Class: Fog::OpenStack::NFV::Vnf

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/openstack/nfv/models/vnf.rb

Instance Attribute Summary

Attributes inherited from Model

#project

Instance Method Summary collapse

Methods inherited from Model

#initialize

Constructor Details

This class inherits a constructor from Fog::OpenStack::Model

Instance Method Details

#create(options = {}) ⇒ Object



21
22
23
24
# File 'lib/fog/openstack/nfv/models/vnf.rb', line 21

def create(options = {})
  merge_attributes(service.create_vnf(default_options.merge(options)).body['vnf'])
  self
end

#default_optionsObject



41
42
43
44
45
46
# File 'lib/fog/openstack/nfv/models/vnf.rb', line 41

def default_options
  {
    :vnf  => vnf,
    :auth => auth
  }
end

#destroyObject



35
36
37
38
39
# File 'lib/fog/openstack/nfv/models/vnf.rb', line 35

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

#ready?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/fog/openstack/nfv/models/vnf.rb', line 52

def ready?
  status == 'ACTIVE'
end

#save(options = {}) ⇒ Object



31
32
33
# File 'lib/fog/openstack/nfv/models/vnf.rb', line 31

def save(options = {})
  identity ? update(options) : create(options)
end

#update(options = {}) ⇒ Object



26
27
28
29
# File 'lib/fog/openstack/nfv/models/vnf.rb', line 26

def update(options = {})
  merge_attributes(service.update_vnf(identity, default_options.merge(options)).body['vnf'])
  self
end

#vnf_attributesObject



48
49
50
# File 'lib/fog/openstack/nfv/models/vnf.rb', line 48

def vnf_attributes
  attributes['attributes']
end