pulp_docker_client 4.0.0b5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +79 -0
  4. data/README.md +131 -0
  5. data/Rakefile +10 -0
  6. data/docs/AsyncOperationResponse.md +17 -0
  7. data/docs/Blob.md +29 -0
  8. data/docs/ContentBlobsApi.md +182 -0
  9. data/docs/ContentManifestTagsApi.md +182 -0
  10. data/docs/ContentManifestsApi.md +180 -0
  11. data/docs/DistributionsDockerApi.md +352 -0
  12. data/docs/DockerDistribution.md +31 -0
  13. data/docs/DockerRemote.md +49 -0
  14. data/docs/InlineResponse200.md +23 -0
  15. data/docs/InlineResponse2001.md +23 -0
  16. data/docs/InlineResponse2002.md +23 -0
  17. data/docs/InlineResponse2003.md +23 -0
  18. data/docs/InlineResponse2004.md +23 -0
  19. data/docs/Manifest.md +37 -0
  20. data/docs/ManifestTag.md +29 -0
  21. data/docs/RemotesDockerApi.md +411 -0
  22. data/docs/RepositorySyncURL.md +19 -0
  23. data/git_push.sh +55 -0
  24. data/lib/pulp_docker_client/api/content_blobs_api.rb +222 -0
  25. data/lib/pulp_docker_client/api/content_manifest_tags_api.rb +222 -0
  26. data/lib/pulp_docker_client/api/content_manifests_api.rb +219 -0
  27. data/lib/pulp_docker_client/api/distributions_docker_api.rb +430 -0
  28. data/lib/pulp_docker_client/api/remotes_docker_api.rb +504 -0
  29. data/lib/pulp_docker_client/api_client.rb +387 -0
  30. data/lib/pulp_docker_client/api_error.rb +57 -0
  31. data/lib/pulp_docker_client/configuration.rb +251 -0
  32. data/lib/pulp_docker_client/models/async_operation_response.rb +202 -0
  33. data/lib/pulp_docker_client/models/blob.rb +347 -0
  34. data/lib/pulp_docker_client/models/docker_distribution.rb +347 -0
  35. data/lib/pulp_docker_client/models/docker_remote.rb +598 -0
  36. data/lib/pulp_docker_client/models/inline_response200.rb +235 -0
  37. data/lib/pulp_docker_client/models/inline_response2001.rb +235 -0
  38. data/lib/pulp_docker_client/models/inline_response2002.rb +235 -0
  39. data/lib/pulp_docker_client/models/inline_response2003.rb +235 -0
  40. data/lib/pulp_docker_client/models/inline_response2004.rb +235 -0
  41. data/lib/pulp_docker_client/models/manifest.rb +411 -0
  42. data/lib/pulp_docker_client/models/manifest_tag.rb +328 -0
  43. data/lib/pulp_docker_client/models/repository_sync_url.rb +214 -0
  44. data/lib/pulp_docker_client/version.rb +15 -0
  45. data/lib/pulp_docker_client.rb +56 -0
  46. data/pulp_docker_client.gemspec +45 -0
  47. data/spec/api/content_blobs_api_spec.rb +76 -0
  48. data/spec/api/content_manifest_tags_api_spec.rb +76 -0
  49. data/spec/api/content_manifests_api_spec.rb +75 -0
  50. data/spec/api/distributions_docker_api_spec.rb +116 -0
  51. data/spec/api/remotes_docker_api_spec.rb +130 -0
  52. data/spec/api_client_spec.rb +226 -0
  53. data/spec/configuration_spec.rb +42 -0
  54. data/spec/models/async_operation_response_spec.rb +41 -0
  55. data/spec/models/blob_spec.rb +77 -0
  56. data/spec/models/docker_distribution_spec.rb +83 -0
  57. data/spec/models/docker_remote_spec.rb +141 -0
  58. data/spec/models/inline_response2001_spec.rb +59 -0
  59. data/spec/models/inline_response2002_spec.rb +59 -0
  60. data/spec/models/inline_response2003_spec.rb +59 -0
  61. data/spec/models/inline_response2004_spec.rb +59 -0
  62. data/spec/models/inline_response200_spec.rb +59 -0
  63. data/spec/models/manifest_spec.rb +101 -0
  64. data/spec/models/manifest_tag_spec.rb +77 -0
  65. data/spec/models/repository_sync_url_spec.rb +47 -0
  66. data/spec/spec_helper.rb +111 -0
  67. metadata +309 -0
