keynetra-client 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +49 -0
  4. data/Rakefile +10 -0
  5. data/docs/ACLCreate.md +28 -0
  6. data/docs/ACLOut.md +34 -0
  7. data/docs/AccessApi.md +234 -0
  8. data/docs/AccessDecisionResponse.md +30 -0
  9. data/docs/AccessRequest.md +28 -0
  10. data/docs/AdminLoginRequest.md +20 -0
  11. data/docs/AdminLoginResponse.md +26 -0
  12. data/docs/AuditRecordOut.md +42 -0
  13. data/docs/AuthApi.md +133 -0
  14. data/docs/AuthModelCreate.md +18 -0
  15. data/docs/AuthModelOut.md +26 -0
  16. data/docs/BatchAccessItem.md +20 -0
  17. data/docs/BatchAccessRequest.md +24 -0
  18. data/docs/BatchAccessResponse.md +20 -0
  19. data/docs/BatchAccessResult.md +22 -0
  20. data/docs/DataValue.md +15 -0
  21. data/docs/DevApi.md +132 -0
  22. data/docs/HTTPValidationError.md +18 -0
  23. data/docs/HealthApi.md +187 -0
  24. data/docs/ImpactAnalysisRequest.md +18 -0
  25. data/docs/ImpactAnalysisResponse.md +20 -0
  26. data/docs/LocationInner.md +15 -0
  27. data/docs/ManagementApi.md +2096 -0
  28. data/docs/MetaBody.md +24 -0
  29. data/docs/PermissionCreate.md +18 -0
  30. data/docs/PermissionOut.md +20 -0
  31. data/docs/PermissionUpdate.md +18 -0
  32. data/docs/PlaygroundApi.md +80 -0
  33. data/docs/PlaygroundEvaluateRequest.md +20 -0
  34. data/docs/PlaygroundInput.md +24 -0
  35. data/docs/PlaygroundPolicy.md +26 -0
  36. data/docs/PolicyCreate.md +26 -0
  37. data/docs/PolicyOut.md +28 -0
  38. data/docs/PolicySimulationInput.md +22 -0
  39. data/docs/PolicySimulationRequest.md +20 -0
  40. data/docs/PolicySimulationResponse.md +20 -0
  41. data/docs/RelationshipCreate.md +26 -0
  42. data/docs/RelationshipOut.md +28 -0
  43. data/docs/RoleCreate.md +18 -0
  44. data/docs/RoleOut.md +20 -0
  45. data/docs/RoleUpdate.md +18 -0
  46. data/docs/SimulationResponse.md +30 -0
  47. data/docs/SuccessResponseACLOut.md +22 -0
  48. data/docs/SuccessResponseAccessDecisionResponse.md +22 -0
  49. data/docs/SuccessResponseAdminLoginResponse.md +22 -0
  50. data/docs/SuccessResponseAuthModelOut.md +22 -0
  51. data/docs/SuccessResponseBatchAccessResponse.md +22 -0
  52. data/docs/SuccessResponseDictStrAny.md +22 -0
  53. data/docs/SuccessResponseDictStrInt.md +22 -0
  54. data/docs/SuccessResponseDictStrObject.md +22 -0
  55. data/docs/SuccessResponseDictStrStr.md +22 -0
  56. data/docs/SuccessResponseDictStrUnionIntStr.md +22 -0
  57. data/docs/SuccessResponseImpactAnalysisResponse.md +22 -0
  58. data/docs/SuccessResponseListACLOut.md +22 -0
  59. data/docs/SuccessResponseListAuditRecordOut.md +22 -0
  60. data/docs/SuccessResponseListDictStrStr.md +22 -0
  61. data/docs/SuccessResponseListPermissionOut.md +22 -0
  62. data/docs/SuccessResponseListPolicyOut.md +22 -0
  63. data/docs/SuccessResponseListRoleOut.md +22 -0
  64. data/docs/SuccessResponsePermissionOut.md +22 -0
  65. data/docs/SuccessResponsePolicyOut.md +22 -0
  66. data/docs/SuccessResponsePolicySimulationResponse.md +22 -0
  67. data/docs/SuccessResponseRelationshipOut.md +22 -0
  68. data/docs/SuccessResponseSimulationResponse.md +22 -0
  69. data/docs/ValidationError.md +26 -0
  70. data/git_push.sh +57 -0
  71. data/keynetra-client.gemspec +39 -0
  72. data/lib/keynetra-client/api/access_api.rb +226 -0
  73. data/lib/keynetra-client/api/auth_api.rb +154 -0
  74. data/lib/keynetra-client/api/dev_api.rb +135 -0
  75. data/lib/keynetra-client/api/health_api.rb +187 -0
  76. data/lib/keynetra-client/api/management_api.rb +1851 -0
  77. data/lib/keynetra-client/api/playground_api.rb +88 -0
  78. data/lib/keynetra-client/api_client.rb +397 -0
  79. data/lib/keynetra-client/api_error.rb +58 -0
  80. data/lib/keynetra-client/api_model_base.rb +88 -0
  81. data/lib/keynetra-client/configuration.rb +315 -0
  82. data/lib/keynetra-client/models/access_decision_response.rb +242 -0
  83. data/lib/keynetra-client/models/access_request.rb +219 -0
  84. data/lib/keynetra-client/models/acl_create.rb +294 -0
  85. data/lib/keynetra-client/models/acl_out.rb +356 -0
  86. data/lib/keynetra-client/models/admin_login_request.rb +190 -0
  87. data/lib/keynetra-client/models/admin_login_response.rb +238 -0
  88. data/lib/keynetra-client/models/audit_record_out.rb +454 -0
  89. data/lib/keynetra-client/models/auth_model_create.rb +164 -0
  90. data/lib/keynetra-client/models/auth_model_out.rb +272 -0
  91. data/lib/keynetra-client/models/batch_access_item.rb +175 -0
  92. data/lib/keynetra-client/models/batch_access_request.rb +198 -0
  93. data/lib/keynetra-client/models/batch_access_response.rb +176 -0
  94. data/lib/keynetra-client/models/batch_access_result.rb +200 -0
  95. data/lib/keynetra-client/models/data_value.rb +103 -0
  96. data/lib/keynetra-client/models/http_validation_error.rb +149 -0
  97. data/lib/keynetra-client/models/impact_analysis_request.rb +164 -0
  98. data/lib/keynetra-client/models/impact_analysis_response.rb +160 -0
  99. data/lib/keynetra-client/models/location_inner.rb +103 -0
  100. data/lib/keynetra-client/models/meta_body.rb +179 -0
  101. data/lib/keynetra-client/models/permission_create.rb +164 -0
  102. data/lib/keynetra-client/models/permission_out.rb +190 -0
  103. data/lib/keynetra-client/models/permission_update.rb +164 -0
  104. data/lib/keynetra-client/models/playground_evaluate_request.rb +192 -0
  105. data/lib/keynetra-client/models/playground_input.rb +182 -0
  106. data/lib/keynetra-client/models/playground_policy.rb +207 -0
  107. data/lib/keynetra-client/models/policy_create.rb +208 -0
  108. data/lib/keynetra-client/models/policy_out.rb +281 -0
  109. data/lib/keynetra-client/models/policy_simulation_input.rb +172 -0
  110. data/lib/keynetra-client/models/policy_simulation_request.rb +158 -0
  111. data/lib/keynetra-client/models/policy_simulation_response.rb +194 -0
  112. data/lib/keynetra-client/models/relationship_create.rb +268 -0
  113. data/lib/keynetra-client/models/relationship_out.rb +294 -0
  114. data/lib/keynetra-client/models/role_create.rb +164 -0
  115. data/lib/keynetra-client/models/role_out.rb +190 -0
  116. data/lib/keynetra-client/models/role_update.rb +164 -0
  117. data/lib/keynetra-client/models/simulation_response.rb +244 -0
  118. data/lib/keynetra-client/models/success_response_access_decision_response.rb +182 -0
  119. data/lib/keynetra-client/models/success_response_acl_out.rb +182 -0
  120. data/lib/keynetra-client/models/success_response_admin_login_response.rb +182 -0
  121. data/lib/keynetra-client/models/success_response_auth_model_out.rb +182 -0
  122. data/lib/keynetra-client/models/success_response_batch_access_response.rb +182 -0
  123. data/lib/keynetra-client/models/success_response_dict_str_any.rb +184 -0
  124. data/lib/keynetra-client/models/success_response_dict_str_int.rb +184 -0
  125. data/lib/keynetra-client/models/success_response_dict_str_object.rb +184 -0
  126. data/lib/keynetra-client/models/success_response_dict_str_str.rb +184 -0
  127. data/lib/keynetra-client/models/success_response_dict_str_union_int_str.rb +184 -0
  128. data/lib/keynetra-client/models/success_response_impact_analysis_response.rb +182 -0
  129. data/lib/keynetra-client/models/success_response_list_acl_out.rb +184 -0
  130. data/lib/keynetra-client/models/success_response_list_audit_record_out.rb +184 -0
  131. data/lib/keynetra-client/models/success_response_list_dict_str_str.rb +184 -0
  132. data/lib/keynetra-client/models/success_response_list_permission_out.rb +184 -0
  133. data/lib/keynetra-client/models/success_response_list_policy_out.rb +184 -0
  134. data/lib/keynetra-client/models/success_response_list_role_out.rb +184 -0
  135. data/lib/keynetra-client/models/success_response_permission_out.rb +182 -0
  136. data/lib/keynetra-client/models/success_response_policy_out.rb +182 -0
  137. data/lib/keynetra-client/models/success_response_policy_simulation_response.rb +182 -0
  138. data/lib/keynetra-client/models/success_response_relationship_out.rb +182 -0
  139. data/lib/keynetra-client/models/success_response_simulation_response.rb +182 -0
  140. data/lib/keynetra-client/models/validation_error.rb +237 -0
  141. data/lib/keynetra-client/version.rb +15 -0
  142. data/lib/keynetra-client.rb +105 -0
  143. data/spec/api/access_api_spec.rb +70 -0
  144. data/spec/api/auth_api_spec.rb +57 -0
  145. data/spec/api/dev_api_spec.rb +56 -0
  146. data/spec/api/health_api_spec.rb +65 -0
  147. data/spec/api/management_api_spec.rb +361 -0
  148. data/spec/api/playground_api_spec.rb +46 -0
  149. data/spec/models/access_decision_response_spec.rb +72 -0
  150. data/spec/models/access_request_spec.rb +66 -0
  151. data/spec/models/acl_create_spec.rb +66 -0
  152. data/spec/models/acl_out_spec.rb +84 -0
  153. data/spec/models/admin_login_request_spec.rb +42 -0
  154. data/spec/models/admin_login_response_spec.rb +60 -0
  155. data/spec/models/audit_record_out_spec.rb +108 -0
  156. data/spec/models/auth_model_create_spec.rb +36 -0
  157. data/spec/models/auth_model_out_spec.rb +60 -0
  158. data/spec/models/batch_access_item_spec.rb +42 -0
  159. data/spec/models/batch_access_request_spec.rb +54 -0
  160. data/spec/models/batch_access_response_spec.rb +42 -0
  161. data/spec/models/batch_access_result_spec.rb +48 -0
  162. data/spec/models/data_value_spec.rb +21 -0
  163. data/spec/models/http_validation_error_spec.rb +36 -0
  164. data/spec/models/impact_analysis_request_spec.rb +36 -0
  165. data/spec/models/impact_analysis_response_spec.rb +42 -0
  166. data/spec/models/location_inner_spec.rb +21 -0
  167. data/spec/models/meta_body_spec.rb +54 -0
  168. data/spec/models/permission_create_spec.rb +36 -0
  169. data/spec/models/permission_out_spec.rb +42 -0
  170. data/spec/models/permission_update_spec.rb +36 -0
  171. data/spec/models/playground_evaluate_request_spec.rb +42 -0
  172. data/spec/models/playground_input_spec.rb +54 -0
  173. data/spec/models/playground_policy_spec.rb +60 -0
  174. data/spec/models/policy_create_spec.rb +60 -0
  175. data/spec/models/policy_out_spec.rb +66 -0
  176. data/spec/models/policy_simulation_input_spec.rb +48 -0
  177. data/spec/models/policy_simulation_request_spec.rb +42 -0
  178. data/spec/models/policy_simulation_response_spec.rb +42 -0
  179. data/spec/models/relationship_create_spec.rb +60 -0
  180. data/spec/models/relationship_out_spec.rb +66 -0
  181. data/spec/models/role_create_spec.rb +36 -0
  182. data/spec/models/role_out_spec.rb +42 -0
  183. data/spec/models/role_update_spec.rb +36 -0
  184. data/spec/models/simulation_response_spec.rb +72 -0
  185. data/spec/models/success_response_access_decision_response_spec.rb +48 -0
  186. data/spec/models/success_response_acl_out_spec.rb +48 -0
  187. data/spec/models/success_response_admin_login_response_spec.rb +48 -0
  188. data/spec/models/success_response_auth_model_out_spec.rb +48 -0
  189. data/spec/models/success_response_batch_access_response_spec.rb +48 -0
  190. data/spec/models/success_response_dict_str_any_spec.rb +48 -0
  191. data/spec/models/success_response_dict_str_int_spec.rb +48 -0
  192. data/spec/models/success_response_dict_str_object_spec.rb +48 -0
  193. data/spec/models/success_response_dict_str_str_spec.rb +48 -0
  194. data/spec/models/success_response_dict_str_union_int_str_spec.rb +48 -0
  195. data/spec/models/success_response_impact_analysis_response_spec.rb +48 -0
  196. data/spec/models/success_response_list_acl_out_spec.rb +48 -0
  197. data/spec/models/success_response_list_audit_record_out_spec.rb +48 -0
  198. data/spec/models/success_response_list_dict_str_str_spec.rb +48 -0
  199. data/spec/models/success_response_list_permission_out_spec.rb +48 -0
  200. data/spec/models/success_response_list_policy_out_spec.rb +48 -0
  201. data/spec/models/success_response_list_role_out_spec.rb +48 -0
  202. data/spec/models/success_response_permission_out_spec.rb +48 -0
  203. data/spec/models/success_response_policy_out_spec.rb +48 -0
  204. data/spec/models/success_response_policy_simulation_response_spec.rb +48 -0
  205. data/spec/models/success_response_relationship_out_spec.rb +48 -0
  206. data/spec/models/success_response_simulation_response_spec.rb +48 -0
  207. data/spec/models/validation_error_spec.rb +60 -0
  208. data/spec/spec_helper.rb +111 -0
  209. metadata +356 -0
