Class CloudApiRegistryClient (0.4.0)

GitHub RepositoryProduct Reference

Service Description: The Cloud API Registry service provides a central registry for managing API Data.

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 (CloudApiRegistryClient cloudApiRegistryClient = CloudApiRegistryClient.create()) {
   McpServerName name =
       McpServerName.ofProjectLocationMcpServerName("[PROJECT]", "[LOCATION]", "[MCP_SERVER]");
   McpServer response = cloudApiRegistryClient.getMcpServer(name);
 }
 

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

GetMcpServer

Gets a single McpServer.

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

  • getMcpServer(GetMcpServerRequest request)

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

  • getMcpServer(McpServerName name)

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

  • getMcpServerCallable()

ListMcpServers

Lists McpServers in a given Project.

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

  • listMcpServers(ListMcpServersRequest request)

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

  • listMcpServers(LocationName parent)

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

  • listMcpServersPagedCallable()

  • listMcpServersCallable()

GetMcpTool

Gets a single McpTool.

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

  • getMcpTool(GetMcpToolRequest request)

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

  • getMcpTool(McpToolName name)

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

  • getMcpToolCallable()

ListMcpTools

Lists McpTools in a given McpServer.

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

  • listMcpTools(ListMcpToolsRequest request)

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

  • listMcpTools(McpServerName parent)

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

  • listMcpToolsPagedCallable()

  • listMcpToolsCallable()

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 CloudApiRegistrySettings 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
 CloudApiRegistrySettings cloudApiRegistrySettings =
     CloudApiRegistrySettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 CloudApiRegistryClient cloudApiRegistryClient =
     CloudApiRegistryClient.create(cloudApiRegistrySettings);
 

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
 CloudApiRegistrySettings cloudApiRegistrySettings =
     CloudApiRegistrySettings.newBuilder().setEndpoint(myEndpoint).build();
 CloudApiRegistryClient cloudApiRegistryClient =
     CloudApiRegistryClient.create(cloudApiRegistrySettings);
 

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:


 // 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
 CloudApiRegistrySettings cloudApiRegistrySettings =
     CloudApiRegistrySettings.newHttpJsonBuilder().build();
 CloudApiRegistryClient cloudApiRegistryClient =
     CloudApiRegistryClient.create(cloudApiRegistrySettings);
 

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

Inheritance

java.lang.Object > CloudApiRegistryClient

Static Methods

create()

public static final CloudApiRegistryClient create()

Constructs an instance of CloudApiRegistryClient with default settings.

Returns
Type Description
CloudApiRegistryClient
Exceptions
Type Description
IOException

create(CloudApiRegistrySettings settings)

public static final CloudApiRegistryClient create(CloudApiRegistrySettings settings)

Constructs an instance of CloudApiRegistryClient, 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 CloudApiRegistrySettings
Returns
Type Description
CloudApiRegistryClient
Exceptions
Type Description
IOException

create(CloudApiRegistryStub stub)

public static final CloudApiRegistryClient create(CloudApiRegistryStub stub)

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

Parameter
Name Description
stub CloudApiRegistryStub
Returns
Type Description
CloudApiRegistryClient

Constructors

CloudApiRegistryClient(CloudApiRegistrySettings settings)

protected CloudApiRegistryClient(CloudApiRegistrySettings settings)

Constructs an instance of CloudApiRegistryClient, 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 CloudApiRegistrySettings

CloudApiRegistryClient(CloudApiRegistryStub stub)

protected CloudApiRegistryClient(CloudApiRegistryStub stub)
Parameter
Name Description
stub CloudApiRegistryStub

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()

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

getMcpServer(GetMcpServerRequest request)

public final McpServer getMcpServer(GetMcpServerRequest request)

