Package com.google.api.apikeys.v2 (0.9.0)

A client to API Keys API

The interfaces provided are listed below, along with usage samples.

ApiKeysClient

Service Description: Manages the API keys associated with projects.

Sample for ApiKeysClient:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
   KeyName name = KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]");
   Key response = apiKeysClient.getKey(name);
 }
 

Classes

AndroidApplication

Identifier of an Android application for key use.

Protobuf type google.api.apikeys.v2.AndroidApplication

AndroidApplication.Builder

Identifier of an Android application for key use.

Protobuf type google.api.apikeys.v2.AndroidApplication

AndroidKeyRestrictions

The Android apps that are allowed to use the key.

Protobuf type google.api.apikeys.v2.AndroidKeyRestrictions

AndroidKeyRestrictions.Builder

The Android apps that are allowed to use the key.

Protobuf type google.api.apikeys.v2.AndroidKeyRestrictions

ApiKeysClient

Service Description: Manages the API keys associated with projects.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
   KeyName name = KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]");
   Key response = apiKeysClient.getKey(name);
 }
 

Note: close() needs to be called on the ApiKeysClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of ApiKeysSettings to create(). For example:

To customize credentials:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 ApiKeysSettings apiKeysSettings =
     ApiKeysSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 ApiKeysClient apiKeysClient = ApiKeysClient.create(apiKeysSettings);
 

