summaryrefslogtreecommitdiff
path: root/novaclient/v2/fping.py
diff options
context:
space:
mode:
Diffstat (limited to 'novaclient/v2/fping.py')
-rw-r--r--novaclient/v2/fping.py64
1 files changed, 64 insertions, 0 deletions
diff --git a/novaclient/v2/fping.py b/novaclient/v2/fping.py
new file mode 100644
index 0000000..ac958d4
--- /dev/null
+++ b/novaclient/v2/fping.py
@@ -0,0 +1,64 @@
1# Copyright 2012 OpenStack Foundation
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16"""
17Fping interface.
18"""
19
20from novaclient import base
21
22
23class Fping(base.Resource):
24 """
25 A server to fping.
26 """
27 HUMAN_ID = True
28
29 def __repr__(self):
30 return "<Fping: %s>" % self.id
31
32
33class FpingManager(base.ManagerWithFind):
34 """
35 Manage :class:`Fping` resources.
36 """
37 resource_class = Fping
38
39 def list(self, all_tenants=False, include=[], exclude=[]):
40 """
41 Fping all servers.
42
43 :rtype: list of :class:`Fping`.
44 """
45 params = []
46 if all_tenants:
47 params.append("all_tenants=1")
48 if include:
49 params.append("include=%s" % ",".join(include))
50 elif exclude:
51 params.append("exclude=%s" % ",".join(exclude))
52 uri = "/os-fping"
53 if params:
54 uri = "%s?%s" % (uri, "&".join(params))
55 return self._list(uri, "servers")
56
57 def get(self, server):
58 """
59 Fping a specific server.
60
61 :param network: ID of the server to fping.
62 :rtype: :class:`Fping`
63 """
64 return self._get("/os-fping/%s" % base.getid(server), "server")