pulpcore_client 3.16.24 → 3.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +70 -22
  3. data/docs/AccessPoliciesApi.md +53 -0
  4. data/docs/AccessPolicy.md +3 -1
  5. data/docs/AccessPolicyResponse.md +3 -1
  6. data/docs/ContentguardsRbacApi.md +138 -22
  7. data/docs/GroupRole.md +19 -0
  8. data/docs/GroupRoleResponse.md +23 -0
  9. data/docs/GroupsApi.md +248 -20
  10. data/docs/GroupsModelPermissionsApi.md +20 -20
  11. data/docs/GroupsObjectPermissionsApi.md +20 -20
  12. data/docs/GroupsRolesApi.md +255 -0
  13. data/docs/GroupsUsersApi.md +15 -15
  14. data/docs/MyPermissionsResponse.md +17 -0
  15. data/docs/NestedRole.md +21 -0
  16. data/docs/NestedRoleResponse.md +21 -0
  17. data/docs/ObjectRolesResponse.md +17 -0
  18. data/docs/PaginatedGroupRoleResponseList.md +23 -0
  19. data/docs/PaginatedRoleResponseList.md +23 -0
  20. data/docs/PaginatedUserRoleResponseList.md +23 -0
  21. data/docs/PatchedAccessPolicy.md +3 -1
  22. data/docs/PatchedRole.md +21 -0
  23. data/docs/PatchedUser.md +29 -0
  24. data/docs/PermissionResponse.md +1 -1
  25. data/docs/Purge.md +19 -0
  26. data/docs/Role.md +21 -0
  27. data/docs/RoleResponse.md +27 -0
  28. data/docs/RolesApi.md +363 -0
  29. data/docs/StatesEnum.md +16 -0
  30. data/docs/TasksApi.md +282 -0
  31. data/docs/User.md +29 -0
  32. data/docs/UserGroup.md +17 -0
  33. data/docs/UserResponse.md +3 -3
  34. data/docs/UserRole.md +19 -0
  35. data/docs/UserRoleResponse.md +23 -0
  36. data/docs/UsersApi.md +219 -0
  37. data/docs/UsersRolesApi.md +255 -0
  38. data/docs/WorkerResponse.md +3 -3
  39. data/git_push.sh +58 -0
  40. data/lib/pulpcore_client/api/access_policies_api.rb +60 -0
  41. data/lib/pulpcore_client/api/artifacts_api.rb +24 -0
  42. data/lib/pulpcore_client/api/contentguards_rbac_api.rb +168 -40
  43. data/lib/pulpcore_client/api/groups_api.rb +304 -36
  44. data/lib/pulpcore_client/api/groups_model_permissions_api.rb +36 -36
  45. data/lib/pulpcore_client/api/groups_object_permissions_api.rb +36 -36
  46. data/lib/pulpcore_client/api/groups_roles_api.rb +315 -0
  47. data/lib/pulpcore_client/api/groups_users_api.rb +27 -27
  48. data/lib/pulpcore_client/api/roles_api.rb +443 -0
  49. data/lib/pulpcore_client/api/tasks_api.rb +332 -0
  50. data/lib/pulpcore_client/api/uploads_api.rb +4 -0
  51. data/lib/pulpcore_client/api/users_api.rb +264 -0
  52. data/lib/pulpcore_client/api/users_roles_api.rb +315 -0
  53. data/lib/pulpcore_client/api_client.rb +5 -2
  54. data/lib/pulpcore_client/configuration.rb +0 -1
  55. data/lib/pulpcore_client/models/access_policy.rb +19 -2
  56. data/lib/pulpcore_client/models/access_policy_response.rb +19 -2
  57. data/lib/pulpcore_client/models/artifact.rb +90 -0
  58. data/lib/pulpcore_client/models/filesystem_exporter.rb +38 -0
  59. data/lib/pulpcore_client/models/group.rb +9 -0
  60. data/lib/pulpcore_client/models/group_role.rb +238 -0
  61. data/lib/pulpcore_client/models/group_role_response.rb +242 -0
  62. data/lib/pulpcore_client/models/group_user.rb +9 -0
  63. data/lib/pulpcore_client/models/{rbac_content_guard_permission.rb → my_permissions_response.rb} +16 -22
  64. data/lib/pulpcore_client/models/nested_role.rb +234 -0
  65. data/lib/pulpcore_client/models/nested_role_response.rb +234 -0
  66. data/lib/pulpcore_client/models/object_roles_response.rb +213 -0
  67. data/lib/pulpcore_client/models/paginated_group_role_response_list.rb +237 -0
  68. data/lib/pulpcore_client/models/paginated_role_response_list.rb +237 -0
  69. data/lib/pulpcore_client/models/paginated_user_role_response_list.rb +237 -0
  70. data/lib/pulpcore_client/models/patched_access_policy.rb +14 -2
  71. data/lib/pulpcore_client/models/patched_filesystem_exporter.rb +30 -0
  72. data/lib/pulpcore_client/models/patched_group.rb +9 -0
  73. data/lib/pulpcore_client/models/patched_pulp_exporter.rb +30 -0
  74. data/lib/pulpcore_client/models/patched_pulp_importer.rb +15 -0
  75. data/lib/pulpcore_client/models/patched_rbac_content_guard.rb +30 -0
  76. data/lib/pulpcore_client/models/patched_role.rb +261 -0
  77. data/lib/pulpcore_client/models/patched_task_cancel.rb +15 -0
  78. data/lib/pulpcore_client/models/patched_user.rb +342 -0
  79. data/lib/pulpcore_client/models/permission_response.rb +1 -1
  80. data/lib/pulpcore_client/models/pulp_export.rb +15 -0
  81. data/lib/pulpcore_client/models/pulp_exporter.rb +38 -0
  82. data/lib/pulpcore_client/models/pulp_import.rb +30 -0
  83. data/lib/pulpcore_client/models/pulp_import_check.rb +45 -0
  84. data/lib/pulpcore_client/models/pulp_importer.rb +19 -0
  85. data/lib/pulpcore_client/models/purge.rb +219 -0
  86. data/lib/pulpcore_client/models/rbac_content_guard.rb +34 -0
  87. data/lib/pulpcore_client/models/role.rb +275 -0
  88. data/lib/pulpcore_client/models/role_response.rb +270 -0
  89. data/lib/pulpcore_client/models/states_enum.rb +38 -0
  90. data/lib/pulpcore_client/models/upload_chunk.rb +15 -0
  91. data/lib/pulpcore_client/models/upload_commit.rb +19 -0
  92. data/lib/pulpcore_client/models/user.rb +351 -0
  93. data/lib/pulpcore_client/models/user_group.rb +241 -0
  94. data/lib/pulpcore_client/models/user_response.rb +6 -29
  95. data/lib/pulpcore_client/models/user_role.rb +238 -0
  96. data/lib/pulpcore_client/models/user_role_response.rb +242 -0
  97. data/lib/pulpcore_client/models/worker_response.rb +10 -10
  98. data/lib/pulpcore_client/version.rb +1 -1
  99. data/lib/pulpcore_client.rb +22 -1
  100. data/pulpcore_client.gemspec +3 -3
  101. data/spec/api/access_policies_api_spec.rb +11 -0
  102. data/spec/api/contentguards_rbac_api_spec.rb +36 -12
  103. data/spec/api/groups_api_spec.rb +54 -4
  104. data/spec/api/groups_model_permissions_api_spec.rb +4 -4
  105. data/spec/api/groups_object_permissions_api_spec.rb +4 -4
  106. data/spec/api/groups_roles_api_spec.rb +97 -0
  107. data/spec/api/groups_users_api_spec.rb +3 -3
  108. data/spec/api/roles_api_spec.rb +121 -0
  109. data/spec/api/tasks_api_spec.rb +62 -0
  110. data/spec/api/users_api_spec.rb +50 -0
  111. data/spec/api/users_roles_api_spec.rb +97 -0
  112. data/spec/models/access_policy_response_spec.rb +6 -0
  113. data/spec/models/access_policy_spec.rb +6 -0
  114. data/spec/models/group_role_response_spec.rb +59 -0
  115. data/spec/models/{rbac_content_guard_permission_spec.rb → group_role_spec.rb} +8 -8
  116. data/spec/models/my_permissions_response_spec.rb +41 -0
  117. data/spec/models/nested_role_response_spec.rb +53 -0
  118. data/spec/models/nested_role_spec.rb +53 -0
  119. data/spec/models/object_roles_response_spec.rb +41 -0
  120. data/spec/models/paginated_group_role_response_list_spec.rb +59 -0
  121. data/spec/models/paginated_role_response_list_spec.rb +59 -0
  122. data/spec/models/paginated_user_role_response_list_spec.rb +59 -0
  123. data/spec/models/patched_access_policy_spec.rb +6 -0
  124. data/spec/models/patched_role_spec.rb +53 -0
  125. data/spec/models/patched_user_spec.rb +77 -0
  126. data/spec/models/purge_spec.rb +47 -0
  127. data/spec/models/role_response_spec.rb +71 -0
  128. data/spec/models/role_spec.rb +53 -0
  129. data/spec/models/states_enum_spec.rb +35 -0
  130. data/spec/models/user_group_spec.rb +41 -0
  131. data/spec/models/user_role_response_spec.rb +59 -0
  132. data/spec/models/user_role_spec.rb +47 -0
  133. data/spec/models/user_spec.rb +77 -0
  134. data/spec/models/worker_response_spec.rb +2 -2
  135. metadata +190 -111
  136. data/docs/RBACContentGuardPermission.md +0 -19
