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

24 statements  

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

1# Copyright 2013 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 

15import copy 

16 

17from nova.api.validation import parameter_types 

18 

19 

20create = { 

21 'type': 'object', 

22 'properties': { 

23 'keypair': { 

24 'type': 'object', 

25 'properties': { 

26 'name': parameter_types.keypair_name_special_chars, 

27 'public_key': {'type': 'string'}, 

28 }, 

29 'required': ['name'], 

30 'additionalProperties': False, 

31 }, 

32 }, 

33 'required': ['keypair'], 

34 'additionalProperties': False, 

35} 

36 

37 

38create_v20 = copy.deepcopy(create) 

39create_v20['properties']['keypair']['properties']['name'] = (parameter_types. 

40 name_with_leading_trailing_spaces) 

41 

42 

43create_v22 = { 

44 'type': 'object', 

45 'properties': { 

46 'keypair': { 

47 'type': 'object', 

48 'properties': { 

49 'name': parameter_types.keypair_name_special_chars, 

50 'type': { 

51 'type': 'string', 

52 'enum': ['ssh', 'x509'] 

53 }, 

54 'public_key': {'type': 'string'}, 

55 }, 

56 'required': ['name'], 

57 'additionalProperties': False, 

58 }, 

59 }, 

60 'required': ['keypair'], 

61 'additionalProperties': False, 

62} 

63 

64create_v210 = { 

65 'type': 'object', 

66 'properties': { 

67 'keypair': { 

68 'type': 'object', 

69 'properties': { 

70 'name': parameter_types.keypair_name_special_chars, 

71 'type': { 

72 'type': 'string', 

73 'enum': ['ssh', 'x509'] 

74 }, 

75 'public_key': {'type': 'string'}, 

76 'user_id': {'type': 'string'}, 

77 }, 

78 'required': ['name'], 

79 'additionalProperties': False, 

80 }, 

81 }, 

82 'required': ['keypair'], 

83 'additionalProperties': False, 

84} 

85 

86create_v292 = copy.deepcopy(create_v210) 

87create_v292['properties']['keypair']['properties']['name'] = (parameter_types. 

88 keypair_name_special_chars_292) 

89create_v292['properties']['keypair']['required'] = ['name', 'public_key'] 

90 

91index_query_schema_v20 = { 

92 'type': 'object', 

93 'properties': {}, 

94 'additionalProperties': True 

95} 

96 

97index_query_schema_v210 = { 

98 'type': 'object', 

99 'properties': { 

100 'user_id': parameter_types.multi_params({'type': 'string'}) 

101 }, 

102 'additionalProperties': True 

103} 

104 

105index_query_schema_v235 = copy.deepcopy(index_query_schema_v210) 

106index_query_schema_v235['properties'].update( 

107 parameter_types.pagination_parameters) 

108 

109show_query_schema_v20 = index_query_schema_v20 

110show_query_schema_v210 = index_query_schema_v210 

111delete_query_schema_v20 = index_query_schema_v20 

112delete_query_schema_v210 = index_query_schema_v210 

113 

114index_query_schema_v275 = copy.deepcopy(index_query_schema_v235) 

115index_query_schema_v275['additionalProperties'] = False 

116show_query_schema_v275 = copy.deepcopy(show_query_schema_v210) 

117show_query_schema_v275['additionalProperties'] = False 

118delete_query_schema_v275 = copy.deepcopy(delete_query_schema_v210) 

119delete_query_schema_v275['additionalProperties'] = False