notification_service.proto 17 KB

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