attachManagedPolicyToPermissionSet method

Future<void> attachManagedPolicyToPermissionSet({
  1. required String instanceArn,
  2. required String managedPolicyArn,
  3. required String permissionSetArn,
})

Attaches an IAM managed policy ARN to a permission set.

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

Parameter instanceArn : The ARN of the SSO instance under which the operation will be executed. For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

Parameter managedPolicyArn : The IAM managed policy ARN to be attached to a permission set.

Parameter permissionSetArn : The ARN of the PermissionSet that the managed policy should be attached to.

Implementation

Future<void> attachManagedPolicyToPermissionSet({
  required String instanceArn,
  required String managedPolicyArn,
  required String permissionSetArn,
}) async {
  ArgumentError.checkNotNull(instanceArn, 'instanceArn');
  _s.validateStringLength(
    'instanceArn',
    instanceArn,
    10,
    1224,
    isRequired: true,
  );
  ArgumentError.checkNotNull(managedPolicyArn, 'managedPolicyArn');
  _s.validateStringLength(
    'managedPolicyArn',
    managedPolicyArn,
    20,
    2048,
    isRequired: true,
  );
  ArgumentError.checkNotNull(permissionSetArn, 'permissionSetArn');
  _s.validateStringLength(
    'permissionSetArn',
    permissionSetArn,
    10,
    1224,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SWBExternalService.AttachManagedPolicyToPermissionSet'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'InstanceArn': instanceArn,
      'ManagedPolicyArn': managedPolicyArn,
      'PermissionSetArn': permissionSetArn,
    },
  );
}