xref: /aosp_15_r20/external/googleapis/google/api/monitored_resource.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package google.api;
18
19import "google/api/label.proto";
20import "google/api/launch_stage.proto";
21import "google/protobuf/struct.proto";
22
23option cc_enable_arenas = true;
24option go_package = "google.golang.org/genproto/googleapis/api/monitoredres;monitoredres";
25option java_multiple_files = true;
26option java_outer_classname = "MonitoredResourceProto";
27option java_package = "com.google.api";
28option objc_class_prefix = "GAPI";
29
30// An object that describes the schema of a
31// [MonitoredResource][google.api.MonitoredResource] object using a type name
32// and a set of labels.  For example, the monitored resource descriptor for
33// Google Compute Engine VM instances has a type of
34// `"gce_instance"` and specifies the use of the labels `"instance_id"` and
35// `"zone"` to identify particular VM instances.
36//
37// Different APIs can support different monitored resource types. APIs generally
38// provide a `list` method that returns the monitored resource descriptors used
39// by the API.
40//
41message MonitoredResourceDescriptor {
42  // Optional. The resource name of the monitored resource descriptor:
43  // `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where
44  // {type} is the value of the `type` field in this object and
45  // {project_id} is a project ID that provides API-specific context for
46  // accessing the type.  APIs that do not use project information can use the
47  // resource name format `"monitoredResourceDescriptors/{type}"`.
48  string name = 5;
49
50  // Required. The monitored resource type. For example, the type
51  // `"cloudsql_database"` represents databases in Google Cloud SQL.
52  //  For a list of types, see [Monitored resource
53  //  types](https://cloud.google.com/monitoring/api/resources)
54  // and [Logging resource
55  // types](https://cloud.google.com/logging/docs/api/v2/resource-list).
56  string type = 1;
57
58  // Optional. A concise name for the monitored resource type that might be
59  // displayed in user interfaces. It should be a Title Cased Noun Phrase,
60  // without any article or other determiners. For example,
61  // `"Google Cloud SQL Database"`.
62  string display_name = 2;
63
64  // Optional. A detailed description of the monitored resource type that might
65  // be used in documentation.
66  string description = 3;
67
68  // Required. A set of labels used to describe instances of this monitored
69  // resource type. For example, an individual Google Cloud SQL database is
70  // identified by values for the labels `"database_id"` and `"zone"`.
71  repeated LabelDescriptor labels = 4;
72
73  // Optional. The launch stage of the monitored resource definition.
74  LaunchStage launch_stage = 7;
75}
76
77// An object representing a resource that can be used for monitoring, logging,
78// billing, or other purposes. Examples include virtual machine instances,
79// databases, and storage devices such as disks. The `type` field identifies a
80// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object
81// that describes the resource's schema. Information in the `labels` field
82// identifies the actual resource and its attributes according to the schema.
83// For example, a particular Compute Engine VM instance could be represented by
84// the following object, because the
85// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] for
86// `"gce_instance"` has labels
87// `"project_id"`, `"instance_id"` and `"zone"`:
88//
89//     { "type": "gce_instance",
90//       "labels": { "project_id": "my-project",
91//                   "instance_id": "12345678901234",
92//                   "zone": "us-central1-a" }}
93message MonitoredResource {
94  // Required. The monitored resource type. This field must match
95  // the `type` field of a
96  // [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor]
97  // object. For example, the type of a Compute Engine VM instance is
98  // `gce_instance`. Some descriptors include the service name in the type; for
99  // example, the type of a Datastream stream is
100  // `datastream.googleapis.com/Stream`.
101  string type = 1;
102
103  // Required. Values for all of the labels listed in the associated monitored
104  // resource descriptor. For example, Compute Engine VM instances use the
105  // labels `"project_id"`, `"instance_id"`, and `"zone"`.
106  map<string, string> labels = 2;
107}
108
109// Auxiliary metadata for a [MonitoredResource][google.api.MonitoredResource]
110// object. [MonitoredResource][google.api.MonitoredResource] objects contain the
111// minimum set of information to uniquely identify a monitored resource
112// instance. There is some other useful auxiliary metadata. Monitoring and
113// Logging use an ingestion pipeline to extract metadata for cloud resources of
114// all types, and store the metadata in this message.
115message MonitoredResourceMetadata {
116  // Output only. Values for predefined system metadata labels.
117  // System labels are a kind of metadata extracted by Google, including
118  // "machine_image", "vpc", "subnet_id",
119  // "security_group", "name", etc.
120  // System label values can be only strings, Boolean values, or a list of
121  // strings. For example:
122  //
123  //     { "name": "my-test-instance",
124  //       "security_group": ["a", "b", "c"],
125  //       "spot_instance": false }
126  google.protobuf.Struct system_labels = 1;
127
128  // Output only. A map of user-defined metadata labels.
129  map<string, string> user_labels = 2;
130}
131