@@ -0,0 +1,351 @@
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 PulpcoreClient
16
+ # Serializer for User.
17
+ class User
18
+ # Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.
19
+ attr_accessor :username
20
+
21
+ # Users password. Set to ``null`` to disable password authentication.
22
+ attr_accessor :password
23
+
24
+ # First name
25
+ attr_accessor :first_name
26
+
27
+ # Last name
28
+ attr_accessor :last_name
29
+
30
+ # Email address
31
+ attr_accessor :email
32
+
33
+ # Designates whether the user can log into this admin site.
34
+ attr_accessor :is_staff
35
+
36
+ # Designates whether this user should be treated as active.
37
+ attr_accessor :is_active
38
+
39
+ # Attribute mapping from ruby-style variable name to JSON key.
40
+ def self.attribute_map
41
+ {
42
+ :'username' => :'username',
43
+ :'password' => :'password',
44
+ :'first_name' => :'first_name',
45
+ :'last_name' => :'last_name',
46
+ :'email' => :'email',
47
+ :'is_staff' => :'is_staff',
48
+ :'is_active' => :'is_active'
49
+ }
50
+ end
51
+
52
+ # Attribute type mapping.
53
+ def self.openapi_types
54
+ {
55
+ :'username' => :'String',
56
+ :'password' => :'String',
57
+ :'first_name' => :'String',
58
+ :'last_name' => :'String',
59
+ :'email' => :'String',
60
+ :'is_staff' => :'Boolean',
61
+ :'is_active' => :'Boolean'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ :'password',
69
+ ])
70
+ end
71
+
72
+ # Initializes the object
73
+ # @param [Hash] attributes Model attributes in the form of hash
74
+ def initialize(attributes = {})
75
+ if (!attributes.is_a?(Hash))
76
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpcoreClient::User` initialize method"
77
+ end
78
+
79
+ # check to see if the attribute exists and convert string to symbol for hash key
80
+ attributes = attributes.each_with_object({}) { |(k, v), h|
81
+ if (!self.class.attribute_map.key?(k.to_sym))
82
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpcoreClient::User`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
83
+ end
84
+ h[k.to_sym] = v
85
+ }
86
+
87
+ if attributes.key?(:'username')
88
+ self.username = attributes[:'username']
89
+ end
90
+
91
+ if attributes.key?(:'password')
92
+ self.password = attributes[:'password']
93
+ end
94
+
95
+ if attributes.key?(:'first_name')
96
+ self.first_name = attributes[:'first_name']
97
+ end
98
+
99
+ if attributes.key?(:'last_name')
100
+ self.last_name = attributes[:'last_name']
101
+ end
102
+
103
+ if attributes.key?(:'email')
104
+ self.email = attributes[:'email']
105
+ end
106
+
107
+ if attributes.key?(:'is_staff')
108
+ self.is_staff = attributes[:'is_staff']
109
+ else
110
+ self.is_staff = false
111
+ end
112
+
113
+ if attributes.key?(:'is_active')
114
+ self.is_active = attributes[:'is_active']
115
+ else
116
+ self.is_active = true
117
+ end
118
+ end
119
+
120
+ # Show invalid properties with the reasons. Usually used together with valid?
121
+ # @return Array for valid properties with the reasons
122
+ def list_invalid_properties
123
+ invalid_properties = Array.new
124
+ if @username.nil?
125
+ invalid_properties.push('invalid value for "username", username cannot be nil.')
126
+ end
127
+
128
+ if @username.to_s.length > 150
129
+ invalid_properties.push('invalid value for "username", the character length must be smaller than or equal to 150.')
130
+ end
131
+
132
+ if @username.to_s.length < 1
133
+ invalid_properties.push('invalid value for "username", the character length must be great than or equal to 1.')
134
+ end
135
+
136
+ if !@password.nil? && @password.to_s.length < 1
137
+ invalid_properties.push('invalid value for "password", the character length must be great than or equal to 1.')
138
+ end
139
+
140
+ if !@first_name.nil? && @first_name.to_s.length > 150
141
+ invalid_properties.push('invalid value for "first_name", the character length must be smaller than or equal to 150.')
142
+ end
143
+
144
+ if !@last_name.nil? && @last_name.to_s.length > 150
145
+ invalid_properties.push('invalid value for "last_name", the character length must be smaller than or equal to 150.')
146
+ end
147
+
148
+ invalid_properties
149
+ end
150
+
151
+ # Check to see if the all the properties in the model are valid
152
+ # @return true if the model is valid
153
+ def valid?
154
+ return false if @username.nil?
155
+ return false if @username.to_s.length > 150
156
+ return false if @username.to_s.length < 1
157
+ return false if !@password.nil? && @password.to_s.length < 1
158
+ return false if !@first_name.nil? && @first_name.to_s.length > 150
159
+ return false if !@last_name.nil? && @last_name.to_s.length > 150
160
+ true
161
+ end
162
+
163
+ # Custom attribute writer method with validation
164
+ # @param [Object] username Value to be assigned
165
+ def username=(username)
166
+ if username.nil?
167
+ fail ArgumentError, 'username cannot be nil'
168
+ end
169
+
170
+ if username.to_s.length > 150
171
+ fail ArgumentError, 'invalid value for "username", the character length must be smaller than or equal to 150.'
172
+ end
173
+
174
+ if username.to_s.length < 1
175
+ fail ArgumentError, 'invalid value for "username", the character length must be great than or equal to 1.'
176
+ end
177
+
178
+ @username = username
179
+ end
180
+
181
+ # Custom attribute writer method with validation
182
+ # @param [Object] password Value to be assigned
183
+ def password=(password)
184
+ if !password.nil? && password.to_s.length < 1
185
+ fail ArgumentError, 'invalid value for "password", the character length must be great than or equal to 1.'
186
+ end
187
+
188
+ @password = password
189
+ end
190
+
191
+ # Custom attribute writer method with validation
192
+ # @param [Object] first_name Value to be assigned
193
+ def first_name=(first_name)
194
+ if !first_name.nil? && first_name.to_s.length > 150
195
+ fail ArgumentError, 'invalid value for "first_name", the character length must be smaller than or equal to 150.'
196
+ end
197
+
198
+ @first_name = first_name
199
+ end
200
+
201
+ # Custom attribute writer method with validation
202
+ # @param [Object] last_name Value to be assigned
203
+ def last_name=(last_name)
204
+ if !last_name.nil? && last_name.to_s.length > 150
205
+ fail ArgumentError, 'invalid value for "last_name", the character length must be smaller than or equal to 150.'
206
+ end
207
+
208
+ @last_name = last_name
209
+ end
210
+
211
+ # Checks equality by comparing each attribute.
212
+ # @param [Object] Object to be compared
213
+ def ==(o)
214
+ return true if self.equal?(o)
215
+ self.class == o.class &&
216
+ username == o.username &&
217
+ password == o.password &&
218
+ first_name == o.first_name &&
219
+ last_name == o.last_name &&
220
+ email == o.email &&
221
+ is_staff == o.is_staff &&
222
+ is_active == o.is_active
223
+ end
224
+
225
+ # @see the `==` method
226
+ # @param [Object] Object to be compared
227
+ def eql?(o)
228
+ self == o
229
+ end
230
+
231
+ # Calculates hash code according to all attributes.
232
+ # @return [Integer] Hash code
233
+ def hash
234
+ [username, password, first_name, last_name, email, is_staff, is_active].hash
235
+ end
236
+
237
+ # Builds the object from hash
238
+ # @param [Hash] attributes Model attributes in the form of hash
239
+ # @return [Object] Returns the model itself
240
+ def self.build_from_hash(attributes)
241
+ new.build_from_hash(attributes)
242
+ end
243
+
244
+ # Builds the object from hash
245
+ # @param [Hash] attributes Model attributes in the form of hash
246
+ # @return [Object] Returns the model itself
247
+ def build_from_hash(attributes)
248
+ return nil unless attributes.is_a?(Hash)
249
+ self.class.openapi_types.each_pair do |key, type|
250
+ if type =~ /\AArray<(.*)>/i
251
+ # check to ensure the input is an array given that the attribute
252
+ # is documented as an array but the input is not
253
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
254
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
255
+ end
256
+ elsif !attributes[self.class.attribute_map[key]].nil?
257
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
258
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
259
+ end
260
+
261
+ self
262
+ end
263
+
264
+ # Deserializes the data based on type
265
+ # @param string type Data type
266
+ # @param string value Value to be deserialized
267
+ # @return [Object] Deserialized data
268
+ def _deserialize(type, value)
269
+ case type.to_sym
270
+ when :DateTime
271
+ DateTime.parse(value)
272
+ when :Date
273
+ Date.parse(value)
274
+ when :String
275
+ value.to_s
276
+ when :Integer
277
+ value.to_i
278
+ when :Float
279
+ value.to_f
280
+ when :Boolean
281
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
282
+ true
283
+ else
284
+ false
285
+ end
286
+ when :Object
287
+ # generic object (usually a Hash), return directly
288
+ value
289
+ when /\AArray<(?<inner_type>.+)>\z/
290
+ inner_type = Regexp.last_match[:inner_type]
291
+ value.map { |v| _deserialize(inner_type, v) }
292
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
293
+ k_type = Regexp.last_match[:k_type]
294
+ v_type = Regexp.last_match[:v_type]
295
+ {}.tap do |hash|
296
+ value.each do |k, v|
297
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
298
+ end
299
+ end
300
+ else # model
301
+ PulpcoreClient.const_get(type).build_from_hash(value)
302
+ end
303
+ end
304
+
305
+ # Returns the string representation of the object
306
+ # @return [String] String presentation of the object
307
+ def to_s
308
+ to_hash.to_s
309
+ end
310
+
311
+ # to_body is an alias to to_hash (backward compatibility)
312
+ # @return [Hash] Returns the object in the form of hash
313
+ def to_body
314
+ to_hash
315
+ end
316
+
317
+ # Returns the object in the form of hash
318
+ # @return [Hash] Returns the object in the form of hash
319
+ def to_hash
320
+ hash = {}
321
+ self.class.attribute_map.each_pair do |attr, param|
322
+ value = self.send(attr)
323
+ if value.nil?
324
+ is_nullable = self.class.openapi_nullable.include?(attr)
325
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
326
+ end
327
+
328
+ hash[param] = _to_hash(value)
329
+ end
330
+ hash
331
+ end
332
+
333
+ # Outputs non-array value in the form of hash
334
+ # For object, use to_hash. Otherwise, just return the value
335
+ # @param [Object] value Any valid value
336
+ # @return [Hash] Returns the value in the form of hash
337
+ def _to_hash(value)
338
+ if value.is_a?(Array)
339
+ value.compact.map { |v| _to_hash(v) }
340
+ elsif value.is_a?(Hash)
341
+ {}.tap do |hash|
342
+ value.each { |k, v| hash[k] = _to_hash(v) }
343
+ end
344
+ elsif value.respond_to? :to_hash
345
+ value.to_hash
346
+ else
347
+ value
348
+ end
349
+ end
350
+ end
351
+ end
@@ -0,0 +1,241 @@
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 PulpcoreClient
16
+ # Serializer for Groups that belong to an User.
17
+ class UserGroup
18
+ # Name.
19
+ attr_accessor :name
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'name' => :'name'
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.openapi_types
30
+ {
31
+ :'name' => :'String'
32
+ }
33
+ end
34
+
35
+ # List of attributes with nullable: true
36
+ def self.openapi_nullable
37
+ Set.new([
38
+ ])
39
+ end
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ def initialize(attributes = {})
44
+ if (!attributes.is_a?(Hash))
45
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpcoreClient::UserGroup` initialize method"
46
+ end
47
+
48
+ # check to see if the attribute exists and convert string to symbol for hash key
49
+ attributes = attributes.each_with_object({}) { |(k, v), h|
50
+ if (!self.class.attribute_map.key?(k.to_sym))
51
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpcoreClient::UserGroup`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
52
+ end
53
+ h[k.to_sym] = v
54
+ }
55
+
56
+ if attributes.key?(:'name')
57
+ self.name = attributes[:'name']
58
+ end
59
+ end
60
+
61
+ # Show invalid properties with the reasons. Usually used together with valid?
62
+ # @return Array for valid properties with the reasons
63
+ def list_invalid_properties
64
+ invalid_properties = Array.new
65
+ if @name.nil?
66
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
67
+ end
68
+
69
+ if @name.to_s.length > 150
70
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 150.')
71
+ end
72
+
73
+ if @name.to_s.length < 1
74
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
75
+ end
76
+
77
+ invalid_properties
78
+ end
79
+
80
+ # Check to see if the all the properties in the model are valid
81
+ # @return true if the model is valid
82
+ def valid?
83
+ return false if @name.nil?
84
+ return false if @name.to_s.length > 150
85
+ return false if @name.to_s.length < 1
86
+ true
87
+ end
88
+
89
+ # Custom attribute writer method with validation
90
+ # @param [Object] name Value to be assigned
91
+ def name=(name)
92
+ if name.nil?
93
+ fail ArgumentError, 'name cannot be nil'
94
+ end
95
+
96
+ if name.to_s.length > 150
97
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 150.'
98
+ end
99
+
100
+ if name.to_s.length < 1
101
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
102
+ end
103
+
104
+ @name = name
105
+ end
106
+
107
+ # Checks equality by comparing each attribute.
108
+ # @param [Object] Object to be compared
109
+ def ==(o)
110
+ return true if self.equal?(o)
111
+ self.class == o.class &&
112
+ name == o.name
113
+ end
114
+
115
+ # @see the `==` method
116
+ # @param [Object] Object to be compared
117
+ def eql?(o)
118
+ self == o
119
+ end
120
+
121
+ # Calculates hash code according to all attributes.
122
+ # @return [Integer] Hash code
123
+ def hash
124
+ [name].hash
125
+ end
126
+
127
+ # Builds the object from hash
128
+ # @param [Hash] attributes Model attributes in the form of hash
129
+ # @return [Object] Returns the model itself
130
+ def self.build_from_hash(attributes)
131
+ new.build_from_hash(attributes)
132
+ end
133
+
134
+ # Builds the object from hash
135
+ # @param [Hash] attributes Model attributes in the form of hash
136
+ # @return [Object] Returns the model itself
137
+ def build_from_hash(attributes)
138
+ return nil unless attributes.is_a?(Hash)
139
+ self.class.openapi_types.each_pair do |key, type|
140
+ if type =~ /\AArray<(.*)>/i
141
+ # check to ensure the input is an array given that the attribute
142
+ # is documented as an array but the input is not
143
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
144
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
145
+ end
146
+ elsif !attributes[self.class.attribute_map[key]].nil?
147
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
148
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
149
+ end
150
+
151
+ self
152
+ end
153
+
154
+ # Deserializes the data based on type
155
+ # @param string type Data type
156
+ # @param string value Value to be deserialized
157
+ # @return [Object] Deserialized data
158
+ def _deserialize(type, value)
159
+ case type.to_sym
160
+ when :DateTime
161
+ DateTime.parse(value)
162
+ when :Date
163
+ Date.parse(value)
164
+ when :String
165
+ value.to_s
166
+ when :Integer
167
+ value.to_i
168
+ when :Float
169
+ value.to_f
170
+ when :Boolean
171
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
172
+ true
173
+ else
174
+ false
175
+ end
176
+ when :Object
177
+ # generic object (usually a Hash), return directly
178
+ value
179
+ when /\AArray<(?<inner_type>.+)>\z/
180
+ inner_type = Regexp.last_match[:inner_type]
181
+ value.map { |v| _deserialize(inner_type, v) }
182
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
183
+ k_type = Regexp.last_match[:k_type]
184
+ v_type = Regexp.last_match[:v_type]
185
+ {}.tap do |hash|
186
+ value.each do |k, v|
187
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
188
+ end
189
+ end
190
+ else # model
191
+ PulpcoreClient.const_get(type).build_from_hash(value)
192
+ end
193
+ end
194
+
195
+ # Returns the string representation of the object
196
+ # @return [String] String presentation of the object
197
+ def to_s
198
+ to_hash.to_s
199
+ end
200
+
201
+ # to_body is an alias to to_hash (backward compatibility)
202
+ # @return [Hash] Returns the object in the form of hash
203
+ def to_body
204
+ to_hash
205
+ end
206
+
207
+ # Returns the object in the form of hash
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_hash
210
+ hash = {}
211
+ self.class.attribute_map.each_pair do |attr, param|
212
+ value = self.send(attr)
213
+ if value.nil?
214
+ is_nullable = self.class.openapi_nullable.include?(attr)
215
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
216
+ end
217
+
218
+ hash[param] = _to_hash(value)
219
+ end
220
+ hash
221
+ end
222
+
223
+ # Outputs non-array value in the form of hash
224
+ # For object, use to_hash. Otherwise, just return the value
225
+ # @param [Object] value Any valid value
226
+ # @return [Hash] Returns the value in the form of hash
227
+ def _to_hash(value)
228
+ if value.is_a?(Array)
229
+ value.compact.map { |v| _to_hash(v) }
230
+ elsif value.is_a?(Hash)
231
+ {}.tap do |hash|
232
+ value.each { |k, v| hash[k] = _to_hash(v) }
233
+ end
234
+ elsif value.respond_to? :to_hash
235
+ value.to_hash
236
+ else
237
+ value
238
+ end
239
+ end
240
+ end
241
+ end
@@ -154,26 +154,14 @@ module PulpcoreClient
154
154
  invalid_properties.push('invalid value for "username", the character length must be smaller than or equal to 150.')
