Class: Fog::Compute::Gridscale::Ip

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/compute/gridscale/models/ip.rb

Instance Method Summary collapse

Instance Method Details

#deleteObject



57
58
59
60
61
# File 'lib/fog/compute/gridscale/models/ip.rb', line 57

def delete
  requires :object_uuid
  response = service.ip_delete object_uuid
  response.body
end

#destroyObject



63
64
65
66
67
# File 'lib/fog/compute/gridscale/models/ip.rb', line 63

def destroy
  requires :object_uuid
  response = service.ip_delete(object_uuid)
  response
end

#saveObject

Raises:

  • (Fog::Errors::Error)


27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/fog/compute/gridscale/models/ip.rb', line 27

def save
  raise Fog::Errors::Error.new('Re-saving an existing object may create a duplicate') if persisted?
  requires :family

  options = {}
  if attributes[:labels]
    options[:labels] = labels
  end

  if attributes[:failover]
    options[:failover] = failover
  end

  if attributes[:name]
    options[:name] = name
  end

  if attributes[:reverse_dns]
    options[:reverse_dns] = reverse_dns
  end

  if attributes[:location_uuid]
    options[:location_uuid] = location_uuid
  end
  data = service.ip_create(family, options)

  merge_attributes(data.body)
  true
end