Sha256: 70c5bf862adb96e982a5607f11cac289e43bcaf86ae1bef554bf5e2ab420c4c7

Contents?: true

Size: 1.21 KB

Versions: 44

Compression:

Stored size: 1.21 KB

Contents

require 'fog/openstack/models/model'

module Fog
  module NFV
    class OpenStack
      class Vnf < Fog::OpenStack::Model
        identity :id

        attribute :status
        attribute :name
        attribute :tenant_id
        attribute :instance_id
        attribute :mgmt_url
        attribute :description
        attribute :vnf_attributes

        # Attributes for create and update
        attribute :vnf
        attribute :auth

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

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

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

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

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

        def vnf_attributes
          attributes['attributes']
        end

        def ready?
          status == 'ACTIVE'
        end
      end
    end
  end
end

Version data entries

44 entries across 42 versions & 3 rubygems

Version Path
fog-openstack-0.1.31 lib/fog/nfv/openstack/models/vnf.rb
fog-openstack-0.3.10 lib/fog/nfv/openstack/models/vnf.rb
fog-openstack-0.1.30 lib/fog/nfv/openstack/models/vnf.rb
fog-openstack-0.1.29 lib/fog/nfv/openstack/models/vnf.rb
fog-openstack-0.3.9 lib/fog/nfv/openstack/models/vnf.rb
fog-openstack-0.1.28 lib/fog/nfv/openstack/models/vnf.rb
fog-openstack-0.3.8 lib/fog/nfv/openstack/models/vnf.rb
fog-openstack-0.3.7 lib/fog/nfv/openstack/models/vnf.rb
fog-openstack-0.3.6 lib/fog/nfv/openstack/models/vnf.rb
fog-openstack-0.3.5 lib/fog/nfv/openstack/models/vnf.rb
fog-openstack-0.3.4 lib/fog/nfv/openstack/models/vnf.rb
fog-openstack-0.3.3 lib/fog/nfv/openstack/models/vnf.rb
fog-openstack-0.3.2 lib/fog/nfv/openstack/models/vnf.rb
fog-openstack-0.3.0 lib/fog/nfv/openstack/models/vnf.rb
fog-openstack-0.2.4 lib/fog/nfv/openstack/models/vnf.rb
fog-openstack-0.2.3 lib/fog/nfv/openstack/models/vnf.rb
fog-openstack-0.2.2 lib/fog/nfv/openstack/models/vnf.rb
fog-openstack-0.2.1 lib/fog/nfv/openstack/models/vnf.rb
fog-openstack-0.2.0 lib/fog/nfv/openstack/models/vnf.rb
fog-zj-0.1.28 lib/fog/nfv/openstack/models/vnf.rb