Class MonitoredResource.Builder (2.28.0)

public static class MonitoredResource.Builder

A builder for MonitoredResource objects.

Inheritance

java.lang.Object > MonitoredResource.Builder

Methods

addLabel(String key, String value)

public MonitoredResource.Builder addLabel(String key, String value)

Adds a label to the labels of the monitored resource.

Parameters
NameDescription
keyString
valueString
Returns
TypeDescription
MonitoredResource.Builder

build()

public MonitoredResource build()
Returns
TypeDescription
MonitoredResource

clearLabels()

public MonitoredResource.Builder clearLabels()

Clears all the labels of the monitored resource.

Returns
TypeDescription
MonitoredResource.Builder

setLabels(Map<String,String> labels)

public MonitoredResource.Builder setLabels(Map<String,String> labels)

Sets 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.

Parameter
NameDescription
labelsMap<String,String>
Returns
TypeDescription
MonitoredResource.Builder

setType(String type)

public MonitoredResource.Builder setType(String type)

Sets 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.

Parameter
NameDescription
typeString
Returns
TypeDescription
MonitoredResource.Builder