Gets a single McpServer.

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 (CloudApiRegistryClient cloudApiRegistryClient = CloudApiRegistryClient.create()) {
   GetMcpServerRequest request =
       GetMcpServerRequest.newBuilder()
           .setName(
               McpServerName.ofProjectLocationMcpServerName(
                       "[PROJECT]", "[LOCATION]", "[MCP_SERVER]")
                   .toString())
           .build();
   McpServer response = cloudApiRegistryClient.getMcpServer(request);
 }
 
Parameter
Name Description
request GetMcpServerRequest

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

Returns
Type Description
McpServer

getMcpServer(McpServerName name)

public final McpServer getMcpServer(McpServerName name)

Gets a single McpServer.

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 (CloudApiRegistryClient cloudApiRegistryClient = CloudApiRegistryClient.create()) {
   McpServerName name =
       McpServerName.ofProjectLocationMcpServerName("[PROJECT]", "[LOCATION]", "[MCP_SERVER]");
   McpServer response = cloudApiRegistryClient.getMcpServer(name);
 }
 
Parameter
Name Description
name McpServerName

Required. Name of the resource

Returns
Type Description
McpServer

getMcpServer(String name)

public final McpServer getMcpServer(String name)

Gets a single McpServer.

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 (CloudApiRegistryClient cloudApiRegistryClient = CloudApiRegistryClient.create()) {
   String name =
       McpServerName.ofProjectLocationApiNamespaceMcpServerName(
               "[PROJECT]", "[LOCATION]", "[API_NAMESPACE]", "[MCP_SERVER]")
           .toString();
   McpServer response = cloudApiRegistryClient.getMcpServer(name);
 }
 
Parameter
Name Description
name String

Required. Name of the resource

Returns
Type Description
McpServer

getMcpServerCallable()

public final UnaryCallable<GetMcpServerRequest,McpServer> getMcpServerCallable()

