Debian Codegraph @

neutron_lib/api/definitions/logging.py

raw
1 # All rights reserved.
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.db import constants as db_const
17
18 # The alias of the extension.
19 ALIAS = 'logging'
20
21 # Whether or not this extension is simply signaling behavior to the user
22 # or it actively modifies the attribute map.
23 IS_SHIM_EXTENSION = False
24
25 # Whether the extension is marking the adoption of standardattr model for
26 # legacy resources, or introducing new standardattr attributes. False or
27 # None if the standardattr model is adopted since the introduction of
28 # resource extension.
29 # If this is True, the alias for the extension should be prefixed with
30 # 'standard-attr-'.
31 IS_STANDARD_ATTR_EXTENSION = False
32
33 # The name of the extension.
34 NAME = 'Logging API Extension'
35
36 # A prefix for API resources. An empty prefix means that the API is going
37 # to be exposed at the v2/ level as any other core resource.
38 API_PREFIX = '/log'
39
40 # The description of the extension.
41 DESCRIPTION = ("Provides a logging API for resources such as "
42 "security group and firewall.")
43
44 # A timestamp of when the extension was introduced.
45 UPDATED_TIMESTAMP = "2017-01-01T10:00:00-00:00"
46
47 LOGS = 'logs'
48 LOG_TYPES = 'loggable_resources'
49
50 ACCEPT_EVENT = 'ACCEPT'
51 DROP_EVENT = 'DROP'
52 ALL_EVENT = 'ALL'
53 LOG_EVENTS = [ACCEPT_EVENT, DROP_EVENT, ALL_EVENT]
54
55 # Attribute Map
56 RESOURCE_ATTRIBUTE_MAP = {
57 LOGS: {
58 'id': {'allow_post': False, 'allow_put': False,
59 'validate': {'type:uuid': None},
60 'is_visible': True,
61 'is_filter': True, 'is_sort_key': True,
62 'primary_key': True},
63 'project_id': {'allow_post': True, 'allow_put': False,
64 'required_by_policy': True,
65 'validate': {
66 'type:string':
67 db_const.PROJECT_ID_FIELD_SIZE},
68 'is_filter': True, 'is_sort_key': True,
69 'is_visible': True},
70 'name': {'allow_post': True, 'allow_put': True,
71 'validate': {'type:string': db_const.NAME_FIELD_SIZE},
72 'is_filter': True, 'is_sort_key': True,
73 'default': '', 'is_visible': True},
74 'resource_type': {'allow_post': True, 'allow_put': False,
75 'required_by_policy': True,
76 'validate': {
77 'type:string':
78 db_const.RESOURCE_TYPE_FIELD_SIZE},
79 'is_filter': True, 'is_sort_key': True,
80 'is_visible': True},
81 'resource_id': {'allow_post': True, 'allow_put': False,
82 'validate': {'type:uuid_or_none': None},
83 'is_filter': True, 'is_sort_key': True,
84 'default': None, 'is_visible': True},
85 'event': {'allow_post': True, 'allow_put': False,
86 'validate': {'type:values': LOG_EVENTS},
87 'is_filter': True,
88 'default': ALL_EVENT, 'is_visible': True},
89 'target_id': {'allow_post': True, 'allow_put': False,
90 'validate': {'type:uuid_or_none': None},
91 'is_filter': True, 'is_sort_key': True,
92 'default': None, 'is_visible': True},
93 'enabled': {'allow_post': True, 'allow_put': True,
94 'is_visible': True, 'default': True,
95 'is_filter': True, 'is_sort_key': True,
96 'convert_to': converters.convert_to_boolean},
97 },
98 LOG_TYPES: {
99 'type': {'allow_post': False, 'allow_put': False,
100 'is_visible': True}},
101 }
102
103 # The subresource attribute map for the extension. This extension has only
104 # top level resources, not child resources, so this is set to an empty dict.
105 SUB_RESOURCE_ATTRIBUTE_MAP = {}
106
107 # The action map.
108 ACTION_MAP = {}
109
110 # The list of required extensions.
111 REQUIRED_EXTENSIONS = []
112
113 # The action status.
114 ACTION_STATUS = {}
115
116 # The list of optional extensions.
117 OPTIONAL_EXTENSIONS = ['security-group', 'fwaas_v2']