-
Notifications
You must be signed in to change notification settings - Fork 19
/
configuration.go
36 lines (31 loc) · 1.63 KB
/
configuration.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
package v1
import (
"strings"
"time"
)
const PrefixConfigObject = "_object_"
// Configuration config info
type Configuration struct {
Name string `json:"name,omitempty" yaml:"name,omitempty" validate:"resourceName"`
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
Data map[string]string `json:"data,omitempty" yaml:"data,omitempty" default:"{}" binding:"required"`
CreationTimestamp time.Time `json:"createTime,omitempty" yaml:"createTime,omitempty"`
UpdateTimestamp time.Time `json:"updateTime,omitempty" yaml:"updateTime,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Version string `json:"version,omitempty" yaml:"version,omitempty"`
System bool `json:"system,omitempty" yaml:"system,omitempty"`
}
// ConfigurationObject extended feature for object configuration
type ConfigurationObject struct {
// hex format
MD5 string `json:"md5,omitempty" yaml:"md5,omitempty"`
Sha256 string `json:"sha256,omitempty" yaml:"sha256,omitempty"`
URL string `json:"url,omitempty" yaml:"url,omitempty"`
Token string `json:"token,omitempty" yaml:"token,omitempty"`
Unpack string `json:"unpack,omitempty" yaml:"unpack,omitempty"`
Metadata map[string]string `json:"metadata,omitempty" yaml:"metadata,omitempty"`
}
func IsConfigObject(key string) bool {
return strings.HasPrefix(key, PrefixConfigObject)
}