pulp_container_client 1.0.0rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +164 -0
  4. data/Rakefile +10 -0
  5. data/docs/AsyncOperationResponse.md +17 -0
  6. data/docs/ContainerBlob.md +25 -0
  7. data/docs/ContainerContainerDistribution.md +31 -0
  8. data/docs/ContainerContainerRemote.md +43 -0
  9. data/docs/ContainerContainerRepository.md +27 -0
  10. data/docs/ContainerManifest.md +33 -0
  11. data/docs/ContainerTag.md +25 -0
  12. data/docs/ContentBlobsApi.md +142 -0
  13. data/docs/ContentManifestsApi.md +142 -0
  14. data/docs/ContentSummary.md +21 -0
  15. data/docs/ContentTagsApi.md +144 -0
  16. data/docs/DistributionsContainerApi.md +362 -0
  17. data/docs/InlineResponse200.md +23 -0
  18. data/docs/InlineResponse2001.md +23 -0
  19. data/docs/InlineResponse2002.md +23 -0
  20. data/docs/InlineResponse2003.md +23 -0
  21. data/docs/InlineResponse2004.md +23 -0
  22. data/docs/InlineResponse2005.md +23 -0
  23. data/docs/InlineResponse2006.md +23 -0
  24. data/docs/ManifestCopy.md +23 -0
  25. data/docs/RecursiveManage.md +17 -0
  26. data/docs/RemotesContainerApi.md +366 -0
  27. data/docs/RepositoriesContainerApi.md +739 -0
  28. data/docs/RepositoriesContainerVersionsApi.md +214 -0
  29. data/docs/RepositorySyncURL.md +19 -0
  30. data/docs/RepositoryVersion.md +25 -0
  31. data/docs/TagCopy.md +21 -0
  32. data/docs/TagImage.md +19 -0
  33. data/docs/UnTagImage.md +17 -0
  34. data/git_push.sh +58 -0
  35. data/lib/pulp_container_client/api/content_blobs_api.rb +176 -0
  36. data/lib/pulp_container_client/api/content_manifests_api.rb +176 -0
  37. data/lib/pulp_container_client/api/content_tags_api.rb +179 -0
  38. data/lib/pulp_container_client/api/distributions_container_api.rb +442 -0
  39. data/lib/pulp_container_client/api/remotes_container_api.rb +448 -0
  40. data/lib/pulp_container_client/api/repositories_container_api.rb +906 -0
  41. data/lib/pulp_container_client/api/repositories_container_versions_api.rb +268 -0
  42. data/lib/pulp_container_client/api_client.rb +402 -0
  43. data/lib/pulp_container_client/api_error.rb +57 -0
  44. data/lib/pulp_container_client/configuration.rb +243 -0
  45. data/lib/pulp_container_client/models/async_operation_response.rb +212 -0
  46. data/lib/pulp_container_client/models/container_blob.rb +299 -0
  47. data/lib/pulp_container_client/models/container_container_distribution.rb +342 -0
  48. data/lib/pulp_container_client/models/container_container_remote.rb +526 -0
  49. data/lib/pulp_container_client/models/container_container_repository.rb +294 -0
  50. data/lib/pulp_container_client/models/container_manifest.rb +363 -0
  51. data/lib/pulp_container_client/models/container_tag.rb +280 -0
  52. data/lib/pulp_container_client/models/content_summary.rb +246 -0
  53. data/lib/pulp_container_client/models/inline_response200.rb +247 -0
  54. data/lib/pulp_container_client/models/inline_response2001.rb +247 -0
  55. data/lib/pulp_container_client/models/inline_response2002.rb +247 -0
  56. data/lib/pulp_container_client/models/inline_response2003.rb +247 -0
  57. data/lib/pulp_container_client/models/inline_response2004.rb +247 -0
  58. data/lib/pulp_container_client/models/inline_response2005.rb +247 -0
  59. data/lib/pulp_container_client/models/inline_response2006.rb +247 -0
  60. data/lib/pulp_container_client/models/manifest_copy.rb +263 -0
  61. data/lib/pulp_container_client/models/recursive_manage.rb +209 -0
  62. data/lib/pulp_container_client/models/repository_sync_url.rb +224 -0
  63. data/lib/pulp_container_client/models/repository_version.rb +244 -0
  64. data/lib/pulp_container_client/models/tag_copy.rb +229 -0
  65. data/lib/pulp_container_client/models/tag_image.rb +265 -0
  66. data/lib/pulp_container_client/models/un_tag_image.rb +231 -0
  67. data/lib/pulp_container_client/version.rb +15 -0
  68. data/lib/pulp_container_client.rb +68 -0
  69. data/pulp_container_client.gemspec +39 -0
  70. data/spec/api/content_blobs_api_spec.rb +70 -0
  71. data/spec/api/content_manifests_api_spec.rb +70 -0
  72. data/spec/api/content_tags_api_spec.rb +71 -0
  73. data/spec/api/distributions_container_api_spec.rb +120 -0
  74. data/spec/api/remotes_container_api_spec.rb +122 -0
  75. data/spec/api/repositories_container_api_spec.rb +200 -0
  76. data/spec/api/repositories_container_versions_api_spec.rb +91 -0
  77. data/spec/api_client_spec.rb +188 -0
  78. data/spec/configuration_spec.rb +42 -0
  79. data/spec/models/async_operation_response_spec.rb +41 -0
  80. data/spec/models/container_blob_spec.rb +65 -0
  81. data/spec/models/container_container_distribution_spec.rb +83 -0
  82. data/spec/models/container_container_remote_spec.rb +123 -0
  83. data/spec/models/container_container_repository_spec.rb +71 -0
  84. data/spec/models/container_manifest_spec.rb +89 -0
  85. data/spec/models/container_tag_spec.rb +65 -0
  86. data/spec/models/content_summary_spec.rb +53 -0
  87. data/spec/models/inline_response2001_spec.rb +59 -0
  88. data/spec/models/inline_response2002_spec.rb +59 -0
  89. data/spec/models/inline_response2003_spec.rb +59 -0
  90. data/spec/models/inline_response2004_spec.rb +59 -0
  91. data/spec/models/inline_response2005_spec.rb +59 -0
  92. data/spec/models/inline_response2006_spec.rb +59 -0
  93. data/spec/models/inline_response200_spec.rb +59 -0
  94. data/spec/models/manifest_copy_spec.rb +63 -0
  95. data/spec/models/recursive_manage_spec.rb +41 -0
  96. data/spec/models/repository_sync_url_spec.rb +47 -0
  97. data/spec/models/repository_version_spec.rb +65 -0
  98. data/spec/models/tag_copy_spec.rb +53 -0
  99. data/spec/models/tag_image_spec.rb +47 -0
  100. data/spec/models/un_tag_image_spec.rb +41 -0
  101. data/spec/spec_helper.rb +111 -0
  102. metadata +230 -0
