ory-keto-client 0.5.4.alpha1 → 0.6.0.alpha6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +22 -31
  4. data/docs/AddOryAccessControlPolicyRoleMembersBody.md +8 -7
  5. data/docs/AuthorizationResult.md +8 -7
  6. data/docs/EnginesApi.md +319 -129
  7. data/docs/ExpandTree.md +22 -0
  8. data/docs/GetCheckResponse.md +18 -0
  9. data/docs/GetRelationTuplesResponse.md +20 -0
  10. data/docs/HealthApi.md +50 -15
  11. data/docs/HealthNotReadyStatus.md +8 -7
  12. data/docs/HealthStatus.md +8 -7
  13. data/docs/InlineResponse400.md +28 -0
  14. data/docs/InlineResponse500.md +18 -17
  15. data/docs/InternalRelationTuple.md +24 -0
  16. data/docs/OryAccessControlPolicy.md +20 -19
  17. data/docs/OryAccessControlPolicyAllowedInput.md +14 -13
  18. data/docs/OryAccessControlPolicyRole.md +10 -9
  19. data/docs/PatchDelta.md +20 -0
  20. data/docs/ReadApi.md +297 -0
  21. data/docs/Version.md +8 -7
  22. data/docs/VersionApi.md +26 -9
  23. data/docs/WriteApi.md +212 -0
  24. data/lib/ory-keto-client.rb +10 -9
  25. data/lib/ory-keto-client/api/engines_api.rb +46 -35
  26. data/lib/ory-keto-client/api/health_api.rb +10 -8
  27. data/lib/ory-keto-client/api/read_api.rb +324 -0
  28. data/lib/ory-keto-client/api/version_api.rb +6 -5
  29. data/lib/ory-keto-client/api/write_api.rb +225 -0
  30. data/lib/ory-keto-client/api_client.rb +51 -47
  31. data/lib/ory-keto-client/api_error.rb +2 -2
  32. data/lib/ory-keto-client/configuration.rb +40 -11
  33. data/lib/ory-keto-client/models/add_ory_access_control_policy_role_members_body.rb +20 -8
  34. data/lib/ory-keto-client/models/authorization_result.rb +20 -8
  35. data/lib/ory-keto-client/models/expand_tree.rb +282 -0
  36. data/lib/ory-keto-client/models/get_check_response.rb +225 -0
  37. data/lib/ory-keto-client/models/get_relation_tuples_response.rb +230 -0
  38. data/lib/ory-keto-client/models/health_not_ready_status.rb +20 -8
  39. data/lib/ory-keto-client/models/health_status.rb +20 -8
  40. data/lib/ory-keto-client/models/inline_response400.rb +265 -0
  41. data/lib/ory-keto-client/models/inline_response500.rb +21 -9
  42. data/lib/ory-keto-client/models/internal_relation_tuple.rb +268 -0
  43. data/lib/ory-keto-client/models/ory_access_control_policy.rb +22 -12
  44. data/lib/ory-keto-client/models/ory_access_control_policy_allowed_input.rb +22 -12
  45. data/lib/ory-keto-client/models/ory_access_control_policy_role.rb +20 -8
  46. data/lib/ory-keto-client/models/patch_delta.rb +227 -0
  47. data/lib/ory-keto-client/models/version.rb +20 -8
  48. data/lib/ory-keto-client/version.rb +3 -3
  49. data/ory-keto-client.gemspec +4 -5
  50. data/spec/api/read_api_spec.rb +94 -0
  51. data/spec/api/write_api_spec.rb +74 -0
  52. data/spec/api_client_spec.rb +4 -4
  53. data/spec/configuration_spec.rb +3 -3
  54. data/spec/models/expand_tree_spec.rb +50 -0
  55. data/spec/models/get_check_response_spec.rb +34 -0
  56. data/spec/models/get_relation_tuples_response_spec.rb +40 -0
  57. data/spec/models/inline_response400_spec.rb +64 -0
  58. data/spec/models/internal_relation_tuple_spec.rb +52 -0
  59. data/spec/models/patch_delta_spec.rb +40 -0
  60. data/spec/spec_helper.rb +3 -3
  61. metadata +92 -80
