Class: Fog::Volume::SakuraCloud::Disk

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/sakuracloud/models/volume/disk.rb

Instance Method Summary collapse

Instance Method Details

#associate_ip(ipaddress, networkmasklen, defaultroute) ⇒ Object



35
36
37
38
39
40
41
42
43
44
# File 'lib/fog/sakuracloud/models/volume/disk.rb', line 35

def associate_ip(ipaddress, networkmasklen, defaultroute)
  subnet ={
    :ipaddress => ipaddress,
    :networkmasklen => networkmasklen,
    :defaultroute => defaultroute
  }
  requires :id
  service.associate_ip_to_disk(@attributes[:id], subnet )
  true
end

#configure(sshkey_id) ⇒ Object



29
30
31
32
33
# File 'lib/fog/sakuracloud/models/volume/disk.rb', line 29

def configure(sshkey_id)
  requires :id
  service.configure_disk(@attributes[:id], sshkey_id )
  true
end

#deleteObject Also known as: destroy



16
17
18
19
# File 'lib/fog/sakuracloud/models/volume/disk.rb', line 16

def delete
  service.delete_disk(identity)
  true
end

#register_script(notes) ⇒ Object



46
47
48
49
50
51
52
# File 'lib/fog/sakuracloud/models/volume/disk.rb', line 46

def register_script(notes)
  note_ids = []
  note_ids << notes
  requires :id
  service.register_note_to_disk(@attributes[:id], note_ids.flatten )
  true
end

#saveObject



22
23
24
25
26
27
# File 'lib/fog/sakuracloud/models/volume/disk.rb', line 22

def save
  requires :name, :plan, :source_archive
  data = service.create_disk(@attributes[:name], @attributes[:plan], @attributes[:source_archive]).body["Disk"]
  merge_attributes(data)
  true
end