AzureAPI.VirtualMachineController (azure_billing_dashboard v0.2.0)

Interface for making API calls.

This module uses a GenServer to store data required for API requests.

Link to this section Summary

Public Facing

Public facing call for getting availability

Public facing call for retreiving cost data

Starts the GenServer.

Public facing call for starting a virtual machine

Public facing call for stopping (deallocating) a virtual machine

Callbacks

Server callbacks for messages

Handles messages sent to the server

Callbacks

Server callbacks for messages

Handles messages sent to the server

Functions

Returns a specification to start this module under a supervisor.

Callback implementation for GenServer.init/1.

Link to this section Public Facing

Link to this function

get_availability(pid)

Public facing call for getting availability

Link to this function

get_cost_data(vm, pid)

Public facing call for retreiving cost data

Link to this function

start_link(user)

Starts the GenServer.

Implicitly calls init/1 with the user passed in.

Link to this function

start_virtual_machine(name, pid)

Public facing call for starting a virtual machine

Link to this function

stop_virtual_machine(name, pid)

Public facing call for stopping (deallocating) a virtual machine

Link to this section Callbacks

Link to this function

handle_call(msg, from, state)

Server callbacks for messages

Possible msgs:

  1. :get_virtual_machines (deprecated)
  2. :get_availability - calls AzureCalls.get_availability/1
  3. [:start_virtual_machine, name] - calls AzureCalls.start_azure_machine/1
  4. [:stop_virtual_machine, name] - calls AzureCalls.stop_azure_machine/1
  5. [:get_cost_data, vm] - calls AzureCalls.get_azure_cost_data/1
Link to this function

handle_info(msg, state)

Handles messages sent to the server

Possible messages:

  1. :refresh_token - calls AzureCalls.get_token/1
  2. :refresh_sync - calls AzureCalls.list_azure_machines_and_statuses/1

Link to this section Callbacks

Link to this function

handle_call(msg, from, state)

Server callbacks for messages

Possible msgs:

  1. :get_virtual_machines (deprecated)
  2. :get_availability - calls AzureCalls.get_availability/1
  3. [:start_virtual_machine, name] - calls AzureCalls.start_azure_machine/1
  4. [:stop_virtual_machine, name] - calls AzureCalls.stop_azure_machine/1
  5. [:get_cost_data, vm] - calls AzureCalls.get_azure_cost_data/1
Link to this function

handle_info(msg, state)

Handles messages sent to the server

Possible messages:

  1. :refresh_token - calls AzureCalls.get_token/1
  2. :refresh_sync - calls AzureCalls.list_azure_machines_and_statuses/1

Link to this section Functions

Link to this function

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

Callback implementation for GenServer.init/1.