rbac-api-client 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (180) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +175 -0
  4. data/Rakefile +10 -0
  5. data/client-meta.json +8 -0
  6. data/docs/Access.md +19 -0
  7. data/docs/AccessApi.md +68 -0
  8. data/docs/AccessPagination.md +21 -0
  9. data/docs/AccessPaginationAllOf.md +17 -0
  10. data/docs/AdditionalGroup.md +19 -0
  11. data/docs/Error.md +17 -0
  12. data/docs/Error403.md +17 -0
  13. data/docs/Group.md +19 -0
  14. data/docs/GroupApi.md +623 -0
  15. data/docs/GroupOut.md +33 -0
  16. data/docs/GroupPagination.md +21 -0
  17. data/docs/GroupPaginationAllOf.md +17 -0
  18. data/docs/GroupPrincipalIn.md +17 -0
  19. data/docs/GroupRoleIn.md +17 -0
  20. data/docs/GroupRolesPagination.md +21 -0
  21. data/docs/GroupWithPrincipals.md +27 -0
  22. data/docs/GroupWithPrincipalsAllOf.md +17 -0
  23. data/docs/GroupWithPrincipalsAndRoles.md +29 -0
  24. data/docs/GroupWithPrincipalsAndRolesAllOf.md +19 -0
  25. data/docs/InlineResponse200.md +17 -0
  26. data/docs/ListPagination.md +19 -0
  27. data/docs/PaginationLinks.md +23 -0
  28. data/docs/PaginationMeta.md +17 -0
  29. data/docs/Policy.md +19 -0
  30. data/docs/PolicyApi.md +283 -0
  31. data/docs/PolicyExtended.md +29 -0
  32. data/docs/PolicyExtendedAllOf.md +19 -0
  33. data/docs/PolicyIn.md +23 -0
  34. data/docs/PolicyInAllOf.md +19 -0
  35. data/docs/PolicyPagination.md +21 -0
  36. data/docs/PolicyPaginationAllOf.md +17 -0
  37. data/docs/Principal.md +25 -0
  38. data/docs/PrincipalApi.md +68 -0
  39. data/docs/PrincipalIn.md +17 -0
  40. data/docs/PrincipalOut.md +27 -0
  41. data/docs/PrincipalPagination.md +21 -0
  42. data/docs/PrincipalPaginationAllOf.md +17 -0
  43. data/docs/ResourceDefinition.md +17 -0
  44. data/docs/ResourceDefinitionFilter.md +21 -0
  45. data/docs/Role.md +19 -0
  46. data/docs/RoleApi.md +340 -0
  47. data/docs/RoleIn.md +21 -0
  48. data/docs/RoleInAllOf.md +17 -0
  49. data/docs/RoleOut.md +35 -0
  50. data/docs/RoleOutDynamic.md +39 -0
  51. data/docs/RoleOutDynamicAllOf.md +29 -0
  52. data/docs/RolePagination.md +21 -0
  53. data/docs/RolePaginationDynamic.md +21 -0
  54. data/docs/RolePaginationDynamicAllOf.md +17 -0
  55. data/docs/RoleWithAccess.md +37 -0
  56. data/docs/Status.md +27 -0
  57. data/docs/StatusApi.md +56 -0
  58. data/docs/Timestamped.md +19 -0
  59. data/docs/UUID.md +17 -0
  60. data/generate.sh +7 -0
  61. data/git_push.sh +58 -0
  62. data/lib/rbac-api-client.rb +93 -0
  63. data/lib/rbac-api-client/api/access_api.rb +104 -0
  64. data/lib/rbac-api-client/api/group_api.rb +800 -0
  65. data/lib/rbac-api-client/api/policy_api.rb +363 -0
  66. data/lib/rbac-api-client/api/principal_api.rb +104 -0
  67. data/lib/rbac-api-client/api/role_api.rb +445 -0
  68. data/lib/rbac-api-client/api/status_api.rb +76 -0
  69. data/lib/rbac-api-client/api_client.rb +386 -0
  70. data/lib/rbac-api-client/api_error.rb +57 -0
  71. data/lib/rbac-api-client/configuration.rb +248 -0
  72. data/lib/rbac-api-client/models/access.rb +227 -0
  73. data/lib/rbac-api-client/models/access_pagination.rb +239 -0
  74. data/lib/rbac-api-client/models/access_pagination_all_of.rb +213 -0
  75. data/lib/rbac-api-client/models/additional_group.rb +215 -0
  76. data/lib/rbac-api-client/models/error.rb +213 -0
  77. data/lib/rbac-api-client/models/error403.rb +213 -0
  78. data/lib/rbac-api-client/models/group.rb +220 -0
  79. data/lib/rbac-api-client/models/group_out.rb +341 -0
  80. data/lib/rbac-api-client/models/group_pagination.rb +239 -0
  81. data/lib/rbac-api-client/models/group_pagination_all_of.rb +213 -0
  82. data/lib/rbac-api-client/models/group_principal_in.rb +213 -0
  83. data/lib/rbac-api-client/models/group_role_in.rb +213 -0
  84. data/lib/rbac-api-client/models/group_roles_pagination.rb +239 -0
  85. data/lib/rbac-api-client/models/group_with_principals.rb +288 -0
  86. data/lib/rbac-api-client/models/group_with_principals_all_of.rb +213 -0
  87. data/lib/rbac-api-client/models/group_with_principals_and_roles.rb +304 -0
  88. data/lib/rbac-api-client/models/group_with_principals_and_roles_all_of.rb +229 -0
  89. data/lib/rbac-api-client/models/inline_response200.rb +213 -0
  90. data/lib/rbac-api-client/models/list_pagination.rb +215 -0
  91. data/lib/rbac-api-client/models/pagination_links.rb +233 -0
  92. data/lib/rbac-api-client/models/pagination_meta.rb +206 -0
  93. data/lib/rbac-api-client/models/policy.rb +220 -0
  94. data/lib/rbac-api-client/models/policy_extended.rb +302 -0
  95. data/lib/rbac-api-client/models/policy_extended_all_of.rb +227 -0
  96. data/lib/rbac-api-client/models/policy_in.rb +258 -0
  97. data/lib/rbac-api-client/models/policy_in_all_of.rb +227 -0
  98. data/lib/rbac-api-client/models/policy_pagination.rb +239 -0
  99. data/lib/rbac-api-client/models/policy_pagination_all_of.rb +213 -0
  100. data/lib/rbac-api-client/models/principal.rb +252 -0
  101. data/lib/rbac-api-client/models/principal_in.rb +211 -0
  102. data/lib/rbac-api-client/models/principal_out.rb +274 -0
  103. data/lib/rbac-api-client/models/principal_pagination.rb +239 -0
  104. data/lib/rbac-api-client/models/principal_pagination_all_of.rb +213 -0
  105. data/lib/rbac-api-client/models/resource_definition.rb +211 -0
  106. data/lib/rbac-api-client/models/resource_definition_filter.rb +273 -0
  107. data/lib/rbac-api-client/models/role.rb +220 -0
  108. data/lib/rbac-api-client/models/role_in.rb +244 -0
  109. data/lib/rbac-api-client/models/role_in_all_of.rb +213 -0
  110. data/lib/rbac-api-client/models/role_out.rb +352 -0
  111. data/lib/rbac-api-client/models/role_out_dynamic.rb +421 -0
  112. data/lib/rbac-api-client/models/role_out_dynamic_all_of.rb +346 -0
  113. data/lib/rbac-api-client/models/role_pagination.rb +239 -0
  114. data/lib/rbac-api-client/models/role_pagination_dynamic.rb +239 -0
  115. data/lib/rbac-api-client/models/role_pagination_dynamic_all_of.rb +213 -0
  116. data/lib/rbac-api-client/models/role_with_access.rb +367 -0
  117. data/lib/rbac-api-client/models/status.rb +256 -0
  118. data/lib/rbac-api-client/models/timestamped.rb +225 -0
  119. data/lib/rbac-api-client/models/uuid.rb +211 -0
  120. data/lib/rbac-api-client/version.rb +15 -0
  121. data/openapi.json +2613 -0
  122. data/rbac-api-client.gemspec +39 -0
  123. data/spec/api/access_api_spec.rb +49 -0
  124. data/spec/api/group_api_spec.rb +176 -0
  125. data/spec/api/policy_api_spec.rb +97 -0
  126. data/spec/api/principal_api_spec.rb +49 -0
  127. data/spec/api/role_api_spec.rb +110 -0
  128. data/spec/api/status_api_spec.rb +45 -0
  129. data/spec/api_client_spec.rb +226 -0
  130. data/spec/configuration_spec.rb +42 -0
  131. data/spec/models/access_pagination_all_of_spec.rb +41 -0
  132. data/spec/models/access_pagination_spec.rb +53 -0
  133. data/spec/models/access_spec.rb +47 -0
  134. data/spec/models/additional_group_spec.rb +47 -0
  135. data/spec/models/error403_spec.rb +41 -0
  136. data/spec/models/error_spec.rb +41 -0
  137. data/spec/models/group_out_spec.rb +89 -0
  138. data/spec/models/group_pagination_all_of_spec.rb +41 -0
  139. data/spec/models/group_pagination_spec.rb +53 -0
  140. data/spec/models/group_principal_in_spec.rb +41 -0
  141. data/spec/models/group_role_in_spec.rb +41 -0
  142. data/spec/models/group_roles_pagination_spec.rb +53 -0
  143. data/spec/models/group_spec.rb +47 -0
  144. data/spec/models/group_with_principals_all_of_spec.rb +41 -0
  145. data/spec/models/group_with_principals_and_roles_all_of_spec.rb +47 -0
  146. data/spec/models/group_with_principals_and_roles_spec.rb +77 -0
  147. data/spec/models/group_with_principals_spec.rb +71 -0
  148. data/spec/models/inline_response200_spec.rb +41 -0
  149. data/spec/models/list_pagination_spec.rb +47 -0
  150. data/spec/models/pagination_links_spec.rb +59 -0
  151. data/spec/models/pagination_meta_spec.rb +41 -0
  152. data/spec/models/policy_extended_all_of_spec.rb +47 -0
  153. data/spec/models/policy_extended_spec.rb +77 -0
  154. data/spec/models/policy_in_all_of_spec.rb +47 -0
  155. data/spec/models/policy_in_spec.rb +59 -0
  156. data/spec/models/policy_pagination_all_of_spec.rb +41 -0
  157. data/spec/models/policy_pagination_spec.rb +53 -0
  158. data/spec/models/policy_spec.rb +47 -0
  159. data/spec/models/principal_in_spec.rb +41 -0
  160. data/spec/models/principal_out_spec.rb +71 -0
  161. data/spec/models/principal_pagination_all_of_spec.rb +41 -0
  162. data/spec/models/principal_pagination_spec.rb +53 -0
  163. data/spec/models/principal_spec.rb +65 -0
  164. data/spec/models/resource_definition_filter_spec.rb +57 -0
  165. data/spec/models/resource_definition_spec.rb +41 -0
  166. data/spec/models/role_in_all_of_spec.rb +41 -0
  167. data/spec/models/role_in_spec.rb +53 -0
  168. data/spec/models/role_out_dynamic_all_of_spec.rb +77 -0
  169. data/spec/models/role_out_dynamic_spec.rb +107 -0
  170. data/spec/models/role_out_spec.rb +95 -0
  171. data/spec/models/role_pagination_dynamic_all_of_spec.rb +41 -0
  172. data/spec/models/role_pagination_dynamic_spec.rb +53 -0
  173. data/spec/models/role_pagination_spec.rb +53 -0
  174. data/spec/models/role_spec.rb +47 -0
  175. data/spec/models/role_with_access_spec.rb +101 -0
  176. data/spec/models/status_spec.rb +71 -0
  177. data/spec/models/timestamped_spec.rb +47 -0
  178. data/spec/models/uuid_spec.rb +41 -0
  179. data/spec/spec_helper.rb +111 -0
  180. metadata +338 -0
