1VM::EC2::REST::tag(3) User Contributed Perl DocumentationVM::EC2::REST::tag(3)
2
3
4

NAME VM::EC2::REST::tag

SYNOPSIS

7        use VM::EC2 ':standard';
8

METHODS

10       These methods allow you to create, delete and fetch resource tags. You
11       may find that you rarely need to use these methods directly because
12       every object produced by VM::EC2 supports a simple tag interface:
13
14         $object = $ec2->describe_volumes(-volume_id=>'vol-12345'); # e.g.
15         $tags = $object->tags();
16         $name = $tags->{Name};
17         $object->add_tags(Role => 'Web Server', Status=>'development);
18         $object->delete_tags(Name=>undef);
19
20       See VM::EC2::Generic for a full description of the uniform object
21       tagging interface.
22
23       These methods are most useful when creating and deleting tags for
24       multiple resources simultaneously.
25
26       Implemented:
27        CreateTags
28        DeleteTags
29        DescribeTags
30
31       Unimplemented:
32        (none)
33
34   @t = $ec2->describe_tags(-filter=>\%filters);
35       Return a series of VM::EC2::Tag objects, each describing an AMI. A
36       single optional -filter argument is allowed.
37
38       Available filters are: key, resource-id, resource-type and value. See
39       http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeTags.html
40
41   $bool = $ec2->create_tags(-resource_id=>\@ids,-tag=>{key1=>value1...})
42       Tags the resource indicated by -resource_id with the tag(s) in in the
43       hashref indicated by -tag. You may specify a single resource by passing
44       a scalar resourceId to -resource_id, or multiple resources using an
45       anonymous array. Returns a true value if tagging was successful.
46
47       The method name "add_tags()" is an alias for create_tags().
48
49       You may find it more convenient to tag an object retrieved with any of
50       the describe() methods using the built-in add_tags() method:
51
52        @snap = $ec2->describe_snapshots(-filter=>{status=>'completed'});
53        foreach (@snap) {$_->add_tags(ReadyToUse => 'true')}
54
55       but if there are many snapshots to tag simultaneously, this will be
56       faster:
57
58        @snap = $ec2->describe_snapshots(-filter=>{status=>'completed'});
59        $ec2->add_tags(-resource_id=>\@snap,-tag=>{ReadyToUse=>'true'});
60
61       Note that you can tag volumes, snapshots and images owned by other
62       people. Only you will be able to see these tags.
63
64   $bool = $ec2->delete_tags(-resource_id=>$id1,-tag=>{key1=>value1...})
65       Delete the indicated tags from the indicated resource. Pass an arrayref
66       to operate on several resources at once. The tag syntax is a bit
67       tricky. Use a value of undef to delete the tag unconditionally:
68
69        -tag => { Role => undef }    # deletes any Role tag
70
71       Any scalar value will cause the tag to be deleted only if its value
72       exactly matches the specified value:
73
74        -tag => { Role => 'Server' }  # only delete the Role tag
75                                      # if it currently has the value "Server"
76
77       An empty string value ('') will only delete the tag if its value is an
78       empty string, which is probably not what you want.
79
80       Pass an array reference of tag names to delete each of the tag names
81       unconditionally (same as passing a value of undef):
82
83        $ec2->delete_tags(['Name','Role','Description']);
84
85       You may find it more convenient to delete tags from objects using their
86       delete_tags() method:
87
88        @snap = $ec2->describe_snapshots(-filter=>{status=>'completed'});
89        foreach (@snap) {$_->delete_tags(Role => undef)}
90
91   @arguments = $ec2->tagcreate_parm(\%args)
92   @arguments = $ec2->tagdelete_parm(\%args)

SEE ALSO

94       VM::EC2
95

AUTHOR

97       Lincoln Stein <lincoln.stein@gmail.com>.
98
99       Copyright (c) 2011 Ontario Institute for Cancer Research
100
101       This package and its accompanying libraries is free software; you can
102       redistribute it and/or modify it under the terms of the GPL (either
103       version 1, or at your option, any later version) or the Artistic
104       License 2.0.  Refer to LICENSE for the full license text. In addition,
105       please see DISCLAIMER.txt for disclaimers of warranty.
106
107
108
109perl v5.32.0                      2020-07-28             VM::EC2::REST::tag(3)
Impressum