pulp_ansible_client 0.2.0b1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,202 @@
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 AsyncOperationResponse
17
+ # The href of the task.
18
+ attr_accessor :task
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'task' => :'task'
24
+ }
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.openapi_types
29
+ {
30
+ :'task' => :'String'
31
+ }
32
+ end
33
+
34
+ # Initializes the object
35
+ # @param [Hash] attributes Model attributes in the form of hash
36
+ def initialize(attributes = {})
37
+ if (!attributes.is_a?(Hash))
38
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpAnsibleClient::AsyncOperationResponse` initialize method"
39
+ end
40
+
41
+ # check to see if the attribute exists and convert string to symbol for hash key
42
+ attributes = attributes.each_with_object({}) { |(k, v), h|
43
+ if (!self.class.attribute_map.key?(k.to_sym))
44
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpAnsibleClient::AsyncOperationResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
45
+ end
46
+ h[k.to_sym] = v
47
+ }
48
+
49
+ if attributes.key?(:'task')
50
+ self.task = attributes[:'task']
51
+ end
52
+ end
53
+
54
+ # Show invalid properties with the reasons. Usually used together with valid?
55
+ # @return Array for valid properties with the reasons
56
+ def list_invalid_properties
57
+ invalid_properties = Array.new
58
+ if @task.nil?
59
+ invalid_properties.push('invalid value for "task", task cannot be nil.')
60
+ end
61
+
62
+ invalid_properties
63
+ end
64
+
65
+ # Check to see if the all the properties in the model are valid
66
+ # @return true if the model is valid
67
+ def valid?
68
+ return false if @task.nil?
69
+ true
70
+ end
71
+
72
+ # Checks equality by comparing each attribute.
73
+ # @param [Object] Object to be compared
74
+ def ==(o)
75
+ return true if self.equal?(o)
76
+ self.class == o.class &&
77
+ task == o.task
78
+ end
79
+
80
+ # @see the `==` method
81
+ # @param [Object] Object to be compared
82
+ def eql?(o)
83
+ self == o
84
+ end
85
+
86
+ # Calculates hash code according to all attributes.
87
+ # @return [Integer] Hash code
88
+ def hash
89
+ [task].hash
90
+ end
91
+
92
+ # Builds the object from hash
93
+ # @param [Hash] attributes Model attributes in the form of hash
94
+ # @return [Object] Returns the model itself
95
+ def self.build_from_hash(attributes)
96
+ new.build_from_hash(attributes)
97
+ end
98
+
99
+ # Builds the object from hash
100
+ # @param [Hash] attributes Model attributes in the form of hash
101
+ # @return [Object] Returns the model itself
102
+ def build_from_hash(attributes)
103
+ return nil unless attributes.is_a?(Hash)
104
+ self.class.openapi_types.each_pair do |key, type|
105
+ if type =~ /\AArray<(.*)>/i
106
+ # check to ensure the input is an array given that the attribute
107
+ # is documented as an array but the input is not
108
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
109
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
110
+ end
111
+ elsif !attributes[self.class.attribute_map[key]].nil?
112
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
113
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
114
+ end
115
+
116
+ self
117
+ end
118
+
119
+ # Deserializes the data based on type
120
+ # @param string type Data type
121
+ # @param string value Value to be deserialized
122
+ # @return [Object] Deserialized data
123
+ def _deserialize(type, value)
124
+ case type.to_sym
125
+ when :DateTime
126
+ DateTime.parse(value)
127
+ when :Date
128
+ Date.parse(value)
129
+ when :String
130
+ value.to_s
131
+ when :Integer
132
+ value.to_i
133
+ when :Float
134
+ value.to_f
135
+ when :Boolean
136
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
137
+ true
138
+ else
139
+ false
140
+ end
141
+ when :Object
142
+ # generic object (usually a Hash), return directly
143
+ value
144
+ when /\AArray<(?<inner_type>.+)>\z/
145
+ inner_type = Regexp.last_match[:inner_type]
146
+ value.map { |v| _deserialize(inner_type, v) }
147
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
148
+ k_type = Regexp.last_match[:k_type]
149
+ v_type = Regexp.last_match[:v_type]
150
+ {}.tap do |hash|
151
+ value.each do |k, v|
152
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
153
+ end
154
+ end
155
+ else # model
156
+ PulpAnsibleClient.const_get(type).build_from_hash(value)
157
+ end
158
+ end
159
+
160
+ # Returns the string representation of the object
161
+ # @return [String] String presentation of the object
162
+ def to_s
163
+ to_hash.to_s
164
+ end
165
+
166
+ # to_body is an alias to to_hash (backward compatibility)
167
+ # @return [Hash] Returns the object in the form of hash
168
+ def to_body
169
+ to_hash
170
+ end
171
+
172
+ # Returns the object in the form of hash
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_hash
175
+ hash = {}
176
+ self.class.attribute_map.each_pair do |attr, param|
177
+ value = self.send(attr)
178
+ next if value.nil?
179
+ hash[param] = _to_hash(value)
180
+ end
181
+ hash
182
+ end
183
+
184
+ # Outputs non-array value in the form of hash
185
+ # For object, use to_hash. Otherwise, just return the value
186
+ # @param [Object] value Any valid value
187
+ # @return [Hash] Returns the value in the form of hash
188
+ def _to_hash(value)
189
+ if value.is_a?(Array)
190
+ value.compact.map { |v| _to_hash(v) }
191
+ elsif value.is_a?(Hash)
192
+ {}.tap do |hash|
193
+ value.each { |k, v| hash[k] = _to_hash(v) }
194
+ end
195
+ elsif value.respond_to? :to_hash
196
+ value.to_hash
197
+ else
198
+ value
199
+ end
200
+ end
201
+ end
202
+ end
@@ -0,0 +1,494 @@
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 Collection
17
+ # Timestamp of creation.
18
+ attr_accessor :_created
19
+
20
+ # Artifact file representing the physical content
21
+ attr_accessor :_artifact
22
+
23
+ attr_accessor :_href
24
+
25
+ attr_accessor :_type
26
+
27
+ # The MD5 checksum if available.
28
+ attr_accessor :md5
29
+
30
+ # The SHA-1 checksum if available.
31
+ attr_accessor :sha1
32
+
33
+ # The SHA-224 checksum if available.
34
+ attr_accessor :sha224
35
+
36
+ # The SHA-256 checksum if available.
37
+ attr_accessor :sha256
38
+
39
+ # The SHA-384 checksum if available.
40
+ attr_accessor :sha384
41
+
42
+ # The SHA-512 checksum if available.
43
+ attr_accessor :sha512
44
+
45
+ attr_accessor :version
46
+
47
+ attr_accessor :name
48
+
49
+ attr_accessor :namespace
50
+
51
+ # Attribute mapping from ruby-style variable name to JSON key.
52
+ def self.attribute_map
53
+ {
54
+ :'_created' => :'_created',
55
+ :'_artifact' => :'_artifact',
56
+ :'_href' => :'_href',
57
+ :'_type' => :'_type',
58
+ :'md5' => :'md5',
59
+ :'sha1' => :'sha1',
60
+ :'sha224' => :'sha224',
61
+ :'sha256' => :'sha256',
62
+ :'sha384' => :'sha384',
63
+ :'sha512' => :'sha512',
64
+ :'version' => :'version',
65
+ :'name' => :'name',
66
+ :'namespace' => :'namespace'
67
+ }
68
+ end
69
+
70
+ # Attribute type mapping.
71
+ def self.openapi_types
72
+ {
73
+ :'_created' => :'DateTime',
74
+ :'_artifact' => :'String',
75
+ :'_href' => :'String',
76
+ :'_type' => :'String',
77
+ :'md5' => :'String',
78
+ :'sha1' => :'String',
79
+ :'sha224' => :'String',
80
+ :'sha256' => :'String',
81
+ :'sha384' => :'String',
82
+ :'sha512' => :'String',
83
+ :'version' => :'String',
84
+ :'name' => :'String',
85
+ :'namespace' => :'String'
86
+ }
87
+ end
88
+
89
+ # Initializes the object
90
+ # @param [Hash] attributes Model attributes in the form of hash
91
+ def initialize(attributes = {})
92
+ if (!attributes.is_a?(Hash))
93
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpAnsibleClient::Collection` initialize method"
94
+ end
95
+
96
+ # check to see if the attribute exists and convert string to symbol for hash key
97
+ attributes = attributes.each_with_object({}) { |(k, v), h|
98
+ if (!self.class.attribute_map.key?(k.to_sym))
99
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpAnsibleClient::Collection`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
100
+ end
101
+ h[k.to_sym] = v
102
+ }
103
+
104
+ if attributes.key?(:'_created')
105
+ self._created = attributes[:'_created']
106
+ end
107
+
108
+ if attributes.key?(:'_artifact')
109
+ self._artifact = attributes[:'_artifact']
110
+ end
111
+
112
+ if attributes.key?(:'_href')
113
+ self._href = attributes[:'_href']
114
+ end
115
+
116
+ if attributes.key?(:'_type')
117
+ self._type = attributes[:'_type']
118
+ end
119
+
120
+ if attributes.key?(:'md5')
121
+ self.md5 = attributes[:'md5']
122
+ end
123
+
124
+ if attributes.key?(:'sha1')
125
+ self.sha1 = attributes[:'sha1']
126
+ end
127
+
128
+ if attributes.key?(:'sha224')
129
+ self.sha224 = attributes[:'sha224']
130
+ end
131
+
132
+ if attributes.key?(:'sha256')
133
+ self.sha256 = attributes[:'sha256']
134
+ end
135
+
136
+ if attributes.key?(:'sha384')
137
+ self.sha384 = attributes[:'sha384']
138
+ end
139
+
140
+ if attributes.key?(:'sha512')
141
+ self.sha512 = attributes[:'sha512']
142
+ end
143
+
144
+ if attributes.key?(:'version')
145
+ self.version = attributes[:'version']
146
+ end
147
+
148
+ if attributes.key?(:'name')
149
+ self.name = attributes[:'name']
150
+ end
151
+
152
+ if attributes.key?(:'namespace')
153
+ self.namespace = attributes[:'namespace']
154
+ end
155
+ end
156
+
157
+ # Show invalid properties with the reasons. Usually used together with valid?
158
+ # @return Array for valid properties with the reasons
159
+ def list_invalid_properties
160
+ invalid_properties = Array.new
161
+ if @_artifact.nil?
162
+ invalid_properties.push('invalid value for "_artifact", _artifact cannot be nil.')
163
+ end
164
+
165
+ if !@_type.nil? && @_type.to_s.length < 1
166
+ invalid_properties.push('invalid value for "_type", the character length must be great than or equal to 1.')
167
+ end
168
+
169
+ if !@md5.nil? && @md5.to_s.length < 1
170
+ invalid_properties.push('invalid value for "md5", the character length must be great than or equal to 1.')
171
+ end
172
+
173
+ if !@sha1.nil? && @sha1.to_s.length < 1
174
+ invalid_properties.push('invalid value for "sha1", the character length must be great than or equal to 1.')
175
+ end
176
+
177
+ if !@sha224.nil? && @sha224.to_s.length < 1
178
+ invalid_properties.push('invalid value for "sha224", the character length must be great than or equal to 1.')
179
+ end
180
+
181
+ if !@sha256.nil? && @sha256.to_s.length < 1
182
+ invalid_properties.push('invalid value for "sha256", the character length must be great than or equal to 1.')
183
+ end
184
+
185
+ if !@sha384.nil? && @sha384.to_s.length < 1
186
+ invalid_properties.push('invalid value for "sha384", the character length must be great than or equal to 1.')
187
+ end
188
+
189
+ if !@sha512.nil? && @sha512.to_s.length < 1
190
+ invalid_properties.push('invalid value for "sha512", the character length must be great than or equal to 1.')
191
+ end
192
+
193
+ if @version.nil?
194
+ invalid_properties.push('invalid value for "version", version cannot be nil.')
195
+ end
196
+
197
+ if @version.to_s.length < 1
198
+ invalid_properties.push('invalid value for "version", the character length must be great than or equal to 1.')
199
+ end
200
+
201
+ if @name.nil?
202
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
203
+ end
204
+
205
+ if @name.to_s.length < 1
206
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
207
+ end
208
+
209
+ if @namespace.nil?
210
+ invalid_properties.push('invalid value for "namespace", namespace cannot be nil.')
211
+ end
212
+
213
+ if @namespace.to_s.length < 1
214
+ invalid_properties.push('invalid value for "namespace", the character length must be great than or equal to 1.')
215
+ end
216
+
217
+ invalid_properties
218
+ end
219
+
220
+ # Check to see if the all the properties in the model are valid
221
+ # @return true if the model is valid
222
+ def valid?
223
+ return false if @_artifact.nil?
224
+ return false if !@_type.nil? && @_type.to_s.length < 1
225
+ return false if !@md5.nil? && @md5.to_s.length < 1
226
+ return false if !@sha1.nil? && @sha1.to_s.length < 1
227
+ return false if !@sha224.nil? && @sha224.to_s.length < 1
228
+ return false if !@sha256.nil? && @sha256.to_s.length < 1
229
+ return false if !@sha384.nil? && @sha384.to_s.length < 1
230
+ return false if !@sha512.nil? && @sha512.to_s.length < 1
231
+ return false if @version.nil?
232
+ return false if @version.to_s.length < 1
233
+ return false if @name.nil?
234
+ return false if @name.to_s.length < 1
235
+ return false if @namespace.nil?
236
+ return false if @namespace.to_s.length < 1
237
+ true
238
+ end
239
+
240
+ # Custom attribute writer method with validation
241
+ # @param [Object] _type Value to be assigned
242
+ def _type=(_type)
243
+ if !_type.nil? && _type.to_s.length < 1
244
+ fail ArgumentError, 'invalid value for "_type", the character length must be great than or equal to 1.'
245
+ end
246
+
247
+ @_type = _type
248
+ end
249
+
250
+ # Custom attribute writer method with validation
251
+ # @param [Object] md5 Value to be assigned
252
+ def md5=(md5)
253
+ if !md5.nil? && md5.to_s.length < 1
254
+ fail ArgumentError, 'invalid value for "md5", the character length must be great than or equal to 1.'
255
+ end
256
+
257
+ @md5 = md5
258
+ end
259
+
260
+ # Custom attribute writer method with validation
261
+ # @param [Object] sha1 Value to be assigned
262
+ def sha1=(sha1)
263
+ if !sha1.nil? && sha1.to_s.length < 1
264
+ fail ArgumentError, 'invalid value for "sha1", the character length must be great than or equal to 1.'
265
+ end
266
+
267
+ @sha1 = sha1
268
+ end
269
+
270
+ # Custom attribute writer method with validation
271
+ # @param [Object] sha224 Value to be assigned
272
+ def sha224=(sha224)
273
+ if !sha224.nil? && sha224.to_s.length < 1
274
+ fail ArgumentError, 'invalid value for "sha224", the character length must be great than or equal to 1.'
275
+ end
276
+
277
+ @sha224 = sha224
278
+ end
279
+
280
+ # Custom attribute writer method with validation
281
+ # @param [Object] sha256 Value to be assigned
282
+ def sha256=(sha256)
283
+ if !sha256.nil? && sha256.to_s.length < 1
284
+ fail ArgumentError, 'invalid value for "sha256", the character length must be great than or equal to 1.'
285
+ end
286
+
287
+ @sha256 = sha256
288
+ end
289
+
290
+ # Custom attribute writer method with validation
291
+ # @param [Object] sha384 Value to be assigned
292
+ def sha384=(sha384)
293
+ if !sha384.nil? && sha384.to_s.length < 1
294
+ fail ArgumentError, 'invalid value for "sha384", the character length must be great than or equal to 1.'
295
+ end
296
+
297
+ @sha384 = sha384
298
+ end
299
+
300
+ # Custom attribute writer method with validation
301
+ # @param [Object] sha512 Value to be assigned
302
+ def sha512=(sha512)
303
+ if !sha512.nil? && sha512.to_s.length < 1
304
+ fail ArgumentError, 'invalid value for "sha512", the character length must be great than or equal to 1.'
305
+ end
306
+
307
+ @sha512 = sha512
308
+ end
309
+
310
+ # Custom attribute writer method with validation
311
+ # @param [Object] version Value to be assigned
312
+ def version=(version)
313
+ if version.nil?
314
+ fail ArgumentError, 'version cannot be nil'
315
+ end
316
+
317
+ if version.to_s.length < 1
318
+ fail ArgumentError, 'invalid value for "version", the character length must be great than or equal to 1.'
319
+ end
320
+
321
+ @version = version
322
+ end
323
+
324
+ # Custom attribute writer method with validation
325
+ # @param [Object] name Value to be assigned
326
+ def name=(name)
327
+ if name.nil?
328
+ fail ArgumentError, 'name cannot be nil'
329
+ end
330
+
331
+ if name.to_s.length < 1
332
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
333
+ end
334
+
335
+ @name = name
336
+ end
337
+
338
+ # Custom attribute writer method with validation
339
+ # @param [Object] namespace Value to be assigned
340
+ def namespace=(namespace)
341
+ if namespace.nil?
342
+ fail ArgumentError, 'namespace cannot be nil'
343
+ end
344
+
345
+ if namespace.to_s.length < 1
346
+ fail ArgumentError, 'invalid value for "namespace", the character length must be great than or equal to 1.'
347
+ end
348
+
349
+ @namespace = namespace
350
+ end
351
+
352
+ # Checks equality by comparing each attribute.
353
+ # @param [Object] Object to be compared
354
+ def ==(o)
355
+ return true if self.equal?(o)
356
+ self.class == o.class &&
357
+ _created == o._created &&
358
+ _artifact == o._artifact &&
359
+ _href == o._href &&
360
+ _type == o._type &&
361
+ md5 == o.md5 &&
362
+ sha1 == o.sha1 &&
363
+ sha224 == o.sha224 &&
364
+ sha256 == o.sha256 &&
365
+ sha384 == o.sha384 &&
366
+ sha512 == o.sha512 &&
367
+ version == o.version &&
368
+ name == o.name &&
369
+ namespace == o.namespace
370
+ end
371
+
372
+ # @see the `==` method
373
+ # @param [Object] Object to be compared
374
+ def eql?(o)
375
+ self == o
376
+ end
377
+
378
+ # Calculates hash code according to all attributes.
379
+ # @return [Integer] Hash code
380
+ def hash
381
+ [_created, _artifact, _href, _type, md5, sha1, sha224, sha256, sha384, sha512, version, name, namespace].hash
382
+ end
383
+
384
+ # Builds the object from hash
385
+ # @param [Hash] attributes Model attributes in the form of hash
386
+ # @return [Object] Returns the model itself
387
+ def self.build_from_hash(attributes)
388
+ new.build_from_hash(attributes)
389
+ end
390
+
391
+ # Builds the object from hash
392
+ # @param [Hash] attributes Model attributes in the form of hash
393
+ # @return [Object] Returns the model itself
394
+ def build_from_hash(attributes)
395
+ return nil unless attributes.is_a?(Hash)
396
+ self.class.openapi_types.each_pair do |key, type|
397
+ if type =~ /\AArray<(.*)>/i
398
+ # check to ensure the input is an array given that the attribute
399
+ # is documented as an array but the input is not
400
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
401
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
402
+ end
403
+ elsif !attributes[self.class.attribute_map[key]].nil?
404
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
405
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
406
+ end
407
+
408
+ self
409
+ end
410
+
411
+ # Deserializes the data based on type
412
+ # @param string type Data type
413
+ # @param string value Value to be deserialized
414
+ # @return [Object] Deserialized data
415
+ def _deserialize(type, value)
416
+ case type.to_sym
417
+ when :DateTime
418
+ DateTime.parse(value)
419
+ when :Date
420
+ Date.parse(value)
421
+ when :String
422
+ value.to_s
423
+ when :Integer
424
+ value.to_i
425
+ when :Float
426
+ value.to_f
427
+ when :Boolean
428
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
429
+ true
430
+ else
431
+ false
432
+ end
433
+ when :Object
434
+ # generic object (usually a Hash), return directly
435
+ value
436
+ when /\AArray<(?<inner_type>.+)>\z/
437
+ inner_type = Regexp.last_match[:inner_type]
438
+ value.map { |v| _deserialize(inner_type, v) }
439
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
440
+ k_type = Regexp.last_match[:k_type]
441
+ v_type = Regexp.last_match[:v_type]
442
+ {}.tap do |hash|
443
+ value.each do |k, v|
444
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
445
+ end
446
+ end
447
+ else # model
448
+ PulpAnsibleClient.const_get(type).build_from_hash(value)
449
+ end
450
+ end
451
+
452
+ # Returns the string representation of the object
453
+ # @return [String] String presentation of the object
454
+ def to_s
455
+ to_hash.to_s
456
+ end
457
+
458
+ # to_body is an alias to to_hash (backward compatibility)
459
+ # @return [Hash] Returns the object in the form of hash
460
+ def to_body
461
+ to_hash
462
+ end
463
+
464
+ # Returns the object in the form of hash
465
+ # @return [Hash] Returns the object in the form of hash
466
+ def to_hash
467
+ hash = {}
468
+ self.class.attribute_map.each_pair do |attr, param|
469
+ value = self.send(attr)
470
+ next if value.nil?
471
+ hash[param] = _to_hash(value)
472
+ end
473
+ hash
474
+ end
475
+
476
+ # Outputs non-array value in the form of hash
477
+ # For object, use to_hash. Otherwise, just return the value
478
+ # @param [Object] value Any valid value
479
+ # @return [Hash] Returns the value in the form of hash
480
+ def _to_hash(value)
481
+ if value.is_a?(Array)
482
+ value.compact.map { |v| _to_hash(v) }
483
+ elsif value.is_a?(Hash)
484
+ {}.tap do |hash|
485
+ value.each { |k, v| hash[k] = _to_hash(v) }
486
+ end
487
+ elsif value.respond_to? :to_hash
488
+ value.to_hash
489
+ else
490
+ value
491
+ end
492
+ end
493
+ end
494
+ end