CW$object = VM::EC2::Generic->new($payload,$ec2 [,$xmlns, CW$requestId])
Given the parsed XML generated by VM::EC2::Dispatch and the VM::EC2
object, return a new object. Two optional additional arguments provide
the seldom-needed XML namespace and ID of the request that generated
CW$ec2 = CW$object->ec2
CW$ec2 = CW$object->aws
Return the VM::EC2 object that generated this object. This method can
be called as either ec2() (preferred) or aws() (deprecated).
CW$id = CW$object->primary_id (optional method)
Resources that have unique Amazon identifiers, such as images,
instances and volumes, implement the primary_id() method to return
that identifier. Resources that do not have unique identifiers, will
throw an exception if this method is called. This method is in
addition to the resource-specific ID. For example, volumes have a
unique ID, and this ID can be fetched with either of:
CW$xmlns = CW$object->xmlns
Return the XML namespace of the request that generated this object, if
any. All objects generated by direct requests on the VM::EC2 object
will return this field, but objects returned via methods calls on
these objects (objects once removed) may not.
CW$id = CW$object->requestId
Return the ID of the reuqest that generated this object, if any. All
objects generated by direct requests on the VM::EC2 object will return
this field, but objects returned via methods calls on these objects
(objects once removed) may not.
CW$name = CW$object->short_name
Return a short name for this object for use in string
interpolation. If the object has a primary_id() method, then this
returns that ID. Otherwise it returns the default Perl object name
(VM::EC2::Generic=HASH(0x99f3850). Some classes override short_name()
in order to customized information about the object. See for example
CW$hashref = CW$object->payload
Return the parsed XML hashref that underlies this object. See
Return the data field names that are valid for an object of this
type. These field names correspond to tags in the XML
returned from Amazon and can then be used as method calls.
Internally, this method is called valid_fields()
CW$text = CW$object->as_string
Return a Data::Dumper representation of the contents of this objects
CW$hashref = CW$object->tags
CW$hashref = CW$object->tagSet
Return the metadata tags assigned to this resource, if any, as a
hashref. Both tags() and tagSet() work identically.
CW$boolean = CW$object->add_tags(Tag1=>value1,Tag2=>value2,...)
CW$boolean = CW$object->add_tags(\%hash)
Add one or more tags to the object. You may provide either a list of
tag/value pairs or a hashref. If no tag of the indicated name exsists
it will be created. If there is already a tag by this name, it will
be set to the provided value. The result code is true if the Amazon
resource was successfully updated.
Also see VM::EC2->add_tags() for a way of tagging multiple resources
The alias add_tag() is also provided as a convenience.
CW$boolean = CW$object->delete_tags(@args)
Delete the indicated tags from the indicated resource. There are
several variants you may use:
# delete Foo tag if it has value "bar" and Buzz tag if it has value bazz
# same as above but using a list rather than a hashref
# delete Foo tag if it has any value, Buzz if it has value bazz
# delete Foo and Buzz tags unconditionally
# delete Foo tag unconditionally
Also see VM::EC2->delete_tags() for a way of deleting tags from multiple
CW$xml = CW$object->as_xml
Returns an XML version of the object. The object will already been
parsed by XML::Simple at this point, and so the data returned by this
method will not be identical to the XML returned by AWS.
CW$value = CW$object->attribute(tag_name)
Returns the value of a tag in the XML returned from AWS, using a
simple heuristic. If the requested tag has a nested tag named <value>
it will return the contents of <value>. If the tag has one or more
nested tags named <item>, it will return a list of hashrefs located
within the <item> tag. Otherwise it will return the contents of
CW$string = CW$object->error_str
Returns the error string for the last operation, if any, as reported
CW$string = CW$object->error
Returns the VM::EC2::Error object from the last operation, if any,
as reported by VM::EC2.
Lincoln Stein <email@example.com>.
Copyright (c) 2011 Ontario Institute for Cancer Research
This package and its accompanying libraries is free software; you can
redistribute it and/or modify it under the terms of the GPL (either
version 1, or at your option, any later version) or the Artistic
License 2.0. Refer to LICENSE for the full license text. In addition,
please see DISCLAIMER.txt for disclaimers of warranty.