@Generated(value="by gapic-generator") @BetaApi public class SslCertificateClient extends Object implements BackgroundResource
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:
try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
ProjectGlobalSslCertificateName sslCertificate = ProjectGlobalSslCertificateName.of("[PROJECT]", "[SSL_CERTIFICATE]");
Operation response = sslCertificateClient.deleteSslCertificate(sslCertificate);
}
Note: close() needs to be called on the sslCertificateClient 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:
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 SslCertificateSettings to create(). For example:
To customize credentials:
SslCertificateSettings sslCertificateSettings =
SslCertificateSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
SslCertificateClient sslCertificateClient =
SslCertificateClient.create(sslCertificateSettings);
To customize the endpoint:
SslCertificateSettings sslCertificateSettings =
SslCertificateSettings.newBuilder().setEndpoint(myEndpoint).build();
SslCertificateClient sslCertificateClient =
SslCertificateClient.create(sslCertificateSettings);
Modifier and Type | Class and Description |
---|---|
static class |
SslCertificateClient.ListSslCertificatesFixedSizeCollection |
static class |
SslCertificateClient.ListSslCertificatesPage |
static class |
SslCertificateClient.ListSslCertificatesPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
SslCertificateClient(SslCertificateSettings settings)
Constructs an instance of SslCertificateClient, using the given settings.
|
protected |
SslCertificateClient(SslCertificateStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static SslCertificateClient |
create()
Constructs an instance of SslCertificateClient with default settings.
|
static SslCertificateClient |
create(SslCertificateSettings settings)
Constructs an instance of SslCertificateClient, using the given settings.
|
static SslCertificateClient |
create(SslCertificateStub stub)
Constructs an instance of SslCertificateClient, using the given stub for making calls.
|
Operation |
deleteSslCertificate(DeleteSslCertificateHttpRequest request)
Deletes the specified SslCertificate resource.
|
Operation |
deleteSslCertificate(ProjectGlobalSslCertificateName sslCertificate)
Deletes the specified SslCertificate resource.
|
Operation |
deleteSslCertificate(String sslCertificate)
Deletes the specified SslCertificate resource.
|
UnaryCallable<DeleteSslCertificateHttpRequest,Operation> |
deleteSslCertificateCallable()
Deletes the specified SslCertificate resource.
|
SslCertificateSettings |
getSettings() |
SslCertificate |
getSslCertificate(GetSslCertificateHttpRequest request)
Returns the specified SslCertificate resource.
|
SslCertificate |
getSslCertificate(ProjectGlobalSslCertificateName sslCertificate)
Returns the specified SslCertificate resource.
|
SslCertificate |
getSslCertificate(String sslCertificate)
Returns the specified SslCertificate resource.
|
UnaryCallable<GetSslCertificateHttpRequest,SslCertificate> |
getSslCertificateCallable()
Returns the specified SslCertificate resource.
|
SslCertificateStub |
getStub() |
Operation |
insertSslCertificate(InsertSslCertificateHttpRequest request)
Creates a SslCertificate resource in the specified project using the data included in the
request.
|
Operation |
insertSslCertificate(ProjectName project,
SslCertificate sslCertificateResource)
Creates a SslCertificate resource in the specified project using the data included in the
request.
|
Operation |
insertSslCertificate(String project,
SslCertificate sslCertificateResource)
Creates a SslCertificate resource in the specified project using the data included in the
request.
|
UnaryCallable<InsertSslCertificateHttpRequest,Operation> |
insertSslCertificateCallable()
Creates a SslCertificate resource in the specified project using the data included in the
request.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
SslCertificateClient.ListSslCertificatesPagedResponse |
listSslCertificates(ListSslCertificatesHttpRequest request)
Retrieves the list of SslCertificate resources available to the specified project.
|
SslCertificateClient.ListSslCertificatesPagedResponse |
listSslCertificates(ProjectName project)
Retrieves the list of SslCertificate resources available to the specified project.
|
SslCertificateClient.ListSslCertificatesPagedResponse |
listSslCertificates(String project)
Retrieves the list of SslCertificate resources available to the specified project.
|
UnaryCallable<ListSslCertificatesHttpRequest,SslCertificateList> |
listSslCertificatesCallable()
Retrieves the list of SslCertificate resources available to the specified project.
|
UnaryCallable<ListSslCertificatesHttpRequest,SslCertificateClient.ListSslCertificatesPagedResponse> |
listSslCertificatesPagedCallable()
Retrieves the list of SslCertificate resources available to the specified project.
|
void |
shutdown() |
void |
shutdownNow() |
protected SslCertificateClient(SslCertificateSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected SslCertificateClient(SslCertificateStub stub)
public static final SslCertificateClient create() throws IOException
IOException
public static final SslCertificateClient create(SslCertificateSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final SslCertificateClient create(SslCertificateStub stub)
public final SslCertificateSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public SslCertificateStub getStub()
@BetaApi public final Operation deleteSslCertificate(ProjectGlobalSslCertificateName sslCertificate)
Sample code:
try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
ProjectGlobalSslCertificateName sslCertificate = ProjectGlobalSslCertificateName.of("[PROJECT]", "[SSL_CERTIFICATE]");
Operation response = sslCertificateClient.deleteSslCertificate(sslCertificate);
}
sslCertificate
- Name of the SslCertificate resource to delete.ApiException
- if the remote call fails@BetaApi public final Operation deleteSslCertificate(String sslCertificate)
Sample code:
try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
ProjectGlobalSslCertificateName sslCertificate = ProjectGlobalSslCertificateName.of("[PROJECT]", "[SSL_CERTIFICATE]");
Operation response = sslCertificateClient.deleteSslCertificate(sslCertificate.toString());
}
sslCertificate
- Name of the SslCertificate resource to delete.ApiException
- if the remote call fails@BetaApi public final Operation deleteSslCertificate(DeleteSslCertificateHttpRequest request)
Sample code:
try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
String formattedSslCertificate = ProjectGlobalSslCertificateName.format("[PROJECT]", "[SSL_CERTIFICATE]");
DeleteSslCertificateHttpRequest request = DeleteSslCertificateHttpRequest.newBuilder()
.setSslCertificate(formattedSslCertificate)
.build();
Operation response = sslCertificateClient.deleteSslCertificate(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<DeleteSslCertificateHttpRequest,Operation> deleteSslCertificateCallable()
Sample code:
try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
String formattedSslCertificate = ProjectGlobalSslCertificateName.format("[PROJECT]", "[SSL_CERTIFICATE]");
DeleteSslCertificateHttpRequest request = DeleteSslCertificateHttpRequest.newBuilder()
.setSslCertificate(formattedSslCertificate)
.build();
ApiFuture<Operation> future = sslCertificateClient.deleteSslCertificateCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final SslCertificate getSslCertificate(ProjectGlobalSslCertificateName sslCertificate)
Sample code:
try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
ProjectGlobalSslCertificateName sslCertificate = ProjectGlobalSslCertificateName.of("[PROJECT]", "[SSL_CERTIFICATE]");
SslCertificate response = sslCertificateClient.getSslCertificate(sslCertificate);
}
sslCertificate
- Name of the SslCertificate resource to return.ApiException
- if the remote call fails@BetaApi public final SslCertificate getSslCertificate(String sslCertificate)
Sample code:
try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
ProjectGlobalSslCertificateName sslCertificate = ProjectGlobalSslCertificateName.of("[PROJECT]", "[SSL_CERTIFICATE]");
SslCertificate response = sslCertificateClient.getSslCertificate(sslCertificate.toString());
}
sslCertificate
- Name of the SslCertificate resource to return.ApiException
- if the remote call fails@BetaApi public final SslCertificate getSslCertificate(GetSslCertificateHttpRequest request)
Sample code:
try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
String formattedSslCertificate = ProjectGlobalSslCertificateName.format("[PROJECT]", "[SSL_CERTIFICATE]");
GetSslCertificateHttpRequest request = GetSslCertificateHttpRequest.newBuilder()
.setSslCertificate(formattedSslCertificate)
.build();
SslCertificate response = sslCertificateClient.getSslCertificate(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<GetSslCertificateHttpRequest,SslCertificate> getSslCertificateCallable()
Sample code:
try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
String formattedSslCertificate = ProjectGlobalSslCertificateName.format("[PROJECT]", "[SSL_CERTIFICATE]");
GetSslCertificateHttpRequest request = GetSslCertificateHttpRequest.newBuilder()
.setSslCertificate(formattedSslCertificate)
.build();
ApiFuture<SslCertificate> future = sslCertificateClient.getSslCertificateCallable().futureCall(request);
// Do something
SslCertificate response = future.get();
}
@BetaApi public final Operation insertSslCertificate(ProjectName project, SslCertificate sslCertificateResource)
Sample code:
try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
SslCertificate sslCertificateResource = SslCertificate.newBuilder().build();
Operation response = sslCertificateClient.insertSslCertificate(project, sslCertificateResource);
}
project
- Project ID for this request.sslCertificateResource
- An SslCertificate resource. This resource provides a mechanism to
upload an SSL key and certificate to the load balancer to serve secure connections from the
user. (== resource_for beta.sslCertificates ==) (== resource_for v1.sslCertificates ==)ApiException
- if the remote call fails@BetaApi public final Operation insertSslCertificate(String project, SslCertificate sslCertificateResource)
Sample code:
try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
SslCertificate sslCertificateResource = SslCertificate.newBuilder().build();
Operation response = sslCertificateClient.insertSslCertificate(project.toString(), sslCertificateResource);
}
project
- Project ID for this request.sslCertificateResource
- An SslCertificate resource. This resource provides a mechanism to
upload an SSL key and certificate to the load balancer to serve secure connections from the
user. (== resource_for beta.sslCertificates ==) (== resource_for v1.sslCertificates ==)ApiException
- if the remote call fails@BetaApi public final Operation insertSslCertificate(InsertSslCertificateHttpRequest request)
Sample code:
try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
SslCertificate sslCertificateResource = SslCertificate.newBuilder().build();
InsertSslCertificateHttpRequest request = InsertSslCertificateHttpRequest.newBuilder()
.setProject(formattedProject)
.setSslCertificateResource(sslCertificateResource)
.build();
Operation response = sslCertificateClient.insertSslCertificate(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<InsertSslCertificateHttpRequest,Operation> insertSslCertificateCallable()
Sample code:
try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
SslCertificate sslCertificateResource = SslCertificate.newBuilder().build();
InsertSslCertificateHttpRequest request = InsertSslCertificateHttpRequest.newBuilder()
.setProject(formattedProject)
.setSslCertificateResource(sslCertificateResource)
.build();
ApiFuture<Operation> future = sslCertificateClient.insertSslCertificateCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final SslCertificateClient.ListSslCertificatesPagedResponse listSslCertificates(ProjectName project)
Sample code:
try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (SslCertificate element : sslCertificateClient.listSslCertificates(project).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.ApiException
- if the remote call fails@BetaApi public final SslCertificateClient.ListSslCertificatesPagedResponse listSslCertificates(String project)
Sample code:
try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (SslCertificate element : sslCertificateClient.listSslCertificates(project.toString()).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.ApiException
- if the remote call fails@BetaApi public final SslCertificateClient.ListSslCertificatesPagedResponse listSslCertificates(ListSslCertificatesHttpRequest request)
Sample code:
try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListSslCertificatesHttpRequest request = ListSslCertificatesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
for (SslCertificate element : sslCertificateClient.listSslCertificates(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<ListSslCertificatesHttpRequest,SslCertificateClient.ListSslCertificatesPagedResponse> listSslCertificatesPagedCallable()
Sample code:
try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListSslCertificatesHttpRequest request = ListSslCertificatesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
ApiFuture<ListSslCertificatesPagedResponse> future = sslCertificateClient.listSslCertificatesPagedCallable().futureCall(request);
// Do something
for (SslCertificate element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final UnaryCallable<ListSslCertificatesHttpRequest,SslCertificateList> listSslCertificatesCallable()
Sample code:
try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListSslCertificatesHttpRequest request = ListSslCertificatesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
while (true) {
SslCertificateList response = sslCertificateClient.listSslCertificatesCallable().call(request);
for (SslCertificate element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface BackgroundResource
public boolean isShutdown()
isShutdown
in interface BackgroundResource
public boolean isTerminated()
isTerminated
in interface BackgroundResource
public void shutdownNow()
shutdownNow
in interface BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.