class PolicyDocument

Attributes

statements[RW]
version[RW]

Public Class Methods

new() click to toggle source
# File lib/cfn-model/model/policy_document.rb, line 8
def initialize
  @statements = []
end

Public Instance Methods

==(another_doc) click to toggle source
# 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() click to toggle source

Select any Statement objects that Allow in conjunction with a NotAction

# 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() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# File lib/cfn-model/model/policy_document.rb, line 43
  def to_s
    <<END
{
  version=#{@version}
  statements=#{@statements}
}
END
  end
wildcard_allowed_actions() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# 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