Sha256: 51d588790c114e869f4594168a3c06602a107166efc28cc781cc0d6b4154b21c

Contents?: true

Size: 1.78 KB

Versions: 12

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

12 entries across 12 versions & 3 rubygems

Version Path
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/google/requests/compute/delete_disk.rb
ns-fog-1.22.11 lib/fog/google/requests/compute/delete_disk.rb
ns-fog-1.22.10 lib/fog/google/requests/compute/delete_disk.rb
ns-fog-1.22.9 lib/fog/google/requests/compute/delete_disk.rb
ns-fog-1.22.8 lib/fog/google/requests/compute/delete_disk.rb
ns-fog-1.22.7 lib/fog/google/requests/compute/delete_disk.rb
ns-fog-1.22.6 lib/fog/google/requests/compute/delete_disk.rb
fog-1.23.0 lib/fog/google/requests/compute/delete_disk.rb
ns-fog-1.22.4 lib/fog/google/requests/compute/delete_disk.rb
ns-fog-1.22.3 lib/fog/google/requests/compute/delete_disk.rb
ns-fog-1.22.2 lib/fog/google/requests/compute/delete_disk.rb
fog-1.22.1 lib/fog/google/requests/compute/delete_disk.rb