Documentation ¶
Index ¶
- Constants
- Variables
- func Register(am AuthMechanism, df DoerFactory)
- func RegistryReset()
- func TLSConfig(enabled bool, caPool *x509.CertPool) (opt urls.Option, config *tls.Config)
- func Validate(am AuthMechanism, cm ConfigMap) (err error)
- type AuthMechanism
- type ConfigMap
- type ConfigMapOption
- type ConfigMapOptions
- type Doer
- type DoerFactory
- type DoerFunc
- type Option
Constants ¶
const ( AuthNone AuthMechanism = "" // AuthNone specifies no authentication mechanism AuthBasic = "basic" // AuthBasic specifies to use HTTP Basic AuthIAM = "iam" // AuthIAM specifies to use IAM / JDK authentication )
AuthNone, et al. represent the complete set of supported authentication mechanisms
Variables ¶
var ( ErrDuplicateAuthRegistration = errors.New("duplicate auth mechanism registration") ErrUnregisteredFactory = errors.New("unregistered factory requested") ErrIllegalDoerFactoryImplementation = errors.New("illegal DoerFactory implementation returned non-nil Doer for a nil *http.Client") ErrMissingConfiguration = errors.New("missing configuration for specified authentication mechanism") )
ErrDuplicateAuthRegistration signifies a configuration error in which the same AuthMechanism is being registered multiple times.
var ErrAuthFailed = errors.New("IAM authentication failed")
ErrAuthFailed is returned for any type of IAM authentication failure
Functions ¶
func Register ¶
func Register(am AuthMechanism, df DoerFactory)
Register associates an AuthMechanism with a DoerFactory
func RegistryReset ¶
func RegistryReset()
RegistryReset unregisters all previously user-registered factory instances and resets to the default state. Intended for testing purposes.
func TLSConfig ¶
TLSConfig generates and returns a recommended URL generation option and TLS configuration.
func Validate ¶
func Validate(am AuthMechanism, cm ConfigMap) (err error)
Validate checks that the given AuthMechainsm and ConfigMap are compatible with the registered set of DoerFactory instances.
Types ¶
type AuthMechanism ¶
type AuthMechanism string
AuthMechanism enumerates the supported authentication strategies
type ConfigMap ¶
type ConfigMap map[AuthMechanism]interface{}
ConfigMap maps authentication configuration types to values
func (ConfigMap) FindOrPanic ¶
func (cm ConfigMap) FindOrPanic(am AuthMechanism) interface{}
FindOrPanic returns the mapped configuration for the given auth mechanism or else panics
type ConfigMapOption ¶
type ConfigMapOption func(ConfigMap)
ConfigMapOption is a functional option for a ConfigMap
type ConfigMapOptions ¶
type ConfigMapOptions []ConfigMapOption
ConfigMapOptions aggregates ConfigMapOption
func (ConfigMapOptions) ToConfigMap ¶
func (cmo ConfigMapOptions) ToConfigMap() (m ConfigMap)
ToConfigMap generates a ConfigMap from the given options. If no map entries are generated then a nil ConfigMap is returned.
type Doer ¶
Doer executes an http.Request and returns the generated http.Response; similar to http.RoundTripper but may modify an in-flight http.Request object.
type DoerFactory ¶
DoerFactory generates a Doer. If the given Client is nil then the returned Doer must also be nil. Specifying a nil Client is useful for asking the factory to ONLY validate the provided ConfigMap.