@Generated(value="by gapic-generator") @BetaApi public class HealthCheckClient 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 (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
Operation response = healthCheckClient.deleteHealthCheck(healthCheck);
}
Note: close() needs to be called on the healthCheckClient 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 HealthCheckSettings to create(). For example:
To customize credentials:
HealthCheckSettings healthCheckSettings =
HealthCheckSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
HealthCheckClient healthCheckClient =
HealthCheckClient.create(healthCheckSettings);
To customize the endpoint:
HealthCheckSettings healthCheckSettings =
HealthCheckSettings.newBuilder().setEndpoint(myEndpoint).build();
HealthCheckClient healthCheckClient =
HealthCheckClient.create(healthCheckSettings);
Modifier and Type | Class and Description |
---|---|
static class |
HealthCheckClient.AggregatedListHealthChecksFixedSizeCollection |
static class |
HealthCheckClient.AggregatedListHealthChecksPage |
static class |
HealthCheckClient.AggregatedListHealthChecksPagedResponse |
static class |
HealthCheckClient.ListHealthChecksFixedSizeCollection |
static class |
HealthCheckClient.ListHealthChecksPage |
static class |
HealthCheckClient.ListHealthChecksPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
HealthCheckClient(HealthCheckSettings settings)
Constructs an instance of HealthCheckClient, using the given settings.
|
protected |
HealthCheckClient(HealthCheckStub stub) |
Modifier and Type | Method and Description |
---|---|
HealthCheckClient.AggregatedListHealthChecksPagedResponse |
aggregatedListHealthChecks(AggregatedListHealthChecksHttpRequest request)
Retrieves the list of all HealthCheck resources, regional and global, available to the
specified project.
|
HealthCheckClient.AggregatedListHealthChecksPagedResponse |
aggregatedListHealthChecks(ProjectName project)
Retrieves the list of all HealthCheck resources, regional and global, available to the
specified project.
|
HealthCheckClient.AggregatedListHealthChecksPagedResponse |
aggregatedListHealthChecks(String project)
Retrieves the list of all HealthCheck resources, regional and global, available to the
specified project.
|
com.google.api.gax.rpc.UnaryCallable<AggregatedListHealthChecksHttpRequest,HealthChecksAggregatedList> |
aggregatedListHealthChecksCallable()
Retrieves the list of all HealthCheck resources, regional and global, available to the
specified project.
|
com.google.api.gax.rpc.UnaryCallable<AggregatedListHealthChecksHttpRequest,HealthCheckClient.AggregatedListHealthChecksPagedResponse> |
aggregatedListHealthChecksPagedCallable()
Retrieves the list of all HealthCheck resources, regional and global, available to the
specified project.
|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static HealthCheckClient |
create()
Constructs an instance of HealthCheckClient with default settings.
|
static HealthCheckClient |
create(HealthCheckSettings settings)
Constructs an instance of HealthCheckClient, using the given settings.
|
static HealthCheckClient |
create(HealthCheckStub stub)
Constructs an instance of HealthCheckClient, using the given stub for making calls.
|
Operation |
deleteHealthCheck(DeleteHealthCheckHttpRequest request)
Deletes the specified HealthCheck resource.
|
Operation |
deleteHealthCheck(ProjectGlobalHealthCheckName healthCheck)
Deletes the specified HealthCheck resource.
|
Operation |
deleteHealthCheck(String healthCheck)
Deletes the specified HealthCheck resource.
|
com.google.api.gax.rpc.UnaryCallable<DeleteHealthCheckHttpRequest,Operation> |
deleteHealthCheckCallable()
Deletes the specified HealthCheck resource.
|
HealthCheck |
getHealthCheck(GetHealthCheckHttpRequest request)
Returns the specified HealthCheck resource.
|
HealthCheck |
getHealthCheck(ProjectGlobalHealthCheckName healthCheck)
Returns the specified HealthCheck resource.
|
HealthCheck |
getHealthCheck(String healthCheck)
Returns the specified HealthCheck resource.
|
com.google.api.gax.rpc.UnaryCallable<GetHealthCheckHttpRequest,HealthCheck> |
getHealthCheckCallable()
Returns the specified HealthCheck resource.
|
HealthCheckSettings |
getSettings() |
HealthCheckStub |
getStub() |
Operation |
insertHealthCheck(InsertHealthCheckHttpRequest request)
Creates a HealthCheck resource in the specified project using the data included in the request.
|
Operation |
insertHealthCheck(ProjectName project,
HealthCheck healthCheckResource)
Creates a HealthCheck resource in the specified project using the data included in the request.
|
Operation |
insertHealthCheck(String project,
HealthCheck healthCheckResource)
Creates a HealthCheck resource in the specified project using the data included in the request.
|
com.google.api.gax.rpc.UnaryCallable<InsertHealthCheckHttpRequest,Operation> |
insertHealthCheckCallable()
Creates a HealthCheck resource in the specified project using the data included in the request.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
HealthCheckClient.ListHealthChecksPagedResponse |
listHealthChecks(ListHealthChecksHttpRequest request)
Retrieves the list of HealthCheck resources available to the specified project.
|
HealthCheckClient.ListHealthChecksPagedResponse |
listHealthChecks(ProjectName project)
Retrieves the list of HealthCheck resources available to the specified project.
|
HealthCheckClient.ListHealthChecksPagedResponse |
listHealthChecks(String project)
Retrieves the list of HealthCheck resources available to the specified project.
|
com.google.api.gax.rpc.UnaryCallable<ListHealthChecksHttpRequest,HealthCheckList> |
listHealthChecksCallable()
Retrieves the list of HealthCheck resources available to the specified project.
|
com.google.api.gax.rpc.UnaryCallable<ListHealthChecksHttpRequest,HealthCheckClient.ListHealthChecksPagedResponse> |
listHealthChecksPagedCallable()
Retrieves the list of HealthCheck resources available to the specified project.
|
Operation |
patchHealthCheck(PatchHealthCheckHttpRequest request)
Updates a HealthCheck resource in the specified project using the data included in the request.
|
Operation |
patchHealthCheck(ProjectGlobalHealthCheckName healthCheck,
HealthCheck healthCheckResource,
List<String> fieldMask)
Updates a HealthCheck resource in the specified project using the data included in the request.
|
Operation |
patchHealthCheck(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<PatchHealthCheckHttpRequest,Operation> |
patchHealthCheckCallable()
Updates a HealthCheck resource in the specified project using the data included in the request.
|
void |
shutdown() |
void |
shutdownNow() |
Operation |
updateHealthCheck(ProjectGlobalHealthCheckName healthCheck,
HealthCheck healthCheckResource,
List<String> fieldMask)
Updates a HealthCheck resource in the specified project using the data included in the request.
|
Operation |
updateHealthCheck(String healthCheck,
HealthCheck healthCheckResource,
List<String> fieldMask)
Updates a HealthCheck resource in the specified project using the data included in the request.
|
Operation |
updateHealthCheck(UpdateHealthCheckHttpRequest request)
Updates a HealthCheck resource in the specified project using the data included in the request.
|
com.google.api.gax.rpc.UnaryCallable<UpdateHealthCheckHttpRequest,Operation> |
updateHealthCheckCallable()
Updates a HealthCheck resource in the specified project using the data included in the request.
|
protected HealthCheckClient(HealthCheckSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected HealthCheckClient(HealthCheckStub stub)
public static final HealthCheckClient create() throws IOException
IOException
public static final HealthCheckClient create(HealthCheckSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final HealthCheckClient create(HealthCheckStub stub)
public final HealthCheckSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public HealthCheckStub getStub()
@BetaApi public final HealthCheckClient.AggregatedListHealthChecksPagedResponse aggregatedListHealthChecks(ProjectName project)
Sample code:
try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (HealthChecksScopedList element : healthCheckClient.aggregatedListHealthChecks(project).iterateAll()) {
// doThingsWith(element);
}
}
project
- Name of the project scoping this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final HealthCheckClient.AggregatedListHealthChecksPagedResponse aggregatedListHealthChecks(String project)
Sample code:
try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (HealthChecksScopedList element : healthCheckClient.aggregatedListHealthChecks(project.toString()).iterateAll()) {
// doThingsWith(element);
}
}
project
- Name of the project scoping this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final HealthCheckClient.AggregatedListHealthChecksPagedResponse aggregatedListHealthChecks(AggregatedListHealthChecksHttpRequest request)
Sample code:
try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListHealthChecksHttpRequest request = AggregatedListHealthChecksHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
for (HealthChecksScopedList element : healthCheckClient.aggregatedListHealthChecks(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<AggregatedListHealthChecksHttpRequest,HealthCheckClient.AggregatedListHealthChecksPagedResponse> aggregatedListHealthChecksPagedCallable()
Sample code:
try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListHealthChecksHttpRequest request = AggregatedListHealthChecksHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
ApiFuture<AggregatedListHealthChecksPagedResponse> future = healthCheckClient.aggregatedListHealthChecksPagedCallable().futureCall(request);
// Do something
for (HealthChecksScopedList element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final com.google.api.gax.rpc.UnaryCallable<AggregatedListHealthChecksHttpRequest,HealthChecksAggregatedList> aggregatedListHealthChecksCallable()
Sample code:
try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListHealthChecksHttpRequest request = AggregatedListHealthChecksHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
while (true) {
HealthChecksAggregatedList response = healthCheckClient.aggregatedListHealthChecksCallable().call(request);
for (HealthChecksScopedList element : response.getItemsMap()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
@BetaApi public final Operation deleteHealthCheck(ProjectGlobalHealthCheckName healthCheck)
Sample code:
try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
Operation response = healthCheckClient.deleteHealthCheck(healthCheck);
}
healthCheck
- Name of the HealthCheck resource to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteHealthCheck(String healthCheck)
Sample code:
try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
Operation response = healthCheckClient.deleteHealthCheck(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 deleteHealthCheck(DeleteHealthCheckHttpRequest request)
Sample code:
try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
String formattedHealthCheck = ProjectGlobalHealthCheckName.format("[PROJECT]", "[HEALTH_CHECK]");
DeleteHealthCheckHttpRequest request = DeleteHealthCheckHttpRequest.newBuilder()
.setHealthCheck(formattedHealthCheck)
.build();
Operation response = healthCheckClient.deleteHealthCheck(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<DeleteHealthCheckHttpRequest,Operation> deleteHealthCheckCallable()
Sample code:
try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
String formattedHealthCheck = ProjectGlobalHealthCheckName.format("[PROJECT]", "[HEALTH_CHECK]");
DeleteHealthCheckHttpRequest request = DeleteHealthCheckHttpRequest.newBuilder()
.setHealthCheck(formattedHealthCheck)
.build();
ApiFuture<Operation> future = healthCheckClient.deleteHealthCheckCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final HealthCheck getHealthCheck(ProjectGlobalHealthCheckName healthCheck)
Sample code:
try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
HealthCheck response = healthCheckClient.getHealthCheck(healthCheck);
}
healthCheck
- Name of the HealthCheck resource to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final HealthCheck getHealthCheck(String healthCheck)
Sample code:
try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
HealthCheck response = healthCheckClient.getHealthCheck(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 getHealthCheck(GetHealthCheckHttpRequest request)
Sample code:
try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
String formattedHealthCheck = ProjectGlobalHealthCheckName.format("[PROJECT]", "[HEALTH_CHECK]");
GetHealthCheckHttpRequest request = GetHealthCheckHttpRequest.newBuilder()
.setHealthCheck(formattedHealthCheck)
.build();
HealthCheck response = healthCheckClient.getHealthCheck(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<GetHealthCheckHttpRequest,HealthCheck> getHealthCheckCallable()
Sample code:
try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
String formattedHealthCheck = ProjectGlobalHealthCheckName.format("[PROJECT]", "[HEALTH_CHECK]");
GetHealthCheckHttpRequest request = GetHealthCheckHttpRequest.newBuilder()
.setHealthCheck(formattedHealthCheck)
.build();
ApiFuture<HealthCheck> future = healthCheckClient.getHealthCheckCallable().futureCall(request);
// Do something
HealthCheck response = future.get();
}
@BetaApi public final Operation insertHealthCheck(ProjectName project, HealthCheck healthCheckResource)
Sample code:
try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
Operation response = healthCheckClient.insertHealthCheck(project, healthCheckResource);
}
project
- Project ID for 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 insertHealthCheck(String project, HealthCheck healthCheckResource)
Sample code:
try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
Operation response = healthCheckClient.insertHealthCheck(project.toString(), healthCheckResource);
}
project
- Project ID for 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 insertHealthCheck(InsertHealthCheckHttpRequest request)
Sample code:
try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
InsertHealthCheckHttpRequest request = InsertHealthCheckHttpRequest.newBuilder()
.setProject(formattedProject)
.setHealthCheckResource(healthCheckResource)
.build();
Operation response = healthCheckClient.insertHealthCheck(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<InsertHealthCheckHttpRequest,Operation> insertHealthCheckCallable()
Sample code:
try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
InsertHealthCheckHttpRequest request = InsertHealthCheckHttpRequest.newBuilder()
.setProject(formattedProject)
.setHealthCheckResource(healthCheckResource)
.build();
ApiFuture<Operation> future = healthCheckClient.insertHealthCheckCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final HealthCheckClient.ListHealthChecksPagedResponse listHealthChecks(ProjectName project)
Sample code:
try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (HealthCheck element : healthCheckClient.listHealthChecks(project).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final HealthCheckClient.ListHealthChecksPagedResponse listHealthChecks(String project)
Sample code:
try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (HealthCheck element : healthCheckClient.listHealthChecks(project.toString()).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final HealthCheckClient.ListHealthChecksPagedResponse listHealthChecks(ListHealthChecksHttpRequest request)
Sample code:
try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListHealthChecksHttpRequest request = ListHealthChecksHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
for (HealthCheck element : healthCheckClient.listHealthChecks(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<ListHealthChecksHttpRequest,HealthCheckClient.ListHealthChecksPagedResponse> listHealthChecksPagedCallable()
Sample code:
try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListHealthChecksHttpRequest request = ListHealthChecksHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
ApiFuture<ListHealthChecksPagedResponse> future = healthCheckClient.listHealthChecksPagedCallable().futureCall(request);
// Do something
for (HealthCheck element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListHealthChecksHttpRequest,HealthCheckList> listHealthChecksCallable()
Sample code:
try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListHealthChecksHttpRequest request = ListHealthChecksHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
while (true) {
HealthCheckList response = healthCheckClient.listHealthChecksCallable().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 patchHealthCheck(ProjectGlobalHealthCheckName healthCheck, HealthCheck healthCheckResource, List<String> fieldMask)
Sample code:
try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = healthCheckClient.patchHealthCheck(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 patchHealthCheck(String healthCheck, HealthCheck healthCheckResource, List<String> fieldMask)
Sample code:
try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = healthCheckClient.patchHealthCheck(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 patchHealthCheck(PatchHealthCheckHttpRequest request)
Sample code:
try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
String formattedHealthCheck = ProjectGlobalHealthCheckName.format("[PROJECT]", "[HEALTH_CHECK]");
HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
PatchHealthCheckHttpRequest request = PatchHealthCheckHttpRequest.newBuilder()
.setHealthCheck(formattedHealthCheck)
.setHealthCheckResource(healthCheckResource)
.addAllFieldMask(fieldMask)
.build();
Operation response = healthCheckClient.patchHealthCheck(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<PatchHealthCheckHttpRequest,Operation> patchHealthCheckCallable()
Sample code:
try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
String formattedHealthCheck = ProjectGlobalHealthCheckName.format("[PROJECT]", "[HEALTH_CHECK]");
HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
PatchHealthCheckHttpRequest request = PatchHealthCheckHttpRequest.newBuilder()
.setHealthCheck(formattedHealthCheck)
.setHealthCheckResource(healthCheckResource)
.addAllFieldMask(fieldMask)
.build();
ApiFuture<Operation> future = healthCheckClient.patchHealthCheckCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation updateHealthCheck(ProjectGlobalHealthCheckName healthCheck, HealthCheck healthCheckResource, List<String> fieldMask)
Sample code:
try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = healthCheckClient.updateHealthCheck(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 updateHealthCheck(String healthCheck, HealthCheck healthCheckResource, List<String> fieldMask)
Sample code:
try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = healthCheckClient.updateHealthCheck(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 updateHealthCheck(UpdateHealthCheckHttpRequest request)
Sample code:
try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
String formattedHealthCheck = ProjectGlobalHealthCheckName.format("[PROJECT]", "[HEALTH_CHECK]");
HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
UpdateHealthCheckHttpRequest request = UpdateHealthCheckHttpRequest.newBuilder()
.setHealthCheck(formattedHealthCheck)
.setHealthCheckResource(healthCheckResource)
.addAllFieldMask(fieldMask)
.build();
Operation response = healthCheckClient.updateHealthCheck(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<UpdateHealthCheckHttpRequest,Operation> updateHealthCheckCallable()
Sample code:
try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
String formattedHealthCheck = ProjectGlobalHealthCheckName.format("[PROJECT]", "[HEALTH_CHECK]");
HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
UpdateHealthCheckHttpRequest request = UpdateHealthCheckHttpRequest.newBuilder()
.setHealthCheck(formattedHealthCheck)
.setHealthCheckResource(healthCheckResource)
.addAllFieldMask(fieldMask)
.build();
ApiFuture<Operation> future = healthCheckClient.updateHealthCheckCallable().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.