Copyright 2020 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Code generated by protoc-gen-go_gapic. DO NOT EDIT.

package monitoring

import (
	
	
	
	
	

	
	gax 
	
	
	gtransport 
	metricpb 
	monitoredrespb 
	monitoringpb 
	
	
	
)

var newMetricClientHook clientHook
MetricCallOptions contains the retry settings for each method of MetricClient.
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
}

func () []option.ClientOption {
	return []option.ClientOption{
		option.WithEndpoint("monitoring.googleapis.com:443"),
		option.WithGRPCDialOption(grpc.WithDisableServiceConfig()),
		option.WithScopes(DefaultAuthScopes()...),
		option.WithGRPCDialOption(grpc.WithDefaultCallOptions(
			grpc.MaxCallRecvMsgSize(math.MaxInt32))),
	}
}

func () *MetricCallOptions {
	return &MetricCallOptions{
		ListMonitoredResourceDescriptors: []gax.CallOption{
			gax.WithRetry(func() gax.Retryer {
				return gax.OnCodes([]codes.Code{
					codes.DeadlineExceeded,
					codes.Unavailable,
				}, gax.Backoff{
					Initial:    100 * time.Millisecond,
					Max:        30000 * time.Millisecond,
					Multiplier: 1.30,
				})
			}),
		},
		GetMonitoredResourceDescriptor: []gax.CallOption{
			gax.WithRetry(func() gax.Retryer {
				return gax.OnCodes([]codes.Code{
					codes.DeadlineExceeded,
					codes.Unavailable,
				}, gax.Backoff{
					Initial:    100 * time.Millisecond,
					Max:        30000 * time.Millisecond,
					Multiplier: 1.30,
				})
			}),
		},
		ListMetricDescriptors: []gax.CallOption{
			gax.WithRetry(func() gax.Retryer {
				return gax.OnCodes([]codes.Code{
					codes.DeadlineExceeded,
					codes.Unavailable,
				}, gax.Backoff{
					Initial:    100 * time.Millisecond,
					Max:        30000 * time.Millisecond,
					Multiplier: 1.30,
				})
			}),
		},
		GetMetricDescriptor: []gax.CallOption{
			gax.WithRetry(func() gax.Retryer {
				return gax.OnCodes([]codes.Code{
					codes.DeadlineExceeded,
					codes.Unavailable,
				}, gax.Backoff{
					Initial:    100 * time.Millisecond,
					Max:        30000 * time.Millisecond,
					Multiplier: 1.30,
				})
			}),
		},
		CreateMetricDescriptor: []gax.CallOption{},
		DeleteMetricDescriptor: []gax.CallOption{
			gax.WithRetry(func() gax.Retryer {
				return gax.OnCodes([]codes.Code{
					codes.DeadlineExceeded,
					codes.Unavailable,
				}, gax.Backoff{
					Initial:    100 * time.Millisecond,
					Max:        30000 * time.Millisecond,
					Multiplier: 1.30,
				})
			}),
		},
		ListTimeSeries: []gax.CallOption{
			gax.WithRetry(func() gax.Retryer {
				return gax.OnCodes([]codes.Code{
					codes.DeadlineExceeded,
					codes.Unavailable,
				}, gax.Backoff{
					Initial:    100 * time.Millisecond,
					Max:        30000 * time.Millisecond,
					Multiplier: 1.30,
				})
			}),
		},
		CreateTimeSeries: []gax.CallOption{},
	}
}
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.
Connection pool of gRPC connections to the service.
The call options for this service.
The x-goog-* metadata to be sent with each request.
NewMetricClient creates a new metric service client. Manages metric descriptors, monitored resource descriptors, and time series data.
func ( context.Context,  ...option.ClientOption) (*MetricClient, error) {
	 := defaultMetricClientOptions()

	if newMetricClientHook != nil {
		,  := newMetricClientHook(, clientHookParams{})
		if  != nil {
			return nil, 
		}
		 = append(, ...)
	}

	,  := gtransport.DialPool(, append(, ...)...)
	if  != nil {
		return nil, 
	}
	 := &MetricClient{
		connPool:    ,
		CallOptions: defaultMetricCallOptions(),

		metricClient: monitoringpb.NewMetricServiceClient(),
	}
	.setGoogleClientInfo()

	return , nil
}
Connection returns a connection to the API service. Deprecated.
func ( *MetricClient) () *grpc.ClientConn {
	return .connPool.Conn()
}
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func ( *MetricClient) () error {
	return .connPool.Close()
}
setGoogleClientInfo sets the name and version of the application in the `x-goog-api-client` header passed on each request. Intended for use by Google-written clients.
func ( *MetricClient) ( ...string) {
	 := append([]string{"gl-go", versionGo()}, ...)
	 = append(, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version)
	.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(...))
}
ListMonitoredResourceDescriptors lists monitored resource descriptors that match a filter. This method does not require a Workspace.
func ( *MetricClient) ( context.Context,  *monitoringpb.ListMonitoredResourceDescriptorsRequest,  ...gax.CallOption) *MonitoredResourceDescriptorIterator {
	 := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(.GetName())))
	 = insertMetadata(, .xGoogMetadata, )
	 = append(.CallOptions.ListMonitoredResourceDescriptors[0:len(.CallOptions.ListMonitoredResourceDescriptors):len(.CallOptions.ListMonitoredResourceDescriptors)], ...)
	 := &MonitoredResourceDescriptorIterator{}
	 = proto.Clone().(*monitoringpb.ListMonitoredResourceDescriptorsRequest)
	.InternalFetch = func( int,  string) ([]*monitoredrespb.MonitoredResourceDescriptor, string, error) {
		var  *monitoringpb.ListMonitoredResourceDescriptorsResponse
		.PageToken = 
		if  > math.MaxInt32 {
			.PageSize = math.MaxInt32
		} else {
			.PageSize = int32()
		}
		 := gax.Invoke(, func( context.Context,  gax.CallSettings) error {
			var  error
			,  = .metricClient.ListMonitoredResourceDescriptors(, , .GRPC...)
			return 
		}, ...)
		if  != nil {
			return nil, "", 
		}

		.Response = 
		return .ResourceDescriptors, .NextPageToken, nil
	}
	 := func( int,  string) (string, error) {
		, ,  := .InternalFetch(, )
		if  != nil {
			return "", 
		}
		.items = append(.items, ...)
		return , nil
	}
	.pageInfo, .nextFunc = iterator.NewPageInfo(, .bufLen, .takeBuf)
	.pageInfo.MaxSize = int(.PageSize)
	.pageInfo.Token = .PageToken
	return 
}
GetMonitoredResourceDescriptor gets a single monitored resource descriptor. This method does not require a Workspace.
ListMetricDescriptors lists metric descriptors that match a filter. This method does not require a Workspace.
func ( *MetricClient) ( context.Context,  *monitoringpb.ListMetricDescriptorsRequest,  ...gax.CallOption) *MetricDescriptorIterator {
	 := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(.GetName())))
	 = insertMetadata(, .xGoogMetadata, )
	 = append(.CallOptions.ListMetricDescriptors[0:len(.CallOptions.ListMetricDescriptors):len(.CallOptions.ListMetricDescriptors)], ...)
	 := &MetricDescriptorIterator{}
	 = proto.Clone().(*monitoringpb.ListMetricDescriptorsRequest)
	.InternalFetch = func( int,  string) ([]*metricpb.MetricDescriptor, string, error) {
		var  *monitoringpb.ListMetricDescriptorsResponse
		.PageToken = 
		if  > math.MaxInt32 {
			.PageSize = math.MaxInt32
		} else {
			.PageSize = int32()
		}
		 := gax.Invoke(, func( context.Context,  gax.CallSettings) error {
			var  error
			,  = .metricClient.ListMetricDescriptors(, , .GRPC...)
			return 
		}, ...)
		if  != nil {
			return nil, "", 
		}

		.Response = 
		return .MetricDescriptors, .NextPageToken, nil
	}
	 := func( int,  string) (string, error) {
		, ,  := .InternalFetch(, )
		if  != nil {
			return "", 
		}
		.items = append(.items, ...)
		return , nil
	}
	.pageInfo, .nextFunc = iterator.NewPageInfo(, .bufLen, .takeBuf)
	.pageInfo.MaxSize = int(.PageSize)
	.pageInfo.Token = .PageToken
	return 
}
GetMetricDescriptor gets a single metric descriptor. This method does not require a Workspace.
func ( *MetricClient) ( context.Context,  *monitoringpb.GetMetricDescriptorRequest,  ...gax.CallOption) (*metricpb.MetricDescriptor, error) {
	 := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(.GetName())))
	 = insertMetadata(, .xGoogMetadata, )
	 = append(.CallOptions.GetMetricDescriptor[0:len(.CallOptions.GetMetricDescriptor):len(.CallOptions.GetMetricDescriptor)], ...)
	var  *metricpb.MetricDescriptor
	 := gax.Invoke(, func( context.Context,  gax.CallSettings) error {
		var  error
		,  = .metricClient.GetMetricDescriptor(, , .GRPC...)
		return 
	}, ...)
	if  != nil {
		return nil, 
	}
	return , nil
}
CreateMetricDescriptor creates a new metric descriptor. User-created metric descriptors define custom metrics (at https://cloud.google.com/monitoring/custom-metrics).
func ( *MetricClient) ( context.Context,  *monitoringpb.CreateMetricDescriptorRequest,  ...gax.CallOption) (*metricpb.MetricDescriptor, error) {
	 := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(.GetName())))
	 = insertMetadata(, .xGoogMetadata, )
	 = append(.CallOptions.CreateMetricDescriptor[0:len(.CallOptions.CreateMetricDescriptor):len(.CallOptions.CreateMetricDescriptor)], ...)
	var  *metricpb.MetricDescriptor
	 := gax.Invoke(, func( context.Context,  gax.CallSettings) error {
		var  error
		,  = .metricClient.CreateMetricDescriptor(, , .GRPC...)
		return 
	}, ...)
	if  != nil {
		return nil, 
	}
	return , nil
}
DeleteMetricDescriptor deletes a metric descriptor. Only user-created custom metrics (at https://cloud.google.com/monitoring/custom-metrics) can be deleted.
func ( *MetricClient) ( context.Context,  *monitoringpb.DeleteMetricDescriptorRequest,  ...gax.CallOption) error {
	 := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(.GetName())))
	 = insertMetadata(, .xGoogMetadata, )
	 = append(.CallOptions.DeleteMetricDescriptor[0:len(.CallOptions.DeleteMetricDescriptor):len(.CallOptions.DeleteMetricDescriptor)], ...)
	 := gax.Invoke(, func( context.Context,  gax.CallSettings) error {
		var  error
		_,  = .metricClient.DeleteMetricDescriptor(, , .GRPC...)
		return 
	}, ...)
	return 
}
ListTimeSeries lists time series that match a filter. This method does not require a Workspace.
func ( *MetricClient) ( context.Context,  *monitoringpb.ListTimeSeriesRequest,  ...gax.CallOption) *TimeSeriesIterator {
	 := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(.GetName())))
	 = insertMetadata(, .xGoogMetadata, )
	 = append(.CallOptions.ListTimeSeries[0:len(.CallOptions.ListTimeSeries):len(.CallOptions.ListTimeSeries)], ...)
	 := &TimeSeriesIterator{}
	 = proto.Clone().(*monitoringpb.ListTimeSeriesRequest)
	.InternalFetch = func( int,  string) ([]*monitoringpb.TimeSeries, string, error) {
		var  *monitoringpb.ListTimeSeriesResponse
		.PageToken = 
		if  > math.MaxInt32 {
			.PageSize = math.MaxInt32
		} else {
			.PageSize = int32()
		}
		 := gax.Invoke(, func( context.Context,  gax.CallSettings) error {
			var  error
			,  = .metricClient.ListTimeSeries(, , .GRPC...)
			return 
		}, ...)
		if  != nil {
			return nil, "", 
		}

		.Response = 
		return .TimeSeries, .NextPageToken, nil
	}
	 := func( int,  string) (string, error) {
		, ,  := .InternalFetch(, )
		if  != nil {
			return "", 
		}
		.items = append(.items, ...)
		return , nil
	}
	.pageInfo, .nextFunc = iterator.NewPageInfo(, .bufLen, .takeBuf)
	.pageInfo.MaxSize = int(.PageSize)
	.pageInfo.Token = .PageToken
	return 
}
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.
func ( *MetricClient) ( context.Context,  *monitoringpb.CreateTimeSeriesRequest,  ...gax.CallOption) error {
	 := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(.GetName())))
	 = insertMetadata(, .xGoogMetadata, )
	 = append(.CallOptions.CreateTimeSeries[0:len(.CallOptions.CreateTimeSeries):len(.CallOptions.CreateTimeSeries)], ...)
	 := gax.Invoke(, func( context.Context,  gax.CallSettings) error {
		var  error
		_,  = .metricClient.CreateTimeSeries(, , .GRPC...)
		return 
	}, ...)
	return 
}
MetricDescriptorIterator manages a stream of *metricpb.MetricDescriptor.
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)
}
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
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) () (*metricpb.MetricDescriptor, error) {
	var  *metricpb.MetricDescriptor
	if  := .nextFunc();  != nil {
		return , 
	}
	 = .items[0]
	.items = .items[1:]
	return , nil
}

