Sha256: 8f913829f39b257f3ee16261d454cdcfd52d3ffbf609ed21f92cd5c596478950
Contents?: true
Size: 1.3 KB
Versions: 9
Compression:
Stored size: 1.3 KB
Contents
module Pipedream::Dsl module Role PROPERTIES = %w[ assume_role_policy_document managed_policy_arns max_session_duration path permissions_boundary policies role_name ] PROPERTIES.each do |prop| define_method(prop) do |v| @properties[prop.to_sym] = v end end # convenience wrapper methods def iam_policy(*definitions) @iam_statements = definitions.map { |definition| standardize_iam_policy(definition) } end # Returns standarized IAM statement def standardize_iam_policy(definition) case definition when String # Expands simple string from: logs => logs:* definition = "#{definition}:*" unless definition.include?(':') { action: [definition], effect: "Allow", resource: "*", } when Hash definition end end def managed_iam_policy(*definitions) @managed_policy_arns = definitions.map { |definition| standardize_managed_iam_policy(definition) } end # AmazonEC2ReadOnlyAccess => arn:aws:iam::aws:policy/AmazonEC2ReadOnlyAccess def standardize_managed_iam_policy(definition) return definition if definition.include?('iam::aws:policy') "arn:aws:iam::aws:policy/#{definition}" end end end
Version data entries
9 entries across 9 versions & 1 rubygems