Class MonitoredResource.Builder (2.40.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
Name Description
key String
value String
Returns
Type Description
MonitoredResource.Builder

build()

public MonitoredResource build()
Returns
Type Description
MonitoredResource

clearLabels()

public MonitoredResource.Builder clearLabels()

Clears all the labels of the monitored resource.

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