apiregistry

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package apiregistry is an auto-generated package for the Cloud API Registry API.

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:

Example usage

To get started with this package, create a client.

// go get cloud.google.com/go/apiregistry/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 := apiregistry.NewCloudApiRegistryClient(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 := &apiregistrypb.GetMcpServerRequest{
	// TODO: Fill request struct fields.
	// See https://pkg.go.dev/cloud.google.com/go/apiregistry/apiv1/apiregistrypb#GetMcpServerRequest.
}
resp, err := c.GetMcpServer(ctx, req)
if err != nil {
	// TODO: Handle error.
}
// TODO: Use resp.
_ = resp

Use of Context

The ctx passed to NewCloudApiRegistryClient 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.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultAuthScopes

func DefaultAuthScopes() []string

DefaultAuthScopes reports the default set of authentication scopes to use with this package.

Types

type CloudApiRegistryCallOptions

type CloudApiRegistryCallOptions struct {
	GetMcpServer   []gax.CallOption
	ListMcpServers []gax.CallOption
	GetMcpTool     []gax.CallOption
	ListMcpTools   []gax.CallOption
	GetLocation    []gax.CallOption
	ListLocations  []gax.CallOption
}

CloudApiRegistryCallOptions contains the retry settings for each method of CloudApiRegistryClient.

type CloudApiRegistryClient

type CloudApiRegistryClient struct {

	// The call options for this service.
	CallOptions *CloudApiRegistryCallOptions
	// contains filtered or unexported fields
}

CloudApiRegistryClient is a client for interacting with Cloud API Registry API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

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

func NewCloudApiRegistryClient

func NewCloudApiRegistryClient(ctx context.Context, opts ...option.ClientOption) (*CloudApiRegistryClient, error)

NewCloudApiRegistryClient creates a new cloud api registry client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

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

Example
package main

import (
	"context"

	apiregistry "cloud.google.com/go/apiregistry/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 := apiregistry.NewCloudApiRegistryClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func NewCloudApiRegistryRESTClient

func NewCloudApiRegistryRESTClient(ctx context.Context, opts ...option.ClientOption) (*CloudApiRegistryClient, error)

NewCloudApiRegistryRESTClient creates a new cloud api registry rest client.

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

Example
package main

import (
	"context"

	apiregistry "cloud.google.com/go/apiregistry/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 := apiregistry.NewCloudApiRegistryRESTClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func (*CloudApiRegistryClient) Close

func (c *CloudApiRegistryClient) Close() error

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*CloudApiRegistryClient) Connection deprecated

func (c *CloudApiRegistryClient) Connection() *grpc.ClientConn

Connection returns a connection to the API service.

Deprecated: Connections are now pooled so this method does not always return the same resource.

func (*CloudApiRegistryClient) GetLocation

GetLocation gets information about a location.

Example
package main

import (
	"context"

	apiregistry "cloud.google.com/go/apiregistry/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 := apiregistry.NewCloudApiRegistryClient(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 (*CloudApiRegistryClient) GetMcpServer

GetMcpServer gets a single McpServer.

Example
package main

import (
	"context"

	apiregistry "cloud.google.com/go/apiregistry/apiv1"
	apiregistrypb "cloud.google.com/go/apiregistry/apiv1/apiregistrypb"
)

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 := apiregistry.NewCloudApiRegistryClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &apiregistrypb.GetMcpServerRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/apiregistry/apiv1/apiregistrypb#GetMcpServerRequest.
	}
	resp, err := c.GetMcpServer(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*CloudApiRegistryClient) GetMcpTool

GetMcpTool gets a single McpTool.

Example
package main

import (
	"context"

	apiregistry "cloud.google.com/go/apiregistry/apiv1"
	apiregistrypb "cloud.google.com/go/apiregistry/apiv1/apiregistrypb"
)

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 := apiregistry.NewCloudApiRegistryClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &apiregistrypb.GetMcpToolRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/apiregistry/apiv1/apiregistrypb#GetMcpToolRequest.
	}
	resp, err := c.GetMcpTool(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*CloudApiRegistryClient) ListLocations

ListLocations lists information about the supported locations for this service.

Example
package main

import (
	"context"

	apiregistry "cloud.google.com/go/apiregistry/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 := apiregistry.NewCloudApiRegistryClient(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)
	}
}
Example (All)
package main

import (
	"context"

	apiregistry "cloud.google.com/go/apiregistry/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 := apiregistry.NewCloudApiRegistryClient(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 (*CloudApiRegistryClient) ListMcpServers

ListMcpServers lists McpServers in a given Project.

Example
package main

import (
	"context"

	apiregistry "cloud.google.com/go/apiregistry/apiv1"
	apiregistrypb "cloud.google.com/go/apiregistry/apiv1/apiregistrypb"
	"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 := apiregistry.NewCloudApiRegistryClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &apiregistrypb.ListMcpServersRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/apiregistry/apiv1/apiregistrypb#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.(*apiregistrypb.ListMcpServersResponse)
	}
}
Example (All)
package main

import (
	"context"

	apiregistry "cloud.google.com/go/apiregistry/apiv1"
	apiregistrypb "cloud.google.com/go/apiregistry/apiv1/apiregistrypb"
)

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 := apiregistry.NewCloudApiRegistryClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &apiregistrypb.ListMcpServersRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/apiregistry/apiv1/apiregistrypb#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 (*CloudApiRegistryClient) ListMcpTools

ListMcpTools lists McpTools in a given McpServer.

Example
package main

import (
	"context"

	apiregistry "cloud.google.com/go/apiregistry/apiv1"
	apiregistrypb "cloud.google.com/go/apiregistry/apiv1/apiregistrypb"
	"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 := apiregistry.NewCloudApiRegistryClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &apiregistrypb.ListMcpToolsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/apiregistry/apiv1/apiregistrypb#ListMcpToolsRequest.
	}
	it := c.ListMcpTools(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.(*apiregistrypb.ListMcpToolsResponse)
	}
}
Example (All)
package main

import (
	"context"

	apiregistry "cloud.google.com/go/apiregistry/apiv1"
	apiregistrypb "cloud.google.com/go/apiregistry/apiv1/apiregistrypb"
)

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 := apiregistry.NewCloudApiRegistryClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &apiregistrypb.ListMcpToolsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/apiregistry/apiv1/apiregistrypb#ListMcpToolsRequest.
	}
	for resp, err := range c.ListMcpTools(ctx, req).All() {
		if err != nil {
			// TODO: Handle error and break/return/continue. Iteration will stop after any error.
		}
		// TODO: Use resp.
		_ = resp
	}
}

type 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

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.PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

type 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 []*apiregistrypb.McpServer, nextPageToken string, err error)
	// contains filtered or unexported fields
}

McpServerIterator manages a stream of *apiregistrypb.McpServer.

func (*McpServerIterator) All

All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.

func (*McpServerIterator) Next

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.PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

type McpToolIterator

type McpToolIterator 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 []*apiregistrypb.McpTool, nextPageToken string, err error)
	// contains filtered or unexported fields
}

McpToolIterator manages a stream of *apiregistrypb.McpTool.

func (*McpToolIterator) All

All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.

func (*McpToolIterator) Next

func (it *McpToolIterator) Next() (*apiregistrypb.McpTool, 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 (*McpToolIterator) PageInfo

func (it *McpToolIterator) PageInfo() *iterator.PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL