Class ApiHubDiscoveryClient

java.lang.Object
com.google.cloud.apihub.v1.ApiHubDiscoveryClient
All Implemented Interfaces:
BackgroundResource, AutoCloseable

@Generated("by gapic-generator-java") public class ApiHubDiscoveryClient extends Object implements BackgroundResource
Service Description: This service exposes methods used to manage DiscoveredApiObservations and DiscoveredApiOperations.

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 (ApiHubDiscoveryClient apiHubDiscoveryClient = ApiHubDiscoveryClient.create()) {
   DiscoveredApiObservationName name =
       DiscoveredApiObservationName.of(
           "[PROJECT]", "[LOCATION]", "[DISCOVERED_API_OBSERVATION]");
   DiscoveredApiObservation response = apiHubDiscoveryClient.getDiscoveredApiObservation(name);
 }
 

Note: close() needs to be called on the ApiHubDiscoveryClient 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

ListDiscoveredApiObservations

Lists all the DiscoveredAPIObservations in a given project and location.

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

  • listDiscoveredApiObservations(ListDiscoveredApiObservationsRequest request)

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

  • listDiscoveredApiObservations(LocationName parent)

  • listDiscoveredApiObservations(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.

  • listDiscoveredApiObservationsPagedCallable()

  • listDiscoveredApiObservationsCallable()

GetDiscoveredApiObservation

Gets a DiscoveredAPIObservation in a given project, location and ApiObservation.

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

  • getDiscoveredApiObservation(GetDiscoveredApiObservationRequest request)

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

  • getDiscoveredApiObservation(DiscoveredApiObservationName name)

  • getDiscoveredApiObservation(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.

  • getDiscoveredApiObservationCallable()

ListDiscoveredApiOperations

Lists all the DiscoveredAPIOperations in a given project, location and ApiObservation.

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

  • listDiscoveredApiOperations(ListDiscoveredApiOperationsRequest request)

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

  • listDiscoveredApiOperations(DiscoveredApiObservationName parent)

  • listDiscoveredApiOperations(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.

  • listDiscoveredApiOperationsPagedCallable()

  • listDiscoveredApiOperationsCallable()

GetDiscoveredApiOperation

Gets a DiscoveredAPIOperation in a given project, location, ApiObservation and ApiOperation.

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

  • getDiscoveredApiOperation(GetDiscoveredApiOperationRequest request)

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

  • getDiscoveredApiOperation(DiscoveredApiOperationName name)

  • getDiscoveredApiOperation(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.

  • getDiscoveredApiOperationCallable()

ListLocations

Lists information about the supported locations for this service.

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

  • listLocations(ListLocationsRequest request)

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

  • listLocationsPagedCallable()

  • listLocationsCallable()

GetLocation

Gets information about a location.

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

  • getLocation(GetLocationRequest request)

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

  • getLocationCallable()

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 ApiHubDiscoverySettings 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
 ApiHubDiscoverySettings apiHubDiscoverySettings =
     ApiHubDiscoverySettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 ApiHubDiscoveryClient apiHubDiscoveryClient =
     ApiHubDiscoveryClient.create(apiHubDiscoverySettings);
 

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
 ApiHubDiscoverySettings apiHubDiscoverySettings =
     ApiHubDiscoverySettings.newBuilder().setEndpoint(myEndpoint).build();
 ApiHubDiscoveryClient apiHubDiscoveryClient =
     ApiHubDiscoveryClient.create(apiHubDiscoverySettings);
 

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

  • Constructor Details

    • ApiHubDiscoveryClient

      protected ApiHubDiscoveryClient(ApiHubDiscoverySettings settings) throws IOException
      Constructs an instance of ApiHubDiscoveryClient, 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
    • ApiHubDiscoveryClient

      protected ApiHubDiscoveryClient(ApiHubDiscoveryStub stub)
  • Method Details

    • create

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

      public static final ApiHubDiscoveryClient create(ApiHubDiscoverySettings settings) throws IOException
      Constructs an instance of ApiHubDiscoveryClient, 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 ApiHubDiscoveryClient create(ApiHubDiscoveryStub stub)
      Constructs an instance of ApiHubDiscoveryClient, using the given stub for making calls. This is for advanced usage - prefer using create(ApiHubDiscoverySettings).
    • getSettings

      public final ApiHubDiscoverySettings getSettings()
    • getStub

      public ApiHubDiscoveryStub getStub()
    • listDiscoveredApiObservations

      public final ApiHubDiscoveryClient.ListDiscoveredApiObservationsPagedResponse listDiscoveredApiObservations(LocationName parent)
      Lists all the DiscoveredAPIObservations in a given project and location.

      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 (ApiHubDiscoveryClient apiHubDiscoveryClient = ApiHubDiscoveryClient.create()) {
         LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
         for (DiscoveredApiObservation element :
             apiHubDiscoveryClient.listDiscoveredApiObservations(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent, which owns this collection of ApiObservations. Format: projects/{project}/locations/{location}
      Throws:
      ApiException - if the remote call fails
    • listDiscoveredApiObservations

      public final ApiHubDiscoveryClient.ListDiscoveredApiObservationsPagedResponse listDiscoveredApiObservations(String parent)
      Lists all the DiscoveredAPIObservations in a given project and location.

      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 (ApiHubDiscoveryClient apiHubDiscoveryClient = ApiHubDiscoveryClient.create()) {
         String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
         for (DiscoveredApiObservation element :
             apiHubDiscoveryClient.listDiscoveredApiObservations(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent, which owns this collection of ApiObservations. Format: projects/{project}/locations/{location}
      Throws:
      ApiException - if the remote call fails
    • listDiscoveredApiObservations

      Lists all the DiscoveredAPIObservations in a given project and location.

      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 (ApiHubDiscoveryClient apiHubDiscoveryClient = ApiHubDiscoveryClient.create()) {
         ListDiscoveredApiObservationsRequest request =
             ListDiscoveredApiObservationsRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (DiscoveredApiObservation element :
             apiHubDiscoveryClient.listDiscoveredApiObservations(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
    • listDiscoveredApiObservationsPagedCallable

      Lists all the DiscoveredAPIObservations in a given project and location.

      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 (ApiHubDiscoveryClient apiHubDiscoveryClient = ApiHubDiscoveryClient.create()) {
         ListDiscoveredApiObservationsRequest request =
             ListDiscoveredApiObservationsRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<DiscoveredApiObservation> future =
             apiHubDiscoveryClient.listDiscoveredApiObservationsPagedCallable().futureCall(request);
         // Do something.
         for (DiscoveredApiObservation element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listDiscoveredApiObservationsCallable

      public final UnaryCallable<ListDiscoveredApiObservationsRequest,ListDiscoveredApiObservationsResponse> listDiscoveredApiObservationsCallable()
      Lists all the DiscoveredAPIObservations in a given project and location.

      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 (ApiHubDiscoveryClient apiHubDiscoveryClient = ApiHubDiscoveryClient.create()) {
         ListDiscoveredApiObservationsRequest request =
             ListDiscoveredApiObservationsRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           ListDiscoveredApiObservationsResponse response =
               apiHubDiscoveryClient.listDiscoveredApiObservationsCallable().call(request);
           for (DiscoveredApiObservation element : response.getDiscoveredApiObservationsList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • getDiscoveredApiObservation

      public final DiscoveredApiObservation getDiscoveredApiObservation(DiscoveredApiObservationName name)
      Gets a DiscoveredAPIObservation in a given project, location and ApiObservation.

      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 (ApiHubDiscoveryClient apiHubDiscoveryClient = ApiHubDiscoveryClient.create()) {
         DiscoveredApiObservationName name =
             DiscoveredApiObservationName.of(
                 "[PROJECT]", "[LOCATION]", "[DISCOVERED_API_OBSERVATION]");
         DiscoveredApiObservation response = apiHubDiscoveryClient.getDiscoveredApiObservation(name);
       }
       
      Parameters:
      name - Required. The name of the DiscoveredApiObservation to retrieve. Format: projects/{project}/locations/{location}/discoveredApiObservations/{discovered_api_observation}
      Throws:
      ApiException - if the remote call fails
    • getDiscoveredApiObservation

      public final DiscoveredApiObservation getDiscoveredApiObservation(String name)
      Gets a DiscoveredAPIObservation in a given project, location and ApiObservation.

      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 (ApiHubDiscoveryClient apiHubDiscoveryClient = ApiHubDiscoveryClient.create()) {
         String name =
             DiscoveredApiObservationName.of("[PROJECT]", "[LOCATION]", "[DISCOVERED_API_OBSERVATION]")
                 .toString();
         DiscoveredApiObservation response = apiHubDiscoveryClient.getDiscoveredApiObservation(name);
       }
       
      Parameters:
      name - Required. The name of the DiscoveredApiObservation to retrieve. Format: projects/{project}/locations/{location}/discoveredApiObservations/{discovered_api_observation}
      Throws:
      ApiException - if the remote call fails
    • getDiscoveredApiObservation

      public final DiscoveredApiObservation getDiscoveredApiObservation(GetDiscoveredApiObservationRequest request)
      Gets a DiscoveredAPIObservation in a given project, location and ApiObservation.

      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 (ApiHubDiscoveryClient apiHubDiscoveryClient = ApiHubDiscoveryClient.create()) {
         GetDiscoveredApiObservationRequest request =
             GetDiscoveredApiObservationRequest.newBuilder()
                 .setName(
                     DiscoveredApiObservationName.of(
                             "[PROJECT]", "[LOCATION]", "[DISCOVERED_API_OBSERVATION]")
                         .toString())
                 .build();
         DiscoveredApiObservation response =
             apiHubDiscoveryClient.getDiscoveredApiObservation(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getDiscoveredApiObservationCallable

      public final UnaryCallable<GetDiscoveredApiObservationRequest,DiscoveredApiObservation> getDiscoveredApiObservationCallable()
      Gets a DiscoveredAPIObservation in a given project, location and ApiObservation.

      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 (ApiHubDiscoveryClient apiHubDiscoveryClient = ApiHubDiscoveryClient.create()) {
         GetDiscoveredApiObservationRequest request =
             GetDiscoveredApiObservationRequest.newBuilder()
                 .setName(
                     DiscoveredApiObservationName.of(
                             "[PROJECT]", "[LOCATION]", "[DISCOVERED_API_OBSERVATION]")
                         .toString())
                 .build();
         ApiFuture<DiscoveredApiObservation> future =
             apiHubDiscoveryClient.getDiscoveredApiObservationCallable().futureCall(request);
         // Do something.
         DiscoveredApiObservation response = future.get();
       }
       
    • listDiscoveredApiOperations

      Lists all the DiscoveredAPIOperations in a given project, location and ApiObservation.

      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 (ApiHubDiscoveryClient apiHubDiscoveryClient = ApiHubDiscoveryClient.create()) {
         DiscoveredApiObservationName parent =
             DiscoveredApiObservationName.of(
                 "[PROJECT]", "[LOCATION]", "[DISCOVERED_API_OBSERVATION]");
         for (DiscoveredApiOperation element :
             apiHubDiscoveryClient.listDiscoveredApiOperations(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent, which owns this collection of DiscoveredApiOperations. Format: projects/{project}/locations/{location}/discoveredApiObservations/{discovered_api_observation}
      Throws:
      ApiException - if the remote call fails
    • listDiscoveredApiOperations

      public final ApiHubDiscoveryClient.ListDiscoveredApiOperationsPagedResponse listDiscoveredApiOperations(String parent)
      Lists all the DiscoveredAPIOperations in a given project, location and ApiObservation.

      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 (ApiHubDiscoveryClient apiHubDiscoveryClient = ApiHubDiscoveryClient.create()) {
         String parent =
             DiscoveredApiObservationName.of("[PROJECT]", "[LOCATION]", "[DISCOVERED_API_OBSERVATION]")
                 .toString();
         for (DiscoveredApiOperation element :
             apiHubDiscoveryClient.listDiscoveredApiOperations(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent, which owns this collection of DiscoveredApiOperations. Format: projects/{project}/locations/{location}/discoveredApiObservations/{discovered_api_observation}
      Throws:
      ApiException - if the remote call fails
    • listDiscoveredApiOperations

      Lists all the DiscoveredAPIOperations in a given project, location and ApiObservation.

      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 (ApiHubDiscoveryClient apiHubDiscoveryClient = ApiHubDiscoveryClient.create()) {
         ListDiscoveredApiOperationsRequest request =
             ListDiscoveredApiOperationsRequest.newBuilder()
                 .setParent(
                     DiscoveredApiObservationName.of(
                             "[PROJECT]", "[LOCATION]", "[DISCOVERED_API_OBSERVATION]")
                         .toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (DiscoveredApiOperation element :
             apiHubDiscoveryClient.listDiscoveredApiOperations(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
    • listDiscoveredApiOperationsPagedCallable

      Lists all the DiscoveredAPIOperations in a given project, location and ApiObservation.

      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 (ApiHubDiscoveryClient apiHubDiscoveryClient = ApiHubDiscoveryClient.create()) {
         ListDiscoveredApiOperationsRequest request =
             ListDiscoveredApiOperationsRequest.newBuilder()
                 .setParent(
                     DiscoveredApiObservationName.of(
                             "[PROJECT]", "[LOCATION]", "[DISCOVERED_API_OBSERVATION]")
                         .toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<DiscoveredApiOperation> future =
             apiHubDiscoveryClient.listDiscoveredApiOperationsPagedCallable().futureCall(request);
         // Do something.
         for (DiscoveredApiOperation element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listDiscoveredApiOperationsCallable

      public final UnaryCallable<ListDiscoveredApiOperationsRequest,ListDiscoveredApiOperationsResponse> listDiscoveredApiOperationsCallable()
      Lists all the DiscoveredAPIOperations in a given project, location and ApiObservation.

      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 (ApiHubDiscoveryClient apiHubDiscoveryClient = ApiHubDiscoveryClient.create()) {
         ListDiscoveredApiOperationsRequest request =
             ListDiscoveredApiOperationsRequest.newBuilder()
                 .setParent(
                     DiscoveredApiObservationName.of(
                             "[PROJECT]", "[LOCATION]", "[DISCOVERED_API_OBSERVATION]")
                         .toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           ListDiscoveredApiOperationsResponse response =
               apiHubDiscoveryClient.listDiscoveredApiOperationsCallable().call(request);
           for (DiscoveredApiOperation element : response.getDiscoveredApiOperationsList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • getDiscoveredApiOperation

      public final DiscoveredApiOperation getDiscoveredApiOperation(DiscoveredApiOperationName name)
      Gets a DiscoveredAPIOperation in a given project, location, ApiObservation and ApiOperation.

      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 (ApiHubDiscoveryClient apiHubDiscoveryClient = ApiHubDiscoveryClient.create()) {
         DiscoveredApiOperationName name =
             DiscoveredApiOperationName.of(
                 "[PROJECT]",
                 "[LOCATION]",
                 "[DISCOVERED_API_OBSERVATION]",
                 "[DISCOVERED_API_OPERATION]");
         DiscoveredApiOperation response = apiHubDiscoveryClient.getDiscoveredApiOperation(name);
       }
       
      Parameters:
      name - Required. The name of the DiscoveredApiOperation to retrieve. Format: projects/{project}/locations/{location}/discoveredApiObservations/{discovered_api_observation}/discoveredApiOperations/{discovered_api_operation}
      Throws:
      ApiException - if the remote call fails
    • getDiscoveredApiOperation

      public final DiscoveredApiOperation getDiscoveredApiOperation(String name)
      Gets a DiscoveredAPIOperation in a given project, location, ApiObservation and ApiOperation.

      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 (ApiHubDiscoveryClient apiHubDiscoveryClient = ApiHubDiscoveryClient.create()) {
         String name =
             DiscoveredApiOperationName.of(
                     "[PROJECT]",
                     "[LOCATION]",
                     "[DISCOVERED_API_OBSERVATION]",
                     "[DISCOVERED_API_OPERATION]")
                 .toString();
         DiscoveredApiOperation response = apiHubDiscoveryClient.getDiscoveredApiOperation(name);
       }
       
      Parameters:
      name - Required. The name of the DiscoveredApiOperation to retrieve. Format: projects/{project}/locations/{location}/discoveredApiObservations/{discovered_api_observation}/discoveredApiOperations/{discovered_api_operation}
      Throws:
      ApiException - if the remote call fails
    • getDiscoveredApiOperation

      public final DiscoveredApiOperation getDiscoveredApiOperation(GetDiscoveredApiOperationRequest request)
      Gets a DiscoveredAPIOperation in a given project, location, ApiObservation and ApiOperation.

      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 (ApiHubDiscoveryClient apiHubDiscoveryClient = ApiHubDiscoveryClient.create()) {
         GetDiscoveredApiOperationRequest request =
             GetDiscoveredApiOperationRequest.newBuilder()
                 .setName(
                     DiscoveredApiOperationName.of(
                             "[PROJECT]",
                             "[LOCATION]",
                             "[DISCOVERED_API_OBSERVATION]",
                             "[DISCOVERED_API_OPERATION]")
                         .toString())
                 .build();
         DiscoveredApiOperation response = apiHubDiscoveryClient.getDiscoveredApiOperation(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getDiscoveredApiOperationCallable

      public final UnaryCallable<GetDiscoveredApiOperationRequest,DiscoveredApiOperation> getDiscoveredApiOperationCallable()
      Gets a DiscoveredAPIOperation in a given project, location, ApiObservation and ApiOperation.

      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 (ApiHubDiscoveryClient apiHubDiscoveryClient = ApiHubDiscoveryClient.create()) {
         GetDiscoveredApiOperationRequest request =
             GetDiscoveredApiOperationRequest.newBuilder()
                 .setName(
                     DiscoveredApiOperationName.of(
                             "[PROJECT]",
                             "[LOCATION]",
                             "[DISCOVERED_API_OBSERVATION]",
                             "[DISCOVERED_API_OPERATION]")
                         .toString())
                 .build();
         ApiFuture<DiscoveredApiOperation> future =
             apiHubDiscoveryClient.getDiscoveredApiOperationCallable().futureCall(request);
         // Do something.
         DiscoveredApiOperation response = future.get();
       }
       
    • listLocations

      Lists information about the supported locations for this service.

      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 (ApiHubDiscoveryClient apiHubDiscoveryClient = ApiHubDiscoveryClient.create()) {
         ListLocationsRequest request =
             ListLocationsRequest.newBuilder()
                 .setName("name3373707")
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (Location element : apiHubDiscoveryClient.listLocations(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
    • listLocationsPagedCallable

      Lists information about the supported locations for this service.

      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 (ApiHubDiscoveryClient apiHubDiscoveryClient = ApiHubDiscoveryClient.create()) {
         ListLocationsRequest request =
             ListLocationsRequest.newBuilder()
                 .setName("name3373707")
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<Location> future =
             apiHubDiscoveryClient.listLocationsPagedCallable().futureCall(request);
         // Do something.
         for (Location element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listLocationsCallable

      public final UnaryCallable<ListLocationsRequest,ListLocationsResponse> listLocationsCallable()
      Lists information about the supported locations for this service.

      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 (ApiHubDiscoveryClient apiHubDiscoveryClient = ApiHubDiscoveryClient.create()) {
         ListLocationsRequest request =
             ListLocationsRequest.newBuilder()
                 .setName("name3373707")
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           ListLocationsResponse response =
               apiHubDiscoveryClient.listLocationsCallable().call(request);
           for (Location element : response.getLocationsList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • getLocation

      public final Location getLocation(GetLocationRequest request)
      Gets information about a location.

      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 (ApiHubDiscoveryClient apiHubDiscoveryClient = ApiHubDiscoveryClient.create()) {
         GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
         Location response = apiHubDiscoveryClient.getLocation(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getLocationCallable

      public final UnaryCallable<GetLocationRequest,Location> getLocationCallable()
      Gets information about a location.

      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 (ApiHubDiscoveryClient apiHubDiscoveryClient = ApiHubDiscoveryClient.create()) {
         GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
         ApiFuture<Location> future = apiHubDiscoveryClient.getLocationCallable().futureCall(request);
         // Do something.
         Location response = future.get();
       }
       
    • 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