Adds permissions to a profiling group's resource-based policy that are provided using an action group. If a profiling group doesn't have a resource-based policy, one is created for it using the permissions in the action group and the roles and users in the principals parameter.
The one supported action group that can be added is agentPermission which grants ConfigureAgent and PostAgent permissions. For more information, see Resource-based policies in CodeGuru Profiler in the Amazon CodeGuru Profiler User Guide, ConfigureAgent , and PostAgentProfile .
The first time you call PutPermission on a profiling group, do not specify a revisionId because it doesn't have a resource-based policy. Subsequent calls must provide a revisionId to specify which revision of the resource-based policy to add the permissions to.
The response contains the profiling group's JSON-formatted resource policy.
Parameters:
-
profiling_group_name
(ProfilingGroupName)
–
The name of the profiling group to grant access to.
-
action_group
(ActionGroup)
–
Specifies an action group that contains permissions to add to a profiling group resource. One action group is supported, agentPermissions, which grants permission to perform actions required by the profiling agent, ConfigureAgent and PostAgentProfile permissions.
-
principals
(Principals)
–
A list ARNs for the roles and users you want to grant access to the profiling group. Wildcards are not are supported in the ARNs.
-
revision_id
(Optional[RevisionId], default:
None
)
–
A universally unique identifier (UUID) for the revision of the policy you are adding to the profiling group. Do not specify this when you add permissions to a profiling group for the first time. If a policy already exists on the profiling group, you must specify the revisionId.
Raises:
Source code in docs_src/capo_codeguruprofiler/_services/code_guru_profiler.py
| def put_permission(
self,
profiling_group_name: "capo_codeguruprofiler.types.profiling_group_name.ProfilingGroupName",
action_group: "capo_codeguruprofiler.types.action_group.ActionGroup",
principals: "capo_codeguruprofiler.types.principals.Principals",
*,
config_overrides: Optional[CodeGuruProfilerClientConfig] = None,
revision_id: Optional[
"capo_codeguruprofiler.types.revision_id.RevisionId"
] = None,
) -> "capo_codeguruprofiler.types.put_permission_response.PutPermissionResponse":
"""<p> Adds permissions to a profiling group's resource-based policy that are provided using an action group. If a profiling group doesn't have a resource-based policy, one is created for it using the permissions in the action group and the roles and users in the <code>principals</code> parameter. </p> <p> The one supported action group that can be added is <code>agentPermission</code> which grants <code>ConfigureAgent</code> and <code>PostAgent</code> permissions. For more information, see <a href="https://docs.aws.amazon.com/codeguru/latest/profiler-ug/resource-based-policies.html">Resource-based policies in CodeGuru Profiler</a> in the <i>Amazon CodeGuru Profiler User Guide</i>, <a href="https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_ConfigureAgent.html"> <code>ConfigureAgent</code> </a>, and <a href="https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_PostAgentProfile.html"> <code>PostAgentProfile</code> </a>. </p> <p> The first time you call <code>PutPermission</code> on a profiling group, do not specify a <code>revisionId</code> because it doesn't have a resource-based policy. Subsequent calls must provide a <code>revisionId</code> to specify which revision of the resource-based policy to add the permissions to. </p> <p> The response contains the profiling group's JSON-formatted resource policy. </p>
Args:
profiling_group_name: <p>The name of the profiling group to grant access to.</p>
action_group: <p> Specifies an action group that contains permissions to add to a profiling group resource. One action group is supported, <code>agentPermissions</code>, which grants permission to perform actions required by the profiling agent, <code>ConfigureAgent</code> and <code>PostAgentProfile</code> permissions. </p>
principals: <p> A list ARNs for the roles and users you want to grant access to the profiling group. Wildcards are not are supported in the ARNs. </p>
revision_id: <p> A universally unique identifier (UUID) for the revision of the policy you are adding to the profiling group. Do not specify this when you add permissions to a profiling group for the first time. If a policy already exists on the profiling group, you must specify the <code>revisionId</code>. </p>
Raises:
capo_codeguruprofiler.errors.conflict_exception.ConflictException: <p>The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request. </p>
capo_codeguruprofiler.errors.internal_server_exception.InternalServerException: <p>The server encountered an internal error and is unable to complete the request.</p>
capo_codeguruprofiler.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource specified in the request does not exist.</p>
capo_codeguruprofiler.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
capo_codeguruprofiler.errors.validation_exception.ValidationException: <p>The parameter is not valid.</p>
capo_codeguruprofiler.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_codeguruprofiler.types.put_permission_request.PutPermissionRequest]",
) -> OperationResponse[
"capo_codeguruprofiler.types.put_permission_response.PutPermissionResponse"
]:
import capo_codeguruprofiler._operations.code_guru_profiler.put_permission
output, http_response = (
capo_codeguruprofiler._operations.code_guru_profiler.put_permission.put_permission(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("PutPermission")
)
input_: capo_codeguruprofiler.types.put_permission_request.PutPermissionRequest = {
"profiling_group_name": profiling_group_name,
"action_group": action_group,
"principals": principals,
}
if revision_id is not None:
input_["revision_id"] = revision_id
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|