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
@@ -15,9 +15,12 @@ require 'date'
15
15
  module PulpcoreClient
16
16
  # Serializer for AccessPolicy.
17
17
  class PatchedAccessPolicy
18
- # List of callables that define the new permissions to be created for new objects.
18
+ # List of callables that define the new permissions to be created for new objects.This is deprecated. Use `creation_hooks` instead.
19
19
  attr_accessor :permissions_assignment
20
20
 
21
+ # List of callables that may associate user roles for new objects.
22
+ attr_accessor :creation_hooks
23
+
21
24
  # List of policy statements defining the policy.
22
25
  attr_accessor :statements
23
26
 
@@ -25,6 +28,7 @@ module PulpcoreClient
25
28
  def self.attribute_map
26
29
  {
27
30
  :'permissions_assignment' => :'permissions_assignment',
31
+ :'creation_hooks' => :'creation_hooks',
28
32
  :'statements' => :'statements'
29
33
  }
30
34
  end
@@ -33,6 +37,7 @@ module PulpcoreClient
33
37
  def self.openapi_types
34
38
  {
35
39
  :'permissions_assignment' => :'Array<Object>',
40
+ :'creation_hooks' => :'Array<Object>',
36
41
  :'statements' => :'Array<Object>'
37
42
  }
38
43
  end
@@ -64,6 +69,12 @@ module PulpcoreClient
64
69
  end
65
70
  end
66
71
 
72
+ if attributes.key?(:'creation_hooks')
73
+ if (value = attributes[:'creation_hooks']).is_a?(Array)
74
+ self.creation_hooks = value
75
+ end
76
+ end
77
+
67
78
  if attributes.key?(:'statements')
68
79
  if (value = attributes[:'statements']).is_a?(Array)
69
80
  self.statements = value
@@ -90,6 +101,7 @@ module PulpcoreClient
90
101
  return true if self.equal?(o)
91
102
  self.class == o.class &&
92
103
  permissions_assignment == o.permissions_assignment &&
104
+ creation_hooks == o.creation_hooks &&
93
105
  statements == o.statements
94
106
  end
95
107
 
@@ -102,7 +114,7 @@ module PulpcoreClient
102
114
  # Calculates hash code according to all attributes.
103
115
  # @return [Integer] Hash code
104
116
  def hash
105
- [permissions_assignment, statements].hash
117
+ [permissions_assignment, creation_hooks, statements].hash
106
118
  end
107
119
 
108
120
  # Builds the object from hash
@@ -80,15 +80,45 @@ module PulpcoreClient
80
80
  # @return Array for valid properties with the reasons
81
81
  def list_invalid_properties
82
82
  invalid_properties = Array.new
83
+ if !@name.nil? && @name.to_s.length < 1
84
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
85
+ end
86
+
87
+ if !@path.nil? && @path.to_s.length < 1
88
+ invalid_properties.push('invalid value for "path", the character length must be great than or equal to 1.')
89
+ end
90
+
83
91
  invalid_properties
84
92
  end
85
93
 
86
94
  # Check to see if the all the properties in the model are valid
87
95
  # @return true if the model is valid
88
96
  def valid?
97
+ return false if !@name.nil? && @name.to_s.length < 1
98
+ return false if !@path.nil? && @path.to_s.length < 1
89
99
  true
90
100
  end
91
101
 
102
+ # Custom attribute writer method with validation
103
+ # @param [Object] name Value to be assigned
104
+ def name=(name)
105
+ if !name.nil? && name.to_s.length < 1
106
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
107
+ end
108
+
109
+ @name = name
110
+ end
111
+
112
+ # Custom attribute writer method with validation
113
+ # @param [Object] path Value to be assigned
114
+ def path=(path)
115
+ if !path.nil? && path.to_s.length < 1
116
+ fail ArgumentError, 'invalid value for "path", the character length must be great than or equal to 1.'
117
+ end
118
+
119
+ @path = path
120
+ end
121
+
92
122
  # Checks equality by comparing each attribute.
93
123
  # @param [Object] Object to be compared
94
124
  def ==(o)
@@ -66,6 +66,10 @@ module PulpcoreClient
66
66
  invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 150.')
67
67
  end
68
68
 
69
+ if !@name.nil? && @name.to_s.length < 1
70
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
71
+ end
72
+
69
73
  invalid_properties
70
74
  end
71
75
 
