1// Copyright 2019 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//
15
16syntax = "proto3";
17
18package google.api;
19
20import "google/api/label.proto";
21import "google/api/launch_stage.proto";
22import "google/protobuf/struct.proto";
23
24option cc_enable_arenas = true;
25option go_package = "google.golang.org/genproto/googleapis/api/monitoredres;monitoredres";
26option java_multiple_files = true;
27option java_outer_classname = "MonitoredResourceProto";
28option java_package = "com.google.api";
29option objc_class_prefix = "GAPI";
30
31// An object that describes the schema of a [MonitoredResource][google.api.MonitoredResource] object using a
32// type name and a set of labels.  For example, the monitored resource
33// descriptor for 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.
40message MonitoredResourceDescriptor {
41  // Optional. The resource name of the monitored resource descriptor:
42  // `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where
43  // {type} is the value of the `type` field in this object and
44  // {project_id} is a project ID that provides API-specific context for
45  // accessing the type.  APIs that do not use project information can use the
46  // resource name format `"monitoredResourceDescriptors/{type}"`.
47  string name = 5;
48
49  // Required. The monitored resource type. For example, the type
50  // `"cloudsql_database"` represents databases in Google Cloud SQL.
51  // The maximum length of this value is 256 characters.
52  string type = 1;
53
54  // Optional. A concise name for the monitored resource type that might be
55  // displayed in user interfaces. It should be a Title Cased Noun Phrase,
56  // without any article or other determiners. For example,
57  // `"Google Cloud SQL Database"`.
58  string display_name = 2;
59
60  // Optional. A detailed description of the monitored resource type that might
61  // be used in documentation.
62  string description = 3;
63
64  // Required. A set of labels used to describe instances of this monitored
65  // resource type. For example, an individual Google Cloud SQL database is
66  // identified by values for the labels `"database_id"` and `"zone"`.
67  repeated LabelDescriptor labels = 4;
68
69  // Optional. The launch stage of the monitored resource definition.
70  LaunchStage launch_stage = 7;
71}
72
73// An object representing a resource that can be used for monitoring, logging,
74// billing, or other purposes. Examples include virtual machine instances,
75// databases, and storage devices such as disks. The `type` field identifies a
76// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object that describes the resource's
77// schema. Information in the `labels` field identifies the actual resource and
78// its attributes according to the schema. For example, a particular Compute
79// Engine VM instance could be represented by the following object, because the
80// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] for `"gce_instance"` has labels
81// `"instance_id"` and `"zone"`:
82//
83//     { "type": "gce_instance",
84//       "labels": { "instance_id": "12345678901234",
85//                   "zone": "us-central1-a" }}
86message MonitoredResource {
87  // Required. The monitored resource type. This field must match
88  // the `type` field of a [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object. For
89  // example, the type of a Compute Engine VM instance is `gce_instance`.
90  string type = 1;
91
92  // Required. Values for all of the labels listed in the associated monitored
93  // resource descriptor. For example, Compute Engine VM instances use the
94  // labels `"project_id"`, `"instance_id"`, and `"zone"`.
95  map<string, string> labels = 2;
96}
97
98// Auxiliary metadata for a [MonitoredResource][google.api.MonitoredResource] object.
99// [MonitoredResource][google.api.MonitoredResource] objects contain the minimum set of information to
100// uniquely identify a monitored resource instance. There is some other useful
101// auxiliary metadata. Monitoring and Logging use an ingestion
102// pipeline to extract metadata for cloud resources of all types, and store
103// the metadata in this message.
104message MonitoredResourceMetadata {
105  // Output only. Values for predefined system metadata labels.
106  // System labels are a kind of metadata extracted by Google, including
107  // "machine_image", "vpc", "subnet_id",
108  // "security_group", "name", etc.
109  // System label values can be only strings, Boolean values, or a list of
110  // strings. For example:
111  //
112  //     { "name": "my-test-instance",
113  //       "security_group": ["a", "b", "c"],
114  //       "spot_instance": false }
115  google.protobuf.Struct system_labels = 1;
116
117  // Output only. A map of user-defined metadata labels.
118  map<string, string> user_labels = 2;
119}
120