| GitHub Repository | Product Reference |
Service Description: Service to manage SSL certs for Cloud SQL instances.
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 (SqlSslCertsServiceClient sqlSslCertsServiceClient = SqlSslCertsServiceClient.create()) {
SqlSslCertsDeleteRequest request =
SqlSslCertsDeleteRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setSha1Fingerprint("sha1Fingerprint163009183")
.build();
Operation response = sqlSslCertsServiceClient.delete(request);
}
Note: close() needs to be called on the SqlSslCertsServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
Delete |
Deletes the SSL certificate. For First Generation instances, the certificate remains valid until the instance is restarted. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
Get |
Retrieves a particular SSL certificate. Does not include the private key (required for usage). The private key must be saved from the response to initial creation. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
Insert |
Creates an SSL certificate and returns it along with the private key and server certificate authority. The new certificate will not be usable until the instance is restarted. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
List |
Lists all of the current SSL certificates for the instance. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return 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 SqlSslCertsServiceSettings 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
SqlSslCertsServiceSettings sqlSslCertsServiceSettings =
SqlSslCertsServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
SqlSslCertsServiceClient sqlSslCertsServiceClient =
SqlSslCertsServiceClient.create(sqlSslCertsServiceSettings);
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
SqlSslCertsServiceSettings sqlSslCertsServiceSettings =
SqlSslCertsServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
SqlSslCertsServiceClient sqlSslCertsServiceClient =
SqlSslCertsServiceClient.create(sqlSslCertsServiceSettings);
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
SqlSslCertsServiceSettings sqlSslCertsServiceSettings =
SqlSslCertsServiceSettings.newHttpJsonBuilder().build();
SqlSslCertsServiceClient sqlSslCertsServiceClient =
SqlSslCertsServiceClient.create(sqlSslCertsServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Static Methods
create()
public static final SqlSslCertsServiceClient create()Constructs an instance of SqlSslCertsServiceClient with default settings.
| Returns | |
|---|---|
| Type | Description |
SqlSslCertsServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(SqlSslCertsServiceSettings settings)
public static final SqlSslCertsServiceClient create(SqlSslCertsServiceSettings settings)Constructs an instance of SqlSslCertsServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
| Parameter | |
|---|---|
| Name | Description |
settings |
SqlSslCertsServiceSettings |
| Returns | |
|---|---|
| Type | Description |
SqlSslCertsServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(SqlSslCertsServiceStub stub)
public static final SqlSslCertsServiceClient create(SqlSslCertsServiceStub stub)Constructs an instance of SqlSslCertsServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(SqlSslCertsServiceSettings).
| Parameter | |
|---|---|
| Name | Description |
stub |
SqlSslCertsServiceStub |
| Returns | |
|---|---|
| Type | Description |
SqlSslCertsServiceClient |
|
Constructors
SqlSslCertsServiceClient(SqlSslCertsServiceSettings settings)
protected SqlSslCertsServiceClient(SqlSslCertsServiceSettings settings)Constructs an instance of SqlSslCertsServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
| Parameter | |
|---|---|
| Name | Description |
settings |
SqlSslCertsServiceSettings |
SqlSslCertsServiceClient(SqlSslCertsServiceStub stub)
protected SqlSslCertsServiceClient(SqlSslCertsServiceStub stub)| Parameter | |
|---|---|
| Name | Description |
stub |
SqlSslCertsServiceStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)| Parameters | |
|---|---|
| Name | Description |
duration |
long |
unit |
TimeUnit |
| Returns | |
|---|---|
| Type | Description |
boolean |
|
| Exceptions | |
|---|---|
| Type | Description |
InterruptedException |
|
close()
public final void close()delete(SqlSslCertsDeleteRequest request)
public final Operation delete(SqlSslCertsDeleteRequest request)Deletes the SSL certificate. For First Generation instances, the certificate remains valid until the instance is restarted.
Sample code:
// 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 (SqlSslCertsServiceClient sqlSslCertsServiceClient = SqlSslCertsServiceClient.create()) {
SqlSslCertsDeleteRequest request =
SqlSslCertsDeleteRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setSha1Fingerprint("sha1Fingerprint163009183")
.build();
Operation response = sqlSslCertsServiceClient.delete(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
SqlSslCertsDeleteRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
Operation |
|
deleteCallable()
public final UnaryCallable<SqlSslCertsDeleteRequest,Operation> deleteCallable()Deletes the SSL certificate. For First Generation instances, the certificate remains valid until the instance is restarted.
Sample code:
// 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 (SqlSslCertsServiceClient sqlSslCertsServiceClient = SqlSslCertsServiceClient.create()) {
SqlSslCertsDeleteRequest request =
SqlSslCertsDeleteRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setSha1Fingerprint("sha1Fingerprint163009183")
.build();
ApiFuture<Operation> future = sqlSslCertsServiceClient.deleteCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<SqlSslCertsDeleteRequest,Operation> |
|
get(SqlSslCertsGetRequest request)
public final SslCert get(SqlSslCertsGetRequest request)Retrieves a particular SSL certificate. Does not include the private key (required for usage). The private key must be saved from the response to initial creation.
Sample code:
// 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 (SqlSslCertsServiceClient sqlSslCertsServiceClient = SqlSslCertsServiceClient.create()) {
SqlSslCertsGetRequest request =
SqlSslCertsGetRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setSha1Fingerprint("sha1Fingerprint163009183")
.build();
SslCert response = sqlSslCertsServiceClient.get(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
SqlSslCertsGetRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
SslCert |
|
getCallable()
public final UnaryCallable<SqlSslCertsGetRequest,SslCert> getCallable()Retrieves a particular SSL certificate. Does not include the private key (required for usage). The private key must be saved from the response to initial creation.
Sample code:
// 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 (SqlSslCertsServiceClient sqlSslCertsServiceClient = SqlSslCertsServiceClient.create()) {
SqlSslCertsGetRequest request =
SqlSslCertsGetRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setSha1Fingerprint("sha1Fingerprint163009183")
.build();
ApiFuture<SslCert> future = sqlSslCertsServiceClient.getCallable().futureCall(request);
// Do something.
SslCert response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<SqlSslCertsGetRequest,SslCert> |
|
getSettings()
public final @Nullable SqlSslCertsServiceSettings getSettings()| Returns | |
|---|---|
| Type | Description |
@org.jspecify.annotations.Nullable com.google.cloud.sql.v1.SqlSslCertsServiceSettings |
|
getStub()
public SqlSslCertsServiceStub getStub()| Returns | |
|---|---|
| Type | Description |
SqlSslCertsServiceStub |
|
insert(SqlSslCertsInsertRequest request)
public final SslCertsInsertResponse insert(SqlSslCertsInsertRequest request)Creates an SSL certificate and returns it along with the private key and server certificate authority. The new certificate will not be usable until the instance is restarted.
Sample code:
// 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 (SqlSslCertsServiceClient sqlSslCertsServiceClient = SqlSslCertsServiceClient.create()) {
SqlSslCertsInsertRequest request =
SqlSslCertsInsertRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setBody(SslCertsInsertRequest.newBuilder().build())
.build();
SslCertsInsertResponse response = sqlSslCertsServiceClient.insert(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
SqlSslCertsInsertRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
SslCertsInsertResponse |
|
insertCallable()
public final UnaryCallable<SqlSslCertsInsertRequest,SslCertsInsertResponse> insertCallable()Creates an SSL certificate and returns it along with the private key and server certificate authority. The new certificate will not be usable until the instance is restarted.
Sample code:
// 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 (SqlSslCertsServiceClient sqlSslCertsServiceClient = SqlSslCertsServiceClient.create()) {
SqlSslCertsInsertRequest request =
SqlSslCertsInsertRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.setBody(SslCertsInsertRequest.newBuilder().build())
.build();
ApiFuture<SslCertsInsertResponse> future =
sqlSslCertsServiceClient.insertCallable().futureCall(request);
// Do something.
SslCertsInsertResponse response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<SqlSslCertsInsertRequest,SslCertsInsertResponse> |
|
isShutdown()
public boolean isShutdown()| Returns | |
|---|---|
| Type | Description |
boolean |
|
isTerminated()
public boolean isTerminated()| Returns | |
|---|---|
| Type | Description |
boolean |
|
list(SqlSslCertsListRequest request)
public final SslCertsListResponse list(SqlSslCertsListRequest request)Lists all of the current SSL certificates for the instance.
Sample code:
// 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 (SqlSslCertsServiceClient sqlSslCertsServiceClient = SqlSslCertsServiceClient.create()) {
SqlSslCertsListRequest request =
SqlSslCertsListRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.build();
SslCertsListResponse response = sqlSslCertsServiceClient.list(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
SqlSslCertsListRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
SslCertsListResponse |
|
listCallable()
public final UnaryCallable<SqlSslCertsListRequest,SslCertsListResponse> listCallable()Lists all of the current SSL certificates for the instance.
Sample code:
// 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 (SqlSslCertsServiceClient sqlSslCertsServiceClient = SqlSslCertsServiceClient.create()) {
SqlSslCertsListRequest request =
SqlSslCertsListRequest.newBuilder()
.setInstance("instance555127957")
.setProject("project-309310695")
.build();
ApiFuture<SslCertsListResponse> future =
sqlSslCertsServiceClient.listCallable().futureCall(request);
// Do something.
SslCertsListResponse response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<SqlSslCertsListRequest,SslCertsListResponse> |
|
shutdown()
public void shutdown()shutdownNow()
public void shutdownNow()