tagResource method

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

Associates the list of tags in the input Tags parameter with the resource identified by the ResourceArn input parameter.

May throw ResourceArnRequiredException. May throw ApplicationDoesNotExistException. May throw DeploymentGroupDoesNotExistException. May throw DeploymentConfigDoesNotExistException. May throw TagRequiredException. May throw InvalidTagsToAddException. May throw ArnNotSupportedException. May throw InvalidArnException.

Parameter resourceArn : The ARN of a resource, such as a CodeDeploy application or deployment group.

Parameter tags : A list of tags that TagResource associates with a resource. The resource is identified by the ResourceArn input parameter.

Implementation

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