Module: ViprStoragePort

Included in:
Vipr
Defined in:
lib/vipruby/objects/storageport.rb

Overview

The following StoragePort calls will get and execute StoragePort items

Instance Method Summary collapse

Instance Method Details

#check_storage_port_id_post(storage_port_id = nil) ⇒ Boolean (private)

Error Handling method to check for Missing Storage Port ID param. If the pass fails, an error exception is raised

Parameters:

  • storage_port_id (String) (defaults to: nil)

    Requires the string of the storage_port_id uid

Returns:

  • (Boolean)

    True if pass, false if it fails



55
56
57
58
59
# File 'lib/vipruby/objects/storageport.rb', line 55

def check_storage_port_id_post(storage_port_id=nil)
  if storage_port_id == nil
      raise "Missing param (storage_port_id)"
  end
end

#get_storage_port(storage_port_id, auth = nil, cert = nil) ⇒ JSON

Get single StoragePort information

Parameters:

  • storage_port_id (urn:id)

    URN of a StoragePort. Required Param

Returns:

  • (JSON)

    The JSON object of the StoragePort



17
18
19
# File 'lib/vipruby/objects/storageport.rb', line 17

def get_storage_port(storage_port_id,auth=nil, cert=nil)
  rest_get("#{@base_url}/vdc/storage-ports/#{storage_port_id}", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)
end

#get_storage_ports(auth = nil, cert = nil) ⇒ json

Get All StoragePorts

Returns:

  • (json)

    JSON object of all the StoragePorts



8
9
10
# File 'lib/vipruby/objects/storageport.rb', line 8

def get_storage_ports(auth=nil, cert=nil)
  rest_get("#{@base_url}/vdc/storage-ports", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)
end

#storage_port_deactivate(storage_port_id = nil, auth = nil, cert = nil) ⇒ JSON

Deactivate StoragePort. Remove a storage port. The method would remove the deregistered storage port and all resources associated with the storage port from the database. Note they are not removed from the storage system physically, but become unavailable for the user.

Parameters:

  • storage_port_id (urn:id) (defaults to: nil)

    URN of a StoragePort. Required Param

Returns:

  • (JSON)

    The JSON object of the StoragePort



39
40
41
42
43
44
45
# File 'lib/vipruby/objects/storageport.rb', line 39

def storage_port_deactivate(storage_port_id=nil,auth=nil, cert=nil)
  check_storage_port_id_post(storage_port_id)
    payload = {
        id: storage_port_id
      }.to_json
    rest_post(payload, "#{@base_url}/vdc/storage-ports/#{storage_port_id}/deactivate", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)
end

#storage_port_deregister(storage_port_id = nil, auth = nil, cert = nil) ⇒ JSON

Deregister StoragePort. Allows the user to deregister a registered storage port so that it is no longer used by the system. This simply sets the registration_status of the storage port to UNREGISTERED

Parameters:

  • storage_port_id (urn:id) (defaults to: nil)

    URN of a StoragePort. Required Param

Returns:

  • (JSON)

    The JSON object of the StoragePort



26
27
28
29
30
31
32
# File 'lib/vipruby/objects/storageport.rb', line 26

def storage_port_deregister(storage_port_id=nil,auth=nil, cert=nil)
  check_storage_port_id_post(storage_port_id)
    payload = {
        id: storage_port_id
      }.to_json
    rest_post(payload, "#{@base_url}/vdc/storage-ports/#{storage_port_id}/deregister", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)
end