Sha256: e2da8886641dc1fe8c1c753254da91fd8b2abe1409afdba8ea6c1dc4ba1811ea

Contents?: true

Size: 1.53 KB

Versions: 10

Compression:

Stored size: 1.53 KB

Contents

module Fog
  module Compute
    class Google
      class Mock
        def insert_disk(_disk_name, _zone, _image_name = nil, _options = {})
          Fog::Mock.not_implemented
        end
      end

      class Real
        # Create a disk resource in a specific zone
        # https://cloud.google.com/compute/docs/reference/latest/disks/insert
        #
        # @param disk_name [String] Name of the disk to create
        # @param zone_name [String] Zone the disk reside in
        # @param image_name [String] Optional image name to create the disk from
        # @param opts [Hash] Optional hash of options
        # @option options [String] size_gb Number of GB to allocate to an empty disk
        # @option options [String] source_snapshot Snapshot to create the disk from
        # @option options [String] description Human friendly description of the disk
        # @option options [String] type URL of the disk type resource describing which disk type to use
        def insert_disk(disk_name, zone, image_name = nil,
                        description: nil, type: nil, size_gb: nil,
                        source_snapshot: nil, **_opts)
          disk = ::Google::Apis::ComputeV1::Disk.new(
            :name => disk_name,
            :description => description,
            :type => type,
            :size_gb => size_gb,
            :source_snapshot => source_snapshot
          )
          @compute.insert_disk(@project, zone.split("/")[-1], disk,
                               :source_image => image_name)
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
fog-google-1.3.3 lib/fog/compute/google/requests/insert_disk.rb
fog-google-1.3.2 lib/fog/compute/google/requests/insert_disk.rb
fog-google-1.3.1 lib/fog/compute/google/requests/insert_disk.rb
fog-google-1.3.0 lib/fog/compute/google/requests/insert_disk.rb
fog-google-1.2.2 lib/fog/compute/google/requests/insert_disk.rb
fog-google-1.2.1 lib/fog/compute/google/requests/insert_disk.rb
fog-google-1.2.0 lib/fog/compute/google/requests/insert_disk.rb
fog-google-1.1.0 lib/fog/compute/google/requests/insert_disk.rb
fog-google-1.0.1 lib/fog/compute/google/requests/insert_disk.rb
fog-google-1.0.0 lib/fog/compute/google/requests/insert_disk.rb