Debian Codegraph @

neutronclient/neutron/v2_0/availability_zone.py

raw
1 # Licensed under the Apache License, Version 2.0 (the "License"); you may
2 # not use this file except in compliance with the License. You may obtain
3 # a copy of the License at
4 #
5 # http://www.apache.org/licenses/LICENSE-2.0
6 #
7 # Unless required by applicable law or agreed to in writing, software
8 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10 # License for the specific language governing permissions and limitations
11 # under the License.
12
13 from neutronclient._i18n import _
14 from neutronclient.neutron import v2_0 as neutronv20
15
16
17 def add_az_hint_argument(parser, resource):
18 parser.add_argument(
19 '--availability-zone-hint', metavar='AVAILABILITY_ZONE',
20 action='append', dest='availability_zone_hints',
21 help=_('Availability Zone for the %s '
22 '(requires availability zone extension, '
23 'this option can be repeated).') % resource)
24
25
26 def args2body_az_hint(parsed_args, resource):
27 if parsed_args.availability_zone_hints:
28 resource['availability_zone_hints'] = (
29 parsed_args.availability_zone_hints)
30
31
32 class ListAvailabilityZone(neutronv20.ListCommand):
33 """List availability zones."""
34
35 resource = 'availability_zone'
36 list_columns = ['name', 'resource', 'state']
37 pagination_support = True
38 sorting_support = True