pulp_ansible_client 0.2.0b1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +79 -0
  4. data/README.md +150 -0
  5. data/Rakefile +10 -0
  6. data/docs/AnsibleCollectionsApi.md +66 -0
  7. data/docs/AnsibleDistribution.md +31 -0
  8. data/docs/AnsibleRemote.md +45 -0
  9. data/docs/AsyncOperationResponse.md +17 -0
  10. data/docs/Collection.md +41 -0
  11. data/docs/CollectionRemote.md +47 -0
  12. data/docs/ContentCollectionsApi.md +134 -0
  13. data/docs/ContentRolesApi.md +186 -0
  14. data/docs/DistributionsAnsibleApi.md +352 -0
  15. data/docs/GalaxyCollection.md +25 -0
  16. data/docs/GalaxyRole.md +21 -0
  17. data/docs/GalaxyRoleVersion.md +19 -0
  18. data/docs/InlineResponse200.md +23 -0
  19. data/docs/InlineResponse2001.md +23 -0
  20. data/docs/InlineResponse2002.md +23 -0
  21. data/docs/InlineResponse2003.md +23 -0
  22. data/docs/InlineResponse2004.md +23 -0
  23. data/docs/InlineResponse2005.md +23 -0
  24. data/docs/InlineResponse2006.md +23 -0
  25. data/docs/InlineResponse2007.md +23 -0
  26. data/docs/PulpAnsibleApiApi.md +60 -0
  27. data/docs/PulpAnsibleGalaxyApiCollectionsApi.md +113 -0
  28. data/docs/PulpAnsibleGalaxyApiRolesApi.md +67 -0
  29. data/docs/PulpAnsibleGalaxyApiV1VersionsApi.md +69 -0
  30. data/docs/PulpAnsibleGalaxyApiV2VersionsApi.md +67 -0
  31. data/docs/RemotesAnsibleApi.md +411 -0
  32. data/docs/RemotesCollectionApi.md +411 -0
  33. data/docs/RepositorySyncURL.md +19 -0
  34. data/docs/Role.md +29 -0
  35. data/git_push.sh +55 -0
  36. data/lib/pulp_ansible_client/api/ansible_collections_api.rb +94 -0
  37. data/lib/pulp_ansible_client/api/content_collections_api.rb +169 -0
  38. data/lib/pulp_ansible_client/api/content_roles_api.rb +228 -0
  39. data/lib/pulp_ansible_client/api/distributions_ansible_api.rb +430 -0
  40. data/lib/pulp_ansible_client/api/pulp_ansible_api_api.rb +80 -0
  41. data/lib/pulp_ansible_client/api/pulp_ansible_galaxy_api_collections_api.rb +140 -0
  42. data/lib/pulp_ansible_client/api/pulp_ansible_galaxy_api_roles_api.rb +88 -0
  43. data/lib/pulp_ansible_client/api/pulp_ansible_galaxy_api_v1_versions_api.rb +94 -0
  44. data/lib/pulp_ansible_client/api/pulp_ansible_galaxy_api_v2_versions_api.rb +88 -0
  45. data/lib/pulp_ansible_client/api/remotes_ansible_api.rb +504 -0
  46. data/lib/pulp_ansible_client/api/remotes_collection_api.rb +504 -0
  47. data/lib/pulp_ansible_client/api_client.rb +387 -0
  48. data/lib/pulp_ansible_client/api_error.rb +57 -0
  49. data/lib/pulp_ansible_client/configuration.rb +251 -0
  50. data/lib/pulp_ansible_client/models/ansible_distribution.rb +347 -0
  51. data/lib/pulp_ansible_client/models/ansible_remote.rb +539 -0
  52. data/lib/pulp_ansible_client/models/async_operation_response.rb +202 -0
  53. data/lib/pulp_ansible_client/models/collection.rb +494 -0
  54. data/lib/pulp_ansible_client/models/collection_remote.rb +572 -0
  55. data/lib/pulp_ansible_client/models/galaxy_collection.rb +304 -0
  56. data/lib/pulp_ansible_client/models/galaxy_role.rb +262 -0
  57. data/lib/pulp_ansible_client/models/galaxy_role_version.rb +229 -0
  58. data/lib/pulp_ansible_client/models/inline_response200.rb +235 -0
  59. data/lib/pulp_ansible_client/models/inline_response2001.rb +235 -0
  60. data/lib/pulp_ansible_client/models/inline_response2002.rb +235 -0
  61. data/lib/pulp_ansible_client/models/inline_response2003.rb +235 -0
  62. data/lib/pulp_ansible_client/models/inline_response2004.rb +235 -0
  63. data/lib/pulp_ansible_client/models/inline_response2005.rb +235 -0
  64. data/lib/pulp_ansible_client/models/inline_response2006.rb +235 -0
  65. data/lib/pulp_ansible_client/models/inline_response2007.rb +235 -0
  66. data/lib/pulp_ansible_client/models/repository_sync_url.rb +214 -0
  67. data/lib/pulp_ansible_client/models/role.rb +344 -0
  68. data/lib/pulp_ansible_client/version.rb +15 -0
  69. data/lib/pulp_ansible_client.rb +68 -0
  70. data/pulp_ansible_client.gemspec +45 -0
  71. data/spec/api/ansible_collections_api_spec.rb +48 -0
  72. data/spec/api/content_collections_api_spec.rb +67 -0
  73. data/spec/api/content_roles_api_spec.rb +78 -0
  74. data/spec/api/distributions_ansible_api_spec.rb +116 -0
  75. data/spec/api/pulp_ansible_api_api_spec.rb +46 -0
  76. data/spec/api/pulp_ansible_galaxy_api_collections_api_spec.rb +57 -0
  77. data/spec/api/pulp_ansible_galaxy_api_roles_api_spec.rb +48 -0
  78. data/spec/api/pulp_ansible_galaxy_api_v1_versions_api_spec.rb +49 -0
  79. data/spec/api/pulp_ansible_galaxy_api_v2_versions_api_spec.rb +48 -0
  80. data/spec/api/remotes_ansible_api_spec.rb +130 -0
  81. data/spec/api/remotes_collection_api_spec.rb +130 -0
  82. data/spec/api_client_spec.rb +226 -0
  83. data/spec/configuration_spec.rb +42 -0
  84. data/spec/models/ansible_distribution_spec.rb +83 -0
  85. data/spec/models/ansible_remote_spec.rb +129 -0
  86. data/spec/models/async_operation_response_spec.rb +41 -0
  87. data/spec/models/collection_remote_spec.rb +135 -0
  88. data/spec/models/collection_spec.rb +113 -0
  89. data/spec/models/galaxy_collection_spec.rb +65 -0
  90. data/spec/models/galaxy_role_spec.rb +53 -0
  91. data/spec/models/galaxy_role_version_spec.rb +47 -0
  92. data/spec/models/inline_response2001_spec.rb +59 -0
  93. data/spec/models/inline_response2002_spec.rb +59 -0
  94. data/spec/models/inline_response2003_spec.rb +59 -0
  95. data/spec/models/inline_response2004_spec.rb +59 -0
  96. data/spec/models/inline_response2005_spec.rb +59 -0
  97. data/spec/models/inline_response2006_spec.rb +59 -0
  98. data/spec/models/inline_response2007_spec.rb +59 -0
  99. data/spec/models/inline_response200_spec.rb +59 -0
  100. data/spec/models/repository_sync_url_spec.rb +47 -0
  101. data/spec/models/role_spec.rb +77 -0
  102. data/spec/spec_helper.rb +111 -0
  103. metadata +357 -0