155
155
  end
156
156
 
157
- if @first_name.nil?
158
- invalid_properties.push('invalid value for "first_name", first_name cannot be nil.')
159
- end
160
-
161
- if @first_name.to_s.length > 150
157
+ if !@first_name.nil? && @first_name.to_s.length > 150
162
158
  invalid_properties.push('invalid value for "first_name", the character length must be smaller than or equal to 150.')
163
159
  end
164
160
 
165
- if @last_name.nil?
166
- invalid_properties.push('invalid value for "last_name", last_name cannot be nil.')
167
- end
168
-
169
- if @last_name.to_s.length > 150
161
+ if !@last_name.nil? && @last_name.to_s.length > 150
170
162
  invalid_properties.push('invalid value for "last_name", the character length must be smaller than or equal to 150.')
171
163
  end
172
164
 
173
- if @email.nil?
174
- invalid_properties.push('invalid value for "email", email cannot be nil.')
175
- end
176
-
177
165
  invalid_properties
178
166
  end
179
167
 
@@ -182,11 +170,8 @@ module PulpcoreClient
182
170
  def valid?
183
171
  return false if @username.nil?
184
172
  return false if @username.to_s.length > 150
185
- return false if @first_name.nil?
186
- return false if @first_name.to_s.length > 150
187
- return false if @last_name.nil?
188
- return false if @last_name.to_s.length > 150
189
- return false if @email.nil?
173
+ return false if !@first_name.nil? && @first_name.to_s.length > 150
174
+ return false if !@last_name.nil? && @last_name.to_s.length > 150
190
175
  true
191
176
  end
192
177
 
@@ -207,11 +192,7 @@ module PulpcoreClient
207
192
  # Custom attribute writer method with validation
208
193
  # @param [Object] first_name Value to be assigned
209
194
  def first_name=(first_name)
210
- if first_name.nil?
211
- fail ArgumentError, 'first_name cannot be nil'
212
- end
213
-
214
- if first_name.to_s.length > 150
195
+ if !first_name.nil? && first_name.to_s.length > 150
215
196
  fail ArgumentError, 'invalid value for "first_name", the character length must be smaller than or equal to 150.'
216
197
  end
217
198
 
@@ -221,11 +202,7 @@ module PulpcoreClient
221
202
  # Custom attribute writer method with validation
222
203
  # @param [Object] last_name Value to be assigned
223
204
  def last_name=(last_name)
224
- if last_name.nil?
225
- fail ArgumentError, 'last_name cannot be nil'
226
- end
227
-
228
- if last_name.to_s.length > 150
205
+ if !last_name.nil? && last_name.to_s.length > 150
229
206
  fail ArgumentError, 'invalid value for "last_name", the character length must be smaller than or equal to 150.'
230
207
  end
231
208