Module: Lono::Configset::Strategy::Helpers::Dsl::Auth

Included in:
Lono::Configset::Strategy::Helpers::Dsl
Defined in:
lib/lono/configset/strategy/helpers/dsl/auth.rb

Instance Method Summary collapse

Instance Method Details

#authentication(data = nil, force: false) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/lono/configset/strategy/helpers/dsl/auth.rb', line 3

def authentication(data=nil, force: false)
  if data.nil?
    authentication_reader
  else
    authentication_setter(data, force)
  end
end

#authentication_readerObject

data can be either:

1. logical id - String
2. Full AWS::CloudFormation::Authentication value structure


16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/lono/configset/strategy/helpers/dsl/auth.rb', line 16

def authentication_reader
  # AWS::CloudFormation::Authentication
  case @authentication
  when String
    logical_id = @authentication
    {
      rolebased: {
        type: "S3",
        buckets: [lono_bucket_name],
        roleName: {Ref: logical_id}, # currently ref meth is not available
      }
    }
  when Hash
    @authentication
  end
end

#authentication_setter(data, force = false) ⇒ Object



33
34
35
# File 'lib/lono/configset/strategy/helpers/dsl/auth.rb', line 33

def authentication_setter(data, force=false)
  @authentication = data unless @authentication || force
end