Class: Opsup::Config

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/opsup/config.rb

Constant Summary collapse

MODES =
T.let(i[parallel serial one_then_all].freeze, T::Array[Symbol])

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stack_name:, aws_access_key_id:, aws_secret_access_key:, opsworks_region:, running_mode: nil, dryrun: false) ⇒ Config

Returns a new instance of Config.



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/opsup/config.rb', line 38

def initialize(
  stack_name:,
  aws_access_key_id:,
  aws_secret_access_key:,
  opsworks_region:,
  running_mode: nil,
  dryrun: false
)
  @stack_name = T.let(stack_name, String)
  @aws_access_key_id = T.let(aws_access_key_id, String)
  @aws_secret_access_key = T.let(aws_secret_access_key, String)
  @opsworks_region = T.let(opsworks_region, String)
  @running_mode = T.let(running_mode || MODES.fetch(0), Symbol)
  @dryrun = T.let(dryrun, T::Boolean)
end

Instance Attribute Details

#aws_access_key_idObject (readonly)

Returns the value of attribute aws_access_key_id.



12
13
14
# File 'lib/opsup/config.rb', line 12

def aws_access_key_id
  @aws_access_key_id
end

#aws_secret_access_keyObject (readonly)

Returns the value of attribute aws_secret_access_key.



15
16
17
# File 'lib/opsup/config.rb', line 15

def aws_secret_access_key
  @aws_secret_access_key
end

#dryrunObject (readonly)

Returns the value of attribute dryrun.



24
25
26
# File 'lib/opsup/config.rb', line 24

def dryrun
  @dryrun
end

#opsworks_regionObject (readonly)

Returns the value of attribute opsworks_region.



18
19
20
# File 'lib/opsup/config.rb', line 18

def opsworks_region
  @opsworks_region
end

#running_modeObject (readonly)

Returns the value of attribute running_mode.



21
22
23
# File 'lib/opsup/config.rb', line 21

def running_mode
  @running_mode
end

#stack_nameObject (readonly)

Returns the value of attribute stack_name.



9
10
11
# File 'lib/opsup/config.rb', line 9

def stack_name
  @stack_name
end

Instance Method Details

#to_hObject



55
56
57
58
59
60
61
62
63
64
# File 'lib/opsup/config.rb', line 55

def to_h
  {
    stack_name: stack_name,
    aws_access_key_id: aws_access_key_id,
    aws_secret_access_key: aws_secret_access_key,
    opsworks_region: opsworks_region,
    running_mode: running_mode,
    dryrun: dryrun,
  }
end