tagResource method

Future<void> tagResource({
  1. required String resourceARN,
  2. required List<Tag> tags,
})
Associates tags with the specified AWS resource. Tags are key:value pairs that you can use to categorize and manage your resources, for purposes like billing. For example, you might set the tag key to "customer" and the value to the customer name or ID. You can specify one or more tags to add to each AWS resource, up to 50 tags for a resource.

You can tag the AWS resources that you manage through AWS WAF: web ACLs, rule groups, IP sets, and regex pattern sets. You can't manage or view tags through the AWS WAF console.

May throw WAFInternalErrorException. May throw WAFInvalidParameterException. May throw WAFLimitsExceededException. May throw WAFNonexistentItemException. May throw WAFTagOperationException. May throw WAFTagOperationInternalErrorException. May throw WAFInvalidOperationException.

Parameter resourceARN : The Amazon Resource Name (ARN) of the resource.

Parameter tags : An array of key:value pairs to associate with the resource.

Implementation

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