Sha256: 9098ca70ebc2149ee5eab1e017e91b1ce30fffa604320f5d67a59c8771e7a4c6

Contents?: true

Size: 1015 Bytes

Versions: 1

Compression:

Stored size: 1015 Bytes

Contents

# coding: utf-8

module Fog
  module Volume
    class SakuraCloud
      class Real
        def create_disk( name, plan, sourcearchive )
          body = {
           "Disk" => {
             "Name" => name,
             "SourceArchive" => {
               "ID" => sourcearchive.to_s
              },
              "Plan" => {
                "ID" => plan.to_i
              }
            }
          }

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

      class Mock
        def create_disk( name, plan, sourcearchive )
          response = Excon::Response.new
          response.status = 202
          response.body = {
          }
          response
        end
      end
    end # SakuraCloud
  end # Volume
end # Fog

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-sakuracloud-1.3.3 lib/fog/sakuracloud/requests/volume/create_disk.rb