monitoring

package
v1.21.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2024 License: Apache-2.0 Imports: 17 Imported by: 248

Documentation

Overview

Package monitoring is an auto-generated package for the Cloud Monitoring API.

Manages your Cloud Monitoring data and configurations. Most projects must be associated with a Workspace, with a few exceptions as noted on the individual method pages. The table entries below are presented in alphabetical order, not in order of common use. For explanations of the concepts found in the table entries, read the [Cloud Monitoring documentation](https://cloud.google.com/monitoring/docs).

Use of Context

The ctx passed to NewClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.

To close the open connection, use the Close() method.

For information about setting deadlines, reusing contexts, and more please visit godoc.org/cloud.google.com/go.

Deprecated: Please use cloud.google.com/go/monitoring/apiv3/v2.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultAuthScopes

func DefaultAuthScopes() []string

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

func GroupGroupPath deprecated

func GroupGroupPath(project, group string) string

GroupGroupPath returns the path for the group resource.

Deprecated: Use

fmt.Sprintf("projects/%s/groups/%s", project, group)

instead.

func GroupProjectPath deprecated

func GroupProjectPath(project string) string

GroupProjectPath returns the path for the project resource.

Deprecated: Use

fmt.Sprintf("projects/%s", project)

instead.

func MetricMetricDescriptorPath deprecated

func MetricMetricDescriptorPath(project, metricDescriptor string) string

MetricMetricDescriptorPath returns the path for the metric descriptor resource.

Deprecated: Use

fmt.Sprintf("projects/%s/metricDescriptors/%s", project, metricDescriptor)

instead.

func MetricMonitoredResourceDescriptorPath deprecated

func MetricMonitoredResourceDescriptorPath(project, monitoredResourceDescriptor string) string

MetricMonitoredResourceDescriptorPath returns the path for the monitored resource descriptor resource.

Deprecated: Use

fmt.Sprintf("projects/%s/monitoredResourceDescriptors/%s", project, monitoredResourceDescriptor)

instead.

func MetricProjectPath deprecated

func MetricProjectPath(project string) string

MetricProjectPath returns the path for the project resource.

Deprecated: Use

fmt.Sprintf("projects/%s", project)

instead.

func UptimeCheckProjectPath deprecated

func UptimeCheckProjectPath(project string) string

UptimeCheckProjectPath returns the path for the project resource.

Deprecated: Use

fmt.Sprintf("projects/%s", project)

instead.

func UptimeCheckUptimeCheckConfigPath deprecated

func UptimeCheckUptimeCheckConfigPath(project, uptimeCheckConfig string) string

UptimeCheckUptimeCheckConfigPath returns the path for the uptime check config resource.

Deprecated: Use

fmt.Sprintf("projects/%s/uptimeCheckConfigs/%s", project, uptimeCheckConfig)

instead.

Types

type AlertPolicyCallOptions

type AlertPolicyCallOptions struct {
	ListAlertPolicies []gax.CallOption
	GetAlertPolicy    []gax.CallOption
	CreateAlertPolicy []gax.CallOption
	DeleteAlertPolicy []gax.CallOption
	UpdateAlertPolicy []gax.CallOption
}

AlertPolicyCallOptions contains the retry settings for each method of AlertPolicyClient.

type AlertPolicyClient

type AlertPolicyClient struct {

	// The call options for this service.
	CallOptions *AlertPolicyCallOptions
	// contains filtered or unexported fields
}

AlertPolicyClient is a client for interacting with Cloud Monitoring API.

Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

func NewAlertPolicyClient

func NewAlertPolicyClient(ctx context.Context, opts ...option.ClientOption) (*AlertPolicyClient, error)

NewAlertPolicyClient creates a new alert policy service client.

The AlertPolicyService API is used to manage (list, create, delete, edit) alert policies in Stackdriver Monitoring. An alerting policy is a description of the conditions under which some aspect of your system is considered to be “unhealthy” and the ways to notify people or services about this state. In addition to using this API, alert policies can also be managed through Stackdriver Monitoring (at https://cloud.google.com/monitoring/docs/), which can be reached by clicking the “Monitoring” tab in Cloud Console (at https://console.cloud.google.com/).

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
)

func main() {
	ctx := context.Background()
	c, err := monitoring.NewAlertPolicyClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use client.
	_ = c
}
Output:

func (*AlertPolicyClient) Close

func (c *AlertPolicyClient) Close() error

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

func (*AlertPolicyClient) Connection

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

Connection returns a connection to the API service.

Deprecated.

func (*AlertPolicyClient) CreateAlertPolicy

CreateAlertPolicy creates a new alerting policy.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"

	ctx := context.Background()
	c, err := monitoring.NewAlertPolicyClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.CreateAlertPolicyRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.CreateAlertPolicy(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*AlertPolicyClient) DeleteAlertPolicy

func (c *AlertPolicyClient) DeleteAlertPolicy(ctx context.Context, req *monitoringpb.DeleteAlertPolicyRequest, opts ...gax.CallOption) error

DeleteAlertPolicy deletes an alerting policy.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	ctx := context.Background()
	c, err := monitoring.NewAlertPolicyClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.DeleteAlertPolicyRequest{
		// TODO: Fill request struct fields.
	}
	err = c.DeleteAlertPolicy(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*AlertPolicyClient) GetAlertPolicy

GetAlertPolicy gets a single alerting policy.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"

	ctx := context.Background()
	c, err := monitoring.NewAlertPolicyClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.GetAlertPolicyRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.GetAlertPolicy(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*AlertPolicyClient) ListAlertPolicies

ListAlertPolicies lists the existing alerting policies for the project.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
	"google.golang.org/api/iterator"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
	// import "google.golang.org/api/iterator"

	ctx := context.Background()
	c, err := monitoring.NewAlertPolicyClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

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

func (*AlertPolicyClient) UpdateAlertPolicy

UpdateAlertPolicy updates an alerting policy. You can either replace the entire policy with a new one or replace only certain fields in the current alerting policy by specifying the fields to be updated via updateMask. Returns the updated alerting policy.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"

	ctx := context.Background()
	c, err := monitoring.NewAlertPolicyClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.UpdateAlertPolicyRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.UpdateAlertPolicy(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

type AlertPolicyIterator

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

AlertPolicyIterator manages a stream of *monitoringpb.AlertPolicy.

func (*AlertPolicyIterator) Next

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

func (*AlertPolicyIterator) PageInfo

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

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

type GroupCallOptions

type GroupCallOptions struct {
	ListGroups       []gax.CallOption
	GetGroup         []gax.CallOption
	CreateGroup      []gax.CallOption
	UpdateGroup      []gax.CallOption
	DeleteGroup      []gax.CallOption
	ListGroupMembers []gax.CallOption
}

GroupCallOptions contains the retry settings for each method of GroupClient.

type GroupClient

type GroupClient struct {

	// The call options for this service.
	CallOptions *GroupCallOptions
	// contains filtered or unexported fields
}

GroupClient is a client for interacting with Cloud Monitoring API.

Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

func NewGroupClient

func NewGroupClient(ctx context.Context, opts ...option.ClientOption) (*GroupClient, error)

NewGroupClient creates a new group service client.

The Group API lets you inspect and manage your groups (at #google.monitoring.v3.Group).

A group is a named filter that is used to identify a collection of monitored resources. Groups are typically used to mirror the physical and/or logical topology of the environment. Because group membership is computed dynamically, monitored resources that are started in the future are automatically placed in matching groups. By using a group to name monitored resources in, for example, an alert policy, the target of that alert policy is updated automatically as monitored resources are added and removed from the infrastructure.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
)

func main() {
	ctx := context.Background()
	c, err := monitoring.NewGroupClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use client.
	_ = c
}
Output:

func (*GroupClient) Close

func (c *GroupClient) Close() error

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

func (*GroupClient) Connection

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

Connection returns a connection to the API service.

Deprecated.

func (*GroupClient) CreateGroup

CreateGroup creates a new group.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"

	ctx := context.Background()
	c, err := monitoring.NewGroupClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.CreateGroupRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.CreateGroup(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*GroupClient) DeleteGroup

func (c *GroupClient) DeleteGroup(ctx context.Context, req *monitoringpb.DeleteGroupRequest, opts ...gax.CallOption) error

DeleteGroup deletes an existing group.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	ctx := context.Background()
	c, err := monitoring.NewGroupClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.DeleteGroupRequest{
		// TODO: Fill request struct fields.
	}
	err = c.DeleteGroup(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*GroupClient) GetGroup

GetGroup gets a single group.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"

	ctx := context.Background()
	c, err := monitoring.NewGroupClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.GetGroupRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.GetGroup(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*GroupClient) ListGroupMembers

ListGroupMembers lists the monitored resources that are members of a group.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
	"google.golang.org/api/iterator"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
	// import "google.golang.org/api/iterator"

	ctx := context.Background()
	c, err := monitoring.NewGroupClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

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

func (*GroupClient) ListGroups

ListGroups lists the existing groups.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
	"google.golang.org/api/iterator"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
	// import "google.golang.org/api/iterator"

	ctx := context.Background()
	c, err := monitoring.NewGroupClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

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

func (*GroupClient) UpdateGroup

UpdateGroup updates an existing group. You can change any group attributes except name.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"

	ctx := context.Background()
	c, err := monitoring.NewGroupClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.UpdateGroupRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.UpdateGroup(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

type GroupIterator

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

GroupIterator manages a stream of *monitoringpb.Group.

func (*GroupIterator) Next

func (it *GroupIterator) Next() (*monitoringpb.Group, 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 (*GroupIterator) PageInfo

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

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

type MetricCallOptions

type MetricCallOptions struct {
	ListMonitoredResourceDescriptors []gax.CallOption
	GetMonitoredResourceDescriptor   []gax.CallOption
	ListMetricDescriptors            []gax.CallOption
	GetMetricDescriptor              []gax.CallOption
	CreateMetricDescriptor           []gax.CallOption
	DeleteMetricDescriptor           []gax.CallOption
	ListTimeSeries                   []gax.CallOption
	CreateTimeSeries                 []gax.CallOption
}

MetricCallOptions contains the retry settings for each method of MetricClient.

type MetricClient

type MetricClient struct {

	// The call options for this service.
	CallOptions *MetricCallOptions
	// contains filtered or unexported fields
}

MetricClient is a client for interacting with Cloud Monitoring API.

Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

func NewMetricClient

func NewMetricClient(ctx context.Context, opts ...option.ClientOption) (*MetricClient, error)

NewMetricClient creates a new metric service client.

Manages metric descriptors, monitored resource descriptors, and time series data.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
)

func main() {
	ctx := context.Background()
	c, err := monitoring.NewMetricClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use client.
	_ = c
}
Output:

func (*MetricClient) Close

func (c *MetricClient) Close() error

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

func (*MetricClient) Connection

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

Connection returns a connection to the API service.

Deprecated.

func (*MetricClient) CreateMetricDescriptor

CreateMetricDescriptor creates a new metric descriptor. User-created metric descriptors define custom metrics (at https://cloud.google.com/monitoring/custom-metrics).

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"

	ctx := context.Background()
	c, err := monitoring.NewMetricClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.CreateMetricDescriptorRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.CreateMetricDescriptor(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*MetricClient) CreateTimeSeries

func (c *MetricClient) CreateTimeSeries(ctx context.Context, req *monitoringpb.CreateTimeSeriesRequest, opts ...gax.CallOption) error

CreateTimeSeries creates or adds data to one or more time series. The response is empty if all time series in the request were written. If any time series could not be written, a corresponding failure message is included in the error response.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	ctx := context.Background()
	c, err := monitoring.NewMetricClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.CreateTimeSeriesRequest{
		// TODO: Fill request struct fields.
	}
	err = c.CreateTimeSeries(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*MetricClient) DeleteMetricDescriptor

func (c *MetricClient) DeleteMetricDescriptor(ctx context.Context, req *monitoringpb.DeleteMetricDescriptorRequest, opts ...gax.CallOption) error

DeleteMetricDescriptor deletes a metric descriptor. Only user-created custom metrics (at https://cloud.google.com/monitoring/custom-metrics) can be deleted.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	ctx := context.Background()
	c, err := monitoring.NewMetricClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.DeleteMetricDescriptorRequest{
		// TODO: Fill request struct fields.
	}
	err = c.DeleteMetricDescriptor(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*MetricClient) GetMetricDescriptor

GetMetricDescriptor gets a single metric descriptor. This method does not require a Workspace.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"

	ctx := context.Background()
	c, err := monitoring.NewMetricClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.GetMetricDescriptorRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.GetMetricDescriptor(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*MetricClient) GetMonitoredResourceDescriptor

GetMonitoredResourceDescriptor gets a single monitored resource descriptor. This method does not require a Workspace.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"

	ctx := context.Background()
	c, err := monitoring.NewMetricClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.GetMonitoredResourceDescriptorRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.GetMonitoredResourceDescriptor(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*MetricClient) ListMetricDescriptors

ListMetricDescriptors lists metric descriptors that match a filter. This method does not require a Workspace.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
	"google.golang.org/api/iterator"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
	// import "google.golang.org/api/iterator"

	ctx := context.Background()
	c, err := monitoring.NewMetricClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

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

func (*MetricClient) ListMonitoredResourceDescriptors

ListMonitoredResourceDescriptors lists monitored resource descriptors that match a filter. This method does not require a Workspace.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
	"google.golang.org/api/iterator"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
	// import "google.golang.org/api/iterator"

	ctx := context.Background()
	c, err := monitoring.NewMetricClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.ListMonitoredResourceDescriptorsRequest{
		// TODO: Fill request struct fields.
	}
	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
	}
}
Output:

func (*MetricClient) ListTimeSeries

ListTimeSeries lists time series that match a filter. This method does not require a Workspace.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
	"google.golang.org/api/iterator"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
	// import "google.golang.org/api/iterator"

	ctx := context.Background()
	c, err := monitoring.NewMetricClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

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

type MetricDescriptorIterator

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

MetricDescriptorIterator manages a stream of *metricpb.MetricDescriptor.

func (*MetricDescriptorIterator) Next

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

func (*MetricDescriptorIterator) PageInfo

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

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

type 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

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

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

type MonitoredResourceIterator

type MonitoredResourceIterator 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.MonitoredResource, nextPageToken string, err error)
	// contains filtered or unexported fields
}

MonitoredResourceIterator manages a stream of *monitoredrespb.MonitoredResource.

func (*MonitoredResourceIterator) Next

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

func (*MonitoredResourceIterator) PageInfo

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

type NotificationChannelCallOptions

type NotificationChannelCallOptions struct {
	ListNotificationChannelDescriptors      []gax.CallOption
	GetNotificationChannelDescriptor        []gax.CallOption
	ListNotificationChannels                []gax.CallOption
	GetNotificationChannel                  []gax.CallOption
	CreateNotificationChannel               []gax.CallOption
	UpdateNotificationChannel               []gax.CallOption
	DeleteNotificationChannel               []gax.CallOption
	SendNotificationChannelVerificationCode []gax.CallOption
	GetNotificationChannelVerificationCode  []gax.CallOption
	VerifyNotificationChannel               []gax.CallOption
}

NotificationChannelCallOptions contains the retry settings for each method of NotificationChannelClient.

type NotificationChannelClient

type NotificationChannelClient struct {

	// The call options for this service.
	CallOptions *NotificationChannelCallOptions
	// contains filtered or unexported fields
}

NotificationChannelClient is a client for interacting with Cloud Monitoring API.

Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

func NewNotificationChannelClient

func NewNotificationChannelClient(ctx context.Context, opts ...option.ClientOption) (*NotificationChannelClient, error)

NewNotificationChannelClient creates a new notification channel service client.

The Notification Channel API provides access to configuration that controls how messages related to incidents are sent.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
)

