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,684 @@
|
|
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 UsersApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Assign Role To User
|
23
|
+
# Assigns a role to the user within the tenant. The tenant defines the scope of the assignment. In other words, the role is effective only within the tenant.
|
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 user_id [String] Either the unique id of the user, or the URL-friendly key of the user (i.e: the \"slug\").
|
27
|
+
# @param user_role_create [UserRoleCreate]
|
28
|
+
# @param [Hash] opts the optional parameters
|
29
|
+
# @return [RoleAssignmentRead]
|
30
|
+
def assign_role_to_user(proj_id, env_id, user_id, user_role_create, opts = {})
|
31
|
+
data, _status_code, _headers = assign_role_to_user_with_http_info(proj_id, env_id, user_id, user_role_create, opts)
|
32
|
+
data
|
33
|
+
end
|
34
|
+
|
35
|
+
# Assign Role To User
|
36
|
+
# Assigns a role to the user within the tenant. The tenant defines the scope of the assignment. In other words, the role is effective only within the tenant.
|
37
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
38
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
39
|
+
# @param user_id [String] Either the unique id of the user, or the URL-friendly key of the user (i.e: the \"slug\").
|
40
|
+
# @param user_role_create [UserRoleCreate]
|
41
|
+
# @param [Hash] opts the optional parameters
|
42
|
+
# @return [Array<(RoleAssignmentRead, Integer, Hash)>] RoleAssignmentRead data, response status code and response headers
|
43
|
+
def assign_role_to_user_with_http_info(proj_id, env_id, user_id, user_role_create, opts = {})
|
44
|
+
if @api_client.config.debugging
|
45
|
+
@api_client.config.logger.debug 'Calling API: UsersApi.assign_role_to_user ...'
|
46
|
+
end
|
47
|
+
# verify the required parameter 'proj_id' is set
|
48
|
+
if @api_client.config.client_side_validation && proj_id.nil?
|
49
|
+
fail ArgumentError, "Missing the required parameter 'proj_id' when calling UsersApi.assign_role_to_user"
|
50
|
+
end
|
51
|
+
# verify the required parameter 'env_id' is set
|
52
|
+
if @api_client.config.client_side_validation && env_id.nil?
|
53
|
+
fail ArgumentError, "Missing the required parameter 'env_id' when calling UsersApi.assign_role_to_user"
|
54
|
+
end
|
55
|
+
# verify the required parameter 'user_id' is set
|
56
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
57
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling UsersApi.assign_role_to_user"
|
58
|
+
end
|
59
|
+
# verify the required parameter 'user_role_create' is set
|
60
|
+
if @api_client.config.client_side_validation && user_role_create.nil?
|
61
|
+
fail ArgumentError, "Missing the required parameter 'user_role_create' when calling UsersApi.assign_role_to_user"
|
62
|
+
end
|
63
|
+
# resource path
|
64
|
+
local_var_path = '/v2/facts/{proj_id}/{env_id}/users/{user_id}/roles'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s)).sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s))
|
65
|
+
|
66
|
+
# query parameters
|
67
|
+
query_params = opts[:query_params] || {}
|
68
|
+
|
69
|
+
# header parameters
|
70
|
+
header_params = opts[:header_params] || {}
|
71
|
+
# HTTP header 'Accept' (if needed)
|
72
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
73
|
+
# HTTP header 'Content-Type'
|
74
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
75
|
+
if !content_type.nil?
|
76
|
+
header_params['Content-Type'] = content_type
|
77
|
+
end
|
78
|
+
|
79
|
+
# form parameters
|
80
|
+
form_params = opts[:form_params] || {}
|
81
|
+
|
82
|
+
# http body (model)
|
83
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(user_role_create)
|
84
|
+
|
85
|
+
# return_type
|
86
|
+
return_type = opts[:debug_return_type] || 'RoleAssignmentRead'
|
87
|
+
|
88
|
+
# auth_names
|
89
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
90
|
+
|
91
|
+
new_options = opts.merge(
|
92
|
+
:operation => :"UsersApi.assign_role_to_user",
|
93
|
+
:header_params => header_params,
|
94
|
+
:query_params => query_params,
|
95
|
+
:form_params => form_params,
|
96
|
+
:body => post_body,
|
97
|
+
:auth_names => auth_names,
|
98
|
+
:return_type => return_type
|
99
|
+
)
|
100
|
+
|
101
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
102
|
+
if @api_client.config.debugging
|
103
|
+
@api_client.config.logger.debug "API called: UsersApi#assign_role_to_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
104
|
+
end
|
105
|
+
return data, status_code, headers
|
106
|
+
end
|
107
|
+
|
108
|
+
# Create User
|
109
|
+
# Creates a new user inside the Permit.io system, from that point forward you may run permission checks on that user. If the user is already created: will return 200 instead of 201, and will return the existing user object in the response body.
|
110
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
111
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
112
|
+
# @param user_create [UserCreate]
|
113
|
+
# @param [Hash] opts the optional parameters
|
114
|
+
# @return [UserRead]
|
115
|
+
def create_user(proj_id, env_id, user_create, opts = {})
|
116
|
+
data, _status_code, _headers = create_user_with_http_info(proj_id, env_id, user_create, opts)
|
117
|
+
data
|
118
|
+
end
|
119
|
+
|
120
|
+
# Create User
|
121
|
+
# Creates a new user inside the Permit.io system, from that point forward you may run permission checks on that user. If the user is already created: will return 200 instead of 201, and will return the existing user object in the response body.
|
122
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
123
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
124
|
+
# @param user_create [UserCreate]
|
125
|
+
# @param [Hash] opts the optional parameters
|
126
|
+
# @return [Array<(UserRead, Integer, Hash)>] UserRead data, response status code and response headers
|
127
|
+
def create_user_with_http_info(proj_id, env_id, user_create, opts = {})
|
128
|
+
if @api_client.config.debugging
|
129
|
+
@api_client.config.logger.debug 'Calling API: UsersApi.create_user ...'
|
130
|
+
end
|
131
|
+
# verify the required parameter 'proj_id' is set
|
132
|
+
if @api_client.config.client_side_validation && proj_id.nil?
|
133
|
+
fail ArgumentError, "Missing the required parameter 'proj_id' when calling UsersApi.create_user"
|
134
|
+
end
|
135
|
+
# verify the required parameter 'env_id' is set
|
136
|
+
if @api_client.config.client_side_validation && env_id.nil?
|
137
|
+
fail ArgumentError, "Missing the required parameter 'env_id' when calling UsersApi.create_user"
|
138
|
+
end
|
139
|
+
# verify the required parameter 'user_create' is set
|
140
|
+
if @api_client.config.client_side_validation && user_create.nil?
|
141
|
+
fail ArgumentError, "Missing the required parameter 'user_create' when calling UsersApi.create_user"
|
142
|
+
end
|
143
|
+
# resource path
|
144
|
+
local_var_path = '/v2/facts/{proj_id}/{env_id}/users'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s))
|
145
|
+
|
146
|
+
# query parameters
|
147
|
+
query_params = opts[:query_params] || {}
|
148
|
+
|
149
|
+
# header parameters
|
150
|
+
header_params = opts[:header_params] || {}
|
151
|
+
# HTTP header 'Accept' (if needed)
|
152
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
153
|
+
# HTTP header 'Content-Type'
|
154
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
155
|
+
if !content_type.nil?
|
156
|
+
header_params['Content-Type'] = content_type
|
157
|
+
end
|
158
|
+
|
159
|
+
# form parameters
|
160
|
+
form_params = opts[:form_params] || {}
|
161
|
+
|
162
|
+
# http body (model)
|
163
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(user_create)
|
164
|
+
|
165
|
+
# return_type
|
166
|
+
return_type = opts[:debug_return_type] || 'UserRead'
|
167
|
+
|
168
|
+
# auth_names
|
169
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
170
|
+
|
171
|
+
new_options = opts.merge(
|
172
|
+
:operation => :"UsersApi.create_user",
|
173
|
+
:header_params => header_params,
|
174
|
+
:query_params => query_params,
|
175
|
+
:form_params => form_params,
|
176
|
+
:body => post_body,
|
177
|
+
:auth_names => auth_names,
|
178
|
+
:return_type => return_type
|
179
|
+
)
|
180
|
+
|
181
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
182
|
+
if @api_client.config.debugging
|
183
|
+
@api_client.config.logger.debug "API called: UsersApi#create_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
184
|
+
end
|
185
|
+
return data, status_code, headers
|
186
|
+
end
|
187
|
+
|
188
|
+
# Delete User
|
189
|
+
# Deletes the user and all its related data.
|
190
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
191
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
192
|
+
# @param user_id [String] Either the unique id of the user, or the URL-friendly key of the user (i.e: the \"slug\").
|
193
|
+
# @param [Hash] opts the optional parameters
|
194
|
+
# @return [nil]
|
195
|
+
def delete_user(proj_id, env_id, user_id, opts = {})
|
196
|
+
delete_user_with_http_info(proj_id, env_id, user_id, opts)
|
197
|
+
nil
|
198
|
+
end
|
199
|
+
|
200
|
+
# Delete User
|
201
|
+
# Deletes the user and all its related data.
|
202
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
203
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
204
|
+
# @param user_id [String] Either the unique id of the user, or the URL-friendly key of the user (i.e: the \"slug\").
|
205
|
+
# @param [Hash] opts the optional parameters
|
206
|
+
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
207
|
+
def delete_user_with_http_info(proj_id, env_id, user_id, opts = {})
|
208
|
+
if @api_client.config.debugging
|
209
|
+
@api_client.config.logger.debug 'Calling API: UsersApi.delete_user ...'
|
210
|
+
end
|
211
|
+
# verify the required parameter 'proj_id' is set
|
212
|
+
if @api_client.config.client_side_validation && proj_id.nil?
|
213
|
+
fail ArgumentError, "Missing the required parameter 'proj_id' when calling UsersApi.delete_user"
|
214
|
+
end
|
215
|
+
# verify the required parameter 'env_id' is set
|
216
|
+
if @api_client.config.client_side_validation && env_id.nil?
|
217
|
+
fail ArgumentError, "Missing the required parameter 'env_id' when calling UsersApi.delete_user"
|
218
|
+
end
|
219
|
+
# verify the required parameter 'user_id' is set
|
220
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
221
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling UsersApi.delete_user"
|
222
|
+
end
|
223
|
+
# resource path
|
224
|
+
local_var_path = '/v2/facts/{proj_id}/{env_id}/users/{user_id}'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s)).sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s))
|
225
|
+
|
226
|
+
# query parameters
|
227
|
+
query_params = opts[:query_params] || {}
|
228
|
+
|
229
|
+
# header parameters
|
230
|
+
header_params = opts[:header_params] || {}
|
231
|
+
# HTTP header 'Accept' (if needed)
|
232
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
233
|
+
|
234
|
+
# form parameters
|
235
|
+
form_params = opts[:form_params] || {}
|
236
|
+
|
237
|
+
# http body (model)
|
238
|
+
post_body = opts[:debug_body]
|
239
|
+
|
240
|
+
# return_type
|
241
|
+
return_type = opts[:debug_return_type]
|
242
|
+
|
243
|
+
# auth_names
|
244
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
245
|
+
|
246
|
+
new_options = opts.merge(
|
247
|
+
:operation => :"UsersApi.delete_user",
|
248
|
+
:header_params => header_params,
|
249
|
+
:query_params => query_params,
|
250
|
+
:form_params => form_params,
|
251
|
+
:body => post_body,
|
252
|
+
:auth_names => auth_names,
|
253
|
+
:return_type => return_type
|
254
|
+
)
|
255
|
+
|
256
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
257
|
+
if @api_client.config.debugging
|
258
|
+
@api_client.config.logger.debug "API called: UsersApi#delete_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
259
|
+
end
|
260
|
+
return data, status_code, headers
|
261
|
+
end
|
262
|
+
|
263
|
+
# Get User
|
264
|
+
# Gets a user, if such user exists. Otherwise returns 404.
|
265
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
266
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
267
|
+
# @param user_id [String] Either the unique id of the user, or the URL-friendly key of the user (i.e: the \"slug\").
|
268
|
+
# @param [Hash] opts the optional parameters
|
269
|
+
# @return [UserRead]
|
270
|
+
def get_user(proj_id, env_id, user_id, opts = {})
|
271
|
+
data, _status_code, _headers = get_user_with_http_info(proj_id, env_id, user_id, opts)
|
272
|
+
data
|
273
|
+
end
|
274
|
+
|
275
|
+
# Get User
|
276
|
+
# Gets a user, if such user exists. Otherwise returns 404.
|
277
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
278
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
279
|
+
# @param user_id [String] Either the unique id of the user, or the URL-friendly key of the user (i.e: the \"slug\").
|
280
|
+
# @param [Hash] opts the optional parameters
|
281
|
+
# @return [Array<(UserRead, Integer, Hash)>] UserRead data, response status code and response headers
|
282
|
+
def get_user_with_http_info(proj_id, env_id, user_id, opts = {})
|
283
|
+
if @api_client.config.debugging
|
284
|
+
@api_client.config.logger.debug 'Calling API: UsersApi.get_user ...'
|
285
|
+
end
|
286
|
+
# verify the required parameter 'proj_id' is set
|
287
|
+
if @api_client.config.client_side_validation && proj_id.nil?
|
288
|
+
fail ArgumentError, "Missing the required parameter 'proj_id' when calling UsersApi.get_user"
|
289
|
+
end
|
290
|
+
# verify the required parameter 'env_id' is set
|
291
|
+
if @api_client.config.client_side_validation && env_id.nil?
|
292
|
+
fail ArgumentError, "Missing the required parameter 'env_id' when calling UsersApi.get_user"
|
293
|
+
end
|
294
|
+
# verify the required parameter 'user_id' is set
|
295
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
296
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling UsersApi.get_user"
|
297
|
+
end
|
298
|
+
# resource path
|
299
|
+
local_var_path = '/v2/facts/{proj_id}/{env_id}/users/{user_id}'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s)).sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s))
|
300
|
+
|
301
|
+
# query parameters
|
302
|
+
query_params = opts[:query_params] || {}
|
303
|
+
|
304
|
+
# header parameters
|
305
|
+
header_params = opts[:header_params] || {}
|
306
|
+
# HTTP header 'Accept' (if needed)
|
307
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
308
|
+
|
309
|
+
# form parameters
|
310
|
+
form_params = opts[:form_params] || {}
|
311
|
+
|
312
|
+
# http body (model)
|
313
|
+
post_body = opts[:debug_body]
|
314
|
+
|
315
|
+
# return_type
|
316
|
+
return_type = opts[:debug_return_type] || 'UserRead'
|
317
|
+
|
318
|
+
# auth_names
|
319
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
320
|
+
|
321
|
+
new_options = opts.merge(
|
322
|
+
:operation => :"UsersApi.get_user",
|
323
|
+
:header_params => header_params,
|
324
|
+
:query_params => query_params,
|
325
|
+
:form_params => form_params,
|
326
|
+
:body => post_body,
|
327
|
+
:auth_names => auth_names,
|
328
|
+
:return_type => return_type
|
329
|
+
)
|
330
|
+
|
331
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
332
|
+
if @api_client.config.debugging
|
333
|
+
@api_client.config.logger.debug "API called: UsersApi#get_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
334
|
+
end
|
335
|
+
return data, status_code, headers
|
336
|
+
end
|
337
|
+
|
338
|
+
# List Users
|
339
|
+
# Lists all the users defined within an environment.
|
340
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
341
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
342
|
+
# @param [Hash] opts the optional parameters
|
343
|
+
# @option opts [String] :search Text search for the email field
|
344
|
+
# @option opts [Integer] :page Page number of the results to fetch, starting at 1. (default to 1)
|
345
|
+
# @option opts [Integer] :per_page The number of results per page (max 100). (default to 30)
|
346
|
+
# @return [PaginatedResultUserRead]
|
347
|
+
def list_users(proj_id, env_id, opts = {})
|
348
|
+
data, _status_code, _headers = list_users_with_http_info(proj_id, env_id, opts)
|
349
|
+
data
|
350
|
+
end
|
351
|
+
|
352
|
+
# List Users
|
353
|
+
# Lists all the users defined within an environment.
|
354
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
355
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
356
|
+
# @param [Hash] opts the optional parameters
|
357
|
+
# @option opts [String] :search Text search for the email field
|
358
|
+
# @option opts [Integer] :page Page number of the results to fetch, starting at 1. (default to 1)
|
359
|
+
# @option opts [Integer] :per_page The number of results per page (max 100). (default to 30)
|
360
|
+
# @return [Array<(PaginatedResultUserRead, Integer, Hash)>] PaginatedResultUserRead data, response status code and response headers
|
361
|
+
def list_users_with_http_info(proj_id, env_id, opts = {})
|
362
|
+
if @api_client.config.debugging
|
363
|
+
@api_client.config.logger.debug 'Calling API: UsersApi.list_users ...'
|
364
|
+
end
|
365
|
+
# verify the required parameter 'proj_id' is set
|
366
|
+
if @api_client.config.client_side_validation && proj_id.nil?
|
367
|
+
fail ArgumentError, "Missing the required parameter 'proj_id' when calling UsersApi.list_users"
|
368
|
+
end
|
369
|
+
# verify the required parameter 'env_id' is set
|
370
|
+
if @api_client.config.client_side_validation && env_id.nil?
|
371
|
+
fail ArgumentError, "Missing the required parameter 'env_id' when calling UsersApi.list_users"
|
372
|
+
end
|
373
|
+
if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
|
374
|
+
fail ArgumentError, 'invalid value for "opts[:"page"]" when calling UsersApi.list_users, must be greater than or equal to 1.'
|
375
|
+
end
|
376
|
+
|
377
|
+
if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] > 100
|
378
|
+
fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling UsersApi.list_users, must be smaller than or equal to 100.'
|
379
|
+
end
|
380
|
+
|
381
|
+
if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] < 1
|
382
|
+
fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling UsersApi.list_users, must be greater than or equal to 1.'
|
383
|
+
end
|
384
|
+
|
385
|
+
# resource path
|
386
|
+
local_var_path = '/v2/facts/{proj_id}/{env_id}/users'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s))
|
387
|
+
|
388
|
+
# query parameters
|
389
|
+
query_params = opts[:query_params] || {}
|
390
|
+
query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?
|
391
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
392
|
+
query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
|
393
|
+
|
394
|
+
# header parameters
|
395
|
+
header_params = opts[:header_params] || {}
|
396
|
+
# HTTP header 'Accept' (if needed)
|
397
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
398
|
+
|
399
|
+
# form parameters
|
400
|
+
form_params = opts[:form_params] || {}
|
401
|
+
|
402
|
+
# http body (model)
|
403
|
+
post_body = opts[:debug_body]
|
404
|
+
|
405
|
+
# return_type
|
406
|
+
return_type = opts[:debug_return_type] || 'PaginatedResultUserRead'
|
407
|
+
|
408
|
+
# auth_names
|
409
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
410
|
+
|
411
|
+
new_options = opts.merge(
|
412
|
+
:operation => :"UsersApi.list_users",
|
413
|
+
:header_params => header_params,
|
414
|
+
:query_params => query_params,
|
415
|
+
:form_params => form_params,
|
416
|
+
:body => post_body,
|
417
|
+
:auth_names => auth_names,
|
418
|
+
:return_type => return_type
|
419
|
+
)
|
420
|
+
|
421
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
422
|
+
if @api_client.config.debugging
|
423
|
+
@api_client.config.logger.debug "API called: UsersApi#list_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
424
|
+
end
|
425
|
+
return data, status_code, headers
|
426
|
+
end
|
427
|
+
|
428
|
+
# Replace User
|
429
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
430
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
431
|
+
# @param user_id [String] Either the unique id of the user, or the URL-friendly key of the user (i.e: the \"slug\").
|
432
|
+
# @param user_create [UserCreate]
|
433
|
+
# @param [Hash] opts the optional parameters
|
434
|
+
# @return [UserRead]
|
435
|
+
def replace_user(proj_id, env_id, user_id, user_create, opts = {})
|
436
|
+
data, _status_code, _headers = replace_user_with_http_info(proj_id, env_id, user_id, user_create, opts)
|
437
|
+
data
|
438
|
+
end
|
439
|
+
|
440
|
+
# Replace User
|
441
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
442
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
443
|
+
# @param user_id [String] Either the unique id of the user, or the URL-friendly key of the user (i.e: the \"slug\").
|
444
|
+
# @param user_create [UserCreate]
|
445
|
+
# @param [Hash] opts the optional parameters
|
446
|
+
# @return [Array<(UserRead, Integer, Hash)>] UserRead data, response status code and response headers
|
447
|
+
def replace_user_with_http_info(proj_id, env_id, user_id, user_create, opts = {})
|
448
|
+
if @api_client.config.debugging
|
449
|
+
@api_client.config.logger.debug 'Calling API: UsersApi.replace_user ...'
|
450
|
+
end
|
451
|
+
# verify the required parameter 'proj_id' is set
|
452
|
+
if @api_client.config.client_side_validation && proj_id.nil?
|
453
|
+
fail ArgumentError, "Missing the required parameter 'proj_id' when calling UsersApi.replace_user"
|
454
|
+
end
|
455
|
+
# verify the required parameter 'env_id' is set
|
456
|
+
if @api_client.config.client_side_validation && env_id.nil?
|
457
|
+
fail ArgumentError, "Missing the required parameter 'env_id' when calling UsersApi.replace_user"
|
458
|
+
end
|
459
|
+
# verify the required parameter 'user_id' is set
|
460
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
461
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling UsersApi.replace_user"
|
462
|
+
end
|
463
|
+
# verify the required parameter 'user_create' is set
|
464
|
+
if @api_client.config.client_side_validation && user_create.nil?
|
465
|
+
fail ArgumentError, "Missing the required parameter 'user_create' when calling UsersApi.replace_user"
|
466
|
+
end
|
467
|
+
# resource path
|
468
|
+
local_var_path = '/v2/facts/{proj_id}/{env_id}/users/{user_id}'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s)).sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s))
|
469
|
+
|
470
|
+
# query parameters
|
471
|
+
query_params = opts[:query_params] || {}
|
472
|
+
|
473
|
+
# header parameters
|
474
|
+
header_params = opts[:header_params] || {}
|
475
|
+
# HTTP header 'Accept' (if needed)
|
476
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
477
|
+
# HTTP header 'Content-Type'
|
478
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
479
|
+
if !content_type.nil?
|
480
|
+
header_params['Content-Type'] = content_type
|
481
|
+
end
|
482
|
+
|
483
|
+
# form parameters
|
484
|
+
form_params = opts[:form_params] || {}
|
485
|
+
|
486
|
+
# http body (model)
|
487
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(user_create)
|
488
|
+
|
489
|
+
# return_type
|
490
|
+
return_type = opts[:debug_return_type] || 'UserRead'
|
491
|
+
|
492
|
+
# auth_names
|
493
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
494
|
+
|
495
|
+
new_options = opts.merge(
|
496
|
+
:operation => :"UsersApi.replace_user",
|
497
|
+
:header_params => header_params,
|
498
|
+
:query_params => query_params,
|
499
|
+
:form_params => form_params,
|
500
|
+
:body => post_body,
|
501
|
+
:auth_names => auth_names,
|
502
|
+
:return_type => return_type
|
503
|
+
)
|
504
|
+
|
505
|
+
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
|
506
|
+
if @api_client.config.debugging
|
507
|
+
@api_client.config.logger.debug "API called: UsersApi#replace_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
508
|
+
end
|
509
|
+
return data, status_code, headers
|
510
|
+
end
|
511
|
+
|
512
|
+
# Unassign Role From User
|
513
|
+
# Unassigns the role from the user within the tenant. The tenant defines the scope of the assignment. In other words, the role is effective only within the tenant. If the role is not actually assigned, will return 404.
|
514
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
515
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
516
|
+
# @param user_id [String] Either the unique id of the user, or the URL-friendly key of the user (i.e: the \"slug\").
|
517
|
+
# @param user_role_remove [UserRoleRemove]
|
518
|
+
# @param [Hash] opts the optional parameters
|
519
|
+
# @return [UserRead]
|
520
|
+
def unassign_role_from_user(proj_id, env_id, user_id, user_role_remove, opts = {})
|
521
|
+
data, _status_code, _headers = unassign_role_from_user_with_http_info(proj_id, env_id, user_id, user_role_remove, opts)
|
522
|
+
data
|
523
|
+
end
|
524
|
+
|
525
|
+
# Unassign Role From User
|
526
|
+
# Unassigns the role from the user within the tenant. The tenant defines the scope of the assignment. In other words, the role is effective only within the tenant. If the role is not actually assigned, will return 404.
|
527
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
528
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
529
|
+
# @param user_id [String] Either the unique id of the user, or the URL-friendly key of the user (i.e: the \"slug\").
|
530
|
+
# @param user_role_remove [UserRoleRemove]
|
531
|
+
# @param [Hash] opts the optional parameters
|
532
|
+
# @return [Array<(UserRead, Integer, Hash)>] UserRead data, response status code and response headers
|
533
|
+
def unassign_role_from_user_with_http_info(proj_id, env_id, user_id, user_role_remove, opts = {})
|
534
|
+
if @api_client.config.debugging
|
535
|
+
@api_client.config.logger.debug 'Calling API: UsersApi.unassign_role_from_user ...'
|
536
|
+
end
|
537
|
+
# verify the required parameter 'proj_id' is set
|
538
|
+
if @api_client.config.client_side_validation && proj_id.nil?
|
539
|
+
fail ArgumentError, "Missing the required parameter 'proj_id' when calling UsersApi.unassign_role_from_user"
|
540
|
+
end
|
541
|
+
# verify the required parameter 'env_id' is set
|
542
|
+
if @api_client.config.client_side_validation && env_id.nil?
|
543
|
+
fail ArgumentError, "Missing the required parameter 'env_id' when calling UsersApi.unassign_role_from_user"
|
544
|
+
end
|
545
|
+
# verify the required parameter 'user_id' is set
|
546
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
547
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling UsersApi.unassign_role_from_user"
|
548
|
+
end
|
549
|
+
# verify the required parameter 'user_role_remove' is set
|
550
|
+
if @api_client.config.client_side_validation && user_role_remove.nil?
|
551
|
+
fail ArgumentError, "Missing the required parameter 'user_role_remove' when calling UsersApi.unassign_role_from_user"
|
552
|
+
end
|
553
|
+
# resource path
|
554
|
+
local_var_path = '/v2/facts/{proj_id}/{env_id}/users/{user_id}/roles'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s)).sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s))
|
555
|
+
|
556
|
+
# query parameters
|
557
|
+
query_params = opts[:query_params] || {}
|
558
|
+
|
559
|
+
# header parameters
|
560
|
+
header_params = opts[:header_params] || {}
|
561
|
+
# HTTP header 'Accept' (if needed)
|
562
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
563
|
+
# HTTP header 'Content-Type'
|
564
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
565
|
+
if !content_type.nil?
|
566
|
+
header_params['Content-Type'] = content_type
|
567
|
+
end
|
568
|
+
|
569
|
+
# form parameters
|
570
|
+
form_params = opts[:form_params] || {}
|
571
|
+
|
572
|
+
# http body (model)
|
573
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(user_role_remove)
|
574
|
+
|
575
|
+
# return_type
|
576
|
+
return_type = opts[:debug_return_type] || 'UserRead'
|
577
|
+
|
578
|
+
# auth_names
|
579
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
580
|
+
|
581
|
+
new_options = opts.merge(
|
582
|
+
:operation => :"UsersApi.unassign_role_from_user",
|
583
|
+
:header_params => header_params,
|
584
|
+
:query_params => query_params,
|
585
|
+
:form_params => form_params,
|
586
|
+
:body => post_body,
|
587
|
+
:auth_names => auth_names,
|
588
|
+
:return_type => return_type
|
589
|
+
)
|
590
|
+
|
591
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
592
|
+
if @api_client.config.debugging
|
593
|
+
@api_client.config.logger.debug "API called: UsersApi#unassign_role_from_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
594
|
+
end
|
595
|
+
return data, status_code, headers
|
596
|
+
end
|
597
|
+
|
598
|
+
# Update User
|
599
|
+
# Partially updates the user definition. Fields that will be provided will be completely overwritten.
|
600
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
601
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
602
|
+
# @param user_id [String] Either the unique id of the user, or the URL-friendly key of the user (i.e: the \"slug\").
|
603
|
+
# @param user_update [UserUpdate]
|
604
|
+
# @param [Hash] opts the optional parameters
|
605
|
+
# @return [UserRead]
|
606
|
+
def update_user(proj_id, env_id, user_id, user_update, opts = {})
|
607
|
+
data, _status_code, _headers = update_user_with_http_info(proj_id, env_id, user_id, user_update, opts)
|
608
|
+
data
|
609
|
+
end
|
610
|
+
|
611
|
+
# Update User
|
612
|
+
# Partially updates the user definition. Fields that will be provided will be completely overwritten.
|
613
|
+
# @param proj_id [String] Either the unique id of the project, or the URL-friendly key of the project (i.e: the \"slug\").
|
614
|
+
# @param env_id [String] Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the \"slug\").
|
615
|
+
# @param user_id [String] Either the unique id of the user, or the URL-friendly key of the user (i.e: the \"slug\").
|
616
|
+
# @param user_update [UserUpdate]
|
617
|
+
# @param [Hash] opts the optional parameters
|
618
|
+
# @return [Array<(UserRead, Integer, Hash)>] UserRead data, response status code and response headers
|
619
|
+
def update_user_with_http_info(proj_id, env_id, user_id, user_update, opts = {})
|
620
|
+
if @api_client.config.debugging
|
621
|
+
@api_client.config.logger.debug 'Calling API: UsersApi.update_user ...'
|
622
|
+
end
|
623
|
+
# verify the required parameter 'proj_id' is set
|
624
|
+
if @api_client.config.client_side_validation && proj_id.nil?
|
625
|
+
fail ArgumentError, "Missing the required parameter 'proj_id' when calling UsersApi.update_user"
|
626
|
+
end
|
627
|
+
# verify the required parameter 'env_id' is set
|
628
|
+
if @api_client.config.client_side_validation && env_id.nil?
|
629
|
+
fail ArgumentError, "Missing the required parameter 'env_id' when calling UsersApi.update_user"
|
630
|
+
end
|
631
|
+
# verify the required parameter 'user_id' is set
|
632
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
633
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling UsersApi.update_user"
|
634
|
+
end
|
635
|
+
# verify the required parameter 'user_update' is set
|
636
|
+
if @api_client.config.client_side_validation && user_update.nil?
|
637
|
+
fail ArgumentError, "Missing the required parameter 'user_update' when calling UsersApi.update_user"
|
638
|
+
end
|
639
|
+
# resource path
|
640
|
+
local_var_path = '/v2/facts/{proj_id}/{env_id}/users/{user_id}'.sub('{' + 'proj_id' + '}', CGI.escape(proj_id.to_s)).sub('{' + 'env_id' + '}', CGI.escape(env_id.to_s)).sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s))
|
641
|
+
|
642
|
+
# query parameters
|
643
|
+
query_params = opts[:query_params] || {}
|
644
|
+
|
645
|
+
# header parameters
|
646
|
+
header_params = opts[:header_params] || {}
|
647
|
+
# HTTP header 'Accept' (if needed)
|
648
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
649
|
+
# HTTP header 'Content-Type'
|
650
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
651
|
+
if !content_type.nil?
|
652
|
+
header_params['Content-Type'] = content_type
|
653
|
+
end
|
654
|
+
|
655
|
+
# form parameters
|
656
|
+
form_params = opts[:form_params] || {}
|
657
|
+
|
658
|
+
# http body (model)
|
659
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(user_update)
|
660
|
+
|
661
|
+
# return_type
|
662
|
+
return_type = opts[:debug_return_type] || 'UserRead'
|
663
|
+
|
664
|
+
# auth_names
|
665
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
666
|
+
|
667
|
+
new_options = opts.merge(
|
668
|
+
:operation => :"UsersApi.update_user",
|
669
|
+
:header_params => header_params,
|
670
|
+
:query_params => query_params,
|
671
|
+
:form_params => form_params,
|
672
|
+
:body => post_body,
|
673
|
+
:auth_names => auth_names,
|
674
|
+
:return_type => return_type
|
675
|
+
)
|
676
|
+
|
677
|
+
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
|
678
|
+
if @api_client.config.debugging
|
679
|
+
@api_client.config.logger.debug "API called: UsersApi#update_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
680
|
+
end
|
681
|
+
return data, status_code, headers
|
682
|
+
end
|
683
|
+
end
|
684
|
+
end
|