permit-sdk 0.0.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 (196) hide show
  1. checksums.yaml +7 -0
  2. data/lib/api/api.rb +25 -0
  3. data/lib/api/base.rb +26 -0
  4. data/lib/api/resources.rb +13 -0
  5. data/lib/api/tenants.rb +11 -0
  6. data/lib/api/users.rb +50 -0
  7. data/lib/api/utils.rb +9 -0
  8. data/lib/config.rb +23 -0
  9. data/lib/main.rb +49 -0
  10. data/lib/openapi_client/api/api_keys_api.rb +413 -0
  11. data/lib/openapi_client/api/audit_elements_data_api.rb +118 -0
  12. data/lib/openapi_client/api/audit_logs_api.rb +204 -0
  13. data/lib/openapi_client/api/authentication_api.rb +512 -0
  14. data/lib/openapi_client/api/condition_set_rules_api.rb +278 -0
  15. data/lib/openapi_client/api/condition_sets_api.rb +428 -0
  16. data/lib/openapi_client/api/decision_logs_api.rb +128 -0
  17. data/lib/openapi_client/api/decision_logs_ingress_api.rb +90 -0
  18. data/lib/openapi_client/api/default_api.rb +297 -0
  19. data/lib/openapi_client/api/elements_configs_api.rb +657 -0
  20. data/lib/openapi_client/api/environments_api.rb +462 -0
  21. data/lib/openapi_client/api/instructions_api.rb +91 -0
  22. data/lib/openapi_client/api/members_api.rb +354 -0
  23. data/lib/openapi_client/api/opal_data_api.rb +343 -0
  24. data/lib/openapi_client/api/organizations_api.rb +652 -0
  25. data/lib/openapi_client/api/policy_api.rb +138 -0
  26. data/lib/openapi_client/api/policy_decision_points_api.rb +382 -0
  27. data/lib/openapi_client/api/policy_git_repositories_api.rb +510 -0
  28. data/lib/openapi_client/api/projects_api.rb +365 -0
  29. data/lib/openapi_client/api/resource_actions_api.rb +455 -0
  30. data/lib/openapi_client/api/resource_attributes_api.rb +473 -0
  31. data/lib/openapi_client/api/resource_instances_api.rb +425 -0
  32. data/lib/openapi_client/api/resource_roles_api.rb +813 -0
  33. data/lib/openapi_client/api/resources_api.rb +514 -0
  34. data/lib/openapi_client/api/role_assignments_api.rb +278 -0
  35. data/lib/openapi_client/api/roles_api.rb +759 -0
  36. data/lib/openapi_client/api/tenants_api.rb +603 -0
  37. data/lib/openapi_client/api/user_attributes_api.rb +458 -0
  38. data/lib/openapi_client/api/users_api.rb +684 -0
  39. data/lib/openapi_client/api/users_elements_data_api.rb +638 -0
  40. data/lib/openapi_client/api_client.rb +392 -0
  41. data/lib/openapi_client/api_error.rb +57 -0
  42. data/lib/openapi_client/configuration.rb +280 -0
  43. data/lib/openapi_client/models/action_block_editable.rb +230 -0
  44. data/lib/openapi_client/models/action_block_read.rb +255 -0
  45. data/lib/openapi_client/models/action_object.rb +275 -0
  46. data/lib/openapi_client/models/actor.rb +57 -0
  47. data/lib/openapi_client/models/add_role_permissions.rb +227 -0
  48. data/lib/openapi_client/models/api_key_create.rb +269 -0
  49. data/lib/openapi_client/models/api_key_owner_type.rb +41 -0
  50. data/lib/openapi_client/models/api_key_read.rb +329 -0
  51. data/lib/openapi_client/models/api_key_scope_read.rb +245 -0
  52. data/lib/openapi_client/models/attribute_block_editable.rb +235 -0
  53. data/lib/openapi_client/models/attribute_block_read.rb +260 -0
  54. data/lib/openapi_client/models/attribute_type.rb +44 -0
  55. data/lib/openapi_client/models/attributes.rb +231 -0
  56. data/lib/openapi_client/models/audit_log.rb +415 -0
  57. data/lib/openapi_client/models/audit_log_objects.rb +282 -0
  58. data/lib/openapi_client/models/authn_me_api_key_read.rb +329 -0
  59. data/lib/openapi_client/models/authn_me_member_read.rb +352 -0
  60. data/lib/openapi_client/models/authn_me_read.rb +224 -0
  61. data/lib/openapi_client/models/authn_me_user_read.rb +440 -0
  62. data/lib/openapi_client/models/condition_set_create.rb +340 -0
  63. data/lib/openapi_client/models/condition_set_read.rb +409 -0
  64. data/lib/openapi_client/models/condition_set_rule_create.rb +279 -0
  65. data/lib/openapi_client/models/condition_set_rule_read.rb +360 -0
  66. data/lib/openapi_client/models/condition_set_rule_remove.rb +279 -0
  67. data/lib/openapi_client/models/condition_set_type.rb +40 -0
  68. data/lib/openapi_client/models/condition_set_update.rb +255 -0
  69. data/lib/openapi_client/models/data_source_config.rb +228 -0
  70. data/lib/openapi_client/models/data_source_entry.rb +272 -0
  71. data/lib/openapi_client/models/detailed_audit_log.rb +443 -0
  72. data/lib/openapi_client/models/dev_login.rb +225 -0
  73. data/lib/openapi_client/models/dummy_engine_model.rb +229 -0
  74. data/lib/openapi_client/models/elements_config_create.rb +319 -0
  75. data/lib/openapi_client/models/elements_config_read.rb +402 -0
  76. data/lib/openapi_client/models/elements_config_runtime_read.rb +238 -0
  77. data/lib/openapi_client/models/elements_config_update.rb +268 -0
  78. data/lib/openapi_client/models/elements_env_type_read.rb +242 -0
  79. data/lib/openapi_client/models/elements_env_type_update.rb +222 -0
  80. data/lib/openapi_client/models/elements_permission_level.rb +44 -0
  81. data/lib/openapi_client/models/elements_role_read.rb +378 -0
  82. data/lib/openapi_client/models/elements_type.rb +41 -0
  83. data/lib/openapi_client/models/elements_user_create.rb +295 -0
  84. data/lib/openapi_client/models/elements_user_role_create.rb +225 -0
  85. data/lib/openapi_client/models/elements_user_role_remove.rb +225 -0
  86. data/lib/openapi_client/models/embedded_login_request_output.rb +265 -0
  87. data/lib/openapi_client/models/engine.rb +39 -0
  88. data/lib/openapi_client/models/environment_create.rb +281 -0
  89. data/lib/openapi_client/models/environment_object.rb +295 -0
  90. data/lib/openapi_client/models/environment_read.rb +335 -0
  91. data/lib/openapi_client/models/environment_stats.rb +365 -0
  92. data/lib/openapi_client/models/environment_update.rb +240 -0
  93. data/lib/openapi_client/models/failed_invite.rb +238 -0
  94. data/lib/openapi_client/models/full_data.rb +258 -0
  95. data/lib/openapi_client/models/http_validation_error.rb +221 -0
  96. data/lib/openapi_client/models/identity_read.rb +300 -0
  97. data/lib/openapi_client/models/invite_attempt_result.rb +232 -0
  98. data/lib/openapi_client/models/invite_create.rb +240 -0
  99. data/lib/openapi_client/models/invite_read.rb +325 -0
  100. data/lib/openapi_client/models/invite_status.rb +42 -0
  101. data/lib/openapi_client/models/labels.rb +238 -0
  102. data/lib/openapi_client/models/language_instructions.rb +252 -0
  103. data/lib/openapi_client/models/location_inner.rb +230 -0
  104. data/lib/openapi_client/models/login_result.rb +259 -0
  105. data/lib/openapi_client/models/member_access_level.rb +41 -0
  106. data/lib/openapi_client/models/member_access_obj.rb +41 -0
  107. data/lib/openapi_client/models/multi_invite_result.rb +238 -0
  108. data/lib/openapi_client/models/onboarding_step.rb +46 -0
  109. data/lib/openapi_client/models/opa_decision_log.rb +288 -0
  110. data/lib/openapi_client/models/opa_engine_decision_log.rb +345 -0
  111. data/lib/openapi_client/models/opa_labels.rb +238 -0
  112. data/lib/openapi_client/models/opa_metrics.rb +273 -0
  113. data/lib/openapi_client/models/opal_client.rb +305 -0
  114. data/lib/openapi_client/models/org_member_read.rb +420 -0
  115. data/lib/openapi_client/models/org_member_update.rb +230 -0
  116. data/lib/openapi_client/models/organization_create.rb +292 -0
  117. data/lib/openapi_client/models/organization_object.rb +295 -0
  118. data/lib/openapi_client/models/organization_read.rb +295 -0
  119. data/lib/openapi_client/models/organization_read_with_api_key.rb +313 -0
  120. data/lib/openapi_client/models/organization_update.rb +247 -0
  121. data/lib/openapi_client/models/paginated_result_api_key_read.rb +285 -0
  122. data/lib/openapi_client/models/paginated_result_audit_log.rb +285 -0
  123. data/lib/openapi_client/models/paginated_result_elements_config_read.rb +285 -0
  124. data/lib/openapi_client/models/paginated_result_opa_decision_log.rb +285 -0
  125. data/lib/openapi_client/models/paginated_result_user_read.rb +285 -0
  126. data/lib/openapi_client/models/pdp.rb +259 -0
  127. data/lib/openapi_client/models/pdp_config_object.rb +258 -0
  128. data/lib/openapi_client/models/pdp_config_read.rb +292 -0
  129. data/lib/openapi_client/models/pdp_context.rb +291 -0
  130. data/lib/openapi_client/models/pdp_state.rb +224 -0
  131. data/lib/openapi_client/models/pdp_state_update.rb +238 -0
  132. data/lib/openapi_client/models/pdp_values.rb +252 -0
  133. data/lib/openapi_client/models/permission_level_role_read.rb +254 -0
  134. data/lib/openapi_client/models/policy_repo_create.rb +318 -0
  135. data/lib/openapi_client/models/policy_repo_read.rb +347 -0
  136. data/lib/openapi_client/models/policy_repo_status.rb +41 -0
  137. data/lib/openapi_client/models/programming_language.rb +43 -0
  138. data/lib/openapi_client/models/project_create.rb +318 -0
  139. data/lib/openapi_client/models/project_object.rb +295 -0
  140. data/lib/openapi_client/models/project_read.rb +357 -0
  141. data/lib/openapi_client/models/project_update.rb +250 -0
  142. data/lib/openapi_client/models/raw_data.rb +329 -0
  143. data/lib/openapi_client/models/relationship_tuple_object.rb +252 -0
  144. data/lib/openapi_client/models/remote_config.rb +256 -0
  145. data/lib/openapi_client/models/remove_role_permissions.rb +227 -0
  146. data/lib/openapi_client/models/resource_action_create.rb +271 -0
  147. data/lib/openapi_client/models/resource_action_read.rb +370 -0
  148. data/lib/openapi_client/models/resource_action_update.rb +230 -0
  149. data/lib/openapi_client/models/resource_attribute_create.rb +271 -0
  150. data/lib/openapi_client/models/resource_attribute_read.rb +370 -0
  151. data/lib/openapi_client/models/resource_attribute_update.rb +230 -0
  152. data/lib/openapi_client/models/resource_attributes.rb +238 -0
  153. data/lib/openapi_client/models/resource_create.rb +310 -0
  154. data/lib/openapi_client/models/resource_id.rb +230 -0
  155. data/lib/openapi_client/models/resource_instance_create.rb +281 -0
  156. data/lib/openapi_client/models/resource_instance_read.rb +375 -0
  157. data/lib/openapi_client/models/resource_instance_update.rb +220 -0
  158. data/lib/openapi_client/models/resource_read.rb +374 -0
  159. data/lib/openapi_client/models/resource_replace.rb +274 -0
  160. data/lib/openapi_client/models/resource_role_create.rb +295 -0
  161. data/lib/openapi_client/models/resource_role_read.rb +379 -0
  162. data/lib/openapi_client/models/resource_role_update.rb +254 -0
  163. data/lib/openapi_client/models/resource_type_object.rb +286 -0
  164. data/lib/openapi_client/models/resource_update.rb +264 -0
  165. data/lib/openapi_client/models/role_assignment_create.rb +255 -0
  166. data/lib/openapi_client/models/role_assignment_read.rb +375 -0
  167. data/lib/openapi_client/models/role_assignment_remove.rb +255 -0
  168. data/lib/openapi_client/models/role_block.rb +244 -0
  169. data/lib/openapi_client/models/role_create.rb +295 -0
  170. data/lib/openapi_client/models/role_data.rb +221 -0
  171. data/lib/openapi_client/models/role_read.rb +364 -0
  172. data/lib/openapi_client/models/role_update.rb +254 -0
  173. data/lib/openapi_client/models/settings.rb +231 -0
  174. data/lib/openapi_client/models/ssh_auth_data.rb +295 -0
  175. data/lib/openapi_client/models/statistics.rb +389 -0
  176. data/lib/openapi_client/models/tenant_create.rb +281 -0
  177. data/lib/openapi_client/models/tenant_object.rb +284 -0
  178. data/lib/openapi_client/models/tenant_read.rb +365 -0
  179. data/lib/openapi_client/models/tenant_update.rb +240 -0
  180. data/lib/openapi_client/models/user_create.rb +286 -0
  181. data/lib/openapi_client/models/user_data.rb +232 -0
  182. data/lib/openapi_client/models/user_login_request_input.rb +240 -0
  183. data/lib/openapi_client/models/user_object.rb +313 -0
  184. data/lib/openapi_client/models/user_read.rb +336 -0
  185. data/lib/openapi_client/models/user_role.rb +240 -0
  186. data/lib/openapi_client/models/user_role_create.rb +240 -0
  187. data/lib/openapi_client/models/user_role_remove.rb +240 -0
  188. data/lib/openapi_client/models/user_update.rb +250 -0
  189. data/lib/openapi_client/models/validation_error.rb +254 -0
  190. data/lib/openapi_client/models/webhook_create.rb +235 -0
  191. data/lib/openapi_client/models/webhook_read.rb +315 -0
  192. data/lib/openapi_client/models/webhook_update.rb +230 -0
  193. data/lib/openapi_client/version.rb +15 -0
  194. data/lib/openapi_client.rb +220 -0
  195. data/lib/permit.rb +58 -0
  196. metadata +251 -0
