mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Merge pull request #48114 from thaJeztah/api_types_move_plugin_types
api/types: move plugin types to api/types/plugin
This commit is contained in:
@@ -2950,6 +2950,7 @@ definitions:
|
||||
|
||||
PluginMount:
|
||||
type: "object"
|
||||
x-go-name: "Mount"
|
||||
x-nullable: false
|
||||
required: [Name, Description, Settable, Source, Destination, Type, Options]
|
||||
properties:
|
||||
@@ -2986,6 +2987,7 @@ definitions:
|
||||
|
||||
PluginDevice:
|
||||
type: "object"
|
||||
x-go-name: "Device"
|
||||
required: [Name, Description, Settable, Path]
|
||||
x-nullable: false
|
||||
properties:
|
||||
@@ -3005,6 +3007,7 @@ definitions:
|
||||
|
||||
PluginEnv:
|
||||
type: "object"
|
||||
x-go-name: "Env"
|
||||
x-nullable: false
|
||||
required: [Name, Description, Settable, Value]
|
||||
properties:
|
||||
@@ -3026,7 +3029,7 @@ definitions:
|
||||
Describes a permission the user has to accept upon installing
|
||||
the plugin.
|
||||
type: "object"
|
||||
x-go-name: "PluginPrivilege"
|
||||
x-go-name: "Privilege"
|
||||
properties:
|
||||
Name:
|
||||
type: "string"
|
||||
@@ -3043,6 +3046,7 @@ definitions:
|
||||
Plugin:
|
||||
description: "A plugin for the Engine API"
|
||||
type: "object"
|
||||
x-go-name: "Plugin"
|
||||
required: [Settings, Enabled, Config, Name]
|
||||
properties:
|
||||
Id:
|
||||
@@ -3060,8 +3064,9 @@ definitions:
|
||||
x-nullable: false
|
||||
example: true
|
||||
Settings:
|
||||
description: "Settings that can be modified by users."
|
||||
description: "user-configurable settings for the plugin."
|
||||
type: "object"
|
||||
x-go-name: "Settings"
|
||||
x-nullable: false
|
||||
required: [Args, Devices, Env, Mounts]
|
||||
properties:
|
||||
@@ -3086,11 +3091,13 @@ definitions:
|
||||
PluginReference:
|
||||
description: "plugin remote reference used to push/pull the plugin"
|
||||
type: "string"
|
||||
x-go-name: "PluginReference"
|
||||
x-nullable: false
|
||||
example: "localhost:5000/tiborvass/sample-volume-plugin:latest"
|
||||
Config:
|
||||
description: "The config of a plugin."
|
||||
type: "object"
|
||||
x-go-name: "Config"
|
||||
x-nullable: false
|
||||
required:
|
||||
- Description
|
||||
@@ -3124,6 +3131,7 @@ definitions:
|
||||
description: "The interface between Docker and the plugin"
|
||||
x-nullable: false
|
||||
type: "object"
|
||||
x-go-name: "Interface"
|
||||
required: [Types, Socket]
|
||||
properties:
|
||||
Types:
|
||||
@@ -3132,8 +3140,6 @@ definitions:
|
||||
type: "string"
|
||||
x-go-type:
|
||||
type: "CapabilityID"
|
||||
import:
|
||||
package: "github.com/moby/moby/api/types/plugin"
|
||||
example:
|
||||
- "docker.volumedriver/1.0"
|
||||
Socket:
|
||||
@@ -3160,6 +3166,7 @@ definitions:
|
||||
example: "/bin/"
|
||||
User:
|
||||
type: "object"
|
||||
x-go-name: "User"
|
||||
x-nullable: false
|
||||
properties:
|
||||
UID:
|
||||
@@ -3172,6 +3179,7 @@ definitions:
|
||||
example: 1000
|
||||
Network:
|
||||
type: "object"
|
||||
x-go-name: "NetworkConfig"
|
||||
x-nullable: false
|
||||
required: [Type]
|
||||
properties:
|
||||
@@ -3181,6 +3189,7 @@ definitions:
|
||||
example: "host"
|
||||
Linux:
|
||||
type: "object"
|
||||
x-go-name: "LinuxConfig"
|
||||
x-nullable: false
|
||||
required: [Capabilities, AllowAllDevices, Devices]
|
||||
properties:
|
||||
@@ -3226,6 +3235,7 @@ definitions:
|
||||
Value: "0"
|
||||
Args:
|
||||
type: "object"
|
||||
x-go-name: "Args"
|
||||
x-nullable: false
|
||||
required: [Name, Description, Settable, Value]
|
||||
properties:
|
||||
@@ -3247,6 +3257,7 @@ definitions:
|
||||
type: "string"
|
||||
rootfs:
|
||||
type: "object"
|
||||
x-go-name: "RootFS"
|
||||
properties:
|
||||
type:
|
||||
type: "string"
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package types
|
||||
package plugin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
// PluginDevice plugin device
|
||||
// Device device
|
||||
//
|
||||
// swagger:model PluginDevice
|
||||
type PluginDevice struct {
|
||||
// swagger:model Device
|
||||
type Device struct {
|
||||
|
||||
// description
|
||||
// Required: true
|
||||
@@ -1,14 +1,14 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package types
|
||||
package plugin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
// PluginEnv plugin env
|
||||
// Env env
|
||||
//
|
||||
// swagger:model PluginEnv
|
||||
type PluginEnv struct {
|
||||
// swagger:model Env
|
||||
type Env struct {
|
||||
|
||||
// description
|
||||
// Required: true
|
||||
@@ -1,14 +1,14 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package types
|
||||
package plugin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
// PluginMount plugin mount
|
||||
// Mount mount
|
||||
//
|
||||
// swagger:model PluginMount
|
||||
type PluginMount struct {
|
||||
// swagger:model Mount
|
||||
type Mount struct {
|
||||
|
||||
// description
|
||||
// Example: This is a mount that's used by the plugin.
|
||||
@@ -1,14 +1,10 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package types
|
||||
package plugin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"github.com/moby/moby/api/types/plugin"
|
||||
)
|
||||
|
||||
// Plugin A plugin for the Engine API
|
||||
//
|
||||
// swagger:model Plugin
|
||||
@@ -16,7 +12,7 @@ type Plugin struct {
|
||||
|
||||
// config
|
||||
// Required: true
|
||||
Config PluginConfig `json:"Config"`
|
||||
Config Config `json:"Config"`
|
||||
|
||||
// True if the plugin is running. False if the plugin is not running, only installed.
|
||||
// Example: true
|
||||
@@ -38,17 +34,17 @@ type Plugin struct {
|
||||
|
||||
// settings
|
||||
// Required: true
|
||||
Settings PluginSettings `json:"Settings"`
|
||||
Settings Settings `json:"Settings"`
|
||||
}
|
||||
|
||||
// PluginConfig The config of a plugin.
|
||||
// Config The config of a plugin.
|
||||
//
|
||||
// swagger:model PluginConfig
|
||||
type PluginConfig struct {
|
||||
// swagger:model Config
|
||||
type Config struct {
|
||||
|
||||
// args
|
||||
// Required: true
|
||||
Args PluginConfigArgs `json:"Args"`
|
||||
Args Args `json:"Args"`
|
||||
|
||||
// description
|
||||
// Example: A sample volume plugin for Docker
|
||||
@@ -72,11 +68,11 @@ type PluginConfig struct {
|
||||
// env
|
||||
// Example: [{"Description":"If set, prints debug messages","Name":"DEBUG","Settable":null,"Value":"0"}]
|
||||
// Required: true
|
||||
Env []PluginEnv `json:"Env"`
|
||||
Env []Env `json:"Env"`
|
||||
|
||||
// interface
|
||||
// Required: true
|
||||
Interface PluginConfigInterface `json:"Interface"`
|
||||
Interface Interface `json:"Interface"`
|
||||
|
||||
// ipc host
|
||||
// Example: false
|
||||
@@ -85,15 +81,15 @@ type PluginConfig struct {
|
||||
|
||||
// linux
|
||||
// Required: true
|
||||
Linux PluginConfigLinux `json:"Linux"`
|
||||
Linux LinuxConfig `json:"Linux"`
|
||||
|
||||
// mounts
|
||||
// Required: true
|
||||
Mounts []PluginMount `json:"Mounts"`
|
||||
Mounts []Mount `json:"Mounts"`
|
||||
|
||||
// network
|
||||
// Required: true
|
||||
Network PluginConfigNetwork `json:"Network"`
|
||||
Network NetworkConfig `json:"Network"`
|
||||
|
||||
// pid host
|
||||
// Example: false
|
||||
@@ -106,7 +102,7 @@ type PluginConfig struct {
|
||||
PropagatedMount string `json:"PropagatedMount"`
|
||||
|
||||
// user
|
||||
User PluginConfigUser `json:"User,omitempty"`
|
||||
User User `json:"User,omitempty"`
|
||||
|
||||
// work dir
|
||||
// Example: /bin/
|
||||
@@ -114,13 +110,13 @@ type PluginConfig struct {
|
||||
WorkDir string `json:"WorkDir"`
|
||||
|
||||
// rootfs
|
||||
Rootfs *PluginConfigRootfs `json:"rootfs,omitempty"`
|
||||
Rootfs *RootFS `json:"rootfs,omitempty"`
|
||||
}
|
||||
|
||||
// PluginConfigArgs plugin config args
|
||||
// Args args
|
||||
//
|
||||
// swagger:model PluginConfigArgs
|
||||
type PluginConfigArgs struct {
|
||||
// swagger:model Args
|
||||
type Args struct {
|
||||
|
||||
// description
|
||||
// Example: command line arguments
|
||||
@@ -141,10 +137,10 @@ type PluginConfigArgs struct {
|
||||
Value []string `json:"Value"`
|
||||
}
|
||||
|
||||
// PluginConfigInterface The interface between Docker and the plugin
|
||||
// Interface The interface between Docker and the plugin
|
||||
//
|
||||
// swagger:model PluginConfigInterface
|
||||
type PluginConfigInterface struct {
|
||||
// swagger:model Interface
|
||||
type Interface struct {
|
||||
|
||||
// Protocol to use for clients connecting to the plugin.
|
||||
// Example: some.protocol/v1.0
|
||||
@@ -159,13 +155,13 @@ type PluginConfigInterface struct {
|
||||
// types
|
||||
// Example: ["docker.volumedriver/1.0"]
|
||||
// Required: true
|
||||
Types []plugin.CapabilityID `json:"Types"`
|
||||
Types []CapabilityID `json:"Types"`
|
||||
}
|
||||
|
||||
// PluginConfigLinux plugin config linux
|
||||
// LinuxConfig linux config
|
||||
//
|
||||
// swagger:model PluginConfigLinux
|
||||
type PluginConfigLinux struct {
|
||||
// swagger:model LinuxConfig
|
||||
type LinuxConfig struct {
|
||||
|
||||
// allow all devices
|
||||
// Example: false
|
||||
@@ -179,13 +175,13 @@ type PluginConfigLinux struct {
|
||||
|
||||
// devices
|
||||
// Required: true
|
||||
Devices []PluginDevice `json:"Devices"`
|
||||
Devices []Device `json:"Devices"`
|
||||
}
|
||||
|
||||
// PluginConfigNetwork plugin config network
|
||||
// NetworkConfig network config
|
||||
//
|
||||
// swagger:model PluginConfigNetwork
|
||||
type PluginConfigNetwork struct {
|
||||
// swagger:model NetworkConfig
|
||||
type NetworkConfig struct {
|
||||
|
||||
// type
|
||||
// Example: host
|
||||
@@ -193,10 +189,10 @@ type PluginConfigNetwork struct {
|
||||
Type string `json:"Type"`
|
||||
}
|
||||
|
||||
// PluginConfigRootfs plugin config rootfs
|
||||
// RootFS root f s
|
||||
//
|
||||
// swagger:model PluginConfigRootfs
|
||||
type PluginConfigRootfs struct {
|
||||
// swagger:model RootFS
|
||||
type RootFS struct {
|
||||
|
||||
// diff ids
|
||||
// Example: ["sha256:675532206fbf3030b8458f88d6e26d4eb1577688a25efec97154c94e8b6b4887","sha256:e216a057b1cb1efc11f8a268f37ef62083e70b1b38323ba252e25ac88904a7e8"]
|
||||
@@ -207,10 +203,10 @@ type PluginConfigRootfs struct {
|
||||
Type string `json:"type,omitempty"`
|
||||
}
|
||||
|
||||
// PluginConfigUser plugin config user
|
||||
// User user
|
||||
//
|
||||
// swagger:model PluginConfigUser
|
||||
type PluginConfigUser struct {
|
||||
// swagger:model User
|
||||
type User struct {
|
||||
|
||||
// g ID
|
||||
// Example: 1000
|
||||
@@ -221,10 +217,10 @@ type PluginConfigUser struct {
|
||||
UID uint32 `json:"UID,omitempty"`
|
||||
}
|
||||
|
||||
// PluginSettings Settings that can be modified by users.
|
||||
// Settings user-configurable settings for the plugin.
|
||||
//
|
||||
// swagger:model PluginSettings
|
||||
type PluginSettings struct {
|
||||
// swagger:model Settings
|
||||
type Settings struct {
|
||||
|
||||
// args
|
||||
// Required: true
|
||||
@@ -232,7 +228,7 @@ type PluginSettings struct {
|
||||
|
||||
// devices
|
||||
// Required: true
|
||||
Devices []PluginDevice `json:"Devices"`
|
||||
Devices []Device `json:"Devices"`
|
||||
|
||||
// env
|
||||
// Example: ["DEBUG=0"]
|
||||
@@ -241,5 +237,5 @@ type PluginSettings struct {
|
||||
|
||||
// mounts
|
||||
// Required: true
|
||||
Mounts []PluginMount `json:"Mounts"`
|
||||
Mounts []Mount `json:"Mounts"`
|
||||
}
|
||||
33
api/types/plugin/plugin_responses.go
Normal file
33
api/types/plugin/plugin_responses.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package plugin
|
||||
|
||||
import (
|
||||
"sort"
|
||||
)
|
||||
|
||||
// ListResponse contains the response for the Engine API
|
||||
type ListResponse []*Plugin
|
||||
|
||||
// Privilege describes a permission the user has to accept
|
||||
// upon installing a plugin.
|
||||
type Privilege struct {
|
||||
Name string
|
||||
Description string
|
||||
Value []string
|
||||
}
|
||||
|
||||
// Privileges is a list of Privilege
|
||||
type Privileges []Privilege
|
||||
|
||||
func (s Privileges) Len() int {
|
||||
return len(s)
|
||||
}
|
||||
|
||||
func (s Privileges) Less(i, j int) bool {
|
||||
return s[i].Name < s[j].Name
|
||||
}
|
||||
|
||||
func (s Privileges) Swap(i, j int) {
|
||||
sort.Strings(s[i].Value)
|
||||
sort.Strings(s[j].Value)
|
||||
s[i], s[j] = s[j], s[i]
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"sort"
|
||||
)
|
||||
|
||||
// PluginsListResponse contains the response for the Engine API
|
||||
type PluginsListResponse []*Plugin
|
||||
|
||||
// PluginPrivilege describes a permission the user has to accept
|
||||
// upon installing a plugin.
|
||||
type PluginPrivilege struct {
|
||||
Name string
|
||||
Description string
|
||||
Value []string
|
||||
}
|
||||
|
||||
// PluginPrivileges is a list of PluginPrivilege
|
||||
type PluginPrivileges []PluginPrivilege
|
||||
|
||||
func (s PluginPrivileges) Len() int {
|
||||
return len(s)
|
||||
}
|
||||
|
||||
func (s PluginPrivileges) Less(i, j int) bool {
|
||||
return s[i].Name < s[j].Name
|
||||
}
|
||||
|
||||
func (s PluginPrivileges) Swap(i, j int) {
|
||||
sort.Strings(s[i].Value)
|
||||
sort.Strings(s[j].Value)
|
||||
s[i], s[j] = s[j], s[i]
|
||||
}
|
||||
Reference in New Issue
Block a user