Sha256: fff0fe979fe39b89cd431e2c6083d8d2f536c147c7f6518c0b22632bc576007f

Contents?: true

Size: 1.18 KB

Versions: 4

Compression:

Stored size: 1.18 KB

Contents

module Fog
  module Network
    class HuaweiCloud
      class Real
        def create_vpc(name, cidr)
          if @huaweicloud_version == "v1"
            data = {
                'vpc' => {
                    'name' => name,
                    'cidr' => cidr
                }
            }

            # vanilla_options = [:name, :gateway_ip, :allocation_pools,
            #                    :dns_nameservers, :host_routes, :enable_dhcp,
            #                    :tenant_id, :vpc_id]
            # vanilla_options.select { |o| options.key?(o) }.each do |key|
            #   data['vpc'][key] = options[key]
            # end

            request(
                :body    => Fog::JSON.encode(data),
                :expects => [200],
                :method  => 'POST',
                :path    => 'vpcs'
            )
          else
            raise Fog::HuaweiCloud::Errors::InterfaceNotImplemented.new('Method :create_subnet is not implemented')
          end
        end
      end

      class Mock
        def create_vpc(name, cidr)
          raise Fog::HuaweiCloud::Errors::InterfaceNotImplemented.new('Method :create_vpc is not implemented')
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-huaweicloud-0.0.3 lib/fog/network/huaweicloud/requests/create_vpc.rb
fog-huaweicloud-0.0.2 lib/fog/network/huaweicloud/requests/create_vpc.rb
fog-huaweicloud-0.1.3 lib/fog/network/huaweicloud/requests/create_vpc.rb
fog-huaweicloud-0.1.2 lib/fog/network/huaweicloud/requests/create_vpc.rb