org.jclouds.ec2.features
Interface TagApi


public interface TagApi

Provides access to Amazon EC2 via the Query API

See Also:
doc

Method Summary
 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)
          like applyToResources(Map, Iterable) except that the tags have no values.
 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.
 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 filter
 com.google.common.collect.FluentIterable<Tag> list()
          Describes all of your tags for your EC2 resources.
 

Method Detail

applyToResources

@Named(value="CreateTags")
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(value="CreateTags")
void applyToResources(Map<String,String> tags,
                            Iterable<String> resourceIds)
like applyToResources(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(value="DescribeTags")
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(value="DescribeTags")
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(value="DeleteTags")
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(value="DeleteTags")
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)


Copyright © 2009-2014 The Apache Software Foundation. All Rights Reserved.