Class: CfFactory::CfIamRole

Inherits:
Object
  • Object
show all
Includes:
CfBase
Defined in:
lib/cf_factory/iam/cf_iam_role.rb

Instance Method Summary collapse

Methods included from CfBase

#generate_ref, #get_deletion_policy, #get_name, #get_update_policy, #hash_to_string, #retrieve_attribute, #set_meta_data, #set_quotes, #set_tags

Constructor Details

#initialize(name, path, options) ⇒ CfIamRole

Returns a new instance of CfIamRole.



9
10
11
12
13
# File 'lib/cf_factory/iam/cf_iam_role.rb', line 9

def initialize(name, path, options)
  @name = name 
  @path = path
  @policies = options[:policies]
end

Instance Method Details

#generateObject



32
33
34
35
# File 'lib/cf_factory/iam/cf_iam_role.rb', line 32

def generate
  result = super
  result += CfIamInstanceProfile.new(@name+"Profile", @path, [@name]).generate
end

#get_cf_attributesObject



19
20
21
# File 'lib/cf_factory/iam/cf_iam_role.rb', line 19

def get_cf_attributes
  {}
end

#get_cf_propertiesObject



23
24
25
26
27
28
29
30
# File 'lib/cf_factory/iam/cf_iam_role.rb', line 23

def get_cf_properties
  result = {
    "Path" => @path,
    "AssumeRolePolicyDocument" => assume_role_ec2() #no other supported right now
  }
  result["Policies"] = CfHelper.generate_inner_array(@policies) unless @policies.nil?
  result
end

#get_cf_typeObject



15
16
17
# File 'lib/cf_factory/iam/cf_iam_role.rb', line 15

def get_cf_type
  "AWS::IAM::Role"
end