-
Notifications
You must be signed in to change notification settings - Fork 1
/
args.go
64 lines (49 loc) · 1.32 KB
/
args.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Package plugin includes helpers for the substrate plugin implementation
// to extract configuration arguments.
// WARNING: This is unstable will be removed in later versions.
package plugin
import (
"context"
"net/url"
"github.com/luthersystems/shiroclient-sdk-go/internal/types"
"github.com/sirupsen/logrus"
)
type pluginArgs struct {
ro *types.RequestOptions
}
func PluginArgs(configs []types.Config) pluginArgs {
return pluginArgs{ro: types.ApplyConfigs(context.TODO(), nil, configs...)}
}
func PluginCtx(p pluginArgs) context.Context {
return p.ro.Ctx
}
func PluginID(p pluginArgs) string {
return p.ro.ID
}
func PluginTimestampGenerator(p pluginArgs) func(context.Context) string {
return p.ro.TimestampGenerator
}
func PluginLogFields(p pluginArgs) logrus.Fields {
return p.ro.LogFields
}
func PluginAuthToken(p pluginArgs) string {
return p.ro.AuthToken
}
func PluginCreator(p pluginArgs) string {
return p.ro.Creator
}
func PluginParams(p pluginArgs) interface{} {
return p.ro.Params
}
func PluginTransient(p pluginArgs) map[string][]byte {
return p.ro.Transient
}
func PluginCcFetchURLDowngrade(p pluginArgs) bool {
return p.ro.CcFetchURLDowngrade
}
func PluginCcFetchURLProxy(p pluginArgs) *url.URL {
return p.ro.CcFetchURLProxy
}
func PluginPhylumVersion(p pluginArgs) string {
return p.ro.PhylumVersion
}