@Generated(value="by gapic-generator") public class UptimeCheckServiceClient 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 (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]");
UptimeCheckConfig response = uptimeCheckServiceClient.getUptimeCheckConfig(name);
}
Note: close() needs to be called on the uptimeCheckServiceClient 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 UptimeCheckServiceSettings to create(). For example:
To customize credentials:
UptimeCheckServiceSettings uptimeCheckServiceSettings =
UptimeCheckServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
UptimeCheckServiceClient uptimeCheckServiceClient =
UptimeCheckServiceClient.create(uptimeCheckServiceSettings);
To customize the endpoint:
UptimeCheckServiceSettings uptimeCheckServiceSettings =
UptimeCheckServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
UptimeCheckServiceClient uptimeCheckServiceClient =
UptimeCheckServiceClient.create(uptimeCheckServiceSettings);
Modifier and Type | Class and Description |
---|---|
static class |
UptimeCheckServiceClient.ListUptimeCheckConfigsFixedSizeCollection |
static class |
UptimeCheckServiceClient.ListUptimeCheckConfigsPage |
static class |
UptimeCheckServiceClient.ListUptimeCheckConfigsPagedResponse |
static class |
UptimeCheckServiceClient.ListUptimeCheckIpsFixedSizeCollection |
static class |
UptimeCheckServiceClient.ListUptimeCheckIpsPage |
static class |
UptimeCheckServiceClient.ListUptimeCheckIpsPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
UptimeCheckServiceClient(UptimeCheckServiceSettings settings)
Constructs an instance of UptimeCheckServiceClient, using the given settings.
|
protected |
UptimeCheckServiceClient(UptimeCheckServiceStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static UptimeCheckServiceClient |
create()
Constructs an instance of UptimeCheckServiceClient with default settings.
|
static UptimeCheckServiceClient |
create(UptimeCheckServiceSettings settings)
Constructs an instance of UptimeCheckServiceClient, using the given settings.
|
static UptimeCheckServiceClient |
create(UptimeCheckServiceStub stub)
Constructs an instance of UptimeCheckServiceClient, using the given stub for making calls.
|
UptimeCheckConfig |
createUptimeCheckConfig(CreateUptimeCheckConfigRequest request)
Creates a new Uptime check configuration.
|
UptimeCheckConfig |
createUptimeCheckConfig(String parent,
UptimeCheckConfig uptimeCheckConfig)
Creates a new Uptime check configuration.
|
com.google.api.gax.rpc.UnaryCallable<CreateUptimeCheckConfigRequest,UptimeCheckConfig> |
createUptimeCheckConfigCallable()
Creates a new Uptime check configuration.
|
void |
deleteUptimeCheckConfig(DeleteUptimeCheckConfigRequest request)
Deletes an Uptime check configuration.
|
void |
deleteUptimeCheckConfig(String name)
Deletes an Uptime check configuration.
|
void |
deleteUptimeCheckConfig(UptimeCheckConfigName name)
Deletes an Uptime check configuration.
|
com.google.api.gax.rpc.UnaryCallable<DeleteUptimeCheckConfigRequest,Empty> |
deleteUptimeCheckConfigCallable()
Deletes an Uptime check configuration.
|
UptimeCheckServiceSettings |
getSettings() |
UptimeCheckServiceStub |
getStub() |
UptimeCheckConfig |
getUptimeCheckConfig(GetUptimeCheckConfigRequest request)
Gets a single Uptime check configuration.
|
UptimeCheckConfig |
getUptimeCheckConfig(String name)
Gets a single Uptime check configuration.
|
UptimeCheckConfig |
getUptimeCheckConfig(UptimeCheckConfigName name)
Gets a single Uptime check configuration.
|
com.google.api.gax.rpc.UnaryCallable<GetUptimeCheckConfigRequest,UptimeCheckConfig> |
getUptimeCheckConfigCallable()
Gets a single Uptime check configuration.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
UptimeCheckServiceClient.ListUptimeCheckConfigsPagedResponse |
listUptimeCheckConfigs(ListUptimeCheckConfigsRequest request)
Lists the existing valid Uptime check configurations for the project (leaving out any invalid
configurations).
|
UptimeCheckServiceClient.ListUptimeCheckConfigsPagedResponse |
listUptimeCheckConfigs(String parent)
Lists the existing valid Uptime check configurations for the project (leaving out any invalid
configurations).
|
com.google.api.gax.rpc.UnaryCallable<ListUptimeCheckConfigsRequest,ListUptimeCheckConfigsResponse> |
listUptimeCheckConfigsCallable()
Lists the existing valid Uptime check configurations for the project (leaving out any invalid
configurations).
|
com.google.api.gax.rpc.UnaryCallable<ListUptimeCheckConfigsRequest,UptimeCheckServiceClient.ListUptimeCheckConfigsPagedResponse> |
listUptimeCheckConfigsPagedCallable()
Lists the existing valid Uptime check configurations for the project (leaving out any invalid
configurations).
|
UptimeCheckServiceClient.ListUptimeCheckIpsPagedResponse |
listUptimeCheckIps(ListUptimeCheckIpsRequest request)
Returns the list of IP addresses that checkers run from
|
com.google.api.gax.rpc.UnaryCallable<ListUptimeCheckIpsRequest,ListUptimeCheckIpsResponse> |
listUptimeCheckIpsCallable()
Returns the list of IP addresses that checkers run from
|
com.google.api.gax.rpc.UnaryCallable<ListUptimeCheckIpsRequest,UptimeCheckServiceClient.ListUptimeCheckIpsPagedResponse> |
listUptimeCheckIpsPagedCallable()
Returns the list of IP addresses that checkers run from
|
void |
shutdown() |
void |
shutdownNow() |
UptimeCheckConfig |
updateUptimeCheckConfig(UpdateUptimeCheckConfigRequest request)
Updates an Uptime check configuration.
|
UptimeCheckConfig |
updateUptimeCheckConfig(UptimeCheckConfig uptimeCheckConfig)
Updates an Uptime check configuration.
|
com.google.api.gax.rpc.UnaryCallable<UpdateUptimeCheckConfigRequest,UptimeCheckConfig> |
updateUptimeCheckConfigCallable()
Updates an Uptime check configuration.
|
protected UptimeCheckServiceClient(UptimeCheckServiceSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected UptimeCheckServiceClient(UptimeCheckServiceStub stub)
public static final UptimeCheckServiceClient create() throws IOException
IOException
public static final UptimeCheckServiceClient create(UptimeCheckServiceSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final UptimeCheckServiceClient create(UptimeCheckServiceStub stub)
public final UptimeCheckServiceSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public UptimeCheckServiceStub getStub()
public final UptimeCheckServiceClient.ListUptimeCheckConfigsPagedResponse listUptimeCheckConfigs(String parent)
Sample code:
try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
String formattedParent = ProjectName.format("[PROJECT]");
for (UptimeCheckConfig element : uptimeCheckServiceClient.listUptimeCheckConfigs(formattedParent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- The project whose Uptime check configurations are listed. The format is
`projects/[PROJECT_ID]`.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final UptimeCheckServiceClient.ListUptimeCheckConfigsPagedResponse listUptimeCheckConfigs(ListUptimeCheckConfigsRequest request)
Sample code:
try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
String formattedParent = ProjectName.format("[PROJECT]");
ListUptimeCheckConfigsRequest request = ListUptimeCheckConfigsRequest.newBuilder()
.setParent(formattedParent)
.build();
for (UptimeCheckConfig element : uptimeCheckServiceClient.listUptimeCheckConfigs(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 failspublic final com.google.api.gax.rpc.UnaryCallable<ListUptimeCheckConfigsRequest,UptimeCheckServiceClient.ListUptimeCheckConfigsPagedResponse> listUptimeCheckConfigsPagedCallable()
Sample code:
try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
String formattedParent = ProjectName.format("[PROJECT]");
ListUptimeCheckConfigsRequest request = ListUptimeCheckConfigsRequest.newBuilder()
.setParent(formattedParent)
.build();
ApiFuture<ListUptimeCheckConfigsPagedResponse> future = uptimeCheckServiceClient.listUptimeCheckConfigsPagedCallable().futureCall(request);
// Do something
for (UptimeCheckConfig element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListUptimeCheckConfigsRequest,ListUptimeCheckConfigsResponse> listUptimeCheckConfigsCallable()
Sample code:
try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
String formattedParent = ProjectName.format("[PROJECT]");
ListUptimeCheckConfigsRequest request = ListUptimeCheckConfigsRequest.newBuilder()
.setParent(formattedParent)
.build();
while (true) {
ListUptimeCheckConfigsResponse response = uptimeCheckServiceClient.listUptimeCheckConfigsCallable().call(request);
for (UptimeCheckConfig element : response.getUptimeCheckConfigsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final UptimeCheckConfig getUptimeCheckConfig(UptimeCheckConfigName name)
Sample code:
try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]");
UptimeCheckConfig response = uptimeCheckServiceClient.getUptimeCheckConfig(name);
}
name
- The Uptime check configuration to retrieve. The format is
`projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID]`.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final UptimeCheckConfig getUptimeCheckConfig(String name)
Sample code:
try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]");
UptimeCheckConfig response = uptimeCheckServiceClient.getUptimeCheckConfig(name.toString());
}
name
- The Uptime check configuration to retrieve. The format is
`projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID]`.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final UptimeCheckConfig getUptimeCheckConfig(GetUptimeCheckConfigRequest request)
Sample code:
try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]");
GetUptimeCheckConfigRequest request = GetUptimeCheckConfigRequest.newBuilder()
.setName(name.toString())
.build();
UptimeCheckConfig response = uptimeCheckServiceClient.getUptimeCheckConfig(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<GetUptimeCheckConfigRequest,UptimeCheckConfig> getUptimeCheckConfigCallable()
Sample code:
try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]");
GetUptimeCheckConfigRequest request = GetUptimeCheckConfigRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<UptimeCheckConfig> future = uptimeCheckServiceClient.getUptimeCheckConfigCallable().futureCall(request);
// Do something
UptimeCheckConfig response = future.get();
}
public final UptimeCheckConfig createUptimeCheckConfig(String parent, UptimeCheckConfig uptimeCheckConfig)
Sample code:
try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
String formattedParent = ProjectName.format("[PROJECT]");
UptimeCheckConfig uptimeCheckConfig = UptimeCheckConfig.newBuilder().build();
UptimeCheckConfig response = uptimeCheckServiceClient.createUptimeCheckConfig(formattedParent, uptimeCheckConfig);
}
parent
- The project in which to create the Uptime check. The format is
`projects/[PROJECT_ID]`.uptimeCheckConfig
- The new Uptime check configuration.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final UptimeCheckConfig createUptimeCheckConfig(CreateUptimeCheckConfigRequest request)
Sample code:
try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
String formattedParent = ProjectName.format("[PROJECT]");
UptimeCheckConfig uptimeCheckConfig = UptimeCheckConfig.newBuilder().build();
CreateUptimeCheckConfigRequest request = CreateUptimeCheckConfigRequest.newBuilder()
.setParent(formattedParent)
.setUptimeCheckConfig(uptimeCheckConfig)
.build();
UptimeCheckConfig response = uptimeCheckServiceClient.createUptimeCheckConfig(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<CreateUptimeCheckConfigRequest,UptimeCheckConfig> createUptimeCheckConfigCallable()
Sample code:
try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
String formattedParent = ProjectName.format("[PROJECT]");
UptimeCheckConfig uptimeCheckConfig = UptimeCheckConfig.newBuilder().build();
CreateUptimeCheckConfigRequest request = CreateUptimeCheckConfigRequest.newBuilder()
.setParent(formattedParent)
.setUptimeCheckConfig(uptimeCheckConfig)
.build();
ApiFuture<UptimeCheckConfig> future = uptimeCheckServiceClient.createUptimeCheckConfigCallable().futureCall(request);
// Do something
UptimeCheckConfig response = future.get();
}
public final UptimeCheckConfig updateUptimeCheckConfig(UptimeCheckConfig uptimeCheckConfig)
Sample code:
try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
UptimeCheckConfig uptimeCheckConfig = UptimeCheckConfig.newBuilder().build();
UptimeCheckConfig response = uptimeCheckServiceClient.updateUptimeCheckConfig(uptimeCheckConfig);
}
uptimeCheckConfig
- Required. If an `updateMask` has been specified, this field gives the
values for the set of fields mentioned in the `updateMask`. If an `updateMask` has not been
given, this Uptime check configuration replaces the current configuration. If a field is
mentioned in `updateMask` but the corresonding field is omitted in this partial Uptime
check configuration, it has the effect of deleting/clearing the field from the
configuration on the server.
The following fields can be updated: `display_name`, `http_check`, `tcp_check`, `timeout`, `content_matchers`, and `selected_regions`.
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final UptimeCheckConfig updateUptimeCheckConfig(UpdateUptimeCheckConfigRequest request)
Sample code:
try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
UptimeCheckConfig uptimeCheckConfig = UptimeCheckConfig.newBuilder().build();
UpdateUptimeCheckConfigRequest request = UpdateUptimeCheckConfigRequest.newBuilder()
.setUptimeCheckConfig(uptimeCheckConfig)
.build();
UptimeCheckConfig response = uptimeCheckServiceClient.updateUptimeCheckConfig(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<UpdateUptimeCheckConfigRequest,UptimeCheckConfig> updateUptimeCheckConfigCallable()
Sample code:
try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
UptimeCheckConfig uptimeCheckConfig = UptimeCheckConfig.newBuilder().build();
UpdateUptimeCheckConfigRequest request = UpdateUptimeCheckConfigRequest.newBuilder()
.setUptimeCheckConfig(uptimeCheckConfig)
.build();
ApiFuture<UptimeCheckConfig> future = uptimeCheckServiceClient.updateUptimeCheckConfigCallable().futureCall(request);
// Do something
UptimeCheckConfig response = future.get();
}
public final void deleteUptimeCheckConfig(UptimeCheckConfigName name)
Sample code:
try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]");
uptimeCheckServiceClient.deleteUptimeCheckConfig(name);
}
name
- The Uptime check configuration to delete. The format is
`projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID]`.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final void deleteUptimeCheckConfig(String name)
Sample code:
try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]");
uptimeCheckServiceClient.deleteUptimeCheckConfig(name.toString());
}
name
- The Uptime check configuration to delete. The format is
`projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID]`.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final void deleteUptimeCheckConfig(DeleteUptimeCheckConfigRequest request)
Sample code:
try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]");
DeleteUptimeCheckConfigRequest request = DeleteUptimeCheckConfigRequest.newBuilder()
.setName(name.toString())
.build();
uptimeCheckServiceClient.deleteUptimeCheckConfig(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<DeleteUptimeCheckConfigRequest,Empty> deleteUptimeCheckConfigCallable()
Sample code:
try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]");
DeleteUptimeCheckConfigRequest request = DeleteUptimeCheckConfigRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Void> future = uptimeCheckServiceClient.deleteUptimeCheckConfigCallable().futureCall(request);
// Do something
future.get();
}
public final UptimeCheckServiceClient.ListUptimeCheckIpsPagedResponse listUptimeCheckIps(ListUptimeCheckIpsRequest request)
Sample code:
try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
ListUptimeCheckIpsRequest request = ListUptimeCheckIpsRequest.newBuilder().build();
for (UptimeCheckIp element : uptimeCheckServiceClient.listUptimeCheckIps(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 failspublic final com.google.api.gax.rpc.UnaryCallable<ListUptimeCheckIpsRequest,UptimeCheckServiceClient.ListUptimeCheckIpsPagedResponse> listUptimeCheckIpsPagedCallable()
Sample code:
try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
ListUptimeCheckIpsRequest request = ListUptimeCheckIpsRequest.newBuilder().build();
ApiFuture<ListUptimeCheckIpsPagedResponse> future = uptimeCheckServiceClient.listUptimeCheckIpsPagedCallable().futureCall(request);
// Do something
for (UptimeCheckIp element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListUptimeCheckIpsRequest,ListUptimeCheckIpsResponse> listUptimeCheckIpsCallable()
Sample code:
try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
ListUptimeCheckIpsRequest request = ListUptimeCheckIpsRequest.newBuilder().build();
while (true) {
ListUptimeCheckIpsResponse response = uptimeCheckServiceClient.listUptimeCheckIpsCallable().call(request);
for (UptimeCheckIp element : response.getUptimeCheckIpsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface 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.