xref: /aosp_15_r20/external/googleapis/google/monitoring/v3/notification_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/resource.proto";
23import "google/monitoring/v3/notification.proto";
24import "google/protobuf/empty.proto";
25import "google/protobuf/field_mask.proto";
26import "google/protobuf/timestamp.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 = "NotificationServiceProto";
32option java_package = "com.google.monitoring.v3";
33option php_namespace = "Google\\Cloud\\Monitoring\\V3";
34option ruby_package = "Google::Cloud::Monitoring::V3";
35
36// The Notification Channel API provides access to configuration that
37// controls how messages related to incidents are sent.
38service NotificationChannelService {
39  option (google.api.default_host) = "monitoring.googleapis.com";
40  option (google.api.oauth_scopes) =
41      "https://www.googleapis.com/auth/cloud-platform,"
42      "https://www.googleapis.com/auth/monitoring,"
43      "https://www.googleapis.com/auth/monitoring.read";
44
45  // Lists the descriptors for supported channel types. The use of descriptors
46  // makes it possible for new channel types to be dynamically added.
47  rpc ListNotificationChannelDescriptors(
48      ListNotificationChannelDescriptorsRequest)
49      returns (ListNotificationChannelDescriptorsResponse) {
50    option (google.api.http) = {
51      get: "/v3/{name=projects/*}/notificationChannelDescriptors"
52    };
53    option (google.api.method_signature) = "name";
54  }
55
56  // Gets a single channel descriptor. The descriptor indicates which fields
57  // are expected / permitted for a notification channel of the given type.
58  rpc GetNotificationChannelDescriptor(GetNotificationChannelDescriptorRequest)
59      returns (NotificationChannelDescriptor) {
60    option (google.api.http) = {
61      get: "/v3/{name=projects/*/notificationChannelDescriptors/*}"
62    };
63    option (google.api.method_signature) = "name";
64  }
65
66  // Lists the notification channels that have been created for the project.
67  // To list the types of notification channels that are supported, use
68  // the `ListNotificationChannelDescriptors` method.
69  rpc ListNotificationChannels(ListNotificationChannelsRequest)
70      returns (ListNotificationChannelsResponse) {
71    option (google.api.http) = {
72      get: "/v3/{name=projects/*}/notificationChannels"
73    };
74    option (google.api.method_signature) = "name";
75  }
76
77  // Gets a single notification channel. The channel includes the relevant
78  // configuration details with which the channel was created. However, the
79  // response may truncate or omit passwords, API keys, or other private key
80  // matter and thus the response may not be 100% identical to the information
81  // that was supplied in the call to the create method.
82  rpc GetNotificationChannel(GetNotificationChannelRequest)
83      returns (NotificationChannel) {
84    option (google.api.http) = {
85      get: "/v3/{name=projects/*/notificationChannels/*}"
86    };
87    option (google.api.method_signature) = "name";
88  }
89
90  // Creates a new notification channel, representing a single notification
91  // endpoint such as an email address, SMS number, or PagerDuty service.
92  //
93  // Design your application to single-thread API calls that modify the state of
94  // notification channels in a single project. This includes calls to
95  // CreateNotificationChannel, DeleteNotificationChannel and
96  // UpdateNotificationChannel.
97  rpc CreateNotificationChannel(CreateNotificationChannelRequest)
98      returns (NotificationChannel) {
99    option (google.api.http) = {
100      post: "/v3/{name=projects/*}/notificationChannels"
101      body: "notification_channel"
102    };
103    option (google.api.method_signature) = "name,notification_channel";
104  }
105
106  // Updates a notification channel. Fields not specified in the field mask
107  // remain unchanged.
108  //
109  // Design your application to single-thread API calls that modify the state of
110  // notification channels in a single project. This includes calls to
111  // CreateNotificationChannel, DeleteNotificationChannel and
112  // UpdateNotificationChannel.
113  rpc UpdateNotificationChannel(UpdateNotificationChannelRequest)
114      returns (NotificationChannel) {
115    option (google.api.http) = {
116      patch: "/v3/{notification_channel.name=projects/*/notificationChannels/*}"
117      body: "notification_channel"
118    };
119    option (google.api.method_signature) = "update_mask,notification_channel";
120  }
121
122  // Deletes a notification channel.
123  //
124  // Design your application to single-thread API calls that modify the state of
125  // notification channels in a single project. This includes calls to
126  // CreateNotificationChannel, DeleteNotificationChannel and
127  // UpdateNotificationChannel.
128  rpc DeleteNotificationChannel(DeleteNotificationChannelRequest)
129      returns (google.protobuf.Empty) {
130    option (google.api.http) = {
131      delete: "/v3/{name=projects/*/notificationChannels/*}"
132    };
133    option (google.api.method_signature) = "name,force";
134  }
135
136  // Causes a verification code to be delivered to the channel. The code
137  // can then be supplied in `VerifyNotificationChannel` to verify the channel.
138  rpc SendNotificationChannelVerificationCode(
139      SendNotificationChannelVerificationCodeRequest)
140      returns (google.protobuf.Empty) {
141    option (google.api.http) = {
142      post: "/v3/{name=projects/*/notificationChannels/*}:sendVerificationCode"
143      body: "*"
144    };
145    option (google.api.method_signature) = "name";
146  }
147
148  // Requests a verification code for an already verified channel that can then
149  // be used in a call to VerifyNotificationChannel() on a different channel
150  // with an equivalent identity in the same or in a different project. This
151  // makes it possible to copy a channel between projects without requiring
152  // manual reverification of the channel. If the channel is not in the
153  // verified state, this method will fail (in other words, this may only be
154  // used if the SendNotificationChannelVerificationCode and
155  // VerifyNotificationChannel paths have already been used to put the given
156  // channel into the verified state).
157  //
158  // There is no guarantee that the verification codes returned by this method
159  // will be of a similar structure or form as the ones that are delivered
160  // to the channel via SendNotificationChannelVerificationCode; while
161  // VerifyNotificationChannel() will recognize both the codes delivered via
162  // SendNotificationChannelVerificationCode() and returned from
163  // GetNotificationChannelVerificationCode(), it is typically the case that
164  // the verification codes delivered via
165  // SendNotificationChannelVerificationCode() will be shorter and also
166  // have a shorter expiration (e.g. codes such as "G-123456") whereas
167  // GetVerificationCode() will typically return a much longer, websafe base
168  // 64 encoded string that has a longer expiration time.
169  rpc GetNotificationChannelVerificationCode(
170      GetNotificationChannelVerificationCodeRequest)
171      returns (GetNotificationChannelVerificationCodeResponse) {
172    option (google.api.http) = {
173      post: "/v3/{name=projects/*/notificationChannels/*}:getVerificationCode"
174      body: "*"
175    };
176    option (google.api.method_signature) = "name";
177  }
178
179  // Verifies a `NotificationChannel` by proving receipt of the code
180  // delivered to the channel as a result of calling
181  // `SendNotificationChannelVerificationCode`.
182  rpc VerifyNotificationChannel(VerifyNotificationChannelRequest)
183      returns (NotificationChannel) {
184    option (google.api.http) = {
185      post: "/v3/{name=projects/*/notificationChannels/*}:verify"
186      body: "*"
187    };
188    option (google.api.method_signature) = "name,code";
189  }
190}
191
192// The `ListNotificationChannelDescriptors` request.
193message ListNotificationChannelDescriptorsRequest {
194  // Required. The REST resource name of the parent from which to retrieve
195  // the notification channel descriptors. The expected syntax is:
196  //
197  //     projects/[PROJECT_ID_OR_NUMBER]
198  //
199  // Note that this
200  // [names](https://cloud.google.com/monitoring/api/v3#project_name) the parent
201  // container in which to look for the descriptors; to retrieve a single
202  // descriptor by name, use the
203  // [GetNotificationChannelDescriptor][google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor]
204  // operation, instead.
205  string name = 4 [
206    (google.api.field_behavior) = REQUIRED,
207    (google.api.resource_reference) = {
208      child_type: "monitoring.googleapis.com/NotificationChannelDescriptor"
209    }
210  ];
211
212  // The maximum number of results to return in a single response. If
213  // not set to a positive number, a reasonable value will be chosen by the
214  // service.
215  int32 page_size = 2;
216
217  // If non-empty, `page_token` must contain a value returned as the
218  // `next_page_token` in a previous response to request the next set
219  // of results.
220  string page_token = 3;
221}
222
223// The `ListNotificationChannelDescriptors` response.
224message ListNotificationChannelDescriptorsResponse {
225  // The monitored resource descriptors supported for the specified
226  // project, optionally filtered.
227  repeated NotificationChannelDescriptor channel_descriptors = 1;
228
229  // If not empty, indicates that there may be more results that match
230  // the request. Use the value in the `page_token` field in a
231  // subsequent request to fetch the next set of results. If empty,
232  // all results have been returned.
233  string next_page_token = 2;
234}
235
236// The `GetNotificationChannelDescriptor` response.
237message GetNotificationChannelDescriptorRequest {
238  // Required. The channel type for which to execute the request. The format is:
239  //
240  //     projects/[PROJECT_ID_OR_NUMBER]/notificationChannelDescriptors/[CHANNEL_TYPE]
241  string name = 3 [
242    (google.api.field_behavior) = REQUIRED,
243    (google.api.resource_reference) = {
244      type: "monitoring.googleapis.com/NotificationChannelDescriptor"
245    }
246  ];
247}
248
249// The `CreateNotificationChannel` request.
250message CreateNotificationChannelRequest {
251  // Required. The
252  // [project](https://cloud.google.com/monitoring/api/v3#project_name) on which
253  // to execute the request. The format is:
254  //
255  //     projects/[PROJECT_ID_OR_NUMBER]
256  //
257  // This names the container into which the channel will be
258  // written, this does not name the newly created channel. The resulting
259  // channel's name will have a normalized version of this field as a prefix,
260  // but will add `/notificationChannels/[CHANNEL_ID]` to identify the channel.
261  string name = 3 [
262    (google.api.field_behavior) = REQUIRED,
263    (google.api.resource_reference) = {
264      child_type: "monitoring.googleapis.com/NotificationChannel"
265    }
266  ];
267
268  // Required. The definition of the `NotificationChannel` to create.
269  NotificationChannel notification_channel = 2
270      [(google.api.field_behavior) = REQUIRED];
271}
272
273// The `ListNotificationChannels` request.
274message ListNotificationChannelsRequest {
275  // Required. The
276  // [project](https://cloud.google.com/monitoring/api/v3#project_name) on which
277  // to execute the request. The format is:
278  //
279  //     projects/[PROJECT_ID_OR_NUMBER]
280  //
281  // This names the container
282  // in which to look for the notification channels; it does not name a
283  // specific channel. To query a specific channel by REST resource name, use
284  // the
285  // [`GetNotificationChannel`][google.monitoring.v3.NotificationChannelService.GetNotificationChannel]
286  // operation.
287  string name = 5 [
288    (google.api.field_behavior) = REQUIRED,
289    (google.api.resource_reference) = {
290      child_type: "monitoring.googleapis.com/NotificationChannel"
291    }
292  ];
293
294  // If provided, this field specifies the criteria that must be met by
295  // notification channels to be included in the response.
296  //
297  // For more details, see [sorting and
298  // filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering).
299  string filter = 6;
300
301  // A comma-separated list of fields by which to sort the result. Supports
302  // the same set of fields as in `filter`. Entries can be prefixed with
303  // a minus sign to sort in descending rather than ascending order.
304  //
305  // For more details, see [sorting and
306  // filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering).
307  string order_by = 7;
308
309  // The maximum number of results to return in a single response. If
310  // not set to a positive number, a reasonable value will be chosen by the
311  // service.
312  int32 page_size = 3;
313
314  // If non-empty, `page_token` must contain a value returned as the
315  // `next_page_token` in a previous response to request the next set
316  // of results.
317  string page_token = 4;
318}
319
320// The `ListNotificationChannels` response.
321message ListNotificationChannelsResponse {
322  // The notification channels defined for the specified project.
323  repeated NotificationChannel notification_channels = 3;
324
325  // If not empty, indicates that there may be more results that match
326  // the request. Use the value in the `page_token` field in a
327  // subsequent request to fetch the next set of results. If empty,
328  // all results have been returned.
329  string next_page_token = 2;
330
331  // The total number of notification channels in all pages. This number is only
332  // an estimate, and may change in subsequent pages. https://aip.dev/158
333  int32 total_size = 4;
334}
335
336// The `GetNotificationChannel` request.
337message GetNotificationChannelRequest {
338  // Required. The channel for which to execute the request. The format is:
339  //
340  //     projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
341  string name = 3 [
342    (google.api.field_behavior) = REQUIRED,
343    (google.api.resource_reference) = {
344      type: "monitoring.googleapis.com/NotificationChannel"
345    }
346  ];
347}
348
349// The `UpdateNotificationChannel` request.
350message UpdateNotificationChannelRequest {
351  // The fields to update.
352  google.protobuf.FieldMask update_mask = 2;
353
354  // Required. A description of the changes to be applied to the specified
355  // notification channel. The description must provide a definition for
356  // fields to be updated; the names of these fields should also be
357  // included in the `update_mask`.
358  NotificationChannel notification_channel = 3
359      [(google.api.field_behavior) = REQUIRED];
360}
361
362// The `DeleteNotificationChannel` request.
363message DeleteNotificationChannelRequest {
364  // Required. The channel for which to execute the request. The format is:
365  //
366  //     projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
367  string name = 3 [
368    (google.api.field_behavior) = REQUIRED,
369    (google.api.resource_reference) = {
370      type: "monitoring.googleapis.com/NotificationChannel"
371    }
372  ];
373
374  // If true, the notification channel will be deleted regardless of its
375  // use in alert policies (the policies will be updated to remove the
376  // channel). If false, channels that are still referenced by an existing
377  // alerting policy will fail to be deleted in a delete operation.
378  bool force = 5;
379}
380
381// The `SendNotificationChannelVerificationCode` request.
382message SendNotificationChannelVerificationCodeRequest {
383  // Required. The notification channel to which to send a verification code.
384  string name = 1 [
385    (google.api.field_behavior) = REQUIRED,
386    (google.api.resource_reference) = {
387      type: "monitoring.googleapis.com/NotificationChannel"
388    }
389  ];
390}
391
392// The `GetNotificationChannelVerificationCode` request.
393message GetNotificationChannelVerificationCodeRequest {
394  // Required. The notification channel for which a verification code is to be
395  // generated and retrieved. This must name a channel that is already verified;
396  // if the specified channel is not verified, the request will fail.
397  string name = 1 [
398    (google.api.field_behavior) = REQUIRED,
399    (google.api.resource_reference) = {
400      type: "monitoring.googleapis.com/NotificationChannel"
401    }
402  ];
403
404  // The desired expiration time. If specified, the API will guarantee that
405  // the returned code will not be valid after the specified timestamp;
406  // however, the API cannot guarantee that the returned code will be
407  // valid for at least as long as the requested time (the API puts an upper
408  // bound on the amount of time for which a code may be valid). If omitted,
409  // a default expiration will be used, which may be less than the max
410  // permissible expiration (so specifying an expiration may extend the
411  // code's lifetime over omitting an expiration, even though the API does
412  // impose an upper limit on the maximum expiration that is permitted).
413  google.protobuf.Timestamp expire_time = 2;
414}
415
416// The `GetNotificationChannelVerificationCode` request.
417message GetNotificationChannelVerificationCodeResponse {
418  // The verification code, which may be used to verify other channels
419  // that have an equivalent identity (i.e. other channels of the same
420  // type with the same fingerprint such as other email channels with
421  // the same email address or other sms channels with the same number).
422  string code = 1;
423
424  // The expiration time associated with the code that was returned. If
425  // an expiration was provided in the request, this is the minimum of the
426  // requested expiration in the request and the max permitted expiration.
427  google.protobuf.Timestamp expire_time = 2;
428}
429
430// The `VerifyNotificationChannel` request.
431message VerifyNotificationChannelRequest {
432  // Required. The notification channel to verify.
433  string name = 1 [
434    (google.api.field_behavior) = REQUIRED,
435    (google.api.resource_reference) = {
436      type: "monitoring.googleapis.com/NotificationChannel"
437    }
438  ];
439
440  // Required. The verification code that was delivered to the channel as
441  // a result of invoking the `SendNotificationChannelVerificationCode` API
442  // method or that was retrieved from a verified channel via
443  // `GetNotificationChannelVerificationCode`. For example, one might have
444  // "G-123456" or "TKNZGhhd2EyN3I1MnRnMjRv" (in general, one is only
445  // guaranteed that the code is valid UTF-8; one should not
446  // make any assumptions regarding the structure or format of the code).
447  string code = 2 [(google.api.field_behavior) = REQUIRED];
448}
449