Class: Lono::Cfn::Opts

Inherits:
Opts
  • Object
show all
Defined in:
lib/lono/cfn/opts.rb

Direct Known Subclasses

Sets::Opts

Instance Method Summary collapse

Methods inherited from Opts

#clean, #initialize, #source, #stack, #template

Constructor Details

This class inherits a constructor from Lono::Opts

Instance Method Details

#base_options(rollback: true) ⇒ Object

Lono::Cfn and Lono::Sets



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/lono/cfn/opts.rb', line 43

def base_options(rollback: true)
  with_cli_scope do
    if rollback
      option :rollback, type: :boolean, desc: "rollback", default: true
    end
    # common to Lono::Cfn and Lono::Sets
    option :source, desc: "url or path to file with template"
    option :blueprint, desc: "override convention and specify the template file to use"
    option :capabilities, type: :array, desc: "iam capabilities. Ex: CAPABILITY_IAM, CAPABILITY_NAMED_IAM"
    option :config, aliases: "c", desc: "override convention and specify both the param and variable file to use"
    option :iam, type: :boolean, desc: "Shortcut for common IAM capabilities: CAPABILITY_IAM, CAPABILITY_NAMED_IAM"
    option :param, aliases: "p", desc: "override convention and specify the param file to use"
    option :tags, type: :hash, desc: "Tags for the stack. IE: Name:api-web Owner:bob"
    option :template, desc: "override convention and specify the template file to use"
    option :variable, aliases: "v", desc: "override convention and specify the variable file to use"
  end
end

#cancelObject



22
23
24
# File 'lib/lono/cfn/opts.rb', line 22

def cancel
  wait_options
end

#createObject



3
4
5
6
# File 'lib/lono/cfn/opts.rb', line 3

def create
  base_options
  wait_options
end

#deleteObject



18
19
20
# File 'lib/lono/cfn/opts.rb', line 18

def delete
  wait_options
end

#deployObject



14
15
16
# File 'lib/lono/cfn/opts.rb', line 14

def deploy
  update
end

#downloadObject



34
35
36
37
38
39
40
# File 'lib/lono/cfn/opts.rb', line 34

def download
  base_options
  with_cli_scope do
    option :name, desc: "Name you want to save the template as. Default: existing stack name."
    option :source, desc: "url or path to file with template"
  end
end

#previewObject



26
27
28
29
30
31
32
# File 'lib/lono/cfn/opts.rb', line 26

def preview
  base_options
  update_options
  with_cli_scope do
    option :keep, type: :boolean, desc: "keep the changeset instead of deleting it afterwards"
  end
end

#updateObject



8
9
10
11
12
# File 'lib/lono/cfn/opts.rb', line 8

def update
  base_options
  update_options
  wait_options
end

#update_options(change_set: true) ⇒ Object



68
69
70
71
72
73
74
75
76
77
78
# File 'lib/lono/cfn/opts.rb', line 68

def update_options(change_set: true)
  with_cli_scope do
    if change_set
      option :change_set, type: :boolean, default: true, desc: "Uses generated change set to update the stack.  If false, will perform normal update-stack."
      option :changeset_preview, type: :boolean, default: true, desc: "Show ChangeSet changes preview."
    end
    # common to Lono::Cfn and Lono::Sets
    option :codediff_preview, type: :boolean, default: true, desc: "Show codediff changes preview."
    option :param_preview, type: :boolean, default: true, desc: "Show parameter diff preview."
  end
end

#wait_optionsObject



61
62
63
64
65
66
# File 'lib/lono/cfn/opts.rb', line 61

def wait_options
  with_cli_scope do
    option :wait, type: :boolean, desc: "Wait for stack operation to complete.", default: true
    option :sure, type: :boolean, desc: "Skip are you sure prompt" # moved to base but used by commands like `lono cfn delete` also. Just keep here.
  end
end