notification_service.proto 17 KB

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