provisionPermissionSet method

Future<ProvisionPermissionSetResponse> provisionPermissionSet({
  1. required String instanceArn,
  2. required String permissionSetArn,
  3. required ProvisionTargetType targetType,
  4. String? targetId,
})

The process by which a specified permission set is provisioned to the specified target.

May throw ResourceNotFoundException. May throw InternalServerException. 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 permissionSetArn : The ARN of the permission set.

Parameter targetType : The entity type for which the assignment will be created.

Parameter targetId : TargetID is an AWS account identifier, typically a 10-12 digit string (For example, 123456789012).

Implementation

Future<ProvisionPermissionSetResponse> provisionPermissionSet({
  required String instanceArn,
  required String permissionSetArn,
  required ProvisionTargetType targetType,
  String? targetId,
}) async {
  ArgumentError.checkNotNull(instanceArn, 'instanceArn');
  _s.validateStringLength(
    'instanceArn',
    instanceArn,
    10,
    1224,
    isRequired: true,
  );
  ArgumentError.checkNotNull(permissionSetArn, 'permissionSetArn');
  _s.validateStringLength(
    'permissionSetArn',
    permissionSetArn,
    10,
    1224,
    isRequired: true,
  );
  ArgumentError.checkNotNull(targetType, 'targetType');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SWBExternalService.ProvisionPermissionSet'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'InstanceArn': instanceArn,
      'PermissionSetArn': permissionSetArn,
      'TargetType': targetType.toValue(),
      if (targetId != null) 'TargetId': targetId,
    },
  );

  return ProvisionPermissionSetResponse.fromJson(jsonResponse.body);
}