ory-keto-client 0.4.1.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (221) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +129 -0
  4. data/Rakefile +10 -0
  5. data/docs/AddOryAccessControlPolicyRoleMembers.md +21 -0
  6. data/docs/AddOryAccessControlPolicyRoleMembersBody.md +17 -0
  7. data/docs/AddOryAccessControlPolicyRoleMembersInternalServerError.md +17 -0
  8. data/docs/AddOryAccessControlPolicyRoleMembersInternalServerErrorBody.md +27 -0
  9. data/docs/AddOryAccessControlPolicyRoleMembersOK.md +17 -0
  10. data/docs/AuthorizationResult.md +17 -0
  11. data/docs/DeleteOryAccessControlPolicy.md +19 -0
  12. data/docs/DeleteOryAccessControlPolicyInternalServerError.md +17 -0
  13. data/docs/DeleteOryAccessControlPolicyInternalServerErrorBody.md +27 -0
  14. data/docs/DeleteOryAccessControlPolicyRole.md +19 -0
  15. data/docs/DeleteOryAccessControlPolicyRoleInternalServerError.md +17 -0
  16. data/docs/DeleteOryAccessControlPolicyRoleInternalServerErrorBody.md +27 -0
  17. data/docs/DoOryAccessControlPoliciesAllow.md +19 -0
  18. data/docs/DoOryAccessControlPoliciesAllowForbidden.md +17 -0
  19. data/docs/DoOryAccessControlPoliciesAllowInternalServerError.md +17 -0
  20. data/docs/DoOryAccessControlPoliciesAllowInternalServerErrorBody.md +27 -0
  21. data/docs/DoOryAccessControlPoliciesAllowOK.md +17 -0
  22. data/docs/EnginesApi.md +579 -0
  23. data/docs/GetOryAccessControlPolicy.md +19 -0
  24. data/docs/GetOryAccessControlPolicyInternalServerError.md +17 -0
  25. data/docs/GetOryAccessControlPolicyInternalServerErrorBody.md +27 -0
  26. data/docs/GetOryAccessControlPolicyNotFound.md +17 -0
  27. data/docs/GetOryAccessControlPolicyNotFoundBody.md +27 -0
  28. data/docs/GetOryAccessControlPolicyOK.md +17 -0
  29. data/docs/GetOryAccessControlPolicyRole.md +19 -0
  30. data/docs/GetOryAccessControlPolicyRoleInternalServerError.md +17 -0
  31. data/docs/GetOryAccessControlPolicyRoleInternalServerErrorBody.md +27 -0
  32. data/docs/GetOryAccessControlPolicyRoleNotFound.md +17 -0
  33. data/docs/GetOryAccessControlPolicyRoleNotFoundBody.md +27 -0
  34. data/docs/GetOryAccessControlPolicyRoleOK.md +17 -0
  35. data/docs/HealthApi.md +96 -0
  36. data/docs/HealthNotReadyStatus.md +17 -0
  37. data/docs/HealthStatus.md +17 -0
  38. data/docs/InlineResponse500.md +27 -0
  39. data/docs/Input.md +23 -0
  40. data/docs/IsInstanceAliveInternalServerError.md +17 -0
  41. data/docs/IsInstanceAliveInternalServerErrorBody.md +27 -0
  42. data/docs/IsInstanceAliveOK.md +17 -0
  43. data/docs/ListOryAccessControlPolicies.md +21 -0
  44. data/docs/ListOryAccessControlPoliciesInternalServerError.md +17 -0
  45. data/docs/ListOryAccessControlPoliciesInternalServerErrorBody.md +27 -0
  46. data/docs/ListOryAccessControlPoliciesOK.md +17 -0
  47. data/docs/ListOryAccessControlPolicyRoles.md +21 -0
  48. data/docs/ListOryAccessControlPolicyRolesInternalServerError.md +17 -0
  49. data/docs/ListOryAccessControlPolicyRolesInternalServerErrorBody.md +27 -0
  50. data/docs/ListOryAccessControlPolicyRolesOK.md +17 -0
  51. data/docs/OryAccessControlPolicies.md +17 -0
  52. data/docs/OryAccessControlPolicy.md +29 -0
  53. data/docs/OryAccessControlPolicyAllowedInput.md +23 -0
  54. data/docs/OryAccessControlPolicyRole.md +19 -0
  55. data/docs/OryAccessControlPolicyRoles.md +17 -0
  56. data/docs/Policy.md +29 -0
  57. data/docs/RemoveOryAccessControlPolicyRoleMembers.md +21 -0
  58. data/docs/RemoveOryAccessControlPolicyRoleMembersInternalServerError.md +17 -0
  59. data/docs/RemoveOryAccessControlPolicyRoleMembersInternalServerErrorBody.md +27 -0
  60. data/docs/Role.md +19 -0
  61. data/docs/SwaggerHealthStatus.md +17 -0
  62. data/docs/SwaggerNotReadyStatus.md +17 -0
  63. data/docs/SwaggerVersion.md +17 -0
  64. data/docs/UpsertOryAccessControlPolicy.md +19 -0
  65. data/docs/UpsertOryAccessControlPolicyInternalServerError.md +17 -0
  66. data/docs/UpsertOryAccessControlPolicyInternalServerErrorBody.md +27 -0
  67. data/docs/UpsertOryAccessControlPolicyOK.md +17 -0
  68. data/docs/UpsertOryAccessControlPolicyRole.md +19 -0
  69. data/docs/UpsertOryAccessControlPolicyRoleInternalServerError.md +17 -0
  70. data/docs/UpsertOryAccessControlPolicyRoleInternalServerErrorBody.md +27 -0
  71. data/docs/UpsertOryAccessControlPolicyRoleOK.md +17 -0
  72. data/docs/Version.md +17 -0
  73. data/docs/VersionApi.md +52 -0
  74. data/lib/ory-keto-client.rb +65 -0
  75. data/lib/ory-keto-client/api/engines_api.rb +778 -0
  76. data/lib/ory-keto-client/api/health_api.rb +134 -0
  77. data/lib/ory-keto-client/api/version_api.rb +78 -0
  78. data/lib/ory-keto-client/api_client.rb +385 -0
  79. data/lib/ory-keto-client/api_error.rb +57 -0
  80. data/lib/ory-keto-client/configuration.rb +241 -0
  81. data/lib/ory-keto-client/models/add_ory_access_control_policy_role_members.rb +237 -0
  82. data/lib/ory-keto-client/models/add_ory_access_control_policy_role_members_body.rb +209 -0
  83. data/lib/ory-keto-client/models/add_ory_access_control_policy_role_members_internal_server_error.rb +207 -0
  84. data/lib/ory-keto-client/models/add_ory_access_control_policy_role_members_internal_server_error_body.rb +260 -0
  85. data/lib/ory-keto-client/models/add_ory_access_control_policy_role_members_ok.rb +207 -0
  86. data/lib/ory-keto-client/models/authorization_result.rb +212 -0
  87. data/lib/ory-keto-client/models/delete_ory_access_control_policy.rb +228 -0
  88. data/lib/ory-keto-client/models/delete_ory_access_control_policy_internal_server_error.rb +207 -0
  89. data/lib/ory-keto-client/models/delete_ory_access_control_policy_internal_server_error_body.rb +260 -0
  90. data/lib/ory-keto-client/models/delete_ory_access_control_policy_role.rb +228 -0
  91. data/lib/ory-keto-client/models/delete_ory_access_control_policy_role_internal_server_error.rb +207 -0
  92. data/lib/ory-keto-client/models/delete_ory_access_control_policy_role_internal_server_error_body.rb +260 -0
  93. data/lib/ory-keto-client/models/do_ory_access_control_policies_allow.rb +222 -0
  94. data/lib/ory-keto-client/models/do_ory_access_control_policies_allow_forbidden.rb +207 -0
  95. data/lib/ory-keto-client/models/do_ory_access_control_policies_allow_internal_server_error.rb +207 -0
  96. data/lib/ory-keto-client/models/do_ory_access_control_policies_allow_internal_server_error_body.rb +260 -0
  97. data/lib/ory-keto-client/models/do_ory_access_control_policies_allow_ok.rb +207 -0
  98. data/lib/ory-keto-client/models/get_ory_access_control_policy.rb +228 -0
  99. data/lib/ory-keto-client/models/get_ory_access_control_policy_internal_server_error.rb +207 -0
  100. data/lib/ory-keto-client/models/get_ory_access_control_policy_internal_server_error_body.rb +260 -0
  101. data/lib/ory-keto-client/models/get_ory_access_control_policy_not_found.rb +207 -0
  102. data/lib/ory-keto-client/models/get_ory_access_control_policy_not_found_body.rb +260 -0
  103. data/lib/ory-keto-client/models/get_ory_access_control_policy_ok.rb +207 -0
  104. data/lib/ory-keto-client/models/get_ory_access_control_policy_role.rb +228 -0
  105. data/lib/ory-keto-client/models/get_ory_access_control_policy_role_internal_server_error.rb +207 -0
  106. data/lib/ory-keto-client/models/get_ory_access_control_policy_role_internal_server_error_body.rb +260 -0
  107. data/lib/ory-keto-client/models/get_ory_access_control_policy_role_not_found.rb +207 -0
  108. data/lib/ory-keto-client/models/get_ory_access_control_policy_role_not_found_body.rb +260 -0
  109. data/lib/ory-keto-client/models/get_ory_access_control_policy_role_ok.rb +207 -0
  110. data/lib/ory-keto-client/models/health_not_ready_status.rb +210 -0
  111. data/lib/ory-keto-client/models/health_status.rb +207 -0
  112. data/lib/ory-keto-client/models/inline_response500.rb +253 -0
  113. data/lib/ory-keto-client/models/input.rb +239 -0
  114. data/lib/ory-keto-client/models/is_instance_alive_internal_server_error.rb +207 -0
  115. data/lib/ory-keto-client/models/is_instance_alive_internal_server_error_body.rb +260 -0
  116. data/lib/ory-keto-client/models/is_instance_alive_ok.rb +207 -0
  117. data/lib/ory-keto-client/models/list_ory_access_control_policies.rb +233 -0
  118. data/lib/ory-keto-client/models/list_ory_access_control_policies_internal_server_error.rb +207 -0
  119. data/lib/ory-keto-client/models/list_ory_access_control_policies_internal_server_error_body.rb +260 -0
  120. data/lib/ory-keto-client/models/list_ory_access_control_policies_ok.rb +210 -0
  121. data/lib/ory-keto-client/models/list_ory_access_control_policy_roles.rb +233 -0
  122. data/lib/ory-keto-client/models/list_ory_access_control_policy_roles_internal_server_error.rb +207 -0
  123. data/lib/ory-keto-client/models/list_ory_access_control_policy_roles_internal_server_error_body.rb +260 -0
  124. data/lib/ory-keto-client/models/list_ory_access_control_policy_roles_ok.rb +210 -0
  125. data/lib/ory-keto-client/models/ory_access_control_policies.rb +209 -0
  126. data/lib/ory-keto-client/models/ory_access_control_policy.rb +275 -0
  127. data/lib/ory-keto-client/models/ory_access_control_policy_allowed_input.rb +239 -0
  128. data/lib/ory-keto-client/models/ory_access_control_policy_role.rb +220 -0
  129. data/lib/ory-keto-client/models/ory_access_control_policy_roles.rb +209 -0
  130. data/lib/ory-keto-client/models/policy.rb +275 -0
  131. data/lib/ory-keto-client/models/remove_ory_access_control_policy_role_members.rb +243 -0
  132. data/lib/ory-keto-client/models/remove_ory_access_control_policy_role_members_internal_server_error.rb +207 -0
  133. data/lib/ory-keto-client/models/remove_ory_access_control_policy_role_members_internal_server_error_body.rb +260 -0
  134. data/lib/ory-keto-client/models/role.rb +220 -0
  135. data/lib/ory-keto-client/models/swagger_health_status.rb +208 -0
  136. data/lib/ory-keto-client/models/swagger_not_ready_status.rb +210 -0
  137. data/lib/ory-keto-client/models/swagger_version.rb +208 -0
  138. data/lib/ory-keto-client/models/upsert_ory_access_control_policy.rb +222 -0
  139. data/lib/ory-keto-client/models/upsert_ory_access_control_policy_internal_server_error.rb +207 -0
  140. data/lib/ory-keto-client/models/upsert_ory_access_control_policy_internal_server_error_body.rb +260 -0
  141. data/lib/ory-keto-client/models/upsert_ory_access_control_policy_ok.rb +207 -0
  142. data/lib/ory-keto-client/models/upsert_ory_access_control_policy_role.rb +222 -0
  143. data/lib/ory-keto-client/models/upsert_ory_access_control_policy_role_internal_server_error.rb +207 -0
  144. data/lib/ory-keto-client/models/upsert_ory_access_control_policy_role_internal_server_error_body.rb +260 -0
  145. data/lib/ory-keto-client/models/upsert_ory_access_control_policy_role_ok.rb +207 -0
  146. data/lib/ory-keto-client/models/version.rb +208 -0
  147. data/lib/ory-keto-client/version.rb +15 -0
  148. data/ory-keto-client.gemspec +39 -0
  149. data/spec/api/engines_api_spec.rb +182 -0
  150. data/spec/api/health_api_spec.rb +57 -0
  151. data/spec/api/version_api_spec.rb +46 -0
  152. data/spec/api_client_spec.rb +226 -0
  153. data/spec/configuration_spec.rb +42 -0
  154. data/spec/models/add_ory_access_control_policy_role_members_body_spec.rb +41 -0
  155. data/spec/models/add_ory_access_control_policy_role_members_internal_server_error_body_spec.rb +71 -0
  156. data/spec/models/add_ory_access_control_policy_role_members_internal_server_error_spec.rb +41 -0
  157. data/spec/models/add_ory_access_control_policy_role_members_ok_spec.rb +41 -0
  158. data/spec/models/add_ory_access_control_policy_role_members_spec.rb +53 -0
  159. data/spec/models/authorization_result_spec.rb +41 -0
  160. data/spec/models/delete_ory_access_control_policy_internal_server_error_body_spec.rb +71 -0
  161. data/spec/models/delete_ory_access_control_policy_internal_server_error_spec.rb +41 -0
  162. data/spec/models/delete_ory_access_control_policy_role_internal_server_error_body_spec.rb +71 -0
  163. data/spec/models/delete_ory_access_control_policy_role_internal_server_error_spec.rb +41 -0
  164. data/spec/models/delete_ory_access_control_policy_role_spec.rb +47 -0
  165. data/spec/models/delete_ory_access_control_policy_spec.rb +47 -0
  166. data/spec/models/do_ory_access_control_policies_allow_forbidden_spec.rb +41 -0
  167. data/spec/models/do_ory_access_control_policies_allow_internal_server_error_body_spec.rb +71 -0
  168. data/spec/models/do_ory_access_control_policies_allow_internal_server_error_spec.rb +41 -0
  169. data/spec/models/do_ory_access_control_policies_allow_ok_spec.rb +41 -0
  170. data/spec/models/do_ory_access_control_policies_allow_spec.rb +47 -0
  171. data/spec/models/get_ory_access_control_policy_internal_server_error_body_spec.rb +71 -0
  172. data/spec/models/get_ory_access_control_policy_internal_server_error_spec.rb +41 -0
  173. data/spec/models/get_ory_access_control_policy_not_found_body_spec.rb +71 -0
  174. data/spec/models/get_ory_access_control_policy_not_found_spec.rb +41 -0
  175. data/spec/models/get_ory_access_control_policy_ok_spec.rb +41 -0
  176. data/spec/models/get_ory_access_control_policy_role_internal_server_error_body_spec.rb +71 -0
  177. data/spec/models/get_ory_access_control_policy_role_internal_server_error_spec.rb +41 -0
  178. data/spec/models/get_ory_access_control_policy_role_not_found_body_spec.rb +71 -0
  179. data/spec/models/get_ory_access_control_policy_role_not_found_spec.rb +41 -0
  180. data/spec/models/get_ory_access_control_policy_role_ok_spec.rb +41 -0
  181. data/spec/models/get_ory_access_control_policy_role_spec.rb +47 -0
  182. data/spec/models/get_ory_access_control_policy_spec.rb +47 -0
  183. data/spec/models/health_not_ready_status_spec.rb +41 -0
  184. data/spec/models/health_status_spec.rb +41 -0
  185. data/spec/models/inline_response500_spec.rb +71 -0
  186. data/spec/models/input_spec.rb +59 -0
  187. data/spec/models/is_instance_alive_internal_server_error_body_spec.rb +71 -0
  188. data/spec/models/is_instance_alive_internal_server_error_spec.rb +41 -0
  189. data/spec/models/is_instance_alive_ok_spec.rb +41 -0
  190. data/spec/models/list_ory_access_control_policies_internal_server_error_body_spec.rb +71 -0
  191. data/spec/models/list_ory_access_control_policies_internal_server_error_spec.rb +41 -0
  192. data/spec/models/list_ory_access_control_policies_ok_spec.rb +41 -0
  193. data/spec/models/list_ory_access_control_policies_spec.rb +53 -0
  194. data/spec/models/list_ory_access_control_policy_roles_internal_server_error_body_spec.rb +71 -0
  195. data/spec/models/list_ory_access_control_policy_roles_internal_server_error_spec.rb +41 -0
  196. data/spec/models/list_ory_access_control_policy_roles_ok_spec.rb +41 -0
  197. data/spec/models/list_ory_access_control_policy_roles_spec.rb +53 -0
  198. data/spec/models/ory_access_control_policies_spec.rb +41 -0
  199. data/spec/models/ory_access_control_policy_allowed_input_spec.rb +59 -0
  200. data/spec/models/ory_access_control_policy_role_spec.rb +47 -0
  201. data/spec/models/ory_access_control_policy_roles_spec.rb +41 -0
  202. data/spec/models/ory_access_control_policy_spec.rb +77 -0
  203. data/spec/models/policy_spec.rb +77 -0
  204. data/spec/models/remove_ory_access_control_policy_role_members_internal_server_error_body_spec.rb +71 -0
  205. data/spec/models/remove_ory_access_control_policy_role_members_internal_server_error_spec.rb +41 -0
  206. data/spec/models/remove_ory_access_control_policy_role_members_spec.rb +53 -0
  207. data/spec/models/role_spec.rb +47 -0
  208. data/spec/models/swagger_health_status_spec.rb +41 -0
  209. data/spec/models/swagger_not_ready_status_spec.rb +41 -0
  210. data/spec/models/swagger_version_spec.rb +41 -0
  211. data/spec/models/upsert_ory_access_control_policy_internal_server_error_body_spec.rb +71 -0
  212. data/spec/models/upsert_ory_access_control_policy_internal_server_error_spec.rb +41 -0
  213. data/spec/models/upsert_ory_access_control_policy_ok_spec.rb +41 -0
  214. data/spec/models/upsert_ory_access_control_policy_role_internal_server_error_body_spec.rb +71 -0
  215. data/spec/models/upsert_ory_access_control_policy_role_internal_server_error_spec.rb +41 -0
  216. data/spec/models/upsert_ory_access_control_policy_role_ok_spec.rb +41 -0
  217. data/spec/models/upsert_ory_access_control_policy_role_spec.rb +47 -0
  218. data/spec/models/upsert_ory_access_control_policy_spec.rb +47 -0
  219. data/spec/models/version_spec.rb +41 -0
  220. data/spec/spec_helper.rb +111 -0
  221. metadata +396 -0