@@ -0,0 +1,238 @@
1
+ =begin
2
+ #KeyNetra
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 0.1.1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.21.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module KeyNetra
17
+ class AdminLoginResponse < ApiModelBase
18
+ attr_accessor :access_token
19
+
20
+ attr_accessor :token_type
21
+
22
+ attr_accessor :expires_in
23
+
24
+ attr_accessor :role
25
+
26
+ attr_accessor :tenant_key
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'access_token' => :'access_token',
32
+ :'token_type' => :'token_type',
33
+ :'expires_in' => :'expires_in',
34
+ :'role' => :'role',
35
+ :'tenant_key' => :'tenant_key'
36
+ }
37
+ end
38
+
39
+ # Returns attribute mapping this model knows about
40
+ def self.acceptable_attribute_map
41
+ attribute_map
42
+ end
43
+
44
+ # Returns all the JSON keys this model knows about
45
+ def self.acceptable_attributes
46
+ acceptable_attribute_map.values
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :'access_token' => :'String',
53
+ :'token_type' => :'String',
54
+ :'expires_in' => :'Integer',
55
+ :'role' => :'String',
56
+ :'tenant_key' => :'String'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ ])
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `KeyNetra::AdminLoginResponse` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ acceptable_attribute_map = self.class.acceptable_attribute_map
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!acceptable_attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `KeyNetra::AdminLoginResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'access_token')
83
+ self.access_token = attributes[:'access_token']
84
+ else
85
+ self.access_token = nil
86
+ end
87
+
88
+ if attributes.key?(:'token_type')
89
+ self.token_type = attributes[:'token_type']
90
+ else
91
+ self.token_type = 'bearer'
92
+ end
93
+
94
+ if attributes.key?(:'expires_in')
95
+ self.expires_in = attributes[:'expires_in']
96
+ else
97
+ self.expires_in = nil
98
+ end
99
+
100
+ if attributes.key?(:'role')
101
+ self.role = attributes[:'role']
102
+ else
103
+ self.role = 'admin'
104
+ end
105
+
106
+ if attributes.key?(:'tenant_key')
107
+ self.tenant_key = attributes[:'tenant_key']
108
+ else
109
+ self.tenant_key = nil
110
+ end
111
+ end
112
+
113
+ # Show invalid properties with the reasons. Usually used together with valid?
114
+ # @return Array for valid properties with the reasons
115
+ def list_invalid_properties
116
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
117
+ invalid_properties = Array.new
118
+ if @access_token.nil?
119
+ invalid_properties.push('invalid value for "access_token", access_token cannot be nil.')
120
+ end
121
+
122
+ if @expires_in.nil?
123
+ invalid_properties.push('invalid value for "expires_in", expires_in cannot be nil.')
124
+ end
125
+
126
+ if @tenant_key.nil?
127
+ invalid_properties.push('invalid value for "tenant_key", tenant_key cannot be nil.')
128
+ end
129
+
130
+ invalid_properties
131
+ end
132
+
133
+ # Check to see if the all the properties in the model are valid
134
+ # @return true if the model is valid
135
+ def valid?
136
+ warn '[DEPRECATED] the `valid?` method is obsolete'
137
+ return false if @access_token.nil?
138
+ return false if @expires_in.nil?
139
+ return false if @tenant_key.nil?
140
+ true
141
+ end
142
+
143
+ # Custom attribute writer method with validation
144
+ # @param [Object] access_token Value to be assigned
145
+ def access_token=(access_token)
146
+ if access_token.nil?
147
+ fail ArgumentError, 'access_token cannot be nil'
148
+ end
149
+
150
+ @access_token = access_token
151
+ end
152
+
153
+ # Custom attribute writer method with validation
154
+ # @param [Object] expires_in Value to be assigned
155
+ def expires_in=(expires_in)
156
+ if expires_in.nil?
157
+ fail ArgumentError, 'expires_in cannot be nil'
158
+ end
159
+
160
+ @expires_in = expires_in
161
+ end
162
+
163
+ # Custom attribute writer method with validation
164
+ # @param [Object] tenant_key Value to be assigned
165
+ def tenant_key=(tenant_key)
166
+ if tenant_key.nil?
167
+ fail ArgumentError, 'tenant_key cannot be nil'
168
+ end
169
+
170
+ @tenant_key = tenant_key
171
+ end
172
+
173
+ # Checks equality by comparing each attribute.
174
+ # @param [Object] Object to be compared
175
+ def ==(o)
176
+ return true if self.equal?(o)
177
+ self.class == o.class &&
178
+ access_token == o.access_token &&
179
+ token_type == o.token_type &&
180
+ expires_in == o.expires_in &&
181
+ role == o.role &&
182
+ tenant_key == o.tenant_key
183
+ end
184
+
185
+ # @see the `==` method
186
+ # @param [Object] Object to be compared
187
+ def eql?(o)
188
+ self == o
189
+ end
190
+
191
+ # Calculates hash code according to all attributes.
192
+ # @return [Integer] Hash code
193
+ def hash
194
+ [access_token, token_type, expires_in, role, tenant_key].hash
195
+ end
196
+
197
+ # Builds the object from hash
198
+ # @param [Hash] attributes Model attributes in the form of hash
199
+ # @return [Object] Returns the model itself
200
+ def self.build_from_hash(attributes)
201
+ return nil unless attributes.is_a?(Hash)
202
+ attributes = attributes.transform_keys(&:to_sym)
203
+ transformed_hash = {}
204
+ openapi_types.each_pair do |key, type|
205
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
206
+ transformed_hash["#{key}"] = nil
207
+ elsif type =~ /\AArray<(.*)>/i
208
+ # check to ensure the input is an array given that the attribute
209
+ # is documented as an array but the input is not
210
+ if attributes[attribute_map[key]].is_a?(Array)
211
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
212
+ end
213
+ elsif !attributes[attribute_map[key]].nil?
214
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
215
+ end
216
+ end
217
+ new(transformed_hash)
218
+ end
219
+
220
+ # Returns the object in the form of hash
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_hash
223
+ hash = {}
224
+ self.class.attribute_map.each_pair do |attr, param|
225
+ value = self.send(attr)
226
+ if value.nil?
227
+ is_nullable = self.class.openapi_nullable.include?(attr)
228
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
229
+ end
230
+
231
+ hash[param] = _to_hash(value)
232
+ end
233
+ hash
234
+ end
235
+
236
+ end
237
+
238
+ end
@@ -0,0 +1,454 @@
1
+ =begin
2
+ #KeyNetra
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 0.1.1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.21.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module KeyNetra
17
+ class AuditRecordOut < ApiModelBase
18
+ attr_accessor :id
19
+
20
+ attr_accessor :principal_type
21
+
22
+ attr_accessor :principal_id
23
+
24
+ attr_accessor :correlation_id
25
+
26
+ attr_accessor :user
27
+
28
+ attr_accessor :action
29
+
30
+ attr_accessor :resource
31
+
32
+ attr_accessor :decision
33
+
34
+ attr_accessor :matched_policies
35
+
36
+ attr_accessor :reason
37
+
38
+ attr_accessor :evaluated_rules
39
+
40
+ attr_accessor :failed_conditions
41
+
42
+ attr_accessor :created_at
43
+
44
+ # Attribute mapping from ruby-style variable name to JSON key.
45
+ def self.attribute_map
46
+ {
47
+ :'id' => :'id',
48
+ :'principal_type' => :'principal_type',
49
+ :'principal_id' => :'principal_id',
50
+ :'correlation_id' => :'correlation_id',
51
+ :'user' => :'user',
52
+ :'action' => :'action',
53
+ :'resource' => :'resource',
54
+ :'decision' => :'decision',
55
+ :'matched_policies' => :'matched_policies',
56
+ :'reason' => :'reason',
57
+ :'evaluated_rules' => :'evaluated_rules',
58
+ :'failed_conditions' => :'failed_conditions',
59
+ :'created_at' => :'created_at'
60
+ }
61
+ end
62
+
63
+ # Returns attribute mapping this model knows about
64
+ def self.acceptable_attribute_map
65
+ attribute_map
66
+ end
67
+
68
+ # Returns all the JSON keys this model knows about
69
+ def self.acceptable_attributes
70
+ acceptable_attribute_map.values
71
+ end
72
+
73
+ # Attribute type mapping.
74
+ def self.openapi_types
75
+ {
76
+ :'id' => :'Integer',
77
+ :'principal_type' => :'String',
78
+ :'principal_id' => :'String',
79
+ :'correlation_id' => :'String',
80
+ :'user' => :'Hash<String, Object>',
81
+ :'action' => :'String',
82
+ :'resource' => :'Hash<String, Object>',
83
+ :'decision' => :'String',
84
+ :'matched_policies' => :'Array<Object>',
85
+ :'reason' => :'String',
86
+ :'evaluated_rules' => :'Array<Object>',
87
+ :'failed_conditions' => :'Array<Object>',
88
+ :'created_at' => :'Time'
89
+ }
90
+ end
91
+
92
+ # List of attributes with nullable: true
93
+ def self.openapi_nullable
94
+ Set.new([
95
+ :'correlation_id',
96
+ :'reason',
97
+ ])
98
+ end
99
+
100
+ # Initializes the object
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ def initialize(attributes = {})
103
+ if (!attributes.is_a?(Hash))
104
+ fail ArgumentError, "The input argument (attributes) must be a hash in `KeyNetra::AuditRecordOut` initialize method"
105
+ end
106
+
107
+ # check to see if the attribute exists and convert string to symbol for hash key
108
+ acceptable_attribute_map = self.class.acceptable_attribute_map
109
+ attributes = attributes.each_with_object({}) { |(k, v), h|
110
+ if (!acceptable_attribute_map.key?(k.to_sym))
111
+ fail ArgumentError, "`#{k}` is not a valid attribute in `KeyNetra::AuditRecordOut`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
112
+ end
113
+ h[k.to_sym] = v
114
+ }
115
+
116
+ if attributes.key?(:'id')
117
+ self.id = attributes[:'id']
118
+ else
119
+ self.id = nil
120
+ end
121
+
122
+ if attributes.key?(:'principal_type')
123
+ self.principal_type = attributes[:'principal_type']
124
+ else
125
+ self.principal_type = nil
126
+ end
127
+
128
+ if attributes.key?(:'principal_id')
129
+ self.principal_id = attributes[:'principal_id']
130
+ else
131
+ self.principal_id = nil
132
+ end
133
+
134
+ if attributes.key?(:'correlation_id')
135
+ self.correlation_id = attributes[:'correlation_id']
136
+ end
137
+
138
+ if attributes.key?(:'user')
139
+ if (value = attributes[:'user']).is_a?(Hash)
140
+ self.user = value
141
+ end
142
+ else
143
+ self.user = nil
144
+ end
145
+
146
+ if attributes.key?(:'action')
147
+ self.action = attributes[:'action']
148
+ else
149
+ self.action = nil
150
+ end
151
+
152
+ if attributes.key?(:'resource')
153
+ if (value = attributes[:'resource']).is_a?(Hash)
154
+ self.resource = value
155
+ end
156
+ else
157
+ self.resource = nil
158
+ end
159
+
160
+ if attributes.key?(:'decision')
161
+ self.decision = attributes[:'decision']
162
+ else
163
+ self.decision = nil
164
+ end
165
+
166
+ if attributes.key?(:'matched_policies')
167
+ if (value = attributes[:'matched_policies']).is_a?(Array)
168
+ self.matched_policies = value
169
+ end
170
+ else
171
+ self.matched_policies = nil
172
+ end
173
+
174
+ if attributes.key?(:'reason')
175
+ self.reason = attributes[:'reason']
176
+ end
177
+
178
+ if attributes.key?(:'evaluated_rules')
179
+ if (value = attributes[:'evaluated_rules']).is_a?(Array)
180
+ self.evaluated_rules = value
181
+ end
182
+ else
183
+ self.evaluated_rules = nil
184
+ end
185
+
186
+ if attributes.key?(:'failed_conditions')
187
+ if (value = attributes[:'failed_conditions']).is_a?(Array)
188
+ self.failed_conditions = value
189
+ end
190
+ else
191
+ self.failed_conditions = nil
192
+ end
193
+
194
+ if attributes.key?(:'created_at')
195
+ self.created_at = attributes[:'created_at']
196
+ else
197
+ self.created_at = nil
198
+ end
199
+ end
200
+
201
+ # Show invalid properties with the reasons. Usually used together with valid?
202
+ # @return Array for valid properties with the reasons
203
+ def list_invalid_properties
204
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
205
+ invalid_properties = Array.new
206
+ if @id.nil?
207
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
208
+ end
209
+
210
+ if @principal_type.nil?
211
+ invalid_properties.push('invalid value for "principal_type", principal_type cannot be nil.')
212
+ end
213
+
214
+ if @principal_id.nil?
215
+ invalid_properties.push('invalid value for "principal_id", principal_id cannot be nil.')
216
+ end
217
+
218
+ if @user.nil?
219
+ invalid_properties.push('invalid value for "user", user cannot be nil.')
220
+ end
221
+
222
+ if @action.nil?
223
+ invalid_properties.push('invalid value for "action", action cannot be nil.')
224
+ end
225
+
226
+ if @resource.nil?
227
+ invalid_properties.push('invalid value for "resource", resource cannot be nil.')
228
+ end
229
+
230
+ if @decision.nil?
231
+ invalid_properties.push('invalid value for "decision", decision cannot be nil.')
232
+ end
233
+
234
+ if @matched_policies.nil?
235
+ invalid_properties.push('invalid value for "matched_policies", matched_policies cannot be nil.')
236
+ end
237
+
238
+ if @evaluated_rules.nil?
239
+ invalid_properties.push('invalid value for "evaluated_rules", evaluated_rules cannot be nil.')
240
+ end
241
+
242
+ if @failed_conditions.nil?
243
+ invalid_properties.push('invalid value for "failed_conditions", failed_conditions cannot be nil.')
244
+ end
245
+
246
+ if @created_at.nil?
247
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
248
+ end
249
+
250
+ invalid_properties
251
+ end
252
+
253
+ # Check to see if the all the properties in the model are valid
254
+ # @return true if the model is valid
255
+ def valid?
256
+ warn '[DEPRECATED] the `valid?` method is obsolete'
257
+ return false if @id.nil?
258
+ return false if @principal_type.nil?
259
+ return false if @principal_id.nil?
260
+ return false if @user.nil?
261
+ return false if @action.nil?
262
+ return false if @resource.nil?
263
+ return false if @decision.nil?
264
+ return false if @matched_policies.nil?
265
+ return false if @evaluated_rules.nil?
266
+ return false if @failed_conditions.nil?
267
+ return false if @created_at.nil?
268
+ true
269
+ end
270
+
271
+ # Custom attribute writer method with validation
272
+ # @param [Object] id Value to be assigned
273
+ def id=(id)
274
+ if id.nil?
275
+ fail ArgumentError, 'id cannot be nil'
276
+ end
277
+
278
+ @id = id
279
+ end
280
+
281
+ # Custom attribute writer method with validation
282
+ # @param [Object] principal_type Value to be assigned
283
+ def principal_type=(principal_type)
284
+ if principal_type.nil?
285
+ fail ArgumentError, 'principal_type cannot be nil'
286
+ end
287
+
288
+ @principal_type = principal_type
289
+ end
290
+
291
+ # Custom attribute writer method with validation
292
+ # @param [Object] principal_id Value to be assigned
293
+ def principal_id=(principal_id)
294
+ if principal_id.nil?
295
+ fail ArgumentError, 'principal_id cannot be nil'
296
+ end
297
+
298
+ @principal_id = principal_id
299
+ end
300
+
301
+ # Custom attribute writer method with validation
302
+ # @param [Object] user Value to be assigned
303
+ def user=(user)
304
+ if user.nil?
305
+ fail ArgumentError, 'user cannot be nil'
306
+ end
307
+
308
+ @user = user
309
+ end
310
+
311
+ # Custom attribute writer method with validation
312
+ # @param [Object] action Value to be assigned
313
+ def action=(action)
314
+ if action.nil?
315
+ fail ArgumentError, 'action cannot be nil'
316
+ end
317
+
318
+ @action = action
319
+ end
320
+
321
+ # Custom attribute writer method with validation
322
+ # @param [Object] resource Value to be assigned
323
+ def resource=(resource)
324
+ if resource.nil?
325
+ fail ArgumentError, 'resource cannot be nil'
326
+ end
327
+
328
+ @resource = resource
329
+ end
330
+
331
+ # Custom attribute writer method with validation
332
+ # @param [Object] decision Value to be assigned
333
+ def decision=(decision)
334
+ if decision.nil?
335
+ fail ArgumentError, 'decision cannot be nil'
336
+ end
337
+
338
+ @decision = decision
339
+ end
340
+
341
+ # Custom attribute writer method with validation
342
+ # @param [Object] matched_policies Value to be assigned
343
+ def matched_policies=(matched_policies)
344
+ if matched_policies.nil?
345
+ fail ArgumentError, 'matched_policies cannot be nil'
346
+ end
347
+
348
+ @matched_policies = matched_policies
349
+ end
350
+
351
+ # Custom attribute writer method with validation
352
+ # @param [Object] evaluated_rules Value to be assigned
353
+ def evaluated_rules=(evaluated_rules)
354
+ if evaluated_rules.nil?
355
+ fail ArgumentError, 'evaluated_rules cannot be nil'
356
+ end
357
+
358
+ @evaluated_rules = evaluated_rules
359
+ end
360
+
361
+ # Custom attribute writer method with validation
362
+ # @param [Object] failed_conditions Value to be assigned
363
+ def failed_conditions=(failed_conditions)
364
+ if failed_conditions.nil?
365
+ fail ArgumentError, 'failed_conditions cannot be nil'
366
+ end
367
+
368
+ @failed_conditions = failed_conditions
369
+ end
370
+
371
+ # Custom attribute writer method with validation
372
+ # @param [Object] created_at Value to be assigned
373
+ def created_at=(created_at)
374
+ if created_at.nil?
375
+ fail ArgumentError, 'created_at cannot be nil'
376
+ end
377
+
378
+ @created_at = created_at
379
+ end
380
+
381
+ # Checks equality by comparing each attribute.
382
+ # @param [Object] Object to be compared
383
+ def ==(o)
384
+ return true if self.equal?(o)
385
+ self.class == o.class &&
386
+ id == o.id &&
387
+ principal_type == o.principal_type &&
388
+ principal_id == o.principal_id &&
389
+ correlation_id == o.correlation_id &&
390
+ user == o.user &&
391
+ action == o.action &&
392
+ resource == o.resource &&
393
+ decision == o.decision &&
394
+ matched_policies == o.matched_policies &&
395
+ reason == o.reason &&
396
+ evaluated_rules == o.evaluated_rules &&
397
+ failed_conditions == o.failed_conditions &&
398
+ created_at == o.created_at
399
+ end
400
+
401
+ # @see the `==` method
402
+ # @param [Object] Object to be compared
403
+ def eql?(o)
404
+ self == o
405
+ end
406
+
407
+ # Calculates hash code according to all attributes.
408
+ # @return [Integer] Hash code
409
+ def hash
410
+ [id, principal_type, principal_id, correlation_id, user, action, resource, decision, matched_policies, reason, evaluated_rules, failed_conditions, created_at].hash
411
+ end
412
+
413
+ # Builds the object from hash
414
+ # @param [Hash] attributes Model attributes in the form of hash
415
+ # @return [Object] Returns the model itself
416
+ def self.build_from_hash(attributes)
417
+ return nil unless attributes.is_a?(Hash)
418
+ attributes = attributes.transform_keys(&:to_sym)
419
+ transformed_hash = {}
420
+ openapi_types.each_pair do |key, type|
421
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
422
+ transformed_hash["#{key}"] = nil
423
+ elsif type =~ /\AArray<(.*)>/i
424
+ # check to ensure the input is an array given that the attribute
425
+ # is documented as an array but the input is not
426
+ if attributes[attribute_map[key]].is_a?(Array)
427
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
428
+ end
429
+ elsif !attributes[attribute_map[key]].nil?
430
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
431
+ end
432
+ end
433
+ new(transformed_hash)
434
+ end
435
+
436
+ # Returns the object in the form of hash
437
+ # @return [Hash] Returns the object in the form of hash
438
+ def to_hash
439
+ hash = {}
440
+ self.class.attribute_map.each_pair do |attr, param|
441
+ value = self.send(attr)
442
+ if value.nil?
443
+ is_nullable = self.class.openapi_nullable.include?(attr)
444
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
445
+ end
446
+
447
+ hash[param] = _to_hash(value)
448
+ end
449
+ hash
450
+ end
451
+
452
+ end
453
+
454
+ end