Class: PolicyDocument
- Inherits:
-
Object
- Object
- PolicyDocument
- Defined in:
- lib/cfn-model/model/policy_document.rb
Instance Attribute Summary collapse
-
#statements ⇒ Object
Returns the value of attribute statements.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #==(another_doc) ⇒ Object
-
#allows_not_action ⇒ Object
Select any Statement objects that Allow in conjunction with a NotAction.
- #allows_not_principal ⇒ Object
- #allows_not_resource ⇒ Object
-
#initialize ⇒ PolicyDocument
constructor
A new instance of PolicyDocument.
- #to_s ⇒ Object
- #wildcard_allowed_actions ⇒ Object
- #wildcard_allowed_principals ⇒ Object
- #wildcard_allowed_resources ⇒ Object
Constructor Details
#initialize ⇒ PolicyDocument
Returns a new instance of PolicyDocument.
8 9 10 |
# File 'lib/cfn-model/model/policy_document.rb', line 8 def initialize @statements = [] end |
Instance Attribute Details
#statements ⇒ Object
Returns the value of attribute statements.
6 7 8 |
# File 'lib/cfn-model/model/policy_document.rb', line 6 def statements @statements end |
#version ⇒ Object
Returns the value of attribute version.
6 7 8 |
# File 'lib/cfn-model/model/policy_document.rb', line 6 def version @version end |
Instance Method Details
#==(another_doc) ⇒ Object
39 40 41 |
# File 'lib/cfn-model/model/policy_document.rb', line 39 def ==(another_doc) self.version == another_doc.version && @statements == another_doc.statements end |
#allows_not_action ⇒ Object
Select any Statement objects that Allow in conjunction with a NotAction
27 28 29 |
# File 'lib/cfn-model/model/policy_document.rb', line 27 def allows_not_action @statements.select { |statement| !statement.not_actions.empty? && statement.effect == 'Allow' } end |
#allows_not_principal ⇒ Object
35 36 37 |
# File 'lib/cfn-model/model/policy_document.rb', line 35 def allows_not_principal @statements.select { |statement| !statement.not_principal.nil? && statement.effect == 'Allow' } end |
#allows_not_resource ⇒ Object
31 32 33 |
# File 'lib/cfn-model/model/policy_document.rb', line 31 def allows_not_resource @statements.select { |statement| !statement.not_resources.empty? && statement.effect == 'Allow' } end |
#to_s ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/cfn-model/model/policy_document.rb', line 43 def to_s <<END { version=#{@version} statements=#{@statements} } END end |
#wildcard_allowed_actions ⇒ Object
16 17 18 |
# File 'lib/cfn-model/model/policy_document.rb', line 16 def wildcard_allowed_actions @statements.select { |statement| !statement.wildcard_actions.empty? && statement.effect == 'Allow' } end |
#wildcard_allowed_principals ⇒ Object
20 21 22 |
# File 'lib/cfn-model/model/policy_document.rb', line 20 def wildcard_allowed_principals @statements.select { |statement| statement.wildcard_principal? && statement.effect == 'Allow' } end |
#wildcard_allowed_resources ⇒ Object
12 13 14 |
# File 'lib/cfn-model/model/policy_document.rb', line 12 def wildcard_allowed_resources @statements.select { |statement| !statement.wildcard_resources.empty? && statement.effect == 'Allow' } end |