Sha256: a917a7e4d07a8531cb5ac8ef9e145a2316893c7b6355e672ecbb9bb8181b6a05

Contents?: true

Size: 1.15 KB

Versions: 4

Compression:

Stored size: 1.15 KB

Contents

require 'fog/huaweicloud/models/model'

module Fog
  module NFV
    class HuaweiCloud
      class Vnfd < Fog::HuaweiCloud::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::HuaweiCloud::Errors::InterfaceNotImplemented, "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

4 entries across 4 versions & 1 rubygems

Version Path
fog-huaweicloud-0.0.3 lib/fog/nfv/huaweicloud/models/vnfd.rb
fog-huaweicloud-0.0.2 lib/fog/nfv/huaweicloud/models/vnfd.rb
fog-huaweicloud-0.1.3 lib/fog/nfv/huaweicloud/models/vnfd.rb
fog-huaweicloud-0.1.2 lib/fog/nfv/huaweicloud/models/vnfd.rb