Class: Sfn::Callback
- Inherits:
-
Object
- Object
- Sfn::Callback
- Defined in:
- lib/sfn/callback.rb,
lib/sfn/callback/aws_mfa.rb,
lib/sfn/callback/stack_policy.rb,
lib/sfn/callback/aws_assume_role.rb
Overview
Interface for injecting custom functionality
Direct Known Subclasses
Defined Under Namespace
Classes: AwsAssumeRole, AwsMfa, StackPolicy
Instance Attribute Summary collapse
-
#api ⇒ Miasma::Models::Orchestration
readonly
Remote API.
-
#arguments ⇒ Array<String>
readonly
CLI arguments.
- #config ⇒ Smash readonly
- #ui ⇒ Bogo::Ui readonly
Instance Method Summary collapse
-
#initialize(ui, config, arguments, api) ⇒ self
constructor
Create a new callback instance.
-
#run_action(msg) ⇒ Object
Wrap action within status text.
Constructor Details
#initialize(ui, config, arguments, api) ⇒ self
Create a new callback instance
27 28 29 30 31 32 |
# File 'lib/sfn/callback.rb', line 27 def initialize(ui, config, arguments, api) @ui = ui @config = config @arguments = arguments @api = api end |
Instance Attribute Details
#api ⇒ Miasma::Models::Orchestration (readonly)
Returns remote API.
17 18 19 |
# File 'lib/sfn/callback.rb', line 17 def api @api end |
#arguments ⇒ Array<String> (readonly)
Returns CLI arguments.
15 16 17 |
# File 'lib/sfn/callback.rb', line 15 def arguments @arguments end |
#config ⇒ Smash (readonly)
13 14 15 |
# File 'lib/sfn/callback.rb', line 13 def config @config end |
#ui ⇒ Bogo::Ui (readonly)
11 12 13 |
# File 'lib/sfn/callback.rb', line 11 def ui @ui end |
Instance Method Details
#run_action(msg) ⇒ Object
Wrap action within status text
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/sfn/callback.rb', line 39 def run_action(msg) ui.info("#{msg}... ", :nonewline) begin result = yield ui.puts ui.color("complete!", :green, :bold) result rescue => e ui.puts ui.color("error!", :red, :bold) ui.error "Reason - #{e}" raise end end |