alert_service.proto 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. // Copyright 2022 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 Cloud 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. // [Cloud 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](https://cloud.google.com/monitoring/api/v3#project_name) in
  89. // which to create the alerting policy. The format is:
  90. //
  91. // projects/[PROJECT_ID_OR_NUMBER]
  92. //
  93. // Note that this field names the parent container in which the alerting
  94. // policy will be written, not the name of the created policy. |name| must be
  95. // a host project of a Metrics Scope, otherwise INVALID_ARGUMENT error will
  96. // return. The alerting policy that is returned will have a name that contains
  97. // a normalized representation of this name as a prefix but adds a suffix of
  98. // the form `/alertPolicies/[ALERT_POLICY_ID]`, identifying the policy in the
  99. // container.
  100. string name = 3 [
  101. (google.api.field_behavior) = REQUIRED,
  102. (google.api.resource_reference) = {
  103. child_type: "monitoring.googleapis.com/AlertPolicy"
  104. }
  105. ];
  106. // Required. The requested alerting policy. You should omit the `name` field in this
  107. // policy. The name will be returned in the new policy, including
  108. // a new `[ALERT_POLICY_ID]` value.
  109. AlertPolicy alert_policy = 2 [(google.api.field_behavior) = REQUIRED];
  110. }
  111. // The protocol for the `GetAlertPolicy` request.
  112. message GetAlertPolicyRequest {
  113. // Required. The alerting policy to retrieve. The format is:
  114. //
  115. // projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]
  116. string name = 3 [
  117. (google.api.field_behavior) = REQUIRED,
  118. (google.api.resource_reference) = {
  119. type: "monitoring.googleapis.com/AlertPolicy"
  120. }
  121. ];
  122. }
  123. // The protocol for the `ListAlertPolicies` request.
  124. message ListAlertPoliciesRequest {
  125. // Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name)
  126. // whose alert policies are to be listed. The format is:
  127. //
  128. // projects/[PROJECT_ID_OR_NUMBER]
  129. //
  130. // Note that this field names the parent container in which the alerting
  131. // policies to be listed are stored. To retrieve a single alerting policy
  132. // by name, use the
  133. // [GetAlertPolicy][google.monitoring.v3.AlertPolicyService.GetAlertPolicy]
  134. // operation, instead.
  135. string name = 4 [
  136. (google.api.field_behavior) = REQUIRED,
  137. (google.api.resource_reference) = {
  138. child_type: "monitoring.googleapis.com/AlertPolicy"
  139. }
  140. ];
  141. // If provided, this field specifies the criteria that must be met by
  142. // alert policies to be included in the response.
  143. //
  144. // For more details, see [sorting and
  145. // filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering).
  146. string filter = 5;
  147. // A comma-separated list of fields by which to sort the result. Supports
  148. // the same set of field references as the `filter` field. Entries can be
  149. // prefixed with a minus sign to sort by the field in descending order.
  150. //
  151. // For more details, see [sorting and
  152. // filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering).
  153. string order_by = 6;
  154. // The maximum number of results to return in a single response.
  155. int32 page_size = 2;
  156. // If this field is not empty then it must contain the `nextPageToken` value
  157. // returned by a previous call to this method. Using this field causes the
  158. // method to return more results from the previous method call.
  159. string page_token = 3;
  160. }
  161. // The protocol for the `ListAlertPolicies` response.
  162. message ListAlertPoliciesResponse {
  163. // The returned alert policies.
  164. repeated AlertPolicy alert_policies = 3;
  165. // If there might be more results than were returned, then this field is set
  166. // to a non-empty value. To see the additional results,
  167. // use that value as `page_token` in the next call to this method.
  168. string next_page_token = 2;
  169. // The total number of alert policies in all pages. This number is only an
  170. // estimate, and may change in subsequent pages. https://aip.dev/158
  171. int32 total_size = 4;
  172. }
  173. // The protocol for the `UpdateAlertPolicy` request.
  174. message UpdateAlertPolicyRequest {
  175. // Optional. A list of alerting policy field names. If this field is not
  176. // empty, each listed field in the existing alerting policy is set to the
  177. // value of the corresponding field in the supplied policy (`alert_policy`),
  178. // or to the field's default value if the field is not in the supplied
  179. // alerting policy. Fields not listed retain their previous value.
  180. //
  181. // Examples of valid field masks include `display_name`, `documentation`,
  182. // `documentation.content`, `documentation.mime_type`, `user_labels`,
  183. // `user_label.nameofkey`, `enabled`, `conditions`, `combiner`, etc.
  184. //
  185. // If this field is empty, then the supplied alerting policy replaces the
  186. // existing policy. It is the same as deleting the existing policy and
  187. // adding the supplied policy, except for the following:
  188. //
  189. // + The new policy will have the same `[ALERT_POLICY_ID]` as the former
  190. // policy. This gives you continuity with the former policy in your
  191. // notifications and incidents.
  192. // + Conditions in the new policy will keep their former `[CONDITION_ID]` if
  193. // the supplied condition includes the `name` field with that
  194. // `[CONDITION_ID]`. If the supplied condition omits the `name` field,
  195. // then a new `[CONDITION_ID]` is created.
  196. google.protobuf.FieldMask update_mask = 2;
  197. // Required. The updated alerting policy or the updated values for the
  198. // fields listed in `update_mask`.
  199. // If `update_mask` is not empty, any fields in this policy that are
  200. // not in `update_mask` are ignored.
  201. AlertPolicy alert_policy = 3 [(google.api.field_behavior) = REQUIRED];
  202. }
  203. // The protocol for the `DeleteAlertPolicy` request.
  204. message DeleteAlertPolicyRequest {
  205. // Required. The alerting policy to delete. The format is:
  206. //
  207. // projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]
  208. //
  209. // For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy].
  210. string name = 3 [
  211. (google.api.field_behavior) = REQUIRED,
  212. (google.api.resource_reference) = {
  213. type: "monitoring.googleapis.com/AlertPolicy"
  214. }
  215. ];
  216. }