Coverage for nova/api/openstack/compute/schemas/hosts.py: 100%

7 statements  

« prev     ^ index     » next       coverage.py v7.6.12, created at 2025-04-17 15:08 +0000

1# Copyright 2014 NEC Corporation. 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 

15from nova.api.validation import parameter_types 

16 

17update = { 

18 'type': 'object', 

19 'properties': { 

20 'status': { 

21 'type': 'string', 

22 'enum': ['enable', 'disable', 

23 'Enable', 'Disable', 

24 'ENABLE', 'DISABLE'], 

25 }, 

26 'maintenance_mode': { 

27 'type': 'string', 

28 'enum': ['enable', 'disable', 

29 'Enable', 'Disable', 

30 'ENABLE', 'DISABLE'], 

31 }, 

32 }, 

33 'anyOf': [ 

34 {'required': ['status']}, 

35 {'required': ['maintenance_mode']} 

36 ], 

37 'additionalProperties': False, 

38} 

39 

40index_query = { 

41 'type': 'object', 

42 'properties': { 

43 'zone': parameter_types.multi_params({'type': 'string'}) 

44 }, 

45 # NOTE(gmann): This is kept True to keep backward compatibility. 

46 # As of now Schema validation stripped out the additional parameters and 

47 # does not raise 400. This API is deprecated in microversion 2.43 so we 

48 # do not to update the additionalProperties to False. 

49 'additionalProperties': True 

50} 

51 

52# NOTE(stephenfin): These schemas are intentionally empty since these APIs are 

53# deprecated proxy APIs 

54startup_query = {} 

55shutdown_query = {} 

56reboot_query = {} 

57show_query = {}