func ( *MetricDescriptorIterator) () int {
	return len(.items)
}

func ( *MetricDescriptorIterator) () interface{} {
	 := .items
	.items = nil
	return 
}
MonitoredResourceDescriptorIterator manages a stream of *monitoredrespb.MonitoredResourceDescriptor.
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)
}
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
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) () (*monitoredrespb.MonitoredResourceDescriptor, error) {
	var  *monitoredrespb.MonitoredResourceDescriptor
	if  := .nextFunc();  != nil {
		return , 
	}
	 = .items[0]
	.items = .items[1:]
	return , nil
}

func ( *MonitoredResourceDescriptorIterator) () int {
	return len(.items)
}

func ( *MonitoredResourceDescriptorIterator) () interface{} {
	 := .items
	.items = nil
	return 
}
TimeSeriesIterator manages a stream of *monitoringpb.TimeSeries.
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)
}
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
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) () (*monitoringpb.TimeSeries, error) {
	var  *monitoringpb.TimeSeries
	if  := .nextFunc();  != nil {
		return , 
	}
	 = .items[0]
	.items = .items[1:]
	return , nil
}

func ( *TimeSeriesIterator) () int {
	return len(.items)
}

func ( *TimeSeriesIterator) () interface{} {
	 := .items
	.items = nil
	return