最新版本
This commit is contained in:
41
google/api/apikeys/BUILD.bazel
Normal file
41
google/api/apikeys/BUILD.bazel
Normal file
@@ -0,0 +1,41 @@
|
||||
# This build file includes a target for the Ruby wrapper library for
|
||||
# google-cloud-api_keys.
|
||||
|
||||
# This is an API workspace, having public visibility by default makes perfect sense.
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
# Export yaml configs.
|
||||
exports_files(glob(["*.yaml"]))
|
||||
|
||||
load(
|
||||
"@com_google_googleapis_imports//:imports.bzl",
|
||||
"ruby_cloud_gapic_library",
|
||||
"ruby_gapic_assembly_pkg",
|
||||
)
|
||||
|
||||
# Generates a Ruby wrapper client for apikeys.
|
||||
# Ruby wrapper clients are versionless, but are generated from source protos
|
||||
# for a particular service version, v2 in this case.
|
||||
ruby_cloud_gapic_library(
|
||||
name = "apikeys_ruby_wrapper",
|
||||
srcs = ["//google/api/apikeys/v2:apikeys_proto_with_info"],
|
||||
extra_protoc_parameters = [
|
||||
"ruby-cloud-api-id=apikeys.googleapis.com",
|
||||
"ruby-cloud-api-shortname=apikeys",
|
||||
"ruby-cloud-gem-name=google-cloud-api_keys",
|
||||
"ruby-cloud-product-url=https://cloud.google.com/api-keys/",
|
||||
"ruby-cloud-wrapper-of=v2:0.2",
|
||||
],
|
||||
ruby_cloud_description = "An API key is a simple encrypted string that you can use when calling Google Cloud APIs. The API Keys service manages the API keys associated with developer projects.",
|
||||
ruby_cloud_title = "API Keys",
|
||||
transport = "grpc+rest",
|
||||
)
|
||||
|
||||
# Open Source package.
|
||||
ruby_gapic_assembly_pkg(
|
||||
name = "google-cloud-apikeys-ruby",
|
||||
deps = [
|
||||
":apikeys_ruby_wrapper",
|
||||
],
|
||||
)
|
||||
|
||||
389
google/api/apikeys/v2/BUILD.bazel
Normal file
389
google/api/apikeys/v2/BUILD.bazel
Normal file
@@ -0,0 +1,389 @@
|
||||
# This file was automatically generated by BuildFileGenerator
|
||||
# https://github.com/googleapis/rules_gapic/tree/master/bazel
|
||||
|
||||
# Most of the manual changes to this file will be overwritten.
|
||||
# It's **only** allowed to change the following rule attribute values:
|
||||
# - names of *_gapic_assembly_* rules
|
||||
# - certain parameters of *_gapic_library rules, including but not limited to:
|
||||
# * extra_protoc_parameters
|
||||
# * extra_protoc_file_parameters
|
||||
# The complete list of preserved parameters can be found in the source code.
|
||||
|
||||
# This is an API workspace, having public visibility by default makes perfect sense.
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
##############################################################################
|
||||
# Common
|
||||
##############################################################################
|
||||
load("@rules_proto//proto:defs.bzl", "proto_library")
|
||||
load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
|
||||
|
||||
proto_library(
|
||||
name = "apikeys_proto",
|
||||
srcs = [
|
||||
"apikeys.proto",
|
||||
"resources.proto",
|
||||
],
|
||||
deps = [
|
||||
"//google/api:annotations_proto",
|
||||
"//google/api:client_proto",
|
||||
"//google/api:field_behavior_proto",
|
||||
"//google/api:resource_proto",
|
||||
"//google/longrunning:operations_proto",
|
||||
"@com_google_protobuf//:empty_proto",
|
||||
"@com_google_protobuf//:field_mask_proto",
|
||||
"@com_google_protobuf//:timestamp_proto",
|
||||
],
|
||||
)
|
||||
|
||||
proto_library_with_info(
|
||||
name = "apikeys_proto_with_info",
|
||||
deps = [
|
||||
":apikeys_proto",
|
||||
"//google/cloud:common_resources_proto",
|
||||
],
|
||||
)
|
||||
|
||||
##############################################################################
|
||||
# Java
|
||||
##############################################################################
|
||||
load(
|
||||
"@com_google_googleapis_imports//:imports.bzl",
|
||||
"java_gapic_assembly_gradle_pkg",
|
||||
"java_gapic_library",
|
||||
"java_gapic_test",
|
||||
"java_grpc_library",
|
||||
"java_proto_library",
|
||||
)
|
||||
|
||||
java_proto_library(
|
||||
name = "apikeys_java_proto",
|
||||
deps = [":apikeys_proto"],
|
||||
)
|
||||
|
||||
java_grpc_library(
|
||||
name = "apikeys_java_grpc",
|
||||
srcs = [":apikeys_proto"],
|
||||
deps = [":apikeys_java_proto"],
|
||||
)
|
||||
|
||||
java_gapic_library(
|
||||
name = "apikeys_java_gapic",
|
||||
srcs = [":apikeys_proto_with_info"],
|
||||
gapic_yaml = None,
|
||||
grpc_service_config = "apikeys_grpc_service_config.json",
|
||||
rest_numeric_enums = True,
|
||||
service_yaml = "apikeys_v2.yaml",
|
||||
test_deps = [
|
||||
":apikeys_java_grpc",
|
||||
],
|
||||
transport = "grpc+rest",
|
||||
deps = [
|
||||
":apikeys_java_proto",
|
||||
"//google/api:api_java_proto",
|
||||
],
|
||||
)
|
||||
|
||||
java_gapic_test(
|
||||
name = "apikeys_java_gapic_test_suite",
|
||||
test_classes = [
|
||||
"com.google.api.apikeys.v2.ApiKeysClientHttpJsonTest",
|
||||
"com.google.api.apikeys.v2.ApiKeysClientTest",
|
||||
],
|
||||
runtime_deps = [":apikeys_java_gapic_test"],
|
||||
)
|
||||
|
||||
# Open Source Packages
|
||||
java_gapic_assembly_gradle_pkg(
|
||||
name = "google-cloud-api-apikeys-v2-java",
|
||||
include_samples = True,
|
||||
transport = "grpc+rest",
|
||||
deps = [
|
||||
":apikeys_java_gapic",
|
||||
":apikeys_java_grpc",
|
||||
":apikeys_java_proto",
|
||||
":apikeys_proto",
|
||||
],
|
||||
)
|
||||
|
||||
##############################################################################
|
||||
# Go
|
||||
##############################################################################
|
||||
load(
|
||||
"@com_google_googleapis_imports//:imports.bzl",
|
||||
"go_gapic_assembly_pkg",
|
||||
"go_gapic_library",
|
||||
"go_proto_library",
|
||||
)
|
||||
|
||||
go_proto_library(
|
||||
name = "apikeys_go_proto",
|
||||
compilers = ["@io_bazel_rules_go//proto:go_grpc"],
|
||||
importpath = "cloud.google.com/go/apikeys/apiv2/apikeyspb",
|
||||
protos = [":apikeys_proto"],
|
||||
deps = [
|
||||
"//google/api:annotations_go_proto",
|
||||
"//google/longrunning:longrunning_go_proto",
|
||||
],
|
||||
)
|
||||
|
||||
go_gapic_library(
|
||||
name = "apikeys_go_gapic",
|
||||
srcs = [":apikeys_proto_with_info"],
|
||||
grpc_service_config = "apikeys_grpc_service_config.json",
|
||||
importpath = "cloud.google.com/go/apikeys/apiv2;apikeys",
|
||||
metadata = True,
|
||||
release_level = "ga",
|
||||
rest_numeric_enums = True,
|
||||
service_yaml = "apikeys_v2.yaml",
|
||||
transport = "grpc+rest",
|
||||
deps = [
|
||||
":apikeys_go_proto",
|
||||
"//google/longrunning:longrunning_go_proto",
|
||||
"@com_google_cloud_go_longrunning//:go_default_library",
|
||||
"@com_google_cloud_go_longrunning//autogen:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
# Open Source Packages
|
||||
go_gapic_assembly_pkg(
|
||||
name = "gapi-cloud-api-apikeys-v2-go",
|
||||
deps = [
|
||||
":apikeys_go_gapic",
|
||||
":apikeys_go_gapic_srcjar-metadata.srcjar",
|
||||
":apikeys_go_gapic_srcjar-snippets.srcjar",
|
||||
":apikeys_go_gapic_srcjar-test.srcjar",
|
||||
":apikeys_go_proto",
|
||||
],
|
||||
)
|
||||
|
||||
##############################################################################
|
||||
# Python
|
||||
##############################################################################
|
||||
load(
|
||||
"@com_google_googleapis_imports//:imports.bzl",
|
||||
"py_gapic_assembly_pkg",
|
||||
"py_gapic_library",
|
||||
"py_test",
|
||||
)
|
||||
|
||||
py_gapic_library(
|
||||
name = "apikeys_py_gapic",
|
||||
srcs = [":apikeys_proto"],
|
||||
grpc_service_config = "apikeys_grpc_service_config.json",
|
||||
opt_args = [
|
||||
"python-gapic-name=api_keys",
|
||||
"python-gapic-namespace=google.cloud",
|
||||
"warehouse-package-name=google-cloud-api-keys",
|
||||
],
|
||||
rest_numeric_enums = True,
|
||||
service_yaml = "apikeys_v2.yaml",
|
||||
transport = "grpc+rest",
|
||||
deps = [
|
||||
],
|
||||
)
|
||||
|
||||
py_test(
|
||||
name = "apikeys_py_gapic_test",
|
||||
srcs = [
|
||||
"apikeys_py_gapic_pytest.py",
|
||||
"apikeys_py_gapic_test.py",
|
||||
],
|
||||
legacy_create_init = False,
|
||||
deps = [":apikeys_py_gapic"],
|
||||
)
|
||||
|
||||
# Open Source Packages
|
||||
py_gapic_assembly_pkg(
|
||||
name = "api-apikeys-v2-py",
|
||||
deps = [
|
||||
":apikeys_py_gapic",
|
||||
],
|
||||
)
|
||||
|
||||
##############################################################################
|
||||
# PHP
|
||||
##############################################################################
|
||||
load(
|
||||
"@com_google_googleapis_imports//:imports.bzl",
|
||||
"php_gapic_assembly_pkg",
|
||||
"php_gapic_library",
|
||||
"php_proto_library",
|
||||
)
|
||||
|
||||
php_proto_library(
|
||||
name = "apikeys_php_proto",
|
||||
deps = [":apikeys_proto"],
|
||||
)
|
||||
|
||||
php_gapic_library(
|
||||
name = "apikeys_php_gapic",
|
||||
srcs = [":apikeys_proto_with_info"],
|
||||
grpc_service_config = "apikeys_grpc_service_config.json",
|
||||
migration_mode = "MIGRATING",
|
||||
rest_numeric_enums = True,
|
||||
service_yaml = "apikeys_v2.yaml",
|
||||
transport = "grpc+rest",
|
||||
deps = [
|
||||
":apikeys_php_proto",
|
||||
],
|
||||
)
|
||||
|
||||
# Open Source Packages
|
||||
php_gapic_assembly_pkg(
|
||||
name = "google-cloud-api-apikeys-v2-php",
|
||||
deps = [
|
||||
":apikeys_php_gapic",
|
||||
":apikeys_php_proto",
|
||||
],
|
||||
)
|
||||
|
||||
##############################################################################
|
||||
# Node.js
|
||||
##############################################################################
|
||||
load(
|
||||
"@com_google_googleapis_imports//:imports.bzl",
|
||||
"nodejs_gapic_assembly_pkg",
|
||||
"nodejs_gapic_library",
|
||||
)
|
||||
|
||||
nodejs_gapic_library(
|
||||
name = "apikeys_nodejs_gapic",
|
||||
package_name = "@google-cloud/apikeys",
|
||||
src = ":apikeys_proto_with_info",
|
||||
extra_protoc_parameters = ["metadata"],
|
||||
grpc_service_config = "apikeys_grpc_service_config.json",
|
||||
package = "google.api.apikeys.v2",
|
||||
rest_numeric_enums = True,
|
||||
service_yaml = "apikeys_v2.yaml",
|
||||
transport = "grpc+rest",
|
||||
deps = [],
|
||||
)
|
||||
|
||||
nodejs_gapic_assembly_pkg(
|
||||
name = "api-apikeys-v2-nodejs",
|
||||
deps = [
|
||||
":apikeys_nodejs_gapic",
|
||||
":apikeys_proto",
|
||||
],
|
||||
)
|
||||
|
||||
##############################################################################
|
||||
# Ruby
|
||||
##############################################################################
|
||||
load(
|
||||
"@com_google_googleapis_imports//:imports.bzl",
|
||||
"ruby_cloud_gapic_library",
|
||||
"ruby_gapic_assembly_pkg",
|
||||
"ruby_grpc_library",
|
||||
"ruby_proto_library",
|
||||
)
|
||||
|
||||
ruby_proto_library(
|
||||
name = "apikeys_ruby_proto",
|
||||
deps = [":apikeys_proto"],
|
||||
)
|
||||
|
||||
ruby_grpc_library(
|
||||
name = "apikeys_ruby_grpc",
|
||||
srcs = [":apikeys_proto"],
|
||||
deps = [":apikeys_ruby_proto"],
|
||||
)
|
||||
|
||||
ruby_cloud_gapic_library(
|
||||
name = "apikeys_ruby_gapic",
|
||||
srcs = [":apikeys_proto_with_info"],
|
||||
extra_protoc_parameters = [
|
||||
"ruby-cloud-api-id=apikeys.googleapis.com",
|
||||
"ruby-cloud-api-shortname=apikeys",
|
||||
"ruby-cloud-gem-name=google-cloud-api_keys-v2",
|
||||
"ruby-cloud-product-url=https://cloud.google.com/api-keys/",
|
||||
],
|
||||
grpc_service_config = "apikeys_grpc_service_config.json",
|
||||
rest_numeric_enums = True,
|
||||
ruby_cloud_description = "An API key is a simple encrypted string that you can use when calling Google Cloud APIs. The API Keys service manages the API keys associated with developer projects.",
|
||||
ruby_cloud_title = "API Keys V2",
|
||||
service_yaml = "apikeys_v2.yaml",
|
||||
transport = "grpc+rest",
|
||||
deps = [
|
||||
":apikeys_ruby_grpc",
|
||||
":apikeys_ruby_proto",
|
||||
],
|
||||
)
|
||||
|
||||
# Open Source Packages
|
||||
ruby_gapic_assembly_pkg(
|
||||
name = "google-cloud-api-apikeys-v2-ruby",
|
||||
deps = [
|
||||
":apikeys_ruby_gapic",
|
||||
":apikeys_ruby_grpc",
|
||||
":apikeys_ruby_proto",
|
||||
],
|
||||
)
|
||||
|
||||
##############################################################################
|
||||
# C#
|
||||
##############################################################################
|
||||
load(
|
||||
"@com_google_googleapis_imports//:imports.bzl",
|
||||
"csharp_gapic_assembly_pkg",
|
||||
"csharp_gapic_library",
|
||||
"csharp_grpc_library",
|
||||
"csharp_proto_library",
|
||||
)
|
||||
|
||||
csharp_proto_library(
|
||||
name = "apikeys_csharp_proto",
|
||||
deps = [":apikeys_proto"],
|
||||
)
|
||||
|
||||
csharp_grpc_library(
|
||||
name = "apikeys_csharp_grpc",
|
||||
srcs = [":apikeys_proto"],
|
||||
deps = [":apikeys_csharp_proto"],
|
||||
)
|
||||
|
||||
csharp_gapic_library(
|
||||
name = "apikeys_csharp_gapic",
|
||||
srcs = [":apikeys_proto_with_info"],
|
||||
common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
|
||||
grpc_service_config = "apikeys_grpc_service_config.json",
|
||||
rest_numeric_enums = True,
|
||||
service_yaml = "apikeys_v2.yaml",
|
||||
transport = "grpc+rest",
|
||||
deps = [
|
||||
":apikeys_csharp_grpc",
|
||||
":apikeys_csharp_proto",
|
||||
],
|
||||
)
|
||||
|
||||
# Open Source Packages
|
||||
csharp_gapic_assembly_pkg(
|
||||
name = "google-cloud-api-apikeys-v2-csharp",
|
||||
deps = [
|
||||
":apikeys_csharp_gapic",
|
||||
":apikeys_csharp_grpc",
|
||||
":apikeys_csharp_proto",
|
||||
],
|
||||
)
|
||||
|
||||
##############################################################################
|
||||
# C++
|
||||
##############################################################################
|
||||
load(
|
||||
"@com_google_googleapis_imports//:imports.bzl",
|
||||
"cc_grpc_library",
|
||||
"cc_proto_library",
|
||||
)
|
||||
|
||||
cc_proto_library(
|
||||
name = "apikeys_cc_proto",
|
||||
deps = [":apikeys_proto"],
|
||||
)
|
||||
|
||||
cc_grpc_library(
|
||||
name = "apikeys_cc_grpc",
|
||||
srcs = [":apikeys_proto"],
|
||||
grpc_only = True,
|
||||
deps = [":apikeys_cc_proto"],
|
||||
)
|
||||
288
google/api/apikeys/v2/apikeys.proto
Normal file
288
google/api/apikeys/v2/apikeys.proto
Normal 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;
|
||||
}
|
||||
8
google/api/apikeys/v2/apikeys_grpc_service_config.json
Normal file
8
google/api/apikeys/v2/apikeys_grpc_service_config.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"methodConfig": [{
|
||||
"name": [
|
||||
{ "service": "google.api.apikeys.v2.ApiKeys" }
|
||||
],
|
||||
"timeout": "10s"
|
||||
}]
|
||||
}
|
||||
55
google/api/apikeys/v2/apikeys_v2.yaml
Normal file
55
google/api/apikeys/v2/apikeys_v2.yaml
Normal file
@@ -0,0 +1,55 @@
|
||||
type: google.api.Service
|
||||
config_version: 3
|
||||
name: apikeys.googleapis.com
|
||||
title: API Keys API
|
||||
|
||||
apis:
|
||||
- name: google.api.apikeys.v2.ApiKeys
|
||||
- name: google.longrunning.Operations
|
||||
|
||||
documentation:
|
||||
summary: Manages the API keys associated with developer projects.
|
||||
|
||||
backend:
|
||||
rules:
|
||||
- selector: 'google.api.apikeys.v2.ApiKeys.*'
|
||||
deadline: 120.0
|
||||
- selector: google.longrunning.Operations.GetOperation
|
||||
deadline: 120.0
|
||||
|
||||
http:
|
||||
rules:
|
||||
- selector: google.longrunning.Operations.GetOperation
|
||||
get: '/v2/{name=operations/*}'
|
||||
|
||||
authentication:
|
||||
rules:
|
||||
- selector: 'google.api.apikeys.v2.ApiKeys.*'
|
||||
oauth:
|
||||
canonical_scopes: |-
|
||||
https://www.googleapis.com/auth/cloud-platform
|
||||
- selector: google.api.apikeys.v2.ApiKeys.GetKey
|
||||
oauth:
|
||||
canonical_scopes: |-
|
||||
https://www.googleapis.com/auth/cloud-platform,
|
||||
https://www.googleapis.com/auth/cloud-platform.read-only
|
||||
- selector: google.api.apikeys.v2.ApiKeys.GetKeyString
|
||||
oauth:
|
||||
canonical_scopes: |-
|
||||
https://www.googleapis.com/auth/cloud-platform,
|
||||
https://www.googleapis.com/auth/cloud-platform.read-only
|
||||
- selector: google.api.apikeys.v2.ApiKeys.ListKeys
|
||||
oauth:
|
||||
canonical_scopes: |-
|
||||
https://www.googleapis.com/auth/cloud-platform,
|
||||
https://www.googleapis.com/auth/cloud-platform.read-only
|
||||
- selector: google.api.apikeys.v2.ApiKeys.LookupKey
|
||||
oauth:
|
||||
canonical_scopes: |-
|
||||
https://www.googleapis.com/auth/cloud-platform,
|
||||
https://www.googleapis.com/auth/cloud-platform.read-only
|
||||
- selector: google.longrunning.Operations.GetOperation
|
||||
oauth:
|
||||
canonical_scopes: |-
|
||||
https://www.googleapis.com/auth/cloud-platform,
|
||||
https://www.googleapis.com/auth/cloud-platform.read-only
|
||||
175
google/api/apikeys/v2/resources.proto
Normal file
175
google/api/apikeys/v2/resources.proto
Normal 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];
|
||||
}
|
||||
Reference in New Issue
Block a user