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,510 @@
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 PolicyGitRepositoriesApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Activate Policy Repo
23
+ # Disable the currently active policy repo, this action means to turn off the gitops feature. If there is no active policy repo, this action will do nothing.
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 repo_id [String] Either the unique id of the policy repo, or the URL-friendly key of the policy repo (i.e: the \"slug\").
26
+ # @param [Hash] opts the optional parameters
27
+ # @return [ProjectRead]
28
+ def activate_policy_repo(proj_id, repo_id, opts = {})
29
+ data, _status_code, _headers = activate_policy_repo_with_http_info(proj_id, repo_id, opts)
30
+ data
31
+ end
32
+
33
+ # Activate Policy Repo
34
+ # Disable the currently active policy repo, this action means to turn off the gitops feature. If there is no active policy repo, this action will do nothing.
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 repo_id [String] Either the unique id of the policy repo, or the URL-friendly key of the policy repo (i.e: the \"slug\").
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [Array<(ProjectRead, Integer, Hash)>] ProjectRead data, response status code and response headers
39
+ def activate_policy_repo_with_http_info(proj_id, repo_id, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: PolicyGitRepositoriesApi.activate_policy_repo ...'
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 PolicyGitRepositoriesApi.activate_policy_repo"
46
+ end
47
+ # verify the required parameter 'repo_id' is set
48
+ if @api_client.config.client_side_validation && repo_id.nil?
49
+ fail ArgumentError, "Missing the required parameter 'repo_id' when calling PolicyGitRepositoriesApi.activate_policy_repo"
50
+ end
51
+ # resource path
52
+ local_var_path = '/v2/projects/{proj_id}/repos/{repo_id}/activate'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'repo_id' + '}', CGI.escape(repo_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] || 'ProjectRead'
70
+
71
+ # auth_names
72
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
73
+
74
+ new_options = opts.merge(
75
+ :operation => :"PolicyGitRepositoriesApi.activate_policy_repo",
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(:PUT, local_var_path, new_options)
85
+ if @api_client.config.debugging
86
+ @api_client.config.logger.debug "API called: PolicyGitRepositoriesApi#activate_policy_repo\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
87
+ end
88
+ return data, status_code, headers
89
+ end
90
+
91
+ # Create Policy Repo
92
+ # Creates a new policy repository configuration under a given project. The given repository is created with status 'pending', it will be changed and used as the 'active' repository for the policy only after a successful attempt to use it. The repository main branch must be present in the remote.
93
+ # @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;).
94
+ # @param policy_repo_create [PolicyRepoCreate]
95
+ # @param [Hash] opts the optional parameters
96
+ # @return [PolicyRepoRead]
97
+ def create_policy_repo(proj_id, policy_repo_create, opts = {})
98
+ data, _status_code, _headers = create_policy_repo_with_http_info(proj_id, policy_repo_create, opts)
99
+ data
100
+ end
101
+
102
+ # Create Policy Repo
103
+ # Creates a new policy repository configuration under a given project. The given repository is created with status &#39;pending&#39;, it will be changed and used as the &#39;active&#39; repository for the policy only after a successful attempt to use it. The repository main branch must be present in the remote.
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 policy_repo_create [PolicyRepoCreate]
106
+ # @param [Hash] opts the optional parameters
107
+ # @return [Array<(PolicyRepoRead, Integer, Hash)>] PolicyRepoRead data, response status code and response headers
108
+ def create_policy_repo_with_http_info(proj_id, policy_repo_create, opts = {})
109
+ if @api_client.config.debugging
110
+ @api_client.config.logger.debug 'Calling API: PolicyGitRepositoriesApi.create_policy_repo ...'
111
+ end
112
+ # verify the required parameter 'proj_id' is set
113
+ if @api_client.config.client_side_validation && proj_id.nil?
114
+ fail ArgumentError, "Missing the required parameter 'proj_id' when calling PolicyGitRepositoriesApi.create_policy_repo"
115
+ end
116
+ # verify the required parameter 'policy_repo_create' is set
117
+ if @api_client.config.client_side_validation && policy_repo_create.nil?
118
+ fail ArgumentError, "Missing the required parameter 'policy_repo_create' when calling PolicyGitRepositoriesApi.create_policy_repo"
119
+ end
120
+ # resource path
121
+ local_var_path = '/v2/projects/{proj_id}/repos'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s))
122
+
123
+ # query parameters
124
+ query_params = opts[:query_params] || {}
125
+
126
+ # header parameters
127
+ header_params = opts[:header_params] || {}
128
+ # HTTP header 'Accept' (if needed)
129
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
130
+ # HTTP header 'Content-Type'
131
+ content_type = @api_client.select_header_content_type(['application/json'])
132
+ if !content_type.nil?
133
+ header_params['Content-Type'] = content_type
134
+ end
135
+
136
+ # form parameters
137
+ form_params = opts[:form_params] || {}
138
+
139
+ # http body (model)
140
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(policy_repo_create)
141
+
142
+ # return_type
143
+ return_type = opts[:debug_return_type] || 'PolicyRepoRead'
144
+
145
+ # auth_names
146
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
147
+
148
+ new_options = opts.merge(
149
+ :operation => :"PolicyGitRepositoriesApi.create_policy_repo",
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(:POST, local_var_path, new_options)
159
+ if @api_client.config.debugging
160
+ @api_client.config.logger.debug "API called: PolicyGitRepositoriesApi#create_policy_repo\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
161
+ end
162
+ return data, status_code, headers
163
+ end
164
+
165
+ # Delete Policy Repo
166
+ # Deletes an environment and all its related data.
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 repo_id [String] Either the unique id of the policy repo, or the URL-friendly key of the policy repo (i.e: the \&quot;slug\&quot;).
169
+ # @param [Hash] opts the optional parameters
170
+ # @return [nil]
171
+ def delete_policy_repo(proj_id, repo_id, opts = {})
172
+ delete_policy_repo_with_http_info(proj_id, repo_id, opts)
173
+ nil
174
+ end
175
+
176
+ # Delete Policy Repo
177
+ # Deletes an environment and all its related data.
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 repo_id [String] Either the unique id of the policy repo, or the URL-friendly key of the policy repo (i.e: the \&quot;slug\&quot;).
180
+ # @param [Hash] opts the optional parameters
181
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
182
+ def delete_policy_repo_with_http_info(proj_id, repo_id, opts = {})
183
+ if @api_client.config.debugging
184
+ @api_client.config.logger.debug 'Calling API: PolicyGitRepositoriesApi.delete_policy_repo ...'
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 PolicyGitRepositoriesApi.delete_policy_repo"
189
+ end
190
+ # verify the required parameter 'repo_id' is set
191
+ if @api_client.config.client_side_validation && repo_id.nil?
192
+ fail ArgumentError, "Missing the required parameter 'repo_id' when calling PolicyGitRepositoriesApi.delete_policy_repo"
193
+ end
194
+ # resource path
195
+ local_var_path = '/v2/projects/{proj_id}/repos/{repo_id}'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'repo_id' + '}', CGI.escape(repo_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]
213
+
214
+ # auth_names
215
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
216
+
217
+ new_options = opts.merge(
218
+ :operation => :"PolicyGitRepositoriesApi.delete_policy_repo",
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(:DELETE, local_var_path, new_options)
228
+ if @api_client.config.debugging
229
+ @api_client.config.logger.debug "API called: PolicyGitRepositoriesApi#delete_policy_repo\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
230
+ end
231
+ return data, status_code, headers
232
+ end
233
+
234
+ # Disable Active Policy Repo
235
+ # Disable the currently active policy repo, this action means to turn off the gitops feature. If there is no active policy repo, this action will do nothing.
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
+ # @return [ProjectRead]
239
+ def disable_active_policy_repo(proj_id, opts = {})
240
+ data, _status_code, _headers = disable_active_policy_repo_with_http_info(proj_id, opts)
241
+ data
242
+ end
243
+
244
+ # Disable Active Policy Repo
245
+ # Disable the currently active policy repo, this action means to turn off the gitops feature. If there is no active policy repo, this action will do nothing.
246
+ # @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;).
247
+ # @param [Hash] opts the optional parameters
248
+ # @return [Array<(ProjectRead, Integer, Hash)>] ProjectRead data, response status code and response headers
249
+ def disable_active_policy_repo_with_http_info(proj_id, opts = {})
250
+ if @api_client.config.debugging
251
+ @api_client.config.logger.debug 'Calling API: PolicyGitRepositoriesApi.disable_active_policy_repo ...'
252
+ end
253
+ # verify the required parameter 'proj_id' is set
254
+ if @api_client.config.client_side_validation && proj_id.nil?
255
+ fail ArgumentError, "Missing the required parameter 'proj_id' when calling PolicyGitRepositoriesApi.disable_active_policy_repo"
256
+ end
257
+ # resource path
258
+ local_var_path = '/v2/projects/{proj_id}/repos/disable'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s))
259
+
260
+ # query parameters
261
+ query_params = opts[:query_params] || {}
262
+
263
+ # header parameters
264
+ header_params = opts[:header_params] || {}
265
+ # HTTP header 'Accept' (if needed)
266
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
267
+
268
+ # form parameters
269
+ form_params = opts[:form_params] || {}
270
+
271
+ # http body (model)
272
+ post_body = opts[:debug_body]
273
+
274
+ # return_type
275
+ return_type = opts[:debug_return_type] || 'ProjectRead'
276
+
277
+ # auth_names
278
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
279
+
280
+ new_options = opts.merge(
281
+ :operation => :"PolicyGitRepositoriesApi.disable_active_policy_repo",
282
+ :header_params => header_params,
283
+ :query_params => query_params,
284
+ :form_params => form_params,
285
+ :body => post_body,
286
+ :auth_names => auth_names,
287
+ :return_type => return_type
288
+ )
289
+
290
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
291
+ if @api_client.config.debugging
292
+ @api_client.config.logger.debug "API called: PolicyGitRepositoriesApi#disable_active_policy_repo\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
293
+ end
294
+ return data, status_code, headers
295
+ end
296
+
297
+ # Get Active Policy Repo
298
+ # Gets the currently active repository, if such repository exists.
299
+ # @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;).
300
+ # @param [Hash] opts the optional parameters
301
+ # @return [PolicyRepoRead]
302
+ def get_active_policy_repo(proj_id, opts = {})
303
+ data, _status_code, _headers = get_active_policy_repo_with_http_info(proj_id, opts)
304
+ data
305
+ end
306
+
307
+ # Get Active Policy Repo
308
+ # Gets the currently active repository, if such repository exists.
309
+ # @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;).
310
+ # @param [Hash] opts the optional parameters
311
+ # @return [Array<(PolicyRepoRead, Integer, Hash)>] PolicyRepoRead data, response status code and response headers
312
+ def get_active_policy_repo_with_http_info(proj_id, opts = {})
313
+ if @api_client.config.debugging
314
+ @api_client.config.logger.debug 'Calling API: PolicyGitRepositoriesApi.get_active_policy_repo ...'
315
+ end
316
+ # verify the required parameter 'proj_id' is set
317
+ if @api_client.config.client_side_validation && proj_id.nil?
318
+ fail ArgumentError, "Missing the required parameter 'proj_id' when calling PolicyGitRepositoriesApi.get_active_policy_repo"
319
+ end
320
+ # resource path
321
+ local_var_path = '/v2/projects/{proj_id}/repos/active'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s))
322
+
323
+ # query parameters
324
+ query_params = opts[:query_params] || {}
325
+
326
+ # header parameters
327
+ header_params = opts[:header_params] || {}
328
+ # HTTP header 'Accept' (if needed)
329
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
330
+
331
+ # form parameters
332
+ form_params = opts[:form_params] || {}
333
+
334
+ # http body (model)
335
+ post_body = opts[:debug_body]
336
+
337
+ # return_type
338
+ return_type = opts[:debug_return_type] || 'PolicyRepoRead'
339
+
340
+ # auth_names
341
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
342
+
343
+ new_options = opts.merge(
344
+ :operation => :"PolicyGitRepositoriesApi.get_active_policy_repo",
345
+ :header_params => header_params,
346
+ :query_params => query_params,
347
+ :form_params => form_params,
348
+ :body => post_body,
349
+ :auth_names => auth_names,
350
+ :return_type => return_type
351
+ )
352
+
353
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
354
+ if @api_client.config.debugging
355
+ @api_client.config.logger.debug "API called: PolicyGitRepositoriesApi#get_active_policy_repo\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
356
+ end
357
+ return data, status_code, headers
358
+ end
359
+
360
+ # Get Policy Repo
361
+ # Gets a single repository matching the given repo_id, if such repository exists.
362
+ # @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;).
363
+ # @param repo_id [String] Either the unique id of the policy repo, or the URL-friendly key of the policy repo (i.e: the \&quot;slug\&quot;).
364
+ # @param [Hash] opts the optional parameters
365
+ # @return [PolicyRepoRead]
366
+ def get_policy_repo(proj_id, repo_id, opts = {})
367
+ data, _status_code, _headers = get_policy_repo_with_http_info(proj_id, repo_id, opts)
368
+ data
369
+ end
370
+
371
+ # Get Policy Repo
372
+ # Gets a single repository matching the given repo_id, if such repository exists.
373
+ # @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;).
374
+ # @param repo_id [String] Either the unique id of the policy repo, or the URL-friendly key of the policy repo (i.e: the \&quot;slug\&quot;).
375
+ # @param [Hash] opts the optional parameters
376
+ # @return [Array<(PolicyRepoRead, Integer, Hash)>] PolicyRepoRead data, response status code and response headers
377
+ def get_policy_repo_with_http_info(proj_id, repo_id, opts = {})
378
+ if @api_client.config.debugging
379
+ @api_client.config.logger.debug 'Calling API: PolicyGitRepositoriesApi.get_policy_repo ...'
380
+ end
381
+ # verify the required parameter 'proj_id' is set
382
+ if @api_client.config.client_side_validation && proj_id.nil?
383
+ fail ArgumentError, "Missing the required parameter 'proj_id' when calling PolicyGitRepositoriesApi.get_policy_repo"
384
+ end
385
+ # verify the required parameter 'repo_id' is set
386
+ if @api_client.config.client_side_validation && repo_id.nil?
387
+ fail ArgumentError, "Missing the required parameter 'repo_id' when calling PolicyGitRepositoriesApi.get_policy_repo"
388
+ end
389
+ # resource path
390
+ local_var_path = '/v2/projects/{proj_id}/repos/{repo_id}'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'repo_id' + '}', CGI.escape(repo_id.to_s))
391
+
392
+ # query parameters
393
+ query_params = opts[:query_params] || {}
394
+
395
+ # header parameters
396
+ header_params = opts[:header_params] || {}
397
+ # HTTP header 'Accept' (if needed)
398
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
399
+
400
+ # form parameters
401
+ form_params = opts[:form_params] || {}
402
+
403
+ # http body (model)
404
+ post_body = opts[:debug_body]
405
+
406
+ # return_type
407
+ return_type = opts[:debug_return_type] || 'PolicyRepoRead'
408
+
409
+ # auth_names
410
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
411
+
412
+ new_options = opts.merge(
413
+ :operation => :"PolicyGitRepositoriesApi.get_policy_repo",
414
+ :header_params => header_params,
415
+ :query_params => query_params,
416
+ :form_params => form_params,
417
+ :body => post_body,
418
+ :auth_names => auth_names,
419
+ :return_type => return_type
420
+ )
421
+
422
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
423
+ if @api_client.config.debugging
424
+ @api_client.config.logger.debug "API called: PolicyGitRepositoriesApi#get_policy_repo\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
425
+ end
426
+ return data, status_code, headers
427
+ end
428
+
429
+ # List Policy Repos
430
+ # Lists all the policy repositories under a given project.
431
+ # @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;).
432
+ # @param [Hash] opts the optional parameters
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<PolicyRepoRead>]
436
+ def list_policy_repos(proj_id, opts = {})
437
+ data, _status_code, _headers = list_policy_repos_with_http_info(proj_id, opts)
438
+ data
439
+ end
440
+
441
+ # List Policy Repos
442
+ # Lists all the policy repositories under a given project.
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 [Hash] opts the optional parameters
445
+ # @option opts [Integer] :page Page number of the results to fetch, starting at 1. (default to 1)
446
+ # @option opts [Integer] :per_page The number of results per page (max 100). (default to 30)
447
+ # @return [Array<(Array<PolicyRepoRead>, Integer, Hash)>] Array<PolicyRepoRead> data, response status code and response headers
448
+ def list_policy_repos_with_http_info(proj_id, opts = {})
449
+ if @api_client.config.debugging
450
+ @api_client.config.logger.debug 'Calling API: PolicyGitRepositoriesApi.list_policy_repos ...'
451
+ end
452
+ # verify the required parameter 'proj_id' is set
453
+ if @api_client.config.client_side_validation && proj_id.nil?
454
+ fail ArgumentError, "Missing the required parameter 'proj_id' when calling PolicyGitRepositoriesApi.list_policy_repos"
455
+ end
456
+ if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
457
+ fail ArgumentError, 'invalid value for "opts[:"page"]" when calling PolicyGitRepositoriesApi.list_policy_repos, must be greater than or equal to 1.'
458
+ end
459
+
460
+ if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] > 100
461
+ fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling PolicyGitRepositoriesApi.list_policy_repos, must be smaller than or equal to 100.'
462
+ end
463
+
464
+ if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] < 1
465
+ fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling PolicyGitRepositoriesApi.list_policy_repos, must be greater than or equal to 1.'
466
+ end
467
+
468
+ # resource path
469
+ local_var_path = '/v2/projects/{proj_id}/repos'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s))
470
+
471
+ # query parameters
472
+ query_params = opts[:query_params] || {}
473
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
474
+ query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
475
+
476
+ # header parameters
477
+ header_params = opts[:header_params] || {}
478
+ # HTTP header 'Accept' (if needed)
479
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
480
+
481
+ # form parameters
482
+ form_params = opts[:form_params] || {}
483
+
484
+ # http body (model)
485
+ post_body = opts[:debug_body]
486
+
487
+ # return_type
488
+ return_type = opts[:debug_return_type] || 'Array<PolicyRepoRead>'
489
+
490
+ # auth_names
491
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
492
+
493
+ new_options = opts.merge(
494
+ :operation => :"PolicyGitRepositoriesApi.list_policy_repos",
495
+ :header_params => header_params,
496
+ :query_params => query_params,
497
+ :form_params => form_params,
498
+ :body => post_body,
499
+ :auth_names => auth_names,
500
+ :return_type => return_type
501
+ )
502
+
503
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
504
+ if @api_client.config.debugging
505
+ @api_client.config.logger.debug "API called: PolicyGitRepositoriesApi#list_policy_repos\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
506
+ end
507
+ return data, status_code, headers
508
+ end
509
+ end
510
+ end