Module: Terraspace::Cloud::Api::Concern
- Extended by:
- Memoist
- Included in:
- Base
- Defined in:
- lib/terraspace/cloud/api/concern.rb,
lib/terraspace/cloud/api/concern/errors.rb
Defined Under Namespace
Modules: Errors
Instance Method Summary collapse
Methods included from Validate
Methods included from Errors
Instance Method Details
#api ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/terraspace/cloud/api/concern.rb', line 7 def api validate("stack", cloud_stack_name) @options = @options.merge( app: Terraspace.app, role: Terraspace.role, env: Terraspace.env, extra: Terraspace.extra, region: region, name: cloud_stack_name, ) @options.reject! { |k,v| v.nil? } Terraspace::Cloud::Api.new(@options) # @options are CLI options end |
#cloud_stack_name ⇒ Object
21 22 23 24 25 26 |
# File 'lib/terraspace/cloud/api/concern.rb', line 21 def cloud_stack_name pattern = Terraspace.config.cloud.stack = .expansion(pattern) # pattern is a String that contains placeholders for substitutions .gsub(%r{-+},'-') # remove double dashes are more. IE: -- -> - .sub(/^-+/,'').sub(/-+$/,'') # remove leading and trailing - end |
#expander ⇒ Object
32 33 34 |
# File 'lib/terraspace/cloud/api/concern.rb', line 32 def Terraspace::Compiler::Expander.autodetect(@mod) end |
#region ⇒ Object
28 29 30 |
# File 'lib/terraspace/cloud/api/concern.rb', line 28 def region .expansion(":REGION") end |