Coverage for manila/api/schemas/quota_class_sets.py: 100%
43 statements
« prev ^ index » next coverage.py v7.11.0, created at 2026-02-18 22:19 +0000
« prev ^ index » next coverage.py v7.11.0, created at 2026-02-18 22:19 +0000
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.
13import copy
15from manila.api.validation import helpers
17show_request_query = {
18 'type': 'object',
19 'properties': {},
20 # TODO(jonathan): Exclude additional query string parameters
21 # in a future microversion
22 'additionalProperties': True,
23}
25_request_quota_prop = {
26 'type': 'object',
27 'properties': {
28 'gigabytes': {
29 'type': 'integer',
30 'description': helpers.description('quota_gigabytes_request'),
31 },
32 'shares': {
33 'type': 'integer',
34 'description': helpers.description('quota_shares_request'),
35 },
36 'share_networks': {
37 'type': 'integer',
38 'description': helpers.description('quota_share_networks_request'),
39 },
40 'share_groups': {
41 'type': 'integer',
42 'description': helpers.description('quota_share_groups_request'),
43 },
44 'snapshot_gigabytes': {
45 'type': 'integer',
46 'description': helpers.description(
47 'quota_snapshot_gigabytes_request'
48 ),
49 },
50 'snapshots': {
51 'type': 'integer',
52 'description': helpers.description('quota_snapshots_request'),
53 },
54 },
55 'description': helpers.description('quota_class_set'),
56 # TODO(jonathan): Exclude additional query string parameters
57 # in a future microversion
58 'additionalProperties': True,
59}
61_request_quota_prop_v253 = copy.deepcopy(_request_quota_prop)
62_request_quota_prop_v253['properties'].update(
63 {
64 'share_replicas': {
65 'type': 'integer',
66 'description': helpers.description('quota_share_replicas_request'),
67 },
68 'replica_gigabytes': {
69 'type': 'integer',
70 'description': helpers.description(
71 'quota_replica_gigabytes_request'
72 ),
73 },
74 }
75)
77_request_quota_prop_v262 = copy.deepcopy(_request_quota_prop_v253)
78_request_quota_prop_v262['properties'].update(
79 {
80 'per_share_gigabytes': {
81 'type': 'integer',
82 'description': helpers.description(
83 'quota_per_share_gigabytes_request'
84 ),
85 },
86 }
87)
89_request_quota_prop_v280 = copy.deepcopy(_request_quota_prop_v262)
90_request_quota_prop_v280['properties'].update(
91 {
92 'backups': {
93 'type': 'integer',
94 'description': helpers.description('quota_backups_request'),
95 },
96 'backup_gigabytes': {
97 'type': 'integer',
98 'description': helpers.description(
99 'quota_backup_gigabytes_request'
100 ),
101 },
102 }
103)
105_request_quota_prop_v290 = copy.deepcopy(_request_quota_prop_v280)
106_request_quota_prop_v290['properties'].update(
107 {
108 'encryption_keys': {
109 'type': 'integer',
110 'description': helpers.description(
111 'quota_encryption_keys_request'
112 ),
113 },
114 }
115)
117update_request_body = {
118 'type': 'object',
119 'properties': {
120 'quota_class_set': _request_quota_prop,
121 },
122 'description': helpers.description('quota_class_set'),
123 'required': ['quota_class_set'],
124 # TODO(jonathan): Exclude additional query string parameters
125 # in a future microversion
126 'additionalProperties': True,
127}
129update_request_body_v253 = copy.deepcopy(update_request_body)
130update_request_body_v253['properties']['quota_class_set'] = (
131 _request_quota_prop_v253
132)
134update_request_body_v262 = copy.deepcopy(update_request_body_v253)
135update_request_body_v262['properties']['quota_class_set'] = (
136 _request_quota_prop_v262
137)
139update_request_body_v280 = copy.deepcopy(update_request_body_v262)
140update_request_body_v280['properties']['quota_class_set'] = (
141 _request_quota_prop_v280
142)
144update_request_body_v290 = copy.deepcopy(update_request_body_v280)
145update_request_body_v290['properties']['quota_class_set'] = (
146 _request_quota_prop_v290
147)
149show_response_body = {
150 'type': 'object',
151 'properties': {
152 'quota_class_set': {
153 'type': 'object',
154 'properties': {
155 'gigabytes': {
156 'type': 'integer',
157 'description': helpers.description('quota_gigabytes'),
158 },
159 'id': {
160 'type': 'string',
161 'description': helpers.description('quota_class_id'),
162 },
163 'snapshots': {
164 'type': 'integer',
165 'description': helpers.description('quota_snapshots'),
166 },
167 'snapshot_gigabytes': {
168 'type': 'integer',
169 'description': helpers.description(
170 'quota_snapshot_gigabytes'
171 ),
172 },
173 'shares': {
174 'type': 'integer',
175 'description': helpers.description('quota_shares'),
176 },
177 'share_networks': {
178 'type': 'integer',
179 'description': helpers.description(
180 'quota_share_networks_default'
181 ),
182 },
183 },
184 'required': [
185 'gigabytes',
186 'snapshots',
187 'snapshot_gigabytes',
188 'shares',
189 'share_networks',
190 ],
191 'additionalProperties': False,
192 },
193 },
194 'description': helpers.description('quota_class_set'),
195 'required': ['quota_class_set'],
196 'additionalProperties': False,
197}
199show_response_body_v240 = copy.deepcopy(show_response_body)
200show_response_body_v240['properties']['quota_class_set']['properties'].update(
201 {
202 'share_group_snapshots': {
203 'type': 'integer',
204 'description': helpers.description('quota_share_group_snapshots'),
205 },
206 'share_groups': {
207 'type': 'integer',
208 'description': helpers.description('quota_share_groups'),
209 },
210 }
211)
212show_response_body_v240['properties']['quota_class_set']['required'].extend(
213 ['share_group_snapshots', 'share_groups']
214)
216show_response_body_v253 = copy.deepcopy(show_response_body_v240)
217show_response_body_v253['properties']['quota_class_set']['properties'].update(
218 {
219 'share_replicas': {
220 'type': 'integer',
221 'description': helpers.description('quota_share_replicas'),
222 },
223 'replica_gigabytes': {
224 'type': 'integer',
225 'description': helpers.description('quota_replica_gigabytes'),
226 },
227 }
228)
229show_response_body_v253['properties']['quota_class_set']['required'].extend(
230 ['share_replicas', 'replica_gigabytes']
231)
233show_response_body_v262 = copy.deepcopy(show_response_body_v253)
234show_response_body_v262['properties']['quota_class_set']['properties'].update(
235 {
236 'per_share_gigabytes': {
237 'type': 'integer',
238 'description': helpers.description('quota_per_share_gigabytes'),
239 }
240 }
241)
242show_response_body_v262['properties']['quota_class_set']['required'].append(
243 'per_share_gigabytes'
244)
246show_response_body_v280 = copy.deepcopy(show_response_body_v262)
247show_response_body_v280['properties']['quota_class_set']['properties'].update(
248 {
249 'backups': {
250 'type': 'integer',
251 'description': helpers.description('quota_backups'),
252 },
253 'backup_gigabytes': {
254 'type': 'integer',
255 'description': helpers.description('quota_backup_gigabytes'),
256 },
257 }
258)
259show_response_body_v280['properties']['quota_class_set']['required'].extend(
260 ['backups', 'backup_gigabytes']
261)
263show_response_body_v290 = copy.deepcopy(show_response_body_v280)
264show_response_body_v290['properties']['quota_class_set']['properties'].update(
265 {
266 'encryption_keys': {
267 'type': 'integer',
268 'description': helpers.description('quota_encryption_keys'),
269 },
270 }
271)
272show_response_body_v290['properties']['quota_class_set']['required'].append(
273 'encryption_keys'
274)
276update_response_body = show_response_body
277update_response_body_v240 = show_response_body_v240
278update_response_body_v253 = show_response_body_v253
279update_response_body_v262 = show_response_body_v262
280update_response_body_v280 = show_response_body_v280
281update_response_body_v290 = show_response_body_v290