Sha256: 13d5a7fbbfe4eb33803b101cb4bd2d27907f5b362515fdbfff3d41f9999ec336

Contents?: true

Size: 1.75 KB

Versions: 5

Compression:

Stored size: 1.75 KB

Contents

module Fog
  module Compute
    class DigitalOcean
      class Real
        def resize_volume(volume_id, size, region)
          body = { :type => 'resize', size_gigabytes: size, region: region}

          encoded_body = Fog::JSON.encode(body)

          request(
            :expects => [201],
            :headers => {
              'Content-Type' => "application/json; charset=UTF-8",
            },
            :method  => 'POST',
            :path    => "v2/images/#{volume_id}/actions",
            :body    => encoded_body,
          )
        end
      end

      class Mock
        def resize_volume(volume_id, size, region)
					response         = Excon::Response.new
					response.status  = 201
          response.body    = {
            "action" => {
              "id" => 72531856,
              "status" => "in-progress",
              "type" => "resize",
              "started_at" => "2015-11-12T17:51:03Z",
              "completed_at" => "2015-11-12T17:51:14Z",
              "resource_id" => nil,
              "resource_type" => "volume",
              "region" => {
                "name" => "New York 1",
                "slug" => "nyc1",
                "sizes" => [
                  "1gb",
                  "2gb",
                  "4gb",
                  "8gb",
                  "32gb",
                  "64gb",
                  "512mb",
                  "48gb",
                  "16gb"
                ],
                "features" => [
                  "private_networking",
                  "backups",
                  "ipv6",
                  "metadata"
                ],
                "available" => true
              },
              "region_slug" => "nyc1"
            }
          }
          response
        end
      end
    end
  end
end

Version data entries

5 entries across 3 versions & 2 rubygems

Version Path
fog-digitalocean-0.4.0 lib/fog/compute/digitalocean/requests/resize_volume.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-digitalocean-0.3.0/lib/fog/digitalocean/requests/compute/resize_volume.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-digitalocean-0.3.0/lib/fog/digitalocean/requests/compute/resize_volume.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-digitalocean-0.3.0/lib/fog/digitalocean/requests/compute/resize_volume.rb
fog-digitalocean-0.3.0 lib/fog/digitalocean/requests/compute/resize_volume.rb