| 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 IPs in Networking V2 API
18 """
19
20 from yakumo import base
21 from yakumo.constant import UNDEF
22 from yakumo import mapper
23
24
25 ATTRIBUTE_MAPPING = [
26 ('id', 'id', mapper.Noop),
27 ('name', 'name', mapper.Noop),
28 ('status', 'status', mapper.Noop),
29 ('floating_network', 'floating_network_id',
30 mapper.Resource('neutron.network')),
31 ('floating_ip', 'floating_ip_address', mapper.Noop),
32 ('fixed_ip', 'fixed_ip_address', mapper.Noop),
33 ('router', 'router_id', mapper.Resource('neutron.router')),
34 ('port', 'port_id', mapper.Resource('neutron.port')),
35 ('project', 'tenant_id', mapper.Resource('project')),
36 ]
37
38
40 """Resource class for floating IPs in Networking V2 API"""
41
43 """
44 Update a floting IP address
45
46 @keyword floating_ip: Floating IP address
47 @type floating_ip: str
48 @keyword port: Port
49 @type port: yakumo.neutron.v2.port
50 @rtype: None
51 """
52 super(Resource, self).update(
53 floating_ip=floating_ip,
54 port=port
55 )
56
58 """
59 Associate a floting IP address with a port
60
61 @keyword port: Port
62 @type port: yakumo.neutron.v2.port
63 @rtype: None
64 """
65 super(Resource, self).update(port=port)
66
74
75
77 """Manager class for floating IPs in Networking V2 API"""
78
79 resource_class = Resource
80 service_type = 'network'
81 _attr_mapping = ATTRIBUTE_MAPPING
82 _json_resource_key = 'floatingip'
83 _json_resources_key = 'floatingips'
84 _url_resource_path = '/v2.0/floatingips'
85
86 - def create(self, project=UNDEF, floating_network=UNDEF,
87 fixed_ip=UNDEF, floating_ip=UNDEF, port=UNDEF):
88 """
89 Aquire a floating IP address
90
91 @keyword project: Project
92 @type project: yakumo.project.Resource
93 @keyword floating_network: Network
94 @type floating_network: yakumo.neutron.v2.network.Resource
95 @keyword fixed_ip: Fixed IP address to map
96 @type fixed_ip: str
97 @keyword port: Port
98 @type port: yakumo.neutron.v2.port
99 @return: Mapped Floating IP address
100 @rtype: yakumo.neutron.v2.floating_ip.Resource
101 """
102 return super(Manager, self).create(
103 project=project,
104 floating_network=floating_network,
105 fixed_ip=fixed_ip,
106 floating_ip=floating_ip,
107 port=port
108 )
109
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Sat Mar 4 23:02:25 2017 | http://epydoc.sourceforge.net |