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.
- checksums.yaml +7 -0
- data/lib/api/api.rb +25 -0
- data/lib/api/base.rb +26 -0
- data/lib/api/resources.rb +13 -0
- data/lib/api/tenants.rb +11 -0
- data/lib/api/users.rb +50 -0
- data/lib/api/utils.rb +9 -0
- data/lib/config.rb +23 -0
- data/lib/main.rb +49 -0
- data/lib/openapi_client/api/api_keys_api.rb +413 -0
- data/lib/openapi_client/api/audit_elements_data_api.rb +118 -0
- data/lib/openapi_client/api/audit_logs_api.rb +204 -0
- data/lib/openapi_client/api/authentication_api.rb +512 -0
- data/lib/openapi_client/api/condition_set_rules_api.rb +278 -0
- data/lib/openapi_client/api/condition_sets_api.rb +428 -0
- data/lib/openapi_client/api/decision_logs_api.rb +128 -0
- data/lib/openapi_client/api/decision_logs_ingress_api.rb +90 -0
- data/lib/openapi_client/api/default_api.rb +297 -0
- data/lib/openapi_client/api/elements_configs_api.rb +657 -0
- data/lib/openapi_client/api/environments_api.rb +462 -0
- data/lib/openapi_client/api/instructions_api.rb +91 -0
- data/lib/openapi_client/api/members_api.rb +354 -0
- data/lib/openapi_client/api/opal_data_api.rb +343 -0
- data/lib/openapi_client/api/organizations_api.rb +652 -0
- data/lib/openapi_client/api/policy_api.rb +138 -0
- data/lib/openapi_client/api/policy_decision_points_api.rb +382 -0
- data/lib/openapi_client/api/policy_git_repositories_api.rb +510 -0
- data/lib/openapi_client/api/projects_api.rb +365 -0
- data/lib/openapi_client/api/resource_actions_api.rb +455 -0
- data/lib/openapi_client/api/resource_attributes_api.rb +473 -0
- data/lib/openapi_client/api/resource_instances_api.rb +425 -0
- data/lib/openapi_client/api/resource_roles_api.rb +813 -0
- data/lib/openapi_client/api/resources_api.rb +514 -0
- data/lib/openapi_client/api/role_assignments_api.rb +278 -0
- data/lib/openapi_client/api/roles_api.rb +759 -0
- data/lib/openapi_client/api/tenants_api.rb +603 -0
- data/lib/openapi_client/api/user_attributes_api.rb +458 -0
- data/lib/openapi_client/api/users_api.rb +684 -0
- data/lib/openapi_client/api/users_elements_data_api.rb +638 -0
- data/lib/openapi_client/api_client.rb +392 -0
- data/lib/openapi_client/api_error.rb +57 -0
- data/lib/openapi_client/configuration.rb +280 -0
- data/lib/openapi_client/models/action_block_editable.rb +230 -0
- data/lib/openapi_client/models/action_block_read.rb +255 -0
- data/lib/openapi_client/models/action_object.rb +275 -0
- data/lib/openapi_client/models/actor.rb +57 -0
- data/lib/openapi_client/models/add_role_permissions.rb +227 -0
- data/lib/openapi_client/models/api_key_create.rb +269 -0
- data/lib/openapi_client/models/api_key_owner_type.rb +41 -0
- data/lib/openapi_client/models/api_key_read.rb +329 -0
- data/lib/openapi_client/models/api_key_scope_read.rb +245 -0
- data/lib/openapi_client/models/attribute_block_editable.rb +235 -0
- data/lib/openapi_client/models/attribute_block_read.rb +260 -0
- data/lib/openapi_client/models/attribute_type.rb +44 -0
- data/lib/openapi_client/models/attributes.rb +231 -0
- data/lib/openapi_client/models/audit_log.rb +415 -0
- data/lib/openapi_client/models/audit_log_objects.rb +282 -0
- data/lib/openapi_client/models/authn_me_api_key_read.rb +329 -0
- data/lib/openapi_client/models/authn_me_member_read.rb +352 -0
- data/lib/openapi_client/models/authn_me_read.rb +224 -0
- data/lib/openapi_client/models/authn_me_user_read.rb +440 -0
- data/lib/openapi_client/models/condition_set_create.rb +340 -0
- data/lib/openapi_client/models/condition_set_read.rb +409 -0
- data/lib/openapi_client/models/condition_set_rule_create.rb +279 -0
- data/lib/openapi_client/models/condition_set_rule_read.rb +360 -0
- data/lib/openapi_client/models/condition_set_rule_remove.rb +279 -0
- data/lib/openapi_client/models/condition_set_type.rb +40 -0
- data/lib/openapi_client/models/condition_set_update.rb +255 -0
- data/lib/openapi_client/models/data_source_config.rb +228 -0
- data/lib/openapi_client/models/data_source_entry.rb +272 -0
- data/lib/openapi_client/models/detailed_audit_log.rb +443 -0
- data/lib/openapi_client/models/dev_login.rb +225 -0
- data/lib/openapi_client/models/dummy_engine_model.rb +229 -0
- data/lib/openapi_client/models/elements_config_create.rb +319 -0
- data/lib/openapi_client/models/elements_config_read.rb +402 -0
- data/lib/openapi_client/models/elements_config_runtime_read.rb +238 -0
- data/lib/openapi_client/models/elements_config_update.rb +268 -0
- data/lib/openapi_client/models/elements_env_type_read.rb +242 -0
- data/lib/openapi_client/models/elements_env_type_update.rb +222 -0
- data/lib/openapi_client/models/elements_permission_level.rb +44 -0
- data/lib/openapi_client/models/elements_role_read.rb +378 -0
- data/lib/openapi_client/models/elements_type.rb +41 -0
- data/lib/openapi_client/models/elements_user_create.rb +295 -0
- data/lib/openapi_client/models/elements_user_role_create.rb +225 -0
- data/lib/openapi_client/models/elements_user_role_remove.rb +225 -0
- data/lib/openapi_client/models/embedded_login_request_output.rb +265 -0
- data/lib/openapi_client/models/engine.rb +39 -0
- data/lib/openapi_client/models/environment_create.rb +281 -0
- data/lib/openapi_client/models/environment_object.rb +295 -0
- data/lib/openapi_client/models/environment_read.rb +335 -0
- data/lib/openapi_client/models/environment_stats.rb +365 -0
- data/lib/openapi_client/models/environment_update.rb +240 -0
- data/lib/openapi_client/models/failed_invite.rb +238 -0
- data/lib/openapi_client/models/full_data.rb +258 -0
- data/lib/openapi_client/models/http_validation_error.rb +221 -0
- data/lib/openapi_client/models/identity_read.rb +300 -0
- data/lib/openapi_client/models/invite_attempt_result.rb +232 -0
- data/lib/openapi_client/models/invite_create.rb +240 -0
- data/lib/openapi_client/models/invite_read.rb +325 -0
- data/lib/openapi_client/models/invite_status.rb +42 -0
- data/lib/openapi_client/models/labels.rb +238 -0
- data/lib/openapi_client/models/language_instructions.rb +252 -0
- data/lib/openapi_client/models/location_inner.rb +230 -0
- data/lib/openapi_client/models/login_result.rb +259 -0
- data/lib/openapi_client/models/member_access_level.rb +41 -0
- data/lib/openapi_client/models/member_access_obj.rb +41 -0
- data/lib/openapi_client/models/multi_invite_result.rb +238 -0
- data/lib/openapi_client/models/onboarding_step.rb +46 -0
- data/lib/openapi_client/models/opa_decision_log.rb +288 -0
- data/lib/openapi_client/models/opa_engine_decision_log.rb +345 -0
- data/lib/openapi_client/models/opa_labels.rb +238 -0
- data/lib/openapi_client/models/opa_metrics.rb +273 -0
- data/lib/openapi_client/models/opal_client.rb +305 -0
- data/lib/openapi_client/models/org_member_read.rb +420 -0
- data/lib/openapi_client/models/org_member_update.rb +230 -0
- data/lib/openapi_client/models/organization_create.rb +292 -0
- data/lib/openapi_client/models/organization_object.rb +295 -0
- data/lib/openapi_client/models/organization_read.rb +295 -0
- data/lib/openapi_client/models/organization_read_with_api_key.rb +313 -0
- data/lib/openapi_client/models/organization_update.rb +247 -0
- data/lib/openapi_client/models/paginated_result_api_key_read.rb +285 -0
- data/lib/openapi_client/models/paginated_result_audit_log.rb +285 -0
- data/lib/openapi_client/models/paginated_result_elements_config_read.rb +285 -0
- data/lib/openapi_client/models/paginated_result_opa_decision_log.rb +285 -0
- data/lib/openapi_client/models/paginated_result_user_read.rb +285 -0
- data/lib/openapi_client/models/pdp.rb +259 -0
- data/lib/openapi_client/models/pdp_config_object.rb +258 -0
- data/lib/openapi_client/models/pdp_config_read.rb +292 -0
- data/lib/openapi_client/models/pdp_context.rb +291 -0
- data/lib/openapi_client/models/pdp_state.rb +224 -0
- data/lib/openapi_client/models/pdp_state_update.rb +238 -0
- data/lib/openapi_client/models/pdp_values.rb +252 -0
- data/lib/openapi_client/models/permission_level_role_read.rb +254 -0
- data/lib/openapi_client/models/policy_repo_create.rb +318 -0
- data/lib/openapi_client/models/policy_repo_read.rb +347 -0
- data/lib/openapi_client/models/policy_repo_status.rb +41 -0
- data/lib/openapi_client/models/programming_language.rb +43 -0
- data/lib/openapi_client/models/project_create.rb +318 -0
- data/lib/openapi_client/models/project_object.rb +295 -0
- data/lib/openapi_client/models/project_read.rb +357 -0
- data/lib/openapi_client/models/project_update.rb +250 -0
- data/lib/openapi_client/models/raw_data.rb +329 -0
- data/lib/openapi_client/models/relationship_tuple_object.rb +252 -0
- data/lib/openapi_client/models/remote_config.rb +256 -0
- data/lib/openapi_client/models/remove_role_permissions.rb +227 -0
- data/lib/openapi_client/models/resource_action_create.rb +271 -0
- data/lib/openapi_client/models/resource_action_read.rb +370 -0
- data/lib/openapi_client/models/resource_action_update.rb +230 -0
- data/lib/openapi_client/models/resource_attribute_create.rb +271 -0
- data/lib/openapi_client/models/resource_attribute_read.rb +370 -0
- data/lib/openapi_client/models/resource_attribute_update.rb +230 -0
- data/lib/openapi_client/models/resource_attributes.rb +238 -0
- data/lib/openapi_client/models/resource_create.rb +310 -0
- data/lib/openapi_client/models/resource_id.rb +230 -0
- data/lib/openapi_client/models/resource_instance_create.rb +281 -0
- data/lib/openapi_client/models/resource_instance_read.rb +375 -0
- data/lib/openapi_client/models/resource_instance_update.rb +220 -0
- data/lib/openapi_client/models/resource_read.rb +374 -0
- data/lib/openapi_client/models/resource_replace.rb +274 -0
- data/lib/openapi_client/models/resource_role_create.rb +295 -0
- data/lib/openapi_client/models/resource_role_read.rb +379 -0
- data/lib/openapi_client/models/resource_role_update.rb +254 -0
- data/lib/openapi_client/models/resource_type_object.rb +286 -0
- data/lib/openapi_client/models/resource_update.rb +264 -0
- data/lib/openapi_client/models/role_assignment_create.rb +255 -0
- data/lib/openapi_client/models/role_assignment_read.rb +375 -0
- data/lib/openapi_client/models/role_assignment_remove.rb +255 -0
- data/lib/openapi_client/models/role_block.rb +244 -0
- data/lib/openapi_client/models/role_create.rb +295 -0
- data/lib/openapi_client/models/role_data.rb +221 -0
- data/lib/openapi_client/models/role_read.rb +364 -0
- data/lib/openapi_client/models/role_update.rb +254 -0
- data/lib/openapi_client/models/settings.rb +231 -0
- data/lib/openapi_client/models/ssh_auth_data.rb +295 -0
- data/lib/openapi_client/models/statistics.rb +389 -0
- data/lib/openapi_client/models/tenant_create.rb +281 -0
- data/lib/openapi_client/models/tenant_object.rb +284 -0
- data/lib/openapi_client/models/tenant_read.rb +365 -0
- data/lib/openapi_client/models/tenant_update.rb +240 -0
- data/lib/openapi_client/models/user_create.rb +286 -0
- data/lib/openapi_client/models/user_data.rb +232 -0
- data/lib/openapi_client/models/user_login_request_input.rb +240 -0
- data/lib/openapi_client/models/user_object.rb +313 -0
- data/lib/openapi_client/models/user_read.rb +336 -0
- data/lib/openapi_client/models/user_role.rb +240 -0
- data/lib/openapi_client/models/user_role_create.rb +240 -0
- data/lib/openapi_client/models/user_role_remove.rb +240 -0
- data/lib/openapi_client/models/user_update.rb +250 -0
- data/lib/openapi_client/models/validation_error.rb +254 -0
- data/lib/openapi_client/models/webhook_create.rb +235 -0
- data/lib/openapi_client/models/webhook_read.rb +315 -0
- data/lib/openapi_client/models/webhook_update.rb +230 -0
- data/lib/openapi_client/version.rb +15 -0
- data/lib/openapi_client.rb +220 -0
- data/lib/permit.rb +58 -0
- metadata +251 -0
@@ -0,0 +1,813 @@
|
|
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 ResourceRolesApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Add Parent Role
|
23
|
+
# This endpoint is part of the role hierarchy feature. Makes role with id `role_id` extend the role with id `parent_role_id`. In other words, `role_id` will automatically be assigned any permissions that are granted to `parent_role_id`. We can say the `role_id` **extends** `parent_role_id` or **inherits** from `parent_role_id`. If `role_id` is already an ancestor of `parent_role_id`, the request will fail with HTTP 400 to prevent a cycle in the role hierarchy. Both roles must be defined on the same resource, identified by id `resource_id`.
|
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 resource_id [String] Either the unique id of the resource, or the URL-friendly key of the resource (i.e: the \"slug\").
|
27
|
+
# @param role_id [String] Either the unique id of the role, or the URL-friendly key of the role (i.e: the \"slug\").
|
28
|
+
# @param parent_role_id [String] Either the unique id of the parent role, or the URL-friendly key of the parent role (i.e: the \"slug\").
|
29
|
+
# @param [Hash] opts the optional parameters
|
30
|
+
# @return [ResourceRoleRead]
|
31
|
+
def add_parent_resource_role(proj_id, env_id, resource_id, role_id, parent_role_id, opts = {})
|
32
|
+
data, _status_code, _headers = add_parent_resource_role_with_http_info(proj_id, env_id, resource_id, role_id, parent_role_id, opts)
|
33
|
+
data
|
34
|
+
end
|
35
|
+
|
36
|
+
# Add Parent Role
|
37
|
+
# This endpoint is part of the role hierarchy feature. Makes role with id `role_id` extend the role with id `parent_role_id`. In other words, `role_id` will automatically be assigned any permissions that are granted to `parent_role_id`. We can say the `role_id` **extends** `parent_role_id` or **inherits** from `parent_role_id`. If `role_id` is already an ancestor of `parent_role_id`, the request will fail with HTTP 400 to prevent a cycle in the role hierarchy. Both roles must be defined on the same resource, identified by id `resource_id`.
|
38
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
39
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
40
|
+
# @param resource_id [String] Either the unique id of the resource, or the URL-friendly key of the resource (i.e: the \"slug\").
|
41
|
+
# @param role_id [String] Either the unique id of the role, or the URL-friendly key of the role (i.e: the \"slug\").
|
42
|
+
# @param parent_role_id [String] Either the unique id of the parent role, or the URL-friendly key of the parent role (i.e: the \"slug\").
|
43
|
+
# @param [Hash] opts the optional parameters
|
44
|
+
# @return [Array<(ResourceRoleRead, Integer, Hash)>] ResourceRoleRead data, response status code and response headers
|
45
|
+
def add_parent_resource_role_with_http_info(proj_id, env_id, resource_id, role_id, parent_role_id, opts = {})
|
46
|
+
if @api_client.config.debugging
|
47
|
+
@api_client.config.logger.debug 'Calling API: ResourceRolesApi.add_parent_resource_role ...'
|
48
|
+
end
|
49
|
+
# verify the required parameter 'proj_id' is set
|
50
|
+
if @api_client.config.client_side_validation && proj_id.nil?
|
51
|
+
fail ArgumentError, "Missing the required parameter 'proj_id' when calling ResourceRolesApi.add_parent_resource_role"
|
52
|
+
end
|
53
|
+
# verify the required parameter 'env_id' is set
|
54
|
+
if @api_client.config.client_side_validation && env_id.nil?
|
55
|
+
fail ArgumentError, "Missing the required parameter 'env_id' when calling ResourceRolesApi.add_parent_resource_role"
|
56
|
+
end
|
57
|
+
# verify the required parameter 'resource_id' is set
|
58
|
+
if @api_client.config.client_side_validation && resource_id.nil?
|
59
|
+
fail ArgumentError, "Missing the required parameter 'resource_id' when calling ResourceRolesApi.add_parent_resource_role"
|
60
|
+
end
|
61
|
+
# verify the required parameter 'role_id' is set
|
62
|
+
if @api_client.config.client_side_validation && role_id.nil?
|
63
|
+
fail ArgumentError, "Missing the required parameter 'role_id' when calling ResourceRolesApi.add_parent_resource_role"
|
64
|
+
end
|
65
|
+
# verify the required parameter 'parent_role_id' is set
|
66
|
+
if @api_client.config.client_side_validation && parent_role_id.nil?
|
67
|
+
fail ArgumentError, "Missing the required parameter 'parent_role_id' when calling ResourceRolesApi.add_parent_resource_role"
|
68
|
+
end
|
69
|
+
# resource path
|
70
|
+
local_var_path = '/v2/schema/{proj_id}/{env_id}/resources/{resource_id}/roles/{role_id}/parents/{parent_role_id}'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s)).sub('{' + 'resource_id' + '}', CGI.escape(resource_id.to_s)).sub('{' + 'role_id' + '}', CGI.escape(role_id.to_s)).sub('{' + 'parent_role_id' + '}', CGI.escape(parent_role_id.to_s))
|
71
|
+
|
72
|
+
# query parameters
|
73
|
+
query_params = opts[:query_params] || {}
|
74
|
+
|
75
|
+
# header parameters
|
76
|
+
header_params = opts[:header_params] || {}
|
77
|
+
# HTTP header 'Accept' (if needed)
|
78
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
79
|
+
|
80
|
+
# form parameters
|
81
|
+
form_params = opts[:form_params] || {}
|
82
|
+
|
83
|
+
# http body (model)
|
84
|
+
post_body = opts[:debug_body]
|
85
|
+
|
86
|
+
# return_type
|
87
|
+
return_type = opts[:debug_return_type] || 'ResourceRoleRead'
|
88
|
+
|
89
|
+
# auth_names
|
90
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
91
|
+
|
92
|
+
new_options = opts.merge(
|
93
|
+
:operation => :"ResourceRolesApi.add_parent_resource_role",
|
94
|
+
:header_params => header_params,
|
95
|
+
:query_params => query_params,
|
96
|
+
:form_params => form_params,
|
97
|
+
:body => post_body,
|
98
|
+
:auth_names => auth_names,
|
99
|
+
:return_type => return_type
|
100
|
+
)
|
101
|
+
|
102
|
+
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
|
103
|
+
if @api_client.config.debugging
|
104
|
+
@api_client.config.logger.debug "API called: ResourceRolesApi#add_parent_resource_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
105
|
+
end
|
106
|
+
return data, status_code, headers
|
107
|
+
end
|
108
|
+
|
109
|
+
# Assign Permissions to Role
|
110
|
+
# Assign permissions to role. If some of the permissions specified are already unassigned, will skip them.
|
111
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
112
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
113
|
+
# @param resource_id [String] Either the unique id of the resource, or the URL-friendly key of the resource (i.e: the \"slug\").
|
114
|
+
# @param role_id [String] Either the unique id of the role, or the URL-friendly key of the role (i.e: the \"slug\").
|
115
|
+
# @param add_role_permissions [AddRolePermissions]
|
116
|
+
# @param [Hash] opts the optional parameters
|
117
|
+
# @return [ResourceRoleRead]
|
118
|
+
def assign_permissions_to_resource_role(proj_id, env_id, resource_id, role_id, add_role_permissions, opts = {})
|
119
|
+
data, _status_code, _headers = assign_permissions_to_resource_role_with_http_info(proj_id, env_id, resource_id, role_id, add_role_permissions, opts)
|
120
|
+
data
|
121
|
+
end
|
122
|
+
|
123
|
+
# Assign Permissions to Role
|
124
|
+
# Assign permissions to role. If some of the permissions specified are already unassigned, will skip them.
|
125
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
126
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
127
|
+
# @param resource_id [String] Either the unique id of the resource, or the URL-friendly key of the resource (i.e: the \"slug\").
|
128
|
+
# @param role_id [String] Either the unique id of the role, or the URL-friendly key of the role (i.e: the \"slug\").
|
129
|
+
# @param add_role_permissions [AddRolePermissions]
|
130
|
+
# @param [Hash] opts the optional parameters
|
131
|
+
# @return [Array<(ResourceRoleRead, Integer, Hash)>] ResourceRoleRead data, response status code and response headers
|
132
|
+
def assign_permissions_to_resource_role_with_http_info(proj_id, env_id, resource_id, role_id, add_role_permissions, opts = {})
|
133
|
+
if @api_client.config.debugging
|
134
|
+
@api_client.config.logger.debug 'Calling API: ResourceRolesApi.assign_permissions_to_resource_role ...'
|
135
|
+
end
|
136
|
+
# verify the required parameter 'proj_id' is set
|
137
|
+
if @api_client.config.client_side_validation && proj_id.nil?
|
138
|
+
fail ArgumentError, "Missing the required parameter 'proj_id' when calling ResourceRolesApi.assign_permissions_to_resource_role"
|
139
|
+
end
|
140
|
+
# verify the required parameter 'env_id' is set
|
141
|
+
if @api_client.config.client_side_validation && env_id.nil?
|
142
|
+
fail ArgumentError, "Missing the required parameter 'env_id' when calling ResourceRolesApi.assign_permissions_to_resource_role"
|
143
|
+
end
|
144
|
+
# verify the required parameter 'resource_id' is set
|
145
|
+
if @api_client.config.client_side_validation && resource_id.nil?
|
146
|
+
fail ArgumentError, "Missing the required parameter 'resource_id' when calling ResourceRolesApi.assign_permissions_to_resource_role"
|
147
|
+
end
|
148
|
+
# verify the required parameter 'role_id' is set
|
149
|
+
if @api_client.config.client_side_validation && role_id.nil?
|
150
|
+
fail ArgumentError, "Missing the required parameter 'role_id' when calling ResourceRolesApi.assign_permissions_to_resource_role"
|
151
|
+
end
|
152
|
+
# verify the required parameter 'add_role_permissions' is set
|
153
|
+
if @api_client.config.client_side_validation && add_role_permissions.nil?
|
154
|
+
fail ArgumentError, "Missing the required parameter 'add_role_permissions' when calling ResourceRolesApi.assign_permissions_to_resource_role"
|
155
|
+
end
|
156
|
+
# resource path
|
157
|
+
local_var_path = '/v2/schema/{proj_id}/{env_id}/resources/{resource_id}/roles/{role_id}/permissions'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s)).sub('{' + 'resource_id' + '}', CGI.escape(resource_id.to_s)).sub('{' + 'role_id' + '}', CGI.escape(role_id.to_s))
|
158
|
+
|
159
|
+
# query parameters
|
160
|
+
query_params = opts[:query_params] || {}
|
161
|
+
|
162
|
+
# header parameters
|
163
|
+
header_params = opts[:header_params] || {}
|
164
|
+
# HTTP header 'Accept' (if needed)
|
165
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
166
|
+
# HTTP header 'Content-Type'
|
167
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
168
|
+
if !content_type.nil?
|
169
|
+
header_params['Content-Type'] = content_type
|
170
|
+
end
|
171
|
+
|
172
|
+
# form parameters
|
173
|
+
form_params = opts[:form_params] || {}
|
174
|
+
|
175
|
+
# http body (model)
|
176
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(add_role_permissions)
|
177
|
+
|
178
|
+
# return_type
|
179
|
+
return_type = opts[:debug_return_type] || 'ResourceRoleRead'
|
180
|
+
|
181
|
+
# auth_names
|
182
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
183
|
+
|
184
|
+
new_options = opts.merge(
|
185
|
+
:operation => :"ResourceRolesApi.assign_permissions_to_resource_role",
|
186
|
+
:header_params => header_params,
|
187
|
+
:query_params => query_params,
|
188
|
+
:form_params => form_params,
|
189
|
+
:body => post_body,
|
190
|
+
:auth_names => auth_names,
|
191
|
+
:return_type => return_type
|
192
|
+
)
|
193
|
+
|
194
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
195
|
+
if @api_client.config.debugging
|
196
|
+
@api_client.config.logger.debug "API called: ResourceRolesApi#assign_permissions_to_resource_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
197
|
+
end
|
198
|
+
return data, status_code, headers
|
199
|
+
end
|
200
|
+
|
201
|
+
# Create Resource Role
|
202
|
+
# Creates a new role associated with the resource.
|
203
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
204
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
205
|
+
# @param resource_id [String] Either the unique id of the resource, or the URL-friendly key of the resource (i.e: the \"slug\").
|
206
|
+
# @param resource_role_create [ResourceRoleCreate]
|
207
|
+
# @param [Hash] opts the optional parameters
|
208
|
+
# @return [ResourceRoleRead]
|
209
|
+
def create_resource_role(proj_id, env_id, resource_id, resource_role_create, opts = {})
|
210
|
+
data, _status_code, _headers = create_resource_role_with_http_info(proj_id, env_id, resource_id, resource_role_create, opts)
|
211
|
+
data
|
212
|
+
end
|
213
|
+
|
214
|
+
# Create Resource Role
|
215
|
+
# Creates a new role associated with the resource.
|
216
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
217
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
218
|
+
# @param resource_id [String] Either the unique id of the resource, or the URL-friendly key of the resource (i.e: the \"slug\").
|
219
|
+
# @param resource_role_create [ResourceRoleCreate]
|
220
|
+
# @param [Hash] opts the optional parameters
|
221
|
+
# @return [Array<(ResourceRoleRead, Integer, Hash)>] ResourceRoleRead data, response status code and response headers
|
222
|
+
def create_resource_role_with_http_info(proj_id, env_id, resource_id, resource_role_create, opts = {})
|
223
|
+
if @api_client.config.debugging
|
224
|
+
@api_client.config.logger.debug 'Calling API: ResourceRolesApi.create_resource_role ...'
|
225
|
+
end
|
226
|
+
# verify the required parameter 'proj_id' is set
|
227
|
+
if @api_client.config.client_side_validation && proj_id.nil?
|
228
|
+
fail ArgumentError, "Missing the required parameter 'proj_id' when calling ResourceRolesApi.create_resource_role"
|
229
|
+
end
|
230
|
+
# verify the required parameter 'env_id' is set
|
231
|
+
if @api_client.config.client_side_validation && env_id.nil?
|
232
|
+
fail ArgumentError, "Missing the required parameter 'env_id' when calling ResourceRolesApi.create_resource_role"
|
233
|
+
end
|
234
|
+
# verify the required parameter 'resource_id' is set
|
235
|
+
if @api_client.config.client_side_validation && resource_id.nil?
|
236
|
+
fail ArgumentError, "Missing the required parameter 'resource_id' when calling ResourceRolesApi.create_resource_role"
|
237
|
+
end
|
238
|
+
# verify the required parameter 'resource_role_create' is set
|
239
|
+
if @api_client.config.client_side_validation && resource_role_create.nil?
|
240
|
+
fail ArgumentError, "Missing the required parameter 'resource_role_create' when calling ResourceRolesApi.create_resource_role"
|
241
|
+
end
|
242
|
+
# resource path
|
243
|
+
local_var_path = '/v2/schema/{proj_id}/{env_id}/resources/{resource_id}/roles'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s)).sub('{' + 'resource_id' + '}', CGI.escape(resource_id.to_s))
|
244
|
+
|
245
|
+
# query parameters
|
246
|
+
query_params = opts[:query_params] || {}
|
247
|
+
|
248
|
+
# header parameters
|
249
|
+
header_params = opts[:header_params] || {}
|
250
|
+
# HTTP header 'Accept' (if needed)
|
251
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
252
|
+
# HTTP header 'Content-Type'
|
253
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
254
|
+
if !content_type.nil?
|
255
|
+
header_params['Content-Type'] = content_type
|
256
|
+
end
|
257
|
+
|
258
|
+
# form parameters
|
259
|
+
form_params = opts[:form_params] || {}
|
260
|
+
|
261
|
+
# http body (model)
|
262
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(resource_role_create)
|
263
|
+
|
264
|
+
# return_type
|
265
|
+
return_type = opts[:debug_return_type] || 'ResourceRoleRead'
|
266
|
+
|
267
|
+
# auth_names
|
268
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
269
|
+
|
270
|
+
new_options = opts.merge(
|
271
|
+
:operation => :"ResourceRolesApi.create_resource_role",
|
272
|
+
:header_params => header_params,
|
273
|
+
:query_params => query_params,
|
274
|
+
:form_params => form_params,
|
275
|
+
:body => post_body,
|
276
|
+
:auth_names => auth_names,
|
277
|
+
:return_type => return_type
|
278
|
+
)
|
279
|
+
|
280
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
281
|
+
if @api_client.config.debugging
|
282
|
+
@api_client.config.logger.debug "API called: ResourceRolesApi#create_resource_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
283
|
+
end
|
284
|
+
return data, status_code, headers
|
285
|
+
end
|
286
|
+
|
287
|
+
# Delete Resource Role
|
288
|
+
# Deletes the role and all its related data. This includes any permissions granted to said role.
|
289
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
290
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
291
|
+
# @param resource_id [String] Either the unique id of the resource, or the URL-friendly key of the resource (i.e: the \"slug\").
|
292
|
+
# @param role_id [String] Either the unique id of the role, or the URL-friendly key of the role (i.e: the \"slug\").
|
293
|
+
# @param [Hash] opts the optional parameters
|
294
|
+
# @return [nil]
|
295
|
+
def delete_resource_role(proj_id, env_id, resource_id, role_id, opts = {})
|
296
|
+
delete_resource_role_with_http_info(proj_id, env_id, resource_id, role_id, opts)
|
297
|
+
nil
|
298
|
+
end
|
299
|
+
|
300
|
+
# Delete Resource Role
|
301
|
+
# Deletes the role and all its related data. This includes any permissions granted to said role.
|
302
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
303
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
304
|
+
# @param resource_id [String] Either the unique id of the resource, or the URL-friendly key of the resource (i.e: the \"slug\").
|
305
|
+
# @param role_id [String] Either the unique id of the role, or the URL-friendly key of the role (i.e: the \"slug\").
|
306
|
+
# @param [Hash] opts the optional parameters
|
307
|
+
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
308
|
+
def delete_resource_role_with_http_info(proj_id, env_id, resource_id, role_id, opts = {})
|
309
|
+
if @api_client.config.debugging
|
310
|
+
@api_client.config.logger.debug 'Calling API: ResourceRolesApi.delete_resource_role ...'
|
311
|
+
end
|
312
|
+
# verify the required parameter 'proj_id' is set
|
313
|
+
if @api_client.config.client_side_validation && proj_id.nil?
|
314
|
+
fail ArgumentError, "Missing the required parameter 'proj_id' when calling ResourceRolesApi.delete_resource_role"
|
315
|
+
end
|
316
|
+
# verify the required parameter 'env_id' is set
|
317
|
+
if @api_client.config.client_side_validation && env_id.nil?
|
318
|
+
fail ArgumentError, "Missing the required parameter 'env_id' when calling ResourceRolesApi.delete_resource_role"
|
319
|
+
end
|
320
|
+
# verify the required parameter 'resource_id' is set
|
321
|
+
if @api_client.config.client_side_validation && resource_id.nil?
|
322
|
+
fail ArgumentError, "Missing the required parameter 'resource_id' when calling ResourceRolesApi.delete_resource_role"
|
323
|
+
end
|
324
|
+
# verify the required parameter 'role_id' is set
|
325
|
+
if @api_client.config.client_side_validation && role_id.nil?
|
326
|
+
fail ArgumentError, "Missing the required parameter 'role_id' when calling ResourceRolesApi.delete_resource_role"
|
327
|
+
end
|
328
|
+
# resource path
|
329
|
+
local_var_path = '/v2/schema/{proj_id}/{env_id}/resources/{resource_id}/roles/{role_id}'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s)).sub('{' + 'resource_id' + '}', CGI.escape(resource_id.to_s)).sub('{' + 'role_id' + '}', CGI.escape(role_id.to_s))
|
330
|
+
|
331
|
+
# query parameters
|
332
|
+
query_params = opts[:query_params] || {}
|
333
|
+
|
334
|
+
# header parameters
|
335
|
+
header_params = opts[:header_params] || {}
|
336
|
+
# HTTP header 'Accept' (if needed)
|
337
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
338
|
+
|
339
|
+
# form parameters
|
340
|
+
form_params = opts[:form_params] || {}
|
341
|
+
|
342
|
+
# http body (model)
|
343
|
+
post_body = opts[:debug_body]
|
344
|
+
|
345
|
+
# return_type
|
346
|
+
return_type = opts[:debug_return_type]
|
347
|
+
|
348
|
+
# auth_names
|
349
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
350
|
+
|
351
|
+
new_options = opts.merge(
|
352
|
+
:operation => :"ResourceRolesApi.delete_resource_role",
|
353
|
+
:header_params => header_params,
|
354
|
+
:query_params => query_params,
|
355
|
+
:form_params => form_params,
|
356
|
+
:body => post_body,
|
357
|
+
:auth_names => auth_names,
|
358
|
+
:return_type => return_type
|
359
|
+
)
|
360
|
+
|
361
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
362
|
+
if @api_client.config.debugging
|
363
|
+
@api_client.config.logger.debug "API called: ResourceRolesApi#delete_resource_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
364
|
+
end
|
365
|
+
return data, status_code, headers
|
366
|
+
end
|
367
|
+
|
368
|
+
# Get Resource Role
|
369
|
+
# Gets a single role defined on the resource, if such role exists.
|
370
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
371
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
372
|
+
# @param resource_id [String] Either the unique id of the resource, or the URL-friendly key of the resource (i.e: the \"slug\").
|
373
|
+
# @param role_id [String] Either the unique id of the role, or the URL-friendly key of the role (i.e: the \"slug\").
|
374
|
+
# @param [Hash] opts the optional parameters
|
375
|
+
# @return [ResourceRoleRead]
|
376
|
+
def get_resource_role(proj_id, env_id, resource_id, role_id, opts = {})
|
377
|
+
data, _status_code, _headers = get_resource_role_with_http_info(proj_id, env_id, resource_id, role_id, opts)
|
378
|
+
data
|
379
|
+
end
|
380
|
+
|
381
|
+
# Get Resource Role
|
382
|
+
# Gets a single role defined on the resource, if such role exists.
|
383
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
384
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
385
|
+
# @param resource_id [String] Either the unique id of the resource, or the URL-friendly key of the resource (i.e: the \"slug\").
|
386
|
+
# @param role_id [String] Either the unique id of the role, or the URL-friendly key of the role (i.e: the \"slug\").
|
387
|
+
# @param [Hash] opts the optional parameters
|
388
|
+
# @return [Array<(ResourceRoleRead, Integer, Hash)>] ResourceRoleRead data, response status code and response headers
|
389
|
+
def get_resource_role_with_http_info(proj_id, env_id, resource_id, role_id, opts = {})
|
390
|
+
if @api_client.config.debugging
|
391
|
+
@api_client.config.logger.debug 'Calling API: ResourceRolesApi.get_resource_role ...'
|
392
|
+
end
|
393
|
+
# verify the required parameter 'proj_id' is set
|
394
|
+
if @api_client.config.client_side_validation && proj_id.nil?
|
395
|
+
fail ArgumentError, "Missing the required parameter 'proj_id' when calling ResourceRolesApi.get_resource_role"
|
396
|
+
end
|
397
|
+
# verify the required parameter 'env_id' is set
|
398
|
+
if @api_client.config.client_side_validation && env_id.nil?
|
399
|
+
fail ArgumentError, "Missing the required parameter 'env_id' when calling ResourceRolesApi.get_resource_role"
|
400
|
+
end
|
401
|
+
# verify the required parameter 'resource_id' is set
|
402
|
+
if @api_client.config.client_side_validation && resource_id.nil?
|
403
|
+
fail ArgumentError, "Missing the required parameter 'resource_id' when calling ResourceRolesApi.get_resource_role"
|
404
|
+
end
|
405
|
+
# verify the required parameter 'role_id' is set
|
406
|
+
if @api_client.config.client_side_validation && role_id.nil?
|
407
|
+
fail ArgumentError, "Missing the required parameter 'role_id' when calling ResourceRolesApi.get_resource_role"
|
408
|
+
end
|
409
|
+
# resource path
|
410
|
+
local_var_path = '/v2/schema/{proj_id}/{env_id}/resources/{resource_id}/roles/{role_id}'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s)).sub('{' + 'resource_id' + '}', CGI.escape(resource_id.to_s)).sub('{' + 'role_id' + '}', CGI.escape(role_id.to_s))
|
411
|
+
|
412
|
+
# query parameters
|
413
|
+
query_params = opts[:query_params] || {}
|
414
|
+
|
415
|
+
# header parameters
|
416
|
+
header_params = opts[:header_params] || {}
|
417
|
+
# HTTP header 'Accept' (if needed)
|
418
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
419
|
+
|
420
|
+
# form parameters
|
421
|
+
form_params = opts[:form_params] || {}
|
422
|
+
|
423
|
+
# http body (model)
|
424
|
+
post_body = opts[:debug_body]
|
425
|
+
|
426
|
+
# return_type
|
427
|
+
return_type = opts[:debug_return_type] || 'ResourceRoleRead'
|
428
|
+
|
429
|
+
# auth_names
|
430
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
431
|
+
|
432
|
+
new_options = opts.merge(
|
433
|
+
:operation => :"ResourceRolesApi.get_resource_role",
|
434
|
+
:header_params => header_params,
|
435
|
+
:query_params => query_params,
|
436
|
+
:form_params => form_params,
|
437
|
+
:body => post_body,
|
438
|
+
:auth_names => auth_names,
|
439
|
+
:return_type => return_type
|
440
|
+
)
|
441
|
+
|
442
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
443
|
+
if @api_client.config.debugging
|
444
|
+
@api_client.config.logger.debug "API called: ResourceRolesApi#get_resource_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
445
|
+
end
|
446
|
+
return data, status_code, headers
|
447
|
+
end
|
448
|
+
|
449
|
+
# List Resource Roles
|
450
|
+
# Lists all the roles defined on the resource.
|
451
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
452
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
453
|
+
# @param resource_id [String] Either the unique id of the resource, or the URL-friendly key of the resource (i.e: the \"slug\").
|
454
|
+
# @param [Hash] opts the optional parameters
|
455
|
+
# @option opts [Integer] :page Page number of the results to fetch, starting at 1. (default to 1)
|
456
|
+
# @option opts [Integer] :per_page The number of results per page (max 100). (default to 30)
|
457
|
+
# @return [Array<ResourceRoleRead>]
|
458
|
+
def list_resource_roles(proj_id, env_id, resource_id, opts = {})
|
459
|
+
data, _status_code, _headers = list_resource_roles_with_http_info(proj_id, env_id, resource_id, opts)
|
460
|
+
data
|
461
|
+
end
|
462
|
+
|
463
|
+
# List Resource Roles
|
464
|
+
# Lists all the roles defined on the resource.
|
465
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
466
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
467
|
+
# @param resource_id [String] Either the unique id of the resource, or the URL-friendly key of the resource (i.e: the \"slug\").
|
468
|
+
# @param [Hash] opts the optional parameters
|
469
|
+
# @option opts [Integer] :page Page number of the results to fetch, starting at 1. (default to 1)
|
470
|
+
# @option opts [Integer] :per_page The number of results per page (max 100). (default to 30)
|
471
|
+
# @return [Array<(Array<ResourceRoleRead>, Integer, Hash)>] Array<ResourceRoleRead> data, response status code and response headers
|
472
|
+
def list_resource_roles_with_http_info(proj_id, env_id, resource_id, opts = {})
|
473
|
+
if @api_client.config.debugging
|
474
|
+
@api_client.config.logger.debug 'Calling API: ResourceRolesApi.list_resource_roles ...'
|
475
|
+
end
|
476
|
+
# verify the required parameter 'proj_id' is set
|
477
|
+
if @api_client.config.client_side_validation && proj_id.nil?
|
478
|
+
fail ArgumentError, "Missing the required parameter 'proj_id' when calling ResourceRolesApi.list_resource_roles"
|
479
|
+
end
|
480
|
+
# verify the required parameter 'env_id' is set
|
481
|
+
if @api_client.config.client_side_validation && env_id.nil?
|
482
|
+
fail ArgumentError, "Missing the required parameter 'env_id' when calling ResourceRolesApi.list_resource_roles"
|
483
|
+
end
|
484
|
+
# verify the required parameter 'resource_id' is set
|
485
|
+
if @api_client.config.client_side_validation && resource_id.nil?
|
486
|
+
fail ArgumentError, "Missing the required parameter 'resource_id' when calling ResourceRolesApi.list_resource_roles"
|
487
|
+
end
|
488
|
+
if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
|
489
|
+
fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ResourceRolesApi.list_resource_roles, must be greater than or equal to 1.'
|
490
|
+
end
|
491
|
+
|
492
|
+
if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] > 100
|
493
|
+
fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling ResourceRolesApi.list_resource_roles, must be smaller than or equal to 100.'
|
494
|
+
end
|
495
|
+
|
496
|
+
if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] < 1
|
497
|
+
fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling ResourceRolesApi.list_resource_roles, must be greater than or equal to 1.'
|
498
|
+
end
|
499
|
+
|
500
|
+
# resource path
|
501
|
+
local_var_path = '/v2/schema/{proj_id}/{env_id}/resources/{resource_id}/roles'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s)).sub('{' + 'resource_id' + '}', CGI.escape(resource_id.to_s))
|
502
|
+
|
503
|
+
# query parameters
|
504
|
+
query_params = opts[:query_params] || {}
|
505
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
506
|
+
query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
|
507
|
+
|
508
|
+
# header parameters
|
509
|
+
header_params = opts[:header_params] || {}
|
510
|
+
# HTTP header 'Accept' (if needed)
|
511
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
512
|
+
|
513
|
+
# form parameters
|
514
|
+
form_params = opts[:form_params] || {}
|
515
|
+
|
516
|
+
# http body (model)
|
517
|
+
post_body = opts[:debug_body]
|
518
|
+
|
519
|
+
# return_type
|
520
|
+
return_type = opts[:debug_return_type] || 'Array<ResourceRoleRead>'
|
521
|
+
|
522
|
+
# auth_names
|
523
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
524
|
+
|
525
|
+
new_options = opts.merge(
|
526
|
+
:operation => :"ResourceRolesApi.list_resource_roles",
|
527
|
+
:header_params => header_params,
|
528
|
+
:query_params => query_params,
|
529
|
+
:form_params => form_params,
|
530
|
+
:body => post_body,
|
531
|
+
:auth_names => auth_names,
|
532
|
+
:return_type => return_type
|
533
|
+
)
|
534
|
+
|
535
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
536
|
+
if @api_client.config.debugging
|
537
|
+
@api_client.config.logger.debug "API called: ResourceRolesApi#list_resource_roles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
538
|
+
end
|
539
|
+
return data, status_code, headers
|
540
|
+
end
|
541
|
+
|
542
|
+
# Remove Parent Role
|
543
|
+
# This endpoint is part of the role hierarchy feature. Removes `parent_role_id` from the list of parent roles of role with id `role_id`. In other words, `role_id` will no longer be automatically assigned permissions that are granted to `parent_role_id`. We can say the `role_id` **not longer extends** `parent_role_id` or **no longer inherits** from `parent_role_id`. Both roles must be defined on the same resource, identified by id `resource_id`.
|
544
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
545
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
546
|
+
# @param resource_id [String] Either the unique id of the resource, or the URL-friendly key of the resource (i.e: the \"slug\").
|
547
|
+
# @param role_id [String] Either the unique id of the role, or the URL-friendly key of the role (i.e: the \"slug\").
|
548
|
+
# @param parent_role_id [String] Either the unique id of the parent role, or the URL-friendly key of the parent role (i.e: the \"slug\").
|
549
|
+
# @param [Hash] opts the optional parameters
|
550
|
+
# @return [ResourceRoleRead]
|
551
|
+
def remove_parent_resource_role(proj_id, env_id, resource_id, role_id, parent_role_id, opts = {})
|
552
|
+
data, _status_code, _headers = remove_parent_resource_role_with_http_info(proj_id, env_id, resource_id, role_id, parent_role_id, opts)
|
553
|
+
data
|
554
|
+
end
|
555
|
+
|
556
|
+
# Remove Parent Role
|
557
|
+
# This endpoint is part of the role hierarchy feature. Removes `parent_role_id` from the list of parent roles of role with id `role_id`. In other words, `role_id` will no longer be automatically assigned permissions that are granted to `parent_role_id`. We can say the `role_id` **not longer extends** `parent_role_id` or **no longer inherits** from `parent_role_id`. Both roles must be defined on the same resource, identified by id `resource_id`.
|
558
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
559
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
560
|
+
# @param resource_id [String] Either the unique id of the resource, or the URL-friendly key of the resource (i.e: the \"slug\").
|
561
|
+
# @param role_id [String] Either the unique id of the role, or the URL-friendly key of the role (i.e: the \"slug\").
|
562
|
+
# @param parent_role_id [String] Either the unique id of the parent role, or the URL-friendly key of the parent role (i.e: the \"slug\").
|
563
|
+
# @param [Hash] opts the optional parameters
|
564
|
+
# @return [Array<(ResourceRoleRead, Integer, Hash)>] ResourceRoleRead data, response status code and response headers
|
565
|
+
def remove_parent_resource_role_with_http_info(proj_id, env_id, resource_id, role_id, parent_role_id, opts = {})
|
566
|
+
if @api_client.config.debugging
|
567
|
+
@api_client.config.logger.debug 'Calling API: ResourceRolesApi.remove_parent_resource_role ...'
|
568
|
+
end
|
569
|
+
# verify the required parameter 'proj_id' is set
|
570
|
+
if @api_client.config.client_side_validation && proj_id.nil?
|
571
|
+
fail ArgumentError, "Missing the required parameter 'proj_id' when calling ResourceRolesApi.remove_parent_resource_role"
|
572
|
+
end
|
573
|
+
# verify the required parameter 'env_id' is set
|
574
|
+
if @api_client.config.client_side_validation && env_id.nil?
|
575
|
+
fail ArgumentError, "Missing the required parameter 'env_id' when calling ResourceRolesApi.remove_parent_resource_role"
|
576
|
+
end
|
577
|
+
# verify the required parameter 'resource_id' is set
|
578
|
+
if @api_client.config.client_side_validation && resource_id.nil?
|
579
|
+
fail ArgumentError, "Missing the required parameter 'resource_id' when calling ResourceRolesApi.remove_parent_resource_role"
|
580
|
+
end
|
581
|
+
# verify the required parameter 'role_id' is set
|
582
|
+
if @api_client.config.client_side_validation && role_id.nil?
|
583
|
+
fail ArgumentError, "Missing the required parameter 'role_id' when calling ResourceRolesApi.remove_parent_resource_role"
|
584
|
+
end
|
585
|
+
# verify the required parameter 'parent_role_id' is set
|
586
|
+
if @api_client.config.client_side_validation && parent_role_id.nil?
|
587
|
+
fail ArgumentError, "Missing the required parameter 'parent_role_id' when calling ResourceRolesApi.remove_parent_resource_role"
|
588
|
+
end
|
589
|
+
# resource path
|
590
|
+
local_var_path = '/v2/schema/{proj_id}/{env_id}/resources/{resource_id}/roles/{role_id}/parents/{parent_role_id}'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s)).sub('{' + 'resource_id' + '}', CGI.escape(resource_id.to_s)).sub('{' + 'role_id' + '}', CGI.escape(role_id.to_s)).sub('{' + 'parent_role_id' + '}', CGI.escape(parent_role_id.to_s))
|
591
|
+
|
592
|
+
# query parameters
|
593
|
+
query_params = opts[:query_params] || {}
|
594
|
+
|
595
|
+
# header parameters
|
596
|
+
header_params = opts[:header_params] || {}
|
597
|
+
# HTTP header 'Accept' (if needed)
|
598
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
599
|
+
|
600
|
+
# form parameters
|
601
|
+
form_params = opts[:form_params] || {}
|
602
|
+
|
603
|
+
# http body (model)
|
604
|
+
post_body = opts[:debug_body]
|
605
|
+
|
606
|
+
# return_type
|
607
|
+
return_type = opts[:debug_return_type] || 'ResourceRoleRead'
|
608
|
+
|
609
|
+
# auth_names
|
610
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
611
|
+
|
612
|
+
new_options = opts.merge(
|
613
|
+
:operation => :"ResourceRolesApi.remove_parent_resource_role",
|
614
|
+
:header_params => header_params,
|
615
|
+
:query_params => query_params,
|
616
|
+
:form_params => form_params,
|
617
|
+
:body => post_body,
|
618
|
+
:auth_names => auth_names,
|
619
|
+
:return_type => return_type
|
620
|
+
)
|
621
|
+
|
622
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
623
|
+
if @api_client.config.debugging
|
624
|
+
@api_client.config.logger.debug "API called: ResourceRolesApi#remove_parent_resource_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
625
|
+
end
|
626
|
+
return data, status_code, headers
|
627
|
+
end
|
628
|
+
|
629
|
+
# Remove Permissions from Role
|
630
|
+
# Remove permissions from role. If some of the permissions specified are already unassigned, will skip them.
|
631
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
632
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
633
|
+
# @param resource_id [String] Either the unique id of the resource, or the URL-friendly key of the resource (i.e: the \"slug\").
|
634
|
+
# @param role_id [String] Either the unique id of the role, or the URL-friendly key of the role (i.e: the \"slug\").
|
635
|
+
# @param remove_role_permissions [RemoveRolePermissions]
|
636
|
+
# @param [Hash] opts the optional parameters
|
637
|
+
# @return [ResourceRoleRead]
|
638
|
+
def remove_permissions_from_resource_role(proj_id, env_id, resource_id, role_id, remove_role_permissions, opts = {})
|
639
|
+
data, _status_code, _headers = remove_permissions_from_resource_role_with_http_info(proj_id, env_id, resource_id, role_id, remove_role_permissions, opts)
|
640
|
+
data
|
641
|
+
end
|
642
|
+
|
643
|
+
# Remove Permissions from Role
|
644
|
+
# Remove permissions from role. If some of the permissions specified are already unassigned, will skip them.
|
645
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
646
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
647
|
+
# @param resource_id [String] Either the unique id of the resource, or the URL-friendly key of the resource (i.e: the \"slug\").
|
648
|
+
# @param role_id [String] Either the unique id of the role, or the URL-friendly key of the role (i.e: the \"slug\").
|
649
|
+
# @param remove_role_permissions [RemoveRolePermissions]
|
650
|
+
# @param [Hash] opts the optional parameters
|
651
|
+
# @return [Array<(ResourceRoleRead, Integer, Hash)>] ResourceRoleRead data, response status code and response headers
|
652
|
+
def remove_permissions_from_resource_role_with_http_info(proj_id, env_id, resource_id, role_id, remove_role_permissions, opts = {})
|
653
|
+
if @api_client.config.debugging
|
654
|
+
@api_client.config.logger.debug 'Calling API: ResourceRolesApi.remove_permissions_from_resource_role ...'
|
655
|
+
end
|
656
|
+
# verify the required parameter 'proj_id' is set
|
657
|
+
if @api_client.config.client_side_validation && proj_id.nil?
|
658
|
+
fail ArgumentError, "Missing the required parameter 'proj_id' when calling ResourceRolesApi.remove_permissions_from_resource_role"
|
659
|
+
end
|
660
|
+
# verify the required parameter 'env_id' is set
|
661
|
+
if @api_client.config.client_side_validation && env_id.nil?
|
662
|
+
fail ArgumentError, "Missing the required parameter 'env_id' when calling ResourceRolesApi.remove_permissions_from_resource_role"
|
663
|
+
end
|
664
|
+
# verify the required parameter 'resource_id' is set
|
665
|
+
if @api_client.config.client_side_validation && resource_id.nil?
|
666
|
+
fail ArgumentError, "Missing the required parameter 'resource_id' when calling ResourceRolesApi.remove_permissions_from_resource_role"
|
667
|
+
end
|
668
|
+
# verify the required parameter 'role_id' is set
|
669
|
+
if @api_client.config.client_side_validation && role_id.nil?
|
670
|
+
fail ArgumentError, "Missing the required parameter 'role_id' when calling ResourceRolesApi.remove_permissions_from_resource_role"
|
671
|
+
end
|
672
|
+
# verify the required parameter 'remove_role_permissions' is set
|
673
|
+
if @api_client.config.client_side_validation && remove_role_permissions.nil?
|
674
|
+
fail ArgumentError, "Missing the required parameter 'remove_role_permissions' when calling ResourceRolesApi.remove_permissions_from_resource_role"
|
675
|
+
end
|
676
|
+
# resource path
|
677
|
+
local_var_path = '/v2/schema/{proj_id}/{env_id}/resources/{resource_id}/roles/{role_id}/permissions'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s)).sub('{' + 'resource_id' + '}', CGI.escape(resource_id.to_s)).sub('{' + 'role_id' + '}', CGI.escape(role_id.to_s))
|
678
|
+
|
679
|
+
# query parameters
|
680
|
+
query_params = opts[:query_params] || {}
|
681
|
+
|
682
|
+
# header parameters
|
683
|
+
header_params = opts[:header_params] || {}
|
684
|
+
# HTTP header 'Accept' (if needed)
|
685
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
686
|
+
# HTTP header 'Content-Type'
|
687
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
688
|
+
if !content_type.nil?
|
689
|
+
header_params['Content-Type'] = content_type
|
690
|
+
end
|
691
|
+
|
692
|
+
# form parameters
|
693
|
+
form_params = opts[:form_params] || {}
|
694
|
+
|
695
|
+
# http body (model)
|
696
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(remove_role_permissions)
|
697
|
+
|
698
|
+
# return_type
|
699
|
+
return_type = opts[:debug_return_type] || 'ResourceRoleRead'
|
700
|
+
|
701
|
+
# auth_names
|
702
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
703
|
+
|
704
|
+
new_options = opts.merge(
|
705
|
+
:operation => :"ResourceRolesApi.remove_permissions_from_resource_role",
|
706
|
+
:header_params => header_params,
|
707
|
+
:query_params => query_params,
|
708
|
+
:form_params => form_params,
|
709
|
+
:body => post_body,
|
710
|
+
:auth_names => auth_names,
|
711
|
+
:return_type => return_type
|
712
|
+
)
|
713
|
+
|
714
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
715
|
+
if @api_client.config.debugging
|
716
|
+
@api_client.config.logger.debug "API called: ResourceRolesApi#remove_permissions_from_resource_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
717
|
+
end
|
718
|
+
return data, status_code, headers
|
719
|
+
end
|
720
|
+
|
721
|
+
# Update Resource Role
|
722
|
+
# Partially updates the role defined on a resource. Fields that will be provided will be completely overwritten.
|
723
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
724
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
725
|
+
# @param resource_id [String] Either the unique id of the resource, or the URL-friendly key of the resource (i.e: the \"slug\").
|
726
|
+
# @param role_id [String] Either the unique id of the role, or the URL-friendly key of the role (i.e: the \"slug\").
|
727
|
+
# @param resource_role_update [ResourceRoleUpdate]
|
728
|
+
# @param [Hash] opts the optional parameters
|
729
|
+
# @return [ResourceRoleRead]
|
730
|
+
def update_resource_role(proj_id, env_id, resource_id, role_id, resource_role_update, opts = {})
|
731
|
+
data, _status_code, _headers = update_resource_role_with_http_info(proj_id, env_id, resource_id, role_id, resource_role_update, opts)
|
732
|
+
data
|
733
|
+
end
|
734
|
+
|
735
|
+
# Update Resource Role
|
736
|
+
# Partially updates the role defined on a resource. Fields that will be provided will be completely overwritten.
|
737
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
738
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
739
|
+
# @param resource_id [String] Either the unique id of the resource, or the URL-friendly key of the resource (i.e: the \"slug\").
|
740
|
+
# @param role_id [String] Either the unique id of the role, or the URL-friendly key of the role (i.e: the \"slug\").
|
741
|
+
# @param resource_role_update [ResourceRoleUpdate]
|
742
|
+
# @param [Hash] opts the optional parameters
|
743
|
+
# @return [Array<(ResourceRoleRead, Integer, Hash)>] ResourceRoleRead data, response status code and response headers
|
744
|
+
def update_resource_role_with_http_info(proj_id, env_id, resource_id, role_id, resource_role_update, opts = {})
|
745
|
+
if @api_client.config.debugging
|
746
|
+
@api_client.config.logger.debug 'Calling API: ResourceRolesApi.update_resource_role ...'
|
747
|
+
end
|
748
|
+
# verify the required parameter 'proj_id' is set
|
749
|
+
if @api_client.config.client_side_validation && proj_id.nil?
|
750
|
+
fail ArgumentError, "Missing the required parameter 'proj_id' when calling ResourceRolesApi.update_resource_role"
|
751
|
+
end
|
752
|
+
# verify the required parameter 'env_id' is set
|
753
|
+
if @api_client.config.client_side_validation && env_id.nil?
|
754
|
+
fail ArgumentError, "Missing the required parameter 'env_id' when calling ResourceRolesApi.update_resource_role"
|
755
|
+
end
|
756
|
+
# verify the required parameter 'resource_id' is set
|
757
|
+
if @api_client.config.client_side_validation && resource_id.nil?
|
758
|
+
fail ArgumentError, "Missing the required parameter 'resource_id' when calling ResourceRolesApi.update_resource_role"
|
759
|
+
end
|
760
|
+
# verify the required parameter 'role_id' is set
|
761
|
+
if @api_client.config.client_side_validation && role_id.nil?
|
762
|
+
fail ArgumentError, "Missing the required parameter 'role_id' when calling ResourceRolesApi.update_resource_role"
|
763
|
+
end
|
764
|
+
# verify the required parameter 'resource_role_update' is set
|
765
|
+
if @api_client.config.client_side_validation && resource_role_update.nil?
|
766
|
+
fail ArgumentError, "Missing the required parameter 'resource_role_update' when calling ResourceRolesApi.update_resource_role"
|
767
|
+
end
|
768
|
+
# resource path
|
769
|
+
local_var_path = '/v2/schema/{proj_id}/{env_id}/resources/{resource_id}/roles/{role_id}'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s)).sub('{' + 'resource_id' + '}', CGI.escape(resource_id.to_s)).sub('{' + 'role_id' + '}', CGI.escape(role_id.to_s))
|
770
|
+
|
771
|
+
# query parameters
|
772
|
+
query_params = opts[:query_params] || {}
|
773
|
+
|
774
|
+
# header parameters
|
775
|
+
header_params = opts[:header_params] || {}
|
776
|
+
# HTTP header 'Accept' (if needed)
|
777
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
778
|
+
# HTTP header 'Content-Type'
|
779
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
780
|
+
if !content_type.nil?
|
781
|
+
header_params['Content-Type'] = content_type
|
782
|
+
end
|
783
|
+
|
784
|
+
# form parameters
|
785
|
+
form_params = opts[:form_params] || {}
|
786
|
+
|
787
|
+
# http body (model)
|
788
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(resource_role_update)
|
789
|
+
|
790
|
+
# return_type
|
791
|
+
return_type = opts[:debug_return_type] || 'ResourceRoleRead'
|
792
|
+
|
793
|
+
# auth_names
|
794
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
795
|
+
|
796
|
+
new_options = opts.merge(
|
797
|
+
:operation => :"ResourceRolesApi.update_resource_role",
|
798
|
+
:header_params => header_params,
|
799
|
+
:query_params => query_params,
|
800
|
+
:form_params => form_params,
|
801
|
+
:body => post_body,
|
802
|
+
:auth_names => auth_names,
|
803
|
+
:return_type => return_type
|
804
|
+
)
|
805
|
+
|
806
|
+
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
|
807
|
+
if @api_client.config.debugging
|
808
|
+
@api_client.config.logger.debug "API called: ResourceRolesApi#update_resource_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
809
|
+
end
|
810
|
+
return data, status_code, headers
|
811
|
+
end
|
812
|
+
end
|
813
|
+
end
|