Reference documentation and code samples for the Cloud Monitoring Dashboards V1 API class Google::Api::MonitoredResource.
An object representing a resource that can be used for monitoring, logging,
billing, or other purposes. Examples include virtual machine instances,
databases, and storage devices such as disks. The type field identifies a
MonitoredResourceDescriptor object
that describes the resource's schema. Information in the labels field
identifies the actual resource and its attributes according to the schema.
For example, a particular Compute Engine VM instance could be represented by
the following object, because the
MonitoredResourceDescriptor for
"gce_instance" has labels
"project_id", "instance_id" and "zone":
(::Google::Protobuf::Map{::String => ::String}) — Required. Values for all of the labels listed in the associated monitored
resource descriptor. For example, Compute Engine VM instances use the
labels "project_id", "instance_id", and "zone".
value (::Google::Protobuf::Map{::String => ::String}) — Required. Values for all of the labels listed in the associated monitored
resource descriptor. For example, Compute Engine VM instances use the
labels "project_id", "instance_id", and "zone".
Returns
(::Google::Protobuf::Map{::String => ::String}) — Required. Values for all of the labels listed in the associated monitored
resource descriptor. For example, Compute Engine VM instances use the
labels "project_id", "instance_id", and "zone".
#type
deftype()->::String
Returns
(::String) — Required. The monitored resource type. This field must match
the type field of a
MonitoredResourceDescriptor
object. For example, the type of a Compute Engine VM instance is
gce_instance. Some descriptors include the service name in the type; for
example, the type of a Datastream stream is
datastream.googleapis.com/Stream.
#type=
deftype=(value)->::String
Parameter
value (::String) — Required. The monitored resource type. This field must match
the type field of a
MonitoredResourceDescriptor
object. For example, the type of a Compute Engine VM instance is
gce_instance. Some descriptors include the service name in the type; for
example, the type of a Datastream stream is
datastream.googleapis.com/Stream.
Returns
(::String) — Required. The monitored resource type. This field must match
the type field of a
MonitoredResourceDescriptor
object. For example, the type of a Compute Engine VM instance is
gce_instance. Some descriptors include the service name in the type; for
example, the type of a Datastream stream is
datastream.googleapis.com/Stream.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[],[],null,["# Cloud Monitoring Dashboards V1 API - Class Google::Api::MonitoredResource (v1.3.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.3.0 (latest)](/ruby/docs/reference/google-cloud-monitoring-dashboard-v1/latest/Google-Api-MonitoredResource)\n- [1.2.1](/ruby/docs/reference/google-cloud-monitoring-dashboard-v1/1.2.1/Google-Api-MonitoredResource)\n- [1.1.0](/ruby/docs/reference/google-cloud-monitoring-dashboard-v1/1.1.0/Google-Api-MonitoredResource)\n- [1.0.1](/ruby/docs/reference/google-cloud-monitoring-dashboard-v1/1.0.1/Google-Api-MonitoredResource)\n- [0.16.0](/ruby/docs/reference/google-cloud-monitoring-dashboard-v1/0.16.0/Google-Api-MonitoredResource)\n- [0.15.0](/ruby/docs/reference/google-cloud-monitoring-dashboard-v1/0.15.0/Google-Api-MonitoredResource)\n- [0.14.2](/ruby/docs/reference/google-cloud-monitoring-dashboard-v1/0.14.2/Google-Api-MonitoredResource)\n- [0.13.0](/ruby/docs/reference/google-cloud-monitoring-dashboard-v1/0.13.0/Google-Api-MonitoredResource)\n- [0.12.1](/ruby/docs/reference/google-cloud-monitoring-dashboard-v1/0.12.1/Google-Api-MonitoredResource)\n- [0.11.0](/ruby/docs/reference/google-cloud-monitoring-dashboard-v1/0.11.0/Google-Api-MonitoredResource)\n- [0.10.0](/ruby/docs/reference/google-cloud-monitoring-dashboard-v1/0.10.0/Google-Api-MonitoredResource)\n- [0.9.1](/ruby/docs/reference/google-cloud-monitoring-dashboard-v1/0.9.1/Google-Api-MonitoredResource)\n- [0.8.0](/ruby/docs/reference/google-cloud-monitoring-dashboard-v1/0.8.0/Google-Api-MonitoredResource)\n- [0.7.0](/ruby/docs/reference/google-cloud-monitoring-dashboard-v1/0.7.0/Google-Api-MonitoredResource)\n- [0.6.6](/ruby/docs/reference/google-cloud-monitoring-dashboard-v1/0.6.6/Google-Api-MonitoredResource) \nReference documentation and code samples for the Cloud Monitoring Dashboards V1 API class Google::Api::MonitoredResource.\n\nAn object representing a resource that can be used for monitoring, logging,\nbilling, or other purposes. Examples include virtual machine instances,\ndatabases, and storage devices such as disks. The `type` field identifies a\n[MonitoredResourceDescriptor](/ruby/docs/reference/google-cloud-monitoring-dashboard-v1/latest/Google-Api-MonitoredResourceDescriptor \"Google::Api::MonitoredResourceDescriptor (class)\") object\nthat describes the resource's schema. Information in the `labels` field\nidentifies the actual resource and its attributes according to the schema.\nFor example, a particular Compute Engine VM instance could be represented by\nthe following object, because the\n[MonitoredResourceDescriptor](/ruby/docs/reference/google-cloud-monitoring-dashboard-v1/latest/Google-Api-MonitoredResourceDescriptor \"Google::Api::MonitoredResourceDescriptor (class)\") for\n`\"gce_instance\"` has labels\n`\"project_id\"`, `\"instance_id\"` and `\"zone\"`: \n\n { \"type\": \"gce_instance\",\n \"labels\": { \"project_id\": \"my-project\",\n \"instance_id\": \"12345678901234\",\n \"zone\": \"us-central1-a\" }}\n\nInherits\n--------\n\n- Object \n\nExtended By\n-----------\n\n- Google::Protobuf::MessageExts::ClassMethods \n\nIncludes\n--------\n\n- Google::Protobuf::MessageExts\n\nMethods\n-------\n\n### #labels\n\n def labels() -\u003e ::Google::Protobuf::Map{::String =\u003e ::String}\n\n**Returns**\n\n- (::Google::Protobuf::Map{::String =\\\u003e ::String}) --- Required. Values for all of the labels listed in the associated monitored resource descriptor. For example, Compute Engine VM instances use the labels `\"project_id\"`, `\"instance_id\"`, and `\"zone\"`.\n\n### #labels=\n\n def labels=(value) -\u003e ::Google::Protobuf::Map{::String =\u003e ::String}\n\n**Parameter**\n\n- **value** (::Google::Protobuf::Map{::String =\\\u003e ::String}) --- Required. Values for all of the labels listed in the associated monitored resource descriptor. For example, Compute Engine VM instances use the labels `\"project_id\"`, `\"instance_id\"`, and `\"zone\"`. \n**Returns**\n\n- (::Google::Protobuf::Map{::String =\\\u003e ::String}) --- Required. Values for all of the labels listed in the associated monitored resource descriptor. For example, Compute Engine VM instances use the labels `\"project_id\"`, `\"instance_id\"`, and `\"zone\"`.\n\n### #type\n\n def type() -\u003e ::String\n\n**Returns**\n\n- (::String) --- Required. The monitored resource type. This field must match the `type` field of a [MonitoredResourceDescriptor](/ruby/docs/reference/google-cloud-monitoring-dashboard-v1/latest/Google-Api-MonitoredResourceDescriptor \"Google::Api::MonitoredResourceDescriptor (class)\") object. For example, the type of a Compute Engine VM instance is `gce_instance`. Some descriptors include the service name in the type; for example, the type of a Datastream stream is `datastream.googleapis.com/Stream`.\n\n### #type=\n\n def type=(value) -\u003e ::String\n\n**Parameter**\n\n- **value** (::String) --- Required. The monitored resource type. This field must match the `type` field of a [MonitoredResourceDescriptor](/ruby/docs/reference/google-cloud-monitoring-dashboard-v1/latest/Google-Api-MonitoredResourceDescriptor \"Google::Api::MonitoredResourceDescriptor (class)\") object. For example, the type of a Compute Engine VM instance is `gce_instance`. Some descriptors include the service name in the type; for example, the type of a Datastream stream is `datastream.googleapis.com/Stream`. \n**Returns**\n\n- (::String) --- Required. The monitored resource type. This field must match the `type` field of a [MonitoredResourceDescriptor](/ruby/docs/reference/google-cloud-monitoring-dashboard-v1/latest/Google-Api-MonitoredResourceDescriptor \"Google::Api::MonitoredResourceDescriptor (class)\") object. For example, the type of a Compute Engine VM instance is `gce_instance`. Some descriptors include the service name in the type; for example, the type of a Datastream stream is `datastream.googleapis.com/Stream`."]]