Class: Purest::HostGroup

Inherits:
APIMethods show all
Defined in:
lib/purest/host_group.rb

Constant Summary collapse

GET_PARAMS =
%i[action block_size connect historical length names
pending pending_only pgrouplist private protect
shared snap space].freeze

Instance Method Summary collapse

Methods inherited from APIMethods

#append_path

Methods inherited from Rest

access_method?, #authenticated?, #concat_url, #initialize, #logout, method_missing, #use_named_parameter

Constructor Details

This class inherits a constructor from Purest::Rest

Instance Method Details

#create(options = nil) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/purest/host_group.rb', line 17

def create(options = nil)
  # The API doesn't accept some of these options in the HTTP body
  # during a POST, so we remove them from the options hash after
  # creating a path to append to the base URL in APIMethods.create
  if options[:name] && options[:volume]
    appended_path = "#{options.delete(:name)}/volume/#{options.delete(:volume)}"
  elsif options[:name] && options[:protection_group]
    appended_path = "#{options.delete(:name)}/pgroup/#{options.delete(:protection_group)}"
  end
  super(options, 'hgroup', appended_path)
end

#delete(options = nil) ⇒ Object

Delete a host group, DELETE

Parameters:

  • options (Hash) (defaults to: nil)

    options to pass



35
36
37
38
39
40
41
42
43
# File 'lib/purest/host_group.rb', line 35

def delete(options = nil)
  if options[:name] && options[:volume]
    appended_path = "#{options.delete(:name)}/volume/#{options.delete(:volume)}"
  elsif options[:name] && options[:protection_group]
    appended_path = "#{options.delete(:name)}/pgroup/#{options.delete(:protection_group)}"
  end

  super(options, 'hgroup', appended_path)
end

#get(options = nil) ⇒ Object

Get a list of hostgroups, GET

Parameters:

  • options (Hash) (defaults to: nil)

    options to pass in



13
14
15
# File 'lib/purest/host_group.rb', line 13

def get(options = nil)
  super(options, 'hgroup', GET_PARAMS, [:show_volume])
end

#update(options = nil) ⇒ Object



29
30
31
# File 'lib/purest/host_group.rb', line 29

def update(options = nil)
  super(options, 'hgroup')
end