1*d5c09012SAndroid Build Coastguard Worker// Copyright 2023 Google LLC 2*d5c09012SAndroid Build Coastguard Worker// 3*d5c09012SAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License"); 4*d5c09012SAndroid Build Coastguard Worker// you may not use this file except in compliance with the License. 5*d5c09012SAndroid Build Coastguard Worker// You may obtain a copy of the License at 6*d5c09012SAndroid Build Coastguard Worker// 7*d5c09012SAndroid Build Coastguard Worker// http://www.apache.org/licenses/LICENSE-2.0 8*d5c09012SAndroid Build Coastguard Worker// 9*d5c09012SAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software 10*d5c09012SAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS, 11*d5c09012SAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12*d5c09012SAndroid Build Coastguard Worker// See the License for the specific language governing permissions and 13*d5c09012SAndroid Build Coastguard Worker// limitations under the License. 14*d5c09012SAndroid Build Coastguard Worker 15*d5c09012SAndroid Build Coastguard Workersyntax = "proto3"; 16*d5c09012SAndroid Build Coastguard Worker 17*d5c09012SAndroid Build Coastguard Workerpackage google.api.apikeys.v2; 18*d5c09012SAndroid Build Coastguard Worker 19*d5c09012SAndroid Build Coastguard Workerimport "google/api/field_behavior.proto"; 20*d5c09012SAndroid Build Coastguard Workerimport "google/api/resource.proto"; 21*d5c09012SAndroid Build Coastguard Workerimport "google/protobuf/timestamp.proto"; 22*d5c09012SAndroid Build Coastguard Worker 23*d5c09012SAndroid Build Coastguard Workeroption csharp_namespace = "Google.Cloud.ApiKeys.V2"; 24*d5c09012SAndroid Build Coastguard Workeroption go_package = "cloud.google.com/go/apikeys/apiv2/apikeyspb;apikeyspb"; 25*d5c09012SAndroid Build Coastguard Workeroption java_multiple_files = true; 26*d5c09012SAndroid Build Coastguard Workeroption java_outer_classname = "ResourcesProto"; 27*d5c09012SAndroid Build Coastguard Workeroption java_package = "com.google.api.apikeys.v2"; 28*d5c09012SAndroid Build Coastguard Workeroption php_namespace = "Google\\Cloud\\ApiKeys\\V2"; 29*d5c09012SAndroid Build Coastguard Workeroption ruby_package = "Google::Cloud::ApiKeys::V2"; 30*d5c09012SAndroid Build Coastguard Worker 31*d5c09012SAndroid Build Coastguard Worker// The representation of a key managed by the API Keys API. 32*d5c09012SAndroid Build Coastguard Workermessage Key { 33*d5c09012SAndroid Build Coastguard Worker option (google.api.resource) = { 34*d5c09012SAndroid Build Coastguard Worker type: "apikeys.googleapis.com/Key" 35*d5c09012SAndroid Build Coastguard Worker pattern: "projects/{project}/locations/{location}/keys/{key}" 36*d5c09012SAndroid Build Coastguard Worker plural: "keys" 37*d5c09012SAndroid Build Coastguard Worker singular: "key" 38*d5c09012SAndroid Build Coastguard Worker style: DECLARATIVE_FRIENDLY 39*d5c09012SAndroid Build Coastguard Worker }; 40*d5c09012SAndroid Build Coastguard Worker 41*d5c09012SAndroid Build Coastguard Worker // Output only. The resource name of the key. 42*d5c09012SAndroid Build Coastguard Worker // The `name` has the form: 43*d5c09012SAndroid Build Coastguard Worker // `projects/<PROJECT_NUMBER>/locations/global/keys/<KEY_ID>`. 44*d5c09012SAndroid Build Coastguard Worker // For example: 45*d5c09012SAndroid Build Coastguard Worker // `projects/123456867718/locations/global/keys/b7ff1f9f-8275-410a-94dd-3855ee9b5dd2` 46*d5c09012SAndroid Build Coastguard Worker // 47*d5c09012SAndroid Build Coastguard Worker // NOTE: Key is a global resource; hence the only supported value for 48*d5c09012SAndroid Build Coastguard Worker // location is `global`. 49*d5c09012SAndroid Build Coastguard Worker string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; 50*d5c09012SAndroid Build Coastguard Worker 51*d5c09012SAndroid Build Coastguard Worker // Output only. Unique id in UUID4 format. 52*d5c09012SAndroid Build Coastguard Worker string uid = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; 53*d5c09012SAndroid Build Coastguard Worker 54*d5c09012SAndroid Build Coastguard Worker // Human-readable display name of this key that you can modify. 55*d5c09012SAndroid Build Coastguard Worker // The maximum length is 63 characters. 56*d5c09012SAndroid Build Coastguard Worker string display_name = 2; 57*d5c09012SAndroid Build Coastguard Worker 58*d5c09012SAndroid Build Coastguard Worker // Output only. An encrypted and signed value held by this key. 59*d5c09012SAndroid Build Coastguard Worker // This field can be accessed only through the `GetKeyString` method. 60*d5c09012SAndroid Build Coastguard Worker string key_string = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; 61*d5c09012SAndroid Build Coastguard Worker 62*d5c09012SAndroid Build Coastguard Worker // Output only. A timestamp identifying the time this key was originally 63*d5c09012SAndroid Build Coastguard Worker // created. 64*d5c09012SAndroid Build Coastguard Worker google.protobuf.Timestamp create_time = 4 65*d5c09012SAndroid Build Coastguard Worker [(google.api.field_behavior) = OUTPUT_ONLY]; 66*d5c09012SAndroid Build Coastguard Worker 67*d5c09012SAndroid Build Coastguard Worker // Output only. A timestamp identifying the time this key was last 68*d5c09012SAndroid Build Coastguard Worker // updated. 69*d5c09012SAndroid Build Coastguard Worker google.protobuf.Timestamp update_time = 6 70*d5c09012SAndroid Build Coastguard Worker [(google.api.field_behavior) = OUTPUT_ONLY]; 71*d5c09012SAndroid Build Coastguard Worker 72*d5c09012SAndroid Build Coastguard Worker // Output only. A timestamp when this key was deleted. If the resource is not 73*d5c09012SAndroid Build Coastguard Worker // deleted, this must be empty. 74*d5c09012SAndroid Build Coastguard Worker google.protobuf.Timestamp delete_time = 7 75*d5c09012SAndroid Build Coastguard Worker [(google.api.field_behavior) = OUTPUT_ONLY]; 76*d5c09012SAndroid Build Coastguard Worker 77*d5c09012SAndroid Build Coastguard Worker // Annotations is an unstructured key-value map stored with a policy that 78*d5c09012SAndroid Build Coastguard Worker // may be set by external tools to store and retrieve arbitrary metadata. 79*d5c09012SAndroid Build Coastguard Worker // They are not queryable and should be preserved when modifying objects. 80*d5c09012SAndroid Build Coastguard Worker map<string, string> annotations = 8; 81*d5c09012SAndroid Build Coastguard Worker 82*d5c09012SAndroid Build Coastguard Worker // Key restrictions. 83*d5c09012SAndroid Build Coastguard Worker Restrictions restrictions = 9; 84*d5c09012SAndroid Build Coastguard Worker 85*d5c09012SAndroid Build Coastguard Worker // Output only. A checksum computed by the server based on the current value 86*d5c09012SAndroid Build Coastguard Worker // of the Key resource. This may be sent on update and delete requests to 87*d5c09012SAndroid Build Coastguard Worker // ensure the client has an up-to-date value before proceeding. See 88*d5c09012SAndroid Build Coastguard Worker // https://google.aip.dev/154. 89*d5c09012SAndroid Build Coastguard Worker string etag = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; 90*d5c09012SAndroid Build Coastguard Worker} 91*d5c09012SAndroid Build Coastguard Worker 92*d5c09012SAndroid Build Coastguard Worker// Describes the restrictions on the key. 93*d5c09012SAndroid Build Coastguard Workermessage Restrictions { 94*d5c09012SAndroid Build Coastguard Worker // The websites, IP addresses, Android apps, or iOS apps (the clients) that 95*d5c09012SAndroid Build Coastguard Worker // are allowed to use the key. You can specify only one type of client 96*d5c09012SAndroid Build Coastguard Worker // restrictions per key. 97*d5c09012SAndroid Build Coastguard Worker oneof client_restrictions { 98*d5c09012SAndroid Build Coastguard Worker // The HTTP referrers (websites) that are allowed to use the key. 99*d5c09012SAndroid Build Coastguard Worker BrowserKeyRestrictions browser_key_restrictions = 1; 100*d5c09012SAndroid Build Coastguard Worker 101*d5c09012SAndroid Build Coastguard Worker // The IP addresses of callers that are allowed to use the key. 102*d5c09012SAndroid Build Coastguard Worker ServerKeyRestrictions server_key_restrictions = 2; 103*d5c09012SAndroid Build Coastguard Worker 104*d5c09012SAndroid Build Coastguard Worker // The Android apps that are allowed to use the key. 105*d5c09012SAndroid Build Coastguard Worker AndroidKeyRestrictions android_key_restrictions = 3; 106*d5c09012SAndroid Build Coastguard Worker 107*d5c09012SAndroid Build Coastguard Worker // The iOS apps that are allowed to use the key. 108*d5c09012SAndroid Build Coastguard Worker IosKeyRestrictions ios_key_restrictions = 4; 109*d5c09012SAndroid Build Coastguard Worker } 110*d5c09012SAndroid Build Coastguard Worker 111*d5c09012SAndroid Build Coastguard Worker // A restriction for a specific service and optionally one or 112*d5c09012SAndroid Build Coastguard Worker // more specific methods. Requests are allowed if they 113*d5c09012SAndroid Build Coastguard Worker // match any of these restrictions. If no restrictions are 114*d5c09012SAndroid Build Coastguard Worker // specified, all targets are allowed. 115*d5c09012SAndroid Build Coastguard Worker repeated ApiTarget api_targets = 5; 116*d5c09012SAndroid Build Coastguard Worker} 117*d5c09012SAndroid Build Coastguard Worker 118*d5c09012SAndroid Build Coastguard Worker// The HTTP referrers (websites) that are allowed to use the key. 119*d5c09012SAndroid Build Coastguard Workermessage BrowserKeyRestrictions { 120*d5c09012SAndroid Build Coastguard Worker // A list of regular expressions for the referrer URLs that are allowed 121*d5c09012SAndroid Build Coastguard Worker // to make API calls with this key. 122*d5c09012SAndroid Build Coastguard Worker repeated string allowed_referrers = 1; 123*d5c09012SAndroid Build Coastguard Worker} 124*d5c09012SAndroid Build Coastguard Worker 125*d5c09012SAndroid Build Coastguard Worker// The IP addresses of callers that are allowed to use the key. 126*d5c09012SAndroid Build Coastguard Workermessage ServerKeyRestrictions { 127*d5c09012SAndroid Build Coastguard Worker // A list of the caller IP addresses that are allowed to make API calls 128*d5c09012SAndroid Build Coastguard Worker // with this key. 129*d5c09012SAndroid Build Coastguard Worker repeated string allowed_ips = 1; 130*d5c09012SAndroid Build Coastguard Worker} 131*d5c09012SAndroid Build Coastguard Worker 132*d5c09012SAndroid Build Coastguard Worker// The Android apps that are allowed to use the key. 133*d5c09012SAndroid Build Coastguard Workermessage AndroidKeyRestrictions { 134*d5c09012SAndroid Build Coastguard Worker // A list of Android applications that are allowed to make API calls with 135*d5c09012SAndroid Build Coastguard Worker // this key. 136*d5c09012SAndroid Build Coastguard Worker repeated AndroidApplication allowed_applications = 1; 137*d5c09012SAndroid Build Coastguard Worker} 138*d5c09012SAndroid Build Coastguard Worker 139*d5c09012SAndroid Build Coastguard Worker// Identifier of an Android application for key use. 140*d5c09012SAndroid Build Coastguard Workermessage AndroidApplication { 141*d5c09012SAndroid Build Coastguard Worker // The SHA1 fingerprint of the application. For example, both sha1 formats are 142*d5c09012SAndroid Build Coastguard Worker // acceptable : DA:39:A3:EE:5E:6B:4B:0D:32:55:BF:EF:95:60:18:90:AF:D8:07:09 or 143*d5c09012SAndroid Build Coastguard Worker // DA39A3EE5E6B4B0D3255BFEF95601890AFD80709. 144*d5c09012SAndroid Build Coastguard Worker // Output format is the latter. 145*d5c09012SAndroid Build Coastguard Worker string sha1_fingerprint = 1; 146*d5c09012SAndroid Build Coastguard Worker 147*d5c09012SAndroid Build Coastguard Worker // The package name of the application. 148*d5c09012SAndroid Build Coastguard Worker string package_name = 2; 149*d5c09012SAndroid Build Coastguard Worker} 150*d5c09012SAndroid Build Coastguard Worker 151*d5c09012SAndroid Build Coastguard Worker// The iOS apps that are allowed to use the key. 152*d5c09012SAndroid Build Coastguard Workermessage IosKeyRestrictions { 153*d5c09012SAndroid Build Coastguard Worker // A list of bundle IDs that are allowed when making API calls with this key. 154*d5c09012SAndroid Build Coastguard Worker repeated string allowed_bundle_ids = 1; 155*d5c09012SAndroid Build Coastguard Worker} 156*d5c09012SAndroid Build Coastguard Worker 157*d5c09012SAndroid Build Coastguard Worker// A restriction for a specific service and optionally one or multiple 158*d5c09012SAndroid Build Coastguard Worker// specific methods. Both fields are case insensitive. 159*d5c09012SAndroid Build Coastguard Workermessage ApiTarget { 160*d5c09012SAndroid Build Coastguard Worker // The service for this restriction. It should be the canonical 161*d5c09012SAndroid Build Coastguard Worker // service name, for example: `translate.googleapis.com`. 162*d5c09012SAndroid Build Coastguard Worker // You can use [`gcloud services list`](/sdk/gcloud/reference/services/list) 163*d5c09012SAndroid Build Coastguard Worker // to get a list of services that are enabled in the project. 164*d5c09012SAndroid Build Coastguard Worker string service = 1; 165*d5c09012SAndroid Build Coastguard Worker 166*d5c09012SAndroid Build Coastguard Worker // Optional. List of one or more methods that can be called. 167*d5c09012SAndroid Build Coastguard Worker // If empty, all methods for the service are allowed. A wildcard 168*d5c09012SAndroid Build Coastguard Worker // (*) can be used as the last symbol. 169*d5c09012SAndroid Build Coastguard Worker // Valid examples: 170*d5c09012SAndroid Build Coastguard Worker // `google.cloud.translate.v2.TranslateService.GetSupportedLanguage` 171*d5c09012SAndroid Build Coastguard Worker // `TranslateText` 172*d5c09012SAndroid Build Coastguard Worker // `Get*` 173*d5c09012SAndroid Build Coastguard Worker // `translate.googleapis.com.Get*` 174*d5c09012SAndroid Build Coastguard Worker repeated string methods = 2 [(google.api.field_behavior) = OPTIONAL]; 175*d5c09012SAndroid Build Coastguard Worker} 176