Package apihub is an auto-generated package for the API hub 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:
- 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.
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 := apihub.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.
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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.CreateApiRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#CreateApiRequest. } resp, err := c.CreateApi(ctx, req) 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() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
ApiHubDependenciesCallOptions
type ApiHubDependenciesCallOptions struct {
CreateDependency []gax.CallOption
GetDependency []gax.CallOption
UpdateDependency []gax.CallOption
DeleteDependency []gax.CallOption
ListDependencies []gax.CallOption
GetLocation []gax.CallOption
ListLocations []gax.CallOption
CancelOperation []gax.CallOption
DeleteOperation []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
ApiHubDependenciesCallOptions contains the retry settings for each method of ApiHubDependenciesClient.
ApiHubDependenciesClient
type ApiHubDependenciesClient struct {
// The call options for this service.
CallOptions *ApiHubDependenciesCallOptions
// contains filtered or unexported fields
}
ApiHubDependenciesClient is a client for interacting with API hub API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
This service provides methods for various operations related to a Dependency in the API hub.
func NewApiHubDependenciesRESTClient
func NewApiHubDependenciesRESTClient(ctx context.Context, opts ...option.ClientOption) (*ApiHubDependenciesClient, error)
NewApiHubDependenciesRESTClient creates a new api hub dependencies rest client.
This service provides methods for various operations related to a Dependency in the API hub.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/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 := apihub.NewApiHubDependenciesRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*ApiHubDependenciesClient) CancelOperation
func (c *ApiHubDependenciesClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/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 := apihub.NewApiHubDependenciesRESTClient(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 (*ApiHubDependenciesClient) Close
func (c *ApiHubDependenciesClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*ApiHubDependenciesClient) Connection (deprecated)
func (c *ApiHubDependenciesClient) 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 (*ApiHubDependenciesClient) CreateDependency
func (c *ApiHubDependenciesClient) CreateDependency(ctx context.Context, req *apihubpb.CreateDependencyRequest, opts ...gax.CallOption) (*apihubpb.Dependency, error)
CreateDependency create a dependency between two entities in the API hub.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewApiHubDependenciesRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.CreateDependencyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#CreateDependencyRequest.
}
resp, err := c.CreateDependency(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ApiHubDependenciesClient) DeleteDependency
func (c *ApiHubDependenciesClient) DeleteDependency(ctx context.Context, req *apihubpb.DeleteDependencyRequest, opts ...gax.CallOption) error
DeleteDependency delete the dependency resource.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewApiHubDependenciesRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.DeleteDependencyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#DeleteDependencyRequest.
}
err = c.DeleteDependency(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*ApiHubDependenciesClient) DeleteOperation
func (c *ApiHubDependenciesClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error
DeleteOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/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 := apihub.NewApiHubDependenciesRESTClient(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 (*ApiHubDependenciesClient) GetDependency
func (c *ApiHubDependenciesClient) GetDependency(ctx context.Context, req *apihubpb.GetDependencyRequest, opts ...gax.CallOption) (*apihubpb.Dependency, error)
GetDependency get details about a dependency resource in the API hub.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewApiHubDependenciesRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.GetDependencyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#GetDependencyRequest.
}
resp, err := c.GetDependency(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ApiHubDependenciesClient) GetLocation
func (c *ApiHubDependenciesClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
GetLocation gets information about a location.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/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 := apihub.NewApiHubDependenciesRESTClient(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 (*ApiHubDependenciesClient) GetOperation
func (c *ApiHubDependenciesClient) 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"
apihub "cloud.google.com/go/apihub/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 := apihub.NewApiHubDependenciesRESTClient(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 (*ApiHubDependenciesClient) ListDependencies
func (c *ApiHubDependenciesClient) ListDependencies(ctx context.Context, req *apihubpb.ListDependenciesRequest, opts ...gax.CallOption) *DependencyIterator
ListDependencies list dependencies based on the provided filter and pagination parameters.
Examples
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
"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 := apihub.NewApiHubDependenciesRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.ListDependenciesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#ListDependenciesRequest.
}
it := c.ListDependencies(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.(*apihubpb.ListDependenciesResponse)
}
}
all
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewApiHubDependenciesRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.ListDependenciesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#ListDependenciesRequest.
}
for resp, err := range c.ListDependencies(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*ApiHubDependenciesClient) ListLocations
func (c *ApiHubDependenciesClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service.
Examples
package main
import (
"context"
apihub "cloud.google.com/go/apihub/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 := apihub.NewApiHubDependenciesRESTClient(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"
apihub "cloud.google.com/go/apihub/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 := apihub.NewApiHubDependenciesRESTClient(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.
}
// TODO: Use resp.
_ = resp
}
}
func (*ApiHubDependenciesClient) ListOperations
func (c *ApiHubDependenciesClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Examples
package main
import (
"context"
apihub "cloud.google.com/go/apihub/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 := apihub.NewApiHubDependenciesRESTClient(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"
apihub "cloud.google.com/go/apihub/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 := apihub.NewApiHubDependenciesRESTClient(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.
}
// TODO: Use resp.
_ = resp
}
}
func (*ApiHubDependenciesClient) UpdateDependency
func (c *ApiHubDependenciesClient) UpdateDependency(ctx context.Context, req *apihubpb.UpdateDependencyRequest, opts ...gax.CallOption) (*apihubpb.Dependency, error)
UpdateDependency update a dependency based on the update_mask provided in the request.
The following fields in the dependency can be updated:
description
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewApiHubDependenciesRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.UpdateDependencyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#UpdateDependencyRequest.
}
resp, err := c.UpdateDependency(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
ApiHubPluginCallOptions
type ApiHubPluginCallOptions struct {
GetPlugin []gax.CallOption
EnablePlugin []gax.CallOption
DisablePlugin []gax.CallOption
GetLocation []gax.CallOption
ListLocations []gax.CallOption
CancelOperation []gax.CallOption
DeleteOperation []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
ApiHubPluginCallOptions contains the retry settings for each method of ApiHubPluginClient.
ApiHubPluginClient
type ApiHubPluginClient struct {
// The call options for this service.
CallOptions *ApiHubPluginCallOptions
// contains filtered or unexported fields
}
ApiHubPluginClient is a client for interacting with API hub API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
This service is used for managing plugins inside the API Hub.
func NewApiHubPluginRESTClient
func NewApiHubPluginRESTClient(ctx context.Context, opts ...option.ClientOption) (*ApiHubPluginClient, error)
NewApiHubPluginRESTClient creates a new api hub plugin rest client.
This service is used for managing plugins inside the API Hub.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/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 := apihub.NewApiHubPluginRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*ApiHubPluginClient) CancelOperation
func (c *ApiHubPluginClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/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 := apihub.NewApiHubPluginRESTClient(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 (*ApiHubPluginClient) Close
func (c *ApiHubPluginClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*ApiHubPluginClient) Connection (deprecated)
func (c *ApiHubPluginClient) 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 (*ApiHubPluginClient) DeleteOperation
func (c *ApiHubPluginClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error
DeleteOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/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 := apihub.NewApiHubPluginRESTClient(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 (*ApiHubPluginClient) DisablePlugin
func (c *ApiHubPluginClient) DisablePlugin(ctx context.Context, req *apihubpb.DisablePluginRequest, opts ...gax.CallOption) (*apihubpb.Plugin, error)
DisablePlugin disables a plugin. The state of the plugin after disabling is DISABLED
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewApiHubPluginRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.DisablePluginRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#DisablePluginRequest.
}
resp, err := c.DisablePlugin(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ApiHubPluginClient) EnablePlugin
func (c *ApiHubPluginClient) EnablePlugin(ctx context.Context, req *apihubpb.EnablePluginRequest, opts ...gax.CallOption) (*apihubpb.Plugin, error)
EnablePlugin enables a plugin. The state of the plugin after enabling is ENABLED
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewApiHubPluginRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.EnablePluginRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#EnablePluginRequest.
}
resp, err := c.EnablePlugin(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ApiHubPluginClient) GetLocation
func (c *ApiHubPluginClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
GetLocation gets information about a location.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/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 := apihub.NewApiHubPluginRESTClient(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 (*ApiHubPluginClient) GetOperation
func (c *ApiHubPluginClient) 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"
apihub "cloud.google.com/go/apihub/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 := apihub.NewApiHubPluginRESTClient(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 (*ApiHubPluginClient) GetPlugin
func (c *ApiHubPluginClient) GetPlugin(ctx context.Context, req *apihubpb.GetPluginRequest, opts ...gax.CallOption) (*apihubpb.Plugin, error)
GetPlugin get details about an API Hub plugin.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewApiHubPluginRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.GetPluginRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#GetPluginRequest.
}
resp, err := c.GetPlugin(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ApiHubPluginClient) ListLocations
func (c *ApiHubPluginClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service.
Examples
package main
import (
"context"
apihub "cloud.google.com/go/apihub/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 := apihub.NewApiHubPluginRESTClient(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"
apihub "cloud.google.com/go/apihub/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 := apihub.NewApiHubPluginRESTClient(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.
}
// TODO: Use resp.
_ = resp
}
}
func (*ApiHubPluginClient) ListOperations
func (c *ApiHubPluginClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Examples
package main
import (
"context"
apihub "cloud.google.com/go/apihub/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 := apihub.NewApiHubPluginRESTClient(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"
apihub "cloud.google.com/go/apihub/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 := apihub.NewApiHubPluginRESTClient(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.
}
// TODO: Use resp.
_ = resp
}
}
ApiIterator
type ApiIterator 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 []*apihubpb.Api, nextPageToken string, err error)
// contains filtered or unexported fields
}
ApiIterator manages a stream of *apihubpb.Api.
func (*ApiIterator) All
func (it *ApiIterator) All() iter.Seq2[*apihubpb.Api, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*ApiIterator) Next
func (it *ApiIterator) Next() (*apihubpb.Api, 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 (*ApiIterator) PageInfo
func (it *ApiIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
ApiOperationIterator
type ApiOperationIterator 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 []*apihubpb.ApiOperation, nextPageToken string, err error)
// contains filtered or unexported fields
}
ApiOperationIterator manages a stream of *apihubpb.ApiOperation.
func (*ApiOperationIterator) All
func (it *ApiOperationIterator) All() iter.Seq2[*apihubpb.ApiOperation, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*ApiOperationIterator) Next
func (it *ApiOperationIterator) Next() (*apihubpb.ApiOperation, 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 (*ApiOperationIterator) PageInfo
func (it *ApiOperationIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
AttributeIterator
type AttributeIterator 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 []*apihubpb.Attribute, nextPageToken string, err error)
// contains filtered or unexported fields
}
AttributeIterator manages a stream of *apihubpb.Attribute.
func (*AttributeIterator) All
func (it *AttributeIterator) All() iter.Seq2[*apihubpb.Attribute, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*AttributeIterator) Next
func (it *AttributeIterator) Next() (*apihubpb.Attribute, 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 (*AttributeIterator) PageInfo
func (it *AttributeIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
CallOptions
type CallOptions struct {
CreateApi []gax.CallOption
GetApi []gax.CallOption
ListApis []gax.CallOption
UpdateApi []gax.CallOption
DeleteApi []gax.CallOption
CreateVersion []gax.CallOption
GetVersion []gax.CallOption
ListVersions []gax.CallOption
UpdateVersion []gax.CallOption
DeleteVersion []gax.CallOption
CreateSpec []gax.CallOption
GetSpec []gax.CallOption
GetSpecContents []gax.CallOption
ListSpecs []gax.CallOption
UpdateSpec []gax.CallOption
DeleteSpec []gax.CallOption
GetApiOperation []gax.CallOption
ListApiOperations []gax.CallOption
GetDefinition []gax.CallOption
CreateDeployment []gax.CallOption
GetDeployment []gax.CallOption
ListDeployments []gax.CallOption
UpdateDeployment []gax.CallOption
DeleteDeployment []gax.CallOption
CreateAttribute []gax.CallOption
GetAttribute []gax.CallOption
UpdateAttribute []gax.CallOption
DeleteAttribute []gax.CallOption
ListAttributes []gax.CallOption
SearchResources []gax.CallOption
CreateExternalApi []gax.CallOption
GetExternalApi []gax.CallOption
UpdateExternalApi []gax.CallOption
DeleteExternalApi []gax.CallOption
ListExternalApis []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
// contains filtered or unexported fields
}
Client is a client for interacting with API hub API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
This service provides all methods related to the API hub.
func NewRESTClient
NewRESTClient creates a new api hub rest client.
This service provides all methods related to the API hub.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/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 := apihub.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) error
CancelOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/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 := apihub.NewRESTClient(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. The user should invoke this when the client is no longer required.
func (*Client) Connection (deprecated)
func (c *Client) 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 (*Client) CreateApi
func (c *Client) CreateApi(ctx context.Context, req *apihubpb.CreateApiRequest, opts ...gax.CallOption) (*apihubpb.Api, error)
CreateApi create an API resource in the API hub. Once an API resource is created, versions can be added to it.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.CreateApiRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#CreateApiRequest.
}
resp, err := c.CreateApi(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) CreateAttribute
func (c *Client) CreateAttribute(ctx context.Context, req *apihubpb.CreateAttributeRequest, opts ...gax.CallOption) (*apihubpb.Attribute, error)
CreateAttribute create a user defined attribute.
Certain pre defined attributes are already created by the API hub. These attributes will have type as SYSTEM_DEFINED and can be listed via ListAttributes method. Allowed values for the same can be updated via UpdateAttribute method.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.CreateAttributeRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#CreateAttributeRequest.
}
resp, err := c.CreateAttribute(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) CreateDeployment
func (c *Client) CreateDeployment(ctx context.Context, req *apihubpb.CreateDeploymentRequest, opts ...gax.CallOption) (*apihubpb.Deployment, error)
CreateDeployment create a deployment resource in the API hub. Once a deployment resource is created, it can be associated with API versions.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.CreateDeploymentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#CreateDeploymentRequest.
}
resp, err := c.CreateDeployment(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) CreateExternalApi
func (c *Client) CreateExternalApi(ctx context.Context, req *apihubpb.CreateExternalApiRequest, opts ...gax.CallOption) (*apihubpb.ExternalApi, error)
CreateExternalApi create an External API resource in the API hub.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.CreateExternalApiRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#CreateExternalApiRequest.
}
resp, err := c.CreateExternalApi(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) CreateSpec
func (c *Client) CreateSpec(ctx context.Context, req *apihubpb.CreateSpecRequest, opts ...gax.CallOption) (*apihubpb.Spec, error)
CreateSpec add a spec to an API version in the API hub. Multiple specs can be added to an API version. Note, while adding a spec, at least one of contents or source_uri must be provided. If contents is provided, then spec_type must also be provided.
On adding a spec with contents to the version, the operations present in it will be added to the version.Note that the file contents in the spec should be of the same type as defined in the projects/{project}/locations/{location}/attributes/system-spec-type attribute associated with spec resource. Note that specs of various types can be uploaded, however parsing of details is supported for OpenAPI spec currently.
In order to access the information parsed from the spec, use the GetSpec method. In order to access the raw contents for a particular spec, use the GetSpecContents method. In order to access the operations parsed from the spec, use the ListAPIOperations method.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.CreateSpecRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#CreateSpecRequest.
}
resp, err := c.CreateSpec(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) CreateVersion
func (c *Client) CreateVersion(ctx context.Context, req *apihubpb.CreateVersionRequest, opts ...gax.CallOption) (*apihubpb.Version, error)
CreateVersion create an API version for an API resource in the API hub.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.CreateVersionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#CreateVersionRequest.
}
resp, err := c.CreateVersion(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) DeleteApi
func (c *Client) DeleteApi(ctx context.Context, req *apihubpb.DeleteApiRequest, opts ...gax.CallOption) error
DeleteApi delete an API resource in the API hub. API can only be deleted if all underlying versions are deleted.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.DeleteApiRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#DeleteApiRequest.
}
err = c.DeleteApi(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*Client) DeleteAttribute
func (c *Client) DeleteAttribute(ctx context.Context, req *apihubpb.DeleteAttributeRequest, opts ...gax.CallOption) error
DeleteAttribute delete an attribute.
Note: System defined attributes cannot be deleted. All associations of the attribute being deleted with any API hub resource will also get deleted.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.DeleteAttributeRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#DeleteAttributeRequest.
}
err = c.DeleteAttribute(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*Client) DeleteDeployment
func (c *Client) DeleteDeployment(ctx context.Context, req *apihubpb.DeleteDeploymentRequest, opts ...gax.CallOption) error
DeleteDeployment delete a deployment resource in the API hub.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.DeleteDeploymentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#DeleteDeploymentRequest.
}
err = c.DeleteDeployment(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*Client) DeleteExternalApi
func (c *Client) DeleteExternalApi(ctx context.Context, req *apihubpb.DeleteExternalApiRequest, opts ...gax.CallOption) error
DeleteExternalApi delete an External API resource in the API hub.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.DeleteExternalApiRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#DeleteExternalApiRequest.
}
err = c.DeleteExternalApi(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*Client) DeleteOperation
func (c *Client) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error
DeleteOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/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 := apihub.NewRESTClient(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) DeleteSpec
func (c *Client) DeleteSpec(ctx context.Context, req *apihubpb.DeleteSpecRequest, opts ...gax.CallOption) error
DeleteSpec delete a spec. Deleting a spec will also delete the associated operations from the version.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.DeleteSpecRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#DeleteSpecRequest.
}
err = c.DeleteSpec(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*Client) DeleteVersion
func (c *Client) DeleteVersion(ctx context.Context, req *apihubpb.DeleteVersionRequest, opts ...gax.CallOption) error
DeleteVersion delete an API version. Version can only be deleted if all underlying specs, operations, definitions and linked deployments are deleted.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.DeleteVersionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#DeleteVersionRequest.
}
err = c.DeleteVersion(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*Client) GetApi
func (c *Client) GetApi(ctx context.Context, req *apihubpb.GetApiRequest, opts ...gax.CallOption) (*apihubpb.Api, error)
GetApi get API resource details including the API versions contained in it.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.GetApiRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#GetApiRequest.
}
resp, err := c.GetApi(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetApiOperation
func (c *Client) GetApiOperation(ctx context.Context, req *apihubpb.GetApiOperationRequest, opts ...gax.CallOption) (*apihubpb.ApiOperation, error)
GetApiOperation get details about a particular operation in API version.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.GetApiOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#GetApiOperationRequest.
}
resp, err := c.GetApiOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetAttribute
func (c *Client) GetAttribute(ctx context.Context, req *apihubpb.GetAttributeRequest, opts ...gax.CallOption) (*apihubpb.Attribute, error)
GetAttribute get details about the attribute.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.GetAttributeRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#GetAttributeRequest.
}
resp, err := c.GetAttribute(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetDefinition
func (c *Client) GetDefinition(ctx context.Context, req *apihubpb.GetDefinitionRequest, opts ...gax.CallOption) (*apihubpb.Definition, error)
GetDefinition get details about a definition in an API version.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.GetDefinitionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#GetDefinitionRequest.
}
resp, err := c.GetDefinition(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetDeployment
func (c *Client) GetDeployment(ctx context.Context, req *apihubpb.GetDeploymentRequest, opts ...gax.CallOption) (*apihubpb.Deployment, error)
GetDeployment get details about a deployment and the API versions linked to it.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.GetDeploymentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#GetDeploymentRequest.
}
resp, err := c.GetDeployment(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetExternalApi
func (c *Client) GetExternalApi(ctx context.Context, req *apihubpb.GetExternalApiRequest, opts ...gax.CallOption) (*apihubpb.ExternalApi, error)
GetExternalApi get details about an External API resource in the API hub.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.GetExternalApiRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#GetExternalApiRequest.
}
resp, err := c.GetExternalApi(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"
apihub "cloud.google.com/go/apihub/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 := apihub.NewRESTClient(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) 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"
apihub "cloud.google.com/go/apihub/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 := apihub.NewRESTClient(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) GetSpec
func (c *Client) GetSpec(ctx context.Context, req *apihubpb.GetSpecRequest, opts ...gax.CallOption) (*apihubpb.Spec, error)
GetSpec get details about the information parsed from a spec. Note that this method does not return the raw spec contents. Use GetSpecContents method to retrieve the same.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.GetSpecRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#GetSpecRequest.
}
resp, err := c.GetSpec(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetSpecContents
func (c *Client) GetSpecContents(ctx context.Context, req *apihubpb.GetSpecContentsRequest, opts ...gax.CallOption) (*apihubpb.SpecContents, error)
GetSpecContents get spec contents.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.GetSpecContentsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#GetSpecContentsRequest.
}
resp, err := c.GetSpecContents(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetVersion
func (c *Client) GetVersion(ctx context.Context, req *apihubpb.GetVersionRequest, opts ...gax.CallOption) (*apihubpb.Version, error)
GetVersion get details about the API version of an API resource. This will include information about the specs and operations present in the API version as well as the deployments linked to it.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.GetVersionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#GetVersionRequest.
}
resp, err := c.GetVersion(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) ListApiOperations
func (c *Client) ListApiOperations(ctx context.Context, req *apihubpb.ListApiOperationsRequest, opts ...gax.CallOption) *ApiOperationIterator
ListApiOperations list operations in an API version.
Examples
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
"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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.ListApiOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#ListApiOperationsRequest.
}
it := c.ListApiOperations(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.(*apihubpb.ListApiOperationsResponse)
}
}
all
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.ListApiOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#ListApiOperationsRequest.
}
for resp, err := range c.ListApiOperations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) ListApis
func (c *Client) ListApis(ctx context.Context, req *apihubpb.ListApisRequest, opts ...gax.CallOption) *ApiIterator
ListApis list API resources in the API hub.
Examples
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
"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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.ListApisRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#ListApisRequest.
}
it := c.ListApis(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.(*apihubpb.ListApisResponse)
}
}
all
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.ListApisRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#ListApisRequest.
}
for resp, err := range c.ListApis(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) ListAttributes
func (c *Client) ListAttributes(ctx context.Context, req *apihubpb.ListAttributesRequest, opts ...gax.CallOption) *AttributeIterator
ListAttributes list all attributes.
Examples
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
"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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.ListAttributesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#ListAttributesRequest.
}
it := c.ListAttributes(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.(*apihubpb.ListAttributesResponse)
}
}
all
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.ListAttributesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#ListAttributesRequest.
}
for resp, err := range c.ListAttributes(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) ListDeployments
func (c *Client) ListDeployments(ctx context.Context, req *apihubpb.ListDeploymentsRequest, opts ...gax.CallOption) *DeploymentIterator
ListDeployments list deployment resources in the API hub.
Examples
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
"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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.ListDeploymentsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#ListDeploymentsRequest.
}
it := c.ListDeployments(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.(*apihubpb.ListDeploymentsResponse)
}
}
all
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.ListDeploymentsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#ListDeploymentsRequest.
}
for resp, err := range c.ListDeployments(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) ListExternalApis
func (c *Client) ListExternalApis(ctx context.Context, req *apihubpb.ListExternalApisRequest, opts ...gax.CallOption) *ExternalApiIterator
ListExternalApis list External API resources in the API hub.
Examples
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
"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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.ListExternalApisRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#ListExternalApisRequest.
}
it := c.ListExternalApis(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.(*apihubpb.ListExternalApisResponse)
}
}
all
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.ListExternalApisRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#ListExternalApisRequest.
}
for resp, err := range c.ListExternalApis(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) ListLocations
func (c *Client) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service.
Examples
package main
import (
"context"
apihub "cloud.google.com/go/apihub/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 := apihub.NewRESTClient(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"
apihub "cloud.google.com/go/apihub/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 := apihub.NewRESTClient(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.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) ListOperations
func (c *Client) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Examples
package main
import (
"context"
apihub "cloud.google.com/go/apihub/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 := apihub.NewRESTClient(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"
apihub "cloud.google.com/go/apihub/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 := apihub.NewRESTClient(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.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) ListSpecs
func (c *Client) ListSpecs(ctx context.Context, req *apihubpb.ListSpecsRequest, opts ...gax.CallOption) *SpecIterator
ListSpecs list specs corresponding to a particular API resource.
Examples
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
"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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.ListSpecsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#ListSpecsRequest.
}
it := c.ListSpecs(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.(*apihubpb.ListSpecsResponse)
}
}
all
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.ListSpecsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#ListSpecsRequest.
}
for resp, err := range c.ListSpecs(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) ListVersions
func (c *Client) ListVersions(ctx context.Context, req *apihubpb.ListVersionsRequest, opts ...gax.CallOption) *VersionIterator
ListVersions list API versions of an API resource in the API hub.
Examples
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
"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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.ListVersionsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#ListVersionsRequest.
}
it := c.ListVersions(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.(*apihubpb.ListVersionsResponse)
}
}
all
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.ListVersionsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#ListVersionsRequest.
}
for resp, err := range c.ListVersions(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) SearchResources
func (c *Client) SearchResources(ctx context.Context, req *apihubpb.SearchResourcesRequest, opts ...gax.CallOption) *SearchResultIterator
SearchResources search across API-Hub resources.
Examples
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
"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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.SearchResourcesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#SearchResourcesRequest.
}
it := c.SearchResources(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.(*apihubpb.SearchResourcesResponse)
}
}
all
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.SearchResourcesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#SearchResourcesRequest.
}
for resp, err := range c.SearchResources(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) UpdateApi
func (c *Client) UpdateApi(ctx context.Context, req *apihubpb.UpdateApiRequest, opts ...gax.CallOption) (*apihubpb.Api, error)
UpdateApi update an API resource in the API hub. The following fields in the API can be updated:
display_name
description
owner
documentation
target_user
[team][google.cloud.apihub.v1.Api.team (at http://google.cloud.apihub.v1.Api.team)]
business_unit
maturity_level
attributes
The update_mask should be used to specify the fields being updated.
Updating the owner field requires complete owner message and updates both owner and email fields.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.UpdateApiRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#UpdateApiRequest.
}
resp, err := c.UpdateApi(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) UpdateAttribute
func (c *Client) UpdateAttribute(ctx context.Context, req *apihubpb.UpdateAttributeRequest, opts ...gax.CallOption) (*apihubpb.Attribute, error)
UpdateAttribute update the attribute. The following fields in the [Attribute resource][google.cloud.apihub.v1.Attribute] can be updated:
display_name
The display name can be updated for user defined attributes only.
description
The description can be updated for user defined attributes only.
allowed_values
To update the list of allowed values, clients need to use the fetched list
of allowed values and add or remove values to or from the same list.
The mutable allowed values can be updated for both user defined and System
defined attributes. The immutable allowed values cannot be updated or
deleted. The updated list of allowed values cannot be empty. If an allowed
value that is already used by some resource’s attribute is deleted, then
the association between the resource and the attribute value will also be
deleted.
cardinality
The cardinality can be updated for user defined attributes only.
Cardinality can only be increased during an update.
The update_mask should be used to specify the fields being updated.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.UpdateAttributeRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#UpdateAttributeRequest.
}
resp, err := c.UpdateAttribute(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) UpdateDeployment
func (c *Client) UpdateDeployment(ctx context.Context, req *apihubpb.UpdateDeploymentRequest, opts ...gax.CallOption) (*apihubpb.Deployment, error)
UpdateDeployment update a deployment resource in the API hub. The following fields in the [deployment resource][google.cloud.apihub.v1.Deployment] can be updated:
display_name
description
documentation
deployment_type
resource_uri
endpoints
slo
environment
attributes
The update_mask should be used to specify the fields being updated.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.UpdateDeploymentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#UpdateDeploymentRequest.
}
resp, err := c.UpdateDeployment(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) UpdateExternalApi
func (c *Client) UpdateExternalApi(ctx context.Context, req *apihubpb.UpdateExternalApiRequest, opts ...gax.CallOption) (*apihubpb.ExternalApi, error)
UpdateExternalApi update an External API resource in the API hub. The following fields can be updated:
display_name
description
documentation
endpoints
paths
The update_mask should be used to specify the fields being updated.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.UpdateExternalApiRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#UpdateExternalApiRequest.
}
resp, err := c.UpdateExternalApi(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) UpdateSpec
func (c *Client) UpdateSpec(ctx context.Context, req *apihubpb.UpdateSpecRequest, opts ...gax.CallOption) (*apihubpb.Spec, error)
UpdateSpec update spec. The following fields in the spec can be updated:
display_name
source_uri
lint_response
attributes
contents
spec_type
In case of an OAS spec, updating spec contents can lead to:
Creation, deletion and update of operations.
Creation, deletion and update of definitions.
Update of other info parsed out from the new spec.
In case of contents or source_uri being present in update mask, spec_type must also be present. Also, spec_type can not be present in update mask if contents or source_uri is not present.
The update_mask should be used to specify the fields being updated.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.UpdateSpecRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#UpdateSpecRequest.
}
resp, err := c.UpdateSpec(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) UpdateVersion
func (c *Client) UpdateVersion(ctx context.Context, req *apihubpb.UpdateVersionRequest, opts ...gax.CallOption) (*apihubpb.Version, error)
UpdateVersion update API version. The following fields in the version can be updated currently:
display_name
description
documentation
deployments
lifecycle
compliance
accreditation
attributes
The update_mask should be used to specify the fields being updated.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/apiv1"
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb"
)
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 := apihub.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apihubpb.UpdateVersionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#UpdateVersionRequest.
}
resp, err := c.UpdateVersion(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
CreateApiHubInstanceOperation
type CreateApiHubInstanceOperation struct {
// contains filtered or unexported fields
}
CreateApiHubInstanceOperation manages a long-running operation from CreateApiHubInstance.
func (*CreateApiHubInstanceOperation) Done
func (op *CreateApiHubInstanceOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*CreateApiHubInstanceOperation) Metadata
func (op *CreateApiHubInstanceOperation) Metadata() (*apihubpb.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 (*CreateApiHubInstanceOperation) Name
func (op *CreateApiHubInstanceOperation) Name() string
Name 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 (*CreateApiHubInstanceOperation) Poll
func (op *CreateApiHubInstanceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*apihubpb.ApiHubInstance, 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 (*CreateApiHubInstanceOperation) Wait
func (op *CreateApiHubInstanceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*apihubpb.ApiHubInstance, 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.
DependencyIterator
type DependencyIterator 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 []*apihubpb.Dependency, nextPageToken string, err error)
// contains filtered or unexported fields
}
DependencyIterator manages a stream of *apihubpb.Dependency.
func (*DependencyIterator) All
func (it *DependencyIterator) All() iter.Seq2[*apihubpb.Dependency, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*DependencyIterator) Next
func (it *DependencyIterator) Next() (*apihubpb.Dependency, 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 (*DependencyIterator) PageInfo
func (it *DependencyIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
DeploymentIterator
type DeploymentIterator 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 []*apihubpb.Deployment, nextPageToken string, err error)
// contains filtered or unexported fields
}
DeploymentIterator manages a stream of *apihubpb.Deployment.
func (*DeploymentIterator) All
func (it *DeploymentIterator) All() iter.Seq2[*apihubpb.Deployment, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*DeploymentIterator) Next
func (it *DeploymentIterator) Next() (*apihubpb.Deployment, 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 (*DeploymentIterator) PageInfo
func (it *DeploymentIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
ExternalApiIterator
type ExternalApiIterator 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 []*apihubpb.ExternalApi, nextPageToken string, err error)
// contains filtered or unexported fields
}
ExternalApiIterator manages a stream of *apihubpb.ExternalApi.
func (*ExternalApiIterator) All
func (it *ExternalApiIterator) All() iter.Seq2[*apihubpb.ExternalApi, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*ExternalApiIterator) Next
func (it *ExternalApiIterator) Next() (*apihubpb.ExternalApi, 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 (*ExternalApiIterator) PageInfo
func (it *ExternalApiIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
HostProjectRegistrationCallOptions
type HostProjectRegistrationCallOptions struct {
CreateHostProjectRegistration []gax.CallOption
GetHostProjectRegistration []gax.CallOption
ListHostProjectRegistrations []gax.CallOption
GetLocation []gax.CallOption
ListLocations []gax.CallOption
CancelOperation []gax.CallOption
DeleteOperation []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
HostProjectRegistrationCallOptions contains the retry settings for each method of HostProjectRegistrationClient.
HostProjectRegistrationClient
type HostProjectRegistrationClient struct {
// The call options for this service.
CallOptions *HostProjectRegistrationCallOptions
// contains filtered or unexported fields
}
HostProjectRegistrationClient is a client for interacting with API hub API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
This service is used for managing the host project registrations.
func NewHostProjectRegistrationRESTClient
func NewHostProjectRegistrationRESTClient(ctx context.Context, opts ...option.ClientOption) (*HostProjectRegistrationClient, error)
NewHostProjectRegistrationRESTClient creates a new host project registration service rest client.
This service is used for managing the host project registrations.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/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 := apihub.NewHostProjectRegistrationRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*HostProjectRegistrationClient) CancelOperation
func (c *HostProjectRegistrationClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
apihub "cloud.google.com/go/apihub/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 := apihub.NewHostProjectRegistrationRESTClient(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 (*HostProjectRegistrationClient) Close
func (c *HostProjectRegistrationClient) Close()