Documentation
¶
Overview ¶
Package networkmanagement is an auto-generated package for the Network Management API.
The Network Management API provides a collection of network performance monitoring and diagnostic capabilities.
General documentation ¶
For information that is relevant for all client libraries please reference https://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on this page includes:
- Authentication and Authorization
- Timeouts and Cancellation
- Testing against Client Libraries
- Debugging Client Libraries
- Inspecting errors
Example usage ¶
To get started with this package, create a client.
// go get cloud.google.com/go/networkmanagement/apiv1@latest ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := networkmanagement.NewReachabilityClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close()
The client will use your default application credentials. Clients should be reused instead of created as needed. The methods of Client are safe for concurrent use by multiple goroutines. The returned client must be Closed when it is done being used.
Using the Client ¶
The following is an example of making an API call with the newly created client, mentioned above.
req := &networkmanagementpb.CreateConnectivityTestRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb#CreateConnectivityTestRequest. } op, err := c.CreateConnectivityTest(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Use of Context ¶
The ctx passed to NewReachabilityClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.
To close the open connection, use the Close() method.
Index ¶
- func DefaultAuthScopes() []string
- type ConnectivityTestIterator
- type CreateConnectivityTestOperation
- func (op *CreateConnectivityTestOperation) Done() bool
- func (op *CreateConnectivityTestOperation) Metadata() (*networkmanagementpb.OperationMetadata, error)
- func (op *CreateConnectivityTestOperation) Name() string
- func (op *CreateConnectivityTestOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*networkmanagementpb.ConnectivityTest, error)
- func (op *CreateConnectivityTestOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*networkmanagementpb.ConnectivityTest, error)
- type CreateVpcFlowLogsConfigOperation
- func (op *CreateVpcFlowLogsConfigOperation) Done() bool
- func (op *CreateVpcFlowLogsConfigOperation) Metadata() (*networkmanagementpb.OperationMetadata, error)
- func (op *CreateVpcFlowLogsConfigOperation) Name() string
- func (op *CreateVpcFlowLogsConfigOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*networkmanagementpb.VpcFlowLogsConfig, error)
- func (op *CreateVpcFlowLogsConfigOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*networkmanagementpb.VpcFlowLogsConfig, error)
- type DeleteConnectivityTestOperation
- func (op *DeleteConnectivityTestOperation) Done() bool
- func (op *DeleteConnectivityTestOperation) Metadata() (*networkmanagementpb.OperationMetadata, error)
- func (op *DeleteConnectivityTestOperation) Name() string
- func (op *DeleteConnectivityTestOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
- func (op *DeleteConnectivityTestOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
- type DeleteVpcFlowLogsConfigOperation
- func (op *DeleteVpcFlowLogsConfigOperation) Done() bool
- func (op *DeleteVpcFlowLogsConfigOperation) Metadata() (*networkmanagementpb.OperationMetadata, error)
- func (op *DeleteVpcFlowLogsConfigOperation) Name() string
- func (op *DeleteVpcFlowLogsConfigOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
- func (op *DeleteVpcFlowLogsConfigOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
- type LocationIterator
- type OperationIterator
- type ReachabilityCallOptions
- type ReachabilityClient
- func (c *ReachabilityClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, ...) error
- func (c *ReachabilityClient) Close() error
- func (c *ReachabilityClient) Connection() *grpc.ClientConndeprecated
- func (c *ReachabilityClient) CreateConnectivityTest(ctx context.Context, req *networkmanagementpb.CreateConnectivityTestRequest, ...) (*CreateConnectivityTestOperation, error)
- func (c *ReachabilityClient) CreateConnectivityTestOperation(name string) *CreateConnectivityTestOperation
- func (c *ReachabilityClient) DeleteConnectivityTest(ctx context.Context, req *networkmanagementpb.DeleteConnectivityTestRequest, ...) (*DeleteConnectivityTestOperation, error)
- func (c *ReachabilityClient) DeleteConnectivityTestOperation(name string) *DeleteConnectivityTestOperation
- func (c *ReachabilityClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, ...) error
- func (c *ReachabilityClient) GetConnectivityTest(ctx context.Context, req *networkmanagementpb.GetConnectivityTestRequest, ...) (*networkmanagementpb.ConnectivityTest, error)
- func (c *ReachabilityClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
- func (c *ReachabilityClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, ...) (*locationpb.Location, error)
- func (c *ReachabilityClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, ...) (*longrunningpb.Operation, error)
- func (c *ReachabilityClient) ListConnectivityTests(ctx context.Context, req *networkmanagementpb.ListConnectivityTestsRequest, ...) *ConnectivityTestIterator
- func (c *ReachabilityClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, ...) *LocationIterator
- func (c *ReachabilityClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, ...) *OperationIterator
- func (c *ReachabilityClient) RerunConnectivityTest(ctx context.Context, req *networkmanagementpb.RerunConnectivityTestRequest, ...) (*RerunConnectivityTestOperation, error)
- func (c *ReachabilityClient) RerunConnectivityTestOperation(name string) *RerunConnectivityTestOperation
- func (c *ReachabilityClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
- func (c *ReachabilityClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, ...) (*iampb.TestIamPermissionsResponse, error)
- func (c *ReachabilityClient) UpdateConnectivityTest(ctx context.Context, req *networkmanagementpb.UpdateConnectivityTestRequest, ...) (*UpdateConnectivityTestOperation, error)
- func (c *ReachabilityClient) UpdateConnectivityTestOperation(name string) *UpdateConnectivityTestOperation
- type RerunConnectivityTestOperation
- func (op *RerunConnectivityTestOperation) Done() bool
- func (op *RerunConnectivityTestOperation) Metadata() (*networkmanagementpb.OperationMetadata, error)
- func (op *RerunConnectivityTestOperation) Name() string
- func (op *RerunConnectivityTestOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*networkmanagementpb.ConnectivityTest, error)
- func (op *RerunConnectivityTestOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*networkmanagementpb.ConnectivityTest, error)
- type UpdateConnectivityTestOperation
- func (op *UpdateConnectivityTestOperation) Done() bool
- func (op *UpdateConnectivityTestOperation) Metadata() (*networkmanagementpb.OperationMetadata, error)
- func (op *UpdateConnectivityTestOperation) Name() string
- func (op *UpdateConnectivityTestOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*networkmanagementpb.ConnectivityTest, error)
- func (op *UpdateConnectivityTestOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*networkmanagementpb.ConnectivityTest, error)
- type UpdateVpcFlowLogsConfigOperation
- func (op *UpdateVpcFlowLogsConfigOperation) Done() bool
- func (op *UpdateVpcFlowLogsConfigOperation) Metadata() (*networkmanagementpb.OperationMetadata, error)
- func (op *UpdateVpcFlowLogsConfigOperation) Name() string
- func (op *UpdateVpcFlowLogsConfigOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*networkmanagementpb.VpcFlowLogsConfig, error)
- func (op *UpdateVpcFlowLogsConfigOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*networkmanagementpb.VpcFlowLogsConfig, error)
- type VpcFlowLogsCallOptions
- type VpcFlowLogsClient
- func (c *VpcFlowLogsClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, ...) error
- func (c *VpcFlowLogsClient) Close() error
- func (c *VpcFlowLogsClient) Connection() *grpc.ClientConndeprecated
- func (c *VpcFlowLogsClient) CreateVpcFlowLogsConfig(ctx context.Context, req *networkmanagementpb.CreateVpcFlowLogsConfigRequest, ...) (*CreateVpcFlowLogsConfigOperation, error)
- func (c *VpcFlowLogsClient) CreateVpcFlowLogsConfigOperation(name string) *CreateVpcFlowLogsConfigOperation
- func (c *VpcFlowLogsClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, ...) error
- func (c *VpcFlowLogsClient) DeleteVpcFlowLogsConfig(ctx context.Context, req *networkmanagementpb.DeleteVpcFlowLogsConfigRequest, ...) (*DeleteVpcFlowLogsConfigOperation, error)
- func (c *VpcFlowLogsClient) DeleteVpcFlowLogsConfigOperation(name string) *DeleteVpcFlowLogsConfigOperation
- func (c *VpcFlowLogsClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
- func (c *VpcFlowLogsClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, ...) (*locationpb.Location, error)
- func (c *VpcFlowLogsClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, ...) (*longrunningpb.Operation, error)
- func (c *VpcFlowLogsClient) GetVpcFlowLogsConfig(ctx context.Context, req *networkmanagementpb.GetVpcFlowLogsConfigRequest, ...) (*networkmanagementpb.VpcFlowLogsConfig, error)
- func (c *VpcFlowLogsClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, ...) *LocationIterator
- func (c *VpcFlowLogsClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, ...) *OperationIterator
- func (c *VpcFlowLogsClient) ListVpcFlowLogsConfigs(ctx context.Context, req *networkmanagementpb.ListVpcFlowLogsConfigsRequest, ...) *VpcFlowLogsConfigIterator
- func (c *VpcFlowLogsClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
- func (c *VpcFlowLogsClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, ...) (*iampb.TestIamPermissionsResponse, error)
- func (c *VpcFlowLogsClient) UpdateVpcFlowLogsConfig(ctx context.Context, req *networkmanagementpb.UpdateVpcFlowLogsConfigRequest, ...) (*UpdateVpcFlowLogsConfigOperation, error)
- func (c *VpcFlowLogsClient) UpdateVpcFlowLogsConfigOperation(name string) *UpdateVpcFlowLogsConfigOperation
- type VpcFlowLogsConfigIterator
Examples ¶
- NewReachabilityClient
- NewReachabilityRESTClient
- NewVpcFlowLogsClient
- NewVpcFlowLogsRESTClient
- ReachabilityClient.CancelOperation
- ReachabilityClient.CreateConnectivityTest
- ReachabilityClient.DeleteConnectivityTest
- ReachabilityClient.DeleteOperation
- ReachabilityClient.GetConnectivityTest
- ReachabilityClient.GetIamPolicy
- ReachabilityClient.GetLocation
- ReachabilityClient.GetOperation
- ReachabilityClient.ListConnectivityTests
- ReachabilityClient.ListConnectivityTests (All)
- ReachabilityClient.ListLocations
- ReachabilityClient.ListLocations (All)
- ReachabilityClient.ListOperations
- ReachabilityClient.ListOperations (All)
- ReachabilityClient.RerunConnectivityTest
- ReachabilityClient.SetIamPolicy
- ReachabilityClient.TestIamPermissions
- ReachabilityClient.UpdateConnectivityTest
- VpcFlowLogsClient.CancelOperation
- VpcFlowLogsClient.CreateVpcFlowLogsConfig
- VpcFlowLogsClient.DeleteOperation
- VpcFlowLogsClient.DeleteVpcFlowLogsConfig
- VpcFlowLogsClient.GetIamPolicy
- VpcFlowLogsClient.GetLocation
- VpcFlowLogsClient.GetOperation
- VpcFlowLogsClient.GetVpcFlowLogsConfig
- VpcFlowLogsClient.ListLocations
- VpcFlowLogsClient.ListLocations (All)
- VpcFlowLogsClient.ListOperations
- VpcFlowLogsClient.ListOperations (All)
- VpcFlowLogsClient.ListVpcFlowLogsConfigs
- VpcFlowLogsClient.ListVpcFlowLogsConfigs (All)
- VpcFlowLogsClient.SetIamPolicy
- VpcFlowLogsClient.TestIamPermissions
- VpcFlowLogsClient.UpdateVpcFlowLogsConfig
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 ConnectivityTestIterator ¶
type ConnectivityTestIterator 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 []*networkmanagementpb.ConnectivityTest, nextPageToken string, err error) // contains filtered or unexported fields }
ConnectivityTestIterator manages a stream of *networkmanagementpb.ConnectivityTest.
func (*ConnectivityTestIterator) All ¶ added in v1.14.1
func (it *ConnectivityTestIterator) All() iter.Seq2[*networkmanagementpb.ConnectivityTest, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*ConnectivityTestIterator) Next ¶
func (it *ConnectivityTestIterator) Next() (*networkmanagementpb.ConnectivityTest, 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 (*ConnectivityTestIterator) PageInfo ¶
func (it *ConnectivityTestIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type CreateConnectivityTestOperation ¶
type CreateConnectivityTestOperation struct {
// contains filtered or unexported fields
}
CreateConnectivityTestOperation manages a long-running operation from CreateConnectivityTest.
func (*CreateConnectivityTestOperation) Done ¶
func (op *CreateConnectivityTestOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*CreateConnectivityTestOperation) Metadata ¶
func (op *CreateConnectivityTestOperation) Metadata() (*networkmanagementpb.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 (*CreateConnectivityTestOperation) Name ¶
func (op *CreateConnectivityTestOperation) 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 (*CreateConnectivityTestOperation) Poll ¶
func (op *CreateConnectivityTestOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*networkmanagementpb.ConnectivityTest, 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 (*CreateConnectivityTestOperation) Wait ¶
func (op *CreateConnectivityTestOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*networkmanagementpb.ConnectivityTest, 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 CreateVpcFlowLogsConfigOperation ¶ added in v1.18.0
type CreateVpcFlowLogsConfigOperation struct {
// contains filtered or unexported fields
}
CreateVpcFlowLogsConfigOperation manages a long-running operation from CreateVpcFlowLogsConfig.
func (*CreateVpcFlowLogsConfigOperation) Done ¶ added in v1.18.0
func (op *CreateVpcFlowLogsConfigOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*CreateVpcFlowLogsConfigOperation) Metadata ¶ added in v1.18.0
func (op *CreateVpcFlowLogsConfigOperation) Metadata() (*networkmanagementpb.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 (*CreateVpcFlowLogsConfigOperation) Name ¶ added in v1.18.0
func (op *CreateVpcFlowLogsConfigOperation) 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 (*CreateVpcFlowLogsConfigOperation) Poll ¶ added in v1.18.0
func (op *CreateVpcFlowLogsConfigOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*networkmanagementpb.VpcFlowLogsConfig, 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 (*CreateVpcFlowLogsConfigOperation) Wait ¶ added in v1.18.0
func (op *CreateVpcFlowLogsConfigOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*networkmanagementpb.VpcFlowLogsConfig, 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 DeleteConnectivityTestOperation ¶
type DeleteConnectivityTestOperation struct {
// contains filtered or unexported fields
}
DeleteConnectivityTestOperation manages a long-running operation from DeleteConnectivityTest.
func (*DeleteConnectivityTestOperation) Done ¶
func (op *DeleteConnectivityTestOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*DeleteConnectivityTestOperation) Metadata ¶
func (op *DeleteConnectivityTestOperation) Metadata() (*networkmanagementpb.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 (*DeleteConnectivityTestOperation) Name ¶
func (op *DeleteConnectivityTestOperation) 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 (*DeleteConnectivityTestOperation) Poll ¶
func (op *DeleteConnectivityTestOperation) 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 (*DeleteConnectivityTestOperation) Wait ¶
func (op *DeleteConnectivityTestOperation) 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 DeleteVpcFlowLogsConfigOperation ¶ added in v1.18.0
type DeleteVpcFlowLogsConfigOperation struct {
// contains filtered or unexported fields
}
DeleteVpcFlowLogsConfigOperation manages a long-running operation from DeleteVpcFlowLogsConfig.
func (*DeleteVpcFlowLogsConfigOperation) Done ¶ added in v1.18.0
func (op *DeleteVpcFlowLogsConfigOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*DeleteVpcFlowLogsConfigOperation) Metadata ¶ added in v1.18.0
func (op *DeleteVpcFlowLogsConfigOperation) Metadata() (*networkmanagementpb.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 (*DeleteVpcFlowLogsConfigOperation) Name ¶ added in v1.18.0
func (op *DeleteVpcFlowLogsConfigOperation) 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 (*DeleteVpcFlowLogsConfigOperation) Poll ¶ added in v1.18.0
func (op *DeleteVpcFlowLogsConfigOperation) 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 (*DeleteVpcFlowLogsConfigOperation) Wait ¶ added in v1.18.0
func (op *DeleteVpcFlowLogsConfigOperation) 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 LocationIterator ¶ added in v1.11.0
type LocationIterator struct { // Response is the raw response for the current page. // It must be cast to the RPC response type. // Calling Next() or InternalFetch() updates this value. Response interface{} // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*locationpb.Location, nextPageToken string, err error) // contains filtered or unexported fields }
LocationIterator manages a stream of *locationpb.Location.
func (*LocationIterator) All ¶ added in v1.14.1
func (it *LocationIterator) All() iter.Seq2[*locationpb.Location, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*LocationIterator) Next ¶ added in v1.11.0
func (it *LocationIterator) Next() (*locationpb.Location, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*LocationIterator) PageInfo ¶ added in v1.11.0
func (it *LocationIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type OperationIterator ¶ added in v1.11.0
type OperationIterator struct { // Response is the raw response for the current page. // It must be cast to the RPC response type. // Calling Next() or InternalFetch() updates this value. Response interface{} // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*longrunningpb.Operation, nextPageToken string, err error) // contains filtered or unexported fields }
OperationIterator manages a stream of *longrunningpb.Operation.
func (*OperationIterator) All ¶ added in v1.14.1
func (it *OperationIterator) All() iter.Seq2[*longrunningpb.Operation, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*OperationIterator) Next ¶ added in v1.11.0
func (it *OperationIterator) Next() (*longrunningpb.Operation, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*OperationIterator) PageInfo ¶ added in v1.11.0
func (it *OperationIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type ReachabilityCallOptions ¶
type ReachabilityCallOptions struct { ListConnectivityTests []gax.CallOption GetConnectivityTest []gax.CallOption CreateConnectivityTest []gax.CallOption UpdateConnectivityTest []gax.CallOption RerunConnectivityTest []gax.CallOption DeleteConnectivityTest []gax.CallOption GetLocation []gax.CallOption ListLocations []gax.CallOption GetIamPolicy []gax.CallOption SetIamPolicy []gax.CallOption TestIamPermissions []gax.CallOption CancelOperation []gax.CallOption DeleteOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }
ReachabilityCallOptions contains the retry settings for each method of ReachabilityClient.
type ReachabilityClient ¶
type ReachabilityClient struct { // The call options for this service. CallOptions *ReachabilityCallOptions // 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 }
ReachabilityClient is a client for interacting with Network Management API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The Reachability service in the Google Cloud Network Management API provides services that analyze the reachability within a single Google Virtual Private Cloud (VPC) network, between peered VPC networks, between VPC and on-premises networks, or between VPC networks and internet hosts. A reachability analysis is based on Google Cloud network configurations.
You can use the analysis results to verify these configurations and to troubleshoot connectivity issues.
func NewReachabilityClient ¶
func NewReachabilityClient(ctx context.Context, opts ...option.ClientOption) (*ReachabilityClient, error)
NewReachabilityClient creates a new reachability service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
The Reachability service in the Google Cloud Network Management API provides services that analyze the reachability within a single Google Virtual Private Cloud (VPC) network, between peered VPC networks, between VPC and on-premises networks, or between VPC networks and internet hosts. A reachability analysis is based on Google Cloud network configurations.
You can use the analysis results to verify these configurations and to troubleshoot connectivity issues.
Example ¶
package main import ( "context" networkmanagement "cloud.google.com/go/networkmanagement/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 := networkmanagement.NewReachabilityClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func NewReachabilityRESTClient ¶ added in v1.6.0
func NewReachabilityRESTClient(ctx context.Context, opts ...option.ClientOption) (*ReachabilityClient, error)
NewReachabilityRESTClient creates a new reachability service rest client.
The Reachability service in the Google Cloud Network Management API provides services that analyze the reachability within a single Google Virtual Private Cloud (VPC) network, between peered VPC networks, between VPC and on-premises networks, or between VPC networks and internet hosts. A reachability analysis is based on Google Cloud network configurations.
You can use the analysis results to verify these configurations and to troubleshoot connectivity issues.
Example ¶
package main import ( "context" networkmanagement "cloud.google.com/go/networkmanagement/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 := networkmanagement.NewReachabilityRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func (*ReachabilityClient) CancelOperation ¶ added in v1.11.0
func (c *ReachabilityClient) 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" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" networkmanagement "cloud.google.com/go/networkmanagement/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 := networkmanagement.NewReachabilityClient(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. } }
Output:
func (*ReachabilityClient) Close ¶
func (c *ReachabilityClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*ReachabilityClient) Connection
deprecated
func (c *ReachabilityClient) 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 (*ReachabilityClient) CreateConnectivityTest ¶
func (c *ReachabilityClient) CreateConnectivityTest(ctx context.Context, req *networkmanagementpb.CreateConnectivityTestRequest, opts ...gax.CallOption) (*CreateConnectivityTestOperation, error)
CreateConnectivityTest creates a new Connectivity Test. After you create a test, the reachability analysis is performed as part of the long running operation, which completes when the analysis completes.
If the endpoint specifications in ConnectivityTest are invalid (for example, containing non-existent resources in the network, or you don’t have read permissions to the network configurations of listed projects), then the reachability result returns a value of UNKNOWN.
If the endpoint specifications in ConnectivityTest are incomplete, the reachability result returns a value of AMBIGUOUS. For more information, see the Connectivity Test documentation.
Example ¶
package main import ( "context" networkmanagement "cloud.google.com/go/networkmanagement/apiv1" networkmanagementpb "cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb" ) 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 := networkmanagement.NewReachabilityClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkmanagementpb.CreateConnectivityTestRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb#CreateConnectivityTestRequest. } op, err := c.CreateConnectivityTest(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 (*ReachabilityClient) CreateConnectivityTestOperation ¶
func (c *ReachabilityClient) CreateConnectivityTestOperation(name string) *CreateConnectivityTestOperation
CreateConnectivityTestOperation returns a new CreateConnectivityTestOperation from a given name. The name must be that of a previously created CreateConnectivityTestOperation, possibly from a different process.
func (*ReachabilityClient) DeleteConnectivityTest ¶
func (c *ReachabilityClient) DeleteConnectivityTest(ctx context.Context, req *networkmanagementpb.DeleteConnectivityTestRequest, opts ...gax.CallOption) (*DeleteConnectivityTestOperation, error)
DeleteConnectivityTest deletes a specific ConnectivityTest.
Example ¶
package main import ( "context" networkmanagement "cloud.google.com/go/networkmanagement/apiv1" networkmanagementpb "cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb" ) 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 := networkmanagement.NewReachabilityClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkmanagementpb.DeleteConnectivityTestRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb#DeleteConnectivityTestRequest. } op, err := c.DeleteConnectivityTest(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) if err != nil { // TODO: Handle error. } }
Output:
func (*ReachabilityClient) DeleteConnectivityTestOperation ¶
func (c *ReachabilityClient) DeleteConnectivityTestOperation(name string) *DeleteConnectivityTestOperation
DeleteConnectivityTestOperation returns a new DeleteConnectivityTestOperation from a given name. The name must be that of a previously created DeleteConnectivityTestOperation, possibly from a different process.
func (*ReachabilityClient) DeleteOperation ¶ added in v1.11.0
func (c *ReachabilityClient) 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" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" networkmanagement "cloud.google.com/go/networkmanagement/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 := networkmanagement.NewReachabilityClient(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. } }
Output:
func (*ReachabilityClient) GetConnectivityTest ¶
func (c *ReachabilityClient) GetConnectivityTest(ctx context.Context, req *networkmanagementpb.GetConnectivityTestRequest, opts ...gax.CallOption) (*networkmanagementpb.ConnectivityTest, error)
GetConnectivityTest gets the details of a specific Connectivity Test.
Example ¶
package main import ( "context" networkmanagement "cloud.google.com/go/networkmanagement/apiv1" networkmanagementpb "cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb" ) 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 := networkmanagement.NewReachabilityClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkmanagementpb.GetConnectivityTestRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb#GetConnectivityTestRequest. } resp, err := c.GetConnectivityTest(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*ReachabilityClient) GetIamPolicy ¶ added in v1.11.0
func (c *ReachabilityClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
GetIamPolicy gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
Example ¶
package main import ( "context" iampb "cloud.google.com/go/iam/apiv1/iampb" networkmanagement "cloud.google.com/go/networkmanagement/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 := networkmanagement.NewReachabilityClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &iampb.GetIamPolicyRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#GetIamPolicyRequest. } resp, err := c.GetIamPolicy(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*ReachabilityClient) GetLocation ¶ added in v1.11.0
func (c *ReachabilityClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
GetLocation gets information about a location.
Example ¶
package main import ( "context" networkmanagement "cloud.google.com/go/networkmanagement/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 := networkmanagement.NewReachabilityClient(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 }
Output:
func (*ReachabilityClient) GetOperation ¶ added in v1.11.0
func (c *ReachabilityClient) 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" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" networkmanagement "cloud.google.com/go/networkmanagement/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 := networkmanagement.NewReachabilityClient(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 }
Output:
func (*ReachabilityClient) ListConnectivityTests ¶
func (c *ReachabilityClient) ListConnectivityTests(ctx context.Context, req *networkmanagementpb.ListConnectivityTestsRequest, opts ...gax.CallOption) *ConnectivityTestIterator
ListConnectivityTests lists all Connectivity Tests owned by a project.
Example ¶
package main import ( "context" networkmanagement "cloud.google.com/go/networkmanagement/apiv1" networkmanagementpb "cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb" "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 := networkmanagement.NewReachabilityClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkmanagementpb.ListConnectivityTestsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb#ListConnectivityTestsRequest. } it := c.ListConnectivityTests(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.(*networkmanagementpb.ListConnectivityTestsResponse) } }
Output:
Example (All) ¶
package main import ( "context" networkmanagement "cloud.google.com/go/networkmanagement/apiv1" networkmanagementpb "cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb" ) 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 := networkmanagement.NewReachabilityClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkmanagementpb.ListConnectivityTestsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb#ListConnectivityTestsRequest. } for resp, err := range c.ListConnectivityTests(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } }
Output:
func (*ReachabilityClient) ListLocations ¶ added in v1.11.0
func (c *ReachabilityClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service.
Example ¶
package main import ( "context" networkmanagement "cloud.google.com/go/networkmanagement/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 := networkmanagement.NewReachabilityClient(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) } }
Output:
Example (All) ¶
package main import ( "context" networkmanagement "cloud.google.com/go/networkmanagement/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 := networkmanagement.NewReachabilityClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &locationpb.ListLocationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest. } for resp, err := range c.ListLocations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } }
Output:
func (*ReachabilityClient) ListOperations ¶ added in v1.11.0
func (c *ReachabilityClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" networkmanagement "cloud.google.com/go/networkmanagement/apiv1" "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 := networkmanagement.NewReachabilityClient(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) } }
Output:
Example (All) ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" networkmanagement "cloud.google.com/go/networkmanagement/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 := networkmanagement.NewReachabilityClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } for resp, err := range c.ListOperations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } }
Output:
func (*ReachabilityClient) RerunConnectivityTest ¶
func (c *ReachabilityClient) RerunConnectivityTest(ctx context.Context, req *networkmanagementpb.RerunConnectivityTestRequest, opts ...gax.CallOption) (*RerunConnectivityTestOperation, error)
RerunConnectivityTest rerun an existing ConnectivityTest. After the user triggers the rerun, the reachability analysis is performed as part of the long running operation, which completes when the analysis completes.
Even though the test configuration remains the same, the reachability result may change due to underlying network configuration changes.
If the endpoint specifications in ConnectivityTest become invalid (for example, specified resources are deleted in the network, or you lost read permissions to the network configurations of listed projects), then the reachability result returns a value of UNKNOWN.
Example ¶
package main import ( "context" networkmanagement "cloud.google.com/go/networkmanagement/apiv1" networkmanagementpb "cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb" ) 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 := networkmanagement.NewReachabilityClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkmanagementpb.RerunConnectivityTestRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb#RerunConnectivityTestRequest. } op, err := c.RerunConnectivityTest(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 (*ReachabilityClient) RerunConnectivityTestOperation ¶
func (c *ReachabilityClient) RerunConnectivityTestOperation(name string) *RerunConnectivityTestOperation
RerunConnectivityTestOperation returns a new RerunConnectivityTestOperation from a given name. The name must be that of a previously created RerunConnectivityTestOperation, possibly from a different process.
func (*ReachabilityClient) SetIamPolicy ¶ added in v1.11.0
func (c *ReachabilityClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.
Example ¶
package main import ( "context" iampb "cloud.google.com/go/iam/apiv1/iampb" networkmanagement "cloud.google.com/go/networkmanagement/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 := networkmanagement.NewReachabilityClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &iampb.SetIamPolicyRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#SetIamPolicyRequest. } resp, err := c.SetIamPolicy(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*ReachabilityClient) TestIamPermissions ¶ added in v1.11.0
func (c *ReachabilityClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error)
TestIamPermissions returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.
Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may “fail open” without warning.
Example ¶
package main import ( "context" iampb "cloud.google.com/go/iam/apiv1/iampb" networkmanagement "cloud.google.com/go/networkmanagement/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 := networkmanagement.NewReachabilityClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &iampb.TestIamPermissionsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#TestIamPermissionsRequest. } resp, err := c.TestIamPermissions(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*ReachabilityClient) UpdateConnectivityTest ¶
func (c *ReachabilityClient) UpdateConnectivityTest(ctx context.Context, req *networkmanagementpb.UpdateConnectivityTestRequest, opts ...gax.CallOption) (*UpdateConnectivityTestOperation, error)
UpdateConnectivityTest updates the configuration of an existing ConnectivityTest. After you update a test, the reachability analysis is performed as part of the long running operation, which completes when the analysis completes. The Reachability state in the test resource is updated with the new result.
If the endpoint specifications in ConnectivityTest are invalid (for example, they contain non-existent resources in the network, or the user does not have read permissions to the network configurations of listed projects), then the reachability result returns a value of UNKNOWN.
If the endpoint specifications in ConnectivityTest are incomplete, the reachability result returns a value of AMBIGUOUS. See the documentation in ConnectivityTest for more details.
Example ¶
package main import ( "context" networkmanagement "cloud.google.com/go/networkmanagement/apiv1" networkmanagementpb "cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb" ) 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 := networkmanagement.NewReachabilityClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkmanagementpb.UpdateConnectivityTestRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb#UpdateConnectivityTestRequest. } op, err := c.UpdateConnectivityTest(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 (*ReachabilityClient) UpdateConnectivityTestOperation ¶
func (c *ReachabilityClient) UpdateConnectivityTestOperation(name string) *UpdateConnectivityTestOperation
UpdateConnectivityTestOperation returns a new UpdateConnectivityTestOperation from a given name. The name must be that of a previously created UpdateConnectivityTestOperation, possibly from a different process.
type RerunConnectivityTestOperation ¶
type RerunConnectivityTestOperation struct {
// contains filtered or unexported fields
}
RerunConnectivityTestOperation manages a long-running operation from RerunConnectivityTest.
func (*RerunConnectivityTestOperation) Done ¶
func (op *RerunConnectivityTestOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*RerunConnectivityTestOperation) Metadata ¶
func (op *RerunConnectivityTestOperation) Metadata() (*networkmanagementpb.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 (*RerunConnectivityTestOperation) Name ¶
func (op *RerunConnectivityTestOperation) 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 (*RerunConnectivityTestOperation) Poll ¶
func (op *RerunConnectivityTestOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*networkmanagementpb.ConnectivityTest, 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 (*RerunConnectivityTestOperation) Wait ¶
func (op *RerunConnectivityTestOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*networkmanagementpb.ConnectivityTest, 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 UpdateConnectivityTestOperation ¶
type UpdateConnectivityTestOperation struct {
// contains filtered or unexported fields
}
UpdateConnectivityTestOperation manages a long-running operation from UpdateConnectivityTest.
func (*UpdateConnectivityTestOperation) Done ¶
func (op *UpdateConnectivityTestOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*UpdateConnectivityTestOperation) Metadata ¶
func (op *UpdateConnectivityTestOperation) Metadata() (*networkmanagementpb.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 (*UpdateConnectivityTestOperation) Name ¶
func (op *UpdateConnectivityTestOperation) 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 (*UpdateConnectivityTestOperation) Poll ¶
func (op *UpdateConnectivityTestOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*networkmanagementpb.ConnectivityTest, 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 (*UpdateConnectivityTestOperation) Wait ¶
func (op *UpdateConnectivityTestOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*networkmanagementpb.ConnectivityTest, 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 UpdateVpcFlowLogsConfigOperation ¶ added in v1.18.0
type UpdateVpcFlowLogsConfigOperation struct {
// contains filtered or unexported fields
}
UpdateVpcFlowLogsConfigOperation manages a long-running operation from UpdateVpcFlowLogsConfig.
func (*UpdateVpcFlowLogsConfigOperation) Done ¶ added in v1.18.0
func (op *UpdateVpcFlowLogsConfigOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*UpdateVpcFlowLogsConfigOperation) Metadata ¶ added in v1.18.0
func (op *UpdateVpcFlowLogsConfigOperation) Metadata() (*networkmanagementpb.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 (*UpdateVpcFlowLogsConfigOperation) Name ¶ added in v1.18.0
func (op *UpdateVpcFlowLogsConfigOperation) 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 (*UpdateVpcFlowLogsConfigOperation) Poll ¶ added in v1.18.0
func (op *UpdateVpcFlowLogsConfigOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*networkmanagementpb.VpcFlowLogsConfig, 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 (*UpdateVpcFlowLogsConfigOperation) Wait ¶ added in v1.18.0
func (op *UpdateVpcFlowLogsConfigOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*networkmanagementpb.VpcFlowLogsConfig, 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 VpcFlowLogsCallOptions ¶ added in v1.18.0
type VpcFlowLogsCallOptions struct { ListVpcFlowLogsConfigs []gax.CallOption GetVpcFlowLogsConfig []gax.CallOption CreateVpcFlowLogsConfig []gax.CallOption UpdateVpcFlowLogsConfig []gax.CallOption DeleteVpcFlowLogsConfig []gax.CallOption GetLocation []gax.CallOption ListLocations []gax.CallOption GetIamPolicy []gax.CallOption SetIamPolicy []gax.CallOption TestIamPermissions []gax.CallOption CancelOperation []gax.CallOption DeleteOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }
VpcFlowLogsCallOptions contains the retry settings for each method of VpcFlowLogsClient.
type VpcFlowLogsClient ¶ added in v1.18.0
type VpcFlowLogsClient struct { // The call options for this service. CallOptions *VpcFlowLogsCallOptions // 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 }
VpcFlowLogsClient is a client for interacting with Network Management API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The VPC Flow Logs service in the Google Cloud Network Management API provides configurations that generate Flow Logs. The service and the configuration resources created using this service are global.
func NewVpcFlowLogsClient ¶ added in v1.18.0
func NewVpcFlowLogsClient(ctx context.Context, opts ...option.ClientOption) (*VpcFlowLogsClient, error)
NewVpcFlowLogsClient creates a new vpc flow logs service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
The VPC Flow Logs service in the Google Cloud Network Management API provides configurations that generate Flow Logs. The service and the configuration resources created using this service are global.
Example ¶
package main import ( "context" networkmanagement "cloud.google.com/go/networkmanagement/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 := networkmanagement.NewVpcFlowLogsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func NewVpcFlowLogsRESTClient ¶ added in v1.18.0
func NewVpcFlowLogsRESTClient(ctx context.Context, opts ...option.ClientOption) (*VpcFlowLogsClient, error)
NewVpcFlowLogsRESTClient creates a new vpc flow logs service rest client.
The VPC Flow Logs service in the Google Cloud Network Management API provides configurations that generate Flow Logs. The service and the configuration resources created using this service are global.
Example ¶
package main import ( "context" networkmanagement "cloud.google.com/go/networkmanagement/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 := networkmanagement.NewVpcFlowLogsRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func (*VpcFlowLogsClient) CancelOperation ¶ added in v1.18.0
func (c *VpcFlowLogsClient) 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" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" networkmanagement "cloud.google.com/go/networkmanagement/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 := networkmanagement.NewVpcFlowLogsClient(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. } }
Output:
func (*VpcFlowLogsClient) Close ¶ added in v1.18.0
func (c *VpcFlowLogsClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*VpcFlowLogsClient) Connection
deprecated
added in
v1.18.0
func (c *VpcFlowLogsClient) 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 (*VpcFlowLogsClient) CreateVpcFlowLogsConfig ¶ added in v1.18.0
func (c *VpcFlowLogsClient) CreateVpcFlowLogsConfig(ctx context.Context, req *networkmanagementpb.CreateVpcFlowLogsConfigRequest, opts ...gax.CallOption) (*CreateVpcFlowLogsConfigOperation, error)
CreateVpcFlowLogsConfig creates a new VpcFlowLogsConfig. If a configuration with the exact same settings already exists (even if the ID is different), the creation fails. Notes:
Creating a configuration with state=DISABLED will fail
The following fields are not considered as settings for the purpose of the check mentioned above, therefore - creating another configuration with the same fields but different values for the following fields will fail as well:
name create_time update_time labels description
Example ¶
package main import ( "context" networkmanagement "cloud.google.com/go/networkmanagement/apiv1" networkmanagementpb "cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb" ) 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 := networkmanagement.NewVpcFlowLogsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkmanagementpb.CreateVpcFlowLogsConfigRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb#CreateVpcFlowLogsConfigRequest. } op, err := c.CreateVpcFlowLogsConfig(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 (*VpcFlowLogsClient) CreateVpcFlowLogsConfigOperation ¶ added in v1.18.0
func (c *VpcFlowLogsClient) CreateVpcFlowLogsConfigOperation(name string) *CreateVpcFlowLogsConfigOperation
CreateVpcFlowLogsConfigOperation returns a new CreateVpcFlowLogsConfigOperation from a given name. The name must be that of a previously created CreateVpcFlowLogsConfigOperation, possibly from a different process.
func (*VpcFlowLogsClient) DeleteOperation ¶ added in v1.18.0
func (c *VpcFlowLogsClient) 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" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" networkmanagement "cloud.google.com/go/networkmanagement/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 := networkmanagement.NewVpcFlowLogsClient(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. } }
Output:
func (*VpcFlowLogsClient) DeleteVpcFlowLogsConfig ¶ added in v1.18.0
func (c *VpcFlowLogsClient) DeleteVpcFlowLogsConfig(ctx context.Context, req *networkmanagementpb.DeleteVpcFlowLogsConfigRequest, opts ...gax.CallOption) (*DeleteVpcFlowLogsConfigOperation, error)
DeleteVpcFlowLogsConfig deletes a specific VpcFlowLogsConfig.
Example ¶
package main import ( "context" networkmanagement "cloud.google.com/go/networkmanagement/apiv1" networkmanagementpb "cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb" ) 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 := networkmanagement.NewVpcFlowLogsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkmanagementpb.DeleteVpcFlowLogsConfigRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb#DeleteVpcFlowLogsConfigRequest. } op, err := c.DeleteVpcFlowLogsConfig(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) if err != nil { // TODO: Handle error. } }
Output:
func (*VpcFlowLogsClient) DeleteVpcFlowLogsConfigOperation ¶ added in v1.18.0
func (c *VpcFlowLogsClient) DeleteVpcFlowLogsConfigOperation(name string) *DeleteVpcFlowLogsConfigOperation
DeleteVpcFlowLogsConfigOperation returns a new DeleteVpcFlowLogsConfigOperation from a given name. The name must be that of a previously created DeleteVpcFlowLogsConfigOperation, possibly from a different process.
func (*VpcFlowLogsClient) GetIamPolicy ¶ added in v1.18.0
func (c *VpcFlowLogsClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
GetIamPolicy gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
Example ¶
package main import ( "context" iampb "cloud.google.com/go/iam/apiv1/iampb" networkmanagement "cloud.google.com/go/networkmanagement/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 := networkmanagement.NewVpcFlowLogsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &iampb.GetIamPolicyRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#GetIamPolicyRequest. } resp, err := c.GetIamPolicy(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*VpcFlowLogsClient) GetLocation ¶ added in v1.18.0
func (c *VpcFlowLogsClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
GetLocation gets information about a location.
Example ¶
package main import ( "context" networkmanagement "cloud.google.com/go/networkmanagement/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 := networkmanagement.NewVpcFlowLogsClient(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 }
Output:
func (*VpcFlowLogsClient) GetOperation ¶ added in v1.18.0
func (c *VpcFlowLogsClient) 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" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" networkmanagement "cloud.google.com/go/networkmanagement/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 := networkmanagement.NewVpcFlowLogsClient(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 }
Output:
func (*VpcFlowLogsClient) GetVpcFlowLogsConfig ¶ added in v1.18.0
func (c *VpcFlowLogsClient) GetVpcFlowLogsConfig(ctx context.Context, req *networkmanagementpb.GetVpcFlowLogsConfigRequest, opts ...gax.CallOption) (*networkmanagementpb.VpcFlowLogsConfig, error)
GetVpcFlowLogsConfig gets the details of a specific VpcFlowLogsConfig.
Example ¶
package main import ( "context" networkmanagement "cloud.google.com/go/networkmanagement/apiv1" networkmanagementpb "cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb" ) 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 := networkmanagement.NewVpcFlowLogsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkmanagementpb.GetVpcFlowLogsConfigRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb#GetVpcFlowLogsConfigRequest. } resp, err := c.GetVpcFlowLogsConfig(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*VpcFlowLogsClient) ListLocations ¶ added in v1.18.0
func (c *VpcFlowLogsClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service.
Example ¶
package main import ( "context" networkmanagement "cloud.google.com/go/networkmanagement/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 := networkmanagement.NewVpcFlowLogsClient(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) } }
Output:
Example (All) ¶
package main import ( "context" networkmanagement "cloud.google.com/go/networkmanagement/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 := networkmanagement.NewVpcFlowLogsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &locationpb.ListLocationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest. } for resp, err := range c.ListLocations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } }
Output:
func (*VpcFlowLogsClient) ListOperations ¶ added in v1.18.0
func (c *VpcFlowLogsClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" networkmanagement "cloud.google.com/go/networkmanagement/apiv1" "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 := networkmanagement.NewVpcFlowLogsClient(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) } }
Output:
Example (All) ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" networkmanagement "cloud.google.com/go/networkmanagement/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 := networkmanagement.NewVpcFlowLogsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } for resp, err := range c.ListOperations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } }
Output:
func (*VpcFlowLogsClient) ListVpcFlowLogsConfigs ¶ added in v1.18.0
func (c *VpcFlowLogsClient) ListVpcFlowLogsConfigs(ctx context.Context, req *networkmanagementpb.ListVpcFlowLogsConfigsRequest, opts ...gax.CallOption) *VpcFlowLogsConfigIterator
ListVpcFlowLogsConfigs lists all VpcFlowLogsConfigs in a given project.
Example ¶
package main import ( "context" networkmanagement "cloud.google.com/go/networkmanagement/apiv1" networkmanagementpb "cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb" "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 := networkmanagement.NewVpcFlowLogsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkmanagementpb.ListVpcFlowLogsConfigsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb#ListVpcFlowLogsConfigsRequest. } it := c.ListVpcFlowLogsConfigs(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.(*networkmanagementpb.ListVpcFlowLogsConfigsResponse) } }
Output:
Example (All) ¶
package main import ( "context" networkmanagement "cloud.google.com/go/networkmanagement/apiv1" networkmanagementpb "cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb" ) 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 := networkmanagement.NewVpcFlowLogsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkmanagementpb.ListVpcFlowLogsConfigsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb#ListVpcFlowLogsConfigsRequest. } for resp, err := range c.ListVpcFlowLogsConfigs(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } }
Output:
func (*VpcFlowLogsClient) SetIamPolicy ¶ added in v1.18.0
func (c *VpcFlowLogsClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.
Example ¶
package main import ( "context" iampb "cloud.google.com/go/iam/apiv1/iampb" networkmanagement "cloud.google.com/go/networkmanagement/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 := networkmanagement.NewVpcFlowLogsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &iampb.SetIamPolicyRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#SetIamPolicyRequest. } resp, err := c.SetIamPolicy(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*VpcFlowLogsClient) TestIamPermissions ¶ added in v1.18.0
func (c *VpcFlowLogsClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error)
TestIamPermissions returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.
Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may “fail open” without warning.
Example ¶
package main import ( "context" iampb "cloud.google.com/go/iam/apiv1/iampb" networkmanagement "cloud.google.com/go/networkmanagement/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 := networkmanagement.NewVpcFlowLogsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &iampb.TestIamPermissionsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#TestIamPermissionsRequest. } resp, err := c.TestIamPermissions(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*VpcFlowLogsClient) UpdateVpcFlowLogsConfig ¶ added in v1.18.0
func (c *VpcFlowLogsClient) UpdateVpcFlowLogsConfig(ctx context.Context, req *networkmanagementpb.UpdateVpcFlowLogsConfigRequest, opts ...gax.CallOption) (*UpdateVpcFlowLogsConfigOperation, error)
UpdateVpcFlowLogsConfig updates an existing VpcFlowLogsConfig. If a configuration with the exact same settings already exists (even if the ID is different), the creation fails. Notes:
Updating a configuration with state=DISABLED will fail.
The following fields are not considered as settings for the purpose of the check mentioned above, therefore - updating another configuration with the same fields but different values for the following fields will fail as well:
name create_time update_time labels description
Example ¶
package main import ( "context" networkmanagement "cloud.google.com/go/networkmanagement/apiv1" networkmanagementpb "cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb" ) 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 := networkmanagement.NewVpcFlowLogsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkmanagementpb.UpdateVpcFlowLogsConfigRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/networkmanagement/apiv1/networkmanagementpb#UpdateVpcFlowLogsConfigRequest. } op, err := c.UpdateVpcFlowLogsConfig(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 (*VpcFlowLogsClient) UpdateVpcFlowLogsConfigOperation ¶ added in v1.18.0
func (c *VpcFlowLogsClient) UpdateVpcFlowLogsConfigOperation(name string) *UpdateVpcFlowLogsConfigOperation
UpdateVpcFlowLogsConfigOperation returns a new UpdateVpcFlowLogsConfigOperation from a given name. The name must be that of a previously created UpdateVpcFlowLogsConfigOperation, possibly from a different process.
type VpcFlowLogsConfigIterator ¶ added in v1.18.0
type VpcFlowLogsConfigIterator 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 []*networkmanagementpb.VpcFlowLogsConfig, nextPageToken string, err error) // contains filtered or unexported fields }
VpcFlowLogsConfigIterator manages a stream of *networkmanagementpb.VpcFlowLogsConfig.
func (*VpcFlowLogsConfigIterator) All ¶ added in v1.18.0
func (it *VpcFlowLogsConfigIterator) All() iter.Seq2[*networkmanagementpb.VpcFlowLogsConfig, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*VpcFlowLogsConfigIterator) Next ¶ added in v1.18.0
func (it *VpcFlowLogsConfigIterator) Next() (*networkmanagementpb.VpcFlowLogsConfig, 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 (*VpcFlowLogsConfigIterator) PageInfo ¶ added in v1.18.0
func (it *VpcFlowLogsConfigIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.