Class ApiHubPluginClient (0.6.0)

GitHub RepositoryProduct Reference

Service Description: This service is used for managing plugins inside the API Hub.

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 (ApiHubPluginClient apiHubPluginClient = ApiHubPluginClient.create()) {
   PluginName name = PluginName.of("[PROJECT]", "[LOCATION]", "[PLUGIN]");
   Plugin response = apiHubPluginClient.getPlugin(name);
 }
 

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

GetPlugin

Get details about an API Hub plugin.

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

  • getPlugin(GetPluginRequest request)

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

  • getPlugin(PluginName name)

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

  • getPluginCallable()

EnablePlugin

Enables a plugin. The state of the plugin after enabling is ENABLED

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

  • enablePlugin(EnablePluginRequest request)

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

  • enablePlugin(PluginName name)

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

  • enablePluginCallable()

DisablePlugin

Disables a plugin. The state of the plugin after disabling is DISABLED

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

  • disablePlugin(DisablePluginRequest request)

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

  • disablePlugin(PluginName name)

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

  • disablePluginCallable()

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 ApiHubPluginSettings 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
 ApiHubPluginSettings apiHubPluginSettings =
     ApiHubPluginSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 ApiHubPluginClient apiHubPluginClient = ApiHubPluginClient.create(apiHubPluginSettings);
 

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
 ApiHubPluginSettings apiHubPluginSettings =
     ApiHubPluginSettings.newBuilder().setEndpoint(myEndpoint).build();
 ApiHubPluginClient apiHubPluginClient = ApiHubPluginClient.create(apiHubPluginSettings);
 

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

Inheritance

java.lang.Object > ApiHubPluginClient

Static Methods

create()

public static final ApiHubPluginClient create()

Constructs an instance of ApiHubPluginClient with default settings.

Returns
Type Description
ApiHubPluginClient
Exceptions
Type Description
IOException

create(ApiHubPluginSettings settings)

public static final ApiHubPluginClient create(ApiHubPluginSettings settings)

Constructs an instance of ApiHubPluginClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
Name Description
settings ApiHubPluginSettings
Returns
Type Description
ApiHubPluginClient
Exceptions
Type Description
IOException

create(ApiHubPluginStub stub)

public static final ApiHubPluginClient create(ApiHubPluginStub stub)

Constructs an instance of ApiHubPluginClient, using the given stub for making calls. This is for advanced usage - prefer using create(ApiHubPluginSettings).

Parameter
Name Description
stub ApiHubPluginStub
Returns
Type Description
ApiHubPluginClient

Constructors

ApiHubPluginClient(ApiHubPluginSettings settings)

protected ApiHubPluginClient(ApiHubPluginSettings settings)

Constructs an instance of ApiHubPluginClient, 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.

Parameter
Name Description
settings ApiHubPluginSettings

ApiHubPluginClient(ApiHubPluginStub stub)

protected ApiHubPluginClient(ApiHubPluginStub stub)
Parameter
Name Description
stub ApiHubPluginStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
Type Description
InterruptedException

close()

public final void close()

disablePlugin(DisablePluginRequest request)

public final Plugin disablePlugin(DisablePluginRequest request)

Disables a plugin. The state of the plugin after disabling is DISABLED

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 (ApiHubPluginClient apiHubPluginClient = ApiHubPluginClient.create()) {
   DisablePluginRequest request =
       DisablePluginRequest.newBuilder()
           .setName(PluginName.of("[PROJECT]", "[LOCATION]", "[PLUGIN]").toString())
           .build();
   Plugin response = apiHubPluginClient.disablePlugin(request);
 }
 
Parameter
Name Description
request DisablePluginRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Plugin

disablePlugin(PluginName name)

public final Plugin disablePlugin(PluginName name)

Disables a plugin. The state of the plugin after disabling is DISABLED

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 (ApiHubPluginClient apiHubPluginClient = ApiHubPluginClient.create()) {
   PluginName name = PluginName.of("[PROJECT]", "[LOCATION]", "[PLUGIN]");
   Plugin response = apiHubPluginClient.disablePlugin(name);
 }
 
