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,462 @@
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 EnvironmentsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create Environment
23
+ # Creates a new environment under a given project.
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 environment_create [EnvironmentCreate]
26
+ # @param [Hash] opts the optional parameters
27
+ # @return [EnvironmentRead]
28
+ def create_environment(proj_id, environment_create, opts = {})
29
+ data, _status_code, _headers = create_environment_with_http_info(proj_id, environment_create, opts)
30
+ data
31
+ end
32
+
33
+ # Create Environment
34
+ # Creates a new environment under a given project.
35
+ # @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
36
+ # @param environment_create [EnvironmentCreate]
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [Array<(EnvironmentRead, Integer, Hash)>] EnvironmentRead data, response status code and response headers
39
+ def create_environment_with_http_info(proj_id, environment_create, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: EnvironmentsApi.create_environment ...'
42
+ end
43
+ # verify the required parameter 'proj_id' is set
44
+ if @api_client.config.client_side_validation && proj_id.nil?
45
+ fail ArgumentError, "Missing the required parameter 'proj_id' when calling EnvironmentsApi.create_environment"
46
+ end
47
+ # verify the required parameter 'environment_create' is set
48
+ if @api_client.config.client_side_validation && environment_create.nil?
49
+ fail ArgumentError, "Missing the required parameter 'environment_create' when calling EnvironmentsApi.create_environment"
50
+ end
51
+ # resource path
52
+ local_var_path = '/v2/projects/{proj_id}/envs'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s))
53
+
54
+ # query parameters
55
+ query_params = opts[:query_params] || {}
56
+
57
+ # header parameters
58
+ header_params = opts[:header_params] || {}
59
+ # HTTP header 'Accept' (if needed)
60
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
61
+ # HTTP header 'Content-Type'
62
+ content_type = @api_client.select_header_content_type(['application/json'])
63
+ if !content_type.nil?
64
+ header_params['Content-Type'] = content_type
65
+ end
66
+
67
+ # form parameters
68
+ form_params = opts[:form_params] || {}
69
+
70
+ # http body (model)
71
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(environment_create)
72
+
73
+ # return_type
74
+ return_type = opts[:debug_return_type] || 'EnvironmentRead'
75
+
76
+ # auth_names
77
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
78
+
79
+ new_options = opts.merge(
80
+ :operation => :"EnvironmentsApi.create_environment",
81
+ :header_params => header_params,
82
+ :query_params => query_params,
83
+ :form_params => form_params,
84
+ :body => post_body,
85
+ :auth_names => auth_names,
86
+ :return_type => return_type
87
+ )
88
+
89
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
90
+ if @api_client.config.debugging
91
+ @api_client.config.logger.debug "API called: EnvironmentsApi#create_environment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
92
+ end
93
+ return data, status_code, headers
94
+ end
95
+
96
+ # Delete Environment
97
+ # Deletes an environment and all its related data.
98
+ # @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;).
99
+ # @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;).
100
+ # @param [Hash] opts the optional parameters
101
+ # @return [nil]
102
+ def delete_environment(proj_id, env_id, opts = {})
103
+ delete_environment_with_http_info(proj_id, env_id, opts)
104
+ nil
105
+ end
106
+
107
+ # Delete Environment
108
+ # Deletes an environment and all its related data.
109
+ # @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;).
110
+ # @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;).
111
+ # @param [Hash] opts the optional parameters
112
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
113
+ def delete_environment_with_http_info(proj_id, env_id, opts = {})
114
+ if @api_client.config.debugging
115
+ @api_client.config.logger.debug 'Calling API: EnvironmentsApi.delete_environment ...'
116
+ end
117
+ # verify the required parameter 'proj_id' is set
118
+ if @api_client.config.client_side_validation && proj_id.nil?
119
+ fail ArgumentError, "Missing the required parameter 'proj_id' when calling EnvironmentsApi.delete_environment"
120
+ end
121
+ # verify the required parameter 'env_id' is set
122
+ if @api_client.config.client_side_validation && env_id.nil?
123
+ fail ArgumentError, "Missing the required parameter 'env_id' when calling EnvironmentsApi.delete_environment"
124
+ end
125
+ # resource path
126
+ local_var_path = '/v2/projects/{proj_id}/envs/{env_id}'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s))
127
+
128
+ # query parameters
129
+ query_params = opts[:query_params] || {}
130
+
131
+ # header parameters
132
+ header_params = opts[:header_params] || {}
133
+ # HTTP header 'Accept' (if needed)
134
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
135
+
136
+ # form parameters
137
+ form_params = opts[:form_params] || {}
138
+
139
+ # http body (model)
140
+ post_body = opts[:debug_body]
141
+
142
+ # return_type
143
+ return_type = opts[:debug_return_type]
144
+
145
+ # auth_names
146
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
147
+
148
+ new_options = opts.merge(
149
+ :operation => :"EnvironmentsApi.delete_environment",
150
+ :header_params => header_params,
151
+ :query_params => query_params,
152
+ :form_params => form_params,
153
+ :body => post_body,
154
+ :auth_names => auth_names,
155
+ :return_type => return_type
156
+ )
157
+
158
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
159
+ if @api_client.config.debugging
160
+ @api_client.config.logger.debug "API called: EnvironmentsApi#delete_environment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
161
+ end
162
+ return data, status_code, headers
163
+ end
164
+
165
+ # Get Environment
166
+ # Gets a single environment matching the given env_id, if such environment exists.
167
+ # @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;).
168
+ # @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;).
169
+ # @param [Hash] opts the optional parameters
170
+ # @return [EnvironmentRead]
171
+ def get_environment(proj_id, env_id, opts = {})
172
+ data, _status_code, _headers = get_environment_with_http_info(proj_id, env_id, opts)
173
+ data
174
+ end
175
+
176
+ # Get Environment
177
+ # Gets a single environment matching the given env_id, if such environment exists.
178
+ # @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;).
179
+ # @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;).
180
+ # @param [Hash] opts the optional parameters
181
+ # @return [Array<(EnvironmentRead, Integer, Hash)>] EnvironmentRead data, response status code and response headers
182
+ def get_environment_with_http_info(proj_id, env_id, opts = {})
183
+ if @api_client.config.debugging
184
+ @api_client.config.logger.debug 'Calling API: EnvironmentsApi.get_environment ...'
185
+ end
186
+ # verify the required parameter 'proj_id' is set
187
+ if @api_client.config.client_side_validation && proj_id.nil?
188
+ fail ArgumentError, "Missing the required parameter 'proj_id' when calling EnvironmentsApi.get_environment"
189
+ end
190
+ # verify the required parameter 'env_id' is set
191
+ if @api_client.config.client_side_validation && env_id.nil?
192
+ fail ArgumentError, "Missing the required parameter 'env_id' when calling EnvironmentsApi.get_environment"
193
+ end
194
+ # resource path
195
+ local_var_path = '/v2/projects/{proj_id}/envs/{env_id}'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s))
196
+
197
+ # query parameters
198
+ query_params = opts[:query_params] || {}
199
+
200
+ # header parameters
201
+ header_params = opts[:header_params] || {}
202
+ # HTTP header 'Accept' (if needed)
203
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
204
+
205
+ # form parameters
206
+ form_params = opts[:form_params] || {}
207
+
208
+ # http body (model)
209
+ post_body = opts[:debug_body]
210
+
211
+ # return_type
212
+ return_type = opts[:debug_return_type] || 'EnvironmentRead'
213
+
214
+ # auth_names
215
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
216
+
217
+ new_options = opts.merge(
218
+ :operation => :"EnvironmentsApi.get_environment",
219
+ :header_params => header_params,
220
+ :query_params => query_params,
221
+ :form_params => form_params,
222
+ :body => post_body,
223
+ :auth_names => auth_names,
224
+ :return_type => return_type
225
+ )
226
+
227
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
228
+ if @api_client.config.debugging
229
+ @api_client.config.logger.debug "API called: EnvironmentsApi#get_environment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
230
+ end
231
+ return data, status_code, headers
232
+ end
233
+
234
+ # List Environments
235
+ # Lists all the environments under a given project.
236
+ # @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;).
237
+ # @param [Hash] opts the optional parameters
238
+ # @option opts [Integer] :page Page number of the results to fetch, starting at 1. (default to 1)
239
+ # @option opts [Integer] :per_page The number of results per page (max 100). (default to 30)
240
+ # @return [Array<EnvironmentRead>]
241
+ def list_environments(proj_id, opts = {})
242
+ data, _status_code, _headers = list_environments_with_http_info(proj_id, opts)
243
+ data
244
+ end
245
+
246
+ # List Environments
247
+ # Lists all the environments under a given project.
248
+ # @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;).
249
+ # @param [Hash] opts the optional parameters
250
+ # @option opts [Integer] :page Page number of the results to fetch, starting at 1. (default to 1)
251
+ # @option opts [Integer] :per_page The number of results per page (max 100). (default to 30)
252
+ # @return [Array<(Array<EnvironmentRead>, Integer, Hash)>] Array<EnvironmentRead> data, response status code and response headers
253
+ def list_environments_with_http_info(proj_id, opts = {})
254
+ if @api_client.config.debugging
255
+ @api_client.config.logger.debug 'Calling API: EnvironmentsApi.list_environments ...'
256
+ end
257
+ # verify the required parameter 'proj_id' is set
258
+ if @api_client.config.client_side_validation && proj_id.nil?
259
+ fail ArgumentError, "Missing the required parameter 'proj_id' when calling EnvironmentsApi.list_environments"
260
+ end
261
+ if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
262
+ fail ArgumentError, 'invalid value for "opts[:"page"]" when calling EnvironmentsApi.list_environments, must be greater than or equal to 1.'
263
+ end
264
+
265
+ if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] > 100
266
+ fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling EnvironmentsApi.list_environments, must be smaller than or equal to 100.'
267
+ end
268
+
269
+ if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] < 1
270
+ fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling EnvironmentsApi.list_environments, must be greater than or equal to 1.'
271
+ end
272
+
273
+ # resource path
274
+ local_var_path = '/v2/projects/{proj_id}/envs'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s))
275
+
276
+ # query parameters
277
+ query_params = opts[:query_params] || {}
278
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
279
+ query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
280
+
281
+ # header parameters
282
+ header_params = opts[:header_params] || {}
283
+ # HTTP header 'Accept' (if needed)
284
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
285
+
286
+ # form parameters
287
+ form_params = opts[:form_params] || {}
288
+
289
+ # http body (model)
290
+ post_body = opts[:debug_body]
291
+
292
+ # return_type
293
+ return_type = opts[:debug_return_type] || 'Array<EnvironmentRead>'
294
+
295
+ # auth_names
296
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
297
+
298
+ new_options = opts.merge(
299
+ :operation => :"EnvironmentsApi.list_environments",
300
+ :header_params => header_params,
301
+ :query_params => query_params,
302
+ :form_params => form_params,
303
+ :body => post_body,
304
+ :auth_names => auth_names,
305
+ :return_type => return_type
306
+ )
307
+
308
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
309
+ if @api_client.config.debugging
310
+ @api_client.config.logger.debug "API called: EnvironmentsApi#list_environments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
311
+ end
312
+ return data, status_code, headers
313
+ end
314
+
315
+ # Stats Environments
316
+ # @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;).
317
+ # @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;).
318
+ # @param [Hash] opts the optional parameters
319
+ # @return [EnvironmentStats]
320
+ def stats_environments(proj_id, env_id, opts = {})
321
+ data, _status_code, _headers = stats_environments_with_http_info(proj_id, env_id, opts)
322
+ data
323
+ end
324
+
325
+ # Stats Environments
326
+ # @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;).
327
+ # @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;).
328
+ # @param [Hash] opts the optional parameters
329
+ # @return [Array<(EnvironmentStats, Integer, Hash)>] EnvironmentStats data, response status code and response headers
330
+ def stats_environments_with_http_info(proj_id, env_id, opts = {})
331
+ if @api_client.config.debugging
332
+ @api_client.config.logger.debug 'Calling API: EnvironmentsApi.stats_environments ...'
333
+ end
334
+ # verify the required parameter 'proj_id' is set
335
+ if @api_client.config.client_side_validation && proj_id.nil?
336
+ fail ArgumentError, "Missing the required parameter 'proj_id' when calling EnvironmentsApi.stats_environments"
337
+ end
338
+ # verify the required parameter 'env_id' is set
339
+ if @api_client.config.client_side_validation && env_id.nil?
340
+ fail ArgumentError, "Missing the required parameter 'env_id' when calling EnvironmentsApi.stats_environments"
341
+ end
342
+ # resource path
343
+ local_var_path = '/v2/projects/{proj_id}/envs/{env_id}/stats'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s))
344
+
345
+ # query parameters
346
+ query_params = opts[:query_params] || {}
347
+
348
+ # header parameters
349
+ header_params = opts[:header_params] || {}
350
+ # HTTP header 'Accept' (if needed)
351
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
352
+
353
+ # form parameters
354
+ form_params = opts[:form_params] || {}
355
+
356
+ # http body (model)
357
+ post_body = opts[:debug_body]
358
+
359
+ # return_type
360
+ return_type = opts[:debug_return_type] || 'EnvironmentStats'
361
+
362
+ # auth_names
363
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
364
+
365
+ new_options = opts.merge(
366
+ :operation => :"EnvironmentsApi.stats_environments",
367
+ :header_params => header_params,
368
+ :query_params => query_params,
369
+ :form_params => form_params,
370
+ :body => post_body,
371
+ :auth_names => auth_names,
372
+ :return_type => return_type
373
+ )
374
+
375
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
376
+ if @api_client.config.debugging
377
+ @api_client.config.logger.debug "API called: EnvironmentsApi#stats_environments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
378
+ end
379
+ return data, status_code, headers
380
+ end
381
+
382
+ # Update Environment
383
+ # Updates the environment.
384
+ # @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;).
385
+ # @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;).
386
+ # @param environment_update [EnvironmentUpdate]
387
+ # @param [Hash] opts the optional parameters
388
+ # @return [EnvironmentRead]
389
+ def update_environment(proj_id, env_id, environment_update, opts = {})
390
+ data, _status_code, _headers = update_environment_with_http_info(proj_id, env_id, environment_update, opts)
391
+ data
392
+ end
393
+
394
+ # Update Environment
395
+ # Updates the environment.
396
+ # @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;).
397
+ # @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;).
398
+ # @param environment_update [EnvironmentUpdate]
399
+ # @param [Hash] opts the optional parameters
400
+ # @return [Array<(EnvironmentRead, Integer, Hash)>] EnvironmentRead data, response status code and response headers
401
+ def update_environment_with_http_info(proj_id, env_id, environment_update, opts = {})
402
+ if @api_client.config.debugging
403
+ @api_client.config.logger.debug 'Calling API: EnvironmentsApi.update_environment ...'
404
+ end
405
+ # verify the required parameter 'proj_id' is set
406
+ if @api_client.config.client_side_validation && proj_id.nil?
407
+ fail ArgumentError, "Missing the required parameter 'proj_id' when calling EnvironmentsApi.update_environment"
408
+ end
409
+ # verify the required parameter 'env_id' is set
410
+ if @api_client.config.client_side_validation && env_id.nil?
411
+ fail ArgumentError, "Missing the required parameter 'env_id' when calling EnvironmentsApi.update_environment"
412
+ end
413
+ # verify the required parameter 'environment_update' is set
414
+ if @api_client.config.client_side_validation && environment_update.nil?
415
+ fail ArgumentError, "Missing the required parameter 'environment_update' when calling EnvironmentsApi.update_environment"
416
+ end
417
+ # resource path
418
+ local_var_path = '/v2/projects/{proj_id}/envs/{env_id}'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s))
419
+
420
+ # query parameters
421
+ query_params = opts[:query_params] || {}
422
+
423
+ # header parameters
424
+ header_params = opts[:header_params] || {}
425
+ # HTTP header 'Accept' (if needed)
426
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
427
+ # HTTP header 'Content-Type'
428
+ content_type = @api_client.select_header_content_type(['application/json'])
429
+ if !content_type.nil?
430
+ header_params['Content-Type'] = content_type
431
+ end
432
+
433
+ # form parameters
434
+ form_params = opts[:form_params] || {}
435
+
436
+ # http body (model)
437
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(environment_update)
438
+
439
+ # return_type
440
+ return_type = opts[:debug_return_type] || 'EnvironmentRead'
441
+
442
+ # auth_names
443
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
444
+
445
+ new_options = opts.merge(
446
+ :operation => :"EnvironmentsApi.update_environment",
447
+ :header_params => header_params,
448
+ :query_params => query_params,
449
+ :form_params => form_params,
450
+ :body => post_body,
451
+ :auth_names => auth_names,
452
+ :return_type => return_type
453
+ )
454
+
455
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
456
+ if @api_client.config.debugging
457
+ @api_client.config.logger.debug "API called: EnvironmentsApi#update_environment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
458
+ end
459
+ return data, status_code, headers
460
+ end
461
+ end
462
+ end
@@ -0,0 +1,91 @@
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 InstructionsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # List Language Instructions
23
+ # Lists pending organization invites
24
+ # @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;).
25
+ # @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;).
26
+ # @param [Hash] opts the optional parameters
27
+ # @return [Array<LanguageInstructions>]
28
+ def list_language_instructions(proj_id, env_id, opts = {})
29
+ data, _status_code, _headers = list_language_instructions_with_http_info(proj_id, env_id, opts)
30
+ data
31
+ end
32
+
33
+ # List Language Instructions
34
+ # Lists pending organization invites
35
+ # @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;).
36
+ # @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;).
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [Array<(Array<LanguageInstructions>, Integer, Hash)>] Array<LanguageInstructions> data, response status code and response headers
39
+ def list_language_instructions_with_http_info(proj_id, env_id, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: InstructionsApi.list_language_instructions ...'
42
+ end
43
+ # verify the required parameter 'proj_id' is set
44
+ if @api_client.config.client_side_validation && proj_id.nil?
45
+ fail ArgumentError, "Missing the required parameter 'proj_id' when calling InstructionsApi.list_language_instructions"
46
+ end
47
+ # verify the required parameter 'env_id' is set
48
+ if @api_client.config.client_side_validation && env_id.nil?
49
+ fail ArgumentError, "Missing the required parameter 'env_id' when calling InstructionsApi.list_language_instructions"
50
+ end
51
+ # resource path
52
+ local_var_path = '/v2/{proj_id}/{env_id}/get_instructions'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s))
53
+
54
+ # query parameters
55
+ query_params = opts[:query_params] || {}
56
+
57
+ # header parameters
58
+ header_params = opts[:header_params] || {}
59
+ # HTTP header 'Accept' (if needed)
60
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
61
+
62
+ # form parameters
63
+ form_params = opts[:form_params] || {}
64
+
65
+ # http body (model)
66
+ post_body = opts[:debug_body]
67
+
68
+ # return_type
69
+ return_type = opts[:debug_return_type] || 'Array<LanguageInstructions>'
70
+
71
+ # auth_names
72
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
73
+
74
+ new_options = opts.merge(
75
+ :operation => :"InstructionsApi.list_language_instructions",
76
+ :header_params => header_params,
77
+ :query_params => query_params,
78
+ :form_params => form_params,
79
+ :body => post_body,
80
+ :auth_names => auth_names,
81
+ :return_type => return_type
82
+ )
83
+
84
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
85
+ if @api_client.config.debugging
86
+ @api_client.config.logger.debug "API called: InstructionsApi#list_language_instructions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
87
+ end
88
+ return data, status_code, headers
89
+ end
90
+ end
91
+ end