Class: Fog::Compute::ProfitBricks::Interface

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Interface

Returns a new instance of Interface.



21
22
23
# File 'lib/fog/profitbricks/models/compute/interface.rb', line 21

def initialize(attributes={})
    super
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



19
20
21
# File 'lib/fog/profitbricks/models/compute/interface.rb', line 19

def options
  @options
end

Instance Method Details

#destroyObject



41
42
43
44
45
# File 'lib/fog/profitbricks/models/compute/interface.rb', line 41

def destroy
    requires :id
    service.delete_nic(id)
    true
end

#failed?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/fog/profitbricks/models/compute/interface.rb', line 58

def failed?
    self.state == 'ERROR'
end

#ready?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/fog/profitbricks/models/compute/interface.rb', line 54

def ready?
    self.state == 'AVAILABLE'
end

#saveObject



25
26
27
28
29
30
31
# File 'lib/fog/profitbricks/models/compute/interface.rb', line 25

def save
    requires :server_id, :lan_id

    data = service.create_nic(server_id, lan_id, options={})
    merge_attributes(data.body['createNicResponse'])
    true
end

#set_internet_access(options = {}) ⇒ Object



47
48
49
50
51
52
# File 'lib/fog/profitbricks/models/compute/interface.rb', line 47

def set_internet_access(options={})
    service.set_internet_access(
        options[:data_center_id], options[:lan_id], options[:internet_access]
    )
    true
end

#updateObject



33
34
35
36
37
38
39
# File 'lib/fog/profitbricks/models/compute/interface.rb', line 33

def update
    requires :id

    data = service.update_nic(id, options)
    merge_attributes(data.body['updateNicResponse'])
    true
end