This section describes the methods available to VM::EC2::Security::Policy. You will create a new, empty,
policy using new(), grant access to EC2 actions using allow(), and deny access to EC2 actions using
deny(). When you are done, either call as_string(), or just use the policy object in a string context, to
get a properly-formatted policy string.
allow() and deny() return the modified object, allowing you to chain methods. For example:
my $p = VM::EC2::Security::Policy->new
->allow('Describe*')
->deny('DescribeImages','DescribeInstances');
print $p;
$policy=VM::EC2::Security::Policy->new()
This class method creates a new, empty policy object. The default policy object denies all access to EC2
resources.
$policy->allow('action1','action2','action3',...)
Grant access to the listed EC2 actions. You may specify actions using Amazon's MixedCase notation (e.g.
"DescribeInstances"), or using VM::EC2's more Perlish underscore notation (e.g. "describe_instances").
You can find the list of actions in VM::EC2, or in the Amazon API documentation at
http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/OperationList-query.html.
The "*" wildcard allows you to indicate a series of matching operations. For example, to allow all
Describe operations:
$policy->allow('Describe*')
As described earlier, allow() returns the object, making it easy to chain methods.
$policy->deny('action1','action2','action3',...)
Similar to allow(), but in this case denies access to certain actions. Deny statements take precedence
over allow statements.
As described earlier, deny() returns the object, making it easy to chain methods.
$string=$policy->as_string
Converts the policy into a JSON string that can be passed to VM::EC2->get_federation_token(), or other
AWS libraries.