pulp_container_client 2.0.0b2 → 2.0.0b3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +32 -20
  3. data/docs/{ContainerBlobRead.md → ContainerBlob.md} +2 -2
  4. data/docs/ContainerContainerDistribution.md +8 -8
  5. data/docs/{ContainerContainerRepositoryRead.md → ContainerContainerPushRepository.md} +2 -2
  6. data/docs/ContainerContentRedirectContentGuard.md +23 -0
  7. data/docs/{ContainerManifestRead.md → ContainerManifest.md} +2 -2
  8. data/docs/{ContainerTagRead.md → ContainerTag.md} +2 -2
  9. data/docs/ContentBlobsApi.md +2 -2
  10. data/docs/ContentManifestsApi.md +2 -2
  11. data/docs/ContentTagsApi.md +2 -2
  12. data/docs/ContentguardsContentRedirectApi.md +355 -0
  13. data/docs/DistributionsContainerApi.md +4 -4
  14. data/docs/InlineResponse200.md +1 -1
  15. data/docs/InlineResponse2001.md +1 -1
  16. data/docs/InlineResponse2002.md +1 -1
  17. data/docs/InlineResponse2003.md +1 -1
  18. data/docs/InlineResponse2004.md +1 -1
  19. data/docs/InlineResponse2005.md +1 -1
  20. data/docs/InlineResponse2006.md +1 -1
  21. data/docs/InlineResponse2007.md +23 -0
  22. data/docs/InlineResponse2008.md +23 -0
  23. data/docs/RemotesContainerApi.md +6 -6
  24. data/docs/RepositoriesContainerApi.md +6 -6
  25. data/docs/RepositoriesContainerPushApi.md +356 -0
  26. data/docs/RepositoriesContainerVersionsApi.md +285 -20
  27. data/docs/{V2Api.md → TokenApi.md} +5 -5
  28. data/lib/pulp_container_client.rb +10 -12
  29. data/lib/pulp_container_client/api/content_blobs_api.rb +3 -3
  30. data/lib/pulp_container_client/api/content_manifests_api.rb +3 -3
  31. data/lib/pulp_container_client/api/content_tags_api.rb +3 -3
  32. data/lib/pulp_container_client/api/contentguards_content_redirect_api.rb +431 -0
  33. data/lib/pulp_container_client/api/distributions_container_api.rb +6 -6
  34. data/lib/pulp_container_client/api/remotes_container_api.rb +9 -9
  35. data/lib/pulp_container_client/api/repositories_container_api.rb +9 -9
  36. data/lib/pulp_container_client/api/repositories_container_push_api.rb +433 -0
  37. data/lib/pulp_container_client/api/repositories_container_versions_api.rb +354 -34
  38. data/lib/pulp_container_client/api/{v2_api.rb → token_api.rb} +6 -6
  39. data/lib/pulp_container_client/models/{container_blob_read.rb → container_blob.rb} +3 -3
  40. data/lib/pulp_container_client/models/container_container_distribution.rb +60 -61
  41. data/lib/pulp_container_client/models/{container_container_repository_read.rb → container_container_push_repository.rb} +3 -3
  42. data/lib/pulp_container_client/models/container_content_redirect_content_guard.rb +276 -0
  43. data/lib/pulp_container_client/models/{container_manifest_read.rb → container_manifest.rb} +3 -3
  44. data/lib/pulp_container_client/models/{container_tag_read.rb → container_tag.rb} +3 -3
  45. data/lib/pulp_container_client/models/inline_response200.rb +1 -1
  46. data/lib/pulp_container_client/models/inline_response2001.rb +1 -1
  47. data/lib/pulp_container_client/models/inline_response2002.rb +1 -1
  48. data/lib/pulp_container_client/models/inline_response2003.rb +1 -1
  49. data/lib/pulp_container_client/models/inline_response2004.rb +1 -1
  50. data/lib/pulp_container_client/models/inline_response2005.rb +1 -1
  51. data/lib/pulp_container_client/models/inline_response2006.rb +1 -1
  52. data/lib/pulp_container_client/models/{repository_version_read.rb → inline_response2007.rb} +42 -39
  53. data/lib/pulp_container_client/models/inline_response2008.rb +247 -0
  54. data/lib/pulp_container_client/version.rb +1 -1
  55. data/spec/api/content_blobs_api_spec.rb +1 -1
  56. data/spec/api/content_manifests_api_spec.rb +1 -1
  57. data/spec/api/content_tags_api_spec.rb +1 -1
  58. data/spec/api/contentguards_content_redirect_api_spec.rb +117 -0
  59. data/spec/api/distributions_container_api_spec.rb +2 -2
  60. data/spec/api/remotes_container_api_spec.rb +3 -3
  61. data/spec/api/repositories_container_api_spec.rb +3 -3
  62. data/spec/api/repositories_container_push_api_spec.rb +117 -0
  63. data/spec/api/repositories_container_versions_api_spec.rb +77 -7
  64. data/spec/api/{v2_api_spec.rb → token_api_spec.rb} +7 -7
  65. data/spec/models/{container_blob_read_spec.rb → container_blob_spec.rb} +6 -6
  66. data/spec/models/container_container_distribution_spec.rb +7 -7
  67. data/spec/models/{container_container_repository_read_spec.rb → container_container_push_repository_spec.rb} +6 -6
  68. data/spec/models/{repository_version_read_spec.rb → container_content_redirect_content_guard_spec.rb} +8 -14
  69. data/spec/models/{container_manifest_read_spec.rb → container_manifest_spec.rb} +6 -6
  70. data/spec/models/{container_tag_read_spec.rb → container_tag_spec.rb} +6 -6
  71. data/spec/models/inline_response2007_spec.rb +59 -0
  72. data/spec/models/inline_response2008_spec.rb +59 -0
  73. metadata +42 -50
  74. data/docs/ContainerContainerDistributionRead.md +0 -31
  75. data/docs/ContainerContainerRemoteRead.md +0 -47
  76. data/docs/RepositoryVersionRead.md +0 -25
  77. data/docs/V2BlobsApi.md +0 -63
  78. data/docs/V2CatalogApi.md +0 -64
  79. data/docs/V2ListApi.md +0 -66
  80. data/docs/V2UploadsApi.md +0 -61
  81. data/lib/pulp_container_client/api/v2_blobs_api.rb +0 -88
  82. data/lib/pulp_container_client/api/v2_catalog_api.rb +0 -80
  83. data/lib/pulp_container_client/api/v2_list_api.rb +0 -86
  84. data/lib/pulp_container_client/api/v2_uploads_api.rb +0 -82
  85. data/lib/pulp_container_client/models/container_container_distribution_read.rb +0 -342
  86. data/lib/pulp_container_client/models/container_container_remote_read.rb +0 -578
  87. data/spec/api/v2_blobs_api_spec.rb +0 -48
  88. data/spec/api/v2_catalog_api_spec.rb +0 -47
  89. data/spec/api/v2_list_api_spec.rb +0 -48
  90. data/spec/api/v2_uploads_api_spec.rb +0 -47
  91. data/spec/models/container_container_distribution_read_spec.rb +0 -83
  92. data/spec/models/container_container_remote_read_spec.rb +0 -135
