| 1 |
# Copyright (C) 2013 eNovance SAS <[email protected]> |
| 2 |
# |
| 3 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 |
# not use this file except in compliance with the License. You may obtain |
| 5 |
# a copy of the License at |
| 6 |
# |
| 7 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
# |
| 9 |
# Unless required by applicable law or agreed to in writing, software |
| 10 |
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 |
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 |
# License for the specific language governing permissions and limitations |
| 13 |
# under the License. |
| 14 |
|
| 15 |
from neutron_lib.api import converters |
| 16 |
from neutron_lib import constants |
| 17 |
from neutron_lib.db import constants as db_const |
| 18 |
from neutron_lib.services.qos import constants as qos_consts |
| 19 |
|
| 20 |
|
| 21 |
METERING_LABELS = 'metering_labels' |
| 22 |
METERING_LABEL_RULES = 'metering_label_rules' |
| 23 |
|
| 24 |
ALIAS = 'metering' |
| 25 |
IS_SHIM_EXTENSION = False |
| 26 |
IS_STANDARD_ATTR_EXTENSION = False |
| 27 |
NAME = 'Neutron Metering' |
| 28 |
API_PREFIX = '' |
| 29 |
DESCRIPTION = 'Neutron Metering extension.' |
| 30 |
UPDATED_TIMESTAMP = '2013-06-12T10:00:00-00:00' |
| 31 |
RESOURCE_ATTRIBUTE_MAP = { |
| 32 |
METERING_LABELS: { |
| 33 |
'id': { |
| 34 |
'allow_post': False, 'allow_put': False, |
| 35 |
'is_visible': True, |
| 36 |
'is_filter': True, |
| 37 |
'is_sort_key': True, |
| 38 |
'primary_key': True |
| 39 |
}, |
| 40 |
'name': { |
| 41 |
'allow_post': True, 'allow_put': False, |
| 42 |
'validate': {'type:string': db_const.NAME_FIELD_SIZE}, |
| 43 |
'is_filter': True, 'is_sort_key': True, |
| 44 |
'is_visible': True, 'default': '' |
| 45 |
}, |
| 46 |
'description': { |
| 47 |
'allow_post': True, 'allow_put': False, |
| 48 |
'validate': { |
| 49 |
'type:string': db_const.LONG_DESCRIPTION_FIELD_SIZE}, |
| 50 |
'is_filter': True, 'is_sort_key': True, |
| 51 |
'is_visible': True, 'default': '' |
| 52 |
}, |
| 53 |
'tenant_id': { |
| 54 |
'allow_post': True, 'allow_put': False, |
| 55 |
'required_by_policy': True, |
| 56 |
'validate': { |
| 57 |
'type:string': db_const.PROJECT_ID_FIELD_SIZE}, |
| 58 |
'is_filter': True, 'is_sort_key': True, |
| 59 |
'is_visible': True |
| 60 |
}, |
| 61 |
constants.SHARED: { |
| 62 |
'allow_post': True, 'allow_put': False, |
| 63 |
'is_filter': True, 'is_sort_key': True, |
| 64 |
'is_visible': True, 'default': False, |
| 65 |
'convert_to': converters.convert_to_boolean |
| 66 |
} |
| 67 |
}, |
| 68 |
METERING_LABEL_RULES: { |
| 69 |
'id': { |
| 70 |
'allow_post': False, 'allow_put': False, |
| 71 |
'is_visible': True, 'is_filter': True, |
| 72 |
'is_sort_key': True, 'primary_key': True |
| 73 |
}, |
| 74 |
'metering_label_id': { |
| 75 |
'allow_post': True, 'allow_put': False, |
| 76 |
'validate': {'type:uuid': None}, |
| 77 |
'is_filter': True, 'is_sort_key': True, |
| 78 |
'is_visible': True, 'required_by_policy': True |
| 79 |
}, |
| 80 |
qos_consts.DIRECTION: { |
| 81 |
'allow_post': True, 'allow_put': False, |
| 82 |
'is_visible': True, 'is_filter': True, |
| 83 |
'is_sort_key': True, |
| 84 |
'validate': {'type:values': constants.VALID_DIRECTIONS} |
| 85 |
}, |
| 86 |
'excluded': { |
| 87 |
'allow_post': True, 'allow_put': False, |
| 88 |
'is_visible': True, 'default': False, |
| 89 |
'is_filter': True, 'is_sort_key': True, |
| 90 |
'convert_to': converters.convert_to_boolean |
| 91 |
}, |
| 92 |
'remote_ip_prefix': { |
| 93 |
'allow_post': True, 'allow_put': False, |
| 94 |
'is_visible': True, 'required_by_policy': True, |
| 95 |
'is_filter': True, 'is_sort_key': True, |
| 96 |
'validate': {'type:subnet': None} |
| 97 |
}, |
| 98 |
'tenant_id': { |
| 99 |
'allow_post': True, 'allow_put': False, |
| 100 |
'required_by_policy': True, |
| 101 |
'validate': {'type:string': db_const.PROJECT_ID_FIELD_SIZE}, |
| 102 |
'is_visible': True |
| 103 |
} |
| 104 |
} |
| 105 |
} |
| 106 |
SUB_RESOURCE_ATTRIBUTE_MAP = {} |
| 107 |
ACTION_MAP = {} |
| 108 |
REQUIRED_EXTENSIONS = [] |
| 109 |
OPTIONAL_EXTENSIONS = [] |
| 110 |
ACTION_STATUS = {} |