|
@@ -1,168 +1,163 @@
|
|
|
package types
|
|
|
|
|
|
-import (
|
|
|
- "encoding/json"
|
|
|
- "fmt"
|
|
|
-)
|
|
|
-
|
|
|
-// PluginInstallOptions holds parameters to install a plugin.
|
|
|
-type PluginInstallOptions struct {
|
|
|
- Disabled bool
|
|
|
- AcceptAllPermissions bool
|
|
|
- RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry
|
|
|
- PrivilegeFunc RequestPrivilegeFunc
|
|
|
- AcceptPermissionsFunc func(PluginPrivileges) (bool, error)
|
|
|
+// This file was generated by the swagger tool.
|
|
|
+// Editing this file might prove futile when you re-run the swagger generate command
|
|
|
+
|
|
|
+// Plugin A plugin for the Remote API
|
|
|
+// swagger:model Plugin
|
|
|
+type Plugin struct {
|
|
|
+
|
|
|
+ // config
|
|
|
+ // Required: true
|
|
|
+ Config PluginConfig `json:"Config"`
|
|
|
+
|
|
|
+ // True when the plugin is running. False when the plugin is not running, only installed.
|
|
|
+ // Required: true
|
|
|
+ Enabled bool `json:"Enabled"`
|
|
|
+
|
|
|
+ // Id
|
|
|
+ ID string `json:"Id,omitempty"`
|
|
|
+
|
|
|
+ // manifest
|
|
|
+ // Required: true
|
|
|
+ Manifest PluginManifest `json:"Manifest"`
|
|
|
+
|
|
|
+ // name
|
|
|
+ // Required: true
|
|
|
+ Name string `json:"Name"`
|
|
|
+
|
|
|
+ // tag
|
|
|
+ // Required: true
|
|
|
+ Tag string `json:"Tag"`
|
|
|
}
|
|
|
|
|
|
-// PluginConfig represents the values of settings potentially modifiable by a user
|
|
|
+// PluginConfigSettings that can be modified by users.
|
|
|
+// swagger:model PluginConfig
|
|
|
type PluginConfig struct {
|
|
|
- Mounts []PluginMount
|
|
|
- Env []string
|
|
|
- Args []string
|
|
|
- Devices []PluginDevice
|
|
|
-}
|
|
|
|
|
|
-// Plugin represents a Docker plugin for the remote API
|
|
|
-type Plugin struct {
|
|
|
- ID string `json:"Id,omitempty"`
|
|
|
- Name string
|
|
|
- Tag string
|
|
|
- // Enabled is true when the plugin is running, is false when the plugin is not running, only installed.
|
|
|
- Enabled bool
|
|
|
- Config PluginConfig
|
|
|
- Manifest PluginManifest
|
|
|
-}
|
|
|
+ // args
|
|
|
+ // Required: true
|
|
|
+ Args []string `json:"Args"`
|
|
|
|
|
|
-// PluginsListResponse contains the response for the remote API
|
|
|
-type PluginsListResponse []*Plugin
|
|
|
-
|
|
|
-const (
|
|
|
- authzDriver = "AuthzDriver"
|
|
|
- graphDriver = "GraphDriver"
|
|
|
- ipamDriver = "IpamDriver"
|
|
|
- networkDriver = "NetworkDriver"
|
|
|
- volumeDriver = "VolumeDriver"
|
|
|
-)
|
|
|
-
|
|
|
-// PluginInterfaceType represents a type that a plugin implements.
|
|
|
-type PluginInterfaceType struct {
|
|
|
- Prefix string // This is always "docker"
|
|
|
- Capability string // Capability should be validated against the above list.
|
|
|
- Version string // Plugin API version. Depends on the capability
|
|
|
-}
|
|
|
+ // devices
|
|
|
+ // Required: true
|
|
|
+ Devices []PluginDevice `json:"Devices"`
|
|
|
|
|
|
-// UnmarshalJSON implements json.Unmarshaler for PluginInterfaceType
|
|
|
-func (t *PluginInterfaceType) UnmarshalJSON(p []byte) error {
|
|
|
- versionIndex := len(p)
|
|
|
- prefixIndex := 0
|
|
|
- if len(p) < 2 || p[0] != '"' || p[len(p)-1] != '"' {
|
|
|
- return fmt.Errorf("%q is not a plugin interface type", p)
|
|
|
- }
|
|
|
- p = p[1 : len(p)-1]
|
|
|
-loop:
|
|
|
- for i, b := range p {
|
|
|
- switch b {
|
|
|
- case '.':
|
|
|
- prefixIndex = i
|
|
|
- case '/':
|
|
|
- versionIndex = i
|
|
|
- break loop
|
|
|
- }
|
|
|
- }
|
|
|
- t.Prefix = string(p[:prefixIndex])
|
|
|
- t.Capability = string(p[prefixIndex+1 : versionIndex])
|
|
|
- if versionIndex < len(p) {
|
|
|
- t.Version = string(p[versionIndex+1:])
|
|
|
- }
|
|
|
- return nil
|
|
|
-}
|
|
|
+ // env
|
|
|
+ // Required: true
|
|
|
+ Env []string `json:"Env"`
|
|
|
|
|
|
-// MarshalJSON implements json.Marshaler for PluginInterfaceType
|
|
|
-func (t *PluginInterfaceType) MarshalJSON() ([]byte, error) {
|
|
|
- return json.Marshal(t.String())
|
|
|
+ // mounts
|
|
|
+ // Required: true
|
|
|
+ Mounts []PluginMount `json:"Mounts"`
|
|
|
}
|
|
|
|
|
|
-// String implements fmt.Stringer for PluginInterfaceType
|
|
|
-func (t PluginInterfaceType) String() string {
|
|
|
- return fmt.Sprintf("%s.%s/%s", t.Prefix, t.Capability, t.Version)
|
|
|
-}
|
|
|
+// PluginManifestThe manifest of a plugin.
|
|
|
+// swagger:model PluginManifest
|
|
|
+type PluginManifest struct {
|
|
|
|
|
|
-// PluginInterface describes the interface between Docker and plugin
|
|
|
-type PluginInterface struct {
|
|
|
- Types []PluginInterfaceType
|
|
|
- Socket string
|
|
|
-}
|
|
|
+ // args
|
|
|
+ // Required: true
|
|
|
+ Args PluginManifestArgs `json:"Args"`
|
|
|
|
|
|
-// PluginSetting is to be embedded in other structs, if they are supposed to be
|
|
|
-// modifiable by the user.
|
|
|
-type PluginSetting struct {
|
|
|
- Name string
|
|
|
- Description string
|
|
|
- Settable []string
|
|
|
-}
|
|
|
+ // capabilities
|
|
|
+ // Required: true
|
|
|
+ Capabilities []string `json:"Capabilities"`
|
|
|
|
|
|
-// PluginNetwork represents the network configuration for a plugin
|
|
|
-type PluginNetwork struct {
|
|
|
- Type string
|
|
|
-}
|
|
|
+ // description
|
|
|
+ // Required: true
|
|
|
+ Description string `json:"Description"`
|
|
|
|
|
|
-// PluginMount represents the mount configuration for a plugin
|
|
|
-type PluginMount struct {
|
|
|
- PluginSetting
|
|
|
- Source *string
|
|
|
- Destination string
|
|
|
- Type string
|
|
|
- Options []string
|
|
|
-}
|
|
|
+ // devices
|
|
|
+ // Required: true
|
|
|
+ Devices []PluginDevice `json:"Devices"`
|
|
|
|
|
|
-// PluginEnv represents an environment variable for a plugin
|
|
|
-type PluginEnv struct {
|
|
|
- PluginSetting
|
|
|
- Value *string
|
|
|
-}
|
|
|
+ // documentation
|
|
|
+ // Required: true
|
|
|
+ Documentation string `json:"Documentation"`
|
|
|
|
|
|
-// PluginArgs represents the command line arguments for a plugin
|
|
|
-type PluginArgs struct {
|
|
|
- PluginSetting
|
|
|
- Value []string
|
|
|
-}
|
|
|
+ // entrypoint
|
|
|
+ // Required: true
|
|
|
+ Entrypoint []string `json:"Entrypoint"`
|
|
|
+
|
|
|
+ // env
|
|
|
+ // Required: true
|
|
|
+ Env []PluginEnv `json:"Env"`
|
|
|
+
|
|
|
+ // interface
|
|
|
+ // Required: true
|
|
|
+ Interface PluginManifestInterface `json:"Interface"`
|
|
|
+
|
|
|
+ // manifest version
|
|
|
+ // Required: true
|
|
|
+ ManifestVersion string `json:"ManifestVersion"`
|
|
|
|
|
|
-// PluginDevice represents a device for a plugin
|
|
|
-type PluginDevice struct {
|
|
|
- PluginSetting
|
|
|
- Path *string
|
|
|
+ // mounts
|
|
|
+ // Required: true
|
|
|
+ Mounts []PluginMount `json:"Mounts"`
|
|
|
+
|
|
|
+ // network
|
|
|
+ // Required: true
|
|
|
+ Network PluginManifestNetwork `json:"Network"`
|
|
|
+
|
|
|
+ // user
|
|
|
+ User PluginManifestUser `json:"User,omitempty"`
|
|
|
+
|
|
|
+ // workdir
|
|
|
+ // Required: true
|
|
|
+ Workdir string `json:"Workdir"`
|
|
|
}
|
|
|
|
|
|
-// PluginUser represents the user for the plugin's process
|
|
|
-type PluginUser struct {
|
|
|
- UID uint32 `json:"Uid,omitempty"`
|
|
|
- GID uint32 `json:"Gid,omitempty"`
|
|
|
+// PluginManifestArgsplugin manifest args
|
|
|
+// swagger:model PluginManifestArgs
|
|
|
+type PluginManifestArgs struct {
|
|
|
+
|
|
|
+ // description
|
|
|
+ // Required: true
|
|
|
+ Description string `json:"Description"`
|
|
|
+
|
|
|
+ // name
|
|
|
+ // Required: true
|
|
|
+ Name string `json:"Name"`
|
|
|
+
|
|
|
+ // settable
|
|
|
+ // Required: true
|
|
|
+ Settable []string `json:"Settable"`
|
|
|
+
|
|
|
+ // value
|
|
|
+ // Required: true
|
|
|
+ Value []string `json:"Value"`
|
|
|
}
|
|
|
|
|
|
-// PluginManifest represents the manifest of a plugin
|
|
|
-type PluginManifest struct {
|
|
|
- ManifestVersion string
|
|
|
- Description string
|
|
|
- Documentation string
|
|
|
- Interface PluginInterface
|
|
|
- Entrypoint []string
|
|
|
- Workdir string
|
|
|
- User PluginUser `json:",omitempty"`
|
|
|
- Network PluginNetwork
|
|
|
- Capabilities []string
|
|
|
- Mounts []PluginMount
|
|
|
- Devices []PluginDevice
|
|
|
- Env []PluginEnv
|
|
|
- Args PluginArgs
|
|
|
+// PluginManifestInterfaceThe interface between Docker and the plugin
|
|
|
+// swagger:model PluginManifestInterface
|
|
|
+type PluginManifestInterface struct {
|
|
|
+
|
|
|
+ // socket
|
|
|
+ // Required: true
|
|
|
+ Socket string `json:"Socket"`
|
|
|
+
|
|
|
+ // types
|
|
|
+ // Required: true
|
|
|
+ Types []PluginInterfaceType `json:"Types"`
|
|
|
}
|
|
|
|
|
|
-// PluginPrivilege describes a permission the user has to accept
|
|
|
-// upon installing a plugin.
|
|
|
-type PluginPrivilege struct {
|
|
|
- Name string
|
|
|
- Description string
|
|
|
- Value []string
|
|
|
+// PluginManifestNetworkplugin manifest network
|
|
|
+// swagger:model PluginManifestNetwork
|
|
|
+type PluginManifestNetwork struct {
|
|
|
+
|
|
|
+ // type
|
|
|
+ // Required: true
|
|
|
+ Type string `json:"Type"`
|
|
|
}
|
|
|
|
|
|
-// PluginPrivileges is a list of PluginPrivilege
|
|
|
-type PluginPrivileges []PluginPrivilege
|
|
|
+// PluginManifestUserplugin manifest user
|
|
|
+// swagger:model PluginManifestUser
|
|
|
+type PluginManifestUser struct {
|
|
|
+
|
|
|
+ // g ID
|
|
|
+ GID uint32 `json:"GID,omitempty"`
|
|
|
+
|
|
|
+ // UID
|
|
|
+ UID uint32 `json:"UID,omitempty"`
|
|
|
+}
|