2020-02-26 19:46:17 +01:00
|
|
|
// Copyright 2020 Google LLC.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
// Package internaloption contains options used internally by Google client code.
|
|
|
|
package internaloption
|
|
|
|
|
|
|
|
import (
|
|
|
|
"google.golang.org/api/internal"
|
|
|
|
"google.golang.org/api/option"
|
|
|
|
)
|
|
|
|
|
|
|
|
type defaultEndpointOption string
|
|
|
|
|
|
|
|
func (o defaultEndpointOption) Apply(settings *internal.DialSettings) {
|
|
|
|
settings.DefaultEndpoint = string(o)
|
|
|
|
}
|
|
|
|
|
|
|
|
// WithDefaultEndpoint is an option that indicates the default endpoint.
|
|
|
|
//
|
|
|
|
// It should only be used internally by generated clients.
|
|
|
|
//
|
2020-09-01 16:43:21 +02:00
|
|
|
// This is similar to WithEndpoint, but allows us to determine whether the user has overridden the default endpoint.
|
2020-02-26 19:46:17 +01:00
|
|
|
func WithDefaultEndpoint(url string) option.ClientOption {
|
|
|
|
return defaultEndpointOption(url)
|
|
|
|
}
|
2020-07-14 19:30:52 +02:00
|
|
|
|
|
|
|
type defaultMTLSEndpointOption string
|
|
|
|
|
|
|
|
func (o defaultMTLSEndpointOption) Apply(settings *internal.DialSettings) {
|
|
|
|
settings.DefaultMTLSEndpoint = string(o)
|
|
|
|
}
|
|
|
|
|
|
|
|
// WithDefaultMTLSEndpoint is an option that indicates the default mTLS endpoint.
|
|
|
|
//
|
|
|
|
// It should only be used internally by generated clients.
|
|
|
|
func WithDefaultMTLSEndpoint(url string) option.ClientOption {
|
|
|
|
return defaultMTLSEndpointOption(url)
|
|
|
|
}
|
2020-08-05 10:15:42 +02:00
|
|
|
|
|
|
|
// SkipDialSettingsValidation bypasses validation on ClientOptions.
|
|
|
|
//
|
|
|
|
// It should only be used internally.
|
|
|
|
func SkipDialSettingsValidation() option.ClientOption {
|
|
|
|
return skipDialSettingsValidation{}
|
|
|
|
}
|
|
|
|
|
|
|
|
type skipDialSettingsValidation struct{}
|
|
|
|
|
|
|
|
func (s skipDialSettingsValidation) Apply(settings *internal.DialSettings) {
|
|
|
|
settings.SkipValidation = true
|
|
|
|
}
|