Method: Fog::Compute::OracleCloud::Mock#create_storage_attachment

Defined in:
lib/fog/oraclecloud/requests/compute/create_storage_attachment.rb

#create_storage_attachment(params) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/fog/oraclecloud/requests/compute/create_storage_attachment.rb', line 31

def create_storage_attachment (params)
  response = Excon::Response.new

  guid = SecureRandom.uuid
  name = "#{params[:instance_name]}/#{guid}"

  self.data[:storage_attachments][name] = {
    'index' => params[:index],
    'account' => nil,
    'storage_volume_name' => params[:storage_volume_name],
    'hypervisor' => nil,
    'uri' => "#{@api_endpoint}/storage/attachment/#{name}",
    'instance_name' => params[:instance_name],
    'state' => 'attaching',
    'readonly' => false,
    'name' => name
  }
  response.status = 201
  response.body = self.data[:storage_attachments][name]
  response
end