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,213 @@
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 Error403
17
+ attr_accessor :errors
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'errors' => :'errors'
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.openapi_types
28
+ {
29
+ :'errors' => :'Array<Object>'
30
+ }
31
+ end
32
+
33
+ # List of attributes with nullable: true
34
+ def self.openapi_nullable
35
+ Set.new([
36
+ ])
37
+ end
38
+
39
+ # Initializes the object
40
+ # @param [Hash] attributes Model attributes in the form of hash
41
+ def initialize(attributes = {})
42
+ if (!attributes.is_a?(Hash))
43
+ fail ArgumentError, "The input argument (attributes) must be a hash in `RBACApiClient::Error403` initialize method"
44
+ end
45
+
46
+ # check to see if the attribute exists and convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}) { |(k, v), h|
48
+ if (!self.class.attribute_map.key?(k.to_sym))
49
+ fail ArgumentError, "`#{k}` is not a valid attribute in `RBACApiClient::Error403`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
50
+ end
51
+ h[k.to_sym] = v
52
+ }
53
+
54
+ if attributes.key?(:'errors')
55
+ if (value = attributes[:'errors']).is_a?(Array)
56
+ self.errors = value
57
+ end
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 @errors.nil?
66
+ invalid_properties.push('invalid value for "errors", errors cannot be nil.')
67
+ end
68
+
69
+ invalid_properties
70
+ end
71
+
72
+ # Check to see if the all the properties in the model are valid
73
+ # @return true if the model is valid
74
+ def valid?
75
+ return false if @errors.nil?
76
+ true
77
+ end
78
+
79
+ # Checks equality by comparing each attribute.
80
+ # @param [Object] Object to be compared
81
+ def ==(o)
82
+ return true if self.equal?(o)
83
+ self.class == o.class &&
84
+ errors == o.errors
85
+ end
86
+
87
+ # @see the `==` method
88
+ # @param [Object] Object to be compared
89
+ def eql?(o)
90
+ self == o
91
+ end
92
+
93
+ # Calculates hash code according to all attributes.
94
+ # @return [Integer] Hash code
95
+ def hash
96
+ [errors].hash
97
+ end
98
+
99
+ # Builds the object from hash
100
+ # @param [Hash] attributes Model attributes in the form of hash
101
+ # @return [Object] Returns the model itself
102
+ def self.build_from_hash(attributes)
103
+ new.build_from_hash(attributes)
104
+ end
105
+
106
+ # Builds the object from hash
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ # @return [Object] Returns the model itself
109
+ def build_from_hash(attributes)
110
+ return nil unless attributes.is_a?(Hash)
111
+ self.class.openapi_types.each_pair do |key, type|
112
+ if type =~ /\AArray<(.*)>/i
113
+ # check to ensure the input is an array given that the attribute
114
+ # is documented as an array but the input is not
115
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
116
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
117
+ end
118
+ elsif !attributes[self.class.attribute_map[key]].nil?
119
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
120
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
121
+ end
122
+
123
+ self
124
+ end
125
+
126
+ # Deserializes the data based on type
127
+ # @param string type Data type
128
+ # @param string value Value to be deserialized
129
+ # @return [Object] Deserialized data
130
+ def _deserialize(type, value)
131
+ case type.to_sym
132
+ when :DateTime
133
+ DateTime.parse(value)
134
+ when :Date
135
+ Date.parse(value)
136
+ when :String
137
+ value.to_s
138
+ when :Integer
139
+ value.to_i
140
+ when :Float
141
+ value.to_f
142
+ when :Boolean
143
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
144
+ true
145
+ else
146
+ false
147
+ end
148
+ when :Object
149
+ # generic object (usually a Hash), return directly
150
+ value
151
+ when /\AArray<(?<inner_type>.+)>\z/
152
+ inner_type = Regexp.last_match[:inner_type]
153
+ value.map { |v| _deserialize(inner_type, v) }
154
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
155
+ k_type = Regexp.last_match[:k_type]
156
+ v_type = Regexp.last_match[:v_type]
157
+ {}.tap do |hash|
158
+ value.each do |k, v|
159
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
160
+ end
161
+ end
162
+ else # model
163
+ RBACApiClient.const_get(type).build_from_hash(value)
164
+ end
165
+ end
166
+
167
+ # Returns the string representation of the object
168
+ # @return [String] String presentation of the object
169
+ def to_s
170
+ to_hash.to_s
171
+ end
172
+
173
+ # to_body is an alias to to_hash (backward compatibility)
174
+ # @return [Hash] Returns the object in the form of hash
175
+ def to_body
176
+ to_hash
177
+ end
178
+
179
+ # Returns the object in the form of hash
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_hash
182
+ hash = {}
183
+ self.class.attribute_map.each_pair do |attr, param|
184
+ value = self.send(attr)
185
+ if value.nil?
186
+ is_nullable = self.class.openapi_nullable.include?(attr)
187
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
188
+ end
189
+
190
+ hash[param] = _to_hash(value)
191
+ end
192
+ hash
193
+ end
194
+
195
+ # Outputs non-array value in the form of hash
196
+ # For object, use to_hash. Otherwise, just return the value
197
+ # @param [Object] value Any valid value
198
+ # @return [Hash] Returns the value in the form of hash
199
+ def _to_hash(value)
200
+ if value.is_a?(Array)
201
+ value.compact.map { |v| _to_hash(v) }
202
+ elsif value.is_a?(Hash)
203
+ {}.tap do |hash|
204
+ value.each { |k, v| hash[k] = _to_hash(v) }
205
+ end
206
+ elsif value.respond_to? :to_hash
207
+ value.to_hash
208
+ else
209
+ value
210
+ end
211
+ end
212
+ end
213
+ end
@@ -0,0 +1,220 @@
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 Group
17
+ attr_accessor :name
18
+
19
+ attr_accessor :description
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'name' => :'name',
25
+ :'description' => :'description'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.openapi_types
31
+ {
32
+ :'name' => :'String',
33
+ :'description' => :'String'
34
+ }
35
+ end
36
+
37
+ # List of attributes with nullable: true
38
+ def self.openapi_nullable
39
+ Set.new([
40
+ ])
41
+ end
42
+
43
+ # Initializes the object
44
+ # @param [Hash] attributes Model attributes in the form of hash
45
+ def initialize(attributes = {})
46
+ if (!attributes.is_a?(Hash))
47
+ fail ArgumentError, "The input argument (attributes) must be a hash in `RBACApiClient::Group` initialize method"
48
+ end
49
+
50
+ # check to see if the attribute exists and convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}) { |(k, v), h|
52
+ if (!self.class.attribute_map.key?(k.to_sym))
53
+ fail ArgumentError, "`#{k}` is not a valid attribute in `RBACApiClient::Group`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
54
+ end
55
+ h[k.to_sym] = v
56
+ }
57
+
58
+ if attributes.key?(:'name')
59
+ self.name = attributes[:'name']
60
+ end
61
+
62
+ if attributes.key?(:'description')
63
+ self.description = attributes[:'description']
64
+ end
65
+ end
66
+
67
+ # Show invalid properties with the reasons. Usually used together with valid?
68
+ # @return Array for valid properties with the reasons
69
+ def list_invalid_properties
70
+ invalid_properties = Array.new
71
+ if @name.nil?
72
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
73
+ end
74
+
75
+ invalid_properties
76
+ end
77
+
78
+ # Check to see if the all the properties in the model are valid
79
+ # @return true if the model is valid
80
+ def valid?
81
+ return false if @name.nil?
82
+ true
83
+ end
84
+
85
+ # Checks equality by comparing each attribute.
86
+ # @param [Object] Object to be compared
87
+ def ==(o)
88
+ return true if self.equal?(o)
89
+ self.class == o.class &&
90
+ name == o.name &&
91
+ description == o.description
92
+ end
93
+
94
+ # @see the `==` method
95
+ # @param [Object] Object to be compared
96
+ def eql?(o)
97
+ self == o
98
+ end
99
+
100
+ # Calculates hash code according to all attributes.
101
+ # @return [Integer] Hash code
102
+ def hash
103
+ [name, description].hash
104
+ end
105
+
106
+ # Builds the object from hash
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ # @return [Object] Returns the model itself
109
+ def self.build_from_hash(attributes)
110
+ new.build_from_hash(attributes)
111
+ end
112
+
113
+ # Builds the object from hash
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ # @return [Object] Returns the model itself
116
+ def build_from_hash(attributes)
117
+ return nil unless attributes.is_a?(Hash)
118
+ self.class.openapi_types.each_pair do |key, type|
119
+ if type =~ /\AArray<(.*)>/i
120
+ # check to ensure the input is an array given that the attribute
121
+ # is documented as an array but the input is not
122
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
123
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
124
+ end
125
+ elsif !attributes[self.class.attribute_map[key]].nil?
126
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
127
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
128
+ end
129
+
130
+ self
131
+ end
132
+
133
+ # Deserializes the data based on type
134
+ # @param string type Data type
135
+ # @param string value Value to be deserialized
136
+ # @return [Object] Deserialized data
137
+ def _deserialize(type, value)
138
+ case type.to_sym
139
+ when :DateTime
140
+ DateTime.parse(value)
141
+ when :Date
142
+ Date.parse(value)
143
+ when :String
144
+ value.to_s
145
+ when :Integer
146
+ value.to_i
147
+ when :Float
148
+ value.to_f
149
+ when :Boolean
150
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
151
+ true
152
+ else
153
+ false
154
+ end
155
+ when :Object
156
+ # generic object (usually a Hash), return directly
157
+ value
158
+ when /\AArray<(?<inner_type>.+)>\z/
159
+ inner_type = Regexp.last_match[:inner_type]
160
+ value.map { |v| _deserialize(inner_type, v) }
161
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
162
+ k_type = Regexp.last_match[:k_type]
163
+ v_type = Regexp.last_match[:v_type]
164
+ {}.tap do |hash|
165
+ value.each do |k, v|
166
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
167
+ end
168
+ end
169
+ else # model
170
+ RBACApiClient.const_get(type).build_from_hash(value)
171
+ end
172
+ end
173
+
174
+ # Returns the string representation of the object
175
+ # @return [String] String presentation of the object
176
+ def to_s
177
+ to_hash.to_s
178
+ end
179
+
180
+ # to_body is an alias to to_hash (backward compatibility)
181
+ # @return [Hash] Returns the object in the form of hash
182
+ def to_body
183
+ to_hash
184
+ end
185
+
186
+ # Returns the object in the form of hash
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_hash
189
+ hash = {}
190
+ self.class.attribute_map.each_pair do |attr, param|
191
+ value = self.send(attr)
192
+ if value.nil?
193
+ is_nullable = self.class.openapi_nullable.include?(attr)
194
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
195
+ end
196
+
197
+ hash[param] = _to_hash(value)
198
+ end
199
+ hash
200
+ end
201
+
202
+ # Outputs non-array value in the form of hash
203
+ # For object, use to_hash. Otherwise, just return the value
204
+ # @param [Object] value Any valid value
205
+ # @return [Hash] Returns the value in the form of hash
206
+ def _to_hash(value)
207
+ if value.is_a?(Array)
208
+ value.compact.map { |v| _to_hash(v) }
209
+ elsif value.is_a?(Hash)
210
+ {}.tap do |hash|
211
+ value.each { |k, v| hash[k] = _to_hash(v) }
212
+ end
213
+ elsif value.respond_to? :to_hash
214
+ value.to_hash
215
+ else
216
+ value
217
+ end
218
+ end
219
+ end
220
+ end
@@ -0,0 +1,341 @@
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 GroupOut
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 :principal_count
28
+
29
+ attr_accessor :role_count
30
+
31
+ attr_accessor :system
32
+
33
+ attr_accessor :platform_default
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+ :'name' => :'name',
39
+ :'description' => :'description',
40
+ :'uuid' => :'uuid',
41
+ :'created' => :'created',
42
+ :'modified' => :'modified',
43
+ :'principal_count' => :'principalCount',
44
+ :'role_count' => :'roleCount',
45
+ :'system' => :'system',
46
+ :'platform_default' => :'platform_default'
47
+ }
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.openapi_types
52
+ {
53
+ :'name' => :'String',
54
+ :'description' => :'String',
55
+ :'uuid' => :'String',
56
+ :'created' => :'DateTime',
57
+ :'modified' => :'DateTime',
58
+ :'principal_count' => :'Integer',
59
+ :'role_count' => :'Integer',
60
+ :'system' => :'Boolean',
61
+ :'platform_default' => :'Boolean'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
71
+ # List of class defined in allOf (OpenAPI v3)
72
+ def self.openapi_all_of
73
+ [
74
+ :'Group',
75
+ :'Timestamped',
76
+ :'UUID'
77
+ ]
78
+ end
79
+
80
+ # Initializes the object
81
+ # @param [Hash] attributes Model attributes in the form of hash
82
+ def initialize(attributes = {})
83
+ if (!attributes.is_a?(Hash))
84
+ fail ArgumentError, "The input argument (attributes) must be a hash in `RBACApiClient::GroupOut` initialize method"
85
+ end
86
+
87
+ # check to see if the attribute exists and convert string to symbol for hash key
88
+ attributes = attributes.each_with_object({}) { |(k, v), h|
89
+ if (!self.class.attribute_map.key?(k.to_sym))
90
+ fail ArgumentError, "`#{k}` is not a valid attribute in `RBACApiClient::GroupOut`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
91
+ end
92
+ h[k.to_sym] = v
93
+ }
94
+
95
+ if attributes.key?(:'name')
96
+ self.name = attributes[:'name']
97
+ end
98
+
99
+ if attributes.key?(:'description')
100
+ self.description = attributes[:'description']
101
+ end
102
+
103
+ if attributes.key?(:'uuid')
104
+ self.uuid = attributes[:'uuid']
105
+ end
106
+
107
+ if attributes.key?(:'created')
108
+ self.created = attributes[:'created']
109
+ end
110
+
111
+ if attributes.key?(:'modified')
112
+ self.modified = attributes[:'modified']
113
+ end
114
+
115
+ if attributes.key?(:'principal_count')
116
+ self.principal_count = attributes[:'principal_count']
117
+ end
118
+
119
+ if attributes.key?(:'role_count')
120
+ self.role_count = attributes[:'role_count']
121
+ end
122
+
123
+ if attributes.key?(:'system')
124
+ self.system = attributes[:'system']
125
+ else
126
+ self.system = false
127
+ end
128
+
129
+ if attributes.key?(:'platform_default')
130
+ self.platform_default = attributes[:'platform_default']
131
+ else
132
+ self.platform_default = false
133
+ end
134
+ end
135
+
136
+ # Show invalid properties with the reasons. Usually used together with valid?
137
+ # @return Array for valid properties with the reasons
138
+ def list_invalid_properties
139
+ invalid_properties = Array.new
140
+ if @name.nil?
141
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
142
+ end
143
+
144
+ if @uuid.nil?
145
+ invalid_properties.push('invalid value for "uuid", uuid cannot be nil.')
146
+ end
147
+
148
+ if @created.nil?
149
+ invalid_properties.push('invalid value for "created", created cannot be nil.')
150
+ end
151
+
152
+ if @modified.nil?
153
+ invalid_properties.push('invalid value for "modified", modified cannot be nil.')
154
+ end
155
+
156
+ if !@principal_count.nil? && @principal_count < 0
157
+ invalid_properties.push('invalid value for "principal_count", must be greater than or equal to 0.')
158
+ end
159
+
160
+ if !@role_count.nil? && @role_count < 0
161
+ invalid_properties.push('invalid value for "role_count", must be greater than or equal to 0.')
162
+ end
163
+
164
+ invalid_properties
165
+ end
166
+
167
+ # Check to see if the all the properties in the model are valid
168
+ # @return true if the model is valid
169
+ def valid?
170
+ return false if @name.nil?
171
+ return false if @uuid.nil?
172
+ return false if @created.nil?
173
+ return false if @modified.nil?
174
+ return false if !@principal_count.nil? && @principal_count < 0
175
+ return false if !@role_count.nil? && @role_count < 0
176
+ true
177
+ end
178
+
179
+ # Custom attribute writer method with validation
180
+ # @param [Object] principal_count Value to be assigned
181
+ def principal_count=(principal_count)
182
+ if !principal_count.nil? && principal_count < 0
183
+ fail ArgumentError, 'invalid value for "principal_count", must be greater than or equal to 0.'
184
+ end
185
+
186
+ @principal_count = principal_count
187
+ end
188
+
189
+ # Custom attribute writer method with validation
190
+ # @param [Object] role_count Value to be assigned
191
+ def role_count=(role_count)
192
+ if !role_count.nil? && role_count < 0
193
+ fail ArgumentError, 'invalid value for "role_count", must be greater than or equal to 0.'
194
+ end
195
+
196
+ @role_count = role_count
197
+ end
198
+
199
+ # Checks equality by comparing each attribute.
200
+ # @param [Object] Object to be compared
201
+ def ==(o)
202
+ return true if self.equal?(o)
203
+ self.class == o.class &&
204
+ name == o.name &&
205
+ description == o.description &&
206
+ uuid == o.uuid &&
207
+ created == o.created &&
208
+ modified == o.modified &&
209
+ principal_count == o.principal_count &&
210
+ role_count == o.role_count &&
211
+ system == o.system &&
212
+ platform_default == o.platform_default
213
+ end
214
+
215
+ # @see the `==` method
216
+ # @param [Object] Object to be compared
217
+ def eql?(o)
218
+ self == o
219
+ end
220
+
221
+ # Calculates hash code according to all attributes.
222
+ # @return [Integer] Hash code
223
+ def hash
224
+ [name, description, uuid, created, modified, principal_count, role_count, system, platform_default].hash
225
+ end
226
+
227
+ # Builds the object from hash
228
+ # @param [Hash] attributes Model attributes in the form of hash
229
+ # @return [Object] Returns the model itself
230
+ def self.build_from_hash(attributes)
231
+ new.build_from_hash(attributes)
232
+ end
233
+
234
+ # Builds the object from hash
235
+ # @param [Hash] attributes Model attributes in the form of hash
236
+ # @return [Object] Returns the model itself
237
+ def build_from_hash(attributes)
238
+ return nil unless attributes.is_a?(Hash)
239
+ self.class.openapi_types.each_pair do |key, type|
240
+ if type =~ /\AArray<(.*)>/i
241
+ # check to ensure the input is an array given that the attribute
242
+ # is documented as an array but the input is not
243
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
244
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
245
+ end
246
+ elsif !attributes[self.class.attribute_map[key]].nil?
247
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
248
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
249
+ end
250
+
251
+ self
252
+ end
253
+
254
+ # Deserializes the data based on type
255
+ # @param string type Data type
256
+ # @param string value Value to be deserialized
257
+ # @return [Object] Deserialized data
258
+ def _deserialize(type, value)
259
+ case type.to_sym
260
+ when :DateTime
261
+ DateTime.parse(value)
262
+ when :Date
263
+ Date.parse(value)
264
+ when :String
265
+ value.to_s
266
+ when :Integer
267
+ value.to_i
268
+ when :Float
269
+ value.to_f
270
+ when :Boolean
271
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
272
+ true
273
+ else
274
+ false
275
+ end
276
+ when :Object
277
+ # generic object (usually a Hash), return directly
278
+ value
279
+ when /\AArray<(?<inner_type>.+)>\z/
280
+ inner_type = Regexp.last_match[:inner_type]
281
+ value.map { |v| _deserialize(inner_type, v) }
282
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
283
+ k_type = Regexp.last_match[:k_type]
284
+ v_type = Regexp.last_match[:v_type]
285
+ {}.tap do |hash|
286
+ value.each do |k, v|
287
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
288
+ end
289
+ end
290
+ else # model
291
+ RBACApiClient.const_get(type).build_from_hash(value)
292
+ end
293
+ end
294
+
295
+ # Returns the string representation of the object
296
+ # @return [String] String presentation of the object
297
+ def to_s
298
+ to_hash.to_s
299
+ end
300
+
301
+ # to_body is an alias to to_hash (backward compatibility)
302
+ # @return [Hash] Returns the object in the form of hash
303
+ def to_body
304
+ to_hash
305
+ end
306
+
307
+ # Returns the object in the form of hash
308
+ # @return [Hash] Returns the object in the form of hash
309
+ def to_hash
310
+ hash = {}
311
+ self.class.attribute_map.each_pair do |attr, param|
312
+ value = self.send(attr)
313
+ if value.nil?
314
+ is_nullable = self.class.openapi_nullable.include?(attr)
315
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
316
+ end
317
+
318
+ hash[param] = _to_hash(value)
319
+ end
320
+ hash
321
+ end
322
+
323
+ # Outputs non-array value in the form of hash
324
+ # For object, use to_hash. Otherwise, just return the value
325
+ # @param [Object] value Any valid value
326
+ # @return [Hash] Returns the value in the form of hash
327
+ def _to_hash(value)
328
+ if value.is_a?(Array)
329
+ value.compact.map { |v| _to_hash(v) }
330
+ elsif value.is_a?(Hash)
331
+ {}.tap do |hash|
332
+ value.each { |k, v| hash[k] = _to_hash(v) }
333
+ end
334
+ elsif value.respond_to? :to_hash
335
+ value.to_hash
336
+ else
337
+ value
338
+ end
339
+ end
340
+ end
341
+ end