Class MonitoredResource (2.41.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
Name Description
descriptorPb com.google.api.MonitoredResource
Returns
Type Description
MonitoredResource

newBuilder(String type)

public static MonitoredResource.Builder newBuilder(String type)

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

Parameter
Name Description
type String
Returns
Type Description
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
Name Description
type String
labels Map<String,String>
Returns
Type Description
MonitoredResource

Methods

equals(Object obj)

public boolean equals(Object obj)
Parameter
Name Description
obj Object
Returns
Type Description
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
Type Description
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
Type Description
String

hashCode()

public int hashCode()
Returns
Type Description
int
Overrides

toBuilder()

public MonitoredResource.Builder toBuilder()

Returns a builder for this MonitoredResource object.

Returns
Type Description
MonitoredResource.Builder

toPb()

public MonitoredResource toPb()
Returns
Type Description
com.google.api.MonitoredResource

toString()

public String toString()
Returns
Type Description
String
Overrides