@@ -73,6 +77,7 @@ module PulpcoreClient
73
77
  # @return true if the model is valid
74
78
  def valid?
75
79
  return false if !@name.nil? && @name.to_s.length > 150
80
+ return false if !@name.nil? && @name.to_s.length < 1
76
81
  true
77
82
  end
78
83
 
@@ -83,6 +88,10 @@ module PulpcoreClient
83
88
  fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 150.'
84
89
  end
85
90
 
91
+ if !name.nil? && name.to_s.length < 1
92
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
93
+ end
94
+
86
95
  @name = name
87
96
  end
88
97
 
@@ -91,15 +91,45 @@ module PulpcoreClient
91
91
  # @return Array for valid properties with the reasons
92
92
  def list_invalid_properties
93
93
  invalid_properties = Array.new
94
+ if !@name.nil? && @name.to_s.length < 1
95
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
96
+ end
97
+
98
+ if !@path.nil? && @path.to_s.length < 1
99
+ invalid_properties.push('invalid value for "path", the character length must be great than or equal to 1.')
100
+ end
101
+
94
102
  invalid_properties
95
103
  end
96
104
 
97
105
  # Check to see if the all the properties in the model are valid
98
106
  # @return true if the model is valid
99
107
  def valid?
108
+ return false if !@name.nil? && @name.to_s.length < 1
109
+ return false if !@path.nil? && @path.to_s.length < 1
100
110
  true
101
111
  end
102
112
 
113
+ # Custom attribute writer method with validation
114
+ # @param [Object] name Value to be assigned
115
+ def name=(name)
116
+ if !name.nil? && name.to_s.length < 1
117
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
118
+ end
119
+
120
+ @name = name
121
+ end
122
+
123
+ # Custom attribute writer method with validation
124
+ # @param [Object] path Value to be assigned
125
+ def path=(path)
126
+ if !path.nil? && path.to_s.length < 1
127
+ fail ArgumentError, 'invalid value for "path", the character length must be great than or equal to 1.'
128
+ end
129
+
130
+ @path = path
131
+ end
132
+
103
133
  # Checks equality by comparing each attribute.
104
134
  # @param [Object] Object to be compared
105
135
  def ==(o)
@@ -73,15 +73,30 @@ module PulpcoreClient
73
73
  # @return Array for valid properties with the reasons
74
74
  def list_invalid_properties
75
75
  invalid_properties = Array.new
76
+ if !@name.nil? && @name.to_s.length < 1
77
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
78
+ end
79
+
76
80
  invalid_properties
77
81
  end
78
82
 
79
83
  # Check to see if the all the properties in the model are valid
80
84
  # @return true if the model is valid
81
85
  def valid?
86
+ return false if !@name.nil? && @name.to_s.length < 1
82
87
  true
83
88
  end
84
89
 
90
+ # Custom attribute writer method with validation
91
+ # @param [Object] name Value to be assigned
92
+ def name=(name)
93
+ if !name.nil? && name.to_s.length < 1
94
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
95
+ end
96
+
97
+ @name = name
98
+ end
99
+
85
100
  # Checks equality by comparing each attribute.
86
101
  # @param [Object] Object to be compared
87
102
  def ==(o)
@@ -72,15 +72,45 @@ module PulpcoreClient
72
72
  # @return Array for valid properties with the reasons
73
73
  def list_invalid_properties
74
74
  invalid_properties = Array.new
75
+ if !@name.nil? && @name.to_s.length < 1
76
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
77
+ end
78
+
79
+ if !@description.nil? && @description.to_s.length < 1
80
+ invalid_properties.push('invalid value for "description", the character length must be great than or equal to 1.')
81
+ end
82
+
75
83
  invalid_properties
76
84
  end
77
85
 
78
86
  # Check to see if the all the properties in the model are valid
79
87
  # @return true if the model is valid
80
88
  def valid?
89
+ return false if !@name.nil? && @name.to_s.length < 1
90
+ return false if !@description.nil? && @description.to_s.length < 1
81
91
  true
82
92
  end
83
93
 
94
+ # Custom attribute writer method with validation
95
+ # @param [Object] name Value to be assigned
96
+ def name=(name)
97
+ if !name.nil? && name.to_s.length < 1
98
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
99
+ end
100
+
101
+ @name = name
102
+ end
103
+
104
+ # Custom attribute writer method with validation
105
+ # @param [Object] description Value to be assigned
106
+ def description=(description)
107
+ if !description.nil? && description.to_s.length < 1
108
+ fail ArgumentError, 'invalid value for "description", the character length must be great than or equal to 1.'
109
+ end
110
+
111
+ @description = description
112
+ end
113
+
84
114
  # Checks equality by comparing each attribute.
