Sha256: ef2c4291df69678e920bf64315228fb8b16d8d85f681ed9f0c3b8496fb36e697

Contents?: true

Size: 1.66 KB

Versions: 14

Compression:

Stored size: 1.66 KB

Contents

module Fog
  module Compute
    class Google
      class Mock
        def delete_disk(disk_name, zone_name)
          get_disk(disk_name, zone_name)

          operation = random_operation
          data[:operations][operation] = {
            "kind" => "compute#operation",
            "id" => Fog::Mock.random_numbers(19).to_s,
            "name" => operation,
            "zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}",
            "operationType" => "delete",
            "targetLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/disks/#{disk_name}",
            "targetId" => data[:disks][disk_name]["id"],
            "status" => Fog::Compute::Google::Operation::PENDING_STATE,
            "user" => "123456789012-qwertyuiopasdfghjkl1234567890qwe@developer.gserviceaccount.com",
            "progress" => 0,
            "insertTime" => Time.now.iso8601,
            "startTime" => Time.now.iso8601,
            "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/operations/#{operation}"
          }
          data[:disks].delete disk_name

          build_excon_response(data[:operations][operation])
        end
      end

      class Real
        def delete_disk(disk_name, zone_name)
          zone_name = zone_name.split("/")[-1] if zone_name.start_with? "http"

          api_method = @compute.disks.delete
          parameters = {
            "project" => @project,
            "disk" => disk_name,
            "zone" => zone_name
          }

          request(api_method, parameters)
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
fog-google-0.6.0 lib/fog/compute/google/requests/delete_disk.rb
fog-google-0.5.5 lib/fog/compute/google/requests/delete_disk.rb
fog-google-0.5.4 lib/fog/compute/google/requests/delete_disk.rb
fog-google-0.5.3 lib/fog/compute/google/requests/delete_disk.rb
fog-google-0.5.2 lib/fog/compute/google/requests/delete_disk.rb
fog-google-0.5.1 lib/fog/compute/google/requests/delete_disk.rb
fog-google-0.5.0 lib/fog/compute/google/requests/delete_disk.rb
fog-google-0.4.2 lib/fog/compute/google/requests/delete_disk.rb
fog-google-0.4.1 lib/fog/compute/google/requests/delete_disk.rb
fog-google-0.4.0 lib/fog/compute/google/requests/delete_disk.rb
fog-google-0.3.2 lib/fog/compute/google/requests/delete_disk.rb
fog-google-0.3.1 lib/fog/compute/google/requests/delete_disk.rb
fog-google-0.3.0 lib/fog/compute/google/requests/delete_disk.rb
fog-google-0.2.0 lib/fog/compute/google/requests/delete_disk.rb