Class MonitoredResource.Builder (2.9.1)

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 "instance_id" and "zone": { "type": "gce_instance", "labels": { "instance_id": "12345678901234", "zone": "us-central1-a" }}

Protobuf type google.api.MonitoredResource

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
TypeDescription
Descriptor

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public MonitoredResource.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
MonitoredResource.Builder
Overrides

build()

public MonitoredResource build()
Returns
TypeDescription
MonitoredResource

buildPartial()

public MonitoredResource buildPartial()
Returns
TypeDescription
MonitoredResource

clear()

public MonitoredResource.Builder clear()
Returns
TypeDescription
MonitoredResource.Builder
Overrides

clearField(Descriptors.FieldDescriptor field)

public MonitoredResource.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
NameDescription
fieldFieldDescriptor
Returns
TypeDescription
MonitoredResource.Builder
Overrides

clearLabels()

public MonitoredResource.Builder clearLabels()
Returns
TypeDescription
MonitoredResource.Builder

clearOneof(Descriptors.OneofDescriptor oneof)

public MonitoredResource.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
NameDescription
oneofOneofDescriptor
Returns
TypeDescription
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.

string type = 1;

Returns
TypeDescription
MonitoredResource.Builder

This builder for chaining.

clone()

public MonitoredResource.Builder clone()
Returns
TypeDescription
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
NameDescription
keyString
Returns
TypeDescription
boolean

getDefaultInstanceForType()

public MonitoredResource getDefaultInstanceForType()
Returns
TypeDescription
MonitoredResource

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
TypeDescription
Descriptor
Overrides

getLabels()

public Map<String,String> getLabels()

Use #getLabelsMap() instead.

Returns
TypeDescription
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
TypeDescription
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
TypeDescription
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
NameDescription
keyString
defaultValueString
Returns
TypeDescription
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
NameDescription
keyString
Returns
TypeDescription
String

getMutableLabels()

public Map<String,String> getMutableLabels()

Use alternate mutation accessors instead.

Returns
TypeDescription
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.

string type = 1;

Returns
TypeDescription
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.

string type = 1;

Returns
TypeDescription
ByteString

The bytes for type.

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

internalGetMapField(int number)

protected MapField internalGetMapField(int number)
Parameter
NameDescription
numberint
Returns
TypeDescription
MapField
Overrides

internalGetMutableMapField(int number)

protected MapField internalGetMutableMapField(int number)
Parameter
NameDescription
numberint
Returns
TypeDescription
MapField
Overrides

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
boolean
Overrides

mergeFrom(MonitoredResource other)

public MonitoredResource.Builder mergeFrom(MonitoredResource other)
Parameter
NameDescription
otherMonitoredResource
Returns
TypeDescription
MonitoredResource.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public MonitoredResource.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputCodedInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
MonitoredResource.Builder
Overrides Exceptions
TypeDescription
IOException

mergeFrom(Message other)

public MonitoredResource.Builder mergeFrom(Message other)
Parameter
NameDescription
otherMessage
Returns
TypeDescription
MonitoredResource.Builder
Overrides

mergeUnknownFields(UnknownFieldSet unknownFields)

public final MonitoredResource.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
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
NameDescription
valuesMap<String,String>
Returns
TypeDescription
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
NameDescription
keyString
valueString
Returns
TypeDescription
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
NameDescription
keyString
Returns
TypeDescription
MonitoredResource.Builder

setField(Descriptors.FieldDescriptor field, Object value)

public MonitoredResource.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
MonitoredResource.Builder
Overrides

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

public MonitoredResource.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
NameDescription
fieldFieldDescriptor
indexint
valueObject
Returns
TypeDescription
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.

string type = 1;

Parameter
NameDescription
valueString

The type to set.

Returns
TypeDescription
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.

string type = 1;

Parameter
NameDescription
valueByteString

The bytes for type to set.

Returns
TypeDescription
MonitoredResource.Builder

This builder for chaining.

setUnknownFields(UnknownFieldSet unknownFields)

public final MonitoredResource.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
MonitoredResource.Builder
Overrides