func main() {
	ctx := context.Background()
	c, err := monitoring.NewNotificationChannelClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use client.
	_ = c
}
Output:

func (*NotificationChannelClient) Close

func (c *NotificationChannelClient) Close() error

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

func (*NotificationChannelClient) Connection

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

Connection returns a connection to the API service.

Deprecated.

func (*NotificationChannelClient) CreateNotificationChannel

CreateNotificationChannel creates a new notification channel, representing a single notification endpoint such as an email address, SMS number, or PagerDuty service.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"

	ctx := context.Background()
	c, err := monitoring.NewNotificationChannelClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.CreateNotificationChannelRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.CreateNotificationChannel(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*NotificationChannelClient) DeleteNotificationChannel

DeleteNotificationChannel deletes a notification channel.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	ctx := context.Background()
	c, err := monitoring.NewNotificationChannelClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.DeleteNotificationChannelRequest{
		// TODO: Fill request struct fields.
	}
	err = c.DeleteNotificationChannel(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*NotificationChannelClient) GetNotificationChannel

GetNotificationChannel gets a single notification channel. The channel includes the relevant configuration details with which the channel was created. However, the response may truncate or omit passwords, API keys, or other private key matter and thus the response may not be 100% identical to the information that was supplied in the call to the create method.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"

	ctx := context.Background()
	c, err := monitoring.NewNotificationChannelClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.GetNotificationChannelRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.GetNotificationChannel(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*NotificationChannelClient) GetNotificationChannelDescriptor

