Method: Google::Cloud::Logging::Project#resource

Defined in:
lib/google/cloud/logging/project.rb

#resource(type, labels = {}) ⇒ Google::Cloud::Logging::Resource Also known as: new_resource

Creates a new monitored resource instance.

Examples:

require "google/cloud/logging"

logging = Google::Cloud::Logging.new

resource = logging.resource "gae_app",
                            "module_id" => "1",
                            "version_id" => "20150925t173233"

Parameters:

  • type (String)

    The type of resource, as represented by a ResourceDescriptor.

  • labels (Hash) (defaults to: {})

    A set of labels that can be used to describe instances of this monitored resource type.

Returns:



573
574
575
576
577
578
# File 'lib/google/cloud/logging/project.rb', line 573

def resource type, labels = {}
  Resource.new.tap do |r|
    r.type = type
    r.labels = labels
  end
end