Class MonitoredResource.Builder (2.48.0)

public static final class MonitoredResource.Builder extends GeneratedMessageV3.Builder<MonitoredResource.Builder> implements MonitoredResourceOrBuilder

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. 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, a particular Compute Engine VM instance could be represented by the following object, because the MonitoredResourceDescriptor for "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" }}

Protobuf type google.api.MonitoredResource

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
Descriptor

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public MonitoredResource.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
MonitoredResource.Builder
Overrides

build()

public MonitoredResource build()
Returns
Type Description
MonitoredResource

buildPartial()

public MonitoredResource buildPartial()
Returns
Type Description
MonitoredResource

clear()

public MonitoredResource.Builder clear()
Returns
Type Description
MonitoredResource.Builder
Overrides

clearField(Descriptors.FieldDescriptor field)

public MonitoredResource.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
Name Description
field FieldDescriptor
Returns
Type Description
MonitoredResource.Builder
Overrides

clearLabels()

public MonitoredResource.Builder clearLabels()
Returns
Type Description
MonitoredResource.Builder

clearOneof(Descriptors.OneofDescriptor oneof)

public MonitoredResource.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
Name Description
oneof OneofDescriptor
Returns
Type Description
MonitoredResource.Builder
Overrides

clearType()

public MonitoredResource.Builder clearType()

Required. The monitored resource type. This field must match the type field of a MonitoredResourceDescriptor object. For example, the type of a Compute Engine VM instance is gce_instance. Some descriptors include the service name in the type; for example, the type of a Datastream stream is datastream.googleapis.com/Stream.

string type = 1;

Returns
Type Description
MonitoredResource.Builder

This builder for chaining.

clone()

public MonitoredResource.Builder clone()
Returns
Type Description
MonitoredResource.Builder
Overrides

containsLabels(String key)

public boolean containsLabels(String key)

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

map<string, string> labels = 2;

Parameter
Name Description
key String
Returns
Type Description
boolean

getDefaultInstanceForType()

public MonitoredResource getDefaultInstanceForType()
Returns
Type Description
MonitoredResource

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
Type Description
Descriptor
Overrides

getLabels() (deprecated)

public Map<String,String> getLabels()

Use #getLabelsMap() instead.

Returns
Type Description
Map<String,String>

getLabelsCount()

public int getLabelsCount()

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

map<string, string> labels = 2;

Returns
Type Description
int

getLabelsMap()

public Map<String,String> getLabelsMap()

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

map<string, string> labels = 2;

Returns
Type Description
Map<String,String>

getLabelsOrDefault(String key, String defaultValue)

public String getLabelsOrDefault(String key, String defaultValue)

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

map<string, string> labels = 2;

Parameters
Name Description
key String
defaultValue String
Returns
Type Description
String

getLabelsOrThrow(String key)

public String getLabelsOrThrow(String key)

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

map<string, string> labels = 2;

Parameter
Name Description
key String
Returns
Type Description
String

getMutableLabels() (deprecated)

public Map<String,String> getMutableLabels()

Use alternate mutation accessors instead.

Returns
Type Description
Map<String,String>

getType()

public String getType()

Required. The monitored resource type. This field must match the type field of a MonitoredResourceDescriptor object. For example, the type of a Compute Engine VM instance is gce_instance. Some descriptors include the service name in the type; for example, the type of a Datastream stream is datastream.googleapis.com/Stream.

string type = 1;

Returns
Type Description
String

The type.

getTypeBytes()

public ByteString getTypeBytes()

Required. The monitored resource type. This field must match the type field of a MonitoredResourceDescriptor object. For example, the type of a Compute Engine VM instance is gce_instance. Some descriptors include the service name in the type; for example, the type of a Datastream stream is datastream.googleapis.com/Stream.

string type = 1;

Returns
Type Description
ByteString

The bytes for type.

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

internalGetMapFieldReflection(int number)

protected MapFieldReflectionAccessor internalGetMapFieldReflection(int number)
Parameter
Name Description
number int
Returns
Type Description
com.google.protobuf.MapFieldReflectionAccessor
Overrides
com.google.protobuf.GeneratedMessageV3.Builder.internalGetMapFieldReflection(int)

internalGetMutableMapFieldReflection(int number)

protected MapFieldReflectionAccessor internalGetMutableMapFieldReflection(int number)
Parameter
Name Description
number int
Returns
Type Description
com.google.protobuf.MapFieldReflectionAccessor
Overrides
com.google.protobuf.GeneratedMessageV3.Builder.internalGetMutableMapFieldReflection(int)

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

mergeFrom(MonitoredResource other)

public MonitoredResource.Builder mergeFrom(MonitoredResource other)
Parameter
Name Description
other MonitoredResource
Returns
Type Description
MonitoredResource.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public MonitoredResource.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
MonitoredResource.Builder
Overrides
Exceptions
Type Description
IOException

mergeFrom(Message other)

public MonitoredResource.Builder mergeFrom(Message other)
Parameter
Name Description
other Message
Returns
Type Description
MonitoredResource.Builder
Overrides

mergeUnknownFields(UnknownFieldSet unknownFields)

public final MonitoredResource.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
MonitoredResource.Builder
Overrides

putAllLabels(Map<String,String> values)

public MonitoredResource.Builder putAllLabels(Map<String,String> values)

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

map<string, string> labels = 2;

Parameter
Name Description
values Map<String,String>
Returns
Type Description
MonitoredResource.Builder

putLabels(String key, String value)

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

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

map<string, string> labels = 2;

Parameters
Name Description
key String
value String
Returns
Type Description
MonitoredResource.Builder

removeLabels(String key)

public MonitoredResource.Builder removeLabels(String key)

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

map<string, string> labels = 2;

Parameter
Name Description
key String
Returns
Type Description
MonitoredResource.Builder

setField(Descriptors.FieldDescriptor field, Object value)

public MonitoredResource.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
MonitoredResource.Builder
Overrides

setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)

public MonitoredResource.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
Name Description
field FieldDescriptor
index int
value Object
Returns
Type Description
MonitoredResource.Builder
Overrides

setType(String value)

public MonitoredResource.Builder setType(String value)

Required. The monitored resource type. This field must match the type field of a MonitoredResourceDescriptor object. For example, the type of a Compute Engine VM instance is gce_instance. Some descriptors include the service name in the type; for example, the type of a Datastream stream is datastream.googleapis.com/Stream.

string type = 1;

Parameter
Name Description
value String

The type to set.

Returns
Type Description
MonitoredResource.Builder

This builder for chaining.

setTypeBytes(ByteString value)

public MonitoredResource.Builder setTypeBytes(ByteString value)

Required. The monitored resource type. This field must match the type field of a MonitoredResourceDescriptor object. For example, the type of a Compute Engine VM instance is gce_instance. Some descriptors include the service name in the type; for example, the type of a Datastream stream is datastream.googleapis.com/Stream.

string type = 1;

Parameter
Name Description
value ByteString

The bytes for type to set.

Returns
Type Description
MonitoredResource.Builder

This builder for chaining.

setUnknownFields(UnknownFieldSet unknownFields)

public final MonitoredResource.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
MonitoredResource.Builder
Overrides