GetNotificationChannelDescriptor gets a single channel descriptor. The descriptor indicates which fields are expected / permitted for a notification channel of the given type.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"

	ctx := context.Background()
	c, err := monitoring.NewNotificationChannelClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.GetNotificationChannelDescriptorRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.GetNotificationChannelDescriptor(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*NotificationChannelClient) GetNotificationChannelVerificationCode

GetNotificationChannelVerificationCode requests a verification code for an already verified channel that can then be used in a call to VerifyNotificationChannel() on a different channel with an equivalent identity in the same or in a different project. This makes it possible to copy a channel between projects without requiring manual reverification of the channel. If the channel is not in the verified state, this method will fail (in other words, this may only be used if the SendNotificationChannelVerificationCode and VerifyNotificationChannel paths have already been used to put the given channel into the verified state).

There is no guarantee that the verification codes returned by this method will be of a similar structure or form as the ones that are delivered to the channel via SendNotificationChannelVerificationCode; while VerifyNotificationChannel() will recognize both the codes delivered via SendNotificationChannelVerificationCode() and returned from GetNotificationChannelVerificationCode(), it is typically the case that the verification codes delivered via SendNotificationChannelVerificationCode() will be shorter and also have a shorter expiration (e.g. codes such as “G-123456”) whereas GetVerificationCode() will typically return a much longer, websafe base 64 encoded string that has a longer expiration time.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"

	ctx := context.Background()
	c, err := monitoring.NewNotificationChannelClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.GetNotificationChannelVerificationCodeRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.GetNotificationChannelVerificationCode(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*NotificationChannelClient) ListNotificationChannelDescriptors