@@ -0,0 +1,603 @@
1
+ =begin
2
+ #Permit.io API
3
+
4
+ # Authorization as a service
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.2.1
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module OpenapiClient
16
+ class TenantsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create Tenant
23
+ # Creates a new tenant inside the Permit.io system. If the tenant is already created: will return 200 instead of 201, and will return the existing tenant object in the response body.
24
+ # @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
25
+ # @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
26
+ # @param tenant_create [TenantCreate]
27
+ # @param [Hash] opts the optional parameters
28
+ # @return [TenantRead]
29
+ def create_tenant(proj_id, env_id, tenant_create, opts = {})
30
+ data, _status_code, _headers = create_tenant_with_http_info(proj_id, env_id, tenant_create, opts)
31
+ data
32
+ end
33
+
34
+ # Create Tenant
35
+ # Creates a new tenant inside the Permit.io system. If the tenant is already created: will return 200 instead of 201, and will return the existing tenant object in the response body.
36
+ # @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
37
+ # @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
38
+ # @param tenant_create [TenantCreate]
39
+ # @param [Hash] opts the optional parameters
40
+ # @return [Array<(TenantRead, Integer, Hash)>] TenantRead data, response status code and response headers
41
+ def create_tenant_with_http_info(proj_id, env_id, tenant_create, opts = {})
42
+ if @api_client.config.debugging
43
+ @api_client.config.logger.debug 'Calling API: TenantsApi.create_tenant ...'
44
+ end
45
+ # verify the required parameter 'proj_id' is set
46
+ if @api_client.config.client_side_validation && proj_id.nil?
47
+ fail ArgumentError, "Missing the required parameter 'proj_id' when calling TenantsApi.create_tenant"
48
+ end
49
+ # verify the required parameter 'env_id' is set
50
+ if @api_client.config.client_side_validation && env_id.nil?
51
+ fail ArgumentError, "Missing the required parameter 'env_id' when calling TenantsApi.create_tenant"
52
+ end
53
+ # verify the required parameter 'tenant_create' is set
54
+ if @api_client.config.client_side_validation && tenant_create.nil?
55
+ fail ArgumentError, "Missing the required parameter 'tenant_create' when calling TenantsApi.create_tenant"
56
+ end
57
+ # resource path
58
+ local_var_path = '/v2/facts/{proj_id}/{env_id}/tenants'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s))
59
+
60
+ # query parameters
61
+ query_params = opts[:query_params] || {}
62
+
63
+ # header parameters
64
+ header_params = opts[:header_params] || {}
65
+ # HTTP header 'Accept' (if needed)
66
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
67
+ # HTTP header 'Content-Type'
68
+ content_type = @api_client.select_header_content_type(['application/json'])
69
+ if !content_type.nil?
70
+ header_params['Content-Type'] = content_type
71
+ end
72
+
73
+ # form parameters
74
+ form_params = opts[:form_params] || {}
75
+
76
+ # http body (model)
77
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(tenant_create)
78
+
79
+ # return_type
80
+ return_type = opts[:debug_return_type] || 'TenantRead'
81
+
82
+ # auth_names
83
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
84
+
85
+ new_options = opts.merge(
86
+ :operation => :"TenantsApi.create_tenant",
87
+ :header_params => header_params,
88
+ :query_params => query_params,
89
+ :form_params => form_params,
90
+ :body => post_body,
91
+ :auth_names => auth_names,
92
+ :return_type => return_type
93
+ )
94
+
95
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
96
+ if @api_client.config.debugging
97
+ @api_client.config.logger.debug "API called: TenantsApi#create_tenant\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
98
+ end
99
+ return data, status_code, headers
100
+ end
101
+
102
+ # Delete Tenant
103
+ # Deletes the tenant and all its related data.
104
+ # @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \&quot;slug\&quot;).
105
+ # @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \&quot;slug\&quot;).
106
+ # @param tenant_id [String] Either the unique id of the tenant, or the URL-friendly key of the tenant (i.e: the \&quot;slug\&quot;).
107
+ # @param [Hash] opts the optional parameters
108
+ # @return [nil]
109
+ def delete_tenant(proj_id, env_id, tenant_id, opts = {})
110
+ delete_tenant_with_http_info(proj_id, env_id, tenant_id, opts)
111
+ nil
112
+ end
113
+
114
+ # Delete Tenant
115
+ # Deletes the tenant and all its related data.
116
+ # @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \&quot;slug\&quot;).
117
+ # @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \&quot;slug\&quot;).
118
+ # @param tenant_id [String] Either the unique id of the tenant, or the URL-friendly key of the tenant (i.e: the \&quot;slug\&quot;).
119
+ # @param [Hash] opts the optional parameters
120
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
121
+ def delete_tenant_with_http_info(proj_id, env_id, tenant_id, opts = {})
122
+ if @api_client.config.debugging
123
+ @api_client.config.logger.debug 'Calling API: TenantsApi.delete_tenant ...'
124
+ end
125
+ # verify the required parameter 'proj_id' is set
126
+ if @api_client.config.client_side_validation && proj_id.nil?
127
+ fail ArgumentError, "Missing the required parameter 'proj_id' when calling TenantsApi.delete_tenant"
128
+ end
129
+ # verify the required parameter 'env_id' is set
130
+ if @api_client.config.client_side_validation && env_id.nil?
131
+ fail ArgumentError, "Missing the required parameter 'env_id' when calling TenantsApi.delete_tenant"
132
+ end
133
+ # verify the required parameter 'tenant_id' is set
134
+ if @api_client.config.client_side_validation && tenant_id.nil?
135
+ fail ArgumentError, "Missing the required parameter 'tenant_id' when calling TenantsApi.delete_tenant"
136
+ end
137
+ # resource path
138
+ local_var_path = '/v2/facts/{proj_id}/{env_id}/tenants/{tenant_id}'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s)).sub('{' + 'tenant_id' + '}', CGI.escape(tenant_id.to_s))
139
+
140
+ # query parameters
141
+ query_params = opts[:query_params] || {}
142
+
143
+ # header parameters
144
+ header_params = opts[:header_params] || {}
145
+ # HTTP header 'Accept' (if needed)
146
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
147
+
148
+ # form parameters
149
+ form_params = opts[:form_params] || {}
150
+
151
+ # http body (model)
152
+ post_body = opts[:debug_body]
153
+
154
+ # return_type
155
+ return_type = opts[:debug_return_type]
156
+
157
+ # auth_names
158
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
159
+
160
+ new_options = opts.merge(
161
+ :operation => :"TenantsApi.delete_tenant",
162
+ :header_params => header_params,
163
+ :query_params => query_params,
164
+ :form_params => form_params,
165
+ :body => post_body,
166
+ :auth_names => auth_names,
167
+ :return_type => return_type
168
+ )
169
+
170
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
171
+ if @api_client.config.debugging
172
+ @api_client.config.logger.debug "API called: TenantsApi#delete_tenant\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
173
+ end
174
+ return data, status_code, headers
175
+ end
176
+
177
+ # Delete Tenant User
178
+ # Deletes a user under a tenant.
179
+ # @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \&quot;slug\&quot;).
180
+ # @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \&quot;slug\&quot;).
181
+ # @param tenant_id [String] Either the unique id of the tenant, or the URL-friendly key of the tenant (i.e: the \&quot;slug\&quot;).
182
+ # @param user_id [String] Either the unique id of the user, or the URL-friendly key of the user (i.e: the \&quot;slug\&quot;).
183
+ # @param [Hash] opts the optional parameters
184
+ # @return [nil]
185
+ def delete_tenant_user(proj_id, env_id, tenant_id, user_id, opts = {})
186
+ delete_tenant_user_with_http_info(proj_id, env_id, tenant_id, user_id, opts)
187
+ nil
188
+ end
189
+
190
+ # Delete Tenant User
191
+ # Deletes a user under a tenant.
192
+ # @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \&quot;slug\&quot;).
193
+ # @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \&quot;slug\&quot;).
194
+ # @param tenant_id [String] Either the unique id of the tenant, or the URL-friendly key of the tenant (i.e: the \&quot;slug\&quot;).
195
+ # @param user_id [String] Either the unique id of the user, or the URL-friendly key of the user (i.e: the \&quot;slug\&quot;).
196
+ # @param [Hash] opts the optional parameters
197
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
198
+ def delete_tenant_user_with_http_info(proj_id, env_id, tenant_id, user_id, opts = {})
199
+ if @api_client.config.debugging
200
+ @api_client.config.logger.debug 'Calling API: TenantsApi.delete_tenant_user ...'
201
+ end
202
+ # verify the required parameter 'proj_id' is set
203
+ if @api_client.config.client_side_validation && proj_id.nil?
204
+ fail ArgumentError, "Missing the required parameter 'proj_id' when calling TenantsApi.delete_tenant_user"
205
+ end
206
+ # verify the required parameter 'env_id' is set
207
+ if @api_client.config.client_side_validation && env_id.nil?
208
+ fail ArgumentError, "Missing the required parameter 'env_id' when calling TenantsApi.delete_tenant_user"
209
+ end
210
+ # verify the required parameter 'tenant_id' is set
211
+ if @api_client.config.client_side_validation && tenant_id.nil?
212
+ fail ArgumentError, "Missing the required parameter 'tenant_id' when calling TenantsApi.delete_tenant_user"
213
+ end
214
+ # verify the required parameter 'user_id' is set
215
+ if @api_client.config.client_side_validation && user_id.nil?
216
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling TenantsApi.delete_tenant_user"
217
+ end
218
+ # resource path
219
+ local_var_path = '/v2/facts/{proj_id}/{env_id}/tenants/{tenant_id}/users/{user_id}'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s)).sub('{' + 'tenant_id' + '}', CGI.escape(tenant_id.to_s)).sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s))
220
+
221
+ # query parameters
222
+ query_params = opts[:query_params] || {}
223
+
224
+ # header parameters
225
+ header_params = opts[:header_params] || {}
226
+ # HTTP header 'Accept' (if needed)
227
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
228
+
229
+ # form parameters
230
+ form_params = opts[:form_params] || {}
231
+
232
+ # http body (model)
233
+ post_body = opts[:debug_body]
234
+
235
+ # return_type
236
+ return_type = opts[:debug_return_type]
237
+
238
+ # auth_names
239
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
240
+
241
+ new_options = opts.merge(
242
+ :operation => :"TenantsApi.delete_tenant_user",
243
+ :header_params => header_params,
244
+ :query_params => query_params,
245
+ :form_params => form_params,
246
+ :body => post_body,
247
+ :auth_names => auth_names,
248
+ :return_type => return_type
249
+ )
250
+
251
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
252
+ if @api_client.config.debugging
253
+ @api_client.config.logger.debug "API called: TenantsApi#delete_tenant_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
254
+ end
255
+ return data, status_code, headers
256
+ end
257
+
258
+ # Get Tenant
259
+ # Gets a tenant, if such tenant exists. Otherwise returns 404.
260
+ # @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \&quot;slug\&quot;).
261
+ # @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \&quot;slug\&quot;).
262
+ # @param tenant_id [String] Either the unique id of the tenant, or the URL-friendly key of the tenant (i.e: the \&quot;slug\&quot;).
263
+ # @param [Hash] opts the optional parameters
264
+ # @return [TenantRead]
265
+ def get_tenant(proj_id, env_id, tenant_id, opts = {})
266
+ data, _status_code, _headers = get_tenant_with_http_info(proj_id, env_id, tenant_id, opts)
267
+ data
268
+ end
269
+
270
+ # Get Tenant
271
+ # Gets a tenant, if such tenant exists. Otherwise returns 404.
272
+ # @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \&quot;slug\&quot;).
273
+ # @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \&quot;slug\&quot;).
274
+ # @param tenant_id [String] Either the unique id of the tenant, or the URL-friendly key of the tenant (i.e: the \&quot;slug\&quot;).
275
+ # @param [Hash] opts the optional parameters
276
+ # @return [Array<(TenantRead, Integer, Hash)>] TenantRead data, response status code and response headers
277
+ def get_tenant_with_http_info(proj_id, env_id, tenant_id, opts = {})
278
+ if @api_client.config.debugging
279
+ @api_client.config.logger.debug 'Calling API: TenantsApi.get_tenant ...'
280
+ end
281
+ # verify the required parameter 'proj_id' is set
282
+ if @api_client.config.client_side_validation && proj_id.nil?
283
+ fail ArgumentError, "Missing the required parameter 'proj_id' when calling TenantsApi.get_tenant"
284
+ end
285
+ # verify the required parameter 'env_id' is set
286
+ if @api_client.config.client_side_validation && env_id.nil?
287
+ fail ArgumentError, "Missing the required parameter 'env_id' when calling TenantsApi.get_tenant"
288
+ end
289
+ # verify the required parameter 'tenant_id' is set
290
+ if @api_client.config.client_side_validation && tenant_id.nil?
291
+ fail ArgumentError, "Missing the required parameter 'tenant_id' when calling TenantsApi.get_tenant"
292
+ end
293
+ # resource path
294
+ local_var_path = '/v2/facts/{proj_id}/{env_id}/tenants/{tenant_id}'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s)).sub('{' + 'tenant_id' + '}', CGI.escape(tenant_id.to_s))
295
+
296
+ # query parameters
297
+ query_params = opts[:query_params] || {}
298
+
299
+ # header parameters
300
+ header_params = opts[:header_params] || {}
301
+ # HTTP header 'Accept' (if needed)
302
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
303
+
304
+ # form parameters
305
+ form_params = opts[:form_params] || {}
306
+
307
+ # http body (model)
308
+ post_body = opts[:debug_body]
309
+
310
+ # return_type
311
+ return_type = opts[:debug_return_type] || 'TenantRead'
312
+
313
+ # auth_names
314
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
315
+
316
+ new_options = opts.merge(
317
+ :operation => :"TenantsApi.get_tenant",
318
+ :header_params => header_params,
319
+ :query_params => query_params,
320
+ :form_params => form_params,
321
+ :body => post_body,
322
+ :auth_names => auth_names,
323
+ :return_type => return_type
324
+ )
325
+
326
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
327
+ if @api_client.config.debugging
328
+ @api_client.config.logger.debug "API called: TenantsApi#get_tenant\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
329
+ end
330
+ return data, status_code, headers
331
+ end
332
+
333
+ # List Tenant Users
334
+ # @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \&quot;slug\&quot;).
335
+ # @param tenant_id [String] Either the unique id of the tenant, or the URL-friendly key of the tenant (i.e: the \&quot;slug\&quot;).
336
+ # @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \&quot;slug\&quot;).
337
+ # @param [Hash] opts the optional parameters
338
+ # @option opts [String] :search Text search for the email field
339
+ # @option opts [Integer] :page Page number of the results to fetch, starting at 1. (default to 1)
340
+ # @option opts [Integer] :per_page The number of results per page (max 100). (default to 30)
341
+ # @return [PaginatedResultUserRead]
342
+ def list_tenant_users(proj_id, tenant_id, env_id, opts = {})
343
+ data, _status_code, _headers = list_tenant_users_with_http_info(proj_id, tenant_id, env_id, opts)
344
+ data
345
+ end
346
+
347
+ # List Tenant Users
348
+ # @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \&quot;slug\&quot;).
349
+ # @param tenant_id [String] Either the unique id of the tenant, or the URL-friendly key of the tenant (i.e: the \&quot;slug\&quot;).
350
+ # @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \&quot;slug\&quot;).
351
+ # @param [Hash] opts the optional parameters
352
+ # @option opts [String] :search Text search for the email field
353
+ # @option opts [Integer] :page Page number of the results to fetch, starting at 1. (default to 1)
354
+ # @option opts [Integer] :per_page The number of results per page (max 100). (default to 30)
355
+ # @return [Array<(PaginatedResultUserRead, Integer, Hash)>] PaginatedResultUserRead data, response status code and response headers
356
+ def list_tenant_users_with_http_info(proj_id, tenant_id, env_id, opts = {})
357
+ if @api_client.config.debugging
358
+ @api_client.config.logger.debug 'Calling API: TenantsApi.list_tenant_users ...'
359
+ end
360
+ # verify the required parameter 'proj_id' is set
361
+ if @api_client.config.client_side_validation && proj_id.nil?
362
+ fail ArgumentError, "Missing the required parameter 'proj_id' when calling TenantsApi.list_tenant_users"
363
+ end
364
+ # verify the required parameter 'tenant_id' is set
365
+ if @api_client.config.client_side_validation && tenant_id.nil?
366
+ fail ArgumentError, "Missing the required parameter 'tenant_id' when calling TenantsApi.list_tenant_users"
367
+ end
368
+ # verify the required parameter 'env_id' is set
369
+ if @api_client.config.client_side_validation && env_id.nil?
370
+ fail ArgumentError, "Missing the required parameter 'env_id' when calling TenantsApi.list_tenant_users"
371
+ end
372
+ if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
373
+ fail ArgumentError, 'invalid value for "opts[:"page"]" when calling TenantsApi.list_tenant_users, must be greater than or equal to 1.'
374
+ end
375
+
376
+ if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] > 100
377
+ fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling TenantsApi.list_tenant_users, must be smaller than or equal to 100.'
378
+ end
379
+
380
+ if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] < 1
381
+ fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling TenantsApi.list_tenant_users, must be greater than or equal to 1.'
382
+ end
383
+
384
+ # resource path
385
+ local_var_path = '/v2/facts/{proj_id}/{env_id}/tenants/{tenant_id}/users'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'tenant_id' + '}', CGI.escape(tenant_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s))
386
+
387
+ # query parameters
388
+ query_params = opts[:query_params] || {}
389
+ query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?
390
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
391
+ query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
392
+
393
+ # header parameters
394
+ header_params = opts[:header_params] || {}
395
+ # HTTP header 'Accept' (if needed)
396
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
397
+
398
+ # form parameters
399
+ form_params = opts[:form_params] || {}
400
+
401
+ # http body (model)
402
+ post_body = opts[:debug_body]
403
+
404
+ # return_type
405
+ return_type = opts[:debug_return_type] || 'PaginatedResultUserRead'
406
+
407
+ # auth_names
408
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
409
+
410
+ new_options = opts.merge(
411
+ :operation => :"TenantsApi.list_tenant_users",
412
+ :header_params => header_params,
413
+ :query_params => query_params,
414
+ :form_params => form_params,
415
+ :body => post_body,
416
+ :auth_names => auth_names,
417
+ :return_type => return_type
418
+ )
419
+
420
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
421
+ if @api_client.config.debugging
422
+ @api_client.config.logger.debug "API called: TenantsApi#list_tenant_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
423
+ end
424
+ return data, status_code, headers
425
+ end
426
+
427
+ # List Tenants
428
+ # Lists all the tenants defined within an environment.
429
+ # @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \&quot;slug\&quot;).
430
+ # @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \&quot;slug\&quot;).
431
+ # @param [Hash] opts the optional parameters
432
+ # @option opts [String] :search Text search for the tenant name or key
433
+ # @option opts [Integer] :page Page number of the results to fetch, starting at 1. (default to 1)
434
+ # @option opts [Integer] :per_page The number of results per page (max 100). (default to 30)
435
+ # @return [Array<TenantRead>]
436
+ def list_tenants(proj_id, env_id, opts = {})
437
+ data, _status_code, _headers = list_tenants_with_http_info(proj_id, env_id, opts)
438
+ data
439
+ end
440
+
441
+ # List Tenants
442
+ # Lists all the tenants defined within an environment.
443
+ # @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \&quot;slug\&quot;).
444
+ # @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \&quot;slug\&quot;).
445
+ # @param [Hash] opts the optional parameters
446
+ # @option opts [String] :search Text search for the tenant name or key
447
+ # @option opts [Integer] :page Page number of the results to fetch, starting at 1. (default to 1)
448
+ # @option opts [Integer] :per_page The number of results per page (max 100). (default to 30)
449
+ # @return [Array<(Array<TenantRead>, Integer, Hash)>] Array<TenantRead> data, response status code and response headers
450
+ def list_tenants_with_http_info(proj_id, env_id, opts = {})
451
+ if @api_client.config.debugging
452
+ @api_client.config.logger.debug 'Calling API: TenantsApi.list_tenants ...'
453
+ end
454
+ # verify the required parameter 'proj_id' is set
455
+ if @api_client.config.client_side_validation && proj_id.nil?
456
+ fail ArgumentError, "Missing the required parameter 'proj_id' when calling TenantsApi.list_tenants"
457
+ end
458
+ # verify the required parameter 'env_id' is set
459
+ if @api_client.config.client_side_validation && env_id.nil?
460
+ fail ArgumentError, "Missing the required parameter 'env_id' when calling TenantsApi.list_tenants"
461
+ end
462
+ if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
463
+ fail ArgumentError, 'invalid value for "opts[:"page"]" when calling TenantsApi.list_tenants, must be greater than or equal to 1.'
464
+ end
465
+
466
+ if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] > 100
467
+ fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling TenantsApi.list_tenants, must be smaller than or equal to 100.'
468
+ end
469
+
470
+ if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] < 1
471
+ fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling TenantsApi.list_tenants, must be greater than or equal to 1.'
472
+ end
473
+
474
+ # resource path
475
+ local_var_path = '/v2/facts/{proj_id}/{env_id}/tenants'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s))
476
+
477
+ # query parameters
478
+ query_params = opts[:query_params] || {}
479
+ query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?
480
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
481
+ query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
482
+
483
+ # header parameters
484
+ header_params = opts[:header_params] || {}
485
+ # HTTP header 'Accept' (if needed)
486
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
487
+
488
+ # form parameters
489
+ form_params = opts[:form_params] || {}
490
+
491
+ # http body (model)
492
+ post_body = opts[:debug_body]
493
+
494
+ # return_type
495
+ return_type = opts[:debug_return_type] || 'Array<TenantRead>'
496
+
497
+ # auth_names
498
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
499
+
500
+ new_options = opts.merge(
501
+ :operation => :"TenantsApi.list_tenants",
502
+ :header_params => header_params,
503
+ :query_params => query_params,
504
+ :form_params => form_params,
505
+ :body => post_body,
506
+ :auth_names => auth_names,
507
+ :return_type => return_type
508
+ )
509
+
510
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
511
+ if @api_client.config.debugging
512
+ @api_client.config.logger.debug "API called: TenantsApi#list_tenants\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
513
+ end
514
+ return data, status_code, headers
515
+ end
516
+
517
+ # Update Tenant
518
+ # Partially updates the tenant definition. Fields that will be provided will be completely overwritten.
519
+ # @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \&quot;slug\&quot;).
520
+ # @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \&quot;slug\&quot;).
521
+ # @param tenant_id [String] Either the unique id of the tenant, or the URL-friendly key of the tenant (i.e: the \&quot;slug\&quot;).
522
+ # @param tenant_update [TenantUpdate]
523
+ # @param [Hash] opts the optional parameters
524
+ # @return [TenantRead]
525
+ def update_tenant(proj_id, env_id, tenant_id, tenant_update, opts = {})
526
+ data, _status_code, _headers = update_tenant_with_http_info(proj_id, env_id, tenant_id, tenant_update, opts)
527
+ data
528
+ end
529
+
530
+ # Update Tenant
531
+ # Partially updates the tenant definition. Fields that will be provided will be completely overwritten.
532
+ # @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \&quot;slug\&quot;).
533
+ # @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \&quot;slug\&quot;).
534
+ # @param tenant_id [String] Either the unique id of the tenant, or the URL-friendly key of the tenant (i.e: the \&quot;slug\&quot;).
535
+ # @param tenant_update [TenantUpdate]
536
+ # @param [Hash] opts the optional parameters
537
+ # @return [Array<(TenantRead, Integer, Hash)>] TenantRead data, response status code and response headers
538
+ def update_tenant_with_http_info(proj_id, env_id, tenant_id, tenant_update, opts = {})
539
+ if @api_client.config.debugging
540
+ @api_client.config.logger.debug 'Calling API: TenantsApi.update_tenant ...'
541
+ end
542
+ # verify the required parameter 'proj_id' is set
543
+ if @api_client.config.client_side_validation && proj_id.nil?
544
+ fail ArgumentError, "Missing the required parameter 'proj_id' when calling TenantsApi.update_tenant"
545
+ end
546
+ # verify the required parameter 'env_id' is set
547
+ if @api_client.config.client_side_validation && env_id.nil?
548
+ fail ArgumentError, "Missing the required parameter 'env_id' when calling TenantsApi.update_tenant"
549
+ end
550
+ # verify the required parameter 'tenant_id' is set
551
+ if @api_client.config.client_side_validation && tenant_id.nil?
552
+ fail ArgumentError, "Missing the required parameter 'tenant_id' when calling TenantsApi.update_tenant"
553
+ end
554
+ # verify the required parameter 'tenant_update' is set
555
+ if @api_client.config.client_side_validation && tenant_update.nil?
556
+ fail ArgumentError, "Missing the required parameter 'tenant_update' when calling TenantsApi.update_tenant"
557
+ end
558
+ # resource path
559
+ local_var_path = '/v2/facts/{proj_id}/{env_id}/tenants/{tenant_id}'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s)).sub('{' + 'tenant_id' + '}', CGI.escape(tenant_id.to_s))
560
+
561
+ # query parameters
562
+ query_params = opts[:query_params] || {}
563
+
564
+ # header parameters
565
+ header_params = opts[:header_params] || {}
566
+ # HTTP header 'Accept' (if needed)
567
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
568
+ # HTTP header 'Content-Type'
569
+ content_type = @api_client.select_header_content_type(['application/json'])
570
+ if !content_type.nil?
571
+ header_params['Content-Type'] = content_type
572
+ end
573
+
574
+ # form parameters
575
+ form_params = opts[:form_params] || {}
576
+
577
+ # http body (model)
578
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(tenant_update)
579
+
580
+ # return_type
581
+ return_type = opts[:debug_return_type] || 'TenantRead'
582
+
583
+ # auth_names
584
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
585
+
586
+ new_options = opts.merge(
587
+ :operation => :"TenantsApi.update_tenant",
588
+ :header_params => header_params,
589
+ :query_params => query_params,
590
+ :form_params => form_params,
591
+ :body => post_body,
592
+ :auth_names => auth_names,
593
+ :return_type => return_type
594
+ )
595
+
596
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
597
+ if @api_client.config.debugging
598
+ @api_client.config.logger.debug "API called: TenantsApi#update_tenant\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
599
+ end
600
+ return data, status_code, headers
601
+ end
602
+ end
603
+ end