Class MonitoredResource (2.25.0)

public final class MonitoredResource implements Serializable

Objects of this class represent 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, the monitored resource for Google Compute Engine VM instances has gce_instance type and specifies values for the labels instance_id and zone to identify particular VM instances.

Inheritance

Object > MonitoredResource

Implements

Serializable

Static Methods

fromPb(MonitoredResource descriptorPb)

public static MonitoredResource fromPb(MonitoredResource descriptorPb)
Parameter
NameDescription
descriptorPbcom.google.api.MonitoredResource
Returns
TypeDescription
MonitoredResource

newBuilder(String type)

public static MonitoredResource.Builder newBuilder(String type)

Returns a builder for MonitoredResource objects given the resource's type.

Parameter
NameDescription
typeString
Returns
TypeDescription
MonitoredResource.Builder

of(String type, Map<String,String> labels)

public static MonitoredResource of(String type, Map<String,String> labels)

Creates a MonitoredResource object given the resource's type and labels.

Parameters
NameDescription
typeString
labelsMap<String,String>
Returns
TypeDescription
MonitoredResource

Methods

equals(Object obj)

public boolean equals(Object obj)
Parameter
NameDescription
objObject
Returns
TypeDescription
boolean
Overrides

getLabels()

public Map<String,String> getLabels()

Returns the values for all the labels required by the corresponding monitored resource descriptor (see MonitoredResourceDescriptor#getLabels(). For example, Google Compute Engine VM instances use the labels instance_id and zone.

Returns
TypeDescription
Map<String,String>

getType()

public String getType()

Returns the monitored resource type. This value must match the one of MonitoredResourceDescriptor#getType() of a MonitoredResourceDescriptor object. For example, the type cloudsql_database represent databases in Google Cloud SQL.

Returns
TypeDescription
String

hashCode()

public int hashCode()
Returns
TypeDescription
int
Overrides

toBuilder()

public MonitoredResource.Builder toBuilder()

Returns a builder for this MonitoredResource object.

Returns
TypeDescription
MonitoredResource.Builder

toPb()

public MonitoredResource toPb()
Returns
TypeDescription
com.google.api.MonitoredResource

toString()

public String toString()
Returns
TypeDescription
String
Overrides