Sha256: 56f1e96102ed27742c32880adedeac1a506df0b57aeb480840e02180cb0dc28d

Contents?: true

Size: 1.14 KB

Versions: 5

Compression:

Stored size: 1.14 KB

Contents

require 'fog/openstack/models/model'

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

        attribute :service_types
        attribute :description
        attribute :tenant_id
        attribute :mgmt_driver
        attribute :infra_driver
        attribute :name
        attribute :vnf_attributes

        # Attributes for create
        attribute :vnfd
        attribute :auth

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

        def update(_options = {})
          raise Fog::OpenStack::Errors::InterfaceNotImplemented.new("Method 'update' is not supported")
        end

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

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

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

        def vnf_attributes
          attributes['attributes']
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fog-openstack-0.1.10 lib/fog/openstack/models/nfv/vnfd.rb
fog-openstack-0.1.9 lib/fog/openstack/models/nfv/vnfd.rb
fog-openstack-0.1.8 lib/fog/openstack/models/nfv/vnfd.rb
fog-openstack-0.1.7 lib/fog/openstack/models/nfv/vnfd.rb
fog-openstack-0.1.6 lib/fog/openstack/models/nfv/vnfd.rb