1 // Copyright 2018 Google LLC.
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
7 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 package google.monitoring.v3;
20 import "google/api/annotations.proto";
21 import "google/monitoring/v3/alert.proto";
22 import "google/protobuf/empty.proto";
23 import "google/protobuf/field_mask.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 = "AlertServiceProto";
29 option java_package = "com.google.monitoring.v3";
30 option php_namespace = "Google\\Cloud\\Monitoring\\V3";
32 // The AlertPolicyService API is used to manage (list, create, delete,
33 // edit) alert policies in Stackdriver Monitoring. An alerting policy is
34 // a description of the conditions under which some aspect of your
35 // system is considered to be "unhealthy" and the ways to notify
36 // people or services about this state. In addition to using this API, alert
37 // policies can also be managed through
38 // [Stackdriver Monitoring](https://cloud.google.com/monitoring/docs/),
39 // which can be reached by clicking the "Monitoring" tab in
40 // [Cloud Console](https://console.cloud.google.com/).
41 service AlertPolicyService {
42 // Lists the existing alerting policies for the project.
43 rpc ListAlertPolicies(ListAlertPoliciesRequest)
44 returns (ListAlertPoliciesResponse) {
45 option (google.api.http) = {
46 get: "/v3/{name=projects/*}/alertPolicies"
50 // Gets a single alerting policy.
51 rpc GetAlertPolicy(GetAlertPolicyRequest) returns (AlertPolicy) {
52 option (google.api.http) = {
53 get: "/v3/{name=projects/*/alertPolicies/*}"
57 // Creates a new alerting policy.
58 rpc CreateAlertPolicy(CreateAlertPolicyRequest) returns (AlertPolicy) {
59 option (google.api.http) = {
60 post: "/v3/{name=projects/*}/alertPolicies"
65 // Deletes an alerting policy.
66 rpc DeleteAlertPolicy(DeleteAlertPolicyRequest)
67 returns (google.protobuf.Empty) {
68 option (google.api.http) = {
69 delete: "/v3/{name=projects/*/alertPolicies/*}"
73 // Updates an alerting policy. You can either replace the entire policy with
74 // a new one or replace only certain fields in the current alerting policy by
75 // specifying the fields to be updated via `updateMask`. Returns the
76 // updated alerting policy.
77 rpc UpdateAlertPolicy(UpdateAlertPolicyRequest) returns (AlertPolicy) {
78 option (google.api.http) = {
79 patch: "/v3/{alert_policy.name=projects/*/alertPolicies/*}"
85 // The protocol for the `CreateAlertPolicy` request.
86 message CreateAlertPolicyRequest {
87 // The project in which to create the alerting policy. The format is
88 // `projects/[PROJECT_ID]`.
90 // Note that this field names the parent container in which the alerting
91 // policy will be written, not the name of the created policy. The alerting
92 // policy that is returned will have a name that contains a normalized
93 // representation of this name as a prefix but adds a suffix of the form
94 // `/alertPolicies/[POLICY_ID]`, identifying the policy in the container.
97 // The requested alerting policy. You should omit the `name` field in this
98 // policy. The name will be returned in the new policy, including
99 // a new [ALERT_POLICY_ID] value.
100 AlertPolicy alert_policy = 2;
103 // The protocol for the `GetAlertPolicy` request.
104 message GetAlertPolicyRequest {
105 // The alerting policy to retrieve. The format is
107 // projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]
111 // The protocol for the `ListAlertPolicies` request.
112 message ListAlertPoliciesRequest {
113 // The project whose alert policies are to be listed. The format is
115 // projects/[PROJECT_ID]
117 // Note that this field names the parent container in which the alerting
118 // policies to be listed are stored. To retrieve a single alerting policy
120 // [GetAlertPolicy][google.monitoring.v3.AlertPolicyService.GetAlertPolicy]
121 // operation, instead.
124 // If provided, this field specifies the criteria that must be met by
125 // alert policies to be included in the response.
127 // For more details, see [sorting and
128 // filtering](/monitoring/api/v3/sorting-and-filtering).
131 // A comma-separated list of fields by which to sort the result. Supports
132 // the same set of field references as the `filter` field. Entries can be
133 // prefixed with a minus sign to sort by the field in descending order.
135 // For more details, see [sorting and
136 // filtering](/monitoring/api/v3/sorting-and-filtering).
139 // The maximum number of results to return in a single response.
142 // If this field is not empty then it must contain the `nextPageToken` value
143 // returned by a previous call to this method. Using this field causes the
144 // method to return more results from the previous method call.
145 string page_token = 3;
148 // The protocol for the `ListAlertPolicies` response.
149 message ListAlertPoliciesResponse {
150 // The returned alert policies.
151 repeated AlertPolicy alert_policies = 3;
153 // If there might be more results than were returned, then this field is set
154 // to a non-empty value. To see the additional results,
155 // use that value as `pageToken` in the next call to this method.
156 string next_page_token = 2;
159 // The protocol for the `UpdateAlertPolicy` request.
160 message UpdateAlertPolicyRequest {
161 // Optional. A list of alerting policy field names. If this field is not
162 // empty, each listed field in the existing alerting policy is set to the
163 // value of the corresponding field in the supplied policy (`alert_policy`),
164 // or to the field's default value if the field is not in the supplied
165 // alerting policy. Fields not listed retain their previous value.
167 // Examples of valid field masks include `display_name`, `documentation`,
168 // `documentation.content`, `documentation.mime_type`, `user_labels`,
169 // `user_label.nameofkey`, `enabled`, `conditions`, `combiner`, etc.
171 // If this field is empty, then the supplied alerting policy replaces the
172 // existing policy. It is the same as deleting the existing policy and
173 // adding the supplied policy, except for the following:
175 // + The new policy will have the same `[ALERT_POLICY_ID]` as the former
176 // policy. This gives you continuity with the former policy in your
177 // notifications and incidents.
178 // + Conditions in the new policy will keep their former `[CONDITION_ID]` if
179 // the supplied condition includes the `name` field with that
180 // `[CONDITION_ID]`. If the supplied condition omits the `name` field,
181 // then a new `[CONDITION_ID]` is created.
182 google.protobuf.FieldMask update_mask = 2;
184 // Required. The updated alerting policy or the updated values for the
185 // fields listed in `update_mask`.
186 // If `update_mask` is not empty, any fields in this policy that are
187 // not in `update_mask` are ignored.
188 AlertPolicy alert_policy = 3;
191 // The protocol for the `DeleteAlertPolicy` request.
192 message DeleteAlertPolicyRequest {
193 // The alerting policy to delete. The format is:
195 // projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]
197 // For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy].