VMware vSphere Integrated Containers provider (#206)
* Add Virtual Kubelet provider for VIC Initial virtual kubelet provider for VMware VIC. This provider currently handles creating and starting of a pod VM via the VIC portlayer and persona server. Image store handling via the VIC persona server. This provider currently requires the feature/wolfpack branch of VIC. * Added pod stop and delete. Also added node capacity. Added the ability to stop and delete pod VMs via VIC. Also retrieve node capacity information from the VCH. * Cleanup and readme file Some file clean up and added a Readme.md markdown file for the VIC provider. * Cleaned up errors, added function comments, moved operation code 1. Cleaned up error handling. Set standard for creating errors. 2. Added method prototype comments for all interface functions. 3. Moved PodCreator, PodStarter, PodStopper, and PodDeleter to a new folder. * Add mocking code and unit tests for podcache, podcreator, and podstarter Used the unit test framework used in VIC to handle assertions in the provider's unit test. Mocking code generated using OSS project mockery, which is compatible with the testify assertion framework. * Vendored packages for the VIC provider Requires feature/wolfpack branch of VIC and a few specific commit sha of projects used within VIC. * Implementation of POD Stopper and Deleter unit tests (#4) * Updated files for initial PR
This commit is contained in:
16
vendor/github.com/opencontainers/runtime-spec/schema/Makefile
generated
vendored
Normal file
16
vendor/github.com/opencontainers/runtime-spec/schema/Makefile
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
default: help
|
||||
|
||||
help:
|
||||
@echo "Usage: make <target>"
|
||||
@echo
|
||||
@echo " * 'fmt' - format the json with indentation"
|
||||
@echo " * 'validate' - build the validation tool"
|
||||
|
||||
fmt:
|
||||
for i in *.json ; do jq --indent 4 -M . "$${i}" > xx && cat xx > "$${i}" && rm xx ; done
|
||||
|
||||
validate: validate.go
|
||||
go get -d ./...
|
||||
go build ./validate.go
|
||||
|
||||
41
vendor/github.com/opencontainers/runtime-spec/schema/README.md
generated
vendored
Normal file
41
vendor/github.com/opencontainers/runtime-spec/schema/README.md
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
# JSON schema
|
||||
|
||||
## Overview
|
||||
|
||||
This directory contains the [JSON Schema](http://json-schema.org/) for validating JSON covered by this specification.
|
||||
|
||||
The layout of the files is as follows:
|
||||
|
||||
* [config-schema.json](config-schema.json) - the primary entrypoint for the [configuration](../config.md) schema
|
||||
* [config-linux.json](config-linux.json) - the [Linux-specific configuration sub-structure](../config-linux.md)
|
||||
* [config-solaris.json](config-solaris.json) - the [Solaris-specific configuration sub-structure](../config-solaris.md)
|
||||
* [config-windows.json](config-windows.json) - the [Windows-specific configuration sub-structure](../config-windows.md)
|
||||
* [state-schema.json](state-schema.json) - the primary entrypoint for the [state JSON](../runtime.md#state) schema
|
||||
* [defs.json](defs.json) - definitions for general types
|
||||
* [defs-linux.json](defs-linux.json) - definitions for Linux-specific types
|
||||
* [validate.go](validate.go) - validation utility source code
|
||||
|
||||
|
||||
## Utility
|
||||
|
||||
There is also included a simple utility for facilitating validation.
|
||||
To build it:
|
||||
|
||||
```bash
|
||||
export GOPATH=`mktemp -d`
|
||||
go get -d ./...
|
||||
go build ./validate.go
|
||||
rm -rf $GOPATH
|
||||
```
|
||||
|
||||
Or you can just use make command to create the utility:
|
||||
|
||||
```bash
|
||||
make validate
|
||||
```
|
||||
|
||||
Then use it like:
|
||||
|
||||
```bash
|
||||
./validate config-schema.json <yourpath>/config.json
|
||||
```
|
||||
355
vendor/github.com/opencontainers/runtime-spec/schema/config-linux.json
generated
vendored
Normal file
355
vendor/github.com/opencontainers/runtime-spec/schema/config-linux.json
generated
vendored
Normal file
@@ -0,0 +1,355 @@
|
||||
{
|
||||
"linux": {
|
||||
"description": "Linux platform-specific configurations",
|
||||
"id": "https://opencontainers.org/schema/bundle/linux",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"devices": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/devices",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "defs-linux.json#/definitions/Device"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"uidMappings": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/uidMappings",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "defs.json#/definitions/IDMapping"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"gidMappings": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/gidMappings",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "defs.json#/definitions/IDMapping"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"namespaces": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/namespaces",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "defs-linux.json#/definitions/NamespaceReference"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"resources": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/resources",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"devices": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/devices",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "defs-linux.json#/definitions/DeviceCgroup"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"oomScoreAdj": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/oomScoreAdj",
|
||||
"type": "integer",
|
||||
"minimum": -1000,
|
||||
"maximum": 1000
|
||||
},
|
||||
"pids": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/pids",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"limit": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/pids/limit",
|
||||
"$ref": "defs.json#/definitions/int64"
|
||||
}
|
||||
}
|
||||
},
|
||||
"blockIO": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/blockIO",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"blkioWeight": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/blockIO/blkioWeight",
|
||||
"$ref": "defs-linux.json#/definitions/blkioWeightPointer"
|
||||
},
|
||||
"blkioLeafWeight": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/blockIO/blkioLeafWeight",
|
||||
"$ref": "defs-linux.json#/definitions/blkioWeightPointer"
|
||||
},
|
||||
"blkioThrottleReadBpsDevice": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/blockIO/blkioThrottleReadBpsDevice",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": [
|
||||
{
|
||||
"$ref": "defs-linux.json#/definitions/blockIODeviceThrottlePointer"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"blkioThrottleWriteBpsDevice": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/blockIO/blkioThrottleWriteBpsDevice",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "defs-linux.json#/definitions/blockIODeviceThrottlePointer"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"blkioThrottleReadIopsDevice": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/blockIO/blkioThrottleReadIopsDevice",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "defs-linux.json#/definitions/blockIODeviceThrottlePointer"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"blkioThrottleWriteIopsDevice": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/blockIO/blkioThrottleWriteIopsDevice",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "defs-linux.json#/definitions/blockIODeviceThrottlePointer"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"blkioWeightDevice": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/blockIO/blkioWeightDevice",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "defs-linux.json#/definitions/blockIODeviceWeightPointer"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"cpu": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/cpu",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"cpus": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/cpus",
|
||||
"$ref": "defs.json#/definitions/stringPointer"
|
||||
},
|
||||
"mems": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/mems",
|
||||
"$ref": "defs.json#/definitions/stringPointer"
|
||||
},
|
||||
"period": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/period",
|
||||
"$ref": "defs.json#/definitions/uint64Pointer"
|
||||
},
|
||||
"quota": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/quota",
|
||||
"$ref": "defs.json#/definitions/uint64Pointer"
|
||||
},
|
||||
"realtimePeriod": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/realtimePeriod",
|
||||
"$ref": "defs.json#/definitions/uint64Pointer"
|
||||
},
|
||||
"realtimeRuntime": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/realtimeRuntime",
|
||||
"$ref": "defs.json#/definitions/uint64Pointer"
|
||||
},
|
||||
"shares": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/shares",
|
||||
"$ref": "defs.json#/definitions/uint64Pointer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"disableOOMKiller": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/disableOOMKiller",
|
||||
"type": "boolean"
|
||||
},
|
||||
"hugepageLimits": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/hugepageLimits",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"pageSize": {
|
||||
"type": "string"
|
||||
},
|
||||
"limit": {
|
||||
"$ref": "defs.json#/definitions/uint64"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"memory": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"kernel": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/kernel",
|
||||
"$ref": "defs.json#/definitions/uint64Pointer"
|
||||
},
|
||||
"limit": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/limit",
|
||||
"$ref": "defs.json#/definitions/uint64Pointer"
|
||||
},
|
||||
"reservation": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/reservation",
|
||||
"$ref": "defs.json#/definitions/uint64Pointer"
|
||||
},
|
||||
"swap": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/swap",
|
||||
"$ref": "defs.json#/definitions/uint64Pointer"
|
||||
},
|
||||
"swappiness": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/swappiness",
|
||||
"$ref": "defs.json#/definitions/uint64Pointer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"network": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/network",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"classID": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/network/classId",
|
||||
"$ref": "defs.json#/definitions/uint32"
|
||||
},
|
||||
"priorities": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/network/priorities",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "defs-linux.json#/definitions/NetworkInterfacePriority"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"cgroupsPath": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "null"
|
||||
},
|
||||
{
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"rootfsPropagation": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/rootfsPropagation",
|
||||
"type": "string"
|
||||
},
|
||||
"seccomp": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/seccomp",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"defaultAction": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/seccomp/defaultAction",
|
||||
"type": "string"
|
||||
},
|
||||
"architectures": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/seccomp/architectures",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "defs-linux.json#/definitions/SeccompArch"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"syscalls": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/seccomp/syscalls",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "defs-linux.json#/definitions/Syscall"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"sysctl": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/sysctl",
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "defs.json#/definitions/mapStringString"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"maskedPaths": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/maskedPaths",
|
||||
"$ref": "defs.json#/definitions/ArrayOfStrings"
|
||||
},
|
||||
"readonlyPaths": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/readonlyPaths",
|
||||
"$ref": "defs.json#/definitions/ArrayOfStrings"
|
||||
},
|
||||
"mountLabel": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/mountLabel",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
177
vendor/github.com/opencontainers/runtime-spec/schema/config-schema.json
generated
vendored
Normal file
177
vendor/github.com/opencontainers/runtime-spec/schema/config-schema.json
generated
vendored
Normal file
@@ -0,0 +1,177 @@
|
||||
{
|
||||
"description": "Open Container Runtime Specification Container Configuration Schema",
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"id": "https://opencontainers.org/schema/bundle",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"ociVersion": {
|
||||
"id": "https://opencontainers.org/schema/bundle/ociVersion",
|
||||
"$ref": "defs.json#/definitions/ociVersion"
|
||||
},
|
||||
"hooks": {
|
||||
"id": "https://opencontainers.org/schema/bundle/hooks",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"prestart": {
|
||||
"$ref": "defs.json#/definitions/ArrayOfHooks"
|
||||
},
|
||||
"poststart": {
|
||||
"$ref": "defs.json#/definitions/ArrayOfHooks"
|
||||
},
|
||||
"poststop": {
|
||||
"$ref": "defs.json#/definitions/ArrayOfHooks"
|
||||
}
|
||||
}
|
||||
},
|
||||
"annotations": {
|
||||
"$ref": "defs.json#/definitions/annotations"
|
||||
},
|
||||
"hostname": {
|
||||
"id": "https://opencontainers.org/schema/bundle/hostname",
|
||||
"type": "string"
|
||||
},
|
||||
"mounts": {
|
||||
"id": "https://opencontainers.org/schema/bundle/mounts",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "defs.json#/definitions/Mount"
|
||||
}
|
||||
},
|
||||
"platform": {
|
||||
"id": "https://opencontainers.org/schema/bundle/platform",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"arch",
|
||||
"os"
|
||||
],
|
||||
"properties": {
|
||||
"arch": {
|
||||
"id": "https://opencontainers.org/schema/bundle/platform/arch",
|
||||
"type": "string"
|
||||
},
|
||||
"os": {
|
||||
"id": "https://opencontainers.org/schema/bundle/platform/os",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"description": "Configures the container's root filesystem.",
|
||||
"id": "https://opencontainers.org/schema/bundle/root",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"path": {
|
||||
"id": "https://opencontainers.org/schema/bundle/root/path",
|
||||
"$ref": "defs.json#/definitions/FilePath"
|
||||
},
|
||||
"readonly": {
|
||||
"id": "https://opencontainers.org/schema/bundle/root/readonly",
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"process": {
|
||||
"id": "https://opencontainers.org/schema/bundle/process",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"cwd",
|
||||
"args"
|
||||
],
|
||||
"properties": {
|
||||
"args": {
|
||||
"id": "https://opencontainers.org/schema/bundle/process/args",
|
||||
"$ref": "defs.json#/definitions/ArrayOfStrings"
|
||||
},
|
||||
"cwd": {
|
||||
"id": "https://opencontainers.org/schema/bundle/process/cwd",
|
||||
"type": "string"
|
||||
},
|
||||
"env": {
|
||||
"id": "https://opencontainers.org/schema/bundle/process/env",
|
||||
"$ref": "defs.json#/definitions/Env"
|
||||
},
|
||||
"terminal": {
|
||||
"id": "https://opencontainers.org/schema/bundle/process/terminal",
|
||||
"type": "boolean"
|
||||
},
|
||||
"user": {
|
||||
"id": "https://opencontainers.org/schema/bundle/process/user",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"uid": {
|
||||
"id": "https://opencontainers.org/schema/bundle/process/user/uid",
|
||||
"$ref": "defs.json#/definitions/UID"
|
||||
},
|
||||
"gid": {
|
||||
"id": "https://opencontainers.org/schema/bundle/process/user/gid",
|
||||
"$ref": "defs.json#/definitions/GID"
|
||||
},
|
||||
"additionalGids": {
|
||||
"id": "https://opencontainers.org/schema/bundle/process/user/additionalGids",
|
||||
"$ref": "defs.json#/definitions/ArrayOfGIDs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"capabilities": {
|
||||
"id": "https://opencontainers.org/schema/bundle/process/linux/capabilities",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "defs-linux.json#/definitions/Capability"
|
||||
}
|
||||
},
|
||||
"apparmorProfile": {
|
||||
"id": "https://opencontainers.org/schema/bundle/process/linux/apparmorProfile",
|
||||
"type": "string"
|
||||
},
|
||||
"selinuxLabel": {
|
||||
"id": "https://opencontainers.org/schema/bundle/process/linux/selinuxLabel",
|
||||
"type": "string"
|
||||
},
|
||||
"noNewPrivileges": {
|
||||
"id": "https://opencontainers.org/schema/bundle/process/linux/noNewPrivileges",
|
||||
"type": "boolean"
|
||||
},
|
||||
"rlimits": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/rlimits",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/rlimits/0",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"hard": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/rlimits/0/hard",
|
||||
"$ref": "defs.json#/definitions/uint64"
|
||||
},
|
||||
"soft": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/rlimits/0/soft",
|
||||
"$ref": "defs.json#/definitions/uint64"
|
||||
},
|
||||
"type": {
|
||||
"id": "https://opencontainers.org/schema/bundle/linux/rlimits/0/type",
|
||||
"type": "string",
|
||||
"pattern": "^RLIMIT_[A-Z]+$"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"linux": {
|
||||
"$ref": "config-linux.json#/linux"
|
||||
},
|
||||
"solaris": {
|
||||
"$ref": "config-solaris.json#/solaris"
|
||||
},
|
||||
"windows": {
|
||||
"$ref": "config-windows.json#/windows"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"ociVersion",
|
||||
"platform",
|
||||
"process",
|
||||
"root",
|
||||
"mounts",
|
||||
"hooks"
|
||||
]
|
||||
}
|
||||
36
vendor/github.com/opencontainers/runtime-spec/schema/config-solaris.json
generated
vendored
Normal file
36
vendor/github.com/opencontainers/runtime-spec/schema/config-solaris.json
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"solaris": {
|
||||
"description": "Solaris platform-specific configurations",
|
||||
"id": "https://opencontainers.org/schema/bundle/solaris",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"milestone": {
|
||||
"id": "https://opencontainers.org/schema/bundle/solaris/milestone",
|
||||
"type": "string"
|
||||
},
|
||||
"limitpriv": {
|
||||
"id": "https://opencontainers.org/schema/bundle/solaris/limitpriv",
|
||||
"type": "string"
|
||||
},
|
||||
"maxShmMemory": {
|
||||
"id": "https://opencontainers.org/schema/bundle/solaris/maxShmMemory",
|
||||
"type": "string"
|
||||
},
|
||||
"cappedCPU": {
|
||||
"id": "https://opencontainers.org/schema/bundle/solaris/cappedCPU",
|
||||
"$ref": "defs.json#/definitions/mapStringString"
|
||||
},
|
||||
"cappedMemory": {
|
||||
"id": "https://opencontainers.org/schema/bundle/solaris/cappedMemory",
|
||||
"$ref": "defs.json#/definitions/mapStringString"
|
||||
},
|
||||
"anet": {
|
||||
"id": "https://opencontainers.org/schema/bundle/solaris/anet",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "defs.json#/definitions/mapStringString"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
75
vendor/github.com/opencontainers/runtime-spec/schema/config-windows.json
generated
vendored
Normal file
75
vendor/github.com/opencontainers/runtime-spec/schema/config-windows.json
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"windows": {
|
||||
"description": "Windows platform-specific configurations",
|
||||
"id": "https://opencontainers.org/schema/bundle/windows",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"resources": {
|
||||
"id": "https://opencontainers.org/schema/bundle/windows/resources",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"memory": {
|
||||
"id": "https://opencontainers.org/schema/bundle/windows/resources/memory",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"limit": {
|
||||
"id": "https://opencontainers.org/schema/bundle/windows/resources/memory/limit",
|
||||
"$ref": "defs.json#/definitions/uint64Pointer"
|
||||
},
|
||||
"reservation": {
|
||||
"id": "https://opencontainers.org/schema/bundle/windows/resources/memory/reservation",
|
||||
"$ref": "defs.json#/definitions/uint64Pointer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"cpu": {
|
||||
"id": "https://opencontainers.org/schema/bundle/windows/resources/cpu",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"count": {
|
||||
"id": "https://opencontainers.org/schema/bundle/windows/resources/cpu/count",
|
||||
"$ref": "defs.json#/definitions/uint64Pointer"
|
||||
},
|
||||
"shares": {
|
||||
"id": "https://opencontainers.org/schema/bundle/windows/resources/cpu/shares",
|
||||
"$ref": "defs-windows.json#/definitions/cpuSharesPointer"
|
||||
},
|
||||
"percent": {
|
||||
"id": "https://opencontainers.org/schema/bundle/windows/resources/cpu/percent",
|
||||
"$ref": "defs.json#/definitions/percentPointer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"storage": {
|
||||
"id": "https://opencontainers.org/schema/bundle/windows/resources/storage",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"iops": {
|
||||
"id": "https://opencontainers.org/schema/bundle/windows/resources/storage/iops",
|
||||
"$ref": "defs.json#/definitions/uint64Pointer"
|
||||
},
|
||||
"bps": {
|
||||
"id": "https://opencontainers.org/schema/bundle/windows/resources/storage/bps",
|
||||
"$ref": "defs.json#/definitions/uint64Pointer"
|
||||
},
|
||||
"sandboxSize": {
|
||||
"id": "https://opencontainers.org/schema/bundle/windows/resources/storage/sandboxSize",
|
||||
"$ref": "defs.json#/definitions/uint64Pointer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"network": {
|
||||
"id": "https://opencontainers.org/schema/bundle/windows/resources/network",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"egressBandwidth": {
|
||||
"id": "https://opencontainers.org/schema/bundle/windows/resources/network/egressBandwidth",
|
||||
"$ref": "defs.json#/definitions/uint64Pointer"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
289
vendor/github.com/opencontainers/runtime-spec/schema/defs-linux.json
generated
vendored
Normal file
289
vendor/github.com/opencontainers/runtime-spec/schema/defs-linux.json
generated
vendored
Normal file
@@ -0,0 +1,289 @@
|
||||
{
|
||||
"definitions": {
|
||||
"SeccompArch": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"SCMP_ARCH_X86",
|
||||
"SCMP_ARCH_X86_64",
|
||||
"SCMP_ARCH_X32",
|
||||
"SCMP_ARCH_ARM",
|
||||
"SCMP_ARCH_AARCH64",
|
||||
"SCMP_ARCH_MIPS",
|
||||
"SCMP_ARCH_MIPS64",
|
||||
"SCMP_ARCH_MIPS64N32",
|
||||
"SCMP_ARCH_MIPSEL",
|
||||
"SCMP_ARCH_MIPSEL64",
|
||||
"SCMP_ARCH_MIPSEL64N32",
|
||||
"SCMP_ARCH_PPC",
|
||||
"SCMP_ARCH_PPC64",
|
||||
"SCMP_ARCH_PPC64LE",
|
||||
"SCMP_ARCH_S390",
|
||||
"SCMP_ARCH_S390X"
|
||||
]
|
||||
},
|
||||
"SeccompAction": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"SCMP_ACT_KILL",
|
||||
"SCMP_ACT_TRAP",
|
||||
"SCMP_ACT_ERRNO",
|
||||
"SCMP_ACT_TRACE",
|
||||
"SCMP_ACT_ALLOW"
|
||||
]
|
||||
},
|
||||
"SeccompOperators": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"SCMP_CMP_NE",
|
||||
"SCMP_CMP_LT",
|
||||
"SCMP_CMP_LE",
|
||||
"SCMP_CMP_EQ",
|
||||
"SCMP_CMP_GE",
|
||||
"SCMP_CMP_GT",
|
||||
"SCMP_CMP_MASKED_EQ"
|
||||
]
|
||||
},
|
||||
"SyscallArg": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"index": {
|
||||
"$ref": "defs.json#/definitions/uint32"
|
||||
},
|
||||
"value": {
|
||||
"$ref": "defs.json#/definitions/uint64"
|
||||
},
|
||||
"valueTwo": {
|
||||
"$ref": "defs.json#/definitions/uint64"
|
||||
},
|
||||
"op": {
|
||||
"$ref": "#/definitions/SeccompOperators"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Syscall": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"action": {
|
||||
"$ref": "#/definitions/SeccompAction"
|
||||
},
|
||||
"args": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/SyscallArg"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Capability": {
|
||||
"description": "Linux process permissions",
|
||||
"type": "string",
|
||||
"pattern": "^CAP_([A-Z]|_)+$"
|
||||
},
|
||||
"Major": {
|
||||
"description": "major device number",
|
||||
"$ref": "defs.json#/definitions/uint16"
|
||||
},
|
||||
"Minor": {
|
||||
"description": "minor device number",
|
||||
"$ref": "defs.json#/definitions/uint16"
|
||||
},
|
||||
"FileMode": {
|
||||
"description": "File permissions mode (typically an octal value)",
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 512
|
||||
},
|
||||
"FilePermissions": {
|
||||
"type": "string"
|
||||
},
|
||||
"FileType": {
|
||||
"description": "Type of a block or special character device",
|
||||
"type": "string",
|
||||
"pattern": "^[cbup]$"
|
||||
},
|
||||
"Device": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"$ref": "#/definitions/FileType"
|
||||
},
|
||||
"permissions": {
|
||||
"$ref": "#/definitions/FilePermissions"
|
||||
},
|
||||
"path": {
|
||||
"$ref": "defs.json#/definitions/FilePath"
|
||||
},
|
||||
"fileMode": {
|
||||
"$ref": "#/definitions/FileMode"
|
||||
},
|
||||
"major": {
|
||||
"$ref": "#/definitions/Major"
|
||||
},
|
||||
"minor": {
|
||||
"$ref": "#/definitions/Minor"
|
||||
},
|
||||
"uid": {
|
||||
"$ref": "defs.json#/definitions/UID"
|
||||
},
|
||||
"gid": {
|
||||
"$ref": "defs.json#/definitions/GID"
|
||||
}
|
||||
}
|
||||
},
|
||||
"blkioWeight": {
|
||||
"type": "integer",
|
||||
"minimum": 10,
|
||||
"maximum": 1000
|
||||
},
|
||||
"blkioWeightPointer": {
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/definitions/blkioWeight"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"blockIODevice": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"major": {
|
||||
"$ref": "#/definitions/Major"
|
||||
},
|
||||
"minor": {
|
||||
"$ref": "#/definitions/Minor"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"major",
|
||||
"minor"
|
||||
]
|
||||
},
|
||||
"blockIODeviceWeight": {
|
||||
"type": "object",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/blockIODevice"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"weight": {
|
||||
"$ref": "#/definitions/blkioWeightPointer"
|
||||
},
|
||||
"leafWeight": {
|
||||
"$ref": "#/definitions/blkioWeightPointer"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"blockIODeviceWeightPointer": {
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/definitions/blockIODeviceWeight"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"blockIODeviceThrottle": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/blockIODevice"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"rate": {
|
||||
"$ref": "defs.json#/definitions/uint64Pointer"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"blockIODeviceThrottlePointer": {
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/definitions/blockIODeviceThrottle"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"DeviceCgroup": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"allow": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"type": {
|
||||
"$ref": "defs.json#/definitions/stringPointer"
|
||||
},
|
||||
"major": {
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/definitions/Major"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"minor": {
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/definitions/Minor"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"access": {
|
||||
"$ref": "defs.json#/definitions/stringPointer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"NetworkInterfacePriority": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"priority": {
|
||||
"$ref": "defs.json#/definitions/uint32"
|
||||
}
|
||||
}
|
||||
},
|
||||
"NamespaceType": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"mount",
|
||||
"pid",
|
||||
"network",
|
||||
"uts",
|
||||
"ipc",
|
||||
"user",
|
||||
"cgroup"
|
||||
]
|
||||
},
|
||||
"NamespaceReference": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"$ref": "#/definitions/NamespaceType"
|
||||
},
|
||||
"path": {
|
||||
"$ref": "defs.json#/definitions/FilePath"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
20
vendor/github.com/opencontainers/runtime-spec/schema/defs-windows.json
generated
vendored
Normal file
20
vendor/github.com/opencontainers/runtime-spec/schema/defs-windows.json
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"definitions": {
|
||||
"cpuShares": {
|
||||
"description": "Relative weight to other containers with CPU Shares defined",
|
||||
"type": "integer",
|
||||
"minimum": 1,
|
||||
"maximum": 10000
|
||||
},
|
||||
"cpuSharesPointer": {
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/definitions/cpuShares"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
205
vendor/github.com/opencontainers/runtime-spec/schema/defs.json
generated
vendored
Normal file
205
vendor/github.com/opencontainers/runtime-spec/schema/defs.json
generated
vendored
Normal file
@@ -0,0 +1,205 @@
|
||||
{
|
||||
"description": "Definitions used throughout the Open Container Runtime Specification",
|
||||
"definitions": {
|
||||
"int8": {
|
||||
"type": "integer",
|
||||
"minimum": -128,
|
||||
"maximum": 127
|
||||
},
|
||||
"int16": {
|
||||
"type": "integer",
|
||||
"minimum": -32768,
|
||||
"maximum": 32767
|
||||
},
|
||||
"int32": {
|
||||
"type": "integer",
|
||||
"minimum": -2147483648,
|
||||
"maximum": 2147483647
|
||||
},
|
||||
"int64": {
|
||||
"type": "integer",
|
||||
"minimum": -9223372036854776000,
|
||||
"maximum": 9223372036854776000
|
||||
},
|
||||
"uint8": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 255
|
||||
},
|
||||
"uint16": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 65535
|
||||
},
|
||||
"uint32": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 4294967295
|
||||
},
|
||||
"uint64": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 18446744073709552000
|
||||
},
|
||||
"percent": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 100
|
||||
},
|
||||
"intPointer": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "integer"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"uint16Pointer": {
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/definitions/uint16"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"uint64Pointer": {
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/definitions/uint64"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"percentPointer": {
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/definitions/percent"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"stringPointer": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"mapStringString": {
|
||||
"type": "object",
|
||||
"patternProperties": {
|
||||
".{1,}": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"UID": {
|
||||
"$ref": "#/definitions/uint32"
|
||||
},
|
||||
"GID": {
|
||||
"$ref": "#/definitions/uint32"
|
||||
},
|
||||
"ArrayOfGIDs": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/GID"
|
||||
}
|
||||
},
|
||||
"ArrayOfStrings": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"FilePath": {
|
||||
"type": "string"
|
||||
},
|
||||
"Env": {
|
||||
"$ref": "#/definitions/ArrayOfStrings"
|
||||
},
|
||||
"Hook": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"path": {
|
||||
"$ref": "#/definitions/FilePath"
|
||||
},
|
||||
"args": {
|
||||
"$ref": "#/definitions/ArrayOfStrings"
|
||||
},
|
||||
"env": {
|
||||
"$ref": "#/definitions/Env"
|
||||
},
|
||||
"timeout": {
|
||||
"$ref": "#/definitions/intPointer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ArrayOfHooks": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/Hook"
|
||||
}
|
||||
},
|
||||
"IDMapping": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"hostID": {
|
||||
"$ref": "#/definitions/uint32"
|
||||
},
|
||||
"containerID": {
|
||||
"$ref": "#/definitions/uint32"
|
||||
},
|
||||
"size": {
|
||||
"$ref": "#/definitions/uint32"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Mount": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"source": {
|
||||
"$ref": "#/definitions/FilePath"
|
||||
},
|
||||
"destination": {
|
||||
"$ref": "#/definitions/FilePath"
|
||||
},
|
||||
"options": {
|
||||
"$ref": "#/definitions/ArrayOfStrings"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"destination",
|
||||
"source",
|
||||
"type"
|
||||
]
|
||||
},
|
||||
"ociVersion": {
|
||||
"description": "The version of Open Container Runtime Specification that the document complies with",
|
||||
"type": "string"
|
||||
},
|
||||
"annotations": {
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/definitions/mapStringString"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
45
vendor/github.com/opencontainers/runtime-spec/schema/state-schema.json
generated
vendored
Normal file
45
vendor/github.com/opencontainers/runtime-spec/schema/state-schema.json
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"description": "Open Container Runtime State Schema",
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"id": "https://opencontainers.org/schema/state",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"ociVersion": {
|
||||
"id": "https://opencontainers.org/schema/runtime/state/ociVersion",
|
||||
"$ref": "defs.json#/definitions/ociVersion"
|
||||
},
|
||||
"id": {
|
||||
"id": "https://opencontainers.org/schema/runtime/state/id",
|
||||
"description": "the container's ID",
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"id": "https://opencontainers.org/schema/runtime/state/status",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"created",
|
||||
"running",
|
||||
"stopped"
|
||||
]
|
||||
},
|
||||
"pid": {
|
||||
"id": "https://opencontainers.org/schema/runtime/state/pid",
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
"bundlePath": {
|
||||
"id": "https://opencontainers.org/schema/runtime/state/bundlePath",
|
||||
"type": "string"
|
||||
},
|
||||
"annotations": {
|
||||
"$ref": "defs.json#/definitions/annotations"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"ociVersion",
|
||||
"id",
|
||||
"status",
|
||||
"pid",
|
||||
"bundlePath"
|
||||
]
|
||||
}
|
||||
58
vendor/github.com/opencontainers/runtime-spec/schema/validate.go
generated
vendored
Normal file
58
vendor/github.com/opencontainers/runtime-spec/schema/validate.go
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/xeipuuv/gojsonschema"
|
||||
)
|
||||
|
||||
func main() {
|
||||
nargs := len(os.Args[1:])
|
||||
if nargs == 0 || nargs > 2 {
|
||||
fmt.Printf("ERROR: usage is: %s <schema.json> [<document.json>]\n", os.Args[0])
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
schemaPath, err := filepath.Abs(os.Args[1])
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
schemaLoader := gojsonschema.NewReferenceLoader("file://" + schemaPath)
|
||||
var documentLoader gojsonschema.JSONLoader
|
||||
|
||||
if nargs > 1 {
|
||||
documentPath, err := filepath.Abs(os.Args[2])
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
documentLoader = gojsonschema.NewReferenceLoader("file://" + documentPath)
|
||||
} else {
|
||||
documentBytes, err := ioutil.ReadAll(os.Stdin)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
documentString := string(documentBytes)
|
||||
documentLoader = gojsonschema.NewStringLoader(documentString)
|
||||
}
|
||||
|
||||
result, err := gojsonschema.Validate(schemaLoader, documentLoader)
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
|
||||
if result.Valid() {
|
||||
fmt.Printf("The document is valid\n")
|
||||
} else {
|
||||
fmt.Printf("The document is not valid. see errors :\n")
|
||||
for _, desc := range result.Errors() {
|
||||
fmt.Printf("- %s\n", desc)
|
||||
}
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user