Class: Opsup::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/opsup/config.rb

Constant Summary collapse

MODES =
%i[parallel serial one_then_all].freeze

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.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/opsup/config.rb', line 14

def initialize(
  stack_name:,
  aws_access_key_id:,
  aws_secret_access_key:,
  opsworks_region:,
  running_mode: nil,
  dryrun: false
)
  @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 || MODES[0]
  @dryrun = dryrun
end

Instance Attribute Details

#aws_access_key_idObject (readonly)

Returns the value of attribute aws_access_key_id.



6
7
8
# File 'lib/opsup/config.rb', line 6

def aws_access_key_id
  @aws_access_key_id
end

#aws_secret_access_keyObject (readonly)

Returns the value of attribute aws_secret_access_key.



7
8
9
# File 'lib/opsup/config.rb', line 7

def aws_secret_access_key
  @aws_secret_access_key
end

#dryrunObject (readonly)

Returns the value of attribute dryrun.



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

def dryrun
  @dryrun
end

#opsworks_regionObject (readonly)

Returns the value of attribute opsworks_region.



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

def opsworks_region
  @opsworks_region
end

#running_modeObject (readonly)

Returns the value of attribute running_mode.



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

def running_mode
  @running_mode
end

#stack_nameObject (readonly)

Returns the value of attribute stack_name.



5
6
7
# File 'lib/opsup/config.rb', line 5

def stack_name
  @stack_name
end

Instance Method Details

#to_hObject



30
31
32
33
34
35
36
37
38
39
# File 'lib/opsup/config.rb', line 30

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