changeTagsForResource method

Future<void> changeTagsForResource({
  1. required String resourceId,
  2. required TagResourceType resourceType,
  3. List<Tag>? addTags,
  4. List<String>? removeTagKeys,
})

Adds, edits, or deletes tags for a health check or a hosted zone.

For information about using tags for cost allocation, see Using Cost Allocation Tags in the AWS Billing and Cost Management User Guide.

May throw InvalidInput. May throw NoSuchHealthCheck. May throw NoSuchHostedZone. May throw PriorRequestNotComplete. May throw ThrottlingException.

Parameter resourceId : The ID of the resource for which you want to add, change, or delete tags.

Parameter resourceType : The type of the resource.

  • The resource type for health checks is healthcheck.
  • The resource type for hosted zones is hostedzone.

Parameter addTags : A complex type that contains a list of the tags that you want to add to the specified health check or hosted zone and/or the tags that you want to edit Value for.

You can add a maximum of 10 tags to a health check or a hosted zone.

Parameter removeTagKeys : A complex type that contains a list of the tags that you want to delete from the specified health check or hosted zone. You can specify up to 10 keys.

Implementation

Future<void> changeTagsForResource({
  required String resourceId,
  required TagResourceType resourceType,
  List<Tag>? addTags,
  List<String>? removeTagKeys,
}) async {
  ArgumentError.checkNotNull(resourceId, 'resourceId');
  _s.validateStringLength(
    'resourceId',
    resourceId,
    0,
    64,
    isRequired: true,
  );
  ArgumentError.checkNotNull(resourceType, 'resourceType');
  await _protocol.send(
    method: 'POST',
    requestUri:
        '/2013-04-01/tags/${Uri.encodeComponent(resourceType.toValue())}/${Uri.encodeComponent(resourceId)}',
    payload: ChangeTagsForResourceRequest(
            resourceId: resourceId,
            resourceType: resourceType,
            addTags: addTags,
            removeTagKeys: removeTagKeys)
        .toXml(
      'ChangeTagsForResourceRequest',
      attributes: [
        _s.XmlAttribute(_s.XmlName('xmlns'),
            'https://route53.amazonaws.com/doc/2013-04-01/'),
      ],
    ),
    exceptionFnMap: _exceptionFns,
  );
}