You are viewing documentation for version 1 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Class: AWS::STS::Policy

Inherits:
Core::Policy show all
Defined in:
lib/aws/sts/policy.rb

Overview

Represents an access policy for AWS operations and resources. For example:

policy = Policy.new
policy.allow(
  :actions => ['s3:PutObject'],
  :resources => "arn:aws:s3:::mybucket/mykey/*",
  :principals => :any
).where(:acl).is("public-read")

policy.to_json # => '{ "Version":"2008-10-17", ...'

Instance Attribute Summary

Attributes inherited from Core::Policy

#id, #statements, #version

Instance Method Summary collapse

Methods inherited from Core::Policy

#==, #allow, #deny, from_json, #initialize, #to_json

Constructor Details

This class inherits a constructor from AWS::Core::Policy

Instance Method Details

#to_hHash

Returns a hash representation of the policy. The following statements are equivalent:

policy.to_h.to_json
policy.to_json

Returns:

  • (Hash)


21
22
23
24
25
# File 'lib/aws/sts/policy.rb', line 21

def to_h
  h = super
  h.delete("Id")
  h
end