xref: /aosp_15_r20/external/googleapis/google/monitoring/v3/group_service.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.monitoring.v3;
18
19import "google/api/annotations.proto";
20import "google/api/client.proto";
21import "google/api/field_behavior.proto";
22import "google/api/monitored_resource.proto";
23import "google/api/resource.proto";
24import "google/monitoring/v3/common.proto";
25import "google/monitoring/v3/group.proto";
26import "google/protobuf/empty.proto";
27
28option csharp_namespace = "Google.Cloud.Monitoring.V3";
29option go_package = "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpb";
30option java_multiple_files = true;
31option java_outer_classname = "GroupServiceProto";
32option java_package = "com.google.monitoring.v3";
33option php_namespace = "Google\\Cloud\\Monitoring\\V3";
34option ruby_package = "Google::Cloud::Monitoring::V3";
35
36// The Group API lets you inspect and manage your
37// [groups](#google.monitoring.v3.Group).
38//
39// A group is a named filter that is used to identify
40// a collection of monitored resources. Groups are typically used to
41// mirror the physical and/or logical topology of the environment.
42// Because group membership is computed dynamically, monitored
43// resources that are started in the future are automatically placed
44// in matching groups. By using a group to name monitored resources in,
45// for example, an alert policy, the target of that alert policy is
46// updated automatically as monitored resources are added and removed
47// from the infrastructure.
48service GroupService {
49  option (google.api.default_host) = "monitoring.googleapis.com";
50  option (google.api.oauth_scopes) =
51      "https://www.googleapis.com/auth/cloud-platform,"
52      "https://www.googleapis.com/auth/monitoring,"
53      "https://www.googleapis.com/auth/monitoring.read";
54
55  // Lists the existing groups.
56  rpc ListGroups(ListGroupsRequest) returns (ListGroupsResponse) {
57    option (google.api.http) = {
58      get: "/v3/{name=projects/*}/groups"
59    };
60    option (google.api.method_signature) = "name";
61  }
62
63  // Gets a single group.
64  rpc GetGroup(GetGroupRequest) returns (Group) {
65    option (google.api.http) = {
66      get: "/v3/{name=projects/*/groups/*}"
67    };
68    option (google.api.method_signature) = "name";
69  }
70
71  // Creates a new group.
72  rpc CreateGroup(CreateGroupRequest) returns (Group) {
73    option (google.api.http) = {
74      post: "/v3/{name=projects/*}/groups"
75      body: "group"
76    };
77    option (google.api.method_signature) = "name,group";
78  }
79
80  // Updates an existing group.
81  // You can change any group attributes except `name`.
82  rpc UpdateGroup(UpdateGroupRequest) returns (Group) {
83    option (google.api.http) = {
84      put: "/v3/{group.name=projects/*/groups/*}"
85      body: "group"
86    };
87    option (google.api.method_signature) = "group";
88  }
89
90  // Deletes an existing group.
91  rpc DeleteGroup(DeleteGroupRequest) returns (google.protobuf.Empty) {
92    option (google.api.http) = {
93      delete: "/v3/{name=projects/*/groups/*}"
94    };
95    option (google.api.method_signature) = "name";
96  }
97
98  // Lists the monitored resources that are members of a group.
99  rpc ListGroupMembers(ListGroupMembersRequest)
100      returns (ListGroupMembersResponse) {
101    option (google.api.http) = {
102      get: "/v3/{name=projects/*/groups/*}/members"
103    };
104    option (google.api.method_signature) = "name";
105  }
106}
107
108// The `ListGroup` request.
109message ListGroupsRequest {
110  // Required. The
111  // [project](https://cloud.google.com/monitoring/api/v3#project_name) whose
112  // groups are to be listed. The format is:
113  //
114  //     projects/[PROJECT_ID_OR_NUMBER]
115  string name = 7 [
116    (google.api.field_behavior) = REQUIRED,
117    (google.api.resource_reference) = {
118      child_type: "monitoring.googleapis.com/Group"
119    }
120  ];
121
122  // An optional filter consisting of a single group name.  The filters limit
123  // the groups returned based on their parent-child relationship with the
124  // specified group. If no filter is specified, all groups are returned.
125  oneof filter {
126    // A group name. The format is:
127    //
128    //     projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
129    //
130    // Returns groups whose `parent_name` field contains the group
131    // name.  If no groups have this parent, the results are empty.
132    string children_of_group = 2 [(google.api.resource_reference) = {
133      type: "monitoring.googleapis.com/Group"
134    }];
135
136    // A group name. The format is:
137    //
138    //     projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
139    //
140    // Returns groups that are ancestors of the specified group.
141    // The groups are returned in order, starting with the immediate parent and
142    // ending with the most distant ancestor.  If the specified group has no
143    // immediate parent, the results are empty.
144    string ancestors_of_group = 3 [(google.api.resource_reference) = {
145      type: "monitoring.googleapis.com/Group"
146    }];
147
148    // A group name. The format is:
149    //
150    //     projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
151    //
152    // Returns the descendants of the specified group.  This is a superset of
153    // the results returned by the `children_of_group` filter, and includes
154    // children-of-children, and so forth.
155    string descendants_of_group = 4 [(google.api.resource_reference) = {
156      type: "monitoring.googleapis.com/Group"
157    }];
158  }
159
160  // A positive number that is the maximum number of results to return.
161  int32 page_size = 5;
162
163  // If this field is not empty then it must contain the `next_page_token` value
164  // returned by a previous call to this method.  Using this field causes the
165  // method to return additional results from the previous method call.
166  string page_token = 6;
167}
168
169// The `ListGroups` response.
170message ListGroupsResponse {
171  // The groups that match the specified filters.
172  repeated Group group = 1;
173
174  // If there are more results than have been returned, then this field is set
175  // to a non-empty value.  To see the additional results,
176  // use that value as `page_token` in the next call to this method.
177  string next_page_token = 2;
178}
179
180// The `GetGroup` request.
181message GetGroupRequest {
182  // Required. The group to retrieve. The format is:
183  //
184  //     projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
185  string name = 3 [
186    (google.api.field_behavior) = REQUIRED,
187    (google.api.resource_reference) = {
188      type: "monitoring.googleapis.com/Group"
189    }
190  ];
191}
192
193// The `CreateGroup` request.
194message CreateGroupRequest {
195  // Required. The
196  // [project](https://cloud.google.com/monitoring/api/v3#project_name) in which
197  // to create the group. The format is:
198  //
199  //     projects/[PROJECT_ID_OR_NUMBER]
200  string name = 4 [
201    (google.api.field_behavior) = REQUIRED,
202    (google.api.resource_reference) = {
203      child_type: "monitoring.googleapis.com/Group"
204    }
205  ];
206
207  // Required. A group definition. It is an error to define the `name` field
208  // because the system assigns the name.
209  Group group = 2 [(google.api.field_behavior) = REQUIRED];
210
211  // If true, validate this request but do not create the group.
212  bool validate_only = 3;
213}
214
215// The `UpdateGroup` request.
216message UpdateGroupRequest {
217  // Required. The new definition of the group.  All fields of the existing
218  // group, excepting `name`, are replaced with the corresponding fields of this
219  // group.
220  Group group = 2 [(google.api.field_behavior) = REQUIRED];
221
222  // If true, validate this request but do not update the existing group.
223  bool validate_only = 3;
224}
225
226// The `DeleteGroup` request. The default behavior is to be able to delete a
227// single group without any descendants.
228message DeleteGroupRequest {
229  // Required. The group to delete. The format is:
230  //
231  //     projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
232  string name = 3 [
233    (google.api.field_behavior) = REQUIRED,
234    (google.api.resource_reference) = {
235      type: "monitoring.googleapis.com/Group"
236    }
237  ];
238
239  // If this field is true, then the request means to delete a group with all
240  // its descendants. Otherwise, the request means to delete a group only when
241  // it has no descendants. The default value is false.
242  bool recursive = 4;
243}
244
245// The `ListGroupMembers` request.
246message ListGroupMembersRequest {
247  // Required. The group whose members are listed. The format is:
248  //
249  //     projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
250  string name = 7 [
251    (google.api.field_behavior) = REQUIRED,
252    (google.api.resource_reference) = {
253      type: "monitoring.googleapis.com/Group"
254    }
255  ];
256
257  // A positive number that is the maximum number of results to return.
258  int32 page_size = 3;
259
260  // If this field is not empty then it must contain the `next_page_token` value
261  // returned by a previous call to this method.  Using this field causes the
262  // method to return additional results from the previous method call.
263  string page_token = 4;
264
265  // An optional [list
266  // filter](https://cloud.google.com/monitoring/api/learn_more#filtering)
267  // describing the members to be returned.  The filter may reference the type,
268  // labels, and metadata of monitored resources that comprise the group. For
269  // example, to return only resources representing Compute Engine VM instances,
270  // use this filter:
271  //
272  //     `resource.type = "gce_instance"`
273  string filter = 5;
274
275  // An optional time interval for which results should be returned. Only
276  // members that were part of the group during the specified interval are
277  // included in the response.  If no interval is provided then the group
278  // membership over the last minute is returned.
279  TimeInterval interval = 6;
280}
281
282// The `ListGroupMembers` response.
283message ListGroupMembersResponse {
284  // A set of monitored resources in the group.
285  repeated google.api.MonitoredResource members = 1;
286
287  // If there are more results than have been returned, then this field is
288  // set to a non-empty value.  To see the additional results, use that value as
289  // `page_token` in the next call to this method.
290  string next_page_token = 2;
291
292  // The total number of elements matching this request.
293  int32 total_size = 3;
294}
295