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
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/service.proto";
24import "google/protobuf/empty.proto";
25import "google/protobuf/field_mask.proto";
26
27option csharp_namespace = "Google.Cloud.Monitoring.V3";
28option go_package = "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpb";
29option java_multiple_files = true;
30option java_outer_classname = "ServiceMonitoringServiceProto";
31option java_package = "com.google.monitoring.v3";
32option php_namespace = "Google\\Cloud\\Monitoring\\V3";
33option ruby_package = "Google::Cloud::Monitoring::V3";
34
35// The Cloud Monitoring Service-Oriented Monitoring API has endpoints for
36// managing and querying aspects of a workspace's services. These include the
37// `Service`'s monitored resources, its Service-Level Objectives, and a taxonomy
38// of categorized Health Metrics.
39service ServiceMonitoringService {
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
46  // Create a `Service`.
47  rpc CreateService(CreateServiceRequest) returns (Service) {
48    option (google.api.http) = {
49      post: "/v3/{parent=*/*}/services"
50      body: "service"
51    };
52    option (google.api.method_signature) = "parent,service";
53  }
54
55  // Get the named `Service`.
56  rpc GetService(GetServiceRequest) returns (Service) {
57    option (google.api.http) = {
58      get: "/v3/{name=*/*/services/*}"
59    };
60    option (google.api.method_signature) = "name";
61  }
62
63  // List `Service`s for this workspace.
64  rpc ListServices(ListServicesRequest) returns (ListServicesResponse) {
65    option (google.api.http) = {
66      get: "/v3/{parent=*/*}/services"
67    };
68    option (google.api.method_signature) = "parent";
69  }
70
71  // Update this `Service`.
72  rpc UpdateService(UpdateServiceRequest) returns (Service) {
73    option (google.api.http) = {
74      patch: "/v3/{service.name=*/*/services/*}"
75      body: "service"
76    };
77    option (google.api.method_signature) = "service";
78  }
79
80  // Soft delete this `Service`.
81  rpc DeleteService(DeleteServiceRequest) returns (google.protobuf.Empty) {
82    option (google.api.http) = {
83      delete: "/v3/{name=*/*/services/*}"
84    };
85    option (google.api.method_signature) = "name";
86  }
87
88  // Create a `ServiceLevelObjective` for the given `Service`.
89  rpc CreateServiceLevelObjective(CreateServiceLevelObjectiveRequest) returns (ServiceLevelObjective) {
90    option (google.api.http) = {
91      post: "/v3/{parent=*/*/services/*}/serviceLevelObjectives"
92      body: "service_level_objective"
93    };
94    option (google.api.method_signature) = "parent,service_level_objective";
95  }
96
97  // Get a `ServiceLevelObjective` by name.
98  rpc GetServiceLevelObjective(GetServiceLevelObjectiveRequest) returns (ServiceLevelObjective) {
99    option (google.api.http) = {
100      get: "/v3/{name=*/*/services/*/serviceLevelObjectives/*}"
101    };
102    option (google.api.method_signature) = "name";
103  }
104
105  // List the `ServiceLevelObjective`s for the given `Service`.
106  rpc ListServiceLevelObjectives(ListServiceLevelObjectivesRequest) returns (ListServiceLevelObjectivesResponse) {
107    option (google.api.http) = {
108      get: "/v3/{parent=*/*/services/*}/serviceLevelObjectives"
109    };
110    option (google.api.method_signature) = "parent";
111  }
112
113  // Update the given `ServiceLevelObjective`.
114  rpc UpdateServiceLevelObjective(UpdateServiceLevelObjectiveRequest) returns (ServiceLevelObjective) {
115    option (google.api.http) = {
116      patch: "/v3/{service_level_objective.name=*/*/services/*/serviceLevelObjectives/*}"
117      body: "service_level_objective"
118    };
119    option (google.api.method_signature) = "service_level_objective";
120  }
121
122  // Delete the given `ServiceLevelObjective`.
123  rpc DeleteServiceLevelObjective(DeleteServiceLevelObjectiveRequest) returns (google.protobuf.Empty) {
124    option (google.api.http) = {
125      delete: "/v3/{name=*/*/services/*/serviceLevelObjectives/*}"
126    };
127    option (google.api.method_signature) = "name";
128  }
129}
130
131// The `CreateService` request.
132message CreateServiceRequest {
133  // Required. Resource [name](https://cloud.google.com/monitoring/api/v3#project_name) of
134  // the parent workspace. The format is:
135  //
136  //     projects/[PROJECT_ID_OR_NUMBER]
137  string parent = 1 [
138    (google.api.field_behavior) = REQUIRED,
139    (google.api.resource_reference) = {
140      child_type: "monitoring.googleapis.com/Service"
141    }
142  ];
143
144  // Optional. The Service id to use for this Service. If omitted, an id will be
145  // generated instead. Must match the pattern `[a-z0-9\-]+`
146  string service_id = 3;
147
148  // Required. The `Service` to create.
149  Service service = 2 [(google.api.field_behavior) = REQUIRED];
150}
151
152// The `GetService` request.
153message GetServiceRequest {
154  // Required. Resource name of the `Service`. The format is:
155  //
156  //     projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
157  string name = 1 [
158    (google.api.field_behavior) = REQUIRED,
159    (google.api.resource_reference) = {
160      type: "monitoring.googleapis.com/Service"
161    }
162  ];
163}
164
165// The `ListServices` request.
166message ListServicesRequest {
167  // Required. Resource name of the parent containing the listed services, either a
168  // [project](https://cloud.google.com/monitoring/api/v3#project_name) or a
169  // Monitoring Workspace. The formats are:
170  //
171  //     projects/[PROJECT_ID_OR_NUMBER]
172  //     workspaces/[HOST_PROJECT_ID_OR_NUMBER]
173  string parent = 1 [
174    (google.api.field_behavior) = REQUIRED,
175    (google.api.resource_reference) = {
176      child_type: "monitoring.googleapis.com/Service"
177    }
178  ];
179
180  // A filter specifying what `Service`s to return. The filter currently
181  // supports the following fields:
182  //
183  //     - `identifier_case`
184  //     - `app_engine.module_id`
185  //     - `cloud_endpoints.service` (reserved for future use)
186  //     - `mesh_istio.mesh_uid`
187  //     - `mesh_istio.service_namespace`
188  //     - `mesh_istio.service_name`
189  //     - `cluster_istio.location` (deprecated)
190  //     - `cluster_istio.cluster_name` (deprecated)
191  //     - `cluster_istio.service_namespace` (deprecated)
192  //     - `cluster_istio.service_name` (deprecated)
193  //
194  // `identifier_case` refers to which option in the identifier oneof is
195  // populated. For example, the filter `identifier_case = "CUSTOM"` would match
196  // all services with a value for the `custom` field. Valid options are
197  // "CUSTOM", "APP_ENGINE", "MESH_ISTIO", plus "CLUSTER_ISTIO" (deprecated)
198  // and "CLOUD_ENDPOINTS" (reserved for future use).
199  string filter = 2;
200
201  // A non-negative number that is the maximum number of results to return.
202  // When 0, use default page size.
203  int32 page_size = 3;
204
205  // If this field is not empty then it must contain the `nextPageToken` value
206  // returned by a previous call to this method.  Using this field causes the
207  // method to return additional results from the previous method call.
208  string page_token = 4;
209}
210
211// The `ListServices` response.
212message ListServicesResponse {
213  // The `Service`s matching the specified filter.
214  repeated Service services = 1;
215
216  // If there are more results than have been returned, then this field is set
217  // to a non-empty value.  To see the additional results,
218  // use that value as `page_token` in the next call to this method.
219  string next_page_token = 2;
220}
221
222// The `UpdateService` request.
223message UpdateServiceRequest {
224  // Required. The `Service` to draw updates from.
225  // The given `name` specifies the resource to update.
226  Service service = 1 [(google.api.field_behavior) = REQUIRED];
227
228  // A set of field paths defining which fields to use for the update.
229  google.protobuf.FieldMask update_mask = 2;
230}
231
232// The `DeleteService` request.
233message DeleteServiceRequest {
234  // Required. Resource name of the `Service` to delete. The format is:
235  //
236  //     projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
237  string name = 1 [
238    (google.api.field_behavior) = REQUIRED,
239    (google.api.resource_reference) = {
240      type: "monitoring.googleapis.com/Service"
241    }
242  ];
243}
244
245// The `CreateServiceLevelObjective` request.
246message CreateServiceLevelObjectiveRequest {
247  // Required. Resource name of the parent `Service`. The format is:
248  //
249  //     projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
250  string parent = 1 [
251    (google.api.field_behavior) = REQUIRED,
252    (google.api.resource_reference) = {
253      type: "monitoring.googleapis.com/Service"
254    }
255  ];
256
257  // Optional. The ServiceLevelObjective id to use for this
258  // ServiceLevelObjective. If omitted, an id will be generated instead. Must
259  // match the pattern `[a-z0-9\-]+`
260  string service_level_objective_id = 3;
261
262  // Required. The `ServiceLevelObjective` to create.
263  // The provided `name` will be respected if no `ServiceLevelObjective` exists
264  // with this name.
265  ServiceLevelObjective service_level_objective = 2 [(google.api.field_behavior) = REQUIRED];
266}
267
268// The `GetServiceLevelObjective` request.
269message GetServiceLevelObjectiveRequest {
270  // Required. Resource name of the `ServiceLevelObjective` to get. The format is:
271  //
272  //     projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME]
273  string name = 1 [
274    (google.api.field_behavior) = REQUIRED,
275    (google.api.resource_reference) = {
276      type: "monitoring.googleapis.com/ServiceLevelObjective"
277    }
278  ];
279
280  // View of the `ServiceLevelObjective` to return. If `DEFAULT`, return the
281  // `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the
282  // `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the
283  // `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed.
284  ServiceLevelObjective.View view = 2;
285}
286
287// The `ListServiceLevelObjectives` request.
288message ListServiceLevelObjectivesRequest {
289  // Required. Resource name of the parent containing the listed SLOs, either a
290  // project or a Monitoring Workspace. The formats are:
291  //
292  //     projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
293  //     workspaces/[HOST_PROJECT_ID_OR_NUMBER]/services/-
294  string parent = 1 [
295    (google.api.field_behavior) = REQUIRED,
296    (google.api.resource_reference) = {
297      type: "monitoring.googleapis.com/Service"
298    }
299  ];
300
301  // A filter specifying what `ServiceLevelObjective`s to return.
302  string filter = 2;
303
304  // A non-negative number that is the maximum number of results to return.
305  // When 0, use default page size.
306  int32 page_size = 3;
307
308  // If this field is not empty then it must contain the `nextPageToken` value
309  // returned by a previous call to this method.  Using this field causes the
310  // method to return additional results from the previous method call.
311  string page_token = 4;
312
313  // View of the `ServiceLevelObjective`s to return. If `DEFAULT`, return each
314  // `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the
315  // `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the
316  // `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed.
317  ServiceLevelObjective.View view = 5;
318}
319
320// The `ListServiceLevelObjectives` response.
321message ListServiceLevelObjectivesResponse {
322  // The `ServiceLevelObjective`s matching the specified filter.
323  repeated ServiceLevelObjective service_level_objectives = 1;
324
325  // If there are more results than have been returned, then this field is set
326  // to a non-empty value.  To see the additional results,
327  // use that value as `page_token` in the next call to this method.
328  string next_page_token = 2;
329}
330
331// The `UpdateServiceLevelObjective` request.
332message UpdateServiceLevelObjectiveRequest {
333  // Required. The `ServiceLevelObjective` to draw updates from.
334  // The given `name` specifies the resource to update.
335  ServiceLevelObjective service_level_objective = 1 [(google.api.field_behavior) = REQUIRED];
336
337  // A set of field paths defining which fields to use for the update.
338  google.protobuf.FieldMask update_mask = 2;
339}
340
341// The `DeleteServiceLevelObjective` request.
342message DeleteServiceLevelObjectiveRequest {
343  // Required. Resource name of the `ServiceLevelObjective` to delete. The format is:
344  //
345  //     projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME]
346  string name = 1 [
347    (google.api.field_behavior) = REQUIRED,
348    (google.api.resource_reference) = {
349      type: "monitoring.googleapis.com/ServiceLevelObjective"
350    }
351  ];
352}
353