ListNotificationChannelDescriptors lists the descriptors for supported channel types. The use of descriptors makes it possible for new channel types to be dynamically added.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
	"google.golang.org/api/iterator"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
	// import "google.golang.org/api/iterator"

	ctx := context.Background()
	c, err := monitoring.NewNotificationChannelClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

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

func (*NotificationChannelClient) ListNotificationChannels

ListNotificationChannels lists the notification channels that have been created for the project.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
	"google.golang.org/api/iterator"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
	// import "google.golang.org/api/iterator"

	ctx := context.Background()
	c, err := monitoring.NewNotificationChannelClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

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

func (*NotificationChannelClient) SendNotificationChannelVerificationCode

func (c *NotificationChannelClient) SendNotificationChannelVerificationCode(ctx context.Context, req *monitoringpb.SendNotificationChannelVerificationCodeRequest, opts ...gax.CallOption) error

SendNotificationChannelVerificationCode causes a verification code to be delivered to the channel. The code can then be supplied in VerifyNotificationChannel to verify the channel.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	ctx := context.Background()
	c, err := monitoring.NewNotificationChannelClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.SendNotificationChannelVerificationCodeRequest{
		// TODO: Fill request struct fields.
	}
	err = c.SendNotificationChannelVerificationCode(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*NotificationChannelClient) UpdateNotificationChannel