85
115
  # @param [Object] Object to be compared
86
116
  def ==(o)
@@ -0,0 +1,261 @@
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 Role.
17
+ class PatchedRole
18
+ # The name of this role.
19
+ attr_accessor :name
20
+
21
+ # An optional description.
22
+ attr_accessor :description
23
+
24
+ # List of permissions defining the role.
25
+ attr_accessor :permissions
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'name' => :'name',
31
+ :'description' => :'description',
32
+ :'permissions' => :'permissions'
33
+ }
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.openapi_types
38
+ {
39
+ :'name' => :'String',
40
+ :'description' => :'String',
41
+ :'permissions' => :'Array<String>'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ :'description',
49
+ ])
50
+ end
51
+
52
+ # Initializes the object
53
+ # @param [Hash] attributes Model attributes in the form of hash
54
+ def initialize(attributes = {})
55
+ if (!attributes.is_a?(Hash))
56
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpcoreClient::PatchedRole` initialize method"
57
+ end
58
+
59
+ # check to see if the attribute exists and convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!self.class.attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpcoreClient::PatchedRole`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:'name')
68
+ self.name = attributes[:'name']
69
+ end
70
+
71
+ if attributes.key?(:'description')
72
+ self.description = attributes[:'description']
73
+ end
74
+
75
+ if attributes.key?(:'permissions')
76
+ if (value = attributes[:'permissions']).is_a?(Array)
77
+ self.permissions = value
78
+ end
79
+ end
80
+ end
81
+
82
+ # Show invalid properties with the reasons. Usually used together with valid?
83
+ # @return Array for valid properties with the reasons
84
+ def list_invalid_properties
85
+ invalid_properties = Array.new
86
+ if !@name.nil? && @name.to_s.length < 1
87
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
88
+ end
89
+
90
+ if !@description.nil? && @description.to_s.length < 1
91
+ invalid_properties.push('invalid value for "description", the character length must be great than or equal to 1.')
92
+ end
93
+
94
+ invalid_properties
95
+ end
96
+
97
+ # Check to see if the all the properties in the model are valid
98
+ # @return true if the model is valid
99
+ def valid?
100
+ return false if !@name.nil? && @name.to_s.length < 1
101
+ return false if !@description.nil? && @description.to_s.length < 1
102
+ true
103
+ end
104
+
105
+ # Custom attribute writer method with validation
106
+ # @param [Object] name Value to be assigned
107
+ def name=(name)
108
+ if !name.nil? && name.to_s.length < 1
109
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
110
+ end
111
+
112
+ @name = name
113
+ end
114
+
115
+ # Custom attribute writer method with validation
116
+ # @param [Object] description Value to be assigned
117
+ def description=(description)
118
+ if !description.nil? && description.to_s.length < 1
119
+ fail ArgumentError, 'invalid value for "description", the character length must be great than or equal to 1.'
120
+ end
121
+
122
+ @description = description
123
+ end
124
+
125
+ # Checks equality by comparing each attribute.
126
+ # @param [Object] Object to be compared
127
+ def ==(o)
128
+ return true if self.equal?(o)
129
+ self.class == o.class &&
130
+ name == o.name &&
131
+ description == o.description &&
132
+ permissions == o.permissions
133
+ end
134
+
135
+ # @see the `==` method
136
+ # @param [Object] Object to be compared
137
+ def eql?(o)
138
+ self == o
139
+ end
140
+
141
+ # Calculates hash code according to all attributes.
142
+ # @return [Integer] Hash code
143
+ def hash
144
+ [name, description, permissions].hash
145
+ end
146
+
147
+ # Builds the object from hash
148
+ # @param [Hash] attributes Model attributes in the form of hash
149
+ # @return [Object] Returns the model itself
150
+ def self.build_from_hash(attributes)
151
+ new.build_from_hash(attributes)
152
+ end
153
+
154
+ # Builds the object from hash
155
+ # @param [Hash] attributes Model attributes in the form of hash
156
+ # @return [Object] Returns the model itself
157
+ def build_from_hash(attributes)
158
+ return nil unless attributes.is_a?(Hash)
159
+ self.class.openapi_types.each_pair do |key, type|
160
+ if type =~ /\AArray<(.*)>/i
161
+ # check to ensure the input is an array given that the attribute
162
+ # is documented as an array but the input is not
163
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
164
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
165
+ end
166
+ elsif !attributes[self.class.attribute_map[key]].nil?
167
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
168
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
169
+ end
170
+
171
+ self
172
+ end
173
+
174
+ # Deserializes the data based on type
175
+ # @param string type Data type
176
+ # @param string value Value to be deserialized
177
+ # @return [Object] Deserialized data
178
+ def _deserialize(type, value)
179
+ case type.to_sym
180
+ when :DateTime
181
+ DateTime.parse(value)
182
+ when :Date
183
+ Date.parse(value)
184
+ when :String
185
+ value.to_s
186
+ when :Integer
187
+ value.to_i
188
+ when :Float
189
+ value.to_f
190
+ when :Boolean
191
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
192
+ true
193
+ else
194
+ false
195
+ end
196
+ when :Object
197
+ # generic object (usually a Hash), return directly
198
+ value
199
+ when /\AArray<(?<inner_type>.+)>\z/
200
+ inner_type = Regexp.last_match[:inner_type]
201
+ value.map { |v| _deserialize(inner_type, v) }
202
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
203
+ k_type = Regexp.last_match[:k_type]
204
+ v_type = Regexp.last_match[:v_type]
205
+ {}.tap do |hash|
206
+ value.each do |k, v|
207
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
208
+ end
209
+ end
210
+ else # model
211
+ PulpcoreClient.const_get(type).build_from_hash(value)
212
+ end
213
+ end
214
+
215
+ # Returns the string representation of the object
216
+ # @return [String] String presentation of the object
217
+ def to_s
218
+ to_hash.to_s
219
+ end
220
+
221
+ # to_body is an alias to to_hash (backward compatibility)
222
+ # @return [Hash] Returns the object in the form of hash
223
+ def to_body
224
+ to_hash
225
+ end
226
+
227
+ # Returns the object in the form of hash
228
+ # @return [Hash] Returns the object in the form of hash
229
+ def to_hash
230
+ hash = {}
231
+ self.class.attribute_map.each_pair do |attr, param|
232
+ value = self.send(attr)
233
+ if value.nil?
234
+ is_nullable = self.class.openapi_nullable.include?(attr)
235
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
236
+ end
237
+
238
+ hash[param] = _to_hash(value)
239
+ end
240
+ hash
241
+ end
242
+
243
+ # Outputs non-array value in the form of hash
244
+ # For object, use to_hash. Otherwise, just return the value
245
+ # @param [Object] value Any valid value
246
+ # @return [Hash] Returns the value in the form of hash
247
+ def _to_hash(value)
248
+ if value.is_a?(Array)
249
+ value.compact.map { |v| _to_hash(v) }
250
+ elsif value.is_a?(Hash)
251
+ {}.tap do |hash|
252
+ value.each { |k, v| hash[k] = _to_hash(v) }
253
+ end
254
+ elsif value.respond_to? :to_hash
255
+ value.to_hash
256
+ else
257
+ value
258
+ end
259
+ end
260
+ end
261
+ end
@@ -62,15 +62,30 @@ module PulpcoreClient
62
62
  # @return Array for valid properties with the reasons
63
63
  def list_invalid_properties
64
64
  invalid_properties = Array.new
65
+ if !@state.nil? && @state.to_s.length < 1
66
+ invalid_properties.push('invalid value for "state", the character length must be great than or equal to 1.')
67
+ end
68
+
65
69
  invalid_properties
66
70
  end
67
71
 
68
72
  # Check to see if the all the properties in the model are valid
69
73
  # @return true if the model is valid
70
74
  def valid?
75
+ return false if !@state.nil? && @state.to_s.length < 1
71
76
  true
72
77
  end
73
78
 
79
+ # Custom attribute writer method with validation
80
+ # @param [Object] state Value to be assigned
81
+ def state=(state)
82
+ if !state.nil? && state.to_s.length < 1
83
+ fail ArgumentError, 'invalid value for "state", the character length must be great than or equal to 1.'
84
+ end
85
+
86
+ @state = state
87
+ end
88
+
74
89
  # Checks equality by comparing each attribute.
75
90
  # @param [Object] Object to be compared
76
91
  def ==(o)