Package com.google.cloud
Class MonitoredResource
- java.lang.Object
-
- com.google.cloud.MonitoredResource
-
- All Implemented Interfaces:
Serializable
public final class MonitoredResource extends Object 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 aMonitoredResourceDescriptor
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 labelsinstance_id
andzone
to identify particular VM instances.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MonitoredResource.Builder
A builder forMonitoredResource
objects.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
static MonitoredResource
fromPb(com.google.api.MonitoredResource descriptorPb)
Map<String,String>
getLabels()
Returns the values for all the labels required by the corresponding monitored resource descriptor (seeMonitoredResourceDescriptor.getLabels()
.String
getType()
Returns the monitored resource type.int
hashCode()
static MonitoredResource.Builder
newBuilder(String type)
Returns a builder forMonitoredResource
objects given the resource's type.static MonitoredResource
of(String type, Map<String,String> labels)
Creates aMonitoredResource
object given the resource's type and labels.MonitoredResource.Builder
toBuilder()
Returns a builder for thisMonitoredResource
object.com.google.api.MonitoredResource
toPb()
String
toString()
-
-
-
Method Detail
-
getType
public String getType()
Returns the monitored resource type. This value must match the one ofMonitoredResourceDescriptor.getType()
of aMonitoredResourceDescriptor
object. For example, the typecloudsql_database
represent databases in Google Cloud SQL.
-
getLabels
public Map<String,String> getLabels()
Returns the values for all the labels required by the corresponding monitored resource descriptor (seeMonitoredResourceDescriptor.getLabels()
. For example, Google Compute Engine VM instances use the labelsinstance_id
andzone
.
-
toPb
public com.google.api.MonitoredResource toPb()
-
toBuilder
public MonitoredResource.Builder toBuilder()
Returns a builder for thisMonitoredResource
object.
-
newBuilder
public static MonitoredResource.Builder newBuilder(String type)
Returns a builder forMonitoredResource
objects given the resource's type.
-
of
public static MonitoredResource of(String type, Map<String,String> labels)
Creates aMonitoredResource
object given the resource's type and labels.
-
fromPb
public static MonitoredResource fromPb(com.google.api.MonitoredResource descriptorPb)
-
-