@@ -13,13 +13,13 @@ OpenAPI Generator version: 4.2.3
13
13
  require 'cgi'
14
14
 
15
15
  module PulpContainerClient
16
- class V2Api
16
+ class TokenApi
17
17
  attr_accessor :api_client
18
18
 
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
- # Handles GET requests for the /v2/ endpoint.
22
+ # Handles GET requests for the /token/ endpoint.
23
23
  # @param [Hash] opts the optional parameters
24
24
  # @option opts [String] :fields A list of fields to include in the response.
25
25
  # @option opts [String] :exclude_fields A list of fields to exclude from the response.
@@ -29,17 +29,17 @@ module PulpContainerClient
29
29
  nil
30
30
  end
31
31
 
32
- # Handles GET requests for the /v2/ endpoint.
32
+ # Handles GET requests for the /token/ endpoint.
33
33
  # @param [Hash] opts the optional parameters
34
34
  # @option opts [String] :fields A list of fields to include in the response.
35
35
  # @option opts [String] :exclude_fields A list of fields to exclude from the response.
36
36
  # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
37
37
  def list_with_http_info(opts = {})
38
38
  if @api_client.config.debugging
39
- @api_client.config.logger.debug 'Calling API: V2Api.list ...'
39
+ @api_client.config.logger.debug 'Calling API: TokenApi.list ...'
40
40
  end