@@ -0,0 +1,598 @@
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 PulpDockerClient
16
+ class DockerRemote
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
+ # Name of the upstream repository
61
+ attr_accessor :upstream_name
62
+
63
+ # A comma separated string of tags to sync. Example: latest,1.27.0
64
+ attr_accessor :whitelist_tags
65
+
66
+ class EnumAttributeValidator
67
+ attr_reader :datatype
68
+ attr_reader :allowable_values
69
+
70
+ def initialize(datatype, allowable_values)
71
+ @allowable_values = allowable_values.map do |value|
72
+ case datatype.to_s
73
+ when /Integer/i
74
+ value.to_i
75
+ when /Float/i
76
+ value.to_f
77
+ else
78
+ value
79
+ end
80
+ end
81
+ end
82
+
83
+ def valid?(value)
84
+ !value || allowable_values.include?(value)
85
+ end
86
+ end
87
+
88
+ # Attribute mapping from ruby-style variable name to JSON key.
89
+ def self.attribute_map
90
+ {
91
+ :'_href' => :'_href',
92
+ :'_created' => :'_created',
93
+ :'_type' => :'_type',
94
+ :'name' => :'name',
95
+ :'url' => :'url',
96
+ :'ssl_ca_certificate' => :'ssl_ca_certificate',
97
+ :'ssl_client_certificate' => :'ssl_client_certificate',
98
+ :'ssl_client_key' => :'ssl_client_key',
99
+ :'ssl_validation' => :'ssl_validation',
100
+ :'proxy_url' => :'proxy_url',
101
+ :'username' => :'username',
102
+ :'password' => :'password',
103
+ :'_last_updated' => :'_last_updated',
104
+ :'download_concurrency' => :'download_concurrency',
105
+ :'policy' => :'policy',
106
+ :'upstream_name' => :'upstream_name',
107
+ :'whitelist_tags' => :'whitelist_tags'
108
+ }
109
+ end
110
+
111
+ # Attribute type mapping.
112
+ def self.openapi_types
113
+ {
114
+ :'_href' => :'String',
115
+ :'_created' => :'DateTime',
116
+ :'_type' => :'String',
117
+ :'name' => :'String',
118
+ :'url' => :'String',
119
+ :'ssl_ca_certificate' => :'String',
120
+ :'ssl_client_certificate' => :'String',
121
+ :'ssl_client_key' => :'String',
122
+ :'ssl_validation' => :'Boolean',
123
+ :'proxy_url' => :'String',
124
+ :'username' => :'String',
125
+ :'password' => :'String',
126
+ :'_last_updated' => :'DateTime',
127
+ :'download_concurrency' => :'Integer',
128
+ :'policy' => :'String',
129
+ :'upstream_name' => :'String',
130
+ :'whitelist_tags' => :'String'
131
+ }
132
+ end
133
+
134
+ # Initializes the object
135
+ # @param [Hash] attributes Model attributes in the form of hash
136
+ def initialize(attributes = {})
137
+ if (!attributes.is_a?(Hash))
138
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpDockerClient::DockerRemote` initialize method"
139
+ end
140
+
141
+ # check to see if the attribute exists and convert string to symbol for hash key
142
+ attributes = attributes.each_with_object({}) { |(k, v), h|
143
+ if (!self.class.attribute_map.key?(k.to_sym))
144
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpDockerClient::DockerRemote`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
145
+ end
146
+ h[k.to_sym] = v
147
+ }
148
+
149
+ if attributes.key?(:'_href')
150
+ self._href = attributes[:'_href']
151
+ end
152
+
153
+ if attributes.key?(:'_created')
154
+ self._created = attributes[:'_created']
155
+ end
156
+
157
+ if attributes.key?(:'_type')
158
+ self._type = attributes[:'_type']
159
+ end
160
+
161
+ if attributes.key?(:'name')
162
+ self.name = attributes[:'name']
163
+ end
164
+
165
+ if attributes.key?(:'url')
166
+ self.url = attributes[:'url']
167
+ end
168
+
169
+ if attributes.key?(:'ssl_ca_certificate')
170
+ self.ssl_ca_certificate = attributes[:'ssl_ca_certificate']
171
+ end
172
+
173
+ if attributes.key?(:'ssl_client_certificate')
174
+ self.ssl_client_certificate = attributes[:'ssl_client_certificate']
175
+ end
176
+
177
+ if attributes.key?(:'ssl_client_key')
178
+ self.ssl_client_key = attributes[:'ssl_client_key']
179
+ end
180
+
181
+ if attributes.key?(:'ssl_validation')
182
+ self.ssl_validation = attributes[:'ssl_validation']
183
+ end
184
+
185
+ if attributes.key?(:'proxy_url')
186
+ self.proxy_url = attributes[:'proxy_url']
187
+ end
188
+
189
+ if attributes.key?(:'username')
190
+ self.username = attributes[:'username']
191
+ end
192
+
193
+ if attributes.key?(:'password')
194
+ self.password = attributes[:'password']
195
+ end
196
+
197
+ if attributes.key?(:'_last_updated')
198
+ self._last_updated = attributes[:'_last_updated']
199
+ end
200
+
201
+ if attributes.key?(:'download_concurrency')
202
+ self.download_concurrency = attributes[:'download_concurrency']
203
+ end
204
+
205
+ if attributes.key?(:'policy')
206
+ self.policy = attributes[:'policy']
207
+ else
208
+ self.policy = 'immediate'
209
+ end
210
+
211
+ if attributes.key?(:'upstream_name')
212
+ self.upstream_name = attributes[:'upstream_name']
213
+ end
214
+
215
+ if attributes.key?(:'whitelist_tags')
216
+ self.whitelist_tags = attributes[:'whitelist_tags']
217
+ end
218
+ end
219
+
220
+ # Show invalid properties with the reasons. Usually used together with valid?
221
+ # @return Array for valid properties with the reasons
222
+ def list_invalid_properties
223
+ invalid_properties = Array.new
224
+ if !@_type.nil? && @_type.to_s.length < 1
225
+ invalid_properties.push('invalid value for "_type", the character length must be great than or equal to 1.')
226
+ end
227
+
228
+ if @name.nil?
229
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
230
+ end
231
+
232
+ if @name.to_s.length < 1
233
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
234
+ end
235
+
236
+ if @url.nil?
237
+ invalid_properties.push('invalid value for "url", url cannot be nil.')
238
+ end
239
+
240
+ if @url.to_s.length < 1
241
+ invalid_properties.push('invalid value for "url", the character length must be great than or equal to 1.')
242
+ end
243
+
244
+ if !@ssl_ca_certificate.nil? && @ssl_ca_certificate.to_s.length < 1
245
+ invalid_properties.push('invalid value for "ssl_ca_certificate", the character length must be great than or equal to 1.')
246
+ end
247
+
248
+ if !@ssl_client_certificate.nil? && @ssl_client_certificate.to_s.length < 1
249
+ invalid_properties.push('invalid value for "ssl_client_certificate", the character length must be great than or equal to 1.')
250
+ end
251
+
252
+ if !@ssl_client_key.nil? && @ssl_client_key.to_s.length < 1
253
+ invalid_properties.push('invalid value for "ssl_client_key", the character length must be great than or equal to 1.')
254
+ end
255
+
256
+ if !@proxy_url.nil? && @proxy_url.to_s.length < 1
257
+ invalid_properties.push('invalid value for "proxy_url", the character length must be great than or equal to 1.')
258
+ end
259
+
260
+ if !@username.nil? && @username.to_s.length < 1
261
+ invalid_properties.push('invalid value for "username", the character length must be great than or equal to 1.')
262
+ end
263
+
264
+ if !@password.nil? && @password.to_s.length < 1
265
+ invalid_properties.push('invalid value for "password", the character length must be great than or equal to 1.')
266
+ end
267
+
268
+ if !@download_concurrency.nil? && @download_concurrency < 1
269
+ invalid_properties.push('invalid value for "download_concurrency", must be greater than or equal to 1.')
270
+ end
271
+
272
+ if @upstream_name.nil?
273
+ invalid_properties.push('invalid value for "upstream_name", upstream_name cannot be nil.')
274
+ end
275
+
276
+ if @upstream_name.to_s.length < 1
277
+ invalid_properties.push('invalid value for "upstream_name", the character length must be great than or equal to 1.')
278
+ end
279
+
280
+ if !@whitelist_tags.nil? && @whitelist_tags.to_s.length < 1
281
+ invalid_properties.push('invalid value for "whitelist_tags", the character length must be great than or equal to 1.')
282
+ end
283
+
284
+ invalid_properties
285
+ end
286
+
287
+ # Check to see if the all the properties in the model are valid
288
+ # @return true if the model is valid
289
+ def valid?
290
+ return false if !@_type.nil? && @_type.to_s.length < 1
291
+ return false if @name.nil?
292
+ return false if @name.to_s.length < 1
293
+ return false if @url.nil?
294
+ return false if @url.to_s.length < 1
295
+ return false if !@ssl_ca_certificate.nil? && @ssl_ca_certificate.to_s.length < 1
296
+ return false if !@ssl_client_certificate.nil? && @ssl_client_certificate.to_s.length < 1
297
+ return false if !@ssl_client_key.nil? && @ssl_client_key.to_s.length < 1
298
+ return false if !@proxy_url.nil? && @proxy_url.to_s.length < 1
299
+ return false if !@username.nil? && @username.to_s.length < 1
300
+ return false if !@password.nil? && @password.to_s.length < 1
301
+ return false if !@download_concurrency.nil? && @download_concurrency < 1
302
+ policy_validator = EnumAttributeValidator.new('String', ["immediate", "on_demand", "streamed"])
303
+ return false unless policy_validator.valid?(@policy)
304
+ return false if @upstream_name.nil?
305
+ return false if @upstream_name.to_s.length < 1
306
+ return false if !@whitelist_tags.nil? && @whitelist_tags.to_s.length < 1
307
+ true
308
+ end
309
+
310
+ # Custom attribute writer method with validation
311
+ # @param [Object] _type Value to be assigned
312
+ def _type=(_type)
313
+ if !_type.nil? && _type.to_s.length < 1
314
+ fail ArgumentError, 'invalid value for "_type", the character length must be great than or equal to 1.'
315
+ end
316
+
317
+ @_type = _type
318
+ end
319
+
320
+ # Custom attribute writer method with validation
321
+ # @param [Object] name Value to be assigned
322
+ def name=(name)
323
+ if name.nil?
324
+ fail ArgumentError, 'name cannot be nil'
325
+ end
326
+
327
+ if name.to_s.length < 1
328
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
329
+ end
330
+
331
+ @name = name
332
+ end
333
+
334
+ # Custom attribute writer method with validation
335
+ # @param [Object] url Value to be assigned
336
+ def url=(url)
337
+ if url.nil?
338
+ fail ArgumentError, 'url cannot be nil'
339
+ end
340
+
341
+ if url.to_s.length < 1
342
+ fail ArgumentError, 'invalid value for "url", the character length must be great than or equal to 1.'
343
+ end
344
+
345
+ @url = url
346
+ end
347
+
348
+ # Custom attribute writer method with validation
349
+ # @param [Object] ssl_ca_certificate Value to be assigned
350
+ def ssl_ca_certificate=(ssl_ca_certificate)
351
+ if !ssl_ca_certificate.nil? && ssl_ca_certificate.to_s.length < 1
352
+ fail ArgumentError, 'invalid value for "ssl_ca_certificate", the character length must be great than or equal to 1.'
353
+ end
354
+
355
+ @ssl_ca_certificate = ssl_ca_certificate
356
+ end
357
+
358
+ # Custom attribute writer method with validation
359
+ # @param [Object] ssl_client_certificate Value to be assigned
360
+ def ssl_client_certificate=(ssl_client_certificate)
361
+ if !ssl_client_certificate.nil? && ssl_client_certificate.to_s.length < 1
362
+ fail ArgumentError, 'invalid value for "ssl_client_certificate", the character length must be great than or equal to 1.'
363
+ end
364
+
365
+ @ssl_client_certificate = ssl_client_certificate
366
+ end
367
+
368
+ # Custom attribute writer method with validation
369
+ # @param [Object] ssl_client_key Value to be assigned
370
+ def ssl_client_key=(ssl_client_key)
371
+ if !ssl_client_key.nil? && ssl_client_key.to_s.length < 1
372
+ fail ArgumentError, 'invalid value for "ssl_client_key", the character length must be great than or equal to 1.'
373
+ end
374
+
375
+ @ssl_client_key = ssl_client_key
376
+ end
377
+
378
+ # Custom attribute writer method with validation
379
+ # @param [Object] proxy_url Value to be assigned
380
+ def proxy_url=(proxy_url)
381
+ if !proxy_url.nil? && proxy_url.to_s.length < 1
382
+ fail ArgumentError, 'invalid value for "proxy_url", the character length must be great than or equal to 1.'
383
+ end
384
+
385
+ @proxy_url = proxy_url
386
+ end
387
+
388
+ # Custom attribute writer method with validation
389
+ # @param [Object] username Value to be assigned
390
+ def username=(username)
391
+ if !username.nil? && username.to_s.length < 1
392
+ fail ArgumentError, 'invalid value for "username", the character length must be great than or equal to 1.'
393
+ end
394
+
395
+ @username = username
396
+ end
397
+
398
+ # Custom attribute writer method with validation
399
+ # @param [Object] password Value to be assigned
400
+ def password=(password)
401
+ if !password.nil? && password.to_s.length < 1
402
+ fail ArgumentError, 'invalid value for "password", the character length must be great than or equal to 1.'
403
+ end
404
+
405
+ @password = password
406
+ end
407
+
408
+ # Custom attribute writer method with validation
409
+ # @param [Object] download_concurrency Value to be assigned
410
+ def download_concurrency=(download_concurrency)
411
+ if !download_concurrency.nil? && download_concurrency < 1
412
+ fail ArgumentError, 'invalid value for "download_concurrency", must be greater than or equal to 1.'
413
+ end
414
+
415
+ @download_concurrency = download_concurrency
416
+ end
417
+
418
+ # Custom attribute writer method checking allowed values (enum).
419
+ # @param [Object] policy Object to be assigned
420
+ def policy=(policy)
421
+ validator = EnumAttributeValidator.new('String', ["immediate", "on_demand", "streamed"])
422
+ unless validator.valid?(policy)
423
+ fail ArgumentError, "invalid value for \"policy\", must be one of #{validator.allowable_values}."
424
+ end
425
+ @policy = policy
426
+ end
427
+
428
+ # Custom attribute writer method with validation
429
+ # @param [Object] upstream_name Value to be assigned
430
+ def upstream_name=(upstream_name)
431
+ if upstream_name.nil?
432
+ fail ArgumentError, 'upstream_name cannot be nil'
433
+ end
434
+
435
+ if upstream_name.to_s.length < 1
436
+ fail ArgumentError, 'invalid value for "upstream_name", the character length must be great than or equal to 1.'
437
+ end
438
+
439
+ @upstream_name = upstream_name
440
+ end
441
+
442
+ # Custom attribute writer method with validation
443
+ # @param [Object] whitelist_tags Value to be assigned
444
+ def whitelist_tags=(whitelist_tags)
445
+ if !whitelist_tags.nil? && whitelist_tags.to_s.length < 1
446
+ fail ArgumentError, 'invalid value for "whitelist_tags", the character length must be great than or equal to 1.'
447
+ end
448
+
449
+ @whitelist_tags = whitelist_tags
450
+ end
451
+
452
+ # Checks equality by comparing each attribute.
453
+ # @param [Object] Object to be compared
454
+ def ==(o)
455
+ return true if self.equal?(o)
456
+ self.class == o.class &&
457
+ _href == o._href &&
458
+ _created == o._created &&
459
+ _type == o._type &&
460
+ name == o.name &&
461
+ url == o.url &&
462
+ ssl_ca_certificate == o.ssl_ca_certificate &&
463
+ ssl_client_certificate == o.ssl_client_certificate &&
464
+ ssl_client_key == o.ssl_client_key &&
465
+ ssl_validation == o.ssl_validation &&
466
+ proxy_url == o.proxy_url &&
467
+ username == o.username &&
468
+ password == o.password &&
469
+ _last_updated == o._last_updated &&
470
+ download_concurrency == o.download_concurrency &&
471
+ policy == o.policy &&
472
+ upstream_name == o.upstream_name &&
473
+ whitelist_tags == o.whitelist_tags
474
+ end
475
+
476
+ # @see the `==` method
477
+ # @param [Object] Object to be compared
478
+ def eql?(o)
479
+ self == o
480
+ end
481
+
482
+ # Calculates hash code according to all attributes.
483
+ # @return [Integer] Hash code
484
+ def hash
485
+ [_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, upstream_name, whitelist_tags].hash
486
+ end
487
+
488
+ # Builds the object from hash
489
+ # @param [Hash] attributes Model attributes in the form of hash
490
+ # @return [Object] Returns the model itself
491
+ def self.build_from_hash(attributes)
492
+ new.build_from_hash(attributes)
493
+ end
494
+
495
+ # Builds the object from hash
496
+ # @param [Hash] attributes Model attributes in the form of hash
497
+ # @return [Object] Returns the model itself
498
+ def build_from_hash(attributes)
499
+ return nil unless attributes.is_a?(Hash)
500
+ self.class.openapi_types.each_pair do |key, type|
501
+ if type =~ /\AArray<(.*)>/i
502
+ # check to ensure the input is an array given that the attribute
503
+ # is documented as an array but the input is not
504
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
505
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
506
+ end
507
+ elsif !attributes[self.class.attribute_map[key]].nil?
508
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
509
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
510
+ end
511
+
512
+ self
513
+ end
514
+
515
+ # Deserializes the data based on type
516
+ # @param string type Data type
517
+ # @param string value Value to be deserialized
518
+ # @return [Object] Deserialized data
519
+ def _deserialize(type, value)
520
+ case type.to_sym
521
+ when :DateTime
522
+ DateTime.parse(value)
523
+ when :Date
524
+ Date.parse(value)
525
+ when :String
526
+ value.to_s
527
+ when :Integer
528
+ value.to_i
529
+ when :Float
530
+ value.to_f
531
+ when :Boolean
532
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
533
+ true
534
+ else
535
+ false
536
+ end
537
+ when :Object
538
+ # generic object (usually a Hash), return directly
539
+ value
540
+ when /\AArray<(?<inner_type>.+)>\z/
541
+ inner_type = Regexp.last_match[:inner_type]
542
+ value.map { |v| _deserialize(inner_type, v) }
543
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
544
+ k_type = Regexp.last_match[:k_type]
545
+ v_type = Regexp.last_match[:v_type]
546
+ {}.tap do |hash|
547
+ value.each do |k, v|
548
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
549
+ end
550
+ end
551
+ else # model
552
+ PulpDockerClient.const_get(type).build_from_hash(value)
553
+ end
554
+ end
555
+
556
+ # Returns the string representation of the object
557
+ # @return [String] String presentation of the object
558
+ def to_s
559
+ to_hash.to_s
560
+ end
561
+
562
+ # to_body is an alias to to_hash (backward compatibility)
563
+ # @return [Hash] Returns the object in the form of hash
564
+ def to_body
565
+ to_hash
566
+ end
567
+
568
+ # Returns the object in the form of hash
569
+ # @return [Hash] Returns the object in the form of hash
570
+ def to_hash
571
+ hash = {}
572
+ self.class.attribute_map.each_pair do |attr, param|
573
+ value = self.send(attr)
574
+ next if value.nil?
575
+ hash[param] = _to_hash(value)
576
+ end
577
+ hash
578
+ end
579
+
580
+ # Outputs non-array value in the form of hash
581
+ # For object, use to_hash. Otherwise, just return the value
582
+ # @param [Object] value Any valid value
583
+ # @return [Hash] Returns the value in the form of hash
584
+ def _to_hash(value)
585
+ if value.is_a?(Array)
586
+ value.compact.map { |v| _to_hash(v) }
587
+ elsif value.is_a?(Hash)
588
+ {}.tap do |hash|
589
+ value.each { |k, v| hash[k] = _to_hash(v) }
590
+ end
591
+ elsif value.respond_to? :to_hash
592
+ value.to_hash
593
+ else
594
+ value
595
+ end
596
+ end
597
+ end
598
+ end