putPermission method

Future<PutPermissionResponse> putPermission({
  1. required ActionGroup actionGroup,
  2. required List<String> principals,
  3. required String profilingGroupName,
  4. String? revisionId,
})

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.

May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter 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.

Parameter 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.

Parameter profilingGroupName : The name of the profiling group to grant access to.

Parameter revisionId : 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.

Implementation

Future<PutPermissionResponse> putPermission({
  required ActionGroup actionGroup,
  required List<String> principals,
  required String profilingGroupName,
  String? revisionId,
}) async {
  final $payload = <String, dynamic>{
    'principals': principals,
    if (revisionId != null) 'revisionId': revisionId,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri:
        '/profilingGroups/${Uri.encodeComponent(profilingGroupName)}/policy/${Uri.encodeComponent(actionGroup.value)}',
    exceptionFnMap: _exceptionFns,
  );
  return PutPermissionResponse.fromJson(response);
}