Module: ViprStoragePool

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

Overview

The following StoragePool calls will get and execute StoragePool items

Instance Method Summary collapse

Instance Method Details

#check_storage_pool_id_post(storage_pool_id = nil) ⇒ Boolean (private)

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

Parameters:

  • storage_pool_id (String) (defaults to: nil)

    Requires the string of the storage_pool_id uid

Returns:

  • (Boolean)

    True if pass, false if it fails



73
74
75
76
77
# File 'lib/vipruby/objects/storagepool.rb', line 73

def check_storage_pool_id_post(storage_pool_id=nil)
  if storage_pool_id == nil
      raise "Missing param (storage_pool_id)"
  end
end

#get_storage_pool(storage_pool_id, auth = nil, cert = nil) ⇒ JSON

Get single StoragePool information

Parameters:

  • storage_pool_id (urn:id)

    URN of a StoragePool. Required Param

Returns:

  • (JSON)

    The JSON object of the StoragePool



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

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

#get_storage_pool_resources(storage_pool_id, auth = nil, cert = nil) ⇒ JSON

Get single StoragePool Resources information

Parameters:

  • storage_pool_id (urn:id)

    URN of a StoragePool. Required Param

Returns:

  • (JSON)

    The JSON object of the StoragePool Resources



35
36
37
# File 'lib/vipruby/objects/storagepool.rb', line 35

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

#get_storage_pool_storage_tiers(storage_pool_id, auth = nil, cert = nil) ⇒ JSON

Get single StoragePool Storage-Tiers information

Parameters:

  • storage_pool_id (urn:id)

    URN of a StoragePool. Required Param

Returns:

  • (JSON)

    The JSON object of the StoragePool Storage-Tiers



26
27
28
# File 'lib/vipruby/objects/storagepool.rb', line 26

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

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

Get All StoragePools

Returns:

  • (json)

    JSON object of all the StoragePools



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

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

#storage_pool_deactivate(storage_pool_id = nil, auth = nil, cert = nil) ⇒ JSON

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

Parameters:

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

    URN of a StoragePool. Required Param

Returns:

  • (JSON)

    The JSON object of the StoragePool



57
58
59
60
61
62
63
# File 'lib/vipruby/objects/storagepool.rb', line 57

def storage_pool_deactivate(storage_pool_id=nil,auth=nil, cert=nil)
  check_storage_pool_id_post(storage_pool_id)
    payload = {
        id: storage_pool_id
      }.to_json
    rest_post(payload, "#{@base_url}/vdc/storage-pools/#{storage_pool_id}/deactivate", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)
end

#storage_pool_deregister(storage_pool_id = nil, auth = nil, cert = nil) ⇒ JSON

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

Parameters:

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

    URN of a StoragePool. Required Param

Returns:

  • (JSON)

    The JSON object of the StoragePool



44
45
46
47
48
49
50
# File 'lib/vipruby/objects/storagepool.rb', line 44

def storage_pool_deregister(storage_pool_id=nil,auth=nil, cert=nil)
  check_storage_pool_id_post(storage_pool_id)
    payload = {
        id: storage_pool_id
      }.to_json
    rest_post(payload, "#{@base_url}/vdc/storage-pools/#{storage_pool_id}/deregister", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)
end