Class: Squall::HypervisorZone

Inherits:
Base
  • Object
show all
Defined in:
lib/squall/hypervisor_zone.rb

Overview

OnApp HypervisorZone

Instance Attribute Summary

Attributes inherited from Base

#result, #success

Instance Method Summary (collapse)

Methods inherited from Base

#check_config, #default_params, #key_for_class, #request

Instance Method Details

- (Object) add_data_store_join(id, data_store_id)

Add a data store to a hypervisor zone.

Parameters:

  • id

    ID of the hypervisor zone

  • data_store_id

    ID of the data store

Returns:

  • a Hash.



77
78
79
# File 'lib/squall/hypervisor_zone.rb', line 77

def add_data_store_join(id, data_store_id)
  request(:post, "/settings/hypervisor_zones/#{id}/data_store_joins.json", query: { data_store_id: data_store_id })
end

- (Object) add_network_join(id, options = {})

Add a network to a hypervisor zone

Parameters:

  • id

    ID of the hypervisor zone

  • options (defaults to: {})

    Params for updating the hypervisor zone

Options Hash (options):

  • :network_id (Object)

    ID of the network to add to the hypervisor zone

  • :interface (Object)

    Name of the appropriate network interface

Returns:

  • a Hash.



109
110
111
# File 'lib/squall/hypervisor_zone.rb', line 109

def add_network_join(id, options = {})
  request(:post, "/settings/hypervisor_zones/#{id}/network_joins.json", query: { network_join:  options })
end

- (Object) create(options = {})

Creates a new hypervisor zone.

Parameters:

  • options (defaults to: {})

    Params for updating the hypervisor zone:

Options Hash (options):

  • :label (Object)

    Label for the hypervisor zone

Returns:

  • a Hash



28
29
30
# File 'lib/squall/hypervisor_zone.rb', line 28

def create(options = {})
  request(:post, "/settings/hypervisor_zones.json", query: { pack: options })
end

- (Object) data_store_joins(id)

List data store joins attached to a hypervisor zone.

Parameters:

  • id

    ID of the hypervisor zone

Returns:

  • an Array.



66
67
68
69
# File 'lib/squall/hypervisor_zone.rb', line 66

def data_store_joins(id)
  response = request(:get, "/settings/hypervisor_zones/#{id}/data_store_joins.json")
  response.collect { |i| i['data_store_join'] }
end

- (Object) delete(id)

Deletes an existing hypervisor zone.

Parameters:

  • id

    ID of the hypervisor zone

Returns:

  • a Hash.



47
48
49
# File 'lib/squall/hypervisor_zone.rb', line 47

def delete(id)
  request(:delete, "/settings/hypervisor_zones/#{id}.json")
end

- (Object) edit(id, options = {})

Updates an existing hypervisor zone.

Parameters:

  • id

    ID of the hypervisor zone

  • options (defaults to: {})

    Params for updating the hypervisor zone, see `#create`

Returns:

  • a Hash.



38
39
40
# File 'lib/squall/hypervisor_zone.rb', line 38

def edit(id, options = {})
  request(:put, "/settings/hypervisor_zones/#{id}.json", query:  { pack: options })
end

- (Object) hypervisors(id)

List hypervisors attached to a zone.

Parameters:

  • id

    ID of the hypervisor zone

Returns:

  • an Array.



56
57
58
59
# File 'lib/squall/hypervisor_zone.rb', line 56

def hypervisors(id)
  response = request(:get, "/settings/hypervisor_zones/#{id}/hypervisors.json")
  response.collect { |hv| hv['hypervisor'] }
end

- (Object) list

Lists all hypervisor zones.

Returns:

  • an Array.



7
8
9
10
# File 'lib/squall/hypervisor_zone.rb', line 7

def list
  response = request(:get, "/settings/hypervisor_zones.json")
  response.collect { |i| i['hypervisor_group'] }
end

- (Object) network_joins(id)

List networks attached to a hypervisor zone.

Parameters:

  • id

    ID of the hypervisor zone

Returns:

  • an Array.



96
97
98
99
# File 'lib/squall/hypervisor_zone.rb', line 96

def network_joins(id)
  response = request(:get, "/settings/hypervisor_zones/#{id}/network_joins.json")
  response.collect { |i| i['network_join'] }
end

- (Object) remove_data_store_join(id, data_store_join_id)

Remove a data store from a hypervisor zone.

Parameters:

  • id

    ID of the hypervisor zone

  • data_store_join_id

    ID of the join record

Returns:

  • a Hash.



87
88
89
# File 'lib/squall/hypervisor_zone.rb', line 87

def remove_data_store_join(id, data_store_join_id)
  request(:delete, "/settings/hypervisor_zones/#{id}/data_store_joins/#{data_store_join_id}.json")
end

- (Object) remove_network_join(id, network_join_id)

Remove a network from a hypervisor zone.

Parameters:

  • id

    ID of the hypervisor zone

  • network_join_id

    ID of the join record

Returns:

  • a Hash.



119
120
121
# File 'lib/squall/hypervisor_zone.rb', line 119

def remove_network_join(id, network_join_id)
  request(:delete, "/settings/hypervisor_zones/#{id}/network_joins/#{network_join_id}.json")
end

- (Object) show(id)

Get the details for a hypervisor zone.

Parameters:

  • id

    ID of the hypervisor zone

Returns:

  • a Hash.



17
18
19
20
# File 'lib/squall/hypervisor_zone.rb', line 17

def show(id)
  response = request(:get, "/settings/hypervisor_zones/#{id}.json")
  response['hypervisor_group']
end