forked from sensu/sensu-go
/
config.go
48 lines (38 loc) · 1.06 KB
/
config.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 config
import (
"github.com/sensu/sensu-go/types"
)
const (
// DefaultNamespace represents the default namespace
DefaultNamespace = "default"
// DefaultFormat is the default format output for printers.
DefaultFormat = FormatTabular
// FormatTabular indicates tabular format for printers.
FormatTabular = "tabular"
// FormatJSON indicates JSON format for printers.
FormatJSON = "json"
// FormatWrappedJSON indicates wrapped JSON format for printers.
FormatWrappedJSON = "wrapped-json"
// FormatYAML indicates YAML format for printers. It has the same layout
// as wrapped JSON.
FormatYAML = "yaml"
)
// Config is an abstract configuration
type Config interface {
Read
Write
}
// Read contains all methods related to reading configuration
type Read interface {
APIUrl() string
Format() string
Namespace() string
Tokens() *types.Tokens
}
// Write contains all methods related to setting and writting configuration
type Write interface {
SaveAPIUrl(string) error
SaveFormat(string) error
SaveNamespace(string) error
SaveTokens(*types.Tokens) error
}