@Generated(value="by gapic-generator-java") public class InstanceSettingsServiceClient 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 (InstanceSettingsServiceClient instanceSettingsServiceClient =
InstanceSettingsServiceClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
InstanceSettings response = instanceSettingsServiceClient.get(project, zone);
}
Note: close() needs to be called on the InstanceSettingsServiceClient 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 |
|---|---|---|
Get |
Get Instance settings. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
Patch |
Patch Instance settings |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
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 InstanceSettingsServiceSettings 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
InstanceSettingsServiceSettings instanceSettingsServiceSettings =
InstanceSettingsServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
InstanceSettingsServiceClient instanceSettingsServiceClient =
InstanceSettingsServiceClient.create(instanceSettingsServiceSettings);
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
InstanceSettingsServiceSettings instanceSettingsServiceSettings =
InstanceSettingsServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
InstanceSettingsServiceClient instanceSettingsServiceClient =
InstanceSettingsServiceClient.create(instanceSettingsServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier | Constructor and Description |
|---|---|
protected |
InstanceSettingsServiceClient(InstanceSettingsServiceSettings settings)
Constructs an instance of InstanceSettingsServiceClient, using the given settings.
|
protected |
InstanceSettingsServiceClient(InstanceSettingsServiceStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static InstanceSettingsServiceClient |
create()
Constructs an instance of InstanceSettingsServiceClient with default settings.
|
static InstanceSettingsServiceClient |
create(InstanceSettingsServiceSettings settings)
Constructs an instance of InstanceSettingsServiceClient, using the given settings.
|
static InstanceSettingsServiceClient |
create(InstanceSettingsServiceStub stub)
Constructs an instance of InstanceSettingsServiceClient, using the given stub for making calls.
|
InstanceSettings |
get(GetInstanceSettingRequest request)
Get Instance settings.
|
InstanceSettings |
get(String project,
String zone)
Get Instance settings.
|
com.google.api.gax.rpc.UnaryCallable<GetInstanceSettingRequest,InstanceSettings> |
getCallable()
Get Instance settings.
|
InstanceSettingsServiceSettings |
getSettings() |
InstanceSettingsServiceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
patchAsync(PatchInstanceSettingRequest request)
Patch Instance settings
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 (InstanceSettingsServiceClient instanceSettingsServiceClient =
InstanceSettingsServiceClient.create()) {
PatchInstanceSettingRequest request =
PatchInstanceSettingRequest.newBuilder()
.setInstanceSettingsResource(InstanceSettings.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setUpdateMask("updateMask-296147115")
.setZone("zone3744684")
.build();
Operation response = instanceSettingsServiceClient.patchAsync(request).get();
}
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
patchAsync(String project,
String zone,
InstanceSettings instanceSettingsResource)
Patch Instance settings
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 (InstanceSettingsServiceClient instanceSettingsServiceClient =
InstanceSettingsServiceClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
InstanceSettings instanceSettingsResource = InstanceSettings.newBuilder().build();
Operation response =
instanceSettingsServiceClient.patchAsync(project, zone, instanceSettingsResource).get();
}
|
com.google.api.gax.rpc.UnaryCallable<PatchInstanceSettingRequest,Operation> |
patchCallable()
Patch Instance settings
Sample code:
{@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 (InstanceSettingsServiceClient instanceSettingsServiceClient =
InstanceSettingsServiceClient.create()) {
PatchInstanceSettingRequest request =
PatchInstanceSettingRequest.newBuilder()
.setInstanceSettingsResource(InstanceSettings.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setUpdateMask("updateMask-296147115")
.setZone("zone3744684")
.build();
ApiFuture
|
com.google.api.gax.rpc.OperationCallable<PatchInstanceSettingRequest,Operation,Operation> |
patchOperationCallable()
Patch Instance settings
Sample code:
{@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 (InstanceSettingsServiceClient instanceSettingsServiceClient =
InstanceSettingsServiceClient.create()) {
PatchInstanceSettingRequest request =
PatchInstanceSettingRequest.newBuilder()
.setInstanceSettingsResource(InstanceSettings.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setUpdateMask("updateMask-296147115")
.setZone("zone3744684")
.build();
OperationFuture
|
void |
shutdown() |
void |
shutdownNow() |
protected InstanceSettingsServiceClient(InstanceSettingsServiceSettings settings) throws IOException
IOExceptionprotected InstanceSettingsServiceClient(InstanceSettingsServiceStub stub)
public static final InstanceSettingsServiceClient create() throws IOException
IOExceptionpublic static final InstanceSettingsServiceClient create(InstanceSettingsServiceSettings settings) throws IOException
IOExceptionpublic static final InstanceSettingsServiceClient create(InstanceSettingsServiceStub stub)
public final InstanceSettingsServiceSettings getSettings()
public InstanceSettingsServiceStub getStub()
public final InstanceSettings get(String project, String zone)
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 (InstanceSettingsServiceClient instanceSettingsServiceClient =
InstanceSettingsServiceClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
InstanceSettings response = instanceSettingsServiceClient.get(project, zone);
}
project - Project ID for this request.zone - Name of the zone for this request.com.google.api.gax.rpc.ApiException - if the remote call failspublic final InstanceSettings get(GetInstanceSettingRequest 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 (InstanceSettingsServiceClient instanceSettingsServiceClient =
InstanceSettingsServiceClient.create()) {
GetInstanceSettingRequest request =
GetInstanceSettingRequest.newBuilder()
.setProject("project-309310695")
.setZone("zone3744684")
.build();
InstanceSettings response = instanceSettingsServiceClient.get(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<GetInstanceSettingRequest,InstanceSettings> getCallable()
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 (InstanceSettingsServiceClient instanceSettingsServiceClient =
InstanceSettingsServiceClient.create()) {
GetInstanceSettingRequest request =
GetInstanceSettingRequest.newBuilder()
.setProject("project-309310695")
.setZone("zone3744684")
.build();
ApiFuture<InstanceSettings> future =
instanceSettingsServiceClient.getCallable().futureCall(request);
// Do something.
InstanceSettings response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> patchAsync(String project, String zone, InstanceSettings instanceSettingsResource)
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 (InstanceSettingsServiceClient instanceSettingsServiceClient =
InstanceSettingsServiceClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
InstanceSettings instanceSettingsResource = InstanceSettings.newBuilder().build();
Operation response =
instanceSettingsServiceClient.patchAsync(project, zone, instanceSettingsResource).get();
}
project - Project ID for this request.zone - The zone scoping this request. It should conform to RFC1035.instanceSettingsResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> patchAsync(PatchInstanceSettingRequest 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 (InstanceSettingsServiceClient instanceSettingsServiceClient =
InstanceSettingsServiceClient.create()) {
PatchInstanceSettingRequest request =
PatchInstanceSettingRequest.newBuilder()
.setInstanceSettingsResource(InstanceSettings.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setUpdateMask("updateMask-296147115")
.setZone("zone3744684")
.build();
Operation response = instanceSettingsServiceClient.patchAsync(request).get();
}
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.OperationCallable<PatchInstanceSettingRequest,Operation,Operation> patchOperationCallable()
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 (InstanceSettingsServiceClient instanceSettingsServiceClient =
InstanceSettingsServiceClient.create()) {
PatchInstanceSettingRequest request =
PatchInstanceSettingRequest.newBuilder()
.setInstanceSettingsResource(InstanceSettings.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setUpdateMask("updateMask-296147115")
.setZone("zone3744684")
.build();
OperationFuture<Operation, Operation> future =
instanceSettingsServiceClient.patchOperationCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<PatchInstanceSettingRequest,Operation> patchCallable()
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 (InstanceSettingsServiceClient instanceSettingsServiceClient =
InstanceSettingsServiceClient.create()) {
PatchInstanceSettingRequest request =
PatchInstanceSettingRequest.newBuilder()
.setInstanceSettingsResource(InstanceSettings.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setUpdateMask("updateMask-296147115")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future =
instanceSettingsServiceClient.patchCallable().futureCall(request);
// Do something.
Operation 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 © 2024 Google LLC. All rights reserved.