@BetaApi @Generated(value="by gapic-generator-java") public class GatewayServiceClient extends Object implements com.google.api.gax.core.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:
// 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 (GatewayServiceClient gatewayServiceClient = GatewayServiceClient.create()) {
HttpBody request =
HttpBody.newBuilder()
.setContentType("contentType-389131437")
.setData(ByteString.EMPTY)
.addAllExtensions(new ArrayList<Any>())
.build();
HttpBody response = gatewayServiceClient.getResource(request);
}
Note: close() needs to be called on the GatewayServiceClient 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 GatewayServiceSettings 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
GatewayServiceSettings gatewayServiceSettings =
GatewayServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
GatewayServiceClient gatewayServiceClient = GatewayServiceClient.create(gatewayServiceSettings);
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
GatewayServiceSettings gatewayServiceSettings =
GatewayServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
GatewayServiceClient gatewayServiceClient = GatewayServiceClient.create(gatewayServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier | Constructor and Description |
|---|---|
protected |
GatewayServiceClient(GatewayServiceSettings settings)
Constructs an instance of GatewayServiceClient, using the given settings.
|
protected |
GatewayServiceClient(GatewayServiceStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static GatewayServiceClient |
create()
Constructs an instance of GatewayServiceClient with default settings.
|
static GatewayServiceClient |
create(GatewayServiceSettings settings)
Constructs an instance of GatewayServiceClient, using the given settings.
|
static GatewayServiceClient |
create(GatewayServiceStub stub)
Constructs an instance of GatewayServiceClient, using the given stub for making calls.
|
com.google.api.HttpBody |
deleteResource(com.google.api.HttpBody request)
DeleteResource performs an HTTP DELETE on the Kubernetes API Server.
|
com.google.api.gax.rpc.UnaryCallable<com.google.api.HttpBody,com.google.api.HttpBody> |
deleteResourceCallable()
DeleteResource performs an HTTP DELETE on the Kubernetes API Server.
|
com.google.api.HttpBody |
getResource(com.google.api.HttpBody request)
GetResource performs an HTTP GET request on the Kubernetes API Server.
|
com.google.api.gax.rpc.UnaryCallable<com.google.api.HttpBody,com.google.api.HttpBody> |
getResourceCallable()
GetResource performs an HTTP GET request on the Kubernetes API Server.
|
GatewayServiceSettings |
getSettings() |
GatewayServiceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
com.google.api.HttpBody |
patchResource(com.google.api.HttpBody request)
PatchResource performs an HTTP PATCH on the Kubernetes API Server.
|
com.google.api.gax.rpc.UnaryCallable<com.google.api.HttpBody,com.google.api.HttpBody> |
patchResourceCallable()
PatchResource performs an HTTP PATCH on the Kubernetes API Server.
|
com.google.api.HttpBody |
postResource(com.google.api.HttpBody request)
PostResource performs an HTTP POST on the Kubernetes API Server.
|
com.google.api.gax.rpc.UnaryCallable<com.google.api.HttpBody,com.google.api.HttpBody> |
postResourceCallable()
PostResource performs an HTTP POST on the Kubernetes API Server.
|
com.google.api.HttpBody |
putResource(com.google.api.HttpBody request)
PutResource performs an HTTP PUT on the Kubernetes API Server.
|
com.google.api.gax.rpc.UnaryCallable<com.google.api.HttpBody,com.google.api.HttpBody> |
putResourceCallable()
PutResource performs an HTTP PUT on the Kubernetes API Server.
|
void |
shutdown() |
void |
shutdownNow() |
protected GatewayServiceClient(GatewayServiceSettings settings) throws IOException
IOExceptionprotected GatewayServiceClient(GatewayServiceStub stub)
public static final GatewayServiceClient create() throws IOException
IOExceptionpublic static final GatewayServiceClient create(GatewayServiceSettings settings) throws IOException
IOExceptionpublic static final GatewayServiceClient create(GatewayServiceStub stub)
public final GatewayServiceSettings getSettings()
public GatewayServiceStub getStub()
public final com.google.api.HttpBody getResource(com.google.api.HttpBody request)
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 (GatewayServiceClient gatewayServiceClient = GatewayServiceClient.create()) {
HttpBody request =
HttpBody.newBuilder()
.setContentType("contentType-389131437")
.setData(ByteString.EMPTY)
.addAllExtensions(new ArrayList<Any>())
.build();
HttpBody response = gatewayServiceClient.getResource(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.api.HttpBody,com.google.api.HttpBody> getResourceCallable()
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 (GatewayServiceClient gatewayServiceClient = GatewayServiceClient.create()) {
HttpBody request =
HttpBody.newBuilder()
.setContentType("contentType-389131437")
.setData(ByteString.EMPTY)
.addAllExtensions(new ArrayList<Any>())
.build();
ApiFuture<HttpBody> future = gatewayServiceClient.getResourceCallable().futureCall(request);
// Do something.
HttpBody response = future.get();
}
public final com.google.api.HttpBody postResource(com.google.api.HttpBody request)
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 (GatewayServiceClient gatewayServiceClient = GatewayServiceClient.create()) {
HttpBody request =
HttpBody.newBuilder()
.setContentType("contentType-389131437")
.setData(ByteString.EMPTY)
.addAllExtensions(new ArrayList<Any>())
.build();
HttpBody response = gatewayServiceClient.postResource(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.api.HttpBody,com.google.api.HttpBody> postResourceCallable()
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 (GatewayServiceClient gatewayServiceClient = GatewayServiceClient.create()) {
HttpBody request =
HttpBody.newBuilder()
.setContentType("contentType-389131437")
.setData(ByteString.EMPTY)
.addAllExtensions(new ArrayList<Any>())
.build();
ApiFuture<HttpBody> future = gatewayServiceClient.postResourceCallable().futureCall(request);
// Do something.
HttpBody response = future.get();
}
public final com.google.api.HttpBody deleteResource(com.google.api.HttpBody request)
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 (GatewayServiceClient gatewayServiceClient = GatewayServiceClient.create()) {
HttpBody request =
HttpBody.newBuilder()
.setContentType("contentType-389131437")
.setData(ByteString.EMPTY)
.addAllExtensions(new ArrayList<Any>())
.build();
HttpBody response = gatewayServiceClient.deleteResource(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.api.HttpBody,com.google.api.HttpBody> deleteResourceCallable()
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 (GatewayServiceClient gatewayServiceClient = GatewayServiceClient.create()) {
HttpBody request =
HttpBody.newBuilder()
.setContentType("contentType-389131437")
.setData(ByteString.EMPTY)
.addAllExtensions(new ArrayList<Any>())
.build();
ApiFuture<HttpBody> future =
gatewayServiceClient.deleteResourceCallable().futureCall(request);
// Do something.
HttpBody response = future.get();
}
public final com.google.api.HttpBody putResource(com.google.api.HttpBody request)
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 (GatewayServiceClient gatewayServiceClient = GatewayServiceClient.create()) {
HttpBody request =
HttpBody.newBuilder()
.setContentType("contentType-389131437")
.setData(ByteString.EMPTY)
.addAllExtensions(new ArrayList<Any>())
.build();
HttpBody response = gatewayServiceClient.putResource(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.api.HttpBody,com.google.api.HttpBody> putResourceCallable()
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 (GatewayServiceClient gatewayServiceClient = GatewayServiceClient.create()) {
HttpBody request =
HttpBody.newBuilder()
.setContentType("contentType-389131437")
.setData(ByteString.EMPTY)
.addAllExtensions(new ArrayList<Any>())
.build();
ApiFuture<HttpBody> future = gatewayServiceClient.putResourceCallable().futureCall(request);
// Do something.
HttpBody response = future.get();
}
public final com.google.api.HttpBody patchResource(com.google.api.HttpBody request)
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 (GatewayServiceClient gatewayServiceClient = GatewayServiceClient.create()) {
HttpBody request =
HttpBody.newBuilder()
.setContentType("contentType-389131437")
.setData(ByteString.EMPTY)
.addAllExtensions(new ArrayList<Any>())
.build();
HttpBody response = gatewayServiceClient.patchResource(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.api.HttpBody,com.google.api.HttpBody> patchResourceCallable()
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 (GatewayServiceClient gatewayServiceClient = GatewayServiceClient.create()) {
HttpBody request =
HttpBody.newBuilder()
.setContentType("contentType-389131437")
.setData(ByteString.EMPTY)
.addAllExtensions(new ArrayList<Any>())
.build();
ApiFuture<HttpBody> future = gatewayServiceClient.patchResourceCallable().futureCall(request);
// Do something.
HttpBody response = future.get();
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2022 Google LLC. All rights reserved.