41
41
  # resource path
42
- local_var_path = '/v2/'
42
+ local_var_path = '/token/'
43
43
 
44
44
  # query parameters
45
45
  query_params = opts[:query_params] || {}
@@ -72,7 +72,7 @@ module PulpContainerClient
72
72
 
73
73
  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
74
74
  if @api_client.config.debugging
75
- @api_client.config.logger.debug "API called: V2Api#list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
75
+ @api_client.config.logger.debug "API called: TokenApi#list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
76
76
  end
77
77
  return data, status_code, headers
78
78
  end
@@ -13,7 +13,7 @@ OpenAPI Generator version: 4.2.3
13
13
  require 'date'
14
14
 
15
15
  module PulpContainerClient
16
- class ContainerBlobRead
16
+ class ContainerBlob
17
17
  attr_accessor :pulp_href
18
18
 
19
19
  # Timestamp of creation.
@@ -60,13 +60,13 @@ module PulpContainerClient
60
60
  # @param [Hash] attributes Model attributes in the form of hash
61
61
  def initialize(attributes = {})
62
62
  if (!attributes.is_a?(Hash))
63
- fail ArgumentError, "The input argument (attributes) must be a hash in `PulpContainerClient::ContainerBlobRead` initialize method"
63
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpContainerClient::ContainerBlob` initialize method"
64
64
  end
65
65
 
66
66
  # check to see if the attribute exists and convert string to symbol for hash key
67
67
  attributes = attributes.each_with_object({}) { |(k, v), h|
68
68
  if (!self.class.attribute_map.key?(k.to_sym))
69
- fail ArgumentError, "`#{k}` is not a valid attribute in `PulpContainerClient::ContainerBlobRead`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
69
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpContainerClient::ContainerBlob`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
70
70
  end
71
71
  h[k.to_sym] = v
72
72
  }
@@ -14,39 +14,39 @@ require 'date'
14
14
 
15
15
  module PulpContainerClient
16
16
  class ContainerContainerDistribution
17
- # RepositoryVersion to be served
18
- attr_accessor :repository_version
19
-
20
- # An optional content-guard.
21
- attr_accessor :content_guard
22
-
23
- # The base (relative) path component of the published url. Avoid paths that overlap with other distribution base paths (e.g. \"foo\" and \"foo/bar\")
24
- attr_accessor :base_path
17
+ # Timestamp of creation.
18
+ attr_accessor :pulp_created
25
19
 
26
20
  # The latest RepositoryVersion for this Repository will be served.
27
21
  attr_accessor :repository
28
22
 
29
- # Timestamp of creation.
30
- attr_accessor :pulp_created
23
+ # RepositoryVersion to be served
24
+ attr_accessor :repository_version
31
25
 
32
26
  # A unique name. Ex, `rawhide` and `stable`.
33
27
  attr_accessor :name
34
28
 
29
+ # An optional content-guard. If none is specified, a default one will be used.
30
+ attr_accessor :content_guard
31
+
35
32
  attr_accessor :pulp_href
36
33
 
34
+ # The base (relative) path component of the published url. Avoid paths that overlap with other distribution base paths (e.g. \"foo\" and \"foo/bar\")
35
+ attr_accessor :base_path
36
+
37
37
  # The Registry hostame/name/ to use with docker pull command defined by this distribution.
38
38
  attr_accessor :registry_path
39
39
 
40
40
  # Attribute mapping from ruby-style variable name to JSON key.
41
41
  def self.attribute_map
42
42
  {
43
- :'repository_version' => :'repository_version',
44
- :'content_guard' => :'content_guard',
45
- :'base_path' => :'base_path',
46
- :'repository' => :'repository',
47
43
  :'pulp_created' => :'pulp_created',
44
+ :'repository' => :'repository',
45
+ :'repository_version' => :'repository_version',
48
46
  :'name' => :'name',
47
+ :'content_guard' => :'content_guard',
49
48
  :'pulp_href' => :'pulp_href',
49
+ :'base_path' => :'base_path',
50
50
  :'registry_path' => :'registry_path'
51
51
  }
52
52
  end
@@ -54,13 +54,13 @@ module PulpContainerClient
54
54
  # Attribute type mapping.
55
55
  def self.openapi_types
56
56
  {
57
- :'repository_version' => :'String',
58
- :'content_guard' => :'String',
59
- :'base_path' => :'String',
60
- :'repository' => :'String',
61
57
  :'pulp_created' => :'DateTime',
58
+ :'repository' => :'String',
59
+ :'repository_version' => :'String',
62
60
  :'name' => :'String',
61
+ :'content_guard' => :'String',
63
62
  :'pulp_href' => :'String',
63
+ :'base_path' => :'String',
64
64
  :'registry_path' => :'String'
65
65
  }
66
66
  end
@@ -68,9 +68,8 @@ module PulpContainerClient
68
68
  # List of attributes with nullable: true
69
69
  def self.openapi_nullable
70
70
  Set.new([
71
- :'repository_version',
72
- :'content_guard',
73
71
  :'repository',
72
+ :'repository_version',
74
73
  ])
75
74
  end
76
75
 
@@ -89,34 +88,34 @@ module PulpContainerClient
89
88
  h[k.to_sym] = v
90
89
  }
91
90
 
92
- if attributes.key?(:'repository_version')
93
- self.repository_version = attributes[:'repository_version']
94
- end
95
-
96
- if attributes.key?(:'content_guard')
97
- self.content_guard = attributes[:'content_guard']
98
- end
99
-
100
- if attributes.key?(:'base_path')
101
- self.base_path = attributes[:'base_path']
91
+ if attributes.key?(:'pulp_created')
92
+ self.pulp_created = attributes[:'pulp_created']
102
93
  end
103
94
 
104
95
  if attributes.key?(:'repository')
105
96
  self.repository = attributes[:'repository']
106
97
  end
107
98
 
108
- if attributes.key?(:'pulp_created')
109
- self.pulp_created = attributes[:'pulp_created']
99
+ if attributes.key?(:'repository_version')
100
+ self.repository_version = attributes[:'repository_version']
110
101
  end
111
102
 
112
103
  if attributes.key?(:'name')
113
104
  self.name = attributes[:'name']
114
105
  end
115
106
 
107
+ if attributes.key?(:'content_guard')
108
+ self.content_guard = attributes[:'content_guard']
109
+ end
110
+
116
111
  if attributes.key?(:'pulp_href')
117
112
  self.pulp_href = attributes[:'pulp_href']
118
113
  end
119
114
 
115
+ if attributes.key?(:'base_path')
116
+ self.base_path = attributes[:'base_path']
117
+ end
118
+
120
119
  if attributes.key?(:'registry_path')
121
120
  self.registry_path = attributes[:'registry_path']
122
121
  end
@@ -126,14 +125,6 @@ module PulpContainerClient
126
125
  # @return Array for valid properties with the reasons
127
126
  def list_invalid_properties
128
127
  invalid_properties = Array.new
129
- if @base_path.nil?
130
- invalid_properties.push('invalid value for "base_path", base_path cannot be nil.')
131
- end
132
-
133
- if @base_path.to_s.length < 1
134
- invalid_properties.push('invalid value for "base_path", the character length must be great than or equal to 1.')
135
- end
136
-
137
128
  if @name.nil?
138
129
  invalid_properties.push('invalid value for "name", name cannot be nil.')
139
130
  end
@@ -142,6 +133,14 @@ module PulpContainerClient
142
133
  invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
143
134
  end
144
135
 
136
+ if @base_path.nil?
137
+ invalid_properties.push('invalid value for "base_path", base_path cannot be nil.')
138
+ end
139
+
140
+ if @base_path.to_s.length < 1
141
+ invalid_properties.push('invalid value for "base_path", the character length must be great than or equal to 1.')
142
+ end
143
+
145
144
  if !@registry_path.nil? && @registry_path.to_s.length < 1
146
145
  invalid_properties.push('invalid value for "registry_path", the character length must be great than or equal to 1.')
147
146
  end
@@ -152,28 +151,14 @@ module PulpContainerClient
152
151
  # Check to see if the all the properties in the model are valid
153
152
  # @return true if the model is valid
154
153
  def valid?
155
- return false if @base_path.nil?
156
- return false if @base_path.to_s.length < 1
157
154
  return false if @name.nil?
158
155
  return false if @name.to_s.length < 1
156
+ return false if @base_path.nil?
157
+ return false if @base_path.to_s.length < 1
159
158
  return false if !@registry_path.nil? && @registry_path.to_s.length < 1
160
159
  true
161
160
  end
162
161
 
163
- # Custom attribute writer method with validation
164
- # @param [Object] base_path Value to be assigned
165
- def base_path=(base_path)
166
- if base_path.nil?
167
- fail ArgumentError, 'base_path cannot be nil'
168
- end
169
-
170
- if base_path.to_s.length < 1
171
- fail ArgumentError, 'invalid value for "base_path", the character length must be great than or equal to 1.'
172
- end
173
-
174
- @base_path = base_path
175
- end
176
-
177
162
  # Custom attribute writer method with validation
178
163
  # @param [Object] name Value to be assigned
179
164
  def name=(name)
@@ -188,6 +173,20 @@ module PulpContainerClient
188
173
  @name = name
189
174
  end
190
175
 
176
+ # Custom attribute writer method with validation
177
+ # @param [Object] base_path Value to be assigned
178
+ def base_path=(base_path)
179
+ if base_path.nil?
180
+ fail ArgumentError, 'base_path cannot be nil'
181
+ end
182
+
183
+ if base_path.to_s.length < 1
184
+ fail ArgumentError, 'invalid value for "base_path", the character length must be great than or equal to 1.'
185
+ end
186
+
187
+ @base_path = base_path
188
+ end
189
+
191
190
  # Custom attribute writer method with validation
192
191
  # @param [Object] registry_path Value to be assigned
193
192
  def registry_path=(registry_path)
@@ -203,13 +202,13 @@ module PulpContainerClient
203
202
  def ==(o)
204
203
  return true if self.equal?(o)
205
204
  self.class == o.class &&
206
- repository_version == o.repository_version &&
207
- content_guard == o.content_guard &&
208
- base_path == o.base_path &&
209
- repository == o.repository &&
210
205
  pulp_created == o.pulp_created &&
206
+ repository == o.repository &&
207
+ repository_version == o.repository_version &&
211
208
  name == o.name &&
209
+ content_guard == o.content_guard &&
212
210
  pulp_href == o.pulp_href &&
211
+ base_path == o.base_path &&
213
212
  registry_path == o.registry_path
214
213
  end
215
214
 
@@ -222,7 +221,7 @@ module PulpContainerClient
222
221
  # Calculates hash code according to all attributes.
223
222
  # @return [Integer] Hash code
224
223
  def hash
225
- [repository_version, content_guard, base_path, repository, pulp_created, name, pulp_href, registry_path].hash
224
+ [pulp_created, repository, repository_version, name, content_guard, pulp_href, base_path, registry_path].hash
226
225
  end
227
226
 
228
227
  # Builds the object from hash
@@ -13,7 +13,7 @@ OpenAPI Generator version: 4.2.3
13
13
  require 'date'
14
14
 
15
15
  module PulpContainerClient
16
- class ContainerContainerRepositoryRead
16
+ class ContainerContainerPushRepository
17
17
  attr_accessor :pulp_href
18
18
 
19
19
  # Timestamp of creation.
@@ -64,13 +64,13 @@ module PulpContainerClient
64
64
  # @param [Hash] attributes Model attributes in the form of hash
65
65
  def initialize(attributes = {})
66
66
  if (!attributes.is_a?(Hash))
67
- fail ArgumentError, "The input argument (attributes) must be a hash in `PulpContainerClient::ContainerContainerRepositoryRead` initialize method"
67
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpContainerClient::ContainerContainerPushRepository` initialize method"
68
68
  end
