Package org.jclouds.ec2.features
Interface TagApi
-
public interface TagApi
Provides access to Amazon EC2 via the Query API- See Also:
- doc
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
applyToResources(Iterable<String> tags, Iterable<String> resourceIds)
Adds or overwrites one or more tags for the specified resource or resources.void
applyToResources(Map<String,String> tags, Iterable<String> resourceIds)
likeapplyToResources(Map, Iterable)
except that the tags have no values.void
conditionallyDeleteFromResources(Map<String,String> conditionalTagValues, Iterable<String> resourceIds)
likedeleteFromResources(Iterable, Iterable)
, except that the tags are only deleted if they match the value.void
deleteFromResources(Iterable<String> tags, Iterable<String> resourceIds)
Deletes a specific set of tags from a specific set of resources.com.google.common.collect.FluentIterable<Tag>
filter(com.google.common.collect.Multimap<String,String> filter)
Describes tags for your EC2 resources qualified by a filtercom.google.common.collect.FluentIterable<Tag>
list()
Describes all of your tags for your EC2 resources.
-
-
-
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
-
applyToResources
@Named("CreateTags") @POST @Path("/") void applyToResources(Map<String,String> tags, Iterable<String> resourceIds)
likeapplyToResources(Map, Iterable)
except that the tags have no values.example
tagApi.applyToResources(ImmutableSet.of("production", "pci-compliant"), ImmutableSet.of("i-1a2b3c4d"));
- See Also:
applyToResources(Map, Iterable)
-
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 filterexample
tags = tagApi.filter(new TagFilterBuilder().image().put("version", "1.0").build());
- Parameters:
filter
- which is typically built byTagFilterBuilder
- 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 alist
orfilter
call. You first determine what tags a resource has, and then you calldelete
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 keysresourceIds
- 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)
likedeleteFromResources(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)
-
-