Parameter
Name Description
name PluginName

Required. The name of the plugin to disable. Format: projects/{project}/locations/{location}/plugins/{plugin}.

Returns
Type Description
Plugin

disablePlugin(String name)

public final Plugin disablePlugin(String name)

Disables a plugin. The state of the plugin after disabling is DISABLED

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 (ApiHubPluginClient apiHubPluginClient = ApiHubPluginClient.create()) {
   String name = PluginName.of("[PROJECT]", "[LOCATION]", "[PLUGIN]").toString();
   Plugin response = apiHubPluginClient.disablePlugin(name);
 }
 
Parameter
Name Description
name String

Required. The name of the plugin to disable. Format: projects/{project}/locations/{location}/plugins/{plugin}.

Returns
Type Description
Plugin

disablePluginCallable()

public final UnaryCallable<DisablePluginRequest,Plugin> disablePluginCallable()

Disables a plugin. The state of the plugin after disabling is DISABLED

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 (ApiHubPluginClient apiHubPluginClient = ApiHubPluginClient.create()) {
   DisablePluginRequest request =
       DisablePluginRequest.newBuilder()
           .setName(PluginName.of("[PROJECT]", "[LOCATION]", "[PLUGIN]").toString())
           .build();
   ApiFuture<Plugin> future = apiHubPluginClient.disablePluginCallable().futureCall(request);
   // Do something.
   Plugin response = future.get();
 }
 
Returns
Type Description
UnaryCallable<DisablePluginRequest,Plugin>

enablePlugin(EnablePluginRequest request)

public final Plugin enablePlugin(EnablePluginRequest request)

Enables a plugin. The state of the plugin after enabling is ENABLED

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 (ApiHubPluginClient apiHubPluginClient = ApiHubPluginClient.create()) {
   EnablePluginRequest request =
       EnablePluginRequest.newBuilder()
           .setName(PluginName.of("[PROJECT]", "[LOCATION]", "[PLUGIN]").toString())
           .build();
   Plugin response = apiHubPluginClient.enablePlugin(request);
 }
 
Parameter
Name Description
request EnablePluginRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Plugin

enablePlugin(PluginName name)

public final Plugin enablePlugin(PluginName name)

Enables a plugin. The state of the plugin after enabling is ENABLED

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 (ApiHubPluginClient apiHubPluginClient = ApiHubPluginClient.create()) {
   PluginName name = PluginName.of("[PROJECT]", "[LOCATION]", "[PLUGIN]");
   Plugin response = apiHubPluginClient.enablePlugin(name);
 }
 
Parameter
Name Description
name PluginName

Required. The name of the plugin to enable. Format: projects/{project}/locations/{location}/plugins/{plugin}.

Returns
Type Description
Plugin

enablePlugin(String name)

public final Plugin enablePlugin(String name)

Enables a plugin. The state of the plugin after enabling is ENABLED

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 (ApiHubPluginClient apiHubPluginClient = ApiHubPluginClient.create()) {
   String name = PluginName.of("[PROJECT]", "[LOCATION]", "[PLUGIN]").toString();
   Plugin response = apiHubPluginClient.enablePlugin(name);
 }
 
Parameter
Name Description
name String

Required. The name of the plugin to enable. Format: projects/{project}/locations/{location}/plugins/{plugin}.

Returns
Type Description
Plugin

enablePluginCallable()

public final UnaryCallable<EnablePluginRequest,Plugin> enablePluginCallable()

Enables a plugin. The state of the plugin after enabling is ENABLED

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 (ApiHubPluginClient apiHubPluginClient = ApiHubPluginClient.create()) {
   EnablePluginRequest request =
       EnablePluginRequest.newBuilder()
           .setName(PluginName.of("[PROJECT]", "[LOCATION]", "[PLUGIN]").toString())
           .build();
   ApiFuture<Plugin> future = apiHubPluginClient.enablePluginCallable().futureCall(request);
   // Do something.
   Plugin response = future.get();
 }
 
Returns
Type Description
UnaryCallable<EnablePluginRequest,Plugin>

