Sha256: 100e6969cf5e9a88493f30570e49753fb04e5b21e71bbff55405d9d719a6b98a

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

# coding: utf-8

module Fog
  module Network
    class SakuraCloud
      class Real
        def create_router(options)
          bandwidthmbps = options[:bandwidthmbps] ? options[:bandwidthmbps].to_i : 100

          body = {
            "Internet" => {
              "Name" => options[:name],
              "NetworkMaskLen"=> options[:networkmasklen].to_i,
              "BandWidthMbps"=> bandwidthmbps
            }
          }

          request(
            :headers => {
              'Authorization' => "Basic #{@auth_encode}"
            },
            :expects  => 202,
            :method => 'POST',
            :path => "#{Fog::SakuraCloud::SAKURACLOUD_API_ENDPOINT}/internet",
            :body => Fog::JSON.encode(body)
          )
        end
      end # Real

      class Mock
        def create_router(options)
          response = Excon::Response.new
          response.status = 202
          response.body = {
          }
          response
        end
      end
    end # SakuraCloud
  end # Network
end # Fog

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fog-sakuracloud-1.4.0 lib/fog/sakuracloud/requests/network/create_router.rb
fog-sakuracloud-1.3.3 lib/fog/sakuracloud/requests/network/create_router.rb