Sha256: ca2f7be8de41f4fe1aade24934b0858759ae0a6e954797626778d3382e9eea27

Contents?: true

Size: 853 Bytes

Versions: 4

Compression:

Stored size: 853 Bytes

Contents

module Fog
  module NFV
    class HuaweiCloud
      class Real
        def create_vnf(options)
          options_valid = [
            :auth,
            :vnf,
          ]

          # Filter only allowed creation attributes
          data = options.select do |key, _|
            options_valid.include?(key.to_sym) || options_valid.include?(key.to_s)
          end

          request(
            :body    => Fog::JSON.encode(data),
            :expects => 201,
            :method  => "POST",
            :path    => "vnfs"
          )
        end
      end

      class Mock
        def create_vnf(_)
          response = Excon::Response.new
          response.status = 201

          create_data = data[:vnfs].first.merge("vnfd_id" => "id")
          response.body = {"vnf" => create_data}
          response
        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/requests/create_vnf.rb
fog-huaweicloud-0.0.2 lib/fog/nfv/huaweicloud/requests/create_vnf.rb
fog-huaweicloud-0.1.3 lib/fog/nfv/huaweicloud/requests/create_vnf.rb
fog-huaweicloud-0.1.2 lib/fog/nfv/huaweicloud/requests/create_vnf.rb