@@ -0,0 +1,134 @@
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: Latest
7
+ Contact: hi@ory.sh
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.2
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module OryHydraClient
16
+ class HealthApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Check alive status
23
+ # This endpoint returns a 200 status code when the HTTP server is up running. This status does currently not include checks whether the database connection is working. If the service supports TLS Edge Termination, this endpoint does not require the `X-Forwarded-Proto` header to be set. Be aware that if you are running multiple nodes of this service, the health status will never refer to the cluster state, only to a single instance.
24
+ # @param [Hash] opts the optional parameters
25
+ # @return [HealthStatus]
26
+ def is_instance_alive(opts = {})
27
+ data, _status_code, _headers = is_instance_alive_with_http_info(opts)
28
+ data
29
+ end
30
+
31
+ # Check alive status
32
+ # This endpoint returns a 200 status code when the HTTP server is up running. This status does currently not include checks whether the database connection is working. If the service supports TLS Edge Termination, this endpoint does not require the `X-Forwarded-Proto` header to be set. Be aware that if you are running multiple nodes of this service, the health status will never refer to the cluster state, only to a single instance.
33
+ # @param [Hash] opts the optional parameters
34
+ # @return [Array<(HealthStatus, Integer, Hash)>] HealthStatus data, response status code and response headers
35
+ def is_instance_alive_with_http_info(opts = {})
36
+ if @api_client.config.debugging
37
+ @api_client.config.logger.debug 'Calling API: HealthApi.is_instance_alive ...'
38
+ end
39
+ # resource path
40
+ local_var_path = '/health/alive'
41
+
42
+ # query parameters
43
+ query_params = opts[:query_params] || {}
44
+
45
+ # header parameters
46
+ header_params = opts[:header_params] || {}
47
+ # HTTP header 'Accept' (if needed)
48
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
49
+
50
+ # form parameters
51
+ form_params = opts[:form_params] || {}
52
+
53
+ # http body (model)
54
+ post_body = opts[:body]
55
+
56
+ # return_type
57
+ return_type = opts[:return_type] || 'HealthStatus'
58
+
59
+ # auth_names
60
+ auth_names = opts[:auth_names] || []
61
+
62
+ new_options = opts.merge(
63
+ :header_params => header_params,
64
+ :query_params => query_params,
65
+ :form_params => form_params,
66
+ :body => post_body,
67
+ :auth_names => auth_names,
68
+ :return_type => return_type
69
+ )
70
+
71
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
72
+ if @api_client.config.debugging
73
+ @api_client.config.logger.debug "API called: HealthApi#is_instance_alive\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
74
+ end
75
+ return data, status_code, headers
76
+ end
77
+
78
+ # Check readiness status
79
+ # This endpoint returns a 200 status code when the HTTP server is up running and the environment dependencies (e.g. the database) are responsive as well. If the service supports TLS Edge Termination, this endpoint does not require the `X-Forwarded-Proto` header to be set. Be aware that if you are running multiple nodes of this service, the health status will never refer to the cluster state, only to a single instance.
80
+ # @param [Hash] opts the optional parameters
81
+ # @return [HealthStatus]
82
+ def is_instance_ready(opts = {})
83
+ data, _status_code, _headers = is_instance_ready_with_http_info(opts)
84
+ data
85
+ end
86
+
87
+ # Check readiness status
88
+ # This endpoint returns a 200 status code when the HTTP server is up running and the environment dependencies (e.g. the database) are responsive as well. If the service supports TLS Edge Termination, this endpoint does not require the &#x60;X-Forwarded-Proto&#x60; header to be set. Be aware that if you are running multiple nodes of this service, the health status will never refer to the cluster state, only to a single instance.
89
+ # @param [Hash] opts the optional parameters
90
+ # @return [Array<(HealthStatus, Integer, Hash)>] HealthStatus data, response status code and response headers
91
+ def is_instance_ready_with_http_info(opts = {})
92
+ if @api_client.config.debugging
93
+ @api_client.config.logger.debug 'Calling API: HealthApi.is_instance_ready ...'
94
+ end
95
+ # resource path
96
+ local_var_path = '/health/ready'
97
+
98
+ # query parameters
99
+ query_params = opts[:query_params] || {}
100
+
101
+ # header parameters
102
+ header_params = opts[:header_params] || {}
103
+ # HTTP header 'Accept' (if needed)
104
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
105
+
106
+ # form parameters
107
+ form_params = opts[:form_params] || {}
108
+
109
+ # http body (model)
110
+ post_body = opts[:body]
111
+
112
+ # return_type
113
+ return_type = opts[:return_type] || 'HealthStatus'
114
+
115
+ # auth_names
116
+ auth_names = opts[:auth_names] || []
117
+
118
+ new_options = opts.merge(
119
+ :header_params => header_params,
120
+ :query_params => query_params,
121
+ :form_params => form_params,
122
+ :body => post_body,
123
+ :auth_names => auth_names,
124
+ :return_type => return_type
125
+ )
126
+
127
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
128
+ if @api_client.config.debugging
129
+ @api_client.config.logger.debug "API called: HealthApi#is_instance_ready\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
130
+ end
131
+ return data, status_code, headers
132
+ end
133
+ end
134
+ end
@@ -0,0 +1,78 @@
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: Latest
7
+ Contact: hi@ory.sh
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.2
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module OryHydraClient
16
+ class VersionApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Get service version
23
+ # This endpoint returns the service version typically notated using semantic versioning. If the service supports TLS Edge Termination, this endpoint does not require the `X-Forwarded-Proto` header to be set. Be aware that if you are running multiple nodes of this service, the health status will never refer to the cluster state, only to a single instance.
24
+ # @param [Hash] opts the optional parameters
25
+ # @return [Version]
26
+ def get_version(opts = {})
27
+ data, _status_code, _headers = get_version_with_http_info(opts)
28
+ data
29
+ end
30
+
31
+ # Get service version
32
+ # This endpoint returns the service version typically notated using semantic versioning. If the service supports TLS Edge Termination, this endpoint does not require the &#x60;X-Forwarded-Proto&#x60; header to be set. Be aware that if you are running multiple nodes of this service, the health status will never refer to the cluster state, only to a single instance.
33
+ # @param [Hash] opts the optional parameters
34
+ # @return [Array<(Version, Integer, Hash)>] Version data, response status code and response headers
35
+ def get_version_with_http_info(opts = {})
36
+ if @api_client.config.debugging
37
+ @api_client.config.logger.debug 'Calling API: VersionApi.get_version ...'
38
+ end
39
+ # resource path
40
+ local_var_path = '/version'
41
+
42
+ # query parameters
43
+ query_params = opts[:query_params] || {}
44
+
45
+ # header parameters
46
+ header_params = opts[:header_params] || {}
47
+ # HTTP header 'Accept' (if needed)
48
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
49
+
50
+ # form parameters
51
+ form_params = opts[:form_params] || {}
52
+
53
+ # http body (model)
54
+ post_body = opts[:body]
55
+
56
+ # return_type
57
+ return_type = opts[:return_type] || 'Version'
58
+
59
+ # auth_names
60
+ auth_names = opts[:auth_names] || []
61
+
62
+ new_options = opts.merge(
63
+ :header_params => header_params,
64
+ :query_params => query_params,
65
+ :form_params => form_params,
66
+ :body => post_body,
67
+ :auth_names => auth_names,
68
+ :return_type => return_type
69
+ )
70
+
71
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
72
+ if @api_client.config.debugging
73
+ @api_client.config.logger.debug "API called: VersionApi#get_version\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
74
+ end
75
+ return data, status_code, headers
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,385 @@
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: Latest
7
+ Contact: hi@ory.sh
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.2
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'json'
15
+ require 'logger'
16
+ require 'tempfile'
17
+ require 'typhoeus'
18
+
19
+ module OryHydraClient
20
+ class ApiClient
21
+ # The Configuration object holding settings to be used in the API client.
22
+ attr_accessor :config
23
+
24
+ # Defines the headers to be used in HTTP requests of all API calls by default.
25
+ #
26
+ # @return [Hash]
27
+ attr_accessor :default_headers
28
+
29
+ # Initializes the ApiClient
30
+ # @option config [Configuration] Configuration for initializing the object, default to Configuration.default
31
+ def initialize(config = Configuration.default)
32
+ @config = config
33
+ @user_agent = "OpenAPI-Generator/#{VERSION}/ruby"
34
+ @default_headers = {
35
+ 'Content-Type' => 'application/json',
36
+ 'User-Agent' => @user_agent
37
+ }
38
+ end
39
+
40
+ def self.default
41
+ @@default ||= ApiClient.new
42
+ end
43
+
44
+ # Call an API with given options.
45
+ #
46
+ # @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
47
+ # the data deserialized from response body (could be nil), response status code and response headers.
48
+ def call_api(http_method, path, opts = {})
49
+ request = build_request(http_method, path, opts)
50
+ response = request.run
51
+
52
+ if @config.debugging
53
+ @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
54
+ end
55
+
56
+ unless response.success?
57
+ if response.timed_out?
58
+ fail ApiError.new('Connection timed out')
59
+ elsif response.code == 0
60
+ # Errors from libcurl will be made visible here
61
+ fail ApiError.new(:code => 0,
62
+ :message => response.return_message)
63
+ else
64
+ fail ApiError.new(:code => response.code,
65
+ :response_headers => response.headers,
66
+ :response_body => response.body),
67
+ response.status_message
68
+ end
69
+ end
70
+
71
+ if opts[:return_type]
72
+ data = deserialize(response, opts[:return_type])
73
+ else
74
+ data = nil
75
+ end
76
+ return data, response.code, response.headers
77
+ end
78
+
79
+ # Builds the HTTP request
80
+ #
81
+ # @param [String] http_method HTTP method/verb (e.g. POST)
82
+ # @param [String] path URL path (e.g. /account/new)
83
+ # @option opts [Hash] :header_params Header parameters
84
+ # @option opts [Hash] :query_params Query parameters
85
+ # @option opts [Hash] :form_params Query parameters
86
+ # @option opts [Object] :body HTTP body (JSON/XML)
87
+ # @return [Typhoeus::Request] A Typhoeus Request
88
+ def build_request(http_method, path, opts = {})
89
+ url = build_request_url(path)
90
+ http_method = http_method.to_sym.downcase
91
+
92
+ header_params = @default_headers.merge(opts[:header_params] || {})
93
+ query_params = opts[:query_params] || {}
94
+ form_params = opts[:form_params] || {}
95
+
96
+
97
+ # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)
98
+ _verify_ssl_host = @config.verify_ssl_host ? 2 : 0
99
+
100
+ req_opts = {
101
+ :method => http_method,
102
+ :headers => header_params,
103
+ :params => query_params,
104
+ :params_encoding => @config.params_encoding,
105
+ :timeout => @config.timeout,
106
+ :ssl_verifypeer => @config.verify_ssl,
107
+ :ssl_verifyhost => _verify_ssl_host,
108
+ :sslcert => @config.cert_file,
109
+ :sslkey => @config.key_file,
110
+ :verbose => @config.debugging
111
+ }
112
+
113
+ # set custom cert, if provided
114
+ req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert
115
+
116
+ if [:post, :patch, :put, :delete].include?(http_method)
117
+ req_body = build_request_body(header_params, form_params, opts[:body])
118
+ req_opts.update :body => req_body
119
+ if @config.debugging
120
+ @config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
121
+ end
122
+ end
123
+
124
+ request = Typhoeus::Request.new(url, req_opts)
125
+ download_file(request) if opts[:return_type] == 'File'
126
+ request
127
+ end
128
+
129
+ # Builds the HTTP request body
130
+ #
131
+ # @param [Hash] header_params Header parameters
132
+ # @param [Hash] form_params Query parameters
133
+ # @param [Object] body HTTP body (JSON/XML)
134
+ # @return [String] HTTP body data in the form of string
135
+ def build_request_body(header_params, form_params, body)
136
+ # http form
137
+ if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
138
+ header_params['Content-Type'] == 'multipart/form-data'
139
+ data = {}
140
+ form_params.each do |key, value|
141
+ case value
142
+ when ::File, ::Array, nil
143
+ # let typhoeus handle File, Array and nil parameters
144
+ data[key] = value
145
+ else
146
+ data[key] = value.to_s
147
+ end
148
+ end
149
+ elsif body
150
+ data = body.is_a?(String) ? body : body.to_json
151
+ else
152
+ data = nil
153
+ end
154
+ data
155
+ end
156
+
157
+ # Check if the given MIME is a JSON MIME.
158
+ # JSON MIME examples:
159
+ # application/json
160
+ # application/json; charset=UTF8
161
+ # APPLICATION/JSON
162
+ # */*
163
+ # @param [String] mime MIME
164
+ # @return [Boolean] True if the MIME is application/json
165
+ def json_mime?(mime)
166
+ (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
167
+ end
168
+
169
+ # Deserialize the response to the given return type.
170
+ #
171
+ # @param [Response] response HTTP response
172
+ # @param [String] return_type some examples: "User", "Array<User>", "Hash<String, Integer>"
173
+ def deserialize(response, return_type)
174
+ body = response.body
175
+
176
+ # handle file downloading - return the File instance processed in request callbacks
177
+ # note that response body is empty when the file is written in chunks in request on_body callback
178
+ return @tempfile if return_type == 'File'
179
+
180
+ return nil if body.nil? || body.empty?
181
+
182
+ # return response body directly for String return type
183
+ return body if return_type == 'String'
184
+
185
+ # ensuring a default content type
186
+ content_type = response.headers['Content-Type'] || 'application/json'
187
+
188
+ fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type)
189
+
190
+ begin
191
+ data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
192
+ rescue JSON::ParserError => e
193
+ if %w(String Date DateTime).include?(return_type)
194
+ data = body
195
+ else
196
+ raise e
197
+ end
198
+ end
199
+
200
+ convert_to_type data, return_type
201
+ end
202
+
203
+ # Convert data to the given return type.
204
+ # @param [Object] data Data to be converted
205
+ # @param [String] return_type Return type
206
+ # @return [Mixed] Data in a particular type
207
+ def convert_to_type(data, return_type)
208
+ return nil if data.nil?
209
+ case return_type
210
+ when 'String'
211
+ data.to_s
212
+ when 'Integer'
213
+ data.to_i
214
+ when 'Float'
215
+ data.to_f
216
+ when 'Boolean'
217
+ data == true
218
+ when 'DateTime'
219
+ # parse date time (expecting ISO 8601 format)
220
+ DateTime.parse data
221
+ when 'Date'
222
+ # parse date time (expecting ISO 8601 format)
223
+ Date.parse data
224
+ when 'Object'
225
+ # generic object (usually a Hash), return directly
226
+ data
227
+ when /\AArray<(.+)>\z/
228
+ # e.g. Array<Pet>
229
+ sub_type = $1
230
+ data.map { |item| convert_to_type(item, sub_type) }
231
+ when /\AHash\<String, (.+)\>\z/
232
+ # e.g. Hash<String, Integer>
233
+ sub_type = $1
234
+ {}.tap do |hash|
235
+ data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
236
+ end
237
+ else
238
+ # models, e.g. Pet
239
+ OryHydraClient.const_get(return_type).build_from_hash(data)
240
+ end
241
+ end
242
+
243
+ # Save response body into a file in (the defined) temporary folder, using the filename
244
+ # from the "Content-Disposition" header if provided, otherwise a random filename.
245
+ # The response body is written to the file in chunks in order to handle files which
246
+ # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
247
+ # process can use.
248
+ #
249
+ # @see Configuration#temp_folder_path
250
+ def download_file(request)
251
+ tempfile = nil
252
+ encoding = nil
253
+ request.on_headers do |response|
254
+ content_disposition = response.headers['Content-Disposition']
255
+ if content_disposition && content_disposition =~ /filename=/i
256
+ filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
257
+ prefix = sanitize_filename(filename)
258
+ else
259
+ prefix = 'download-'
260
+ end
261
+ prefix = prefix + '-' unless prefix.end_with?('-')
262
+ encoding = response.body.encoding
263
+ tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
264
+ @tempfile = tempfile
265
+ end
266
+ request.on_body do |chunk|
267
+ chunk.force_encoding(encoding)
268
+ tempfile.write(chunk)
269
+ end
270
+ request.on_complete do |response|
271
+ tempfile.close if tempfile
272
+ @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
273
+ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
274
+ "will be deleted automatically with GC. It's also recommended to delete the temp file "\
275
+ "explicitly with `tempfile.delete`"
276
+ end
277
+ end
278
+
279
+ # Sanitize filename by removing path.
280
+ # e.g. ../../sun.gif becomes sun.gif
281
+ #
282
+ # @param [String] filename the filename to be sanitized
283
+ # @return [String] the sanitized filename
284
+ def sanitize_filename(filename)
285
+ filename.gsub(/.*[\/\\]/, '')
286
+ end
287
+
288
+ def build_request_url(path)
289
+ # Add leading and trailing slashes to path
290
+ path = "/#{path}".gsub(/\/+/, '/')
291
+ @config.base_url + path
292
+ end
293
+
294
+ # Update hearder and query params based on authentication settings.
295
+ #
296
+ # @param [Hash] header_params Header parameters
297
+ # @param [Hash] query_params Query parameters
298
+ # @param [String] auth_names Authentication scheme name
299
+ def update_params_for_auth!(header_params, query_params, auth_names)
300
+ Array(auth_names).each do |auth_name|
301
+ auth_setting = @config.auth_settings[auth_name]
302
+ next unless auth_setting
303
+ case auth_setting[:in]
304
+ when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
305
+ when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
306
+ else fail ArgumentError, 'Authentication token must be in `query` of `header`'
307
+ end
308
+ end
309
+ end
310
+
311
+ # Sets user agent in HTTP header
312
+ #
313
+ # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0)
314
+ def user_agent=(user_agent)
315
+ @user_agent = user_agent
316
+ @default_headers['User-Agent'] = @user_agent
317
+ end
318
+
319
+ # Return Accept header based on an array of accepts provided.
320
+ # @param [Array] accepts array for Accept
321
+ # @return [String] the Accept header (e.g. application/json)
322
+ def select_header_accept(accepts)
323
+ return nil if accepts.nil? || accepts.empty?
324
+ # use JSON when present, otherwise use all of the provided
325
+ json_accept = accepts.find { |s| json_mime?(s) }
326
+ json_accept || accepts.join(',')
327
+ end
328
+
329
+ # Return Content-Type header based on an array of content types provided.
330
+ # @param [Array] content_types array for Content-Type
331
+ # @return [String] the Content-Type header (e.g. application/json)
332
+ def select_header_content_type(content_types)
333
+ # use application/json by default
334
+ return 'application/json' if content_types.nil? || content_types.empty?
335
+ # use JSON when present, otherwise use the first one
336
+ json_content_type = content_types.find { |s| json_mime?(s) }
337
+ json_content_type || content_types.first
338
+ end
339
+
340
+ # Convert object (array, hash, object, etc) to JSON string.
341
+ # @param [Object] model object to be converted into JSON string
342
+ # @return [String] JSON string representation of the object
343
+ def object_to_http_body(model)
344
+ return model if model.nil? || model.is_a?(String)
345
+ local_body = nil
346
+ if model.is_a?(Array)
347
+ local_body = model.map { |m| object_to_hash(m) }
348
+ else
349
+ local_body = object_to_hash(model)
350
+ end
351
+ local_body.to_json
352
+ end
353
+
354
+ # Convert object(non-array) to hash.
355
+ # @param [Object] obj object to be converted into JSON string
356
+ # @return [String] JSON string representation of the object
357
+ def object_to_hash(obj)
358
+ if obj.respond_to?(:to_hash)
359
+ obj.to_hash
360
+ else
361
+ obj
362
+ end
363
+ end
364
+
365
+ # Build parameter value according to the given collection format.
366
+ # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi
367
+ def build_collection_param(param, collection_format)
368
+ case collection_format
369
+ when :csv
370
+ param.join(',')
371
+ when :ssv
372
+ param.join(' ')
373
+ when :tsv
374
+ param.join("\t")
375
+ when :pipes
376
+ param.join('|')
377
+ when :multi
378
+ # return the array directly as typhoeus will handle it as expected
379
+ param
380
+ else
381
+ fail "unknown collection format: #{collection_format.inspect}"
382
+ end
383
+ end
384
+ end
385
+ end