@@ -0,0 +1,268 @@
1
+ =begin
2
+ #ORY Keto
3
+
4
+ #Ory Keto is a cloud native access control server providing best-practice patterns (RBAC, ABAC, ACL, AWS IAM Policies, Kubernetes Roles, ...) via REST APIs.
5
+
6
+ The version of the OpenAPI document: v0.6.0-alpha.6
7
+ Contact: hi@ory.sh
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.1.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module OryHydraClient
17
+ class InternalRelationTuple
18
+ # Namespace of the Relation Tuple in: query
19
+ attr_accessor :namespace
20
+
21
+ # Object of the Relation Tuple in: query
22
+ attr_accessor :object
23
+
24
+ # Relation of the Relation Tuple in: query
25
+ attr_accessor :relation
26
+
27
+ attr_accessor :subject
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'namespace' => :'namespace',
33
+ :'object' => :'object',
34
+ :'relation' => :'relation',
35
+ :'subject' => :'subject'
36
+ }
37
+ end
38
+
39
+ # Returns all the JSON keys this model knows about
40
+ def self.acceptable_attributes
41
+ attribute_map.values
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.openapi_types
46
+ {
47
+ :'namespace' => :'String',
48
+ :'object' => :'String',
49
+ :'relation' => :'String',
50
+ :'subject' => :'String'
51
+ }
52
+ end
53
+
54
+ # List of attributes with nullable: true
55
+ def self.openapi_nullable
56
+ Set.new([
57
+ ])
58
+ end
59
+
60
+ # Initializes the object
61
+ # @param [Hash] attributes Model attributes in the form of hash
62
+ def initialize(attributes = {})
63
+ if (!attributes.is_a?(Hash))
64
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OryHydraClient::InternalRelationTuple` initialize method"
65
+ end
66
+
67
+ # check to see if the attribute exists and convert string to symbol for hash key
68
+ attributes = attributes.each_with_object({}) { |(k, v), h|
69
+ if (!self.class.attribute_map.key?(k.to_sym))
70
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OryHydraClient::InternalRelationTuple`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
71
+ end
72
+ h[k.to_sym] = v
73
+ }
74
+
75
+ if attributes.key?(:'namespace')
76
+ self.namespace = attributes[:'namespace']
77
+ end
78
+
79
+ if attributes.key?(:'object')
80
+ self.object = attributes[:'object']
81
+ end
82
+
83
+ if attributes.key?(:'relation')
84
+ self.relation = attributes[:'relation']
85
+ end
86
+
87
+ if attributes.key?(:'subject')
88
+ self.subject = attributes[:'subject']
89
+ end
90
+ end
91
+
92
+ # Show invalid properties with the reasons. Usually used together with valid?
93
+ # @return Array for valid properties with the reasons
94
+ def list_invalid_properties
95
+ invalid_properties = Array.new
96
+ if @namespace.nil?
97
+ invalid_properties.push('invalid value for "namespace", namespace cannot be nil.')
98
+ end
99
+
100
+ if @object.nil?
101
+ invalid_properties.push('invalid value for "object", object cannot be nil.')
102
+ end
103
+
104
+ if @relation.nil?
105
+ invalid_properties.push('invalid value for "relation", relation cannot be nil.')
106
+ end
107
+
108
+ if @subject.nil?
109
+ invalid_properties.push('invalid value for "subject", subject cannot be nil.')
110
+ end
111
+
112
+ invalid_properties
113
+ end
114
+
115
+ # Check to see if the all the properties in the model are valid
116
+ # @return true if the model is valid
117
+ def valid?
118
+ return false if @namespace.nil?
119
+ return false if @object.nil?
120
+ return false if @relation.nil?
121
+ return false if @subject.nil?
122
+ true
123
+ end
124
+
125
+ # Checks equality by comparing each attribute.
126
+ # @param [Object] Object to be compared
127
+ def ==(o)
128
+ return true if self.equal?(o)
129
+ self.class == o.class &&
130
+ namespace == o.namespace &&
131
+ object == o.object &&
132
+ relation == o.relation &&
133
+ subject == o.subject
134
+ end
135
+
136
+ # @see the `==` method
137
+ # @param [Object] Object to be compared
138
+ def eql?(o)
139
+ self == o
140
+ end
141
+
142
+ # Calculates hash code according to all attributes.
143
+ # @return [Integer] Hash code
144
+ def hash
145
+ [namespace, object, relation, subject].hash
146
+ end
147
+
148
+ # Builds the object from hash
149
+ # @param [Hash] attributes Model attributes in the form of hash
150
+ # @return [Object] Returns the model itself
151
+ def self.build_from_hash(attributes)
152
+ new.build_from_hash(attributes)
153
+ end
154
+
155
+ # Builds the object from hash
156
+ # @param [Hash] attributes Model attributes in the form of hash
157
+ # @return [Object] Returns the model itself
158
+ def build_from_hash(attributes)
159
+ return nil unless attributes.is_a?(Hash)
160
+ self.class.openapi_types.each_pair do |key, type|
161
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
162
+ self.send("#{key}=", nil)
163
+ elsif type =~ /\AArray<(.*)>/i
164
+ # check to ensure the input is an array given that the attribute
165
+ # is documented as an array but the input is not
166
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
167
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
168
+ end
169
+ elsif !attributes[self.class.attribute_map[key]].nil?
170
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
171
+ end
172
+ end
173
+
174
+ self
175
+ end
176
+
177
+ # Deserializes the data based on type
178
+ # @param string type Data type
179
+ # @param string value Value to be deserialized
180
+ # @return [Object] Deserialized data
181
+ def _deserialize(type, value)
182
+ case type.to_sym
183
+ when :Time
184
+ Time.parse(value)
185
+ when :Date
186
+ Date.parse(value)
187
+ when :String
188
+ value.to_s
189
+ when :Integer
190
+ value.to_i
191
+ when :Float
192
+ value.to_f
193
+ when :Boolean
194
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
195
+ true
196
+ else
197
+ false
198
+ end
199
+ when :Object
200
+ # generic object (usually a Hash), return directly
201
+ value
202
+ when /\AArray<(?<inner_type>.+)>\z/
203
+ inner_type = Regexp.last_match[:inner_type]
204
+ value.map { |v| _deserialize(inner_type, v) }
205
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
206
+ k_type = Regexp.last_match[:k_type]
207
+ v_type = Regexp.last_match[:v_type]
208
+ {}.tap do |hash|
209
+ value.each do |k, v|
210
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
211
+ end
212
+ end
213
+ else # model
214
+ # models (e.g. Pet) or oneOf
215
+ klass = OryHydraClient.const_get(type)
216
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
217
+ end
218
+ end
219
+
220
+ # Returns the string representation of the object
221
+ # @return [String] String presentation of the object
222
+ def to_s
223
+ to_hash.to_s
224
+ end
225
+
226
+ # to_body is an alias to to_hash (backward compatibility)
227
+ # @return [Hash] Returns the object in the form of hash
228
+ def to_body
229
+ to_hash
230
+ end
231
+
232
+ # Returns the object in the form of hash
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_hash
235
+ hash = {}
236
+ self.class.attribute_map.each_pair do |attr, param|
237
+ value = self.send(attr)
238
+ if value.nil?
239
+ is_nullable = self.class.openapi_nullable.include?(attr)
240
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
241
+ end
242
+
243
+ hash[param] = _to_hash(value)
244
+ end
245
+ hash
246
+ end
247
+
248
+ # Outputs non-array value in the form of hash
249
+ # For object, use to_hash. Otherwise, just return the value
250
+ # @param [Object] value Any valid value
251
+ # @return [Hash] Returns the value in the form of hash
252
+ def _to_hash(value)
253
+ if value.is_a?(Array)
254
+ value.compact.map { |v| _to_hash(v) }
255
+ elsif value.is_a?(Hash)
256
+ {}.tap do |hash|
257
+ value.each { |k, v| hash[k] = _to_hash(v) }
258
+ end
259
+ elsif value.respond_to? :to_hash
260
+ value.to_hash
261
+ else
262
+ value
263
+ end
264
+ end
265
+
266
+ end
267
+
268
+ end
@@ -3,14 +3,15 @@
3
3
 
