Network Connectivity API v1alpha1 - Package cloud.google.com/go/networkconnectivity/apiv1alpha1 (v0.90.0)

Package networkconnectivity is an auto-generated package for the Network Connectivity API.

The Network Connectivity API will be home to various services which provide information pertaining to network connectivity.

NOTE: This package is in alpha. It is not stable, and is likely to change.

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.

For information about setting deadlines, reusing contexts, and more please visit https://pkg.go.dev/cloud.google.com/go.

Functions

func DefaultAuthScopes

func DefaultAuthScopes() []string

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

CreateHubOperation

type CreateHubOperation struct {
	// contains filtered or unexported fields
}

CreateHubOperation manages a long-running operation from CreateHub.

func (*CreateHubOperation) Done

func (op *CreateHubOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*CreateHubOperation) Metadata

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 (*CreateHubOperation) Name

func (op *CreateHubOperation) 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 (*CreateHubOperation) Poll

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 (*CreateHubOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

CreateSpokeOperation

type CreateSpokeOperation struct {
	// contains filtered or unexported fields
}

CreateSpokeOperation manages a long-running operation from CreateSpoke.

func (*CreateSpokeOperation) Done

func (op *CreateSpokeOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*CreateSpokeOperation) Metadata

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 (*CreateSpokeOperation) Name

func (op *CreateSpokeOperation) 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 (*CreateSpokeOperation) Poll

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 (*CreateSpokeOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

DeleteHubOperation

type DeleteHubOperation struct {
	// contains filtered or unexported fields
}

DeleteHubOperation manages a long-running operation from DeleteHub.

func (*DeleteHubOperation) Done

func (op *DeleteHubOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*DeleteHubOperation) Metadata

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 (*DeleteHubOperation) Name

func (op *DeleteHubOperation) 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 (*DeleteHubOperation) Poll

func (op *DeleteHubOperation) Poll(ctx context.Context, opts ...gax.CallOption) 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 (*DeleteHubOperation) Wait

func (op *DeleteHubOperation) Wait(ctx context.Context, opts ...gax.CallOption) 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.

DeleteSpokeOperation

type DeleteSpokeOperation struct {
	// contains filtered or unexported fields
}

DeleteSpokeOperation manages a long-running operation from DeleteSpoke.

func (*DeleteSpokeOperation) Done

func (op *DeleteSpokeOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*DeleteSpokeOperation) Metadata

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 (*DeleteSpokeOperation) Name

func (op *DeleteSpokeOperation) 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 (*DeleteSpokeOperation) Poll

func (op *DeleteSpokeOperation) Poll(ctx context.Context, opts ...gax.CallOption) 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 (*DeleteSpokeOperation) Wait

func (op *DeleteSpokeOperation) Wait(ctx context.Context, opts ...gax.CallOption) 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.

HubCallOptions

type HubCallOptions struct {
	ListHubs    []gax.CallOption
	GetHub      []gax.CallOption
	CreateHub   []gax.CallOption
	UpdateHub   []gax.CallOption
	DeleteHub   []gax.CallOption
	ListSpokes  []gax.CallOption
	GetSpoke    []gax.CallOption
	CreateSpoke []gax.CallOption
	UpdateSpoke []gax.CallOption
	DeleteSpoke []gax.CallOption
}

HubCallOptions contains the retry settings for each method of HubClient.

HubClient

type HubClient struct {

	// The call options for this service.
	CallOptions *HubCallOptions

	// LROClient is used internally to handle long-running operations.
	// It is exposed so that its CallOptions can be modified if required.
	// Users should not Close this client.
	LROClient *lroauto.OperationsClient
	// contains filtered or unexported fields
}

HubClient is a client for interacting with Network Connectivity API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

Network Connectivity Center is a hub-and-spoke abstraction for network connectivity management in Google Cloud. It reduces operational complexity through a simple, centralized connectivity management model.

func NewHubClient

func NewHubClient(ctx context.Context, opts ...option.ClientOption) (*HubClient, error)

NewHubClient creates a new hub service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

Network Connectivity Center is a hub-and-spoke abstraction for network connectivity management in Google Cloud. It reduces operational complexity through a simple, centralized connectivity management model.

Example

package main

import (
	"context"

	networkconnectivity "cloud.google.com/go/networkconnectivity/apiv1alpha1"
)

func main() {
	ctx := context.Background()
	c, err := networkconnectivity.NewHubClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func (*HubClient) Close

func (c *HubClient) Close() error

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

func (*HubClient) Connection

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

Connection returns a connection to the API service.

Deprecated.

func (*HubClient) CreateHub

CreateHub creates a new Hub in a given project and location.

Example

package main

import (
	"context"

	networkconnectivity "cloud.google.com/go/networkconnectivity/apiv1alpha1"

	networkconnectivitypb "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1alpha1"
)

func main() {
	ctx := context.Background()
	c, err := networkconnectivity.NewHubClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &networkconnectivitypb.CreateHubRequest{
		// TODO: Fill request struct fields.
	}
	op, err := c.CreateHub(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*HubClient) CreateHubOperation

func (c *HubClient) CreateHubOperation(name string) *CreateHubOperation

CreateHubOperation returns a new CreateHubOperation from a given name. The name must be that of a previously created CreateHubOperation, possibly from a different process.

func (*HubClient) CreateSpoke

CreateSpoke creates a new Spoke in a given project and location.

Example

package main

import (
	"context"

	networkconnectivity "cloud.google.com/go/networkconnectivity/apiv1alpha1"

	networkconnectivitypb "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1alpha1"
)

func main() {
	ctx := context.Background()
	c, err := networkconnectivity.NewHubClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &networkconnectivitypb.CreateSpokeRequest{
		// TODO: Fill request struct fields.
	}
	op, err := c.CreateSpoke(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*HubClient) CreateSpokeOperation

func (c *HubClient) CreateSpokeOperation(name string) *CreateSpokeOperation

CreateSpokeOperation returns a new CreateSpokeOperation from a given name. The name must be that of a previously created CreateSpokeOperation, possibly from a different process.

func (*HubClient) DeleteHub

DeleteHub deletes a single Hub.

Example

package main

import (
	"context"

	networkconnectivity "cloud.google.com/go/networkconnectivity/apiv1alpha1"

	networkconnectivitypb "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1alpha1"
)

func main() {
	ctx := context.Background()
	c, err := networkconnectivity.NewHubClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &networkconnectivitypb.DeleteHubRequest{
		// TODO: Fill request struct fields.
	}
	op, err := c.DeleteHub(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	err = op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
}

func (*HubClient) DeleteHubOperation

func (c *HubClient) DeleteHubOperation(name string) *DeleteHubOperation

DeleteHubOperation returns a new DeleteHubOperation from a given name. The name must be that of a previously created DeleteHubOperation, possibly from a different process.

func (*HubClient) DeleteSpoke

DeleteSpoke deletes a single Spoke.

Example

package main

import (
	"context"

	networkconnectivity "cloud.google.com/go/networkconnectivity/apiv1alpha1"

	networkconnectivitypb "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1alpha1"
)

func main() {
	ctx := context.Background()
	c, err := networkconnectivity.NewHubClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &networkconnectivitypb.DeleteSpokeRequest{
		// TODO: Fill request struct fields.
	}
	op, err := c.DeleteSpoke(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	err = op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
}

func (*HubClient) DeleteSpokeOperation

func (c *HubClient) DeleteSpokeOperation(name string) *DeleteSpokeOperation

DeleteSpokeOperation returns a new DeleteSpokeOperation from a given name. The name must be that of a previously created DeleteSpokeOperation, possibly from a different process.

func (*HubClient) GetHub

GetHub gets details of a single Hub.

Example

package main

import (
	"context"

	networkconnectivity "cloud.google.com/go/networkconnectivity/apiv1alpha1"

	networkconnectivitypb "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1alpha1"
)

func main() {
	ctx := context.Background()
	c, err := networkconnectivity.NewHubClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &networkconnectivitypb.GetHubRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.GetHub(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*HubClient) GetSpoke

GetSpoke gets details of a single Spoke.

Example

package main

import (
	"context"

	networkconnectivity "cloud.google.com/go/networkconnectivity/apiv1alpha1"

	networkconnectivitypb "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1alpha1"
)

func main() {
	ctx := context.Background()
	c, err := networkconnectivity.NewHubClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &networkconnectivitypb.GetSpokeRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.GetSpoke(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*HubClient) ListHubs

ListHubs lists Hubs in a given project and location.

Example

package main

import (
	"context"

	networkconnectivity "cloud.google.com/go/networkconnectivity/apiv1alpha1"
	"google.golang.org/api/iterator"

	networkconnectivitypb "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1alpha1"
)

func main() {
	ctx := context.Background()
	c, err := networkconnectivity.NewHubClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &networkconnectivitypb.ListHubsRequest{
		// TODO: Fill request struct fields.
	}
	it := c.ListHubs(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}

func (*HubClient) ListSpokes

ListSpokes lists Spokes in a given project and location.

Example

package main

import (
	"context"

	networkconnectivity "cloud.google.com/go/networkconnectivity/apiv1alpha1"
	"google.golang.org/api/iterator"

	networkconnectivitypb "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1alpha1"
)

func main() {
	ctx := context.Background()
	c, err := networkconnectivity.NewHubClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &networkconnectivitypb.ListSpokesRequest{
		// TODO: Fill request struct fields.
	}
	it := c.ListSpokes(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}

func (*HubClient) UpdateHub

UpdateHub updates the parameters of a single Hub.

Example

package main

import (
	"context"

	networkconnectivity "cloud.google.com/go/networkconnectivity/apiv1alpha1"

	networkconnectivitypb "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1alpha1"
)

func main() {
	ctx := context.Background()
	c, err := networkconnectivity.NewHubClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &networkconnectivitypb.UpdateHubRequest{
		// TODO: Fill request struct fields.
	}
	op, err := c.UpdateHub(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*HubClient) UpdateHubOperation

func (c *HubClient) UpdateHubOperation(name string) *UpdateHubOperation

UpdateHubOperation returns a new UpdateHubOperation from a given name. The name must be that of a previously created UpdateHubOperation, possibly from a different process.

func (*HubClient) UpdateSpoke

UpdateSpoke updates the parameters of a single Spoke.

Example

package main

import (
	"context"

	networkconnectivity "cloud.google.com/go/networkconnectivity/apiv1alpha1"

	networkconnectivitypb "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1alpha1"
)

func main() {
	ctx := context.Background()
	c, err := networkconnectivity.NewHubClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &networkconnectivitypb.UpdateSpokeRequest{
		// TODO: Fill request struct fields.
	}
	op, err := c.UpdateSpoke(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*HubClient) UpdateSpokeOperation

func (c *HubClient) UpdateSpokeOperation(name string) *UpdateSpokeOperation

UpdateSpokeOperation returns a new UpdateSpokeOperation from a given name. The name must be that of a previously created UpdateSpokeOperation, possibly from a different process.

HubIterator

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

HubIterator manages a stream of *networkconnectivitypb.Hub.

func (*HubIterator) Next

func (it *HubIterator) Next() (*networkconnectivitypb.Hub, 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 (*HubIterator) PageInfo

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

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

SpokeIterator

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

SpokeIterator manages a stream of *networkconnectivitypb.Spoke.

func (*SpokeIterator) Next

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*SpokeIterator) PageInfo

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

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

UpdateHubOperation

type UpdateHubOperation struct {
	// contains filtered or unexported fields
}

UpdateHubOperation manages a long-running operation from UpdateHub.

func (*UpdateHubOperation) Done

func (op *UpdateHubOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*UpdateHubOperation) Metadata

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 (*UpdateHubOperation) Name

func (op *UpdateHubOperation) 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 (*UpdateHubOperation) Poll

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 (*UpdateHubOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

UpdateSpokeOperation

type UpdateSpokeOperation struct {
	// contains filtered or unexported fields
}

UpdateSpokeOperation manages a long-running operation from UpdateSpoke.

func (*UpdateSpokeOperation) Done

func (op *UpdateSpokeOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*UpdateSpokeOperation) Metadata

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 (*UpdateSpokeOperation) Name

func (op *UpdateSpokeOperation) 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 (*UpdateSpokeOperation) Poll

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 (*UpdateSpokeOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.