-
Notifications
You must be signed in to change notification settings - Fork 1
/
option.go
41 lines (35 loc) · 905 Bytes
/
option.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Package aiven provides a client for interacting with the Aiven API.
package aiven
// Option is a function that configures the client.
type Option func(*aivenClient)
// DebugOpt whether should the client run in debug mode.
// For instance, to output debug information
func DebugOpt(debug bool) Option {
return func(d *aivenClient) {
d.Debug = debug
}
}
// UserAgentOpt sets User-Agent header
func UserAgentOpt(userAgent string) Option {
return func(d *aivenClient) {
d.UserAgent = userAgent
}
}
// TokenOpt runs the client with the given token
func TokenOpt(token string) Option {
return func(d *aivenClient) {
d.Token = token
}
}
// HostOpt API host url
func HostOpt(host string) Option {
return func(d *aivenClient) {
d.Host = host
}
}
// DoerOpt replaces underlying http client in aivenClient
func DoerOpt(doer Doer) Option {
return func(d *aivenClient) {
d.doer = doer
}
}