4
4
  #Ory Keto is a cloud native access control server providing best-practice patterns (RBAC, ABAC, ACL, AWS IAM Policies, Kubernetes Roles, ...) via REST APIs.
5
5
 
6
- The version of the OpenAPI document: Latest
6
+ The version of the OpenAPI document: v0.0.0-alpha.58
7
7
  Contact: hi@ory.sh
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.3
9
+ OpenAPI Generator version: 5.0.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module OryHydraClient
16
17
  class OryAccessControlPolicy
@@ -48,11 +49,16 @@ module OryHydraClient
48
49
  }
49
50
  end
50
51
 
52
+ # Returns all the JSON keys this model knows about
53
+ def self.acceptable_attributes
54
+ attribute_map.values
55
+ end
56
+
51
57
  # Attribute type mapping.
52
58
  def self.openapi_types
53
59
  {
54
60
  :'actions' => :'Array<String>',
55
- :'conditions' => :'Hash<String, Object>',
61
+ :'conditions' => :'Object',
56
62
  :'description' => :'String',
57
63
  :'effect' => :'String',
58
64
  :'id' => :'String',
@@ -89,9 +95,7 @@ module OryHydraClient
89
95
  end
90
96
 
91
97
  if attributes.key?(:'conditions')
92
- if (value = attributes[:'conditions']).is_a?(Hash)
93
- self.conditions = value
94
- end
98
+ self.conditions = attributes[:'conditions']
95
99
  end
96
100
 
97
101
  if attributes.key?(:'description')
@@ -171,7 +175,9 @@ module OryHydraClient
171
175
  def build_from_hash(attributes)
172
176
  return nil unless attributes.is_a?(Hash)
173
177
  self.class.openapi_types.each_pair do |key, type|
174
- if type =~ /\AArray<(.*)>/i
178
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
179
+ self.send("#{key}=", nil)
180
+ elsif type =~ /\AArray<(.*)>/i
175
181
  # check to ensure the input is an array given that the attribute
176
182
  # is documented as an array but the input is not
177
183
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -179,7 +185,7 @@ module OryHydraClient
179
185
  end
180
186
  elsif !attributes[self.class.attribute_map[key]].nil?
181
187
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
182
- end # or else data not found in attributes(hash), not an issue as the data can be optional
188
+ end
183
189
  end
184
190
 
185
191
  self
@@ -191,8 +197,8 @@ module OryHydraClient
191
197
  # @return [Object] Deserialized data
192
198
  def _deserialize(type, value)
193
199
  case type.to_sym
194
- when :DateTime
195
- DateTime.parse(value)
200
+ when :Time
201
+ Time.parse(value)
196
202
  when :Date
197
203
  Date.parse(value)
198
204
  when :String
@@ -222,7 +228,9 @@ module OryHydraClient
222
228
  end
223
229
  end
224
230
  else # model
225
- OryHydraClient.const_get(type).build_from_hash(value)
231
+ # models (e.g. Pet) or oneOf
232
+ klass = OryHydraClient.const_get(type)
233
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
226
234
  end
227
235
  end
228
236
 
@@ -248,7 +256,7 @@ module OryHydraClient
248
256
  is_nullable = self.class.openapi_nullable.include?(attr)
249
257
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
250
258
  end
251
-
259
+
252
260
  hash[param] = _to_hash(value)
253
261
  end
254
262
  hash
@@ -271,5 +279,7 @@ module OryHydraClient
271
279
  value
272
280
  end
273
281
  end
282
+
274
283
  end
284
+
275
285
  end
@@ -3,14 +3,15 @@
3
3
 
4
4
  #Ory Keto is a cloud native access control server providing best-practice patterns (RBAC, ABAC, ACL, AWS IAM Policies, Kubernetes Roles, ...) via REST APIs.
5
5
 
6
- The version of the OpenAPI document: Latest
6
+ The version of the OpenAPI document: v0.0.0-alpha.58
7
7
  Contact: hi@ory.sh
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.3
9
+ OpenAPI Generator version: 5.0.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module OryHydraClient
16
17
  class OryAccessControlPolicyAllowedInput
@@ -36,11 +37,16 @@ module OryHydraClient
36
37
  }
