Package logging is an auto-generated package for the Cloud Logging API.
Writes log entries and manages your Cloud Logging configuration.
General documentation
For information that is relevant for all client libraries please reference https://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on this page includes:
- Authentication and Authorization
- Timeouts and Cancellation
- Testing against Client Libraries
- Debugging Client Libraries
- Inspecting errors
Example usage
To get started with this package, create a client.
ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := logging.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close()
The client will use your default application credentials. Clients should be reused instead of created as needed. The methods of Client are safe for concurrent use by multiple goroutines. The returned client must be Closed when it is done being used.
Using the Client
The following is an example of making an API call with the newly created client.
ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := logging.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &loggingpb.DeleteLogRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#DeleteLogRequest. } err = c.DeleteLog(ctx, req) if err != nil { // TODO: Handle error. }
Use of Context
The ctx passed to NewClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.
To close the open connection, use the Close() method.
Functions
func ConfigExclusionPath (deprecated)
ConfigExclusionPath returns the path for the exclusion resource.
Deprecated: Use
fmt.Sprintf("projects/%s/exclusions/%s", project, exclusion)
instead.
func ConfigProjectPath (deprecated)
ConfigProjectPath returns the path for the project resource.
Deprecated: Use
fmt.Sprintf("projects/%s", project)
instead.
func ConfigSinkPath (deprecated)
ConfigSinkPath returns the path for the sink resource.
Deprecated: Use
fmt.Sprintf("projects/%s/sinks/%s", project, sink)
instead.
func DefaultAuthScopes
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
func LogPath (deprecated)
LogPath returns the path for the log resource.
Deprecated: Use
fmt.Sprintf("projects/%s/logs/%s", project, log)
instead.
func MetricsMetricPath (deprecated)
MetricsMetricPath returns the path for the metric resource.
Deprecated: Use
fmt.Sprintf("projects/%s/metrics/%s", project, metric)
instead.
func MetricsProjectPath (deprecated)
MetricsProjectPath returns the path for the project resource.
Deprecated: Use
fmt.Sprintf("projects/%s", project)
instead.
func ProjectPath (deprecated)
ProjectPath returns the path for the project resource.
Deprecated: Use
fmt.Sprintf("projects/%s", project)
instead.
CallOptions
type CallOptions struct {
DeleteLog []gax.CallOption
WriteLogEntries []gax.CallOption
ListLogEntries []gax.CallOption
ListMonitoredResourceDescriptors []gax.CallOption
ListLogs []gax.CallOption
TailLogEntries []gax.CallOption
CancelOperation []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
CallOptions contains the retry settings for each method of Client.
Client
type Client struct {
// The call options for this service.
CallOptions *CallOptions
// contains filtered or unexported fields
}
Client is a client for interacting with Cloud Logging API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for ingesting and querying logs.
func NewClient
NewClient creates a new logging service v2 client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for ingesting and querying logs.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
)
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 := logging.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*Client) CancelOperation
func (c *Client) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := logging.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*Client) Close
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*Client) Connection (deprecated)
func (c *Client) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*Client) DeleteLog
func (c *Client) DeleteLog(ctx context.Context, req *loggingpb.DeleteLogRequest, opts ...gax.CallOption) error
DeleteLog deletes all the log entries in a log for the _Default Log Bucket. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted. Entries received after the delete operation with a timestamp before the operation will be deleted.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.DeleteLogRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#DeleteLogRequest.
}
err = c.DeleteLog(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*Client) GetOperation
func (c *Client) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := logging.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) ListLogEntries
func (c *Client) ListLogEntries(ctx context.Context, req *loggingpb.ListLogEntriesRequest, opts ...gax.CallOption) *LogEntryIterator
ListLogEntries lists log entries. Use this method to retrieve log entries that originated from a project/folder/organization/billing account. For ways to export log entries, see Exporting Logs (at https://cloud.google.com/logging/docs/export).
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
"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 := logging.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.ListLogEntriesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#ListLogEntriesRequest.
}
it := c.ListLogEntries(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.(*loggingpb.ListLogEntriesResponse)
}
}
func (*Client) ListLogs
func (c *Client) ListLogs(ctx context.Context, req *loggingpb.ListLogsRequest, opts ...gax.CallOption) *StringIterator
ListLogs lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
"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 := logging.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.ListLogsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#ListLogsRequest.
}
it := c.ListLogs(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.(*loggingpb.ListLogsResponse)
}
}
func (*Client) ListMonitoredResourceDescriptors
func (c *Client) ListMonitoredResourceDescriptors(ctx context.Context, req *loggingpb.ListMonitoredResourceDescriptorsRequest, opts ...gax.CallOption) *MonitoredResourceDescriptorIterator
ListMonitoredResourceDescriptors lists the descriptors for monitored resource types used by Logging.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
"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 := logging.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.ListMonitoredResourceDescriptorsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#ListMonitoredResourceDescriptorsRequest.
}
it := c.ListMonitoredResourceDescriptors(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.(*loggingpb.ListMonitoredResourceDescriptorsResponse)
}
}
func (*Client) ListOperations
func (c *Client) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := logging.NewClient(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)
}
}
func (*Client) SetGoogleClientInfo
SetGoogleClientInfo sets the name and version of the application in
the x-goog-api-client
header passed on each request. Also passes any
provided key-value pairs. Intended for use by Google-written clients.
Internal use only.
func (*Client) TailLogEntries
func (c *Client) TailLogEntries(ctx context.Context, opts ...gax.CallOption) (loggingpb.LoggingServiceV2_TailLogEntriesClient, error)
TailLogEntries streaming read of log entries as they are ingested. Until the stream is terminated, it will continue reading logs.
Example
package main
import (
"context"
"io"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
stream, err := c.TailLogEntries(ctx)
if err != nil {
// TODO: Handle error.
}
go func() {
reqs := []*loggingpb.TailLogEntriesRequest{
// TODO: Create requests.
}
for _, req := range reqs {
if err := stream.Send(req); err != nil {
// TODO: Handle error.
}
}
stream.CloseSend()
}()
for {
resp, err := stream.Recv()
if err == io.EOF {
break
}
if err != nil {
// TODO: handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) WriteLogEntries
func (c *Client) WriteLogEntries(ctx context.Context, req *loggingpb.WriteLogEntriesRequest, opts ...gax.CallOption) (*loggingpb.WriteLogEntriesResponse, error)
WriteLogEntries writes log entries to Logging. This API method is the only way to send log entries to Logging. This method is used, directly or indirectly, by the Logging agent (fluentd) and all logging libraries configured to use Logging. A single request may contain log entries for a maximum of 1000 different resources (projects, organizations, billing accounts or folders)
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.WriteLogEntriesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#WriteLogEntriesRequest.
}
resp, err := c.WriteLogEntries(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
ConfigCallOptions
type ConfigCallOptions struct {
ListBuckets []gax.CallOption
GetBucket []gax.CallOption
CreateBucketAsync []gax.CallOption
UpdateBucketAsync []gax.CallOption
CreateBucket []gax.CallOption
UpdateBucket []gax.CallOption
DeleteBucket []gax.CallOption
UndeleteBucket []gax.CallOption
ListViews []gax.CallOption
GetView []gax.CallOption
CreateView []gax.CallOption
UpdateView []gax.CallOption
DeleteView []gax.CallOption
ListSinks []gax.CallOption
GetSink []gax.CallOption
CreateSink []gax.CallOption
UpdateSink []gax.CallOption
DeleteSink []gax.CallOption
CreateLink []gax.CallOption
DeleteLink []gax.CallOption
ListLinks []gax.CallOption
GetLink []gax.CallOption
ListExclusions []gax.CallOption
GetExclusion []gax.CallOption
CreateExclusion []gax.CallOption
UpdateExclusion []gax.CallOption
DeleteExclusion []gax.CallOption
GetCmekSettings []gax.CallOption
UpdateCmekSettings []gax.CallOption
GetSettings []gax.CallOption
UpdateSettings []gax.CallOption
CopyLogEntries []gax.CallOption
CancelOperation []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
ConfigCallOptions contains the retry settings for each method of ConfigClient.
ConfigClient
type ConfigClient struct {
// The call options for this service.
CallOptions *ConfigCallOptions
// 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
}
ConfigClient is a client for interacting with Cloud Logging API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for configuring sinks used to route log entries.
func NewConfigClient
func NewConfigClient(ctx context.Context, opts ...option.ClientOption) (*ConfigClient, error)
NewConfigClient creates a new config service v2 client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for configuring sinks used to route log entries.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
)
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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*ConfigClient) CancelOperation
func (c *ConfigClient) 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"
logging "cloud.google.com/go/logging/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*ConfigClient) Close
func (c *ConfigClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*ConfigClient) Connection (deprecated)
func (c *ConfigClient) 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 (*ConfigClient) CopyLogEntries
func (c *ConfigClient) CopyLogEntries(ctx context.Context, req *loggingpb.CopyLogEntriesRequest, opts ...gax.CallOption) (*CopyLogEntriesOperation, error)
CopyLogEntries copies a set of log entries from a log bucket to a Cloud Storage bucket.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.CopyLogEntriesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#CopyLogEntriesRequest.
}
op, err := c.CopyLogEntries(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConfigClient) CopyLogEntriesOperation
func (c *ConfigClient) CopyLogEntriesOperation(name string) *CopyLogEntriesOperation
CopyLogEntriesOperation returns a new CopyLogEntriesOperation from a given name. The name must be that of a previously created CopyLogEntriesOperation, possibly from a different process.
func (*ConfigClient) CreateBucket
func (c *ConfigClient) CreateBucket(ctx context.Context, req *loggingpb.CreateBucketRequest, opts ...gax.CallOption) (*loggingpb.LogBucket, error)
CreateBucket creates a log bucket that can be used to store log entries. After a bucket has been created, the bucket’s location cannot be changed.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.CreateBucketRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#CreateBucketRequest.
}
resp, err := c.CreateBucket(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConfigClient) CreateBucketAsync
func (c *ConfigClient) CreateBucketAsync(ctx context.Context, req *loggingpb.CreateBucketRequest, opts ...gax.CallOption) (*CreateBucketAsyncOperation, error)
CreateBucketAsync creates a log bucket asynchronously that can be used to store log entries.
After a bucket has been created, the bucket’s location cannot be changed.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.CreateBucketRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#CreateBucketRequest.
}
op, err := c.CreateBucketAsync(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConfigClient) CreateBucketAsyncOperation
func (c *ConfigClient) CreateBucketAsyncOperation(name string) *CreateBucketAsyncOperation
CreateBucketAsyncOperation returns a new CreateBucketAsyncOperation from a given name. The name must be that of a previously created CreateBucketAsyncOperation, possibly from a different process.
func (*ConfigClient) CreateExclusion
func (c *ConfigClient) CreateExclusion(ctx context.Context, req *loggingpb.CreateExclusionRequest, opts ...gax.CallOption) (*loggingpb.LogExclusion, error)
CreateExclusion creates a new exclusion in the _Default sink in a specified parent resource. Only log entries belonging to that resource can be excluded. You can have up to 10 exclusions in a resource.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.CreateExclusionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#CreateExclusionRequest.
}
resp, err := c.CreateExclusion(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConfigClient) CreateLink
func (c *ConfigClient) CreateLink(ctx context.Context, req *loggingpb.CreateLinkRequest, opts ...gax.CallOption) (*CreateLinkOperation, error)
CreateLink asynchronously creates a linked dataset in BigQuery which makes it possible to use BigQuery to read the logs stored in the log bucket. A log bucket may currently only contain one link.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.CreateLinkRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#CreateLinkRequest.
}
op, err := c.CreateLink(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConfigClient) CreateLinkOperation
func (c *ConfigClient) CreateLinkOperation(name string) *CreateLinkOperation
CreateLinkOperation returns a new CreateLinkOperation from a given name. The name must be that of a previously created CreateLinkOperation, possibly from a different process.
func (*ConfigClient) CreateSink
func (c *ConfigClient) CreateSink(ctx context.Context, req *loggingpb.CreateSinkRequest, opts ...gax.CallOption) (*loggingpb.LogSink, error)
CreateSink creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the sink’s writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.CreateSinkRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#CreateSinkRequest.
}
resp, err := c.CreateSink(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConfigClient) CreateView
func (c *ConfigClient) CreateView(ctx context.Context, req *loggingpb.CreateViewRequest, opts ...gax.CallOption) (*loggingpb.LogView, error)
CreateView creates a view over log entries in a log bucket. A bucket may contain a maximum of 30 views.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.CreateViewRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#CreateViewRequest.
}
resp, err := c.CreateView(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConfigClient) DeleteBucket
func (c *ConfigClient) DeleteBucket(ctx context.Context, req *loggingpb.DeleteBucketRequest, opts ...gax.CallOption) error
DeleteBucket deletes a log bucket.
Changes the bucket’s lifecycle_state to the DELETE_REQUESTED state. After 7 days, the bucket will be purged and all log entries in the bucket will be permanently deleted.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.DeleteBucketRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#DeleteBucketRequest.
}
err = c.DeleteBucket(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*ConfigClient) DeleteExclusion
func (c *ConfigClient) DeleteExclusion(ctx context.Context, req *loggingpb.DeleteExclusionRequest, opts ...gax.CallOption) error
DeleteExclusion deletes an exclusion in the _Default sink.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.DeleteExclusionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#DeleteExclusionRequest.
}
err = c.DeleteExclusion(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*ConfigClient) DeleteLink
func (c *ConfigClient) DeleteLink(ctx context.Context, req *loggingpb.DeleteLinkRequest, opts ...gax.CallOption) (*DeleteLinkOperation, error)
DeleteLink deletes a link. This will also delete the corresponding BigQuery linked dataset.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.DeleteLinkRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#DeleteLinkRequest.
}
op, err := c.DeleteLink(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
func (*ConfigClient) DeleteLinkOperation
func (c *ConfigClient) DeleteLinkOperation(name string) *DeleteLinkOperation
DeleteLinkOperation returns a new DeleteLinkOperation from a given name. The name must be that of a previously created DeleteLinkOperation, possibly from a different process.
func (*ConfigClient) DeleteSink
func (c *ConfigClient) DeleteSink(ctx context.Context, req *loggingpb.DeleteSinkRequest, opts ...gax.CallOption) error
DeleteSink deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.DeleteSinkRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#DeleteSinkRequest.
}
err = c.DeleteSink(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*ConfigClient) DeleteView
func (c *ConfigClient) DeleteView(ctx context.Context, req *loggingpb.DeleteViewRequest, opts ...gax.CallOption) error
DeleteView deletes a view on a log bucket. If an UNAVAILABLE error is returned, this indicates that system is not in a state where it can delete the view. If this occurs, please try again in a few minutes.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.DeleteViewRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#DeleteViewRequest.
}
err = c.DeleteView(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*ConfigClient) GetBucket
func (c *ConfigClient) GetBucket(ctx context.Context, req *loggingpb.GetBucketRequest, opts ...gax.CallOption) (*loggingpb.LogBucket, error)
GetBucket gets a log bucket.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.GetBucketRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#GetBucketRequest.
}
resp, err := c.GetBucket(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConfigClient) GetCmekSettings
func (c *ConfigClient) GetCmekSettings(ctx context.Context, req *loggingpb.GetCmekSettingsRequest, opts ...gax.CallOption) (*loggingpb.CmekSettings, error)
GetCmekSettings gets the Logging CMEK settings for the given resource.
Note: CMEK for the Log Router can be configured for Google Cloud projects, folders, organizations and billing accounts. Once configured for an organization, it applies to all projects and folders in the Google Cloud organization.
See Enabling CMEK for Log Router (at https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.GetCmekSettingsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#GetCmekSettingsRequest.
}
resp, err := c.GetCmekSettings(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConfigClient) GetExclusion
func (c *ConfigClient) GetExclusion(ctx context.Context, req *loggingpb.GetExclusionRequest, opts ...gax.CallOption) (*loggingpb.LogExclusion, error)
GetExclusion gets the description of an exclusion in the _Default sink.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.GetExclusionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#GetExclusionRequest.
}
resp, err := c.GetExclusion(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConfigClient) GetLink
func (c *ConfigClient) GetLink(ctx context.Context, req *loggingpb.GetLinkRequest, opts ...gax.CallOption) (*loggingpb.Link, error)
GetLink gets a link.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.GetLinkRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#GetLinkRequest.
}
resp, err := c.GetLink(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConfigClient) GetOperation
func (c *ConfigClient) 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"
logging "cloud.google.com/go/logging/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConfigClient) GetSettings
func (c *ConfigClient) GetSettings(ctx context.Context, req *loggingpb.GetSettingsRequest, opts ...gax.CallOption) (*loggingpb.Settings, error)
GetSettings gets the Log Router settings for the given resource.
Note: Settings for the Log Router can be get for Google Cloud projects, folders, organizations and billing accounts. Currently it can only be configured for organizations. Once configured for an organization, it applies to all projects and folders in the Google Cloud organization.
See Enabling CMEK for Log Router (at https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.GetSettingsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#GetSettingsRequest.
}
resp, err := c.GetSettings(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConfigClient) GetSink
func (c *ConfigClient) GetSink(ctx context.Context, req *loggingpb.GetSinkRequest, opts ...gax.CallOption) (*loggingpb.LogSink, error)
GetSink gets a sink.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.GetSinkRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#GetSinkRequest.
}
resp, err := c.GetSink(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConfigClient) GetView
func (c *ConfigClient) GetView(ctx context.Context, req *loggingpb.GetViewRequest, opts ...gax.CallOption) (*loggingpb.LogView, error)
GetView gets a view on a log bucket…
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.GetViewRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#GetViewRequest.
}
resp, err := c.GetView(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConfigClient) ListBuckets
func (c *ConfigClient) ListBuckets(ctx context.Context, req *loggingpb.ListBucketsRequest, opts ...gax.CallOption) *LogBucketIterator
ListBuckets lists log buckets.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
"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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.ListBucketsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#ListBucketsRequest.
}
it := c.ListBuckets(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.(*loggingpb.ListBucketsResponse)
}
}
func (*ConfigClient) ListExclusions
func (c *ConfigClient) ListExclusions(ctx context.Context, req *loggingpb.ListExclusionsRequest, opts ...gax.CallOption) *LogExclusionIterator
ListExclusions lists all the exclusions on the _Default sink in a parent resource.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
"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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.ListExclusionsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#ListExclusionsRequest.
}
it := c.ListExclusions(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.(*loggingpb.ListExclusionsResponse)
}
}
func (*ConfigClient) ListLinks
func (c *ConfigClient) ListLinks(ctx context.Context, req *loggingpb.ListLinksRequest, opts ...gax.CallOption) *LinkIterator
ListLinks lists links.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
"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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.ListLinksRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#ListLinksRequest.
}
it := c.ListLinks(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.(*loggingpb.ListLinksResponse)
}
}
func (*ConfigClient) ListOperations
func (c *ConfigClient) 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"
logging "cloud.google.com/go/logging/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := logging.NewConfigClient(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)
}
}
func (*ConfigClient) ListSinks
func (c *ConfigClient) ListSinks(ctx context.Context, req *loggingpb.ListSinksRequest, opts ...gax.CallOption) *LogSinkIterator
ListSinks lists sinks.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
"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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.ListSinksRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#ListSinksRequest.
}
it := c.ListSinks(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.(*loggingpb.ListSinksResponse)
}
}
func (*ConfigClient) ListViews
func (c *ConfigClient) ListViews(ctx context.Context, req *loggingpb.ListViewsRequest, opts ...gax.CallOption) *LogViewIterator
ListViews lists views on a log bucket.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
"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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.ListViewsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#ListViewsRequest.
}
it := c.ListViews(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.(*loggingpb.ListViewsResponse)
}
}
func (*ConfigClient) SetGoogleClientInfo
func (cc *ConfigClient) SetGoogleClientInfo(keyval string)
SetGoogleClientInfo sets the name and version of the application in
the x-goog-api-client
header passed on each request. Also passes any
provided key-value pairs. Intended for use by Google-written clients.
Internal use only.
func (*ConfigClient) UndeleteBucket
func (c *ConfigClient) UndeleteBucket(ctx context.Context, req *loggingpb.UndeleteBucketRequest, opts ...gax.CallOption) error
UndeleteBucket undeletes a log bucket. A bucket that has been deleted can be undeleted within the grace period of 7 days.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.UndeleteBucketRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#UndeleteBucketRequest.
}
err = c.UndeleteBucket(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*ConfigClient) UpdateBucket
func (c *ConfigClient) UpdateBucket(ctx context.Context, req *loggingpb.UpdateBucketRequest, opts ...gax.CallOption) (*loggingpb.LogBucket, error)
UpdateBucket updates a log bucket.
If the bucket has a lifecycle_state of DELETE_REQUESTED, then FAILED_PRECONDITION will be returned.
After a bucket has been created, the bucket’s location cannot be changed.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.UpdateBucketRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#UpdateBucketRequest.
}
resp, err := c.UpdateBucket(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConfigClient) UpdateBucketAsync
func (c *ConfigClient) UpdateBucketAsync(ctx context.Context, req *loggingpb.UpdateBucketRequest, opts ...gax.CallOption) (*UpdateBucketAsyncOperation, error)
UpdateBucketAsync updates a log bucket asynchronously.
If the bucket has a lifecycle_state of DELETE_REQUESTED, then FAILED_PRECONDITION will be returned.
After a bucket has been created, the bucket’s location cannot be changed.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.UpdateBucketRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#UpdateBucketRequest.
}
op, err := c.UpdateBucketAsync(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConfigClient) UpdateBucketAsyncOperation
func (c *ConfigClient) UpdateBucketAsyncOperation(name string) *UpdateBucketAsyncOperation
UpdateBucketAsyncOperation returns a new UpdateBucketAsyncOperation from a given name. The name must be that of a previously created UpdateBucketAsyncOperation, possibly from a different process.
func (*ConfigClient) UpdateCmekSettings
func (c *ConfigClient) UpdateCmekSettings(ctx context.Context, req *loggingpb.UpdateCmekSettingsRequest, opts ...gax.CallOption) (*loggingpb.CmekSettings, error)
UpdateCmekSettings updates the Log Router CMEK settings for the given resource.
Note: CMEK for the Log Router can currently only be configured for Google Cloud organizations. Once configured, it applies to all projects and folders in the Google Cloud organization.
UpdateCmekSettings will fail if 1) kms_key_name is invalid, or 2) the associated service account does not have the required roles/cloudkms.cryptoKeyEncrypterDecrypter role assigned for the key, or 3) access to the key is disabled.
See Enabling CMEK for Log Router (at https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.UpdateCmekSettingsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#UpdateCmekSettingsRequest.
}
resp, err := c.UpdateCmekSettings(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConfigClient) UpdateExclusion
func (c *ConfigClient) UpdateExclusion(ctx context.Context, req *loggingpb.UpdateExclusionRequest, opts ...gax.CallOption) (*loggingpb.LogExclusion, error)
UpdateExclusion changes one or more properties of an existing exclusion in the _Default sink.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.UpdateExclusionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#UpdateExclusionRequest.
}
resp, err := c.UpdateExclusion(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConfigClient) UpdateSettings
func (c *ConfigClient) UpdateSettings(ctx context.Context, req *loggingpb.UpdateSettingsRequest, opts ...gax.CallOption) (*loggingpb.Settings, error)
UpdateSettings updates the Log Router settings for the given resource.
Note: Settings for the Log Router can currently only be configured for Google Cloud organizations. Once configured, it applies to all projects and folders in the Google Cloud organization.
UpdateSettings will fail if 1) kms_key_name is invalid, or 2) the associated service account does not have the required roles/cloudkms.cryptoKeyEncrypterDecrypter role assigned for the key, or 3) access to the key is disabled. 4) location_id is not supported by Logging. 5) location_id violate OrgPolicy.
See Enabling CMEK for Log Router (at https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.UpdateSettingsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#UpdateSettingsRequest.
}
resp, err := c.UpdateSettings(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConfigClient) UpdateSink
func (c *ConfigClient) UpdateSink(ctx context.Context, req *loggingpb.UpdateSinkRequest, opts ...gax.CallOption) (*loggingpb.LogSink, error)
UpdateSink updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter.
The updated sink might also have a new writer_identity; see the unique_writer_identity field.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.UpdateSinkRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#UpdateSinkRequest.
}
resp, err := c.UpdateSink(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConfigClient) UpdateView
func (c *ConfigClient) UpdateView(ctx context.Context, req *loggingpb.UpdateViewRequest, opts ...gax.CallOption) (*loggingpb.LogView, error)
UpdateView updates a view on a log bucket. This method replaces the following fields in the existing view with values from the new view: filter. If an UNAVAILABLE error is returned, this indicates that system is not in a state where it can update the view. If this occurs, please try again in a few minutes.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewConfigClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.UpdateViewRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#UpdateViewRequest.
}
resp, err := c.UpdateView(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
CopyLogEntriesOperation
type CopyLogEntriesOperation struct {
// contains filtered or unexported fields
}
CopyLogEntriesOperation manages a long-running operation from CopyLogEntries.
func (*CopyLogEntriesOperation) Done
func (op *CopyLogEntriesOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*CopyLogEntriesOperation) Metadata
func (op *CopyLogEntriesOperation) Metadata() (*loggingpb.CopyLogEntriesMetadata, 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 (*CopyLogEntriesOperation) Name
func (op *CopyLogEntriesOperation) 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 (*CopyLogEntriesOperation) Poll
func (op *CopyLogEntriesOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*loggingpb.CopyLogEntriesResponse, 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 (*CopyLogEntriesOperation) Wait
func (op *CopyLogEntriesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*loggingpb.CopyLogEntriesResponse, 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.
CreateBucketAsyncOperation
type CreateBucketAsyncOperation struct {
// contains filtered or unexported fields
}
CreateBucketAsyncOperation manages a long-running operation from CreateBucketAsync.
func (*CreateBucketAsyncOperation) Done
func (op *CreateBucketAsyncOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*CreateBucketAsyncOperation) Metadata
func (op *CreateBucketAsyncOperation) Metadata() (*loggingpb.BucketMetadata, 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 (*CreateBucketAsyncOperation) Name
func (op *CreateBucketAsyncOperation) 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 (*CreateBucketAsyncOperation) Poll
func (op *CreateBucketAsyncOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*loggingpb.LogBucket, 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 (*CreateBucketAsyncOperation) Wait
func (op *CreateBucketAsyncOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*loggingpb.LogBucket, 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.
CreateLinkOperation
type CreateLinkOperation struct {
// contains filtered or unexported fields
}
CreateLinkOperation manages a long-running operation from CreateLink.
func (*CreateLinkOperation) Done
func (op *CreateLinkOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*CreateLinkOperation) Metadata
func (op *CreateLinkOperation) Metadata() (*loggingpb.LinkMetadata, 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 (*CreateLinkOperation) Name
func (op *CreateLinkOperation) 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 (*CreateLinkOperation) Poll
func (op *CreateLinkOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*loggingpb.Link, 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 (*CreateLinkOperation) Wait
func (op *CreateLinkOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*loggingpb.Link, 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.
DeleteLinkOperation
type DeleteLinkOperation struct {
// contains filtered or unexported fields
}
DeleteLinkOperation manages a long-running operation from DeleteLink.
func (*DeleteLinkOperation) Done
func (op *DeleteLinkOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*DeleteLinkOperation) Metadata
func (op *DeleteLinkOperation) Metadata() (*loggingpb.LinkMetadata, 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 (*DeleteLinkOperation) Name
func (op *DeleteLinkOperation) 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 (*DeleteLinkOperation) Poll
func (op *DeleteLinkOperation) 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 (*DeleteLinkOperation) Wait
func (op *DeleteLinkOperation) 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.
LinkIterator
type LinkIterator 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 []*loggingpb.Link, nextPageToken string, err error)
// contains filtered or unexported fields
}
LinkIterator manages a stream of *loggingpb.Link.
func (*LinkIterator) Next
func (it *LinkIterator) Next() (*loggingpb.Link, 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 (*LinkIterator) PageInfo
func (it *LinkIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
LogBucketIterator
type LogBucketIterator 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 []*loggingpb.LogBucket, nextPageToken string, err error)
// contains filtered or unexported fields
}
LogBucketIterator manages a stream of *loggingpb.LogBucket.
func (*LogBucketIterator) Next
func (it *LogBucketIterator) Next() (*loggingpb.LogBucket, 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 (*LogBucketIterator) PageInfo
func (it *LogBucketIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
LogEntryIterator
type LogEntryIterator 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 []*loggingpb.LogEntry, nextPageToken string, err error)
// contains filtered or unexported fields
}
LogEntryIterator manages a stream of *loggingpb.LogEntry.
func (*LogEntryIterator) Next
func (it *LogEntryIterator) Next() (*loggingpb.LogEntry, 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 (*LogEntryIterator) PageInfo
func (it *LogEntryIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
LogExclusionIterator
type LogExclusionIterator 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 []*loggingpb.LogExclusion, nextPageToken string, err error)
// contains filtered or unexported fields
}
LogExclusionIterator manages a stream of *loggingpb.LogExclusion.
func (*LogExclusionIterator) Next
func (it *LogExclusionIterator) Next() (*loggingpb.LogExclusion, 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 (*LogExclusionIterator) PageInfo
func (it *LogExclusionIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
LogMetricIterator
type LogMetricIterator 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 []*loggingpb.LogMetric, nextPageToken string, err error)
// contains filtered or unexported fields
}
LogMetricIterator manages a stream of *loggingpb.LogMetric.
func (*LogMetricIterator) Next
func (it *LogMetricIterator) Next() (*loggingpb.LogMetric, 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 (*LogMetricIterator) PageInfo
func (it *LogMetricIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
LogSinkIterator
type LogSinkIterator 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 []*loggingpb.LogSink, nextPageToken string, err error)
// contains filtered or unexported fields
}
LogSinkIterator manages a stream of *loggingpb.LogSink.
func (*LogSinkIterator) Next
func (it *LogSinkIterator) Next() (*loggingpb.LogSink, 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 (*LogSinkIterator) PageInfo
func (it *LogSinkIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
LogViewIterator
type LogViewIterator 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 []*loggingpb.LogView, nextPageToken string, err error)
// contains filtered or unexported fields
}
LogViewIterator manages a stream of *loggingpb.LogView.
func (*LogViewIterator) Next
func (it *LogViewIterator) Next() (*loggingpb.LogView, 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 (*LogViewIterator) PageInfo
func (it *LogViewIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
MetricsCallOptions
type MetricsCallOptions struct {
ListLogMetrics []gax.CallOption
GetLogMetric []gax.CallOption
CreateLogMetric []gax.CallOption
UpdateLogMetric []gax.CallOption
DeleteLogMetric []gax.CallOption
CancelOperation []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
MetricsCallOptions contains the retry settings for each method of MetricsClient.
MetricsClient
type MetricsClient struct {
// The call options for this service.
CallOptions *MetricsCallOptions
// contains filtered or unexported fields
}
MetricsClient is a client for interacting with Cloud Logging API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for configuring logs-based metrics.
func NewMetricsClient
func NewMetricsClient(ctx context.Context, opts ...option.ClientOption) (*MetricsClient, error)
NewMetricsClient creates a new metrics service v2 client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for configuring logs-based metrics.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
)
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 := logging.NewMetricsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*MetricsClient) CancelOperation
func (c *MetricsClient) 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"
logging "cloud.google.com/go/logging/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := logging.NewMetricsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*MetricsClient) Close
func (c *MetricsClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*MetricsClient) Connection (deprecated)
func (c *MetricsClient) 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 (*MetricsClient) CreateLogMetric
func (c *MetricsClient) CreateLogMetric(ctx context.Context, req *loggingpb.CreateLogMetricRequest, opts ...gax.CallOption) (*loggingpb.LogMetric, error)
CreateLogMetric creates a logs-based metric.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewMetricsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.CreateLogMetricRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#CreateLogMetricRequest.
}
resp, err := c.CreateLogMetric(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*MetricsClient) DeleteLogMetric
func (c *MetricsClient) DeleteLogMetric(ctx context.Context, req *loggingpb.DeleteLogMetricRequest, opts ...gax.CallOption) error
DeleteLogMetric deletes a logs-based metric.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewMetricsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.DeleteLogMetricRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#DeleteLogMetricRequest.
}
err = c.DeleteLogMetric(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*MetricsClient) GetLogMetric
func (c *MetricsClient) GetLogMetric(ctx context.Context, req *loggingpb.GetLogMetricRequest, opts ...gax.CallOption) (*loggingpb.LogMetric, error)
GetLogMetric gets a logs-based metric.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewMetricsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.GetLogMetricRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#GetLogMetricRequest.
}
resp, err := c.GetLogMetric(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*MetricsClient) GetOperation
func (c *MetricsClient) 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"
logging "cloud.google.com/go/logging/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := logging.NewMetricsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*MetricsClient) ListLogMetrics
func (c *MetricsClient) ListLogMetrics(ctx context.Context, req *loggingpb.ListLogMetricsRequest, opts ...gax.CallOption) *LogMetricIterator
ListLogMetrics lists logs-based metrics.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
"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 := logging.NewMetricsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.ListLogMetricsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#ListLogMetricsRequest.
}
it := c.ListLogMetrics(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.(*loggingpb.ListLogMetricsResponse)
}
}
func (*MetricsClient) ListOperations
func (c *MetricsClient) 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"
logging "cloud.google.com/go/logging/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := logging.NewMetricsClient(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)
}
}
func (*MetricsClient) SetGoogleClientInfo
func (mc *MetricsClient) SetGoogleClientInfo(keyval string)
SetGoogleClientInfo sets the name and version of the application in
the x-goog-api-client
header passed on each request. Also passes any
provided key-value pairs. Intended for use by Google-written clients.
Internal use only.
func (*MetricsClient) UpdateLogMetric
func (c *MetricsClient) UpdateLogMetric(ctx context.Context, req *loggingpb.UpdateLogMetricRequest, opts ...gax.CallOption) (*loggingpb.LogMetric, error)
UpdateLogMetric creates or updates a logs-based metric.
Example
package main
import (
"context"
logging "cloud.google.com/go/logging/apiv2"
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
)
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 := logging.NewMetricsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &loggingpb.UpdateLogMetricRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#UpdateLogMetricRequest.
}
resp, err := c.UpdateLogMetric(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
MonitoredResourceDescriptorIterator
type MonitoredResourceDescriptorIterator 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 []*monitoredrespb.MonitoredResourceDescriptor, nextPageToken string, err error)
// contains filtered or unexported fields
}
MonitoredResourceDescriptorIterator manages a stream of *monitoredrespb.MonitoredResourceDescriptor.
func (*MonitoredResourceDescriptorIterator) Next
func (it *MonitoredResourceDescriptorIterator) Next() (*monitoredrespb.MonitoredResourceDescriptor, 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 (*MonitoredResourceDescriptorIterator) PageInfo
func (it *MonitoredResourceDescriptorIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
OperationIterator
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) Next
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
func (it *OperationIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
StringIterator
type StringIterator 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 []string, nextPageToken string, err error)
// contains filtered or unexported fields
}
StringIterator manages a stream of string.
func (*StringIterator) Next
func (it *StringIterator) Next() (string, 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 (*StringIterator) PageInfo
func (it *StringIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
UpdateBucketAsyncOperation
type UpdateBucketAsyncOperation struct {
// contains filtered or unexported fields
}
UpdateBucketAsyncOperation manages a long-running operation from UpdateBucketAsync.
func (*UpdateBucketAsyncOperation) Done
func (op *UpdateBucketAsyncOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*UpdateBucketAsyncOperation) Metadata
func (op *UpdateBucketAsyncOperation) Metadata() (*loggingpb.BucketMetadata, 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 (*UpdateBucketAsyncOperation) Name
func (op *UpdateBucketAsyncOperation) 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 (*UpdateBucketAsyncOperation) Poll
func (op *UpdateBucketAsyncOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*loggingpb.LogBucket, 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 (*UpdateBucketAsyncOperation) Wait
func (op *UpdateBucketAsyncOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*loggingpb.LogBucket, 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.