Sha256: 6322fd1d1466591def154a09d35ed0766f8d300cc0ff9a87b016be6aef724cc2

Contents?: true

Size: 1.78 KB

Versions: 24

Compression:

Stored size: 1.78 KB

Contents

module Fog
  module Compute
    class Google

      class Mock

        def delete_disk(disk_name, zone_name)
          get_disk(disk_name, zone_name)

          operation = self.random_operation
          self.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" => self.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}"
          }
          self.data[:disks].delete disk_name

          build_response(:body => self.data[:operations][operation])
        end

      end

      class Real

        def delete_disk(disk_name, zone_name)
          if zone_name.start_with? 'http'
            zone_name = zone_name.split('/')[-1]
          end

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

          result = self.build_result(api_method, parameters)
          response = self.build_response(result)
        end

      end

    end
  end
end

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
fog-1.22.0 lib/fog/google/requests/compute/delete_disk.rb
fog-1.21.0 lib/fog/google/requests/compute/delete_disk.rb
fog-maestrodev-1.20.0.20140305101839 lib/fog/google/requests/compute/delete_disk.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/google/requests/compute/delete_disk.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/google/requests/compute/delete_disk.rb
fog-1.20.0 lib/fog/google/requests/compute/delete_disk.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/google/requests/compute/delete_disk.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/google/requests/compute/delete_disk.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/google/requests/compute/delete_disk.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/google/requests/compute/delete_disk.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/google/requests/compute/delete_disk.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/google/requests/compute/delete_disk.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/google/requests/compute/delete_disk.rb
fog-1.19.0 lib/fog/google/requests/compute/delete_disk.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/google/requests/compute/delete_disk.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/google/requests/compute/delete_disk.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/google/requests/compute/delete_disk.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/google/requests/compute/delete_disk.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/google/requests/compute/delete_disk.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/google/requests/compute/delete_disk.rb