37
38
  end
38
39
 
40
+ # Returns all the JSON keys this model knows about
41
+ def self.acceptable_attributes
42
+ attribute_map.values
43
+ end
44
+
39
45
  # Attribute type mapping.
40
46
  def self.openapi_types
41
47
  {
42
48
  :'action' => :'String',
43
- :'context' => :'Hash<String, Object>',
49
+ :'context' => :'Object',
44
50
  :'resource' => :'String',
45
51
  :'subject' => :'String'
46
52
  }
@@ -72,9 +78,7 @@ module OryHydraClient
72
78
  end
73
79
 
74
80
  if attributes.key?(:'context')
75
- if (value = attributes[:'context']).is_a?(Hash)
76
- self.context = value
77
- end
81
+ self.context = attributes[:'context']
78
82
  end
79
83
 
80
84
  if attributes.key?(:'resource')
@@ -135,7 +139,9 @@ module OryHydraClient
135
139
  def build_from_hash(attributes)
136
140
  return nil unless attributes.is_a?(Hash)
137
141
  self.class.openapi_types.each_pair do |key, type|
138
- if type =~ /\AArray<(.*)>/i
142
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
143
+ self.send("#{key}=", nil)
144
+ elsif type =~ /\AArray<(.*)>/i
139
145
  # check to ensure the input is an array given that the attribute
