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::DEFAULT_REQUEST_HEADER, 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!, #deep_merge!, #each, #eql?, #exists?, find_by, find_with_pagination, from_file, get_all, get_all_with_query, #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) ⇒ Array

Gets the list of extra unmanaged storage volumes

Parameters:

Returns:

  • (Array)

    Array of extra unmanaged storage volumes



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

def self.get_extra_unmanaged_volumes(client)
  response = client.rest_get(BASE_URI + '/repair?alertFixType=ExtraUnmanagedStorageVolumes')
  body = client.response_handler(response)
  body['members'].map { |data| new(client, data) }
end

.remove_extra_unmanaged_volume(client, resource) ⇒ Object

Removes extra presentations from a specific server profile

Parameters:



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

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)


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

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



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

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