UpdateNotificationChannel updates a notification channel. Fields not specified in the field mask remain unchanged.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"

	ctx := context.Background()
	c, err := monitoring.NewNotificationChannelClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.UpdateNotificationChannelRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.UpdateNotificationChannel(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*NotificationChannelClient) VerifyNotificationChannel

VerifyNotificationChannel verifies a NotificationChannel by proving receipt of the code delivered to the channel as a result of calling SendNotificationChannelVerificationCode.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"

	ctx := context.Background()
	c, err := monitoring.NewNotificationChannelClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.VerifyNotificationChannelRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.VerifyNotificationChannel(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

type NotificationChannelDescriptorIterator

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

NotificationChannelDescriptorIterator manages a stream of *monitoringpb.NotificationChannelDescriptor.

func (*NotificationChannelDescriptorIterator) Next

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

func (*NotificationChannelDescriptorIterator) PageInfo

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

type NotificationChannelIterator

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

NotificationChannelIterator manages a stream of *monitoringpb.NotificationChannel.

func (*NotificationChannelIterator) Next

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

func (*NotificationChannelIterator) PageInfo

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

type ServiceIterator

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

ServiceIterator manages a stream of *monitoringpb.Service.

func (*ServiceIterator) Next

func (it *ServiceIterator) Next() (*monitoringpb.Service, 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 (*ServiceIterator) PageInfo

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

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

type ServiceLevelObjectiveIterator

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

ServiceLevelObjectiveIterator manages a stream of *monitoringpb.ServiceLevelObjective.

func (*ServiceLevelObjectiveIterator) Next

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

func (*ServiceLevelObjectiveIterator) PageInfo

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

type ServiceMonitoringCallOptions

type ServiceMonitoringCallOptions struct {
	CreateService               []gax.CallOption
	GetService                  []gax.CallOption
	ListServices                []gax.CallOption
	UpdateService               []gax.CallOption
	DeleteService               []gax.CallOption
	CreateServiceLevelObjective []gax.CallOption
	GetServiceLevelObjective    []gax.CallOption
	ListServiceLevelObjectives  []gax.CallOption
	UpdateServiceLevelObjective []gax.CallOption
	DeleteServiceLevelObjective []gax.CallOption
}

ServiceMonitoringCallOptions contains the retry settings for each method of ServiceMonitoringClient.

type ServiceMonitoringClient

type ServiceMonitoringClient struct {

	// The call options for this service.
	CallOptions *ServiceMonitoringCallOptions
	// contains filtered or unexported fields
}

ServiceMonitoringClient is a client for interacting with Cloud Monitoring API.

Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

func NewServiceMonitoringClient

func NewServiceMonitoringClient(ctx context.Context, opts ...option.ClientOption) (*ServiceMonitoringClient, error)

NewServiceMonitoringClient creates a new service monitoring service client.

The Cloud Monitoring Service-Oriented Monitoring API has endpoints for managing and querying aspects of a workspace’s services. These include the Service's monitored resources, its Service-Level Objectives, and a taxonomy of categorized Health Metrics.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
)

func main() {
	ctx := context.Background()
	c, err := monitoring.NewServiceMonitoringClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use client.
	_ = c
}
Output:

func (*ServiceMonitoringClient) Close

func (c *ServiceMonitoringClient) Close() error

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

func (*ServiceMonitoringClient) Connection

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

Connection returns a connection to the API service.

Deprecated.

func (*ServiceMonitoringClient) CreateService

CreateService create a Service.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"

	ctx := context.Background()
	c, err := monitoring.NewServiceMonitoringClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.CreateServiceRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.CreateService(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*ServiceMonitoringClient) CreateServiceLevelObjective

CreateServiceLevelObjective create a ServiceLevelObjective for the given Service.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"

	ctx := context.Background()
	c, err := monitoring.NewServiceMonitoringClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.CreateServiceLevelObjectiveRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.CreateServiceLevelObjective(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*ServiceMonitoringClient) DeleteService

DeleteService soft delete this Service.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	ctx := context.Background()
	c, err := monitoring.NewServiceMonitoringClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.DeleteServiceRequest{
		// TODO: Fill request struct fields.
	}
	err = c.DeleteService(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*ServiceMonitoringClient) DeleteServiceLevelObjective

DeleteServiceLevelObjective delete the given ServiceLevelObjective.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	ctx := context.Background()
	c, err := monitoring.NewServiceMonitoringClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.DeleteServiceLevelObjectiveRequest{
		// TODO: Fill request struct fields.
	}
	err = c.DeleteServiceLevelObjective(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*ServiceMonitoringClient) GetService

GetService get the named Service.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"

	ctx := context.Background()
	c, err := monitoring.NewServiceMonitoringClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.GetServiceRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.GetService(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*ServiceMonitoringClient) GetServiceLevelObjective

GetServiceLevelObjective get a ServiceLevelObjective by name.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"

	ctx := context.Background()
	c, err := monitoring.NewServiceMonitoringClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.GetServiceLevelObjectiveRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.GetServiceLevelObjective(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*ServiceMonitoringClient) ListServiceLevelObjectives

ListServiceLevelObjectives list the ServiceLevelObjectives for the given Service.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
	"google.golang.org/api/iterator"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
	// import "google.golang.org/api/iterator"

	ctx := context.Background()
	c, err := monitoring.NewServiceMonitoringClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

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

func (*ServiceMonitoringClient) ListServices

ListServices list Services for this workspace.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
	"google.golang.org/api/iterator"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
	// import "google.golang.org/api/iterator"

	ctx := context.Background()
	c, err := monitoring.NewServiceMonitoringClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

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

func (*ServiceMonitoringClient) UpdateService

UpdateService update this Service.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"

	ctx := context.Background()
	c, err := monitoring.NewServiceMonitoringClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.UpdateServiceRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.UpdateService(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*ServiceMonitoringClient) UpdateServiceLevelObjective

UpdateServiceLevelObjective update the given ServiceLevelObjective.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"

	ctx := context.Background()
	c, err := monitoring.NewServiceMonitoringClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.UpdateServiceLevelObjectiveRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.UpdateServiceLevelObjective(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

type TimeSeriesIterator

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

TimeSeriesIterator manages a stream of *monitoringpb.TimeSeries.

func (*TimeSeriesIterator) Next

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

func (*TimeSeriesIterator) PageInfo

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

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

type UptimeCheckCallOptions

type UptimeCheckCallOptions struct {
	ListUptimeCheckConfigs  []gax.CallOption
	GetUptimeCheckConfig    []gax.CallOption
	CreateUptimeCheckConfig []gax.CallOption
	UpdateUptimeCheckConfig []gax.CallOption
	DeleteUptimeCheckConfig []gax.CallOption
	ListUptimeCheckIps      []gax.CallOption
}

UptimeCheckCallOptions contains the retry settings for each method of UptimeCheckClient.

type UptimeCheckClient

type UptimeCheckClient struct {

	// The call options for this service.
	CallOptions *UptimeCheckCallOptions
	// contains filtered or unexported fields
}

UptimeCheckClient is a client for interacting with Cloud Monitoring API.

Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

func NewUptimeCheckClient

func NewUptimeCheckClient(ctx context.Context, opts ...option.ClientOption) (*UptimeCheckClient, error)

NewUptimeCheckClient creates a new uptime check service client.

The UptimeCheckService API is used to manage (list, create, delete, edit) Uptime check configurations in the Stackdriver Monitoring product. An Uptime check is a piece of configuration that determines which resources and services to monitor for availability. These configurations can also be configured interactively by navigating to the [Cloud Console] (http://console.cloud.google.com (at http://console.cloud.google.com)), selecting the appropriate project, clicking on “Monitoring” on the left-hand side to navigate to Stackdriver, and then clicking on “Uptime”.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
)

func main() {
	ctx := context.Background()
	c, err := monitoring.NewUptimeCheckClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use client.
	_ = c
}
Output:

func (*UptimeCheckClient) Close

func (c *UptimeCheckClient) Close() error

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

func (*UptimeCheckClient) Connection

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

Connection returns a connection to the API service.

Deprecated.

func (*UptimeCheckClient) CreateUptimeCheckConfig

CreateUptimeCheckConfig creates a new Uptime check configuration.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"

	ctx := context.Background()
	c, err := monitoring.NewUptimeCheckClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.CreateUptimeCheckConfigRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.CreateUptimeCheckConfig(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*UptimeCheckClient) DeleteUptimeCheckConfig

func (c *UptimeCheckClient) DeleteUptimeCheckConfig(ctx context.Context, req *monitoringpb.DeleteUptimeCheckConfigRequest, opts ...gax.CallOption) error

DeleteUptimeCheckConfig deletes an Uptime check configuration. Note that this method will fail if the Uptime check configuration is referenced by an alert policy or other dependent configs that would be rendered invalid by the deletion.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	ctx := context.Background()
	c, err := monitoring.NewUptimeCheckClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.DeleteUptimeCheckConfigRequest{
		// TODO: Fill request struct fields.
	}
	err = c.DeleteUptimeCheckConfig(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*UptimeCheckClient) GetUptimeCheckConfig

GetUptimeCheckConfig gets a single Uptime check configuration.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"

	ctx := context.Background()
	c, err := monitoring.NewUptimeCheckClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.GetUptimeCheckConfigRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.GetUptimeCheckConfig(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*UptimeCheckClient) ListUptimeCheckConfigs

ListUptimeCheckConfigs lists the existing valid Uptime check configurations for the project (leaving out any invalid configurations).

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
	"google.golang.org/api/iterator"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
	// import "google.golang.org/api/iterator"

	ctx := context.Background()
	c, err := monitoring.NewUptimeCheckClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

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

func (*UptimeCheckClient) ListUptimeCheckIps

ListUptimeCheckIps returns the list of IP addresses that checkers run from

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
	"google.golang.org/api/iterator"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
	// import "google.golang.org/api/iterator"

	ctx := context.Background()
	c, err := monitoring.NewUptimeCheckClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

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

func (*UptimeCheckClient) UpdateUptimeCheckConfig

UpdateUptimeCheckConfig updates an Uptime check configuration. You can either replace the entire configuration with a new one or replace only certain fields in the current configuration by specifying the fields to be updated via updateMask. Returns the updated configuration.

Example
package main

import (
	"context"

	monitoring "cloud.google.com/go/monitoring/apiv3"
	"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)

func main() {
	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"

	ctx := context.Background()
	c, err := monitoring.NewUptimeCheckClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.UpdateUptimeCheckConfigRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.UpdateUptimeCheckConfig(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

type UptimeCheckConfigIterator

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

UptimeCheckConfigIterator manages a stream of *monitoringpb.UptimeCheckConfig.

func (*UptimeCheckConfigIterator) Next

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

func (*UptimeCheckConfigIterator) PageInfo

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

type UptimeCheckIpIterator

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

UptimeCheckIpIterator manages a stream of *monitoringpb.UptimeCheckIp.

func (*UptimeCheckIpIterator) Next

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

func (*UptimeCheckIpIterator) PageInfo

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

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

Directories

Path Synopsis
v2
Package monitoring is an auto-generated package for the Cloud Monitoring API.
Package monitoring is an auto-generated package for the Cloud Monitoring API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL