-
Notifications
You must be signed in to change notification settings - Fork 22
/
options.go
executable file
·48 lines (41 loc) · 1.03 KB
/
options.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
42
43
44
45
46
47
48
package sc
import (
"crypto/tls"
"github.com/go-chassis/cari/rbac"
"time"
"context"
)
// Options is the list of dynamic parameter's which can be passed to the Client while creating a new client
type Options struct {
Endpoints []string
EnableSSL bool
Timeout time.Duration
TLSConfig *tls.Config
// Other options can be stored in a context
Context context.Context
Compressed bool
Verbose bool
EnableAuth bool
AuthUser *rbac.AuthUser
TokenExpiration time.Duration
}
//CallOptions is options when you call a API
type CallOptions struct {
WithoutRevision bool
Revision string
WithGlobal bool
}
//WithoutRevision ignore current revision number
func WithoutRevision() CallOption {
return func(o *CallOptions) {
o.WithoutRevision = true
}
}
//WithGlobal query resources include other aggregated SC
func WithGlobal() CallOption {
return func(o *CallOptions) {
o.WithGlobal = true
}
}
//CallOption is receiver for options and chang the attribute of it
type CallOption func(*CallOptions)