Gets a single McpServer.

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 (CloudApiRegistryClient cloudApiRegistryClient = CloudApiRegistryClient.create()) {
   GetMcpServerRequest request =
       GetMcpServerRequest.newBuilder()
           .setName(
               McpServerName.ofProjectLocationMcpServerName(
                       "[PROJECT]", "[LOCATION]", "[MCP_SERVER]")
                   .toString())
           .build();
   ApiFuture<McpServer> future =
       cloudApiRegistryClient.getMcpServerCallable().futureCall(request);
   // Do something.
   McpServer response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetMcpServerRequest,McpServer>

getMcpTool(GetMcpToolRequest request)

public final McpTool getMcpTool(GetMcpToolRequest request)

Gets a single McpTool.

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 (CloudApiRegistryClient cloudApiRegistryClient = CloudApiRegistryClient.create()) {
   GetMcpToolRequest request =
       GetMcpToolRequest.newBuilder()
           .setName(
               McpToolName.ofProjectLocationMcpServerMcpToolName(
                       "[PROJECT]", "[LOCATION]", "[MCP_SERVER]", "[MCP_TOOL]")
                   .toString())
           .build();
   McpTool response = cloudApiRegistryClient.getMcpTool(request);
 }
 
Parameter
Name Description
request GetMcpToolRequest

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

Returns
Type Description
McpTool

getMcpTool(McpToolName name)

public final McpTool getMcpTool(McpToolName name)

Gets a single McpTool.

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 (CloudApiRegistryClient cloudApiRegistryClient = CloudApiRegistryClient.create()) {
   McpToolName name =
       McpToolName.ofProjectLocationMcpServerMcpToolName(
           "[PROJECT]", "[LOCATION]", "[MCP_SERVER]", "[MCP_TOOL]");
   McpTool response = cloudApiRegistryClient.getMcpTool(name);
 }
 
Parameter
Name Description
name McpToolName

Required. Name of the resource

Returns
Type Description
McpTool

getMcpTool(String name)

public final McpTool getMcpTool(String name)

Gets a single McpTool.

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 (CloudApiRegistryClient cloudApiRegistryClient = CloudApiRegistryClient.create()) {
   String name =
       McpToolName.ofProjectLocationApiNamespaceMcpServerMcpToolName(
               "[PROJECT]", "[LOCATION]", "[API_NAMESPACE]", "[MCP_SERVER]", "[MCP_TOOL]")
           .toString();
   McpTool response = cloudApiRegistryClient.getMcpTool(name);
 }
 
Parameter
Name Description
name String

Required. Name of the resource

Returns
Type Description
McpTool

getMcpToolCallable()

public final UnaryCallable<GetMcpToolRequest,McpTool> getMcpToolCallable()

Gets a single McpTool.

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 (CloudApiRegistryClient cloudApiRegistryClient = CloudApiRegistryClient.create()) {
   GetMcpToolRequest request =
       GetMcpToolRequest.newBuilder()
           .setName(
               McpToolName.ofProjectLocationMcpServerMcpToolName(
                       "[PROJECT]", "[LOCATION]", "[MCP_SERVER]", "[MCP_TOOL]")
                   .toString())
           .build();
   ApiFuture<McpTool> future = cloudApiRegistryClient.getMcpToolCallable().futureCall(request);
   // Do something.
   McpTool response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetMcpToolRequest,McpTool>

getSettings()

public final CloudApiRegistrySettings getSettings()
Returns
Type Description
CloudApiRegistrySettings

getStub()

public CloudApiRegistryStub getStub()
Returns
Type Description
CloudApiRegistryStub

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listLocations(ListLocationsRequest request)

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

listMcpServers(ListMcpServersRequest request)

public final CloudApiRegistryClient.ListMcpServersPagedResponse listMcpServers(ListMcpServersRequest request)

Lists McpServers in a given Project.

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 (CloudApiRegistryClient cloudApiRegistryClient = CloudApiRegistryClient.create()) {
   ListMcpServersRequest request =
       ListMcpServersRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .build();
   for (McpServer element : cloudApiRegistryClient.listMcpServers(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListMcpServersRequest

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

Returns
Type Description
CloudApiRegistryClient.ListMcpServersPagedResponse

listMcpServers(LocationName parent)

public final CloudApiRegistryClient.ListMcpServersPagedResponse listMcpServers(LocationName parent)

Lists McpServers in a given Project.

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 (CloudApiRegistryClient cloudApiRegistryClient = CloudApiRegistryClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   for (McpServer element : cloudApiRegistryClient.listMcpServers(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent LocationName

Required. Parent value for ListMcpServersRequest

Returns
Type Description
CloudApiRegistryClient.ListMcpServersPagedResponse

listMcpServers(String parent)

public final CloudApiRegistryClient.ListMcpServersPagedResponse listMcpServers(String parent)

Lists McpServers in a given Project.

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 (CloudApiRegistryClient cloudApiRegistryClient = CloudApiRegistryClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   for (McpServer element : cloudApiRegistryClient.listMcpServers(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

Required. Parent value for ListMcpServersRequest

Returns
Type Description
CloudApiRegistryClient.ListMcpServersPagedResponse

listMcpServersCallable()

public final UnaryCallable<ListMcpServersRequest,ListMcpServersResponse> listMcpServersCallable()

Lists McpServers in a given Project.

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 (CloudApiRegistryClient cloudApiRegistryClient = CloudApiRegistryClient.create()) {
   ListMcpServersRequest request =
       ListMcpServersRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .build();
   while (true) {
     ListMcpServersResponse response =
         cloudApiRegistryClient.listMcpServersCallable().call(request);
     for (McpServer element : response.getMcpServersList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListMcpServersRequest,ListMcpServersResponse>

listMcpServersPagedCallable()

public final UnaryCallable<ListMcpServersRequest,CloudApiRegistryClient.ListMcpServersPagedResponse> listMcpServersPagedCallable()

Lists McpServers in a given Project.

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 (CloudApiRegistryClient cloudApiRegistryClient = CloudApiRegistryClient.create()) {
   ListMcpServersRequest request =
       ListMcpServersRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .build();
   ApiFuture<McpServer> future =
       cloudApiRegistryClient.listMcpServersPagedCallable().futureCall(request);
   // Do something.
   for (McpServer element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListMcpServersRequest,ListMcpServersPagedResponse>

listMcpTools(ListMcpToolsRequest request)

public final CloudApiRegistryClient.ListMcpToolsPagedResponse listMcpTools(ListMcpToolsRequest request)

Lists McpTools in a given McpServer.

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 (CloudApiRegistryClient cloudApiRegistryClient = CloudApiRegistryClient.create()) {
   ListMcpToolsRequest request =
       ListMcpToolsRequest.newBuilder()
           .setParent(
               McpServerName.ofProjectLocationMcpServerName(
                       "[PROJECT]", "[LOCATION]", "[MCP_SERVER]")
                   .toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .build();
   for (McpTool element : cloudApiRegistryClient.listMcpTools(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListMcpToolsRequest

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

Returns
Type Description
CloudApiRegistryClient.ListMcpToolsPagedResponse

listMcpTools(McpServerName parent)

public final CloudApiRegistryClient.ListMcpToolsPagedResponse listMcpTools(McpServerName parent)

Lists McpTools in a given McpServer.

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 (CloudApiRegistryClient cloudApiRegistryClient = CloudApiRegistryClient.create()) {
   McpServerName parent =
       McpServerName.ofProjectLocationMcpServerName("[PROJECT]", "[LOCATION]", "[MCP_SERVER]");
   for (McpTool element : cloudApiRegistryClient.listMcpTools(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent McpServerName

Required. Parent value for ListMcpToolsRequest

Returns
Type Description
CloudApiRegistryClient.ListMcpToolsPagedResponse

listMcpTools(String parent)

public final CloudApiRegistryClient.ListMcpToolsPagedResponse listMcpTools(String parent)

Lists McpTools in a given McpServer.

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 (CloudApiRegistryClient cloudApiRegistryClient = CloudApiRegistryClient.create()) {
   String parent =
       McpServerName.ofProjectLocationApiNamespaceMcpServerName(
               "[PROJECT]", "[LOCATION]", "[API_NAMESPACE]", "[MCP_SERVER]")
           .toString();
   for (McpTool element : cloudApiRegistryClient.listMcpTools(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

Required. Parent value for ListMcpToolsRequest

Returns
Type Description
CloudApiRegistryClient.ListMcpToolsPagedResponse

listMcpToolsCallable()

public final UnaryCallable<ListMcpToolsRequest,ListMcpToolsResponse> listMcpToolsCallable()

Lists McpTools in a given McpServer.

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 (CloudApiRegistryClient cloudApiRegistryClient = CloudApiRegistryClient.create()) {
   ListMcpToolsRequest request =
       ListMcpToolsRequest.newBuilder()
           .setParent(
               McpServerName.ofProjectLocationMcpServerName(
                       "[PROJECT]", "[LOCATION]", "[MCP_SERVER]")
                   .toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .build();
   while (true) {
     ListMcpToolsResponse response = cloudApiRegistryClient.listMcpToolsCallable().call(request);
     for (McpTool element : response.getMcpToolsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListMcpToolsRequest,ListMcpToolsResponse>

listMcpToolsPagedCallable()

public final UnaryCallable<ListMcpToolsRequest,CloudApiRegistryClient.ListMcpToolsPagedResponse> listMcpToolsPagedCallable()

Lists McpTools in a given McpServer.

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 (CloudApiRegistryClient cloudApiRegistryClient = CloudApiRegistryClient.create()) {
   ListMcpToolsRequest request =
       ListMcpToolsRequest.newBuilder()
           .setParent(
               McpServerName.ofProjectLocationMcpServerName(
                       "[PROJECT]", "[LOCATION]", "[MCP_SERVER]")
                   .toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .build();
   ApiFuture<McpTool> future =
       cloudApiRegistryClient.listMcpToolsPagedCallable().futureCall(request);
   // Do something.
   for (McpTool element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListMcpToolsRequest,ListMcpToolsPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()