Interface TagApi


  • public interface TagApi
    Provides access to Amazon EC2 via the Query API

    See Also:
    doc
    • Method Detail

      • applyToResources

        @Named("CreateTags")
        @POST
        @Path("/")
        void applyToResources​(Iterable<String> tags,
                              Iterable<String> resourceIds)
        Adds or overwrites one or more tags for the specified resource or resources. Each resource can have a maximum of 10 tags. Each tag consists of a key and optional value. Tag keys must be unique per resource.

        example

         tagApi.applyToResources(ImmutableMap.of("group", "backend"), ImmutableSet.of("i-1a2b3c4d"));
         
        Parameters:
        tags - key to an optional value.
        resourceIds - The ID of a resource to tag. For example, ami-1a2b3c4d
        See Also:
        docs
      • list

        @Named("DescribeTags")
        @POST
        @Path("/")
        com.google.common.collect.FluentIterable<Tag> list()
        Describes all of your tags for your EC2 resources.
        Returns:
        tags or empty if there are none
        See Also:
        docs
      • filter

        @Named("DescribeTags")
        @POST
        @Path("/")
        com.google.common.collect.FluentIterable<Tag> filter​(com.google.common.collect.Multimap<String,​String> filter)
        Describes tags for your EC2 resources qualified by a filter

        example

         tags = tagApi.filter(new TagFilterBuilder().image().put("version", "1.0").build());
         
        Parameters:
        filter - which is typically built by TagFilterBuilder
        Returns:
        tags or empty if there are none that match the filter
        See Also:
        docs
      • deleteFromResources

        @Named("DeleteTags")
        @POST
        @Path("/")
        void deleteFromResources​(Iterable<String> tags,
                                 Iterable<String> resourceIds)
        Deletes a specific set of tags from a specific set of resources. This call is designed to follow a list or filter call. You first determine what tags a resource has, and then you call delete with the resource ID and the specific tags you want to delete.

        example

         tagApi.deleteFromResources(ImmutableSet.of("Purpose"), ImmutableSet.of("ami-1a2b3c4d"));
         
        Parameters:
        tags - the tag keys
        resourceIds - The ID of a resource with the tag. For example, ami-1a2b3c4d
        See Also:
        docs
      • conditionallyDeleteFromResources

        @Named("DeleteTags")
        @POST
        @Path("/")
        void conditionallyDeleteFromResources​(Map<String,​String> conditionalTagValues,
                                              Iterable<String> resourceIds)
        like deleteFromResources(Iterable, Iterable), except that the tags are only deleted if they match the value.

        example

         tagApi.conditionallyDeleteFromResources(ImmutableMap.of("Purpose", "production"), ImmutableSet.of("ami-1a2b3c4d"));
         
        Parameters:
        conditionalTagValues - tag id to value it must match before deleting. For a tag without a value, supply empty string.
        resourceIds - The ID of a resource with the tag. For example, ami-1a2b3c4d
        See Also:
        deleteFromResources(Iterable, Iterable)