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.metricsscope.v1; 18 19import "google/api/annotations.proto"; 20import "google/api/client.proto"; 21import "google/api/field_behavior.proto"; 22import "google/api/resource.proto"; 23import "google/longrunning/operations.proto"; 24import "google/monitoring/metricsscope/v1/metrics_scope.proto"; 25import "google/protobuf/timestamp.proto"; 26 27option go_package = "cloud.google.com/go/monitoring/metricsscope/apiv1/metricsscopepb;metricsscopepb"; 28option java_multiple_files = true; 29option java_outer_classname = "MetricsScopesProto"; 30option java_package = "com.google.monitoring.metricsscope.v1"; 31option csharp_namespace = "Google.Cloud.Monitoring.MetricsScope.V1"; 32option php_namespace = "Google\\Cloud\\Monitoring\\MetricsScope\\V1"; 33option ruby_package = "Google::Cloud::Monitoring::MetricsScope::V1"; 34 35// Manages Cloud Monitoring Metrics Scopes, and the monitoring of Google Cloud 36// projects and AWS accounts. 37service MetricsScopes { 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 "https://www.googleapis.com/auth/monitoring.write"; 44 45 // Returns a specific `Metrics Scope`. 46 rpc GetMetricsScope(GetMetricsScopeRequest) returns (MetricsScope) { 47 option (google.api.http) = { 48 get: "/v1/{name=locations/global/metricsScopes/*}" 49 }; 50 option (google.api.method_signature) = "name"; 51 } 52 53 // Returns a list of every `Metrics Scope` that a specific `MonitoredProject` 54 // has been added to. The metrics scope representing the specified monitored 55 // project will always be the first entry in the response. 56 rpc ListMetricsScopesByMonitoredProject(ListMetricsScopesByMonitoredProjectRequest) returns (ListMetricsScopesByMonitoredProjectResponse) { 57 option (google.api.http) = { 58 get: "/v1/locations/global/metricsScopes:listMetricsScopesByMonitoredProject" 59 }; 60 } 61 62 // Adds a `MonitoredProject` with the given project ID 63 // to the specified `Metrics Scope`. 64 rpc CreateMonitoredProject(CreateMonitoredProjectRequest) returns (google.longrunning.Operation) { 65 option (google.api.http) = { 66 post: "/v1/{parent=locations/global/metricsScopes/*}/projects" 67 body: "monitored_project" 68 }; 69 option (google.api.method_signature) = "parent,monitored_project"; 70 option (google.longrunning.operation_info) = { 71 response_type: "MonitoredProject" 72 metadata_type: "OperationMetadata" 73 }; 74 } 75 76 // Deletes a `MonitoredProject` from the specified `Metrics Scope`. 77 rpc DeleteMonitoredProject(DeleteMonitoredProjectRequest) returns (google.longrunning.Operation) { 78 option (google.api.http) = { 79 delete: "/v1/{name=locations/global/metricsScopes/*/projects/*}" 80 }; 81 option (google.api.method_signature) = "name"; 82 option (google.longrunning.operation_info) = { 83 response_type: "google.protobuf.Empty" 84 metadata_type: "OperationMetadata" 85 }; 86 } 87} 88 89// Request for the `GetMetricsScope` method. 90message GetMetricsScopeRequest { 91 // Required. The resource name of the `Metrics Scope`. 92 // Example: 93 // `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}` 94 string name = 1 [ 95 (google.api.field_behavior) = REQUIRED, 96 (google.api.resource_reference) = { 97 type: "monitoring.googleapis.com/MetricsScope" 98 } 99 ]; 100} 101 102// Request for the `ListMetricsScopesByMonitoredProject` method. 103message ListMetricsScopesByMonitoredProjectRequest { 104 // Required. The resource name of the `Monitored Project` being requested. 105 // Example: 106 // `projects/{MONITORED_PROJECT_ID_OR_NUMBER}` 107 string monitored_resource_container = 1 [(google.api.field_behavior) = REQUIRED]; 108} 109 110// Response for the `ListMetricsScopesByMonitoredProject` method. 111message ListMetricsScopesByMonitoredProjectResponse { 112 // A set of all metrics scopes that the specified monitored project has been 113 // added to. 114 repeated MetricsScope metrics_scopes = 1; 115} 116 117// Request for the `CreateMonitoredProject` method. 118message CreateMonitoredProjectRequest { 119 // Required. The resource name of the existing `Metrics Scope` that will monitor this 120 // project. 121 // Example: 122 // `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}` 123 string parent = 1 [ 124 (google.api.field_behavior) = REQUIRED, 125 (google.api.resource_reference) = { 126 type: "monitoring.googleapis.com/MetricsScope" 127 } 128 ]; 129 130 // Required. The initial `MonitoredProject` configuration. 131 // Specify only the `monitored_project.name` field. All other fields are 132 // ignored. The `monitored_project.name` must be in the format: 133 // `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}` 134 MonitoredProject monitored_project = 2 [(google.api.field_behavior) = REQUIRED]; 135} 136 137// Request for the `DeleteMonitoredProject` method. 138message DeleteMonitoredProjectRequest { 139 // Required. The resource name of the `MonitoredProject`. 140 // Example: 141 // `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}` 142 // 143 // Authorization requires the following [Google 144 // IAM](https://cloud.google.com/iam) permissions on both the `Metrics Scope` 145 // and on the `MonitoredProject`: `monitoring.metricsScopes.link` 146 string name = 1 [ 147 (google.api.field_behavior) = REQUIRED, 148 (google.api.resource_reference) = { 149 type: "monitoring.googleapis.com/MonitoredProject" 150 } 151 ]; 152} 153 154// Contains metadata for longrunning operation for the edit Metrics Scope 155// endpoints. 156message OperationMetadata { 157 // Batch operation states. 158 enum State { 159 // Invalid. 160 STATE_UNSPECIFIED = 0; 161 162 // Request has been received. 163 CREATED = 1; 164 165 // Request is actively being processed. 166 RUNNING = 2; 167 168 // The batch processing is done. 169 DONE = 3; 170 171 // The batch processing was cancelled. 172 CANCELLED = 4; 173 } 174 175 // Current state of the batch operation. 176 State state = 1; 177 178 // The time when the batch request was received. 179 google.protobuf.Timestamp create_time = 5; 180 181 // The time when the operation result was last updated. 182 google.protobuf.Timestamp update_time = 6; 183} 184