initial commit

This commit is contained in:
2025-09-01 22:12:29 +02:00
parent b1873f9c1d
commit 02a54f61c0
5598 changed files with 903558 additions and 0 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,31 @@
// Copyright 2015 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
import "google/api/http.proto";
import "google/protobuf/descriptor.proto";
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
option java_multiple_files = true;
option java_outer_classname = "AnnotationsProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
extend google.protobuf.MethodOptions {
// See `HttpRule`.
HttpRule http = 72295728;
}

View File

@@ -0,0 +1,288 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api.apikeys.v2;
import "google/api/annotations.proto";
import "google/api/apikeys/v2/resources.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/longrunning/operations.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
option csharp_namespace = "Google.Cloud.ApiKeys.V2";
option go_package = "cloud.google.com/go/apikeys/apiv2/apikeyspb;apikeyspb";
option java_multiple_files = true;
option java_outer_classname = "ApiKeysProto";
option java_package = "com.google.api.apikeys.v2";
option php_namespace = "Google\\Cloud\\ApiKeys\\V2";
option ruby_package = "Google::Cloud::ApiKeys::V2";
// Manages the API keys associated with projects.
service ApiKeys {
option (google.api.default_host) = "apikeys.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform,"
"https://www.googleapis.com/auth/cloud-platform.read-only";
// Creates a new API key.
//
// NOTE: Key is a global resource; hence the only supported value for
// location is `global`.
rpc CreateKey(CreateKeyRequest) returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v2/{parent=projects/*/locations/*}/keys"
body: "key"
};
option (google.api.method_signature) = "parent,key,key_id";
option (google.longrunning.operation_info) = {
response_type: "Key"
metadata_type: "google.protobuf.Empty"
};
}
// Lists the API keys owned by a project. The key string of the API key
// isn't included in the response.
//
// NOTE: Key is a global resource; hence the only supported value for
// location is `global`.
rpc ListKeys(ListKeysRequest) returns (ListKeysResponse) {
option (google.api.http) = {
get: "/v2/{parent=projects/*/locations/*}/keys"
};
option (google.api.method_signature) = "parent";
}
// Gets the metadata for an API key. The key string of the API key
// isn't included in the response.
//
// NOTE: Key is a global resource; hence the only supported value for
// location is `global`.
rpc GetKey(GetKeyRequest) returns (Key) {
option (google.api.http) = {
get: "/v2/{name=projects/*/locations/*/keys/*}"
};
option (google.api.method_signature) = "name";
}
// Get the key string for an API key.
//
// NOTE: Key is a global resource; hence the only supported value for
// location is `global`.
rpc GetKeyString(GetKeyStringRequest) returns (GetKeyStringResponse) {
option (google.api.http) = {
get: "/v2/{name=projects/*/locations/*/keys/*}/keyString"
};
option (google.api.method_signature) = "name";
}
// Patches the modifiable fields of an API key.
// The key string of the API key isn't included in the response.
//
// NOTE: Key is a global resource; hence the only supported value for
// location is `global`.
rpc UpdateKey(UpdateKeyRequest) returns (google.longrunning.Operation) {
option (google.api.http) = {
patch: "/v2/{key.name=projects/*/locations/*/keys/*}"
body: "key"
};
option (google.api.method_signature) = "key,update_mask";
option (google.longrunning.operation_info) = {
response_type: "Key"
metadata_type: "google.protobuf.Empty"
};
}
// Deletes an API key. Deleted key can be retrieved within 30 days of
// deletion. Afterward, key will be purged from the project.
//
// NOTE: Key is a global resource; hence the only supported value for
// location is `global`.
rpc DeleteKey(DeleteKeyRequest) returns (google.longrunning.Operation) {
option (google.api.http) = {
delete: "/v2/{name=projects/*/locations/*/keys/*}"
};
option (google.api.method_signature) = "name";
option (google.longrunning.operation_info) = {
response_type: "Key"
metadata_type: "google.protobuf.Empty"
};
}
// Undeletes an API key which was deleted within 30 days.
//
// NOTE: Key is a global resource; hence the only supported value for
// location is `global`.
rpc UndeleteKey(UndeleteKeyRequest) returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v2/{name=projects/*/locations/*/keys/*}:undelete"
body: "*"
};
option (google.longrunning.operation_info) = {
response_type: "Key"
metadata_type: "google.protobuf.Empty"
};
}
// Find the parent project and resource name of the API
// key that matches the key string in the request. If the API key has been
// purged, resource name will not be set.
// The service account must have the `apikeys.keys.lookup` permission
// on the parent project.
rpc LookupKey(LookupKeyRequest) returns (LookupKeyResponse) {
option (google.api.http) = {
get: "/v2/keys:lookupKey"
};
}
}
// Request message for `CreateKey` method.
message CreateKeyRequest {
// Required. The project in which the API key is created.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "apikeys.googleapis.com/Key"
}
];
// Required. The API key fields to set at creation time.
// You can configure only the `display_name`, `restrictions`, and
// `annotations` fields.
Key key = 2 [(google.api.field_behavior) = REQUIRED];
// User specified key id (optional). If specified, it will become the final
// component of the key resource name.
//
// The id must be unique within the project, must conform with RFC-1034,
// is restricted to lower-cased letters, and has a maximum length of 63
// characters. In another word, the id must match the regular
// expression: `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`.
//
// The id must NOT be a UUID-like string.
string key_id = 3;
}
// Request message for `ListKeys` method.
message ListKeysRequest {
// Required. Lists all API keys associated with this project.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "apikeys.googleapis.com/Key"
}
];
// Optional. Specifies the maximum number of results to be returned at a time.
int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
// Optional. Requests a specific page of results.
string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
// Optional. Indicate that keys deleted in the past 30 days should also be
// returned.
bool show_deleted = 6 [(google.api.field_behavior) = OPTIONAL];
}
// Response message for `ListKeys` method.
message ListKeysResponse {
// A list of API keys.
repeated Key keys = 1;
// The pagination token for the next page of results.
string next_page_token = 2;
}
// Request message for `GetKey` method.
message GetKeyRequest {
// Required. The resource name of the API key to get.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "apikeys.googleapis.com/Key" }
];
}
// Request message for `GetKeyString` method.
message GetKeyStringRequest {
// Required. The resource name of the API key to be retrieved.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "apikeys.googleapis.com/Key" }
];
}
// Response message for `GetKeyString` method.
message GetKeyStringResponse {
// An encrypted and signed value of the key.
string key_string = 1;
}
// Request message for `UpdateKey` method.
message UpdateKeyRequest {
// Required. Set the `name` field to the resource name of the API key to be
// updated. You can update only the `display_name`, `restrictions`, and
// `annotations` fields.
Key key = 1 [(google.api.field_behavior) = REQUIRED];
// The field mask specifies which fields to be updated as part of this
// request. All other fields are ignored.
// Mutable fields are: `display_name`, `restrictions`, and `annotations`.
// If an update mask is not provided, the service treats it as an implied mask
// equivalent to all allowed fields that are set on the wire. If the field
// mask has a special value "*", the service treats it equivalent to replace
// all allowed mutable fields.
google.protobuf.FieldMask update_mask = 2;
}
// Request message for `DeleteKey` method.
message DeleteKeyRequest {
// Required. The resource name of the API key to be deleted.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "apikeys.googleapis.com/Key" }
];
// Optional. The etag known to the client for the expected state of the key.
// This is to be used for optimistic concurrency.
string etag = 2 [(google.api.field_behavior) = OPTIONAL];
}
// Request message for `UndeleteKey` method.
message UndeleteKeyRequest {
// Required. The resource name of the API key to be undeleted.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "apikeys.googleapis.com/Key" }
];
}
// Request message for `LookupKey` method.
message LookupKeyRequest {
// Required. Finds the project that owns the key string value.
string key_string = 1 [(google.api.field_behavior) = REQUIRED];
}
// Response message for `LookupKey` method.
message LookupKeyResponse {
// The project that owns the key with the value specified in the request.
string parent = 1;
// The resource name of the API key. If the API key has been purged,
// resource name is empty.
string name = 2;
}

View File

@@ -0,0 +1,175 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api.apikeys.v2;
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/timestamp.proto";
option csharp_namespace = "Google.Cloud.ApiKeys.V2";
option go_package = "cloud.google.com/go/apikeys/apiv2/apikeyspb;apikeyspb";
option java_multiple_files = true;
option java_outer_classname = "ResourcesProto";
option java_package = "com.google.api.apikeys.v2";
option php_namespace = "Google\\Cloud\\ApiKeys\\V2";
option ruby_package = "Google::Cloud::ApiKeys::V2";
// The representation of a key managed by the API Keys API.
message Key {
option (google.api.resource) = {
type: "apikeys.googleapis.com/Key"
pattern: "projects/{project}/locations/{location}/keys/{key}"
plural: "keys"
singular: "key"
style: DECLARATIVE_FRIENDLY
};
// Output only. The resource name of the key.
// The `name` has the form:
// `projects/<PROJECT_NUMBER>/locations/global/keys/<KEY_ID>`.
// For example:
// `projects/123456867718/locations/global/keys/b7ff1f9f-8275-410a-94dd-3855ee9b5dd2`
//
// NOTE: Key is a global resource; hence the only supported value for
// location is `global`.
string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. Unique id in UUID4 format.
string uid = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
// Human-readable display name of this key that you can modify.
// The maximum length is 63 characters.
string display_name = 2;
// Output only. An encrypted and signed value held by this key.
// This field can be accessed only through the `GetKeyString` method.
string key_string = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. A timestamp identifying the time this key was originally
// created.
google.protobuf.Timestamp create_time = 4
[(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. A timestamp identifying the time this key was last
// updated.
google.protobuf.Timestamp update_time = 6
[(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. A timestamp when this key was deleted. If the resource is not
// deleted, this must be empty.
google.protobuf.Timestamp delete_time = 7
[(google.api.field_behavior) = OUTPUT_ONLY];
// Annotations is an unstructured key-value map stored with a policy that
// may be set by external tools to store and retrieve arbitrary metadata.
// They are not queryable and should be preserved when modifying objects.
map<string, string> annotations = 8;
// Key restrictions.
Restrictions restrictions = 9;
// Output only. A checksum computed by the server based on the current value
// of the Key resource. This may be sent on update and delete requests to
// ensure the client has an up-to-date value before proceeding. See
// https://google.aip.dev/154.
string etag = 11 [(google.api.field_behavior) = OUTPUT_ONLY];
}
// Describes the restrictions on the key.
message Restrictions {
// The websites, IP addresses, Android apps, or iOS apps (the clients) that
// are allowed to use the key. You can specify only one type of client
// restrictions per key.
oneof client_restrictions {
// The HTTP referrers (websites) that are allowed to use the key.
BrowserKeyRestrictions browser_key_restrictions = 1;
// The IP addresses of callers that are allowed to use the key.
ServerKeyRestrictions server_key_restrictions = 2;
// The Android apps that are allowed to use the key.
AndroidKeyRestrictions android_key_restrictions = 3;
// The iOS apps that are allowed to use the key.
IosKeyRestrictions ios_key_restrictions = 4;
}
// A restriction for a specific service and optionally one or
// more specific methods. Requests are allowed if they
// match any of these restrictions. If no restrictions are
// specified, all targets are allowed.
repeated ApiTarget api_targets = 5;
}
// The HTTP referrers (websites) that are allowed to use the key.
message BrowserKeyRestrictions {
// A list of regular expressions for the referrer URLs that are allowed
// to make API calls with this key.
repeated string allowed_referrers = 1;
}
// The IP addresses of callers that are allowed to use the key.
message ServerKeyRestrictions {
// A list of the caller IP addresses that are allowed to make API calls
// with this key.
repeated string allowed_ips = 1;
}
// The Android apps that are allowed to use the key.
message AndroidKeyRestrictions {
// A list of Android applications that are allowed to make API calls with
// this key.
repeated AndroidApplication allowed_applications = 1;
}
// Identifier of an Android application for key use.
message AndroidApplication {
// The SHA1 fingerprint of the application. For example, both sha1 formats are
// acceptable : DA:39:A3:EE:5E:6B:4B:0D:32:55:BF:EF:95:60:18:90:AF:D8:07:09 or
// DA39A3EE5E6B4B0D3255BFEF95601890AFD80709.
// Output format is the latter.
string sha1_fingerprint = 1;
// The package name of the application.
string package_name = 2;
}
// The iOS apps that are allowed to use the key.
message IosKeyRestrictions {
// A list of bundle IDs that are allowed when making API calls with this key.
repeated string allowed_bundle_ids = 1;
}
// A restriction for a specific service and optionally one or multiple
// specific methods. Both fields are case insensitive.
message ApiTarget {
// The service for this restriction. It should be the canonical
// service name, for example: `translate.googleapis.com`.
// You can use [`gcloud services list`](/sdk/gcloud/reference/services/list)
// to get a list of services that are enabled in the project.
string service = 1;
// Optional. List of one or more methods that can be called.
// If empty, all methods for the service are allowed. A wildcard
// (*) can be used as the last symbol.
// Valid examples:
// `google.cloud.translate.v2.TranslateService.GetSupportedLanguage`
// `TranslateText`
// `Get*`
// `translate.googleapis.com.Get*`
repeated string methods = 2 [(google.api.field_behavior) = OPTIONAL];
}

View File

@@ -0,0 +1,237 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
option java_multiple_files = true;
option java_outer_classname = "AuthProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// `Authentication` defines the authentication configuration for API methods
// provided by an API service.
//
// Example:
//
// name: calendar.googleapis.com
// authentication:
// providers:
// - id: google_calendar_auth
// jwks_uri: https://www.googleapis.com/oauth2/v1/certs
// issuer: https://securetoken.google.com
// rules:
// - selector: "*"
// requirements:
// provider_id: google_calendar_auth
// - selector: google.calendar.Delegate
// oauth:
// canonical_scopes: https://www.googleapis.com/auth/calendar.read
message Authentication {
// A list of authentication rules that apply to individual API methods.
//
// **NOTE:** All service configuration rules follow "last one wins" order.
repeated AuthenticationRule rules = 3;
// Defines a set of authentication providers that a service supports.
repeated AuthProvider providers = 4;
}
// Authentication rules for the service.
//
// By default, if a method has any authentication requirements, every request
// must include a valid credential matching one of the requirements.
// It's an error to include more than one kind of credential in a single
// request.
//
// If a method doesn't have any auth requirements, request credentials will be
// ignored.
message AuthenticationRule {
// Selects the methods to which this rule applies.
//
// Refer to [selector][google.api.DocumentationRule.selector] for syntax
// details.
string selector = 1;
// The requirements for OAuth credentials.
OAuthRequirements oauth = 2;
// If true, the service accepts API keys without any other credential.
// This flag only applies to HTTP and gRPC requests.
bool allow_without_credential = 5;
// Requirements for additional authentication providers.
repeated AuthRequirement requirements = 7;
}
// Specifies a location to extract JWT from an API request.
message JwtLocation {
oneof in {
// Specifies HTTP header name to extract JWT token.
string header = 1;
// Specifies URL query parameter name to extract JWT token.
string query = 2;
// Specifies cookie name to extract JWT token.
string cookie = 4;
}
// The value prefix. The value format is "value_prefix{token}"
// Only applies to "in" header type. Must be empty for "in" query type.
// If not empty, the header value has to match (case sensitive) this prefix.
// If not matched, JWT will not be extracted. If matched, JWT will be
// extracted after the prefix is removed.
//
// For example, for "Authorization: Bearer {JWT}",
// value_prefix="Bearer " with a space at the end.
string value_prefix = 3;
}
// Configuration for an authentication provider, including support for
// [JSON Web Token
// (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32).
message AuthProvider {
// The unique identifier of the auth provider. It will be referred to by
// `AuthRequirement.provider_id`.
//
// Example: "bookstore_auth".
string id = 1;
// Identifies the principal that issued the JWT. See
// https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.1
// Usually a URL or an email address.
//
// Example: https://securetoken.google.com
// Example: 1234567-compute@developer.gserviceaccount.com
string issuer = 2;
// URL of the provider's public key set to validate signature of the JWT. See
// [OpenID
// Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata).
// Optional if the key set document:
// - can be retrieved from
// [OpenID
// Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html)
// of the issuer.
// - can be inferred from the email domain of the issuer (e.g. a Google
// service account).
//
// Example: https://www.googleapis.com/oauth2/v1/certs
string jwks_uri = 3;
// The list of JWT
// [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).
// that are allowed to access. A JWT containing any of these audiences will
// be accepted. When this setting is absent, JWTs with audiences:
// - "https://[service.name]/[google.protobuf.Api.name]"
// - "https://[service.name]/"
// will be accepted.
// For example, if no audiences are in the setting, LibraryService API will
// accept JWTs with the following audiences:
// -
// https://library-example.googleapis.com/google.example.library.v1.LibraryService
// - https://library-example.googleapis.com/
//
// Example:
//
// audiences: bookstore_android.apps.googleusercontent.com,
// bookstore_web.apps.googleusercontent.com
string audiences = 4;
// Redirect URL if JWT token is required but not present or is expired.
// Implement authorizationUrl of securityDefinitions in OpenAPI spec.
string authorization_url = 5;
// Defines the locations to extract the JWT. For now it is only used by the
// Cloud Endpoints to store the OpenAPI extension [x-google-jwt-locations]
// (https://cloud.google.com/endpoints/docs/openapi/openapi-extensions#x-google-jwt-locations)
//
// JWT locations can be one of HTTP headers, URL query parameters or
// cookies. The rule is that the first match wins.
//
// If not specified, default to use following 3 locations:
// 1) Authorization: Bearer
// 2) x-goog-iap-jwt-assertion
// 3) access_token query parameter
//
// Default locations can be specified as followings:
// jwt_locations:
// - header: Authorization
// value_prefix: "Bearer "
// - header: x-goog-iap-jwt-assertion
// - query: access_token
repeated JwtLocation jwt_locations = 6;
}
// OAuth scopes are a way to define data and permissions on data. For example,
// there are scopes defined for "Read-only access to Google Calendar" and
// "Access to Cloud Platform". Users can consent to a scope for an application,
// giving it permission to access that data on their behalf.
//
// OAuth scope specifications should be fairly coarse grained; a user will need
// to see and understand the text description of what your scope means.
//
// In most cases: use one or at most two OAuth scopes for an entire family of
// products. If your product has multiple APIs, you should probably be sharing
// the OAuth scope across all of those APIs.
//
// When you need finer grained OAuth consent screens: talk with your product
// management about how developers will use them in practice.
//
// Please note that even though each of the canonical scopes is enough for a
// request to be accepted and passed to the backend, a request can still fail
// due to the backend requiring additional scopes or permissions.
message OAuthRequirements {
// The list of publicly documented OAuth scopes that are allowed access. An
// OAuth token containing any of these scopes will be accepted.
//
// Example:
//
// canonical_scopes: https://www.googleapis.com/auth/calendar,
// https://www.googleapis.com/auth/calendar.read
string canonical_scopes = 1;
}
// User-defined authentication requirements, including support for
// [JSON Web Token
// (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32).
message AuthRequirement {
// [id][google.api.AuthProvider.id] from authentication provider.
//
// Example:
//
// provider_id: bookstore_auth
string provider_id = 1;
// NOTE: This will be deprecated soon, once AuthProvider.audiences is
// implemented and accepted in all the runtime components.
//
// The list of JWT
// [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).
// that are allowed to access. A JWT containing any of these audiences will
// be accepted. When this setting is absent, only JWTs with audience
// "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]"
// will be accepted. For example, if no audiences are in the setting,
// LibraryService API will only accept JWTs with the following audience
// "https://library-example.googleapis.com/google.example.library.v1.LibraryService".
//
// Example:
//
// audiences: bookstore_android.apps.googleusercontent.com,
// bookstore_web.apps.googleusercontent.com
string audiences = 2;
}

View File

@@ -0,0 +1,185 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
option java_multiple_files = true;
option java_outer_classname = "BackendProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// `Backend` defines the backend configuration for a service.
message Backend {
// A list of API backend rules that apply to individual API methods.
//
// **NOTE:** All service configuration rules follow "last one wins" order.
repeated BackendRule rules = 1;
}
// A backend rule provides configuration for an individual API element.
message BackendRule {
// Path Translation specifies how to combine the backend address with the
// request path in order to produce the appropriate forwarding URL for the
// request.
//
// Path Translation is applicable only to HTTP-based backends. Backends which
// do not accept requests over HTTP/HTTPS should leave `path_translation`
// unspecified.
enum PathTranslation {
PATH_TRANSLATION_UNSPECIFIED = 0;
// Use the backend address as-is, with no modification to the path. If the
// URL pattern contains variables, the variable names and values will be
// appended to the query string. If a query string parameter and a URL
// pattern variable have the same name, this may result in duplicate keys in
// the query string.
//
// # Examples
//
// Given the following operation config:
//
// Method path: /api/company/{cid}/user/{uid}
// Backend address: https://example.cloudfunctions.net/getUser
//
// Requests to the following request paths will call the backend at the
// translated path:
//
// Request path: /api/company/widgetworks/user/johndoe
// Translated:
// https://example.cloudfunctions.net/getUser?cid=widgetworks&uid=johndoe
//
// Request path: /api/company/widgetworks/user/johndoe?timezone=EST
// Translated:
// https://example.cloudfunctions.net/getUser?timezone=EST&cid=widgetworks&uid=johndoe
CONSTANT_ADDRESS = 1;
// The request path will be appended to the backend address.
//
// # Examples
//
// Given the following operation config:
//
// Method path: /api/company/{cid}/user/{uid}
// Backend address: https://example.appspot.com
//
// Requests to the following request paths will call the backend at the
// translated path:
//
// Request path: /api/company/widgetworks/user/johndoe
// Translated:
// https://example.appspot.com/api/company/widgetworks/user/johndoe
//
// Request path: /api/company/widgetworks/user/johndoe?timezone=EST
// Translated:
// https://example.appspot.com/api/company/widgetworks/user/johndoe?timezone=EST
APPEND_PATH_TO_ADDRESS = 2;
}
// Selects the methods to which this rule applies.
//
// Refer to [selector][google.api.DocumentationRule.selector] for syntax
// details.
string selector = 1;
// The address of the API backend.
//
// The scheme is used to determine the backend protocol and security.
// The following schemes are accepted:
//
// SCHEME PROTOCOL SECURITY
// http:// HTTP None
// https:// HTTP TLS
// grpc:// gRPC None
// grpcs:// gRPC TLS
//
// It is recommended to explicitly include a scheme. Leaving out the scheme
// may cause constrasting behaviors across platforms.
//
// If the port is unspecified, the default is:
// - 80 for schemes without TLS
// - 443 for schemes with TLS
//
// For HTTP backends, use [protocol][google.api.BackendRule.protocol]
// to specify the protocol version.
string address = 2;
// The number of seconds to wait for a response from a request. The default
// varies based on the request protocol and deployment environment.
double deadline = 3;
// Deprecated, do not use.
double min_deadline = 4 [deprecated = true];
// The number of seconds to wait for the completion of a long running
// operation. The default is no deadline.
double operation_deadline = 5;
PathTranslation path_translation = 6;
// Authentication settings used by the backend.
//
// These are typically used to provide service management functionality to
// a backend served on a publicly-routable URL. The `authentication`
// details should match the authentication behavior used by the backend.
//
// For example, specifying `jwt_audience` implies that the backend expects
// authentication via a JWT.
//
// When authentication is unspecified, the resulting behavior is the same
// as `disable_auth` set to `true`.
//
// Refer to https://developers.google.com/identity/protocols/OpenIDConnect for
// JWT ID token.
oneof authentication {
// The JWT audience is used when generating a JWT ID token for the backend.
// This ID token will be added in the HTTP "authorization" header, and sent
// to the backend.
string jwt_audience = 7;
// When disable_auth is true, a JWT ID token won't be generated and the
// original "Authorization" HTTP header will be preserved. If the header is
// used to carry the original token and is expected by the backend, this
// field must be set to true to preserve the header.
bool disable_auth = 8;
}
// The protocol used for sending a request to the backend.
// The supported values are "http/1.1" and "h2".
//
// The default value is inferred from the scheme in the
// [address][google.api.BackendRule.address] field:
//
// SCHEME PROTOCOL
// http:// http/1.1
// https:// http/1.1
// grpc:// h2
// grpcs:// h2
//
// For secure HTTP backends (https://) that support HTTP/2, set this field
// to "h2" for improved performance.
//
// Configuring this field to non-default values is only supported for secure
// HTTP backends. This field will be ignored for all other backends.
//
// See
// https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids
// for more details on the supported values.
string protocol = 9;
// The map between request protocol and the backend address.
map<string, BackendRule> overrides_by_request_protocol = 10;
}

View File

@@ -0,0 +1,77 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
option java_multiple_files = true;
option java_outer_classname = "BillingProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// Billing related configuration of the service.
//
// The following example shows how to configure monitored resources and metrics
// for billing, `consumer_destinations` is the only supported destination and
// the monitored resources need at least one label key
// `cloud.googleapis.com/location` to indicate the location of the billing
// usage, using different monitored resources between monitoring and billing is
// recommended so they can be evolved independently:
//
//
// monitored_resources:
// - type: library.googleapis.com/billing_branch
// labels:
// - key: cloud.googleapis.com/location
// description: |
// Predefined label to support billing location restriction.
// - key: city
// description: |
// Custom label to define the city where the library branch is located
// in.
// - key: name
// description: Custom label to define the name of the library branch.
// metrics:
// - name: library.googleapis.com/book/borrowed_count
// metric_kind: DELTA
// value_type: INT64
// unit: "1"
// billing:
// consumer_destinations:
// - monitored_resource: library.googleapis.com/billing_branch
// metrics:
// - library.googleapis.com/book/borrowed_count
message Billing {
// Configuration of a specific billing destination (Currently only support
// bill against consumer project).
message BillingDestination {
// The monitored resource type. The type must be defined in
// [Service.monitored_resources][google.api.Service.monitored_resources]
// section.
string monitored_resource = 1;
// Names of the metrics to report to this billing destination.
// Each name must be defined in
// [Service.metrics][google.api.Service.metrics] section.
repeated string metrics = 2;
}
// Billing configurations for sending metrics to the consumer project.
// There can be multiple consumer destinations per service, each one must have
// a different monitored resource type. A metric can be used in at most
// one consumer destination.
repeated BillingDestination consumer_destinations = 8;
}

View File

@@ -0,0 +1,427 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
import "google/api/launch_stage.proto";
import "google/protobuf/descriptor.proto";
import "google/protobuf/duration.proto";
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
option java_multiple_files = true;
option java_outer_classname = "ClientProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
extend google.protobuf.MethodOptions {
// A definition of a client library method signature.
//
// In client libraries, each proto RPC corresponds to one or more methods
// which the end user is able to call, and calls the underlying RPC.
// Normally, this method receives a single argument (a struct or instance
// corresponding to the RPC request object). Defining this field will
// add one or more overloads providing flattened or simpler method signatures
// in some languages.
//
// The fields on the method signature are provided as a comma-separated
// string.
//
// For example, the proto RPC and annotation:
//
// rpc CreateSubscription(CreateSubscriptionRequest)
// returns (Subscription) {
// option (google.api.method_signature) = "name,topic";
// }
//
// Would add the following Java overload (in addition to the method accepting
// the request object):
//
// public final Subscription createSubscription(String name, String topic)
//
// The following backwards-compatibility guidelines apply:
//
// * Adding this annotation to an unannotated method is backwards
// compatible.
// * Adding this annotation to a method which already has existing
// method signature annotations is backwards compatible if and only if
// the new method signature annotation is last in the sequence.
// * Modifying or removing an existing method signature annotation is
// a breaking change.
// * Re-ordering existing method signature annotations is a breaking
// change.
repeated string method_signature = 1051;
}
extend google.protobuf.ServiceOptions {
// The hostname for this service.
// This should be specified with no prefix or protocol.
//
// Example:
//
// service Foo {
// option (google.api.default_host) = "foo.googleapi.com";
// ...
// }
string default_host = 1049;
// OAuth scopes needed for the client.
//
// Example:
//
// service Foo {
// option (google.api.oauth_scopes) = \
// "https://www.googleapis.com/auth/cloud-platform";
// ...
// }
//
// If there is more than one scope, use a comma-separated string:
//
// Example:
//
// service Foo {
// option (google.api.oauth_scopes) = \
// "https://www.googleapis.com/auth/cloud-platform,"
// "https://www.googleapis.com/auth/monitoring";
// ...
// }
string oauth_scopes = 1050;
// The API version of this service, which should be sent by version-aware
// clients to the service. This allows services to abide by the schema and
// behavior of the service at the time this API version was deployed.
// The format of the API version must be treated as opaque by clients.
// Services may use a format with an apparent structure, but clients must
// not rely on this to determine components within an API version, or attempt
// to construct other valid API versions. Note that this is for upcoming
// functionality and may not be implemented for all services.
//
// Example:
//
// service Foo {
// option (google.api.api_version) = "v1_20230821_preview";
// }
string api_version = 525000001;
}
// Required information for every language.
message CommonLanguageSettings {
// Link to automatically generated reference documentation. Example:
// https://cloud.google.com/nodejs/docs/reference/asset/latest
string reference_docs_uri = 1 [deprecated = true];
// The destination where API teams want this client library to be published.
repeated ClientLibraryDestination destinations = 2;
}
// Details about how and where to publish client libraries.
message ClientLibrarySettings {
// Version of the API to apply these settings to. This is the full protobuf
// package for the API, ending in the version element.
// Examples: "google.cloud.speech.v1" and "google.spanner.admin.database.v1".
string version = 1;
// Launch stage of this version of the API.
LaunchStage launch_stage = 2;
// When using transport=rest, the client request will encode enums as
// numbers rather than strings.
bool rest_numeric_enums = 3;
// Settings for legacy Java features, supported in the Service YAML.
JavaSettings java_settings = 21;
// Settings for C++ client libraries.
CppSettings cpp_settings = 22;
// Settings for PHP client libraries.
PhpSettings php_settings = 23;
// Settings for Python client libraries.
PythonSettings python_settings = 24;
// Settings for Node client libraries.
NodeSettings node_settings = 25;
// Settings for .NET client libraries.
DotnetSettings dotnet_settings = 26;
// Settings for Ruby client libraries.
RubySettings ruby_settings = 27;
// Settings for Go client libraries.
GoSettings go_settings = 28;
}
// This message configures the settings for publishing [Google Cloud Client
// libraries](https://cloud.google.com/apis/docs/cloud-client-libraries)
// generated from the service config.
message Publishing {
// A list of API method settings, e.g. the behavior for methods that use the
// long-running operation pattern.
repeated MethodSettings method_settings = 2;
// Link to a *public* URI where users can report issues. Example:
// https://issuetracker.google.com/issues/new?component=190865&template=1161103
string new_issue_uri = 101;
// Link to product home page. Example:
// https://cloud.google.com/asset-inventory/docs/overview
string documentation_uri = 102;
// Used as a tracking tag when collecting data about the APIs developer
// relations artifacts like docs, packages delivered to package managers,
// etc. Example: "speech".
string api_short_name = 103;
// GitHub label to apply to issues and pull requests opened for this API.
string github_label = 104;
// GitHub teams to be added to CODEOWNERS in the directory in GitHub
// containing source code for the client libraries for this API.
repeated string codeowner_github_teams = 105;
// A prefix used in sample code when demarking regions to be included in
// documentation.
string doc_tag_prefix = 106;
// For whom the client library is being published.
ClientLibraryOrganization organization = 107;
// Client library settings. If the same version string appears multiple
// times in this list, then the last one wins. Settings from earlier
// settings with the same version string are discarded.
repeated ClientLibrarySettings library_settings = 109;
// Optional link to proto reference documentation. Example:
// https://cloud.google.com/pubsub/lite/docs/reference/rpc
string proto_reference_documentation_uri = 110;
// Optional link to REST reference documentation. Example:
// https://cloud.google.com/pubsub/lite/docs/reference/rest
string rest_reference_documentation_uri = 111;
}
// Settings for Java client libraries.
message JavaSettings {
// The package name to use in Java. Clobbers the java_package option
// set in the protobuf. This should be used **only** by APIs
// who have already set the language_settings.java.package_name" field
// in gapic.yaml. API teams should use the protobuf java_package option
// where possible.
//
// Example of a YAML configuration::
//
// publishing:
// java_settings:
// library_package: com.google.cloud.pubsub.v1
string library_package = 1;
// Configure the Java class name to use instead of the service's for its
// corresponding generated GAPIC client. Keys are fully-qualified
// service names as they appear in the protobuf (including the full
// the language_settings.java.interface_names" field in gapic.yaml. API
// teams should otherwise use the service name as it appears in the
// protobuf.
//
// Example of a YAML configuration::
//
// publishing:
// java_settings:
// service_class_names:
// - google.pubsub.v1.Publisher: TopicAdmin
// - google.pubsub.v1.Subscriber: SubscriptionAdmin
map<string, string> service_class_names = 2;
// Some settings.
CommonLanguageSettings common = 3;
}
// Settings for C++ client libraries.
message CppSettings {
// Some settings.
CommonLanguageSettings common = 1;
}
// Settings for Php client libraries.
message PhpSettings {
// Some settings.
CommonLanguageSettings common = 1;
}
// Settings for Python client libraries.
message PythonSettings {
// Some settings.
CommonLanguageSettings common = 1;
}
// Settings for Node client libraries.
message NodeSettings {
// Some settings.
CommonLanguageSettings common = 1;
}
// Settings for Dotnet client libraries.
message DotnetSettings {
// Some settings.
CommonLanguageSettings common = 1;
// Map from original service names to renamed versions.
// This is used when the default generated types
// would cause a naming conflict. (Neither name is
// fully-qualified.)
// Example: Subscriber to SubscriberServiceApi.
map<string, string> renamed_services = 2;
// Map from full resource types to the effective short name
// for the resource. This is used when otherwise resource
// named from different services would cause naming collisions.
// Example entry:
// "datalabeling.googleapis.com/Dataset": "DataLabelingDataset"
map<string, string> renamed_resources = 3;
// List of full resource types to ignore during generation.
// This is typically used for API-specific Location resources,
// which should be handled by the generator as if they were actually
// the common Location resources.
// Example entry: "documentai.googleapis.com/Location"
repeated string ignored_resources = 4;
// Namespaces which must be aliased in snippets due to
// a known (but non-generator-predictable) naming collision
repeated string forced_namespace_aliases = 5;
// Method signatures (in the form "service.method(signature)")
// which are provided separately, so shouldn't be generated.
// Snippets *calling* these methods are still generated, however.
repeated string handwritten_signatures = 6;
}
// Settings for Ruby client libraries.
message RubySettings {
// Some settings.
CommonLanguageSettings common = 1;
}
// Settings for Go client libraries.
message GoSettings {
// Some settings.
CommonLanguageSettings common = 1;
}
// Describes the generator configuration for a method.
message MethodSettings {
// Describes settings to use when generating API methods that use the
// long-running operation pattern.
// All default values below are from those used in the client library
// generators (e.g.
// [Java](https://github.com/googleapis/gapic-generator-java/blob/04c2faa191a9b5a10b92392fe8482279c4404803/src/main/java/com/google/api/generator/gapic/composer/common/RetrySettingsComposer.java)).
message LongRunning {
// Initial delay after which the first poll request will be made.
// Default value: 5 seconds.
google.protobuf.Duration initial_poll_delay = 1;
// Multiplier to gradually increase delay between subsequent polls until it
// reaches max_poll_delay.
// Default value: 1.5.
float poll_delay_multiplier = 2;
// Maximum time between two subsequent poll requests.
// Default value: 45 seconds.
google.protobuf.Duration max_poll_delay = 3;
// Total polling timeout.
// Default value: 5 minutes.
google.protobuf.Duration total_poll_timeout = 4;
}
// The fully qualified name of the method, for which the options below apply.
// This is used to find the method to apply the options.
string selector = 1;
// Describes settings to use for long-running operations when generating
// API methods for RPCs. Complements RPCs that use the annotations in
// google/longrunning/operations.proto.
//
// Example of a YAML configuration::
//
// publishing:
// method_settings:
// - selector: google.cloud.speech.v2.Speech.BatchRecognize
// long_running:
// initial_poll_delay:
// seconds: 60 # 1 minute
// poll_delay_multiplier: 1.5
// max_poll_delay:
// seconds: 360 # 6 minutes
// total_poll_timeout:
// seconds: 54000 # 90 minutes
LongRunning long_running = 2;
// List of top-level fields of the request message, that should be
// automatically populated by the client libraries based on their
// (google.api.field_info).format. Currently supported format: UUID4.
//
// Example of a YAML configuration:
//
// publishing:
// method_settings:
// - selector: google.example.v1.ExampleService.CreateExample
// auto_populated_fields:
// - request_id
repeated string auto_populated_fields = 3;
}
// The organization for which the client libraries are being published.
// Affects the url where generated docs are published, etc.
enum ClientLibraryOrganization {
// Not useful.
CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED = 0;
// Google Cloud Platform Org.
CLOUD = 1;
// Ads (Advertising) Org.
ADS = 2;
// Photos Org.
PHOTOS = 3;
// Street View Org.
STREET_VIEW = 4;
// Shopping Org.
SHOPPING = 5;
// Geo Org.
GEO = 6;
// Generative AI - https://developers.generativeai.google
GENERATIVE_AI = 7;
}
// To where should client libraries be published?
enum ClientLibraryDestination {
// Client libraries will neither be generated nor published to package
// managers.
CLIENT_LIBRARY_DESTINATION_UNSPECIFIED = 0;
// Generate the client library in a repo under github.com/googleapis,
// but don't publish it to package managers.
GITHUB = 10;
// Publish the library to package managers like nuget.org and npmjs.com.
PACKAGE_MANAGER = 20;
}

View File

@@ -0,0 +1,322 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api.cloudquotas.v1;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/cloudquotas/v1/resources.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/field_mask.proto";
option csharp_namespace = "Google.Cloud.CloudQuotas.V1";
option go_package = "cloud.google.com/go/cloudquotas/apiv1/cloudquotaspb;cloudquotaspb";
option java_multiple_files = true;
option java_outer_classname = "CloudquotasProto";
option java_package = "com.google.api.cloudquotas.v1";
option php_namespace = "Google\\Cloud\\CloudQuotas\\V1";
option ruby_package = "Google::Cloud::CloudQuotas::V1";
option (google.api.resource_definition) = {
type: "cloudquotas.googleapis.com/Service"
pattern: "projects/{project}/locations/{location}/services/{service}"
pattern: "folders/{folder}/locations/{location}/services/{service}"
pattern: "organizations/{organization}/locations/{location}/services/{service}"
};
option (google.api.resource_definition) = {
type: "cloudquotas.googleapis.com/Location"
pattern: "projects/{project}/locations/{location}"
pattern: "folders/{folder}/locations/{location}"
pattern: "organizations/{organization}/locations/{location}"
};
// The Cloud Quotas API is an infrastructure service for Google Cloud that lets
// service consumers list and manage their resource usage limits.
//
// - List/Get the metadata and current status of the quotas for a service.
// - Create/Update quota preferencess that declare the preferred quota values.
// - Check the status of a quota preference request.
// - List/Get pending and historical quota preference.
service CloudQuotas {
option (google.api.default_host) = "cloudquotas.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform";
// Lists QuotaInfos of all quotas for a given project, folder or organization.
rpc ListQuotaInfos(ListQuotaInfosRequest) returns (ListQuotaInfosResponse) {
option (google.api.http) = {
get: "/v1/{parent=projects/*/locations/*/services/*}/quotaInfos"
additional_bindings {
get: "/v1/{parent=organizations/*/locations/*/services/*}/quotaInfos"
}
additional_bindings {
get: "/v1/{parent=folders/*/locations/*/services/*}/quotaInfos"
}
};
option (google.api.method_signature) = "parent";
}
// Retrieve the QuotaInfo of a quota for a project, folder or organization.
rpc GetQuotaInfo(GetQuotaInfoRequest) returns (QuotaInfo) {
option (google.api.http) = {
get: "/v1/{name=projects/*/locations/*/services/*/quotaInfos/*}"
additional_bindings {
get: "/v1/{name=organizations/*/locations/*/services/*/quotaInfos/*}"
}
additional_bindings {
get: "/v1/{name=folders/*/locations/*/services/*/quotaInfos/*}"
}
};
option (google.api.method_signature) = "name";
}
// Lists QuotaPreferences in a given project, folder or organization.
rpc ListQuotaPreferences(ListQuotaPreferencesRequest)
returns (ListQuotaPreferencesResponse) {
option (google.api.http) = {
get: "/v1/{parent=projects/*/locations/*}/quotaPreferences"
additional_bindings {
get: "/v1/{parent=folders/*/locations/*}/quotaPreferences"
}
additional_bindings {
get: "/v1/{parent=organizations/*/locations/*}/quotaPreferences"
}
};
option (google.api.method_signature) = "parent";
}
// Gets details of a single QuotaPreference.
rpc GetQuotaPreference(GetQuotaPreferenceRequest) returns (QuotaPreference) {
option (google.api.http) = {
get: "/v1/{name=projects/*/locations/*/quotaPreferences/*}"
additional_bindings {
get: "/v1/{name=organizations/*/locations/*/quotaPreferences/*}"
}
additional_bindings {
get: "/v1/{name=folders/*/locations/*/quotaPreferences/*}"
}
};
option (google.api.method_signature) = "name";
}
// Creates a new QuotaPreference that declares the desired value for a quota.
rpc CreateQuotaPreference(CreateQuotaPreferenceRequest)
returns (QuotaPreference) {
option (google.api.http) = {
post: "/v1/{parent=projects/*/locations/*}/quotaPreferences"
body: "quota_preference"
additional_bindings {
post: "/v1/{parent=folders/*/locations/*}/quotaPreferences"
body: "quota_preference"
}
additional_bindings {
post: "/v1/{parent=organizations/*/locations/*}/quotaPreferences"
body: "quota_preference"
}
};
option (google.api.method_signature) =
"parent,quota_preference,quota_preference_id";
option (google.api.method_signature) = "parent,quota_preference";
}
// Updates the parameters of a single QuotaPreference. It can updates the
// config in any states, not just the ones pending approval.
rpc UpdateQuotaPreference(UpdateQuotaPreferenceRequest)
returns (QuotaPreference) {
option (google.api.http) = {
patch: "/v1/{quota_preference.name=projects/*/locations/*/quotaPreferences/*}"
body: "quota_preference"
additional_bindings {
patch: "/v1/{quota_preference.name=folders/*/locations/*/quotaPreferences/*}"
body: "quota_preference"
}
additional_bindings {
patch: "/v1/{quota_preference.name=organizations/*/locations/*/quotaPreferences/*}"
body: "quota_preference"
}
};
option (google.api.method_signature) = "quota_preference,update_mask";
}
}
// Message for requesting list of QuotaInfos
message ListQuotaInfosRequest {
// Required. Parent value of QuotaInfo resources.
// Listing across different resource containers (such as 'projects/-') is not
// allowed.
//
// Example names:
// `projects/123/locations/global/services/compute.googleapis.com`
// `folders/234/locations/global/services/compute.googleapis.com`
// `organizations/345/locations/global/services/compute.googleapis.com`
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "cloudquotas.googleapis.com/QuotaInfo"
}
];
// Optional. Requested page size. Server may return fewer items than
// requested. If unspecified, server will pick an appropriate default.
int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
// Optional. A token identifying a page of results the server should return.
string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
}
// Message for response to listing QuotaInfos
message ListQuotaInfosResponse {
// The list of QuotaInfo
repeated QuotaInfo quota_infos = 1;
// A token, which can be sent as `page_token` to retrieve the next page.
// If this field is omitted, there are no subsequent pages.
string next_page_token = 2;
}
// Message for getting a QuotaInfo
message GetQuotaInfoRequest {
// Required. The resource name of the quota info.
//
// An example name:
// `projects/123/locations/global/services/compute.googleapis.com/quotaInfos/CpusPerProjectPerRegion`
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "cloudquotas.googleapis.com/QuotaInfo"
}
];
}
// Message for requesting list of QuotaPreferences
message ListQuotaPreferencesRequest {
// Required. Parent value of QuotaPreference resources.
// Listing across different resource containers (such as 'projects/-') is not
// allowed.
//
// When the value starts with 'folders' or 'organizations', it lists the
// QuotaPreferences for org quotas in the container. It does not list the
// QuotaPreferences in the descendant projects of the container.
//
// Example parents:
// `projects/123/locations/global`
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "cloudquotas.googleapis.com/QuotaPreference"
}
];
// Optional. Requested page size. Server may return fewer items than
// requested. If unspecified, server will pick an appropriate default.
int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
// Optional. A token identifying a page of results the server should return.
string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
// Optional. Filter result QuotaPreferences by their state, type,
// create/update time range.
//
// Example filters:
// `reconciling=true AND request_type=CLOUD_CONSOLE`,
// `reconciling=true OR creation_time>2022-12-03T10:30:00`
string filter = 4 [(google.api.field_behavior) = OPTIONAL];
// Optional. How to order of the results. By default, the results are ordered
// by create time.
//
// Example orders:
// `quota_id`,
// `service, create_time`
string order_by = 5 [(google.api.field_behavior) = OPTIONAL];
}
// Message for response to listing QuotaPreferences
message ListQuotaPreferencesResponse {
// The list of QuotaPreference
repeated QuotaPreference quota_preferences = 1;
// A token, which can be sent as `page_token` to retrieve the next page.
// If this field is omitted, there are no subsequent pages.
string next_page_token = 2;
// Locations that could not be reached.
repeated string unreachable = 3;
}
// Message for getting a QuotaPreference
message GetQuotaPreferenceRequest {
// Required. Name of the resource
//
// Example name:
// `projects/123/locations/global/quota_preferences/my-config-for-us-east1`
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "cloudquotas.googleapis.com/QuotaPreference"
}
];
}
// Message for creating a QuotaPreference
message CreateQuotaPreferenceRequest {
// Required. Value for parent.
//
// Example:
// `projects/123/locations/global`
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "cloudquotas.googleapis.com/QuotaPreference"
}
];
// Optional. Id of the requesting object, must be unique under its parent.
// If client does not set this field, the service will generate one.
string quota_preference_id = 2 [(google.api.field_behavior) = OPTIONAL];
// Required. The resource being created
QuotaPreference quota_preference = 3 [(google.api.field_behavior) = REQUIRED];
// The list of quota safety checks to be ignored.
repeated QuotaSafetyCheck ignore_safety_checks = 4;
}
// Message for updating a QuotaPreference
message UpdateQuotaPreferenceRequest {
// Optional. Field mask is used to specify the fields to be overwritten in the
// QuotaPreference resource by the update.
// The fields specified in the update_mask are relative to the resource, not
// the full request. A field will be overwritten if it is in the mask. If the
// user does not provide a mask then all fields will be overwritten.
google.protobuf.FieldMask update_mask = 1
[(google.api.field_behavior) = OPTIONAL];
// Required. The resource being updated
QuotaPreference quota_preference = 2 [(google.api.field_behavior) = REQUIRED];
// Optional. If set to true, and the quota preference is not found, a new one
// will be created. In this situation, `update_mask` is ignored.
bool allow_missing = 3 [(google.api.field_behavior) = OPTIONAL];
// Optional. If set to true, validate the request, but do not actually update.
// Note that a request being valid does not mean that the request is
// guaranteed to be fulfilled.
bool validate_only = 4 [(google.api.field_behavior) = OPTIONAL];
// The list of quota safety checks to be ignored.
repeated QuotaSafetyCheck ignore_safety_checks = 5;
}

View File

@@ -0,0 +1,311 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api.cloudquotas.v1;
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
option csharp_namespace = "Google.Cloud.CloudQuotas.V1";
option go_package = "cloud.google.com/go/cloudquotas/apiv1/cloudquotaspb;cloudquotaspb";
option java_multiple_files = true;
option java_outer_classname = "ResourcesProto";
option java_package = "com.google.api.cloudquotas.v1";
option php_namespace = "Google\\Cloud\\CloudQuotas\\V1";
option ruby_package = "Google::Cloud::CloudQuotas::V1";
// Enumerations of quota safety checks.
enum QuotaSafetyCheck {
// Unspecified quota safety check.
QUOTA_SAFETY_CHECK_UNSPECIFIED = 0;
// Validates that a quota mutation would not cause the consumer's effective
// limit to be lower than the consumer's quota usage.
QUOTA_DECREASE_BELOW_USAGE = 1;
// Validates that a quota mutation would not cause the consumer's effective
// limit to decrease by more than 10 percent.
QUOTA_DECREASE_PERCENTAGE_TOO_HIGH = 2;
}
// QuotaInfo represents information about a particular quota for a given
// project, folder or organization.
message QuotaInfo {
option (google.api.resource) = {
type: "cloudquotas.googleapis.com/QuotaInfo"
pattern: "projects/{project}/locations/{location}/services/{service}/quotaInfos/{quota_info}"
pattern: "folders/{folder}/locations/{location}/services/{service}/quotaInfos/{quota_info}"
pattern: "organizations/{organization}/locations/{location}/services/{service}/quotaInfos/{quota_info}"
};
// The enumeration of the types of a cloud resource container.
enum ContainerType {
// Unspecified container type.
CONTAINER_TYPE_UNSPECIFIED = 0;
// consumer project
PROJECT = 1;
// folder
FOLDER = 2;
// organization
ORGANIZATION = 3;
}
// Resource name of this QuotaInfo.
// The ID component following "locations/" must be "global".
// Example:
// `projects/123/locations/global/services/compute.googleapis.com/quotaInfos/CpusPerProjectPerRegion`
string name = 1;
// The id of the quota, which is unquie within the service.
// Example: `CpusPerProjectPerRegion`
string quota_id = 2;
// The metric of the quota. It specifies the resources consumption the quota
// is defined for.
// Example: `compute.googleapis.com/cpus`
string metric = 3;
// The name of the service in which the quota is defined.
// Example: `compute.googleapis.com`
string service = 4;
// Whether this is a precise quota. A precise quota is tracked with absolute
// precision. In contrast, an imprecise quota is not tracked with precision.
bool is_precise = 5;
// The reset time interval for the quota. Refresh interval applies to rate
// quota only.
// Example: "minute" for per minute, "day" for per day, or "10 seconds" for
// every 10 seconds.
string refresh_interval = 6;
// The container type of the QuotaInfo.
ContainerType container_type = 7;
// The dimensions the quota is defined on.
repeated string dimensions = 8;
// The display name of the quota metric
string metric_display_name = 9;
// The display name of the quota.
string quota_display_name = 10;
// The unit in which the metric value is reported, e.g., "MByte".
string metric_unit = 11;
// Whether it is eligible to request a higher quota value for this quota.
QuotaIncreaseEligibility quota_increase_eligibility = 12;
// Whether the quota value is fixed or adjustable
bool is_fixed = 13;
// The collection of dimensions info ordered by their dimensions from more
// specific ones to less specific ones.
repeated DimensionsInfo dimensions_infos = 14;
// Whether the quota is a concurrent quota. Concurrent quotas are enforced
// on the total number of concurrent operations in flight at any given time.
bool is_concurrent = 15;
// URI to the page where the user can request more quotas for the cloud
// service, such as
// https://docs.google.com/spreadsheet/viewform?formkey=abc123&entry_0={email}&entry_1={id}.
// Google Developers Console UI replace {email} with the current
// user's e-mail, {id} with the current project number, or organization ID
// with "organizations/" prefix. For example,
// https://docs.google.com/spreadsheet/viewform?formkey=abc123&entry_0=johndoe@gmail.com&entry_1=25463754,
// or
// https://docs.google.com/spreadsheet/viewform?formkey=abc123&entry_0=johndoe@gmail.com&entry_1=organizations/26474422.
string service_request_quota_uri = 17;
}
// Eligibility information regarding requesting increase adjustment of a quota.
message QuotaIncreaseEligibility {
// The enumeration of reasons when it is ineligible to request increase
// adjustment.
enum IneligibilityReason {
// Default value when is_eligible is true.
INELIGIBILITY_REASON_UNSPECIFIED = 0;
// The container is not linked with a valid billing account.
NO_VALID_BILLING_ACCOUNT = 1;
// Other reasons.
OTHER = 2;
}
// Whether a higher quota value can be requested for the quota.
bool is_eligible = 1;
// The reason of why it is ineligible to request increased value of the quota.
// If the is_eligible field is true, it defaults to
// INELIGIBILITY_REASON_UNSPECIFIED.
IneligibilityReason ineligibility_reason = 2;
}
// QuotaPreference represents the preferred quota configuration specified for
// a project, folder or organization. There is only one QuotaPreference
// resource for a quota value targeting a unique set of dimensions.
message QuotaPreference {
option (google.api.resource) = {
type: "cloudquotas.googleapis.com/QuotaPreference"
pattern: "projects/{project}/locations/{location}/quotaPreferences/{quota_preference}"
pattern: "folders/{folder}/locations/{location}/quotaPreferences/{quota_preference}"
pattern: "organizations/{organization}/locations/{location}/quotaPreferences/{quota_preference}"
};
// Required except in the CREATE requests.
// The resource name of the quota preference.
// The ID component following "locations/" must be "global".
// Example:
// `projects/123/locations/global/quotaPreferences/my-config-for-us-east1`
string name = 1;
// Immutable. The dimensions that this quota preference applies to. The key of
// the map entry is the name of a dimension, such as "region", "zone",
// "network_id", and the value of the map entry is the dimension value.
//
// If a dimension is missing from the map of dimensions, the quota preference
// applies to all the dimension values except for those that have other quota
// preferences configured for the specific value.
//
// NOTE: QuotaPreferences can only be applied across all values of "user" and
// "resource" dimension. Do not set values for "user" or "resource" in the
// dimension map.
//
// Example: {"provider", "Foo Inc"} where "provider" is a service specific
// dimension.
map<string, string> dimensions = 2 [(google.api.field_behavior) = IMMUTABLE];
// Required. Preferred quota configuration.
QuotaConfig quota_config = 3 [(google.api.field_behavior) = REQUIRED];
// Optional. The current etag of the quota preference. If an etag is provided
// on update and does not match the current server's etag of the quota
// preference, the request will be blocked and an ABORTED error will be
// returned. See https://google.aip.dev/134#etags for more details on etags.
string etag = 4 [(google.api.field_behavior) = OPTIONAL];
// Output only. Create time stamp
google.protobuf.Timestamp create_time = 5
[(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. Update time stamp
google.protobuf.Timestamp update_time = 6
[(google.api.field_behavior) = OUTPUT_ONLY];
// Required. The name of the service to which the quota preference is applied.
string service = 7 [(google.api.field_behavior) = REQUIRED];
// Required. The id of the quota to which the quota preference is applied. A
// quota name is unique in the service. Example: `CpusPerProjectPerRegion`
string quota_id = 8 [(google.api.field_behavior) = REQUIRED];
// Output only. Is the quota preference pending Google Cloud approval and
// fulfillment.
bool reconciling = 10 [(google.api.field_behavior) = OUTPUT_ONLY];
// The reason / justification for this quota preference.
string justification = 11;
// Required. Input only. An email address that can be used for quota related
// communication between the Google Cloud and the user in case the Google
// Cloud needs further information to make a decision on whether the user
// preferred quota can be granted.
//
// The Google account for the email address must have quota update permission
// for the project, folder or organization this quota preference is for.
string contact_email = 12 [
(google.api.field_behavior) = INPUT_ONLY,
(google.api.field_behavior) = REQUIRED
];
}
// The preferred quota configuration.
message QuotaConfig {
// The enumeration of the origins of quota preference requests.
enum Origin {
// The unspecified value.
ORIGIN_UNSPECIFIED = 0;
// Created through Cloud Console.
CLOUD_CONSOLE = 1;
// Generated by automatic quota adjustment.
AUTO_ADJUSTER = 2;
}
// Required. The preferred value. Must be greater than or equal to -1. If set
// to -1, it means the value is "unlimited".
int64 preferred_value = 1 [(google.api.field_behavior) = REQUIRED];
// Output only. Optional details about the state of this quota preference.
string state_detail = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. Granted quota value.
google.protobuf.Int64Value granted_value = 3
[(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. The trace id that the Google Cloud uses to provision the
// requested quota. This trace id may be used by the client to contact Cloud
// support to track the state of a quota preference request. The trace id is
// only produced for increase requests and is unique for each request. The
// quota decrease requests do not have a trace id.
string trace_id = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
// Optional. The annotations map for clients to store small amounts of
// arbitrary data. Do not put PII or other sensitive information here. See
// https://google.aip.dev/128#annotations
map<string, string> annotations = 5 [(google.api.field_behavior) = OPTIONAL];
// Output only. The origin of the quota preference request.
Origin request_origin = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
}
// The detailed quota information such as effective quota value for a
// combination of dimensions.
message DimensionsInfo {
// The map of dimensions for this dimensions info. The key of a map entry
// is "region", "zone" or the name of a service specific dimension, and the
// value of a map entry is the value of the dimension. If a dimension does
// not appear in the map of dimensions, the dimensions info applies to all
// the dimension values except for those that have another DimenisonInfo
// instance configured for the specific value.
// Example: {"provider" : "Foo Inc"} where "provider" is a service specific
// dimension of a quota.
map<string, string> dimensions = 1;
// Quota details for the specified dimensions.
QuotaDetails details = 2;
// The applicable regions or zones of this dimensions info. The field will be
// set to ['global'] for quotas that are not per region or per zone.
// Otherwise, it will be set to the list of locations this dimension info is
// applicable to.
repeated string applicable_locations = 3;
}
// The quota details for a map of dimensions.
message QuotaDetails {
// The value currently in effect and being enforced.
int64 value = 1;
}

View File

@@ -0,0 +1,84 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
option go_package = "google.golang.org/genproto/googleapis/api/configchange;configchange";
option java_multiple_files = true;
option java_outer_classname = "ConfigChangeProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// Output generated from semantically comparing two versions of a service
// configuration.
//
// Includes detailed information about a field that have changed with
// applicable advice about potential consequences for the change, such as
// backwards-incompatibility.
message ConfigChange {
// Object hierarchy path to the change, with levels separated by a '.'
// character. For repeated fields, an applicable unique identifier field is
// used for the index (usually selector, name, or id). For maps, the term
// 'key' is used. If the field has no unique identifier, the numeric index
// is used.
// Examples:
// - visibility.rules[selector=="google.LibraryService.ListBooks"].restriction
// - quota.metric_rules[selector=="google"].metric_costs[key=="reads"].value
// - logging.producer_destinations[0]
string element = 1;
// Value of the changed object in the old Service configuration,
// in JSON format. This field will not be populated if ChangeType == ADDED.
string old_value = 2;
// Value of the changed object in the new Service configuration,
// in JSON format. This field will not be populated if ChangeType == REMOVED.
string new_value = 3;
// The type for this change, either ADDED, REMOVED, or MODIFIED.
ChangeType change_type = 4;
// Collection of advice provided for this change, useful for determining the
// possible impact of this change.
repeated Advice advices = 5;
}
// Generated advice about this change, used for providing more
// information about how a change will affect the existing service.
message Advice {
// Useful description for why this advice was applied and what actions should
// be taken to mitigate any implied risks.
string description = 2;
}
// Classifies set of possible modifications to an object in the service
// configuration.
enum ChangeType {
// No value was provided.
CHANGE_TYPE_UNSPECIFIED = 0;
// The changed object exists in the 'new' service configuration, but not
// in the 'old' service configuration.
ADDED = 1;
// The changed object exists in the 'old' service configuration, but not
// in the 'new' service configuration.
REMOVED = 2;
// The changed object exists in both service configurations, but its value
// is different.
MODIFIED = 3;
}

View File

@@ -0,0 +1,82 @@
// Copyright 2016 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
option java_multiple_files = true;
option java_outer_classname = "ConsumerProto";
option java_package = "com.google.api";
// A descriptor for defining project properties for a service. One service may
// have many consumer projects, and the service may want to behave differently
// depending on some properties on the project. For example, a project may be
// associated with a school, or a business, or a government agency, a business
// type property on the project may affect how a service responds to the client.
// This descriptor defines which properties are allowed to be set on a project.
//
// Example:
//
// project_properties:
// properties:
// - name: NO_WATERMARK
// type: BOOL
// description: Allows usage of the API without watermarks.
// - name: EXTENDED_TILE_CACHE_PERIOD
// type: INT64
message ProjectProperties {
// List of per consumer project-specific properties.
repeated Property properties = 1;
}
// Defines project properties.
//
// API services can define properties that can be assigned to consumer projects
// so that backends can perform response customization without having to make
// additional calls or maintain additional storage. For example, Maps API
// defines properties that controls map tile cache period, or whether to embed a
// watermark in a result.
//
// These values can be set via API producer console. Only API providers can
// define and set these properties.
message Property {
// Supported data type of the property values
enum PropertyType {
// The type is unspecified, and will result in an error.
UNSPECIFIED = 0;
// The type is `int64`.
INT64 = 1;
// The type is `bool`.
BOOL = 2;
// The type is `string`.
STRING = 3;
// The type is 'double'.
DOUBLE = 4;
}
// The name of the property (a.k.a key).
string name = 1;
// The type of this property.
PropertyType type = 2;
// The description of the property
string description = 3;
}

View File

@@ -0,0 +1,90 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
option java_multiple_files = true;
option java_outer_classname = "ContextProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// `Context` defines which contexts an API requests.
//
// Example:
//
// context:
// rules:
// - selector: "*"
// requested:
// - google.rpc.context.ProjectContext
// - google.rpc.context.OriginContext
//
// The above specifies that all methods in the API request
// `google.rpc.context.ProjectContext` and
// `google.rpc.context.OriginContext`.
//
// Available context types are defined in package
// `google.rpc.context`.
//
// This also provides mechanism to allowlist any protobuf message extension that
// can be sent in grpc metadata using “x-goog-ext-<extension_id>-bin” and
// “x-goog-ext-<extension_id>-jspb” format. For example, list any service
// specific protobuf types that can appear in grpc metadata as follows in your
// yaml file:
//
// Example:
//
// context:
// rules:
// - selector: "google.example.library.v1.LibraryService.CreateBook"
// allowed_request_extensions:
// - google.foo.v1.NewExtension
// allowed_response_extensions:
// - google.foo.v1.NewExtension
//
// You can also specify extension ID instead of fully qualified extension name
// here.
message Context {
// A list of RPC context rules that apply to individual API methods.
//
// **NOTE:** All service configuration rules follow "last one wins" order.
repeated ContextRule rules = 1;
}
// A context rule provides information about the context for an individual API
// element.
message ContextRule {
// Selects the methods to which this rule applies.
//
// Refer to [selector][google.api.DocumentationRule.selector] for syntax
// details.
string selector = 1;
// A list of full type names of requested contexts.
repeated string requested = 2;
// A list of full type names of provided contexts.
repeated string provided = 3;
// A list of full type names or extension IDs of extensions allowed in grpc
// side channel from client to backend.
repeated string allowed_request_extensions = 4;
// A list of full type names or extension IDs of extensions allowed in grpc
// side channel from backend to client.
repeated string allowed_response_extensions = 5;
}

View File

@@ -0,0 +1,41 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
import "google/api/policy.proto";
option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
option java_multiple_files = true;
option java_outer_classname = "ControlProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// Selects and configures the service controller used by the service.
//
// Example:
//
// control:
// environment: servicecontrol.googleapis.com
message Control {
// The service controller environment to use. If empty, no control plane
// feature (like quota and billing) will be enabled. The recommended value for
// most services is servicecontrol.googleapis.com
string environment = 1;
// Defines policies applying to the API methods of the service.
repeated MethodPolicy method_policies = 4;
}

View File

@@ -0,0 +1,213 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
import "google/protobuf/any.proto";
import "google/protobuf/timestamp.proto";
option go_package = "google.golang.org/genproto/googleapis/api/distribution;distribution";
option java_multiple_files = true;
option java_outer_classname = "DistributionProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// `Distribution` contains summary statistics for a population of values. It
// optionally contains a histogram representing the distribution of those values
// across a set of buckets.
//
// The summary statistics are the count, mean, sum of the squared deviation from
// the mean, the minimum, and the maximum of the set of population of values.
// The histogram is based on a sequence of buckets and gives a count of values
// that fall into each bucket. The boundaries of the buckets are given either
// explicitly or by formulas for buckets of fixed or exponentially increasing
// widths.
//
// Although it is not forbidden, it is generally a bad idea to include
// non-finite values (infinities or NaNs) in the population of values, as this
// will render the `mean` and `sum_of_squared_deviation` fields meaningless.
message Distribution {
// The range of the population values.
message Range {
// The minimum of the population values.
double min = 1;
// The maximum of the population values.
double max = 2;
}
// `BucketOptions` describes the bucket boundaries used to create a histogram
// for the distribution. The buckets can be in a linear sequence, an
// exponential sequence, or each bucket can be specified explicitly.
// `BucketOptions` does not include the number of values in each bucket.
//
// A bucket has an inclusive lower bound and exclusive upper bound for the
// values that are counted for that bucket. The upper bound of a bucket must
// be strictly greater than the lower bound. The sequence of N buckets for a
// distribution consists of an underflow bucket (number 0), zero or more
// finite buckets (number 1 through N - 2) and an overflow bucket (number N -
// 1). The buckets are contiguous: the lower bound of bucket i (i > 0) is the
// same as the upper bound of bucket i - 1. The buckets span the whole range
// of finite values: lower bound of the underflow bucket is -infinity and the
// upper bound of the overflow bucket is +infinity. The finite buckets are
// so-called because both bounds are finite.
message BucketOptions {
// Specifies a linear sequence of buckets that all have the same width
// (except overflow and underflow). Each bucket represents a constant
// absolute uncertainty on the specific value in the bucket.
//
// There are `num_finite_buckets + 2` (= N) buckets. Bucket `i` has the
// following boundaries:
//
// Upper bound (0 <= i < N-1): offset + (width * i).
//
// Lower bound (1 <= i < N): offset + (width * (i - 1)).
message Linear {
// Must be greater than 0.
int32 num_finite_buckets = 1;
// Must be greater than 0.
double width = 2;
// Lower bound of the first bucket.
double offset = 3;
}
// Specifies an exponential sequence of buckets that have a width that is
// proportional to the value of the lower bound. Each bucket represents a
// constant relative uncertainty on a specific value in the bucket.
//
// There are `num_finite_buckets + 2` (= N) buckets. Bucket `i` has the
// following boundaries:
//
// Upper bound (0 <= i < N-1): scale * (growth_factor ^ i).
//
// Lower bound (1 <= i < N): scale * (growth_factor ^ (i - 1)).
message Exponential {
// Must be greater than 0.
int32 num_finite_buckets = 1;
// Must be greater than 1.
double growth_factor = 2;
// Must be greater than 0.
double scale = 3;
}
// Specifies a set of buckets with arbitrary widths.
//
// There are `size(bounds) + 1` (= N) buckets. Bucket `i` has the following
// boundaries:
//
// Upper bound (0 <= i < N-1): bounds[i]
// Lower bound (1 <= i < N); bounds[i - 1]
//
// The `bounds` field must contain at least one element. If `bounds` has
// only one element, then there are no finite buckets, and that single
// element is the common boundary of the overflow and underflow buckets.
message Explicit {
// The values must be monotonically increasing.
repeated double bounds = 1;
}
// Exactly one of these three fields must be set.
oneof options {
// The linear bucket.
Linear linear_buckets = 1;
// The exponential buckets.
Exponential exponential_buckets = 2;
// The explicit buckets.
Explicit explicit_buckets = 3;
}
}
// Exemplars are example points that may be used to annotate aggregated
// distribution values. They are metadata that gives information about a
// particular value added to a Distribution bucket, such as a trace ID that
// was active when a value was added. They may contain further information,
// such as a example values and timestamps, origin, etc.
message Exemplar {
// Value of the exemplar point. This value determines to which bucket the
// exemplar belongs.
double value = 1;
// The observation (sampling) time of the above value.
google.protobuf.Timestamp timestamp = 2;
// Contextual information about the example value. Examples are:
//
// Trace: type.googleapis.com/google.monitoring.v3.SpanContext
//
// Literal string: type.googleapis.com/google.protobuf.StringValue
//
// Labels dropped during aggregation:
// type.googleapis.com/google.monitoring.v3.DroppedLabels
//
// There may be only a single attachment of any given message type in a
// single exemplar, and this is enforced by the system.
repeated google.protobuf.Any attachments = 3;
}
// The number of values in the population. Must be non-negative. This value
// must equal the sum of the values in `bucket_counts` if a histogram is
// provided.
int64 count = 1;
// The arithmetic mean of the values in the population. If `count` is zero
// then this field must be zero.
double mean = 2;
// The sum of squared deviations from the mean of the values in the
// population. For values x_i this is:
//
// Sum[i=1..n]((x_i - mean)^2)
//
// Knuth, "The Art of Computer Programming", Vol. 2, page 232, 3rd edition
// describes Welford's method for accumulating this sum in one pass.
//
// If `count` is zero then this field must be zero.
double sum_of_squared_deviation = 3;
// If specified, contains the range of the population values. The field
// must not be present if the `count` is zero.
Range range = 4;
// Defines the histogram bucket boundaries. If the distribution does not
// contain a histogram, then omit this field.
BucketOptions bucket_options = 6;
// The number of values in each bucket of the histogram, as described in
// `bucket_options`. If the distribution does not have a histogram, then omit
// this field. If there is a histogram, then the sum of the values in
// `bucket_counts` must equal the value in the `count` field of the
// distribution.
//
// If present, `bucket_counts` should contain N values, where N is the number
// of buckets specified in `bucket_options`. If you supply fewer than N
// values, the remaining values are assumed to be 0.
//
// The order of the values in `bucket_counts` follows the bucket numbering
// schemes described for the three bucket types. The first value must be the
// count for the underflow bucket (number 0). The next N-2 values are the
// counts for the finite buckets (number 1 through N-2). The N'th value in
// `bucket_counts` is the count for the overflow bucket (number N-1).
repeated int64 bucket_counts = 7;
// Must be in increasing order of `value` field.
repeated Exemplar exemplars = 10;
}

View File

@@ -0,0 +1,168 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
option java_multiple_files = true;
option java_outer_classname = "DocumentationProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// `Documentation` provides the information for describing a service.
//
// Example:
// <pre><code>documentation:
// summary: >
// The Google Calendar API gives access
// to most calendar features.
// pages:
// - name: Overview
// content: &#40;== include google/foo/overview.md ==&#41;
// - name: Tutorial
// content: &#40;== include google/foo/tutorial.md ==&#41;
// subpages:
// - name: Java
// content: &#40;== include google/foo/tutorial_java.md ==&#41;
// rules:
// - selector: google.calendar.Calendar.Get
// description: >
// ...
// - selector: google.calendar.Calendar.Put
// description: >
// ...
// </code></pre>
// Documentation is provided in markdown syntax. In addition to
// standard markdown features, definition lists, tables and fenced
// code blocks are supported. Section headers can be provided and are
// interpreted relative to the section nesting of the context where
// a documentation fragment is embedded.
//
// Documentation from the IDL is merged with documentation defined
// via the config at normalization time, where documentation provided
// by config rules overrides IDL provided.
//
// A number of constructs specific to the API platform are supported
// in documentation text.
//
// In order to reference a proto element, the following
// notation can be used:
// <pre><code>&#91;fully.qualified.proto.name]&#91;]</code></pre>
// To override the display text used for the link, this can be used:
// <pre><code>&#91;display text]&#91;fully.qualified.proto.name]</code></pre>
// Text can be excluded from doc using the following notation:
// <pre><code>&#40;-- internal comment --&#41;</code></pre>
//
// A few directives are available in documentation. Note that
// directives must appear on a single line to be properly
// identified. The `include` directive includes a markdown file from
// an external source:
// <pre><code>&#40;== include path/to/file ==&#41;</code></pre>
// The `resource_for` directive marks a message to be the resource of
// a collection in REST view. If it is not specified, tools attempt
// to infer the resource from the operations in a collection:
// <pre><code>&#40;== resource_for v1.shelves.books ==&#41;</code></pre>
// The directive `suppress_warning` does not directly affect documentation
// and is documented together with service config validation.
message Documentation {
// A short description of what the service does. The summary must be plain
// text. It becomes the overview of the service displayed in Google Cloud
// Console.
// NOTE: This field is equivalent to the standard field `description`.
string summary = 1;
// The top level pages for the documentation set.
repeated Page pages = 5;
// A list of documentation rules that apply to individual API elements.
//
// **NOTE:** All service configuration rules follow "last one wins" order.
repeated DocumentationRule rules = 3;
// The URL to the root of documentation.
string documentation_root_url = 4;
// Specifies the service root url if the default one (the service name
// from the yaml file) is not suitable. This can be seen in any fully
// specified service urls as well as sections that show a base that other
// urls are relative to.
string service_root_url = 6;
// Declares a single overview page. For example:
// <pre><code>documentation:
// summary: ...
// overview: &#40;== include overview.md ==&#41;
// </code></pre>
// This is a shortcut for the following declaration (using pages style):
// <pre><code>documentation:
// summary: ...
// pages:
// - name: Overview
// content: &#40;== include overview.md ==&#41;
// </code></pre>
// Note: you cannot specify both `overview` field and `pages` field.
string overview = 2;
}
// A documentation rule provides information about individual API elements.
message DocumentationRule {
// The selector is a comma-separated list of patterns for any element such as
// a method, a field, an enum value. Each pattern is a qualified name of the
// element which may end in "*", indicating a wildcard. Wildcards are only
// allowed at the end and for a whole component of the qualified name,
// i.e. "foo.*" is ok, but not "foo.b*" or "foo.*.bar". A wildcard will match
// one or more components. To specify a default for all applicable elements,
// the whole pattern "*" is used.
string selector = 1;
// Description of the selected proto element (e.g. a message, a method, a
// 'service' definition, or a field). Defaults to leading & trailing comments
// taken from the proto source definition of the proto element.
string description = 2;
// Deprecation description of the selected element(s). It can be provided if
// an element is marked as `deprecated`.
string deprecation_description = 3;
}
// Represents a documentation page. A page can contain subpages to represent
// nested documentation set structure.
message Page {
// The name of the page. It will be used as an identity of the page to
// generate URI of the page, text of the link to this page in navigation,
// etc. The full page name (start from the root page name to this page
// concatenated with `.`) can be used as reference to the page in your
// documentation. For example:
// <pre><code>pages:
// - name: Tutorial
// content: &#40;== include tutorial.md ==&#41;
// subpages:
// - name: Java
// content: &#40;== include tutorial_java.md ==&#41;
// </code></pre>
// You can reference `Java` page using Markdown reference link syntax:
// `[Java][Tutorial.Java]`.
string name = 1;
// The Markdown content of the page. You can use <code>&#40;== include {path}
// ==&#41;</code> to include content from a Markdown file. The content can be
// used to produce the documentation page such as HTML format page.
string content = 2;
// Subpages of this page. The order of subpages specified here will be
// honored in the generated docset.
repeated Page subpages = 3;
}

View File

@@ -0,0 +1,73 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
option java_multiple_files = true;
option java_outer_classname = "EndpointProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// `Endpoint` describes a network address of a service that serves a set of
// APIs. It is commonly known as a service endpoint. A service may expose
// any number of service endpoints, and all service endpoints share the same
// service definition, such as quota limits and monitoring metrics.
//
// Example:
//
// type: google.api.Service
// name: library-example.googleapis.com
// endpoints:
// # Declares network address `https://library-example.googleapis.com`
// # for service `library-example.googleapis.com`. The `https` scheme
// # is implicit for all service endpoints. Other schemes may be
// # supported in the future.
// - name: library-example.googleapis.com
// allow_cors: false
// - name: content-staging-library-example.googleapis.com
// # Allows HTTP OPTIONS calls to be passed to the API frontend, for it
// # to decide whether the subsequent cross-origin request is allowed
// # to proceed.
// allow_cors: true
message Endpoint {
// The canonical name of this endpoint.
string name = 1;
// Unimplemented. Dot not use.
//
// DEPRECATED: This field is no longer supported. Instead of using aliases,
// please specify multiple [google.api.Endpoint][google.api.Endpoint] for each
// of the intended aliases.
//
// Additional names that this endpoint will be hosted on.
repeated string aliases = 2 [deprecated = true];
// The specification of an Internet routable address of API frontend that will
// handle requests to this [API
// Endpoint](https://cloud.google.com/apis/design/glossary). It should be
// either a valid IPv4 address or a fully-qualified domain name. For example,
// "8.8.8.8" or "myservice.appspot.com".
string target = 101;
// Allowing
// [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), aka
// cross-domain traffic, would allow the backends served from this endpoint to
// receive and respond to HTTP OPTIONS requests. The response will be used by
// the browser to determine whether the subsequent cross-origin request is
// allowed to proceed.
bool allow_cors = 5;
}

View File

@@ -0,0 +1,589 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
option go_package = "google.golang.org/genproto/googleapis/api/error_reason;error_reason";
option java_multiple_files = true;
option java_outer_classname = "ErrorReasonProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// Defines the supported values for `google.rpc.ErrorInfo.reason` for the
// `googleapis.com` error domain. This error domain is reserved for [Service
// Infrastructure](https://cloud.google.com/service-infrastructure/docs/overview).
// For each error info of this domain, the metadata key "service" refers to the
// logical identifier of an API service, such as "pubsub.googleapis.com". The
// "consumer" refers to the entity that consumes an API Service. It typically is
// a Google project that owns the client application or the server resource,
// such as "projects/123". Other metadata keys are specific to each error
// reason. For more information, see the definition of the specific error
// reason.
enum ErrorReason {
// Do not use this default value.
ERROR_REASON_UNSPECIFIED = 0;
// The request is calling a disabled service for a consumer.
//
// Example of an ErrorInfo when the consumer "projects/123" contacting
// "pubsub.googleapis.com" service which is disabled:
//
// { "reason": "SERVICE_DISABLED",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "pubsub.googleapis.com"
// }
// }
//
// This response indicates the "pubsub.googleapis.com" has been disabled in
// "projects/123".
SERVICE_DISABLED = 1;
// The request whose associated billing account is disabled.
//
// Example of an ErrorInfo when the consumer "projects/123" fails to contact
// "pubsub.googleapis.com" service because the associated billing account is
// disabled:
//
// { "reason": "BILLING_DISABLED",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "pubsub.googleapis.com"
// }
// }
//
// This response indicates the billing account associated has been disabled.
BILLING_DISABLED = 2;
// The request is denied because the provided [API
// key](https://cloud.google.com/docs/authentication/api-keys) is invalid. It
// may be in a bad format, cannot be found, or has been expired).
//
// Example of an ErrorInfo when the request is contacting
// "storage.googleapis.com" service with an invalid API key:
//
// { "reason": "API_KEY_INVALID",
// "domain": "googleapis.com",
// "metadata": {
// "service": "storage.googleapis.com",
// }
// }
API_KEY_INVALID = 3;
// The request is denied because it violates [API key API
// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_api_restrictions).
//
// Example of an ErrorInfo when the consumer "projects/123" fails to call the
// "storage.googleapis.com" service because this service is restricted in the
// API key:
//
// { "reason": "API_KEY_SERVICE_BLOCKED",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "storage.googleapis.com"
// }
// }
API_KEY_SERVICE_BLOCKED = 4;
// The request is denied because it violates [API key HTTP
// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_http_restrictions).
//
// Example of an ErrorInfo when the consumer "projects/123" fails to call
// "storage.googleapis.com" service because the http referrer of the request
// violates API key HTTP restrictions:
//
// { "reason": "API_KEY_HTTP_REFERRER_BLOCKED",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "storage.googleapis.com",
// }
// }
API_KEY_HTTP_REFERRER_BLOCKED = 7;
// The request is denied because it violates [API key IP address
// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
//
// Example of an ErrorInfo when the consumer "projects/123" fails to call
// "storage.googleapis.com" service because the caller IP of the request
// violates API key IP address restrictions:
//
// { "reason": "API_KEY_IP_ADDRESS_BLOCKED",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "storage.googleapis.com",
// }
// }
API_KEY_IP_ADDRESS_BLOCKED = 8;
// The request is denied because it violates [API key Android application
// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
//
// Example of an ErrorInfo when the consumer "projects/123" fails to call
// "storage.googleapis.com" service because the request from the Android apps
// violates the API key Android application restrictions:
//
// { "reason": "API_KEY_ANDROID_APP_BLOCKED",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "storage.googleapis.com"
// }
// }
API_KEY_ANDROID_APP_BLOCKED = 9;
// The request is denied because it violates [API key iOS application
// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
//
// Example of an ErrorInfo when the consumer "projects/123" fails to call
// "storage.googleapis.com" service because the request from the iOS apps
// violates the API key iOS application restrictions:
//
// { "reason": "API_KEY_IOS_APP_BLOCKED",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "storage.googleapis.com"
// }
// }
API_KEY_IOS_APP_BLOCKED = 13;
// The request is denied because there is not enough rate quota for the
// consumer.
//
// Example of an ErrorInfo when the consumer "projects/123" fails to contact
// "pubsub.googleapis.com" service because consumer's rate quota usage has
// reached the maximum value set for the quota limit
// "ReadsPerMinutePerProject" on the quota metric
// "pubsub.googleapis.com/read_requests":
//
// { "reason": "RATE_LIMIT_EXCEEDED",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "pubsub.googleapis.com",
// "quota_metric": "pubsub.googleapis.com/read_requests",
// "quota_limit": "ReadsPerMinutePerProject"
// }
// }
//
// Example of an ErrorInfo when the consumer "projects/123" checks quota on
// the service "dataflow.googleapis.com" and hits the organization quota
// limit "DefaultRequestsPerMinutePerOrganization" on the metric
// "dataflow.googleapis.com/default_requests".
//
// { "reason": "RATE_LIMIT_EXCEEDED",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "dataflow.googleapis.com",
// "quota_metric": "dataflow.googleapis.com/default_requests",
// "quota_limit": "DefaultRequestsPerMinutePerOrganization"
// }
// }
RATE_LIMIT_EXCEEDED = 5;
// The request is denied because there is not enough resource quota for the
// consumer.
//
// Example of an ErrorInfo when the consumer "projects/123" fails to contact
// "compute.googleapis.com" service because consumer's resource quota usage
// has reached the maximum value set for the quota limit "VMsPerProject"
// on the quota metric "compute.googleapis.com/vms":
//
// { "reason": "RESOURCE_QUOTA_EXCEEDED",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "compute.googleapis.com",
// "quota_metric": "compute.googleapis.com/vms",
// "quota_limit": "VMsPerProject"
// }
// }
//
// Example of an ErrorInfo when the consumer "projects/123" checks resource
// quota on the service "dataflow.googleapis.com" and hits the organization
// quota limit "jobs-per-organization" on the metric
// "dataflow.googleapis.com/job_count".
//
// { "reason": "RESOURCE_QUOTA_EXCEEDED",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "dataflow.googleapis.com",
// "quota_metric": "dataflow.googleapis.com/job_count",
// "quota_limit": "jobs-per-organization"
// }
// }
RESOURCE_QUOTA_EXCEEDED = 6;
// The request whose associated billing account address is in a tax restricted
// location, violates the local tax restrictions when creating resources in
// the restricted region.
//
// Example of an ErrorInfo when creating the Cloud Storage Bucket in the
// container "projects/123" under a tax restricted region
// "locations/asia-northeast3":
//
// { "reason": "LOCATION_TAX_POLICY_VIOLATED",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "storage.googleapis.com",
// "location": "locations/asia-northeast3"
// }
// }
//
// This response indicates creating the Cloud Storage Bucket in
// "locations/asia-northeast3" violates the location tax restriction.
LOCATION_TAX_POLICY_VIOLATED = 10;
// The request is denied because the caller does not have required permission
// on the user project "projects/123" or the user project is invalid. For more
// information, check the [userProject System
// Parameters](https://cloud.google.com/apis/docs/system-parameters).
//
// Example of an ErrorInfo when the caller is calling Cloud Storage service
// with insufficient permissions on the user project:
//
// { "reason": "USER_PROJECT_DENIED",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "storage.googleapis.com"
// }
// }
USER_PROJECT_DENIED = 11;
// The request is denied because the consumer "projects/123" is suspended due
// to Terms of Service(Tos) violations. Check [Project suspension
// guidelines](https://cloud.google.com/resource-manager/docs/project-suspension-guidelines)
// for more information.
//
// Example of an ErrorInfo when calling Cloud Storage service with the
// suspended consumer "projects/123":
//
// { "reason": "CONSUMER_SUSPENDED",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "storage.googleapis.com"
// }
// }
CONSUMER_SUSPENDED = 12;
// The request is denied because the associated consumer is invalid. It may be
// in a bad format, cannot be found, or have been deleted.
//
// Example of an ErrorInfo when calling Cloud Storage service with the
// invalid consumer "projects/123":
//
// { "reason": "CONSUMER_INVALID",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "storage.googleapis.com"
// }
// }
CONSUMER_INVALID = 14;
// The request is denied because it violates [VPC Service
// Controls](https://cloud.google.com/vpc-service-controls/docs/overview).
// The 'uid' field is a random generated identifier that customer can use it
// to search the audit log for a request rejected by VPC Service Controls. For
// more information, please refer [VPC Service Controls
// Troubleshooting](https://cloud.google.com/vpc-service-controls/docs/troubleshooting#unique-id)
//
// Example of an ErrorInfo when the consumer "projects/123" fails to call
// Cloud Storage service because the request is prohibited by the VPC Service
// Controls.
//
// { "reason": "SECURITY_POLICY_VIOLATED",
// "domain": "googleapis.com",
// "metadata": {
// "uid": "123456789abcde",
// "consumer": "projects/123",
// "service": "storage.googleapis.com"
// }
// }
SECURITY_POLICY_VIOLATED = 15;
// The request is denied because the provided access token has expired.
//
// Example of an ErrorInfo when the request is calling Cloud Storage service
// with an expired access token:
//
// { "reason": "ACCESS_TOKEN_EXPIRED",
// "domain": "googleapis.com",
// "metadata": {
// "service": "storage.googleapis.com",
// "method": "google.storage.v1.Storage.GetObject"
// }
// }
ACCESS_TOKEN_EXPIRED = 16;
// The request is denied because the provided access token doesn't have at
// least one of the acceptable scopes required for the API. Please check
// [OAuth 2.0 Scopes for Google
// APIs](https://developers.google.com/identity/protocols/oauth2/scopes) for
// the list of the OAuth 2.0 scopes that you might need to request to access
// the API.
//
// Example of an ErrorInfo when the request is calling Cloud Storage service
// with an access token that is missing required scopes:
//
// { "reason": "ACCESS_TOKEN_SCOPE_INSUFFICIENT",
// "domain": "googleapis.com",
// "metadata": {
// "service": "storage.googleapis.com",
// "method": "google.storage.v1.Storage.GetObject"
// }
// }
ACCESS_TOKEN_SCOPE_INSUFFICIENT = 17;
// The request is denied because the account associated with the provided
// access token is in an invalid state, such as disabled or deleted.
// For more information, see https://cloud.google.com/docs/authentication.
//
// Warning: For privacy reasons, the server may not be able to disclose the
// email address for some accounts. The client MUST NOT depend on the
// availability of the `email` attribute.
//
// Example of an ErrorInfo when the request is to the Cloud Storage API with
// an access token that is associated with a disabled or deleted [service
// account](http://cloud/iam/docs/service-accounts):
//
// { "reason": "ACCOUNT_STATE_INVALID",
// "domain": "googleapis.com",
// "metadata": {
// "service": "storage.googleapis.com",
// "method": "google.storage.v1.Storage.GetObject",
// "email": "user@123.iam.gserviceaccount.com"
// }
// }
ACCOUNT_STATE_INVALID = 18;
// The request is denied because the type of the provided access token is not
// supported by the API being called.
//
// Example of an ErrorInfo when the request is to the Cloud Storage API with
// an unsupported token type.
//
// { "reason": "ACCESS_TOKEN_TYPE_UNSUPPORTED",
// "domain": "googleapis.com",
// "metadata": {
// "service": "storage.googleapis.com",
// "method": "google.storage.v1.Storage.GetObject"
// }
// }
ACCESS_TOKEN_TYPE_UNSUPPORTED = 19;
// The request is denied because the request doesn't have any authentication
// credentials. For more information regarding the supported authentication
// strategies for Google Cloud APIs, see
// https://cloud.google.com/docs/authentication.
//
// Example of an ErrorInfo when the request is to the Cloud Storage API
// without any authentication credentials.
//
// { "reason": "CREDENTIALS_MISSING",
// "domain": "googleapis.com",
// "metadata": {
// "service": "storage.googleapis.com",
// "method": "google.storage.v1.Storage.GetObject"
// }
// }
CREDENTIALS_MISSING = 20;
// The request is denied because the provided project owning the resource
// which acts as the [API
// consumer](https://cloud.google.com/apis/design/glossary#api_consumer) is
// invalid. It may be in a bad format or empty.
//
// Example of an ErrorInfo when the request is to the Cloud Functions API,
// but the offered resource project in the request in a bad format which can't
// perform the ListFunctions method.
//
// { "reason": "RESOURCE_PROJECT_INVALID",
// "domain": "googleapis.com",
// "metadata": {
// "service": "cloudfunctions.googleapis.com",
// "method":
// "google.cloud.functions.v1.CloudFunctionsService.ListFunctions"
// }
// }
RESOURCE_PROJECT_INVALID = 21;
// The request is denied because the provided session cookie is missing,
// invalid or failed to decode.
//
// Example of an ErrorInfo when the request is calling Cloud Storage service
// with a SID cookie which can't be decoded.
//
// { "reason": "SESSION_COOKIE_INVALID",
// "domain": "googleapis.com",
// "metadata": {
// "service": "storage.googleapis.com",
// "method": "google.storage.v1.Storage.GetObject",
// "cookie": "SID"
// }
// }
SESSION_COOKIE_INVALID = 23;
// The request is denied because the user is from a Google Workspace customer
// that blocks their users from accessing a particular service.
//
// Example scenario: https://support.google.com/a/answer/9197205?hl=en
//
// Example of an ErrorInfo when access to Google Cloud Storage service is
// blocked by the Google Workspace administrator:
//
// { "reason": "USER_BLOCKED_BY_ADMIN",
// "domain": "googleapis.com",
// "metadata": {
// "service": "storage.googleapis.com",
// "method": "google.storage.v1.Storage.GetObject",
// }
// }
USER_BLOCKED_BY_ADMIN = 24;
// The request is denied because the resource service usage is restricted
// by administrators according to the organization policy constraint.
// For more information see
// https://cloud.google.com/resource-manager/docs/organization-policy/restricting-services.
//
// Example of an ErrorInfo when access to Google Cloud Storage service is
// restricted by Resource Usage Restriction policy:
//
// { "reason": "RESOURCE_USAGE_RESTRICTION_VIOLATED",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/project-123",
// "service": "storage.googleapis.com"
// }
// }
RESOURCE_USAGE_RESTRICTION_VIOLATED = 25;
// Unimplemented. Do not use.
//
// The request is denied because it contains unsupported system parameters in
// URL query parameters or HTTP headers. For more information,
// see https://cloud.google.com/apis/docs/system-parameters
//
// Example of an ErrorInfo when access "pubsub.googleapis.com" service with
// a request header of "x-goog-user-ip":
//
// { "reason": "SYSTEM_PARAMETER_UNSUPPORTED",
// "domain": "googleapis.com",
// "metadata": {
// "service": "pubsub.googleapis.com"
// "parameter": "x-goog-user-ip"
// }
// }
SYSTEM_PARAMETER_UNSUPPORTED = 26;
// The request is denied because it violates Org Restriction: the requested
// resource does not belong to allowed organizations specified in
// "X-Goog-Allowed-Resources" header.
//
// Example of an ErrorInfo when accessing a GCP resource that is restricted by
// Org Restriction for "pubsub.googleapis.com" service.
//
// {
// reason: "ORG_RESTRICTION_VIOLATION"
// domain: "googleapis.com"
// metadata {
// "consumer":"projects/123456"
// "service": "pubsub.googleapis.com"
// }
// }
ORG_RESTRICTION_VIOLATION = 27;
// The request is denied because "X-Goog-Allowed-Resources" header is in a bad
// format.
//
// Example of an ErrorInfo when
// accessing "pubsub.googleapis.com" service with an invalid
// "X-Goog-Allowed-Resources" request header.
//
// {
// reason: "ORG_RESTRICTION_HEADER_INVALID"
// domain: "googleapis.com"
// metadata {
// "consumer":"projects/123456"
// "service": "pubsub.googleapis.com"
// }
// }
ORG_RESTRICTION_HEADER_INVALID = 28;
// Unimplemented. Do not use.
//
// The request is calling a service that is not visible to the consumer.
//
// Example of an ErrorInfo when the consumer "projects/123" contacting
// "pubsub.googleapis.com" service which is not visible to the consumer.
//
// { "reason": "SERVICE_NOT_VISIBLE",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "pubsub.googleapis.com"
// }
// }
//
// This response indicates the "pubsub.googleapis.com" is not visible to
// "projects/123" (or it may not exist).
SERVICE_NOT_VISIBLE = 29;
// The request is related to a project for which GCP access is suspended.
//
// Example of an ErrorInfo when the consumer "projects/123" fails to contact
// "pubsub.googleapis.com" service because GCP access is suspended:
//
// { "reason": "GCP_SUSPENDED",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "pubsub.googleapis.com"
// }
// }
//
// This response indicates the associated GCP account has been suspended.
GCP_SUSPENDED = 30;
// The request violates the location policies when creating resources in
// the restricted region.
//
// Example of an ErrorInfo when creating the Cloud Storage Bucket by
// "projects/123" for service storage.googleapis.com:
//
// { "reason": "LOCATION_POLICY_VIOLATED",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "storage.googleapis.com",
// }
// }
//
// This response indicates creating the Cloud Storage Bucket in
// "locations/asia-northeast3" violates at least one location policy.
// The troubleshooting guidance is provided in the Help links.
LOCATION_POLICY_VIOLATED = 31;
}

View File

@@ -0,0 +1,183 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api.expr.conformance.v1alpha1;
import "google/api/client.proto";
import "google/api/expr/v1alpha1/checked.proto";
import "google/api/expr/v1alpha1/eval.proto";
import "google/api/expr/v1alpha1/syntax.proto";
import "google/rpc/status.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/expr/conformance/v1alpha1;confpb";
option java_multiple_files = true;
option java_outer_classname = "ConformanceServiceProto";
option java_package = "com.google.api.expr.conformance.v1alpha1";
// Access a CEL implementation from another process or machine.
// A CEL implementation is decomposed as a parser, a static checker,
// and an evaluator. Every CEL implementation is expected to provide
// a server for this API. The API will be used for conformance testing
// and other utilities.
service ConformanceService {
option (google.api.default_host) = "cel.googleapis.com";
// Transforms CEL source text into a parsed representation.
rpc Parse(ParseRequest) returns (ParseResponse) {
}
// Runs static checks on a parsed CEL representation and return
// an annotated representation, or a set of issues.
rpc Check(CheckRequest) returns (CheckResponse) {
}
// Evaluates a parsed or annotation CEL representation given
// values of external bindings.
rpc Eval(EvalRequest) returns (EvalResponse) {
}
}
// Request message for the Parse method.
message ParseRequest {
// Required. Source text in CEL syntax.
string cel_source = 1;
// Tag for version of CEL syntax, for future use.
string syntax_version = 2;
// File or resource for source text, used in [SourceInfo][google.api.SourceInfo].
string source_location = 3;
// Prevent macro expansion. See "Macros" in Language Defiinition.
bool disable_macros = 4;
}
// Response message for the Parse method.
message ParseResponse {
// The parsed representation, or unset if parsing failed.
google.api.expr.v1alpha1.ParsedExpr parsed_expr = 1;
// Any number of issues with [StatusDetails][] as the details.
repeated google.rpc.Status issues = 2;
}
// Request message for the Check method.
message CheckRequest {
// Required. The parsed representation of the CEL program.
google.api.expr.v1alpha1.ParsedExpr parsed_expr = 1;
// Declarations of types for external variables and functions.
// Required if program uses external variables or functions
// not in the default environment.
repeated google.api.expr.v1alpha1.Decl type_env = 2;
// The protocol buffer context. See "Name Resolution" in the
// Language Definition.
string container = 3;
// If true, use only the declarations in [type_env][google.api.expr.conformance.v1alpha1.CheckRequest.type_env]. If false (default),
// add declarations for the standard definitions to the type environment. See
// "Standard Definitions" in the Language Definition.
bool no_std_env = 4;
}
// Response message for the Check method.
message CheckResponse {
// The annotated representation, or unset if checking failed.
google.api.expr.v1alpha1.CheckedExpr checked_expr = 1;
// Any number of issues with [StatusDetails][] as the details.
repeated google.rpc.Status issues = 2;
}
// Request message for the Eval method.
message EvalRequest {
// Required. Either the parsed or annotated representation of the CEL program.
oneof expr_kind {
// Evaluate based on the parsed representation.
google.api.expr.v1alpha1.ParsedExpr parsed_expr = 1;
// Evaluate based on the checked representation.
google.api.expr.v1alpha1.CheckedExpr checked_expr = 2;
}
// Bindings for the external variables. The types SHOULD be compatible
// with the type environment in [CheckRequest][google.api.expr.conformance.v1alpha1.CheckRequest], if checked.
map<string, google.api.expr.v1alpha1.ExprValue> bindings = 3;
// SHOULD be the same container as used in [CheckRequest][google.api.expr.conformance.v1alpha1.CheckRequest], if checked.
string container = 4;
}
// Response message for the Eval method.
message EvalResponse {
// The execution result, or unset if execution couldn't start.
google.api.expr.v1alpha1.ExprValue result = 1;
// Any number of issues with [StatusDetails][] as the details.
// Note that CEL execution errors are reified into [ExprValue][].
// Nevertheless, we'll allow out-of-band issues to be raised,
// which also makes the replies more regular.
repeated google.rpc.Status issues = 2;
}
// A specific position in source.
message SourcePosition {
// The source location name (e.g. file name).
string location = 1;
// The UTF-8 code unit offset.
int32 offset = 2;
// The 1-based index of the starting line in the source text
// where the issue occurs, or 0 if unknown.
int32 line = 3;
// The 0-based index of the starting position within the line of source text
// where the issue occurs. Only meaningful if line is nonzero.
int32 column = 4;
}
// Warnings or errors in service execution are represented by
// [google.rpc.Status][google.rpc.Status] messages, with the following message
// in the details field.
message IssueDetails {
// Severities of issues.
enum Severity {
// An unspecified severity.
SEVERITY_UNSPECIFIED = 0;
// Deprecation issue for statements and method that may no longer be
// supported or maintained.
DEPRECATION = 1;
// Warnings such as: unused variables.
WARNING = 2;
// Errors such as: unmatched curly braces or variable redefinition.
ERROR = 3;
}
// The severity of the issue.
Severity severity = 1;
// Position in the source, if known.
SourcePosition position = 2;
// Expression ID from [Expr][], 0 if unknown.
int64 id = 3;
}

View File

@@ -0,0 +1,343 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api.expr.v1alpha1;
import "google/api/expr/v1alpha1/syntax.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/struct.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr";
option java_multiple_files = true;
option java_outer_classname = "DeclProto";
option java_package = "com.google.api.expr.v1alpha1";
// Protos for representing CEL declarations and typed checked expressions.
// A CEL expression which has been successfully type checked.
message CheckedExpr {
// A map from expression ids to resolved references.
//
// The following entries are in this table:
//
// - An Ident or Select expression is represented here if it resolves to a
// declaration. For instance, if `a.b.c` is represented by
// `select(select(id(a), b), c)`, and `a.b` resolves to a declaration,
// while `c` is a field selection, then the reference is attached to the
// nested select expression (but not to the id or or the outer select).
// In turn, if `a` resolves to a declaration and `b.c` are field selections,
// the reference is attached to the ident expression.
// - Every Call expression has an entry here, identifying the function being
// called.
// - Every CreateStruct expression for a message has an entry, identifying
// the message.
map<int64, Reference> reference_map = 2;
// A map from expression ids to types.
//
// Every expression node which has a type different than DYN has a mapping
// here. If an expression has type DYN, it is omitted from this map to save
// space.
map<int64, Type> type_map = 3;
// The source info derived from input that generated the parsed `expr` and
// any optimizations made during the type-checking pass.
SourceInfo source_info = 5;
// The expr version indicates the major / minor version number of the `expr`
// representation.
//
// The most common reason for a version change will be to indicate to the CEL
// runtimes that transformations have been performed on the expr during static
// analysis. In some cases, this will save the runtime the work of applying
// the same or similar transformations prior to evaluation.
string expr_version = 6;
// The checked expression. Semantically equivalent to the parsed `expr`, but
// may have structural differences.
Expr expr = 4;
}
// Represents a CEL type.
message Type {
// List type with typed elements, e.g. `list<example.proto.MyMessage>`.
message ListType {
// The element type.
Type elem_type = 1;
}
// Map type with parameterized key and value types, e.g. `map<string, int>`.
message MapType {
// The type of the key.
Type key_type = 1;
// The type of the value.
Type value_type = 2;
}
// Function type with result and arg types.
message FunctionType {
// Result type of the function.
Type result_type = 1;
// Argument types of the function.
repeated Type arg_types = 2;
}
// Application defined abstract type.
message AbstractType {
// The fully qualified name of this abstract type.
string name = 1;
// Parameter types for this abstract type.
repeated Type parameter_types = 2;
}
// CEL primitive types.
enum PrimitiveType {
// Unspecified type.
PRIMITIVE_TYPE_UNSPECIFIED = 0;
// Boolean type.
BOOL = 1;
// Int64 type.
//
// Proto-based integer values are widened to int64.
INT64 = 2;
// Uint64 type.
//
// Proto-based unsigned integer values are widened to uint64.
UINT64 = 3;
// Double type.
//
// Proto-based float values are widened to double values.
DOUBLE = 4;
// String type.
STRING = 5;
// Bytes type.
BYTES = 6;
}
// Well-known protobuf types treated with first-class support in CEL.
enum WellKnownType {
// Unspecified type.
WELL_KNOWN_TYPE_UNSPECIFIED = 0;
// Well-known protobuf.Any type.
//
// Any types are a polymorphic message type. During type-checking they are
// treated like `DYN` types, but at runtime they are resolved to a specific
// message type specified at evaluation time.
ANY = 1;
// Well-known protobuf.Timestamp type, internally referenced as `timestamp`.
TIMESTAMP = 2;
// Well-known protobuf.Duration type, internally referenced as `duration`.
DURATION = 3;
}
// The kind of type.
oneof type_kind {
// Dynamic type.
google.protobuf.Empty dyn = 1;
// Null value.
google.protobuf.NullValue null = 2;
// Primitive types: `true`, `1u`, `-2.0`, `'string'`, `b'bytes'`.
PrimitiveType primitive = 3;
// Wrapper of a primitive type, e.g. `google.protobuf.Int64Value`.
PrimitiveType wrapper = 4;
// Well-known protobuf type such as `google.protobuf.Timestamp`.
WellKnownType well_known = 5;
// Parameterized list with elements of `list_type`, e.g. `list<timestamp>`.
ListType list_type = 6;
// Parameterized map with typed keys and values.
MapType map_type = 7;
// Function type.
FunctionType function = 8;
// Protocol buffer message type.
//
// The `message_type` string specifies the qualified message type name. For
// example, `google.plus.Profile`.
string message_type = 9;
// Type param type.
//
// The `type_param` string specifies the type parameter name, e.g. `list<E>`
// would be a `list_type` whose element type was a `type_param` type
// named `E`.
string type_param = 10;
// Type type.
//
// The `type` value specifies the target type. e.g. int is type with a
// target type of `Primitive.INT`.
Type type = 11;
// Error type.
//
// During type-checking if an expression is an error, its type is propagated
// as the `ERROR` type. This permits the type-checker to discover other
// errors present in the expression.
google.protobuf.Empty error = 12;
// Abstract, application defined type.
AbstractType abstract_type = 14;
}
}
// Represents a declaration of a named value or function.
//
// A declaration is part of the contract between the expression, the agent
// evaluating that expression, and the caller requesting evaluation.
message Decl {
// Identifier declaration which specifies its type and optional `Expr` value.
//
// An identifier without a value is a declaration that must be provided at
// evaluation time. An identifier with a value should resolve to a constant,
// but may be used in conjunction with other identifiers bound at evaluation
// time.
message IdentDecl {
// Required. The type of the identifier.
Type type = 1;
// The constant value of the identifier. If not specified, the identifier
// must be supplied at evaluation time.
Constant value = 2;
// Documentation string for the identifier.
string doc = 3;
}
// Function declaration specifies one or more overloads which indicate the
// function's parameter types and return type.
//
// Functions have no observable side-effects (there may be side-effects like
// logging which are not observable from CEL).
message FunctionDecl {
// An overload indicates a function's parameter types and return type, and
// may optionally include a function body described in terms of
// [Expr][google.api.expr.v1alpha1.Expr] values.
//
// Functions overloads are declared in either a function or method
// call-style. For methods, the `params[0]` is the expected type of the
// target receiver.
//
// Overloads must have non-overlapping argument types after erasure of all
// parameterized type variables (similar as type erasure in Java).
message Overload {
// Required. Globally unique overload name of the function which reflects
// the function name and argument types.
//
// This will be used by a [Reference][google.api.expr.v1alpha1.Reference]
// to indicate the `overload_id` that was resolved for the function
// `name`.
string overload_id = 1;
// List of function parameter [Type][google.api.expr.v1alpha1.Type]
// values.
//
// Param types are disjoint after generic type parameters have been
// replaced with the type `DYN`. Since the `DYN` type is compatible with
// any other type, this means that if `A` is a type parameter, the
// function types `int<A>` and `int<int>` are not disjoint. Likewise,
// `map<string, string>` is not disjoint from `map<K, V>`.
//
// When the `result_type` of a function is a generic type param, the
// type param name also appears as the `type` of on at least one params.
repeated Type params = 2;
// The type param names associated with the function declaration.
//
// For example, `function ex<K,V>(K key, map<K, V> map) : V` would yield
// the type params of `K, V`.
repeated string type_params = 3;
// Required. The result type of the function. For example, the operator
// `string.isEmpty()` would have `result_type` of `kind: BOOL`.
Type result_type = 4;
// Whether the function is to be used in a method call-style `x.f(...)`
// or a function call-style `f(x, ...)`.
//
// For methods, the first parameter declaration, `params[0]` is the
// expected type of the target receiver.
bool is_instance_function = 5;
// Documentation string for the overload.
string doc = 6;
}
// Required. List of function overloads, must contain at least one overload.
repeated Overload overloads = 1;
}
// The fully qualified name of the declaration.
//
// Declarations are organized in containers and this represents the full path
// to the declaration in its container, as in `google.api.expr.Decl`.
//
// Declarations used as
// [FunctionDecl.Overload][google.api.expr.v1alpha1.Decl.FunctionDecl.Overload]
// parameters may or may not have a name depending on whether the overload is
// function declaration or a function definition containing a result
// [Expr][google.api.expr.v1alpha1.Expr].
string name = 1;
// Required. The declaration kind.
oneof decl_kind {
// Identifier declaration.
IdentDecl ident = 2;
// Function declaration.
FunctionDecl function = 3;
}
}
// Describes a resolved reference to a declaration.
message Reference {
// The fully qualified name of the declaration.
string name = 1;
// For references to functions, this is a list of `Overload.overload_id`
// values which match according to typing rules.
//
// If the list has more than one element, overload resolution among the
// presented candidates must happen at runtime because of dynamic types. The
// type checker attempts to narrow down this list as much as possible.
//
// Empty if this is not a reference to a
// [Decl.FunctionDecl][google.api.expr.v1alpha1.Decl.FunctionDecl].
repeated string overload_id = 3;
// For references to constants, this may contain the value of the
// constant if known at compile time.
Constant value = 4;
}

View File

@@ -0,0 +1,118 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api.expr.v1alpha1;
import "google/api/expr/v1alpha1/value.proto";
import "google/rpc/status.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr";
option java_multiple_files = true;
option java_outer_classname = "EvalProto";
option java_package = "com.google.api.expr.v1alpha1";
// The state of an evaluation.
//
// Can represent an inital, partial, or completed state of evaluation.
message EvalState {
// A single evalution result.
message Result {
// The id of the expression this result if for.
int64 expr = 1;
// The index in `values` of the resulting value.
int64 value = 2;
}
// The unique values referenced in this message.
repeated ExprValue values = 1;
// An ordered list of results.
//
// Tracks the flow of evaluation through the expression.
// May be sparse.
repeated Result results = 3;
}
// The value of an evaluated expression.
message ExprValue {
// An expression can resolve to a value, error or unknown.
oneof kind {
// A concrete value.
Value value = 1;
// The set of errors in the critical path of evalution.
//
// Only errors in the critical path are included. For example,
// `(<error1> || true) && <error2>` will only result in `<error2>`,
// while `<error1> || <error2>` will result in both `<error1>` and
// `<error2>`.
//
// Errors cause by the presence of other errors are not included in the
// set. For example `<error1>.foo`, `foo(<error1>)`, and `<error1> + 1` will
// only result in `<error1>`.
//
// Multiple errors *might* be included when evaluation could result
// in different errors. For example `<error1> + <error2>` and
// `foo(<error1>, <error2>)` may result in `<error1>`, `<error2>` or both.
// The exact subset of errors included for this case is unspecified and
// depends on the implementation details of the evaluator.
ErrorSet error = 2;
// The set of unknowns in the critical path of evaluation.
//
// Unknown behaves identically to Error with regards to propagation.
// Specifically, only unknowns in the critical path are included, unknowns
// caused by the presence of other unknowns are not included, and multiple
// unknowns *might* be included included when evaluation could result in
// different unknowns. For example:
//
// (<unknown[1]> || true) && <unknown[2]> -> <unknown[2]>
// <unknown[1]> || <unknown[2]> -> <unknown[1,2]>
// <unknown[1]>.foo -> <unknown[1]>
// foo(<unknown[1]>) -> <unknown[1]>
// <unknown[1]> + <unknown[2]> -> <unknown[1]> or <unknown[2[>
//
// Unknown takes precidence over Error in cases where a `Value` can short
// circuit the result:
//
// <error> || <unknown> -> <unknown>
// <error> && <unknown> -> <unknown>
//
// Errors take precidence in all other cases:
//
// <unknown> + <error> -> <error>
// foo(<unknown>, <error>) -> <error>
UnknownSet unknown = 3;
}
}
// A set of errors.
//
// The errors included depend on the context. See `ExprValue.error`.
message ErrorSet {
// The errors in the set.
repeated google.rpc.Status errors = 1;
}
// A set of expressions for which the value is unknown.
//
// The unknowns included depend on the context. See `ExprValue.unknown`.
message UnknownSet {
// The ids of the expressions with unknown values.
repeated int64 exprs = 1;
}

View File

@@ -0,0 +1,53 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api.expr.v1alpha1;
import "google/api/expr/v1alpha1/value.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr";
option java_multiple_files = true;
option java_outer_classname = "ExplainProto";
option java_package = "com.google.api.expr.v1alpha1";
// Values of intermediate expressions produced when evaluating expression.
// Deprecated, use `EvalState` instead.
message Explain {
option deprecated = true;
// ID and value index of one step.
message ExprStep {
// ID of corresponding Expr node.
int64 id = 1;
// Index of the value in the values list.
int32 value_index = 2;
}
// All of the observed values.
//
// The field value_index is an index in the values list.
// Separating values from steps is needed to remove redundant values.
repeated Value values = 1;
// List of steps.
//
// Repeated evaluations of the same expression generate new ExprStep
// instances. The order of such ExprStep instances matches the order of
// elements returned by Comprehension.iter_range.
repeated ExprStep expr_steps = 2;
}

View File

@@ -0,0 +1,400 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api.expr.v1alpha1;
import "google/protobuf/duration.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr";
option java_multiple_files = true;
option java_outer_classname = "SyntaxProto";
option java_package = "com.google.api.expr.v1alpha1";
// A representation of the abstract syntax of the Common Expression Language.
// An expression together with source information as returned by the parser.
message ParsedExpr {
// The parsed expression.
Expr expr = 2;
// The source info derived from input that generated the parsed `expr`.
SourceInfo source_info = 3;
}
// An abstract representation of a common expression.
//
// Expressions are abstractly represented as a collection of identifiers,
// select statements, function calls, literals, and comprehensions. All
// operators with the exception of the '.' operator are modelled as function
// calls. This makes it easy to represent new operators into the existing AST.
//
// All references within expressions must resolve to a
// [Decl][google.api.expr.v1alpha1.Decl] provided at type-check for an
// expression to be valid. A reference may either be a bare identifier `name` or
// a qualified identifier `google.api.name`. References may either refer to a
// value or a function declaration.
//
// For example, the expression `google.api.name.startsWith('expr')` references
// the declaration `google.api.name` within a
// [Expr.Select][google.api.expr.v1alpha1.Expr.Select] expression, and the
// function declaration `startsWith`.
message Expr {
// An identifier expression. e.g. `request`.
message Ident {
// Required. Holds a single, unqualified identifier, possibly preceded by a
// '.'.
//
// Qualified names are represented by the
// [Expr.Select][google.api.expr.v1alpha1.Expr.Select] expression.
string name = 1;
}
// A field selection expression. e.g. `request.auth`.
message Select {
// Required. The target of the selection expression.
//
// For example, in the select expression `request.auth`, the `request`
// portion of the expression is the `operand`.
Expr operand = 1;
// Required. The name of the field to select.
//
// For example, in the select expression `request.auth`, the `auth` portion
// of the expression would be the `field`.
string field = 2;
// Whether the select is to be interpreted as a field presence test.
//
// This results from the macro `has(request.auth)`.
bool test_only = 3;
}
// A call expression, including calls to predefined functions and operators.
//
// For example, `value == 10`, `size(map_value)`.
message Call {
// The target of an method call-style expression. For example, `x` in
// `x.f()`.
Expr target = 1;
// Required. The name of the function or method being called.
string function = 2;
// The arguments.
repeated Expr args = 3;
}
// A list creation expression.
//
// Lists may either be homogenous, e.g. `[1, 2, 3]`, or heterogeneous, e.g.
// `dyn([1, 'hello', 2.0])`
message CreateList {
// The elements part of the list.
repeated Expr elements = 1;
// The indices within the elements list which are marked as optional
// elements.
//
// When an optional-typed value is present, the value it contains
// is included in the list. If the optional-typed value is absent, the list
// element is omitted from the CreateList result.
repeated int32 optional_indices = 2;
}
// A map or message creation expression.
//
// Maps are constructed as `{'key_name': 'value'}`. Message construction is
// similar, but prefixed with a type name and composed of field ids:
// `types.MyType{field_id: 'value'}`.
message CreateStruct {
// Represents an entry.
message Entry {
// Required. An id assigned to this node by the parser which is unique
// in a given expression tree. This is used to associate type
// information and other attributes to the node.
int64 id = 1;
// The `Entry` key kinds.
oneof key_kind {
// The field key for a message creator statement.
string field_key = 2;
// The key expression for a map creation statement.
Expr map_key = 3;
}
// Required. The value assigned to the key.
//
// If the optional_entry field is true, the expression must resolve to an
// optional-typed value. If the optional value is present, the key will be
// set; however, if the optional value is absent, the key will be unset.
Expr value = 4;
// Whether the key-value pair is optional.
bool optional_entry = 5;
}
// The type name of the message to be created, empty when creating map
// literals.
string message_name = 1;
// The entries in the creation expression.
repeated Entry entries = 2;
}
// A comprehension expression applied to a list or map.
//
// Comprehensions are not part of the core syntax, but enabled with macros.
// A macro matches a specific call signature within a parsed AST and replaces
// the call with an alternate AST block. Macro expansion happens at parse
// time.
//
// The following macros are supported within CEL:
//
// Aggregate type macros may be applied to all elements in a list or all keys
// in a map:
//
// * `all`, `exists`, `exists_one` - test a predicate expression against
// the inputs and return `true` if the predicate is satisfied for all,
// any, or only one value `list.all(x, x < 10)`.
// * `filter` - test a predicate expression against the inputs and return
// the subset of elements which satisfy the predicate:
// `payments.filter(p, p > 1000)`.
// * `map` - apply an expression to all elements in the input and return the
// output aggregate type: `[1, 2, 3].map(i, i * i)`.
//
// The `has(m.x)` macro tests whether the property `x` is present in struct
// `m`. The semantics of this macro depend on the type of `m`. For proto2
// messages `has(m.x)` is defined as 'defined, but not set`. For proto3, the
// macro tests whether the property is set to its default. For map and struct
// types, the macro tests whether the property `x` is defined on `m`.
message Comprehension {
// The name of the iteration variable.
string iter_var = 1;
// The range over which var iterates.
Expr iter_range = 2;
// The name of the variable used for accumulation of the result.
string accu_var = 3;
// The initial value of the accumulator.
Expr accu_init = 4;
// An expression which can contain iter_var and accu_var.
//
// Returns false when the result has been computed and may be used as
// a hint to short-circuit the remainder of the comprehension.
Expr loop_condition = 5;
// An expression which can contain iter_var and accu_var.
//
// Computes the next value of accu_var.
Expr loop_step = 6;
// An expression which can contain accu_var.
//
// Computes the result.
Expr result = 7;
}
// Required. An id assigned to this node by the parser which is unique in a
// given expression tree. This is used to associate type information and other
// attributes to a node in the parse tree.
int64 id = 2;
// Required. Variants of expressions.
oneof expr_kind {
// A literal expression.
Constant const_expr = 3;
// An identifier expression.
Ident ident_expr = 4;
// A field selection expression, e.g. `request.auth`.
Select select_expr = 5;
// A call expression, including calls to predefined functions and operators.
Call call_expr = 6;
// A list creation expression.
CreateList list_expr = 7;
// A map or message creation expression.
CreateStruct struct_expr = 8;
// A comprehension expression.
Comprehension comprehension_expr = 9;
}
}
// Represents a primitive literal.
//
// Named 'Constant' here for backwards compatibility.
//
// This is similar as the primitives supported in the well-known type
// `google.protobuf.Value`, but richer so it can represent CEL's full range of
// primitives.
//
// Lists and structs are not included as constants as these aggregate types may
// contain [Expr][google.api.expr.v1alpha1.Expr] elements which require
// evaluation and are thus not constant.
//
// Examples of literals include: `"hello"`, `b'bytes'`, `1u`, `4.2`, `-2`,
// `true`, `null`.
message Constant {
// Required. The valid constant kinds.
oneof constant_kind {
// null value.
google.protobuf.NullValue null_value = 1;
// boolean value.
bool bool_value = 2;
// int64 value.
int64 int64_value = 3;
// uint64 value.
uint64 uint64_value = 4;
// double value.
double double_value = 5;
// string value.
string string_value = 6;
// bytes value.
bytes bytes_value = 7;
// protobuf.Duration value.
//
// Deprecated: duration is no longer considered a builtin cel type.
google.protobuf.Duration duration_value = 8 [deprecated = true];
// protobuf.Timestamp value.
//
// Deprecated: timestamp is no longer considered a builtin cel type.
google.protobuf.Timestamp timestamp_value = 9 [deprecated = true];
}
}
// Source information collected at parse time.
message SourceInfo {
// An extension that was requested for the source expression.
message Extension {
// Version
message Version {
// Major version changes indicate different required support level from
// the required components.
int64 major = 1;
// Minor version changes must not change the observed behavior from
// existing implementations, but may be provided informationally.
int64 minor = 2;
}
// CEL component specifier.
enum Component {
// Unspecified, default.
COMPONENT_UNSPECIFIED = 0;
// Parser. Converts a CEL string to an AST.
COMPONENT_PARSER = 1;
// Type checker. Checks that references in an AST are defined and types
// agree.
COMPONENT_TYPE_CHECKER = 2;
// Runtime. Evaluates a parsed and optionally checked CEL AST against a
// context.
COMPONENT_RUNTIME = 3;
}
// Identifier for the extension. Example: constant_folding
string id = 1;
// If set, the listed components must understand the extension for the
// expression to evaluate correctly.
//
// This field has set semantics, repeated values should be deduplicated.
repeated Component affected_components = 2;
// Version info. May be skipped if it isn't meaningful for the extension.
// (for example constant_folding might always be v0.0).
Version version = 3;
}
// The syntax version of the source, e.g. `cel1`.
string syntax_version = 1;
// The location name. All position information attached to an expression is
// relative to this location.
//
// The location could be a file, UI element, or similar. For example,
// `acme/app/AnvilPolicy.cel`.
string location = 2;
// Monotonically increasing list of code point offsets where newlines
// `\n` appear.
//
// The line number of a given position is the index `i` where for a given
// `id` the `line_offsets[i] < id_positions[id] < line_offsets[i+1]`. The
// column may be derivd from `id_positions[id] - line_offsets[i]`.
repeated int32 line_offsets = 3;
// A map from the parse node id (e.g. `Expr.id`) to the code point offset
// within the source.
map<int64, int32> positions = 4;
// A map from the parse node id where a macro replacement was made to the
// call `Expr` that resulted in a macro expansion.
//
// For example, `has(value.field)` is a function call that is replaced by a
// `test_only` field selection in the AST. Likewise, the call
// `list.exists(e, e > 10)` translates to a comprehension expression. The key
// in the map corresponds to the expression id of the expanded macro, and the
// value is the call `Expr` that was replaced.
map<int64, Expr> macro_calls = 5;
// A list of tags for extensions that were used while parsing or type checking
// the source expression. For example, optimizations that require special
// runtime support may be specified.
//
// These are used to check feature support between components in separate
// implementations. This can be used to either skip redundant work or
// report an error if the extension is unsupported.
repeated Extension extensions = 6;
}
// A specific position in source.
message SourcePosition {
// The soucre location name (e.g. file name).
string location = 1;
// The UTF-8 code unit offset.
int32 offset = 2;
// The 1-based index of the starting line in the source text
// where the issue occurs, or 0 if unknown.
int32 line = 3;
// The 0-based index of the starting position within the line of source text
// where the issue occurs. Only meaningful if line is nonzero.
int32 column = 4;
}

View File

@@ -0,0 +1,115 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api.expr.v1alpha1;
import "google/protobuf/any.proto";
import "google/protobuf/struct.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr";
option java_multiple_files = true;
option java_outer_classname = "ValueProto";
option java_package = "com.google.api.expr.v1alpha1";
// Contains representations for CEL runtime values.
// Represents a CEL value.
//
// This is similar to `google.protobuf.Value`, but can represent CEL's full
// range of values.
message Value {
// Required. The valid kinds of values.
oneof kind {
// Null value.
google.protobuf.NullValue null_value = 1;
// Boolean value.
bool bool_value = 2;
// Signed integer value.
int64 int64_value = 3;
// Unsigned integer value.
uint64 uint64_value = 4;
// Floating point value.
double double_value = 5;
// UTF-8 string value.
string string_value = 6;
// Byte string value.
bytes bytes_value = 7;
// An enum value.
EnumValue enum_value = 9;
// The proto message backing an object value.
google.protobuf.Any object_value = 10;
// Map value.
MapValue map_value = 11;
// List value.
ListValue list_value = 12;
// Type value.
string type_value = 15;
}
}
// An enum value.
message EnumValue {
// The fully qualified name of the enum type.
string type = 1;
// The value of the enum.
int32 value = 2;
}
// A list.
//
// Wrapped in a message so 'not set' and empty can be differentiated, which is
// required for use in a 'oneof'.
message ListValue {
// The ordered values in the list.
repeated Value values = 1;
}
// A map.
//
// Wrapped in a message so 'not set' and empty can be differentiated, which is
// required for use in a 'oneof'.
message MapValue {
// An entry in the map.
message Entry {
// The key.
//
// Must be unique with in the map.
// Currently only boolean, int, uint, and string values can be keys.
Value key = 1;
// The value.
Value value = 2;
}
// The set of map entries.
//
// CEL has fewer restrictions on keys, so a protobuf map represenation
// cannot be used.
repeated Entry entries = 1;
}

View File

@@ -0,0 +1,84 @@
// Copyright 2019 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
syntax = "proto3";
package google.api.expr.v1beta1;
import "google/api/expr/v1beta1/expr.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/expr/v1beta1;expr";
option java_multiple_files = true;
option java_outer_classname = "DeclProto";
option java_package = "com.google.api.expr.v1beta1";
// A declaration.
message Decl {
// The id of the declaration.
int32 id = 1;
// The name of the declaration.
string name = 2;
// The documentation string for the declaration.
string doc = 3;
// The kind of declaration.
oneof kind {
// An identifier declaration.
IdentDecl ident = 4;
// A function declaration.
FunctionDecl function = 5;
}
}
// The declared type of a variable.
//
// Extends runtime type values with extra information used for type checking
// and dispatching.
message DeclType {
// The expression id of the declared type, if applicable.
int32 id = 1;
// The type name, e.g. 'int', 'my.type.Type' or 'T'
string type = 2;
// An ordered list of type parameters, e.g. `<string, int>`.
// Only applies to a subset of types, e.g. `map`, `list`.
repeated DeclType type_params = 4;
}
// An identifier declaration.
message IdentDecl {
// Optional type of the identifier.
DeclType type = 3;
// Optional value of the identifier.
Expr value = 4;
}
// A function declaration.
message FunctionDecl {
// The function arguments.
repeated IdentDecl args = 1;
// Optional declared return type.
DeclType return_type = 2;
// If the first argument of the function is the receiver.
bool receiver_function = 3;
}

View File

@@ -0,0 +1,125 @@
// Copyright 2019 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
syntax = "proto3";
package google.api.expr.v1beta1;
import "google/api/expr/v1beta1/value.proto";
import "google/rpc/status.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/expr/v1beta1;expr";
option java_multiple_files = true;
option java_outer_classname = "EvalProto";
option java_package = "com.google.api.expr.v1beta1";
// The state of an evaluation.
//
// Can represent an initial, partial, or completed state of evaluation.
message EvalState {
// A single evaluation result.
message Result {
// The expression this result is for.
IdRef expr = 1;
// The index in `values` of the resulting value.
int32 value = 2;
}
// The unique values referenced in this message.
repeated ExprValue values = 1;
// An ordered list of results.
//
// Tracks the flow of evaluation through the expression.
// May be sparse.
repeated Result results = 3;
}
// The value of an evaluated expression.
message ExprValue {
// An expression can resolve to a value, error or unknown.
oneof kind {
// A concrete value.
Value value = 1;
// The set of errors in the critical path of evalution.
//
// Only errors in the critical path are included. For example,
// `(<error1> || true) && <error2>` will only result in `<error2>`,
// while `<error1> || <error2>` will result in both `<error1>` and
// `<error2>`.
//
// Errors cause by the presence of other errors are not included in the
// set. For example `<error1>.foo`, `foo(<error1>)`, and `<error1> + 1` will
// only result in `<error1>`.
//
// Multiple errors *might* be included when evaluation could result
// in different errors. For example `<error1> + <error2>` and
// `foo(<error1>, <error2>)` may result in `<error1>`, `<error2>` or both.
// The exact subset of errors included for this case is unspecified and
// depends on the implementation details of the evaluator.
ErrorSet error = 2;
// The set of unknowns in the critical path of evaluation.
//
// Unknown behaves identically to Error with regards to propagation.
// Specifically, only unknowns in the critical path are included, unknowns
// caused by the presence of other unknowns are not included, and multiple
// unknowns *might* be included included when evaluation could result in
// different unknowns. For example:
//
// (<unknown[1]> || true) && <unknown[2]> -> <unknown[2]>
// <unknown[1]> || <unknown[2]> -> <unknown[1,2]>
// <unknown[1]>.foo -> <unknown[1]>
// foo(<unknown[1]>) -> <unknown[1]>
// <unknown[1]> + <unknown[2]> -> <unknown[1]> or <unknown[2[>
//
// Unknown takes precidence over Error in cases where a `Value` can short
// circuit the result:
//
// <error> || <unknown> -> <unknown>
// <error> && <unknown> -> <unknown>
//
// Errors take precidence in all other cases:
//
// <unknown> + <error> -> <error>
// foo(<unknown>, <error>) -> <error>
UnknownSet unknown = 3;
}
}
// A set of errors.
//
// The errors included depend on the context. See `ExprValue.error`.
message ErrorSet {
// The errors in the set.
repeated google.rpc.Status errors = 1;
}
// A set of expressions for which the value is unknown.
//
// The unknowns included depend on the context. See `ExprValue.unknown`.
message UnknownSet {
// The ids of the expressions with unknown values.
repeated IdRef exprs = 1;
}
// A reference to an expression id.
message IdRef {
// The expression id.
int32 id = 1;
}

View File

@@ -0,0 +1,265 @@
// Copyright 2019 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
syntax = "proto3";
package google.api.expr.v1beta1;
import "google/api/expr/v1beta1/source.proto";
import "google/protobuf/struct.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/expr/v1beta1;expr";
option java_multiple_files = true;
option java_outer_classname = "ExprProto";
option java_package = "com.google.api.expr.v1beta1";
// An expression together with source information as returned by the parser.
message ParsedExpr {
// The parsed expression.
Expr expr = 2;
// The source info derived from input that generated the parsed `expr`.
SourceInfo source_info = 3;
// The syntax version of the source, e.g. `cel1`.
string syntax_version = 4;
}
// An abstract representation of a common expression.
//
// Expressions are abstractly represented as a collection of identifiers,
// select statements, function calls, literals, and comprehensions. All
// operators with the exception of the '.' operator are modelled as function
// calls. This makes it easy to represent new operators into the existing AST.
//
// All references within expressions must resolve to a [Decl][google.api.expr.v1beta1.Decl] provided at
// type-check for an expression to be valid. A reference may either be a bare
// identifier `name` or a qualified identifier `google.api.name`. References
// may either refer to a value or a function declaration.
//
// For example, the expression `google.api.name.startsWith('expr')` references
// the declaration `google.api.name` within a [Expr.Select][google.api.expr.v1beta1.Expr.Select] expression, and
// the function declaration `startsWith`.
message Expr {
// An identifier expression. e.g. `request`.
message Ident {
// Required. Holds a single, unqualified identifier, possibly preceded by a
// '.'.
//
// Qualified names are represented by the [Expr.Select][google.api.expr.v1beta1.Expr.Select] expression.
string name = 1;
}
// A field selection expression. e.g. `request.auth`.
message Select {
// Required. The target of the selection expression.
//
// For example, in the select expression `request.auth`, the `request`
// portion of the expression is the `operand`.
Expr operand = 1;
// Required. The name of the field to select.
//
// For example, in the select expression `request.auth`, the `auth` portion
// of the expression would be the `field`.
string field = 2;
// Whether the select is to be interpreted as a field presence test.
//
// This results from the macro `has(request.auth)`.
bool test_only = 3;
}
// A call expression, including calls to predefined functions and operators.
//
// For example, `value == 10`, `size(map_value)`.
message Call {
// The target of an method call-style expression. For example, `x` in
// `x.f()`.
Expr target = 1;
// Required. The name of the function or method being called.
string function = 2;
// The arguments.
repeated Expr args = 3;
}
// A list creation expression.
//
// Lists may either be homogenous, e.g. `[1, 2, 3]`, or heterogenous, e.g.
// `dyn([1, 'hello', 2.0])`
message CreateList {
// The elements part of the list.
repeated Expr elements = 1;
}
// A map or message creation expression.
//
// Maps are constructed as `{'key_name': 'value'}`. Message construction is
// similar, but prefixed with a type name and composed of field ids:
// `types.MyType{field_id: 'value'}`.
message CreateStruct {
// Represents an entry.
message Entry {
// Required. An id assigned to this node by the parser which is unique
// in a given expression tree. This is used to associate type
// information and other attributes to the node.
int32 id = 1;
// The `Entry` key kinds.
oneof key_kind {
// The field key for a message creator statement.
string field_key = 2;
// The key expression for a map creation statement.
Expr map_key = 3;
}
// Required. The value assigned to the key.
Expr value = 4;
}
// The type name of the message to be created, empty when creating map
// literals.
string type = 1;
// The entries in the creation expression.
repeated Entry entries = 2;
}
// A comprehension expression applied to a list or map.
//
// Comprehensions are not part of the core syntax, but enabled with macros.
// A macro matches a specific call signature within a parsed AST and replaces
// the call with an alternate AST block. Macro expansion happens at parse
// time.
//
// The following macros are supported within CEL:
//
// Aggregate type macros may be applied to all elements in a list or all keys
// in a map:
//
// * `all`, `exists`, `exists_one` - test a predicate expression against
// the inputs and return `true` if the predicate is satisfied for all,
// any, or only one value `list.all(x, x < 10)`.
// * `filter` - test a predicate expression against the inputs and return
// the subset of elements which satisfy the predicate:
// `payments.filter(p, p > 1000)`.
// * `map` - apply an expression to all elements in the input and return the
// output aggregate type: `[1, 2, 3].map(i, i * i)`.
//
// The `has(m.x)` macro tests whether the property `x` is present in struct
// `m`. The semantics of this macro depend on the type of `m`. For proto2
// messages `has(m.x)` is defined as 'defined, but not set`. For proto3, the
// macro tests whether the property is set to its default. For map and struct
// types, the macro tests whether the property `x` is defined on `m`.
message Comprehension {
// The name of the iteration variable.
string iter_var = 1;
// The range over which var iterates.
Expr iter_range = 2;
// The name of the variable used for accumulation of the result.
string accu_var = 3;
// The initial value of the accumulator.
Expr accu_init = 4;
// An expression which can contain iter_var and accu_var.
//
// Returns false when the result has been computed and may be used as
// a hint to short-circuit the remainder of the comprehension.
Expr loop_condition = 5;
// An expression which can contain iter_var and accu_var.
//
// Computes the next value of accu_var.
Expr loop_step = 6;
// An expression which can contain accu_var.
//
// Computes the result.
Expr result = 7;
}
// Required. An id assigned to this node by the parser which is unique in a
// given expression tree. This is used to associate type information and other
// attributes to a node in the parse tree.
int32 id = 2;
// Required. Variants of expressions.
oneof expr_kind {
// A literal expression.
Literal literal_expr = 3;
// An identifier expression.
Ident ident_expr = 4;
// A field selection expression, e.g. `request.auth`.
Select select_expr = 5;
// A call expression, including calls to predefined functions and operators.
Call call_expr = 6;
// A list creation expression.
CreateList list_expr = 7;
// A map or object creation expression.
CreateStruct struct_expr = 8;
// A comprehension expression.
Comprehension comprehension_expr = 9;
}
}
// Represents a primitive literal.
//
// This is similar to the primitives supported in the well-known type
// `google.protobuf.Value`, but richer so it can represent CEL's full range of
// primitives.
//
// Lists and structs are not included as constants as these aggregate types may
// contain [Expr][google.api.expr.v1beta1.Expr] elements which require evaluation and are thus not constant.
//
// Examples of literals include: `"hello"`, `b'bytes'`, `1u`, `4.2`, `-2`,
// `true`, `null`.
message Literal {
// Required. The valid constant kinds.
oneof constant_kind {
// null value.
google.protobuf.NullValue null_value = 1;
// boolean value.
bool bool_value = 2;
// int64 value.
int64 int64_value = 3;
// uint64 value.
uint64 uint64_value = 4;
// double value.
double double_value = 5;
// string value.
string string_value = 6;
// bytes value.
bytes bytes_value = 7;
}
}

View File

@@ -0,0 +1,62 @@
// Copyright 2019 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
syntax = "proto3";
package google.api.expr.v1beta1;
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/expr/v1beta1;expr";
option java_multiple_files = true;
option java_outer_classname = "SourceProto";
option java_package = "com.google.api.expr.v1beta1";
// Source information collected at parse time.
message SourceInfo {
// The location name. All position information attached to an expression is
// relative to this location.
//
// The location could be a file, UI element, or similar. For example,
// `acme/app/AnvilPolicy.cel`.
string location = 2;
// Monotonically increasing list of character offsets where newlines appear.
//
// The line number of a given position is the index `i` where for a given
// `id` the `line_offsets[i] < id_positions[id] < line_offsets[i+1]`. The
// column may be derivd from `id_positions[id] - line_offsets[i]`.
repeated int32 line_offsets = 3;
// A map from the parse node id (e.g. `Expr.id`) to the character offset
// within source.
map<int32, int32> positions = 4;
}
// A specific position in source.
message SourcePosition {
// The soucre location name (e.g. file name).
string location = 1;
// The character offset.
int32 offset = 2;
// The 1-based index of the starting line in the source text
// where the issue occurs, or 0 if unknown.
int32 line = 3;
// The 0-based index of the starting position within the line of source text
// where the issue occurs. Only meaningful if line is nonzer..
int32 column = 4;
}

View File

@@ -0,0 +1,114 @@
// Copyright 2019 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
syntax = "proto3";
package google.api.expr.v1beta1;
import "google/protobuf/any.proto";
import "google/protobuf/struct.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/expr/v1beta1;expr";
option java_multiple_files = true;
option java_outer_classname = "ValueProto";
option java_package = "com.google.api.expr.v1beta1";
// Represents a CEL value.
//
// This is similar to `google.protobuf.Value`, but can represent CEL's full
// range of values.
message Value {
// Required. The valid kinds of values.
oneof kind {
// Null value.
google.protobuf.NullValue null_value = 1;
// Boolean value.
bool bool_value = 2;
// Signed integer value.
int64 int64_value = 3;
// Unsigned integer value.
uint64 uint64_value = 4;
// Floating point value.
double double_value = 5;
// UTF-8 string value.
string string_value = 6;
// Byte string value.
bytes bytes_value = 7;
// An enum value.
EnumValue enum_value = 9;
// The proto message backing an object value.
google.protobuf.Any object_value = 10;
// Map value.
MapValue map_value = 11;
// List value.
ListValue list_value = 12;
// A Type value represented by the fully qualified name of the type.
string type_value = 15;
}
}
// An enum value.
message EnumValue {
// The fully qualified name of the enum type.
string type = 1;
// The value of the enum.
int32 value = 2;
}
// A list.
//
// Wrapped in a message so 'not set' and empty can be differentiated, which is
// required for use in a 'oneof'.
message ListValue {
// The ordered values in the list.
repeated Value values = 1;
}
// A map.
//
// Wrapped in a message so 'not set' and empty can be differentiated, which is
// required for use in a 'oneof'.
message MapValue {
// An entry in the map.
message Entry {
// The key.
//
// Must be unique with in the map.
// Currently only boolean, int, uint, and string values can be keys.
Value key = 1;
// The value.
Value value = 2;
}
// The set of map entries.
//
// CEL has fewer restrictions on keys, so a protobuf map represenation
// cannot be used.
repeated Entry entries = 1;
}

View File

@@ -0,0 +1,104 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
import "google/protobuf/descriptor.proto";
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
option java_multiple_files = true;
option java_outer_classname = "FieldBehaviorProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
extend google.protobuf.FieldOptions {
// A designation of a specific field behavior (required, output only, etc.)
// in protobuf messages.
//
// Examples:
//
// string name = 1 [(google.api.field_behavior) = REQUIRED];
// State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
// google.protobuf.Duration ttl = 1
// [(google.api.field_behavior) = INPUT_ONLY];
// google.protobuf.Timestamp expire_time = 1
// [(google.api.field_behavior) = OUTPUT_ONLY,
// (google.api.field_behavior) = IMMUTABLE];
repeated google.api.FieldBehavior field_behavior = 1052 [packed = false];
}
// An indicator of the behavior of a given field (for example, that a field
// is required in requests, or given as output but ignored as input).
// This **does not** change the behavior in protocol buffers itself; it only
// denotes the behavior and may affect how API tooling handles the field.
//
// Note: This enum **may** receive new values in the future.
enum FieldBehavior {
// Conventional default for enums. Do not use this.
FIELD_BEHAVIOR_UNSPECIFIED = 0;
// Specifically denotes a field as optional.
// While all fields in protocol buffers are optional, this may be specified
// for emphasis if appropriate.
OPTIONAL = 1;
// Denotes a field as required.
// This indicates that the field **must** be provided as part of the request,
// and failure to do so will cause an error (usually `INVALID_ARGUMENT`).
REQUIRED = 2;
// Denotes a field as output only.
// This indicates that the field is provided in responses, but including the
// field in a request does nothing (the server *must* ignore it and
// *must not* throw an error as a result of the field's presence).
OUTPUT_ONLY = 3;
// Denotes a field as input only.
// This indicates that the field is provided in requests, and the
// corresponding field is not included in output.
INPUT_ONLY = 4;
// Denotes a field as immutable.
// This indicates that the field may be set once in a request to create a
// resource, but may not be changed thereafter.
IMMUTABLE = 5;
// Denotes that a (repeated) field is an unordered list.
// This indicates that the service may provide the elements of the list
// in any arbitrary order, rather than the order the user originally
// provided. Additionally, the list's order may or may not be stable.
UNORDERED_LIST = 6;
// Denotes that this field returns a non-empty default value if not set.
// This indicates that if the user provides the empty value in a request,
// a non-empty value will be returned. The user will not be aware of what
// non-empty value to expect.
NON_EMPTY_DEFAULT = 7;
// Denotes that the field in a resource (a message annotated with
// google.api.resource) is used in the resource name to uniquely identify the
// resource. For AIP-compliant APIs, this should only be applied to the
// `name` field on the resource.
//
// This behavior should not be applied to references to other resources within
// the message.
//
// The identifier field of resources often have different field behavior
// depending on the request it is embedded in (e.g. for Create methods name
// is optional and unused, while for Update methods it is required). Instead
// of method-specific annotations, only `IDENTIFIER` is required.
IDENTIFIER = 8;
}

View File

@@ -0,0 +1,79 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
import "google/protobuf/descriptor.proto";
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
option java_multiple_files = true;
option java_outer_classname = "FieldInfoProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
extend google.protobuf.FieldOptions {
// Rich semantic descriptor of an API field beyond the basic typing.
//
// Examples:
//
// string request_id = 1 [(google.api.field_info).format = UUID4];
// string old_ip_address = 2 [(google.api.field_info).format = IPV4];
// string new_ip_address = 3 [(google.api.field_info).format = IPV6];
// string actual_ip_address = 4 [
// (google.api.field_info).format = IPV4_OR_IPV6
// ];
google.api.FieldInfo field_info = 291403980;
}
// Rich semantic information of an API field beyond basic typing.
message FieldInfo {
// The standard format of a field value. The supported formats are all backed
// by either an RFC defined by the IETF or a Google-defined AIP.
enum Format {
// Default, unspecified value.
FORMAT_UNSPECIFIED = 0;
// Universally Unique Identifier, version 4, value as defined by
// https://datatracker.ietf.org/doc/html/rfc4122. The value may be
// normalized to entirely lowercase letters. For example, the value
// `F47AC10B-58CC-0372-8567-0E02B2C3D479` would be normalized to
// `f47ac10b-58cc-0372-8567-0e02b2c3d479`.
UUID4 = 1;
// Internet Protocol v4 value as defined by [RFC
// 791](https://datatracker.ietf.org/doc/html/rfc791). The value may be
// condensed, with leading zeros in each octet stripped. For example,
// `001.022.233.040` would be condensed to `1.22.233.40`.
IPV4 = 2;
// Internet Protocol v6 value as defined by [RFC
// 2460](https://datatracker.ietf.org/doc/html/rfc2460). The value may be
// normalized to entirely lowercase letters with zeros compressed, following
// [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952). For example,
// the value `2001:0DB8:0::0` would be normalized to `2001:db8::`.
IPV6 = 3;
// An IP address in either v4 or v6 format as described by the individual
// values defined herein. See the comments on the IPV4 and IPV6 types for
// allowed normalizations of each.
IPV4_OR_IPV6 = 4;
}
// The standard format of a field value. This does not explicitly configure
// any API consumer, just documents the API's format for the field it is
// applied to.
Format format = 1;
}

View File

@@ -0,0 +1,379 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
option java_multiple_files = true;
option java_outer_classname = "HttpProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// Defines the HTTP configuration for an API service. It contains a list of
// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
// to one or more HTTP REST API methods.
message Http {
// A list of HTTP configuration rules that apply to individual API methods.
//
// **NOTE:** All service configuration rules follow "last one wins" order.
repeated HttpRule rules = 1;
// When set to true, URL path parameters will be fully URI-decoded except in
// cases of single segment matches in reserved expansion, where "%2F" will be
// left encoded.
//
// The default behavior is to not decode RFC 6570 reserved characters in multi
// segment matches.
bool fully_decode_reserved_expansion = 2;
}
// # gRPC Transcoding
//
// gRPC Transcoding is a feature for mapping between a gRPC method and one or
// more HTTP REST endpoints. It allows developers to build a single API service
// that supports both gRPC APIs and REST APIs. Many systems, including [Google
// APIs](https://github.com/googleapis/googleapis),
// [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC
// Gateway](https://github.com/grpc-ecosystem/grpc-gateway),
// and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature
// and use it for large scale production services.
//
// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies
// how different portions of the gRPC request message are mapped to the URL
// path, URL query parameters, and HTTP request body. It also controls how the
// gRPC response message is mapped to the HTTP response body. `HttpRule` is
// typically specified as an `google.api.http` annotation on the gRPC method.
//
// Each mapping specifies a URL path template and an HTTP method. The path
// template may refer to one or more fields in the gRPC request message, as long
// as each field is a non-repeated field with a primitive (non-message) type.
// The path template controls how fields of the request message are mapped to
// the URL path.
//
// Example:
//
// service Messaging {
// rpc GetMessage(GetMessageRequest) returns (Message) {
// option (google.api.http) = {
// get: "/v1/{name=messages/*}"
// };
// }
// }
// message GetMessageRequest {
// string name = 1; // Mapped to URL path.
// }
// message Message {
// string text = 1; // The resource content.
// }
//
// This enables an HTTP REST to gRPC mapping as below:
//
// HTTP | gRPC
// -----|-----
// `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")`
//
// Any fields in the request message which are not bound by the path template
// automatically become HTTP query parameters if there is no HTTP request body.
// For example:
//
// service Messaging {
// rpc GetMessage(GetMessageRequest) returns (Message) {
// option (google.api.http) = {
// get:"/v1/messages/{message_id}"
// };
// }
// }
// message GetMessageRequest {
// message SubMessage {
// string subfield = 1;
// }
// string message_id = 1; // Mapped to URL path.
// int64 revision = 2; // Mapped to URL query parameter `revision`.
// SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`.
// }
//
// This enables a HTTP JSON to RPC mapping as below:
//
// HTTP | gRPC
// -----|-----
// `GET /v1/messages/123456?revision=2&sub.subfield=foo` |
// `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield:
// "foo"))`
//
// Note that fields which are mapped to URL query parameters must have a
// primitive type or a repeated primitive type or a non-repeated message type.
// In the case of a repeated type, the parameter can be repeated in the URL
// as `...?param=A&param=B`. In the case of a message type, each field of the
// message is mapped to a separate parameter, such as
// `...?foo.a=A&foo.b=B&foo.c=C`.
//
// For HTTP methods that allow a request body, the `body` field
// specifies the mapping. Consider a REST update method on the
// message resource collection:
//
// service Messaging {
// rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
// option (google.api.http) = {
// patch: "/v1/messages/{message_id}"
// body: "message"
// };
// }
// }
// message UpdateMessageRequest {
// string message_id = 1; // mapped to the URL
// Message message = 2; // mapped to the body
// }
//
// The following HTTP JSON to RPC mapping is enabled, where the
// representation of the JSON in the request body is determined by
// protos JSON encoding:
//
// HTTP | gRPC
// -----|-----
// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
// "123456" message { text: "Hi!" })`
//
// The special name `*` can be used in the body mapping to define that
// every field not bound by the path template should be mapped to the
// request body. This enables the following alternative definition of
// the update method:
//
// service Messaging {
// rpc UpdateMessage(Message) returns (Message) {
// option (google.api.http) = {
// patch: "/v1/messages/{message_id}"
// body: "*"
// };
// }
// }
// message Message {
// string message_id = 1;
// string text = 2;
// }
//
//
// The following HTTP JSON to RPC mapping is enabled:
//
// HTTP | gRPC
// -----|-----
// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
// "123456" text: "Hi!")`
//
// Note that when using `*` in the body mapping, it is not possible to
// have HTTP parameters, as all fields not bound by the path end in
// the body. This makes this option more rarely used in practice when
// defining REST APIs. The common usage of `*` is in custom methods
// which don't use the URL at all for transferring data.
//
// It is possible to define multiple HTTP methods for one RPC by using
// the `additional_bindings` option. Example:
//
// service Messaging {
// rpc GetMessage(GetMessageRequest) returns (Message) {
// option (google.api.http) = {
// get: "/v1/messages/{message_id}"
// additional_bindings {
// get: "/v1/users/{user_id}/messages/{message_id}"
// }
// };
// }
// }
// message GetMessageRequest {
// string message_id = 1;
// string user_id = 2;
// }
//
// This enables the following two alternative HTTP JSON to RPC mappings:
//
// HTTP | gRPC
// -----|-----
// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")`
// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id:
// "123456")`
//
// ## Rules for HTTP mapping
//
// 1. Leaf request fields (recursive expansion nested messages in the request
// message) are classified into three categories:
// - Fields referred by the path template. They are passed via the URL path.
// - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They
// are passed via the HTTP
// request body.
// - All other fields are passed via the URL query parameters, and the
// parameter name is the field path in the request message. A repeated
// field can be represented as multiple query parameters under the same
// name.
// 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL
// query parameter, all fields
// are passed via URL path and HTTP request body.
// 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP
// request body, all
// fields are passed via URL path and URL query parameters.
//
// ### Path template syntax
//
// Template = "/" Segments [ Verb ] ;
// Segments = Segment { "/" Segment } ;
// Segment = "*" | "**" | LITERAL | Variable ;
// Variable = "{" FieldPath [ "=" Segments ] "}" ;
// FieldPath = IDENT { "." IDENT } ;
// Verb = ":" LITERAL ;
//
// The syntax `*` matches a single URL path segment. The syntax `**` matches
// zero or more URL path segments, which must be the last part of the URL path
// except the `Verb`.
//
// The syntax `Variable` matches part of the URL path as specified by its
// template. A variable template must not contain other variables. If a variable
// matches a single path segment, its template may be omitted, e.g. `{var}`
// is equivalent to `{var=*}`.
//
// The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL`
// contains any reserved character, such characters should be percent-encoded
// before the matching.
//
// If a variable contains exactly one path segment, such as `"{var}"` or
// `"{var=*}"`, when such a variable is expanded into a URL path on the client
// side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The
// server side does the reverse decoding. Such variables show up in the
// [Discovery
// Document](https://developers.google.com/discovery/v1/reference/apis) as
// `{var}`.
//
// If a variable contains multiple path segments, such as `"{var=foo/*}"`
// or `"{var=**}"`, when such a variable is expanded into a URL path on the
// client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded.
// The server side does the reverse decoding, except "%2F" and "%2f" are left
// unchanged. Such variables show up in the
// [Discovery
// Document](https://developers.google.com/discovery/v1/reference/apis) as
// `{+var}`.
//
// ## Using gRPC API Service Configuration
//
// gRPC API Service Configuration (service config) is a configuration language
// for configuring a gRPC service to become a user-facing product. The
// service config is simply the YAML representation of the `google.api.Service`
// proto message.
//
// As an alternative to annotating your proto file, you can configure gRPC
// transcoding in your service config YAML files. You do this by specifying a
// `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same
// effect as the proto annotation. This can be particularly useful if you
// have a proto that is reused in multiple services. Note that any transcoding
// specified in the service config will override any matching transcoding
// configuration in the proto.
//
// Example:
//
// http:
// rules:
// # Selects a gRPC method and applies HttpRule to it.
// - selector: example.v1.Messaging.GetMessage
// get: /v1/messages/{message_id}/{sub.subfield}
//
// ## Special notes
//
// When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the
// proto to JSON conversion must follow the [proto3
// specification](https://developers.google.com/protocol-buffers/docs/proto3#json).
//
// While the single segment variable follows the semantics of
// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String
// Expansion, the multi segment variable **does not** follow RFC 6570 Section
// 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion
// does not expand special characters like `?` and `#`, which would lead
// to invalid URLs. As the result, gRPC Transcoding uses a custom encoding
// for multi segment variables.
//
// The path variables **must not** refer to any repeated or mapped field,
// because client libraries are not capable of handling such variable expansion.
//
// The path variables **must not** capture the leading "/" character. The reason
// is that the most common use case "{var}" does not capture the leading "/"
// character. For consistency, all path variables must share the same behavior.
//
// Repeated message fields must not be mapped to URL query parameters, because
// no client library can support such complicated mapping.
//
// If an API needs to use a JSON array for request or response body, it can map
// the request or response body to a repeated field. However, some gRPC
// Transcoding implementations may not support this feature.
message HttpRule {
// Selects a method to which this rule applies.
//
// Refer to [selector][google.api.DocumentationRule.selector] for syntax
// details.
string selector = 1;
// Determines the URL pattern is matched by this rules. This pattern can be
// used with any of the {get|put|post|delete|patch} methods. A custom method
// can be defined using the 'custom' field.
oneof pattern {
// Maps to HTTP GET. Used for listing and getting information about
// resources.
string get = 2;
// Maps to HTTP PUT. Used for replacing a resource.
string put = 3;
// Maps to HTTP POST. Used for creating a resource or performing an action.
string post = 4;
// Maps to HTTP DELETE. Used for deleting a resource.
string delete = 5;
// Maps to HTTP PATCH. Used for updating a resource.
string patch = 6;
// The custom pattern is used for specifying an HTTP method that is not
// included in the `pattern` field, such as HEAD, or "*" to leave the
// HTTP method unspecified for this rule. The wild-card rule is useful
// for services that provide content to Web (HTML) clients.
CustomHttpPattern custom = 8;
}
// The name of the request field whose value is mapped to the HTTP request
// body, or `*` for mapping all request fields not captured by the path
// pattern to the HTTP body, or omitted for not having any HTTP request body.
//
// NOTE: the referred field must be present at the top-level of the request
// message type.
string body = 7;
// Optional. The name of the response field whose value is mapped to the HTTP
// response body. When omitted, the entire response message will be used
// as the HTTP response body.
//
// NOTE: The referred field must be present at the top-level of the response
// message type.
string response_body = 12;
// Additional HTTP bindings for the selector. Nested bindings must
// not contain an `additional_bindings` field themselves (that is,
// the nesting may only be one level deep).
repeated HttpRule additional_bindings = 11;
}
// A custom pattern is used for defining custom HTTP verb.
message CustomHttpPattern {
// The name of this custom HTTP verb.
string kind = 1;
// The path matched by this custom verb.
string path = 2;
}

View File

@@ -0,0 +1,81 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
import "google/protobuf/any.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/httpbody;httpbody";
option java_multiple_files = true;
option java_outer_classname = "HttpBodyProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// Message that represents an arbitrary HTTP body. It should only be used for
// payload formats that can't be represented as JSON, such as raw binary or
// an HTML page.
//
//
// This message can be used both in streaming and non-streaming API methods in
// the request as well as the response.
//
// It can be used as a top-level request field, which is convenient if one
// wants to extract parameters from either the URL or HTTP template into the
// request fields and also want access to the raw HTTP body.
//
// Example:
//
// message GetResourceRequest {
// // A unique request id.
// string request_id = 1;
//
// // The raw HTTP body is bound to this field.
// google.api.HttpBody http_body = 2;
//
// }
//
// service ResourceService {
// rpc GetResource(GetResourceRequest)
// returns (google.api.HttpBody);
// rpc UpdateResource(google.api.HttpBody)
// returns (google.protobuf.Empty);
//
// }
//
// Example with streaming methods:
//
// service CaldavService {
// rpc GetCalendar(stream google.api.HttpBody)
// returns (stream google.api.HttpBody);
// rpc UpdateCalendar(stream google.api.HttpBody)
// returns (stream google.api.HttpBody);
//
// }
//
// Use of this type only changes how the request and response bodies are
// handled, all other features will continue to work unchanged.
message HttpBody {
// The HTTP Content-Type header value specifying the content type of the body.
string content_type = 1;
// The HTTP request/response body as raw binary.
bytes data = 2;
// Application specific response metadata. Must be set in the first response
// for streaming APIs.
repeated google.protobuf.Any extensions = 3;
}

View File

@@ -0,0 +1,48 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/label;label";
option java_multiple_files = true;
option java_outer_classname = "LabelProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// A description of a label.
message LabelDescriptor {
// Value types that can be used as label values.
enum ValueType {
// A variable-length string. This is the default.
STRING = 0;
// Boolean; true or false.
BOOL = 1;
// A 64-bit signed integer.
INT64 = 2;
}
// The label key.
string key = 1;
// The type of data that can be assigned to the label.
ValueType value_type = 2;
// A human-readable description for the label.
string description = 3;
}

View File

@@ -0,0 +1,72 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
option go_package = "google.golang.org/genproto/googleapis/api;api";
option java_multiple_files = true;
option java_outer_classname = "LaunchStageProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// The launch stage as defined by [Google Cloud Platform
// Launch Stages](https://cloud.google.com/terms/launch-stages).
enum LaunchStage {
// Do not use this default value.
LAUNCH_STAGE_UNSPECIFIED = 0;
// The feature is not yet implemented. Users can not use it.
UNIMPLEMENTED = 6;
// Prelaunch features are hidden from users and are only visible internally.
PRELAUNCH = 7;
// Early Access features are limited to a closed group of testers. To use
// these features, you must sign up in advance and sign a Trusted Tester
// agreement (which includes confidentiality provisions). These features may
// be unstable, changed in backward-incompatible ways, and are not
// guaranteed to be released.
EARLY_ACCESS = 1;
// Alpha is a limited availability test for releases before they are cleared
// for widespread use. By Alpha, all significant design issues are resolved
// and we are in the process of verifying functionality. Alpha customers
// need to apply for access, agree to applicable terms, and have their
// projects allowlisted. Alpha releases don't have to be feature complete,
// no SLAs are provided, and there are no technical support obligations, but
// they will be far enough along that customers can actually use them in
// test environments or for limited-use tests -- just like they would in
// normal production cases.
ALPHA = 2;
// Beta is the point at which we are ready to open a release for any
// customer to use. There are no SLA or technical support obligations in a
// Beta release. Products will be complete from a feature perspective, but
// may have some open outstanding issues. Beta releases are suitable for
// limited production use cases.
BETA = 3;
// GA features are open to all developers and are considered stable and
// fully qualified for production use.
GA = 4;
// Deprecated features are scheduled to be shut down and removed. For more
// information, see the "Deprecation Policy" section of our [Terms of
// Service](https://cloud.google.com/terms/)
// and the [Google Cloud Platform Subject to the Deprecation
// Policy](https://cloud.google.com/terms/deprecation) documentation.
DEPRECATED = 5;
}

View File

@@ -0,0 +1,54 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
import "google/api/label.proto";
option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
option java_multiple_files = true;
option java_outer_classname = "LogProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// A description of a log type. Example in YAML format:
//
// - name: library.googleapis.com/activity_history
// description: The history of borrowing and returning library items.
// display_name: Activity
// labels:
// - key: /customer_id
// description: Identifier of a library customer
message LogDescriptor {
// The name of the log. It must be less than 512 characters long and can
// include the following characters: upper- and lower-case alphanumeric
// characters [A-Za-z0-9], and punctuation characters including
// slash, underscore, hyphen, period [/_-.].
string name = 1;
// The set of labels that are available to describe a specific log entry.
// Runtime requests that contain labels not specified here are
// considered invalid.
repeated LabelDescriptor labels = 2;
// A human-readable description of this log. This information appears in
// the documentation and can contain details.
string description = 3;
// The human-readable name for this log. This information appears on
// the user interface and should be concise.
string display_name = 4;
}

View File

@@ -0,0 +1,81 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
option java_multiple_files = true;
option java_outer_classname = "LoggingProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// Logging configuration of the service.
//
// The following example shows how to configure logs to be sent to the
// producer and consumer projects. In the example, the `activity_history`
// log is sent to both the producer and consumer projects, whereas the
// `purchase_history` log is only sent to the producer project.
//
// monitored_resources:
// - type: library.googleapis.com/branch
// labels:
// - key: /city
// description: The city where the library branch is located in.
// - key: /name
// description: The name of the branch.
// logs:
// - name: activity_history
// labels:
// - key: /customer_id
// - name: purchase_history
// logging:
// producer_destinations:
// - monitored_resource: library.googleapis.com/branch
// logs:
// - activity_history
// - purchase_history
// consumer_destinations:
// - monitored_resource: library.googleapis.com/branch
// logs:
// - activity_history
message Logging {
// Configuration of a specific logging destination (the producer project
// or the consumer project).
message LoggingDestination {
// The monitored resource type. The type must be defined in the
// [Service.monitored_resources][google.api.Service.monitored_resources]
// section.
string monitored_resource = 3;
// Names of the logs to be sent to this destination. Each name must
// be defined in the [Service.logs][google.api.Service.logs] section. If the
// log name is not a domain scoped name, it will be automatically prefixed
// with the service name followed by "/".
repeated string logs = 1;
}
// Logging configurations for sending logs to the producer project.
// There can be multiple producer destinations, each one must have a
// different monitored resource type. A log can be used in at most
// one producer destination.
repeated LoggingDestination producer_destinations = 1;
// Logging configurations for sending logs to the consumer project.
// There can be multiple consumer destinations, each one must have a
// different monitored resource type. A log can be used in at most
// one consumer destination.
repeated LoggingDestination consumer_destinations = 2;
}

View File

@@ -0,0 +1,268 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
import "google/api/label.proto";
import "google/api/launch_stage.proto";
import "google/protobuf/duration.proto";
option go_package = "google.golang.org/genproto/googleapis/api/metric;metric";
option java_multiple_files = true;
option java_outer_classname = "MetricProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// Defines a metric type and its schema. Once a metric descriptor is created,
// deleting or altering it stops data collection and makes the metric type's
// existing data unusable.
//
message MetricDescriptor {
// The kind of measurement. It describes how the data is reported.
// For information on setting the start time and end time based on
// the MetricKind, see [TimeInterval][google.monitoring.v3.TimeInterval].
enum MetricKind {
// Do not use this default value.
METRIC_KIND_UNSPECIFIED = 0;
// An instantaneous measurement of a value.
GAUGE = 1;
// The change in a value during a time interval.
DELTA = 2;
// A value accumulated over a time interval. Cumulative
// measurements in a time series should have the same start time
// and increasing end times, until an event resets the cumulative
// value to zero and sets a new start time for the following
// points.
CUMULATIVE = 3;
}
// The value type of a metric.
enum ValueType {
// Do not use this default value.
VALUE_TYPE_UNSPECIFIED = 0;
// The value is a boolean.
// This value type can be used only if the metric kind is `GAUGE`.
BOOL = 1;
// The value is a signed 64-bit integer.
INT64 = 2;
// The value is a double precision floating point number.
DOUBLE = 3;
// The value is a text string.
// This value type can be used only if the metric kind is `GAUGE`.
STRING = 4;
// The value is a [`Distribution`][google.api.Distribution].
DISTRIBUTION = 5;
// The value is money.
MONEY = 6;
}
// Additional annotations that can be used to guide the usage of a metric.
message MetricDescriptorMetadata {
// Deprecated. Must use the
// [MetricDescriptor.launch_stage][google.api.MetricDescriptor.launch_stage]
// instead.
LaunchStage launch_stage = 1 [deprecated = true];
// The sampling period of metric data points. For metrics which are written
// periodically, consecutive data points are stored at this time interval,
// excluding data loss due to errors. Metrics with a higher granularity have
// a smaller sampling period.
google.protobuf.Duration sample_period = 2;
// The delay of data points caused by ingestion. Data points older than this
// age are guaranteed to be ingested and available to be read, excluding
// data loss due to errors.
google.protobuf.Duration ingest_delay = 3;
}
// The resource name of the metric descriptor.
string name = 1;
// The metric type, including its DNS name prefix. The type is not
// URL-encoded. All user-defined metric types have the DNS name
// `custom.googleapis.com` or `external.googleapis.com`. Metric types should
// use a natural hierarchical grouping. For example:
//
// "custom.googleapis.com/invoice/paid/amount"
// "external.googleapis.com/prometheus/up"
// "appengine.googleapis.com/http/server/response_latencies"
string type = 8;
// The set of labels that can be used to describe a specific
// instance of this metric type. For example, the
// `appengine.googleapis.com/http/server/response_latencies` metric
// type has a label for the HTTP response code, `response_code`, so
// you can look at latencies for successful responses or just
// for responses that failed.
repeated LabelDescriptor labels = 2;
// Whether the metric records instantaneous values, changes to a value, etc.
// Some combinations of `metric_kind` and `value_type` might not be supported.
MetricKind metric_kind = 3;
// Whether the measurement is an integer, a floating-point number, etc.
// Some combinations of `metric_kind` and `value_type` might not be supported.
ValueType value_type = 4;
// The units in which the metric value is reported. It is only applicable
// if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit`
// defines the representation of the stored metric values.
//
// Different systems might scale the values to be more easily displayed (so a
// value of `0.02kBy` _might_ be displayed as `20By`, and a value of
// `3523kBy` _might_ be displayed as `3.5MBy`). However, if the `unit` is
// `kBy`, then the value of the metric is always in thousands of bytes, no
// matter how it might be displayed.
//
// If you want a custom metric to record the exact number of CPU-seconds used
// by a job, you can create an `INT64 CUMULATIVE` metric whose `unit` is
// `s{CPU}` (or equivalently `1s{CPU}` or just `s`). If the job uses 12,005
// CPU-seconds, then the value is written as `12005`.
//
// Alternatively, if you want a custom metric to record data in a more
// granular way, you can create a `DOUBLE CUMULATIVE` metric whose `unit` is
// `ks{CPU}`, and then write the value `12.005` (which is `12005/1000`),
// or use `Kis{CPU}` and write `11.723` (which is `12005/1024`).
//
// The supported units are a subset of [The Unified Code for Units of
// Measure](https://unitsofmeasure.org/ucum.html) standard:
//
// **Basic units (UNIT)**
//
// * `bit` bit
// * `By` byte
// * `s` second
// * `min` minute
// * `h` hour
// * `d` day
// * `1` dimensionless
//
// **Prefixes (PREFIX)**
//
// * `k` kilo (10^3)
// * `M` mega (10^6)
// * `G` giga (10^9)
// * `T` tera (10^12)
// * `P` peta (10^15)
// * `E` exa (10^18)
// * `Z` zetta (10^21)
// * `Y` yotta (10^24)
//
// * `m` milli (10^-3)
// * `u` micro (10^-6)
// * `n` nano (10^-9)
// * `p` pico (10^-12)
// * `f` femto (10^-15)
// * `a` atto (10^-18)
// * `z` zepto (10^-21)
// * `y` yocto (10^-24)
//
// * `Ki` kibi (2^10)
// * `Mi` mebi (2^20)
// * `Gi` gibi (2^30)
// * `Ti` tebi (2^40)
// * `Pi` pebi (2^50)
//
// **Grammar**
//
// The grammar also includes these connectors:
//
// * `/` division or ratio (as an infix operator). For examples,
// `kBy/{email}` or `MiBy/10ms` (although you should almost never
// have `/s` in a metric `unit`; rates should always be computed at
// query time from the underlying cumulative or delta value).
// * `.` multiplication or composition (as an infix operator). For
// examples, `GBy.d` or `k{watt}.h`.
//
// The grammar for a unit is as follows:
//
// Expression = Component { "." Component } { "/" Component } ;
//
// Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ]
// | Annotation
// | "1"
// ;
//
// Annotation = "{" NAME "}" ;
//
// Notes:
//
// * `Annotation` is just a comment if it follows a `UNIT`. If the annotation
// is used alone, then the unit is equivalent to `1`. For examples,
// `{request}/s == 1/s`, `By{transmitted}/s == By/s`.
// * `NAME` is a sequence of non-blank printable ASCII characters not
// containing `{` or `}`.
// * `1` represents a unitary [dimensionless
// unit](https://en.wikipedia.org/wiki/Dimensionless_quantity) of 1, such
// as in `1/s`. It is typically used when none of the basic units are
// appropriate. For example, "new users per day" can be represented as
// `1/d` or `{new-users}/d` (and a metric value `5` would mean "5 new
// users). Alternatively, "thousands of page views per day" would be
// represented as `1000/d` or `k1/d` or `k{page_views}/d` (and a metric
// value of `5.3` would mean "5300 page views per day").
// * `%` represents dimensionless value of 1/100, and annotates values giving
// a percentage (so the metric values are typically in the range of 0..100,
// and a metric value `3` means "3 percent").
// * `10^2.%` indicates a metric contains a ratio, typically in the range
// 0..1, that will be multiplied by 100 and displayed as a percentage
// (so a metric value `0.03` means "3 percent").
string unit = 5;
// A detailed description of the metric, which can be used in documentation.
string description = 6;
// A concise name for the metric, which can be displayed in user interfaces.
// Use sentence case without an ending period, for example "Request count".
// This field is optional but it is recommended to be set for any metrics
// associated with user-visible concepts, such as Quota.
string display_name = 7;
// Optional. Metadata which can be used to guide usage of the metric.
MetricDescriptorMetadata metadata = 10;
// Optional. The launch stage of the metric definition.
LaunchStage launch_stage = 12;
// Read-only. If present, then a [time
// series][google.monitoring.v3.TimeSeries], which is identified partially by
// a metric type and a
// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor], that
// is associated with this metric type can only be associated with one of the
// monitored resource types listed here.
repeated string monitored_resource_types = 13;
}
// A specific metric, identified by specifying values for all of the
// labels of a [`MetricDescriptor`][google.api.MetricDescriptor].
message Metric {
// An existing metric type, see
// [google.api.MetricDescriptor][google.api.MetricDescriptor]. For example,
// `custom.googleapis.com/invoice/paid/amount`.
string type = 3;
// The set of label values that uniquely identify this metric. All
// labels listed in the `MetricDescriptor` must be assigned values.
map<string, string> labels = 2;
}

View File

@@ -0,0 +1,130 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
import "google/api/label.proto";
import "google/api/launch_stage.proto";
import "google/protobuf/struct.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/monitoredres;monitoredres";
option java_multiple_files = true;
option java_outer_classname = "MonitoredResourceProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// An object that describes the schema of a
// [MonitoredResource][google.api.MonitoredResource] object using a type name
// and a set of labels. For example, the monitored resource descriptor for
// Google Compute Engine VM instances has a type of
// `"gce_instance"` and specifies the use of the labels `"instance_id"` and
// `"zone"` to identify particular VM instances.
//
// Different APIs can support different monitored resource types. APIs generally
// provide a `list` method that returns the monitored resource descriptors used
// by the API.
//
message MonitoredResourceDescriptor {
// Optional. The resource name of the monitored resource descriptor:
// `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where
// {type} is the value of the `type` field in this object and
// {project_id} is a project ID that provides API-specific context for
// accessing the type. APIs that do not use project information can use the
// resource name format `"monitoredResourceDescriptors/{type}"`.
string name = 5;
// Required. The monitored resource type. For example, the type
// `"cloudsql_database"` represents databases in Google Cloud SQL.
// For a list of types, see [Monitored resource
// types](https://cloud.google.com/monitoring/api/resources)
// and [Logging resource
// types](https://cloud.google.com/logging/docs/api/v2/resource-list).
string type = 1;
// Optional. A concise name for the monitored resource type that might be
// displayed in user interfaces. It should be a Title Cased Noun Phrase,
// without any article or other determiners. For example,
// `"Google Cloud SQL Database"`.
string display_name = 2;
// Optional. A detailed description of the monitored resource type that might
// be used in documentation.
string description = 3;
// Required. A set of labels used to describe instances of this monitored
// resource type. For example, an individual Google Cloud SQL database is
// identified by values for the labels `"database_id"` and `"zone"`.
repeated LabelDescriptor labels = 4;
// Optional. The launch stage of the monitored resource definition.
LaunchStage launch_stage = 7;
}
// An object representing a resource that can be used for monitoring, logging,
// billing, or other purposes. Examples include virtual machine instances,
// databases, and storage devices such as disks. The `type` field identifies a
// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object
// that describes the resource's schema. Information in the `labels` field
// identifies the actual resource and its attributes according to the schema.
// For example, a particular Compute Engine VM instance could be represented by
// the following object, because the
// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] for
// `"gce_instance"` has labels
// `"project_id"`, `"instance_id"` and `"zone"`:
//
// { "type": "gce_instance",
// "labels": { "project_id": "my-project",
// "instance_id": "12345678901234",
// "zone": "us-central1-a" }}
message MonitoredResource {
// Required. The monitored resource type. This field must match
// the `type` field of a
// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor]
// object. For example, the type of a Compute Engine VM instance is
// `gce_instance`. Some descriptors include the service name in the type; for
// example, the type of a Datastream stream is
// `datastream.googleapis.com/Stream`.
string type = 1;
// Required. Values for all of the labels listed in the associated monitored
// resource descriptor. For example, Compute Engine VM instances use the
// labels `"project_id"`, `"instance_id"`, and `"zone"`.
map<string, string> labels = 2;
}
// Auxiliary metadata for a [MonitoredResource][google.api.MonitoredResource]
// object. [MonitoredResource][google.api.MonitoredResource] objects contain the
// minimum set of information to uniquely identify a monitored resource
// instance. There is some other useful auxiliary metadata. Monitoring and
// Logging use an ingestion pipeline to extract metadata for cloud resources of
// all types, and store the metadata in this message.
message MonitoredResourceMetadata {
// Output only. Values for predefined system metadata labels.
// System labels are a kind of metadata extracted by Google, including
// "machine_image", "vpc", "subnet_id",
// "security_group", "name", etc.
// System label values can be only strings, Boolean values, or a list of
// strings. For example:
//
// { "name": "my-test-instance",
// "security_group": ["a", "b", "c"],
// "spot_instance": false }
google.protobuf.Struct system_labels = 1;
// Output only. A map of user-defined metadata labels.
map<string, string> user_labels = 2;
}

View File

@@ -0,0 +1,107 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
option java_multiple_files = true;
option java_outer_classname = "MonitoringProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// Monitoring configuration of the service.
//
// The example below shows how to configure monitored resources and metrics
// for monitoring. In the example, a monitored resource and two metrics are
// defined. The `library.googleapis.com/book/returned_count` metric is sent
// to both producer and consumer projects, whereas the
// `library.googleapis.com/book/num_overdue` metric is only sent to the
// consumer project.
//
// monitored_resources:
// - type: library.googleapis.com/Branch
// display_name: "Library Branch"
// description: "A branch of a library."
// launch_stage: GA
// labels:
// - key: resource_container
// description: "The Cloud container (ie. project id) for the Branch."
// - key: location
// description: "The location of the library branch."
// - key: branch_id
// description: "The id of the branch."
// metrics:
// - name: library.googleapis.com/book/returned_count
// display_name: "Books Returned"
// description: "The count of books that have been returned."
// launch_stage: GA
// metric_kind: DELTA
// value_type: INT64
// unit: "1"
// labels:
// - key: customer_id
// description: "The id of the customer."
// - name: library.googleapis.com/book/num_overdue
// display_name: "Books Overdue"
// description: "The current number of overdue books."
// launch_stage: GA
// metric_kind: GAUGE
// value_type: INT64
// unit: "1"
// labels:
// - key: customer_id
// description: "The id of the customer."
// monitoring:
// producer_destinations:
// - monitored_resource: library.googleapis.com/Branch
// metrics:
// - library.googleapis.com/book/returned_count
// consumer_destinations:
// - monitored_resource: library.googleapis.com/Branch
// metrics:
// - library.googleapis.com/book/returned_count
// - library.googleapis.com/book/num_overdue
message Monitoring {
// Configuration of a specific monitoring destination (the producer project
// or the consumer project).
message MonitoringDestination {
// The monitored resource type. The type must be defined in
// [Service.monitored_resources][google.api.Service.monitored_resources]
// section.
string monitored_resource = 1;
// Types of the metrics to report to this monitoring destination.
// Each type must be defined in
// [Service.metrics][google.api.Service.metrics] section.
repeated string metrics = 2;
}
// Monitoring configurations for sending metrics to the producer project.
// There can be multiple producer destinations. A monitored resource type may
// appear in multiple monitoring destinations if different aggregations are
// needed for different sets of metrics associated with that monitored
// resource type. A monitored resource and metric pair may only be used once
// in the Monitoring configuration.
repeated MonitoringDestination producer_destinations = 1;
// Monitoring configurations for sending metrics to the consumer project.
// There can be multiple consumer destinations. A monitored resource type may
// appear in multiple monitoring destinations if different aggregations are
// needed for different sets of metrics associated with that monitored
// resource type. A monitored resource and metric pair may only be used once
// in the Monitoring configuration.
repeated MonitoringDestination consumer_destinations = 2;
}

View File

@@ -0,0 +1,85 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
import "google/protobuf/descriptor.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
option java_multiple_files = true;
option java_outer_classname = "PolicyProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// Provides `google.api.field_policy` annotation at proto fields.
extend google.protobuf.FieldOptions {
// See [FieldPolicy][].
FieldPolicy field_policy = 158361448;
}
// Provides `google.api.method_policy` annotation at proto methods.
extend google.protobuf.MethodOptions {
// See [MethodPolicy][].
MethodPolicy method_policy = 161893301;
}
// Google API Policy Annotation
//
// This message defines a simple API policy annotation that can be used to
// annotate API request and response message fields with applicable policies.
// One field may have multiple applicable policies that must all be satisfied
// before a request can be processed. This policy annotation is used to
// generate the overall policy that will be used for automatic runtime
// policy enforcement and documentation generation.
message FieldPolicy {
// Selects one or more request or response message fields to apply this
// `FieldPolicy`.
//
// When a `FieldPolicy` is used in proto annotation, the selector must
// be left as empty. The service config generator will automatically fill
// the correct value.
//
// When a `FieldPolicy` is used in service config, the selector must be a
// comma-separated string with valid request or response field paths,
// such as "foo.bar" or "foo.bar,foo.baz".
string selector = 1;
// Specifies the required permission(s) for the resource referred to by the
// field. It requires the field contains a valid resource reference, and
// the request must pass the permission checks to proceed. For example,
// "resourcemanager.projects.get".
string resource_permission = 2;
// Specifies the resource type for the resource referred to by the field.
string resource_type = 3;
}
// Defines policies applying to an RPC method.
message MethodPolicy {
// Selects a method to which these policies should be enforced, for example,
// "google.pubsub.v1.Subscriber.CreateSubscription".
//
// Refer to [selector][google.api.DocumentationRule.selector] for syntax
// details.
//
// NOTE: This field must not be set in the proto annotation. It will be
// automatically filled by the service config compiler .
string selector = 9;
// Policies that are applicable to the request message.
repeated FieldPolicy request_policies = 2;
}

View File

@@ -0,0 +1,184 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
option java_multiple_files = true;
option java_outer_classname = "QuotaProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// Quota configuration helps to achieve fairness and budgeting in service
// usage.
//
// The metric based quota configuration works this way:
// - The service configuration defines a set of metrics.
// - For API calls, the quota.metric_rules maps methods to metrics with
// corresponding costs.
// - The quota.limits defines limits on the metrics, which will be used for
// quota checks at runtime.
//
// An example quota configuration in yaml format:
//
// quota:
// limits:
//
// - name: apiWriteQpsPerProject
// metric: library.googleapis.com/write_calls
// unit: "1/min/{project}" # rate limit for consumer projects
// values:
// STANDARD: 10000
//
//
// (The metric rules bind all methods to the read_calls metric,
// except for the UpdateBook and DeleteBook methods. These two methods
// are mapped to the write_calls metric, with the UpdateBook method
// consuming at twice rate as the DeleteBook method.)
// metric_rules:
// - selector: "*"
// metric_costs:
// library.googleapis.com/read_calls: 1
// - selector: google.example.library.v1.LibraryService.UpdateBook
// metric_costs:
// library.googleapis.com/write_calls: 2
// - selector: google.example.library.v1.LibraryService.DeleteBook
// metric_costs:
// library.googleapis.com/write_calls: 1
//
// Corresponding Metric definition:
//
// metrics:
// - name: library.googleapis.com/read_calls
// display_name: Read requests
// metric_kind: DELTA
// value_type: INT64
//
// - name: library.googleapis.com/write_calls
// display_name: Write requests
// metric_kind: DELTA
// value_type: INT64
//
//
message Quota {
// List of QuotaLimit definitions for the service.
repeated QuotaLimit limits = 3;
// List of MetricRule definitions, each one mapping a selected method to one
// or more metrics.
repeated MetricRule metric_rules = 4;
}
// Bind API methods to metrics. Binding a method to a metric causes that
// metric's configured quota behaviors to apply to the method call.
message MetricRule {
// Selects the methods to which this rule applies.
//
// Refer to [selector][google.api.DocumentationRule.selector] for syntax
// details.
string selector = 1;
// Metrics to update when the selected methods are called, and the associated
// cost applied to each metric.
//
// The key of the map is the metric name, and the values are the amount
// increased for the metric against which the quota limits are defined.
// The value must not be negative.
map<string, int64> metric_costs = 2;
}
// `QuotaLimit` defines a specific limit that applies over a specified duration
// for a limit type. There can be at most one limit for a duration and limit
// type combination defined within a `QuotaGroup`.
message QuotaLimit {
// Name of the quota limit.
//
// The name must be provided, and it must be unique within the service. The
// name can only include alphanumeric characters as well as '-'.
//
// The maximum length of the limit name is 64 characters.
string name = 6;
// Optional. User-visible, extended description for this quota limit.
// Should be used only when more context is needed to understand this limit
// than provided by the limit's display name (see: `display_name`).
string description = 2;
// Default number of tokens that can be consumed during the specified
// duration. This is the number of tokens assigned when a client
// application developer activates the service for his/her project.
//
// Specifying a value of 0 will block all requests. This can be used if you
// are provisioning quota to selected consumers and blocking others.
// Similarly, a value of -1 will indicate an unlimited quota. No other
// negative values are allowed.
//
// Used by group-based quotas only.
int64 default_limit = 3;
// Maximum number of tokens that can be consumed during the specified
// duration. Client application developers can override the default limit up
// to this maximum. If specified, this value cannot be set to a value less
// than the default limit. If not specified, it is set to the default limit.
//
// To allow clients to apply overrides with no upper bound, set this to -1,
// indicating unlimited maximum quota.
//
// Used by group-based quotas only.
int64 max_limit = 4;
// Free tier value displayed in the Developers Console for this limit.
// The free tier is the number of tokens that will be subtracted from the
// billed amount when billing is enabled.
// This field can only be set on a limit with duration "1d", in a billable
// group; it is invalid on any other limit. If this field is not set, it
// defaults to 0, indicating that there is no free tier for this service.
//
// Used by group-based quotas only.
int64 free_tier = 7;
// Duration of this limit in textual notation. Must be "100s" or "1d".
//
// Used by group-based quotas only.
string duration = 5;
// The name of the metric this quota limit applies to. The quota limits with
// the same metric will be checked together during runtime. The metric must be
// defined within the service config.
string metric = 8;
// Specify the unit of the quota limit. It uses the same syntax as
// [Metric.unit][]. The supported unit kinds are determined by the quota
// backend system.
//
// Here are some examples:
// * "1/min/{project}" for quota per minute per project.
//
// Note: the order of unit components is insignificant.
// The "1" at the beginning is required to follow the metric unit syntax.
string unit = 9;
// Tiered limit values. You must specify this as a key:value pair, with an
// integer value that is the maximum number of requests allowed for the
// specified unit. Currently only STANDARD is supported.
map<string, int64> values = 10;
// User-visible display name for this limit.
// Optional. If not set, the UI will provide a default display name based on
// the quota configuration. This field can be used to override the default
// display name generated from the configuration.
string display_name = 12;
}

View File

@@ -0,0 +1,238 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
import "google/protobuf/descriptor.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
option java_multiple_files = true;
option java_outer_classname = "ResourceProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
extend google.protobuf.FieldOptions {
// An annotation that describes a resource reference, see
// [ResourceReference][].
google.api.ResourceReference resource_reference = 1055;
}
extend google.protobuf.FileOptions {
// An annotation that describes a resource definition without a corresponding
// message; see [ResourceDescriptor][].
repeated google.api.ResourceDescriptor resource_definition = 1053;
}
extend google.protobuf.MessageOptions {
// An annotation that describes a resource definition, see
// [ResourceDescriptor][].
google.api.ResourceDescriptor resource = 1053;
}
// A simple descriptor of a resource type.
//
// ResourceDescriptor annotates a resource message (either by means of a
// protobuf annotation or use in the service config), and associates the
// resource's schema, the resource type, and the pattern of the resource name.
//
// Example:
//
// message Topic {
// // Indicates this message defines a resource schema.
// // Declares the resource type in the format of {service}/{kind}.
// // For Kubernetes resources, the format is {api group}/{kind}.
// option (google.api.resource) = {
// type: "pubsub.googleapis.com/Topic"
// pattern: "projects/{project}/topics/{topic}"
// };
// }
//
// The ResourceDescriptor Yaml config will look like:
//
// resources:
// - type: "pubsub.googleapis.com/Topic"
// pattern: "projects/{project}/topics/{topic}"
//
// Sometimes, resources have multiple patterns, typically because they can
// live under multiple parents.
//
// Example:
//
// message LogEntry {
// option (google.api.resource) = {
// type: "logging.googleapis.com/LogEntry"
// pattern: "projects/{project}/logs/{log}"
// pattern: "folders/{folder}/logs/{log}"
// pattern: "organizations/{organization}/logs/{log}"
// pattern: "billingAccounts/{billing_account}/logs/{log}"
// };
// }
//
// The ResourceDescriptor Yaml config will look like:
//
// resources:
// - type: 'logging.googleapis.com/LogEntry'
// pattern: "projects/{project}/logs/{log}"
// pattern: "folders/{folder}/logs/{log}"
// pattern: "organizations/{organization}/logs/{log}"
// pattern: "billingAccounts/{billing_account}/logs/{log}"
message ResourceDescriptor {
// A description of the historical or future-looking state of the
// resource pattern.
enum History {
// The "unset" value.
HISTORY_UNSPECIFIED = 0;
// The resource originally had one pattern and launched as such, and
// additional patterns were added later.
ORIGINALLY_SINGLE_PATTERN = 1;
// The resource has one pattern, but the API owner expects to add more
// later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents
// that from being necessary once there are multiple patterns.)
FUTURE_MULTI_PATTERN = 2;
}
// A flag representing a specific style that a resource claims to conform to.
enum Style {
// The unspecified value. Do not use.
STYLE_UNSPECIFIED = 0;
// This resource is intended to be "declarative-friendly".
//
// Declarative-friendly resources must be more strictly consistent, and
// setting this to true communicates to tools that this resource should
// adhere to declarative-friendly expectations.
//
// Note: This is used by the API linter (linter.aip.dev) to enable
// additional checks.
DECLARATIVE_FRIENDLY = 1;
}
// The resource type. It must be in the format of
// {service_name}/{resource_type_kind}. The `resource_type_kind` must be
// singular and must not include version numbers.
//
// Example: `storage.googleapis.com/Bucket`
//
// The value of the resource_type_kind must follow the regular expression
// /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and
// should use PascalCase (UpperCamelCase). The maximum number of
// characters allowed for the `resource_type_kind` is 100.
string type = 1;
// Optional. The relative resource name pattern associated with this resource
// type. The DNS prefix of the full resource name shouldn't be specified here.
//
// The path pattern must follow the syntax, which aligns with HTTP binding
// syntax:
//
// Template = Segment { "/" Segment } ;
// Segment = LITERAL | Variable ;
// Variable = "{" LITERAL "}" ;
//
// Examples:
//
// - "projects/{project}/topics/{topic}"
// - "projects/{project}/knowledgeBases/{knowledge_base}"
//
// The components in braces correspond to the IDs for each resource in the
// hierarchy. It is expected that, if multiple patterns are provided,
// the same component name (e.g. "project") refers to IDs of the same
// type of resource.
repeated string pattern = 2;
// Optional. The field on the resource that designates the resource name
// field. If omitted, this is assumed to be "name".
string name_field = 3;
// Optional. The historical or future-looking state of the resource pattern.
//
// Example:
//
// // The InspectTemplate message originally only supported resource
// // names with organization, and project was added later.
// message InspectTemplate {
// option (google.api.resource) = {
// type: "dlp.googleapis.com/InspectTemplate"
// pattern:
// "organizations/{organization}/inspectTemplates/{inspect_template}"
// pattern: "projects/{project}/inspectTemplates/{inspect_template}"
// history: ORIGINALLY_SINGLE_PATTERN
// };
// }
History history = 4;
// The plural name used in the resource name and permission names, such as
// 'projects' for the resource name of 'projects/{project}' and the permission
// name of 'cloudresourcemanager.googleapis.com/projects.get'. It is the same
// concept of the `plural` field in k8s CRD spec
// https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/
//
// Note: The plural form is required even for singleton resources. See
// https://aip.dev/156
string plural = 5;
// The same concept of the `singular` field in k8s CRD spec
// https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/
// Such as "project" for the `resourcemanager.googleapis.com/Project` type.
string singular = 6;
// Style flag(s) for this resource.
// These indicate that a resource is expected to conform to a given
// style. See the specific style flags for additional information.
repeated Style style = 10;
}
// Defines a proto annotation that describes a string field that refers to
// an API resource.
message ResourceReference {
// The resource type that the annotated field references.
//
// Example:
//
// message Subscription {
// string topic = 2 [(google.api.resource_reference) = {
// type: "pubsub.googleapis.com/Topic"
// }];
// }
//
// Occasionally, a field may reference an arbitrary resource. In this case,
// APIs use the special value * in their resource reference.
//
// Example:
//
// message GetIamPolicyRequest {
// string resource = 2 [(google.api.resource_reference) = {
// type: "*"
// }];
// }
string type = 1;
// The resource type of a child collection that the annotated field
// references. This is useful for annotating the `parent` field that
// doesn't have a fixed resource type.
//
// Example:
//
// message ListLogEntriesRequest {
// string parent = 1 [(google.api.resource_reference) = {
// child_type: "logging.googleapis.com/LogEntry"
// };
// }
string child_type = 2;
}

View File

@@ -0,0 +1,461 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
import "google/protobuf/descriptor.proto";
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
option java_multiple_files = true;
option java_outer_classname = "RoutingProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
extend google.protobuf.MethodOptions {
// See RoutingRule.
google.api.RoutingRule routing = 72295729;
}
// Specifies the routing information that should be sent along with the request
// in the form of routing header.
// **NOTE:** All service configuration rules follow the "last one wins" order.
//
// The examples below will apply to an RPC which has the following request type:
//
// Message Definition:
//
// message Request {
// // The name of the Table
// // Values can be of the following formats:
// // - `projects/<project>/tables/<table>`
// // - `projects/<project>/instances/<instance>/tables/<table>`
// // - `region/<region>/zones/<zone>/tables/<table>`
// string table_name = 1;
//
// // This value specifies routing for replication.
// // It can be in the following formats:
// // - `profiles/<profile_id>`
// // - a legacy `profile_id` that can be any string
// string app_profile_id = 2;
// }
//
// Example message:
//
// {
// table_name: projects/proj_foo/instances/instance_bar/table/table_baz,
// app_profile_id: profiles/prof_qux
// }
//
// The routing header consists of one or multiple key-value pairs. Every key
// and value must be percent-encoded, and joined together in the format of
// `key1=value1&key2=value2`.
// In the examples below I am skipping the percent-encoding for readablity.
//
// Example 1
//
// Extracting a field from the request to put into the routing header
// unchanged, with the key equal to the field name.
//
// annotation:
//
// option (google.api.routing) = {
// // Take the `app_profile_id`.
// routing_parameters {
// field: "app_profile_id"
// }
// };
//
// result:
//
// x-goog-request-params: app_profile_id=profiles/prof_qux
//
// Example 2
//
// Extracting a field from the request to put into the routing header
// unchanged, with the key different from the field name.
//
// annotation:
//
// option (google.api.routing) = {
// // Take the `app_profile_id`, but name it `routing_id` in the header.
// routing_parameters {
// field: "app_profile_id"
// path_template: "{routing_id=**}"
// }
// };
//
// result:
//
// x-goog-request-params: routing_id=profiles/prof_qux
//
// Example 3
//
// Extracting a field from the request to put into the routing
// header, while matching a path template syntax on the field's value.
//
// NB: it is more useful to send nothing than to send garbage for the purpose
// of dynamic routing, since garbage pollutes cache. Thus the matching.
//
// Sub-example 3a
//
// The field matches the template.
//
// annotation:
//
// option (google.api.routing) = {
// // Take the `table_name`, if it's well-formed (with project-based
// // syntax).
// routing_parameters {
// field: "table_name"
// path_template: "{table_name=projects/*/instances/*/**}"
// }
// };
//
// result:
//
// x-goog-request-params:
// table_name=projects/proj_foo/instances/instance_bar/table/table_baz
//
// Sub-example 3b
//
// The field does not match the template.
//
// annotation:
//
// option (google.api.routing) = {
// // Take the `table_name`, if it's well-formed (with region-based
// // syntax).
// routing_parameters {
// field: "table_name"
// path_template: "{table_name=regions/*/zones/*/**}"
// }
// };
//
// result:
//
// <no routing header will be sent>
//
// Sub-example 3c
//
// Multiple alternative conflictingly named path templates are
// specified. The one that matches is used to construct the header.
//
// annotation:
//
// option (google.api.routing) = {
// // Take the `table_name`, if it's well-formed, whether
// // using the region- or projects-based syntax.
//
// routing_parameters {
// field: "table_name"
// path_template: "{table_name=regions/*/zones/*/**}"
// }
// routing_parameters {
// field: "table_name"
// path_template: "{table_name=projects/*/instances/*/**}"
// }
// };
//
// result:
//
// x-goog-request-params:
// table_name=projects/proj_foo/instances/instance_bar/table/table_baz
//
// Example 4
//
// Extracting a single routing header key-value pair by matching a
// template syntax on (a part of) a single request field.
//
// annotation:
//
// option (google.api.routing) = {
// // Take just the project id from the `table_name` field.
// routing_parameters {
// field: "table_name"
// path_template: "{routing_id=projects/*}/**"
// }
// };
//
// result:
//
// x-goog-request-params: routing_id=projects/proj_foo
//
// Example 5
//
// Extracting a single routing header key-value pair by matching
// several conflictingly named path templates on (parts of) a single request
// field. The last template to match "wins" the conflict.
//
// annotation:
//
// option (google.api.routing) = {
// // If the `table_name` does not have instances information,
// // take just the project id for routing.
// // Otherwise take project + instance.
//
// routing_parameters {
// field: "table_name"
// path_template: "{routing_id=projects/*}/**"
// }
// routing_parameters {
// field: "table_name"
// path_template: "{routing_id=projects/*/instances/*}/**"
// }
// };
//
// result:
//
// x-goog-request-params:
// routing_id=projects/proj_foo/instances/instance_bar
//
// Example 6
//
// Extracting multiple routing header key-value pairs by matching
// several non-conflicting path templates on (parts of) a single request field.
//
// Sub-example 6a
//
// Make the templates strict, so that if the `table_name` does not
// have an instance information, nothing is sent.
//
// annotation:
//
// option (google.api.routing) = {
// // The routing code needs two keys instead of one composite
// // but works only for the tables with the "project-instance" name
// // syntax.
//
// routing_parameters {
// field: "table_name"
// path_template: "{project_id=projects/*}/instances/*/**"
// }
// routing_parameters {
// field: "table_name"
// path_template: "projects/*/{instance_id=instances/*}/**"
// }
// };
//
// result:
//
// x-goog-request-params:
// project_id=projects/proj_foo&instance_id=instances/instance_bar
//
// Sub-example 6b
//
// Make the templates loose, so that if the `table_name` does not
// have an instance information, just the project id part is sent.
//
// annotation:
//
// option (google.api.routing) = {
// // The routing code wants two keys instead of one composite
// // but will work with just the `project_id` for tables without
// // an instance in the `table_name`.
//
// routing_parameters {
// field: "table_name"
// path_template: "{project_id=projects/*}/**"
// }
// routing_parameters {
// field: "table_name"
// path_template: "projects/*/{instance_id=instances/*}/**"
// }
// };
//
// result (is the same as 6a for our example message because it has the instance
// information):
//
// x-goog-request-params:
// project_id=projects/proj_foo&instance_id=instances/instance_bar
//
// Example 7
//
// Extracting multiple routing header key-value pairs by matching
// several path templates on multiple request fields.
//
// NB: note that here there is no way to specify sending nothing if one of the
// fields does not match its template. E.g. if the `table_name` is in the wrong
// format, the `project_id` will not be sent, but the `routing_id` will be.
// The backend routing code has to be aware of that and be prepared to not
// receive a full complement of keys if it expects multiple.
//
// annotation:
//
// option (google.api.routing) = {
// // The routing needs both `project_id` and `routing_id`
// // (from the `app_profile_id` field) for routing.
//
// routing_parameters {
// field: "table_name"
// path_template: "{project_id=projects/*}/**"
// }
// routing_parameters {
// field: "app_profile_id"
// path_template: "{routing_id=**}"
// }
// };
//
// result:
//
// x-goog-request-params:
// project_id=projects/proj_foo&routing_id=profiles/prof_qux
//
// Example 8
//
// Extracting a single routing header key-value pair by matching
// several conflictingly named path templates on several request fields. The
// last template to match "wins" the conflict.
//
// annotation:
//
// option (google.api.routing) = {
// // The `routing_id` can be a project id or a region id depending on
// // the table name format, but only if the `app_profile_id` is not set.
// // If `app_profile_id` is set it should be used instead.
//
// routing_parameters {
// field: "table_name"
// path_template: "{routing_id=projects/*}/**"
// }
// routing_parameters {
// field: "table_name"
// path_template: "{routing_id=regions/*}/**"
// }
// routing_parameters {
// field: "app_profile_id"
// path_template: "{routing_id=**}"
// }
// };
//
// result:
//
// x-goog-request-params: routing_id=profiles/prof_qux
//
// Example 9
//
// Bringing it all together.
//
// annotation:
//
// option (google.api.routing) = {
// // For routing both `table_location` and a `routing_id` are needed.
// //
// // table_location can be either an instance id or a region+zone id.
// //
// // For `routing_id`, take the value of `app_profile_id`
// // - If it's in the format `profiles/<profile_id>`, send
// // just the `<profile_id>` part.
// // - If it's any other literal, send it as is.
// // If the `app_profile_id` is empty, and the `table_name` starts with
// // the project_id, send that instead.
//
// routing_parameters {
// field: "table_name"
// path_template: "projects/*/{table_location=instances/*}/tables/*"
// }
// routing_parameters {
// field: "table_name"
// path_template: "{table_location=regions/*/zones/*}/tables/*"
// }
// routing_parameters {
// field: "table_name"
// path_template: "{routing_id=projects/*}/**"
// }
// routing_parameters {
// field: "app_profile_id"
// path_template: "{routing_id=**}"
// }
// routing_parameters {
// field: "app_profile_id"
// path_template: "profiles/{routing_id=*}"
// }
// };
//
// result:
//
// x-goog-request-params:
// table_location=instances/instance_bar&routing_id=prof_qux
message RoutingRule {
// A collection of Routing Parameter specifications.
// **NOTE:** If multiple Routing Parameters describe the same key
// (via the `path_template` field or via the `field` field when
// `path_template` is not provided), "last one wins" rule
// determines which Parameter gets used.
// See the examples for more details.
repeated RoutingParameter routing_parameters = 2;
}
// A projection from an input message to the GRPC or REST header.
message RoutingParameter {
// A request field to extract the header key-value pair from.
string field = 1;
// A pattern matching the key-value field. Optional.
// If not specified, the whole field specified in the `field` field will be
// taken as value, and its name used as key. If specified, it MUST contain
// exactly one named segment (along with any number of unnamed segments) The
// pattern will be matched over the field specified in the `field` field, then
// if the match is successful:
// - the name of the single named segment will be used as a header name,
// - the match value of the segment will be used as a header value;
// if the match is NOT successful, nothing will be sent.
//
// Example:
//
// -- This is a field in the request message
// | that the header value will be extracted from.
// |
// | -- This is the key name in the
// | | routing header.
// V |
// field: "table_name" v
// path_template: "projects/*/{table_location=instances/*}/tables/*"
// ^ ^
// | |
// In the {} brackets is the pattern that -- |
// specifies what to extract from the |
// field as a value to be sent. |
// |
// The string in the field must match the whole pattern --
// before brackets, inside brackets, after brackets.
//
// When looking at this specific example, we can see that:
// - A key-value pair with the key `table_location`
// and the value matching `instances/*` should be added
// to the x-goog-request-params routing header.
// - The value is extracted from the request message's `table_name` field
// if it matches the full pattern specified:
// `projects/*/instances/*/tables/*`.
//
// **NB:** If the `path_template` field is not provided, the key name is
// equal to the field name, and the whole field should be sent as a value.
// This makes the pattern for the field and the value functionally equivalent
// to `**`, and the configuration
//
// {
// field: "table_name"
// }
//
// is a functionally equivalent shorthand to:
//
// {
// field: "table_name"
// path_template: "{table_name=**}"
// }
//
// See Example 1 for more details.
string path_template = 2;
}

View File

@@ -0,0 +1,191 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
import "google/api/auth.proto";
import "google/api/backend.proto";
import "google/api/billing.proto";
import "google/api/client.proto";
import "google/api/context.proto";
import "google/api/control.proto";
import "google/api/documentation.proto";
import "google/api/endpoint.proto";
import "google/api/http.proto";
import "google/api/log.proto";
import "google/api/logging.proto";
import "google/api/metric.proto";
import "google/api/monitored_resource.proto";
import "google/api/monitoring.proto";
import "google/api/quota.proto";
import "google/api/source_info.proto";
import "google/api/system_parameter.proto";
import "google/api/usage.proto";
import "google/protobuf/api.proto";
import "google/protobuf/type.proto";
import "google/protobuf/wrappers.proto";
option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
option java_multiple_files = true;
option java_outer_classname = "ServiceProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// `Service` is the root object of Google API service configuration (service
// config). It describes the basic information about a logical service,
// such as the service name and the user-facing title, and delegates other
// aspects to sub-sections. Each sub-section is either a proto message or a
// repeated proto message that configures a specific aspect, such as auth.
// For more information, see each proto message definition.
//
// Example:
//
// type: google.api.Service
// name: calendar.googleapis.com
// title: Google Calendar API
// apis:
// - name: google.calendar.v3.Calendar
//
// visibility:
// rules:
// - selector: "google.calendar.v3.*"
// restriction: PREVIEW
// backend:
// rules:
// - selector: "google.calendar.v3.*"
// address: calendar.example.com
//
// authentication:
// providers:
// - id: google_calendar_auth
// jwks_uri: https://www.googleapis.com/oauth2/v1/certs
// issuer: https://securetoken.google.com
// rules:
// - selector: "*"
// requirements:
// provider_id: google_calendar_auth
message Service {
// The service name, which is a DNS-like logical identifier for the
// service, such as `calendar.googleapis.com`. The service name
// typically goes through DNS verification to make sure the owner
// of the service also owns the DNS name.
string name = 1;
// The product title for this service, it is the name displayed in Google
// Cloud Console.
string title = 2;
// The Google project that owns this service.
string producer_project_id = 22;
// A unique ID for a specific instance of this message, typically assigned
// by the client for tracking purpose. Must be no longer than 63 characters
// and only lower case letters, digits, '.', '_' and '-' are allowed. If
// empty, the server may choose to generate one instead.
string id = 33;
// A list of API interfaces exported by this service. Only the `name` field
// of the [google.protobuf.Api][google.protobuf.Api] needs to be provided by
// the configuration author, as the remaining fields will be derived from the
// IDL during the normalization process. It is an error to specify an API
// interface here which cannot be resolved against the associated IDL files.
repeated google.protobuf.Api apis = 3;
// A list of all proto message types included in this API service.
// Types referenced directly or indirectly by the `apis` are automatically
// included. Messages which are not referenced but shall be included, such as
// types used by the `google.protobuf.Any` type, should be listed here by
// name by the configuration author. Example:
//
// types:
// - name: google.protobuf.Int32
repeated google.protobuf.Type types = 4;
// A list of all enum types included in this API service. Enums referenced
// directly or indirectly by the `apis` are automatically included. Enums
// which are not referenced but shall be included should be listed here by
// name by the configuration author. Example:
//
// enums:
// - name: google.someapi.v1.SomeEnum
repeated google.protobuf.Enum enums = 5;
// Additional API documentation.
Documentation documentation = 6;
// API backend configuration.
Backend backend = 8;
// HTTP configuration.
Http http = 9;
// Quota configuration.
Quota quota = 10;
// Auth configuration.
Authentication authentication = 11;
// Context configuration.
Context context = 12;
// Configuration controlling usage of this service.
Usage usage = 15;
// Configuration for network endpoints. If this is empty, then an endpoint
// with the same name as the service is automatically generated to service all
// defined APIs.
repeated Endpoint endpoints = 18;
// Configuration for the service control plane.
Control control = 21;
// Defines the logs used by this service.
repeated LogDescriptor logs = 23;
// Defines the metrics used by this service.
repeated MetricDescriptor metrics = 24;
// Defines the monitored resources used by this service. This is required
// by the [Service.monitoring][google.api.Service.monitoring] and
// [Service.logging][google.api.Service.logging] configurations.
repeated MonitoredResourceDescriptor monitored_resources = 25;
// Billing configuration.
Billing billing = 26;
// Logging configuration.
Logging logging = 27;
// Monitoring configuration.
Monitoring monitoring = 28;
// System parameter configuration.
SystemParameters system_parameters = 29;
// Output only. The source information for this configuration if available.
SourceInfo source_info = 37;
// Settings for [Google Cloud Client
// libraries](https://cloud.google.com/apis/docs/cloud-client-libraries)
// generated from APIs defined as protocol buffers.
Publishing publishing = 45;
// Obsolete. Do not use.
//
// This field has no semantic meaning. The service config compiler always
// sets this field to `3`.
google.protobuf.UInt32Value config_version = 20;
}

View File

@@ -0,0 +1,124 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api.servicecontrol.v1;
import "google/rpc/status.proto";
option cc_enable_arenas = true;
option csharp_namespace = "Google.Cloud.ServiceControl.V1";
option go_package = "cloud.google.com/go/servicecontrol/apiv1/servicecontrolpb;servicecontrolpb";
option java_multiple_files = true;
option java_outer_classname = "CheckErrorProto";
option java_package = "com.google.api.servicecontrol.v1";
option php_namespace = "Google\\Cloud\\ServiceControl\\V1";
option ruby_package = "Google::Cloud::ServiceControl::V1";
// Defines the errors to be returned in
// [google.api.servicecontrol.v1.CheckResponse.check_errors][google.api.servicecontrol.v1.CheckResponse.check_errors].
message CheckError {
// Error codes for Check responses.
enum Code {
// This is never used in `CheckResponse`.
ERROR_CODE_UNSPECIFIED = 0;
// The consumer's project id, network container, or resource container was
// not found. Same as [google.rpc.Code.NOT_FOUND][google.rpc.Code.NOT_FOUND].
NOT_FOUND = 5;
// The consumer doesn't have access to the specified resource.
// Same as [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED].
PERMISSION_DENIED = 7;
// Quota check failed. Same as [google.rpc.Code.RESOURCE_EXHAUSTED][google.rpc.Code.RESOURCE_EXHAUSTED].
RESOURCE_EXHAUSTED = 8;
// The consumer hasn't activated the service.
SERVICE_NOT_ACTIVATED = 104;
// The consumer cannot access the service because billing is disabled.
BILLING_DISABLED = 107;
// The consumer's project has been marked as deleted (soft deletion).
PROJECT_DELETED = 108;
// The consumer's project number or id does not represent a valid project.
PROJECT_INVALID = 114;
// The input consumer info does not represent a valid consumer folder or
// organization.
CONSUMER_INVALID = 125;
// The IP address of the consumer is invalid for the specific consumer
// project.
IP_ADDRESS_BLOCKED = 109;
// The referer address of the consumer request is invalid for the specific
// consumer project.
REFERER_BLOCKED = 110;
// The client application of the consumer request is invalid for the
// specific consumer project.
CLIENT_APP_BLOCKED = 111;
// The API targeted by this request is invalid for the specified consumer
// project.
API_TARGET_BLOCKED = 122;
// The consumer's API key is invalid.
API_KEY_INVALID = 105;
// The consumer's API Key has expired.
API_KEY_EXPIRED = 112;
// The consumer's API Key was not found in config record.
API_KEY_NOT_FOUND = 113;
// The credential in the request can not be verified.
INVALID_CREDENTIAL = 123;
// The backend server for looking up project id/number is unavailable.
NAMESPACE_LOOKUP_UNAVAILABLE = 300;
// The backend server for checking service status is unavailable.
SERVICE_STATUS_UNAVAILABLE = 301;
// The backend server for checking billing status is unavailable.
BILLING_STATUS_UNAVAILABLE = 302;
// Cloud Resource Manager backend server is unavailable.
CLOUD_RESOURCE_MANAGER_BACKEND_UNAVAILABLE = 305;
}
// The error code.
Code code = 1;
// Subject to whom this error applies. See the specific code enum for more
// details on this field. For example:
//
// - "project:<project-id or project-number>"
// - "folder:<folder-id>"
// - "organization:<organization-id>"
string subject = 4;
// Free-form text providing details on the error cause of the error.
string detail = 2;
// Contains public information about the check error. If available,
// `status.code` will be non zero and client can propagate it out as public
// error.
google.rpc.Status status = 3;
}

View File

@@ -0,0 +1,166 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api.servicecontrol.v1;
import "google/api/distribution.proto";
option cc_enable_arenas = true;
option csharp_namespace = "Google.Cloud.ServiceControl.V1";
option go_package = "cloud.google.com/go/servicecontrol/apiv1/servicecontrolpb;servicecontrolpb";
option java_multiple_files = true;
option java_outer_classname = "DistributionProto";
option java_package = "com.google.api.servicecontrol.v1";
option php_namespace = "Google\\Cloud\\ServiceControl\\V1";
option ruby_package = "Google::Cloud::ServiceControl::V1";
// Distribution represents a frequency distribution of double-valued sample
// points. It contains the size of the population of sample points plus
// additional optional information:
//
// * the arithmetic mean of the samples
// * the minimum and maximum of the samples
// * the sum-squared-deviation of the samples, used to compute variance
// * a histogram of the values of the sample points
message Distribution {
// Describing buckets with constant width.
message LinearBuckets {
// The number of finite buckets. With the underflow and overflow buckets,
// the total number of buckets is `num_finite_buckets` + 2.
// See comments on `bucket_options` for details.
int32 num_finite_buckets = 1;
// The i'th linear bucket covers the interval
// [offset + (i-1) * width, offset + i * width)
// where i ranges from 1 to num_finite_buckets, inclusive.
// Must be strictly positive.
double width = 2;
// The i'th linear bucket covers the interval
// [offset + (i-1) * width, offset + i * width)
// where i ranges from 1 to num_finite_buckets, inclusive.
double offset = 3;
}
// Describing buckets with exponentially growing width.
message ExponentialBuckets {
// The number of finite buckets. With the underflow and overflow buckets,
// the total number of buckets is `num_finite_buckets` + 2.
// See comments on `bucket_options` for details.
int32 num_finite_buckets = 1;
// The i'th exponential bucket covers the interval
// [scale * growth_factor^(i-1), scale * growth_factor^i)
// where i ranges from 1 to num_finite_buckets inclusive.
// Must be larger than 1.0.
double growth_factor = 2;
// The i'th exponential bucket covers the interval
// [scale * growth_factor^(i-1), scale * growth_factor^i)
// where i ranges from 1 to num_finite_buckets inclusive.
// Must be > 0.
double scale = 3;
}
// Describing buckets with arbitrary user-provided width.
message ExplicitBuckets {
// 'bound' is a list of strictly increasing boundaries between
// buckets. Note that a list of length N-1 defines N buckets because
// of fenceposting. See comments on `bucket_options` for details.
//
// The i'th finite bucket covers the interval
// [bound[i-1], bound[i])
// where i ranges from 1 to bound_size() - 1. Note that there are no
// finite buckets at all if 'bound' only contains a single element; in
// that special case the single bound defines the boundary between the
// underflow and overflow buckets.
//
// bucket number lower bound upper bound
// i == 0 (underflow) -inf bound[i]
// 0 < i < bound_size() bound[i-1] bound[i]
// i == bound_size() (overflow) bound[i-1] +inf
repeated double bounds = 1;
}
// The total number of samples in the distribution. Must be >= 0.
int64 count = 1;
// The arithmetic mean of the samples in the distribution. If `count` is
// zero then this field must be zero.
double mean = 2;
// The minimum of the population of values. Ignored if `count` is zero.
double minimum = 3;
// The maximum of the population of values. Ignored if `count` is zero.
double maximum = 4;
// The sum of squared deviations from the mean:
// Sum[i=1..count]((x_i - mean)^2)
// where each x_i is a sample values. If `count` is zero then this field
// must be zero, otherwise validation of the request fails.
double sum_of_squared_deviation = 5;
// The number of samples in each histogram bucket. `bucket_counts` are
// optional. If present, they must sum to the `count` value.
//
// The buckets are defined below in `bucket_option`. There are N buckets.
// `bucket_counts[0]` is the number of samples in the underflow bucket.
// `bucket_counts[1]` to `bucket_counts[N-1]` are the numbers of samples
// in each of the finite buckets. And `bucket_counts[N] is the number
// of samples in the overflow bucket. See the comments of `bucket_option`
// below for more details.
//
// Any suffix of trailing zeros may be omitted.
repeated int64 bucket_counts = 6;
// Defines the buckets in the histogram. `bucket_option` and `bucket_counts`
// must be both set, or both unset.
//
// Buckets are numbered in the range of [0, N], with a total of N+1 buckets.
// There must be at least two buckets (a single-bucket histogram gives
// no information that isn't already provided by `count`).
//
// The first bucket is the underflow bucket which has a lower bound
// of -inf. The last bucket is the overflow bucket which has an
// upper bound of +inf. All other buckets (if any) are called "finite"
// buckets because they have finite lower and upper bounds. As described
// below, there are three ways to define the finite buckets.
//
// (1) Buckets with constant width.
// (2) Buckets with exponentially growing widths.
// (3) Buckets with arbitrary user-provided widths.
//
// In all cases, the buckets cover the entire real number line (-inf,
// +inf). Bucket upper bounds are exclusive and lower bounds are
// inclusive. The upper bound of the underflow bucket is equal to the
// lower bound of the smallest finite bucket; the lower bound of the
// overflow bucket is equal to the upper bound of the largest finite
// bucket.
oneof bucket_option {
// Buckets with constant width.
LinearBuckets linear_buckets = 7;
// Buckets with exponentially growing width.
ExponentialBuckets exponential_buckets = 8;
// Buckets with arbitrary user-provided width.
ExplicitBuckets explicit_buckets = 9;
}
// Example points. Must be in increasing order of `value` field.
repeated google.api.Distribution.Exemplar exemplars = 10;
}

View File

@@ -0,0 +1,93 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api.servicecontrol.v1;
import "google/protobuf/duration.proto";
option csharp_namespace = "Google.Cloud.ServiceControl.V1";
option go_package = "cloud.google.com/go/servicecontrol/apiv1/servicecontrolpb;servicecontrolpb";
option java_multiple_files = true;
option java_outer_classname = "HttpRequestProto";
option java_package = "com.google.api.servicecontrol.v1";
option php_namespace = "Google\\Cloud\\ServiceControl\\V1";
option ruby_package = "Google::Cloud::ServiceControl::V1";
// A common proto for logging HTTP requests. Only contains semantics
// defined by the HTTP specification. Product-specific logging
// information MUST be defined in a separate message.
message HttpRequest {
// The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`.
string request_method = 1;
// The scheme (http, https), the host name, the path, and the query
// portion of the URL that was requested.
// Example: `"http://example.com/some/info?color=red"`.
string request_url = 2;
// The size of the HTTP request message in bytes, including the request
// headers and the request body.
int64 request_size = 3;
// The response code indicating the status of the response.
// Examples: 200, 404.
int32 status = 4;
// The size of the HTTP response message sent back to the client, in bytes,
// including the response headers and the response body.
int64 response_size = 5;
// The user agent sent by the client. Example:
// `"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET
// CLR 1.0.3705)"`.
string user_agent = 6;
// The IP address (IPv4 or IPv6) of the client that issued the HTTP
// request. Examples: `"192.168.1.1"`, `"FE80::0202:B3FF:FE1E:8329"`.
string remote_ip = 7;
// The IP address (IPv4 or IPv6) of the origin server that the request was
// sent to.
string server_ip = 13;
// The referer URL of the request, as defined in
// [HTTP/1.1 Header Field
// Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).
string referer = 8;
// The request processing latency on the server, from the time the request was
// received until the response was sent.
google.protobuf.Duration latency = 14;
// Whether or not a cache lookup was attempted.
bool cache_lookup = 11;
// Whether or not an entity was served from cache
// (with or without validation).
bool cache_hit = 9;
// Whether or not the response was validated with the origin server before
// being served from cache. This field is only meaningful if `cache_hit` is
// True.
bool cache_validated_with_origin_server = 10;
// The number of HTTP response bytes inserted into cache. Set only when a
// cache fill was attempted.
int64 cache_fill_bytes = 12;
// Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket"
string protocol = 15;
}

View File

@@ -0,0 +1,126 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api.servicecontrol.v1;
import "google/api/servicecontrol/v1/http_request.proto";
import "google/logging/type/log_severity.proto";
import "google/protobuf/any.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";
option csharp_namespace = "Google.Cloud.ServiceControl.V1";
option go_package = "cloud.google.com/go/servicecontrol/apiv1/servicecontrolpb;servicecontrolpb";
option java_multiple_files = true;
option java_outer_classname = "LogEntryProto";
option java_package = "com.google.api.servicecontrol.v1";
option php_namespace = "Google\\Cloud\\ServiceControl\\V1";
option ruby_package = "Google::Cloud::ServiceControl::V1";
// An individual log entry.
message LogEntry {
// Required. The log to which this log entry belongs. Examples: `"syslog"`,
// `"book_log"`.
string name = 10;
// The time the event described by the log entry occurred. If
// omitted, defaults to operation start time.
google.protobuf.Timestamp timestamp = 11;
// The severity of the log entry. The default value is
// `LogSeverity.DEFAULT`.
google.logging.type.LogSeverity severity = 12;
// Optional. Information about the HTTP request associated with this
// log entry, if applicable.
HttpRequest http_request = 14;
// Optional. Resource name of the trace associated with the log entry, if any.
// If this field contains a relative resource name, you can assume the name is
// relative to `//tracing.googleapis.com`. Example:
// `projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824`
string trace = 15;
// A unique ID for the log entry used for deduplication. If omitted,
// the implementation will generate one based on operation_id.
string insert_id = 4;
// A set of user-defined (key, value) data that provides additional
// information about the log entry.
map<string, string> labels = 13;
// The log entry payload, which can be one of multiple types.
oneof payload {
// The log entry payload, represented as a protocol buffer that is
// expressed as a JSON object. The only accepted type currently is
// [AuditLog][google.cloud.audit.AuditLog].
google.protobuf.Any proto_payload = 2;
// The log entry payload, represented as a Unicode string (UTF-8).
string text_payload = 3;
// The log entry payload, represented as a structure that
// is expressed as a JSON object.
google.protobuf.Struct struct_payload = 6;
}
// Optional. Information about an operation associated with the log entry, if
// applicable.
LogEntryOperation operation = 16;
// Optional. Source code location information associated with the log entry,
// if any.
LogEntrySourceLocation source_location = 17;
}
// Additional information about a potentially long-running operation with which
// a log entry is associated.
message LogEntryOperation {
// Optional. An arbitrary operation identifier. Log entries with the
// same identifier are assumed to be part of the same operation.
string id = 1;
// Optional. An arbitrary producer identifier. The combination of
// `id` and `producer` must be globally unique. Examples for `producer`:
// `"MyDivision.MyBigCompany.com"`, `"github.com/MyProject/MyApplication"`.
string producer = 2;
// Optional. Set this to True if this is the first log entry in the operation.
bool first = 3;
// Optional. Set this to True if this is the last log entry in the operation.
bool last = 4;
}
// Additional information about the source code location that produced the log
// entry.
message LogEntrySourceLocation {
// Optional. Source file name. Depending on the runtime environment, this
// might be a simple name or a fully-qualified name.
string file = 1;
// Optional. Line within the source file. 1-based; 0 indicates no line number
// available.
int64 line = 2;
// Optional. Human-readable name of the function or method being invoked, with
// optional context such as the class or package name. This information may be
// used in contexts such as the logs viewer, where a file and line number are
// less meaningful. The format can vary by language. For example:
// `qual.if.ied.Class.method` (Java), `dir/package.func` (Go), `function`
// (Python).
string function = 3;
}

View File

@@ -0,0 +1,81 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api.servicecontrol.v1;
import "google/api/servicecontrol/v1/distribution.proto";
import "google/protobuf/timestamp.proto";
option cc_enable_arenas = true;
option csharp_namespace = "Google.Cloud.ServiceControl.V1";
option go_package = "cloud.google.com/go/servicecontrol/apiv1/servicecontrolpb;servicecontrolpb";
option java_multiple_files = true;
option java_outer_classname = "MetricValueSetProto";
option java_package = "com.google.api.servicecontrol.v1";
option php_namespace = "Google\\Cloud\\ServiceControl\\V1";
option ruby_package = "Google::Cloud::ServiceControl::V1";
// Represents a single metric value.
message MetricValue {
// The labels describing the metric value.
// See comments on [google.api.servicecontrol.v1.Operation.labels][google.api.servicecontrol.v1.Operation.labels] for
// the overriding relationship.
// Note that this map must not contain monitored resource labels.
map<string, string> labels = 1;
// The start of the time period over which this metric value's measurement
// applies. The time period has different semantics for different metric
// types (cumulative, delta, and gauge). See the metric definition
// documentation in the service configuration for details. If not specified,
// [google.api.servicecontrol.v1.Operation.start_time][google.api.servicecontrol.v1.Operation.start_time] will be used.
google.protobuf.Timestamp start_time = 2;
// The end of the time period over which this metric value's measurement
// applies. If not specified,
// [google.api.servicecontrol.v1.Operation.end_time][google.api.servicecontrol.v1.Operation.end_time] will be used.
google.protobuf.Timestamp end_time = 3;
// The value. The type of value used in the request must
// agree with the metric definition in the service configuration, otherwise
// the MetricValue is rejected.
oneof value {
// A boolean value.
bool bool_value = 4;
// A signed 64-bit integer value.
int64 int64_value = 5;
// A double precision floating point value.
double double_value = 6;
// A text string value.
string string_value = 7;
// A distribution value.
Distribution distribution_value = 8;
}
}
// Represents a set of metric values in the same metric.
// Each metric value in the set should have a unique combination of start time,
// end time, and label values.
message MetricValueSet {
// The metric name defined in the service configuration.
string metric_name = 1;
// The values in this metric.
repeated MetricValue metric_values = 2;
}

View File

@@ -0,0 +1,123 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api.servicecontrol.v1;
import "google/api/servicecontrol/v1/log_entry.proto";
import "google/api/servicecontrol/v1/metric_value.proto";
import "google/protobuf/any.proto";
import "google/protobuf/timestamp.proto";
option cc_enable_arenas = true;
option csharp_namespace = "Google.Cloud.ServiceControl.V1";
option go_package = "cloud.google.com/go/servicecontrol/apiv1/servicecontrolpb;servicecontrolpb";
option java_multiple_files = true;
option java_outer_classname = "OperationProto";
option java_package = "com.google.api.servicecontrol.v1";
option php_namespace = "Google\\Cloud\\ServiceControl\\V1";
option ruby_package = "Google::Cloud::ServiceControl::V1";
// Represents information regarding an operation.
message Operation {
// Defines the importance of the data contained in the operation.
enum Importance {
// Allows data caching, batching, and aggregation. It provides
// higher performance with higher data loss risk.
LOW = 0;
// Disables data aggregation to minimize data loss. It is for operations
// that contains significant monetary value or audit trail. This feature
// only applies to the client libraries.
HIGH = 1;
}
// Identity of the operation. This must be unique within the scope of the
// service that generated the operation. If the service calls
// Check() and Report() on the same operation, the two calls should carry
// the same id.
//
// UUID version 4 is recommended, though not required.
// In scenarios where an operation is computed from existing information
// and an idempotent id is desirable for deduplication purpose, UUID version 5
// is recommended. See RFC 4122 for details.
string operation_id = 1;
// Fully qualified name of the operation. Reserved for future use.
string operation_name = 2;
// Identity of the consumer who is using the service.
// This field should be filled in for the operations initiated by a
// consumer, but not for service-initiated operations that are
// not related to a specific consumer.
//
// - This can be in one of the following formats:
// - project:PROJECT_ID,
// - project`_`number:PROJECT_NUMBER,
// - projects/PROJECT_ID or PROJECT_NUMBER,
// - folders/FOLDER_NUMBER,
// - organizations/ORGANIZATION_NUMBER,
// - api`_`key:API_KEY.
string consumer_id = 3;
// Required. Start time of the operation.
google.protobuf.Timestamp start_time = 4;
// End time of the operation.
// Required when the operation is used in
// [ServiceController.Report][google.api.servicecontrol.v1.ServiceController.Report],
// but optional when the operation is used in
// [ServiceController.Check][google.api.servicecontrol.v1.ServiceController.Check].
google.protobuf.Timestamp end_time = 5;
// Labels describing the operation. Only the following labels are allowed:
//
// - Labels describing monitored resources as defined in
// the service configuration.
// - Default labels of metric values. When specified, labels defined in the
// metric value override these default.
// - The following labels defined by Google Cloud Platform:
// - `cloud.googleapis.com/location` describing the location where the
// operation happened,
// - `servicecontrol.googleapis.com/user_agent` describing the user agent
// of the API request,
// - `servicecontrol.googleapis.com/service_agent` describing the service
// used to handle the API request (e.g. ESP),
// - `servicecontrol.googleapis.com/platform` describing the platform
// where the API is served, such as App Engine, Compute Engine, or
// Kubernetes Engine.
map<string, string> labels = 6;
// Represents information about this operation. Each MetricValueSet
// corresponds to a metric defined in the service configuration.
// The data type used in the MetricValueSet must agree with
// the data type specified in the metric definition.
//
// Within a single operation, it is not allowed to have more than one
// MetricValue instances that have the same metric names and identical
// label value combinations. If a request has such duplicated MetricValue
// instances, the entire request is rejected with
// an invalid argument error.
repeated MetricValueSet metric_value_sets = 7;
// Represents information to be logged.
repeated LogEntry log_entries = 8;
// DO NOT USE. This is an experimental field.
Importance importance = 11;
// Unimplemented.
repeated google.protobuf.Any extensions = 16;
}

View File

@@ -0,0 +1,245 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api.servicecontrol.v1;
import "google/api/annotations.proto";
import "google/api/servicecontrol/v1/metric_value.proto";
import "google/rpc/status.proto";
import "google/api/client.proto";
option cc_enable_arenas = true;
option csharp_namespace = "Google.Cloud.ServiceControl.V1";
option go_package = "cloud.google.com/go/servicecontrol/apiv1/servicecontrolpb;servicecontrolpb";
option java_multiple_files = true;
option java_outer_classname = "QuotaControllerProto";
option java_package = "com.google.api.servicecontrol.v1";
option php_namespace = "Google\\Cloud\\ServiceControl\\V1";
option ruby_package = "Google::Cloud::ServiceControl::V1";
// [Google Quota Control API](/service-control/overview)
//
// Allows clients to allocate and release quota against a [managed
// service](https://cloud.google.com/service-management/reference/rpc/google.api/servicemanagement.v1#google.api.servicemanagement.v1.ManagedService).
service QuotaController {
option (google.api.default_host) = "servicecontrol.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform,"
"https://www.googleapis.com/auth/servicecontrol";
// Attempts to allocate quota for the specified consumer. It should be called
// before the operation is executed.
//
// This method requires the `servicemanagement.services.quota`
// permission on the specified service. For more information, see
// [Cloud IAM](https://cloud.google.com/iam).
//
// **NOTE:** The client **must** fail-open on server errors `INTERNAL`,
// `UNKNOWN`, `DEADLINE_EXCEEDED`, and `UNAVAILABLE`. To ensure system
// reliability, the server may inject these errors to prohibit any hard
// dependency on the quota functionality.
rpc AllocateQuota(AllocateQuotaRequest) returns (AllocateQuotaResponse) {
option (google.api.http) = {
post: "/v1/services/{service_name}:allocateQuota"
body: "*"
};
}
}
// Request message for the AllocateQuota method.
message AllocateQuotaRequest {
// Name of the service as specified in the service configuration. For example,
// `"pubsub.googleapis.com"`.
//
// See [google.api.Service][google.api.Service] for the definition of a service name.
string service_name = 1;
// Operation that describes the quota allocation.
QuotaOperation allocate_operation = 2;
// Specifies which version of service configuration should be used to process
// the request. If unspecified or no matching version can be found, the latest
// one will be used.
string service_config_id = 4;
}
// Represents information regarding a quota operation.
message QuotaOperation {
// Supported quota modes.
enum QuotaMode {
// Guard against implicit default. Must not be used.
UNSPECIFIED = 0;
// For AllocateQuota request, allocates quota for the amount specified in
// the service configuration or specified using the quota metrics. If the
// amount is higher than the available quota, allocation error will be
// returned and no quota will be allocated.
// If multiple quotas are part of the request, and one fails, none of the
// quotas are allocated or released.
NORMAL = 1;
// The operation allocates quota for the amount specified in the service
// configuration or specified using the quota metrics. If the amount is
// higher than the available quota, request does not fail but all available
// quota will be allocated.
// For rate quota, BEST_EFFORT will continue to deduct from other groups
// even if one does not have enough quota. For allocation, it will find the
// minimum available amount across all groups and deduct that amount from
// all the affected groups.
BEST_EFFORT = 2;
// For AllocateQuota request, only checks if there is enough quota
// available and does not change the available quota. No lock is placed on
// the available quota either.
CHECK_ONLY = 3;
// Unimplemented. When used in AllocateQuotaRequest, this returns the
// effective quota limit(s) in the response, and no quota check will be
// performed. Not supported for other requests, and even for
// AllocateQuotaRequest, this is currently supported only for allowlisted
// services.
QUERY_ONLY = 4;
// The operation allocates quota for the amount specified in the service
// configuration or specified using the quota metrics. If the requested
// amount is higher than the available quota, request does not fail and
// remaining quota would become negative (going over the limit).
// Not supported for Rate Quota.
ADJUST_ONLY = 5;
}
// Identity of the operation. This is expected to be unique within the scope
// of the service that generated the operation, and guarantees idempotency in
// case of retries.
//
// In order to ensure best performance and latency in the Quota backends,
// operation_ids are optimally associated with time, so that related
// operations can be accessed fast in storage. For this reason, the
// recommended token for services that intend to operate at a high QPS is
// Unix time in nanos + UUID
string operation_id = 1;
// Fully qualified name of the API method for which this quota operation is
// requested. This name is used for matching quota rules or metric rules and
// billing status rules defined in service configuration.
//
// This field should not be set if any of the following is true:
// (1) the quota operation is performed on non-API resources.
// (2) quota_metrics is set because the caller is doing quota override.
//
//
// Example of an RPC method name:
// google.example.library.v1.LibraryService.CreateShelf
string method_name = 2;
// Identity of the consumer for whom this quota operation is being performed.
//
// This can be in one of the following formats:
// project:<project_id>,
// project_number:<project_number>,
// api_key:<api_key>.
string consumer_id = 3;
// Labels describing the operation.
map<string, string> labels = 4;
// Represents information about this operation. Each MetricValueSet
// corresponds to a metric defined in the service configuration.
// The data type used in the MetricValueSet must agree with
// the data type specified in the metric definition.
//
// Within a single operation, it is not allowed to have more than one
// MetricValue instances that have the same metric names and identical
// label value combinations. If a request has such duplicated MetricValue
// instances, the entire request is rejected with
// an invalid argument error.
//
// This field is mutually exclusive with method_name.
repeated MetricValueSet quota_metrics = 5;
// Quota mode for this operation.
QuotaMode quota_mode = 6;
}
// Response message for the AllocateQuota method.
message AllocateQuotaResponse {
// The same operation_id value used in the AllocateQuotaRequest. Used for
// logging and diagnostics purposes.
string operation_id = 1;
// Indicates the decision of the allocate.
repeated QuotaError allocate_errors = 2;
// Quota metrics to indicate the result of allocation. Depending on the
// request, one or more of the following metrics will be included:
//
// 1. Per quota group or per quota metric incremental usage will be specified
// using the following delta metric :
// "serviceruntime.googleapis.com/api/consumer/quota_used_count"
//
// 2. The quota limit reached condition will be specified using the following
// boolean metric :
// "serviceruntime.googleapis.com/quota/exceeded"
repeated MetricValueSet quota_metrics = 3;
// ID of the actual config used to process the request.
string service_config_id = 4;
}
// Represents error information for [QuotaOperation][google.api.servicecontrol.v1.QuotaOperation].
message QuotaError {
// Error codes related to project config validations are deprecated since the
// quota controller methods do not perform these validations. Instead services
// have to call the Check method, without quota_properties field, to perform
// these validations before calling the quota controller methods. These
// methods check only for project deletion to be wipe out compliant.
enum Code {
// This is never used.
UNSPECIFIED = 0;
// Quota allocation failed.
// Same as [google.rpc.Code.RESOURCE_EXHAUSTED][google.rpc.Code.RESOURCE_EXHAUSTED].
RESOURCE_EXHAUSTED = 8;
// Consumer cannot access the service because the service requires active
// billing.
BILLING_NOT_ACTIVE = 107;
// Consumer's project has been marked as deleted (soft deletion).
PROJECT_DELETED = 108;
// Specified API key is invalid.
API_KEY_INVALID = 105;
// Specified API Key has expired.
API_KEY_EXPIRED = 112;
}
// Error code.
Code code = 1;
// Subject to whom this error applies. See the specific enum for more details
// on this field. For example, "clientip:<ip address of client>" or
// "project:<Google developer project id>".
string subject = 2;
// Free-form text that provides details on the cause of the error.
string description = 3;
// Contains additional information about the quota error.
// If available, `status.code` will be non zero.
google.rpc.Status status = 4;
}

View File

@@ -0,0 +1,260 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api.servicecontrol.v1;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/servicecontrol/v1/check_error.proto";
import "google/api/servicecontrol/v1/operation.proto";
import "google/rpc/status.proto";
option cc_enable_arenas = true;
option csharp_namespace = "Google.Cloud.ServiceControl.V1";
option go_package = "cloud.google.com/go/servicecontrol/apiv1/servicecontrolpb;servicecontrolpb";
option java_multiple_files = true;
option java_outer_classname = "ServiceControllerProto";
option java_package = "com.google.api.servicecontrol.v1";
option objc_class_prefix = "GASC";
option php_namespace = "Google\\Cloud\\ServiceControl\\V1";
option ruby_package = "Google::Cloud::ServiceControl::V1";
// [Google Service Control API](/service-control/overview)
//
// Lets clients check and report operations against a [managed
// service](https://cloud.google.com/service-management/reference/rpc/google.api/servicemanagement.v1#google.api.servicemanagement.v1.ManagedService).
service ServiceController {
option (google.api.default_host) = "servicecontrol.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform,"
"https://www.googleapis.com/auth/servicecontrol";
// Checks whether an operation on a service should be allowed to proceed
// based on the configuration of the service and related policies. It must be
// called before the operation is executed.
//
// If feasible, the client should cache the check results and reuse them for
// 60 seconds. In case of any server errors, the client should rely on the
// cached results for much longer time to avoid outage.
// WARNING: There is general 60s delay for the configuration and policy
// propagation, therefore callers MUST NOT depend on the `Check` method having
// the latest policy information.
//
// NOTE: the [CheckRequest][google.api.servicecontrol.v1.CheckRequest] has
// the size limit (wire-format byte size) of 1MB.
//
// This method requires the `servicemanagement.services.check` permission
// on the specified service. For more information, see
// [Cloud IAM](https://cloud.google.com/iam).
rpc Check(CheckRequest) returns (CheckResponse) {
option (google.api.http) = {
post: "/v1/services/{service_name}:check"
body: "*"
};
}
// Reports operation results to Google Service Control, such as logs and
// metrics. It should be called after an operation is completed.
//
// If feasible, the client should aggregate reporting data for up to 5
// seconds to reduce API traffic. Limiting aggregation to 5 seconds is to
// reduce data loss during client crashes. Clients should carefully choose
// the aggregation time window to avoid data loss risk more than 0.01%
// for business and compliance reasons.
//
// NOTE: the [ReportRequest][google.api.servicecontrol.v1.ReportRequest] has
// the size limit (wire-format byte size) of 1MB.
//
// This method requires the `servicemanagement.services.report` permission
// on the specified service. For more information, see
// [Google Cloud IAM](https://cloud.google.com/iam).
rpc Report(ReportRequest) returns (ReportResponse) {
option (google.api.http) = {
post: "/v1/services/{service_name}:report"
body: "*"
};
}
}
// Request message for the Check method.
message CheckRequest {
// The service name as specified in its service configuration. For example,
// `"pubsub.googleapis.com"`.
//
// See
// [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
// for the definition of a service name.
string service_name = 1;
// The operation to be checked.
Operation operation = 2;
// Specifies which version of service configuration should be used to process
// the request.
//
// If unspecified or no matching version can be found, the
// latest one will be used.
string service_config_id = 4;
}
// Response message for the Check method.
message CheckResponse {
// Contains additional information about the check operation.
message CheckInfo {
// A list of fields and label keys that are ignored by the server.
// The client doesn't need to send them for following requests to improve
// performance and allow better aggregation.
repeated string unused_arguments = 1;
// Consumer info of this check.
ConsumerInfo consumer_info = 2;
// The unique id of the api key in the format of "apikey:<UID>".
// This field will be populated when the consumer passed to Service Control
// is an API key and all the API key related validations are successful.
string api_key_uid = 5;
}
// `ConsumerInfo` provides information about the consumer.
message ConsumerInfo {
// The type of the consumer as defined in
// [Google Resource Manager](https://cloud.google.com/resource-manager/).
enum ConsumerType {
// This is never used.
CONSUMER_TYPE_UNSPECIFIED = 0;
// The consumer is a Google Cloud Project.
PROJECT = 1;
// The consumer is a Google Cloud Folder.
FOLDER = 2;
// The consumer is a Google Cloud Organization.
ORGANIZATION = 3;
// Service-specific resource container which is defined by the service
// producer to offer their users the ability to manage service control
// functionalities at a finer level of granularity than the PROJECT.
SERVICE_SPECIFIC = 4;
}
// The Google cloud project number, e.g. 1234567890. A value of 0 indicates
// no project number is found.
//
// NOTE: This field is deprecated after we support flexible consumer
// id. New code should not depend on this field anymore.
int64 project_number = 1;
// The type of the consumer which should have been defined in
// [Google Resource Manager](https://cloud.google.com/resource-manager/).
ConsumerType type = 2;
// The consumer identity number, can be Google cloud project number, folder
// number or organization number e.g. 1234567890. A value of 0 indicates no
// consumer number is found.
int64 consumer_number = 3;
}
// The same operation_id value used in the
// [CheckRequest][google.api.servicecontrol.v1.CheckRequest]. Used for logging
// and diagnostics purposes.
string operation_id = 1;
// Indicate the decision of the check.
//
// If no check errors are present, the service should process the operation.
// Otherwise the service should use the list of errors to determine the
// appropriate action.
repeated CheckError check_errors = 2;
// The actual config id used to process the request.
string service_config_id = 5;
// The current service rollout id used to process the request.
string service_rollout_id = 11;
// Feedback data returned from the server during processing a Check request.
CheckInfo check_info = 6;
}
// Request message for the Report method.
message ReportRequest {
// The service name as specified in its service configuration. For example,
// `"pubsub.googleapis.com"`.
//
// See
// [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
// for the definition of a service name.
string service_name = 1;
// Operations to be reported.
//
// Typically the service should report one operation per request.
// Putting multiple operations into a single request is allowed, but should
// be used only when multiple operations are natually available at the time
// of the report.
//
// There is no limit on the number of operations in the same ReportRequest,
// however the ReportRequest size should be no larger than 1MB. See
// [ReportResponse.report_errors][google.api.servicecontrol.v1.ReportResponse.report_errors]
// for partial failure behavior.
repeated Operation operations = 2;
// Specifies which version of service config should be used to process the
// request.
//
// If unspecified or no matching version can be found, the
// latest one will be used.
string service_config_id = 3;
}
// Response message for the Report method.
message ReportResponse {
// Represents the processing error of one
// [Operation][google.api.servicecontrol.v1.Operation] in the request.
message ReportError {
// The
// [Operation.operation_id][google.api.servicecontrol.v1.Operation.operation_id]
// value from the request.
string operation_id = 1;
// Details of the error when processing the
// [Operation][google.api.servicecontrol.v1.Operation].
google.rpc.Status status = 2;
}
// Partial failures, one for each `Operation` in the request that failed
// processing. There are three possible combinations of the RPC status:
//
// 1. The combination of a successful RPC status and an empty `report_errors`
// list indicates a complete success where all `Operations` in the
// request are processed successfully.
// 2. The combination of a successful RPC status and a non-empty
// `report_errors` list indicates a partial success where some
// `Operations` in the request succeeded. Each
// `Operation` that failed processing has a corresponding item
// in this list.
// 3. A failed RPC status indicates a general non-deterministic failure.
// When this happens, it's impossible to know which of the
// 'Operations' in the request succeeded or failed.
repeated ReportError report_errors = 1;
// The actual config id used to process the request.
string service_config_id = 2;
// The current service rollout id used to process the request.
string service_rollout_id = 4;
}

View File

@@ -0,0 +1,196 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api.servicecontrol.v2;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/rpc/context/attribute_context.proto";
import "google/rpc/status.proto";
option cc_enable_arenas = true;
option csharp_namespace = "Google.Cloud.ServiceControl.V2";
option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v2;servicecontrol";
option java_multiple_files = true;
option java_outer_classname = "ServiceControllerProto";
option java_package = "com.google.api.servicecontrol.v2";
option objc_class_prefix = "GASC";
option php_namespace = "Google\\Cloud\\ServiceControl\\V2";
option ruby_package = "Google::Cloud::ServiceControl::V2";
// [Service Control API
// v2](https://cloud.google.com/service-infrastructure/docs/service-control/access-control)
//
// Private Preview. This feature is only available for approved services.
//
// This API provides admission control and telemetry reporting for services
// that are integrated with [Service
// Infrastructure](https://cloud.google.com/service-infrastructure).
service ServiceController {
option (google.api.default_host) = "servicecontrol.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform,"
"https://www.googleapis.com/auth/servicecontrol";
// Private Preview. This feature is only available for approved services.
//
// This method provides admission control for services that are integrated
// with [Service
// Infrastructure](https://cloud.google.com/service-infrastructure). It checks
// whether an operation should be allowed based on the service configuration
// and relevant policies. It must be called before the operation is executed.
// For more information, see
// [Admission
// Control](https://cloud.google.com/service-infrastructure/docs/admission-control).
//
// NOTE: The admission control has an expected policy propagation delay of
// 60s. The caller **must** not depend on the most recent policy changes.
//
// NOTE: The admission control has a hard limit of 1 referenced resources
// per call. If an operation refers to more than 1 resources, the caller
// must call the Check method multiple times.
//
// This method requires the `servicemanagement.services.check` permission
// on the specified service. For more information, see
// [Service Control API Access
// Control](https://cloud.google.com/service-infrastructure/docs/service-control/access-control).
rpc Check(CheckRequest) returns (CheckResponse) {
option (google.api.http) = {
post: "/v2/services/{service_name}:check"
body: "*"
};
}
// Private Preview. This feature is only available for approved services.
//
// This method provides telemetry reporting for services that are integrated
// with [Service
// Infrastructure](https://cloud.google.com/service-infrastructure). It
// reports a list of operations that have occurred on a service. It must be
// called after the operations have been executed. For more information, see
// [Telemetry
// Reporting](https://cloud.google.com/service-infrastructure/docs/telemetry-reporting).
//
// NOTE: The telemetry reporting has a hard limit of 1000 operations and 1MB
// per Report call. It is recommended to have no more than 100 operations per
// call.
//
// This method requires the `servicemanagement.services.report` permission
// on the specified service. For more information, see
// [Service Control API Access
// Control](https://cloud.google.com/service-infrastructure/docs/service-control/access-control).
rpc Report(ReportRequest) returns (ReportResponse) {
option (google.api.http) = {
post: "/v2/services/{service_name}:report"
body: "*"
};
}
}
// Request message for the Check method.
message CheckRequest {
// The service name as specified in its service configuration. For example,
// `"pubsub.googleapis.com"`.
//
// See
// [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
// for the definition of a service name.
string service_name = 1;
// Specifies the version of the service configuration that should be used to
// process the request. Must not be empty. Set this field to 'latest' to
// specify using the latest configuration.
string service_config_id = 2;
// Describes attributes about the operation being executed by the service.
google.rpc.context.AttributeContext attributes = 3;
// Describes the resources and the policies applied to each resource.
repeated ResourceInfo resources = 4;
// Optional. Contains a comma-separated list of flags.
string flags = 5;
}
// Describes a resource referenced in the request.
message ResourceInfo {
// The name of the resource referenced in the request.
string name = 1;
// The resource type in the format of "{service}/{kind}".
string type = 2;
// The resource permission needed for this request.
// The format must be "{service}/{plural}.{verb}".
string permission = 3;
// Optional. The identifier of the container of this resource. For Google
// Cloud APIs, the resource container must be one of the following formats:
// - `projects/<project-id or project-number>`
// - `folders/<folder-id>`
// - `organizations/<organization-id>`
// For the policy enforcement on the container level (VPCSC and Location
// Policy check), this field takes precedence on the container extracted from
// name when presents.
string container = 4;
// Optional. The location of the resource. The value must be a valid zone,
// region or multiregion. For example: "europe-west4" or
// "northamerica-northeast1-a"
string location = 5;
}
// Response message for the Check method.
message CheckResponse {
// Operation is allowed when this field is not set. Any non-'OK' status
// indicates a denial; [google.rpc.Status.details][google.rpc.Status.details]
// would contain additional details about the denial.
google.rpc.Status status = 1;
// Returns a set of request contexts generated from the `CheckRequest`.
map<string, string> headers = 2;
}
// Request message for the Report method.
message ReportRequest {
// The service name as specified in its service configuration. For example,
// `"pubsub.googleapis.com"`.
//
// See
// [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
// for the definition of a service name.
string service_name = 1;
// Specifies the version of the service configuration that should be used to
// process the request. Must not be empty. Set this field to 'latest' to
// specify using the latest configuration.
string service_config_id = 2;
// Describes the list of operations to be reported. Each operation is
// represented as an AttributeContext, and contains all attributes around an
// API access.
repeated google.rpc.context.AttributeContext operations = 3;
}
// Response message for the Report method.
// If the request contains any invalid data, the server returns an RPC error.
message ReportResponse {}
// Message containing resource details in a batch mode.
message ResourceInfoList {
// The resource details.
repeated ResourceInfo resources = 1;
}

View File

@@ -0,0 +1,295 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api.servicemanagement.v1;
import "google/api/config_change.proto";
import "google/api/field_behavior.proto";
import "google/protobuf/timestamp.proto";
option csharp_namespace = "Google.Cloud.ServiceManagement.V1";
option go_package = "cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb;servicemanagementpb";
option java_multiple_files = true;
option java_outer_classname = "ResourcesProto";
option java_package = "com.google.api.servicemanagement.v1";
option objc_class_prefix = "GASM";
option php_namespace = "Google\\Cloud\\ServiceManagement\\V1";
option ruby_package = "Google::Cloud::ServiceManagement::V1";
// The full representation of a Service that is managed by
// Google Service Management.
message ManagedService {
// The name of the service. See the
// [overview](https://cloud.google.com/service-infrastructure/docs/overview)
// for naming requirements.
string service_name = 2;
// ID of the project that produces and owns this service.
string producer_project_id = 3;
}
// The metadata associated with a long running operation resource.
message OperationMetadata {
// Represents the status of one operation step.
message Step {
// The short description of the step.
string description = 2;
// The status code.
Status status = 4;
}
// Code describes the status of the operation (or one of its steps).
enum Status {
// Unspecifed code.
STATUS_UNSPECIFIED = 0;
// The operation or step has completed without errors.
DONE = 1;
// The operation or step has not started yet.
NOT_STARTED = 2;
// The operation or step is in progress.
IN_PROGRESS = 3;
// The operation or step has completed with errors. If the operation is
// rollbackable, the rollback completed with errors too.
FAILED = 4;
// The operation or step has completed with cancellation.
CANCELLED = 5;
}
// The full name of the resources that this operation is directly
// associated with.
repeated string resource_names = 1;
// Detailed status information for each step. The order is undetermined.
repeated Step steps = 2;
// Percentage of completion of this operation, ranging from 0 to 100.
int32 progress_percentage = 3;
// The start time of the operation.
google.protobuf.Timestamp start_time = 4;
}
// Represents a diagnostic message (error or warning)
message Diagnostic {
// The kind of diagnostic information possible.
enum Kind {
// Warnings and errors
WARNING = 0;
// Only errors
ERROR = 1;
}
// File name and line number of the error or warning.
string location = 1;
// The kind of diagnostic information provided.
Kind kind = 2;
// Message describing the error or warning.
string message = 3;
}
// Represents a source file which is used to generate the service configuration
// defined by `google.api.Service`.
message ConfigSource {
// A unique ID for a specific instance of this message, typically assigned
// by the client for tracking purpose. If empty, the server may choose to
// generate one instead.
string id = 5;
// Set of source configuration files that are used to generate a service
// configuration (`google.api.Service`).
repeated ConfigFile files = 2;
}
// Generic specification of a source configuration file
message ConfigFile {
enum FileType {
// Unknown file type.
FILE_TYPE_UNSPECIFIED = 0;
// YAML-specification of service.
SERVICE_CONFIG_YAML = 1;
// OpenAPI specification, serialized in JSON.
OPEN_API_JSON = 2;
// OpenAPI specification, serialized in YAML.
OPEN_API_YAML = 3;
// FileDescriptorSet, generated by protoc.
//
// To generate, use protoc with imports and source info included.
// For an example test.proto file, the following command would put the value
// in a new file named out.pb.
//
// $protoc --include_imports --include_source_info test.proto -o out.pb
FILE_DESCRIPTOR_SET_PROTO = 4;
// Uncompiled Proto file. Used for storage and display purposes only,
// currently server-side compilation is not supported. Should match the
// inputs to 'protoc' command used to generated FILE_DESCRIPTOR_SET_PROTO. A
// file of this type can only be included if at least one file of type
// FILE_DESCRIPTOR_SET_PROTO is included.
PROTO_FILE = 6;
}
// The file name of the configuration file (full or relative path).
string file_path = 1;
// The bytes that constitute the file.
bytes file_contents = 3;
// The type of configuration file this represents.
FileType file_type = 4;
}
// Represents a service configuration with its name and id.
message ConfigRef {
// Resource name of a service config. It must have the following
// format: "services/{service name}/configs/{config id}".
string name = 1;
}
// Change report associated with a particular service configuration.
//
// It contains a list of ConfigChanges based on the comparison between
// two service configurations.
message ChangeReport {
// List of changes between two service configurations.
// The changes will be alphabetically sorted based on the identifier
// of each change.
// A ConfigChange identifier is a dot separated path to the configuration.
// Example: visibility.rules[selector='LibraryService.CreateBook'].restriction
repeated google.api.ConfigChange config_changes = 1;
}
// A rollout resource that defines how service configuration versions are pushed
// to control plane systems. Typically, you create a new version of the
// service config, and then create a Rollout to push the service config.
message Rollout {
// Strategy that specifies how clients of Google Service Controller want to
// send traffic to use different config versions. This is generally
// used by API proxy to split traffic based on your configured percentage for
// each config version.
//
// One example of how to gradually rollout a new service configuration using
// this
// strategy:
// Day 1
//
// Rollout {
// id: "example.googleapis.com/rollout_20160206"
// traffic_percent_strategy {
// percentages: {
// "example.googleapis.com/20160201": 70.00
// "example.googleapis.com/20160206": 30.00
// }
// }
// }
//
// Day 2
//
// Rollout {
// id: "example.googleapis.com/rollout_20160207"
// traffic_percent_strategy: {
// percentages: {
// "example.googleapis.com/20160206": 100.00
// }
// }
// }
message TrafficPercentStrategy {
// Maps service configuration IDs to their corresponding traffic percentage.
// Key is the service configuration ID, Value is the traffic percentage
// which must be greater than 0.0 and the sum must equal to 100.0.
map<string, double> percentages = 1;
}
// Strategy used to delete a service. This strategy is a placeholder only
// used by the system generated rollout to delete a service.
message DeleteServiceStrategy {}
// Status of a Rollout.
enum RolloutStatus {
// No status specified.
ROLLOUT_STATUS_UNSPECIFIED = 0;
// The Rollout is in progress.
IN_PROGRESS = 1;
// The Rollout has completed successfully.
SUCCESS = 2;
// The Rollout has been cancelled. This can happen if you have overlapping
// Rollout pushes, and the previous ones will be cancelled.
CANCELLED = 3;
// The Rollout has failed and the rollback attempt has failed too.
FAILED = 4;
// The Rollout has not started yet and is pending for execution.
PENDING = 5;
// The Rollout has failed and rolled back to the previous successful
// Rollout.
FAILED_ROLLED_BACK = 6;
}
// Optional. Unique identifier of this Rollout. Must be no longer than 63
// characters and only lower case letters, digits, '.', '_' and '-' are
// allowed.
//
// If not specified by client, the server will generate one. The generated id
// will have the form of <date><revision number>, where "date" is the create
// date in ISO 8601 format. "revision number" is a monotonically increasing
// positive number that is reset every day for each service.
// An example of the generated rollout_id is '2016-02-16r1'
string rollout_id = 1 [(google.api.field_behavior) = OPTIONAL];
// Creation time of the rollout. Readonly.
google.protobuf.Timestamp create_time = 2;
// The user who created the Rollout. Readonly.
string created_by = 3;
// The status of this rollout. Readonly. In case of a failed rollout,
// the system will automatically rollback to the current Rollout
// version. Readonly.
RolloutStatus status = 4;
// Strategy that defines which versions of service configurations should be
// pushed
// and how they should be used at runtime.
oneof strategy {
// Google Service Control selects service configurations based on
// traffic percentage.
TrafficPercentStrategy traffic_percent_strategy = 5;
// The strategy associated with a rollout to delete a `ManagedService`.
// Readonly.
DeleteServiceStrategy delete_service_strategy = 200;
}
// The name of the service associated with this Rollout.
string service_name = 8;
}

View File

@@ -0,0 +1,508 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api.servicemanagement.v1;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/service.proto";
import "google/api/servicemanagement/v1/resources.proto";
import "google/longrunning/operations.proto";
import "google/protobuf/any.proto";
import "google/protobuf/empty.proto";
option csharp_namespace = "Google.Cloud.ServiceManagement.V1";
option go_package = "cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb;servicemanagementpb";
option java_multiple_files = true;
option java_outer_classname = "ServiceManagerProto";
option java_package = "com.google.api.servicemanagement.v1";
option objc_class_prefix = "GASM";
option php_namespace = "Google\\Cloud\\ServiceManagement\\V1";
option ruby_package = "Google::Cloud::ServiceManagement::V1";
// [Google Service Management
// API](https://cloud.google.com/service-infrastructure/docs/overview)
service ServiceManager {
option (google.api.default_host) = "servicemanagement.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform,"
"https://www.googleapis.com/auth/cloud-platform.read-only,"
"https://www.googleapis.com/auth/service.management,"
"https://www.googleapis.com/auth/service.management.readonly";
// Lists managed services.
//
// Returns all public services. For authenticated users, also returns all
// services the calling user has "servicemanagement.services.get" permission
// for.
rpc ListServices(ListServicesRequest) returns (ListServicesResponse) {
option (google.api.http) = {
get: "/v1/services"
};
option (google.api.method_signature) = "producer_project_id,consumer_id";
}
// Gets a managed service. Authentication is required unless the service is
// public.
rpc GetService(GetServiceRequest) returns (ManagedService) {
option (google.api.http) = {
get: "/v1/services/{service_name}"
};
option (google.api.method_signature) = "service_name";
}
// Creates a new managed service.
//
// A managed service is immutable, and is subject to mandatory 30-day
// data retention. You cannot move a service or recreate it within 30 days
// after deletion.
//
// One producer project can own no more than 500 services. For security and
// reliability purposes, a production service should be hosted in a
// dedicated producer project.
//
// Operation<response: ManagedService>
rpc CreateService(CreateServiceRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1/services"
body: "service"
};
option (google.api.method_signature) = "service";
option (google.longrunning.operation_info) = {
response_type: "google.api.servicemanagement.v1.ManagedService"
metadata_type: "google.api.servicemanagement.v1.OperationMetadata"
};
}
// Deletes a managed service. This method will change the service to the
// `Soft-Delete` state for 30 days. Within this period, service producers may
// call
// [UndeleteService][google.api.servicemanagement.v1.ServiceManager.UndeleteService]
// to restore the service. After 30 days, the service will be permanently
// deleted.
//
// Operation<response: google.protobuf.Empty>
rpc DeleteService(DeleteServiceRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
delete: "/v1/services/{service_name}"
};
option (google.api.method_signature) = "service_name";
option (google.longrunning.operation_info) = {
response_type: "google.protobuf.Empty"
metadata_type: "google.api.servicemanagement.v1.OperationMetadata"
};
}
// Revives a previously deleted managed service. The method restores the
// service using the configuration at the time the service was deleted.
// The target service must exist and must have been deleted within the
// last 30 days.
//
// Operation<response: UndeleteServiceResponse>
rpc UndeleteService(UndeleteServiceRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1/services/{service_name}:undelete"
};
option (google.api.method_signature) = "service_name";
option (google.longrunning.operation_info) = {
response_type: "google.api.servicemanagement.v1.UndeleteServiceResponse"
metadata_type: "google.api.servicemanagement.v1.OperationMetadata"
};
}
// Lists the history of the service configuration for a managed service,
// from the newest to the oldest.
rpc ListServiceConfigs(ListServiceConfigsRequest)
returns (ListServiceConfigsResponse) {
option (google.api.http) = {
get: "/v1/services/{service_name}/configs"
};
option (google.api.method_signature) = "service_name";
}
// Gets a service configuration (version) for a managed service.
rpc GetServiceConfig(GetServiceConfigRequest) returns (google.api.Service) {
option (google.api.http) = {
get: "/v1/services/{service_name}/configs/{config_id}"
additional_bindings { get: "/v1/services/{service_name}/config" }
};
option (google.api.method_signature) = "service_name,config_id,view";
}
// Creates a new service configuration (version) for a managed service.
// This method only stores the service configuration. To roll out the service
// configuration to backend systems please call
// [CreateServiceRollout][google.api.servicemanagement.v1.ServiceManager.CreateServiceRollout].
//
// Only the 100 most recent service configurations and ones referenced by
// existing rollouts are kept for each service. The rest will be deleted
// eventually.
rpc CreateServiceConfig(CreateServiceConfigRequest)
returns (google.api.Service) {
option (google.api.http) = {
post: "/v1/services/{service_name}/configs"
body: "service_config"
};
option (google.api.method_signature) = "service_name,service_config";
}
// Creates a new service configuration (version) for a managed service based
// on
// user-supplied configuration source files (for example: OpenAPI
// Specification). This method stores the source configurations as well as the
// generated service configuration. To rollout the service configuration to
// other services,
// please call
// [CreateServiceRollout][google.api.servicemanagement.v1.ServiceManager.CreateServiceRollout].
//
// Only the 100 most recent configuration sources and ones referenced by
// existing service configurtions are kept for each service. The rest will be
// deleted eventually.
//
// Operation<response: SubmitConfigSourceResponse>
rpc SubmitConfigSource(SubmitConfigSourceRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1/services/{service_name}/configs:submit"
body: "*"
};
option (google.api.method_signature) =
"service_name,config_source,validate_only";
option (google.longrunning.operation_info) = {
response_type: "google.api.servicemanagement.v1.SubmitConfigSourceResponse"
metadata_type: "google.api.servicemanagement.v1.OperationMetadata"
};
}
// Lists the history of the service configuration rollouts for a managed
// service, from the newest to the oldest.
rpc ListServiceRollouts(ListServiceRolloutsRequest)
returns (ListServiceRolloutsResponse) {
option (google.api.http) = {
get: "/v1/services/{service_name}/rollouts"
};
option (google.api.method_signature) = "service_name,filter";
}
// Gets a service configuration
// [rollout][google.api.servicemanagement.v1.Rollout].
rpc GetServiceRollout(GetServiceRolloutRequest) returns (Rollout) {
option (google.api.http) = {
get: "/v1/services/{service_name}/rollouts/{rollout_id}"
};
option (google.api.method_signature) = "service_name,rollout_id";
}
// Creates a new service configuration rollout. Based on rollout, the
// Google Service Management will roll out the service configurations to
// different backend services. For example, the logging configuration will be
// pushed to Google Cloud Logging.
//
// Please note that any previous pending and running Rollouts and associated
// Operations will be automatically cancelled so that the latest Rollout will
// not be blocked by previous Rollouts.
//
// Only the 100 most recent (in any state) and the last 10 successful (if not
// already part of the set of 100 most recent) rollouts are kept for each
// service. The rest will be deleted eventually.
//
// Operation<response: Rollout>
rpc CreateServiceRollout(CreateServiceRolloutRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1/services/{service_name}/rollouts"
body: "rollout"
};
option (google.api.method_signature) = "service_name,rollout";
option (google.longrunning.operation_info) = {
response_type: "google.api.servicemanagement.v1.Rollout"
metadata_type: "google.api.servicemanagement.v1.OperationMetadata"
};
}
// Generates and returns a report (errors, warnings and changes from
// existing configurations) associated with
// GenerateConfigReportRequest.new_value
//
// If GenerateConfigReportRequest.old_value is specified,
// GenerateConfigReportRequest will contain a single ChangeReport based on the
// comparison between GenerateConfigReportRequest.new_value and
// GenerateConfigReportRequest.old_value.
// If GenerateConfigReportRequest.old_value is not specified, this method
// will compare GenerateConfigReportRequest.new_value with the last pushed
// service configuration.
rpc GenerateConfigReport(GenerateConfigReportRequest)
returns (GenerateConfigReportResponse) {
option (google.api.http) = {
post: "/v1/services:generateConfigReport"
body: "*"
};
option (google.api.method_signature) = "new_config,old_config";
}
}
// Request message for `ListServices` method.
message ListServicesRequest {
// Include services produced by the specified project.
string producer_project_id = 1;
// The max number of items to include in the response list. Page size is 50
// if not specified. Maximum value is 500.
int32 page_size = 5;
// Token identifying which result to start with; returned by a previous list
// call.
string page_token = 6;
// Include services consumed by the specified consumer.
//
// The Google Service Management implementation accepts the following
// forms:
// - project:<project_id>
string consumer_id = 7 [deprecated = true];
}
// Response message for `ListServices` method.
message ListServicesResponse {
// The returned services will only have the name field set.
repeated ManagedService services = 1;
// Token that can be passed to `ListServices` to resume a paginated query.
string next_page_token = 2;
}
// Request message for `GetService` method.
message GetServiceRequest {
// Required. The name of the service. See the `ServiceManager` overview for
// naming requirements. For example: `example.googleapis.com`.
string service_name = 1 [(google.api.field_behavior) = REQUIRED];
}
// Request message for CreateService method.
message CreateServiceRequest {
// Required. Initial values for the service resource.
ManagedService service = 1 [(google.api.field_behavior) = REQUIRED];
}
// Request message for DeleteService method.
message DeleteServiceRequest {
// Required. The name of the service. See the
// [overview](https://cloud.google.com/service-management/overview) for naming
// requirements. For example: `example.googleapis.com`.
string service_name = 1 [(google.api.field_behavior) = REQUIRED];
}
// Request message for UndeleteService method.
message UndeleteServiceRequest {
// Required. The name of the service. See the
// [overview](https://cloud.google.com/service-management/overview) for naming
// requirements. For example: `example.googleapis.com`.
string service_name = 1 [(google.api.field_behavior) = REQUIRED];
}
// Response message for UndeleteService method.
message UndeleteServiceResponse {
// Revived service resource.
ManagedService service = 1;
}
// Request message for GetServiceConfig method.
message GetServiceConfigRequest {
enum ConfigView {
// Server response includes all fields except SourceInfo.
BASIC = 0;
// Server response includes all fields including SourceInfo.
// SourceFiles are of type 'google.api.servicemanagement.v1.ConfigFile'
// and are only available for configs created using the
// SubmitConfigSource method.
FULL = 1;
}
// Required. The name of the service. See the
// [overview](https://cloud.google.com/service-management/overview) for naming
// requirements. For example: `example.googleapis.com`.
string service_name = 1 [(google.api.field_behavior) = REQUIRED];
// Required. The id of the service configuration resource.
//
// This field must be specified for the server to return all fields, including
// `SourceInfo`.
string config_id = 2 [(google.api.field_behavior) = REQUIRED];
// Specifies which parts of the Service Config should be returned in the
// response.
ConfigView view = 3;
}
// Request message for ListServiceConfigs method.
message ListServiceConfigsRequest {
// Required. The name of the service. See the
// [overview](https://cloud.google.com/service-management/overview) for naming
// requirements. For example: `example.googleapis.com`.
string service_name = 1 [(google.api.field_behavior) = REQUIRED];
// The token of the page to retrieve.
string page_token = 2;
// The max number of items to include in the response list. Page size is 50
// if not specified. Maximum value is 100.
int32 page_size = 3;
}
// Response message for ListServiceConfigs method.
message ListServiceConfigsResponse {
// The list of service configuration resources.
repeated google.api.Service service_configs = 1;
// The token of the next page of results.
string next_page_token = 2;
}
// Request message for CreateServiceConfig method.
message CreateServiceConfigRequest {
// Required. The name of the service. See the
// [overview](https://cloud.google.com/service-management/overview) for naming
// requirements. For example: `example.googleapis.com`.
string service_name = 1 [(google.api.field_behavior) = REQUIRED];
// Required. The service configuration resource.
google.api.Service service_config = 2
[(google.api.field_behavior) = REQUIRED];
}
// Request message for SubmitConfigSource method.
message SubmitConfigSourceRequest {
// Required. The name of the service. See the
// [overview](https://cloud.google.com/service-management/overview) for naming
// requirements. For example: `example.googleapis.com`.
string service_name = 1 [(google.api.field_behavior) = REQUIRED];
// Required. The source configuration for the service.
ConfigSource config_source = 2 [(google.api.field_behavior) = REQUIRED];
// Optional. If set, this will result in the generation of a
// `google.api.Service` configuration based on the `ConfigSource` provided,
// but the generated config and the sources will NOT be persisted.
bool validate_only = 3 [(google.api.field_behavior) = OPTIONAL];
}
// Response message for SubmitConfigSource method.
message SubmitConfigSourceResponse {
// The generated service configuration.
google.api.Service service_config = 1;
}
//
// Request message for 'CreateServiceRollout'
message CreateServiceRolloutRequest {
// Required. The name of the service. See the
// [overview](https://cloud.google.com/service-management/overview) for naming
// requirements. For example: `example.googleapis.com`.
string service_name = 1 [(google.api.field_behavior) = REQUIRED];
// Required. The rollout resource. The `service_name` field is output only.
Rollout rollout = 2 [(google.api.field_behavior) = REQUIRED];
}
// Request message for 'ListServiceRollouts'
message ListServiceRolloutsRequest {
// Required. The name of the service. See the
// [overview](https://cloud.google.com/service-management/overview) for naming
// requirements. For example: `example.googleapis.com`.
string service_name = 1 [(google.api.field_behavior) = REQUIRED];
// The token of the page to retrieve.
string page_token = 2;
// The max number of items to include in the response list. Page size is 50
// if not specified. Maximum value is 100.
int32 page_size = 3;
// Required. Use `filter` to return subset of rollouts.
// The following filters are supported:
//
// -- By [status]
// [google.api.servicemanagement.v1.Rollout.RolloutStatus]. For example,
// `filter='status=SUCCESS'`
//
// -- By [strategy]
// [google.api.servicemanagement.v1.Rollout.strategy]. For example,
// `filter='strategy=TrafficPercentStrategy'`
string filter = 4 [(google.api.field_behavior) = REQUIRED];
}
// Response message for ListServiceRollouts method.
message ListServiceRolloutsResponse {
// The list of rollout resources.
repeated Rollout rollouts = 1;
// The token of the next page of results.
string next_page_token = 2;
}
// Request message for GetServiceRollout method.
message GetServiceRolloutRequest {
// Required. The name of the service. See the
// [overview](https://cloud.google.com/service-management/overview) for naming
// requirements. For example: `example.googleapis.com`.
string service_name = 1 [(google.api.field_behavior) = REQUIRED];
// Required. The id of the rollout resource.
string rollout_id = 2 [(google.api.field_behavior) = REQUIRED];
}
// Operation payload for EnableService method.
message EnableServiceResponse {}
// Request message for GenerateConfigReport method.
message GenerateConfigReportRequest {
// Required. Service configuration for which we want to generate the report.
// For this version of API, the supported types are
// [google.api.servicemanagement.v1.ConfigRef][google.api.servicemanagement.v1.ConfigRef],
// [google.api.servicemanagement.v1.ConfigSource][google.api.servicemanagement.v1.ConfigSource],
// and [google.api.Service][google.api.Service]
google.protobuf.Any new_config = 1 [(google.api.field_behavior) = REQUIRED];
// Optional. Service configuration against which the comparison will be done.
// For this version of API, the supported types are
// [google.api.servicemanagement.v1.ConfigRef][google.api.servicemanagement.v1.ConfigRef],
// [google.api.servicemanagement.v1.ConfigSource][google.api.servicemanagement.v1.ConfigSource],
// and [google.api.Service][google.api.Service]
google.protobuf.Any old_config = 2 [(google.api.field_behavior) = OPTIONAL];
}
// Response message for GenerateConfigReport method.
message GenerateConfigReportResponse {
// Name of the service this report belongs to.
string service_name = 1;
// ID of the service configuration this report belongs to.
string id = 2;
// list of ChangeReport, each corresponding to comparison between two
// service configurations.
repeated ChangeReport change_reports = 3;
// Errors / Linter warnings associated with the service definition this
// report
// belongs to.
repeated Diagnostic diagnostics = 4;
}

View File

@@ -0,0 +1,130 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api.serviceusage.v1;
import "google/api/auth.proto";
import "google/api/documentation.proto";
import "google/api/endpoint.proto";
import "google/api/monitored_resource.proto";
import "google/api/monitoring.proto";
import "google/api/quota.proto";
import "google/api/resource.proto";
import "google/api/usage.proto";
import "google/protobuf/api.proto";
option csharp_namespace = "Google.Cloud.ServiceUsage.V1";
option go_package = "cloud.google.com/go/serviceusage/apiv1/serviceusagepb;serviceusagepb";
option java_multiple_files = true;
option java_outer_classname = "ResourcesProto";
option java_package = "com.google.api.serviceusage.v1";
option php_namespace = "Google\\Cloud\\ServiceUsage\\V1";
option ruby_package = "Google::Cloud::ServiceUsage::V1";
// A service that is available for use by the consumer.
message Service {
option (google.api.resource) = {
type: "serviceusage.googleapis.com/Service"
pattern: "projects/{project}/services/{service}"
pattern: "folders/{folder}/services/{service}"
pattern: "organizations/{organization}/services/{service}"
};
// The resource name of the consumer and service.
//
// A valid name would be:
// - projects/123/services/serviceusage.googleapis.com
string name = 1;
// The resource name of the consumer.
//
// A valid name would be:
// - projects/123
string parent = 5;
// The service configuration of the available service.
// Some fields may be filtered out of the configuration in responses to
// the `ListServices` method. These fields are present only in responses to
// the `GetService` method.
ServiceConfig config = 2;
// Whether or not the service has been enabled for use by the consumer.
State state = 4;
}
// Whether or not a service has been enabled for use by a consumer.
enum State {
// The default value, which indicates that the enabled state of the service
// is unspecified or not meaningful. Currently, all consumers other than
// projects (such as folders and organizations) are always in this state.
STATE_UNSPECIFIED = 0;
// The service cannot be used by this consumer. It has either been explicitly
// disabled, or has never been enabled.
DISABLED = 1;
// The service has been explicitly enabled for use by this consumer.
ENABLED = 2;
}
// The configuration of the service.
message ServiceConfig {
// The DNS address at which this service is available.
//
// An example DNS address would be:
// `calendar.googleapis.com`.
string name = 1;
// The product title for this service.
string title = 2;
// A list of API interfaces exported by this service. Contains only the names,
// versions, and method names of the interfaces.
repeated google.protobuf.Api apis = 3;
// Additional API documentation. Contains only the summary and the
// documentation URL.
google.api.Documentation documentation = 6;
// Quota configuration.
google.api.Quota quota = 10;
// Auth configuration. Contains only the OAuth rules.
google.api.Authentication authentication = 11;
// Configuration controlling usage of this service.
google.api.Usage usage = 15;
// Configuration for network endpoints. Contains only the names and aliases
// of the endpoints.
repeated google.api.Endpoint endpoints = 18;
// Defines the monitored resources used by this service. This is required
// by the [Service.monitoring][google.api.Service.monitoring] and
// [Service.logging][google.api.Service.logging] configurations.
repeated google.api.MonitoredResourceDescriptor monitored_resources = 25;
// Monitoring configuration.
// This should not include the 'producer_destinations' field.
google.api.Monitoring monitoring = 28;
}
// The operation metadata returned for the batchend services operation.
message OperationMetadata {
// The full name of the resources that this operation is directly
// associated with.
repeated string resource_names = 2;
}

View File

@@ -0,0 +1,305 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api.serviceusage.v1;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/serviceusage/v1/resources.proto";
import "google/longrunning/operations.proto";
option csharp_namespace = "Google.Cloud.ServiceUsage.V1";
option go_package = "cloud.google.com/go/serviceusage/apiv1/serviceusagepb;serviceusagepb";
option java_multiple_files = true;
option java_outer_classname = "ServiceUsageProto";
option java_package = "com.google.api.serviceusage.v1";
option php_namespace = "Google\\Cloud\\ServiceUsage\\V1";
option ruby_package = "Google::Cloud::ServiceUsage::V1";
// Enables services that service consumers want to use on Google Cloud Platform,
// lists the available or enabled services, or disables services that service
// consumers no longer use.
//
// See [Service Usage API](https://cloud.google.com/service-usage/docs/overview)
service ServiceUsage {
option (google.api.default_host) = "serviceusage.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform,"
"https://www.googleapis.com/auth/cloud-platform.read-only,"
"https://www.googleapis.com/auth/service.management";
// Enable a service so that it can be used with a project.
rpc EnableService(EnableServiceRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1/{name=*/*/services/*}:enable"
body: "*"
};
option (google.longrunning.operation_info) = {
response_type: "EnableServiceResponse"
metadata_type: "OperationMetadata"
};
}
// Disable a service so that it can no longer be used with a project.
// This prevents unintended usage that may cause unexpected billing
// charges or security leaks.
//
// It is not valid to call the disable method on a service that is not
// currently enabled. Callers will receive a `FAILED_PRECONDITION` status if
// the target service is not currently enabled.
rpc DisableService(DisableServiceRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1/{name=*/*/services/*}:disable"
body: "*"
};
option (google.longrunning.operation_info) = {
response_type: "DisableServiceResponse"
metadata_type: "OperationMetadata"
};
}
// Returns the service configuration and enabled state for a given service.
rpc GetService(GetServiceRequest) returns (Service) {
option (google.api.http) = {
get: "/v1/{name=*/*/services/*}"
};
}
// List all services available to the specified project, and the current
// state of those services with respect to the project. The list includes
// all public services, all services for which the calling user has the
// `servicemanagement.services.bind` permission, and all services that have
// already been enabled on the project. The list can be filtered to
// only include services in a specific state, for example to only include
// services enabled on the project.
//
// WARNING: If you need to query enabled services frequently or across
// an organization, you should use
// [Cloud Asset Inventory
// API](https://cloud.google.com/asset-inventory/docs/apis), which provides
// higher throughput and richer filtering capability.
rpc ListServices(ListServicesRequest) returns (ListServicesResponse) {
option (google.api.http) = {
get: "/v1/{parent=*/*}/services"
};
}
// Enable multiple services on a project. The operation is atomic: if enabling
// any service fails, then the entire batch fails, and no state changes occur.
// To enable a single service, use the `EnableService` method instead.
rpc BatchEnableServices(BatchEnableServicesRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1/{parent=*/*}/services:batchEnable"
body: "*"
};
option (google.longrunning.operation_info) = {
response_type: "BatchEnableServicesResponse"
metadata_type: "OperationMetadata"
};
}
// Returns the service configurations and enabled states for a given list of
// services.
rpc BatchGetServices(BatchGetServicesRequest)
returns (BatchGetServicesResponse) {
option (google.api.http) = {
get: "/v1/{parent=*/*}/services:batchGet"
};
}
}
// Request message for the `EnableService` method.
message EnableServiceRequest {
// Name of the consumer and service to enable the service on.
//
// The `EnableService` and `DisableService` methods currently only support
// projects.
//
// Enabling a service requires that the service is public or is shared with
// the user enabling the service.
//
// An example name would be:
// `projects/123/services/serviceusage.googleapis.com` where `123` is the
// project number.
string name = 1;
}
// Response message for the `EnableService` method.
// This response message is assigned to the `response` field of the returned
// Operation when that operation is done.
message EnableServiceResponse {
// The new state of the service after enabling.
Service service = 1;
}
// Request message for the `DisableService` method.
message DisableServiceRequest {
// Enum to determine if service usage should be checked when disabling a
// service.
enum CheckIfServiceHasUsage {
// When unset, the default behavior is used, which is SKIP.
CHECK_IF_SERVICE_HAS_USAGE_UNSPECIFIED = 0;
// If set, skip checking service usage when disabling a service.
SKIP = 1;
// If set, service usage is checked when disabling the service. If a
// service, or its dependents, has usage in the last 30 days, the request
// returns a FAILED_PRECONDITION error.
CHECK = 2;
}
// Name of the consumer and service to disable the service on.
//
// The enable and disable methods currently only support projects.
//
// An example name would be:
// `projects/123/services/serviceusage.googleapis.com` where `123` is the
// project number.
string name = 1;
// Indicates if services that are enabled and which depend on this service
// should also be disabled. If not set, an error will be generated if any
// enabled services depend on the service to be disabled. When set, the
// service, and any enabled services that depend on it, will be disabled
// together.
bool disable_dependent_services = 2;
// Defines the behavior for checking service usage when disabling a service.
CheckIfServiceHasUsage check_if_service_has_usage = 3;
}
// Response message for the `DisableService` method.
// This response message is assigned to the `response` field of the returned
// Operation when that operation is done.
message DisableServiceResponse {
// The new state of the service after disabling.
Service service = 1;
}
// Request message for the `GetService` method.
message GetServiceRequest {
// Name of the consumer and service to get the `ConsumerState` for.
//
// An example name would be:
// `projects/123/services/serviceusage.googleapis.com` where `123` is the
// project number.
string name = 1;
}
// Request message for the `ListServices` method.
message ListServicesRequest {
// Parent to search for services on.
//
// An example name would be:
// `projects/123` where `123` is the project number.
string parent = 1;
// Requested size of the next page of data.
// Requested page size cannot exceed 200.
// If not set, the default page size is 50.
int32 page_size = 2;
// Token identifying which result to start with, which is returned by a
// previous list call.
string page_token = 3;
// Only list services that conform to the given filter.
// The allowed filter strings are `state:ENABLED` and `state:DISABLED`.
string filter = 4;
}
// Response message for the `ListServices` method.
message ListServicesResponse {
// The available services for the requested project.
repeated Service services = 1;
// Token that can be passed to `ListServices` to resume a paginated
// query.
string next_page_token = 2;
}
// Request message for the `BatchEnableServices` method.
message BatchEnableServicesRequest {
// Parent to enable services on.
//
// An example name would be:
// `projects/123` where `123` is the project number.
//
// The `BatchEnableServices` method currently only supports projects.
string parent = 1;
// The identifiers of the services to enable on the project.
//
// A valid identifier would be:
// serviceusage.googleapis.com
//
// Enabling services requires that each service is public or is shared with
// the user enabling the service.
//
// A single request can enable a maximum of 20 services at a time. If more
// than 20 services are specified, the request will fail, and no state changes
// will occur.
repeated string service_ids = 2;
}
// Response message for the `BatchEnableServices` method.
// This response message is assigned to the `response` field of the returned
// Operation when that operation is done.
message BatchEnableServicesResponse {
// Provides error messages for the failing services.
message EnableFailure {
// The service id of a service that could not be enabled.
string service_id = 1;
// An error message describing why the service could not be enabled.
string error_message = 2;
}
// The new state of the services after enabling.
repeated Service services = 1;
// If allow_partial_success is true, and one or more services could not be
// enabled, this field contains the details about each failure.
repeated EnableFailure failures = 2;
}
// Request message for the `BatchGetServices` method.
message BatchGetServicesRequest {
// Parent to retrieve services from.
// If this is set, the parent of all of the services specified in `names` must
// match this field. An example name would be: `projects/123` where `123` is
// the project number. The `BatchGetServices` method currently only supports
// projects.
string parent = 1;
// Names of the services to retrieve.
//
// An example name would be:
// `projects/123/services/serviceusage.googleapis.com` where `123` is the
// project number.
// A single request can get a maximum of 30 services at a time.
repeated string names = 2;
}
// Response message for the `BatchGetServices` method.
message BatchGetServicesResponse {
// The requested Service states.
repeated Service services = 1;
}

View File

@@ -0,0 +1,458 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api.serviceusage.v1beta1;
import "google/api/auth.proto";
import "google/api/documentation.proto";
import "google/api/endpoint.proto";
import "google/api/monitored_resource.proto";
import "google/api/monitoring.proto";
import "google/api/quota.proto";
import "google/api/usage.proto";
import "google/protobuf/api.proto";
option csharp_namespace = "Google.Api.ServiceUsage.V1Beta1";
option go_package = "google.golang.org/genproto/googleapis/api/serviceusage/v1beta1;serviceusage";
option java_multiple_files = true;
option java_outer_classname = "ResourcesProto";
option java_package = "com.google.api.serviceusage.v1beta1";
option php_namespace = "Google\\Api\\ServiceUsage\\V1beta1";
option ruby_package = "Google::Api::ServiceUsage::V1beta1";
// A service that is available for use by the consumer.
message Service {
// The resource name of the consumer and service.
//
// A valid name would be:
// - `projects/123/services/serviceusage.googleapis.com`
string name = 1;
// The resource name of the consumer.
//
// A valid name would be:
// - `projects/123`
string parent = 5;
// The service configuration of the available service.
// Some fields may be filtered out of the configuration in responses to
// the `ListServices` method. These fields are present only in responses to
// the `GetService` method.
ServiceConfig config = 2;
// Whether or not the service has been enabled for use by the consumer.
State state = 4;
}
// Whether or not a service has been enabled for use by a consumer.
enum State {
// The default value, which indicates that the enabled state of the service
// is unspecified or not meaningful. Currently, all consumers other than
// projects (such as folders and organizations) are always in this state.
STATE_UNSPECIFIED = 0;
// The service cannot be used by this consumer. It has either been explicitly
// disabled, or has never been enabled.
DISABLED = 1;
// The service has been explicitly enabled for use by this consumer.
ENABLED = 2;
}
// The configuration of the service.
message ServiceConfig {
// The DNS address at which this service is available.
//
// An example DNS address would be:
// `calendar.googleapis.com`.
string name = 1;
// The product title for this service.
string title = 2;
// A list of API interfaces exported by this service. Contains only the names,
// versions, and method names of the interfaces.
repeated google.protobuf.Api apis = 3;
// Additional API documentation. Contains only the summary and the
// documentation URL.
google.api.Documentation documentation = 6;
// Quota configuration.
google.api.Quota quota = 10;
// Auth configuration. Contains only the OAuth rules.
google.api.Authentication authentication = 11;
// Configuration controlling usage of this service.
google.api.Usage usage = 15;
// Configuration for network endpoints. Contains only the names and aliases
// of the endpoints.
repeated google.api.Endpoint endpoints = 18;
// Defines the monitored resources used by this service. This is required
// by the [Service.monitoring][google.api.Service.monitoring] and
// [Service.logging][google.api.Service.logging] configurations.
repeated google.api.MonitoredResourceDescriptor monitored_resources = 25;
// Monitoring configuration.
// This should not include the 'producer_destinations' field.
google.api.Monitoring monitoring = 28;
}
// The operation metadata returned for the batchend services operation.
message OperationMetadata {
// The full name of the resources that this operation is directly
// associated with.
repeated string resource_names = 2;
}
// Consumer quota settings for a quota metric.
message ConsumerQuotaMetric {
// The resource name of the quota settings on this metric for this consumer.
//
// An example name would be:
// `projects/123/services/compute.googleapis.com/consumerQuotaMetrics/compute.googleapis.com%2Fcpus`
//
// The resource name is intended to be opaque and should not be parsed for
// its component strings, since its representation could change in the future.
string name = 1;
// The name of the metric.
//
// An example name would be:
// `compute.googleapis.com/cpus`
string metric = 4;
// The display name of the metric.
//
// An example name would be:
// `CPUs`
string display_name = 2;
// The consumer quota for each quota limit defined on the metric.
repeated ConsumerQuotaLimit consumer_quota_limits = 3;
// The quota limits targeting the descendant containers of the
// consumer in request.
//
// If the consumer in request is of type `organizations`
// or `folders`, the field will list per-project limits in the metric; if the
// consumer in request is of type `project`, the field will be empty.
//
// The `quota_buckets` field of each descendant consumer quota limit will not
// be populated.
repeated ConsumerQuotaLimit descendant_consumer_quota_limits = 6;
// The units in which the metric value is reported.
string unit = 5;
}
// Consumer quota settings for a quota limit.
message ConsumerQuotaLimit {
// The resource name of the quota limit.
//
// An example name would be:
// `projects/123/services/compute.googleapis.com/consumerQuotaMetrics/compute.googleapis.com%2Fcpus/limits/%2Fproject%2Fregion`
//
// The resource name is intended to be opaque and should not be parsed for
// its component strings, since its representation could change in the future.
string name = 1;
// The name of the parent metric of this limit.
//
// An example name would be:
// `compute.googleapis.com/cpus`
string metric = 8;
// The limit unit.
//
// An example unit would be
// `1/{project}/{region}`
// Note that `{project}` and `{region}` are not placeholders in this example;
// the literal characters `{` and `}` occur in the string.
string unit = 2;
// Whether this limit is precise or imprecise.
bool is_precise = 3;
// Whether admin overrides are allowed on this limit
bool allows_admin_overrides = 7;
// Summary of the enforced quota buckets, organized by quota dimension,
// ordered from least specific to most specific (for example, the global
// default bucket, with no quota dimensions, will always appear first).
repeated QuotaBucket quota_buckets = 9;
// List of all supported locations.
// This field is present only if the limit has a {region} or {zone} dimension.
repeated string supported_locations = 11;
}
// Selected view of quota. Can be used to request more detailed quota
// information when retrieving quota metrics and limits.
enum QuotaView {
// No quota view specified. Requests that do not specify a quota view will
// typically default to the BASIC view.
QUOTA_VIEW_UNSPECIFIED = 0;
// Only buckets with overrides are shown in the response.
BASIC = 1;
// Include per-location buckets even if they do not have overrides.
// When the view is FULL, and a limit has regional or zonal quota, the limit
// will include buckets for all regions or zones that could support
// overrides, even if none are currently present. In some cases this will
// cause the response to become very large; callers that do not need this
// extra information should use the BASIC view instead.
FULL = 2;
}
// A quota bucket is a quota provisioning unit for a specific set of dimensions.
message QuotaBucket {
// The effective limit of this quota bucket. Equal to default_limit if there
// are no overrides.
int64 effective_limit = 1;
// The default limit of this quota bucket, as specified by the service
// configuration.
int64 default_limit = 2;
// Producer override on this quota bucket.
QuotaOverride producer_override = 3;
// Consumer override on this quota bucket.
QuotaOverride consumer_override = 4;
// Admin override on this quota bucket.
QuotaOverride admin_override = 5;
// Producer policy inherited from the closet ancestor of the current consumer.
ProducerQuotaPolicy producer_quota_policy = 7;
// The dimensions of this quota bucket.
//
// If this map is empty, this is the global bucket, which is the default quota
// value applied to all requests that do not have a more specific override.
//
// If this map is nonempty, the default limit, effective limit, and quota
// overrides apply only to requests that have the dimensions given in the map.
//
// For example, if the map has key `region` and value `us-east-1`, then the
// specified effective limit is only effective in that region, and the
// specified overrides apply only in that region.
map<string, string> dimensions = 6;
}
// A quota override
message QuotaOverride {
// The resource name of the override.
// This name is generated by the server when the override is created.
//
// Example names would be:
// `projects/123/services/compute.googleapis.com/consumerQuotaMetrics/compute.googleapis.com%2Fcpus/limits/%2Fproject%2Fregion/adminOverrides/4a3f2c1d`
// `projects/123/services/compute.googleapis.com/consumerQuotaMetrics/compute.googleapis.com%2Fcpus/limits/%2Fproject%2Fregion/consumerOverrides/4a3f2c1d`
//
// The resource name is intended to be opaque and should not be parsed for
// its component strings, since its representation could change in the future.
string name = 1;
// The overriding quota limit value.
// Can be any nonnegative integer, or -1 (unlimited quota).
int64 override_value = 2;
// If this map is nonempty, then this override applies only to specific values
// for dimensions defined in the limit unit.
//
// For example, an override on a limit with the unit `1/{project}/{region}`
// could contain an entry with the key `region` and the value `us-east-1`;
// the override is only applied to quota consumed in that region.
//
// This map has the following restrictions:
//
// * Keys that are not defined in the limit's unit are not valid keys.
// Any string appearing in `{brackets}` in the unit (besides `{project}`
// or
// `{user}`) is a defined key.
// * `project` is not a valid key; the project is already specified in
// the parent resource name.
// * `user` is not a valid key; the API does not support quota overrides
// that apply only to a specific user.
// * If `region` appears as a key, its value must be a valid Cloud region.
// * If `zone` appears as a key, its value must be a valid Cloud zone.
// * If any valid key other than `region` or `zone` appears in the map, then
// all valid keys other than `region` or `zone` must also appear in the
// map.
map<string, string> dimensions = 3;
// The name of the metric to which this override applies.
//
// An example name would be:
// `compute.googleapis.com/cpus`
string metric = 4;
// The limit unit of the limit to which this override applies.
//
// An example unit would be:
// `1/{project}/{region}`
// Note that `{project}` and `{region}` are not placeholders in this example;
// the literal characters `{` and `}` occur in the string.
string unit = 5;
// The resource name of the ancestor that requested the override. For example:
// `organizations/12345` or `folders/67890`.
// Used by admin overrides only.
string admin_override_ancestor = 6;
}
// Import data embedded in the request message
message OverrideInlineSource {
// The overrides to create.
// Each override must have a value for 'metric' and 'unit', to specify
// which metric and which limit the override should be applied to.
// The 'name' field of the override does not need to be set; it is ignored.
repeated QuotaOverride overrides = 1;
}
// Enumerations of quota safety checks.
enum QuotaSafetyCheck {
// Unspecified quota safety check.
QUOTA_SAFETY_CHECK_UNSPECIFIED = 0;
// Validates that a quota mutation would not cause the consumer's effective
// limit to be lower than the consumer's quota usage.
LIMIT_DECREASE_BELOW_USAGE = 1;
// Validates that a quota mutation would not cause the consumer's effective
// limit to decrease by more than 10 percent.
LIMIT_DECREASE_PERCENTAGE_TOO_HIGH = 2;
}
// Quota policy created by service producer.
message ProducerQuotaPolicy {
// The resource name of the policy.
// This name is generated by the server when the policy is created.
//
// Example names would be:
// `organizations/123/services/compute.googleapis.com/consumerQuotaMetrics/compute.googleapis.com%2Fcpus/limits/%2Fproject%2Fregion/producerQuotaPolicies/4a3f2c1d`
string name = 1;
// The quota policy value.
// Can be any nonnegative integer, or -1 (unlimited quota).
int64 policy_value = 2;
//
// If this map is nonempty, then this policy applies only to specific values
// for dimensions defined in the limit unit.
//
// For example, a policy on a limit with the unit `1/{project}/{region}`
// could contain an entry with the key `region` and the value `us-east-1`;
// the policy is only applied to quota consumed in that region.
//
// This map has the following restrictions:
//
// * Keys that are not defined in the limit's unit are not valid keys.
// Any string appearing in {brackets} in the unit (besides {project} or
// {user}) is a defined key.
// * `project` is not a valid key; the project is already specified in
// the parent resource name.
// * `user` is not a valid key; the API does not support quota policies
// that apply only to a specific user.
// * If `region` appears as a key, its value must be a valid Cloud region.
// * If `zone` appears as a key, its value must be a valid Cloud zone.
// * If any valid key other than `region` or `zone` appears in the map, then
// all valid keys other than `region` or `zone` must also appear in the
// map.
map<string, string> dimensions = 3;
// The name of the metric to which this policy applies.
//
// An example name would be:
// `compute.googleapis.com/cpus`
string metric = 4;
// The limit unit of the limit to which this policy applies.
//
// An example unit would be:
// `1/{project}/{region}`
// Note that `{project}` and `{region}` are not placeholders in this example;
// the literal characters `{` and `}` occur in the string.
string unit = 5;
// The cloud resource container at which the quota policy is created. The
// format is `{container_type}/{container_number}`
string container = 6;
}
// Quota policy created by quota administrator.
message AdminQuotaPolicy {
// The resource name of the policy.
// This name is generated by the server when the policy is created.
//
// Example names would be:
// `organizations/123/services/compute.googleapis.com/consumerQuotaMetrics/compute.googleapis.com%2Fcpus/limits/%2Fproject%2Fregion/adminQuotaPolicies/4a3f2c1d`
string name = 1;
// The quota policy value.
// Can be any nonnegative integer, or -1 (unlimited quota).
int64 policy_value = 2;
//
// If this map is nonempty, then this policy applies only to specific values
// for dimensions defined in the limit unit.
//
// For example, a policy on a limit with the unit `1/{project}/{region}`
// could contain an entry with the key `region` and the value `us-east-1`;
// the policy is only applied to quota consumed in that region.
//
// This map has the following restrictions:
//
// * If `region` appears as a key, its value must be a valid Cloud region.
// * If `zone` appears as a key, its value must be a valid Cloud zone.
// * Keys other than `region` or `zone` are not valid.
map<string, string> dimensions = 3;
// The name of the metric to which this policy applies.
//
// An example name would be:
// `compute.googleapis.com/cpus`
string metric = 4;
// The limit unit of the limit to which this policy applies.
//
// An example unit would be:
// `1/{project}/{region}`
// Note that `{project}` and `{region}` are not placeholders in this example;
// the literal characters `{` and `}` occur in the string.
string unit = 5;
// The cloud resource container at which the quota policy is created. The
// format is `{container_type}/{container_number}`
string container = 6;
}
// Service identity for a service. This is the identity that service producer
// should use to access consumer resources.
message ServiceIdentity {
// The email address of the service account that a service producer would use
// to access consumer resources.
string email = 1;
// The unique and stable id of the service account.
// https://cloud.google.com/iam/reference/rest/v1/projects.serviceAccounts#ServiceAccount
string unique_id = 2;
}

View File

@@ -0,0 +1,793 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api.serviceusage.v1beta1;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/serviceusage/v1beta1/resources.proto";
import "google/longrunning/operations.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
option csharp_namespace = "Google.Api.ServiceUsage.V1Beta1";
option go_package = "google.golang.org/genproto/googleapis/api/serviceusage/v1beta1;serviceusage";
option java_multiple_files = true;
option java_outer_classname = "ServiceUsageProto";
option java_package = "com.google.api.serviceusage.v1beta1";
option php_namespace = "Google\\Api\\ServiceUsage\\V1beta1";
option ruby_package = "Google::Api::ServiceUsage::V1beta1";
// [Service Usage API](https://cloud.google.com/service-usage/docs/overview)
service ServiceUsage {
option (google.api.default_host) = "serviceusage.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform,"
"https://www.googleapis.com/auth/cloud-platform.read-only,"
"https://www.googleapis.com/auth/service.management";
// Enables a service so that it can be used with a project.
//
// Operation response type: `google.protobuf.Empty`
rpc EnableService(EnableServiceRequest)
returns (google.longrunning.Operation) {
option deprecated = true;
option (google.api.http) = {
post: "/v1beta1/{name=*/*/services/*}:enable"
body: "*"
};
option (google.longrunning.operation_info) = {
response_type: "google.protobuf.Empty"
metadata_type: "OperationMetadata"
};
}
// Disables a service so that it can no longer be used with a project.
// This prevents unintended usage that may cause unexpected billing
// charges or security leaks.
//
// It is not valid to call the disable method on a service that is not
// currently enabled. Callers will receive a `FAILED_PRECONDITION` status if
// the target service is not currently enabled.
//
// Operation response type: `google.protobuf.Empty`
rpc DisableService(DisableServiceRequest)
returns (google.longrunning.Operation) {
option deprecated = true;
option (google.api.http) = {
post: "/v1beta1/{name=*/*/services/*}:disable"
body: "*"
};
option (google.longrunning.operation_info) = {
response_type: "google.protobuf.Empty"
metadata_type: "OperationMetadata"
};
}
// Returns the service configuration and enabled state for a given service.
rpc GetService(GetServiceRequest) returns (Service) {
option deprecated = true;
option (google.api.http) = {
get: "/v1beta1/{name=*/*/services/*}"
};
}
// Lists all services available to the specified project, and the current
// state of those services with respect to the project. The list includes
// all public services, all services for which the calling user has the
// `servicemanagement.services.bind` permission, and all services that have
// already been enabled on the project. The list can be filtered to
// only include services in a specific state, for example to only include
// services enabled on the project.
rpc ListServices(ListServicesRequest) returns (ListServicesResponse) {
option deprecated = true;
option (google.api.http) = {
get: "/v1beta1/{parent=*/*}/services"
};
}
// Enables multiple services on a project. The operation is atomic: if
// enabling any service fails, then the entire batch fails, and no state
// changes occur.
//
// Operation response type: `google.protobuf.Empty`
rpc BatchEnableServices(BatchEnableServicesRequest)
returns (google.longrunning.Operation) {
option deprecated = true;
option (google.api.http) = {
post: "/v1beta1/{parent=*/*}/services:batchEnable"
body: "*"
};
option (google.longrunning.operation_info) = {
response_type: "google.protobuf.Empty"
metadata_type: "OperationMetadata"
};
}
// Retrieves a summary of all quota information visible to the service
// consumer, organized by service metric. Each metric includes information
// about all of its defined limits. Each limit includes the limit
// configuration (quota unit, preciseness, default value), the current
// effective limit value, and all of the overrides applied to the limit.
rpc ListConsumerQuotaMetrics(ListConsumerQuotaMetricsRequest)
returns (ListConsumerQuotaMetricsResponse) {
option (google.api.http) = {
get: "/v1beta1/{parent=*/*/services/*}/consumerQuotaMetrics"
};
}
// Retrieves a summary of quota information for a specific quota metric
rpc GetConsumerQuotaMetric(GetConsumerQuotaMetricRequest)
returns (ConsumerQuotaMetric) {
option (google.api.http) = {
get: "/v1beta1/{name=*/*/services/*/consumerQuotaMetrics/*}"
};
}
// Retrieves a summary of quota information for a specific quota limit.
rpc GetConsumerQuotaLimit(GetConsumerQuotaLimitRequest)
returns (ConsumerQuotaLimit) {
option (google.api.http) = {
get: "/v1beta1/{name=*/*/services/*/consumerQuotaMetrics/*/limits/*}"
};
}
// Creates an admin override.
// An admin override is applied by an administrator of a parent folder or
// parent organization of the consumer receiving the override. An admin
// override is intended to limit the amount of quota the consumer can use out
// of the total quota pool allocated to all children of the folder or
// organization.
rpc CreateAdminOverride(CreateAdminOverrideRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1beta1/{parent=*/*/services/*/consumerQuotaMetrics/*/limits/*}/adminOverrides"
body: "override"
};
option (google.longrunning.operation_info) = {
response_type: "QuotaOverride"
metadata_type: "OperationMetadata"
};
}
// Updates an admin override.
rpc UpdateAdminOverride(UpdateAdminOverrideRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
patch: "/v1beta1/{name=*/*/services/*/consumerQuotaMetrics/*/limits/*/adminOverrides/*}"
body: "override"
};
option (google.longrunning.operation_info) = {
response_type: "QuotaOverride"
metadata_type: "OperationMetadata"
};
}
// Deletes an admin override.
rpc DeleteAdminOverride(DeleteAdminOverrideRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
delete: "/v1beta1/{name=*/*/services/*/consumerQuotaMetrics/*/limits/*/adminOverrides/*}"
};
option (google.longrunning.operation_info) = {
response_type: "google.protobuf.Empty"
metadata_type: "OperationMetadata"
};
}
// Lists all admin overrides on this limit.
rpc ListAdminOverrides(ListAdminOverridesRequest)
returns (ListAdminOverridesResponse) {
option (google.api.http) = {
get: "/v1beta1/{parent=*/*/services/*/consumerQuotaMetrics/*/limits/*}/adminOverrides"
};
}
// Creates or updates multiple admin overrides atomically, all on the
// same consumer, but on many different metrics or limits.
// The name field in the quota override message should not be set.
rpc ImportAdminOverrides(ImportAdminOverridesRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1beta1/{parent=*/*/services/*}/consumerQuotaMetrics:importAdminOverrides"
body: "*"
};
option (google.longrunning.operation_info) = {
response_type: "ImportAdminOverridesResponse"
metadata_type: "ImportAdminOverridesMetadata"
};
}
// Creates a consumer override.
// A consumer override is applied to the consumer on its own authority to
// limit its own quota usage. Consumer overrides cannot be used to grant more
// quota than would be allowed by admin overrides, producer overrides, or the
// default limit of the service.
rpc CreateConsumerOverride(CreateConsumerOverrideRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1beta1/{parent=*/*/services/*/consumerQuotaMetrics/*/limits/*}/consumerOverrides"
body: "override"
};
option (google.longrunning.operation_info) = {
response_type: "QuotaOverride"
metadata_type: "OperationMetadata"
};
}
// Updates a consumer override.
rpc UpdateConsumerOverride(UpdateConsumerOverrideRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
patch: "/v1beta1/{name=*/*/services/*/consumerQuotaMetrics/*/limits/*/consumerOverrides/*}"
body: "override"
};
option (google.longrunning.operation_info) = {
response_type: "QuotaOverride"
metadata_type: "OperationMetadata"
};
}
// Deletes a consumer override.
rpc DeleteConsumerOverride(DeleteConsumerOverrideRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
delete: "/v1beta1/{name=*/*/services/*/consumerQuotaMetrics/*/limits/*/consumerOverrides/*}"
};
option (google.longrunning.operation_info) = {
response_type: "google.protobuf.Empty"
metadata_type: "OperationMetadata"
};
}
// Lists all consumer overrides on this limit.
rpc ListConsumerOverrides(ListConsumerOverridesRequest)
returns (ListConsumerOverridesResponse) {
option (google.api.http) = {
get: "/v1beta1/{parent=*/*/services/*/consumerQuotaMetrics/*/limits/*}/consumerOverrides"
};
}
// Creates or updates multiple consumer overrides atomically, all on the
// same consumer, but on many different metrics or limits.
// The name field in the quota override message should not be set.
rpc ImportConsumerOverrides(ImportConsumerOverridesRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1beta1/{parent=*/*/services/*}/consumerQuotaMetrics:importConsumerOverrides"
body: "*"
};
option (google.longrunning.operation_info) = {
response_type: "ImportConsumerOverridesResponse"
metadata_type: "ImportConsumerOverridesMetadata"
};
}
// Generates service identity for service.
rpc GenerateServiceIdentity(GenerateServiceIdentityRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1beta1/{parent=*/*/services/*}:generateServiceIdentity"
};
option (google.longrunning.operation_info) = {
response_type: "ServiceIdentity"
metadata_type: "google.protobuf.Empty"
};
}
}
// Request message for the `EnableService` method.
message EnableServiceRequest {
// Name of the consumer and service to enable the service on.
//
// The `EnableService` and `DisableService` methods currently only support
// projects.
//
// Enabling a service requires that the service is public or is shared with
// the user enabling the service.
//
// An example name would be:
// `projects/123/services/serviceusage.googleapis.com`
// where `123` is the project number (not project ID).
string name = 1;
}
// Request message for the `DisableService` method.
message DisableServiceRequest {
// Name of the consumer and service to disable the service on.
//
// The enable and disable methods currently only support projects.
//
// An example name would be:
// `projects/123/services/serviceusage.googleapis.com`
// where `123` is the project number (not project ID).
string name = 1;
}
// Request message for the `GetService` method.
message GetServiceRequest {
// Name of the consumer and service to get the `ConsumerState` for.
//
// An example name would be:
// `projects/123/services/serviceusage.googleapis.com`
// where `123` is the project number (not project ID).
string name = 1;
}
// Request message for the `ListServices` method.
message ListServicesRequest {
// Parent to search for services on.
//
// An example name would be:
// `projects/123`
// where `123` is the project number (not project ID).
string parent = 1;
// Requested size of the next page of data.
// Requested page size cannot exceed 200.
// If not set, the default page size is 50.
int32 page_size = 2;
// Token identifying which result to start with, which is returned by a
// previous list call.
string page_token = 3;
// Only list services that conform to the given filter.
// The allowed filter strings are `state:ENABLED` and `state:DISABLED`.
string filter = 4;
}
// Response message for the `ListServices` method.
message ListServicesResponse {
// The available services for the requested project.
repeated Service services = 1;
// Token that can be passed to `ListServices` to resume a paginated
// query.
string next_page_token = 2;
}
// Request message for the `BatchEnableServices` method.
message BatchEnableServicesRequest {
// Parent to enable services on.
//
// An example name would be:
// `projects/123`
// where `123` is the project number (not project ID).
//
// The `BatchEnableServices` method currently only supports projects.
string parent = 1;
// The identifiers of the services to enable on the project.
//
// A valid identifier would be:
// serviceusage.googleapis.com
//
// Enabling services requires that each service is public or is shared with
// the user enabling the service.
//
// Two or more services must be specified. To enable a single service,
// use the `EnableService` method instead.
//
// A single request can enable a maximum of 20 services at a time. If more
// than 20 services are specified, the request will fail, and no state changes
// will occur.
repeated string service_ids = 2;
}
// Request message for ListConsumerQuotaMetrics
message ListConsumerQuotaMetricsRequest {
// Parent of the quotas resource.
//
// Some example names would be:
// `projects/123/services/serviceconsumermanagement.googleapis.com`
// `folders/345/services/serviceconsumermanagement.googleapis.com`
// `organizations/456/services/serviceconsumermanagement.googleapis.com`
string parent = 1;
// Requested size of the next page of data.
int32 page_size = 2;
// Token identifying which result to start with; returned by a previous list
// call.
string page_token = 3;
// Specifies the level of detail for quota information in the response.
QuotaView view = 4;
}
// Response message for ListConsumerQuotaMetrics
message ListConsumerQuotaMetricsResponse {
// Quota settings for the consumer, organized by quota metric.
repeated ConsumerQuotaMetric metrics = 1;
// Token identifying which result to start with; returned by a previous list
// call.
string next_page_token = 2;
}
// Request message for GetConsumerQuotaMetric
message GetConsumerQuotaMetricRequest {
// The resource name of the quota limit.
//
// An example name would be:
// `projects/123/services/serviceusage.googleapis.com/quotas/metrics/serviceusage.googleapis.com%2Fmutate_requests`
string name = 1;
// Specifies the level of detail for quota information in the response.
QuotaView view = 2;
}
// Request message for GetConsumerQuotaLimit
message GetConsumerQuotaLimitRequest {
// The resource name of the quota limit.
//
// Use the quota limit resource name returned by previous
// ListConsumerQuotaMetrics and GetConsumerQuotaMetric API calls.
string name = 1;
// Specifies the level of detail for quota information in the response.
QuotaView view = 2;
}
// Request message for CreateAdminOverride.
message CreateAdminOverrideRequest {
// The resource name of the parent quota limit, returned by a
// ListConsumerQuotaMetrics or GetConsumerQuotaMetric call.
//
// An example name would be:
// `projects/123/services/compute.googleapis.com/consumerQuotaMetrics/compute.googleapis.com%2Fcpus/limits/%2Fproject%2Fregion`
string parent = 1;
// The admin override to create.
QuotaOverride override = 2;
// Whether to force the creation of the quota override.
// Setting the force parameter to 'true' ignores all quota safety checks that
// would fail the request. QuotaSafetyCheck lists all such validations.
bool force = 3;
// The list of quota safety checks to ignore before the override mutation.
// Unlike 'force' field that ignores all the quota safety checks, the
// 'force_only' field ignores only the specified checks; other checks are
// still enforced. The 'force' and 'force_only' fields cannot both be set.
repeated QuotaSafetyCheck force_only = 4;
}
// Request message for UpdateAdminOverride.
message UpdateAdminOverrideRequest {
// The resource name of the override to update.
//
// An example name would be:
// `projects/123/services/compute.googleapis.com/consumerQuotaMetrics/compute.googleapis.com%2Fcpus/limits/%2Fproject%2Fregion/adminOverrides/4a3f2c1d`
string name = 1;
// The new override.
// Only the override_value is updated; all other fields are ignored.
QuotaOverride override = 2;
// Whether to force the update of the quota override.
// Setting the force parameter to 'true' ignores all quota safety checks that
// would fail the request. QuotaSafetyCheck lists all such validations.
bool force = 3;
// Update only the specified fields of the override.
// If unset, all fields will be updated.
google.protobuf.FieldMask update_mask = 4;
// The list of quota safety checks to ignore before the override mutation.
// Unlike 'force' field that ignores all the quota safety checks, the
// 'force_only' field ignores only the specified checks; other checks are
// still enforced. The 'force' and 'force_only' fields cannot both be set.
repeated QuotaSafetyCheck force_only = 5;
}
// Request message for DeleteAdminOverride.
message DeleteAdminOverrideRequest {
// The resource name of the override to delete.
//
// An example name would be:
// `projects/123/services/compute.googleapis.com/consumerQuotaMetrics/compute.googleapis.com%2Fcpus/limits/%2Fproject%2Fregion/adminOverrides/4a3f2c1d`
string name = 1;
// Whether to force the deletion of the quota override.
// Setting the force parameter to 'true' ignores all quota safety checks that
// would fail the request. QuotaSafetyCheck lists all such validations.
bool force = 2;
// The list of quota safety checks to ignore before the override mutation.
// Unlike 'force' field that ignores all the quota safety checks, the
// 'force_only' field ignores only the specified checks; other checks are
// still enforced. The 'force' and 'force_only' fields cannot both be set.
repeated QuotaSafetyCheck force_only = 3;
}
// Request message for ListAdminOverrides
message ListAdminOverridesRequest {
// The resource name of the parent quota limit, returned by a
// ListConsumerQuotaMetrics or GetConsumerQuotaMetric call.
//
// An example name would be:
// `projects/123/services/compute.googleapis.com/consumerQuotaMetrics/compute.googleapis.com%2Fcpus/limits/%2Fproject%2Fregion`
string parent = 1;
// Requested size of the next page of data.
int32 page_size = 2;
// Token identifying which result to start with; returned by a previous list
// call.
string page_token = 3;
}
// Response message for ListAdminOverrides.
message ListAdminOverridesResponse {
// Admin overrides on this limit.
repeated QuotaOverride overrides = 1;
// Token identifying which result to start with; returned by a previous list
// call.
string next_page_token = 2;
}
// Response message for BatchCreateAdminOverrides
message BatchCreateAdminOverridesResponse {
// The overrides that were created.
repeated QuotaOverride overrides = 1;
}
// Request message for ImportAdminOverrides
message ImportAdminOverridesRequest {
// The resource name of the consumer.
//
// An example name would be:
// `projects/123/services/compute.googleapis.com`
string parent = 1;
// Source of import data
oneof source {
// The import data is specified in the request message itself
OverrideInlineSource inline_source = 2;
}
// Whether to force the creation of the quota overrides.
// Setting the force parameter to 'true' ignores all quota safety checks that
// would fail the request. QuotaSafetyCheck lists all such validations.
bool force = 3;
// The list of quota safety checks to ignore before the override mutation.
// Unlike 'force' field that ignores all the quota safety checks, the
// 'force_only' field ignores only the specified checks; other checks are
// still enforced. The 'force' and 'force_only' fields cannot both be set.
repeated QuotaSafetyCheck force_only = 4;
}
// Response message for ImportAdminOverrides
message ImportAdminOverridesResponse {
// The overrides that were created from the imported data.
repeated QuotaOverride overrides = 1;
}
// Metadata message that provides information such as progress,
// partial failures, and similar information on each GetOperation call
// of LRO returned by ImportAdminOverrides.
message ImportAdminOverridesMetadata {}
// Request message for CreateConsumerOverride.
message CreateConsumerOverrideRequest {
// The resource name of the parent quota limit, returned by a
// ListConsumerQuotaMetrics or GetConsumerQuotaMetric call.
//
// An example name would be:
// `projects/123/services/compute.googleapis.com/consumerQuotaMetrics/compute.googleapis.com%2Fcpus/limits/%2Fproject%2Fregion`
string parent = 1;
// The override to create.
QuotaOverride override = 2;
// Whether to force the creation of the quota override.
// Setting the force parameter to 'true' ignores all quota safety checks that
// would fail the request. QuotaSafetyCheck lists all such validations.
bool force = 3;
// The list of quota safety checks to ignore before the override mutation.
// Unlike 'force' field that ignores all the quota safety checks, the
// 'force_only' field ignores only the specified checks; other checks are
// still enforced. The 'force' and 'force_only' fields cannot both be set.
repeated QuotaSafetyCheck force_only = 4;
}
// Request message for UpdateConsumerOverride.
message UpdateConsumerOverrideRequest {
// The resource name of the override to update.
//
// An example name would be:
// `projects/123/services/compute.googleapis.com/consumerQuotaMetrics/compute.googleapis.com%2Fcpus/limits/%2Fproject%2Fregion/consumerOverrides/4a3f2c1d`
string name = 1;
// The new override.
// Only the override_value is updated; all other fields are ignored.
QuotaOverride override = 2;
// Whether to force the update of the quota override.
// Setting the force parameter to 'true' ignores all quota safety checks that
// would fail the request. QuotaSafetyCheck lists all such validations.
bool force = 3;
// Update only the specified fields of the override.
// If unset, all fields will be updated.
google.protobuf.FieldMask update_mask = 4;
// The list of quota safety checks to ignore before the override mutation.
// Unlike 'force' field that ignores all the quota safety checks, the
// 'force_only' field ignores only the specified checks; other checks are
// still enforced. The 'force' and 'force_only' fields cannot both be set.
repeated QuotaSafetyCheck force_only = 5;
}
// Request message for DeleteConsumerOverride.
message DeleteConsumerOverrideRequest {
// The resource name of the override to delete.
//
// An example name would be:
// `projects/123/services/compute.googleapis.com/consumerQuotaMetrics/compute.googleapis.com%2Fcpus/limits/%2Fproject%2Fregion/consumerOverrides/4a3f2c1d`
string name = 1;
// Whether to force the deletion of the quota override.
// Setting the force parameter to 'true' ignores all quota safety checks that
// would fail the request. QuotaSafetyCheck lists all such validations.
bool force = 2;
// The list of quota safety checks to ignore before the override mutation.
// Unlike 'force' field that ignores all the quota safety checks, the
// 'force_only' field ignores only the specified checks; other checks are
// still enforced. The 'force' and 'force_only' fields cannot both be set.
repeated QuotaSafetyCheck force_only = 3;
}
// Request message for ListConsumerOverrides
message ListConsumerOverridesRequest {
// The resource name of the parent quota limit, returned by a
// ListConsumerQuotaMetrics or GetConsumerQuotaMetric call.
//
// An example name would be:
// `projects/123/services/compute.googleapis.com/consumerQuotaMetrics/compute.googleapis.com%2Fcpus/limits/%2Fproject%2Fregion`
string parent = 1;
// Requested size of the next page of data.
int32 page_size = 2;
// Token identifying which result to start with; returned by a previous list
// call.
string page_token = 3;
}
// Response message for ListConsumerOverrides.
message ListConsumerOverridesResponse {
// Consumer overrides on this limit.
repeated QuotaOverride overrides = 1;
// Token identifying which result to start with; returned by a previous list
// call.
string next_page_token = 2;
}
// Response message for BatchCreateConsumerOverrides
message BatchCreateConsumerOverridesResponse {
// The overrides that were created.
repeated QuotaOverride overrides = 1;
}
// Request message for ImportConsumerOverrides
message ImportConsumerOverridesRequest {
// The resource name of the consumer.
//
// An example name would be:
// `projects/123/services/compute.googleapis.com`
string parent = 1;
// Source of import data
oneof source {
// The import data is specified in the request message itself
OverrideInlineSource inline_source = 2;
}
// Whether to force the creation of the quota overrides.
// Setting the force parameter to 'true' ignores all quota safety checks that
// would fail the request. QuotaSafetyCheck lists all such validations.
bool force = 3;
// The list of quota safety checks to ignore before the override mutation.
// Unlike 'force' field that ignores all the quota safety checks, the
// 'force_only' field ignores only the specified checks; other checks are
// still enforced. The 'force' and 'force_only' fields cannot both be set.
repeated QuotaSafetyCheck force_only = 4;
}
// Response message for ImportConsumerOverrides
message ImportConsumerOverridesResponse {
// The overrides that were created from the imported data.
repeated QuotaOverride overrides = 1;
}
// Metadata message that provides information such as progress,
// partial failures, and similar information on each GetOperation call
// of LRO returned by ImportConsumerOverrides.
message ImportConsumerOverridesMetadata {}
// Response message for ImportAdminQuotaPolicies
message ImportAdminQuotaPoliciesResponse {
// The policies that were created from the imported data.
repeated AdminQuotaPolicy policies = 1;
}
// Metadata message that provides information such as progress,
// partial failures, and similar information on each GetOperation call
// of LRO returned by ImportAdminQuotaPolicies.
message ImportAdminQuotaPoliciesMetadata {}
// Metadata message that provides information such as progress,
// partial failures, and similar information on each GetOperation call
// of LRO returned by CreateAdminQuotaPolicy.
message CreateAdminQuotaPolicyMetadata {}
// Metadata message that provides information such as progress,
// partial failures, and similar information on each GetOperation call
// of LRO returned by UpdateAdminQuotaPolicy.
message UpdateAdminQuotaPolicyMetadata {}
// Metadata message that provides information such as progress,
// partial failures, and similar information on each GetOperation call
// of LRO returned by DeleteAdminQuotaPolicy.
message DeleteAdminQuotaPolicyMetadata {}
// Request message for generating service identity.
message GenerateServiceIdentityRequest {
// Name of the consumer and service to generate an identity for.
//
// The `GenerateServiceIdentity` methods currently support projects, folders,
// organizations.
//
// Example parents would be:
// `projects/123/services/example.googleapis.com`
// `folders/123/services/example.googleapis.com`
// `organizations/123/services/example.googleapis.com`
string parent = 1;
}
// Response message for getting service identity.
message GetServiceIdentityResponse {
// Enum for service identity state.
enum IdentityState {
// Default service identity state. This value is used if the state is
// omitted.
IDENTITY_STATE_UNSPECIFIED = 0;
// Service identity has been created and can be used.
ACTIVE = 1;
}
// Service identity that service producer can use to access consumer
// resources. If exists is true, it contains email and unique_id. If exists is
// false, it contains pre-constructed email and empty unique_id.
ServiceIdentity identity = 1;
// Service identity state.
IdentityState state = 2;
}
// Metadata for the `GetServiceIdentity` method.
message GetServiceIdentityMetadata {}

View File

@@ -0,0 +1,31 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
import "google/protobuf/any.proto";
option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
option java_multiple_files = true;
option java_outer_classname = "SourceInfoProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// Source information used to create a Service Config
message SourceInfo {
// All files used during config generation.
repeated google.protobuf.Any source_files = 1;
}

View File

@@ -0,0 +1,96 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
option java_multiple_files = true;
option java_outer_classname = "SystemParameterProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// ### System parameter configuration
//
// A system parameter is a special kind of parameter defined by the API
// system, not by an individual API. It is typically mapped to an HTTP header
// and/or a URL query parameter. This configuration specifies which methods
// change the names of the system parameters.
message SystemParameters {
// Define system parameters.
//
// The parameters defined here will override the default parameters
// implemented by the system. If this field is missing from the service
// config, default system parameters will be used. Default system parameters
// and names is implementation-dependent.
//
// Example: define api key for all methods
//
// system_parameters
// rules:
// - selector: "*"
// parameters:
// - name: api_key
// url_query_parameter: api_key
//
//
// Example: define 2 api key names for a specific method.
//
// system_parameters
// rules:
// - selector: "/ListShelves"
// parameters:
// - name: api_key
// http_header: Api-Key1
// - name: api_key
// http_header: Api-Key2
//
// **NOTE:** All service configuration rules follow "last one wins" order.
repeated SystemParameterRule rules = 1;
}
// Define a system parameter rule mapping system parameter definitions to
// methods.
message SystemParameterRule {
// Selects the methods to which this rule applies. Use '*' to indicate all
// methods in all APIs.
//
// Refer to [selector][google.api.DocumentationRule.selector] for syntax
// details.
string selector = 1;
// Define parameters. Multiple names may be defined for a parameter.
// For a given method call, only one of them should be used. If multiple
// names are used the behavior is implementation-dependent.
// If none of the specified names are present the behavior is
// parameter-dependent.
repeated SystemParameter parameters = 2;
}
// Define a parameter's name and location. The parameter may be passed as either
// an HTTP header or a URL query parameter, and if both are passed the behavior
// is implementation-dependent.
message SystemParameter {
// Define the name of the parameter, such as "api_key" . It is case sensitive.
string name = 1;
// Define the HTTP header name to use for the parameter. It is case
// insensitive.
string http_header = 2;
// Define the URL query parameter name to use for the parameter. It is case
// sensitive.
string url_query_parameter = 3;
}

View File

@@ -0,0 +1,96 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
option java_multiple_files = true;
option java_outer_classname = "UsageProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// Configuration controlling usage of a service.
message Usage {
// Requirements that must be satisfied before a consumer project can use the
// service. Each requirement is of the form <service.name>/<requirement-id>;
// for example 'serviceusage.googleapis.com/billing-enabled'.
//
// For Google APIs, a Terms of Service requirement must be included here.
// Google Cloud APIs must include "serviceusage.googleapis.com/tos/cloud".
// Other Google APIs should include
// "serviceusage.googleapis.com/tos/universal". Additional ToS can be
// included based on the business needs.
repeated string requirements = 1;
// A list of usage rules that apply to individual API methods.
//
// **NOTE:** All service configuration rules follow "last one wins" order.
repeated UsageRule rules = 6;
// The full resource name of a channel used for sending notifications to the
// service producer.
//
// Google Service Management currently only supports
// [Google Cloud Pub/Sub](https://cloud.google.com/pubsub) as a notification
// channel. To use Google Cloud Pub/Sub as the channel, this must be the name
// of a Cloud Pub/Sub topic that uses the Cloud Pub/Sub topic name format
// documented in https://cloud.google.com/pubsub/docs/overview.
string producer_notification_channel = 7;
}
// Usage configuration rules for the service.
//
// NOTE: Under development.
//
//
// Use this rule to configure unregistered calls for the service. Unregistered
// calls are calls that do not contain consumer project identity.
// (Example: calls that do not contain an API key).
// By default, API methods do not allow unregistered calls, and each method call
// must be identified by a consumer project identity. Use this rule to
// allow/disallow unregistered calls.
//
// Example of an API that wants to allow unregistered calls for entire service.
//
// usage:
// rules:
// - selector: "*"
// allow_unregistered_calls: true
//
// Example of a method that wants to allow unregistered calls.
//
// usage:
// rules:
// - selector: "google.example.library.v1.LibraryService.CreateBook"
// allow_unregistered_calls: true
message UsageRule {
// Selects the methods to which this rule applies. Use '*' to indicate all
// methods in all APIs.
//
// Refer to [selector][google.api.DocumentationRule.selector] for syntax
// details.
string selector = 1;
// If true, the selected method allows unregistered calls, e.g. calls
// that don't identify any user or application.
bool allow_unregistered_calls = 2;
// If true, the selected method should skip service control and the control
// plane features, such as quota and billing, will not be available.
// This flag is used by Google Cloud Endpoints to bypass checks for internal
// methods, such as service health check methods.
bool skip_service_control = 3;
}

View File

@@ -0,0 +1,113 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
import "google/protobuf/descriptor.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/visibility;visibility";
option java_multiple_files = true;
option java_outer_classname = "VisibilityProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
extend google.protobuf.EnumOptions {
// See `VisibilityRule`.
google.api.VisibilityRule enum_visibility = 72295727;
}
extend google.protobuf.EnumValueOptions {
// See `VisibilityRule`.
google.api.VisibilityRule value_visibility = 72295727;
}
extend google.protobuf.FieldOptions {
// See `VisibilityRule`.
google.api.VisibilityRule field_visibility = 72295727;
}
extend google.protobuf.MessageOptions {
// See `VisibilityRule`.
google.api.VisibilityRule message_visibility = 72295727;
}
extend google.protobuf.MethodOptions {
// See `VisibilityRule`.
google.api.VisibilityRule method_visibility = 72295727;
}
extend google.protobuf.ServiceOptions {
// See `VisibilityRule`.
google.api.VisibilityRule api_visibility = 72295727;
}
// `Visibility` restricts service consumer's access to service elements,
// such as whether an application can call a visibility-restricted method.
// The restriction is expressed by applying visibility labels on service
// elements. The visibility labels are elsewhere linked to service consumers.
//
// A service can define multiple visibility labels, but a service consumer
// should be granted at most one visibility label. Multiple visibility
// labels for a single service consumer are not supported.
//
// If an element and all its parents have no visibility label, its visibility
// is unconditionally granted.
//
// Example:
//
// visibility:
// rules:
// - selector: google.calendar.Calendar.EnhancedSearch
// restriction: PREVIEW
// - selector: google.calendar.Calendar.Delegate
// restriction: INTERNAL
//
// Here, all methods are publicly visible except for the restricted methods
// EnhancedSearch and Delegate.
message Visibility {
// A list of visibility rules that apply to individual API elements.
//
// **NOTE:** All service configuration rules follow "last one wins" order.
repeated VisibilityRule rules = 1;
}
// A visibility rule provides visibility configuration for an individual API
// element.
message VisibilityRule {
// Selects methods, messages, fields, enums, etc. to which this rule applies.
//
// Refer to [selector][google.api.DocumentationRule.selector] for syntax
// details.
string selector = 1;
// A comma-separated list of visibility labels that apply to the `selector`.
// Any of the listed labels can be used to grant the visibility.
//
// If a rule has multiple labels, removing one of the labels but not all of
// them can break clients.
//
// Example:
//
// visibility:
// rules:
// - selector: google.calendar.Calendar.EnhancedSearch
// restriction: INTERNAL, PREVIEW
//
// Removing INTERNAL from this restriction will break clients that rely on
// this method and only had access to it through INTERNAL.
string restriction = 2;
}

View File

@@ -0,0 +1,108 @@
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.cloud.location;
import "google/api/annotations.proto";
import "google/protobuf/any.proto";
import "google/api/client.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/cloud/location;location";
option java_multiple_files = true;
option java_outer_classname = "LocationsProto";
option java_package = "com.google.cloud.location";
// An abstract interface that provides location-related information for
// a service. Service-specific metadata is provided through the
// [Location.metadata][google.cloud.location.Location.metadata] field.
service Locations {
option (google.api.default_host) = "cloud.googleapis.com";
option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
// Lists information about the supported locations for this service.
rpc ListLocations(ListLocationsRequest) returns (ListLocationsResponse) {
option (google.api.http) = {
get: "/v1/{name=locations}"
additional_bindings {
get: "/v1/{name=projects/*}/locations"
}
};
}
// Gets information about a location.
rpc GetLocation(GetLocationRequest) returns (Location) {
option (google.api.http) = {
get: "/v1/{name=locations/*}"
additional_bindings {
get: "/v1/{name=projects/*/locations/*}"
}
};
}
}
// The request message for [Locations.ListLocations][google.cloud.location.Locations.ListLocations].
message ListLocationsRequest {
// The resource that owns the locations collection, if applicable.
string name = 1;
// The standard list filter.
string filter = 2;
// The standard list page size.
int32 page_size = 3;
// The standard list page token.
string page_token = 4;
}
// The response message for [Locations.ListLocations][google.cloud.location.Locations.ListLocations].
message ListLocationsResponse {
// A list of locations that matches the specified filter in the request.
repeated Location locations = 1;
// The standard List next-page token.
string next_page_token = 2;
}
// The request message for [Locations.GetLocation][google.cloud.location.Locations.GetLocation].
message GetLocationRequest {
// Resource name for the location.
string name = 1;
}
// A resource that represents Google Cloud Platform location.
message Location {
// Resource name for the location, which may vary between implementations.
// For example: `"projects/example-project/locations/us-east1"`
string name = 1;
// The canonical id for this location. For example: `"us-east1"`.
string location_id = 4;
// The friendly name for this location, typically a nearby city name.
// For example, "Tokyo".
string display_name = 5;
// Cross-service attributes for the location. For example
//
// {"cloud.googleapis.com/region": "us-east1"}
map<string, string> labels = 2;
// Service-specific metadata. For example the available capacity at the given
// location.
google.protobuf.Any metadata = 3;
}

View File

@@ -0,0 +1,155 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.iam.v1;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/iam/v1/options.proto";
import "google/iam/v1/policy.proto";
import "google/protobuf/field_mask.proto";
option cc_enable_arenas = true;
option csharp_namespace = "Google.Cloud.Iam.V1";
option go_package = "cloud.google.com/go/iam/apiv1/iampb;iampb";
option java_multiple_files = true;
option java_outer_classname = "IamPolicyProto";
option java_package = "com.google.iam.v1";
option php_namespace = "Google\\Cloud\\Iam\\V1";
// API Overview
//
//
// Manages Identity and Access Management (IAM) policies.
//
// Any implementation of an API that offers access control features
// implements the google.iam.v1.IAMPolicy interface.
//
// ## Data model
//
// Access control is applied when a principal (user or service account), takes
// some action on a resource exposed by a service. Resources, identified by
// URI-like names, are the unit of access control specification. Service
// implementations can choose the granularity of access control and the
// supported permissions for their resources.
// For example one database service may allow access control to be
// specified only at the Table level, whereas another might allow access control
// to also be specified at the Column level.
//
// ## Policy Structure
//
// See google.iam.v1.Policy
//
// This is intentionally not a CRUD style API because access control policies
// are created and deleted implicitly with the resources to which they are
// attached.
service IAMPolicy {
option (google.api.default_host) = "iam-meta-api.googleapis.com";
// Sets the access control policy on the specified resource. Replaces any
// existing policy.
//
// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
rpc SetIamPolicy(SetIamPolicyRequest) returns (Policy) {
option (google.api.http) = {
post: "/v1/{resource=**}:setIamPolicy"
body: "*"
};
}
// Gets the access control policy for a resource.
// Returns an empty policy if the resource exists and does not have a policy
// set.
rpc GetIamPolicy(GetIamPolicyRequest) returns (Policy) {
option (google.api.http) = {
post: "/v1/{resource=**}:getIamPolicy"
body: "*"
};
}
// Returns permissions that a caller has on the specified resource.
// If the resource does not exist, this will return an empty set of
// permissions, not a `NOT_FOUND` error.
//
// Note: This operation is designed to be used for building permission-aware
// UIs and command-line tools, not for authorization checking. This operation
// may "fail open" without warning.
rpc TestIamPermissions(TestIamPermissionsRequest) returns (TestIamPermissionsResponse) {
option (google.api.http) = {
post: "/v1/{resource=**}:testIamPermissions"
body: "*"
};
}
}
// Request message for `SetIamPolicy` method.
message SetIamPolicyRequest {
// REQUIRED: The resource for which the policy is being specified.
// See the operation documentation for the appropriate value for this field.
string resource = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference).type = "*"];
// REQUIRED: The complete policy to be applied to the `resource`. The size of
// the policy is limited to a few 10s of KB. An empty policy is a
// valid policy but certain Cloud Platform services (such as Projects)
// might reject them.
Policy policy = 2 [(google.api.field_behavior) = REQUIRED];
// OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only
// the fields in the mask will be modified. If no mask is provided, the
// following default mask is used:
//
// `paths: "bindings, etag"`
google.protobuf.FieldMask update_mask = 3;
}
// Request message for `GetIamPolicy` method.
message GetIamPolicyRequest {
// REQUIRED: The resource for which the policy is being requested.
// See the operation documentation for the appropriate value for this field.
string resource = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference).type = "*"];
// OPTIONAL: A `GetPolicyOptions` object for specifying options to
// `GetIamPolicy`.
GetPolicyOptions options = 2;
}
// Request message for `TestIamPermissions` method.
message TestIamPermissionsRequest {
// REQUIRED: The resource for which the policy detail is being requested.
// See the operation documentation for the appropriate value for this field.
string resource = 1[
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference).type = "*"];
// The set of permissions to check for the `resource`. Permissions with
// wildcards (such as '*' or 'storage.*') are not allowed. For more
// information see
// [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
repeated string permissions = 2 [(google.api.field_behavior) = REQUIRED];
}
// Response message for `TestIamPermissions` method.
message TestIamPermissionsResponse {
// A subset of `TestPermissionsRequest.permissions` that the caller is
// allowed.
repeated string permissions = 1;
}

View File

@@ -0,0 +1,33 @@
// Copyright 2017 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.iam.v1.logging;
import "google/iam/v1/policy.proto";
option csharp_namespace = "Google.Cloud.Iam.V1.Logging";
option go_package = "cloud.google.com/go/iam/apiv1/logging/loggingpb;loggingpb";
option java_multiple_files = true;
option java_outer_classname = "AuditDataProto";
option java_package = "com.google.iam.v1.logging";
// Audit log information specific to Cloud IAM. This message is serialized
// as an `Any` type in the `ServiceData` message of an
// `AuditLog` message.
message AuditData {
// Policy delta between the original policy and the newly set policy.
google.iam.v1.PolicyDelta policy_delta = 2;
}

View File

@@ -0,0 +1,48 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.iam.v1;
option cc_enable_arenas = true;
option csharp_namespace = "Google.Cloud.Iam.V1";
option go_package = "cloud.google.com/go/iam/apiv1/iampb;iampb";
option java_multiple_files = true;
option java_outer_classname = "OptionsProto";
option java_package = "com.google.iam.v1";
option php_namespace = "Google\\Cloud\\Iam\\V1";
// Encapsulates settings provided to GetIamPolicy.
message GetPolicyOptions {
// Optional. The maximum policy version that will be used to format the
// policy.
//
// Valid values are 0, 1, and 3. Requests specifying an invalid value will be
// rejected.
//
// Requests for policies with any conditional role bindings must specify
// version 3. Policies with no conditional role bindings may specify any valid
// value or leave the field unset.
//
// The policy in the response might use the policy version that you specified,
// or it might use a lower policy version. For example, if you specify version
// 3, but the policy has no conditional role bindings, the response uses
// version 1.
//
// To learn which resources support conditions in their IAM policies, see the
// [IAM
// documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
int32 requested_policy_version = 1;
}

View File

@@ -0,0 +1,410 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.iam.v1;
import "google/type/expr.proto";
option cc_enable_arenas = true;
option csharp_namespace = "Google.Cloud.Iam.V1";
option go_package = "cloud.google.com/go/iam/apiv1/iampb;iampb";
option java_multiple_files = true;
option java_outer_classname = "PolicyProto";
option java_package = "com.google.iam.v1";
option php_namespace = "Google\\Cloud\\Iam\\V1";
// An Identity and Access Management (IAM) policy, which specifies access
// controls for Google Cloud resources.
//
//
// A `Policy` is a collection of `bindings`. A `binding` binds one or more
// `members`, or principals, to a single `role`. Principals can be user
// accounts, service accounts, Google groups, and domains (such as G Suite). A
// `role` is a named list of permissions; each `role` can be an IAM predefined
// role or a user-created custom role.
//
// For some types of Google Cloud resources, a `binding` can also specify a
// `condition`, which is a logical expression that allows access to a resource
// only if the expression evaluates to `true`. A condition can add constraints
// based on attributes of the request, the resource, or both. To learn which
// resources support conditions in their IAM policies, see the
// [IAM
// documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
//
// **JSON example:**
//
// ```
// {
// "bindings": [
// {
// "role": "roles/resourcemanager.organizationAdmin",
// "members": [
// "user:mike@example.com",
// "group:admins@example.com",
// "domain:google.com",
// "serviceAccount:my-project-id@appspot.gserviceaccount.com"
// ]
// },
// {
// "role": "roles/resourcemanager.organizationViewer",
// "members": [
// "user:eve@example.com"
// ],
// "condition": {
// "title": "expirable access",
// "description": "Does not grant access after Sep 2020",
// "expression": "request.time <
// timestamp('2020-10-01T00:00:00.000Z')",
// }
// }
// ],
// "etag": "BwWWja0YfJA=",
// "version": 3
// }
// ```
//
// **YAML example:**
//
// ```
// bindings:
// - members:
// - user:mike@example.com
// - group:admins@example.com
// - domain:google.com
// - serviceAccount:my-project-id@appspot.gserviceaccount.com
// role: roles/resourcemanager.organizationAdmin
// - members:
// - user:eve@example.com
// role: roles/resourcemanager.organizationViewer
// condition:
// title: expirable access
// description: Does not grant access after Sep 2020
// expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
// etag: BwWWja0YfJA=
// version: 3
// ```
//
// For a description of IAM and its features, see the
// [IAM documentation](https://cloud.google.com/iam/docs/).
message Policy {
// Specifies the format of the policy.
//
// Valid values are `0`, `1`, and `3`. Requests that specify an invalid value
// are rejected.
//
// Any operation that affects conditional role bindings must specify version
// `3`. This requirement applies to the following operations:
//
// * Getting a policy that includes a conditional role binding
// * Adding a conditional role binding to a policy
// * Changing a conditional role binding in a policy
// * Removing any role binding, with or without a condition, from a policy
// that includes conditions
//
// **Important:** If you use IAM Conditions, you must include the `etag` field
// whenever you call `setIamPolicy`. If you omit this field, then IAM allows
// you to overwrite a version `3` policy with a version `1` policy, and all of
// the conditions in the version `3` policy are lost.
//
// If a policy does not include any conditions, operations on that policy may
// specify any valid version or leave the field unset.
//
// To learn which resources support conditions in their IAM policies, see the
// [IAM
// documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
int32 version = 1;
// Associates a list of `members`, or principals, with a `role`. Optionally,
// may specify a `condition` that determines how and when the `bindings` are
// applied. Each of the `bindings` must contain at least one principal.
//
// The `bindings` in a `Policy` can refer to up to 1,500 principals; up to 250
// of these principals can be Google groups. Each occurrence of a principal
// counts towards these limits. For example, if the `bindings` grant 50
// different roles to `user:alice@example.com`, and not to any other
// principal, then you can add another 1,450 principals to the `bindings` in
// the `Policy`.
repeated Binding bindings = 4;
// Specifies cloud audit logging configuration for this policy.
repeated AuditConfig audit_configs = 6;
// `etag` is used for optimistic concurrency control as a way to help
// prevent simultaneous updates of a policy from overwriting each other.
// It is strongly suggested that systems make use of the `etag` in the
// read-modify-write cycle to perform policy updates in order to avoid race
// conditions: An `etag` is returned in the response to `getIamPolicy`, and
// systems are expected to put that etag in the request to `setIamPolicy` to
// ensure that their change will be applied to the same version of the policy.
//
// **Important:** If you use IAM Conditions, you must include the `etag` field
// whenever you call `setIamPolicy`. If you omit this field, then IAM allows
// you to overwrite a version `3` policy with a version `1` policy, and all of
// the conditions in the version `3` policy are lost.
bytes etag = 3;
}
// Associates `members`, or principals, with a `role`.
message Binding {
// Role that is assigned to the list of `members`, or principals.
// For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
string role = 1;
// Specifies the principals requesting access for a Google Cloud resource.
// `members` can have the following values:
//
// * `allUsers`: A special identifier that represents anyone who is
// on the internet; with or without a Google account.
//
// * `allAuthenticatedUsers`: A special identifier that represents anyone
// who is authenticated with a Google account or a service account.
//
// * `user:{emailid}`: An email address that represents a specific Google
// account. For example, `alice@example.com` .
//
//
// * `serviceAccount:{emailid}`: An email address that represents a service
// account. For example, `my-other-app@appspot.gserviceaccount.com`.
//
// * `group:{emailid}`: An email address that represents a Google group.
// For example, `admins@example.com`.
//
// * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique
// identifier) representing a user that has been recently deleted. For
// example, `alice@example.com?uid=123456789012345678901`. If the user is
// recovered, this value reverts to `user:{emailid}` and the recovered user
// retains the role in the binding.
//
// * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus
// unique identifier) representing a service account that has been recently
// deleted. For example,
// `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`.
// If the service account is undeleted, this value reverts to
// `serviceAccount:{emailid}` and the undeleted service account retains the
// role in the binding.
//
// * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique
// identifier) representing a Google group that has been recently
// deleted. For example, `admins@example.com?uid=123456789012345678901`. If
// the group is recovered, this value reverts to `group:{emailid}` and the
// recovered group retains the role in the binding.
//
//
// * `domain:{domain}`: The G Suite domain (primary) that represents all the
// users of that domain. For example, `google.com` or `example.com`.
//
//
repeated string members = 2;
// The condition that is associated with this binding.
//
// If the condition evaluates to `true`, then this binding applies to the
// current request.
//
// If the condition evaluates to `false`, then this binding does not apply to
// the current request. However, a different role binding might grant the same
// role to one or more of the principals in this binding.
//
// To learn which resources support conditions in their IAM policies, see the
// [IAM
// documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
google.type.Expr condition = 3;
}
// Specifies the audit configuration for a service.
// The configuration determines which permission types are logged, and what
// identities, if any, are exempted from logging.
// An AuditConfig must have one or more AuditLogConfigs.
//
// If there are AuditConfigs for both `allServices` and a specific service,
// the union of the two AuditConfigs is used for that service: the log_types
// specified in each AuditConfig are enabled, and the exempted_members in each
// AuditLogConfig are exempted.
//
// Example Policy with multiple AuditConfigs:
//
// {
// "audit_configs": [
// {
// "service": "allServices",
// "audit_log_configs": [
// {
// "log_type": "DATA_READ",
// "exempted_members": [
// "user:jose@example.com"
// ]
// },
// {
// "log_type": "DATA_WRITE"
// },
// {
// "log_type": "ADMIN_READ"
// }
// ]
// },
// {
// "service": "sampleservice.googleapis.com",
// "audit_log_configs": [
// {
// "log_type": "DATA_READ"
// },
// {
// "log_type": "DATA_WRITE",
// "exempted_members": [
// "user:aliya@example.com"
// ]
// }
// ]
// }
// ]
// }
//
// For sampleservice, this policy enables DATA_READ, DATA_WRITE and ADMIN_READ
// logging. It also exempts `jose@example.com` from DATA_READ logging, and
// `aliya@example.com` from DATA_WRITE logging.
message AuditConfig {
// Specifies a service that will be enabled for audit logging.
// For example, `storage.googleapis.com`, `cloudsql.googleapis.com`.
// `allServices` is a special value that covers all services.
string service = 1;
// The configuration for logging of each type of permission.
repeated AuditLogConfig audit_log_configs = 3;
}
// Provides the configuration for logging a type of permissions.
// Example:
//
// {
// "audit_log_configs": [
// {
// "log_type": "DATA_READ",
// "exempted_members": [
// "user:jose@example.com"
// ]
// },
// {
// "log_type": "DATA_WRITE"
// }
// ]
// }
//
// This enables 'DATA_READ' and 'DATA_WRITE' logging, while exempting
// jose@example.com from DATA_READ logging.
message AuditLogConfig {
// The list of valid permission types for which logging can be configured.
// Admin writes are always logged, and are not configurable.
enum LogType {
// Default case. Should never be this.
LOG_TYPE_UNSPECIFIED = 0;
// Admin reads. Example: CloudIAM getIamPolicy
ADMIN_READ = 1;
// Data writes. Example: CloudSQL Users create
DATA_WRITE = 2;
// Data reads. Example: CloudSQL Users list
DATA_READ = 3;
}
// The log type that this config enables.
LogType log_type = 1;
// Specifies the identities that do not cause logging for this type of
// permission.
// Follows the same format of
// [Binding.members][google.iam.v1.Binding.members].
repeated string exempted_members = 2;
}
// The difference delta between two policies.
message PolicyDelta {
// The delta for Bindings between two policies.
repeated BindingDelta binding_deltas = 1;
// The delta for AuditConfigs between two policies.
repeated AuditConfigDelta audit_config_deltas = 2;
}
// One delta entry for Binding. Each individual change (only one member in each
// entry) to a binding will be a separate entry.
message BindingDelta {
// The type of action performed on a Binding in a policy.
enum Action {
// Unspecified.
ACTION_UNSPECIFIED = 0;
// Addition of a Binding.
ADD = 1;
// Removal of a Binding.
REMOVE = 2;
}
// The action that was performed on a Binding.
// Required
Action action = 1;
// Role that is assigned to `members`.
// For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
// Required
string role = 2;
// A single identity requesting access for a Google Cloud resource.
// Follows the same format of Binding.members.
// Required
string member = 3;
// The condition that is associated with this binding.
google.type.Expr condition = 4;
}
// One delta entry for AuditConfig. Each individual change (only one
// exempted_member in each entry) to a AuditConfig will be a separate entry.
message AuditConfigDelta {
// The type of action performed on an audit configuration in a policy.
enum Action {
// Unspecified.
ACTION_UNSPECIFIED = 0;
// Addition of an audit configuration.
ADD = 1;
// Removal of an audit configuration.
REMOVE = 2;
}
// The action that was performed on an audit configuration in a policy.
// Required
Action action = 1;
// Specifies a service that was configured for Cloud Audit Logging.
// For example, `storage.googleapis.com`, `cloudsql.googleapis.com`.
// `allServices` is a special value that covers all services.
// Required
string service = 2;
// A single identity that is exempted from "data access" audit
// logging for the `service` specified above.
// Follows the same format of Binding.members.
string exempted_member = 3;
// Specifies the log_type that was be enabled. ADMIN_ACTIVITY is always
// enabled, and cannot be configured.
// Required
string log_type = 4;
}

View File

@@ -0,0 +1,95 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.logging.type;
import "google/protobuf/duration.proto";
option csharp_namespace = "Google.Cloud.Logging.Type";
option go_package = "google.golang.org/genproto/googleapis/logging/type;ltype";
option java_multiple_files = true;
option java_outer_classname = "HttpRequestProto";
option java_package = "com.google.logging.type";
option php_namespace = "Google\\Cloud\\Logging\\Type";
option ruby_package = "Google::Cloud::Logging::Type";
// A common proto for logging HTTP requests. Only contains semantics
// defined by the HTTP specification. Product-specific logging
// information MUST be defined in a separate message.
message HttpRequest {
// The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`.
string request_method = 1;
// The scheme (http, https), the host name, the path and the query
// portion of the URL that was requested.
// Example: `"http://example.com/some/info?color=red"`.
string request_url = 2;
// The size of the HTTP request message in bytes, including the request
// headers and the request body.
int64 request_size = 3;
// The response code indicating the status of response.
// Examples: 200, 404.
int32 status = 4;
// The size of the HTTP response message sent back to the client, in bytes,
// including the response headers and the response body.
int64 response_size = 5;
// The user agent sent by the client. Example:
// `"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET
// CLR 1.0.3705)"`.
string user_agent = 6;
// The IP address (IPv4 or IPv6) of the client that issued the HTTP
// request. This field can include port information. Examples:
// `"192.168.1.1"`, `"10.0.0.1:80"`, `"FE80::0202:B3FF:FE1E:8329"`.
string remote_ip = 7;
// The IP address (IPv4 or IPv6) of the origin server that the request was
// sent to. This field can include port information. Examples:
// `"192.168.1.1"`, `"10.0.0.1:80"`, `"FE80::0202:B3FF:FE1E:8329"`.
string server_ip = 13;
// The referer URL of the request, as defined in
// [HTTP/1.1 Header Field
// Definitions](https://datatracker.ietf.org/doc/html/rfc2616#section-14.36).
string referer = 8;
// The request processing latency on the server, from the time the request was
// received until the response was sent.
google.protobuf.Duration latency = 14;
// Whether or not a cache lookup was attempted.
bool cache_lookup = 11;
// Whether or not an entity was served from cache
// (with or without validation).
bool cache_hit = 9;
// Whether or not the response was validated with the origin server before
// being served from cache. This field is only meaningful if `cache_hit` is
// True.
bool cache_validated_with_origin_server = 10;
// The number of HTTP response bytes inserted into cache. Set only when a
// cache fill was attempted.
int64 cache_fill_bytes = 12;
// Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket"
string protocol = 15;
}

View File

@@ -0,0 +1,71 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.logging.type;
option csharp_namespace = "Google.Cloud.Logging.Type";
option go_package = "google.golang.org/genproto/googleapis/logging/type;ltype";
option java_multiple_files = true;
option java_outer_classname = "LogSeverityProto";
option java_package = "com.google.logging.type";
option objc_class_prefix = "GLOG";
option php_namespace = "Google\\Cloud\\Logging\\Type";
option ruby_package = "Google::Cloud::Logging::Type";
// The severity of the event described in a log entry, expressed as one of the
// standard severity levels listed below. For your reference, the levels are
// assigned the listed numeric values. The effect of using numeric values other
// than those listed is undefined.
//
// You can filter for log entries by severity. For example, the following
// filter expression will match log entries with severities `INFO`, `NOTICE`,
// and `WARNING`:
//
// severity > DEBUG AND severity <= WARNING
//
// If you are writing log entries, you should map other severity encodings to
// one of these standard levels. For example, you might map all of Java's FINE,
// FINER, and FINEST levels to `LogSeverity.DEBUG`. You can preserve the
// original severity level in the log entry payload if you wish.
enum LogSeverity {
// (0) The log entry has no assigned severity level.
DEFAULT = 0;
// (100) Debug or trace information.
DEBUG = 100;
// (200) Routine information, such as ongoing status or performance.
INFO = 200;
// (300) Normal but significant events, such as start up, shut down, or
// a configuration change.
NOTICE = 300;
// (400) Warning events might cause problems.
WARNING = 400;
// (500) Error events are likely to cause problems.
ERROR = 500;
// (600) Critical events cause more severe problems or outages.
CRITICAL = 600;
// (700) A person must take an action immediately.
ALERT = 700;
// (800) One or more systems are unusable.
EMERGENCY = 800;
}

View File

@@ -0,0 +1,247 @@
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.longrunning;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/protobuf/any.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/empty.proto";
import "google/rpc/status.proto";
import "google/protobuf/descriptor.proto";
option cc_enable_arenas = true;
option csharp_namespace = "Google.LongRunning";
option go_package = "cloud.google.com/go/longrunning/autogen/longrunningpb;longrunningpb";
option java_multiple_files = true;
option java_outer_classname = "OperationsProto";
option java_package = "com.google.longrunning";
option php_namespace = "Google\\LongRunning";
extend google.protobuf.MethodOptions {
// Additional information regarding long-running operations.
// In particular, this specifies the types that are returned from
// long-running operations.
//
// Required for methods that return `google.longrunning.Operation`; invalid
// otherwise.
google.longrunning.OperationInfo operation_info = 1049;
}
// Manages long-running operations with an API service.
//
// When an API method normally takes long time to complete, it can be designed
// to return [Operation][google.longrunning.Operation] to the client, and the client can use this
// interface to receive the real response asynchronously by polling the
// operation resource, or pass the operation resource to another API (such as
// Google Cloud Pub/Sub API) to receive the response. Any API service that
// returns long-running operations should implement the `Operations` interface
// so developers can have a consistent client experience.
service Operations {
option (google.api.default_host) = "longrunning.googleapis.com";
// Lists operations that match the specified filter in the request. If the
// server doesn't support this method, it returns `UNIMPLEMENTED`.
//
// NOTE: the `name` binding allows API services to override the binding
// to use different resource name schemes, such as `users/*/operations`. To
// override the binding, API services can add a binding such as
// `"/v1/{name=users/*}/operations"` to their service configuration.
// For backwards compatibility, the default name includes the operations
// collection id, however overriding users must ensure the name binding
// is the parent resource, without the operations collection id.
rpc ListOperations(ListOperationsRequest) returns (ListOperationsResponse) {
option (google.api.http) = {
get: "/v1/{name=operations}"
};
option (google.api.method_signature) = "name,filter";
}
// Gets the latest state of a long-running operation. Clients can use this
// method to poll the operation result at intervals as recommended by the API
// service.
rpc GetOperation(GetOperationRequest) returns (Operation) {
option (google.api.http) = {
get: "/v1/{name=operations/**}"
};
option (google.api.method_signature) = "name";
}
// Deletes a long-running operation. This method indicates that the client is
// no longer interested in the operation result. It does not cancel the
// operation. If the server doesn't support this method, it returns
// `google.rpc.Code.UNIMPLEMENTED`.
rpc DeleteOperation(DeleteOperationRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1/{name=operations/**}"
};
option (google.api.method_signature) = "name";
}
// Starts asynchronous cancellation on a long-running operation. The server
// makes a best effort to cancel the operation, but success is not
// guaranteed. If the server doesn't support this method, it returns
// `google.rpc.Code.UNIMPLEMENTED`. Clients can use
// [Operations.GetOperation][google.longrunning.Operations.GetOperation] or
// other methods to check whether the cancellation succeeded or whether the
// operation completed despite cancellation. On successful cancellation,
// the operation is not deleted; instead, it becomes an operation with
// an [Operation.error][google.longrunning.Operation.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
// corresponding to `Code.CANCELLED`.
rpc CancelOperation(CancelOperationRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/v1/{name=operations/**}:cancel"
body: "*"
};
option (google.api.method_signature) = "name";
}
// Waits until the specified long-running operation is done or reaches at most
// a specified timeout, returning the latest state. If the operation is
// already done, the latest state is immediately returned. If the timeout
// specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
// timeout is used. If the server does not support this method, it returns
// `google.rpc.Code.UNIMPLEMENTED`.
// Note that this method is on a best-effort basis. It may return the latest
// state before the specified timeout (including immediately), meaning even an
// immediate response is no guarantee that the operation is done.
rpc WaitOperation(WaitOperationRequest) returns (Operation) {
}
}
// This resource represents a long-running operation that is the result of a
// network API call.
message Operation {
// The server-assigned name, which is only unique within the same service that
// originally returns it. If you use the default HTTP mapping, the
// `name` should be a resource name ending with `operations/{unique_id}`.
string name = 1;
// Service-specific metadata associated with the operation. It typically
// contains progress information and common metadata such as create time.
// Some services might not provide such metadata. Any method that returns a
// long-running operation should document the metadata type, if any.
google.protobuf.Any metadata = 2;
// If the value is `false`, it means the operation is still in progress.
// If `true`, the operation is completed, and either `error` or `response` is
// available.
bool done = 3;
// The operation result, which can be either an `error` or a valid `response`.
// If `done` == `false`, neither `error` nor `response` is set.
// If `done` == `true`, exactly one of `error` or `response` is set.
oneof result {
// The error result of the operation in case of failure or cancellation.
google.rpc.Status error = 4;
// The normal response of the operation in case of success. If the original
// method returns no data on success, such as `Delete`, the response is
// `google.protobuf.Empty`. If the original method is standard
// `Get`/`Create`/`Update`, the response should be the resource. For other
// methods, the response should have the type `XxxResponse`, where `Xxx`
// is the original method name. For example, if the original method name
// is `TakeSnapshot()`, the inferred response type is
// `TakeSnapshotResponse`.
google.protobuf.Any response = 5;
}
}
// The request message for [Operations.GetOperation][google.longrunning.Operations.GetOperation].
message GetOperationRequest {
// The name of the operation resource.
string name = 1;
}
// The request message for [Operations.ListOperations][google.longrunning.Operations.ListOperations].
message ListOperationsRequest {
// The name of the operation's parent resource.
string name = 4;
// The standard list filter.
string filter = 1;
// The standard list page size.
int32 page_size = 2;
// The standard list page token.
string page_token = 3;
}
// The response message for [Operations.ListOperations][google.longrunning.Operations.ListOperations].
message ListOperationsResponse {
// A list of operations that matches the specified filter in the request.
repeated Operation operations = 1;
// The standard List next-page token.
string next_page_token = 2;
}
// The request message for [Operations.CancelOperation][google.longrunning.Operations.CancelOperation].
message CancelOperationRequest {
// The name of the operation resource to be cancelled.
string name = 1;
}
// The request message for [Operations.DeleteOperation][google.longrunning.Operations.DeleteOperation].
message DeleteOperationRequest {
// The name of the operation resource to be deleted.
string name = 1;
}
// The request message for [Operations.WaitOperation][google.longrunning.Operations.WaitOperation].
message WaitOperationRequest {
// The name of the operation resource to wait on.
string name = 1;
// The maximum duration to wait before timing out. If left blank, the wait
// will be at most the time permitted by the underlying HTTP/RPC protocol.
// If RPC context deadline is also specified, the shorter one will be used.
google.protobuf.Duration timeout = 2;
}
// A message representing the message types used by a long-running operation.
//
// Example:
//
// rpc LongRunningRecognize(LongRunningRecognizeRequest)
// returns (google.longrunning.Operation) {
// option (google.longrunning.operation_info) = {
// response_type: "LongRunningRecognizeResponse"
// metadata_type: "LongRunningRecognizeMetadata"
// };
// }
message OperationInfo {
// Required. The message name of the primary return type for this
// long-running operation.
// This type will be used to deserialize the LRO's response.
//
// If the response is in a different package from the rpc, a fully-qualified
// message name must be used (e.g. `google.protobuf.Struct`).
//
// Note: Altering this value constitutes a breaking change.
string response_type = 1;
// Required. The message name of the metadata type for this long-running
// operation.
//
// If the response is in a different package from the rpc, a fully-qualified
// message name must be used (e.g. `google.protobuf.Struct`).
//
// Note: Altering this value constitutes a breaking change.
string metadata_type = 2;
}

View File

@@ -0,0 +1,669 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.monitoring.v3;
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/monitoring/v3/common.proto";
import "google/monitoring/v3/mutation_record.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/wrappers.proto";
import "google/rpc/status.proto";
option csharp_namespace = "Google.Cloud.Monitoring.V3";
option go_package = "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpb";
option java_multiple_files = true;
option java_outer_classname = "AlertProto";
option java_package = "com.google.monitoring.v3";
option php_namespace = "Google\\Cloud\\Monitoring\\V3";
option ruby_package = "Google::Cloud::Monitoring::V3";
// A description of the conditions under which some aspect of your system is
// considered to be "unhealthy" and the ways to notify people or services about
// this state. For an overview of alert policies, see
// [Introduction to Alerting](https://cloud.google.com/monitoring/alerts/).
//
message AlertPolicy {
option (google.api.resource) = {
type: "monitoring.googleapis.com/AlertPolicy"
pattern: "projects/{project}/alertPolicies/{alert_policy}"
pattern: "organizations/{organization}/alertPolicies/{alert_policy}"
pattern: "folders/{folder}/alertPolicies/{alert_policy}"
pattern: "*"
};
// A content string and a MIME type that describes the content string's
// format.
message Documentation {
// The body of the documentation, interpreted according to `mime_type`.
// The content may not exceed 8,192 Unicode characters and may not exceed
// more than 10,240 bytes when encoded in UTF-8 format, whichever is
// smaller. This text can be [templatized by using
// variables](https://cloud.google.com/monitoring/alerts/doc-variables).
string content = 1;
// The format of the `content` field. Presently, only the value
// `"text/markdown"` is supported. See
// [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
string mime_type = 2;
// Optional. The subject line of the notification. The subject line may not
// exceed 10,240 bytes. In notifications generated by this policy, the
// contents of the subject line after variable expansion will be truncated
// to 255 bytes or shorter at the latest UTF-8 character boundary. The
// 255-byte limit is recommended by [this
// thread](https://stackoverflow.com/questions/1592291/what-is-the-email-subject-length-limit).
// It is both the limit imposed by some third-party ticketing products and
// it is common to define textual fields in databases as VARCHAR(255).
//
// The contents of the subject line can be [templatized by using
// variables](https://cloud.google.com/monitoring/alerts/doc-variables).
// If this field is missing or empty, a default subject line will be
// generated.
string subject = 3 [(google.api.field_behavior) = OPTIONAL];
}
// A condition is a true/false test that determines when an alerting policy
// should open an incident. If a condition evaluates to true, it signifies
// that something is wrong.
message Condition {
option (google.api.resource) = {
type: "monitoring.googleapis.com/AlertPolicyCondition"
pattern: "projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}"
pattern: "organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}"
pattern: "folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}"
pattern: "*"
};
// Specifies how many time series must fail a predicate to trigger a
// condition. If not specified, then a `{count: 1}` trigger is used.
message Trigger {
// A type of trigger.
oneof type {
// The absolute number of time series that must fail
// the predicate for the condition to be triggered.
int32 count = 1;
// The percentage of time series that must fail the
// predicate for the condition to be triggered.
double percent = 2;
}
}
// A condition control that determines how metric-threshold conditions
// are evaluated when data stops arriving.
// This control doesn't affect metric-absence policies.
enum EvaluationMissingData {
// An unspecified evaluation missing data option. Equivalent to
// EVALUATION_MISSING_DATA_NO_OP.
EVALUATION_MISSING_DATA_UNSPECIFIED = 0;
// If there is no data to evaluate the condition, then evaluate the
// condition as false.
EVALUATION_MISSING_DATA_INACTIVE = 1;
// If there is no data to evaluate the condition, then evaluate the
// condition as true.
EVALUATION_MISSING_DATA_ACTIVE = 2;
// Do not evaluate the condition to any value if there is no data.
EVALUATION_MISSING_DATA_NO_OP = 3;
}
// A condition type that compares a collection of time series
// against a threshold.
message MetricThreshold {
// Options used when forecasting the time series and testing
// the predicted value against the threshold.
message ForecastOptions {
// Required. The length of time into the future to forecast whether a
// time series will violate the threshold. If the predicted value is
// found to violate the threshold, and the violation is observed in all
// forecasts made for the configured `duration`, then the time series is
// considered to be failing.
// The forecast horizon can range from 1 hour to 60 hours.
google.protobuf.Duration forecast_horizon = 1
[(google.api.field_behavior) = REQUIRED];
}
// Required. A
// [filter](https://cloud.google.com/monitoring/api/v3/filters) that
// identifies which time series should be compared with the threshold.
//
// The filter is similar to the one that is specified in the
// [`ListTimeSeries`
// request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
// (that call is useful to verify the time series that will be retrieved /
// processed). The filter must specify the metric type and the resource
// type. Optionally, it can specify resource labels and metric labels.
// This field must not exceed 2048 Unicode characters in length.
string filter = 2 [(google.api.field_behavior) = REQUIRED];
// Specifies the alignment of data points in individual time series as
// well as how to combine the retrieved time series together (such as
// when aggregating multiple streams on each resource to a single
// stream for each resource or when aggregating streams across all
// members of a group of resources). Multiple aggregations
// are applied in the order specified.
//
// This field is similar to the one in the [`ListTimeSeries`
// request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
// It is advisable to use the `ListTimeSeries` method when debugging this
// field.
repeated Aggregation aggregations = 8;
// A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
// identifies a time series that should be used as the denominator of a
// ratio that will be compared with the threshold. If a
// `denominator_filter` is specified, the time series specified by the
// `filter` field will be used as the numerator.
//
// The filter must specify the metric type and optionally may contain
// restrictions on resource type, resource labels, and metric labels.
// This field may not exceed 2048 Unicode characters in length.
string denominator_filter = 9;
// Specifies the alignment of data points in individual time series
// selected by `denominatorFilter` as
// well as how to combine the retrieved time series together (such as
// when aggregating multiple streams on each resource to a single
// stream for each resource or when aggregating streams across all
// members of a group of resources).
//
// When computing ratios, the `aggregations` and
// `denominator_aggregations` fields must use the same alignment period
// and produce time series that have the same periodicity and labels.
repeated Aggregation denominator_aggregations = 10;
// When this field is present, the `MetricThreshold` condition forecasts
// whether the time series is predicted to violate the threshold within
// the `forecast_horizon`. When this field is not set, the
// `MetricThreshold` tests the current value of the timeseries against the
// threshold.
ForecastOptions forecast_options = 12;
// The comparison to apply between the time series (indicated by `filter`
// and `aggregation`) and the threshold (indicated by `threshold_value`).
// The comparison is applied on each time series, with the time series
// on the left-hand side and the threshold on the right-hand side.
//
// Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently.
ComparisonType comparison = 4;
// A value against which to compare the time series.
double threshold_value = 5;
// The amount of time that a time series must violate the
// threshold to be considered failing. Currently, only values
// that are a multiple of a minute--e.g., 0, 60, 120, or 300
// seconds--are supported. If an invalid value is given, an
// error will be returned. When choosing a duration, it is useful to
// keep in mind the frequency of the underlying time series data
// (which may also be affected by any alignments specified in the
// `aggregations` field); a good duration is long enough so that a single
// outlier does not generate spurious alerts, but short enough that
// unhealthy states are detected and alerted on quickly.
google.protobuf.Duration duration = 6;
// The number/percent of time series for which the comparison must hold
// in order for the condition to trigger. If unspecified, then the
// condition will trigger if the comparison is true for any of the
// time series that have been identified by `filter` and `aggregations`,
// or by the ratio, if `denominator_filter` and `denominator_aggregations`
// are specified.
Trigger trigger = 7;
// A condition control that determines how metric-threshold conditions
// are evaluated when data stops arriving.
EvaluationMissingData evaluation_missing_data = 11;
}
// A condition type that checks that monitored resources
// are reporting data. The configuration defines a metric and
// a set of monitored resources. The predicate is considered in violation
// when a time series for the specified metric of a monitored
// resource does not include any data in the specified `duration`.
message MetricAbsence {
// Required. A
// [filter](https://cloud.google.com/monitoring/api/v3/filters) that
// identifies which time series should be compared with the threshold.
//
// The filter is similar to the one that is specified in the
// [`ListTimeSeries`
// request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
// (that call is useful to verify the time series that will be retrieved /
// processed). The filter must specify the metric type and the resource
// type. Optionally, it can specify resource labels and metric labels.
// This field must not exceed 2048 Unicode characters in length.
string filter = 1 [(google.api.field_behavior) = REQUIRED];
// Specifies the alignment of data points in individual time series as
// well as how to combine the retrieved time series together (such as
// when aggregating multiple streams on each resource to a single
// stream for each resource or when aggregating streams across all
// members of a group of resources). Multiple aggregations
// are applied in the order specified.
//
// This field is similar to the one in the [`ListTimeSeries`
// request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
// It is advisable to use the `ListTimeSeries` method when debugging this
// field.
repeated Aggregation aggregations = 5;
// The amount of time that a time series must fail to report new
// data to be considered failing. The minimum value of this field
// is 120 seconds. Larger values that are a multiple of a
// minute--for example, 240 or 300 seconds--are supported.
// If an invalid value is given, an
// error will be returned. The `Duration.nanos` field is
// ignored.
google.protobuf.Duration duration = 2;
// The number/percent of time series for which the comparison must hold
// in order for the condition to trigger. If unspecified, then the
// condition will trigger if the comparison is true for any of the
// time series that have been identified by `filter` and `aggregations`.
Trigger trigger = 3;
}
// A condition type that checks whether a log message in the [scoping
// project](https://cloud.google.com/monitoring/api/v3#project_name)
// satisfies the given filter. Logs from other projects in the metrics
// scope are not evaluated.
message LogMatch {
// Required. A logs-based filter. See [Advanced Logs
// Queries](https://cloud.google.com/logging/docs/view/advanced-queries)
// for how this filter should be constructed.
string filter = 1 [(google.api.field_behavior) = REQUIRED];
// Optional. A map from a label key to an extractor expression, which is
// used to extract the value for this label key. Each entry in this map is
// a specification for how data should be extracted from log entries that
// match `filter`. Each combination of extracted values is treated as a
// separate rule for the purposes of triggering notifications. Label keys
// and corresponding values can be used in notifications generated by this
// condition.
//
// Please see [the documentation on logs-based metric
// `valueExtractor`s](https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics#LogMetric.FIELDS.value_extractor)
// for syntax and examples.
map<string, string> label_extractors = 2;
}
// A condition type that allows alert policies to be defined using
// [Monitoring Query Language](https://cloud.google.com/monitoring/mql).
message MonitoringQueryLanguageCondition {
// [Monitoring Query Language](https://cloud.google.com/monitoring/mql)
// query that outputs a boolean stream.
string query = 1;
// The amount of time that a time series must violate the
// threshold to be considered failing. Currently, only values
// that are a multiple of a minute--e.g., 0, 60, 120, or 300
// seconds--are supported. If an invalid value is given, an
// error will be returned. When choosing a duration, it is useful to
// keep in mind the frequency of the underlying time series data
// (which may also be affected by any alignments specified in the
// `aggregations` field); a good duration is long enough so that a single
// outlier does not generate spurious alerts, but short enough that
// unhealthy states are detected and alerted on quickly.
google.protobuf.Duration duration = 2;
// The number/percent of time series for which the comparison must hold
// in order for the condition to trigger. If unspecified, then the
// condition will trigger if the comparison is true for any of the
// time series that have been identified by `filter` and `aggregations`,
// or by the ratio, if `denominator_filter` and `denominator_aggregations`
// are specified.
Trigger trigger = 3;
// A condition control that determines how metric-threshold conditions
// are evaluated when data stops arriving.
EvaluationMissingData evaluation_missing_data = 4;
}
// A condition type that allows alert policies to be defined using
// [Prometheus Query Language
// (PromQL)](https://prometheus.io/docs/prometheus/latest/querying/basics/).
//
// The PrometheusQueryLanguageCondition message contains information
// from a Prometheus alerting rule and its associated rule group.
//
// A Prometheus alerting rule is described
// [here](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/).
// The semantics of a Prometheus alerting rule is described
// [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule).
//
// A Prometheus rule group is described
// [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/).
// The semantics of a Prometheus rule group is described
// [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule_group).
//
// Because Cloud Alerting has no representation of a Prometheus rule
// group resource, we must embed the information of the parent rule
// group inside each of the conditions that refer to it. We must also
// update the contents of all Prometheus alerts in case the information
// of their rule group changes.
//
// The PrometheusQueryLanguageCondition protocol buffer combines the
// information of the corresponding rule group and alerting rule.
// The structure of the PrometheusQueryLanguageCondition protocol buffer
// does NOT mimic the structure of the Prometheus rule group and alerting
// rule YAML declarations. The PrometheusQueryLanguageCondition protocol
// buffer may change in the future to support future rule group and/or
// alerting rule features. There are no new such features at the present
// time (2023-06-26).
message PrometheusQueryLanguageCondition {
// Required. The PromQL expression to evaluate. Every evaluation cycle
// this expression is evaluated at the current time, and all resultant
// time series become pending/firing alerts. This field must not be empty.
string query = 1 [(google.api.field_behavior) = REQUIRED];
// Optional. Alerts are considered firing once their PromQL expression was
// evaluated to be "true" for this long.
// Alerts whose PromQL expression was not evaluated to be "true" for
// long enough are considered pending.
// Must be a non-negative duration or missing.
// This field is optional. Its default value is zero.
google.protobuf.Duration duration = 2
[(google.api.field_behavior) = OPTIONAL];
// Optional. How often this rule should be evaluated.
// Must be a positive multiple of 30 seconds or missing.
// This field is optional. Its default value is 30 seconds.
// If this PrometheusQueryLanguageCondition was generated from a
// Prometheus alerting rule, then this value should be taken from the
// enclosing rule group.
google.protobuf.Duration evaluation_interval = 3
[(google.api.field_behavior) = OPTIONAL];
// Optional. Labels to add to or overwrite in the PromQL query result.
// Label names [must be
// valid](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
// Label values can be [templatized by using
// variables](https://cloud.google.com/monitoring/alerts/doc-variables).
// The only available variable names are the names of the labels in the
// PromQL result, including "__name__" and "value". "labels" may be empty.
map<string, string> labels = 4 [(google.api.field_behavior) = OPTIONAL];
// Optional. The rule group name of this alert in the corresponding
// Prometheus configuration file.
//
// Some external tools may require this field to be populated correctly
// in order to refer to the original Prometheus configuration file.
// The rule group name and the alert name are necessary to update the
// relevant AlertPolicies in case the definition of the rule group changes
// in the future.
//
// This field is optional. If this field is not empty, then it must
// contain a valid UTF-8 string.
// This field may not exceed 2048 Unicode characters in length.
string rule_group = 5 [(google.api.field_behavior) = OPTIONAL];
// Optional. The alerting rule name of this alert in the corresponding
// Prometheus configuration file.
//
// Some external tools may require this field to be populated correctly
// in order to refer to the original Prometheus configuration file.
// The rule group name and the alert name are necessary to update the
// relevant AlertPolicies in case the definition of the rule group changes
// in the future.
//
// This field is optional. If this field is not empty, then it must be a
// [valid Prometheus label
// name](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
// This field may not exceed 2048 Unicode characters in length.
string alert_rule = 6 [(google.api.field_behavior) = OPTIONAL];
}
// Required if the condition exists. The unique resource name for this
// condition. Its format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
//
// `[CONDITION_ID]` is assigned by Cloud Monitoring when the
// condition is created as part of a new or updated alerting policy.
//
// When calling the
// [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy]
// method, do not include the `name` field in the conditions of the
// requested alerting policy. Cloud Monitoring creates the
// condition identifiers and includes them in the new policy.
//
// When calling the
// [alertPolicies.update][google.monitoring.v3.AlertPolicyService.UpdateAlertPolicy]
// method to update a policy, including a condition `name` causes the
// existing condition to be updated. Conditions without names are added to
// the updated policy. Existing conditions are deleted if they are not
// updated.
//
// Best practice is to preserve `[CONDITION_ID]` if you make only small
// changes, such as those to condition thresholds, durations, or trigger
// values. Otherwise, treat the change as a new condition and let the
// existing condition be deleted.
string name = 12;
// A short name or phrase used to identify the condition in dashboards,
// notifications, and incidents. To avoid confusion, don't use the same
// display name for multiple conditions in the same policy.
string display_name = 6;
// Only one of the following condition types will be specified.
oneof condition {
// A condition that compares a time series against a threshold.
MetricThreshold condition_threshold = 1;
// A condition that checks that a time series continues to
// receive new data points.
MetricAbsence condition_absent = 2;
// A condition that checks for log messages matching given constraints. If
// set, no other conditions can be present.
LogMatch condition_matched_log = 20;
// A condition that uses the Monitoring Query Language to define
// alerts.
MonitoringQueryLanguageCondition condition_monitoring_query_language = 19;
// A condition that uses the Prometheus query language to define alerts.
PrometheusQueryLanguageCondition condition_prometheus_query_language = 21;
}
}
// Operators for combining conditions.
enum ConditionCombinerType {
// An unspecified combiner.
COMBINE_UNSPECIFIED = 0;
// Combine conditions using the logical `AND` operator. An
// incident is created only if all the conditions are met
// simultaneously. This combiner is satisfied if all conditions are
// met, even if they are met on completely different resources.
AND = 1;
// Combine conditions using the logical `OR` operator. An incident
// is created if any of the listed conditions is met.
OR = 2;
// Combine conditions using logical `AND` operator, but unlike the regular
// `AND` option, an incident is created only if all conditions are met
// simultaneously on at least one resource.
AND_WITH_MATCHING_RESOURCE = 3;
}
// Control over how the notification channels in `notification_channels`
// are notified when this alert fires.
message AlertStrategy {
// Control over the rate of notifications sent to this alert policy's
// notification channels.
message NotificationRateLimit {
// Not more than one notification per `period`.
google.protobuf.Duration period = 1;
}
// Control over how the notification channels in `notification_channels`
// are notified when this alert fires, on a per-channel basis.
message NotificationChannelStrategy {
// The full REST resource name for the notification channels that these
// settings apply to. Each of these correspond to the name field in one
// of the NotificationChannel objects referenced in the
// notification_channels field of this AlertPolicy.
// The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
repeated string notification_channel_names = 1;
// The frequency at which to send reminder notifications for open
// incidents.
google.protobuf.Duration renotify_interval = 2;
}
// Required for alert policies with a `LogMatch` condition.
//
// This limit is not implemented for alert policies that are not log-based.
NotificationRateLimit notification_rate_limit = 1;
// If an alert policy that was active has no data for this long, any open
// incidents will close
google.protobuf.Duration auto_close = 3;
// Control how notifications will be sent out, on a per-channel basis.
repeated NotificationChannelStrategy notification_channel_strategy = 4;
}
// An enumeration of possible severity level for an Alert Policy.
enum Severity {
// No severity is specified. This is the default value.
SEVERITY_UNSPECIFIED = 0;
// This is the highest severity level. Use this if the problem could
// cause significant damage or downtime.
CRITICAL = 1;
// This is the medium severity level. Use this if the problem could
// cause minor damage or downtime.
ERROR = 2;
// This is the lowest severity level. Use this if the problem is not causing
// any damage or downtime, but could potentially lead to a problem in the
// future.
WARNING = 3;
}
// Required if the policy exists. The resource name for this policy. The
// format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]
//
// `[ALERT_POLICY_ID]` is assigned by Cloud Monitoring when the policy
// is created. When calling the
// [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy]
// method, do not include the `name` field in the alerting policy passed as
// part of the request.
string name = 1;
// A short name or phrase used to identify the policy in dashboards,
// notifications, and incidents. To avoid confusion, don't use the same
// display name for multiple policies in the same project. The name is
// limited to 512 Unicode characters.
//
// The convention for the display_name of a PrometheusQueryLanguageCondition
// is "{rule group name}/{alert name}", where the {rule group name} and
// {alert name} should be taken from the corresponding Prometheus
// configuration file. This convention is not enforced.
// In any case the display_name is not a unique key of the AlertPolicy.
string display_name = 2;
// Documentation that is included with notifications and incidents related to
// this policy. Best practice is for the documentation to include information
// to help responders understand, mitigate, escalate, and correct the
// underlying problems detected by the alerting policy. Notification channels
// that have limited capacity might not show this documentation.
Documentation documentation = 13;
// User-supplied key/value data to be used for organizing and
// identifying the `AlertPolicy` objects.
//
// The field can contain up to 64 entries. Each key and value is limited to
// 63 Unicode characters or 128 bytes, whichever is smaller. Labels and
// values can contain only lowercase letters, numerals, underscores, and
// dashes. Keys must begin with a letter.
//
// Note that Prometheus {alert name} is a
// [valid Prometheus label
// names](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels),
// whereas Prometheus {rule group} is an unrestricted UTF-8 string.
// This means that they cannot be stored as-is in user labels, because
// they may contain characters that are not allowed in user-label values.
map<string, string> user_labels = 16;
// A list of conditions for the policy. The conditions are combined by AND or
// OR according to the `combiner` field. If the combined conditions evaluate
// to true, then an incident is created. A policy can have from one to six
// conditions.
// If `condition_time_series_query_language` is present, it must be the only
// `condition`.
// If `condition_monitoring_query_language` is present, it must be the only
// `condition`.
repeated Condition conditions = 12;
// How to combine the results of multiple conditions to determine if an
// incident should be opened.
// If `condition_time_series_query_language` is present, this must be
// `COMBINE_UNSPECIFIED`.
ConditionCombinerType combiner = 6;
// Whether or not the policy is enabled. On write, the default interpretation
// if unset is that the policy is enabled. On read, clients should not make
// any assumption about the state if it has not been populated. The
// field should always be populated on List and Get operations, unless
// a field projection has been specified that strips it out.
google.protobuf.BoolValue enabled = 17;
// Read-only description of how the alert policy is invalid. This field is
// only set when the alert policy is invalid. An invalid alert policy will not
// generate incidents.
google.rpc.Status validity = 18;
// Identifies the notification channels to which notifications should be sent
// when incidents are opened or closed or when new violations occur on
// an already opened incident. Each element of this array corresponds to
// the `name` field in each of the
// [`NotificationChannel`][google.monitoring.v3.NotificationChannel]
// objects that are returned from the [`ListNotificationChannels`]
// [google.monitoring.v3.NotificationChannelService.ListNotificationChannels]
// method. The format of the entries in this field is:
//
// projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
repeated string notification_channels = 14;
// A read-only record of the creation of the alerting policy. If provided
// in a call to create or update, this field will be ignored.
MutationRecord creation_record = 10;
// A read-only record of the most recent change to the alerting policy. If
// provided in a call to create or update, this field will be ignored.
MutationRecord mutation_record = 11;
// Control over how this alert policy's notification channels are notified.
AlertStrategy alert_strategy = 21;
// Optional. The severity of an alert policy indicates how important incidents
// generated by that policy are. The severity level will be displayed on the
// Incident detail page and in notifications.
Severity severity = 22 [(google.api.field_behavior) = OPTIONAL];
}

View File

@@ -0,0 +1,256 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.monitoring.v3;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/monitoring/v3/alert.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
option csharp_namespace = "Google.Cloud.Monitoring.V3";
option go_package = "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpb";
option java_multiple_files = true;
option java_outer_classname = "AlertServiceProto";
option java_package = "com.google.monitoring.v3";
option php_namespace = "Google\\Cloud\\Monitoring\\V3";
option ruby_package = "Google::Cloud::Monitoring::V3";
// The AlertPolicyService API is used to manage (list, create, delete,
// edit) alert policies in Cloud Monitoring. An alerting policy is
// a description of the conditions under which some aspect of your
// system is considered to be "unhealthy" and the ways to notify
// people or services about this state. In addition to using this API, alert
// policies can also be managed through
// [Cloud Monitoring](https://cloud.google.com/monitoring/docs/),
// which can be reached by clicking the "Monitoring" tab in
// [Cloud console](https://console.cloud.google.com/).
service AlertPolicyService {
option (google.api.default_host) = "monitoring.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform,"
"https://www.googleapis.com/auth/monitoring,"
"https://www.googleapis.com/auth/monitoring.read";
// Lists the existing alerting policies for the workspace.
rpc ListAlertPolicies(ListAlertPoliciesRequest)
returns (ListAlertPoliciesResponse) {
option (google.api.http) = {
get: "/v3/{name=projects/*}/alertPolicies"
};
option (google.api.method_signature) = "name";
}
// Gets a single alerting policy.
rpc GetAlertPolicy(GetAlertPolicyRequest) returns (AlertPolicy) {
option (google.api.http) = {
get: "/v3/{name=projects/*/alertPolicies/*}"
};
option (google.api.method_signature) = "name";
}
// Creates a new alerting policy.
//
// Design your application to single-thread API calls that modify the state of
// alerting policies in a single project. This includes calls to
// CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.
rpc CreateAlertPolicy(CreateAlertPolicyRequest) returns (AlertPolicy) {
option (google.api.http) = {
post: "/v3/{name=projects/*}/alertPolicies"
body: "alert_policy"
};
option (google.api.method_signature) = "name,alert_policy";
}
// Deletes an alerting policy.
//
// Design your application to single-thread API calls that modify the state of
// alerting policies in a single project. This includes calls to
// CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.
rpc DeleteAlertPolicy(DeleteAlertPolicyRequest)
returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v3/{name=projects/*/alertPolicies/*}"
};
option (google.api.method_signature) = "name";
}
// Updates an alerting policy. You can either replace the entire policy with
// a new one or replace only certain fields in the current alerting policy by
// specifying the fields to be updated via `updateMask`. Returns the
// updated alerting policy.
//
// Design your application to single-thread API calls that modify the state of
// alerting policies in a single project. This includes calls to
// CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.
rpc UpdateAlertPolicy(UpdateAlertPolicyRequest) returns (AlertPolicy) {
option (google.api.http) = {
patch: "/v3/{alert_policy.name=projects/*/alertPolicies/*}"
body: "alert_policy"
};
option (google.api.method_signature) = "update_mask,alert_policy";
}
}
// The protocol for the `CreateAlertPolicy` request.
message CreateAlertPolicyRequest {
// Required. The
// [project](https://cloud.google.com/monitoring/api/v3#project_name) in which
// to create the alerting policy. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]
//
// Note that this field names the parent container in which the alerting
// policy will be written, not the name of the created policy. |name| must be
// a host project of a Metrics Scope, otherwise INVALID_ARGUMENT error will
// return. The alerting policy that is returned will have a name that contains
// a normalized representation of this name as a prefix but adds a suffix of
// the form `/alertPolicies/[ALERT_POLICY_ID]`, identifying the policy in the
// container.
string name = 3 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "monitoring.googleapis.com/AlertPolicy"
}
];
// Required. The requested alerting policy. You should omit the `name` field
// in this policy. The name will be returned in the new policy, including a
// new `[ALERT_POLICY_ID]` value.
AlertPolicy alert_policy = 2 [(google.api.field_behavior) = REQUIRED];
}
// The protocol for the `GetAlertPolicy` request.
message GetAlertPolicyRequest {
// Required. The alerting policy to retrieve. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]
string name = 3 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "monitoring.googleapis.com/AlertPolicy"
}
];
}
// The protocol for the `ListAlertPolicies` request.
message ListAlertPoliciesRequest {
// Required. The
// [project](https://cloud.google.com/monitoring/api/v3#project_name) whose
// alert policies are to be listed. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]
//
// Note that this field names the parent container in which the alerting
// policies to be listed are stored. To retrieve a single alerting policy
// by name, use the
// [GetAlertPolicy][google.monitoring.v3.AlertPolicyService.GetAlertPolicy]
// operation, instead.
string name = 4 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "monitoring.googleapis.com/AlertPolicy"
}
];
// If provided, this field specifies the criteria that must be met by
// alert policies to be included in the response.
//
// For more details, see [sorting and
// filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering).
string filter = 5;
// A comma-separated list of fields by which to sort the result. Supports
// the same set of field references as the `filter` field. Entries can be
// prefixed with a minus sign to sort by the field in descending order.
//
// For more details, see [sorting and
// filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering).
string order_by = 6;
// The maximum number of results to return in a single response.
int32 page_size = 2;
// If this field is not empty then it must contain the `nextPageToken` value
// returned by a previous call to this method. Using this field causes the
// method to return more results from the previous method call.
string page_token = 3;
}
// The protocol for the `ListAlertPolicies` response.
message ListAlertPoliciesResponse {
// The returned alert policies.
repeated AlertPolicy alert_policies = 3;
// If there might be more results than were returned, then this field is set
// to a non-empty value. To see the additional results,
// use that value as `page_token` in the next call to this method.
string next_page_token = 2;
// The total number of alert policies in all pages. This number is only an
// estimate, and may change in subsequent pages. https://aip.dev/158
int32 total_size = 4;
}
// The protocol for the `UpdateAlertPolicy` request.
message UpdateAlertPolicyRequest {
// Optional. A list of alerting policy field names. If this field is not
// empty, each listed field in the existing alerting policy is set to the
// value of the corresponding field in the supplied policy (`alert_policy`),
// or to the field's default value if the field is not in the supplied
// alerting policy. Fields not listed retain their previous value.
//
// Examples of valid field masks include `display_name`, `documentation`,
// `documentation.content`, `documentation.mime_type`, `user_labels`,
// `user_label.nameofkey`, `enabled`, `conditions`, `combiner`, etc.
//
// If this field is empty, then the supplied alerting policy replaces the
// existing policy. It is the same as deleting the existing policy and
// adding the supplied policy, except for the following:
//
// + The new policy will have the same `[ALERT_POLICY_ID]` as the former
// policy. This gives you continuity with the former policy in your
// notifications and incidents.
// + Conditions in the new policy will keep their former `[CONDITION_ID]` if
// the supplied condition includes the `name` field with that
// `[CONDITION_ID]`. If the supplied condition omits the `name` field,
// then a new `[CONDITION_ID]` is created.
google.protobuf.FieldMask update_mask = 2;
// Required. The updated alerting policy or the updated values for the
// fields listed in `update_mask`.
// If `update_mask` is not empty, any fields in this policy that are
// not in `update_mask` are ignored.
AlertPolicy alert_policy = 3 [(google.api.field_behavior) = REQUIRED];
}
// The protocol for the `DeleteAlertPolicy` request.
message DeleteAlertPolicyRequest {
// Required. The alerting policy to delete. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]
//
// For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy].
string name = 3 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "monitoring.googleapis.com/AlertPolicy"
}
];
}

View File

@@ -0,0 +1,488 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.monitoring.v3;
import "google/api/distribution.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
option csharp_namespace = "Google.Cloud.Monitoring.V3";
option go_package = "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpb";
option java_multiple_files = true;
option java_outer_classname = "CommonProto";
option java_package = "com.google.monitoring.v3";
option php_namespace = "Google\\Cloud\\Monitoring\\V3";
option ruby_package = "Google::Cloud::Monitoring::V3";
// A single strongly-typed value.
message TypedValue {
// The typed value field.
oneof value {
// A Boolean value: `true` or `false`.
bool bool_value = 1;
// A 64-bit integer. Its range is approximately &plusmn;9.2x10<sup>18</sup>.
int64 int64_value = 2;
// A 64-bit double-precision floating-point number. Its magnitude
// is approximately &plusmn;10<sup>&plusmn;300</sup> and it has 16
// significant digits of precision.
double double_value = 3;
// A variable-length string value.
string string_value = 4;
// A distribution value.
google.api.Distribution distribution_value = 5;
}
}
// A closed time interval. It extends from the start time to the end time, and includes both: `[startTime, endTime]`. Valid time intervals depend on the [`MetricKind`](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors#MetricKind) of the metric value. The end time must not be earlier than the start time. When writing data points, the start time must not be more than 25 hours in the past and the end time must not be more than five minutes in the future.
//
// * For `GAUGE` metrics, the `startTime` value is technically optional; if
// no value is specified, the start time defaults to the value of the
// end time, and the interval represents a single point in time. If both
// start and end times are specified, they must be identical. Such an
// interval is valid only for `GAUGE` metrics, which are point-in-time
// measurements. The end time of a new interval must be at least a
// millisecond after the end time of the previous interval.
//
// * For `DELTA` metrics, the start time and end time must specify a
// non-zero interval, with subsequent points specifying contiguous and
// non-overlapping intervals. For `DELTA` metrics, the start time of
// the next interval must be at least a millisecond after the end time
// of the previous interval.
//
// * For `CUMULATIVE` metrics, the start time and end time must specify a
// non-zero interval, with subsequent points specifying the same
// start time and increasing end times, until an event resets the
// cumulative value to zero and sets a new start time for the following
// points. The new start time must be at least a millisecond after the
// end time of the previous interval.
//
// * The start time of a new interval must be at least a millisecond after the
// end time of the previous interval because intervals are closed. If the
// start time of a new interval is the same as the end time of the previous
// interval, then data written at the new start time could overwrite data
// written at the previous end time.
message TimeInterval {
// Required. The end of the time interval.
google.protobuf.Timestamp end_time = 2;
// Optional. The beginning of the time interval. The default value
// for the start time is the end time. The start time must not be
// later than the end time.
google.protobuf.Timestamp start_time = 1;
}
// Describes how to combine multiple time series to provide a different view of
// the data. Aggregation of time series is done in two steps. First, each time
// series in the set is _aligned_ to the same time interval boundaries, then the
// set of time series is optionally _reduced_ in number.
//
// Alignment consists of applying the `per_series_aligner` operation
// to each time series after its data has been divided into regular
// `alignment_period` time intervals. This process takes _all_ of the data
// points in an alignment period, applies a mathematical transformation such as
// averaging, minimum, maximum, delta, etc., and converts them into a single
// data point per period.
//
// Reduction is when the aligned and transformed time series can optionally be
// combined, reducing the number of time series through similar mathematical
// transformations. Reduction involves applying a `cross_series_reducer` to
// all the time series, optionally sorting the time series into subsets with
// `group_by_fields`, and applying the reducer to each subset.
//
// The raw time series data can contain a huge amount of information from
// multiple sources. Alignment and reduction transforms this mass of data into
// a more manageable and representative collection of data, for example "the
// 95% latency across the average of all tasks in a cluster". This
// representative data can be more easily graphed and comprehended, and the
// individual time series data is still available for later drilldown. For more
// details, see [Filtering and
// aggregation](https://cloud.google.com/monitoring/api/v3/aggregation).
message Aggregation {
// The `Aligner` specifies the operation that will be applied to the data
// points in each alignment period in a time series. Except for
// `ALIGN_NONE`, which specifies that no operation be applied, each alignment
// operation replaces the set of data values in each alignment period with
// a single value: the result of applying the operation to the data values.
// An aligned time series has a single data value at the end of each
// `alignment_period`.
//
// An alignment operation can change the data type of the values, too. For
// example, if you apply a counting operation to boolean values, the data
// `value_type` in the original time series is `BOOLEAN`, but the `value_type`
// in the aligned result is `INT64`.
enum Aligner {
// No alignment. Raw data is returned. Not valid if cross-series reduction
// is requested. The `value_type` of the result is the same as the
// `value_type` of the input.
ALIGN_NONE = 0;
// Align and convert to
// [DELTA][google.api.MetricDescriptor.MetricKind.DELTA].
// The output is `delta = y1 - y0`.
//
// This alignment is valid for
// [CUMULATIVE][google.api.MetricDescriptor.MetricKind.CUMULATIVE] and
// `DELTA` metrics. If the selected alignment period results in periods
// with no data, then the aligned value for such a period is created by
// interpolation. The `value_type` of the aligned result is the same as
// the `value_type` of the input.
ALIGN_DELTA = 1;
// Align and convert to a rate. The result is computed as
// `rate = (y1 - y0)/(t1 - t0)`, or "delta over time".
// Think of this aligner as providing the slope of the line that passes
// through the value at the start and at the end of the `alignment_period`.
//
// This aligner is valid for `CUMULATIVE`
// and `DELTA` metrics with numeric values. If the selected alignment
// period results in periods with no data, then the aligned value for
// such a period is created by interpolation. The output is a `GAUGE`
// metric with `value_type` `DOUBLE`.
//
// If, by "rate", you mean "percentage change", see the
// `ALIGN_PERCENT_CHANGE` aligner instead.
ALIGN_RATE = 2;
// Align by interpolating between adjacent points around the alignment
// period boundary. This aligner is valid for `GAUGE` metrics with
// numeric values. The `value_type` of the aligned result is the same as the
// `value_type` of the input.
ALIGN_INTERPOLATE = 3;
// Align by moving the most recent data point before the end of the
// alignment period to the boundary at the end of the alignment
// period. This aligner is valid for `GAUGE` metrics. The `value_type` of
// the aligned result is the same as the `value_type` of the input.
ALIGN_NEXT_OLDER = 4;
// Align the time series by returning the minimum value in each alignment
// period. This aligner is valid for `GAUGE` and `DELTA` metrics with
// numeric values. The `value_type` of the aligned result is the same as
// the `value_type` of the input.
ALIGN_MIN = 10;
// Align the time series by returning the maximum value in each alignment
// period. This aligner is valid for `GAUGE` and `DELTA` metrics with
// numeric values. The `value_type` of the aligned result is the same as
// the `value_type` of the input.
ALIGN_MAX = 11;
// Align the time series by returning the mean value in each alignment
// period. This aligner is valid for `GAUGE` and `DELTA` metrics with
// numeric values. The `value_type` of the aligned result is `DOUBLE`.
ALIGN_MEAN = 12;
// Align the time series by returning the number of values in each alignment
// period. This aligner is valid for `GAUGE` and `DELTA` metrics with
// numeric or Boolean values. The `value_type` of the aligned result is
// `INT64`.
ALIGN_COUNT = 13;
// Align the time series by returning the sum of the values in each
// alignment period. This aligner is valid for `GAUGE` and `DELTA`
// metrics with numeric and distribution values. The `value_type` of the
// aligned result is the same as the `value_type` of the input.
ALIGN_SUM = 14;
// Align the time series by returning the standard deviation of the values
// in each alignment period. This aligner is valid for `GAUGE` and
// `DELTA` metrics with numeric values. The `value_type` of the output is
// `DOUBLE`.
ALIGN_STDDEV = 15;
// Align the time series by returning the number of `True` values in
// each alignment period. This aligner is valid for `GAUGE` metrics with
// Boolean values. The `value_type` of the output is `INT64`.
ALIGN_COUNT_TRUE = 16;
// Align the time series by returning the number of `False` values in
// each alignment period. This aligner is valid for `GAUGE` metrics with
// Boolean values. The `value_type` of the output is `INT64`.
ALIGN_COUNT_FALSE = 24;
// Align the time series by returning the ratio of the number of `True`
// values to the total number of values in each alignment period. This
// aligner is valid for `GAUGE` metrics with Boolean values. The output
// value is in the range [0.0, 1.0] and has `value_type` `DOUBLE`.
ALIGN_FRACTION_TRUE = 17;
// Align the time series by using [percentile
// aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting
// data point in each alignment period is the 99th percentile of all data
// points in the period. This aligner is valid for `GAUGE` and `DELTA`
// metrics with distribution values. The output is a `GAUGE` metric with
// `value_type` `DOUBLE`.
ALIGN_PERCENTILE_99 = 18;
// Align the time series by using [percentile
// aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting
// data point in each alignment period is the 95th percentile of all data
// points in the period. This aligner is valid for `GAUGE` and `DELTA`
// metrics with distribution values. The output is a `GAUGE` metric with
// `value_type` `DOUBLE`.
ALIGN_PERCENTILE_95 = 19;
// Align the time series by using [percentile
// aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting
// data point in each alignment period is the 50th percentile of all data
// points in the period. This aligner is valid for `GAUGE` and `DELTA`
// metrics with distribution values. The output is a `GAUGE` metric with
// `value_type` `DOUBLE`.
ALIGN_PERCENTILE_50 = 20;
// Align the time series by using [percentile
// aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting
// data point in each alignment period is the 5th percentile of all data
// points in the period. This aligner is valid for `GAUGE` and `DELTA`
// metrics with distribution values. The output is a `GAUGE` metric with
// `value_type` `DOUBLE`.
ALIGN_PERCENTILE_05 = 21;
// Align and convert to a percentage change. This aligner is valid for
// `GAUGE` and `DELTA` metrics with numeric values. This alignment returns
// `((current - previous)/previous) * 100`, where the value of `previous` is
// determined based on the `alignment_period`.
//
// If the values of `current` and `previous` are both 0, then the returned
// value is 0. If only `previous` is 0, the returned value is infinity.
//
// A 10-minute moving mean is computed at each point of the alignment period
// prior to the above calculation to smooth the metric and prevent false
// positives from very short-lived spikes. The moving mean is only
// applicable for data whose values are `>= 0`. Any values `< 0` are
// treated as a missing datapoint, and are ignored. While `DELTA`
// metrics are accepted by this alignment, special care should be taken that
// the values for the metric will always be positive. The output is a
// `GAUGE` metric with `value_type` `DOUBLE`.
ALIGN_PERCENT_CHANGE = 23;
}
// A Reducer operation describes how to aggregate data points from multiple
// time series into a single time series, where the value of each data point
// in the resulting series is a function of all the already aligned values in
// the input time series.
enum Reducer {
// No cross-time series reduction. The output of the `Aligner` is
// returned.
REDUCE_NONE = 0;
// Reduce by computing the mean value across time series for each
// alignment period. This reducer is valid for
// [DELTA][google.api.MetricDescriptor.MetricKind.DELTA] and
// [GAUGE][google.api.MetricDescriptor.MetricKind.GAUGE] metrics with
// numeric or distribution values. The `value_type` of the output is
// [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE].
REDUCE_MEAN = 1;
// Reduce by computing the minimum value across time series for each
// alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics
// with numeric values. The `value_type` of the output is the same as the
// `value_type` of the input.
REDUCE_MIN = 2;
// Reduce by computing the maximum value across time series for each
// alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics
// with numeric values. The `value_type` of the output is the same as the
// `value_type` of the input.
REDUCE_MAX = 3;
// Reduce by computing the sum across time series for each
// alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics
// with numeric and distribution values. The `value_type` of the output is
// the same as the `value_type` of the input.
REDUCE_SUM = 4;
// Reduce by computing the standard deviation across time series
// for each alignment period. This reducer is valid for `DELTA` and
// `GAUGE` metrics with numeric or distribution values. The `value_type`
// of the output is `DOUBLE`.
REDUCE_STDDEV = 5;
// Reduce by computing the number of data points across time series
// for each alignment period. This reducer is valid for `DELTA` and
// `GAUGE` metrics of numeric, Boolean, distribution, and string
// `value_type`. The `value_type` of the output is `INT64`.
REDUCE_COUNT = 6;
// Reduce by computing the number of `True`-valued data points across time
// series for each alignment period. This reducer is valid for `DELTA` and
// `GAUGE` metrics of Boolean `value_type`. The `value_type` of the output
// is `INT64`.
REDUCE_COUNT_TRUE = 7;
// Reduce by computing the number of `False`-valued data points across time
// series for each alignment period. This reducer is valid for `DELTA` and
// `GAUGE` metrics of Boolean `value_type`. The `value_type` of the output
// is `INT64`.
REDUCE_COUNT_FALSE = 15;
// Reduce by computing the ratio of the number of `True`-valued data points
// to the total number of data points for each alignment period. This
// reducer is valid for `DELTA` and `GAUGE` metrics of Boolean `value_type`.
// The output value is in the range [0.0, 1.0] and has `value_type`
// `DOUBLE`.
REDUCE_FRACTION_TRUE = 8;
// Reduce by computing the [99th
// percentile](https://en.wikipedia.org/wiki/Percentile) of data points
// across time series for each alignment period. This reducer is valid for
// `GAUGE` and `DELTA` metrics of numeric and distribution type. The value
// of the output is `DOUBLE`.
REDUCE_PERCENTILE_99 = 9;
// Reduce by computing the [95th
// percentile](https://en.wikipedia.org/wiki/Percentile) of data points
// across time series for each alignment period. This reducer is valid for
// `GAUGE` and `DELTA` metrics of numeric and distribution type. The value
// of the output is `DOUBLE`.
REDUCE_PERCENTILE_95 = 10;
// Reduce by computing the [50th
// percentile](https://en.wikipedia.org/wiki/Percentile) of data points
// across time series for each alignment period. This reducer is valid for
// `GAUGE` and `DELTA` metrics of numeric and distribution type. The value
// of the output is `DOUBLE`.
REDUCE_PERCENTILE_50 = 11;
// Reduce by computing the [5th
// percentile](https://en.wikipedia.org/wiki/Percentile) of data points
// across time series for each alignment period. This reducer is valid for
// `GAUGE` and `DELTA` metrics of numeric and distribution type. The value
// of the output is `DOUBLE`.
REDUCE_PERCENTILE_05 = 12;
}
// The `alignment_period` specifies a time interval, in seconds, that is used
// to divide the data in all the
// [time series][google.monitoring.v3.TimeSeries] into consistent blocks of
// time. This will be done before the per-series aligner can be applied to
// the data.
//
// The value must be at least 60 seconds. If a per-series
// aligner other than `ALIGN_NONE` is specified, this field is required or an
// error is returned. If no per-series aligner is specified, or the aligner
// `ALIGN_NONE` is specified, then this field is ignored.
//
// The maximum value of the `alignment_period` is 104 weeks (2 years) for
// charts, and 90,000 seconds (25 hours) for alerting policies.
google.protobuf.Duration alignment_period = 1;
// An `Aligner` describes how to bring the data points in a single
// time series into temporal alignment. Except for `ALIGN_NONE`, all
// alignments cause all the data points in an `alignment_period` to be
// mathematically grouped together, resulting in a single data point for
// each `alignment_period` with end timestamp at the end of the period.
//
// Not all alignment operations may be applied to all time series. The valid
// choices depend on the `metric_kind` and `value_type` of the original time
// series. Alignment can change the `metric_kind` or the `value_type` of
// the time series.
//
// Time series data must be aligned in order to perform cross-time
// series reduction. If `cross_series_reducer` is specified, then
// `per_series_aligner` must be specified and not equal to `ALIGN_NONE`
// and `alignment_period` must be specified; otherwise, an error is
// returned.
Aligner per_series_aligner = 2;
// The reduction operation to be used to combine time series into a single
// time series, where the value of each data point in the resulting series is
// a function of all the already aligned values in the input time series.
//
// Not all reducer operations can be applied to all time series. The valid
// choices depend on the `metric_kind` and the `value_type` of the original
// time series. Reduction can yield a time series with a different
// `metric_kind` or `value_type` than the input time series.
//
// Time series data must first be aligned (see `per_series_aligner`) in order
// to perform cross-time series reduction. If `cross_series_reducer` is
// specified, then `per_series_aligner` must be specified, and must not be
// `ALIGN_NONE`. An `alignment_period` must also be specified; otherwise, an
// error is returned.
Reducer cross_series_reducer = 4;
// The set of fields to preserve when `cross_series_reducer` is
// specified. The `group_by_fields` determine how the time series are
// partitioned into subsets prior to applying the aggregation
// operation. Each subset contains time series that have the same
// value for each of the grouping fields. Each individual time
// series is a member of exactly one subset. The
// `cross_series_reducer` is applied to each subset of time series.
// It is not possible to reduce across different resource types, so
// this field implicitly contains `resource.type`. Fields not
// specified in `group_by_fields` are aggregated away. If
// `group_by_fields` is not specified and all the time series have
// the same resource type, then the time series are aggregated into
// a single output time series. If `cross_series_reducer` is not
// defined, this field is ignored.
repeated string group_by_fields = 5;
}
// Specifies an ordering relationship on two arguments, called `left` and
// `right`.
enum ComparisonType {
// No ordering relationship is specified.
COMPARISON_UNSPECIFIED = 0;
// True if the left argument is greater than the right argument.
COMPARISON_GT = 1;
// True if the left argument is greater than or equal to the right argument.
COMPARISON_GE = 2;
// True if the left argument is less than the right argument.
COMPARISON_LT = 3;
// True if the left argument is less than or equal to the right argument.
COMPARISON_LE = 4;
// True if the left argument is equal to the right argument.
COMPARISON_EQ = 5;
// True if the left argument is not equal to the right argument.
COMPARISON_NE = 6;
}
// The tier of service for a Workspace. Please see the
// [service tiers
// documentation](https://cloud.google.com/monitoring/workspaces/tiers) for more
// details.
enum ServiceTier {
option deprecated = true;
// An invalid sentinel value, used to indicate that a tier has not
// been provided explicitly.
SERVICE_TIER_UNSPECIFIED = 0;
// The Stackdriver Basic tier, a free tier of service that provides basic
// features, a moderate allotment of logs, and access to built-in metrics.
// A number of features are not available in this tier. For more details,
// see [the service tiers
// documentation](https://cloud.google.com/monitoring/workspaces/tiers).
SERVICE_TIER_BASIC = 1;
// The Stackdriver Premium tier, a higher, more expensive tier of service
// that provides access to all Stackdriver features, lets you use Stackdriver
// with AWS accounts, and has a larger allotments for logs and metrics. For
// more details, see [the service tiers
// documentation](https://cloud.google.com/monitoring/workspaces/tiers).
SERVICE_TIER_PREMIUM = 2;
}

View File

@@ -0,0 +1,46 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.monitoring.v3;
option csharp_namespace = "Google.Cloud.Monitoring.V3";
option go_package = "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpb";
option java_multiple_files = true;
option java_outer_classname = "DroppedLabelsProto";
option java_package = "com.google.monitoring.v3";
option php_namespace = "Google\\Cloud\\Monitoring\\V3";
option ruby_package = "Google::Cloud::Monitoring::V3";
// A set of (label, value) pairs that were removed from a Distribution
// time series during aggregation and then added as an attachment to a
// Distribution.Exemplar.
//
// The full label set for the exemplars is constructed by using the dropped
// pairs in combination with the label values that remain on the aggregated
// Distribution time series. The constructed full label set can be used to
// identify the specific entity, such as the instance or job, which might be
// contributing to a long-tail. However, with dropped labels, the storage
// requirements are reduced because only the aggregated distribution values for
// a large group of time series are stored.
//
// Note that there are no guarantees on ordering of the labels from
// exemplar-to-exemplar and from distribution-to-distribution in the same
// stream, and there may be duplicates. It is up to clients to resolve any
// ambiguities.
message DroppedLabels {
// Map from label to its value, for all labels dropped in any aggregation.
map<string, string> label = 1;
}

View File

@@ -0,0 +1,90 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.monitoring.v3;
import "google/api/resource.proto";
option csharp_namespace = "Google.Cloud.Monitoring.V3";
option go_package = "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpb";
option java_multiple_files = true;
option java_outer_classname = "GroupProto";
option java_package = "com.google.monitoring.v3";
option php_namespace = "Google\\Cloud\\Monitoring\\V3";
option ruby_package = "Google::Cloud::Monitoring::V3";
// The description of a dynamic collection of monitored resources. Each group
// has a filter that is matched against monitored resources and their associated
// metadata. If a group's filter matches an available monitored resource, then
// that resource is a member of that group. Groups can contain any number of
// monitored resources, and each monitored resource can be a member of any
// number of groups.
//
// Groups can be nested in parent-child hierarchies. The `parentName` field
// identifies an optional parent for each group. If a group has a parent, then
// the only monitored resources available to be matched by the group's filter
// are the resources contained in the parent group. In other words, a group
// contains the monitored resources that match its filter and the filters of all
// the group's ancestors. A group without a parent can contain any monitored
// resource.
//
// For example, consider an infrastructure running a set of instances with two
// user-defined tags: `"environment"` and `"role"`. A parent group has a filter,
// `environment="production"`. A child of that parent group has a filter,
// `role="transcoder"`. The parent group contains all instances in the
// production environment, regardless of their roles. The child group contains
// instances that have the transcoder role *and* are in the production
// environment.
//
// The monitored resources contained in a group can change at any moment,
// depending on what resources exist and what filters are associated with the
// group and its ancestors.
message Group {
option (google.api.resource) = {
type: "monitoring.googleapis.com/Group"
pattern: "projects/{project}/groups/{group}"
pattern: "organizations/{organization}/groups/{group}"
pattern: "folders/{folder}/groups/{group}"
pattern: "*"
};
// Output only. The name of this group. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
//
// When creating a group, this field is ignored and a new name is created
// consisting of the project specified in the call to `CreateGroup`
// and a unique `[GROUP_ID]` that is generated automatically.
string name = 1;
// A user-assigned name for this group, used only for display purposes.
string display_name = 2;
// The name of the group's parent, if it has one. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
//
// For groups with no parent, `parent_name` is the empty string, `""`.
string parent_name = 3;
// The filter used to determine which monitored resources belong to this
// group.
string filter = 5;
// If true, the members of this group are considered to be a cluster.
// The system can perform additional analysis on groups that are clusters.
bool is_cluster = 6;
}

View File

@@ -0,0 +1,290 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.monitoring.v3;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/monitored_resource.proto";
import "google/api/resource.proto";
import "google/monitoring/v3/common.proto";
import "google/monitoring/v3/group.proto";
import "google/protobuf/empty.proto";
option csharp_namespace = "Google.Cloud.Monitoring.V3";
option go_package = "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpb";
option java_multiple_files = true;
option java_outer_classname = "GroupServiceProto";
option java_package = "com.google.monitoring.v3";
option php_namespace = "Google\\Cloud\\Monitoring\\V3";
option ruby_package = "Google::Cloud::Monitoring::V3";
// The Group API lets you inspect and manage your
// [groups](#google.monitoring.v3.Group).
//
// A group is a named filter that is used to identify
// a collection of monitored resources. Groups are typically used to
// mirror the physical and/or logical topology of the environment.
// Because group membership is computed dynamically, monitored
// resources that are started in the future are automatically placed
// in matching groups. By using a group to name monitored resources in,
// for example, an alert policy, the target of that alert policy is
// updated automatically as monitored resources are added and removed
// from the infrastructure.
service GroupService {
option (google.api.default_host) = "monitoring.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform,"
"https://www.googleapis.com/auth/monitoring,"
"https://www.googleapis.com/auth/monitoring.read";
// Lists the existing groups.
rpc ListGroups(ListGroupsRequest) returns (ListGroupsResponse) {
option (google.api.http) = {
get: "/v3/{name=projects/*}/groups"
};
option (google.api.method_signature) = "name";
}
// Gets a single group.
rpc GetGroup(GetGroupRequest) returns (Group) {
option (google.api.http) = {
get: "/v3/{name=projects/*/groups/*}"
};
option (google.api.method_signature) = "name";
}
// Creates a new group.
rpc CreateGroup(CreateGroupRequest) returns (Group) {
option (google.api.http) = {
post: "/v3/{name=projects/*}/groups"
body: "group"
};
option (google.api.method_signature) = "name,group";
}
// Updates an existing group.
// You can change any group attributes except `name`.
rpc UpdateGroup(UpdateGroupRequest) returns (Group) {
option (google.api.http) = {
put: "/v3/{group.name=projects/*/groups/*}"
body: "group"
};
option (google.api.method_signature) = "group";
}
// Deletes an existing group.
rpc DeleteGroup(DeleteGroupRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v3/{name=projects/*/groups/*}"
};
option (google.api.method_signature) = "name";
}
// Lists the monitored resources that are members of a group.
rpc ListGroupMembers(ListGroupMembersRequest) returns (ListGroupMembersResponse) {
option (google.api.http) = {
get: "/v3/{name=projects/*/groups/*}/members"
};
option (google.api.method_signature) = "name";
}
}
// The `ListGroup` request.
message ListGroupsRequest {
// Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name)
// whose groups are to be listed. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]
string name = 7 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "monitoring.googleapis.com/Group"
}
];
// An optional filter consisting of a single group name. The filters limit
// the groups returned based on their parent-child relationship with the
// specified group. If no filter is specified, all groups are returned.
oneof filter {
// A group name. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
//
// Returns groups whose `parent_name` field contains the group
// name. If no groups have this parent, the results are empty.
string children_of_group = 2 [(google.api.resource_reference) = {
type: "monitoring.googleapis.com/Group"
}];
// A group name. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
//
// Returns groups that are ancestors of the specified group.
// The groups are returned in order, starting with the immediate parent and
// ending with the most distant ancestor. If the specified group has no
// immediate parent, the results are empty.
string ancestors_of_group = 3 [(google.api.resource_reference) = {
type: "monitoring.googleapis.com/Group"
}];
// A group name. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
//
// Returns the descendants of the specified group. This is a superset of
// the results returned by the `children_of_group` filter, and includes
// children-of-children, and so forth.
string descendants_of_group = 4 [(google.api.resource_reference) = {
type: "monitoring.googleapis.com/Group"
}];
}
// A positive number that is the maximum number of results to return.
int32 page_size = 5;
// If this field is not empty then it must contain the `next_page_token` value
// returned by a previous call to this method. Using this field causes the
// method to return additional results from the previous method call.
string page_token = 6;
}
// The `ListGroups` response.
message ListGroupsResponse {
// The groups that match the specified filters.
repeated Group group = 1;
// If there are more results than have been returned, then this field is set
// to a non-empty value. To see the additional results,
// use that value as `page_token` in the next call to this method.
string next_page_token = 2;
}
// The `GetGroup` request.
message GetGroupRequest {
// Required. The group to retrieve. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
string name = 3 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "monitoring.googleapis.com/Group"
}
];
}
// The `CreateGroup` request.
message CreateGroupRequest {
// Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) in
// which to create the group. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]
string name = 4 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "monitoring.googleapis.com/Group"
}
];
// Required. A group definition. It is an error to define the `name` field because
// the system assigns the name.
Group group = 2 [(google.api.field_behavior) = REQUIRED];
// If true, validate this request but do not create the group.
bool validate_only = 3;
}
// The `UpdateGroup` request.
message UpdateGroupRequest {
// Required. The new definition of the group. All fields of the existing group,
// excepting `name`, are replaced with the corresponding fields of this group.
Group group = 2 [(google.api.field_behavior) = REQUIRED];
// If true, validate this request but do not update the existing group.
bool validate_only = 3;
}
// The `DeleteGroup` request. The default behavior is to be able to delete a
// single group without any descendants.
message DeleteGroupRequest {
// Required. The group to delete. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
string name = 3 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "monitoring.googleapis.com/Group"
}
];
// If this field is true, then the request means to delete a group with all
// its descendants. Otherwise, the request means to delete a group only when
// it has no descendants. The default value is false.
bool recursive = 4;
}
// The `ListGroupMembers` request.
message ListGroupMembersRequest {
// Required. The group whose members are listed. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
string name = 7 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "monitoring.googleapis.com/Group"
}
];
// A positive number that is the maximum number of results to return.
int32 page_size = 3;
// If this field is not empty then it must contain the `next_page_token` value
// returned by a previous call to this method. Using this field causes the
// method to return additional results from the previous method call.
string page_token = 4;
// An optional [list
// filter](https://cloud.google.com/monitoring/api/learn_more#filtering)
// describing the members to be returned. The filter may reference the type,
// labels, and metadata of monitored resources that comprise the group. For
// example, to return only resources representing Compute Engine VM instances,
// use this filter:
//
// `resource.type = "gce_instance"`
string filter = 5;
// An optional time interval for which results should be returned. Only
// members that were part of the group during the specified interval are
// included in the response. If no interval is provided then the group
// membership over the last minute is returned.
TimeInterval interval = 6;
}
// The `ListGroupMembers` response.
message ListGroupMembersResponse {
// A set of monitored resources in the group.
repeated google.api.MonitoredResource members = 1;
// If there are more results than have been returned, then this field is
// set to a non-empty value. To see the additional results, use that value as
// `page_token` in the next call to this method.
string next_page_token = 2;
// The total number of elements matching this request.
int32 total_size = 3;
}

View File

@@ -0,0 +1,239 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.monitoring.v3;
import "google/api/label.proto";
import "google/api/metric.proto";
import "google/api/monitored_resource.proto";
import "google/monitoring/v3/common.proto";
option csharp_namespace = "Google.Cloud.Monitoring.V3";
option go_package = "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpb";
option java_multiple_files = true;
option java_outer_classname = "MetricProto";
option java_package = "com.google.monitoring.v3";
option php_namespace = "Google\\Cloud\\Monitoring\\V3";
option ruby_package = "Google::Cloud::Monitoring::V3";
// A single data point in a time series.
message Point {
// The time interval to which the data point applies. For `GAUGE` metrics,
// the start time is optional, but if it is supplied, it must equal the
// end time. For `DELTA` metrics, the start
// and end time should specify a non-zero interval, with subsequent points
// specifying contiguous and non-overlapping intervals. For `CUMULATIVE`
// metrics, the start and end time should specify a non-zero interval, with
// subsequent points specifying the same start time and increasing end times,
// until an event resets the cumulative value to zero and sets a new start
// time for the following points.
TimeInterval interval = 1;
// The value of the data point.
TypedValue value = 2;
}
// A collection of data points that describes the time-varying values
// of a metric. A time series is identified by a combination of a
// fully-specified monitored resource and a fully-specified metric.
// This type is used for both listing and creating time series.
message TimeSeries {
// The associated metric. A fully-specified metric used to identify the time
// series.
google.api.Metric metric = 1;
// The associated monitored resource. Custom metrics can use only certain
// monitored resource types in their time series data. For more information,
// see [Monitored resources for custom
// metrics](https://cloud.google.com/monitoring/custom-metrics/creating-metrics#custom-metric-resources).
google.api.MonitoredResource resource = 2;
// Output only. The associated monitored resource metadata. When reading a
// time series, this field will include metadata labels that are explicitly
// named in the reduction. When creating a time series, this field is ignored.
google.api.MonitoredResourceMetadata metadata = 7;
// The metric kind of the time series. When listing time series, this metric
// kind might be different from the metric kind of the associated metric if
// this time series is an alignment or reduction of other time series.
//
// When creating a time series, this field is optional. If present, it must be
// the same as the metric kind of the associated metric. If the associated
// metric's descriptor must be auto-created, then this field specifies the
// metric kind of the new descriptor and must be either `GAUGE` (the default)
// or `CUMULATIVE`.
google.api.MetricDescriptor.MetricKind metric_kind = 3;
// The value type of the time series. When listing time series, this value
// type might be different from the value type of the associated metric if
// this time series is an alignment or reduction of other time series.
//
// When creating a time series, this field is optional. If present, it must be
// the same as the type of the data in the `points` field.
google.api.MetricDescriptor.ValueType value_type = 4;
// The data points of this time series. When listing time series, points are
// returned in reverse time order.
//
// When creating a time series, this field must contain exactly one point and
// the point's type must be the same as the value type of the associated
// metric. If the associated metric's descriptor must be auto-created, then
// the value type of the descriptor is determined by the point's type, which
// must be `BOOL`, `INT64`, `DOUBLE`, or `DISTRIBUTION`.
repeated Point points = 5;
// The units in which the metric value is reported. It is only applicable
// if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit`
// defines the representation of the stored metric values.
string unit = 8;
}
// A descriptor for the labels and points in a time series.
message TimeSeriesDescriptor {
// A descriptor for the value columns in a data point.
message ValueDescriptor {
// The value key.
string key = 1;
// The value type.
google.api.MetricDescriptor.ValueType value_type = 2;
// The value stream kind.
google.api.MetricDescriptor.MetricKind metric_kind = 3;
// The unit in which `time_series` point values are reported. `unit`
// follows the UCUM format for units as seen in
// https://unitsofmeasure.org/ucum.html.
// `unit` is only valid if `value_type` is INTEGER, DOUBLE, DISTRIBUTION.
string unit = 4;
}
// Descriptors for the labels.
repeated google.api.LabelDescriptor label_descriptors = 1;
// Descriptors for the point data value columns.
repeated ValueDescriptor point_descriptors = 5;
}
// Represents the values of a time series associated with a
// TimeSeriesDescriptor.
message TimeSeriesData {
// A point's value columns and time interval. Each point has one or more
// point values corresponding to the entries in `point_descriptors` field in
// the TimeSeriesDescriptor associated with this object.
message PointData {
// The values that make up the point.
repeated TypedValue values = 1;
// The time interval associated with the point.
TimeInterval time_interval = 2;
}
// The values of the labels in the time series identifier, given in the same
// order as the `label_descriptors` field of the TimeSeriesDescriptor
// associated with this object. Each value must have a value of the type
// given in the corresponding entry of `label_descriptors`.
repeated LabelValue label_values = 1;
// The points in the time series.
repeated PointData point_data = 2;
}
// A label value.
message LabelValue {
// The label value can be a bool, int64, or string.
oneof value {
// A bool label value.
bool bool_value = 1;
// An int64 label value.
int64 int64_value = 2;
// A string label value.
string string_value = 3;
}
}
// An error associated with a query in the time series query language format.
message QueryError {
// The location of the time series query language text that this error applies
// to.
TextLocator locator = 1;
// The error message.
string message = 2;
}
// A locator for text. Indicates a particular part of the text of a request or
// of an object referenced in the request.
//
// For example, suppose the request field `text` contains:
//
// text: "The quick brown fox jumps over the lazy dog."
//
// Then the locator:
//
// source: "text"
// start_position {
// line: 1
// column: 17
// }
// end_position {
// line: 1
// column: 19
// }
//
// refers to the part of the text: "fox".
message TextLocator {
// The position of a byte within the text.
message Position {
// The line, starting with 1, where the byte is positioned.
int32 line = 1;
// The column within the line, starting with 1, where the byte is
// positioned. This is a byte index even though the text is UTF-8.
int32 column = 2;
}
// The source of the text. The source may be a field in the request, in which
// case its format is the format of the
// google.rpc.BadRequest.FieldViolation.field field in
// https://cloud.google.com/apis/design/errors#error_details. It may also be
// be a source other than the request field (e.g. a macro definition
// referenced in the text of the query), in which case this is the name of
// the source (e.g. the macro name).
string source = 1;
// The position of the first byte within the text.
Position start_position = 2;
// The position of the last byte within the text.
Position end_position = 3;
// If `source`, `start_position`, and `end_position` describe a call on
// some object (e.g. a macro in the time series query language text) and a
// location is to be designated in that object's text, `nested_locator`
// identifies the location within that object.
TextLocator nested_locator = 4;
// When `nested_locator` is set, this field gives the reason for the nesting.
// Usually, the reason is a macro invocation. In that case, the macro name
// (including the leading '@') signals the location of the macro call
// in the text and a macro argument name (including the leading '$') signals
// the location of the macro argument inside the macro body that got
// substituted away.
string nesting_reason = 5;
}

View File

@@ -0,0 +1,522 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.monitoring.v3;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/metric.proto";
import "google/api/monitored_resource.proto";
import "google/api/resource.proto";
import "google/monitoring/v3/common.proto";
import "google/monitoring/v3/metric.proto";
import "google/protobuf/empty.proto";
import "google/rpc/status.proto";
option csharp_namespace = "Google.Cloud.Monitoring.V3";
option go_package = "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpb";
option java_multiple_files = true;
option java_outer_classname = "MetricServiceProto";
option java_package = "com.google.monitoring.v3";
option php_namespace = "Google\\Cloud\\Monitoring\\V3";
option ruby_package = "Google::Cloud::Monitoring::V3";
option (google.api.resource_definition) = {
type: "monitoring.googleapis.com/MetricDescriptor"
pattern: "projects/{project}/metricDescriptors/{metric_descriptor=**}"
pattern: "organizations/{organization}/metricDescriptors/{metric_descriptor=**}"
pattern: "folders/{folder}/metricDescriptors/{metric_descriptor=**}"
pattern: "*"
history: ORIGINALLY_SINGLE_PATTERN
};
option (google.api.resource_definition) = {
type: "monitoring.googleapis.com/MonitoredResourceDescriptor"
pattern: "projects/{project}/monitoredResourceDescriptors/{monitored_resource_descriptor}"
pattern: "organizations/{organization}/monitoredResourceDescriptors/{monitored_resource_descriptor}"
pattern: "folders/{folder}/monitoredResourceDescriptors/{monitored_resource_descriptor}"
pattern: "*"
history: ORIGINALLY_SINGLE_PATTERN
};
option (google.api.resource_definition) = {
type: "monitoring.googleapis.com/Workspace"
pattern: "projects/{project}"
pattern: "workspaces/{workspace}"
};
option (google.api.resource_definition) = {
type: "monitoring.googleapis.com/TimeSeries"
pattern: "projects/{project}/timeSeries/{time_series}"
pattern: "organizations/{organization}/timeSeries/{time_series}"
pattern: "folders/{folder}/timeSeries/{time_series}"
};
// Manages metric descriptors, monitored resource descriptors, and
// time series data.
service MetricService {
option (google.api.default_host) = "monitoring.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform,"
"https://www.googleapis.com/auth/monitoring,"
"https://www.googleapis.com/auth/monitoring.read,"
"https://www.googleapis.com/auth/monitoring.write";
// Lists monitored resource descriptors that match a filter. This method does not require a Workspace.
rpc ListMonitoredResourceDescriptors(ListMonitoredResourceDescriptorsRequest) returns (ListMonitoredResourceDescriptorsResponse) {
option (google.api.http) = {
get: "/v3/{name=projects/*}/monitoredResourceDescriptors"
};
option (google.api.method_signature) = "name";
}
// Gets a single monitored resource descriptor. This method does not require a Workspace.
rpc GetMonitoredResourceDescriptor(GetMonitoredResourceDescriptorRequest) returns (google.api.MonitoredResourceDescriptor) {
option (google.api.http) = {
get: "/v3/{name=projects/*/monitoredResourceDescriptors/**}"
};
option (google.api.method_signature) = "name";
}
// Lists metric descriptors that match a filter. This method does not require a Workspace.
rpc ListMetricDescriptors(ListMetricDescriptorsRequest) returns (ListMetricDescriptorsResponse) {
option (google.api.http) = {
get: "/v3/{name=projects/*}/metricDescriptors"
};
option (google.api.method_signature) = "name";
}
// Gets a single metric descriptor. This method does not require a Workspace.
rpc GetMetricDescriptor(GetMetricDescriptorRequest) returns (google.api.MetricDescriptor) {
option (google.api.http) = {
get: "/v3/{name=projects/*/metricDescriptors/**}"
};
option (google.api.method_signature) = "name";
}
// Creates a new metric descriptor.
// The creation is executed asynchronously and callers may check the returned
// operation to track its progress.
// User-created metric descriptors define
// [custom metrics](https://cloud.google.com/monitoring/custom-metrics).
rpc CreateMetricDescriptor(CreateMetricDescriptorRequest) returns (google.api.MetricDescriptor) {
option (google.api.http) = {
post: "/v3/{name=projects/*}/metricDescriptors"
body: "metric_descriptor"
};
option (google.api.method_signature) = "name,metric_descriptor";
}
// Deletes a metric descriptor. Only user-created
// [custom metrics](https://cloud.google.com/monitoring/custom-metrics) can be
// deleted.
rpc DeleteMetricDescriptor(DeleteMetricDescriptorRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v3/{name=projects/*/metricDescriptors/**}"
};
option (google.api.method_signature) = "name";
}
// Lists time series that match a filter. This method does not require a Workspace.
rpc ListTimeSeries(ListTimeSeriesRequest) returns (ListTimeSeriesResponse) {
option (google.api.http) = {
get: "/v3/{name=projects/*}/timeSeries"
additional_bindings {
get: "/v3/{name=organizations/*}/timeSeries"
}
additional_bindings {
get: "/v3/{name=folders/*}/timeSeries"
}
};
option (google.api.method_signature) = "name,filter,interval,view";
}
// Creates or adds data to one or more time series.
// The response is empty if all time series in the request were written.
// If any time series could not be written, a corresponding failure message is
// included in the error response.
rpc CreateTimeSeries(CreateTimeSeriesRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/v3/{name=projects/*}/timeSeries"
body: "*"
};
option (google.api.method_signature) = "name,time_series";
}
// Creates or adds data to one or more service time series. A service time
// series is a time series for a metric from a Google Cloud service. The
// response is empty if all time series in the request were written. If any
// time series could not be written, a corresponding failure message is
// included in the error response. This endpoint rejects writes to
// user-defined metrics.
// This method is only for use by Google Cloud services. Use
// [projects.timeSeries.create][google.monitoring.v3.MetricService.CreateTimeSeries]
// instead.
rpc CreateServiceTimeSeries(CreateTimeSeriesRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/v3/{name=projects/*}/timeSeries:createService"
body: "*"
};
option (google.api.method_signature) = "name,time_series";
}
}
// The `ListMonitoredResourceDescriptors` request.
message ListMonitoredResourceDescriptorsRequest {
// Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) on
// which to execute the request. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]
string name = 5 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "monitoring.googleapis.com/MonitoredResourceDescriptor"
}
];
// An optional [filter](https://cloud.google.com/monitoring/api/v3/filters)
// describing the descriptors to be returned. The filter can reference the
// descriptor's type and labels. For example, the following filter returns
// only Google Compute Engine descriptors that have an `id` label:
//
// resource.type = starts_with("gce_") AND resource.label:id
string filter = 2;
// A positive number that is the maximum number of results to return.
int32 page_size = 3;
// If this field is not empty then it must contain the `nextPageToken` value
// returned by a previous call to this method. Using this field causes the
// method to return additional results from the previous method call.
string page_token = 4;
}
// The `ListMonitoredResourceDescriptors` response.
message ListMonitoredResourceDescriptorsResponse {
// The monitored resource descriptors that are available to this project
// and that match `filter`, if present.
repeated google.api.MonitoredResourceDescriptor resource_descriptors = 1;
// If there are more results than have been returned, then this field is set
// to a non-empty value. To see the additional results,
// use that value as `page_token` in the next call to this method.
string next_page_token = 2;
}
// The `GetMonitoredResourceDescriptor` request.
message GetMonitoredResourceDescriptorRequest {
// Required. The monitored resource descriptor to get. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/monitoredResourceDescriptors/[RESOURCE_TYPE]
//
// The `[RESOURCE_TYPE]` is a predefined type, such as
// `cloudsql_database`.
string name = 3 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "monitoring.googleapis.com/MonitoredResourceDescriptor"
}
];
}
// The `ListMetricDescriptors` request.
message ListMetricDescriptorsRequest {
// Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) on
// which to execute the request. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]
string name = 5 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "monitoring.googleapis.com/MetricDescriptor"
}
];
// If this field is empty, all custom and
// system-defined metric descriptors are returned.
// Otherwise, the [filter](https://cloud.google.com/monitoring/api/v3/filters)
// specifies which metric descriptors are to be
// returned. For example, the following filter matches all
// [custom metrics](https://cloud.google.com/monitoring/custom-metrics):
//
// metric.type = starts_with("custom.googleapis.com/")
string filter = 2;
// A positive number that is the maximum number of results to return.
int32 page_size = 3;
// If this field is not empty then it must contain the `nextPageToken` value
// returned by a previous call to this method. Using this field causes the
// method to return additional results from the previous method call.
string page_token = 4;
}
// The `ListMetricDescriptors` response.
message ListMetricDescriptorsResponse {
// The metric descriptors that are available to the project
// and that match the value of `filter`, if present.
repeated google.api.MetricDescriptor metric_descriptors = 1;
// If there are more results than have been returned, then this field is set
// to a non-empty value. To see the additional results,
// use that value as `page_token` in the next call to this method.
string next_page_token = 2;
}
// The `GetMetricDescriptor` request.
message GetMetricDescriptorRequest {
// Required. The metric descriptor on which to execute the request. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID]
//
// An example value of `[METRIC_ID]` is
// `"compute.googleapis.com/instance/disk/read_bytes_count"`.
string name = 3 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "monitoring.googleapis.com/MetricDescriptor"
}
];
}
// The `CreateMetricDescriptor` request.
message CreateMetricDescriptorRequest {
// Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) on
// which to execute the request. The format is:
// 4
// projects/[PROJECT_ID_OR_NUMBER]
string name = 3 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "monitoring.googleapis.com/MetricDescriptor"
}
];
// Required. The new [custom metric](https://cloud.google.com/monitoring/custom-metrics)
// descriptor.
google.api.MetricDescriptor metric_descriptor = 2 [(google.api.field_behavior) = REQUIRED];
}
// The `DeleteMetricDescriptor` request.
message DeleteMetricDescriptorRequest {
// Required. The metric descriptor on which to execute the request. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID]
//
// An example of `[METRIC_ID]` is:
// `"custom.googleapis.com/my_test_metric"`.
string name = 3 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "monitoring.googleapis.com/MetricDescriptor"
}
];
}
// The `ListTimeSeries` request.
message ListTimeSeriesRequest {
// Controls which fields are returned by `ListTimeSeries`.
enum TimeSeriesView {
// Returns the identity of the metric(s), the time series,
// and the time series data.
FULL = 0;
// Returns the identity of the metric and the time series resource,
// but not the time series data.
HEADERS = 1;
}
// Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name),
// organization or folder on which to execute the request. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]
// organizations/[ORGANIZATION_ID]
// folders/[FOLDER_ID]
string name = 10 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "monitoring.googleapis.com/TimeSeries"
}
];
// Required. A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
// that specifies which time series should be returned. The filter must
// specify a single metric type, and can additionally specify metric labels
// and other information. For example:
//
// metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND
// metric.labels.instance_name = "my-instance-name"
string filter = 2 [(google.api.field_behavior) = REQUIRED];
// Required. The time interval for which results should be returned. Only time series
// that contain data points in the specified interval are included
// in the response.
TimeInterval interval = 4 [(google.api.field_behavior) = REQUIRED];
// Specifies the alignment of data points in individual time series as
// well as how to combine the retrieved time series across specified labels.
//
// By default (if no `aggregation` is explicitly specified), the raw time
// series data is returned.
Aggregation aggregation = 5;
// Apply a second aggregation after `aggregation` is applied. May only be
// specified if `aggregation` is specified.
Aggregation secondary_aggregation = 11;
// Unsupported: must be left blank. The points in each time series are
// currently returned in reverse time order (most recent to oldest).
string order_by = 6;
// Required. Specifies which information is returned about the time series.
TimeSeriesView view = 7 [(google.api.field_behavior) = REQUIRED];
// A positive number that is the maximum number of results to return. If
// `page_size` is empty or more than 100,000 results, the effective
// `page_size` is 100,000 results. If `view` is set to `FULL`, this is the
// maximum number of `Points` returned. If `view` is set to `HEADERS`, this is
// the maximum number of `TimeSeries` returned.
int32 page_size = 8;
// If this field is not empty then it must contain the `nextPageToken` value
// returned by a previous call to this method. Using this field causes the
// method to return additional results from the previous method call.
string page_token = 9;
}
// The `ListTimeSeries` response.
message ListTimeSeriesResponse {
// One or more time series that match the filter included in the request.
repeated TimeSeries time_series = 1;
// If there are more results than have been returned, then this field is set
// to a non-empty value. To see the additional results,
// use that value as `page_token` in the next call to this method.
string next_page_token = 2;
// Query execution errors that may have caused the time series data returned
// to be incomplete.
repeated google.rpc.Status execution_errors = 3;
// The unit in which all `time_series` point values are reported. `unit`
// follows the UCUM format for units as seen in
// https://unitsofmeasure.org/ucum.html.
// If different `time_series` have different units (for example, because they
// come from different metric types, or a unit is absent), then `unit` will be
// "{not_a_unit}".
string unit = 5;
}
// The `CreateTimeSeries` request.
message CreateTimeSeriesRequest {
// Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) on
// which to execute the request. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]
string name = 3 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "cloudresourcemanager.googleapis.com/Project"
}
];
// Required. The new data to be added to a list of time series.
// Adds at most one data point to each of several time series. The new data
// point must be more recent than any other point in its time series. Each
// `TimeSeries` value must fully specify a unique time series by supplying
// all label values for the metric and the monitored resource.
//
// The maximum number of `TimeSeries` objects per `Create` request is 200.
repeated TimeSeries time_series = 2 [(google.api.field_behavior) = REQUIRED];
}
// DEPRECATED. Used to hold per-time-series error status.
message CreateTimeSeriesError {
// DEPRECATED. Time series ID that resulted in the `status` error.
TimeSeries time_series = 1 [deprecated = true];
// DEPRECATED. The status of the requested write operation for `time_series`.
google.rpc.Status status = 2 [deprecated = true];
}
// Summary of the result of a failed request to write data to a time series.
message CreateTimeSeriesSummary {
// Detailed information about an error category.
message Error {
// The status of the requested write operation.
google.rpc.Status status = 1;
// The number of points that couldn't be written because of `status`.
int32 point_count = 2;
}
// The number of points in the request.
int32 total_point_count = 1;
// The number of points that were successfully written.
int32 success_point_count = 2;
// The number of points that failed to be written. Order is not guaranteed.
repeated Error errors = 3;
}
// The `QueryTimeSeries` request.
message QueryTimeSeriesRequest {
// Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) on
// which to execute the request. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]
string name = 1 [(google.api.field_behavior) = REQUIRED];
// Required. The query in the [Monitoring Query
// Language](https://cloud.google.com/monitoring/mql/reference) format.
// The default time zone is in UTC.
string query = 7 [(google.api.field_behavior) = REQUIRED];
// A positive number that is the maximum number of time_series_data to return.
int32 page_size = 9;
// If this field is not empty then it must contain the `nextPageToken` value
// returned by a previous call to this method. Using this field causes the
// method to return additional results from the previous method call.
string page_token = 10;
}
// The `QueryTimeSeries` response.
message QueryTimeSeriesResponse {
// The descriptor for the time series data.
TimeSeriesDescriptor time_series_descriptor = 8;
// The time series data.
repeated TimeSeriesData time_series_data = 9;
// If there are more results than have been returned, then this field is set
// to a non-empty value. To see the additional results, use that value as
// `page_token` in the next call to this method.
string next_page_token = 10;
// Query execution errors that may have caused the time series data returned
// to be incomplete. The available data will be available in the
// response.
repeated google.rpc.Status partial_errors = 11;
}
// This is an error detail intended to be used with INVALID_ARGUMENT errors.
message QueryErrorList {
// Errors in parsing the time series query language text. The number of errors
// in the response may be limited.
repeated QueryError errors = 1;
// A summary of all the errors.
string error_summary = 2;
}

View File

@@ -0,0 +1,36 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.monitoring.v3;
import "google/protobuf/timestamp.proto";
option csharp_namespace = "Google.Cloud.Monitoring.V3";
option go_package = "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpb";
option java_multiple_files = true;
option java_outer_classname = "MutationRecordProto";
option java_package = "com.google.monitoring.v3";
option php_namespace = "Google\\Cloud\\Monitoring\\V3";
option ruby_package = "Google::Cloud::Monitoring::V3";
// Describes a change made to a configuration.
message MutationRecord {
// When the change occurred.
google.protobuf.Timestamp mutate_time = 1;
// The email address of the user making the change.
string mutated_by = 2;
}

View File

@@ -0,0 +1,195 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.monitoring.v3;
import "google/api/label.proto";
import "google/api/launch_stage.proto";
import "google/api/resource.proto";
import "google/monitoring/v3/common.proto";
import "google/monitoring/v3/mutation_record.proto";
import "google/protobuf/wrappers.proto";
option csharp_namespace = "Google.Cloud.Monitoring.V3";
option go_package = "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpb";
option java_multiple_files = true;
option java_outer_classname = "NotificationProto";
option java_package = "com.google.monitoring.v3";
option php_namespace = "Google\\Cloud\\Monitoring\\V3";
option ruby_package = "Google::Cloud::Monitoring::V3";
// A description of a notification channel. The descriptor includes
// the properties of the channel and the set of labels or fields that
// must be specified to configure channels of a given type.
message NotificationChannelDescriptor {
option (google.api.resource) = {
type: "monitoring.googleapis.com/NotificationChannelDescriptor"
pattern: "projects/{project}/notificationChannelDescriptors/{channel_descriptor}"
pattern: "organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}"
pattern: "folders/{folder}/notificationChannelDescriptors/{channel_descriptor}"
pattern: "*"
};
// The full REST resource name for this descriptor. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/notificationChannelDescriptors/[TYPE]
//
// In the above, `[TYPE]` is the value of the `type` field.
string name = 6;
// The type of notification channel, such as "email" and "sms". To view the
// full list of channels, see
// [Channel
// descriptors](https://cloud.google.com/monitoring/alerts/using-channels-api#ncd).
// Notification channel types are globally unique.
string type = 1;
// A human-readable name for the notification channel type. This
// form of the name is suitable for a user interface.
string display_name = 2;
// A human-readable description of the notification channel
// type. The description may include a description of the properties
// of the channel and pointers to external documentation.
string description = 3;
// The set of labels that must be defined to identify a particular
// channel of the corresponding type. Each label includes a
// description for how that field should be populated.
repeated google.api.LabelDescriptor labels = 4;
// The tiers that support this notification channel; the project service tier
// must be one of the supported_tiers.
repeated ServiceTier supported_tiers = 5 [deprecated = true];
// The product launch stage for channels of this type.
google.api.LaunchStage launch_stage = 7;
}
// A `NotificationChannel` is a medium through which an alert is
// delivered when a policy violation is detected. Examples of channels
// include email, SMS, and third-party messaging applications. Fields
// containing sensitive information like authentication tokens or
// contact info are only partially populated on retrieval.
message NotificationChannel {
option (google.api.resource) = {
type: "monitoring.googleapis.com/NotificationChannel"
pattern: "projects/{project}/notificationChannels/{notification_channel}"
pattern: "organizations/{organization}/notificationChannels/{notification_channel}"
pattern: "folders/{folder}/notificationChannels/{notification_channel}"
pattern: "*"
};
// Indicates whether the channel has been verified or not. It is illegal
// to specify this field in a
// [`CreateNotificationChannel`][google.monitoring.v3.NotificationChannelService.CreateNotificationChannel]
// or an
// [`UpdateNotificationChannel`][google.monitoring.v3.NotificationChannelService.UpdateNotificationChannel]
// operation.
enum VerificationStatus {
// Sentinel value used to indicate that the state is unknown, omitted, or
// is not applicable (as in the case of channels that neither support
// nor require verification in order to function).
VERIFICATION_STATUS_UNSPECIFIED = 0;
// The channel has yet to be verified and requires verification to function.
// Note that this state also applies to the case where the verification
// process has been initiated by sending a verification code but where
// the verification code has not been submitted to complete the process.
UNVERIFIED = 1;
// It has been proven that notifications can be received on this
// notification channel and that someone on the project has access
// to messages that are delivered to that channel.
VERIFIED = 2;
}
// The type of the notification channel. This field matches the
// value of the
// [NotificationChannelDescriptor.type][google.monitoring.v3.NotificationChannelDescriptor.type]
// field.
string type = 1;
// The full REST resource name for this channel. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
//
// The `[CHANNEL_ID]` is automatically assigned by the server on creation.
string name = 6;
// An optional human-readable name for this notification channel. It is
// recommended that you specify a non-empty and unique name in order to
// make it easier to identify the channels in your project, though this is
// not enforced. The display name is limited to 512 Unicode characters.
string display_name = 3;
// An optional human-readable description of this notification channel. This
// description may provide additional details, beyond the display
// name, for the channel. This may not exceed 1024 Unicode characters.
string description = 4;
// Configuration fields that define the channel and its behavior. The
// permissible and required labels are specified in the
// [NotificationChannelDescriptor.labels][google.monitoring.v3.NotificationChannelDescriptor.labels]
// of the `NotificationChannelDescriptor` corresponding to the `type` field.
map<string, string> labels = 5;
// User-supplied key/value data that does not need to conform to
// the corresponding `NotificationChannelDescriptor`'s schema, unlike
// the `labels` field. This field is intended to be used for organizing
// and identifying the `NotificationChannel` objects.
//
// The field can contain up to 64 entries. Each key and value is limited to
// 63 Unicode characters or 128 bytes, whichever is smaller. Labels and
// values can contain only lowercase letters, numerals, underscores, and
// dashes. Keys must begin with a letter.
map<string, string> user_labels = 8;
// Indicates whether this channel has been verified or not. On a
// [`ListNotificationChannels`][google.monitoring.v3.NotificationChannelService.ListNotificationChannels]
// or
// [`GetNotificationChannel`][google.monitoring.v3.NotificationChannelService.GetNotificationChannel]
// operation, this field is expected to be populated.
//
// If the value is `UNVERIFIED`, then it indicates that the channel is
// non-functioning (it both requires verification and lacks verification);
// otherwise, it is assumed that the channel works.
//
// If the channel is neither `VERIFIED` nor `UNVERIFIED`, it implies that
// the channel is of a type that does not require verification or that
// this specific channel has been exempted from verification because it was
// created prior to verification being required for channels of this type.
//
// This field cannot be modified using a standard
// [`UpdateNotificationChannel`][google.monitoring.v3.NotificationChannelService.UpdateNotificationChannel]
// operation. To change the value of this field, you must call
// [`VerifyNotificationChannel`][google.monitoring.v3.NotificationChannelService.VerifyNotificationChannel].
VerificationStatus verification_status = 9;
// Whether notifications are forwarded to the described channel. This makes
// it possible to disable delivery of notifications to a particular channel
// without removing the channel from all alerting policies that reference
// the channel. This is a more convenient approach when the change is
// temporary and you want to receive notifications from the same set
// of alerting policies on the channel at some point in the future.
google.protobuf.BoolValue enabled = 11;
// Record of the creation of this channel.
MutationRecord creation_record = 12;
// Records of the modification of this channel.
repeated MutationRecord mutation_records = 13;
}

View File

@@ -0,0 +1,448 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.monitoring.v3;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/monitoring/v3/notification.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";
option csharp_namespace = "Google.Cloud.Monitoring.V3";
option go_package = "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpb";
option java_multiple_files = true;
option java_outer_classname = "NotificationServiceProto";
option java_package = "com.google.monitoring.v3";
option php_namespace = "Google\\Cloud\\Monitoring\\V3";
option ruby_package = "Google::Cloud::Monitoring::V3";
// The Notification Channel API provides access to configuration that
// controls how messages related to incidents are sent.
service NotificationChannelService {
option (google.api.default_host) = "monitoring.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform,"
"https://www.googleapis.com/auth/monitoring,"
"https://www.googleapis.com/auth/monitoring.read";
// Lists the descriptors for supported channel types. The use of descriptors
// makes it possible for new channel types to be dynamically added.
rpc ListNotificationChannelDescriptors(
ListNotificationChannelDescriptorsRequest)
returns (ListNotificationChannelDescriptorsResponse) {
option (google.api.http) = {
get: "/v3/{name=projects/*}/notificationChannelDescriptors"
};
option (google.api.method_signature) = "name";
}
// Gets a single channel descriptor. The descriptor indicates which fields
// are expected / permitted for a notification channel of the given type.
rpc GetNotificationChannelDescriptor(GetNotificationChannelDescriptorRequest)
returns (NotificationChannelDescriptor) {
option (google.api.http) = {
get: "/v3/{name=projects/*/notificationChannelDescriptors/*}"
};
option (google.api.method_signature) = "name";
}
// Lists the notification channels that have been created for the project.
// To list the types of notification channels that are supported, use
// the `ListNotificationChannelDescriptors` method.
rpc ListNotificationChannels(ListNotificationChannelsRequest)
returns (ListNotificationChannelsResponse) {
option (google.api.http) = {
get: "/v3/{name=projects/*}/notificationChannels"
};
option (google.api.method_signature) = "name";
}
// Gets a single notification channel. The channel includes the relevant
// configuration details with which the channel was created. However, the
// response may truncate or omit passwords, API keys, or other private key
// matter and thus the response may not be 100% identical to the information
// that was supplied in the call to the create method.
rpc GetNotificationChannel(GetNotificationChannelRequest)
returns (NotificationChannel) {
option (google.api.http) = {
get: "/v3/{name=projects/*/notificationChannels/*}"
};
option (google.api.method_signature) = "name";
}
// Creates a new notification channel, representing a single notification
// endpoint such as an email address, SMS number, or PagerDuty service.
//
// Design your application to single-thread API calls that modify the state of
// notification channels in a single project. This includes calls to
// CreateNotificationChannel, DeleteNotificationChannel and
// UpdateNotificationChannel.
rpc CreateNotificationChannel(CreateNotificationChannelRequest)
returns (NotificationChannel) {
option (google.api.http) = {
post: "/v3/{name=projects/*}/notificationChannels"
body: "notification_channel"
};
option (google.api.method_signature) = "name,notification_channel";
}
// Updates a notification channel. Fields not specified in the field mask
// remain unchanged.
//
// Design your application to single-thread API calls that modify the state of
// notification channels in a single project. This includes calls to
// CreateNotificationChannel, DeleteNotificationChannel and
// UpdateNotificationChannel.
rpc UpdateNotificationChannel(UpdateNotificationChannelRequest)
returns (NotificationChannel) {
option (google.api.http) = {
patch: "/v3/{notification_channel.name=projects/*/notificationChannels/*}"
body: "notification_channel"
};
option (google.api.method_signature) = "update_mask,notification_channel";
}
// Deletes a notification channel.
//
// Design your application to single-thread API calls that modify the state of
// notification channels in a single project. This includes calls to
// CreateNotificationChannel, DeleteNotificationChannel and
// UpdateNotificationChannel.
rpc DeleteNotificationChannel(DeleteNotificationChannelRequest)
returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v3/{name=projects/*/notificationChannels/*}"
};
option (google.api.method_signature) = "name,force";
}
// Causes a verification code to be delivered to the channel. The code
// can then be supplied in `VerifyNotificationChannel` to verify the channel.
rpc SendNotificationChannelVerificationCode(
SendNotificationChannelVerificationCodeRequest)
returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/v3/{name=projects/*/notificationChannels/*}:sendVerificationCode"
body: "*"
};
option (google.api.method_signature) = "name";
}
// Requests a verification code for an already verified channel that can then
// be used in a call to VerifyNotificationChannel() on a different channel
// with an equivalent identity in the same or in a different project. This
// makes it possible to copy a channel between projects without requiring
// manual reverification of the channel. If the channel is not in the
// verified state, this method will fail (in other words, this may only be
// used if the SendNotificationChannelVerificationCode and
// VerifyNotificationChannel paths have already been used to put the given
// channel into the verified state).
//
// There is no guarantee that the verification codes returned by this method
// will be of a similar structure or form as the ones that are delivered
// to the channel via SendNotificationChannelVerificationCode; while
// VerifyNotificationChannel() will recognize both the codes delivered via
// SendNotificationChannelVerificationCode() and returned from
// GetNotificationChannelVerificationCode(), it is typically the case that
// the verification codes delivered via
// SendNotificationChannelVerificationCode() will be shorter and also
// have a shorter expiration (e.g. codes such as "G-123456") whereas
// GetVerificationCode() will typically return a much longer, websafe base
// 64 encoded string that has a longer expiration time.
rpc GetNotificationChannelVerificationCode(
GetNotificationChannelVerificationCodeRequest)
returns (GetNotificationChannelVerificationCodeResponse) {
option (google.api.http) = {
post: "/v3/{name=projects/*/notificationChannels/*}:getVerificationCode"
body: "*"
};
option (google.api.method_signature) = "name";
}
// Verifies a `NotificationChannel` by proving receipt of the code
// delivered to the channel as a result of calling
// `SendNotificationChannelVerificationCode`.
rpc VerifyNotificationChannel(VerifyNotificationChannelRequest)
returns (NotificationChannel) {
option (google.api.http) = {
post: "/v3/{name=projects/*/notificationChannels/*}:verify"
body: "*"
};
option (google.api.method_signature) = "name,code";
}
}
// The `ListNotificationChannelDescriptors` request.
message ListNotificationChannelDescriptorsRequest {
// Required. The REST resource name of the parent from which to retrieve
// the notification channel descriptors. The expected syntax is:
//
// projects/[PROJECT_ID_OR_NUMBER]
//
// Note that this
// [names](https://cloud.google.com/monitoring/api/v3#project_name) the parent
// container in which to look for the descriptors; to retrieve a single
// descriptor by name, use the
// [GetNotificationChannelDescriptor][google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor]
// operation, instead.
string name = 4 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "monitoring.googleapis.com/NotificationChannelDescriptor"
}
];
// The maximum number of results to return in a single response. If
// not set to a positive number, a reasonable value will be chosen by the
// service.
int32 page_size = 2;
// If non-empty, `page_token` must contain a value returned as the
// `next_page_token` in a previous response to request the next set
// of results.
string page_token = 3;
}
// The `ListNotificationChannelDescriptors` response.
message ListNotificationChannelDescriptorsResponse {
// The monitored resource descriptors supported for the specified
// project, optionally filtered.
repeated NotificationChannelDescriptor channel_descriptors = 1;
// If not empty, indicates that there may be more results that match
// the request. Use the value in the `page_token` field in a
// subsequent request to fetch the next set of results. If empty,
// all results have been returned.
string next_page_token = 2;
}
// The `GetNotificationChannelDescriptor` response.
message GetNotificationChannelDescriptorRequest {
// Required. The channel type for which to execute the request. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/notificationChannelDescriptors/[CHANNEL_TYPE]
string name = 3 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "monitoring.googleapis.com/NotificationChannelDescriptor"
}
];
}
// The `CreateNotificationChannel` request.
message CreateNotificationChannelRequest {
// Required. The
// [project](https://cloud.google.com/monitoring/api/v3#project_name) on which
// to execute the request. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]
//
// This names the container into which the channel will be
// written, this does not name the newly created channel. The resulting
// channel's name will have a normalized version of this field as a prefix,
// but will add `/notificationChannels/[CHANNEL_ID]` to identify the channel.
string name = 3 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "monitoring.googleapis.com/NotificationChannel"
}
];
// Required. The definition of the `NotificationChannel` to create.
NotificationChannel notification_channel = 2
[(google.api.field_behavior) = REQUIRED];
}
// The `ListNotificationChannels` request.
message ListNotificationChannelsRequest {
// Required. The
// [project](https://cloud.google.com/monitoring/api/v3#project_name) on which
// to execute the request. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]
//
// This names the container
// in which to look for the notification channels; it does not name a
// specific channel. To query a specific channel by REST resource name, use
// the
// [`GetNotificationChannel`][google.monitoring.v3.NotificationChannelService.GetNotificationChannel]
// operation.
string name = 5 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "monitoring.googleapis.com/NotificationChannel"
}
];
// If provided, this field specifies the criteria that must be met by
// notification channels to be included in the response.
//
// For more details, see [sorting and
// filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering).
string filter = 6;
// A comma-separated list of fields by which to sort the result. Supports
// the same set of fields as in `filter`. Entries can be prefixed with
// a minus sign to sort in descending rather than ascending order.
//
// For more details, see [sorting and
// filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering).
string order_by = 7;
// The maximum number of results to return in a single response. If
// not set to a positive number, a reasonable value will be chosen by the
// service.
int32 page_size = 3;
// If non-empty, `page_token` must contain a value returned as the
// `next_page_token` in a previous response to request the next set
// of results.
string page_token = 4;
}
// The `ListNotificationChannels` response.
message ListNotificationChannelsResponse {
// The notification channels defined for the specified project.
repeated NotificationChannel notification_channels = 3;
// If not empty, indicates that there may be more results that match
// the request. Use the value in the `page_token` field in a
// subsequent request to fetch the next set of results. If empty,
// all results have been returned.
string next_page_token = 2;
// The total number of notification channels in all pages. This number is only
// an estimate, and may change in subsequent pages. https://aip.dev/158
int32 total_size = 4;
}
// The `GetNotificationChannel` request.
message GetNotificationChannelRequest {
// Required. The channel for which to execute the request. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
string name = 3 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "monitoring.googleapis.com/NotificationChannel"
}
];
}
// The `UpdateNotificationChannel` request.
message UpdateNotificationChannelRequest {
// The fields to update.
google.protobuf.FieldMask update_mask = 2;
// Required. A description of the changes to be applied to the specified
// notification channel. The description must provide a definition for
// fields to be updated; the names of these fields should also be
// included in the `update_mask`.
NotificationChannel notification_channel = 3
[(google.api.field_behavior) = REQUIRED];
}
// The `DeleteNotificationChannel` request.
message DeleteNotificationChannelRequest {
// Required. The channel for which to execute the request. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
string name = 3 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "monitoring.googleapis.com/NotificationChannel"
}
];
// If true, the notification channel will be deleted regardless of its
// use in alert policies (the policies will be updated to remove the
// channel). If false, channels that are still referenced by an existing
// alerting policy will fail to be deleted in a delete operation.
bool force = 5;
}
// The `SendNotificationChannelVerificationCode` request.
message SendNotificationChannelVerificationCodeRequest {
// Required. The notification channel to which to send a verification code.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "monitoring.googleapis.com/NotificationChannel"
}
];
}
// The `GetNotificationChannelVerificationCode` request.
message GetNotificationChannelVerificationCodeRequest {
// Required. The notification channel for which a verification code is to be
// generated and retrieved. This must name a channel that is already verified;
// if the specified channel is not verified, the request will fail.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "monitoring.googleapis.com/NotificationChannel"
}
];
// The desired expiration time. If specified, the API will guarantee that
// the returned code will not be valid after the specified timestamp;
// however, the API cannot guarantee that the returned code will be
// valid for at least as long as the requested time (the API puts an upper
// bound on the amount of time for which a code may be valid). If omitted,
// a default expiration will be used, which may be less than the max
// permissible expiration (so specifying an expiration may extend the
// code's lifetime over omitting an expiration, even though the API does
// impose an upper limit on the maximum expiration that is permitted).
google.protobuf.Timestamp expire_time = 2;
}
// The `GetNotificationChannelVerificationCode` request.
message GetNotificationChannelVerificationCodeResponse {
// The verification code, which may be used to verify other channels
// that have an equivalent identity (i.e. other channels of the same
// type with the same fingerprint such as other email channels with
// the same email address or other sms channels with the same number).
string code = 1;
// The expiration time associated with the code that was returned. If
// an expiration was provided in the request, this is the minimum of the
// requested expiration in the request and the max permitted expiration.
google.protobuf.Timestamp expire_time = 2;
}
// The `VerifyNotificationChannel` request.
message VerifyNotificationChannelRequest {
// Required. The notification channel to verify.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "monitoring.googleapis.com/NotificationChannel"
}
];
// Required. The verification code that was delivered to the channel as
// a result of invoking the `SendNotificationChannelVerificationCode` API
// method or that was retrieved from a verified channel via
// `GetNotificationChannelVerificationCode`. For example, one might have
// "G-123456" or "TKNZGhhd2EyN3I1MnRnMjRv" (in general, one is only
// guaranteed that the code is valid UTF-8; one should not
// make any assumptions regarding the structure or format of the code).
string code = 2 [(google.api.field_behavior) = REQUIRED];
}

View File

@@ -0,0 +1,48 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.monitoring.v3;
import "google/api/annotations.proto";
import "google/monitoring/v3/metric_service.proto";
import "google/api/client.proto";
option csharp_namespace = "Google.Cloud.Monitoring.V3";
option go_package = "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpb";
option java_multiple_files = true;
option java_outer_classname = "QueryServiceProto";
option java_package = "com.google.monitoring.v3";
option php_namespace = "Google\\Cloud\\Monitoring\\V3";
option ruby_package = "Google::Cloud::Monitoring::V3";
// The QueryService API is used to manage time series data in Stackdriver
// Monitoring. Time series data is a collection of data points that describes
// the time-varying values of a metric.
service QueryService {
option (google.api.default_host) = "monitoring.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform,"
"https://www.googleapis.com/auth/monitoring,"
"https://www.googleapis.com/auth/monitoring.read";
// Queries time series using Monitoring Query Language. This method does not require a Workspace.
rpc QueryTimeSeries(QueryTimeSeriesRequest) returns (QueryTimeSeriesResponse) {
option (google.api.http) = {
post: "/v3/{name=projects/*}/timeSeries:query"
body: "*"
};
}
}

View File

@@ -0,0 +1,457 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.monitoring.v3;
import "google/api/resource.proto";
import "google/protobuf/duration.proto";
import "google/type/calendar_period.proto";
option csharp_namespace = "Google.Cloud.Monitoring.V3";
option go_package = "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpb";
option java_multiple_files = true;
option java_outer_classname = "ServiceMonitoringProto";
option java_package = "com.google.monitoring.v3";
option php_namespace = "Google\\Cloud\\Monitoring\\V3";
option ruby_package = "Google::Cloud::Monitoring::V3";
// A `Service` is a discrete, autonomous, and network-accessible unit, designed
// to solve an individual concern
// ([Wikipedia](https://en.wikipedia.org/wiki/Service-orientation)). In
// Cloud Monitoring, a `Service` acts as the root resource under which
// operational aspects of the service are accessible.
message Service {
option (google.api.resource) = {
type: "monitoring.googleapis.com/Service"
pattern: "projects/{project}/services/{service}"
pattern: "organizations/{organization}/services/{service}"
pattern: "folders/{folder}/services/{service}"
pattern: "*"
};
// Custom view of service telemetry. Currently a place-holder pending final
// design.
message Custom {
}
// App Engine service. Learn more at https://cloud.google.com/appengine.
message AppEngine {
// The ID of the App Engine module underlying this service. Corresponds to
// the `module_id` resource label in the `gae_app` monitored resource:
// https://cloud.google.com/monitoring/api/resources#tag_gae_app
string module_id = 1;
}
// Cloud Endpoints service. Learn more at https://cloud.google.com/endpoints.
message CloudEndpoints {
// The name of the Cloud Endpoints service underlying this service.
// Corresponds to the `service` resource label in the `api` monitored
// resource: https://cloud.google.com/monitoring/api/resources#tag_api
string service = 1;
}
// Istio service scoped to a single Kubernetes cluster. Learn more at
// https://istio.io. Clusters running OSS Istio will have their services
// ingested as this type.
message ClusterIstio {
// The location of the Kubernetes cluster in which this Istio service is
// defined. Corresponds to the `location` resource label in `k8s_cluster`
// resources.
string location = 1;
// The name of the Kubernetes cluster in which this Istio service is
// defined. Corresponds to the `cluster_name` resource label in
// `k8s_cluster` resources.
string cluster_name = 2;
// The namespace of the Istio service underlying this service. Corresponds
// to the `destination_service_namespace` metric label in Istio metrics.
string service_namespace = 3;
// The name of the Istio service underlying this service. Corresponds to the
// `destination_service_name` metric label in Istio metrics.
string service_name = 4;
}
// Istio service scoped to an Istio mesh. Anthos clusters running ASM < 1.6.8
// will have their services ingested as this type.
message MeshIstio {
// Identifier for the mesh in which this Istio service is defined.
// Corresponds to the `mesh_uid` metric label in Istio metrics.
string mesh_uid = 1;
// The namespace of the Istio service underlying this service. Corresponds
// to the `destination_service_namespace` metric label in Istio metrics.
string service_namespace = 3;
// The name of the Istio service underlying this service. Corresponds to the
// `destination_service_name` metric label in Istio metrics.
string service_name = 4;
}
// Canonical service scoped to an Istio mesh. Anthos clusters running ASM >=
// 1.6.8 will have their services ingested as this type.
message IstioCanonicalService {
// Identifier for the Istio mesh in which this canonical service is defined.
// Corresponds to the `mesh_uid` metric label in
// [Istio metrics](https://cloud.google.com/monitoring/api/metrics_istio).
string mesh_uid = 1;
// The namespace of the canonical service underlying this service.
// Corresponds to the `destination_canonical_service_namespace` metric
// label in [Istio
// metrics](https://cloud.google.com/monitoring/api/metrics_istio).
string canonical_service_namespace = 3;
// The name of the canonical service underlying this service.
// Corresponds to the `destination_canonical_service_name` metric label in
// label in [Istio
// metrics](https://cloud.google.com/monitoring/api/metrics_istio).
string canonical_service = 4;
}
// Configuration for how to query telemetry on a Service.
message Telemetry {
// The full name of the resource that defines this service. Formatted as
// described in https://cloud.google.com/apis/design/resource_names.
string resource_name = 1;
}
// Resource name for this Service. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
string name = 1;
// Name used for UI elements listing this Service.
string display_name = 2;
// REQUIRED. Service-identifying atoms specifying the underlying service.
oneof identifier {
// Custom service type.
Custom custom = 6;
// Type used for App Engine services.
AppEngine app_engine = 7;
// Type used for Cloud Endpoints services.
CloudEndpoints cloud_endpoints = 8;
// Type used for Istio services that live in a Kubernetes cluster.
ClusterIstio cluster_istio = 9;
// Type used for Istio services scoped to an Istio mesh.
MeshIstio mesh_istio = 10;
// Type used for canonical services scoped to an Istio mesh.
// Metrics for Istio are
// [documented here](https://istio.io/latest/docs/reference/config/metrics/)
IstioCanonicalService istio_canonical_service = 11;
}
// Configuration for how to query telemetry on a Service.
Telemetry telemetry = 13;
// Labels which have been used to annotate the service. Label keys must start
// with a letter. Label keys and values may contain lowercase letters,
// numbers, underscores, and dashes. Label keys and values have a maximum
// length of 63 characters, and must be less than 128 bytes in size. Up to 64
// label entries may be stored. For labels which do not have a semantic value,
// the empty string may be supplied for the label value.
map<string, string> user_labels = 14;
}
// A Service-Level Objective (SLO) describes a level of desired good service. It
// consists of a service-level indicator (SLI), a performance goal, and a period
// over which the objective is to be evaluated against that goal. The SLO can
// use SLIs defined in a number of different manners. Typical SLOs might include
// "99% of requests in each rolling week have latency below 200 milliseconds" or
// "99.5% of requests in each calendar month return successfully."
message ServiceLevelObjective {
option (google.api.resource) = {
type: "monitoring.googleapis.com/ServiceLevelObjective"
pattern: "projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}"
pattern: "organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}"
pattern: "folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}"
pattern: "*"
history: ORIGINALLY_SINGLE_PATTERN
};
// `ServiceLevelObjective.View` determines what form of
// `ServiceLevelObjective` is returned from `GetServiceLevelObjective`,
// `ListServiceLevelObjectives`, and `ListServiceLevelObjectiveVersions` RPCs.
enum View {
// Same as FULL.
VIEW_UNSPECIFIED = 0;
// Return the embedded `ServiceLevelIndicator` in the form in which it was
// defined. If it was defined using a `BasicSli`, return that `BasicSli`.
FULL = 2;
// For `ServiceLevelIndicator`s using `BasicSli` articulation, instead
// return the `ServiceLevelIndicator` with its mode of computation fully
// spelled out as a `RequestBasedSli`. For `ServiceLevelIndicator`s using
// `RequestBasedSli` or `WindowsBasedSli`, return the
// `ServiceLevelIndicator` as it was provided.
EXPLICIT = 1;
}
// Resource name for this `ServiceLevelObjective`. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME]
string name = 1;
// Name used for UI elements listing this SLO.
string display_name = 11;
// The definition of good service, used to measure and calculate the quality
// of the `Service`'s performance with respect to a single aspect of service
// quality.
ServiceLevelIndicator service_level_indicator = 3;
// The fraction of service that must be good in order for this objective to be
// met. `0 < goal <= 0.999`.
double goal = 4;
// The time period over which the objective will be evaluated.
oneof period {
// A rolling time period, semantically "in the past `<rolling_period>`".
// Must be an integer multiple of 1 day no larger than 30 days.
google.protobuf.Duration rolling_period = 5;
// A calendar period, semantically "since the start of the current
// `<calendar_period>`". At this time, only `DAY`, `WEEK`, `FORTNIGHT`, and
// `MONTH` are supported.
google.type.CalendarPeriod calendar_period = 6;
}
// Labels which have been used to annotate the service-level objective. Label
// keys must start with a letter. Label keys and values may contain lowercase
// letters, numbers, underscores, and dashes. Label keys and values have a
// maximum length of 63 characters, and must be less than 128 bytes in size.
// Up to 64 label entries may be stored. For labels which do not have a
// semantic value, the empty string may be supplied for the label value.
map<string, string> user_labels = 12;
}
// A Service-Level Indicator (SLI) describes the "performance" of a service. For
// some services, the SLI is well-defined. In such cases, the SLI can be
// described easily by referencing the well-known SLI and providing the needed
// parameters. Alternatively, a "custom" SLI can be defined with a query to the
// underlying metric store. An SLI is defined to be `good_service /
// total_service` over any queried time interval. The value of performance
// always falls into the range `0 <= performance <= 1`. A custom SLI describes
// how to compute this ratio, whether this is by dividing values from a pair of
// time series, cutting a `Distribution` into good and bad counts, or counting
// time windows in which the service complies with a criterion. For separation
// of concerns, a single Service-Level Indicator measures performance for only
// one aspect of service quality, such as fraction of successful queries or
// fast-enough queries.
message ServiceLevelIndicator {
// Service level indicators can be grouped by whether the "unit" of service
// being measured is based on counts of good requests or on counts of good
// time windows
oneof type {
// Basic SLI on a well-known service type.
BasicSli basic_sli = 4;
// Request-based SLIs
RequestBasedSli request_based = 1;
// Windows-based SLIs
WindowsBasedSli windows_based = 2;
}
}
// An SLI measuring performance on a well-known service type. Performance will
// be computed on the basis of pre-defined metrics. The type of the
// `service_resource` determines the metrics to use and the
// `service_resource.labels` and `metric_labels` are used to construct a
// monitoring filter to filter that metric down to just the data relevant to
// this service.
message BasicSli {
// Future parameters for the availability SLI.
message AvailabilityCriteria {
}
// Parameters for a latency threshold SLI.
message LatencyCriteria {
// Good service is defined to be the count of requests made to this service
// that return in no more than `threshold`.
google.protobuf.Duration threshold = 3;
}
// OPTIONAL: The set of RPCs to which this SLI is relevant. Telemetry from
// other methods will not be used to calculate performance for this SLI. If
// omitted, this SLI applies to all the Service's methods. For service types
// that don't support breaking down by method, setting this field will result
// in an error.
repeated string method = 7;
// OPTIONAL: The set of locations to which this SLI is relevant. Telemetry
// from other locations will not be used to calculate performance for this
// SLI. If omitted, this SLI applies to all locations in which the Service has
// activity. For service types that don't support breaking down by location,
// setting this field will result in an error.
repeated string location = 8;
// OPTIONAL: The set of API versions to which this SLI is relevant. Telemetry
// from other API versions will not be used to calculate performance for this
// SLI. If omitted, this SLI applies to all API versions. For service types
// that don't support breaking down by version, setting this field will result
// in an error.
repeated string version = 9;
// This SLI can be evaluated on the basis of availability or latency.
oneof sli_criteria {
// Good service is defined to be the count of requests made to this service
// that return successfully.
AvailabilityCriteria availability = 2;
// Good service is defined to be the count of requests made to this service
// that are fast enough with respect to `latency.threshold`.
LatencyCriteria latency = 3;
}
}
// Range of numerical values within `min` and `max`.
message Range {
// Range minimum.
double min = 1;
// Range maximum.
double max = 2;
}
// Service Level Indicators for which atomic units of service are counted
// directly.
message RequestBasedSli {
// The means to compute a ratio of `good_service` to `total_service`.
oneof method {
// `good_total_ratio` is used when the ratio of `good_service` to
// `total_service` is computed from two `TimeSeries`.
TimeSeriesRatio good_total_ratio = 1;
// `distribution_cut` is used when `good_service` is a count of values
// aggregated in a `Distribution` that fall into a good range. The
// `total_service` is the total count of all values aggregated in the
// `Distribution`.
DistributionCut distribution_cut = 3;
}
}
// A `TimeSeriesRatio` specifies two `TimeSeries` to use for computing the
// `good_service / total_service` ratio. The specified `TimeSeries` must have
// `ValueType = DOUBLE` or `ValueType = INT64` and must have `MetricKind =
// DELTA` or `MetricKind = CUMULATIVE`. The `TimeSeriesRatio` must specify
// exactly two of good, bad, and total, and the relationship `good_service +
// bad_service = total_service` will be assumed.
message TimeSeriesRatio {
// A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
// specifying a `TimeSeries` quantifying good service provided. Must have
// `ValueType = DOUBLE` or `ValueType = INT64` and must have `MetricKind =
// DELTA` or `MetricKind = CUMULATIVE`.
string good_service_filter = 4;
// A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
// specifying a `TimeSeries` quantifying bad service, either demanded service
// that was not provided or demanded service that was of inadequate quality.
// Must have `ValueType = DOUBLE` or `ValueType = INT64` and must have
// `MetricKind = DELTA` or `MetricKind = CUMULATIVE`.
string bad_service_filter = 5;
// A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
// specifying a `TimeSeries` quantifying total demanded service. Must have
// `ValueType = DOUBLE` or `ValueType = INT64` and must have `MetricKind =
// DELTA` or `MetricKind = CUMULATIVE`.
string total_service_filter = 6;
}
// A `DistributionCut` defines a `TimeSeries` and thresholds used for measuring
// good service and total service. The `TimeSeries` must have `ValueType =
// DISTRIBUTION` and `MetricKind = DELTA` or `MetricKind = CUMULATIVE`. The
// computed `good_service` will be the estimated count of values in the
// `Distribution` that fall within the specified `min` and `max`.
message DistributionCut {
// A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
// specifying a `TimeSeries` aggregating values. Must have `ValueType =
// DISTRIBUTION` and `MetricKind = DELTA` or `MetricKind = CUMULATIVE`.
string distribution_filter = 4;
// Range of values considered "good." For a one-sided range, set one bound to
// an infinite value.
Range range = 5;
}
// A `WindowsBasedSli` defines `good_service` as the count of time windows for
// which the provided service was of good quality. Criteria for determining
// if service was good are embedded in the `window_criterion`.
message WindowsBasedSli {
// A `PerformanceThreshold` is used when each window is good when that window
// has a sufficiently high `performance`.
message PerformanceThreshold {
// The means, either a request-based SLI or a basic SLI, by which to compute
// performance over a window.
oneof type {
// `RequestBasedSli` to evaluate to judge window quality.
RequestBasedSli performance = 1;
// `BasicSli` to evaluate to judge window quality.
BasicSli basic_sli_performance = 3;
}
// If window `performance >= threshold`, the window is counted as good.
double threshold = 2;
}
// A `MetricRange` is used when each window is good when the value x of a
// single `TimeSeries` satisfies `range.min <= x <= range.max`. The provided
// `TimeSeries` must have `ValueType = INT64` or `ValueType = DOUBLE` and
// `MetricKind = GAUGE`.
message MetricRange {
// A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
// specifying the `TimeSeries` to use for evaluating window quality.
string time_series = 1;
// Range of values considered "good." For a one-sided range, set one bound
// to an infinite value.
Range range = 4;
}
// The criterion to use for evaluating window goodness.
oneof window_criterion {
// A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
// specifying a `TimeSeries` with `ValueType = BOOL`. The window is good if
// any `true` values appear in the window.
string good_bad_metric_filter = 5;
// A window is good if its `performance` is high enough.
PerformanceThreshold good_total_ratio_threshold = 2;
// A window is good if the metric's value is in a good range, averaged
// across returned streams.
MetricRange metric_mean_in_range = 6;
// A window is good if the metric's value is in a good range, summed across
// returned streams.
MetricRange metric_sum_in_range = 7;
}
// Duration over which window quality is evaluated. Must be an integer
// fraction of a day and at least `60s`.
google.protobuf.Duration window_period = 4;
}

View File

@@ -0,0 +1,352 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.monitoring.v3;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/monitoring/v3/service.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
option csharp_namespace = "Google.Cloud.Monitoring.V3";
option go_package = "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpb";
option java_multiple_files = true;
option java_outer_classname = "ServiceMonitoringServiceProto";
option java_package = "com.google.monitoring.v3";
option php_namespace = "Google\\Cloud\\Monitoring\\V3";
option ruby_package = "Google::Cloud::Monitoring::V3";
// The Cloud Monitoring Service-Oriented Monitoring API has endpoints for
// managing and querying aspects of a workspace's services. These include the
// `Service`'s monitored resources, its Service-Level Objectives, and a taxonomy
// of categorized Health Metrics.
service ServiceMonitoringService {
option (google.api.default_host) = "monitoring.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform,"
"https://www.googleapis.com/auth/monitoring,"
"https://www.googleapis.com/auth/monitoring.read";
// Create a `Service`.
rpc CreateService(CreateServiceRequest) returns (Service) {
option (google.api.http) = {
post: "/v3/{parent=*/*}/services"
body: "service"
};
option (google.api.method_signature) = "parent,service";
}
// Get the named `Service`.
rpc GetService(GetServiceRequest) returns (Service) {
option (google.api.http) = {
get: "/v3/{name=*/*/services/*}"
};
option (google.api.method_signature) = "name";
}
// List `Service`s for this workspace.
rpc ListServices(ListServicesRequest) returns (ListServicesResponse) {
option (google.api.http) = {
get: "/v3/{parent=*/*}/services"
};
option (google.api.method_signature) = "parent";
}
// Update this `Service`.
rpc UpdateService(UpdateServiceRequest) returns (Service) {
option (google.api.http) = {
patch: "/v3/{service.name=*/*/services/*}"
body: "service"
};
option (google.api.method_signature) = "service";
}
// Soft delete this `Service`.
rpc DeleteService(DeleteServiceRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v3/{name=*/*/services/*}"
};
option (google.api.method_signature) = "name";
}
// Create a `ServiceLevelObjective` for the given `Service`.
rpc CreateServiceLevelObjective(CreateServiceLevelObjectiveRequest) returns (ServiceLevelObjective) {
option (google.api.http) = {
post: "/v3/{parent=*/*/services/*}/serviceLevelObjectives"
body: "service_level_objective"
};
option (google.api.method_signature) = "parent,service_level_objective";
}
// Get a `ServiceLevelObjective` by name.
rpc GetServiceLevelObjective(GetServiceLevelObjectiveRequest) returns (ServiceLevelObjective) {
option (google.api.http) = {
get: "/v3/{name=*/*/services/*/serviceLevelObjectives/*}"
};
option (google.api.method_signature) = "name";
}
// List the `ServiceLevelObjective`s for the given `Service`.
rpc ListServiceLevelObjectives(ListServiceLevelObjectivesRequest) returns (ListServiceLevelObjectivesResponse) {
option (google.api.http) = {
get: "/v3/{parent=*/*/services/*}/serviceLevelObjectives"
};
option (google.api.method_signature) = "parent";
}
// Update the given `ServiceLevelObjective`.
rpc UpdateServiceLevelObjective(UpdateServiceLevelObjectiveRequest) returns (ServiceLevelObjective) {
option (google.api.http) = {
patch: "/v3/{service_level_objective.name=*/*/services/*/serviceLevelObjectives/*}"
body: "service_level_objective"
};
option (google.api.method_signature) = "service_level_objective";
}
// Delete the given `ServiceLevelObjective`.
rpc DeleteServiceLevelObjective(DeleteServiceLevelObjectiveRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v3/{name=*/*/services/*/serviceLevelObjectives/*}"
};
option (google.api.method_signature) = "name";
}
}
// The `CreateService` request.
message CreateServiceRequest {
// Required. Resource [name](https://cloud.google.com/monitoring/api/v3#project_name) of
// the parent workspace. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "monitoring.googleapis.com/Service"
}
];
// Optional. The Service id to use for this Service. If omitted, an id will be
// generated instead. Must match the pattern `[a-z0-9\-]+`
string service_id = 3;
// Required. The `Service` to create.
Service service = 2 [(google.api.field_behavior) = REQUIRED];
}
// The `GetService` request.
message GetServiceRequest {
// Required. Resource name of the `Service`. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "monitoring.googleapis.com/Service"
}
];
}
// The `ListServices` request.
message ListServicesRequest {
// Required. Resource name of the parent containing the listed services, either a
// [project](https://cloud.google.com/monitoring/api/v3#project_name) or a
// Monitoring Workspace. The formats are:
//
// projects/[PROJECT_ID_OR_NUMBER]
// workspaces/[HOST_PROJECT_ID_OR_NUMBER]
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "monitoring.googleapis.com/Service"
}
];
// A filter specifying what `Service`s to return. The filter currently
// supports the following fields:
//
// - `identifier_case`
// - `app_engine.module_id`
// - `cloud_endpoints.service` (reserved for future use)
// - `mesh_istio.mesh_uid`
// - `mesh_istio.service_namespace`
// - `mesh_istio.service_name`
// - `cluster_istio.location` (deprecated)
// - `cluster_istio.cluster_name` (deprecated)
// - `cluster_istio.service_namespace` (deprecated)
// - `cluster_istio.service_name` (deprecated)
//
// `identifier_case` refers to which option in the identifier oneof is
// populated. For example, the filter `identifier_case = "CUSTOM"` would match
// all services with a value for the `custom` field. Valid options are
// "CUSTOM", "APP_ENGINE", "MESH_ISTIO", plus "CLUSTER_ISTIO" (deprecated)
// and "CLOUD_ENDPOINTS" (reserved for future use).
string filter = 2;
// A non-negative number that is the maximum number of results to return.
// When 0, use default page size.
int32 page_size = 3;
// If this field is not empty then it must contain the `nextPageToken` value
// returned by a previous call to this method. Using this field causes the
// method to return additional results from the previous method call.
string page_token = 4;
}
// The `ListServices` response.
message ListServicesResponse {
// The `Service`s matching the specified filter.
repeated Service services = 1;
// If there are more results than have been returned, then this field is set
// to a non-empty value. To see the additional results,
// use that value as `page_token` in the next call to this method.
string next_page_token = 2;
}
// The `UpdateService` request.
message UpdateServiceRequest {
// Required. The `Service` to draw updates from.
// The given `name` specifies the resource to update.
Service service = 1 [(google.api.field_behavior) = REQUIRED];
// A set of field paths defining which fields to use for the update.
google.protobuf.FieldMask update_mask = 2;
}
// The `DeleteService` request.
message DeleteServiceRequest {
// Required. Resource name of the `Service` to delete. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "monitoring.googleapis.com/Service"
}
];
}
// The `CreateServiceLevelObjective` request.
message CreateServiceLevelObjectiveRequest {
// Required. Resource name of the parent `Service`. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "monitoring.googleapis.com/Service"
}
];
// Optional. The ServiceLevelObjective id to use for this
// ServiceLevelObjective. If omitted, an id will be generated instead. Must
// match the pattern `[a-z0-9\-]+`
string service_level_objective_id = 3;
// Required. The `ServiceLevelObjective` to create.
// The provided `name` will be respected if no `ServiceLevelObjective` exists
// with this name.
ServiceLevelObjective service_level_objective = 2 [(google.api.field_behavior) = REQUIRED];
}
// The `GetServiceLevelObjective` request.
message GetServiceLevelObjectiveRequest {
// Required. Resource name of the `ServiceLevelObjective` to get. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME]
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "monitoring.googleapis.com/ServiceLevelObjective"
}
];
// View of the `ServiceLevelObjective` to return. If `DEFAULT`, return the
// `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the
// `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the
// `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed.
ServiceLevelObjective.View view = 2;
}
// The `ListServiceLevelObjectives` request.
message ListServiceLevelObjectivesRequest {
// Required. Resource name of the parent containing the listed SLOs, either a
// project or a Monitoring Workspace. The formats are:
//
// projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
// workspaces/[HOST_PROJECT_ID_OR_NUMBER]/services/-
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "monitoring.googleapis.com/Service"
}
];
// A filter specifying what `ServiceLevelObjective`s to return.
string filter = 2;
// A non-negative number that is the maximum number of results to return.
// When 0, use default page size.
int32 page_size = 3;
// If this field is not empty then it must contain the `nextPageToken` value
// returned by a previous call to this method. Using this field causes the
// method to return additional results from the previous method call.
string page_token = 4;
// View of the `ServiceLevelObjective`s to return. If `DEFAULT`, return each
// `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the
// `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the
// `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed.
ServiceLevelObjective.View view = 5;
}
// The `ListServiceLevelObjectives` response.
message ListServiceLevelObjectivesResponse {
// The `ServiceLevelObjective`s matching the specified filter.
repeated ServiceLevelObjective service_level_objectives = 1;
// If there are more results than have been returned, then this field is set
// to a non-empty value. To see the additional results,
// use that value as `page_token` in the next call to this method.
string next_page_token = 2;
}
// The `UpdateServiceLevelObjective` request.
message UpdateServiceLevelObjectiveRequest {
// Required. The `ServiceLevelObjective` to draw updates from.
// The given `name` specifies the resource to update.
ServiceLevelObjective service_level_objective = 1 [(google.api.field_behavior) = REQUIRED];
// A set of field paths defining which fields to use for the update.
google.protobuf.FieldMask update_mask = 2;
}
// The `DeleteServiceLevelObjective` request.
message DeleteServiceLevelObjectiveRequest {
// Required. Resource name of the `ServiceLevelObjective` to delete. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME]
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "monitoring.googleapis.com/ServiceLevelObjective"
}
];
}

View File

@@ -0,0 +1,78 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.monitoring.v3;
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/monitoring/v3/common.proto";
option csharp_namespace = "Google.Cloud.Monitoring.V3";
option go_package = "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpb";
option java_multiple_files = true;
option java_outer_classname = "SnoozeProto";
option java_package = "com.google.monitoring.v3";
option php_namespace = "Google\\Cloud\\Monitoring\\V3";
option ruby_package = "Google::Cloud::Monitoring::V3";
// A `Snooze` will prevent any alerts from being opened, and close any that
// are already open. The `Snooze` will work on alerts that match the
// criteria defined in the `Snooze`. The `Snooze` will be active from
// `interval.start_time` through `interval.end_time`.
message Snooze {
option (google.api.resource) = {
type: "monitoring.googleapis.com/Snooze"
pattern: "projects/{project}/snoozes/{snooze}"
};
// Criteria specific to the `AlertPolicy`s that this `Snooze` applies to. The
// `Snooze` will suppress alerts that come from one of the `AlertPolicy`s
// whose names are supplied.
message Criteria {
// The specific `AlertPolicy` names for the alert that should be snoozed.
// The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID]
//
// There is a limit of 16 policies per snooze. This limit is checked during
// snooze creation.
repeated string policies = 1 [(google.api.resource_reference) = {
type: "monitoring.googleapis.com/AlertPolicy"
}];
}
// Required. The name of the `Snooze`. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/snoozes/[SNOOZE_ID]
//
// The ID of the `Snooze` will be generated by the system.
string name = 1 [(google.api.field_behavior) = REQUIRED];
// Required. This defines the criteria for applying the `Snooze`. See
// `Criteria` for more information.
Criteria criteria = 3 [(google.api.field_behavior) = REQUIRED];
// Required. The `Snooze` will be active from `interval.start_time` through
// `interval.end_time`.
// `interval.start_time` cannot be in the past. There is a 15 second clock
// skew to account for the time it takes for a request to reach the API from
// the UI.
TimeInterval interval = 4 [(google.api.field_behavior) = REQUIRED];
// Required. A display name for the `Snooze`. This can be, at most, 512
// unicode characters.
string display_name = 5 [(google.api.field_behavior) = REQUIRED];
}

View File

@@ -0,0 +1,210 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.monitoring.v3;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/monitoring/v3/snooze.proto";
import "google/protobuf/field_mask.proto";
option csharp_namespace = "Google.Cloud.Monitoring.V3";
option go_package = "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpb";
option java_multiple_files = true;
option java_outer_classname = "SnoozeServiceProto";
option java_package = "com.google.monitoring.v3";
option php_namespace = "Google\\Cloud\\Monitoring\\V3";
option ruby_package = "Google::Cloud::Monitoring::V3";
// The SnoozeService API is used to temporarily prevent an alert policy from
// generating alerts. A Snooze is a description of the criteria under which one
// or more alert policies should not fire alerts for the specified duration.
service SnoozeService {
option (google.api.default_host) = "monitoring.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform,"
"https://www.googleapis.com/auth/monitoring,"
"https://www.googleapis.com/auth/monitoring.read";
// Creates a `Snooze` that will prevent alerts, which match the provided
// criteria, from being opened. The `Snooze` applies for a specific time
// interval.
rpc CreateSnooze(CreateSnoozeRequest) returns (Snooze) {
option (google.api.http) = {
post: "/v3/{parent=projects/*}/snoozes"
body: "snooze"
};
option (google.api.method_signature) = "parent,snooze";
}
// Lists the `Snooze`s associated with a project. Can optionally pass in
// `filter`, which specifies predicates to match `Snooze`s.
rpc ListSnoozes(ListSnoozesRequest) returns (ListSnoozesResponse) {
option (google.api.http) = {
get: "/v3/{parent=projects/*}/snoozes"
};
option (google.api.method_signature) = "parent";
}
// Retrieves a `Snooze` by `name`.
rpc GetSnooze(GetSnoozeRequest) returns (Snooze) {
option (google.api.http) = {
get: "/v3/{name=projects/*/snoozes/*}"
};
option (google.api.method_signature) = "name";
}
// Updates a `Snooze`, identified by its `name`, with the parameters in the
// given `Snooze` object.
rpc UpdateSnooze(UpdateSnoozeRequest) returns (Snooze) {
option (google.api.http) = {
patch: "/v3/{snooze.name=projects/*/snoozes/*}"
body: "snooze"
};
option (google.api.method_signature) = "snooze,update_mask";
}
}
// The message definition for creating a `Snooze`. Users must provide the body
// of the `Snooze` to be created but must omit the `Snooze` field, `name`.
message CreateSnoozeRequest {
// Required. The
// [project](https://cloud.google.com/monitoring/api/v3#project_name) in which
// a `Snooze` should be created. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "monitoring.googleapis.com/Snooze"
}
];
// Required. The `Snooze` to create. Omit the `name` field, as it will be
// filled in by the API.
Snooze snooze = 2 [(google.api.field_behavior) = REQUIRED];
}
// The message definition for listing `Snooze`s associated with the given
// `parent`, satisfying the optional `filter`.
message ListSnoozesRequest {
// Required. The
// [project](https://cloud.google.com/monitoring/api/v3#project_name) whose
// `Snooze`s should be listed. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "monitoring.googleapis.com/Snooze"
}
];
// Optional. Optional filter to restrict results to the given criteria. The
// following fields are supported.
//
// * `interval.start_time`
// * `interval.end_time`
//
// For example:
//
// ```
// interval.start_time > "2022-03-11T00:00:00-08:00" AND
// interval.end_time < "2022-03-12T00:00:00-08:00"
// ```
string filter = 2 [(google.api.field_behavior) = OPTIONAL];
// Optional. The maximum number of results to return for a single query. The
// server may further constrain the maximum number of results returned in a
// single page. The value should be in the range [1, 1000]. If the value given
// is outside this range, the server will decide the number of results to be
// returned.
int32 page_size = 4 [(google.api.field_behavior) = OPTIONAL];
// Optional. The `next_page_token` from a previous call to
// `ListSnoozesRequest` to get the next page of results.
string page_token = 5 [(google.api.field_behavior) = OPTIONAL];
}
// The results of a successful `ListSnoozes` call, containing the matching
// `Snooze`s.
message ListSnoozesResponse {
// `Snooze`s matching this list call.
repeated Snooze snoozes = 1;
// Page token for repeated calls to `ListSnoozes`, to fetch additional pages
// of results. If this is empty or missing, there are no more pages.
string next_page_token = 2;
}
// The message definition for retrieving a `Snooze`. Users must specify the
// field, `name`, which identifies the `Snooze`.
message GetSnoozeRequest {
// Required. The ID of the `Snooze` to retrieve. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/snoozes/[SNOOZE_ID]
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "monitoring.googleapis.com/Snooze"
}
];
}
// The message definition for updating a `Snooze`. The field, `snooze.name`
// identifies the `Snooze` to be updated. The remainder of `snooze` gives the
// content the `Snooze` in question will be assigned.
//
// What fields can be updated depends on the start time and end time of the
// `Snooze`.
//
// * end time is in the past: These `Snooze`s are considered
// read-only and cannot be updated.
// * start time is in the past and end time is in the future: `display_name`
// and `interval.end_time` can be updated.
// * start time is in the future: `display_name`, `interval.start_time` and
// `interval.end_time` can be updated.
message UpdateSnoozeRequest {
// Required. The `Snooze` to update. Must have the name field present.
Snooze snooze = 1 [(google.api.field_behavior) = REQUIRED];
// Required. The fields to update.
//
// For each field listed in `update_mask`:
//
// * If the `Snooze` object supplied in the `UpdateSnoozeRequest` has a
// value for that field, the value of the field in the existing `Snooze`
// will be set to the value of the field in the supplied `Snooze`.
// * If the field does not have a value in the supplied `Snooze`, the field
// in the existing `Snooze` is set to its default value.
//
// Fields not listed retain their existing value.
//
// The following are the field names that are accepted in `update_mask`:
//
// * `display_name`
// * `interval.start_time`
// * `interval.end_time`
//
// That said, the start time and end time of the `Snooze` determines which
// fields can legally be updated. Before attempting an update, users should
// consult the documentation for `UpdateSnoozeRequest`, which talks about
// which fields can be updated.
google.protobuf.FieldMask update_mask = 2
[(google.api.field_behavior) = REQUIRED];
}

View File

@@ -0,0 +1,45 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.monitoring.v3;
option csharp_namespace = "Google.Cloud.Monitoring.V3";
option go_package = "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpb";
option java_multiple_files = true;
option java_outer_classname = "SpanContextProto";
option java_package = "com.google.monitoring.v3";
option php_namespace = "Google\\Cloud\\Monitoring\\V3";
option ruby_package = "Google::Cloud::Monitoring::V3";
// The context of a span. This is attached to an
// [Exemplar][google.api.Distribution.Exemplar]
// in [Distribution][google.api.Distribution] values during aggregation.
//
// It contains the name of a span with format:
//
// projects/[PROJECT_ID_OR_NUMBER]/traces/[TRACE_ID]/spans/[SPAN_ID]
message SpanContext {
// The resource name of the span. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/traces/[TRACE_ID]/spans/[SPAN_ID]
//
// `[TRACE_ID]` is a unique identifier for a trace within a project;
// it is a 32-character hexadecimal encoding of a 16-byte array.
//
// `[SPAN_ID]` is a unique identifier for a span within a trace; it
// is a 16-character hexadecimal encoding of an 8-byte array.
string span_name = 1;
}

View File

@@ -0,0 +1,564 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.monitoring.v3;
import "google/api/field_behavior.proto";
import "google/api/monitored_resource.proto";
import "google/api/resource.proto";
import "google/protobuf/duration.proto";
option csharp_namespace = "Google.Cloud.Monitoring.V3";
option go_package = "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpb";
option java_multiple_files = true;
option java_outer_classname = "UptimeProto";
option java_package = "com.google.monitoring.v3";
option php_namespace = "Google\\Cloud\\Monitoring\\V3";
option ruby_package = "Google::Cloud::Monitoring::V3";
// An internal checker allows Uptime checks to run on private/internal GCP
// resources.
message InternalChecker {
option deprecated = true;
// Operational states for an internal checker.
enum State {
// An internal checker should never be in the unspecified state.
UNSPECIFIED = 0;
// The checker is being created, provisioned, and configured. A checker in
// this state can be returned by `ListInternalCheckers` or
// `GetInternalChecker`, as well as by examining the [long running
// Operation](https://cloud.google.com/apis/design/design_patterns#long_running_operations)
// that created it.
CREATING = 1;
// The checker is running and available for use. A checker in this state
// can be returned by `ListInternalCheckers` or `GetInternalChecker` as
// well as by examining the [long running
// Operation](https://cloud.google.com/apis/design/design_patterns#long_running_operations)
// that created it.
// If a checker is being torn down, it is neither visible nor usable, so
// there is no "deleting" or "down" state.
RUNNING = 2;
}
// A unique resource name for this InternalChecker. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/internalCheckers/[INTERNAL_CHECKER_ID]
//
// `[PROJECT_ID_OR_NUMBER]` is the Cloud Monitoring Metrics Scope project for
// the Uptime check config associated with the internal checker.
string name = 1;
// The checker's human-readable name. The display name
// should be unique within a Cloud Monitoring Metrics Scope in order to make
// it easier to identify; however, uniqueness is not enforced.
string display_name = 2;
// The [GCP VPC network](https://cloud.google.com/vpc/docs/vpc) where the
// internal resource lives (ex: "default").
string network = 3;
// The GCP zone the Uptime check should egress from. Only respected for
// internal Uptime checks, where internal_network is specified.
string gcp_zone = 4;
// The GCP project ID where the internal checker lives. Not necessary
// the same as the Metrics Scope project.
string peer_project_id = 6;
// The current operational state of the internal checker.
State state = 7;
}
// This message configures which resources and services to monitor for
// availability.
message UptimeCheckConfig {
option (google.api.resource) = {
type: "monitoring.googleapis.com/UptimeCheckConfig"
pattern: "projects/{project}/uptimeCheckConfigs/{uptime_check_config}"
pattern: "organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}"
pattern: "folders/{folder}/uptimeCheckConfigs/{uptime_check_config}"
pattern: "*"
};
// The resource submessage for group checks. It can be used instead of a
// monitored resource, when multiple resources are being monitored.
message ResourceGroup {
// The group of resources being monitored. Should be only the `[GROUP_ID]`,
// and not the full-path
// `projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]`.
string group_id = 1;
// The resource type of the group members.
GroupResourceType resource_type = 2;
}
// Information involved in sending ICMP pings alongside public HTTP/TCP
// checks. For HTTP, the pings are performed for each part of the redirect
// chain.
message PingConfig {
// Number of ICMP pings. A maximum of 3 ICMP pings is currently supported.
int32 pings_count = 1;
}
// Information involved in an HTTP/HTTPS Uptime check request.
message HttpCheck {
// The HTTP request method options.
enum RequestMethod {
// No request method specified.
METHOD_UNSPECIFIED = 0;
// GET request.
GET = 1;
// POST request.
POST = 2;
}
// The authentication parameters to provide to the specified resource or
// URL that requires a username and password. Currently, only
// [Basic HTTP authentication](https://tools.ietf.org/html/rfc7617) is
// supported in Uptime checks.
message BasicAuthentication {
// The username to use when authenticating with the HTTP server.
string username = 1;
// The password to use when authenticating with the HTTP server.
string password = 2;
}
// Header options corresponding to the content type of a HTTP request body.
enum ContentType {
// No content type specified.
TYPE_UNSPECIFIED = 0;
// `body` is in URL-encoded form. Equivalent to setting the `Content-Type`
// to `application/x-www-form-urlencoded` in the HTTP request.
URL_ENCODED = 1;
// `body` is in `custom_content_type` form. Equivalent to setting the
// `Content-Type` to the contents of `custom_content_type` in the HTTP
// request.
USER_PROVIDED = 2;
}
// A status to accept. Either a status code class like "2xx", or an integer
// status code like "200".
message ResponseStatusCode {
// An HTTP status code class.
enum StatusClass {
// Default value that matches no status codes.
STATUS_CLASS_UNSPECIFIED = 0;
// The class of status codes between 100 and 199.
STATUS_CLASS_1XX = 100;
// The class of status codes between 200 and 299.
STATUS_CLASS_2XX = 200;
// The class of status codes between 300 and 399.
STATUS_CLASS_3XX = 300;
// The class of status codes between 400 and 499.
STATUS_CLASS_4XX = 400;
// The class of status codes between 500 and 599.
STATUS_CLASS_5XX = 500;
// The class of all status codes.
STATUS_CLASS_ANY = 1000;
}
// Either a specific value or a class of status codes.
oneof status_code {
// A status code to accept.
int32 status_value = 1;
// A class of status codes to accept.
StatusClass status_class = 2;
}
}
// The HTTP request method to use for the check. If set to
// `METHOD_UNSPECIFIED` then `request_method` defaults to `GET`.
RequestMethod request_method = 8;
// If `true`, use HTTPS instead of HTTP to run the check.
bool use_ssl = 1;
// Optional (defaults to "/"). The path to the page against which to run
// the check. Will be combined with the `host` (specified within the
// `monitored_resource`) and `port` to construct the full URL. If the
// provided path does not begin with "/", a "/" will be prepended
// automatically.
string path = 2;
// Optional (defaults to 80 when `use_ssl` is `false`, and 443 when
// `use_ssl` is `true`). The TCP port on the HTTP server against which to
// run the check. Will be combined with host (specified within the
// `monitored_resource`) and `path` to construct the full URL.
int32 port = 3;
// The authentication information. Optional when creating an HTTP check;
// defaults to empty.
BasicAuthentication auth_info = 4;
// Boolean specifying whether to encrypt the header information.
// Encryption should be specified for any headers related to authentication
// that you do not wish to be seen when retrieving the configuration. The
// server will be responsible for encrypting the headers.
// On Get/List calls, if `mask_headers` is set to `true` then the headers
// will be obscured with `******.`
bool mask_headers = 5;
// The list of headers to send as part of the Uptime check request.
// If two headers have the same key and different values, they should
// be entered as a single header, with the value being a comma-separated
// list of all the desired values as described at
// https://www.w3.org/Protocols/rfc2616/rfc2616.txt (page 31).
// Entering two separate headers with the same key in a Create call will
// cause the first to be overwritten by the second.
// The maximum number of headers allowed is 100.
map<string, string> headers = 6;
// The content type header to use for the check. The following
// configurations result in errors:
// 1. Content type is specified in both the `headers` field and the
// `content_type` field.
// 2. Request method is `GET` and `content_type` is not `TYPE_UNSPECIFIED`
// 3. Request method is `POST` and `content_type` is `TYPE_UNSPECIFIED`.
// 4. Request method is `POST` and a "Content-Type" header is provided via
// `headers` field. The `content_type` field should be used instead.
ContentType content_type = 9;
// A user provided content type header to use for the check. The invalid
// configurations outlined in the `content_type` field apply to
// `custom_content_type`, as well as the following:
// 1. `content_type` is `URL_ENCODED` and `custom_content_type` is set.
// 2. `content_type` is `USER_PROVIDED` and `custom_content_type` is not
// set.
string custom_content_type = 13;
// Boolean specifying whether to include SSL certificate validation as a
// part of the Uptime check. Only applies to checks where
// `monitored_resource` is set to `uptime_url`. If `use_ssl` is `false`,
// setting `validate_ssl` to `true` has no effect.
bool validate_ssl = 7;
// The request body associated with the HTTP POST request. If `content_type`
// is `URL_ENCODED`, the body passed in must be URL-encoded. Users can
// provide a `Content-Length` header via the `headers` field or the API will
// do so. If the `request_method` is `GET` and `body` is not empty, the API
// will return an error. The maximum byte size is 1 megabyte.
//
// Note: If client libraries aren't used (which performs the conversion
// automatically) base64 encode your `body` data since the field is of
// `bytes` type.
bytes body = 10;
// If present, the check will only pass if the HTTP response status code is
// in this set of status codes. If empty, the HTTP status code will only
// pass if the HTTP status code is 200-299.
repeated ResponseStatusCode accepted_response_status_codes = 11;
// Contains information needed to add pings to an HTTP check.
PingConfig ping_config = 12;
}
// Information required for a TCP Uptime check request.
message TcpCheck {
// The TCP port on the server against which to run the check. Will be
// combined with host (specified within the `monitored_resource`) to
// construct the full URL. Required.
int32 port = 1;
// Contains information needed to add pings to a TCP check.
PingConfig ping_config = 2;
}
// Optional. Used to perform content matching. This allows matching based on
// substrings and regular expressions, together with their negations. Only the
// first 4&nbsp;MB of an HTTP or HTTPS check's response (and the first
// 1&nbsp;MB of a TCP check's response) are examined for purposes of content
// matching.
message ContentMatcher {
// Options to perform content matching.
enum ContentMatcherOption {
// No content matcher type specified (maintained for backward
// compatibility, but deprecated for future use).
// Treated as `CONTAINS_STRING`.
CONTENT_MATCHER_OPTION_UNSPECIFIED = 0;
// Selects substring matching. The match succeeds if the output contains
// the `content` string. This is the default value for checks without
// a `matcher` option, or where the value of `matcher` is
// `CONTENT_MATCHER_OPTION_UNSPECIFIED`.
CONTAINS_STRING = 1;
// Selects negation of substring matching. The match succeeds if the
// output does _NOT_ contain the `content` string.
NOT_CONTAINS_STRING = 2;
// Selects regular-expression matching. The match succeeds if the output
// matches the regular expression specified in the `content` string.
// Regex matching is only supported for HTTP/HTTPS checks.
MATCHES_REGEX = 3;
// Selects negation of regular-expression matching. The match succeeds if
// the output does _NOT_ match the regular expression specified in the
// `content` string. Regex matching is only supported for HTTP/HTTPS
// checks.
NOT_MATCHES_REGEX = 4;
// Selects JSONPath matching. See `JsonPathMatcher` for details on when
// the match succeeds. JSONPath matching is only supported for HTTP/HTTPS
// checks.
MATCHES_JSON_PATH = 5;
// Selects JSONPath matching. See `JsonPathMatcher` for details on when
// the match succeeds. Succeeds when output does _NOT_ match as specified.
// JSONPath is only supported for HTTP/HTTPS checks.
NOT_MATCHES_JSON_PATH = 6;
}
// Information needed to perform a JSONPath content match.
// Used for `ContentMatcherOption::MATCHES_JSON_PATH` and
// `ContentMatcherOption::NOT_MATCHES_JSON_PATH`.
message JsonPathMatcher {
// Options to perform JSONPath content matching.
enum JsonPathMatcherOption {
// No JSONPath matcher type specified (not valid).
JSON_PATH_MATCHER_OPTION_UNSPECIFIED = 0;
// Selects 'exact string' matching. The match succeeds if the content at
// the `json_path` within the output is exactly the same as the
// `content` string.
EXACT_MATCH = 1;
// Selects regular-expression matching. The match succeeds if the
// content at the `json_path` within the output matches the regular
// expression specified in the `content` string.
REGEX_MATCH = 2;
}
// JSONPath within the response output pointing to the expected
// `ContentMatcher::content` to match against.
string json_path = 1;
// The type of JSONPath match that will be applied to the JSON output
// (`ContentMatcher.content`)
JsonPathMatcherOption json_matcher = 2;
}
// String, regex or JSON content to match. Maximum 1024 bytes. An empty
// `content` string indicates no content matching is to be performed.
string content = 1;
// The type of content matcher that will be applied to the server output,
// compared to the `content` string when the check is run.
ContentMatcherOption matcher = 2;
// Certain `ContentMatcherOption` types require additional information.
// `MATCHES_JSON_PATH` or `NOT_MATCHES_JSON_PATH` require a
// `JsonPathMatcher`; not used for other options.
oneof additional_matcher_info {
// Matcher information for `MATCHES_JSON_PATH` and `NOT_MATCHES_JSON_PATH`
JsonPathMatcher json_path_matcher = 3;
}
}
// What kind of checkers are available to be used by the check.
enum CheckerType {
// The default checker type. Currently converted to `STATIC_IP_CHECKERS`
// on creation, the default conversion behavior may change in the future.
CHECKER_TYPE_UNSPECIFIED = 0;
// `STATIC_IP_CHECKERS` are used for uptime checks that perform egress
// across the public internet. `STATIC_IP_CHECKERS` use the static IP
// addresses returned by `ListUptimeCheckIps`.
STATIC_IP_CHECKERS = 1;
// `VPC_CHECKERS` are used for uptime checks that perform egress using
// Service Directory and private network access. When using `VPC_CHECKERS`,
// the monitored resource type must be `servicedirectory_service`.
VPC_CHECKERS = 3;
}
// A unique resource name for this Uptime check configuration. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID]
//
// `[PROJECT_ID_OR_NUMBER]` is the Workspace host project associated with the
// Uptime check.
//
// This field should be omitted when creating the Uptime check configuration;
// on create, the resource name is assigned by the server and included in the
// response.
string name = 1;
// A human-friendly name for the Uptime check configuration. The display name
// should be unique within a Cloud Monitoring Workspace in order to make it
// easier to identify; however, uniqueness is not enforced. Required.
string display_name = 2;
// The resource the check is checking. Required.
oneof resource {
// The [monitored
// resource](https://cloud.google.com/monitoring/api/resources) associated
// with the configuration.
// The following monitored resource types are valid for this field:
// `uptime_url`,
// `gce_instance`,
// `gae_app`,
// `aws_ec2_instance`,
// `aws_elb_load_balancer`
// `k8s_service`
// `servicedirectory_service`
// `cloud_run_revision`
google.api.MonitoredResource monitored_resource = 3;
// The group resource associated with the configuration.
ResourceGroup resource_group = 4;
}
// The type of Uptime check request.
oneof check_request_type {
// Contains information needed to make an HTTP or HTTPS check.
HttpCheck http_check = 5;
// Contains information needed to make a TCP check.
TcpCheck tcp_check = 6;
}
// How often, in seconds, the Uptime check is performed.
// Currently, the only supported values are `60s` (1 minute), `300s`
// (5 minutes), `600s` (10 minutes), and `900s` (15 minutes). Optional,
// defaults to `60s`.
google.protobuf.Duration period = 7;
// The maximum amount of time to wait for the request to complete (must be
// between 1 and 60 seconds). Required.
google.protobuf.Duration timeout = 8;
// The content that is expected to appear in the data returned by the target
// server against which the check is run. Currently, only the first entry
// in the `content_matchers` list is supported, and additional entries will
// be ignored. This field is optional and should only be specified if a
// content match is required as part of the/ Uptime check.
repeated ContentMatcher content_matchers = 9;
// The type of checkers to use to execute the Uptime check.
CheckerType checker_type = 17;
// The list of regions from which the check will be run.
// Some regions contain one location, and others contain more than one.
// If this field is specified, enough regions must be provided to include a
// minimum of 3 locations. Not specifying this field will result in Uptime
// checks running from all available regions.
repeated UptimeCheckRegion selected_regions = 10;
// If this is `true`, then checks are made only from the 'internal_checkers'.
// If it is `false`, then checks are made only from the 'selected_regions'.
// It is an error to provide 'selected_regions' when is_internal is `true`,
// or to provide 'internal_checkers' when is_internal is `false`.
bool is_internal = 15 [deprecated = true];
// The internal checkers that this check will egress from. If `is_internal` is
// `true` and this list is empty, the check will egress from all the
// InternalCheckers configured for the project that owns this
// `UptimeCheckConfig`.
repeated InternalChecker internal_checkers = 14 [deprecated = true];
// User-supplied key/value data to be used for organizing and
// identifying the `UptimeCheckConfig` objects.
//
// The field can contain up to 64 entries. Each key and value is limited to
// 63 Unicode characters or 128 bytes, whichever is smaller. Labels and
// values can contain only lowercase letters, numerals, underscores, and
// dashes. Keys must begin with a letter.
map<string, string> user_labels = 20;
}
// Contains the region, location, and list of IP
// addresses where checkers in the location run from.
message UptimeCheckIp {
// A broad region category in which the IP address is located.
UptimeCheckRegion region = 1;
// A more specific location within the region that typically encodes
// a particular city/town/metro (and its containing state/province or country)
// within the broader umbrella region category.
string location = 2;
// The IP address from which the Uptime check originates. This is a fully
// specified IP address (not an IP address range). Most IP addresses, as of
// this publication, are in IPv4 format; however, one should not rely on the
// IP addresses being in IPv4 format indefinitely, and should support
// interpreting this field in either IPv4 or IPv6 format.
string ip_address = 3;
}
// The regions from which an Uptime check can be run.
enum UptimeCheckRegion {
// Default value if no region is specified. Will result in Uptime checks
// running from all regions.
REGION_UNSPECIFIED = 0;
// Allows checks to run from locations within the United States of America.
USA = 1;
// Allows checks to run from locations within the continent of Europe.
EUROPE = 2;
// Allows checks to run from locations within the continent of South
// America.
SOUTH_AMERICA = 3;
// Allows checks to run from locations within the Asia Pacific area (ex:
// Singapore).
ASIA_PACIFIC = 4;
// Allows checks to run from locations within the western United States of
// America
USA_OREGON = 5;
// Allows checks to run from locations within the central United States of
// America
USA_IOWA = 6;
// Allows checks to run from locations within the eastern United States of
// America
USA_VIRGINIA = 7;
}
// The supported resource types that can be used as values of
// `group_resource.resource_type`.
// `INSTANCE` includes `gce_instance` and `aws_ec2_instance` resource types.
// The resource types `gae_app` and `uptime_url` are not valid here because
// group checks on App Engine modules and URLs are not allowed.
enum GroupResourceType {
// Default value (not valid).
RESOURCE_TYPE_UNSPECIFIED = 0;
// A group of instances from Google Cloud Platform (GCP) or
// Amazon Web Services (AWS).
INSTANCE = 1;
// A group of Amazon ELB load balancers.
AWS_ELB_LOAD_BALANCER = 2;
}

View File

@@ -0,0 +1,259 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.monitoring.v3;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/monitoring/v3/uptime.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
option csharp_namespace = "Google.Cloud.Monitoring.V3";
option go_package = "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpb";
option java_multiple_files = true;
option java_outer_classname = "UptimeServiceProto";
option java_package = "com.google.monitoring.v3";
option php_namespace = "Google\\Cloud\\Monitoring\\V3";
option ruby_package = "Google::Cloud::Monitoring::V3";
// The UptimeCheckService API is used to manage (list, create, delete, edit)
// Uptime check configurations in the Cloud Monitoring product. An Uptime
// check is a piece of configuration that determines which resources and
// services to monitor for availability. These configurations can also be
// configured interactively by navigating to the [Cloud console]
// (https://console.cloud.google.com), selecting the appropriate project,
// clicking on "Monitoring" on the left-hand side to navigate to Cloud
// Monitoring, and then clicking on "Uptime".
service UptimeCheckService {
option (google.api.default_host) = "monitoring.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform,"
"https://www.googleapis.com/auth/monitoring,"
"https://www.googleapis.com/auth/monitoring.read";
// Lists the existing valid Uptime check configurations for the project
// (leaving out any invalid configurations).
rpc ListUptimeCheckConfigs(ListUptimeCheckConfigsRequest)
returns (ListUptimeCheckConfigsResponse) {
option (google.api.http) = {
get: "/v3/{parent=projects/*}/uptimeCheckConfigs"
};
option (google.api.method_signature) = "parent";
}
// Gets a single Uptime check configuration.
rpc GetUptimeCheckConfig(GetUptimeCheckConfigRequest)
returns (UptimeCheckConfig) {
option (google.api.http) = {
get: "/v3/{name=projects/*/uptimeCheckConfigs/*}"
};
option (google.api.method_signature) = "name";
}
// Creates a new Uptime check configuration.
rpc CreateUptimeCheckConfig(CreateUptimeCheckConfigRequest)
returns (UptimeCheckConfig) {
option (google.api.http) = {
post: "/v3/{parent=projects/*}/uptimeCheckConfigs"
body: "uptime_check_config"
};
option (google.api.method_signature) = "parent,uptime_check_config";
}
// Updates an Uptime check configuration. You can either replace the entire
// configuration with a new one or replace only certain fields in the current
// configuration by specifying the fields to be updated via `updateMask`.
// Returns the updated configuration.
rpc UpdateUptimeCheckConfig(UpdateUptimeCheckConfigRequest)
returns (UptimeCheckConfig) {
option (google.api.http) = {
patch: "/v3/{uptime_check_config.name=projects/*/uptimeCheckConfigs/*}"
body: "uptime_check_config"
};
option (google.api.method_signature) = "uptime_check_config";
}
// Deletes an Uptime check configuration. Note that this method will fail
// if the Uptime check configuration is referenced by an alert policy or
// other dependent configs that would be rendered invalid by the deletion.
rpc DeleteUptimeCheckConfig(DeleteUptimeCheckConfigRequest)
returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v3/{name=projects/*/uptimeCheckConfigs/*}"
};
option (google.api.method_signature) = "name";
}
// Returns the list of IP addresses that checkers run from
rpc ListUptimeCheckIps(ListUptimeCheckIpsRequest)
returns (ListUptimeCheckIpsResponse) {
option (google.api.http) = {
get: "/v3/uptimeCheckIps"
};
}
}
// The protocol for the `ListUptimeCheckConfigs` request.
message ListUptimeCheckConfigsRequest {
// Required. The
// [project](https://cloud.google.com/monitoring/api/v3#project_name) whose
// Uptime check configurations are listed. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "monitoring.googleapis.com/UptimeCheckConfig"
}
];
// If provided, this field specifies the criteria that must be met by
// uptime checks to be included in the response.
//
// For more details, see [Filtering
// syntax](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering#filter_syntax).
string filter = 2;
// The maximum number of results to return in a single response. The server
// may further constrain the maximum number of results returned in a single
// page. If the page_size is <=0, the server will decide the number of results
// to be returned.
int32 page_size = 3;
// If this field is not empty then it must contain the `nextPageToken` value
// returned by a previous call to this method. Using this field causes the
// method to return more results from the previous method call.
string page_token = 4;
}
// The protocol for the `ListUptimeCheckConfigs` response.
message ListUptimeCheckConfigsResponse {
// The returned Uptime check configurations.
repeated UptimeCheckConfig uptime_check_configs = 1;
// This field represents the pagination token to retrieve the next page of
// results. If the value is empty, it means no further results for the
// request. To retrieve the next page of results, the value of the
// next_page_token is passed to the subsequent List method call (in the
// request message's page_token field).
string next_page_token = 2;
// The total number of Uptime check configurations for the project,
// irrespective of any pagination.
int32 total_size = 3;
}
// The protocol for the `GetUptimeCheckConfig` request.
message GetUptimeCheckConfigRequest {
// Required. The Uptime check configuration to retrieve. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID]
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "monitoring.googleapis.com/UptimeCheckConfig"
}
];
}
// The protocol for the `CreateUptimeCheckConfig` request.
message CreateUptimeCheckConfigRequest {
// Required. The
// [project](https://cloud.google.com/monitoring/api/v3#project_name) in which
// to create the Uptime check. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "monitoring.googleapis.com/UptimeCheckConfig"
}
];
// Required. The new Uptime check configuration.
UptimeCheckConfig uptime_check_config = 2
[(google.api.field_behavior) = REQUIRED];
}
// The protocol for the `UpdateUptimeCheckConfig` request.
message UpdateUptimeCheckConfigRequest {
// Optional. If present, only the listed fields in the current Uptime check
// configuration are updated with values from the new configuration. If this
// field is empty, then the current configuration is completely replaced with
// the new configuration.
google.protobuf.FieldMask update_mask = 2;
// Required. If an `updateMask` has been specified, this field gives
// the values for the set of fields mentioned in the `updateMask`. If an
// `updateMask` has not been given, this Uptime check configuration replaces
// the current configuration. If a field is mentioned in `updateMask` but
// the corresponding field is omitted in this partial Uptime check
// configuration, it has the effect of deleting/clearing the field from the
// configuration on the server.
//
// The following fields can be updated: `display_name`,
// `http_check`, `tcp_check`, `timeout`, `content_matchers`, and
// `selected_regions`.
UptimeCheckConfig uptime_check_config = 3
[(google.api.field_behavior) = REQUIRED];
}
// The protocol for the `DeleteUptimeCheckConfig` request.
message DeleteUptimeCheckConfigRequest {
// Required. The Uptime check configuration to delete. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID]
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "monitoring.googleapis.com/UptimeCheckConfig"
}
];
}
// The protocol for the `ListUptimeCheckIps` request.
message ListUptimeCheckIpsRequest {
// The maximum number of results to return in a single response. The server
// may further constrain the maximum number of results returned in a single
// page. If the page_size is <=0, the server will decide the number of results
// to be returned.
// NOTE: this field is not yet implemented
int32 page_size = 2;
// If this field is not empty then it must contain the `nextPageToken` value
// returned by a previous call to this method. Using this field causes the
// method to return more results from the previous method call.
// NOTE: this field is not yet implemented
string page_token = 3;
}
// The protocol for the `ListUptimeCheckIps` response.
message ListUptimeCheckIpsResponse {
// The returned list of IP addresses (including region and location) that the
// checkers run from.
repeated UptimeCheckIp uptime_check_ips = 1;
// This field represents the pagination token to retrieve the next page of
// results. If the value is empty, it means no further results for the
// request. To retrieve the next page of results, the value of the
// next_page_token is passed to the subsequent List method call (in the
// request message's page_token field).
// NOTE: this field is not yet implemented
string next_page_token = 2;
}

View File

@@ -0,0 +1,162 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
syntax = "proto3";
package google.protobuf;
option go_package = "google.golang.org/protobuf/types/known/anypb";
option java_package = "com.google.protobuf";
option java_outer_classname = "AnyProto";
option java_multiple_files = true;
option objc_class_prefix = "GPB";
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
// `Any` contains an arbitrary serialized protocol buffer message along with a
// URL that describes the type of the serialized message.
//
// Protobuf library provides support to pack/unpack Any values in the form
// of utility functions or additional generated methods of the Any type.
//
// Example 1: Pack and unpack a message in C++.
//
// Foo foo = ...;
// Any any;
// any.PackFrom(foo);
// ...
// if (any.UnpackTo(&foo)) {
// ...
// }
//
// Example 2: Pack and unpack a message in Java.
//
// Foo foo = ...;
// Any any = Any.pack(foo);
// ...
// if (any.is(Foo.class)) {
// foo = any.unpack(Foo.class);
// }
// // or ...
// if (any.isSameTypeAs(Foo.getDefaultInstance())) {
// foo = any.unpack(Foo.getDefaultInstance());
// }
//
// Example 3: Pack and unpack a message in Python.
//
// foo = Foo(...)
// any = Any()
// any.Pack(foo)
// ...
// if any.Is(Foo.DESCRIPTOR):
// any.Unpack(foo)
// ...
//
// Example 4: Pack and unpack a message in Go
//
// foo := &pb.Foo{...}
// any, err := anypb.New(foo)
// if err != nil {
// ...
// }
// ...
// foo := &pb.Foo{}
// if err := any.UnmarshalTo(foo); err != nil {
// ...
// }
//
// The pack methods provided by protobuf library will by default use
// 'type.googleapis.com/full.type.name' as the type URL and the unpack
// methods only use the fully qualified type name after the last '/'
// in the type URL, for example "foo.bar.com/x/y.z" will yield type
// name "y.z".
//
// JSON
// ====
// The JSON representation of an `Any` value uses the regular
// representation of the deserialized, embedded message, with an
// additional field `@type` which contains the type URL. Example:
//
// package google.profile;
// message Person {
// string first_name = 1;
// string last_name = 2;
// }
//
// {
// "@type": "type.googleapis.com/google.profile.Person",
// "firstName": <string>,
// "lastName": <string>
// }
//
// If the embedded message type is well-known and has a custom JSON
// representation, that representation will be embedded adding a field
// `value` which holds the custom JSON in addition to the `@type`
// field. Example (for message [google.protobuf.Duration][]):
//
// {
// "@type": "type.googleapis.com/google.protobuf.Duration",
// "value": "1.212s"
// }
//
message Any {
// A URL/resource name that uniquely identifies the type of the serialized
// protocol buffer message. This string must contain at least
// one "/" character. The last segment of the URL's path must represent
// the fully qualified name of the type (as in
// `path/google.protobuf.Duration`). The name should be in a canonical form
// (e.g., leading "." is not accepted).
//
// In practice, teams usually precompile into the binary all types that they
// expect it to use in the context of Any. However, for URLs which use the
// scheme `http`, `https`, or no scheme, one can optionally set up a type
// server that maps type URLs to message definitions as follows:
//
// * If no scheme is provided, `https` is assumed.
// * An HTTP GET on the URL must yield a [google.protobuf.Type][]
// value in binary format, or produce an error.
// * Applications are allowed to cache lookup results based on the
// URL, or have them precompiled into a binary to avoid any
// lookup. Therefore, binary compatibility needs to be preserved
// on changes to types. (Use versioned type names to manage
// breaking changes.)
//
// Note: this functionality is not currently available in the official
// protobuf release, and it is not used for type URLs beginning with
// type.googleapis.com. As of May 2023, there are no widely used type server
// implementations and no plans to implement one.
//
// Schemes other than `http`, `https` (or the empty scheme) might be
// used with implementation specific semantics.
//
string type_url = 1;
// Must be a valid serialized protocol buffer of the above specified type.
bytes value = 2;
}

View File

@@ -0,0 +1,207 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
syntax = "proto3";
package google.protobuf;
import "google/protobuf/source_context.proto";
import "google/protobuf/type.proto";
option java_package = "com.google.protobuf";
option java_outer_classname = "ApiProto";
option java_multiple_files = true;
option objc_class_prefix = "GPB";
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
option go_package = "google.golang.org/protobuf/types/known/apipb";
// Api is a light-weight descriptor for an API Interface.
//
// Interfaces are also described as "protocol buffer services" in some contexts,
// such as by the "service" keyword in a .proto file, but they are different
// from API Services, which represent a concrete implementation of an interface
// as opposed to simply a description of methods and bindings. They are also
// sometimes simply referred to as "APIs" in other contexts, such as the name of
// this message itself. See https://cloud.google.com/apis/design/glossary for
// detailed terminology.
message Api {
// The fully qualified name of this interface, including package name
// followed by the interface's simple name.
string name = 1;
// The methods of this interface, in unspecified order.
repeated Method methods = 2;
// Any metadata attached to the interface.
repeated Option options = 3;
// A version string for this interface. If specified, must have the form
// `major-version.minor-version`, as in `1.10`. If the minor version is
// omitted, it defaults to zero. If the entire version field is empty, the
// major version is derived from the package name, as outlined below. If the
// field is not empty, the version in the package name will be verified to be
// consistent with what is provided here.
//
// The versioning schema uses [semantic
// versioning](http://semver.org) where the major version number
// indicates a breaking change and the minor version an additive,
// non-breaking change. Both version numbers are signals to users
// what to expect from different versions, and should be carefully
// chosen based on the product plan.
//
// The major version is also reflected in the package name of the
// interface, which must end in `v<major-version>`, as in
// `google.feature.v1`. For major versions 0 and 1, the suffix can
// be omitted. Zero major versions must only be used for
// experimental, non-GA interfaces.
//
string version = 4;
// Source context for the protocol buffer service represented by this
// message.
SourceContext source_context = 5;
// Included interfaces. See [Mixin][].
repeated Mixin mixins = 6;
// The source syntax of the service.
Syntax syntax = 7;
}
// Method represents a method of an API interface.
message Method {
// The simple name of this method.
string name = 1;
// A URL of the input message type.
string request_type_url = 2;
// If true, the request is streamed.
bool request_streaming = 3;
// The URL of the output message type.
string response_type_url = 4;
// If true, the response is streamed.
bool response_streaming = 5;
// Any metadata attached to the method.
repeated Option options = 6;
// The source syntax of this method.
Syntax syntax = 7;
}
// Declares an API Interface to be included in this interface. The including
// interface must redeclare all the methods from the included interface, but
// documentation and options are inherited as follows:
//
// - If after comment and whitespace stripping, the documentation
// string of the redeclared method is empty, it will be inherited
// from the original method.
//
// - Each annotation belonging to the service config (http,
// visibility) which is not set in the redeclared method will be
// inherited.
//
// - If an http annotation is inherited, the path pattern will be
// modified as follows. Any version prefix will be replaced by the
// version of the including interface plus the [root][] path if
// specified.
//
// Example of a simple mixin:
//
// package google.acl.v1;
// service AccessControl {
// // Get the underlying ACL object.
// rpc GetAcl(GetAclRequest) returns (Acl) {
// option (google.api.http).get = "/v1/{resource=**}:getAcl";
// }
// }
//
// package google.storage.v2;
// service Storage {
// rpc GetAcl(GetAclRequest) returns (Acl);
//
// // Get a data record.
// rpc GetData(GetDataRequest) returns (Data) {
// option (google.api.http).get = "/v2/{resource=**}";
// }
// }
//
// Example of a mixin configuration:
//
// apis:
// - name: google.storage.v2.Storage
// mixins:
// - name: google.acl.v1.AccessControl
//
// The mixin construct implies that all methods in `AccessControl` are
// also declared with same name and request/response types in
// `Storage`. A documentation generator or annotation processor will
// see the effective `Storage.GetAcl` method after inherting
// documentation and annotations as follows:
//
// service Storage {
// // Get the underlying ACL object.
// rpc GetAcl(GetAclRequest) returns (Acl) {
// option (google.api.http).get = "/v2/{resource=**}:getAcl";
// }
// ...
// }
//
// Note how the version in the path pattern changed from `v1` to `v2`.
//
// If the `root` field in the mixin is specified, it should be a
// relative path under which inherited HTTP paths are placed. Example:
//
// apis:
// - name: google.storage.v2.Storage
// mixins:
// - name: google.acl.v1.AccessControl
// root: acls
//
// This implies the following inherited HTTP annotation:
//
// service Storage {
// // Get the underlying ACL object.
// rpc GetAcl(GetAclRequest) returns (Acl) {
// option (google.api.http).get = "/v2/acls/{resource=**}:getAcl";
// }
// ...
// }
message Mixin {
// The fully qualified name of the interface which is included.
string name = 1;
// If non-empty specifies a path under which inherited HTTP paths
// are rooted.
string root = 2;
}

View File

@@ -0,0 +1,76 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2007 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Author: kenton@google.com (Kenton Varda)
//
// This is proto2's version of MessageSet. See go/messageset to learn what
// MessageSets are and how they are used.
//
// In proto2, we implement MessageSet in terms of extensions, except with a
// special wire format for backwards-compatibility. To define a message that
// goes in a MessageSet in proto2, you must declare within that message's
// scope an extension of MessageSet named "message_set_extension" and with
// the field number matching the type ID. So, for example, this proto1 code:
// message Foo {
// enum TypeId { MESSAGE_TYPE_ID = 1234; }
// }
// becomes this proto2 code:
// message Foo {
// extend google.protobuf.bridge.MessageSet {
// optional Foo message_set_extension = 1234;
// }
// }
//
// Now you can use the usual proto2 extensions accessors to access this
// message. For example, the proto1 code:
// MessageSet mset;
// Foo* foo = mset.get_mutable<Foo>();
// becomes this proto2 code:
// google::protobuf::bridge::MessageSet mset;
// Foo* foo = mset.MutableExtension(Foo::message_set_extension);
//
// Of course, new code that doesn't have backwards-compatibility requirements
// should just use extensions themselves and not worry about MessageSet.
syntax = "proto2";
package google.protobuf.bridge;
option java_outer_classname = "MessageSetProtos";
option java_multiple_files = true;
option cc_enable_arenas = true;
option objc_class_prefix = "GPB";
// This is proto2's version of MessageSet.
message MessageSet {
option message_set_wire_format = true;
extensions 4 to max [verification = UNVERIFIED];
}

View File

@@ -0,0 +1,180 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
// Author: kenton@google.com (Kenton Varda)
//
// protoc (aka the Protocol Compiler) can be extended via plugins. A plugin is
// just a program that reads a CodeGeneratorRequest from stdin and writes a
// CodeGeneratorResponse to stdout.
//
// Plugins written using C++ can use google/protobuf/compiler/plugin.h instead
// of dealing with the raw protocol defined here.
//
// A plugin executable needs only to be placed somewhere in the path. The
// plugin should be named "protoc-gen-$NAME", and will then be used when the
// flag "--${NAME}_out" is passed to protoc.
syntax = "proto2";
package google.protobuf.compiler;
option java_package = "com.google.protobuf.compiler";
option java_outer_classname = "PluginProtos";
option csharp_namespace = "Google.Protobuf.Compiler";
option go_package = "google.golang.org/protobuf/types/pluginpb";
import "google/protobuf/descriptor.proto";
// The version number of protocol compiler.
message Version {
optional int32 major = 1;
optional int32 minor = 2;
optional int32 patch = 3;
// A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should
// be empty for mainline stable releases.
optional string suffix = 4;
}
// An encoded CodeGeneratorRequest is written to the plugin's stdin.
message CodeGeneratorRequest {
// The .proto files that were explicitly listed on the command-line. The
// code generator should generate code only for these files. Each file's
// descriptor will be included in proto_file, below.
repeated string file_to_generate = 1;
// The generator parameter passed on the command-line.
optional string parameter = 2;
// FileDescriptorProtos for all files in files_to_generate and everything
// they import. The files will appear in topological order, so each file
// appears before any file that imports it.
//
// Note: the files listed in files_to_generate will include runtime-retention
// options only, but all other files will include source-retention options.
// The source_file_descriptors field below is available in case you need
// source-retention options for files_to_generate.
//
// protoc guarantees that all proto_files will be written after
// the fields above, even though this is not technically guaranteed by the
// protobuf wire format. This theoretically could allow a plugin to stream
// in the FileDescriptorProtos and handle them one by one rather than read
// the entire set into memory at once. However, as of this writing, this
// is not similarly optimized on protoc's end -- it will store all fields in
// memory at once before sending them to the plugin.
//
// Type names of fields and extensions in the FileDescriptorProto are always
// fully qualified.
repeated FileDescriptorProto proto_file = 15;
// File descriptors with all options, including source-retention options.
// These descriptors are only provided for the files listed in
// files_to_generate.
repeated FileDescriptorProto source_file_descriptors = 17;
// The version number of protocol compiler.
optional Version compiler_version = 3;
}
// The plugin writes an encoded CodeGeneratorResponse to stdout.
message CodeGeneratorResponse {
// Error message. If non-empty, code generation failed. The plugin process
// should exit with status code zero even if it reports an error in this way.
//
// This should be used to indicate errors in .proto files which prevent the
// code generator from generating correct code. Errors which indicate a
// problem in protoc itself -- such as the input CodeGeneratorRequest being
// unparseable -- should be reported by writing a message to stderr and
// exiting with a non-zero status code.
optional string error = 1;
// A bitmask of supported features that the code generator supports.
// This is a bitwise "or" of values from the Feature enum.
optional uint64 supported_features = 2;
// Sync with code_generator.h.
enum Feature {
FEATURE_NONE = 0;
FEATURE_PROTO3_OPTIONAL = 1;
FEATURE_SUPPORTS_EDITIONS = 2;
}
// The minimum edition this plugin supports. This will be treated as an
// Edition enum, but we want to allow unknown values. It should be specified
// according the edition enum value, *not* the edition number. Only takes
// effect for plugins that have FEATURE_SUPPORTS_EDITIONS set.
optional int32 minimum_edition = 3;
// The maximum edition this plugin supports. This will be treated as an
// Edition enum, but we want to allow unknown values. It should be specified
// according the edition enum value, *not* the edition number. Only takes
// effect for plugins that have FEATURE_SUPPORTS_EDITIONS set.
optional int32 maximum_edition = 4;
// Represents a single generated file.
message File {
// The file name, relative to the output directory. The name must not
// contain "." or ".." components and must be relative, not be absolute (so,
// the file cannot lie outside the output directory). "/" must be used as
// the path separator, not "\".
//
// If the name is omitted, the content will be appended to the previous
// file. This allows the generator to break large files into small chunks,
// and allows the generated text to be streamed back to protoc so that large
// files need not reside completely in memory at one time. Note that as of
// this writing protoc does not optimize for this -- it will read the entire
// CodeGeneratorResponse before writing files to disk.
optional string name = 1;
// If non-empty, indicates that the named file should already exist, and the
// content here is to be inserted into that file at a defined insertion
// point. This feature allows a code generator to extend the output
// produced by another code generator. The original generator may provide
// insertion points by placing special annotations in the file that look
// like:
// @@protoc_insertion_point(NAME)
// The annotation can have arbitrary text before and after it on the line,
// which allows it to be placed in a comment. NAME should be replaced with
// an identifier naming the point -- this is what other generators will use
// as the insertion_point. Code inserted at this point will be placed
// immediately above the line containing the insertion point (thus multiple
// insertions to the same point will come out in the order they were added).
// The double-@ is intended to make it unlikely that the generated code
// could contain things that look like insertion points by accident.
//
// For example, the C++ code generator places the following line in the
// .pb.h files that it generates:
// // @@protoc_insertion_point(namespace_scope)
// This line appears within the scope of the file's package namespace, but
// outside of any particular class. Another plugin can then specify the
// insertion_point "namespace_scope" to generate additional classes or
// other declarations that should be placed in this scope.
//
// Note that if the line containing the insertion point begins with
// whitespace, the same whitespace will be added to every line of the
// inserted text. This is useful for languages like Python, where
// indentation matters. In these languages, the insertion point comment
// should be indented the same amount as any inserted code will need to be
// in order to work correctly in that context.
//
// The code generator that generates the initial file and the one which
// inserts into it must both run as part of a single invocation of protoc.
// Code generators are executed in the order in which they appear on the
// command line.
//
// If |insertion_point| is present, |name| must also be present.
optional string insertion_point = 2;
// The file contents.
optional string content = 15;
// Information describing the file content being inserted. If an insertion
// point is used, this information will be appropriately offset and inserted
// into the code generation metadata for the generated files.
optional GeneratedCodeInfo generated_code_info = 16;
}
repeated File file = 15;
}

View File

@@ -0,0 +1,77 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
syntax = "proto3";
package A.B.C;
import "ruby_generated_code_proto2_import.proto";
message TestMessage {
int32 optional_int32 = 1;
int64 optional_int64 = 2;
uint32 optional_uint32 = 3;
uint64 optional_uint64 = 4;
bool optional_bool = 5;
double optional_double = 6;
float optional_float = 7;
string optional_string = 8;
bytes optional_bytes = 9;
TestEnum optional_enum = 10;
TestMessage optional_msg = 11;
TestImportedMessage optional_proto2_submessage = 12;
repeated int32 repeated_int32 = 21;
repeated int64 repeated_int64 = 22;
repeated uint32 repeated_uint32 = 23;
repeated uint64 repeated_uint64 = 24;
repeated bool repeated_bool = 25;
repeated double repeated_double = 26;
repeated float repeated_float = 27;
repeated string repeated_string = 28;
repeated bytes repeated_bytes = 29;
repeated TestEnum repeated_enum = 30;
repeated TestMessage repeated_msg = 31;
oneof my_oneof {
int32 oneof_int32 = 41;
int64 oneof_int64 = 42;
uint32 oneof_uint32 = 43;
uint64 oneof_uint64 = 44;
bool oneof_bool = 45;
double oneof_double = 46;
float oneof_float = 47;
string oneof_string = 48;
bytes oneof_bytes = 49;
TestEnum oneof_enum = 50;
TestMessage oneof_msg = 51;
}
map<int32, string> map_int32_string = 61;
map<int64, string> map_int64_string = 62;
map<uint32, string> map_uint32_string = 63;
map<uint64, string> map_uint64_string = 64;
map<bool, string> map_bool_string = 65;
map<string, string> map_string_string = 66;
map<string, TestMessage> map_string_msg = 67;
map<string, TestEnum> map_string_enum = 68;
map<string, int32> map_string_int32 = 69;
map<string, bool> map_string_bool = 70;
message NestedMessage {
int32 foo = 1;
}
NestedMessage nested_message = 80;
}
enum TestEnum {
Default = 0;
A = 1;
B = 2;
C = 3;
}

View File

@@ -0,0 +1,78 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
syntax = "proto2";
package A.B.C;
import "ruby_generated_code_proto2_import.proto";
message TestMessage {
optional int32 optional_int32 = 1 [default = 1];
optional int64 optional_int64 = 2 [default = 2];
optional uint32 optional_uint32 = 3 [default = 3];
optional uint64 optional_uint64 = 4 [default = 4];
optional bool optional_bool = 5 [default = true];
optional double optional_double = 6 [default = 6.0];
optional float optional_float = 7 [default = 7.0];
optional string optional_string = 8 [default = "default str"];
optional bytes optional_bytes = 9 [default = "\0\1\2\100fubar"];
optional TestEnum optional_enum = 10 [default = A];
optional TestMessage optional_msg = 11;
optional TestImportedMessage optional_proto2_submessage = 12;
repeated int32 repeated_int32 = 21;
repeated int64 repeated_int64 = 22;
repeated uint32 repeated_uint32 = 23;
repeated uint64 repeated_uint64 = 24;
repeated bool repeated_bool = 25;
repeated double repeated_double = 26;
repeated float repeated_float = 27;
repeated string repeated_string = 28;
repeated bytes repeated_bytes = 29;
repeated TestEnum repeated_enum = 30;
repeated TestMessage repeated_msg = 31;
required int32 required_int32 = 41;
required int64 required_int64 = 42;
required uint32 required_uint32 = 43;
required uint64 required_uint64 = 44;
required bool required_bool = 45;
required double required_double = 46;
required float required_float = 47;
required string required_string = 48;
required bytes required_bytes = 49;
required TestEnum required_enum = 50;
required TestMessage required_msg = 51;
oneof my_oneof {
int32 oneof_int32 = 61;
int64 oneof_int64 = 62;
uint32 oneof_uint32 = 63;
uint64 oneof_uint64 = 64;
bool oneof_bool = 65;
double oneof_double = 66;
float oneof_float = 67;
string oneof_string = 68;
bytes oneof_bytes = 69;
TestEnum oneof_enum = 70;
TestMessage oneof_msg = 71;
}
message NestedMessage {
optional int32 foo = 1;
}
optional NestedMessage nested_message = 80;
}
enum TestEnum {
Default = 0;
A = 1;
B = 2;
C = 3;
}

View File

@@ -0,0 +1,12 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
syntax = "proto2";
package A.B.C;
message TestImportedMessage {}

Some files were not shown because too many files have changed in this diff Show More