Method: OpenapiClient::ResourceRolesApi#add_parent_resource_role_with_http_info

Defined in:
lib/openapi_client/api/resource_roles_api.rb

#add_parent_resource_role_with_http_info(proj_id, env_id, resource_id, role_id, parent_role_id, opts = {}) ⇒ Array<(ResourceRoleRead, Integer, Hash)>

Add Parent Role This endpoint is part of the role hierarchy feature. Makes role with id &#x60;role_id&#x60; extend the role with id &#x60;parent_role_id&#x60;. In other words, &#x60;role_id&#x60; will automatically be assigned any permissions that are granted to &#x60;parent_role_id&#x60;. We can say the &#x60;role_id&#x60; extends &#x60;parent_role_id&#x60; or inherits from &#x60;parent_role_id&#x60;. If &#x60;role_id&#x60; is already an ancestor of &#x60;parent_role_id&#x60;, 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 &#x60;resource_id&#x60;.

Parameters:

  • proj_id (String)

    Either the unique id of the project, or the URL-friendly key of the project (i.e: the &quot;slug&quot;).

  • env_id (String)

    Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the &quot;slug&quot;).

  • resource_id (String)

    Either the unique id of the resource, or the URL-friendly key of the resource (i.e: the &quot;slug&quot;).

  • role_id (String)

    Either the unique id of the role, or the URL-friendly key of the role (i.e: the &quot;slug&quot;).

  • parent_role_id (String)

    Either the unique id of the parent role, or the URL-friendly key of the parent role (i.e: the &quot;slug&quot;).

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ResourceRoleRead, Integer, Hash)>)

    ResourceRoleRead data, response status code and response headers



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/openapi_client/api/resource_roles_api.rb', line 45

def add_parent_resource_role_with_http_info(proj_id, env_id, resource_id, role_id, parent_role_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ResourceRolesApi.add_parent_resource_role ...'
  end
  # verify the required parameter 'proj_id' is set
  if @api_client.config.client_side_validation && proj_id.nil?
    fail ArgumentError, "Missing the required parameter 'proj_id' when calling ResourceRolesApi.add_parent_resource_role"
  end
  # verify the required parameter 'env_id' is set
  if @api_client.config.client_side_validation && env_id.nil?
    fail ArgumentError, "Missing the required parameter 'env_id' when calling ResourceRolesApi.add_parent_resource_role"
  end
  # verify the required parameter 'resource_id' is set
  if @api_client.config.client_side_validation && resource_id.nil?
    fail ArgumentError, "Missing the required parameter 'resource_id' when calling ResourceRolesApi.add_parent_resource_role"
  end
  # verify the required parameter 'role_id' is set
  if @api_client.config.client_side_validation && role_id.nil?
    fail ArgumentError, "Missing the required parameter 'role_id' when calling ResourceRolesApi.add_parent_resource_role"
  end
  # verify the required parameter 'parent_role_id' is set
  if @api_client.config.client_side_validation && parent_role_id.nil?
    fail ArgumentError, "Missing the required parameter 'parent_role_id' when calling ResourceRolesApi.add_parent_resource_role"
  end
  # resource path
  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))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ResourceRoleRead'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"ResourceRolesApi.add_parent_resource_role",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ResourceRolesApi#add_parent_resource_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end