Class: Cyoi::Cli::Addresses::AddressCliAws
- Inherits:
-
Object
- Object
- Cyoi::Cli::Addresses::AddressCliAws
- Defined in:
- lib/cyoi/cli/provider_addresses/address_cli_aws.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#hl ⇒ Object
readonly
Returns the value of attribute hl.
-
#provider_client ⇒ Object
readonly
Returns the value of attribute provider_client.
Instance Method Summary collapse
- #display_confirmation ⇒ Object
-
#export_attributes ⇒ Object
helper to export the complete nested attributes.
-
#initialize(provider_client, attributes, highline) ⇒ AddressCliAws
constructor
A new instance of AddressCliAws.
- #perform_and_return_attributes ⇒ Object
- #valid_address? ⇒ Boolean
Constructor Details
#initialize(provider_client, attributes, highline) ⇒ AddressCliAws
Returns a new instance of AddressCliAws.
7 8 9 10 11 12 |
# File 'lib/cyoi/cli/provider_addresses/address_cli_aws.rb', line 7 def initialize(provider_client, attributes, highline) @provider_client = provider_client @hl = highline @attributes = attributes.is_a?(Hash) ? ReadWriteSettings.new(attributes) : attributes raise "@attributes must be ReadWriteSettings (or Hash)" unless @attributes.is_a?(ReadWriteSettings) end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
4 5 6 |
# File 'lib/cyoi/cli/provider_addresses/address_cli_aws.rb', line 4 def attributes @attributes end |
#hl ⇒ Object (readonly)
Returns the value of attribute hl.
5 6 7 |
# File 'lib/cyoi/cli/provider_addresses/address_cli_aws.rb', line 5 def hl @hl end |
#provider_client ⇒ Object (readonly)
Returns the value of attribute provider_client.
3 4 5 |
# File 'lib/cyoi/cli/provider_addresses/address_cli_aws.rb', line 3 def provider_client @provider_client end |
Instance Method Details
#display_confirmation ⇒ Object
40 41 42 43 |
# File 'lib/cyoi/cli/provider_addresses/address_cli_aws.rb', line 40 def display_confirmation puts "\n" puts "Confirming: Using address #{attributes.ip}" end |
#export_attributes ⇒ Object
helper to export the complete nested attributes.
31 32 33 |
# File 'lib/cyoi/cli/provider_addresses/address_cli_aws.rb', line 31 def export_attributes attributes.to_nested_hash end |
#perform_and_return_attributes ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/cyoi/cli/provider_addresses/address_cli_aws.rb', line 14 def perform_and_return_attributes unless valid_address? if networks? if vpc = select_vpc subnet = select_subnet_for_vpc(vpc) choose_address_from_subnet(subnet) end end unless attributes.exists?("ip") puts "Using EC2..." provision_address end end export_attributes end |
#valid_address? ⇒ Boolean
36 37 38 |
# File 'lib/cyoi/cli/provider_addresses/address_cli_aws.rb', line 36 def valid_address? attributes["ip"] end |