Skip to content

Commit

Permalink
Generate plugin types from the swagger spec.
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Nephin <[email protected]>
  • Loading branch information
dnephin committed Oct 20, 2016
1 parent 02e1ffd commit 6f7b69b
Show file tree
Hide file tree
Showing 9 changed files with 404 additions and 156 deletions.
97 changes: 84 additions & 13 deletions api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1118,11 +1118,15 @@ definitions:

PluginMount:
type: "object"
x-nullable: false
required: [Name, Description, Settable, Source, Destination, Type, Options]
properties:
Name:
type: "string"
x-nullable: false
Description:
type: "string"
x-nullable: false
Settable:
type: "array"
items:
Expand All @@ -1131,43 +1135,88 @@ definitions:
type: "string"
Destination:
type: "string"
x-nullable: false
Type:
type: "string"
x-nullable: false
Options:
type: "array"
items:
type: "string"

PluginDevice:
type: "object"
required: [Name, Description, Settable, Path]
x-nullable: false
properties:
Name:
type: "string"
x-nullable: false
Description:
type: "string"
x-nullable: false
Settable:
type: "array"
items:
type: "string"
Path:
type: "string"

PluginEnv:
type: "object"
x-nullable: false
required: [Name, Description, Settable, Value]
properties:
Name:
x-nullable: false
type: "string"
Description:
x-nullable: false
type: "string"
Settable:
type: "array"
items:
type: "string"
Value:
type: "string"

PluginInterfaceType:
type: "object"
x-nullable: false
required: [Prefix, Capability, Version]
properties:
Prefix:
type: "string"
x-nullable: false
Capability:
type: "string"
x-nullable: false
Version:
type: "string"
x-nullable: false

Plugin:
description: "A plugin for the Remote API"
type: "object"
required: [Config, Enabled, Manifest, Name, Tag]
properties:
Id:
type: "string"
Name:
type: "string"
x-nullable: false
Tag:
type: "string"
x-nullable: false
Enabled:
description: "True when the plugin is running. False when the plugin is not running, only installed."
type: "boolean"
x-nullable: false
Config:
description: "Settings that can be modified by users."
type: "object"
x-nullable: false
required: [Args, Devices, Env, Mounts]
properties:
Mounts:
type: "array"
Expand All @@ -1188,40 +1237,67 @@ definitions:
Manifest:
description: "The manifest of a plugin."
type: "object"
x-nullable: false
required:
- ManifestVersion
- Description
- Documentation
- Interface
- Entrypoint
- Workdir
- Network
- Capabilities
- Mounts
- Devices
- Env
- Args
properties:
ManifestVersion:
type: "string"
x-nullable: false
Description:
type: "string"
x-nullable: false
Documentation:
type: "string"
x-nullable: false
Interface:
description: "The interface between Docker and the plugin"
x-nullable: false
type: "object"
required: [Types, Socket]
properties:
Types:
type: "array"
items:
type: "string"
$ref: "#/definitions/PluginInterfaceType"
Socket:
type: "string"
x-nullable: false
Entrypoint:
type: "array"
items:
type: "string"
Workdir:
type: "string"
x-nullable: false
User:
type: "object"
x-nullable: false
properties:
UID:
type: "integer"
format: "uint32"
GID:
type: "integer"
format: "uint32"
Network:
type: "object"
x-nullable: false
required: [Type]
properties:
Type:
x-nullable: false
type: "string"
Capabilities:
type: "array"
Expand All @@ -1236,24 +1312,19 @@ definitions:
items:
$ref: "#/definitions/PluginDevice"
Env:
type: "object"
properties:
Name:
type: "string"
Description:
type: "string"
Settable:
type: "array"
items:
type: "string"
Value:
type: "string"
type: "array"
items:
$ref: "#/definitions/PluginEnv"
Args:
type: "object"
x-nullable: false
required: [Name, Description, Settable, Value]
properties:
Name:
x-nullable: false
type: "string"
Description:
x-nullable: false
type: "string"
Settable:
type: "array"
Expand Down
9 changes: 9 additions & 0 deletions api/types/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,3 +314,12 @@ type TaskListOptions struct {
type PluginRemoveOptions struct {
Force bool
}

// 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)
}
Loading

0 comments on commit 6f7b69b

Please sign in to comment.