Class UptimeCheckServiceClient

java.lang.Object
com.google.cloud.monitoring.v3.UptimeCheckServiceClient
All Implemented Interfaces:
BackgroundResource, AutoCloseable

@Generated("by gapic-generator-java") public class UptimeCheckServiceClient extends Object implements BackgroundResource
Service Description: The UptimeCheckService API is used to manage (list, create, delete, edit) Uptime check configurations in the Cloud Monitoring product. An Uptime check is a piece of configuration that determines which resources and services to monitor for availability. These configurations can also be configured interactively by navigating to the [Cloud console] (https://console.cloud.google.com), selecting the appropriate project, clicking on "Monitoring" on the left-hand side to navigate to Cloud Monitoring, and then clicking on "Uptime".

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 (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
   UptimeCheckConfigName name =
       UptimeCheckConfigName.ofProjectUptimeCheckConfigName(
           "[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().

Methods
Method Description Method Variants

ListUptimeCheckConfigs

Lists the existing valid Uptime check configurations for the project (leaving out any invalid configurations).

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listUptimeCheckConfigs(ListUptimeCheckConfigsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listUptimeCheckConfigs(ResourceName parent)

  • listUptimeCheckConfigs(OrganizationName parent)

  • listUptimeCheckConfigs(ProjectName parent)

  • listUptimeCheckConfigs(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listUptimeCheckConfigsPagedCallable()

  • listUptimeCheckConfigsCallable()

GetUptimeCheckConfig

Gets a single Uptime check configuration.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getUptimeCheckConfig(GetUptimeCheckConfigRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getUptimeCheckConfig(UptimeCheckConfigName name)

  • getUptimeCheckConfig(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getUptimeCheckConfigCallable()

CreateUptimeCheckConfig

Creates a new Uptime check configuration.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createUptimeCheckConfig(CreateUptimeCheckConfigRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • createUptimeCheckConfig(ResourceName parent, UptimeCheckConfig uptimeCheckConfig)

  • createUptimeCheckConfig(OrganizationName parent, UptimeCheckConfig uptimeCheckConfig)

  • createUptimeCheckConfig(ProjectName parent, UptimeCheckConfig uptimeCheckConfig)

  • createUptimeCheckConfig(String parent, UptimeCheckConfig uptimeCheckConfig)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createUptimeCheckConfigCallable()

UpdateUptimeCheckConfig

Updates an Uptime check configuration. You can either replace the entire configuration with a new one or replace only certain fields in the current configuration by specifying the fields to be updated via `updateMask`. Returns the updated configuration.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateUptimeCheckConfig(UpdateUptimeCheckConfigRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • updateUptimeCheckConfig(UptimeCheckConfig uptimeCheckConfig)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateUptimeCheckConfigCallable()

DeleteUptimeCheckConfig

Deletes an Uptime check configuration. Note that this method will fail if the Uptime check configuration is referenced by an alert policy or other dependent configs that would be rendered invalid by the deletion.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteUptimeCheckConfig(DeleteUptimeCheckConfigRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • deleteUptimeCheckConfig(UptimeCheckConfigName name)

  • deleteUptimeCheckConfig(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteUptimeCheckConfigCallable()

ListUptimeCheckIps

Returns the list of IP addresses that checkers run from.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listUptimeCheckIps(ListUptimeCheckIpsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listUptimeCheckIpsPagedCallable()

  • listUptimeCheckIpsCallable()

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:


 // 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
 UptimeCheckServiceSettings uptimeCheckServiceSettings =
     UptimeCheckServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 UptimeCheckServiceClient uptimeCheckServiceClient =
     UptimeCheckServiceClient.create(uptimeCheckServiceSettings);
 

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
 UptimeCheckServiceSettings uptimeCheckServiceSettings =
     UptimeCheckServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 UptimeCheckServiceClient uptimeCheckServiceClient =
     UptimeCheckServiceClient.create(uptimeCheckServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

  • Constructor Details

    • UptimeCheckServiceClient

      protected UptimeCheckServiceClient(UptimeCheckServiceSettings settings) throws IOException
      Constructs an instance of UptimeCheckServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
      Throws:
      IOException
    • UptimeCheckServiceClient

      protected UptimeCheckServiceClient(UptimeCheckServiceStub stub)
  • Method Details

    • create

      public static final UptimeCheckServiceClient create() throws IOException
      Constructs an instance of UptimeCheckServiceClient with default settings.
      Throws:
      IOException
    • create

      public static final UptimeCheckServiceClient create(UptimeCheckServiceSettings settings) throws IOException
      Constructs an instance of UptimeCheckServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
      Throws:
      IOException
    • create

      public static final UptimeCheckServiceClient create(UptimeCheckServiceStub stub)
      Constructs an instance of UptimeCheckServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(UptimeCheckServiceSettings).
    • getSettings

      public final UptimeCheckServiceSettings getSettings()
    • getStub

      public UptimeCheckServiceStub getStub()
    • listUptimeCheckConfigs

      public final UptimeCheckServiceClient.ListUptimeCheckConfigsPagedResponse listUptimeCheckConfigs(ResourceName parent)
      Lists the existing valid Uptime check configurations for the project (leaving out any invalid configurations).

      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 (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
         ResourceName parent = ResourceName.of("[FOLDER]");
         for (UptimeCheckConfig element :
             uptimeCheckServiceClient.listUptimeCheckConfigs(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) whose Uptime check configurations are listed. The format is:

      projects/[PROJECT_ID_OR_NUMBER]

      Throws:
      ApiException - if the remote call fails
    • listUptimeCheckConfigs

      Lists the existing valid Uptime check configurations for the project (leaving out any invalid configurations).

      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 (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
         OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
         for (UptimeCheckConfig element :
             uptimeCheckServiceClient.listUptimeCheckConfigs(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) whose Uptime check configurations are listed. The format is:

      projects/[PROJECT_ID_OR_NUMBER]

      Throws:
      ApiException - if the remote call fails
    • listUptimeCheckConfigs

      public final UptimeCheckServiceClient.ListUptimeCheckConfigsPagedResponse listUptimeCheckConfigs(ProjectName parent)
      Lists the existing valid Uptime check configurations for the project (leaving out any invalid configurations).

      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 (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
         ProjectName parent = ProjectName.of("[PROJECT]");
         for (UptimeCheckConfig element :
             uptimeCheckServiceClient.listUptimeCheckConfigs(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) whose Uptime check configurations are listed. The format is:

      projects/[PROJECT_ID_OR_NUMBER]

      Throws:
      ApiException - if the remote call fails
    • listUptimeCheckConfigs

      public final UptimeCheckServiceClient.ListUptimeCheckConfigsPagedResponse listUptimeCheckConfigs(String parent)
      Lists the existing valid Uptime check configurations for the project (leaving out any invalid configurations).

      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 (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
         String parent = ProjectName.of("[PROJECT]").toString();
         for (UptimeCheckConfig element :
             uptimeCheckServiceClient.listUptimeCheckConfigs(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) whose Uptime check configurations are listed. The format is:

      projects/[PROJECT_ID_OR_NUMBER]

      Throws:
      ApiException - if the remote call fails
    • listUptimeCheckConfigs

      Lists the existing valid Uptime check configurations for the project (leaving out any invalid configurations).

      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 (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
         ListUptimeCheckConfigsRequest request =
             ListUptimeCheckConfigsRequest.newBuilder()
                 .setParent(ProjectName.of("[PROJECT]").toString())
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (UptimeCheckConfig element :
             uptimeCheckServiceClient.listUptimeCheckConfigs(request).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • listUptimeCheckConfigsPagedCallable

      Lists the existing valid Uptime check configurations for the project (leaving out any invalid configurations).

      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 (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
         ListUptimeCheckConfigsRequest request =
             ListUptimeCheckConfigsRequest.newBuilder()
                 .setParent(ProjectName.of("[PROJECT]").toString())
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<UptimeCheckConfig> future =
             uptimeCheckServiceClient.listUptimeCheckConfigsPagedCallable().futureCall(request);
         // Do something.
         for (UptimeCheckConfig element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listUptimeCheckConfigsCallable

      public final UnaryCallable<ListUptimeCheckConfigsRequest,ListUptimeCheckConfigsResponse> listUptimeCheckConfigsCallable()
      Lists the existing valid Uptime check configurations for the project (leaving out any invalid configurations).

      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 (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
         ListUptimeCheckConfigsRequest request =
             ListUptimeCheckConfigsRequest.newBuilder()
                 .setParent(ProjectName.of("[PROJECT]").toString())
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .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;
           }
         }
       }
       
    • getUptimeCheckConfig

      public final UptimeCheckConfig getUptimeCheckConfig(UptimeCheckConfigName name)
      Gets a single Uptime check configuration.

      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 (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
         UptimeCheckConfigName name =
             UptimeCheckConfigName.ofProjectUptimeCheckConfigName(
                 "[PROJECT]", "[UPTIME_CHECK_CONFIG]");
         UptimeCheckConfig response = uptimeCheckServiceClient.getUptimeCheckConfig(name);
       }
       
      Parameters:
      name - Required. The Uptime check configuration to retrieve. The format is:

      projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID]

      Throws:
      ApiException - if the remote call fails
    • getUptimeCheckConfig

      public final UptimeCheckConfig getUptimeCheckConfig(String name)
      Gets a single Uptime check configuration.

      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 (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
         String name =
             UptimeCheckConfigName.ofProjectUptimeCheckConfigName("[PROJECT]", "[UPTIME_CHECK_CONFIG]")
                 .toString();
         UptimeCheckConfig response = uptimeCheckServiceClient.getUptimeCheckConfig(name);
       }
       
      Parameters:
      name - Required. The Uptime check configuration to retrieve. The format is:

      projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID]

      Throws:
      ApiException - if the remote call fails
    • getUptimeCheckConfig

      public final UptimeCheckConfig getUptimeCheckConfig(GetUptimeCheckConfigRequest request)
      Gets a single Uptime check configuration.

      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 (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
         GetUptimeCheckConfigRequest request =
             GetUptimeCheckConfigRequest.newBuilder()
                 .setName(
                     UptimeCheckConfigName.ofProjectUptimeCheckConfigName(
                             "[PROJECT]", "[UPTIME_CHECK_CONFIG]")
                         .toString())
                 .build();
         UptimeCheckConfig response = uptimeCheckServiceClient.getUptimeCheckConfig(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getUptimeCheckConfigCallable

      public final UnaryCallable<GetUptimeCheckConfigRequest,UptimeCheckConfig> getUptimeCheckConfigCallable()
      Gets a single Uptime check configuration.

      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 (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
         GetUptimeCheckConfigRequest request =
             GetUptimeCheckConfigRequest.newBuilder()
                 .setName(
                     UptimeCheckConfigName.ofProjectUptimeCheckConfigName(
                             "[PROJECT]", "[UPTIME_CHECK_CONFIG]")
                         .toString())
                 .build();
         ApiFuture<UptimeCheckConfig> future =
             uptimeCheckServiceClient.getUptimeCheckConfigCallable().futureCall(request);
         // Do something.
         UptimeCheckConfig response = future.get();
       }
       
    • createUptimeCheckConfig

      public final UptimeCheckConfig createUptimeCheckConfig(ResourceName parent, UptimeCheckConfig uptimeCheckConfig)
      Creates a new Uptime check configuration.

      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 (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
         ResourceName parent = ResourceName.of("[FOLDER]");
         UptimeCheckConfig uptimeCheckConfig = UptimeCheckConfig.newBuilder().build();
         UptimeCheckConfig response =
             uptimeCheckServiceClient.createUptimeCheckConfig(parent, uptimeCheckConfig);
       }
       
      Parameters:
      parent - Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) in which to create the Uptime check. The format is:

      projects/[PROJECT_ID_OR_NUMBER]

      uptimeCheckConfig - Required. The new Uptime check configuration.
      Throws:
      ApiException - if the remote call fails
    • createUptimeCheckConfig

      public final UptimeCheckConfig createUptimeCheckConfig(OrganizationName parent, UptimeCheckConfig uptimeCheckConfig)
      Creates a new Uptime check configuration.

      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 (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
         OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
         UptimeCheckConfig uptimeCheckConfig = UptimeCheckConfig.newBuilder().build();
         UptimeCheckConfig response =
             uptimeCheckServiceClient.createUptimeCheckConfig(parent, uptimeCheckConfig);
       }
       
      Parameters:
      parent - Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) in which to create the Uptime check. The format is:

      projects/[PROJECT_ID_OR_NUMBER]

      uptimeCheckConfig - Required. The new Uptime check configuration.
      Throws:
      ApiException - if the remote call fails
    • createUptimeCheckConfig

      public final UptimeCheckConfig createUptimeCheckConfig(ProjectName parent, UptimeCheckConfig uptimeCheckConfig)
      Creates a new Uptime check configuration.

      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 (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
         ProjectName parent = ProjectName.of("[PROJECT]");
         UptimeCheckConfig uptimeCheckConfig = UptimeCheckConfig.newBuilder().build();
         UptimeCheckConfig response =
             uptimeCheckServiceClient.createUptimeCheckConfig(parent, uptimeCheckConfig);
       }
       
      Parameters:
      parent - Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) in which to create the Uptime check. The format is:

      projects/[PROJECT_ID_OR_NUMBER]

      uptimeCheckConfig - Required. The new Uptime check configuration.
      Throws:
      ApiException - if the remote call fails
    • createUptimeCheckConfig

      public final UptimeCheckConfig createUptimeCheckConfig(String parent, UptimeCheckConfig uptimeCheckConfig)
      Creates a new Uptime check configuration.

      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 (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
         String parent = ProjectName.of("[PROJECT]").toString();
         UptimeCheckConfig uptimeCheckConfig = UptimeCheckConfig.newBuilder().build();
         UptimeCheckConfig response =
             uptimeCheckServiceClient.createUptimeCheckConfig(parent, uptimeCheckConfig);
       }
       
      Parameters:
      parent - Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) in which to create the Uptime check. The format is:

      projects/[PROJECT_ID_OR_NUMBER]

      uptimeCheckConfig - Required. The new Uptime check configuration.
      Throws:
      ApiException - if the remote call fails
    • createUptimeCheckConfig

      public final UptimeCheckConfig createUptimeCheckConfig(CreateUptimeCheckConfigRequest request)
      Creates a new Uptime check configuration.

      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 (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
         CreateUptimeCheckConfigRequest request =
             CreateUptimeCheckConfigRequest.newBuilder()
                 .setParent(ProjectName.of("[PROJECT]").toString())
                 .setUptimeCheckConfig(UptimeCheckConfig.newBuilder().build())
                 .build();
         UptimeCheckConfig response = uptimeCheckServiceClient.createUptimeCheckConfig(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • createUptimeCheckConfigCallable

      public final UnaryCallable<CreateUptimeCheckConfigRequest,UptimeCheckConfig> createUptimeCheckConfigCallable()
      Creates a new Uptime check configuration.

      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 (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
         CreateUptimeCheckConfigRequest request =
             CreateUptimeCheckConfigRequest.newBuilder()
                 .setParent(ProjectName.of("[PROJECT]").toString())
                 .setUptimeCheckConfig(UptimeCheckConfig.newBuilder().build())
                 .build();
         ApiFuture<UptimeCheckConfig> future =
             uptimeCheckServiceClient.createUptimeCheckConfigCallable().futureCall(request);
         // Do something.
         UptimeCheckConfig response = future.get();
       }
       
    • updateUptimeCheckConfig

      public final UptimeCheckConfig updateUptimeCheckConfig(UptimeCheckConfig uptimeCheckConfig)
      Updates an Uptime check configuration. You can either replace the entire configuration with a new one or replace only certain fields in the current configuration by specifying the fields to be updated via `updateMask`. Returns the updated configuration.

      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 (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
         UptimeCheckConfig uptimeCheckConfig = UptimeCheckConfig.newBuilder().build();
         UptimeCheckConfig response =
             uptimeCheckServiceClient.updateUptimeCheckConfig(uptimeCheckConfig);
       }
       
      Parameters:
      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 corresponding 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`.

      Throws:
      ApiException - if the remote call fails
    • updateUptimeCheckConfig

      public final UptimeCheckConfig updateUptimeCheckConfig(UpdateUptimeCheckConfigRequest request)
      Updates an Uptime check configuration. You can either replace the entire configuration with a new one or replace only certain fields in the current configuration by specifying the fields to be updated via `updateMask`. Returns the updated configuration.

      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 (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
         UpdateUptimeCheckConfigRequest request =
             UpdateUptimeCheckConfigRequest.newBuilder()
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .setUptimeCheckConfig(UptimeCheckConfig.newBuilder().build())
                 .build();
         UptimeCheckConfig response = uptimeCheckServiceClient.updateUptimeCheckConfig(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • updateUptimeCheckConfigCallable

      public final UnaryCallable<UpdateUptimeCheckConfigRequest,UptimeCheckConfig> updateUptimeCheckConfigCallable()
      Updates an Uptime check configuration. You can either replace the entire configuration with a new one or replace only certain fields in the current configuration by specifying the fields to be updated via `updateMask`. Returns the updated configuration.

      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 (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
         UpdateUptimeCheckConfigRequest request =
             UpdateUptimeCheckConfigRequest.newBuilder()
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .setUptimeCheckConfig(UptimeCheckConfig.newBuilder().build())
                 .build();
         ApiFuture<UptimeCheckConfig> future =
             uptimeCheckServiceClient.updateUptimeCheckConfigCallable().futureCall(request);
         // Do something.
         UptimeCheckConfig response = future.get();
       }
       
    • deleteUptimeCheckConfig

      public final void deleteUptimeCheckConfig(UptimeCheckConfigName name)
      Deletes an Uptime check configuration. Note that this method will fail if the Uptime check configuration is referenced by an alert policy or other dependent configs that would be rendered invalid by the deletion.

      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 (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
         UptimeCheckConfigName name =
             UptimeCheckConfigName.ofProjectUptimeCheckConfigName(
                 "[PROJECT]", "[UPTIME_CHECK_CONFIG]");
         uptimeCheckServiceClient.deleteUptimeCheckConfig(name);
       }
       
      Parameters:
      name - Required. The Uptime check configuration to delete. The format is:

      projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID]

      Throws:
      ApiException - if the remote call fails
    • deleteUptimeCheckConfig

      public final void deleteUptimeCheckConfig(String name)
      Deletes an Uptime check configuration. Note that this method will fail if the Uptime check configuration is referenced by an alert policy or other dependent configs that would be rendered invalid by the deletion.

      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 (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
         String name =
             UptimeCheckConfigName.ofProjectUptimeCheckConfigName("[PROJECT]", "[UPTIME_CHECK_CONFIG]")
                 .toString();
         uptimeCheckServiceClient.deleteUptimeCheckConfig(name);
       }
       
      Parameters:
      name - Required. The Uptime check configuration to delete. The format is:

      projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID]

      Throws:
      ApiException - if the remote call fails
    • deleteUptimeCheckConfig

      public final void deleteUptimeCheckConfig(DeleteUptimeCheckConfigRequest request)
      Deletes an Uptime check configuration. Note that this method will fail if the Uptime check configuration is referenced by an alert policy or other dependent configs that would be rendered invalid by the deletion.

      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 (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
         DeleteUptimeCheckConfigRequest request =
             DeleteUptimeCheckConfigRequest.newBuilder()
                 .setName(
                     UptimeCheckConfigName.ofProjectUptimeCheckConfigName(
                             "[PROJECT]", "[UPTIME_CHECK_CONFIG]")
                         .toString())
                 .build();
         uptimeCheckServiceClient.deleteUptimeCheckConfig(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • deleteUptimeCheckConfigCallable

      public final UnaryCallable<DeleteUptimeCheckConfigRequest,com.google.protobuf.Empty> deleteUptimeCheckConfigCallable()
      Deletes an Uptime check configuration. Note that this method will fail if the Uptime check configuration is referenced by an alert policy or other dependent configs that would be rendered invalid by the deletion.

      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 (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
         DeleteUptimeCheckConfigRequest request =
             DeleteUptimeCheckConfigRequest.newBuilder()
                 .setName(
                     UptimeCheckConfigName.ofProjectUptimeCheckConfigName(
                             "[PROJECT]", "[UPTIME_CHECK_CONFIG]")
                         .toString())
                 .build();
         ApiFuture<Empty> future =
             uptimeCheckServiceClient.deleteUptimeCheckConfigCallable().futureCall(request);
         // Do something.
         future.get();
       }
       
    • listUptimeCheckIps

      Returns the list of IP addresses that checkers run from.

      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 (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
         ListUptimeCheckIpsRequest request =
             ListUptimeCheckIpsRequest.newBuilder()
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (UptimeCheckIp element :
             uptimeCheckServiceClient.listUptimeCheckIps(request).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • listUptimeCheckIpsPagedCallable

      Returns the list of IP addresses that checkers run from.

      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 (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
         ListUptimeCheckIpsRequest request =
             ListUptimeCheckIpsRequest.newBuilder()
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<UptimeCheckIp> future =
             uptimeCheckServiceClient.listUptimeCheckIpsPagedCallable().futureCall(request);
         // Do something.
         for (UptimeCheckIp element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listUptimeCheckIpsCallable

      public final UnaryCallable<ListUptimeCheckIpsRequest,ListUptimeCheckIpsResponse> listUptimeCheckIpsCallable()
      Returns the list of IP addresses that checkers run from.

      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 (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
         ListUptimeCheckIpsRequest request =
             ListUptimeCheckIpsRequest.newBuilder()
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .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;
           }
         }
       }
       
    • close

      public final void close()
      Specified by:
      close in interface AutoCloseable
    • shutdown

      public void shutdown()
      Specified by:
      shutdown in interface BackgroundResource
    • isShutdown

      public boolean isShutdown()
      Specified by:
      isShutdown in interface BackgroundResource
    • isTerminated

      public boolean isTerminated()
      Specified by:
      isTerminated in interface BackgroundResource
    • shutdownNow

      public void shutdownNow()
      Specified by:
      shutdownNow in interface BackgroundResource
    • awaitTermination

      public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
      Specified by:
      awaitTermination in interface BackgroundResource
      Throws:
      InterruptedException