Class: Jellyfish::Fog::Azure::Infrastructure
- Inherits:
-
Provisioner
- Object
- Provisioner
- Jellyfish::Fog::Azure::Infrastructure
- Defined in:
- lib/jellyfish_fog_azure/infrastructure.rb
Instance Method Summary collapse
- #connection ⇒ Object
- #handle_errors ⇒ Object
- #provision ⇒ Object
- #retire ⇒ Object
- #server_attributes ⇒ Object
Instance Method Details
#connection ⇒ Object
15 16 17 |
# File 'lib/jellyfish_fog_azure/infrastructure.rb', line 15 def connection Connection.new.connect end |
#handle_errors ⇒ Object
30 31 32 33 34 |
# File 'lib/jellyfish_fog_azure/infrastructure.rb', line 30 def handle_errors yield rescue Excon::Errors::BadRequest, Excon::Errors::Forbidden => e raise e, 'Bad request. Check for valid credentials and proper permissions.', e.backtrace end |
#provision ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/jellyfish_fog_azure/infrastructure.rb', line 5 def provision details = order_item.answers server = nil handle_errors do server = connection.servers.create(details) end order_item.provision_status = :ok order_item.payload_response = server.attributes end |
#retire ⇒ Object
19 20 21 22 23 24 |
# File 'lib/jellyfish_fog_azure/infrastructure.rb', line 19 def retire handle_errors do connection.delete_virtual_machine(server_attributes[:vm_name], server_attributes[:cloud_service_name]) end order_item.provision_status = :retired end |
#server_attributes ⇒ Object
26 27 28 |
# File 'lib/jellyfish_fog_azure/infrastructure.rb', line 26 def server_attributes order_item.payload_response end |