Sha256: fb591da60752e16763883823367d197415e25d3abfb0e74acf88cecdb9f9f7cc

Contents?: true

Size: 1.46 KB

Versions: 2

Compression:

Stored size: 1.46 KB

Contents

require_relative '../resource'

module Convection
  module DSL
    module Template
      module Resource
        ## Role DSL
        module IAMUser
          def policy(policy_name, &block)
            add_policy = Model::Mixin::Policy.new(:name => policy_name, :template => @template)
            add_policy.instance_exec(&block) if block

            policies << add_policy
          end

          def with_key(serial = 0, &block)
            key = Model::Template::Resource::IAMAccessKey.new("#{ name }Key", @template)
            key.user_name = self
            key.serial = serial

            key.depends_on(self)

            key.with_output("#{ name }Id", key.reference)
            key.with_output("#{ name }Secret", get_att(key.name, 'SecretAccessKey'))

            key.instance_exec(&block) if block

            @template.resources[key.name] = key
          end
        end
      end
    end
  end

  module Model
    class Template
      class Resource
        ##
        # AWS::IAM::User
        ##
        class IAMUser < Resource
          include DSL::Template::Resource::IAMUser

          type 'AWS::IAM::User'
          property :path, 'Path'
          property :login_profile, 'LoginProfile'
          property :group, 'Groups', :type => :list
          property :policies, 'Policies', :type => :list
          property :managed_policy_arn, 'ManagedPolicyArns', :type => :list
          alias managed_policy managed_policy_arn
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
convection-0.2.33 lib/convection/model/template/resource/aws_iam_user.rb
convection-0.2.32 lib/convection/model/template/resource/aws_iam_user.rb