Documentation ¶
Overview ¶
Package metrics is an experimental, auto-generated package for the logging API.
The Google Cloud Logging API lets you write log entries and manage your logs, log sinks and logs-based metrics.
Index ¶
- Variables
- func MetricPath(project string, metric string) string
- func ProjectPath(project string) string
- type Client
- func (c *Client) Close() error
- func (c *Client) CreateLogMetric(ctx context.Context, req *google_logging_v2.CreateLogMetricRequest) (*google_logging_v2.LogMetric, error)
- func (c *Client) DeleteLogMetric(ctx context.Context, req *google_logging_v2.DeleteLogMetricRequest) error
- func (c *Client) GetLogMetric(ctx context.Context, req *google_logging_v2.GetLogMetricRequest) (*google_logging_v2.LogMetric, error)
- func (c *Client) ListLogMetrics(ctx context.Context, req *google_logging_v2.ListLogMetricsRequest) *LogMetricIterator
- func (c *Client) UpdateLogMetric(ctx context.Context, req *google_logging_v2.UpdateLogMetricRequest) (*google_logging_v2.LogMetric, error)
- type LogMetricIterator
- func (it *LogMetricIterator) Next() (*google_logging_v2.LogMetric, error)
- func (it *LogMetricIterator) NextPage() ([]*google_logging_v2.LogMetric, error)
- func (it *LogMetricIterator) NextPageToken() string
- func (it *LogMetricIterator) SetPageSize(pageSize int32)
- func (it *LogMetricIterator) SetPageToken(token string)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Done is returned by iterators on successful completion. Done = errors.New("iterator done") )
Functions ¶
func MetricPath ¶
MetricPath returns the path for the metric resource.
func ProjectPath ¶
ProjectPath returns the path for the project resource.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client for interacting with MetricsServiceV2.
func NewClient ¶
NewClient creates a new API service client.
Example ¶
package main import ( "cloud.google.com/go/logging/apiv2/metrics" gax "github.com/googleapis/gax-go" "golang.org/x/net/context" ) func main() { ctx := context.Background() opts := []gax.ClientOption{ /* Optional client parameters. */ } c, err := metrics.NewClient(ctx, opts...) _, _ = c, err // Handle error. }
Output:
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) CreateLogMetric ¶
func (c *Client) CreateLogMetric(ctx context.Context, req *google_logging_v2.CreateLogMetricRequest) (*google_logging_v2.LogMetric, error)
CreateLogMetric creates a logs-based metric.
Example ¶
package main import ( "cloud.google.com/go/logging/apiv2/metrics" google_logging_v2 "github.com/googleapis/proto-client-go/logging/v2" "golang.org/x/net/context" ) func main() { ctx := context.Background() c, err := metrics.NewClient(ctx) _ = err // Handle error. req := &google_logging_v2.CreateLogMetricRequest{ /* Data... */ } var resp *google_logging_v2.LogMetric resp, err = c.CreateLogMetric(ctx, req) _, _ = resp, err // Handle error. }
Output:
func (*Client) DeleteLogMetric ¶
func (c *Client) DeleteLogMetric(ctx context.Context, req *google_logging_v2.DeleteLogMetricRequest) error
DeleteLogMetric deletes a logs-based metric.
Example ¶
package main import ( "cloud.google.com/go/logging/apiv2/metrics" google_logging_v2 "github.com/googleapis/proto-client-go/logging/v2" "golang.org/x/net/context" ) func main() { ctx := context.Background() c, err := metrics.NewClient(ctx) _ = err // Handle error. req := &google_logging_v2.DeleteLogMetricRequest{ /* Data... */ } err = c.DeleteLogMetric(ctx, req) _ = err // Handle error. }
Output:
func (*Client) GetLogMetric ¶
func (c *Client) GetLogMetric(ctx context.Context, req *google_logging_v2.GetLogMetricRequest) (*google_logging_v2.LogMetric, error)
GetLogMetric gets a logs-based metric.
Example ¶
package main import ( "cloud.google.com/go/logging/apiv2/metrics" google_logging_v2 "github.com/googleapis/proto-client-go/logging/v2" "golang.org/x/net/context" ) func main() { ctx := context.Background() c, err := metrics.NewClient(ctx) _ = err // Handle error. req := &google_logging_v2.GetLogMetricRequest{ /* Data... */ } var resp *google_logging_v2.LogMetric resp, err = c.GetLogMetric(ctx, req) _, _ = resp, err // Handle error. }
Output:
func (*Client) ListLogMetrics ¶
func (c *Client) ListLogMetrics(ctx context.Context, req *google_logging_v2.ListLogMetricsRequest) *LogMetricIterator
ListLogMetrics lists logs-based metrics.
Example ¶
package main import ( "cloud.google.com/go/logging/apiv2/metrics" google_logging_v2 "github.com/googleapis/proto-client-go/logging/v2" "golang.org/x/net/context" ) func main() { ctx := context.Background() c, err := metrics.NewClient(ctx) _ = err // Handle error. req := &google_logging_v2.ListLogMetricsRequest{ /* Data... */ } it := c.ListLogMetrics(ctx, req) var resp *google_logging_v2.LogMetric for { resp, err = it.Next() if err != nil { break } } _ = resp }
Output:
func (*Client) UpdateLogMetric ¶
func (c *Client) UpdateLogMetric(ctx context.Context, req *google_logging_v2.UpdateLogMetricRequest) (*google_logging_v2.LogMetric, error)
UpdateLogMetric creates or updates a logs-based metric.
Example ¶
package main import ( "cloud.google.com/go/logging/apiv2/metrics" google_logging_v2 "github.com/googleapis/proto-client-go/logging/v2" "golang.org/x/net/context" ) func main() { ctx := context.Background() c, err := metrics.NewClient(ctx) _ = err // Handle error. req := &google_logging_v2.UpdateLogMetricRequest{ /* Data... */ } var resp *google_logging_v2.LogMetric resp, err = c.UpdateLogMetric(ctx, req) _, _ = resp, err // Handle error. }
Output:
type LogMetricIterator ¶
type LogMetricIterator struct {
// contains filtered or unexported fields
}
LogMetricIterator manages a stream of *google_logging_v2.LogMetric.
func (*LogMetricIterator) Next ¶
func (it *LogMetricIterator) Next() (*google_logging_v2.LogMetric, error)
Next returns the next element in the stream. It returns Done at the end of the stream.
func (*LogMetricIterator) NextPage ¶
func (it *LogMetricIterator) NextPage() ([]*google_logging_v2.LogMetric, error)
NextPage moves to the next page and updates its internal data. It returns Done if no more pages exist.
func (*LogMetricIterator) NextPageToken ¶
func (it *LogMetricIterator) NextPageToken() string
NextPageToken returns the next page token.
func (*LogMetricIterator) SetPageSize ¶
func (it *LogMetricIterator) SetPageSize(pageSize int32)
SetPageSize sets the maximum size of the next page to be retrieved.
func (*LogMetricIterator) SetPageToken ¶
func (it *LogMetricIterator) SetPageToken(token string)
SetPageToken sets the next page token to be retrieved. Note, it does not retrieve the next page, or modify the cached page. If Next is called, there is no guarantee that the result returned will be from the next page until NextPage is called.