1// Copyright 2023 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 15syntax = "proto3"; 16 17package google.monitoring.v3; 18 19import "google/api/annotations.proto"; 20import "google/api/client.proto"; 21import "google/api/field_behavior.proto"; 22import "google/api/resource.proto"; 23import "google/monitoring/v3/snooze.proto"; 24import "google/protobuf/field_mask.proto"; 25 26option csharp_namespace = "Google.Cloud.Monitoring.V3"; 27option go_package = "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpb"; 28option java_multiple_files = true; 29option java_outer_classname = "SnoozeServiceProto"; 30option java_package = "com.google.monitoring.v3"; 31option php_namespace = "Google\\Cloud\\Monitoring\\V3"; 32option ruby_package = "Google::Cloud::Monitoring::V3"; 33 34// The SnoozeService API is used to temporarily prevent an alert policy from 35// generating alerts. A Snooze is a description of the criteria under which one 36// or more alert policies should not fire alerts for the specified duration. 37service SnoozeService { 38 option (google.api.default_host) = "monitoring.googleapis.com"; 39 option (google.api.oauth_scopes) = 40 "https://www.googleapis.com/auth/cloud-platform," 41 "https://www.googleapis.com/auth/monitoring," 42 "https://www.googleapis.com/auth/monitoring.read"; 43 44 // Creates a `Snooze` that will prevent alerts, which match the provided 45 // criteria, from being opened. The `Snooze` applies for a specific time 46 // interval. 47 rpc CreateSnooze(CreateSnoozeRequest) returns (Snooze) { 48 option (google.api.http) = { 49 post: "/v3/{parent=projects/*}/snoozes" 50 body: "snooze" 51 }; 52 option (google.api.method_signature) = "parent,snooze"; 53 } 54 55 // Lists the `Snooze`s associated with a project. Can optionally pass in 56 // `filter`, which specifies predicates to match `Snooze`s. 57 rpc ListSnoozes(ListSnoozesRequest) returns (ListSnoozesResponse) { 58 option (google.api.http) = { 59 get: "/v3/{parent=projects/*}/snoozes" 60 }; 61 option (google.api.method_signature) = "parent"; 62 } 63 64 // Retrieves a `Snooze` by `name`. 65 rpc GetSnooze(GetSnoozeRequest) returns (Snooze) { 66 option (google.api.http) = { 67 get: "/v3/{name=projects/*/snoozes/*}" 68 }; 69 option (google.api.method_signature) = "name"; 70 } 71 72 // Updates a `Snooze`, identified by its `name`, with the parameters in the 73 // given `Snooze` object. 74 rpc UpdateSnooze(UpdateSnoozeRequest) returns (Snooze) { 75 option (google.api.http) = { 76 patch: "/v3/{snooze.name=projects/*/snoozes/*}" 77 body: "snooze" 78 }; 79 option (google.api.method_signature) = "snooze,update_mask"; 80 } 81} 82 83// The message definition for creating a `Snooze`. Users must provide the body 84// of the `Snooze` to be created but must omit the `Snooze` field, `name`. 85message CreateSnoozeRequest { 86 // Required. The 87 // [project](https://cloud.google.com/monitoring/api/v3#project_name) in which 88 // a `Snooze` should be created. The format is: 89 // 90 // projects/[PROJECT_ID_OR_NUMBER] 91 string parent = 1 [ 92 (google.api.field_behavior) = REQUIRED, 93 (google.api.resource_reference) = { 94 child_type: "monitoring.googleapis.com/Snooze" 95 } 96 ]; 97 98 // Required. The `Snooze` to create. Omit the `name` field, as it will be 99 // filled in by the API. 100 Snooze snooze = 2 [(google.api.field_behavior) = REQUIRED]; 101} 102 103// The message definition for listing `Snooze`s associated with the given 104// `parent`, satisfying the optional `filter`. 105message ListSnoozesRequest { 106 // Required. The 107 // [project](https://cloud.google.com/monitoring/api/v3#project_name) whose 108 // `Snooze`s should be listed. The format is: 109 // 110 // projects/[PROJECT_ID_OR_NUMBER] 111 string parent = 1 [ 112 (google.api.field_behavior) = REQUIRED, 113 (google.api.resource_reference) = { 114 child_type: "monitoring.googleapis.com/Snooze" 115 } 116 ]; 117 118 // Optional. Optional filter to restrict results to the given criteria. The 119 // following fields are supported. 120 // 121 // * `interval.start_time` 122 // * `interval.end_time` 123 // 124 // For example: 125 // 126 // ``` 127 // interval.start_time > "2022-03-11T00:00:00-08:00" AND 128 // interval.end_time < "2022-03-12T00:00:00-08:00" 129 // ``` 130 string filter = 2 [(google.api.field_behavior) = OPTIONAL]; 131 132 // Optional. The maximum number of results to return for a single query. The 133 // server may further constrain the maximum number of results returned in a 134 // single page. The value should be in the range [1, 1000]. If the value given 135 // is outside this range, the server will decide the number of results to be 136 // returned. 137 int32 page_size = 4 [(google.api.field_behavior) = OPTIONAL]; 138 139 // Optional. The `next_page_token` from a previous call to 140 // `ListSnoozesRequest` to get the next page of results. 141 string page_token = 5 [(google.api.field_behavior) = OPTIONAL]; 142} 143 144// The results of a successful `ListSnoozes` call, containing the matching 145// `Snooze`s. 146message ListSnoozesResponse { 147 // `Snooze`s matching this list call. 148 repeated Snooze snoozes = 1; 149 150 // Page token for repeated calls to `ListSnoozes`, to fetch additional pages 151 // of results. If this is empty or missing, there are no more pages. 152 string next_page_token = 2; 153} 154 155// The message definition for retrieving a `Snooze`. Users must specify the 156// field, `name`, which identifies the `Snooze`. 157message GetSnoozeRequest { 158 // Required. The ID of the `Snooze` to retrieve. The format is: 159 // 160 // projects/[PROJECT_ID_OR_NUMBER]/snoozes/[SNOOZE_ID] 161 string name = 1 [ 162 (google.api.field_behavior) = REQUIRED, 163 (google.api.resource_reference) = { 164 type: "monitoring.googleapis.com/Snooze" 165 } 166 ]; 167} 168 169// The message definition for updating a `Snooze`. The field, `snooze.name` 170// identifies the `Snooze` to be updated. The remainder of `snooze` gives the 171// content the `Snooze` in question will be assigned. 172// 173// What fields can be updated depends on the start time and end time of the 174// `Snooze`. 175// 176// * end time is in the past: These `Snooze`s are considered 177// read-only and cannot be updated. 178// * start time is in the past and end time is in the future: `display_name` 179// and `interval.end_time` can be updated. 180// * start time is in the future: `display_name`, `interval.start_time` and 181// `interval.end_time` can be updated. 182message UpdateSnoozeRequest { 183 // Required. The `Snooze` to update. Must have the name field present. 184 Snooze snooze = 1 [(google.api.field_behavior) = REQUIRED]; 185 186 // Required. The fields to update. 187 // 188 // For each field listed in `update_mask`: 189 // 190 // * If the `Snooze` object supplied in the `UpdateSnoozeRequest` has a 191 // value for that field, the value of the field in the existing `Snooze` 192 // will be set to the value of the field in the supplied `Snooze`. 193 // * If the field does not have a value in the supplied `Snooze`, the field 194 // in the existing `Snooze` is set to its default value. 195 // 196 // Fields not listed retain their existing value. 197 // 198 // The following are the field names that are accepted in `update_mask`: 199 // 200 // * `display_name` 201 // * `interval.start_time` 202 // * `interval.end_time` 203 // 204 // That said, the start time and end time of the `Snooze` determines which 205 // fields can legally be updated. Before attempting an update, users should 206 // consult the documentation for `UpdateSnoozeRequest`, which talks about 207 // which fields can be updated. 208 google.protobuf.FieldMask update_mask = 2 209 [(google.api.field_behavior) = REQUIRED]; 210} 211