Documentation ¶
Overview ¶
Package networkconnectivity is an auto-generated package for the Network Connectivity API.
The Network Connectivity API provides access to Network Connectivity Center.
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 := networkconnectivity.NewHubClient(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 := networkconnectivity.NewHubClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkconnectivitypb.ListHubsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1#ListHubsRequest. } 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 }
Use of Context ¶
The ctx passed to NewHubClient 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.
Index ¶
- func DefaultAuthScopes() []string
- type CreateHubOperation
- func (op *CreateHubOperation) Done() bool
- func (op *CreateHubOperation) Metadata() (*networkconnectivitypb.OperationMetadata, error)
- func (op *CreateHubOperation) Name() string
- func (op *CreateHubOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*networkconnectivitypb.Hub, error)
- func (op *CreateHubOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*networkconnectivitypb.Hub, error)
- type CreateSpokeOperation
- func (op *CreateSpokeOperation) Done() bool
- func (op *CreateSpokeOperation) Metadata() (*networkconnectivitypb.OperationMetadata, error)
- func (op *CreateSpokeOperation) Name() string
- func (op *CreateSpokeOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*networkconnectivitypb.Spoke, error)
- func (op *CreateSpokeOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*networkconnectivitypb.Spoke, error)
- type DeleteHubOperation
- func (op *DeleteHubOperation) Done() bool
- func (op *DeleteHubOperation) Metadata() (*networkconnectivitypb.OperationMetadata, error)
- func (op *DeleteHubOperation) Name() string
- func (op *DeleteHubOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
- func (op *DeleteHubOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
- type DeleteSpokeOperation
- func (op *DeleteSpokeOperation) Done() bool
- func (op *DeleteSpokeOperation) Metadata() (*networkconnectivitypb.OperationMetadata, error)
- func (op *DeleteSpokeOperation) Name() string
- func (op *DeleteSpokeOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
- func (op *DeleteSpokeOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
- type HubCallOptions
- type HubClient
- func (c *HubClient) Close() error
- func (c *HubClient) Connection() *grpc.ClientConndeprecated
- func (c *HubClient) CreateHub(ctx context.Context, req *networkconnectivitypb.CreateHubRequest, ...) (*CreateHubOperation, error)
- func (c *HubClient) CreateHubOperation(name string) *CreateHubOperation
- func (c *HubClient) CreateSpoke(ctx context.Context, req *networkconnectivitypb.CreateSpokeRequest, ...) (*CreateSpokeOperation, error)
- func (c *HubClient) CreateSpokeOperation(name string) *CreateSpokeOperation
- func (c *HubClient) DeleteHub(ctx context.Context, req *networkconnectivitypb.DeleteHubRequest, ...) (*DeleteHubOperation, error)
- func (c *HubClient) DeleteHubOperation(name string) *DeleteHubOperation
- func (c *HubClient) DeleteSpoke(ctx context.Context, req *networkconnectivitypb.DeleteSpokeRequest, ...) (*DeleteSpokeOperation, error)
- func (c *HubClient) DeleteSpokeOperation(name string) *DeleteSpokeOperation
- func (c *HubClient) GetHub(ctx context.Context, req *networkconnectivitypb.GetHubRequest, ...) (*networkconnectivitypb.Hub, error)
- func (c *HubClient) GetSpoke(ctx context.Context, req *networkconnectivitypb.GetSpokeRequest, ...) (*networkconnectivitypb.Spoke, error)
- func (c *HubClient) ListHubs(ctx context.Context, req *networkconnectivitypb.ListHubsRequest, ...) *HubIterator
- func (c *HubClient) ListSpokes(ctx context.Context, req *networkconnectivitypb.ListSpokesRequest, ...) *SpokeIterator
- func (c *HubClient) UpdateHub(ctx context.Context, req *networkconnectivitypb.UpdateHubRequest, ...) (*UpdateHubOperation, error)
- func (c *HubClient) UpdateHubOperation(name string) *UpdateHubOperation
- func (c *HubClient) UpdateSpoke(ctx context.Context, req *networkconnectivitypb.UpdateSpokeRequest, ...) (*UpdateSpokeOperation, error)
- func (c *HubClient) UpdateSpokeOperation(name string) *UpdateSpokeOperation
- type HubIterator
- type SpokeIterator
- type UpdateHubOperation
- func (op *UpdateHubOperation) Done() bool
- func (op *UpdateHubOperation) Metadata() (*networkconnectivitypb.OperationMetadata, error)
- func (op *UpdateHubOperation) Name() string
- func (op *UpdateHubOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*networkconnectivitypb.Hub, error)
- func (op *UpdateHubOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*networkconnectivitypb.Hub, error)
- type UpdateSpokeOperation
- func (op *UpdateSpokeOperation) Done() bool
- func (op *UpdateSpokeOperation) Metadata() (*networkconnectivitypb.OperationMetadata, error)
- func (op *UpdateSpokeOperation) Name() string
- func (op *UpdateSpokeOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*networkconnectivitypb.Spoke, error)
- func (op *UpdateSpokeOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*networkconnectivitypb.Spoke, error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultAuthScopes ¶
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
Types ¶
type 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 ¶
func (op *CreateHubOperation) Metadata() (*networkconnectivitypb.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 (*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 ¶
func (op *CreateHubOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*networkconnectivitypb.Hub, 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 (*CreateHubOperation) Wait ¶
func (op *CreateHubOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*networkconnectivitypb.Hub, 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.
type 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 ¶
func (op *CreateSpokeOperation) Metadata() (*networkconnectivitypb.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 (*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 ¶
func (op *CreateSpokeOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*networkconnectivitypb.Spoke, 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 (*CreateSpokeOperation) Wait ¶
func (op *CreateSpokeOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*networkconnectivitypb.Spoke, 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.
type 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 ¶
func (op *DeleteHubOperation) Metadata() (*networkconnectivitypb.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 (*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.
type 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 ¶
func (op *DeleteSpokeOperation) Metadata() (*networkconnectivitypb.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 (*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.
type 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.
type 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 ¶
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/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 := networkconnectivity.NewHubClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func (*HubClient) Close ¶
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*HubClient) Connection
deprecated
func (c *HubClient) 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 (*HubClient) CreateHub ¶
func (c *HubClient) CreateHub(ctx context.Context, req *networkconnectivitypb.CreateHubRequest, opts ...gax.CallOption) (*CreateHubOperation, error)
CreateHub creates a new hub in the specified project.
Example ¶
package main import ( "context" networkconnectivity "cloud.google.com/go/networkconnectivity/apiv1" networkconnectivitypb "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1" ) 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 := networkconnectivity.NewHubClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkconnectivitypb.CreateHubRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1#CreateHubRequest. } 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 }
Output:
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 ¶
func (c *HubClient) CreateSpoke(ctx context.Context, req *networkconnectivitypb.CreateSpokeRequest, opts ...gax.CallOption) (*CreateSpokeOperation, error)
CreateSpoke creates a spoke in the specified project and location.
Example ¶
package main import ( "context" networkconnectivity "cloud.google.com/go/networkconnectivity/apiv1" networkconnectivitypb "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1" ) 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 := networkconnectivity.NewHubClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkconnectivitypb.CreateSpokeRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1#CreateSpokeRequest. } 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 }
Output:
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 ¶
func (c *HubClient) DeleteHub(ctx context.Context, req *networkconnectivitypb.DeleteHubRequest, opts ...gax.CallOption) (*DeleteHubOperation, error)
DeleteHub deletes the specified hub.
Example ¶
package main import ( "context" networkconnectivity "cloud.google.com/go/networkconnectivity/apiv1" networkconnectivitypb "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1" ) 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 := networkconnectivity.NewHubClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkconnectivitypb.DeleteHubRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1#DeleteHubRequest. } op, err := c.DeleteHub(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) if err != nil { // TODO: Handle error. } }
Output:
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 ¶
func (c *HubClient) DeleteSpoke(ctx context.Context, req *networkconnectivitypb.DeleteSpokeRequest, opts ...gax.CallOption) (*DeleteSpokeOperation, error)
DeleteSpoke deletes the specified spoke.
Example ¶
package main import ( "context" networkconnectivity "cloud.google.com/go/networkconnectivity/apiv1" networkconnectivitypb "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1" ) 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 := networkconnectivity.NewHubClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkconnectivitypb.DeleteSpokeRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1#DeleteSpokeRequest. } op, err := c.DeleteSpoke(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) if err != nil { // TODO: Handle error. } }
Output:
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 ¶
func (c *HubClient) GetHub(ctx context.Context, req *networkconnectivitypb.GetHubRequest, opts ...gax.CallOption) (*networkconnectivitypb.Hub, error)
GetHub gets details about the specified hub.
Example ¶
package main import ( "context" networkconnectivity "cloud.google.com/go/networkconnectivity/apiv1" networkconnectivitypb "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1" ) 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 := networkconnectivity.NewHubClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkconnectivitypb.GetHubRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1#GetHubRequest. } resp, err := c.GetHub(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*HubClient) GetSpoke ¶
func (c *HubClient) GetSpoke(ctx context.Context, req *networkconnectivitypb.GetSpokeRequest, opts ...gax.CallOption) (*networkconnectivitypb.Spoke, error)
GetSpoke gets details about the specified spoke.
Example ¶
package main import ( "context" networkconnectivity "cloud.google.com/go/networkconnectivity/apiv1" networkconnectivitypb "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1" ) 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 := networkconnectivity.NewHubClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkconnectivitypb.GetSpokeRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1#GetSpokeRequest. } resp, err := c.GetSpoke(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*HubClient) ListHubs ¶
func (c *HubClient) ListHubs(ctx context.Context, req *networkconnectivitypb.ListHubsRequest, opts ...gax.CallOption) *HubIterator
ListHubs lists hubs in a given project.
Example ¶
package main import ( "context" networkconnectivity "cloud.google.com/go/networkconnectivity/apiv1" "google.golang.org/api/iterator" networkconnectivitypb "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1" ) 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 := networkconnectivity.NewHubClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkconnectivitypb.ListHubsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1#ListHubsRequest. } 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 } }
Output:
func (*HubClient) ListSpokes ¶
func (c *HubClient) ListSpokes(ctx context.Context, req *networkconnectivitypb.ListSpokesRequest, opts ...gax.CallOption) *SpokeIterator
ListSpokes lists the spokes in the specified project and location.
Example ¶
package main import ( "context" networkconnectivity "cloud.google.com/go/networkconnectivity/apiv1" "google.golang.org/api/iterator" networkconnectivitypb "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1" ) 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 := networkconnectivity.NewHubClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkconnectivitypb.ListSpokesRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1#ListSpokesRequest. } 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 } }
Output:
func (*HubClient) UpdateHub ¶
func (c *HubClient) UpdateHub(ctx context.Context, req *networkconnectivitypb.UpdateHubRequest, opts ...gax.CallOption) (*UpdateHubOperation, error)
UpdateHub updates the description and/or labels of the specified hub.
Example ¶
package main import ( "context" networkconnectivity "cloud.google.com/go/networkconnectivity/apiv1" networkconnectivitypb "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1" ) 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 := networkconnectivity.NewHubClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkconnectivitypb.UpdateHubRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1#UpdateHubRequest. } 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 }
Output:
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 ¶
func (c *HubClient) UpdateSpoke(ctx context.Context, req *networkconnectivitypb.UpdateSpokeRequest, opts ...gax.CallOption) (*UpdateSpokeOperation, error)
UpdateSpoke updates the parameters of the specified spoke.
Example ¶
package main import ( "context" networkconnectivity "cloud.google.com/go/networkconnectivity/apiv1" networkconnectivitypb "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1" ) 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 := networkconnectivity.NewHubClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkconnectivitypb.UpdateSpokeRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1#UpdateSpokeRequest. } 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 }
Output:
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.
type 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.
type 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 ¶
func (it *SpokeIterator) Next() (*networkconnectivitypb.Spoke, 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 (*SpokeIterator) PageInfo ¶
func (it *SpokeIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type 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 ¶
func (op *UpdateHubOperation) Metadata() (*networkconnectivitypb.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 (*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 ¶
func (op *UpdateHubOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*networkconnectivitypb.Hub, 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 (*UpdateHubOperation) Wait ¶
func (op *UpdateHubOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*networkconnectivitypb.Hub, 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.
type 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 ¶
func (op *UpdateSpokeOperation) Metadata() (*networkconnectivitypb.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 (*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 ¶
func (op *UpdateSpokeOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*networkconnectivitypb.Spoke, 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 (*UpdateSpokeOperation) Wait ¶
func (op *UpdateSpokeOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*networkconnectivitypb.Spoke, 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.