Sha256: cd313f46250e6d8c85899fe84dd39b10726a6f6a3d7bc2f91480cf37f6ede4a8

Contents?: true

Size: 904 Bytes

Versions: 1

Compression:

Stored size: 904 Bytes

Contents

require_relative '../resource'

module Convection
  module DSL
    ## Add DSL method to template namespace
    module Template
      def iam_policy(name, &block)
        r = Model::Template::Resource::IAMPolicy.new(name, self)
        r.instance_exec(&block) if block

        resources[name] = r
      end
    end
  end

  module Model
    class Template
      class Resource
        ##
        # AWS::IAM::Policy
        ##
        class IAMPolicy < Resource
          def initialize(*args)
            super

            type 'AWS::IAM::Policy'
            @properties['Roles'] = []
          end

          def role(value)
            @properties['Roles'] << value
          end

          def name(value)
            property('PolicyName', value)
          end

          def policy_document(value)
            property('PolicyDocument', value)
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
convection-0.0.1 lib/convection/model/template/resource/aws_iam_policy.rb