Copyright 2019 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 gapic-generator. DO NOT EDIT.

package logging

import (
	
	
	
	
	

	
	gax 
	
	
	
	loggingpb 
	
	
	
)
ConfigCallOptions contains the retry settings for each method of ConfigClient.
type ConfigCallOptions struct {
	ListSinks       []gax.CallOption
	GetSink         []gax.CallOption
	CreateSink      []gax.CallOption
	UpdateSink      []gax.CallOption
	DeleteSink      []gax.CallOption
	ListExclusions  []gax.CallOption
	GetExclusion    []gax.CallOption
	CreateExclusion []gax.CallOption
	UpdateExclusion []gax.CallOption
	DeleteExclusion []gax.CallOption
}

func () []option.ClientOption {
	return []option.ClientOption{
		option.WithEndpoint("logging.googleapis.com:443"),
		option.WithScopes(DefaultAuthScopes()...),
	}
}

func () *ConfigCallOptions {
	 := map[[2]string][]gax.CallOption{
		{"default", "idempotent"}: {
			gax.WithRetry(func() gax.Retryer {
				return gax.OnCodes([]codes.Code{
					codes.DeadlineExceeded,
					codes.Internal,
					codes.Unavailable,
				}, gax.Backoff{
					Initial:    100 * time.Millisecond,
					Max:        60000 * time.Millisecond,
					Multiplier: 1.3,
				})
			}),
		},
	}
	return &ConfigCallOptions{
		ListSinks:       [[2]string{"default", "idempotent"}],
		GetSink:         [[2]string{"default", "idempotent"}],
		CreateSink:      [[2]string{"default", "non_idempotent"}],
		UpdateSink:      [[2]string{"default", "idempotent"}],
		DeleteSink:      [[2]string{"default", "idempotent"}],
		ListExclusions:  [[2]string{"default", "idempotent"}],
		GetExclusion:    [[2]string{"default", "idempotent"}],
		CreateExclusion: [[2]string{"default", "non_idempotent"}],
		UpdateExclusion: [[2]string{"default", "non_idempotent"}],
		DeleteExclusion: [[2]string{"default", "idempotent"}],
	}
}
ConfigClient is a client for interacting with Stackdriver Logging API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The connection to the service.
The call options for this service.
The x-goog-* metadata to be sent with each request.
NewConfigClient creates a new config service v2 client. Service for configuring sinks used to export log entries out of Logging.
Connection returns the client's connection to the API service.
func ( *ConfigClient) () *grpc.ClientConn {
	return .conn
}
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func ( *ConfigClient) () error {
	return .conn.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 ( *ConfigClient) ( ...string) {
	 := append([]string{"gl-go", versionGo()}, ...)
	 = append(, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version)
	.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(...))
}
ListSinks lists sinks.
func ( *ConfigClient) ( context.Context,  *loggingpb.ListSinksRequest,  ...gax.CallOption) *LogSinkIterator {
	 := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(.GetParent())))
	 = insertMetadata(, .xGoogMetadata, )
	 = append(.CallOptions.ListSinks[0:len(.CallOptions.ListSinks):len(.CallOptions.ListSinks)], ...)
	 := &LogSinkIterator{}
	 = proto.Clone().(*loggingpb.ListSinksRequest)
	.InternalFetch = func( int,  string) ([]*loggingpb.LogSink, string, error) {
		var  *loggingpb.ListSinksResponse
		.PageToken = 
		if  > math.MaxInt32 {
			.PageSize = math.MaxInt32
		} else {
			.PageSize = int32()
		}
		 := gax.Invoke(, func( context.Context,  gax.CallSettings) error {
			var  error
			,  = .configClient.ListSinks(, , .GRPC...)
			return 
		}, ...)
		if  != nil {
			return nil, "", 
		}
		return .Sinks, .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 
}
GetSink gets a sink.
func ( *ConfigClient) ( context.Context,  *loggingpb.GetSinkRequest,  ...gax.CallOption) (*loggingpb.LogSink, error) {
	 := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "sink_name", url.QueryEscape(.GetSinkName())))
	 = insertMetadata(, .xGoogMetadata, )
	 = append(.CallOptions.GetSink[0:len(.CallOptions.GetSink):len(.CallOptions.GetSink)], ...)
	var  *loggingpb.LogSink
	 := gax.Invoke(, func( context.Context,  gax.CallSettings) error {
		var  error
		,  = .configClient.GetSink(, , .GRPC...)
		return 
	}, ...)
	if  != nil {
		return nil, 
	}
	return , nil
}
CreateSink creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink.
func ( *ConfigClient) ( context.Context,  *loggingpb.CreateSinkRequest,  ...gax.CallOption) (*loggingpb.LogSink, error) {
	 := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(.GetParent())))
	 = insertMetadata(, .xGoogMetadata, )
	 = append(.CallOptions.CreateSink[0:len(.CallOptions.CreateSink):len(.CallOptions.CreateSink)], ...)
	var  *loggingpb.LogSink
	 := gax.Invoke(, func( context.Context,  gax.CallSettings) error {
		var  error
		,  = .configClient.CreateSink(, , .GRPC...)
		return 
	}, ...)
	if  != nil {
		return nil, 
	}
	return , nil
}
UpdateSink updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter. The updated sink might also have a new writer_identity; see the unique_writer_identity field.
func ( *ConfigClient) ( context.Context,  *loggingpb.UpdateSinkRequest,  ...gax.CallOption) (*loggingpb.LogSink, error) {
	 := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "sink_name", url.QueryEscape(.GetSinkName())))
	 = insertMetadata(, .xGoogMetadata, )
	 = append(.CallOptions.UpdateSink[0:len(.CallOptions.UpdateSink):len(.CallOptions.UpdateSink)], ...)
	var  *loggingpb.LogSink
	 := gax.Invoke(, func( context.Context,  gax.CallSettings) error {
		var  error
		,  = .configClient.UpdateSink(, , .GRPC...)
		return 
	}, ...)
	if  != nil {
		return nil, 
	}
	return , nil
}
DeleteSink deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted.
func ( *ConfigClient) ( context.Context,  *loggingpb.DeleteSinkRequest,  ...gax.CallOption) error {
	 := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "sink_name", url.QueryEscape(.GetSinkName())))
	 = insertMetadata(, .xGoogMetadata, )
	 = append(.CallOptions.DeleteSink[0:len(.CallOptions.DeleteSink):len(.CallOptions.DeleteSink)], ...)
	 := gax.Invoke(, func( context.Context,  gax.CallSettings) error {
		var  error
		_,  = .configClient.DeleteSink(, , .GRPC...)
		return 
	}, ...)
	return 
}
ListExclusions lists all the exclusions in a parent resource.
func ( *ConfigClient) ( context.Context,  *loggingpb.ListExclusionsRequest,  ...gax.CallOption) *LogExclusionIterator {
	 := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(.GetParent())))
	 = insertMetadata(, .xGoogMetadata, )
	 = append(.CallOptions.ListExclusions[0:len(.CallOptions.ListExclusions):len(.CallOptions.ListExclusions)], ...)
	 := &LogExclusionIterator{}
	 = proto.Clone().(*loggingpb.ListExclusionsRequest)
	.InternalFetch = func( int,  string) ([]*loggingpb.LogExclusion, string, error) {
		var  *loggingpb.ListExclusionsResponse
		.PageToken = 
		if  > math.MaxInt32 {
			.PageSize = math.MaxInt32
		} else {
			.PageSize = int32()
		}
		 := gax.Invoke(, func( context.Context,  gax.CallSettings) error {
			var  error
			,  = .configClient.ListExclusions(, , .GRPC...)
			return 
		}, ...)
		if  != nil {
			return nil, "", 
		}
		return .Exclusions, .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 
}
GetExclusion gets the description of an exclusion.
func ( *ConfigClient) ( context.Context,  *loggingpb.GetExclusionRequest,  ...gax.CallOption) (*loggingpb.LogExclusion, error) {
	 := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(.GetName())))
	 = insertMetadata(, .xGoogMetadata, )
	 = append(.CallOptions.GetExclusion[0:len(.CallOptions.GetExclusion):len(.CallOptions.GetExclusion)], ...)
	var  *loggingpb.LogExclusion
	 := gax.Invoke(, func( context.Context,  gax.CallSettings) error {
		var  error
		,  = .configClient.GetExclusion(, , .GRPC...)
		return 
	}, ...)
	if  != nil {
		return nil, 
	}
	return , nil
}
CreateExclusion creates a new exclusion in a specified parent resource. Only log entries belonging to that resource can be excluded. You can have up to 10 exclusions in a resource.
func ( *ConfigClient) ( context.Context,  *loggingpb.CreateExclusionRequest,  ...gax.CallOption) (*loggingpb.LogExclusion, error) {
	 := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(.GetParent())))
	 = insertMetadata(, .xGoogMetadata, )
	 = append(.CallOptions.CreateExclusion[0:len(.CallOptions.CreateExclusion):len(.CallOptions.CreateExclusion)], ...)
	var  *loggingpb.LogExclusion
	 := gax.Invoke(, func( context.Context,  gax.CallSettings) error {
		var  error
		,  = .configClient.CreateExclusion(, , .GRPC...)
		return 
	}, ...)
	if  != nil {
		return nil, 
	}
	return , nil
}
UpdateExclusion changes one or more properties of an existing exclusion.
func ( *ConfigClient) ( context.Context,  *loggingpb.UpdateExclusionRequest,  ...gax.CallOption) (*loggingpb.LogExclusion, error) {
	 := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(.GetName())))
	 = insertMetadata(, .xGoogMetadata, )
	 = append(.CallOptions.UpdateExclusion[0:len(.CallOptions.UpdateExclusion):len(.CallOptions.UpdateExclusion)], ...)
	var  *loggingpb.LogExclusion
	 := gax.Invoke(, func( context.Context,  gax.CallSettings) error {
		var  error
		,  = .configClient.UpdateExclusion(, , .GRPC...)
		return 
	}, ...)
	if  != nil {
		return nil, 
	}
	return , nil
}
DeleteExclusion deletes an exclusion.
func ( *ConfigClient) ( context.Context,  *loggingpb.DeleteExclusionRequest,  ...gax.CallOption) error {
	 := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(.GetName())))
	 = insertMetadata(, .xGoogMetadata, )
	 = append(.CallOptions.DeleteExclusion[0:len(.CallOptions.DeleteExclusion):len(.CallOptions.DeleteExclusion)], ...)
	 := gax.Invoke(, func( context.Context,  gax.CallSettings) error {
		var  error
		_,  = .configClient.DeleteExclusion(, , .GRPC...)
		return 
	}, ...)
	return 
}
LogExclusionIterator manages a stream of *loggingpb.LogExclusion.
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 []*loggingpb.LogExclusion, 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 ( *LogExclusionIterator) () (*loggingpb.LogExclusion, error) {
	var  *loggingpb.LogExclusion
	if  := .nextFunc();  != nil {
		return , 
	}
	 = .items[0]
	.items = .items[1:]
	return , nil
}

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

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

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

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