69
69
 
70
70
  # check to see if the attribute exists and convert string to symbol for hash key
71
71
  attributes = attributes.each_with_object({}) { |(k, v), h|
72
72
  if (!self.class.attribute_map.key?(k.to_sym))
73
- fail ArgumentError, "`#{k}` is not a valid attribute in `PulpContainerClient::ContainerContainerRepositoryRead`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
73
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpContainerClient::ContainerContainerPushRepository`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
74
74
  end
75
75
  h[k.to_sym] = v
76
76
  }
@@ -0,0 +1,276 @@
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.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module PulpContainerClient
16
+ class ContainerContentRedirectContentGuard
17
+ attr_accessor :pulp_href
18
+
19
+ # Timestamp of creation.
20
+ attr_accessor :pulp_created
21
+
22
+ # The unique name.
23
+ attr_accessor :name
24
+
25
+ # An optional description.
26
+ attr_accessor :description
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'pulp_href' => :'pulp_href',
32
+ :'pulp_created' => :'pulp_created',
33
+ :'name' => :'name',
34
+ :'description' => :'description'
35
+ }
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'pulp_href' => :'String',
42
+ :'pulp_created' => :'DateTime',
43
+ :'name' => :'String',
44
+ :'description' => :'String'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ :'description'
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpContainerClient::ContainerContentRedirectContentGuard` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!self.class.attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpContainerClient::ContainerContentRedirectContentGuard`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'pulp_href')
71
+ self.pulp_href = attributes[:'pulp_href']
72
+ end
73
+
74
+ if attributes.key?(:'pulp_created')
75
+ self.pulp_created = attributes[:'pulp_created']
76
+ end
77
+
78
+ if attributes.key?(:'name')
79
+ self.name = attributes[:'name']
80
+ end
81
+
82
+ if attributes.key?(:'description')
83
+ self.description = attributes[:'description']
84
+ end
85
+ end
86
+
87
+ # Show invalid properties with the reasons. Usually used together with valid?
88
+ # @return Array for valid properties with the reasons
89
+ def list_invalid_properties
90
+ invalid_properties = Array.new
91
+ if @name.nil?
92
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
93
+ end
94
+
95
+ if @name.to_s.length < 1
96
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
97
+ end
98
+
99
+ if !@description.nil? && @description.to_s.length < 1
100
+ invalid_properties.push('invalid value for "description", the character length must be great than or equal to 1.')
101
+ end
102
+
103
+ invalid_properties
104
+ end
105
+
106
+ # Check to see if the all the properties in the model are valid
107
+ # @return true if the model is valid
108
+ def valid?
109
+ return false if @name.nil?
110
+ return false if @name.to_s.length < 1
111
+ return false if !@description.nil? && @description.to_s.length < 1
112
+ true
113
+ end
114
+
115
+ # Custom attribute writer method with validation
116
+ # @param [Object] name Value to be assigned
117
+ def name=(name)
118
+ if name.nil?
119
+ fail ArgumentError, 'name cannot be nil'
120
+ end
121
+
122
+ if name.to_s.length < 1
123
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
124
+ end
125
+
126
+ @name = name
127
+ end
128
+
129
+ # Custom attribute writer method with validation
130
+ # @param [Object] description Value to be assigned
131
+ def description=(description)
132
+ if !description.nil? && description.to_s.length < 1
133
+ fail ArgumentError, 'invalid value for "description", the character length must be great than or equal to 1.'
134
+ end
135
+
136
+ @description = description
137
+ end
138
+
139
+ # Checks equality by comparing each attribute.
140
+ # @param [Object] Object to be compared
141
+ def ==(o)
142
+ return true if self.equal?(o)
143
+ self.class == o.class &&
144
+ pulp_href == o.pulp_href &&
145
+ pulp_created == o.pulp_created &&
146
+ name == o.name &&
147
+ description == o.description
148
+ end
149
+
150
+ # @see the `==` method
151
+ # @param [Object] Object to be compared
152
+ def eql?(o)
153
+ self == o
154
+ end
155
+
156
+ # Calculates hash code according to all attributes.
157
+ # @return [Integer] Hash code
158
+ def hash
159
+ [pulp_href, pulp_created, name, description].hash
160
+ end
161
+
162
+ # Builds the object from hash
163
+ # @param [Hash] attributes Model attributes in the form of hash
164
+ # @return [Object] Returns the model itself
165
+ def self.build_from_hash(attributes)
166
+ new.build_from_hash(attributes)
167
+ end
168
+
169
+ # Builds the object from hash
170
+ # @param [Hash] attributes Model attributes in the form of hash
171
+ # @return [Object] Returns the model itself
172
+ def build_from_hash(attributes)
173
+ return nil unless attributes.is_a?(Hash)
174
+ self.class.openapi_types.each_pair do |key, type|
175
+ if type =~ /\AArray<(.*)>/i
176
+ # check to ensure the input is an array given that the attribute
177
+ # is documented as an array but the input is not
178
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
179
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
180
+ end
181
+ elsif !attributes[self.class.attribute_map[key]].nil?
182
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
183
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
184
+ end
185
+
186
+ self
187
+ end
188
+
189
+ # Deserializes the data based on type
190
+ # @param string type Data type
191
+ # @param string value Value to be deserialized
192
+ # @return [Object] Deserialized data
193
+ def _deserialize(type, value)
194
+ case type.to_sym
195
+ when :DateTime
196
+ DateTime.parse(value)
197
+ when :Date
198
+ Date.parse(value)
199
+ when :String
200
+ value.to_s
201
+ when :Integer
202
+ value.to_i
203
+ when :Float
204
+ value.to_f
205
+ when :Boolean
206
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
207
+ true
208
+ else
209
+ false
210
+ end
211
+ when :Object
212
+ # generic object (usually a Hash), return directly
213
+ value
214
+ when /\AArray<(?<inner_type>.+)>\z/
215
+ inner_type = Regexp.last_match[:inner_type]
216
+ value.map { |v| _deserialize(inner_type, v) }
217
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
218
+ k_type = Regexp.last_match[:k_type]
219
+ v_type = Regexp.last_match[:v_type]
220
+ {}.tap do |hash|
221
+ value.each do |k, v|
222
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
223
+ end
224
+ end
225
+ else # model
226
+ PulpContainerClient.const_get(type).build_from_hash(value)
227
+ end
228
+ end
229
+
230
+ # Returns the string representation of the object
231
+ # @return [String] String presentation of the object
232
+ def to_s
233
+ to_hash.to_s
234
+ end
235
+
236
+ # to_body is an alias to to_hash (backward compatibility)
237
+ # @return [Hash] Returns the object in the form of hash
238
+ def to_body
239
+ to_hash
240
+ end
241
+
242
+ # Returns the object in the form of hash
243
+ # @return [Hash] Returns the object in the form of hash
244
+ def to_hash
245
+ hash = {}
246
+ self.class.attribute_map.each_pair do |attr, param|
247
+ value = self.send(attr)
248
+ if value.nil?
249
+ is_nullable = self.class.openapi_nullable.include?(attr)
250
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
251
+ end
252
+
253
+ hash[param] = _to_hash(value)
254
+ end
255
+ hash
256
+ end
257
+
258
+ # Outputs non-array value in the form of hash
259
+ # For object, use to_hash. Otherwise, just return the value
260
+ # @param [Object] value Any valid value
261
+ # @return [Hash] Returns the value in the form of hash
262
+ def _to_hash(value)
263
+ if value.is_a?(Array)
264
+ value.compact.map { |v| _to_hash(v) }
265
+ elsif value.is_a?(Hash)
266
+ {}.tap do |hash|
267
+ value.each { |k, v| hash[k] = _to_hash(v) }
268
+ end
269
+ elsif value.respond_to? :to_hash
270
+ value.to_hash
271
+ else
272
+ value
273
+ end
274
+ end
275
+ end
276
+ end