Package agentregistry is an auto-generated package for the Agent Registry API.
Agent Registry is a centralized, unified catalog that lets you store, discover, and govern Model Context Protocol (MCP) servers, tools, and AI agents within Google Cloud.
NOTE: This package is in beta. It is not stable, and may be subject to changes.
General documentation
For information that is relevant for all client libraries please reference https://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on this page includes:
- Authentication and Authorization
- Timeouts and Cancellation
- Testing against Client Libraries
- Debugging Client Libraries
- Inspecting errors
Example usage
To get started with this package, create a client.
// go get cloud.google.com/go/agentregistry/apiv1@latest ctx := context.Background() // 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := agentregistry.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close()
The client will use your default application credentials. Clients should be reused instead of created as needed. The methods of Client are safe for concurrent use by multiple goroutines. The returned client must be Closed when it is done being used.
Using the Client
The following is an example of making an API call with the newly created client, mentioned above.
req := &agentregistrypb.CreateBindingRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/agentregistry/apiv1/agentregistrypb#CreateBindingRequest. } op, err := c.CreateBinding(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Use of Context
The ctx passed to NewClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.
To close the open connection, use the Close() method.
Functions
func DefaultAuthScopes
func DefaultAuthScopes() []stringDefaultAuthScopes reports the default set of authentication scopes to use with this package.
AgentIterator
type AgentIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch func(pageSize int, pageToken string) (results []*agentregistrypb.Agent, nextPageToken string, err error)
// contains filtered or unexported fields
}AgentIterator manages a stream of *agentregistrypb.Agent.
func (*AgentIterator) All
func (it *AgentIterator) All() iter.Seq2[*agentregistrypb.Agent, error]All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*AgentIterator) Next
func (it *AgentIterator) Next() (*agentregistrypb.Agent, error)Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*AgentIterator) PageInfo
func (it *AgentIterator) PageInfo() *iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
BindingIterator
type BindingIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch func(pageSize int, pageToken string) (results []*agentregistrypb.Binding, nextPageToken string, err error)
// contains filtered or unexported fields
}BindingIterator manages a stream of *agentregistrypb.Binding.
func (*BindingIterator) All
func (it *BindingIterator) All() iter.Seq2[*agentregistrypb.Binding, error]All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*BindingIterator) Next
func (it *BindingIterator) Next() (*agentregistrypb.Binding, error)Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*BindingIterator) PageInfo
func (it *BindingIterator) PageInfo() *iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
CallOptions
type CallOptions struct {
ListAgents []gax.CallOption
SearchAgents []gax.CallOption
GetAgent []gax.CallOption
ListEndpoints []gax.CallOption
GetEndpoint []gax.CallOption
ListMcpServers []gax.CallOption
SearchMcpServers []gax.CallOption
GetMcpServer []gax.CallOption
ListServices []gax.CallOption
GetService []gax.CallOption
CreateService []gax.CallOption
UpdateService []gax.CallOption
DeleteService []gax.CallOption
ListBindings []gax.CallOption
GetBinding []gax.CallOption
CreateBinding []gax.CallOption
UpdateBinding []gax.CallOption
DeleteBinding []gax.CallOption
FetchAvailableBindings []gax.CallOption
GetLocation []gax.CallOption
ListLocations []gax.CallOption
CancelOperation []gax.CallOption
DeleteOperation []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}CallOptions contains the retry settings for each method of Client.
Client
type Client struct {
// The call options for this service.
CallOptions *CallOptions
// LROClient is used internally to handle long-running operations.
// It is exposed so that its CallOptions can be modified if required.
// Users should not Close this client.
LROClient *lroauto.OperationsClient
// contains filtered or unexported fields
}Client is a client for interacting with Agent Registry API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for managing Agents, Endpoints, McpServers, Services, and Bindings.
func NewClient
NewClient creates a new agent registry client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for managing Agents, Endpoints, McpServers, Services, and Bindings.
Example
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewRESTClient
NewRESTClient creates a new agent registry rest client.
Service for managing Agents, Endpoints, McpServers, Services, and Bindings.
Example
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*Client) CancelOperation
func (c *Client) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) errorCancelOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*Client) Close
Close closes the connection to the API service. Always call Close() when the client is no longer required.
func (*Client) Connection (deprecated)
func (c *Client) Connection() *grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*Client) CreateBinding
func (c *Client) CreateBinding(ctx context.Context, req *agentregistrypb.CreateBindingRequest, opts ...gax.CallOption) (*CreateBindingOperation, error)CreateBinding creates a new Binding in a given project and location.
Example
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
agentregistrypb "cloud.google.com/go/agentregistry/apiv1/agentregistrypb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentregistrypb.CreateBindingRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentregistry/apiv1/agentregistrypb#CreateBindingRequest.
}
op, err := c.CreateBinding(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) CreateBindingOperation
func (c *Client) CreateBindingOperation(name string) *CreateBindingOperationCreateBindingOperation returns a new CreateBindingOperation from a given name. The name must be that of a previously created CreateBindingOperation, possibly from a different process.
func (*Client) CreateService
func (c *Client) CreateService(ctx context.Context, req *agentregistrypb.CreateServiceRequest, opts ...gax.CallOption) (*CreateServiceOperation, error)CreateService creates a new Service in a given project and location.
Example
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
agentregistrypb "cloud.google.com/go/agentregistry/apiv1/agentregistrypb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentregistrypb.CreateServiceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentregistry/apiv1/agentregistrypb#CreateServiceRequest.
}
op, err := c.CreateService(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) CreateServiceOperation
func (c *Client) CreateServiceOperation(name string) *CreateServiceOperationCreateServiceOperation returns a new CreateServiceOperation from a given name. The name must be that of a previously created CreateServiceOperation, possibly from a different process.
func (*Client) DeleteBinding
func (c *Client) DeleteBinding(ctx context.Context, req *agentregistrypb.DeleteBindingRequest, opts ...gax.CallOption) (*DeleteBindingOperation, error)DeleteBinding deletes a single Binding.
Example
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
agentregistrypb "cloud.google.com/go/agentregistry/apiv1/agentregistrypb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentregistrypb.DeleteBindingRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentregistry/apiv1/agentregistrypb#DeleteBindingRequest.
}
op, err := c.DeleteBinding(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
func (*Client) DeleteBindingOperation
func (c *Client) DeleteBindingOperation(name string) *DeleteBindingOperationDeleteBindingOperation returns a new DeleteBindingOperation from a given name. The name must be that of a previously created DeleteBindingOperation, possibly from a different process.
func (*Client) DeleteOperation
func (c *Client) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) errorDeleteOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.DeleteOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
}
err = c.DeleteOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*Client) DeleteService
func (c *Client) DeleteService(ctx context.Context, req *agentregistrypb.DeleteServiceRequest, opts ...gax.CallOption) (*DeleteServiceOperation, error)DeleteService deletes a single Service.
Example
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
agentregistrypb "cloud.google.com/go/agentregistry/apiv1/agentregistrypb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentregistrypb.DeleteServiceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentregistry/apiv1/agentregistrypb#DeleteServiceRequest.
}
op, err := c.DeleteService(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
func (*Client) DeleteServiceOperation
func (c *Client) DeleteServiceOperation(name string) *DeleteServiceOperationDeleteServiceOperation returns a new DeleteServiceOperation from a given name. The name must be that of a previously created DeleteServiceOperation, possibly from a different process.
func (*Client) FetchAvailableBindings
func (c *Client) FetchAvailableBindings(ctx context.Context, req *agentregistrypb.FetchAvailableBindingsRequest, opts ...gax.CallOption) *BindingIteratorFetchAvailableBindings fetches available Bindings.
Examples
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
agentregistrypb "cloud.google.com/go/agentregistry/apiv1/agentregistrypb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentregistrypb.FetchAvailableBindingsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentregistry/apiv1/agentregistrypb#FetchAvailableBindingsRequest.
}
it := c.FetchAvailableBindings(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*agentregistrypb.FetchAvailableBindingsResponse)
}
}
all
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
agentregistrypb "cloud.google.com/go/agentregistry/apiv1/agentregistrypb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentregistrypb.FetchAvailableBindingsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentregistry/apiv1/agentregistrypb#FetchAvailableBindingsRequest.
}
for resp, err := range c.FetchAvailableBindings(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) GetAgent
func (c *Client) GetAgent(ctx context.Context, req *agentregistrypb.GetAgentRequest, opts ...gax.CallOption) (*agentregistrypb.Agent, error)GetAgent gets details of a single Agent.
Example
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
agentregistrypb "cloud.google.com/go/agentregistry/apiv1/agentregistrypb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentregistrypb.GetAgentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentregistry/apiv1/agentregistrypb#GetAgentRequest.
}
resp, err := c.GetAgent(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetBinding
func (c *Client) GetBinding(ctx context.Context, req *agentregistrypb.GetBindingRequest, opts ...gax.CallOption) (*agentregistrypb.Binding, error)GetBinding gets details of a single Binding.
Example
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
agentregistrypb "cloud.google.com/go/agentregistry/apiv1/agentregistrypb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentregistrypb.GetBindingRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentregistry/apiv1/agentregistrypb#GetBindingRequest.
}
resp, err := c.GetBinding(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetEndpoint
func (c *Client) GetEndpoint(ctx context.Context, req *agentregistrypb.GetEndpointRequest, opts ...gax.CallOption) (*agentregistrypb.Endpoint, error)GetEndpoint gets details of a single Endpoint.
Example
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
agentregistrypb "cloud.google.com/go/agentregistry/apiv1/agentregistrypb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentregistrypb.GetEndpointRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentregistry/apiv1/agentregistrypb#GetEndpointRequest.
}
resp, err := c.GetEndpoint(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetLocation
func (c *Client) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)GetLocation gets information about a location.
Example
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.GetLocationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
}
resp, err := c.GetLocation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetMcpServer
func (c *Client) GetMcpServer(ctx context.Context, req *agentregistrypb.GetMcpServerRequest, opts ...gax.CallOption) (*agentregistrypb.McpServer, error)GetMcpServer gets details of a single McpServer.
Example
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
agentregistrypb "cloud.google.com/go/agentregistry/apiv1/agentregistrypb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentregistrypb.GetMcpServerRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentregistry/apiv1/agentregistrypb#GetMcpServerRequest.
}
resp, err := c.GetMcpServer(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetOperation
func (c *Client) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)GetOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetService
func (c *Client) GetService(ctx context.Context, req *agentregistrypb.GetServiceRequest, opts ...gax.CallOption) (*agentregistrypb.Service, error)GetService gets details of a single Service.
Example
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
agentregistrypb "cloud.google.com/go/agentregistry/apiv1/agentregistrypb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentregistrypb.GetServiceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentregistry/apiv1/agentregistrypb#GetServiceRequest.
}
resp, err := c.GetService(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) ListAgents
func (c *Client) ListAgents(ctx context.Context, req *agentregistrypb.ListAgentsRequest, opts ...gax.CallOption) *AgentIteratorListAgents lists Agents in a given project and location.
Examples
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
agentregistrypb "cloud.google.com/go/agentregistry/apiv1/agentregistrypb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentregistrypb.ListAgentsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentregistry/apiv1/agentregistrypb#ListAgentsRequest.
}
it := c.ListAgents(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*agentregistrypb.ListAgentsResponse)
}
}
all
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
agentregistrypb "cloud.google.com/go/agentregistry/apiv1/agentregistrypb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentregistrypb.ListAgentsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentregistry/apiv1/agentregistrypb#ListAgentsRequest.
}
for resp, err := range c.ListAgents(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) ListBindings
func (c *Client) ListBindings(ctx context.Context, req *agentregistrypb.ListBindingsRequest, opts ...gax.CallOption) *BindingIteratorListBindings lists Bindings in a given project and location.
Examples
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
agentregistrypb "cloud.google.com/go/agentregistry/apiv1/agentregistrypb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentregistrypb.ListBindingsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentregistry/apiv1/agentregistrypb#ListBindingsRequest.
}
it := c.ListBindings(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*agentregistrypb.ListBindingsResponse)
}
}
all
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
agentregistrypb "cloud.google.com/go/agentregistry/apiv1/agentregistrypb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentregistrypb.ListBindingsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentregistry/apiv1/agentregistrypb#ListBindingsRequest.
}
for resp, err := range c.ListBindings(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) ListEndpoints
func (c *Client) ListEndpoints(ctx context.Context, req *agentregistrypb.ListEndpointsRequest, opts ...gax.CallOption) *EndpointIteratorListEndpoints lists Endpoints in a given project and location.
Examples
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
agentregistrypb "cloud.google.com/go/agentregistry/apiv1/agentregistrypb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentregistrypb.ListEndpointsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentregistry/apiv1/agentregistrypb#ListEndpointsRequest.
}
it := c.ListEndpoints(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*agentregistrypb.ListEndpointsResponse)
}
}
all
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
agentregistrypb "cloud.google.com/go/agentregistry/apiv1/agentregistrypb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentregistrypb.ListEndpointsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentregistry/apiv1/agentregistrypb#ListEndpointsRequest.
}
for resp, err := range c.ListEndpoints(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) ListLocations
func (c *Client) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIteratorListLocations lists information about the supported locations for this service.
This method lists locations based on the resource scope provided in the [ListLocationsRequest.name (at http://ListLocationsRequest.name)][google.cloud.location.ListLocationsRequest.name (at http://google.cloud.location.ListLocationsRequest.name)] field: * Global locations: If name is empty, the method lists the public locations available to all projects. * Project-specific locations: If name follows the format projects/{project}, the method lists locations visible to that specific project. This includes public, private, or other project-specific locations enabled for the project.
For gRPC and client library implementations, the resource name is passed as the name field. For direct service calls, the resource name is incorporated into the request path based on the specific service implementation and version.
Examples
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
"google.golang.org/api/iterator"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
it := c.ListLocations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*locationpb.ListLocationsResponse)
}
}
all
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
for resp, err := range c.ListLocations(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) ListMcpServers
func (c *Client) ListMcpServers(ctx context.Context, req *agentregistrypb.ListMcpServersRequest, opts ...gax.CallOption) *McpServerIteratorListMcpServers lists McpServers in a given project and location.
Examples
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
agentregistrypb "cloud.google.com/go/agentregistry/apiv1/agentregistrypb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentregistrypb.ListMcpServersRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentregistry/apiv1/agentregistrypb#ListMcpServersRequest.
}
it := c.ListMcpServers(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*agentregistrypb.ListMcpServersResponse)
}
}
all
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
agentregistrypb "cloud.google.com/go/agentregistry/apiv1/agentregistrypb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentregistrypb.ListMcpServersRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentregistry/apiv1/agentregistrypb#ListMcpServersRequest.
}
for resp, err := range c.ListMcpServers(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) ListOperations
func (c *Client) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
it := c.ListOperations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*longrunningpb.ListOperationsResponse)
}
}
all
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
for resp, err := range c.ListOperations(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) ListServices
func (c *Client) ListServices(ctx context.Context, req *agentregistrypb.ListServicesRequest, opts ...gax.CallOption) *ServiceIteratorListServices lists Services in a given project and location.
Examples
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
agentregistrypb "cloud.google.com/go/agentregistry/apiv1/agentregistrypb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentregistrypb.ListServicesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentregistry/apiv1/agentregistrypb#ListServicesRequest.
}
it := c.ListServices(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*agentregistrypb.ListServicesResponse)
}
}
all
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
agentregistrypb "cloud.google.com/go/agentregistry/apiv1/agentregistrypb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentregistrypb.ListServicesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentregistry/apiv1/agentregistrypb#ListServicesRequest.
}
for resp, err := range c.ListServices(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) SearchAgents
func (c *Client) SearchAgents(ctx context.Context, req *agentregistrypb.SearchAgentsRequest, opts ...gax.CallOption) *AgentIteratorSearchAgents searches Agents in a given project and location.
Examples
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
agentregistrypb "cloud.google.com/go/agentregistry/apiv1/agentregistrypb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentregistrypb.SearchAgentsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentregistry/apiv1/agentregistrypb#SearchAgentsRequest.
}
it := c.SearchAgents(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*agentregistrypb.SearchAgentsResponse)
}
}
all
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
agentregistrypb "cloud.google.com/go/agentregistry/apiv1/agentregistrypb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentregistrypb.SearchAgentsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentregistry/apiv1/agentregistrypb#SearchAgentsRequest.
}
for resp, err := range c.SearchAgents(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) SearchMcpServers
func (c *Client) SearchMcpServers(ctx context.Context, req *agentregistrypb.SearchMcpServersRequest, opts ...gax.CallOption) *McpServerIteratorSearchMcpServers searches McpServers in a given project and location.
Examples
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
agentregistrypb "cloud.google.com/go/agentregistry/apiv1/agentregistrypb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentregistrypb.SearchMcpServersRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentregistry/apiv1/agentregistrypb#SearchMcpServersRequest.
}
it := c.SearchMcpServers(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*agentregistrypb.SearchMcpServersResponse)
}
}
all
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
agentregistrypb "cloud.google.com/go/agentregistry/apiv1/agentregistrypb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentregistrypb.SearchMcpServersRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentregistry/apiv1/agentregistrypb#SearchMcpServersRequest.
}
for resp, err := range c.SearchMcpServers(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) UpdateBinding
func (c *Client) UpdateBinding(ctx context.Context, req *agentregistrypb.UpdateBindingRequest, opts ...gax.CallOption) (*UpdateBindingOperation, error)UpdateBinding updates the parameters of a single Binding.
Example
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
agentregistrypb "cloud.google.com/go/agentregistry/apiv1/agentregistrypb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentregistrypb.UpdateBindingRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentregistry/apiv1/agentregistrypb#UpdateBindingRequest.
}
op, err := c.UpdateBinding(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) UpdateBindingOperation
func (c *Client) UpdateBindingOperation(name string) *UpdateBindingOperationUpdateBindingOperation returns a new UpdateBindingOperation from a given name. The name must be that of a previously created UpdateBindingOperation, possibly from a different process.
func (*Client) UpdateService
func (c *Client) UpdateService(ctx context.Context, req *agentregistrypb.UpdateServiceRequest, opts ...gax.CallOption) (*UpdateServiceOperation, error)UpdateService updates the parameters of a single Service.
Example
package main
import (
"context"
agentregistry "cloud.google.com/go/agentregistry/apiv1"
agentregistrypb "cloud.google.com/go/agentregistry/apiv1/agentregistrypb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := agentregistry.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentregistrypb.UpdateServiceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentregistry/apiv1/agentregistrypb#UpdateServiceRequest.
}
op, err := c.UpdateService(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) UpdateServiceOperation
func (c *Client) UpdateServiceOperation(name string) *UpdateServiceOperationUpdateServiceOperation returns a new UpdateServiceOperation from a given name. The name must be that of a previously created UpdateServiceOperation, possibly from a different process.
CreateBindingOperation
type CreateBindingOperation struct {
// contains filtered or unexported fields
}CreateBindingOperation manages a long-running operation from CreateBinding.
func (*CreateBindingOperation) Done
func (op *CreateBindingOperation) Done() boolDone reports whether the long-running operation has completed.
func (*CreateBindingOperation) Metadata
func (op *CreateBindingOperation) Metadata() (*agentregistrypb.OperationMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*CreateBindingOperation) Name
func (op *CreateBindingOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*CreateBindingOperation) Poll
func (op *CreateBindingOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*agentregistrypb.Binding, error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*CreateBindingOperation) Wait
func (op *CreateBindingOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*agentregistrypb.Binding, error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
CreateServiceOperation
type CreateServiceOperation struct {
// contains filtered or unexported fields
}CreateServiceOperation manages a long-running operation from CreateService.
func (*CreateServiceOperation) Done
func (op *CreateServiceOperation) Done() boolDone reports whether the long-running operation has completed.
func (*CreateServiceOperation) Metadata
func (op *CreateServiceOperation) Metadata() (*agentregistrypb.OperationMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*CreateServiceOperation) Name
func (op *CreateServiceOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*CreateServiceOperation) Poll
func (op *CreateServiceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*agentregistrypb.Service, error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*CreateServiceOperation) Wait
func (op *CreateServiceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*agentregistrypb.Service, error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
DeleteBindingOperation
type DeleteBindingOperation struct {
// contains filtered or unexported fields
}DeleteBindingOperation manages a long-running operation from DeleteBinding.
func (*DeleteBindingOperation) Done
func (op *DeleteBindingOperation) Done() boolDone reports whether the long-running operation has completed.
func (*DeleteBindingOperation) Metadata
func (op *DeleteBindingOperation) Metadata() (*agentregistrypb.OperationMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*DeleteBindingOperation) Name
func (op *DeleteBindingOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*DeleteBindingOperation) Poll
func (op *DeleteBindingOperation) Poll(ctx context.Context, opts ...gax.CallOption) errorPoll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*DeleteBindingOperation) Wait
func (op *DeleteBindingOperation) Wait(ctx context.Context, opts ...gax.CallOption) errorWait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
DeleteServiceOperation
type DeleteServiceOperation struct {
// contains filtered or unexported fields
}DeleteServiceOperation manages a long-running operation from DeleteService.
func (*DeleteServiceOperation) Done
func (op *DeleteServiceOperation) Done() boolDone reports whether the long-running operation has completed.
func (*DeleteServiceOperation) Metadata
func (op *DeleteServiceOperation) Metadata() (*agentregistrypb.OperationMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*DeleteServiceOperation) Name
func (op *DeleteServiceOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*DeleteServiceOperation) Poll
func (op *DeleteServiceOperation) Poll(ctx context.Context, opts ...gax.CallOption) errorPoll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*DeleteServiceOperation) Wait
func (op *DeleteServiceOperation) Wait(ctx context.Context, opts ...gax.CallOption) errorWait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
EndpointIterator
type EndpointIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch func(pageSize int, pageToken string) (results []*agentregistrypb.Endpoint, nextPageToken string, err error)
// contains filtered or unexported fields
}EndpointIterator manages a stream of *agentregistrypb.Endpoint.
func (*EndpointIterator) All
func (it *EndpointIterator) All() iter.Seq2[*agentregistrypb.Endpoint, error]All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*EndpointIterator) Next
func (it *EndpointIterator) Next() (*agentregistrypb.Endpoint, error)Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*EndpointIterator) PageInfo
func (it *EndpointIterator) PageInfo() *iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
LocationIterator
type LocationIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch func(pageSize int, pageToken string) (results []*locationpb.Location, nextPageToken string, err error)
// contains filtered or unexported fields
}LocationIterator manages a stream of *locationpb.Location.
func (*LocationIterator) All
func (it *LocationIterator) All() iter.Seq2[*locationpb.Location, error]All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*LocationIterator) Next
func (it *LocationIterator) Next() (*locationpb.Location, error)Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*LocationIterator) PageInfo
func (it *LocationIterator) PageInfo() *iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
McpServerIterator
type McpServerIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch func(pageSize int, pageToken string) (results []*agentregistrypb.McpServer, nextPageToken string, err error)
// contains filtered or unexported fields
}McpServerIterator manages a stream of *agentregistrypb.McpServer.
func (*McpServerIterator) All
func (it *McpServerIterator) All() iter.Seq2[*agentregistrypb.McpServer, error]All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*McpServerIterator) Next
func (it *McpServerIterator) Next() (*agentregistrypb.McpServer, error)Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*McpServerIterator) PageInfo
func (it *McpServerIterator) PageInfo() *iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
OperationIterator
type OperationIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch func(pageSize int, pageToken string) (results []*longrunningpb.Operation, nextPageToken string, err error)
// contains filtered or unexported fields
}OperationIterator manages a stream of *longrunningpb.Operation.
func (*OperationIterator) All
func (it *OperationIterator) All() iter.Seq2[*longrunningpb.Operation, error]All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*OperationIterator) Next
func (it *OperationIterator) Next() (*longrunningpb.Operation, error)Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*OperationIterator) PageInfo
func (it *OperationIterator) PageInfo() *iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
ServiceIterator
type ServiceIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch func(pageSize int, pageToken string) (results []*agentregistrypb.Service, nextPageToken string, err error)
// contains filtered or unexported fields
}ServiceIterator manages a stream of *agentregistrypb.Service.
func (*ServiceIterator) All
func (it *ServiceIterator) All() iter.Seq2[*agentregistrypb.Service, error]All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*ServiceIterator) Next
func (it *ServiceIterator) Next() (*agentregistrypb.Service, error)Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*ServiceIterator) PageInfo
func (it *ServiceIterator) PageInfo() *iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
UpdateBindingOperation
type UpdateBindingOperation struct {
// contains filtered or unexported fields
}UpdateBindingOperation manages a long-running operation from UpdateBinding.
func (*UpdateBindingOperation) Done
func (op *UpdateBindingOperation) Done() boolDone reports whether the long-running operation has completed.
func (*UpdateBindingOperation) Metadata
func (op *UpdateBindingOperation) Metadata() (*agentregistrypb.OperationMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*UpdateBindingOperation) Name
func (op *UpdateBindingOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*UpdateBindingOperation) Poll
func (op *UpdateBindingOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*agentregistrypb.Binding, error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*UpdateBindingOperation) Wait
func (op *UpdateBindingOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*agentregistrypb.Binding, error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
UpdateServiceOperation
type UpdateServiceOperation struct {
// contains filtered or unexported fields
}UpdateServiceOperation manages a long-running operation from UpdateService.
func (*UpdateServiceOperation) Done
func (op *UpdateServiceOperation) Done() boolDone reports whether the long-running operation has completed.
func (*UpdateServiceOperation) Metadata
func (op *UpdateServiceOperation) Metadata() (*agentregistrypb.OperationMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*UpdateServiceOperation) Name
func (op *UpdateServiceOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*UpdateServiceOperation) Poll
func (op *UpdateServiceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*agentregistrypb.Service, error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*UpdateServiceOperation) Wait
func (op *UpdateServiceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*agentregistrypb.Service, error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.