Reference documentation and code samples for the Google API Common Protos Client class 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. Thetypefield identifies aMonitoredResourceDescriptorobject
that describes the resource's schema. Information in thelabelsfield
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 theMonitoredResourceDescriptorfor"gce_instance"has labels"project_id","instance_id"and"zone":
{ "type": "gce_instance",
"labels": { "project_id": "my-project",
"instance_id": "12345678901234",
"zone": "us-central1-a" }}
Generated from protobuf messagegoogle.api.MonitoredResource
Namespace
Google \ Api
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ type
string
Required. The monitored resource type. This field must match thetypefield of aMonitoredResourceDescriptorobject. For example, the type of a Compute Engine VM instance isgce_instance. Some descriptors include the service name in the type; for example, the type of a Datastream stream isdatastream.googleapis.com/Stream.
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".
getType
Required. The monitored resource type. This field must match
thetypefield of aMonitoredResourceDescriptorobject. For example, the type of a Compute Engine VM instance isgce_instance. Some descriptors include the service name in the type; for
example, the type of a Datastream stream isdatastream.googleapis.com/Stream.
Returns
Type
Description
string
setType
Required. The monitored resource type. This field must match
thetypefield of aMonitoredResourceDescriptorobject. For example, the type of a Compute Engine VM instance isgce_instance. Some descriptors include the service name in the type; for
example, the type of a Datastream stream isdatastream.googleapis.com/Stream.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getLabels
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".
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".
[[["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-09-04 UTC."],[],[],null,["# Google API Common Protos Client - Class MonitoredResource (4.12.3)\n\nVersion latestkeyboard_arrow_down\n\n- [4.12.3 (latest)](/php/docs/reference/common-protos/latest/Api.MonitoredResource)\n- [4.12.2](/php/docs/reference/common-protos/4.12.2/Api.MonitoredResource)\n- [4.11.0](/php/docs/reference/common-protos/4.11.0/Api.MonitoredResource)\n- [4.10.0](/php/docs/reference/common-protos/4.10.0/Api.MonitoredResource)\n- [4.9.0](/php/docs/reference/common-protos/4.9.0/Api.MonitoredResource)\n- [4.8.3](/php/docs/reference/common-protos/4.8.3/Api.MonitoredResource) \nReference documentation and code samples for the Google API Common Protos Client class 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](/php/docs/reference/common-protos/latest/Api.MonitoredResourceDescriptor) object\nthat describes the resource's schema. Information in the `labels` field\nidentifies the actual resource and its attributes according to the schema.\n\nFor example, a particular Compute Engine VM instance could be represented by\nthe following object, because the\n[MonitoredResourceDescriptor](/php/docs/reference/common-protos/latest/Api.MonitoredResourceDescriptor) for\n`\"gce_instance\"` has labels\n`\"project_id\"`, `\"instance_id\"` and `\"zone\"`:\n{ \"type\": \"gce_instance\",\n\"labels\": { \"project_id\": \"my-project\",\n\"instance_id\": \"12345678901234\",\n\"zone\": \"us-central1-a\" }}\n\nGenerated from protobuf message `google.api.MonitoredResource`\n\nNamespace\n---------\n\nGoogle \\\\ Api\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getType\n\nRequired. The monitored resource type. This field must match\nthe `type` field of a\n[MonitoredResourceDescriptor](/php/docs/reference/common-protos/latest/Api.MonitoredResourceDescriptor)\nobject. For example, the type of a Compute Engine VM instance is\n`gce_instance`. Some descriptors include the service name in the type; for\nexample, the type of a Datastream stream is\n`datastream.googleapis.com/Stream`.\n\n### setType\n\nRequired. The monitored resource type. This field must match\nthe `type` field of a\n[MonitoredResourceDescriptor](/php/docs/reference/common-protos/latest/Api.MonitoredResourceDescriptor)\nobject. For example, the type of a Compute Engine VM instance is\n`gce_instance`. Some descriptors include the service name in the type; for\nexample, the type of a Datastream stream is\n`datastream.googleapis.com/Stream`.\n\n### getLabels\n\nRequired. Values for all of the labels listed in the associated monitored\nresource descriptor. For example, Compute Engine VM instances use the\nlabels `\"project_id\"`, `\"instance_id\"`, and `\"zone\"`.\n\n### setLabels\n\nRequired. Values for all of the labels listed in the associated monitored\nresource descriptor. For example, Compute Engine VM instances use the\nlabels `\"project_id\"`, `\"instance_id\"`, and `\"zone\"`."]]