metrics_scopes.proto 6.7 KB

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