alert_service.proto 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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/alert.proto";
  21. import "google/protobuf/empty.proto";
  22. import "google/protobuf/field_mask.proto";
  23. option csharp_namespace = "Google.Cloud.Monitoring.V3";
  24. option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring";
  25. option java_multiple_files = true;
  26. option java_outer_classname = "AlertServiceProto";
  27. option java_package = "com.google.monitoring.v3";
  28. option php_namespace = "Google\\Cloud\\Monitoring\\V3";
  29. option ruby_package = "Google::Cloud::Monitoring::V3";
  30. // The AlertPolicyService API is used to manage (list, create, delete,
  31. // edit) alert policies in Stackdriver Monitoring. An alerting policy is
  32. // a description of the conditions under which some aspect of your
  33. // system is considered to be "unhealthy" and the ways to notify
  34. // people or services about this state. In addition to using this API, alert
  35. // policies can also be managed through
  36. // [Stackdriver Monitoring](https://cloud.google.com/monitoring/docs/),
  37. // which can be reached by clicking the "Monitoring" tab in
  38. // [Cloud Console](https://console.cloud.google.com/).
  39. service AlertPolicyService {
  40. option (google.api.default_host) = "monitoring.googleapis.com";
  41. option (google.api.oauth_scopes) =
  42. "https://www.googleapis.com/auth/cloud-platform,"
  43. "https://www.googleapis.com/auth/monitoring,"
  44. "https://www.googleapis.com/auth/monitoring.read";
  45. // Lists the existing alerting policies for the workspace.
  46. rpc ListAlertPolicies(ListAlertPoliciesRequest) returns (ListAlertPoliciesResponse) {
  47. option (google.api.http) = {
  48. get: "/v3/{name=projects/*}/alertPolicies"
  49. };
  50. option (google.api.method_signature) = "name";
  51. }
  52. // Gets a single alerting policy.
  53. rpc GetAlertPolicy(GetAlertPolicyRequest) returns (AlertPolicy) {
  54. option (google.api.http) = {
  55. get: "/v3/{name=projects/*/alertPolicies/*}"
  56. };
  57. option (google.api.method_signature) = "name";
  58. }
  59. // Creates a new alerting policy.
  60. rpc CreateAlertPolicy(CreateAlertPolicyRequest) returns (AlertPolicy) {
  61. option (google.api.http) = {
  62. post: "/v3/{name=projects/*}/alertPolicies"
  63. body: "alert_policy"
  64. };
  65. option (google.api.method_signature) = "name,alert_policy";
  66. }
  67. // Deletes an alerting policy.
  68. rpc DeleteAlertPolicy(DeleteAlertPolicyRequest) returns (google.protobuf.Empty) {
  69. option (google.api.http) = {
  70. delete: "/v3/{name=projects/*/alertPolicies/*}"
  71. };
  72. option (google.api.method_signature) = "name";
  73. }
  74. // Updates an alerting policy. You can either replace the entire policy with
  75. // a new one or replace only certain fields in the current alerting policy by
  76. // specifying the fields to be updated via `updateMask`. Returns the
  77. // updated alerting policy.
  78. rpc UpdateAlertPolicy(UpdateAlertPolicyRequest) returns (AlertPolicy) {
  79. option (google.api.http) = {
  80. patch: "/v3/{alert_policy.name=projects/*/alertPolicies/*}"
  81. body: "alert_policy"
  82. };
  83. option (google.api.method_signature) = "update_mask,alert_policy";
  84. }
  85. }
  86. // The protocol for the `CreateAlertPolicy` request.
  87. message CreateAlertPolicyRequest {
  88. // Required. The project in which to create the alerting policy. The format is:
  89. //
  90. // projects/[PROJECT_ID_OR_NUMBER]
  91. //
  92. // Note that this field names the parent container in which the alerting
  93. // policy will be written, not the name of the created policy. |name| must be
  94. // a host project of a workspace, otherwise INVALID_ARGUMENT error will
  95. // return. The alerting policy that is returned will have a name that contains
  96. // a normalized representation of this name as a prefix but adds a suffix of
  97. // the form `/alertPolicies/[ALERT_POLICY_ID]`, identifying the policy in the
  98. // container.
  99. string name = 3 [
  100. (google.api.field_behavior) = REQUIRED,
  101. (google.api.resource_reference) = {
  102. child_type: "monitoring.googleapis.com/AlertPolicy"
  103. }
  104. ];
  105. // Required. The requested alerting policy. You should omit the `name` field in this
  106. // policy. The name will be returned in the new policy, including
  107. // a new `[ALERT_POLICY_ID]` value.
  108. AlertPolicy alert_policy = 2 [(google.api.field_behavior) = REQUIRED];
  109. }
  110. // The protocol for the `GetAlertPolicy` request.
  111. message GetAlertPolicyRequest {
  112. // Required. The alerting policy to retrieve. The format is:
  113. //
  114. // projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]
  115. string name = 3 [
  116. (google.api.field_behavior) = REQUIRED,
  117. (google.api.resource_reference) = {
  118. type: "monitoring.googleapis.com/AlertPolicy"
  119. }
  120. ];
  121. }
  122. // The protocol for the `ListAlertPolicies` request.
  123. message ListAlertPoliciesRequest {
  124. // Required. The project whose alert policies are to be listed. The format is:
  125. //
  126. // projects/[PROJECT_ID_OR_NUMBER]
  127. //
  128. // Note that this field names the parent container in which the alerting
  129. // policies to be listed are stored. To retrieve a single alerting policy
  130. // by name, use the
  131. // [GetAlertPolicy][google.monitoring.v3.AlertPolicyService.GetAlertPolicy]
  132. // operation, instead.
  133. string name = 4 [
  134. (google.api.field_behavior) = REQUIRED,
  135. (google.api.resource_reference) = {
  136. child_type: "monitoring.googleapis.com/AlertPolicy"
  137. }
  138. ];
  139. // If provided, this field specifies the criteria that must be met by
  140. // alert policies to be included in the response.
  141. //
  142. // For more details, see [sorting and
  143. // filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering).
  144. string filter = 5;
  145. // A comma-separated list of fields by which to sort the result. Supports
  146. // the same set of field references as the `filter` field. Entries can be
  147. // prefixed with a minus sign to sort by the field in descending order.
  148. //
  149. // For more details, see [sorting and
  150. // filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering).
  151. string order_by = 6;
  152. // The maximum number of results to return in a single response.
  153. int32 page_size = 2;
  154. // If this field is not empty then it must contain the `nextPageToken` value
  155. // returned by a previous call to this method. Using this field causes the
  156. // method to return more results from the previous method call.
  157. string page_token = 3;
  158. }
  159. // The protocol for the `ListAlertPolicies` response.
  160. message ListAlertPoliciesResponse {
  161. // The returned alert policies.
  162. repeated AlertPolicy alert_policies = 3;
  163. // If there might be more results than were returned, then this field is set
  164. // to a non-empty value. To see the additional results,
  165. // use that value as `page_token` in the next call to this method.
  166. string next_page_token = 2;
  167. // The total number of alert policies in all pages. This number is only an
  168. // estimate, and may change in subsequent pages. https://aip.dev/158
  169. int32 total_size = 4;
  170. }
  171. // The protocol for the `UpdateAlertPolicy` request.
  172. message UpdateAlertPolicyRequest {
  173. // Optional. A list of alerting policy field names. If this field is not
  174. // empty, each listed field in the existing alerting policy is set to the
  175. // value of the corresponding field in the supplied policy (`alert_policy`),
  176. // or to the field's default value if the field is not in the supplied
  177. // alerting policy. Fields not listed retain their previous value.
  178. //
  179. // Examples of valid field masks include `display_name`, `documentation`,
  180. // `documentation.content`, `documentation.mime_type`, `user_labels`,
  181. // `user_label.nameofkey`, `enabled`, `conditions`, `combiner`, etc.
  182. //
  183. // If this field is empty, then the supplied alerting policy replaces the
  184. // existing policy. It is the same as deleting the existing policy and
  185. // adding the supplied policy, except for the following:
  186. //
  187. // + The new policy will have the same `[ALERT_POLICY_ID]` as the former
  188. // policy. This gives you continuity with the former policy in your
  189. // notifications and incidents.
  190. // + Conditions in the new policy will keep their former `[CONDITION_ID]` if
  191. // the supplied condition includes the `name` field with that
  192. // `[CONDITION_ID]`. If the supplied condition omits the `name` field,
  193. // then a new `[CONDITION_ID]` is created.
  194. google.protobuf.FieldMask update_mask = 2;
  195. // Required. The updated alerting policy or the updated values for the
  196. // fields listed in `update_mask`.
  197. // If `update_mask` is not empty, any fields in this policy that are
  198. // not in `update_mask` are ignored.
  199. AlertPolicy alert_policy = 3 [(google.api.field_behavior) = REQUIRED];
  200. }
  201. // The protocol for the `DeleteAlertPolicy` request.
  202. message DeleteAlertPolicyRequest {
  203. // Required. The alerting policy to delete. The format is:
  204. //
  205. // projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]
  206. //
  207. // For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy].
  208. string name = 3 [
  209. (google.api.field_behavior) = REQUIRED,
  210. (google.api.resource_reference) = {
  211. type: "monitoring.googleapis.com/AlertPolicy"
  212. }
  213. ];
  214. }