@@ -0,0 +1,539 @@
1
+ =begin
2
+ #Pulp 3 API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: v3
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module PulpAnsibleClient
16
+ class AnsibleRemote
17
+ attr_accessor :_href
18
+
19
+ # Timestamp of creation.
20
+ attr_accessor :_created
21
+
22
+ attr_accessor :_type
23
+
24
+ # A unique name for this remote.
25
+ attr_accessor :name
26
+
27
+ # The URL of an external content source.
28
+ attr_accessor :url
29
+
30
+ # A string containing the PEM encoded CA certificate used to validate the server certificate presented by the remote server. All new line characters must be escaped. Returns SHA256 sum on GET.
31
+ attr_accessor :ssl_ca_certificate
32
+
33
+ # A string containing the PEM encoded client certificate used for authentication. All new line characters must be escaped. Returns SHA256 sum on GET.
34
+ attr_accessor :ssl_client_certificate
35
+
36
+ # A PEM encoded private key used for authentication. Returns SHA256 sum on GET.
37
+ attr_accessor :ssl_client_key
38
+
39
+ # If True, SSL peer validation must be performed.
40
+ attr_accessor :ssl_validation
41
+
42
+ # The proxy URL. Format: scheme://user:password@host:port
43
+ attr_accessor :proxy_url
44
+
45
+ # The username to be used for authentication when syncing.
46
+ attr_accessor :username
47
+
48
+ # The password to be used for authentication when syncing.
49
+ attr_accessor :password
50
+
51
+ # Timestamp of the most recent update of the remote.
52
+ attr_accessor :_last_updated
53
+
54
+ # Total number of simultaneous connections.
55
+ attr_accessor :download_concurrency
56
+
57
+ # The policy to use when downloading content.
58
+ attr_accessor :policy
59
+
60
+ class EnumAttributeValidator
61
+ attr_reader :datatype
62
+ attr_reader :allowable_values
63
+
64
+ def initialize(datatype, allowable_values)
65
+ @allowable_values = allowable_values.map do |value|
66
+ case datatype.to_s
67
+ when /Integer/i
68
+ value.to_i
69
+ when /Float/i
70
+ value.to_f
71
+ else
72
+ value
73
+ end
74
+ end
75
+ end
76
+
77
+ def valid?(value)
78
+ !value || allowable_values.include?(value)
79
+ end
80
+ end
81
+
82
+ # Attribute mapping from ruby-style variable name to JSON key.
83
+ def self.attribute_map
84
+ {
85
+ :'_href' => :'_href',
86
+ :'_created' => :'_created',
87
+ :'_type' => :'_type',
88
+ :'name' => :'name',
89
+ :'url' => :'url',
90
+ :'ssl_ca_certificate' => :'ssl_ca_certificate',
91
+ :'ssl_client_certificate' => :'ssl_client_certificate',
92
+ :'ssl_client_key' => :'ssl_client_key',
93
+ :'ssl_validation' => :'ssl_validation',
94
+ :'proxy_url' => :'proxy_url',
95
+ :'username' => :'username',
96
+ :'password' => :'password',
97
+ :'_last_updated' => :'_last_updated',
98
+ :'download_concurrency' => :'download_concurrency',
99
+ :'policy' => :'policy'
100
+ }
101
+ end
102
+
103
+ # Attribute type mapping.
104
+ def self.openapi_types
105
+ {
106
+ :'_href' => :'String',
107
+ :'_created' => :'DateTime',
108
+ :'_type' => :'String',
109
+ :'name' => :'String',
110
+ :'url' => :'String',
111
+ :'ssl_ca_certificate' => :'String',
112
+ :'ssl_client_certificate' => :'String',
113
+ :'ssl_client_key' => :'String',
114
+ :'ssl_validation' => :'Boolean',
115
+ :'proxy_url' => :'String',
116
+ :'username' => :'String',
117
+ :'password' => :'String',
118
+ :'_last_updated' => :'DateTime',
119
+ :'download_concurrency' => :'Integer',
120
+ :'policy' => :'String'
121
+ }
122
+ end
123
+
124
+ # Initializes the object
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ def initialize(attributes = {})
127
+ if (!attributes.is_a?(Hash))
128
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpAnsibleClient::AnsibleRemote` initialize method"
129
+ end
130
+
131
+ # check to see if the attribute exists and convert string to symbol for hash key
132
+ attributes = attributes.each_with_object({}) { |(k, v), h|
133
+ if (!self.class.attribute_map.key?(k.to_sym))
134
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpAnsibleClient::AnsibleRemote`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
135
+ end
136
+ h[k.to_sym] = v
137
+ }
138
+
139
+ if attributes.key?(:'_href')
140
+ self._href = attributes[:'_href']
141
+ end
142
+
143
+ if attributes.key?(:'_created')
144
+ self._created = attributes[:'_created']
145
+ end
146
+
147
+ if attributes.key?(:'_type')
148
+ self._type = attributes[:'_type']
149
+ end
150
+
151
+ if attributes.key?(:'name')
152
+ self.name = attributes[:'name']
153
+ end
154
+
155
+ if attributes.key?(:'url')
156
+ self.url = attributes[:'url']
157
+ end
158
+
159
+ if attributes.key?(:'ssl_ca_certificate')
160
+ self.ssl_ca_certificate = attributes[:'ssl_ca_certificate']
161
+ end
162
+
163
+ if attributes.key?(:'ssl_client_certificate')
164
+ self.ssl_client_certificate = attributes[:'ssl_client_certificate']
165
+ end
166
+
167
+ if attributes.key?(:'ssl_client_key')
168
+ self.ssl_client_key = attributes[:'ssl_client_key']
169
+ end
170
+
171
+ if attributes.key?(:'ssl_validation')
172
+ self.ssl_validation = attributes[:'ssl_validation']
173
+ end
174
+
175
+ if attributes.key?(:'proxy_url')
176
+ self.proxy_url = attributes[:'proxy_url']
177
+ end
178
+
179
+ if attributes.key?(:'username')
180
+ self.username = attributes[:'username']
181
+ end
182
+
183
+ if attributes.key?(:'password')
184
+ self.password = attributes[:'password']
185
+ end
186
+
187
+ if attributes.key?(:'_last_updated')
188
+ self._last_updated = attributes[:'_last_updated']
189
+ end
190
+
191
+ if attributes.key?(:'download_concurrency')
192
+ self.download_concurrency = attributes[:'download_concurrency']
193
+ end
194
+
195
+ if attributes.key?(:'policy')
196
+ self.policy = attributes[:'policy']
197
+ else
198
+ self.policy = 'immediate'
199
+ end
200
+ end
201
+
202
+ # Show invalid properties with the reasons. Usually used together with valid?
203
+ # @return Array for valid properties with the reasons
204
+ def list_invalid_properties
205
+ invalid_properties = Array.new
206
+ if !@_type.nil? && @_type.to_s.length < 1
207
+ invalid_properties.push('invalid value for "_type", the character length must be great than or equal to 1.')
208
+ end
209
+
210
+ if @name.nil?
211
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
212
+ end
213
+
214
+ if @name.to_s.length < 1
215
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
216
+ end
217
+
218
+ if @url.nil?
219
+ invalid_properties.push('invalid value for "url", url cannot be nil.')
220
+ end
221
+
222
+ if @url.to_s.length < 1
223
+ invalid_properties.push('invalid value for "url", the character length must be great than or equal to 1.')
224
+ end
225
+
226
+ if !@ssl_ca_certificate.nil? && @ssl_ca_certificate.to_s.length < 1
227
+ invalid_properties.push('invalid value for "ssl_ca_certificate", the character length must be great than or equal to 1.')
228
+ end
229
+
230
+ if !@ssl_client_certificate.nil? && @ssl_client_certificate.to_s.length < 1
231
+ invalid_properties.push('invalid value for "ssl_client_certificate", the character length must be great than or equal to 1.')
232
+ end
233
+
234
+ if !@ssl_client_key.nil? && @ssl_client_key.to_s.length < 1
235
+ invalid_properties.push('invalid value for "ssl_client_key", the character length must be great than or equal to 1.')
236
+ end
237
+
238
+ if !@proxy_url.nil? && @proxy_url.to_s.length < 1
239
+ invalid_properties.push('invalid value for "proxy_url", the character length must be great than or equal to 1.')
240
+ end
241
+
242
+ if !@username.nil? && @username.to_s.length < 1
243
+ invalid_properties.push('invalid value for "username", the character length must be great than or equal to 1.')
244
+ end
245
+
246
+ if !@password.nil? && @password.to_s.length < 1
247
+ invalid_properties.push('invalid value for "password", the character length must be great than or equal to 1.')
248
+ end
249
+
250
+ if !@download_concurrency.nil? && @download_concurrency < 1
251
+ invalid_properties.push('invalid value for "download_concurrency", must be greater than or equal to 1.')
252
+ end
253
+
254
+ invalid_properties
255
+ end
256
+
257
+ # Check to see if the all the properties in the model are valid
258
+ # @return true if the model is valid
259
+ def valid?
260
+ return false if !@_type.nil? && @_type.to_s.length < 1
261
+ return false if @name.nil?
262
+ return false if @name.to_s.length < 1
263
+ return false if @url.nil?
264
+ return false if @url.to_s.length < 1
265
+ return false if !@ssl_ca_certificate.nil? && @ssl_ca_certificate.to_s.length < 1
266
+ return false if !@ssl_client_certificate.nil? && @ssl_client_certificate.to_s.length < 1
267
+ return false if !@ssl_client_key.nil? && @ssl_client_key.to_s.length < 1
268
+ return false if !@proxy_url.nil? && @proxy_url.to_s.length < 1
269
+ return false if !@username.nil? && @username.to_s.length < 1
270
+ return false if !@password.nil? && @password.to_s.length < 1
271
+ return false if !@download_concurrency.nil? && @download_concurrency < 1
272
+ policy_validator = EnumAttributeValidator.new('String', ["immediate", "When syncing, download all metadata and content now."])
273
+ return false unless policy_validator.valid?(@policy)
274
+ true
275
+ end
276
+
277
+ # Custom attribute writer method with validation
278
+ # @param [Object] _type Value to be assigned
279
+ def _type=(_type)
280
+ if !_type.nil? && _type.to_s.length < 1
281
+ fail ArgumentError, 'invalid value for "_type", the character length must be great than or equal to 1.'
282
+ end
283
+
284
+ @_type = _type
285
+ end
286
+
287
+ # Custom attribute writer method with validation
288
+ # @param [Object] name Value to be assigned
289
+ def name=(name)
290
+ if name.nil?
291
+ fail ArgumentError, 'name cannot be nil'
292
+ end
293
+
294
+ if name.to_s.length < 1
295
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
296
+ end
297
+
298
+ @name = name
299
+ end
300
+
301
+ # Custom attribute writer method with validation
302
+ # @param [Object] url Value to be assigned
303
+ def url=(url)
304
+ if url.nil?
305
+ fail ArgumentError, 'url cannot be nil'
306
+ end
307
+
308
+ if url.to_s.length < 1
309
+ fail ArgumentError, 'invalid value for "url", the character length must be great than or equal to 1.'
310
+ end
311
+
312
+ @url = url
313
+ end
314
+
315
+ # Custom attribute writer method with validation
316
+ # @param [Object] ssl_ca_certificate Value to be assigned
317
+ def ssl_ca_certificate=(ssl_ca_certificate)
318
+ if !ssl_ca_certificate.nil? && ssl_ca_certificate.to_s.length < 1
319
+ fail ArgumentError, 'invalid value for "ssl_ca_certificate", the character length must be great than or equal to 1.'
320
+ end
321
+
322
+ @ssl_ca_certificate = ssl_ca_certificate
323
+ end
324
+
325
+ # Custom attribute writer method with validation
326
+ # @param [Object] ssl_client_certificate Value to be assigned
327
+ def ssl_client_certificate=(ssl_client_certificate)
328
+ if !ssl_client_certificate.nil? && ssl_client_certificate.to_s.length < 1
329
+ fail ArgumentError, 'invalid value for "ssl_client_certificate", the character length must be great than or equal to 1.'
330
+ end
331
+
332
+ @ssl_client_certificate = ssl_client_certificate
333
+ end
334
+
335
+ # Custom attribute writer method with validation
336
+ # @param [Object] ssl_client_key Value to be assigned
337
+ def ssl_client_key=(ssl_client_key)
338
+ if !ssl_client_key.nil? && ssl_client_key.to_s.length < 1
339
+ fail ArgumentError, 'invalid value for "ssl_client_key", the character length must be great than or equal to 1.'
340
+ end
341
+
342
+ @ssl_client_key = ssl_client_key
343
+ end
344
+
345
+ # Custom attribute writer method with validation
346
+ # @param [Object] proxy_url Value to be assigned
347
+ def proxy_url=(proxy_url)
348
+ if !proxy_url.nil? && proxy_url.to_s.length < 1
349
+ fail ArgumentError, 'invalid value for "proxy_url", the character length must be great than or equal to 1.'
350
+ end
351
+
352
+ @proxy_url = proxy_url
353
+ end
354
+
355
+ # Custom attribute writer method with validation
356
+ # @param [Object] username Value to be assigned
357
+ def username=(username)
358
+ if !username.nil? && username.to_s.length < 1
359
+ fail ArgumentError, 'invalid value for "username", the character length must be great than or equal to 1.'
360
+ end
361
+
362
+ @username = username
363
+ end
364
+
365
+ # Custom attribute writer method with validation
366
+ # @param [Object] password Value to be assigned
367
+ def password=(password)
368
+ if !password.nil? && password.to_s.length < 1
369
+ fail ArgumentError, 'invalid value for "password", the character length must be great than or equal to 1.'
370
+ end
371
+
372
+ @password = password
373
+ end
374
+
375
+ # Custom attribute writer method with validation
376
+ # @param [Object] download_concurrency Value to be assigned
377
+ def download_concurrency=(download_concurrency)
378
+ if !download_concurrency.nil? && download_concurrency < 1
379
+ fail ArgumentError, 'invalid value for "download_concurrency", must be greater than or equal to 1.'
380
+ end
381
+
382
+ @download_concurrency = download_concurrency
383
+ end
384
+
385
+ # Custom attribute writer method checking allowed values (enum).
386
+ # @param [Object] policy Object to be assigned
387
+ def policy=(policy)
388
+ validator = EnumAttributeValidator.new('String', ["immediate", "When syncing, download all metadata and content now."])
389
+ unless validator.valid?(policy)
390
+ fail ArgumentError, "invalid value for \"policy\", must be one of #{validator.allowable_values}."
391
+ end
392
+ @policy = policy
393
+ end
394
+
395
+ # Checks equality by comparing each attribute.
396
+ # @param [Object] Object to be compared
397
+ def ==(o)
398
+ return true if self.equal?(o)
399
+ self.class == o.class &&
400
+ _href == o._href &&
401
+ _created == o._created &&
402
+ _type == o._type &&
403
+ name == o.name &&
404
+ url == o.url &&
405
+ ssl_ca_certificate == o.ssl_ca_certificate &&
406
+ ssl_client_certificate == o.ssl_client_certificate &&
407
+ ssl_client_key == o.ssl_client_key &&
408
+ ssl_validation == o.ssl_validation &&
409
+ proxy_url == o.proxy_url &&
410
+ username == o.username &&
411
+ password == o.password &&
412
+ _last_updated == o._last_updated &&
413
+ download_concurrency == o.download_concurrency &&
414
+ policy == o.policy
415
+ end
416
+
417
+ # @see the `==` method
418
+ # @param [Object] Object to be compared
419
+ def eql?(o)
420
+ self == o
421
+ end
422
+
423
+ # Calculates hash code according to all attributes.
424
+ # @return [Integer] Hash code
425
+ def hash
426
+ [_href, _created, _type, name, url, ssl_ca_certificate, ssl_client_certificate, ssl_client_key, ssl_validation, proxy_url, username, password, _last_updated, download_concurrency, policy].hash
427
+ end
428
+
429
+ # Builds the object from hash
430
+ # @param [Hash] attributes Model attributes in the form of hash
431
+ # @return [Object] Returns the model itself
432
+ def self.build_from_hash(attributes)
433
+ new.build_from_hash(attributes)
434
+ end
435
+
436
+ # Builds the object from hash
437
+ # @param [Hash] attributes Model attributes in the form of hash
438
+ # @return [Object] Returns the model itself
439
+ def build_from_hash(attributes)
440
+ return nil unless attributes.is_a?(Hash)
441
+ self.class.openapi_types.each_pair do |key, type|
442
+ if type =~ /\AArray<(.*)>/i
443
+ # check to ensure the input is an array given that the attribute
444
+ # is documented as an array but the input is not
445
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
446
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
447
+ end
448
+ elsif !attributes[self.class.attribute_map[key]].nil?
449
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
450
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
451
+ end
452
+
453
+ self
454
+ end
455
+
456
+ # Deserializes the data based on type
457
+ # @param string type Data type
458
+ # @param string value Value to be deserialized
459
+ # @return [Object] Deserialized data
460
+ def _deserialize(type, value)
461
+ case type.to_sym
462
+ when :DateTime
463
+ DateTime.parse(value)
464
+ when :Date
465
+ Date.parse(value)
466
+ when :String
467
+ value.to_s
468
+ when :Integer
469
+ value.to_i
470
+ when :Float
471
+ value.to_f
472
+ when :Boolean
473
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
474
+ true
475
+ else
476
+ false
477
+ end
478
+ when :Object
479
+ # generic object (usually a Hash), return directly
480
+ value
481
+ when /\AArray<(?<inner_type>.+)>\z/
482
+ inner_type = Regexp.last_match[:inner_type]
483
+ value.map { |v| _deserialize(inner_type, v) }
484
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
485
+ k_type = Regexp.last_match[:k_type]
486
+ v_type = Regexp.last_match[:v_type]
487
+ {}.tap do |hash|
488
+ value.each do |k, v|
489
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
490
+ end
491
+ end
492
+ else # model
493
+ PulpAnsibleClient.const_get(type).build_from_hash(value)
494
+ end
495
+ end
496
+
497
+ # Returns the string representation of the object
498
+ # @return [String] String presentation of the object
499
+ def to_s
500
+ to_hash.to_s
501
+ end
502
+
503
+ # to_body is an alias to to_hash (backward compatibility)
504
+ # @return [Hash] Returns the object in the form of hash
505
+ def to_body
506
+ to_hash
507
+ end
508
+
509
+ # Returns the object in the form of hash
510
+ # @return [Hash] Returns the object in the form of hash
511
+ def to_hash
512
+ hash = {}
513
+ self.class.attribute_map.each_pair do |attr, param|
514
+ value = self.send(attr)
515
+ next if value.nil?
516
+ hash[param] = _to_hash(value)
517
+ end
518
+ hash
519
+ end
520
+
521
+ # Outputs non-array value in the form of hash
522
+ # For object, use to_hash. Otherwise, just return the value
523
+ # @param [Object] value Any valid value
524
+ # @return [Hash] Returns the value in the form of hash
525
+ def _to_hash(value)
526
+ if value.is_a?(Array)
527
+ value.compact.map { |v| _to_hash(v) }
528
+ elsif value.is_a?(Hash)
529
+ {}.tap do |hash|
530
+ value.each { |k, v| hash[k] = _to_hash(v) }
531
+ end
532
+ elsif value.respond_to? :to_hash
533
+ value.to_hash
534
+ else
535
+ value
536
+ end
537
+ end
538
+ end
539
+ end