140
146
  # is documented as an array but the input is not
141
147
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -143,7 +149,7 @@ module OryHydraClient
143
149
  end
144
150
  elsif !attributes[self.class.attribute_map[key]].nil?
145
151
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
146
- end # or else data not found in attributes(hash), not an issue as the data can be optional
152
+ end
147
153
  end
148
154
 
149
155
  self
@@ -155,8 +161,8 @@ module OryHydraClient
155
161
  # @return [Object] Deserialized data
156
162
  def _deserialize(type, value)
157
163
  case type.to_sym
158
- when :DateTime
159
- DateTime.parse(value)
164
+ when :Time
165
+ Time.parse(value)
160
166
  when :Date
161
167
  Date.parse(value)
162
168
  when :String
@@ -186,7 +192,9 @@ module OryHydraClient
186
192
  end
187
193
  end
188
194
  else # model
189
- OryHydraClient.const_get(type).build_from_hash(value)
195
+ # models (e.g. Pet) or oneOf
196
+ klass = OryHydraClient.const_get(type)
197
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
190
198
  end
191
199
  end
192
200
 
@@ -212,7 +220,7 @@ module OryHydraClient
212
220
  is_nullable = self.class.openapi_nullable.include?(attr)
213
221
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
214
222
  end
215
-
223
+
216
224
  hash[param] = _to_hash(value)
217
225
  end
218
226
  hash
@@ -235,5 +243,7 @@ module OryHydraClient
235
243
  value
236
244
  end
237
245
  end
246
+
238
247
  end
248
+
239
249
  end