| Home | Trees | Indices | Help |
|---|
|
|
1 # Copyright 2014-2017 by Akira Yoshiyama <akirayoshiyama@gmail.com>.
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 """
17 Resource class and its manager for floating IP DNS entries in Compute API v2
18 """
19
20 from yakumo import base
21 from yakumo.constant import UNDEF
22 from yakumo import mapper
23 from yakumo import utils
24
25
26 ATTRIBUTE_MAPPING = [
27 ('domain', 'domain', mapper.Noop),
28 ('project', 'project', mapper.Resource('project')),
29 ('scope', 'scope', mapper.Noop),
30 ('availability_zone', 'availability_zone',
31 mapper.Resource('nova.availability_zone')),
32 ]
33
34
36 """Resource class for floating IP DNS entries in Compute API v2"""
37
40 """
41 Update properties of a domain
42
43 @keyword new_domain: New domain name
44 @type new_domain: str
45 @keyword project: Project object
46 @type project: yakumo.project.Resource
47 @keyword scope: 'public' or 'private'
48 @type scope: str
49 @keyword availability_zone: Availability zone name
50 @type availability_zone: str
51 @rtype: None
52 """
53 self._http.put(self._url_resource_path, self._id,
54 data=utils.get_json_body(
55 'domain_entry',
56 domain=new_domain,
57 project=project,
58 scope=scope,
59 availability_zone=availability_zone))
60
62 """
63 Add an entry
64
65 @keyword name: Hostname
66 @type name: str
67 @keyword ip: IP address
68 @type ip: str
69 @keyword dns_type: DNS type
70 @type dns_type: str
71 @rtype: None
72 """
73 self._http.put(self._url_resource_path, self._id,
74 data=utils.get_json_body(
75 'domain_entry',
76 domain=new_domain,
77 project=project,
78 scope=scope,
79 availability_zone=availability_zone))
80
82 """
83 Remove an entry
84
85 @keyword name: Hostname
86 @type name: str
87 @rtype: None
88 """
89 self._http.delete(self._url_resource_path, self._id, 'entries', name)
90
92 """
93 Get DNS entries for an IP address
94
95 @keyword ip: IP address
96 @type ip: str
97 @return: DNS entries
98 @rtype: [str]
99 """
100 ret = self._http.get(self._url_resource_path, self._id, 'entries',
101 name)
102 return ret.get('dns_entries')
103
104
106 """Manager class for floating IP DNS entries in Compute API v2"""
107
108 resource_class = Resource
109 service_type = 'compute'
110 _attr_mapping = ATTRIBUTE_MAPPING
111 _id_attr = 'domain'
112 _json_resource_key = 'domain_entry'
113 _json_resources_key = 'domain_entries'
114 _url_resource_path = '/os-floating-ip-dns'
115
118 """
119 Create a domain
120
121 @keyword domain: Domain name (str, required)
122 @type domain: str
123 @keyword project: Project object
124 @type project: yakumo.project.Resource
125 @keyword scope: 'public' or 'private' (str)
126 @type scope: str
127 @keyword availability_zone: Availability zone name (str)
128 @type availability_zone: str
129 @rtype: None
130 """
131 self._http.put(self._url_resource_path, domain,
132 data=utils.get_json_body(
133 'domain_entry',
134 domain=domain,
135 project=project,
136 scope=scope,
137 availability_zone=availability_zone))
138
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Sat Mar 4 23:02:25 2017 | http://epydoc.sourceforge.net |