Class: OneviewSDK::API200::VolumeAttachment

Inherits:
Resource show all
Defined in:
lib/oneview-sdk/resource/api200/volume_attachment.rb

Overview

Storage volume attachment resource implementation

Constant Summary collapse

BASE_URI =
'/rest/storage-volume-attachments'.freeze

Constants inherited from Resource

Resource::UNIQUE_IDENTIFIERS

Instance Attribute Summary

Attributes inherited from Resource

#api_version, #client, #data, #logger

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

#==, #[], #[]=, build_query, #create!, #each, #eql?, #exists?, find_by, from_file, get_all, #like?, #refresh, #retrieve!, schema, #schema, #set, #set_all, #to_file

Constructor Details

#initialize(client, params = {}, api_ver = nil) ⇒ VolumeAttachment

Create a resource object, associate it with a client, and set its properties.

Parameters:

  • client (OneviewSDK::Client)

    The client object for the OneView appliance

  • params (Hash) (defaults to: {})

    The options for this resource (key-value pairs)

  • api_ver (Integer) (defaults to: nil)

    The api version to use when interracting with this resource.


24
25
26
27
28
# File 'lib/oneview-sdk/resource/api200/volume_attachment.rb', line 24

def initialize(client, params = {}, api_ver = nil)
  super
  # Default values:
  @data['type'] ||= 'StorageVolumeAttachment'
end

Class Method Details

.get_extra_unmanaged_volumes(client) ⇒ Object

Gets the list of extra unmanaged storage volumes

Parameters:


50
51
52
53
# File 'lib/oneview-sdk/resource/api200/volume_attachment.rb', line 50

def self.get_extra_unmanaged_volumes(client)
  response = client.rest_get(BASE_URI + '/repair?alertFixType=ExtraUnmanagedStorageVolumes')
  client.response_handler(response)
end

.remove_extra_unmanaged_volume(client, resource) ⇒ Object

Removes extra presentations from a specific server profile

Parameters:


58
59
60
61
62
63
64
65
# File 'lib/oneview-sdk/resource/api200/volume_attachment.rb', line 58

def self.remove_extra_unmanaged_volume(client, resource)
  requestBody = {
    type: 'ExtraUnmanagedStorageVolumes',
    resourceUri: resource['uri']
  }
  response = client.rest_post(BASE_URI + '/repair', { 'Accept-Language' => 'en_US', 'body' => requestBody }, client.api_version)
  client.response_handler(response)
end

Instance Method Details

#createObject

Method is not available

Raises:


32
33
34
# File 'lib/oneview-sdk/resource/api200/volume_attachment.rb', line 32

def create(*)
  unavailable_method
end

#deleteObject

Method is not available

Raises:


44
45
46
# File 'lib/oneview-sdk/resource/api200/volume_attachment.rb', line 44

def delete(*)
  unavailable_method
end

#get_path(id) ⇒ OneviewSDK::VolumeAttachmentPath

Gets a volume attachment path by id

Parameters:

  • id (String)

    Volume attachament path id

Returns:

  • (OneviewSDK::VolumeAttachmentPath)

77
78
79
80
# File 'lib/oneview-sdk/resource/api200/volume_attachment.rb', line 77

def get_path(id)
  response = @client.rest_get("#{@data['uri']}/paths/#{id}")
  @client.response_handler(response)
end

#get_pathsArray

Gets all volume attachment paths

Returns:

  • (Array)

    List of the storage volume attachments paths


69
70
71
72
# File 'lib/oneview-sdk/resource/api200/volume_attachment.rb', line 69

def get_paths
  response = @client.rest_get(@data['uri'] + '/paths')
  @client.response_handler(response)
end

#updateObject

Method is not available

Raises:


38
39
40
# File 'lib/oneview-sdk/resource/api200/volume_attachment.rb', line 38

def update(*)
  unavailable_method
end