To customize the endpoint:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 ApiKeysSettings apiKeysSettings = ApiKeysSettings.newBuilder().setEndpoint(myEndpoint).build();
 ApiKeysClient apiKeysClient = ApiKeysClient.create(apiKeysSettings);
 

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 ApiKeysSettings apiKeysSettings = ApiKeysSettings.newHttpJsonBuilder().build();
 ApiKeysClient apiKeysClient = ApiKeysClient.create(apiKeysSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

ApiKeysClient.ListKeysFixedSizeCollection

ApiKeysClient.ListKeysPage

ApiKeysClient.ListKeysPagedResponse

ApiKeysGrpc

Manages the API keys associated with projects.

ApiKeysGrpc.ApiKeysBlockingStub

Manages the API keys associated with projects.

ApiKeysGrpc.ApiKeysFutureStub

Manages the API keys associated with projects.

ApiKeysGrpc.ApiKeysImplBase

Manages the API keys associated with projects.

ApiKeysGrpc.ApiKeysStub

Manages the API keys associated with projects.

ApiKeysProto

ApiKeysSettings

Settings class to configure an instance of ApiKeysClient.

The default instance has everything set to sensible defaults:

  • The default service address (apikeys.googleapis.com) and default port (443) are used.
  • Credentials are acquired automatically through Application Default Credentials.
  • Retries are configured for idempotent methods but not for non-idempotent methods.

The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object.

For example, to set the total timeout of getKey to 30 seconds:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 ApiKeysSettings.Builder apiKeysSettingsBuilder = ApiKeysSettings.newBuilder();
 apiKeysSettingsBuilder
     .getKeySettings()
     .setRetrySettings(
         apiKeysSettingsBuilder
             .getKeySettings()
             .getRetrySettings()
             .toBuilder()
             .setTotalTimeout(Duration.ofSeconds(30))
             .build());
 ApiKeysSettings apiKeysSettings = apiKeysSettingsBuilder.build();
 

ApiKeysSettings.Builder

Builder for ApiKeysSettings.

ApiTarget

A restriction for a specific service and optionally one or multiple specific methods. Both fields are case insensitive.

Protobuf type google.api.apikeys.v2.ApiTarget

ApiTarget.Builder

A restriction for a specific service and optionally one or multiple specific methods. Both fields are case insensitive.

Protobuf type google.api.apikeys.v2.ApiTarget

BrowserKeyRestrictions

The HTTP referrers (websites) that are allowed to use the key.

Protobuf type google.api.apikeys.v2.BrowserKeyRestrictions

BrowserKeyRestrictions.Builder

The HTTP referrers (websites) that are allowed to use the key.

Protobuf type google.api.apikeys.v2.BrowserKeyRestrictions

CreateKeyRequest

Request message for CreateKey method.

Protobuf type google.api.apikeys.v2.CreateKeyRequest

CreateKeyRequest.Builder

Request message for CreateKey method.

Protobuf type google.api.apikeys.v2.CreateKeyRequest

DeleteKeyRequest

Request message for DeleteKey method.

Protobuf type google.api.apikeys.v2.DeleteKeyRequest

DeleteKeyRequest.Builder

Request message for DeleteKey method.

Protobuf type google.api.apikeys.v2.DeleteKeyRequest

GetKeyRequest

Request message for GetKey method.

Protobuf type google.api.apikeys.v2.GetKeyRequest

GetKeyRequest.Builder

Request message for GetKey method.

Protobuf type google.api.apikeys.v2.GetKeyRequest

GetKeyStringRequest

Request message for GetKeyString method.

Protobuf type google.api.apikeys.v2.GetKeyStringRequest

GetKeyStringRequest.Builder

Request message for GetKeyString method.

Protobuf type google.api.apikeys.v2.GetKeyStringRequest

GetKeyStringResponse

Response message for GetKeyString method.

Protobuf type google.api.apikeys.v2.GetKeyStringResponse

GetKeyStringResponse.Builder

Response message for GetKeyString method.

Protobuf type google.api.apikeys.v2.GetKeyStringResponse

IosKeyRestrictions

The iOS apps that are allowed to use the key.

Protobuf type google.api.apikeys.v2.IosKeyRestrictions

IosKeyRestrictions.Builder

The iOS apps that are allowed to use the key.

Protobuf type google.api.apikeys.v2.IosKeyRestrictions

Key

The representation of a key managed by the API Keys API.

Protobuf type google.api.apikeys.v2.Key

Key.Builder

The representation of a key managed by the API Keys API.

Protobuf type google.api.apikeys.v2.Key

KeyName

KeyName.Builder

Builder for projects/{project}/locations/{location}/keys/{key}.

ListKeysRequest

Request message for ListKeys method.

Protobuf type google.api.apikeys.v2.ListKeysRequest

ListKeysRequest.Builder

Request message for ListKeys method.

Protobuf type google.api.apikeys.v2.ListKeysRequest

ListKeysResponse

Response message for ListKeys method.

Protobuf type google.api.apikeys.v2.ListKeysResponse

ListKeysResponse.Builder

Response message for ListKeys method.

Protobuf type google.api.apikeys.v2.ListKeysResponse

LocationName

LocationName.Builder

Builder for projects/{project}/locations/{location}.

LookupKeyRequest

Request message for LookupKey method.

Protobuf type google.api.apikeys.v2.LookupKeyRequest

LookupKeyRequest.Builder

Request message for LookupKey method.

Protobuf type google.api.apikeys.v2.LookupKeyRequest

LookupKeyResponse

Response message for LookupKey method.

Protobuf type google.api.apikeys.v2.LookupKeyResponse

LookupKeyResponse.Builder

Response message for LookupKey method.

Protobuf type google.api.apikeys.v2.LookupKeyResponse

ResourcesProto

Restrictions

Describes the restrictions on the key.

Protobuf type google.api.apikeys.v2.Restrictions

Restrictions.Builder

Describes the restrictions on the key.

Protobuf type google.api.apikeys.v2.Restrictions

ServerKeyRestrictions

The IP addresses of callers that are allowed to use the key.

Protobuf type google.api.apikeys.v2.ServerKeyRestrictions

ServerKeyRestrictions.Builder

The IP addresses of callers that are allowed to use the key.

Protobuf type google.api.apikeys.v2.ServerKeyRestrictions

UndeleteKeyRequest

Request message for UndeleteKey method.

Protobuf type google.api.apikeys.v2.UndeleteKeyRequest

UndeleteKeyRequest.Builder

Request message for UndeleteKey method.

Protobuf type google.api.apikeys.v2.UndeleteKeyRequest

UpdateKeyRequest

Request message for UpdateKey method.

Protobuf type google.api.apikeys.v2.UpdateKeyRequest

UpdateKeyRequest.Builder

Request message for UpdateKey method.

Protobuf type google.api.apikeys.v2.UpdateKeyRequest

Interfaces

AndroidApplicationOrBuilder

AndroidKeyRestrictionsOrBuilder

ApiTargetOrBuilder

BrowserKeyRestrictionsOrBuilder

CreateKeyRequestOrBuilder

DeleteKeyRequestOrBuilder

GetKeyRequestOrBuilder

GetKeyStringRequestOrBuilder

GetKeyStringResponseOrBuilder

IosKeyRestrictionsOrBuilder

KeyOrBuilder

ListKeysRequestOrBuilder

ListKeysResponseOrBuilder

LookupKeyRequestOrBuilder

LookupKeyResponseOrBuilder

RestrictionsOrBuilder

ServerKeyRestrictionsOrBuilder

UndeleteKeyRequestOrBuilder

UpdateKeyRequestOrBuilder

Enums

Restrictions.ClientRestrictionsCase