tagResource method

Future<void> tagResource({
  1. required String instanceArn,
  2. required String resourceArn,
  3. required List<Tag> tags,
})

Associates a set of tags with a specified resource.

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 resourceArn : The ARN of the resource with the tags to be listed.

Parameter tags : A set of key-value pairs that are used to manage the resource.

Implementation

Future<void> tagResource({
  required String instanceArn,
  required String resourceArn,
  required List<Tag> tags,
}) async {
  ArgumentError.checkNotNull(instanceArn, 'instanceArn');
  _s.validateStringLength(
    'instanceArn',
    instanceArn,
    10,
    1224,
    isRequired: true,
  );
  ArgumentError.checkNotNull(resourceArn, 'resourceArn');
  _s.validateStringLength(
    'resourceArn',
    resourceArn,
    10,
    2048,
    isRequired: true,
  );
  ArgumentError.checkNotNull(tags, 'tags');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SWBExternalService.TagResource'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'InstanceArn': instanceArn,
      'ResourceArn': resourceArn,
      'Tags': tags,
    },
  );
}