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.
6 7 8 |
# File 'lib/cfn-model/model/policy_document.rb', line 6 def initialize @statements = [] end |
Instance Attribute Details
#statements ⇒ Object
Returns the value of attribute statements.
4 5 6 |
# File 'lib/cfn-model/model/policy_document.rb', line 4 def statements @statements end |
#version ⇒ Object
Returns the value of attribute version.
4 5 6 |
# File 'lib/cfn-model/model/policy_document.rb', line 4 def version @version end |
Instance Method Details
#==(another_doc) ⇒ Object
37 38 39 |
# File 'lib/cfn-model/model/policy_document.rb', line 37 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
25 26 27 |
# File 'lib/cfn-model/model/policy_document.rb', line 25 def allows_not_action @statements.select { |statement| !statement.not_actions.empty? && statement.effect == 'Allow' } end |
#allows_not_principal ⇒ Object
33 34 35 |
# File 'lib/cfn-model/model/policy_document.rb', line 33 def allows_not_principal @statements.select { |statement| !statement.not_principal.nil? && statement.effect == 'Allow' } end |
#allows_not_resource ⇒ Object
29 30 31 |
# File 'lib/cfn-model/model/policy_document.rb', line 29 def allows_not_resource @statements.select { |statement| !statement.not_resources.empty? && statement.effect == 'Allow' } end |
#to_s ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'lib/cfn-model/model/policy_document.rb', line 41 def to_s <<END { version=#{@version} statements=#{@statements} } END end |
#wildcard_allowed_actions ⇒ Object
14 15 16 |
# File 'lib/cfn-model/model/policy_document.rb', line 14 def wildcard_allowed_actions @statements.select { |statement| !statement.wildcard_actions.empty? && statement.effect == 'Allow' } end |
#wildcard_allowed_principals ⇒ Object
18 19 20 |
# File 'lib/cfn-model/model/policy_document.rb', line 18 def wildcard_allowed_principals @statements.select { |statement| statement.wildcard_principal? && statement.effect == 'Allow' } end |
#wildcard_allowed_resources ⇒ Object
10 11 12 |
# File 'lib/cfn-model/model/policy_document.rb', line 10 def wildcard_allowed_resources @statements.select { |statement| !statement.wildcard_resources.empty? && statement.effect == 'Allow' } end |