Skip to content

Commit 7c9fb31

Browse files
committed
[Update] add json/yaml/toml tag
1 parent 9ddbd64 commit 7c9fb31

File tree

1 file changed

+31
-37
lines changed

1 file changed

+31
-37
lines changed

plugin.go

Lines changed: 31 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -52,63 +52,57 @@ type PluginSetting struct {
5252
Devices []string `json:"Devices,omitempty" yaml:"Devices,omitempty" toml:"Devices,omitempty"`
5353
}
5454

55-
type PluginInterfaceType struct {
56-
Preifx string
57-
Capability string
58-
Version string
59-
}
60-
6155
type PluginInterface struct {
62-
Types []PluginInterfaceType
63-
Socket string
56+
Types []string `json:"Types,omitempty" yaml:"Types,omitempty" toml:"Types,omitempty"`
57+
Socket string `json:"Socket,omitempty" yaml:"Socket,omitempty" toml:"Socket,omitempty"`
6458
}
6559

6660
type PluginNetwork struct {
67-
Type string
61+
Type string `json:"Type,omitempty" yaml:"Type,omitempty" toml:"Type,omitempty"`
6862
}
6963
type PluginLinux struct {
70-
Capabilities []string
71-
AllowAllDevices bool
72-
Devices []PluginLinuxDevices
64+
Capabilities []string `json:"Capabilities,omitempty" yaml:"Capabilities,omitempty" toml:"Capabilities,omitempty"`
65+
AllowAllDevices bool `json:"AllowAllDevices,omitempty" yaml:"AllowAllDevices,omitempty" toml:"AllowAllDevices,omitempty"`
66+
Devices []PluginLinuxDevices `json:"Devices,omitempty" yaml:"Devices,omitempty" toml:"Devices,omitempty"`
7367
}
7468

7569
type PluginLinuxDevices struct {
76-
Name string
77-
Description string
78-
Settable []string
79-
Path string
70+
Name string `json:"Name,omitempty" yaml:"Name,omitempty" toml:"Name,omitempty"`
71+
Description string `json:"Documentation,omitempty" yaml:"Documentation,omitempty" toml:"Documentation,omitempty"`
72+
Settable []string `json:"Settable,omitempty" yaml:"Settable,omitempty" toml:"Settable,omitempty"`
73+
Path string `json:"Path,omitempty" yaml:"Path,omitempty" toml:"Path,omitempty"`
8074
}
8175
type PluginEnv struct {
82-
Name string
83-
Description string
84-
Settable []string
85-
Value string
76+
Name string `json:"Name,omitempty" yaml:"Name,omitempty" toml:"Name,omitempty"`
77+
Description string `json:"Documentation,omitempty" yaml:"Documentation,omitempty" toml:"Documentation,omitempty"`
78+
Settable []string `json:"Settable,omitempty" yaml:"Settable,omitempty" toml:"Settable,omitempty"`
79+
Value string `json:"Value,omitempty" yaml:"Value,omitempty" toml:"Value,omitempty"`
8680
}
8781
type PluginArgs struct {
88-
Name string
89-
Description string
90-
Settable []string
91-
Value []string
82+
Name string `json:"Name,omitempty" yaml:"Name,omitempty" toml:"Name,omitempty"`
83+
Description string `json:"Documentation,omitempty" yaml:"Documentation,omitempty" toml:"Documentation,omitempty"`
84+
Settable []string `json:"Settable,omitempty" yaml:"Settable,omitempty" toml:"Settable,omitempty"`
85+
Value []string `json:"Value,omitempty" yaml:"Value,omitempty" toml:"Value,omitempty"`
9286
}
9387

9488
type PluginUser struct {
95-
UID int32
96-
GID int32
89+
UID int32 `json:"UID,omitempty" yaml:"UID,omitempty" toml:"UID,omitempty"`
90+
GID int32 `json:"GID,omitempty" yaml:"GID,omitempty" toml:"GID,omitempty"`
9791
}
9892

9993
type PluginConfig struct {
10094
Description string `json:"Description,omitempty" yaml:"Description,omitempty" toml:"Description,omitempty"`
101-
Documentation string `json:"Documentation,omitempty" yaml:"Documentation,omitempty" toml:"Documentation,omitempty"`
102-
Interface PluginInterface
103-
Entrypoint []string
104-
WorkDir string
105-
User PluginUser
106-
Network PluginNetwork
107-
Linux PluginLinux
108-
PropagatedMount string
109-
Mounts []Mount
110-
Env []PluginEnv
111-
Args PluginArgs
95+
Documentation string
96+
Interface PluginInterface `json:"Interface,omitempty" yaml:"Interface,omitempty" toml:"Interface,omitempty"`
97+
Entrypoint []string `json:"Entrypoint,omitempty" yaml:"Entrypoint,omitempty" toml:"Entrypoint,omitempty"`
98+
WorkDir string `json:"WorkDir,omitempty" yaml:"WorkDir,omitempty" toml:"WorkDir,omitempty"`
99+
User PluginUser `json:"User,omitempty" yaml:"User,omitempty" toml:"User,omitempty"`
100+
Network PluginNetwork `json:"Network,omitempty" yaml:"Network,omitempty" toml:"Network,omitempty"`
101+
Linux PluginLinux `json:"Linux,omitempty" yaml:"Linux,omitempty" toml:"Linux,omitempty"`
102+
PropagatedMount string `json:"Interface,omitempty" yaml:"Interface,omitempty" toml:"Interface,omitempty"`
103+
Mounts []Mount `json:"Mounts,omitempty" yaml:"Mounts,omitempty" toml:"Mounts,omitempty"`
104+
Env []PluginEnv `json:"Env,omitempty" yaml:"Env,omitempty" toml:"Env,omitempty"`
105+
Args PluginArgs `json:"Args,omitempty" yaml:"Args,omitempty" toml:"Args,omitempty"`
112106
}
113107

114108
type PluginDetail struct {

0 commit comments

Comments
 (0)