mirror of https://github.com/k3d-io/k3d
parent
13f3844ff4
commit
7d33f77a9a
@ -0,0 +1 @@ |
|||||||
|
* text=auto eol=lf |
@ -1 +1,10 @@ |
|||||||
|
.vscode/ |
||||||
|
|
||||||
*.exe |
*.exe |
||||||
|
|
||||||
|
# testing |
||||||
|
testdata |
||||||
|
|
||||||
|
# go workspaces |
||||||
|
go.work |
||||||
|
go.work.sum |
||||||
|
@ -0,0 +1,144 @@ |
|||||||
|
run: |
||||||
|
skip-dirs: |
||||||
|
- pkg/etw/sample |
||||||
|
|
||||||
|
linters: |
||||||
|
enable: |
||||||
|
# style |
||||||
|
- containedctx # struct contains a context |
||||||
|
- dupl # duplicate code |
||||||
|
- errname # erorrs are named correctly |
||||||
|
- goconst # strings that should be constants |
||||||
|
- godot # comments end in a period |
||||||
|
- misspell |
||||||
|
- nolintlint # "//nolint" directives are properly explained |
||||||
|
- revive # golint replacement |
||||||
|
- stylecheck # golint replacement, less configurable than revive |
||||||
|
- unconvert # unnecessary conversions |
||||||
|
- wastedassign |
||||||
|
|
||||||
|
# bugs, performance, unused, etc ... |
||||||
|
- contextcheck # function uses a non-inherited context |
||||||
|
- errorlint # errors not wrapped for 1.13 |
||||||
|
- exhaustive # check exhaustiveness of enum switch statements |
||||||
|
- gofmt # files are gofmt'ed |
||||||
|
- gosec # security |
||||||
|
- nestif # deeply nested ifs |
||||||
|
- nilerr # returns nil even with non-nil error |
||||||
|
- prealloc # slices that can be pre-allocated |
||||||
|
- structcheck # unused struct fields |
||||||
|
- unparam # unused function params |
||||||
|
|
||||||
|
issues: |
||||||
|
exclude-rules: |
||||||
|
# err is very often shadowed in nested scopes |
||||||
|
- linters: |
||||||
|
- govet |
||||||
|
text: '^shadow: declaration of "err" shadows declaration' |
||||||
|
|
||||||
|
# ignore long lines for skip autogen directives |
||||||
|
- linters: |
||||||
|
- revive |
||||||
|
text: "^line-length-limit: " |
||||||
|
source: "^//(go:generate|sys) " |
||||||
|
|
||||||
|
# allow unjustified ignores of error checks in defer statements |
||||||
|
- linters: |
||||||
|
- nolintlint |
||||||
|
text: "^directive `//nolint:errcheck` should provide explanation" |
||||||
|
source: '^\s*defer ' |
||||||
|
|
||||||
|
# allow unjustified ignores of error lints for io.EOF |
||||||
|
- linters: |
||||||
|
- nolintlint |
||||||
|
text: "^directive `//nolint:errorlint` should provide explanation" |
||||||
|
source: '[=|!]= io.EOF' |
||||||
|
|
||||||
|
|
||||||
|
linters-settings: |
||||||
|
govet: |
||||||
|
enable-all: true |
||||||
|
disable: |
||||||
|
# struct order is often for Win32 compat |
||||||
|
# also, ignore pointer bytes/GC issues for now until performance becomes an issue |
||||||
|
- fieldalignment |
||||||
|
check-shadowing: true |
||||||
|
nolintlint: |
||||||
|
allow-leading-space: false |
||||||
|
require-explanation: true |
||||||
|
require-specific: true |
||||||
|
revive: |
||||||
|
# revive is more configurable than static check, so likely the preferred alternative to static-check |
||||||
|
# (once the perf issue is solved: https://github.com/golangci/golangci-lint/issues/2997) |
||||||
|
enable-all-rules: |
||||||
|
true |
||||||
|
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md |
||||||
|
rules: |
||||||
|
# rules with required arguments |
||||||
|
- name: argument-limit |
||||||
|
disabled: true |
||||||
|
- name: banned-characters |
||||||
|
disabled: true |
||||||
|
- name: cognitive-complexity |
||||||
|
disabled: true |
||||||
|
- name: cyclomatic |
||||||
|
disabled: true |
||||||
|
- name: file-header |
||||||
|
disabled: true |
||||||
|
- name: function-length |
||||||
|
disabled: true |
||||||
|
- name: function-result-limit |
||||||
|
disabled: true |
||||||
|
- name: max-public-structs |
||||||
|
disabled: true |
||||||
|
# geneally annoying rules |
||||||
|
- name: add-constant # complains about any and all strings and integers |
||||||
|
disabled: true |
||||||
|
- name: confusing-naming # we frequently use "Foo()" and "foo()" together |
||||||
|
disabled: true |
||||||
|
- name: flag-parameter # excessive, and a common idiom we use |
||||||
|
disabled: true |
||||||
|
# general config |
||||||
|
- name: line-length-limit |
||||||
|
arguments: |
||||||
|
- 140 |
||||||
|
- name: var-naming |
||||||
|
arguments: |
||||||
|
- [] |
||||||
|
- - CID |
||||||
|
- CRI |
||||||
|
- CTRD |
||||||
|
- DACL |
||||||
|
- DLL |
||||||
|
- DOS |
||||||
|
- ETW |
||||||
|
- FSCTL |
||||||
|
- GCS |
||||||
|
- GMSA |
||||||
|
- HCS |
||||||
|
- HV |
||||||
|
- IO |
||||||
|
- LCOW |
||||||
|
- LDAP |
||||||
|
- LPAC |
||||||
|
- LTSC |
||||||
|
- MMIO |
||||||
|
- NT |
||||||
|
- OCI |
||||||
|
- PMEM |
||||||
|
- PWSH |
||||||
|
- RX |
||||||
|
- SACl |
||||||
|
- SID |
||||||
|
- SMB |
||||||
|
- TX |
||||||
|
- VHD |
||||||
|
- VHDX |
||||||
|
- VMID |
||||||
|
- VPCI |
||||||
|
- WCOW |
||||||
|
- WIM |
||||||
|
stylecheck: |
||||||
|
checks: |
||||||
|
- "all" |
||||||
|
- "-ST1003" # use revive's var naming |
@ -0,0 +1,41 @@ |
|||||||
|
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.7 BLOCK --> |
||||||
|
|
||||||
|
## Security |
||||||
|
|
||||||
|
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). |
||||||
|
|
||||||
|
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below. |
||||||
|
|
||||||
|
## Reporting Security Issues |
||||||
|
|
||||||
|
**Please do not report security vulnerabilities through public GitHub issues.** |
||||||
|
|
||||||
|
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report). |
||||||
|
|
||||||
|
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey). |
||||||
|
|
||||||
|
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc). |
||||||
|
|
||||||
|
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: |
||||||
|
|
||||||
|
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) |
||||||
|
* Full paths of source file(s) related to the manifestation of the issue |
||||||
|
* The location of the affected source code (tag/branch/commit or direct URL) |
||||||
|
* Any special configuration required to reproduce the issue |
||||||
|
* Step-by-step instructions to reproduce the issue |
||||||
|
* Proof-of-concept or exploit code (if possible) |
||||||
|
* Impact of the issue, including how an attacker might exploit the issue |
||||||
|
|
||||||
|
This information will help us triage your report more quickly. |
||||||
|
|
||||||
|
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs. |
||||||
|
|
||||||
|
## Preferred Languages |
||||||
|
|
||||||
|
We prefer all communications to be in English. |
||||||
|
|
||||||
|
## Policy |
||||||
|
|
||||||
|
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd). |
||||||
|
|
||||||
|
<!-- END MICROSOFT SECURITY.MD BLOCK --> |
@ -0,0 +1,22 @@ |
|||||||
|
// This package provides utilities for efficiently performing Win32 IO operations in Go.
|
||||||
|
// Currently, this package is provides support for genreal IO and management of
|
||||||
|
// - named pipes
|
||||||
|
// - files
|
||||||
|
// - [Hyper-V sockets]
|
||||||
|
//
|
||||||
|
// This code is similar to Go's [net] package, and uses IO completion ports to avoid
|
||||||
|
// blocking IO on system threads, allowing Go to reuse the thread to schedule other goroutines.
|
||||||
|
//
|
||||||
|
// This limits support to Windows Vista and newer operating systems.
|
||||||
|
//
|
||||||
|
// Additionally, this package provides support for:
|
||||||
|
// - creating and managing GUIDs
|
||||||
|
// - writing to [ETW]
|
||||||
|
// - opening and manageing VHDs
|
||||||
|
// - parsing [Windows Image files]
|
||||||
|
// - auto-generating Win32 API code
|
||||||
|
//
|
||||||
|
// [Hyper-V sockets]: https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/user-guide/make-integration-service
|
||||||
|
// [ETW]: https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/event-tracing-for-windows--etw-
|
||||||
|
// [Windows Image files]: https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/work-with-windows-images
|
||||||
|
package winio |
@ -0,0 +1,20 @@ |
|||||||
|
package socket |
||||||
|
|
||||||
|
import ( |
||||||
|
"unsafe" |
||||||
|
) |
||||||
|
|
||||||
|
// RawSockaddr allows structs to be used with [Bind] and [ConnectEx]. The
|
||||||
|
// struct must meet the Win32 sockaddr requirements specified here:
|
||||||
|
// https://docs.microsoft.com/en-us/windows/win32/winsock/sockaddr-2
|
||||||
|
//
|
||||||
|
// Specifically, the struct size must be least larger than an int16 (unsigned short)
|
||||||
|
// for the address family.
|
||||||
|
type RawSockaddr interface { |
||||||
|
// Sockaddr returns a pointer to the RawSockaddr and its struct size, allowing
|
||||||
|
// for the RawSockaddr's data to be overwritten by syscalls (if necessary).
|
||||||
|
//
|
||||||
|
// It is the callers responsibility to validate that the values are valid; invalid
|
||||||
|
// pointers or size can cause a panic.
|
||||||
|
Sockaddr() (unsafe.Pointer, int32, error) |
||||||
|
} |
@ -0,0 +1,179 @@ |
|||||||
|
//go:build windows
|
||||||
|
|
||||||
|
package socket |
||||||
|
|
||||||
|
import ( |
||||||
|
"errors" |
||||||
|
"fmt" |
||||||
|
"net" |
||||||
|
"sync" |
||||||
|
"syscall" |
||||||
|
"unsafe" |
||||||
|
|
||||||
|
"github.com/Microsoft/go-winio/pkg/guid" |
||||||
|
"golang.org/x/sys/windows" |
||||||
|
) |
||||||
|
|
||||||
|
//go:generate go run github.com/Microsoft/go-winio/tools/mkwinsyscall -output zsyscall_windows.go socket.go
|
||||||
|
|
||||||
|
//sys getsockname(s windows.Handle, name unsafe.Pointer, namelen *int32) (err error) [failretval==socketError] = ws2_32.getsockname
|
||||||
|
//sys getpeername(s windows.Handle, name unsafe.Pointer, namelen *int32) (err error) [failretval==socketError] = ws2_32.getpeername
|
||||||
|
//sys bind(s windows.Handle, name unsafe.Pointer, namelen int32) (err error) [failretval==socketError] = ws2_32.bind
|
||||||
|
|
||||||
|
const socketError = uintptr(^uint32(0)) |
||||||
|
|
||||||
|
var ( |
||||||
|
// todo(helsaawy): create custom error types to store the desired vs actual size and addr family?
|
||||||
|
|
||||||
|
ErrBufferSize = errors.New("buffer size") |
||||||
|
ErrAddrFamily = errors.New("address family") |
||||||
|
ErrInvalidPointer = errors.New("invalid pointer") |
||||||
|
ErrSocketClosed = fmt.Errorf("socket closed: %w", net.ErrClosed) |
||||||
|
) |
||||||
|
|
||||||
|
// todo(helsaawy): replace these with generics, ie: GetSockName[S RawSockaddr](s windows.Handle) (S, error)
|
||||||
|
|
||||||
|
// GetSockName writes the local address of socket s to the [RawSockaddr] rsa.
|
||||||
|
// If rsa is not large enough, the [windows.WSAEFAULT] is returned.
|
||||||
|
func GetSockName(s windows.Handle, rsa RawSockaddr) error { |
||||||
|
ptr, l, err := rsa.Sockaddr() |
||||||
|
if err != nil { |
||||||
|
return fmt.Errorf("could not retrieve socket pointer and size: %w", err) |
||||||
|
} |
||||||
|
|
||||||
|
// although getsockname returns WSAEFAULT if the buffer is too small, it does not set
|
||||||
|
// &l to the correct size, so--apart from doubling the buffer repeatedly--there is no remedy
|
||||||
|
return getsockname(s, ptr, &l) |
||||||
|
} |
||||||
|
|
||||||
|
// GetPeerName returns the remote address the socket is connected to.
|
||||||
|
//
|
||||||
|
// See [GetSockName] for more information.
|
||||||
|
func GetPeerName(s windows.Handle, rsa RawSockaddr) error { |
||||||
|
ptr, l, err := rsa.Sockaddr() |
||||||
|
if err != nil { |
||||||
|
return fmt.Errorf("could not retrieve socket pointer and size: %w", err) |
||||||
|
} |
||||||
|
|
||||||
|
return getpeername(s, ptr, &l) |
||||||
|
} |
||||||
|
|
||||||
|
func Bind(s windows.Handle, rsa RawSockaddr) (err error) { |
||||||
|
ptr, l, err := rsa.Sockaddr() |
||||||
|
if err != nil { |
||||||
|
return fmt.Errorf("could not retrieve socket pointer and size: %w", err) |
||||||
|
} |
||||||
|
|
||||||
|
return bind(s, ptr, l) |
||||||
|
} |
||||||
|
|
||||||
|
// "golang.org/x/sys/windows".ConnectEx and .Bind only accept internal implementations of the
|
||||||
|
// their sockaddr interface, so they cannot be used with HvsockAddr
|
||||||
|
// Replicate functionality here from
|
||||||
|
// https://cs.opensource.google/go/x/sys/+/master:windows/syscall_windows.go
|
||||||
|
|
||||||
|
// The function pointers to `AcceptEx`, `ConnectEx` and `GetAcceptExSockaddrs` must be loaded at
|
||||||
|
// runtime via a WSAIoctl call:
|
||||||
|
// https://docs.microsoft.com/en-us/windows/win32/api/Mswsock/nc-mswsock-lpfn_connectex#remarks
|
||||||
|
|
||||||
|
type runtimeFunc struct { |
||||||
|
id guid.GUID |
||||||
|
once sync.Once |
||||||
|
addr uintptr |
||||||
|
err error |
||||||
|
} |
||||||
|
|
||||||
|
func (f *runtimeFunc) Load() error { |
||||||
|
f.once.Do(func() { |
||||||
|
var s windows.Handle |
||||||
|
s, f.err = windows.Socket(windows.AF_INET, windows.SOCK_STREAM, windows.IPPROTO_TCP) |
||||||
|
if f.err != nil { |
||||||
|
return |
||||||
|
} |
||||||
|
defer windows.CloseHandle(s) //nolint:errcheck
|
||||||
|
|
||||||
|
var n uint32 |
||||||
|
f.err = windows.WSAIoctl(s, |
||||||
|
windows.SIO_GET_EXTENSION_FUNCTION_POINTER, |
||||||
|
(*byte)(unsafe.Pointer(&f.id)), |
||||||
|
uint32(unsafe.Sizeof(f.id)), |
||||||
|
(*byte)(unsafe.Pointer(&f.addr)), |
||||||
|
uint32(unsafe.Sizeof(f.addr)), |
||||||
|
&n, |
||||||
|
nil, //overlapped
|
||||||
|
0, //completionRoutine
|
||||||
|
) |
||||||
|
}) |
||||||
|
return f.err |
||||||
|
} |
||||||
|
|
||||||
|
var ( |
||||||
|
// todo: add `AcceptEx` and `GetAcceptExSockaddrs`
|
||||||
|
WSAID_CONNECTEX = guid.GUID{ //revive:disable-line:var-naming ALL_CAPS
|
||||||
|
Data1: 0x25a207b9, |
||||||
|
Data2: 0xddf3, |
||||||
|
Data3: 0x4660, |
||||||
|
Data4: [8]byte{0x8e, 0xe9, 0x76, 0xe5, 0x8c, 0x74, 0x06, 0x3e}, |
||||||
|
} |
||||||
|
|
||||||
|
connectExFunc = runtimeFunc{id: WSAID_CONNECTEX} |
||||||
|
) |
||||||
|
|
||||||
|
func ConnectEx( |
||||||
|
fd windows.Handle, |
||||||
|
rsa RawSockaddr, |
||||||
|
sendBuf *byte, |
||||||
|
sendDataLen uint32, |
||||||
|
bytesSent *uint32, |
||||||
|
overlapped *windows.Overlapped, |
||||||
|
) error { |
||||||
|
if err := connectExFunc.Load(); err != nil { |
||||||
|
return fmt.Errorf("failed to load ConnectEx function pointer: %w", err) |
||||||
|
} |
||||||
|
ptr, n, err := rsa.Sockaddr() |
||||||
|
if err != nil { |
||||||
|
return err |
||||||
|
} |
||||||
|
return connectEx(fd, ptr, n, sendBuf, sendDataLen, bytesSent, overlapped) |
||||||
|
} |
||||||
|
|
||||||
|
// BOOL LpfnConnectex(
|
||||||
|
// [in] SOCKET s,
|
||||||
|
// [in] const sockaddr *name,
|
||||||
|
// [in] int namelen,
|
||||||
|
// [in, optional] PVOID lpSendBuffer,
|
||||||
|
// [in] DWORD dwSendDataLength,
|
||||||
|
// [out] LPDWORD lpdwBytesSent,
|
||||||
|
// [in] LPOVERLAPPED lpOverlapped
|
||||||
|
// )
|
||||||
|
|
||||||
|
func connectEx( |
||||||
|
s windows.Handle, |
||||||
|
name unsafe.Pointer, |
||||||
|
namelen int32, |
||||||
|
sendBuf *byte, |
||||||
|
sendDataLen uint32, |
||||||
|
bytesSent *uint32, |
||||||
|
overlapped *windows.Overlapped, |
||||||
|
) (err error) { |
||||||
|
// todo: after upgrading to 1.18, switch from syscall.Syscall9 to syscall.SyscallN
|
||||||
|
r1, _, e1 := syscall.Syscall9(connectExFunc.addr, |
||||||
|
7, |
||||||
|
uintptr(s), |
||||||
|
uintptr(name), |
||||||
|
uintptr(namelen), |
||||||
|
uintptr(unsafe.Pointer(sendBuf)), |
||||||
|
uintptr(sendDataLen), |
||||||
|
uintptr(unsafe.Pointer(bytesSent)), |
||||||
|
uintptr(unsafe.Pointer(overlapped)), |
||||||
|
0, |
||||||
|
0) |
||||||
|
if r1 == 0 { |
||||||
|
if e1 != 0 { |
||||||
|
err = error(e1) |
||||||
|
} else { |
||||||
|
err = syscall.EINVAL |
||||||
|
} |
||||||
|
} |
||||||
|
return err |
||||||
|
} |
72
tools/vendor/github.com/Microsoft/go-winio/internal/socket/zsyscall_windows.go
generated
vendored
72
tools/vendor/github.com/Microsoft/go-winio/internal/socket/zsyscall_windows.go
generated
vendored
@ -0,0 +1,72 @@ |
|||||||
|
//go:build windows
|
||||||
|
|
||||||
|
// Code generated by 'go generate' using "github.com/Microsoft/go-winio/tools/mkwinsyscall"; DO NOT EDIT.
|
||||||
|
|
||||||
|
package socket |
||||||
|
|
||||||
|
import ( |
||||||
|
"syscall" |
||||||
|
"unsafe" |
||||||
|
|
||||||
|
"golang.org/x/sys/windows" |
||||||
|
) |
||||||
|
|
||||||
|
var _ unsafe.Pointer |
||||||
|
|
||||||
|
// Do the interface allocations only once for common
|
||||||
|
// Errno values.
|
||||||
|
const ( |
||||||
|
errnoERROR_IO_PENDING = 997 |
||||||
|
) |
||||||
|
|
||||||
|
var ( |
||||||
|
errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING) |
||||||
|
errERROR_EINVAL error = syscall.EINVAL |
||||||
|
) |
||||||
|
|
||||||
|
// errnoErr returns common boxed Errno values, to prevent
|
||||||
|
// allocations at runtime.
|
||||||
|
func errnoErr(e syscall.Errno) error { |
||||||
|
switch e { |
||||||
|
case 0: |
||||||
|
return errERROR_EINVAL |
||||||
|
case errnoERROR_IO_PENDING: |
||||||
|
return errERROR_IO_PENDING |
||||||
|
} |
||||||
|
// TODO: add more here, after collecting data on the common
|
||||||
|
// error values see on Windows. (perhaps when running
|
||||||
|
// all.bat?)
|
||||||
|
return e |
||||||
|
} |
||||||
|
|
||||||
|
var ( |
||||||
|
modws2_32 = windows.NewLazySystemDLL("ws2_32.dll") |
||||||
|
|
||||||
|
procbind = modws2_32.NewProc("bind") |
||||||
|
procgetpeername = modws2_32.NewProc("getpeername") |
||||||
|
procgetsockname = modws2_32.NewProc("getsockname") |
||||||
|
) |
||||||
|
|
||||||
|
func bind(s windows.Handle, name unsafe.Pointer, namelen int32) (err error) { |
||||||
|
r1, _, e1 := syscall.Syscall(procbind.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen)) |
||||||
|
if r1 == socketError { |
||||||
|
err = errnoErr(e1) |
||||||
|
} |
||||||
|
return |
||||||
|
} |
||||||
|
|
||||||
|
func getpeername(s windows.Handle, name unsafe.Pointer, namelen *int32) (err error) { |
||||||
|
r1, _, e1 := syscall.Syscall(procgetpeername.Addr(), 3, uintptr(s), uintptr(name), uintptr(unsafe.Pointer(namelen))) |
||||||
|
if r1 == socketError { |
||||||
|
err = errnoErr(e1) |
||||||
|
} |
||||||
|
return |
||||||
|
} |
||||||
|
|
||||||
|
func getsockname(s windows.Handle, name unsafe.Pointer, namelen *int32) (err error) { |
||||||
|
r1, _, e1 := syscall.Syscall(procgetsockname.Addr(), 3, uintptr(s), uintptr(name), uintptr(unsafe.Pointer(namelen))) |
||||||
|
if r1 == socketError { |
||||||
|
err = errnoErr(e1) |
||||||
|
} |
||||||
|
return |
||||||
|
} |
@ -0,0 +1,27 @@ |
|||||||
|
// Code generated by "stringer -type=Variant -trimprefix=Variant -linecomment"; DO NOT EDIT.
|
||||||
|
|
||||||
|
package guid |
||||||
|
|
||||||
|
import "strconv" |
||||||
|
|
||||||
|
func _() { |
||||||
|
// An "invalid array index" compiler error signifies that the constant values have changed.
|
||||||
|
// Re-run the stringer command to generate them again.
|
||||||
|
var x [1]struct{} |
||||||
|
_ = x[VariantUnknown-0] |
||||||
|
_ = x[VariantNCS-1] |
||||||
|
_ = x[VariantRFC4122-2] |
||||||
|
_ = x[VariantMicrosoft-3] |
||||||
|
_ = x[VariantFuture-4] |
||||||
|
} |
||||||
|
|
||||||
|
const _Variant_name = "UnknownNCSRFC 4122MicrosoftFuture" |
||||||
|
|
||||||
|
var _Variant_index = [...]uint8{0, 7, 10, 18, 27, 33} |
||||||
|
|
||||||
|
func (i Variant) String() string { |
||||||
|
if i >= Variant(len(_Variant_index)-1) { |
||||||
|
return "Variant(" + strconv.FormatInt(int64(i), 10) + ")" |
||||||
|
} |
||||||
|
return _Variant_name[_Variant_index[i]:_Variant_index[i+1]] |
||||||
|
} |
@ -1,3 +1,5 @@ |
|||||||
|
//go:build windows
|
||||||
|
|
||||||
package winio |
package winio |
||||||
|
|
||||||
//go:generate go run golang.org/x/sys/windows/mkwinsyscall -output zsyscall_windows.go file.go pipe.go sd.go fileinfo.go privilege.go backup.go hvsock.go
|
//go:generate go run github.com/Microsoft/go-winio/tools/mkwinsyscall -output zsyscall_windows.go ./*.go
|
||||||
|
@ -0,0 +1,5 @@ |
|||||||
|
//go:build tools
|
||||||
|
|
||||||
|
package winio |
||||||
|
|
||||||
|
import _ "golang.org/x/tools/cmd/stringer" |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,20 +0,0 @@ |
|||||||
package container // import "github.com/docker/docker/api/types/container"
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// Code generated by `swagger generate operation`. DO NOT EDIT.
|
|
||||||
//
|
|
||||||
// See hack/generate-swagger-api.sh
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// ContainerCreateCreatedBody OK response to ContainerCreate operation
|
|
||||||
// swagger:model ContainerCreateCreatedBody
|
|
||||||
type ContainerCreateCreatedBody struct { |
|
||||||
|
|
||||||
// The ID of the created container
|
|
||||||
// Required: true
|
|
||||||
ID string `json:"Id"` |
|
||||||
|
|
||||||
// Warnings encountered when creating the container
|
|
||||||
// Required: true
|
|
||||||
Warnings []string `json:"Warnings"` |
|
||||||
} |
|
@ -1,28 +0,0 @@ |
|||||||
package container // import "github.com/docker/docker/api/types/container"
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// Code generated by `swagger generate operation`. DO NOT EDIT.
|
|
||||||
//
|
|
||||||
// See hack/generate-swagger-api.sh
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// ContainerWaitOKBodyError container waiting error, if any
|
|
||||||
// swagger:model ContainerWaitOKBodyError
|
|
||||||
type ContainerWaitOKBodyError struct { |
|
||||||
|
|
||||||
// Details of an error
|
|
||||||
Message string `json:"Message,omitempty"` |
|
||||||
} |
|
||||||
|
|
||||||
// ContainerWaitOKBody OK response to ContainerWait operation
|
|
||||||
// swagger:model ContainerWaitOKBody
|
|
||||||
type ContainerWaitOKBody struct { |
|
||||||
|
|
||||||
// error
|
|
||||||
// Required: true
|
|
||||||
Error *ContainerWaitOKBodyError `json:"Error"` |
|
||||||
|
|
||||||
// Exit code of the container
|
|
||||||
// Required: true
|
|
||||||
StatusCode int64 `json:"StatusCode"` |
|
||||||
} |
|
@ -0,0 +1,19 @@ |
|||||||
|
package container |
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
// CreateResponse ContainerCreateResponse
|
||||||
|
//
|
||||||
|
// OK response to ContainerCreate operation
|
||||||
|
// swagger:model CreateResponse
|
||||||
|
type CreateResponse struct { |
||||||
|
|
||||||
|
// The ID of the created container
|
||||||
|
// Required: true
|
||||||
|
ID string `json:"Id"` |
||||||
|
|
||||||
|
// Warnings encountered when creating the container
|
||||||
|
// Required: true
|
||||||
|
Warnings []string `json:"Warnings"` |
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package container // import "github.com/docker/docker/api/types/container"
|
||||||
|
|
||||||
|
// ContainerCreateCreatedBody OK response to ContainerCreate operation
|
||||||
|
//
|
||||||
|
// Deprecated: use CreateResponse
|
||||||
|
type ContainerCreateCreatedBody = CreateResponse |
||||||
|
|
||||||
|
// ContainerWaitOKBody OK response to ContainerWait operation
|
||||||
|
//
|
||||||
|
// Deprecated: use WaitResponse
|
||||||
|
type ContainerWaitOKBody = WaitResponse |
||||||
|
|
||||||
|
// ContainerWaitOKBodyError container waiting error, if any
|
||||||
|
//
|
||||||
|
// Deprecated: use WaitExitError
|
||||||
|
type ContainerWaitOKBodyError = WaitExitError |
@ -0,0 +1,12 @@ |
|||||||
|
package container |
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
// WaitExitError container waiting error, if any
|
||||||
|
// swagger:model WaitExitError
|
||||||
|
type WaitExitError struct { |
||||||
|
|
||||||
|
// Details of an error
|
||||||
|
Message string `json:"Message,omitempty"` |
||||||
|
} |
@ -0,0 +1,18 @@ |
|||||||
|
package container |
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
// WaitResponse ContainerWaitResponse
|
||||||
|
//
|
||||||
|
// OK response to ContainerWait operation
|
||||||
|
// swagger:model WaitResponse
|
||||||
|
type WaitResponse struct { |
||||||
|
|
||||||
|
// error
|
||||||
|
Error *WaitExitError `json:"Error,omitempty"` |
||||||
|
|
||||||
|
// Exit code of the container
|
||||||
|
// Required: true
|
||||||
|
StatusCode int64 `json:"StatusCode"` |
||||||
|
} |
@ -0,0 +1,14 @@ |
|||||||
|
package types // import "github.com/docker/docker/api/types"
|
||||||
|
|
||||||
|
import "github.com/docker/docker/api/types/volume" |
||||||
|
|
||||||
|
// Volume volume
|
||||||
|
//
|
||||||
|
// Deprecated: use github.com/docker/docker/api/types/volume.Volume
|
||||||
|
type Volume = volume.Volume |
||||||
|
|
||||||
|
// VolumeUsageData Usage details about the volume. This information is used by the
|
||||||
|
// `GET /system/df` endpoint, and omitted in other endpoints.
|
||||||
|
//
|
||||||
|
// Deprecated: use github.com/docker/docker/api/types/volume.UsageData
|
||||||
|
type VolumeUsageData = volume.UsageData |
@ -1,12 +0,0 @@ |
|||||||
package time // import "github.com/docker/docker/api/types/time"
|
|
||||||
|
|
||||||
import ( |
|
||||||
"strconv" |
|
||||||
"time" |
|
||||||
) |
|
||||||
|
|
||||||
// DurationToSecondsString converts the specified duration to the number
|
|
||||||
// seconds it represents, formatted as a string.
|
|
||||||
func DurationToSecondsString(duration time.Duration) string { |
|
||||||
return strconv.FormatFloat(duration.Seconds(), 'f', 0, 64) |
|
||||||
} |
|
@ -0,0 +1,420 @@ |
|||||||
|
package volume |
||||||
|
|
||||||
|
import ( |
||||||
|
"github.com/docker/docker/api/types/swarm" |
||||||
|
) |
||||||
|
|
||||||
|
// ClusterVolume contains options and information specific to, and only present
|
||||||
|
// on, Swarm CSI cluster volumes.
|
||||||
|
type ClusterVolume struct { |
||||||
|
// ID is the Swarm ID of the volume. Because cluster volumes are Swarm
|
||||||
|
// objects, they have an ID, unlike non-cluster volumes, which only have a
|
||||||
|
// Name. This ID can be used to refer to the cluster volume.
|
||||||
|
ID string |
||||||
|
|
||||||
|
// Meta is the swarm metadata about this volume.
|
||||||
|
swarm.Meta |
||||||
|
|
||||||
|
// Spec is the cluster-specific options from which this volume is derived.
|
||||||
|
Spec ClusterVolumeSpec |
||||||
|
|
||||||
|
// PublishStatus contains the status of the volume as it pertains to its
|
||||||
|
// publishing on Nodes.
|
||||||
|
PublishStatus []*PublishStatus `json:",omitempty"` |
||||||
|
|
||||||
|
// Info is information about the global status of the volume.
|
||||||
|
Info *Info `json:",omitempty"` |
||||||
|
} |
||||||
|
|
||||||
|
// ClusterVolumeSpec contains the spec used to create this volume.
|
||||||
|
type ClusterVolumeSpec struct { |
||||||
|
// Group defines the volume group of this volume. Volumes belonging to the
|
||||||
|
// same group can be referred to by group name when creating Services.
|
||||||
|
// Referring to a volume by group instructs swarm to treat volumes in that
|
||||||
|
// group interchangeably for the purpose of scheduling. Volumes with an
|
||||||
|
// empty string for a group technically all belong to the same, emptystring
|
||||||
|
// group.
|
||||||
|
Group string `json:",omitempty"` |
||||||
|
|
||||||
|
// AccessMode defines how the volume is used by tasks.
|
||||||
|
AccessMode *AccessMode `json:",omitempty"` |
||||||
|
|
||||||
|
// AccessibilityRequirements specifies where in the cluster a volume must
|
||||||
|
// be accessible from.
|
||||||
|
//
|
||||||
|
// This field must be empty if the plugin does not support
|
||||||
|
// VOLUME_ACCESSIBILITY_CONSTRAINTS capabilities. If it is present but the
|
||||||
|
// plugin does not support it, volume will not be created.
|
||||||
|
//
|
||||||
|
// If AccessibilityRequirements is empty, but the plugin does support
|
||||||
|
// VOLUME_ACCESSIBILITY_CONSTRAINTS, then Swarmkit will assume the entire
|
||||||
|
// cluster is a valid target for the volume.
|
||||||
|
AccessibilityRequirements *TopologyRequirement `json:",omitempty"` |
||||||
|
|
||||||
|
// CapacityRange defines the desired capacity that the volume should be
|
||||||
|
// created with. If nil, the plugin will decide the capacity.
|
||||||
|
CapacityRange *CapacityRange `json:",omitempty"` |
||||||
|
|
||||||
|
// Secrets defines Swarm Secrets that are passed to the CSI storage plugin
|
||||||
|
// when operating on this volume.
|
||||||
|
Secrets []Secret `json:",omitempty"` |
||||||
|
|
||||||
|
// Availability is the Volume's desired availability. Analogous to Node
|
||||||
|
// Availability, this allows the user to take volumes offline in order to
|
||||||
|
// update or delete them.
|
||||||
|
Availability Availability `json:",omitempty"` |
||||||
|
} |
||||||
|
|
||||||
|
// Availability specifies the availability of the volume.
|
||||||
|
type Availability string |
||||||
|
|
||||||
|
const ( |
||||||
|
// AvailabilityActive indicates that the volume is active and fully
|
||||||
|
// schedulable on the cluster.
|
||||||
|
AvailabilityActive Availability = "active" |
||||||
|
|
||||||
|
// AvailabilityPause indicates that no new workloads should use the
|
||||||
|
// volume, but existing workloads can continue to use it.
|
||||||
|
AvailabilityPause Availability = "pause" |
||||||
|
|
||||||
|
// AvailabilityDrain indicates that all workloads using this volume
|
||||||
|
// should be rescheduled, and the volume unpublished from all nodes.
|
||||||
|
AvailabilityDrain Availability = "drain" |
||||||
|
) |
||||||
|
|
||||||
|
// AccessMode defines the access mode of a volume.
|
||||||
|
type AccessMode struct { |
||||||
|
// Scope defines the set of nodes this volume can be used on at one time.
|
||||||
|
Scope Scope `json:",omitempty"` |
||||||
|
|
||||||
|
// Sharing defines the number and way that different tasks can use this
|
||||||
|
// volume at one time.
|
||||||
|
Sharing SharingMode `json:",omitempty"` |
||||||
|
|
||||||
|
// MountVolume defines options for using this volume as a Mount-type
|
||||||
|
// volume.
|
||||||
|
//
|
||||||
|
// Either BlockVolume or MountVolume, but not both, must be present.
|
||||||
|
MountVolume *TypeMount `json:",omitempty"` |
||||||
|
|
||||||
|
// BlockVolume defines options for using this volume as a Block-type
|
||||||
|
// volume.
|
||||||
|
//
|
||||||
|
// Either BlockVolume or MountVolume, but not both, must be present.
|
||||||
|
BlockVolume *TypeBlock `json:",omitempty"` |
||||||
|
} |
||||||
|
|
||||||
|
// Scope defines the Scope of a Cluster Volume. This is how many nodes a
|
||||||
|
// Volume can be accessed simultaneously on.
|
||||||
|
type Scope string |
||||||
|
|
||||||
|
const ( |
||||||
|
// ScopeSingleNode indicates the volume can be used on one node at a
|
||||||
|
// time.
|
||||||
|
ScopeSingleNode Scope = "single" |
||||||
|
|
||||||
|
// ScopeMultiNode indicates the volume can be used on many nodes at
|
||||||
|
// the same time.
|
||||||
|
ScopeMultiNode Scope = "multi" |
||||||
|
) |
||||||
|
|
||||||
|
// SharingMode defines the Sharing of a Cluster Volume. This is how Tasks using a
|
||||||
|
// Volume at the same time can use it.
|
||||||
|
type SharingMode string |
||||||
|
|
||||||
|
const ( |
||||||
|
// SharingNone indicates that only one Task may use the Volume at a
|
||||||
|
// time.
|
||||||
|
SharingNone SharingMode = "none" |
||||||
|
|
||||||
|
// SharingReadOnly indicates that the Volume may be shared by any
|
||||||
|
// number of Tasks, but they must be read-only.
|
||||||
|
SharingReadOnly SharingMode = "readonly" |
||||||
|
|
||||||
|
// SharingOneWriter indicates that the Volume may be shared by any
|
||||||
|
// number of Tasks, but all after the first must be read-only.
|
||||||
|
SharingOneWriter SharingMode = "onewriter" |
||||||
|
|
||||||
|
// SharingAll means that the Volume may be shared by any number of
|
||||||
|
// Tasks, as readers or writers.
|
||||||
|
SharingAll SharingMode = "all" |
||||||
|
) |
||||||
|
|
||||||
|
// TypeBlock defines options for using a volume as a block-type volume.
|
||||||
|
//
|
||||||
|
// Intentionally empty.
|
||||||
|
type TypeBlock struct{} |
||||||
|
|
||||||
|
// TypeMount contains options for using a volume as a Mount-type
|
||||||
|
// volume.
|
||||||
|
type TypeMount struct { |
||||||
|
// FsType specifies the filesystem type for the mount volume. Optional.
|
||||||
|
FsType string `json:",omitempty"` |
||||||
|
|
||||||
|
// MountFlags defines flags to pass when mounting the volume. Optional.
|
||||||
|
MountFlags []string `json:",omitempty"` |
||||||
|
} |
||||||
|
|
||||||
|
// TopologyRequirement expresses the user's requirements for a volume's
|
||||||
|
// accessible topology.
|
||||||
|
type TopologyRequirement struct { |
||||||
|
// Requisite specifies a list of Topologies, at least one of which the
|
||||||
|
// volume must be accessible from.
|
||||||
|
//
|
||||||
|
// Taken verbatim from the CSI Spec:
|
||||||
|
//
|
||||||
|
// Specifies the list of topologies the provisioned volume MUST be
|
||||||
|
// accessible from.
|
||||||
|
// This field is OPTIONAL. If TopologyRequirement is specified either
|
||||||
|
// requisite or preferred or both MUST be specified.
|
||||||
|
//
|
||||||
|
// If requisite is specified, the provisioned volume MUST be
|
||||||
|
// accessible from at least one of the requisite topologies.
|
||||||
|
//
|
||||||
|
// Given
|
||||||
|
// x = number of topologies provisioned volume is accessible from
|
||||||
|
// n = number of requisite topologies
|
||||||
|
// The CO MUST ensure n >= 1. The SP MUST ensure x >= 1
|
||||||
|
// If x==n, then the SP MUST make the provisioned volume available to
|
||||||
|
// all topologies from the list of requisite topologies. If it is
|
||||||
|
// unable to do so, the SP MUST fail the CreateVolume call.
|
||||||
|
// For example, if a volume should be accessible from a single zone,
|
||||||
|
// and requisite =
|
||||||
|
// {"region": "R1", "zone": "Z2"}
|
||||||
|
// then the provisioned volume MUST be accessible from the "region"
|
||||||
|
// "R1" and the "zone" "Z2".
|
||||||
|
// Similarly, if a volume should be accessible from two zones, and
|
||||||
|
// requisite =
|
||||||
|
// {"region": "R1", "zone": "Z2"},
|
||||||
|
// {"region": "R1", "zone": "Z3"}
|
||||||
|
// then the provisioned volume MUST be accessible from the "region"
|
||||||
|
// "R1" and both "zone" "Z2" and "zone" "Z3".
|
||||||
|
//
|
||||||
|
// If x<n, then the SP SHALL choose x unique topologies from the list
|
||||||
|
// of requisite topologies. If it is unable to do so, the SP MUST fail
|
||||||
|
// the CreateVolume call.
|
||||||
|
// For example, if a volume should be accessible from a single zone,
|
||||||
|
// and requisite =
|
||||||
|
// {"region": "R1", "zone": "Z2"},
|
||||||
|
// {"region": "R1", "zone": "Z3"}
|
||||||
|
// then the SP may choose to make the provisioned volume available in
|
||||||
|
// either the "zone" "Z2" or the "zone" "Z3" in the "region" "R1".
|
||||||
|
// Similarly, if a volume should be accessible from two zones, and
|
||||||
|
// requisite =
|
||||||
|
// {"region": "R1", "zone": "Z2"},
|
||||||
|
// {"region": "R1", "zone": "Z3"},
|
||||||
|
// {"region": "R1", "zone": "Z4"}
|
||||||
|
// then the provisioned volume MUST be accessible from any combination
|
||||||
|
// of two unique topologies: e.g. "R1/Z2" and "R1/Z3", or "R1/Z2" and
|
||||||
|
// "R1/Z4", or "R1/Z3" and "R1/Z4".
|
||||||
|
//
|
||||||
|
// If x>n, then the SP MUST make the provisioned volume available from
|
||||||
|
// all topologies from the list of requisite topologies and MAY choose
|
||||||
|
// the remaining x-n unique topologies from the list of all possible
|
||||||
|
// topologies. If it is unable to do so, the SP MUST fail the
|
||||||
|
// CreateVolume call.
|
||||||
|
// For example, if a volume should be accessible from two zones, and
|
||||||
|
// requisite =
|
||||||
|
// {"region": "R1", "zone": "Z2"}
|
||||||
|
// then the provisioned volume MUST be accessible from the "region"
|
||||||
|
// "R1" and the "zone" "Z2" and the SP may select the second zone
|
||||||
|
// independently, e.g. "R1/Z4".
|
||||||
|
Requisite []Topology `json:",omitempty"` |
||||||
|
|
||||||
|
// Preferred is a list of Topologies that the volume should attempt to be
|
||||||
|
// provisioned in.
|
||||||
|
//
|
||||||
|
// Taken from the CSI spec:
|
||||||
|
//
|
||||||
|
// Specifies the list of topologies the CO would prefer the volume to
|
||||||
|
// be provisioned in.
|
||||||
|
//
|
||||||
|
// This field is OPTIONAL. If TopologyRequirement is specified either
|
||||||
|
// requisite or preferred or both MUST be specified.
|
||||||
|
//
|
||||||
|
// An SP MUST attempt to make the provisioned volume available using
|
||||||
|
// the preferred topologies in order from first to last.
|
||||||
|
//
|
||||||
|
// If requisite is specified, all topologies in preferred list MUST
|
||||||
|
// also be present in the list of requisite topologies.
|
||||||
|
//
|
||||||
|
// If the SP is unable to to make the provisioned volume available
|
||||||
|
// from any of the preferred topologies, the SP MAY choose a topology
|
||||||
|
// from the list of requisite topologies.
|
||||||
|
// If the list of requisite topologies is not specified, then the SP
|
||||||
|
// MAY choose from the list of all possible topologies.
|
||||||
|
// If the list of requisite topologies is specified and the SP is
|
||||||
|
// unable to to make the provisioned volume available from any of the
|
||||||
|
// requisite topologies it MUST fail the CreateVolume call.
|
||||||
|
//
|
||||||
|
// Example 1:
|
||||||
|
// Given a volume should be accessible from a single zone, and
|
||||||
|
// requisite =
|
||||||
|
// {"region": "R1", "zone": "Z2"},
|
||||||
|
// {"region": "R1", "zone": "Z3"}
|
||||||
|
// preferred =
|
||||||
|
// {"region": "R1", "zone": "Z3"}
|
||||||
|
// then the the SP SHOULD first attempt to make the provisioned volume
|
||||||
|
// available from "zone" "Z3" in the "region" "R1" and fall back to
|
||||||
|
// "zone" "Z2" in the "region" "R1" if that is not possible.
|
||||||
|
//
|
||||||
|
// Example 2:
|
||||||
|
// Given a volume should be accessible from a single zone, and
|
||||||
|
// requisite =
|
||||||
|
// {"region": "R1", "zone": "Z2"},
|
||||||
|
// {"region": "R1", "zone": "Z3"},
|
||||||
|
// {"region": "R1", "zone": "Z4"},
|
||||||
|
// {"region": "R1", "zone": "Z5"}
|
||||||
|
// preferred =
|
||||||
|
// {"region": "R1", "zone": "Z4"},
|
||||||
|
// {"region": "R1", "zone": "Z2"}
|
||||||
|
// then the the SP SHOULD first attempt to make the provisioned volume
|
||||||
|
// accessible from "zone" "Z4" in the "region" "R1" and fall back to
|
||||||
|
// "zone" "Z2" in the "region" "R1" if that is not possible. If that
|
||||||
|
// is not possible, the SP may choose between either the "zone"
|
||||||
|
// "Z3" or "Z5" in the "region" "R1".
|
||||||
|
//
|
||||||
|
// Example 3:
|
||||||
|
// Given a volume should be accessible from TWO zones (because an
|
||||||
|
// opaque parameter in CreateVolumeRequest, for example, specifies
|
||||||
|
// the volume is accessible from two zones, aka synchronously
|
||||||
|
// replicated), and
|
||||||
|
// requisite =
|
||||||
|
// {"region": "R1", "zone": "Z2"},
|
||||||
|
// {"region": "R1", "zone": "Z3"},
|
||||||
|
// {"region": "R1", "zone": "Z4"},
|
||||||
|
// {"region": "R1", "zone": "Z5"}
|
||||||
|
// preferred =
|
||||||
|
// {"region": "R1", "zone": "Z5"},
|
||||||
|
// {"region": "R1", "zone": "Z3"}
|
||||||
|
// then the the SP SHOULD first attempt to make the provisioned volume
|
||||||
|
// accessible from the combination of the two "zones" "Z5" and "Z3" in
|
||||||
|
// the "region" "R1". If that's not possible, it should fall back to
|
||||||
|
// a combination of "Z5" and other possibilities from the list of
|
||||||
|
// requisite. If that's not possible, it should fall back to a
|
||||||
|
// combination of "Z3" and other possibilities from the list of
|
||||||
|
// requisite. If that's not possible, it should fall back to a
|
||||||
|
// combination of other possibilities from the list of requisite.
|
||||||
|
Preferred []Topology `json:",omitempty"` |
||||||
|
} |
||||||
|
|
||||||
|
// Topology is a map of topological domains to topological segments.
|
||||||
|
//
|
||||||
|
// This description is taken verbatim from the CSI Spec:
|
||||||
|
//
|
||||||
|
// A topological domain is a sub-division of a cluster, like "region",
|
||||||
|
// "zone", "rack", etc.
|
||||||
|
// A topological segment is a specific instance of a topological domain,
|
||||||
|
// like "zone3", "rack3", etc.
|
||||||
|
// For example {"com.company/zone": "Z1", "com.company/rack": "R3"}
|
||||||
|
// Valid keys have two segments: an OPTIONAL prefix and name, separated
|
||||||
|
// by a slash (/), for example: "com.company.example/zone".
|
||||||
|
// The key name segment is REQUIRED. The prefix is OPTIONAL.
|
||||||
|
// The key name MUST be 63 characters or less, begin and end with an
|
||||||
|
// alphanumeric character ([a-z0-9A-Z]), and contain only dashes (-),
|
||||||
|
// underscores (_), dots (.), or alphanumerics in between, for example
|
||||||
|
// "zone".
|
||||||
|
// The key prefix MUST be 63 characters or less, begin and end with a
|
||||||
|
// lower-case alphanumeric character ([a-z0-9]), contain only
|
||||||
|
// dashes (-), dots (.), or lower-case alphanumerics in between, and
|
||||||
|
// follow domain name notation format
|
||||||
|
// (https://tools.ietf.org/html/rfc1035#section-2.3.1).
|
||||||
|
// The key prefix SHOULD include the plugin's host company name and/or
|
||||||
|
// the plugin name, to minimize the possibility of collisions with keys
|
||||||
|
// from other plugins.
|
||||||
|
// If a key prefix is specified, it MUST be identical across all
|
||||||
|
// topology keys returned by the SP (across all RPCs).
|
||||||
|
// Keys MUST be case-insensitive. Meaning the keys "Zone" and "zone"
|
||||||
|
// MUST not both exist.
|
||||||
|
// Each value (topological segment) MUST contain 1 or more strings.
|
||||||
|
// Each string MUST be 63 characters or less and begin and end with an
|
||||||
|
// alphanumeric character with '-', '_', '.', or alphanumerics in
|
||||||
|
// between.
|
||||||
|
type Topology struct { |
||||||
|
Segments map[string]string `json:",omitempty"` |
||||||
|
} |
||||||
|
|
||||||
|
// CapacityRange describes the minimum and maximum capacity a volume should be
|
||||||
|
// created with
|
||||||
|
type CapacityRange struct { |
||||||
|
// RequiredBytes specifies that a volume must be at least this big. The
|
||||||
|
// value of 0 indicates an unspecified minimum.
|
||||||
|
RequiredBytes int64 |
||||||
|
|
||||||
|
// LimitBytes specifies that a volume must not be bigger than this. The
|
||||||
|
// value of 0 indicates an unspecified maximum
|
||||||
|
LimitBytes int64 |
||||||
|
} |
||||||
|
|
||||||
|
// Secret represents a Swarm Secret value that must be passed to the CSI
|
||||||
|
// storage plugin when operating on this Volume. It represents one key-value
|
||||||
|
// pair of possibly many.
|
||||||
|
type Secret struct { |
||||||
|
// Key is the name of the key of the key-value pair passed to the plugin.
|
||||||
|
Key string |
||||||
|
|
||||||
|
// Secret is the swarm Secret object from which to read data. This can be a
|
||||||
|
// Secret name or ID. The Secret data is retrieved by Swarm and used as the
|
||||||
|
// value of the key-value pair passed to the plugin.
|
||||||
|
Secret string |
||||||
|
} |
||||||
|
|
||||||
|
// PublishState represents the state of a Volume as it pertains to its
|
||||||
|
// use on a particular Node.
|
||||||
|
type PublishState string |
||||||
|
|
||||||
|
const ( |
||||||
|
// StatePending indicates that the volume should be published on
|
||||||
|
// this node, but the call to ControllerPublishVolume has not been
|
||||||
|
// successfully completed yet and the result recorded by swarmkit.
|
||||||
|
StatePending PublishState = "pending-publish" |
||||||
|
|
||||||
|
// StatePublished means the volume is published successfully to the node.
|
||||||
|
StatePublished PublishState = "published" |
||||||
|
|
||||||
|
// StatePendingNodeUnpublish indicates that the Volume should be
|
||||||
|
// unpublished on the Node, and we're waiting for confirmation that it has
|
||||||
|
// done so. After the Node has confirmed that the Volume has been
|
||||||
|
// unpublished, the state will move to StatePendingUnpublish.
|
||||||
|
StatePendingNodeUnpublish PublishState = "pending-node-unpublish" |
||||||
|
|
||||||
|
// StatePendingUnpublish means the volume is still published to the node
|
||||||
|
// by the controller, awaiting the operation to unpublish it.
|
||||||
|
StatePendingUnpublish PublishState = "pending-controller-unpublish" |
||||||
|
) |
||||||
|
|
||||||
|
// PublishStatus represents the status of the volume as published to an
|
||||||
|
// individual node
|
||||||
|
type PublishStatus struct { |
||||||
|
// NodeID is the ID of the swarm node this Volume is published to.
|
||||||
|
NodeID string `json:",omitempty"` |
||||||
|
|
||||||
|
// State is the publish state of the volume.
|
||||||
|
State PublishState `json:",omitempty"` |
||||||
|
|
||||||
|
// PublishContext is the PublishContext returned by the CSI plugin when
|
||||||
|
// a volume is published.
|
||||||
|
PublishContext map[string]string `json:",omitempty"` |
||||||
|
} |
||||||
|
|
||||||
|
// Info contains information about the Volume as a whole as provided by
|
||||||
|
// the CSI storage plugin.
|
||||||
|
type Info struct { |
||||||
|
// CapacityBytes is the capacity of the volume in bytes. A value of 0
|
||||||
|
// indicates that the capacity is unknown.
|
||||||
|
CapacityBytes int64 `json:",omitempty"` |
||||||
|
|
||||||
|
// VolumeContext is the context originating from the CSI storage plugin
|
||||||
|
// when the Volume is created.
|
||||||
|
VolumeContext map[string]string `json:",omitempty"` |
||||||
|
|
||||||
|
// VolumeID is the ID of the Volume as seen by the CSI storage plugin. This
|
||||||
|
// is distinct from the Volume's Swarm ID, which is the ID used by all of
|
||||||
|
// the Docker Engine to refer to the Volume. If this field is blank, then
|
||||||
|
// the Volume has not been successfully created yet.
|
||||||
|
VolumeID string `json:",omitempty"` |
||||||
|
|
||||||
|
// AccessibleTopolgoy is the topology this volume is actually accessible
|
||||||
|
// from.
|
||||||
|
AccessibleTopology []Topology `json:",omitempty"` |
||||||
|
} |
@ -0,0 +1,29 @@ |
|||||||
|
package volume |
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
// CreateOptions VolumeConfig
|
||||||
|
//
|
||||||
|
// Volume configuration
|
||||||
|
// swagger:model CreateOptions
|
||||||
|
type CreateOptions struct { |
||||||
|
|
||||||
|
// cluster volume spec
|
||||||
|
ClusterVolumeSpec *ClusterVolumeSpec `json:"ClusterVolumeSpec,omitempty"` |
||||||
|
|
||||||
|
// Name of the volume driver to use.
|
||||||
|
Driver string `json:"Driver,omitempty"` |
||||||
|
|
||||||
|
// A mapping of driver options and values. These options are
|
||||||
|
// passed directly to the driver and are driver specific.
|
||||||
|
//
|
||||||
|
DriverOpts map[string]string `json:"DriverOpts,omitempty"` |
||||||
|
|
||||||
|
// User-defined key/value metadata.
|
||||||
|
Labels map[string]string `json:"Labels,omitempty"` |
||||||
|
|
||||||
|
// The new volume's name. If not specified, Docker generates a name.
|
||||||
|
//
|
||||||
|
Name string `json:"Name,omitempty"` |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
package volume // import "github.com/docker/docker/api/types/volume"
|
||||||
|
|
||||||
|
// VolumeCreateBody Volume configuration
|
||||||
|
//
|
||||||
|
// Deprecated: use CreateOptions
|
||||||
|
type VolumeCreateBody = CreateOptions |
||||||
|
|
||||||
|
// VolumeListOKBody Volume list response
|
||||||
|
//
|
||||||
|
// Deprecated: use ListResponse
|
||||||
|
type VolumeListOKBody = ListResponse |
@ -0,0 +1,18 @@ |
|||||||
|
package volume |
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
// ListResponse VolumeListResponse
|
||||||
|
//
|
||||||
|
// Volume list response
|
||||||
|
// swagger:model ListResponse
|
||||||
|
type ListResponse struct { |
||||||
|
|
||||||
|
// List of volumes
|
||||||
|
Volumes []*Volume `json:"Volumes"` |
||||||
|
|
||||||
|
// Warnings that occurred when fetching the list of volumes.
|
||||||
|
//
|
||||||
|
Warnings []string `json:"Warnings"` |
||||||
|
} |
@ -0,0 +1,8 @@ |
|||||||
|
package volume // import "github.com/docker/docker/api/types/volume"
|
||||||
|
|
||||||
|
import "github.com/docker/docker/api/types/filters" |
||||||
|
|
||||||
|
// ListOptions holds parameters to list volumes.
|
||||||
|
type ListOptions struct { |
||||||
|
Filters filters.Args |
||||||
|
} |
@ -1,31 +0,0 @@ |
|||||||
package volume // import "github.com/docker/docker/api/types/volume"
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// Code generated by `swagger generate operation`. DO NOT EDIT.
|
|
||||||
//
|
|
||||||
// See hack/generate-swagger-api.sh
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// VolumeCreateBody Volume configuration
|
|
||||||
// swagger:model VolumeCreateBody
|
|
||||||
type VolumeCreateBody struct { |
|
||||||
|
|
||||||
// Name of the volume driver to use.
|
|
||||||
// Required: true
|
|
||||||
Driver string `json:"Driver"` |
|
||||||
|
|
||||||
// A mapping of driver options and values. These options are
|
|
||||||
// passed directly to the driver and are driver specific.
|
|
||||||
//
|
|
||||||
// Required: true
|
|
||||||
DriverOpts map[string]string `json:"DriverOpts"` |
|
||||||
|
|
||||||
// User-defined key/value metadata.
|
|
||||||
// Required: true
|
|
||||||
Labels map[string]string `json:"Labels"` |
|
||||||
|
|
||||||
// The new volume's name. If not specified, Docker generates a name.
|
|
||||||
//
|
|
||||||
// Required: true
|
|
||||||
Name string `json:"Name"` |
|
||||||
} |
|
@ -1,23 +0,0 @@ |
|||||||
package volume // import "github.com/docker/docker/api/types/volume"
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// Code generated by `swagger generate operation`. DO NOT EDIT.
|
|
||||||
//
|
|
||||||
// See hack/generate-swagger-api.sh
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
import "github.com/docker/docker/api/types" |
|
||||||
|
|
||||||
// VolumeListOKBody Volume list response
|
|
||||||
// swagger:model VolumeListOKBody
|
|
||||||
type VolumeListOKBody struct { |
|
||||||
|
|
||||||
// List of volumes
|
|
||||||
// Required: true
|
|
||||||
Volumes []*types.Volume `json:"Volumes"` |
|
||||||
|
|
||||||
// Warnings that occurred when fetching the list of volumes.
|
|
||||||
//
|
|
||||||
// Required: true
|
|
||||||
Warnings []string `json:"Warnings"` |
|
||||||
} |
|
@ -0,0 +1,7 @@ |
|||||||
|
package volume // import "github.com/docker/docker/api/types/volume"
|
||||||
|
|
||||||
|
// UpdateOptions is configuration to update a Volume with.
|
||||||
|
type UpdateOptions struct { |
||||||
|
// Spec is the ClusterVolumeSpec to update the volume to.
|
||||||
|
Spec *ClusterVolumeSpec `json:"Spec,omitempty"` |
||||||
|
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue