pulp_ansible_client 0.16.2 → 0.17.0.dev1676171799

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of pulp_ansible_client might be problematic. Click here for more details.

Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -7
  3. data/docs/AnsibleAnsibleRepository.md +1 -1
  4. data/docs/AnsibleAnsibleRepositoryResponse.md +4 -2
  5. data/docs/AnsibleCollectionRemote.md +1 -1
  6. data/docs/AnsibleCollectionRemoteResponse.md +4 -2
  7. data/docs/AnsibleCollectionVersion.md +2 -2
  8. data/docs/AnsibleCollectionVersionResponse.md +2 -2
  9. data/docs/AnsibleCollectionsApi.md +2 -6
  10. data/docs/AnsibleGitRemote.md +29 -29
  11. data/docs/AnsibleGitRemoteResponse.md +29 -29
  12. data/docs/AnsibleRoleRemote.md +1 -1
  13. data/docs/AnsibleRoleRemoteResponse.md +1 -1
  14. data/docs/AnsibleRoleResponse.md +4 -4
  15. data/docs/CollectionRefResponse.md +1 -1
  16. data/docs/CollectionResponse.md +6 -6
  17. data/docs/CollectionVersionListResponse.md +1 -1
  18. data/docs/CollectionVersionResponse.md +4 -4
  19. data/docs/ContentCollectionDeprecationsApi.md +2 -6
  20. data/docs/ContentCollectionSignaturesApi.md +2 -6
  21. data/docs/ContentCollectionVersionsApi.md +4 -8
  22. data/docs/ContentRolesApi.md +2 -6
  23. data/docs/DistributionsAnsibleApi.md +2 -6
  24. data/docs/GalaxyCollectionResponse.md +4 -4
  25. data/docs/GalaxyCollectionVersionResponse.md +4 -4
  26. data/docs/GalaxyRoleResponse.md +1 -1
  27. data/docs/GalaxyRoleVersionResponse.md +1 -1
  28. data/docs/PatchedansibleAnsibleRepository.md +1 -1
  29. data/docs/PatchedansibleCollectionRemote.md +1 -1
  30. data/docs/PatchedansibleGitRemote.md +29 -29
  31. data/docs/PatchedansibleRoleRemote.md +1 -1
  32. data/docs/ProgressReportResponse.md +27 -0
  33. data/docs/PulpAnsibleApiV3CollectionsAllApi.md +2 -6
  34. data/docs/PulpAnsibleApiV3CollectionsApi.md +2 -6
  35. data/docs/PulpAnsibleApiV3CollectionsVersionsApi.md +2 -6
  36. data/docs/PulpAnsibleApiV3PluginAnsibleContentCollectionsAllCollectionsApi.md +2 -6
  37. data/docs/PulpAnsibleApiV3PluginAnsibleContentCollectionsIndexApi.md +2 -6
  38. data/docs/PulpAnsibleApiV3PluginAnsibleContentCollectionsIndexVersionsApi.md +2 -6
  39. data/docs/PulpAnsibleDefaultApiV3CollectionsAllApi.md +2 -6
  40. data/docs/PulpAnsibleDefaultApiV3CollectionsApi.md +2 -6
  41. data/docs/PulpAnsibleDefaultApiV3CollectionsVersionsApi.md +2 -6
  42. data/docs/PulpAnsibleDefaultApiV3PluginAnsibleContentCollectionsAllCollectionsApi.md +2 -6
  43. data/docs/PulpAnsibleDefaultApiV3PluginAnsibleContentCollectionsIndexApi.md +2 -6
  44. data/docs/PulpAnsibleDefaultApiV3PluginAnsibleContentCollectionsIndexVersionsApi.md +2 -6
  45. data/docs/RemotesCollectionApi.md +10 -6
  46. data/docs/RemotesGitApi.md +2 -6
  47. data/docs/RemotesRoleApi.md +2 -6
  48. data/docs/RepositoriesAnsibleApi.md +2 -6
  49. data/docs/RepositoriesAnsibleVersionsApi.md +2 -4
  50. data/docs/RepositoryAddRemoveContent.md +2 -2
  51. data/docs/Task.md +19 -0
  52. data/docs/TaskResponse.md +45 -0
  53. data/docs/UnpaginatedCollectionVersionResponse.md +4 -4
  54. data/lib/pulp_ansible_client/api/ansible_collections_api.rb +2 -8
  55. data/lib/pulp_ansible_client/api/content_collection_deprecations_api.rb +2 -8
  56. data/lib/pulp_ansible_client/api/content_collection_signatures_api.rb +2 -8
  57. data/lib/pulp_ansible_client/api/content_collection_versions_api.rb +5 -11
  58. data/lib/pulp_ansible_client/api/content_roles_api.rb +2 -8
  59. data/lib/pulp_ansible_client/api/distributions_ansible_api.rb +2 -8
  60. data/lib/pulp_ansible_client/api/pulp_ansible_api_v3_collections_all_api.rb +2 -8
  61. data/lib/pulp_ansible_client/api/pulp_ansible_api_v3_collections_api.rb +2 -8
  62. data/lib/pulp_ansible_client/api/pulp_ansible_api_v3_collections_versions_api.rb +2 -8
  63. data/lib/pulp_ansible_client/api/pulp_ansible_api_v3_plugin_ansible_content_collections_all_collections_api.rb +2 -8
  64. data/lib/pulp_ansible_client/api/pulp_ansible_api_v3_plugin_ansible_content_collections_index_api.rb +2 -8
  65. data/lib/pulp_ansible_client/api/pulp_ansible_api_v3_plugin_ansible_content_collections_index_versions_api.rb +2 -8
  66. data/lib/pulp_ansible_client/api/pulp_ansible_default_api_v3_collections_all_api.rb +2 -8
  67. data/lib/pulp_ansible_client/api/pulp_ansible_default_api_v3_collections_api.rb +2 -8
  68. data/lib/pulp_ansible_client/api/pulp_ansible_default_api_v3_collections_versions_api.rb +2 -8
  69. data/lib/pulp_ansible_client/api/pulp_ansible_default_api_v3_plugin_ansible_content_collections_all_collections_api.rb +2 -8
  70. data/lib/pulp_ansible_client/api/pulp_ansible_default_api_v3_plugin_ansible_content_collections_index_api.rb +2 -8
  71. data/lib/pulp_ansible_client/api/pulp_ansible_default_api_v3_plugin_ansible_content_collections_index_versions_api.rb +2 -8
  72. data/lib/pulp_ansible_client/api/remotes_collection_api.rb +15 -9
  73. data/lib/pulp_ansible_client/api/remotes_git_api.rb +2 -8
  74. data/lib/pulp_ansible_client/api/remotes_role_api.rb +2 -8
  75. data/lib/pulp_ansible_client/api/repositories_ansible_api.rb +2 -8
  76. data/lib/pulp_ansible_client/api/repositories_ansible_versions_api.rb +2 -5
  77. data/lib/pulp_ansible_client/models/ansible_ansible_repository.rb +1 -1
  78. data/lib/pulp_ansible_client/models/ansible_ansible_repository_response.rb +15 -6
  79. data/lib/pulp_ansible_client/models/ansible_collection_remote.rb +1 -1
  80. data/lib/pulp_ansible_client/models/ansible_collection_remote_response.rb +14 -5
  81. data/lib/pulp_ansible_client/models/ansible_collection_version.rb +11 -11
  82. data/lib/pulp_ansible_client/models/ansible_collection_version_response.rb +10 -10
  83. data/lib/pulp_ansible_client/models/ansible_git_remote.rb +236 -236
  84. data/lib/pulp_ansible_client/models/ansible_git_remote_response.rb +159 -159
  85. data/lib/pulp_ansible_client/models/ansible_role_remote.rb +1 -1
  86. data/lib/pulp_ansible_client/models/ansible_role_remote_response.rb +1 -1
  87. data/lib/pulp_ansible_client/models/ansible_role_response.rb +15 -15
  88. data/lib/pulp_ansible_client/models/collection_ref_response.rb +0 -1
  89. data/lib/pulp_ansible_client/models/collection_response.rb +0 -6
  90. data/lib/pulp_ansible_client/models/collection_version_list_response.rb +0 -1
  91. data/lib/pulp_ansible_client/models/collection_version_response.rb +0 -4
  92. data/lib/pulp_ansible_client/models/galaxy_collection_response.rb +0 -4
  93. data/lib/pulp_ansible_client/models/galaxy_collection_version_response.rb +0 -4
  94. data/lib/pulp_ansible_client/models/galaxy_role_response.rb +0 -1
  95. data/lib/pulp_ansible_client/models/galaxy_role_version_response.rb +0 -1
  96. data/lib/pulp_ansible_client/models/patchedansible_ansible_repository.rb +1 -1
  97. data/lib/pulp_ansible_client/models/patchedansible_collection_remote.rb +1 -1
  98. data/lib/pulp_ansible_client/models/patchedansible_git_remote.rb +226 -226
  99. data/lib/pulp_ansible_client/models/patchedansible_role_remote.rb +1 -1
  100. data/lib/pulp_ansible_client/models/progress_report_response.rb +259 -0
  101. data/lib/pulp_ansible_client/models/repository_add_remove_content.rb +2 -2
  102. data/lib/pulp_ansible_client/models/task.rb +266 -0
  103. data/lib/pulp_ansible_client/models/task_response.rb +366 -0
  104. data/lib/pulp_ansible_client/models/unpaginated_collection_version_response.rb +0 -4
  105. data/lib/pulp_ansible_client/version.rb +1 -1
  106. data/lib/pulp_ansible_client.rb +3 -0
  107. data/spec/api/ansible_collections_api_spec.rb +1 -3
  108. data/spec/api/content_collection_deprecations_api_spec.rb +1 -3
  109. data/spec/api/content_collection_signatures_api_spec.rb +1 -3
  110. data/spec/api/content_collection_versions_api_spec.rb +2 -4
  111. data/spec/api/content_roles_api_spec.rb +1 -3
  112. data/spec/api/distributions_ansible_api_spec.rb +1 -3
  113. data/spec/api/pulp_ansible_api_v3_collections_all_api_spec.rb +1 -3
  114. data/spec/api/pulp_ansible_api_v3_collections_api_spec.rb +1 -3
  115. data/spec/api/pulp_ansible_api_v3_collections_versions_api_spec.rb +1 -3
  116. data/spec/api/pulp_ansible_api_v3_plugin_ansible_content_collections_all_collections_api_spec.rb +1 -3
  117. data/spec/api/pulp_ansible_api_v3_plugin_ansible_content_collections_index_api_spec.rb +1 -3
  118. data/spec/api/pulp_ansible_api_v3_plugin_ansible_content_collections_index_versions_api_spec.rb +1 -3
  119. data/spec/api/pulp_ansible_default_api_v3_collections_all_api_spec.rb +1 -3
  120. data/spec/api/pulp_ansible_default_api_v3_collections_api_spec.rb +1 -3
  121. data/spec/api/pulp_ansible_default_api_v3_collections_versions_api_spec.rb +1 -3
  122. data/spec/api/pulp_ansible_default_api_v3_plugin_ansible_content_collections_all_collections_api_spec.rb +1 -3
  123. data/spec/api/pulp_ansible_default_api_v3_plugin_ansible_content_collections_index_api_spec.rb +1 -3
  124. data/spec/api/pulp_ansible_default_api_v3_plugin_ansible_content_collections_index_versions_api_spec.rb +1 -3
  125. data/spec/api/remotes_collection_api_spec.rb +5 -3
  126. data/spec/api/remotes_git_api_spec.rb +1 -3
  127. data/spec/api/remotes_role_api_spec.rb +1 -3
  128. data/spec/api/repositories_ansible_api_spec.rb +1 -3
  129. data/spec/api/repositories_ansible_versions_api_spec.rb +1 -2
  130. data/spec/models/ansible_ansible_repository_response_spec.rb +6 -0
  131. data/spec/models/ansible_collection_remote_response_spec.rb +6 -0
  132. data/spec/models/ansible_collection_version_response_spec.rb +2 -2
  133. data/spec/models/ansible_collection_version_spec.rb +3 -3
  134. data/spec/models/ansible_git_remote_response_spec.rb +19 -19
  135. data/spec/models/ansible_git_remote_spec.rb +19 -19
  136. data/spec/models/ansible_role_response_spec.rb +2 -2
  137. data/spec/models/patchedansible_git_remote_spec.rb +19 -19
  138. data/spec/models/progress_report_response_spec.rb +71 -0
  139. data/spec/models/task_response_spec.rb +125 -0
  140. data/spec/models/task_spec.rb +47 -0
  141. metadata +114 -102
@@ -56,7 +56,7 @@ module PulpAnsibleClient
56
56
  # Maximum number of retry attempts after a download failure. If not set then the default value (3) will be used.
57
57
  attr_accessor :max_retries
58
58
 
59
- # The policy to use when downloading content. * `immediate` - immediate * `When syncing, download all metadata and content now.` - When syncing, download all metadata and content now.
59
+ # The policy to use when downloading content.
60
60
  attr_accessor :policy
61
61
 
62
62
  # aiohttp.ClientTimeout.total (q.v.) for download-connections. The default is null, which will cause the default from the aiohttp library to be used.
@@ -0,0 +1,259 @@
1
+ =begin
2
+ #Pulp 3 API
3
+
4
+ #Fetch, Upload, Organize, and Distribute Software Packages
5
+
6
+ The version of the OpenAPI document: v3
7
+ Contact: pulp-list@redhat.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module PulpAnsibleClient
16
+ # Base serializer for use with :class:`pulpcore.app.models.Model` This ensures that all Serializers provide values for the 'pulp_href` field. The class provides a default for the ``ref_name`` attribute in the ModelSerializers's ``Meta`` class. This ensures that the OpenAPI definitions of plugins are namespaced properly.
17
+ class ProgressReportResponse
18
+ # The message shown to the user for the progress report.
19
+ attr_accessor :message
20
+
21
+ # Identifies the type of progress report'.
22
+ attr_accessor :code
23
+
24
+ # The current state of the progress report. The possible values are: 'waiting', 'skipped', 'running', 'completed', 'failed', 'canceled' and 'canceling'. The default is 'waiting'.
25
+ attr_accessor :state
26
+
27
+ # The total count of items.
28
+ attr_accessor :total
29
+
30
+ # The count of items already processed. Defaults to 0.
31
+ attr_accessor :done
32
+
33
+ # The suffix to be shown with the progress report.
34
+ attr_accessor :suffix
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'message' => :'message',
40
+ :'code' => :'code',
41
+ :'state' => :'state',
42
+ :'total' => :'total',
43
+ :'done' => :'done',
44
+ :'suffix' => :'suffix'
45
+ }
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.openapi_types
50
+ {
51
+ :'message' => :'String',
52
+ :'code' => :'String',
53
+ :'state' => :'String',
54
+ :'total' => :'Integer',
55
+ :'done' => :'Integer',
56
+ :'suffix' => :'String'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ :'suffix'
64
+ ])
65
+ end
66
+
67
+ # Initializes the object
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ def initialize(attributes = {})
70
+ if (!attributes.is_a?(Hash))
71
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpAnsibleClient::ProgressReportResponse` initialize method"
72
+ end
73
+
74
+ # check to see if the attribute exists and convert string to symbol for hash key
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!self.class.attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpAnsibleClient::ProgressReportResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'message')
83
+ self.message = attributes[:'message']
84
+ end
85
+
86
+ if attributes.key?(:'code')
87
+ self.code = attributes[:'code']
88
+ end
89
+
90
+ if attributes.key?(:'state')
91
+ self.state = attributes[:'state']
92
+ end
93
+
94
+ if attributes.key?(:'total')
95
+ self.total = attributes[:'total']
96
+ end
97
+
98
+ if attributes.key?(:'done')
99
+ self.done = attributes[:'done']
100
+ end
101
+
102
+ if attributes.key?(:'suffix')
103
+ self.suffix = attributes[:'suffix']
104
+ end
105
+ end
106
+
107
+ # Show invalid properties with the reasons. Usually used together with valid?
108
+ # @return Array for valid properties with the reasons
109
+ def list_invalid_properties
110
+ invalid_properties = Array.new
111
+ invalid_properties
112
+ end
113
+
114
+ # Check to see if the all the properties in the model are valid
115
+ # @return true if the model is valid
116
+ def valid?
117
+ true
118
+ end
119
+
120
+ # Checks equality by comparing each attribute.
121
+ # @param [Object] Object to be compared
122
+ def ==(o)
123
+ return true if self.equal?(o)
124
+ self.class == o.class &&
125
+ message == o.message &&
126
+ code == o.code &&
127
+ state == o.state &&
128
+ total == o.total &&
129
+ done == o.done &&
130
+ suffix == o.suffix
131
+ end
132
+
133
+ # @see the `==` method
134
+ # @param [Object] Object to be compared
135
+ def eql?(o)
136
+ self == o
137
+ end
138
+
139
+ # Calculates hash code according to all attributes.
140
+ # @return [Integer] Hash code
141
+ def hash
142
+ [message, code, state, total, done, suffix].hash
143
+ end
144
+
145
+ # Builds the object from hash
146
+ # @param [Hash] attributes Model attributes in the form of hash
147
+ # @return [Object] Returns the model itself
148
+ def self.build_from_hash(attributes)
149
+ new.build_from_hash(attributes)
150
+ end
151
+
152
+ # Builds the object from hash
153
+ # @param [Hash] attributes Model attributes in the form of hash
154
+ # @return [Object] Returns the model itself
155
+ def build_from_hash(attributes)
156
+ return nil unless attributes.is_a?(Hash)
157
+ self.class.openapi_types.each_pair do |key, type|
158
+ if type =~ /\AArray<(.*)>/i
159
+ # check to ensure the input is an array given that the attribute
160
+ # is documented as an array but the input is not
161
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
162
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
163
+ end
164
+ elsif !attributes[self.class.attribute_map[key]].nil?
165
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
166
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
167
+ end
168
+
169
+ self
170
+ end
171
+
172
+ # Deserializes the data based on type
173
+ # @param string type Data type
174
+ # @param string value Value to be deserialized
175
+ # @return [Object] Deserialized data
176
+ def _deserialize(type, value)
177
+ case type.to_sym
178
+ when :DateTime
179
+ DateTime.parse(value)
180
+ when :Date
181
+ Date.parse(value)
182
+ when :String
183
+ value.to_s
184
+ when :Integer
185
+ value.to_i
186
+ when :Float
187
+ value.to_f
188
+ when :Boolean
189
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
190
+ true
191
+ else
192
+ false
193
+ end
194
+ when :Object
195
+ # generic object (usually a Hash), return directly
196
+ value
197
+ when /\AArray<(?<inner_type>.+)>\z/
198
+ inner_type = Regexp.last_match[:inner_type]
199
+ value.map { |v| _deserialize(inner_type, v) }
200
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
201
+ k_type = Regexp.last_match[:k_type]
202
+ v_type = Regexp.last_match[:v_type]
203
+ {}.tap do |hash|
204
+ value.each do |k, v|
205
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
206
+ end
207
+ end
208
+ else # model
209
+ PulpAnsibleClient.const_get(type).build_from_hash(value)
210
+ end
211
+ end
212
+
213
+ # Returns the string representation of the object
214
+ # @return [String] String presentation of the object
215
+ def to_s
216
+ to_hash.to_s
217
+ end
218
+
219
+ # to_body is an alias to to_hash (backward compatibility)
220
+ # @return [Hash] Returns the object in the form of hash
221
+ def to_body
222
+ to_hash
223
+ end
224
+
225
+ # Returns the object in the form of hash
226
+ # @return [Hash] Returns the object in the form of hash
227
+ def to_hash
228
+ hash = {}
229
+ self.class.attribute_map.each_pair do |attr, param|
230
+ value = self.send(attr)
231
+ if value.nil?
232
+ is_nullable = self.class.openapi_nullable.include?(attr)
233
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
234
+ end
235
+
236
+ hash[param] = _to_hash(value)
237
+ end
238
+ hash
239
+ end
240
+
241
+ # Outputs non-array value in the form of hash
242
+ # For object, use to_hash. Otherwise, just return the value
243
+ # @param [Object] value Any valid value
244
+ # @return [Hash] Returns the value in the form of hash
245
+ def _to_hash(value)
246
+ if value.is_a?(Array)
247
+ value.compact.map { |v| _to_hash(v) }
248
+ elsif value.is_a?(Hash)
249
+ {}.tap do |hash|
250
+ value.each { |k, v| hash[k] = _to_hash(v) }
251
+ end
252
+ elsif value.respond_to? :to_hash
253
+ value.to_hash
254
+ else
255
+ value
256
+ end
257
+ end
258
+ end
259
+ end
@@ -36,8 +36,8 @@ module PulpAnsibleClient
36
36
  # Attribute type mapping.
37
37
  def self.openapi_types
38
38
  {
39
- :'add_content_units' => :'Array<String>',
40
- :'remove_content_units' => :'Array<String>',
39
+ :'add_content_units' => :'Array<AnyType>',
40
+ :'remove_content_units' => :'Array<AnyType>',
41
41
  :'base_version' => :'String'
42
42
  }
43
43
  end
@@ -0,0 +1,266 @@
1
+ =begin
2
+ #Pulp 3 API
3
+
4
+ #Fetch, Upload, Organize, and Distribute Software Packages
5
+
6
+ The version of the OpenAPI document: v3
7
+ Contact: pulp-list@redhat.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module PulpAnsibleClient
16
+ # Base serializer for use with :class:`pulpcore.app.models.Model` This ensures that all Serializers provide values for the 'pulp_href` field. The class provides a default for the ``ref_name`` attribute in the ModelSerializers's ``Meta`` class. This ensures that the OpenAPI definitions of plugins are namespaced properly.
17
+ class Task
18
+ # The name of task.
19
+ attr_accessor :name
20
+
21
+ # The logging correlation id associated with this task
22
+ attr_accessor :logging_cid
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'name' => :'name',
28
+ :'logging_cid' => :'logging_cid'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'name' => :'String',
36
+ :'logging_cid' => :'String'
37
+ }
38
+ end
39
+
40
+ # List of attributes with nullable: true
41
+ def self.openapi_nullable
42
+ Set.new([
43
+ ])
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpAnsibleClient::Task` initialize method"
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpAnsibleClient::Task`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:'name')
62
+ self.name = attributes[:'name']
63
+ end
64
+
65
+ if attributes.key?(:'logging_cid')
66
+ self.logging_cid = attributes[:'logging_cid']
67
+ end
68
+ end
69
+
70
+ # Show invalid properties with the reasons. Usually used together with valid?
71
+ # @return Array for valid properties with the reasons
72
+ def list_invalid_properties
73
+ invalid_properties = Array.new
74
+ if @name.nil?
75
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
76
+ end
77
+
78
+ if @name.to_s.length < 1
79
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
80
+ end
81
+
82
+ if @logging_cid.nil?
83
+ invalid_properties.push('invalid value for "logging_cid", logging_cid cannot be nil.')
84
+ end
85
+
86
+ if @logging_cid.to_s.length < 1
87
+ invalid_properties.push('invalid value for "logging_cid", the character length must be great than or equal to 1.')
88
+ end
89
+
90
+ invalid_properties
91
+ end
92
+
93
+ # Check to see if the all the properties in the model are valid
94
+ # @return true if the model is valid
95
+ def valid?
96
+ return false if @name.nil?
97
+ return false if @name.to_s.length < 1
98
+ return false if @logging_cid.nil?
99
+ return false if @logging_cid.to_s.length < 1
100
+ true
101
+ end
102
+
103
+ # Custom attribute writer method with validation
104
+ # @param [Object] name Value to be assigned
105
+ def name=(name)
106
+ if name.nil?
107
+ fail ArgumentError, 'name cannot be nil'
108
+ end
109
+
110
+ if name.to_s.length < 1
111
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
112
+ end
113
+
114
+ @name = name
115
+ end
116
+
117
+ # Custom attribute writer method with validation
118
+ # @param [Object] logging_cid Value to be assigned
119
+ def logging_cid=(logging_cid)
120
+ if logging_cid.nil?
121
+ fail ArgumentError, 'logging_cid cannot be nil'
122
+ end
123
+
124
+ if logging_cid.to_s.length < 1
125
+ fail ArgumentError, 'invalid value for "logging_cid", the character length must be great than or equal to 1.'
126
+ end
127
+
128
+ @logging_cid = logging_cid
129
+ end
130
+
131
+ # Checks equality by comparing each attribute.
132
+ # @param [Object] Object to be compared
133
+ def ==(o)
134
+ return true if self.equal?(o)
135
+ self.class == o.class &&
136
+ name == o.name &&
137
+ logging_cid == o.logging_cid
138
+ end
139
+
140
+ # @see the `==` method
141
+ # @param [Object] Object to be compared
142
+ def eql?(o)
143
+ self == o
144
+ end
145
+
146
+ # Calculates hash code according to all attributes.
147
+ # @return [Integer] Hash code
148
+ def hash
149
+ [name, logging_cid].hash
150
+ end
151
+
152
+ # Builds the object from hash
153
+ # @param [Hash] attributes Model attributes in the form of hash
154
+ # @return [Object] Returns the model itself
155
+ def self.build_from_hash(attributes)
156
+ new.build_from_hash(attributes)
157
+ end
158
+
159
+ # Builds the object from hash
160
+ # @param [Hash] attributes Model attributes in the form of hash
161
+ # @return [Object] Returns the model itself
162
+ def build_from_hash(attributes)
163
+ return nil unless attributes.is_a?(Hash)
164
+ self.class.openapi_types.each_pair do |key, type|
165
+ if type =~ /\AArray<(.*)>/i
166
+ # check to ensure the input is an array given that the attribute
167
+ # is documented as an array but the input is not
168
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
169
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
170
+ end
171
+ elsif !attributes[self.class.attribute_map[key]].nil?
172
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
173
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
174
+ end
175
+
176
+ self
177
+ end
178
+
179
+ # Deserializes the data based on type
180
+ # @param string type Data type
181
+ # @param string value Value to be deserialized
182
+ # @return [Object] Deserialized data
183
+ def _deserialize(type, value)
184
+ case type.to_sym
185
+ when :DateTime
186
+ DateTime.parse(value)
187
+ when :Date
188
+ Date.parse(value)
189
+ when :String
190
+ value.to_s
191
+ when :Integer
192
+ value.to_i
193
+ when :Float
194
+ value.to_f
195
+ when :Boolean
196
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
197
+ true
198
+ else
199
+ false
200
+ end
201
+ when :Object
202
+ # generic object (usually a Hash), return directly
203
+ value
204
+ when /\AArray<(?<inner_type>.+)>\z/
205
+ inner_type = Regexp.last_match[:inner_type]
206
+ value.map { |v| _deserialize(inner_type, v) }
207
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
208
+ k_type = Regexp.last_match[:k_type]
209
+ v_type = Regexp.last_match[:v_type]
210
+ {}.tap do |hash|
211
+ value.each do |k, v|
212
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
213
+ end
214
+ end
215
+ else # model
216
+ PulpAnsibleClient.const_get(type).build_from_hash(value)
217
+ end
218
+ end
219
+
220
+ # Returns the string representation of the object
221
+ # @return [String] String presentation of the object
222
+ def to_s
223
+ to_hash.to_s
224
+ end
225
+
226
+ # to_body is an alias to to_hash (backward compatibility)
227
+ # @return [Hash] Returns the object in the form of hash
228
+ def to_body
229
+ to_hash
230
+ end
231
+
232
+ # Returns the object in the form of hash
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_hash
235
+ hash = {}
236
+ self.class.attribute_map.each_pair do |attr, param|
237
+ value = self.send(attr)
238
+ if value.nil?
239
+ is_nullable = self.class.openapi_nullable.include?(attr)
240
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
241
+ end
242
+
243
+ hash[param] = _to_hash(value)
244
+ end
245
+ hash
246
+ end
247
+
248
+ # Outputs non-array value in the form of hash
249
+ # For object, use to_hash. Otherwise, just return the value
250
+ # @param [Object] value Any valid value
251
+ # @return [Hash] Returns the value in the form of hash
252
+ def _to_hash(value)
253
+ if value.is_a?(Array)
254
+ value.compact.map { |v| _to_hash(v) }
255
+ elsif value.is_a?(Hash)
256
+ {}.tap do |hash|
257
+ value.each { |k, v| hash[k] = _to_hash(v) }
258
+ end
259
+ elsif value.respond_to? :to_hash
260
+ value.to_hash
261
+ else
262
+ value
263
+ end
264
+ end
265
+ end
266
+ end