@@ -0,0 +1,421 @@
1
+ =begin
2
+ #Role Based Access Control
3
+
4
+ #The API for Role Based Access Control.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.2
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module RBACApiClient
16
+ class RoleOutDynamic
17
+ attr_accessor :name
18
+
19
+ attr_accessor :description
20
+
21
+ attr_accessor :uuid
22
+
23
+ attr_accessor :created
24
+
25
+ attr_accessor :modified
26
+
27
+ attr_accessor :policy_count
28
+
29
+ attr_accessor :access_count
30
+
31
+ attr_accessor :applications
32
+
33
+ attr_accessor :system
34
+
35
+ attr_accessor :platform_default
36
+
37
+ attr_accessor :groups_in_count
38
+
39
+ attr_accessor :groups_in
40
+
41
+ # Attribute mapping from ruby-style variable name to JSON key.
42
+ def self.attribute_map
43
+ {
44
+ :'name' => :'name',
45
+ :'description' => :'description',
46
+ :'uuid' => :'uuid',
47
+ :'created' => :'created',
48
+ :'modified' => :'modified',
49
+ :'policy_count' => :'policyCount',
50
+ :'access_count' => :'accessCount',
51
+ :'applications' => :'applications',
52
+ :'system' => :'system',
53
+ :'platform_default' => :'platform_default',
54
+ :'groups_in_count' => :'groups_in_count',
55
+ :'groups_in' => :'groups_in'
56
+ }
57
+ end
58
+
59
+ # Attribute type mapping.
60
+ def self.openapi_types
61
+ {
62
+ :'name' => :'String',
63
+ :'description' => :'String',
64
+ :'uuid' => :'String',
65
+ :'created' => :'DateTime',
66
+ :'modified' => :'DateTime',
67
+ :'policy_count' => :'Integer',
68
+ :'access_count' => :'Integer',
69
+ :'applications' => :'Array<String>',
70
+ :'system' => :'Boolean',
71
+ :'platform_default' => :'Boolean',
72
+ :'groups_in_count' => :'Integer',
73
+ :'groups_in' => :'Array<AdditionalGroup>'
74
+ }
75
+ end
76
+
77
+ # List of attributes with nullable: true
78
+ def self.openapi_nullable
79
+ Set.new([
80
+ ])
81
+ end
82
+
83
+ # List of class defined in allOf (OpenAPI v3)
84
+ def self.openapi_all_of
85
+ [
86
+ :'Role',
87
+ :'RoleOutDynamicAllOf',
88
+ :'Timestamped',
89
+ :'UUID'
90
+ ]
91
+ end
92
+
93
+ # Initializes the object
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ def initialize(attributes = {})
96
+ if (!attributes.is_a?(Hash))
97
+ fail ArgumentError, "The input argument (attributes) must be a hash in `RBACApiClient::RoleOutDynamic` initialize method"
98
+ end
99
+
100
+ # check to see if the attribute exists and convert string to symbol for hash key
101
+ attributes = attributes.each_with_object({}) { |(k, v), h|
102
+ if (!self.class.attribute_map.key?(k.to_sym))
103
+ fail ArgumentError, "`#{k}` is not a valid attribute in `RBACApiClient::RoleOutDynamic`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
104
+ end
105
+ h[k.to_sym] = v
106
+ }
107
+
108
+ if attributes.key?(:'name')
109
+ self.name = attributes[:'name']
110
+ end
111
+
112
+ if attributes.key?(:'description')
113
+ self.description = attributes[:'description']
114
+ end
115
+
116
+ if attributes.key?(:'uuid')
117
+ self.uuid = attributes[:'uuid']
118
+ end
119
+
120
+ if attributes.key?(:'created')
121
+ self.created = attributes[:'created']
122
+ end
123
+
124
+ if attributes.key?(:'modified')
125
+ self.modified = attributes[:'modified']
126
+ end
127
+
128
+ if attributes.key?(:'policy_count')
129
+ self.policy_count = attributes[:'policy_count']
130
+ end
131
+
132
+ if attributes.key?(:'access_count')
133
+ self.access_count = attributes[:'access_count']
134
+ end
135
+
136
+ if attributes.key?(:'applications')
137
+ if (value = attributes[:'applications']).is_a?(Array)
138
+ self.applications = value
139
+ end
140
+ end
141
+
142
+ if attributes.key?(:'system')
143
+ self.system = attributes[:'system']
144
+ else
145
+ self.system = false
146
+ end
147
+
148
+ if attributes.key?(:'platform_default')
149
+ self.platform_default = attributes[:'platform_default']
150
+ else
151
+ self.platform_default = false
152
+ end
153
+
154
+ if attributes.key?(:'groups_in_count')
155
+ self.groups_in_count = attributes[:'groups_in_count']
156
+ end
157
+
158
+ if attributes.key?(:'groups_in')
159
+ if (value = attributes[:'groups_in']).is_a?(Array)
160
+ self.groups_in = value
161
+ end
162
+ end
163
+ end
164
+
165
+ # Show invalid properties with the reasons. Usually used together with valid?
166
+ # @return Array for valid properties with the reasons
167
+ def list_invalid_properties
168
+ invalid_properties = Array.new
169
+ if @name.nil?
170
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
171
+ end
172
+
173
+ if @uuid.nil?
174
+ invalid_properties.push('invalid value for "uuid", uuid cannot be nil.')
175
+ end
176
+
177
+ if @created.nil?
178
+ invalid_properties.push('invalid value for "created", created cannot be nil.')
179
+ end
180
+
181
+ if @modified.nil?
182
+ invalid_properties.push('invalid value for "modified", modified cannot be nil.')
183
+ end
184
+
185
+ if @policy_count.nil?
186
+ invalid_properties.push('invalid value for "policy_count", policy_count cannot be nil.')
187
+ end
188
+
189
+ if @policy_count < 0
190
+ invalid_properties.push('invalid value for "policy_count", must be greater than or equal to 0.')
191
+ end
192
+
193
+ if @access_count.nil?
194
+ invalid_properties.push('invalid value for "access_count", access_count cannot be nil.')
195
+ end
196
+
197
+ if @access_count < 0
198
+ invalid_properties.push('invalid value for "access_count", must be greater than or equal to 0.')
199
+ end
200
+
201
+ if @applications.nil?
202
+ invalid_properties.push('invalid value for "applications", applications cannot be nil.')
203
+ end
204
+
205
+ if @system.nil?
206
+ invalid_properties.push('invalid value for "system", system cannot be nil.')
207
+ end
208
+
209
+ if @platform_default.nil?
210
+ invalid_properties.push('invalid value for "platform_default", platform_default cannot be nil.')
211
+ end
212
+
213
+ if !@groups_in_count.nil? && @groups_in_count < 0
214
+ invalid_properties.push('invalid value for "groups_in_count", must be greater than or equal to 0.')
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 @name.nil?
224
+ return false if @uuid.nil?
225
+ return false if @created.nil?
226
+ return false if @modified.nil?
227
+ return false if @policy_count.nil?
228
+ return false if @policy_count < 0
229
+ return false if @access_count.nil?
230
+ return false if @access_count < 0
231
+ return false if @applications.nil?
232
+ return false if @system.nil?
233
+ return false if @platform_default.nil?
234
+ return false if !@groups_in_count.nil? && @groups_in_count < 0
235
+ true
236
+ end
237
+
238
+ # Custom attribute writer method with validation
239
+ # @param [Object] policy_count Value to be assigned
240
+ def policy_count=(policy_count)
241
+ if policy_count.nil?
242
+ fail ArgumentError, 'policy_count cannot be nil'
243
+ end
244
+
245
+ if policy_count < 0
246
+ fail ArgumentError, 'invalid value for "policy_count", must be greater than or equal to 0.'
247
+ end
248
+
249
+ @policy_count = policy_count
250
+ end
251
+
252
+ # Custom attribute writer method with validation
253
+ # @param [Object] access_count Value to be assigned
254
+ def access_count=(access_count)
255
+ if access_count.nil?
256
+ fail ArgumentError, 'access_count cannot be nil'
257
+ end
258
+
259
+ if access_count < 0
260
+ fail ArgumentError, 'invalid value for "access_count", must be greater than or equal to 0.'
261
+ end
262
+
263
+ @access_count = access_count
264
+ end
265
+
266
+ # Custom attribute writer method with validation
267
+ # @param [Object] groups_in_count Value to be assigned
268
+ def groups_in_count=(groups_in_count)
269
+ if !groups_in_count.nil? && groups_in_count < 0
270
+ fail ArgumentError, 'invalid value for "groups_in_count", must be greater than or equal to 0.'
271
+ end
272
+
273
+ @groups_in_count = groups_in_count
274
+ end
275
+
276
+ # Checks equality by comparing each attribute.
277
+ # @param [Object] Object to be compared
278
+ def ==(o)
279
+ return true if self.equal?(o)
280
+ self.class == o.class &&
281
+ name == o.name &&
282
+ description == o.description &&
283
+ uuid == o.uuid &&
284
+ created == o.created &&
285
+ modified == o.modified &&
286
+ policy_count == o.policy_count &&
287
+ access_count == o.access_count &&
288
+ applications == o.applications &&
289
+ system == o.system &&
290
+ platform_default == o.platform_default &&
291
+ groups_in_count == o.groups_in_count &&
292
+ groups_in == o.groups_in
293
+ end
294
+
295
+ # @see the `==` method
296
+ # @param [Object] Object to be compared
297
+ def eql?(o)
298
+ self == o
299
+ end
300
+
301
+ # Calculates hash code according to all attributes.
302
+ # @return [Integer] Hash code
303
+ def hash
304
+ [name, description, uuid, created, modified, policy_count, access_count, applications, system, platform_default, groups_in_count, groups_in].hash
305
+ end
306
+
307
+ # Builds the object from hash
308
+ # @param [Hash] attributes Model attributes in the form of hash
309
+ # @return [Object] Returns the model itself
310
+ def self.build_from_hash(attributes)
311
+ new.build_from_hash(attributes)
312
+ end
313
+
314
+ # Builds the object from hash
315
+ # @param [Hash] attributes Model attributes in the form of hash
316
+ # @return [Object] Returns the model itself
317
+ def build_from_hash(attributes)
318
+ return nil unless attributes.is_a?(Hash)
319
+ self.class.openapi_types.each_pair do |key, type|
320
+ if type =~ /\AArray<(.*)>/i
321
+ # check to ensure the input is an array given that the attribute
322
+ # is documented as an array but the input is not
323
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
324
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
325
+ end
326
+ elsif !attributes[self.class.attribute_map[key]].nil?
327
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
328
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
329
+ end
330
+
331
+ self
332
+ end
333
+
334
+ # Deserializes the data based on type
335
+ # @param string type Data type
336
+ # @param string value Value to be deserialized
337
+ # @return [Object] Deserialized data
338
+ def _deserialize(type, value)
339
+ case type.to_sym
340
+ when :DateTime
341
+ DateTime.parse(value)
342
+ when :Date
343
+ Date.parse(value)
344
+ when :String
345
+ value.to_s
346
+ when :Integer
347
+ value.to_i
348
+ when :Float
349
+ value.to_f
350
+ when :Boolean
351
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
352
+ true
353
+ else
354
+ false
355
+ end
356
+ when :Object
357
+ # generic object (usually a Hash), return directly
358
+ value
359
+ when /\AArray<(?<inner_type>.+)>\z/
360
+ inner_type = Regexp.last_match[:inner_type]
361
+ value.map { |v| _deserialize(inner_type, v) }
362
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
363
+ k_type = Regexp.last_match[:k_type]
364
+ v_type = Regexp.last_match[:v_type]
365
+ {}.tap do |hash|
366
+ value.each do |k, v|
367
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
368
+ end
369
+ end
370
+ else # model
371
+ RBACApiClient.const_get(type).build_from_hash(value)
372
+ end
373
+ end
374
+
375
+ # Returns the string representation of the object
376
+ # @return [String] String presentation of the object
377
+ def to_s
378
+ to_hash.to_s
379
+ end
380
+
381
+ # to_body is an alias to to_hash (backward compatibility)
382
+ # @return [Hash] Returns the object in the form of hash
383
+ def to_body
384
+ to_hash
385
+ end
386
+
387
+ # Returns the object in the form of hash
388
+ # @return [Hash] Returns the object in the form of hash
389
+ def to_hash
390
+ hash = {}
391
+ self.class.attribute_map.each_pair do |attr, param|
392
+ value = self.send(attr)
393
+ if value.nil?
394
+ is_nullable = self.class.openapi_nullable.include?(attr)
395
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
396
+ end
397
+
398
+ hash[param] = _to_hash(value)
399
+ end
400
+ hash
401
+ end
402
+
403
+ # Outputs non-array value in the form of hash
404
+ # For object, use to_hash. Otherwise, just return the value
405
+ # @param [Object] value Any valid value
406
+ # @return [Hash] Returns the value in the form of hash
407
+ def _to_hash(value)
408
+ if value.is_a?(Array)
409
+ value.compact.map { |v| _to_hash(v) }
410
+ elsif value.is_a?(Hash)
411
+ {}.tap do |hash|
412
+ value.each { |k, v| hash[k] = _to_hash(v) }
413
+ end
414
+ elsif value.respond_to? :to_hash
415
+ value.to_hash
416
+ else
417
+ value
418
+ end
419
+ end
420
+ end
421
+ end
@@ -0,0 +1,346 @@
1
+ =begin
2
+ #Role Based Access Control
3
+
4
+ #The API for Role Based Access Control.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.2
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module RBACApiClient
16
+ class RoleOutDynamicAllOf
17
+ attr_accessor :policy_count
18
+
19
+ attr_accessor :access_count
20
+
21
+ attr_accessor :applications
22
+
23
+ attr_accessor :system
24
+
25
+ attr_accessor :platform_default
26
+
27
+ attr_accessor :groups_in_count
28
+
29
+ attr_accessor :groups_in
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'policy_count' => :'policyCount',
35
+ :'access_count' => :'accessCount',
36
+ :'applications' => :'applications',
37
+ :'system' => :'system',
38
+ :'platform_default' => :'platform_default',
39
+ :'groups_in_count' => :'groups_in_count',
40
+ :'groups_in' => :'groups_in'
41
+ }
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.openapi_types
46
+ {
47
+ :'policy_count' => :'Integer',
48
+ :'access_count' => :'Integer',
49
+ :'applications' => :'Array<String>',
50
+ :'system' => :'Boolean',
51
+ :'platform_default' => :'Boolean',
52
+ :'groups_in_count' => :'Integer',
53
+ :'groups_in' => :'Array<AdditionalGroup>'
54
+ }
55
+ end
56
+
57
+ # List of attributes with nullable: true
58
+ def self.openapi_nullable
59
+ Set.new([
60
+ ])
61
+ end
62
+
63
+ # Initializes the object
64
+ # @param [Hash] attributes Model attributes in the form of hash
65
+ def initialize(attributes = {})
66
+ if (!attributes.is_a?(Hash))
67
+ fail ArgumentError, "The input argument (attributes) must be a hash in `RBACApiClient::RoleOutDynamicAllOf` initialize method"
68
+ end
69
+
70
+ # check to see if the attribute exists and convert string to symbol for hash key
71
+ attributes = attributes.each_with_object({}) { |(k, v), h|
72
+ if (!self.class.attribute_map.key?(k.to_sym))
73
+ fail ArgumentError, "`#{k}` is not a valid attribute in `RBACApiClient::RoleOutDynamicAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
74
+ end
75
+ h[k.to_sym] = v
76
+ }
77
+
78
+ if attributes.key?(:'policy_count')
79
+ self.policy_count = attributes[:'policy_count']
80
+ end
81
+
82
+ if attributes.key?(:'access_count')
83
+ self.access_count = attributes[:'access_count']
84
+ end
85
+
86
+ if attributes.key?(:'applications')
87
+ if (value = attributes[:'applications']).is_a?(Array)
88
+ self.applications = value
89
+ end
90
+ end
91
+
92
+ if attributes.key?(:'system')
93
+ self.system = attributes[:'system']
94
+ else
95
+ self.system = false
96
+ end
97
+
98
+ if attributes.key?(:'platform_default')
99
+ self.platform_default = attributes[:'platform_default']
100
+ else
101
+ self.platform_default = false
102
+ end
103
+
104
+ if attributes.key?(:'groups_in_count')
105
+ self.groups_in_count = attributes[:'groups_in_count']
106
+ end
107
+
108
+ if attributes.key?(:'groups_in')
109
+ if (value = attributes[:'groups_in']).is_a?(Array)
110
+ self.groups_in = value
111
+ end
112
+ end
113
+ end
114
+
115
+ # Show invalid properties with the reasons. Usually used together with valid?
116
+ # @return Array for valid properties with the reasons
117
+ def list_invalid_properties
118
+ invalid_properties = Array.new
119
+ if @policy_count.nil?
120
+ invalid_properties.push('invalid value for "policy_count", policy_count cannot be nil.')
121
+ end
122
+
123
+ if @policy_count < 0
124
+ invalid_properties.push('invalid value for "policy_count", must be greater than or equal to 0.')
125
+ end
126
+
127
+ if @access_count.nil?
128
+ invalid_properties.push('invalid value for "access_count", access_count cannot be nil.')
129
+ end
130
+
131
+ if @access_count < 0
132
+ invalid_properties.push('invalid value for "access_count", must be greater than or equal to 0.')
133
+ end
134
+
135
+ if @applications.nil?
136
+ invalid_properties.push('invalid value for "applications", applications cannot be nil.')
137
+ end
138
+
139
+ if @system.nil?
140
+ invalid_properties.push('invalid value for "system", system cannot be nil.')
141
+ end
142
+
143
+ if @platform_default.nil?
144
+ invalid_properties.push('invalid value for "platform_default", platform_default cannot be nil.')
145
+ end
146
+
147
+ if !@groups_in_count.nil? && @groups_in_count < 0
148
+ invalid_properties.push('invalid value for "groups_in_count", must be greater than or equal to 0.')
149
+ end
150
+
151
+ invalid_properties
152
+ end
153
+
154
+ # Check to see if the all the properties in the model are valid
155
+ # @return true if the model is valid
156
+ def valid?
157
+ return false if @policy_count.nil?
158
+ return false if @policy_count < 0
159
+ return false if @access_count.nil?
160
+ return false if @access_count < 0
161
+ return false if @applications.nil?
162
+ return false if @system.nil?
163
+ return false if @platform_default.nil?
164
+ return false if !@groups_in_count.nil? && @groups_in_count < 0
165
+ true
166
+ end
167
+
168
+ # Custom attribute writer method with validation
169
+ # @param [Object] policy_count Value to be assigned
170
+ def policy_count=(policy_count)
171
+ if policy_count.nil?
172
+ fail ArgumentError, 'policy_count cannot be nil'
173
+ end
174
+
175
+ if policy_count < 0
176
+ fail ArgumentError, 'invalid value for "policy_count", must be greater than or equal to 0.'
177
+ end
178
+
179
+ @policy_count = policy_count
180
+ end
181
+
182
+ # Custom attribute writer method with validation
183
+ # @param [Object] access_count Value to be assigned
184
+ def access_count=(access_count)
185
+ if access_count.nil?
186
+ fail ArgumentError, 'access_count cannot be nil'
187
+ end
188
+
189
+ if access_count < 0
190
+ fail ArgumentError, 'invalid value for "access_count", must be greater than or equal to 0.'
191
+ end
192
+
193
+ @access_count = access_count
194
+ end
195
+
196
+ # Custom attribute writer method with validation
197
+ # @param [Object] groups_in_count Value to be assigned
198
+ def groups_in_count=(groups_in_count)
199
+ if !groups_in_count.nil? && groups_in_count < 0
200
+ fail ArgumentError, 'invalid value for "groups_in_count", must be greater than or equal to 0.'
201
+ end
202
+
203
+ @groups_in_count = groups_in_count
204
+ end
205
+
206
+ # Checks equality by comparing each attribute.
207
+ # @param [Object] Object to be compared
208
+ def ==(o)
209
+ return true if self.equal?(o)
210
+ self.class == o.class &&
211
+ policy_count == o.policy_count &&
212
+ access_count == o.access_count &&
213
+ applications == o.applications &&
214
+ system == o.system &&
215
+ platform_default == o.platform_default &&
216
+ groups_in_count == o.groups_in_count &&
217
+ groups_in == o.groups_in
218
+ end
219
+
220
+ # @see the `==` method
221
+ # @param [Object] Object to be compared
222
+ def eql?(o)
223
+ self == o
224
+ end
225
+
226
+ # Calculates hash code according to all attributes.
227
+ # @return [Integer] Hash code
228
+ def hash
229
+ [policy_count, access_count, applications, system, platform_default, groups_in_count, groups_in].hash
230
+ end
231
+
232
+ # Builds the object from hash
233
+ # @param [Hash] attributes Model attributes in the form of hash
234
+ # @return [Object] Returns the model itself
235
+ def self.build_from_hash(attributes)
236
+ new.build_from_hash(attributes)
237
+ end
238
+
239
+ # Builds the object from hash
240
+ # @param [Hash] attributes Model attributes in the form of hash
241
+ # @return [Object] Returns the model itself
242
+ def build_from_hash(attributes)
243
+ return nil unless attributes.is_a?(Hash)
244
+ self.class.openapi_types.each_pair do |key, type|
245
+ if type =~ /\AArray<(.*)>/i
246
+ # check to ensure the input is an array given that the attribute
247
+ # is documented as an array but the input is not
248
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
249
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
250
+ end
251
+ elsif !attributes[self.class.attribute_map[key]].nil?
252
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
253
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
254
+ end
255
+
256
+ self
257
+ end
258
+
259
+ # Deserializes the data based on type
260
+ # @param string type Data type
261
+ # @param string value Value to be deserialized
262
+ # @return [Object] Deserialized data
263
+ def _deserialize(type, value)
264
+ case type.to_sym
265
+ when :DateTime
266
+ DateTime.parse(value)
267
+ when :Date
268
+ Date.parse(value)
269
+ when :String
270
+ value.to_s
271
+ when :Integer
272
+ value.to_i
273
+ when :Float
274
+ value.to_f
275
+ when :Boolean
276
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
277
+ true
278
+ else
279
+ false
280
+ end
281
+ when :Object
282
+ # generic object (usually a Hash), return directly
283
+ value
284
+ when /\AArray<(?<inner_type>.+)>\z/
285
+ inner_type = Regexp.last_match[:inner_type]
286
+ value.map { |v| _deserialize(inner_type, v) }
287
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
288
+ k_type = Regexp.last_match[:k_type]
289
+ v_type = Regexp.last_match[:v_type]
290
+ {}.tap do |hash|
291
+ value.each do |k, v|
292
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
293
+ end
294
+ end
295
+ else # model
296
+ RBACApiClient.const_get(type).build_from_hash(value)
297
+ end
298
+ end
299
+
300
+ # Returns the string representation of the object
301
+ # @return [String] String presentation of the object
302
+ def to_s
303
+ to_hash.to_s
304
+ end
305
+
306
+ # to_body is an alias to to_hash (backward compatibility)
307
+ # @return [Hash] Returns the object in the form of hash
308
+ def to_body
309
+ to_hash
310
+ end
311
+
312
+ # Returns the object in the form of hash
313
+ # @return [Hash] Returns the object in the form of hash
314
+ def to_hash
315
+ hash = {}
316
+ self.class.attribute_map.each_pair do |attr, param|
317
+ value = self.send(attr)
318
+ if value.nil?
319
+ is_nullable = self.class.openapi_nullable.include?(attr)
320
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
321
+ end
322
+
323
+ hash[param] = _to_hash(value)
324
+ end
325
+ hash
326
+ end
327
+
328
+ # Outputs non-array value in the form of hash
329
+ # For object, use to_hash. Otherwise, just return the value
330
+ # @param [Object] value Any valid value
331
+ # @return [Hash] Returns the value in the form of hash
332
+ def _to_hash(value)
333
+ if value.is_a?(Array)
334
+ value.compact.map { |v| _to_hash(v) }
335
+ elsif value.is_a?(Hash)
336
+ {}.tap do |hash|
337
+ value.each { |k, v| hash[k] = _to_hash(v) }
338
+ end
339
+ elsif value.respond_to? :to_hash
340
+ value.to_hash
341
+ else
342
+ value
343
+ end
344
+ end
345
+ end
346
+ end