Sha256: 76465c2b5139850df342b78c67a48022ff080868f8da63f3eb54d9ad466b8d59

Contents?: true

Size: 1.36 KB

Versions: 14

Compression:

Stored size: 1.36 KB

Contents

module Fog
  module Compute
    class Google
      class Mock
        def set_server_metadata(_instance, _zone, _fingerprint, _metadata_items = {})
          # :no-coverage:
          Fog::Mock.not_implemented
          # :no-coverage:
        end
      end

      class Real
        # Set an instance metadata
        #
        # @param [String] instance Instance name (identity)
        # @param [String] zone Name of zone
        # @param [String] fingerprint The fingerprint of the last metadata.
        #   Can be retrieved by reloading the compute object, and checking the
        #   metadata fingerprint field.
        #     instance.reload
        #     fingerprint = instance.metadata['fingerprint']
        # @param [Hash] metadata A new metadata object
        #   Should have the following structure:
        #   {'foo' => 'bar', 'baz'=>'foo'}
        #
        # @returns [::Google::Apis::ComputeV1::Operation] set operation
        def set_server_metadata(instance, zone, fingerprint, metadata_items = [])
          items = metadata_items.map { |item| ::Google::Apis::ComputeV1::Metadata::Item.new(**item) }
          @compute.set_instance_metadata(
            @project, zone.split("/")[-1], instance,
            ::Google::Apis::ComputeV1::Metadata.new(
              fingerprint: fingerprint, items: items
            )
          )
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
fog-google-1.24.1 lib/fog/compute/google/requests/set_server_metadata.rb
fog-google-1.24.0 lib/fog/compute/google/requests/set_server_metadata.rb
fog-google-1.23.0 lib/fog/compute/google/requests/set_server_metadata.rb
fog-google-1.22.0 lib/fog/compute/google/requests/set_server_metadata.rb
fog-google-1.21.1 lib/fog/compute/google/requests/set_server_metadata.rb
fog-google-1.21.0 lib/fog/compute/google/requests/set_server_metadata.rb
fog-google-1.20.0 lib/fog/compute/google/requests/set_server_metadata.rb
fog-google-1.19.0 lib/fog/compute/google/requests/set_server_metadata.rb
fog-google-1.18.0 lib/fog/compute/google/requests/set_server_metadata.rb
fog-google-1.17.0 lib/fog/compute/google/requests/set_server_metadata.rb
fog-google-1.16.1 lib/fog/compute/google/requests/set_server_metadata.rb
fog-google-1.16.0 lib/fog/compute/google/requests/set_server_metadata.rb
fog-google-1.15.0 lib/fog/compute/google/requests/set_server_metadata.rb
fog-google-1.14.0 lib/fog/compute/google/requests/set_server_metadata.rb