Sha256: 4142fe442fb12c57eaa8d33bfcbde0d458dea83433fab735911fc0820e204e6a

Contents?: true

Size: 1.22 KB

Versions: 10

Compression:

Stored size: 1.22 KB

Contents

module Fog
  module Compute
    class Google
      class Mock
        def set_server_metadata(_instance, _zone, _fingerprint, _metadata_items = {})
          Fog::Mock.not_implemented
        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
        #
        # @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

10 entries across 10 versions & 1 rubygems

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