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 
	monitoringpb 
	
	
	
)

var newServiceMonitoringClientHook clientHook
ServiceMonitoringCallOptions contains the retry settings for each method of ServiceMonitoringClient.
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
}

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 () *ServiceMonitoringCallOptions {
	return &ServiceMonitoringCallOptions{
		CreateService: []gax.CallOption{},
		GetService: []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,
				})
			}),
		},
		ListServices: []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,
				})
			}),
		},
		UpdateService: []gax.CallOption{},
		DeleteService: []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,
				})
			}),
		},
		CreateServiceLevelObjective: []gax.CallOption{},
		GetServiceLevelObjective: []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,
				})
			}),
		},
		ListServiceLevelObjectives: []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,
				})
			}),
		},
		UpdateServiceLevelObjective: []gax.CallOption{},
		DeleteServiceLevelObjective: []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,
				})
			}),
		},
	}
}
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.
Connection pool of gRPC connections to the service.
The call options for this service.
The x-goog-* metadata to be sent with each request.
NewServiceMonitoringClient creates a new service monitoring service client. The Cloud Monitoring Service-Oriented Monitoring API has endpoints for managing and querying aspects of a workspace’s services. These include the Service's monitored resources, its Service-Level Objectives, and a taxonomy of categorized Health Metrics.
func ( context.Context,  ...option.ClientOption) (*ServiceMonitoringClient, error) {
	 := defaultServiceMonitoringClientOptions()

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

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

		serviceMonitoringClient: monitoringpb.NewServiceMonitoringServiceClient(),
	}
	.setGoogleClientInfo()

	return , nil
}
Connection returns a connection to the API service. Deprecated.
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func ( *ServiceMonitoringClient) () 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 ( *ServiceMonitoringClient) ( ...string) {
	 := append([]string{"gl-go", versionGo()}, ...)
	 = append(, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version)
	.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(...))
}
CreateService create a Service.
func ( *ServiceMonitoringClient) ( context.Context,  *monitoringpb.CreateServiceRequest,  ...gax.CallOption) (*monitoringpb.Service, error) {
	 := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(.GetParent())))
	 = insertMetadata(, .xGoogMetadata, )
	 = append(.CallOptions.CreateService[0:len(.CallOptions.CreateService):len(.CallOptions.CreateService)], ...)
	var  *monitoringpb.Service
	 := gax.Invoke(, func( context.Context,  gax.CallSettings) error {
		var  error
		,  = .serviceMonitoringClient.CreateService(, , .GRPC...)
		return 
	}, ...)
	if  != nil {
		return nil, 
	}
	return , nil
}
GetService get the named Service.
func ( *ServiceMonitoringClient) ( context.Context,  *monitoringpb.GetServiceRequest,  ...gax.CallOption) (*monitoringpb.Service, error) {
	 := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(.GetName())))
	 = insertMetadata(, .xGoogMetadata, )
	 = append(.CallOptions.GetService[0:len(.CallOptions.GetService):len(.CallOptions.GetService)], ...)
	var  *monitoringpb.Service
	 := gax.Invoke(, func( context.Context,  gax.CallSettings) error {
		var  error
		,  = .serviceMonitoringClient.GetService(, , .GRPC...)
		return 
	}, ...)
	if  != nil {
		return nil, 
	}
	return , nil
}
ListServices list Services for this workspace.
func ( *ServiceMonitoringClient) ( context.Context,  *monitoringpb.ListServicesRequest,  ...gax.CallOption) *ServiceIterator {
	 := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(.GetParent())))
	 = insertMetadata(, .xGoogMetadata, )
	 = append(.CallOptions.ListServices[0:len(.CallOptions.ListServices):len(.CallOptions.ListServices)], ...)
	 := &ServiceIterator{}
	 = proto.Clone().(*monitoringpb.ListServicesRequest)
	.InternalFetch = func( int,  string) ([]*monitoringpb.Service, string, error) {
		var  *monitoringpb.ListServicesResponse
		.PageToken = 
		if  > math.MaxInt32 {
			.PageSize = math.MaxInt32
		} else {
			.PageSize = int32()
		}
		 := gax.Invoke(, func( context.Context,  gax.CallSettings) error {
			var  error
			,  = .serviceMonitoringClient.ListServices(, , .GRPC...)
			return 
		}, ...)
		if  != nil {
			return nil, "", 
		}

		.Response = 
		return .Services, .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 
}
UpdateService update this Service.
func ( *ServiceMonitoringClient) ( context.Context,  *monitoringpb.UpdateServiceRequest,  ...gax.CallOption) (*monitoringpb.Service, error) {
	 := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "service.name", url.QueryEscape(.GetService().GetName())))
	 = insertMetadata(, .xGoogMetadata, )
	 = append(.CallOptions.UpdateService[0:len(.CallOptions.UpdateService):len(.CallOptions.UpdateService)], ...)
	var  *monitoringpb.Service
	 := gax.Invoke(, func( context.Context,  gax.CallSettings) error {
		var  error
		,  = .serviceMonitoringClient.UpdateService(, , .GRPC...)
		return 
	}, ...)
	if  != nil {
		return nil, 
	}
	return , nil
}
DeleteService soft delete this Service.
func ( *ServiceMonitoringClient) ( context.Context,  *monitoringpb.DeleteServiceRequest,  ...gax.CallOption) error {
	 := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(.GetName())))
	 = insertMetadata(, .xGoogMetadata, )
	 = append(.CallOptions.DeleteService[0:len(.CallOptions.DeleteService):len(.CallOptions.DeleteService)], ...)
	 := gax.Invoke(, func( context.Context,  gax.CallSettings) error {
		var  error
		_,  = .serviceMonitoringClient.DeleteService(, , .GRPC...)
		return 
	}, ...)
	return 
}
CreateServiceLevelObjective create a ServiceLevelObjective for the given Service.
func ( *ServiceMonitoringClient) ( context.Context,  *monitoringpb.CreateServiceLevelObjectiveRequest,  ...gax.CallOption) (*monitoringpb.ServiceLevelObjective, error) {
	 := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(.GetParent())))
	 = insertMetadata(, .xGoogMetadata, )
	 = append(.CallOptions.CreateServiceLevelObjective[0:len(.CallOptions.CreateServiceLevelObjective):len(.CallOptions.CreateServiceLevelObjective)], ...)
	var  *monitoringpb.ServiceLevelObjective
	 := gax.Invoke(, func( context.Context,  gax.CallSettings) error {
		var  error
		,  = .serviceMonitoringClient.CreateServiceLevelObjective(, , .GRPC...)
		return 
	}, ...)
	if  != nil {
		return nil, 
	}
	return , nil
}
GetServiceLevelObjective get a ServiceLevelObjective by name.
func ( *ServiceMonitoringClient) ( context.Context,  *monitoringpb.GetServiceLevelObjectiveRequest,  ...gax.CallOption) (*monitoringpb.ServiceLevelObjective, error) {
	 := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(.GetName())))
	 = insertMetadata(, .xGoogMetadata, )
	 = append(.CallOptions.GetServiceLevelObjective[0:len(.CallOptions.GetServiceLevelObjective):len(.CallOptions.GetServiceLevelObjective)], ...)
	var  *monitoringpb.ServiceLevelObjective
	 := gax.Invoke(, func( context.Context,  gax.CallSettings) error {
		var  error
		,  = .serviceMonitoringClient.GetServiceLevelObjective(, , .GRPC...)
		return 
	}, ...)
	if  != nil {
		return nil, 
	}
	return , nil
}
ListServiceLevelObjectives list the ServiceLevelObjectives for the given Service.
func ( *ServiceMonitoringClient) ( context.Context,  *monitoringpb.ListServiceLevelObjectivesRequest,  ...gax.CallOption) *ServiceLevelObjectiveIterator {
	 := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(.GetParent())))
	 = insertMetadata(, .xGoogMetadata, )
	 = append(.CallOptions.ListServiceLevelObjectives[0:len(.CallOptions.ListServiceLevelObjectives):len(.CallOptions.ListServiceLevelObjectives)], ...)
	 := &ServiceLevelObjectiveIterator{}
	 = proto.Clone().(*monitoringpb.ListServiceLevelObjectivesRequest)
	.InternalFetch = func( int,  string) ([]*monitoringpb.ServiceLevelObjective, string, error) {
		var  *monitoringpb.ListServiceLevelObjectivesResponse
		.PageToken = 
		if  > math.MaxInt32 {
			.PageSize = math.MaxInt32
		} else {
			.PageSize = int32()
		}
		 := gax.Invoke(, func( context.Context,  gax.CallSettings) error {
			var  error
			,  = .serviceMonitoringClient.ListServiceLevelObjectives(, , .GRPC...)
			return 
		}, ...)
		if  != nil {
			return nil, "", 
		}

		.Response = 
		return .ServiceLevelObjectives, .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 
}
UpdateServiceLevelObjective update the given ServiceLevelObjective.
func ( *ServiceMonitoringClient) ( context.Context,  *monitoringpb.UpdateServiceLevelObjectiveRequest,  ...gax.CallOption) (*monitoringpb.ServiceLevelObjective, error) {
	 := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "service_level_objective.name", url.QueryEscape(.GetServiceLevelObjective().GetName())))
	 = insertMetadata(, .xGoogMetadata, )
	 = append(.CallOptions.UpdateServiceLevelObjective[0:len(.CallOptions.UpdateServiceLevelObjective):len(.CallOptions.UpdateServiceLevelObjective)], ...)
	var  *monitoringpb.ServiceLevelObjective
	 := gax.Invoke(, func( context.Context,  gax.CallSettings) error {
		var  error
		,  = .serviceMonitoringClient.UpdateServiceLevelObjective(, , .GRPC...)
		return 
	}, ...)
	if  != nil {
		return nil, 
	}
	return , nil
}
DeleteServiceLevelObjective delete the given ServiceLevelObjective.
func ( *ServiceMonitoringClient) ( context.Context,  *monitoringpb.DeleteServiceLevelObjectiveRequest,  ...gax.CallOption) error {
	 := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(.GetName())))
	 = insertMetadata(, .xGoogMetadata, )
	 = append(.CallOptions.DeleteServiceLevelObjective[0:len(.CallOptions.DeleteServiceLevelObjective):len(.CallOptions.DeleteServiceLevelObjective)], ...)
	 := gax.Invoke(, func( context.Context,  gax.CallSettings) error {
		var  error
		_,  = .serviceMonitoringClient.DeleteServiceLevelObjective(, , .GRPC...)
		return 
	}, ...)
	return 
}
ServiceIterator manages a stream of *monitoringpb.Service.
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)
}
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
func ( *ServiceIterator) () *iterator.PageInfo {
	return .pageInfo
}
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) () (*monitoringpb.Service, error) {
	var  *monitoringpb.Service
	if  := .nextFunc();  != nil {
		return , 
	}
	 = .items[0]
	.items = .items[1:]
	return , nil
}

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

func ( *ServiceIterator) () interface{} {
	 := .items
	.items = nil
	return 
}
ServiceLevelObjectiveIterator manages a stream of *monitoringpb.ServiceLevelObjective.
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)
}
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 ( *ServiceLevelObjectiveIterator) () (*monitoringpb.ServiceLevelObjective, error) {
	var  *monitoringpb.ServiceLevelObjective
	if  := .nextFunc();  != nil {
		return , 
	}
	 = .items[0]
	.items = .items[1:]
	return , nil
}

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

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