@Generated(value="by gapic-generator") @BetaApi public class RegionHealthCheckClient 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:
try (RegionHealthCheckClient regionHealthCheckClient = RegionHealthCheckClient.create()) {
ProjectRegionHealthCheckName healthCheck = ProjectRegionHealthCheckName.of("[PROJECT]", "[REGION]", "[HEALTH_CHECK]");
Operation response = regionHealthCheckClient.deleteRegionHealthCheck(healthCheck);
}
Note: close() needs to be called on the regionHealthCheckClient 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 RegionHealthCheckSettings to create(). For example:
To customize credentials:
RegionHealthCheckSettings regionHealthCheckSettings =
RegionHealthCheckSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
RegionHealthCheckClient regionHealthCheckClient =
RegionHealthCheckClient.create(regionHealthCheckSettings);
To customize the endpoint:
RegionHealthCheckSettings regionHealthCheckSettings =
RegionHealthCheckSettings.newBuilder().setEndpoint(myEndpoint).build();
RegionHealthCheckClient regionHealthCheckClient =
RegionHealthCheckClient.create(regionHealthCheckSettings);
Modifier and Type | Class and Description |
---|---|
static class |
RegionHealthCheckClient.ListRegionHealthChecksFixedSizeCollection |
static class |
RegionHealthCheckClient.ListRegionHealthChecksPage |
static class |
RegionHealthCheckClient.ListRegionHealthChecksPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
RegionHealthCheckClient(RegionHealthCheckSettings settings)
Constructs an instance of RegionHealthCheckClient, using the given settings.
|
protected |
RegionHealthCheckClient(RegionHealthCheckStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static RegionHealthCheckClient |
create()
Constructs an instance of RegionHealthCheckClient with default settings.
|
static RegionHealthCheckClient |
create(RegionHealthCheckSettings settings)
Constructs an instance of RegionHealthCheckClient, using the given settings.
|
static RegionHealthCheckClient |
create(RegionHealthCheckStub stub)
Constructs an instance of RegionHealthCheckClient, using the given stub for making calls.
|
Operation |
deleteRegionHealthCheck(DeleteRegionHealthCheckHttpRequest request)
Deletes the specified HealthCheck resource.
|
Operation |
deleteRegionHealthCheck(ProjectRegionHealthCheckName healthCheck)
Deletes the specified HealthCheck resource.
|
Operation |
deleteRegionHealthCheck(String healthCheck)
Deletes the specified HealthCheck resource.
|
com.google.api.gax.rpc.UnaryCallable<DeleteRegionHealthCheckHttpRequest,Operation> |
deleteRegionHealthCheckCallable()
Deletes the specified HealthCheck resource.
|
HealthCheck |
getRegionHealthCheck(GetRegionHealthCheckHttpRequest request)
Returns the specified HealthCheck resource.
|
HealthCheck |
getRegionHealthCheck(ProjectRegionHealthCheckName healthCheck)
Returns the specified HealthCheck resource.
|
HealthCheck |
getRegionHealthCheck(String healthCheck)
Returns the specified HealthCheck resource.
|
com.google.api.gax.rpc.UnaryCallable<GetRegionHealthCheckHttpRequest,HealthCheck> |
getRegionHealthCheckCallable()
Returns the specified HealthCheck resource.
|
RegionHealthCheckSettings |
getSettings() |
RegionHealthCheckStub |
getStub() |
Operation |
insertRegionHealthCheck(InsertRegionHealthCheckHttpRequest request)
Creates a HealthCheck resource in the specified project using the data included in the request.
|
Operation |
insertRegionHealthCheck(ProjectRegionName region,
HealthCheck healthCheckResource)
Creates a HealthCheck resource in the specified project using the data included in the request.
|
Operation |
insertRegionHealthCheck(String region,
HealthCheck healthCheckResource)
Creates a HealthCheck resource in the specified project using the data included in the request.
|
com.google.api.gax.rpc.UnaryCallable<InsertRegionHealthCheckHttpRequest,Operation> |
insertRegionHealthCheckCallable()
Creates a HealthCheck resource in the specified project using the data included in the request.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
RegionHealthCheckClient.ListRegionHealthChecksPagedResponse |
listRegionHealthChecks(ListRegionHealthChecksHttpRequest request)
Retrieves the list of HealthCheck resources available to the specified project.
|
RegionHealthCheckClient.ListRegionHealthChecksPagedResponse |
listRegionHealthChecks(ProjectRegionName region)
Retrieves the list of HealthCheck resources available to the specified project.
|
RegionHealthCheckClient.ListRegionHealthChecksPagedResponse |
listRegionHealthChecks(String region)
Retrieves the list of HealthCheck resources available to the specified project.
|
com.google.api.gax.rpc.UnaryCallable<ListRegionHealthChecksHttpRequest,HealthCheckList> |
listRegionHealthChecksCallable()
Retrieves the list of HealthCheck resources available to the specified project.
|
com.google.api.gax.rpc.UnaryCallable<ListRegionHealthChecksHttpRequest,RegionHealthCheckClient.ListRegionHealthChecksPagedResponse> |
listRegionHealthChecksPagedCallable()
Retrieves the list of HealthCheck resources available to the specified project.
|
Operation |
patchRegionHealthCheck(PatchRegionHealthCheckHttpRequest request)
Updates a HealthCheck resource in the specified project using the data included in the request.
|
Operation |
patchRegionHealthCheck(ProjectRegionHealthCheckName healthCheck,
HealthCheck healthCheckResource,
List<String> fieldMask)
Updates a HealthCheck resource in the specified project using the data included in the request.
|
Operation |
patchRegionHealthCheck(String healthCheck,
HealthCheck healthCheckResource,
List<String> fieldMask)
Updates a HealthCheck resource in the specified project using the data included in the request.
|
com.google.api.gax.rpc.UnaryCallable<PatchRegionHealthCheckHttpRequest,Operation> |
patchRegionHealthCheckCallable()
Updates a HealthCheck resource in the specified project using the data included in the request.
|
void |
shutdown() |
void |
shutdownNow() |
Operation |
updateRegionHealthCheck(ProjectRegionHealthCheckName healthCheck,
HealthCheck healthCheckResource,
List<String> fieldMask)
Updates a HealthCheck resource in the specified project using the data included in the request.
|
Operation |
updateRegionHealthCheck(String healthCheck,
HealthCheck healthCheckResource,
List<String> fieldMask)
Updates a HealthCheck resource in the specified project using the data included in the request.
|
Operation |
updateRegionHealthCheck(UpdateRegionHealthCheckHttpRequest request)
Updates a HealthCheck resource in the specified project using the data included in the request.
|
com.google.api.gax.rpc.UnaryCallable<UpdateRegionHealthCheckHttpRequest,Operation> |
updateRegionHealthCheckCallable()
Updates a HealthCheck resource in the specified project using the data included in the request.
|
protected RegionHealthCheckClient(RegionHealthCheckSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected RegionHealthCheckClient(RegionHealthCheckStub stub)
public static final RegionHealthCheckClient create() throws IOException
IOException
public static final RegionHealthCheckClient create(RegionHealthCheckSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final RegionHealthCheckClient create(RegionHealthCheckStub stub)
public final RegionHealthCheckSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public RegionHealthCheckStub getStub()
@BetaApi public final Operation deleteRegionHealthCheck(ProjectRegionHealthCheckName healthCheck)
Sample code:
try (RegionHealthCheckClient regionHealthCheckClient = RegionHealthCheckClient.create()) {
ProjectRegionHealthCheckName healthCheck = ProjectRegionHealthCheckName.of("[PROJECT]", "[REGION]", "[HEALTH_CHECK]");
Operation response = regionHealthCheckClient.deleteRegionHealthCheck(healthCheck);
}
healthCheck
- Name of the HealthCheck resource to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteRegionHealthCheck(String healthCheck)
Sample code:
try (RegionHealthCheckClient regionHealthCheckClient = RegionHealthCheckClient.create()) {
ProjectRegionHealthCheckName healthCheck = ProjectRegionHealthCheckName.of("[PROJECT]", "[REGION]", "[HEALTH_CHECK]");
Operation response = regionHealthCheckClient.deleteRegionHealthCheck(healthCheck.toString());
}
healthCheck
- Name of the HealthCheck resource to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteRegionHealthCheck(DeleteRegionHealthCheckHttpRequest request)
Sample code:
try (RegionHealthCheckClient regionHealthCheckClient = RegionHealthCheckClient.create()) {
String formattedHealthCheck = ProjectRegionHealthCheckName.format("[PROJECT]", "[REGION]", "[HEALTH_CHECK]");
DeleteRegionHealthCheckHttpRequest request = DeleteRegionHealthCheckHttpRequest.newBuilder()
.setHealthCheck(formattedHealthCheck)
.build();
Operation response = regionHealthCheckClient.deleteRegionHealthCheck(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<DeleteRegionHealthCheckHttpRequest,Operation> deleteRegionHealthCheckCallable()
Sample code:
try (RegionHealthCheckClient regionHealthCheckClient = RegionHealthCheckClient.create()) {
String formattedHealthCheck = ProjectRegionHealthCheckName.format("[PROJECT]", "[REGION]", "[HEALTH_CHECK]");
DeleteRegionHealthCheckHttpRequest request = DeleteRegionHealthCheckHttpRequest.newBuilder()
.setHealthCheck(formattedHealthCheck)
.build();
ApiFuture<Operation> future = regionHealthCheckClient.deleteRegionHealthCheckCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final HealthCheck getRegionHealthCheck(ProjectRegionHealthCheckName healthCheck)
Sample code:
try (RegionHealthCheckClient regionHealthCheckClient = RegionHealthCheckClient.create()) {
ProjectRegionHealthCheckName healthCheck = ProjectRegionHealthCheckName.of("[PROJECT]", "[REGION]", "[HEALTH_CHECK]");
HealthCheck response = regionHealthCheckClient.getRegionHealthCheck(healthCheck);
}
healthCheck
- Name of the HealthCheck resource to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final HealthCheck getRegionHealthCheck(String healthCheck)
Sample code:
try (RegionHealthCheckClient regionHealthCheckClient = RegionHealthCheckClient.create()) {
ProjectRegionHealthCheckName healthCheck = ProjectRegionHealthCheckName.of("[PROJECT]", "[REGION]", "[HEALTH_CHECK]");
HealthCheck response = regionHealthCheckClient.getRegionHealthCheck(healthCheck.toString());
}
healthCheck
- Name of the HealthCheck resource to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final HealthCheck getRegionHealthCheck(GetRegionHealthCheckHttpRequest request)
Sample code:
try (RegionHealthCheckClient regionHealthCheckClient = RegionHealthCheckClient.create()) {
String formattedHealthCheck = ProjectRegionHealthCheckName.format("[PROJECT]", "[REGION]", "[HEALTH_CHECK]");
GetRegionHealthCheckHttpRequest request = GetRegionHealthCheckHttpRequest.newBuilder()
.setHealthCheck(formattedHealthCheck)
.build();
HealthCheck response = regionHealthCheckClient.getRegionHealthCheck(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<GetRegionHealthCheckHttpRequest,HealthCheck> getRegionHealthCheckCallable()
Sample code:
try (RegionHealthCheckClient regionHealthCheckClient = RegionHealthCheckClient.create()) {
String formattedHealthCheck = ProjectRegionHealthCheckName.format("[PROJECT]", "[REGION]", "[HEALTH_CHECK]");
GetRegionHealthCheckHttpRequest request = GetRegionHealthCheckHttpRequest.newBuilder()
.setHealthCheck(formattedHealthCheck)
.build();
ApiFuture<HealthCheck> future = regionHealthCheckClient.getRegionHealthCheckCallable().futureCall(request);
// Do something
HealthCheck response = future.get();
}
@BetaApi public final Operation insertRegionHealthCheck(ProjectRegionName region, HealthCheck healthCheckResource)
Sample code:
try (RegionHealthCheckClient regionHealthCheckClient = RegionHealthCheckClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
Operation response = regionHealthCheckClient.insertRegionHealthCheck(region, healthCheckResource);
}
region
- Name of the region scoping this request.healthCheckResource
- Represents a Health Check resource.
Health checks are used for most GCP load balancers and managed instance group auto-healing. For more information, read Health Check Concepts.
To perform health checks on network load balancers, you must use either httpHealthChecks or httpsHealthChecks.
com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation insertRegionHealthCheck(String region, HealthCheck healthCheckResource)
Sample code:
try (RegionHealthCheckClient regionHealthCheckClient = RegionHealthCheckClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
Operation response = regionHealthCheckClient.insertRegionHealthCheck(region.toString(), healthCheckResource);
}
region
- Name of the region scoping this request.healthCheckResource
- Represents a Health Check resource.
Health checks are used for most GCP load balancers and managed instance group auto-healing. For more information, read Health Check Concepts.
To perform health checks on network load balancers, you must use either httpHealthChecks or httpsHealthChecks.
com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation insertRegionHealthCheck(InsertRegionHealthCheckHttpRequest request)
Sample code:
try (RegionHealthCheckClient regionHealthCheckClient = RegionHealthCheckClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
InsertRegionHealthCheckHttpRequest request = InsertRegionHealthCheckHttpRequest.newBuilder()
.setRegion(formattedRegion)
.setHealthCheckResource(healthCheckResource)
.build();
Operation response = regionHealthCheckClient.insertRegionHealthCheck(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<InsertRegionHealthCheckHttpRequest,Operation> insertRegionHealthCheckCallable()
Sample code:
try (RegionHealthCheckClient regionHealthCheckClient = RegionHealthCheckClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
InsertRegionHealthCheckHttpRequest request = InsertRegionHealthCheckHttpRequest.newBuilder()
.setRegion(formattedRegion)
.setHealthCheckResource(healthCheckResource)
.build();
ApiFuture<Operation> future = regionHealthCheckClient.insertRegionHealthCheckCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final RegionHealthCheckClient.ListRegionHealthChecksPagedResponse listRegionHealthChecks(ProjectRegionName region)
Sample code:
try (RegionHealthCheckClient regionHealthCheckClient = RegionHealthCheckClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
for (HealthCheck element : regionHealthCheckClient.listRegionHealthChecks(region).iterateAll()) {
// doThingsWith(element);
}
}
region
- Name of the region scoping this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final RegionHealthCheckClient.ListRegionHealthChecksPagedResponse listRegionHealthChecks(String region)
Sample code:
try (RegionHealthCheckClient regionHealthCheckClient = RegionHealthCheckClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
for (HealthCheck element : regionHealthCheckClient.listRegionHealthChecks(region.toString()).iterateAll()) {
// doThingsWith(element);
}
}
region
- Name of the region scoping this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final RegionHealthCheckClient.ListRegionHealthChecksPagedResponse listRegionHealthChecks(ListRegionHealthChecksHttpRequest request)
Sample code:
try (RegionHealthCheckClient regionHealthCheckClient = RegionHealthCheckClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
ListRegionHealthChecksHttpRequest request = ListRegionHealthChecksHttpRequest.newBuilder()
.setRegion(formattedRegion)
.build();
for (HealthCheck element : regionHealthCheckClient.listRegionHealthChecks(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListRegionHealthChecksHttpRequest,RegionHealthCheckClient.ListRegionHealthChecksPagedResponse> listRegionHealthChecksPagedCallable()
Sample code:
try (RegionHealthCheckClient regionHealthCheckClient = RegionHealthCheckClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
ListRegionHealthChecksHttpRequest request = ListRegionHealthChecksHttpRequest.newBuilder()
.setRegion(formattedRegion)
.build();
ApiFuture<ListRegionHealthChecksPagedResponse> future = regionHealthCheckClient.listRegionHealthChecksPagedCallable().futureCall(request);
// Do something
for (HealthCheck element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListRegionHealthChecksHttpRequest,HealthCheckList> listRegionHealthChecksCallable()
Sample code:
try (RegionHealthCheckClient regionHealthCheckClient = RegionHealthCheckClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
ListRegionHealthChecksHttpRequest request = ListRegionHealthChecksHttpRequest.newBuilder()
.setRegion(formattedRegion)
.build();
while (true) {
HealthCheckList response = regionHealthCheckClient.listRegionHealthChecksCallable().call(request);
for (HealthCheck element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
@BetaApi public final Operation patchRegionHealthCheck(ProjectRegionHealthCheckName healthCheck, HealthCheck healthCheckResource, List<String> fieldMask)
Sample code:
try (RegionHealthCheckClient regionHealthCheckClient = RegionHealthCheckClient.create()) {
ProjectRegionHealthCheckName healthCheck = ProjectRegionHealthCheckName.of("[PROJECT]", "[REGION]", "[HEALTH_CHECK]");
HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = regionHealthCheckClient.patchRegionHealthCheck(healthCheck, healthCheckResource, fieldMask);
}
healthCheck
- Name of the HealthCheck resource to patch.healthCheckResource
- Represents a Health Check resource.
Health checks are used for most GCP load balancers and managed instance group auto-healing. For more information, read Health Check Concepts.
To perform health checks on network load balancers, you must use either httpHealthChecks or httpsHealthChecks.
fieldMask
- The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation patchRegionHealthCheck(String healthCheck, HealthCheck healthCheckResource, List<String> fieldMask)
Sample code:
try (RegionHealthCheckClient regionHealthCheckClient = RegionHealthCheckClient.create()) {
ProjectRegionHealthCheckName healthCheck = ProjectRegionHealthCheckName.of("[PROJECT]", "[REGION]", "[HEALTH_CHECK]");
HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = regionHealthCheckClient.patchRegionHealthCheck(healthCheck.toString(), healthCheckResource, fieldMask);
}
healthCheck
- Name of the HealthCheck resource to patch.healthCheckResource
- Represents a Health Check resource.
Health checks are used for most GCP load balancers and managed instance group auto-healing. For more information, read Health Check Concepts.
To perform health checks on network load balancers, you must use either httpHealthChecks or httpsHealthChecks.
fieldMask
- The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation patchRegionHealthCheck(PatchRegionHealthCheckHttpRequest request)
Sample code:
try (RegionHealthCheckClient regionHealthCheckClient = RegionHealthCheckClient.create()) {
String formattedHealthCheck = ProjectRegionHealthCheckName.format("[PROJECT]", "[REGION]", "[HEALTH_CHECK]");
HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
PatchRegionHealthCheckHttpRequest request = PatchRegionHealthCheckHttpRequest.newBuilder()
.setHealthCheck(formattedHealthCheck)
.setHealthCheckResource(healthCheckResource)
.addAllFieldMask(fieldMask)
.build();
Operation response = regionHealthCheckClient.patchRegionHealthCheck(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<PatchRegionHealthCheckHttpRequest,Operation> patchRegionHealthCheckCallable()
Sample code:
try (RegionHealthCheckClient regionHealthCheckClient = RegionHealthCheckClient.create()) {
String formattedHealthCheck = ProjectRegionHealthCheckName.format("[PROJECT]", "[REGION]", "[HEALTH_CHECK]");
HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
PatchRegionHealthCheckHttpRequest request = PatchRegionHealthCheckHttpRequest.newBuilder()
.setHealthCheck(formattedHealthCheck)
.setHealthCheckResource(healthCheckResource)
.addAllFieldMask(fieldMask)
.build();
ApiFuture<Operation> future = regionHealthCheckClient.patchRegionHealthCheckCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation updateRegionHealthCheck(ProjectRegionHealthCheckName healthCheck, HealthCheck healthCheckResource, List<String> fieldMask)
Sample code:
try (RegionHealthCheckClient regionHealthCheckClient = RegionHealthCheckClient.create()) {
ProjectRegionHealthCheckName healthCheck = ProjectRegionHealthCheckName.of("[PROJECT]", "[REGION]", "[HEALTH_CHECK]");
HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = regionHealthCheckClient.updateRegionHealthCheck(healthCheck, healthCheckResource, fieldMask);
}
healthCheck
- Name of the HealthCheck resource to update.healthCheckResource
- Represents a Health Check resource.
Health checks are used for most GCP load balancers and managed instance group auto-healing. For more information, read Health Check Concepts.
To perform health checks on network load balancers, you must use either httpHealthChecks or httpsHealthChecks.
fieldMask
- The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation updateRegionHealthCheck(String healthCheck, HealthCheck healthCheckResource, List<String> fieldMask)
Sample code:
try (RegionHealthCheckClient regionHealthCheckClient = RegionHealthCheckClient.create()) {
ProjectRegionHealthCheckName healthCheck = ProjectRegionHealthCheckName.of("[PROJECT]", "[REGION]", "[HEALTH_CHECK]");
HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = regionHealthCheckClient.updateRegionHealthCheck(healthCheck.toString(), healthCheckResource, fieldMask);
}
healthCheck
- Name of the HealthCheck resource to update.healthCheckResource
- Represents a Health Check resource.
Health checks are used for most GCP load balancers and managed instance group auto-healing. For more information, read Health Check Concepts.
To perform health checks on network load balancers, you must use either httpHealthChecks or httpsHealthChecks.
fieldMask
- The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation updateRegionHealthCheck(UpdateRegionHealthCheckHttpRequest request)
Sample code:
try (RegionHealthCheckClient regionHealthCheckClient = RegionHealthCheckClient.create()) {
String formattedHealthCheck = ProjectRegionHealthCheckName.format("[PROJECT]", "[REGION]", "[HEALTH_CHECK]");
HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
UpdateRegionHealthCheckHttpRequest request = UpdateRegionHealthCheckHttpRequest.newBuilder()
.setHealthCheck(formattedHealthCheck)
.setHealthCheckResource(healthCheckResource)
.addAllFieldMask(fieldMask)
.build();
Operation response = regionHealthCheckClient.updateRegionHealthCheck(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<UpdateRegionHealthCheckHttpRequest,Operation> updateRegionHealthCheckCallable()
Sample code:
try (RegionHealthCheckClient regionHealthCheckClient = RegionHealthCheckClient.create()) {
String formattedHealthCheck = ProjectRegionHealthCheckName.format("[PROJECT]", "[REGION]", "[HEALTH_CHECK]");
HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
UpdateRegionHealthCheckHttpRequest request = UpdateRegionHealthCheckHttpRequest.newBuilder()
.setHealthCheck(formattedHealthCheck)
.setHealthCheckResource(healthCheckResource)
.addAllFieldMask(fieldMask)
.build();
ApiFuture<Operation> future = regionHealthCheckClient.updateRegionHealthCheckCallable().futureCall(request);
// Do something
Operation response = future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isShutdown()
isShutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isTerminated()
isTerminated
in interface com.google.api.gax.core.BackgroundResource
public void shutdownNow()
shutdownNow
in interface com.google.api.gax.core.BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface com.google.api.gax.core.BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.