class Google::Cloud::Logging::ResourceDescriptor
Describes a type of monitored resource supported by Stackdriver Logging
. Each ResourceDescriptor
has a type name, such as `cloudsql_database`, `gae_app`, or `gce_instance`. It also specifies a set of labels that must all be given values in a {Resource} instance to represent an actual instance of the type.
ResourceDescriptor
instances are read-only. You cannot create your own instances, but you can list them with {Project#resource_descriptors}.
@example
require "google/cloud/logging" logging = Google::Cloud::Logging.new resource_descriptor = logging.resource_descriptors.first resource_descriptor.type #=> "cloudsql_database" resource_descriptor.name #=> "Cloud SQL Database" resource_descriptor.labels.map &:key #=> ["database_id", "zone"]
Attributes
A detailed description of the monitored resource type, which is used in documentation.
A set of definitions of the labels that can be used to describe instances of this monitored resource type. For example, Cloud
SQL databases must be labeled with their `database_id` and their `region`.
@return [Array<LabelDescriptor>]
A display name for the monitored resource type. For example, `Cloud SQL Database`.
The monitored resource type. For example, `cloudsql_database`.
Public Class Methods
@private New ResourceDescriptor
from a Google::Api::MonitoredResourceDescriptor object.
# File lib/google/cloud/logging/resource_descriptor.rb, line 75 def self.from_grpc grpc labels = Array(grpc.labels).map do |g| LabelDescriptor.from_grpc g end new.tap do |r| r.instance_variable_set :@type, grpc.type r.instance_variable_set :@name, grpc.display_name r.instance_variable_set :@description, grpc.description r.instance_variable_set :@labels, labels end end
@private New ResourceDescriptor
from a Google
API Client object.
# File lib/google/cloud/logging/resource_descriptor.rb, line 45 def initialize @labels = [] end