getLocation(GetLocationRequest request)

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 (ApiHubPluginClient apiHubPluginClient = ApiHubPluginClient.create()) {
   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
   Location response = apiHubPluginClient.getLocation(request);
 }
 
Parameter
Name Description
request com.google.cloud.location.GetLocationRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
com.google.cloud.location.Location

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 (ApiHubPluginClient apiHubPluginClient = ApiHubPluginClient.create()) {
   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
   ApiFuture<Location> future = apiHubPluginClient.getLocationCallable().futureCall(request);
   // Do something.
   Location response = future.get();
 }
 
Returns
Type Description
UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location>

getPlugin(GetPluginRequest request)

public final Plugin getPlugin(GetPluginRequest request)

Get details about an API Hub plugin.

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 (ApiHubPluginClient apiHubPluginClient = ApiHubPluginClient.create()) {
   GetPluginRequest request =
       GetPluginRequest.newBuilder()
           .setName(PluginName.of("[PROJECT]", "[LOCATION]", "[PLUGIN]").toString())
           .build();
   Plugin response = apiHubPluginClient.getPlugin(request);
 }
 
Parameter
Name Description
request GetPluginRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Plugin

getPlugin(PluginName name)

public final Plugin getPlugin(PluginName name)

Get details about an API Hub plugin.

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 (ApiHubPluginClient apiHubPluginClient = ApiHubPluginClient.create()) {
   PluginName name = PluginName.of("[PROJECT]", "[LOCATION]", "[PLUGIN]");
   Plugin response = apiHubPluginClient.getPlugin(name);
 }
 
Parameter
Name Description
name PluginName

Required. The name of the plugin to retrieve. Format: projects/{project}/locations/{location}/plugins/{plugin}.

Returns
Type Description
Plugin

getPlugin(String name)

public final Plugin getPlugin(String name)

Get details about an API Hub plugin.

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 (ApiHubPluginClient apiHubPluginClient = ApiHubPluginClient.create()) {
   String name = PluginName.of("[PROJECT]", "[LOCATION]", "[PLUGIN]").toString();
   Plugin response = apiHubPluginClient.getPlugin(name);
 }
 
Parameter
Name Description
name String

Required. The name of the plugin to retrieve. Format: projects/{project}/locations/{location}/plugins/{plugin}.

Returns
Type Description
Plugin

getPluginCallable()

public final UnaryCallable<GetPluginRequest,Plugin> getPluginCallable()

Get details about an API Hub plugin.

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 (ApiHubPluginClient apiHubPluginClient = ApiHubPluginClient.create()) {
   GetPluginRequest request =
       GetPluginRequest.newBuilder()
           .setName(PluginName.of("[PROJECT]", "[LOCATION]", "[PLUGIN]").toString())
           .build();
   ApiFuture<Plugin> future = apiHubPluginClient.getPluginCallable().futureCall(request);
   // Do something.
   Plugin response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetPluginRequest,Plugin>

getSettings()

public final ApiHubPluginSettings getSettings()
Returns
Type Description
ApiHubPluginSettings

getStub()

public ApiHubPluginStub getStub()
Returns
Type Description
ApiHubPluginStub

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listLocations(ListLocationsRequest request)

public final ApiHubPluginClient.ListLocationsPagedResponse listLocations(ListLocationsRequest request)

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 (ApiHubPluginClient apiHubPluginClient = ApiHubPluginClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (Location element : apiHubPluginClient.listLocations(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request com.google.cloud.location.ListLocationsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
ApiHubPluginClient.ListLocationsPagedResponse

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 (ApiHubPluginClient apiHubPluginClient = ApiHubPluginClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListLocationsResponse response = apiHubPluginClient.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;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse>

listLocationsPagedCallable()

public final UnaryCallable<ListLocationsRequest,ApiHubPluginClient.ListLocationsPagedResponse> 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 (ApiHubPluginClient apiHubPluginClient = ApiHubPluginClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<Location> future =
       apiHubPluginClient.listLocationsPagedCallable().futureCall(request);
   // Do something.
   for (Location element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<com.google.cloud.location.ListLocationsRequest,ListLocationsPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()