Coverage for manila/api/schemas/share_export_locations.py: 100%

26 statements  

« 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. 

12 

13import copy 

14from manila.api.validation import parameter_types 

15 

16empty_query_schema = {} 

17 

18show_metadata_request_body = { 

19 'type': 'object', 

20 'properties': { 

21 'key': { 

22 'type': 'string', 

23 } 

24 }, 

25 # TODO(jonathan): Exclude additional query string parameters in a future 

26 # micro-version 

27 'required': ['key'], 

28 'additionalProperties': True 

29} 

30 

31update_metadata_request_body = { 

32 'type': 'object', 

33 'properties': { 

34 'metadata': parameter_types.metadata, 

35 }, 

36 # TODO(jonathan): Exclude additional query string parameters in a future 

37 # micro-version 

38 'required': ['metadata'], 

39 'additionalProperties': True 

40} 

41 

42create_metadata_response_body = { 

43 'type': 'object', 

44 'properties': { 

45 'metadata': parameter_types.metadata, 

46 }, 

47 # TODO(jonathan): Exclude additional query string parameters in a future 

48 # micro-version 

49 'required': ['metadata'], 

50 'additionalProperties': True 

51} 

52 

53delete_metadata_request_body = { 

54 'type': 'object', 

55 'properties': { 

56 'key': { 

57 'type': 'string', 

58 } 

59 }, 

60 # TODO(jonathan): Exclude additional query string parameters in a future 

61 # micro-version 

62 'required': ['key'], 

63 'additionalProperties': True 

64} 

65 

66index_response_body = { 

67 'type': 'object', 

68 'properties': { 

69 'export_locations': { 

70 'type': 'array', 

71 'items': { 

72 'type': 'object', 

73 'properties': { 

74 'id': { 

75 'type': 'string', 

76 'x-openstack': {'apiref': 'export_location_id'}, 

77 }, 

78 'is_admin_only': { 

79 'type': 'boolean', 

80 'x-openstack': { 

81 'apiref': 'export_location_is_admin_only'}, 

82 }, 

83 'path': { 

84 'type': 'string', 

85 'x-openstack': {'apiref': 'export_location_path'}, 

86 }, 

87 'share_instance_id': { 

88 'type': 'string', 

89 'x-openstack': {'apiref': 'share_instance_id'}, 

90 }, 

91 }, 

92 'required': ['id', 'path'], 

93 'additionalProperties': False, 

94 }, 

95 } 

96 }, 

97 'required': ['export_locations'], 

98 'additionalProperties': False, 

99 'x-openstack': {'apiref': 'export_locations'}, 

100} 

101 

102index_response_body_v214 = copy.deepcopy(index_response_body) 

103index_response_body_v214['properties']['export_locations']['items'][ 

104 'properties' 

105].update( 

106 { 

107 'preferred': { 

108 'type': 'boolean', 

109 'x-openstack': {'apiref': 'export_location_preferred'}, 

110 } 

111 } 

112) 

113index_response_body_v214['properties']['export_locations']['items'][ 

114 'required'].append('preferred') 

115 

116index_response_body_v287 = copy.deepcopy(index_response_body_v214) 

117index_response_body_v287['properties']['export_locations']['items'][ 

118 'properties' 

119].update({ 

120 'metadata': { 

121 'type': 'object', 

122 'patternProperties': { 

123 '^[a-zA-Z0-9-_:. ]{1,255}$': { 

124 'type': 'string', 

125 } 

126 }, 

127 } 

128 }) 

129index_response_body_v287['properties']['export_locations']['items'][ 

130 'required'].append('metadata') 

131 

132show_response_body = { 

133 'type': 'object', 

134 'properties': { 

135 'export_location': { 

136 'type': 'object', 

137 'properties': { 

138 'created_at': { 

139 'type': 'string', 

140 'format': 'date-time', 

141 'readonly': True, 

142 'x-openstack': { 

143 'apiref': 'created_at', 

144 }, 

145 }, 

146 'id': { 

147 'type': 'string', 

148 'readonly': True, 

149 'x-openstack': { 

150 'apiref': 'export_location_id', 

151 }, 

152 }, 

153 'is_admin_only': { 

154 'type': 'boolean', 

155 'x-openstack': { 

156 'apiref': 'export_location_is_admin_only', 

157 }, 

158 }, 

159 'path': { 

160 'type': 'string', 

161 'x-openstack': { 

162 'apiref': 'export_location_path', 

163 }, 

164 }, 

165 'updated_at': { 

166 'type': 'string', 

167 'format': 'date-time', 

168 'readonly': True, 

169 'x-openstack': { 

170 'apiref': 'updated_at', 

171 }, 

172 }, 

173 'share_instance_id': { 

174 'type': 'string', 

175 'x-openstack': { 

176 'apiref': 'share_instance_id', 

177 }, 

178 }, 

179 }, 

180 'required': [ 

181 'created_at', 

182 'id', 

183 'path', 

184 'updated_at', 

185 ], 

186 'additionalProperties': False, 

187 'x-openstack': { 

188 'apiref': 'export_location', 

189 }, 

190 } 

191 }, 

192 'required': ['export_location'], 

193 'additionalProperties': False, 

194} 

195 

196show_response_body_v214 = copy.deepcopy(show_response_body) 

197_ex_loc = show_response_body_v214['properties']['export_location'] 

198_ex_loc['properties'].update( 

199 { 

200 'preferred': { 

201 'type': 'boolean', 

202 'x-openstack': { 

203 'apiref': 'export_location_preferred'}, 

204 } 

205 } 

206) 

207_ex_loc['required'].append('preferred') 

208 

209show_response_body_v287 = copy.deepcopy(show_response_body_v214) 

210show_response_body_v287['properties']['export_location']['properties'].update({ 

211 'metadata': parameter_types.metadata 

212}) 

213(show_response_body_v287['properties']['export_location']['required'] 

214 .append('metadata')) 

215 

216show_metadata_response_body = { 

217 'type': 'object', 

218 'properties': { 

219 'meta': parameter_types.metadata 

220 }, 

221 'required': ['meta'], 

222 'additionalProperties': False, 

223} 

224 

225update_metadata_response_body = { 

226 'type': 'object', 

227 'properties': { 

228 'metadata': parameter_types.metadata, 

229 }, 

230 'required': ['metadata'], 

231 'additionalProperties': False, 

232} 

233create_metadata_response_body = { 

234 'type': 'object', 

235 'properties': { 

236 'metadata': parameter_types.metadata, 

237 }, 

238 'required': ['metadata'], 

239 'additionalProperties': False, 

240} 

241 

242delete_metadata_response_body = {}