@@ -0,0 +1,526 @@
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.2.2-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module PulpContainerClient
16
+ class ContainerContainerRemote
17
+ attr_accessor :pulp_href
18
+
19
+ # Timestamp of creation.
20
+ attr_accessor :pulp_created
21
+
22
+ # A unique name for this remote.
23
+ attr_accessor :name
24
+
25
+ # The URL of an external content source.
26
+ attr_accessor :url
27
+
28
+ # 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.
29
+ attr_accessor :ca_cert
30
+
31
+ # A string containing the PEM encoded client certificate used for authentication. All new line characters must be escaped. Returns SHA256 sum on GET.
32
+ attr_accessor :client_cert
33
+
34
+ # A PEM encoded private key used for authentication. Returns SHA256 sum on GET.
35
+ attr_accessor :client_key
36
+
37
+ # If True, TLS peer validation must be performed.
38
+ attr_accessor :tls_validation
39
+
40
+ # The proxy URL. Format: scheme://user:password@host:port
41
+ attr_accessor :proxy_url
42
+
43
+ # Timestamp of the most recent update of the remote.
44
+ attr_accessor :pulp_last_updated
45
+
46
+ # Total number of simultaneous connections.
47
+ attr_accessor :download_concurrency
48
+
49
+ # immediate - All manifests and blobs are downloaded and saved during a sync. on_demand - Only tags and manifests are downloaded. Blobs are not downloaded until they are requested for the first time by a client. streamed - Blobs are streamed to the client with every request and never saved.
50
+ attr_accessor :policy
51
+
52
+ # Name of the upstream repository
53
+ attr_accessor :upstream_name
54
+
55
+ # A list of whitelisted tags to sync
56
+ attr_accessor :whitelist_tags
57
+
58
+ class EnumAttributeValidator
59
+ attr_reader :datatype
60
+ attr_reader :allowable_values
61
+
62
+ def initialize(datatype, allowable_values)
63
+ @allowable_values = allowable_values.map do |value|
64
+ case datatype.to_s
65
+ when /Integer/i
66
+ value.to_i
67
+ when /Float/i
68
+ value.to_f
69
+ else
70
+ value
71
+ end
72
+ end
73
+ end
74
+
75
+ def valid?(value)
76
+ !value || allowable_values.include?(value)
77
+ end
78
+ end
79
+
80
+ # Attribute mapping from ruby-style variable name to JSON key.
81
+ def self.attribute_map
82
+ {
83
+ :'pulp_href' => :'pulp_href',
84
+ :'pulp_created' => :'pulp_created',
85
+ :'name' => :'name',
86
+ :'url' => :'url',
87
+ :'ca_cert' => :'ca_cert',
88
+ :'client_cert' => :'client_cert',
89
+ :'client_key' => :'client_key',
90
+ :'tls_validation' => :'tls_validation',
91
+ :'proxy_url' => :'proxy_url',
92
+ :'pulp_last_updated' => :'pulp_last_updated',
93
+ :'download_concurrency' => :'download_concurrency',
94
+ :'policy' => :'policy',
95
+ :'upstream_name' => :'upstream_name',
96
+ :'whitelist_tags' => :'whitelist_tags'
97
+ }
98
+ end
99
+
100
+ # Attribute type mapping.
101
+ def self.openapi_types
102
+ {
103
+ :'pulp_href' => :'String',
104
+ :'pulp_created' => :'DateTime',
105
+ :'name' => :'String',
106
+ :'url' => :'String',
107
+ :'ca_cert' => :'String',
108
+ :'client_cert' => :'String',
109
+ :'client_key' => :'String',
110
+ :'tls_validation' => :'Boolean',
111
+ :'proxy_url' => :'String',
112
+ :'pulp_last_updated' => :'DateTime',
113
+ :'download_concurrency' => :'Integer',
114
+ :'policy' => :'String',
115
+ :'upstream_name' => :'String',
116
+ :'whitelist_tags' => :'Array<String>'
117
+ }
118
+ end
119
+
120
+ # List of attributes with nullable: true
121
+ def self.openapi_nullable
122
+ Set.new([
123
+ :'ca_cert',
124
+ :'client_cert',
125
+ :'client_key',
126
+ :'proxy_url',
127
+ :'whitelist_tags'
128
+ ])
129
+ end
130
+
131
+ # Initializes the object
132
+ # @param [Hash] attributes Model attributes in the form of hash
133
+ def initialize(attributes = {})
134
+ if (!attributes.is_a?(Hash))
135
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpContainerClient::ContainerContainerRemote` initialize method"
136
+ end
137
+
138
+ # check to see if the attribute exists and convert string to symbol for hash key
139
+ attributes = attributes.each_with_object({}) { |(k, v), h|
140
+ if (!self.class.attribute_map.key?(k.to_sym))
141
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpContainerClient::ContainerContainerRemote`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
142
+ end
143
+ h[k.to_sym] = v
144
+ }
145
+
146
+ if attributes.key?(:'pulp_href')
147
+ self.pulp_href = attributes[:'pulp_href']
148
+ end
149
+
150
+ if attributes.key?(:'pulp_created')
151
+ self.pulp_created = attributes[:'pulp_created']
152
+ end
153
+
154
+ if attributes.key?(:'name')
155
+ self.name = attributes[:'name']
156
+ end
157
+
158
+ if attributes.key?(:'url')
159
+ self.url = attributes[:'url']
160
+ end
161
+
162
+ if attributes.key?(:'ca_cert')
163
+ self.ca_cert = attributes[:'ca_cert']
164
+ end
165
+
166
+ if attributes.key?(:'client_cert')
167
+ self.client_cert = attributes[:'client_cert']
168
+ end
169
+
170
+ if attributes.key?(:'client_key')
171
+ self.client_key = attributes[:'client_key']
172
+ end
173
+
174
+ if attributes.key?(:'tls_validation')
175
+ self.tls_validation = attributes[:'tls_validation']
176
+ end
177
+
178
+ if attributes.key?(:'proxy_url')
179
+ self.proxy_url = attributes[:'proxy_url']
180
+ end
181
+
182
+ if attributes.key?(:'pulp_last_updated')
183
+ self.pulp_last_updated = attributes[:'pulp_last_updated']
184
+ end
185
+
186
+ if attributes.key?(:'download_concurrency')
187
+ self.download_concurrency = attributes[:'download_concurrency']
188
+ end
189
+
190
+ if attributes.key?(:'policy')
191
+ self.policy = attributes[:'policy']
192
+ else
193
+ self.policy = 'immediate'
194
+ end
195
+
196
+ if attributes.key?(:'upstream_name')
197
+ self.upstream_name = attributes[:'upstream_name']
198
+ end
199
+
200
+ if attributes.key?(:'whitelist_tags')
201
+ if (value = attributes[:'whitelist_tags']).is_a?(Array)
202
+ self.whitelist_tags = value
203
+ end
204
+ end
205
+ end
206
+
207
+ # Show invalid properties with the reasons. Usually used together with valid?
208
+ # @return Array for valid properties with the reasons
209
+ def list_invalid_properties
210
+ invalid_properties = Array.new
211
+ if @name.nil?
212
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
213
+ end
214
+
215
+ if @name.to_s.length < 1
216
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
217
+ end
218
+
219
+ if @url.nil?
220
+ invalid_properties.push('invalid value for "url", url cannot be nil.')
221
+ end
222
+
223
+ if @url.to_s.length < 1
224
+ invalid_properties.push('invalid value for "url", the character length must be great than or equal to 1.')
225
+ end
226
+
227
+ if !@ca_cert.nil? && @ca_cert.to_s.length < 1
228
+ invalid_properties.push('invalid value for "ca_cert", the character length must be great than or equal to 1.')
229
+ end
230
+
231
+ if !@client_cert.nil? && @client_cert.to_s.length < 1
232
+ invalid_properties.push('invalid value for "client_cert", the character length must be great than or equal to 1.')
233
+ end
234
+
235
+ if !@client_key.nil? && @client_key.to_s.length < 1
236
+ invalid_properties.push('invalid value for "client_key", the character length must be great than or equal to 1.')
237
+ end
238
+
239
+ if !@proxy_url.nil? && @proxy_url.to_s.length < 1
240
+ invalid_properties.push('invalid value for "proxy_url", the character length must be great than or equal to 1.')
241
+ end
242
+
243
+ if !@download_concurrency.nil? && @download_concurrency < 1
244
+ invalid_properties.push('invalid value for "download_concurrency", must be greater than or equal to 1.')
245
+ end
246
+
247
+ if @upstream_name.nil?
248
+ invalid_properties.push('invalid value for "upstream_name", upstream_name cannot be nil.')
249
+ end
250
+
251
+ if @upstream_name.to_s.length < 1
252
+ invalid_properties.push('invalid value for "upstream_name", the character length must be great than or equal to 1.')
253
+ end
254
+
255
+ invalid_properties
256
+ end
257
+
258
+ # Check to see if the all the properties in the model are valid
259
+ # @return true if the model is valid
260
+ def valid?
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 !@ca_cert.nil? && @ca_cert.to_s.length < 1
266
+ return false if !@client_cert.nil? && @client_cert.to_s.length < 1
267
+ return false if !@client_key.nil? && @client_key.to_s.length < 1
268
+ return false if !@proxy_url.nil? && @proxy_url.to_s.length < 1
269
+ return false if !@download_concurrency.nil? && @download_concurrency < 1
270
+ policy_validator = EnumAttributeValidator.new('String', ["immediate", "on_demand", "streamed"])
271
+ return false unless policy_validator.valid?(@policy)
272
+ return false if @upstream_name.nil?
273
+ return false if @upstream_name.to_s.length < 1
274
+ true
275
+ end
276
+
277
+ # Custom attribute writer method with validation
278
+ # @param [Object] name Value to be assigned
279
+ def name=(name)
280
+ if name.nil?
281
+ fail ArgumentError, 'name cannot be nil'
282
+ end
283
+
284
+ if name.to_s.length < 1
285
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
286
+ end
287
+
288
+ @name = name
289
+ end
290
+
291
+ # Custom attribute writer method with validation
292
+ # @param [Object] url Value to be assigned
293
+ def url=(url)
294
+ if url.nil?
295
+ fail ArgumentError, 'url cannot be nil'
296
+ end
297
+
298
+ if url.to_s.length < 1
299
+ fail ArgumentError, 'invalid value for "url", the character length must be great than or equal to 1.'
300
+ end
301
+
302
+ @url = url
303
+ end
304
+
305
+ # Custom attribute writer method with validation
306
+ # @param [Object] ca_cert Value to be assigned
307
+ def ca_cert=(ca_cert)
308
+ if !ca_cert.nil? && ca_cert.to_s.length < 1
309
+ fail ArgumentError, 'invalid value for "ca_cert", the character length must be great than or equal to 1.'
310
+ end
311
+
312
+ @ca_cert = ca_cert
313
+ end
314
+
315
+ # Custom attribute writer method with validation
316
+ # @param [Object] client_cert Value to be assigned
317
+ def client_cert=(client_cert)
318
+ if !client_cert.nil? && client_cert.to_s.length < 1
319
+ fail ArgumentError, 'invalid value for "client_cert", the character length must be great than or equal to 1.'
320
+ end
321
+
322
+ @client_cert = client_cert
323
+ end
324
+
325
+ # Custom attribute writer method with validation
326
+ # @param [Object] client_key Value to be assigned
327
+ def client_key=(client_key)
328
+ if !client_key.nil? && client_key.to_s.length < 1
329
+ fail ArgumentError, 'invalid value for "client_key", the character length must be great than or equal to 1.'
330
+ end
331
+
332
+ @client_key = client_key
333
+ end
334
+
335
+ # Custom attribute writer method with validation
336
+ # @param [Object] proxy_url Value to be assigned
337
+ def proxy_url=(proxy_url)
338
+ if !proxy_url.nil? && proxy_url.to_s.length < 1
339
+ fail ArgumentError, 'invalid value for "proxy_url", the character length must be great than or equal to 1.'
340
+ end
341
+
342
+ @proxy_url = proxy_url
343
+ end
344
+
345
+ # Custom attribute writer method with validation
346
+ # @param [Object] download_concurrency Value to be assigned
347
+ def download_concurrency=(download_concurrency)
348
+ if !download_concurrency.nil? && download_concurrency < 1
349
+ fail ArgumentError, 'invalid value for "download_concurrency", must be greater than or equal to 1.'
350
+ end
351
+
352
+ @download_concurrency = download_concurrency
353
+ end
354
+
355
+ # Custom attribute writer method checking allowed values (enum).
356
+ # @param [Object] policy Object to be assigned
357
+ def policy=(policy)
358
+ validator = EnumAttributeValidator.new('String', ["immediate", "on_demand", "streamed"])
359
+ unless validator.valid?(policy)
360
+ fail ArgumentError, "invalid value for \"policy\", must be one of #{validator.allowable_values}."
361
+ end
362
+ @policy = policy
363
+ end
364
+
365
+ # Custom attribute writer method with validation
366
+ # @param [Object] upstream_name Value to be assigned
367
+ def upstream_name=(upstream_name)
368
+ if upstream_name.nil?
369
+ fail ArgumentError, 'upstream_name cannot be nil'
370
+ end
371
+
372
+ if upstream_name.to_s.length < 1
373
+ fail ArgumentError, 'invalid value for "upstream_name", the character length must be great than or equal to 1.'
374
+ end
375
+
376
+ @upstream_name = upstream_name
377
+ end
378
+
379
+ # Checks equality by comparing each attribute.
380
+ # @param [Object] Object to be compared
381
+ def ==(o)
382
+ return true if self.equal?(o)
383
+ self.class == o.class &&
384
+ pulp_href == o.pulp_href &&
385
+ pulp_created == o.pulp_created &&
386
+ name == o.name &&
387
+ url == o.url &&
388
+ ca_cert == o.ca_cert &&
389
+ client_cert == o.client_cert &&
390
+ client_key == o.client_key &&
391
+ tls_validation == o.tls_validation &&
392
+ proxy_url == o.proxy_url &&
393
+ pulp_last_updated == o.pulp_last_updated &&
394
+ download_concurrency == o.download_concurrency &&
395
+ policy == o.policy &&
396
+ upstream_name == o.upstream_name &&
397
+ whitelist_tags == o.whitelist_tags
398
+ end
399
+
400
+ # @see the `==` method
401
+ # @param [Object] Object to be compared
402
+ def eql?(o)
403
+ self == o
404
+ end
405
+
406
+ # Calculates hash code according to all attributes.
407
+ # @return [Integer] Hash code
408
+ def hash
409
+ [pulp_href, pulp_created, name, url, ca_cert, client_cert, client_key, tls_validation, proxy_url, pulp_last_updated, download_concurrency, policy, upstream_name, whitelist_tags].hash
410
+ end
411
+
412
+ # Builds the object from hash
413
+ # @param [Hash] attributes Model attributes in the form of hash
414
+ # @return [Object] Returns the model itself
415
+ def self.build_from_hash(attributes)
416
+ new.build_from_hash(attributes)
417
+ end
418
+
419
+ # Builds the object from hash
420
+ # @param [Hash] attributes Model attributes in the form of hash
421
+ # @return [Object] Returns the model itself
422
+ def build_from_hash(attributes)
423
+ return nil unless attributes.is_a?(Hash)
424
+ self.class.openapi_types.each_pair do |key, type|
425
+ if type =~ /\AArray<(.*)>/i
426
+ # check to ensure the input is an array given that the attribute
427
+ # is documented as an array but the input is not
428
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
429
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
430
+ end
431
+ elsif !attributes[self.class.attribute_map[key]].nil?
432
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
433
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
434
+ end
435
+
436
+ self
437
+ end
438
+
439
+ # Deserializes the data based on type
440
+ # @param string type Data type
441
+ # @param string value Value to be deserialized
442
+ # @return [Object] Deserialized data
443
+ def _deserialize(type, value)
444
+ case type.to_sym
445
+ when :DateTime
446
+ DateTime.parse(value)
447
+ when :Date
448
+ Date.parse(value)
449
+ when :String
450
+ value.to_s
451
+ when :Integer
452
+ value.to_i
453
+ when :Float
454
+ value.to_f
455
+ when :Boolean
456
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
457
+ true
458
+ else
459
+ false
460
+ end
461
+ when :Object
462
+ # generic object (usually a Hash), return directly
463
+ value
464
+ when /\AArray<(?<inner_type>.+)>\z/
465
+ inner_type = Regexp.last_match[:inner_type]
466
+ value.map { |v| _deserialize(inner_type, v) }
467
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
468
+ k_type = Regexp.last_match[:k_type]
469
+ v_type = Regexp.last_match[:v_type]
470
+ {}.tap do |hash|
471
+ value.each do |k, v|
472
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
473
+ end
474
+ end
475
+ else # model
476
+ PulpContainerClient.const_get(type).build_from_hash(value)
477
+ end
478
+ end
479
+
480
+ # Returns the string representation of the object
481
+ # @return [String] String presentation of the object
482
+ def to_s
483
+ to_hash.to_s
484
+ end
485
+
486
+ # to_body is an alias to to_hash (backward compatibility)
487
+ # @return [Hash] Returns the object in the form of hash
488
+ def to_body
489
+ to_hash
490
+ end
491
+
492
+ # Returns the object in the form of hash
493
+ # @return [Hash] Returns the object in the form of hash
494
+ def to_hash
495
+ hash = {}
496
+ self.class.attribute_map.each_pair do |attr, param|
497
+ value = self.send(attr)
498
+ if value.nil?
499
+ is_nullable = self.class.openapi_nullable.include?(attr)
500
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
501
+ end
502
+
503
+ hash[param] = _to_hash(value)
504
+ end
505
+ hash
506
+ end
507
+
508
+ # Outputs non-array value in the form of hash
509
+ # For object, use to_hash. Otherwise, just return the value
510
+ # @param [Object] value Any valid value
511
+ # @return [Hash] Returns the value in the form of hash
512
+ def _to_hash(value)
513
+ if value.is_a?(Array)
514
+ value.compact.map { |v| _to_hash(v) }
515
+ elsif value.is_a?(Hash)
516
+ {}.tap do |hash|
517
+ value.each { |k, v| hash[k] = _to_hash(v) }
518
+ end
519
+ elsif value.respond_to? :to_hash
520
+ value.to_hash
521
+ else
522
+ value
523
+ end
524
+ end
525
+ end
526
+ end