package monitoring
import "cloud.google.com/go/monitoring/apiv3/v2"
Package monitoring is an auto-generated package for the Cloud Monitoring API.
Manages your Cloud Monitoring data and configurations.
General documentation
For information about setting deadlines, reusing contexts, and more please visit https://pkg.go.dev/cloud.google.com/go.
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 := monitoring.NewAlertPolicyClient(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 := monitoring.NewAlertPolicyClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.ListAlertPoliciesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#ListAlertPoliciesRequest.
}
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
}
Use of Context
The ctx passed to NewAlertPolicyClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.
To close the open connection, use the Close() method.
Index ¶
- func DefaultAuthScopes() []string
- type AlertPolicyCallOptions
- type AlertPolicyClient
- func NewAlertPolicyClient(ctx context.Context, opts ...option.ClientOption) (*AlertPolicyClient, error)
- func (c *AlertPolicyClient) Close() error
- func (c *AlertPolicyClient) Connection() *grpc.ClientConn
- func (c *AlertPolicyClient) CreateAlertPolicy(ctx context.Context, req *monitoringpb.CreateAlertPolicyRequest, opts ...gax.CallOption) (*monitoringpb.AlertPolicy, error)
- func (c *AlertPolicyClient) DeleteAlertPolicy(ctx context.Context, req *monitoringpb.DeleteAlertPolicyRequest, opts ...gax.CallOption) error
- func (c *AlertPolicyClient) GetAlertPolicy(ctx context.Context, req *monitoringpb.GetAlertPolicyRequest, opts ...gax.CallOption) (*monitoringpb.AlertPolicy, error)
- func (c *AlertPolicyClient) ListAlertPolicies(ctx context.Context, req *monitoringpb.ListAlertPoliciesRequest, opts ...gax.CallOption) *AlertPolicyIterator
- func (c *AlertPolicyClient) UpdateAlertPolicy(ctx context.Context, req *monitoringpb.UpdateAlertPolicyRequest, opts ...gax.CallOption) (*monitoringpb.AlertPolicy, error)
- type AlertPolicyIterator
- func (it *AlertPolicyIterator) Next() (*monitoringpb.AlertPolicy, error)
- func (it *AlertPolicyIterator) PageInfo() *iterator.PageInfo
- type GroupCallOptions
- type GroupClient
- func NewGroupClient(ctx context.Context, opts ...option.ClientOption) (*GroupClient, error)
- func (c *GroupClient) Close() error
- func (c *GroupClient) Connection() *grpc.ClientConn
- func (c *GroupClient) CreateGroup(ctx context.Context, req *monitoringpb.CreateGroupRequest, opts ...gax.CallOption) (*monitoringpb.Group, error)
- func (c *GroupClient) DeleteGroup(ctx context.Context, req *monitoringpb.DeleteGroupRequest, opts ...gax.CallOption) error
- func (c *GroupClient) GetGroup(ctx context.Context, req *monitoringpb.GetGroupRequest, opts ...gax.CallOption) (*monitoringpb.Group, error)
- func (c *GroupClient) ListGroupMembers(ctx context.Context, req *monitoringpb.ListGroupMembersRequest, opts ...gax.CallOption) *MonitoredResourceIterator
- func (c *GroupClient) ListGroups(ctx context.Context, req *monitoringpb.ListGroupsRequest, opts ...gax.CallOption) *GroupIterator
- func (c *GroupClient) UpdateGroup(ctx context.Context, req *monitoringpb.UpdateGroupRequest, opts ...gax.CallOption) (*monitoringpb.Group, error)
- type GroupIterator
- func (it *GroupIterator) Next() (*monitoringpb.Group, error)
- func (it *GroupIterator) PageInfo() *iterator.PageInfo
- type MetricCallOptions
- type MetricClient
- func NewMetricClient(ctx context.Context, opts ...option.ClientOption) (*MetricClient, error)
- func (c *MetricClient) Close() error
- func (c *MetricClient) Connection() *grpc.ClientConn
- func (c *MetricClient) CreateMetricDescriptor(ctx context.Context, req *monitoringpb.CreateMetricDescriptorRequest, opts ...gax.CallOption) (*metricpb.MetricDescriptor, error)
- func (c *MetricClient) CreateServiceTimeSeries(ctx context.Context, req *monitoringpb.CreateTimeSeriesRequest, opts ...gax.CallOption) error
- func (c *MetricClient) CreateTimeSeries(ctx context.Context, req *monitoringpb.CreateTimeSeriesRequest, opts ...gax.CallOption) error
- func (c *MetricClient) DeleteMetricDescriptor(ctx context.Context, req *monitoringpb.DeleteMetricDescriptorRequest, opts ...gax.CallOption) error
- func (c *MetricClient) GetMetricDescriptor(ctx context.Context, req *monitoringpb.GetMetricDescriptorRequest, opts ...gax.CallOption) (*metricpb.MetricDescriptor, error)
- func (c *MetricClient) GetMonitoredResourceDescriptor(ctx context.Context, req *monitoringpb.GetMonitoredResourceDescriptorRequest, opts ...gax.CallOption) (*monitoredrespb.MonitoredResourceDescriptor, error)
- func (c *MetricClient) ListMetricDescriptors(ctx context.Context, req *monitoringpb.ListMetricDescriptorsRequest, opts ...gax.CallOption) *MetricDescriptorIterator
- func (c *MetricClient) ListMonitoredResourceDescriptors(ctx context.Context, req *monitoringpb.ListMonitoredResourceDescriptorsRequest, opts ...gax.CallOption) *MonitoredResourceDescriptorIterator
- func (c *MetricClient) ListTimeSeries(ctx context.Context, req *monitoringpb.ListTimeSeriesRequest, opts ...gax.CallOption) *TimeSeriesIterator
- type MetricDescriptorIterator
- func (it *MetricDescriptorIterator) Next() (*metricpb.MetricDescriptor, error)
- func (it *MetricDescriptorIterator) PageInfo() *iterator.PageInfo
- type MonitoredResourceDescriptorIterator
- func (it *MonitoredResourceDescriptorIterator) Next() (*monitoredrespb.MonitoredResourceDescriptor, error)
- func (it *MonitoredResourceDescriptorIterator) PageInfo() *iterator.PageInfo
- type MonitoredResourceIterator
- func (it *MonitoredResourceIterator) Next() (*monitoredrespb.MonitoredResource, error)
- func (it *MonitoredResourceIterator) PageInfo() *iterator.PageInfo
- type NotificationChannelCallOptions
- type NotificationChannelClient
- func NewNotificationChannelClient(ctx context.Context, opts ...option.ClientOption) (*NotificationChannelClient, error)
- func (c *NotificationChannelClient) Close() error
- func (c *NotificationChannelClient) Connection() *grpc.ClientConn
- func (c *NotificationChannelClient) CreateNotificationChannel(ctx context.Context, req *monitoringpb.CreateNotificationChannelRequest, opts ...gax.CallOption) (*monitoringpb.NotificationChannel, error)
- func (c *NotificationChannelClient) DeleteNotificationChannel(ctx context.Context, req *monitoringpb.DeleteNotificationChannelRequest, opts ...gax.CallOption) error
- func (c *NotificationChannelClient) GetNotificationChannel(ctx context.Context, req *monitoringpb.GetNotificationChannelRequest, opts ...gax.CallOption) (*monitoringpb.NotificationChannel, error)
- func (c *NotificationChannelClient) GetNotificationChannelDescriptor(ctx context.Context, req *monitoringpb.GetNotificationChannelDescriptorRequest, opts ...gax.CallOption) (*monitoringpb.NotificationChannelDescriptor, error)
- func (c *NotificationChannelClient) GetNotificationChannelVerificationCode(ctx context.Context, req *monitoringpb.GetNotificationChannelVerificationCodeRequest, opts ...gax.CallOption) (*monitoringpb.GetNotificationChannelVerificationCodeResponse, error)
- func (c *NotificationChannelClient) ListNotificationChannelDescriptors(ctx context.Context, req *monitoringpb.ListNotificationChannelDescriptorsRequest, opts ...gax.CallOption) *NotificationChannelDescriptorIterator
- func (c *NotificationChannelClient) ListNotificationChannels(ctx context.Context, req *monitoringpb.ListNotificationChannelsRequest, opts ...gax.CallOption) *NotificationChannelIterator
- func (c *NotificationChannelClient) SendNotificationChannelVerificationCode(ctx context.Context, req *monitoringpb.SendNotificationChannelVerificationCodeRequest, opts ...gax.CallOption) error
- func (c *NotificationChannelClient) UpdateNotificationChannel(ctx context.Context, req *monitoringpb.UpdateNotificationChannelRequest, opts ...gax.CallOption) (*monitoringpb.NotificationChannel, error)
- func (c *NotificationChannelClient) VerifyNotificationChannel(ctx context.Context, req *monitoringpb.VerifyNotificationChannelRequest, opts ...gax.CallOption) (*monitoringpb.NotificationChannel, error)
- type NotificationChannelDescriptorIterator
- func (it *NotificationChannelDescriptorIterator) Next() (*monitoringpb.NotificationChannelDescriptor, error)
- func (it *NotificationChannelDescriptorIterator) PageInfo() *iterator.PageInfo
- type NotificationChannelIterator
- func (it *NotificationChannelIterator) Next() (*monitoringpb.NotificationChannel, error)
- func (it *NotificationChannelIterator) PageInfo() *iterator.PageInfo
- type QueryCallOptions
- type QueryClient
- func NewQueryClient(ctx context.Context, opts ...option.ClientOption) (*QueryClient, error)
- func (c *QueryClient) Close() error
- func (c *QueryClient) Connection() *grpc.ClientConn
- func (c *QueryClient) QueryTimeSeries(ctx context.Context, req *monitoringpb.QueryTimeSeriesRequest, opts ...gax.CallOption) *TimeSeriesDataIterator
- type ServiceIterator
- func (it *ServiceIterator) Next() (*monitoringpb.Service, error)
- func (it *ServiceIterator) PageInfo() *iterator.PageInfo
- type ServiceLevelObjectiveIterator
- func (it *ServiceLevelObjectiveIterator) Next() (*monitoringpb.ServiceLevelObjective, error)
- func (it *ServiceLevelObjectiveIterator) PageInfo() *iterator.PageInfo
- type ServiceMonitoringCallOptions
- type ServiceMonitoringClient
- func NewServiceMonitoringClient(ctx context.Context, opts ...option.ClientOption) (*ServiceMonitoringClient, error)
- func (c *ServiceMonitoringClient) Close() error
- func (c *ServiceMonitoringClient) Connection() *grpc.ClientConn
- func (c *ServiceMonitoringClient) CreateService(ctx context.Context, req *monitoringpb.CreateServiceRequest, opts ...gax.CallOption) (*monitoringpb.Service, error)
- func (c *ServiceMonitoringClient) CreateServiceLevelObjective(ctx context.Context, req *monitoringpb.CreateServiceLevelObjectiveRequest, opts ...gax.CallOption) (*monitoringpb.ServiceLevelObjective, error)
- func (c *ServiceMonitoringClient) DeleteService(ctx context.Context, req *monitoringpb.DeleteServiceRequest, opts ...gax.CallOption) error
- func (c *ServiceMonitoringClient) DeleteServiceLevelObjective(ctx context.Context, req *monitoringpb.DeleteServiceLevelObjectiveRequest, opts ...gax.CallOption) error
- func (c *ServiceMonitoringClient) GetService(ctx context.Context, req *monitoringpb.GetServiceRequest, opts ...gax.CallOption) (*monitoringpb.Service, error)
- func (c *ServiceMonitoringClient) GetServiceLevelObjective(ctx context.Context, req *monitoringpb.GetServiceLevelObjectiveRequest, opts ...gax.CallOption) (*monitoringpb.ServiceLevelObjective, error)
- func (c *ServiceMonitoringClient) ListServiceLevelObjectives(ctx context.Context, req *monitoringpb.ListServiceLevelObjectivesRequest, opts ...gax.CallOption) *ServiceLevelObjectiveIterator
- func (c *ServiceMonitoringClient) ListServices(ctx context.Context, req *monitoringpb.ListServicesRequest, opts ...gax.CallOption) *ServiceIterator
- func (c *ServiceMonitoringClient) UpdateService(ctx context.Context, req *monitoringpb.UpdateServiceRequest, opts ...gax.CallOption) (*monitoringpb.Service, error)
- func (c *ServiceMonitoringClient) UpdateServiceLevelObjective(ctx context.Context, req *monitoringpb.UpdateServiceLevelObjectiveRequest, opts ...gax.CallOption) (*monitoringpb.ServiceLevelObjective, error)
- type SnoozeCallOptions
- type SnoozeClient
- func NewSnoozeClient(ctx context.Context, opts ...option.ClientOption) (*SnoozeClient, error)
- func (c *SnoozeClient) Close() error
- func (c *SnoozeClient) Connection() *grpc.ClientConn
- func (c *SnoozeClient) CreateSnooze(ctx context.Context, req *monitoringpb.CreateSnoozeRequest, opts ...gax.CallOption) (*monitoringpb.Snooze, error)
- func (c *SnoozeClient) GetSnooze(ctx context.Context, req *monitoringpb.GetSnoozeRequest, opts ...gax.CallOption) (*monitoringpb.Snooze, error)
- func (c *SnoozeClient) ListSnoozes(ctx context.Context, req *monitoringpb.ListSnoozesRequest, opts ...gax.CallOption) *SnoozeIterator
- func (c *SnoozeClient) UpdateSnooze(ctx context.Context, req *monitoringpb.UpdateSnoozeRequest, opts ...gax.CallOption) (*monitoringpb.Snooze, error)
- type SnoozeIterator
- func (it *SnoozeIterator) Next() (*monitoringpb.Snooze, error)
- func (it *SnoozeIterator) PageInfo() *iterator.PageInfo
- type TimeSeriesDataIterator
- func (it *TimeSeriesDataIterator) Next() (*monitoringpb.TimeSeriesData, error)
- func (it *TimeSeriesDataIterator) PageInfo() *iterator.PageInfo
- type TimeSeriesIterator
- func (it *TimeSeriesIterator) Next() (*monitoringpb.TimeSeries, error)
- func (it *TimeSeriesIterator) PageInfo() *iterator.PageInfo
- type UptimeCheckCallOptions
- type UptimeCheckClient
- func NewUptimeCheckClient(ctx context.Context, opts ...option.ClientOption) (*UptimeCheckClient, error)
- func (c *UptimeCheckClient) Close() error
- func (c *UptimeCheckClient) Connection() *grpc.ClientConn
- func (c *UptimeCheckClient) CreateUptimeCheckConfig(ctx context.Context, req *monitoringpb.CreateUptimeCheckConfigRequest, opts ...gax.CallOption) (*monitoringpb.UptimeCheckConfig, error)
- func (c *UptimeCheckClient) DeleteUptimeCheckConfig(ctx context.Context, req *monitoringpb.DeleteUptimeCheckConfigRequest, opts ...gax.CallOption) error
- func (c *UptimeCheckClient) GetUptimeCheckConfig(ctx context.Context, req *monitoringpb.GetUptimeCheckConfigRequest, opts ...gax.CallOption) (*monitoringpb.UptimeCheckConfig, error)
- func (c *UptimeCheckClient) ListUptimeCheckConfigs(ctx context.Context, req *monitoringpb.ListUptimeCheckConfigsRequest, opts ...gax.CallOption) *UptimeCheckConfigIterator
- func (c *UptimeCheckClient) ListUptimeCheckIps(ctx context.Context, req *monitoringpb.ListUptimeCheckIpsRequest, opts ...gax.CallOption) *UptimeCheckIpIterator
- func (c *UptimeCheckClient) UpdateUptimeCheckConfig(ctx context.Context, req *monitoringpb.UpdateUptimeCheckConfigRequest, opts ...gax.CallOption) (*monitoringpb.UptimeCheckConfig, error)
- type UptimeCheckConfigIterator
- func (it *UptimeCheckConfigIterator) Next() (*monitoringpb.UptimeCheckConfig, error)
- func (it *UptimeCheckConfigIterator) PageInfo() *iterator.PageInfo
- type UptimeCheckIpIterator
Examples ¶
- AlertPolicyClient.CreateAlertPolicy
- AlertPolicyClient.DeleteAlertPolicy
- AlertPolicyClient.GetAlertPolicy
- AlertPolicyClient.ListAlertPolicies
- AlertPolicyClient.UpdateAlertPolicy
- GroupClient.CreateGroup
- GroupClient.DeleteGroup
- GroupClient.GetGroup
- GroupClient.ListGroupMembers
- GroupClient.ListGroups
- GroupClient.UpdateGroup
- MetricClient.CreateMetricDescriptor
- MetricClient.CreateServiceTimeSeries
- MetricClient.CreateTimeSeries
- MetricClient.DeleteMetricDescriptor
- MetricClient.GetMetricDescriptor
- MetricClient.GetMonitoredResourceDescriptor
- MetricClient.ListMetricDescriptors
- MetricClient.ListMonitoredResourceDescriptors
- MetricClient.ListTimeSeries
- NewAlertPolicyClient
- NewGroupClient
- NewMetricClient
- NewNotificationChannelClient
- NewQueryClient
- NewServiceMonitoringClient
- NewSnoozeClient
- NewUptimeCheckClient
- NotificationChannelClient.CreateNotificationChannel
- NotificationChannelClient.DeleteNotificationChannel
- NotificationChannelClient.GetNotificationChannel
- NotificationChannelClient.GetNotificationChannelDescriptor
- NotificationChannelClient.GetNotificationChannelVerificationCode
- NotificationChannelClient.ListNotificationChannelDescriptors
- NotificationChannelClient.ListNotificationChannels
- NotificationChannelClient.SendNotificationChannelVerificationCode
- NotificationChannelClient.UpdateNotificationChannel
- NotificationChannelClient.VerifyNotificationChannel
- QueryClient.QueryTimeSeries
- ServiceMonitoringClient.CreateService
- ServiceMonitoringClient.CreateServiceLevelObjective
- ServiceMonitoringClient.DeleteService
- ServiceMonitoringClient.DeleteServiceLevelObjective
- ServiceMonitoringClient.GetService
- ServiceMonitoringClient.GetServiceLevelObjective
- ServiceMonitoringClient.ListServiceLevelObjectives
- ServiceMonitoringClient.ListServices
- ServiceMonitoringClient.UpdateService
- ServiceMonitoringClient.UpdateServiceLevelObjective
- SnoozeClient.CreateSnooze
- SnoozeClient.GetSnooze
- SnoozeClient.ListSnoozes
- SnoozeClient.UpdateSnooze
- UptimeCheckClient.CreateUptimeCheckConfig
- UptimeCheckClient.DeleteUptimeCheckConfig
- UptimeCheckClient.GetUptimeCheckConfig
- UptimeCheckClient.ListUptimeCheckConfigs
- UptimeCheckClient.ListUptimeCheckIps
- UptimeCheckClient.UpdateUptimeCheckConfig
Functions ¶
func DefaultAuthScopes ¶
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
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.
The AlertPolicyService API is used to manage (list, create, delete, edit) alert policies in Cloud 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 Cloud 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/).
func NewAlertPolicyClient ¶
func NewAlertPolicyClient(ctx context.Context, opts ...option.ClientOption) (*AlertPolicyClient, error)
NewAlertPolicyClient creates a new alert policy service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
The AlertPolicyService API is used to manage (list, create, delete,
edit) alert policies in Cloud 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
Cloud 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/).
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
)
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 := monitoring.NewAlertPolicyClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
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: Connections are now pooled so this method does not always return the same resource.
func (*AlertPolicyClient) CreateAlertPolicy ¶
func (c *AlertPolicyClient) CreateAlertPolicy(ctx context.Context, req *monitoringpb.CreateAlertPolicyRequest, opts ...gax.CallOption) (*monitoringpb.AlertPolicy, error)
CreateAlertPolicy creates a new alerting policy.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewAlertPolicyClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.CreateAlertPolicyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#CreateAlertPolicyRequest.
}
resp, err := c.CreateAlertPolicy(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*AlertPolicyClient) DeleteAlertPolicy ¶
func (c *AlertPolicyClient) DeleteAlertPolicy(ctx context.Context, req *monitoringpb.DeleteAlertPolicyRequest, opts ...gax.CallOption) error
DeleteAlertPolicy deletes an alerting policy.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewAlertPolicyClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.DeleteAlertPolicyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#DeleteAlertPolicyRequest.
}
err = c.DeleteAlertPolicy(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*AlertPolicyClient) GetAlertPolicy ¶
func (c *AlertPolicyClient) GetAlertPolicy(ctx context.Context, req *monitoringpb.GetAlertPolicyRequest, opts ...gax.CallOption) (*monitoringpb.AlertPolicy, error)
GetAlertPolicy gets a single alerting policy.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewAlertPolicyClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.GetAlertPolicyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#GetAlertPolicyRequest.
}
resp, err := c.GetAlertPolicy(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*AlertPolicyClient) ListAlertPolicies ¶
func (c *AlertPolicyClient) ListAlertPolicies(ctx context.Context, req *monitoringpb.ListAlertPoliciesRequest, opts ...gax.CallOption) *AlertPolicyIterator
ListAlertPolicies lists the existing alerting policies for the workspace.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
"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 := monitoring.NewAlertPolicyClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.ListAlertPoliciesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#ListAlertPoliciesRequest.
}
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
}
}
func (*AlertPolicyClient) UpdateAlertPolicy ¶
func (c *AlertPolicyClient) UpdateAlertPolicy(ctx context.Context, req *monitoringpb.UpdateAlertPolicyRequest, opts ...gax.CallOption) (*monitoringpb.AlertPolicy, error)
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.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewAlertPolicyClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.UpdateAlertPolicyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#UpdateAlertPolicyRequest.
}
resp, err := c.UpdateAlertPolicy(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
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 ¶
func (it *AlertPolicyIterator) Next() (*monitoringpb.AlertPolicy, 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 (*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.
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.
func NewGroupClient ¶
func NewGroupClient(ctx context.Context, opts ...option.ClientOption) (*GroupClient, error)
NewGroupClient creates a new group service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
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.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
)
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 := monitoring.NewGroupClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
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: Connections are now pooled so this method does not always return the same resource.
func (*GroupClient) CreateGroup ¶
func (c *GroupClient) CreateGroup(ctx context.Context, req *monitoringpb.CreateGroupRequest, opts ...gax.CallOption) (*monitoringpb.Group, error)
CreateGroup creates a new group.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewGroupClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.CreateGroupRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#CreateGroupRequest.
}
resp, err := c.CreateGroup(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*GroupClient) DeleteGroup ¶
func (c *GroupClient) DeleteGroup(ctx context.Context, req *monitoringpb.DeleteGroupRequest, opts ...gax.CallOption) error
DeleteGroup deletes an existing group.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewGroupClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.DeleteGroupRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#DeleteGroupRequest.
}
err = c.DeleteGroup(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*GroupClient) GetGroup ¶
func (c *GroupClient) GetGroup(ctx context.Context, req *monitoringpb.GetGroupRequest, opts ...gax.CallOption) (*monitoringpb.Group, error)
GetGroup gets a single group.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewGroupClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.GetGroupRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#GetGroupRequest.
}
resp, err := c.GetGroup(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*GroupClient) ListGroupMembers ¶
func (c *GroupClient) ListGroupMembers(ctx context.Context, req *monitoringpb.ListGroupMembersRequest, opts ...gax.CallOption) *MonitoredResourceIterator
ListGroupMembers lists the monitored resources that are members of a group.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
"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 := monitoring.NewGroupClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.ListGroupMembersRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#ListGroupMembersRequest.
}
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
}
}
func (*GroupClient) ListGroups ¶
func (c *GroupClient) ListGroups(ctx context.Context, req *monitoringpb.ListGroupsRequest, opts ...gax.CallOption) *GroupIterator
ListGroups lists the existing groups.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
"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 := monitoring.NewGroupClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.ListGroupsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#ListGroupsRequest.
}
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
}
}
func (*GroupClient) UpdateGroup ¶
func (c *GroupClient) UpdateGroup(ctx context.Context, req *monitoringpb.UpdateGroupRequest, opts ...gax.CallOption) (*monitoringpb.Group, error)
UpdateGroup updates an existing group.
You can change any group attributes except name.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewGroupClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.UpdateGroupRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#UpdateGroupRequest.
}
resp, err := c.UpdateGroup(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
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
CreateServiceTimeSeries []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.
Manages metric descriptors, monitored resource descriptors, and time series data.
func NewMetricClient ¶
func NewMetricClient(ctx context.Context, opts ...option.ClientOption) (*MetricClient, error)
NewMetricClient creates a new metric service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Manages metric descriptors, monitored resource descriptors, and
time series data.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
)
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 := monitoring.NewMetricClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
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: Connections are now pooled so this method does not always return the same resource.
func (*MetricClient) CreateMetricDescriptor ¶
func (c *MetricClient) CreateMetricDescriptor(ctx context.Context, req *monitoringpb.CreateMetricDescriptorRequest, opts ...gax.CallOption) (*metricpb.MetricDescriptor, error)
CreateMetricDescriptor creates a new metric descriptor.
The creation is executed asynchronously and callers may check the returned
operation to track its progress.
User-created metric descriptors define
custom metrics (at https://cloud.google.com/monitoring/custom-metrics).
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewMetricClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.CreateMetricDescriptorRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#CreateMetricDescriptorRequest.
}
resp, err := c.CreateMetricDescriptor(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*MetricClient) CreateServiceTimeSeries ¶
func (c *MetricClient) CreateServiceTimeSeries(ctx context.Context, req *monitoringpb.CreateTimeSeriesRequest, opts ...gax.CallOption) error
CreateServiceTimeSeries creates or adds data to one or more service time series. A service time
series is a time series for a metric from a Google Cloud service. 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. This endpoint rejects writes to
user-defined metrics.
This method is only for use by Google Cloud services. Use
projects.timeSeries.create
instead.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewMetricClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.CreateTimeSeriesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#CreateTimeSeriesRequest.
}
err = c.CreateServiceTimeSeries(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
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.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewMetricClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.CreateTimeSeriesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#CreateTimeSeriesRequest.
}
err = c.CreateTimeSeries(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
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.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewMetricClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.DeleteMetricDescriptorRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#DeleteMetricDescriptorRequest.
}
err = c.DeleteMetricDescriptor(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*MetricClient) GetMetricDescriptor ¶
func (c *MetricClient) GetMetricDescriptor(ctx context.Context, req *monitoringpb.GetMetricDescriptorRequest, opts ...gax.CallOption) (*metricpb.MetricDescriptor, error)
GetMetricDescriptor gets a single metric descriptor. This method does not require a Workspace.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewMetricClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.GetMetricDescriptorRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#GetMetricDescriptorRequest.
}
resp, err := c.GetMetricDescriptor(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*MetricClient) GetMonitoredResourceDescriptor ¶
func (c *MetricClient) GetMonitoredResourceDescriptor(ctx context.Context, req *monitoringpb.GetMonitoredResourceDescriptorRequest, opts ...gax.CallOption) (*monitoredrespb.MonitoredResourceDescriptor, error)
GetMonitoredResourceDescriptor gets a single monitored resource descriptor. This method does not require a Workspace.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewMetricClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.GetMonitoredResourceDescriptorRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#GetMonitoredResourceDescriptorRequest.
}
resp, err := c.GetMonitoredResourceDescriptor(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*MetricClient) ListMetricDescriptors ¶
func (c *MetricClient) ListMetricDescriptors(ctx context.Context, req *monitoringpb.ListMetricDescriptorsRequest, opts ...gax.CallOption) *MetricDescriptorIterator
ListMetricDescriptors lists metric descriptors that match a filter. This method does not require a Workspace.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
"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 := monitoring.NewMetricClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.ListMetricDescriptorsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#ListMetricDescriptorsRequest.
}
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
}
}
func (*MetricClient) ListMonitoredResourceDescriptors ¶
func (c *MetricClient) ListMonitoredResourceDescriptors(ctx context.Context, req *monitoringpb.ListMonitoredResourceDescriptorsRequest, opts ...gax.CallOption) *MonitoredResourceDescriptorIterator
ListMonitoredResourceDescriptors lists monitored resource descriptors that match a filter. This method does not require a Workspace.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
"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 := monitoring.NewMetricClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.ListMonitoredResourceDescriptorsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#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
}
}
func (*MetricClient) ListTimeSeries ¶
func (c *MetricClient) ListTimeSeries(ctx context.Context, req *monitoringpb.ListTimeSeriesRequest, opts ...gax.CallOption) *TimeSeriesIterator
ListTimeSeries lists time series that match a filter. This method does not require a Workspace.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
"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 := monitoring.NewMetricClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.ListTimeSeriesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#ListTimeSeriesRequest.
}
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
}
}
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 ¶
func (it *MetricDescriptorIterator) Next() (*metricpb.MetricDescriptor, 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 (*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 ¶
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.
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 ¶
func (it *MonitoredResourceIterator) Next() (*monitoredrespb.MonitoredResource, 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 (*MonitoredResourceIterator) PageInfo ¶
func (it *MonitoredResourceIterator) PageInfo() *iterator.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.
The Notification Channel API provides access to configuration that controls how messages related to incidents are sent.
func NewNotificationChannelClient ¶
func NewNotificationChannelClient(ctx context.Context, opts ...option.ClientOption) (*NotificationChannelClient, error)
NewNotificationChannelClient creates a new notification channel service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
The Notification Channel API provides access to configuration that
controls how messages related to incidents are sent.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
)
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 := monitoring.NewNotificationChannelClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
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: Connections are now pooled so this method does not always return the same resource.
func (*NotificationChannelClient) CreateNotificationChannel ¶
func (c *NotificationChannelClient) CreateNotificationChannel(ctx context.Context, req *monitoringpb.CreateNotificationChannelRequest, opts ...gax.CallOption) (*monitoringpb.NotificationChannel, error)
CreateNotificationChannel creates a new notification channel, representing a single notification
endpoint such as an email address, SMS number, or PagerDuty service.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewNotificationChannelClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.CreateNotificationChannelRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#CreateNotificationChannelRequest.
}
resp, err := c.CreateNotificationChannel(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*NotificationChannelClient) DeleteNotificationChannel ¶
func (c *NotificationChannelClient) DeleteNotificationChannel(ctx context.Context, req *monitoringpb.DeleteNotificationChannelRequest, opts ...gax.CallOption) error
DeleteNotificationChannel deletes a notification channel.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewNotificationChannelClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.DeleteNotificationChannelRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#DeleteNotificationChannelRequest.
}
err = c.DeleteNotificationChannel(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*NotificationChannelClient) GetNotificationChannel ¶
func (c *NotificationChannelClient) GetNotificationChannel(ctx context.Context, req *monitoringpb.GetNotificationChannelRequest, opts ...gax.CallOption) (*monitoringpb.NotificationChannel, error)
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.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewNotificationChannelClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.GetNotificationChannelRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#GetNotificationChannelRequest.
}
resp, err := c.GetNotificationChannel(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*NotificationChannelClient) GetNotificationChannelDescriptor ¶
func (c *NotificationChannelClient) GetNotificationChannelDescriptor(ctx context.Context, req *monitoringpb.GetNotificationChannelDescriptorRequest, opts ...gax.CallOption) (*monitoringpb.NotificationChannelDescriptor, error)
GetNotificationChannelDescriptor gets a single channel descriptor. The descriptor indicates which fields
are expected / permitted for a notification channel of the given type.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewNotificationChannelClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.GetNotificationChannelDescriptorRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#GetNotificationChannelDescriptorRequest.
}
resp, err := c.GetNotificationChannelDescriptor(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*NotificationChannelClient) GetNotificationChannelVerificationCode ¶
func (c *NotificationChannelClient) GetNotificationChannelVerificationCode(ctx context.Context, req *monitoringpb.GetNotificationChannelVerificationCodeRequest, opts ...gax.CallOption) (*monitoringpb.GetNotificationChannelVerificationCodeResponse, error)
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.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewNotificationChannelClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.GetNotificationChannelVerificationCodeRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#GetNotificationChannelVerificationCodeRequest.
}
resp, err := c.GetNotificationChannelVerificationCode(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*NotificationChannelClient) ListNotificationChannelDescriptors ¶
func (c *NotificationChannelClient) ListNotificationChannelDescriptors(ctx context.Context, req *monitoringpb.ListNotificationChannelDescriptorsRequest, opts ...gax.CallOption) *NotificationChannelDescriptorIterator
ListNotificationChannelDescriptors lists the descriptors for supported channel types. The use of descriptors
makes it possible for new channel types to be dynamically added.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
"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 := monitoring.NewNotificationChannelClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.ListNotificationChannelDescriptorsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#ListNotificationChannelDescriptorsRequest.
}
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
}
}
func (*NotificationChannelClient) ListNotificationChannels ¶
func (c *NotificationChannelClient) ListNotificationChannels(ctx context.Context, req *monitoringpb.ListNotificationChannelsRequest, opts ...gax.CallOption) *NotificationChannelIterator
ListNotificationChannels lists the notification channels that have been created for the project.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
"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 := monitoring.NewNotificationChannelClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.ListNotificationChannelsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#ListNotificationChannelsRequest.
}
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
}
}
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.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewNotificationChannelClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.SendNotificationChannelVerificationCodeRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#SendNotificationChannelVerificationCodeRequest.
}
err = c.SendNotificationChannelVerificationCode(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*NotificationChannelClient) UpdateNotificationChannel ¶
func (c *NotificationChannelClient) UpdateNotificationChannel(ctx context.Context, req *monitoringpb.UpdateNotificationChannelRequest, opts ...gax.CallOption) (*monitoringpb.NotificationChannel, error)
UpdateNotificationChannel updates a notification channel. Fields not specified in the field mask
remain unchanged.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewNotificationChannelClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.UpdateNotificationChannelRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#UpdateNotificationChannelRequest.
}
resp, err := c.UpdateNotificationChannel(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*NotificationChannelClient) VerifyNotificationChannel ¶
func (c *NotificationChannelClient) VerifyNotificationChannel(ctx context.Context, req *monitoringpb.VerifyNotificationChannelRequest, opts ...gax.CallOption) (*monitoringpb.NotificationChannel, error)
VerifyNotificationChannel verifies a NotificationChannel by proving receipt of the code
delivered to the channel as a result of calling
SendNotificationChannelVerificationCode.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewNotificationChannelClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.VerifyNotificationChannelRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#VerifyNotificationChannelRequest.
}
resp, err := c.VerifyNotificationChannel(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
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 ¶
func (it *NotificationChannelDescriptorIterator) Next() (*monitoringpb.NotificationChannelDescriptor, 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 (*NotificationChannelDescriptorIterator) PageInfo ¶
func (it *NotificationChannelDescriptorIterator) PageInfo() *iterator.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 ¶
func (it *NotificationChannelIterator) Next() (*monitoringpb.NotificationChannel, 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 (*NotificationChannelIterator) PageInfo ¶
func (it *NotificationChannelIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type QueryCallOptions ¶
type QueryCallOptions struct {
QueryTimeSeries []gax.CallOption
}
QueryCallOptions contains the retry settings for each method of QueryClient.
type QueryClient ¶
type QueryClient struct {
// The call options for this service.
CallOptions *QueryCallOptions
// contains filtered or unexported fields
}
QueryClient 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.
The QueryService API is used to manage time series data in Stackdriver Monitoring. Time series data is a collection of data points that describes the time-varying values of a metric.
func NewQueryClient ¶
func NewQueryClient(ctx context.Context, opts ...option.ClientOption) (*QueryClient, error)
NewQueryClient creates a new query service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
The QueryService API is used to manage time series data in Stackdriver
Monitoring. Time series data is a collection of data points that describes
the time-varying values of a metric.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
)
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 := monitoring.NewQueryClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*QueryClient) Close ¶
func (c *QueryClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*QueryClient) Connection ¶
func (c *QueryClient) 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 (*QueryClient) QueryTimeSeries ¶
func (c *QueryClient) QueryTimeSeries(ctx context.Context, req *monitoringpb.QueryTimeSeriesRequest, opts ...gax.CallOption) *TimeSeriesDataIterator
QueryTimeSeries queries time series using Monitoring Query Language. This method does not require a Workspace.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
"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 := monitoring.NewQueryClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.QueryTimeSeriesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#QueryTimeSeriesRequest.
}
it := c.QueryTimeSeries(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
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 ¶
func (it *ServiceLevelObjectiveIterator) Next() (*monitoringpb.ServiceLevelObjective, 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 (*ServiceLevelObjectiveIterator) PageInfo ¶
func (it *ServiceLevelObjectiveIterator) PageInfo() *iterator.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.
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.
func NewServiceMonitoringClient ¶
func NewServiceMonitoringClient(ctx context.Context, opts ...option.ClientOption) (*ServiceMonitoringClient, error)
NewServiceMonitoringClient creates a new service monitoring service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
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.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
)
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 := monitoring.NewServiceMonitoringClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
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: Connections are now pooled so this method does not always return the same resource.
func (*ServiceMonitoringClient) CreateService ¶
func (c *ServiceMonitoringClient) CreateService(ctx context.Context, req *monitoringpb.CreateServiceRequest, opts ...gax.CallOption) (*monitoringpb.Service, error)
CreateService create a Service.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewServiceMonitoringClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.CreateServiceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#CreateServiceRequest.
}
resp, err := c.CreateService(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ServiceMonitoringClient) CreateServiceLevelObjective ¶
func (c *ServiceMonitoringClient) CreateServiceLevelObjective(ctx context.Context, req *monitoringpb.CreateServiceLevelObjectiveRequest, opts ...gax.CallOption) (*monitoringpb.ServiceLevelObjective, error)
CreateServiceLevelObjective create a ServiceLevelObjective for the given Service.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewServiceMonitoringClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.CreateServiceLevelObjectiveRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#CreateServiceLevelObjectiveRequest.
}
resp, err := c.CreateServiceLevelObjective(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ServiceMonitoringClient) DeleteService ¶
func (c *ServiceMonitoringClient) DeleteService(ctx context.Context, req *monitoringpb.DeleteServiceRequest, opts ...gax.CallOption) error
DeleteService soft delete this Service.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewServiceMonitoringClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.DeleteServiceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#DeleteServiceRequest.
}
err = c.DeleteService(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*ServiceMonitoringClient) DeleteServiceLevelObjective ¶
func (c *ServiceMonitoringClient) DeleteServiceLevelObjective(ctx context.Context, req *monitoringpb.DeleteServiceLevelObjectiveRequest, opts ...gax.CallOption) error
DeleteServiceLevelObjective delete the given ServiceLevelObjective.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewServiceMonitoringClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.DeleteServiceLevelObjectiveRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#DeleteServiceLevelObjectiveRequest.
}
err = c.DeleteServiceLevelObjective(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*ServiceMonitoringClient) GetService ¶
func (c *ServiceMonitoringClient) GetService(ctx context.Context, req *monitoringpb.GetServiceRequest, opts ...gax.CallOption) (*monitoringpb.Service, error)
GetService get the named Service.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewServiceMonitoringClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.GetServiceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#GetServiceRequest.
}
resp, err := c.GetService(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ServiceMonitoringClient) GetServiceLevelObjective ¶
func (c *ServiceMonitoringClient) GetServiceLevelObjective(ctx context.Context, req *monitoringpb.GetServiceLevelObjectiveRequest, opts ...gax.CallOption) (*monitoringpb.ServiceLevelObjective, error)
GetServiceLevelObjective get a ServiceLevelObjective by name.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewServiceMonitoringClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.GetServiceLevelObjectiveRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#GetServiceLevelObjectiveRequest.
}
resp, err := c.GetServiceLevelObjective(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ServiceMonitoringClient) ListServiceLevelObjectives ¶
func (c *ServiceMonitoringClient) ListServiceLevelObjectives(ctx context.Context, req *monitoringpb.ListServiceLevelObjectivesRequest, opts ...gax.CallOption) *ServiceLevelObjectiveIterator
ListServiceLevelObjectives list the ServiceLevelObjectives for the given Service.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
"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 := monitoring.NewServiceMonitoringClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.ListServiceLevelObjectivesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#ListServiceLevelObjectivesRequest.
}
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
}
}
func (*ServiceMonitoringClient) ListServices ¶
func (c *ServiceMonitoringClient) ListServices(ctx context.Context, req *monitoringpb.ListServicesRequest, opts ...gax.CallOption) *ServiceIterator
ListServices list Services for this workspace.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
"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 := monitoring.NewServiceMonitoringClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.ListServicesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#ListServicesRequest.
}
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
}
}
func (*ServiceMonitoringClient) UpdateService ¶
func (c *ServiceMonitoringClient) UpdateService(ctx context.Context, req *monitoringpb.UpdateServiceRequest, opts ...gax.CallOption) (*monitoringpb.Service, error)
UpdateService update this Service.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewServiceMonitoringClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.UpdateServiceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#UpdateServiceRequest.
}
resp, err := c.UpdateService(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ServiceMonitoringClient) UpdateServiceLevelObjective ¶
func (c *ServiceMonitoringClient) UpdateServiceLevelObjective(ctx context.Context, req *monitoringpb.UpdateServiceLevelObjectiveRequest, opts ...gax.CallOption) (*monitoringpb.ServiceLevelObjective, error)
UpdateServiceLevelObjective update the given ServiceLevelObjective.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewServiceMonitoringClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.UpdateServiceLevelObjectiveRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#UpdateServiceLevelObjectiveRequest.
}
resp, err := c.UpdateServiceLevelObjective(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
type SnoozeCallOptions ¶
type SnoozeCallOptions struct {
CreateSnooze []gax.CallOption
ListSnoozes []gax.CallOption
GetSnooze []gax.CallOption
UpdateSnooze []gax.CallOption
}
SnoozeCallOptions contains the retry settings for each method of SnoozeClient.
type SnoozeClient ¶
type SnoozeClient struct {
// The call options for this service.
CallOptions *SnoozeCallOptions
// contains filtered or unexported fields
}
SnoozeClient 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.
The SnoozeService API is used to temporarily prevent an alert policy from generating alerts. A Snooze is a description of the criteria under which one or more alert policies should not fire alerts for the specified duration.
func NewSnoozeClient ¶
func NewSnoozeClient(ctx context.Context, opts ...option.ClientOption) (*SnoozeClient, error)
NewSnoozeClient creates a new snooze service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
The SnoozeService API is used to temporarily prevent an alert policy from
generating alerts. A Snooze is a description of the criteria under which one
or more alert policies should not fire alerts for the specified duration.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
)
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 := monitoring.NewSnoozeClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*SnoozeClient) Close ¶
func (c *SnoozeClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*SnoozeClient) Connection ¶
func (c *SnoozeClient) 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 (*SnoozeClient) CreateSnooze ¶
func (c *SnoozeClient) CreateSnooze(ctx context.Context, req *monitoringpb.CreateSnoozeRequest, opts ...gax.CallOption) (*monitoringpb.Snooze, error)
CreateSnooze creates a Snooze that will prevent alerts, which match the provided
criteria, from being opened. The Snooze applies for a specific time
interval.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewSnoozeClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.CreateSnoozeRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#CreateSnoozeRequest.
}
resp, err := c.CreateSnooze(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*SnoozeClient) GetSnooze ¶
func (c *SnoozeClient) GetSnooze(ctx context.Context, req *monitoringpb.GetSnoozeRequest, opts ...gax.CallOption) (*monitoringpb.Snooze, error)
GetSnooze retrieves a Snooze by name.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewSnoozeClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.GetSnoozeRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#GetSnoozeRequest.
}
resp, err := c.GetSnooze(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*SnoozeClient) ListSnoozes ¶
func (c *SnoozeClient) ListSnoozes(ctx context.Context, req *monitoringpb.ListSnoozesRequest, opts ...gax.CallOption) *SnoozeIterator
ListSnoozes lists the Snoozes associated with a project. Can optionally pass in
filter, which specifies predicates to match Snoozes.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
"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 := monitoring.NewSnoozeClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.ListSnoozesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#ListSnoozesRequest.
}
it := c.ListSnoozes(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*SnoozeClient) UpdateSnooze ¶
func (c *SnoozeClient) UpdateSnooze(ctx context.Context, req *monitoringpb.UpdateSnoozeRequest, opts ...gax.CallOption) (*monitoringpb.Snooze, error)
UpdateSnooze updates a Snooze, identified by its name, with the parameters in the
given Snooze object.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewSnoozeClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.UpdateSnoozeRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#UpdateSnoozeRequest.
}
resp, err := c.UpdateSnooze(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
type SnoozeIterator ¶
type SnoozeIterator 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.Snooze, nextPageToken string, err error)
// contains filtered or unexported fields
}
SnoozeIterator manages a stream of *monitoringpb.Snooze.
func (*SnoozeIterator) Next ¶
func (it *SnoozeIterator) Next() (*monitoringpb.Snooze, 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 (*SnoozeIterator) PageInfo ¶
func (it *SnoozeIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type TimeSeriesDataIterator ¶
type TimeSeriesDataIterator 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.TimeSeriesData, nextPageToken string, err error)
// contains filtered or unexported fields
}
TimeSeriesDataIterator manages a stream of *monitoringpb.TimeSeriesData.
func (*TimeSeriesDataIterator) Next ¶
func (it *TimeSeriesDataIterator) Next() (*monitoringpb.TimeSeriesData, 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 (*TimeSeriesDataIterator) PageInfo ¶
func (it *TimeSeriesDataIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
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 ¶
func (it *TimeSeriesIterator) Next() (*monitoringpb.TimeSeries, 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 (*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.
The UptimeCheckService API is used to manage (list, create, delete, edit) Uptime check configurations in the Cloud 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] (https://console.cloud.google.com (at https://console.cloud.google.com)), selecting the appropriate project, clicking on “Monitoring” on the left-hand side to navigate to Cloud Monitoring, and then clicking on “Uptime”.
func NewUptimeCheckClient ¶
func NewUptimeCheckClient(ctx context.Context, opts ...option.ClientOption) (*UptimeCheckClient, error)
NewUptimeCheckClient creates a new uptime check service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
The UptimeCheckService API is used to manage (list, create, delete, edit)
Uptime check configurations in the Cloud 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]
(https://console.cloud.google.com (at https://console.cloud.google.com)), selecting the appropriate project,
clicking on “Monitoring” on the left-hand side to navigate to Cloud
Monitoring, and then clicking on “Uptime”.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
)
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 := monitoring.NewUptimeCheckClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
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: Connections are now pooled so this method does not always return the same resource.
func (*UptimeCheckClient) CreateUptimeCheckConfig ¶
func (c *UptimeCheckClient) CreateUptimeCheckConfig(ctx context.Context, req *monitoringpb.CreateUptimeCheckConfigRequest, opts ...gax.CallOption) (*monitoringpb.UptimeCheckConfig, error)
CreateUptimeCheckConfig creates a new Uptime check configuration.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewUptimeCheckClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.CreateUptimeCheckConfigRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#CreateUptimeCheckConfigRequest.
}
resp, err := c.CreateUptimeCheckConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
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.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewUptimeCheckClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.DeleteUptimeCheckConfigRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#DeleteUptimeCheckConfigRequest.
}
err = c.DeleteUptimeCheckConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*UptimeCheckClient) GetUptimeCheckConfig ¶
func (c *UptimeCheckClient) GetUptimeCheckConfig(ctx context.Context, req *monitoringpb.GetUptimeCheckConfigRequest, opts ...gax.CallOption) (*monitoringpb.UptimeCheckConfig, error)
GetUptimeCheckConfig gets a single Uptime check configuration.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewUptimeCheckClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.GetUptimeCheckConfigRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#GetUptimeCheckConfigRequest.
}
resp, err := c.GetUptimeCheckConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*UptimeCheckClient) ListUptimeCheckConfigs ¶
func (c *UptimeCheckClient) ListUptimeCheckConfigs(ctx context.Context, req *monitoringpb.ListUptimeCheckConfigsRequest, opts ...gax.CallOption) *UptimeCheckConfigIterator
ListUptimeCheckConfigs lists the existing valid Uptime check configurations for the project
(leaving out any invalid configurations).
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
"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 := monitoring.NewUptimeCheckClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.ListUptimeCheckConfigsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#ListUptimeCheckConfigsRequest.
}
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
}
}
func (*UptimeCheckClient) ListUptimeCheckIps ¶
func (c *UptimeCheckClient) ListUptimeCheckIps(ctx context.Context, req *monitoringpb.ListUptimeCheckIpsRequest, opts ...gax.CallOption) *UptimeCheckIpIterator
ListUptimeCheckIps returns the list of IP addresses that checkers run from
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
"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 := monitoring.NewUptimeCheckClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.ListUptimeCheckIpsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#ListUptimeCheckIpsRequest.
}
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
}
}
func (*UptimeCheckClient) UpdateUptimeCheckConfig ¶
func (c *UptimeCheckClient) UpdateUptimeCheckConfig(ctx context.Context, req *monitoringpb.UpdateUptimeCheckConfigRequest, opts ...gax.CallOption) (*monitoringpb.UptimeCheckConfig, error)
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.
Code:play
Example¶
package main
import (
"context"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
)
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 := monitoring.NewUptimeCheckClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &monitoringpb.UpdateUptimeCheckConfigRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#UpdateUptimeCheckConfigRequest.
}
resp, err := c.UpdateUptimeCheckConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
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 ¶
func (it *UptimeCheckConfigIterator) Next() (*monitoringpb.UptimeCheckConfig, 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 (*UptimeCheckConfigIterator) PageInfo ¶
func (it *UptimeCheckConfigIterator) PageInfo() *iterator.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 ¶
func (it *UptimeCheckIpIterator) Next() (*monitoringpb.UptimeCheckIp, 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 (*UptimeCheckIpIterator) PageInfo ¶
func (it *UptimeCheckIpIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
Source Files ¶
alert_policy_client.go doc.go group_client.go metric_client.go notification_channel_client.go query_client.go service_monitoring_client.go snooze_client.go uptime_check_client.go version.go
Directories ¶
| Path | Synopsis |
|---|---|
| apiv3/v2/monitoringpb |
- Version
- v1.14.0
- Published
- May 10, 2023
- Platform
- darwin/amd64
- Imports
- 23 packages
- Last checked
- 19 seconds ago –
Tools for package owners.