Class: Fog::Compute::Gridscale::Network

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

Instance Method Summary collapse

Instance Method Details

#deleteObject



26
27
28
29
30
# File 'lib/fog/compute/gridscale/models/network.rb', line 26

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

#destroyObject



32
33
34
35
36
# File 'lib/fog/compute/gridscale/models/network.rb', line 32

def destroy
  requires :object_uuid
  response = service.network_delete object_uuid
  response.body
end

#saveObject

Raises:

  • (Fog::Errors::Error)


38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/fog/compute/gridscale/models/network.rb', line 38

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

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

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

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

  data = service.network_create(name, options)

  merge_attributes(data.body)
  true
end

#updateObject



61
62
63
64
65
66
67
68
69
# File 'lib/fog/compute/gridscale/models/network.rb', line 61

def update
  requires :object_uuid

  payload = {}

  data = service.network_update(object_uuid, payload)
  merge_attributes(data.body)
  true
end