diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 6ff9703..e567803 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -8,6 +8,10 @@ on: jobs: publish-npm: runs-on: ubuntu-latest + permissions: + contents: read + id-token: write + attestations: write steps: - uses: actions/checkout@v4 @@ -15,11 +19,10 @@ jobs: - uses: actions/setup-node@v4 with: + node-version: 24 + registry-url: https://registry.npmjs.org/ cache: 'pnpm' - registry-url: 'https://registry.npmjs.org' - run: make - - run: pnpm publish --access=public --no-git-checks - env: - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + - run: pnpm publish --access=public --no-git-checks --provenance diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 6c72882..19eadf8 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -6,10 +6,13 @@ on: jobs: test: - runs-on: ubuntu-latest strategy: matrix: - node-version: [20, 22] + version: [24] + os: [ubuntu-latest] + + runs-on: ${{ matrix.os }} + steps: - uses: actions/checkout@v4 @@ -17,8 +20,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: ${{ matrix.version }} cache: 'pnpm' - registry-url: 'https://registry.npmjs.org' - run: make test diff --git a/.gitignore b/.gitignore index 0e75fe5..ae105f3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ node_modules dist coverage +tmp/ +.vscode/ diff --git a/.node-version b/.node-version index 209e3ef..a45fd52 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -20 +24 diff --git a/Makefile b/Makefile index c9649fd..9411315 100644 --- a/Makefile +++ b/Makefile @@ -1,50 +1,44 @@ SRCS = $(wildcard lib/**) -all: dist +all: typecheck .PHONY: deps deps: node_modules -.PHONY: clean -clean: - pnpm exec tsc -b --clean - rm -rf dist - rm -rf __tests__/dist - rm __tests__/fixtures/*/*.ts +.PHONY: distclean +distclean: + rm -rf node_modules + +.PHONY: typecheck +typecheck: node_modules tsconfig.json $(SRCS) + pnpm exec tsc .PHONY: test test: node_modules - pnpm exec tsc -b + pnpm exec tsc pnpm exec vitest node_modules: package.json pnpm install -dist: node_modules tsconfig.json $(SRCS) - pnpm exec tsc - -.PHONY: dev -dev: - pnpm tsc -b -w - .PHONY: fixtures -fixtures: dist - $(MAKE) petstore test1 openai +fixtures: + $(MAKE) petstore test1 openai docker .PHONY: petstore -petstore: __tests__/fixtures/petstore.json dist - node --enable-source-maps dist/bin/index.js \ +petstore: __tests__/fixtures/petstore.json + node --enable-source-maps bin/index.ts \ -i $< \ -o __tests__/fixtures/petstore - pnpm exec prettier --write __tests__/fixtures/petstore + pnpm exec biome check --unsafe --write __tests__/fixtures/petstore .PHONY: test1 -test1: __tests__/fixtures/test1.json dist - node --enable-source-maps dist/bin/index.js \ +test1: __tests__/fixtures/test1.json + node --enable-source-maps bin/index.ts \ -i $< \ -o __tests__/fixtures/test1 - pnpm exec prettier --write __tests__/fixtures/test1 + pnpm exec biome check --unsafe --write __tests__/fixtures/test1 __tests__/fixtures/openai.json: __tests__/fixtures/openai.yaml @@ -55,20 +49,20 @@ __tests__/fixtures/openai.yaml: __tests__/fixtures/openai.yaml curl https://raw.githubusercontent.com/openai/openai-openapi/refs/heads/master/openapi.yaml --output $@ .PHONY: openai -openai: __tests__/fixtures/openai.json dist - node --enable-source-maps dist/bin/index.js \ +openai: __tests__/fixtures/openai.json + node --enable-source-maps bin/index.ts \ -i $< \ -o __tests__/fixtures/openai - pnpm exec prettier --write __tests__/fixtures/openai + pnpm exec biome check --unsafe --write __tests__/fixtures/openai -# .PHONY: cloudflare -# cloudflare: __tests__/fixtures/cloudflare/openapi.json dist -# node --enable-source-maps dist/bin/index.js \ -# -i __tests__/fixtures/cloudflare/openapi.json \ -# -o __tests__/fixtures/cloudflare -# pnpm prettier --write __tests__/fixtures/cloudflare +.PHONY: docker +docker: __tests__/fixtures/docker.json + node --enable-source-maps bin/index.ts \ + -i $< \ + -o __tests__/fixtures/docker + pnpm exec biome check --unsafe --write __tests__/fixtures/docker .PHONY: pretty pretty: node_modules pnpm exec eslint --fix . || true - pnpm exec prettier --write . + pnpm exec biome check --unsafe --write . diff --git a/__tests__/fixtures/docker.json b/__tests__/fixtures/docker.json new file mode 100644 index 0000000..03a6a05 --- /dev/null +++ b/__tests__/fixtures/docker.json @@ -0,0 +1,55749 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "Docker Engine API", + "description": "The Engine API is an HTTP API served by Docker Engine. It is the API the\nDocker client uses to communicate with the Engine, so everything the Docker\nclient can do can be done with the API.\n\nMost of the client's commands map directly to API endpoints (e.g. `docker ps`\nis `GET /containers/json`). The notable exception is running containers,\nwhich consists of several API calls.\n\n# Errors\n\nThe API uses standard HTTP status codes to indicate the success or failure\nof the API call. The body of the response will be JSON in the following\nformat:\n\n```\n{\n \"message\": \"page not found\"\n}\n```\n\n# Versioning\n\nThe API is usually changed in each release, so API calls are versioned to\nensure that clients don't break. To lock to a specific version of the API,\nyou prefix the URL with its version, for example, call `/v1.30/info` to use\nthe v1.30 version of the `/info` endpoint. If the API version specified in\nthe URL is not supported by the daemon, a HTTP `400 Bad Request` error message\nis returned.\n\nIf you omit the version-prefix, the current version of the API (v1.43) is used.\nFor example, calling `/info` is the same as calling `/v1.43/info`. Using the\nAPI without a version-prefix is deprecated and will be removed in a future release.\n\nEngine releases in the near future should support this version of the API,\nso your client will continue to work even if it is talking to a newer Engine.\n\nThe API uses an open schema model, which means server may add extra properties\nto responses. Likewise, the server will ignore any extra query parameters and\nrequest body properties. When you write clients, you need to ignore additional\nproperties in responses to ensure they do not break when talking to newer\ndaemons.\n\n\n# Authentication\n\nAuthentication for registries is handled client side. The client has to send\nauthentication details to various endpoints that need to communicate with\nregistries, such as `POST /images/(name)/push`. These are sent as\n`X-Registry-Auth` header as a [base64url encoded](https://tools.ietf.org/html/rfc4648#section-5)\n(JSON) string with the following structure:\n\n```\n{\n \"username\": \"string\",\n \"password\": \"string\",\n \"email\": \"string\",\n \"serveraddress\": \"string\"\n}\n```\n\nThe `serveraddress` is a domain/IP without a protocol. Throughout this\nstructure, double quotes are required.\n\nIf you have already got an identity token from the [`/auth` endpoint](#operation/SystemAuth),\nyou can just pass this instead of credentials:\n\n```\n{\n \"identitytoken\": \"9cbaf023786cd7...\"\n}\n```\n", + "version": "1.43", + "x-logo": { + "url": "https://docs.docker.com/assets/images/logo-docker-main.png" + } + }, + "servers": [ + { + "url": "http://docker.local:2375/v1.43" + } + ], + "tags": [ + { + "name": "Container", + "description": "Create and manage containers.\n", + "x-displayName": "Containers" + }, + { + "name": "Image", + "x-displayName": "Images" + }, + { + "name": "Network", + "description": "Networks are user-defined networks that containers can be attached to.\nSee the [networking documentation](https://docs.docker.com/network/)\nfor more information.\n", + "x-displayName": "Networks" + }, + { + "name": "Volume", + "description": "Create and manage persistent storage that can be attached to containers.\n", + "x-displayName": "Volumes" + }, + { + "name": "Exec", + "description": "Run new commands inside running containers. Refer to the\n[command-line reference](https://docs.docker.com/engine/reference/commandline/exec/)\nfor more information.\n\nTo exec a command in a container, you first need to create an exec instance,\nthen start it. These two API endpoints are wrapped up in a single command-line\ncommand, `docker exec`.\n", + "x-displayName": "Exec" + }, + { + "name": "Swarm", + "description": "Engines can be clustered together in a swarm. Refer to the\n[swarm mode documentation](https://docs.docker.com/engine/swarm/)\nfor more information.\n", + "x-displayName": "Swarm" + }, + { + "name": "Node", + "description": "Nodes are instances of the Engine participating in a swarm. Swarm mode\nmust be enabled for these endpoints to work.\n", + "x-displayName": "Nodes" + }, + { + "name": "Service", + "description": "Services are the definitions of tasks to run on a swarm. Swarm mode must\nbe enabled for these endpoints to work.\n", + "x-displayName": "Services" + }, + { + "name": "Task", + "description": "A task is a container running on a swarm. It is the atomic scheduling unit\nof swarm. Swarm mode must be enabled for these endpoints to work.\n", + "x-displayName": "Tasks" + }, + { + "name": "Secret", + "description": "Secrets are sensitive data that can be used by services. Swarm mode must\nbe enabled for these endpoints to work.\n", + "x-displayName": "Secrets" + }, + { + "name": "Config", + "description": "Configs are application configurations that can be used by services. Swarm\nmode must be enabled for these endpoints to work.\n", + "x-displayName": "Configs" + }, + { + "name": "Plugin", + "x-displayName": "Plugins" + }, + { + "name": "System", + "x-displayName": "System" + } + ], + "paths": { + "/containers/json": { + "get": { + "tags": [ + "Container" + ], + "summary": "List containers", + "description": "Returns a list of containers. For details on the format, see the\n[inspect endpoint](#operation/ContainerInspect).\n\nNote that it uses a different, smaller representation of a container\nthan inspecting a single container. For example, the list of linked\ncontainers is not propagated .\n", + "operationId": "ContainerList", + "parameters": [ + { + "name": "all", + "in": "query", + "description": "Return all containers. By default, only running containers are shown.\n", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "limit", + "in": "query", + "description": "Return this number of most recently created containers, including\nnon-running ones.\n", + "schema": { + "type": "integer" + } + }, + { + "name": "size", + "in": "query", + "description": "Return the size of container as fields `SizeRw` and `SizeRootFs`.\n", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "filters", + "in": "query", + "description": "Filters to process on the container list, encoded as JSON (a\n`map[string][]string`). For example, `{\"status\": [\"paused\"]}` will\nonly return paused containers.\n\nAvailable filters:\n\n- `ancestor`=(`[:]`, ``, or ``)\n- `before`=(`` or ``)\n- `expose`=(`[/]`|`/[]`)\n- `exited=` containers with exit code of ``\n- `health`=(`starting`|`healthy`|`unhealthy`|`none`)\n- `id=` a container's ID\n- `isolation=`(`default`|`process`|`hyperv`) (Windows daemon only)\n- `is-task=`(`true`|`false`)\n- `label=key` or `label=\"key=value\"` of a container label\n- `name=` a container's name\n- `network`=(`` or ``)\n- `publish`=(`[/]`|`/[]`)\n- `since`=(`` or ``)\n- `status=`(`created`|`restarting`|`running`|`removing`|`paused`|`exited`|`dead`)\n- `volume`=(`` or ``)\n", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "no error", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "Id": { + "type": "string", + "description": "The ID of this container", + "x-go-name": "ID" + }, + "Names": { + "type": "array", + "description": "The names that this container has been given", + "items": { + "type": "string" + } + }, + "Image": { + "type": "string", + "description": "The name of the image used when creating this container" + }, + "ImageID": { + "type": "string", + "description": "The ID of the image that this container was created from" + }, + "Command": { + "type": "string", + "description": "Command to run when starting the container" + }, + "Created": { + "type": "integer", + "description": "When the container was created", + "format": "int64" + }, + "Ports": { + "type": "array", + "description": "The ports exposed by this container", + "items": { + "required": [ + "PrivatePort", + "Type" + ], + "type": "object", + "properties": { + "IP": { + "type": "string", + "description": "Host IP address that the container's port is mapped to", + "format": "ip-address" + }, + "PrivatePort": { + "type": "integer", + "description": "Port on the container", + "format": "uint16", + "nullable": false + }, + "PublicPort": { + "type": "integer", + "description": "Port exposed on the host", + "format": "uint16" + }, + "Type": { + "type": "string", + "nullable": false, + "enum": [ + "tcp", + "udp", + "sctp" + ] + } + }, + "description": "An open port on a container", + "example": { + "PrivatePort": 8080, + "PublicPort": 80, + "Type": "tcp" + } + } + }, + "SizeRw": { + "type": "integer", + "description": "The size of files that have been created or changed by this container", + "format": "int64" + }, + "SizeRootFs": { + "type": "integer", + "description": "The total size of all the files in this container", + "format": "int64" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "State": { + "type": "string", + "description": "The state of this container (e.g. `Exited`)" + }, + "Status": { + "type": "string", + "description": "Additional human-readable status of this container (e.g. `Exit 0`)" + }, + "HostConfig": { + "type": "object", + "properties": { + "NetworkMode": { + "type": "string" + } + } + }, + "NetworkSettings": { + "type": "object", + "properties": { + "Networks": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "IPAMConfig": { + "type": "object", + "properties": { + "IPv4Address": { + "type": "string", + "example": "172.20.30.33" + }, + "IPv6Address": { + "type": "string", + "example": "2001:db8:abcd::3033" + }, + "LinkLocalIPs": { + "type": "array", + "example": [ + "169.254.34.68", + "fe80::3468" + ], + "items": { + "type": "string" + } + } + }, + "description": "EndpointIPAMConfig represents an endpoint's IPAM configuration.\n", + "nullable": true, + "x-nullable": true + }, + "Links": { + "type": "array", + "example": [ + "container_1", + "container_2" + ], + "items": { + "type": "string" + } + }, + "Aliases": { + "type": "array", + "example": [ + "server_x", + "server_y" + ], + "items": { + "type": "string" + } + }, + "NetworkID": { + "type": "string", + "description": "Unique ID of the network.\n", + "example": "08754567f1f40222263eab4102e1c733ae697e8e354aa9cd6e18d7402835292a" + }, + "EndpointID": { + "type": "string", + "description": "Unique ID for the service endpoint in a Sandbox.\n", + "example": "b88f5b905aabf2893f3cbc4ee42d1ea7980bbc0a92e2c8922b1e1795298afb0b" + }, + "Gateway": { + "type": "string", + "description": "Gateway address for this network.\n", + "example": "172.17.0.1" + }, + "IPAddress": { + "type": "string", + "description": "IPv4 address.\n", + "example": "172.17.0.4" + }, + "IPPrefixLen": { + "type": "integer", + "description": "Mask length of the IPv4 address.\n", + "example": 16 + }, + "IPv6Gateway": { + "type": "string", + "description": "IPv6 gateway address.\n", + "example": "2001:db8:2::100" + }, + "GlobalIPv6Address": { + "type": "string", + "description": "Global IPv6 address.\n", + "example": "2001:db8::5689" + }, + "GlobalIPv6PrefixLen": { + "type": "integer", + "description": "Mask length of the global IPv6 address.\n", + "format": "int64", + "example": 64 + }, + "MacAddress": { + "type": "string", + "description": "MAC address for the endpoint on this network.\n", + "example": "02:42:ac:11:00:04" + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "DriverOpts is a mapping of driver options and values. These options\nare passed directly to the driver and are driver specific.\n", + "nullable": true, + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + } + }, + "description": "Configuration for a network endpoint." + } + } + }, + "description": "A summary of the container's network settings" + }, + "Mounts": { + "type": "array", + "items": { + "type": "object", + "properties": { + "Type": { + "type": "string", + "description": "The mount type:\n\n- `bind` a mount of a file or directory from the host into the container.\n- `volume` a docker volume with the given `Name`.\n- `tmpfs` a `tmpfs`.\n- `npipe` a named pipe from the host into the container.\n- `cluster` a Swarm cluster volume\n", + "example": "volume", + "enum": [ + "bind", + "volume", + "tmpfs", + "npipe", + "cluster" + ] + }, + "Name": { + "type": "string", + "description": "Name is the name reference to the underlying data defined by `Source`\ne.g., the volume name.\n", + "example": "myvolume" + }, + "Source": { + "type": "string", + "description": "Source location of the mount.\n\nFor volumes, this contains the storage location of the volume (within\n`/var/lib/docker/volumes/`). For bind-mounts, and `npipe`, this contains\nthe source (host) part of the bind-mount. For `tmpfs` mount points, this\nfield is empty.\n", + "example": "/var/lib/docker/volumes/myvolume/_data" + }, + "Destination": { + "type": "string", + "description": "Destination is the path relative to the container root (`/`) where\nthe `Source` is mounted inside the container.\n", + "example": "/usr/share/nginx/html/" + }, + "Driver": { + "type": "string", + "description": "Driver is the volume driver used to create the volume (if it is a volume).\n", + "example": "local" + }, + "Mode": { + "type": "string", + "description": "Mode is a comma separated list of options supplied by the user when\ncreating the bind/volume mount.\n\nThe default is platform-specific (`\"z\"` on Linux, empty on Windows).\n", + "example": "z" + }, + "RW": { + "type": "boolean", + "description": "Whether the mount is mounted writable (read-write).\n", + "example": true + }, + "Propagation": { + "type": "string", + "description": "Propagation describes how mounts are propagated from the host into the\nmount point, and vice-versa. Refer to the [Linux kernel documentation](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt)\nfor details. This field is not used on Windows.\n", + "example": "" + } + }, + "description": "MountPoint represents a mount point configuration inside the container.\nThis is used for reporting the mountpoints in use by a container.\n" + } + } + } + } + }, + "example": [ + { + "Id": "8dfafdbc3a40", + "Names": [ + "/boring_feynman" + ], + "Image": "ubuntu:latest", + "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82", + "Command": "echo 1", + "Created": 1367854155, + "State": "Exited", + "Status": "Exit 0", + "Ports": [ + { + "PrivatePort": 2222, + "PublicPort": 3333, + "Type": "tcp" + } + ], + "Labels": { + "com.example.vendor": "Acme", + "com.example.license": "GPL", + "com.example.version": "1.0" + }, + "SizeRw": 12288, + "SizeRootFs": 0, + "HostConfig": { + "NetworkMode": "default" + }, + "NetworkSettings": { + "Networks": { + "bridge": { + "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812", + "EndpointID": "2cdc4edb1ded3631c81f57966563e5c8525b81121bb3706a9a9a3ae102711f3f", + "Gateway": "172.17.0.1", + "IPAddress": "172.17.0.2", + "IPPrefixLen": 16, + "IPv6Gateway": "", + "GlobalIPv6Address": "", + "GlobalIPv6PrefixLen": 0, + "MacAddress": "02:42:ac:11:00:02" + } + } + }, + "Mounts": [ + { + "Name": "fac362...80535", + "Source": "/data", + "Destination": "/data", + "Driver": "local", + "Mode": "ro,Z", + "RW": false, + "Propagation": "" + } + ] + }, + { + "Id": "9cd87474be90", + "Names": [ + "/coolName" + ], + "Image": "ubuntu:latest", + "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82", + "Command": "echo 222222", + "Created": 1367854155, + "State": "Exited", + "Status": "Exit 0", + "Ports": [], + "Labels": {}, + "SizeRw": 12288, + "SizeRootFs": 0, + "HostConfig": { + "NetworkMode": "default" + }, + "NetworkSettings": { + "Networks": { + "bridge": { + "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812", + "EndpointID": "88eaed7b37b38c2a3f0c4bc796494fdf51b270c2d22656412a2ca5d559a64d7a", + "Gateway": "172.17.0.1", + "IPAddress": "172.17.0.8", + "IPPrefixLen": 16, + "IPv6Gateway": "", + "GlobalIPv6Address": "", + "GlobalIPv6PrefixLen": 0, + "MacAddress": "02:42:ac:11:00:08" + } + } + }, + "Mounts": [] + }, + { + "Id": "3176a2479c92", + "Names": [ + "/sleepy_dog" + ], + "Image": "ubuntu:latest", + "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82", + "Command": "echo 3333333333333333", + "Created": 1367854154, + "State": "Exited", + "Status": "Exit 0", + "Ports": [], + "Labels": {}, + "SizeRw": 12288, + "SizeRootFs": 0, + "HostConfig": { + "NetworkMode": "default" + }, + "NetworkSettings": { + "Networks": { + "bridge": { + "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812", + "EndpointID": "8b27c041c30326d59cd6e6f510d4f8d1d570a228466f956edf7815508f78e30d", + "Gateway": "172.17.0.1", + "IPAddress": "172.17.0.6", + "IPPrefixLen": 16, + "IPv6Gateway": "", + "GlobalIPv6Address": "", + "GlobalIPv6PrefixLen": 0, + "MacAddress": "02:42:ac:11:00:06" + } + } + }, + "Mounts": [] + }, + { + "Id": "4cb07b47f9fb", + "Names": [ + "/running_cat" + ], + "Image": "ubuntu:latest", + "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82", + "Command": "echo 444444444444444444444444444444444", + "Created": 1367854152, + "State": "Exited", + "Status": "Exit 0", + "Ports": [], + "Labels": {}, + "SizeRw": 12288, + "SizeRootFs": 0, + "HostConfig": { + "NetworkMode": "default" + }, + "NetworkSettings": { + "Networks": { + "bridge": { + "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812", + "EndpointID": "d91c7b2f0644403d7ef3095985ea0e2370325cd2332ff3a3225c4247328e66e9", + "Gateway": "172.17.0.1", + "IPAddress": "172.17.0.5", + "IPPrefixLen": 16, + "IPv6Gateway": "", + "GlobalIPv6Address": "", + "GlobalIPv6PrefixLen": 0, + "MacAddress": "02:42:ac:11:00:05" + } + } + }, + "Mounts": [] + } + ] + } + } + }, + "400": { + "description": "bad parameter", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/containers/create": { + "post": { + "tags": [ + "Container" + ], + "summary": "Create a container", + "operationId": "ContainerCreate", + "parameters": [ + { + "name": "name", + "in": "query", + "description": "Assign the specified name to the container. Must match\n`/?[a-zA-Z0-9][a-zA-Z0-9_.-]+`.\n", + "schema": { + "pattern": "^/?[a-zA-Z0-9][a-zA-Z0-9_.-]+$", + "type": "string" + } + }, + { + "name": "platform", + "in": "query", + "description": "Platform in the format `os[/arch[/variant]]` used for image lookup.\n\nWhen specified, the daemon checks if the requested image is present\nin the local image cache with the given OS and Architecture, and\notherwise returns a `404` status.\n\nIf the option is not set, the host's native OS and Architecture are\nused to look up the image in the image cache. However, if no platform\nis passed and the given image does exist in the local image cache,\nbut its OS or architecture does not match, the container is created\nwith the available image, and a warning is added to the `Warnings`\nfield in the response, for example;\n\n WARNING: The requested image's platform (linux/arm64/v8) does not\n match the detected host platform (linux/amd64) and no\n specific platform was requested\n", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "Container to create", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "type": "object", + "properties": { + "Hostname": { + "type": "string", + "description": "The hostname to use for the container, as a valid RFC 1123 hostname.\n", + "example": "439f4e91bd1d" + }, + "Domainname": { + "type": "string", + "description": "The domain name to use for the container.\n" + }, + "User": { + "type": "string", + "description": "The user that commands are run as inside the container." + }, + "AttachStdin": { + "type": "boolean", + "description": "Whether to attach to `stdin`.", + "default": false + }, + "AttachStdout": { + "type": "boolean", + "description": "Whether to attach to `stdout`.", + "default": true + }, + "AttachStderr": { + "type": "boolean", + "description": "Whether to attach to `stderr`.", + "default": true + }, + "ExposedPorts": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": {} + }, + "description": "An object mapping ports to an empty object in the form:\n\n`{\"/\": {}}`\n", + "nullable": true, + "example": { + "80/tcp": {}, + "443/tcp": {} + } + }, + "Tty": { + "type": "boolean", + "description": "Attach standard streams to a TTY, including `stdin` if it is not closed.\n", + "default": false + }, + "OpenStdin": { + "type": "boolean", + "description": "Open `stdin`", + "default": false + }, + "StdinOnce": { + "type": "boolean", + "description": "Close `stdin` after one attached client disconnects", + "default": false + }, + "Env": { + "type": "array", + "description": "A list of environment variables to set inside the container in the\nform `[\"VAR=value\", ...]`. A variable without `=` is removed from the\nenvironment, rather than to have an empty value.\n", + "example": [ + "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + ], + "items": { + "type": "string" + } + }, + "Cmd": { + "type": "array", + "description": "Command to run specified as a string or an array of strings.\n", + "example": [ + "/bin/sh" + ], + "items": { + "type": "string" + } + }, + "Healthcheck": { + "type": "object", + "properties": { + "Test": { + "type": "array", + "description": "The test to perform. Possible values are:\n\n- `[]` inherit healthcheck from image or parent image\n- `[\"NONE\"]` disable healthcheck\n- `[\"CMD\", args...]` exec arguments directly\n- `[\"CMD-SHELL\", command]` run command with system's default shell\n", + "items": { + "type": "string" + } + }, + "Interval": { + "type": "integer", + "description": "The time to wait between checks in nanoseconds. It should be 0 or at\nleast 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Timeout": { + "type": "integer", + "description": "The time to wait before considering the check to have hung. It should\nbe 0 or at least 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Retries": { + "type": "integer", + "description": "The number of consecutive failures needed to consider a container as\nunhealthy. 0 means inherit.\n" + }, + "StartPeriod": { + "type": "integer", + "description": "Start period for the container to initialize before starting\nhealth-retries countdown in nanoseconds. It should be 0 or at least\n1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + } + }, + "description": "A test to perform to check that the container is healthy." + }, + "ArgsEscaped": { + "type": "boolean", + "description": "Command is already escaped (Windows only)", + "nullable": true, + "example": false, + "default": false + }, + "Image": { + "type": "string", + "description": "The name (or reference) of the image to use when creating the container,\nor which was used when the container was created.\n", + "example": "example-image:1.0" + }, + "Volumes": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": {} + }, + "description": "An object mapping mount point paths inside the container to empty\nobjects.\n" + }, + "WorkingDir": { + "type": "string", + "description": "The working directory for commands to run in.", + "example": "/public/" + }, + "Entrypoint": { + "type": "array", + "description": "The entry point for the container as a string or an array of strings.\n\nIf the array consists of exactly one empty string (`[\"\"]`) then the\nentry point is reset to system default (i.e., the entry point used by\ndocker when there is no `ENTRYPOINT` instruction in the `Dockerfile`).\n", + "example": [], + "items": { + "type": "string" + } + }, + "NetworkDisabled": { + "type": "boolean", + "description": "Disable networking for the container.", + "nullable": true + }, + "MacAddress": { + "type": "string", + "description": "MAC address of the container.", + "nullable": true + }, + "OnBuild": { + "type": "array", + "description": "`ONBUILD` metadata that were defined in the image's `Dockerfile`.\n", + "nullable": true, + "example": [], + "items": { + "type": "string" + } + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "StopSignal": { + "type": "string", + "description": "Signal to stop a container as a string or unsigned integer.\n", + "nullable": true, + "example": "SIGTERM" + }, + "StopTimeout": { + "type": "integer", + "description": "Timeout to stop a container in seconds.", + "nullable": true + }, + "Shell": { + "type": "array", + "description": "Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell.\n", + "nullable": true, + "example": [ + "/bin/sh", + "-c" + ], + "items": { + "type": "string" + } + } + }, + "description": "Configuration for a container that is portable between hosts.\n\nWhen used as `ContainerConfig` field in an image, `ContainerConfig` is an\noptional field containing the configuration of the container that was last\ncommitted when creating the image.\n\nPrevious versions of Docker builder used this field to store build cache,\nand it is not in active use anymore.\n" + }, + { + "type": "object", + "properties": { + "HostConfig": { + "description": "Container configuration that depends on the host we are running on", + "allOf": [ + { + "type": "object", + "properties": { + "CpuShares": { + "type": "integer", + "description": "An integer value representing this container's relative CPU weight\nversus other containers.\n" + }, + "Memory": { + "type": "integer", + "description": "Memory limit in bytes.", + "format": "int64", + "default": 0 + }, + "CgroupParent": { + "type": "string", + "description": "Path to `cgroups` under which the container's `cgroup` is created. If\nthe path is not absolute, the path is considered to be relative to the\n`cgroups` path of the init process. Cgroups are created if they do not\nalready exist.\n" + }, + "BlkioWeight": { + "maximum": 1000, + "minimum": 0, + "type": "integer", + "description": "Block IO weight (relative weight)." + }, + "BlkioWeightDevice": { + "type": "array", + "description": "Block IO weight (relative device weight) in the form:\n\n```\n[{\"Path\": \"device_path\", \"Weight\": weight}]\n```\n", + "items": { + "type": "object", + "properties": { + "Path": { + "type": "string" + }, + "Weight": { + "minimum": 0, + "type": "integer" + } + } + } + }, + "BlkioDeviceReadBps": { + "type": "array", + "description": "Limit read rate (bytes per second) from a device, in the form:\n\n```\n[{\"Path\": \"device_path\", \"Rate\": rate}]\n```\n", + "items": { + "type": "object", + "properties": { + "Path": { + "type": "string", + "description": "Device path" + }, + "Rate": { + "minimum": 0, + "type": "integer", + "description": "Rate", + "format": "int64" + } + } + } + }, + "BlkioDeviceWriteBps": { + "type": "array", + "description": "Limit write rate (bytes per second) to a device, in the form:\n\n```\n[{\"Path\": \"device_path\", \"Rate\": rate}]\n```\n", + "items": { + "type": "object", + "properties": { + "Path": { + "type": "string", + "description": "Device path" + }, + "Rate": { + "minimum": 0, + "type": "integer", + "description": "Rate", + "format": "int64" + } + } + } + }, + "BlkioDeviceReadIOps": { + "type": "array", + "description": "Limit read rate (IO per second) from a device, in the form:\n\n```\n[{\"Path\": \"device_path\", \"Rate\": rate}]\n```\n", + "items": { + "type": "object", + "properties": { + "Path": { + "type": "string", + "description": "Device path" + }, + "Rate": { + "minimum": 0, + "type": "integer", + "description": "Rate", + "format": "int64" + } + } + } + }, + "BlkioDeviceWriteIOps": { + "type": "array", + "description": "Limit write rate (IO per second) to a device, in the form:\n\n```\n[{\"Path\": \"device_path\", \"Rate\": rate}]\n```\n", + "items": { + "type": "object", + "properties": { + "Path": { + "type": "string", + "description": "Device path" + }, + "Rate": { + "minimum": 0, + "type": "integer", + "description": "Rate", + "format": "int64" + } + } + } + }, + "CpuPeriod": { + "type": "integer", + "description": "The length of a CPU period in microseconds.", + "format": "int64" + }, + "CpuQuota": { + "type": "integer", + "description": "Microseconds of CPU time that the container can get in a CPU period.\n", + "format": "int64" + }, + "CpuRealtimePeriod": { + "type": "integer", + "description": "The length of a CPU real-time period in microseconds. Set to 0 to\nallocate no time allocated to real-time tasks.\n", + "format": "int64" + }, + "CpuRealtimeRuntime": { + "type": "integer", + "description": "The length of a CPU real-time runtime in microseconds. Set to 0 to\nallocate no time allocated to real-time tasks.\n", + "format": "int64" + }, + "CpusetCpus": { + "type": "string", + "description": "CPUs in which to allow execution (e.g., `0-3`, `0,1`).\n", + "example": "0-3" + }, + "CpusetMems": { + "type": "string", + "description": "Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only\neffective on NUMA systems.\n" + }, + "Devices": { + "type": "array", + "description": "A list of devices to add to the container.", + "items": { + "type": "object", + "properties": { + "PathOnHost": { + "type": "string" + }, + "PathInContainer": { + "type": "string" + }, + "CgroupPermissions": { + "type": "string" + } + }, + "description": "A device mapping between the host and container", + "example": { + "PathOnHost": "/dev/deviceName", + "PathInContainer": "/dev/deviceName", + "CgroupPermissions": "mrw" + } + } + }, + "DeviceCgroupRules": { + "type": "array", + "description": "a list of cgroup rules to apply to the container", + "items": { + "type": "string", + "example": "c 13:* rwm" + } + }, + "DeviceRequests": { + "type": "array", + "description": "A list of requests for devices to be sent to device drivers.\n", + "items": { + "type": "object", + "properties": { + "Driver": { + "type": "string", + "example": "nvidia" + }, + "Count": { + "type": "integer", + "example": -1 + }, + "DeviceIDs": { + "type": "array", + "example": [ + "0", + "1", + "GPU-fef8089b-4820-abfc-e83e-94318197576e" + ], + "items": { + "type": "string" + } + }, + "Capabilities": { + "type": "array", + "description": "A list of capabilities; an OR list of AND lists of capabilities.\n", + "example": [ + [ + "gpu", + "nvidia", + "compute" + ] + ], + "items": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver-specific options, specified as a key/value pairs. These options\nare passed directly to the driver.\n" + } + }, + "description": "A request for devices to be sent to device drivers" + } + }, + "KernelMemoryTCP": { + "type": "integer", + "description": "Hard limit for kernel TCP buffer memory (in bytes). Depending on the\nOCI runtime in use, this option may be ignored. It is no longer supported\nby the default (runc) runtime.\n\nThis field is omitted when empty.\n", + "format": "int64" + }, + "MemoryReservation": { + "type": "integer", + "description": "Memory soft limit in bytes.", + "format": "int64" + }, + "MemorySwap": { + "type": "integer", + "description": "Total memory limit (memory + swap). Set as `-1` to enable unlimited\nswap.\n", + "format": "int64" + }, + "MemorySwappiness": { + "maximum": 100, + "minimum": 0, + "type": "integer", + "description": "Tune a container's memory swappiness behavior. Accepts an integer\nbetween 0 and 100.\n", + "format": "int64" + }, + "NanoCpus": { + "type": "integer", + "description": "CPU quota in units of 10-9 CPUs.", + "format": "int64" + }, + "OomKillDisable": { + "type": "boolean", + "description": "Disable OOM Killer for the container." + }, + "Init": { + "type": "boolean", + "description": "Run an init inside the container that forwards signals and reaps\nprocesses. This field is omitted if empty, and the default (as\nconfigured on the daemon) is used.\n", + "nullable": true + }, + "PidsLimit": { + "type": "integer", + "description": "Tune a container's PIDs limit. Set `0` or `-1` for unlimited, or `null`\nto not change.\n", + "format": "int64", + "nullable": true + }, + "Ulimits": { + "type": "array", + "description": "A list of resource limits to set in the container. For example:\n\n```\n{\"Name\": \"nofile\", \"Soft\": 1024, \"Hard\": 2048}\n```\n", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of ulimit" + }, + "Soft": { + "type": "integer", + "description": "Soft limit" + }, + "Hard": { + "type": "integer", + "description": "Hard limit" + } + } + } + }, + "CpuCount": { + "type": "integer", + "description": "The number of usable CPUs (Windows only).\n\nOn Windows Server containers, the processor resource controls are\nmutually exclusive. The order of precedence is `CPUCount` first, then\n`CPUShares`, and `CPUPercent` last.\n", + "format": "int64" + }, + "CpuPercent": { + "type": "integer", + "description": "The usable percentage of the available CPUs (Windows only).\n\nOn Windows Server containers, the processor resource controls are\nmutually exclusive. The order of precedence is `CPUCount` first, then\n`CPUShares`, and `CPUPercent` last.\n", + "format": "int64" + }, + "IOMaximumIOps": { + "type": "integer", + "description": "Maximum IOps for the container system drive (Windows only)", + "format": "int64" + }, + "IOMaximumBandwidth": { + "type": "integer", + "description": "Maximum IO in bytes per second for the container system drive\n(Windows only).\n", + "format": "int64" + } + }, + "description": "A container's resources (cgroups config, ulimits, etc)" + }, + { + "type": "object", + "properties": { + "Binds": { + "type": "array", + "description": "A list of volume bindings for this container. Each volume binding\nis a string in one of these forms:\n\n- `host-src:container-dest[:options]` to bind-mount a host path\n into the container. Both `host-src`, and `container-dest` must\n be an _absolute_ path.\n- `volume-name:container-dest[:options]` to bind-mount a volume\n managed by a volume driver into the container. `container-dest`\n must be an _absolute_ path.\n\n`options` is an optional, comma-delimited list of:\n\n- `nocopy` disables automatic copying of data from the container\n path to the volume. The `nocopy` flag only applies to named volumes.\n- `[ro|rw]` mounts a volume read-only or read-write, respectively.\n If omitted or set to `rw`, volumes are mounted read-write.\n- `[z|Z]` applies SELinux labels to allow or deny multiple containers\n to read and write to the same volume.\n - `z`: a _shared_ content label is applied to the content. This\n label indicates that multiple containers can share the volume\n content, for both reading and writing.\n - `Z`: a _private unshared_ label is applied to the content.\n This label indicates that only the current container can use\n a private volume. Labeling systems such as SELinux require\n proper labels to be placed on volume content that is mounted\n into a container. Without a label, the security system can\n prevent a container's processes from using the content. By\n default, the labels set by the host operating system are not\n modified.\n- `[[r]shared|[r]slave|[r]private]` specifies mount\n [propagation behavior](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt).\n This only applies to bind-mounted volumes, not internal volumes\n or named volumes. Mount propagation requires the source mount\n point (the location where the source directory is mounted in the\n host operating system) to have the correct propagation properties.\n For shared volumes, the source mount point must be set to `shared`.\n For slave volumes, the mount must be set to either `shared` or\n `slave`.\n", + "items": { + "type": "string" + } + }, + "ContainerIDFile": { + "type": "string", + "description": "Path to a file where the container ID is written" + }, + "LogConfig": { + "type": "object", + "properties": { + "Type": { + "type": "string", + "enum": [ + "json-file", + "syslog", + "journald", + "gelf", + "fluentd", + "awslogs", + "splunk", + "etwlogs", + "none" + ] + }, + "Config": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "description": "The logging configuration for this container" + }, + "NetworkMode": { + "type": "string", + "description": "Network mode to use for this container. Supported standard values\nare: `bridge`, `host`, `none`, and `container:`. Any\nother value is taken as a custom network's name to which this\ncontainer should connect to.\n" + }, + "PortBindings": { + "type": "object", + "additionalProperties": { + "type": "array", + "nullable": true, + "items": { + "type": "object", + "properties": { + "HostIp": { + "type": "string", + "description": "Host IP address that the container's port is mapped to.", + "example": "127.0.0.1" + }, + "HostPort": { + "type": "string", + "description": "Host port number that the container's port is mapped to.", + "example": "4443" + } + }, + "description": "PortBinding represents a binding between a host IP address and a host\nport.\n" + } + }, + "description": "PortMap describes the mapping of container ports to host ports, using the\ncontainer's port-number and protocol as key in the format `/`,\nfor example, `80/udp`.\n\nIf a container's port is mapped for multiple protocols, separate entries\nare added to the mapping table.\n", + "example": { + "443/tcp": [ + { + "HostIp": "127.0.0.1", + "HostPort": "4443" + } + ], + "80/tcp": [ + { + "HostIp": "0.0.0.0", + "HostPort": "80" + }, + { + "HostIp": "0.0.0.0", + "HostPort": "8080" + } + ], + "80/udp": [ + { + "HostIp": "0.0.0.0", + "HostPort": "80" + } + ], + "53/udp": [ + { + "HostIp": "0.0.0.0", + "HostPort": "53" + } + ] + } + }, + "RestartPolicy": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "- Empty string means not to restart\n- `no` Do not automatically restart\n- `always` Always restart\n- `unless-stopped` Restart always except when the user has manually stopped the container\n- `on-failure` Restart only when the container exit code is non-zero\n", + "enum": [ + "", + "no", + "always", + "unless-stopped", + "on-failure" + ] + }, + "MaximumRetryCount": { + "type": "integer", + "description": "If `on-failure` is used, the number of times to retry before giving up.\n" + } + }, + "description": "The behavior to apply when the container exits. The default is not to\nrestart.\n\nAn ever increasing delay (double the previous delay, starting at 100ms) is\nadded before each restart to prevent flooding the server.\n" + }, + "AutoRemove": { + "type": "boolean", + "description": "Automatically remove the container when the container's process\nexits. This has no effect if `RestartPolicy` is set.\n" + }, + "VolumeDriver": { + "type": "string", + "description": "Driver that this container uses to mount volumes." + }, + "VolumesFrom": { + "type": "array", + "description": "A list of volumes to inherit from another container, specified in\nthe form `[:]`.\n", + "items": { + "type": "string" + } + }, + "Mounts": { + "type": "array", + "description": "Specification for mounts to be added to the container.\n", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "Container path." + }, + "Source": { + "type": "string", + "description": "Mount source (e.g. a volume name, a host path)." + }, + "Type": { + "type": "string", + "description": "The mount type. Available types:\n\n- `bind` Mounts a file or directory from the host into the container. Must exist prior to creating the container.\n- `volume` Creates a volume with the given name and options (or uses a pre-existing volume with the same name and options). These are **not** removed when the container is removed.\n- `tmpfs` Create a tmpfs with the given options. The mount source cannot be specified for tmpfs.\n- `npipe` Mounts a named pipe from the host into the container. Must exist prior to creating the container.\n- `cluster` a Swarm cluster volume\n", + "enum": [ + "bind", + "volume", + "tmpfs", + "npipe", + "cluster" + ] + }, + "ReadOnly": { + "type": "boolean", + "description": "Whether the mount should be read-only." + }, + "Consistency": { + "type": "string", + "description": "The consistency requirement for the mount: `default`, `consistent`, `cached`, or `delegated`." + }, + "BindOptions": { + "type": "object", + "properties": { + "Propagation": { + "type": "string", + "description": "A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`.", + "enum": [ + "private", + "rprivate", + "shared", + "rshared", + "slave", + "rslave" + ] + }, + "NonRecursive": { + "type": "boolean", + "description": "Disable recursive bind mount.", + "default": false + }, + "CreateMountpoint": { + "type": "boolean", + "description": "Create mount point on host if missing", + "default": false + } + }, + "description": "Optional configuration for the `bind` type." + }, + "VolumeOptions": { + "type": "object", + "properties": { + "NoCopy": { + "type": "boolean", + "description": "Populate volume with data from the target.", + "default": false + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "DriverConfig": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver to use to create the volume." + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "key/value map of driver specific options." + } + }, + "description": "Map of driver specific options" + } + }, + "description": "Optional configuration for the `volume` type." + }, + "TmpfsOptions": { + "type": "object", + "properties": { + "SizeBytes": { + "type": "integer", + "description": "The size for the tmpfs mount in bytes.", + "format": "int64" + }, + "Mode": { + "type": "integer", + "description": "The permission mode for the tmpfs mount in an integer." + } + }, + "description": "Optional configuration for the `tmpfs` type." + } + } + } + }, + "ConsoleSize": { + "maxItems": 2, + "minItems": 2, + "type": "array", + "description": "Initial console size, as an `[height, width]` array.\n", + "nullable": true, + "items": { + "minimum": 0, + "type": "integer" + } + }, + "Annotations": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Arbitrary non-identifying metadata attached to container and\nprovided to the runtime when the container is started.\n" + }, + "CapAdd": { + "type": "array", + "description": "A list of kernel capabilities to add to the container. Conflicts\nwith option 'Capabilities'.\n", + "items": { + "type": "string" + } + }, + "CapDrop": { + "type": "array", + "description": "A list of kernel capabilities to drop from the container. Conflicts\nwith option 'Capabilities'.\n", + "items": { + "type": "string" + } + }, + "CgroupnsMode": { + "type": "string", + "description": "cgroup namespace mode for the container. Possible values are:\n\n- `\"private\"`: the container runs in its own private cgroup namespace\n- `\"host\"`: use the host system's cgroup namespace\n\nIf not specified, the daemon default is used, which can either be `\"private\"`\nor `\"host\"`, depending on daemon version, kernel support and configuration.\n", + "enum": [ + "private", + "host" + ] + }, + "Dns": { + "type": "array", + "description": "A list of DNS servers for the container to use.", + "items": { + "type": "string" + } + }, + "DnsOptions": { + "type": "array", + "description": "A list of DNS options.", + "items": { + "type": "string" + } + }, + "DnsSearch": { + "type": "array", + "description": "A list of DNS search domains.", + "items": { + "type": "string" + } + }, + "ExtraHosts": { + "type": "array", + "description": "A list of hostnames/IP mappings to add to the container's `/etc/hosts`\nfile. Specified in the form `[\"hostname:IP\"]`.\n", + "items": { + "type": "string" + } + }, + "GroupAdd": { + "type": "array", + "description": "A list of additional groups that the container process will run as.\n", + "items": { + "type": "string" + } + }, + "IpcMode": { + "type": "string", + "description": "IPC sharing mode for the container. Possible values are:\n\n- `\"none\"`: own private IPC namespace, with /dev/shm not mounted\n- `\"private\"`: own private IPC namespace\n- `\"shareable\"`: own private IPC namespace, with a possibility to share it with other containers\n- `\"container:\"`: join another (shareable) container's IPC namespace\n- `\"host\"`: use the host system's IPC namespace\n\nIf not specified, daemon default is used, which can either be `\"private\"`\nor `\"shareable\"`, depending on daemon version and configuration.\n" + }, + "Cgroup": { + "type": "string", + "description": "Cgroup to use for the container." + }, + "Links": { + "type": "array", + "description": "A list of links for the container in the form `container_name:alias`.\n", + "items": { + "type": "string" + } + }, + "OomScoreAdj": { + "type": "integer", + "description": "An integer value containing the score given to the container in\norder to tune OOM killer preferences.\n", + "example": 500 + }, + "PidMode": { + "type": "string", + "description": "Set the PID (Process) Namespace mode for the container. It can be\neither:\n\n- `\"container:\"`: joins another container's PID namespace\n- `\"host\"`: use the host's PID namespace inside the container\n" + }, + "Privileged": { + "type": "boolean", + "description": "Gives the container full access to the host." + }, + "PublishAllPorts": { + "type": "boolean", + "description": "Allocates an ephemeral host port for all of a container's\nexposed ports.\n\nPorts are de-allocated when the container stops and allocated when\nthe container starts. The allocated port might be changed when\nrestarting the container.\n\nThe port is selected from the ephemeral port range that depends on\nthe kernel. For example, on Linux the range is defined by\n`/proc/sys/net/ipv4/ip_local_port_range`.\n" + }, + "ReadonlyRootfs": { + "type": "boolean", + "description": "Mount the container's root filesystem as read only." + }, + "SecurityOpt": { + "type": "array", + "description": "A list of string values to customize labels for MLS systems, such\nas SELinux.\n", + "items": { + "type": "string" + } + }, + "StorageOpt": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Storage driver options for this container, in the form `{\"size\": \"120G\"}`.\n" + }, + "Tmpfs": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of container directories which should be replaced by tmpfs\nmounts, and their corresponding mount options. For example:\n\n```\n{ \"/run\": \"rw,noexec,nosuid,size=65536k\" }\n```\n" + }, + "UTSMode": { + "type": "string", + "description": "UTS namespace to use for the container." + }, + "UsernsMode": { + "type": "string", + "description": "Sets the usernamespace mode for the container when usernamespace\nremapping option is enabled.\n" + }, + "ShmSize": { + "minimum": 0, + "type": "integer", + "description": "Size of `/dev/shm` in bytes. If omitted, the system uses 64MB.\n", + "format": "int64" + }, + "Sysctls": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A list of kernel parameters (sysctls) to set in the container.\nFor example:\n\n```\n{\"net.ipv4.ip_forward\": \"1\"}\n```\n" + }, + "Runtime": { + "type": "string", + "description": "Runtime to use with this container." + }, + "Isolation": { + "type": "string", + "description": "Isolation technology of the container. (Windows only)\n", + "enum": [ + "default", + "process", + "hyperv", + "" + ] + }, + "MaskedPaths": { + "type": "array", + "description": "The list of paths to be masked inside the container (this overrides\nthe default set of paths).\n", + "items": { + "type": "string" + } + }, + "ReadonlyPaths": { + "type": "array", + "description": "The list of paths to be set as read-only inside the container\n(this overrides the default set of paths).\n", + "items": { + "type": "string" + } + } + } + } + ] + }, + "NetworkingConfig": { + "type": "object", + "properties": { + "EndpointsConfig": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "IPAMConfig": { + "type": "object", + "properties": { + "IPv4Address": { + "type": "string", + "example": "172.20.30.33" + }, + "IPv6Address": { + "type": "string", + "example": "2001:db8:abcd::3033" + }, + "LinkLocalIPs": { + "type": "array", + "example": [ + "169.254.34.68", + "fe80::3468" + ], + "items": { + "type": "string" + } + } + }, + "description": "EndpointIPAMConfig represents an endpoint's IPAM configuration.\n", + "nullable": true, + "x-nullable": true + }, + "Links": { + "type": "array", + "example": [ + "container_1", + "container_2" + ], + "items": { + "type": "string" + } + }, + "Aliases": { + "type": "array", + "example": [ + "server_x", + "server_y" + ], + "items": { + "type": "string" + } + }, + "NetworkID": { + "type": "string", + "description": "Unique ID of the network.\n", + "example": "08754567f1f40222263eab4102e1c733ae697e8e354aa9cd6e18d7402835292a" + }, + "EndpointID": { + "type": "string", + "description": "Unique ID for the service endpoint in a Sandbox.\n", + "example": "b88f5b905aabf2893f3cbc4ee42d1ea7980bbc0a92e2c8922b1e1795298afb0b" + }, + "Gateway": { + "type": "string", + "description": "Gateway address for this network.\n", + "example": "172.17.0.1" + }, + "IPAddress": { + "type": "string", + "description": "IPv4 address.\n", + "example": "172.17.0.4" + }, + "IPPrefixLen": { + "type": "integer", + "description": "Mask length of the IPv4 address.\n", + "example": 16 + }, + "IPv6Gateway": { + "type": "string", + "description": "IPv6 gateway address.\n", + "example": "2001:db8:2::100" + }, + "GlobalIPv6Address": { + "type": "string", + "description": "Global IPv6 address.\n", + "example": "2001:db8::5689" + }, + "GlobalIPv6PrefixLen": { + "type": "integer", + "description": "Mask length of the global IPv6 address.\n", + "format": "int64", + "example": 64 + }, + "MacAddress": { + "type": "string", + "description": "MAC address for the endpoint on this network.\n", + "example": "02:42:ac:11:00:04" + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "DriverOpts is a mapping of driver options and values. These options\nare passed directly to the driver and are driver specific.\n", + "nullable": true, + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + } + }, + "description": "Configuration for a network endpoint." + }, + "description": "A mapping of network name to endpoint configuration for that network.\n" + } + }, + "description": "NetworkingConfig represents the container's networking configuration for\neach of its interfaces.\nIt is used for the networking configs specified in the `docker create`\nand `docker network connect` commands.\n", + "example": { + "EndpointsConfig": { + "isolated_nw": { + "IPAMConfig": { + "IPv4Address": "172.20.30.33", + "IPv6Address": "2001:db8:abcd::3033", + "LinkLocalIPs": [ + "169.254.34.68", + "fe80::3468" + ] + }, + "Links": [ + "container_1", + "container_2" + ], + "Aliases": [ + "server_x", + "server_y" + ] + } + } + } + } + } + } + ] + } + }, + "application/octet-stream": { + "schema": { + "allOf": [ + { + "type": "object", + "properties": { + "Hostname": { + "type": "string", + "description": "The hostname to use for the container, as a valid RFC 1123 hostname.\n", + "example": "439f4e91bd1d" + }, + "Domainname": { + "type": "string", + "description": "The domain name to use for the container.\n" + }, + "User": { + "type": "string", + "description": "The user that commands are run as inside the container." + }, + "AttachStdin": { + "type": "boolean", + "description": "Whether to attach to `stdin`.", + "default": false + }, + "AttachStdout": { + "type": "boolean", + "description": "Whether to attach to `stdout`.", + "default": true + }, + "AttachStderr": { + "type": "boolean", + "description": "Whether to attach to `stderr`.", + "default": true + }, + "ExposedPorts": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": {} + }, + "description": "An object mapping ports to an empty object in the form:\n\n`{\"/\": {}}`\n", + "nullable": true, + "example": { + "80/tcp": {}, + "443/tcp": {} + } + }, + "Tty": { + "type": "boolean", + "description": "Attach standard streams to a TTY, including `stdin` if it is not closed.\n", + "default": false + }, + "OpenStdin": { + "type": "boolean", + "description": "Open `stdin`", + "default": false + }, + "StdinOnce": { + "type": "boolean", + "description": "Close `stdin` after one attached client disconnects", + "default": false + }, + "Env": { + "type": "array", + "description": "A list of environment variables to set inside the container in the\nform `[\"VAR=value\", ...]`. A variable without `=` is removed from the\nenvironment, rather than to have an empty value.\n", + "example": [ + "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + ], + "items": { + "type": "string" + } + }, + "Cmd": { + "type": "array", + "description": "Command to run specified as a string or an array of strings.\n", + "example": [ + "/bin/sh" + ], + "items": { + "type": "string" + } + }, + "Healthcheck": { + "type": "object", + "properties": { + "Test": { + "type": "array", + "description": "The test to perform. Possible values are:\n\n- `[]` inherit healthcheck from image or parent image\n- `[\"NONE\"]` disable healthcheck\n- `[\"CMD\", args...]` exec arguments directly\n- `[\"CMD-SHELL\", command]` run command with system's default shell\n", + "items": { + "type": "string" + } + }, + "Interval": { + "type": "integer", + "description": "The time to wait between checks in nanoseconds. It should be 0 or at\nleast 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Timeout": { + "type": "integer", + "description": "The time to wait before considering the check to have hung. It should\nbe 0 or at least 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Retries": { + "type": "integer", + "description": "The number of consecutive failures needed to consider a container as\nunhealthy. 0 means inherit.\n" + }, + "StartPeriod": { + "type": "integer", + "description": "Start period for the container to initialize before starting\nhealth-retries countdown in nanoseconds. It should be 0 or at least\n1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + } + }, + "description": "A test to perform to check that the container is healthy." + }, + "ArgsEscaped": { + "type": "boolean", + "description": "Command is already escaped (Windows only)", + "nullable": true, + "example": false, + "default": false + }, + "Image": { + "type": "string", + "description": "The name (or reference) of the image to use when creating the container,\nor which was used when the container was created.\n", + "example": "example-image:1.0" + }, + "Volumes": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": {} + }, + "description": "An object mapping mount point paths inside the container to empty\nobjects.\n" + }, + "WorkingDir": { + "type": "string", + "description": "The working directory for commands to run in.", + "example": "/public/" + }, + "Entrypoint": { + "type": "array", + "description": "The entry point for the container as a string or an array of strings.\n\nIf the array consists of exactly one empty string (`[\"\"]`) then the\nentry point is reset to system default (i.e., the entry point used by\ndocker when there is no `ENTRYPOINT` instruction in the `Dockerfile`).\n", + "example": [], + "items": { + "type": "string" + } + }, + "NetworkDisabled": { + "type": "boolean", + "description": "Disable networking for the container.", + "nullable": true + }, + "MacAddress": { + "type": "string", + "description": "MAC address of the container.", + "nullable": true + }, + "OnBuild": { + "type": "array", + "description": "`ONBUILD` metadata that were defined in the image's `Dockerfile`.\n", + "nullable": true, + "example": [], + "items": { + "type": "string" + } + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "StopSignal": { + "type": "string", + "description": "Signal to stop a container as a string or unsigned integer.\n", + "nullable": true, + "example": "SIGTERM" + }, + "StopTimeout": { + "type": "integer", + "description": "Timeout to stop a container in seconds.", + "nullable": true + }, + "Shell": { + "type": "array", + "description": "Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell.\n", + "nullable": true, + "example": [ + "/bin/sh", + "-c" + ], + "items": { + "type": "string" + } + } + }, + "description": "Configuration for a container that is portable between hosts.\n\nWhen used as `ContainerConfig` field in an image, `ContainerConfig` is an\noptional field containing the configuration of the container that was last\ncommitted when creating the image.\n\nPrevious versions of Docker builder used this field to store build cache,\nand it is not in active use anymore.\n" + }, + { + "type": "object", + "properties": { + "HostConfig": { + "description": "Container configuration that depends on the host we are running on", + "allOf": [ + { + "type": "object", + "properties": { + "CpuShares": { + "type": "integer", + "description": "An integer value representing this container's relative CPU weight\nversus other containers.\n" + }, + "Memory": { + "type": "integer", + "description": "Memory limit in bytes.", + "format": "int64", + "default": 0 + }, + "CgroupParent": { + "type": "string", + "description": "Path to `cgroups` under which the container's `cgroup` is created. If\nthe path is not absolute, the path is considered to be relative to the\n`cgroups` path of the init process. Cgroups are created if they do not\nalready exist.\n" + }, + "BlkioWeight": { + "maximum": 1000, + "minimum": 0, + "type": "integer", + "description": "Block IO weight (relative weight)." + }, + "BlkioWeightDevice": { + "type": "array", + "description": "Block IO weight (relative device weight) in the form:\n\n```\n[{\"Path\": \"device_path\", \"Weight\": weight}]\n```\n", + "items": { + "type": "object", + "properties": { + "Path": { + "type": "string" + }, + "Weight": { + "minimum": 0, + "type": "integer" + } + } + } + }, + "BlkioDeviceReadBps": { + "type": "array", + "description": "Limit read rate (bytes per second) from a device, in the form:\n\n```\n[{\"Path\": \"device_path\", \"Rate\": rate}]\n```\n", + "items": { + "type": "object", + "properties": { + "Path": { + "type": "string", + "description": "Device path" + }, + "Rate": { + "minimum": 0, + "type": "integer", + "description": "Rate", + "format": "int64" + } + } + } + }, + "BlkioDeviceWriteBps": { + "type": "array", + "description": "Limit write rate (bytes per second) to a device, in the form:\n\n```\n[{\"Path\": \"device_path\", \"Rate\": rate}]\n```\n", + "items": { + "type": "object", + "properties": { + "Path": { + "type": "string", + "description": "Device path" + }, + "Rate": { + "minimum": 0, + "type": "integer", + "description": "Rate", + "format": "int64" + } + } + } + }, + "BlkioDeviceReadIOps": { + "type": "array", + "description": "Limit read rate (IO per second) from a device, in the form:\n\n```\n[{\"Path\": \"device_path\", \"Rate\": rate}]\n```\n", + "items": { + "type": "object", + "properties": { + "Path": { + "type": "string", + "description": "Device path" + }, + "Rate": { + "minimum": 0, + "type": "integer", + "description": "Rate", + "format": "int64" + } + } + } + }, + "BlkioDeviceWriteIOps": { + "type": "array", + "description": "Limit write rate (IO per second) to a device, in the form:\n\n```\n[{\"Path\": \"device_path\", \"Rate\": rate}]\n```\n", + "items": { + "type": "object", + "properties": { + "Path": { + "type": "string", + "description": "Device path" + }, + "Rate": { + "minimum": 0, + "type": "integer", + "description": "Rate", + "format": "int64" + } + } + } + }, + "CpuPeriod": { + "type": "integer", + "description": "The length of a CPU period in microseconds.", + "format": "int64" + }, + "CpuQuota": { + "type": "integer", + "description": "Microseconds of CPU time that the container can get in a CPU period.\n", + "format": "int64" + }, + "CpuRealtimePeriod": { + "type": "integer", + "description": "The length of a CPU real-time period in microseconds. Set to 0 to\nallocate no time allocated to real-time tasks.\n", + "format": "int64" + }, + "CpuRealtimeRuntime": { + "type": "integer", + "description": "The length of a CPU real-time runtime in microseconds. Set to 0 to\nallocate no time allocated to real-time tasks.\n", + "format": "int64" + }, + "CpusetCpus": { + "type": "string", + "description": "CPUs in which to allow execution (e.g., `0-3`, `0,1`).\n", + "example": "0-3" + }, + "CpusetMems": { + "type": "string", + "description": "Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only\neffective on NUMA systems.\n" + }, + "Devices": { + "type": "array", + "description": "A list of devices to add to the container.", + "items": { + "type": "object", + "properties": { + "PathOnHost": { + "type": "string" + }, + "PathInContainer": { + "type": "string" + }, + "CgroupPermissions": { + "type": "string" + } + }, + "description": "A device mapping between the host and container", + "example": { + "PathOnHost": "/dev/deviceName", + "PathInContainer": "/dev/deviceName", + "CgroupPermissions": "mrw" + } + } + }, + "DeviceCgroupRules": { + "type": "array", + "description": "a list of cgroup rules to apply to the container", + "items": { + "type": "string", + "example": "c 13:* rwm" + } + }, + "DeviceRequests": { + "type": "array", + "description": "A list of requests for devices to be sent to device drivers.\n", + "items": { + "type": "object", + "properties": { + "Driver": { + "type": "string", + "example": "nvidia" + }, + "Count": { + "type": "integer", + "example": -1 + }, + "DeviceIDs": { + "type": "array", + "example": [ + "0", + "1", + "GPU-fef8089b-4820-abfc-e83e-94318197576e" + ], + "items": { + "type": "string" + } + }, + "Capabilities": { + "type": "array", + "description": "A list of capabilities; an OR list of AND lists of capabilities.\n", + "example": [ + [ + "gpu", + "nvidia", + "compute" + ] + ], + "items": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver-specific options, specified as a key/value pairs. These options\nare passed directly to the driver.\n" + } + }, + "description": "A request for devices to be sent to device drivers" + } + }, + "KernelMemoryTCP": { + "type": "integer", + "description": "Hard limit for kernel TCP buffer memory (in bytes). Depending on the\nOCI runtime in use, this option may be ignored. It is no longer supported\nby the default (runc) runtime.\n\nThis field is omitted when empty.\n", + "format": "int64" + }, + "MemoryReservation": { + "type": "integer", + "description": "Memory soft limit in bytes.", + "format": "int64" + }, + "MemorySwap": { + "type": "integer", + "description": "Total memory limit (memory + swap). Set as `-1` to enable unlimited\nswap.\n", + "format": "int64" + }, + "MemorySwappiness": { + "maximum": 100, + "minimum": 0, + "type": "integer", + "description": "Tune a container's memory swappiness behavior. Accepts an integer\nbetween 0 and 100.\n", + "format": "int64" + }, + "NanoCpus": { + "type": "integer", + "description": "CPU quota in units of 10-9 CPUs.", + "format": "int64" + }, + "OomKillDisable": { + "type": "boolean", + "description": "Disable OOM Killer for the container." + }, + "Init": { + "type": "boolean", + "description": "Run an init inside the container that forwards signals and reaps\nprocesses. This field is omitted if empty, and the default (as\nconfigured on the daemon) is used.\n", + "nullable": true + }, + "PidsLimit": { + "type": "integer", + "description": "Tune a container's PIDs limit. Set `0` or `-1` for unlimited, or `null`\nto not change.\n", + "format": "int64", + "nullable": true + }, + "Ulimits": { + "type": "array", + "description": "A list of resource limits to set in the container. For example:\n\n```\n{\"Name\": \"nofile\", \"Soft\": 1024, \"Hard\": 2048}\n```\n", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of ulimit" + }, + "Soft": { + "type": "integer", + "description": "Soft limit" + }, + "Hard": { + "type": "integer", + "description": "Hard limit" + } + } + } + }, + "CpuCount": { + "type": "integer", + "description": "The number of usable CPUs (Windows only).\n\nOn Windows Server containers, the processor resource controls are\nmutually exclusive. The order of precedence is `CPUCount` first, then\n`CPUShares`, and `CPUPercent` last.\n", + "format": "int64" + }, + "CpuPercent": { + "type": "integer", + "description": "The usable percentage of the available CPUs (Windows only).\n\nOn Windows Server containers, the processor resource controls are\nmutually exclusive. The order of precedence is `CPUCount` first, then\n`CPUShares`, and `CPUPercent` last.\n", + "format": "int64" + }, + "IOMaximumIOps": { + "type": "integer", + "description": "Maximum IOps for the container system drive (Windows only)", + "format": "int64" + }, + "IOMaximumBandwidth": { + "type": "integer", + "description": "Maximum IO in bytes per second for the container system drive\n(Windows only).\n", + "format": "int64" + } + }, + "description": "A container's resources (cgroups config, ulimits, etc)" + }, + { + "type": "object", + "properties": { + "Binds": { + "type": "array", + "description": "A list of volume bindings for this container. Each volume binding\nis a string in one of these forms:\n\n- `host-src:container-dest[:options]` to bind-mount a host path\n into the container. Both `host-src`, and `container-dest` must\n be an _absolute_ path.\n- `volume-name:container-dest[:options]` to bind-mount a volume\n managed by a volume driver into the container. `container-dest`\n must be an _absolute_ path.\n\n`options` is an optional, comma-delimited list of:\n\n- `nocopy` disables automatic copying of data from the container\n path to the volume. The `nocopy` flag only applies to named volumes.\n- `[ro|rw]` mounts a volume read-only or read-write, respectively.\n If omitted or set to `rw`, volumes are mounted read-write.\n- `[z|Z]` applies SELinux labels to allow or deny multiple containers\n to read and write to the same volume.\n - `z`: a _shared_ content label is applied to the content. This\n label indicates that multiple containers can share the volume\n content, for both reading and writing.\n - `Z`: a _private unshared_ label is applied to the content.\n This label indicates that only the current container can use\n a private volume. Labeling systems such as SELinux require\n proper labels to be placed on volume content that is mounted\n into a container. Without a label, the security system can\n prevent a container's processes from using the content. By\n default, the labels set by the host operating system are not\n modified.\n- `[[r]shared|[r]slave|[r]private]` specifies mount\n [propagation behavior](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt).\n This only applies to bind-mounted volumes, not internal volumes\n or named volumes. Mount propagation requires the source mount\n point (the location where the source directory is mounted in the\n host operating system) to have the correct propagation properties.\n For shared volumes, the source mount point must be set to `shared`.\n For slave volumes, the mount must be set to either `shared` or\n `slave`.\n", + "items": { + "type": "string" + } + }, + "ContainerIDFile": { + "type": "string", + "description": "Path to a file where the container ID is written" + }, + "LogConfig": { + "type": "object", + "properties": { + "Type": { + "type": "string", + "enum": [ + "json-file", + "syslog", + "journald", + "gelf", + "fluentd", + "awslogs", + "splunk", + "etwlogs", + "none" + ] + }, + "Config": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "description": "The logging configuration for this container" + }, + "NetworkMode": { + "type": "string", + "description": "Network mode to use for this container. Supported standard values\nare: `bridge`, `host`, `none`, and `container:`. Any\nother value is taken as a custom network's name to which this\ncontainer should connect to.\n" + }, + "PortBindings": { + "type": "object", + "additionalProperties": { + "type": "array", + "nullable": true, + "items": { + "type": "object", + "properties": { + "HostIp": { + "type": "string", + "description": "Host IP address that the container's port is mapped to.", + "example": "127.0.0.1" + }, + "HostPort": { + "type": "string", + "description": "Host port number that the container's port is mapped to.", + "example": "4443" + } + }, + "description": "PortBinding represents a binding between a host IP address and a host\nport.\n" + } + }, + "description": "PortMap describes the mapping of container ports to host ports, using the\ncontainer's port-number and protocol as key in the format `/`,\nfor example, `80/udp`.\n\nIf a container's port is mapped for multiple protocols, separate entries\nare added to the mapping table.\n", + "example": { + "443/tcp": [ + { + "HostIp": "127.0.0.1", + "HostPort": "4443" + } + ], + "80/tcp": [ + { + "HostIp": "0.0.0.0", + "HostPort": "80" + }, + { + "HostIp": "0.0.0.0", + "HostPort": "8080" + } + ], + "80/udp": [ + { + "HostIp": "0.0.0.0", + "HostPort": "80" + } + ], + "53/udp": [ + { + "HostIp": "0.0.0.0", + "HostPort": "53" + } + ] + } + }, + "RestartPolicy": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "- Empty string means not to restart\n- `no` Do not automatically restart\n- `always` Always restart\n- `unless-stopped` Restart always except when the user has manually stopped the container\n- `on-failure` Restart only when the container exit code is non-zero\n", + "enum": [ + "", + "no", + "always", + "unless-stopped", + "on-failure" + ] + }, + "MaximumRetryCount": { + "type": "integer", + "description": "If `on-failure` is used, the number of times to retry before giving up.\n" + } + }, + "description": "The behavior to apply when the container exits. The default is not to\nrestart.\n\nAn ever increasing delay (double the previous delay, starting at 100ms) is\nadded before each restart to prevent flooding the server.\n" + }, + "AutoRemove": { + "type": "boolean", + "description": "Automatically remove the container when the container's process\nexits. This has no effect if `RestartPolicy` is set.\n" + }, + "VolumeDriver": { + "type": "string", + "description": "Driver that this container uses to mount volumes." + }, + "VolumesFrom": { + "type": "array", + "description": "A list of volumes to inherit from another container, specified in\nthe form `[:]`.\n", + "items": { + "type": "string" + } + }, + "Mounts": { + "type": "array", + "description": "Specification for mounts to be added to the container.\n", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "Container path." + }, + "Source": { + "type": "string", + "description": "Mount source (e.g. a volume name, a host path)." + }, + "Type": { + "type": "string", + "description": "The mount type. Available types:\n\n- `bind` Mounts a file or directory from the host into the container. Must exist prior to creating the container.\n- `volume` Creates a volume with the given name and options (or uses a pre-existing volume with the same name and options). These are **not** removed when the container is removed.\n- `tmpfs` Create a tmpfs with the given options. The mount source cannot be specified for tmpfs.\n- `npipe` Mounts a named pipe from the host into the container. Must exist prior to creating the container.\n- `cluster` a Swarm cluster volume\n", + "enum": [ + "bind", + "volume", + "tmpfs", + "npipe", + "cluster" + ] + }, + "ReadOnly": { + "type": "boolean", + "description": "Whether the mount should be read-only." + }, + "Consistency": { + "type": "string", + "description": "The consistency requirement for the mount: `default`, `consistent`, `cached`, or `delegated`." + }, + "BindOptions": { + "type": "object", + "properties": { + "Propagation": { + "type": "string", + "description": "A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`.", + "enum": [ + "private", + "rprivate", + "shared", + "rshared", + "slave", + "rslave" + ] + }, + "NonRecursive": { + "type": "boolean", + "description": "Disable recursive bind mount.", + "default": false + }, + "CreateMountpoint": { + "type": "boolean", + "description": "Create mount point on host if missing", + "default": false + } + }, + "description": "Optional configuration for the `bind` type." + }, + "VolumeOptions": { + "type": "object", + "properties": { + "NoCopy": { + "type": "boolean", + "description": "Populate volume with data from the target.", + "default": false + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "DriverConfig": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver to use to create the volume." + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "key/value map of driver specific options." + } + }, + "description": "Map of driver specific options" + } + }, + "description": "Optional configuration for the `volume` type." + }, + "TmpfsOptions": { + "type": "object", + "properties": { + "SizeBytes": { + "type": "integer", + "description": "The size for the tmpfs mount in bytes.", + "format": "int64" + }, + "Mode": { + "type": "integer", + "description": "The permission mode for the tmpfs mount in an integer." + } + }, + "description": "Optional configuration for the `tmpfs` type." + } + } + } + }, + "ConsoleSize": { + "maxItems": 2, + "minItems": 2, + "type": "array", + "description": "Initial console size, as an `[height, width]` array.\n", + "nullable": true, + "items": { + "minimum": 0, + "type": "integer" + } + }, + "Annotations": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Arbitrary non-identifying metadata attached to container and\nprovided to the runtime when the container is started.\n" + }, + "CapAdd": { + "type": "array", + "description": "A list of kernel capabilities to add to the container. Conflicts\nwith option 'Capabilities'.\n", + "items": { + "type": "string" + } + }, + "CapDrop": { + "type": "array", + "description": "A list of kernel capabilities to drop from the container. Conflicts\nwith option 'Capabilities'.\n", + "items": { + "type": "string" + } + }, + "CgroupnsMode": { + "type": "string", + "description": "cgroup namespace mode for the container. Possible values are:\n\n- `\"private\"`: the container runs in its own private cgroup namespace\n- `\"host\"`: use the host system's cgroup namespace\n\nIf not specified, the daemon default is used, which can either be `\"private\"`\nor `\"host\"`, depending on daemon version, kernel support and configuration.\n", + "enum": [ + "private", + "host" + ] + }, + "Dns": { + "type": "array", + "description": "A list of DNS servers for the container to use.", + "items": { + "type": "string" + } + }, + "DnsOptions": { + "type": "array", + "description": "A list of DNS options.", + "items": { + "type": "string" + } + }, + "DnsSearch": { + "type": "array", + "description": "A list of DNS search domains.", + "items": { + "type": "string" + } + }, + "ExtraHosts": { + "type": "array", + "description": "A list of hostnames/IP mappings to add to the container's `/etc/hosts`\nfile. Specified in the form `[\"hostname:IP\"]`.\n", + "items": { + "type": "string" + } + }, + "GroupAdd": { + "type": "array", + "description": "A list of additional groups that the container process will run as.\n", + "items": { + "type": "string" + } + }, + "IpcMode": { + "type": "string", + "description": "IPC sharing mode for the container. Possible values are:\n\n- `\"none\"`: own private IPC namespace, with /dev/shm not mounted\n- `\"private\"`: own private IPC namespace\n- `\"shareable\"`: own private IPC namespace, with a possibility to share it with other containers\n- `\"container:\"`: join another (shareable) container's IPC namespace\n- `\"host\"`: use the host system's IPC namespace\n\nIf not specified, daemon default is used, which can either be `\"private\"`\nor `\"shareable\"`, depending on daemon version and configuration.\n" + }, + "Cgroup": { + "type": "string", + "description": "Cgroup to use for the container." + }, + "Links": { + "type": "array", + "description": "A list of links for the container in the form `container_name:alias`.\n", + "items": { + "type": "string" + } + }, + "OomScoreAdj": { + "type": "integer", + "description": "An integer value containing the score given to the container in\norder to tune OOM killer preferences.\n", + "example": 500 + }, + "PidMode": { + "type": "string", + "description": "Set the PID (Process) Namespace mode for the container. It can be\neither:\n\n- `\"container:\"`: joins another container's PID namespace\n- `\"host\"`: use the host's PID namespace inside the container\n" + }, + "Privileged": { + "type": "boolean", + "description": "Gives the container full access to the host." + }, + "PublishAllPorts": { + "type": "boolean", + "description": "Allocates an ephemeral host port for all of a container's\nexposed ports.\n\nPorts are de-allocated when the container stops and allocated when\nthe container starts. The allocated port might be changed when\nrestarting the container.\n\nThe port is selected from the ephemeral port range that depends on\nthe kernel. For example, on Linux the range is defined by\n`/proc/sys/net/ipv4/ip_local_port_range`.\n" + }, + "ReadonlyRootfs": { + "type": "boolean", + "description": "Mount the container's root filesystem as read only." + }, + "SecurityOpt": { + "type": "array", + "description": "A list of string values to customize labels for MLS systems, such\nas SELinux.\n", + "items": { + "type": "string" + } + }, + "StorageOpt": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Storage driver options for this container, in the form `{\"size\": \"120G\"}`.\n" + }, + "Tmpfs": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of container directories which should be replaced by tmpfs\nmounts, and their corresponding mount options. For example:\n\n```\n{ \"/run\": \"rw,noexec,nosuid,size=65536k\" }\n```\n" + }, + "UTSMode": { + "type": "string", + "description": "UTS namespace to use for the container." + }, + "UsernsMode": { + "type": "string", + "description": "Sets the usernamespace mode for the container when usernamespace\nremapping option is enabled.\n" + }, + "ShmSize": { + "minimum": 0, + "type": "integer", + "description": "Size of `/dev/shm` in bytes. If omitted, the system uses 64MB.\n", + "format": "int64" + }, + "Sysctls": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A list of kernel parameters (sysctls) to set in the container.\nFor example:\n\n```\n{\"net.ipv4.ip_forward\": \"1\"}\n```\n" + }, + "Runtime": { + "type": "string", + "description": "Runtime to use with this container." + }, + "Isolation": { + "type": "string", + "description": "Isolation technology of the container. (Windows only)\n", + "enum": [ + "default", + "process", + "hyperv", + "" + ] + }, + "MaskedPaths": { + "type": "array", + "description": "The list of paths to be masked inside the container (this overrides\nthe default set of paths).\n", + "items": { + "type": "string" + } + }, + "ReadonlyPaths": { + "type": "array", + "description": "The list of paths to be set as read-only inside the container\n(this overrides the default set of paths).\n", + "items": { + "type": "string" + } + } + } + } + ] + }, + "NetworkingConfig": { + "type": "object", + "properties": { + "EndpointsConfig": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "IPAMConfig": { + "type": "object", + "properties": { + "IPv4Address": { + "type": "string", + "example": "172.20.30.33" + }, + "IPv6Address": { + "type": "string", + "example": "2001:db8:abcd::3033" + }, + "LinkLocalIPs": { + "type": "array", + "example": [ + "169.254.34.68", + "fe80::3468" + ], + "items": { + "type": "string" + } + } + }, + "description": "EndpointIPAMConfig represents an endpoint's IPAM configuration.\n", + "nullable": true, + "x-nullable": true + }, + "Links": { + "type": "array", + "example": [ + "container_1", + "container_2" + ], + "items": { + "type": "string" + } + }, + "Aliases": { + "type": "array", + "example": [ + "server_x", + "server_y" + ], + "items": { + "type": "string" + } + }, + "NetworkID": { + "type": "string", + "description": "Unique ID of the network.\n", + "example": "08754567f1f40222263eab4102e1c733ae697e8e354aa9cd6e18d7402835292a" + }, + "EndpointID": { + "type": "string", + "description": "Unique ID for the service endpoint in a Sandbox.\n", + "example": "b88f5b905aabf2893f3cbc4ee42d1ea7980bbc0a92e2c8922b1e1795298afb0b" + }, + "Gateway": { + "type": "string", + "description": "Gateway address for this network.\n", + "example": "172.17.0.1" + }, + "IPAddress": { + "type": "string", + "description": "IPv4 address.\n", + "example": "172.17.0.4" + }, + "IPPrefixLen": { + "type": "integer", + "description": "Mask length of the IPv4 address.\n", + "example": 16 + }, + "IPv6Gateway": { + "type": "string", + "description": "IPv6 gateway address.\n", + "example": "2001:db8:2::100" + }, + "GlobalIPv6Address": { + "type": "string", + "description": "Global IPv6 address.\n", + "example": "2001:db8::5689" + }, + "GlobalIPv6PrefixLen": { + "type": "integer", + "description": "Mask length of the global IPv6 address.\n", + "format": "int64", + "example": 64 + }, + "MacAddress": { + "type": "string", + "description": "MAC address for the endpoint on this network.\n", + "example": "02:42:ac:11:00:04" + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "DriverOpts is a mapping of driver options and values. These options\nare passed directly to the driver and are driver specific.\n", + "nullable": true, + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + } + }, + "description": "Configuration for a network endpoint." + }, + "description": "A mapping of network name to endpoint configuration for that network.\n" + } + }, + "description": "NetworkingConfig represents the container's networking configuration for\neach of its interfaces.\nIt is used for the networking configs specified in the `docker create`\nand `docker network connect` commands.\n", + "example": { + "EndpointsConfig": { + "isolated_nw": { + "IPAMConfig": { + "IPv4Address": "172.20.30.33", + "IPv6Address": "2001:db8:abcd::3033", + "LinkLocalIPs": [ + "169.254.34.68", + "fe80::3468" + ] + }, + "Links": [ + "container_1", + "container_2" + ], + "Aliases": [ + "server_x", + "server_y" + ] + } + } + } + } + } + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "Container created successfully", + "content": { + "application/json": { + "schema": { + "title": "ContainerCreateResponse", + "required": [ + "Id", + "Warnings" + ], + "type": "object", + "properties": { + "Id": { + "type": "string", + "description": "The ID of the created container", + "nullable": false, + "example": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743" + }, + "Warnings": { + "type": "array", + "description": "Warnings encountered when creating the container", + "nullable": false, + "example": [], + "items": { + "type": "string" + } + } + }, + "description": "OK response to ContainerCreate operation", + "x-go-name": "CreateResponse" + } + } + } + }, + "400": { + "description": "bad parameter", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "404": { + "description": "no such image", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + }, + "example": { + "message": "No such image: c2ada9df5af8" + } + } + } + }, + "409": { + "description": "conflict", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + }, + "x-codegen-request-body-name": "body" + } + }, + "/containers/{id}/json": { + "get": { + "tags": [ + "Container" + ], + "summary": "Inspect a container", + "description": "Return low-level information about a container.", + "operationId": "ContainerInspect", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID or name of the container", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "size", + "in": "query", + "description": "Return the size of container as fields `SizeRw` and `SizeRootFs`", + "schema": { + "type": "boolean", + "default": false + } + } + ], + "responses": { + "200": { + "description": "no error", + "content": { + "application/json": { + "schema": { + "title": "ContainerInspectResponse", + "type": "object", + "properties": { + "Id": { + "type": "string", + "description": "The ID of the container" + }, + "Created": { + "type": "string", + "description": "The time the container was created" + }, + "Path": { + "type": "string", + "description": "The path to the command being run" + }, + "Args": { + "type": "array", + "description": "The arguments to the command being run", + "items": { + "type": "string" + } + }, + "State": { + "type": "object", + "properties": { + "Status": { + "type": "string", + "description": "String representation of the container state. Can be one of \"created\",\n\"running\", \"paused\", \"restarting\", \"removing\", \"exited\", or \"dead\".\n", + "example": "running", + "enum": [ + "created", + "running", + "paused", + "restarting", + "removing", + "exited", + "dead" + ] + }, + "Running": { + "type": "boolean", + "description": "Whether this container is running.\n\nNote that a running container can be _paused_. The `Running` and `Paused`\nbooleans are not mutually exclusive:\n\nWhen pausing a container (on Linux), the freezer cgroup is used to suspend\nall processes in the container. Freezing the process requires the process to\nbe running. As a result, paused containers are both `Running` _and_ `Paused`.\n\nUse the `Status` field instead to determine if a container's state is \"running\".\n", + "example": true + }, + "Paused": { + "type": "boolean", + "description": "Whether this container is paused.", + "example": false + }, + "Restarting": { + "type": "boolean", + "description": "Whether this container is restarting.", + "example": false + }, + "OOMKilled": { + "type": "boolean", + "description": "Whether a process within this container has been killed because it ran\nout of memory since the container was last started.\n", + "example": false + }, + "Dead": { + "type": "boolean", + "example": false + }, + "Pid": { + "type": "integer", + "description": "The process ID of this container", + "example": 1234 + }, + "ExitCode": { + "type": "integer", + "description": "The last exit code of this container", + "example": 0 + }, + "Error": { + "type": "string" + }, + "StartedAt": { + "type": "string", + "description": "The time when this container was last started.", + "example": "2020-01-06T09:06:59.461876391Z" + }, + "FinishedAt": { + "type": "string", + "description": "The time when this container last exited.", + "example": "2020-01-06T09:07:59.461876391Z" + }, + "Health": { + "type": "object", + "properties": { + "Status": { + "type": "string", + "description": "Status is one of `none`, `starting`, `healthy` or `unhealthy`\n\n- \"none\" Indicates there is no healthcheck\n- \"starting\" Starting indicates that the container is not yet ready\n- \"healthy\" Healthy indicates that the container is running correctly\n- \"unhealthy\" Unhealthy indicates that the container has a problem\n", + "example": "healthy", + "enum": [ + "none", + "starting", + "healthy", + "unhealthy" + ] + }, + "FailingStreak": { + "type": "integer", + "description": "FailingStreak is the number of consecutive failures", + "example": 0 + }, + "Log": { + "type": "array", + "description": "Log contains the last few results (oldest first)\n", + "items": { + "type": "object", + "properties": { + "Start": { + "type": "string", + "description": "Date and time at which this check started in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "date-time", + "example": "2020-01-04T10:44:24.496525531Z" + }, + "End": { + "type": "string", + "description": "Date and time at which this check ended in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2020-01-04T10:45:21.364524523Z" + }, + "ExitCode": { + "type": "integer", + "description": "ExitCode meanings:\n\n- `0` healthy\n- `1` unhealthy\n- `2` reserved (considered unhealthy)\n- other values: error running probe\n", + "example": 0 + }, + "Output": { + "type": "string", + "description": "Output from last check" + } + }, + "description": "HealthcheckResult stores information about a single run of a healthcheck probe\n", + "nullable": true, + "x-nullable": true + } + } + }, + "description": "Health stores information about the container's healthcheck results.\n", + "nullable": true, + "x-nullable": true + } + }, + "description": "ContainerState stores container's running state. It's part of ContainerJSONBase\nand will be returned by the \"inspect\" command.\n", + "nullable": true, + "x-nullable": true + }, + "Image": { + "type": "string", + "description": "The container's image ID" + }, + "ResolvConfPath": { + "type": "string" + }, + "HostnamePath": { + "type": "string" + }, + "HostsPath": { + "type": "string" + }, + "LogPath": { + "type": "string" + }, + "Name": { + "type": "string" + }, + "RestartCount": { + "type": "integer" + }, + "Driver": { + "type": "string" + }, + "Platform": { + "type": "string" + }, + "MountLabel": { + "type": "string" + }, + "ProcessLabel": { + "type": "string" + }, + "AppArmorProfile": { + "type": "string" + }, + "ExecIDs": { + "type": "array", + "description": "IDs of exec instances that are running in the container.", + "nullable": true, + "items": { + "type": "string" + } + }, + "HostConfig": { + "description": "Container configuration that depends on the host we are running on", + "allOf": [ + { + "type": "object", + "properties": { + "CpuShares": { + "type": "integer", + "description": "An integer value representing this container's relative CPU weight\nversus other containers.\n" + }, + "Memory": { + "type": "integer", + "description": "Memory limit in bytes.", + "format": "int64", + "default": 0 + }, + "CgroupParent": { + "type": "string", + "description": "Path to `cgroups` under which the container's `cgroup` is created. If\nthe path is not absolute, the path is considered to be relative to the\n`cgroups` path of the init process. Cgroups are created if they do not\nalready exist.\n" + }, + "BlkioWeight": { + "maximum": 1000, + "minimum": 0, + "type": "integer", + "description": "Block IO weight (relative weight)." + }, + "BlkioWeightDevice": { + "type": "array", + "description": "Block IO weight (relative device weight) in the form:\n\n```\n[{\"Path\": \"device_path\", \"Weight\": weight}]\n```\n", + "items": { + "type": "object", + "properties": { + "Path": { + "type": "string" + }, + "Weight": { + "minimum": 0, + "type": "integer" + } + } + } + }, + "BlkioDeviceReadBps": { + "type": "array", + "description": "Limit read rate (bytes per second) from a device, in the form:\n\n```\n[{\"Path\": \"device_path\", \"Rate\": rate}]\n```\n", + "items": { + "type": "object", + "properties": { + "Path": { + "type": "string", + "description": "Device path" + }, + "Rate": { + "minimum": 0, + "type": "integer", + "description": "Rate", + "format": "int64" + } + } + } + }, + "BlkioDeviceWriteBps": { + "type": "array", + "description": "Limit write rate (bytes per second) to a device, in the form:\n\n```\n[{\"Path\": \"device_path\", \"Rate\": rate}]\n```\n", + "items": { + "type": "object", + "properties": { + "Path": { + "type": "string", + "description": "Device path" + }, + "Rate": { + "minimum": 0, + "type": "integer", + "description": "Rate", + "format": "int64" + } + } + } + }, + "BlkioDeviceReadIOps": { + "type": "array", + "description": "Limit read rate (IO per second) from a device, in the form:\n\n```\n[{\"Path\": \"device_path\", \"Rate\": rate}]\n```\n", + "items": { + "type": "object", + "properties": { + "Path": { + "type": "string", + "description": "Device path" + }, + "Rate": { + "minimum": 0, + "type": "integer", + "description": "Rate", + "format": "int64" + } + } + } + }, + "BlkioDeviceWriteIOps": { + "type": "array", + "description": "Limit write rate (IO per second) to a device, in the form:\n\n```\n[{\"Path\": \"device_path\", \"Rate\": rate}]\n```\n", + "items": { + "type": "object", + "properties": { + "Path": { + "type": "string", + "description": "Device path" + }, + "Rate": { + "minimum": 0, + "type": "integer", + "description": "Rate", + "format": "int64" + } + } + } + }, + "CpuPeriod": { + "type": "integer", + "description": "The length of a CPU period in microseconds.", + "format": "int64" + }, + "CpuQuota": { + "type": "integer", + "description": "Microseconds of CPU time that the container can get in a CPU period.\n", + "format": "int64" + }, + "CpuRealtimePeriod": { + "type": "integer", + "description": "The length of a CPU real-time period in microseconds. Set to 0 to\nallocate no time allocated to real-time tasks.\n", + "format": "int64" + }, + "CpuRealtimeRuntime": { + "type": "integer", + "description": "The length of a CPU real-time runtime in microseconds. Set to 0 to\nallocate no time allocated to real-time tasks.\n", + "format": "int64" + }, + "CpusetCpus": { + "type": "string", + "description": "CPUs in which to allow execution (e.g., `0-3`, `0,1`).\n", + "example": "0-3" + }, + "CpusetMems": { + "type": "string", + "description": "Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only\neffective on NUMA systems.\n" + }, + "Devices": { + "type": "array", + "description": "A list of devices to add to the container.", + "items": { + "type": "object", + "properties": { + "PathOnHost": { + "type": "string" + }, + "PathInContainer": { + "type": "string" + }, + "CgroupPermissions": { + "type": "string" + } + }, + "description": "A device mapping between the host and container", + "example": { + "PathOnHost": "/dev/deviceName", + "PathInContainer": "/dev/deviceName", + "CgroupPermissions": "mrw" + } + } + }, + "DeviceCgroupRules": { + "type": "array", + "description": "a list of cgroup rules to apply to the container", + "items": { + "type": "string", + "example": "c 13:* rwm" + } + }, + "DeviceRequests": { + "type": "array", + "description": "A list of requests for devices to be sent to device drivers.\n", + "items": { + "type": "object", + "properties": { + "Driver": { + "type": "string", + "example": "nvidia" + }, + "Count": { + "type": "integer", + "example": -1 + }, + "DeviceIDs": { + "type": "array", + "example": [ + "0", + "1", + "GPU-fef8089b-4820-abfc-e83e-94318197576e" + ], + "items": { + "type": "string" + } + }, + "Capabilities": { + "type": "array", + "description": "A list of capabilities; an OR list of AND lists of capabilities.\n", + "example": [ + [ + "gpu", + "nvidia", + "compute" + ] + ], + "items": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver-specific options, specified as a key/value pairs. These options\nare passed directly to the driver.\n" + } + }, + "description": "A request for devices to be sent to device drivers" + } + }, + "KernelMemoryTCP": { + "type": "integer", + "description": "Hard limit for kernel TCP buffer memory (in bytes). Depending on the\nOCI runtime in use, this option may be ignored. It is no longer supported\nby the default (runc) runtime.\n\nThis field is omitted when empty.\n", + "format": "int64" + }, + "MemoryReservation": { + "type": "integer", + "description": "Memory soft limit in bytes.", + "format": "int64" + }, + "MemorySwap": { + "type": "integer", + "description": "Total memory limit (memory + swap). Set as `-1` to enable unlimited\nswap.\n", + "format": "int64" + }, + "MemorySwappiness": { + "maximum": 100, + "minimum": 0, + "type": "integer", + "description": "Tune a container's memory swappiness behavior. Accepts an integer\nbetween 0 and 100.\n", + "format": "int64" + }, + "NanoCpus": { + "type": "integer", + "description": "CPU quota in units of 10-9 CPUs.", + "format": "int64" + }, + "OomKillDisable": { + "type": "boolean", + "description": "Disable OOM Killer for the container." + }, + "Init": { + "type": "boolean", + "description": "Run an init inside the container that forwards signals and reaps\nprocesses. This field is omitted if empty, and the default (as\nconfigured on the daemon) is used.\n", + "nullable": true + }, + "PidsLimit": { + "type": "integer", + "description": "Tune a container's PIDs limit. Set `0` or `-1` for unlimited, or `null`\nto not change.\n", + "format": "int64", + "nullable": true + }, + "Ulimits": { + "type": "array", + "description": "A list of resource limits to set in the container. For example:\n\n```\n{\"Name\": \"nofile\", \"Soft\": 1024, \"Hard\": 2048}\n```\n", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of ulimit" + }, + "Soft": { + "type": "integer", + "description": "Soft limit" + }, + "Hard": { + "type": "integer", + "description": "Hard limit" + } + } + } + }, + "CpuCount": { + "type": "integer", + "description": "The number of usable CPUs (Windows only).\n\nOn Windows Server containers, the processor resource controls are\nmutually exclusive. The order of precedence is `CPUCount` first, then\n`CPUShares`, and `CPUPercent` last.\n", + "format": "int64" + }, + "CpuPercent": { + "type": "integer", + "description": "The usable percentage of the available CPUs (Windows only).\n\nOn Windows Server containers, the processor resource controls are\nmutually exclusive. The order of precedence is `CPUCount` first, then\n`CPUShares`, and `CPUPercent` last.\n", + "format": "int64" + }, + "IOMaximumIOps": { + "type": "integer", + "description": "Maximum IOps for the container system drive (Windows only)", + "format": "int64" + }, + "IOMaximumBandwidth": { + "type": "integer", + "description": "Maximum IO in bytes per second for the container system drive\n(Windows only).\n", + "format": "int64" + } + }, + "description": "A container's resources (cgroups config, ulimits, etc)" + }, + { + "type": "object", + "properties": { + "Binds": { + "type": "array", + "description": "A list of volume bindings for this container. Each volume binding\nis a string in one of these forms:\n\n- `host-src:container-dest[:options]` to bind-mount a host path\n into the container. Both `host-src`, and `container-dest` must\n be an _absolute_ path.\n- `volume-name:container-dest[:options]` to bind-mount a volume\n managed by a volume driver into the container. `container-dest`\n must be an _absolute_ path.\n\n`options` is an optional, comma-delimited list of:\n\n- `nocopy` disables automatic copying of data from the container\n path to the volume. The `nocopy` flag only applies to named volumes.\n- `[ro|rw]` mounts a volume read-only or read-write, respectively.\n If omitted or set to `rw`, volumes are mounted read-write.\n- `[z|Z]` applies SELinux labels to allow or deny multiple containers\n to read and write to the same volume.\n - `z`: a _shared_ content label is applied to the content. This\n label indicates that multiple containers can share the volume\n content, for both reading and writing.\n - `Z`: a _private unshared_ label is applied to the content.\n This label indicates that only the current container can use\n a private volume. Labeling systems such as SELinux require\n proper labels to be placed on volume content that is mounted\n into a container. Without a label, the security system can\n prevent a container's processes from using the content. By\n default, the labels set by the host operating system are not\n modified.\n- `[[r]shared|[r]slave|[r]private]` specifies mount\n [propagation behavior](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt).\n This only applies to bind-mounted volumes, not internal volumes\n or named volumes. Mount propagation requires the source mount\n point (the location where the source directory is mounted in the\n host operating system) to have the correct propagation properties.\n For shared volumes, the source mount point must be set to `shared`.\n For slave volumes, the mount must be set to either `shared` or\n `slave`.\n", + "items": { + "type": "string" + } + }, + "ContainerIDFile": { + "type": "string", + "description": "Path to a file where the container ID is written" + }, + "LogConfig": { + "type": "object", + "properties": { + "Type": { + "type": "string", + "enum": [ + "json-file", + "syslog", + "journald", + "gelf", + "fluentd", + "awslogs", + "splunk", + "etwlogs", + "none" + ] + }, + "Config": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "description": "The logging configuration for this container" + }, + "NetworkMode": { + "type": "string", + "description": "Network mode to use for this container. Supported standard values\nare: `bridge`, `host`, `none`, and `container:`. Any\nother value is taken as a custom network's name to which this\ncontainer should connect to.\n" + }, + "PortBindings": { + "type": "object", + "additionalProperties": { + "type": "array", + "nullable": true, + "items": { + "type": "object", + "properties": { + "HostIp": { + "type": "string", + "description": "Host IP address that the container's port is mapped to.", + "example": "127.0.0.1" + }, + "HostPort": { + "type": "string", + "description": "Host port number that the container's port is mapped to.", + "example": "4443" + } + }, + "description": "PortBinding represents a binding between a host IP address and a host\nport.\n" + } + }, + "description": "PortMap describes the mapping of container ports to host ports, using the\ncontainer's port-number and protocol as key in the format `/`,\nfor example, `80/udp`.\n\nIf a container's port is mapped for multiple protocols, separate entries\nare added to the mapping table.\n", + "example": { + "443/tcp": [ + { + "HostIp": "127.0.0.1", + "HostPort": "4443" + } + ], + "80/tcp": [ + { + "HostIp": "0.0.0.0", + "HostPort": "80" + }, + { + "HostIp": "0.0.0.0", + "HostPort": "8080" + } + ], + "80/udp": [ + { + "HostIp": "0.0.0.0", + "HostPort": "80" + } + ], + "53/udp": [ + { + "HostIp": "0.0.0.0", + "HostPort": "53" + } + ] + } + }, + "RestartPolicy": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "- Empty string means not to restart\n- `no` Do not automatically restart\n- `always` Always restart\n- `unless-stopped` Restart always except when the user has manually stopped the container\n- `on-failure` Restart only when the container exit code is non-zero\n", + "enum": [ + "", + "no", + "always", + "unless-stopped", + "on-failure" + ] + }, + "MaximumRetryCount": { + "type": "integer", + "description": "If `on-failure` is used, the number of times to retry before giving up.\n" + } + }, + "description": "The behavior to apply when the container exits. The default is not to\nrestart.\n\nAn ever increasing delay (double the previous delay, starting at 100ms) is\nadded before each restart to prevent flooding the server.\n" + }, + "AutoRemove": { + "type": "boolean", + "description": "Automatically remove the container when the container's process\nexits. This has no effect if `RestartPolicy` is set.\n" + }, + "VolumeDriver": { + "type": "string", + "description": "Driver that this container uses to mount volumes." + }, + "VolumesFrom": { + "type": "array", + "description": "A list of volumes to inherit from another container, specified in\nthe form `[:]`.\n", + "items": { + "type": "string" + } + }, + "Mounts": { + "type": "array", + "description": "Specification for mounts to be added to the container.\n", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "Container path." + }, + "Source": { + "type": "string", + "description": "Mount source (e.g. a volume name, a host path)." + }, + "Type": { + "type": "string", + "description": "The mount type. Available types:\n\n- `bind` Mounts a file or directory from the host into the container. Must exist prior to creating the container.\n- `volume` Creates a volume with the given name and options (or uses a pre-existing volume with the same name and options). These are **not** removed when the container is removed.\n- `tmpfs` Create a tmpfs with the given options. The mount source cannot be specified for tmpfs.\n- `npipe` Mounts a named pipe from the host into the container. Must exist prior to creating the container.\n- `cluster` a Swarm cluster volume\n", + "enum": [ + "bind", + "volume", + "tmpfs", + "npipe", + "cluster" + ] + }, + "ReadOnly": { + "type": "boolean", + "description": "Whether the mount should be read-only." + }, + "Consistency": { + "type": "string", + "description": "The consistency requirement for the mount: `default`, `consistent`, `cached`, or `delegated`." + }, + "BindOptions": { + "type": "object", + "properties": { + "Propagation": { + "type": "string", + "description": "A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`.", + "enum": [ + "private", + "rprivate", + "shared", + "rshared", + "slave", + "rslave" + ] + }, + "NonRecursive": { + "type": "boolean", + "description": "Disable recursive bind mount.", + "default": false + }, + "CreateMountpoint": { + "type": "boolean", + "description": "Create mount point on host if missing", + "default": false + } + }, + "description": "Optional configuration for the `bind` type." + }, + "VolumeOptions": { + "type": "object", + "properties": { + "NoCopy": { + "type": "boolean", + "description": "Populate volume with data from the target.", + "default": false + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "DriverConfig": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver to use to create the volume." + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "key/value map of driver specific options." + } + }, + "description": "Map of driver specific options" + } + }, + "description": "Optional configuration for the `volume` type." + }, + "TmpfsOptions": { + "type": "object", + "properties": { + "SizeBytes": { + "type": "integer", + "description": "The size for the tmpfs mount in bytes.", + "format": "int64" + }, + "Mode": { + "type": "integer", + "description": "The permission mode for the tmpfs mount in an integer." + } + }, + "description": "Optional configuration for the `tmpfs` type." + } + } + } + }, + "ConsoleSize": { + "maxItems": 2, + "minItems": 2, + "type": "array", + "description": "Initial console size, as an `[height, width]` array.\n", + "nullable": true, + "items": { + "minimum": 0, + "type": "integer" + } + }, + "Annotations": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Arbitrary non-identifying metadata attached to container and\nprovided to the runtime when the container is started.\n" + }, + "CapAdd": { + "type": "array", + "description": "A list of kernel capabilities to add to the container. Conflicts\nwith option 'Capabilities'.\n", + "items": { + "type": "string" + } + }, + "CapDrop": { + "type": "array", + "description": "A list of kernel capabilities to drop from the container. Conflicts\nwith option 'Capabilities'.\n", + "items": { + "type": "string" + } + }, + "CgroupnsMode": { + "type": "string", + "description": "cgroup namespace mode for the container. Possible values are:\n\n- `\"private\"`: the container runs in its own private cgroup namespace\n- `\"host\"`: use the host system's cgroup namespace\n\nIf not specified, the daemon default is used, which can either be `\"private\"`\nor `\"host\"`, depending on daemon version, kernel support and configuration.\n", + "enum": [ + "private", + "host" + ] + }, + "Dns": { + "type": "array", + "description": "A list of DNS servers for the container to use.", + "items": { + "type": "string" + } + }, + "DnsOptions": { + "type": "array", + "description": "A list of DNS options.", + "items": { + "type": "string" + } + }, + "DnsSearch": { + "type": "array", + "description": "A list of DNS search domains.", + "items": { + "type": "string" + } + }, + "ExtraHosts": { + "type": "array", + "description": "A list of hostnames/IP mappings to add to the container's `/etc/hosts`\nfile. Specified in the form `[\"hostname:IP\"]`.\n", + "items": { + "type": "string" + } + }, + "GroupAdd": { + "type": "array", + "description": "A list of additional groups that the container process will run as.\n", + "items": { + "type": "string" + } + }, + "IpcMode": { + "type": "string", + "description": "IPC sharing mode for the container. Possible values are:\n\n- `\"none\"`: own private IPC namespace, with /dev/shm not mounted\n- `\"private\"`: own private IPC namespace\n- `\"shareable\"`: own private IPC namespace, with a possibility to share it with other containers\n- `\"container:\"`: join another (shareable) container's IPC namespace\n- `\"host\"`: use the host system's IPC namespace\n\nIf not specified, daemon default is used, which can either be `\"private\"`\nor `\"shareable\"`, depending on daemon version and configuration.\n" + }, + "Cgroup": { + "type": "string", + "description": "Cgroup to use for the container." + }, + "Links": { + "type": "array", + "description": "A list of links for the container in the form `container_name:alias`.\n", + "items": { + "type": "string" + } + }, + "OomScoreAdj": { + "type": "integer", + "description": "An integer value containing the score given to the container in\norder to tune OOM killer preferences.\n", + "example": 500 + }, + "PidMode": { + "type": "string", + "description": "Set the PID (Process) Namespace mode for the container. It can be\neither:\n\n- `\"container:\"`: joins another container's PID namespace\n- `\"host\"`: use the host's PID namespace inside the container\n" + }, + "Privileged": { + "type": "boolean", + "description": "Gives the container full access to the host." + }, + "PublishAllPorts": { + "type": "boolean", + "description": "Allocates an ephemeral host port for all of a container's\nexposed ports.\n\nPorts are de-allocated when the container stops and allocated when\nthe container starts. The allocated port might be changed when\nrestarting the container.\n\nThe port is selected from the ephemeral port range that depends on\nthe kernel. For example, on Linux the range is defined by\n`/proc/sys/net/ipv4/ip_local_port_range`.\n" + }, + "ReadonlyRootfs": { + "type": "boolean", + "description": "Mount the container's root filesystem as read only." + }, + "SecurityOpt": { + "type": "array", + "description": "A list of string values to customize labels for MLS systems, such\nas SELinux.\n", + "items": { + "type": "string" + } + }, + "StorageOpt": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Storage driver options for this container, in the form `{\"size\": \"120G\"}`.\n" + }, + "Tmpfs": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of container directories which should be replaced by tmpfs\nmounts, and their corresponding mount options. For example:\n\n```\n{ \"/run\": \"rw,noexec,nosuid,size=65536k\" }\n```\n" + }, + "UTSMode": { + "type": "string", + "description": "UTS namespace to use for the container." + }, + "UsernsMode": { + "type": "string", + "description": "Sets the usernamespace mode for the container when usernamespace\nremapping option is enabled.\n" + }, + "ShmSize": { + "minimum": 0, + "type": "integer", + "description": "Size of `/dev/shm` in bytes. If omitted, the system uses 64MB.\n", + "format": "int64" + }, + "Sysctls": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A list of kernel parameters (sysctls) to set in the container.\nFor example:\n\n```\n{\"net.ipv4.ip_forward\": \"1\"}\n```\n" + }, + "Runtime": { + "type": "string", + "description": "Runtime to use with this container." + }, + "Isolation": { + "type": "string", + "description": "Isolation technology of the container. (Windows only)\n", + "enum": [ + "default", + "process", + "hyperv", + "" + ] + }, + "MaskedPaths": { + "type": "array", + "description": "The list of paths to be masked inside the container (this overrides\nthe default set of paths).\n", + "items": { + "type": "string" + } + }, + "ReadonlyPaths": { + "type": "array", + "description": "The list of paths to be set as read-only inside the container\n(this overrides the default set of paths).\n", + "items": { + "type": "string" + } + } + } + } + ] + }, + "GraphDriver": { + "required": [ + "Data", + "Name" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the storage driver.", + "nullable": false, + "example": "overlay2" + }, + "Data": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Low-level storage metadata, provided as key/value pairs.\n\nThis information is driver-specific, and depends on the storage-driver\nin use, and should be used for informational purposes only.\n", + "nullable": false, + "example": { + "MergedDir": "/var/lib/docker/overlay2/ef749362d13333e65fc95c572eb525abbe0052e16e086cb64bc3b98ae9aa6d74/merged", + "UpperDir": "/var/lib/docker/overlay2/ef749362d13333e65fc95c572eb525abbe0052e16e086cb64bc3b98ae9aa6d74/diff", + "WorkDir": "/var/lib/docker/overlay2/ef749362d13333e65fc95c572eb525abbe0052e16e086cb64bc3b98ae9aa6d74/work" + } + } + }, + "description": "Information about the storage driver used to store the container's and\nimage's filesystem.\n" + }, + "SizeRw": { + "type": "integer", + "description": "The size of files that have been created or changed by this\ncontainer.\n", + "format": "int64" + }, + "SizeRootFs": { + "type": "integer", + "description": "The total size of all the files in this container.", + "format": "int64" + }, + "Mounts": { + "type": "array", + "items": { + "type": "object", + "properties": { + "Type": { + "type": "string", + "description": "The mount type:\n\n- `bind` a mount of a file or directory from the host into the container.\n- `volume` a docker volume with the given `Name`.\n- `tmpfs` a `tmpfs`.\n- `npipe` a named pipe from the host into the container.\n- `cluster` a Swarm cluster volume\n", + "example": "volume", + "enum": [ + "bind", + "volume", + "tmpfs", + "npipe", + "cluster" + ] + }, + "Name": { + "type": "string", + "description": "Name is the name reference to the underlying data defined by `Source`\ne.g., the volume name.\n", + "example": "myvolume" + }, + "Source": { + "type": "string", + "description": "Source location of the mount.\n\nFor volumes, this contains the storage location of the volume (within\n`/var/lib/docker/volumes/`). For bind-mounts, and `npipe`, this contains\nthe source (host) part of the bind-mount. For `tmpfs` mount points, this\nfield is empty.\n", + "example": "/var/lib/docker/volumes/myvolume/_data" + }, + "Destination": { + "type": "string", + "description": "Destination is the path relative to the container root (`/`) where\nthe `Source` is mounted inside the container.\n", + "example": "/usr/share/nginx/html/" + }, + "Driver": { + "type": "string", + "description": "Driver is the volume driver used to create the volume (if it is a volume).\n", + "example": "local" + }, + "Mode": { + "type": "string", + "description": "Mode is a comma separated list of options supplied by the user when\ncreating the bind/volume mount.\n\nThe default is platform-specific (`\"z\"` on Linux, empty on Windows).\n", + "example": "z" + }, + "RW": { + "type": "boolean", + "description": "Whether the mount is mounted writable (read-write).\n", + "example": true + }, + "Propagation": { + "type": "string", + "description": "Propagation describes how mounts are propagated from the host into the\nmount point, and vice-versa. Refer to the [Linux kernel documentation](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt)\nfor details. This field is not used on Windows.\n", + "example": "" + } + }, + "description": "MountPoint represents a mount point configuration inside the container.\nThis is used for reporting the mountpoints in use by a container.\n" + } + }, + "Config": { + "type": "object", + "properties": { + "Hostname": { + "type": "string", + "description": "The hostname to use for the container, as a valid RFC 1123 hostname.\n", + "example": "439f4e91bd1d" + }, + "Domainname": { + "type": "string", + "description": "The domain name to use for the container.\n" + }, + "User": { + "type": "string", + "description": "The user that commands are run as inside the container." + }, + "AttachStdin": { + "type": "boolean", + "description": "Whether to attach to `stdin`.", + "default": false + }, + "AttachStdout": { + "type": "boolean", + "description": "Whether to attach to `stdout`.", + "default": true + }, + "AttachStderr": { + "type": "boolean", + "description": "Whether to attach to `stderr`.", + "default": true + }, + "ExposedPorts": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": {} + }, + "description": "An object mapping ports to an empty object in the form:\n\n`{\"/\": {}}`\n", + "nullable": true, + "example": { + "80/tcp": {}, + "443/tcp": {} + } + }, + "Tty": { + "type": "boolean", + "description": "Attach standard streams to a TTY, including `stdin` if it is not closed.\n", + "default": false + }, + "OpenStdin": { + "type": "boolean", + "description": "Open `stdin`", + "default": false + }, + "StdinOnce": { + "type": "boolean", + "description": "Close `stdin` after one attached client disconnects", + "default": false + }, + "Env": { + "type": "array", + "description": "A list of environment variables to set inside the container in the\nform `[\"VAR=value\", ...]`. A variable without `=` is removed from the\nenvironment, rather than to have an empty value.\n", + "example": [ + "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + ], + "items": { + "type": "string" + } + }, + "Cmd": { + "type": "array", + "description": "Command to run specified as a string or an array of strings.\n", + "example": [ + "/bin/sh" + ], + "items": { + "type": "string" + } + }, + "Healthcheck": { + "type": "object", + "properties": { + "Test": { + "type": "array", + "description": "The test to perform. Possible values are:\n\n- `[]` inherit healthcheck from image or parent image\n- `[\"NONE\"]` disable healthcheck\n- `[\"CMD\", args...]` exec arguments directly\n- `[\"CMD-SHELL\", command]` run command with system's default shell\n", + "items": { + "type": "string" + } + }, + "Interval": { + "type": "integer", + "description": "The time to wait between checks in nanoseconds. It should be 0 or at\nleast 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Timeout": { + "type": "integer", + "description": "The time to wait before considering the check to have hung. It should\nbe 0 or at least 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Retries": { + "type": "integer", + "description": "The number of consecutive failures needed to consider a container as\nunhealthy. 0 means inherit.\n" + }, + "StartPeriod": { + "type": "integer", + "description": "Start period for the container to initialize before starting\nhealth-retries countdown in nanoseconds. It should be 0 or at least\n1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + } + }, + "description": "A test to perform to check that the container is healthy." + }, + "ArgsEscaped": { + "type": "boolean", + "description": "Command is already escaped (Windows only)", + "nullable": true, + "example": false, + "default": false + }, + "Image": { + "type": "string", + "description": "The name (or reference) of the image to use when creating the container,\nor which was used when the container was created.\n", + "example": "example-image:1.0" + }, + "Volumes": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": {} + }, + "description": "An object mapping mount point paths inside the container to empty\nobjects.\n" + }, + "WorkingDir": { + "type": "string", + "description": "The working directory for commands to run in.", + "example": "/public/" + }, + "Entrypoint": { + "type": "array", + "description": "The entry point for the container as a string or an array of strings.\n\nIf the array consists of exactly one empty string (`[\"\"]`) then the\nentry point is reset to system default (i.e., the entry point used by\ndocker when there is no `ENTRYPOINT` instruction in the `Dockerfile`).\n", + "example": [], + "items": { + "type": "string" + } + }, + "NetworkDisabled": { + "type": "boolean", + "description": "Disable networking for the container.", + "nullable": true + }, + "MacAddress": { + "type": "string", + "description": "MAC address of the container.", + "nullable": true + }, + "OnBuild": { + "type": "array", + "description": "`ONBUILD` metadata that were defined in the image's `Dockerfile`.\n", + "nullable": true, + "example": [], + "items": { + "type": "string" + } + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "StopSignal": { + "type": "string", + "description": "Signal to stop a container as a string or unsigned integer.\n", + "nullable": true, + "example": "SIGTERM" + }, + "StopTimeout": { + "type": "integer", + "description": "Timeout to stop a container in seconds.", + "nullable": true + }, + "Shell": { + "type": "array", + "description": "Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell.\n", + "nullable": true, + "example": [ + "/bin/sh", + "-c" + ], + "items": { + "type": "string" + } + } + }, + "description": "Configuration for a container that is portable between hosts.\n\nWhen used as `ContainerConfig` field in an image, `ContainerConfig` is an\noptional field containing the configuration of the container that was last\ncommitted when creating the image.\n\nPrevious versions of Docker builder used this field to store build cache,\nand it is not in active use anymore.\n" + }, + "NetworkSettings": { + "type": "object", + "properties": { + "Bridge": { + "type": "string", + "description": "Name of the network's bridge (for example, `docker0`).", + "example": "docker0" + }, + "SandboxID": { + "type": "string", + "description": "SandboxID uniquely represents a container's network stack.", + "example": "9d12daf2c33f5959c8bf90aa513e4f65b561738661003029ec84830cd503a0c3" + }, + "HairpinMode": { + "type": "boolean", + "description": "Indicates if hairpin NAT should be enabled on the virtual interface.\n", + "example": false + }, + "LinkLocalIPv6Address": { + "type": "string", + "description": "IPv6 unicast address using the link-local prefix.", + "example": "fe80::42:acff:fe11:1" + }, + "LinkLocalIPv6PrefixLen": { + "type": "integer", + "description": "Prefix length of the IPv6 unicast address.", + "example": 64 + }, + "Ports": { + "type": "object", + "additionalProperties": { + "type": "array", + "nullable": true, + "items": { + "type": "object", + "properties": { + "HostIp": { + "type": "string", + "description": "Host IP address that the container's port is mapped to.", + "example": "127.0.0.1" + }, + "HostPort": { + "type": "string", + "description": "Host port number that the container's port is mapped to.", + "example": "4443" + } + }, + "description": "PortBinding represents a binding between a host IP address and a host\nport.\n" + } + }, + "description": "PortMap describes the mapping of container ports to host ports, using the\ncontainer's port-number and protocol as key in the format `/`,\nfor example, `80/udp`.\n\nIf a container's port is mapped for multiple protocols, separate entries\nare added to the mapping table.\n", + "example": { + "443/tcp": [ + { + "HostIp": "127.0.0.1", + "HostPort": "4443" + } + ], + "80/tcp": [ + { + "HostIp": "0.0.0.0", + "HostPort": "80" + }, + { + "HostIp": "0.0.0.0", + "HostPort": "8080" + } + ], + "80/udp": [ + { + "HostIp": "0.0.0.0", + "HostPort": "80" + } + ], + "53/udp": [ + { + "HostIp": "0.0.0.0", + "HostPort": "53" + } + ] + } + }, + "SandboxKey": { + "type": "string", + "description": "SandboxKey identifies the sandbox", + "example": "/var/run/docker/netns/8ab54b426c38" + }, + "SecondaryIPAddresses": { + "type": "array", + "description": "", + "nullable": true, + "items": { + "type": "object", + "properties": { + "Addr": { + "type": "string", + "description": "IP address." + }, + "PrefixLen": { + "type": "integer", + "description": "Mask length of the IP address." + } + }, + "description": "Address represents an IPv4 or IPv6 IP address." + } + }, + "SecondaryIPv6Addresses": { + "type": "array", + "description": "", + "nullable": true, + "items": { + "type": "object", + "properties": { + "Addr": { + "type": "string", + "description": "IP address." + }, + "PrefixLen": { + "type": "integer", + "description": "Mask length of the IP address." + } + }, + "description": "Address represents an IPv4 or IPv6 IP address." + } + }, + "EndpointID": { + "type": "string", + "description": "EndpointID uniquely represents a service endpoint in a Sandbox.\n\n


\n\n> **Deprecated**: This field is only propagated when attached to the\n> default \"bridge\" network. Use the information from the \"bridge\"\n> network inside the `Networks` map instead, which contains the same\n> information. This field was deprecated in Docker 1.9 and is scheduled\n> to be removed in Docker 17.12.0\n", + "example": "b88f5b905aabf2893f3cbc4ee42d1ea7980bbc0a92e2c8922b1e1795298afb0b" + }, + "Gateway": { + "type": "string", + "description": "Gateway address for the default \"bridge\" network.\n\n


\n\n> **Deprecated**: This field is only propagated when attached to the\n> default \"bridge\" network. Use the information from the \"bridge\"\n> network inside the `Networks` map instead, which contains the same\n> information. This field was deprecated in Docker 1.9 and is scheduled\n> to be removed in Docker 17.12.0\n", + "example": "172.17.0.1" + }, + "GlobalIPv6Address": { + "type": "string", + "description": "Global IPv6 address for the default \"bridge\" network.\n\n


\n\n> **Deprecated**: This field is only propagated when attached to the\n> default \"bridge\" network. Use the information from the \"bridge\"\n> network inside the `Networks` map instead, which contains the same\n> information. This field was deprecated in Docker 1.9 and is scheduled\n> to be removed in Docker 17.12.0\n", + "example": "2001:db8::5689" + }, + "GlobalIPv6PrefixLen": { + "type": "integer", + "description": "Mask length of the global IPv6 address.\n\n


\n\n> **Deprecated**: This field is only propagated when attached to the\n> default \"bridge\" network. Use the information from the \"bridge\"\n> network inside the `Networks` map instead, which contains the same\n> information. This field was deprecated in Docker 1.9 and is scheduled\n> to be removed in Docker 17.12.0\n", + "example": 64 + }, + "IPAddress": { + "type": "string", + "description": "IPv4 address for the default \"bridge\" network.\n\n


\n\n> **Deprecated**: This field is only propagated when attached to the\n> default \"bridge\" network. Use the information from the \"bridge\"\n> network inside the `Networks` map instead, which contains the same\n> information. This field was deprecated in Docker 1.9 and is scheduled\n> to be removed in Docker 17.12.0\n", + "example": "172.17.0.4" + }, + "IPPrefixLen": { + "type": "integer", + "description": "Mask length of the IPv4 address.\n\n


\n\n> **Deprecated**: This field is only propagated when attached to the\n> default \"bridge\" network. Use the information from the \"bridge\"\n> network inside the `Networks` map instead, which contains the same\n> information. This field was deprecated in Docker 1.9 and is scheduled\n> to be removed in Docker 17.12.0\n", + "example": 16 + }, + "IPv6Gateway": { + "type": "string", + "description": "IPv6 gateway address for this network.\n\n


\n\n> **Deprecated**: This field is only propagated when attached to the\n> default \"bridge\" network. Use the information from the \"bridge\"\n> network inside the `Networks` map instead, which contains the same\n> information. This field was deprecated in Docker 1.9 and is scheduled\n> to be removed in Docker 17.12.0\n", + "example": "2001:db8:2::100" + }, + "MacAddress": { + "type": "string", + "description": "MAC address for the container on the default \"bridge\" network.\n\n


\n\n> **Deprecated**: This field is only propagated when attached to the\n> default \"bridge\" network. Use the information from the \"bridge\"\n> network inside the `Networks` map instead, which contains the same\n> information. This field was deprecated in Docker 1.9 and is scheduled\n> to be removed in Docker 17.12.0\n", + "example": "02:42:ac:11:00:04" + }, + "Networks": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "IPAMConfig": { + "type": "object", + "properties": { + "IPv4Address": { + "type": "string", + "example": "172.20.30.33" + }, + "IPv6Address": { + "type": "string", + "example": "2001:db8:abcd::3033" + }, + "LinkLocalIPs": { + "type": "array", + "example": [ + "169.254.34.68", + "fe80::3468" + ], + "items": { + "type": "string" + } + } + }, + "description": "EndpointIPAMConfig represents an endpoint's IPAM configuration.\n", + "nullable": true, + "x-nullable": true + }, + "Links": { + "type": "array", + "example": [ + "container_1", + "container_2" + ], + "items": { + "type": "string" + } + }, + "Aliases": { + "type": "array", + "example": [ + "server_x", + "server_y" + ], + "items": { + "type": "string" + } + }, + "NetworkID": { + "type": "string", + "description": "Unique ID of the network.\n", + "example": "08754567f1f40222263eab4102e1c733ae697e8e354aa9cd6e18d7402835292a" + }, + "EndpointID": { + "type": "string", + "description": "Unique ID for the service endpoint in a Sandbox.\n", + "example": "b88f5b905aabf2893f3cbc4ee42d1ea7980bbc0a92e2c8922b1e1795298afb0b" + }, + "Gateway": { + "type": "string", + "description": "Gateway address for this network.\n", + "example": "172.17.0.1" + }, + "IPAddress": { + "type": "string", + "description": "IPv4 address.\n", + "example": "172.17.0.4" + }, + "IPPrefixLen": { + "type": "integer", + "description": "Mask length of the IPv4 address.\n", + "example": 16 + }, + "IPv6Gateway": { + "type": "string", + "description": "IPv6 gateway address.\n", + "example": "2001:db8:2::100" + }, + "GlobalIPv6Address": { + "type": "string", + "description": "Global IPv6 address.\n", + "example": "2001:db8::5689" + }, + "GlobalIPv6PrefixLen": { + "type": "integer", + "description": "Mask length of the global IPv6 address.\n", + "format": "int64", + "example": 64 + }, + "MacAddress": { + "type": "string", + "description": "MAC address for the endpoint on this network.\n", + "example": "02:42:ac:11:00:04" + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "DriverOpts is a mapping of driver options and values. These options\nare passed directly to the driver and are driver specific.\n", + "nullable": true, + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + } + }, + "description": "Configuration for a network endpoint." + }, + "description": "Information about all networks that the container is connected to.\n" + } + }, + "description": "NetworkSettings exposes the network settings in the API" + } + } + }, + "example": { + "AppArmorProfile": "", + "Args": [ + "-c", + "exit 9" + ], + "Config": { + "AttachStderr": true, + "AttachStdin": false, + "AttachStdout": true, + "Cmd": [ + "/bin/sh", + "-c", + "exit 9" + ], + "Domainname": "", + "Env": [ + "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + ], + "Healthcheck": { + "Test": [ + "CMD-SHELL", + "exit 0" + ] + }, + "Hostname": "ba033ac44011", + "Image": "ubuntu", + "Labels": { + "com.example.vendor": "Acme", + "com.example.license": "GPL", + "com.example.version": "1.0" + }, + "MacAddress": "", + "NetworkDisabled": false, + "OpenStdin": false, + "StdinOnce": false, + "Tty": false, + "User": "", + "Volumes": { + "/volumes/data": {} + }, + "WorkingDir": "", + "StopSignal": "SIGTERM", + "StopTimeout": 10 + }, + "Created": "2015-01-06T15:47:31.485331387Z", + "Driver": "overlay2", + "ExecIDs": [ + "b35395de42bc8abd327f9dd65d913b9ba28c74d2f0734eeeae84fa1c616a0fca", + "3fc1232e5cd20c8de182ed81178503dc6437f4e7ef12b52cc5e8de020652f1c4" + ], + "HostConfig": { + "MaximumIOps": 0, + "MaximumIOBps": 0, + "BlkioWeight": 0, + "BlkioWeightDevice": [ + {} + ], + "BlkioDeviceReadBps": [ + {} + ], + "BlkioDeviceWriteBps": [ + {} + ], + "BlkioDeviceReadIOps": [ + {} + ], + "BlkioDeviceWriteIOps": [ + {} + ], + "ContainerIDFile": "", + "CpusetCpus": "", + "CpusetMems": "", + "CpuPercent": 80, + "CpuShares": 0, + "CpuPeriod": 100000, + "CpuRealtimePeriod": 1000000, + "CpuRealtimeRuntime": 10000, + "Devices": [], + "DeviceRequests": [ + { + "Driver": "nvidia", + "Count": -1, + "DeviceIDs\"": [ + "0", + "1", + "GPU-fef8089b-4820-abfc-e83e-94318197576e" + ], + "Capabilities": [ + [ + "gpu", + "nvidia", + "compute" + ] + ], + "Options": { + "property1": "string", + "property2": "string" + } + } + ], + "IpcMode": "", + "Memory": 0, + "MemorySwap": 0, + "MemoryReservation": 0, + "OomKillDisable": false, + "OomScoreAdj": 500, + "NetworkMode": "bridge", + "PidMode": "", + "PortBindings": {}, + "Privileged": false, + "ReadonlyRootfs": false, + "PublishAllPorts": false, + "RestartPolicy": { + "MaximumRetryCount": 2, + "Name": "on-failure" + }, + "LogConfig": { + "Type": "json-file" + }, + "Sysctls": { + "net.ipv4.ip_forward": "1" + }, + "Ulimits": [ + {} + ], + "VolumeDriver": "", + "ShmSize": 67108864 + }, + "HostnamePath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hostname", + "HostsPath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hosts", + "LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log", + "Id": "ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39", + "Image": "04c5d3b7b0656168630d3ba35d8889bd0e9caafcaeb3004d2bfbc47e7c5d35d2", + "MountLabel": "", + "Name": "/boring_euclid", + "NetworkSettings": { + "Bridge": "", + "SandboxID": "", + "HairpinMode": false, + "LinkLocalIPv6Address": "", + "LinkLocalIPv6PrefixLen": 0, + "SandboxKey": "", + "EndpointID": "", + "Gateway": "", + "GlobalIPv6Address": "", + "GlobalIPv6PrefixLen": 0, + "IPAddress": "", + "IPPrefixLen": 0, + "IPv6Gateway": "", + "MacAddress": "", + "Networks": { + "bridge": { + "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812", + "EndpointID": "7587b82f0dada3656fda26588aee72630c6fab1536d36e394b2bfbcf898c971d", + "Gateway": "172.17.0.1", + "IPAddress": "172.17.0.2", + "IPPrefixLen": 16, + "IPv6Gateway": "", + "GlobalIPv6Address": "", + "GlobalIPv6PrefixLen": 0, + "MacAddress": "02:42:ac:12:00:02" + } + } + }, + "Path": "/bin/sh", + "ProcessLabel": "", + "ResolvConfPath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/resolv.conf", + "RestartCount": 1, + "State": { + "Error": "", + "ExitCode": 9, + "FinishedAt": "2015-01-06T15:47:32.080254511Z", + "Health": { + "Status": "healthy", + "FailingStreak": 0, + "Log": [ + { + "Start": "2019-12-22T10:59:05.6385933Z", + "End": "2019-12-22T10:59:05.8078452Z", + "ExitCode": 0, + "Output": "" + } + ] + }, + "OOMKilled": false, + "Dead": false, + "Paused": false, + "Pid": 0, + "Restarting": false, + "Running": true, + "StartedAt": "2015-01-06T15:47:32.072697474Z", + "Status": "running" + }, + "Mounts": [ + { + "Name": "fac362...80535", + "Source": "/data", + "Destination": "/data", + "Driver": "local", + "Mode": "ro,Z", + "RW": false, + "Propagation": "" + } + ] + } + } + } + }, + "404": { + "description": "no such container", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + }, + "example": { + "message": "No such container: c2ada9df5af8" + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/containers/{id}/top": { + "get": { + "tags": [ + "Container" + ], + "summary": "List processes running inside a container", + "description": "On Unix systems, this is done by running the `ps` command. This endpoint\nis not supported on Windows.\n", + "operationId": "ContainerTop", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID or name of the container", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "ps_args", + "in": "query", + "description": "The arguments to pass to `ps`. For example, `aux`", + "schema": { + "type": "string", + "default": "-ef" + } + } + ], + "responses": { + "200": { + "description": "no error", + "content": { + "application/json": { + "schema": { + "title": "ContainerTopResponse", + "type": "object", + "properties": { + "Titles": { + "type": "array", + "description": "The ps column titles", + "items": { + "type": "string" + } + }, + "Processes": { + "type": "array", + "description": "Each process running in the container, where each is process\nis an array of values corresponding to the titles.\n", + "items": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "description": "OK response to ContainerTop operation" + }, + "example": { + "Titles": [ + "UID", + "PID", + "PPID", + "C", + "STIME", + "TTY", + "TIME", + "CMD" + ], + "Processes": [ + [ + "root", + "13642", + "882", + "0", + "17:03", + "pts/0", + "00:00:00", + "/bin/bash" + ], + [ + "root", + "13735", + "13642", + "0", + "17:06", + "pts/0", + "00:00:00", + "sleep 10" + ] + ] + } + }, + "text/plain": { + "schema": { + "title": "ContainerTopResponse", + "type": "object", + "properties": { + "Titles": { + "type": "array", + "description": "The ps column titles", + "items": { + "type": "string" + } + }, + "Processes": { + "type": "array", + "description": "Each process running in the container, where each is process\nis an array of values corresponding to the titles.\n", + "items": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "description": "OK response to ContainerTop operation" + } + } + } + }, + "404": { + "description": "no such container", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + }, + "example": { + "message": "No such container: c2ada9df5af8" + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/containers/{id}/logs": { + "get": { + "tags": [ + "Container" + ], + "summary": "Get container logs", + "description": "Get `stdout` and `stderr` logs from a container.\n\nNote: This endpoint works only for containers with the `json-file` or\n`journald` logging driver.\n", + "operationId": "ContainerLogs", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID or name of the container", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "follow", + "in": "query", + "description": "Keep connection after returning logs.", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "stdout", + "in": "query", + "description": "Return logs from `stdout`", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "stderr", + "in": "query", + "description": "Return logs from `stderr`", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "since", + "in": "query", + "description": "Only return logs since this time, as a UNIX timestamp", + "schema": { + "type": "integer", + "default": 0 + } + }, + { + "name": "until", + "in": "query", + "description": "Only return logs before this time, as a UNIX timestamp", + "schema": { + "type": "integer", + "default": 0 + } + }, + { + "name": "timestamps", + "in": "query", + "description": "Add timestamps to every log line", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "tail", + "in": "query", + "description": "Only return this number of log lines from the end of the logs.\nSpecify as an integer or `all` to output all log lines.\n", + "schema": { + "type": "string", + "default": "all" + } + } + ], + "responses": { + "200": { + "description": "logs returned as a stream in response body.\nFor the stream format, [see the documentation for the attach endpoint](#operation/ContainerAttach).\nNote that unlike the attach endpoint, the logs endpoint does not\nupgrade the connection and does not set Content-Type.\n", + "content": { + "application/vnd.docker.raw-stream": { + "schema": { + "type": "string", + "format": "binary" + } + }, + "application/vnd.docker.multiplexed-stream": { + "schema": { + "type": "string", + "format": "binary" + } + } + } + }, + "404": { + "description": "no such container", + "content": { + "application/vnd.docker.raw-stream": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "application/vnd.docker.multiplexed-stream": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "application/json": { + "example": { + "message": "No such container: c2ada9df5af8" + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/vnd.docker.raw-stream": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "application/vnd.docker.multiplexed-stream": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/containers/{id}/changes": { + "get": { + "tags": [ + "Container" + ], + "summary": "Get changes on a container’s filesystem", + "description": "Returns which files in a container's filesystem have been added, deleted,\nor modified. The `Kind` of modification can be one of:\n\n- `0`: Modified (\"C\")\n- `1`: Added (\"A\")\n- `2`: Deleted (\"D\")\n", + "operationId": "ContainerChanges", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID or name of the container", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The list of changes", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "required": [ + "Kind", + "Path" + ], + "type": "object", + "properties": { + "Path": { + "type": "string", + "description": "Path to file or directory that has changed.\n", + "nullable": false + }, + "Kind": { + "type": "integer", + "description": "Kind of change\n\nCan be one of:\n\n- `0`: Modified (\"C\")\n- `1`: Added (\"A\")\n- `2`: Deleted (\"D\")\n", + "format": "uint8", + "nullable": false, + "enum": [ + 0, + 1, + 2 + ], + "x-nullable": false + } + }, + "description": "Change in the container's filesystem.\n" + } + }, + "example": [ + { + "Path": "/dev", + "Kind": 0 + }, + { + "Path": "/dev/kmsg", + "Kind": 1 + }, + { + "Path": "/test", + "Kind": 1 + } + ] + } + } + }, + "404": { + "description": "no such container", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + }, + "example": { + "message": "No such container: c2ada9df5af8" + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/containers/{id}/export": { + "get": { + "tags": [ + "Container" + ], + "summary": "Export a container", + "description": "Export the contents of a container as a tarball.", + "operationId": "ContainerExport", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID or name of the container", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "no error", + "content": {} + }, + "404": { + "description": "no such container", + "content": { + "application/octet-stream": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "application/json": { + "example": { + "message": "No such container: c2ada9df5af8" + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/octet-stream": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/containers/{id}/stats": { + "get": { + "tags": [ + "Container" + ], + "summary": "Get container stats based on resource usage", + "description": "This endpoint returns a live stream of a container’s resource usage\nstatistics.\n\nThe `precpu_stats` is the CPU statistic of the *previous* read, and is\nused to calculate the CPU usage percentage. It is not an exact copy\nof the `cpu_stats` field.\n\nIf either `precpu_stats.online_cpus` or `cpu_stats.online_cpus` is\nnil then for compatibility with older daemons the length of the\ncorresponding `cpu_usage.percpu_usage` array should be used.\n\nOn a cgroup v2 host, the following fields are not set\n* `blkio_stats`: all fields other than `io_service_bytes_recursive`\n* `cpu_stats`: `cpu_usage.percpu_usage`\n* `memory_stats`: `max_usage` and `failcnt`\nAlso, `memory_stats.stats` fields are incompatible with cgroup v1.\n\nTo calculate the values shown by the `stats` command of the docker cli tool\nthe following formulas can be used:\n* used_memory = `memory_stats.usage - memory_stats.stats.cache`\n* available_memory = `memory_stats.limit`\n* Memory usage % = `(used_memory / available_memory) * 100.0`\n* cpu_delta = `cpu_stats.cpu_usage.total_usage - precpu_stats.cpu_usage.total_usage`\n* system_cpu_delta = `cpu_stats.system_cpu_usage - precpu_stats.system_cpu_usage`\n* number_cpus = `length(cpu_stats.cpu_usage.percpu_usage)` or `cpu_stats.online_cpus`\n* CPU usage % = `(cpu_delta / system_cpu_delta) * number_cpus * 100.0`\n", + "operationId": "ContainerStats", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID or name of the container", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "stream", + "in": "query", + "description": "Stream the output. If false, the stats will be output once and then\nit will disconnect.\n", + "schema": { + "type": "boolean", + "default": true + } + }, + { + "name": "one-shot", + "in": "query", + "description": "Only get a single stat instead of waiting for 2 cycles. Must be used\nwith `stream=false`.\n", + "schema": { + "type": "boolean", + "default": false + } + } + ], + "responses": { + "200": { + "description": "no error", + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "example": { + "read": "2015-01-08T22:57:31.547920715Z", + "pids_stats": { + "current": 3 + }, + "networks": { + "eth0": { + "rx_bytes": 5338, + "rx_dropped": 0, + "rx_errors": 0, + "rx_packets": 36, + "tx_bytes": 648, + "tx_dropped": 0, + "tx_errors": 0, + "tx_packets": 8 + }, + "eth5": { + "rx_bytes": 4641, + "rx_dropped": 0, + "rx_errors": 0, + "rx_packets": 26, + "tx_bytes": 690, + "tx_dropped": 0, + "tx_errors": 0, + "tx_packets": 9 + } + }, + "memory_stats": { + "stats": { + "total_pgmajfault": 0, + "cache": 0, + "mapped_file": 0, + "total_inactive_file": 0, + "pgpgout": 414, + "rss": 6537216, + "total_mapped_file": 0, + "writeback": 0, + "unevictable": 0, + "pgpgin": 477, + "total_unevictable": 0, + "pgmajfault": 0, + "total_rss": 6537216, + "total_rss_huge": 6291456, + "total_writeback": 0, + "total_inactive_anon": 0, + "rss_huge": 6291456, + "hierarchical_memory_limit": 67108864, + "total_pgfault": 964, + "total_active_file": 0, + "active_anon": 6537216, + "total_active_anon": 6537216, + "total_pgpgout": 414, + "total_cache": 0, + "inactive_anon": 0, + "active_file": 0, + "pgfault": 964, + "inactive_file": 0, + "total_pgpgin": 477 + }, + "max_usage": 6651904, + "usage": 6537216, + "failcnt": 0, + "limit": 67108864 + }, + "blkio_stats": {}, + "cpu_stats": { + "cpu_usage": { + "percpu_usage": [ + 8646879, + 24472255, + 36438778, + 30657443 + ], + "usage_in_usermode": 50000000, + "total_usage": 100215355, + "usage_in_kernelmode": 30000000 + }, + "system_cpu_usage": 739306590000000, + "online_cpus": 4, + "throttling_data": { + "periods": 0, + "throttled_periods": 0, + "throttled_time": 0 + } + }, + "precpu_stats": { + "cpu_usage": { + "percpu_usage": [ + 8646879, + 24350896, + 36438778, + 30657443 + ], + "usage_in_usermode": 50000000, + "total_usage": 100093996, + "usage_in_kernelmode": 30000000 + }, + "system_cpu_usage": 9492140000000, + "online_cpus": 4, + "throttling_data": { + "periods": 0, + "throttled_periods": 0, + "throttled_time": 0 + } + } + } + } + } + }, + "404": { + "description": "no such container", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + }, + "example": { + "message": "No such container: c2ada9df5af8" + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/containers/{id}/resize": { + "post": { + "tags": [ + "Container" + ], + "summary": "Resize a container TTY", + "description": "Resize the TTY for a container.", + "operationId": "ContainerResize", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID or name of the container", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "h", + "in": "query", + "description": "Height of the TTY session in characters", + "required": true, + "schema": { + "type": "integer" + } + }, + { + "name": "w", + "in": "query", + "description": "Width of the TTY session in characters", + "required": true, + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "no error", + "content": {} + }, + "404": { + "description": "no such container", + "content": { + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "application/json": { + "example": { + "message": "No such container: c2ada9df5af8" + } + } + } + }, + "500": { + "description": "cannot resize container", + "content": { + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/containers/{id}/start": { + "post": { + "tags": [ + "Container" + ], + "summary": "Start a container", + "operationId": "ContainerStart", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID or name of the container", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "detachKeys", + "in": "query", + "description": "Override the key sequence for detaching a container. Format is a\nsingle character `[a-Z]` or `ctrl-` where `` is one\nof: `a-z`, `@`, `^`, `[`, `,` or `_`.\n", + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "no error", + "content": {} + }, + "304": { + "description": "container already started", + "content": {} + }, + "404": { + "description": "no such container", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + }, + "example": { + "message": "No such container: c2ada9df5af8" + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/containers/{id}/stop": { + "post": { + "tags": [ + "Container" + ], + "summary": "Stop a container", + "operationId": "ContainerStop", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID or name of the container", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "signal", + "in": "query", + "description": "Signal to send to the container as an integer or string (e.g. `SIGINT`).\n", + "schema": { + "type": "string" + } + }, + { + "name": "t", + "in": "query", + "description": "Number of seconds to wait before killing the container", + "schema": { + "type": "integer" + } + } + ], + "responses": { + "204": { + "description": "no error", + "content": {} + }, + "304": { + "description": "container already stopped", + "content": {} + }, + "404": { + "description": "no such container", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + }, + "example": { + "message": "No such container: c2ada9df5af8" + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/containers/{id}/restart": { + "post": { + "tags": [ + "Container" + ], + "summary": "Restart a container", + "operationId": "ContainerRestart", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID or name of the container", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "signal", + "in": "query", + "description": "Signal to send to the container as an integer or string (e.g. `SIGINT`).\n", + "schema": { + "type": "string" + } + }, + { + "name": "t", + "in": "query", + "description": "Number of seconds to wait before killing the container", + "schema": { + "type": "integer" + } + } + ], + "responses": { + "204": { + "description": "no error", + "content": {} + }, + "404": { + "description": "no such container", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + }, + "example": { + "message": "No such container: c2ada9df5af8" + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/containers/{id}/kill": { + "post": { + "tags": [ + "Container" + ], + "summary": "Kill a container", + "description": "Send a POSIX signal to a container, defaulting to killing to the\ncontainer.\n", + "operationId": "ContainerKill", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID or name of the container", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "signal", + "in": "query", + "description": "Signal to send to the container as an integer or string (e.g. `SIGINT`).\n", + "schema": { + "type": "string", + "default": "SIGKILL" + } + } + ], + "responses": { + "204": { + "description": "no error", + "content": {} + }, + "404": { + "description": "no such container", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + }, + "example": { + "message": "No such container: c2ada9df5af8" + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "409": { + "description": "container is not running", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + }, + "example": { + "message": "Container d37cde0fe4ad63c3a7252023b2f9800282894247d145cb5933ddf6e52cc03a28 is not running" + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/containers/{id}/update": { + "post": { + "tags": [ + "Container" + ], + "summary": "Update a container", + "description": "Change various configuration options of a container without having to\nrecreate it.\n", + "operationId": "ContainerUpdate", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID or name of the container", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "type": "object", + "properties": { + "CpuShares": { + "type": "integer", + "description": "An integer value representing this container's relative CPU weight\nversus other containers.\n" + }, + "Memory": { + "type": "integer", + "description": "Memory limit in bytes.", + "format": "int64", + "default": 0 + }, + "CgroupParent": { + "type": "string", + "description": "Path to `cgroups` under which the container's `cgroup` is created. If\nthe path is not absolute, the path is considered to be relative to the\n`cgroups` path of the init process. Cgroups are created if they do not\nalready exist.\n" + }, + "BlkioWeight": { + "maximum": 1000, + "minimum": 0, + "type": "integer", + "description": "Block IO weight (relative weight)." + }, + "BlkioWeightDevice": { + "type": "array", + "description": "Block IO weight (relative device weight) in the form:\n\n```\n[{\"Path\": \"device_path\", \"Weight\": weight}]\n```\n", + "items": { + "type": "object", + "properties": { + "Path": { + "type": "string" + }, + "Weight": { + "minimum": 0, + "type": "integer" + } + } + } + }, + "BlkioDeviceReadBps": { + "type": "array", + "description": "Limit read rate (bytes per second) from a device, in the form:\n\n```\n[{\"Path\": \"device_path\", \"Rate\": rate}]\n```\n", + "items": { + "type": "object", + "properties": { + "Path": { + "type": "string", + "description": "Device path" + }, + "Rate": { + "minimum": 0, + "type": "integer", + "description": "Rate", + "format": "int64" + } + } + } + }, + "BlkioDeviceWriteBps": { + "type": "array", + "description": "Limit write rate (bytes per second) to a device, in the form:\n\n```\n[{\"Path\": \"device_path\", \"Rate\": rate}]\n```\n", + "items": { + "type": "object", + "properties": { + "Path": { + "type": "string", + "description": "Device path" + }, + "Rate": { + "minimum": 0, + "type": "integer", + "description": "Rate", + "format": "int64" + } + } + } + }, + "BlkioDeviceReadIOps": { + "type": "array", + "description": "Limit read rate (IO per second) from a device, in the form:\n\n```\n[{\"Path\": \"device_path\", \"Rate\": rate}]\n```\n", + "items": { + "type": "object", + "properties": { + "Path": { + "type": "string", + "description": "Device path" + }, + "Rate": { + "minimum": 0, + "type": "integer", + "description": "Rate", + "format": "int64" + } + } + } + }, + "BlkioDeviceWriteIOps": { + "type": "array", + "description": "Limit write rate (IO per second) to a device, in the form:\n\n```\n[{\"Path\": \"device_path\", \"Rate\": rate}]\n```\n", + "items": { + "type": "object", + "properties": { + "Path": { + "type": "string", + "description": "Device path" + }, + "Rate": { + "minimum": 0, + "type": "integer", + "description": "Rate", + "format": "int64" + } + } + } + }, + "CpuPeriod": { + "type": "integer", + "description": "The length of a CPU period in microseconds.", + "format": "int64" + }, + "CpuQuota": { + "type": "integer", + "description": "Microseconds of CPU time that the container can get in a CPU period.\n", + "format": "int64" + }, + "CpuRealtimePeriod": { + "type": "integer", + "description": "The length of a CPU real-time period in microseconds. Set to 0 to\nallocate no time allocated to real-time tasks.\n", + "format": "int64" + }, + "CpuRealtimeRuntime": { + "type": "integer", + "description": "The length of a CPU real-time runtime in microseconds. Set to 0 to\nallocate no time allocated to real-time tasks.\n", + "format": "int64" + }, + "CpusetCpus": { + "type": "string", + "description": "CPUs in which to allow execution (e.g., `0-3`, `0,1`).\n", + "example": "0-3" + }, + "CpusetMems": { + "type": "string", + "description": "Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only\neffective on NUMA systems.\n" + }, + "Devices": { + "type": "array", + "description": "A list of devices to add to the container.", + "items": { + "type": "object", + "properties": { + "PathOnHost": { + "type": "string" + }, + "PathInContainer": { + "type": "string" + }, + "CgroupPermissions": { + "type": "string" + } + }, + "description": "A device mapping between the host and container", + "example": { + "PathOnHost": "/dev/deviceName", + "PathInContainer": "/dev/deviceName", + "CgroupPermissions": "mrw" + } + } + }, + "DeviceCgroupRules": { + "type": "array", + "description": "a list of cgroup rules to apply to the container", + "items": { + "type": "string", + "example": "c 13:* rwm" + } + }, + "DeviceRequests": { + "type": "array", + "description": "A list of requests for devices to be sent to device drivers.\n", + "items": { + "type": "object", + "properties": { + "Driver": { + "type": "string", + "example": "nvidia" + }, + "Count": { + "type": "integer", + "example": -1 + }, + "DeviceIDs": { + "type": "array", + "example": [ + "0", + "1", + "GPU-fef8089b-4820-abfc-e83e-94318197576e" + ], + "items": { + "type": "string" + } + }, + "Capabilities": { + "type": "array", + "description": "A list of capabilities; an OR list of AND lists of capabilities.\n", + "example": [ + [ + "gpu", + "nvidia", + "compute" + ] + ], + "items": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver-specific options, specified as a key/value pairs. These options\nare passed directly to the driver.\n" + } + }, + "description": "A request for devices to be sent to device drivers" + } + }, + "KernelMemoryTCP": { + "type": "integer", + "description": "Hard limit for kernel TCP buffer memory (in bytes). Depending on the\nOCI runtime in use, this option may be ignored. It is no longer supported\nby the default (runc) runtime.\n\nThis field is omitted when empty.\n", + "format": "int64" + }, + "MemoryReservation": { + "type": "integer", + "description": "Memory soft limit in bytes.", + "format": "int64" + }, + "MemorySwap": { + "type": "integer", + "description": "Total memory limit (memory + swap). Set as `-1` to enable unlimited\nswap.\n", + "format": "int64" + }, + "MemorySwappiness": { + "maximum": 100, + "minimum": 0, + "type": "integer", + "description": "Tune a container's memory swappiness behavior. Accepts an integer\nbetween 0 and 100.\n", + "format": "int64" + }, + "NanoCpus": { + "type": "integer", + "description": "CPU quota in units of 10-9 CPUs.", + "format": "int64" + }, + "OomKillDisable": { + "type": "boolean", + "description": "Disable OOM Killer for the container." + }, + "Init": { + "type": "boolean", + "description": "Run an init inside the container that forwards signals and reaps\nprocesses. This field is omitted if empty, and the default (as\nconfigured on the daemon) is used.\n", + "nullable": true + }, + "PidsLimit": { + "type": "integer", + "description": "Tune a container's PIDs limit. Set `0` or `-1` for unlimited, or `null`\nto not change.\n", + "format": "int64", + "nullable": true + }, + "Ulimits": { + "type": "array", + "description": "A list of resource limits to set in the container. For example:\n\n```\n{\"Name\": \"nofile\", \"Soft\": 1024, \"Hard\": 2048}\n```\n", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of ulimit" + }, + "Soft": { + "type": "integer", + "description": "Soft limit" + }, + "Hard": { + "type": "integer", + "description": "Hard limit" + } + } + } + }, + "CpuCount": { + "type": "integer", + "description": "The number of usable CPUs (Windows only).\n\nOn Windows Server containers, the processor resource controls are\nmutually exclusive. The order of precedence is `CPUCount` first, then\n`CPUShares`, and `CPUPercent` last.\n", + "format": "int64" + }, + "CpuPercent": { + "type": "integer", + "description": "The usable percentage of the available CPUs (Windows only).\n\nOn Windows Server containers, the processor resource controls are\nmutually exclusive. The order of precedence is `CPUCount` first, then\n`CPUShares`, and `CPUPercent` last.\n", + "format": "int64" + }, + "IOMaximumIOps": { + "type": "integer", + "description": "Maximum IOps for the container system drive (Windows only)", + "format": "int64" + }, + "IOMaximumBandwidth": { + "type": "integer", + "description": "Maximum IO in bytes per second for the container system drive\n(Windows only).\n", + "format": "int64" + } + }, + "description": "A container's resources (cgroups config, ulimits, etc)" + }, + { + "type": "object", + "properties": { + "RestartPolicy": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "- Empty string means not to restart\n- `no` Do not automatically restart\n- `always` Always restart\n- `unless-stopped` Restart always except when the user has manually stopped the container\n- `on-failure` Restart only when the container exit code is non-zero\n", + "enum": [ + "", + "no", + "always", + "unless-stopped", + "on-failure" + ] + }, + "MaximumRetryCount": { + "type": "integer", + "description": "If `on-failure` is used, the number of times to retry before giving up.\n" + } + }, + "description": "The behavior to apply when the container exits. The default is not to\nrestart.\n\nAn ever increasing delay (double the previous delay, starting at 100ms) is\nadded before each restart to prevent flooding the server.\n" + } + } + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The container has been updated.", + "content": { + "application/json": { + "schema": { + "title": "ContainerUpdateResponse", + "type": "object", + "properties": { + "Warnings": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "description": "OK response to ContainerUpdate operation" + } + } + } + }, + "404": { + "description": "no such container", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + }, + "example": { + "message": "No such container: c2ada9df5af8" + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + }, + "x-codegen-request-body-name": "update" + } + }, + "/containers/{id}/rename": { + "post": { + "tags": [ + "Container" + ], + "summary": "Rename a container", + "operationId": "ContainerRename", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID or name of the container", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "name", + "in": "query", + "description": "New name for the container", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "no error", + "content": {} + }, + "404": { + "description": "no such container", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + }, + "example": { + "message": "No such container: c2ada9df5af8" + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "409": { + "description": "name already in use", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/containers/{id}/pause": { + "post": { + "tags": [ + "Container" + ], + "summary": "Pause a container", + "description": "Use the freezer cgroup to suspend all processes in a container.\n\nTraditionally, when suspending a process the `SIGSTOP` signal is used,\nwhich is observable by the process being suspended. With the freezer\ncgroup the process is unaware, and unable to capture, that it is being\nsuspended, and subsequently resumed.\n", + "operationId": "ContainerPause", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID or name of the container", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "no error", + "content": {} + }, + "404": { + "description": "no such container", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + }, + "example": { + "message": "No such container: c2ada9df5af8" + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/containers/{id}/unpause": { + "post": { + "tags": [ + "Container" + ], + "summary": "Unpause a container", + "description": "Resume a container which has been paused.", + "operationId": "ContainerUnpause", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID or name of the container", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "no error", + "content": {} + }, + "404": { + "description": "no such container", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + }, + "example": { + "message": "No such container: c2ada9df5af8" + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/containers/{id}/attach": { + "post": { + "tags": [ + "Container" + ], + "summary": "Attach to a container", + "description": "Attach to a container to read its output or send it input. You can attach\nto the same container multiple times and you can reattach to containers\nthat have been detached.\n\nEither the `stream` or `logs` parameter must be `true` for this endpoint\nto do anything.\n\nSee the [documentation for the `docker attach` command](https://docs.docker.com/engine/reference/commandline/attach/)\nfor more details.\n\n### Hijacking\n\nThis endpoint hijacks the HTTP connection to transport `stdin`, `stdout`,\nand `stderr` on the same socket.\n\nThis is the response from the daemon for an attach request:\n\n```\nHTTP/1.1 200 OK\nContent-Type: application/vnd.docker.raw-stream\n\n[STREAM]\n```\n\nAfter the headers and two new lines, the TCP connection can now be used\nfor raw, bidirectional communication between the client and server.\n\nTo hint potential proxies about connection hijacking, the Docker client\ncan also optionally send connection upgrade headers.\n\nFor example, the client sends this request to upgrade the connection:\n\n```\nPOST /containers/16253994b7c4/attach?stream=1&stdout=1 HTTP/1.1\nUpgrade: tcp\nConnection: Upgrade\n```\n\nThe Docker daemon will respond with a `101 UPGRADED` response, and will\nsimilarly follow with the raw stream:\n\n```\nHTTP/1.1 101 UPGRADED\nContent-Type: application/vnd.docker.raw-stream\nConnection: Upgrade\nUpgrade: tcp\n\n[STREAM]\n```\n\n### Stream format\n\nWhen the TTY setting is disabled in [`POST /containers/create`](#operation/ContainerCreate),\nthe HTTP Content-Type header is set to application/vnd.docker.multiplexed-stream\nand the stream over the hijacked connected is multiplexed to separate out\n`stdout` and `stderr`. The stream consists of a series of frames, each\ncontaining a header and a payload.\n\nThe header contains the information which the stream writes (`stdout` or\n`stderr`). It also contains the size of the associated frame encoded in\nthe last four bytes (`uint32`).\n\nIt is encoded on the first eight bytes like this:\n\n```go\nheader := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}\n```\n\n`STREAM_TYPE` can be:\n\n- 0: `stdin` (is written on `stdout`)\n- 1: `stdout`\n- 2: `stderr`\n\n`SIZE1, SIZE2, SIZE3, SIZE4` are the four bytes of the `uint32` size\nencoded as big endian.\n\nFollowing the header is the payload, which is the specified number of\nbytes of `STREAM_TYPE`.\n\nThe simplest way to implement this protocol is the following:\n\n1. Read 8 bytes.\n2. Choose `stdout` or `stderr` depending on the first byte.\n3. Extract the frame size from the last four bytes.\n4. Read the extracted size and output it on the correct output.\n5. Goto 1.\n\n### Stream format when using a TTY\n\nWhen the TTY setting is enabled in [`POST /containers/create`](#operation/ContainerCreate),\nthe stream is not multiplexed. The data exchanged over the hijacked\nconnection is simply the raw data from the process PTY and client's\n`stdin`.\n", + "operationId": "ContainerAttach", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID or name of the container", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "detachKeys", + "in": "query", + "description": "Override the key sequence for detaching a container.Format is a single\ncharacter `[a-Z]` or `ctrl-` where `` is one of: `a-z`,\n`@`, `^`, `[`, `,` or `_`.\n", + "schema": { + "type": "string" + } + }, + { + "name": "logs", + "in": "query", + "description": "Replay previous logs from the container.\n\nThis is useful for attaching to a container that has started and you\nwant to output everything since the container started.\n\nIf `stream` is also enabled, once all the previous output has been\nreturned, it will seamlessly transition into streaming current\noutput.\n", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "stream", + "in": "query", + "description": "Stream attached streams from the time the request was made onwards.\n", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "stdin", + "in": "query", + "description": "Attach to `stdin`", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "stdout", + "in": "query", + "description": "Attach to `stdout`", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "stderr", + "in": "query", + "description": "Attach to `stderr`", + "schema": { + "type": "boolean", + "default": false + } + } + ], + "responses": { + "101": { + "description": "no error, hints proxy about hijacking", + "content": {} + }, + "200": { + "description": "no error, no upgrade header found", + "content": {} + }, + "400": { + "description": "bad parameter", + "content": { + "application/vnd.docker.raw-stream": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "application/vnd.docker.multiplexed-stream": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "404": { + "description": "no such container", + "content": { + "application/vnd.docker.raw-stream": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "application/vnd.docker.multiplexed-stream": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "application/json": { + "example": { + "message": "No such container: c2ada9df5af8" + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/vnd.docker.raw-stream": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "application/vnd.docker.multiplexed-stream": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/containers/{id}/attach/ws": { + "get": { + "tags": [ + "Container" + ], + "summary": "Attach to a container via a websocket", + "operationId": "ContainerAttachWebsocket", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID or name of the container", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "detachKeys", + "in": "query", + "description": "Override the key sequence for detaching a container.Format is a single\ncharacter `[a-Z]` or `ctrl-` where `` is one of: `a-z`,\n`@`, `^`, `[`, `,`, or `_`.\n", + "schema": { + "type": "string" + } + }, + { + "name": "logs", + "in": "query", + "description": "Return logs", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "stream", + "in": "query", + "description": "Return stream", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "stdin", + "in": "query", + "description": "Attach to `stdin`", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "stdout", + "in": "query", + "description": "Attach to `stdout`", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "stderr", + "in": "query", + "description": "Attach to `stderr`", + "schema": { + "type": "boolean", + "default": false + } + } + ], + "responses": { + "101": { + "description": "no error, hints proxy about hijacking", + "content": {} + }, + "200": { + "description": "no error, no upgrade header found", + "content": {} + }, + "400": { + "description": "bad parameter", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "404": { + "description": "no such container", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + }, + "example": { + "message": "No such container: c2ada9df5af8" + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/containers/{id}/wait": { + "post": { + "tags": [ + "Container" + ], + "summary": "Wait for a container", + "description": "Block until a container stops, then returns the exit code.", + "operationId": "ContainerWait", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID or name of the container", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "condition", + "in": "query", + "description": "Wait until a container state reaches the given condition.\n\nDefaults to `not-running` if omitted or empty.\n", + "schema": { + "type": "string", + "default": "not-running", + "enum": [ + "not-running", + "next-exit", + "removed" + ] + } + } + ], + "responses": { + "200": { + "description": "The container has exit.", + "content": { + "application/json": { + "schema": { + "title": "ContainerWaitResponse", + "required": [ + "StatusCode" + ], + "type": "object", + "properties": { + "StatusCode": { + "type": "integer", + "description": "Exit code of the container", + "format": "int64", + "nullable": false + }, + "Error": { + "type": "object", + "properties": { + "Message": { + "type": "string", + "description": "Details of an error" + } + }, + "description": "container waiting error, if any", + "x-go-name": "WaitExitError" + } + }, + "description": "OK response to ContainerWait operation", + "x-go-name": "WaitResponse" + } + } + } + }, + "400": { + "description": "bad parameter", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "404": { + "description": "no such container", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + }, + "example": { + "message": "No such container: c2ada9df5af8" + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/containers/{id}": { + "delete": { + "tags": [ + "Container" + ], + "summary": "Remove a container", + "operationId": "ContainerDelete", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID or name of the container", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "v", + "in": "query", + "description": "Remove anonymous volumes associated with the container.", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "force", + "in": "query", + "description": "If the container is running, kill it before removing it.", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "link", + "in": "query", + "description": "Remove the specified link associated with the container.", + "schema": { + "type": "boolean", + "default": false + } + } + ], + "responses": { + "204": { + "description": "no error", + "content": {} + }, + "400": { + "description": "bad parameter", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "404": { + "description": "no such container", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + }, + "example": { + "message": "No such container: c2ada9df5af8" + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "409": { + "description": "conflict", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + }, + "example": { + "message": "You cannot remove a running container: c2ada9df5af8. Stop the\ncontainer before attempting removal or force remove\n" + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/containers/{id}/archive": { + "get": { + "tags": [ + "Container" + ], + "summary": "Get an archive of a filesystem resource in a container", + "description": "Get a tar archive of a resource in the filesystem of container id.", + "operationId": "ContainerArchive", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID or name of the container", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "path", + "in": "query", + "description": "Resource in the container’s filesystem to archive.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "no error", + "content": {} + }, + "400": { + "description": "Bad parameter", + "content": { + "application/x-tar": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "404": { + "description": "Container or path does not exist", + "content": { + "application/x-tar": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "application/json": { + "example": { + "message": "No such container: c2ada9df5af8" + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/x-tar": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + }, + "put": { + "tags": [ + "Container" + ], + "summary": "Extract an archive of files or folders to a directory in a container", + "description": "Upload a tar archive to be extracted to a path in the filesystem of container id.\n`path` parameter is asserted to be a directory. If it exists as a file, 400 error\nwill be returned with message \"not a directory\".\n", + "operationId": "PutContainerArchive", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID or name of the container", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "path", + "in": "query", + "description": "Path to a directory in the container to extract the archive’s contents into. ", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "noOverwriteDirNonDir", + "in": "query", + "description": "If `1`, `true`, or `True` then it will be an error if unpacking the\ngiven content would cause an existing directory to be replaced with\na non-directory and vice versa.\n", + "schema": { + "type": "string" + } + }, + { + "name": "copyUIDGID", + "in": "query", + "description": "If `1`, `true`, then it will copy UID/GID maps to the dest file or\ndir\n", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The input stream must be a tar archive compressed with one of the\nfollowing algorithms: `identity` (no compression), `gzip`, `bzip2`,\nor `xz`.\n", + "content": { + "application/x-tar": { + "schema": { + "type": "string", + "format": "binary" + } + }, + "application/octet-stream": { + "schema": { + "type": "string", + "format": "binary" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The content was extracted successfully", + "content": {} + }, + "400": { + "description": "Bad parameter", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + }, + "example": { + "message": "not a directory" + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "403": { + "description": "Permission denied, the volume or container rootfs is marked as read-only.", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "404": { + "description": "No such container or path does not exist inside the container", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + }, + "example": { + "message": "No such container: c2ada9df5af8" + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "Server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + }, + "x-codegen-request-body-name": "inputStream" + }, + "head": { + "tags": [ + "Container" + ], + "summary": "Get information about files in a container", + "description": "A response header `X-Docker-Container-Path-Stat` is returned, containing\na base64 - encoded JSON object with some filesystem header information\nabout the path.\n", + "operationId": "ContainerArchiveInfo", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID or name of the container", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "path", + "in": "query", + "description": "Resource in the container’s filesystem to archive.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "no error", + "headers": { + "X-Docker-Container-Path-Stat": { + "description": "A base64 - encoded JSON object with some filesystem header\ninformation about the path\n", + "schema": { + "type": "string" + } + } + }, + "content": {} + }, + "400": { + "description": "Bad parameter", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "404": { + "description": "Container or path does not exist", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + }, + "example": { + "message": "No such container: c2ada9df5af8" + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "Server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/containers/prune": { + "post": { + "tags": [ + "Container" + ], + "summary": "Delete stopped containers", + "operationId": "ContainerPrune", + "parameters": [ + { + "name": "filters", + "in": "query", + "description": "Filters to process on the prune list, encoded as JSON (a `map[string][]string`).\n\nAvailable filters:\n- `until=` Prune containers created before this timestamp. The `` can be Unix timestamps, date formatted timestamps, or Go duration strings (e.g. `10m`, `1h30m`) computed relative to the daemon machine’s time.\n- `label` (`label=`, `label==`, `label!=`, or `label!==`) Prune containers with (or without, in case `label!=...` is used) the specified labels.\n", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "No error", + "content": { + "application/json": { + "schema": { + "title": "ContainerPruneResponse", + "type": "object", + "properties": { + "ContainersDeleted": { + "type": "array", + "description": "Container IDs that were deleted", + "items": { + "type": "string" + } + }, + "SpaceReclaimed": { + "type": "integer", + "description": "Disk space reclaimed in bytes", + "format": "int64" + } + } + } + } + } + }, + "500": { + "description": "Server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/images/json": { + "get": { + "tags": [ + "Image" + ], + "summary": "List Images", + "description": "Returns a list of images on the server. Note that it uses a different, smaller representation of an image than inspecting a single image.", + "operationId": "ImageList", + "parameters": [ + { + "name": "all", + "in": "query", + "description": "Show all images. Only images from a final layer (no children) are shown by default.", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "filters", + "in": "query", + "description": "A JSON encoded value of the filters (a `map[string][]string`) to\nprocess on the images list.\n\nAvailable filters:\n\n- `before`=(`[:]`, `` or ``)\n- `dangling=true`\n- `label=key` or `label=\"key=value\"` of an image label\n- `reference`=(`[:]`)\n- `since`=(`[:]`, `` or ``)\n", + "schema": { + "type": "string" + } + }, + { + "name": "shared-size", + "in": "query", + "description": "Compute and show shared size as a `SharedSize` field on each image.", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "digests", + "in": "query", + "description": "Show digest information as a `RepoDigests` field on each image.", + "schema": { + "type": "boolean", + "default": false + } + } + ], + "responses": { + "200": { + "description": "Summary image data for the images matching the query", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "required": [ + "Containers", + "Created", + "Id", + "Labels", + "ParentId", + "RepoDigests", + "RepoTags", + "SharedSize", + "Size" + ], + "type": "object", + "properties": { + "Id": { + "type": "string", + "description": "ID is the content-addressable ID of an image.\n\nThis identifier is a content-addressable digest calculated from the\nimage's configuration (which includes the digests of layers used by\nthe image).\n\nNote that this digest differs from the `RepoDigests` below, which\nholds digests of image manifests that reference the image.\n", + "nullable": false, + "example": "sha256:ec3f0931a6e6b6855d76b2d7b0be30e81860baccd891b2e243280bf1cd8ad710" + }, + "ParentId": { + "type": "string", + "description": "ID of the parent image.\n\nDepending on how the image was created, this field may be empty and\nis only set for images that were built/created locally. This field\nis empty if the image was pulled from an image registry.\n", + "nullable": false, + "example": "" + }, + "RepoTags": { + "type": "array", + "description": "List of image names/tags in the local image cache that reference this\nimage.\n\nMultiple image tags can refer to the same image, and this list may be\nempty if no tags reference the image, in which case the image is\n\"untagged\", in which case it can still be referenced by its ID.\n", + "nullable": false, + "example": [ + "example:1.0", + "example:latest", + "example:stable", + "internal.registry.example.com:5000/example:1.0" + ], + "items": { + "type": "string" + } + }, + "RepoDigests": { + "type": "array", + "description": "List of content-addressable digests of locally available image manifests\nthat the image is referenced from. Multiple manifests can refer to the\nsame image.\n\nThese digests are usually only available if the image was either pulled\nfrom a registry, or if the image was pushed to a registry, which is when\nthe manifest is generated and its digest calculated.\n", + "nullable": false, + "example": [ + "example@sha256:afcc7f1ac1b49db317a7196c902e61c6c3c4607d63599ee1a82d702d249a0ccb", + "internal.registry.example.com:5000/example@sha256:b69959407d21e8a062e0416bf13405bb2b71ed7a84dde4158ebafacfa06f5578" + ], + "items": { + "type": "string" + } + }, + "Created": { + "type": "integer", + "description": "Date and time at which the image was created as a Unix timestamp\n(number of seconds since EPOCH).\n", + "nullable": false, + "example": 1644009612 + }, + "Size": { + "type": "integer", + "description": "Total size of the image including all layers it is composed of.\n", + "format": "int64", + "nullable": false, + "example": 172064416 + }, + "SharedSize": { + "type": "integer", + "description": "Total size of image layers that are shared between this image and other\nimages.\n\nThis size is not calculated by default. `-1` indicates that the value\nhas not been set / calculated.\n", + "format": "int64", + "nullable": false, + "example": 1239828 + }, + "VirtualSize": { + "type": "integer", + "description": "Total size of the image including all layers it is composed of.\n\nIn versions of Docker before v1.10, this field was calculated from\nthe image itself and all of its parent images. Images are now stored\nself-contained, and no longer use a parent-chain, making this field\nan equivalent of the Size field.\n\nDeprecated: this field is kept for backward compatibility, and will be removed in API v1.44.", + "format": "int64", + "example": 172064416 + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "nullable": false, + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "Containers": { + "type": "integer", + "description": "Number of containers using this image. Includes both stopped and running\ncontainers.\n\nThis size is not calculated by default, and depends on which API endpoint\nis used. `-1` indicates that the value has not been set / calculated.\n", + "nullable": false, + "example": 2 + } + } + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/build": { + "post": { + "tags": [ + "Image" + ], + "summary": "Build an image", + "description": "Build an image from a tar archive with a `Dockerfile` in it.\n\nThe `Dockerfile` specifies how the image is built from the tar archive. It is typically in the archive's root, but can be at a different path or have a different name by specifying the `dockerfile` parameter. [See the `Dockerfile` reference for more information](https://docs.docker.com/engine/reference/builder/).\n\nThe Docker daemon performs a preliminary validation of the `Dockerfile` before starting the build, and returns an error if the syntax is incorrect. After that, each instruction is run one-by-one until the ID of the new image is output.\n\nThe build is canceled if the client drops the connection by quitting or being killed.\n", + "operationId": "ImageBuild", + "parameters": [ + { + "name": "dockerfile", + "in": "query", + "description": "Path within the build context to the `Dockerfile`. This is ignored if `remote` is specified and points to an external `Dockerfile`.", + "schema": { + "type": "string", + "default": "Dockerfile" + } + }, + { + "name": "t", + "in": "query", + "description": "A name and optional tag to apply to the image in the `name:tag` format. If you omit the tag the default `latest` value is assumed. You can provide several `t` parameters.", + "schema": { + "type": "string" + } + }, + { + "name": "extrahosts", + "in": "query", + "description": "Extra hosts to add to /etc/hosts", + "schema": { + "type": "string" + } + }, + { + "name": "remote", + "in": "query", + "description": "A Git repository URI or HTTP/HTTPS context URI. If the URI points to a single text file, the file’s contents are placed into a file called `Dockerfile` and the image is built from that file. If the URI points to a tarball, the file is downloaded by the daemon and the contents therein used as the context for the build. If the URI points to a tarball and the `dockerfile` parameter is also specified, there must be a file with the corresponding path inside the tarball.", + "schema": { + "type": "string" + } + }, + { + "name": "q", + "in": "query", + "description": "Suppress verbose build output.", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "nocache", + "in": "query", + "description": "Do not use the cache when building the image.", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "cachefrom", + "in": "query", + "description": "JSON array of images used for build cache resolution.", + "schema": { + "type": "string" + } + }, + { + "name": "pull", + "in": "query", + "description": "Attempt to pull the image even if an older image exists locally.", + "schema": { + "type": "string" + } + }, + { + "name": "rm", + "in": "query", + "description": "Remove intermediate containers after a successful build.", + "schema": { + "type": "boolean", + "default": true + } + }, + { + "name": "forcerm", + "in": "query", + "description": "Always remove intermediate containers, even upon failure.", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "memory", + "in": "query", + "description": "Set memory limit for build.", + "schema": { + "type": "integer" + } + }, + { + "name": "memswap", + "in": "query", + "description": "Total memory (memory + swap). Set as `-1` to disable swap.", + "schema": { + "type": "integer" + } + }, + { + "name": "cpushares", + "in": "query", + "description": "CPU shares (relative weight).", + "schema": { + "type": "integer" + } + }, + { + "name": "cpusetcpus", + "in": "query", + "description": "CPUs in which to allow execution (e.g., `0-3`, `0,1`).", + "schema": { + "type": "string" + } + }, + { + "name": "cpuperiod", + "in": "query", + "description": "The length of a CPU period in microseconds.", + "schema": { + "type": "integer" + } + }, + { + "name": "cpuquota", + "in": "query", + "description": "Microseconds of CPU time that the container can get in a CPU period.", + "schema": { + "type": "integer" + } + }, + { + "name": "buildargs", + "in": "query", + "description": "JSON map of string pairs for build-time variables. Users pass these values at build-time. Docker uses the buildargs as the environment context for commands run via the `Dockerfile` RUN instruction, or for variable expansion in other `Dockerfile` instructions. This is not meant for passing secret values.\n\nFor example, the build arg `FOO=bar` would become `{\"FOO\":\"bar\"}` in JSON. This would result in the query parameter `buildargs={\"FOO\":\"bar\"}`. Note that `{\"FOO\":\"bar\"}` should be URI component encoded.\n\n[Read more about the buildargs instruction.](https://docs.docker.com/engine/reference/builder/#arg)\n", + "schema": { + "type": "string" + } + }, + { + "name": "shmsize", + "in": "query", + "description": "Size of `/dev/shm` in bytes. The size must be greater than 0. If omitted the system uses 64MB.", + "schema": { + "type": "integer" + } + }, + { + "name": "squash", + "in": "query", + "description": "Squash the resulting images layers into a single layer. *(Experimental release only.)*", + "schema": { + "type": "boolean" + } + }, + { + "name": "labels", + "in": "query", + "description": "Arbitrary key/value labels to set on the image, as a JSON map of string pairs.", + "schema": { + "type": "string" + } + }, + { + "name": "networkmode", + "in": "query", + "description": "Sets the networking mode for the run commands during build. Supported\nstandard values are: `bridge`, `host`, `none`, and `container:`.\nAny other value is taken as a custom network's name or ID to which this\ncontainer should connect to.\n", + "schema": { + "type": "string" + } + }, + { + "name": "Content-type", + "in": "header", + "schema": { + "type": "string", + "default": "application/x-tar", + "enum": [ + "application/x-tar" + ] + } + }, + { + "name": "X-Registry-Config", + "in": "header", + "description": "This is a base64-encoded JSON object with auth configurations for multiple registries that a build may refer to.\n\nThe key is a registry URL, and the value is an auth configuration object, [as described in the authentication section](#section/Authentication). For example:\n\n```\n{\n \"docker.example.com\": {\n \"username\": \"janedoe\",\n \"password\": \"hunter2\"\n },\n \"https://index.docker.io/v1/\": {\n \"username\": \"mobydock\",\n \"password\": \"conta1n3rize14\"\n }\n}\n```\n\nOnly the registry domain name (and port if not the default 443) are required. However, for legacy reasons, the Docker Hub registry must be specified with both a `https://` prefix and a `/v1/` suffix even though Docker will prefer to use the v2 registry API.\n", + "schema": { + "type": "string" + } + }, + { + "name": "platform", + "in": "query", + "description": "Platform in the format os[/arch[/variant]]", + "schema": { + "type": "string" + } + }, + { + "name": "target", + "in": "query", + "description": "Target build stage", + "schema": { + "type": "string" + } + }, + { + "name": "outputs", + "in": "query", + "description": "BuildKit output configuration", + "schema": { + "type": "string" + } + }, + { + "name": "version", + "in": "query", + "description": "Version of the builder backend to use.\n\n- `1` is the first generation classic (deprecated) builder in the Docker daemon (default)\n- `2` is [BuildKit](https://github.com/moby/buildkit)\n", + "schema": { + "type": "string", + "default": "1", + "enum": [ + "1", + "2" + ] + } + } + ], + "requestBody": { + "description": "A tar archive compressed with one of the following algorithms: identity (no compression), gzip, bzip2, xz.", + "content": { + "application/octet-stream": { + "schema": { + "type": "string", + "format": "binary" + } + } + }, + "required": false + }, + "responses": { + "200": { + "description": "no error", + "content": {} + }, + "400": { + "description": "Bad parameter", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + }, + "x-codegen-request-body-name": "inputStream" + } + }, + "/build/prune": { + "post": { + "tags": [ + "Image" + ], + "summary": "Delete builder cache", + "operationId": "BuildPrune", + "parameters": [ + { + "name": "keep-storage", + "in": "query", + "description": "Amount of disk space in bytes to keep for cache", + "schema": { + "type": "integer", + "format": "int64" + } + }, + { + "name": "all", + "in": "query", + "description": "Remove all types of build cache", + "schema": { + "type": "boolean" + } + }, + { + "name": "filters", + "in": "query", + "description": "A JSON encoded value of the filters (a `map[string][]string`) to\nprocess on the list of build cache objects.\n\nAvailable filters:\n\n- `until=` remove cache older than ``. The `` can be Unix timestamps, date formatted timestamps, or Go duration strings (e.g. `10m`, `1h30m`) computed relative to the daemon's local time.\n- `id=`\n- `parent=`\n- `type=`\n- `description=`\n- `inuse`\n- `shared`\n- `private`\n", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "No error", + "content": { + "application/json": { + "schema": { + "title": "BuildPruneResponse", + "type": "object", + "properties": { + "CachesDeleted": { + "type": "array", + "items": { + "type": "string", + "description": "ID of build cache object" + } + }, + "SpaceReclaimed": { + "type": "integer", + "description": "Disk space reclaimed in bytes", + "format": "int64" + } + } + } + } + } + }, + "500": { + "description": "Server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/images/create": { + "post": { + "tags": [ + "Image" + ], + "summary": "Create an image", + "description": "Create an image by either pulling it from a registry or importing it.", + "operationId": "ImageCreate", + "parameters": [ + { + "name": "fromImage", + "in": "query", + "description": "Name of the image to pull. The name may include a tag or digest. This parameter may only be used when pulling an image. The pull is cancelled if the HTTP connection is closed.", + "schema": { + "type": "string" + } + }, + { + "name": "fromSrc", + "in": "query", + "description": "Source to import. The value may be a URL from which the image can be retrieved or `-` to read the image from the request body. This parameter may only be used when importing an image.", + "schema": { + "type": "string" + } + }, + { + "name": "repo", + "in": "query", + "description": "Repository name given to an image when it is imported. The repo may include a tag. This parameter may only be used when importing an image.", + "schema": { + "type": "string" + } + }, + { + "name": "tag", + "in": "query", + "description": "Tag or digest. If empty when pulling an image, this causes all tags for the given image to be pulled.", + "schema": { + "type": "string" + } + }, + { + "name": "message", + "in": "query", + "description": "Set commit message for imported image.", + "schema": { + "type": "string" + } + }, + { + "name": "X-Registry-Auth", + "in": "header", + "description": "A base64url-encoded auth configuration.\n\nRefer to the [authentication section](#section/Authentication) for\ndetails.\n", + "schema": { + "type": "string" + } + }, + { + "name": "changes", + "in": "query", + "description": "Apply `Dockerfile` instructions to the image that is created,\nfor example: `changes=ENV DEBUG=true`.\nNote that `ENV DEBUG=true` should be URI component encoded.\n\nSupported `Dockerfile` instructions:\n`CMD`|`ENTRYPOINT`|`ENV`|`EXPOSE`|`ONBUILD`|`USER`|`VOLUME`|`WORKDIR`\n", + "style": "form", + "explode": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "name": "platform", + "in": "query", + "description": "Platform in the format os[/arch[/variant]].\n\nWhen used in combination with the `fromImage` option, the daemon checks\nif the given image is present in the local image cache with the given\nOS and Architecture, and otherwise attempts to pull the image. If the\noption is not set, the host's native OS and Architecture are used.\nIf the given image does not exist in the local image cache, the daemon\nattempts to pull the image with the host's native OS and Architecture.\nIf the given image does exists in the local image cache, but its OS or\narchitecture does not match, a warning is produced.\n\nWhen used with the `fromSrc` option to import an image from an archive,\nthis option sets the platform information for the imported image. If\nthe option is not set, the host's native OS and Architecture are used\nfor the imported image.\n", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "Image content if the value `-` has been specified in fromSrc query parameter", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + }, + "application/octet-stream": { + "schema": { + "type": "string" + } + } + }, + "required": false + }, + "responses": { + "200": { + "description": "no error", + "content": {} + }, + "404": { + "description": "repository does not exist or no read access", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + }, + "x-codegen-request-body-name": "inputImage" + } + }, + "/images/{name}/json": { + "get": { + "tags": [ + "Image" + ], + "summary": "Inspect an image", + "description": "Return low-level information about an image.", + "operationId": "ImageInspect", + "parameters": [ + { + "name": "name", + "in": "path", + "description": "Image name or id", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "No error", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "Id": { + "type": "string", + "description": "ID is the content-addressable ID of an image.\n\nThis identifier is a content-addressable digest calculated from the\nimage's configuration (which includes the digests of layers used by\nthe image).\n\nNote that this digest differs from the `RepoDigests` below, which\nholds digests of image manifests that reference the image.\n", + "nullable": false, + "example": "sha256:ec3f0931a6e6b6855d76b2d7b0be30e81860baccd891b2e243280bf1cd8ad710" + }, + "RepoTags": { + "type": "array", + "description": "List of image names/tags in the local image cache that reference this\nimage.\n\nMultiple image tags can refer to the same image, and this list may be\nempty if no tags reference the image, in which case the image is\n\"untagged\", in which case it can still be referenced by its ID.\n", + "example": [ + "example:1.0", + "example:latest", + "example:stable", + "internal.registry.example.com:5000/example:1.0" + ], + "items": { + "type": "string" + } + }, + "RepoDigests": { + "type": "array", + "description": "List of content-addressable digests of locally available image manifests\nthat the image is referenced from. Multiple manifests can refer to the\nsame image.\n\nThese digests are usually only available if the image was either pulled\nfrom a registry, or if the image was pushed to a registry, which is when\nthe manifest is generated and its digest calculated.\n", + "example": [ + "example@sha256:afcc7f1ac1b49db317a7196c902e61c6c3c4607d63599ee1a82d702d249a0ccb", + "internal.registry.example.com:5000/example@sha256:b69959407d21e8a062e0416bf13405bb2b71ed7a84dde4158ebafacfa06f5578" + ], + "items": { + "type": "string" + } + }, + "Parent": { + "type": "string", + "description": "ID of the parent image.\n\nDepending on how the image was created, this field may be empty and\nis only set for images that were built/created locally. This field\nis empty if the image was pulled from an image registry.\n", + "nullable": false, + "example": "" + }, + "Comment": { + "type": "string", + "description": "Optional message that was set when committing or importing the image.\n", + "nullable": false, + "example": "" + }, + "Created": { + "type": "string", + "description": "Date and time at which the image was created, formatted in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "nullable": false, + "example": "2022-02-04T21:20:12.497794809Z" + }, + "Container": { + "type": "string", + "description": "The ID of the container that was used to create the image.\n\nDepending on how the image was created, this field may be empty.\n", + "nullable": false, + "example": "65974bc86f1770ae4bff79f651ebdbce166ae9aada632ee3fa9af3a264911735" + }, + "ContainerConfig": { + "type": "object", + "properties": { + "Hostname": { + "type": "string", + "description": "The hostname to use for the container, as a valid RFC 1123 hostname.\n", + "example": "439f4e91bd1d" + }, + "Domainname": { + "type": "string", + "description": "The domain name to use for the container.\n" + }, + "User": { + "type": "string", + "description": "The user that commands are run as inside the container." + }, + "AttachStdin": { + "type": "boolean", + "description": "Whether to attach to `stdin`.", + "default": false + }, + "AttachStdout": { + "type": "boolean", + "description": "Whether to attach to `stdout`.", + "default": true + }, + "AttachStderr": { + "type": "boolean", + "description": "Whether to attach to `stderr`.", + "default": true + }, + "ExposedPorts": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": {} + }, + "description": "An object mapping ports to an empty object in the form:\n\n`{\"/\": {}}`\n", + "nullable": true, + "example": { + "80/tcp": {}, + "443/tcp": {} + } + }, + "Tty": { + "type": "boolean", + "description": "Attach standard streams to a TTY, including `stdin` if it is not closed.\n", + "default": false + }, + "OpenStdin": { + "type": "boolean", + "description": "Open `stdin`", + "default": false + }, + "StdinOnce": { + "type": "boolean", + "description": "Close `stdin` after one attached client disconnects", + "default": false + }, + "Env": { + "type": "array", + "description": "A list of environment variables to set inside the container in the\nform `[\"VAR=value\", ...]`. A variable without `=` is removed from the\nenvironment, rather than to have an empty value.\n", + "example": [ + "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + ], + "items": { + "type": "string" + } + }, + "Cmd": { + "type": "array", + "description": "Command to run specified as a string or an array of strings.\n", + "example": [ + "/bin/sh" + ], + "items": { + "type": "string" + } + }, + "Healthcheck": { + "type": "object", + "properties": { + "Test": { + "type": "array", + "description": "The test to perform. Possible values are:\n\n- `[]` inherit healthcheck from image or parent image\n- `[\"NONE\"]` disable healthcheck\n- `[\"CMD\", args...]` exec arguments directly\n- `[\"CMD-SHELL\", command]` run command with system's default shell\n", + "items": { + "type": "string" + } + }, + "Interval": { + "type": "integer", + "description": "The time to wait between checks in nanoseconds. It should be 0 or at\nleast 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Timeout": { + "type": "integer", + "description": "The time to wait before considering the check to have hung. It should\nbe 0 or at least 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Retries": { + "type": "integer", + "description": "The number of consecutive failures needed to consider a container as\nunhealthy. 0 means inherit.\n" + }, + "StartPeriod": { + "type": "integer", + "description": "Start period for the container to initialize before starting\nhealth-retries countdown in nanoseconds. It should be 0 or at least\n1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + } + }, + "description": "A test to perform to check that the container is healthy." + }, + "ArgsEscaped": { + "type": "boolean", + "description": "Command is already escaped (Windows only)", + "nullable": true, + "example": false, + "default": false + }, + "Image": { + "type": "string", + "description": "The name (or reference) of the image to use when creating the container,\nor which was used when the container was created.\n", + "example": "example-image:1.0" + }, + "Volumes": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": {} + }, + "description": "An object mapping mount point paths inside the container to empty\nobjects.\n" + }, + "WorkingDir": { + "type": "string", + "description": "The working directory for commands to run in.", + "example": "/public/" + }, + "Entrypoint": { + "type": "array", + "description": "The entry point for the container as a string or an array of strings.\n\nIf the array consists of exactly one empty string (`[\"\"]`) then the\nentry point is reset to system default (i.e., the entry point used by\ndocker when there is no `ENTRYPOINT` instruction in the `Dockerfile`).\n", + "example": [], + "items": { + "type": "string" + } + }, + "NetworkDisabled": { + "type": "boolean", + "description": "Disable networking for the container.", + "nullable": true + }, + "MacAddress": { + "type": "string", + "description": "MAC address of the container.", + "nullable": true + }, + "OnBuild": { + "type": "array", + "description": "`ONBUILD` metadata that were defined in the image's `Dockerfile`.\n", + "nullable": true, + "example": [], + "items": { + "type": "string" + } + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "StopSignal": { + "type": "string", + "description": "Signal to stop a container as a string or unsigned integer.\n", + "nullable": true, + "example": "SIGTERM" + }, + "StopTimeout": { + "type": "integer", + "description": "Timeout to stop a container in seconds.", + "nullable": true + }, + "Shell": { + "type": "array", + "description": "Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell.\n", + "nullable": true, + "example": [ + "/bin/sh", + "-c" + ], + "items": { + "type": "string" + } + } + }, + "description": "Configuration for a container that is portable between hosts.\n\nWhen used as `ContainerConfig` field in an image, `ContainerConfig` is an\noptional field containing the configuration of the container that was last\ncommitted when creating the image.\n\nPrevious versions of Docker builder used this field to store build cache,\nand it is not in active use anymore.\n" + }, + "DockerVersion": { + "type": "string", + "description": "The version of Docker that was used to build the image.\n\nDepending on how the image was created, this field may be empty.\n", + "nullable": false, + "example": "20.10.7" + }, + "Author": { + "type": "string", + "description": "Name of the author that was specified when committing the image, or as\nspecified through MAINTAINER (deprecated) in the Dockerfile.\n", + "nullable": false, + "example": "" + }, + "Config": { + "type": "object", + "properties": { + "Hostname": { + "type": "string", + "description": "The hostname to use for the container, as a valid RFC 1123 hostname.\n\n


\n\n> **Note**: this field is always empty and must not be used.\n", + "example": "" + }, + "Domainname": { + "type": "string", + "description": "The domain name to use for the container.\n\n


\n\n> **Note**: this field is always empty and must not be used.\n", + "example": "" + }, + "User": { + "type": "string", + "description": "The user that commands are run as inside the container.", + "example": "web:web" + }, + "AttachStdin": { + "type": "boolean", + "description": "Whether to attach to `stdin`.\n\n


\n\n> **Note**: this field is always false and must not be used.\n", + "example": false, + "default": false + }, + "AttachStdout": { + "type": "boolean", + "description": "Whether to attach to `stdout`.\n\n


\n\n> **Note**: this field is always false and must not be used.\n", + "example": false, + "default": false + }, + "AttachStderr": { + "type": "boolean", + "description": "Whether to attach to `stderr`.\n\n


\n\n> **Note**: this field is always false and must not be used.\n", + "example": false, + "default": false + }, + "ExposedPorts": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": {} + }, + "description": "An object mapping ports to an empty object in the form:\n\n`{\"/\": {}}`\n", + "nullable": true, + "example": { + "80/tcp": {}, + "443/tcp": {} + } + }, + "Tty": { + "type": "boolean", + "description": "Attach standard streams to a TTY, including `stdin` if it is not closed.\n\n


\n\n> **Note**: this field is always false and must not be used.\n", + "example": false, + "default": false + }, + "OpenStdin": { + "type": "boolean", + "description": "Open `stdin`\n\n


\n\n> **Note**: this field is always false and must not be used.\n", + "example": false, + "default": false + }, + "StdinOnce": { + "type": "boolean", + "description": "Close `stdin` after one attached client disconnects.\n\n


\n\n> **Note**: this field is always false and must not be used.\n", + "example": false, + "default": false + }, + "Env": { + "type": "array", + "description": "A list of environment variables to set inside the container in the\nform `[\"VAR=value\", ...]`. A variable without `=` is removed from the\nenvironment, rather than to have an empty value.\n", + "example": [ + "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + ], + "items": { + "type": "string" + } + }, + "Cmd": { + "type": "array", + "description": "Command to run specified as a string or an array of strings.\n", + "example": [ + "/bin/sh" + ], + "items": { + "type": "string" + } + }, + "Healthcheck": { + "type": "object", + "properties": { + "Test": { + "type": "array", + "description": "The test to perform. Possible values are:\n\n- `[]` inherit healthcheck from image or parent image\n- `[\"NONE\"]` disable healthcheck\n- `[\"CMD\", args...]` exec arguments directly\n- `[\"CMD-SHELL\", command]` run command with system's default shell\n", + "items": { + "type": "string" + } + }, + "Interval": { + "type": "integer", + "description": "The time to wait between checks in nanoseconds. It should be 0 or at\nleast 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Timeout": { + "type": "integer", + "description": "The time to wait before considering the check to have hung. It should\nbe 0 or at least 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Retries": { + "type": "integer", + "description": "The number of consecutive failures needed to consider a container as\nunhealthy. 0 means inherit.\n" + }, + "StartPeriod": { + "type": "integer", + "description": "Start period for the container to initialize before starting\nhealth-retries countdown in nanoseconds. It should be 0 or at least\n1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + } + }, + "description": "A test to perform to check that the container is healthy." + }, + "ArgsEscaped": { + "type": "boolean", + "description": "Command is already escaped (Windows only)", + "nullable": true, + "example": false, + "default": false + }, + "Image": { + "type": "string", + "description": "The name (or reference) of the image to use when creating the container,\nor which was used when the container was created.\n\n


\n\n> **Note**: this field is always empty and must not be used.\n", + "example": "", + "default": "" + }, + "Volumes": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": {} + }, + "description": "An object mapping mount point paths inside the container to empty\nobjects.\n", + "example": { + "/app/data": {}, + "/app/config": {} + } + }, + "WorkingDir": { + "type": "string", + "description": "The working directory for commands to run in.", + "example": "/public/" + }, + "Entrypoint": { + "type": "array", + "description": "The entry point for the container as a string or an array of strings.\n\nIf the array consists of exactly one empty string (`[\"\"]`) then the\nentry point is reset to system default (i.e., the entry point used by\ndocker when there is no `ENTRYPOINT` instruction in the `Dockerfile`).\n", + "example": [], + "items": { + "type": "string" + } + }, + "NetworkDisabled": { + "type": "boolean", + "description": "Disable networking for the container.\n\n


\n\n> **Note**: this field is always omitted and must not be used.\n", + "nullable": true, + "example": false, + "default": false + }, + "MacAddress": { + "type": "string", + "description": "MAC address of the container.\n\n


\n\n> **Note**: this field is always omitted and must not be used.\n", + "nullable": true, + "example": "", + "default": "" + }, + "OnBuild": { + "type": "array", + "description": "`ONBUILD` metadata that were defined in the image's `Dockerfile`.\n", + "nullable": true, + "example": [], + "items": { + "type": "string" + } + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "StopSignal": { + "type": "string", + "description": "Signal to stop a container as a string or unsigned integer.\n", + "nullable": true, + "example": "SIGTERM" + }, + "StopTimeout": { + "type": "integer", + "description": "Timeout to stop a container in seconds.\n\n


\n\n> **Note**: this field is always omitted and must not be used.\n", + "nullable": true + }, + "Shell": { + "type": "array", + "description": "Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell.\n", + "nullable": true, + "example": [ + "/bin/sh", + "-c" + ], + "items": { + "type": "string" + } + } + }, + "description": "Configuration of the image. These fields are used as defaults\nwhen starting a container from the image.\n", + "example": { + "Hostname": "", + "Domainname": "", + "User": "web:web", + "AttachStdin": false, + "AttachStdout": false, + "AttachStderr": false, + "ExposedPorts": { + "80/tcp": {}, + "443/tcp": {} + }, + "Tty": false, + "OpenStdin": false, + "StdinOnce": false, + "Env": [ + "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + ], + "Cmd": [ + "/bin/sh" + ], + "Healthcheck": { + "Test": [ + "string" + ], + "Interval": 0, + "Timeout": 0, + "Retries": 0, + "StartPeriod": 0, + "StartInterval": 0 + }, + "ArgsEscaped": true, + "Image": "", + "Volumes": { + "/app/data": {}, + "/app/config": {} + }, + "WorkingDir": "/public/", + "Entrypoint": [], + "OnBuild": [], + "Labels": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + }, + "StopSignal": "SIGTERM", + "Shell": [ + "/bin/sh", + "-c" + ] + } + }, + "Architecture": { + "type": "string", + "description": "Hardware CPU architecture that the image runs on.\n", + "nullable": false, + "example": "arm" + }, + "Variant": { + "type": "string", + "description": "CPU architecture variant (presently ARM-only).\n", + "nullable": true, + "example": "v7" + }, + "Os": { + "type": "string", + "description": "Operating System the image is built to run on.\n", + "nullable": false, + "example": "linux" + }, + "OsVersion": { + "type": "string", + "description": "Operating System version the image is built to run on (especially\nfor Windows).\n", + "nullable": true, + "example": "" + }, + "Size": { + "type": "integer", + "description": "Total size of the image including all layers it is composed of.\n", + "format": "int64", + "nullable": false, + "example": 1239828 + }, + "VirtualSize": { + "type": "integer", + "description": "Total size of the image including all layers it is composed of.\n\nIn versions of Docker before v1.10, this field was calculated from\nthe image itself and all of its parent images. Images are now stored\nself-contained, and no longer use a parent-chain, making this field\nan equivalent of the Size field.\n\n> **Deprecated**: this field is kept for backward compatibility, but\n> will be removed in API v1.44.\n", + "format": "int64", + "example": 1239828 + }, + "GraphDriver": { + "required": [ + "Data", + "Name" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the storage driver.", + "nullable": false, + "example": "overlay2" + }, + "Data": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Low-level storage metadata, provided as key/value pairs.\n\nThis information is driver-specific, and depends on the storage-driver\nin use, and should be used for informational purposes only.\n", + "nullable": false, + "example": { + "MergedDir": "/var/lib/docker/overlay2/ef749362d13333e65fc95c572eb525abbe0052e16e086cb64bc3b98ae9aa6d74/merged", + "UpperDir": "/var/lib/docker/overlay2/ef749362d13333e65fc95c572eb525abbe0052e16e086cb64bc3b98ae9aa6d74/diff", + "WorkDir": "/var/lib/docker/overlay2/ef749362d13333e65fc95c572eb525abbe0052e16e086cb64bc3b98ae9aa6d74/work" + } + } + }, + "description": "Information about the storage driver used to store the container's and\nimage's filesystem.\n" + }, + "RootFS": { + "required": [ + "Type" + ], + "type": "object", + "properties": { + "Type": { + "type": "string", + "nullable": false, + "example": "layers" + }, + "Layers": { + "type": "array", + "example": [ + "sha256:1834950e52ce4d5a88a1bbd131c537f4d0e56d10ff0dd69e66be3b7dfa9df7e6", + "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef" + ], + "items": { + "type": "string" + } + } + }, + "description": "Information about the image's RootFS, including the layer IDs.\n" + }, + "Metadata": { + "type": "object", + "properties": { + "LastTagTime": { + "type": "string", + "description": "Date and time at which the image was last tagged in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n\nThis information is only available if the image was tagged locally,\nand omitted otherwise.\n", + "format": "dateTime", + "nullable": true, + "example": "2022-02-28T14:40:02.623929178Z" + } + }, + "description": "Additional metadata of the image in the local cache. This information\nis local to the daemon, and not part of the image itself.\n" + } + }, + "description": "Information about an image in the local image cache.\n" + } + } + } + }, + "404": { + "description": "No such image", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + }, + "example": { + "message": "No such image: someimage (tag: latest)" + } + } + } + }, + "500": { + "description": "Server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/images/{name}/history": { + "get": { + "tags": [ + "Image" + ], + "summary": "Get the history of an image", + "description": "Return parent layers of an image.", + "operationId": "ImageHistory", + "parameters": [ + { + "name": "name", + "in": "path", + "description": "Image name or ID", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "List of image layers", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "title": "HistoryResponseItem", + "required": [ + "Comment", + "Created", + "CreatedBy", + "Id", + "Size", + "Tags" + ], + "type": "object", + "properties": { + "Id": { + "type": "string", + "nullable": false + }, + "Created": { + "type": "integer", + "format": "int64", + "nullable": false + }, + "CreatedBy": { + "type": "string", + "nullable": false + }, + "Tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "Size": { + "type": "integer", + "format": "int64", + "nullable": false + }, + "Comment": { + "type": "string", + "nullable": false + } + }, + "description": "individual image layer information in response to ImageHistory operation", + "x-go-name": "HistoryResponseItem" + } + }, + "example": [ + { + "Id": "3db9c44f45209632d6050b35958829c3a2aa256d81b9a7be45b362ff85c54710", + "Created": 1398108230, + "CreatedBy": "/bin/sh -c #(nop) ADD file:eb15dbd63394e063b805a3c32ca7bf0266ef64676d5a6fab4801f2e81e2a5148 in /", + "Tags": [ + "ubuntu:lucid", + "ubuntu:10.04" + ], + "Size": 182964289, + "Comment": "" + }, + { + "Id": "6cfa4d1f33fb861d4d114f43b25abd0ac737509268065cdfd69d544a59c85ab8", + "Created": 1398108222, + "CreatedBy": "/bin/sh -c #(nop) MAINTAINER Tianon Gravi - mkimage-debootstrap.sh -i iproute,iputils-ping,ubuntu-minimal -t lucid.tar.xz lucid http://archive.ubuntu.com/ubuntu/", + "Tags": [], + "Size": 0, + "Comment": "" + }, + { + "Id": "511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158", + "Created": 1371157430, + "CreatedBy": "", + "Tags": [ + "scratch12:latest", + "scratch:latest" + ], + "Size": 0, + "Comment": "Imported from -" + } + ] + } + } + }, + "404": { + "description": "No such image", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "Server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/images/{name}/push": { + "post": { + "tags": [ + "Image" + ], + "summary": "Push an image", + "description": "Push an image to a registry.\n\nIf you wish to push an image on to a private registry, that image must\nalready have a tag which references the registry. For example,\n`registry.example.com/myimage:latest`.\n\nThe push is cancelled if the HTTP connection is closed.\n", + "operationId": "ImagePush", + "parameters": [ + { + "name": "name", + "in": "path", + "description": "Name of the image to push. For example, `registry.example.com/myimage`.\nThe image must be present in the local image store with the same name.\n\nThe name should be provided without tag; if a tag is provided, it\nis ignored. For example, `registry.example.com/myimage:latest` is\nconsidered equivalent to `registry.example.com/myimage`.\n\nUse the `tag` parameter to specify the tag to push.\n", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "tag", + "in": "query", + "description": "Tag of the image to push. For example, `latest`. If no tag is provided,\nall tags of the given image that are present in the local image store\nare pushed.\n", + "schema": { + "type": "string" + } + }, + { + "name": "X-Registry-Auth", + "in": "header", + "description": "A base64url-encoded auth configuration.\n\nRefer to the [authentication section](#section/Authentication) for\ndetails.\n", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "No error", + "content": {} + }, + "404": { + "description": "No such image", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "Server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/images/{name}/tag": { + "post": { + "tags": [ + "Image" + ], + "summary": "Tag an image", + "description": "Tag an image so that it becomes part of a repository.", + "operationId": "ImageTag", + "parameters": [ + { + "name": "name", + "in": "path", + "description": "Image name or ID to tag.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "repo", + "in": "query", + "description": "The repository to tag in. For example, `someuser/someimage`.", + "schema": { + "type": "string" + } + }, + { + "name": "tag", + "in": "query", + "description": "The name of the new tag.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "201": { + "description": "No error", + "content": {} + }, + "400": { + "description": "Bad parameter", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "404": { + "description": "No such image", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "409": { + "description": "Conflict", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "Server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/images/{name}": { + "delete": { + "tags": [ + "Image" + ], + "summary": "Remove an image", + "description": "Remove an image, along with any untagged parent images that were\nreferenced by that image.\n\nImages can't be removed if they have descendant images, are being\nused by a running container or are being used by a build.\n", + "operationId": "ImageDelete", + "parameters": [ + { + "name": "name", + "in": "path", + "description": "Image name or ID", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "force", + "in": "query", + "description": "Remove the image even if it is being used by stopped containers or has other tags", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "noprune", + "in": "query", + "description": "Do not delete untagged parent images", + "schema": { + "type": "boolean", + "default": false + } + } + ], + "responses": { + "200": { + "description": "The image was deleted successfully", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "Untagged": { + "type": "string", + "description": "The image ID of an image that was untagged" + }, + "Deleted": { + "type": "string", + "description": "The image ID of an image that was deleted" + } + } + } + }, + "example": [ + { + "Untagged": "3e2f21a89f" + }, + { + "Deleted": "3e2f21a89f" + }, + { + "Deleted": "53b4f83ac9" + } + ] + } + } + }, + "404": { + "description": "No such image", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "409": { + "description": "Conflict", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "Server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/images/search": { + "get": { + "tags": [ + "Image" + ], + "summary": "Search images", + "description": "Search for an image on Docker Hub.", + "operationId": "ImageSearch", + "parameters": [ + { + "name": "term", + "in": "query", + "description": "Term to search", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "limit", + "in": "query", + "description": "Maximum number of results to return", + "schema": { + "type": "integer" + } + }, + { + "name": "filters", + "in": "query", + "description": "A JSON encoded value of the filters (a `map[string][]string`) to process on the images list. Available filters:\n\n- `is-automated=(true|false)`\n- `is-official=(true|false)`\n- `stars=` Matches images that has at least 'number' stars.\n", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "No error", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "title": "ImageSearchResponseItem", + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "is_official": { + "type": "boolean" + }, + "is_automated": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "star_count": { + "type": "integer" + } + } + } + }, + "example": [ + { + "description": "", + "is_official": false, + "is_automated": false, + "name": "wma55/u1210sshd", + "star_count": 0 + }, + { + "description": "", + "is_official": false, + "is_automated": false, + "name": "jdswinbank/sshd", + "star_count": 0 + }, + { + "description": "", + "is_official": false, + "is_automated": false, + "name": "vgauthier/sshd", + "star_count": 0 + } + ] + } + } + }, + "500": { + "description": "Server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/images/prune": { + "post": { + "tags": [ + "Image" + ], + "summary": "Delete unused images", + "operationId": "ImagePrune", + "parameters": [ + { + "name": "filters", + "in": "query", + "description": "Filters to process on the prune list, encoded as JSON (a `map[string][]string`). Available filters:\n\n- `dangling=` When set to `true` (or `1`), prune only\n unused *and* untagged images. When set to `false`\n (or `0`), all unused images are pruned.\n- `until=` Prune images created before this timestamp. The `` can be Unix timestamps, date formatted timestamps, or Go duration strings (e.g. `10m`, `1h30m`) computed relative to the daemon machine’s time.\n- `label` (`label=`, `label==`, `label!=`, or `label!==`) Prune images with (or without, in case `label!=...` is used) the specified labels.\n", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "No error", + "content": { + "application/json": { + "schema": { + "title": "ImagePruneResponse", + "type": "object", + "properties": { + "ImagesDeleted": { + "type": "array", + "description": "Images that were deleted", + "items": { + "type": "object", + "properties": { + "Untagged": { + "type": "string", + "description": "The image ID of an image that was untagged" + }, + "Deleted": { + "type": "string", + "description": "The image ID of an image that was deleted" + } + } + } + }, + "SpaceReclaimed": { + "type": "integer", + "description": "Disk space reclaimed in bytes", + "format": "int64" + } + } + } + } + } + }, + "500": { + "description": "Server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/auth": { + "post": { + "tags": [ + "System" + ], + "summary": "Check auth configuration", + "description": "Validate credentials for a registry and, if available, get an identity\ntoken for accessing the registry without password.\n", + "operationId": "SystemAuth", + "requestBody": { + "description": "Authentication to check", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "password": { + "type": "string" + }, + "email": { + "type": "string" + }, + "serveraddress": { + "type": "string" + } + }, + "example": { + "username": "hannibal", + "password": "xxxx", + "serveraddress": "https://index.docker.io/v1/" + } + } + } + }, + "required": false + }, + "responses": { + "200": { + "description": "An identity token was generated successfully.", + "content": { + "application/json": { + "schema": { + "title": "SystemAuthResponse", + "required": [ + "Status" + ], + "type": "object", + "properties": { + "Status": { + "type": "string", + "description": "The status of the authentication", + "nullable": false + }, + "IdentityToken": { + "type": "string", + "description": "An opaque token used to authenticate a user after a successful login", + "nullable": false + } + } + }, + "example": { + "Status": "Login Succeeded", + "IdentityToken": "9cbaf023786cd7..." + } + } + } + }, + "204": { + "description": "No error", + "content": {} + }, + "401": { + "description": "Auth error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "Server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + }, + "x-codegen-request-body-name": "authConfig" + } + }, + "/info": { + "get": { + "tags": [ + "System" + ], + "summary": "Get system information", + "operationId": "SystemInfo", + "responses": { + "200": { + "description": "No error", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "Unique identifier of the daemon.\n\n


\n\n> **Note**: The format of the ID itself is not part of the API, and\n> should not be considered stable.\n", + "example": "7TRN:IPZB:QYBB:VPBQ:UMPP:KARE:6ZNR:XE6T:7EWV:PKF4:ZOJD:TPYS" + }, + "Containers": { + "type": "integer", + "description": "Total number of containers on the host.", + "example": 14 + }, + "ContainersRunning": { + "type": "integer", + "description": "Number of containers with status `\"running\"`.\n", + "example": 3 + }, + "ContainersPaused": { + "type": "integer", + "description": "Number of containers with status `\"paused\"`.\n", + "example": 1 + }, + "ContainersStopped": { + "type": "integer", + "description": "Number of containers with status `\"stopped\"`.\n", + "example": 10 + }, + "Images": { + "type": "integer", + "description": "Total number of images on the host.\n\nBoth _tagged_ and _untagged_ (dangling) images are counted.\n", + "example": 508 + }, + "Driver": { + "type": "string", + "description": "Name of the storage driver in use.", + "example": "overlay2" + }, + "DriverStatus": { + "type": "array", + "description": "Information specific to the storage driver, provided as\n\"label\" / \"value\" pairs.\n\nThis information is provided by the storage driver, and formatted\nin a way consistent with the output of `docker info` on the command\nline.\n\n


\n\n> **Note**: The information returned in this field, including the\n> formatting of values and labels, should not be considered stable,\n> and may change without notice.\n", + "example": [ + [ + "Backing Filesystem", + "extfs" + ], + [ + "Supports d_type", + "true" + ], + [ + "Native Overlay Diff", + "true" + ] + ], + "items": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "DockerRootDir": { + "type": "string", + "description": "Root directory of persistent Docker state.\n\nDefaults to `/var/lib/docker` on Linux, and `C:\\ProgramData\\docker`\non Windows.\n", + "example": "/var/lib/docker" + }, + "Plugins": { + "type": "object", + "properties": { + "Volume": { + "type": "array", + "description": "Names of available volume-drivers, and network-driver plugins.", + "example": [ + "local" + ], + "items": { + "type": "string" + } + }, + "Network": { + "type": "array", + "description": "Names of available network-drivers, and network-driver plugins.", + "example": [ + "bridge", + "host", + "ipvlan", + "macvlan", + "null", + "overlay" + ], + "items": { + "type": "string" + } + }, + "Authorization": { + "type": "array", + "description": "Names of available authorization plugins.", + "example": [ + "img-authz-plugin", + "hbm" + ], + "items": { + "type": "string" + } + }, + "Log": { + "type": "array", + "description": "Names of available logging-drivers, and logging-driver plugins.", + "example": [ + "awslogs", + "fluentd", + "gcplogs", + "gelf", + "journald", + "json-file", + "splunk", + "syslog" + ], + "items": { + "type": "string" + } + } + }, + "description": "Available plugins per type.\n\n


\n\n> **Note**: Only unmanaged (V1) plugins are included in this list.\n> V1 plugins are \"lazily\" loaded, and are not returned in this list\n> if there is no resource using the plugin.\n" + }, + "MemoryLimit": { + "type": "boolean", + "description": "Indicates if the host has memory limit support enabled.", + "example": true + }, + "SwapLimit": { + "type": "boolean", + "description": "Indicates if the host has memory swap limit support enabled.", + "example": true + }, + "KernelMemoryTCP": { + "type": "boolean", + "description": "Indicates if the host has kernel memory TCP limit support enabled. This\nfield is omitted if not supported.\n\nKernel memory TCP limits are not supported when using cgroups v2, which\ndoes not support the corresponding `memory.kmem.tcp.limit_in_bytes` cgroup.\n", + "example": true + }, + "CpuCfsPeriod": { + "type": "boolean", + "description": "Indicates if CPU CFS(Completely Fair Scheduler) period is supported by\nthe host.\n", + "example": true + }, + "CpuCfsQuota": { + "type": "boolean", + "description": "Indicates if CPU CFS(Completely Fair Scheduler) quota is supported by\nthe host.\n", + "example": true + }, + "CPUShares": { + "type": "boolean", + "description": "Indicates if CPU Shares limiting is supported by the host.\n", + "example": true + }, + "CPUSet": { + "type": "boolean", + "description": "Indicates if CPUsets (cpuset.cpus, cpuset.mems) are supported by the host.\n\nSee [cpuset(7)](https://www.kernel.org/doc/Documentation/cgroup-v1/cpusets.txt)\n", + "example": true + }, + "PidsLimit": { + "type": "boolean", + "description": "Indicates if the host kernel has PID limit support enabled.", + "example": true + }, + "OomKillDisable": { + "type": "boolean", + "description": "Indicates if OOM killer disable is supported on the host." + }, + "IPv4Forwarding": { + "type": "boolean", + "description": "Indicates IPv4 forwarding is enabled.", + "example": true + }, + "BridgeNfIptables": { + "type": "boolean", + "description": "Indicates if `bridge-nf-call-iptables` is available on the host.", + "example": true + }, + "BridgeNfIp6tables": { + "type": "boolean", + "description": "Indicates if `bridge-nf-call-ip6tables` is available on the host.", + "example": true + }, + "Debug": { + "type": "boolean", + "description": "Indicates if the daemon is running in debug-mode / with debug-level\nlogging enabled.\n", + "example": true + }, + "NFd": { + "type": "integer", + "description": "The total number of file Descriptors in use by the daemon process.\n\nThis information is only returned if debug-mode is enabled.\n", + "example": 64 + }, + "NGoroutines": { + "type": "integer", + "description": "The number of goroutines that currently exist.\n\nThis information is only returned if debug-mode is enabled.\n", + "example": 174 + }, + "SystemTime": { + "type": "string", + "description": "Current system-time in [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt)\nformat with nano-seconds.\n", + "example": "2017-08-08T20:28:29.06202363Z" + }, + "LoggingDriver": { + "type": "string", + "description": "The logging driver to use as a default for new containers.\n" + }, + "CgroupDriver": { + "type": "string", + "description": "The driver to use for managing cgroups.\n", + "example": "cgroupfs", + "default": "cgroupfs", + "enum": [ + "cgroupfs", + "systemd", + "none" + ] + }, + "CgroupVersion": { + "type": "string", + "description": "The version of the cgroup.\n", + "example": "1", + "default": "1", + "enum": [ + "1", + "2" + ] + }, + "NEventsListener": { + "type": "integer", + "description": "Number of event listeners subscribed.", + "example": 30 + }, + "KernelVersion": { + "type": "string", + "description": "Kernel version of the host.\n\nOn Linux, this information obtained from `uname`. On Windows this\ninformation is queried from the HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Windows NT\\\\CurrentVersion\\\\\nregistry value, for example _\"10.0 14393 (14393.1198.amd64fre.rs1_release_sec.170427-1353)\"_.\n", + "example": "4.9.38-moby" + }, + "OperatingSystem": { + "type": "string", + "description": "Name of the host's operating system, for example: \"Ubuntu 16.04.2 LTS\"\nor \"Windows Server 2016 Datacenter\"\n", + "example": "Alpine Linux v3.5" + }, + "OSVersion": { + "type": "string", + "description": "Version of the host's operating system\n\n


\n\n> **Note**: The information returned in this field, including its\n> very existence, and the formatting of values, should not be considered\n> stable, and may change without notice.\n", + "example": "16.04" + }, + "OSType": { + "type": "string", + "description": "Generic type of the operating system of the host, as returned by the\nGo runtime (`GOOS`).\n\nCurrently returned values are \"linux\" and \"windows\". A full list of\npossible values can be found in the [Go documentation](https://go.dev/doc/install/source#environment).\n", + "example": "linux" + }, + "Architecture": { + "type": "string", + "description": "Hardware architecture of the host, as returned by the Go runtime\n(`GOARCH`).\n\nA full list of possible values can be found in the [Go documentation](https://go.dev/doc/install/source#environment).\n", + "example": "x86_64" + }, + "NCPU": { + "type": "integer", + "description": "The number of logical CPUs usable by the daemon.\n\nThe number of available CPUs is checked by querying the operating\nsystem when the daemon starts. Changes to operating system CPU\nallocation after the daemon is started are not reflected.\n", + "example": 4 + }, + "MemTotal": { + "type": "integer", + "description": "Total amount of physical memory available on the host, in bytes.\n", + "format": "int64", + "example": 2095882240 + }, + "IndexServerAddress": { + "type": "string", + "description": "Address / URL of the index server that is used for image search,\nand as a default for user authentication for Docker Hub and Docker Cloud.\n", + "example": "https://index.docker.io/v1/", + "default": "https://index.docker.io/v1/" + }, + "RegistryConfig": { + "type": "object", + "properties": { + "AllowNondistributableArtifactsCIDRs": { + "type": "array", + "description": "List of IP ranges to which nondistributable artifacts can be pushed,\nusing the CIDR syntax [RFC 4632](https://tools.ietf.org/html/4632).\n\nSome images (for example, Windows base images) contain artifacts\nwhose distribution is restricted by license. When these images are\npushed to a registry, restricted artifacts are not included.\n\nThis configuration override this behavior, and enables the daemon to\npush nondistributable artifacts to all registries whose resolved IP\naddress is within the subnet described by the CIDR syntax.\n\nThis option is useful when pushing images containing\nnondistributable artifacts to a registry on an air-gapped network so\nhosts on that network can pull the images without connecting to\nanother server.\n\n> **Warning**: Nondistributable artifacts typically have restrictions\n> on how and where they can be distributed and shared. Only use this\n> feature to push artifacts to private registries and ensure that you\n> are in compliance with any terms that cover redistributing\n> nondistributable artifacts.\n", + "example": [ + "::1/128", + "127.0.0.0/8" + ], + "items": { + "type": "string" + } + }, + "AllowNondistributableArtifactsHostnames": { + "type": "array", + "description": "List of registry hostnames to which nondistributable artifacts can be\npushed, using the format `[:]` or `[:]`.\n\nSome images (for example, Windows base images) contain artifacts\nwhose distribution is restricted by license. When these images are\npushed to a registry, restricted artifacts are not included.\n\nThis configuration override this behavior for the specified\nregistries.\n\nThis option is useful when pushing images containing\nnondistributable artifacts to a registry on an air-gapped network so\nhosts on that network can pull the images without connecting to\nanother server.\n\n> **Warning**: Nondistributable artifacts typically have restrictions\n> on how and where they can be distributed and shared. Only use this\n> feature to push artifacts to private registries and ensure that you\n> are in compliance with any terms that cover redistributing\n> nondistributable artifacts.\n", + "example": [ + "registry.internal.corp.example.com:3000", + "[2001:db8:a0b:12f0::1]:443" + ], + "items": { + "type": "string" + } + }, + "InsecureRegistryCIDRs": { + "type": "array", + "description": "List of IP ranges of insecure registries, using the CIDR syntax\n([RFC 4632](https://tools.ietf.org/html/4632)). Insecure registries\naccept un-encrypted (HTTP) and/or untrusted (HTTPS with certificates\nfrom unknown CAs) communication.\n\nBy default, local registries (`127.0.0.0/8`) are configured as\ninsecure. All other registries are secure. Communicating with an\ninsecure registry is not possible if the daemon assumes that registry\nis secure.\n\nThis configuration override this behavior, insecure communication with\nregistries whose resolved IP address is within the subnet described by\nthe CIDR syntax.\n\nRegistries can also be marked insecure by hostname. Those registries\nare listed under `IndexConfigs` and have their `Secure` field set to\n`false`.\n\n> **Warning**: Using this option can be useful when running a local\n> registry, but introduces security vulnerabilities. This option\n> should therefore ONLY be used for testing purposes. For increased\n> security, users should add their CA to their system's list of trusted\n> CAs instead of enabling this option.\n", + "example": [ + "::1/128", + "127.0.0.0/8" + ], + "items": { + "type": "string" + } + }, + "IndexConfigs": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the registry, such as \"docker.io\".\n", + "example": "docker.io" + }, + "Mirrors": { + "type": "array", + "description": "List of mirrors, expressed as URIs.\n", + "example": [ + "https://hub-mirror.corp.example.com:5000/", + "https://registry-2.docker.io/", + "https://registry-3.docker.io/" + ], + "items": { + "type": "string" + } + }, + "Secure": { + "type": "boolean", + "description": "Indicates if the registry is part of the list of insecure\nregistries.\n\nIf `false`, the registry is insecure. Insecure registries accept\nun-encrypted (HTTP) and/or untrusted (HTTPS with certificates from\nunknown CAs) communication.\n\n> **Warning**: Insecure registries can be useful when running a local\n> registry. However, because its use creates security vulnerabilities\n> it should ONLY be enabled for testing purposes. For increased\n> security, users should add their CA to their system's list of\n> trusted CAs instead of enabling this option.\n", + "example": true + }, + "Official": { + "type": "boolean", + "description": "Indicates whether this is an official registry (i.e., Docker Hub / docker.io)\n", + "example": true + } + }, + "description": "IndexInfo contains information about a registry.", + "nullable": true, + "x-nullable": true + }, + "example": { + "127.0.0.1:5000": { + "Name": "127.0.0.1:5000", + "Mirrors": [], + "Secure": false, + "Official": false + }, + "[2001:db8:a0b:12f0::1]:80": { + "Name": "[2001:db8:a0b:12f0::1]:80", + "Mirrors": [], + "Secure": false, + "Official": false + }, + "docker.io": { + "Name": "docker.io", + "Mirrors": [ + "https://hub-mirror.corp.example.com:5000/" + ], + "Secure": true, + "Official": true + }, + "registry.internal.corp.example.com:3000": { + "Name": "registry.internal.corp.example.com:3000", + "Mirrors": [], + "Secure": false, + "Official": false + } + } + }, + "Mirrors": { + "type": "array", + "description": "List of registry URLs that act as a mirror for the official\n(`docker.io`) registry.\n", + "example": [ + "https://hub-mirror.corp.example.com:5000/", + "https://[2001:db8:a0b:12f0::1]/" + ], + "items": { + "type": "string" + } + } + }, + "description": "RegistryServiceConfig stores daemon registry services configuration.\n", + "nullable": true, + "x-nullable": true + }, + "GenericResources": { + "type": "array", + "description": "User-defined resources can be either Integer resources (e.g, `SSD=3`) or\nString resources (e.g, `GPU=UUID1`).\n", + "example": [ + { + "DiscreteResourceSpec": { + "Kind": "SSD", + "Value": 3 + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID1" + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID2" + } + } + ], + "items": { + "type": "object", + "properties": { + "NamedResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + }, + "DiscreteResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "integer", + "format": "int64" + } + } + } + } + } + }, + "HttpProxy": { + "type": "string", + "description": "HTTP-proxy configured for the daemon. This value is obtained from the\n[`HTTP_PROXY`](https://www.gnu.org/software/wget/manual/html_node/Proxies.html) environment variable.\nCredentials ([user info component](https://tools.ietf.org/html/rfc3986#section-3.2.1)) in the proxy URL\nare masked in the API response.\n\nContainers do not automatically inherit this configuration.\n", + "example": "http://xxxxx:xxxxx@proxy.corp.example.com:8080" + }, + "HttpsProxy": { + "type": "string", + "description": "HTTPS-proxy configured for the daemon. This value is obtained from the\n[`HTTPS_PROXY`](https://www.gnu.org/software/wget/manual/html_node/Proxies.html) environment variable.\nCredentials ([user info component](https://tools.ietf.org/html/rfc3986#section-3.2.1)) in the proxy URL\nare masked in the API response.\n\nContainers do not automatically inherit this configuration.\n", + "example": "https://xxxxx:xxxxx@proxy.corp.example.com:4443" + }, + "NoProxy": { + "type": "string", + "description": "Comma-separated list of domain extensions for which no proxy should be\nused. This value is obtained from the [`NO_PROXY`](https://www.gnu.org/software/wget/manual/html_node/Proxies.html)\nenvironment variable.\n\nContainers do not automatically inherit this configuration.\n", + "example": "*.local, 169.254/16" + }, + "Name": { + "type": "string", + "description": "Hostname of the host.", + "example": "node5.corp.example.com" + }, + "Labels": { + "type": "array", + "description": "User-defined labels (key/value metadata) as set on the daemon.\n\n


\n\n> **Note**: When part of a Swarm, nodes can both have _daemon_ labels,\n> set through the daemon configuration, and _node_ labels, set from a\n> manager node in the Swarm. Node labels are not included in this\n> field. Node labels can be retrieved using the `/nodes/(id)` endpoint\n> on a manager node in the Swarm.\n", + "example": [ + "storage=ssd", + "production" + ], + "items": { + "type": "string" + } + }, + "ExperimentalBuild": { + "type": "boolean", + "description": "Indicates if experimental features are enabled on the daemon.\n", + "example": true + }, + "ServerVersion": { + "type": "string", + "description": "Version string of the daemon.\n", + "example": "24.0.2" + }, + "Runtimes": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "path": { + "type": "string", + "description": "Name and, optional, path, of the OCI executable binary.\n\nIf the path is omitted, the daemon searches the host's `$PATH` for the\nbinary and uses the first result.\n", + "example": "/usr/local/bin/my-oci-runtime" + }, + "runtimeArgs": { + "type": "array", + "description": "List of command-line arguments to pass to the runtime when invoked.\n", + "nullable": true, + "example": [ + "--debug", + "--systemd-cgroup=false" + ], + "items": { + "type": "string" + } + } + }, + "description": "Runtime describes an [OCI compliant](https://github.com/opencontainers/runtime-spec)\nruntime.\n\nThe runtime is invoked by the daemon via the `containerd` daemon. OCI\nruntimes act as an interface to the Linux kernel namespaces, cgroups,\nand SELinux.\n" + }, + "description": "List of [OCI compliant](https://github.com/opencontainers/runtime-spec)\nruntimes configured on the daemon. Keys hold the \"name\" used to\nreference the runtime.\n\nThe Docker daemon relies on an OCI compliant runtime (invoked via the\n`containerd` daemon) as its interface to the Linux kernel namespaces,\ncgroups, and SELinux.\n\nThe default runtime is `runc`, and automatically configured. Additional\nruntimes can be configured by the user and will be listed here.\n", + "example": { + "runc": { + "path": "runc" + }, + "runc-master": { + "path": "/go/bin/runc" + }, + "custom": { + "path": "/usr/local/bin/my-oci-runtime", + "runtimeArgs": [ + "--debug", + "--systemd-cgroup=false" + ] + } + } + }, + "DefaultRuntime": { + "type": "string", + "description": "Name of the default OCI runtime that is used when starting containers.\n\nThe default can be overridden per-container at create time.\n", + "example": "runc", + "default": "runc" + }, + "Swarm": { + "type": "object", + "properties": { + "NodeID": { + "type": "string", + "description": "Unique identifier of for this node in the swarm.", + "example": "k67qz4598weg5unwwffg6z1m1", + "default": "" + }, + "NodeAddr": { + "type": "string", + "description": "IP address at which this node can be reached by other nodes in the\nswarm.\n", + "example": "10.0.0.46", + "default": "" + }, + "LocalNodeState": { + "type": "string", + "description": "Current local status of this node.", + "example": "active", + "default": "", + "enum": [ + "", + "inactive", + "pending", + "active", + "error", + "locked" + ] + }, + "ControlAvailable": { + "type": "boolean", + "example": true, + "default": false + }, + "Error": { + "type": "string", + "default": "" + }, + "RemoteManagers": { + "type": "array", + "description": "List of ID's and addresses of other managers in the swarm.\n", + "nullable": true, + "example": [ + { + "NodeID": "71izy0goik036k48jg985xnds", + "Addr": "10.0.0.158:2377" + }, + { + "NodeID": "79y6h1o4gv8n120drcprv5nmc", + "Addr": "10.0.0.159:2377" + }, + { + "NodeID": "k67qz4598weg5unwwffg6z1m1", + "Addr": "10.0.0.46:2377" + } + ], + "items": { + "type": "object", + "properties": { + "NodeID": { + "type": "string", + "description": "Unique identifier of for this node in the swarm." + }, + "Addr": { + "type": "string", + "description": "IP address and ports at which this node can be reached.\n" + } + }, + "description": "Represents a peer-node in the swarm" + } + }, + "Nodes": { + "type": "integer", + "description": "Total number of nodes in the swarm.", + "nullable": true, + "example": 4 + }, + "Managers": { + "type": "integer", + "description": "Total number of managers in the swarm.", + "nullable": true, + "example": 3 + }, + "Cluster": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "The ID of the swarm.", + "example": "abajmipo7b4xz5ip2nrla6b11" + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "description": "Date and time at which the swarm was initialised in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2016-08-18T10:44:24.496525531Z" + }, + "UpdatedAt": { + "type": "string", + "description": "Date and time at which the swarm was last updated in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2017-08-09T07:09:37.632105588Z" + }, + "Spec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the swarm.", + "example": "default" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.corp.type": "production", + "com.example.corp.department": "engineering" + } + }, + "Orchestration": { + "type": "object", + "properties": { + "TaskHistoryRetentionLimit": { + "type": "integer", + "description": "The number of historic tasks to keep per instance or node. If\nnegative, never remove completed or failed tasks.\n", + "format": "int64", + "example": 10 + } + }, + "description": "Orchestration configuration.", + "nullable": true + }, + "Raft": { + "type": "object", + "properties": { + "SnapshotInterval": { + "type": "integer", + "description": "The number of log entries between snapshots.", + "format": "uint64", + "example": 10000 + }, + "KeepOldSnapshots": { + "type": "integer", + "description": "The number of snapshots to keep beyond the current snapshot.\n", + "format": "uint64" + }, + "LogEntriesForSlowFollowers": { + "type": "integer", + "description": "The number of log entries to keep around to sync up slow followers\nafter a snapshot is created.\n", + "format": "uint64", + "example": 500 + }, + "ElectionTick": { + "type": "integer", + "description": "The number of ticks that a follower will wait for a message from\nthe leader before becoming a candidate and starting an election.\n`ElectionTick` must be greater than `HeartbeatTick`.\n\nA tick currently defaults to one second, so these translate\ndirectly to seconds currently, but this is NOT guaranteed.\n", + "example": 3 + }, + "HeartbeatTick": { + "type": "integer", + "description": "The number of ticks between heartbeats. Every HeartbeatTick ticks,\nthe leader will send a heartbeat to the followers.\n\nA tick currently defaults to one second, so these translate\ndirectly to seconds currently, but this is NOT guaranteed.\n", + "example": 1 + } + }, + "description": "Raft configuration." + }, + "Dispatcher": { + "type": "object", + "properties": { + "HeartbeatPeriod": { + "type": "integer", + "description": "The delay for an agent to send a heartbeat to the dispatcher.\n", + "format": "int64", + "example": 5000000000 + } + }, + "description": "Dispatcher configuration.", + "nullable": true + }, + "CAConfig": { + "type": "object", + "properties": { + "NodeCertExpiry": { + "type": "integer", + "description": "The duration node certificates are issued for.", + "format": "int64", + "example": 7776000000000000 + }, + "ExternalCAs": { + "type": "array", + "description": "Configuration for forwarding signing requests to an external\ncertificate authority.\n", + "items": { + "type": "object", + "properties": { + "Protocol": { + "type": "string", + "description": "Protocol for communication with the external CA (currently\nonly `cfssl` is supported).\n", + "default": "cfssl", + "enum": [ + "cfssl" + ] + }, + "URL": { + "type": "string", + "description": "URL where certificate signing requests should be sent.\n" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "An object with key/value pairs that are interpreted as\nprotocol-specific options for the external CA driver.\n" + }, + "CACert": { + "type": "string", + "description": "The root CA certificate (in PEM format) this external CA uses\nto issue TLS certificates (assumed to be to the current swarm\nroot CA certificate if not provided).\n" + } + } + } + }, + "SigningCACert": { + "type": "string", + "description": "The desired signing CA certificate for all swarm node TLS leaf\ncertificates, in PEM format.\n" + }, + "SigningCAKey": { + "type": "string", + "description": "The desired signing CA key for all swarm node TLS leaf certificates,\nin PEM format.\n" + }, + "ForceRotate": { + "type": "integer", + "description": "An integer whose purpose is to force swarm to generate a new\nsigning CA certificate and key, if none have been specified in\n`SigningCACert` and `SigningCAKey`\n", + "format": "uint64" + } + }, + "description": "CA configuration.", + "nullable": true + }, + "EncryptionConfig": { + "type": "object", + "properties": { + "AutoLockManagers": { + "type": "boolean", + "description": "If set, generate a key and use it to lock data stored on the\nmanagers.\n", + "example": false + } + }, + "description": "Parameters related to encryption-at-rest." + }, + "TaskDefaults": { + "type": "object", + "properties": { + "LogDriver": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "The log driver to use as a default for new tasks.\n", + "example": "json-file" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver-specific options for the selected log driver, specified\nas key/value pairs.\n", + "example": { + "max-file": "10", + "max-size": "100m" + } + } + }, + "description": "The log driver to use for tasks created in the orchestrator if\nunspecified by a service.\n\nUpdating this value only affects new tasks. Existing tasks continue\nto use their previously configured log driver until recreated.\n" + } + }, + "description": "Defaults for creating tasks in this cluster." + } + }, + "description": "User modifiable swarm configuration." + }, + "TLSInfo": { + "type": "object", + "properties": { + "TrustRoot": { + "type": "string", + "description": "The root CA certificate(s) that are used to validate leaf TLS\ncertificates.\n" + }, + "CertIssuerSubject": { + "type": "string", + "description": "The base64-url-safe-encoded raw subject bytes of the issuer." + }, + "CertIssuerPublicKey": { + "type": "string", + "description": "The base64-url-safe-encoded raw public key bytes of the issuer.\n" + } + }, + "description": "Information about the issuer of leaf TLS certificates and the trusted root\nCA certificate.\n", + "example": { + "TrustRoot": "-----BEGIN CERTIFICATE-----\nMIIBajCCARCgAwIBAgIUbYqrLSOSQHoxD8CwG6Bi2PJi9c8wCgYIKoZIzj0EAwIw\nEzERMA8GA1UEAxMIc3dhcm0tY2EwHhcNMTcwNDI0MjE0MzAwWhcNMzcwNDE5MjE0\nMzAwWjATMREwDwYDVQQDEwhzd2FybS1jYTBZMBMGByqGSM49AgEGCCqGSM49AwEH\nA0IABJk/VyMPYdaqDXJb/VXh5n/1Yuv7iNrxV3Qb3l06XD46seovcDWs3IZNV1lf\n3Skyr0ofcchipoiHkXBODojJydSjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMB\nAf8EBTADAQH/MB0GA1UdDgQWBBRUXxuRcnFjDfR/RIAUQab8ZV/n4jAKBggqhkjO\nPQQDAgNIADBFAiAy+JTe6Uc3KyLCMiqGl2GyWGQqQDEcO3/YG36x7om65AIhAJvz\npxv6zFeVEkAEEkqIYi0omA9+CjanB/6Bz4n1uw8H\n-----END CERTIFICATE-----\n", + "CertIssuerSubject": "MBMxETAPBgNVBAMTCHN3YXJtLWNh", + "CertIssuerPublicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEmT9XIw9h1qoNclv9VeHmf/Vi6/uI2vFXdBveXTpcPjqx6i9wNazchk1XWV/dKTKvSh9xyGKmiIeRcE4OiMnJ1A==" + } + }, + "RootRotationInProgress": { + "type": "boolean", + "description": "Whether there is currently a root CA rotation in progress for the swarm\n", + "example": false + }, + "DataPathPort": { + "type": "integer", + "description": "DataPathPort specifies the data path port number for data traffic.\nAcceptable port range is 1024 to 49151.\nIf no port is set or is set to 0, the default port (4789) is used.\n", + "format": "uint32", + "example": 4789 + }, + "DefaultAddrPool": { + "type": "array", + "description": "Default Address Pool specifies default subnet pools for global scope\nnetworks.\n", + "items": { + "type": "string", + "format": "CIDR", + "example": "" + } + }, + "SubnetSize": { + "maximum": 29, + "type": "integer", + "description": "SubnetSize specifies the subnet size of the networks created from the\ndefault subnet pool.\n", + "format": "uint32", + "example": 24 + } + }, + "description": "ClusterInfo represents information about the swarm as is returned by the\n\"/info\" endpoint. Join-tokens are not included.\n", + "nullable": true, + "x-nullable": true + } + }, + "description": "Represents generic information about swarm.\n" + }, + "LiveRestoreEnabled": { + "type": "boolean", + "description": "Indicates if live restore is enabled.\n\nIf enabled, containers are kept running when the daemon is shutdown\nor upon daemon start if running containers are detected.\n", + "example": false, + "default": false + }, + "Isolation": { + "type": "string", + "description": "Represents the isolation technology to use as a default for containers.\nThe supported values are platform-specific.\n\nIf no isolation value is specified on daemon start, on Windows client,\nthe default is `hyperv`, and on Windows server, the default is `process`.\n\nThis option is currently not used on other platforms.\n", + "default": "default", + "enum": [ + "default", + "hyperv", + "process", + "" + ] + }, + "InitBinary": { + "type": "string", + "description": "Name and, optional, path of the `docker-init` binary.\n\nIf the path is omitted, the daemon searches the host's `$PATH` for the\nbinary and uses the first result.\n", + "example": "docker-init" + }, + "ContainerdCommit": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "Actual commit ID of external tool.", + "example": "cfb82a876ecc11b5ca0977d1733adbe58599088a" + }, + "Expected": { + "type": "string", + "description": "Commit ID of external tool expected by dockerd as set at build time.\n", + "example": "2d41c047c83e09a6d61d464906feb2a2f3c52aa4" + } + }, + "description": "Commit holds the Git-commit (SHA1) that a binary was built from, as\nreported in the version-string of external tools, such as `containerd`,\nor `runC`.\n" + }, + "RuncCommit": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "Actual commit ID of external tool.", + "example": "cfb82a876ecc11b5ca0977d1733adbe58599088a" + }, + "Expected": { + "type": "string", + "description": "Commit ID of external tool expected by dockerd as set at build time.\n", + "example": "2d41c047c83e09a6d61d464906feb2a2f3c52aa4" + } + }, + "description": "Commit holds the Git-commit (SHA1) that a binary was built from, as\nreported in the version-string of external tools, such as `containerd`,\nor `runC`.\n" + }, + "InitCommit": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "Actual commit ID of external tool.", + "example": "cfb82a876ecc11b5ca0977d1733adbe58599088a" + }, + "Expected": { + "type": "string", + "description": "Commit ID of external tool expected by dockerd as set at build time.\n", + "example": "2d41c047c83e09a6d61d464906feb2a2f3c52aa4" + } + }, + "description": "Commit holds the Git-commit (SHA1) that a binary was built from, as\nreported in the version-string of external tools, such as `containerd`,\nor `runC`.\n" + }, + "SecurityOptions": { + "type": "array", + "description": "List of security features that are enabled on the daemon, such as\napparmor, seccomp, SELinux, user-namespaces (userns), rootless and\nno-new-privileges.\n\nAdditional configuration options for each security feature may\nbe present, and are included as a comma-separated list of key/value\npairs.\n", + "example": [ + "name=apparmor", + "name=seccomp,profile=default", + "name=selinux", + "name=userns", + "name=rootless" + ], + "items": { + "type": "string" + } + }, + "ProductLicense": { + "type": "string", + "description": "Reports a summary of the product license on the daemon.\n\nIf a commercial license has been applied to the daemon, information\nsuch as number of nodes, and expiration are included.\n", + "example": "Community Engine" + }, + "DefaultAddressPools": { + "type": "array", + "description": "List of custom default address pools for local networks, which can be\nspecified in the daemon.json file or dockerd option.\n\nExample: a Base \"10.10.0.0/16\" with Size 24 will define the set of 256\n10.10.[0-255].0/24 address pools.\n", + "items": { + "type": "object", + "properties": { + "Base": { + "type": "string", + "description": "The network address in CIDR format", + "example": "10.10.0.0/16" + }, + "Size": { + "type": "integer", + "description": "The network pool size", + "example": 24 + } + } + } + }, + "Warnings": { + "type": "array", + "description": "List of warnings / informational messages about missing features, or\nissues related to the daemon configuration.\n\nThese messages can be printed by the client as information to the user.\n", + "example": [ + "WARNING: No memory limit support" + ], + "items": { + "type": "string" + } + } + } + } + } + } + }, + "500": { + "description": "Server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/version": { + "get": { + "tags": [ + "System" + ], + "summary": "Get version", + "description": "Returns the version of Docker that is running and various information about the system that Docker is running on.", + "operationId": "SystemVersion", + "responses": { + "200": { + "description": "no error", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "Platform": { + "required": [ + "Name" + ], + "type": "object", + "properties": { + "Name": { + "type": "string" + } + } + }, + "Components": { + "type": "array", + "description": "Information about system components\n", + "items": { + "required": [ + "Name", + "Version" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the component\n", + "example": "Engine" + }, + "Version": { + "type": "string", + "description": "Version of the component\n", + "nullable": false, + "example": "19.03.12" + }, + "Details": { + "type": "object", + "properties": {}, + "description": "Key/value pairs of strings with additional information about the\ncomponent. These values are intended for informational purposes\nonly, and their content is not defined, and not part of the API\nspecification.\n\nThese messages can be printed by the client as information to the user.\n", + "nullable": true + } + }, + "x-go-name": "ComponentVersion" + } + }, + "Version": { + "type": "string", + "description": "The version of the daemon", + "example": "19.03.12" + }, + "ApiVersion": { + "type": "string", + "description": "The default (and highest) API version that is supported by the daemon\n", + "example": "1.40" + }, + "MinAPIVersion": { + "type": "string", + "description": "The minimum API version that is supported by the daemon\n", + "example": "1.12" + }, + "GitCommit": { + "type": "string", + "description": "The Git commit of the source code that was used to build the daemon\n", + "example": "48a66213fe" + }, + "GoVersion": { + "type": "string", + "description": "The version Go used to compile the daemon, and the version of the Go\nruntime in use.\n", + "example": "go1.13.14" + }, + "Os": { + "type": "string", + "description": "The operating system that the daemon is running on (\"linux\" or \"windows\")\n", + "example": "linux" + }, + "Arch": { + "type": "string", + "description": "The architecture that the daemon is running on\n", + "example": "amd64" + }, + "KernelVersion": { + "type": "string", + "description": "The kernel version (`uname -r`) that the daemon is running on.\n\nThis field is omitted when empty.\n", + "example": "4.19.76-linuxkit" + }, + "Experimental": { + "type": "boolean", + "description": "Indicates if the daemon is started with experimental features enabled.\n\nThis field is omitted when empty / false.\n", + "example": true + }, + "BuildTime": { + "type": "string", + "description": "The date and time that the daemon was compiled.\n", + "example": "2020-06-22T15:49:27.000000000+00:00" + } + }, + "description": "Response of Engine API: GET \"/version\"\n" + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/_ping": { + "get": { + "tags": [ + "System" + ], + "summary": "Ping", + "description": "This is a dummy endpoint you can use to test if the server is accessible.", + "operationId": "SystemPing", + "responses": { + "200": { + "description": "no error", + "headers": { + "Swarm": { + "description": "Contains information about Swarm status of the daemon,\nand if the daemon is acting as a manager or worker node.\n", + "schema": { + "type": "string", + "default": "inactive", + "enum": [ + "inactive", + "pending", + "error", + "locked", + "active/worker", + "active/manager" + ] + } + }, + "Api-Version": { + "description": "Max API Version the server supports", + "schema": { + "type": "string" + } + }, + "Docker-Experimental": { + "description": "If the server is running with experimental mode enabled", + "schema": { + "type": "boolean" + } + }, + "Cache-Control": { + "schema": { + "type": "string", + "default": "no-cache, no-store, must-revalidate" + } + }, + "Pragma": { + "schema": { + "type": "string", + "default": "no-cache" + } + }, + "Builder-Version": { + "description": "Default version of docker image builder\n\nThe default on Linux is version \"2\" (BuildKit), but the daemon\ncan be configured to recommend version \"1\" (classic Builder).\nWindows does not yet support BuildKit for native Windows images,\nand uses \"1\" (classic builder) as a default.\n\nThis value is a recommendation as advertised by the daemon, and\nit is up to the client to choose which builder to use.\n", + "schema": { + "type": "string", + "default": "2" + } + } + }, + "content": { + "text/plain": { + "schema": { + "type": "string", + "example": "OK" + } + } + } + }, + "500": { + "description": "server error", + "headers": { + "Cache-Control": { + "schema": { + "type": "string", + "default": "no-cache, no-store, must-revalidate" + } + }, + "Pragma": { + "schema": { + "type": "string", + "default": "no-cache" + } + } + }, + "content": { + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + }, + "head": { + "tags": [ + "System" + ], + "summary": "Ping", + "description": "This is a dummy endpoint you can use to test if the server is accessible.", + "operationId": "SystemPingHead", + "responses": { + "200": { + "description": "no error", + "headers": { + "Swarm": { + "description": "Contains information about Swarm status of the daemon,\nand if the daemon is acting as a manager or worker node.\n", + "schema": { + "type": "string", + "default": "inactive", + "enum": [ + "inactive", + "pending", + "error", + "locked", + "active/worker", + "active/manager" + ] + } + }, + "Api-Version": { + "description": "Max API Version the server supports", + "schema": { + "type": "string" + } + }, + "Docker-Experimental": { + "description": "If the server is running with experimental mode enabled", + "schema": { + "type": "boolean" + } + }, + "Cache-Control": { + "schema": { + "type": "string", + "default": "no-cache, no-store, must-revalidate" + } + }, + "Pragma": { + "schema": { + "type": "string", + "default": "no-cache" + } + }, + "Builder-Version": { + "description": "Default version of docker image builder", + "schema": { + "type": "string" + } + } + }, + "content": { + "text/plain": { + "schema": { + "type": "string", + "example": "(empty)" + } + } + } + }, + "500": { + "description": "server error", + "content": { + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/commit": { + "post": { + "tags": [ + "Image" + ], + "summary": "Create a new image from a container", + "operationId": "ImageCommit", + "parameters": [ + { + "name": "container", + "in": "query", + "description": "The ID or name of the container to commit", + "schema": { + "type": "string" + } + }, + { + "name": "repo", + "in": "query", + "description": "Repository name for the created image", + "schema": { + "type": "string" + } + }, + { + "name": "tag", + "in": "query", + "description": "Tag name for the create image", + "schema": { + "type": "string" + } + }, + { + "name": "comment", + "in": "query", + "description": "Commit message", + "schema": { + "type": "string" + } + }, + { + "name": "author", + "in": "query", + "description": "Author of the image (e.g., `John Hannibal Smith `)", + "schema": { + "type": "string" + } + }, + { + "name": "pause", + "in": "query", + "description": "Whether to pause the container before committing", + "schema": { + "type": "boolean", + "default": true + } + }, + { + "name": "changes", + "in": "query", + "description": "`Dockerfile` instructions to apply while committing", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The container configuration", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "Hostname": { + "type": "string", + "description": "The hostname to use for the container, as a valid RFC 1123 hostname.\n", + "example": "439f4e91bd1d" + }, + "Domainname": { + "type": "string", + "description": "The domain name to use for the container.\n" + }, + "User": { + "type": "string", + "description": "The user that commands are run as inside the container." + }, + "AttachStdin": { + "type": "boolean", + "description": "Whether to attach to `stdin`.", + "default": false + }, + "AttachStdout": { + "type": "boolean", + "description": "Whether to attach to `stdout`.", + "default": true + }, + "AttachStderr": { + "type": "boolean", + "description": "Whether to attach to `stderr`.", + "default": true + }, + "ExposedPorts": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": {} + }, + "description": "An object mapping ports to an empty object in the form:\n\n`{\"/\": {}}`\n", + "nullable": true, + "example": { + "80/tcp": {}, + "443/tcp": {} + } + }, + "Tty": { + "type": "boolean", + "description": "Attach standard streams to a TTY, including `stdin` if it is not closed.\n", + "default": false + }, + "OpenStdin": { + "type": "boolean", + "description": "Open `stdin`", + "default": false + }, + "StdinOnce": { + "type": "boolean", + "description": "Close `stdin` after one attached client disconnects", + "default": false + }, + "Env": { + "type": "array", + "description": "A list of environment variables to set inside the container in the\nform `[\"VAR=value\", ...]`. A variable without `=` is removed from the\nenvironment, rather than to have an empty value.\n", + "example": [ + "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + ], + "items": { + "type": "string" + } + }, + "Cmd": { + "type": "array", + "description": "Command to run specified as a string or an array of strings.\n", + "example": [ + "/bin/sh" + ], + "items": { + "type": "string" + } + }, + "Healthcheck": { + "type": "object", + "properties": { + "Test": { + "type": "array", + "description": "The test to perform. Possible values are:\n\n- `[]` inherit healthcheck from image or parent image\n- `[\"NONE\"]` disable healthcheck\n- `[\"CMD\", args...]` exec arguments directly\n- `[\"CMD-SHELL\", command]` run command with system's default shell\n", + "items": { + "type": "string" + } + }, + "Interval": { + "type": "integer", + "description": "The time to wait between checks in nanoseconds. It should be 0 or at\nleast 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Timeout": { + "type": "integer", + "description": "The time to wait before considering the check to have hung. It should\nbe 0 or at least 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Retries": { + "type": "integer", + "description": "The number of consecutive failures needed to consider a container as\nunhealthy. 0 means inherit.\n" + }, + "StartPeriod": { + "type": "integer", + "description": "Start period for the container to initialize before starting\nhealth-retries countdown in nanoseconds. It should be 0 or at least\n1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + } + }, + "description": "A test to perform to check that the container is healthy." + }, + "ArgsEscaped": { + "type": "boolean", + "description": "Command is already escaped (Windows only)", + "nullable": true, + "example": false, + "default": false + }, + "Image": { + "type": "string", + "description": "The name (or reference) of the image to use when creating the container,\nor which was used when the container was created.\n", + "example": "example-image:1.0" + }, + "Volumes": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": {} + }, + "description": "An object mapping mount point paths inside the container to empty\nobjects.\n" + }, + "WorkingDir": { + "type": "string", + "description": "The working directory for commands to run in.", + "example": "/public/" + }, + "Entrypoint": { + "type": "array", + "description": "The entry point for the container as a string or an array of strings.\n\nIf the array consists of exactly one empty string (`[\"\"]`) then the\nentry point is reset to system default (i.e., the entry point used by\ndocker when there is no `ENTRYPOINT` instruction in the `Dockerfile`).\n", + "example": [], + "items": { + "type": "string" + } + }, + "NetworkDisabled": { + "type": "boolean", + "description": "Disable networking for the container.", + "nullable": true + }, + "MacAddress": { + "type": "string", + "description": "MAC address of the container.", + "nullable": true + }, + "OnBuild": { + "type": "array", + "description": "`ONBUILD` metadata that were defined in the image's `Dockerfile`.\n", + "nullable": true, + "example": [], + "items": { + "type": "string" + } + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "StopSignal": { + "type": "string", + "description": "Signal to stop a container as a string or unsigned integer.\n", + "nullable": true, + "example": "SIGTERM" + }, + "StopTimeout": { + "type": "integer", + "description": "Timeout to stop a container in seconds.", + "nullable": true + }, + "Shell": { + "type": "array", + "description": "Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell.\n", + "nullable": true, + "example": [ + "/bin/sh", + "-c" + ], + "items": { + "type": "string" + } + } + }, + "description": "Configuration for a container that is portable between hosts.\n\nWhen used as `ContainerConfig` field in an image, `ContainerConfig` is an\noptional field containing the configuration of the container that was last\ncommitted when creating the image.\n\nPrevious versions of Docker builder used this field to store build cache,\nand it is not in active use anymore.\n" + } + } + }, + "required": false + }, + "responses": { + "201": { + "description": "no error", + "content": { + "application/json": { + "schema": { + "required": [ + "Id" + ], + "type": "object", + "properties": { + "Id": { + "type": "string", + "description": "The id of the newly created object.", + "nullable": false + } + }, + "description": "Response to an API call that returns just an Id" + } + } + } + }, + "404": { + "description": "no such container", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + }, + "example": { + "message": "No such container: c2ada9df5af8" + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + }, + "x-codegen-request-body-name": "containerConfig" + } + }, + "/events": { + "get": { + "tags": [ + "System" + ], + "summary": "Monitor events", + "description": "Stream real-time events from the server.\n\nVarious objects within Docker report events when something happens to them.\n\nContainers report these events: `attach`, `commit`, `copy`, `create`, `destroy`, `detach`, `die`, `exec_create`, `exec_detach`, `exec_start`, `exec_die`, `export`, `health_status`, `kill`, `oom`, `pause`, `rename`, `resize`, `restart`, `start`, `stop`, `top`, `unpause`, `update`, and `prune`\n\nImages report these events: `delete`, `import`, `load`, `pull`, `push`, `save`, `tag`, `untag`, and `prune`\n\nVolumes report these events: `create`, `mount`, `unmount`, `destroy`, and `prune`\n\nNetworks report these events: `create`, `connect`, `disconnect`, `destroy`, `update`, `remove`, and `prune`\n\nThe Docker daemon reports these events: `reload`\n\nServices report these events: `create`, `update`, and `remove`\n\nNodes report these events: `create`, `update`, and `remove`\n\nSecrets report these events: `create`, `update`, and `remove`\n\nConfigs report these events: `create`, `update`, and `remove`\n\nThe Builder reports `prune` events\n", + "operationId": "SystemEvents", + "parameters": [ + { + "name": "since", + "in": "query", + "description": "Show events created since this timestamp then stream new events.", + "schema": { + "type": "string" + } + }, + { + "name": "until", + "in": "query", + "description": "Show events created until this timestamp then stop streaming.", + "schema": { + "type": "string" + } + }, + { + "name": "filters", + "in": "query", + "description": "A JSON encoded value of filters (a `map[string][]string`) to process on the event list. Available filters:\n\n- `config=` config name or ID\n- `container=` container name or ID\n- `daemon=` daemon name or ID\n- `event=` event type\n- `image=` image name or ID\n- `label=` image or container label\n- `network=` network name or ID\n- `node=` node ID\n- `plugin`= plugin name or ID\n- `scope`= local or swarm\n- `secret=` secret name or ID\n- `service=` service name or ID\n- `type=` object to filter by, one of `container`, `image`, `volume`, `network`, `daemon`, `plugin`, `node`, `service`, `secret` or `config`\n- `volume=` volume name\n", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "no error", + "content": { + "application/json": { + "schema": { + "title": "SystemEventsResponse", + "type": "object", + "properties": { + "Type": { + "type": "string", + "description": "The type of object emitting the event", + "example": "container", + "enum": [ + "builder", + "config", + "container", + "daemon", + "image", + "network", + "node", + "plugin", + "secret", + "service", + "volume" + ] + }, + "Action": { + "type": "string", + "description": "The type of event", + "example": "create" + }, + "Actor": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "The ID of the object emitting the event", + "example": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743" + }, + "Attributes": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Various key/value attributes of the object, depending on its type.\n", + "example": { + "com.example.some-label": "some-label-value", + "image": "alpine:latest", + "name": "my-container" + } + } + }, + "description": "Actor describes something that generates events, like a container, network,\nor a volume.\n" + }, + "scope": { + "type": "string", + "description": "Scope of the event. Engine events are `local` scope. Cluster (Swarm)\nevents are `swarm` scope.\n", + "enum": [ + "local", + "swarm" + ] + }, + "time": { + "type": "integer", + "description": "Timestamp of event", + "format": "int64", + "example": 1629574695 + }, + "timeNano": { + "type": "integer", + "description": "Timestamp of event, with nanosecond accuracy", + "format": "int64", + "example": 1629574695515050000 + } + }, + "description": "EventMessage represents the information an event contains.\n" + } + } + } + }, + "400": { + "description": "bad parameter", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/system/df": { + "get": { + "tags": [ + "System" + ], + "summary": "Get data usage information", + "operationId": "SystemDataUsage", + "parameters": [ + { + "name": "type", + "in": "query", + "description": "Object types, for which to compute and return data.\n", + "style": "form", + "explode": true, + "schema": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "container", + "image", + "volume", + "build-cache" + ] + } + } + } + ], + "responses": { + "200": { + "description": "no error", + "content": { + "application/json": { + "schema": { + "title": "SystemDataUsageResponse", + "type": "object", + "properties": { + "LayersSize": { + "type": "integer", + "format": "int64" + }, + "Images": { + "type": "array", + "items": { + "required": [ + "Containers", + "Created", + "Id", + "Labels", + "ParentId", + "RepoDigests", + "RepoTags", + "SharedSize", + "Size" + ], + "type": "object", + "properties": { + "Id": { + "type": "string", + "description": "ID is the content-addressable ID of an image.\n\nThis identifier is a content-addressable digest calculated from the\nimage's configuration (which includes the digests of layers used by\nthe image).\n\nNote that this digest differs from the `RepoDigests` below, which\nholds digests of image manifests that reference the image.\n", + "nullable": false, + "example": "sha256:ec3f0931a6e6b6855d76b2d7b0be30e81860baccd891b2e243280bf1cd8ad710" + }, + "ParentId": { + "type": "string", + "description": "ID of the parent image.\n\nDepending on how the image was created, this field may be empty and\nis only set for images that were built/created locally. This field\nis empty if the image was pulled from an image registry.\n", + "nullable": false, + "example": "" + }, + "RepoTags": { + "type": "array", + "description": "List of image names/tags in the local image cache that reference this\nimage.\n\nMultiple image tags can refer to the same image, and this list may be\nempty if no tags reference the image, in which case the image is\n\"untagged\", in which case it can still be referenced by its ID.\n", + "nullable": false, + "example": [ + "example:1.0", + "example:latest", + "example:stable", + "internal.registry.example.com:5000/example:1.0" + ], + "items": { + "type": "string" + } + }, + "RepoDigests": { + "type": "array", + "description": "List of content-addressable digests of locally available image manifests\nthat the image is referenced from. Multiple manifests can refer to the\nsame image.\n\nThese digests are usually only available if the image was either pulled\nfrom a registry, or if the image was pushed to a registry, which is when\nthe manifest is generated and its digest calculated.\n", + "nullable": false, + "example": [ + "example@sha256:afcc7f1ac1b49db317a7196c902e61c6c3c4607d63599ee1a82d702d249a0ccb", + "internal.registry.example.com:5000/example@sha256:b69959407d21e8a062e0416bf13405bb2b71ed7a84dde4158ebafacfa06f5578" + ], + "items": { + "type": "string" + } + }, + "Created": { + "type": "integer", + "description": "Date and time at which the image was created as a Unix timestamp\n(number of seconds since EPOCH).\n", + "nullable": false, + "example": 1644009612 + }, + "Size": { + "type": "integer", + "description": "Total size of the image including all layers it is composed of.\n", + "format": "int64", + "nullable": false, + "example": 172064416 + }, + "SharedSize": { + "type": "integer", + "description": "Total size of image layers that are shared between this image and other\nimages.\n\nThis size is not calculated by default. `-1` indicates that the value\nhas not been set / calculated.\n", + "format": "int64", + "nullable": false, + "example": 1239828 + }, + "VirtualSize": { + "type": "integer", + "description": "Total size of the image including all layers it is composed of.\n\nIn versions of Docker before v1.10, this field was calculated from\nthe image itself and all of its parent images. Images are now stored\nself-contained, and no longer use a parent-chain, making this field\nan equivalent of the Size field.\n\nDeprecated: this field is kept for backward compatibility, and will be removed in API v1.44.", + "format": "int64", + "example": 172064416 + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "nullable": false, + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "Containers": { + "type": "integer", + "description": "Number of containers using this image. Includes both stopped and running\ncontainers.\n\nThis size is not calculated by default, and depends on which API endpoint\nis used. `-1` indicates that the value has not been set / calculated.\n", + "nullable": false, + "example": 2 + } + } + } + }, + "Containers": { + "type": "array", + "items": { + "type": "object", + "properties": { + "Id": { + "type": "string", + "description": "The ID of this container", + "x-go-name": "ID" + }, + "Names": { + "type": "array", + "description": "The names that this container has been given", + "items": { + "type": "string" + } + }, + "Image": { + "type": "string", + "description": "The name of the image used when creating this container" + }, + "ImageID": { + "type": "string", + "description": "The ID of the image that this container was created from" + }, + "Command": { + "type": "string", + "description": "Command to run when starting the container" + }, + "Created": { + "type": "integer", + "description": "When the container was created", + "format": "int64" + }, + "Ports": { + "type": "array", + "description": "The ports exposed by this container", + "items": { + "required": [ + "PrivatePort", + "Type" + ], + "type": "object", + "properties": { + "IP": { + "type": "string", + "description": "Host IP address that the container's port is mapped to", + "format": "ip-address" + }, + "PrivatePort": { + "type": "integer", + "description": "Port on the container", + "format": "uint16", + "nullable": false + }, + "PublicPort": { + "type": "integer", + "description": "Port exposed on the host", + "format": "uint16" + }, + "Type": { + "type": "string", + "nullable": false, + "enum": [ + "tcp", + "udp", + "sctp" + ] + } + }, + "description": "An open port on a container", + "example": { + "PrivatePort": 8080, + "PublicPort": 80, + "Type": "tcp" + } + } + }, + "SizeRw": { + "type": "integer", + "description": "The size of files that have been created or changed by this container", + "format": "int64" + }, + "SizeRootFs": { + "type": "integer", + "description": "The total size of all the files in this container", + "format": "int64" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "State": { + "type": "string", + "description": "The state of this container (e.g. `Exited`)" + }, + "Status": { + "type": "string", + "description": "Additional human-readable status of this container (e.g. `Exit 0`)" + }, + "HostConfig": { + "type": "object", + "properties": { + "NetworkMode": { + "type": "string" + } + } + }, + "NetworkSettings": { + "type": "object", + "properties": { + "Networks": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "IPAMConfig": { + "type": "object", + "properties": { + "IPv4Address": { + "type": "string", + "example": "172.20.30.33" + }, + "IPv6Address": { + "type": "string", + "example": "2001:db8:abcd::3033" + }, + "LinkLocalIPs": { + "type": "array", + "example": [ + "169.254.34.68", + "fe80::3468" + ], + "items": { + "type": "string" + } + } + }, + "description": "EndpointIPAMConfig represents an endpoint's IPAM configuration.\n", + "nullable": true, + "x-nullable": true + }, + "Links": { + "type": "array", + "example": [ + "container_1", + "container_2" + ], + "items": { + "type": "string" + } + }, + "Aliases": { + "type": "array", + "example": [ + "server_x", + "server_y" + ], + "items": { + "type": "string" + } + }, + "NetworkID": { + "type": "string", + "description": "Unique ID of the network.\n", + "example": "08754567f1f40222263eab4102e1c733ae697e8e354aa9cd6e18d7402835292a" + }, + "EndpointID": { + "type": "string", + "description": "Unique ID for the service endpoint in a Sandbox.\n", + "example": "b88f5b905aabf2893f3cbc4ee42d1ea7980bbc0a92e2c8922b1e1795298afb0b" + }, + "Gateway": { + "type": "string", + "description": "Gateway address for this network.\n", + "example": "172.17.0.1" + }, + "IPAddress": { + "type": "string", + "description": "IPv4 address.\n", + "example": "172.17.0.4" + }, + "IPPrefixLen": { + "type": "integer", + "description": "Mask length of the IPv4 address.\n", + "example": 16 + }, + "IPv6Gateway": { + "type": "string", + "description": "IPv6 gateway address.\n", + "example": "2001:db8:2::100" + }, + "GlobalIPv6Address": { + "type": "string", + "description": "Global IPv6 address.\n", + "example": "2001:db8::5689" + }, + "GlobalIPv6PrefixLen": { + "type": "integer", + "description": "Mask length of the global IPv6 address.\n", + "format": "int64", + "example": 64 + }, + "MacAddress": { + "type": "string", + "description": "MAC address for the endpoint on this network.\n", + "example": "02:42:ac:11:00:04" + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "DriverOpts is a mapping of driver options and values. These options\nare passed directly to the driver and are driver specific.\n", + "nullable": true, + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + } + }, + "description": "Configuration for a network endpoint." + } + } + }, + "description": "A summary of the container's network settings" + }, + "Mounts": { + "type": "array", + "items": { + "type": "object", + "properties": { + "Type": { + "type": "string", + "description": "The mount type:\n\n- `bind` a mount of a file or directory from the host into the container.\n- `volume` a docker volume with the given `Name`.\n- `tmpfs` a `tmpfs`.\n- `npipe` a named pipe from the host into the container.\n- `cluster` a Swarm cluster volume\n", + "example": "volume", + "enum": [ + "bind", + "volume", + "tmpfs", + "npipe", + "cluster" + ] + }, + "Name": { + "type": "string", + "description": "Name is the name reference to the underlying data defined by `Source`\ne.g., the volume name.\n", + "example": "myvolume" + }, + "Source": { + "type": "string", + "description": "Source location of the mount.\n\nFor volumes, this contains the storage location of the volume (within\n`/var/lib/docker/volumes/`). For bind-mounts, and `npipe`, this contains\nthe source (host) part of the bind-mount. For `tmpfs` mount points, this\nfield is empty.\n", + "example": "/var/lib/docker/volumes/myvolume/_data" + }, + "Destination": { + "type": "string", + "description": "Destination is the path relative to the container root (`/`) where\nthe `Source` is mounted inside the container.\n", + "example": "/usr/share/nginx/html/" + }, + "Driver": { + "type": "string", + "description": "Driver is the volume driver used to create the volume (if it is a volume).\n", + "example": "local" + }, + "Mode": { + "type": "string", + "description": "Mode is a comma separated list of options supplied by the user when\ncreating the bind/volume mount.\n\nThe default is platform-specific (`\"z\"` on Linux, empty on Windows).\n", + "example": "z" + }, + "RW": { + "type": "boolean", + "description": "Whether the mount is mounted writable (read-write).\n", + "example": true + }, + "Propagation": { + "type": "string", + "description": "Propagation describes how mounts are propagated from the host into the\nmount point, and vice-versa. Refer to the [Linux kernel documentation](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt)\nfor details. This field is not used on Windows.\n", + "example": "" + } + }, + "description": "MountPoint represents a mount point configuration inside the container.\nThis is used for reporting the mountpoints in use by a container.\n" + } + } + } + } + }, + "Volumes": { + "type": "array", + "items": { + "required": [ + "Driver", + "Labels", + "Mountpoint", + "Name", + "Options", + "Scope" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the volume.", + "nullable": false, + "example": "tardis" + }, + "Driver": { + "type": "string", + "description": "Name of the volume driver used by the volume.", + "nullable": false, + "example": "custom" + }, + "Mountpoint": { + "type": "string", + "description": "Mount path of the volume on the host.", + "nullable": false, + "example": "/var/lib/docker/volumes/tardis" + }, + "CreatedAt": { + "type": "string", + "description": "Date/Time the volume was created.", + "format": "dateTime", + "example": "2016-06-07T20:31:11.853781916Z" + }, + "Status": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": {} + }, + "description": "Low-level details about the volume, provided by the volume driver.\nDetails are returned as a map with key/value pairs:\n`{\"key\":\"value\",\"key2\":\"value2\"}`.\n\nThe `Status` field is optional, and is omitted if the volume driver\ndoes not support this feature.\n", + "example": { + "hello": "world" + } + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "nullable": false, + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "Scope": { + "type": "string", + "description": "The level at which the volume exists. Either `global` for cluster-wide,\nor `local` for machine level.\n", + "nullable": false, + "example": "local", + "default": "local", + "enum": [ + "local", + "global" + ] + }, + "ClusterVolume": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "The Swarm ID of this volume. Because cluster volumes are Swarm\nobjects, they have an ID, unlike non-cluster volumes. This ID can\nbe used to refer to the Volume instead of the name.\n" + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "format": "dateTime" + }, + "UpdatedAt": { + "type": "string", + "format": "dateTime" + }, + "Spec": { + "type": "object", + "properties": { + "Group": { + "type": "string", + "description": "Group defines the volume group of this volume. Volumes belonging to\nthe same group can be referred to by group name when creating\nServices. Referring to a volume by group instructs Swarm to treat\nvolumes in that group interchangeably for the purpose of scheduling.\nVolumes with an empty string for a group technically all belong to\nthe same, emptystring group.\n" + }, + "AccessMode": { + "type": "object", + "properties": { + "Scope": { + "type": "string", + "description": "The set of nodes this volume can be used on at one time.\n- `single` The volume may only be scheduled to one node at a time.\n- `multi` the volume may be scheduled to any supported number of nodes at a time.\n", + "nullable": false, + "default": "single", + "enum": [ + "single", + "multi" + ] + }, + "Sharing": { + "type": "string", + "description": "The number and way that different tasks can use this volume\nat one time.\n- `none` The volume may only be used by one task at a time.\n- `readonly` The volume may be used by any number of tasks, but they all must mount the volume as readonly\n- `onewriter` The volume may be used by any number of tasks, but only one may mount it as read/write.\n- `all` The volume may have any number of readers and writers.\n", + "nullable": false, + "default": "none", + "enum": [ + "none", + "readonly", + "onewriter", + "all" + ] + }, + "MountVolume": { + "type": "object", + "properties": {}, + "description": "Options for using this volume as a Mount-type volume.\n\n Either MountVolume or BlockVolume, but not both, must be\n present.\n properties:\n FsType:\n type: \"string\"\n description: |\n Specifies the filesystem type for the mount volume.\n Optional.\n MountFlags:\n type: \"array\"\n description: |\n Flags to pass when mounting the volume. Optional.\n items:\n type: \"string\"\nBlockVolume:\n type: \"object\"\n description: |\n Options for using this volume as a Block-type volume.\n Intentionally empty.\n" + }, + "Secrets": { + "type": "array", + "description": "Swarm Secrets that are passed to the CSI storage plugin when\noperating on this volume.\n", + "items": { + "type": "object", + "properties": { + "Key": { + "type": "string", + "description": "Key is the name of the key of the key-value pair passed to\nthe plugin.\n" + }, + "Secret": { + "type": "string", + "description": "Secret is the swarm Secret object from which to read data.\nThis can be a Secret name or ID. The Secret data is\nretrieved by swarm and used as the value of the key-value\npair passed to the plugin.\n" + } + }, + "description": "One cluster volume secret entry. Defines a key-value pair that\nis passed to the plugin.\n" + } + }, + "AccessibilityRequirements": { + "type": "object", + "properties": { + "Requisite": { + "type": "array", + "description": "A list of required topologies, at least one of which the\nvolume must be accessible from.\n", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + }, + "Preferred": { + "type": "array", + "description": "A list of topologies that the volume should attempt to be\nprovisioned in.\n", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + } + }, + "description": "Requirements for the accessible topology of the volume. These\nfields are optional. For an in-depth description of what these\nfields mean, see the CSI specification.\n" + }, + "CapacityRange": { + "type": "object", + "properties": { + "RequiredBytes": { + "type": "integer", + "description": "The volume must be at least this big. The value of 0\nindicates an unspecified minimum\n", + "format": "int64" + }, + "LimitBytes": { + "type": "integer", + "description": "The volume must not be bigger than this. The value of 0\nindicates an unspecified maximum.\n", + "format": "int64" + } + }, + "description": "The desired capacity that the volume should be created with. If\nempty, the plugin will decide the capacity.\n" + }, + "Availability": { + "type": "string", + "description": "The availability of the volume for use in tasks.\n- `active` The volume is fully available for scheduling on the cluster\n- `pause` No new workloads should use the volume, but existing workloads are not stopped.\n- `drain` All workloads using this volume should be stopped and rescheduled, and no new ones should be started.\n", + "nullable": false, + "default": "active", + "enum": [ + "active", + "pause", + "drain" + ] + } + }, + "description": "Defines how the volume is used by tasks.\n" + } + }, + "description": "Cluster-specific options used to create the volume.\n" + }, + "Info": { + "type": "object", + "properties": { + "CapacityBytes": { + "type": "integer", + "description": "The capacity of the volume in bytes. A value of 0 indicates that\nthe capacity is unknown.\n", + "format": "int64" + }, + "VolumeContext": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of strings to strings returned from the storage plugin when\nthe volume is created.\n" + }, + "VolumeID": { + "type": "string", + "description": "The ID of the volume as returned by the CSI storage plugin. This\nis distinct from the volume's ID as provided by Docker. This ID\nis never used by the user when communicating with Docker to refer\nto this volume. If the ID is blank, then the Volume has not been\nsuccessfully created in the plugin yet.\n" + }, + "AccessibleTopology": { + "type": "array", + "description": "The topology this volume is actually accessible from.\n", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + } + }, + "description": "Information about the global status of the volume.\n" + }, + "PublishStatus": { + "type": "array", + "description": "The status of the volume as it pertains to its publishing and use on\nspecific nodes\n", + "items": { + "type": "object", + "properties": { + "NodeID": { + "type": "string", + "description": "The ID of the Swarm node the volume is published on.\n" + }, + "State": { + "type": "string", + "description": "The published state of the volume.\n* `pending-publish` The volume should be published to this node, but the call to the controller plugin to do so has not yet been successfully completed.\n* `published` The volume is published successfully to the node.\n* `pending-node-unpublish` The volume should be unpublished from the node, and the manager is awaiting confirmation from the worker that it has done so.\n* `pending-controller-unpublish` The volume is successfully unpublished from the node, but has not yet been successfully unpublished on the controller.\n", + "enum": [ + "pending-publish", + "published", + "pending-node-unpublish", + "pending-controller-unpublish" + ] + }, + "PublishContext": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of strings to strings returned by the CSI controller\nplugin when a volume is published.\n" + } + } + } + } + }, + "description": "Options and information specific to, and only present on, Swarm CSI\ncluster volumes.\n" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "The driver specific options used when creating the volume.\n", + "example": { + "device": "tmpfs", + "o": "size=100m,uid=1000", + "type": "tmpfs" + } + }, + "UsageData": { + "required": [ + "RefCount", + "Size" + ], + "type": "object", + "properties": { + "Size": { + "type": "integer", + "description": "Amount of disk space used by the volume (in bytes). This information\nis only available for volumes created with the `\"local\"` volume\ndriver. For volumes created with other volume drivers, this field\nis set to `-1` (\"not available\")\n", + "format": "int64", + "nullable": false, + "default": -1 + }, + "RefCount": { + "type": "integer", + "description": "The number of containers referencing this volume. This field\nis set to `-1` if the reference-count is not available.\n", + "format": "int64", + "nullable": false, + "default": -1 + } + }, + "description": "Usage details about the volume. This information is used by the\n`GET /system/df` endpoint, and omitted in other endpoints.\n", + "nullable": true, + "x-go-name": "UsageData" + } + } + } + }, + "BuildCache": { + "type": "array", + "items": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "Unique ID of the build cache record.\n", + "example": "ndlpt0hhvkqcdfkputsk4cq9c" + }, + "Parent": { + "type": "string", + "description": "ID of the parent build cache record.\n\n> **Deprecated**: This field is deprecated, and omitted if empty.\n", + "nullable": true, + "example": "" + }, + "Parents": { + "type": "array", + "description": "List of parent build cache record IDs.\n", + "nullable": true, + "example": [ + "hw53o5aio51xtltp5xjp8v7fx" + ], + "items": { + "type": "string" + } + }, + "Type": { + "type": "string", + "description": "Cache record type.\n", + "example": "regular", + "enum": [ + "internal", + "frontend", + "source.local", + "source.git.checkout", + "exec.cachemount", + "regular" + ] + }, + "Description": { + "type": "string", + "description": "Description of the build-step that produced the build cache.\n", + "example": "mount / from exec /bin/sh -c echo 'Binary::apt::APT::Keep-Downloaded-Packages \"true\";' > /etc/apt/apt.conf.d/keep-cache" + }, + "InUse": { + "type": "boolean", + "description": "Indicates if the build cache is in use.\n", + "example": false + }, + "Shared": { + "type": "boolean", + "description": "Indicates if the build cache is shared.\n", + "example": true + }, + "Size": { + "type": "integer", + "description": "Amount of disk space used by the build cache (in bytes).\n", + "example": 51 + }, + "CreatedAt": { + "type": "string", + "description": "Date and time at which the build cache was created in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2016-08-18T10:44:24.496525531Z" + }, + "LastUsedAt": { + "type": "string", + "description": "Date and time at which the build cache was last used in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "nullable": true, + "example": "2017-08-09T07:09:37.632105588Z" + }, + "UsageCount": { + "type": "integer", + "example": 26 + } + }, + "description": "BuildCache contains information about a build cache record.\n" + } + } + }, + "example": { + "LayersSize": 1092588, + "Images": [ + { + "Id": "sha256:2b8fd9751c4c0f5dd266fcae00707e67a2545ef34f9a29354585f93dac906749", + "ParentId": "", + "RepoTags": [ + "busybox:latest" + ], + "RepoDigests": [ + "busybox@sha256:a59906e33509d14c036c8678d687bd4eec81ed7c4b8ce907b888c607f6a1e0e6" + ], + "Created": 1466724217, + "Size": 1092588, + "SharedSize": 0, + "VirtualSize": 1092588, + "Labels": {}, + "Containers": 1 + } + ], + "Containers": [ + { + "Id": "e575172ed11dc01bfce087fb27bee502db149e1a0fad7c296ad300bbff178148", + "Names": [ + "/top" + ], + "Image": "busybox", + "ImageID": "sha256:2b8fd9751c4c0f5dd266fcae00707e67a2545ef34f9a29354585f93dac906749", + "Command": "top", + "Created": 1472592424, + "Ports": [], + "SizeRootFs": 1092588, + "Labels": {}, + "State": "exited", + "Status": "Exited (0) 56 minutes ago", + "HostConfig": { + "NetworkMode": "default" + }, + "NetworkSettings": { + "Networks": { + "bridge": { + "NetworkID": "d687bc59335f0e5c9ee8193e5612e8aee000c8c62ea170cfb99c098f95899d92", + "EndpointID": "8ed5115aeaad9abb174f68dcf135b49f11daf597678315231a32ca28441dec6a", + "Gateway": "172.18.0.1", + "IPAddress": "172.18.0.2", + "IPPrefixLen": 16, + "IPv6Gateway": "", + "GlobalIPv6Address": "", + "GlobalIPv6PrefixLen": 0, + "MacAddress": "02:42:ac:12:00:02" + } + } + }, + "Mounts": [] + } + ], + "Volumes": [ + { + "Name": "my-volume", + "Driver": "local", + "Mountpoint": "/var/lib/docker/volumes/my-volume/_data", + "Scope": "local", + "UsageData": { + "Size": 10920104, + "RefCount": 2 + } + } + ], + "BuildCache": [ + { + "ID": "hw53o5aio51xtltp5xjp8v7fx", + "Parents": [], + "Type": "regular", + "Description": "pulled from docker.io/library/debian@sha256:234cb88d3020898631af0ccbbcca9a66ae7306ecd30c9720690858c1b007d2a0", + "InUse": false, + "Shared": true, + "Size": 0, + "CreatedAt": "2021-06-28T13:31:01.474619385Z", + "LastUsedAt": "2021-07-07T22:02:32.738075951Z", + "UsageCount": 26 + }, + { + "ID": "ndlpt0hhvkqcdfkputsk4cq9c", + "Parents": [ + "ndlpt0hhvkqcdfkputsk4cq9c" + ], + "Type": "regular", + "Description": "mount / from exec /bin/sh -c echo 'Binary::apt::APT::Keep-Downloaded-Packages \"true\";' > /etc/apt/apt.conf.d/keep-cache", + "InUse": false, + "Shared": true, + "Size": 51, + "CreatedAt": "2021-06-28T13:31:03.002625487Z", + "LastUsedAt": "2021-07-07T22:02:32.773909517Z", + "UsageCount": 26 + } + ] + } + } + }, + "text/plain": { + "schema": { + "title": "SystemDataUsageResponse", + "type": "object", + "properties": { + "LayersSize": { + "type": "integer", + "format": "int64" + }, + "Images": { + "type": "array", + "items": { + "required": [ + "Containers", + "Created", + "Id", + "Labels", + "ParentId", + "RepoDigests", + "RepoTags", + "SharedSize", + "Size" + ], + "type": "object", + "properties": { + "Id": { + "type": "string", + "description": "ID is the content-addressable ID of an image.\n\nThis identifier is a content-addressable digest calculated from the\nimage's configuration (which includes the digests of layers used by\nthe image).\n\nNote that this digest differs from the `RepoDigests` below, which\nholds digests of image manifests that reference the image.\n", + "nullable": false, + "example": "sha256:ec3f0931a6e6b6855d76b2d7b0be30e81860baccd891b2e243280bf1cd8ad710" + }, + "ParentId": { + "type": "string", + "description": "ID of the parent image.\n\nDepending on how the image was created, this field may be empty and\nis only set for images that were built/created locally. This field\nis empty if the image was pulled from an image registry.\n", + "nullable": false, + "example": "" + }, + "RepoTags": { + "type": "array", + "description": "List of image names/tags in the local image cache that reference this\nimage.\n\nMultiple image tags can refer to the same image, and this list may be\nempty if no tags reference the image, in which case the image is\n\"untagged\", in which case it can still be referenced by its ID.\n", + "nullable": false, + "example": [ + "example:1.0", + "example:latest", + "example:stable", + "internal.registry.example.com:5000/example:1.0" + ], + "items": { + "type": "string" + } + }, + "RepoDigests": { + "type": "array", + "description": "List of content-addressable digests of locally available image manifests\nthat the image is referenced from. Multiple manifests can refer to the\nsame image.\n\nThese digests are usually only available if the image was either pulled\nfrom a registry, or if the image was pushed to a registry, which is when\nthe manifest is generated and its digest calculated.\n", + "nullable": false, + "example": [ + "example@sha256:afcc7f1ac1b49db317a7196c902e61c6c3c4607d63599ee1a82d702d249a0ccb", + "internal.registry.example.com:5000/example@sha256:b69959407d21e8a062e0416bf13405bb2b71ed7a84dde4158ebafacfa06f5578" + ], + "items": { + "type": "string" + } + }, + "Created": { + "type": "integer", + "description": "Date and time at which the image was created as a Unix timestamp\n(number of seconds since EPOCH).\n", + "nullable": false, + "example": 1644009612 + }, + "Size": { + "type": "integer", + "description": "Total size of the image including all layers it is composed of.\n", + "format": "int64", + "nullable": false, + "example": 172064416 + }, + "SharedSize": { + "type": "integer", + "description": "Total size of image layers that are shared between this image and other\nimages.\n\nThis size is not calculated by default. `-1` indicates that the value\nhas not been set / calculated.\n", + "format": "int64", + "nullable": false, + "example": 1239828 + }, + "VirtualSize": { + "type": "integer", + "description": "Total size of the image including all layers it is composed of.\n\nIn versions of Docker before v1.10, this field was calculated from\nthe image itself and all of its parent images. Images are now stored\nself-contained, and no longer use a parent-chain, making this field\nan equivalent of the Size field.\n\nDeprecated: this field is kept for backward compatibility, and will be removed in API v1.44.", + "format": "int64", + "example": 172064416 + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "nullable": false, + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "Containers": { + "type": "integer", + "description": "Number of containers using this image. Includes both stopped and running\ncontainers.\n\nThis size is not calculated by default, and depends on which API endpoint\nis used. `-1` indicates that the value has not been set / calculated.\n", + "nullable": false, + "example": 2 + } + } + } + }, + "Containers": { + "type": "array", + "items": { + "type": "object", + "properties": { + "Id": { + "type": "string", + "description": "The ID of this container", + "x-go-name": "ID" + }, + "Names": { + "type": "array", + "description": "The names that this container has been given", + "items": { + "type": "string" + } + }, + "Image": { + "type": "string", + "description": "The name of the image used when creating this container" + }, + "ImageID": { + "type": "string", + "description": "The ID of the image that this container was created from" + }, + "Command": { + "type": "string", + "description": "Command to run when starting the container" + }, + "Created": { + "type": "integer", + "description": "When the container was created", + "format": "int64" + }, + "Ports": { + "type": "array", + "description": "The ports exposed by this container", + "items": { + "required": [ + "PrivatePort", + "Type" + ], + "type": "object", + "properties": { + "IP": { + "type": "string", + "description": "Host IP address that the container's port is mapped to", + "format": "ip-address" + }, + "PrivatePort": { + "type": "integer", + "description": "Port on the container", + "format": "uint16", + "nullable": false + }, + "PublicPort": { + "type": "integer", + "description": "Port exposed on the host", + "format": "uint16" + }, + "Type": { + "type": "string", + "nullable": false, + "enum": [ + "tcp", + "udp", + "sctp" + ] + } + }, + "description": "An open port on a container", + "example": { + "PrivatePort": 8080, + "PublicPort": 80, + "Type": "tcp" + } + } + }, + "SizeRw": { + "type": "integer", + "description": "The size of files that have been created or changed by this container", + "format": "int64" + }, + "SizeRootFs": { + "type": "integer", + "description": "The total size of all the files in this container", + "format": "int64" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "State": { + "type": "string", + "description": "The state of this container (e.g. `Exited`)" + }, + "Status": { + "type": "string", + "description": "Additional human-readable status of this container (e.g. `Exit 0`)" + }, + "HostConfig": { + "type": "object", + "properties": { + "NetworkMode": { + "type": "string" + } + } + }, + "NetworkSettings": { + "type": "object", + "properties": { + "Networks": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "IPAMConfig": { + "type": "object", + "properties": { + "IPv4Address": { + "type": "string", + "example": "172.20.30.33" + }, + "IPv6Address": { + "type": "string", + "example": "2001:db8:abcd::3033" + }, + "LinkLocalIPs": { + "type": "array", + "example": [ + "169.254.34.68", + "fe80::3468" + ], + "items": { + "type": "string" + } + } + }, + "description": "EndpointIPAMConfig represents an endpoint's IPAM configuration.\n", + "nullable": true, + "x-nullable": true + }, + "Links": { + "type": "array", + "example": [ + "container_1", + "container_2" + ], + "items": { + "type": "string" + } + }, + "Aliases": { + "type": "array", + "example": [ + "server_x", + "server_y" + ], + "items": { + "type": "string" + } + }, + "NetworkID": { + "type": "string", + "description": "Unique ID of the network.\n", + "example": "08754567f1f40222263eab4102e1c733ae697e8e354aa9cd6e18d7402835292a" + }, + "EndpointID": { + "type": "string", + "description": "Unique ID for the service endpoint in a Sandbox.\n", + "example": "b88f5b905aabf2893f3cbc4ee42d1ea7980bbc0a92e2c8922b1e1795298afb0b" + }, + "Gateway": { + "type": "string", + "description": "Gateway address for this network.\n", + "example": "172.17.0.1" + }, + "IPAddress": { + "type": "string", + "description": "IPv4 address.\n", + "example": "172.17.0.4" + }, + "IPPrefixLen": { + "type": "integer", + "description": "Mask length of the IPv4 address.\n", + "example": 16 + }, + "IPv6Gateway": { + "type": "string", + "description": "IPv6 gateway address.\n", + "example": "2001:db8:2::100" + }, + "GlobalIPv6Address": { + "type": "string", + "description": "Global IPv6 address.\n", + "example": "2001:db8::5689" + }, + "GlobalIPv6PrefixLen": { + "type": "integer", + "description": "Mask length of the global IPv6 address.\n", + "format": "int64", + "example": 64 + }, + "MacAddress": { + "type": "string", + "description": "MAC address for the endpoint on this network.\n", + "example": "02:42:ac:11:00:04" + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "DriverOpts is a mapping of driver options and values. These options\nare passed directly to the driver and are driver specific.\n", + "nullable": true, + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + } + }, + "description": "Configuration for a network endpoint." + } + } + }, + "description": "A summary of the container's network settings" + }, + "Mounts": { + "type": "array", + "items": { + "type": "object", + "properties": { + "Type": { + "type": "string", + "description": "The mount type:\n\n- `bind` a mount of a file or directory from the host into the container.\n- `volume` a docker volume with the given `Name`.\n- `tmpfs` a `tmpfs`.\n- `npipe` a named pipe from the host into the container.\n- `cluster` a Swarm cluster volume\n", + "example": "volume", + "enum": [ + "bind", + "volume", + "tmpfs", + "npipe", + "cluster" + ] + }, + "Name": { + "type": "string", + "description": "Name is the name reference to the underlying data defined by `Source`\ne.g., the volume name.\n", + "example": "myvolume" + }, + "Source": { + "type": "string", + "description": "Source location of the mount.\n\nFor volumes, this contains the storage location of the volume (within\n`/var/lib/docker/volumes/`). For bind-mounts, and `npipe`, this contains\nthe source (host) part of the bind-mount. For `tmpfs` mount points, this\nfield is empty.\n", + "example": "/var/lib/docker/volumes/myvolume/_data" + }, + "Destination": { + "type": "string", + "description": "Destination is the path relative to the container root (`/`) where\nthe `Source` is mounted inside the container.\n", + "example": "/usr/share/nginx/html/" + }, + "Driver": { + "type": "string", + "description": "Driver is the volume driver used to create the volume (if it is a volume).\n", + "example": "local" + }, + "Mode": { + "type": "string", + "description": "Mode is a comma separated list of options supplied by the user when\ncreating the bind/volume mount.\n\nThe default is platform-specific (`\"z\"` on Linux, empty on Windows).\n", + "example": "z" + }, + "RW": { + "type": "boolean", + "description": "Whether the mount is mounted writable (read-write).\n", + "example": true + }, + "Propagation": { + "type": "string", + "description": "Propagation describes how mounts are propagated from the host into the\nmount point, and vice-versa. Refer to the [Linux kernel documentation](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt)\nfor details. This field is not used on Windows.\n", + "example": "" + } + }, + "description": "MountPoint represents a mount point configuration inside the container.\nThis is used for reporting the mountpoints in use by a container.\n" + } + } + } + } + }, + "Volumes": { + "type": "array", + "items": { + "required": [ + "Driver", + "Labels", + "Mountpoint", + "Name", + "Options", + "Scope" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the volume.", + "nullable": false, + "example": "tardis" + }, + "Driver": { + "type": "string", + "description": "Name of the volume driver used by the volume.", + "nullable": false, + "example": "custom" + }, + "Mountpoint": { + "type": "string", + "description": "Mount path of the volume on the host.", + "nullable": false, + "example": "/var/lib/docker/volumes/tardis" + }, + "CreatedAt": { + "type": "string", + "description": "Date/Time the volume was created.", + "format": "dateTime", + "example": "2016-06-07T20:31:11.853781916Z" + }, + "Status": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": {} + }, + "description": "Low-level details about the volume, provided by the volume driver.\nDetails are returned as a map with key/value pairs:\n`{\"key\":\"value\",\"key2\":\"value2\"}`.\n\nThe `Status` field is optional, and is omitted if the volume driver\ndoes not support this feature.\n", + "example": { + "hello": "world" + } + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "nullable": false, + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "Scope": { + "type": "string", + "description": "The level at which the volume exists. Either `global` for cluster-wide,\nor `local` for machine level.\n", + "nullable": false, + "example": "local", + "default": "local", + "enum": [ + "local", + "global" + ] + }, + "ClusterVolume": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "The Swarm ID of this volume. Because cluster volumes are Swarm\nobjects, they have an ID, unlike non-cluster volumes. This ID can\nbe used to refer to the Volume instead of the name.\n" + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "format": "dateTime" + }, + "UpdatedAt": { + "type": "string", + "format": "dateTime" + }, + "Spec": { + "type": "object", + "properties": { + "Group": { + "type": "string", + "description": "Group defines the volume group of this volume. Volumes belonging to\nthe same group can be referred to by group name when creating\nServices. Referring to a volume by group instructs Swarm to treat\nvolumes in that group interchangeably for the purpose of scheduling.\nVolumes with an empty string for a group technically all belong to\nthe same, emptystring group.\n" + }, + "AccessMode": { + "type": "object", + "properties": { + "Scope": { + "type": "string", + "description": "The set of nodes this volume can be used on at one time.\n- `single` The volume may only be scheduled to one node at a time.\n- `multi` the volume may be scheduled to any supported number of nodes at a time.\n", + "nullable": false, + "default": "single", + "enum": [ + "single", + "multi" + ] + }, + "Sharing": { + "type": "string", + "description": "The number and way that different tasks can use this volume\nat one time.\n- `none` The volume may only be used by one task at a time.\n- `readonly` The volume may be used by any number of tasks, but they all must mount the volume as readonly\n- `onewriter` The volume may be used by any number of tasks, but only one may mount it as read/write.\n- `all` The volume may have any number of readers and writers.\n", + "nullable": false, + "default": "none", + "enum": [ + "none", + "readonly", + "onewriter", + "all" + ] + }, + "MountVolume": { + "type": "object", + "properties": {}, + "description": "Options for using this volume as a Mount-type volume.\n\n Either MountVolume or BlockVolume, but not both, must be\n present.\n properties:\n FsType:\n type: \"string\"\n description: |\n Specifies the filesystem type for the mount volume.\n Optional.\n MountFlags:\n type: \"array\"\n description: |\n Flags to pass when mounting the volume. Optional.\n items:\n type: \"string\"\nBlockVolume:\n type: \"object\"\n description: |\n Options for using this volume as a Block-type volume.\n Intentionally empty.\n" + }, + "Secrets": { + "type": "array", + "description": "Swarm Secrets that are passed to the CSI storage plugin when\noperating on this volume.\n", + "items": { + "type": "object", + "properties": { + "Key": { + "type": "string", + "description": "Key is the name of the key of the key-value pair passed to\nthe plugin.\n" + }, + "Secret": { + "type": "string", + "description": "Secret is the swarm Secret object from which to read data.\nThis can be a Secret name or ID. The Secret data is\nretrieved by swarm and used as the value of the key-value\npair passed to the plugin.\n" + } + }, + "description": "One cluster volume secret entry. Defines a key-value pair that\nis passed to the plugin.\n" + } + }, + "AccessibilityRequirements": { + "type": "object", + "properties": { + "Requisite": { + "type": "array", + "description": "A list of required topologies, at least one of which the\nvolume must be accessible from.\n", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + }, + "Preferred": { + "type": "array", + "description": "A list of topologies that the volume should attempt to be\nprovisioned in.\n", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + } + }, + "description": "Requirements for the accessible topology of the volume. These\nfields are optional. For an in-depth description of what these\nfields mean, see the CSI specification.\n" + }, + "CapacityRange": { + "type": "object", + "properties": { + "RequiredBytes": { + "type": "integer", + "description": "The volume must be at least this big. The value of 0\nindicates an unspecified minimum\n", + "format": "int64" + }, + "LimitBytes": { + "type": "integer", + "description": "The volume must not be bigger than this. The value of 0\nindicates an unspecified maximum.\n", + "format": "int64" + } + }, + "description": "The desired capacity that the volume should be created with. If\nempty, the plugin will decide the capacity.\n" + }, + "Availability": { + "type": "string", + "description": "The availability of the volume for use in tasks.\n- `active` The volume is fully available for scheduling on the cluster\n- `pause` No new workloads should use the volume, but existing workloads are not stopped.\n- `drain` All workloads using this volume should be stopped and rescheduled, and no new ones should be started.\n", + "nullable": false, + "default": "active", + "enum": [ + "active", + "pause", + "drain" + ] + } + }, + "description": "Defines how the volume is used by tasks.\n" + } + }, + "description": "Cluster-specific options used to create the volume.\n" + }, + "Info": { + "type": "object", + "properties": { + "CapacityBytes": { + "type": "integer", + "description": "The capacity of the volume in bytes. A value of 0 indicates that\nthe capacity is unknown.\n", + "format": "int64" + }, + "VolumeContext": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of strings to strings returned from the storage plugin when\nthe volume is created.\n" + }, + "VolumeID": { + "type": "string", + "description": "The ID of the volume as returned by the CSI storage plugin. This\nis distinct from the volume's ID as provided by Docker. This ID\nis never used by the user when communicating with Docker to refer\nto this volume. If the ID is blank, then the Volume has not been\nsuccessfully created in the plugin yet.\n" + }, + "AccessibleTopology": { + "type": "array", + "description": "The topology this volume is actually accessible from.\n", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + } + }, + "description": "Information about the global status of the volume.\n" + }, + "PublishStatus": { + "type": "array", + "description": "The status of the volume as it pertains to its publishing and use on\nspecific nodes\n", + "items": { + "type": "object", + "properties": { + "NodeID": { + "type": "string", + "description": "The ID of the Swarm node the volume is published on.\n" + }, + "State": { + "type": "string", + "description": "The published state of the volume.\n* `pending-publish` The volume should be published to this node, but the call to the controller plugin to do so has not yet been successfully completed.\n* `published` The volume is published successfully to the node.\n* `pending-node-unpublish` The volume should be unpublished from the node, and the manager is awaiting confirmation from the worker that it has done so.\n* `pending-controller-unpublish` The volume is successfully unpublished from the node, but has not yet been successfully unpublished on the controller.\n", + "enum": [ + "pending-publish", + "published", + "pending-node-unpublish", + "pending-controller-unpublish" + ] + }, + "PublishContext": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of strings to strings returned by the CSI controller\nplugin when a volume is published.\n" + } + } + } + } + }, + "description": "Options and information specific to, and only present on, Swarm CSI\ncluster volumes.\n" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "The driver specific options used when creating the volume.\n", + "example": { + "device": "tmpfs", + "o": "size=100m,uid=1000", + "type": "tmpfs" + } + }, + "UsageData": { + "required": [ + "RefCount", + "Size" + ], + "type": "object", + "properties": { + "Size": { + "type": "integer", + "description": "Amount of disk space used by the volume (in bytes). This information\nis only available for volumes created with the `\"local\"` volume\ndriver. For volumes created with other volume drivers, this field\nis set to `-1` (\"not available\")\n", + "format": "int64", + "nullable": false, + "default": -1 + }, + "RefCount": { + "type": "integer", + "description": "The number of containers referencing this volume. This field\nis set to `-1` if the reference-count is not available.\n", + "format": "int64", + "nullable": false, + "default": -1 + } + }, + "description": "Usage details about the volume. This information is used by the\n`GET /system/df` endpoint, and omitted in other endpoints.\n", + "nullable": true, + "x-go-name": "UsageData" + } + } + } + }, + "BuildCache": { + "type": "array", + "items": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "Unique ID of the build cache record.\n", + "example": "ndlpt0hhvkqcdfkputsk4cq9c" + }, + "Parent": { + "type": "string", + "description": "ID of the parent build cache record.\n\n> **Deprecated**: This field is deprecated, and omitted if empty.\n", + "nullable": true, + "example": "" + }, + "Parents": { + "type": "array", + "description": "List of parent build cache record IDs.\n", + "nullable": true, + "example": [ + "hw53o5aio51xtltp5xjp8v7fx" + ], + "items": { + "type": "string" + } + }, + "Type": { + "type": "string", + "description": "Cache record type.\n", + "example": "regular", + "enum": [ + "internal", + "frontend", + "source.local", + "source.git.checkout", + "exec.cachemount", + "regular" + ] + }, + "Description": { + "type": "string", + "description": "Description of the build-step that produced the build cache.\n", + "example": "mount / from exec /bin/sh -c echo 'Binary::apt::APT::Keep-Downloaded-Packages \"true\";' > /etc/apt/apt.conf.d/keep-cache" + }, + "InUse": { + "type": "boolean", + "description": "Indicates if the build cache is in use.\n", + "example": false + }, + "Shared": { + "type": "boolean", + "description": "Indicates if the build cache is shared.\n", + "example": true + }, + "Size": { + "type": "integer", + "description": "Amount of disk space used by the build cache (in bytes).\n", + "example": 51 + }, + "CreatedAt": { + "type": "string", + "description": "Date and time at which the build cache was created in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2016-08-18T10:44:24.496525531Z" + }, + "LastUsedAt": { + "type": "string", + "description": "Date and time at which the build cache was last used in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "nullable": true, + "example": "2017-08-09T07:09:37.632105588Z" + }, + "UsageCount": { + "type": "integer", + "example": 26 + } + }, + "description": "BuildCache contains information about a build cache record.\n" + } + } + }, + "example": { + "LayersSize": 1092588, + "Images": [ + { + "Id": "sha256:2b8fd9751c4c0f5dd266fcae00707e67a2545ef34f9a29354585f93dac906749", + "ParentId": "", + "RepoTags": [ + "busybox:latest" + ], + "RepoDigests": [ + "busybox@sha256:a59906e33509d14c036c8678d687bd4eec81ed7c4b8ce907b888c607f6a1e0e6" + ], + "Created": 1466724217, + "Size": 1092588, + "SharedSize": 0, + "VirtualSize": 1092588, + "Labels": {}, + "Containers": 1 + } + ], + "Containers": [ + { + "Id": "e575172ed11dc01bfce087fb27bee502db149e1a0fad7c296ad300bbff178148", + "Names": [ + "/top" + ], + "Image": "busybox", + "ImageID": "sha256:2b8fd9751c4c0f5dd266fcae00707e67a2545ef34f9a29354585f93dac906749", + "Command": "top", + "Created": 1472592424, + "Ports": [], + "SizeRootFs": 1092588, + "Labels": {}, + "State": "exited", + "Status": "Exited (0) 56 minutes ago", + "HostConfig": { + "NetworkMode": "default" + }, + "NetworkSettings": { + "Networks": { + "bridge": { + "NetworkID": "d687bc59335f0e5c9ee8193e5612e8aee000c8c62ea170cfb99c098f95899d92", + "EndpointID": "8ed5115aeaad9abb174f68dcf135b49f11daf597678315231a32ca28441dec6a", + "Gateway": "172.18.0.1", + "IPAddress": "172.18.0.2", + "IPPrefixLen": 16, + "IPv6Gateway": "", + "GlobalIPv6Address": "", + "GlobalIPv6PrefixLen": 0, + "MacAddress": "02:42:ac:12:00:02" + } + } + }, + "Mounts": [] + } + ], + "Volumes": [ + { + "Name": "my-volume", + "Driver": "local", + "Mountpoint": "/var/lib/docker/volumes/my-volume/_data", + "Scope": "local", + "UsageData": { + "Size": 10920104, + "RefCount": 2 + } + } + ], + "BuildCache": [ + { + "ID": "hw53o5aio51xtltp5xjp8v7fx", + "Parents": [], + "Type": "regular", + "Description": "pulled from docker.io/library/debian@sha256:234cb88d3020898631af0ccbbcca9a66ae7306ecd30c9720690858c1b007d2a0", + "InUse": false, + "Shared": true, + "Size": 0, + "CreatedAt": "2021-06-28T13:31:01.474619385Z", + "LastUsedAt": "2021-07-07T22:02:32.738075951Z", + "UsageCount": 26 + }, + { + "ID": "ndlpt0hhvkqcdfkputsk4cq9c", + "Parents": [ + "ndlpt0hhvkqcdfkputsk4cq9c" + ], + "Type": "regular", + "Description": "mount / from exec /bin/sh -c echo 'Binary::apt::APT::Keep-Downloaded-Packages \"true\";' > /etc/apt/apt.conf.d/keep-cache", + "InUse": false, + "Shared": true, + "Size": 51, + "CreatedAt": "2021-06-28T13:31:03.002625487Z", + "LastUsedAt": "2021-07-07T22:02:32.773909517Z", + "UsageCount": 26 + } + ] + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/images/{name}/get": { + "get": { + "tags": [ + "Image" + ], + "summary": "Export an image", + "description": "Get a tarball containing all images and metadata for a repository.\n\nIf `name` is a specific name and tag (e.g. `ubuntu:latest`), then only that image (and its parents) are returned. If `name` is an image ID, similarly only that image (and its parents) are returned, but with the exclusion of the `repositories` file in the tarball, as there were no image names referenced.\n\n### Image tarball format\n\nAn image tarball contains one directory per image layer (named using its long ID), each containing these files:\n\n- `VERSION`: currently `1.0` - the file format version\n- `json`: detailed layer information, similar to `docker inspect layer_id`\n- `layer.tar`: A tarfile containing the filesystem changes in this layer\n\nThe `layer.tar` file contains `aufs` style `.wh..wh.aufs` files and directories for storing attribute changes and deletions.\n\nIf the tarball defines a repository, the tarball should also include a `repositories` file at the root that contains a list of repository and tag names mapped to layer IDs.\n\n```json\n{\n \"hello-world\": {\n \"latest\": \"565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1\"\n }\n}\n```\n", + "operationId": "ImageGet", + "parameters": [ + { + "name": "name", + "in": "path", + "description": "Image name or ID", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "no error", + "content": { + "application/x-tar": { + "schema": { + "type": "string", + "format": "binary" + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/x-tar": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/images/get": { + "get": { + "tags": [ + "Image" + ], + "summary": "Export several images", + "description": "Get a tarball containing all images and metadata for several image\nrepositories.\n\nFor each value of the `names` parameter: if it is a specific name and\ntag (e.g. `ubuntu:latest`), then only that image (and its parents) are\nreturned; if it is an image ID, similarly only that image (and its parents)\nare returned and there would be no names referenced in the 'repositories'\nfile for this image ID.\n\nFor details on the format, see the [export image endpoint](#operation/ImageGet).\n", + "operationId": "ImageGetAll", + "parameters": [ + { + "name": "names", + "in": "query", + "description": "Image names to filter by", + "style": "form", + "explode": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + ], + "responses": { + "200": { + "description": "no error", + "content": { + "application/x-tar": { + "schema": { + "type": "string", + "format": "binary" + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/x-tar": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/images/load": { + "post": { + "tags": [ + "Image" + ], + "summary": "Import images", + "description": "Load a set of images and tags into a repository.\n\nFor details on the format, see the [export image endpoint](#operation/ImageGet).\n", + "operationId": "ImageLoad", + "parameters": [ + { + "name": "quiet", + "in": "query", + "description": "Suppress progress details during load.", + "schema": { + "type": "boolean", + "default": false + } + } + ], + "requestBody": { + "description": "Tar archive containing images", + "content": { + "application/x-tar": { + "schema": { + "type": "string", + "format": "binary" + } + } + }, + "required": false + }, + "responses": { + "200": { + "description": "no error", + "content": {} + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + }, + "x-codegen-request-body-name": "imagesTarball" + } + }, + "/containers/{id}/exec": { + "post": { + "tags": [ + "Exec" + ], + "summary": "Create an exec instance", + "description": "Run a command inside a running container.", + "operationId": "ContainerExec", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID or name of container", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "Exec configuration", + "content": { + "application/json": { + "schema": { + "title": "ExecConfig", + "type": "object", + "properties": { + "AttachStdin": { + "type": "boolean", + "description": "Attach to `stdin` of the exec command." + }, + "AttachStdout": { + "type": "boolean", + "description": "Attach to `stdout` of the exec command." + }, + "AttachStderr": { + "type": "boolean", + "description": "Attach to `stderr` of the exec command." + }, + "ConsoleSize": { + "maxItems": 2, + "minItems": 2, + "type": "array", + "description": "Initial console size, as an `[height, width]` array.", + "nullable": true, + "items": { + "minimum": 0, + "type": "integer" + } + }, + "DetachKeys": { + "type": "string", + "description": "Override the key sequence for detaching a container. Format is\na single character `[a-Z]` or `ctrl-` where ``\nis one of: `a-z`, `@`, `^`, `[`, `,` or `_`.\n" + }, + "Tty": { + "type": "boolean", + "description": "Allocate a pseudo-TTY." + }, + "Env": { + "type": "array", + "description": "A list of environment variables in the form `[\"VAR=value\", ...]`.\n", + "items": { + "type": "string" + } + }, + "Cmd": { + "type": "array", + "description": "Command to run, as a string or array of strings.", + "items": { + "type": "string" + } + }, + "Privileged": { + "type": "boolean", + "description": "Runs the exec process with extended privileges.", + "default": false + }, + "User": { + "type": "string", + "description": "The user, and optionally, group to run the exec process inside\nthe container. Format is one of: `user`, `user:group`, `uid`,\nor `uid:gid`.\n" + }, + "WorkingDir": { + "type": "string", + "description": "The working directory for the exec process inside the container.\n" + } + }, + "example": { + "AttachStdin": false, + "AttachStdout": true, + "AttachStderr": true, + "DetachKeys": "ctrl-p,ctrl-q", + "Tty": false, + "Cmd": [ + "date" + ], + "Env": [ + "FOO=bar", + "BAZ=quux" + ] + } + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "no error", + "content": { + "application/json": { + "schema": { + "required": [ + "Id" + ], + "type": "object", + "properties": { + "Id": { + "type": "string", + "description": "The id of the newly created object.", + "nullable": false + } + }, + "description": "Response to an API call that returns just an Id" + } + } + } + }, + "404": { + "description": "no such container", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + }, + "example": { + "message": "No such container: c2ada9df5af8" + } + } + } + }, + "409": { + "description": "container is paused", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "Server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + }, + "x-codegen-request-body-name": "execConfig" + } + }, + "/exec/{id}/start": { + "post": { + "tags": [ + "Exec" + ], + "summary": "Start an exec instance", + "description": "Starts a previously set up exec instance. If detach is true, this endpoint\nreturns immediately after starting the command. Otherwise, it sets up an\ninteractive session with the command.\n", + "operationId": "ExecStart", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Exec instance ID", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "title": "ExecStartConfig", + "type": "object", + "properties": { + "Detach": { + "type": "boolean", + "description": "Detach from the command." + }, + "Tty": { + "type": "boolean", + "description": "Allocate a pseudo-TTY." + }, + "ConsoleSize": { + "maxItems": 2, + "minItems": 2, + "type": "array", + "description": "Initial console size, as an `[height, width]` array.", + "nullable": true, + "items": { + "minimum": 0, + "type": "integer" + } + } + }, + "example": { + "Detach": false, + "Tty": true, + "ConsoleSize": [ + 80, + 64 + ] + } + } + } + }, + "required": false + }, + "responses": { + "200": { + "description": "No error", + "content": {} + }, + "404": { + "description": "No such exec instance", + "content": { + "application/vnd.docker.raw-stream": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "application/vnd.docker.multiplexed-stream": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "409": { + "description": "Container is stopped or paused", + "content": { + "application/vnd.docker.raw-stream": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "application/vnd.docker.multiplexed-stream": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + }, + "x-codegen-request-body-name": "execStartConfig" + } + }, + "/exec/{id}/resize": { + "post": { + "tags": [ + "Exec" + ], + "summary": "Resize an exec instance", + "description": "Resize the TTY session used by an exec instance. This endpoint only works\nif `tty` was specified as part of creating and starting the exec instance.\n", + "operationId": "ExecResize", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Exec instance ID", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "h", + "in": "query", + "description": "Height of the TTY session in characters", + "required": true, + "schema": { + "type": "integer" + } + }, + { + "name": "w", + "in": "query", + "description": "Width of the TTY session in characters", + "required": true, + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "No error", + "content": {} + }, + "400": { + "description": "bad parameter", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "404": { + "description": "No such exec instance", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "Server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/exec/{id}/json": { + "get": { + "tags": [ + "Exec" + ], + "summary": "Inspect an exec instance", + "description": "Return low-level information about an exec instance.", + "operationId": "ExecInspect", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Exec instance ID", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "No error", + "content": { + "application/json": { + "schema": { + "title": "ExecInspectResponse", + "type": "object", + "properties": { + "CanRemove": { + "type": "boolean" + }, + "DetachKeys": { + "type": "string" + }, + "ID": { + "type": "string" + }, + "Running": { + "type": "boolean" + }, + "ExitCode": { + "type": "integer" + }, + "ProcessConfig": { + "type": "object", + "properties": { + "privileged": { + "type": "boolean" + }, + "user": { + "type": "string" + }, + "tty": { + "type": "boolean" + }, + "entrypoint": { + "type": "string" + }, + "arguments": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "OpenStdin": { + "type": "boolean" + }, + "OpenStderr": { + "type": "boolean" + }, + "OpenStdout": { + "type": "boolean" + }, + "ContainerID": { + "type": "string" + }, + "Pid": { + "type": "integer", + "description": "The system process ID for the exec process." + } + } + }, + "example": { + "CanRemove": false, + "ContainerID": "b53ee82b53a40c7dca428523e34f741f3abc51d9f297a14ff874bf761b995126", + "DetachKeys": "", + "ExitCode": 2, + "ID": "f33bbfb39f5b142420f4759b2348913bd4a8d1a6d7fd56499cb41a1bb91d7b3b", + "OpenStderr": true, + "OpenStdin": true, + "OpenStdout": true, + "ProcessConfig": { + "arguments": [ + "-c", + "exit 2" + ], + "entrypoint": "sh", + "privileged": false, + "tty": true, + "user": "1000" + }, + "Running": false, + "Pid": 42000 + } + } + } + }, + "404": { + "description": "No such exec instance", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "Server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/volumes": { + "get": { + "tags": [ + "Volume" + ], + "summary": "List volumes", + "operationId": "VolumeList", + "parameters": [ + { + "name": "filters", + "in": "query", + "description": "JSON encoded value of the filters (a `map[string][]string`) to\nprocess on the volumes list. Available filters:\n\n- `dangling=` When set to `true` (or `1`), returns all\n volumes that are not in use by a container. When set to `false`\n (or `0`), only volumes that are in use by one or more\n containers are returned.\n- `driver=` Matches volumes based on their driver.\n- `label=` or `label=:` Matches volumes based on\n the presence of a `label` alone or a `label` and a value.\n- `name=` Matches all or part of a volume name.\n", + "schema": { + "type": "string", + "format": "json" + } + } + ], + "responses": { + "200": { + "description": "Summary volume data that matches the query", + "content": { + "application/json": { + "schema": { + "title": "VolumeListResponse", + "type": "object", + "properties": { + "Volumes": { + "type": "array", + "description": "List of volumes", + "items": { + "required": [ + "Driver", + "Labels", + "Mountpoint", + "Name", + "Options", + "Scope" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the volume.", + "nullable": false, + "example": "tardis" + }, + "Driver": { + "type": "string", + "description": "Name of the volume driver used by the volume.", + "nullable": false, + "example": "custom" + }, + "Mountpoint": { + "type": "string", + "description": "Mount path of the volume on the host.", + "nullable": false, + "example": "/var/lib/docker/volumes/tardis" + }, + "CreatedAt": { + "type": "string", + "description": "Date/Time the volume was created.", + "format": "dateTime", + "example": "2016-06-07T20:31:11.853781916Z" + }, + "Status": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": {} + }, + "description": "Low-level details about the volume, provided by the volume driver.\nDetails are returned as a map with key/value pairs:\n`{\"key\":\"value\",\"key2\":\"value2\"}`.\n\nThe `Status` field is optional, and is omitted if the volume driver\ndoes not support this feature.\n", + "example": { + "hello": "world" + } + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "nullable": false, + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "Scope": { + "type": "string", + "description": "The level at which the volume exists. Either `global` for cluster-wide,\nor `local` for machine level.\n", + "nullable": false, + "example": "local", + "default": "local", + "enum": [ + "local", + "global" + ] + }, + "ClusterVolume": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "The Swarm ID of this volume. Because cluster volumes are Swarm\nobjects, they have an ID, unlike non-cluster volumes. This ID can\nbe used to refer to the Volume instead of the name.\n" + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "format": "dateTime" + }, + "UpdatedAt": { + "type": "string", + "format": "dateTime" + }, + "Spec": { + "type": "object", + "properties": { + "Group": { + "type": "string", + "description": "Group defines the volume group of this volume. Volumes belonging to\nthe same group can be referred to by group name when creating\nServices. Referring to a volume by group instructs Swarm to treat\nvolumes in that group interchangeably for the purpose of scheduling.\nVolumes with an empty string for a group technically all belong to\nthe same, emptystring group.\n" + }, + "AccessMode": { + "type": "object", + "properties": { + "Scope": { + "type": "string", + "description": "The set of nodes this volume can be used on at one time.\n- `single` The volume may only be scheduled to one node at a time.\n- `multi` the volume may be scheduled to any supported number of nodes at a time.\n", + "nullable": false, + "default": "single", + "enum": [ + "single", + "multi" + ] + }, + "Sharing": { + "type": "string", + "description": "The number and way that different tasks can use this volume\nat one time.\n- `none` The volume may only be used by one task at a time.\n- `readonly` The volume may be used by any number of tasks, but they all must mount the volume as readonly\n- `onewriter` The volume may be used by any number of tasks, but only one may mount it as read/write.\n- `all` The volume may have any number of readers and writers.\n", + "nullable": false, + "default": "none", + "enum": [ + "none", + "readonly", + "onewriter", + "all" + ] + }, + "MountVolume": { + "type": "object", + "properties": {}, + "description": "Options for using this volume as a Mount-type volume.\n\n Either MountVolume or BlockVolume, but not both, must be\n present.\n properties:\n FsType:\n type: \"string\"\n description: |\n Specifies the filesystem type for the mount volume.\n Optional.\n MountFlags:\n type: \"array\"\n description: |\n Flags to pass when mounting the volume. Optional.\n items:\n type: \"string\"\nBlockVolume:\n type: \"object\"\n description: |\n Options for using this volume as a Block-type volume.\n Intentionally empty.\n" + }, + "Secrets": { + "type": "array", + "description": "Swarm Secrets that are passed to the CSI storage plugin when\noperating on this volume.\n", + "items": { + "type": "object", + "properties": { + "Key": { + "type": "string", + "description": "Key is the name of the key of the key-value pair passed to\nthe plugin.\n" + }, + "Secret": { + "type": "string", + "description": "Secret is the swarm Secret object from which to read data.\nThis can be a Secret name or ID. The Secret data is\nretrieved by swarm and used as the value of the key-value\npair passed to the plugin.\n" + } + }, + "description": "One cluster volume secret entry. Defines a key-value pair that\nis passed to the plugin.\n" + } + }, + "AccessibilityRequirements": { + "type": "object", + "properties": { + "Requisite": { + "type": "array", + "description": "A list of required topologies, at least one of which the\nvolume must be accessible from.\n", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + }, + "Preferred": { + "type": "array", + "description": "A list of topologies that the volume should attempt to be\nprovisioned in.\n", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + } + }, + "description": "Requirements for the accessible topology of the volume. These\nfields are optional. For an in-depth description of what these\nfields mean, see the CSI specification.\n" + }, + "CapacityRange": { + "type": "object", + "properties": { + "RequiredBytes": { + "type": "integer", + "description": "The volume must be at least this big. The value of 0\nindicates an unspecified minimum\n", + "format": "int64" + }, + "LimitBytes": { + "type": "integer", + "description": "The volume must not be bigger than this. The value of 0\nindicates an unspecified maximum.\n", + "format": "int64" + } + }, + "description": "The desired capacity that the volume should be created with. If\nempty, the plugin will decide the capacity.\n" + }, + "Availability": { + "type": "string", + "description": "The availability of the volume for use in tasks.\n- `active` The volume is fully available for scheduling on the cluster\n- `pause` No new workloads should use the volume, but existing workloads are not stopped.\n- `drain` All workloads using this volume should be stopped and rescheduled, and no new ones should be started.\n", + "nullable": false, + "default": "active", + "enum": [ + "active", + "pause", + "drain" + ] + } + }, + "description": "Defines how the volume is used by tasks.\n" + } + }, + "description": "Cluster-specific options used to create the volume.\n" + }, + "Info": { + "type": "object", + "properties": { + "CapacityBytes": { + "type": "integer", + "description": "The capacity of the volume in bytes. A value of 0 indicates that\nthe capacity is unknown.\n", + "format": "int64" + }, + "VolumeContext": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of strings to strings returned from the storage plugin when\nthe volume is created.\n" + }, + "VolumeID": { + "type": "string", + "description": "The ID of the volume as returned by the CSI storage plugin. This\nis distinct from the volume's ID as provided by Docker. This ID\nis never used by the user when communicating with Docker to refer\nto this volume. If the ID is blank, then the Volume has not been\nsuccessfully created in the plugin yet.\n" + }, + "AccessibleTopology": { + "type": "array", + "description": "The topology this volume is actually accessible from.\n", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + } + }, + "description": "Information about the global status of the volume.\n" + }, + "PublishStatus": { + "type": "array", + "description": "The status of the volume as it pertains to its publishing and use on\nspecific nodes\n", + "items": { + "type": "object", + "properties": { + "NodeID": { + "type": "string", + "description": "The ID of the Swarm node the volume is published on.\n" + }, + "State": { + "type": "string", + "description": "The published state of the volume.\n* `pending-publish` The volume should be published to this node, but the call to the controller plugin to do so has not yet been successfully completed.\n* `published` The volume is published successfully to the node.\n* `pending-node-unpublish` The volume should be unpublished from the node, and the manager is awaiting confirmation from the worker that it has done so.\n* `pending-controller-unpublish` The volume is successfully unpublished from the node, but has not yet been successfully unpublished on the controller.\n", + "enum": [ + "pending-publish", + "published", + "pending-node-unpublish", + "pending-controller-unpublish" + ] + }, + "PublishContext": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of strings to strings returned by the CSI controller\nplugin when a volume is published.\n" + } + } + } + } + }, + "description": "Options and information specific to, and only present on, Swarm CSI\ncluster volumes.\n" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "The driver specific options used when creating the volume.\n", + "example": { + "device": "tmpfs", + "o": "size=100m,uid=1000", + "type": "tmpfs" + } + }, + "UsageData": { + "required": [ + "RefCount", + "Size" + ], + "type": "object", + "properties": { + "Size": { + "type": "integer", + "description": "Amount of disk space used by the volume (in bytes). This information\nis only available for volumes created with the `\"local\"` volume\ndriver. For volumes created with other volume drivers, this field\nis set to `-1` (\"not available\")\n", + "format": "int64", + "nullable": false, + "default": -1 + }, + "RefCount": { + "type": "integer", + "description": "The number of containers referencing this volume. This field\nis set to `-1` if the reference-count is not available.\n", + "format": "int64", + "nullable": false, + "default": -1 + } + }, + "description": "Usage details about the volume. This information is used by the\n`GET /system/df` endpoint, and omitted in other endpoints.\n", + "nullable": true, + "x-go-name": "UsageData" + } + } + } + }, + "Warnings": { + "type": "array", + "description": "Warnings that occurred when fetching the list of volumes.\n", + "example": [], + "items": { + "type": "string" + } + } + }, + "description": "Volume list response", + "x-go-name": "ListResponse" + } + } + } + }, + "500": { + "description": "Server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/volumes/create": { + "post": { + "tags": [ + "Volume" + ], + "summary": "Create a volume", + "operationId": "VolumeCreate", + "requestBody": { + "description": "Volume configuration", + "content": { + "application/json": { + "schema": { + "title": "VolumeConfig", + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "The new volume's name. If not specified, Docker generates a name.\n", + "nullable": false, + "example": "tardis" + }, + "Driver": { + "type": "string", + "description": "Name of the volume driver to use.", + "nullable": false, + "example": "custom", + "default": "local" + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A mapping of driver options and values. These options are\npassed directly to the driver and are driver specific.\n", + "example": { + "device": "tmpfs", + "o": "size=100m,uid=1000", + "type": "tmpfs" + } + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "ClusterVolumeSpec": { + "type": "object", + "properties": { + "Group": { + "type": "string", + "description": "Group defines the volume group of this volume. Volumes belonging to\nthe same group can be referred to by group name when creating\nServices. Referring to a volume by group instructs Swarm to treat\nvolumes in that group interchangeably for the purpose of scheduling.\nVolumes with an empty string for a group technically all belong to\nthe same, emptystring group.\n" + }, + "AccessMode": { + "type": "object", + "properties": { + "Scope": { + "type": "string", + "description": "The set of nodes this volume can be used on at one time.\n- `single` The volume may only be scheduled to one node at a time.\n- `multi` the volume may be scheduled to any supported number of nodes at a time.\n", + "nullable": false, + "default": "single", + "enum": [ + "single", + "multi" + ] + }, + "Sharing": { + "type": "string", + "description": "The number and way that different tasks can use this volume\nat one time.\n- `none` The volume may only be used by one task at a time.\n- `readonly` The volume may be used by any number of tasks, but they all must mount the volume as readonly\n- `onewriter` The volume may be used by any number of tasks, but only one may mount it as read/write.\n- `all` The volume may have any number of readers and writers.\n", + "nullable": false, + "default": "none", + "enum": [ + "none", + "readonly", + "onewriter", + "all" + ] + }, + "MountVolume": { + "type": "object", + "properties": {}, + "description": "Options for using this volume as a Mount-type volume.\n\n Either MountVolume or BlockVolume, but not both, must be\n present.\n properties:\n FsType:\n type: \"string\"\n description: |\n Specifies the filesystem type for the mount volume.\n Optional.\n MountFlags:\n type: \"array\"\n description: |\n Flags to pass when mounting the volume. Optional.\n items:\n type: \"string\"\nBlockVolume:\n type: \"object\"\n description: |\n Options for using this volume as a Block-type volume.\n Intentionally empty.\n" + }, + "Secrets": { + "type": "array", + "description": "Swarm Secrets that are passed to the CSI storage plugin when\noperating on this volume.\n", + "items": { + "type": "object", + "properties": { + "Key": { + "type": "string", + "description": "Key is the name of the key of the key-value pair passed to\nthe plugin.\n" + }, + "Secret": { + "type": "string", + "description": "Secret is the swarm Secret object from which to read data.\nThis can be a Secret name or ID. The Secret data is\nretrieved by swarm and used as the value of the key-value\npair passed to the plugin.\n" + } + }, + "description": "One cluster volume secret entry. Defines a key-value pair that\nis passed to the plugin.\n" + } + }, + "AccessibilityRequirements": { + "type": "object", + "properties": { + "Requisite": { + "type": "array", + "description": "A list of required topologies, at least one of which the\nvolume must be accessible from.\n", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + }, + "Preferred": { + "type": "array", + "description": "A list of topologies that the volume should attempt to be\nprovisioned in.\n", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + } + }, + "description": "Requirements for the accessible topology of the volume. These\nfields are optional. For an in-depth description of what these\nfields mean, see the CSI specification.\n" + }, + "CapacityRange": { + "type": "object", + "properties": { + "RequiredBytes": { + "type": "integer", + "description": "The volume must be at least this big. The value of 0\nindicates an unspecified minimum\n", + "format": "int64" + }, + "LimitBytes": { + "type": "integer", + "description": "The volume must not be bigger than this. The value of 0\nindicates an unspecified maximum.\n", + "format": "int64" + } + }, + "description": "The desired capacity that the volume should be created with. If\nempty, the plugin will decide the capacity.\n" + }, + "Availability": { + "type": "string", + "description": "The availability of the volume for use in tasks.\n- `active` The volume is fully available for scheduling on the cluster\n- `pause` No new workloads should use the volume, but existing workloads are not stopped.\n- `drain` All workloads using this volume should be stopped and rescheduled, and no new ones should be started.\n", + "nullable": false, + "default": "active", + "enum": [ + "active", + "pause", + "drain" + ] + } + }, + "description": "Defines how the volume is used by tasks.\n" + } + }, + "description": "Cluster-specific options used to create the volume.\n" + } + }, + "description": "Volume configuration", + "x-go-name": "CreateOptions" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The volume was created successfully", + "content": { + "application/json": { + "schema": { + "required": [ + "Driver", + "Labels", + "Mountpoint", + "Name", + "Options", + "Scope" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the volume.", + "nullable": false, + "example": "tardis" + }, + "Driver": { + "type": "string", + "description": "Name of the volume driver used by the volume.", + "nullable": false, + "example": "custom" + }, + "Mountpoint": { + "type": "string", + "description": "Mount path of the volume on the host.", + "nullable": false, + "example": "/var/lib/docker/volumes/tardis" + }, + "CreatedAt": { + "type": "string", + "description": "Date/Time the volume was created.", + "format": "dateTime", + "example": "2016-06-07T20:31:11.853781916Z" + }, + "Status": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": {} + }, + "description": "Low-level details about the volume, provided by the volume driver.\nDetails are returned as a map with key/value pairs:\n`{\"key\":\"value\",\"key2\":\"value2\"}`.\n\nThe `Status` field is optional, and is omitted if the volume driver\ndoes not support this feature.\n", + "example": { + "hello": "world" + } + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "nullable": false, + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "Scope": { + "type": "string", + "description": "The level at which the volume exists. Either `global` for cluster-wide,\nor `local` for machine level.\n", + "nullable": false, + "example": "local", + "default": "local", + "enum": [ + "local", + "global" + ] + }, + "ClusterVolume": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "The Swarm ID of this volume. Because cluster volumes are Swarm\nobjects, they have an ID, unlike non-cluster volumes. This ID can\nbe used to refer to the Volume instead of the name.\n" + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "format": "dateTime" + }, + "UpdatedAt": { + "type": "string", + "format": "dateTime" + }, + "Spec": { + "type": "object", + "properties": { + "Group": { + "type": "string", + "description": "Group defines the volume group of this volume. Volumes belonging to\nthe same group can be referred to by group name when creating\nServices. Referring to a volume by group instructs Swarm to treat\nvolumes in that group interchangeably for the purpose of scheduling.\nVolumes with an empty string for a group technically all belong to\nthe same, emptystring group.\n" + }, + "AccessMode": { + "type": "object", + "properties": { + "Scope": { + "type": "string", + "description": "The set of nodes this volume can be used on at one time.\n- `single` The volume may only be scheduled to one node at a time.\n- `multi` the volume may be scheduled to any supported number of nodes at a time.\n", + "nullable": false, + "default": "single", + "enum": [ + "single", + "multi" + ] + }, + "Sharing": { + "type": "string", + "description": "The number and way that different tasks can use this volume\nat one time.\n- `none` The volume may only be used by one task at a time.\n- `readonly` The volume may be used by any number of tasks, but they all must mount the volume as readonly\n- `onewriter` The volume may be used by any number of tasks, but only one may mount it as read/write.\n- `all` The volume may have any number of readers and writers.\n", + "nullable": false, + "default": "none", + "enum": [ + "none", + "readonly", + "onewriter", + "all" + ] + }, + "MountVolume": { + "type": "object", + "properties": {}, + "description": "Options for using this volume as a Mount-type volume.\n\n Either MountVolume or BlockVolume, but not both, must be\n present.\n properties:\n FsType:\n type: \"string\"\n description: |\n Specifies the filesystem type for the mount volume.\n Optional.\n MountFlags:\n type: \"array\"\n description: |\n Flags to pass when mounting the volume. Optional.\n items:\n type: \"string\"\nBlockVolume:\n type: \"object\"\n description: |\n Options for using this volume as a Block-type volume.\n Intentionally empty.\n" + }, + "Secrets": { + "type": "array", + "description": "Swarm Secrets that are passed to the CSI storage plugin when\noperating on this volume.\n", + "items": { + "type": "object", + "properties": { + "Key": { + "type": "string", + "description": "Key is the name of the key of the key-value pair passed to\nthe plugin.\n" + }, + "Secret": { + "type": "string", + "description": "Secret is the swarm Secret object from which to read data.\nThis can be a Secret name or ID. The Secret data is\nretrieved by swarm and used as the value of the key-value\npair passed to the plugin.\n" + } + }, + "description": "One cluster volume secret entry. Defines a key-value pair that\nis passed to the plugin.\n" + } + }, + "AccessibilityRequirements": { + "type": "object", + "properties": { + "Requisite": { + "type": "array", + "description": "A list of required topologies, at least one of which the\nvolume must be accessible from.\n", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + }, + "Preferred": { + "type": "array", + "description": "A list of topologies that the volume should attempt to be\nprovisioned in.\n", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + } + }, + "description": "Requirements for the accessible topology of the volume. These\nfields are optional. For an in-depth description of what these\nfields mean, see the CSI specification.\n" + }, + "CapacityRange": { + "type": "object", + "properties": { + "RequiredBytes": { + "type": "integer", + "description": "The volume must be at least this big. The value of 0\nindicates an unspecified minimum\n", + "format": "int64" + }, + "LimitBytes": { + "type": "integer", + "description": "The volume must not be bigger than this. The value of 0\nindicates an unspecified maximum.\n", + "format": "int64" + } + }, + "description": "The desired capacity that the volume should be created with. If\nempty, the plugin will decide the capacity.\n" + }, + "Availability": { + "type": "string", + "description": "The availability of the volume for use in tasks.\n- `active` The volume is fully available for scheduling on the cluster\n- `pause` No new workloads should use the volume, but existing workloads are not stopped.\n- `drain` All workloads using this volume should be stopped and rescheduled, and no new ones should be started.\n", + "nullable": false, + "default": "active", + "enum": [ + "active", + "pause", + "drain" + ] + } + }, + "description": "Defines how the volume is used by tasks.\n" + } + }, + "description": "Cluster-specific options used to create the volume.\n" + }, + "Info": { + "type": "object", + "properties": { + "CapacityBytes": { + "type": "integer", + "description": "The capacity of the volume in bytes. A value of 0 indicates that\nthe capacity is unknown.\n", + "format": "int64" + }, + "VolumeContext": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of strings to strings returned from the storage plugin when\nthe volume is created.\n" + }, + "VolumeID": { + "type": "string", + "description": "The ID of the volume as returned by the CSI storage plugin. This\nis distinct from the volume's ID as provided by Docker. This ID\nis never used by the user when communicating with Docker to refer\nto this volume. If the ID is blank, then the Volume has not been\nsuccessfully created in the plugin yet.\n" + }, + "AccessibleTopology": { + "type": "array", + "description": "The topology this volume is actually accessible from.\n", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + } + }, + "description": "Information about the global status of the volume.\n" + }, + "PublishStatus": { + "type": "array", + "description": "The status of the volume as it pertains to its publishing and use on\nspecific nodes\n", + "items": { + "type": "object", + "properties": { + "NodeID": { + "type": "string", + "description": "The ID of the Swarm node the volume is published on.\n" + }, + "State": { + "type": "string", + "description": "The published state of the volume.\n* `pending-publish` The volume should be published to this node, but the call to the controller plugin to do so has not yet been successfully completed.\n* `published` The volume is published successfully to the node.\n* `pending-node-unpublish` The volume should be unpublished from the node, and the manager is awaiting confirmation from the worker that it has done so.\n* `pending-controller-unpublish` The volume is successfully unpublished from the node, but has not yet been successfully unpublished on the controller.\n", + "enum": [ + "pending-publish", + "published", + "pending-node-unpublish", + "pending-controller-unpublish" + ] + }, + "PublishContext": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of strings to strings returned by the CSI controller\nplugin when a volume is published.\n" + } + } + } + } + }, + "description": "Options and information specific to, and only present on, Swarm CSI\ncluster volumes.\n" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "The driver specific options used when creating the volume.\n", + "example": { + "device": "tmpfs", + "o": "size=100m,uid=1000", + "type": "tmpfs" + } + }, + "UsageData": { + "required": [ + "RefCount", + "Size" + ], + "type": "object", + "properties": { + "Size": { + "type": "integer", + "description": "Amount of disk space used by the volume (in bytes). This information\nis only available for volumes created with the `\"local\"` volume\ndriver. For volumes created with other volume drivers, this field\nis set to `-1` (\"not available\")\n", + "format": "int64", + "nullable": false, + "default": -1 + }, + "RefCount": { + "type": "integer", + "description": "The number of containers referencing this volume. This field\nis set to `-1` if the reference-count is not available.\n", + "format": "int64", + "nullable": false, + "default": -1 + } + }, + "description": "Usage details about the volume. This information is used by the\n`GET /system/df` endpoint, and omitted in other endpoints.\n", + "nullable": true, + "x-go-name": "UsageData" + } + } + } + } + } + }, + "500": { + "description": "Server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + }, + "x-codegen-request-body-name": "volumeConfig" + } + }, + "/volumes/{name}": { + "get": { + "tags": [ + "Volume" + ], + "summary": "Inspect a volume", + "operationId": "VolumeInspect", + "parameters": [ + { + "name": "name", + "in": "path", + "description": "Volume name or ID", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "No error", + "content": { + "application/json": { + "schema": { + "required": [ + "Driver", + "Labels", + "Mountpoint", + "Name", + "Options", + "Scope" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the volume.", + "nullable": false, + "example": "tardis" + }, + "Driver": { + "type": "string", + "description": "Name of the volume driver used by the volume.", + "nullable": false, + "example": "custom" + }, + "Mountpoint": { + "type": "string", + "description": "Mount path of the volume on the host.", + "nullable": false, + "example": "/var/lib/docker/volumes/tardis" + }, + "CreatedAt": { + "type": "string", + "description": "Date/Time the volume was created.", + "format": "dateTime", + "example": "2016-06-07T20:31:11.853781916Z" + }, + "Status": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": {} + }, + "description": "Low-level details about the volume, provided by the volume driver.\nDetails are returned as a map with key/value pairs:\n`{\"key\":\"value\",\"key2\":\"value2\"}`.\n\nThe `Status` field is optional, and is omitted if the volume driver\ndoes not support this feature.\n", + "example": { + "hello": "world" + } + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "nullable": false, + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "Scope": { + "type": "string", + "description": "The level at which the volume exists. Either `global` for cluster-wide,\nor `local` for machine level.\n", + "nullable": false, + "example": "local", + "default": "local", + "enum": [ + "local", + "global" + ] + }, + "ClusterVolume": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "The Swarm ID of this volume. Because cluster volumes are Swarm\nobjects, they have an ID, unlike non-cluster volumes. This ID can\nbe used to refer to the Volume instead of the name.\n" + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "format": "dateTime" + }, + "UpdatedAt": { + "type": "string", + "format": "dateTime" + }, + "Spec": { + "type": "object", + "properties": { + "Group": { + "type": "string", + "description": "Group defines the volume group of this volume. Volumes belonging to\nthe same group can be referred to by group name when creating\nServices. Referring to a volume by group instructs Swarm to treat\nvolumes in that group interchangeably for the purpose of scheduling.\nVolumes with an empty string for a group technically all belong to\nthe same, emptystring group.\n" + }, + "AccessMode": { + "type": "object", + "properties": { + "Scope": { + "type": "string", + "description": "The set of nodes this volume can be used on at one time.\n- `single` The volume may only be scheduled to one node at a time.\n- `multi` the volume may be scheduled to any supported number of nodes at a time.\n", + "nullable": false, + "default": "single", + "enum": [ + "single", + "multi" + ] + }, + "Sharing": { + "type": "string", + "description": "The number and way that different tasks can use this volume\nat one time.\n- `none` The volume may only be used by one task at a time.\n- `readonly` The volume may be used by any number of tasks, but they all must mount the volume as readonly\n- `onewriter` The volume may be used by any number of tasks, but only one may mount it as read/write.\n- `all` The volume may have any number of readers and writers.\n", + "nullable": false, + "default": "none", + "enum": [ + "none", + "readonly", + "onewriter", + "all" + ] + }, + "MountVolume": { + "type": "object", + "properties": {}, + "description": "Options for using this volume as a Mount-type volume.\n\n Either MountVolume or BlockVolume, but not both, must be\n present.\n properties:\n FsType:\n type: \"string\"\n description: |\n Specifies the filesystem type for the mount volume.\n Optional.\n MountFlags:\n type: \"array\"\n description: |\n Flags to pass when mounting the volume. Optional.\n items:\n type: \"string\"\nBlockVolume:\n type: \"object\"\n description: |\n Options for using this volume as a Block-type volume.\n Intentionally empty.\n" + }, + "Secrets": { + "type": "array", + "description": "Swarm Secrets that are passed to the CSI storage plugin when\noperating on this volume.\n", + "items": { + "type": "object", + "properties": { + "Key": { + "type": "string", + "description": "Key is the name of the key of the key-value pair passed to\nthe plugin.\n" + }, + "Secret": { + "type": "string", + "description": "Secret is the swarm Secret object from which to read data.\nThis can be a Secret name or ID. The Secret data is\nretrieved by swarm and used as the value of the key-value\npair passed to the plugin.\n" + } + }, + "description": "One cluster volume secret entry. Defines a key-value pair that\nis passed to the plugin.\n" + } + }, + "AccessibilityRequirements": { + "type": "object", + "properties": { + "Requisite": { + "type": "array", + "description": "A list of required topologies, at least one of which the\nvolume must be accessible from.\n", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + }, + "Preferred": { + "type": "array", + "description": "A list of topologies that the volume should attempt to be\nprovisioned in.\n", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + } + }, + "description": "Requirements for the accessible topology of the volume. These\nfields are optional. For an in-depth description of what these\nfields mean, see the CSI specification.\n" + }, + "CapacityRange": { + "type": "object", + "properties": { + "RequiredBytes": { + "type": "integer", + "description": "The volume must be at least this big. The value of 0\nindicates an unspecified minimum\n", + "format": "int64" + }, + "LimitBytes": { + "type": "integer", + "description": "The volume must not be bigger than this. The value of 0\nindicates an unspecified maximum.\n", + "format": "int64" + } + }, + "description": "The desired capacity that the volume should be created with. If\nempty, the plugin will decide the capacity.\n" + }, + "Availability": { + "type": "string", + "description": "The availability of the volume for use in tasks.\n- `active` The volume is fully available for scheduling on the cluster\n- `pause` No new workloads should use the volume, but existing workloads are not stopped.\n- `drain` All workloads using this volume should be stopped and rescheduled, and no new ones should be started.\n", + "nullable": false, + "default": "active", + "enum": [ + "active", + "pause", + "drain" + ] + } + }, + "description": "Defines how the volume is used by tasks.\n" + } + }, + "description": "Cluster-specific options used to create the volume.\n" + }, + "Info": { + "type": "object", + "properties": { + "CapacityBytes": { + "type": "integer", + "description": "The capacity of the volume in bytes. A value of 0 indicates that\nthe capacity is unknown.\n", + "format": "int64" + }, + "VolumeContext": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of strings to strings returned from the storage plugin when\nthe volume is created.\n" + }, + "VolumeID": { + "type": "string", + "description": "The ID of the volume as returned by the CSI storage plugin. This\nis distinct from the volume's ID as provided by Docker. This ID\nis never used by the user when communicating with Docker to refer\nto this volume. If the ID is blank, then the Volume has not been\nsuccessfully created in the plugin yet.\n" + }, + "AccessibleTopology": { + "type": "array", + "description": "The topology this volume is actually accessible from.\n", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + } + }, + "description": "Information about the global status of the volume.\n" + }, + "PublishStatus": { + "type": "array", + "description": "The status of the volume as it pertains to its publishing and use on\nspecific nodes\n", + "items": { + "type": "object", + "properties": { + "NodeID": { + "type": "string", + "description": "The ID of the Swarm node the volume is published on.\n" + }, + "State": { + "type": "string", + "description": "The published state of the volume.\n* `pending-publish` The volume should be published to this node, but the call to the controller plugin to do so has not yet been successfully completed.\n* `published` The volume is published successfully to the node.\n* `pending-node-unpublish` The volume should be unpublished from the node, and the manager is awaiting confirmation from the worker that it has done so.\n* `pending-controller-unpublish` The volume is successfully unpublished from the node, but has not yet been successfully unpublished on the controller.\n", + "enum": [ + "pending-publish", + "published", + "pending-node-unpublish", + "pending-controller-unpublish" + ] + }, + "PublishContext": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of strings to strings returned by the CSI controller\nplugin when a volume is published.\n" + } + } + } + } + }, + "description": "Options and information specific to, and only present on, Swarm CSI\ncluster volumes.\n" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "The driver specific options used when creating the volume.\n", + "example": { + "device": "tmpfs", + "o": "size=100m,uid=1000", + "type": "tmpfs" + } + }, + "UsageData": { + "required": [ + "RefCount", + "Size" + ], + "type": "object", + "properties": { + "Size": { + "type": "integer", + "description": "Amount of disk space used by the volume (in bytes). This information\nis only available for volumes created with the `\"local\"` volume\ndriver. For volumes created with other volume drivers, this field\nis set to `-1` (\"not available\")\n", + "format": "int64", + "nullable": false, + "default": -1 + }, + "RefCount": { + "type": "integer", + "description": "The number of containers referencing this volume. This field\nis set to `-1` if the reference-count is not available.\n", + "format": "int64", + "nullable": false, + "default": -1 + } + }, + "description": "Usage details about the volume. This information is used by the\n`GET /system/df` endpoint, and omitted in other endpoints.\n", + "nullable": true, + "x-go-name": "UsageData" + } + } + } + } + } + }, + "404": { + "description": "No such volume", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "Server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + }, + "put": { + "tags": [ + "Volume" + ], + "summary": "\"Update a volume. Valid only for Swarm cluster volumes\"\n", + "operationId": "VolumeUpdate", + "parameters": [ + { + "name": "name", + "in": "path", + "description": "The name or ID of the volume", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "version", + "in": "query", + "description": "The version number of the volume being updated. This is required to\navoid conflicting writes. Found in the volume's `ClusterVolume`\nfield.\n", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The spec of the volume to update. Currently, only Availability may\nchange. All other fields must remain unchanged.\n", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "Spec": { + "type": "object", + "properties": { + "Group": { + "type": "string", + "description": "Group defines the volume group of this volume. Volumes belonging to\nthe same group can be referred to by group name when creating\nServices. Referring to a volume by group instructs Swarm to treat\nvolumes in that group interchangeably for the purpose of scheduling.\nVolumes with an empty string for a group technically all belong to\nthe same, emptystring group.\n" + }, + "AccessMode": { + "type": "object", + "properties": { + "Scope": { + "type": "string", + "description": "The set of nodes this volume can be used on at one time.\n- `single` The volume may only be scheduled to one node at a time.\n- `multi` the volume may be scheduled to any supported number of nodes at a time.\n", + "nullable": false, + "default": "single", + "enum": [ + "single", + "multi" + ] + }, + "Sharing": { + "type": "string", + "description": "The number and way that different tasks can use this volume\nat one time.\n- `none` The volume may only be used by one task at a time.\n- `readonly` The volume may be used by any number of tasks, but they all must mount the volume as readonly\n- `onewriter` The volume may be used by any number of tasks, but only one may mount it as read/write.\n- `all` The volume may have any number of readers and writers.\n", + "nullable": false, + "default": "none", + "enum": [ + "none", + "readonly", + "onewriter", + "all" + ] + }, + "MountVolume": { + "type": "object", + "properties": {}, + "description": "Options for using this volume as a Mount-type volume.\n\n Either MountVolume or BlockVolume, but not both, must be\n present.\n properties:\n FsType:\n type: \"string\"\n description: |\n Specifies the filesystem type for the mount volume.\n Optional.\n MountFlags:\n type: \"array\"\n description: |\n Flags to pass when mounting the volume. Optional.\n items:\n type: \"string\"\nBlockVolume:\n type: \"object\"\n description: |\n Options for using this volume as a Block-type volume.\n Intentionally empty.\n" + }, + "Secrets": { + "type": "array", + "description": "Swarm Secrets that are passed to the CSI storage plugin when\noperating on this volume.\n", + "items": { + "type": "object", + "properties": { + "Key": { + "type": "string", + "description": "Key is the name of the key of the key-value pair passed to\nthe plugin.\n" + }, + "Secret": { + "type": "string", + "description": "Secret is the swarm Secret object from which to read data.\nThis can be a Secret name or ID. The Secret data is\nretrieved by swarm and used as the value of the key-value\npair passed to the plugin.\n" + } + }, + "description": "One cluster volume secret entry. Defines a key-value pair that\nis passed to the plugin.\n" + } + }, + "AccessibilityRequirements": { + "type": "object", + "properties": { + "Requisite": { + "type": "array", + "description": "A list of required topologies, at least one of which the\nvolume must be accessible from.\n", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + }, + "Preferred": { + "type": "array", + "description": "A list of topologies that the volume should attempt to be\nprovisioned in.\n", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + } + }, + "description": "Requirements for the accessible topology of the volume. These\nfields are optional. For an in-depth description of what these\nfields mean, see the CSI specification.\n" + }, + "CapacityRange": { + "type": "object", + "properties": { + "RequiredBytes": { + "type": "integer", + "description": "The volume must be at least this big. The value of 0\nindicates an unspecified minimum\n", + "format": "int64" + }, + "LimitBytes": { + "type": "integer", + "description": "The volume must not be bigger than this. The value of 0\nindicates an unspecified maximum.\n", + "format": "int64" + } + }, + "description": "The desired capacity that the volume should be created with. If\nempty, the plugin will decide the capacity.\n" + }, + "Availability": { + "type": "string", + "description": "The availability of the volume for use in tasks.\n- `active` The volume is fully available for scheduling on the cluster\n- `pause` No new workloads should use the volume, but existing workloads are not stopped.\n- `drain` All workloads using this volume should be stopped and rescheduled, and no new ones should be started.\n", + "nullable": false, + "default": "active", + "enum": [ + "active", + "pause", + "drain" + ] + } + }, + "description": "Defines how the volume is used by tasks.\n" + } + }, + "description": "Cluster-specific options used to create the volume.\n" + } + }, + "description": "Volume configuration" + } + } + }, + "required": false + }, + "responses": { + "200": { + "description": "no error", + "content": {} + }, + "400": { + "description": "bad parameter", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "404": { + "description": "no such volume", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "503": { + "description": "node is not part of a swarm", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + }, + "x-codegen-request-body-name": "body" + }, + "delete": { + "tags": [ + "Volume" + ], + "summary": "Remove a volume", + "description": "Instruct the driver to remove the volume.", + "operationId": "VolumeDelete", + "parameters": [ + { + "name": "name", + "in": "path", + "description": "Volume name or ID", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "force", + "in": "query", + "description": "Force the removal of the volume", + "schema": { + "type": "boolean", + "default": false + } + } + ], + "responses": { + "204": { + "description": "The volume was removed", + "content": {} + }, + "404": { + "description": "No such volume or volume driver", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "409": { + "description": "Volume is in use and cannot be removed", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "Server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/volumes/prune": { + "post": { + "tags": [ + "Volume" + ], + "summary": "Delete unused volumes", + "operationId": "VolumePrune", + "parameters": [ + { + "name": "filters", + "in": "query", + "description": "Filters to process on the prune list, encoded as JSON (a `map[string][]string`).\n\nAvailable filters:\n- `label` (`label=`, `label==`, `label!=`, or `label!==`) Prune volumes with (or without, in case `label!=...` is used) the specified labels.\n- `all` (`all=true`) - Consider all (local) volumes for pruning and not just anonymous volumes.\n", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "No error", + "content": { + "application/json": { + "schema": { + "title": "VolumePruneResponse", + "type": "object", + "properties": { + "VolumesDeleted": { + "type": "array", + "description": "Volumes that were deleted", + "items": { + "type": "string" + } + }, + "SpaceReclaimed": { + "type": "integer", + "description": "Disk space reclaimed in bytes", + "format": "int64" + } + } + } + } + } + }, + "500": { + "description": "Server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/networks": { + "get": { + "tags": [ + "Network" + ], + "summary": "List networks", + "description": "Returns a list of networks. For details on the format, see the\n[network inspect endpoint](#operation/NetworkInspect).\n\nNote that it uses a different, smaller representation of a network than\ninspecting a single network. For example, the list of containers attached\nto the network is not propagated in API versions 1.28 and up.\n", + "operationId": "NetworkList", + "parameters": [ + { + "name": "filters", + "in": "query", + "description": "JSON encoded value of the filters (a `map[string][]string`) to process\non the networks list.\n\nAvailable filters:\n\n- `dangling=` When set to `true` (or `1`), returns all\n networks that are not in use by a container. When set to `false`\n (or `0`), only networks that are in use by one or more\n containers are returned.\n- `driver=` Matches a network's driver.\n- `id=` Matches all or part of a network ID.\n- `label=` or `label==` of a network label.\n- `name=` Matches all or part of a network name.\n- `scope=[\"swarm\"|\"global\"|\"local\"]` Filters networks by scope (`swarm`, `global`, or `local`).\n- `type=[\"custom\"|\"builtin\"]` Filters networks by type. The `custom` keyword returns all user-defined networks.\n", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "No error", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the network.\n", + "example": "my_network" + }, + "Id": { + "type": "string", + "description": "ID that uniquely identifies a network on a single machine.\n", + "example": "7d86d31b1478e7cca9ebed7e73aa0fdeec46c5ca29497431d3007d2d9e15ed99" + }, + "Created": { + "type": "string", + "description": "Date and time at which the network was created in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2016-10-19T04:33:30.360899459Z" + }, + "Scope": { + "type": "string", + "description": "The level at which the network exists (e.g. `swarm` for cluster-wide\nor `local` for machine level)\n", + "example": "local" + }, + "Driver": { + "type": "string", + "description": "The name of the driver used to create the network (e.g. `bridge`,\n`overlay`).\n", + "example": "overlay" + }, + "EnableIPv6": { + "type": "boolean", + "description": "Whether the network was created with IPv6 enabled.\n", + "example": false + }, + "IPAM": { + "type": "object", + "properties": { + "Driver": { + "type": "string", + "description": "Name of the IPAM driver to use.", + "example": "default", + "default": "default" + }, + "Config": { + "type": "array", + "description": "List of IPAM configuration options, specified as a map:\n\n```\n{\"Subnet\": , \"IPRange\": , \"Gateway\": , \"AuxAddress\": }\n```\n", + "items": { + "type": "object", + "properties": { + "Subnet": { + "type": "string", + "example": "172.20.0.0/16" + }, + "IPRange": { + "type": "string", + "example": "172.20.10.0/24" + }, + "Gateway": { + "type": "string", + "example": "172.20.10.11" + }, + "AuxiliaryAddresses": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver-specific options, specified as a map.", + "example": { + "foo": "bar" + } + } + } + }, + "Internal": { + "type": "boolean", + "description": "Whether the network is created to only allow internal networking\nconnectivity.\n", + "example": false, + "default": false + }, + "Attachable": { + "type": "boolean", + "description": "Whether a global / swarm scope network is manually attachable by regular\ncontainers from workers in swarm mode.\n", + "example": false, + "default": false + }, + "Ingress": { + "type": "boolean", + "description": "Whether the network is providing the routing-mesh for the swarm cluster.\n", + "example": false, + "default": false + }, + "ConfigFrom": { + "type": "object", + "properties": { + "Network": { + "type": "string", + "description": "The name of the config-only network that provides the network's\nconfiguration. The specified network must be an existing config-only\nnetwork. Only network names are allowed, not network IDs.\n", + "example": "config_only_network_01" + } + }, + "description": "The config-only network source to provide the configuration for\nthis network.\n" + }, + "ConfigOnly": { + "type": "boolean", + "description": "Whether the network is a config-only network. Config-only networks are\nplaceholder networks for network configurations to be used by other\nnetworks. Config-only networks cannot be used directly to run containers\nor services.\n", + "default": false + }, + "Containers": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "example": "container_1" + }, + "EndpointID": { + "type": "string", + "example": "628cadb8bcb92de107b2a1e516cbffe463e321f548feb37697cce00ad694f21a" + }, + "MacAddress": { + "type": "string", + "example": "02:42:ac:13:00:02" + }, + "IPv4Address": { + "type": "string", + "example": "172.19.0.2/16" + }, + "IPv6Address": { + "type": "string", + "example": "" + } + } + }, + "description": "Contains endpoints attached to the network.\n", + "example": { + "19a4d5d687db25203351ed79d478946f861258f018fe384f229f2efa4b23513c": { + "Name": "test", + "EndpointID": "628cadb8bcb92de107b2a1e516cbffe463e321f548feb37697cce00ad694f21a", + "MacAddress": "02:42:ac:13:00:02", + "IPv4Address": "172.19.0.2/16", + "IPv6Address": "" + } + } + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Network-specific options uses when creating the network.\n", + "example": { + "com.docker.network.bridge.default_bridge": "true", + "com.docker.network.bridge.enable_icc": "true", + "com.docker.network.bridge.enable_ip_masquerade": "true", + "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0", + "com.docker.network.bridge.name": "docker0", + "com.docker.network.driver.mtu": "1500" + } + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "Peers": { + "type": "array", + "description": "List of peer nodes for an overlay network. This field is only present\nfor overlay networks, and omitted for other network types.\n", + "nullable": true, + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "ID of the peer-node in the Swarm cluster.", + "example": "6869d7c1732b" + }, + "IP": { + "type": "string", + "description": "IP-address of the peer-node in the Swarm cluster.", + "example": "10.133.77.91" + } + }, + "description": "PeerInfo represents one peer of an overlay network.\n" + } + } + } + } + }, + "example": [ + { + "Name": "bridge", + "Id": "f2de39df4171b0dc801e8002d1d999b77256983dfc63041c0f34030aa3977566", + "Created": "2016-10-19T06:21:00.416543526Z", + "Scope": "local", + "Driver": "bridge", + "EnableIPv6": false, + "Internal": false, + "Attachable": false, + "Ingress": false, + "IPAM": { + "Driver": "default", + "Config": [ + { + "Subnet": "172.17.0.0/16" + } + ] + }, + "Options": { + "com.docker.network.bridge.default_bridge": "true", + "com.docker.network.bridge.enable_icc": "true", + "com.docker.network.bridge.enable_ip_masquerade": "true", + "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0", + "com.docker.network.bridge.name": "docker0", + "com.docker.network.driver.mtu": "1500" + } + }, + { + "Name": "none", + "Id": "e086a3893b05ab69242d3c44e49483a3bbbd3a26b46baa8f61ab797c1088d794", + "Created": "0001-01-01T00:00:00Z", + "Scope": "local", + "Driver": "null", + "EnableIPv6": false, + "Internal": false, + "Attachable": false, + "Ingress": false, + "IPAM": { + "Driver": "default", + "Config": [] + }, + "Containers": {}, + "Options": {} + }, + { + "Name": "host", + "Id": "13e871235c677f196c4e1ecebb9dc733b9b2d2ab589e30c539efeda84a24215e", + "Created": "0001-01-01T00:00:00Z", + "Scope": "local", + "Driver": "host", + "EnableIPv6": false, + "Internal": false, + "Attachable": false, + "Ingress": false, + "IPAM": { + "Driver": "default", + "Config": [] + }, + "Containers": {}, + "Options": {} + } + ] + } + } + }, + "500": { + "description": "Server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/networks/{id}": { + "get": { + "tags": [ + "Network" + ], + "summary": "Inspect a network", + "operationId": "NetworkInspect", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Network ID or name", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "verbose", + "in": "query", + "description": "Detailed inspect output for troubleshooting", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "scope", + "in": "query", + "description": "Filter the network by scope (swarm, global, or local)", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "No error", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the network.\n", + "example": "my_network" + }, + "Id": { + "type": "string", + "description": "ID that uniquely identifies a network on a single machine.\n", + "example": "7d86d31b1478e7cca9ebed7e73aa0fdeec46c5ca29497431d3007d2d9e15ed99" + }, + "Created": { + "type": "string", + "description": "Date and time at which the network was created in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2016-10-19T04:33:30.360899459Z" + }, + "Scope": { + "type": "string", + "description": "The level at which the network exists (e.g. `swarm` for cluster-wide\nor `local` for machine level)\n", + "example": "local" + }, + "Driver": { + "type": "string", + "description": "The name of the driver used to create the network (e.g. `bridge`,\n`overlay`).\n", + "example": "overlay" + }, + "EnableIPv6": { + "type": "boolean", + "description": "Whether the network was created with IPv6 enabled.\n", + "example": false + }, + "IPAM": { + "type": "object", + "properties": { + "Driver": { + "type": "string", + "description": "Name of the IPAM driver to use.", + "example": "default", + "default": "default" + }, + "Config": { + "type": "array", + "description": "List of IPAM configuration options, specified as a map:\n\n```\n{\"Subnet\": , \"IPRange\": , \"Gateway\": , \"AuxAddress\": }\n```\n", + "items": { + "type": "object", + "properties": { + "Subnet": { + "type": "string", + "example": "172.20.0.0/16" + }, + "IPRange": { + "type": "string", + "example": "172.20.10.0/24" + }, + "Gateway": { + "type": "string", + "example": "172.20.10.11" + }, + "AuxiliaryAddresses": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver-specific options, specified as a map.", + "example": { + "foo": "bar" + } + } + } + }, + "Internal": { + "type": "boolean", + "description": "Whether the network is created to only allow internal networking\nconnectivity.\n", + "example": false, + "default": false + }, + "Attachable": { + "type": "boolean", + "description": "Whether a global / swarm scope network is manually attachable by regular\ncontainers from workers in swarm mode.\n", + "example": false, + "default": false + }, + "Ingress": { + "type": "boolean", + "description": "Whether the network is providing the routing-mesh for the swarm cluster.\n", + "example": false, + "default": false + }, + "ConfigFrom": { + "type": "object", + "properties": { + "Network": { + "type": "string", + "description": "The name of the config-only network that provides the network's\nconfiguration. The specified network must be an existing config-only\nnetwork. Only network names are allowed, not network IDs.\n", + "example": "config_only_network_01" + } + }, + "description": "The config-only network source to provide the configuration for\nthis network.\n" + }, + "ConfigOnly": { + "type": "boolean", + "description": "Whether the network is a config-only network. Config-only networks are\nplaceholder networks for network configurations to be used by other\nnetworks. Config-only networks cannot be used directly to run containers\nor services.\n", + "default": false + }, + "Containers": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "example": "container_1" + }, + "EndpointID": { + "type": "string", + "example": "628cadb8bcb92de107b2a1e516cbffe463e321f548feb37697cce00ad694f21a" + }, + "MacAddress": { + "type": "string", + "example": "02:42:ac:13:00:02" + }, + "IPv4Address": { + "type": "string", + "example": "172.19.0.2/16" + }, + "IPv6Address": { + "type": "string", + "example": "" + } + } + }, + "description": "Contains endpoints attached to the network.\n", + "example": { + "19a4d5d687db25203351ed79d478946f861258f018fe384f229f2efa4b23513c": { + "Name": "test", + "EndpointID": "628cadb8bcb92de107b2a1e516cbffe463e321f548feb37697cce00ad694f21a", + "MacAddress": "02:42:ac:13:00:02", + "IPv4Address": "172.19.0.2/16", + "IPv6Address": "" + } + } + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Network-specific options uses when creating the network.\n", + "example": { + "com.docker.network.bridge.default_bridge": "true", + "com.docker.network.bridge.enable_icc": "true", + "com.docker.network.bridge.enable_ip_masquerade": "true", + "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0", + "com.docker.network.bridge.name": "docker0", + "com.docker.network.driver.mtu": "1500" + } + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "Peers": { + "type": "array", + "description": "List of peer nodes for an overlay network. This field is only present\nfor overlay networks, and omitted for other network types.\n", + "nullable": true, + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "ID of the peer-node in the Swarm cluster.", + "example": "6869d7c1732b" + }, + "IP": { + "type": "string", + "description": "IP-address of the peer-node in the Swarm cluster.", + "example": "10.133.77.91" + } + }, + "description": "PeerInfo represents one peer of an overlay network.\n" + } + } + } + } + } + } + }, + "404": { + "description": "Network not found", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "Server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + }, + "delete": { + "tags": [ + "Network" + ], + "summary": "Remove a network", + "operationId": "NetworkDelete", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Network ID or name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "No error", + "content": {} + }, + "403": { + "description": "operation not supported for pre-defined networks", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "404": { + "description": "no such network", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "Server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/networks/create": { + "post": { + "tags": [ + "Network" + ], + "summary": "Create a network", + "operationId": "NetworkCreate", + "requestBody": { + "description": "Network configuration", + "content": { + "application/json": { + "schema": { + "title": "NetworkCreateRequest", + "required": [ + "Name" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "The network's name.", + "example": "my_network" + }, + "CheckDuplicate": { + "type": "boolean", + "description": "Check for networks with duplicate names. Since Network is\nprimarily keyed based on a random ID and not on the name, and\nnetwork name is strictly a user-friendly alias to the network\nwhich is uniquely identified using ID, there is no guaranteed\nway to check for duplicates. CheckDuplicate is there to provide\na best effort checking of any networks which has the same name\nbut it is not guaranteed to catch all name collisions.\n", + "example": true + }, + "Driver": { + "type": "string", + "description": "Name of the network driver plugin to use.", + "example": "bridge", + "default": "bridge" + }, + "Scope": { + "type": "string", + "description": "The level at which the network exists (e.g. `swarm` for cluster-wide\nor `local` for machine level).\n" + }, + "Internal": { + "type": "boolean", + "description": "Restrict external access to the network." + }, + "Attachable": { + "type": "boolean", + "description": "Globally scoped network is manually attachable by regular\ncontainers from workers in swarm mode.\n", + "example": true + }, + "Ingress": { + "type": "boolean", + "description": "Ingress network is the network which provides the routing-mesh\nin swarm mode.\n", + "example": false + }, + "ConfigOnly": { + "type": "boolean", + "description": "Creates a config-only network. Config-only networks are placeholder\nnetworks for network configurations to be used by other networks.\nConfig-only networks cannot be used directly to run containers\nor services.\n", + "example": false, + "default": false + }, + "ConfigFrom": { + "type": "object", + "properties": { + "Network": { + "type": "string", + "description": "The name of the config-only network that provides the network's\nconfiguration. The specified network must be an existing config-only\nnetwork. Only network names are allowed, not network IDs.\n", + "example": "config_only_network_01" + } + }, + "description": "The config-only network source to provide the configuration for\nthis network.\n" + }, + "IPAM": { + "type": "object", + "properties": { + "Driver": { + "type": "string", + "description": "Name of the IPAM driver to use.", + "example": "default", + "default": "default" + }, + "Config": { + "type": "array", + "description": "List of IPAM configuration options, specified as a map:\n\n```\n{\"Subnet\": , \"IPRange\": , \"Gateway\": , \"AuxAddress\": }\n```\n", + "items": { + "type": "object", + "properties": { + "Subnet": { + "type": "string", + "example": "172.20.0.0/16" + }, + "IPRange": { + "type": "string", + "example": "172.20.10.0/24" + }, + "Gateway": { + "type": "string", + "example": "172.20.10.11" + }, + "AuxiliaryAddresses": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver-specific options, specified as a map.", + "example": { + "foo": "bar" + } + } + } + }, + "EnableIPv6": { + "type": "boolean", + "description": "Enable IPv6 on the network.", + "example": true + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Network specific options to be used by the drivers.", + "example": { + "com.docker.network.bridge.default_bridge": "true", + "com.docker.network.bridge.enable_icc": "true", + "com.docker.network.bridge.enable_ip_masquerade": "true", + "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0", + "com.docker.network.bridge.name": "docker0", + "com.docker.network.driver.mtu": "1500" + } + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + } + } + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "No error", + "content": { + "application/json": { + "schema": { + "title": "NetworkCreateResponse", + "type": "object", + "properties": { + "Id": { + "type": "string", + "description": "The ID of the created network." + }, + "Warning": { + "type": "string" + } + }, + "example": { + "Id": "22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30", + "Warning": "" + } + } + } + } + }, + "400": { + "description": "bad parameter", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "403": { + "description": "operation not supported for pre-defined networks", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "404": { + "description": "plugin not found", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "Server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + }, + "x-codegen-request-body-name": "networkConfig" + } + }, + "/networks/{id}/connect": { + "post": { + "tags": [ + "Network" + ], + "summary": "Connect a container to a network", + "operationId": "NetworkConnect", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Network ID or name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "title": "NetworkConnectRequest", + "type": "object", + "properties": { + "Container": { + "type": "string", + "description": "The ID or name of the container to connect to the network." + }, + "EndpointConfig": { + "type": "object", + "properties": { + "IPAMConfig": { + "type": "object", + "properties": { + "IPv4Address": { + "type": "string", + "example": "172.20.30.33" + }, + "IPv6Address": { + "type": "string", + "example": "2001:db8:abcd::3033" + }, + "LinkLocalIPs": { + "type": "array", + "example": [ + "169.254.34.68", + "fe80::3468" + ], + "items": { + "type": "string" + } + } + }, + "description": "EndpointIPAMConfig represents an endpoint's IPAM configuration.\n", + "nullable": true, + "x-nullable": true + }, + "Links": { + "type": "array", + "example": [ + "container_1", + "container_2" + ], + "items": { + "type": "string" + } + }, + "Aliases": { + "type": "array", + "example": [ + "server_x", + "server_y" + ], + "items": { + "type": "string" + } + }, + "NetworkID": { + "type": "string", + "description": "Unique ID of the network.\n", + "example": "08754567f1f40222263eab4102e1c733ae697e8e354aa9cd6e18d7402835292a" + }, + "EndpointID": { + "type": "string", + "description": "Unique ID for the service endpoint in a Sandbox.\n", + "example": "b88f5b905aabf2893f3cbc4ee42d1ea7980bbc0a92e2c8922b1e1795298afb0b" + }, + "Gateway": { + "type": "string", + "description": "Gateway address for this network.\n", + "example": "172.17.0.1" + }, + "IPAddress": { + "type": "string", + "description": "IPv4 address.\n", + "example": "172.17.0.4" + }, + "IPPrefixLen": { + "type": "integer", + "description": "Mask length of the IPv4 address.\n", + "example": 16 + }, + "IPv6Gateway": { + "type": "string", + "description": "IPv6 gateway address.\n", + "example": "2001:db8:2::100" + }, + "GlobalIPv6Address": { + "type": "string", + "description": "Global IPv6 address.\n", + "example": "2001:db8::5689" + }, + "GlobalIPv6PrefixLen": { + "type": "integer", + "description": "Mask length of the global IPv6 address.\n", + "format": "int64", + "example": 64 + }, + "MacAddress": { + "type": "string", + "description": "MAC address for the endpoint on this network.\n", + "example": "02:42:ac:11:00:04" + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "DriverOpts is a mapping of driver options and values. These options\nare passed directly to the driver and are driver specific.\n", + "nullable": true, + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + } + }, + "description": "Configuration for a network endpoint." + } + }, + "example": { + "Container": "3613f73ba0e4", + "EndpointConfig": { + "IPAMConfig": { + "IPv4Address": "172.24.56.89", + "IPv6Address": "2001:db8::5689" + } + } + } + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "No error", + "content": {} + }, + "403": { + "description": "Operation not supported for swarm scoped networks", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "404": { + "description": "Network or container not found", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "Server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + }, + "x-codegen-request-body-name": "container" + } + }, + "/networks/{id}/disconnect": { + "post": { + "tags": [ + "Network" + ], + "summary": "Disconnect a container from a network", + "operationId": "NetworkDisconnect", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Network ID or name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "title": "NetworkDisconnectRequest", + "type": "object", + "properties": { + "Container": { + "type": "string", + "description": "The ID or name of the container to disconnect from the network.\n" + }, + "Force": { + "type": "boolean", + "description": "Force the container to disconnect from the network.\n" + } + } + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "No error", + "content": {} + }, + "403": { + "description": "Operation not supported for swarm scoped networks", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "404": { + "description": "Network or container not found", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "Server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + }, + "x-codegen-request-body-name": "container" + } + }, + "/networks/prune": { + "post": { + "tags": [ + "Network" + ], + "summary": "Delete unused networks", + "operationId": "NetworkPrune", + "parameters": [ + { + "name": "filters", + "in": "query", + "description": "Filters to process on the prune list, encoded as JSON (a `map[string][]string`).\n\nAvailable filters:\n- `until=` Prune networks created before this timestamp. The `` can be Unix timestamps, date formatted timestamps, or Go duration strings (e.g. `10m`, `1h30m`) computed relative to the daemon machine’s time.\n- `label` (`label=`, `label==`, `label!=`, or `label!==`) Prune networks with (or without, in case `label!=...` is used) the specified labels.\n", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "No error", + "content": { + "application/json": { + "schema": { + "title": "NetworkPruneResponse", + "type": "object", + "properties": { + "NetworksDeleted": { + "type": "array", + "description": "Networks that were deleted", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "500": { + "description": "Server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/plugins": { + "get": { + "tags": [ + "Plugin" + ], + "summary": "List plugins", + "description": "Returns information about installed plugins.", + "operationId": "PluginList", + "parameters": [ + { + "name": "filters", + "in": "query", + "description": "A JSON encoded value of the filters (a `map[string][]string`) to\nprocess on the plugin list.\n\nAvailable filters:\n\n- `capability=`\n- `enable=|`\n", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "No error", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "required": [ + "Config", + "Enabled", + "Name", + "Settings" + ], + "type": "object", + "properties": { + "Id": { + "type": "string", + "example": "5724e2c8652da337ab2eedd19fc6fc0ec908e4bd907c7421bf6a8dfc70c4c078" + }, + "Name": { + "type": "string", + "nullable": false, + "example": "tiborvass/sample-volume-plugin" + }, + "Enabled": { + "type": "boolean", + "description": "True if the plugin is running. False if the plugin is not running, only installed.", + "nullable": false, + "example": true + }, + "Settings": { + "required": [ + "Args", + "Devices", + "Env", + "Mounts" + ], + "type": "object", + "properties": { + "Mounts": { + "type": "array", + "items": { + "required": [ + "Description", + "Destination", + "Name", + "Options", + "Settable", + "Source", + "Type" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false, + "example": "some-mount" + }, + "Description": { + "type": "string", + "nullable": false, + "example": "This is a mount that's used by the plugin." + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Source": { + "type": "string", + "example": "/var/lib/docker/plugins/" + }, + "Destination": { + "type": "string", + "nullable": false, + "example": "/mnt/state" + }, + "Type": { + "type": "string", + "nullable": false, + "example": "bind" + }, + "Options": { + "type": "array", + "example": [ + "rbind", + "rw" + ], + "items": { + "type": "string" + } + } + }, + "nullable": false, + "x-nullable": false + } + }, + "Env": { + "type": "array", + "example": [ + "DEBUG=0" + ], + "items": { + "type": "string" + } + }, + "Args": { + "type": "array", + "items": { + "type": "string" + } + }, + "Devices": { + "type": "array", + "items": { + "required": [ + "Description", + "Name", + "Path", + "Settable" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false + }, + "Description": { + "type": "string", + "nullable": false + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Path": { + "type": "string", + "example": "/dev/fuse" + } + }, + "nullable": false, + "x-nullable": false + } + } + }, + "description": "Settings that can be modified by users.", + "nullable": false + }, + "PluginReference": { + "type": "string", + "description": "plugin remote reference used to push/pull the plugin", + "nullable": false, + "example": "localhost:5000/tiborvass/sample-volume-plugin:latest" + }, + "Config": { + "required": [ + "Args", + "Description", + "Documentation", + "Entrypoint", + "Env", + "Interface", + "IpcHost", + "Linux", + "Mounts", + "Network", + "PidHost", + "PropagatedMount", + "WorkDir" + ], + "type": "object", + "properties": { + "DockerVersion": { + "type": "string", + "description": "Docker Version used to create the plugin", + "nullable": false, + "example": "17.06.0-ce" + }, + "Description": { + "type": "string", + "nullable": false, + "example": "A sample volume plugin for Docker" + }, + "Documentation": { + "type": "string", + "nullable": false, + "example": "https://docs.docker.com/engine/extend/plugins/" + }, + "Interface": { + "required": [ + "Socket", + "Types" + ], + "type": "object", + "properties": { + "Types": { + "type": "array", + "example": [ + "docker.volumedriver/1.0" + ], + "items": { + "required": [ + "Capability", + "Prefix", + "Version" + ], + "type": "object", + "properties": { + "Prefix": { + "type": "string", + "nullable": false + }, + "Capability": { + "type": "string", + "nullable": false + }, + "Version": { + "type": "string", + "nullable": false + } + }, + "nullable": false, + "x-nullable": false + } + }, + "Socket": { + "type": "string", + "nullable": false, + "example": "plugins.sock" + }, + "ProtocolScheme": { + "type": "string", + "description": "Protocol to use for clients connecting to the plugin.", + "example": "some.protocol/v1.0", + "enum": [ + "", + "moby.plugins.http/v1" + ] + } + }, + "description": "The interface between Docker and the plugin", + "nullable": false + }, + "Entrypoint": { + "type": "array", + "example": [ + "/usr/bin/sample-volume-plugin", + "/data" + ], + "items": { + "type": "string" + } + }, + "WorkDir": { + "type": "string", + "nullable": false, + "example": "/bin/" + }, + "User": { + "type": "object", + "properties": { + "UID": { + "type": "integer", + "format": "uint32", + "example": 1000 + }, + "GID": { + "type": "integer", + "format": "uint32", + "example": 1000 + } + }, + "nullable": false + }, + "Network": { + "required": [ + "Type" + ], + "type": "object", + "properties": { + "Type": { + "type": "string", + "nullable": false, + "example": "host" + } + }, + "nullable": false + }, + "Linux": { + "required": [ + "AllowAllDevices", + "Capabilities", + "Devices" + ], + "type": "object", + "properties": { + "Capabilities": { + "type": "array", + "example": [ + "CAP_SYS_ADMIN", + "CAP_SYSLOG" + ], + "items": { + "type": "string" + } + }, + "AllowAllDevices": { + "type": "boolean", + "nullable": false, + "example": false + }, + "Devices": { + "type": "array", + "items": { + "required": [ + "Description", + "Name", + "Path", + "Settable" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false + }, + "Description": { + "type": "string", + "nullable": false + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Path": { + "type": "string", + "example": "/dev/fuse" + } + }, + "nullable": false, + "x-nullable": false + } + } + }, + "nullable": false + }, + "PropagatedMount": { + "type": "string", + "nullable": false, + "example": "/mnt/volumes" + }, + "IpcHost": { + "type": "boolean", + "nullable": false, + "example": false + }, + "PidHost": { + "type": "boolean", + "nullable": false, + "example": false + }, + "Mounts": { + "type": "array", + "items": { + "required": [ + "Description", + "Destination", + "Name", + "Options", + "Settable", + "Source", + "Type" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false, + "example": "some-mount" + }, + "Description": { + "type": "string", + "nullable": false, + "example": "This is a mount that's used by the plugin." + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Source": { + "type": "string", + "example": "/var/lib/docker/plugins/" + }, + "Destination": { + "type": "string", + "nullable": false, + "example": "/mnt/state" + }, + "Type": { + "type": "string", + "nullable": false, + "example": "bind" + }, + "Options": { + "type": "array", + "example": [ + "rbind", + "rw" + ], + "items": { + "type": "string" + } + } + }, + "nullable": false, + "x-nullable": false + } + }, + "Env": { + "type": "array", + "example": [ + { + "Name": "DEBUG", + "Description": "If set, prints debug messages", + "Value": "0" + } + ], + "items": { + "required": [ + "Description", + "Name", + "Settable", + "Value" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false + }, + "Description": { + "type": "string", + "nullable": false + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Value": { + "type": "string" + } + }, + "nullable": false, + "x-nullable": false + } + }, + "Args": { + "required": [ + "Description", + "Name", + "Settable", + "Value" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false, + "example": "args" + }, + "Description": { + "type": "string", + "nullable": false, + "example": "command line arguments" + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Value": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "nullable": false + }, + "rootfs": { + "type": "object", + "properties": { + "type": { + "type": "string", + "example": "layers" + }, + "diff_ids": { + "type": "array", + "example": [ + "sha256:675532206fbf3030b8458f88d6e26d4eb1577688a25efec97154c94e8b6b4887", + "sha256:e216a057b1cb1efc11f8a268f37ef62083e70b1b38323ba252e25ac88904a7e8" + ], + "items": { + "type": "string" + } + } + } + } + }, + "description": "The config of a plugin.", + "nullable": false + } + }, + "description": "A plugin for the Engine API" + } + } + } + } + }, + "500": { + "description": "Server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/plugins/privileges": { + "get": { + "tags": [ + "Plugin" + ], + "summary": "Get plugin privileges", + "operationId": "GetPluginPrivileges", + "parameters": [ + { + "name": "remote", + "in": "query", + "description": "The name of the plugin. The `:latest` tag is optional, and is the\ndefault if omitted.\n", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "no error", + "content": { + "application/json": { + "schema": { + "type": "array", + "example": [ + { + "Name": "network", + "Description": "", + "Value": [ + "host" + ] + }, + { + "Name": "mount", + "Description": "", + "Value": [ + "/data" + ] + }, + { + "Name": "device", + "Description": "", + "Value": [ + "/dev/cpu_dma_latency" + ] + } + ], + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "example": "network" + }, + "Description": { + "type": "string" + }, + "Value": { + "type": "array", + "example": [ + "host" + ], + "items": { + "type": "string" + } + } + }, + "description": "Describes a permission the user has to accept upon installing\nthe plugin.\n", + "x-go-name": "PluginPrivilege" + } + } + }, + "text/plain": { + "schema": { + "type": "array", + "example": [ + { + "Name": "network", + "Description": "", + "Value": [ + "host" + ] + }, + { + "Name": "mount", + "Description": "", + "Value": [ + "/data" + ] + }, + { + "Name": "device", + "Description": "", + "Value": [ + "/dev/cpu_dma_latency" + ] + } + ], + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "example": "network" + }, + "Description": { + "type": "string" + }, + "Value": { + "type": "array", + "example": [ + "host" + ], + "items": { + "type": "string" + } + } + }, + "description": "Describes a permission the user has to accept upon installing\nthe plugin.\n", + "x-go-name": "PluginPrivilege" + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/plugins/pull": { + "post": { + "tags": [ + "Plugin" + ], + "summary": "Install a plugin", + "description": "Pulls and installs a plugin. After the plugin is installed, it can be\nenabled using the [`POST /plugins/{name}/enable` endpoint](#operation/PostPluginsEnable).\n", + "operationId": "PluginPull", + "parameters": [ + { + "name": "remote", + "in": "query", + "description": "Remote reference for plugin to install.\n\nThe `:latest` tag is optional, and is used as the default if omitted.\n", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "name", + "in": "query", + "description": "Local name for the pulled plugin.\n\nThe `:latest` tag is optional, and is used as the default if omitted.\n", + "schema": { + "type": "string" + } + }, + { + "name": "X-Registry-Auth", + "in": "header", + "description": "A base64url-encoded auth configuration to use when pulling a plugin\nfrom a registry.\n\nRefer to the [authentication section](#section/Authentication) for\ndetails.\n", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "array", + "example": [ + { + "Name": "network", + "Description": "", + "Value": [ + "host" + ] + }, + { + "Name": "mount", + "Description": "", + "Value": [ + "/data" + ] + }, + { + "Name": "device", + "Description": "", + "Value": [ + "/dev/cpu_dma_latency" + ] + } + ], + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "example": "network" + }, + "Description": { + "type": "string" + }, + "Value": { + "type": "array", + "example": [ + "host" + ], + "items": { + "type": "string" + } + } + }, + "description": "Describes a permission the user has to accept upon installing\nthe plugin.\n", + "x-go-name": "PluginPrivilege" + } + } + }, + "text/plain": { + "schema": { + "type": "array", + "example": [ + { + "Name": "network", + "Description": "", + "Value": [ + "host" + ] + }, + { + "Name": "mount", + "Description": "", + "Value": [ + "/data" + ] + }, + { + "Name": "device", + "Description": "", + "Value": [ + "/dev/cpu_dma_latency" + ] + } + ], + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "example": "network" + }, + "Description": { + "type": "string" + }, + "Value": { + "type": "array", + "example": [ + "host" + ], + "items": { + "type": "string" + } + } + }, + "description": "Describes a permission the user has to accept upon installing\nthe plugin.\n", + "x-go-name": "PluginPrivilege" + } + } + } + }, + "required": false + }, + "responses": { + "204": { + "description": "no error", + "content": {} + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + }, + "x-codegen-request-body-name": "body" + } + }, + "/plugins/{name}/json": { + "get": { + "tags": [ + "Plugin" + ], + "summary": "Inspect a plugin", + "operationId": "PluginInspect", + "parameters": [ + { + "name": "name", + "in": "path", + "description": "The name of the plugin. The `:latest` tag is optional, and is the\ndefault if omitted.\n", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "no error", + "content": { + "application/json": { + "schema": { + "required": [ + "Config", + "Enabled", + "Name", + "Settings" + ], + "type": "object", + "properties": { + "Id": { + "type": "string", + "example": "5724e2c8652da337ab2eedd19fc6fc0ec908e4bd907c7421bf6a8dfc70c4c078" + }, + "Name": { + "type": "string", + "nullable": false, + "example": "tiborvass/sample-volume-plugin" + }, + "Enabled": { + "type": "boolean", + "description": "True if the plugin is running. False if the plugin is not running, only installed.", + "nullable": false, + "example": true + }, + "Settings": { + "required": [ + "Args", + "Devices", + "Env", + "Mounts" + ], + "type": "object", + "properties": { + "Mounts": { + "type": "array", + "items": { + "required": [ + "Description", + "Destination", + "Name", + "Options", + "Settable", + "Source", + "Type" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false, + "example": "some-mount" + }, + "Description": { + "type": "string", + "nullable": false, + "example": "This is a mount that's used by the plugin." + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Source": { + "type": "string", + "example": "/var/lib/docker/plugins/" + }, + "Destination": { + "type": "string", + "nullable": false, + "example": "/mnt/state" + }, + "Type": { + "type": "string", + "nullable": false, + "example": "bind" + }, + "Options": { + "type": "array", + "example": [ + "rbind", + "rw" + ], + "items": { + "type": "string" + } + } + }, + "nullable": false, + "x-nullable": false + } + }, + "Env": { + "type": "array", + "example": [ + "DEBUG=0" + ], + "items": { + "type": "string" + } + }, + "Args": { + "type": "array", + "items": { + "type": "string" + } + }, + "Devices": { + "type": "array", + "items": { + "required": [ + "Description", + "Name", + "Path", + "Settable" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false + }, + "Description": { + "type": "string", + "nullable": false + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Path": { + "type": "string", + "example": "/dev/fuse" + } + }, + "nullable": false, + "x-nullable": false + } + } + }, + "description": "Settings that can be modified by users.", + "nullable": false + }, + "PluginReference": { + "type": "string", + "description": "plugin remote reference used to push/pull the plugin", + "nullable": false, + "example": "localhost:5000/tiborvass/sample-volume-plugin:latest" + }, + "Config": { + "required": [ + "Args", + "Description", + "Documentation", + "Entrypoint", + "Env", + "Interface", + "IpcHost", + "Linux", + "Mounts", + "Network", + "PidHost", + "PropagatedMount", + "WorkDir" + ], + "type": "object", + "properties": { + "DockerVersion": { + "type": "string", + "description": "Docker Version used to create the plugin", + "nullable": false, + "example": "17.06.0-ce" + }, + "Description": { + "type": "string", + "nullable": false, + "example": "A sample volume plugin for Docker" + }, + "Documentation": { + "type": "string", + "nullable": false, + "example": "https://docs.docker.com/engine/extend/plugins/" + }, + "Interface": { + "required": [ + "Socket", + "Types" + ], + "type": "object", + "properties": { + "Types": { + "type": "array", + "example": [ + "docker.volumedriver/1.0" + ], + "items": { + "required": [ + "Capability", + "Prefix", + "Version" + ], + "type": "object", + "properties": { + "Prefix": { + "type": "string", + "nullable": false + }, + "Capability": { + "type": "string", + "nullable": false + }, + "Version": { + "type": "string", + "nullable": false + } + }, + "nullable": false, + "x-nullable": false + } + }, + "Socket": { + "type": "string", + "nullable": false, + "example": "plugins.sock" + }, + "ProtocolScheme": { + "type": "string", + "description": "Protocol to use for clients connecting to the plugin.", + "example": "some.protocol/v1.0", + "enum": [ + "", + "moby.plugins.http/v1" + ] + } + }, + "description": "The interface between Docker and the plugin", + "nullable": false + }, + "Entrypoint": { + "type": "array", + "example": [ + "/usr/bin/sample-volume-plugin", + "/data" + ], + "items": { + "type": "string" + } + }, + "WorkDir": { + "type": "string", + "nullable": false, + "example": "/bin/" + }, + "User": { + "type": "object", + "properties": { + "UID": { + "type": "integer", + "format": "uint32", + "example": 1000 + }, + "GID": { + "type": "integer", + "format": "uint32", + "example": 1000 + } + }, + "nullable": false + }, + "Network": { + "required": [ + "Type" + ], + "type": "object", + "properties": { + "Type": { + "type": "string", + "nullable": false, + "example": "host" + } + }, + "nullable": false + }, + "Linux": { + "required": [ + "AllowAllDevices", + "Capabilities", + "Devices" + ], + "type": "object", + "properties": { + "Capabilities": { + "type": "array", + "example": [ + "CAP_SYS_ADMIN", + "CAP_SYSLOG" + ], + "items": { + "type": "string" + } + }, + "AllowAllDevices": { + "type": "boolean", + "nullable": false, + "example": false + }, + "Devices": { + "type": "array", + "items": { + "required": [ + "Description", + "Name", + "Path", + "Settable" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false + }, + "Description": { + "type": "string", + "nullable": false + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Path": { + "type": "string", + "example": "/dev/fuse" + } + }, + "nullable": false, + "x-nullable": false + } + } + }, + "nullable": false + }, + "PropagatedMount": { + "type": "string", + "nullable": false, + "example": "/mnt/volumes" + }, + "IpcHost": { + "type": "boolean", + "nullable": false, + "example": false + }, + "PidHost": { + "type": "boolean", + "nullable": false, + "example": false + }, + "Mounts": { + "type": "array", + "items": { + "required": [ + "Description", + "Destination", + "Name", + "Options", + "Settable", + "Source", + "Type" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false, + "example": "some-mount" + }, + "Description": { + "type": "string", + "nullable": false, + "example": "This is a mount that's used by the plugin." + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Source": { + "type": "string", + "example": "/var/lib/docker/plugins/" + }, + "Destination": { + "type": "string", + "nullable": false, + "example": "/mnt/state" + }, + "Type": { + "type": "string", + "nullable": false, + "example": "bind" + }, + "Options": { + "type": "array", + "example": [ + "rbind", + "rw" + ], + "items": { + "type": "string" + } + } + }, + "nullable": false, + "x-nullable": false + } + }, + "Env": { + "type": "array", + "example": [ + { + "Name": "DEBUG", + "Description": "If set, prints debug messages", + "Value": "0" + } + ], + "items": { + "required": [ + "Description", + "Name", + "Settable", + "Value" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false + }, + "Description": { + "type": "string", + "nullable": false + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Value": { + "type": "string" + } + }, + "nullable": false, + "x-nullable": false + } + }, + "Args": { + "required": [ + "Description", + "Name", + "Settable", + "Value" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false, + "example": "args" + }, + "Description": { + "type": "string", + "nullable": false, + "example": "command line arguments" + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Value": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "nullable": false + }, + "rootfs": { + "type": "object", + "properties": { + "type": { + "type": "string", + "example": "layers" + }, + "diff_ids": { + "type": "array", + "example": [ + "sha256:675532206fbf3030b8458f88d6e26d4eb1577688a25efec97154c94e8b6b4887", + "sha256:e216a057b1cb1efc11f8a268f37ef62083e70b1b38323ba252e25ac88904a7e8" + ], + "items": { + "type": "string" + } + } + } + } + }, + "description": "The config of a plugin.", + "nullable": false + } + }, + "description": "A plugin for the Engine API" + } + }, + "text/plain": { + "schema": { + "required": [ + "Config", + "Enabled", + "Name", + "Settings" + ], + "type": "object", + "properties": { + "Id": { + "type": "string", + "example": "5724e2c8652da337ab2eedd19fc6fc0ec908e4bd907c7421bf6a8dfc70c4c078" + }, + "Name": { + "type": "string", + "nullable": false, + "example": "tiborvass/sample-volume-plugin" + }, + "Enabled": { + "type": "boolean", + "description": "True if the plugin is running. False if the plugin is not running, only installed.", + "nullable": false, + "example": true + }, + "Settings": { + "required": [ + "Args", + "Devices", + "Env", + "Mounts" + ], + "type": "object", + "properties": { + "Mounts": { + "type": "array", + "items": { + "required": [ + "Description", + "Destination", + "Name", + "Options", + "Settable", + "Source", + "Type" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false, + "example": "some-mount" + }, + "Description": { + "type": "string", + "nullable": false, + "example": "This is a mount that's used by the plugin." + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Source": { + "type": "string", + "example": "/var/lib/docker/plugins/" + }, + "Destination": { + "type": "string", + "nullable": false, + "example": "/mnt/state" + }, + "Type": { + "type": "string", + "nullable": false, + "example": "bind" + }, + "Options": { + "type": "array", + "example": [ + "rbind", + "rw" + ], + "items": { + "type": "string" + } + } + }, + "nullable": false, + "x-nullable": false + } + }, + "Env": { + "type": "array", + "example": [ + "DEBUG=0" + ], + "items": { + "type": "string" + } + }, + "Args": { + "type": "array", + "items": { + "type": "string" + } + }, + "Devices": { + "type": "array", + "items": { + "required": [ + "Description", + "Name", + "Path", + "Settable" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false + }, + "Description": { + "type": "string", + "nullable": false + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Path": { + "type": "string", + "example": "/dev/fuse" + } + }, + "nullable": false, + "x-nullable": false + } + } + }, + "description": "Settings that can be modified by users.", + "nullable": false + }, + "PluginReference": { + "type": "string", + "description": "plugin remote reference used to push/pull the plugin", + "nullable": false, + "example": "localhost:5000/tiborvass/sample-volume-plugin:latest" + }, + "Config": { + "required": [ + "Args", + "Description", + "Documentation", + "Entrypoint", + "Env", + "Interface", + "IpcHost", + "Linux", + "Mounts", + "Network", + "PidHost", + "PropagatedMount", + "WorkDir" + ], + "type": "object", + "properties": { + "DockerVersion": { + "type": "string", + "description": "Docker Version used to create the plugin", + "nullable": false, + "example": "17.06.0-ce" + }, + "Description": { + "type": "string", + "nullable": false, + "example": "A sample volume plugin for Docker" + }, + "Documentation": { + "type": "string", + "nullable": false, + "example": "https://docs.docker.com/engine/extend/plugins/" + }, + "Interface": { + "required": [ + "Socket", + "Types" + ], + "type": "object", + "properties": { + "Types": { + "type": "array", + "example": [ + "docker.volumedriver/1.0" + ], + "items": { + "required": [ + "Capability", + "Prefix", + "Version" + ], + "type": "object", + "properties": { + "Prefix": { + "type": "string", + "nullable": false + }, + "Capability": { + "type": "string", + "nullable": false + }, + "Version": { + "type": "string", + "nullable": false + } + }, + "nullable": false, + "x-nullable": false + } + }, + "Socket": { + "type": "string", + "nullable": false, + "example": "plugins.sock" + }, + "ProtocolScheme": { + "type": "string", + "description": "Protocol to use for clients connecting to the plugin.", + "example": "some.protocol/v1.0", + "enum": [ + "", + "moby.plugins.http/v1" + ] + } + }, + "description": "The interface between Docker and the plugin", + "nullable": false + }, + "Entrypoint": { + "type": "array", + "example": [ + "/usr/bin/sample-volume-plugin", + "/data" + ], + "items": { + "type": "string" + } + }, + "WorkDir": { + "type": "string", + "nullable": false, + "example": "/bin/" + }, + "User": { + "type": "object", + "properties": { + "UID": { + "type": "integer", + "format": "uint32", + "example": 1000 + }, + "GID": { + "type": "integer", + "format": "uint32", + "example": 1000 + } + }, + "nullable": false + }, + "Network": { + "required": [ + "Type" + ], + "type": "object", + "properties": { + "Type": { + "type": "string", + "nullable": false, + "example": "host" + } + }, + "nullable": false + }, + "Linux": { + "required": [ + "AllowAllDevices", + "Capabilities", + "Devices" + ], + "type": "object", + "properties": { + "Capabilities": { + "type": "array", + "example": [ + "CAP_SYS_ADMIN", + "CAP_SYSLOG" + ], + "items": { + "type": "string" + } + }, + "AllowAllDevices": { + "type": "boolean", + "nullable": false, + "example": false + }, + "Devices": { + "type": "array", + "items": { + "required": [ + "Description", + "Name", + "Path", + "Settable" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false + }, + "Description": { + "type": "string", + "nullable": false + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Path": { + "type": "string", + "example": "/dev/fuse" + } + }, + "nullable": false, + "x-nullable": false + } + } + }, + "nullable": false + }, + "PropagatedMount": { + "type": "string", + "nullable": false, + "example": "/mnt/volumes" + }, + "IpcHost": { + "type": "boolean", + "nullable": false, + "example": false + }, + "PidHost": { + "type": "boolean", + "nullable": false, + "example": false + }, + "Mounts": { + "type": "array", + "items": { + "required": [ + "Description", + "Destination", + "Name", + "Options", + "Settable", + "Source", + "Type" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false, + "example": "some-mount" + }, + "Description": { + "type": "string", + "nullable": false, + "example": "This is a mount that's used by the plugin." + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Source": { + "type": "string", + "example": "/var/lib/docker/plugins/" + }, + "Destination": { + "type": "string", + "nullable": false, + "example": "/mnt/state" + }, + "Type": { + "type": "string", + "nullable": false, + "example": "bind" + }, + "Options": { + "type": "array", + "example": [ + "rbind", + "rw" + ], + "items": { + "type": "string" + } + } + }, + "nullable": false, + "x-nullable": false + } + }, + "Env": { + "type": "array", + "example": [ + { + "Name": "DEBUG", + "Description": "If set, prints debug messages", + "Value": "0" + } + ], + "items": { + "required": [ + "Description", + "Name", + "Settable", + "Value" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false + }, + "Description": { + "type": "string", + "nullable": false + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Value": { + "type": "string" + } + }, + "nullable": false, + "x-nullable": false + } + }, + "Args": { + "required": [ + "Description", + "Name", + "Settable", + "Value" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false, + "example": "args" + }, + "Description": { + "type": "string", + "nullable": false, + "example": "command line arguments" + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Value": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "nullable": false + }, + "rootfs": { + "type": "object", + "properties": { + "type": { + "type": "string", + "example": "layers" + }, + "diff_ids": { + "type": "array", + "example": [ + "sha256:675532206fbf3030b8458f88d6e26d4eb1577688a25efec97154c94e8b6b4887", + "sha256:e216a057b1cb1efc11f8a268f37ef62083e70b1b38323ba252e25ac88904a7e8" + ], + "items": { + "type": "string" + } + } + } + } + }, + "description": "The config of a plugin.", + "nullable": false + } + }, + "description": "A plugin for the Engine API" + } + } + } + }, + "404": { + "description": "plugin is not installed", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/plugins/{name}": { + "delete": { + "tags": [ + "Plugin" + ], + "summary": "Remove a plugin", + "operationId": "PluginDelete", + "parameters": [ + { + "name": "name", + "in": "path", + "description": "The name of the plugin. The `:latest` tag is optional, and is the\ndefault if omitted.\n", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "force", + "in": "query", + "description": "Disable the plugin before removing. This may result in issues if the\nplugin is in use by a container.\n", + "schema": { + "type": "boolean", + "default": false + } + } + ], + "responses": { + "200": { + "description": "no error", + "content": { + "application/json": { + "schema": { + "required": [ + "Config", + "Enabled", + "Name", + "Settings" + ], + "type": "object", + "properties": { + "Id": { + "type": "string", + "example": "5724e2c8652da337ab2eedd19fc6fc0ec908e4bd907c7421bf6a8dfc70c4c078" + }, + "Name": { + "type": "string", + "nullable": false, + "example": "tiborvass/sample-volume-plugin" + }, + "Enabled": { + "type": "boolean", + "description": "True if the plugin is running. False if the plugin is not running, only installed.", + "nullable": false, + "example": true + }, + "Settings": { + "required": [ + "Args", + "Devices", + "Env", + "Mounts" + ], + "type": "object", + "properties": { + "Mounts": { + "type": "array", + "items": { + "required": [ + "Description", + "Destination", + "Name", + "Options", + "Settable", + "Source", + "Type" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false, + "example": "some-mount" + }, + "Description": { + "type": "string", + "nullable": false, + "example": "This is a mount that's used by the plugin." + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Source": { + "type": "string", + "example": "/var/lib/docker/plugins/" + }, + "Destination": { + "type": "string", + "nullable": false, + "example": "/mnt/state" + }, + "Type": { + "type": "string", + "nullable": false, + "example": "bind" + }, + "Options": { + "type": "array", + "example": [ + "rbind", + "rw" + ], + "items": { + "type": "string" + } + } + }, + "nullable": false, + "x-nullable": false + } + }, + "Env": { + "type": "array", + "example": [ + "DEBUG=0" + ], + "items": { + "type": "string" + } + }, + "Args": { + "type": "array", + "items": { + "type": "string" + } + }, + "Devices": { + "type": "array", + "items": { + "required": [ + "Description", + "Name", + "Path", + "Settable" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false + }, + "Description": { + "type": "string", + "nullable": false + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Path": { + "type": "string", + "example": "/dev/fuse" + } + }, + "nullable": false, + "x-nullable": false + } + } + }, + "description": "Settings that can be modified by users.", + "nullable": false + }, + "PluginReference": { + "type": "string", + "description": "plugin remote reference used to push/pull the plugin", + "nullable": false, + "example": "localhost:5000/tiborvass/sample-volume-plugin:latest" + }, + "Config": { + "required": [ + "Args", + "Description", + "Documentation", + "Entrypoint", + "Env", + "Interface", + "IpcHost", + "Linux", + "Mounts", + "Network", + "PidHost", + "PropagatedMount", + "WorkDir" + ], + "type": "object", + "properties": { + "DockerVersion": { + "type": "string", + "description": "Docker Version used to create the plugin", + "nullable": false, + "example": "17.06.0-ce" + }, + "Description": { + "type": "string", + "nullable": false, + "example": "A sample volume plugin for Docker" + }, + "Documentation": { + "type": "string", + "nullable": false, + "example": "https://docs.docker.com/engine/extend/plugins/" + }, + "Interface": { + "required": [ + "Socket", + "Types" + ], + "type": "object", + "properties": { + "Types": { + "type": "array", + "example": [ + "docker.volumedriver/1.0" + ], + "items": { + "required": [ + "Capability", + "Prefix", + "Version" + ], + "type": "object", + "properties": { + "Prefix": { + "type": "string", + "nullable": false + }, + "Capability": { + "type": "string", + "nullable": false + }, + "Version": { + "type": "string", + "nullable": false + } + }, + "nullable": false, + "x-nullable": false + } + }, + "Socket": { + "type": "string", + "nullable": false, + "example": "plugins.sock" + }, + "ProtocolScheme": { + "type": "string", + "description": "Protocol to use for clients connecting to the plugin.", + "example": "some.protocol/v1.0", + "enum": [ + "", + "moby.plugins.http/v1" + ] + } + }, + "description": "The interface between Docker and the plugin", + "nullable": false + }, + "Entrypoint": { + "type": "array", + "example": [ + "/usr/bin/sample-volume-plugin", + "/data" + ], + "items": { + "type": "string" + } + }, + "WorkDir": { + "type": "string", + "nullable": false, + "example": "/bin/" + }, + "User": { + "type": "object", + "properties": { + "UID": { + "type": "integer", + "format": "uint32", + "example": 1000 + }, + "GID": { + "type": "integer", + "format": "uint32", + "example": 1000 + } + }, + "nullable": false + }, + "Network": { + "required": [ + "Type" + ], + "type": "object", + "properties": { + "Type": { + "type": "string", + "nullable": false, + "example": "host" + } + }, + "nullable": false + }, + "Linux": { + "required": [ + "AllowAllDevices", + "Capabilities", + "Devices" + ], + "type": "object", + "properties": { + "Capabilities": { + "type": "array", + "example": [ + "CAP_SYS_ADMIN", + "CAP_SYSLOG" + ], + "items": { + "type": "string" + } + }, + "AllowAllDevices": { + "type": "boolean", + "nullable": false, + "example": false + }, + "Devices": { + "type": "array", + "items": { + "required": [ + "Description", + "Name", + "Path", + "Settable" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false + }, + "Description": { + "type": "string", + "nullable": false + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Path": { + "type": "string", + "example": "/dev/fuse" + } + }, + "nullable": false, + "x-nullable": false + } + } + }, + "nullable": false + }, + "PropagatedMount": { + "type": "string", + "nullable": false, + "example": "/mnt/volumes" + }, + "IpcHost": { + "type": "boolean", + "nullable": false, + "example": false + }, + "PidHost": { + "type": "boolean", + "nullable": false, + "example": false + }, + "Mounts": { + "type": "array", + "items": { + "required": [ + "Description", + "Destination", + "Name", + "Options", + "Settable", + "Source", + "Type" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false, + "example": "some-mount" + }, + "Description": { + "type": "string", + "nullable": false, + "example": "This is a mount that's used by the plugin." + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Source": { + "type": "string", + "example": "/var/lib/docker/plugins/" + }, + "Destination": { + "type": "string", + "nullable": false, + "example": "/mnt/state" + }, + "Type": { + "type": "string", + "nullable": false, + "example": "bind" + }, + "Options": { + "type": "array", + "example": [ + "rbind", + "rw" + ], + "items": { + "type": "string" + } + } + }, + "nullable": false, + "x-nullable": false + } + }, + "Env": { + "type": "array", + "example": [ + { + "Name": "DEBUG", + "Description": "If set, prints debug messages", + "Value": "0" + } + ], + "items": { + "required": [ + "Description", + "Name", + "Settable", + "Value" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false + }, + "Description": { + "type": "string", + "nullable": false + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Value": { + "type": "string" + } + }, + "nullable": false, + "x-nullable": false + } + }, + "Args": { + "required": [ + "Description", + "Name", + "Settable", + "Value" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false, + "example": "args" + }, + "Description": { + "type": "string", + "nullable": false, + "example": "command line arguments" + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Value": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "nullable": false + }, + "rootfs": { + "type": "object", + "properties": { + "type": { + "type": "string", + "example": "layers" + }, + "diff_ids": { + "type": "array", + "example": [ + "sha256:675532206fbf3030b8458f88d6e26d4eb1577688a25efec97154c94e8b6b4887", + "sha256:e216a057b1cb1efc11f8a268f37ef62083e70b1b38323ba252e25ac88904a7e8" + ], + "items": { + "type": "string" + } + } + } + } + }, + "description": "The config of a plugin.", + "nullable": false + } + }, + "description": "A plugin for the Engine API" + } + }, + "text/plain": { + "schema": { + "required": [ + "Config", + "Enabled", + "Name", + "Settings" + ], + "type": "object", + "properties": { + "Id": { + "type": "string", + "example": "5724e2c8652da337ab2eedd19fc6fc0ec908e4bd907c7421bf6a8dfc70c4c078" + }, + "Name": { + "type": "string", + "nullable": false, + "example": "tiborvass/sample-volume-plugin" + }, + "Enabled": { + "type": "boolean", + "description": "True if the plugin is running. False if the plugin is not running, only installed.", + "nullable": false, + "example": true + }, + "Settings": { + "required": [ + "Args", + "Devices", + "Env", + "Mounts" + ], + "type": "object", + "properties": { + "Mounts": { + "type": "array", + "items": { + "required": [ + "Description", + "Destination", + "Name", + "Options", + "Settable", + "Source", + "Type" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false, + "example": "some-mount" + }, + "Description": { + "type": "string", + "nullable": false, + "example": "This is a mount that's used by the plugin." + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Source": { + "type": "string", + "example": "/var/lib/docker/plugins/" + }, + "Destination": { + "type": "string", + "nullable": false, + "example": "/mnt/state" + }, + "Type": { + "type": "string", + "nullable": false, + "example": "bind" + }, + "Options": { + "type": "array", + "example": [ + "rbind", + "rw" + ], + "items": { + "type": "string" + } + } + }, + "nullable": false, + "x-nullable": false + } + }, + "Env": { + "type": "array", + "example": [ + "DEBUG=0" + ], + "items": { + "type": "string" + } + }, + "Args": { + "type": "array", + "items": { + "type": "string" + } + }, + "Devices": { + "type": "array", + "items": { + "required": [ + "Description", + "Name", + "Path", + "Settable" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false + }, + "Description": { + "type": "string", + "nullable": false + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Path": { + "type": "string", + "example": "/dev/fuse" + } + }, + "nullable": false, + "x-nullable": false + } + } + }, + "description": "Settings that can be modified by users.", + "nullable": false + }, + "PluginReference": { + "type": "string", + "description": "plugin remote reference used to push/pull the plugin", + "nullable": false, + "example": "localhost:5000/tiborvass/sample-volume-plugin:latest" + }, + "Config": { + "required": [ + "Args", + "Description", + "Documentation", + "Entrypoint", + "Env", + "Interface", + "IpcHost", + "Linux", + "Mounts", + "Network", + "PidHost", + "PropagatedMount", + "WorkDir" + ], + "type": "object", + "properties": { + "DockerVersion": { + "type": "string", + "description": "Docker Version used to create the plugin", + "nullable": false, + "example": "17.06.0-ce" + }, + "Description": { + "type": "string", + "nullable": false, + "example": "A sample volume plugin for Docker" + }, + "Documentation": { + "type": "string", + "nullable": false, + "example": "https://docs.docker.com/engine/extend/plugins/" + }, + "Interface": { + "required": [ + "Socket", + "Types" + ], + "type": "object", + "properties": { + "Types": { + "type": "array", + "example": [ + "docker.volumedriver/1.0" + ], + "items": { + "required": [ + "Capability", + "Prefix", + "Version" + ], + "type": "object", + "properties": { + "Prefix": { + "type": "string", + "nullable": false + }, + "Capability": { + "type": "string", + "nullable": false + }, + "Version": { + "type": "string", + "nullable": false + } + }, + "nullable": false, + "x-nullable": false + } + }, + "Socket": { + "type": "string", + "nullable": false, + "example": "plugins.sock" + }, + "ProtocolScheme": { + "type": "string", + "description": "Protocol to use for clients connecting to the plugin.", + "example": "some.protocol/v1.0", + "enum": [ + "", + "moby.plugins.http/v1" + ] + } + }, + "description": "The interface between Docker and the plugin", + "nullable": false + }, + "Entrypoint": { + "type": "array", + "example": [ + "/usr/bin/sample-volume-plugin", + "/data" + ], + "items": { + "type": "string" + } + }, + "WorkDir": { + "type": "string", + "nullable": false, + "example": "/bin/" + }, + "User": { + "type": "object", + "properties": { + "UID": { + "type": "integer", + "format": "uint32", + "example": 1000 + }, + "GID": { + "type": "integer", + "format": "uint32", + "example": 1000 + } + }, + "nullable": false + }, + "Network": { + "required": [ + "Type" + ], + "type": "object", + "properties": { + "Type": { + "type": "string", + "nullable": false, + "example": "host" + } + }, + "nullable": false + }, + "Linux": { + "required": [ + "AllowAllDevices", + "Capabilities", + "Devices" + ], + "type": "object", + "properties": { + "Capabilities": { + "type": "array", + "example": [ + "CAP_SYS_ADMIN", + "CAP_SYSLOG" + ], + "items": { + "type": "string" + } + }, + "AllowAllDevices": { + "type": "boolean", + "nullable": false, + "example": false + }, + "Devices": { + "type": "array", + "items": { + "required": [ + "Description", + "Name", + "Path", + "Settable" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false + }, + "Description": { + "type": "string", + "nullable": false + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Path": { + "type": "string", + "example": "/dev/fuse" + } + }, + "nullable": false, + "x-nullable": false + } + } + }, + "nullable": false + }, + "PropagatedMount": { + "type": "string", + "nullable": false, + "example": "/mnt/volumes" + }, + "IpcHost": { + "type": "boolean", + "nullable": false, + "example": false + }, + "PidHost": { + "type": "boolean", + "nullable": false, + "example": false + }, + "Mounts": { + "type": "array", + "items": { + "required": [ + "Description", + "Destination", + "Name", + "Options", + "Settable", + "Source", + "Type" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false, + "example": "some-mount" + }, + "Description": { + "type": "string", + "nullable": false, + "example": "This is a mount that's used by the plugin." + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Source": { + "type": "string", + "example": "/var/lib/docker/plugins/" + }, + "Destination": { + "type": "string", + "nullable": false, + "example": "/mnt/state" + }, + "Type": { + "type": "string", + "nullable": false, + "example": "bind" + }, + "Options": { + "type": "array", + "example": [ + "rbind", + "rw" + ], + "items": { + "type": "string" + } + } + }, + "nullable": false, + "x-nullable": false + } + }, + "Env": { + "type": "array", + "example": [ + { + "Name": "DEBUG", + "Description": "If set, prints debug messages", + "Value": "0" + } + ], + "items": { + "required": [ + "Description", + "Name", + "Settable", + "Value" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false + }, + "Description": { + "type": "string", + "nullable": false + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Value": { + "type": "string" + } + }, + "nullable": false, + "x-nullable": false + } + }, + "Args": { + "required": [ + "Description", + "Name", + "Settable", + "Value" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false, + "example": "args" + }, + "Description": { + "type": "string", + "nullable": false, + "example": "command line arguments" + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Value": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "nullable": false + }, + "rootfs": { + "type": "object", + "properties": { + "type": { + "type": "string", + "example": "layers" + }, + "diff_ids": { + "type": "array", + "example": [ + "sha256:675532206fbf3030b8458f88d6e26d4eb1577688a25efec97154c94e8b6b4887", + "sha256:e216a057b1cb1efc11f8a268f37ef62083e70b1b38323ba252e25ac88904a7e8" + ], + "items": { + "type": "string" + } + } + } + } + }, + "description": "The config of a plugin.", + "nullable": false + } + }, + "description": "A plugin for the Engine API" + } + } + } + }, + "404": { + "description": "plugin is not installed", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/plugins/{name}/enable": { + "post": { + "tags": [ + "Plugin" + ], + "summary": "Enable a plugin", + "operationId": "PluginEnable", + "parameters": [ + { + "name": "name", + "in": "path", + "description": "The name of the plugin. The `:latest` tag is optional, and is the\ndefault if omitted.\n", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "timeout", + "in": "query", + "description": "Set the HTTP client timeout (in seconds)", + "schema": { + "type": "integer", + "default": 0 + } + } + ], + "responses": { + "200": { + "description": "no error", + "content": {} + }, + "404": { + "description": "plugin is not installed", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/plugins/{name}/disable": { + "post": { + "tags": [ + "Plugin" + ], + "summary": "Disable a plugin", + "operationId": "PluginDisable", + "parameters": [ + { + "name": "name", + "in": "path", + "description": "The name of the plugin. The `:latest` tag is optional, and is the\ndefault if omitted.\n", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "force", + "in": "query", + "description": "Force disable a plugin even if still in use.\n", + "schema": { + "type": "boolean" + } + } + ], + "responses": { + "200": { + "description": "no error", + "content": {} + }, + "404": { + "description": "plugin is not installed", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/plugins/{name}/upgrade": { + "post": { + "tags": [ + "Plugin" + ], + "summary": "Upgrade a plugin", + "operationId": "PluginUpgrade", + "parameters": [ + { + "name": "name", + "in": "path", + "description": "The name of the plugin. The `:latest` tag is optional, and is the\ndefault if omitted.\n", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "remote", + "in": "query", + "description": "Remote reference to upgrade to.\n\nThe `:latest` tag is optional, and is used as the default if omitted.\n", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "X-Registry-Auth", + "in": "header", + "description": "A base64url-encoded auth configuration to use when pulling a plugin\nfrom a registry.\n\nRefer to the [authentication section](#section/Authentication) for\ndetails.\n", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "array", + "example": [ + { + "Name": "network", + "Description": "", + "Value": [ + "host" + ] + }, + { + "Name": "mount", + "Description": "", + "Value": [ + "/data" + ] + }, + { + "Name": "device", + "Description": "", + "Value": [ + "/dev/cpu_dma_latency" + ] + } + ], + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "example": "network" + }, + "Description": { + "type": "string" + }, + "Value": { + "type": "array", + "example": [ + "host" + ], + "items": { + "type": "string" + } + } + }, + "description": "Describes a permission the user has to accept upon installing\nthe plugin.\n", + "x-go-name": "PluginPrivilege" + } + } + }, + "text/plain": { + "schema": { + "type": "array", + "example": [ + { + "Name": "network", + "Description": "", + "Value": [ + "host" + ] + }, + { + "Name": "mount", + "Description": "", + "Value": [ + "/data" + ] + }, + { + "Name": "device", + "Description": "", + "Value": [ + "/dev/cpu_dma_latency" + ] + } + ], + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "example": "network" + }, + "Description": { + "type": "string" + }, + "Value": { + "type": "array", + "example": [ + "host" + ], + "items": { + "type": "string" + } + } + }, + "description": "Describes a permission the user has to accept upon installing\nthe plugin.\n", + "x-go-name": "PluginPrivilege" + } + } + } + }, + "required": false + }, + "responses": { + "204": { + "description": "no error", + "content": {} + }, + "404": { + "description": "plugin not installed", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + }, + "x-codegen-request-body-name": "body" + } + }, + "/plugins/create": { + "post": { + "tags": [ + "Plugin" + ], + "summary": "Create a plugin", + "operationId": "PluginCreate", + "parameters": [ + { + "name": "name", + "in": "query", + "description": "The name of the plugin. The `:latest` tag is optional, and is the\ndefault if omitted.\n", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "Path to tar containing plugin rootfs and manifest", + "content": { + "application/x-tar": { + "schema": { + "type": "string", + "format": "binary" + } + } + }, + "required": false + }, + "responses": { + "204": { + "description": "no error", + "content": {} + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + }, + "x-codegen-request-body-name": "tarContext" + } + }, + "/plugins/{name}/push": { + "post": { + "tags": [ + "Plugin" + ], + "summary": "Push a plugin", + "description": "Push a plugin to the registry.\n", + "operationId": "PluginPush", + "parameters": [ + { + "name": "name", + "in": "path", + "description": "The name of the plugin. The `:latest` tag is optional, and is the\ndefault if omitted.\n", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "no error", + "content": {} + }, + "404": { + "description": "plugin not installed", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/plugins/{name}/set": { + "post": { + "tags": [ + "Plugin" + ], + "summary": "Configure a plugin", + "operationId": "PluginSet", + "parameters": [ + { + "name": "name", + "in": "path", + "description": "The name of the plugin. The `:latest` tag is optional, and is the\ndefault if omitted.\n", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "array", + "example": [ + "DEBUG=1" + ], + "items": { + "type": "string" + } + } + } + }, + "required": false + }, + "responses": { + "204": { + "description": "No error", + "content": {} + }, + "404": { + "description": "Plugin not installed", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "Server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + }, + "x-codegen-request-body-name": "body" + } + }, + "/nodes": { + "get": { + "tags": [ + "Node" + ], + "summary": "List nodes", + "operationId": "NodeList", + "parameters": [ + { + "name": "filters", + "in": "query", + "description": "Filters to process on the nodes list, encoded as JSON (a `map[string][]string`).\n\nAvailable filters:\n- `id=`\n- `label=`\n- `membership=`(`accepted`|`pending`)`\n- `name=`\n- `node.label=`\n- `role=`(`manager`|`worker`)`\n", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "no error", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "example": "24ifsmvkjbyhk" + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "description": "Date and time at which the node was added to the swarm in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2016-08-18T10:44:24.496525531Z" + }, + "UpdatedAt": { + "type": "string", + "description": "Date and time at which the node was last updated in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2017-08-09T07:09:37.632105588Z" + }, + "Spec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name for the node.", + "example": "my-node" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "Role": { + "type": "string", + "description": "Role of the node.", + "example": "manager", + "enum": [ + "worker", + "manager" + ] + }, + "Availability": { + "type": "string", + "description": "Availability of the node.", + "example": "active", + "enum": [ + "active", + "pause", + "drain" + ] + } + }, + "example": { + "Availability": "active", + "Name": "node-name", + "Role": "manager", + "Labels": { + "foo": "bar" + } + } + }, + "Description": { + "type": "object", + "properties": { + "Hostname": { + "type": "string", + "example": "bf3067039e47" + }, + "Platform": { + "type": "object", + "properties": { + "Architecture": { + "type": "string", + "description": "Architecture represents the hardware architecture (for example,\n`x86_64`).\n", + "example": "x86_64" + }, + "OS": { + "type": "string", + "description": "OS represents the Operating System (for example, `linux` or `windows`).\n", + "example": "linux" + } + }, + "description": "Platform represents the platform (Arch/OS).\n" + }, + "Resources": { + "type": "object", + "properties": { + "NanoCPUs": { + "type": "integer", + "format": "int64", + "example": 4000000000 + }, + "MemoryBytes": { + "type": "integer", + "format": "int64", + "example": 8272408576 + }, + "GenericResources": { + "type": "array", + "description": "User-defined resources can be either Integer resources (e.g, `SSD=3`) or\nString resources (e.g, `GPU=UUID1`).\n", + "example": [ + { + "DiscreteResourceSpec": { + "Kind": "SSD", + "Value": 3 + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID1" + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID2" + } + } + ], + "items": { + "type": "object", + "properties": { + "NamedResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + }, + "DiscreteResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "integer", + "format": "int64" + } + } + } + } + } + } + }, + "description": "An object describing the resources which can be advertised by a node and\nrequested by a task.\n" + }, + "Engine": { + "type": "object", + "properties": { + "EngineVersion": { + "type": "string", + "example": "17.06.0" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "example": { + "foo": "bar" + } + }, + "Plugins": { + "type": "array", + "example": [ + { + "Type": "Log", + "Name": "awslogs" + }, + { + "Type": "Log", + "Name": "fluentd" + }, + { + "Type": "Log", + "Name": "gcplogs" + }, + { + "Type": "Log", + "Name": "gelf" + }, + { + "Type": "Log", + "Name": "journald" + }, + { + "Type": "Log", + "Name": "json-file" + }, + { + "Type": "Log", + "Name": "splunk" + }, + { + "Type": "Log", + "Name": "syslog" + }, + { + "Type": "Network", + "Name": "bridge" + }, + { + "Type": "Network", + "Name": "host" + }, + { + "Type": "Network", + "Name": "ipvlan" + }, + { + "Type": "Network", + "Name": "macvlan" + }, + { + "Type": "Network", + "Name": "null" + }, + { + "Type": "Network", + "Name": "overlay" + }, + { + "Type": "Volume", + "Name": "local" + }, + { + "Type": "Volume", + "Name": "localhost:5000/vieux/sshfs:latest" + }, + { + "Type": "Volume", + "Name": "vieux/sshfs:latest" + } + ], + "items": { + "type": "object", + "properties": { + "Type": { + "type": "string" + }, + "Name": { + "type": "string" + } + } + } + } + }, + "description": "EngineDescription provides information about an engine." + }, + "TLSInfo": { + "type": "object", + "properties": { + "TrustRoot": { + "type": "string", + "description": "The root CA certificate(s) that are used to validate leaf TLS\ncertificates.\n" + }, + "CertIssuerSubject": { + "type": "string", + "description": "The base64-url-safe-encoded raw subject bytes of the issuer." + }, + "CertIssuerPublicKey": { + "type": "string", + "description": "The base64-url-safe-encoded raw public key bytes of the issuer.\n" + } + }, + "description": "Information about the issuer of leaf TLS certificates and the trusted root\nCA certificate.\n", + "example": { + "TrustRoot": "-----BEGIN CERTIFICATE-----\nMIIBajCCARCgAwIBAgIUbYqrLSOSQHoxD8CwG6Bi2PJi9c8wCgYIKoZIzj0EAwIw\nEzERMA8GA1UEAxMIc3dhcm0tY2EwHhcNMTcwNDI0MjE0MzAwWhcNMzcwNDE5MjE0\nMzAwWjATMREwDwYDVQQDEwhzd2FybS1jYTBZMBMGByqGSM49AgEGCCqGSM49AwEH\nA0IABJk/VyMPYdaqDXJb/VXh5n/1Yuv7iNrxV3Qb3l06XD46seovcDWs3IZNV1lf\n3Skyr0ofcchipoiHkXBODojJydSjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMB\nAf8EBTADAQH/MB0GA1UdDgQWBBRUXxuRcnFjDfR/RIAUQab8ZV/n4jAKBggqhkjO\nPQQDAgNIADBFAiAy+JTe6Uc3KyLCMiqGl2GyWGQqQDEcO3/YG36x7om65AIhAJvz\npxv6zFeVEkAEEkqIYi0omA9+CjanB/6Bz4n1uw8H\n-----END CERTIFICATE-----\n", + "CertIssuerSubject": "MBMxETAPBgNVBAMTCHN3YXJtLWNh", + "CertIssuerPublicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEmT9XIw9h1qoNclv9VeHmf/Vi6/uI2vFXdBveXTpcPjqx6i9wNazchk1XWV/dKTKvSh9xyGKmiIeRcE4OiMnJ1A==" + } + } + }, + "description": "NodeDescription encapsulates the properties of the Node as reported by the\nagent.\n" + }, + "Status": { + "type": "object", + "properties": { + "State": { + "type": "string", + "description": "NodeState represents the state of a node.", + "example": "ready", + "enum": [ + "unknown", + "down", + "ready", + "disconnected" + ] + }, + "Message": { + "type": "string", + "example": "" + }, + "Addr": { + "type": "string", + "description": "IP address of the node.", + "example": "172.17.0.2" + } + }, + "description": "NodeStatus represents the status of a node.\n\nIt provides the current status of the node, as seen by the manager.\n" + }, + "ManagerStatus": { + "type": "object", + "properties": { + "Leader": { + "type": "boolean", + "example": true, + "default": false + }, + "Reachability": { + "type": "string", + "description": "Reachability represents the reachability of a node.", + "example": "reachable", + "enum": [ + "unknown", + "unreachable", + "reachable" + ] + }, + "Addr": { + "type": "string", + "description": "The IP address and port at which the manager is reachable.\n", + "example": "10.0.0.46:2377" + } + }, + "description": "ManagerStatus represents the status of a manager.\n\nIt provides the current status of a node's manager component, if the node\nis a manager.\n", + "nullable": true, + "x-nullable": true + } + } + } + } + }, + "text/plain": { + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "example": "24ifsmvkjbyhk" + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "description": "Date and time at which the node was added to the swarm in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2016-08-18T10:44:24.496525531Z" + }, + "UpdatedAt": { + "type": "string", + "description": "Date and time at which the node was last updated in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2017-08-09T07:09:37.632105588Z" + }, + "Spec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name for the node.", + "example": "my-node" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "Role": { + "type": "string", + "description": "Role of the node.", + "example": "manager", + "enum": [ + "worker", + "manager" + ] + }, + "Availability": { + "type": "string", + "description": "Availability of the node.", + "example": "active", + "enum": [ + "active", + "pause", + "drain" + ] + } + }, + "example": { + "Availability": "active", + "Name": "node-name", + "Role": "manager", + "Labels": { + "foo": "bar" + } + } + }, + "Description": { + "type": "object", + "properties": { + "Hostname": { + "type": "string", + "example": "bf3067039e47" + }, + "Platform": { + "type": "object", + "properties": { + "Architecture": { + "type": "string", + "description": "Architecture represents the hardware architecture (for example,\n`x86_64`).\n", + "example": "x86_64" + }, + "OS": { + "type": "string", + "description": "OS represents the Operating System (for example, `linux` or `windows`).\n", + "example": "linux" + } + }, + "description": "Platform represents the platform (Arch/OS).\n" + }, + "Resources": { + "type": "object", + "properties": { + "NanoCPUs": { + "type": "integer", + "format": "int64", + "example": 4000000000 + }, + "MemoryBytes": { + "type": "integer", + "format": "int64", + "example": 8272408576 + }, + "GenericResources": { + "type": "array", + "description": "User-defined resources can be either Integer resources (e.g, `SSD=3`) or\nString resources (e.g, `GPU=UUID1`).\n", + "example": [ + { + "DiscreteResourceSpec": { + "Kind": "SSD", + "Value": 3 + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID1" + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID2" + } + } + ], + "items": { + "type": "object", + "properties": { + "NamedResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + }, + "DiscreteResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "integer", + "format": "int64" + } + } + } + } + } + } + }, + "description": "An object describing the resources which can be advertised by a node and\nrequested by a task.\n" + }, + "Engine": { + "type": "object", + "properties": { + "EngineVersion": { + "type": "string", + "example": "17.06.0" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "example": { + "foo": "bar" + } + }, + "Plugins": { + "type": "array", + "example": [ + { + "Type": "Log", + "Name": "awslogs" + }, + { + "Type": "Log", + "Name": "fluentd" + }, + { + "Type": "Log", + "Name": "gcplogs" + }, + { + "Type": "Log", + "Name": "gelf" + }, + { + "Type": "Log", + "Name": "journald" + }, + { + "Type": "Log", + "Name": "json-file" + }, + { + "Type": "Log", + "Name": "splunk" + }, + { + "Type": "Log", + "Name": "syslog" + }, + { + "Type": "Network", + "Name": "bridge" + }, + { + "Type": "Network", + "Name": "host" + }, + { + "Type": "Network", + "Name": "ipvlan" + }, + { + "Type": "Network", + "Name": "macvlan" + }, + { + "Type": "Network", + "Name": "null" + }, + { + "Type": "Network", + "Name": "overlay" + }, + { + "Type": "Volume", + "Name": "local" + }, + { + "Type": "Volume", + "Name": "localhost:5000/vieux/sshfs:latest" + }, + { + "Type": "Volume", + "Name": "vieux/sshfs:latest" + } + ], + "items": { + "type": "object", + "properties": { + "Type": { + "type": "string" + }, + "Name": { + "type": "string" + } + } + } + } + }, + "description": "EngineDescription provides information about an engine." + }, + "TLSInfo": { + "type": "object", + "properties": { + "TrustRoot": { + "type": "string", + "description": "The root CA certificate(s) that are used to validate leaf TLS\ncertificates.\n" + }, + "CertIssuerSubject": { + "type": "string", + "description": "The base64-url-safe-encoded raw subject bytes of the issuer." + }, + "CertIssuerPublicKey": { + "type": "string", + "description": "The base64-url-safe-encoded raw public key bytes of the issuer.\n" + } + }, + "description": "Information about the issuer of leaf TLS certificates and the trusted root\nCA certificate.\n", + "example": { + "TrustRoot": "-----BEGIN CERTIFICATE-----\nMIIBajCCARCgAwIBAgIUbYqrLSOSQHoxD8CwG6Bi2PJi9c8wCgYIKoZIzj0EAwIw\nEzERMA8GA1UEAxMIc3dhcm0tY2EwHhcNMTcwNDI0MjE0MzAwWhcNMzcwNDE5MjE0\nMzAwWjATMREwDwYDVQQDEwhzd2FybS1jYTBZMBMGByqGSM49AgEGCCqGSM49AwEH\nA0IABJk/VyMPYdaqDXJb/VXh5n/1Yuv7iNrxV3Qb3l06XD46seovcDWs3IZNV1lf\n3Skyr0ofcchipoiHkXBODojJydSjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMB\nAf8EBTADAQH/MB0GA1UdDgQWBBRUXxuRcnFjDfR/RIAUQab8ZV/n4jAKBggqhkjO\nPQQDAgNIADBFAiAy+JTe6Uc3KyLCMiqGl2GyWGQqQDEcO3/YG36x7om65AIhAJvz\npxv6zFeVEkAEEkqIYi0omA9+CjanB/6Bz4n1uw8H\n-----END CERTIFICATE-----\n", + "CertIssuerSubject": "MBMxETAPBgNVBAMTCHN3YXJtLWNh", + "CertIssuerPublicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEmT9XIw9h1qoNclv9VeHmf/Vi6/uI2vFXdBveXTpcPjqx6i9wNazchk1XWV/dKTKvSh9xyGKmiIeRcE4OiMnJ1A==" + } + } + }, + "description": "NodeDescription encapsulates the properties of the Node as reported by the\nagent.\n" + }, + "Status": { + "type": "object", + "properties": { + "State": { + "type": "string", + "description": "NodeState represents the state of a node.", + "example": "ready", + "enum": [ + "unknown", + "down", + "ready", + "disconnected" + ] + }, + "Message": { + "type": "string", + "example": "" + }, + "Addr": { + "type": "string", + "description": "IP address of the node.", + "example": "172.17.0.2" + } + }, + "description": "NodeStatus represents the status of a node.\n\nIt provides the current status of the node, as seen by the manager.\n" + }, + "ManagerStatus": { + "type": "object", + "properties": { + "Leader": { + "type": "boolean", + "example": true, + "default": false + }, + "Reachability": { + "type": "string", + "description": "Reachability represents the reachability of a node.", + "example": "reachable", + "enum": [ + "unknown", + "unreachable", + "reachable" + ] + }, + "Addr": { + "type": "string", + "description": "The IP address and port at which the manager is reachable.\n", + "example": "10.0.0.46:2377" + } + }, + "description": "ManagerStatus represents the status of a manager.\n\nIt provides the current status of a node's manager component, if the node\nis a manager.\n", + "nullable": true, + "x-nullable": true + } + } + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "503": { + "description": "node is not part of a swarm", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/nodes/{id}": { + "get": { + "tags": [ + "Node" + ], + "summary": "Inspect a node", + "operationId": "NodeInspect", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The ID or name of the node", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "no error", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "example": "24ifsmvkjbyhk" + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "description": "Date and time at which the node was added to the swarm in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2016-08-18T10:44:24.496525531Z" + }, + "UpdatedAt": { + "type": "string", + "description": "Date and time at which the node was last updated in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2017-08-09T07:09:37.632105588Z" + }, + "Spec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name for the node.", + "example": "my-node" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "Role": { + "type": "string", + "description": "Role of the node.", + "example": "manager", + "enum": [ + "worker", + "manager" + ] + }, + "Availability": { + "type": "string", + "description": "Availability of the node.", + "example": "active", + "enum": [ + "active", + "pause", + "drain" + ] + } + }, + "example": { + "Availability": "active", + "Name": "node-name", + "Role": "manager", + "Labels": { + "foo": "bar" + } + } + }, + "Description": { + "type": "object", + "properties": { + "Hostname": { + "type": "string", + "example": "bf3067039e47" + }, + "Platform": { + "type": "object", + "properties": { + "Architecture": { + "type": "string", + "description": "Architecture represents the hardware architecture (for example,\n`x86_64`).\n", + "example": "x86_64" + }, + "OS": { + "type": "string", + "description": "OS represents the Operating System (for example, `linux` or `windows`).\n", + "example": "linux" + } + }, + "description": "Platform represents the platform (Arch/OS).\n" + }, + "Resources": { + "type": "object", + "properties": { + "NanoCPUs": { + "type": "integer", + "format": "int64", + "example": 4000000000 + }, + "MemoryBytes": { + "type": "integer", + "format": "int64", + "example": 8272408576 + }, + "GenericResources": { + "type": "array", + "description": "User-defined resources can be either Integer resources (e.g, `SSD=3`) or\nString resources (e.g, `GPU=UUID1`).\n", + "example": [ + { + "DiscreteResourceSpec": { + "Kind": "SSD", + "Value": 3 + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID1" + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID2" + } + } + ], + "items": { + "type": "object", + "properties": { + "NamedResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + }, + "DiscreteResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "integer", + "format": "int64" + } + } + } + } + } + } + }, + "description": "An object describing the resources which can be advertised by a node and\nrequested by a task.\n" + }, + "Engine": { + "type": "object", + "properties": { + "EngineVersion": { + "type": "string", + "example": "17.06.0" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "example": { + "foo": "bar" + } + }, + "Plugins": { + "type": "array", + "example": [ + { + "Type": "Log", + "Name": "awslogs" + }, + { + "Type": "Log", + "Name": "fluentd" + }, + { + "Type": "Log", + "Name": "gcplogs" + }, + { + "Type": "Log", + "Name": "gelf" + }, + { + "Type": "Log", + "Name": "journald" + }, + { + "Type": "Log", + "Name": "json-file" + }, + { + "Type": "Log", + "Name": "splunk" + }, + { + "Type": "Log", + "Name": "syslog" + }, + { + "Type": "Network", + "Name": "bridge" + }, + { + "Type": "Network", + "Name": "host" + }, + { + "Type": "Network", + "Name": "ipvlan" + }, + { + "Type": "Network", + "Name": "macvlan" + }, + { + "Type": "Network", + "Name": "null" + }, + { + "Type": "Network", + "Name": "overlay" + }, + { + "Type": "Volume", + "Name": "local" + }, + { + "Type": "Volume", + "Name": "localhost:5000/vieux/sshfs:latest" + }, + { + "Type": "Volume", + "Name": "vieux/sshfs:latest" + } + ], + "items": { + "type": "object", + "properties": { + "Type": { + "type": "string" + }, + "Name": { + "type": "string" + } + } + } + } + }, + "description": "EngineDescription provides information about an engine." + }, + "TLSInfo": { + "type": "object", + "properties": { + "TrustRoot": { + "type": "string", + "description": "The root CA certificate(s) that are used to validate leaf TLS\ncertificates.\n" + }, + "CertIssuerSubject": { + "type": "string", + "description": "The base64-url-safe-encoded raw subject bytes of the issuer." + }, + "CertIssuerPublicKey": { + "type": "string", + "description": "The base64-url-safe-encoded raw public key bytes of the issuer.\n" + } + }, + "description": "Information about the issuer of leaf TLS certificates and the trusted root\nCA certificate.\n", + "example": { + "TrustRoot": "-----BEGIN CERTIFICATE-----\nMIIBajCCARCgAwIBAgIUbYqrLSOSQHoxD8CwG6Bi2PJi9c8wCgYIKoZIzj0EAwIw\nEzERMA8GA1UEAxMIc3dhcm0tY2EwHhcNMTcwNDI0MjE0MzAwWhcNMzcwNDE5MjE0\nMzAwWjATMREwDwYDVQQDEwhzd2FybS1jYTBZMBMGByqGSM49AgEGCCqGSM49AwEH\nA0IABJk/VyMPYdaqDXJb/VXh5n/1Yuv7iNrxV3Qb3l06XD46seovcDWs3IZNV1lf\n3Skyr0ofcchipoiHkXBODojJydSjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMB\nAf8EBTADAQH/MB0GA1UdDgQWBBRUXxuRcnFjDfR/RIAUQab8ZV/n4jAKBggqhkjO\nPQQDAgNIADBFAiAy+JTe6Uc3KyLCMiqGl2GyWGQqQDEcO3/YG36x7om65AIhAJvz\npxv6zFeVEkAEEkqIYi0omA9+CjanB/6Bz4n1uw8H\n-----END CERTIFICATE-----\n", + "CertIssuerSubject": "MBMxETAPBgNVBAMTCHN3YXJtLWNh", + "CertIssuerPublicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEmT9XIw9h1qoNclv9VeHmf/Vi6/uI2vFXdBveXTpcPjqx6i9wNazchk1XWV/dKTKvSh9xyGKmiIeRcE4OiMnJ1A==" + } + } + }, + "description": "NodeDescription encapsulates the properties of the Node as reported by the\nagent.\n" + }, + "Status": { + "type": "object", + "properties": { + "State": { + "type": "string", + "description": "NodeState represents the state of a node.", + "example": "ready", + "enum": [ + "unknown", + "down", + "ready", + "disconnected" + ] + }, + "Message": { + "type": "string", + "example": "" + }, + "Addr": { + "type": "string", + "description": "IP address of the node.", + "example": "172.17.0.2" + } + }, + "description": "NodeStatus represents the status of a node.\n\nIt provides the current status of the node, as seen by the manager.\n" + }, + "ManagerStatus": { + "type": "object", + "properties": { + "Leader": { + "type": "boolean", + "example": true, + "default": false + }, + "Reachability": { + "type": "string", + "description": "Reachability represents the reachability of a node.", + "example": "reachable", + "enum": [ + "unknown", + "unreachable", + "reachable" + ] + }, + "Addr": { + "type": "string", + "description": "The IP address and port at which the manager is reachable.\n", + "example": "10.0.0.46:2377" + } + }, + "description": "ManagerStatus represents the status of a manager.\n\nIt provides the current status of a node's manager component, if the node\nis a manager.\n", + "nullable": true, + "x-nullable": true + } + } + } + }, + "text/plain": { + "schema": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "example": "24ifsmvkjbyhk" + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "description": "Date and time at which the node was added to the swarm in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2016-08-18T10:44:24.496525531Z" + }, + "UpdatedAt": { + "type": "string", + "description": "Date and time at which the node was last updated in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2017-08-09T07:09:37.632105588Z" + }, + "Spec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name for the node.", + "example": "my-node" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "Role": { + "type": "string", + "description": "Role of the node.", + "example": "manager", + "enum": [ + "worker", + "manager" + ] + }, + "Availability": { + "type": "string", + "description": "Availability of the node.", + "example": "active", + "enum": [ + "active", + "pause", + "drain" + ] + } + }, + "example": { + "Availability": "active", + "Name": "node-name", + "Role": "manager", + "Labels": { + "foo": "bar" + } + } + }, + "Description": { + "type": "object", + "properties": { + "Hostname": { + "type": "string", + "example": "bf3067039e47" + }, + "Platform": { + "type": "object", + "properties": { + "Architecture": { + "type": "string", + "description": "Architecture represents the hardware architecture (for example,\n`x86_64`).\n", + "example": "x86_64" + }, + "OS": { + "type": "string", + "description": "OS represents the Operating System (for example, `linux` or `windows`).\n", + "example": "linux" + } + }, + "description": "Platform represents the platform (Arch/OS).\n" + }, + "Resources": { + "type": "object", + "properties": { + "NanoCPUs": { + "type": "integer", + "format": "int64", + "example": 4000000000 + }, + "MemoryBytes": { + "type": "integer", + "format": "int64", + "example": 8272408576 + }, + "GenericResources": { + "type": "array", + "description": "User-defined resources can be either Integer resources (e.g, `SSD=3`) or\nString resources (e.g, `GPU=UUID1`).\n", + "example": [ + { + "DiscreteResourceSpec": { + "Kind": "SSD", + "Value": 3 + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID1" + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID2" + } + } + ], + "items": { + "type": "object", + "properties": { + "NamedResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + }, + "DiscreteResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "integer", + "format": "int64" + } + } + } + } + } + } + }, + "description": "An object describing the resources which can be advertised by a node and\nrequested by a task.\n" + }, + "Engine": { + "type": "object", + "properties": { + "EngineVersion": { + "type": "string", + "example": "17.06.0" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "example": { + "foo": "bar" + } + }, + "Plugins": { + "type": "array", + "example": [ + { + "Type": "Log", + "Name": "awslogs" + }, + { + "Type": "Log", + "Name": "fluentd" + }, + { + "Type": "Log", + "Name": "gcplogs" + }, + { + "Type": "Log", + "Name": "gelf" + }, + { + "Type": "Log", + "Name": "journald" + }, + { + "Type": "Log", + "Name": "json-file" + }, + { + "Type": "Log", + "Name": "splunk" + }, + { + "Type": "Log", + "Name": "syslog" + }, + { + "Type": "Network", + "Name": "bridge" + }, + { + "Type": "Network", + "Name": "host" + }, + { + "Type": "Network", + "Name": "ipvlan" + }, + { + "Type": "Network", + "Name": "macvlan" + }, + { + "Type": "Network", + "Name": "null" + }, + { + "Type": "Network", + "Name": "overlay" + }, + { + "Type": "Volume", + "Name": "local" + }, + { + "Type": "Volume", + "Name": "localhost:5000/vieux/sshfs:latest" + }, + { + "Type": "Volume", + "Name": "vieux/sshfs:latest" + } + ], + "items": { + "type": "object", + "properties": { + "Type": { + "type": "string" + }, + "Name": { + "type": "string" + } + } + } + } + }, + "description": "EngineDescription provides information about an engine." + }, + "TLSInfo": { + "type": "object", + "properties": { + "TrustRoot": { + "type": "string", + "description": "The root CA certificate(s) that are used to validate leaf TLS\ncertificates.\n" + }, + "CertIssuerSubject": { + "type": "string", + "description": "The base64-url-safe-encoded raw subject bytes of the issuer." + }, + "CertIssuerPublicKey": { + "type": "string", + "description": "The base64-url-safe-encoded raw public key bytes of the issuer.\n" + } + }, + "description": "Information about the issuer of leaf TLS certificates and the trusted root\nCA certificate.\n", + "example": { + "TrustRoot": "-----BEGIN CERTIFICATE-----\nMIIBajCCARCgAwIBAgIUbYqrLSOSQHoxD8CwG6Bi2PJi9c8wCgYIKoZIzj0EAwIw\nEzERMA8GA1UEAxMIc3dhcm0tY2EwHhcNMTcwNDI0MjE0MzAwWhcNMzcwNDE5MjE0\nMzAwWjATMREwDwYDVQQDEwhzd2FybS1jYTBZMBMGByqGSM49AgEGCCqGSM49AwEH\nA0IABJk/VyMPYdaqDXJb/VXh5n/1Yuv7iNrxV3Qb3l06XD46seovcDWs3IZNV1lf\n3Skyr0ofcchipoiHkXBODojJydSjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMB\nAf8EBTADAQH/MB0GA1UdDgQWBBRUXxuRcnFjDfR/RIAUQab8ZV/n4jAKBggqhkjO\nPQQDAgNIADBFAiAy+JTe6Uc3KyLCMiqGl2GyWGQqQDEcO3/YG36x7om65AIhAJvz\npxv6zFeVEkAEEkqIYi0omA9+CjanB/6Bz4n1uw8H\n-----END CERTIFICATE-----\n", + "CertIssuerSubject": "MBMxETAPBgNVBAMTCHN3YXJtLWNh", + "CertIssuerPublicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEmT9XIw9h1qoNclv9VeHmf/Vi6/uI2vFXdBveXTpcPjqx6i9wNazchk1XWV/dKTKvSh9xyGKmiIeRcE4OiMnJ1A==" + } + } + }, + "description": "NodeDescription encapsulates the properties of the Node as reported by the\nagent.\n" + }, + "Status": { + "type": "object", + "properties": { + "State": { + "type": "string", + "description": "NodeState represents the state of a node.", + "example": "ready", + "enum": [ + "unknown", + "down", + "ready", + "disconnected" + ] + }, + "Message": { + "type": "string", + "example": "" + }, + "Addr": { + "type": "string", + "description": "IP address of the node.", + "example": "172.17.0.2" + } + }, + "description": "NodeStatus represents the status of a node.\n\nIt provides the current status of the node, as seen by the manager.\n" + }, + "ManagerStatus": { + "type": "object", + "properties": { + "Leader": { + "type": "boolean", + "example": true, + "default": false + }, + "Reachability": { + "type": "string", + "description": "Reachability represents the reachability of a node.", + "example": "reachable", + "enum": [ + "unknown", + "unreachable", + "reachable" + ] + }, + "Addr": { + "type": "string", + "description": "The IP address and port at which the manager is reachable.\n", + "example": "10.0.0.46:2377" + } + }, + "description": "ManagerStatus represents the status of a manager.\n\nIt provides the current status of a node's manager component, if the node\nis a manager.\n", + "nullable": true, + "x-nullable": true + } + } + } + } + } + }, + "404": { + "description": "no such node", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "503": { + "description": "node is not part of a swarm", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + }, + "delete": { + "tags": [ + "Node" + ], + "summary": "Delete a node", + "operationId": "NodeDelete", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The ID or name of the node", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "force", + "in": "query", + "description": "Force remove a node from the swarm", + "schema": { + "type": "boolean", + "default": false + } + } + ], + "responses": { + "200": { + "description": "no error", + "content": {} + }, + "404": { + "description": "no such node", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "503": { + "description": "node is not part of a swarm", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/nodes/{id}/update": { + "post": { + "tags": [ + "Node" + ], + "summary": "Update a node", + "operationId": "NodeUpdate", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The ID of the node", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "version", + "in": "query", + "description": "The version number of the node object being updated. This is required\nto avoid conflicting writes.\n", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name for the node.", + "example": "my-node" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "Role": { + "type": "string", + "description": "Role of the node.", + "example": "manager", + "enum": [ + "worker", + "manager" + ] + }, + "Availability": { + "type": "string", + "description": "Availability of the node.", + "example": "active", + "enum": [ + "active", + "pause", + "drain" + ] + } + }, + "example": { + "Availability": "active", + "Name": "node-name", + "Role": "manager", + "Labels": { + "foo": "bar" + } + } + } + }, + "text/plain": { + "schema": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name for the node.", + "example": "my-node" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "Role": { + "type": "string", + "description": "Role of the node.", + "example": "manager", + "enum": [ + "worker", + "manager" + ] + }, + "Availability": { + "type": "string", + "description": "Availability of the node.", + "example": "active", + "enum": [ + "active", + "pause", + "drain" + ] + } + }, + "example": { + "Availability": "active", + "Name": "node-name", + "Role": "manager", + "Labels": { + "foo": "bar" + } + } + } + } + }, + "required": false + }, + "responses": { + "200": { + "description": "no error", + "content": {} + }, + "400": { + "description": "bad parameter", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "404": { + "description": "no such node", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "503": { + "description": "node is not part of a swarm", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + }, + "x-codegen-request-body-name": "body" + } + }, + "/swarm": { + "get": { + "tags": [ + "Swarm" + ], + "summary": "Inspect swarm", + "operationId": "SwarmInspect", + "responses": { + "200": { + "description": "no error", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "The ID of the swarm.", + "example": "abajmipo7b4xz5ip2nrla6b11" + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "description": "Date and time at which the swarm was initialised in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2016-08-18T10:44:24.496525531Z" + }, + "UpdatedAt": { + "type": "string", + "description": "Date and time at which the swarm was last updated in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2017-08-09T07:09:37.632105588Z" + }, + "Spec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the swarm.", + "example": "default" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.corp.type": "production", + "com.example.corp.department": "engineering" + } + }, + "Orchestration": { + "type": "object", + "properties": { + "TaskHistoryRetentionLimit": { + "type": "integer", + "description": "The number of historic tasks to keep per instance or node. If\nnegative, never remove completed or failed tasks.\n", + "format": "int64", + "example": 10 + } + }, + "description": "Orchestration configuration.", + "nullable": true + }, + "Raft": { + "type": "object", + "properties": { + "SnapshotInterval": { + "type": "integer", + "description": "The number of log entries between snapshots.", + "format": "uint64", + "example": 10000 + }, + "KeepOldSnapshots": { + "type": "integer", + "description": "The number of snapshots to keep beyond the current snapshot.\n", + "format": "uint64" + }, + "LogEntriesForSlowFollowers": { + "type": "integer", + "description": "The number of log entries to keep around to sync up slow followers\nafter a snapshot is created.\n", + "format": "uint64", + "example": 500 + }, + "ElectionTick": { + "type": "integer", + "description": "The number of ticks that a follower will wait for a message from\nthe leader before becoming a candidate and starting an election.\n`ElectionTick` must be greater than `HeartbeatTick`.\n\nA tick currently defaults to one second, so these translate\ndirectly to seconds currently, but this is NOT guaranteed.\n", + "example": 3 + }, + "HeartbeatTick": { + "type": "integer", + "description": "The number of ticks between heartbeats. Every HeartbeatTick ticks,\nthe leader will send a heartbeat to the followers.\n\nA tick currently defaults to one second, so these translate\ndirectly to seconds currently, but this is NOT guaranteed.\n", + "example": 1 + } + }, + "description": "Raft configuration." + }, + "Dispatcher": { + "type": "object", + "properties": { + "HeartbeatPeriod": { + "type": "integer", + "description": "The delay for an agent to send a heartbeat to the dispatcher.\n", + "format": "int64", + "example": 5000000000 + } + }, + "description": "Dispatcher configuration.", + "nullable": true + }, + "CAConfig": { + "type": "object", + "properties": { + "NodeCertExpiry": { + "type": "integer", + "description": "The duration node certificates are issued for.", + "format": "int64", + "example": 7776000000000000 + }, + "ExternalCAs": { + "type": "array", + "description": "Configuration for forwarding signing requests to an external\ncertificate authority.\n", + "items": { + "type": "object", + "properties": { + "Protocol": { + "type": "string", + "description": "Protocol for communication with the external CA (currently\nonly `cfssl` is supported).\n", + "default": "cfssl", + "enum": [ + "cfssl" + ] + }, + "URL": { + "type": "string", + "description": "URL where certificate signing requests should be sent.\n" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "An object with key/value pairs that are interpreted as\nprotocol-specific options for the external CA driver.\n" + }, + "CACert": { + "type": "string", + "description": "The root CA certificate (in PEM format) this external CA uses\nto issue TLS certificates (assumed to be to the current swarm\nroot CA certificate if not provided).\n" + } + } + } + }, + "SigningCACert": { + "type": "string", + "description": "The desired signing CA certificate for all swarm node TLS leaf\ncertificates, in PEM format.\n" + }, + "SigningCAKey": { + "type": "string", + "description": "The desired signing CA key for all swarm node TLS leaf certificates,\nin PEM format.\n" + }, + "ForceRotate": { + "type": "integer", + "description": "An integer whose purpose is to force swarm to generate a new\nsigning CA certificate and key, if none have been specified in\n`SigningCACert` and `SigningCAKey`\n", + "format": "uint64" + } + }, + "description": "CA configuration.", + "nullable": true + }, + "EncryptionConfig": { + "type": "object", + "properties": { + "AutoLockManagers": { + "type": "boolean", + "description": "If set, generate a key and use it to lock data stored on the\nmanagers.\n", + "example": false + } + }, + "description": "Parameters related to encryption-at-rest." + }, + "TaskDefaults": { + "type": "object", + "properties": { + "LogDriver": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "The log driver to use as a default for new tasks.\n", + "example": "json-file" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver-specific options for the selected log driver, specified\nas key/value pairs.\n", + "example": { + "max-file": "10", + "max-size": "100m" + } + } + }, + "description": "The log driver to use for tasks created in the orchestrator if\nunspecified by a service.\n\nUpdating this value only affects new tasks. Existing tasks continue\nto use their previously configured log driver until recreated.\n" + } + }, + "description": "Defaults for creating tasks in this cluster." + } + }, + "description": "User modifiable swarm configuration." + }, + "TLSInfo": { + "type": "object", + "properties": { + "TrustRoot": { + "type": "string", + "description": "The root CA certificate(s) that are used to validate leaf TLS\ncertificates.\n" + }, + "CertIssuerSubject": { + "type": "string", + "description": "The base64-url-safe-encoded raw subject bytes of the issuer." + }, + "CertIssuerPublicKey": { + "type": "string", + "description": "The base64-url-safe-encoded raw public key bytes of the issuer.\n" + } + }, + "description": "Information about the issuer of leaf TLS certificates and the trusted root\nCA certificate.\n", + "example": { + "TrustRoot": "-----BEGIN CERTIFICATE-----\nMIIBajCCARCgAwIBAgIUbYqrLSOSQHoxD8CwG6Bi2PJi9c8wCgYIKoZIzj0EAwIw\nEzERMA8GA1UEAxMIc3dhcm0tY2EwHhcNMTcwNDI0MjE0MzAwWhcNMzcwNDE5MjE0\nMzAwWjATMREwDwYDVQQDEwhzd2FybS1jYTBZMBMGByqGSM49AgEGCCqGSM49AwEH\nA0IABJk/VyMPYdaqDXJb/VXh5n/1Yuv7iNrxV3Qb3l06XD46seovcDWs3IZNV1lf\n3Skyr0ofcchipoiHkXBODojJydSjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMB\nAf8EBTADAQH/MB0GA1UdDgQWBBRUXxuRcnFjDfR/RIAUQab8ZV/n4jAKBggqhkjO\nPQQDAgNIADBFAiAy+JTe6Uc3KyLCMiqGl2GyWGQqQDEcO3/YG36x7om65AIhAJvz\npxv6zFeVEkAEEkqIYi0omA9+CjanB/6Bz4n1uw8H\n-----END CERTIFICATE-----\n", + "CertIssuerSubject": "MBMxETAPBgNVBAMTCHN3YXJtLWNh", + "CertIssuerPublicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEmT9XIw9h1qoNclv9VeHmf/Vi6/uI2vFXdBveXTpcPjqx6i9wNazchk1XWV/dKTKvSh9xyGKmiIeRcE4OiMnJ1A==" + } + }, + "RootRotationInProgress": { + "type": "boolean", + "description": "Whether there is currently a root CA rotation in progress for the swarm\n", + "example": false + }, + "DataPathPort": { + "type": "integer", + "description": "DataPathPort specifies the data path port number for data traffic.\nAcceptable port range is 1024 to 49151.\nIf no port is set or is set to 0, the default port (4789) is used.\n", + "format": "uint32", + "example": 4789 + }, + "DefaultAddrPool": { + "type": "array", + "description": "Default Address Pool specifies default subnet pools for global scope\nnetworks.\n", + "items": { + "type": "string", + "format": "CIDR", + "example": "" + } + }, + "SubnetSize": { + "maximum": 29, + "type": "integer", + "description": "SubnetSize specifies the subnet size of the networks created from the\ndefault subnet pool.\n", + "format": "uint32", + "example": 24 + } + }, + "description": "ClusterInfo represents information about the swarm as is returned by the\n\"/info\" endpoint. Join-tokens are not included.\n", + "nullable": true, + "x-nullable": true + }, + { + "type": "object", + "properties": { + "JoinTokens": { + "type": "object", + "properties": { + "Worker": { + "type": "string", + "description": "The token workers can use to join the swarm.\n", + "example": "SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-1awxwuwd3z9j1z3puu7rcgdbx" + }, + "Manager": { + "type": "string", + "description": "The token managers can use to join the swarm.\n", + "example": "SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-7p73s1dx5in4tatdymyhg9hu2" + } + }, + "description": "JoinTokens contains the tokens workers and managers need to join the swarm.\n" + } + } + } + ] + } + }, + "text/plain": { + "schema": { + "allOf": [ + { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "The ID of the swarm.", + "example": "abajmipo7b4xz5ip2nrla6b11" + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "description": "Date and time at which the swarm was initialised in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2016-08-18T10:44:24.496525531Z" + }, + "UpdatedAt": { + "type": "string", + "description": "Date and time at which the swarm was last updated in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2017-08-09T07:09:37.632105588Z" + }, + "Spec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the swarm.", + "example": "default" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.corp.type": "production", + "com.example.corp.department": "engineering" + } + }, + "Orchestration": { + "type": "object", + "properties": { + "TaskHistoryRetentionLimit": { + "type": "integer", + "description": "The number of historic tasks to keep per instance or node. If\nnegative, never remove completed or failed tasks.\n", + "format": "int64", + "example": 10 + } + }, + "description": "Orchestration configuration.", + "nullable": true + }, + "Raft": { + "type": "object", + "properties": { + "SnapshotInterval": { + "type": "integer", + "description": "The number of log entries between snapshots.", + "format": "uint64", + "example": 10000 + }, + "KeepOldSnapshots": { + "type": "integer", + "description": "The number of snapshots to keep beyond the current snapshot.\n", + "format": "uint64" + }, + "LogEntriesForSlowFollowers": { + "type": "integer", + "description": "The number of log entries to keep around to sync up slow followers\nafter a snapshot is created.\n", + "format": "uint64", + "example": 500 + }, + "ElectionTick": { + "type": "integer", + "description": "The number of ticks that a follower will wait for a message from\nthe leader before becoming a candidate and starting an election.\n`ElectionTick` must be greater than `HeartbeatTick`.\n\nA tick currently defaults to one second, so these translate\ndirectly to seconds currently, but this is NOT guaranteed.\n", + "example": 3 + }, + "HeartbeatTick": { + "type": "integer", + "description": "The number of ticks between heartbeats. Every HeartbeatTick ticks,\nthe leader will send a heartbeat to the followers.\n\nA tick currently defaults to one second, so these translate\ndirectly to seconds currently, but this is NOT guaranteed.\n", + "example": 1 + } + }, + "description": "Raft configuration." + }, + "Dispatcher": { + "type": "object", + "properties": { + "HeartbeatPeriod": { + "type": "integer", + "description": "The delay for an agent to send a heartbeat to the dispatcher.\n", + "format": "int64", + "example": 5000000000 + } + }, + "description": "Dispatcher configuration.", + "nullable": true + }, + "CAConfig": { + "type": "object", + "properties": { + "NodeCertExpiry": { + "type": "integer", + "description": "The duration node certificates are issued for.", + "format": "int64", + "example": 7776000000000000 + }, + "ExternalCAs": { + "type": "array", + "description": "Configuration for forwarding signing requests to an external\ncertificate authority.\n", + "items": { + "type": "object", + "properties": { + "Protocol": { + "type": "string", + "description": "Protocol for communication with the external CA (currently\nonly `cfssl` is supported).\n", + "default": "cfssl", + "enum": [ + "cfssl" + ] + }, + "URL": { + "type": "string", + "description": "URL where certificate signing requests should be sent.\n" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "An object with key/value pairs that are interpreted as\nprotocol-specific options for the external CA driver.\n" + }, + "CACert": { + "type": "string", + "description": "The root CA certificate (in PEM format) this external CA uses\nto issue TLS certificates (assumed to be to the current swarm\nroot CA certificate if not provided).\n" + } + } + } + }, + "SigningCACert": { + "type": "string", + "description": "The desired signing CA certificate for all swarm node TLS leaf\ncertificates, in PEM format.\n" + }, + "SigningCAKey": { + "type": "string", + "description": "The desired signing CA key for all swarm node TLS leaf certificates,\nin PEM format.\n" + }, + "ForceRotate": { + "type": "integer", + "description": "An integer whose purpose is to force swarm to generate a new\nsigning CA certificate and key, if none have been specified in\n`SigningCACert` and `SigningCAKey`\n", + "format": "uint64" + } + }, + "description": "CA configuration.", + "nullable": true + }, + "EncryptionConfig": { + "type": "object", + "properties": { + "AutoLockManagers": { + "type": "boolean", + "description": "If set, generate a key and use it to lock data stored on the\nmanagers.\n", + "example": false + } + }, + "description": "Parameters related to encryption-at-rest." + }, + "TaskDefaults": { + "type": "object", + "properties": { + "LogDriver": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "The log driver to use as a default for new tasks.\n", + "example": "json-file" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver-specific options for the selected log driver, specified\nas key/value pairs.\n", + "example": { + "max-file": "10", + "max-size": "100m" + } + } + }, + "description": "The log driver to use for tasks created in the orchestrator if\nunspecified by a service.\n\nUpdating this value only affects new tasks. Existing tasks continue\nto use their previously configured log driver until recreated.\n" + } + }, + "description": "Defaults for creating tasks in this cluster." + } + }, + "description": "User modifiable swarm configuration." + }, + "TLSInfo": { + "type": "object", + "properties": { + "TrustRoot": { + "type": "string", + "description": "The root CA certificate(s) that are used to validate leaf TLS\ncertificates.\n" + }, + "CertIssuerSubject": { + "type": "string", + "description": "The base64-url-safe-encoded raw subject bytes of the issuer." + }, + "CertIssuerPublicKey": { + "type": "string", + "description": "The base64-url-safe-encoded raw public key bytes of the issuer.\n" + } + }, + "description": "Information about the issuer of leaf TLS certificates and the trusted root\nCA certificate.\n", + "example": { + "TrustRoot": "-----BEGIN CERTIFICATE-----\nMIIBajCCARCgAwIBAgIUbYqrLSOSQHoxD8CwG6Bi2PJi9c8wCgYIKoZIzj0EAwIw\nEzERMA8GA1UEAxMIc3dhcm0tY2EwHhcNMTcwNDI0MjE0MzAwWhcNMzcwNDE5MjE0\nMzAwWjATMREwDwYDVQQDEwhzd2FybS1jYTBZMBMGByqGSM49AgEGCCqGSM49AwEH\nA0IABJk/VyMPYdaqDXJb/VXh5n/1Yuv7iNrxV3Qb3l06XD46seovcDWs3IZNV1lf\n3Skyr0ofcchipoiHkXBODojJydSjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMB\nAf8EBTADAQH/MB0GA1UdDgQWBBRUXxuRcnFjDfR/RIAUQab8ZV/n4jAKBggqhkjO\nPQQDAgNIADBFAiAy+JTe6Uc3KyLCMiqGl2GyWGQqQDEcO3/YG36x7om65AIhAJvz\npxv6zFeVEkAEEkqIYi0omA9+CjanB/6Bz4n1uw8H\n-----END CERTIFICATE-----\n", + "CertIssuerSubject": "MBMxETAPBgNVBAMTCHN3YXJtLWNh", + "CertIssuerPublicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEmT9XIw9h1qoNclv9VeHmf/Vi6/uI2vFXdBveXTpcPjqx6i9wNazchk1XWV/dKTKvSh9xyGKmiIeRcE4OiMnJ1A==" + } + }, + "RootRotationInProgress": { + "type": "boolean", + "description": "Whether there is currently a root CA rotation in progress for the swarm\n", + "example": false + }, + "DataPathPort": { + "type": "integer", + "description": "DataPathPort specifies the data path port number for data traffic.\nAcceptable port range is 1024 to 49151.\nIf no port is set or is set to 0, the default port (4789) is used.\n", + "format": "uint32", + "example": 4789 + }, + "DefaultAddrPool": { + "type": "array", + "description": "Default Address Pool specifies default subnet pools for global scope\nnetworks.\n", + "items": { + "type": "string", + "format": "CIDR", + "example": "" + } + }, + "SubnetSize": { + "maximum": 29, + "type": "integer", + "description": "SubnetSize specifies the subnet size of the networks created from the\ndefault subnet pool.\n", + "format": "uint32", + "example": 24 + } + }, + "description": "ClusterInfo represents information about the swarm as is returned by the\n\"/info\" endpoint. Join-tokens are not included.\n", + "nullable": true, + "x-nullable": true + }, + { + "type": "object", + "properties": { + "JoinTokens": { + "type": "object", + "properties": { + "Worker": { + "type": "string", + "description": "The token workers can use to join the swarm.\n", + "example": "SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-1awxwuwd3z9j1z3puu7rcgdbx" + }, + "Manager": { + "type": "string", + "description": "The token managers can use to join the swarm.\n", + "example": "SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-7p73s1dx5in4tatdymyhg9hu2" + } + }, + "description": "JoinTokens contains the tokens workers and managers need to join the swarm.\n" + } + } + } + ] + } + } + } + }, + "404": { + "description": "no such swarm", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "503": { + "description": "node is not part of a swarm", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/swarm/init": { + "post": { + "tags": [ + "Swarm" + ], + "summary": "Initialize a new swarm", + "operationId": "SwarmInit", + "requestBody": { + "content": { + "application/json": { + "schema": { + "title": "SwarmInitRequest", + "type": "object", + "properties": { + "ListenAddr": { + "type": "string", + "description": "Listen address used for inter-manager communication, as well\nas determining the networking interface used for the VXLAN\nTunnel Endpoint (VTEP). This can either be an address/port\ncombination in the form `192.168.1.1:4567`, or an interface\nfollowed by a port number, like `eth0:4567`. If the port number\nis omitted, the default swarm listening port is used.\n" + }, + "AdvertiseAddr": { + "type": "string", + "description": "Externally reachable address advertised to other nodes. This\ncan either be an address/port combination in the form\n`192.168.1.1:4567`, or an interface followed by a port number,\nlike `eth0:4567`. If the port number is omitted, the port\nnumber from the listen address is used. If `AdvertiseAddr` is\nnot specified, it will be automatically detected when possible.\n" + }, + "DataPathAddr": { + "type": "string", + "description": "Address or interface to use for data path traffic (format:\n``), for example, `192.168.1.1`, or an interface,\nlike `eth0`. If `DataPathAddr` is unspecified, the same address\nas `AdvertiseAddr` is used.\n\nThe `DataPathAddr` specifies the address that global scope\nnetwork drivers will publish towards other nodes in order to\nreach the containers running on this node. Using this parameter\nit is possible to separate the container data traffic from the\nmanagement traffic of the cluster.\n" + }, + "DataPathPort": { + "type": "integer", + "description": "DataPathPort specifies the data path port number for data traffic.\nAcceptable port range is 1024 to 49151.\nif no port is set or is set to 0, default port 4789 will be used.\n", + "format": "uint32" + }, + "DefaultAddrPool": { + "type": "array", + "description": "Default Address Pool specifies default subnet pools for global\nscope networks.\n", + "items": { + "type": "string", + "example": "" + } + }, + "ForceNewCluster": { + "type": "boolean", + "description": "Force creation of a new swarm." + }, + "SubnetSize": { + "type": "integer", + "description": "SubnetSize specifies the subnet size of the networks created\nfrom the default subnet pool.\n", + "format": "uint32" + }, + "Spec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the swarm.", + "example": "default" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.corp.type": "production", + "com.example.corp.department": "engineering" + } + }, + "Orchestration": { + "type": "object", + "properties": { + "TaskHistoryRetentionLimit": { + "type": "integer", + "description": "The number of historic tasks to keep per instance or node. If\nnegative, never remove completed or failed tasks.\n", + "format": "int64", + "example": 10 + } + }, + "description": "Orchestration configuration.", + "nullable": true + }, + "Raft": { + "type": "object", + "properties": { + "SnapshotInterval": { + "type": "integer", + "description": "The number of log entries between snapshots.", + "format": "uint64", + "example": 10000 + }, + "KeepOldSnapshots": { + "type": "integer", + "description": "The number of snapshots to keep beyond the current snapshot.\n", + "format": "uint64" + }, + "LogEntriesForSlowFollowers": { + "type": "integer", + "description": "The number of log entries to keep around to sync up slow followers\nafter a snapshot is created.\n", + "format": "uint64", + "example": 500 + }, + "ElectionTick": { + "type": "integer", + "description": "The number of ticks that a follower will wait for a message from\nthe leader before becoming a candidate and starting an election.\n`ElectionTick` must be greater than `HeartbeatTick`.\n\nA tick currently defaults to one second, so these translate\ndirectly to seconds currently, but this is NOT guaranteed.\n", + "example": 3 + }, + "HeartbeatTick": { + "type": "integer", + "description": "The number of ticks between heartbeats. Every HeartbeatTick ticks,\nthe leader will send a heartbeat to the followers.\n\nA tick currently defaults to one second, so these translate\ndirectly to seconds currently, but this is NOT guaranteed.\n", + "example": 1 + } + }, + "description": "Raft configuration." + }, + "Dispatcher": { + "type": "object", + "properties": { + "HeartbeatPeriod": { + "type": "integer", + "description": "The delay for an agent to send a heartbeat to the dispatcher.\n", + "format": "int64", + "example": 5000000000 + } + }, + "description": "Dispatcher configuration.", + "nullable": true + }, + "CAConfig": { + "type": "object", + "properties": { + "NodeCertExpiry": { + "type": "integer", + "description": "The duration node certificates are issued for.", + "format": "int64", + "example": 7776000000000000 + }, + "ExternalCAs": { + "type": "array", + "description": "Configuration for forwarding signing requests to an external\ncertificate authority.\n", + "items": { + "type": "object", + "properties": { + "Protocol": { + "type": "string", + "description": "Protocol for communication with the external CA (currently\nonly `cfssl` is supported).\n", + "default": "cfssl", + "enum": [ + "cfssl" + ] + }, + "URL": { + "type": "string", + "description": "URL where certificate signing requests should be sent.\n" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "An object with key/value pairs that are interpreted as\nprotocol-specific options for the external CA driver.\n" + }, + "CACert": { + "type": "string", + "description": "The root CA certificate (in PEM format) this external CA uses\nto issue TLS certificates (assumed to be to the current swarm\nroot CA certificate if not provided).\n" + } + } + } + }, + "SigningCACert": { + "type": "string", + "description": "The desired signing CA certificate for all swarm node TLS leaf\ncertificates, in PEM format.\n" + }, + "SigningCAKey": { + "type": "string", + "description": "The desired signing CA key for all swarm node TLS leaf certificates,\nin PEM format.\n" + }, + "ForceRotate": { + "type": "integer", + "description": "An integer whose purpose is to force swarm to generate a new\nsigning CA certificate and key, if none have been specified in\n`SigningCACert` and `SigningCAKey`\n", + "format": "uint64" + } + }, + "description": "CA configuration.", + "nullable": true + }, + "EncryptionConfig": { + "type": "object", + "properties": { + "AutoLockManagers": { + "type": "boolean", + "description": "If set, generate a key and use it to lock data stored on the\nmanagers.\n", + "example": false + } + }, + "description": "Parameters related to encryption-at-rest." + }, + "TaskDefaults": { + "type": "object", + "properties": { + "LogDriver": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "The log driver to use as a default for new tasks.\n", + "example": "json-file" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver-specific options for the selected log driver, specified\nas key/value pairs.\n", + "example": { + "max-file": "10", + "max-size": "100m" + } + } + }, + "description": "The log driver to use for tasks created in the orchestrator if\nunspecified by a service.\n\nUpdating this value only affects new tasks. Existing tasks continue\nto use their previously configured log driver until recreated.\n" + } + }, + "description": "Defaults for creating tasks in this cluster." + } + }, + "description": "User modifiable swarm configuration." + } + }, + "example": { + "ListenAddr": "0.0.0.0:2377", + "AdvertiseAddr": "192.168.1.1:2377", + "DataPathPort": 4789, + "DefaultAddrPool": [ + "10.10.0.0/8", + "20.20.0.0/8" + ], + "SubnetSize": 24, + "ForceNewCluster": false, + "Spec": { + "Orchestration": {}, + "Raft": {}, + "Dispatcher": {}, + "CAConfig": {}, + "EncryptionConfig": { + "AutoLockManagers": false + } + } + } + } + }, + "text/plain": { + "schema": { + "title": "SwarmInitRequest", + "type": "object", + "properties": { + "ListenAddr": { + "type": "string", + "description": "Listen address used for inter-manager communication, as well\nas determining the networking interface used for the VXLAN\nTunnel Endpoint (VTEP). This can either be an address/port\ncombination in the form `192.168.1.1:4567`, or an interface\nfollowed by a port number, like `eth0:4567`. If the port number\nis omitted, the default swarm listening port is used.\n" + }, + "AdvertiseAddr": { + "type": "string", + "description": "Externally reachable address advertised to other nodes. This\ncan either be an address/port combination in the form\n`192.168.1.1:4567`, or an interface followed by a port number,\nlike `eth0:4567`. If the port number is omitted, the port\nnumber from the listen address is used. If `AdvertiseAddr` is\nnot specified, it will be automatically detected when possible.\n" + }, + "DataPathAddr": { + "type": "string", + "description": "Address or interface to use for data path traffic (format:\n``), for example, `192.168.1.1`, or an interface,\nlike `eth0`. If `DataPathAddr` is unspecified, the same address\nas `AdvertiseAddr` is used.\n\nThe `DataPathAddr` specifies the address that global scope\nnetwork drivers will publish towards other nodes in order to\nreach the containers running on this node. Using this parameter\nit is possible to separate the container data traffic from the\nmanagement traffic of the cluster.\n" + }, + "DataPathPort": { + "type": "integer", + "description": "DataPathPort specifies the data path port number for data traffic.\nAcceptable port range is 1024 to 49151.\nif no port is set or is set to 0, default port 4789 will be used.\n", + "format": "uint32" + }, + "DefaultAddrPool": { + "type": "array", + "description": "Default Address Pool specifies default subnet pools for global\nscope networks.\n", + "items": { + "type": "string", + "example": "" + } + }, + "ForceNewCluster": { + "type": "boolean", + "description": "Force creation of a new swarm." + }, + "SubnetSize": { + "type": "integer", + "description": "SubnetSize specifies the subnet size of the networks created\nfrom the default subnet pool.\n", + "format": "uint32" + }, + "Spec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the swarm.", + "example": "default" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.corp.type": "production", + "com.example.corp.department": "engineering" + } + }, + "Orchestration": { + "type": "object", + "properties": { + "TaskHistoryRetentionLimit": { + "type": "integer", + "description": "The number of historic tasks to keep per instance or node. If\nnegative, never remove completed or failed tasks.\n", + "format": "int64", + "example": 10 + } + }, + "description": "Orchestration configuration.", + "nullable": true + }, + "Raft": { + "type": "object", + "properties": { + "SnapshotInterval": { + "type": "integer", + "description": "The number of log entries between snapshots.", + "format": "uint64", + "example": 10000 + }, + "KeepOldSnapshots": { + "type": "integer", + "description": "The number of snapshots to keep beyond the current snapshot.\n", + "format": "uint64" + }, + "LogEntriesForSlowFollowers": { + "type": "integer", + "description": "The number of log entries to keep around to sync up slow followers\nafter a snapshot is created.\n", + "format": "uint64", + "example": 500 + }, + "ElectionTick": { + "type": "integer", + "description": "The number of ticks that a follower will wait for a message from\nthe leader before becoming a candidate and starting an election.\n`ElectionTick` must be greater than `HeartbeatTick`.\n\nA tick currently defaults to one second, so these translate\ndirectly to seconds currently, but this is NOT guaranteed.\n", + "example": 3 + }, + "HeartbeatTick": { + "type": "integer", + "description": "The number of ticks between heartbeats. Every HeartbeatTick ticks,\nthe leader will send a heartbeat to the followers.\n\nA tick currently defaults to one second, so these translate\ndirectly to seconds currently, but this is NOT guaranteed.\n", + "example": 1 + } + }, + "description": "Raft configuration." + }, + "Dispatcher": { + "type": "object", + "properties": { + "HeartbeatPeriod": { + "type": "integer", + "description": "The delay for an agent to send a heartbeat to the dispatcher.\n", + "format": "int64", + "example": 5000000000 + } + }, + "description": "Dispatcher configuration.", + "nullable": true + }, + "CAConfig": { + "type": "object", + "properties": { + "NodeCertExpiry": { + "type": "integer", + "description": "The duration node certificates are issued for.", + "format": "int64", + "example": 7776000000000000 + }, + "ExternalCAs": { + "type": "array", + "description": "Configuration for forwarding signing requests to an external\ncertificate authority.\n", + "items": { + "type": "object", + "properties": { + "Protocol": { + "type": "string", + "description": "Protocol for communication with the external CA (currently\nonly `cfssl` is supported).\n", + "default": "cfssl", + "enum": [ + "cfssl" + ] + }, + "URL": { + "type": "string", + "description": "URL where certificate signing requests should be sent.\n" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "An object with key/value pairs that are interpreted as\nprotocol-specific options for the external CA driver.\n" + }, + "CACert": { + "type": "string", + "description": "The root CA certificate (in PEM format) this external CA uses\nto issue TLS certificates (assumed to be to the current swarm\nroot CA certificate if not provided).\n" + } + } + } + }, + "SigningCACert": { + "type": "string", + "description": "The desired signing CA certificate for all swarm node TLS leaf\ncertificates, in PEM format.\n" + }, + "SigningCAKey": { + "type": "string", + "description": "The desired signing CA key for all swarm node TLS leaf certificates,\nin PEM format.\n" + }, + "ForceRotate": { + "type": "integer", + "description": "An integer whose purpose is to force swarm to generate a new\nsigning CA certificate and key, if none have been specified in\n`SigningCACert` and `SigningCAKey`\n", + "format": "uint64" + } + }, + "description": "CA configuration.", + "nullable": true + }, + "EncryptionConfig": { + "type": "object", + "properties": { + "AutoLockManagers": { + "type": "boolean", + "description": "If set, generate a key and use it to lock data stored on the\nmanagers.\n", + "example": false + } + }, + "description": "Parameters related to encryption-at-rest." + }, + "TaskDefaults": { + "type": "object", + "properties": { + "LogDriver": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "The log driver to use as a default for new tasks.\n", + "example": "json-file" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver-specific options for the selected log driver, specified\nas key/value pairs.\n", + "example": { + "max-file": "10", + "max-size": "100m" + } + } + }, + "description": "The log driver to use for tasks created in the orchestrator if\nunspecified by a service.\n\nUpdating this value only affects new tasks. Existing tasks continue\nto use their previously configured log driver until recreated.\n" + } + }, + "description": "Defaults for creating tasks in this cluster." + } + }, + "description": "User modifiable swarm configuration." + } + }, + "example": { + "ListenAddr": "0.0.0.0:2377", + "AdvertiseAddr": "192.168.1.1:2377", + "DataPathPort": 4789, + "DefaultAddrPool": [ + "10.10.0.0/8", + "20.20.0.0/8" + ], + "SubnetSize": 24, + "ForceNewCluster": false, + "Spec": { + "Orchestration": {}, + "Raft": {}, + "Dispatcher": {}, + "CAConfig": {}, + "EncryptionConfig": { + "AutoLockManagers": false + } + } + } + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "no error", + "content": { + "application/json": { + "schema": { + "type": "string", + "description": "The node ID", + "example": "7v2t30z9blmxuhnyo6s4cpenp" + } + }, + "text/plain": { + "schema": { + "type": "string", + "description": "The node ID", + "example": "7v2t30z9blmxuhnyo6s4cpenp" + } + } + } + }, + "400": { + "description": "bad parameter", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "503": { + "description": "node is already part of a swarm", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + }, + "x-codegen-request-body-name": "body" + } + }, + "/swarm/join": { + "post": { + "tags": [ + "Swarm" + ], + "summary": "Join an existing swarm", + "operationId": "SwarmJoin", + "requestBody": { + "content": { + "application/json": { + "schema": { + "title": "SwarmJoinRequest", + "type": "object", + "properties": { + "ListenAddr": { + "type": "string", + "description": "Listen address used for inter-manager communication if the node\ngets promoted to manager, as well as determining the networking\ninterface used for the VXLAN Tunnel Endpoint (VTEP).\n" + }, + "AdvertiseAddr": { + "type": "string", + "description": "Externally reachable address advertised to other nodes. This\ncan either be an address/port combination in the form\n`192.168.1.1:4567`, or an interface followed by a port number,\nlike `eth0:4567`. If the port number is omitted, the port\nnumber from the listen address is used. If `AdvertiseAddr` is\nnot specified, it will be automatically detected when possible.\n" + }, + "DataPathAddr": { + "type": "string", + "description": "Address or interface to use for data path traffic (format:\n``), for example, `192.168.1.1`, or an interface,\nlike `eth0`. If `DataPathAddr` is unspecified, the same address\nas `AdvertiseAddr` is used.\n\nThe `DataPathAddr` specifies the address that global scope\nnetwork drivers will publish towards other nodes in order to\nreach the containers running on this node. Using this parameter\nit is possible to separate the container data traffic from the\nmanagement traffic of the cluster.\n" + }, + "RemoteAddrs": { + "type": "array", + "description": "Addresses of manager nodes already participating in the swarm.\n", + "items": { + "type": "string" + } + }, + "JoinToken": { + "type": "string", + "description": "Secret token for joining this swarm." + } + }, + "example": { + "ListenAddr": "0.0.0.0:2377", + "AdvertiseAddr": "192.168.1.1:2377", + "DataPathAddr": "192.168.1.1", + "RemoteAddrs": [ + "node1:2377" + ], + "JoinToken": "SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-7p73s1dx5in4tatdymyhg9hu2" + } + } + }, + "text/plain": { + "schema": { + "title": "SwarmJoinRequest", + "type": "object", + "properties": { + "ListenAddr": { + "type": "string", + "description": "Listen address used for inter-manager communication if the node\ngets promoted to manager, as well as determining the networking\ninterface used for the VXLAN Tunnel Endpoint (VTEP).\n" + }, + "AdvertiseAddr": { + "type": "string", + "description": "Externally reachable address advertised to other nodes. This\ncan either be an address/port combination in the form\n`192.168.1.1:4567`, or an interface followed by a port number,\nlike `eth0:4567`. If the port number is omitted, the port\nnumber from the listen address is used. If `AdvertiseAddr` is\nnot specified, it will be automatically detected when possible.\n" + }, + "DataPathAddr": { + "type": "string", + "description": "Address or interface to use for data path traffic (format:\n``), for example, `192.168.1.1`, or an interface,\nlike `eth0`. If `DataPathAddr` is unspecified, the same address\nas `AdvertiseAddr` is used.\n\nThe `DataPathAddr` specifies the address that global scope\nnetwork drivers will publish towards other nodes in order to\nreach the containers running on this node. Using this parameter\nit is possible to separate the container data traffic from the\nmanagement traffic of the cluster.\n" + }, + "RemoteAddrs": { + "type": "array", + "description": "Addresses of manager nodes already participating in the swarm.\n", + "items": { + "type": "string" + } + }, + "JoinToken": { + "type": "string", + "description": "Secret token for joining this swarm." + } + }, + "example": { + "ListenAddr": "0.0.0.0:2377", + "AdvertiseAddr": "192.168.1.1:2377", + "DataPathAddr": "192.168.1.1", + "RemoteAddrs": [ + "node1:2377" + ], + "JoinToken": "SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-7p73s1dx5in4tatdymyhg9hu2" + } + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "no error", + "content": {} + }, + "400": { + "description": "bad parameter", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "503": { + "description": "node is already part of a swarm", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + }, + "x-codegen-request-body-name": "body" + } + }, + "/swarm/leave": { + "post": { + "tags": [ + "Swarm" + ], + "summary": "Leave a swarm", + "operationId": "SwarmLeave", + "parameters": [ + { + "name": "force", + "in": "query", + "description": "Force leave swarm, even if this is the last manager or that it will\nbreak the cluster.\n", + "schema": { + "type": "boolean", + "default": false + } + } + ], + "responses": { + "200": { + "description": "no error", + "content": {} + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "503": { + "description": "node is not part of a swarm", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/swarm/update": { + "post": { + "tags": [ + "Swarm" + ], + "summary": "Update a swarm", + "operationId": "SwarmUpdate", + "parameters": [ + { + "name": "version", + "in": "query", + "description": "The version number of the swarm object being updated. This is\nrequired to avoid conflicting writes.\n", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + }, + { + "name": "rotateWorkerToken", + "in": "query", + "description": "Rotate the worker join token.", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "rotateManagerToken", + "in": "query", + "description": "Rotate the manager join token.", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "rotateManagerUnlockKey", + "in": "query", + "description": "Rotate the manager unlock key.", + "schema": { + "type": "boolean", + "default": false + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the swarm.", + "example": "default" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.corp.type": "production", + "com.example.corp.department": "engineering" + } + }, + "Orchestration": { + "type": "object", + "properties": { + "TaskHistoryRetentionLimit": { + "type": "integer", + "description": "The number of historic tasks to keep per instance or node. If\nnegative, never remove completed or failed tasks.\n", + "format": "int64", + "example": 10 + } + }, + "description": "Orchestration configuration.", + "nullable": true + }, + "Raft": { + "type": "object", + "properties": { + "SnapshotInterval": { + "type": "integer", + "description": "The number of log entries between snapshots.", + "format": "uint64", + "example": 10000 + }, + "KeepOldSnapshots": { + "type": "integer", + "description": "The number of snapshots to keep beyond the current snapshot.\n", + "format": "uint64" + }, + "LogEntriesForSlowFollowers": { + "type": "integer", + "description": "The number of log entries to keep around to sync up slow followers\nafter a snapshot is created.\n", + "format": "uint64", + "example": 500 + }, + "ElectionTick": { + "type": "integer", + "description": "The number of ticks that a follower will wait for a message from\nthe leader before becoming a candidate and starting an election.\n`ElectionTick` must be greater than `HeartbeatTick`.\n\nA tick currently defaults to one second, so these translate\ndirectly to seconds currently, but this is NOT guaranteed.\n", + "example": 3 + }, + "HeartbeatTick": { + "type": "integer", + "description": "The number of ticks between heartbeats. Every HeartbeatTick ticks,\nthe leader will send a heartbeat to the followers.\n\nA tick currently defaults to one second, so these translate\ndirectly to seconds currently, but this is NOT guaranteed.\n", + "example": 1 + } + }, + "description": "Raft configuration." + }, + "Dispatcher": { + "type": "object", + "properties": { + "HeartbeatPeriod": { + "type": "integer", + "description": "The delay for an agent to send a heartbeat to the dispatcher.\n", + "format": "int64", + "example": 5000000000 + } + }, + "description": "Dispatcher configuration.", + "nullable": true + }, + "CAConfig": { + "type": "object", + "properties": { + "NodeCertExpiry": { + "type": "integer", + "description": "The duration node certificates are issued for.", + "format": "int64", + "example": 7776000000000000 + }, + "ExternalCAs": { + "type": "array", + "description": "Configuration for forwarding signing requests to an external\ncertificate authority.\n", + "items": { + "type": "object", + "properties": { + "Protocol": { + "type": "string", + "description": "Protocol for communication with the external CA (currently\nonly `cfssl` is supported).\n", + "default": "cfssl", + "enum": [ + "cfssl" + ] + }, + "URL": { + "type": "string", + "description": "URL where certificate signing requests should be sent.\n" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "An object with key/value pairs that are interpreted as\nprotocol-specific options for the external CA driver.\n" + }, + "CACert": { + "type": "string", + "description": "The root CA certificate (in PEM format) this external CA uses\nto issue TLS certificates (assumed to be to the current swarm\nroot CA certificate if not provided).\n" + } + } + } + }, + "SigningCACert": { + "type": "string", + "description": "The desired signing CA certificate for all swarm node TLS leaf\ncertificates, in PEM format.\n" + }, + "SigningCAKey": { + "type": "string", + "description": "The desired signing CA key for all swarm node TLS leaf certificates,\nin PEM format.\n" + }, + "ForceRotate": { + "type": "integer", + "description": "An integer whose purpose is to force swarm to generate a new\nsigning CA certificate and key, if none have been specified in\n`SigningCACert` and `SigningCAKey`\n", + "format": "uint64" + } + }, + "description": "CA configuration.", + "nullable": true + }, + "EncryptionConfig": { + "type": "object", + "properties": { + "AutoLockManagers": { + "type": "boolean", + "description": "If set, generate a key and use it to lock data stored on the\nmanagers.\n", + "example": false + } + }, + "description": "Parameters related to encryption-at-rest." + }, + "TaskDefaults": { + "type": "object", + "properties": { + "LogDriver": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "The log driver to use as a default for new tasks.\n", + "example": "json-file" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver-specific options for the selected log driver, specified\nas key/value pairs.\n", + "example": { + "max-file": "10", + "max-size": "100m" + } + } + }, + "description": "The log driver to use for tasks created in the orchestrator if\nunspecified by a service.\n\nUpdating this value only affects new tasks. Existing tasks continue\nto use their previously configured log driver until recreated.\n" + } + }, + "description": "Defaults for creating tasks in this cluster." + } + }, + "description": "User modifiable swarm configuration." + } + }, + "text/plain": { + "schema": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the swarm.", + "example": "default" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.corp.type": "production", + "com.example.corp.department": "engineering" + } + }, + "Orchestration": { + "type": "object", + "properties": { + "TaskHistoryRetentionLimit": { + "type": "integer", + "description": "The number of historic tasks to keep per instance or node. If\nnegative, never remove completed or failed tasks.\n", + "format": "int64", + "example": 10 + } + }, + "description": "Orchestration configuration.", + "nullable": true + }, + "Raft": { + "type": "object", + "properties": { + "SnapshotInterval": { + "type": "integer", + "description": "The number of log entries between snapshots.", + "format": "uint64", + "example": 10000 + }, + "KeepOldSnapshots": { + "type": "integer", + "description": "The number of snapshots to keep beyond the current snapshot.\n", + "format": "uint64" + }, + "LogEntriesForSlowFollowers": { + "type": "integer", + "description": "The number of log entries to keep around to sync up slow followers\nafter a snapshot is created.\n", + "format": "uint64", + "example": 500 + }, + "ElectionTick": { + "type": "integer", + "description": "The number of ticks that a follower will wait for a message from\nthe leader before becoming a candidate and starting an election.\n`ElectionTick` must be greater than `HeartbeatTick`.\n\nA tick currently defaults to one second, so these translate\ndirectly to seconds currently, but this is NOT guaranteed.\n", + "example": 3 + }, + "HeartbeatTick": { + "type": "integer", + "description": "The number of ticks between heartbeats. Every HeartbeatTick ticks,\nthe leader will send a heartbeat to the followers.\n\nA tick currently defaults to one second, so these translate\ndirectly to seconds currently, but this is NOT guaranteed.\n", + "example": 1 + } + }, + "description": "Raft configuration." + }, + "Dispatcher": { + "type": "object", + "properties": { + "HeartbeatPeriod": { + "type": "integer", + "description": "The delay for an agent to send a heartbeat to the dispatcher.\n", + "format": "int64", + "example": 5000000000 + } + }, + "description": "Dispatcher configuration.", + "nullable": true + }, + "CAConfig": { + "type": "object", + "properties": { + "NodeCertExpiry": { + "type": "integer", + "description": "The duration node certificates are issued for.", + "format": "int64", + "example": 7776000000000000 + }, + "ExternalCAs": { + "type": "array", + "description": "Configuration for forwarding signing requests to an external\ncertificate authority.\n", + "items": { + "type": "object", + "properties": { + "Protocol": { + "type": "string", + "description": "Protocol for communication with the external CA (currently\nonly `cfssl` is supported).\n", + "default": "cfssl", + "enum": [ + "cfssl" + ] + }, + "URL": { + "type": "string", + "description": "URL where certificate signing requests should be sent.\n" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "An object with key/value pairs that are interpreted as\nprotocol-specific options for the external CA driver.\n" + }, + "CACert": { + "type": "string", + "description": "The root CA certificate (in PEM format) this external CA uses\nto issue TLS certificates (assumed to be to the current swarm\nroot CA certificate if not provided).\n" + } + } + } + }, + "SigningCACert": { + "type": "string", + "description": "The desired signing CA certificate for all swarm node TLS leaf\ncertificates, in PEM format.\n" + }, + "SigningCAKey": { + "type": "string", + "description": "The desired signing CA key for all swarm node TLS leaf certificates,\nin PEM format.\n" + }, + "ForceRotate": { + "type": "integer", + "description": "An integer whose purpose is to force swarm to generate a new\nsigning CA certificate and key, if none have been specified in\n`SigningCACert` and `SigningCAKey`\n", + "format": "uint64" + } + }, + "description": "CA configuration.", + "nullable": true + }, + "EncryptionConfig": { + "type": "object", + "properties": { + "AutoLockManagers": { + "type": "boolean", + "description": "If set, generate a key and use it to lock data stored on the\nmanagers.\n", + "example": false + } + }, + "description": "Parameters related to encryption-at-rest." + }, + "TaskDefaults": { + "type": "object", + "properties": { + "LogDriver": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "The log driver to use as a default for new tasks.\n", + "example": "json-file" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver-specific options for the selected log driver, specified\nas key/value pairs.\n", + "example": { + "max-file": "10", + "max-size": "100m" + } + } + }, + "description": "The log driver to use for tasks created in the orchestrator if\nunspecified by a service.\n\nUpdating this value only affects new tasks. Existing tasks continue\nto use their previously configured log driver until recreated.\n" + } + }, + "description": "Defaults for creating tasks in this cluster." + } + }, + "description": "User modifiable swarm configuration." + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "no error", + "content": {} + }, + "400": { + "description": "bad parameter", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "503": { + "description": "node is not part of a swarm", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + }, + "x-codegen-request-body-name": "body" + } + }, + "/swarm/unlockkey": { + "get": { + "tags": [ + "Swarm" + ], + "summary": "Get the unlock key", + "operationId": "SwarmUnlockkey", + "responses": { + "200": { + "description": "no error", + "content": { + "application/json": { + "schema": { + "title": "UnlockKeyResponse", + "type": "object", + "properties": { + "UnlockKey": { + "type": "string", + "description": "The swarm's unlock key." + } + }, + "example": { + "UnlockKey": "SWMKEY-1-7c37Cc8654o6p38HnroywCi19pllOnGtbdZEgtKxZu8" + } + } + }, + "text/plain": { + "schema": { + "title": "UnlockKeyResponse", + "type": "object", + "properties": { + "UnlockKey": { + "type": "string", + "description": "The swarm's unlock key." + } + }, + "example": { + "UnlockKey": "SWMKEY-1-7c37Cc8654o6p38HnroywCi19pllOnGtbdZEgtKxZu8" + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "503": { + "description": "node is not part of a swarm", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/swarm/unlock": { + "post": { + "tags": [ + "Swarm" + ], + "summary": "Unlock a locked manager", + "operationId": "SwarmUnlock", + "requestBody": { + "content": { + "application/json": { + "schema": { + "title": "SwarmUnlockRequest", + "type": "object", + "properties": { + "UnlockKey": { + "type": "string", + "description": "The swarm's unlock key." + } + }, + "example": { + "UnlockKey": "SWMKEY-1-7c37Cc8654o6p38HnroywCi19pllOnGtbdZEgtKxZu8" + } + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "no error", + "content": {} + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "503": { + "description": "node is not part of a swarm", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + }, + "x-codegen-request-body-name": "body" + } + }, + "/services": { + "get": { + "tags": [ + "Service" + ], + "summary": "List services", + "operationId": "ServiceList", + "parameters": [ + { + "name": "filters", + "in": "query", + "description": "A JSON encoded value of the filters (a `map[string][]string`) to\nprocess on the services list.\n\nAvailable filters:\n\n- `id=`\n- `label=`\n- `mode=[\"replicated\"|\"global\"]`\n- `name=`\n", + "schema": { + "type": "string" + } + }, + { + "name": "status", + "in": "query", + "description": "Include service status, with count of running and desired tasks.\n", + "schema": { + "type": "boolean" + } + } + ], + "responses": { + "200": { + "description": "no error", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "ID": { + "type": "string" + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "format": "dateTime" + }, + "UpdatedAt": { + "type": "string", + "format": "dateTime" + }, + "Spec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the service." + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "TaskTemplate": { + "type": "object", + "properties": { + "PluginSpec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "The name or 'alias' to use for the plugin." + }, + "Remote": { + "type": "string", + "description": "The plugin image reference to use." + }, + "Disabled": { + "type": "boolean", + "description": "Disable the plugin once scheduled." + }, + "PluginPrivilege": { + "type": "array", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "example": "network" + }, + "Description": { + "type": "string" + }, + "Value": { + "type": "array", + "example": [ + "host" + ], + "items": { + "type": "string" + } + } + }, + "description": "Describes a permission the user has to accept upon installing\nthe plugin.\n", + "x-go-name": "PluginPrivilege" + } + } + }, + "description": "Plugin spec for the service. *(Experimental release only.)*\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "ContainerSpec": { + "type": "object", + "properties": { + "Image": { + "type": "string", + "description": "The image name to use for the container" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value data." + }, + "Command": { + "type": "array", + "description": "The command to be run in the image.", + "items": { + "type": "string" + } + }, + "Args": { + "type": "array", + "description": "Arguments to the command.", + "items": { + "type": "string" + } + }, + "Hostname": { + "type": "string", + "description": "The hostname to use for the container, as a valid\n[RFC 1123](https://tools.ietf.org/html/rfc1123) hostname.\n" + }, + "Env": { + "type": "array", + "description": "A list of environment variables in the form `VAR=value`.\n", + "items": { + "type": "string" + } + }, + "Dir": { + "type": "string", + "description": "The working directory for commands to run in." + }, + "User": { + "type": "string", + "description": "The user inside the container." + }, + "Groups": { + "type": "array", + "description": "A list of additional groups that the container process will run as.\n", + "items": { + "type": "string" + } + }, + "Privileges": { + "type": "object", + "properties": { + "CredentialSpec": { + "type": "object", + "properties": { + "Config": { + "type": "string", + "description": "Load credential spec from a Swarm Config with the given ID.\nThe specified config must also be present in the Configs\nfield with the Runtime property set.\n\n


\n\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n", + "example": "0bt9dmxjvjiqermk6xrop3ekq" + }, + "File": { + "type": "string", + "description": "Load credential spec from this file. The file is read by\nthe daemon, and must be present in the `CredentialSpecs`\nsubdirectory in the docker data directory, which defaults\nto `C:\\ProgramData\\Docker\\` on Windows.\n\nFor example, specifying `spec.json` loads\n`C:\\ProgramData\\Docker\\CredentialSpecs\\spec.json`.\n\n


\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n", + "example": "spec.json" + }, + "Registry": { + "type": "string", + "description": "Load credential spec from this value in the Windows\nregistry. The specified registry value must be located in:\n\n`HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Virtualization\\Containers\\CredentialSpecs`\n\n


\n\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n" + } + }, + "description": "CredentialSpec for managed service account (Windows only)" + }, + "SELinuxContext": { + "type": "object", + "properties": { + "Disable": { + "type": "boolean", + "description": "Disable SELinux" + }, + "User": { + "type": "string", + "description": "SELinux user label" + }, + "Role": { + "type": "string", + "description": "SELinux role label" + }, + "Type": { + "type": "string", + "description": "SELinux type label" + }, + "Level": { + "type": "string", + "description": "SELinux level label" + } + }, + "description": "SELinux labels of the container" + } + }, + "description": "Security options for the container" + }, + "TTY": { + "type": "boolean", + "description": "Whether a pseudo-TTY should be allocated." + }, + "OpenStdin": { + "type": "boolean", + "description": "Open `stdin`" + }, + "ReadOnly": { + "type": "boolean", + "description": "Mount the container's root filesystem as read only." + }, + "Mounts": { + "type": "array", + "description": "Specification for mounts to be added to containers created as part\nof the service.\n", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "Container path." + }, + "Source": { + "type": "string", + "description": "Mount source (e.g. a volume name, a host path)." + }, + "Type": { + "type": "string", + "description": "The mount type. Available types:\n\n- `bind` Mounts a file or directory from the host into the container. Must exist prior to creating the container.\n- `volume` Creates a volume with the given name and options (or uses a pre-existing volume with the same name and options). These are **not** removed when the container is removed.\n- `tmpfs` Create a tmpfs with the given options. The mount source cannot be specified for tmpfs.\n- `npipe` Mounts a named pipe from the host into the container. Must exist prior to creating the container.\n- `cluster` a Swarm cluster volume\n", + "enum": [ + "bind", + "volume", + "tmpfs", + "npipe", + "cluster" + ] + }, + "ReadOnly": { + "type": "boolean", + "description": "Whether the mount should be read-only." + }, + "Consistency": { + "type": "string", + "description": "The consistency requirement for the mount: `default`, `consistent`, `cached`, or `delegated`." + }, + "BindOptions": { + "type": "object", + "properties": { + "Propagation": { + "type": "string", + "description": "A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`.", + "enum": [ + "private", + "rprivate", + "shared", + "rshared", + "slave", + "rslave" + ] + }, + "NonRecursive": { + "type": "boolean", + "description": "Disable recursive bind mount.", + "default": false + }, + "CreateMountpoint": { + "type": "boolean", + "description": "Create mount point on host if missing", + "default": false + } + }, + "description": "Optional configuration for the `bind` type." + }, + "VolumeOptions": { + "type": "object", + "properties": { + "NoCopy": { + "type": "boolean", + "description": "Populate volume with data from the target.", + "default": false + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "DriverConfig": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver to use to create the volume." + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "key/value map of driver specific options." + } + }, + "description": "Map of driver specific options" + } + }, + "description": "Optional configuration for the `volume` type." + }, + "TmpfsOptions": { + "type": "object", + "properties": { + "SizeBytes": { + "type": "integer", + "description": "The size for the tmpfs mount in bytes.", + "format": "int64" + }, + "Mode": { + "type": "integer", + "description": "The permission mode for the tmpfs mount in an integer." + } + }, + "description": "Optional configuration for the `tmpfs` type." + } + } + } + }, + "StopSignal": { + "type": "string", + "description": "Signal to stop the container." + }, + "StopGracePeriod": { + "type": "integer", + "description": "Amount of time to wait for the container to terminate before\nforcefully killing it.\n", + "format": "int64" + }, + "HealthCheck": { + "type": "object", + "properties": { + "Test": { + "type": "array", + "description": "The test to perform. Possible values are:\n\n- `[]` inherit healthcheck from image or parent image\n- `[\"NONE\"]` disable healthcheck\n- `[\"CMD\", args...]` exec arguments directly\n- `[\"CMD-SHELL\", command]` run command with system's default shell\n", + "items": { + "type": "string" + } + }, + "Interval": { + "type": "integer", + "description": "The time to wait between checks in nanoseconds. It should be 0 or at\nleast 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Timeout": { + "type": "integer", + "description": "The time to wait before considering the check to have hung. It should\nbe 0 or at least 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Retries": { + "type": "integer", + "description": "The number of consecutive failures needed to consider a container as\nunhealthy. 0 means inherit.\n" + }, + "StartPeriod": { + "type": "integer", + "description": "Start period for the container to initialize before starting\nhealth-retries countdown in nanoseconds. It should be 0 or at least\n1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + } + }, + "description": "A test to perform to check that the container is healthy." + }, + "Hosts": { + "type": "array", + "description": "A list of hostname/IP mappings to add to the container's `hosts`\nfile. The format of extra hosts is specified in the\n[hosts(5)](http://man7.org/linux/man-pages/man5/hosts.5.html)\nman page:\n\n IP_address canonical_hostname [aliases...]\n", + "items": { + "type": "string" + } + }, + "DNSConfig": { + "type": "object", + "properties": { + "Nameservers": { + "type": "array", + "description": "The IP addresses of the name servers.", + "items": { + "type": "string" + } + }, + "Search": { + "type": "array", + "description": "A search list for host-name lookup.", + "items": { + "type": "string" + } + }, + "Options": { + "type": "array", + "description": "A list of internal resolver variables to be modified (e.g.,\n`debug`, `ndots:3`, etc.).\n", + "items": { + "type": "string" + } + } + }, + "description": "Specification for DNS related configurations in resolver configuration\nfile (`resolv.conf`).\n" + }, + "Secrets": { + "type": "array", + "description": "Secrets contains references to zero or more secrets that will be\nexposed to the service.\n", + "items": { + "type": "object", + "properties": { + "File": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name represents the final filename in the filesystem.\n" + }, + "UID": { + "type": "string", + "description": "UID represents the file UID." + }, + "GID": { + "type": "string", + "description": "GID represents the file GID." + }, + "Mode": { + "type": "integer", + "description": "Mode represents the FileMode of the file.", + "format": "uint32" + } + }, + "description": "File represents a specific target that is backed by a file.\n" + }, + "SecretID": { + "type": "string", + "description": "SecretID represents the ID of the specific secret that we're\nreferencing.\n" + }, + "SecretName": { + "type": "string", + "description": "SecretName is the name of the secret that this references,\nbut this is just provided for lookup/display purposes. The\nsecret in the reference will be identified by its ID.\n" + } + } + } + }, + "Configs": { + "type": "array", + "description": "Configs contains references to zero or more configs that will be\nexposed to the service.\n", + "items": { + "type": "object", + "properties": { + "File": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name represents the final filename in the filesystem.\n" + }, + "UID": { + "type": "string", + "description": "UID represents the file UID." + }, + "GID": { + "type": "string", + "description": "GID represents the file GID." + }, + "Mode": { + "type": "integer", + "description": "Mode represents the FileMode of the file.", + "format": "uint32" + } + }, + "description": "File represents a specific target that is backed by a file.\n\n


\n\n> **Note**: `Configs.File` and `Configs.Runtime` are mutually exclusive\n" + }, + "Runtime": { + "type": "object", + "properties": {}, + "description": "Runtime represents a target that is not mounted into the\ncontainer but is used by the task\n\n


\n\n> **Note**: `Configs.File` and `Configs.Runtime` are mutually\n> exclusive\n" + }, + "ConfigID": { + "type": "string", + "description": "ConfigID represents the ID of the specific config that we're\nreferencing.\n" + }, + "ConfigName": { + "type": "string", + "description": "ConfigName is the name of the config that this references,\nbut this is just provided for lookup/display purposes. The\nconfig in the reference will be identified by its ID.\n" + } + } + } + }, + "Isolation": { + "type": "string", + "description": "Isolation technology of the containers running the service.\n(Windows only)\n", + "enum": [ + "default", + "process", + "hyperv", + "" + ] + }, + "Init": { + "type": "boolean", + "description": "Run an init inside the container that forwards signals and reaps\nprocesses. This field is omitted if empty, and the default (as\nconfigured on the daemon) is used.\n", + "nullable": true + }, + "Sysctls": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Set kernel namedspaced parameters (sysctls) in the container.\nThe Sysctls option on services accepts the same sysctls as the\nare supported on containers. Note that while the same sysctls are\nsupported, no guarantees or checks are made about their\nsuitability for a clustered environment, and it's up to the user\nto determine whether a given sysctl will work properly in a\nService.\n" + }, + "CapabilityAdd": { + "type": "array", + "description": "A list of kernel capabilities to add to the default set\nfor the container.\n", + "example": [ + "CAP_NET_RAW", + "CAP_SYS_ADMIN", + "CAP_SYS_CHROOT", + "CAP_SYSLOG" + ], + "items": { + "type": "string" + } + }, + "CapabilityDrop": { + "type": "array", + "description": "A list of kernel capabilities to drop from the default set\nfor the container.\n", + "example": [ + "CAP_NET_RAW" + ], + "items": { + "type": "string" + } + }, + "Ulimits": { + "type": "array", + "description": "A list of resource limits to set in the container. For example: `{\"Name\": \"nofile\", \"Soft\": 1024, \"Hard\": 2048}`\"\n", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of ulimit" + }, + "Soft": { + "type": "integer", + "description": "Soft limit" + }, + "Hard": { + "type": "integer", + "description": "Hard limit" + } + } + } + } + }, + "description": "Container spec for the service.\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "NetworkAttachmentSpec": { + "type": "object", + "properties": { + "ContainerID": { + "type": "string", + "description": "ID of the container represented by this task" + } + }, + "description": "Read-only spec type for non-swarm containers attached to swarm overlay\nnetworks.\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "Resources": { + "type": "object", + "properties": { + "Limits": { + "type": "object", + "properties": { + "NanoCPUs": { + "type": "integer", + "format": "int64", + "example": 4000000000 + }, + "MemoryBytes": { + "type": "integer", + "format": "int64", + "example": 8272408576 + }, + "Pids": { + "type": "integer", + "description": "Limits the maximum number of PIDs in the container. Set `0` for unlimited.\n", + "format": "int64", + "example": 100, + "default": 0 + } + }, + "description": "An object describing a limit on resources which can be requested by a task.\n" + }, + "Reservations": { + "type": "object", + "properties": { + "NanoCPUs": { + "type": "integer", + "format": "int64", + "example": 4000000000 + }, + "MemoryBytes": { + "type": "integer", + "format": "int64", + "example": 8272408576 + }, + "GenericResources": { + "type": "array", + "description": "User-defined resources can be either Integer resources (e.g, `SSD=3`) or\nString resources (e.g, `GPU=UUID1`).\n", + "example": [ + { + "DiscreteResourceSpec": { + "Kind": "SSD", + "Value": 3 + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID1" + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID2" + } + } + ], + "items": { + "type": "object", + "properties": { + "NamedResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + }, + "DiscreteResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "integer", + "format": "int64" + } + } + } + } + } + } + }, + "description": "An object describing the resources which can be advertised by a node and\nrequested by a task.\n" + } + }, + "description": "Resource requirements which apply to each individual container created\nas part of the service.\n" + }, + "RestartPolicy": { + "type": "object", + "properties": { + "Condition": { + "type": "string", + "description": "Condition for restart.", + "enum": [ + "none", + "on-failure", + "any" + ] + }, + "Delay": { + "type": "integer", + "description": "Delay between restart attempts.", + "format": "int64" + }, + "MaxAttempts": { + "type": "integer", + "description": "Maximum attempts to restart a given container before giving up\n(default value is 0, which is ignored).\n", + "format": "int64", + "default": 0 + }, + "Window": { + "type": "integer", + "description": "Windows is the time window used to evaluate the restart policy\n(default value is 0, which is unbounded).\n", + "format": "int64", + "default": 0 + } + }, + "description": "Specification for the restart policy which applies to containers\ncreated as part of this service.\n" + }, + "Placement": { + "type": "object", + "properties": { + "Constraints": { + "type": "array", + "description": "An array of constraint expressions to limit the set of nodes where\na task can be scheduled. Constraint expressions can either use a\n_match_ (`==`) or _exclude_ (`!=`) rule. Multiple constraints find\nnodes that satisfy every expression (AND match). Constraints can\nmatch node or Docker Engine labels as follows:\n\nnode attribute | matches | example\n---------------------|--------------------------------|-----------------------------------------------\n`node.id` | Node ID | `node.id==2ivku8v2gvtg4`\n`node.hostname` | Node hostname | `node.hostname!=node-2`\n`node.role` | Node role (`manager`/`worker`) | `node.role==manager`\n`node.platform.os` | Node operating system | `node.platform.os==windows`\n`node.platform.arch` | Node architecture | `node.platform.arch==x86_64`\n`node.labels` | User-defined node labels | `node.labels.security==high`\n`engine.labels` | Docker Engine's labels | `engine.labels.operatingsystem==ubuntu-14.04`\n\n`engine.labels` apply to Docker Engine labels like operating system,\ndrivers, etc. Swarm administrators add `node.labels` for operational\npurposes by using the [`node update endpoint`](#operation/NodeUpdate).\n", + "example": [ + "node.hostname!=node3.corp.example.com", + "node.role!=manager", + "node.labels.type==production", + "node.platform.os==linux", + "node.platform.arch==x86_64" + ], + "items": { + "type": "string" + } + }, + "Preferences": { + "type": "array", + "description": "Preferences provide a way to make the scheduler aware of factors\nsuch as topology. They are provided in order from highest to\nlowest precedence.\n", + "example": [ + { + "Spread": { + "SpreadDescriptor": "node.labels.datacenter" + } + }, + { + "Spread": { + "SpreadDescriptor": "node.labels.rack" + } + } + ], + "items": { + "type": "object", + "properties": { + "Spread": { + "type": "object", + "properties": { + "SpreadDescriptor": { + "type": "string", + "description": "label descriptor, such as `engine.labels.az`.\n" + } + } + } + } + } + }, + "MaxReplicas": { + "type": "integer", + "description": "Maximum number of replicas for per node (default value is 0, which\nis unlimited)\n", + "format": "int64", + "default": 0 + }, + "Platforms": { + "type": "array", + "description": "Platforms stores all the platforms that the service's image can\nrun on. This field is used in the platform filter for scheduling.\nIf empty, then the platform filter is off, meaning there are no\nscheduling restrictions.\n", + "items": { + "type": "object", + "properties": { + "Architecture": { + "type": "string", + "description": "Architecture represents the hardware architecture (for example,\n`x86_64`).\n", + "example": "x86_64" + }, + "OS": { + "type": "string", + "description": "OS represents the Operating System (for example, `linux` or `windows`).\n", + "example": "linux" + } + }, + "description": "Platform represents the platform (Arch/OS).\n" + } + } + } + }, + "ForceUpdate": { + "type": "integer", + "description": "A counter that triggers an update even if no relevant parameters have\nbeen changed.\n" + }, + "Runtime": { + "type": "string", + "description": "Runtime is the type of runtime specified for the task executor.\n" + }, + "Networks": { + "type": "array", + "description": "Specifies which networks the service should attach to.", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "The target network for attachment. Must be a network name or ID.\n" + }, + "Aliases": { + "type": "array", + "description": "Discoverable alternate names for the service on this network.\n", + "items": { + "type": "string" + } + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver attachment options for the network target.\n" + } + }, + "description": "Specifies how a service should be attached to a particular network.\n" + } + }, + "LogDriver": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "description": "Specifies the log driver to use for tasks created from this spec. If\nnot present, the default one for the swarm will be used, finally\nfalling back to the engine default if not specified.\n" + } + }, + "description": "User modifiable task configuration." + }, + "Mode": { + "type": "object", + "properties": { + "Replicated": { + "type": "object", + "properties": { + "Replicas": { + "type": "integer", + "format": "int64" + } + } + }, + "Global": { + "type": "object", + "properties": {} + }, + "ReplicatedJob": { + "type": "object", + "properties": { + "MaxConcurrent": { + "type": "integer", + "description": "The maximum number of replicas to run simultaneously.\n", + "format": "int64", + "default": 1 + }, + "TotalCompletions": { + "type": "integer", + "description": "The total number of replicas desired to reach the Completed\nstate. If unset, will default to the value of `MaxConcurrent`\n", + "format": "int64" + } + }, + "description": "The mode used for services with a finite number of tasks that run\nto a completed state.\n" + }, + "GlobalJob": { + "type": "object", + "properties": {}, + "description": "The mode used for services which run a task to the completed state\non each valid node.\n" + } + }, + "description": "Scheduling mode for the service." + }, + "UpdateConfig": { + "type": "object", + "properties": { + "Parallelism": { + "type": "integer", + "description": "Maximum number of tasks to be updated in one iteration (0 means\nunlimited parallelism).\n", + "format": "int64" + }, + "Delay": { + "type": "integer", + "description": "Amount of time between updates, in nanoseconds.", + "format": "int64" + }, + "FailureAction": { + "type": "string", + "description": "Action to take if an updated task fails to run, or stops running\nduring the update.\n", + "enum": [ + "continue", + "pause", + "rollback" + ] + }, + "Monitor": { + "type": "integer", + "description": "Amount of time to monitor each updated task for failures, in\nnanoseconds.\n", + "format": "int64" + }, + "MaxFailureRatio": { + "type": "number", + "description": "The fraction of tasks that may fail during an update before the\nfailure action is invoked, specified as a floating point number\nbetween 0 and 1.\n" + }, + "Order": { + "type": "string", + "description": "The order of operations when rolling out an updated task. Either\nthe old task is shut down before the new task is started, or the\nnew task is started before the old task is shut down.\n", + "enum": [ + "stop-first", + "start-first" + ] + } + }, + "description": "Specification for the update strategy of the service." + }, + "RollbackConfig": { + "type": "object", + "properties": { + "Parallelism": { + "type": "integer", + "description": "Maximum number of tasks to be rolled back in one iteration (0 means\nunlimited parallelism).\n", + "format": "int64" + }, + "Delay": { + "type": "integer", + "description": "Amount of time between rollback iterations, in nanoseconds.\n", + "format": "int64" + }, + "FailureAction": { + "type": "string", + "description": "Action to take if an rolled back task fails to run, or stops\nrunning during the rollback.\n", + "enum": [ + "continue", + "pause" + ] + }, + "Monitor": { + "type": "integer", + "description": "Amount of time to monitor each rolled back task for failures, in\nnanoseconds.\n", + "format": "int64" + }, + "MaxFailureRatio": { + "type": "number", + "description": "The fraction of tasks that may fail during a rollback before the\nfailure action is invoked, specified as a floating point number\nbetween 0 and 1.\n" + }, + "Order": { + "type": "string", + "description": "The order of operations when rolling back a task. Either the old\ntask is shut down before the new task is started, or the new task\nis started before the old task is shut down.\n", + "enum": [ + "stop-first", + "start-first" + ] + } + }, + "description": "Specification for the rollback strategy of the service." + }, + "Networks": { + "type": "array", + "description": "Specifies which networks the service should attach to.", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "The target network for attachment. Must be a network name or ID.\n" + }, + "Aliases": { + "type": "array", + "description": "Discoverable alternate names for the service on this network.\n", + "items": { + "type": "string" + } + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver attachment options for the network target.\n" + } + }, + "description": "Specifies how a service should be attached to a particular network.\n" + } + }, + "EndpointSpec": { + "type": "object", + "properties": { + "Mode": { + "type": "string", + "description": "The mode of resolution to use for internal load balancing between tasks.\n", + "default": "vip", + "enum": [ + "vip", + "dnsrr" + ] + }, + "Ports": { + "type": "array", + "description": "List of exposed ports that this service is accessible on from the\noutside. Ports can only be provided if `vip` resolution mode is used.\n", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Protocol": { + "type": "string", + "enum": [ + "tcp", + "udp", + "sctp" + ] + }, + "TargetPort": { + "type": "integer", + "description": "The port inside the container." + }, + "PublishedPort": { + "type": "integer", + "description": "The port on the swarm hosts." + }, + "PublishMode": { + "type": "string", + "description": "The mode in which port is published.\n\n


\n\n- \"ingress\" makes the target port accessible on every node,\n regardless of whether there is a task for the service running on\n that node or not.\n- \"host\" bypasses the routing mesh and publish the port directly on\n the swarm node where that service is running.\n", + "example": "ingress", + "default": "ingress", + "enum": [ + "ingress", + "host" + ] + } + } + } + } + }, + "description": "Properties that can be configured to access and load balance a service." + } + }, + "description": "User modifiable configuration for a service." + }, + "Endpoint": { + "type": "object", + "properties": { + "Spec": { + "type": "object", + "properties": { + "Mode": { + "type": "string", + "description": "The mode of resolution to use for internal load balancing between tasks.\n", + "default": "vip", + "enum": [ + "vip", + "dnsrr" + ] + }, + "Ports": { + "type": "array", + "description": "List of exposed ports that this service is accessible on from the\noutside. Ports can only be provided if `vip` resolution mode is used.\n", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Protocol": { + "type": "string", + "enum": [ + "tcp", + "udp", + "sctp" + ] + }, + "TargetPort": { + "type": "integer", + "description": "The port inside the container." + }, + "PublishedPort": { + "type": "integer", + "description": "The port on the swarm hosts." + }, + "PublishMode": { + "type": "string", + "description": "The mode in which port is published.\n\n


\n\n- \"ingress\" makes the target port accessible on every node,\n regardless of whether there is a task for the service running on\n that node or not.\n- \"host\" bypasses the routing mesh and publish the port directly on\n the swarm node where that service is running.\n", + "example": "ingress", + "default": "ingress", + "enum": [ + "ingress", + "host" + ] + } + } + } + } + }, + "description": "Properties that can be configured to access and load balance a service." + }, + "Ports": { + "type": "array", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Protocol": { + "type": "string", + "enum": [ + "tcp", + "udp", + "sctp" + ] + }, + "TargetPort": { + "type": "integer", + "description": "The port inside the container." + }, + "PublishedPort": { + "type": "integer", + "description": "The port on the swarm hosts." + }, + "PublishMode": { + "type": "string", + "description": "The mode in which port is published.\n\n


\n\n- \"ingress\" makes the target port accessible on every node,\n regardless of whether there is a task for the service running on\n that node or not.\n- \"host\" bypasses the routing mesh and publish the port directly on\n the swarm node where that service is running.\n", + "example": "ingress", + "default": "ingress", + "enum": [ + "ingress", + "host" + ] + } + } + } + }, + "VirtualIPs": { + "type": "array", + "items": { + "type": "object", + "properties": { + "NetworkID": { + "type": "string" + }, + "Addr": { + "type": "string" + } + } + } + } + } + }, + "UpdateStatus": { + "type": "object", + "properties": { + "State": { + "type": "string", + "enum": [ + "updating", + "paused", + "completed" + ] + }, + "StartedAt": { + "type": "string", + "format": "dateTime" + }, + "CompletedAt": { + "type": "string", + "format": "dateTime" + }, + "Message": { + "type": "string" + } + }, + "description": "The status of a service update." + }, + "ServiceStatus": { + "type": "object", + "properties": { + "RunningTasks": { + "type": "integer", + "description": "The number of tasks for the service currently in the Running state.\n", + "format": "uint64", + "example": 7 + }, + "DesiredTasks": { + "type": "integer", + "description": "The number of tasks for the service desired to be running.\nFor replicated services, this is the replica count from the\nservice spec. For global services, this is computed by taking\ncount of all tasks for the service with a Desired State other\nthan Shutdown.\n", + "format": "uint64", + "example": 10 + }, + "CompletedTasks": { + "type": "integer", + "description": "The number of tasks for a job that are in the Completed state.\nThis field must be cross-referenced with the service type, as the\nvalue of 0 may mean the service is not in a job mode, or it may\nmean the job-mode service has no tasks yet Completed.\n", + "format": "uint64" + } + }, + "description": "The status of the service's tasks. Provided only when requested as\npart of a ServiceList operation.\n" + }, + "JobStatus": { + "type": "object", + "properties": { + "JobIteration": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "LastExecution": { + "type": "string", + "description": "The last time, as observed by the server, that this job was\nstarted.\n", + "format": "dateTime" + } + }, + "description": "The status of the service when it is in one of ReplicatedJob or\nGlobalJob modes. Absent on Replicated and Global mode services. The\nJobIteration is an ObjectVersion, but unlike the Service's version,\ndoes not need to be sent with an update request.\n" + } + }, + "example": { + "ID": "9mnpnzenvg8p8tdbtq4wvbkcz", + "Version": { + "Index": 19 + }, + "CreatedAt": "2016-06-07T21:05:51.880065305Z", + "UpdatedAt": "2016-06-07T21:07:29.962229872Z", + "Spec": { + "Name": "hopeful_cori", + "TaskTemplate": { + "ContainerSpec": { + "Image": "redis" + }, + "Resources": { + "Limits": {}, + "Reservations": {} + }, + "RestartPolicy": { + "Condition": "any", + "MaxAttempts": 0 + }, + "Placement": {}, + "ForceUpdate": 0 + }, + "Mode": { + "Replicated": { + "Replicas": 1 + } + }, + "UpdateConfig": { + "Parallelism": 1, + "Delay": 1000000000, + "FailureAction": "pause", + "Monitor": 15000000000, + "MaxFailureRatio": 0.15 + }, + "RollbackConfig": { + "Parallelism": 1, + "Delay": 1000000000, + "FailureAction": "pause", + "Monitor": 15000000000, + "MaxFailureRatio": 0.15 + }, + "EndpointSpec": { + "Mode": "vip", + "Ports": [ + { + "Protocol": "tcp", + "TargetPort": 6379, + "PublishedPort": 30001 + } + ] + } + }, + "Endpoint": { + "Spec": { + "Mode": "vip", + "Ports": [ + { + "Protocol": "tcp", + "TargetPort": 6379, + "PublishedPort": 30001 + } + ] + }, + "Ports": [ + { + "Protocol": "tcp", + "TargetPort": 6379, + "PublishedPort": 30001 + } + ], + "VirtualIPs": [ + { + "NetworkID": "4qvuz4ko70xaltuqbt8956gd1", + "Addr": "10.255.0.2/16" + }, + { + "NetworkID": "4qvuz4ko70xaltuqbt8956gd1", + "Addr": "10.255.0.3/16" + } + ] + } + } + } + } + }, + "text/plain": { + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "ID": { + "type": "string" + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "format": "dateTime" + }, + "UpdatedAt": { + "type": "string", + "format": "dateTime" + }, + "Spec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the service." + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "TaskTemplate": { + "type": "object", + "properties": { + "PluginSpec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "The name or 'alias' to use for the plugin." + }, + "Remote": { + "type": "string", + "description": "The plugin image reference to use." + }, + "Disabled": { + "type": "boolean", + "description": "Disable the plugin once scheduled." + }, + "PluginPrivilege": { + "type": "array", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "example": "network" + }, + "Description": { + "type": "string" + }, + "Value": { + "type": "array", + "example": [ + "host" + ], + "items": { + "type": "string" + } + } + }, + "description": "Describes a permission the user has to accept upon installing\nthe plugin.\n", + "x-go-name": "PluginPrivilege" + } + } + }, + "description": "Plugin spec for the service. *(Experimental release only.)*\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "ContainerSpec": { + "type": "object", + "properties": { + "Image": { + "type": "string", + "description": "The image name to use for the container" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value data." + }, + "Command": { + "type": "array", + "description": "The command to be run in the image.", + "items": { + "type": "string" + } + }, + "Args": { + "type": "array", + "description": "Arguments to the command.", + "items": { + "type": "string" + } + }, + "Hostname": { + "type": "string", + "description": "The hostname to use for the container, as a valid\n[RFC 1123](https://tools.ietf.org/html/rfc1123) hostname.\n" + }, + "Env": { + "type": "array", + "description": "A list of environment variables in the form `VAR=value`.\n", + "items": { + "type": "string" + } + }, + "Dir": { + "type": "string", + "description": "The working directory for commands to run in." + }, + "User": { + "type": "string", + "description": "The user inside the container." + }, + "Groups": { + "type": "array", + "description": "A list of additional groups that the container process will run as.\n", + "items": { + "type": "string" + } + }, + "Privileges": { + "type": "object", + "properties": { + "CredentialSpec": { + "type": "object", + "properties": { + "Config": { + "type": "string", + "description": "Load credential spec from a Swarm Config with the given ID.\nThe specified config must also be present in the Configs\nfield with the Runtime property set.\n\n


\n\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n", + "example": "0bt9dmxjvjiqermk6xrop3ekq" + }, + "File": { + "type": "string", + "description": "Load credential spec from this file. The file is read by\nthe daemon, and must be present in the `CredentialSpecs`\nsubdirectory in the docker data directory, which defaults\nto `C:\\ProgramData\\Docker\\` on Windows.\n\nFor example, specifying `spec.json` loads\n`C:\\ProgramData\\Docker\\CredentialSpecs\\spec.json`.\n\n


\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n", + "example": "spec.json" + }, + "Registry": { + "type": "string", + "description": "Load credential spec from this value in the Windows\nregistry. The specified registry value must be located in:\n\n`HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Virtualization\\Containers\\CredentialSpecs`\n\n


\n\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n" + } + }, + "description": "CredentialSpec for managed service account (Windows only)" + }, + "SELinuxContext": { + "type": "object", + "properties": { + "Disable": { + "type": "boolean", + "description": "Disable SELinux" + }, + "User": { + "type": "string", + "description": "SELinux user label" + }, + "Role": { + "type": "string", + "description": "SELinux role label" + }, + "Type": { + "type": "string", + "description": "SELinux type label" + }, + "Level": { + "type": "string", + "description": "SELinux level label" + } + }, + "description": "SELinux labels of the container" + } + }, + "description": "Security options for the container" + }, + "TTY": { + "type": "boolean", + "description": "Whether a pseudo-TTY should be allocated." + }, + "OpenStdin": { + "type": "boolean", + "description": "Open `stdin`" + }, + "ReadOnly": { + "type": "boolean", + "description": "Mount the container's root filesystem as read only." + }, + "Mounts": { + "type": "array", + "description": "Specification for mounts to be added to containers created as part\nof the service.\n", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "Container path." + }, + "Source": { + "type": "string", + "description": "Mount source (e.g. a volume name, a host path)." + }, + "Type": { + "type": "string", + "description": "The mount type. Available types:\n\n- `bind` Mounts a file or directory from the host into the container. Must exist prior to creating the container.\n- `volume` Creates a volume with the given name and options (or uses a pre-existing volume with the same name and options). These are **not** removed when the container is removed.\n- `tmpfs` Create a tmpfs with the given options. The mount source cannot be specified for tmpfs.\n- `npipe` Mounts a named pipe from the host into the container. Must exist prior to creating the container.\n- `cluster` a Swarm cluster volume\n", + "enum": [ + "bind", + "volume", + "tmpfs", + "npipe", + "cluster" + ] + }, + "ReadOnly": { + "type": "boolean", + "description": "Whether the mount should be read-only." + }, + "Consistency": { + "type": "string", + "description": "The consistency requirement for the mount: `default`, `consistent`, `cached`, or `delegated`." + }, + "BindOptions": { + "type": "object", + "properties": { + "Propagation": { + "type": "string", + "description": "A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`.", + "enum": [ + "private", + "rprivate", + "shared", + "rshared", + "slave", + "rslave" + ] + }, + "NonRecursive": { + "type": "boolean", + "description": "Disable recursive bind mount.", + "default": false + }, + "CreateMountpoint": { + "type": "boolean", + "description": "Create mount point on host if missing", + "default": false + } + }, + "description": "Optional configuration for the `bind` type." + }, + "VolumeOptions": { + "type": "object", + "properties": { + "NoCopy": { + "type": "boolean", + "description": "Populate volume with data from the target.", + "default": false + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "DriverConfig": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver to use to create the volume." + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "key/value map of driver specific options." + } + }, + "description": "Map of driver specific options" + } + }, + "description": "Optional configuration for the `volume` type." + }, + "TmpfsOptions": { + "type": "object", + "properties": { + "SizeBytes": { + "type": "integer", + "description": "The size for the tmpfs mount in bytes.", + "format": "int64" + }, + "Mode": { + "type": "integer", + "description": "The permission mode for the tmpfs mount in an integer." + } + }, + "description": "Optional configuration for the `tmpfs` type." + } + } + } + }, + "StopSignal": { + "type": "string", + "description": "Signal to stop the container." + }, + "StopGracePeriod": { + "type": "integer", + "description": "Amount of time to wait for the container to terminate before\nforcefully killing it.\n", + "format": "int64" + }, + "HealthCheck": { + "type": "object", + "properties": { + "Test": { + "type": "array", + "description": "The test to perform. Possible values are:\n\n- `[]` inherit healthcheck from image or parent image\n- `[\"NONE\"]` disable healthcheck\n- `[\"CMD\", args...]` exec arguments directly\n- `[\"CMD-SHELL\", command]` run command with system's default shell\n", + "items": { + "type": "string" + } + }, + "Interval": { + "type": "integer", + "description": "The time to wait between checks in nanoseconds. It should be 0 or at\nleast 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Timeout": { + "type": "integer", + "description": "The time to wait before considering the check to have hung. It should\nbe 0 or at least 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Retries": { + "type": "integer", + "description": "The number of consecutive failures needed to consider a container as\nunhealthy. 0 means inherit.\n" + }, + "StartPeriod": { + "type": "integer", + "description": "Start period for the container to initialize before starting\nhealth-retries countdown in nanoseconds. It should be 0 or at least\n1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + } + }, + "description": "A test to perform to check that the container is healthy." + }, + "Hosts": { + "type": "array", + "description": "A list of hostname/IP mappings to add to the container's `hosts`\nfile. The format of extra hosts is specified in the\n[hosts(5)](http://man7.org/linux/man-pages/man5/hosts.5.html)\nman page:\n\n IP_address canonical_hostname [aliases...]\n", + "items": { + "type": "string" + } + }, + "DNSConfig": { + "type": "object", + "properties": { + "Nameservers": { + "type": "array", + "description": "The IP addresses of the name servers.", + "items": { + "type": "string" + } + }, + "Search": { + "type": "array", + "description": "A search list for host-name lookup.", + "items": { + "type": "string" + } + }, + "Options": { + "type": "array", + "description": "A list of internal resolver variables to be modified (e.g.,\n`debug`, `ndots:3`, etc.).\n", + "items": { + "type": "string" + } + } + }, + "description": "Specification for DNS related configurations in resolver configuration\nfile (`resolv.conf`).\n" + }, + "Secrets": { + "type": "array", + "description": "Secrets contains references to zero or more secrets that will be\nexposed to the service.\n", + "items": { + "type": "object", + "properties": { + "File": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name represents the final filename in the filesystem.\n" + }, + "UID": { + "type": "string", + "description": "UID represents the file UID." + }, + "GID": { + "type": "string", + "description": "GID represents the file GID." + }, + "Mode": { + "type": "integer", + "description": "Mode represents the FileMode of the file.", + "format": "uint32" + } + }, + "description": "File represents a specific target that is backed by a file.\n" + }, + "SecretID": { + "type": "string", + "description": "SecretID represents the ID of the specific secret that we're\nreferencing.\n" + }, + "SecretName": { + "type": "string", + "description": "SecretName is the name of the secret that this references,\nbut this is just provided for lookup/display purposes. The\nsecret in the reference will be identified by its ID.\n" + } + } + } + }, + "Configs": { + "type": "array", + "description": "Configs contains references to zero or more configs that will be\nexposed to the service.\n", + "items": { + "type": "object", + "properties": { + "File": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name represents the final filename in the filesystem.\n" + }, + "UID": { + "type": "string", + "description": "UID represents the file UID." + }, + "GID": { + "type": "string", + "description": "GID represents the file GID." + }, + "Mode": { + "type": "integer", + "description": "Mode represents the FileMode of the file.", + "format": "uint32" + } + }, + "description": "File represents a specific target that is backed by a file.\n\n


\n\n> **Note**: `Configs.File` and `Configs.Runtime` are mutually exclusive\n" + }, + "Runtime": { + "type": "object", + "properties": {}, + "description": "Runtime represents a target that is not mounted into the\ncontainer but is used by the task\n\n


\n\n> **Note**: `Configs.File` and `Configs.Runtime` are mutually\n> exclusive\n" + }, + "ConfigID": { + "type": "string", + "description": "ConfigID represents the ID of the specific config that we're\nreferencing.\n" + }, + "ConfigName": { + "type": "string", + "description": "ConfigName is the name of the config that this references,\nbut this is just provided for lookup/display purposes. The\nconfig in the reference will be identified by its ID.\n" + } + } + } + }, + "Isolation": { + "type": "string", + "description": "Isolation technology of the containers running the service.\n(Windows only)\n", + "enum": [ + "default", + "process", + "hyperv", + "" + ] + }, + "Init": { + "type": "boolean", + "description": "Run an init inside the container that forwards signals and reaps\nprocesses. This field is omitted if empty, and the default (as\nconfigured on the daemon) is used.\n", + "nullable": true + }, + "Sysctls": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Set kernel namedspaced parameters (sysctls) in the container.\nThe Sysctls option on services accepts the same sysctls as the\nare supported on containers. Note that while the same sysctls are\nsupported, no guarantees or checks are made about their\nsuitability for a clustered environment, and it's up to the user\nto determine whether a given sysctl will work properly in a\nService.\n" + }, + "CapabilityAdd": { + "type": "array", + "description": "A list of kernel capabilities to add to the default set\nfor the container.\n", + "example": [ + "CAP_NET_RAW", + "CAP_SYS_ADMIN", + "CAP_SYS_CHROOT", + "CAP_SYSLOG" + ], + "items": { + "type": "string" + } + }, + "CapabilityDrop": { + "type": "array", + "description": "A list of kernel capabilities to drop from the default set\nfor the container.\n", + "example": [ + "CAP_NET_RAW" + ], + "items": { + "type": "string" + } + }, + "Ulimits": { + "type": "array", + "description": "A list of resource limits to set in the container. For example: `{\"Name\": \"nofile\", \"Soft\": 1024, \"Hard\": 2048}`\"\n", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of ulimit" + }, + "Soft": { + "type": "integer", + "description": "Soft limit" + }, + "Hard": { + "type": "integer", + "description": "Hard limit" + } + } + } + } + }, + "description": "Container spec for the service.\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "NetworkAttachmentSpec": { + "type": "object", + "properties": { + "ContainerID": { + "type": "string", + "description": "ID of the container represented by this task" + } + }, + "description": "Read-only spec type for non-swarm containers attached to swarm overlay\nnetworks.\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "Resources": { + "type": "object", + "properties": { + "Limits": { + "type": "object", + "properties": { + "NanoCPUs": { + "type": "integer", + "format": "int64", + "example": 4000000000 + }, + "MemoryBytes": { + "type": "integer", + "format": "int64", + "example": 8272408576 + }, + "Pids": { + "type": "integer", + "description": "Limits the maximum number of PIDs in the container. Set `0` for unlimited.\n", + "format": "int64", + "example": 100, + "default": 0 + } + }, + "description": "An object describing a limit on resources which can be requested by a task.\n" + }, + "Reservations": { + "type": "object", + "properties": { + "NanoCPUs": { + "type": "integer", + "format": "int64", + "example": 4000000000 + }, + "MemoryBytes": { + "type": "integer", + "format": "int64", + "example": 8272408576 + }, + "GenericResources": { + "type": "array", + "description": "User-defined resources can be either Integer resources (e.g, `SSD=3`) or\nString resources (e.g, `GPU=UUID1`).\n", + "example": [ + { + "DiscreteResourceSpec": { + "Kind": "SSD", + "Value": 3 + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID1" + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID2" + } + } + ], + "items": { + "type": "object", + "properties": { + "NamedResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + }, + "DiscreteResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "integer", + "format": "int64" + } + } + } + } + } + } + }, + "description": "An object describing the resources which can be advertised by a node and\nrequested by a task.\n" + } + }, + "description": "Resource requirements which apply to each individual container created\nas part of the service.\n" + }, + "RestartPolicy": { + "type": "object", + "properties": { + "Condition": { + "type": "string", + "description": "Condition for restart.", + "enum": [ + "none", + "on-failure", + "any" + ] + }, + "Delay": { + "type": "integer", + "description": "Delay between restart attempts.", + "format": "int64" + }, + "MaxAttempts": { + "type": "integer", + "description": "Maximum attempts to restart a given container before giving up\n(default value is 0, which is ignored).\n", + "format": "int64", + "default": 0 + }, + "Window": { + "type": "integer", + "description": "Windows is the time window used to evaluate the restart policy\n(default value is 0, which is unbounded).\n", + "format": "int64", + "default": 0 + } + }, + "description": "Specification for the restart policy which applies to containers\ncreated as part of this service.\n" + }, + "Placement": { + "type": "object", + "properties": { + "Constraints": { + "type": "array", + "description": "An array of constraint expressions to limit the set of nodes where\na task can be scheduled. Constraint expressions can either use a\n_match_ (`==`) or _exclude_ (`!=`) rule. Multiple constraints find\nnodes that satisfy every expression (AND match). Constraints can\nmatch node or Docker Engine labels as follows:\n\nnode attribute | matches | example\n---------------------|--------------------------------|-----------------------------------------------\n`node.id` | Node ID | `node.id==2ivku8v2gvtg4`\n`node.hostname` | Node hostname | `node.hostname!=node-2`\n`node.role` | Node role (`manager`/`worker`) | `node.role==manager`\n`node.platform.os` | Node operating system | `node.platform.os==windows`\n`node.platform.arch` | Node architecture | `node.platform.arch==x86_64`\n`node.labels` | User-defined node labels | `node.labels.security==high`\n`engine.labels` | Docker Engine's labels | `engine.labels.operatingsystem==ubuntu-14.04`\n\n`engine.labels` apply to Docker Engine labels like operating system,\ndrivers, etc. Swarm administrators add `node.labels` for operational\npurposes by using the [`node update endpoint`](#operation/NodeUpdate).\n", + "example": [ + "node.hostname!=node3.corp.example.com", + "node.role!=manager", + "node.labels.type==production", + "node.platform.os==linux", + "node.platform.arch==x86_64" + ], + "items": { + "type": "string" + } + }, + "Preferences": { + "type": "array", + "description": "Preferences provide a way to make the scheduler aware of factors\nsuch as topology. They are provided in order from highest to\nlowest precedence.\n", + "example": [ + { + "Spread": { + "SpreadDescriptor": "node.labels.datacenter" + } + }, + { + "Spread": { + "SpreadDescriptor": "node.labels.rack" + } + } + ], + "items": { + "type": "object", + "properties": { + "Spread": { + "type": "object", + "properties": { + "SpreadDescriptor": { + "type": "string", + "description": "label descriptor, such as `engine.labels.az`.\n" + } + } + } + } + } + }, + "MaxReplicas": { + "type": "integer", + "description": "Maximum number of replicas for per node (default value is 0, which\nis unlimited)\n", + "format": "int64", + "default": 0 + }, + "Platforms": { + "type": "array", + "description": "Platforms stores all the platforms that the service's image can\nrun on. This field is used in the platform filter for scheduling.\nIf empty, then the platform filter is off, meaning there are no\nscheduling restrictions.\n", + "items": { + "type": "object", + "properties": { + "Architecture": { + "type": "string", + "description": "Architecture represents the hardware architecture (for example,\n`x86_64`).\n", + "example": "x86_64" + }, + "OS": { + "type": "string", + "description": "OS represents the Operating System (for example, `linux` or `windows`).\n", + "example": "linux" + } + }, + "description": "Platform represents the platform (Arch/OS).\n" + } + } + } + }, + "ForceUpdate": { + "type": "integer", + "description": "A counter that triggers an update even if no relevant parameters have\nbeen changed.\n" + }, + "Runtime": { + "type": "string", + "description": "Runtime is the type of runtime specified for the task executor.\n" + }, + "Networks": { + "type": "array", + "description": "Specifies which networks the service should attach to.", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "The target network for attachment. Must be a network name or ID.\n" + }, + "Aliases": { + "type": "array", + "description": "Discoverable alternate names for the service on this network.\n", + "items": { + "type": "string" + } + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver attachment options for the network target.\n" + } + }, + "description": "Specifies how a service should be attached to a particular network.\n" + } + }, + "LogDriver": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "description": "Specifies the log driver to use for tasks created from this spec. If\nnot present, the default one for the swarm will be used, finally\nfalling back to the engine default if not specified.\n" + } + }, + "description": "User modifiable task configuration." + }, + "Mode": { + "type": "object", + "properties": { + "Replicated": { + "type": "object", + "properties": { + "Replicas": { + "type": "integer", + "format": "int64" + } + } + }, + "Global": { + "type": "object", + "properties": {} + }, + "ReplicatedJob": { + "type": "object", + "properties": { + "MaxConcurrent": { + "type": "integer", + "description": "The maximum number of replicas to run simultaneously.\n", + "format": "int64", + "default": 1 + }, + "TotalCompletions": { + "type": "integer", + "description": "The total number of replicas desired to reach the Completed\nstate. If unset, will default to the value of `MaxConcurrent`\n", + "format": "int64" + } + }, + "description": "The mode used for services with a finite number of tasks that run\nto a completed state.\n" + }, + "GlobalJob": { + "type": "object", + "properties": {}, + "description": "The mode used for services which run a task to the completed state\non each valid node.\n" + } + }, + "description": "Scheduling mode for the service." + }, + "UpdateConfig": { + "type": "object", + "properties": { + "Parallelism": { + "type": "integer", + "description": "Maximum number of tasks to be updated in one iteration (0 means\nunlimited parallelism).\n", + "format": "int64" + }, + "Delay": { + "type": "integer", + "description": "Amount of time between updates, in nanoseconds.", + "format": "int64" + }, + "FailureAction": { + "type": "string", + "description": "Action to take if an updated task fails to run, or stops running\nduring the update.\n", + "enum": [ + "continue", + "pause", + "rollback" + ] + }, + "Monitor": { + "type": "integer", + "description": "Amount of time to monitor each updated task for failures, in\nnanoseconds.\n", + "format": "int64" + }, + "MaxFailureRatio": { + "type": "number", + "description": "The fraction of tasks that may fail during an update before the\nfailure action is invoked, specified as a floating point number\nbetween 0 and 1.\n" + }, + "Order": { + "type": "string", + "description": "The order of operations when rolling out an updated task. Either\nthe old task is shut down before the new task is started, or the\nnew task is started before the old task is shut down.\n", + "enum": [ + "stop-first", + "start-first" + ] + } + }, + "description": "Specification for the update strategy of the service." + }, + "RollbackConfig": { + "type": "object", + "properties": { + "Parallelism": { + "type": "integer", + "description": "Maximum number of tasks to be rolled back in one iteration (0 means\nunlimited parallelism).\n", + "format": "int64" + }, + "Delay": { + "type": "integer", + "description": "Amount of time between rollback iterations, in nanoseconds.\n", + "format": "int64" + }, + "FailureAction": { + "type": "string", + "description": "Action to take if an rolled back task fails to run, or stops\nrunning during the rollback.\n", + "enum": [ + "continue", + "pause" + ] + }, + "Monitor": { + "type": "integer", + "description": "Amount of time to monitor each rolled back task for failures, in\nnanoseconds.\n", + "format": "int64" + }, + "MaxFailureRatio": { + "type": "number", + "description": "The fraction of tasks that may fail during a rollback before the\nfailure action is invoked, specified as a floating point number\nbetween 0 and 1.\n" + }, + "Order": { + "type": "string", + "description": "The order of operations when rolling back a task. Either the old\ntask is shut down before the new task is started, or the new task\nis started before the old task is shut down.\n", + "enum": [ + "stop-first", + "start-first" + ] + } + }, + "description": "Specification for the rollback strategy of the service." + }, + "Networks": { + "type": "array", + "description": "Specifies which networks the service should attach to.", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "The target network for attachment. Must be a network name or ID.\n" + }, + "Aliases": { + "type": "array", + "description": "Discoverable alternate names for the service on this network.\n", + "items": { + "type": "string" + } + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver attachment options for the network target.\n" + } + }, + "description": "Specifies how a service should be attached to a particular network.\n" + } + }, + "EndpointSpec": { + "type": "object", + "properties": { + "Mode": { + "type": "string", + "description": "The mode of resolution to use for internal load balancing between tasks.\n", + "default": "vip", + "enum": [ + "vip", + "dnsrr" + ] + }, + "Ports": { + "type": "array", + "description": "List of exposed ports that this service is accessible on from the\noutside. Ports can only be provided if `vip` resolution mode is used.\n", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Protocol": { + "type": "string", + "enum": [ + "tcp", + "udp", + "sctp" + ] + }, + "TargetPort": { + "type": "integer", + "description": "The port inside the container." + }, + "PublishedPort": { + "type": "integer", + "description": "The port on the swarm hosts." + }, + "PublishMode": { + "type": "string", + "description": "The mode in which port is published.\n\n


\n\n- \"ingress\" makes the target port accessible on every node,\n regardless of whether there is a task for the service running on\n that node or not.\n- \"host\" bypasses the routing mesh and publish the port directly on\n the swarm node where that service is running.\n", + "example": "ingress", + "default": "ingress", + "enum": [ + "ingress", + "host" + ] + } + } + } + } + }, + "description": "Properties that can be configured to access and load balance a service." + } + }, + "description": "User modifiable configuration for a service." + }, + "Endpoint": { + "type": "object", + "properties": { + "Spec": { + "type": "object", + "properties": { + "Mode": { + "type": "string", + "description": "The mode of resolution to use for internal load balancing between tasks.\n", + "default": "vip", + "enum": [ + "vip", + "dnsrr" + ] + }, + "Ports": { + "type": "array", + "description": "List of exposed ports that this service is accessible on from the\noutside. Ports can only be provided if `vip` resolution mode is used.\n", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Protocol": { + "type": "string", + "enum": [ + "tcp", + "udp", + "sctp" + ] + }, + "TargetPort": { + "type": "integer", + "description": "The port inside the container." + }, + "PublishedPort": { + "type": "integer", + "description": "The port on the swarm hosts." + }, + "PublishMode": { + "type": "string", + "description": "The mode in which port is published.\n\n


\n\n- \"ingress\" makes the target port accessible on every node,\n regardless of whether there is a task for the service running on\n that node or not.\n- \"host\" bypasses the routing mesh and publish the port directly on\n the swarm node where that service is running.\n", + "example": "ingress", + "default": "ingress", + "enum": [ + "ingress", + "host" + ] + } + } + } + } + }, + "description": "Properties that can be configured to access and load balance a service." + }, + "Ports": { + "type": "array", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Protocol": { + "type": "string", + "enum": [ + "tcp", + "udp", + "sctp" + ] + }, + "TargetPort": { + "type": "integer", + "description": "The port inside the container." + }, + "PublishedPort": { + "type": "integer", + "description": "The port on the swarm hosts." + }, + "PublishMode": { + "type": "string", + "description": "The mode in which port is published.\n\n


\n\n- \"ingress\" makes the target port accessible on every node,\n regardless of whether there is a task for the service running on\n that node or not.\n- \"host\" bypasses the routing mesh and publish the port directly on\n the swarm node where that service is running.\n", + "example": "ingress", + "default": "ingress", + "enum": [ + "ingress", + "host" + ] + } + } + } + }, + "VirtualIPs": { + "type": "array", + "items": { + "type": "object", + "properties": { + "NetworkID": { + "type": "string" + }, + "Addr": { + "type": "string" + } + } + } + } + } + }, + "UpdateStatus": { + "type": "object", + "properties": { + "State": { + "type": "string", + "enum": [ + "updating", + "paused", + "completed" + ] + }, + "StartedAt": { + "type": "string", + "format": "dateTime" + }, + "CompletedAt": { + "type": "string", + "format": "dateTime" + }, + "Message": { + "type": "string" + } + }, + "description": "The status of a service update." + }, + "ServiceStatus": { + "type": "object", + "properties": { + "RunningTasks": { + "type": "integer", + "description": "The number of tasks for the service currently in the Running state.\n", + "format": "uint64", + "example": 7 + }, + "DesiredTasks": { + "type": "integer", + "description": "The number of tasks for the service desired to be running.\nFor replicated services, this is the replica count from the\nservice spec. For global services, this is computed by taking\ncount of all tasks for the service with a Desired State other\nthan Shutdown.\n", + "format": "uint64", + "example": 10 + }, + "CompletedTasks": { + "type": "integer", + "description": "The number of tasks for a job that are in the Completed state.\nThis field must be cross-referenced with the service type, as the\nvalue of 0 may mean the service is not in a job mode, or it may\nmean the job-mode service has no tasks yet Completed.\n", + "format": "uint64" + } + }, + "description": "The status of the service's tasks. Provided only when requested as\npart of a ServiceList operation.\n" + }, + "JobStatus": { + "type": "object", + "properties": { + "JobIteration": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "LastExecution": { + "type": "string", + "description": "The last time, as observed by the server, that this job was\nstarted.\n", + "format": "dateTime" + } + }, + "description": "The status of the service when it is in one of ReplicatedJob or\nGlobalJob modes. Absent on Replicated and Global mode services. The\nJobIteration is an ObjectVersion, but unlike the Service's version,\ndoes not need to be sent with an update request.\n" + } + }, + "example": { + "ID": "9mnpnzenvg8p8tdbtq4wvbkcz", + "Version": { + "Index": 19 + }, + "CreatedAt": "2016-06-07T21:05:51.880065305Z", + "UpdatedAt": "2016-06-07T21:07:29.962229872Z", + "Spec": { + "Name": "hopeful_cori", + "TaskTemplate": { + "ContainerSpec": { + "Image": "redis" + }, + "Resources": { + "Limits": {}, + "Reservations": {} + }, + "RestartPolicy": { + "Condition": "any", + "MaxAttempts": 0 + }, + "Placement": {}, + "ForceUpdate": 0 + }, + "Mode": { + "Replicated": { + "Replicas": 1 + } + }, + "UpdateConfig": { + "Parallelism": 1, + "Delay": 1000000000, + "FailureAction": "pause", + "Monitor": 15000000000, + "MaxFailureRatio": 0.15 + }, + "RollbackConfig": { + "Parallelism": 1, + "Delay": 1000000000, + "FailureAction": "pause", + "Monitor": 15000000000, + "MaxFailureRatio": 0.15 + }, + "EndpointSpec": { + "Mode": "vip", + "Ports": [ + { + "Protocol": "tcp", + "TargetPort": 6379, + "PublishedPort": 30001 + } + ] + } + }, + "Endpoint": { + "Spec": { + "Mode": "vip", + "Ports": [ + { + "Protocol": "tcp", + "TargetPort": 6379, + "PublishedPort": 30001 + } + ] + }, + "Ports": [ + { + "Protocol": "tcp", + "TargetPort": 6379, + "PublishedPort": 30001 + } + ], + "VirtualIPs": [ + { + "NetworkID": "4qvuz4ko70xaltuqbt8956gd1", + "Addr": "10.255.0.2/16" + }, + { + "NetworkID": "4qvuz4ko70xaltuqbt8956gd1", + "Addr": "10.255.0.3/16" + } + ] + } + } + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "503": { + "description": "node is not part of a swarm", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/services/create": { + "post": { + "tags": [ + "Service" + ], + "summary": "Create a service", + "operationId": "ServiceCreate", + "parameters": [ + { + "name": "X-Registry-Auth", + "in": "header", + "description": "A base64url-encoded auth configuration for pulling from private\nregistries.\n\nRefer to the [authentication section](#section/Authentication) for\ndetails.\n", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the service." + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "TaskTemplate": { + "type": "object", + "properties": { + "PluginSpec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "The name or 'alias' to use for the plugin." + }, + "Remote": { + "type": "string", + "description": "The plugin image reference to use." + }, + "Disabled": { + "type": "boolean", + "description": "Disable the plugin once scheduled." + }, + "PluginPrivilege": { + "type": "array", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "example": "network" + }, + "Description": { + "type": "string" + }, + "Value": { + "type": "array", + "example": [ + "host" + ], + "items": { + "type": "string" + } + } + }, + "description": "Describes a permission the user has to accept upon installing\nthe plugin.\n", + "x-go-name": "PluginPrivilege" + } + } + }, + "description": "Plugin spec for the service. *(Experimental release only.)*\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "ContainerSpec": { + "type": "object", + "properties": { + "Image": { + "type": "string", + "description": "The image name to use for the container" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value data." + }, + "Command": { + "type": "array", + "description": "The command to be run in the image.", + "items": { + "type": "string" + } + }, + "Args": { + "type": "array", + "description": "Arguments to the command.", + "items": { + "type": "string" + } + }, + "Hostname": { + "type": "string", + "description": "The hostname to use for the container, as a valid\n[RFC 1123](https://tools.ietf.org/html/rfc1123) hostname.\n" + }, + "Env": { + "type": "array", + "description": "A list of environment variables in the form `VAR=value`.\n", + "items": { + "type": "string" + } + }, + "Dir": { + "type": "string", + "description": "The working directory for commands to run in." + }, + "User": { + "type": "string", + "description": "The user inside the container." + }, + "Groups": { + "type": "array", + "description": "A list of additional groups that the container process will run as.\n", + "items": { + "type": "string" + } + }, + "Privileges": { + "type": "object", + "properties": { + "CredentialSpec": { + "type": "object", + "properties": { + "Config": { + "type": "string", + "description": "Load credential spec from a Swarm Config with the given ID.\nThe specified config must also be present in the Configs\nfield with the Runtime property set.\n\n


\n\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n", + "example": "0bt9dmxjvjiqermk6xrop3ekq" + }, + "File": { + "type": "string", + "description": "Load credential spec from this file. The file is read by\nthe daemon, and must be present in the `CredentialSpecs`\nsubdirectory in the docker data directory, which defaults\nto `C:\\ProgramData\\Docker\\` on Windows.\n\nFor example, specifying `spec.json` loads\n`C:\\ProgramData\\Docker\\CredentialSpecs\\spec.json`.\n\n


\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n", + "example": "spec.json" + }, + "Registry": { + "type": "string", + "description": "Load credential spec from this value in the Windows\nregistry. The specified registry value must be located in:\n\n`HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Virtualization\\Containers\\CredentialSpecs`\n\n


\n\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n" + } + }, + "description": "CredentialSpec for managed service account (Windows only)" + }, + "SELinuxContext": { + "type": "object", + "properties": { + "Disable": { + "type": "boolean", + "description": "Disable SELinux" + }, + "User": { + "type": "string", + "description": "SELinux user label" + }, + "Role": { + "type": "string", + "description": "SELinux role label" + }, + "Type": { + "type": "string", + "description": "SELinux type label" + }, + "Level": { + "type": "string", + "description": "SELinux level label" + } + }, + "description": "SELinux labels of the container" + } + }, + "description": "Security options for the container" + }, + "TTY": { + "type": "boolean", + "description": "Whether a pseudo-TTY should be allocated." + }, + "OpenStdin": { + "type": "boolean", + "description": "Open `stdin`" + }, + "ReadOnly": { + "type": "boolean", + "description": "Mount the container's root filesystem as read only." + }, + "Mounts": { + "type": "array", + "description": "Specification for mounts to be added to containers created as part\nof the service.\n", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "Container path." + }, + "Source": { + "type": "string", + "description": "Mount source (e.g. a volume name, a host path)." + }, + "Type": { + "type": "string", + "description": "The mount type. Available types:\n\n- `bind` Mounts a file or directory from the host into the container. Must exist prior to creating the container.\n- `volume` Creates a volume with the given name and options (or uses a pre-existing volume with the same name and options). These are **not** removed when the container is removed.\n- `tmpfs` Create a tmpfs with the given options. The mount source cannot be specified for tmpfs.\n- `npipe` Mounts a named pipe from the host into the container. Must exist prior to creating the container.\n- `cluster` a Swarm cluster volume\n", + "enum": [ + "bind", + "volume", + "tmpfs", + "npipe", + "cluster" + ] + }, + "ReadOnly": { + "type": "boolean", + "description": "Whether the mount should be read-only." + }, + "Consistency": { + "type": "string", + "description": "The consistency requirement for the mount: `default`, `consistent`, `cached`, or `delegated`." + }, + "BindOptions": { + "type": "object", + "properties": { + "Propagation": { + "type": "string", + "description": "A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`.", + "enum": [ + "private", + "rprivate", + "shared", + "rshared", + "slave", + "rslave" + ] + }, + "NonRecursive": { + "type": "boolean", + "description": "Disable recursive bind mount.", + "default": false + }, + "CreateMountpoint": { + "type": "boolean", + "description": "Create mount point on host if missing", + "default": false + } + }, + "description": "Optional configuration for the `bind` type." + }, + "VolumeOptions": { + "type": "object", + "properties": { + "NoCopy": { + "type": "boolean", + "description": "Populate volume with data from the target.", + "default": false + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "DriverConfig": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver to use to create the volume." + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "key/value map of driver specific options." + } + }, + "description": "Map of driver specific options" + } + }, + "description": "Optional configuration for the `volume` type." + }, + "TmpfsOptions": { + "type": "object", + "properties": { + "SizeBytes": { + "type": "integer", + "description": "The size for the tmpfs mount in bytes.", + "format": "int64" + }, + "Mode": { + "type": "integer", + "description": "The permission mode for the tmpfs mount in an integer." + } + }, + "description": "Optional configuration for the `tmpfs` type." + } + } + } + }, + "StopSignal": { + "type": "string", + "description": "Signal to stop the container." + }, + "StopGracePeriod": { + "type": "integer", + "description": "Amount of time to wait for the container to terminate before\nforcefully killing it.\n", + "format": "int64" + }, + "HealthCheck": { + "type": "object", + "properties": { + "Test": { + "type": "array", + "description": "The test to perform. Possible values are:\n\n- `[]` inherit healthcheck from image or parent image\n- `[\"NONE\"]` disable healthcheck\n- `[\"CMD\", args...]` exec arguments directly\n- `[\"CMD-SHELL\", command]` run command with system's default shell\n", + "items": { + "type": "string" + } + }, + "Interval": { + "type": "integer", + "description": "The time to wait between checks in nanoseconds. It should be 0 or at\nleast 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Timeout": { + "type": "integer", + "description": "The time to wait before considering the check to have hung. It should\nbe 0 or at least 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Retries": { + "type": "integer", + "description": "The number of consecutive failures needed to consider a container as\nunhealthy. 0 means inherit.\n" + }, + "StartPeriod": { + "type": "integer", + "description": "Start period for the container to initialize before starting\nhealth-retries countdown in nanoseconds. It should be 0 or at least\n1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + } + }, + "description": "A test to perform to check that the container is healthy." + }, + "Hosts": { + "type": "array", + "description": "A list of hostname/IP mappings to add to the container's `hosts`\nfile. The format of extra hosts is specified in the\n[hosts(5)](http://man7.org/linux/man-pages/man5/hosts.5.html)\nman page:\n\n IP_address canonical_hostname [aliases...]\n", + "items": { + "type": "string" + } + }, + "DNSConfig": { + "type": "object", + "properties": { + "Nameservers": { + "type": "array", + "description": "The IP addresses of the name servers.", + "items": { + "type": "string" + } + }, + "Search": { + "type": "array", + "description": "A search list for host-name lookup.", + "items": { + "type": "string" + } + }, + "Options": { + "type": "array", + "description": "A list of internal resolver variables to be modified (e.g.,\n`debug`, `ndots:3`, etc.).\n", + "items": { + "type": "string" + } + } + }, + "description": "Specification for DNS related configurations in resolver configuration\nfile (`resolv.conf`).\n" + }, + "Secrets": { + "type": "array", + "description": "Secrets contains references to zero or more secrets that will be\nexposed to the service.\n", + "items": { + "type": "object", + "properties": { + "File": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name represents the final filename in the filesystem.\n" + }, + "UID": { + "type": "string", + "description": "UID represents the file UID." + }, + "GID": { + "type": "string", + "description": "GID represents the file GID." + }, + "Mode": { + "type": "integer", + "description": "Mode represents the FileMode of the file.", + "format": "uint32" + } + }, + "description": "File represents a specific target that is backed by a file.\n" + }, + "SecretID": { + "type": "string", + "description": "SecretID represents the ID of the specific secret that we're\nreferencing.\n" + }, + "SecretName": { + "type": "string", + "description": "SecretName is the name of the secret that this references,\nbut this is just provided for lookup/display purposes. The\nsecret in the reference will be identified by its ID.\n" + } + } + } + }, + "Configs": { + "type": "array", + "description": "Configs contains references to zero or more configs that will be\nexposed to the service.\n", + "items": { + "type": "object", + "properties": { + "File": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name represents the final filename in the filesystem.\n" + }, + "UID": { + "type": "string", + "description": "UID represents the file UID." + }, + "GID": { + "type": "string", + "description": "GID represents the file GID." + }, + "Mode": { + "type": "integer", + "description": "Mode represents the FileMode of the file.", + "format": "uint32" + } + }, + "description": "File represents a specific target that is backed by a file.\n\n


\n\n> **Note**: `Configs.File` and `Configs.Runtime` are mutually exclusive\n" + }, + "Runtime": { + "type": "object", + "properties": {}, + "description": "Runtime represents a target that is not mounted into the\ncontainer but is used by the task\n\n


\n\n> **Note**: `Configs.File` and `Configs.Runtime` are mutually\n> exclusive\n" + }, + "ConfigID": { + "type": "string", + "description": "ConfigID represents the ID of the specific config that we're\nreferencing.\n" + }, + "ConfigName": { + "type": "string", + "description": "ConfigName is the name of the config that this references,\nbut this is just provided for lookup/display purposes. The\nconfig in the reference will be identified by its ID.\n" + } + } + } + }, + "Isolation": { + "type": "string", + "description": "Isolation technology of the containers running the service.\n(Windows only)\n", + "enum": [ + "default", + "process", + "hyperv", + "" + ] + }, + "Init": { + "type": "boolean", + "description": "Run an init inside the container that forwards signals and reaps\nprocesses. This field is omitted if empty, and the default (as\nconfigured on the daemon) is used.\n", + "nullable": true + }, + "Sysctls": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Set kernel namedspaced parameters (sysctls) in the container.\nThe Sysctls option on services accepts the same sysctls as the\nare supported on containers. Note that while the same sysctls are\nsupported, no guarantees or checks are made about their\nsuitability for a clustered environment, and it's up to the user\nto determine whether a given sysctl will work properly in a\nService.\n" + }, + "CapabilityAdd": { + "type": "array", + "description": "A list of kernel capabilities to add to the default set\nfor the container.\n", + "example": [ + "CAP_NET_RAW", + "CAP_SYS_ADMIN", + "CAP_SYS_CHROOT", + "CAP_SYSLOG" + ], + "items": { + "type": "string" + } + }, + "CapabilityDrop": { + "type": "array", + "description": "A list of kernel capabilities to drop from the default set\nfor the container.\n", + "example": [ + "CAP_NET_RAW" + ], + "items": { + "type": "string" + } + }, + "Ulimits": { + "type": "array", + "description": "A list of resource limits to set in the container. For example: `{\"Name\": \"nofile\", \"Soft\": 1024, \"Hard\": 2048}`\"\n", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of ulimit" + }, + "Soft": { + "type": "integer", + "description": "Soft limit" + }, + "Hard": { + "type": "integer", + "description": "Hard limit" + } + } + } + } + }, + "description": "Container spec for the service.\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "NetworkAttachmentSpec": { + "type": "object", + "properties": { + "ContainerID": { + "type": "string", + "description": "ID of the container represented by this task" + } + }, + "description": "Read-only spec type for non-swarm containers attached to swarm overlay\nnetworks.\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "Resources": { + "type": "object", + "properties": { + "Limits": { + "type": "object", + "properties": { + "NanoCPUs": { + "type": "integer", + "format": "int64", + "example": 4000000000 + }, + "MemoryBytes": { + "type": "integer", + "format": "int64", + "example": 8272408576 + }, + "Pids": { + "type": "integer", + "description": "Limits the maximum number of PIDs in the container. Set `0` for unlimited.\n", + "format": "int64", + "example": 100, + "default": 0 + } + }, + "description": "An object describing a limit on resources which can be requested by a task.\n" + }, + "Reservations": { + "type": "object", + "properties": { + "NanoCPUs": { + "type": "integer", + "format": "int64", + "example": 4000000000 + }, + "MemoryBytes": { + "type": "integer", + "format": "int64", + "example": 8272408576 + }, + "GenericResources": { + "type": "array", + "description": "User-defined resources can be either Integer resources (e.g, `SSD=3`) or\nString resources (e.g, `GPU=UUID1`).\n", + "example": [ + { + "DiscreteResourceSpec": { + "Kind": "SSD", + "Value": 3 + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID1" + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID2" + } + } + ], + "items": { + "type": "object", + "properties": { + "NamedResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + }, + "DiscreteResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "integer", + "format": "int64" + } + } + } + } + } + } + }, + "description": "An object describing the resources which can be advertised by a node and\nrequested by a task.\n" + } + }, + "description": "Resource requirements which apply to each individual container created\nas part of the service.\n" + }, + "RestartPolicy": { + "type": "object", + "properties": { + "Condition": { + "type": "string", + "description": "Condition for restart.", + "enum": [ + "none", + "on-failure", + "any" + ] + }, + "Delay": { + "type": "integer", + "description": "Delay between restart attempts.", + "format": "int64" + }, + "MaxAttempts": { + "type": "integer", + "description": "Maximum attempts to restart a given container before giving up\n(default value is 0, which is ignored).\n", + "format": "int64", + "default": 0 + }, + "Window": { + "type": "integer", + "description": "Windows is the time window used to evaluate the restart policy\n(default value is 0, which is unbounded).\n", + "format": "int64", + "default": 0 + } + }, + "description": "Specification for the restart policy which applies to containers\ncreated as part of this service.\n" + }, + "Placement": { + "type": "object", + "properties": { + "Constraints": { + "type": "array", + "description": "An array of constraint expressions to limit the set of nodes where\na task can be scheduled. Constraint expressions can either use a\n_match_ (`==`) or _exclude_ (`!=`) rule. Multiple constraints find\nnodes that satisfy every expression (AND match). Constraints can\nmatch node or Docker Engine labels as follows:\n\nnode attribute | matches | example\n---------------------|--------------------------------|-----------------------------------------------\n`node.id` | Node ID | `node.id==2ivku8v2gvtg4`\n`node.hostname` | Node hostname | `node.hostname!=node-2`\n`node.role` | Node role (`manager`/`worker`) | `node.role==manager`\n`node.platform.os` | Node operating system | `node.platform.os==windows`\n`node.platform.arch` | Node architecture | `node.platform.arch==x86_64`\n`node.labels` | User-defined node labels | `node.labels.security==high`\n`engine.labels` | Docker Engine's labels | `engine.labels.operatingsystem==ubuntu-14.04`\n\n`engine.labels` apply to Docker Engine labels like operating system,\ndrivers, etc. Swarm administrators add `node.labels` for operational\npurposes by using the [`node update endpoint`](#operation/NodeUpdate).\n", + "example": [ + "node.hostname!=node3.corp.example.com", + "node.role!=manager", + "node.labels.type==production", + "node.platform.os==linux", + "node.platform.arch==x86_64" + ], + "items": { + "type": "string" + } + }, + "Preferences": { + "type": "array", + "description": "Preferences provide a way to make the scheduler aware of factors\nsuch as topology. They are provided in order from highest to\nlowest precedence.\n", + "example": [ + { + "Spread": { + "SpreadDescriptor": "node.labels.datacenter" + } + }, + { + "Spread": { + "SpreadDescriptor": "node.labels.rack" + } + } + ], + "items": { + "type": "object", + "properties": { + "Spread": { + "type": "object", + "properties": { + "SpreadDescriptor": { + "type": "string", + "description": "label descriptor, such as `engine.labels.az`.\n" + } + } + } + } + } + }, + "MaxReplicas": { + "type": "integer", + "description": "Maximum number of replicas for per node (default value is 0, which\nis unlimited)\n", + "format": "int64", + "default": 0 + }, + "Platforms": { + "type": "array", + "description": "Platforms stores all the platforms that the service's image can\nrun on. This field is used in the platform filter for scheduling.\nIf empty, then the platform filter is off, meaning there are no\nscheduling restrictions.\n", + "items": { + "type": "object", + "properties": { + "Architecture": { + "type": "string", + "description": "Architecture represents the hardware architecture (for example,\n`x86_64`).\n", + "example": "x86_64" + }, + "OS": { + "type": "string", + "description": "OS represents the Operating System (for example, `linux` or `windows`).\n", + "example": "linux" + } + }, + "description": "Platform represents the platform (Arch/OS).\n" + } + } + } + }, + "ForceUpdate": { + "type": "integer", + "description": "A counter that triggers an update even if no relevant parameters have\nbeen changed.\n" + }, + "Runtime": { + "type": "string", + "description": "Runtime is the type of runtime specified for the task executor.\n" + }, + "Networks": { + "type": "array", + "description": "Specifies which networks the service should attach to.", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "The target network for attachment. Must be a network name or ID.\n" + }, + "Aliases": { + "type": "array", + "description": "Discoverable alternate names for the service on this network.\n", + "items": { + "type": "string" + } + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver attachment options for the network target.\n" + } + }, + "description": "Specifies how a service should be attached to a particular network.\n" + } + }, + "LogDriver": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "description": "Specifies the log driver to use for tasks created from this spec. If\nnot present, the default one for the swarm will be used, finally\nfalling back to the engine default if not specified.\n" + } + }, + "description": "User modifiable task configuration." + }, + "Mode": { + "type": "object", + "properties": { + "Replicated": { + "type": "object", + "properties": { + "Replicas": { + "type": "integer", + "format": "int64" + } + } + }, + "Global": { + "type": "object", + "properties": {} + }, + "ReplicatedJob": { + "type": "object", + "properties": { + "MaxConcurrent": { + "type": "integer", + "description": "The maximum number of replicas to run simultaneously.\n", + "format": "int64", + "default": 1 + }, + "TotalCompletions": { + "type": "integer", + "description": "The total number of replicas desired to reach the Completed\nstate. If unset, will default to the value of `MaxConcurrent`\n", + "format": "int64" + } + }, + "description": "The mode used for services with a finite number of tasks that run\nto a completed state.\n" + }, + "GlobalJob": { + "type": "object", + "properties": {}, + "description": "The mode used for services which run a task to the completed state\non each valid node.\n" + } + }, + "description": "Scheduling mode for the service." + }, + "UpdateConfig": { + "type": "object", + "properties": { + "Parallelism": { + "type": "integer", + "description": "Maximum number of tasks to be updated in one iteration (0 means\nunlimited parallelism).\n", + "format": "int64" + }, + "Delay": { + "type": "integer", + "description": "Amount of time between updates, in nanoseconds.", + "format": "int64" + }, + "FailureAction": { + "type": "string", + "description": "Action to take if an updated task fails to run, or stops running\nduring the update.\n", + "enum": [ + "continue", + "pause", + "rollback" + ] + }, + "Monitor": { + "type": "integer", + "description": "Amount of time to monitor each updated task for failures, in\nnanoseconds.\n", + "format": "int64" + }, + "MaxFailureRatio": { + "type": "number", + "description": "The fraction of tasks that may fail during an update before the\nfailure action is invoked, specified as a floating point number\nbetween 0 and 1.\n" + }, + "Order": { + "type": "string", + "description": "The order of operations when rolling out an updated task. Either\nthe old task is shut down before the new task is started, or the\nnew task is started before the old task is shut down.\n", + "enum": [ + "stop-first", + "start-first" + ] + } + }, + "description": "Specification for the update strategy of the service." + }, + "RollbackConfig": { + "type": "object", + "properties": { + "Parallelism": { + "type": "integer", + "description": "Maximum number of tasks to be rolled back in one iteration (0 means\nunlimited parallelism).\n", + "format": "int64" + }, + "Delay": { + "type": "integer", + "description": "Amount of time between rollback iterations, in nanoseconds.\n", + "format": "int64" + }, + "FailureAction": { + "type": "string", + "description": "Action to take if an rolled back task fails to run, or stops\nrunning during the rollback.\n", + "enum": [ + "continue", + "pause" + ] + }, + "Monitor": { + "type": "integer", + "description": "Amount of time to monitor each rolled back task for failures, in\nnanoseconds.\n", + "format": "int64" + }, + "MaxFailureRatio": { + "type": "number", + "description": "The fraction of tasks that may fail during a rollback before the\nfailure action is invoked, specified as a floating point number\nbetween 0 and 1.\n" + }, + "Order": { + "type": "string", + "description": "The order of operations when rolling back a task. Either the old\ntask is shut down before the new task is started, or the new task\nis started before the old task is shut down.\n", + "enum": [ + "stop-first", + "start-first" + ] + } + }, + "description": "Specification for the rollback strategy of the service." + }, + "Networks": { + "type": "array", + "description": "Specifies which networks the service should attach to.", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "The target network for attachment. Must be a network name or ID.\n" + }, + "Aliases": { + "type": "array", + "description": "Discoverable alternate names for the service on this network.\n", + "items": { + "type": "string" + } + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver attachment options for the network target.\n" + } + }, + "description": "Specifies how a service should be attached to a particular network.\n" + } + }, + "EndpointSpec": { + "type": "object", + "properties": { + "Mode": { + "type": "string", + "description": "The mode of resolution to use for internal load balancing between tasks.\n", + "default": "vip", + "enum": [ + "vip", + "dnsrr" + ] + }, + "Ports": { + "type": "array", + "description": "List of exposed ports that this service is accessible on from the\noutside. Ports can only be provided if `vip` resolution mode is used.\n", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Protocol": { + "type": "string", + "enum": [ + "tcp", + "udp", + "sctp" + ] + }, + "TargetPort": { + "type": "integer", + "description": "The port inside the container." + }, + "PublishedPort": { + "type": "integer", + "description": "The port on the swarm hosts." + }, + "PublishMode": { + "type": "string", + "description": "The mode in which port is published.\n\n


\n\n- \"ingress\" makes the target port accessible on every node,\n regardless of whether there is a task for the service running on\n that node or not.\n- \"host\" bypasses the routing mesh and publish the port directly on\n the swarm node where that service is running.\n", + "example": "ingress", + "default": "ingress", + "enum": [ + "ingress", + "host" + ] + } + } + } + } + }, + "description": "Properties that can be configured to access and load balance a service." + } + }, + "description": "User modifiable configuration for a service." + }, + { + "type": "object", + "example": { + "Name": "web", + "TaskTemplate": { + "ContainerSpec": { + "Image": "nginx:alpine", + "Mounts": [ + { + "ReadOnly": true, + "Source": "web-data", + "Target": "/usr/share/nginx/html", + "Type": "volume", + "VolumeOptions": { + "DriverConfig": {}, + "Labels": { + "com.example.something": "something-value" + } + } + } + ], + "Hosts": [ + "10.10.10.10 host1", + "ABCD:EF01:2345:6789:ABCD:EF01:2345:6789 host2" + ], + "User": "33", + "DNSConfig": { + "Nameservers": [ + "8.8.8.8" + ], + "Search": [ + "example.org" + ], + "Options": [ + "timeout:3" + ] + }, + "Secrets": [ + { + "File": { + "Name": "www.example.org.key", + "UID": "33", + "GID": "33", + "Mode": 384 + }, + "SecretID": "fpjqlhnwb19zds35k8wn80lq9", + "SecretName": "example_org_domain_key" + } + ] + }, + "LogDriver": { + "Name": "json-file", + "Options": { + "max-file": "3", + "max-size": "10M" + } + }, + "Placement": {}, + "Resources": { + "Limits": { + "MemoryBytes": 104857600 + }, + "Reservations": {} + }, + "RestartPolicy": { + "Condition": "on-failure", + "Delay": 10000000000, + "MaxAttempts": 10 + } + }, + "Mode": { + "Replicated": { + "Replicas": 4 + } + }, + "UpdateConfig": { + "Parallelism": 2, + "Delay": 1000000000, + "FailureAction": "pause", + "Monitor": 15000000000, + "MaxFailureRatio": 0.15 + }, + "RollbackConfig": { + "Parallelism": 1, + "Delay": 1000000000, + "FailureAction": "pause", + "Monitor": 15000000000, + "MaxFailureRatio": 0.15 + }, + "EndpointSpec": { + "Ports": [ + { + "Protocol": "tcp", + "PublishedPort": 8080, + "TargetPort": 80 + } + ] + }, + "Labels": { + "foo": "bar" + } + } + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "no error", + "content": { + "application/json": { + "schema": { + "title": "ServiceCreateResponse", + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "The ID of the created service." + }, + "Warning": { + "type": "string", + "description": "Optional warning message" + } + }, + "example": { + "ID": "ak7w3gjqoa3kuz8xcpnyy0pvl", + "Warning": "unable to pin image doesnotexist:latest to digest: image library/doesnotexist:latest not found" + } + } + } + } + }, + "400": { + "description": "bad parameter", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "403": { + "description": "network is not eligible for services", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "409": { + "description": "name conflicts with an existing service", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "503": { + "description": "node is not part of a swarm", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + }, + "x-codegen-request-body-name": "body" + } + }, + "/services/{id}": { + "get": { + "tags": [ + "Service" + ], + "summary": "Inspect a service", + "operationId": "ServiceInspect", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID or name of service.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "insertDefaults", + "in": "query", + "description": "Fill empty fields with default values.", + "schema": { + "type": "boolean", + "default": false + } + } + ], + "responses": { + "200": { + "description": "no error", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "ID": { + "type": "string" + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "format": "dateTime" + }, + "UpdatedAt": { + "type": "string", + "format": "dateTime" + }, + "Spec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the service." + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "TaskTemplate": { + "type": "object", + "properties": { + "PluginSpec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "The name or 'alias' to use for the plugin." + }, + "Remote": { + "type": "string", + "description": "The plugin image reference to use." + }, + "Disabled": { + "type": "boolean", + "description": "Disable the plugin once scheduled." + }, + "PluginPrivilege": { + "type": "array", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "example": "network" + }, + "Description": { + "type": "string" + }, + "Value": { + "type": "array", + "example": [ + "host" + ], + "items": { + "type": "string" + } + } + }, + "description": "Describes a permission the user has to accept upon installing\nthe plugin.\n", + "x-go-name": "PluginPrivilege" + } + } + }, + "description": "Plugin spec for the service. *(Experimental release only.)*\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "ContainerSpec": { + "type": "object", + "properties": { + "Image": { + "type": "string", + "description": "The image name to use for the container" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value data." + }, + "Command": { + "type": "array", + "description": "The command to be run in the image.", + "items": { + "type": "string" + } + }, + "Args": { + "type": "array", + "description": "Arguments to the command.", + "items": { + "type": "string" + } + }, + "Hostname": { + "type": "string", + "description": "The hostname to use for the container, as a valid\n[RFC 1123](https://tools.ietf.org/html/rfc1123) hostname.\n" + }, + "Env": { + "type": "array", + "description": "A list of environment variables in the form `VAR=value`.\n", + "items": { + "type": "string" + } + }, + "Dir": { + "type": "string", + "description": "The working directory for commands to run in." + }, + "User": { + "type": "string", + "description": "The user inside the container." + }, + "Groups": { + "type": "array", + "description": "A list of additional groups that the container process will run as.\n", + "items": { + "type": "string" + } + }, + "Privileges": { + "type": "object", + "properties": { + "CredentialSpec": { + "type": "object", + "properties": { + "Config": { + "type": "string", + "description": "Load credential spec from a Swarm Config with the given ID.\nThe specified config must also be present in the Configs\nfield with the Runtime property set.\n\n


\n\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n", + "example": "0bt9dmxjvjiqermk6xrop3ekq" + }, + "File": { + "type": "string", + "description": "Load credential spec from this file. The file is read by\nthe daemon, and must be present in the `CredentialSpecs`\nsubdirectory in the docker data directory, which defaults\nto `C:\\ProgramData\\Docker\\` on Windows.\n\nFor example, specifying `spec.json` loads\n`C:\\ProgramData\\Docker\\CredentialSpecs\\spec.json`.\n\n


\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n", + "example": "spec.json" + }, + "Registry": { + "type": "string", + "description": "Load credential spec from this value in the Windows\nregistry. The specified registry value must be located in:\n\n`HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Virtualization\\Containers\\CredentialSpecs`\n\n


\n\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n" + } + }, + "description": "CredentialSpec for managed service account (Windows only)" + }, + "SELinuxContext": { + "type": "object", + "properties": { + "Disable": { + "type": "boolean", + "description": "Disable SELinux" + }, + "User": { + "type": "string", + "description": "SELinux user label" + }, + "Role": { + "type": "string", + "description": "SELinux role label" + }, + "Type": { + "type": "string", + "description": "SELinux type label" + }, + "Level": { + "type": "string", + "description": "SELinux level label" + } + }, + "description": "SELinux labels of the container" + } + }, + "description": "Security options for the container" + }, + "TTY": { + "type": "boolean", + "description": "Whether a pseudo-TTY should be allocated." + }, + "OpenStdin": { + "type": "boolean", + "description": "Open `stdin`" + }, + "ReadOnly": { + "type": "boolean", + "description": "Mount the container's root filesystem as read only." + }, + "Mounts": { + "type": "array", + "description": "Specification for mounts to be added to containers created as part\nof the service.\n", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "Container path." + }, + "Source": { + "type": "string", + "description": "Mount source (e.g. a volume name, a host path)." + }, + "Type": { + "type": "string", + "description": "The mount type. Available types:\n\n- `bind` Mounts a file or directory from the host into the container. Must exist prior to creating the container.\n- `volume` Creates a volume with the given name and options (or uses a pre-existing volume with the same name and options). These are **not** removed when the container is removed.\n- `tmpfs` Create a tmpfs with the given options. The mount source cannot be specified for tmpfs.\n- `npipe` Mounts a named pipe from the host into the container. Must exist prior to creating the container.\n- `cluster` a Swarm cluster volume\n", + "enum": [ + "bind", + "volume", + "tmpfs", + "npipe", + "cluster" + ] + }, + "ReadOnly": { + "type": "boolean", + "description": "Whether the mount should be read-only." + }, + "Consistency": { + "type": "string", + "description": "The consistency requirement for the mount: `default`, `consistent`, `cached`, or `delegated`." + }, + "BindOptions": { + "type": "object", + "properties": { + "Propagation": { + "type": "string", + "description": "A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`.", + "enum": [ + "private", + "rprivate", + "shared", + "rshared", + "slave", + "rslave" + ] + }, + "NonRecursive": { + "type": "boolean", + "description": "Disable recursive bind mount.", + "default": false + }, + "CreateMountpoint": { + "type": "boolean", + "description": "Create mount point on host if missing", + "default": false + } + }, + "description": "Optional configuration for the `bind` type." + }, + "VolumeOptions": { + "type": "object", + "properties": { + "NoCopy": { + "type": "boolean", + "description": "Populate volume with data from the target.", + "default": false + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "DriverConfig": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver to use to create the volume." + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "key/value map of driver specific options." + } + }, + "description": "Map of driver specific options" + } + }, + "description": "Optional configuration for the `volume` type." + }, + "TmpfsOptions": { + "type": "object", + "properties": { + "SizeBytes": { + "type": "integer", + "description": "The size for the tmpfs mount in bytes.", + "format": "int64" + }, + "Mode": { + "type": "integer", + "description": "The permission mode for the tmpfs mount in an integer." + } + }, + "description": "Optional configuration for the `tmpfs` type." + } + } + } + }, + "StopSignal": { + "type": "string", + "description": "Signal to stop the container." + }, + "StopGracePeriod": { + "type": "integer", + "description": "Amount of time to wait for the container to terminate before\nforcefully killing it.\n", + "format": "int64" + }, + "HealthCheck": { + "type": "object", + "properties": { + "Test": { + "type": "array", + "description": "The test to perform. Possible values are:\n\n- `[]` inherit healthcheck from image or parent image\n- `[\"NONE\"]` disable healthcheck\n- `[\"CMD\", args...]` exec arguments directly\n- `[\"CMD-SHELL\", command]` run command with system's default shell\n", + "items": { + "type": "string" + } + }, + "Interval": { + "type": "integer", + "description": "The time to wait between checks in nanoseconds. It should be 0 or at\nleast 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Timeout": { + "type": "integer", + "description": "The time to wait before considering the check to have hung. It should\nbe 0 or at least 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Retries": { + "type": "integer", + "description": "The number of consecutive failures needed to consider a container as\nunhealthy. 0 means inherit.\n" + }, + "StartPeriod": { + "type": "integer", + "description": "Start period for the container to initialize before starting\nhealth-retries countdown in nanoseconds. It should be 0 or at least\n1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + } + }, + "description": "A test to perform to check that the container is healthy." + }, + "Hosts": { + "type": "array", + "description": "A list of hostname/IP mappings to add to the container's `hosts`\nfile. The format of extra hosts is specified in the\n[hosts(5)](http://man7.org/linux/man-pages/man5/hosts.5.html)\nman page:\n\n IP_address canonical_hostname [aliases...]\n", + "items": { + "type": "string" + } + }, + "DNSConfig": { + "type": "object", + "properties": { + "Nameservers": { + "type": "array", + "description": "The IP addresses of the name servers.", + "items": { + "type": "string" + } + }, + "Search": { + "type": "array", + "description": "A search list for host-name lookup.", + "items": { + "type": "string" + } + }, + "Options": { + "type": "array", + "description": "A list of internal resolver variables to be modified (e.g.,\n`debug`, `ndots:3`, etc.).\n", + "items": { + "type": "string" + } + } + }, + "description": "Specification for DNS related configurations in resolver configuration\nfile (`resolv.conf`).\n" + }, + "Secrets": { + "type": "array", + "description": "Secrets contains references to zero or more secrets that will be\nexposed to the service.\n", + "items": { + "type": "object", + "properties": { + "File": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name represents the final filename in the filesystem.\n" + }, + "UID": { + "type": "string", + "description": "UID represents the file UID." + }, + "GID": { + "type": "string", + "description": "GID represents the file GID." + }, + "Mode": { + "type": "integer", + "description": "Mode represents the FileMode of the file.", + "format": "uint32" + } + }, + "description": "File represents a specific target that is backed by a file.\n" + }, + "SecretID": { + "type": "string", + "description": "SecretID represents the ID of the specific secret that we're\nreferencing.\n" + }, + "SecretName": { + "type": "string", + "description": "SecretName is the name of the secret that this references,\nbut this is just provided for lookup/display purposes. The\nsecret in the reference will be identified by its ID.\n" + } + } + } + }, + "Configs": { + "type": "array", + "description": "Configs contains references to zero or more configs that will be\nexposed to the service.\n", + "items": { + "type": "object", + "properties": { + "File": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name represents the final filename in the filesystem.\n" + }, + "UID": { + "type": "string", + "description": "UID represents the file UID." + }, + "GID": { + "type": "string", + "description": "GID represents the file GID." + }, + "Mode": { + "type": "integer", + "description": "Mode represents the FileMode of the file.", + "format": "uint32" + } + }, + "description": "File represents a specific target that is backed by a file.\n\n


\n\n> **Note**: `Configs.File` and `Configs.Runtime` are mutually exclusive\n" + }, + "Runtime": { + "type": "object", + "properties": {}, + "description": "Runtime represents a target that is not mounted into the\ncontainer but is used by the task\n\n


\n\n> **Note**: `Configs.File` and `Configs.Runtime` are mutually\n> exclusive\n" + }, + "ConfigID": { + "type": "string", + "description": "ConfigID represents the ID of the specific config that we're\nreferencing.\n" + }, + "ConfigName": { + "type": "string", + "description": "ConfigName is the name of the config that this references,\nbut this is just provided for lookup/display purposes. The\nconfig in the reference will be identified by its ID.\n" + } + } + } + }, + "Isolation": { + "type": "string", + "description": "Isolation technology of the containers running the service.\n(Windows only)\n", + "enum": [ + "default", + "process", + "hyperv", + "" + ] + }, + "Init": { + "type": "boolean", + "description": "Run an init inside the container that forwards signals and reaps\nprocesses. This field is omitted if empty, and the default (as\nconfigured on the daemon) is used.\n", + "nullable": true + }, + "Sysctls": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Set kernel namedspaced parameters (sysctls) in the container.\nThe Sysctls option on services accepts the same sysctls as the\nare supported on containers. Note that while the same sysctls are\nsupported, no guarantees or checks are made about their\nsuitability for a clustered environment, and it's up to the user\nto determine whether a given sysctl will work properly in a\nService.\n" + }, + "CapabilityAdd": { + "type": "array", + "description": "A list of kernel capabilities to add to the default set\nfor the container.\n", + "example": [ + "CAP_NET_RAW", + "CAP_SYS_ADMIN", + "CAP_SYS_CHROOT", + "CAP_SYSLOG" + ], + "items": { + "type": "string" + } + }, + "CapabilityDrop": { + "type": "array", + "description": "A list of kernel capabilities to drop from the default set\nfor the container.\n", + "example": [ + "CAP_NET_RAW" + ], + "items": { + "type": "string" + } + }, + "Ulimits": { + "type": "array", + "description": "A list of resource limits to set in the container. For example: `{\"Name\": \"nofile\", \"Soft\": 1024, \"Hard\": 2048}`\"\n", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of ulimit" + }, + "Soft": { + "type": "integer", + "description": "Soft limit" + }, + "Hard": { + "type": "integer", + "description": "Hard limit" + } + } + } + } + }, + "description": "Container spec for the service.\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "NetworkAttachmentSpec": { + "type": "object", + "properties": { + "ContainerID": { + "type": "string", + "description": "ID of the container represented by this task" + } + }, + "description": "Read-only spec type for non-swarm containers attached to swarm overlay\nnetworks.\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "Resources": { + "type": "object", + "properties": { + "Limits": { + "type": "object", + "properties": { + "NanoCPUs": { + "type": "integer", + "format": "int64", + "example": 4000000000 + }, + "MemoryBytes": { + "type": "integer", + "format": "int64", + "example": 8272408576 + }, + "Pids": { + "type": "integer", + "description": "Limits the maximum number of PIDs in the container. Set `0` for unlimited.\n", + "format": "int64", + "example": 100, + "default": 0 + } + }, + "description": "An object describing a limit on resources which can be requested by a task.\n" + }, + "Reservations": { + "type": "object", + "properties": { + "NanoCPUs": { + "type": "integer", + "format": "int64", + "example": 4000000000 + }, + "MemoryBytes": { + "type": "integer", + "format": "int64", + "example": 8272408576 + }, + "GenericResources": { + "type": "array", + "description": "User-defined resources can be either Integer resources (e.g, `SSD=3`) or\nString resources (e.g, `GPU=UUID1`).\n", + "example": [ + { + "DiscreteResourceSpec": { + "Kind": "SSD", + "Value": 3 + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID1" + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID2" + } + } + ], + "items": { + "type": "object", + "properties": { + "NamedResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + }, + "DiscreteResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "integer", + "format": "int64" + } + } + } + } + } + } + }, + "description": "An object describing the resources which can be advertised by a node and\nrequested by a task.\n" + } + }, + "description": "Resource requirements which apply to each individual container created\nas part of the service.\n" + }, + "RestartPolicy": { + "type": "object", + "properties": { + "Condition": { + "type": "string", + "description": "Condition for restart.", + "enum": [ + "none", + "on-failure", + "any" + ] + }, + "Delay": { + "type": "integer", + "description": "Delay between restart attempts.", + "format": "int64" + }, + "MaxAttempts": { + "type": "integer", + "description": "Maximum attempts to restart a given container before giving up\n(default value is 0, which is ignored).\n", + "format": "int64", + "default": 0 + }, + "Window": { + "type": "integer", + "description": "Windows is the time window used to evaluate the restart policy\n(default value is 0, which is unbounded).\n", + "format": "int64", + "default": 0 + } + }, + "description": "Specification for the restart policy which applies to containers\ncreated as part of this service.\n" + }, + "Placement": { + "type": "object", + "properties": { + "Constraints": { + "type": "array", + "description": "An array of constraint expressions to limit the set of nodes where\na task can be scheduled. Constraint expressions can either use a\n_match_ (`==`) or _exclude_ (`!=`) rule. Multiple constraints find\nnodes that satisfy every expression (AND match). Constraints can\nmatch node or Docker Engine labels as follows:\n\nnode attribute | matches | example\n---------------------|--------------------------------|-----------------------------------------------\n`node.id` | Node ID | `node.id==2ivku8v2gvtg4`\n`node.hostname` | Node hostname | `node.hostname!=node-2`\n`node.role` | Node role (`manager`/`worker`) | `node.role==manager`\n`node.platform.os` | Node operating system | `node.platform.os==windows`\n`node.platform.arch` | Node architecture | `node.platform.arch==x86_64`\n`node.labels` | User-defined node labels | `node.labels.security==high`\n`engine.labels` | Docker Engine's labels | `engine.labels.operatingsystem==ubuntu-14.04`\n\n`engine.labels` apply to Docker Engine labels like operating system,\ndrivers, etc. Swarm administrators add `node.labels` for operational\npurposes by using the [`node update endpoint`](#operation/NodeUpdate).\n", + "example": [ + "node.hostname!=node3.corp.example.com", + "node.role!=manager", + "node.labels.type==production", + "node.platform.os==linux", + "node.platform.arch==x86_64" + ], + "items": { + "type": "string" + } + }, + "Preferences": { + "type": "array", + "description": "Preferences provide a way to make the scheduler aware of factors\nsuch as topology. They are provided in order from highest to\nlowest precedence.\n", + "example": [ + { + "Spread": { + "SpreadDescriptor": "node.labels.datacenter" + } + }, + { + "Spread": { + "SpreadDescriptor": "node.labels.rack" + } + } + ], + "items": { + "type": "object", + "properties": { + "Spread": { + "type": "object", + "properties": { + "SpreadDescriptor": { + "type": "string", + "description": "label descriptor, such as `engine.labels.az`.\n" + } + } + } + } + } + }, + "MaxReplicas": { + "type": "integer", + "description": "Maximum number of replicas for per node (default value is 0, which\nis unlimited)\n", + "format": "int64", + "default": 0 + }, + "Platforms": { + "type": "array", + "description": "Platforms stores all the platforms that the service's image can\nrun on. This field is used in the platform filter for scheduling.\nIf empty, then the platform filter is off, meaning there are no\nscheduling restrictions.\n", + "items": { + "type": "object", + "properties": { + "Architecture": { + "type": "string", + "description": "Architecture represents the hardware architecture (for example,\n`x86_64`).\n", + "example": "x86_64" + }, + "OS": { + "type": "string", + "description": "OS represents the Operating System (for example, `linux` or `windows`).\n", + "example": "linux" + } + }, + "description": "Platform represents the platform (Arch/OS).\n" + } + } + } + }, + "ForceUpdate": { + "type": "integer", + "description": "A counter that triggers an update even if no relevant parameters have\nbeen changed.\n" + }, + "Runtime": { + "type": "string", + "description": "Runtime is the type of runtime specified for the task executor.\n" + }, + "Networks": { + "type": "array", + "description": "Specifies which networks the service should attach to.", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "The target network for attachment. Must be a network name or ID.\n" + }, + "Aliases": { + "type": "array", + "description": "Discoverable alternate names for the service on this network.\n", + "items": { + "type": "string" + } + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver attachment options for the network target.\n" + } + }, + "description": "Specifies how a service should be attached to a particular network.\n" + } + }, + "LogDriver": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "description": "Specifies the log driver to use for tasks created from this spec. If\nnot present, the default one for the swarm will be used, finally\nfalling back to the engine default if not specified.\n" + } + }, + "description": "User modifiable task configuration." + }, + "Mode": { + "type": "object", + "properties": { + "Replicated": { + "type": "object", + "properties": { + "Replicas": { + "type": "integer", + "format": "int64" + } + } + }, + "Global": { + "type": "object", + "properties": {} + }, + "ReplicatedJob": { + "type": "object", + "properties": { + "MaxConcurrent": { + "type": "integer", + "description": "The maximum number of replicas to run simultaneously.\n", + "format": "int64", + "default": 1 + }, + "TotalCompletions": { + "type": "integer", + "description": "The total number of replicas desired to reach the Completed\nstate. If unset, will default to the value of `MaxConcurrent`\n", + "format": "int64" + } + }, + "description": "The mode used for services with a finite number of tasks that run\nto a completed state.\n" + }, + "GlobalJob": { + "type": "object", + "properties": {}, + "description": "The mode used for services which run a task to the completed state\non each valid node.\n" + } + }, + "description": "Scheduling mode for the service." + }, + "UpdateConfig": { + "type": "object", + "properties": { + "Parallelism": { + "type": "integer", + "description": "Maximum number of tasks to be updated in one iteration (0 means\nunlimited parallelism).\n", + "format": "int64" + }, + "Delay": { + "type": "integer", + "description": "Amount of time between updates, in nanoseconds.", + "format": "int64" + }, + "FailureAction": { + "type": "string", + "description": "Action to take if an updated task fails to run, or stops running\nduring the update.\n", + "enum": [ + "continue", + "pause", + "rollback" + ] + }, + "Monitor": { + "type": "integer", + "description": "Amount of time to monitor each updated task for failures, in\nnanoseconds.\n", + "format": "int64" + }, + "MaxFailureRatio": { + "type": "number", + "description": "The fraction of tasks that may fail during an update before the\nfailure action is invoked, specified as a floating point number\nbetween 0 and 1.\n" + }, + "Order": { + "type": "string", + "description": "The order of operations when rolling out an updated task. Either\nthe old task is shut down before the new task is started, or the\nnew task is started before the old task is shut down.\n", + "enum": [ + "stop-first", + "start-first" + ] + } + }, + "description": "Specification for the update strategy of the service." + }, + "RollbackConfig": { + "type": "object", + "properties": { + "Parallelism": { + "type": "integer", + "description": "Maximum number of tasks to be rolled back in one iteration (0 means\nunlimited parallelism).\n", + "format": "int64" + }, + "Delay": { + "type": "integer", + "description": "Amount of time between rollback iterations, in nanoseconds.\n", + "format": "int64" + }, + "FailureAction": { + "type": "string", + "description": "Action to take if an rolled back task fails to run, or stops\nrunning during the rollback.\n", + "enum": [ + "continue", + "pause" + ] + }, + "Monitor": { + "type": "integer", + "description": "Amount of time to monitor each rolled back task for failures, in\nnanoseconds.\n", + "format": "int64" + }, + "MaxFailureRatio": { + "type": "number", + "description": "The fraction of tasks that may fail during a rollback before the\nfailure action is invoked, specified as a floating point number\nbetween 0 and 1.\n" + }, + "Order": { + "type": "string", + "description": "The order of operations when rolling back a task. Either the old\ntask is shut down before the new task is started, or the new task\nis started before the old task is shut down.\n", + "enum": [ + "stop-first", + "start-first" + ] + } + }, + "description": "Specification for the rollback strategy of the service." + }, + "Networks": { + "type": "array", + "description": "Specifies which networks the service should attach to.", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "The target network for attachment. Must be a network name or ID.\n" + }, + "Aliases": { + "type": "array", + "description": "Discoverable alternate names for the service on this network.\n", + "items": { + "type": "string" + } + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver attachment options for the network target.\n" + } + }, + "description": "Specifies how a service should be attached to a particular network.\n" + } + }, + "EndpointSpec": { + "type": "object", + "properties": { + "Mode": { + "type": "string", + "description": "The mode of resolution to use for internal load balancing between tasks.\n", + "default": "vip", + "enum": [ + "vip", + "dnsrr" + ] + }, + "Ports": { + "type": "array", + "description": "List of exposed ports that this service is accessible on from the\noutside. Ports can only be provided if `vip` resolution mode is used.\n", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Protocol": { + "type": "string", + "enum": [ + "tcp", + "udp", + "sctp" + ] + }, + "TargetPort": { + "type": "integer", + "description": "The port inside the container." + }, + "PublishedPort": { + "type": "integer", + "description": "The port on the swarm hosts." + }, + "PublishMode": { + "type": "string", + "description": "The mode in which port is published.\n\n


\n\n- \"ingress\" makes the target port accessible on every node,\n regardless of whether there is a task for the service running on\n that node or not.\n- \"host\" bypasses the routing mesh and publish the port directly on\n the swarm node where that service is running.\n", + "example": "ingress", + "default": "ingress", + "enum": [ + "ingress", + "host" + ] + } + } + } + } + }, + "description": "Properties that can be configured to access and load balance a service." + } + }, + "description": "User modifiable configuration for a service." + }, + "Endpoint": { + "type": "object", + "properties": { + "Spec": { + "type": "object", + "properties": { + "Mode": { + "type": "string", + "description": "The mode of resolution to use for internal load balancing between tasks.\n", + "default": "vip", + "enum": [ + "vip", + "dnsrr" + ] + }, + "Ports": { + "type": "array", + "description": "List of exposed ports that this service is accessible on from the\noutside. Ports can only be provided if `vip` resolution mode is used.\n", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Protocol": { + "type": "string", + "enum": [ + "tcp", + "udp", + "sctp" + ] + }, + "TargetPort": { + "type": "integer", + "description": "The port inside the container." + }, + "PublishedPort": { + "type": "integer", + "description": "The port on the swarm hosts." + }, + "PublishMode": { + "type": "string", + "description": "The mode in which port is published.\n\n


\n\n- \"ingress\" makes the target port accessible on every node,\n regardless of whether there is a task for the service running on\n that node or not.\n- \"host\" bypasses the routing mesh and publish the port directly on\n the swarm node where that service is running.\n", + "example": "ingress", + "default": "ingress", + "enum": [ + "ingress", + "host" + ] + } + } + } + } + }, + "description": "Properties that can be configured to access and load balance a service." + }, + "Ports": { + "type": "array", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Protocol": { + "type": "string", + "enum": [ + "tcp", + "udp", + "sctp" + ] + }, + "TargetPort": { + "type": "integer", + "description": "The port inside the container." + }, + "PublishedPort": { + "type": "integer", + "description": "The port on the swarm hosts." + }, + "PublishMode": { + "type": "string", + "description": "The mode in which port is published.\n\n


\n\n- \"ingress\" makes the target port accessible on every node,\n regardless of whether there is a task for the service running on\n that node or not.\n- \"host\" bypasses the routing mesh and publish the port directly on\n the swarm node where that service is running.\n", + "example": "ingress", + "default": "ingress", + "enum": [ + "ingress", + "host" + ] + } + } + } + }, + "VirtualIPs": { + "type": "array", + "items": { + "type": "object", + "properties": { + "NetworkID": { + "type": "string" + }, + "Addr": { + "type": "string" + } + } + } + } + } + }, + "UpdateStatus": { + "type": "object", + "properties": { + "State": { + "type": "string", + "enum": [ + "updating", + "paused", + "completed" + ] + }, + "StartedAt": { + "type": "string", + "format": "dateTime" + }, + "CompletedAt": { + "type": "string", + "format": "dateTime" + }, + "Message": { + "type": "string" + } + }, + "description": "The status of a service update." + }, + "ServiceStatus": { + "type": "object", + "properties": { + "RunningTasks": { + "type": "integer", + "description": "The number of tasks for the service currently in the Running state.\n", + "format": "uint64", + "example": 7 + }, + "DesiredTasks": { + "type": "integer", + "description": "The number of tasks for the service desired to be running.\nFor replicated services, this is the replica count from the\nservice spec. For global services, this is computed by taking\ncount of all tasks for the service with a Desired State other\nthan Shutdown.\n", + "format": "uint64", + "example": 10 + }, + "CompletedTasks": { + "type": "integer", + "description": "The number of tasks for a job that are in the Completed state.\nThis field must be cross-referenced with the service type, as the\nvalue of 0 may mean the service is not in a job mode, or it may\nmean the job-mode service has no tasks yet Completed.\n", + "format": "uint64" + } + }, + "description": "The status of the service's tasks. Provided only when requested as\npart of a ServiceList operation.\n" + }, + "JobStatus": { + "type": "object", + "properties": { + "JobIteration": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "LastExecution": { + "type": "string", + "description": "The last time, as observed by the server, that this job was\nstarted.\n", + "format": "dateTime" + } + }, + "description": "The status of the service when it is in one of ReplicatedJob or\nGlobalJob modes. Absent on Replicated and Global mode services. The\nJobIteration is an ObjectVersion, but unlike the Service's version,\ndoes not need to be sent with an update request.\n" + } + }, + "example": { + "ID": "9mnpnzenvg8p8tdbtq4wvbkcz", + "Version": { + "Index": 19 + }, + "CreatedAt": "2016-06-07T21:05:51.880065305Z", + "UpdatedAt": "2016-06-07T21:07:29.962229872Z", + "Spec": { + "Name": "hopeful_cori", + "TaskTemplate": { + "ContainerSpec": { + "Image": "redis" + }, + "Resources": { + "Limits": {}, + "Reservations": {} + }, + "RestartPolicy": { + "Condition": "any", + "MaxAttempts": 0 + }, + "Placement": {}, + "ForceUpdate": 0 + }, + "Mode": { + "Replicated": { + "Replicas": 1 + } + }, + "UpdateConfig": { + "Parallelism": 1, + "Delay": 1000000000, + "FailureAction": "pause", + "Monitor": 15000000000, + "MaxFailureRatio": 0.15 + }, + "RollbackConfig": { + "Parallelism": 1, + "Delay": 1000000000, + "FailureAction": "pause", + "Monitor": 15000000000, + "MaxFailureRatio": 0.15 + }, + "EndpointSpec": { + "Mode": "vip", + "Ports": [ + { + "Protocol": "tcp", + "TargetPort": 6379, + "PublishedPort": 30001 + } + ] + } + }, + "Endpoint": { + "Spec": { + "Mode": "vip", + "Ports": [ + { + "Protocol": "tcp", + "TargetPort": 6379, + "PublishedPort": 30001 + } + ] + }, + "Ports": [ + { + "Protocol": "tcp", + "TargetPort": 6379, + "PublishedPort": 30001 + } + ], + "VirtualIPs": [ + { + "NetworkID": "4qvuz4ko70xaltuqbt8956gd1", + "Addr": "10.255.0.2/16" + }, + { + "NetworkID": "4qvuz4ko70xaltuqbt8956gd1", + "Addr": "10.255.0.3/16" + } + ] + } + } + } + }, + "text/plain": { + "schema": { + "type": "object", + "properties": { + "ID": { + "type": "string" + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "format": "dateTime" + }, + "UpdatedAt": { + "type": "string", + "format": "dateTime" + }, + "Spec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the service." + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "TaskTemplate": { + "type": "object", + "properties": { + "PluginSpec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "The name or 'alias' to use for the plugin." + }, + "Remote": { + "type": "string", + "description": "The plugin image reference to use." + }, + "Disabled": { + "type": "boolean", + "description": "Disable the plugin once scheduled." + }, + "PluginPrivilege": { + "type": "array", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "example": "network" + }, + "Description": { + "type": "string" + }, + "Value": { + "type": "array", + "example": [ + "host" + ], + "items": { + "type": "string" + } + } + }, + "description": "Describes a permission the user has to accept upon installing\nthe plugin.\n", + "x-go-name": "PluginPrivilege" + } + } + }, + "description": "Plugin spec for the service. *(Experimental release only.)*\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "ContainerSpec": { + "type": "object", + "properties": { + "Image": { + "type": "string", + "description": "The image name to use for the container" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value data." + }, + "Command": { + "type": "array", + "description": "The command to be run in the image.", + "items": { + "type": "string" + } + }, + "Args": { + "type": "array", + "description": "Arguments to the command.", + "items": { + "type": "string" + } + }, + "Hostname": { + "type": "string", + "description": "The hostname to use for the container, as a valid\n[RFC 1123](https://tools.ietf.org/html/rfc1123) hostname.\n" + }, + "Env": { + "type": "array", + "description": "A list of environment variables in the form `VAR=value`.\n", + "items": { + "type": "string" + } + }, + "Dir": { + "type": "string", + "description": "The working directory for commands to run in." + }, + "User": { + "type": "string", + "description": "The user inside the container." + }, + "Groups": { + "type": "array", + "description": "A list of additional groups that the container process will run as.\n", + "items": { + "type": "string" + } + }, + "Privileges": { + "type": "object", + "properties": { + "CredentialSpec": { + "type": "object", + "properties": { + "Config": { + "type": "string", + "description": "Load credential spec from a Swarm Config with the given ID.\nThe specified config must also be present in the Configs\nfield with the Runtime property set.\n\n


\n\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n", + "example": "0bt9dmxjvjiqermk6xrop3ekq" + }, + "File": { + "type": "string", + "description": "Load credential spec from this file. The file is read by\nthe daemon, and must be present in the `CredentialSpecs`\nsubdirectory in the docker data directory, which defaults\nto `C:\\ProgramData\\Docker\\` on Windows.\n\nFor example, specifying `spec.json` loads\n`C:\\ProgramData\\Docker\\CredentialSpecs\\spec.json`.\n\n


\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n", + "example": "spec.json" + }, + "Registry": { + "type": "string", + "description": "Load credential spec from this value in the Windows\nregistry. The specified registry value must be located in:\n\n`HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Virtualization\\Containers\\CredentialSpecs`\n\n


\n\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n" + } + }, + "description": "CredentialSpec for managed service account (Windows only)" + }, + "SELinuxContext": { + "type": "object", + "properties": { + "Disable": { + "type": "boolean", + "description": "Disable SELinux" + }, + "User": { + "type": "string", + "description": "SELinux user label" + }, + "Role": { + "type": "string", + "description": "SELinux role label" + }, + "Type": { + "type": "string", + "description": "SELinux type label" + }, + "Level": { + "type": "string", + "description": "SELinux level label" + } + }, + "description": "SELinux labels of the container" + } + }, + "description": "Security options for the container" + }, + "TTY": { + "type": "boolean", + "description": "Whether a pseudo-TTY should be allocated." + }, + "OpenStdin": { + "type": "boolean", + "description": "Open `stdin`" + }, + "ReadOnly": { + "type": "boolean", + "description": "Mount the container's root filesystem as read only." + }, + "Mounts": { + "type": "array", + "description": "Specification for mounts to be added to containers created as part\nof the service.\n", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "Container path." + }, + "Source": { + "type": "string", + "description": "Mount source (e.g. a volume name, a host path)." + }, + "Type": { + "type": "string", + "description": "The mount type. Available types:\n\n- `bind` Mounts a file or directory from the host into the container. Must exist prior to creating the container.\n- `volume` Creates a volume with the given name and options (or uses a pre-existing volume with the same name and options). These are **not** removed when the container is removed.\n- `tmpfs` Create a tmpfs with the given options. The mount source cannot be specified for tmpfs.\n- `npipe` Mounts a named pipe from the host into the container. Must exist prior to creating the container.\n- `cluster` a Swarm cluster volume\n", + "enum": [ + "bind", + "volume", + "tmpfs", + "npipe", + "cluster" + ] + }, + "ReadOnly": { + "type": "boolean", + "description": "Whether the mount should be read-only." + }, + "Consistency": { + "type": "string", + "description": "The consistency requirement for the mount: `default`, `consistent`, `cached`, or `delegated`." + }, + "BindOptions": { + "type": "object", + "properties": { + "Propagation": { + "type": "string", + "description": "A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`.", + "enum": [ + "private", + "rprivate", + "shared", + "rshared", + "slave", + "rslave" + ] + }, + "NonRecursive": { + "type": "boolean", + "description": "Disable recursive bind mount.", + "default": false + }, + "CreateMountpoint": { + "type": "boolean", + "description": "Create mount point on host if missing", + "default": false + } + }, + "description": "Optional configuration for the `bind` type." + }, + "VolumeOptions": { + "type": "object", + "properties": { + "NoCopy": { + "type": "boolean", + "description": "Populate volume with data from the target.", + "default": false + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "DriverConfig": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver to use to create the volume." + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "key/value map of driver specific options." + } + }, + "description": "Map of driver specific options" + } + }, + "description": "Optional configuration for the `volume` type." + }, + "TmpfsOptions": { + "type": "object", + "properties": { + "SizeBytes": { + "type": "integer", + "description": "The size for the tmpfs mount in bytes.", + "format": "int64" + }, + "Mode": { + "type": "integer", + "description": "The permission mode for the tmpfs mount in an integer." + } + }, + "description": "Optional configuration for the `tmpfs` type." + } + } + } + }, + "StopSignal": { + "type": "string", + "description": "Signal to stop the container." + }, + "StopGracePeriod": { + "type": "integer", + "description": "Amount of time to wait for the container to terminate before\nforcefully killing it.\n", + "format": "int64" + }, + "HealthCheck": { + "type": "object", + "properties": { + "Test": { + "type": "array", + "description": "The test to perform. Possible values are:\n\n- `[]` inherit healthcheck from image or parent image\n- `[\"NONE\"]` disable healthcheck\n- `[\"CMD\", args...]` exec arguments directly\n- `[\"CMD-SHELL\", command]` run command with system's default shell\n", + "items": { + "type": "string" + } + }, + "Interval": { + "type": "integer", + "description": "The time to wait between checks in nanoseconds. It should be 0 or at\nleast 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Timeout": { + "type": "integer", + "description": "The time to wait before considering the check to have hung. It should\nbe 0 or at least 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Retries": { + "type": "integer", + "description": "The number of consecutive failures needed to consider a container as\nunhealthy. 0 means inherit.\n" + }, + "StartPeriod": { + "type": "integer", + "description": "Start period for the container to initialize before starting\nhealth-retries countdown in nanoseconds. It should be 0 or at least\n1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + } + }, + "description": "A test to perform to check that the container is healthy." + }, + "Hosts": { + "type": "array", + "description": "A list of hostname/IP mappings to add to the container's `hosts`\nfile. The format of extra hosts is specified in the\n[hosts(5)](http://man7.org/linux/man-pages/man5/hosts.5.html)\nman page:\n\n IP_address canonical_hostname [aliases...]\n", + "items": { + "type": "string" + } + }, + "DNSConfig": { + "type": "object", + "properties": { + "Nameservers": { + "type": "array", + "description": "The IP addresses of the name servers.", + "items": { + "type": "string" + } + }, + "Search": { + "type": "array", + "description": "A search list for host-name lookup.", + "items": { + "type": "string" + } + }, + "Options": { + "type": "array", + "description": "A list of internal resolver variables to be modified (e.g.,\n`debug`, `ndots:3`, etc.).\n", + "items": { + "type": "string" + } + } + }, + "description": "Specification for DNS related configurations in resolver configuration\nfile (`resolv.conf`).\n" + }, + "Secrets": { + "type": "array", + "description": "Secrets contains references to zero or more secrets that will be\nexposed to the service.\n", + "items": { + "type": "object", + "properties": { + "File": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name represents the final filename in the filesystem.\n" + }, + "UID": { + "type": "string", + "description": "UID represents the file UID." + }, + "GID": { + "type": "string", + "description": "GID represents the file GID." + }, + "Mode": { + "type": "integer", + "description": "Mode represents the FileMode of the file.", + "format": "uint32" + } + }, + "description": "File represents a specific target that is backed by a file.\n" + }, + "SecretID": { + "type": "string", + "description": "SecretID represents the ID of the specific secret that we're\nreferencing.\n" + }, + "SecretName": { + "type": "string", + "description": "SecretName is the name of the secret that this references,\nbut this is just provided for lookup/display purposes. The\nsecret in the reference will be identified by its ID.\n" + } + } + } + }, + "Configs": { + "type": "array", + "description": "Configs contains references to zero or more configs that will be\nexposed to the service.\n", + "items": { + "type": "object", + "properties": { + "File": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name represents the final filename in the filesystem.\n" + }, + "UID": { + "type": "string", + "description": "UID represents the file UID." + }, + "GID": { + "type": "string", + "description": "GID represents the file GID." + }, + "Mode": { + "type": "integer", + "description": "Mode represents the FileMode of the file.", + "format": "uint32" + } + }, + "description": "File represents a specific target that is backed by a file.\n\n


\n\n> **Note**: `Configs.File` and `Configs.Runtime` are mutually exclusive\n" + }, + "Runtime": { + "type": "object", + "properties": {}, + "description": "Runtime represents a target that is not mounted into the\ncontainer but is used by the task\n\n


\n\n> **Note**: `Configs.File` and `Configs.Runtime` are mutually\n> exclusive\n" + }, + "ConfigID": { + "type": "string", + "description": "ConfigID represents the ID of the specific config that we're\nreferencing.\n" + }, + "ConfigName": { + "type": "string", + "description": "ConfigName is the name of the config that this references,\nbut this is just provided for lookup/display purposes. The\nconfig in the reference will be identified by its ID.\n" + } + } + } + }, + "Isolation": { + "type": "string", + "description": "Isolation technology of the containers running the service.\n(Windows only)\n", + "enum": [ + "default", + "process", + "hyperv", + "" + ] + }, + "Init": { + "type": "boolean", + "description": "Run an init inside the container that forwards signals and reaps\nprocesses. This field is omitted if empty, and the default (as\nconfigured on the daemon) is used.\n", + "nullable": true + }, + "Sysctls": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Set kernel namedspaced parameters (sysctls) in the container.\nThe Sysctls option on services accepts the same sysctls as the\nare supported on containers. Note that while the same sysctls are\nsupported, no guarantees or checks are made about their\nsuitability for a clustered environment, and it's up to the user\nto determine whether a given sysctl will work properly in a\nService.\n" + }, + "CapabilityAdd": { + "type": "array", + "description": "A list of kernel capabilities to add to the default set\nfor the container.\n", + "example": [ + "CAP_NET_RAW", + "CAP_SYS_ADMIN", + "CAP_SYS_CHROOT", + "CAP_SYSLOG" + ], + "items": { + "type": "string" + } + }, + "CapabilityDrop": { + "type": "array", + "description": "A list of kernel capabilities to drop from the default set\nfor the container.\n", + "example": [ + "CAP_NET_RAW" + ], + "items": { + "type": "string" + } + }, + "Ulimits": { + "type": "array", + "description": "A list of resource limits to set in the container. For example: `{\"Name\": \"nofile\", \"Soft\": 1024, \"Hard\": 2048}`\"\n", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of ulimit" + }, + "Soft": { + "type": "integer", + "description": "Soft limit" + }, + "Hard": { + "type": "integer", + "description": "Hard limit" + } + } + } + } + }, + "description": "Container spec for the service.\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "NetworkAttachmentSpec": { + "type": "object", + "properties": { + "ContainerID": { + "type": "string", + "description": "ID of the container represented by this task" + } + }, + "description": "Read-only spec type for non-swarm containers attached to swarm overlay\nnetworks.\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "Resources": { + "type": "object", + "properties": { + "Limits": { + "type": "object", + "properties": { + "NanoCPUs": { + "type": "integer", + "format": "int64", + "example": 4000000000 + }, + "MemoryBytes": { + "type": "integer", + "format": "int64", + "example": 8272408576 + }, + "Pids": { + "type": "integer", + "description": "Limits the maximum number of PIDs in the container. Set `0` for unlimited.\n", + "format": "int64", + "example": 100, + "default": 0 + } + }, + "description": "An object describing a limit on resources which can be requested by a task.\n" + }, + "Reservations": { + "type": "object", + "properties": { + "NanoCPUs": { + "type": "integer", + "format": "int64", + "example": 4000000000 + }, + "MemoryBytes": { + "type": "integer", + "format": "int64", + "example": 8272408576 + }, + "GenericResources": { + "type": "array", + "description": "User-defined resources can be either Integer resources (e.g, `SSD=3`) or\nString resources (e.g, `GPU=UUID1`).\n", + "example": [ + { + "DiscreteResourceSpec": { + "Kind": "SSD", + "Value": 3 + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID1" + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID2" + } + } + ], + "items": { + "type": "object", + "properties": { + "NamedResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + }, + "DiscreteResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "integer", + "format": "int64" + } + } + } + } + } + } + }, + "description": "An object describing the resources which can be advertised by a node and\nrequested by a task.\n" + } + }, + "description": "Resource requirements which apply to each individual container created\nas part of the service.\n" + }, + "RestartPolicy": { + "type": "object", + "properties": { + "Condition": { + "type": "string", + "description": "Condition for restart.", + "enum": [ + "none", + "on-failure", + "any" + ] + }, + "Delay": { + "type": "integer", + "description": "Delay between restart attempts.", + "format": "int64" + }, + "MaxAttempts": { + "type": "integer", + "description": "Maximum attempts to restart a given container before giving up\n(default value is 0, which is ignored).\n", + "format": "int64", + "default": 0 + }, + "Window": { + "type": "integer", + "description": "Windows is the time window used to evaluate the restart policy\n(default value is 0, which is unbounded).\n", + "format": "int64", + "default": 0 + } + }, + "description": "Specification for the restart policy which applies to containers\ncreated as part of this service.\n" + }, + "Placement": { + "type": "object", + "properties": { + "Constraints": { + "type": "array", + "description": "An array of constraint expressions to limit the set of nodes where\na task can be scheduled. Constraint expressions can either use a\n_match_ (`==`) or _exclude_ (`!=`) rule. Multiple constraints find\nnodes that satisfy every expression (AND match). Constraints can\nmatch node or Docker Engine labels as follows:\n\nnode attribute | matches | example\n---------------------|--------------------------------|-----------------------------------------------\n`node.id` | Node ID | `node.id==2ivku8v2gvtg4`\n`node.hostname` | Node hostname | `node.hostname!=node-2`\n`node.role` | Node role (`manager`/`worker`) | `node.role==manager`\n`node.platform.os` | Node operating system | `node.platform.os==windows`\n`node.platform.arch` | Node architecture | `node.platform.arch==x86_64`\n`node.labels` | User-defined node labels | `node.labels.security==high`\n`engine.labels` | Docker Engine's labels | `engine.labels.operatingsystem==ubuntu-14.04`\n\n`engine.labels` apply to Docker Engine labels like operating system,\ndrivers, etc. Swarm administrators add `node.labels` for operational\npurposes by using the [`node update endpoint`](#operation/NodeUpdate).\n", + "example": [ + "node.hostname!=node3.corp.example.com", + "node.role!=manager", + "node.labels.type==production", + "node.platform.os==linux", + "node.platform.arch==x86_64" + ], + "items": { + "type": "string" + } + }, + "Preferences": { + "type": "array", + "description": "Preferences provide a way to make the scheduler aware of factors\nsuch as topology. They are provided in order from highest to\nlowest precedence.\n", + "example": [ + { + "Spread": { + "SpreadDescriptor": "node.labels.datacenter" + } + }, + { + "Spread": { + "SpreadDescriptor": "node.labels.rack" + } + } + ], + "items": { + "type": "object", + "properties": { + "Spread": { + "type": "object", + "properties": { + "SpreadDescriptor": { + "type": "string", + "description": "label descriptor, such as `engine.labels.az`.\n" + } + } + } + } + } + }, + "MaxReplicas": { + "type": "integer", + "description": "Maximum number of replicas for per node (default value is 0, which\nis unlimited)\n", + "format": "int64", + "default": 0 + }, + "Platforms": { + "type": "array", + "description": "Platforms stores all the platforms that the service's image can\nrun on. This field is used in the platform filter for scheduling.\nIf empty, then the platform filter is off, meaning there are no\nscheduling restrictions.\n", + "items": { + "type": "object", + "properties": { + "Architecture": { + "type": "string", + "description": "Architecture represents the hardware architecture (for example,\n`x86_64`).\n", + "example": "x86_64" + }, + "OS": { + "type": "string", + "description": "OS represents the Operating System (for example, `linux` or `windows`).\n", + "example": "linux" + } + }, + "description": "Platform represents the platform (Arch/OS).\n" + } + } + } + }, + "ForceUpdate": { + "type": "integer", + "description": "A counter that triggers an update even if no relevant parameters have\nbeen changed.\n" + }, + "Runtime": { + "type": "string", + "description": "Runtime is the type of runtime specified for the task executor.\n" + }, + "Networks": { + "type": "array", + "description": "Specifies which networks the service should attach to.", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "The target network for attachment. Must be a network name or ID.\n" + }, + "Aliases": { + "type": "array", + "description": "Discoverable alternate names for the service on this network.\n", + "items": { + "type": "string" + } + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver attachment options for the network target.\n" + } + }, + "description": "Specifies how a service should be attached to a particular network.\n" + } + }, + "LogDriver": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "description": "Specifies the log driver to use for tasks created from this spec. If\nnot present, the default one for the swarm will be used, finally\nfalling back to the engine default if not specified.\n" + } + }, + "description": "User modifiable task configuration." + }, + "Mode": { + "type": "object", + "properties": { + "Replicated": { + "type": "object", + "properties": { + "Replicas": { + "type": "integer", + "format": "int64" + } + } + }, + "Global": { + "type": "object", + "properties": {} + }, + "ReplicatedJob": { + "type": "object", + "properties": { + "MaxConcurrent": { + "type": "integer", + "description": "The maximum number of replicas to run simultaneously.\n", + "format": "int64", + "default": 1 + }, + "TotalCompletions": { + "type": "integer", + "description": "The total number of replicas desired to reach the Completed\nstate. If unset, will default to the value of `MaxConcurrent`\n", + "format": "int64" + } + }, + "description": "The mode used for services with a finite number of tasks that run\nto a completed state.\n" + }, + "GlobalJob": { + "type": "object", + "properties": {}, + "description": "The mode used for services which run a task to the completed state\non each valid node.\n" + } + }, + "description": "Scheduling mode for the service." + }, + "UpdateConfig": { + "type": "object", + "properties": { + "Parallelism": { + "type": "integer", + "description": "Maximum number of tasks to be updated in one iteration (0 means\nunlimited parallelism).\n", + "format": "int64" + }, + "Delay": { + "type": "integer", + "description": "Amount of time between updates, in nanoseconds.", + "format": "int64" + }, + "FailureAction": { + "type": "string", + "description": "Action to take if an updated task fails to run, or stops running\nduring the update.\n", + "enum": [ + "continue", + "pause", + "rollback" + ] + }, + "Monitor": { + "type": "integer", + "description": "Amount of time to monitor each updated task for failures, in\nnanoseconds.\n", + "format": "int64" + }, + "MaxFailureRatio": { + "type": "number", + "description": "The fraction of tasks that may fail during an update before the\nfailure action is invoked, specified as a floating point number\nbetween 0 and 1.\n" + }, + "Order": { + "type": "string", + "description": "The order of operations when rolling out an updated task. Either\nthe old task is shut down before the new task is started, or the\nnew task is started before the old task is shut down.\n", + "enum": [ + "stop-first", + "start-first" + ] + } + }, + "description": "Specification for the update strategy of the service." + }, + "RollbackConfig": { + "type": "object", + "properties": { + "Parallelism": { + "type": "integer", + "description": "Maximum number of tasks to be rolled back in one iteration (0 means\nunlimited parallelism).\n", + "format": "int64" + }, + "Delay": { + "type": "integer", + "description": "Amount of time between rollback iterations, in nanoseconds.\n", + "format": "int64" + }, + "FailureAction": { + "type": "string", + "description": "Action to take if an rolled back task fails to run, or stops\nrunning during the rollback.\n", + "enum": [ + "continue", + "pause" + ] + }, + "Monitor": { + "type": "integer", + "description": "Amount of time to monitor each rolled back task for failures, in\nnanoseconds.\n", + "format": "int64" + }, + "MaxFailureRatio": { + "type": "number", + "description": "The fraction of tasks that may fail during a rollback before the\nfailure action is invoked, specified as a floating point number\nbetween 0 and 1.\n" + }, + "Order": { + "type": "string", + "description": "The order of operations when rolling back a task. Either the old\ntask is shut down before the new task is started, or the new task\nis started before the old task is shut down.\n", + "enum": [ + "stop-first", + "start-first" + ] + } + }, + "description": "Specification for the rollback strategy of the service." + }, + "Networks": { + "type": "array", + "description": "Specifies which networks the service should attach to.", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "The target network for attachment. Must be a network name or ID.\n" + }, + "Aliases": { + "type": "array", + "description": "Discoverable alternate names for the service on this network.\n", + "items": { + "type": "string" + } + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver attachment options for the network target.\n" + } + }, + "description": "Specifies how a service should be attached to a particular network.\n" + } + }, + "EndpointSpec": { + "type": "object", + "properties": { + "Mode": { + "type": "string", + "description": "The mode of resolution to use for internal load balancing between tasks.\n", + "default": "vip", + "enum": [ + "vip", + "dnsrr" + ] + }, + "Ports": { + "type": "array", + "description": "List of exposed ports that this service is accessible on from the\noutside. Ports can only be provided if `vip` resolution mode is used.\n", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Protocol": { + "type": "string", + "enum": [ + "tcp", + "udp", + "sctp" + ] + }, + "TargetPort": { + "type": "integer", + "description": "The port inside the container." + }, + "PublishedPort": { + "type": "integer", + "description": "The port on the swarm hosts." + }, + "PublishMode": { + "type": "string", + "description": "The mode in which port is published.\n\n


\n\n- \"ingress\" makes the target port accessible on every node,\n regardless of whether there is a task for the service running on\n that node or not.\n- \"host\" bypasses the routing mesh and publish the port directly on\n the swarm node where that service is running.\n", + "example": "ingress", + "default": "ingress", + "enum": [ + "ingress", + "host" + ] + } + } + } + } + }, + "description": "Properties that can be configured to access and load balance a service." + } + }, + "description": "User modifiable configuration for a service." + }, + "Endpoint": { + "type": "object", + "properties": { + "Spec": { + "type": "object", + "properties": { + "Mode": { + "type": "string", + "description": "The mode of resolution to use for internal load balancing between tasks.\n", + "default": "vip", + "enum": [ + "vip", + "dnsrr" + ] + }, + "Ports": { + "type": "array", + "description": "List of exposed ports that this service is accessible on from the\noutside. Ports can only be provided if `vip` resolution mode is used.\n", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Protocol": { + "type": "string", + "enum": [ + "tcp", + "udp", + "sctp" + ] + }, + "TargetPort": { + "type": "integer", + "description": "The port inside the container." + }, + "PublishedPort": { + "type": "integer", + "description": "The port on the swarm hosts." + }, + "PublishMode": { + "type": "string", + "description": "The mode in which port is published.\n\n


\n\n- \"ingress\" makes the target port accessible on every node,\n regardless of whether there is a task for the service running on\n that node or not.\n- \"host\" bypasses the routing mesh and publish the port directly on\n the swarm node where that service is running.\n", + "example": "ingress", + "default": "ingress", + "enum": [ + "ingress", + "host" + ] + } + } + } + } + }, + "description": "Properties that can be configured to access and load balance a service." + }, + "Ports": { + "type": "array", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Protocol": { + "type": "string", + "enum": [ + "tcp", + "udp", + "sctp" + ] + }, + "TargetPort": { + "type": "integer", + "description": "The port inside the container." + }, + "PublishedPort": { + "type": "integer", + "description": "The port on the swarm hosts." + }, + "PublishMode": { + "type": "string", + "description": "The mode in which port is published.\n\n


\n\n- \"ingress\" makes the target port accessible on every node,\n regardless of whether there is a task for the service running on\n that node or not.\n- \"host\" bypasses the routing mesh and publish the port directly on\n the swarm node where that service is running.\n", + "example": "ingress", + "default": "ingress", + "enum": [ + "ingress", + "host" + ] + } + } + } + }, + "VirtualIPs": { + "type": "array", + "items": { + "type": "object", + "properties": { + "NetworkID": { + "type": "string" + }, + "Addr": { + "type": "string" + } + } + } + } + } + }, + "UpdateStatus": { + "type": "object", + "properties": { + "State": { + "type": "string", + "enum": [ + "updating", + "paused", + "completed" + ] + }, + "StartedAt": { + "type": "string", + "format": "dateTime" + }, + "CompletedAt": { + "type": "string", + "format": "dateTime" + }, + "Message": { + "type": "string" + } + }, + "description": "The status of a service update." + }, + "ServiceStatus": { + "type": "object", + "properties": { + "RunningTasks": { + "type": "integer", + "description": "The number of tasks for the service currently in the Running state.\n", + "format": "uint64", + "example": 7 + }, + "DesiredTasks": { + "type": "integer", + "description": "The number of tasks for the service desired to be running.\nFor replicated services, this is the replica count from the\nservice spec. For global services, this is computed by taking\ncount of all tasks for the service with a Desired State other\nthan Shutdown.\n", + "format": "uint64", + "example": 10 + }, + "CompletedTasks": { + "type": "integer", + "description": "The number of tasks for a job that are in the Completed state.\nThis field must be cross-referenced with the service type, as the\nvalue of 0 may mean the service is not in a job mode, or it may\nmean the job-mode service has no tasks yet Completed.\n", + "format": "uint64" + } + }, + "description": "The status of the service's tasks. Provided only when requested as\npart of a ServiceList operation.\n" + }, + "JobStatus": { + "type": "object", + "properties": { + "JobIteration": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "LastExecution": { + "type": "string", + "description": "The last time, as observed by the server, that this job was\nstarted.\n", + "format": "dateTime" + } + }, + "description": "The status of the service when it is in one of ReplicatedJob or\nGlobalJob modes. Absent on Replicated and Global mode services. The\nJobIteration is an ObjectVersion, but unlike the Service's version,\ndoes not need to be sent with an update request.\n" + } + }, + "example": { + "ID": "9mnpnzenvg8p8tdbtq4wvbkcz", + "Version": { + "Index": 19 + }, + "CreatedAt": "2016-06-07T21:05:51.880065305Z", + "UpdatedAt": "2016-06-07T21:07:29.962229872Z", + "Spec": { + "Name": "hopeful_cori", + "TaskTemplate": { + "ContainerSpec": { + "Image": "redis" + }, + "Resources": { + "Limits": {}, + "Reservations": {} + }, + "RestartPolicy": { + "Condition": "any", + "MaxAttempts": 0 + }, + "Placement": {}, + "ForceUpdate": 0 + }, + "Mode": { + "Replicated": { + "Replicas": 1 + } + }, + "UpdateConfig": { + "Parallelism": 1, + "Delay": 1000000000, + "FailureAction": "pause", + "Monitor": 15000000000, + "MaxFailureRatio": 0.15 + }, + "RollbackConfig": { + "Parallelism": 1, + "Delay": 1000000000, + "FailureAction": "pause", + "Monitor": 15000000000, + "MaxFailureRatio": 0.15 + }, + "EndpointSpec": { + "Mode": "vip", + "Ports": [ + { + "Protocol": "tcp", + "TargetPort": 6379, + "PublishedPort": 30001 + } + ] + } + }, + "Endpoint": { + "Spec": { + "Mode": "vip", + "Ports": [ + { + "Protocol": "tcp", + "TargetPort": 6379, + "PublishedPort": 30001 + } + ] + }, + "Ports": [ + { + "Protocol": "tcp", + "TargetPort": 6379, + "PublishedPort": 30001 + } + ], + "VirtualIPs": [ + { + "NetworkID": "4qvuz4ko70xaltuqbt8956gd1", + "Addr": "10.255.0.2/16" + }, + { + "NetworkID": "4qvuz4ko70xaltuqbt8956gd1", + "Addr": "10.255.0.3/16" + } + ] + } + } + } + } + } + }, + "404": { + "description": "no such service", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "503": { + "description": "node is not part of a swarm", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + }, + "delete": { + "tags": [ + "Service" + ], + "summary": "Delete a service", + "operationId": "ServiceDelete", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID or name of service.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "no error", + "content": {} + }, + "404": { + "description": "no such service", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "503": { + "description": "node is not part of a swarm", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/services/{id}/update": { + "post": { + "tags": [ + "Service" + ], + "summary": "Update a service", + "operationId": "ServiceUpdate", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID or name of service.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "version", + "in": "query", + "description": "The version number of the service object being updated. This is\nrequired to avoid conflicting writes.\nThis version number should be the value as currently set on the\nservice *before* the update. You can find the current version by\ncalling `GET /services/{id}`\n", + "required": true, + "schema": { + "type": "integer" + } + }, + { + "name": "registryAuthFrom", + "in": "query", + "description": "If the `X-Registry-Auth` header is not specified, this parameter\nindicates where to find registry authorization credentials.\n", + "schema": { + "type": "string", + "default": "spec", + "enum": [ + "spec", + "previous-spec" + ] + } + }, + { + "name": "rollback", + "in": "query", + "description": "Set to this parameter to `previous` to cause a server-side rollback\nto the previous service spec. The supplied spec will be ignored in\nthis case.\n", + "schema": { + "type": "string" + } + }, + { + "name": "X-Registry-Auth", + "in": "header", + "description": "A base64url-encoded auth configuration for pulling from private\nregistries.\n\nRefer to the [authentication section](#section/Authentication) for\ndetails.\n", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the service." + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "TaskTemplate": { + "type": "object", + "properties": { + "PluginSpec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "The name or 'alias' to use for the plugin." + }, + "Remote": { + "type": "string", + "description": "The plugin image reference to use." + }, + "Disabled": { + "type": "boolean", + "description": "Disable the plugin once scheduled." + }, + "PluginPrivilege": { + "type": "array", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "example": "network" + }, + "Description": { + "type": "string" + }, + "Value": { + "type": "array", + "example": [ + "host" + ], + "items": { + "type": "string" + } + } + }, + "description": "Describes a permission the user has to accept upon installing\nthe plugin.\n", + "x-go-name": "PluginPrivilege" + } + } + }, + "description": "Plugin spec for the service. *(Experimental release only.)*\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "ContainerSpec": { + "type": "object", + "properties": { + "Image": { + "type": "string", + "description": "The image name to use for the container" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value data." + }, + "Command": { + "type": "array", + "description": "The command to be run in the image.", + "items": { + "type": "string" + } + }, + "Args": { + "type": "array", + "description": "Arguments to the command.", + "items": { + "type": "string" + } + }, + "Hostname": { + "type": "string", + "description": "The hostname to use for the container, as a valid\n[RFC 1123](https://tools.ietf.org/html/rfc1123) hostname.\n" + }, + "Env": { + "type": "array", + "description": "A list of environment variables in the form `VAR=value`.\n", + "items": { + "type": "string" + } + }, + "Dir": { + "type": "string", + "description": "The working directory for commands to run in." + }, + "User": { + "type": "string", + "description": "The user inside the container." + }, + "Groups": { + "type": "array", + "description": "A list of additional groups that the container process will run as.\n", + "items": { + "type": "string" + } + }, + "Privileges": { + "type": "object", + "properties": { + "CredentialSpec": { + "type": "object", + "properties": { + "Config": { + "type": "string", + "description": "Load credential spec from a Swarm Config with the given ID.\nThe specified config must also be present in the Configs\nfield with the Runtime property set.\n\n


\n\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n", + "example": "0bt9dmxjvjiqermk6xrop3ekq" + }, + "File": { + "type": "string", + "description": "Load credential spec from this file. The file is read by\nthe daemon, and must be present in the `CredentialSpecs`\nsubdirectory in the docker data directory, which defaults\nto `C:\\ProgramData\\Docker\\` on Windows.\n\nFor example, specifying `spec.json` loads\n`C:\\ProgramData\\Docker\\CredentialSpecs\\spec.json`.\n\n


\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n", + "example": "spec.json" + }, + "Registry": { + "type": "string", + "description": "Load credential spec from this value in the Windows\nregistry. The specified registry value must be located in:\n\n`HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Virtualization\\Containers\\CredentialSpecs`\n\n


\n\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n" + } + }, + "description": "CredentialSpec for managed service account (Windows only)" + }, + "SELinuxContext": { + "type": "object", + "properties": { + "Disable": { + "type": "boolean", + "description": "Disable SELinux" + }, + "User": { + "type": "string", + "description": "SELinux user label" + }, + "Role": { + "type": "string", + "description": "SELinux role label" + }, + "Type": { + "type": "string", + "description": "SELinux type label" + }, + "Level": { + "type": "string", + "description": "SELinux level label" + } + }, + "description": "SELinux labels of the container" + } + }, + "description": "Security options for the container" + }, + "TTY": { + "type": "boolean", + "description": "Whether a pseudo-TTY should be allocated." + }, + "OpenStdin": { + "type": "boolean", + "description": "Open `stdin`" + }, + "ReadOnly": { + "type": "boolean", + "description": "Mount the container's root filesystem as read only." + }, + "Mounts": { + "type": "array", + "description": "Specification for mounts to be added to containers created as part\nof the service.\n", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "Container path." + }, + "Source": { + "type": "string", + "description": "Mount source (e.g. a volume name, a host path)." + }, + "Type": { + "type": "string", + "description": "The mount type. Available types:\n\n- `bind` Mounts a file or directory from the host into the container. Must exist prior to creating the container.\n- `volume` Creates a volume with the given name and options (or uses a pre-existing volume with the same name and options). These are **not** removed when the container is removed.\n- `tmpfs` Create a tmpfs with the given options. The mount source cannot be specified for tmpfs.\n- `npipe` Mounts a named pipe from the host into the container. Must exist prior to creating the container.\n- `cluster` a Swarm cluster volume\n", + "enum": [ + "bind", + "volume", + "tmpfs", + "npipe", + "cluster" + ] + }, + "ReadOnly": { + "type": "boolean", + "description": "Whether the mount should be read-only." + }, + "Consistency": { + "type": "string", + "description": "The consistency requirement for the mount: `default`, `consistent`, `cached`, or `delegated`." + }, + "BindOptions": { + "type": "object", + "properties": { + "Propagation": { + "type": "string", + "description": "A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`.", + "enum": [ + "private", + "rprivate", + "shared", + "rshared", + "slave", + "rslave" + ] + }, + "NonRecursive": { + "type": "boolean", + "description": "Disable recursive bind mount.", + "default": false + }, + "CreateMountpoint": { + "type": "boolean", + "description": "Create mount point on host if missing", + "default": false + } + }, + "description": "Optional configuration for the `bind` type." + }, + "VolumeOptions": { + "type": "object", + "properties": { + "NoCopy": { + "type": "boolean", + "description": "Populate volume with data from the target.", + "default": false + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "DriverConfig": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver to use to create the volume." + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "key/value map of driver specific options." + } + }, + "description": "Map of driver specific options" + } + }, + "description": "Optional configuration for the `volume` type." + }, + "TmpfsOptions": { + "type": "object", + "properties": { + "SizeBytes": { + "type": "integer", + "description": "The size for the tmpfs mount in bytes.", + "format": "int64" + }, + "Mode": { + "type": "integer", + "description": "The permission mode for the tmpfs mount in an integer." + } + }, + "description": "Optional configuration for the `tmpfs` type." + } + } + } + }, + "StopSignal": { + "type": "string", + "description": "Signal to stop the container." + }, + "StopGracePeriod": { + "type": "integer", + "description": "Amount of time to wait for the container to terminate before\nforcefully killing it.\n", + "format": "int64" + }, + "HealthCheck": { + "type": "object", + "properties": { + "Test": { + "type": "array", + "description": "The test to perform. Possible values are:\n\n- `[]` inherit healthcheck from image or parent image\n- `[\"NONE\"]` disable healthcheck\n- `[\"CMD\", args...]` exec arguments directly\n- `[\"CMD-SHELL\", command]` run command with system's default shell\n", + "items": { + "type": "string" + } + }, + "Interval": { + "type": "integer", + "description": "The time to wait between checks in nanoseconds. It should be 0 or at\nleast 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Timeout": { + "type": "integer", + "description": "The time to wait before considering the check to have hung. It should\nbe 0 or at least 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Retries": { + "type": "integer", + "description": "The number of consecutive failures needed to consider a container as\nunhealthy. 0 means inherit.\n" + }, + "StartPeriod": { + "type": "integer", + "description": "Start period for the container to initialize before starting\nhealth-retries countdown in nanoseconds. It should be 0 or at least\n1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + } + }, + "description": "A test to perform to check that the container is healthy." + }, + "Hosts": { + "type": "array", + "description": "A list of hostname/IP mappings to add to the container's `hosts`\nfile. The format of extra hosts is specified in the\n[hosts(5)](http://man7.org/linux/man-pages/man5/hosts.5.html)\nman page:\n\n IP_address canonical_hostname [aliases...]\n", + "items": { + "type": "string" + } + }, + "DNSConfig": { + "type": "object", + "properties": { + "Nameservers": { + "type": "array", + "description": "The IP addresses of the name servers.", + "items": { + "type": "string" + } + }, + "Search": { + "type": "array", + "description": "A search list for host-name lookup.", + "items": { + "type": "string" + } + }, + "Options": { + "type": "array", + "description": "A list of internal resolver variables to be modified (e.g.,\n`debug`, `ndots:3`, etc.).\n", + "items": { + "type": "string" + } + } + }, + "description": "Specification for DNS related configurations in resolver configuration\nfile (`resolv.conf`).\n" + }, + "Secrets": { + "type": "array", + "description": "Secrets contains references to zero or more secrets that will be\nexposed to the service.\n", + "items": { + "type": "object", + "properties": { + "File": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name represents the final filename in the filesystem.\n" + }, + "UID": { + "type": "string", + "description": "UID represents the file UID." + }, + "GID": { + "type": "string", + "description": "GID represents the file GID." + }, + "Mode": { + "type": "integer", + "description": "Mode represents the FileMode of the file.", + "format": "uint32" + } + }, + "description": "File represents a specific target that is backed by a file.\n" + }, + "SecretID": { + "type": "string", + "description": "SecretID represents the ID of the specific secret that we're\nreferencing.\n" + }, + "SecretName": { + "type": "string", + "description": "SecretName is the name of the secret that this references,\nbut this is just provided for lookup/display purposes. The\nsecret in the reference will be identified by its ID.\n" + } + } + } + }, + "Configs": { + "type": "array", + "description": "Configs contains references to zero or more configs that will be\nexposed to the service.\n", + "items": { + "type": "object", + "properties": { + "File": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name represents the final filename in the filesystem.\n" + }, + "UID": { + "type": "string", + "description": "UID represents the file UID." + }, + "GID": { + "type": "string", + "description": "GID represents the file GID." + }, + "Mode": { + "type": "integer", + "description": "Mode represents the FileMode of the file.", + "format": "uint32" + } + }, + "description": "File represents a specific target that is backed by a file.\n\n


\n\n> **Note**: `Configs.File` and `Configs.Runtime` are mutually exclusive\n" + }, + "Runtime": { + "type": "object", + "properties": {}, + "description": "Runtime represents a target that is not mounted into the\ncontainer but is used by the task\n\n


\n\n> **Note**: `Configs.File` and `Configs.Runtime` are mutually\n> exclusive\n" + }, + "ConfigID": { + "type": "string", + "description": "ConfigID represents the ID of the specific config that we're\nreferencing.\n" + }, + "ConfigName": { + "type": "string", + "description": "ConfigName is the name of the config that this references,\nbut this is just provided for lookup/display purposes. The\nconfig in the reference will be identified by its ID.\n" + } + } + } + }, + "Isolation": { + "type": "string", + "description": "Isolation technology of the containers running the service.\n(Windows only)\n", + "enum": [ + "default", + "process", + "hyperv", + "" + ] + }, + "Init": { + "type": "boolean", + "description": "Run an init inside the container that forwards signals and reaps\nprocesses. This field is omitted if empty, and the default (as\nconfigured on the daemon) is used.\n", + "nullable": true + }, + "Sysctls": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Set kernel namedspaced parameters (sysctls) in the container.\nThe Sysctls option on services accepts the same sysctls as the\nare supported on containers. Note that while the same sysctls are\nsupported, no guarantees or checks are made about their\nsuitability for a clustered environment, and it's up to the user\nto determine whether a given sysctl will work properly in a\nService.\n" + }, + "CapabilityAdd": { + "type": "array", + "description": "A list of kernel capabilities to add to the default set\nfor the container.\n", + "example": [ + "CAP_NET_RAW", + "CAP_SYS_ADMIN", + "CAP_SYS_CHROOT", + "CAP_SYSLOG" + ], + "items": { + "type": "string" + } + }, + "CapabilityDrop": { + "type": "array", + "description": "A list of kernel capabilities to drop from the default set\nfor the container.\n", + "example": [ + "CAP_NET_RAW" + ], + "items": { + "type": "string" + } + }, + "Ulimits": { + "type": "array", + "description": "A list of resource limits to set in the container. For example: `{\"Name\": \"nofile\", \"Soft\": 1024, \"Hard\": 2048}`\"\n", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of ulimit" + }, + "Soft": { + "type": "integer", + "description": "Soft limit" + }, + "Hard": { + "type": "integer", + "description": "Hard limit" + } + } + } + } + }, + "description": "Container spec for the service.\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "NetworkAttachmentSpec": { + "type": "object", + "properties": { + "ContainerID": { + "type": "string", + "description": "ID of the container represented by this task" + } + }, + "description": "Read-only spec type for non-swarm containers attached to swarm overlay\nnetworks.\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "Resources": { + "type": "object", + "properties": { + "Limits": { + "type": "object", + "properties": { + "NanoCPUs": { + "type": "integer", + "format": "int64", + "example": 4000000000 + }, + "MemoryBytes": { + "type": "integer", + "format": "int64", + "example": 8272408576 + }, + "Pids": { + "type": "integer", + "description": "Limits the maximum number of PIDs in the container. Set `0` for unlimited.\n", + "format": "int64", + "example": 100, + "default": 0 + } + }, + "description": "An object describing a limit on resources which can be requested by a task.\n" + }, + "Reservations": { + "type": "object", + "properties": { + "NanoCPUs": { + "type": "integer", + "format": "int64", + "example": 4000000000 + }, + "MemoryBytes": { + "type": "integer", + "format": "int64", + "example": 8272408576 + }, + "GenericResources": { + "type": "array", + "description": "User-defined resources can be either Integer resources (e.g, `SSD=3`) or\nString resources (e.g, `GPU=UUID1`).\n", + "example": [ + { + "DiscreteResourceSpec": { + "Kind": "SSD", + "Value": 3 + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID1" + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID2" + } + } + ], + "items": { + "type": "object", + "properties": { + "NamedResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + }, + "DiscreteResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "integer", + "format": "int64" + } + } + } + } + } + } + }, + "description": "An object describing the resources which can be advertised by a node and\nrequested by a task.\n" + } + }, + "description": "Resource requirements which apply to each individual container created\nas part of the service.\n" + }, + "RestartPolicy": { + "type": "object", + "properties": { + "Condition": { + "type": "string", + "description": "Condition for restart.", + "enum": [ + "none", + "on-failure", + "any" + ] + }, + "Delay": { + "type": "integer", + "description": "Delay between restart attempts.", + "format": "int64" + }, + "MaxAttempts": { + "type": "integer", + "description": "Maximum attempts to restart a given container before giving up\n(default value is 0, which is ignored).\n", + "format": "int64", + "default": 0 + }, + "Window": { + "type": "integer", + "description": "Windows is the time window used to evaluate the restart policy\n(default value is 0, which is unbounded).\n", + "format": "int64", + "default": 0 + } + }, + "description": "Specification for the restart policy which applies to containers\ncreated as part of this service.\n" + }, + "Placement": { + "type": "object", + "properties": { + "Constraints": { + "type": "array", + "description": "An array of constraint expressions to limit the set of nodes where\na task can be scheduled. Constraint expressions can either use a\n_match_ (`==`) or _exclude_ (`!=`) rule. Multiple constraints find\nnodes that satisfy every expression (AND match). Constraints can\nmatch node or Docker Engine labels as follows:\n\nnode attribute | matches | example\n---------------------|--------------------------------|-----------------------------------------------\n`node.id` | Node ID | `node.id==2ivku8v2gvtg4`\n`node.hostname` | Node hostname | `node.hostname!=node-2`\n`node.role` | Node role (`manager`/`worker`) | `node.role==manager`\n`node.platform.os` | Node operating system | `node.platform.os==windows`\n`node.platform.arch` | Node architecture | `node.platform.arch==x86_64`\n`node.labels` | User-defined node labels | `node.labels.security==high`\n`engine.labels` | Docker Engine's labels | `engine.labels.operatingsystem==ubuntu-14.04`\n\n`engine.labels` apply to Docker Engine labels like operating system,\ndrivers, etc. Swarm administrators add `node.labels` for operational\npurposes by using the [`node update endpoint`](#operation/NodeUpdate).\n", + "example": [ + "node.hostname!=node3.corp.example.com", + "node.role!=manager", + "node.labels.type==production", + "node.platform.os==linux", + "node.platform.arch==x86_64" + ], + "items": { + "type": "string" + } + }, + "Preferences": { + "type": "array", + "description": "Preferences provide a way to make the scheduler aware of factors\nsuch as topology. They are provided in order from highest to\nlowest precedence.\n", + "example": [ + { + "Spread": { + "SpreadDescriptor": "node.labels.datacenter" + } + }, + { + "Spread": { + "SpreadDescriptor": "node.labels.rack" + } + } + ], + "items": { + "type": "object", + "properties": { + "Spread": { + "type": "object", + "properties": { + "SpreadDescriptor": { + "type": "string", + "description": "label descriptor, such as `engine.labels.az`.\n" + } + } + } + } + } + }, + "MaxReplicas": { + "type": "integer", + "description": "Maximum number of replicas for per node (default value is 0, which\nis unlimited)\n", + "format": "int64", + "default": 0 + }, + "Platforms": { + "type": "array", + "description": "Platforms stores all the platforms that the service's image can\nrun on. This field is used in the platform filter for scheduling.\nIf empty, then the platform filter is off, meaning there are no\nscheduling restrictions.\n", + "items": { + "type": "object", + "properties": { + "Architecture": { + "type": "string", + "description": "Architecture represents the hardware architecture (for example,\n`x86_64`).\n", + "example": "x86_64" + }, + "OS": { + "type": "string", + "description": "OS represents the Operating System (for example, `linux` or `windows`).\n", + "example": "linux" + } + }, + "description": "Platform represents the platform (Arch/OS).\n" + } + } + } + }, + "ForceUpdate": { + "type": "integer", + "description": "A counter that triggers an update even if no relevant parameters have\nbeen changed.\n" + }, + "Runtime": { + "type": "string", + "description": "Runtime is the type of runtime specified for the task executor.\n" + }, + "Networks": { + "type": "array", + "description": "Specifies which networks the service should attach to.", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "The target network for attachment. Must be a network name or ID.\n" + }, + "Aliases": { + "type": "array", + "description": "Discoverable alternate names for the service on this network.\n", + "items": { + "type": "string" + } + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver attachment options for the network target.\n" + } + }, + "description": "Specifies how a service should be attached to a particular network.\n" + } + }, + "LogDriver": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "description": "Specifies the log driver to use for tasks created from this spec. If\nnot present, the default one for the swarm will be used, finally\nfalling back to the engine default if not specified.\n" + } + }, + "description": "User modifiable task configuration." + }, + "Mode": { + "type": "object", + "properties": { + "Replicated": { + "type": "object", + "properties": { + "Replicas": { + "type": "integer", + "format": "int64" + } + } + }, + "Global": { + "type": "object", + "properties": {} + }, + "ReplicatedJob": { + "type": "object", + "properties": { + "MaxConcurrent": { + "type": "integer", + "description": "The maximum number of replicas to run simultaneously.\n", + "format": "int64", + "default": 1 + }, + "TotalCompletions": { + "type": "integer", + "description": "The total number of replicas desired to reach the Completed\nstate. If unset, will default to the value of `MaxConcurrent`\n", + "format": "int64" + } + }, + "description": "The mode used for services with a finite number of tasks that run\nto a completed state.\n" + }, + "GlobalJob": { + "type": "object", + "properties": {}, + "description": "The mode used for services which run a task to the completed state\non each valid node.\n" + } + }, + "description": "Scheduling mode for the service." + }, + "UpdateConfig": { + "type": "object", + "properties": { + "Parallelism": { + "type": "integer", + "description": "Maximum number of tasks to be updated in one iteration (0 means\nunlimited parallelism).\n", + "format": "int64" + }, + "Delay": { + "type": "integer", + "description": "Amount of time between updates, in nanoseconds.", + "format": "int64" + }, + "FailureAction": { + "type": "string", + "description": "Action to take if an updated task fails to run, or stops running\nduring the update.\n", + "enum": [ + "continue", + "pause", + "rollback" + ] + }, + "Monitor": { + "type": "integer", + "description": "Amount of time to monitor each updated task for failures, in\nnanoseconds.\n", + "format": "int64" + }, + "MaxFailureRatio": { + "type": "number", + "description": "The fraction of tasks that may fail during an update before the\nfailure action is invoked, specified as a floating point number\nbetween 0 and 1.\n" + }, + "Order": { + "type": "string", + "description": "The order of operations when rolling out an updated task. Either\nthe old task is shut down before the new task is started, or the\nnew task is started before the old task is shut down.\n", + "enum": [ + "stop-first", + "start-first" + ] + } + }, + "description": "Specification for the update strategy of the service." + }, + "RollbackConfig": { + "type": "object", + "properties": { + "Parallelism": { + "type": "integer", + "description": "Maximum number of tasks to be rolled back in one iteration (0 means\nunlimited parallelism).\n", + "format": "int64" + }, + "Delay": { + "type": "integer", + "description": "Amount of time between rollback iterations, in nanoseconds.\n", + "format": "int64" + }, + "FailureAction": { + "type": "string", + "description": "Action to take if an rolled back task fails to run, or stops\nrunning during the rollback.\n", + "enum": [ + "continue", + "pause" + ] + }, + "Monitor": { + "type": "integer", + "description": "Amount of time to monitor each rolled back task for failures, in\nnanoseconds.\n", + "format": "int64" + }, + "MaxFailureRatio": { + "type": "number", + "description": "The fraction of tasks that may fail during a rollback before the\nfailure action is invoked, specified as a floating point number\nbetween 0 and 1.\n" + }, + "Order": { + "type": "string", + "description": "The order of operations when rolling back a task. Either the old\ntask is shut down before the new task is started, or the new task\nis started before the old task is shut down.\n", + "enum": [ + "stop-first", + "start-first" + ] + } + }, + "description": "Specification for the rollback strategy of the service." + }, + "Networks": { + "type": "array", + "description": "Specifies which networks the service should attach to.", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "The target network for attachment. Must be a network name or ID.\n" + }, + "Aliases": { + "type": "array", + "description": "Discoverable alternate names for the service on this network.\n", + "items": { + "type": "string" + } + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver attachment options for the network target.\n" + } + }, + "description": "Specifies how a service should be attached to a particular network.\n" + } + }, + "EndpointSpec": { + "type": "object", + "properties": { + "Mode": { + "type": "string", + "description": "The mode of resolution to use for internal load balancing between tasks.\n", + "default": "vip", + "enum": [ + "vip", + "dnsrr" + ] + }, + "Ports": { + "type": "array", + "description": "List of exposed ports that this service is accessible on from the\noutside. Ports can only be provided if `vip` resolution mode is used.\n", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Protocol": { + "type": "string", + "enum": [ + "tcp", + "udp", + "sctp" + ] + }, + "TargetPort": { + "type": "integer", + "description": "The port inside the container." + }, + "PublishedPort": { + "type": "integer", + "description": "The port on the swarm hosts." + }, + "PublishMode": { + "type": "string", + "description": "The mode in which port is published.\n\n


\n\n- \"ingress\" makes the target port accessible on every node,\n regardless of whether there is a task for the service running on\n that node or not.\n- \"host\" bypasses the routing mesh and publish the port directly on\n the swarm node where that service is running.\n", + "example": "ingress", + "default": "ingress", + "enum": [ + "ingress", + "host" + ] + } + } + } + } + }, + "description": "Properties that can be configured to access and load balance a service." + } + }, + "description": "User modifiable configuration for a service." + }, + { + "type": "object", + "example": { + "Name": "top", + "TaskTemplate": { + "ContainerSpec": { + "Image": "busybox", + "Args": [ + "top" + ] + }, + "Resources": { + "Limits": {}, + "Reservations": {} + }, + "RestartPolicy": { + "Condition": "any", + "MaxAttempts": 0 + }, + "Placement": {}, + "ForceUpdate": 0 + }, + "Mode": { + "Replicated": { + "Replicas": 1 + } + }, + "UpdateConfig": { + "Parallelism": 2, + "Delay": 1000000000, + "FailureAction": "pause", + "Monitor": 15000000000, + "MaxFailureRatio": 0.15 + }, + "RollbackConfig": { + "Parallelism": 1, + "Delay": 1000000000, + "FailureAction": "pause", + "Monitor": 15000000000, + "MaxFailureRatio": 0.15 + }, + "EndpointSpec": { + "Mode": "vip" + } + } + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "no error", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "Warnings": { + "type": "array", + "description": "Optional warning messages", + "items": { + "type": "string" + } + } + }, + "example": { + "Warning": "unable to pin image doesnotexist:latest to digest: image library/doesnotexist:latest not found" + } + } + } + } + }, + "400": { + "description": "bad parameter", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "404": { + "description": "no such service", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "503": { + "description": "node is not part of a swarm", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + }, + "x-codegen-request-body-name": "body" + } + }, + "/services/{id}/logs": { + "get": { + "tags": [ + "Service" + ], + "summary": "Get service logs", + "description": "Get `stdout` and `stderr` logs from a service. See also\n[`/containers/{id}/logs`](#operation/ContainerLogs).\n\n**Note**: This endpoint works only for services with the `local`,\n`json-file` or `journald` logging drivers.\n", + "operationId": "ServiceLogs", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID or name of the service", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "details", + "in": "query", + "description": "Show service context and extra details provided to logs.", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "follow", + "in": "query", + "description": "Keep connection after returning logs.", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "stdout", + "in": "query", + "description": "Return logs from `stdout`", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "stderr", + "in": "query", + "description": "Return logs from `stderr`", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "since", + "in": "query", + "description": "Only return logs since this time, as a UNIX timestamp", + "schema": { + "type": "integer", + "default": 0 + } + }, + { + "name": "timestamps", + "in": "query", + "description": "Add timestamps to every log line", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "tail", + "in": "query", + "description": "Only return this number of log lines from the end of the logs.\nSpecify as an integer or `all` to output all log lines.\n", + "schema": { + "type": "string", + "default": "all" + } + } + ], + "responses": { + "200": { + "description": "logs returned as a stream in response body", + "content": { + "application/vnd.docker.raw-stream": { + "schema": { + "type": "string", + "format": "binary" + } + }, + "application/vnd.docker.multiplexed-stream": { + "schema": { + "type": "string", + "format": "binary" + } + } + } + }, + "404": { + "description": "no such service", + "content": { + "application/vnd.docker.raw-stream": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "application/vnd.docker.multiplexed-stream": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "application/json": { + "example": { + "message": "No such service: c2ada9df5af8" + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/vnd.docker.raw-stream": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "application/vnd.docker.multiplexed-stream": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "503": { + "description": "node is not part of a swarm", + "content": { + "application/vnd.docker.raw-stream": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "application/vnd.docker.multiplexed-stream": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/tasks": { + "get": { + "tags": [ + "Task" + ], + "summary": "List tasks", + "operationId": "TaskList", + "parameters": [ + { + "name": "filters", + "in": "query", + "description": "A JSON encoded value of the filters (a `map[string][]string`) to\nprocess on the tasks list.\n\nAvailable filters:\n\n- `desired-state=(running | shutdown | accepted)`\n- `id=`\n- `label=key` or `label=\"key=value\"`\n- `name=`\n- `node=`\n- `service=`\n", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "no error", + "content": { + "application/json": { + "schema": { + "type": "array", + "example": [ + { + "ID": "0kzzo1i0y4jz6027t0k7aezc7", + "Version": { + "Index": 71 + }, + "CreatedAt": "2016-06-07T21:07:31.171892745Z", + "UpdatedAt": "2016-06-07T21:07:31.376370513Z", + "Spec": { + "ContainerSpec": { + "Image": "redis" + }, + "Resources": { + "Limits": {}, + "Reservations": {} + }, + "RestartPolicy": { + "Condition": "any", + "MaxAttempts": 0 + }, + "Placement": {} + }, + "ServiceID": "9mnpnzenvg8p8tdbtq4wvbkcz", + "Slot": 1, + "NodeID": "60gvrl6tm78dmak4yl7srz94v", + "Status": { + "Timestamp": "2016-06-07T21:07:31.290032978Z", + "State": "running", + "Message": "started", + "ContainerStatus": { + "ContainerID": "e5d62702a1b48d01c3e02ca1e0212a250801fa8d67caca0b6f35919ebc12f035", + "PID": 677 + } + }, + "DesiredState": "running", + "NetworksAttachments": [ + { + "Network": { + "ID": "4qvuz4ko70xaltuqbt8956gd1", + "Version": { + "Index": 18 + }, + "CreatedAt": "2016-06-07T20:31:11.912919752Z", + "UpdatedAt": "2016-06-07T21:07:29.955277358Z", + "Spec": { + "Name": "ingress", + "Labels": { + "com.docker.swarm.internal": "true" + }, + "DriverConfiguration": {}, + "IPAMOptions": { + "Driver": {}, + "Configs": [ + { + "Subnet": "10.255.0.0/16", + "Gateway": "10.255.0.1" + } + ] + } + }, + "DriverState": { + "Name": "overlay", + "Options": { + "com.docker.network.driver.overlay.vxlanid_list": "256" + } + }, + "IPAMOptions": { + "Driver": { + "Name": "default" + }, + "Configs": [ + { + "Subnet": "10.255.0.0/16", + "Gateway": "10.255.0.1" + } + ] + } + }, + "Addresses": [ + "10.255.0.10/16" + ] + } + ] + }, + { + "ID": "1yljwbmlr8er2waf8orvqpwms", + "Version": { + "Index": 30 + }, + "CreatedAt": "2016-06-07T21:07:30.019104782Z", + "UpdatedAt": "2016-06-07T21:07:30.231958098Z", + "Name": "hopeful_cori", + "Spec": { + "ContainerSpec": { + "Image": "redis" + }, + "Resources": { + "Limits": {}, + "Reservations": {} + }, + "RestartPolicy": { + "Condition": "any", + "MaxAttempts": 0 + }, + "Placement": {} + }, + "ServiceID": "9mnpnzenvg8p8tdbtq4wvbkcz", + "Slot": 1, + "NodeID": "60gvrl6tm78dmak4yl7srz94v", + "Status": { + "Timestamp": "2016-06-07T21:07:30.202183143Z", + "State": "shutdown", + "Message": "shutdown", + "ContainerStatus": { + "ContainerID": "1cf8d63d18e79668b0004a4be4c6ee58cddfad2dae29506d8781581d0688a213" + } + }, + "DesiredState": "shutdown", + "NetworksAttachments": [ + { + "Network": { + "ID": "4qvuz4ko70xaltuqbt8956gd1", + "Version": { + "Index": 18 + }, + "CreatedAt": "2016-06-07T20:31:11.912919752Z", + "UpdatedAt": "2016-06-07T21:07:29.955277358Z", + "Spec": { + "Name": "ingress", + "Labels": { + "com.docker.swarm.internal": "true" + }, + "DriverConfiguration": {}, + "IPAMOptions": { + "Driver": {}, + "Configs": [ + { + "Subnet": "10.255.0.0/16", + "Gateway": "10.255.0.1" + } + ] + } + }, + "DriverState": { + "Name": "overlay", + "Options": { + "com.docker.network.driver.overlay.vxlanid_list": "256" + } + }, + "IPAMOptions": { + "Driver": { + "Name": "default" + }, + "Configs": [ + { + "Subnet": "10.255.0.0/16", + "Gateway": "10.255.0.1" + } + ] + } + }, + "Addresses": [ + "10.255.0.5/16" + ] + } + ] + } + ], + "items": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "The ID of the task." + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "format": "dateTime" + }, + "UpdatedAt": { + "type": "string", + "format": "dateTime" + }, + "Name": { + "type": "string", + "description": "Name of the task." + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "Spec": { + "type": "object", + "properties": { + "PluginSpec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "The name or 'alias' to use for the plugin." + }, + "Remote": { + "type": "string", + "description": "The plugin image reference to use." + }, + "Disabled": { + "type": "boolean", + "description": "Disable the plugin once scheduled." + }, + "PluginPrivilege": { + "type": "array", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "example": "network" + }, + "Description": { + "type": "string" + }, + "Value": { + "type": "array", + "example": [ + "host" + ], + "items": { + "type": "string" + } + } + }, + "description": "Describes a permission the user has to accept upon installing\nthe plugin.\n", + "x-go-name": "PluginPrivilege" + } + } + }, + "description": "Plugin spec for the service. *(Experimental release only.)*\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "ContainerSpec": { + "type": "object", + "properties": { + "Image": { + "type": "string", + "description": "The image name to use for the container" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value data." + }, + "Command": { + "type": "array", + "description": "The command to be run in the image.", + "items": { + "type": "string" + } + }, + "Args": { + "type": "array", + "description": "Arguments to the command.", + "items": { + "type": "string" + } + }, + "Hostname": { + "type": "string", + "description": "The hostname to use for the container, as a valid\n[RFC 1123](https://tools.ietf.org/html/rfc1123) hostname.\n" + }, + "Env": { + "type": "array", + "description": "A list of environment variables in the form `VAR=value`.\n", + "items": { + "type": "string" + } + }, + "Dir": { + "type": "string", + "description": "The working directory for commands to run in." + }, + "User": { + "type": "string", + "description": "The user inside the container." + }, + "Groups": { + "type": "array", + "description": "A list of additional groups that the container process will run as.\n", + "items": { + "type": "string" + } + }, + "Privileges": { + "type": "object", + "properties": { + "CredentialSpec": { + "type": "object", + "properties": { + "Config": { + "type": "string", + "description": "Load credential spec from a Swarm Config with the given ID.\nThe specified config must also be present in the Configs\nfield with the Runtime property set.\n\n


\n\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n", + "example": "0bt9dmxjvjiqermk6xrop3ekq" + }, + "File": { + "type": "string", + "description": "Load credential spec from this file. The file is read by\nthe daemon, and must be present in the `CredentialSpecs`\nsubdirectory in the docker data directory, which defaults\nto `C:\\ProgramData\\Docker\\` on Windows.\n\nFor example, specifying `spec.json` loads\n`C:\\ProgramData\\Docker\\CredentialSpecs\\spec.json`.\n\n


\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n", + "example": "spec.json" + }, + "Registry": { + "type": "string", + "description": "Load credential spec from this value in the Windows\nregistry. The specified registry value must be located in:\n\n`HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Virtualization\\Containers\\CredentialSpecs`\n\n


\n\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n" + } + }, + "description": "CredentialSpec for managed service account (Windows only)" + }, + "SELinuxContext": { + "type": "object", + "properties": { + "Disable": { + "type": "boolean", + "description": "Disable SELinux" + }, + "User": { + "type": "string", + "description": "SELinux user label" + }, + "Role": { + "type": "string", + "description": "SELinux role label" + }, + "Type": { + "type": "string", + "description": "SELinux type label" + }, + "Level": { + "type": "string", + "description": "SELinux level label" + } + }, + "description": "SELinux labels of the container" + } + }, + "description": "Security options for the container" + }, + "TTY": { + "type": "boolean", + "description": "Whether a pseudo-TTY should be allocated." + }, + "OpenStdin": { + "type": "boolean", + "description": "Open `stdin`" + }, + "ReadOnly": { + "type": "boolean", + "description": "Mount the container's root filesystem as read only." + }, + "Mounts": { + "type": "array", + "description": "Specification for mounts to be added to containers created as part\nof the service.\n", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "Container path." + }, + "Source": { + "type": "string", + "description": "Mount source (e.g. a volume name, a host path)." + }, + "Type": { + "type": "string", + "description": "The mount type. Available types:\n\n- `bind` Mounts a file or directory from the host into the container. Must exist prior to creating the container.\n- `volume` Creates a volume with the given name and options (or uses a pre-existing volume with the same name and options). These are **not** removed when the container is removed.\n- `tmpfs` Create a tmpfs with the given options. The mount source cannot be specified for tmpfs.\n- `npipe` Mounts a named pipe from the host into the container. Must exist prior to creating the container.\n- `cluster` a Swarm cluster volume\n", + "enum": [ + "bind", + "volume", + "tmpfs", + "npipe", + "cluster" + ] + }, + "ReadOnly": { + "type": "boolean", + "description": "Whether the mount should be read-only." + }, + "Consistency": { + "type": "string", + "description": "The consistency requirement for the mount: `default`, `consistent`, `cached`, or `delegated`." + }, + "BindOptions": { + "type": "object", + "properties": { + "Propagation": { + "type": "string", + "description": "A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`.", + "enum": [ + "private", + "rprivate", + "shared", + "rshared", + "slave", + "rslave" + ] + }, + "NonRecursive": { + "type": "boolean", + "description": "Disable recursive bind mount.", + "default": false + }, + "CreateMountpoint": { + "type": "boolean", + "description": "Create mount point on host if missing", + "default": false + } + }, + "description": "Optional configuration for the `bind` type." + }, + "VolumeOptions": { + "type": "object", + "properties": { + "NoCopy": { + "type": "boolean", + "description": "Populate volume with data from the target.", + "default": false + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "DriverConfig": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver to use to create the volume." + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "key/value map of driver specific options." + } + }, + "description": "Map of driver specific options" + } + }, + "description": "Optional configuration for the `volume` type." + }, + "TmpfsOptions": { + "type": "object", + "properties": { + "SizeBytes": { + "type": "integer", + "description": "The size for the tmpfs mount in bytes.", + "format": "int64" + }, + "Mode": { + "type": "integer", + "description": "The permission mode for the tmpfs mount in an integer." + } + }, + "description": "Optional configuration for the `tmpfs` type." + } + } + } + }, + "StopSignal": { + "type": "string", + "description": "Signal to stop the container." + }, + "StopGracePeriod": { + "type": "integer", + "description": "Amount of time to wait for the container to terminate before\nforcefully killing it.\n", + "format": "int64" + }, + "HealthCheck": { + "type": "object", + "properties": { + "Test": { + "type": "array", + "description": "The test to perform. Possible values are:\n\n- `[]` inherit healthcheck from image or parent image\n- `[\"NONE\"]` disable healthcheck\n- `[\"CMD\", args...]` exec arguments directly\n- `[\"CMD-SHELL\", command]` run command with system's default shell\n", + "items": { + "type": "string" + } + }, + "Interval": { + "type": "integer", + "description": "The time to wait between checks in nanoseconds. It should be 0 or at\nleast 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Timeout": { + "type": "integer", + "description": "The time to wait before considering the check to have hung. It should\nbe 0 or at least 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Retries": { + "type": "integer", + "description": "The number of consecutive failures needed to consider a container as\nunhealthy. 0 means inherit.\n" + }, + "StartPeriod": { + "type": "integer", + "description": "Start period for the container to initialize before starting\nhealth-retries countdown in nanoseconds. It should be 0 or at least\n1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + } + }, + "description": "A test to perform to check that the container is healthy." + }, + "Hosts": { + "type": "array", + "description": "A list of hostname/IP mappings to add to the container's `hosts`\nfile. The format of extra hosts is specified in the\n[hosts(5)](http://man7.org/linux/man-pages/man5/hosts.5.html)\nman page:\n\n IP_address canonical_hostname [aliases...]\n", + "items": { + "type": "string" + } + }, + "DNSConfig": { + "type": "object", + "properties": { + "Nameservers": { + "type": "array", + "description": "The IP addresses of the name servers.", + "items": { + "type": "string" + } + }, + "Search": { + "type": "array", + "description": "A search list for host-name lookup.", + "items": { + "type": "string" + } + }, + "Options": { + "type": "array", + "description": "A list of internal resolver variables to be modified (e.g.,\n`debug`, `ndots:3`, etc.).\n", + "items": { + "type": "string" + } + } + }, + "description": "Specification for DNS related configurations in resolver configuration\nfile (`resolv.conf`).\n" + }, + "Secrets": { + "type": "array", + "description": "Secrets contains references to zero or more secrets that will be\nexposed to the service.\n", + "items": { + "type": "object", + "properties": { + "File": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name represents the final filename in the filesystem.\n" + }, + "UID": { + "type": "string", + "description": "UID represents the file UID." + }, + "GID": { + "type": "string", + "description": "GID represents the file GID." + }, + "Mode": { + "type": "integer", + "description": "Mode represents the FileMode of the file.", + "format": "uint32" + } + }, + "description": "File represents a specific target that is backed by a file.\n" + }, + "SecretID": { + "type": "string", + "description": "SecretID represents the ID of the specific secret that we're\nreferencing.\n" + }, + "SecretName": { + "type": "string", + "description": "SecretName is the name of the secret that this references,\nbut this is just provided for lookup/display purposes. The\nsecret in the reference will be identified by its ID.\n" + } + } + } + }, + "Configs": { + "type": "array", + "description": "Configs contains references to zero or more configs that will be\nexposed to the service.\n", + "items": { + "type": "object", + "properties": { + "File": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name represents the final filename in the filesystem.\n" + }, + "UID": { + "type": "string", + "description": "UID represents the file UID." + }, + "GID": { + "type": "string", + "description": "GID represents the file GID." + }, + "Mode": { + "type": "integer", + "description": "Mode represents the FileMode of the file.", + "format": "uint32" + } + }, + "description": "File represents a specific target that is backed by a file.\n\n


\n\n> **Note**: `Configs.File` and `Configs.Runtime` are mutually exclusive\n" + }, + "Runtime": { + "type": "object", + "properties": {}, + "description": "Runtime represents a target that is not mounted into the\ncontainer but is used by the task\n\n


\n\n> **Note**: `Configs.File` and `Configs.Runtime` are mutually\n> exclusive\n" + }, + "ConfigID": { + "type": "string", + "description": "ConfigID represents the ID of the specific config that we're\nreferencing.\n" + }, + "ConfigName": { + "type": "string", + "description": "ConfigName is the name of the config that this references,\nbut this is just provided for lookup/display purposes. The\nconfig in the reference will be identified by its ID.\n" + } + } + } + }, + "Isolation": { + "type": "string", + "description": "Isolation technology of the containers running the service.\n(Windows only)\n", + "enum": [ + "default", + "process", + "hyperv", + "" + ] + }, + "Init": { + "type": "boolean", + "description": "Run an init inside the container that forwards signals and reaps\nprocesses. This field is omitted if empty, and the default (as\nconfigured on the daemon) is used.\n", + "nullable": true + }, + "Sysctls": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Set kernel namedspaced parameters (sysctls) in the container.\nThe Sysctls option on services accepts the same sysctls as the\nare supported on containers. Note that while the same sysctls are\nsupported, no guarantees or checks are made about their\nsuitability for a clustered environment, and it's up to the user\nto determine whether a given sysctl will work properly in a\nService.\n" + }, + "CapabilityAdd": { + "type": "array", + "description": "A list of kernel capabilities to add to the default set\nfor the container.\n", + "example": [ + "CAP_NET_RAW", + "CAP_SYS_ADMIN", + "CAP_SYS_CHROOT", + "CAP_SYSLOG" + ], + "items": { + "type": "string" + } + }, + "CapabilityDrop": { + "type": "array", + "description": "A list of kernel capabilities to drop from the default set\nfor the container.\n", + "example": [ + "CAP_NET_RAW" + ], + "items": { + "type": "string" + } + }, + "Ulimits": { + "type": "array", + "description": "A list of resource limits to set in the container. For example: `{\"Name\": \"nofile\", \"Soft\": 1024, \"Hard\": 2048}`\"\n", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of ulimit" + }, + "Soft": { + "type": "integer", + "description": "Soft limit" + }, + "Hard": { + "type": "integer", + "description": "Hard limit" + } + } + } + } + }, + "description": "Container spec for the service.\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "NetworkAttachmentSpec": { + "type": "object", + "properties": { + "ContainerID": { + "type": "string", + "description": "ID of the container represented by this task" + } + }, + "description": "Read-only spec type for non-swarm containers attached to swarm overlay\nnetworks.\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "Resources": { + "type": "object", + "properties": { + "Limits": { + "type": "object", + "properties": { + "NanoCPUs": { + "type": "integer", + "format": "int64", + "example": 4000000000 + }, + "MemoryBytes": { + "type": "integer", + "format": "int64", + "example": 8272408576 + }, + "Pids": { + "type": "integer", + "description": "Limits the maximum number of PIDs in the container. Set `0` for unlimited.\n", + "format": "int64", + "example": 100, + "default": 0 + } + }, + "description": "An object describing a limit on resources which can be requested by a task.\n" + }, + "Reservations": { + "type": "object", + "properties": { + "NanoCPUs": { + "type": "integer", + "format": "int64", + "example": 4000000000 + }, + "MemoryBytes": { + "type": "integer", + "format": "int64", + "example": 8272408576 + }, + "GenericResources": { + "type": "array", + "description": "User-defined resources can be either Integer resources (e.g, `SSD=3`) or\nString resources (e.g, `GPU=UUID1`).\n", + "example": [ + { + "DiscreteResourceSpec": { + "Kind": "SSD", + "Value": 3 + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID1" + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID2" + } + } + ], + "items": { + "type": "object", + "properties": { + "NamedResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + }, + "DiscreteResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "integer", + "format": "int64" + } + } + } + } + } + } + }, + "description": "An object describing the resources which can be advertised by a node and\nrequested by a task.\n" + } + }, + "description": "Resource requirements which apply to each individual container created\nas part of the service.\n" + }, + "RestartPolicy": { + "type": "object", + "properties": { + "Condition": { + "type": "string", + "description": "Condition for restart.", + "enum": [ + "none", + "on-failure", + "any" + ] + }, + "Delay": { + "type": "integer", + "description": "Delay between restart attempts.", + "format": "int64" + }, + "MaxAttempts": { + "type": "integer", + "description": "Maximum attempts to restart a given container before giving up\n(default value is 0, which is ignored).\n", + "format": "int64", + "default": 0 + }, + "Window": { + "type": "integer", + "description": "Windows is the time window used to evaluate the restart policy\n(default value is 0, which is unbounded).\n", + "format": "int64", + "default": 0 + } + }, + "description": "Specification for the restart policy which applies to containers\ncreated as part of this service.\n" + }, + "Placement": { + "type": "object", + "properties": { + "Constraints": { + "type": "array", + "description": "An array of constraint expressions to limit the set of nodes where\na task can be scheduled. Constraint expressions can either use a\n_match_ (`==`) or _exclude_ (`!=`) rule. Multiple constraints find\nnodes that satisfy every expression (AND match). Constraints can\nmatch node or Docker Engine labels as follows:\n\nnode attribute | matches | example\n---------------------|--------------------------------|-----------------------------------------------\n`node.id` | Node ID | `node.id==2ivku8v2gvtg4`\n`node.hostname` | Node hostname | `node.hostname!=node-2`\n`node.role` | Node role (`manager`/`worker`) | `node.role==manager`\n`node.platform.os` | Node operating system | `node.platform.os==windows`\n`node.platform.arch` | Node architecture | `node.platform.arch==x86_64`\n`node.labels` | User-defined node labels | `node.labels.security==high`\n`engine.labels` | Docker Engine's labels | `engine.labels.operatingsystem==ubuntu-14.04`\n\n`engine.labels` apply to Docker Engine labels like operating system,\ndrivers, etc. Swarm administrators add `node.labels` for operational\npurposes by using the [`node update endpoint`](#operation/NodeUpdate).\n", + "example": [ + "node.hostname!=node3.corp.example.com", + "node.role!=manager", + "node.labels.type==production", + "node.platform.os==linux", + "node.platform.arch==x86_64" + ], + "items": { + "type": "string" + } + }, + "Preferences": { + "type": "array", + "description": "Preferences provide a way to make the scheduler aware of factors\nsuch as topology. They are provided in order from highest to\nlowest precedence.\n", + "example": [ + { + "Spread": { + "SpreadDescriptor": "node.labels.datacenter" + } + }, + { + "Spread": { + "SpreadDescriptor": "node.labels.rack" + } + } + ], + "items": { + "type": "object", + "properties": { + "Spread": { + "type": "object", + "properties": { + "SpreadDescriptor": { + "type": "string", + "description": "label descriptor, such as `engine.labels.az`.\n" + } + } + } + } + } + }, + "MaxReplicas": { + "type": "integer", + "description": "Maximum number of replicas for per node (default value is 0, which\nis unlimited)\n", + "format": "int64", + "default": 0 + }, + "Platforms": { + "type": "array", + "description": "Platforms stores all the platforms that the service's image can\nrun on. This field is used in the platform filter for scheduling.\nIf empty, then the platform filter is off, meaning there are no\nscheduling restrictions.\n", + "items": { + "type": "object", + "properties": { + "Architecture": { + "type": "string", + "description": "Architecture represents the hardware architecture (for example,\n`x86_64`).\n", + "example": "x86_64" + }, + "OS": { + "type": "string", + "description": "OS represents the Operating System (for example, `linux` or `windows`).\n", + "example": "linux" + } + }, + "description": "Platform represents the platform (Arch/OS).\n" + } + } + } + }, + "ForceUpdate": { + "type": "integer", + "description": "A counter that triggers an update even if no relevant parameters have\nbeen changed.\n" + }, + "Runtime": { + "type": "string", + "description": "Runtime is the type of runtime specified for the task executor.\n" + }, + "Networks": { + "type": "array", + "description": "Specifies which networks the service should attach to.", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "The target network for attachment. Must be a network name or ID.\n" + }, + "Aliases": { + "type": "array", + "description": "Discoverable alternate names for the service on this network.\n", + "items": { + "type": "string" + } + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver attachment options for the network target.\n" + } + }, + "description": "Specifies how a service should be attached to a particular network.\n" + } + }, + "LogDriver": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "description": "Specifies the log driver to use for tasks created from this spec. If\nnot present, the default one for the swarm will be used, finally\nfalling back to the engine default if not specified.\n" + } + }, + "description": "User modifiable task configuration." + }, + "ServiceID": { + "type": "string", + "description": "The ID of the service this task is part of." + }, + "Slot": { + "type": "integer" + }, + "NodeID": { + "type": "string", + "description": "The ID of the node that this task is on." + }, + "AssignedGenericResources": { + "type": "array", + "description": "User-defined resources can be either Integer resources (e.g, `SSD=3`) or\nString resources (e.g, `GPU=UUID1`).\n", + "example": [ + { + "DiscreteResourceSpec": { + "Kind": "SSD", + "Value": 3 + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID1" + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID2" + } + } + ], + "items": { + "type": "object", + "properties": { + "NamedResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + }, + "DiscreteResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "integer", + "format": "int64" + } + } + } + } + } + }, + "Status": { + "type": "object", + "properties": { + "Timestamp": { + "type": "string", + "format": "dateTime" + }, + "State": { + "type": "string", + "enum": [ + "new", + "allocated", + "pending", + "assigned", + "accepted", + "preparing", + "ready", + "starting", + "running", + "complete", + "shutdown", + "failed", + "rejected", + "remove", + "orphaned" + ] + }, + "Message": { + "type": "string" + }, + "Err": { + "type": "string" + }, + "ContainerStatus": { + "type": "object", + "properties": { + "ContainerID": { + "type": "string" + }, + "PID": { + "type": "integer" + }, + "ExitCode": { + "type": "integer" + } + } + } + } + }, + "DesiredState": { + "type": "string", + "enum": [ + "new", + "allocated", + "pending", + "assigned", + "accepted", + "preparing", + "ready", + "starting", + "running", + "complete", + "shutdown", + "failed", + "rejected", + "remove", + "orphaned" + ] + }, + "JobIteration": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + } + }, + "example": { + "ID": "0kzzo1i0y4jz6027t0k7aezc7", + "Version": { + "Index": 71 + }, + "CreatedAt": "2016-06-07T21:07:31.171892745Z", + "UpdatedAt": "2016-06-07T21:07:31.376370513Z", + "Spec": { + "ContainerSpec": { + "Image": "redis" + }, + "Resources": { + "Limits": {}, + "Reservations": {} + }, + "RestartPolicy": { + "Condition": "any", + "MaxAttempts": 0 + }, + "Placement": {} + }, + "ServiceID": "9mnpnzenvg8p8tdbtq4wvbkcz", + "Slot": 1, + "NodeID": "60gvrl6tm78dmak4yl7srz94v", + "Status": { + "Timestamp": "2016-06-07T21:07:31.290032978Z", + "State": "running", + "Message": "started", + "ContainerStatus": { + "ContainerID": "e5d62702a1b48d01c3e02ca1e0212a250801fa8d67caca0b6f35919ebc12f035", + "PID": 677 + } + }, + "DesiredState": "running", + "NetworksAttachments": [ + { + "Network": { + "ID": "4qvuz4ko70xaltuqbt8956gd1", + "Version": { + "Index": 18 + }, + "CreatedAt": "2016-06-07T20:31:11.912919752Z", + "UpdatedAt": "2016-06-07T21:07:29.955277358Z", + "Spec": { + "Name": "ingress", + "Labels": { + "com.docker.swarm.internal": "true" + }, + "DriverConfiguration": {}, + "IPAMOptions": { + "Driver": {}, + "Configs": [ + { + "Subnet": "10.255.0.0/16", + "Gateway": "10.255.0.1" + } + ] + } + }, + "DriverState": { + "Name": "overlay", + "Options": { + "com.docker.network.driver.overlay.vxlanid_list": "256" + } + }, + "IPAMOptions": { + "Driver": { + "Name": "default" + }, + "Configs": [ + { + "Subnet": "10.255.0.0/16", + "Gateway": "10.255.0.1" + } + ] + } + }, + "Addresses": [ + "10.255.0.10/16" + ] + } + ], + "AssignedGenericResources": [ + { + "DiscreteResourceSpec": { + "Kind": "SSD", + "Value": 3 + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID1" + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID2" + } + } + ] + } + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "503": { + "description": "node is not part of a swarm", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/tasks/{id}": { + "get": { + "tags": [ + "Task" + ], + "summary": "Inspect a task", + "operationId": "TaskInspect", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID of the task", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "no error", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "The ID of the task." + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "format": "dateTime" + }, + "UpdatedAt": { + "type": "string", + "format": "dateTime" + }, + "Name": { + "type": "string", + "description": "Name of the task." + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "Spec": { + "type": "object", + "properties": { + "PluginSpec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "The name or 'alias' to use for the plugin." + }, + "Remote": { + "type": "string", + "description": "The plugin image reference to use." + }, + "Disabled": { + "type": "boolean", + "description": "Disable the plugin once scheduled." + }, + "PluginPrivilege": { + "type": "array", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "example": "network" + }, + "Description": { + "type": "string" + }, + "Value": { + "type": "array", + "example": [ + "host" + ], + "items": { + "type": "string" + } + } + }, + "description": "Describes a permission the user has to accept upon installing\nthe plugin.\n", + "x-go-name": "PluginPrivilege" + } + } + }, + "description": "Plugin spec for the service. *(Experimental release only.)*\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "ContainerSpec": { + "type": "object", + "properties": { + "Image": { + "type": "string", + "description": "The image name to use for the container" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value data." + }, + "Command": { + "type": "array", + "description": "The command to be run in the image.", + "items": { + "type": "string" + } + }, + "Args": { + "type": "array", + "description": "Arguments to the command.", + "items": { + "type": "string" + } + }, + "Hostname": { + "type": "string", + "description": "The hostname to use for the container, as a valid\n[RFC 1123](https://tools.ietf.org/html/rfc1123) hostname.\n" + }, + "Env": { + "type": "array", + "description": "A list of environment variables in the form `VAR=value`.\n", + "items": { + "type": "string" + } + }, + "Dir": { + "type": "string", + "description": "The working directory for commands to run in." + }, + "User": { + "type": "string", + "description": "The user inside the container." + }, + "Groups": { + "type": "array", + "description": "A list of additional groups that the container process will run as.\n", + "items": { + "type": "string" + } + }, + "Privileges": { + "type": "object", + "properties": { + "CredentialSpec": { + "type": "object", + "properties": { + "Config": { + "type": "string", + "description": "Load credential spec from a Swarm Config with the given ID.\nThe specified config must also be present in the Configs\nfield with the Runtime property set.\n\n


\n\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n", + "example": "0bt9dmxjvjiqermk6xrop3ekq" + }, + "File": { + "type": "string", + "description": "Load credential spec from this file. The file is read by\nthe daemon, and must be present in the `CredentialSpecs`\nsubdirectory in the docker data directory, which defaults\nto `C:\\ProgramData\\Docker\\` on Windows.\n\nFor example, specifying `spec.json` loads\n`C:\\ProgramData\\Docker\\CredentialSpecs\\spec.json`.\n\n


\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n", + "example": "spec.json" + }, + "Registry": { + "type": "string", + "description": "Load credential spec from this value in the Windows\nregistry. The specified registry value must be located in:\n\n`HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Virtualization\\Containers\\CredentialSpecs`\n\n


\n\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n" + } + }, + "description": "CredentialSpec for managed service account (Windows only)" + }, + "SELinuxContext": { + "type": "object", + "properties": { + "Disable": { + "type": "boolean", + "description": "Disable SELinux" + }, + "User": { + "type": "string", + "description": "SELinux user label" + }, + "Role": { + "type": "string", + "description": "SELinux role label" + }, + "Type": { + "type": "string", + "description": "SELinux type label" + }, + "Level": { + "type": "string", + "description": "SELinux level label" + } + }, + "description": "SELinux labels of the container" + } + }, + "description": "Security options for the container" + }, + "TTY": { + "type": "boolean", + "description": "Whether a pseudo-TTY should be allocated." + }, + "OpenStdin": { + "type": "boolean", + "description": "Open `stdin`" + }, + "ReadOnly": { + "type": "boolean", + "description": "Mount the container's root filesystem as read only." + }, + "Mounts": { + "type": "array", + "description": "Specification for mounts to be added to containers created as part\nof the service.\n", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "Container path." + }, + "Source": { + "type": "string", + "description": "Mount source (e.g. a volume name, a host path)." + }, + "Type": { + "type": "string", + "description": "The mount type. Available types:\n\n- `bind` Mounts a file or directory from the host into the container. Must exist prior to creating the container.\n- `volume` Creates a volume with the given name and options (or uses a pre-existing volume with the same name and options). These are **not** removed when the container is removed.\n- `tmpfs` Create a tmpfs with the given options. The mount source cannot be specified for tmpfs.\n- `npipe` Mounts a named pipe from the host into the container. Must exist prior to creating the container.\n- `cluster` a Swarm cluster volume\n", + "enum": [ + "bind", + "volume", + "tmpfs", + "npipe", + "cluster" + ] + }, + "ReadOnly": { + "type": "boolean", + "description": "Whether the mount should be read-only." + }, + "Consistency": { + "type": "string", + "description": "The consistency requirement for the mount: `default`, `consistent`, `cached`, or `delegated`." + }, + "BindOptions": { + "type": "object", + "properties": { + "Propagation": { + "type": "string", + "description": "A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`.", + "enum": [ + "private", + "rprivate", + "shared", + "rshared", + "slave", + "rslave" + ] + }, + "NonRecursive": { + "type": "boolean", + "description": "Disable recursive bind mount.", + "default": false + }, + "CreateMountpoint": { + "type": "boolean", + "description": "Create mount point on host if missing", + "default": false + } + }, + "description": "Optional configuration for the `bind` type." + }, + "VolumeOptions": { + "type": "object", + "properties": { + "NoCopy": { + "type": "boolean", + "description": "Populate volume with data from the target.", + "default": false + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "DriverConfig": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver to use to create the volume." + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "key/value map of driver specific options." + } + }, + "description": "Map of driver specific options" + } + }, + "description": "Optional configuration for the `volume` type." + }, + "TmpfsOptions": { + "type": "object", + "properties": { + "SizeBytes": { + "type": "integer", + "description": "The size for the tmpfs mount in bytes.", + "format": "int64" + }, + "Mode": { + "type": "integer", + "description": "The permission mode for the tmpfs mount in an integer." + } + }, + "description": "Optional configuration for the `tmpfs` type." + } + } + } + }, + "StopSignal": { + "type": "string", + "description": "Signal to stop the container." + }, + "StopGracePeriod": { + "type": "integer", + "description": "Amount of time to wait for the container to terminate before\nforcefully killing it.\n", + "format": "int64" + }, + "HealthCheck": { + "type": "object", + "properties": { + "Test": { + "type": "array", + "description": "The test to perform. Possible values are:\n\n- `[]` inherit healthcheck from image or parent image\n- `[\"NONE\"]` disable healthcheck\n- `[\"CMD\", args...]` exec arguments directly\n- `[\"CMD-SHELL\", command]` run command with system's default shell\n", + "items": { + "type": "string" + } + }, + "Interval": { + "type": "integer", + "description": "The time to wait between checks in nanoseconds. It should be 0 or at\nleast 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Timeout": { + "type": "integer", + "description": "The time to wait before considering the check to have hung. It should\nbe 0 or at least 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Retries": { + "type": "integer", + "description": "The number of consecutive failures needed to consider a container as\nunhealthy. 0 means inherit.\n" + }, + "StartPeriod": { + "type": "integer", + "description": "Start period for the container to initialize before starting\nhealth-retries countdown in nanoseconds. It should be 0 or at least\n1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + } + }, + "description": "A test to perform to check that the container is healthy." + }, + "Hosts": { + "type": "array", + "description": "A list of hostname/IP mappings to add to the container's `hosts`\nfile. The format of extra hosts is specified in the\n[hosts(5)](http://man7.org/linux/man-pages/man5/hosts.5.html)\nman page:\n\n IP_address canonical_hostname [aliases...]\n", + "items": { + "type": "string" + } + }, + "DNSConfig": { + "type": "object", + "properties": { + "Nameservers": { + "type": "array", + "description": "The IP addresses of the name servers.", + "items": { + "type": "string" + } + }, + "Search": { + "type": "array", + "description": "A search list for host-name lookup.", + "items": { + "type": "string" + } + }, + "Options": { + "type": "array", + "description": "A list of internal resolver variables to be modified (e.g.,\n`debug`, `ndots:3`, etc.).\n", + "items": { + "type": "string" + } + } + }, + "description": "Specification for DNS related configurations in resolver configuration\nfile (`resolv.conf`).\n" + }, + "Secrets": { + "type": "array", + "description": "Secrets contains references to zero or more secrets that will be\nexposed to the service.\n", + "items": { + "type": "object", + "properties": { + "File": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name represents the final filename in the filesystem.\n" + }, + "UID": { + "type": "string", + "description": "UID represents the file UID." + }, + "GID": { + "type": "string", + "description": "GID represents the file GID." + }, + "Mode": { + "type": "integer", + "description": "Mode represents the FileMode of the file.", + "format": "uint32" + } + }, + "description": "File represents a specific target that is backed by a file.\n" + }, + "SecretID": { + "type": "string", + "description": "SecretID represents the ID of the specific secret that we're\nreferencing.\n" + }, + "SecretName": { + "type": "string", + "description": "SecretName is the name of the secret that this references,\nbut this is just provided for lookup/display purposes. The\nsecret in the reference will be identified by its ID.\n" + } + } + } + }, + "Configs": { + "type": "array", + "description": "Configs contains references to zero or more configs that will be\nexposed to the service.\n", + "items": { + "type": "object", + "properties": { + "File": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name represents the final filename in the filesystem.\n" + }, + "UID": { + "type": "string", + "description": "UID represents the file UID." + }, + "GID": { + "type": "string", + "description": "GID represents the file GID." + }, + "Mode": { + "type": "integer", + "description": "Mode represents the FileMode of the file.", + "format": "uint32" + } + }, + "description": "File represents a specific target that is backed by a file.\n\n


\n\n> **Note**: `Configs.File` and `Configs.Runtime` are mutually exclusive\n" + }, + "Runtime": { + "type": "object", + "properties": {}, + "description": "Runtime represents a target that is not mounted into the\ncontainer but is used by the task\n\n


\n\n> **Note**: `Configs.File` and `Configs.Runtime` are mutually\n> exclusive\n" + }, + "ConfigID": { + "type": "string", + "description": "ConfigID represents the ID of the specific config that we're\nreferencing.\n" + }, + "ConfigName": { + "type": "string", + "description": "ConfigName is the name of the config that this references,\nbut this is just provided for lookup/display purposes. The\nconfig in the reference will be identified by its ID.\n" + } + } + } + }, + "Isolation": { + "type": "string", + "description": "Isolation technology of the containers running the service.\n(Windows only)\n", + "enum": [ + "default", + "process", + "hyperv", + "" + ] + }, + "Init": { + "type": "boolean", + "description": "Run an init inside the container that forwards signals and reaps\nprocesses. This field is omitted if empty, and the default (as\nconfigured on the daemon) is used.\n", + "nullable": true + }, + "Sysctls": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Set kernel namedspaced parameters (sysctls) in the container.\nThe Sysctls option on services accepts the same sysctls as the\nare supported on containers. Note that while the same sysctls are\nsupported, no guarantees or checks are made about their\nsuitability for a clustered environment, and it's up to the user\nto determine whether a given sysctl will work properly in a\nService.\n" + }, + "CapabilityAdd": { + "type": "array", + "description": "A list of kernel capabilities to add to the default set\nfor the container.\n", + "example": [ + "CAP_NET_RAW", + "CAP_SYS_ADMIN", + "CAP_SYS_CHROOT", + "CAP_SYSLOG" + ], + "items": { + "type": "string" + } + }, + "CapabilityDrop": { + "type": "array", + "description": "A list of kernel capabilities to drop from the default set\nfor the container.\n", + "example": [ + "CAP_NET_RAW" + ], + "items": { + "type": "string" + } + }, + "Ulimits": { + "type": "array", + "description": "A list of resource limits to set in the container. For example: `{\"Name\": \"nofile\", \"Soft\": 1024, \"Hard\": 2048}`\"\n", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of ulimit" + }, + "Soft": { + "type": "integer", + "description": "Soft limit" + }, + "Hard": { + "type": "integer", + "description": "Hard limit" + } + } + } + } + }, + "description": "Container spec for the service.\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "NetworkAttachmentSpec": { + "type": "object", + "properties": { + "ContainerID": { + "type": "string", + "description": "ID of the container represented by this task" + } + }, + "description": "Read-only spec type for non-swarm containers attached to swarm overlay\nnetworks.\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "Resources": { + "type": "object", + "properties": { + "Limits": { + "type": "object", + "properties": { + "NanoCPUs": { + "type": "integer", + "format": "int64", + "example": 4000000000 + }, + "MemoryBytes": { + "type": "integer", + "format": "int64", + "example": 8272408576 + }, + "Pids": { + "type": "integer", + "description": "Limits the maximum number of PIDs in the container. Set `0` for unlimited.\n", + "format": "int64", + "example": 100, + "default": 0 + } + }, + "description": "An object describing a limit on resources which can be requested by a task.\n" + }, + "Reservations": { + "type": "object", + "properties": { + "NanoCPUs": { + "type": "integer", + "format": "int64", + "example": 4000000000 + }, + "MemoryBytes": { + "type": "integer", + "format": "int64", + "example": 8272408576 + }, + "GenericResources": { + "type": "array", + "description": "User-defined resources can be either Integer resources (e.g, `SSD=3`) or\nString resources (e.g, `GPU=UUID1`).\n", + "example": [ + { + "DiscreteResourceSpec": { + "Kind": "SSD", + "Value": 3 + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID1" + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID2" + } + } + ], + "items": { + "type": "object", + "properties": { + "NamedResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + }, + "DiscreteResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "integer", + "format": "int64" + } + } + } + } + } + } + }, + "description": "An object describing the resources which can be advertised by a node and\nrequested by a task.\n" + } + }, + "description": "Resource requirements which apply to each individual container created\nas part of the service.\n" + }, + "RestartPolicy": { + "type": "object", + "properties": { + "Condition": { + "type": "string", + "description": "Condition for restart.", + "enum": [ + "none", + "on-failure", + "any" + ] + }, + "Delay": { + "type": "integer", + "description": "Delay between restart attempts.", + "format": "int64" + }, + "MaxAttempts": { + "type": "integer", + "description": "Maximum attempts to restart a given container before giving up\n(default value is 0, which is ignored).\n", + "format": "int64", + "default": 0 + }, + "Window": { + "type": "integer", + "description": "Windows is the time window used to evaluate the restart policy\n(default value is 0, which is unbounded).\n", + "format": "int64", + "default": 0 + } + }, + "description": "Specification for the restart policy which applies to containers\ncreated as part of this service.\n" + }, + "Placement": { + "type": "object", + "properties": { + "Constraints": { + "type": "array", + "description": "An array of constraint expressions to limit the set of nodes where\na task can be scheduled. Constraint expressions can either use a\n_match_ (`==`) or _exclude_ (`!=`) rule. Multiple constraints find\nnodes that satisfy every expression (AND match). Constraints can\nmatch node or Docker Engine labels as follows:\n\nnode attribute | matches | example\n---------------------|--------------------------------|-----------------------------------------------\n`node.id` | Node ID | `node.id==2ivku8v2gvtg4`\n`node.hostname` | Node hostname | `node.hostname!=node-2`\n`node.role` | Node role (`manager`/`worker`) | `node.role==manager`\n`node.platform.os` | Node operating system | `node.platform.os==windows`\n`node.platform.arch` | Node architecture | `node.platform.arch==x86_64`\n`node.labels` | User-defined node labels | `node.labels.security==high`\n`engine.labels` | Docker Engine's labels | `engine.labels.operatingsystem==ubuntu-14.04`\n\n`engine.labels` apply to Docker Engine labels like operating system,\ndrivers, etc. Swarm administrators add `node.labels` for operational\npurposes by using the [`node update endpoint`](#operation/NodeUpdate).\n", + "example": [ + "node.hostname!=node3.corp.example.com", + "node.role!=manager", + "node.labels.type==production", + "node.platform.os==linux", + "node.platform.arch==x86_64" + ], + "items": { + "type": "string" + } + }, + "Preferences": { + "type": "array", + "description": "Preferences provide a way to make the scheduler aware of factors\nsuch as topology. They are provided in order from highest to\nlowest precedence.\n", + "example": [ + { + "Spread": { + "SpreadDescriptor": "node.labels.datacenter" + } + }, + { + "Spread": { + "SpreadDescriptor": "node.labels.rack" + } + } + ], + "items": { + "type": "object", + "properties": { + "Spread": { + "type": "object", + "properties": { + "SpreadDescriptor": { + "type": "string", + "description": "label descriptor, such as `engine.labels.az`.\n" + } + } + } + } + } + }, + "MaxReplicas": { + "type": "integer", + "description": "Maximum number of replicas for per node (default value is 0, which\nis unlimited)\n", + "format": "int64", + "default": 0 + }, + "Platforms": { + "type": "array", + "description": "Platforms stores all the platforms that the service's image can\nrun on. This field is used in the platform filter for scheduling.\nIf empty, then the platform filter is off, meaning there are no\nscheduling restrictions.\n", + "items": { + "type": "object", + "properties": { + "Architecture": { + "type": "string", + "description": "Architecture represents the hardware architecture (for example,\n`x86_64`).\n", + "example": "x86_64" + }, + "OS": { + "type": "string", + "description": "OS represents the Operating System (for example, `linux` or `windows`).\n", + "example": "linux" + } + }, + "description": "Platform represents the platform (Arch/OS).\n" + } + } + } + }, + "ForceUpdate": { + "type": "integer", + "description": "A counter that triggers an update even if no relevant parameters have\nbeen changed.\n" + }, + "Runtime": { + "type": "string", + "description": "Runtime is the type of runtime specified for the task executor.\n" + }, + "Networks": { + "type": "array", + "description": "Specifies which networks the service should attach to.", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "The target network for attachment. Must be a network name or ID.\n" + }, + "Aliases": { + "type": "array", + "description": "Discoverable alternate names for the service on this network.\n", + "items": { + "type": "string" + } + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver attachment options for the network target.\n" + } + }, + "description": "Specifies how a service should be attached to a particular network.\n" + } + }, + "LogDriver": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "description": "Specifies the log driver to use for tasks created from this spec. If\nnot present, the default one for the swarm will be used, finally\nfalling back to the engine default if not specified.\n" + } + }, + "description": "User modifiable task configuration." + }, + "ServiceID": { + "type": "string", + "description": "The ID of the service this task is part of." + }, + "Slot": { + "type": "integer" + }, + "NodeID": { + "type": "string", + "description": "The ID of the node that this task is on." + }, + "AssignedGenericResources": { + "type": "array", + "description": "User-defined resources can be either Integer resources (e.g, `SSD=3`) or\nString resources (e.g, `GPU=UUID1`).\n", + "example": [ + { + "DiscreteResourceSpec": { + "Kind": "SSD", + "Value": 3 + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID1" + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID2" + } + } + ], + "items": { + "type": "object", + "properties": { + "NamedResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + }, + "DiscreteResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "integer", + "format": "int64" + } + } + } + } + } + }, + "Status": { + "type": "object", + "properties": { + "Timestamp": { + "type": "string", + "format": "dateTime" + }, + "State": { + "type": "string", + "enum": [ + "new", + "allocated", + "pending", + "assigned", + "accepted", + "preparing", + "ready", + "starting", + "running", + "complete", + "shutdown", + "failed", + "rejected", + "remove", + "orphaned" + ] + }, + "Message": { + "type": "string" + }, + "Err": { + "type": "string" + }, + "ContainerStatus": { + "type": "object", + "properties": { + "ContainerID": { + "type": "string" + }, + "PID": { + "type": "integer" + }, + "ExitCode": { + "type": "integer" + } + } + } + } + }, + "DesiredState": { + "type": "string", + "enum": [ + "new", + "allocated", + "pending", + "assigned", + "accepted", + "preparing", + "ready", + "starting", + "running", + "complete", + "shutdown", + "failed", + "rejected", + "remove", + "orphaned" + ] + }, + "JobIteration": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + } + }, + "example": { + "ID": "0kzzo1i0y4jz6027t0k7aezc7", + "Version": { + "Index": 71 + }, + "CreatedAt": "2016-06-07T21:07:31.171892745Z", + "UpdatedAt": "2016-06-07T21:07:31.376370513Z", + "Spec": { + "ContainerSpec": { + "Image": "redis" + }, + "Resources": { + "Limits": {}, + "Reservations": {} + }, + "RestartPolicy": { + "Condition": "any", + "MaxAttempts": 0 + }, + "Placement": {} + }, + "ServiceID": "9mnpnzenvg8p8tdbtq4wvbkcz", + "Slot": 1, + "NodeID": "60gvrl6tm78dmak4yl7srz94v", + "Status": { + "Timestamp": "2016-06-07T21:07:31.290032978Z", + "State": "running", + "Message": "started", + "ContainerStatus": { + "ContainerID": "e5d62702a1b48d01c3e02ca1e0212a250801fa8d67caca0b6f35919ebc12f035", + "PID": 677 + } + }, + "DesiredState": "running", + "NetworksAttachments": [ + { + "Network": { + "ID": "4qvuz4ko70xaltuqbt8956gd1", + "Version": { + "Index": 18 + }, + "CreatedAt": "2016-06-07T20:31:11.912919752Z", + "UpdatedAt": "2016-06-07T21:07:29.955277358Z", + "Spec": { + "Name": "ingress", + "Labels": { + "com.docker.swarm.internal": "true" + }, + "DriverConfiguration": {}, + "IPAMOptions": { + "Driver": {}, + "Configs": [ + { + "Subnet": "10.255.0.0/16", + "Gateway": "10.255.0.1" + } + ] + } + }, + "DriverState": { + "Name": "overlay", + "Options": { + "com.docker.network.driver.overlay.vxlanid_list": "256" + } + }, + "IPAMOptions": { + "Driver": { + "Name": "default" + }, + "Configs": [ + { + "Subnet": "10.255.0.0/16", + "Gateway": "10.255.0.1" + } + ] + } + }, + "Addresses": [ + "10.255.0.10/16" + ] + } + ], + "AssignedGenericResources": [ + { + "DiscreteResourceSpec": { + "Kind": "SSD", + "Value": 3 + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID1" + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID2" + } + } + ] + } + } + } + } + }, + "404": { + "description": "no such task", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "503": { + "description": "node is not part of a swarm", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/tasks/{id}/logs": { + "get": { + "tags": [ + "Task" + ], + "summary": "Get task logs", + "description": "Get `stdout` and `stderr` logs from a task.\nSee also [`/containers/{id}/logs`](#operation/ContainerLogs).\n\n**Note**: This endpoint works only for services with the `local`,\n`json-file` or `journald` logging drivers.\n", + "operationId": "TaskLogs", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID of the task", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "details", + "in": "query", + "description": "Show task context and extra details provided to logs.", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "follow", + "in": "query", + "description": "Keep connection after returning logs.", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "stdout", + "in": "query", + "description": "Return logs from `stdout`", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "stderr", + "in": "query", + "description": "Return logs from `stderr`", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "since", + "in": "query", + "description": "Only return logs since this time, as a UNIX timestamp", + "schema": { + "type": "integer", + "default": 0 + } + }, + { + "name": "timestamps", + "in": "query", + "description": "Add timestamps to every log line", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "tail", + "in": "query", + "description": "Only return this number of log lines from the end of the logs.\nSpecify as an integer or `all` to output all log lines.\n", + "schema": { + "type": "string", + "default": "all" + } + } + ], + "responses": { + "200": { + "description": "logs returned as a stream in response body", + "content": { + "application/vnd.docker.raw-stream": { + "schema": { + "type": "string", + "format": "binary" + } + }, + "application/vnd.docker.multiplexed-stream": { + "schema": { + "type": "string", + "format": "binary" + } + } + } + }, + "404": { + "description": "no such task", + "content": { + "application/vnd.docker.raw-stream": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "application/vnd.docker.multiplexed-stream": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "application/json": { + "example": { + "message": "No such task: c2ada9df5af8" + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/vnd.docker.raw-stream": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "application/vnd.docker.multiplexed-stream": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "503": { + "description": "node is not part of a swarm", + "content": { + "application/vnd.docker.raw-stream": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "application/vnd.docker.multiplexed-stream": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/secrets": { + "get": { + "tags": [ + "Secret" + ], + "summary": "List secrets", + "operationId": "SecretList", + "parameters": [ + { + "name": "filters", + "in": "query", + "description": "A JSON encoded value of the filters (a `map[string][]string`) to\nprocess on the secrets list.\n\nAvailable filters:\n\n- `id=`\n- `label= or label==value`\n- `name=`\n- `names=`\n", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "no error", + "content": { + "application/json": { + "schema": { + "type": "array", + "example": [ + { + "ID": "blt1owaxmitz71s9v5zh81zun", + "Version": { + "Index": 85 + }, + "CreatedAt": "2017-07-20T13:55:28.678958722Z", + "UpdatedAt": "2017-07-20T13:55:28.678958722Z", + "Spec": { + "Name": "mysql-passwd", + "Labels": { + "some.label": "some.value" + }, + "Driver": { + "Name": "secret-bucket", + "Options": { + "OptionA": "value for driver option A", + "OptionB": "value for driver option B" + } + } + } + }, + { + "ID": "ktnbjxoalbkvbvedmg1urrz8h", + "Version": { + "Index": 11 + }, + "CreatedAt": "2016-11-05T01:20:17.327670065Z", + "UpdatedAt": "2016-11-05T01:20:17.327670065Z", + "Spec": { + "Name": "app-dev.crt", + "Labels": { + "foo": "bar" + } + } + } + ], + "items": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "example": "blt1owaxmitz71s9v5zh81zun" + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "format": "dateTime", + "example": "2017-07-20T13:55:28.678958722Z" + }, + "UpdatedAt": { + "type": "string", + "format": "dateTime", + "example": "2017-07-20T13:55:28.678958722Z" + }, + "Spec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "User-defined name of the secret." + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "Data": { + "type": "string", + "description": "Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5))\ndata to store as secret.\n\nThis field is only used to _create_ a secret, and is not returned by\nother endpoints.\n", + "example": "" + }, + "Driver": { + "required": [ + "Name" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver.", + "nullable": false, + "example": "some-driver" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Key/value map of driver-specific options.", + "nullable": false, + "example": { + "OptionA": "value for driver-specific option A", + "OptionB": "value for driver-specific option B" + } + } + }, + "description": "Driver represents a driver (network, logging, secrets)." + }, + "Templating": { + "required": [ + "Name" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver.", + "nullable": false, + "example": "some-driver" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Key/value map of driver-specific options.", + "nullable": false, + "example": { + "OptionA": "value for driver-specific option A", + "OptionB": "value for driver-specific option B" + } + } + }, + "description": "Driver represents a driver (network, logging, secrets)." + } + } + } + } + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "503": { + "description": "node is not part of a swarm", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/secrets/create": { + "post": { + "tags": [ + "Secret" + ], + "summary": "Create a secret", + "operationId": "SecretCreate", + "requestBody": { + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "User-defined name of the secret." + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "Data": { + "type": "string", + "description": "Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5))\ndata to store as secret.\n\nThis field is only used to _create_ a secret, and is not returned by\nother endpoints.\n", + "example": "" + }, + "Driver": { + "required": [ + "Name" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver.", + "nullable": false, + "example": "some-driver" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Key/value map of driver-specific options.", + "nullable": false, + "example": { + "OptionA": "value for driver-specific option A", + "OptionB": "value for driver-specific option B" + } + } + }, + "description": "Driver represents a driver (network, logging, secrets)." + }, + "Templating": { + "required": [ + "Name" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver.", + "nullable": false, + "example": "some-driver" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Key/value map of driver-specific options.", + "nullable": false, + "example": { + "OptionA": "value for driver-specific option A", + "OptionB": "value for driver-specific option B" + } + } + }, + "description": "Driver represents a driver (network, logging, secrets)." + } + } + }, + { + "type": "object", + "example": { + "Name": "app-key.crt", + "Labels": { + "foo": "bar" + }, + "Data": "VEhJUyBJUyBOT1QgQSBSRUFMIENFUlRJRklDQVRFCg==", + "Driver": { + "Name": "secret-bucket", + "Options": { + "OptionA": "value for driver option A", + "OptionB": "value for driver option B" + } + } + } + } + ] + } + } + }, + "required": false + }, + "responses": { + "201": { + "description": "no error", + "content": { + "application/json": { + "schema": { + "required": [ + "Id" + ], + "type": "object", + "properties": { + "Id": { + "type": "string", + "description": "The id of the newly created object.", + "nullable": false + } + }, + "description": "Response to an API call that returns just an Id" + } + } + } + }, + "409": { + "description": "name conflicts with an existing object", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "503": { + "description": "node is not part of a swarm", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + }, + "x-codegen-request-body-name": "body" + } + }, + "/secrets/{id}": { + "get": { + "tags": [ + "Secret" + ], + "summary": "Inspect a secret", + "operationId": "SecretInspect", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID of the secret", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "no error", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "example": "blt1owaxmitz71s9v5zh81zun" + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "format": "dateTime", + "example": "2017-07-20T13:55:28.678958722Z" + }, + "UpdatedAt": { + "type": "string", + "format": "dateTime", + "example": "2017-07-20T13:55:28.678958722Z" + }, + "Spec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "User-defined name of the secret." + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "Data": { + "type": "string", + "description": "Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5))\ndata to store as secret.\n\nThis field is only used to _create_ a secret, and is not returned by\nother endpoints.\n", + "example": "" + }, + "Driver": { + "required": [ + "Name" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver.", + "nullable": false, + "example": "some-driver" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Key/value map of driver-specific options.", + "nullable": false, + "example": { + "OptionA": "value for driver-specific option A", + "OptionB": "value for driver-specific option B" + } + } + }, + "description": "Driver represents a driver (network, logging, secrets)." + }, + "Templating": { + "required": [ + "Name" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver.", + "nullable": false, + "example": "some-driver" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Key/value map of driver-specific options.", + "nullable": false, + "example": { + "OptionA": "value for driver-specific option A", + "OptionB": "value for driver-specific option B" + } + } + }, + "description": "Driver represents a driver (network, logging, secrets)." + } + } + } + } + }, + "example": { + "ID": "ktnbjxoalbkvbvedmg1urrz8h", + "Version": { + "Index": 11 + }, + "CreatedAt": "2016-11-05T01:20:17.327670065Z", + "UpdatedAt": "2016-11-05T01:20:17.327670065Z", + "Spec": { + "Name": "app-dev.crt", + "Labels": { + "foo": "bar" + }, + "Driver": { + "Name": "secret-bucket", + "Options": { + "OptionA": "value for driver option A", + "OptionB": "value for driver option B" + } + } + } + } + } + } + }, + "404": { + "description": "secret not found", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "503": { + "description": "node is not part of a swarm", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + }, + "delete": { + "tags": [ + "Secret" + ], + "summary": "Delete a secret", + "operationId": "SecretDelete", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID of the secret", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "no error", + "content": {} + }, + "404": { + "description": "secret not found", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "503": { + "description": "node is not part of a swarm", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/secrets/{id}/update": { + "post": { + "tags": [ + "Secret" + ], + "summary": "Update a Secret", + "operationId": "SecretUpdate", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The ID or name of the secret", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "version", + "in": "query", + "description": "The version number of the secret object being updated. This is\nrequired to avoid conflicting writes.\n", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The spec of the secret to update. Currently, only the Labels field\ncan be updated. All other fields must remain unchanged from the\n[SecretInspect endpoint](#operation/SecretInspect) response values.\n", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "User-defined name of the secret." + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "Data": { + "type": "string", + "description": "Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5))\ndata to store as secret.\n\nThis field is only used to _create_ a secret, and is not returned by\nother endpoints.\n", + "example": "" + }, + "Driver": { + "required": [ + "Name" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver.", + "nullable": false, + "example": "some-driver" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Key/value map of driver-specific options.", + "nullable": false, + "example": { + "OptionA": "value for driver-specific option A", + "OptionB": "value for driver-specific option B" + } + } + }, + "description": "Driver represents a driver (network, logging, secrets)." + }, + "Templating": { + "required": [ + "Name" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver.", + "nullable": false, + "example": "some-driver" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Key/value map of driver-specific options.", + "nullable": false, + "example": { + "OptionA": "value for driver-specific option A", + "OptionB": "value for driver-specific option B" + } + } + }, + "description": "Driver represents a driver (network, logging, secrets)." + } + } + } + }, + "text/plain": { + "schema": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "User-defined name of the secret." + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "Data": { + "type": "string", + "description": "Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5))\ndata to store as secret.\n\nThis field is only used to _create_ a secret, and is not returned by\nother endpoints.\n", + "example": "" + }, + "Driver": { + "required": [ + "Name" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver.", + "nullable": false, + "example": "some-driver" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Key/value map of driver-specific options.", + "nullable": false, + "example": { + "OptionA": "value for driver-specific option A", + "OptionB": "value for driver-specific option B" + } + } + }, + "description": "Driver represents a driver (network, logging, secrets)." + }, + "Templating": { + "required": [ + "Name" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver.", + "nullable": false, + "example": "some-driver" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Key/value map of driver-specific options.", + "nullable": false, + "example": { + "OptionA": "value for driver-specific option A", + "OptionB": "value for driver-specific option B" + } + } + }, + "description": "Driver represents a driver (network, logging, secrets)." + } + } + } + } + }, + "required": false + }, + "responses": { + "200": { + "description": "no error", + "content": {} + }, + "400": { + "description": "bad parameter", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "404": { + "description": "no such secret", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "503": { + "description": "node is not part of a swarm", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + }, + "x-codegen-request-body-name": "body" + } + }, + "/configs": { + "get": { + "tags": [ + "Config" + ], + "summary": "List configs", + "operationId": "ConfigList", + "parameters": [ + { + "name": "filters", + "in": "query", + "description": "A JSON encoded value of the filters (a `map[string][]string`) to\nprocess on the configs list.\n\nAvailable filters:\n\n- `id=`\n- `label= or label==value`\n- `name=`\n- `names=`\n", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "no error", + "content": { + "application/json": { + "schema": { + "type": "array", + "example": [ + { + "ID": "ktnbjxoalbkvbvedmg1urrz8h", + "Version": { + "Index": 11 + }, + "CreatedAt": "2016-11-05T01:20:17.327670065Z", + "UpdatedAt": "2016-11-05T01:20:17.327670065Z", + "Spec": { + "Name": "server.conf" + } + } + ], + "items": { + "type": "object", + "properties": { + "ID": { + "type": "string" + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "format": "dateTime" + }, + "UpdatedAt": { + "type": "string", + "format": "dateTime" + }, + "Spec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "User-defined name of the config." + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "Data": { + "type": "string", + "description": "Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5))\nconfig data.\n" + }, + "Templating": { + "required": [ + "Name" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver.", + "nullable": false, + "example": "some-driver" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Key/value map of driver-specific options.", + "nullable": false, + "example": { + "OptionA": "value for driver-specific option A", + "OptionB": "value for driver-specific option B" + } + } + }, + "description": "Driver represents a driver (network, logging, secrets)." + } + } + } + } + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "503": { + "description": "node is not part of a swarm", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/configs/create": { + "post": { + "tags": [ + "Config" + ], + "summary": "Create a config", + "operationId": "ConfigCreate", + "requestBody": { + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "User-defined name of the config." + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "Data": { + "type": "string", + "description": "Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5))\nconfig data.\n" + }, + "Templating": { + "required": [ + "Name" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver.", + "nullable": false, + "example": "some-driver" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Key/value map of driver-specific options.", + "nullable": false, + "example": { + "OptionA": "value for driver-specific option A", + "OptionB": "value for driver-specific option B" + } + } + }, + "description": "Driver represents a driver (network, logging, secrets)." + } + } + }, + { + "type": "object", + "example": { + "Name": "server.conf", + "Labels": { + "foo": "bar" + }, + "Data": "VEhJUyBJUyBOT1QgQSBSRUFMIENFUlRJRklDQVRFCg==" + } + } + ] + } + } + }, + "required": false + }, + "responses": { + "201": { + "description": "no error", + "content": { + "application/json": { + "schema": { + "required": [ + "Id" + ], + "type": "object", + "properties": { + "Id": { + "type": "string", + "description": "The id of the newly created object.", + "nullable": false + } + }, + "description": "Response to an API call that returns just an Id" + } + } + } + }, + "409": { + "description": "name conflicts with an existing object", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "503": { + "description": "node is not part of a swarm", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + }, + "x-codegen-request-body-name": "body" + } + }, + "/configs/{id}": { + "get": { + "tags": [ + "Config" + ], + "summary": "Inspect a config", + "operationId": "ConfigInspect", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID of the config", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "no error", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "ID": { + "type": "string" + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "format": "dateTime" + }, + "UpdatedAt": { + "type": "string", + "format": "dateTime" + }, + "Spec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "User-defined name of the config." + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "Data": { + "type": "string", + "description": "Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5))\nconfig data.\n" + }, + "Templating": { + "required": [ + "Name" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver.", + "nullable": false, + "example": "some-driver" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Key/value map of driver-specific options.", + "nullable": false, + "example": { + "OptionA": "value for driver-specific option A", + "OptionB": "value for driver-specific option B" + } + } + }, + "description": "Driver represents a driver (network, logging, secrets)." + } + } + } + } + }, + "example": { + "ID": "ktnbjxoalbkvbvedmg1urrz8h", + "Version": { + "Index": 11 + }, + "CreatedAt": "2016-11-05T01:20:17.327670065Z", + "UpdatedAt": "2016-11-05T01:20:17.327670065Z", + "Spec": { + "Name": "app-dev.crt" + } + } + } + } + }, + "404": { + "description": "config not found", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "503": { + "description": "node is not part of a swarm", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + }, + "delete": { + "tags": [ + "Config" + ], + "summary": "Delete a config", + "operationId": "ConfigDelete", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID of the config", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "no error", + "content": {} + }, + "404": { + "description": "config not found", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "503": { + "description": "node is not part of a swarm", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/configs/{id}/update": { + "post": { + "tags": [ + "Config" + ], + "summary": "Update a Config", + "operationId": "ConfigUpdate", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The ID or name of the config", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "version", + "in": "query", + "description": "The version number of the config object being updated. This is\nrequired to avoid conflicting writes.\n", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The spec of the config to update. Currently, only the Labels field\ncan be updated. All other fields must remain unchanged from the\n[ConfigInspect endpoint](#operation/ConfigInspect) response values.\n", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "User-defined name of the config." + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "Data": { + "type": "string", + "description": "Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5))\nconfig data.\n" + }, + "Templating": { + "required": [ + "Name" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver.", + "nullable": false, + "example": "some-driver" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Key/value map of driver-specific options.", + "nullable": false, + "example": { + "OptionA": "value for driver-specific option A", + "OptionB": "value for driver-specific option B" + } + } + }, + "description": "Driver represents a driver (network, logging, secrets)." + } + } + } + }, + "text/plain": { + "schema": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "User-defined name of the config." + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "Data": { + "type": "string", + "description": "Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5))\nconfig data.\n" + }, + "Templating": { + "required": [ + "Name" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver.", + "nullable": false, + "example": "some-driver" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Key/value map of driver-specific options.", + "nullable": false, + "example": { + "OptionA": "value for driver-specific option A", + "OptionB": "value for driver-specific option B" + } + } + }, + "description": "Driver represents a driver (network, logging, secrets)." + } + } + } + } + }, + "required": false + }, + "responses": { + "200": { + "description": "no error", + "content": {} + }, + "400": { + "description": "bad parameter", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "404": { + "description": "no such config", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "503": { + "description": "node is not part of a swarm", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + }, + "text/plain": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + }, + "x-codegen-request-body-name": "body" + } + }, + "/distribution/{name}/json": { + "get": { + "tags": [ + "Distribution" + ], + "summary": "Get image information from the registry", + "description": "Return image digest and platform information by contacting the registry.\n", + "operationId": "DistributionInspect", + "parameters": [ + { + "name": "name", + "in": "path", + "description": "Image name or id", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "descriptor and platform information", + "content": { + "application/json": { + "schema": { + "title": "DistributionInspectResponse", + "required": [ + "Descriptor", + "Platforms" + ], + "type": "object", + "properties": { + "Descriptor": { + "type": "object", + "properties": { + "mediaType": { + "type": "string", + "description": "The media type of the object this schema refers to.\n", + "example": "application/vnd.docker.distribution.manifest.v2+json" + }, + "digest": { + "type": "string", + "description": "The digest of the targeted content.\n", + "example": "sha256:c0537ff6a5218ef531ece93d4984efc99bbf3f7497c0a7726c88e2bb7584dc96" + }, + "size": { + "type": "integer", + "description": "The size in bytes of the blob.\n", + "format": "int64", + "example": 3987495 + } + }, + "description": "A descriptor struct containing digest, media type, and size, as defined in\nthe [OCI Content Descriptors Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md).\n", + "x-go-name": "Descriptor" + }, + "Platforms": { + "type": "array", + "description": "An array containing all platforms supported by the image.\n", + "items": { + "type": "object", + "properties": { + "architecture": { + "type": "string", + "description": "The CPU architecture, for example `amd64` or `ppc64`.\n", + "example": "arm" + }, + "os": { + "type": "string", + "description": "The operating system, for example `linux` or `windows`.\n", + "example": "windows" + }, + "os.version": { + "type": "string", + "description": "Optional field specifying the operating system version, for example on\nWindows `10.0.19041.1165`.\n", + "example": "10.0.19041.1165" + }, + "os.features": { + "type": "array", + "description": "Optional field specifying an array of strings, each listing a required\nOS feature (for example on Windows `win32k`).\n", + "example": [ + "win32k" + ], + "items": { + "type": "string" + } + }, + "variant": { + "type": "string", + "description": "Optional field specifying a variant of the CPU, for example `v7` to\nspecify ARMv7 when architecture is `arm`.\n", + "example": "v7" + } + }, + "description": "Describes the platform which the image in the manifest runs on, as defined\nin the [OCI Image Index Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md).\n", + "x-go-name": "Platform" + } + } + }, + "description": "Describes the result obtained from contacting the registry to retrieve\nimage metadata.\n", + "x-go-name": "DistributionInspect" + } + } + } + }, + "401": { + "description": "Failed authentication or no image found", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + }, + "example": { + "message": "No such image: someimage (tag: latest)" + } + } + } + }, + "500": { + "description": "Server error", + "content": { + "application/json": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + }, + "/session": { + "post": { + "tags": [ + "Session" + ], + "summary": "Initialize interactive session", + "description": "Start a new interactive session with a server. Session allows server to\ncall back to the client for advanced capabilities.\n\n### Hijacking\n\nThis endpoint hijacks the HTTP connection to HTTP2 transport that allows\nthe client to expose gPRC services on that connection.\n\nFor example, the client sends this request to upgrade the connection:\n\n```\nPOST /session HTTP/1.1\nUpgrade: h2c\nConnection: Upgrade\n```\n\nThe Docker daemon responds with a `101 UPGRADED` response follow with\nthe raw stream:\n\n```\nHTTP/1.1 101 UPGRADED\nConnection: Upgrade\nUpgrade: h2c\n```\n", + "operationId": "Session", + "responses": { + "101": { + "description": "no error, hijacking successful", + "content": {} + }, + "400": { + "description": "bad parameter", + "content": { + "application/vnd.docker.raw-stream": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + }, + "500": { + "description": "server error", + "content": { + "application/vnd.docker.raw-stream": { + "schema": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "Port": { + "required": [ + "PrivatePort", + "Type" + ], + "type": "object", + "properties": { + "IP": { + "type": "string", + "description": "Host IP address that the container's port is mapped to", + "format": "ip-address" + }, + "PrivatePort": { + "type": "integer", + "description": "Port on the container", + "format": "uint16", + "nullable": false + }, + "PublicPort": { + "type": "integer", + "description": "Port exposed on the host", + "format": "uint16" + }, + "Type": { + "type": "string", + "nullable": false, + "enum": [ + "tcp", + "udp", + "sctp" + ] + } + }, + "description": "An open port on a container", + "example": { + "PrivatePort": 8080, + "PublicPort": 80, + "Type": "tcp" + } + }, + "MountPoint": { + "type": "object", + "properties": { + "Type": { + "type": "string", + "description": "The mount type:\n\n- `bind` a mount of a file or directory from the host into the container.\n- `volume` a docker volume with the given `Name`.\n- `tmpfs` a `tmpfs`.\n- `npipe` a named pipe from the host into the container.\n- `cluster` a Swarm cluster volume\n", + "example": "volume", + "enum": [ + "bind", + "volume", + "tmpfs", + "npipe", + "cluster" + ] + }, + "Name": { + "type": "string", + "description": "Name is the name reference to the underlying data defined by `Source`\ne.g., the volume name.\n", + "example": "myvolume" + }, + "Source": { + "type": "string", + "description": "Source location of the mount.\n\nFor volumes, this contains the storage location of the volume (within\n`/var/lib/docker/volumes/`). For bind-mounts, and `npipe`, this contains\nthe source (host) part of the bind-mount. For `tmpfs` mount points, this\nfield is empty.\n", + "example": "/var/lib/docker/volumes/myvolume/_data" + }, + "Destination": { + "type": "string", + "description": "Destination is the path relative to the container root (`/`) where\nthe `Source` is mounted inside the container.\n", + "example": "/usr/share/nginx/html/" + }, + "Driver": { + "type": "string", + "description": "Driver is the volume driver used to create the volume (if it is a volume).\n", + "example": "local" + }, + "Mode": { + "type": "string", + "description": "Mode is a comma separated list of options supplied by the user when\ncreating the bind/volume mount.\n\nThe default is platform-specific (`\"z\"` on Linux, empty on Windows).\n", + "example": "z" + }, + "RW": { + "type": "boolean", + "description": "Whether the mount is mounted writable (read-write).\n", + "example": true + }, + "Propagation": { + "type": "string", + "description": "Propagation describes how mounts are propagated from the host into the\nmount point, and vice-versa. Refer to the [Linux kernel documentation](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt)\nfor details. This field is not used on Windows.\n", + "example": "" + } + }, + "description": "MountPoint represents a mount point configuration inside the container.\nThis is used for reporting the mountpoints in use by a container.\n" + }, + "DeviceMapping": { + "type": "object", + "properties": { + "PathOnHost": { + "type": "string" + }, + "PathInContainer": { + "type": "string" + }, + "CgroupPermissions": { + "type": "string" + } + }, + "description": "A device mapping between the host and container", + "example": { + "PathOnHost": "/dev/deviceName", + "PathInContainer": "/dev/deviceName", + "CgroupPermissions": "mrw" + } + }, + "DeviceRequest": { + "type": "object", + "properties": { + "Driver": { + "type": "string", + "example": "nvidia" + }, + "Count": { + "type": "integer", + "example": -1 + }, + "DeviceIDs": { + "type": "array", + "example": [ + "0", + "1", + "GPU-fef8089b-4820-abfc-e83e-94318197576e" + ], + "items": { + "type": "string" + } + }, + "Capabilities": { + "type": "array", + "description": "A list of capabilities; an OR list of AND lists of capabilities.\n", + "example": [ + [ + "gpu", + "nvidia", + "compute" + ] + ], + "items": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver-specific options, specified as a key/value pairs. These options\nare passed directly to the driver.\n" + } + }, + "description": "A request for devices to be sent to device drivers" + }, + "ThrottleDevice": { + "type": "object", + "properties": { + "Path": { + "type": "string", + "description": "Device path" + }, + "Rate": { + "minimum": 0, + "type": "integer", + "description": "Rate", + "format": "int64" + } + } + }, + "Mount": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "Container path." + }, + "Source": { + "type": "string", + "description": "Mount source (e.g. a volume name, a host path)." + }, + "Type": { + "type": "string", + "description": "The mount type. Available types:\n\n- `bind` Mounts a file or directory from the host into the container. Must exist prior to creating the container.\n- `volume` Creates a volume with the given name and options (or uses a pre-existing volume with the same name and options). These are **not** removed when the container is removed.\n- `tmpfs` Create a tmpfs with the given options. The mount source cannot be specified for tmpfs.\n- `npipe` Mounts a named pipe from the host into the container. Must exist prior to creating the container.\n- `cluster` a Swarm cluster volume\n", + "enum": [ + "bind", + "volume", + "tmpfs", + "npipe", + "cluster" + ] + }, + "ReadOnly": { + "type": "boolean", + "description": "Whether the mount should be read-only." + }, + "Consistency": { + "type": "string", + "description": "The consistency requirement for the mount: `default`, `consistent`, `cached`, or `delegated`." + }, + "BindOptions": { + "type": "object", + "properties": { + "Propagation": { + "type": "string", + "description": "A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`.", + "enum": [ + "private", + "rprivate", + "shared", + "rshared", + "slave", + "rslave" + ] + }, + "NonRecursive": { + "type": "boolean", + "description": "Disable recursive bind mount.", + "default": false + }, + "CreateMountpoint": { + "type": "boolean", + "description": "Create mount point on host if missing", + "default": false + } + }, + "description": "Optional configuration for the `bind` type." + }, + "VolumeOptions": { + "type": "object", + "properties": { + "NoCopy": { + "type": "boolean", + "description": "Populate volume with data from the target.", + "default": false + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "DriverConfig": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver to use to create the volume." + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "key/value map of driver specific options." + } + }, + "description": "Map of driver specific options" + } + }, + "description": "Optional configuration for the `volume` type." + }, + "TmpfsOptions": { + "type": "object", + "properties": { + "SizeBytes": { + "type": "integer", + "description": "The size for the tmpfs mount in bytes.", + "format": "int64" + }, + "Mode": { + "type": "integer", + "description": "The permission mode for the tmpfs mount in an integer." + } + }, + "description": "Optional configuration for the `tmpfs` type." + } + } + }, + "RestartPolicy": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "- Empty string means not to restart\n- `no` Do not automatically restart\n- `always` Always restart\n- `unless-stopped` Restart always except when the user has manually stopped the container\n- `on-failure` Restart only when the container exit code is non-zero\n", + "enum": [ + "", + "no", + "always", + "unless-stopped", + "on-failure" + ] + }, + "MaximumRetryCount": { + "type": "integer", + "description": "If `on-failure` is used, the number of times to retry before giving up.\n" + } + }, + "description": "The behavior to apply when the container exits. The default is not to\nrestart.\n\nAn ever increasing delay (double the previous delay, starting at 100ms) is\nadded before each restart to prevent flooding the server.\n" + }, + "Resources": { + "type": "object", + "properties": { + "CpuShares": { + "type": "integer", + "description": "An integer value representing this container's relative CPU weight\nversus other containers.\n" + }, + "Memory": { + "type": "integer", + "description": "Memory limit in bytes.", + "format": "int64", + "default": 0 + }, + "CgroupParent": { + "type": "string", + "description": "Path to `cgroups` under which the container's `cgroup` is created. If\nthe path is not absolute, the path is considered to be relative to the\n`cgroups` path of the init process. Cgroups are created if they do not\nalready exist.\n" + }, + "BlkioWeight": { + "maximum": 1000, + "minimum": 0, + "type": "integer", + "description": "Block IO weight (relative weight)." + }, + "BlkioWeightDevice": { + "type": "array", + "description": "Block IO weight (relative device weight) in the form:\n\n```\n[{\"Path\": \"device_path\", \"Weight\": weight}]\n```\n", + "items": { + "type": "object", + "properties": { + "Path": { + "type": "string" + }, + "Weight": { + "minimum": 0, + "type": "integer" + } + } + } + }, + "BlkioDeviceReadBps": { + "type": "array", + "description": "Limit read rate (bytes per second) from a device, in the form:\n\n```\n[{\"Path\": \"device_path\", \"Rate\": rate}]\n```\n", + "items": { + "type": "object", + "properties": { + "Path": { + "type": "string", + "description": "Device path" + }, + "Rate": { + "minimum": 0, + "type": "integer", + "description": "Rate", + "format": "int64" + } + } + } + }, + "BlkioDeviceWriteBps": { + "type": "array", + "description": "Limit write rate (bytes per second) to a device, in the form:\n\n```\n[{\"Path\": \"device_path\", \"Rate\": rate}]\n```\n", + "items": { + "type": "object", + "properties": { + "Path": { + "type": "string", + "description": "Device path" + }, + "Rate": { + "minimum": 0, + "type": "integer", + "description": "Rate", + "format": "int64" + } + } + } + }, + "BlkioDeviceReadIOps": { + "type": "array", + "description": "Limit read rate (IO per second) from a device, in the form:\n\n```\n[{\"Path\": \"device_path\", \"Rate\": rate}]\n```\n", + "items": { + "type": "object", + "properties": { + "Path": { + "type": "string", + "description": "Device path" + }, + "Rate": { + "minimum": 0, + "type": "integer", + "description": "Rate", + "format": "int64" + } + } + } + }, + "BlkioDeviceWriteIOps": { + "type": "array", + "description": "Limit write rate (IO per second) to a device, in the form:\n\n```\n[{\"Path\": \"device_path\", \"Rate\": rate}]\n```\n", + "items": { + "type": "object", + "properties": { + "Path": { + "type": "string", + "description": "Device path" + }, + "Rate": { + "minimum": 0, + "type": "integer", + "description": "Rate", + "format": "int64" + } + } + } + }, + "CpuPeriod": { + "type": "integer", + "description": "The length of a CPU period in microseconds.", + "format": "int64" + }, + "CpuQuota": { + "type": "integer", + "description": "Microseconds of CPU time that the container can get in a CPU period.\n", + "format": "int64" + }, + "CpuRealtimePeriod": { + "type": "integer", + "description": "The length of a CPU real-time period in microseconds. Set to 0 to\nallocate no time allocated to real-time tasks.\n", + "format": "int64" + }, + "CpuRealtimeRuntime": { + "type": "integer", + "description": "The length of a CPU real-time runtime in microseconds. Set to 0 to\nallocate no time allocated to real-time tasks.\n", + "format": "int64" + }, + "CpusetCpus": { + "type": "string", + "description": "CPUs in which to allow execution (e.g., `0-3`, `0,1`).\n", + "example": "0-3" + }, + "CpusetMems": { + "type": "string", + "description": "Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only\neffective on NUMA systems.\n" + }, + "Devices": { + "type": "array", + "description": "A list of devices to add to the container.", + "items": { + "type": "object", + "properties": { + "PathOnHost": { + "type": "string" + }, + "PathInContainer": { + "type": "string" + }, + "CgroupPermissions": { + "type": "string" + } + }, + "description": "A device mapping between the host and container", + "example": { + "PathOnHost": "/dev/deviceName", + "PathInContainer": "/dev/deviceName", + "CgroupPermissions": "mrw" + } + } + }, + "DeviceCgroupRules": { + "type": "array", + "description": "a list of cgroup rules to apply to the container", + "items": { + "type": "string", + "example": "c 13:* rwm" + } + }, + "DeviceRequests": { + "type": "array", + "description": "A list of requests for devices to be sent to device drivers.\n", + "items": { + "type": "object", + "properties": { + "Driver": { + "type": "string", + "example": "nvidia" + }, + "Count": { + "type": "integer", + "example": -1 + }, + "DeviceIDs": { + "type": "array", + "example": [ + "0", + "1", + "GPU-fef8089b-4820-abfc-e83e-94318197576e" + ], + "items": { + "type": "string" + } + }, + "Capabilities": { + "type": "array", + "description": "A list of capabilities; an OR list of AND lists of capabilities.\n", + "example": [ + [ + "gpu", + "nvidia", + "compute" + ] + ], + "items": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver-specific options, specified as a key/value pairs. These options\nare passed directly to the driver.\n" + } + }, + "description": "A request for devices to be sent to device drivers" + } + }, + "KernelMemoryTCP": { + "type": "integer", + "description": "Hard limit for kernel TCP buffer memory (in bytes). Depending on the\nOCI runtime in use, this option may be ignored. It is no longer supported\nby the default (runc) runtime.\n\nThis field is omitted when empty.\n", + "format": "int64" + }, + "MemoryReservation": { + "type": "integer", + "description": "Memory soft limit in bytes.", + "format": "int64" + }, + "MemorySwap": { + "type": "integer", + "description": "Total memory limit (memory + swap). Set as `-1` to enable unlimited\nswap.\n", + "format": "int64" + }, + "MemorySwappiness": { + "maximum": 100, + "minimum": 0, + "type": "integer", + "description": "Tune a container's memory swappiness behavior. Accepts an integer\nbetween 0 and 100.\n", + "format": "int64" + }, + "NanoCpus": { + "type": "integer", + "description": "CPU quota in units of 10-9 CPUs.", + "format": "int64" + }, + "OomKillDisable": { + "type": "boolean", + "description": "Disable OOM Killer for the container." + }, + "Init": { + "type": "boolean", + "description": "Run an init inside the container that forwards signals and reaps\nprocesses. This field is omitted if empty, and the default (as\nconfigured on the daemon) is used.\n", + "nullable": true + }, + "PidsLimit": { + "type": "integer", + "description": "Tune a container's PIDs limit. Set `0` or `-1` for unlimited, or `null`\nto not change.\n", + "format": "int64", + "nullable": true + }, + "Ulimits": { + "type": "array", + "description": "A list of resource limits to set in the container. For example:\n\n```\n{\"Name\": \"nofile\", \"Soft\": 1024, \"Hard\": 2048}\n```\n", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of ulimit" + }, + "Soft": { + "type": "integer", + "description": "Soft limit" + }, + "Hard": { + "type": "integer", + "description": "Hard limit" + } + } + } + }, + "CpuCount": { + "type": "integer", + "description": "The number of usable CPUs (Windows only).\n\nOn Windows Server containers, the processor resource controls are\nmutually exclusive. The order of precedence is `CPUCount` first, then\n`CPUShares`, and `CPUPercent` last.\n", + "format": "int64" + }, + "CpuPercent": { + "type": "integer", + "description": "The usable percentage of the available CPUs (Windows only).\n\nOn Windows Server containers, the processor resource controls are\nmutually exclusive. The order of precedence is `CPUCount` first, then\n`CPUShares`, and `CPUPercent` last.\n", + "format": "int64" + }, + "IOMaximumIOps": { + "type": "integer", + "description": "Maximum IOps for the container system drive (Windows only)", + "format": "int64" + }, + "IOMaximumBandwidth": { + "type": "integer", + "description": "Maximum IO in bytes per second for the container system drive\n(Windows only).\n", + "format": "int64" + } + }, + "description": "A container's resources (cgroups config, ulimits, etc)" + }, + "Limit": { + "type": "object", + "properties": { + "NanoCPUs": { + "type": "integer", + "format": "int64", + "example": 4000000000 + }, + "MemoryBytes": { + "type": "integer", + "format": "int64", + "example": 8272408576 + }, + "Pids": { + "type": "integer", + "description": "Limits the maximum number of PIDs in the container. Set `0` for unlimited.\n", + "format": "int64", + "example": 100, + "default": 0 + } + }, + "description": "An object describing a limit on resources which can be requested by a task.\n" + }, + "ResourceObject": { + "type": "object", + "properties": { + "NanoCPUs": { + "type": "integer", + "format": "int64", + "example": 4000000000 + }, + "MemoryBytes": { + "type": "integer", + "format": "int64", + "example": 8272408576 + }, + "GenericResources": { + "type": "array", + "description": "User-defined resources can be either Integer resources (e.g, `SSD=3`) or\nString resources (e.g, `GPU=UUID1`).\n", + "example": [ + { + "DiscreteResourceSpec": { + "Kind": "SSD", + "Value": 3 + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID1" + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID2" + } + } + ], + "items": { + "type": "object", + "properties": { + "NamedResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + }, + "DiscreteResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "integer", + "format": "int64" + } + } + } + } + } + } + }, + "description": "An object describing the resources which can be advertised by a node and\nrequested by a task.\n" + }, + "GenericResources": { + "type": "array", + "description": "User-defined resources can be either Integer resources (e.g, `SSD=3`) or\nString resources (e.g, `GPU=UUID1`).\n", + "example": [ + { + "DiscreteResourceSpec": { + "Kind": "SSD", + "Value": 3 + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID1" + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID2" + } + } + ], + "items": { + "type": "object", + "properties": { + "NamedResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + }, + "DiscreteResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "integer", + "format": "int64" + } + } + } + } + } + }, + "HealthConfig": { + "type": "object", + "properties": { + "Test": { + "type": "array", + "description": "The test to perform. Possible values are:\n\n- `[]` inherit healthcheck from image or parent image\n- `[\"NONE\"]` disable healthcheck\n- `[\"CMD\", args...]` exec arguments directly\n- `[\"CMD-SHELL\", command]` run command with system's default shell\n", + "items": { + "type": "string" + } + }, + "Interval": { + "type": "integer", + "description": "The time to wait between checks in nanoseconds. It should be 0 or at\nleast 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Timeout": { + "type": "integer", + "description": "The time to wait before considering the check to have hung. It should\nbe 0 or at least 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Retries": { + "type": "integer", + "description": "The number of consecutive failures needed to consider a container as\nunhealthy. 0 means inherit.\n" + }, + "StartPeriod": { + "type": "integer", + "description": "Start period for the container to initialize before starting\nhealth-retries countdown in nanoseconds. It should be 0 or at least\n1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + } + }, + "description": "A test to perform to check that the container is healthy." + }, + "Health": { + "type": "object", + "properties": { + "Status": { + "type": "string", + "description": "Status is one of `none`, `starting`, `healthy` or `unhealthy`\n\n- \"none\" Indicates there is no healthcheck\n- \"starting\" Starting indicates that the container is not yet ready\n- \"healthy\" Healthy indicates that the container is running correctly\n- \"unhealthy\" Unhealthy indicates that the container has a problem\n", + "example": "healthy", + "enum": [ + "none", + "starting", + "healthy", + "unhealthy" + ] + }, + "FailingStreak": { + "type": "integer", + "description": "FailingStreak is the number of consecutive failures", + "example": 0 + }, + "Log": { + "type": "array", + "description": "Log contains the last few results (oldest first)\n", + "items": { + "type": "object", + "properties": { + "Start": { + "type": "string", + "description": "Date and time at which this check started in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "date-time", + "example": "2020-01-04T10:44:24.496525531Z" + }, + "End": { + "type": "string", + "description": "Date and time at which this check ended in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2020-01-04T10:45:21.364524523Z" + }, + "ExitCode": { + "type": "integer", + "description": "ExitCode meanings:\n\n- `0` healthy\n- `1` unhealthy\n- `2` reserved (considered unhealthy)\n- other values: error running probe\n", + "example": 0 + }, + "Output": { + "type": "string", + "description": "Output from last check" + } + }, + "description": "HealthcheckResult stores information about a single run of a healthcheck probe\n", + "nullable": true, + "x-nullable": true + } + } + }, + "description": "Health stores information about the container's healthcheck results.\n", + "nullable": true, + "x-nullable": true + }, + "HealthcheckResult": { + "type": "object", + "properties": { + "Start": { + "type": "string", + "description": "Date and time at which this check started in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "date-time", + "example": "2020-01-04T10:44:24.496525531Z" + }, + "End": { + "type": "string", + "description": "Date and time at which this check ended in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2020-01-04T10:45:21.364524523Z" + }, + "ExitCode": { + "type": "integer", + "description": "ExitCode meanings:\n\n- `0` healthy\n- `1` unhealthy\n- `2` reserved (considered unhealthy)\n- other values: error running probe\n", + "example": 0 + }, + "Output": { + "type": "string", + "description": "Output from last check" + } + }, + "description": "HealthcheckResult stores information about a single run of a healthcheck probe\n", + "nullable": true, + "x-nullable": true + }, + "HostConfig": { + "description": "Container configuration that depends on the host we are running on", + "allOf": [ + { + "type": "object", + "properties": { + "CpuShares": { + "type": "integer", + "description": "An integer value representing this container's relative CPU weight\nversus other containers.\n" + }, + "Memory": { + "type": "integer", + "description": "Memory limit in bytes.", + "format": "int64", + "default": 0 + }, + "CgroupParent": { + "type": "string", + "description": "Path to `cgroups` under which the container's `cgroup` is created. If\nthe path is not absolute, the path is considered to be relative to the\n`cgroups` path of the init process. Cgroups are created if they do not\nalready exist.\n" + }, + "BlkioWeight": { + "maximum": 1000, + "minimum": 0, + "type": "integer", + "description": "Block IO weight (relative weight)." + }, + "BlkioWeightDevice": { + "type": "array", + "description": "Block IO weight (relative device weight) in the form:\n\n```\n[{\"Path\": \"device_path\", \"Weight\": weight}]\n```\n", + "items": { + "type": "object", + "properties": { + "Path": { + "type": "string" + }, + "Weight": { + "minimum": 0, + "type": "integer" + } + } + } + }, + "BlkioDeviceReadBps": { + "type": "array", + "description": "Limit read rate (bytes per second) from a device, in the form:\n\n```\n[{\"Path\": \"device_path\", \"Rate\": rate}]\n```\n", + "items": { + "type": "object", + "properties": { + "Path": { + "type": "string", + "description": "Device path" + }, + "Rate": { + "minimum": 0, + "type": "integer", + "description": "Rate", + "format": "int64" + } + } + } + }, + "BlkioDeviceWriteBps": { + "type": "array", + "description": "Limit write rate (bytes per second) to a device, in the form:\n\n```\n[{\"Path\": \"device_path\", \"Rate\": rate}]\n```\n", + "items": { + "type": "object", + "properties": { + "Path": { + "type": "string", + "description": "Device path" + }, + "Rate": { + "minimum": 0, + "type": "integer", + "description": "Rate", + "format": "int64" + } + } + } + }, + "BlkioDeviceReadIOps": { + "type": "array", + "description": "Limit read rate (IO per second) from a device, in the form:\n\n```\n[{\"Path\": \"device_path\", \"Rate\": rate}]\n```\n", + "items": { + "type": "object", + "properties": { + "Path": { + "type": "string", + "description": "Device path" + }, + "Rate": { + "minimum": 0, + "type": "integer", + "description": "Rate", + "format": "int64" + } + } + } + }, + "BlkioDeviceWriteIOps": { + "type": "array", + "description": "Limit write rate (IO per second) to a device, in the form:\n\n```\n[{\"Path\": \"device_path\", \"Rate\": rate}]\n```\n", + "items": { + "type": "object", + "properties": { + "Path": { + "type": "string", + "description": "Device path" + }, + "Rate": { + "minimum": 0, + "type": "integer", + "description": "Rate", + "format": "int64" + } + } + } + }, + "CpuPeriod": { + "type": "integer", + "description": "The length of a CPU period in microseconds.", + "format": "int64" + }, + "CpuQuota": { + "type": "integer", + "description": "Microseconds of CPU time that the container can get in a CPU period.\n", + "format": "int64" + }, + "CpuRealtimePeriod": { + "type": "integer", + "description": "The length of a CPU real-time period in microseconds. Set to 0 to\nallocate no time allocated to real-time tasks.\n", + "format": "int64" + }, + "CpuRealtimeRuntime": { + "type": "integer", + "description": "The length of a CPU real-time runtime in microseconds. Set to 0 to\nallocate no time allocated to real-time tasks.\n", + "format": "int64" + }, + "CpusetCpus": { + "type": "string", + "description": "CPUs in which to allow execution (e.g., `0-3`, `0,1`).\n", + "example": "0-3" + }, + "CpusetMems": { + "type": "string", + "description": "Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only\neffective on NUMA systems.\n" + }, + "Devices": { + "type": "array", + "description": "A list of devices to add to the container.", + "items": { + "type": "object", + "properties": { + "PathOnHost": { + "type": "string" + }, + "PathInContainer": { + "type": "string" + }, + "CgroupPermissions": { + "type": "string" + } + }, + "description": "A device mapping between the host and container", + "example": { + "PathOnHost": "/dev/deviceName", + "PathInContainer": "/dev/deviceName", + "CgroupPermissions": "mrw" + } + } + }, + "DeviceCgroupRules": { + "type": "array", + "description": "a list of cgroup rules to apply to the container", + "items": { + "type": "string", + "example": "c 13:* rwm" + } + }, + "DeviceRequests": { + "type": "array", + "description": "A list of requests for devices to be sent to device drivers.\n", + "items": { + "type": "object", + "properties": { + "Driver": { + "type": "string", + "example": "nvidia" + }, + "Count": { + "type": "integer", + "example": -1 + }, + "DeviceIDs": { + "type": "array", + "example": [ + "0", + "1", + "GPU-fef8089b-4820-abfc-e83e-94318197576e" + ], + "items": { + "type": "string" + } + }, + "Capabilities": { + "type": "array", + "description": "A list of capabilities; an OR list of AND lists of capabilities.\n", + "example": [ + [ + "gpu", + "nvidia", + "compute" + ] + ], + "items": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver-specific options, specified as a key/value pairs. These options\nare passed directly to the driver.\n" + } + }, + "description": "A request for devices to be sent to device drivers" + } + }, + "KernelMemoryTCP": { + "type": "integer", + "description": "Hard limit for kernel TCP buffer memory (in bytes). Depending on the\nOCI runtime in use, this option may be ignored. It is no longer supported\nby the default (runc) runtime.\n\nThis field is omitted when empty.\n", + "format": "int64" + }, + "MemoryReservation": { + "type": "integer", + "description": "Memory soft limit in bytes.", + "format": "int64" + }, + "MemorySwap": { + "type": "integer", + "description": "Total memory limit (memory + swap). Set as `-1` to enable unlimited\nswap.\n", + "format": "int64" + }, + "MemorySwappiness": { + "maximum": 100, + "minimum": 0, + "type": "integer", + "description": "Tune a container's memory swappiness behavior. Accepts an integer\nbetween 0 and 100.\n", + "format": "int64" + }, + "NanoCpus": { + "type": "integer", + "description": "CPU quota in units of 10-9 CPUs.", + "format": "int64" + }, + "OomKillDisable": { + "type": "boolean", + "description": "Disable OOM Killer for the container." + }, + "Init": { + "type": "boolean", + "description": "Run an init inside the container that forwards signals and reaps\nprocesses. This field is omitted if empty, and the default (as\nconfigured on the daemon) is used.\n", + "nullable": true + }, + "PidsLimit": { + "type": "integer", + "description": "Tune a container's PIDs limit. Set `0` or `-1` for unlimited, or `null`\nto not change.\n", + "format": "int64", + "nullable": true + }, + "Ulimits": { + "type": "array", + "description": "A list of resource limits to set in the container. For example:\n\n```\n{\"Name\": \"nofile\", \"Soft\": 1024, \"Hard\": 2048}\n```\n", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of ulimit" + }, + "Soft": { + "type": "integer", + "description": "Soft limit" + }, + "Hard": { + "type": "integer", + "description": "Hard limit" + } + } + } + }, + "CpuCount": { + "type": "integer", + "description": "The number of usable CPUs (Windows only).\n\nOn Windows Server containers, the processor resource controls are\nmutually exclusive. The order of precedence is `CPUCount` first, then\n`CPUShares`, and `CPUPercent` last.\n", + "format": "int64" + }, + "CpuPercent": { + "type": "integer", + "description": "The usable percentage of the available CPUs (Windows only).\n\nOn Windows Server containers, the processor resource controls are\nmutually exclusive. The order of precedence is `CPUCount` first, then\n`CPUShares`, and `CPUPercent` last.\n", + "format": "int64" + }, + "IOMaximumIOps": { + "type": "integer", + "description": "Maximum IOps for the container system drive (Windows only)", + "format": "int64" + }, + "IOMaximumBandwidth": { + "type": "integer", + "description": "Maximum IO in bytes per second for the container system drive\n(Windows only).\n", + "format": "int64" + } + }, + "description": "A container's resources (cgroups config, ulimits, etc)" + }, + { + "type": "object", + "properties": { + "Binds": { + "type": "array", + "description": "A list of volume bindings for this container. Each volume binding\nis a string in one of these forms:\n\n- `host-src:container-dest[:options]` to bind-mount a host path\n into the container. Both `host-src`, and `container-dest` must\n be an _absolute_ path.\n- `volume-name:container-dest[:options]` to bind-mount a volume\n managed by a volume driver into the container. `container-dest`\n must be an _absolute_ path.\n\n`options` is an optional, comma-delimited list of:\n\n- `nocopy` disables automatic copying of data from the container\n path to the volume. The `nocopy` flag only applies to named volumes.\n- `[ro|rw]` mounts a volume read-only or read-write, respectively.\n If omitted or set to `rw`, volumes are mounted read-write.\n- `[z|Z]` applies SELinux labels to allow or deny multiple containers\n to read and write to the same volume.\n - `z`: a _shared_ content label is applied to the content. This\n label indicates that multiple containers can share the volume\n content, for both reading and writing.\n - `Z`: a _private unshared_ label is applied to the content.\n This label indicates that only the current container can use\n a private volume. Labeling systems such as SELinux require\n proper labels to be placed on volume content that is mounted\n into a container. Without a label, the security system can\n prevent a container's processes from using the content. By\n default, the labels set by the host operating system are not\n modified.\n- `[[r]shared|[r]slave|[r]private]` specifies mount\n [propagation behavior](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt).\n This only applies to bind-mounted volumes, not internal volumes\n or named volumes. Mount propagation requires the source mount\n point (the location where the source directory is mounted in the\n host operating system) to have the correct propagation properties.\n For shared volumes, the source mount point must be set to `shared`.\n For slave volumes, the mount must be set to either `shared` or\n `slave`.\n", + "items": { + "type": "string" + } + }, + "ContainerIDFile": { + "type": "string", + "description": "Path to a file where the container ID is written" + }, + "LogConfig": { + "type": "object", + "properties": { + "Type": { + "type": "string", + "enum": [ + "json-file", + "syslog", + "journald", + "gelf", + "fluentd", + "awslogs", + "splunk", + "etwlogs", + "none" + ] + }, + "Config": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "description": "The logging configuration for this container" + }, + "NetworkMode": { + "type": "string", + "description": "Network mode to use for this container. Supported standard values\nare: `bridge`, `host`, `none`, and `container:`. Any\nother value is taken as a custom network's name to which this\ncontainer should connect to.\n" + }, + "PortBindings": { + "type": "object", + "additionalProperties": { + "type": "array", + "nullable": true, + "items": { + "type": "object", + "properties": { + "HostIp": { + "type": "string", + "description": "Host IP address that the container's port is mapped to.", + "example": "127.0.0.1" + }, + "HostPort": { + "type": "string", + "description": "Host port number that the container's port is mapped to.", + "example": "4443" + } + }, + "description": "PortBinding represents a binding between a host IP address and a host\nport.\n" + } + }, + "description": "PortMap describes the mapping of container ports to host ports, using the\ncontainer's port-number and protocol as key in the format `/`,\nfor example, `80/udp`.\n\nIf a container's port is mapped for multiple protocols, separate entries\nare added to the mapping table.\n", + "example": { + "443/tcp": [ + { + "HostIp": "127.0.0.1", + "HostPort": "4443" + } + ], + "80/tcp": [ + { + "HostIp": "0.0.0.0", + "HostPort": "80" + }, + { + "HostIp": "0.0.0.0", + "HostPort": "8080" + } + ], + "80/udp": [ + { + "HostIp": "0.0.0.0", + "HostPort": "80" + } + ], + "53/udp": [ + { + "HostIp": "0.0.0.0", + "HostPort": "53" + } + ] + } + }, + "RestartPolicy": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "- Empty string means not to restart\n- `no` Do not automatically restart\n- `always` Always restart\n- `unless-stopped` Restart always except when the user has manually stopped the container\n- `on-failure` Restart only when the container exit code is non-zero\n", + "enum": [ + "", + "no", + "always", + "unless-stopped", + "on-failure" + ] + }, + "MaximumRetryCount": { + "type": "integer", + "description": "If `on-failure` is used, the number of times to retry before giving up.\n" + } + }, + "description": "The behavior to apply when the container exits. The default is not to\nrestart.\n\nAn ever increasing delay (double the previous delay, starting at 100ms) is\nadded before each restart to prevent flooding the server.\n" + }, + "AutoRemove": { + "type": "boolean", + "description": "Automatically remove the container when the container's process\nexits. This has no effect if `RestartPolicy` is set.\n" + }, + "VolumeDriver": { + "type": "string", + "description": "Driver that this container uses to mount volumes." + }, + "VolumesFrom": { + "type": "array", + "description": "A list of volumes to inherit from another container, specified in\nthe form `[:]`.\n", + "items": { + "type": "string" + } + }, + "Mounts": { + "type": "array", + "description": "Specification for mounts to be added to the container.\n", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "Container path." + }, + "Source": { + "type": "string", + "description": "Mount source (e.g. a volume name, a host path)." + }, + "Type": { + "type": "string", + "description": "The mount type. Available types:\n\n- `bind` Mounts a file or directory from the host into the container. Must exist prior to creating the container.\n- `volume` Creates a volume with the given name and options (or uses a pre-existing volume with the same name and options). These are **not** removed when the container is removed.\n- `tmpfs` Create a tmpfs with the given options. The mount source cannot be specified for tmpfs.\n- `npipe` Mounts a named pipe from the host into the container. Must exist prior to creating the container.\n- `cluster` a Swarm cluster volume\n", + "enum": [ + "bind", + "volume", + "tmpfs", + "npipe", + "cluster" + ] + }, + "ReadOnly": { + "type": "boolean", + "description": "Whether the mount should be read-only." + }, + "Consistency": { + "type": "string", + "description": "The consistency requirement for the mount: `default`, `consistent`, `cached`, or `delegated`." + }, + "BindOptions": { + "type": "object", + "properties": { + "Propagation": { + "type": "string", + "description": "A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`.", + "enum": [ + "private", + "rprivate", + "shared", + "rshared", + "slave", + "rslave" + ] + }, + "NonRecursive": { + "type": "boolean", + "description": "Disable recursive bind mount.", + "default": false + }, + "CreateMountpoint": { + "type": "boolean", + "description": "Create mount point on host if missing", + "default": false + } + }, + "description": "Optional configuration for the `bind` type." + }, + "VolumeOptions": { + "type": "object", + "properties": { + "NoCopy": { + "type": "boolean", + "description": "Populate volume with data from the target.", + "default": false + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "DriverConfig": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver to use to create the volume." + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "key/value map of driver specific options." + } + }, + "description": "Map of driver specific options" + } + }, + "description": "Optional configuration for the `volume` type." + }, + "TmpfsOptions": { + "type": "object", + "properties": { + "SizeBytes": { + "type": "integer", + "description": "The size for the tmpfs mount in bytes.", + "format": "int64" + }, + "Mode": { + "type": "integer", + "description": "The permission mode for the tmpfs mount in an integer." + } + }, + "description": "Optional configuration for the `tmpfs` type." + } + } + } + }, + "ConsoleSize": { + "maxItems": 2, + "minItems": 2, + "type": "array", + "description": "Initial console size, as an `[height, width]` array.\n", + "nullable": true, + "items": { + "minimum": 0, + "type": "integer" + } + }, + "Annotations": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Arbitrary non-identifying metadata attached to container and\nprovided to the runtime when the container is started.\n" + }, + "CapAdd": { + "type": "array", + "description": "A list of kernel capabilities to add to the container. Conflicts\nwith option 'Capabilities'.\n", + "items": { + "type": "string" + } + }, + "CapDrop": { + "type": "array", + "description": "A list of kernel capabilities to drop from the container. Conflicts\nwith option 'Capabilities'.\n", + "items": { + "type": "string" + } + }, + "CgroupnsMode": { + "type": "string", + "description": "cgroup namespace mode for the container. Possible values are:\n\n- `\"private\"`: the container runs in its own private cgroup namespace\n- `\"host\"`: use the host system's cgroup namespace\n\nIf not specified, the daemon default is used, which can either be `\"private\"`\nor `\"host\"`, depending on daemon version, kernel support and configuration.\n", + "enum": [ + "private", + "host" + ] + }, + "Dns": { + "type": "array", + "description": "A list of DNS servers for the container to use.", + "items": { + "type": "string" + } + }, + "DnsOptions": { + "type": "array", + "description": "A list of DNS options.", + "items": { + "type": "string" + } + }, + "DnsSearch": { + "type": "array", + "description": "A list of DNS search domains.", + "items": { + "type": "string" + } + }, + "ExtraHosts": { + "type": "array", + "description": "A list of hostnames/IP mappings to add to the container's `/etc/hosts`\nfile. Specified in the form `[\"hostname:IP\"]`.\n", + "items": { + "type": "string" + } + }, + "GroupAdd": { + "type": "array", + "description": "A list of additional groups that the container process will run as.\n", + "items": { + "type": "string" + } + }, + "IpcMode": { + "type": "string", + "description": "IPC sharing mode for the container. Possible values are:\n\n- `\"none\"`: own private IPC namespace, with /dev/shm not mounted\n- `\"private\"`: own private IPC namespace\n- `\"shareable\"`: own private IPC namespace, with a possibility to share it with other containers\n- `\"container:\"`: join another (shareable) container's IPC namespace\n- `\"host\"`: use the host system's IPC namespace\n\nIf not specified, daemon default is used, which can either be `\"private\"`\nor `\"shareable\"`, depending on daemon version and configuration.\n" + }, + "Cgroup": { + "type": "string", + "description": "Cgroup to use for the container." + }, + "Links": { + "type": "array", + "description": "A list of links for the container in the form `container_name:alias`.\n", + "items": { + "type": "string" + } + }, + "OomScoreAdj": { + "type": "integer", + "description": "An integer value containing the score given to the container in\norder to tune OOM killer preferences.\n", + "example": 500 + }, + "PidMode": { + "type": "string", + "description": "Set the PID (Process) Namespace mode for the container. It can be\neither:\n\n- `\"container:\"`: joins another container's PID namespace\n- `\"host\"`: use the host's PID namespace inside the container\n" + }, + "Privileged": { + "type": "boolean", + "description": "Gives the container full access to the host." + }, + "PublishAllPorts": { + "type": "boolean", + "description": "Allocates an ephemeral host port for all of a container's\nexposed ports.\n\nPorts are de-allocated when the container stops and allocated when\nthe container starts. The allocated port might be changed when\nrestarting the container.\n\nThe port is selected from the ephemeral port range that depends on\nthe kernel. For example, on Linux the range is defined by\n`/proc/sys/net/ipv4/ip_local_port_range`.\n" + }, + "ReadonlyRootfs": { + "type": "boolean", + "description": "Mount the container's root filesystem as read only." + }, + "SecurityOpt": { + "type": "array", + "description": "A list of string values to customize labels for MLS systems, such\nas SELinux.\n", + "items": { + "type": "string" + } + }, + "StorageOpt": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Storage driver options for this container, in the form `{\"size\": \"120G\"}`.\n" + }, + "Tmpfs": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of container directories which should be replaced by tmpfs\nmounts, and their corresponding mount options. For example:\n\n```\n{ \"/run\": \"rw,noexec,nosuid,size=65536k\" }\n```\n" + }, + "UTSMode": { + "type": "string", + "description": "UTS namespace to use for the container." + }, + "UsernsMode": { + "type": "string", + "description": "Sets the usernamespace mode for the container when usernamespace\nremapping option is enabled.\n" + }, + "ShmSize": { + "minimum": 0, + "type": "integer", + "description": "Size of `/dev/shm` in bytes. If omitted, the system uses 64MB.\n", + "format": "int64" + }, + "Sysctls": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A list of kernel parameters (sysctls) to set in the container.\nFor example:\n\n```\n{\"net.ipv4.ip_forward\": \"1\"}\n```\n" + }, + "Runtime": { + "type": "string", + "description": "Runtime to use with this container." + }, + "Isolation": { + "type": "string", + "description": "Isolation technology of the container. (Windows only)\n", + "enum": [ + "default", + "process", + "hyperv", + "" + ] + }, + "MaskedPaths": { + "type": "array", + "description": "The list of paths to be masked inside the container (this overrides\nthe default set of paths).\n", + "items": { + "type": "string" + } + }, + "ReadonlyPaths": { + "type": "array", + "description": "The list of paths to be set as read-only inside the container\n(this overrides the default set of paths).\n", + "items": { + "type": "string" + } + } + } + } + ] + }, + "ContainerConfig": { + "type": "object", + "properties": { + "Hostname": { + "type": "string", + "description": "The hostname to use for the container, as a valid RFC 1123 hostname.\n", + "example": "439f4e91bd1d" + }, + "Domainname": { + "type": "string", + "description": "The domain name to use for the container.\n" + }, + "User": { + "type": "string", + "description": "The user that commands are run as inside the container." + }, + "AttachStdin": { + "type": "boolean", + "description": "Whether to attach to `stdin`.", + "default": false + }, + "AttachStdout": { + "type": "boolean", + "description": "Whether to attach to `stdout`.", + "default": true + }, + "AttachStderr": { + "type": "boolean", + "description": "Whether to attach to `stderr`.", + "default": true + }, + "ExposedPorts": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": {} + }, + "description": "An object mapping ports to an empty object in the form:\n\n`{\"/\": {}}`\n", + "nullable": true, + "example": { + "80/tcp": {}, + "443/tcp": {} + } + }, + "Tty": { + "type": "boolean", + "description": "Attach standard streams to a TTY, including `stdin` if it is not closed.\n", + "default": false + }, + "OpenStdin": { + "type": "boolean", + "description": "Open `stdin`", + "default": false + }, + "StdinOnce": { + "type": "boolean", + "description": "Close `stdin` after one attached client disconnects", + "default": false + }, + "Env": { + "type": "array", + "description": "A list of environment variables to set inside the container in the\nform `[\"VAR=value\", ...]`. A variable without `=` is removed from the\nenvironment, rather than to have an empty value.\n", + "example": [ + "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + ], + "items": { + "type": "string" + } + }, + "Cmd": { + "type": "array", + "description": "Command to run specified as a string or an array of strings.\n", + "example": [ + "/bin/sh" + ], + "items": { + "type": "string" + } + }, + "Healthcheck": { + "type": "object", + "properties": { + "Test": { + "type": "array", + "description": "The test to perform. Possible values are:\n\n- `[]` inherit healthcheck from image or parent image\n- `[\"NONE\"]` disable healthcheck\n- `[\"CMD\", args...]` exec arguments directly\n- `[\"CMD-SHELL\", command]` run command with system's default shell\n", + "items": { + "type": "string" + } + }, + "Interval": { + "type": "integer", + "description": "The time to wait between checks in nanoseconds. It should be 0 or at\nleast 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Timeout": { + "type": "integer", + "description": "The time to wait before considering the check to have hung. It should\nbe 0 or at least 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Retries": { + "type": "integer", + "description": "The number of consecutive failures needed to consider a container as\nunhealthy. 0 means inherit.\n" + }, + "StartPeriod": { + "type": "integer", + "description": "Start period for the container to initialize before starting\nhealth-retries countdown in nanoseconds. It should be 0 or at least\n1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + } + }, + "description": "A test to perform to check that the container is healthy." + }, + "ArgsEscaped": { + "type": "boolean", + "description": "Command is already escaped (Windows only)", + "nullable": true, + "example": false, + "default": false + }, + "Image": { + "type": "string", + "description": "The name (or reference) of the image to use when creating the container,\nor which was used when the container was created.\n", + "example": "example-image:1.0" + }, + "Volumes": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": {} + }, + "description": "An object mapping mount point paths inside the container to empty\nobjects.\n" + }, + "WorkingDir": { + "type": "string", + "description": "The working directory for commands to run in.", + "example": "/public/" + }, + "Entrypoint": { + "type": "array", + "description": "The entry point for the container as a string or an array of strings.\n\nIf the array consists of exactly one empty string (`[\"\"]`) then the\nentry point is reset to system default (i.e., the entry point used by\ndocker when there is no `ENTRYPOINT` instruction in the `Dockerfile`).\n", + "example": [], + "items": { + "type": "string" + } + }, + "NetworkDisabled": { + "type": "boolean", + "description": "Disable networking for the container.", + "nullable": true + }, + "MacAddress": { + "type": "string", + "description": "MAC address of the container.", + "nullable": true + }, + "OnBuild": { + "type": "array", + "description": "`ONBUILD` metadata that were defined in the image's `Dockerfile`.\n", + "nullable": true, + "example": [], + "items": { + "type": "string" + } + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "StopSignal": { + "type": "string", + "description": "Signal to stop a container as a string or unsigned integer.\n", + "nullable": true, + "example": "SIGTERM" + }, + "StopTimeout": { + "type": "integer", + "description": "Timeout to stop a container in seconds.", + "nullable": true + }, + "Shell": { + "type": "array", + "description": "Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell.\n", + "nullable": true, + "example": [ + "/bin/sh", + "-c" + ], + "items": { + "type": "string" + } + } + }, + "description": "Configuration for a container that is portable between hosts.\n\nWhen used as `ContainerConfig` field in an image, `ContainerConfig` is an\noptional field containing the configuration of the container that was last\ncommitted when creating the image.\n\nPrevious versions of Docker builder used this field to store build cache,\nand it is not in active use anymore.\n" + }, + "ImageConfig": { + "type": "object", + "properties": { + "Hostname": { + "type": "string", + "description": "The hostname to use for the container, as a valid RFC 1123 hostname.\n\n


\n\n> **Note**: this field is always empty and must not be used.\n", + "example": "" + }, + "Domainname": { + "type": "string", + "description": "The domain name to use for the container.\n\n


\n\n> **Note**: this field is always empty and must not be used.\n", + "example": "" + }, + "User": { + "type": "string", + "description": "The user that commands are run as inside the container.", + "example": "web:web" + }, + "AttachStdin": { + "type": "boolean", + "description": "Whether to attach to `stdin`.\n\n


\n\n> **Note**: this field is always false and must not be used.\n", + "example": false, + "default": false + }, + "AttachStdout": { + "type": "boolean", + "description": "Whether to attach to `stdout`.\n\n


\n\n> **Note**: this field is always false and must not be used.\n", + "example": false, + "default": false + }, + "AttachStderr": { + "type": "boolean", + "description": "Whether to attach to `stderr`.\n\n


\n\n> **Note**: this field is always false and must not be used.\n", + "example": false, + "default": false + }, + "ExposedPorts": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": {} + }, + "description": "An object mapping ports to an empty object in the form:\n\n`{\"/\": {}}`\n", + "nullable": true, + "example": { + "80/tcp": {}, + "443/tcp": {} + } + }, + "Tty": { + "type": "boolean", + "description": "Attach standard streams to a TTY, including `stdin` if it is not closed.\n\n


\n\n> **Note**: this field is always false and must not be used.\n", + "example": false, + "default": false + }, + "OpenStdin": { + "type": "boolean", + "description": "Open `stdin`\n\n


\n\n> **Note**: this field is always false and must not be used.\n", + "example": false, + "default": false + }, + "StdinOnce": { + "type": "boolean", + "description": "Close `stdin` after one attached client disconnects.\n\n


\n\n> **Note**: this field is always false and must not be used.\n", + "example": false, + "default": false + }, + "Env": { + "type": "array", + "description": "A list of environment variables to set inside the container in the\nform `[\"VAR=value\", ...]`. A variable without `=` is removed from the\nenvironment, rather than to have an empty value.\n", + "example": [ + "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + ], + "items": { + "type": "string" + } + }, + "Cmd": { + "type": "array", + "description": "Command to run specified as a string or an array of strings.\n", + "example": [ + "/bin/sh" + ], + "items": { + "type": "string" + } + }, + "Healthcheck": { + "type": "object", + "properties": { + "Test": { + "type": "array", + "description": "The test to perform. Possible values are:\n\n- `[]` inherit healthcheck from image or parent image\n- `[\"NONE\"]` disable healthcheck\n- `[\"CMD\", args...]` exec arguments directly\n- `[\"CMD-SHELL\", command]` run command with system's default shell\n", + "items": { + "type": "string" + } + }, + "Interval": { + "type": "integer", + "description": "The time to wait between checks in nanoseconds. It should be 0 or at\nleast 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Timeout": { + "type": "integer", + "description": "The time to wait before considering the check to have hung. It should\nbe 0 or at least 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Retries": { + "type": "integer", + "description": "The number of consecutive failures needed to consider a container as\nunhealthy. 0 means inherit.\n" + }, + "StartPeriod": { + "type": "integer", + "description": "Start period for the container to initialize before starting\nhealth-retries countdown in nanoseconds. It should be 0 or at least\n1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + } + }, + "description": "A test to perform to check that the container is healthy." + }, + "ArgsEscaped": { + "type": "boolean", + "description": "Command is already escaped (Windows only)", + "nullable": true, + "example": false, + "default": false + }, + "Image": { + "type": "string", + "description": "The name (or reference) of the image to use when creating the container,\nor which was used when the container was created.\n\n


\n\n> **Note**: this field is always empty and must not be used.\n", + "example": "", + "default": "" + }, + "Volumes": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": {} + }, + "description": "An object mapping mount point paths inside the container to empty\nobjects.\n", + "example": { + "/app/data": {}, + "/app/config": {} + } + }, + "WorkingDir": { + "type": "string", + "description": "The working directory for commands to run in.", + "example": "/public/" + }, + "Entrypoint": { + "type": "array", + "description": "The entry point for the container as a string or an array of strings.\n\nIf the array consists of exactly one empty string (`[\"\"]`) then the\nentry point is reset to system default (i.e., the entry point used by\ndocker when there is no `ENTRYPOINT` instruction in the `Dockerfile`).\n", + "example": [], + "items": { + "type": "string" + } + }, + "NetworkDisabled": { + "type": "boolean", + "description": "Disable networking for the container.\n\n


\n\n> **Note**: this field is always omitted and must not be used.\n", + "nullable": true, + "example": false, + "default": false + }, + "MacAddress": { + "type": "string", + "description": "MAC address of the container.\n\n


\n\n> **Note**: this field is always omitted and must not be used.\n", + "nullable": true, + "example": "", + "default": "" + }, + "OnBuild": { + "type": "array", + "description": "`ONBUILD` metadata that were defined in the image's `Dockerfile`.\n", + "nullable": true, + "example": [], + "items": { + "type": "string" + } + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "StopSignal": { + "type": "string", + "description": "Signal to stop a container as a string or unsigned integer.\n", + "nullable": true, + "example": "SIGTERM" + }, + "StopTimeout": { + "type": "integer", + "description": "Timeout to stop a container in seconds.\n\n


\n\n> **Note**: this field is always omitted and must not be used.\n", + "nullable": true + }, + "Shell": { + "type": "array", + "description": "Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell.\n", + "nullable": true, + "example": [ + "/bin/sh", + "-c" + ], + "items": { + "type": "string" + } + } + }, + "description": "Configuration of the image. These fields are used as defaults\nwhen starting a container from the image.\n", + "example": { + "Hostname": "", + "Domainname": "", + "User": "web:web", + "AttachStdin": false, + "AttachStdout": false, + "AttachStderr": false, + "ExposedPorts": { + "80/tcp": {}, + "443/tcp": {} + }, + "Tty": false, + "OpenStdin": false, + "StdinOnce": false, + "Env": [ + "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + ], + "Cmd": [ + "/bin/sh" + ], + "Healthcheck": { + "Test": [ + "string" + ], + "Interval": 0, + "Timeout": 0, + "Retries": 0, + "StartPeriod": 0, + "StartInterval": 0 + }, + "ArgsEscaped": true, + "Image": "", + "Volumes": { + "/app/data": {}, + "/app/config": {} + }, + "WorkingDir": "/public/", + "Entrypoint": [], + "OnBuild": [], + "Labels": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + }, + "StopSignal": "SIGTERM", + "Shell": [ + "/bin/sh", + "-c" + ] + } + }, + "NetworkingConfig": { + "type": "object", + "properties": { + "EndpointsConfig": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "IPAMConfig": { + "type": "object", + "properties": { + "IPv4Address": { + "type": "string", + "example": "172.20.30.33" + }, + "IPv6Address": { + "type": "string", + "example": "2001:db8:abcd::3033" + }, + "LinkLocalIPs": { + "type": "array", + "example": [ + "169.254.34.68", + "fe80::3468" + ], + "items": { + "type": "string" + } + } + }, + "description": "EndpointIPAMConfig represents an endpoint's IPAM configuration.\n", + "nullable": true, + "x-nullable": true + }, + "Links": { + "type": "array", + "example": [ + "container_1", + "container_2" + ], + "items": { + "type": "string" + } + }, + "Aliases": { + "type": "array", + "example": [ + "server_x", + "server_y" + ], + "items": { + "type": "string" + } + }, + "NetworkID": { + "type": "string", + "description": "Unique ID of the network.\n", + "example": "08754567f1f40222263eab4102e1c733ae697e8e354aa9cd6e18d7402835292a" + }, + "EndpointID": { + "type": "string", + "description": "Unique ID for the service endpoint in a Sandbox.\n", + "example": "b88f5b905aabf2893f3cbc4ee42d1ea7980bbc0a92e2c8922b1e1795298afb0b" + }, + "Gateway": { + "type": "string", + "description": "Gateway address for this network.\n", + "example": "172.17.0.1" + }, + "IPAddress": { + "type": "string", + "description": "IPv4 address.\n", + "example": "172.17.0.4" + }, + "IPPrefixLen": { + "type": "integer", + "description": "Mask length of the IPv4 address.\n", + "example": 16 + }, + "IPv6Gateway": { + "type": "string", + "description": "IPv6 gateway address.\n", + "example": "2001:db8:2::100" + }, + "GlobalIPv6Address": { + "type": "string", + "description": "Global IPv6 address.\n", + "example": "2001:db8::5689" + }, + "GlobalIPv6PrefixLen": { + "type": "integer", + "description": "Mask length of the global IPv6 address.\n", + "format": "int64", + "example": 64 + }, + "MacAddress": { + "type": "string", + "description": "MAC address for the endpoint on this network.\n", + "example": "02:42:ac:11:00:04" + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "DriverOpts is a mapping of driver options and values. These options\nare passed directly to the driver and are driver specific.\n", + "nullable": true, + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + } + }, + "description": "Configuration for a network endpoint." + }, + "description": "A mapping of network name to endpoint configuration for that network.\n" + } + }, + "description": "NetworkingConfig represents the container's networking configuration for\neach of its interfaces.\nIt is used for the networking configs specified in the `docker create`\nand `docker network connect` commands.\n", + "example": { + "EndpointsConfig": { + "isolated_nw": { + "IPAMConfig": { + "IPv4Address": "172.20.30.33", + "IPv6Address": "2001:db8:abcd::3033", + "LinkLocalIPs": [ + "169.254.34.68", + "fe80::3468" + ] + }, + "Links": [ + "container_1", + "container_2" + ], + "Aliases": [ + "server_x", + "server_y" + ] + } + } + } + }, + "NetworkSettings": { + "type": "object", + "properties": { + "Bridge": { + "type": "string", + "description": "Name of the network's bridge (for example, `docker0`).", + "example": "docker0" + }, + "SandboxID": { + "type": "string", + "description": "SandboxID uniquely represents a container's network stack.", + "example": "9d12daf2c33f5959c8bf90aa513e4f65b561738661003029ec84830cd503a0c3" + }, + "HairpinMode": { + "type": "boolean", + "description": "Indicates if hairpin NAT should be enabled on the virtual interface.\n", + "example": false + }, + "LinkLocalIPv6Address": { + "type": "string", + "description": "IPv6 unicast address using the link-local prefix.", + "example": "fe80::42:acff:fe11:1" + }, + "LinkLocalIPv6PrefixLen": { + "type": "integer", + "description": "Prefix length of the IPv6 unicast address.", + "example": 64 + }, + "Ports": { + "type": "object", + "additionalProperties": { + "type": "array", + "nullable": true, + "items": { + "type": "object", + "properties": { + "HostIp": { + "type": "string", + "description": "Host IP address that the container's port is mapped to.", + "example": "127.0.0.1" + }, + "HostPort": { + "type": "string", + "description": "Host port number that the container's port is mapped to.", + "example": "4443" + } + }, + "description": "PortBinding represents a binding between a host IP address and a host\nport.\n" + } + }, + "description": "PortMap describes the mapping of container ports to host ports, using the\ncontainer's port-number and protocol as key in the format `/`,\nfor example, `80/udp`.\n\nIf a container's port is mapped for multiple protocols, separate entries\nare added to the mapping table.\n", + "example": { + "443/tcp": [ + { + "HostIp": "127.0.0.1", + "HostPort": "4443" + } + ], + "80/tcp": [ + { + "HostIp": "0.0.0.0", + "HostPort": "80" + }, + { + "HostIp": "0.0.0.0", + "HostPort": "8080" + } + ], + "80/udp": [ + { + "HostIp": "0.0.0.0", + "HostPort": "80" + } + ], + "53/udp": [ + { + "HostIp": "0.0.0.0", + "HostPort": "53" + } + ] + } + }, + "SandboxKey": { + "type": "string", + "description": "SandboxKey identifies the sandbox", + "example": "/var/run/docker/netns/8ab54b426c38" + }, + "SecondaryIPAddresses": { + "type": "array", + "description": "", + "nullable": true, + "items": { + "type": "object", + "properties": { + "Addr": { + "type": "string", + "description": "IP address." + }, + "PrefixLen": { + "type": "integer", + "description": "Mask length of the IP address." + } + }, + "description": "Address represents an IPv4 or IPv6 IP address." + } + }, + "SecondaryIPv6Addresses": { + "type": "array", + "description": "", + "nullable": true, + "items": { + "type": "object", + "properties": { + "Addr": { + "type": "string", + "description": "IP address." + }, + "PrefixLen": { + "type": "integer", + "description": "Mask length of the IP address." + } + }, + "description": "Address represents an IPv4 or IPv6 IP address." + } + }, + "EndpointID": { + "type": "string", + "description": "EndpointID uniquely represents a service endpoint in a Sandbox.\n\n


\n\n> **Deprecated**: This field is only propagated when attached to the\n> default \"bridge\" network. Use the information from the \"bridge\"\n> network inside the `Networks` map instead, which contains the same\n> information. This field was deprecated in Docker 1.9 and is scheduled\n> to be removed in Docker 17.12.0\n", + "example": "b88f5b905aabf2893f3cbc4ee42d1ea7980bbc0a92e2c8922b1e1795298afb0b" + }, + "Gateway": { + "type": "string", + "description": "Gateway address for the default \"bridge\" network.\n\n


\n\n> **Deprecated**: This field is only propagated when attached to the\n> default \"bridge\" network. Use the information from the \"bridge\"\n> network inside the `Networks` map instead, which contains the same\n> information. This field was deprecated in Docker 1.9 and is scheduled\n> to be removed in Docker 17.12.0\n", + "example": "172.17.0.1" + }, + "GlobalIPv6Address": { + "type": "string", + "description": "Global IPv6 address for the default \"bridge\" network.\n\n


\n\n> **Deprecated**: This field is only propagated when attached to the\n> default \"bridge\" network. Use the information from the \"bridge\"\n> network inside the `Networks` map instead, which contains the same\n> information. This field was deprecated in Docker 1.9 and is scheduled\n> to be removed in Docker 17.12.0\n", + "example": "2001:db8::5689" + }, + "GlobalIPv6PrefixLen": { + "type": "integer", + "description": "Mask length of the global IPv6 address.\n\n


\n\n> **Deprecated**: This field is only propagated when attached to the\n> default \"bridge\" network. Use the information from the \"bridge\"\n> network inside the `Networks` map instead, which contains the same\n> information. This field was deprecated in Docker 1.9 and is scheduled\n> to be removed in Docker 17.12.0\n", + "example": 64 + }, + "IPAddress": { + "type": "string", + "description": "IPv4 address for the default \"bridge\" network.\n\n


\n\n> **Deprecated**: This field is only propagated when attached to the\n> default \"bridge\" network. Use the information from the \"bridge\"\n> network inside the `Networks` map instead, which contains the same\n> information. This field was deprecated in Docker 1.9 and is scheduled\n> to be removed in Docker 17.12.0\n", + "example": "172.17.0.4" + }, + "IPPrefixLen": { + "type": "integer", + "description": "Mask length of the IPv4 address.\n\n


\n\n> **Deprecated**: This field is only propagated when attached to the\n> default \"bridge\" network. Use the information from the \"bridge\"\n> network inside the `Networks` map instead, which contains the same\n> information. This field was deprecated in Docker 1.9 and is scheduled\n> to be removed in Docker 17.12.0\n", + "example": 16 + }, + "IPv6Gateway": { + "type": "string", + "description": "IPv6 gateway address for this network.\n\n


\n\n> **Deprecated**: This field is only propagated when attached to the\n> default \"bridge\" network. Use the information from the \"bridge\"\n> network inside the `Networks` map instead, which contains the same\n> information. This field was deprecated in Docker 1.9 and is scheduled\n> to be removed in Docker 17.12.0\n", + "example": "2001:db8:2::100" + }, + "MacAddress": { + "type": "string", + "description": "MAC address for the container on the default \"bridge\" network.\n\n


\n\n> **Deprecated**: This field is only propagated when attached to the\n> default \"bridge\" network. Use the information from the \"bridge\"\n> network inside the `Networks` map instead, which contains the same\n> information. This field was deprecated in Docker 1.9 and is scheduled\n> to be removed in Docker 17.12.0\n", + "example": "02:42:ac:11:00:04" + }, + "Networks": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "IPAMConfig": { + "type": "object", + "properties": { + "IPv4Address": { + "type": "string", + "example": "172.20.30.33" + }, + "IPv6Address": { + "type": "string", + "example": "2001:db8:abcd::3033" + }, + "LinkLocalIPs": { + "type": "array", + "example": [ + "169.254.34.68", + "fe80::3468" + ], + "items": { + "type": "string" + } + } + }, + "description": "EndpointIPAMConfig represents an endpoint's IPAM configuration.\n", + "nullable": true, + "x-nullable": true + }, + "Links": { + "type": "array", + "example": [ + "container_1", + "container_2" + ], + "items": { + "type": "string" + } + }, + "Aliases": { + "type": "array", + "example": [ + "server_x", + "server_y" + ], + "items": { + "type": "string" + } + }, + "NetworkID": { + "type": "string", + "description": "Unique ID of the network.\n", + "example": "08754567f1f40222263eab4102e1c733ae697e8e354aa9cd6e18d7402835292a" + }, + "EndpointID": { + "type": "string", + "description": "Unique ID for the service endpoint in a Sandbox.\n", + "example": "b88f5b905aabf2893f3cbc4ee42d1ea7980bbc0a92e2c8922b1e1795298afb0b" + }, + "Gateway": { + "type": "string", + "description": "Gateway address for this network.\n", + "example": "172.17.0.1" + }, + "IPAddress": { + "type": "string", + "description": "IPv4 address.\n", + "example": "172.17.0.4" + }, + "IPPrefixLen": { + "type": "integer", + "description": "Mask length of the IPv4 address.\n", + "example": 16 + }, + "IPv6Gateway": { + "type": "string", + "description": "IPv6 gateway address.\n", + "example": "2001:db8:2::100" + }, + "GlobalIPv6Address": { + "type": "string", + "description": "Global IPv6 address.\n", + "example": "2001:db8::5689" + }, + "GlobalIPv6PrefixLen": { + "type": "integer", + "description": "Mask length of the global IPv6 address.\n", + "format": "int64", + "example": 64 + }, + "MacAddress": { + "type": "string", + "description": "MAC address for the endpoint on this network.\n", + "example": "02:42:ac:11:00:04" + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "DriverOpts is a mapping of driver options and values. These options\nare passed directly to the driver and are driver specific.\n", + "nullable": true, + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + } + }, + "description": "Configuration for a network endpoint." + }, + "description": "Information about all networks that the container is connected to.\n" + } + }, + "description": "NetworkSettings exposes the network settings in the API" + }, + "Address": { + "type": "object", + "properties": { + "Addr": { + "type": "string", + "description": "IP address." + }, + "PrefixLen": { + "type": "integer", + "description": "Mask length of the IP address." + } + }, + "description": "Address represents an IPv4 or IPv6 IP address." + }, + "PortMap": { + "type": "object", + "additionalProperties": { + "type": "array", + "nullable": true, + "items": { + "type": "object", + "properties": { + "HostIp": { + "type": "string", + "description": "Host IP address that the container's port is mapped to.", + "example": "127.0.0.1" + }, + "HostPort": { + "type": "string", + "description": "Host port number that the container's port is mapped to.", + "example": "4443" + } + }, + "description": "PortBinding represents a binding between a host IP address and a host\nport.\n" + } + }, + "description": "PortMap describes the mapping of container ports to host ports, using the\ncontainer's port-number and protocol as key in the format `/`,\nfor example, `80/udp`.\n\nIf a container's port is mapped for multiple protocols, separate entries\nare added to the mapping table.\n", + "example": { + "443/tcp": [ + { + "HostIp": "127.0.0.1", + "HostPort": "4443" + } + ], + "80/tcp": [ + { + "HostIp": "0.0.0.0", + "HostPort": "80" + }, + { + "HostIp": "0.0.0.0", + "HostPort": "8080" + } + ], + "80/udp": [ + { + "HostIp": "0.0.0.0", + "HostPort": "80" + } + ], + "53/udp": [ + { + "HostIp": "0.0.0.0", + "HostPort": "53" + } + ] + } + }, + "PortBinding": { + "type": "object", + "properties": { + "HostIp": { + "type": "string", + "description": "Host IP address that the container's port is mapped to.", + "example": "127.0.0.1" + }, + "HostPort": { + "type": "string", + "description": "Host port number that the container's port is mapped to.", + "example": "4443" + } + }, + "description": "PortBinding represents a binding between a host IP address and a host\nport.\n" + }, + "GraphDriverData": { + "required": [ + "Data", + "Name" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the storage driver.", + "nullable": false, + "example": "overlay2" + }, + "Data": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Low-level storage metadata, provided as key/value pairs.\n\nThis information is driver-specific, and depends on the storage-driver\nin use, and should be used for informational purposes only.\n", + "nullable": false, + "example": { + "MergedDir": "/var/lib/docker/overlay2/ef749362d13333e65fc95c572eb525abbe0052e16e086cb64bc3b98ae9aa6d74/merged", + "UpperDir": "/var/lib/docker/overlay2/ef749362d13333e65fc95c572eb525abbe0052e16e086cb64bc3b98ae9aa6d74/diff", + "WorkDir": "/var/lib/docker/overlay2/ef749362d13333e65fc95c572eb525abbe0052e16e086cb64bc3b98ae9aa6d74/work" + } + } + }, + "description": "Information about the storage driver used to store the container's and\nimage's filesystem.\n" + }, + "FilesystemChange": { + "required": [ + "Kind", + "Path" + ], + "type": "object", + "properties": { + "Path": { + "type": "string", + "description": "Path to file or directory that has changed.\n", + "nullable": false + }, + "Kind": { + "type": "integer", + "description": "Kind of change\n\nCan be one of:\n\n- `0`: Modified (\"C\")\n- `1`: Added (\"A\")\n- `2`: Deleted (\"D\")\n", + "format": "uint8", + "nullable": false, + "enum": [ + 0, + 1, + 2 + ], + "x-nullable": false + } + }, + "description": "Change in the container's filesystem.\n" + }, + "ChangeType": { + "type": "integer", + "description": "Kind of change\n\nCan be one of:\n\n- `0`: Modified (\"C\")\n- `1`: Added (\"A\")\n- `2`: Deleted (\"D\")\n", + "format": "uint8", + "nullable": false, + "enum": [ + 0, + 1, + 2 + ], + "x-nullable": false + }, + "ImageInspect": { + "type": "object", + "properties": { + "Id": { + "type": "string", + "description": "ID is the content-addressable ID of an image.\n\nThis identifier is a content-addressable digest calculated from the\nimage's configuration (which includes the digests of layers used by\nthe image).\n\nNote that this digest differs from the `RepoDigests` below, which\nholds digests of image manifests that reference the image.\n", + "nullable": false, + "example": "sha256:ec3f0931a6e6b6855d76b2d7b0be30e81860baccd891b2e243280bf1cd8ad710" + }, + "RepoTags": { + "type": "array", + "description": "List of image names/tags in the local image cache that reference this\nimage.\n\nMultiple image tags can refer to the same image, and this list may be\nempty if no tags reference the image, in which case the image is\n\"untagged\", in which case it can still be referenced by its ID.\n", + "example": [ + "example:1.0", + "example:latest", + "example:stable", + "internal.registry.example.com:5000/example:1.0" + ], + "items": { + "type": "string" + } + }, + "RepoDigests": { + "type": "array", + "description": "List of content-addressable digests of locally available image manifests\nthat the image is referenced from. Multiple manifests can refer to the\nsame image.\n\nThese digests are usually only available if the image was either pulled\nfrom a registry, or if the image was pushed to a registry, which is when\nthe manifest is generated and its digest calculated.\n", + "example": [ + "example@sha256:afcc7f1ac1b49db317a7196c902e61c6c3c4607d63599ee1a82d702d249a0ccb", + "internal.registry.example.com:5000/example@sha256:b69959407d21e8a062e0416bf13405bb2b71ed7a84dde4158ebafacfa06f5578" + ], + "items": { + "type": "string" + } + }, + "Parent": { + "type": "string", + "description": "ID of the parent image.\n\nDepending on how the image was created, this field may be empty and\nis only set for images that were built/created locally. This field\nis empty if the image was pulled from an image registry.\n", + "nullable": false, + "example": "" + }, + "Comment": { + "type": "string", + "description": "Optional message that was set when committing or importing the image.\n", + "nullable": false, + "example": "" + }, + "Created": { + "type": "string", + "description": "Date and time at which the image was created, formatted in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "nullable": false, + "example": "2022-02-04T21:20:12.497794809Z" + }, + "Container": { + "type": "string", + "description": "The ID of the container that was used to create the image.\n\nDepending on how the image was created, this field may be empty.\n", + "nullable": false, + "example": "65974bc86f1770ae4bff79f651ebdbce166ae9aada632ee3fa9af3a264911735" + }, + "ContainerConfig": { + "type": "object", + "properties": { + "Hostname": { + "type": "string", + "description": "The hostname to use for the container, as a valid RFC 1123 hostname.\n", + "example": "439f4e91bd1d" + }, + "Domainname": { + "type": "string", + "description": "The domain name to use for the container.\n" + }, + "User": { + "type": "string", + "description": "The user that commands are run as inside the container." + }, + "AttachStdin": { + "type": "boolean", + "description": "Whether to attach to `stdin`.", + "default": false + }, + "AttachStdout": { + "type": "boolean", + "description": "Whether to attach to `stdout`.", + "default": true + }, + "AttachStderr": { + "type": "boolean", + "description": "Whether to attach to `stderr`.", + "default": true + }, + "ExposedPorts": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": {} + }, + "description": "An object mapping ports to an empty object in the form:\n\n`{\"/\": {}}`\n", + "nullable": true, + "example": { + "80/tcp": {}, + "443/tcp": {} + } + }, + "Tty": { + "type": "boolean", + "description": "Attach standard streams to a TTY, including `stdin` if it is not closed.\n", + "default": false + }, + "OpenStdin": { + "type": "boolean", + "description": "Open `stdin`", + "default": false + }, + "StdinOnce": { + "type": "boolean", + "description": "Close `stdin` after one attached client disconnects", + "default": false + }, + "Env": { + "type": "array", + "description": "A list of environment variables to set inside the container in the\nform `[\"VAR=value\", ...]`. A variable without `=` is removed from the\nenvironment, rather than to have an empty value.\n", + "example": [ + "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + ], + "items": { + "type": "string" + } + }, + "Cmd": { + "type": "array", + "description": "Command to run specified as a string or an array of strings.\n", + "example": [ + "/bin/sh" + ], + "items": { + "type": "string" + } + }, + "Healthcheck": { + "type": "object", + "properties": { + "Test": { + "type": "array", + "description": "The test to perform. Possible values are:\n\n- `[]` inherit healthcheck from image or parent image\n- `[\"NONE\"]` disable healthcheck\n- `[\"CMD\", args...]` exec arguments directly\n- `[\"CMD-SHELL\", command]` run command with system's default shell\n", + "items": { + "type": "string" + } + }, + "Interval": { + "type": "integer", + "description": "The time to wait between checks in nanoseconds. It should be 0 or at\nleast 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Timeout": { + "type": "integer", + "description": "The time to wait before considering the check to have hung. It should\nbe 0 or at least 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Retries": { + "type": "integer", + "description": "The number of consecutive failures needed to consider a container as\nunhealthy. 0 means inherit.\n" + }, + "StartPeriod": { + "type": "integer", + "description": "Start period for the container to initialize before starting\nhealth-retries countdown in nanoseconds. It should be 0 or at least\n1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + } + }, + "description": "A test to perform to check that the container is healthy." + }, + "ArgsEscaped": { + "type": "boolean", + "description": "Command is already escaped (Windows only)", + "nullable": true, + "example": false, + "default": false + }, + "Image": { + "type": "string", + "description": "The name (or reference) of the image to use when creating the container,\nor which was used when the container was created.\n", + "example": "example-image:1.0" + }, + "Volumes": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": {} + }, + "description": "An object mapping mount point paths inside the container to empty\nobjects.\n" + }, + "WorkingDir": { + "type": "string", + "description": "The working directory for commands to run in.", + "example": "/public/" + }, + "Entrypoint": { + "type": "array", + "description": "The entry point for the container as a string or an array of strings.\n\nIf the array consists of exactly one empty string (`[\"\"]`) then the\nentry point is reset to system default (i.e., the entry point used by\ndocker when there is no `ENTRYPOINT` instruction in the `Dockerfile`).\n", + "example": [], + "items": { + "type": "string" + } + }, + "NetworkDisabled": { + "type": "boolean", + "description": "Disable networking for the container.", + "nullable": true + }, + "MacAddress": { + "type": "string", + "description": "MAC address of the container.", + "nullable": true + }, + "OnBuild": { + "type": "array", + "description": "`ONBUILD` metadata that were defined in the image's `Dockerfile`.\n", + "nullable": true, + "example": [], + "items": { + "type": "string" + } + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "StopSignal": { + "type": "string", + "description": "Signal to stop a container as a string or unsigned integer.\n", + "nullable": true, + "example": "SIGTERM" + }, + "StopTimeout": { + "type": "integer", + "description": "Timeout to stop a container in seconds.", + "nullable": true + }, + "Shell": { + "type": "array", + "description": "Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell.\n", + "nullable": true, + "example": [ + "/bin/sh", + "-c" + ], + "items": { + "type": "string" + } + } + }, + "description": "Configuration for a container that is portable between hosts.\n\nWhen used as `ContainerConfig` field in an image, `ContainerConfig` is an\noptional field containing the configuration of the container that was last\ncommitted when creating the image.\n\nPrevious versions of Docker builder used this field to store build cache,\nand it is not in active use anymore.\n" + }, + "DockerVersion": { + "type": "string", + "description": "The version of Docker that was used to build the image.\n\nDepending on how the image was created, this field may be empty.\n", + "nullable": false, + "example": "20.10.7" + }, + "Author": { + "type": "string", + "description": "Name of the author that was specified when committing the image, or as\nspecified through MAINTAINER (deprecated) in the Dockerfile.\n", + "nullable": false, + "example": "" + }, + "Config": { + "type": "object", + "properties": { + "Hostname": { + "type": "string", + "description": "The hostname to use for the container, as a valid RFC 1123 hostname.\n\n


\n\n> **Note**: this field is always empty and must not be used.\n", + "example": "" + }, + "Domainname": { + "type": "string", + "description": "The domain name to use for the container.\n\n


\n\n> **Note**: this field is always empty and must not be used.\n", + "example": "" + }, + "User": { + "type": "string", + "description": "The user that commands are run as inside the container.", + "example": "web:web" + }, + "AttachStdin": { + "type": "boolean", + "description": "Whether to attach to `stdin`.\n\n


\n\n> **Note**: this field is always false and must not be used.\n", + "example": false, + "default": false + }, + "AttachStdout": { + "type": "boolean", + "description": "Whether to attach to `stdout`.\n\n


\n\n> **Note**: this field is always false and must not be used.\n", + "example": false, + "default": false + }, + "AttachStderr": { + "type": "boolean", + "description": "Whether to attach to `stderr`.\n\n


\n\n> **Note**: this field is always false and must not be used.\n", + "example": false, + "default": false + }, + "ExposedPorts": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": {} + }, + "description": "An object mapping ports to an empty object in the form:\n\n`{\"/\": {}}`\n", + "nullable": true, + "example": { + "80/tcp": {}, + "443/tcp": {} + } + }, + "Tty": { + "type": "boolean", + "description": "Attach standard streams to a TTY, including `stdin` if it is not closed.\n\n


\n\n> **Note**: this field is always false and must not be used.\n", + "example": false, + "default": false + }, + "OpenStdin": { + "type": "boolean", + "description": "Open `stdin`\n\n


\n\n> **Note**: this field is always false and must not be used.\n", + "example": false, + "default": false + }, + "StdinOnce": { + "type": "boolean", + "description": "Close `stdin` after one attached client disconnects.\n\n


\n\n> **Note**: this field is always false and must not be used.\n", + "example": false, + "default": false + }, + "Env": { + "type": "array", + "description": "A list of environment variables to set inside the container in the\nform `[\"VAR=value\", ...]`. A variable without `=` is removed from the\nenvironment, rather than to have an empty value.\n", + "example": [ + "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + ], + "items": { + "type": "string" + } + }, + "Cmd": { + "type": "array", + "description": "Command to run specified as a string or an array of strings.\n", + "example": [ + "/bin/sh" + ], + "items": { + "type": "string" + } + }, + "Healthcheck": { + "type": "object", + "properties": { + "Test": { + "type": "array", + "description": "The test to perform. Possible values are:\n\n- `[]` inherit healthcheck from image or parent image\n- `[\"NONE\"]` disable healthcheck\n- `[\"CMD\", args...]` exec arguments directly\n- `[\"CMD-SHELL\", command]` run command with system's default shell\n", + "items": { + "type": "string" + } + }, + "Interval": { + "type": "integer", + "description": "The time to wait between checks in nanoseconds. It should be 0 or at\nleast 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Timeout": { + "type": "integer", + "description": "The time to wait before considering the check to have hung. It should\nbe 0 or at least 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Retries": { + "type": "integer", + "description": "The number of consecutive failures needed to consider a container as\nunhealthy. 0 means inherit.\n" + }, + "StartPeriod": { + "type": "integer", + "description": "Start period for the container to initialize before starting\nhealth-retries countdown in nanoseconds. It should be 0 or at least\n1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + } + }, + "description": "A test to perform to check that the container is healthy." + }, + "ArgsEscaped": { + "type": "boolean", + "description": "Command is already escaped (Windows only)", + "nullable": true, + "example": false, + "default": false + }, + "Image": { + "type": "string", + "description": "The name (or reference) of the image to use when creating the container,\nor which was used when the container was created.\n\n


\n\n> **Note**: this field is always empty and must not be used.\n", + "example": "", + "default": "" + }, + "Volumes": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": {} + }, + "description": "An object mapping mount point paths inside the container to empty\nobjects.\n", + "example": { + "/app/data": {}, + "/app/config": {} + } + }, + "WorkingDir": { + "type": "string", + "description": "The working directory for commands to run in.", + "example": "/public/" + }, + "Entrypoint": { + "type": "array", + "description": "The entry point for the container as a string or an array of strings.\n\nIf the array consists of exactly one empty string (`[\"\"]`) then the\nentry point is reset to system default (i.e., the entry point used by\ndocker when there is no `ENTRYPOINT` instruction in the `Dockerfile`).\n", + "example": [], + "items": { + "type": "string" + } + }, + "NetworkDisabled": { + "type": "boolean", + "description": "Disable networking for the container.\n\n


\n\n> **Note**: this field is always omitted and must not be used.\n", + "nullable": true, + "example": false, + "default": false + }, + "MacAddress": { + "type": "string", + "description": "MAC address of the container.\n\n


\n\n> **Note**: this field is always omitted and must not be used.\n", + "nullable": true, + "example": "", + "default": "" + }, + "OnBuild": { + "type": "array", + "description": "`ONBUILD` metadata that were defined in the image's `Dockerfile`.\n", + "nullable": true, + "example": [], + "items": { + "type": "string" + } + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "StopSignal": { + "type": "string", + "description": "Signal to stop a container as a string or unsigned integer.\n", + "nullable": true, + "example": "SIGTERM" + }, + "StopTimeout": { + "type": "integer", + "description": "Timeout to stop a container in seconds.\n\n


\n\n> **Note**: this field is always omitted and must not be used.\n", + "nullable": true + }, + "Shell": { + "type": "array", + "description": "Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell.\n", + "nullable": true, + "example": [ + "/bin/sh", + "-c" + ], + "items": { + "type": "string" + } + } + }, + "description": "Configuration of the image. These fields are used as defaults\nwhen starting a container from the image.\n", + "example": { + "Hostname": "", + "Domainname": "", + "User": "web:web", + "AttachStdin": false, + "AttachStdout": false, + "AttachStderr": false, + "ExposedPorts": { + "80/tcp": {}, + "443/tcp": {} + }, + "Tty": false, + "OpenStdin": false, + "StdinOnce": false, + "Env": [ + "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + ], + "Cmd": [ + "/bin/sh" + ], + "Healthcheck": { + "Test": [ + "string" + ], + "Interval": 0, + "Timeout": 0, + "Retries": 0, + "StartPeriod": 0, + "StartInterval": 0 + }, + "ArgsEscaped": true, + "Image": "", + "Volumes": { + "/app/data": {}, + "/app/config": {} + }, + "WorkingDir": "/public/", + "Entrypoint": [], + "OnBuild": [], + "Labels": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + }, + "StopSignal": "SIGTERM", + "Shell": [ + "/bin/sh", + "-c" + ] + } + }, + "Architecture": { + "type": "string", + "description": "Hardware CPU architecture that the image runs on.\n", + "nullable": false, + "example": "arm" + }, + "Variant": { + "type": "string", + "description": "CPU architecture variant (presently ARM-only).\n", + "nullable": true, + "example": "v7" + }, + "Os": { + "type": "string", + "description": "Operating System the image is built to run on.\n", + "nullable": false, + "example": "linux" + }, + "OsVersion": { + "type": "string", + "description": "Operating System version the image is built to run on (especially\nfor Windows).\n", + "nullable": true, + "example": "" + }, + "Size": { + "type": "integer", + "description": "Total size of the image including all layers it is composed of.\n", + "format": "int64", + "nullable": false, + "example": 1239828 + }, + "VirtualSize": { + "type": "integer", + "description": "Total size of the image including all layers it is composed of.\n\nIn versions of Docker before v1.10, this field was calculated from\nthe image itself and all of its parent images. Images are now stored\nself-contained, and no longer use a parent-chain, making this field\nan equivalent of the Size field.\n\n> **Deprecated**: this field is kept for backward compatibility, but\n> will be removed in API v1.44.\n", + "format": "int64", + "example": 1239828 + }, + "GraphDriver": { + "required": [ + "Data", + "Name" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the storage driver.", + "nullable": false, + "example": "overlay2" + }, + "Data": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Low-level storage metadata, provided as key/value pairs.\n\nThis information is driver-specific, and depends on the storage-driver\nin use, and should be used for informational purposes only.\n", + "nullable": false, + "example": { + "MergedDir": "/var/lib/docker/overlay2/ef749362d13333e65fc95c572eb525abbe0052e16e086cb64bc3b98ae9aa6d74/merged", + "UpperDir": "/var/lib/docker/overlay2/ef749362d13333e65fc95c572eb525abbe0052e16e086cb64bc3b98ae9aa6d74/diff", + "WorkDir": "/var/lib/docker/overlay2/ef749362d13333e65fc95c572eb525abbe0052e16e086cb64bc3b98ae9aa6d74/work" + } + } + }, + "description": "Information about the storage driver used to store the container's and\nimage's filesystem.\n" + }, + "RootFS": { + "required": [ + "Type" + ], + "type": "object", + "properties": { + "Type": { + "type": "string", + "nullable": false, + "example": "layers" + }, + "Layers": { + "type": "array", + "example": [ + "sha256:1834950e52ce4d5a88a1bbd131c537f4d0e56d10ff0dd69e66be3b7dfa9df7e6", + "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef" + ], + "items": { + "type": "string" + } + } + }, + "description": "Information about the image's RootFS, including the layer IDs.\n" + }, + "Metadata": { + "type": "object", + "properties": { + "LastTagTime": { + "type": "string", + "description": "Date and time at which the image was last tagged in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n\nThis information is only available if the image was tagged locally,\nand omitted otherwise.\n", + "format": "dateTime", + "nullable": true, + "example": "2022-02-28T14:40:02.623929178Z" + } + }, + "description": "Additional metadata of the image in the local cache. This information\nis local to the daemon, and not part of the image itself.\n" + } + }, + "description": "Information about an image in the local image cache.\n" + }, + "ImageSummary": { + "required": [ + "Containers", + "Created", + "Id", + "Labels", + "ParentId", + "RepoDigests", + "RepoTags", + "SharedSize", + "Size" + ], + "type": "object", + "properties": { + "Id": { + "type": "string", + "description": "ID is the content-addressable ID of an image.\n\nThis identifier is a content-addressable digest calculated from the\nimage's configuration (which includes the digests of layers used by\nthe image).\n\nNote that this digest differs from the `RepoDigests` below, which\nholds digests of image manifests that reference the image.\n", + "nullable": false, + "example": "sha256:ec3f0931a6e6b6855d76b2d7b0be30e81860baccd891b2e243280bf1cd8ad710" + }, + "ParentId": { + "type": "string", + "description": "ID of the parent image.\n\nDepending on how the image was created, this field may be empty and\nis only set for images that were built/created locally. This field\nis empty if the image was pulled from an image registry.\n", + "nullable": false, + "example": "" + }, + "RepoTags": { + "type": "array", + "description": "List of image names/tags in the local image cache that reference this\nimage.\n\nMultiple image tags can refer to the same image, and this list may be\nempty if no tags reference the image, in which case the image is\n\"untagged\", in which case it can still be referenced by its ID.\n", + "nullable": false, + "example": [ + "example:1.0", + "example:latest", + "example:stable", + "internal.registry.example.com:5000/example:1.0" + ], + "items": { + "type": "string" + } + }, + "RepoDigests": { + "type": "array", + "description": "List of content-addressable digests of locally available image manifests\nthat the image is referenced from. Multiple manifests can refer to the\nsame image.\n\nThese digests are usually only available if the image was either pulled\nfrom a registry, or if the image was pushed to a registry, which is when\nthe manifest is generated and its digest calculated.\n", + "nullable": false, + "example": [ + "example@sha256:afcc7f1ac1b49db317a7196c902e61c6c3c4607d63599ee1a82d702d249a0ccb", + "internal.registry.example.com:5000/example@sha256:b69959407d21e8a062e0416bf13405bb2b71ed7a84dde4158ebafacfa06f5578" + ], + "items": { + "type": "string" + } + }, + "Created": { + "type": "integer", + "description": "Date and time at which the image was created as a Unix timestamp\n(number of seconds since EPOCH).\n", + "nullable": false, + "example": 1644009612 + }, + "Size": { + "type": "integer", + "description": "Total size of the image including all layers it is composed of.\n", + "format": "int64", + "nullable": false, + "example": 172064416 + }, + "SharedSize": { + "type": "integer", + "description": "Total size of image layers that are shared between this image and other\nimages.\n\nThis size is not calculated by default. `-1` indicates that the value\nhas not been set / calculated.\n", + "format": "int64", + "nullable": false, + "example": 1239828 + }, + "VirtualSize": { + "type": "integer", + "description": "Total size of the image including all layers it is composed of.\n\nIn versions of Docker before v1.10, this field was calculated from\nthe image itself and all of its parent images. Images are now stored\nself-contained, and no longer use a parent-chain, making this field\nan equivalent of the Size field.\n\nDeprecated: this field is kept for backward compatibility, and will be removed in API v1.44.", + "format": "int64", + "example": 172064416 + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "nullable": false, + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "Containers": { + "type": "integer", + "description": "Number of containers using this image. Includes both stopped and running\ncontainers.\n\nThis size is not calculated by default, and depends on which API endpoint\nis used. `-1` indicates that the value has not been set / calculated.\n", + "nullable": false, + "example": 2 + } + } + }, + "AuthConfig": { + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "password": { + "type": "string" + }, + "email": { + "type": "string" + }, + "serveraddress": { + "type": "string" + } + }, + "example": { + "username": "hannibal", + "password": "xxxx", + "serveraddress": "https://index.docker.io/v1/" + } + }, + "ProcessConfig": { + "type": "object", + "properties": { + "privileged": { + "type": "boolean" + }, + "user": { + "type": "string" + }, + "tty": { + "type": "boolean" + }, + "entrypoint": { + "type": "string" + }, + "arguments": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "Volume": { + "required": [ + "Driver", + "Labels", + "Mountpoint", + "Name", + "Options", + "Scope" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the volume.", + "nullable": false, + "example": "tardis" + }, + "Driver": { + "type": "string", + "description": "Name of the volume driver used by the volume.", + "nullable": false, + "example": "custom" + }, + "Mountpoint": { + "type": "string", + "description": "Mount path of the volume on the host.", + "nullable": false, + "example": "/var/lib/docker/volumes/tardis" + }, + "CreatedAt": { + "type": "string", + "description": "Date/Time the volume was created.", + "format": "dateTime", + "example": "2016-06-07T20:31:11.853781916Z" + }, + "Status": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": {} + }, + "description": "Low-level details about the volume, provided by the volume driver.\nDetails are returned as a map with key/value pairs:\n`{\"key\":\"value\",\"key2\":\"value2\"}`.\n\nThe `Status` field is optional, and is omitted if the volume driver\ndoes not support this feature.\n", + "example": { + "hello": "world" + } + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "nullable": false, + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "Scope": { + "type": "string", + "description": "The level at which the volume exists. Either `global` for cluster-wide,\nor `local` for machine level.\n", + "nullable": false, + "example": "local", + "default": "local", + "enum": [ + "local", + "global" + ] + }, + "ClusterVolume": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "The Swarm ID of this volume. Because cluster volumes are Swarm\nobjects, they have an ID, unlike non-cluster volumes. This ID can\nbe used to refer to the Volume instead of the name.\n" + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "format": "dateTime" + }, + "UpdatedAt": { + "type": "string", + "format": "dateTime" + }, + "Spec": { + "type": "object", + "properties": { + "Group": { + "type": "string", + "description": "Group defines the volume group of this volume. Volumes belonging to\nthe same group can be referred to by group name when creating\nServices. Referring to a volume by group instructs Swarm to treat\nvolumes in that group interchangeably for the purpose of scheduling.\nVolumes with an empty string for a group technically all belong to\nthe same, emptystring group.\n" + }, + "AccessMode": { + "type": "object", + "properties": { + "Scope": { + "type": "string", + "description": "The set of nodes this volume can be used on at one time.\n- `single` The volume may only be scheduled to one node at a time.\n- `multi` the volume may be scheduled to any supported number of nodes at a time.\n", + "nullable": false, + "default": "single", + "enum": [ + "single", + "multi" + ] + }, + "Sharing": { + "type": "string", + "description": "The number and way that different tasks can use this volume\nat one time.\n- `none` The volume may only be used by one task at a time.\n- `readonly` The volume may be used by any number of tasks, but they all must mount the volume as readonly\n- `onewriter` The volume may be used by any number of tasks, but only one may mount it as read/write.\n- `all` The volume may have any number of readers and writers.\n", + "nullable": false, + "default": "none", + "enum": [ + "none", + "readonly", + "onewriter", + "all" + ] + }, + "MountVolume": { + "type": "object", + "properties": {}, + "description": "Options for using this volume as a Mount-type volume.\n\n Either MountVolume or BlockVolume, but not both, must be\n present.\n properties:\n FsType:\n type: \"string\"\n description: |\n Specifies the filesystem type for the mount volume.\n Optional.\n MountFlags:\n type: \"array\"\n description: |\n Flags to pass when mounting the volume. Optional.\n items:\n type: \"string\"\nBlockVolume:\n type: \"object\"\n description: |\n Options for using this volume as a Block-type volume.\n Intentionally empty.\n" + }, + "Secrets": { + "type": "array", + "description": "Swarm Secrets that are passed to the CSI storage plugin when\noperating on this volume.\n", + "items": { + "type": "object", + "properties": { + "Key": { + "type": "string", + "description": "Key is the name of the key of the key-value pair passed to\nthe plugin.\n" + }, + "Secret": { + "type": "string", + "description": "Secret is the swarm Secret object from which to read data.\nThis can be a Secret name or ID. The Secret data is\nretrieved by swarm and used as the value of the key-value\npair passed to the plugin.\n" + } + }, + "description": "One cluster volume secret entry. Defines a key-value pair that\nis passed to the plugin.\n" + } + }, + "AccessibilityRequirements": { + "type": "object", + "properties": { + "Requisite": { + "type": "array", + "description": "A list of required topologies, at least one of which the\nvolume must be accessible from.\n", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + }, + "Preferred": { + "type": "array", + "description": "A list of topologies that the volume should attempt to be\nprovisioned in.\n", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + } + }, + "description": "Requirements for the accessible topology of the volume. These\nfields are optional. For an in-depth description of what these\nfields mean, see the CSI specification.\n" + }, + "CapacityRange": { + "type": "object", + "properties": { + "RequiredBytes": { + "type": "integer", + "description": "The volume must be at least this big. The value of 0\nindicates an unspecified minimum\n", + "format": "int64" + }, + "LimitBytes": { + "type": "integer", + "description": "The volume must not be bigger than this. The value of 0\nindicates an unspecified maximum.\n", + "format": "int64" + } + }, + "description": "The desired capacity that the volume should be created with. If\nempty, the plugin will decide the capacity.\n" + }, + "Availability": { + "type": "string", + "description": "The availability of the volume for use in tasks.\n- `active` The volume is fully available for scheduling on the cluster\n- `pause` No new workloads should use the volume, but existing workloads are not stopped.\n- `drain` All workloads using this volume should be stopped and rescheduled, and no new ones should be started.\n", + "nullable": false, + "default": "active", + "enum": [ + "active", + "pause", + "drain" + ] + } + }, + "description": "Defines how the volume is used by tasks.\n" + } + }, + "description": "Cluster-specific options used to create the volume.\n" + }, + "Info": { + "type": "object", + "properties": { + "CapacityBytes": { + "type": "integer", + "description": "The capacity of the volume in bytes. A value of 0 indicates that\nthe capacity is unknown.\n", + "format": "int64" + }, + "VolumeContext": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of strings to strings returned from the storage plugin when\nthe volume is created.\n" + }, + "VolumeID": { + "type": "string", + "description": "The ID of the volume as returned by the CSI storage plugin. This\nis distinct from the volume's ID as provided by Docker. This ID\nis never used by the user when communicating with Docker to refer\nto this volume. If the ID is blank, then the Volume has not been\nsuccessfully created in the plugin yet.\n" + }, + "AccessibleTopology": { + "type": "array", + "description": "The topology this volume is actually accessible from.\n", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + } + }, + "description": "Information about the global status of the volume.\n" + }, + "PublishStatus": { + "type": "array", + "description": "The status of the volume as it pertains to its publishing and use on\nspecific nodes\n", + "items": { + "type": "object", + "properties": { + "NodeID": { + "type": "string", + "description": "The ID of the Swarm node the volume is published on.\n" + }, + "State": { + "type": "string", + "description": "The published state of the volume.\n* `pending-publish` The volume should be published to this node, but the call to the controller plugin to do so has not yet been successfully completed.\n* `published` The volume is published successfully to the node.\n* `pending-node-unpublish` The volume should be unpublished from the node, and the manager is awaiting confirmation from the worker that it has done so.\n* `pending-controller-unpublish` The volume is successfully unpublished from the node, but has not yet been successfully unpublished on the controller.\n", + "enum": [ + "pending-publish", + "published", + "pending-node-unpublish", + "pending-controller-unpublish" + ] + }, + "PublishContext": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of strings to strings returned by the CSI controller\nplugin when a volume is published.\n" + } + } + } + } + }, + "description": "Options and information specific to, and only present on, Swarm CSI\ncluster volumes.\n" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "The driver specific options used when creating the volume.\n", + "example": { + "device": "tmpfs", + "o": "size=100m,uid=1000", + "type": "tmpfs" + } + }, + "UsageData": { + "required": [ + "RefCount", + "Size" + ], + "type": "object", + "properties": { + "Size": { + "type": "integer", + "description": "Amount of disk space used by the volume (in bytes). This information\nis only available for volumes created with the `\"local\"` volume\ndriver. For volumes created with other volume drivers, this field\nis set to `-1` (\"not available\")\n", + "format": "int64", + "nullable": false, + "default": -1 + }, + "RefCount": { + "type": "integer", + "description": "The number of containers referencing this volume. This field\nis set to `-1` if the reference-count is not available.\n", + "format": "int64", + "nullable": false, + "default": -1 + } + }, + "description": "Usage details about the volume. This information is used by the\n`GET /system/df` endpoint, and omitted in other endpoints.\n", + "nullable": true, + "x-go-name": "UsageData" + } + } + }, + "VolumeCreateOptions": { + "title": "VolumeConfig", + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "The new volume's name. If not specified, Docker generates a name.\n", + "nullable": false, + "example": "tardis" + }, + "Driver": { + "type": "string", + "description": "Name of the volume driver to use.", + "nullable": false, + "example": "custom", + "default": "local" + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A mapping of driver options and values. These options are\npassed directly to the driver and are driver specific.\n", + "example": { + "device": "tmpfs", + "o": "size=100m,uid=1000", + "type": "tmpfs" + } + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "ClusterVolumeSpec": { + "type": "object", + "properties": { + "Group": { + "type": "string", + "description": "Group defines the volume group of this volume. Volumes belonging to\nthe same group can be referred to by group name when creating\nServices. Referring to a volume by group instructs Swarm to treat\nvolumes in that group interchangeably for the purpose of scheduling.\nVolumes with an empty string for a group technically all belong to\nthe same, emptystring group.\n" + }, + "AccessMode": { + "type": "object", + "properties": { + "Scope": { + "type": "string", + "description": "The set of nodes this volume can be used on at one time.\n- `single` The volume may only be scheduled to one node at a time.\n- `multi` the volume may be scheduled to any supported number of nodes at a time.\n", + "nullable": false, + "default": "single", + "enum": [ + "single", + "multi" + ] + }, + "Sharing": { + "type": "string", + "description": "The number and way that different tasks can use this volume\nat one time.\n- `none` The volume may only be used by one task at a time.\n- `readonly` The volume may be used by any number of tasks, but they all must mount the volume as readonly\n- `onewriter` The volume may be used by any number of tasks, but only one may mount it as read/write.\n- `all` The volume may have any number of readers and writers.\n", + "nullable": false, + "default": "none", + "enum": [ + "none", + "readonly", + "onewriter", + "all" + ] + }, + "MountVolume": { + "type": "object", + "properties": {}, + "description": "Options for using this volume as a Mount-type volume.\n\n Either MountVolume or BlockVolume, but not both, must be\n present.\n properties:\n FsType:\n type: \"string\"\n description: |\n Specifies the filesystem type for the mount volume.\n Optional.\n MountFlags:\n type: \"array\"\n description: |\n Flags to pass when mounting the volume. Optional.\n items:\n type: \"string\"\nBlockVolume:\n type: \"object\"\n description: |\n Options for using this volume as a Block-type volume.\n Intentionally empty.\n" + }, + "Secrets": { + "type": "array", + "description": "Swarm Secrets that are passed to the CSI storage plugin when\noperating on this volume.\n", + "items": { + "type": "object", + "properties": { + "Key": { + "type": "string", + "description": "Key is the name of the key of the key-value pair passed to\nthe plugin.\n" + }, + "Secret": { + "type": "string", + "description": "Secret is the swarm Secret object from which to read data.\nThis can be a Secret name or ID. The Secret data is\nretrieved by swarm and used as the value of the key-value\npair passed to the plugin.\n" + } + }, + "description": "One cluster volume secret entry. Defines a key-value pair that\nis passed to the plugin.\n" + } + }, + "AccessibilityRequirements": { + "type": "object", + "properties": { + "Requisite": { + "type": "array", + "description": "A list of required topologies, at least one of which the\nvolume must be accessible from.\n", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + }, + "Preferred": { + "type": "array", + "description": "A list of topologies that the volume should attempt to be\nprovisioned in.\n", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + } + }, + "description": "Requirements for the accessible topology of the volume. These\nfields are optional. For an in-depth description of what these\nfields mean, see the CSI specification.\n" + }, + "CapacityRange": { + "type": "object", + "properties": { + "RequiredBytes": { + "type": "integer", + "description": "The volume must be at least this big. The value of 0\nindicates an unspecified minimum\n", + "format": "int64" + }, + "LimitBytes": { + "type": "integer", + "description": "The volume must not be bigger than this. The value of 0\nindicates an unspecified maximum.\n", + "format": "int64" + } + }, + "description": "The desired capacity that the volume should be created with. If\nempty, the plugin will decide the capacity.\n" + }, + "Availability": { + "type": "string", + "description": "The availability of the volume for use in tasks.\n- `active` The volume is fully available for scheduling on the cluster\n- `pause` No new workloads should use the volume, but existing workloads are not stopped.\n- `drain` All workloads using this volume should be stopped and rescheduled, and no new ones should be started.\n", + "nullable": false, + "default": "active", + "enum": [ + "active", + "pause", + "drain" + ] + } + }, + "description": "Defines how the volume is used by tasks.\n" + } + }, + "description": "Cluster-specific options used to create the volume.\n" + } + }, + "description": "Volume configuration", + "x-go-name": "CreateOptions" + }, + "VolumeListResponse": { + "title": "VolumeListResponse", + "type": "object", + "properties": { + "Volumes": { + "type": "array", + "description": "List of volumes", + "items": { + "required": [ + "Driver", + "Labels", + "Mountpoint", + "Name", + "Options", + "Scope" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the volume.", + "nullable": false, + "example": "tardis" + }, + "Driver": { + "type": "string", + "description": "Name of the volume driver used by the volume.", + "nullable": false, + "example": "custom" + }, + "Mountpoint": { + "type": "string", + "description": "Mount path of the volume on the host.", + "nullable": false, + "example": "/var/lib/docker/volumes/tardis" + }, + "CreatedAt": { + "type": "string", + "description": "Date/Time the volume was created.", + "format": "dateTime", + "example": "2016-06-07T20:31:11.853781916Z" + }, + "Status": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": {} + }, + "description": "Low-level details about the volume, provided by the volume driver.\nDetails are returned as a map with key/value pairs:\n`{\"key\":\"value\",\"key2\":\"value2\"}`.\n\nThe `Status` field is optional, and is omitted if the volume driver\ndoes not support this feature.\n", + "example": { + "hello": "world" + } + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "nullable": false, + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "Scope": { + "type": "string", + "description": "The level at which the volume exists. Either `global` for cluster-wide,\nor `local` for machine level.\n", + "nullable": false, + "example": "local", + "default": "local", + "enum": [ + "local", + "global" + ] + }, + "ClusterVolume": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "The Swarm ID of this volume. Because cluster volumes are Swarm\nobjects, they have an ID, unlike non-cluster volumes. This ID can\nbe used to refer to the Volume instead of the name.\n" + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "format": "dateTime" + }, + "UpdatedAt": { + "type": "string", + "format": "dateTime" + }, + "Spec": { + "type": "object", + "properties": { + "Group": { + "type": "string", + "description": "Group defines the volume group of this volume. Volumes belonging to\nthe same group can be referred to by group name when creating\nServices. Referring to a volume by group instructs Swarm to treat\nvolumes in that group interchangeably for the purpose of scheduling.\nVolumes with an empty string for a group technically all belong to\nthe same, emptystring group.\n" + }, + "AccessMode": { + "type": "object", + "properties": { + "Scope": { + "type": "string", + "description": "The set of nodes this volume can be used on at one time.\n- `single` The volume may only be scheduled to one node at a time.\n- `multi` the volume may be scheduled to any supported number of nodes at a time.\n", + "nullable": false, + "default": "single", + "enum": [ + "single", + "multi" + ] + }, + "Sharing": { + "type": "string", + "description": "The number and way that different tasks can use this volume\nat one time.\n- `none` The volume may only be used by one task at a time.\n- `readonly` The volume may be used by any number of tasks, but they all must mount the volume as readonly\n- `onewriter` The volume may be used by any number of tasks, but only one may mount it as read/write.\n- `all` The volume may have any number of readers and writers.\n", + "nullable": false, + "default": "none", + "enum": [ + "none", + "readonly", + "onewriter", + "all" + ] + }, + "MountVolume": { + "type": "object", + "properties": {}, + "description": "Options for using this volume as a Mount-type volume.\n\n Either MountVolume or BlockVolume, but not both, must be\n present.\n properties:\n FsType:\n type: \"string\"\n description: |\n Specifies the filesystem type for the mount volume.\n Optional.\n MountFlags:\n type: \"array\"\n description: |\n Flags to pass when mounting the volume. Optional.\n items:\n type: \"string\"\nBlockVolume:\n type: \"object\"\n description: |\n Options for using this volume as a Block-type volume.\n Intentionally empty.\n" + }, + "Secrets": { + "type": "array", + "description": "Swarm Secrets that are passed to the CSI storage plugin when\noperating on this volume.\n", + "items": { + "type": "object", + "properties": { + "Key": { + "type": "string", + "description": "Key is the name of the key of the key-value pair passed to\nthe plugin.\n" + }, + "Secret": { + "type": "string", + "description": "Secret is the swarm Secret object from which to read data.\nThis can be a Secret name or ID. The Secret data is\nretrieved by swarm and used as the value of the key-value\npair passed to the plugin.\n" + } + }, + "description": "One cluster volume secret entry. Defines a key-value pair that\nis passed to the plugin.\n" + } + }, + "AccessibilityRequirements": { + "type": "object", + "properties": { + "Requisite": { + "type": "array", + "description": "A list of required topologies, at least one of which the\nvolume must be accessible from.\n", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + }, + "Preferred": { + "type": "array", + "description": "A list of topologies that the volume should attempt to be\nprovisioned in.\n", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + } + }, + "description": "Requirements for the accessible topology of the volume. These\nfields are optional. For an in-depth description of what these\nfields mean, see the CSI specification.\n" + }, + "CapacityRange": { + "type": "object", + "properties": { + "RequiredBytes": { + "type": "integer", + "description": "The volume must be at least this big. The value of 0\nindicates an unspecified minimum\n", + "format": "int64" + }, + "LimitBytes": { + "type": "integer", + "description": "The volume must not be bigger than this. The value of 0\nindicates an unspecified maximum.\n", + "format": "int64" + } + }, + "description": "The desired capacity that the volume should be created with. If\nempty, the plugin will decide the capacity.\n" + }, + "Availability": { + "type": "string", + "description": "The availability of the volume for use in tasks.\n- `active` The volume is fully available for scheduling on the cluster\n- `pause` No new workloads should use the volume, but existing workloads are not stopped.\n- `drain` All workloads using this volume should be stopped and rescheduled, and no new ones should be started.\n", + "nullable": false, + "default": "active", + "enum": [ + "active", + "pause", + "drain" + ] + } + }, + "description": "Defines how the volume is used by tasks.\n" + } + }, + "description": "Cluster-specific options used to create the volume.\n" + }, + "Info": { + "type": "object", + "properties": { + "CapacityBytes": { + "type": "integer", + "description": "The capacity of the volume in bytes. A value of 0 indicates that\nthe capacity is unknown.\n", + "format": "int64" + }, + "VolumeContext": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of strings to strings returned from the storage plugin when\nthe volume is created.\n" + }, + "VolumeID": { + "type": "string", + "description": "The ID of the volume as returned by the CSI storage plugin. This\nis distinct from the volume's ID as provided by Docker. This ID\nis never used by the user when communicating with Docker to refer\nto this volume. If the ID is blank, then the Volume has not been\nsuccessfully created in the plugin yet.\n" + }, + "AccessibleTopology": { + "type": "array", + "description": "The topology this volume is actually accessible from.\n", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + } + }, + "description": "Information about the global status of the volume.\n" + }, + "PublishStatus": { + "type": "array", + "description": "The status of the volume as it pertains to its publishing and use on\nspecific nodes\n", + "items": { + "type": "object", + "properties": { + "NodeID": { + "type": "string", + "description": "The ID of the Swarm node the volume is published on.\n" + }, + "State": { + "type": "string", + "description": "The published state of the volume.\n* `pending-publish` The volume should be published to this node, but the call to the controller plugin to do so has not yet been successfully completed.\n* `published` The volume is published successfully to the node.\n* `pending-node-unpublish` The volume should be unpublished from the node, and the manager is awaiting confirmation from the worker that it has done so.\n* `pending-controller-unpublish` The volume is successfully unpublished from the node, but has not yet been successfully unpublished on the controller.\n", + "enum": [ + "pending-publish", + "published", + "pending-node-unpublish", + "pending-controller-unpublish" + ] + }, + "PublishContext": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of strings to strings returned by the CSI controller\nplugin when a volume is published.\n" + } + } + } + } + }, + "description": "Options and information specific to, and only present on, Swarm CSI\ncluster volumes.\n" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "The driver specific options used when creating the volume.\n", + "example": { + "device": "tmpfs", + "o": "size=100m,uid=1000", + "type": "tmpfs" + } + }, + "UsageData": { + "required": [ + "RefCount", + "Size" + ], + "type": "object", + "properties": { + "Size": { + "type": "integer", + "description": "Amount of disk space used by the volume (in bytes). This information\nis only available for volumes created with the `\"local\"` volume\ndriver. For volumes created with other volume drivers, this field\nis set to `-1` (\"not available\")\n", + "format": "int64", + "nullable": false, + "default": -1 + }, + "RefCount": { + "type": "integer", + "description": "The number of containers referencing this volume. This field\nis set to `-1` if the reference-count is not available.\n", + "format": "int64", + "nullable": false, + "default": -1 + } + }, + "description": "Usage details about the volume. This information is used by the\n`GET /system/df` endpoint, and omitted in other endpoints.\n", + "nullable": true, + "x-go-name": "UsageData" + } + } + } + }, + "Warnings": { + "type": "array", + "description": "Warnings that occurred when fetching the list of volumes.\n", + "example": [], + "items": { + "type": "string" + } + } + }, + "description": "Volume list response", + "x-go-name": "ListResponse" + }, + "Network": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the network.\n", + "example": "my_network" + }, + "Id": { + "type": "string", + "description": "ID that uniquely identifies a network on a single machine.\n", + "example": "7d86d31b1478e7cca9ebed7e73aa0fdeec46c5ca29497431d3007d2d9e15ed99" + }, + "Created": { + "type": "string", + "description": "Date and time at which the network was created in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2016-10-19T04:33:30.360899459Z" + }, + "Scope": { + "type": "string", + "description": "The level at which the network exists (e.g. `swarm` for cluster-wide\nor `local` for machine level)\n", + "example": "local" + }, + "Driver": { + "type": "string", + "description": "The name of the driver used to create the network (e.g. `bridge`,\n`overlay`).\n", + "example": "overlay" + }, + "EnableIPv6": { + "type": "boolean", + "description": "Whether the network was created with IPv6 enabled.\n", + "example": false + }, + "IPAM": { + "type": "object", + "properties": { + "Driver": { + "type": "string", + "description": "Name of the IPAM driver to use.", + "example": "default", + "default": "default" + }, + "Config": { + "type": "array", + "description": "List of IPAM configuration options, specified as a map:\n\n```\n{\"Subnet\": , \"IPRange\": , \"Gateway\": , \"AuxAddress\": }\n```\n", + "items": { + "type": "object", + "properties": { + "Subnet": { + "type": "string", + "example": "172.20.0.0/16" + }, + "IPRange": { + "type": "string", + "example": "172.20.10.0/24" + }, + "Gateway": { + "type": "string", + "example": "172.20.10.11" + }, + "AuxiliaryAddresses": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver-specific options, specified as a map.", + "example": { + "foo": "bar" + } + } + } + }, + "Internal": { + "type": "boolean", + "description": "Whether the network is created to only allow internal networking\nconnectivity.\n", + "example": false, + "default": false + }, + "Attachable": { + "type": "boolean", + "description": "Whether a global / swarm scope network is manually attachable by regular\ncontainers from workers in swarm mode.\n", + "example": false, + "default": false + }, + "Ingress": { + "type": "boolean", + "description": "Whether the network is providing the routing-mesh for the swarm cluster.\n", + "example": false, + "default": false + }, + "ConfigFrom": { + "type": "object", + "properties": { + "Network": { + "type": "string", + "description": "The name of the config-only network that provides the network's\nconfiguration. The specified network must be an existing config-only\nnetwork. Only network names are allowed, not network IDs.\n", + "example": "config_only_network_01" + } + }, + "description": "The config-only network source to provide the configuration for\nthis network.\n" + }, + "ConfigOnly": { + "type": "boolean", + "description": "Whether the network is a config-only network. Config-only networks are\nplaceholder networks for network configurations to be used by other\nnetworks. Config-only networks cannot be used directly to run containers\nor services.\n", + "default": false + }, + "Containers": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "example": "container_1" + }, + "EndpointID": { + "type": "string", + "example": "628cadb8bcb92de107b2a1e516cbffe463e321f548feb37697cce00ad694f21a" + }, + "MacAddress": { + "type": "string", + "example": "02:42:ac:13:00:02" + }, + "IPv4Address": { + "type": "string", + "example": "172.19.0.2/16" + }, + "IPv6Address": { + "type": "string", + "example": "" + } + } + }, + "description": "Contains endpoints attached to the network.\n", + "example": { + "19a4d5d687db25203351ed79d478946f861258f018fe384f229f2efa4b23513c": { + "Name": "test", + "EndpointID": "628cadb8bcb92de107b2a1e516cbffe463e321f548feb37697cce00ad694f21a", + "MacAddress": "02:42:ac:13:00:02", + "IPv4Address": "172.19.0.2/16", + "IPv6Address": "" + } + } + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Network-specific options uses when creating the network.\n", + "example": { + "com.docker.network.bridge.default_bridge": "true", + "com.docker.network.bridge.enable_icc": "true", + "com.docker.network.bridge.enable_ip_masquerade": "true", + "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0", + "com.docker.network.bridge.name": "docker0", + "com.docker.network.driver.mtu": "1500" + } + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "Peers": { + "type": "array", + "description": "List of peer nodes for an overlay network. This field is only present\nfor overlay networks, and omitted for other network types.\n", + "nullable": true, + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "ID of the peer-node in the Swarm cluster.", + "example": "6869d7c1732b" + }, + "IP": { + "type": "string", + "description": "IP-address of the peer-node in the Swarm cluster.", + "example": "10.133.77.91" + } + }, + "description": "PeerInfo represents one peer of an overlay network.\n" + } + } + } + }, + "ConfigReference": { + "type": "object", + "properties": { + "Network": { + "type": "string", + "description": "The name of the config-only network that provides the network's\nconfiguration. The specified network must be an existing config-only\nnetwork. Only network names are allowed, not network IDs.\n", + "example": "config_only_network_01" + } + }, + "description": "The config-only network source to provide the configuration for\nthis network.\n" + }, + "IPAM": { + "type": "object", + "properties": { + "Driver": { + "type": "string", + "description": "Name of the IPAM driver to use.", + "example": "default", + "default": "default" + }, + "Config": { + "type": "array", + "description": "List of IPAM configuration options, specified as a map:\n\n```\n{\"Subnet\": , \"IPRange\": , \"Gateway\": , \"AuxAddress\": }\n```\n", + "items": { + "type": "object", + "properties": { + "Subnet": { + "type": "string", + "example": "172.20.0.0/16" + }, + "IPRange": { + "type": "string", + "example": "172.20.10.0/24" + }, + "Gateway": { + "type": "string", + "example": "172.20.10.11" + }, + "AuxiliaryAddresses": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver-specific options, specified as a map.", + "example": { + "foo": "bar" + } + } + } + }, + "IPAMConfig": { + "type": "object", + "properties": { + "Subnet": { + "type": "string", + "example": "172.20.0.0/16" + }, + "IPRange": { + "type": "string", + "example": "172.20.10.0/24" + }, + "Gateway": { + "type": "string", + "example": "172.20.10.11" + }, + "AuxiliaryAddresses": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, + "NetworkContainer": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "example": "container_1" + }, + "EndpointID": { + "type": "string", + "example": "628cadb8bcb92de107b2a1e516cbffe463e321f548feb37697cce00ad694f21a" + }, + "MacAddress": { + "type": "string", + "example": "02:42:ac:13:00:02" + }, + "IPv4Address": { + "type": "string", + "example": "172.19.0.2/16" + }, + "IPv6Address": { + "type": "string", + "example": "" + } + } + }, + "PeerInfo": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "ID of the peer-node in the Swarm cluster.", + "example": "6869d7c1732b" + }, + "IP": { + "type": "string", + "description": "IP-address of the peer-node in the Swarm cluster.", + "example": "10.133.77.91" + } + }, + "description": "PeerInfo represents one peer of an overlay network.\n" + }, + "BuildInfo": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "stream": { + "type": "string" + }, + "error": { + "type": "string" + }, + "errorDetail": { + "type": "object", + "properties": { + "code": { + "type": "integer" + }, + "message": { + "type": "string" + } + } + }, + "status": { + "type": "string" + }, + "progress": { + "type": "string" + }, + "progressDetail": { + "type": "object", + "properties": { + "current": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "aux": { + "type": "object", + "properties": { + "ID": { + "type": "string" + } + }, + "description": "Image ID or Digest", + "example": { + "ID": "sha256:85f05633ddc1c50679be2b16a0479ab6f7637f8884e0cfe0f4d20e1ebb3d6e7c" + } + } + } + }, + "BuildCache": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "Unique ID of the build cache record.\n", + "example": "ndlpt0hhvkqcdfkputsk4cq9c" + }, + "Parent": { + "type": "string", + "description": "ID of the parent build cache record.\n\n> **Deprecated**: This field is deprecated, and omitted if empty.\n", + "nullable": true, + "example": "" + }, + "Parents": { + "type": "array", + "description": "List of parent build cache record IDs.\n", + "nullable": true, + "example": [ + "hw53o5aio51xtltp5xjp8v7fx" + ], + "items": { + "type": "string" + } + }, + "Type": { + "type": "string", + "description": "Cache record type.\n", + "example": "regular", + "enum": [ + "internal", + "frontend", + "source.local", + "source.git.checkout", + "exec.cachemount", + "regular" + ] + }, + "Description": { + "type": "string", + "description": "Description of the build-step that produced the build cache.\n", + "example": "mount / from exec /bin/sh -c echo 'Binary::apt::APT::Keep-Downloaded-Packages \"true\";' > /etc/apt/apt.conf.d/keep-cache" + }, + "InUse": { + "type": "boolean", + "description": "Indicates if the build cache is in use.\n", + "example": false + }, + "Shared": { + "type": "boolean", + "description": "Indicates if the build cache is shared.\n", + "example": true + }, + "Size": { + "type": "integer", + "description": "Amount of disk space used by the build cache (in bytes).\n", + "example": 51 + }, + "CreatedAt": { + "type": "string", + "description": "Date and time at which the build cache was created in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2016-08-18T10:44:24.496525531Z" + }, + "LastUsedAt": { + "type": "string", + "description": "Date and time at which the build cache was last used in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "nullable": true, + "example": "2017-08-09T07:09:37.632105588Z" + }, + "UsageCount": { + "type": "integer", + "example": 26 + } + }, + "description": "BuildCache contains information about a build cache record.\n" + }, + "ImageID": { + "type": "object", + "properties": { + "ID": { + "type": "string" + } + }, + "description": "Image ID or Digest", + "example": { + "ID": "sha256:85f05633ddc1c50679be2b16a0479ab6f7637f8884e0cfe0f4d20e1ebb3d6e7c" + } + }, + "CreateImageInfo": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "error": { + "type": "string" + }, + "errorDetail": { + "type": "object", + "properties": { + "code": { + "type": "integer" + }, + "message": { + "type": "string" + } + } + }, + "status": { + "type": "string" + }, + "progress": { + "type": "string" + }, + "progressDetail": { + "type": "object", + "properties": { + "current": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + } + } + }, + "PushImageInfo": { + "type": "object", + "properties": { + "error": { + "type": "string" + }, + "status": { + "type": "string" + }, + "progress": { + "type": "string" + }, + "progressDetail": { + "type": "object", + "properties": { + "current": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + } + } + }, + "ErrorDetail": { + "type": "object", + "properties": { + "code": { + "type": "integer" + }, + "message": { + "type": "string" + } + } + }, + "ProgressDetail": { + "type": "object", + "properties": { + "current": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "ErrorResponse": { + "required": [ + "message" + ], + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "The error message.", + "nullable": false + } + }, + "description": "Represents an error.", + "example": { + "message": "Something went wrong." + } + }, + "IdResponse": { + "required": [ + "Id" + ], + "type": "object", + "properties": { + "Id": { + "type": "string", + "description": "The id of the newly created object.", + "nullable": false + } + }, + "description": "Response to an API call that returns just an Id" + }, + "EndpointSettings": { + "type": "object", + "properties": { + "IPAMConfig": { + "type": "object", + "properties": { + "IPv4Address": { + "type": "string", + "example": "172.20.30.33" + }, + "IPv6Address": { + "type": "string", + "example": "2001:db8:abcd::3033" + }, + "LinkLocalIPs": { + "type": "array", + "example": [ + "169.254.34.68", + "fe80::3468" + ], + "items": { + "type": "string" + } + } + }, + "description": "EndpointIPAMConfig represents an endpoint's IPAM configuration.\n", + "nullable": true, + "x-nullable": true + }, + "Links": { + "type": "array", + "example": [ + "container_1", + "container_2" + ], + "items": { + "type": "string" + } + }, + "Aliases": { + "type": "array", + "example": [ + "server_x", + "server_y" + ], + "items": { + "type": "string" + } + }, + "NetworkID": { + "type": "string", + "description": "Unique ID of the network.\n", + "example": "08754567f1f40222263eab4102e1c733ae697e8e354aa9cd6e18d7402835292a" + }, + "EndpointID": { + "type": "string", + "description": "Unique ID for the service endpoint in a Sandbox.\n", + "example": "b88f5b905aabf2893f3cbc4ee42d1ea7980bbc0a92e2c8922b1e1795298afb0b" + }, + "Gateway": { + "type": "string", + "description": "Gateway address for this network.\n", + "example": "172.17.0.1" + }, + "IPAddress": { + "type": "string", + "description": "IPv4 address.\n", + "example": "172.17.0.4" + }, + "IPPrefixLen": { + "type": "integer", + "description": "Mask length of the IPv4 address.\n", + "example": 16 + }, + "IPv6Gateway": { + "type": "string", + "description": "IPv6 gateway address.\n", + "example": "2001:db8:2::100" + }, + "GlobalIPv6Address": { + "type": "string", + "description": "Global IPv6 address.\n", + "example": "2001:db8::5689" + }, + "GlobalIPv6PrefixLen": { + "type": "integer", + "description": "Mask length of the global IPv6 address.\n", + "format": "int64", + "example": 64 + }, + "MacAddress": { + "type": "string", + "description": "MAC address for the endpoint on this network.\n", + "example": "02:42:ac:11:00:04" + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "DriverOpts is a mapping of driver options and values. These options\nare passed directly to the driver and are driver specific.\n", + "nullable": true, + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + } + }, + "description": "Configuration for a network endpoint." + }, + "EndpointIPAMConfig": { + "type": "object", + "properties": { + "IPv4Address": { + "type": "string", + "example": "172.20.30.33" + }, + "IPv6Address": { + "type": "string", + "example": "2001:db8:abcd::3033" + }, + "LinkLocalIPs": { + "type": "array", + "example": [ + "169.254.34.68", + "fe80::3468" + ], + "items": { + "type": "string" + } + } + }, + "description": "EndpointIPAMConfig represents an endpoint's IPAM configuration.\n", + "nullable": true, + "x-nullable": true + }, + "PluginMount": { + "required": [ + "Description", + "Destination", + "Name", + "Options", + "Settable", + "Source", + "Type" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false, + "example": "some-mount" + }, + "Description": { + "type": "string", + "nullable": false, + "example": "This is a mount that's used by the plugin." + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Source": { + "type": "string", + "example": "/var/lib/docker/plugins/" + }, + "Destination": { + "type": "string", + "nullable": false, + "example": "/mnt/state" + }, + "Type": { + "type": "string", + "nullable": false, + "example": "bind" + }, + "Options": { + "type": "array", + "example": [ + "rbind", + "rw" + ], + "items": { + "type": "string" + } + } + }, + "nullable": false, + "x-nullable": false + }, + "PluginDevice": { + "required": [ + "Description", + "Name", + "Path", + "Settable" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false + }, + "Description": { + "type": "string", + "nullable": false + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Path": { + "type": "string", + "example": "/dev/fuse" + } + }, + "nullable": false, + "x-nullable": false + }, + "PluginEnv": { + "required": [ + "Description", + "Name", + "Settable", + "Value" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false + }, + "Description": { + "type": "string", + "nullable": false + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Value": { + "type": "string" + } + }, + "nullable": false, + "x-nullable": false + }, + "PluginInterfaceType": { + "required": [ + "Capability", + "Prefix", + "Version" + ], + "type": "object", + "properties": { + "Prefix": { + "type": "string", + "nullable": false + }, + "Capability": { + "type": "string", + "nullable": false + }, + "Version": { + "type": "string", + "nullable": false + } + }, + "nullable": false, + "x-nullable": false + }, + "PluginPrivilege": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "example": "network" + }, + "Description": { + "type": "string" + }, + "Value": { + "type": "array", + "example": [ + "host" + ], + "items": { + "type": "string" + } + } + }, + "description": "Describes a permission the user has to accept upon installing\nthe plugin.\n", + "x-go-name": "PluginPrivilege" + }, + "Plugin": { + "required": [ + "Config", + "Enabled", + "Name", + "Settings" + ], + "type": "object", + "properties": { + "Id": { + "type": "string", + "example": "5724e2c8652da337ab2eedd19fc6fc0ec908e4bd907c7421bf6a8dfc70c4c078" + }, + "Name": { + "type": "string", + "nullable": false, + "example": "tiborvass/sample-volume-plugin" + }, + "Enabled": { + "type": "boolean", + "description": "True if the plugin is running. False if the plugin is not running, only installed.", + "nullable": false, + "example": true + }, + "Settings": { + "required": [ + "Args", + "Devices", + "Env", + "Mounts" + ], + "type": "object", + "properties": { + "Mounts": { + "type": "array", + "items": { + "required": [ + "Description", + "Destination", + "Name", + "Options", + "Settable", + "Source", + "Type" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false, + "example": "some-mount" + }, + "Description": { + "type": "string", + "nullable": false, + "example": "This is a mount that's used by the plugin." + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Source": { + "type": "string", + "example": "/var/lib/docker/plugins/" + }, + "Destination": { + "type": "string", + "nullable": false, + "example": "/mnt/state" + }, + "Type": { + "type": "string", + "nullable": false, + "example": "bind" + }, + "Options": { + "type": "array", + "example": [ + "rbind", + "rw" + ], + "items": { + "type": "string" + } + } + }, + "nullable": false, + "x-nullable": false + } + }, + "Env": { + "type": "array", + "example": [ + "DEBUG=0" + ], + "items": { + "type": "string" + } + }, + "Args": { + "type": "array", + "items": { + "type": "string" + } + }, + "Devices": { + "type": "array", + "items": { + "required": [ + "Description", + "Name", + "Path", + "Settable" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false + }, + "Description": { + "type": "string", + "nullable": false + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Path": { + "type": "string", + "example": "/dev/fuse" + } + }, + "nullable": false, + "x-nullable": false + } + } + }, + "description": "Settings that can be modified by users.", + "nullable": false + }, + "PluginReference": { + "type": "string", + "description": "plugin remote reference used to push/pull the plugin", + "nullable": false, + "example": "localhost:5000/tiborvass/sample-volume-plugin:latest" + }, + "Config": { + "required": [ + "Args", + "Description", + "Documentation", + "Entrypoint", + "Env", + "Interface", + "IpcHost", + "Linux", + "Mounts", + "Network", + "PidHost", + "PropagatedMount", + "WorkDir" + ], + "type": "object", + "properties": { + "DockerVersion": { + "type": "string", + "description": "Docker Version used to create the plugin", + "nullable": false, + "example": "17.06.0-ce" + }, + "Description": { + "type": "string", + "nullable": false, + "example": "A sample volume plugin for Docker" + }, + "Documentation": { + "type": "string", + "nullable": false, + "example": "https://docs.docker.com/engine/extend/plugins/" + }, + "Interface": { + "required": [ + "Socket", + "Types" + ], + "type": "object", + "properties": { + "Types": { + "type": "array", + "example": [ + "docker.volumedriver/1.0" + ], + "items": { + "required": [ + "Capability", + "Prefix", + "Version" + ], + "type": "object", + "properties": { + "Prefix": { + "type": "string", + "nullable": false + }, + "Capability": { + "type": "string", + "nullable": false + }, + "Version": { + "type": "string", + "nullable": false + } + }, + "nullable": false, + "x-nullable": false + } + }, + "Socket": { + "type": "string", + "nullable": false, + "example": "plugins.sock" + }, + "ProtocolScheme": { + "type": "string", + "description": "Protocol to use for clients connecting to the plugin.", + "example": "some.protocol/v1.0", + "enum": [ + "", + "moby.plugins.http/v1" + ] + } + }, + "description": "The interface between Docker and the plugin", + "nullable": false + }, + "Entrypoint": { + "type": "array", + "example": [ + "/usr/bin/sample-volume-plugin", + "/data" + ], + "items": { + "type": "string" + } + }, + "WorkDir": { + "type": "string", + "nullable": false, + "example": "/bin/" + }, + "User": { + "type": "object", + "properties": { + "UID": { + "type": "integer", + "format": "uint32", + "example": 1000 + }, + "GID": { + "type": "integer", + "format": "uint32", + "example": 1000 + } + }, + "nullable": false + }, + "Network": { + "required": [ + "Type" + ], + "type": "object", + "properties": { + "Type": { + "type": "string", + "nullable": false, + "example": "host" + } + }, + "nullable": false + }, + "Linux": { + "required": [ + "AllowAllDevices", + "Capabilities", + "Devices" + ], + "type": "object", + "properties": { + "Capabilities": { + "type": "array", + "example": [ + "CAP_SYS_ADMIN", + "CAP_SYSLOG" + ], + "items": { + "type": "string" + } + }, + "AllowAllDevices": { + "type": "boolean", + "nullable": false, + "example": false + }, + "Devices": { + "type": "array", + "items": { + "required": [ + "Description", + "Name", + "Path", + "Settable" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false + }, + "Description": { + "type": "string", + "nullable": false + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Path": { + "type": "string", + "example": "/dev/fuse" + } + }, + "nullable": false, + "x-nullable": false + } + } + }, + "nullable": false + }, + "PropagatedMount": { + "type": "string", + "nullable": false, + "example": "/mnt/volumes" + }, + "IpcHost": { + "type": "boolean", + "nullable": false, + "example": false + }, + "PidHost": { + "type": "boolean", + "nullable": false, + "example": false + }, + "Mounts": { + "type": "array", + "items": { + "required": [ + "Description", + "Destination", + "Name", + "Options", + "Settable", + "Source", + "Type" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false, + "example": "some-mount" + }, + "Description": { + "type": "string", + "nullable": false, + "example": "This is a mount that's used by the plugin." + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Source": { + "type": "string", + "example": "/var/lib/docker/plugins/" + }, + "Destination": { + "type": "string", + "nullable": false, + "example": "/mnt/state" + }, + "Type": { + "type": "string", + "nullable": false, + "example": "bind" + }, + "Options": { + "type": "array", + "example": [ + "rbind", + "rw" + ], + "items": { + "type": "string" + } + } + }, + "nullable": false, + "x-nullable": false + } + }, + "Env": { + "type": "array", + "example": [ + { + "Name": "DEBUG", + "Description": "If set, prints debug messages", + "Value": "0" + } + ], + "items": { + "required": [ + "Description", + "Name", + "Settable", + "Value" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false + }, + "Description": { + "type": "string", + "nullable": false + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Value": { + "type": "string" + } + }, + "nullable": false, + "x-nullable": false + } + }, + "Args": { + "required": [ + "Description", + "Name", + "Settable", + "Value" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "nullable": false, + "example": "args" + }, + "Description": { + "type": "string", + "nullable": false, + "example": "command line arguments" + }, + "Settable": { + "type": "array", + "items": { + "type": "string" + } + }, + "Value": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "nullable": false + }, + "rootfs": { + "type": "object", + "properties": { + "type": { + "type": "string", + "example": "layers" + }, + "diff_ids": { + "type": "array", + "example": [ + "sha256:675532206fbf3030b8458f88d6e26d4eb1577688a25efec97154c94e8b6b4887", + "sha256:e216a057b1cb1efc11f8a268f37ef62083e70b1b38323ba252e25ac88904a7e8" + ], + "items": { + "type": "string" + } + } + } + } + }, + "description": "The config of a plugin.", + "nullable": false + } + }, + "description": "A plugin for the Engine API" + }, + "ObjectVersion": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "NodeSpec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name for the node.", + "example": "my-node" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "Role": { + "type": "string", + "description": "Role of the node.", + "example": "manager", + "enum": [ + "worker", + "manager" + ] + }, + "Availability": { + "type": "string", + "description": "Availability of the node.", + "example": "active", + "enum": [ + "active", + "pause", + "drain" + ] + } + }, + "example": { + "Availability": "active", + "Name": "node-name", + "Role": "manager", + "Labels": { + "foo": "bar" + } + } + }, + "Node": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "example": "24ifsmvkjbyhk" + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "description": "Date and time at which the node was added to the swarm in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2016-08-18T10:44:24.496525531Z" + }, + "UpdatedAt": { + "type": "string", + "description": "Date and time at which the node was last updated in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2017-08-09T07:09:37.632105588Z" + }, + "Spec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name for the node.", + "example": "my-node" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "Role": { + "type": "string", + "description": "Role of the node.", + "example": "manager", + "enum": [ + "worker", + "manager" + ] + }, + "Availability": { + "type": "string", + "description": "Availability of the node.", + "example": "active", + "enum": [ + "active", + "pause", + "drain" + ] + } + }, + "example": { + "Availability": "active", + "Name": "node-name", + "Role": "manager", + "Labels": { + "foo": "bar" + } + } + }, + "Description": { + "type": "object", + "properties": { + "Hostname": { + "type": "string", + "example": "bf3067039e47" + }, + "Platform": { + "type": "object", + "properties": { + "Architecture": { + "type": "string", + "description": "Architecture represents the hardware architecture (for example,\n`x86_64`).\n", + "example": "x86_64" + }, + "OS": { + "type": "string", + "description": "OS represents the Operating System (for example, `linux` or `windows`).\n", + "example": "linux" + } + }, + "description": "Platform represents the platform (Arch/OS).\n" + }, + "Resources": { + "type": "object", + "properties": { + "NanoCPUs": { + "type": "integer", + "format": "int64", + "example": 4000000000 + }, + "MemoryBytes": { + "type": "integer", + "format": "int64", + "example": 8272408576 + }, + "GenericResources": { + "type": "array", + "description": "User-defined resources can be either Integer resources (e.g, `SSD=3`) or\nString resources (e.g, `GPU=UUID1`).\n", + "example": [ + { + "DiscreteResourceSpec": { + "Kind": "SSD", + "Value": 3 + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID1" + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID2" + } + } + ], + "items": { + "type": "object", + "properties": { + "NamedResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + }, + "DiscreteResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "integer", + "format": "int64" + } + } + } + } + } + } + }, + "description": "An object describing the resources which can be advertised by a node and\nrequested by a task.\n" + }, + "Engine": { + "type": "object", + "properties": { + "EngineVersion": { + "type": "string", + "example": "17.06.0" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "example": { + "foo": "bar" + } + }, + "Plugins": { + "type": "array", + "example": [ + { + "Type": "Log", + "Name": "awslogs" + }, + { + "Type": "Log", + "Name": "fluentd" + }, + { + "Type": "Log", + "Name": "gcplogs" + }, + { + "Type": "Log", + "Name": "gelf" + }, + { + "Type": "Log", + "Name": "journald" + }, + { + "Type": "Log", + "Name": "json-file" + }, + { + "Type": "Log", + "Name": "splunk" + }, + { + "Type": "Log", + "Name": "syslog" + }, + { + "Type": "Network", + "Name": "bridge" + }, + { + "Type": "Network", + "Name": "host" + }, + { + "Type": "Network", + "Name": "ipvlan" + }, + { + "Type": "Network", + "Name": "macvlan" + }, + { + "Type": "Network", + "Name": "null" + }, + { + "Type": "Network", + "Name": "overlay" + }, + { + "Type": "Volume", + "Name": "local" + }, + { + "Type": "Volume", + "Name": "localhost:5000/vieux/sshfs:latest" + }, + { + "Type": "Volume", + "Name": "vieux/sshfs:latest" + } + ], + "items": { + "type": "object", + "properties": { + "Type": { + "type": "string" + }, + "Name": { + "type": "string" + } + } + } + } + }, + "description": "EngineDescription provides information about an engine." + }, + "TLSInfo": { + "type": "object", + "properties": { + "TrustRoot": { + "type": "string", + "description": "The root CA certificate(s) that are used to validate leaf TLS\ncertificates.\n" + }, + "CertIssuerSubject": { + "type": "string", + "description": "The base64-url-safe-encoded raw subject bytes of the issuer." + }, + "CertIssuerPublicKey": { + "type": "string", + "description": "The base64-url-safe-encoded raw public key bytes of the issuer.\n" + } + }, + "description": "Information about the issuer of leaf TLS certificates and the trusted root\nCA certificate.\n", + "example": { + "TrustRoot": "-----BEGIN CERTIFICATE-----\nMIIBajCCARCgAwIBAgIUbYqrLSOSQHoxD8CwG6Bi2PJi9c8wCgYIKoZIzj0EAwIw\nEzERMA8GA1UEAxMIc3dhcm0tY2EwHhcNMTcwNDI0MjE0MzAwWhcNMzcwNDE5MjE0\nMzAwWjATMREwDwYDVQQDEwhzd2FybS1jYTBZMBMGByqGSM49AgEGCCqGSM49AwEH\nA0IABJk/VyMPYdaqDXJb/VXh5n/1Yuv7iNrxV3Qb3l06XD46seovcDWs3IZNV1lf\n3Skyr0ofcchipoiHkXBODojJydSjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMB\nAf8EBTADAQH/MB0GA1UdDgQWBBRUXxuRcnFjDfR/RIAUQab8ZV/n4jAKBggqhkjO\nPQQDAgNIADBFAiAy+JTe6Uc3KyLCMiqGl2GyWGQqQDEcO3/YG36x7om65AIhAJvz\npxv6zFeVEkAEEkqIYi0omA9+CjanB/6Bz4n1uw8H\n-----END CERTIFICATE-----\n", + "CertIssuerSubject": "MBMxETAPBgNVBAMTCHN3YXJtLWNh", + "CertIssuerPublicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEmT9XIw9h1qoNclv9VeHmf/Vi6/uI2vFXdBveXTpcPjqx6i9wNazchk1XWV/dKTKvSh9xyGKmiIeRcE4OiMnJ1A==" + } + } + }, + "description": "NodeDescription encapsulates the properties of the Node as reported by the\nagent.\n" + }, + "Status": { + "type": "object", + "properties": { + "State": { + "type": "string", + "description": "NodeState represents the state of a node.", + "example": "ready", + "enum": [ + "unknown", + "down", + "ready", + "disconnected" + ] + }, + "Message": { + "type": "string", + "example": "" + }, + "Addr": { + "type": "string", + "description": "IP address of the node.", + "example": "172.17.0.2" + } + }, + "description": "NodeStatus represents the status of a node.\n\nIt provides the current status of the node, as seen by the manager.\n" + }, + "ManagerStatus": { + "type": "object", + "properties": { + "Leader": { + "type": "boolean", + "example": true, + "default": false + }, + "Reachability": { + "type": "string", + "description": "Reachability represents the reachability of a node.", + "example": "reachable", + "enum": [ + "unknown", + "unreachable", + "reachable" + ] + }, + "Addr": { + "type": "string", + "description": "The IP address and port at which the manager is reachable.\n", + "example": "10.0.0.46:2377" + } + }, + "description": "ManagerStatus represents the status of a manager.\n\nIt provides the current status of a node's manager component, if the node\nis a manager.\n", + "nullable": true, + "x-nullable": true + } + } + }, + "NodeDescription": { + "type": "object", + "properties": { + "Hostname": { + "type": "string", + "example": "bf3067039e47" + }, + "Platform": { + "type": "object", + "properties": { + "Architecture": { + "type": "string", + "description": "Architecture represents the hardware architecture (for example,\n`x86_64`).\n", + "example": "x86_64" + }, + "OS": { + "type": "string", + "description": "OS represents the Operating System (for example, `linux` or `windows`).\n", + "example": "linux" + } + }, + "description": "Platform represents the platform (Arch/OS).\n" + }, + "Resources": { + "type": "object", + "properties": { + "NanoCPUs": { + "type": "integer", + "format": "int64", + "example": 4000000000 + }, + "MemoryBytes": { + "type": "integer", + "format": "int64", + "example": 8272408576 + }, + "GenericResources": { + "type": "array", + "description": "User-defined resources can be either Integer resources (e.g, `SSD=3`) or\nString resources (e.g, `GPU=UUID1`).\n", + "example": [ + { + "DiscreteResourceSpec": { + "Kind": "SSD", + "Value": 3 + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID1" + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID2" + } + } + ], + "items": { + "type": "object", + "properties": { + "NamedResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + }, + "DiscreteResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "integer", + "format": "int64" + } + } + } + } + } + } + }, + "description": "An object describing the resources which can be advertised by a node and\nrequested by a task.\n" + }, + "Engine": { + "type": "object", + "properties": { + "EngineVersion": { + "type": "string", + "example": "17.06.0" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "example": { + "foo": "bar" + } + }, + "Plugins": { + "type": "array", + "example": [ + { + "Type": "Log", + "Name": "awslogs" + }, + { + "Type": "Log", + "Name": "fluentd" + }, + { + "Type": "Log", + "Name": "gcplogs" + }, + { + "Type": "Log", + "Name": "gelf" + }, + { + "Type": "Log", + "Name": "journald" + }, + { + "Type": "Log", + "Name": "json-file" + }, + { + "Type": "Log", + "Name": "splunk" + }, + { + "Type": "Log", + "Name": "syslog" + }, + { + "Type": "Network", + "Name": "bridge" + }, + { + "Type": "Network", + "Name": "host" + }, + { + "Type": "Network", + "Name": "ipvlan" + }, + { + "Type": "Network", + "Name": "macvlan" + }, + { + "Type": "Network", + "Name": "null" + }, + { + "Type": "Network", + "Name": "overlay" + }, + { + "Type": "Volume", + "Name": "local" + }, + { + "Type": "Volume", + "Name": "localhost:5000/vieux/sshfs:latest" + }, + { + "Type": "Volume", + "Name": "vieux/sshfs:latest" + } + ], + "items": { + "type": "object", + "properties": { + "Type": { + "type": "string" + }, + "Name": { + "type": "string" + } + } + } + } + }, + "description": "EngineDescription provides information about an engine." + }, + "TLSInfo": { + "type": "object", + "properties": { + "TrustRoot": { + "type": "string", + "description": "The root CA certificate(s) that are used to validate leaf TLS\ncertificates.\n" + }, + "CertIssuerSubject": { + "type": "string", + "description": "The base64-url-safe-encoded raw subject bytes of the issuer." + }, + "CertIssuerPublicKey": { + "type": "string", + "description": "The base64-url-safe-encoded raw public key bytes of the issuer.\n" + } + }, + "description": "Information about the issuer of leaf TLS certificates and the trusted root\nCA certificate.\n", + "example": { + "TrustRoot": "-----BEGIN CERTIFICATE-----\nMIIBajCCARCgAwIBAgIUbYqrLSOSQHoxD8CwG6Bi2PJi9c8wCgYIKoZIzj0EAwIw\nEzERMA8GA1UEAxMIc3dhcm0tY2EwHhcNMTcwNDI0MjE0MzAwWhcNMzcwNDE5MjE0\nMzAwWjATMREwDwYDVQQDEwhzd2FybS1jYTBZMBMGByqGSM49AgEGCCqGSM49AwEH\nA0IABJk/VyMPYdaqDXJb/VXh5n/1Yuv7iNrxV3Qb3l06XD46seovcDWs3IZNV1lf\n3Skyr0ofcchipoiHkXBODojJydSjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMB\nAf8EBTADAQH/MB0GA1UdDgQWBBRUXxuRcnFjDfR/RIAUQab8ZV/n4jAKBggqhkjO\nPQQDAgNIADBFAiAy+JTe6Uc3KyLCMiqGl2GyWGQqQDEcO3/YG36x7om65AIhAJvz\npxv6zFeVEkAEEkqIYi0omA9+CjanB/6Bz4n1uw8H\n-----END CERTIFICATE-----\n", + "CertIssuerSubject": "MBMxETAPBgNVBAMTCHN3YXJtLWNh", + "CertIssuerPublicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEmT9XIw9h1qoNclv9VeHmf/Vi6/uI2vFXdBveXTpcPjqx6i9wNazchk1XWV/dKTKvSh9xyGKmiIeRcE4OiMnJ1A==" + } + } + }, + "description": "NodeDescription encapsulates the properties of the Node as reported by the\nagent.\n" + }, + "Platform": { + "type": "object", + "properties": { + "Architecture": { + "type": "string", + "description": "Architecture represents the hardware architecture (for example,\n`x86_64`).\n", + "example": "x86_64" + }, + "OS": { + "type": "string", + "description": "OS represents the Operating System (for example, `linux` or `windows`).\n", + "example": "linux" + } + }, + "description": "Platform represents the platform (Arch/OS).\n" + }, + "EngineDescription": { + "type": "object", + "properties": { + "EngineVersion": { + "type": "string", + "example": "17.06.0" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "example": { + "foo": "bar" + } + }, + "Plugins": { + "type": "array", + "example": [ + { + "Type": "Log", + "Name": "awslogs" + }, + { + "Type": "Log", + "Name": "fluentd" + }, + { + "Type": "Log", + "Name": "gcplogs" + }, + { + "Type": "Log", + "Name": "gelf" + }, + { + "Type": "Log", + "Name": "journald" + }, + { + "Type": "Log", + "Name": "json-file" + }, + { + "Type": "Log", + "Name": "splunk" + }, + { + "Type": "Log", + "Name": "syslog" + }, + { + "Type": "Network", + "Name": "bridge" + }, + { + "Type": "Network", + "Name": "host" + }, + { + "Type": "Network", + "Name": "ipvlan" + }, + { + "Type": "Network", + "Name": "macvlan" + }, + { + "Type": "Network", + "Name": "null" + }, + { + "Type": "Network", + "Name": "overlay" + }, + { + "Type": "Volume", + "Name": "local" + }, + { + "Type": "Volume", + "Name": "localhost:5000/vieux/sshfs:latest" + }, + { + "Type": "Volume", + "Name": "vieux/sshfs:latest" + } + ], + "items": { + "type": "object", + "properties": { + "Type": { + "type": "string" + }, + "Name": { + "type": "string" + } + } + } + } + }, + "description": "EngineDescription provides information about an engine." + }, + "TLSInfo": { + "type": "object", + "properties": { + "TrustRoot": { + "type": "string", + "description": "The root CA certificate(s) that are used to validate leaf TLS\ncertificates.\n" + }, + "CertIssuerSubject": { + "type": "string", + "description": "The base64-url-safe-encoded raw subject bytes of the issuer." + }, + "CertIssuerPublicKey": { + "type": "string", + "description": "The base64-url-safe-encoded raw public key bytes of the issuer.\n" + } + }, + "description": "Information about the issuer of leaf TLS certificates and the trusted root\nCA certificate.\n", + "example": { + "TrustRoot": "-----BEGIN CERTIFICATE-----\nMIIBajCCARCgAwIBAgIUbYqrLSOSQHoxD8CwG6Bi2PJi9c8wCgYIKoZIzj0EAwIw\nEzERMA8GA1UEAxMIc3dhcm0tY2EwHhcNMTcwNDI0MjE0MzAwWhcNMzcwNDE5MjE0\nMzAwWjATMREwDwYDVQQDEwhzd2FybS1jYTBZMBMGByqGSM49AgEGCCqGSM49AwEH\nA0IABJk/VyMPYdaqDXJb/VXh5n/1Yuv7iNrxV3Qb3l06XD46seovcDWs3IZNV1lf\n3Skyr0ofcchipoiHkXBODojJydSjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMB\nAf8EBTADAQH/MB0GA1UdDgQWBBRUXxuRcnFjDfR/RIAUQab8ZV/n4jAKBggqhkjO\nPQQDAgNIADBFAiAy+JTe6Uc3KyLCMiqGl2GyWGQqQDEcO3/YG36x7om65AIhAJvz\npxv6zFeVEkAEEkqIYi0omA9+CjanB/6Bz4n1uw8H\n-----END CERTIFICATE-----\n", + "CertIssuerSubject": "MBMxETAPBgNVBAMTCHN3YXJtLWNh", + "CertIssuerPublicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEmT9XIw9h1qoNclv9VeHmf/Vi6/uI2vFXdBveXTpcPjqx6i9wNazchk1XWV/dKTKvSh9xyGKmiIeRcE4OiMnJ1A==" + } + }, + "NodeStatus": { + "type": "object", + "properties": { + "State": { + "type": "string", + "description": "NodeState represents the state of a node.", + "example": "ready", + "enum": [ + "unknown", + "down", + "ready", + "disconnected" + ] + }, + "Message": { + "type": "string", + "example": "" + }, + "Addr": { + "type": "string", + "description": "IP address of the node.", + "example": "172.17.0.2" + } + }, + "description": "NodeStatus represents the status of a node.\n\nIt provides the current status of the node, as seen by the manager.\n" + }, + "NodeState": { + "type": "string", + "description": "NodeState represents the state of a node.", + "example": "ready", + "enum": [ + "unknown", + "down", + "ready", + "disconnected" + ] + }, + "ManagerStatus": { + "type": "object", + "properties": { + "Leader": { + "type": "boolean", + "example": true, + "default": false + }, + "Reachability": { + "type": "string", + "description": "Reachability represents the reachability of a node.", + "example": "reachable", + "enum": [ + "unknown", + "unreachable", + "reachable" + ] + }, + "Addr": { + "type": "string", + "description": "The IP address and port at which the manager is reachable.\n", + "example": "10.0.0.46:2377" + } + }, + "description": "ManagerStatus represents the status of a manager.\n\nIt provides the current status of a node's manager component, if the node\nis a manager.\n", + "nullable": true, + "x-nullable": true + }, + "Reachability": { + "type": "string", + "description": "Reachability represents the reachability of a node.", + "example": "reachable", + "enum": [ + "unknown", + "unreachable", + "reachable" + ] + }, + "SwarmSpec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the swarm.", + "example": "default" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.corp.type": "production", + "com.example.corp.department": "engineering" + } + }, + "Orchestration": { + "type": "object", + "properties": { + "TaskHistoryRetentionLimit": { + "type": "integer", + "description": "The number of historic tasks to keep per instance or node. If\nnegative, never remove completed or failed tasks.\n", + "format": "int64", + "example": 10 + } + }, + "description": "Orchestration configuration.", + "nullable": true + }, + "Raft": { + "type": "object", + "properties": { + "SnapshotInterval": { + "type": "integer", + "description": "The number of log entries between snapshots.", + "format": "uint64", + "example": 10000 + }, + "KeepOldSnapshots": { + "type": "integer", + "description": "The number of snapshots to keep beyond the current snapshot.\n", + "format": "uint64" + }, + "LogEntriesForSlowFollowers": { + "type": "integer", + "description": "The number of log entries to keep around to sync up slow followers\nafter a snapshot is created.\n", + "format": "uint64", + "example": 500 + }, + "ElectionTick": { + "type": "integer", + "description": "The number of ticks that a follower will wait for a message from\nthe leader before becoming a candidate and starting an election.\n`ElectionTick` must be greater than `HeartbeatTick`.\n\nA tick currently defaults to one second, so these translate\ndirectly to seconds currently, but this is NOT guaranteed.\n", + "example": 3 + }, + "HeartbeatTick": { + "type": "integer", + "description": "The number of ticks between heartbeats. Every HeartbeatTick ticks,\nthe leader will send a heartbeat to the followers.\n\nA tick currently defaults to one second, so these translate\ndirectly to seconds currently, but this is NOT guaranteed.\n", + "example": 1 + } + }, + "description": "Raft configuration." + }, + "Dispatcher": { + "type": "object", + "properties": { + "HeartbeatPeriod": { + "type": "integer", + "description": "The delay for an agent to send a heartbeat to the dispatcher.\n", + "format": "int64", + "example": 5000000000 + } + }, + "description": "Dispatcher configuration.", + "nullable": true + }, + "CAConfig": { + "type": "object", + "properties": { + "NodeCertExpiry": { + "type": "integer", + "description": "The duration node certificates are issued for.", + "format": "int64", + "example": 7776000000000000 + }, + "ExternalCAs": { + "type": "array", + "description": "Configuration for forwarding signing requests to an external\ncertificate authority.\n", + "items": { + "type": "object", + "properties": { + "Protocol": { + "type": "string", + "description": "Protocol for communication with the external CA (currently\nonly `cfssl` is supported).\n", + "default": "cfssl", + "enum": [ + "cfssl" + ] + }, + "URL": { + "type": "string", + "description": "URL where certificate signing requests should be sent.\n" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "An object with key/value pairs that are interpreted as\nprotocol-specific options for the external CA driver.\n" + }, + "CACert": { + "type": "string", + "description": "The root CA certificate (in PEM format) this external CA uses\nto issue TLS certificates (assumed to be to the current swarm\nroot CA certificate if not provided).\n" + } + } + } + }, + "SigningCACert": { + "type": "string", + "description": "The desired signing CA certificate for all swarm node TLS leaf\ncertificates, in PEM format.\n" + }, + "SigningCAKey": { + "type": "string", + "description": "The desired signing CA key for all swarm node TLS leaf certificates,\nin PEM format.\n" + }, + "ForceRotate": { + "type": "integer", + "description": "An integer whose purpose is to force swarm to generate a new\nsigning CA certificate and key, if none have been specified in\n`SigningCACert` and `SigningCAKey`\n", + "format": "uint64" + } + }, + "description": "CA configuration.", + "nullable": true + }, + "EncryptionConfig": { + "type": "object", + "properties": { + "AutoLockManagers": { + "type": "boolean", + "description": "If set, generate a key and use it to lock data stored on the\nmanagers.\n", + "example": false + } + }, + "description": "Parameters related to encryption-at-rest." + }, + "TaskDefaults": { + "type": "object", + "properties": { + "LogDriver": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "The log driver to use as a default for new tasks.\n", + "example": "json-file" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver-specific options for the selected log driver, specified\nas key/value pairs.\n", + "example": { + "max-file": "10", + "max-size": "100m" + } + } + }, + "description": "The log driver to use for tasks created in the orchestrator if\nunspecified by a service.\n\nUpdating this value only affects new tasks. Existing tasks continue\nto use their previously configured log driver until recreated.\n" + } + }, + "description": "Defaults for creating tasks in this cluster." + } + }, + "description": "User modifiable swarm configuration." + }, + "ClusterInfo": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "The ID of the swarm.", + "example": "abajmipo7b4xz5ip2nrla6b11" + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "description": "Date and time at which the swarm was initialised in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2016-08-18T10:44:24.496525531Z" + }, + "UpdatedAt": { + "type": "string", + "description": "Date and time at which the swarm was last updated in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2017-08-09T07:09:37.632105588Z" + }, + "Spec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the swarm.", + "example": "default" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.corp.type": "production", + "com.example.corp.department": "engineering" + } + }, + "Orchestration": { + "type": "object", + "properties": { + "TaskHistoryRetentionLimit": { + "type": "integer", + "description": "The number of historic tasks to keep per instance or node. If\nnegative, never remove completed or failed tasks.\n", + "format": "int64", + "example": 10 + } + }, + "description": "Orchestration configuration.", + "nullable": true + }, + "Raft": { + "type": "object", + "properties": { + "SnapshotInterval": { + "type": "integer", + "description": "The number of log entries between snapshots.", + "format": "uint64", + "example": 10000 + }, + "KeepOldSnapshots": { + "type": "integer", + "description": "The number of snapshots to keep beyond the current snapshot.\n", + "format": "uint64" + }, + "LogEntriesForSlowFollowers": { + "type": "integer", + "description": "The number of log entries to keep around to sync up slow followers\nafter a snapshot is created.\n", + "format": "uint64", + "example": 500 + }, + "ElectionTick": { + "type": "integer", + "description": "The number of ticks that a follower will wait for a message from\nthe leader before becoming a candidate and starting an election.\n`ElectionTick` must be greater than `HeartbeatTick`.\n\nA tick currently defaults to one second, so these translate\ndirectly to seconds currently, but this is NOT guaranteed.\n", + "example": 3 + }, + "HeartbeatTick": { + "type": "integer", + "description": "The number of ticks between heartbeats. Every HeartbeatTick ticks,\nthe leader will send a heartbeat to the followers.\n\nA tick currently defaults to one second, so these translate\ndirectly to seconds currently, but this is NOT guaranteed.\n", + "example": 1 + } + }, + "description": "Raft configuration." + }, + "Dispatcher": { + "type": "object", + "properties": { + "HeartbeatPeriod": { + "type": "integer", + "description": "The delay for an agent to send a heartbeat to the dispatcher.\n", + "format": "int64", + "example": 5000000000 + } + }, + "description": "Dispatcher configuration.", + "nullable": true + }, + "CAConfig": { + "type": "object", + "properties": { + "NodeCertExpiry": { + "type": "integer", + "description": "The duration node certificates are issued for.", + "format": "int64", + "example": 7776000000000000 + }, + "ExternalCAs": { + "type": "array", + "description": "Configuration for forwarding signing requests to an external\ncertificate authority.\n", + "items": { + "type": "object", + "properties": { + "Protocol": { + "type": "string", + "description": "Protocol for communication with the external CA (currently\nonly `cfssl` is supported).\n", + "default": "cfssl", + "enum": [ + "cfssl" + ] + }, + "URL": { + "type": "string", + "description": "URL where certificate signing requests should be sent.\n" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "An object with key/value pairs that are interpreted as\nprotocol-specific options for the external CA driver.\n" + }, + "CACert": { + "type": "string", + "description": "The root CA certificate (in PEM format) this external CA uses\nto issue TLS certificates (assumed to be to the current swarm\nroot CA certificate if not provided).\n" + } + } + } + }, + "SigningCACert": { + "type": "string", + "description": "The desired signing CA certificate for all swarm node TLS leaf\ncertificates, in PEM format.\n" + }, + "SigningCAKey": { + "type": "string", + "description": "The desired signing CA key for all swarm node TLS leaf certificates,\nin PEM format.\n" + }, + "ForceRotate": { + "type": "integer", + "description": "An integer whose purpose is to force swarm to generate a new\nsigning CA certificate and key, if none have been specified in\n`SigningCACert` and `SigningCAKey`\n", + "format": "uint64" + } + }, + "description": "CA configuration.", + "nullable": true + }, + "EncryptionConfig": { + "type": "object", + "properties": { + "AutoLockManagers": { + "type": "boolean", + "description": "If set, generate a key and use it to lock data stored on the\nmanagers.\n", + "example": false + } + }, + "description": "Parameters related to encryption-at-rest." + }, + "TaskDefaults": { + "type": "object", + "properties": { + "LogDriver": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "The log driver to use as a default for new tasks.\n", + "example": "json-file" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver-specific options for the selected log driver, specified\nas key/value pairs.\n", + "example": { + "max-file": "10", + "max-size": "100m" + } + } + }, + "description": "The log driver to use for tasks created in the orchestrator if\nunspecified by a service.\n\nUpdating this value only affects new tasks. Existing tasks continue\nto use their previously configured log driver until recreated.\n" + } + }, + "description": "Defaults for creating tasks in this cluster." + } + }, + "description": "User modifiable swarm configuration." + }, + "TLSInfo": { + "type": "object", + "properties": { + "TrustRoot": { + "type": "string", + "description": "The root CA certificate(s) that are used to validate leaf TLS\ncertificates.\n" + }, + "CertIssuerSubject": { + "type": "string", + "description": "The base64-url-safe-encoded raw subject bytes of the issuer." + }, + "CertIssuerPublicKey": { + "type": "string", + "description": "The base64-url-safe-encoded raw public key bytes of the issuer.\n" + } + }, + "description": "Information about the issuer of leaf TLS certificates and the trusted root\nCA certificate.\n", + "example": { + "TrustRoot": "-----BEGIN CERTIFICATE-----\nMIIBajCCARCgAwIBAgIUbYqrLSOSQHoxD8CwG6Bi2PJi9c8wCgYIKoZIzj0EAwIw\nEzERMA8GA1UEAxMIc3dhcm0tY2EwHhcNMTcwNDI0MjE0MzAwWhcNMzcwNDE5MjE0\nMzAwWjATMREwDwYDVQQDEwhzd2FybS1jYTBZMBMGByqGSM49AgEGCCqGSM49AwEH\nA0IABJk/VyMPYdaqDXJb/VXh5n/1Yuv7iNrxV3Qb3l06XD46seovcDWs3IZNV1lf\n3Skyr0ofcchipoiHkXBODojJydSjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMB\nAf8EBTADAQH/MB0GA1UdDgQWBBRUXxuRcnFjDfR/RIAUQab8ZV/n4jAKBggqhkjO\nPQQDAgNIADBFAiAy+JTe6Uc3KyLCMiqGl2GyWGQqQDEcO3/YG36x7om65AIhAJvz\npxv6zFeVEkAEEkqIYi0omA9+CjanB/6Bz4n1uw8H\n-----END CERTIFICATE-----\n", + "CertIssuerSubject": "MBMxETAPBgNVBAMTCHN3YXJtLWNh", + "CertIssuerPublicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEmT9XIw9h1qoNclv9VeHmf/Vi6/uI2vFXdBveXTpcPjqx6i9wNazchk1XWV/dKTKvSh9xyGKmiIeRcE4OiMnJ1A==" + } + }, + "RootRotationInProgress": { + "type": "boolean", + "description": "Whether there is currently a root CA rotation in progress for the swarm\n", + "example": false + }, + "DataPathPort": { + "type": "integer", + "description": "DataPathPort specifies the data path port number for data traffic.\nAcceptable port range is 1024 to 49151.\nIf no port is set or is set to 0, the default port (4789) is used.\n", + "format": "uint32", + "example": 4789 + }, + "DefaultAddrPool": { + "type": "array", + "description": "Default Address Pool specifies default subnet pools for global scope\nnetworks.\n", + "items": { + "type": "string", + "format": "CIDR", + "example": "" + } + }, + "SubnetSize": { + "maximum": 29, + "type": "integer", + "description": "SubnetSize specifies the subnet size of the networks created from the\ndefault subnet pool.\n", + "format": "uint32", + "example": 24 + } + }, + "description": "ClusterInfo represents information about the swarm as is returned by the\n\"/info\" endpoint. Join-tokens are not included.\n", + "nullable": true, + "x-nullable": true + }, + "JoinTokens": { + "type": "object", + "properties": { + "Worker": { + "type": "string", + "description": "The token workers can use to join the swarm.\n", + "example": "SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-1awxwuwd3z9j1z3puu7rcgdbx" + }, + "Manager": { + "type": "string", + "description": "The token managers can use to join the swarm.\n", + "example": "SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-7p73s1dx5in4tatdymyhg9hu2" + } + }, + "description": "JoinTokens contains the tokens workers and managers need to join the swarm.\n" + }, + "Swarm": { + "allOf": [ + { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "The ID of the swarm.", + "example": "abajmipo7b4xz5ip2nrla6b11" + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "description": "Date and time at which the swarm was initialised in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2016-08-18T10:44:24.496525531Z" + }, + "UpdatedAt": { + "type": "string", + "description": "Date and time at which the swarm was last updated in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2017-08-09T07:09:37.632105588Z" + }, + "Spec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the swarm.", + "example": "default" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.corp.type": "production", + "com.example.corp.department": "engineering" + } + }, + "Orchestration": { + "type": "object", + "properties": { + "TaskHistoryRetentionLimit": { + "type": "integer", + "description": "The number of historic tasks to keep per instance or node. If\nnegative, never remove completed or failed tasks.\n", + "format": "int64", + "example": 10 + } + }, + "description": "Orchestration configuration.", + "nullable": true + }, + "Raft": { + "type": "object", + "properties": { + "SnapshotInterval": { + "type": "integer", + "description": "The number of log entries between snapshots.", + "format": "uint64", + "example": 10000 + }, + "KeepOldSnapshots": { + "type": "integer", + "description": "The number of snapshots to keep beyond the current snapshot.\n", + "format": "uint64" + }, + "LogEntriesForSlowFollowers": { + "type": "integer", + "description": "The number of log entries to keep around to sync up slow followers\nafter a snapshot is created.\n", + "format": "uint64", + "example": 500 + }, + "ElectionTick": { + "type": "integer", + "description": "The number of ticks that a follower will wait for a message from\nthe leader before becoming a candidate and starting an election.\n`ElectionTick` must be greater than `HeartbeatTick`.\n\nA tick currently defaults to one second, so these translate\ndirectly to seconds currently, but this is NOT guaranteed.\n", + "example": 3 + }, + "HeartbeatTick": { + "type": "integer", + "description": "The number of ticks between heartbeats. Every HeartbeatTick ticks,\nthe leader will send a heartbeat to the followers.\n\nA tick currently defaults to one second, so these translate\ndirectly to seconds currently, but this is NOT guaranteed.\n", + "example": 1 + } + }, + "description": "Raft configuration." + }, + "Dispatcher": { + "type": "object", + "properties": { + "HeartbeatPeriod": { + "type": "integer", + "description": "The delay for an agent to send a heartbeat to the dispatcher.\n", + "format": "int64", + "example": 5000000000 + } + }, + "description": "Dispatcher configuration.", + "nullable": true + }, + "CAConfig": { + "type": "object", + "properties": { + "NodeCertExpiry": { + "type": "integer", + "description": "The duration node certificates are issued for.", + "format": "int64", + "example": 7776000000000000 + }, + "ExternalCAs": { + "type": "array", + "description": "Configuration for forwarding signing requests to an external\ncertificate authority.\n", + "items": { + "type": "object", + "properties": { + "Protocol": { + "type": "string", + "description": "Protocol for communication with the external CA (currently\nonly `cfssl` is supported).\n", + "default": "cfssl", + "enum": [ + "cfssl" + ] + }, + "URL": { + "type": "string", + "description": "URL where certificate signing requests should be sent.\n" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "An object with key/value pairs that are interpreted as\nprotocol-specific options for the external CA driver.\n" + }, + "CACert": { + "type": "string", + "description": "The root CA certificate (in PEM format) this external CA uses\nto issue TLS certificates (assumed to be to the current swarm\nroot CA certificate if not provided).\n" + } + } + } + }, + "SigningCACert": { + "type": "string", + "description": "The desired signing CA certificate for all swarm node TLS leaf\ncertificates, in PEM format.\n" + }, + "SigningCAKey": { + "type": "string", + "description": "The desired signing CA key for all swarm node TLS leaf certificates,\nin PEM format.\n" + }, + "ForceRotate": { + "type": "integer", + "description": "An integer whose purpose is to force swarm to generate a new\nsigning CA certificate and key, if none have been specified in\n`SigningCACert` and `SigningCAKey`\n", + "format": "uint64" + } + }, + "description": "CA configuration.", + "nullable": true + }, + "EncryptionConfig": { + "type": "object", + "properties": { + "AutoLockManagers": { + "type": "boolean", + "description": "If set, generate a key and use it to lock data stored on the\nmanagers.\n", + "example": false + } + }, + "description": "Parameters related to encryption-at-rest." + }, + "TaskDefaults": { + "type": "object", + "properties": { + "LogDriver": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "The log driver to use as a default for new tasks.\n", + "example": "json-file" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver-specific options for the selected log driver, specified\nas key/value pairs.\n", + "example": { + "max-file": "10", + "max-size": "100m" + } + } + }, + "description": "The log driver to use for tasks created in the orchestrator if\nunspecified by a service.\n\nUpdating this value only affects new tasks. Existing tasks continue\nto use their previously configured log driver until recreated.\n" + } + }, + "description": "Defaults for creating tasks in this cluster." + } + }, + "description": "User modifiable swarm configuration." + }, + "TLSInfo": { + "type": "object", + "properties": { + "TrustRoot": { + "type": "string", + "description": "The root CA certificate(s) that are used to validate leaf TLS\ncertificates.\n" + }, + "CertIssuerSubject": { + "type": "string", + "description": "The base64-url-safe-encoded raw subject bytes of the issuer." + }, + "CertIssuerPublicKey": { + "type": "string", + "description": "The base64-url-safe-encoded raw public key bytes of the issuer.\n" + } + }, + "description": "Information about the issuer of leaf TLS certificates and the trusted root\nCA certificate.\n", + "example": { + "TrustRoot": "-----BEGIN CERTIFICATE-----\nMIIBajCCARCgAwIBAgIUbYqrLSOSQHoxD8CwG6Bi2PJi9c8wCgYIKoZIzj0EAwIw\nEzERMA8GA1UEAxMIc3dhcm0tY2EwHhcNMTcwNDI0MjE0MzAwWhcNMzcwNDE5MjE0\nMzAwWjATMREwDwYDVQQDEwhzd2FybS1jYTBZMBMGByqGSM49AgEGCCqGSM49AwEH\nA0IABJk/VyMPYdaqDXJb/VXh5n/1Yuv7iNrxV3Qb3l06XD46seovcDWs3IZNV1lf\n3Skyr0ofcchipoiHkXBODojJydSjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMB\nAf8EBTADAQH/MB0GA1UdDgQWBBRUXxuRcnFjDfR/RIAUQab8ZV/n4jAKBggqhkjO\nPQQDAgNIADBFAiAy+JTe6Uc3KyLCMiqGl2GyWGQqQDEcO3/YG36x7om65AIhAJvz\npxv6zFeVEkAEEkqIYi0omA9+CjanB/6Bz4n1uw8H\n-----END CERTIFICATE-----\n", + "CertIssuerSubject": "MBMxETAPBgNVBAMTCHN3YXJtLWNh", + "CertIssuerPublicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEmT9XIw9h1qoNclv9VeHmf/Vi6/uI2vFXdBveXTpcPjqx6i9wNazchk1XWV/dKTKvSh9xyGKmiIeRcE4OiMnJ1A==" + } + }, + "RootRotationInProgress": { + "type": "boolean", + "description": "Whether there is currently a root CA rotation in progress for the swarm\n", + "example": false + }, + "DataPathPort": { + "type": "integer", + "description": "DataPathPort specifies the data path port number for data traffic.\nAcceptable port range is 1024 to 49151.\nIf no port is set or is set to 0, the default port (4789) is used.\n", + "format": "uint32", + "example": 4789 + }, + "DefaultAddrPool": { + "type": "array", + "description": "Default Address Pool specifies default subnet pools for global scope\nnetworks.\n", + "items": { + "type": "string", + "format": "CIDR", + "example": "" + } + }, + "SubnetSize": { + "maximum": 29, + "type": "integer", + "description": "SubnetSize specifies the subnet size of the networks created from the\ndefault subnet pool.\n", + "format": "uint32", + "example": 24 + } + }, + "description": "ClusterInfo represents information about the swarm as is returned by the\n\"/info\" endpoint. Join-tokens are not included.\n", + "nullable": true, + "x-nullable": true + }, + { + "type": "object", + "properties": { + "JoinTokens": { + "type": "object", + "properties": { + "Worker": { + "type": "string", + "description": "The token workers can use to join the swarm.\n", + "example": "SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-1awxwuwd3z9j1z3puu7rcgdbx" + }, + "Manager": { + "type": "string", + "description": "The token managers can use to join the swarm.\n", + "example": "SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-7p73s1dx5in4tatdymyhg9hu2" + } + }, + "description": "JoinTokens contains the tokens workers and managers need to join the swarm.\n" + } + } + } + ] + }, + "TaskSpec": { + "type": "object", + "properties": { + "PluginSpec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "The name or 'alias' to use for the plugin." + }, + "Remote": { + "type": "string", + "description": "The plugin image reference to use." + }, + "Disabled": { + "type": "boolean", + "description": "Disable the plugin once scheduled." + }, + "PluginPrivilege": { + "type": "array", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "example": "network" + }, + "Description": { + "type": "string" + }, + "Value": { + "type": "array", + "example": [ + "host" + ], + "items": { + "type": "string" + } + } + }, + "description": "Describes a permission the user has to accept upon installing\nthe plugin.\n", + "x-go-name": "PluginPrivilege" + } + } + }, + "description": "Plugin spec for the service. *(Experimental release only.)*\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "ContainerSpec": { + "type": "object", + "properties": { + "Image": { + "type": "string", + "description": "The image name to use for the container" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value data." + }, + "Command": { + "type": "array", + "description": "The command to be run in the image.", + "items": { + "type": "string" + } + }, + "Args": { + "type": "array", + "description": "Arguments to the command.", + "items": { + "type": "string" + } + }, + "Hostname": { + "type": "string", + "description": "The hostname to use for the container, as a valid\n[RFC 1123](https://tools.ietf.org/html/rfc1123) hostname.\n" + }, + "Env": { + "type": "array", + "description": "A list of environment variables in the form `VAR=value`.\n", + "items": { + "type": "string" + } + }, + "Dir": { + "type": "string", + "description": "The working directory for commands to run in." + }, + "User": { + "type": "string", + "description": "The user inside the container." + }, + "Groups": { + "type": "array", + "description": "A list of additional groups that the container process will run as.\n", + "items": { + "type": "string" + } + }, + "Privileges": { + "type": "object", + "properties": { + "CredentialSpec": { + "type": "object", + "properties": { + "Config": { + "type": "string", + "description": "Load credential spec from a Swarm Config with the given ID.\nThe specified config must also be present in the Configs\nfield with the Runtime property set.\n\n


\n\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n", + "example": "0bt9dmxjvjiqermk6xrop3ekq" + }, + "File": { + "type": "string", + "description": "Load credential spec from this file. The file is read by\nthe daemon, and must be present in the `CredentialSpecs`\nsubdirectory in the docker data directory, which defaults\nto `C:\\ProgramData\\Docker\\` on Windows.\n\nFor example, specifying `spec.json` loads\n`C:\\ProgramData\\Docker\\CredentialSpecs\\spec.json`.\n\n


\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n", + "example": "spec.json" + }, + "Registry": { + "type": "string", + "description": "Load credential spec from this value in the Windows\nregistry. The specified registry value must be located in:\n\n`HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Virtualization\\Containers\\CredentialSpecs`\n\n


\n\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n" + } + }, + "description": "CredentialSpec for managed service account (Windows only)" + }, + "SELinuxContext": { + "type": "object", + "properties": { + "Disable": { + "type": "boolean", + "description": "Disable SELinux" + }, + "User": { + "type": "string", + "description": "SELinux user label" + }, + "Role": { + "type": "string", + "description": "SELinux role label" + }, + "Type": { + "type": "string", + "description": "SELinux type label" + }, + "Level": { + "type": "string", + "description": "SELinux level label" + } + }, + "description": "SELinux labels of the container" + } + }, + "description": "Security options for the container" + }, + "TTY": { + "type": "boolean", + "description": "Whether a pseudo-TTY should be allocated." + }, + "OpenStdin": { + "type": "boolean", + "description": "Open `stdin`" + }, + "ReadOnly": { + "type": "boolean", + "description": "Mount the container's root filesystem as read only." + }, + "Mounts": { + "type": "array", + "description": "Specification for mounts to be added to containers created as part\nof the service.\n", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "Container path." + }, + "Source": { + "type": "string", + "description": "Mount source (e.g. a volume name, a host path)." + }, + "Type": { + "type": "string", + "description": "The mount type. Available types:\n\n- `bind` Mounts a file or directory from the host into the container. Must exist prior to creating the container.\n- `volume` Creates a volume with the given name and options (or uses a pre-existing volume with the same name and options). These are **not** removed when the container is removed.\n- `tmpfs` Create a tmpfs with the given options. The mount source cannot be specified for tmpfs.\n- `npipe` Mounts a named pipe from the host into the container. Must exist prior to creating the container.\n- `cluster` a Swarm cluster volume\n", + "enum": [ + "bind", + "volume", + "tmpfs", + "npipe", + "cluster" + ] + }, + "ReadOnly": { + "type": "boolean", + "description": "Whether the mount should be read-only." + }, + "Consistency": { + "type": "string", + "description": "The consistency requirement for the mount: `default`, `consistent`, `cached`, or `delegated`." + }, + "BindOptions": { + "type": "object", + "properties": { + "Propagation": { + "type": "string", + "description": "A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`.", + "enum": [ + "private", + "rprivate", + "shared", + "rshared", + "slave", + "rslave" + ] + }, + "NonRecursive": { + "type": "boolean", + "description": "Disable recursive bind mount.", + "default": false + }, + "CreateMountpoint": { + "type": "boolean", + "description": "Create mount point on host if missing", + "default": false + } + }, + "description": "Optional configuration for the `bind` type." + }, + "VolumeOptions": { + "type": "object", + "properties": { + "NoCopy": { + "type": "boolean", + "description": "Populate volume with data from the target.", + "default": false + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "DriverConfig": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver to use to create the volume." + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "key/value map of driver specific options." + } + }, + "description": "Map of driver specific options" + } + }, + "description": "Optional configuration for the `volume` type." + }, + "TmpfsOptions": { + "type": "object", + "properties": { + "SizeBytes": { + "type": "integer", + "description": "The size for the tmpfs mount in bytes.", + "format": "int64" + }, + "Mode": { + "type": "integer", + "description": "The permission mode for the tmpfs mount in an integer." + } + }, + "description": "Optional configuration for the `tmpfs` type." + } + } + } + }, + "StopSignal": { + "type": "string", + "description": "Signal to stop the container." + }, + "StopGracePeriod": { + "type": "integer", + "description": "Amount of time to wait for the container to terminate before\nforcefully killing it.\n", + "format": "int64" + }, + "HealthCheck": { + "type": "object", + "properties": { + "Test": { + "type": "array", + "description": "The test to perform. Possible values are:\n\n- `[]` inherit healthcheck from image or parent image\n- `[\"NONE\"]` disable healthcheck\n- `[\"CMD\", args...]` exec arguments directly\n- `[\"CMD-SHELL\", command]` run command with system's default shell\n", + "items": { + "type": "string" + } + }, + "Interval": { + "type": "integer", + "description": "The time to wait between checks in nanoseconds. It should be 0 or at\nleast 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Timeout": { + "type": "integer", + "description": "The time to wait before considering the check to have hung. It should\nbe 0 or at least 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Retries": { + "type": "integer", + "description": "The number of consecutive failures needed to consider a container as\nunhealthy. 0 means inherit.\n" + }, + "StartPeriod": { + "type": "integer", + "description": "Start period for the container to initialize before starting\nhealth-retries countdown in nanoseconds. It should be 0 or at least\n1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + } + }, + "description": "A test to perform to check that the container is healthy." + }, + "Hosts": { + "type": "array", + "description": "A list of hostname/IP mappings to add to the container's `hosts`\nfile. The format of extra hosts is specified in the\n[hosts(5)](http://man7.org/linux/man-pages/man5/hosts.5.html)\nman page:\n\n IP_address canonical_hostname [aliases...]\n", + "items": { + "type": "string" + } + }, + "DNSConfig": { + "type": "object", + "properties": { + "Nameservers": { + "type": "array", + "description": "The IP addresses of the name servers.", + "items": { + "type": "string" + } + }, + "Search": { + "type": "array", + "description": "A search list for host-name lookup.", + "items": { + "type": "string" + } + }, + "Options": { + "type": "array", + "description": "A list of internal resolver variables to be modified (e.g.,\n`debug`, `ndots:3`, etc.).\n", + "items": { + "type": "string" + } + } + }, + "description": "Specification for DNS related configurations in resolver configuration\nfile (`resolv.conf`).\n" + }, + "Secrets": { + "type": "array", + "description": "Secrets contains references to zero or more secrets that will be\nexposed to the service.\n", + "items": { + "type": "object", + "properties": { + "File": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name represents the final filename in the filesystem.\n" + }, + "UID": { + "type": "string", + "description": "UID represents the file UID." + }, + "GID": { + "type": "string", + "description": "GID represents the file GID." + }, + "Mode": { + "type": "integer", + "description": "Mode represents the FileMode of the file.", + "format": "uint32" + } + }, + "description": "File represents a specific target that is backed by a file.\n" + }, + "SecretID": { + "type": "string", + "description": "SecretID represents the ID of the specific secret that we're\nreferencing.\n" + }, + "SecretName": { + "type": "string", + "description": "SecretName is the name of the secret that this references,\nbut this is just provided for lookup/display purposes. The\nsecret in the reference will be identified by its ID.\n" + } + } + } + }, + "Configs": { + "type": "array", + "description": "Configs contains references to zero or more configs that will be\nexposed to the service.\n", + "items": { + "type": "object", + "properties": { + "File": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name represents the final filename in the filesystem.\n" + }, + "UID": { + "type": "string", + "description": "UID represents the file UID." + }, + "GID": { + "type": "string", + "description": "GID represents the file GID." + }, + "Mode": { + "type": "integer", + "description": "Mode represents the FileMode of the file.", + "format": "uint32" + } + }, + "description": "File represents a specific target that is backed by a file.\n\n


\n\n> **Note**: `Configs.File` and `Configs.Runtime` are mutually exclusive\n" + }, + "Runtime": { + "type": "object", + "properties": {}, + "description": "Runtime represents a target that is not mounted into the\ncontainer but is used by the task\n\n


\n\n> **Note**: `Configs.File` and `Configs.Runtime` are mutually\n> exclusive\n" + }, + "ConfigID": { + "type": "string", + "description": "ConfigID represents the ID of the specific config that we're\nreferencing.\n" + }, + "ConfigName": { + "type": "string", + "description": "ConfigName is the name of the config that this references,\nbut this is just provided for lookup/display purposes. The\nconfig in the reference will be identified by its ID.\n" + } + } + } + }, + "Isolation": { + "type": "string", + "description": "Isolation technology of the containers running the service.\n(Windows only)\n", + "enum": [ + "default", + "process", + "hyperv", + "" + ] + }, + "Init": { + "type": "boolean", + "description": "Run an init inside the container that forwards signals and reaps\nprocesses. This field is omitted if empty, and the default (as\nconfigured on the daemon) is used.\n", + "nullable": true + }, + "Sysctls": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Set kernel namedspaced parameters (sysctls) in the container.\nThe Sysctls option on services accepts the same sysctls as the\nare supported on containers. Note that while the same sysctls are\nsupported, no guarantees or checks are made about their\nsuitability for a clustered environment, and it's up to the user\nto determine whether a given sysctl will work properly in a\nService.\n" + }, + "CapabilityAdd": { + "type": "array", + "description": "A list of kernel capabilities to add to the default set\nfor the container.\n", + "example": [ + "CAP_NET_RAW", + "CAP_SYS_ADMIN", + "CAP_SYS_CHROOT", + "CAP_SYSLOG" + ], + "items": { + "type": "string" + } + }, + "CapabilityDrop": { + "type": "array", + "description": "A list of kernel capabilities to drop from the default set\nfor the container.\n", + "example": [ + "CAP_NET_RAW" + ], + "items": { + "type": "string" + } + }, + "Ulimits": { + "type": "array", + "description": "A list of resource limits to set in the container. For example: `{\"Name\": \"nofile\", \"Soft\": 1024, \"Hard\": 2048}`\"\n", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of ulimit" + }, + "Soft": { + "type": "integer", + "description": "Soft limit" + }, + "Hard": { + "type": "integer", + "description": "Hard limit" + } + } + } + } + }, + "description": "Container spec for the service.\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "NetworkAttachmentSpec": { + "type": "object", + "properties": { + "ContainerID": { + "type": "string", + "description": "ID of the container represented by this task" + } + }, + "description": "Read-only spec type for non-swarm containers attached to swarm overlay\nnetworks.\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "Resources": { + "type": "object", + "properties": { + "Limits": { + "type": "object", + "properties": { + "NanoCPUs": { + "type": "integer", + "format": "int64", + "example": 4000000000 + }, + "MemoryBytes": { + "type": "integer", + "format": "int64", + "example": 8272408576 + }, + "Pids": { + "type": "integer", + "description": "Limits the maximum number of PIDs in the container. Set `0` for unlimited.\n", + "format": "int64", + "example": 100, + "default": 0 + } + }, + "description": "An object describing a limit on resources which can be requested by a task.\n" + }, + "Reservations": { + "type": "object", + "properties": { + "NanoCPUs": { + "type": "integer", + "format": "int64", + "example": 4000000000 + }, + "MemoryBytes": { + "type": "integer", + "format": "int64", + "example": 8272408576 + }, + "GenericResources": { + "type": "array", + "description": "User-defined resources can be either Integer resources (e.g, `SSD=3`) or\nString resources (e.g, `GPU=UUID1`).\n", + "example": [ + { + "DiscreteResourceSpec": { + "Kind": "SSD", + "Value": 3 + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID1" + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID2" + } + } + ], + "items": { + "type": "object", + "properties": { + "NamedResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + }, + "DiscreteResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "integer", + "format": "int64" + } + } + } + } + } + } + }, + "description": "An object describing the resources which can be advertised by a node and\nrequested by a task.\n" + } + }, + "description": "Resource requirements which apply to each individual container created\nas part of the service.\n" + }, + "RestartPolicy": { + "type": "object", + "properties": { + "Condition": { + "type": "string", + "description": "Condition for restart.", + "enum": [ + "none", + "on-failure", + "any" + ] + }, + "Delay": { + "type": "integer", + "description": "Delay between restart attempts.", + "format": "int64" + }, + "MaxAttempts": { + "type": "integer", + "description": "Maximum attempts to restart a given container before giving up\n(default value is 0, which is ignored).\n", + "format": "int64", + "default": 0 + }, + "Window": { + "type": "integer", + "description": "Windows is the time window used to evaluate the restart policy\n(default value is 0, which is unbounded).\n", + "format": "int64", + "default": 0 + } + }, + "description": "Specification for the restart policy which applies to containers\ncreated as part of this service.\n" + }, + "Placement": { + "type": "object", + "properties": { + "Constraints": { + "type": "array", + "description": "An array of constraint expressions to limit the set of nodes where\na task can be scheduled. Constraint expressions can either use a\n_match_ (`==`) or _exclude_ (`!=`) rule. Multiple constraints find\nnodes that satisfy every expression (AND match). Constraints can\nmatch node or Docker Engine labels as follows:\n\nnode attribute | matches | example\n---------------------|--------------------------------|-----------------------------------------------\n`node.id` | Node ID | `node.id==2ivku8v2gvtg4`\n`node.hostname` | Node hostname | `node.hostname!=node-2`\n`node.role` | Node role (`manager`/`worker`) | `node.role==manager`\n`node.platform.os` | Node operating system | `node.platform.os==windows`\n`node.platform.arch` | Node architecture | `node.platform.arch==x86_64`\n`node.labels` | User-defined node labels | `node.labels.security==high`\n`engine.labels` | Docker Engine's labels | `engine.labels.operatingsystem==ubuntu-14.04`\n\n`engine.labels` apply to Docker Engine labels like operating system,\ndrivers, etc. Swarm administrators add `node.labels` for operational\npurposes by using the [`node update endpoint`](#operation/NodeUpdate).\n", + "example": [ + "node.hostname!=node3.corp.example.com", + "node.role!=manager", + "node.labels.type==production", + "node.platform.os==linux", + "node.platform.arch==x86_64" + ], + "items": { + "type": "string" + } + }, + "Preferences": { + "type": "array", + "description": "Preferences provide a way to make the scheduler aware of factors\nsuch as topology. They are provided in order from highest to\nlowest precedence.\n", + "example": [ + { + "Spread": { + "SpreadDescriptor": "node.labels.datacenter" + } + }, + { + "Spread": { + "SpreadDescriptor": "node.labels.rack" + } + } + ], + "items": { + "type": "object", + "properties": { + "Spread": { + "type": "object", + "properties": { + "SpreadDescriptor": { + "type": "string", + "description": "label descriptor, such as `engine.labels.az`.\n" + } + } + } + } + } + }, + "MaxReplicas": { + "type": "integer", + "description": "Maximum number of replicas for per node (default value is 0, which\nis unlimited)\n", + "format": "int64", + "default": 0 + }, + "Platforms": { + "type": "array", + "description": "Platforms stores all the platforms that the service's image can\nrun on. This field is used in the platform filter for scheduling.\nIf empty, then the platform filter is off, meaning there are no\nscheduling restrictions.\n", + "items": { + "type": "object", + "properties": { + "Architecture": { + "type": "string", + "description": "Architecture represents the hardware architecture (for example,\n`x86_64`).\n", + "example": "x86_64" + }, + "OS": { + "type": "string", + "description": "OS represents the Operating System (for example, `linux` or `windows`).\n", + "example": "linux" + } + }, + "description": "Platform represents the platform (Arch/OS).\n" + } + } + } + }, + "ForceUpdate": { + "type": "integer", + "description": "A counter that triggers an update even if no relevant parameters have\nbeen changed.\n" + }, + "Runtime": { + "type": "string", + "description": "Runtime is the type of runtime specified for the task executor.\n" + }, + "Networks": { + "type": "array", + "description": "Specifies which networks the service should attach to.", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "The target network for attachment. Must be a network name or ID.\n" + }, + "Aliases": { + "type": "array", + "description": "Discoverable alternate names for the service on this network.\n", + "items": { + "type": "string" + } + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver attachment options for the network target.\n" + } + }, + "description": "Specifies how a service should be attached to a particular network.\n" + } + }, + "LogDriver": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "description": "Specifies the log driver to use for tasks created from this spec. If\nnot present, the default one for the swarm will be used, finally\nfalling back to the engine default if not specified.\n" + } + }, + "description": "User modifiable task configuration." + }, + "TaskState": { + "type": "string", + "enum": [ + "new", + "allocated", + "pending", + "assigned", + "accepted", + "preparing", + "ready", + "starting", + "running", + "complete", + "shutdown", + "failed", + "rejected", + "remove", + "orphaned" + ] + }, + "Task": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "The ID of the task." + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "format": "dateTime" + }, + "UpdatedAt": { + "type": "string", + "format": "dateTime" + }, + "Name": { + "type": "string", + "description": "Name of the task." + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "Spec": { + "type": "object", + "properties": { + "PluginSpec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "The name or 'alias' to use for the plugin." + }, + "Remote": { + "type": "string", + "description": "The plugin image reference to use." + }, + "Disabled": { + "type": "boolean", + "description": "Disable the plugin once scheduled." + }, + "PluginPrivilege": { + "type": "array", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "example": "network" + }, + "Description": { + "type": "string" + }, + "Value": { + "type": "array", + "example": [ + "host" + ], + "items": { + "type": "string" + } + } + }, + "description": "Describes a permission the user has to accept upon installing\nthe plugin.\n", + "x-go-name": "PluginPrivilege" + } + } + }, + "description": "Plugin spec for the service. *(Experimental release only.)*\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "ContainerSpec": { + "type": "object", + "properties": { + "Image": { + "type": "string", + "description": "The image name to use for the container" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value data." + }, + "Command": { + "type": "array", + "description": "The command to be run in the image.", + "items": { + "type": "string" + } + }, + "Args": { + "type": "array", + "description": "Arguments to the command.", + "items": { + "type": "string" + } + }, + "Hostname": { + "type": "string", + "description": "The hostname to use for the container, as a valid\n[RFC 1123](https://tools.ietf.org/html/rfc1123) hostname.\n" + }, + "Env": { + "type": "array", + "description": "A list of environment variables in the form `VAR=value`.\n", + "items": { + "type": "string" + } + }, + "Dir": { + "type": "string", + "description": "The working directory for commands to run in." + }, + "User": { + "type": "string", + "description": "The user inside the container." + }, + "Groups": { + "type": "array", + "description": "A list of additional groups that the container process will run as.\n", + "items": { + "type": "string" + } + }, + "Privileges": { + "type": "object", + "properties": { + "CredentialSpec": { + "type": "object", + "properties": { + "Config": { + "type": "string", + "description": "Load credential spec from a Swarm Config with the given ID.\nThe specified config must also be present in the Configs\nfield with the Runtime property set.\n\n


\n\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n", + "example": "0bt9dmxjvjiqermk6xrop3ekq" + }, + "File": { + "type": "string", + "description": "Load credential spec from this file. The file is read by\nthe daemon, and must be present in the `CredentialSpecs`\nsubdirectory in the docker data directory, which defaults\nto `C:\\ProgramData\\Docker\\` on Windows.\n\nFor example, specifying `spec.json` loads\n`C:\\ProgramData\\Docker\\CredentialSpecs\\spec.json`.\n\n


\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n", + "example": "spec.json" + }, + "Registry": { + "type": "string", + "description": "Load credential spec from this value in the Windows\nregistry. The specified registry value must be located in:\n\n`HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Virtualization\\Containers\\CredentialSpecs`\n\n


\n\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n" + } + }, + "description": "CredentialSpec for managed service account (Windows only)" + }, + "SELinuxContext": { + "type": "object", + "properties": { + "Disable": { + "type": "boolean", + "description": "Disable SELinux" + }, + "User": { + "type": "string", + "description": "SELinux user label" + }, + "Role": { + "type": "string", + "description": "SELinux role label" + }, + "Type": { + "type": "string", + "description": "SELinux type label" + }, + "Level": { + "type": "string", + "description": "SELinux level label" + } + }, + "description": "SELinux labels of the container" + } + }, + "description": "Security options for the container" + }, + "TTY": { + "type": "boolean", + "description": "Whether a pseudo-TTY should be allocated." + }, + "OpenStdin": { + "type": "boolean", + "description": "Open `stdin`" + }, + "ReadOnly": { + "type": "boolean", + "description": "Mount the container's root filesystem as read only." + }, + "Mounts": { + "type": "array", + "description": "Specification for mounts to be added to containers created as part\nof the service.\n", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "Container path." + }, + "Source": { + "type": "string", + "description": "Mount source (e.g. a volume name, a host path)." + }, + "Type": { + "type": "string", + "description": "The mount type. Available types:\n\n- `bind` Mounts a file or directory from the host into the container. Must exist prior to creating the container.\n- `volume` Creates a volume with the given name and options (or uses a pre-existing volume with the same name and options). These are **not** removed when the container is removed.\n- `tmpfs` Create a tmpfs with the given options. The mount source cannot be specified for tmpfs.\n- `npipe` Mounts a named pipe from the host into the container. Must exist prior to creating the container.\n- `cluster` a Swarm cluster volume\n", + "enum": [ + "bind", + "volume", + "tmpfs", + "npipe", + "cluster" + ] + }, + "ReadOnly": { + "type": "boolean", + "description": "Whether the mount should be read-only." + }, + "Consistency": { + "type": "string", + "description": "The consistency requirement for the mount: `default`, `consistent`, `cached`, or `delegated`." + }, + "BindOptions": { + "type": "object", + "properties": { + "Propagation": { + "type": "string", + "description": "A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`.", + "enum": [ + "private", + "rprivate", + "shared", + "rshared", + "slave", + "rslave" + ] + }, + "NonRecursive": { + "type": "boolean", + "description": "Disable recursive bind mount.", + "default": false + }, + "CreateMountpoint": { + "type": "boolean", + "description": "Create mount point on host if missing", + "default": false + } + }, + "description": "Optional configuration for the `bind` type." + }, + "VolumeOptions": { + "type": "object", + "properties": { + "NoCopy": { + "type": "boolean", + "description": "Populate volume with data from the target.", + "default": false + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "DriverConfig": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver to use to create the volume." + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "key/value map of driver specific options." + } + }, + "description": "Map of driver specific options" + } + }, + "description": "Optional configuration for the `volume` type." + }, + "TmpfsOptions": { + "type": "object", + "properties": { + "SizeBytes": { + "type": "integer", + "description": "The size for the tmpfs mount in bytes.", + "format": "int64" + }, + "Mode": { + "type": "integer", + "description": "The permission mode for the tmpfs mount in an integer." + } + }, + "description": "Optional configuration for the `tmpfs` type." + } + } + } + }, + "StopSignal": { + "type": "string", + "description": "Signal to stop the container." + }, + "StopGracePeriod": { + "type": "integer", + "description": "Amount of time to wait for the container to terminate before\nforcefully killing it.\n", + "format": "int64" + }, + "HealthCheck": { + "type": "object", + "properties": { + "Test": { + "type": "array", + "description": "The test to perform. Possible values are:\n\n- `[]` inherit healthcheck from image or parent image\n- `[\"NONE\"]` disable healthcheck\n- `[\"CMD\", args...]` exec arguments directly\n- `[\"CMD-SHELL\", command]` run command with system's default shell\n", + "items": { + "type": "string" + } + }, + "Interval": { + "type": "integer", + "description": "The time to wait between checks in nanoseconds. It should be 0 or at\nleast 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Timeout": { + "type": "integer", + "description": "The time to wait before considering the check to have hung. It should\nbe 0 or at least 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Retries": { + "type": "integer", + "description": "The number of consecutive failures needed to consider a container as\nunhealthy. 0 means inherit.\n" + }, + "StartPeriod": { + "type": "integer", + "description": "Start period for the container to initialize before starting\nhealth-retries countdown in nanoseconds. It should be 0 or at least\n1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + } + }, + "description": "A test to perform to check that the container is healthy." + }, + "Hosts": { + "type": "array", + "description": "A list of hostname/IP mappings to add to the container's `hosts`\nfile. The format of extra hosts is specified in the\n[hosts(5)](http://man7.org/linux/man-pages/man5/hosts.5.html)\nman page:\n\n IP_address canonical_hostname [aliases...]\n", + "items": { + "type": "string" + } + }, + "DNSConfig": { + "type": "object", + "properties": { + "Nameservers": { + "type": "array", + "description": "The IP addresses of the name servers.", + "items": { + "type": "string" + } + }, + "Search": { + "type": "array", + "description": "A search list for host-name lookup.", + "items": { + "type": "string" + } + }, + "Options": { + "type": "array", + "description": "A list of internal resolver variables to be modified (e.g.,\n`debug`, `ndots:3`, etc.).\n", + "items": { + "type": "string" + } + } + }, + "description": "Specification for DNS related configurations in resolver configuration\nfile (`resolv.conf`).\n" + }, + "Secrets": { + "type": "array", + "description": "Secrets contains references to zero or more secrets that will be\nexposed to the service.\n", + "items": { + "type": "object", + "properties": { + "File": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name represents the final filename in the filesystem.\n" + }, + "UID": { + "type": "string", + "description": "UID represents the file UID." + }, + "GID": { + "type": "string", + "description": "GID represents the file GID." + }, + "Mode": { + "type": "integer", + "description": "Mode represents the FileMode of the file.", + "format": "uint32" + } + }, + "description": "File represents a specific target that is backed by a file.\n" + }, + "SecretID": { + "type": "string", + "description": "SecretID represents the ID of the specific secret that we're\nreferencing.\n" + }, + "SecretName": { + "type": "string", + "description": "SecretName is the name of the secret that this references,\nbut this is just provided for lookup/display purposes. The\nsecret in the reference will be identified by its ID.\n" + } + } + } + }, + "Configs": { + "type": "array", + "description": "Configs contains references to zero or more configs that will be\nexposed to the service.\n", + "items": { + "type": "object", + "properties": { + "File": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name represents the final filename in the filesystem.\n" + }, + "UID": { + "type": "string", + "description": "UID represents the file UID." + }, + "GID": { + "type": "string", + "description": "GID represents the file GID." + }, + "Mode": { + "type": "integer", + "description": "Mode represents the FileMode of the file.", + "format": "uint32" + } + }, + "description": "File represents a specific target that is backed by a file.\n\n


\n\n> **Note**: `Configs.File` and `Configs.Runtime` are mutually exclusive\n" + }, + "Runtime": { + "type": "object", + "properties": {}, + "description": "Runtime represents a target that is not mounted into the\ncontainer but is used by the task\n\n


\n\n> **Note**: `Configs.File` and `Configs.Runtime` are mutually\n> exclusive\n" + }, + "ConfigID": { + "type": "string", + "description": "ConfigID represents the ID of the specific config that we're\nreferencing.\n" + }, + "ConfigName": { + "type": "string", + "description": "ConfigName is the name of the config that this references,\nbut this is just provided for lookup/display purposes. The\nconfig in the reference will be identified by its ID.\n" + } + } + } + }, + "Isolation": { + "type": "string", + "description": "Isolation technology of the containers running the service.\n(Windows only)\n", + "enum": [ + "default", + "process", + "hyperv", + "" + ] + }, + "Init": { + "type": "boolean", + "description": "Run an init inside the container that forwards signals and reaps\nprocesses. This field is omitted if empty, and the default (as\nconfigured on the daemon) is used.\n", + "nullable": true + }, + "Sysctls": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Set kernel namedspaced parameters (sysctls) in the container.\nThe Sysctls option on services accepts the same sysctls as the\nare supported on containers. Note that while the same sysctls are\nsupported, no guarantees or checks are made about their\nsuitability for a clustered environment, and it's up to the user\nto determine whether a given sysctl will work properly in a\nService.\n" + }, + "CapabilityAdd": { + "type": "array", + "description": "A list of kernel capabilities to add to the default set\nfor the container.\n", + "example": [ + "CAP_NET_RAW", + "CAP_SYS_ADMIN", + "CAP_SYS_CHROOT", + "CAP_SYSLOG" + ], + "items": { + "type": "string" + } + }, + "CapabilityDrop": { + "type": "array", + "description": "A list of kernel capabilities to drop from the default set\nfor the container.\n", + "example": [ + "CAP_NET_RAW" + ], + "items": { + "type": "string" + } + }, + "Ulimits": { + "type": "array", + "description": "A list of resource limits to set in the container. For example: `{\"Name\": \"nofile\", \"Soft\": 1024, \"Hard\": 2048}`\"\n", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of ulimit" + }, + "Soft": { + "type": "integer", + "description": "Soft limit" + }, + "Hard": { + "type": "integer", + "description": "Hard limit" + } + } + } + } + }, + "description": "Container spec for the service.\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "NetworkAttachmentSpec": { + "type": "object", + "properties": { + "ContainerID": { + "type": "string", + "description": "ID of the container represented by this task" + } + }, + "description": "Read-only spec type for non-swarm containers attached to swarm overlay\nnetworks.\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "Resources": { + "type": "object", + "properties": { + "Limits": { + "type": "object", + "properties": { + "NanoCPUs": { + "type": "integer", + "format": "int64", + "example": 4000000000 + }, + "MemoryBytes": { + "type": "integer", + "format": "int64", + "example": 8272408576 + }, + "Pids": { + "type": "integer", + "description": "Limits the maximum number of PIDs in the container. Set `0` for unlimited.\n", + "format": "int64", + "example": 100, + "default": 0 + } + }, + "description": "An object describing a limit on resources which can be requested by a task.\n" + }, + "Reservations": { + "type": "object", + "properties": { + "NanoCPUs": { + "type": "integer", + "format": "int64", + "example": 4000000000 + }, + "MemoryBytes": { + "type": "integer", + "format": "int64", + "example": 8272408576 + }, + "GenericResources": { + "type": "array", + "description": "User-defined resources can be either Integer resources (e.g, `SSD=3`) or\nString resources (e.g, `GPU=UUID1`).\n", + "example": [ + { + "DiscreteResourceSpec": { + "Kind": "SSD", + "Value": 3 + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID1" + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID2" + } + } + ], + "items": { + "type": "object", + "properties": { + "NamedResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + }, + "DiscreteResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "integer", + "format": "int64" + } + } + } + } + } + } + }, + "description": "An object describing the resources which can be advertised by a node and\nrequested by a task.\n" + } + }, + "description": "Resource requirements which apply to each individual container created\nas part of the service.\n" + }, + "RestartPolicy": { + "type": "object", + "properties": { + "Condition": { + "type": "string", + "description": "Condition for restart.", + "enum": [ + "none", + "on-failure", + "any" + ] + }, + "Delay": { + "type": "integer", + "description": "Delay between restart attempts.", + "format": "int64" + }, + "MaxAttempts": { + "type": "integer", + "description": "Maximum attempts to restart a given container before giving up\n(default value is 0, which is ignored).\n", + "format": "int64", + "default": 0 + }, + "Window": { + "type": "integer", + "description": "Windows is the time window used to evaluate the restart policy\n(default value is 0, which is unbounded).\n", + "format": "int64", + "default": 0 + } + }, + "description": "Specification for the restart policy which applies to containers\ncreated as part of this service.\n" + }, + "Placement": { + "type": "object", + "properties": { + "Constraints": { + "type": "array", + "description": "An array of constraint expressions to limit the set of nodes where\na task can be scheduled. Constraint expressions can either use a\n_match_ (`==`) or _exclude_ (`!=`) rule. Multiple constraints find\nnodes that satisfy every expression (AND match). Constraints can\nmatch node or Docker Engine labels as follows:\n\nnode attribute | matches | example\n---------------------|--------------------------------|-----------------------------------------------\n`node.id` | Node ID | `node.id==2ivku8v2gvtg4`\n`node.hostname` | Node hostname | `node.hostname!=node-2`\n`node.role` | Node role (`manager`/`worker`) | `node.role==manager`\n`node.platform.os` | Node operating system | `node.platform.os==windows`\n`node.platform.arch` | Node architecture | `node.platform.arch==x86_64`\n`node.labels` | User-defined node labels | `node.labels.security==high`\n`engine.labels` | Docker Engine's labels | `engine.labels.operatingsystem==ubuntu-14.04`\n\n`engine.labels` apply to Docker Engine labels like operating system,\ndrivers, etc. Swarm administrators add `node.labels` for operational\npurposes by using the [`node update endpoint`](#operation/NodeUpdate).\n", + "example": [ + "node.hostname!=node3.corp.example.com", + "node.role!=manager", + "node.labels.type==production", + "node.platform.os==linux", + "node.platform.arch==x86_64" + ], + "items": { + "type": "string" + } + }, + "Preferences": { + "type": "array", + "description": "Preferences provide a way to make the scheduler aware of factors\nsuch as topology. They are provided in order from highest to\nlowest precedence.\n", + "example": [ + { + "Spread": { + "SpreadDescriptor": "node.labels.datacenter" + } + }, + { + "Spread": { + "SpreadDescriptor": "node.labels.rack" + } + } + ], + "items": { + "type": "object", + "properties": { + "Spread": { + "type": "object", + "properties": { + "SpreadDescriptor": { + "type": "string", + "description": "label descriptor, such as `engine.labels.az`.\n" + } + } + } + } + } + }, + "MaxReplicas": { + "type": "integer", + "description": "Maximum number of replicas for per node (default value is 0, which\nis unlimited)\n", + "format": "int64", + "default": 0 + }, + "Platforms": { + "type": "array", + "description": "Platforms stores all the platforms that the service's image can\nrun on. This field is used in the platform filter for scheduling.\nIf empty, then the platform filter is off, meaning there are no\nscheduling restrictions.\n", + "items": { + "type": "object", + "properties": { + "Architecture": { + "type": "string", + "description": "Architecture represents the hardware architecture (for example,\n`x86_64`).\n", + "example": "x86_64" + }, + "OS": { + "type": "string", + "description": "OS represents the Operating System (for example, `linux` or `windows`).\n", + "example": "linux" + } + }, + "description": "Platform represents the platform (Arch/OS).\n" + } + } + } + }, + "ForceUpdate": { + "type": "integer", + "description": "A counter that triggers an update even if no relevant parameters have\nbeen changed.\n" + }, + "Runtime": { + "type": "string", + "description": "Runtime is the type of runtime specified for the task executor.\n" + }, + "Networks": { + "type": "array", + "description": "Specifies which networks the service should attach to.", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "The target network for attachment. Must be a network name or ID.\n" + }, + "Aliases": { + "type": "array", + "description": "Discoverable alternate names for the service on this network.\n", + "items": { + "type": "string" + } + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver attachment options for the network target.\n" + } + }, + "description": "Specifies how a service should be attached to a particular network.\n" + } + }, + "LogDriver": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "description": "Specifies the log driver to use for tasks created from this spec. If\nnot present, the default one for the swarm will be used, finally\nfalling back to the engine default if not specified.\n" + } + }, + "description": "User modifiable task configuration." + }, + "ServiceID": { + "type": "string", + "description": "The ID of the service this task is part of." + }, + "Slot": { + "type": "integer" + }, + "NodeID": { + "type": "string", + "description": "The ID of the node that this task is on." + }, + "AssignedGenericResources": { + "type": "array", + "description": "User-defined resources can be either Integer resources (e.g, `SSD=3`) or\nString resources (e.g, `GPU=UUID1`).\n", + "example": [ + { + "DiscreteResourceSpec": { + "Kind": "SSD", + "Value": 3 + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID1" + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID2" + } + } + ], + "items": { + "type": "object", + "properties": { + "NamedResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + }, + "DiscreteResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "integer", + "format": "int64" + } + } + } + } + } + }, + "Status": { + "type": "object", + "properties": { + "Timestamp": { + "type": "string", + "format": "dateTime" + }, + "State": { + "type": "string", + "enum": [ + "new", + "allocated", + "pending", + "assigned", + "accepted", + "preparing", + "ready", + "starting", + "running", + "complete", + "shutdown", + "failed", + "rejected", + "remove", + "orphaned" + ] + }, + "Message": { + "type": "string" + }, + "Err": { + "type": "string" + }, + "ContainerStatus": { + "type": "object", + "properties": { + "ContainerID": { + "type": "string" + }, + "PID": { + "type": "integer" + }, + "ExitCode": { + "type": "integer" + } + } + } + } + }, + "DesiredState": { + "type": "string", + "enum": [ + "new", + "allocated", + "pending", + "assigned", + "accepted", + "preparing", + "ready", + "starting", + "running", + "complete", + "shutdown", + "failed", + "rejected", + "remove", + "orphaned" + ] + }, + "JobIteration": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + } + }, + "example": { + "ID": "0kzzo1i0y4jz6027t0k7aezc7", + "Version": { + "Index": 71 + }, + "CreatedAt": "2016-06-07T21:07:31.171892745Z", + "UpdatedAt": "2016-06-07T21:07:31.376370513Z", + "Spec": { + "ContainerSpec": { + "Image": "redis" + }, + "Resources": { + "Limits": {}, + "Reservations": {} + }, + "RestartPolicy": { + "Condition": "any", + "MaxAttempts": 0 + }, + "Placement": {} + }, + "ServiceID": "9mnpnzenvg8p8tdbtq4wvbkcz", + "Slot": 1, + "NodeID": "60gvrl6tm78dmak4yl7srz94v", + "Status": { + "Timestamp": "2016-06-07T21:07:31.290032978Z", + "State": "running", + "Message": "started", + "ContainerStatus": { + "ContainerID": "e5d62702a1b48d01c3e02ca1e0212a250801fa8d67caca0b6f35919ebc12f035", + "PID": 677 + } + }, + "DesiredState": "running", + "NetworksAttachments": [ + { + "Network": { + "ID": "4qvuz4ko70xaltuqbt8956gd1", + "Version": { + "Index": 18 + }, + "CreatedAt": "2016-06-07T20:31:11.912919752Z", + "UpdatedAt": "2016-06-07T21:07:29.955277358Z", + "Spec": { + "Name": "ingress", + "Labels": { + "com.docker.swarm.internal": "true" + }, + "DriverConfiguration": {}, + "IPAMOptions": { + "Driver": {}, + "Configs": [ + { + "Subnet": "10.255.0.0/16", + "Gateway": "10.255.0.1" + } + ] + } + }, + "DriverState": { + "Name": "overlay", + "Options": { + "com.docker.network.driver.overlay.vxlanid_list": "256" + } + }, + "IPAMOptions": { + "Driver": { + "Name": "default" + }, + "Configs": [ + { + "Subnet": "10.255.0.0/16", + "Gateway": "10.255.0.1" + } + ] + } + }, + "Addresses": [ + "10.255.0.10/16" + ] + } + ], + "AssignedGenericResources": [ + { + "DiscreteResourceSpec": { + "Kind": "SSD", + "Value": 3 + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID1" + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID2" + } + } + ] + } + }, + "ServiceSpec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the service." + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "TaskTemplate": { + "type": "object", + "properties": { + "PluginSpec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "The name or 'alias' to use for the plugin." + }, + "Remote": { + "type": "string", + "description": "The plugin image reference to use." + }, + "Disabled": { + "type": "boolean", + "description": "Disable the plugin once scheduled." + }, + "PluginPrivilege": { + "type": "array", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "example": "network" + }, + "Description": { + "type": "string" + }, + "Value": { + "type": "array", + "example": [ + "host" + ], + "items": { + "type": "string" + } + } + }, + "description": "Describes a permission the user has to accept upon installing\nthe plugin.\n", + "x-go-name": "PluginPrivilege" + } + } + }, + "description": "Plugin spec for the service. *(Experimental release only.)*\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "ContainerSpec": { + "type": "object", + "properties": { + "Image": { + "type": "string", + "description": "The image name to use for the container" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value data." + }, + "Command": { + "type": "array", + "description": "The command to be run in the image.", + "items": { + "type": "string" + } + }, + "Args": { + "type": "array", + "description": "Arguments to the command.", + "items": { + "type": "string" + } + }, + "Hostname": { + "type": "string", + "description": "The hostname to use for the container, as a valid\n[RFC 1123](https://tools.ietf.org/html/rfc1123) hostname.\n" + }, + "Env": { + "type": "array", + "description": "A list of environment variables in the form `VAR=value`.\n", + "items": { + "type": "string" + } + }, + "Dir": { + "type": "string", + "description": "The working directory for commands to run in." + }, + "User": { + "type": "string", + "description": "The user inside the container." + }, + "Groups": { + "type": "array", + "description": "A list of additional groups that the container process will run as.\n", + "items": { + "type": "string" + } + }, + "Privileges": { + "type": "object", + "properties": { + "CredentialSpec": { + "type": "object", + "properties": { + "Config": { + "type": "string", + "description": "Load credential spec from a Swarm Config with the given ID.\nThe specified config must also be present in the Configs\nfield with the Runtime property set.\n\n


\n\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n", + "example": "0bt9dmxjvjiqermk6xrop3ekq" + }, + "File": { + "type": "string", + "description": "Load credential spec from this file. The file is read by\nthe daemon, and must be present in the `CredentialSpecs`\nsubdirectory in the docker data directory, which defaults\nto `C:\\ProgramData\\Docker\\` on Windows.\n\nFor example, specifying `spec.json` loads\n`C:\\ProgramData\\Docker\\CredentialSpecs\\spec.json`.\n\n


\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n", + "example": "spec.json" + }, + "Registry": { + "type": "string", + "description": "Load credential spec from this value in the Windows\nregistry. The specified registry value must be located in:\n\n`HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Virtualization\\Containers\\CredentialSpecs`\n\n


\n\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n" + } + }, + "description": "CredentialSpec for managed service account (Windows only)" + }, + "SELinuxContext": { + "type": "object", + "properties": { + "Disable": { + "type": "boolean", + "description": "Disable SELinux" + }, + "User": { + "type": "string", + "description": "SELinux user label" + }, + "Role": { + "type": "string", + "description": "SELinux role label" + }, + "Type": { + "type": "string", + "description": "SELinux type label" + }, + "Level": { + "type": "string", + "description": "SELinux level label" + } + }, + "description": "SELinux labels of the container" + } + }, + "description": "Security options for the container" + }, + "TTY": { + "type": "boolean", + "description": "Whether a pseudo-TTY should be allocated." + }, + "OpenStdin": { + "type": "boolean", + "description": "Open `stdin`" + }, + "ReadOnly": { + "type": "boolean", + "description": "Mount the container's root filesystem as read only." + }, + "Mounts": { + "type": "array", + "description": "Specification for mounts to be added to containers created as part\nof the service.\n", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "Container path." + }, + "Source": { + "type": "string", + "description": "Mount source (e.g. a volume name, a host path)." + }, + "Type": { + "type": "string", + "description": "The mount type. Available types:\n\n- `bind` Mounts a file or directory from the host into the container. Must exist prior to creating the container.\n- `volume` Creates a volume with the given name and options (or uses a pre-existing volume with the same name and options). These are **not** removed when the container is removed.\n- `tmpfs` Create a tmpfs with the given options. The mount source cannot be specified for tmpfs.\n- `npipe` Mounts a named pipe from the host into the container. Must exist prior to creating the container.\n- `cluster` a Swarm cluster volume\n", + "enum": [ + "bind", + "volume", + "tmpfs", + "npipe", + "cluster" + ] + }, + "ReadOnly": { + "type": "boolean", + "description": "Whether the mount should be read-only." + }, + "Consistency": { + "type": "string", + "description": "The consistency requirement for the mount: `default`, `consistent`, `cached`, or `delegated`." + }, + "BindOptions": { + "type": "object", + "properties": { + "Propagation": { + "type": "string", + "description": "A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`.", + "enum": [ + "private", + "rprivate", + "shared", + "rshared", + "slave", + "rslave" + ] + }, + "NonRecursive": { + "type": "boolean", + "description": "Disable recursive bind mount.", + "default": false + }, + "CreateMountpoint": { + "type": "boolean", + "description": "Create mount point on host if missing", + "default": false + } + }, + "description": "Optional configuration for the `bind` type." + }, + "VolumeOptions": { + "type": "object", + "properties": { + "NoCopy": { + "type": "boolean", + "description": "Populate volume with data from the target.", + "default": false + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "DriverConfig": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver to use to create the volume." + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "key/value map of driver specific options." + } + }, + "description": "Map of driver specific options" + } + }, + "description": "Optional configuration for the `volume` type." + }, + "TmpfsOptions": { + "type": "object", + "properties": { + "SizeBytes": { + "type": "integer", + "description": "The size for the tmpfs mount in bytes.", + "format": "int64" + }, + "Mode": { + "type": "integer", + "description": "The permission mode for the tmpfs mount in an integer." + } + }, + "description": "Optional configuration for the `tmpfs` type." + } + } + } + }, + "StopSignal": { + "type": "string", + "description": "Signal to stop the container." + }, + "StopGracePeriod": { + "type": "integer", + "description": "Amount of time to wait for the container to terminate before\nforcefully killing it.\n", + "format": "int64" + }, + "HealthCheck": { + "type": "object", + "properties": { + "Test": { + "type": "array", + "description": "The test to perform. Possible values are:\n\n- `[]` inherit healthcheck from image or parent image\n- `[\"NONE\"]` disable healthcheck\n- `[\"CMD\", args...]` exec arguments directly\n- `[\"CMD-SHELL\", command]` run command with system's default shell\n", + "items": { + "type": "string" + } + }, + "Interval": { + "type": "integer", + "description": "The time to wait between checks in nanoseconds. It should be 0 or at\nleast 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Timeout": { + "type": "integer", + "description": "The time to wait before considering the check to have hung. It should\nbe 0 or at least 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Retries": { + "type": "integer", + "description": "The number of consecutive failures needed to consider a container as\nunhealthy. 0 means inherit.\n" + }, + "StartPeriod": { + "type": "integer", + "description": "Start period for the container to initialize before starting\nhealth-retries countdown in nanoseconds. It should be 0 or at least\n1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + } + }, + "description": "A test to perform to check that the container is healthy." + }, + "Hosts": { + "type": "array", + "description": "A list of hostname/IP mappings to add to the container's `hosts`\nfile. The format of extra hosts is specified in the\n[hosts(5)](http://man7.org/linux/man-pages/man5/hosts.5.html)\nman page:\n\n IP_address canonical_hostname [aliases...]\n", + "items": { + "type": "string" + } + }, + "DNSConfig": { + "type": "object", + "properties": { + "Nameservers": { + "type": "array", + "description": "The IP addresses of the name servers.", + "items": { + "type": "string" + } + }, + "Search": { + "type": "array", + "description": "A search list for host-name lookup.", + "items": { + "type": "string" + } + }, + "Options": { + "type": "array", + "description": "A list of internal resolver variables to be modified (e.g.,\n`debug`, `ndots:3`, etc.).\n", + "items": { + "type": "string" + } + } + }, + "description": "Specification for DNS related configurations in resolver configuration\nfile (`resolv.conf`).\n" + }, + "Secrets": { + "type": "array", + "description": "Secrets contains references to zero or more secrets that will be\nexposed to the service.\n", + "items": { + "type": "object", + "properties": { + "File": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name represents the final filename in the filesystem.\n" + }, + "UID": { + "type": "string", + "description": "UID represents the file UID." + }, + "GID": { + "type": "string", + "description": "GID represents the file GID." + }, + "Mode": { + "type": "integer", + "description": "Mode represents the FileMode of the file.", + "format": "uint32" + } + }, + "description": "File represents a specific target that is backed by a file.\n" + }, + "SecretID": { + "type": "string", + "description": "SecretID represents the ID of the specific secret that we're\nreferencing.\n" + }, + "SecretName": { + "type": "string", + "description": "SecretName is the name of the secret that this references,\nbut this is just provided for lookup/display purposes. The\nsecret in the reference will be identified by its ID.\n" + } + } + } + }, + "Configs": { + "type": "array", + "description": "Configs contains references to zero or more configs that will be\nexposed to the service.\n", + "items": { + "type": "object", + "properties": { + "File": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name represents the final filename in the filesystem.\n" + }, + "UID": { + "type": "string", + "description": "UID represents the file UID." + }, + "GID": { + "type": "string", + "description": "GID represents the file GID." + }, + "Mode": { + "type": "integer", + "description": "Mode represents the FileMode of the file.", + "format": "uint32" + } + }, + "description": "File represents a specific target that is backed by a file.\n\n


\n\n> **Note**: `Configs.File` and `Configs.Runtime` are mutually exclusive\n" + }, + "Runtime": { + "type": "object", + "properties": {}, + "description": "Runtime represents a target that is not mounted into the\ncontainer but is used by the task\n\n


\n\n> **Note**: `Configs.File` and `Configs.Runtime` are mutually\n> exclusive\n" + }, + "ConfigID": { + "type": "string", + "description": "ConfigID represents the ID of the specific config that we're\nreferencing.\n" + }, + "ConfigName": { + "type": "string", + "description": "ConfigName is the name of the config that this references,\nbut this is just provided for lookup/display purposes. The\nconfig in the reference will be identified by its ID.\n" + } + } + } + }, + "Isolation": { + "type": "string", + "description": "Isolation technology of the containers running the service.\n(Windows only)\n", + "enum": [ + "default", + "process", + "hyperv", + "" + ] + }, + "Init": { + "type": "boolean", + "description": "Run an init inside the container that forwards signals and reaps\nprocesses. This field is omitted if empty, and the default (as\nconfigured on the daemon) is used.\n", + "nullable": true + }, + "Sysctls": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Set kernel namedspaced parameters (sysctls) in the container.\nThe Sysctls option on services accepts the same sysctls as the\nare supported on containers. Note that while the same sysctls are\nsupported, no guarantees or checks are made about their\nsuitability for a clustered environment, and it's up to the user\nto determine whether a given sysctl will work properly in a\nService.\n" + }, + "CapabilityAdd": { + "type": "array", + "description": "A list of kernel capabilities to add to the default set\nfor the container.\n", + "example": [ + "CAP_NET_RAW", + "CAP_SYS_ADMIN", + "CAP_SYS_CHROOT", + "CAP_SYSLOG" + ], + "items": { + "type": "string" + } + }, + "CapabilityDrop": { + "type": "array", + "description": "A list of kernel capabilities to drop from the default set\nfor the container.\n", + "example": [ + "CAP_NET_RAW" + ], + "items": { + "type": "string" + } + }, + "Ulimits": { + "type": "array", + "description": "A list of resource limits to set in the container. For example: `{\"Name\": \"nofile\", \"Soft\": 1024, \"Hard\": 2048}`\"\n", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of ulimit" + }, + "Soft": { + "type": "integer", + "description": "Soft limit" + }, + "Hard": { + "type": "integer", + "description": "Hard limit" + } + } + } + } + }, + "description": "Container spec for the service.\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "NetworkAttachmentSpec": { + "type": "object", + "properties": { + "ContainerID": { + "type": "string", + "description": "ID of the container represented by this task" + } + }, + "description": "Read-only spec type for non-swarm containers attached to swarm overlay\nnetworks.\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "Resources": { + "type": "object", + "properties": { + "Limits": { + "type": "object", + "properties": { + "NanoCPUs": { + "type": "integer", + "format": "int64", + "example": 4000000000 + }, + "MemoryBytes": { + "type": "integer", + "format": "int64", + "example": 8272408576 + }, + "Pids": { + "type": "integer", + "description": "Limits the maximum number of PIDs in the container. Set `0` for unlimited.\n", + "format": "int64", + "example": 100, + "default": 0 + } + }, + "description": "An object describing a limit on resources which can be requested by a task.\n" + }, + "Reservations": { + "type": "object", + "properties": { + "NanoCPUs": { + "type": "integer", + "format": "int64", + "example": 4000000000 + }, + "MemoryBytes": { + "type": "integer", + "format": "int64", + "example": 8272408576 + }, + "GenericResources": { + "type": "array", + "description": "User-defined resources can be either Integer resources (e.g, `SSD=3`) or\nString resources (e.g, `GPU=UUID1`).\n", + "example": [ + { + "DiscreteResourceSpec": { + "Kind": "SSD", + "Value": 3 + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID1" + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID2" + } + } + ], + "items": { + "type": "object", + "properties": { + "NamedResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + }, + "DiscreteResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "integer", + "format": "int64" + } + } + } + } + } + } + }, + "description": "An object describing the resources which can be advertised by a node and\nrequested by a task.\n" + } + }, + "description": "Resource requirements which apply to each individual container created\nas part of the service.\n" + }, + "RestartPolicy": { + "type": "object", + "properties": { + "Condition": { + "type": "string", + "description": "Condition for restart.", + "enum": [ + "none", + "on-failure", + "any" + ] + }, + "Delay": { + "type": "integer", + "description": "Delay between restart attempts.", + "format": "int64" + }, + "MaxAttempts": { + "type": "integer", + "description": "Maximum attempts to restart a given container before giving up\n(default value is 0, which is ignored).\n", + "format": "int64", + "default": 0 + }, + "Window": { + "type": "integer", + "description": "Windows is the time window used to evaluate the restart policy\n(default value is 0, which is unbounded).\n", + "format": "int64", + "default": 0 + } + }, + "description": "Specification for the restart policy which applies to containers\ncreated as part of this service.\n" + }, + "Placement": { + "type": "object", + "properties": { + "Constraints": { + "type": "array", + "description": "An array of constraint expressions to limit the set of nodes where\na task can be scheduled. Constraint expressions can either use a\n_match_ (`==`) or _exclude_ (`!=`) rule. Multiple constraints find\nnodes that satisfy every expression (AND match). Constraints can\nmatch node or Docker Engine labels as follows:\n\nnode attribute | matches | example\n---------------------|--------------------------------|-----------------------------------------------\n`node.id` | Node ID | `node.id==2ivku8v2gvtg4`\n`node.hostname` | Node hostname | `node.hostname!=node-2`\n`node.role` | Node role (`manager`/`worker`) | `node.role==manager`\n`node.platform.os` | Node operating system | `node.platform.os==windows`\n`node.platform.arch` | Node architecture | `node.platform.arch==x86_64`\n`node.labels` | User-defined node labels | `node.labels.security==high`\n`engine.labels` | Docker Engine's labels | `engine.labels.operatingsystem==ubuntu-14.04`\n\n`engine.labels` apply to Docker Engine labels like operating system,\ndrivers, etc. Swarm administrators add `node.labels` for operational\npurposes by using the [`node update endpoint`](#operation/NodeUpdate).\n", + "example": [ + "node.hostname!=node3.corp.example.com", + "node.role!=manager", + "node.labels.type==production", + "node.platform.os==linux", + "node.platform.arch==x86_64" + ], + "items": { + "type": "string" + } + }, + "Preferences": { + "type": "array", + "description": "Preferences provide a way to make the scheduler aware of factors\nsuch as topology. They are provided in order from highest to\nlowest precedence.\n", + "example": [ + { + "Spread": { + "SpreadDescriptor": "node.labels.datacenter" + } + }, + { + "Spread": { + "SpreadDescriptor": "node.labels.rack" + } + } + ], + "items": { + "type": "object", + "properties": { + "Spread": { + "type": "object", + "properties": { + "SpreadDescriptor": { + "type": "string", + "description": "label descriptor, such as `engine.labels.az`.\n" + } + } + } + } + } + }, + "MaxReplicas": { + "type": "integer", + "description": "Maximum number of replicas for per node (default value is 0, which\nis unlimited)\n", + "format": "int64", + "default": 0 + }, + "Platforms": { + "type": "array", + "description": "Platforms stores all the platforms that the service's image can\nrun on. This field is used in the platform filter for scheduling.\nIf empty, then the platform filter is off, meaning there are no\nscheduling restrictions.\n", + "items": { + "type": "object", + "properties": { + "Architecture": { + "type": "string", + "description": "Architecture represents the hardware architecture (for example,\n`x86_64`).\n", + "example": "x86_64" + }, + "OS": { + "type": "string", + "description": "OS represents the Operating System (for example, `linux` or `windows`).\n", + "example": "linux" + } + }, + "description": "Platform represents the platform (Arch/OS).\n" + } + } + } + }, + "ForceUpdate": { + "type": "integer", + "description": "A counter that triggers an update even if no relevant parameters have\nbeen changed.\n" + }, + "Runtime": { + "type": "string", + "description": "Runtime is the type of runtime specified for the task executor.\n" + }, + "Networks": { + "type": "array", + "description": "Specifies which networks the service should attach to.", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "The target network for attachment. Must be a network name or ID.\n" + }, + "Aliases": { + "type": "array", + "description": "Discoverable alternate names for the service on this network.\n", + "items": { + "type": "string" + } + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver attachment options for the network target.\n" + } + }, + "description": "Specifies how a service should be attached to a particular network.\n" + } + }, + "LogDriver": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "description": "Specifies the log driver to use for tasks created from this spec. If\nnot present, the default one for the swarm will be used, finally\nfalling back to the engine default if not specified.\n" + } + }, + "description": "User modifiable task configuration." + }, + "Mode": { + "type": "object", + "properties": { + "Replicated": { + "type": "object", + "properties": { + "Replicas": { + "type": "integer", + "format": "int64" + } + } + }, + "Global": { + "type": "object", + "properties": {} + }, + "ReplicatedJob": { + "type": "object", + "properties": { + "MaxConcurrent": { + "type": "integer", + "description": "The maximum number of replicas to run simultaneously.\n", + "format": "int64", + "default": 1 + }, + "TotalCompletions": { + "type": "integer", + "description": "The total number of replicas desired to reach the Completed\nstate. If unset, will default to the value of `MaxConcurrent`\n", + "format": "int64" + } + }, + "description": "The mode used for services with a finite number of tasks that run\nto a completed state.\n" + }, + "GlobalJob": { + "type": "object", + "properties": {}, + "description": "The mode used for services which run a task to the completed state\non each valid node.\n" + } + }, + "description": "Scheduling mode for the service." + }, + "UpdateConfig": { + "type": "object", + "properties": { + "Parallelism": { + "type": "integer", + "description": "Maximum number of tasks to be updated in one iteration (0 means\nunlimited parallelism).\n", + "format": "int64" + }, + "Delay": { + "type": "integer", + "description": "Amount of time between updates, in nanoseconds.", + "format": "int64" + }, + "FailureAction": { + "type": "string", + "description": "Action to take if an updated task fails to run, or stops running\nduring the update.\n", + "enum": [ + "continue", + "pause", + "rollback" + ] + }, + "Monitor": { + "type": "integer", + "description": "Amount of time to monitor each updated task for failures, in\nnanoseconds.\n", + "format": "int64" + }, + "MaxFailureRatio": { + "type": "number", + "description": "The fraction of tasks that may fail during an update before the\nfailure action is invoked, specified as a floating point number\nbetween 0 and 1.\n" + }, + "Order": { + "type": "string", + "description": "The order of operations when rolling out an updated task. Either\nthe old task is shut down before the new task is started, or the\nnew task is started before the old task is shut down.\n", + "enum": [ + "stop-first", + "start-first" + ] + } + }, + "description": "Specification for the update strategy of the service." + }, + "RollbackConfig": { + "type": "object", + "properties": { + "Parallelism": { + "type": "integer", + "description": "Maximum number of tasks to be rolled back in one iteration (0 means\nunlimited parallelism).\n", + "format": "int64" + }, + "Delay": { + "type": "integer", + "description": "Amount of time between rollback iterations, in nanoseconds.\n", + "format": "int64" + }, + "FailureAction": { + "type": "string", + "description": "Action to take if an rolled back task fails to run, or stops\nrunning during the rollback.\n", + "enum": [ + "continue", + "pause" + ] + }, + "Monitor": { + "type": "integer", + "description": "Amount of time to monitor each rolled back task for failures, in\nnanoseconds.\n", + "format": "int64" + }, + "MaxFailureRatio": { + "type": "number", + "description": "The fraction of tasks that may fail during a rollback before the\nfailure action is invoked, specified as a floating point number\nbetween 0 and 1.\n" + }, + "Order": { + "type": "string", + "description": "The order of operations when rolling back a task. Either the old\ntask is shut down before the new task is started, or the new task\nis started before the old task is shut down.\n", + "enum": [ + "stop-first", + "start-first" + ] + } + }, + "description": "Specification for the rollback strategy of the service." + }, + "Networks": { + "type": "array", + "description": "Specifies which networks the service should attach to.", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "The target network for attachment. Must be a network name or ID.\n" + }, + "Aliases": { + "type": "array", + "description": "Discoverable alternate names for the service on this network.\n", + "items": { + "type": "string" + } + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver attachment options for the network target.\n" + } + }, + "description": "Specifies how a service should be attached to a particular network.\n" + } + }, + "EndpointSpec": { + "type": "object", + "properties": { + "Mode": { + "type": "string", + "description": "The mode of resolution to use for internal load balancing between tasks.\n", + "default": "vip", + "enum": [ + "vip", + "dnsrr" + ] + }, + "Ports": { + "type": "array", + "description": "List of exposed ports that this service is accessible on from the\noutside. Ports can only be provided if `vip` resolution mode is used.\n", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Protocol": { + "type": "string", + "enum": [ + "tcp", + "udp", + "sctp" + ] + }, + "TargetPort": { + "type": "integer", + "description": "The port inside the container." + }, + "PublishedPort": { + "type": "integer", + "description": "The port on the swarm hosts." + }, + "PublishMode": { + "type": "string", + "description": "The mode in which port is published.\n\n


\n\n- \"ingress\" makes the target port accessible on every node,\n regardless of whether there is a task for the service running on\n that node or not.\n- \"host\" bypasses the routing mesh and publish the port directly on\n the swarm node where that service is running.\n", + "example": "ingress", + "default": "ingress", + "enum": [ + "ingress", + "host" + ] + } + } + } + } + }, + "description": "Properties that can be configured to access and load balance a service." + } + }, + "description": "User modifiable configuration for a service." + }, + "EndpointPortConfig": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Protocol": { + "type": "string", + "enum": [ + "tcp", + "udp", + "sctp" + ] + }, + "TargetPort": { + "type": "integer", + "description": "The port inside the container." + }, + "PublishedPort": { + "type": "integer", + "description": "The port on the swarm hosts." + }, + "PublishMode": { + "type": "string", + "description": "The mode in which port is published.\n\n


\n\n- \"ingress\" makes the target port accessible on every node,\n regardless of whether there is a task for the service running on\n that node or not.\n- \"host\" bypasses the routing mesh and publish the port directly on\n the swarm node where that service is running.\n", + "example": "ingress", + "default": "ingress", + "enum": [ + "ingress", + "host" + ] + } + } + }, + "EndpointSpec": { + "type": "object", + "properties": { + "Mode": { + "type": "string", + "description": "The mode of resolution to use for internal load balancing between tasks.\n", + "default": "vip", + "enum": [ + "vip", + "dnsrr" + ] + }, + "Ports": { + "type": "array", + "description": "List of exposed ports that this service is accessible on from the\noutside. Ports can only be provided if `vip` resolution mode is used.\n", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Protocol": { + "type": "string", + "enum": [ + "tcp", + "udp", + "sctp" + ] + }, + "TargetPort": { + "type": "integer", + "description": "The port inside the container." + }, + "PublishedPort": { + "type": "integer", + "description": "The port on the swarm hosts." + }, + "PublishMode": { + "type": "string", + "description": "The mode in which port is published.\n\n


\n\n- \"ingress\" makes the target port accessible on every node,\n regardless of whether there is a task for the service running on\n that node or not.\n- \"host\" bypasses the routing mesh and publish the port directly on\n the swarm node where that service is running.\n", + "example": "ingress", + "default": "ingress", + "enum": [ + "ingress", + "host" + ] + } + } + } + } + }, + "description": "Properties that can be configured to access and load balance a service." + }, + "Service": { + "type": "object", + "properties": { + "ID": { + "type": "string" + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "format": "dateTime" + }, + "UpdatedAt": { + "type": "string", + "format": "dateTime" + }, + "Spec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the service." + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "TaskTemplate": { + "type": "object", + "properties": { + "PluginSpec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "The name or 'alias' to use for the plugin." + }, + "Remote": { + "type": "string", + "description": "The plugin image reference to use." + }, + "Disabled": { + "type": "boolean", + "description": "Disable the plugin once scheduled." + }, + "PluginPrivilege": { + "type": "array", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "example": "network" + }, + "Description": { + "type": "string" + }, + "Value": { + "type": "array", + "example": [ + "host" + ], + "items": { + "type": "string" + } + } + }, + "description": "Describes a permission the user has to accept upon installing\nthe plugin.\n", + "x-go-name": "PluginPrivilege" + } + } + }, + "description": "Plugin spec for the service. *(Experimental release only.)*\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "ContainerSpec": { + "type": "object", + "properties": { + "Image": { + "type": "string", + "description": "The image name to use for the container" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value data." + }, + "Command": { + "type": "array", + "description": "The command to be run in the image.", + "items": { + "type": "string" + } + }, + "Args": { + "type": "array", + "description": "Arguments to the command.", + "items": { + "type": "string" + } + }, + "Hostname": { + "type": "string", + "description": "The hostname to use for the container, as a valid\n[RFC 1123](https://tools.ietf.org/html/rfc1123) hostname.\n" + }, + "Env": { + "type": "array", + "description": "A list of environment variables in the form `VAR=value`.\n", + "items": { + "type": "string" + } + }, + "Dir": { + "type": "string", + "description": "The working directory for commands to run in." + }, + "User": { + "type": "string", + "description": "The user inside the container." + }, + "Groups": { + "type": "array", + "description": "A list of additional groups that the container process will run as.\n", + "items": { + "type": "string" + } + }, + "Privileges": { + "type": "object", + "properties": { + "CredentialSpec": { + "type": "object", + "properties": { + "Config": { + "type": "string", + "description": "Load credential spec from a Swarm Config with the given ID.\nThe specified config must also be present in the Configs\nfield with the Runtime property set.\n\n


\n\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n", + "example": "0bt9dmxjvjiqermk6xrop3ekq" + }, + "File": { + "type": "string", + "description": "Load credential spec from this file. The file is read by\nthe daemon, and must be present in the `CredentialSpecs`\nsubdirectory in the docker data directory, which defaults\nto `C:\\ProgramData\\Docker\\` on Windows.\n\nFor example, specifying `spec.json` loads\n`C:\\ProgramData\\Docker\\CredentialSpecs\\spec.json`.\n\n


\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n", + "example": "spec.json" + }, + "Registry": { + "type": "string", + "description": "Load credential spec from this value in the Windows\nregistry. The specified registry value must be located in:\n\n`HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Virtualization\\Containers\\CredentialSpecs`\n\n


\n\n\n> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`,\n> and `CredentialSpec.Config` are mutually exclusive.\n" + } + }, + "description": "CredentialSpec for managed service account (Windows only)" + }, + "SELinuxContext": { + "type": "object", + "properties": { + "Disable": { + "type": "boolean", + "description": "Disable SELinux" + }, + "User": { + "type": "string", + "description": "SELinux user label" + }, + "Role": { + "type": "string", + "description": "SELinux role label" + }, + "Type": { + "type": "string", + "description": "SELinux type label" + }, + "Level": { + "type": "string", + "description": "SELinux level label" + } + }, + "description": "SELinux labels of the container" + } + }, + "description": "Security options for the container" + }, + "TTY": { + "type": "boolean", + "description": "Whether a pseudo-TTY should be allocated." + }, + "OpenStdin": { + "type": "boolean", + "description": "Open `stdin`" + }, + "ReadOnly": { + "type": "boolean", + "description": "Mount the container's root filesystem as read only." + }, + "Mounts": { + "type": "array", + "description": "Specification for mounts to be added to containers created as part\nof the service.\n", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "Container path." + }, + "Source": { + "type": "string", + "description": "Mount source (e.g. a volume name, a host path)." + }, + "Type": { + "type": "string", + "description": "The mount type. Available types:\n\n- `bind` Mounts a file or directory from the host into the container. Must exist prior to creating the container.\n- `volume` Creates a volume with the given name and options (or uses a pre-existing volume with the same name and options). These are **not** removed when the container is removed.\n- `tmpfs` Create a tmpfs with the given options. The mount source cannot be specified for tmpfs.\n- `npipe` Mounts a named pipe from the host into the container. Must exist prior to creating the container.\n- `cluster` a Swarm cluster volume\n", + "enum": [ + "bind", + "volume", + "tmpfs", + "npipe", + "cluster" + ] + }, + "ReadOnly": { + "type": "boolean", + "description": "Whether the mount should be read-only." + }, + "Consistency": { + "type": "string", + "description": "The consistency requirement for the mount: `default`, `consistent`, `cached`, or `delegated`." + }, + "BindOptions": { + "type": "object", + "properties": { + "Propagation": { + "type": "string", + "description": "A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`.", + "enum": [ + "private", + "rprivate", + "shared", + "rshared", + "slave", + "rslave" + ] + }, + "NonRecursive": { + "type": "boolean", + "description": "Disable recursive bind mount.", + "default": false + }, + "CreateMountpoint": { + "type": "boolean", + "description": "Create mount point on host if missing", + "default": false + } + }, + "description": "Optional configuration for the `bind` type." + }, + "VolumeOptions": { + "type": "object", + "properties": { + "NoCopy": { + "type": "boolean", + "description": "Populate volume with data from the target.", + "default": false + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "DriverConfig": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver to use to create the volume." + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "key/value map of driver specific options." + } + }, + "description": "Map of driver specific options" + } + }, + "description": "Optional configuration for the `volume` type." + }, + "TmpfsOptions": { + "type": "object", + "properties": { + "SizeBytes": { + "type": "integer", + "description": "The size for the tmpfs mount in bytes.", + "format": "int64" + }, + "Mode": { + "type": "integer", + "description": "The permission mode for the tmpfs mount in an integer." + } + }, + "description": "Optional configuration for the `tmpfs` type." + } + } + } + }, + "StopSignal": { + "type": "string", + "description": "Signal to stop the container." + }, + "StopGracePeriod": { + "type": "integer", + "description": "Amount of time to wait for the container to terminate before\nforcefully killing it.\n", + "format": "int64" + }, + "HealthCheck": { + "type": "object", + "properties": { + "Test": { + "type": "array", + "description": "The test to perform. Possible values are:\n\n- `[]` inherit healthcheck from image or parent image\n- `[\"NONE\"]` disable healthcheck\n- `[\"CMD\", args...]` exec arguments directly\n- `[\"CMD-SHELL\", command]` run command with system's default shell\n", + "items": { + "type": "string" + } + }, + "Interval": { + "type": "integer", + "description": "The time to wait between checks in nanoseconds. It should be 0 or at\nleast 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Timeout": { + "type": "integer", + "description": "The time to wait before considering the check to have hung. It should\nbe 0 or at least 1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + }, + "Retries": { + "type": "integer", + "description": "The number of consecutive failures needed to consider a container as\nunhealthy. 0 means inherit.\n" + }, + "StartPeriod": { + "type": "integer", + "description": "Start period for the container to initialize before starting\nhealth-retries countdown in nanoseconds. It should be 0 or at least\n1000000 (1 ms). 0 means inherit.\n", + "format": "int64" + } + }, + "description": "A test to perform to check that the container is healthy." + }, + "Hosts": { + "type": "array", + "description": "A list of hostname/IP mappings to add to the container's `hosts`\nfile. The format of extra hosts is specified in the\n[hosts(5)](http://man7.org/linux/man-pages/man5/hosts.5.html)\nman page:\n\n IP_address canonical_hostname [aliases...]\n", + "items": { + "type": "string" + } + }, + "DNSConfig": { + "type": "object", + "properties": { + "Nameservers": { + "type": "array", + "description": "The IP addresses of the name servers.", + "items": { + "type": "string" + } + }, + "Search": { + "type": "array", + "description": "A search list for host-name lookup.", + "items": { + "type": "string" + } + }, + "Options": { + "type": "array", + "description": "A list of internal resolver variables to be modified (e.g.,\n`debug`, `ndots:3`, etc.).\n", + "items": { + "type": "string" + } + } + }, + "description": "Specification for DNS related configurations in resolver configuration\nfile (`resolv.conf`).\n" + }, + "Secrets": { + "type": "array", + "description": "Secrets contains references to zero or more secrets that will be\nexposed to the service.\n", + "items": { + "type": "object", + "properties": { + "File": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name represents the final filename in the filesystem.\n" + }, + "UID": { + "type": "string", + "description": "UID represents the file UID." + }, + "GID": { + "type": "string", + "description": "GID represents the file GID." + }, + "Mode": { + "type": "integer", + "description": "Mode represents the FileMode of the file.", + "format": "uint32" + } + }, + "description": "File represents a specific target that is backed by a file.\n" + }, + "SecretID": { + "type": "string", + "description": "SecretID represents the ID of the specific secret that we're\nreferencing.\n" + }, + "SecretName": { + "type": "string", + "description": "SecretName is the name of the secret that this references,\nbut this is just provided for lookup/display purposes. The\nsecret in the reference will be identified by its ID.\n" + } + } + } + }, + "Configs": { + "type": "array", + "description": "Configs contains references to zero or more configs that will be\nexposed to the service.\n", + "items": { + "type": "object", + "properties": { + "File": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name represents the final filename in the filesystem.\n" + }, + "UID": { + "type": "string", + "description": "UID represents the file UID." + }, + "GID": { + "type": "string", + "description": "GID represents the file GID." + }, + "Mode": { + "type": "integer", + "description": "Mode represents the FileMode of the file.", + "format": "uint32" + } + }, + "description": "File represents a specific target that is backed by a file.\n\n


\n\n> **Note**: `Configs.File` and `Configs.Runtime` are mutually exclusive\n" + }, + "Runtime": { + "type": "object", + "properties": {}, + "description": "Runtime represents a target that is not mounted into the\ncontainer but is used by the task\n\n


\n\n> **Note**: `Configs.File` and `Configs.Runtime` are mutually\n> exclusive\n" + }, + "ConfigID": { + "type": "string", + "description": "ConfigID represents the ID of the specific config that we're\nreferencing.\n" + }, + "ConfigName": { + "type": "string", + "description": "ConfigName is the name of the config that this references,\nbut this is just provided for lookup/display purposes. The\nconfig in the reference will be identified by its ID.\n" + } + } + } + }, + "Isolation": { + "type": "string", + "description": "Isolation technology of the containers running the service.\n(Windows only)\n", + "enum": [ + "default", + "process", + "hyperv", + "" + ] + }, + "Init": { + "type": "boolean", + "description": "Run an init inside the container that forwards signals and reaps\nprocesses. This field is omitted if empty, and the default (as\nconfigured on the daemon) is used.\n", + "nullable": true + }, + "Sysctls": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Set kernel namedspaced parameters (sysctls) in the container.\nThe Sysctls option on services accepts the same sysctls as the\nare supported on containers. Note that while the same sysctls are\nsupported, no guarantees or checks are made about their\nsuitability for a clustered environment, and it's up to the user\nto determine whether a given sysctl will work properly in a\nService.\n" + }, + "CapabilityAdd": { + "type": "array", + "description": "A list of kernel capabilities to add to the default set\nfor the container.\n", + "example": [ + "CAP_NET_RAW", + "CAP_SYS_ADMIN", + "CAP_SYS_CHROOT", + "CAP_SYSLOG" + ], + "items": { + "type": "string" + } + }, + "CapabilityDrop": { + "type": "array", + "description": "A list of kernel capabilities to drop from the default set\nfor the container.\n", + "example": [ + "CAP_NET_RAW" + ], + "items": { + "type": "string" + } + }, + "Ulimits": { + "type": "array", + "description": "A list of resource limits to set in the container. For example: `{\"Name\": \"nofile\", \"Soft\": 1024, \"Hard\": 2048}`\"\n", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of ulimit" + }, + "Soft": { + "type": "integer", + "description": "Soft limit" + }, + "Hard": { + "type": "integer", + "description": "Hard limit" + } + } + } + } + }, + "description": "Container spec for the service.\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "NetworkAttachmentSpec": { + "type": "object", + "properties": { + "ContainerID": { + "type": "string", + "description": "ID of the container represented by this task" + } + }, + "description": "Read-only spec type for non-swarm containers attached to swarm overlay\nnetworks.\n\n


\n\n> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are\n> mutually exclusive. PluginSpec is only used when the Runtime field\n> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime\n> field is set to `attachment`.\n" + }, + "Resources": { + "type": "object", + "properties": { + "Limits": { + "type": "object", + "properties": { + "NanoCPUs": { + "type": "integer", + "format": "int64", + "example": 4000000000 + }, + "MemoryBytes": { + "type": "integer", + "format": "int64", + "example": 8272408576 + }, + "Pids": { + "type": "integer", + "description": "Limits the maximum number of PIDs in the container. Set `0` for unlimited.\n", + "format": "int64", + "example": 100, + "default": 0 + } + }, + "description": "An object describing a limit on resources which can be requested by a task.\n" + }, + "Reservations": { + "type": "object", + "properties": { + "NanoCPUs": { + "type": "integer", + "format": "int64", + "example": 4000000000 + }, + "MemoryBytes": { + "type": "integer", + "format": "int64", + "example": 8272408576 + }, + "GenericResources": { + "type": "array", + "description": "User-defined resources can be either Integer resources (e.g, `SSD=3`) or\nString resources (e.g, `GPU=UUID1`).\n", + "example": [ + { + "DiscreteResourceSpec": { + "Kind": "SSD", + "Value": 3 + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID1" + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID2" + } + } + ], + "items": { + "type": "object", + "properties": { + "NamedResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + }, + "DiscreteResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "integer", + "format": "int64" + } + } + } + } + } + } + }, + "description": "An object describing the resources which can be advertised by a node and\nrequested by a task.\n" + } + }, + "description": "Resource requirements which apply to each individual container created\nas part of the service.\n" + }, + "RestartPolicy": { + "type": "object", + "properties": { + "Condition": { + "type": "string", + "description": "Condition for restart.", + "enum": [ + "none", + "on-failure", + "any" + ] + }, + "Delay": { + "type": "integer", + "description": "Delay between restart attempts.", + "format": "int64" + }, + "MaxAttempts": { + "type": "integer", + "description": "Maximum attempts to restart a given container before giving up\n(default value is 0, which is ignored).\n", + "format": "int64", + "default": 0 + }, + "Window": { + "type": "integer", + "description": "Windows is the time window used to evaluate the restart policy\n(default value is 0, which is unbounded).\n", + "format": "int64", + "default": 0 + } + }, + "description": "Specification for the restart policy which applies to containers\ncreated as part of this service.\n" + }, + "Placement": { + "type": "object", + "properties": { + "Constraints": { + "type": "array", + "description": "An array of constraint expressions to limit the set of nodes where\na task can be scheduled. Constraint expressions can either use a\n_match_ (`==`) or _exclude_ (`!=`) rule. Multiple constraints find\nnodes that satisfy every expression (AND match). Constraints can\nmatch node or Docker Engine labels as follows:\n\nnode attribute | matches | example\n---------------------|--------------------------------|-----------------------------------------------\n`node.id` | Node ID | `node.id==2ivku8v2gvtg4`\n`node.hostname` | Node hostname | `node.hostname!=node-2`\n`node.role` | Node role (`manager`/`worker`) | `node.role==manager`\n`node.platform.os` | Node operating system | `node.platform.os==windows`\n`node.platform.arch` | Node architecture | `node.platform.arch==x86_64`\n`node.labels` | User-defined node labels | `node.labels.security==high`\n`engine.labels` | Docker Engine's labels | `engine.labels.operatingsystem==ubuntu-14.04`\n\n`engine.labels` apply to Docker Engine labels like operating system,\ndrivers, etc. Swarm administrators add `node.labels` for operational\npurposes by using the [`node update endpoint`](#operation/NodeUpdate).\n", + "example": [ + "node.hostname!=node3.corp.example.com", + "node.role!=manager", + "node.labels.type==production", + "node.platform.os==linux", + "node.platform.arch==x86_64" + ], + "items": { + "type": "string" + } + }, + "Preferences": { + "type": "array", + "description": "Preferences provide a way to make the scheduler aware of factors\nsuch as topology. They are provided in order from highest to\nlowest precedence.\n", + "example": [ + { + "Spread": { + "SpreadDescriptor": "node.labels.datacenter" + } + }, + { + "Spread": { + "SpreadDescriptor": "node.labels.rack" + } + } + ], + "items": { + "type": "object", + "properties": { + "Spread": { + "type": "object", + "properties": { + "SpreadDescriptor": { + "type": "string", + "description": "label descriptor, such as `engine.labels.az`.\n" + } + } + } + } + } + }, + "MaxReplicas": { + "type": "integer", + "description": "Maximum number of replicas for per node (default value is 0, which\nis unlimited)\n", + "format": "int64", + "default": 0 + }, + "Platforms": { + "type": "array", + "description": "Platforms stores all the platforms that the service's image can\nrun on. This field is used in the platform filter for scheduling.\nIf empty, then the platform filter is off, meaning there are no\nscheduling restrictions.\n", + "items": { + "type": "object", + "properties": { + "Architecture": { + "type": "string", + "description": "Architecture represents the hardware architecture (for example,\n`x86_64`).\n", + "example": "x86_64" + }, + "OS": { + "type": "string", + "description": "OS represents the Operating System (for example, `linux` or `windows`).\n", + "example": "linux" + } + }, + "description": "Platform represents the platform (Arch/OS).\n" + } + } + } + }, + "ForceUpdate": { + "type": "integer", + "description": "A counter that triggers an update even if no relevant parameters have\nbeen changed.\n" + }, + "Runtime": { + "type": "string", + "description": "Runtime is the type of runtime specified for the task executor.\n" + }, + "Networks": { + "type": "array", + "description": "Specifies which networks the service should attach to.", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "The target network for attachment. Must be a network name or ID.\n" + }, + "Aliases": { + "type": "array", + "description": "Discoverable alternate names for the service on this network.\n", + "items": { + "type": "string" + } + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver attachment options for the network target.\n" + } + }, + "description": "Specifies how a service should be attached to a particular network.\n" + } + }, + "LogDriver": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "description": "Specifies the log driver to use for tasks created from this spec. If\nnot present, the default one for the swarm will be used, finally\nfalling back to the engine default if not specified.\n" + } + }, + "description": "User modifiable task configuration." + }, + "Mode": { + "type": "object", + "properties": { + "Replicated": { + "type": "object", + "properties": { + "Replicas": { + "type": "integer", + "format": "int64" + } + } + }, + "Global": { + "type": "object", + "properties": {} + }, + "ReplicatedJob": { + "type": "object", + "properties": { + "MaxConcurrent": { + "type": "integer", + "description": "The maximum number of replicas to run simultaneously.\n", + "format": "int64", + "default": 1 + }, + "TotalCompletions": { + "type": "integer", + "description": "The total number of replicas desired to reach the Completed\nstate. If unset, will default to the value of `MaxConcurrent`\n", + "format": "int64" + } + }, + "description": "The mode used for services with a finite number of tasks that run\nto a completed state.\n" + }, + "GlobalJob": { + "type": "object", + "properties": {}, + "description": "The mode used for services which run a task to the completed state\non each valid node.\n" + } + }, + "description": "Scheduling mode for the service." + }, + "UpdateConfig": { + "type": "object", + "properties": { + "Parallelism": { + "type": "integer", + "description": "Maximum number of tasks to be updated in one iteration (0 means\nunlimited parallelism).\n", + "format": "int64" + }, + "Delay": { + "type": "integer", + "description": "Amount of time between updates, in nanoseconds.", + "format": "int64" + }, + "FailureAction": { + "type": "string", + "description": "Action to take if an updated task fails to run, or stops running\nduring the update.\n", + "enum": [ + "continue", + "pause", + "rollback" + ] + }, + "Monitor": { + "type": "integer", + "description": "Amount of time to monitor each updated task for failures, in\nnanoseconds.\n", + "format": "int64" + }, + "MaxFailureRatio": { + "type": "number", + "description": "The fraction of tasks that may fail during an update before the\nfailure action is invoked, specified as a floating point number\nbetween 0 and 1.\n" + }, + "Order": { + "type": "string", + "description": "The order of operations when rolling out an updated task. Either\nthe old task is shut down before the new task is started, or the\nnew task is started before the old task is shut down.\n", + "enum": [ + "stop-first", + "start-first" + ] + } + }, + "description": "Specification for the update strategy of the service." + }, + "RollbackConfig": { + "type": "object", + "properties": { + "Parallelism": { + "type": "integer", + "description": "Maximum number of tasks to be rolled back in one iteration (0 means\nunlimited parallelism).\n", + "format": "int64" + }, + "Delay": { + "type": "integer", + "description": "Amount of time between rollback iterations, in nanoseconds.\n", + "format": "int64" + }, + "FailureAction": { + "type": "string", + "description": "Action to take if an rolled back task fails to run, or stops\nrunning during the rollback.\n", + "enum": [ + "continue", + "pause" + ] + }, + "Monitor": { + "type": "integer", + "description": "Amount of time to monitor each rolled back task for failures, in\nnanoseconds.\n", + "format": "int64" + }, + "MaxFailureRatio": { + "type": "number", + "description": "The fraction of tasks that may fail during a rollback before the\nfailure action is invoked, specified as a floating point number\nbetween 0 and 1.\n" + }, + "Order": { + "type": "string", + "description": "The order of operations when rolling back a task. Either the old\ntask is shut down before the new task is started, or the new task\nis started before the old task is shut down.\n", + "enum": [ + "stop-first", + "start-first" + ] + } + }, + "description": "Specification for the rollback strategy of the service." + }, + "Networks": { + "type": "array", + "description": "Specifies which networks the service should attach to.", + "items": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "The target network for attachment. Must be a network name or ID.\n" + }, + "Aliases": { + "type": "array", + "description": "Discoverable alternate names for the service on this network.\n", + "items": { + "type": "string" + } + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver attachment options for the network target.\n" + } + }, + "description": "Specifies how a service should be attached to a particular network.\n" + } + }, + "EndpointSpec": { + "type": "object", + "properties": { + "Mode": { + "type": "string", + "description": "The mode of resolution to use for internal load balancing between tasks.\n", + "default": "vip", + "enum": [ + "vip", + "dnsrr" + ] + }, + "Ports": { + "type": "array", + "description": "List of exposed ports that this service is accessible on from the\noutside. Ports can only be provided if `vip` resolution mode is used.\n", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Protocol": { + "type": "string", + "enum": [ + "tcp", + "udp", + "sctp" + ] + }, + "TargetPort": { + "type": "integer", + "description": "The port inside the container." + }, + "PublishedPort": { + "type": "integer", + "description": "The port on the swarm hosts." + }, + "PublishMode": { + "type": "string", + "description": "The mode in which port is published.\n\n


\n\n- \"ingress\" makes the target port accessible on every node,\n regardless of whether there is a task for the service running on\n that node or not.\n- \"host\" bypasses the routing mesh and publish the port directly on\n the swarm node where that service is running.\n", + "example": "ingress", + "default": "ingress", + "enum": [ + "ingress", + "host" + ] + } + } + } + } + }, + "description": "Properties that can be configured to access and load balance a service." + } + }, + "description": "User modifiable configuration for a service." + }, + "Endpoint": { + "type": "object", + "properties": { + "Spec": { + "type": "object", + "properties": { + "Mode": { + "type": "string", + "description": "The mode of resolution to use for internal load balancing between tasks.\n", + "default": "vip", + "enum": [ + "vip", + "dnsrr" + ] + }, + "Ports": { + "type": "array", + "description": "List of exposed ports that this service is accessible on from the\noutside. Ports can only be provided if `vip` resolution mode is used.\n", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Protocol": { + "type": "string", + "enum": [ + "tcp", + "udp", + "sctp" + ] + }, + "TargetPort": { + "type": "integer", + "description": "The port inside the container." + }, + "PublishedPort": { + "type": "integer", + "description": "The port on the swarm hosts." + }, + "PublishMode": { + "type": "string", + "description": "The mode in which port is published.\n\n


\n\n- \"ingress\" makes the target port accessible on every node,\n regardless of whether there is a task for the service running on\n that node or not.\n- \"host\" bypasses the routing mesh and publish the port directly on\n the swarm node where that service is running.\n", + "example": "ingress", + "default": "ingress", + "enum": [ + "ingress", + "host" + ] + } + } + } + } + }, + "description": "Properties that can be configured to access and load balance a service." + }, + "Ports": { + "type": "array", + "items": { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Protocol": { + "type": "string", + "enum": [ + "tcp", + "udp", + "sctp" + ] + }, + "TargetPort": { + "type": "integer", + "description": "The port inside the container." + }, + "PublishedPort": { + "type": "integer", + "description": "The port on the swarm hosts." + }, + "PublishMode": { + "type": "string", + "description": "The mode in which port is published.\n\n


\n\n- \"ingress\" makes the target port accessible on every node,\n regardless of whether there is a task for the service running on\n that node or not.\n- \"host\" bypasses the routing mesh and publish the port directly on\n the swarm node where that service is running.\n", + "example": "ingress", + "default": "ingress", + "enum": [ + "ingress", + "host" + ] + } + } + } + }, + "VirtualIPs": { + "type": "array", + "items": { + "type": "object", + "properties": { + "NetworkID": { + "type": "string" + }, + "Addr": { + "type": "string" + } + } + } + } + } + }, + "UpdateStatus": { + "type": "object", + "properties": { + "State": { + "type": "string", + "enum": [ + "updating", + "paused", + "completed" + ] + }, + "StartedAt": { + "type": "string", + "format": "dateTime" + }, + "CompletedAt": { + "type": "string", + "format": "dateTime" + }, + "Message": { + "type": "string" + } + }, + "description": "The status of a service update." + }, + "ServiceStatus": { + "type": "object", + "properties": { + "RunningTasks": { + "type": "integer", + "description": "The number of tasks for the service currently in the Running state.\n", + "format": "uint64", + "example": 7 + }, + "DesiredTasks": { + "type": "integer", + "description": "The number of tasks for the service desired to be running.\nFor replicated services, this is the replica count from the\nservice spec. For global services, this is computed by taking\ncount of all tasks for the service with a Desired State other\nthan Shutdown.\n", + "format": "uint64", + "example": 10 + }, + "CompletedTasks": { + "type": "integer", + "description": "The number of tasks for a job that are in the Completed state.\nThis field must be cross-referenced with the service type, as the\nvalue of 0 may mean the service is not in a job mode, or it may\nmean the job-mode service has no tasks yet Completed.\n", + "format": "uint64" + } + }, + "description": "The status of the service's tasks. Provided only when requested as\npart of a ServiceList operation.\n" + }, + "JobStatus": { + "type": "object", + "properties": { + "JobIteration": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "LastExecution": { + "type": "string", + "description": "The last time, as observed by the server, that this job was\nstarted.\n", + "format": "dateTime" + } + }, + "description": "The status of the service when it is in one of ReplicatedJob or\nGlobalJob modes. Absent on Replicated and Global mode services. The\nJobIteration is an ObjectVersion, but unlike the Service's version,\ndoes not need to be sent with an update request.\n" + } + }, + "example": { + "ID": "9mnpnzenvg8p8tdbtq4wvbkcz", + "Version": { + "Index": 19 + }, + "CreatedAt": "2016-06-07T21:05:51.880065305Z", + "UpdatedAt": "2016-06-07T21:07:29.962229872Z", + "Spec": { + "Name": "hopeful_cori", + "TaskTemplate": { + "ContainerSpec": { + "Image": "redis" + }, + "Resources": { + "Limits": {}, + "Reservations": {} + }, + "RestartPolicy": { + "Condition": "any", + "MaxAttempts": 0 + }, + "Placement": {}, + "ForceUpdate": 0 + }, + "Mode": { + "Replicated": { + "Replicas": 1 + } + }, + "UpdateConfig": { + "Parallelism": 1, + "Delay": 1000000000, + "FailureAction": "pause", + "Monitor": 15000000000, + "MaxFailureRatio": 0.15 + }, + "RollbackConfig": { + "Parallelism": 1, + "Delay": 1000000000, + "FailureAction": "pause", + "Monitor": 15000000000, + "MaxFailureRatio": 0.15 + }, + "EndpointSpec": { + "Mode": "vip", + "Ports": [ + { + "Protocol": "tcp", + "TargetPort": 6379, + "PublishedPort": 30001 + } + ] + } + }, + "Endpoint": { + "Spec": { + "Mode": "vip", + "Ports": [ + { + "Protocol": "tcp", + "TargetPort": 6379, + "PublishedPort": 30001 + } + ] + }, + "Ports": [ + { + "Protocol": "tcp", + "TargetPort": 6379, + "PublishedPort": 30001 + } + ], + "VirtualIPs": [ + { + "NetworkID": "4qvuz4ko70xaltuqbt8956gd1", + "Addr": "10.255.0.2/16" + }, + { + "NetworkID": "4qvuz4ko70xaltuqbt8956gd1", + "Addr": "10.255.0.3/16" + } + ] + } + } + }, + "ImageDeleteResponseItem": { + "type": "object", + "properties": { + "Untagged": { + "type": "string", + "description": "The image ID of an image that was untagged" + }, + "Deleted": { + "type": "string", + "description": "The image ID of an image that was deleted" + } + } + }, + "ServiceUpdateResponse": { + "type": "object", + "properties": { + "Warnings": { + "type": "array", + "description": "Optional warning messages", + "items": { + "type": "string" + } + } + }, + "example": { + "Warning": "unable to pin image doesnotexist:latest to digest: image library/doesnotexist:latest not found" + } + }, + "ContainerSummary": { + "type": "object", + "properties": { + "Id": { + "type": "string", + "description": "The ID of this container", + "x-go-name": "ID" + }, + "Names": { + "type": "array", + "description": "The names that this container has been given", + "items": { + "type": "string" + } + }, + "Image": { + "type": "string", + "description": "The name of the image used when creating this container" + }, + "ImageID": { + "type": "string", + "description": "The ID of the image that this container was created from" + }, + "Command": { + "type": "string", + "description": "Command to run when starting the container" + }, + "Created": { + "type": "integer", + "description": "When the container was created", + "format": "int64" + }, + "Ports": { + "type": "array", + "description": "The ports exposed by this container", + "items": { + "required": [ + "PrivatePort", + "Type" + ], + "type": "object", + "properties": { + "IP": { + "type": "string", + "description": "Host IP address that the container's port is mapped to", + "format": "ip-address" + }, + "PrivatePort": { + "type": "integer", + "description": "Port on the container", + "format": "uint16", + "nullable": false + }, + "PublicPort": { + "type": "integer", + "description": "Port exposed on the host", + "format": "uint16" + }, + "Type": { + "type": "string", + "nullable": false, + "enum": [ + "tcp", + "udp", + "sctp" + ] + } + }, + "description": "An open port on a container", + "example": { + "PrivatePort": 8080, + "PublicPort": 80, + "Type": "tcp" + } + } + }, + "SizeRw": { + "type": "integer", + "description": "The size of files that have been created or changed by this container", + "format": "int64" + }, + "SizeRootFs": { + "type": "integer", + "description": "The total size of all the files in this container", + "format": "int64" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "State": { + "type": "string", + "description": "The state of this container (e.g. `Exited`)" + }, + "Status": { + "type": "string", + "description": "Additional human-readable status of this container (e.g. `Exit 0`)" + }, + "HostConfig": { + "type": "object", + "properties": { + "NetworkMode": { + "type": "string" + } + } + }, + "NetworkSettings": { + "type": "object", + "properties": { + "Networks": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "IPAMConfig": { + "type": "object", + "properties": { + "IPv4Address": { + "type": "string", + "example": "172.20.30.33" + }, + "IPv6Address": { + "type": "string", + "example": "2001:db8:abcd::3033" + }, + "LinkLocalIPs": { + "type": "array", + "example": [ + "169.254.34.68", + "fe80::3468" + ], + "items": { + "type": "string" + } + } + }, + "description": "EndpointIPAMConfig represents an endpoint's IPAM configuration.\n", + "nullable": true, + "x-nullable": true + }, + "Links": { + "type": "array", + "example": [ + "container_1", + "container_2" + ], + "items": { + "type": "string" + } + }, + "Aliases": { + "type": "array", + "example": [ + "server_x", + "server_y" + ], + "items": { + "type": "string" + } + }, + "NetworkID": { + "type": "string", + "description": "Unique ID of the network.\n", + "example": "08754567f1f40222263eab4102e1c733ae697e8e354aa9cd6e18d7402835292a" + }, + "EndpointID": { + "type": "string", + "description": "Unique ID for the service endpoint in a Sandbox.\n", + "example": "b88f5b905aabf2893f3cbc4ee42d1ea7980bbc0a92e2c8922b1e1795298afb0b" + }, + "Gateway": { + "type": "string", + "description": "Gateway address for this network.\n", + "example": "172.17.0.1" + }, + "IPAddress": { + "type": "string", + "description": "IPv4 address.\n", + "example": "172.17.0.4" + }, + "IPPrefixLen": { + "type": "integer", + "description": "Mask length of the IPv4 address.\n", + "example": 16 + }, + "IPv6Gateway": { + "type": "string", + "description": "IPv6 gateway address.\n", + "example": "2001:db8:2::100" + }, + "GlobalIPv6Address": { + "type": "string", + "description": "Global IPv6 address.\n", + "example": "2001:db8::5689" + }, + "GlobalIPv6PrefixLen": { + "type": "integer", + "description": "Mask length of the global IPv6 address.\n", + "format": "int64", + "example": 64 + }, + "MacAddress": { + "type": "string", + "description": "MAC address for the endpoint on this network.\n", + "example": "02:42:ac:11:00:04" + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "DriverOpts is a mapping of driver options and values. These options\nare passed directly to the driver and are driver specific.\n", + "nullable": true, + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + } + }, + "description": "Configuration for a network endpoint." + } + } + }, + "description": "A summary of the container's network settings" + }, + "Mounts": { + "type": "array", + "items": { + "type": "object", + "properties": { + "Type": { + "type": "string", + "description": "The mount type:\n\n- `bind` a mount of a file or directory from the host into the container.\n- `volume` a docker volume with the given `Name`.\n- `tmpfs` a `tmpfs`.\n- `npipe` a named pipe from the host into the container.\n- `cluster` a Swarm cluster volume\n", + "example": "volume", + "enum": [ + "bind", + "volume", + "tmpfs", + "npipe", + "cluster" + ] + }, + "Name": { + "type": "string", + "description": "Name is the name reference to the underlying data defined by `Source`\ne.g., the volume name.\n", + "example": "myvolume" + }, + "Source": { + "type": "string", + "description": "Source location of the mount.\n\nFor volumes, this contains the storage location of the volume (within\n`/var/lib/docker/volumes/`). For bind-mounts, and `npipe`, this contains\nthe source (host) part of the bind-mount. For `tmpfs` mount points, this\nfield is empty.\n", + "example": "/var/lib/docker/volumes/myvolume/_data" + }, + "Destination": { + "type": "string", + "description": "Destination is the path relative to the container root (`/`) where\nthe `Source` is mounted inside the container.\n", + "example": "/usr/share/nginx/html/" + }, + "Driver": { + "type": "string", + "description": "Driver is the volume driver used to create the volume (if it is a volume).\n", + "example": "local" + }, + "Mode": { + "type": "string", + "description": "Mode is a comma separated list of options supplied by the user when\ncreating the bind/volume mount.\n\nThe default is platform-specific (`\"z\"` on Linux, empty on Windows).\n", + "example": "z" + }, + "RW": { + "type": "boolean", + "description": "Whether the mount is mounted writable (read-write).\n", + "example": true + }, + "Propagation": { + "type": "string", + "description": "Propagation describes how mounts are propagated from the host into the\nmount point, and vice-versa. Refer to the [Linux kernel documentation](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt)\nfor details. This field is not used on Windows.\n", + "example": "" + } + }, + "description": "MountPoint represents a mount point configuration inside the container.\nThis is used for reporting the mountpoints in use by a container.\n" + } + } + } + }, + "Driver": { + "required": [ + "Name" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver.", + "nullable": false, + "example": "some-driver" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Key/value map of driver-specific options.", + "nullable": false, + "example": { + "OptionA": "value for driver-specific option A", + "OptionB": "value for driver-specific option B" + } + } + }, + "description": "Driver represents a driver (network, logging, secrets)." + }, + "SecretSpec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "User-defined name of the secret." + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "Data": { + "type": "string", + "description": "Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5))\ndata to store as secret.\n\nThis field is only used to _create_ a secret, and is not returned by\nother endpoints.\n", + "example": "" + }, + "Driver": { + "required": [ + "Name" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver.", + "nullable": false, + "example": "some-driver" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Key/value map of driver-specific options.", + "nullable": false, + "example": { + "OptionA": "value for driver-specific option A", + "OptionB": "value for driver-specific option B" + } + } + }, + "description": "Driver represents a driver (network, logging, secrets)." + }, + "Templating": { + "required": [ + "Name" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver.", + "nullable": false, + "example": "some-driver" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Key/value map of driver-specific options.", + "nullable": false, + "example": { + "OptionA": "value for driver-specific option A", + "OptionB": "value for driver-specific option B" + } + } + }, + "description": "Driver represents a driver (network, logging, secrets)." + } + } + }, + "Secret": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "example": "blt1owaxmitz71s9v5zh81zun" + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "format": "dateTime", + "example": "2017-07-20T13:55:28.678958722Z" + }, + "UpdatedAt": { + "type": "string", + "format": "dateTime", + "example": "2017-07-20T13:55:28.678958722Z" + }, + "Spec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "User-defined name of the secret." + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.some-label": "some-value", + "com.example.some-other-label": "some-other-value" + } + }, + "Data": { + "type": "string", + "description": "Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5))\ndata to store as secret.\n\nThis field is only used to _create_ a secret, and is not returned by\nother endpoints.\n", + "example": "" + }, + "Driver": { + "required": [ + "Name" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver.", + "nullable": false, + "example": "some-driver" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Key/value map of driver-specific options.", + "nullable": false, + "example": { + "OptionA": "value for driver-specific option A", + "OptionB": "value for driver-specific option B" + } + } + }, + "description": "Driver represents a driver (network, logging, secrets)." + }, + "Templating": { + "required": [ + "Name" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver.", + "nullable": false, + "example": "some-driver" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Key/value map of driver-specific options.", + "nullable": false, + "example": { + "OptionA": "value for driver-specific option A", + "OptionB": "value for driver-specific option B" + } + } + }, + "description": "Driver represents a driver (network, logging, secrets)." + } + } + } + } + }, + "ConfigSpec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "User-defined name of the config." + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "Data": { + "type": "string", + "description": "Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5))\nconfig data.\n" + }, + "Templating": { + "required": [ + "Name" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver.", + "nullable": false, + "example": "some-driver" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Key/value map of driver-specific options.", + "nullable": false, + "example": { + "OptionA": "value for driver-specific option A", + "OptionB": "value for driver-specific option B" + } + } + }, + "description": "Driver represents a driver (network, logging, secrets)." + } + } + }, + "Config": { + "type": "object", + "properties": { + "ID": { + "type": "string" + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "format": "dateTime" + }, + "UpdatedAt": { + "type": "string", + "format": "dateTime" + }, + "Spec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "User-defined name of the config." + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata." + }, + "Data": { + "type": "string", + "description": "Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5))\nconfig data.\n" + }, + "Templating": { + "required": [ + "Name" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the driver.", + "nullable": false, + "example": "some-driver" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Key/value map of driver-specific options.", + "nullable": false, + "example": { + "OptionA": "value for driver-specific option A", + "OptionB": "value for driver-specific option B" + } + } + }, + "description": "Driver represents a driver (network, logging, secrets)." + } + } + } + } + }, + "ContainerState": { + "type": "object", + "properties": { + "Status": { + "type": "string", + "description": "String representation of the container state. Can be one of \"created\",\n\"running\", \"paused\", \"restarting\", \"removing\", \"exited\", or \"dead\".\n", + "example": "running", + "enum": [ + "created", + "running", + "paused", + "restarting", + "removing", + "exited", + "dead" + ] + }, + "Running": { + "type": "boolean", + "description": "Whether this container is running.\n\nNote that a running container can be _paused_. The `Running` and `Paused`\nbooleans are not mutually exclusive:\n\nWhen pausing a container (on Linux), the freezer cgroup is used to suspend\nall processes in the container. Freezing the process requires the process to\nbe running. As a result, paused containers are both `Running` _and_ `Paused`.\n\nUse the `Status` field instead to determine if a container's state is \"running\".\n", + "example": true + }, + "Paused": { + "type": "boolean", + "description": "Whether this container is paused.", + "example": false + }, + "Restarting": { + "type": "boolean", + "description": "Whether this container is restarting.", + "example": false + }, + "OOMKilled": { + "type": "boolean", + "description": "Whether a process within this container has been killed because it ran\nout of memory since the container was last started.\n", + "example": false + }, + "Dead": { + "type": "boolean", + "example": false + }, + "Pid": { + "type": "integer", + "description": "The process ID of this container", + "example": 1234 + }, + "ExitCode": { + "type": "integer", + "description": "The last exit code of this container", + "example": 0 + }, + "Error": { + "type": "string" + }, + "StartedAt": { + "type": "string", + "description": "The time when this container was last started.", + "example": "2020-01-06T09:06:59.461876391Z" + }, + "FinishedAt": { + "type": "string", + "description": "The time when this container last exited.", + "example": "2020-01-06T09:07:59.461876391Z" + }, + "Health": { + "type": "object", + "properties": { + "Status": { + "type": "string", + "description": "Status is one of `none`, `starting`, `healthy` or `unhealthy`\n\n- \"none\" Indicates there is no healthcheck\n- \"starting\" Starting indicates that the container is not yet ready\n- \"healthy\" Healthy indicates that the container is running correctly\n- \"unhealthy\" Unhealthy indicates that the container has a problem\n", + "example": "healthy", + "enum": [ + "none", + "starting", + "healthy", + "unhealthy" + ] + }, + "FailingStreak": { + "type": "integer", + "description": "FailingStreak is the number of consecutive failures", + "example": 0 + }, + "Log": { + "type": "array", + "description": "Log contains the last few results (oldest first)\n", + "items": { + "type": "object", + "properties": { + "Start": { + "type": "string", + "description": "Date and time at which this check started in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "date-time", + "example": "2020-01-04T10:44:24.496525531Z" + }, + "End": { + "type": "string", + "description": "Date and time at which this check ended in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2020-01-04T10:45:21.364524523Z" + }, + "ExitCode": { + "type": "integer", + "description": "ExitCode meanings:\n\n- `0` healthy\n- `1` unhealthy\n- `2` reserved (considered unhealthy)\n- other values: error running probe\n", + "example": 0 + }, + "Output": { + "type": "string", + "description": "Output from last check" + } + }, + "description": "HealthcheckResult stores information about a single run of a healthcheck probe\n", + "nullable": true, + "x-nullable": true + } + } + }, + "description": "Health stores information about the container's healthcheck results.\n", + "nullable": true, + "x-nullable": true + } + }, + "description": "ContainerState stores container's running state. It's part of ContainerJSONBase\nand will be returned by the \"inspect\" command.\n", + "nullable": true, + "x-nullable": true + }, + "ContainerCreateResponse": { + "title": "ContainerCreateResponse", + "required": [ + "Id", + "Warnings" + ], + "type": "object", + "properties": { + "Id": { + "type": "string", + "description": "The ID of the created container", + "nullable": false, + "example": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743" + }, + "Warnings": { + "type": "array", + "description": "Warnings encountered when creating the container", + "nullable": false, + "example": [], + "items": { + "type": "string" + } + } + }, + "description": "OK response to ContainerCreate operation", + "x-go-name": "CreateResponse" + }, + "ContainerWaitResponse": { + "title": "ContainerWaitResponse", + "required": [ + "StatusCode" + ], + "type": "object", + "properties": { + "StatusCode": { + "type": "integer", + "description": "Exit code of the container", + "format": "int64", + "nullable": false + }, + "Error": { + "type": "object", + "properties": { + "Message": { + "type": "string", + "description": "Details of an error" + } + }, + "description": "container waiting error, if any", + "x-go-name": "WaitExitError" + } + }, + "description": "OK response to ContainerWait operation", + "x-go-name": "WaitResponse" + }, + "ContainerWaitExitError": { + "type": "object", + "properties": { + "Message": { + "type": "string", + "description": "Details of an error" + } + }, + "description": "container waiting error, if any", + "x-go-name": "WaitExitError" + }, + "SystemVersion": { + "type": "object", + "properties": { + "Platform": { + "required": [ + "Name" + ], + "type": "object", + "properties": { + "Name": { + "type": "string" + } + } + }, + "Components": { + "type": "array", + "description": "Information about system components\n", + "items": { + "required": [ + "Name", + "Version" + ], + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the component\n", + "example": "Engine" + }, + "Version": { + "type": "string", + "description": "Version of the component\n", + "nullable": false, + "example": "19.03.12" + }, + "Details": { + "type": "object", + "properties": {}, + "description": "Key/value pairs of strings with additional information about the\ncomponent. These values are intended for informational purposes\nonly, and their content is not defined, and not part of the API\nspecification.\n\nThese messages can be printed by the client as information to the user.\n", + "nullable": true + } + }, + "x-go-name": "ComponentVersion" + } + }, + "Version": { + "type": "string", + "description": "The version of the daemon", + "example": "19.03.12" + }, + "ApiVersion": { + "type": "string", + "description": "The default (and highest) API version that is supported by the daemon\n", + "example": "1.40" + }, + "MinAPIVersion": { + "type": "string", + "description": "The minimum API version that is supported by the daemon\n", + "example": "1.12" + }, + "GitCommit": { + "type": "string", + "description": "The Git commit of the source code that was used to build the daemon\n", + "example": "48a66213fe" + }, + "GoVersion": { + "type": "string", + "description": "The version Go used to compile the daemon, and the version of the Go\nruntime in use.\n", + "example": "go1.13.14" + }, + "Os": { + "type": "string", + "description": "The operating system that the daemon is running on (\"linux\" or \"windows\")\n", + "example": "linux" + }, + "Arch": { + "type": "string", + "description": "The architecture that the daemon is running on\n", + "example": "amd64" + }, + "KernelVersion": { + "type": "string", + "description": "The kernel version (`uname -r`) that the daemon is running on.\n\nThis field is omitted when empty.\n", + "example": "4.19.76-linuxkit" + }, + "Experimental": { + "type": "boolean", + "description": "Indicates if the daemon is started with experimental features enabled.\n\nThis field is omitted when empty / false.\n", + "example": true + }, + "BuildTime": { + "type": "string", + "description": "The date and time that the daemon was compiled.\n", + "example": "2020-06-22T15:49:27.000000000+00:00" + } + }, + "description": "Response of Engine API: GET \"/version\"\n" + }, + "SystemInfo": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "Unique identifier of the daemon.\n\n


\n\n> **Note**: The format of the ID itself is not part of the API, and\n> should not be considered stable.\n", + "example": "7TRN:IPZB:QYBB:VPBQ:UMPP:KARE:6ZNR:XE6T:7EWV:PKF4:ZOJD:TPYS" + }, + "Containers": { + "type": "integer", + "description": "Total number of containers on the host.", + "example": 14 + }, + "ContainersRunning": { + "type": "integer", + "description": "Number of containers with status `\"running\"`.\n", + "example": 3 + }, + "ContainersPaused": { + "type": "integer", + "description": "Number of containers with status `\"paused\"`.\n", + "example": 1 + }, + "ContainersStopped": { + "type": "integer", + "description": "Number of containers with status `\"stopped\"`.\n", + "example": 10 + }, + "Images": { + "type": "integer", + "description": "Total number of images on the host.\n\nBoth _tagged_ and _untagged_ (dangling) images are counted.\n", + "example": 508 + }, + "Driver": { + "type": "string", + "description": "Name of the storage driver in use.", + "example": "overlay2" + }, + "DriverStatus": { + "type": "array", + "description": "Information specific to the storage driver, provided as\n\"label\" / \"value\" pairs.\n\nThis information is provided by the storage driver, and formatted\nin a way consistent with the output of `docker info` on the command\nline.\n\n


\n\n> **Note**: The information returned in this field, including the\n> formatting of values and labels, should not be considered stable,\n> and may change without notice.\n", + "example": [ + [ + "Backing Filesystem", + "extfs" + ], + [ + "Supports d_type", + "true" + ], + [ + "Native Overlay Diff", + "true" + ] + ], + "items": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "DockerRootDir": { + "type": "string", + "description": "Root directory of persistent Docker state.\n\nDefaults to `/var/lib/docker` on Linux, and `C:\\ProgramData\\docker`\non Windows.\n", + "example": "/var/lib/docker" + }, + "Plugins": { + "type": "object", + "properties": { + "Volume": { + "type": "array", + "description": "Names of available volume-drivers, and network-driver plugins.", + "example": [ + "local" + ], + "items": { + "type": "string" + } + }, + "Network": { + "type": "array", + "description": "Names of available network-drivers, and network-driver plugins.", + "example": [ + "bridge", + "host", + "ipvlan", + "macvlan", + "null", + "overlay" + ], + "items": { + "type": "string" + } + }, + "Authorization": { + "type": "array", + "description": "Names of available authorization plugins.", + "example": [ + "img-authz-plugin", + "hbm" + ], + "items": { + "type": "string" + } + }, + "Log": { + "type": "array", + "description": "Names of available logging-drivers, and logging-driver plugins.", + "example": [ + "awslogs", + "fluentd", + "gcplogs", + "gelf", + "journald", + "json-file", + "splunk", + "syslog" + ], + "items": { + "type": "string" + } + } + }, + "description": "Available plugins per type.\n\n


\n\n> **Note**: Only unmanaged (V1) plugins are included in this list.\n> V1 plugins are \"lazily\" loaded, and are not returned in this list\n> if there is no resource using the plugin.\n" + }, + "MemoryLimit": { + "type": "boolean", + "description": "Indicates if the host has memory limit support enabled.", + "example": true + }, + "SwapLimit": { + "type": "boolean", + "description": "Indicates if the host has memory swap limit support enabled.", + "example": true + }, + "KernelMemoryTCP": { + "type": "boolean", + "description": "Indicates if the host has kernel memory TCP limit support enabled. This\nfield is omitted if not supported.\n\nKernel memory TCP limits are not supported when using cgroups v2, which\ndoes not support the corresponding `memory.kmem.tcp.limit_in_bytes` cgroup.\n", + "example": true + }, + "CpuCfsPeriod": { + "type": "boolean", + "description": "Indicates if CPU CFS(Completely Fair Scheduler) period is supported by\nthe host.\n", + "example": true + }, + "CpuCfsQuota": { + "type": "boolean", + "description": "Indicates if CPU CFS(Completely Fair Scheduler) quota is supported by\nthe host.\n", + "example": true + }, + "CPUShares": { + "type": "boolean", + "description": "Indicates if CPU Shares limiting is supported by the host.\n", + "example": true + }, + "CPUSet": { + "type": "boolean", + "description": "Indicates if CPUsets (cpuset.cpus, cpuset.mems) are supported by the host.\n\nSee [cpuset(7)](https://www.kernel.org/doc/Documentation/cgroup-v1/cpusets.txt)\n", + "example": true + }, + "PidsLimit": { + "type": "boolean", + "description": "Indicates if the host kernel has PID limit support enabled.", + "example": true + }, + "OomKillDisable": { + "type": "boolean", + "description": "Indicates if OOM killer disable is supported on the host." + }, + "IPv4Forwarding": { + "type": "boolean", + "description": "Indicates IPv4 forwarding is enabled.", + "example": true + }, + "BridgeNfIptables": { + "type": "boolean", + "description": "Indicates if `bridge-nf-call-iptables` is available on the host.", + "example": true + }, + "BridgeNfIp6tables": { + "type": "boolean", + "description": "Indicates if `bridge-nf-call-ip6tables` is available on the host.", + "example": true + }, + "Debug": { + "type": "boolean", + "description": "Indicates if the daemon is running in debug-mode / with debug-level\nlogging enabled.\n", + "example": true + }, + "NFd": { + "type": "integer", + "description": "The total number of file Descriptors in use by the daemon process.\n\nThis information is only returned if debug-mode is enabled.\n", + "example": 64 + }, + "NGoroutines": { + "type": "integer", + "description": "The number of goroutines that currently exist.\n\nThis information is only returned if debug-mode is enabled.\n", + "example": 174 + }, + "SystemTime": { + "type": "string", + "description": "Current system-time in [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt)\nformat with nano-seconds.\n", + "example": "2017-08-08T20:28:29.06202363Z" + }, + "LoggingDriver": { + "type": "string", + "description": "The logging driver to use as a default for new containers.\n" + }, + "CgroupDriver": { + "type": "string", + "description": "The driver to use for managing cgroups.\n", + "example": "cgroupfs", + "default": "cgroupfs", + "enum": [ + "cgroupfs", + "systemd", + "none" + ] + }, + "CgroupVersion": { + "type": "string", + "description": "The version of the cgroup.\n", + "example": "1", + "default": "1", + "enum": [ + "1", + "2" + ] + }, + "NEventsListener": { + "type": "integer", + "description": "Number of event listeners subscribed.", + "example": 30 + }, + "KernelVersion": { + "type": "string", + "description": "Kernel version of the host.\n\nOn Linux, this information obtained from `uname`. On Windows this\ninformation is queried from the HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Windows NT\\\\CurrentVersion\\\\\nregistry value, for example _\"10.0 14393 (14393.1198.amd64fre.rs1_release_sec.170427-1353)\"_.\n", + "example": "4.9.38-moby" + }, + "OperatingSystem": { + "type": "string", + "description": "Name of the host's operating system, for example: \"Ubuntu 16.04.2 LTS\"\nor \"Windows Server 2016 Datacenter\"\n", + "example": "Alpine Linux v3.5" + }, + "OSVersion": { + "type": "string", + "description": "Version of the host's operating system\n\n


\n\n> **Note**: The information returned in this field, including its\n> very existence, and the formatting of values, should not be considered\n> stable, and may change without notice.\n", + "example": "16.04" + }, + "OSType": { + "type": "string", + "description": "Generic type of the operating system of the host, as returned by the\nGo runtime (`GOOS`).\n\nCurrently returned values are \"linux\" and \"windows\". A full list of\npossible values can be found in the [Go documentation](https://go.dev/doc/install/source#environment).\n", + "example": "linux" + }, + "Architecture": { + "type": "string", + "description": "Hardware architecture of the host, as returned by the Go runtime\n(`GOARCH`).\n\nA full list of possible values can be found in the [Go documentation](https://go.dev/doc/install/source#environment).\n", + "example": "x86_64" + }, + "NCPU": { + "type": "integer", + "description": "The number of logical CPUs usable by the daemon.\n\nThe number of available CPUs is checked by querying the operating\nsystem when the daemon starts. Changes to operating system CPU\nallocation after the daemon is started are not reflected.\n", + "example": 4 + }, + "MemTotal": { + "type": "integer", + "description": "Total amount of physical memory available on the host, in bytes.\n", + "format": "int64", + "example": 2095882240 + }, + "IndexServerAddress": { + "type": "string", + "description": "Address / URL of the index server that is used for image search,\nand as a default for user authentication for Docker Hub and Docker Cloud.\n", + "example": "https://index.docker.io/v1/", + "default": "https://index.docker.io/v1/" + }, + "RegistryConfig": { + "type": "object", + "properties": { + "AllowNondistributableArtifactsCIDRs": { + "type": "array", + "description": "List of IP ranges to which nondistributable artifacts can be pushed,\nusing the CIDR syntax [RFC 4632](https://tools.ietf.org/html/4632).\n\nSome images (for example, Windows base images) contain artifacts\nwhose distribution is restricted by license. When these images are\npushed to a registry, restricted artifacts are not included.\n\nThis configuration override this behavior, and enables the daemon to\npush nondistributable artifacts to all registries whose resolved IP\naddress is within the subnet described by the CIDR syntax.\n\nThis option is useful when pushing images containing\nnondistributable artifacts to a registry on an air-gapped network so\nhosts on that network can pull the images without connecting to\nanother server.\n\n> **Warning**: Nondistributable artifacts typically have restrictions\n> on how and where they can be distributed and shared. Only use this\n> feature to push artifacts to private registries and ensure that you\n> are in compliance with any terms that cover redistributing\n> nondistributable artifacts.\n", + "example": [ + "::1/128", + "127.0.0.0/8" + ], + "items": { + "type": "string" + } + }, + "AllowNondistributableArtifactsHostnames": { + "type": "array", + "description": "List of registry hostnames to which nondistributable artifacts can be\npushed, using the format `[:]` or `[:]`.\n\nSome images (for example, Windows base images) contain artifacts\nwhose distribution is restricted by license. When these images are\npushed to a registry, restricted artifacts are not included.\n\nThis configuration override this behavior for the specified\nregistries.\n\nThis option is useful when pushing images containing\nnondistributable artifacts to a registry on an air-gapped network so\nhosts on that network can pull the images without connecting to\nanother server.\n\n> **Warning**: Nondistributable artifacts typically have restrictions\n> on how and where they can be distributed and shared. Only use this\n> feature to push artifacts to private registries and ensure that you\n> are in compliance with any terms that cover redistributing\n> nondistributable artifacts.\n", + "example": [ + "registry.internal.corp.example.com:3000", + "[2001:db8:a0b:12f0::1]:443" + ], + "items": { + "type": "string" + } + }, + "InsecureRegistryCIDRs": { + "type": "array", + "description": "List of IP ranges of insecure registries, using the CIDR syntax\n([RFC 4632](https://tools.ietf.org/html/4632)). Insecure registries\naccept un-encrypted (HTTP) and/or untrusted (HTTPS with certificates\nfrom unknown CAs) communication.\n\nBy default, local registries (`127.0.0.0/8`) are configured as\ninsecure. All other registries are secure. Communicating with an\ninsecure registry is not possible if the daemon assumes that registry\nis secure.\n\nThis configuration override this behavior, insecure communication with\nregistries whose resolved IP address is within the subnet described by\nthe CIDR syntax.\n\nRegistries can also be marked insecure by hostname. Those registries\nare listed under `IndexConfigs` and have their `Secure` field set to\n`false`.\n\n> **Warning**: Using this option can be useful when running a local\n> registry, but introduces security vulnerabilities. This option\n> should therefore ONLY be used for testing purposes. For increased\n> security, users should add their CA to their system's list of trusted\n> CAs instead of enabling this option.\n", + "example": [ + "::1/128", + "127.0.0.0/8" + ], + "items": { + "type": "string" + } + }, + "IndexConfigs": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the registry, such as \"docker.io\".\n", + "example": "docker.io" + }, + "Mirrors": { + "type": "array", + "description": "List of mirrors, expressed as URIs.\n", + "example": [ + "https://hub-mirror.corp.example.com:5000/", + "https://registry-2.docker.io/", + "https://registry-3.docker.io/" + ], + "items": { + "type": "string" + } + }, + "Secure": { + "type": "boolean", + "description": "Indicates if the registry is part of the list of insecure\nregistries.\n\nIf `false`, the registry is insecure. Insecure registries accept\nun-encrypted (HTTP) and/or untrusted (HTTPS with certificates from\nunknown CAs) communication.\n\n> **Warning**: Insecure registries can be useful when running a local\n> registry. However, because its use creates security vulnerabilities\n> it should ONLY be enabled for testing purposes. For increased\n> security, users should add their CA to their system's list of\n> trusted CAs instead of enabling this option.\n", + "example": true + }, + "Official": { + "type": "boolean", + "description": "Indicates whether this is an official registry (i.e., Docker Hub / docker.io)\n", + "example": true + } + }, + "description": "IndexInfo contains information about a registry.", + "nullable": true, + "x-nullable": true + }, + "example": { + "127.0.0.1:5000": { + "Name": "127.0.0.1:5000", + "Mirrors": [], + "Secure": false, + "Official": false + }, + "[2001:db8:a0b:12f0::1]:80": { + "Name": "[2001:db8:a0b:12f0::1]:80", + "Mirrors": [], + "Secure": false, + "Official": false + }, + "docker.io": { + "Name": "docker.io", + "Mirrors": [ + "https://hub-mirror.corp.example.com:5000/" + ], + "Secure": true, + "Official": true + }, + "registry.internal.corp.example.com:3000": { + "Name": "registry.internal.corp.example.com:3000", + "Mirrors": [], + "Secure": false, + "Official": false + } + } + }, + "Mirrors": { + "type": "array", + "description": "List of registry URLs that act as a mirror for the official\n(`docker.io`) registry.\n", + "example": [ + "https://hub-mirror.corp.example.com:5000/", + "https://[2001:db8:a0b:12f0::1]/" + ], + "items": { + "type": "string" + } + } + }, + "description": "RegistryServiceConfig stores daemon registry services configuration.\n", + "nullable": true, + "x-nullable": true + }, + "GenericResources": { + "type": "array", + "description": "User-defined resources can be either Integer resources (e.g, `SSD=3`) or\nString resources (e.g, `GPU=UUID1`).\n", + "example": [ + { + "DiscreteResourceSpec": { + "Kind": "SSD", + "Value": 3 + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID1" + } + }, + { + "NamedResourceSpec": { + "Kind": "GPU", + "Value": "UUID2" + } + } + ], + "items": { + "type": "object", + "properties": { + "NamedResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "string" + } + } + }, + "DiscreteResourceSpec": { + "type": "object", + "properties": { + "Kind": { + "type": "string" + }, + "Value": { + "type": "integer", + "format": "int64" + } + } + } + } + } + }, + "HttpProxy": { + "type": "string", + "description": "HTTP-proxy configured for the daemon. This value is obtained from the\n[`HTTP_PROXY`](https://www.gnu.org/software/wget/manual/html_node/Proxies.html) environment variable.\nCredentials ([user info component](https://tools.ietf.org/html/rfc3986#section-3.2.1)) in the proxy URL\nare masked in the API response.\n\nContainers do not automatically inherit this configuration.\n", + "example": "http://xxxxx:xxxxx@proxy.corp.example.com:8080" + }, + "HttpsProxy": { + "type": "string", + "description": "HTTPS-proxy configured for the daemon. This value is obtained from the\n[`HTTPS_PROXY`](https://www.gnu.org/software/wget/manual/html_node/Proxies.html) environment variable.\nCredentials ([user info component](https://tools.ietf.org/html/rfc3986#section-3.2.1)) in the proxy URL\nare masked in the API response.\n\nContainers do not automatically inherit this configuration.\n", + "example": "https://xxxxx:xxxxx@proxy.corp.example.com:4443" + }, + "NoProxy": { + "type": "string", + "description": "Comma-separated list of domain extensions for which no proxy should be\nused. This value is obtained from the [`NO_PROXY`](https://www.gnu.org/software/wget/manual/html_node/Proxies.html)\nenvironment variable.\n\nContainers do not automatically inherit this configuration.\n", + "example": "*.local, 169.254/16" + }, + "Name": { + "type": "string", + "description": "Hostname of the host.", + "example": "node5.corp.example.com" + }, + "Labels": { + "type": "array", + "description": "User-defined labels (key/value metadata) as set on the daemon.\n\n


\n\n> **Note**: When part of a Swarm, nodes can both have _daemon_ labels,\n> set through the daemon configuration, and _node_ labels, set from a\n> manager node in the Swarm. Node labels are not included in this\n> field. Node labels can be retrieved using the `/nodes/(id)` endpoint\n> on a manager node in the Swarm.\n", + "example": [ + "storage=ssd", + "production" + ], + "items": { + "type": "string" + } + }, + "ExperimentalBuild": { + "type": "boolean", + "description": "Indicates if experimental features are enabled on the daemon.\n", + "example": true + }, + "ServerVersion": { + "type": "string", + "description": "Version string of the daemon.\n", + "example": "24.0.2" + }, + "Runtimes": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "path": { + "type": "string", + "description": "Name and, optional, path, of the OCI executable binary.\n\nIf the path is omitted, the daemon searches the host's `$PATH` for the\nbinary and uses the first result.\n", + "example": "/usr/local/bin/my-oci-runtime" + }, + "runtimeArgs": { + "type": "array", + "description": "List of command-line arguments to pass to the runtime when invoked.\n", + "nullable": true, + "example": [ + "--debug", + "--systemd-cgroup=false" + ], + "items": { + "type": "string" + } + } + }, + "description": "Runtime describes an [OCI compliant](https://github.com/opencontainers/runtime-spec)\nruntime.\n\nThe runtime is invoked by the daemon via the `containerd` daemon. OCI\nruntimes act as an interface to the Linux kernel namespaces, cgroups,\nand SELinux.\n" + }, + "description": "List of [OCI compliant](https://github.com/opencontainers/runtime-spec)\nruntimes configured on the daemon. Keys hold the \"name\" used to\nreference the runtime.\n\nThe Docker daemon relies on an OCI compliant runtime (invoked via the\n`containerd` daemon) as its interface to the Linux kernel namespaces,\ncgroups, and SELinux.\n\nThe default runtime is `runc`, and automatically configured. Additional\nruntimes can be configured by the user and will be listed here.\n", + "example": { + "runc": { + "path": "runc" + }, + "runc-master": { + "path": "/go/bin/runc" + }, + "custom": { + "path": "/usr/local/bin/my-oci-runtime", + "runtimeArgs": [ + "--debug", + "--systemd-cgroup=false" + ] + } + } + }, + "DefaultRuntime": { + "type": "string", + "description": "Name of the default OCI runtime that is used when starting containers.\n\nThe default can be overridden per-container at create time.\n", + "example": "runc", + "default": "runc" + }, + "Swarm": { + "type": "object", + "properties": { + "NodeID": { + "type": "string", + "description": "Unique identifier of for this node in the swarm.", + "example": "k67qz4598weg5unwwffg6z1m1", + "default": "" + }, + "NodeAddr": { + "type": "string", + "description": "IP address at which this node can be reached by other nodes in the\nswarm.\n", + "example": "10.0.0.46", + "default": "" + }, + "LocalNodeState": { + "type": "string", + "description": "Current local status of this node.", + "example": "active", + "default": "", + "enum": [ + "", + "inactive", + "pending", + "active", + "error", + "locked" + ] + }, + "ControlAvailable": { + "type": "boolean", + "example": true, + "default": false + }, + "Error": { + "type": "string", + "default": "" + }, + "RemoteManagers": { + "type": "array", + "description": "List of ID's and addresses of other managers in the swarm.\n", + "nullable": true, + "example": [ + { + "NodeID": "71izy0goik036k48jg985xnds", + "Addr": "10.0.0.158:2377" + }, + { + "NodeID": "79y6h1o4gv8n120drcprv5nmc", + "Addr": "10.0.0.159:2377" + }, + { + "NodeID": "k67qz4598weg5unwwffg6z1m1", + "Addr": "10.0.0.46:2377" + } + ], + "items": { + "type": "object", + "properties": { + "NodeID": { + "type": "string", + "description": "Unique identifier of for this node in the swarm." + }, + "Addr": { + "type": "string", + "description": "IP address and ports at which this node can be reached.\n" + } + }, + "description": "Represents a peer-node in the swarm" + } + }, + "Nodes": { + "type": "integer", + "description": "Total number of nodes in the swarm.", + "nullable": true, + "example": 4 + }, + "Managers": { + "type": "integer", + "description": "Total number of managers in the swarm.", + "nullable": true, + "example": 3 + }, + "Cluster": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "The ID of the swarm.", + "example": "abajmipo7b4xz5ip2nrla6b11" + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "description": "Date and time at which the swarm was initialised in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2016-08-18T10:44:24.496525531Z" + }, + "UpdatedAt": { + "type": "string", + "description": "Date and time at which the swarm was last updated in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2017-08-09T07:09:37.632105588Z" + }, + "Spec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the swarm.", + "example": "default" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.corp.type": "production", + "com.example.corp.department": "engineering" + } + }, + "Orchestration": { + "type": "object", + "properties": { + "TaskHistoryRetentionLimit": { + "type": "integer", + "description": "The number of historic tasks to keep per instance or node. If\nnegative, never remove completed or failed tasks.\n", + "format": "int64", + "example": 10 + } + }, + "description": "Orchestration configuration.", + "nullable": true + }, + "Raft": { + "type": "object", + "properties": { + "SnapshotInterval": { + "type": "integer", + "description": "The number of log entries between snapshots.", + "format": "uint64", + "example": 10000 + }, + "KeepOldSnapshots": { + "type": "integer", + "description": "The number of snapshots to keep beyond the current snapshot.\n", + "format": "uint64" + }, + "LogEntriesForSlowFollowers": { + "type": "integer", + "description": "The number of log entries to keep around to sync up slow followers\nafter a snapshot is created.\n", + "format": "uint64", + "example": 500 + }, + "ElectionTick": { + "type": "integer", + "description": "The number of ticks that a follower will wait for a message from\nthe leader before becoming a candidate and starting an election.\n`ElectionTick` must be greater than `HeartbeatTick`.\n\nA tick currently defaults to one second, so these translate\ndirectly to seconds currently, but this is NOT guaranteed.\n", + "example": 3 + }, + "HeartbeatTick": { + "type": "integer", + "description": "The number of ticks between heartbeats. Every HeartbeatTick ticks,\nthe leader will send a heartbeat to the followers.\n\nA tick currently defaults to one second, so these translate\ndirectly to seconds currently, but this is NOT guaranteed.\n", + "example": 1 + } + }, + "description": "Raft configuration." + }, + "Dispatcher": { + "type": "object", + "properties": { + "HeartbeatPeriod": { + "type": "integer", + "description": "The delay for an agent to send a heartbeat to the dispatcher.\n", + "format": "int64", + "example": 5000000000 + } + }, + "description": "Dispatcher configuration.", + "nullable": true + }, + "CAConfig": { + "type": "object", + "properties": { + "NodeCertExpiry": { + "type": "integer", + "description": "The duration node certificates are issued for.", + "format": "int64", + "example": 7776000000000000 + }, + "ExternalCAs": { + "type": "array", + "description": "Configuration for forwarding signing requests to an external\ncertificate authority.\n", + "items": { + "type": "object", + "properties": { + "Protocol": { + "type": "string", + "description": "Protocol for communication with the external CA (currently\nonly `cfssl` is supported).\n", + "default": "cfssl", + "enum": [ + "cfssl" + ] + }, + "URL": { + "type": "string", + "description": "URL where certificate signing requests should be sent.\n" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "An object with key/value pairs that are interpreted as\nprotocol-specific options for the external CA driver.\n" + }, + "CACert": { + "type": "string", + "description": "The root CA certificate (in PEM format) this external CA uses\nto issue TLS certificates (assumed to be to the current swarm\nroot CA certificate if not provided).\n" + } + } + } + }, + "SigningCACert": { + "type": "string", + "description": "The desired signing CA certificate for all swarm node TLS leaf\ncertificates, in PEM format.\n" + }, + "SigningCAKey": { + "type": "string", + "description": "The desired signing CA key for all swarm node TLS leaf certificates,\nin PEM format.\n" + }, + "ForceRotate": { + "type": "integer", + "description": "An integer whose purpose is to force swarm to generate a new\nsigning CA certificate and key, if none have been specified in\n`SigningCACert` and `SigningCAKey`\n", + "format": "uint64" + } + }, + "description": "CA configuration.", + "nullable": true + }, + "EncryptionConfig": { + "type": "object", + "properties": { + "AutoLockManagers": { + "type": "boolean", + "description": "If set, generate a key and use it to lock data stored on the\nmanagers.\n", + "example": false + } + }, + "description": "Parameters related to encryption-at-rest." + }, + "TaskDefaults": { + "type": "object", + "properties": { + "LogDriver": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "The log driver to use as a default for new tasks.\n", + "example": "json-file" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver-specific options for the selected log driver, specified\nas key/value pairs.\n", + "example": { + "max-file": "10", + "max-size": "100m" + } + } + }, + "description": "The log driver to use for tasks created in the orchestrator if\nunspecified by a service.\n\nUpdating this value only affects new tasks. Existing tasks continue\nto use their previously configured log driver until recreated.\n" + } + }, + "description": "Defaults for creating tasks in this cluster." + } + }, + "description": "User modifiable swarm configuration." + }, + "TLSInfo": { + "type": "object", + "properties": { + "TrustRoot": { + "type": "string", + "description": "The root CA certificate(s) that are used to validate leaf TLS\ncertificates.\n" + }, + "CertIssuerSubject": { + "type": "string", + "description": "The base64-url-safe-encoded raw subject bytes of the issuer." + }, + "CertIssuerPublicKey": { + "type": "string", + "description": "The base64-url-safe-encoded raw public key bytes of the issuer.\n" + } + }, + "description": "Information about the issuer of leaf TLS certificates and the trusted root\nCA certificate.\n", + "example": { + "TrustRoot": "-----BEGIN CERTIFICATE-----\nMIIBajCCARCgAwIBAgIUbYqrLSOSQHoxD8CwG6Bi2PJi9c8wCgYIKoZIzj0EAwIw\nEzERMA8GA1UEAxMIc3dhcm0tY2EwHhcNMTcwNDI0MjE0MzAwWhcNMzcwNDE5MjE0\nMzAwWjATMREwDwYDVQQDEwhzd2FybS1jYTBZMBMGByqGSM49AgEGCCqGSM49AwEH\nA0IABJk/VyMPYdaqDXJb/VXh5n/1Yuv7iNrxV3Qb3l06XD46seovcDWs3IZNV1lf\n3Skyr0ofcchipoiHkXBODojJydSjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMB\nAf8EBTADAQH/MB0GA1UdDgQWBBRUXxuRcnFjDfR/RIAUQab8ZV/n4jAKBggqhkjO\nPQQDAgNIADBFAiAy+JTe6Uc3KyLCMiqGl2GyWGQqQDEcO3/YG36x7om65AIhAJvz\npxv6zFeVEkAEEkqIYi0omA9+CjanB/6Bz4n1uw8H\n-----END CERTIFICATE-----\n", + "CertIssuerSubject": "MBMxETAPBgNVBAMTCHN3YXJtLWNh", + "CertIssuerPublicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEmT9XIw9h1qoNclv9VeHmf/Vi6/uI2vFXdBveXTpcPjqx6i9wNazchk1XWV/dKTKvSh9xyGKmiIeRcE4OiMnJ1A==" + } + }, + "RootRotationInProgress": { + "type": "boolean", + "description": "Whether there is currently a root CA rotation in progress for the swarm\n", + "example": false + }, + "DataPathPort": { + "type": "integer", + "description": "DataPathPort specifies the data path port number for data traffic.\nAcceptable port range is 1024 to 49151.\nIf no port is set or is set to 0, the default port (4789) is used.\n", + "format": "uint32", + "example": 4789 + }, + "DefaultAddrPool": { + "type": "array", + "description": "Default Address Pool specifies default subnet pools for global scope\nnetworks.\n", + "items": { + "type": "string", + "format": "CIDR", + "example": "" + } + }, + "SubnetSize": { + "maximum": 29, + "type": "integer", + "description": "SubnetSize specifies the subnet size of the networks created from the\ndefault subnet pool.\n", + "format": "uint32", + "example": 24 + } + }, + "description": "ClusterInfo represents information about the swarm as is returned by the\n\"/info\" endpoint. Join-tokens are not included.\n", + "nullable": true, + "x-nullable": true + } + }, + "description": "Represents generic information about swarm.\n" + }, + "LiveRestoreEnabled": { + "type": "boolean", + "description": "Indicates if live restore is enabled.\n\nIf enabled, containers are kept running when the daemon is shutdown\nor upon daemon start if running containers are detected.\n", + "example": false, + "default": false + }, + "Isolation": { + "type": "string", + "description": "Represents the isolation technology to use as a default for containers.\nThe supported values are platform-specific.\n\nIf no isolation value is specified on daemon start, on Windows client,\nthe default is `hyperv`, and on Windows server, the default is `process`.\n\nThis option is currently not used on other platforms.\n", + "default": "default", + "enum": [ + "default", + "hyperv", + "process", + "" + ] + }, + "InitBinary": { + "type": "string", + "description": "Name and, optional, path of the `docker-init` binary.\n\nIf the path is omitted, the daemon searches the host's `$PATH` for the\nbinary and uses the first result.\n", + "example": "docker-init" + }, + "ContainerdCommit": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "Actual commit ID of external tool.", + "example": "cfb82a876ecc11b5ca0977d1733adbe58599088a" + }, + "Expected": { + "type": "string", + "description": "Commit ID of external tool expected by dockerd as set at build time.\n", + "example": "2d41c047c83e09a6d61d464906feb2a2f3c52aa4" + } + }, + "description": "Commit holds the Git-commit (SHA1) that a binary was built from, as\nreported in the version-string of external tools, such as `containerd`,\nor `runC`.\n" + }, + "RuncCommit": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "Actual commit ID of external tool.", + "example": "cfb82a876ecc11b5ca0977d1733adbe58599088a" + }, + "Expected": { + "type": "string", + "description": "Commit ID of external tool expected by dockerd as set at build time.\n", + "example": "2d41c047c83e09a6d61d464906feb2a2f3c52aa4" + } + }, + "description": "Commit holds the Git-commit (SHA1) that a binary was built from, as\nreported in the version-string of external tools, such as `containerd`,\nor `runC`.\n" + }, + "InitCommit": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "Actual commit ID of external tool.", + "example": "cfb82a876ecc11b5ca0977d1733adbe58599088a" + }, + "Expected": { + "type": "string", + "description": "Commit ID of external tool expected by dockerd as set at build time.\n", + "example": "2d41c047c83e09a6d61d464906feb2a2f3c52aa4" + } + }, + "description": "Commit holds the Git-commit (SHA1) that a binary was built from, as\nreported in the version-string of external tools, such as `containerd`,\nor `runC`.\n" + }, + "SecurityOptions": { + "type": "array", + "description": "List of security features that are enabled on the daemon, such as\napparmor, seccomp, SELinux, user-namespaces (userns), rootless and\nno-new-privileges.\n\nAdditional configuration options for each security feature may\nbe present, and are included as a comma-separated list of key/value\npairs.\n", + "example": [ + "name=apparmor", + "name=seccomp,profile=default", + "name=selinux", + "name=userns", + "name=rootless" + ], + "items": { + "type": "string" + } + }, + "ProductLicense": { + "type": "string", + "description": "Reports a summary of the product license on the daemon.\n\nIf a commercial license has been applied to the daemon, information\nsuch as number of nodes, and expiration are included.\n", + "example": "Community Engine" + }, + "DefaultAddressPools": { + "type": "array", + "description": "List of custom default address pools for local networks, which can be\nspecified in the daemon.json file or dockerd option.\n\nExample: a Base \"10.10.0.0/16\" with Size 24 will define the set of 256\n10.10.[0-255].0/24 address pools.\n", + "items": { + "type": "object", + "properties": { + "Base": { + "type": "string", + "description": "The network address in CIDR format", + "example": "10.10.0.0/16" + }, + "Size": { + "type": "integer", + "description": "The network pool size", + "example": 24 + } + } + } + }, + "Warnings": { + "type": "array", + "description": "List of warnings / informational messages about missing features, or\nissues related to the daemon configuration.\n\nThese messages can be printed by the client as information to the user.\n", + "example": [ + "WARNING: No memory limit support" + ], + "items": { + "type": "string" + } + } + } + }, + "PluginsInfo": { + "type": "object", + "properties": { + "Volume": { + "type": "array", + "description": "Names of available volume-drivers, and network-driver plugins.", + "example": [ + "local" + ], + "items": { + "type": "string" + } + }, + "Network": { + "type": "array", + "description": "Names of available network-drivers, and network-driver plugins.", + "example": [ + "bridge", + "host", + "ipvlan", + "macvlan", + "null", + "overlay" + ], + "items": { + "type": "string" + } + }, + "Authorization": { + "type": "array", + "description": "Names of available authorization plugins.", + "example": [ + "img-authz-plugin", + "hbm" + ], + "items": { + "type": "string" + } + }, + "Log": { + "type": "array", + "description": "Names of available logging-drivers, and logging-driver plugins.", + "example": [ + "awslogs", + "fluentd", + "gcplogs", + "gelf", + "journald", + "json-file", + "splunk", + "syslog" + ], + "items": { + "type": "string" + } + } + }, + "description": "Available plugins per type.\n\n


\n\n> **Note**: Only unmanaged (V1) plugins are included in this list.\n> V1 plugins are \"lazily\" loaded, and are not returned in this list\n> if there is no resource using the plugin.\n" + }, + "RegistryServiceConfig": { + "type": "object", + "properties": { + "AllowNondistributableArtifactsCIDRs": { + "type": "array", + "description": "List of IP ranges to which nondistributable artifacts can be pushed,\nusing the CIDR syntax [RFC 4632](https://tools.ietf.org/html/4632).\n\nSome images (for example, Windows base images) contain artifacts\nwhose distribution is restricted by license. When these images are\npushed to a registry, restricted artifacts are not included.\n\nThis configuration override this behavior, and enables the daemon to\npush nondistributable artifacts to all registries whose resolved IP\naddress is within the subnet described by the CIDR syntax.\n\nThis option is useful when pushing images containing\nnondistributable artifacts to a registry on an air-gapped network so\nhosts on that network can pull the images without connecting to\nanother server.\n\n> **Warning**: Nondistributable artifacts typically have restrictions\n> on how and where they can be distributed and shared. Only use this\n> feature to push artifacts to private registries and ensure that you\n> are in compliance with any terms that cover redistributing\n> nondistributable artifacts.\n", + "example": [ + "::1/128", + "127.0.0.0/8" + ], + "items": { + "type": "string" + } + }, + "AllowNondistributableArtifactsHostnames": { + "type": "array", + "description": "List of registry hostnames to which nondistributable artifacts can be\npushed, using the format `[:]` or `[:]`.\n\nSome images (for example, Windows base images) contain artifacts\nwhose distribution is restricted by license. When these images are\npushed to a registry, restricted artifacts are not included.\n\nThis configuration override this behavior for the specified\nregistries.\n\nThis option is useful when pushing images containing\nnondistributable artifacts to a registry on an air-gapped network so\nhosts on that network can pull the images without connecting to\nanother server.\n\n> **Warning**: Nondistributable artifacts typically have restrictions\n> on how and where they can be distributed and shared. Only use this\n> feature to push artifacts to private registries and ensure that you\n> are in compliance with any terms that cover redistributing\n> nondistributable artifacts.\n", + "example": [ + "registry.internal.corp.example.com:3000", + "[2001:db8:a0b:12f0::1]:443" + ], + "items": { + "type": "string" + } + }, + "InsecureRegistryCIDRs": { + "type": "array", + "description": "List of IP ranges of insecure registries, using the CIDR syntax\n([RFC 4632](https://tools.ietf.org/html/4632)). Insecure registries\naccept un-encrypted (HTTP) and/or untrusted (HTTPS with certificates\nfrom unknown CAs) communication.\n\nBy default, local registries (`127.0.0.0/8`) are configured as\ninsecure. All other registries are secure. Communicating with an\ninsecure registry is not possible if the daemon assumes that registry\nis secure.\n\nThis configuration override this behavior, insecure communication with\nregistries whose resolved IP address is within the subnet described by\nthe CIDR syntax.\n\nRegistries can also be marked insecure by hostname. Those registries\nare listed under `IndexConfigs` and have their `Secure` field set to\n`false`.\n\n> **Warning**: Using this option can be useful when running a local\n> registry, but introduces security vulnerabilities. This option\n> should therefore ONLY be used for testing purposes. For increased\n> security, users should add their CA to their system's list of trusted\n> CAs instead of enabling this option.\n", + "example": [ + "::1/128", + "127.0.0.0/8" + ], + "items": { + "type": "string" + } + }, + "IndexConfigs": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the registry, such as \"docker.io\".\n", + "example": "docker.io" + }, + "Mirrors": { + "type": "array", + "description": "List of mirrors, expressed as URIs.\n", + "example": [ + "https://hub-mirror.corp.example.com:5000/", + "https://registry-2.docker.io/", + "https://registry-3.docker.io/" + ], + "items": { + "type": "string" + } + }, + "Secure": { + "type": "boolean", + "description": "Indicates if the registry is part of the list of insecure\nregistries.\n\nIf `false`, the registry is insecure. Insecure registries accept\nun-encrypted (HTTP) and/or untrusted (HTTPS with certificates from\nunknown CAs) communication.\n\n> **Warning**: Insecure registries can be useful when running a local\n> registry. However, because its use creates security vulnerabilities\n> it should ONLY be enabled for testing purposes. For increased\n> security, users should add their CA to their system's list of\n> trusted CAs instead of enabling this option.\n", + "example": true + }, + "Official": { + "type": "boolean", + "description": "Indicates whether this is an official registry (i.e., Docker Hub / docker.io)\n", + "example": true + } + }, + "description": "IndexInfo contains information about a registry.", + "nullable": true, + "x-nullable": true + }, + "example": { + "127.0.0.1:5000": { + "Name": "127.0.0.1:5000", + "Mirrors": [], + "Secure": false, + "Official": false + }, + "[2001:db8:a0b:12f0::1]:80": { + "Name": "[2001:db8:a0b:12f0::1]:80", + "Mirrors": [], + "Secure": false, + "Official": false + }, + "docker.io": { + "Name": "docker.io", + "Mirrors": [ + "https://hub-mirror.corp.example.com:5000/" + ], + "Secure": true, + "Official": true + }, + "registry.internal.corp.example.com:3000": { + "Name": "registry.internal.corp.example.com:3000", + "Mirrors": [], + "Secure": false, + "Official": false + } + } + }, + "Mirrors": { + "type": "array", + "description": "List of registry URLs that act as a mirror for the official\n(`docker.io`) registry.\n", + "example": [ + "https://hub-mirror.corp.example.com:5000/", + "https://[2001:db8:a0b:12f0::1]/" + ], + "items": { + "type": "string" + } + } + }, + "description": "RegistryServiceConfig stores daemon registry services configuration.\n", + "nullable": true, + "x-nullable": true + }, + "IndexInfo": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the registry, such as \"docker.io\".\n", + "example": "docker.io" + }, + "Mirrors": { + "type": "array", + "description": "List of mirrors, expressed as URIs.\n", + "example": [ + "https://hub-mirror.corp.example.com:5000/", + "https://registry-2.docker.io/", + "https://registry-3.docker.io/" + ], + "items": { + "type": "string" + } + }, + "Secure": { + "type": "boolean", + "description": "Indicates if the registry is part of the list of insecure\nregistries.\n\nIf `false`, the registry is insecure. Insecure registries accept\nun-encrypted (HTTP) and/or untrusted (HTTPS with certificates from\nunknown CAs) communication.\n\n> **Warning**: Insecure registries can be useful when running a local\n> registry. However, because its use creates security vulnerabilities\n> it should ONLY be enabled for testing purposes. For increased\n> security, users should add their CA to their system's list of\n> trusted CAs instead of enabling this option.\n", + "example": true + }, + "Official": { + "type": "boolean", + "description": "Indicates whether this is an official registry (i.e., Docker Hub / docker.io)\n", + "example": true + } + }, + "description": "IndexInfo contains information about a registry.", + "nullable": true, + "x-nullable": true + }, + "Runtime": { + "type": "object", + "properties": { + "path": { + "type": "string", + "description": "Name and, optional, path, of the OCI executable binary.\n\nIf the path is omitted, the daemon searches the host's `$PATH` for the\nbinary and uses the first result.\n", + "example": "/usr/local/bin/my-oci-runtime" + }, + "runtimeArgs": { + "type": "array", + "description": "List of command-line arguments to pass to the runtime when invoked.\n", + "nullable": true, + "example": [ + "--debug", + "--systemd-cgroup=false" + ], + "items": { + "type": "string" + } + } + }, + "description": "Runtime describes an [OCI compliant](https://github.com/opencontainers/runtime-spec)\nruntime.\n\nThe runtime is invoked by the daemon via the `containerd` daemon. OCI\nruntimes act as an interface to the Linux kernel namespaces, cgroups,\nand SELinux.\n" + }, + "Commit": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "Actual commit ID of external tool.", + "example": "cfb82a876ecc11b5ca0977d1733adbe58599088a" + }, + "Expected": { + "type": "string", + "description": "Commit ID of external tool expected by dockerd as set at build time.\n", + "example": "2d41c047c83e09a6d61d464906feb2a2f3c52aa4" + } + }, + "description": "Commit holds the Git-commit (SHA1) that a binary was built from, as\nreported in the version-string of external tools, such as `containerd`,\nor `runC`.\n" + }, + "SwarmInfo": { + "type": "object", + "properties": { + "NodeID": { + "type": "string", + "description": "Unique identifier of for this node in the swarm.", + "example": "k67qz4598weg5unwwffg6z1m1", + "default": "" + }, + "NodeAddr": { + "type": "string", + "description": "IP address at which this node can be reached by other nodes in the\nswarm.\n", + "example": "10.0.0.46", + "default": "" + }, + "LocalNodeState": { + "type": "string", + "description": "Current local status of this node.", + "example": "active", + "default": "", + "enum": [ + "", + "inactive", + "pending", + "active", + "error", + "locked" + ] + }, + "ControlAvailable": { + "type": "boolean", + "example": true, + "default": false + }, + "Error": { + "type": "string", + "default": "" + }, + "RemoteManagers": { + "type": "array", + "description": "List of ID's and addresses of other managers in the swarm.\n", + "nullable": true, + "example": [ + { + "NodeID": "71izy0goik036k48jg985xnds", + "Addr": "10.0.0.158:2377" + }, + { + "NodeID": "79y6h1o4gv8n120drcprv5nmc", + "Addr": "10.0.0.159:2377" + }, + { + "NodeID": "k67qz4598weg5unwwffg6z1m1", + "Addr": "10.0.0.46:2377" + } + ], + "items": { + "type": "object", + "properties": { + "NodeID": { + "type": "string", + "description": "Unique identifier of for this node in the swarm." + }, + "Addr": { + "type": "string", + "description": "IP address and ports at which this node can be reached.\n" + } + }, + "description": "Represents a peer-node in the swarm" + } + }, + "Nodes": { + "type": "integer", + "description": "Total number of nodes in the swarm.", + "nullable": true, + "example": 4 + }, + "Managers": { + "type": "integer", + "description": "Total number of managers in the swarm.", + "nullable": true, + "example": 3 + }, + "Cluster": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "The ID of the swarm.", + "example": "abajmipo7b4xz5ip2nrla6b11" + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "description": "Date and time at which the swarm was initialised in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2016-08-18T10:44:24.496525531Z" + }, + "UpdatedAt": { + "type": "string", + "description": "Date and time at which the swarm was last updated in\n[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.\n", + "format": "dateTime", + "example": "2017-08-09T07:09:37.632105588Z" + }, + "Spec": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "Name of the swarm.", + "example": "default" + }, + "Labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "User-defined key/value metadata.", + "example": { + "com.example.corp.type": "production", + "com.example.corp.department": "engineering" + } + }, + "Orchestration": { + "type": "object", + "properties": { + "TaskHistoryRetentionLimit": { + "type": "integer", + "description": "The number of historic tasks to keep per instance or node. If\nnegative, never remove completed or failed tasks.\n", + "format": "int64", + "example": 10 + } + }, + "description": "Orchestration configuration.", + "nullable": true + }, + "Raft": { + "type": "object", + "properties": { + "SnapshotInterval": { + "type": "integer", + "description": "The number of log entries between snapshots.", + "format": "uint64", + "example": 10000 + }, + "KeepOldSnapshots": { + "type": "integer", + "description": "The number of snapshots to keep beyond the current snapshot.\n", + "format": "uint64" + }, + "LogEntriesForSlowFollowers": { + "type": "integer", + "description": "The number of log entries to keep around to sync up slow followers\nafter a snapshot is created.\n", + "format": "uint64", + "example": 500 + }, + "ElectionTick": { + "type": "integer", + "description": "The number of ticks that a follower will wait for a message from\nthe leader before becoming a candidate and starting an election.\n`ElectionTick` must be greater than `HeartbeatTick`.\n\nA tick currently defaults to one second, so these translate\ndirectly to seconds currently, but this is NOT guaranteed.\n", + "example": 3 + }, + "HeartbeatTick": { + "type": "integer", + "description": "The number of ticks between heartbeats. Every HeartbeatTick ticks,\nthe leader will send a heartbeat to the followers.\n\nA tick currently defaults to one second, so these translate\ndirectly to seconds currently, but this is NOT guaranteed.\n", + "example": 1 + } + }, + "description": "Raft configuration." + }, + "Dispatcher": { + "type": "object", + "properties": { + "HeartbeatPeriod": { + "type": "integer", + "description": "The delay for an agent to send a heartbeat to the dispatcher.\n", + "format": "int64", + "example": 5000000000 + } + }, + "description": "Dispatcher configuration.", + "nullable": true + }, + "CAConfig": { + "type": "object", + "properties": { + "NodeCertExpiry": { + "type": "integer", + "description": "The duration node certificates are issued for.", + "format": "int64", + "example": 7776000000000000 + }, + "ExternalCAs": { + "type": "array", + "description": "Configuration for forwarding signing requests to an external\ncertificate authority.\n", + "items": { + "type": "object", + "properties": { + "Protocol": { + "type": "string", + "description": "Protocol for communication with the external CA (currently\nonly `cfssl` is supported).\n", + "default": "cfssl", + "enum": [ + "cfssl" + ] + }, + "URL": { + "type": "string", + "description": "URL where certificate signing requests should be sent.\n" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "An object with key/value pairs that are interpreted as\nprotocol-specific options for the external CA driver.\n" + }, + "CACert": { + "type": "string", + "description": "The root CA certificate (in PEM format) this external CA uses\nto issue TLS certificates (assumed to be to the current swarm\nroot CA certificate if not provided).\n" + } + } + } + }, + "SigningCACert": { + "type": "string", + "description": "The desired signing CA certificate for all swarm node TLS leaf\ncertificates, in PEM format.\n" + }, + "SigningCAKey": { + "type": "string", + "description": "The desired signing CA key for all swarm node TLS leaf certificates,\nin PEM format.\n" + }, + "ForceRotate": { + "type": "integer", + "description": "An integer whose purpose is to force swarm to generate a new\nsigning CA certificate and key, if none have been specified in\n`SigningCACert` and `SigningCAKey`\n", + "format": "uint64" + } + }, + "description": "CA configuration.", + "nullable": true + }, + "EncryptionConfig": { + "type": "object", + "properties": { + "AutoLockManagers": { + "type": "boolean", + "description": "If set, generate a key and use it to lock data stored on the\nmanagers.\n", + "example": false + } + }, + "description": "Parameters related to encryption-at-rest." + }, + "TaskDefaults": { + "type": "object", + "properties": { + "LogDriver": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "description": "The log driver to use as a default for new tasks.\n", + "example": "json-file" + }, + "Options": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver-specific options for the selected log driver, specified\nas key/value pairs.\n", + "example": { + "max-file": "10", + "max-size": "100m" + } + } + }, + "description": "The log driver to use for tasks created in the orchestrator if\nunspecified by a service.\n\nUpdating this value only affects new tasks. Existing tasks continue\nto use their previously configured log driver until recreated.\n" + } + }, + "description": "Defaults for creating tasks in this cluster." + } + }, + "description": "User modifiable swarm configuration." + }, + "TLSInfo": { + "type": "object", + "properties": { + "TrustRoot": { + "type": "string", + "description": "The root CA certificate(s) that are used to validate leaf TLS\ncertificates.\n" + }, + "CertIssuerSubject": { + "type": "string", + "description": "The base64-url-safe-encoded raw subject bytes of the issuer." + }, + "CertIssuerPublicKey": { + "type": "string", + "description": "The base64-url-safe-encoded raw public key bytes of the issuer.\n" + } + }, + "description": "Information about the issuer of leaf TLS certificates and the trusted root\nCA certificate.\n", + "example": { + "TrustRoot": "-----BEGIN CERTIFICATE-----\nMIIBajCCARCgAwIBAgIUbYqrLSOSQHoxD8CwG6Bi2PJi9c8wCgYIKoZIzj0EAwIw\nEzERMA8GA1UEAxMIc3dhcm0tY2EwHhcNMTcwNDI0MjE0MzAwWhcNMzcwNDE5MjE0\nMzAwWjATMREwDwYDVQQDEwhzd2FybS1jYTBZMBMGByqGSM49AgEGCCqGSM49AwEH\nA0IABJk/VyMPYdaqDXJb/VXh5n/1Yuv7iNrxV3Qb3l06XD46seovcDWs3IZNV1lf\n3Skyr0ofcchipoiHkXBODojJydSjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMB\nAf8EBTADAQH/MB0GA1UdDgQWBBRUXxuRcnFjDfR/RIAUQab8ZV/n4jAKBggqhkjO\nPQQDAgNIADBFAiAy+JTe6Uc3KyLCMiqGl2GyWGQqQDEcO3/YG36x7om65AIhAJvz\npxv6zFeVEkAEEkqIYi0omA9+CjanB/6Bz4n1uw8H\n-----END CERTIFICATE-----\n", + "CertIssuerSubject": "MBMxETAPBgNVBAMTCHN3YXJtLWNh", + "CertIssuerPublicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEmT9XIw9h1qoNclv9VeHmf/Vi6/uI2vFXdBveXTpcPjqx6i9wNazchk1XWV/dKTKvSh9xyGKmiIeRcE4OiMnJ1A==" + } + }, + "RootRotationInProgress": { + "type": "boolean", + "description": "Whether there is currently a root CA rotation in progress for the swarm\n", + "example": false + }, + "DataPathPort": { + "type": "integer", + "description": "DataPathPort specifies the data path port number for data traffic.\nAcceptable port range is 1024 to 49151.\nIf no port is set or is set to 0, the default port (4789) is used.\n", + "format": "uint32", + "example": 4789 + }, + "DefaultAddrPool": { + "type": "array", + "description": "Default Address Pool specifies default subnet pools for global scope\nnetworks.\n", + "items": { + "type": "string", + "format": "CIDR", + "example": "" + } + }, + "SubnetSize": { + "maximum": 29, + "type": "integer", + "description": "SubnetSize specifies the subnet size of the networks created from the\ndefault subnet pool.\n", + "format": "uint32", + "example": 24 + } + }, + "description": "ClusterInfo represents information about the swarm as is returned by the\n\"/info\" endpoint. Join-tokens are not included.\n", + "nullable": true, + "x-nullable": true + } + }, + "description": "Represents generic information about swarm.\n" + }, + "LocalNodeState": { + "type": "string", + "description": "Current local status of this node.", + "example": "active", + "default": "", + "enum": [ + "", + "inactive", + "pending", + "active", + "error", + "locked" + ] + }, + "PeerNode": { + "type": "object", + "properties": { + "NodeID": { + "type": "string", + "description": "Unique identifier of for this node in the swarm." + }, + "Addr": { + "type": "string", + "description": "IP address and ports at which this node can be reached.\n" + } + }, + "description": "Represents a peer-node in the swarm" + }, + "NetworkAttachmentConfig": { + "type": "object", + "properties": { + "Target": { + "type": "string", + "description": "The target network for attachment. Must be a network name or ID.\n" + }, + "Aliases": { + "type": "array", + "description": "Discoverable alternate names for the service on this network.\n", + "items": { + "type": "string" + } + }, + "DriverOpts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Driver attachment options for the network target.\n" + } + }, + "description": "Specifies how a service should be attached to a particular network.\n" + }, + "EventActor": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "The ID of the object emitting the event", + "example": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743" + }, + "Attributes": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Various key/value attributes of the object, depending on its type.\n", + "example": { + "com.example.some-label": "some-label-value", + "image": "alpine:latest", + "name": "my-container" + } + } + }, + "description": "Actor describes something that generates events, like a container, network,\nor a volume.\n" + }, + "EventMessage": { + "title": "SystemEventsResponse", + "type": "object", + "properties": { + "Type": { + "type": "string", + "description": "The type of object emitting the event", + "example": "container", + "enum": [ + "builder", + "config", + "container", + "daemon", + "image", + "network", + "node", + "plugin", + "secret", + "service", + "volume" + ] + }, + "Action": { + "type": "string", + "description": "The type of event", + "example": "create" + }, + "Actor": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "The ID of the object emitting the event", + "example": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743" + }, + "Attributes": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Various key/value attributes of the object, depending on its type.\n", + "example": { + "com.example.some-label": "some-label-value", + "image": "alpine:latest", + "name": "my-container" + } + } + }, + "description": "Actor describes something that generates events, like a container, network,\nor a volume.\n" + }, + "scope": { + "type": "string", + "description": "Scope of the event. Engine events are `local` scope. Cluster (Swarm)\nevents are `swarm` scope.\n", + "enum": [ + "local", + "swarm" + ] + }, + "time": { + "type": "integer", + "description": "Timestamp of event", + "format": "int64", + "example": 1629574695 + }, + "timeNano": { + "type": "integer", + "description": "Timestamp of event, with nanosecond accuracy", + "format": "int64", + "example": 1629574695515050000 + } + }, + "description": "EventMessage represents the information an event contains.\n" + }, + "OCIDescriptor": { + "type": "object", + "properties": { + "mediaType": { + "type": "string", + "description": "The media type of the object this schema refers to.\n", + "example": "application/vnd.docker.distribution.manifest.v2+json" + }, + "digest": { + "type": "string", + "description": "The digest of the targeted content.\n", + "example": "sha256:c0537ff6a5218ef531ece93d4984efc99bbf3f7497c0a7726c88e2bb7584dc96" + }, + "size": { + "type": "integer", + "description": "The size in bytes of the blob.\n", + "format": "int64", + "example": 3987495 + } + }, + "description": "A descriptor struct containing digest, media type, and size, as defined in\nthe [OCI Content Descriptors Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md).\n", + "x-go-name": "Descriptor" + }, + "OCIPlatform": { + "type": "object", + "properties": { + "architecture": { + "type": "string", + "description": "The CPU architecture, for example `amd64` or `ppc64`.\n", + "example": "arm" + }, + "os": { + "type": "string", + "description": "The operating system, for example `linux` or `windows`.\n", + "example": "windows" + }, + "os.version": { + "type": "string", + "description": "Optional field specifying the operating system version, for example on\nWindows `10.0.19041.1165`.\n", + "example": "10.0.19041.1165" + }, + "os.features": { + "type": "array", + "description": "Optional field specifying an array of strings, each listing a required\nOS feature (for example on Windows `win32k`).\n", + "example": [ + "win32k" + ], + "items": { + "type": "string" + } + }, + "variant": { + "type": "string", + "description": "Optional field specifying a variant of the CPU, for example `v7` to\nspecify ARMv7 when architecture is `arm`.\n", + "example": "v7" + } + }, + "description": "Describes the platform which the image in the manifest runs on, as defined\nin the [OCI Image Index Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md).\n", + "x-go-name": "Platform" + }, + "DistributionInspect": { + "title": "DistributionInspectResponse", + "required": [ + "Descriptor", + "Platforms" + ], + "type": "object", + "properties": { + "Descriptor": { + "type": "object", + "properties": { + "mediaType": { + "type": "string", + "description": "The media type of the object this schema refers to.\n", + "example": "application/vnd.docker.distribution.manifest.v2+json" + }, + "digest": { + "type": "string", + "description": "The digest of the targeted content.\n", + "example": "sha256:c0537ff6a5218ef531ece93d4984efc99bbf3f7497c0a7726c88e2bb7584dc96" + }, + "size": { + "type": "integer", + "description": "The size in bytes of the blob.\n", + "format": "int64", + "example": 3987495 + } + }, + "description": "A descriptor struct containing digest, media type, and size, as defined in\nthe [OCI Content Descriptors Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md).\n", + "x-go-name": "Descriptor" + }, + "Platforms": { + "type": "array", + "description": "An array containing all platforms supported by the image.\n", + "items": { + "type": "object", + "properties": { + "architecture": { + "type": "string", + "description": "The CPU architecture, for example `amd64` or `ppc64`.\n", + "example": "arm" + }, + "os": { + "type": "string", + "description": "The operating system, for example `linux` or `windows`.\n", + "example": "windows" + }, + "os.version": { + "type": "string", + "description": "Optional field specifying the operating system version, for example on\nWindows `10.0.19041.1165`.\n", + "example": "10.0.19041.1165" + }, + "os.features": { + "type": "array", + "description": "Optional field specifying an array of strings, each listing a required\nOS feature (for example on Windows `win32k`).\n", + "example": [ + "win32k" + ], + "items": { + "type": "string" + } + }, + "variant": { + "type": "string", + "description": "Optional field specifying a variant of the CPU, for example `v7` to\nspecify ARMv7 when architecture is `arm`.\n", + "example": "v7" + } + }, + "description": "Describes the platform which the image in the manifest runs on, as defined\nin the [OCI Image Index Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md).\n", + "x-go-name": "Platform" + } + } + }, + "description": "Describes the result obtained from contacting the registry to retrieve\nimage metadata.\n", + "x-go-name": "DistributionInspect" + }, + "ClusterVolume": { + "type": "object", + "properties": { + "ID": { + "type": "string", + "description": "The Swarm ID of this volume. Because cluster volumes are Swarm\nobjects, they have an ID, unlike non-cluster volumes. This ID can\nbe used to refer to the Volume instead of the name.\n" + }, + "Version": { + "type": "object", + "properties": { + "Index": { + "type": "integer", + "format": "uint64", + "example": 373531 + } + }, + "description": "The version number of the object such as node, service, etc. This is needed\nto avoid conflicting writes. The client must send the version number along\nwith the modified specification when updating these objects.\n\nThis approach ensures safe concurrency and determinism in that the change\non the object may not be applied if the version number has changed from the\nlast read. In other words, if two update requests specify the same base\nversion, only one of the requests can succeed. As a result, two separate\nupdate requests that happen at the same time will not unintentionally\noverwrite each other.\n" + }, + "CreatedAt": { + "type": "string", + "format": "dateTime" + }, + "UpdatedAt": { + "type": "string", + "format": "dateTime" + }, + "Spec": { + "type": "object", + "properties": { + "Group": { + "type": "string", + "description": "Group defines the volume group of this volume. Volumes belonging to\nthe same group can be referred to by group name when creating\nServices. Referring to a volume by group instructs Swarm to treat\nvolumes in that group interchangeably for the purpose of scheduling.\nVolumes with an empty string for a group technically all belong to\nthe same, emptystring group.\n" + }, + "AccessMode": { + "type": "object", + "properties": { + "Scope": { + "type": "string", + "description": "The set of nodes this volume can be used on at one time.\n- `single` The volume may only be scheduled to one node at a time.\n- `multi` the volume may be scheduled to any supported number of nodes at a time.\n", + "nullable": false, + "default": "single", + "enum": [ + "single", + "multi" + ] + }, + "Sharing": { + "type": "string", + "description": "The number and way that different tasks can use this volume\nat one time.\n- `none` The volume may only be used by one task at a time.\n- `readonly` The volume may be used by any number of tasks, but they all must mount the volume as readonly\n- `onewriter` The volume may be used by any number of tasks, but only one may mount it as read/write.\n- `all` The volume may have any number of readers and writers.\n", + "nullable": false, + "default": "none", + "enum": [ + "none", + "readonly", + "onewriter", + "all" + ] + }, + "MountVolume": { + "type": "object", + "properties": {}, + "description": "Options for using this volume as a Mount-type volume.\n\n Either MountVolume or BlockVolume, but not both, must be\n present.\n properties:\n FsType:\n type: \"string\"\n description: |\n Specifies the filesystem type for the mount volume.\n Optional.\n MountFlags:\n type: \"array\"\n description: |\n Flags to pass when mounting the volume. Optional.\n items:\n type: \"string\"\nBlockVolume:\n type: \"object\"\n description: |\n Options for using this volume as a Block-type volume.\n Intentionally empty.\n" + }, + "Secrets": { + "type": "array", + "description": "Swarm Secrets that are passed to the CSI storage plugin when\noperating on this volume.\n", + "items": { + "type": "object", + "properties": { + "Key": { + "type": "string", + "description": "Key is the name of the key of the key-value pair passed to\nthe plugin.\n" + }, + "Secret": { + "type": "string", + "description": "Secret is the swarm Secret object from which to read data.\nThis can be a Secret name or ID. The Secret data is\nretrieved by swarm and used as the value of the key-value\npair passed to the plugin.\n" + } + }, + "description": "One cluster volume secret entry. Defines a key-value pair that\nis passed to the plugin.\n" + } + }, + "AccessibilityRequirements": { + "type": "object", + "properties": { + "Requisite": { + "type": "array", + "description": "A list of required topologies, at least one of which the\nvolume must be accessible from.\n", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + }, + "Preferred": { + "type": "array", + "description": "A list of topologies that the volume should attempt to be\nprovisioned in.\n", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + } + }, + "description": "Requirements for the accessible topology of the volume. These\nfields are optional. For an in-depth description of what these\nfields mean, see the CSI specification.\n" + }, + "CapacityRange": { + "type": "object", + "properties": { + "RequiredBytes": { + "type": "integer", + "description": "The volume must be at least this big. The value of 0\nindicates an unspecified minimum\n", + "format": "int64" + }, + "LimitBytes": { + "type": "integer", + "description": "The volume must not be bigger than this. The value of 0\nindicates an unspecified maximum.\n", + "format": "int64" + } + }, + "description": "The desired capacity that the volume should be created with. If\nempty, the plugin will decide the capacity.\n" + }, + "Availability": { + "type": "string", + "description": "The availability of the volume for use in tasks.\n- `active` The volume is fully available for scheduling on the cluster\n- `pause` No new workloads should use the volume, but existing workloads are not stopped.\n- `drain` All workloads using this volume should be stopped and rescheduled, and no new ones should be started.\n", + "nullable": false, + "default": "active", + "enum": [ + "active", + "pause", + "drain" + ] + } + }, + "description": "Defines how the volume is used by tasks.\n" + } + }, + "description": "Cluster-specific options used to create the volume.\n" + }, + "Info": { + "type": "object", + "properties": { + "CapacityBytes": { + "type": "integer", + "description": "The capacity of the volume in bytes. A value of 0 indicates that\nthe capacity is unknown.\n", + "format": "int64" + }, + "VolumeContext": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of strings to strings returned from the storage plugin when\nthe volume is created.\n" + }, + "VolumeID": { + "type": "string", + "description": "The ID of the volume as returned by the CSI storage plugin. This\nis distinct from the volume's ID as provided by Docker. This ID\nis never used by the user when communicating with Docker to refer\nto this volume. If the ID is blank, then the Volume has not been\nsuccessfully created in the plugin yet.\n" + }, + "AccessibleTopology": { + "type": "array", + "description": "The topology this volume is actually accessible from.\n", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + } + }, + "description": "Information about the global status of the volume.\n" + }, + "PublishStatus": { + "type": "array", + "description": "The status of the volume as it pertains to its publishing and use on\nspecific nodes\n", + "items": { + "type": "object", + "properties": { + "NodeID": { + "type": "string", + "description": "The ID of the Swarm node the volume is published on.\n" + }, + "State": { + "type": "string", + "description": "The published state of the volume.\n* `pending-publish` The volume should be published to this node, but the call to the controller plugin to do so has not yet been successfully completed.\n* `published` The volume is published successfully to the node.\n* `pending-node-unpublish` The volume should be unpublished from the node, and the manager is awaiting confirmation from the worker that it has done so.\n* `pending-controller-unpublish` The volume is successfully unpublished from the node, but has not yet been successfully unpublished on the controller.\n", + "enum": [ + "pending-publish", + "published", + "pending-node-unpublish", + "pending-controller-unpublish" + ] + }, + "PublishContext": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of strings to strings returned by the CSI controller\nplugin when a volume is published.\n" + } + } + } + } + }, + "description": "Options and information specific to, and only present on, Swarm CSI\ncluster volumes.\n" + }, + "ClusterVolumeSpec": { + "type": "object", + "properties": { + "Group": { + "type": "string", + "description": "Group defines the volume group of this volume. Volumes belonging to\nthe same group can be referred to by group name when creating\nServices. Referring to a volume by group instructs Swarm to treat\nvolumes in that group interchangeably for the purpose of scheduling.\nVolumes with an empty string for a group technically all belong to\nthe same, emptystring group.\n" + }, + "AccessMode": { + "type": "object", + "properties": { + "Scope": { + "type": "string", + "description": "The set of nodes this volume can be used on at one time.\n- `single` The volume may only be scheduled to one node at a time.\n- `multi` the volume may be scheduled to any supported number of nodes at a time.\n", + "nullable": false, + "default": "single", + "enum": [ + "single", + "multi" + ] + }, + "Sharing": { + "type": "string", + "description": "The number and way that different tasks can use this volume\nat one time.\n- `none` The volume may only be used by one task at a time.\n- `readonly` The volume may be used by any number of tasks, but they all must mount the volume as readonly\n- `onewriter` The volume may be used by any number of tasks, but only one may mount it as read/write.\n- `all` The volume may have any number of readers and writers.\n", + "nullable": false, + "default": "none", + "enum": [ + "none", + "readonly", + "onewriter", + "all" + ] + }, + "MountVolume": { + "type": "object", + "properties": {}, + "description": "Options for using this volume as a Mount-type volume.\n\n Either MountVolume or BlockVolume, but not both, must be\n present.\n properties:\n FsType:\n type: \"string\"\n description: |\n Specifies the filesystem type for the mount volume.\n Optional.\n MountFlags:\n type: \"array\"\n description: |\n Flags to pass when mounting the volume. Optional.\n items:\n type: \"string\"\nBlockVolume:\n type: \"object\"\n description: |\n Options for using this volume as a Block-type volume.\n Intentionally empty.\n" + }, + "Secrets": { + "type": "array", + "description": "Swarm Secrets that are passed to the CSI storage plugin when\noperating on this volume.\n", + "items": { + "type": "object", + "properties": { + "Key": { + "type": "string", + "description": "Key is the name of the key of the key-value pair passed to\nthe plugin.\n" + }, + "Secret": { + "type": "string", + "description": "Secret is the swarm Secret object from which to read data.\nThis can be a Secret name or ID. The Secret data is\nretrieved by swarm and used as the value of the key-value\npair passed to the plugin.\n" + } + }, + "description": "One cluster volume secret entry. Defines a key-value pair that\nis passed to the plugin.\n" + } + }, + "AccessibilityRequirements": { + "type": "object", + "properties": { + "Requisite": { + "type": "array", + "description": "A list of required topologies, at least one of which the\nvolume must be accessible from.\n", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + }, + "Preferred": { + "type": "array", + "description": "A list of topologies that the volume should attempt to be\nprovisioned in.\n", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + } + }, + "description": "Requirements for the accessible topology of the volume. These\nfields are optional. For an in-depth description of what these\nfields mean, see the CSI specification.\n" + }, + "CapacityRange": { + "type": "object", + "properties": { + "RequiredBytes": { + "type": "integer", + "description": "The volume must be at least this big. The value of 0\nindicates an unspecified minimum\n", + "format": "int64" + }, + "LimitBytes": { + "type": "integer", + "description": "The volume must not be bigger than this. The value of 0\nindicates an unspecified maximum.\n", + "format": "int64" + } + }, + "description": "The desired capacity that the volume should be created with. If\nempty, the plugin will decide the capacity.\n" + }, + "Availability": { + "type": "string", + "description": "The availability of the volume for use in tasks.\n- `active` The volume is fully available for scheduling on the cluster\n- `pause` No new workloads should use the volume, but existing workloads are not stopped.\n- `drain` All workloads using this volume should be stopped and rescheduled, and no new ones should be started.\n", + "nullable": false, + "default": "active", + "enum": [ + "active", + "pause", + "drain" + ] + } + }, + "description": "Defines how the volume is used by tasks.\n" + } + }, + "description": "Cluster-specific options used to create the volume.\n" + }, + "Topology": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A map of topological domains to topological segments. For in depth\ndetails, see documentation for the Topology object in the CSI\nspecification.\n" + } + } + }, + "x-original-swagger-version": "2.0" +} \ No newline at end of file diff --git a/__tests__/fixtures/docker/commands.ts b/__tests__/fixtures/docker/commands.ts new file mode 100644 index 0000000..070ed1c --- /dev/null +++ b/__tests__/fixtures/docker/commands.ts @@ -0,0 +1,2565 @@ +/** + * This file was auto generated by @block65/openapi-codegen + * + * WARN: Do not edit directly. + * + * Generated on 2026-03-06T07:45:59.608Z + * + */ +/** eslint-disable max-classes */ +import { Command, jsonStringify, stripUndefined } from "@block65/rest-client"; +import type { + BuildPruneCommandInput, + BuildPruneCommandOutput, + BuildPruneCommandQuery, + ConfigCreateCommandInput, + ConfigCreateCommandOutput, + ConfigDeleteCommandInput, + ConfigInspectCommandInput, + ConfigInspectCommandOutput, + ConfigListCommandInput, + ConfigListCommandOutput, + ConfigListCommandQuery, + ConfigUpdateCommandInput, + ConfigUpdateCommandQuery, + ContainerArchiveCommandInput, + ContainerArchiveCommandQuery, + ContainerArchiveInfoCommandInput, + ContainerArchiveInfoCommandQuery, + ContainerAttachCommandInput, + ContainerAttachCommandQuery, + ContainerAttachWebsocketCommandInput, + ContainerAttachWebsocketCommandQuery, + ContainerChangesCommandInput, + ContainerChangesCommandOutput, + ContainerCreateCommandInput, + ContainerCreateCommandOutput, + ContainerCreateCommandQuery, + ContainerDeleteCommandInput, + ContainerDeleteCommandQuery, + ContainerExecCommandInput, + ContainerExecCommandOutput, + ContainerExportCommandInput, + ContainerInspectCommandInput, + ContainerInspectCommandOutput, + ContainerInspectCommandQuery, + ContainerKillCommandInput, + ContainerKillCommandQuery, + ContainerListCommandInput, + ContainerListCommandOutput, + ContainerListCommandQuery, + ContainerLogsCommandInput, + ContainerLogsCommandQuery, + ContainerPauseCommandInput, + ContainerPruneCommandInput, + ContainerPruneCommandOutput, + ContainerPruneCommandQuery, + ContainerRenameCommandInput, + ContainerRenameCommandQuery, + ContainerResizeCommandInput, + ContainerResizeCommandQuery, + ContainerRestartCommandInput, + ContainerRestartCommandQuery, + ContainerStartCommandInput, + ContainerStartCommandQuery, + ContainerStatsCommandInput, + ContainerStatsCommandOutput, + ContainerStatsCommandQuery, + ContainerStopCommandInput, + ContainerStopCommandQuery, + ContainerTopCommandInput, + ContainerTopCommandOutput, + ContainerTopCommandQuery, + ContainerUnpauseCommandInput, + ContainerUpdateCommandInput, + ContainerUpdateCommandOutput, + ContainerWaitCommandInput, + ContainerWaitCommandOutput, + ContainerWaitCommandQuery, + DistributionInspectCommandInput, + DistributionInspectCommandOutput, + ExecInspectCommandInput, + ExecInspectCommandOutput, + ExecResizeCommandInput, + ExecResizeCommandQuery, + ExecStartCommandInput, + GetPluginPrivilegesCommandInput, + GetPluginPrivilegesCommandOutput, + GetPluginPrivilegesCommandQuery, + ImageBuildCommandInput, + ImageBuildCommandQuery, + ImageCommitCommandInput, + ImageCommitCommandOutput, + ImageCommitCommandQuery, + ImageCreateCommandInput, + ImageCreateCommandQuery, + ImageDeleteCommandInput, + ImageDeleteCommandOutput, + ImageDeleteCommandQuery, + ImageGetAllCommandInput, + ImageGetAllCommandQuery, + ImageGetCommandInput, + ImageHistoryCommandInput, + ImageHistoryCommandOutput, + ImageInspectCommandInput, + ImageInspectCommandOutput, + ImageListCommandInput, + ImageListCommandOutput, + ImageListCommandQuery, + ImageLoadCommandInput, + ImageLoadCommandQuery, + ImagePruneCommandInput, + ImagePruneCommandOutput, + ImagePruneCommandQuery, + ImagePushCommandInput, + ImagePushCommandQuery, + ImageSearchCommandInput, + ImageSearchCommandOutput, + ImageSearchCommandQuery, + ImageTagCommandInput, + ImageTagCommandQuery, + NetworkConnectCommandInput, + NetworkCreateCommandInput, + NetworkCreateCommandOutput, + NetworkDeleteCommandInput, + NetworkDisconnectCommandInput, + NetworkInspectCommandInput, + NetworkInspectCommandOutput, + NetworkInspectCommandQuery, + NetworkListCommandInput, + NetworkListCommandOutput, + NetworkListCommandQuery, + NetworkPruneCommandInput, + NetworkPruneCommandOutput, + NetworkPruneCommandQuery, + NodeDeleteCommandInput, + NodeDeleteCommandQuery, + NodeInspectCommandInput, + NodeInspectCommandOutput, + NodeListCommandInput, + NodeListCommandOutput, + NodeListCommandQuery, + NodeUpdateCommandInput, + NodeUpdateCommandQuery, + PluginCreateCommandInput, + PluginCreateCommandQuery, + PluginDeleteCommandInput, + PluginDeleteCommandOutput, + PluginDeleteCommandQuery, + PluginDisableCommandInput, + PluginDisableCommandQuery, + PluginEnableCommandInput, + PluginEnableCommandQuery, + PluginInspectCommandInput, + PluginInspectCommandOutput, + PluginListCommandInput, + PluginListCommandOutput, + PluginListCommandQuery, + PluginPullCommandInput, + PluginPullCommandQuery, + PluginPushCommandInput, + PluginSetCommandInput, + PluginUpgradeCommandInput, + PluginUpgradeCommandQuery, + PutContainerArchiveCommandInput, + PutContainerArchiveCommandQuery, + SecretCreateCommandInput, + SecretCreateCommandOutput, + SecretDeleteCommandInput, + SecretInspectCommandInput, + SecretInspectCommandOutput, + SecretListCommandInput, + SecretListCommandOutput, + SecretListCommandQuery, + SecretUpdateCommandInput, + SecretUpdateCommandQuery, + ServiceCreateCommandInput, + ServiceCreateCommandOutput, + ServiceDeleteCommandInput, + ServiceInspectCommandInput, + ServiceInspectCommandOutput, + ServiceInspectCommandQuery, + ServiceListCommandInput, + ServiceListCommandOutput, + ServiceListCommandQuery, + ServiceLogsCommandInput, + ServiceLogsCommandQuery, + ServiceUpdateCommandInput, + ServiceUpdateCommandOutput, + ServiceUpdateCommandQuery, + SessionCommandInput, + SwarmInitCommandInput, + SwarmInitCommandOutput, + SwarmInspectCommandInput, + SwarmInspectCommandOutput, + SwarmJoinCommandInput, + SwarmLeaveCommandInput, + SwarmLeaveCommandQuery, + SwarmUnlockCommandInput, + SwarmUnlockkeyCommandInput, + SwarmUnlockkeyCommandOutput, + SwarmUpdateCommandInput, + SwarmUpdateCommandQuery, + SystemAuthCommandInput, + SystemAuthCommandOutput, + SystemDataUsageCommandInput, + SystemDataUsageCommandOutput, + SystemDataUsageCommandQuery, + SystemEventsCommandInput, + SystemEventsCommandOutput, + SystemEventsCommandQuery, + SystemInfoCommandInput, + SystemInfoCommandOutput, + SystemPingCommandInput, + SystemPingHeadCommandInput, + SystemVersionCommandInput, + SystemVersionCommandOutput, + TaskInspectCommandInput, + TaskInspectCommandOutput, + TaskListCommandInput, + TaskListCommandOutput, + TaskListCommandQuery, + TaskLogsCommandInput, + TaskLogsCommandQuery, + VolumeCreateCommandInput, + VolumeCreateCommandOutput, + VolumeDeleteCommandInput, + VolumeDeleteCommandQuery, + VolumeInspectCommandInput, + VolumeInspectCommandOutput, + VolumeListCommandInput, + VolumeListCommandOutput, + VolumeListCommandQuery, + VolumePruneCommandInput, + VolumePruneCommandOutput, + VolumePruneCommandQuery, + VolumeUpdateCommandInput, + VolumeUpdateCommandQuery, +} from "./types.js"; + +/** + * Returns a list of containers. For details on the format, see the + * [inspect endpoint](#operation/ContainerInspect). + * + * Note that it uses a different, smaller representation of a container + * than inspecting a single container. For example, the list of linked + * containers is not propagated . + * + * @summary List containers + */ +export class ContainerListCommand extends Command< + ContainerListCommandInput, + ContainerListCommandOutput, + ContainerListCommandQuery +> { + public override method = "get" as const; + + constructor(input: ContainerListCommandInput) { + const { all, limit, size, filters } = input; + super( + "/containers/json", + undefined, + stripUndefined({ all, limit, size, filters }), + ); + } +} + +/** + * ContainerCreateCommand + * + * @summary Create a container + */ +export class ContainerCreateCommand extends Command< + ContainerCreateCommandInput, + ContainerCreateCommandOutput, + ContainerCreateCommandQuery +> { + public override method = "post" as const; + + constructor(input: ContainerCreateCommandInput) { + const { name, platform, ...body } = input; + super( + "/containers/create", + jsonStringify(body), + stripUndefined({ name, platform }), + ); + } +} + +/** + * Return low-level information about a container. + * + * @summary Inspect a container + */ +export class ContainerInspectCommand extends Command< + ContainerInspectCommandInput, + ContainerInspectCommandOutput, + ContainerInspectCommandQuery +> { + public override method = "get" as const; + + constructor(input: ContainerInspectCommandInput) { + const { id, size } = input; + super(`/containers/${id}/json`, undefined, stripUndefined({ size })); + } +} + +/** + * On Unix systems, this is done by running the `ps` command. This endpoint + * is not supported on Windows. + * + * @summary List processes running inside a container + */ +export class ContainerTopCommand extends Command< + ContainerTopCommandInput, + ContainerTopCommandOutput, + ContainerTopCommandQuery +> { + public override method = "get" as const; + + constructor(input: ContainerTopCommandInput) { + const { id, ps_args } = input; + super(`/containers/${id}/top`, undefined, stripUndefined({ ps_args })); + } +} + +/** + * Get `stdout` and `stderr` logs from a container. + * + * Note: This endpoint works only for containers with the `json-file` or + * `journald` logging driver. + * + * @summary Get container logs + */ +export class ContainerLogsCommand extends Command< + ContainerLogsCommandInput, + unknown, + ContainerLogsCommandQuery +> { + public override method = "get" as const; + + constructor(input: ContainerLogsCommandInput) { + const { id, follow, stdout, stderr, since, until, timestamps, tail } = + input; + super( + `/containers/${id}/logs`, + undefined, + stripUndefined({ + follow, + stdout, + stderr, + since, + until, + timestamps, + tail, + }), + ); + } +} + +/** + * Returns which files in a container's filesystem have been added, deleted, + * or modified. The `Kind` of modification can be one of: + * + * - `0`: Modified ("C") + * - `1`: Added ("A") + * - `2`: Deleted ("D") + * + * @summary Get changes on a container’s filesystem + */ +export class ContainerChangesCommand extends Command< + ContainerChangesCommandInput, + ContainerChangesCommandOutput +> { + public override method = "get" as const; + + constructor(input: ContainerChangesCommandInput) { + const { id } = input; + super(`/containers/${id}/changes`); + } +} + +/** + * Export the contents of a container as a tarball. + * + * @summary Export a container + */ +export class ContainerExportCommand extends Command< + ContainerExportCommandInput, + unknown +> { + public override method = "get" as const; + + constructor(input: ContainerExportCommandInput) { + const { id } = input; + super(`/containers/${id}/export`); + } +} + +/** + * This endpoint returns a live stream of a container’s resource usage + * statistics. + * + * The `precpu_stats` is the CPU statistic of the *previous* read, and is + * used to calculate the CPU usage percentage. It is not an exact copy + * of the `cpu_stats` field. + * + * If either `precpu_stats.online_cpus` or `cpu_stats.online_cpus` is + * nil then for compatibility with older daemons the length of the + * corresponding `cpu_usage.percpu_usage` array should be used. + * + * On a cgroup v2 host, the following fields are not set + * * `blkio_stats`: all fields other than `io_service_bytes_recursive` + * * `cpu_stats`: `cpu_usage.percpu_usage` + * * `memory_stats`: `max_usage` and `failcnt` + * Also, `memory_stats.stats` fields are incompatible with cgroup v1. + * + * To calculate the values shown by the `stats` command of the docker cli tool + * the following formulas can be used: + * * used_memory = `memory_stats.usage - memory_stats.stats.cache` + * * available_memory = `memory_stats.limit` + * * Memory usage % = `(used_memory / available_memory) * 100.0` + * * cpu_delta = `cpu_stats.cpu_usage.total_usage - + * precpu_stats.cpu_usage.total_usage` + * * system_cpu_delta = `cpu_stats.system_cpu_usage - + * precpu_stats.system_cpu_usage` + * * number_cpus = `length(cpu_stats.cpu_usage.percpu_usage)` or + * `cpu_stats.online_cpus` + * * CPU usage % = `(cpu_delta / system_cpu_delta) * number_cpus * 100.0` + * + * @summary Get container stats based on resource usage + */ +export class ContainerStatsCommand extends Command< + ContainerStatsCommandInput, + ContainerStatsCommandOutput, + ContainerStatsCommandQuery +> { + public override method = "get" as const; + + constructor(input: ContainerStatsCommandInput) { + const { id, stream, oneshot } = input; + super( + `/containers/${id}/stats`, + undefined, + stripUndefined({ stream, oneshot }), + ); + } +} + +/** + * Resize the TTY for a container. + * + * @summary Resize a container TTY + */ +export class ContainerResizeCommand extends Command< + ContainerResizeCommandInput, + unknown, + ContainerResizeCommandQuery +> { + public override method = "post" as const; + + constructor(input: ContainerResizeCommandInput) { + const { id, h, w } = input; + super(`/containers/${id}/resize`, undefined, stripUndefined({ h, w })); + } +} + +/** + * ContainerStartCommand + * + * @summary Start a container + */ +export class ContainerStartCommand extends Command< + ContainerStartCommandInput, + undefined, + ContainerStartCommandQuery +> { + public override method = "post" as const; + + constructor(input: ContainerStartCommandInput) { + const { id, detachKeys } = input; + super(`/containers/${id}/start`, undefined, stripUndefined({ detachKeys })); + } +} + +/** + * ContainerStopCommand + * + * @summary Stop a container + */ +export class ContainerStopCommand extends Command< + ContainerStopCommandInput, + undefined, + ContainerStopCommandQuery +> { + public override method = "post" as const; + + constructor(input: ContainerStopCommandInput) { + const { id, signal, t } = input; + super(`/containers/${id}/stop`, undefined, stripUndefined({ signal, t })); + } +} + +/** + * ContainerRestartCommand + * + * @summary Restart a container + */ +export class ContainerRestartCommand extends Command< + ContainerRestartCommandInput, + undefined, + ContainerRestartCommandQuery +> { + public override method = "post" as const; + + constructor(input: ContainerRestartCommandInput) { + const { id, signal, t } = input; + super( + `/containers/${id}/restart`, + undefined, + stripUndefined({ signal, t }), + ); + } +} + +/** + * Send a POSIX signal to a container, defaulting to killing to the + * container. + * + * @summary Kill a container + */ +export class ContainerKillCommand extends Command< + ContainerKillCommandInput, + undefined, + ContainerKillCommandQuery +> { + public override method = "post" as const; + + constructor(input: ContainerKillCommandInput) { + const { id, signal } = input; + super(`/containers/${id}/kill`, undefined, stripUndefined({ signal })); + } +} + +/** + * Change various configuration options of a container without having to + * recreate it. + * + * @summary Update a container + */ +export class ContainerUpdateCommand extends Command< + ContainerUpdateCommandInput, + ContainerUpdateCommandOutput +> { + public override method = "post" as const; + + constructor(input: ContainerUpdateCommandInput) { + const { id, ...body } = input; + super(`/containers/${id}/update`, jsonStringify(body)); + } +} + +/** + * ContainerRenameCommand + * + * @summary Rename a container + */ +export class ContainerRenameCommand extends Command< + ContainerRenameCommandInput, + undefined, + ContainerRenameCommandQuery +> { + public override method = "post" as const; + + constructor(input: ContainerRenameCommandInput) { + const { id, name } = input; + super(`/containers/${id}/rename`, undefined, stripUndefined({ name })); + } +} + +/** + * Use the freezer cgroup to suspend all processes in a container. + * + * Traditionally, when suspending a process the `SIGSTOP` signal is used, + * which is observable by the process being suspended. With the freezer + * cgroup the process is unaware, and unable to capture, that it is being + * suspended, and subsequently resumed. + * + * @summary Pause a container + */ +export class ContainerPauseCommand extends Command< + ContainerPauseCommandInput, + undefined +> { + public override method = "post" as const; + + constructor(input: ContainerPauseCommandInput) { + const { id } = input; + super(`/containers/${id}/pause`); + } +} + +/** + * Resume a container which has been paused. + * + * @summary Unpause a container + */ +export class ContainerUnpauseCommand extends Command< + ContainerUnpauseCommandInput, + undefined +> { + public override method = "post" as const; + + constructor(input: ContainerUnpauseCommandInput) { + const { id } = input; + super(`/containers/${id}/unpause`); + } +} + +/** + * Attach to a container to read its output or send it input. You can attach + * to the same container multiple times and you can reattach to containers + * that have been detached. + * + * Either the `stream` or `logs` parameter must be `true` for this endpoint + * to do anything. + * + * See the [documentation for the `docker attach` + * command](https://docs.docker.com/engine/reference/commandline/attach/) + * for more details. + * + * ### Hijacking + * + * This endpoint hijacks the HTTP connection to transport `stdin`, `stdout`, + * and `stderr` on the same socket. + * + * This is the response from the daemon for an attach request: + * + * ``` + * HTTP/1.1 200 OK + * Content-Type: application/vnd.docker.raw-stream + * + * [STREAM] + * ``` + * + * After the headers and two new lines, the TCP connection can now be used + * for raw, bidirectional communication between the client and server. + * + * To hint potential proxies about connection hijacking, the Docker client + * can also optionally send connection upgrade headers. + * + * For example, the client sends this request to upgrade the connection: + * + * ``` + * POST /containers/16253994b7c4/attach?stream=1&stdout=1 HTTP/1.1 + * Upgrade: tcp + * Connection: Upgrade + * ``` + * + * The Docker daemon will respond with a `101 UPGRADED` response, and will + * similarly follow with the raw stream: + * + * ``` + * HTTP/1.1 101 UPGRADED + * Content-Type: application/vnd.docker.raw-stream + * Connection: Upgrade + * Upgrade: tcp + * + * [STREAM] + * ``` + * + * ### Stream format + * + * When the TTY setting is disabled in [`POST + * /containers/create`](#operation/ContainerCreate), + * the HTTP Content-Type header is set to + * application/vnd.docker.multiplexed-stream + * and the stream over the hijacked connected is multiplexed to separate out + * `stdout` and `stderr`. The stream consists of a series of frames, each + * containing a header and a payload. + * + * The header contains the information which the stream writes (`stdout` or + * `stderr`). It also contains the size of the associated frame encoded in + * the last four bytes (`uint32`). + * + * It is encoded on the first eight bytes like this: + * + * ```go + * header := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4} + * ``` + * + * `STREAM_TYPE` can be: + * + * - 0: `stdin` (is written on `stdout`) + * - 1: `stdout` + * - 2: `stderr` + * + * `SIZE1, SIZE2, SIZE3, SIZE4` are the four bytes of the `uint32` size + * encoded as big endian. + * + * Following the header is the payload, which is the specified number of + * bytes of `STREAM_TYPE`. + * + * The simplest way to implement this protocol is the following: + * + * 1. Read 8 bytes. + * 2. Choose `stdout` or `stderr` depending on the first byte. + * 3. Extract the frame size from the last four bytes. + * 4. Read the extracted size and output it on the correct output. + * 5. Goto 1. + * + * ### Stream format when using a TTY + * + * When the TTY setting is enabled in [`POST + * /containers/create`](#operation/ContainerCreate), + * the stream is not multiplexed. The data exchanged over the hijacked + * connection is simply the raw data from the process PTY and client's + * `stdin`. + * + * @summary Attach to a container + */ +export class ContainerAttachCommand extends Command< + ContainerAttachCommandInput, + unknown, + ContainerAttachCommandQuery +> { + public override method = "post" as const; + + constructor(input: ContainerAttachCommandInput) { + const { id, detachKeys, logs, stream, stdin, stdout, stderr } = input; + super( + `/containers/${id}/attach`, + undefined, + stripUndefined({ detachKeys, logs, stream, stdin, stdout, stderr }), + ); + } +} + +/** + * ContainerAttachWebsocketCommand + * + * @summary Attach to a container via a websocket + */ +export class ContainerAttachWebsocketCommand extends Command< + ContainerAttachWebsocketCommandInput, + unknown, + ContainerAttachWebsocketCommandQuery +> { + public override method = "get" as const; + + constructor(input: ContainerAttachWebsocketCommandInput) { + const { id, detachKeys, logs, stream, stdin, stdout, stderr } = input; + super( + `/containers/${id}/attach/ws`, + undefined, + stripUndefined({ detachKeys, logs, stream, stdin, stdout, stderr }), + ); + } +} + +/** + * Block until a container stops, then returns the exit code. + * + * @summary Wait for a container + */ +export class ContainerWaitCommand extends Command< + ContainerWaitCommandInput, + ContainerWaitCommandOutput, + ContainerWaitCommandQuery +> { + public override method = "post" as const; + + constructor(input: ContainerWaitCommandInput) { + const { id, condition } = input; + super(`/containers/${id}/wait`, undefined, stripUndefined({ condition })); + } +} + +/** + * ContainerDeleteCommand + * + * @summary Remove a container + */ +export class ContainerDeleteCommand extends Command< + ContainerDeleteCommandInput, + undefined, + ContainerDeleteCommandQuery +> { + public override method = "delete" as const; + + constructor(input: ContainerDeleteCommandInput) { + const { id, v, force, link } = input; + super(`/containers/${id}`, undefined, stripUndefined({ v, force, link })); + } +} + +/** + * Get a tar archive of a resource in the filesystem of container id. + * + * @summary Get an archive of a filesystem resource in a container + */ +export class ContainerArchiveCommand extends Command< + ContainerArchiveCommandInput, + unknown, + ContainerArchiveCommandQuery +> { + public override method = "get" as const; + + constructor(input: ContainerArchiveCommandInput) { + const { id, path } = input; + super(`/containers/${id}/archive`, undefined, stripUndefined({ path })); + } +} + +/** + * Upload a tar archive to be extracted to a path in the filesystem of + * container id. + * `path` parameter is asserted to be a directory. If it exists as a file, 400 + * error + * will be returned with message "not a directory". + * + * @summary Extract an archive of files or folders to a directory in a container + */ +export class PutContainerArchiveCommand extends Command< + PutContainerArchiveCommandInput, + unknown, + PutContainerArchiveCommandQuery +> { + public override method = "put" as const; + + constructor(input: PutContainerArchiveCommandInput) { + const { id, path, noOverwriteDirNonDir, copyUIDGID, body } = input; + super( + `/containers/${id}/archive`, + body, + stripUndefined({ path, noOverwriteDirNonDir, copyUIDGID }), + ); + } +} + +/** + * A response header `X-Docker-Container-Path-Stat` is returned, containing + * a base64 - encoded JSON object with some filesystem header information + * about the path. + * + * @summary Get information about files in a container + */ +export class ContainerArchiveInfoCommand extends Command< + ContainerArchiveInfoCommandInput, + unknown, + ContainerArchiveInfoCommandQuery +> { + public override method = "head" as const; + + constructor(input: ContainerArchiveInfoCommandInput) { + const { id, path } = input; + super(`/containers/${id}/archive`, undefined, stripUndefined({ path })); + } +} + +/** + * ContainerPruneCommand + * + * @summary Delete stopped containers + */ +export class ContainerPruneCommand extends Command< + ContainerPruneCommandInput, + ContainerPruneCommandOutput, + ContainerPruneCommandQuery +> { + public override method = "post" as const; + + constructor(input: ContainerPruneCommandInput) { + const { filters } = input; + super("/containers/prune", undefined, stripUndefined({ filters })); + } +} + +/** + * Returns a list of images on the server. Note that it uses a different, + * smaller representation of an image than inspecting a single image. + * + * @summary List Images + */ +export class ImageListCommand extends Command< + ImageListCommandInput, + ImageListCommandOutput, + ImageListCommandQuery +> { + public override method = "get" as const; + + constructor(input: ImageListCommandInput) { + const { all, filters, sharedsize, digests } = input; + super( + "/images/json", + undefined, + stripUndefined({ all, filters, sharedsize, digests }), + ); + } +} + +/** + * Build an image from a tar archive with a `Dockerfile` in it. + * + * The `Dockerfile` specifies how the image is built from the tar archive. It + * is typically in the archive's root, but can be at a different path or have + * a different name by specifying the `dockerfile` parameter. [See the + * `Dockerfile` reference for more + * information](https://docs.docker.com/engine/reference/builder/). + * + * The Docker daemon performs a preliminary validation of the `Dockerfile` + * before starting the build, and returns an error if the syntax is incorrect. + * After that, each instruction is run one-by-one until the ID of the new + * image is output. + * + * The build is canceled if the client drops the connection by quitting or + * being killed. + * + * @summary Build an image + */ +export class ImageBuildCommand extends Command< + ImageBuildCommandInput, + unknown, + ImageBuildCommandQuery +> { + public override method = "post" as const; + + constructor(input: ImageBuildCommandInput) { + const { + dockerfile, + t, + extrahosts, + remote, + q, + nocache, + cachefrom, + pull, + rm, + forcerm, + memory, + memswap, + cpushares, + cpusetcpus, + cpuperiod, + cpuquota, + buildargs, + shmsize, + squash, + labels, + networkmode, + platform, + target, + outputs, + version, + body, + } = input; + super( + "/build", + body, + stripUndefined({ + dockerfile, + t, + extrahosts, + remote, + q, + nocache, + cachefrom, + pull, + rm, + forcerm, + memory, + memswap, + cpushares, + cpusetcpus, + cpuperiod, + cpuquota, + buildargs, + shmsize, + squash, + labels, + networkmode, + platform, + target, + outputs, + version, + }), + ); + } +} + +/** + * BuildPruneCommand + * + * @summary Delete builder cache + */ +export class BuildPruneCommand extends Command< + BuildPruneCommandInput, + BuildPruneCommandOutput, + BuildPruneCommandQuery +> { + public override method = "post" as const; + + constructor(input: BuildPruneCommandInput) { + const { keepstorage, all, filters } = input; + super( + "/build/prune", + undefined, + stripUndefined({ keepstorage, all, filters }), + ); + } +} + +/** + * Create an image by either pulling it from a registry or importing it. + * + * @summary Create an image + */ +export class ImageCreateCommand extends Command< + ImageCreateCommandInput, + unknown, + ImageCreateCommandQuery +> { + public override method = "post" as const; + + constructor(input: ImageCreateCommandInput) { + const { fromImage, fromSrc, repo, tag, message, changes, platform, body } = + input; + super( + "/images/create", + body, + stripUndefined({ + fromImage, + fromSrc, + repo, + tag, + message, + changes, + platform, + }), + ); + } +} + +/** + * Return low-level information about an image. + * + * @summary Inspect an image + */ +export class ImageInspectCommand extends Command< + ImageInspectCommandInput, + ImageInspectCommandOutput +> { + public override method = "get" as const; + + constructor(input: ImageInspectCommandInput) { + const { name } = input; + super(`/images/${name}/json`); + } +} + +/** + * Return parent layers of an image. + * + * @summary Get the history of an image + */ +export class ImageHistoryCommand extends Command< + ImageHistoryCommandInput, + ImageHistoryCommandOutput +> { + public override method = "get" as const; + + constructor(input: ImageHistoryCommandInput) { + const { name } = input; + super(`/images/${name}/history`); + } +} + +/** + * Push an image to a registry. + * + * If you wish to push an image on to a private registry, that image must + * already have a tag which references the registry. For example, + * `registry.example.com/myimage:latest`. + * + * The push is cancelled if the HTTP connection is closed. + * + * @summary Push an image + */ +export class ImagePushCommand extends Command< + ImagePushCommandInput, + unknown, + ImagePushCommandQuery +> { + public override method = "post" as const; + + constructor(input: ImagePushCommandInput) { + const { name, tag } = input; + super(`/images/${name}/push`, undefined, stripUndefined({ tag })); + } +} + +/** + * Tag an image so that it becomes part of a repository. + * + * @summary Tag an image + */ +export class ImageTagCommand extends Command< + ImageTagCommandInput, + unknown, + ImageTagCommandQuery +> { + public override method = "post" as const; + + constructor(input: ImageTagCommandInput) { + const { name, repo, tag } = input; + super(`/images/${name}/tag`, undefined, stripUndefined({ repo, tag })); + } +} + +/** + * Remove an image, along with any untagged parent images that were + * referenced by that image. + * + * Images can't be removed if they have descendant images, are being + * used by a running container or are being used by a build. + * + * @summary Remove an image + */ +export class ImageDeleteCommand extends Command< + ImageDeleteCommandInput, + ImageDeleteCommandOutput, + ImageDeleteCommandQuery +> { + public override method = "delete" as const; + + constructor(input: ImageDeleteCommandInput) { + const { name, force, noprune } = input; + super(`/images/${name}`, undefined, stripUndefined({ force, noprune })); + } +} + +/** + * Search for an image on Docker Hub. + * + * @summary Search images + */ +export class ImageSearchCommand extends Command< + ImageSearchCommandInput, + ImageSearchCommandOutput, + ImageSearchCommandQuery +> { + public override method = "get" as const; + + constructor(input: ImageSearchCommandInput) { + const { term, limit, filters } = input; + super( + "/images/search", + undefined, + stripUndefined({ term, limit, filters }), + ); + } +} + +/** + * ImagePruneCommand + * + * @summary Delete unused images + */ +export class ImagePruneCommand extends Command< + ImagePruneCommandInput, + ImagePruneCommandOutput, + ImagePruneCommandQuery +> { + public override method = "post" as const; + + constructor(input: ImagePruneCommandInput) { + const { filters } = input; + super("/images/prune", undefined, stripUndefined({ filters })); + } +} + +/** + * Validate credentials for a registry and, if available, get an identity + * token for accessing the registry without password. + * + * @summary Check auth configuration + */ +export class SystemAuthCommand extends Command< + SystemAuthCommandInput, + SystemAuthCommandOutput, + undefined +> { + public override method = "post" as const; + + constructor(input: SystemAuthCommandInput) { + const body = input; + super("/auth", jsonStringify(body)); + } +} + +/** + * SystemInfoCommand + * + * @summary Get system information + */ +export class SystemInfoCommand extends Command< + SystemInfoCommandInput, + SystemInfoCommandOutput +> { + public override method = "get" as const; +} + +/** + * Returns the version of Docker that is running and various information about + * the system that Docker is running on. + * + * @summary Get version + */ +export class SystemVersionCommand extends Command< + SystemVersionCommandInput, + SystemVersionCommandOutput +> { + public override method = "get" as const; +} + +/** + * This is a dummy endpoint you can use to test if the server is accessible. + * + * @summary Ping + */ +export class SystemPingCommand extends Command< + SystemPingCommandInput, + unknown +> { + public override method = "get" as const; +} + +/** + * This is a dummy endpoint you can use to test if the server is accessible. + * + * @summary Ping + */ +export class SystemPingHeadCommand extends Command< + SystemPingHeadCommandInput, + unknown +> { + public override method = "head" as const; +} + +/** + * ImageCommitCommand + * + * @summary Create a new image from a container + */ +export class ImageCommitCommand extends Command< + ImageCommitCommandInput, + ImageCommitCommandOutput, + ImageCommitCommandQuery +> { + public override method = "post" as const; + + constructor(input: ImageCommitCommandInput) { + const { container, repo, tag, comment, author, pause, changes, ...body } = + input; + super( + "/commit", + jsonStringify(body), + stripUndefined({ container, repo, tag, comment, author, pause, changes }), + ); + } +} + +/** + * Stream real-time events from the server. + * + * Various objects within Docker report events when something happens to them. + * + * Containers report these events: `attach`, `commit`, `copy`, `create`, + * `destroy`, `detach`, `die`, `exec_create`, `exec_detach`, `exec_start`, + * `exec_die`, `export`, `health_status`, `kill`, `oom`, `pause`, `rename`, + * `resize`, `restart`, `start`, `stop`, `top`, `unpause`, `update`, and + * `prune` + * + * Images report these events: `delete`, `import`, `load`, `pull`, `push`, + * `save`, `tag`, `untag`, and `prune` + * + * Volumes report these events: `create`, `mount`, `unmount`, `destroy`, and + * `prune` + * + * Networks report these events: `create`, `connect`, `disconnect`, `destroy`, + * `update`, `remove`, and `prune` + * + * The Docker daemon reports these events: `reload` + * + * Services report these events: `create`, `update`, and `remove` + * + * Nodes report these events: `create`, `update`, and `remove` + * + * Secrets report these events: `create`, `update`, and `remove` + * + * Configs report these events: `create`, `update`, and `remove` + * + * The Builder reports `prune` events + * + * @summary Monitor events + */ +export class SystemEventsCommand extends Command< + SystemEventsCommandInput, + SystemEventsCommandOutput, + SystemEventsCommandQuery +> { + public override method = "get" as const; + + constructor(input: SystemEventsCommandInput) { + const { since, until, filters } = input; + super("/events", undefined, stripUndefined({ since, until, filters })); + } +} + +/** + * SystemDataUsageCommand + * + * @summary Get data usage information + */ +export class SystemDataUsageCommand extends Command< + SystemDataUsageCommandInput, + SystemDataUsageCommandOutput, + SystemDataUsageCommandQuery +> { + public override method = "get" as const; + + constructor(input: SystemDataUsageCommandInput) { + const { type } = input; + super("/system/df", undefined, stripUndefined({ type })); + } +} + +/** + * Get a tarball containing all images and metadata for a repository. + * + * If `name` is a specific name and tag (e.g. `ubuntu:latest`), then only that + * image (and its parents) are returned. If `name` is an image ID, similarly + * only that image (and its parents) are returned, but with the exclusion of + * the `repositories` file in the tarball, as there were no image names + * referenced. + * + * ### Image tarball format + * + * An image tarball contains one directory per image layer (named using its + * long ID), each containing these files: + * + * - `VERSION`: currently `1.0` - the file format version + * - `json`: detailed layer information, similar to `docker inspect layer_id` + * - `layer.tar`: A tarfile containing the filesystem changes in this layer + * + * The `layer.tar` file contains `aufs` style `.wh..wh.aufs` files and + * directories for storing attribute changes and deletions. + * + * If the tarball defines a repository, the tarball should also include a + * `repositories` file at the root that contains a list of repository and tag + * names mapped to layer IDs. + * + * ```json + * { + * + * "hello-world": { + * + * "latest": + * "565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1" + * + * } + * } + * ``` + * + * @summary Export an image + */ +export class ImageGetCommand extends Command { + public override method = "get" as const; + + constructor(input: ImageGetCommandInput) { + const { name } = input; + super(`/images/${name}/get`); + } +} + +/** + * Get a tarball containing all images and metadata for several image + * repositories. + * + * For each value of the `names` parameter: if it is a specific name and + * tag (e.g. `ubuntu:latest`), then only that image (and its parents) are + * returned; if it is an image ID, similarly only that image (and its parents) + * are returned and there would be no names referenced in the 'repositories' + * file for this image ID. + * + * For details on the format, see the [export image + * endpoint](#operation/ImageGet). + * + * @summary Export several images + */ +export class ImageGetAllCommand extends Command< + ImageGetAllCommandInput, + unknown, + ImageGetAllCommandQuery +> { + public override method = "get" as const; + + constructor(input: ImageGetAllCommandInput) { + const { names } = input; + super("/images/get", undefined, stripUndefined({ names })); + } +} + +/** + * Load a set of images and tags into a repository. + * + * For details on the format, see the [export image + * endpoint](#operation/ImageGet). + * + * @summary Import images + */ +export class ImageLoadCommand extends Command< + ImageLoadCommandInput, + unknown, + ImageLoadCommandQuery +> { + public override method = "post" as const; + + constructor(input: ImageLoadCommandInput) { + const { quiet, body } = input; + super("/images/load", body, stripUndefined({ quiet })); + } +} + +/** + * Run a command inside a running container. + * + * @summary Create an exec instance + */ +export class ContainerExecCommand extends Command< + ContainerExecCommandInput, + ContainerExecCommandOutput +> { + public override method = "post" as const; + + constructor(input: ContainerExecCommandInput) { + const { id, ...body } = input; + super(`/containers/${id}/exec`, jsonStringify(body)); + } +} + +/** + * Starts a previously set up exec instance. If detach is true, this endpoint + * returns immediately after starting the command. Otherwise, it sets up an + * interactive session with the command. + * + * @summary Start an exec instance + */ +export class ExecStartCommand extends Command { + public override method = "post" as const; + + constructor(input: ExecStartCommandInput) { + const { id, ...body } = input; + super(`/exec/${id}/start`, jsonStringify(body)); + } +} + +/** + * Resize the TTY session used by an exec instance. This endpoint only works + * if `tty` was specified as part of creating and starting the exec instance. + * + * @summary Resize an exec instance + */ +export class ExecResizeCommand extends Command< + ExecResizeCommandInput, + unknown, + ExecResizeCommandQuery +> { + public override method = "post" as const; + + constructor(input: ExecResizeCommandInput) { + const { id, h, w } = input; + super(`/exec/${id}/resize`, undefined, stripUndefined({ h, w })); + } +} + +/** + * Return low-level information about an exec instance. + * + * @summary Inspect an exec instance + */ +export class ExecInspectCommand extends Command< + ExecInspectCommandInput, + ExecInspectCommandOutput +> { + public override method = "get" as const; + + constructor(input: ExecInspectCommandInput) { + const { id } = input; + super(`/exec/${id}/json`); + } +} + +/** + * VolumeListCommand + * + * @summary List volumes + */ +export class VolumeListCommand extends Command< + VolumeListCommandInput, + VolumeListCommandOutput, + VolumeListCommandQuery +> { + public override method = "get" as const; + + constructor(input: VolumeListCommandInput) { + const { filters } = input; + super("/volumes", undefined, stripUndefined({ filters })); + } +} + +/** + * VolumeCreateCommand + * + * @summary Create a volume + */ +export class VolumeCreateCommand extends Command< + VolumeCreateCommandInput, + VolumeCreateCommandOutput +> { + public override method = "post" as const; + + constructor(input: VolumeCreateCommandInput) { + const body = input; + super("/volumes/create", jsonStringify(body)); + } +} + +/** + * VolumeInspectCommand + * + * @summary Inspect a volume + */ +export class VolumeInspectCommand extends Command< + VolumeInspectCommandInput, + VolumeInspectCommandOutput +> { + public override method = "get" as const; + + constructor(input: VolumeInspectCommandInput) { + const { name } = input; + super(`/volumes/${name}`); + } +} + +/** + * VolumeUpdateCommand + * + * @summary "Update a volume. Valid only for Swarm cluster volumes" + */ +export class VolumeUpdateCommand extends Command< + VolumeUpdateCommandInput, + unknown, + VolumeUpdateCommandQuery +> { + public override method = "put" as const; + + constructor(input: VolumeUpdateCommandInput) { + const { name, version, ...body } = input; + super(`/volumes/${name}`, jsonStringify(body), stripUndefined({ version })); + } +} + +/** + * Instruct the driver to remove the volume. + * + * @summary Remove a volume + */ +export class VolumeDeleteCommand extends Command< + VolumeDeleteCommandInput, + undefined, + VolumeDeleteCommandQuery +> { + public override method = "delete" as const; + + constructor(input: VolumeDeleteCommandInput) { + const { name, force } = input; + super(`/volumes/${name}`, undefined, stripUndefined({ force })); + } +} + +/** + * VolumePruneCommand + * + * @summary Delete unused volumes + */ +export class VolumePruneCommand extends Command< + VolumePruneCommandInput, + VolumePruneCommandOutput, + VolumePruneCommandQuery +> { + public override method = "post" as const; + + constructor(input: VolumePruneCommandInput) { + const { filters } = input; + super("/volumes/prune", undefined, stripUndefined({ filters })); + } +} + +/** + * Returns a list of networks. For details on the format, see the + * [network inspect endpoint](#operation/NetworkInspect). + * + * Note that it uses a different, smaller representation of a network than + * inspecting a single network. For example, the list of containers attached + * to the network is not propagated in API versions 1.28 and up. + * + * @summary List networks + */ +export class NetworkListCommand extends Command< + NetworkListCommandInput, + NetworkListCommandOutput, + NetworkListCommandQuery +> { + public override method = "get" as const; + + constructor(input: NetworkListCommandInput) { + const { filters } = input; + super("/networks", undefined, stripUndefined({ filters })); + } +} + +/** + * NetworkInspectCommand + * + * @summary Inspect a network + */ +export class NetworkInspectCommand extends Command< + NetworkInspectCommandInput, + NetworkInspectCommandOutput, + NetworkInspectCommandQuery +> { + public override method = "get" as const; + + constructor(input: NetworkInspectCommandInput) { + const { id, verbose, scope } = input; + super(`/networks/${id}`, undefined, stripUndefined({ verbose, scope })); + } +} + +/** + * NetworkDeleteCommand + * + * @summary Remove a network + */ +export class NetworkDeleteCommand extends Command< + NetworkDeleteCommandInput, + undefined +> { + public override method = "delete" as const; + + constructor(input: NetworkDeleteCommandInput) { + const { id } = input; + super(`/networks/${id}`); + } +} + +/** + * NetworkCreateCommand + * + * @summary Create a network + */ +export class NetworkCreateCommand extends Command< + NetworkCreateCommandInput, + NetworkCreateCommandOutput +> { + public override method = "post" as const; + + constructor(input: NetworkCreateCommandInput) { + const body = input; + super("/networks/create", jsonStringify(body)); + } +} + +/** + * NetworkConnectCommand + * + * @summary Connect a container to a network + */ +export class NetworkConnectCommand extends Command< + NetworkConnectCommandInput, + unknown +> { + public override method = "post" as const; + + constructor(input: NetworkConnectCommandInput) { + const { id, ...body } = input; + super(`/networks/${id}/connect`, jsonStringify(body)); + } +} + +/** + * NetworkDisconnectCommand + * + * @summary Disconnect a container from a network + */ +export class NetworkDisconnectCommand extends Command< + NetworkDisconnectCommandInput, + unknown +> { + public override method = "post" as const; + + constructor(input: NetworkDisconnectCommandInput) { + const { id, ...body } = input; + super(`/networks/${id}/disconnect`, jsonStringify(body)); + } +} + +/** + * NetworkPruneCommand + * + * @summary Delete unused networks + */ +export class NetworkPruneCommand extends Command< + NetworkPruneCommandInput, + NetworkPruneCommandOutput, + NetworkPruneCommandQuery +> { + public override method = "post" as const; + + constructor(input: NetworkPruneCommandInput) { + const { filters } = input; + super("/networks/prune", undefined, stripUndefined({ filters })); + } +} + +/** + * Returns information about installed plugins. + * + * @summary List plugins + */ +export class PluginListCommand extends Command< + PluginListCommandInput, + PluginListCommandOutput, + PluginListCommandQuery +> { + public override method = "get" as const; + + constructor(input: PluginListCommandInput) { + const { filters } = input; + super("/plugins", undefined, stripUndefined({ filters })); + } +} + +/** + * GetPluginPrivilegesCommand + * + * @summary Get plugin privileges + */ +export class GetPluginPrivilegesCommand extends Command< + GetPluginPrivilegesCommandInput, + GetPluginPrivilegesCommandOutput, + GetPluginPrivilegesCommandQuery +> { + public override method = "get" as const; + + constructor(input: GetPluginPrivilegesCommandInput) { + const { remote } = input; + super("/plugins/privileges", undefined, stripUndefined({ remote })); + } +} + +/** + * Pulls and installs a plugin. After the plugin is installed, it can be + * enabled using the [`POST /plugins/{name}/enable` + * endpoint](#operation/PostPluginsEnable). + * + * @summary Install a plugin + */ +export class PluginPullCommand extends Command< + PluginPullCommandInput, + undefined, + PluginPullCommandQuery +> { + public override method = "post" as const; + + constructor(input: PluginPullCommandInput) { + const { remote, name, ...body } = input; + super( + "/plugins/pull", + jsonStringify(body), + stripUndefined({ remote, name }), + ); + } +} + +/** + * PluginInspectCommand + * + * @summary Inspect a plugin + */ +export class PluginInspectCommand extends Command< + PluginInspectCommandInput, + PluginInspectCommandOutput +> { + public override method = "get" as const; + + constructor(input: PluginInspectCommandInput) { + const { name } = input; + super(`/plugins/${name}/json`); + } +} + +/** + * PluginDeleteCommand + * + * @summary Remove a plugin + */ +export class PluginDeleteCommand extends Command< + PluginDeleteCommandInput, + PluginDeleteCommandOutput, + PluginDeleteCommandQuery +> { + public override method = "delete" as const; + + constructor(input: PluginDeleteCommandInput) { + const { name, force } = input; + super(`/plugins/${name}`, undefined, stripUndefined({ force })); + } +} + +/** + * PluginEnableCommand + * + * @summary Enable a plugin + */ +export class PluginEnableCommand extends Command< + PluginEnableCommandInput, + unknown, + PluginEnableCommandQuery +> { + public override method = "post" as const; + + constructor(input: PluginEnableCommandInput) { + const { name, timeout } = input; + super(`/plugins/${name}/enable`, undefined, stripUndefined({ timeout })); + } +} + +/** + * PluginDisableCommand + * + * @summary Disable a plugin + */ +export class PluginDisableCommand extends Command< + PluginDisableCommandInput, + unknown, + PluginDisableCommandQuery +> { + public override method = "post" as const; + + constructor(input: PluginDisableCommandInput) { + const { name, force } = input; + super(`/plugins/${name}/disable`, undefined, stripUndefined({ force })); + } +} + +/** + * PluginUpgradeCommand + * + * @summary Upgrade a plugin + */ +export class PluginUpgradeCommand extends Command< + PluginUpgradeCommandInput, + undefined, + PluginUpgradeCommandQuery +> { + public override method = "post" as const; + + constructor(input: PluginUpgradeCommandInput) { + const { name, remote, ...body } = input; + super( + `/plugins/${name}/upgrade`, + jsonStringify(body), + stripUndefined({ remote }), + ); + } +} + +/** + * PluginCreateCommand + * + * @summary Create a plugin + */ +export class PluginCreateCommand extends Command< + PluginCreateCommandInput, + undefined, + PluginCreateCommandQuery +> { + public override method = "post" as const; + + constructor(input: PluginCreateCommandInput) { + const { name, body } = input; + super("/plugins/create", body, stripUndefined({ name })); + } +} + +/** + * Push a plugin to the registry. + * + * @summary Push a plugin + */ +export class PluginPushCommand extends Command< + PluginPushCommandInput, + unknown +> { + public override method = "post" as const; + + constructor(input: PluginPushCommandInput) { + const { name } = input; + super(`/plugins/${name}/push`); + } +} + +/** + * PluginSetCommand + * + * @summary Configure a plugin + */ +export class PluginSetCommand extends Command< + PluginSetCommandInput, + undefined +> { + public override method = "post" as const; + + constructor(input: PluginSetCommandInput) { + const { name, ...body } = input; + super(`/plugins/${name}/set`, jsonStringify(body)); + } +} + +/** + * NodeListCommand + * + * @summary List nodes + */ +export class NodeListCommand extends Command< + NodeListCommandInput, + NodeListCommandOutput, + NodeListCommandQuery +> { + public override method = "get" as const; + + constructor(input: NodeListCommandInput) { + const { filters } = input; + super("/nodes", undefined, stripUndefined({ filters })); + } +} + +/** + * NodeInspectCommand + * + * @summary Inspect a node + */ +export class NodeInspectCommand extends Command< + NodeInspectCommandInput, + NodeInspectCommandOutput +> { + public override method = "get" as const; + + constructor(input: NodeInspectCommandInput) { + const { id } = input; + super(`/nodes/${id}`); + } +} + +/** + * NodeDeleteCommand + * + * @summary Delete a node + */ +export class NodeDeleteCommand extends Command< + NodeDeleteCommandInput, + unknown, + NodeDeleteCommandQuery +> { + public override method = "delete" as const; + + constructor(input: NodeDeleteCommandInput) { + const { id, force } = input; + super(`/nodes/${id}`, undefined, stripUndefined({ force })); + } +} + +/** + * NodeUpdateCommand + * + * @summary Update a node + */ +export class NodeUpdateCommand extends Command< + NodeUpdateCommandInput, + unknown, + NodeUpdateCommandQuery +> { + public override method = "post" as const; + + constructor(input: NodeUpdateCommandInput) { + const { id, version, ...body } = input; + super( + `/nodes/${id}/update`, + jsonStringify(body), + stripUndefined({ version }), + ); + } +} + +/** + * SwarmInspectCommand + * + * @summary Inspect swarm + */ +export class SwarmInspectCommand extends Command< + SwarmInspectCommandInput, + SwarmInspectCommandOutput +> { + public override method = "get" as const; +} + +/** + * SwarmInitCommand + * + * @summary Initialize a new swarm + */ +export class SwarmInitCommand extends Command< + SwarmInitCommandInput, + SwarmInitCommandOutput +> { + public override method = "post" as const; + + constructor(input: SwarmInitCommandInput) { + const body = input; + super("/swarm/init", jsonStringify(body)); + } +} + +/** + * SwarmJoinCommand + * + * @summary Join an existing swarm + */ +export class SwarmJoinCommand extends Command { + public override method = "post" as const; + + constructor(input: SwarmJoinCommandInput) { + const body = input; + super("/swarm/join", jsonStringify(body)); + } +} + +/** + * SwarmLeaveCommand + * + * @summary Leave a swarm + */ +export class SwarmLeaveCommand extends Command< + SwarmLeaveCommandInput, + unknown, + SwarmLeaveCommandQuery +> { + public override method = "post" as const; + + constructor(input: SwarmLeaveCommandInput) { + const { force } = input; + super("/swarm/leave", undefined, stripUndefined({ force })); + } +} + +/** + * SwarmUpdateCommand + * + * @summary Update a swarm + */ +export class SwarmUpdateCommand extends Command< + SwarmUpdateCommandInput, + unknown, + SwarmUpdateCommandQuery +> { + public override method = "post" as const; + + constructor(input: SwarmUpdateCommandInput) { + const { + version, + rotateWorkerToken, + rotateManagerToken, + rotateManagerUnlockKey, + ...body + } = input; + super( + "/swarm/update", + jsonStringify(body), + stripUndefined({ + version, + rotateWorkerToken, + rotateManagerToken, + rotateManagerUnlockKey, + }), + ); + } +} + +/** + * SwarmUnlockkeyCommand + * + * @summary Get the unlock key + */ +export class SwarmUnlockkeyCommand extends Command< + SwarmUnlockkeyCommandInput, + SwarmUnlockkeyCommandOutput +> { + public override method = "get" as const; +} + +/** + * SwarmUnlockCommand + * + * @summary Unlock a locked manager + */ +export class SwarmUnlockCommand extends Command< + SwarmUnlockCommandInput, + unknown +> { + public override method = "post" as const; + + constructor(input: SwarmUnlockCommandInput) { + const body = input; + super("/swarm/unlock", jsonStringify(body)); + } +} + +/** + * ServiceListCommand + * + * @summary List services + */ +export class ServiceListCommand extends Command< + ServiceListCommandInput, + ServiceListCommandOutput, + ServiceListCommandQuery +> { + public override method = "get" as const; + + constructor(input: ServiceListCommandInput) { + const { filters, status } = input; + super("/services", undefined, stripUndefined({ filters, status })); + } +} + +/** + * ServiceCreateCommand + * + * @summary Create a service + */ +export class ServiceCreateCommand extends Command< + ServiceCreateCommandInput, + ServiceCreateCommandOutput +> { + public override method = "post" as const; + + constructor(input: ServiceCreateCommandInput) { + const body = input; + super("/services/create", jsonStringify(body)); + } +} + +/** + * ServiceInspectCommand + * + * @summary Inspect a service + */ +export class ServiceInspectCommand extends Command< + ServiceInspectCommandInput, + ServiceInspectCommandOutput, + ServiceInspectCommandQuery +> { + public override method = "get" as const; + + constructor(input: ServiceInspectCommandInput) { + const { id, insertDefaults } = input; + super(`/services/${id}`, undefined, stripUndefined({ insertDefaults })); + } +} + +/** + * ServiceDeleteCommand + * + * @summary Delete a service + */ +export class ServiceDeleteCommand extends Command< + ServiceDeleteCommandInput, + unknown +> { + public override method = "delete" as const; + + constructor(input: ServiceDeleteCommandInput) { + const { id } = input; + super(`/services/${id}`); + } +} + +/** + * ServiceUpdateCommand + * + * @summary Update a service + */ +export class ServiceUpdateCommand extends Command< + ServiceUpdateCommandInput, + ServiceUpdateCommandOutput, + ServiceUpdateCommandQuery +> { + public override method = "post" as const; + + constructor(input: ServiceUpdateCommandInput) { + const { id, version, registryAuthFrom, rollback, ...body } = input; + super( + `/services/${id}/update`, + jsonStringify(body), + stripUndefined({ version, registryAuthFrom, rollback }), + ); + } +} + +/** + * Get `stdout` and `stderr` logs from a service. See also + * [`/containers/{id}/logs`](#operation/ContainerLogs). + * + * **Note**: This endpoint works only for services with the `local`, + * `json-file` or `journald` logging drivers. + * + * @summary Get service logs + */ +export class ServiceLogsCommand extends Command< + ServiceLogsCommandInput, + unknown, + ServiceLogsCommandQuery +> { + public override method = "get" as const; + + constructor(input: ServiceLogsCommandInput) { + const { id, details, follow, stdout, stderr, since, timestamps, tail } = + input; + super( + `/services/${id}/logs`, + undefined, + stripUndefined({ + details, + follow, + stdout, + stderr, + since, + timestamps, + tail, + }), + ); + } +} + +/** + * TaskListCommand + * + * @summary List tasks + */ +export class TaskListCommand extends Command< + TaskListCommandInput, + TaskListCommandOutput, + TaskListCommandQuery +> { + public override method = "get" as const; + + constructor(input: TaskListCommandInput) { + const { filters } = input; + super("/tasks", undefined, stripUndefined({ filters })); + } +} + +/** + * TaskInspectCommand + * + * @summary Inspect a task + */ +export class TaskInspectCommand extends Command< + TaskInspectCommandInput, + TaskInspectCommandOutput +> { + public override method = "get" as const; + + constructor(input: TaskInspectCommandInput) { + const { id } = input; + super(`/tasks/${id}`); + } +} + +/** + * Get `stdout` and `stderr` logs from a task. + * See also [`/containers/{id}/logs`](#operation/ContainerLogs). + * + * **Note**: This endpoint works only for services with the `local`, + * `json-file` or `journald` logging drivers. + * + * @summary Get task logs + */ +export class TaskLogsCommand extends Command< + TaskLogsCommandInput, + unknown, + TaskLogsCommandQuery +> { + public override method = "get" as const; + + constructor(input: TaskLogsCommandInput) { + const { id, details, follow, stdout, stderr, since, timestamps, tail } = + input; + super( + `/tasks/${id}/logs`, + undefined, + stripUndefined({ + details, + follow, + stdout, + stderr, + since, + timestamps, + tail, + }), + ); + } +} + +/** + * SecretListCommand + * + * @summary List secrets + */ +export class SecretListCommand extends Command< + SecretListCommandInput, + SecretListCommandOutput, + SecretListCommandQuery +> { + public override method = "get" as const; + + constructor(input: SecretListCommandInput) { + const { filters } = input; + super("/secrets", undefined, stripUndefined({ filters })); + } +} + +/** + * SecretCreateCommand + * + * @summary Create a secret + */ +export class SecretCreateCommand extends Command< + SecretCreateCommandInput, + SecretCreateCommandOutput +> { + public override method = "post" as const; + + constructor(input: SecretCreateCommandInput) { + const body = input; + super("/secrets/create", jsonStringify(body)); + } +} + +/** + * SecretInspectCommand + * + * @summary Inspect a secret + */ +export class SecretInspectCommand extends Command< + SecretInspectCommandInput, + SecretInspectCommandOutput +> { + public override method = "get" as const; + + constructor(input: SecretInspectCommandInput) { + const { id } = input; + super(`/secrets/${id}`); + } +} + +/** + * SecretDeleteCommand + * + * @summary Delete a secret + */ +export class SecretDeleteCommand extends Command< + SecretDeleteCommandInput, + undefined +> { + public override method = "delete" as const; + + constructor(input: SecretDeleteCommandInput) { + const { id } = input; + super(`/secrets/${id}`); + } +} + +/** + * SecretUpdateCommand + * + * @summary Update a Secret + */ +export class SecretUpdateCommand extends Command< + SecretUpdateCommandInput, + unknown, + SecretUpdateCommandQuery +> { + public override method = "post" as const; + + constructor(input: SecretUpdateCommandInput) { + const { id, version, ...body } = input; + super( + `/secrets/${id}/update`, + jsonStringify(body), + stripUndefined({ version }), + ); + } +} + +/** + * ConfigListCommand + * + * @summary List configs + */ +export class ConfigListCommand extends Command< + ConfigListCommandInput, + ConfigListCommandOutput, + ConfigListCommandQuery +> { + public override method = "get" as const; + + constructor(input: ConfigListCommandInput) { + const { filters } = input; + super("/configs", undefined, stripUndefined({ filters })); + } +} + +/** + * ConfigCreateCommand + * + * @summary Create a config + */ +export class ConfigCreateCommand extends Command< + ConfigCreateCommandInput, + ConfigCreateCommandOutput +> { + public override method = "post" as const; + + constructor(input: ConfigCreateCommandInput) { + const body = input; + super("/configs/create", jsonStringify(body)); + } +} + +/** + * ConfigInspectCommand + * + * @summary Inspect a config + */ +export class ConfigInspectCommand extends Command< + ConfigInspectCommandInput, + ConfigInspectCommandOutput +> { + public override method = "get" as const; + + constructor(input: ConfigInspectCommandInput) { + const { id } = input; + super(`/configs/${id}`); + } +} + +/** + * ConfigDeleteCommand + * + * @summary Delete a config + */ +export class ConfigDeleteCommand extends Command< + ConfigDeleteCommandInput, + undefined +> { + public override method = "delete" as const; + + constructor(input: ConfigDeleteCommandInput) { + const { id } = input; + super(`/configs/${id}`); + } +} + +/** + * ConfigUpdateCommand + * + * @summary Update a Config + */ +export class ConfigUpdateCommand extends Command< + ConfigUpdateCommandInput, + unknown, + ConfigUpdateCommandQuery +> { + public override method = "post" as const; + + constructor(input: ConfigUpdateCommandInput) { + const { id, version, ...body } = input; + super( + `/configs/${id}/update`, + jsonStringify(body), + stripUndefined({ version }), + ); + } +} + +/** + * Return image digest and platform information by contacting the registry. + * + * @summary Get image information from the registry + */ +export class DistributionInspectCommand extends Command< + DistributionInspectCommandInput, + DistributionInspectCommandOutput +> { + public override method = "get" as const; + + constructor(input: DistributionInspectCommandInput) { + const { name } = input; + super(`/distribution/${name}/json`); + } +} + +/** + * Start a new interactive session with a server. Session allows server to + * call back to the client for advanced capabilities. + * + * ### Hijacking + * + * This endpoint hijacks the HTTP connection to HTTP2 transport that allows + * the client to expose gPRC services on that connection. + * + * For example, the client sends this request to upgrade the connection: + * + * ``` + * POST /session HTTP/1.1 + * Upgrade: h2c + * Connection: Upgrade + * ``` + * + * The Docker daemon responds with a `101 UPGRADED` response follow with + * the raw stream: + * + * ``` + * HTTP/1.1 101 UPGRADED + * Connection: Upgrade + * Upgrade: h2c + * ``` + * + * @summary Initialize interactive session + */ +export class SessionCommand extends Command { + public override method = "post" as const; +} diff --git a/__tests__/fixtures/docker/hono-valibot.ts b/__tests__/fixtures/docker/hono-valibot.ts new file mode 100644 index 0000000..5e6682d --- /dev/null +++ b/__tests__/fixtures/docker/hono-valibot.ts @@ -0,0 +1,1141 @@ +/** + * This file was auto generated by @block65/openapi-codegen + * + * WARN: Do not edit directly. + * + * Generated on 2026-03-06T07:45:59.608Z + * + */ + +import { PublicValibotHonoError } from "@block65/rest-client"; +import { validator } from "hono/validator"; +import * as v from "valibot"; +import { + buildPruneCommandQuerySchema, + configCreateCommandBodySchema, + configDeleteCommandParamsSchema, + configInspectCommandParamsSchema, + configListCommandQuerySchema, + configUpdateCommandBodySchema, + configUpdateCommandParamsSchema, + configUpdateCommandQuerySchema, + containerArchiveCommandParamsSchema, + containerArchiveCommandQuerySchema, + containerArchiveInfoCommandParamsSchema, + containerArchiveInfoCommandQuerySchema, + containerAttachCommandParamsSchema, + containerAttachCommandQuerySchema, + containerAttachWebsocketCommandParamsSchema, + containerAttachWebsocketCommandQuerySchema, + containerChangesCommandParamsSchema, + containerCreateCommandBodySchema, + containerCreateCommandQuerySchema, + containerDeleteCommandParamsSchema, + containerDeleteCommandQuerySchema, + containerExecCommandBodySchema, + containerExecCommandParamsSchema, + containerExportCommandParamsSchema, + containerInspectCommandParamsSchema, + containerInspectCommandQuerySchema, + containerKillCommandParamsSchema, + containerKillCommandQuerySchema, + containerListCommandQuerySchema, + containerLogsCommandParamsSchema, + containerLogsCommandQuerySchema, + containerPauseCommandParamsSchema, + containerPruneCommandQuerySchema, + containerRenameCommandParamsSchema, + containerRenameCommandQuerySchema, + containerResizeCommandParamsSchema, + containerResizeCommandQuerySchema, + containerRestartCommandParamsSchema, + containerRestartCommandQuerySchema, + containerStartCommandParamsSchema, + containerStartCommandQuerySchema, + containerStatsCommandParamsSchema, + containerStatsCommandQuerySchema, + containerStopCommandParamsSchema, + containerStopCommandQuerySchema, + containerTopCommandParamsSchema, + containerTopCommandQuerySchema, + containerUnpauseCommandParamsSchema, + containerUpdateCommandBodySchema, + containerUpdateCommandParamsSchema, + containerWaitCommandParamsSchema, + containerWaitCommandQuerySchema, + distributionInspectCommandParamsSchema, + execInspectCommandParamsSchema, + execResizeCommandParamsSchema, + execResizeCommandQuerySchema, + execStartCommandBodySchema, + execStartCommandParamsSchema, + getPluginPrivilegesCommandQuerySchema, + imageBuildCommandQuerySchema, + imageCommitCommandBodySchema, + imageCommitCommandQuerySchema, + imageCreateCommandQuerySchema, + imageDeleteCommandParamsSchema, + imageDeleteCommandQuerySchema, + imageGetAllCommandQuerySchema, + imageGetCommandParamsSchema, + imageHistoryCommandParamsSchema, + imageInspectCommandParamsSchema, + imageListCommandQuerySchema, + imageLoadCommandQuerySchema, + imagePruneCommandQuerySchema, + imagePushCommandParamsSchema, + imagePushCommandQuerySchema, + imageSearchCommandQuerySchema, + imageTagCommandParamsSchema, + imageTagCommandQuerySchema, + networkConnectCommandBodySchema, + networkConnectCommandParamsSchema, + networkCreateCommandBodySchema, + networkDeleteCommandParamsSchema, + networkDisconnectCommandBodySchema, + networkDisconnectCommandParamsSchema, + networkInspectCommandParamsSchema, + networkInspectCommandQuerySchema, + networkListCommandQuerySchema, + networkPruneCommandQuerySchema, + nodeDeleteCommandParamsSchema, + nodeDeleteCommandQuerySchema, + nodeInspectCommandParamsSchema, + nodeListCommandQuerySchema, + nodeUpdateCommandBodySchema, + nodeUpdateCommandParamsSchema, + nodeUpdateCommandQuerySchema, + pluginCreateCommandQuerySchema, + pluginDeleteCommandParamsSchema, + pluginDeleteCommandQuerySchema, + pluginDisableCommandParamsSchema, + pluginDisableCommandQuerySchema, + pluginEnableCommandParamsSchema, + pluginEnableCommandQuerySchema, + pluginInspectCommandParamsSchema, + pluginListCommandQuerySchema, + pluginPullCommandBodySchema, + pluginPullCommandQuerySchema, + pluginPushCommandParamsSchema, + pluginSetCommandBodySchema, + pluginSetCommandParamsSchema, + pluginUpgradeCommandBodySchema, + pluginUpgradeCommandParamsSchema, + pluginUpgradeCommandQuerySchema, + putContainerArchiveCommandParamsSchema, + putContainerArchiveCommandQuerySchema, + secretCreateCommandBodySchema, + secretDeleteCommandParamsSchema, + secretInspectCommandParamsSchema, + secretListCommandQuerySchema, + secretUpdateCommandBodySchema, + secretUpdateCommandParamsSchema, + secretUpdateCommandQuerySchema, + serviceCreateCommandBodySchema, + serviceDeleteCommandParamsSchema, + serviceInspectCommandParamsSchema, + serviceInspectCommandQuerySchema, + serviceListCommandQuerySchema, + serviceLogsCommandParamsSchema, + serviceLogsCommandQuerySchema, + serviceUpdateCommandBodySchema, + serviceUpdateCommandParamsSchema, + serviceUpdateCommandQuerySchema, + swarmInitCommandBodySchema, + swarmJoinCommandBodySchema, + swarmLeaveCommandQuerySchema, + swarmUnlockCommandBodySchema, + swarmUpdateCommandBodySchema, + swarmUpdateCommandQuerySchema, + systemAuthCommandBodySchema, + systemDataUsageCommandQuerySchema, + systemEventsCommandQuerySchema, + taskInspectCommandParamsSchema, + taskListCommandQuerySchema, + taskLogsCommandParamsSchema, + taskLogsCommandQuerySchema, + volumeCreateCommandBodySchema, + volumeDeleteCommandParamsSchema, + volumeDeleteCommandQuerySchema, + volumeInspectCommandParamsSchema, + volumeListCommandQuerySchema, + volumePruneCommandQuerySchema, + volumeUpdateCommandBodySchema, + volumeUpdateCommandParamsSchema, + volumeUpdateCommandQuerySchema, +} from "./valibot.js"; + +function toPublicValibotHonoError(err: unknown): never { + if (err instanceof v.ValiError) { + throw PublicValibotHonoError.from(err); + } + throw err; +} + +export const ContainerList = [ + validator("query", (value) => { + return v + .parseAsync(containerListCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ContainerCreate = [ + validator("json", (value) => { + return v + .parseAsync(containerCreateCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(containerCreateCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ContainerInspect = [ + validator("param", (value) => { + return v + .parseAsync(containerInspectCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(containerInspectCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ContainerTop = [ + validator("param", (value) => { + return v + .parseAsync(containerTopCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(containerTopCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ContainerLogs = [ + validator("param", (value) => { + return v + .parseAsync(containerLogsCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(containerLogsCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ContainerChanges = [ + validator("param", (value) => { + return v + .parseAsync(containerChangesCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ContainerExport = [ + validator("param", (value) => { + return v + .parseAsync(containerExportCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ContainerStats = [ + validator("param", (value) => { + return v + .parseAsync(containerStatsCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(containerStatsCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ContainerResize = [ + validator("param", (value) => { + return v + .parseAsync(containerResizeCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(containerResizeCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ContainerStart = [ + validator("param", (value) => { + return v + .parseAsync(containerStartCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(containerStartCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ContainerStop = [ + validator("param", (value) => { + return v + .parseAsync(containerStopCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(containerStopCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ContainerRestart = [ + validator("param", (value) => { + return v + .parseAsync(containerRestartCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(containerRestartCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ContainerKill = [ + validator("param", (value) => { + return v + .parseAsync(containerKillCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(containerKillCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ContainerUpdate = [ + validator("json", (value) => { + return v + .parseAsync(containerUpdateCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(containerUpdateCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ContainerRename = [ + validator("param", (value) => { + return v + .parseAsync(containerRenameCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(containerRenameCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ContainerPause = [ + validator("param", (value) => { + return v + .parseAsync(containerPauseCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ContainerUnpause = [ + validator("param", (value) => { + return v + .parseAsync(containerUnpauseCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ContainerAttach = [ + validator("param", (value) => { + return v + .parseAsync(containerAttachCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(containerAttachCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ContainerAttachWebsocket = [ + validator("param", (value) => { + return v + .parseAsync(containerAttachWebsocketCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(containerAttachWebsocketCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ContainerWait = [ + validator("param", (value) => { + return v + .parseAsync(containerWaitCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(containerWaitCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ContainerDelete = [ + validator("param", (value) => { + return v + .parseAsync(containerDeleteCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(containerDeleteCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ContainerArchive = [ + validator("param", (value) => { + return v + .parseAsync(containerArchiveCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(containerArchiveCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const PutContainerArchive = [ + validator("param", (value) => { + return v + .parseAsync(putContainerArchiveCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(putContainerArchiveCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ContainerArchiveInfo = [ + validator("param", (value) => { + return v + .parseAsync(containerArchiveInfoCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(containerArchiveInfoCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ContainerPrune = [ + validator("query", (value) => { + return v + .parseAsync(containerPruneCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ImageList = [ + validator("query", (value) => { + return v + .parseAsync(imageListCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ImageBuild = [ + validator("query", (value) => { + return v + .parseAsync(imageBuildCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const BuildPrune = [ + validator("query", (value) => { + return v + .parseAsync(buildPruneCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ImageCreate = [ + validator("query", (value) => { + return v + .parseAsync(imageCreateCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ImageInspect = [ + validator("param", (value) => { + return v + .parseAsync(imageInspectCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ImageHistory = [ + validator("param", (value) => { + return v + .parseAsync(imageHistoryCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ImagePush = [ + validator("param", (value) => { + return v + .parseAsync(imagePushCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(imagePushCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ImageTag = [ + validator("param", (value) => { + return v + .parseAsync(imageTagCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(imageTagCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ImageDelete = [ + validator("param", (value) => { + return v + .parseAsync(imageDeleteCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(imageDeleteCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ImageSearch = [ + validator("query", (value) => { + return v + .parseAsync(imageSearchCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ImagePrune = [ + validator("query", (value) => { + return v + .parseAsync(imagePruneCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const SystemAuth = [ + validator("json", (value) => { + return v + .parseAsync(systemAuthCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const SystemInfo = [] as const; +export const SystemVersion = [] as const; +export const SystemPing = [] as const; +export const SystemPingHead = [] as const; +export const ImageCommit = [ + validator("json", (value) => { + return v + .parseAsync(imageCommitCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(imageCommitCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const SystemEvents = [ + validator("query", (value) => { + return v + .parseAsync(systemEventsCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const SystemDataUsage = [ + validator("query", (value) => { + return v + .parseAsync(systemDataUsageCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ImageGet = [ + validator("param", (value) => { + return v + .parseAsync(imageGetCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ImageGetAll = [ + validator("query", (value) => { + return v + .parseAsync(imageGetAllCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ImageLoad = [ + validator("query", (value) => { + return v + .parseAsync(imageLoadCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ContainerExec = [ + validator("json", (value) => { + return v + .parseAsync(containerExecCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(containerExecCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ExecStart = [ + validator("json", (value) => { + return v + .parseAsync(execStartCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(execStartCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ExecResize = [ + validator("param", (value) => { + return v + .parseAsync(execResizeCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(execResizeCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ExecInspect = [ + validator("param", (value) => { + return v + .parseAsync(execInspectCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const VolumeList = [ + validator("query", (value) => { + return v + .parseAsync(volumeListCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const VolumeCreate = [ + validator("json", (value) => { + return v + .parseAsync(volumeCreateCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const VolumeInspect = [ + validator("param", (value) => { + return v + .parseAsync(volumeInspectCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const VolumeUpdate = [ + validator("json", (value) => { + return v + .parseAsync(volumeUpdateCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(volumeUpdateCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(volumeUpdateCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const VolumeDelete = [ + validator("param", (value) => { + return v + .parseAsync(volumeDeleteCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(volumeDeleteCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const VolumePrune = [ + validator("query", (value) => { + return v + .parseAsync(volumePruneCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const NetworkList = [ + validator("query", (value) => { + return v + .parseAsync(networkListCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const NetworkInspect = [ + validator("param", (value) => { + return v + .parseAsync(networkInspectCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(networkInspectCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const NetworkDelete = [ + validator("param", (value) => { + return v + .parseAsync(networkDeleteCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const NetworkCreate = [ + validator("json", (value) => { + return v + .parseAsync(networkCreateCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const NetworkConnect = [ + validator("json", (value) => { + return v + .parseAsync(networkConnectCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(networkConnectCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const NetworkDisconnect = [ + validator("json", (value) => { + return v + .parseAsync(networkDisconnectCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(networkDisconnectCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const NetworkPrune = [ + validator("query", (value) => { + return v + .parseAsync(networkPruneCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const PluginList = [ + validator("query", (value) => { + return v + .parseAsync(pluginListCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const GetPluginPrivileges = [ + validator("query", (value) => { + return v + .parseAsync(getPluginPrivilegesCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const PluginPull = [ + validator("json", (value) => { + return v + .parseAsync(pluginPullCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(pluginPullCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const PluginInspect = [ + validator("param", (value) => { + return v + .parseAsync(pluginInspectCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const PluginDelete = [ + validator("param", (value) => { + return v + .parseAsync(pluginDeleteCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(pluginDeleteCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const PluginEnable = [ + validator("param", (value) => { + return v + .parseAsync(pluginEnableCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(pluginEnableCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const PluginDisable = [ + validator("param", (value) => { + return v + .parseAsync(pluginDisableCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(pluginDisableCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const PluginUpgrade = [ + validator("json", (value) => { + return v + .parseAsync(pluginUpgradeCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(pluginUpgradeCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(pluginUpgradeCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const PluginCreate = [ + validator("query", (value) => { + return v + .parseAsync(pluginCreateCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const PluginPush = [ + validator("param", (value) => { + return v + .parseAsync(pluginPushCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const PluginSet = [ + validator("json", (value) => { + return v + .parseAsync(pluginSetCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(pluginSetCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const NodeList = [ + validator("query", (value) => { + return v + .parseAsync(nodeListCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const NodeInspect = [ + validator("param", (value) => { + return v + .parseAsync(nodeInspectCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const NodeDelete = [ + validator("param", (value) => { + return v + .parseAsync(nodeDeleteCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(nodeDeleteCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const NodeUpdate = [ + validator("json", (value) => { + return v + .parseAsync(nodeUpdateCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(nodeUpdateCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(nodeUpdateCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const SwarmInspect = [] as const; +export const SwarmInit = [ + validator("json", (value) => { + return v + .parseAsync(swarmInitCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const SwarmJoin = [ + validator("json", (value) => { + return v + .parseAsync(swarmJoinCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const SwarmLeave = [ + validator("query", (value) => { + return v + .parseAsync(swarmLeaveCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const SwarmUpdate = [ + validator("json", (value) => { + return v + .parseAsync(swarmUpdateCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(swarmUpdateCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const SwarmUnlockkey = [] as const; +export const SwarmUnlock = [ + validator("json", (value) => { + return v + .parseAsync(swarmUnlockCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ServiceList = [ + validator("query", (value) => { + return v + .parseAsync(serviceListCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ServiceCreate = [ + validator("json", (value) => { + return v + .parseAsync(serviceCreateCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ServiceInspect = [ + validator("param", (value) => { + return v + .parseAsync(serviceInspectCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(serviceInspectCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ServiceDelete = [ + validator("param", (value) => { + return v + .parseAsync(serviceDeleteCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ServiceUpdate = [ + validator("json", (value) => { + return v + .parseAsync(serviceUpdateCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(serviceUpdateCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(serviceUpdateCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ServiceLogs = [ + validator("param", (value) => { + return v + .parseAsync(serviceLogsCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(serviceLogsCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const TaskList = [ + validator("query", (value) => { + return v + .parseAsync(taskListCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const TaskInspect = [ + validator("param", (value) => { + return v + .parseAsync(taskInspectCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const TaskLogs = [ + validator("param", (value) => { + return v + .parseAsync(taskLogsCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(taskLogsCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const SecretList = [ + validator("query", (value) => { + return v + .parseAsync(secretListCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const SecretCreate = [ + validator("json", (value) => { + return v + .parseAsync(secretCreateCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const SecretInspect = [ + validator("param", (value) => { + return v + .parseAsync(secretInspectCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const SecretDelete = [ + validator("param", (value) => { + return v + .parseAsync(secretDeleteCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const SecretUpdate = [ + validator("json", (value) => { + return v + .parseAsync(secretUpdateCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(secretUpdateCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(secretUpdateCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ConfigList = [ + validator("query", (value) => { + return v + .parseAsync(configListCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ConfigCreate = [ + validator("json", (value) => { + return v + .parseAsync(configCreateCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ConfigInspect = [ + validator("param", (value) => { + return v + .parseAsync(configInspectCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ConfigDelete = [ + validator("param", (value) => { + return v + .parseAsync(configDeleteCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const ConfigUpdate = [ + validator("json", (value) => { + return v + .parseAsync(configUpdateCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(configUpdateCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(configUpdateCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const DistributionInspect = [ + validator("param", (value) => { + return v + .parseAsync(distributionInspectCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const Session = [] as const; diff --git a/__tests__/fixtures/docker/main.ts b/__tests__/fixtures/docker/main.ts new file mode 100644 index 0000000..4e3b3ac --- /dev/null +++ b/__tests__/fixtures/docker/main.ts @@ -0,0 +1,353 @@ +/** + * This file was auto generated by @block65/openapi-codegen + * + * WARN: Do not edit directly. + * + * Generated on 2026-03-06T07:45:59.608Z + * + */ +import { + RestServiceClient, + type RestServiceClientConfig, +} from "@block65/rest-client"; +import type { + BuildPruneCommandInput, + BuildPruneCommandOutput, + ConfigCreateCommandInput, + ConfigCreateCommandOutput, + ConfigDeleteCommandInput, + ConfigInspectCommandInput, + ConfigInspectCommandOutput, + ConfigListCommandInput, + ConfigListCommandOutput, + ConfigUpdateCommandInput, + ContainerArchiveCommandInput, + ContainerArchiveInfoCommandInput, + ContainerAttachCommandInput, + ContainerAttachWebsocketCommandInput, + ContainerChangesCommandInput, + ContainerChangesCommandOutput, + ContainerCreateCommandInput, + ContainerCreateCommandOutput, + ContainerDeleteCommandInput, + ContainerExecCommandInput, + ContainerExecCommandOutput, + ContainerExportCommandInput, + ContainerInspectCommandInput, + ContainerInspectCommandOutput, + ContainerKillCommandInput, + ContainerListCommandInput, + ContainerListCommandOutput, + ContainerLogsCommandInput, + ContainerPauseCommandInput, + ContainerPruneCommandInput, + ContainerPruneCommandOutput, + ContainerRenameCommandInput, + ContainerResizeCommandInput, + ContainerRestartCommandInput, + ContainerStartCommandInput, + ContainerStatsCommandInput, + ContainerStatsCommandOutput, + ContainerStopCommandInput, + ContainerTopCommandInput, + ContainerTopCommandOutput, + ContainerUnpauseCommandInput, + ContainerUpdateCommandInput, + ContainerUpdateCommandOutput, + ContainerWaitCommandInput, + ContainerWaitCommandOutput, + DistributionInspectCommandInput, + DistributionInspectCommandOutput, + ExecInspectCommandInput, + ExecInspectCommandOutput, + ExecResizeCommandInput, + ExecStartCommandInput, + GetPluginPrivilegesCommandInput, + GetPluginPrivilegesCommandOutput, + ImageBuildCommandInput, + ImageCommitCommandInput, + ImageCommitCommandOutput, + ImageCreateCommandInput, + ImageDeleteCommandInput, + ImageDeleteCommandOutput, + ImageGetAllCommandInput, + ImageGetCommandInput, + ImageHistoryCommandInput, + ImageHistoryCommandOutput, + ImageInspectCommandInput, + ImageInspectCommandOutput, + ImageListCommandInput, + ImageListCommandOutput, + ImageLoadCommandInput, + ImagePruneCommandInput, + ImagePruneCommandOutput, + ImagePushCommandInput, + ImageSearchCommandInput, + ImageSearchCommandOutput, + ImageTagCommandInput, + NetworkConnectCommandInput, + NetworkCreateCommandInput, + NetworkCreateCommandOutput, + NetworkDeleteCommandInput, + NetworkDisconnectCommandInput, + NetworkInspectCommandInput, + NetworkInspectCommandOutput, + NetworkListCommandInput, + NetworkListCommandOutput, + NetworkPruneCommandInput, + NetworkPruneCommandOutput, + NodeDeleteCommandInput, + NodeInspectCommandInput, + NodeInspectCommandOutput, + NodeListCommandInput, + NodeListCommandOutput, + NodeUpdateCommandInput, + PluginCreateCommandInput, + PluginDeleteCommandInput, + PluginDeleteCommandOutput, + PluginDisableCommandInput, + PluginEnableCommandInput, + PluginInspectCommandInput, + PluginInspectCommandOutput, + PluginListCommandInput, + PluginListCommandOutput, + PluginPullCommandInput, + PluginPushCommandInput, + PluginSetCommandInput, + PluginUpgradeCommandInput, + PutContainerArchiveCommandInput, + SecretCreateCommandInput, + SecretCreateCommandOutput, + SecretDeleteCommandInput, + SecretInspectCommandInput, + SecretInspectCommandOutput, + SecretListCommandInput, + SecretListCommandOutput, + SecretUpdateCommandInput, + ServiceCreateCommandInput, + ServiceCreateCommandOutput, + ServiceDeleteCommandInput, + ServiceInspectCommandInput, + ServiceInspectCommandOutput, + ServiceListCommandInput, + ServiceListCommandOutput, + ServiceLogsCommandInput, + ServiceUpdateCommandInput, + ServiceUpdateCommandOutput, + SessionCommandInput, + SwarmInitCommandInput, + SwarmInitCommandOutput, + SwarmInspectCommandInput, + SwarmInspectCommandOutput, + SwarmJoinCommandInput, + SwarmLeaveCommandInput, + SwarmUnlockCommandInput, + SwarmUnlockkeyCommandInput, + SwarmUnlockkeyCommandOutput, + SwarmUpdateCommandInput, + SystemAuthCommandInput, + SystemAuthCommandOutput, + SystemDataUsageCommandInput, + SystemDataUsageCommandOutput, + SystemEventsCommandInput, + SystemEventsCommandOutput, + SystemInfoCommandInput, + SystemInfoCommandOutput, + SystemPingCommandInput, + SystemPingHeadCommandInput, + SystemVersionCommandInput, + SystemVersionCommandOutput, + TaskInspectCommandInput, + TaskInspectCommandOutput, + TaskListCommandInput, + TaskListCommandOutput, + TaskLogsCommandInput, + VolumeCreateCommandInput, + VolumeCreateCommandOutput, + VolumeDeleteCommandInput, + VolumeInspectCommandInput, + VolumeInspectCommandOutput, + VolumeListCommandInput, + VolumeListCommandOutput, + VolumePruneCommandInput, + VolumePruneCommandOutput, + VolumeUpdateCommandInput, +} from "./types.js"; + +type AllInputs = + | BuildPruneCommandInput + | ConfigCreateCommandInput + | ConfigDeleteCommandInput + | ConfigInspectCommandInput + | ConfigListCommandInput + | ConfigUpdateCommandInput + | ContainerArchiveCommandInput + | ContainerArchiveInfoCommandInput + | ContainerAttachCommandInput + | ContainerAttachWebsocketCommandInput + | ContainerChangesCommandInput + | ContainerCreateCommandInput + | ContainerDeleteCommandInput + | ContainerExecCommandInput + | ContainerExportCommandInput + | ContainerInspectCommandInput + | ContainerKillCommandInput + | ContainerListCommandInput + | ContainerLogsCommandInput + | ContainerPauseCommandInput + | ContainerPruneCommandInput + | ContainerRenameCommandInput + | ContainerResizeCommandInput + | ContainerRestartCommandInput + | ContainerStartCommandInput + | ContainerStatsCommandInput + | ContainerStopCommandInput + | ContainerTopCommandInput + | ContainerUnpauseCommandInput + | ContainerUpdateCommandInput + | ContainerWaitCommandInput + | DistributionInspectCommandInput + | ExecInspectCommandInput + | ExecResizeCommandInput + | ExecStartCommandInput + | GetPluginPrivilegesCommandInput + | ImageBuildCommandInput + | ImageCommitCommandInput + | ImageCreateCommandInput + | ImageDeleteCommandInput + | ImageGetAllCommandInput + | ImageGetCommandInput + | ImageHistoryCommandInput + | ImageInspectCommandInput + | ImageListCommandInput + | ImageLoadCommandInput + | ImagePruneCommandInput + | ImagePushCommandInput + | ImageSearchCommandInput + | ImageTagCommandInput + | NetworkConnectCommandInput + | NetworkCreateCommandInput + | NetworkDeleteCommandInput + | NetworkDisconnectCommandInput + | NetworkInspectCommandInput + | NetworkListCommandInput + | NetworkPruneCommandInput + | NodeDeleteCommandInput + | NodeInspectCommandInput + | NodeListCommandInput + | NodeUpdateCommandInput + | PluginCreateCommandInput + | PluginDeleteCommandInput + | PluginDisableCommandInput + | PluginEnableCommandInput + | PluginInspectCommandInput + | PluginListCommandInput + | PluginPullCommandInput + | PluginPushCommandInput + | PluginSetCommandInput + | PluginUpgradeCommandInput + | PutContainerArchiveCommandInput + | SecretCreateCommandInput + | SecretDeleteCommandInput + | SecretInspectCommandInput + | SecretListCommandInput + | SecretUpdateCommandInput + | ServiceCreateCommandInput + | ServiceDeleteCommandInput + | ServiceInspectCommandInput + | ServiceListCommandInput + | ServiceLogsCommandInput + | ServiceUpdateCommandInput + | SessionCommandInput + | SwarmInitCommandInput + | SwarmInspectCommandInput + | SwarmJoinCommandInput + | SwarmLeaveCommandInput + | SwarmUnlockCommandInput + | SwarmUnlockkeyCommandInput + | SwarmUpdateCommandInput + | SystemAuthCommandInput + | SystemDataUsageCommandInput + | SystemEventsCommandInput + | SystemInfoCommandInput + | SystemPingCommandInput + | SystemPingHeadCommandInput + | SystemVersionCommandInput + | TaskInspectCommandInput + | TaskListCommandInput + | TaskLogsCommandInput + | VolumeCreateCommandInput + | VolumeDeleteCommandInput + | VolumeInspectCommandInput + | VolumeListCommandInput + | VolumePruneCommandInput + | VolumeUpdateCommandInput; +type AllOutputs = + | BuildPruneCommandOutput + | ConfigCreateCommandOutput + | ConfigInspectCommandOutput + | ConfigListCommandOutput + | ContainerChangesCommandOutput + | ContainerCreateCommandOutput + | ContainerExecCommandOutput + | ContainerInspectCommandOutput + | ContainerListCommandOutput + | ContainerPruneCommandOutput + | ContainerStatsCommandOutput + | ContainerTopCommandOutput + | ContainerUpdateCommandOutput + | ContainerWaitCommandOutput + | DistributionInspectCommandOutput + | ExecInspectCommandOutput + | GetPluginPrivilegesCommandOutput + | ImageCommitCommandOutput + | ImageDeleteCommandOutput + | ImageHistoryCommandOutput + | ImageInspectCommandOutput + | ImageListCommandOutput + | ImagePruneCommandOutput + | ImageSearchCommandOutput + | NetworkCreateCommandOutput + | NetworkInspectCommandOutput + | NetworkListCommandOutput + | NetworkPruneCommandOutput + | NodeInspectCommandOutput + | NodeListCommandOutput + | PluginDeleteCommandOutput + | PluginInspectCommandOutput + | PluginListCommandOutput + | SecretCreateCommandOutput + | SecretInspectCommandOutput + | SecretListCommandOutput + | ServiceCreateCommandOutput + | ServiceInspectCommandOutput + | ServiceListCommandOutput + | ServiceUpdateCommandOutput + | SwarmInitCommandOutput + | SwarmInspectCommandOutput + | SwarmUnlockkeyCommandOutput + | SystemAuthCommandOutput + | SystemDataUsageCommandOutput + | SystemEventsCommandOutput + | SystemInfoCommandOutput + | SystemVersionCommandOutput + | TaskInspectCommandOutput + | TaskListCommandOutput + | undefined + | unknown + | VolumeCreateCommandOutput + | VolumeInspectCommandOutput + | VolumeListCommandOutput + | VolumePruneCommandOutput; + +export class DockerEngineApiRestClient extends RestServiceClient< + AllInputs, + AllOutputs +> { + constructor( + baseUrl: string | URL = new URL("http://docker.local:2375/v1.43/"), + config?: RestServiceClientConfig, + ) { + super(baseUrl, config); + } +} diff --git a/__tests__/fixtures/docker/types.ts b/__tests__/fixtures/docker/types.ts new file mode 100644 index 0000000..5c7cceb --- /dev/null +++ b/__tests__/fixtures/docker/types.ts @@ -0,0 +1,15796 @@ +/** + * This file was auto generated by @block65/openapi-codegen + * + * WARN: Do not edit directly. + * + * Generated on 2026-03-06T07:45:59.608Z + * + */ +import type { Jsonifiable } from "type-fest"; + +/** An open port on a container */ +export type Port = { + IP?: string; + PrivatePort: number; + PublicPort?: number; + Type: "tcp" | "udp" | "sctp"; +}; +/** + * MountPoint represents a mount point configuration inside the container. + * This is used for reporting the mountpoints in use by a container. + */ +export type MountPoint = { + /** + * The mount type: + * + * - `bind` a mount of a file or directory from the host into the container. + * - `volume` a docker volume with the given `Name`. + * - `tmpfs` a `tmpfs`. + * - `npipe` a named pipe from the host into the container. + * - `cluster` a Swarm cluster volume + * @enum bind,volume,tmpfs,npipe,cluster + * @example volume + */ + Type?: "bind" | "volume" | "tmpfs" | "npipe" | "cluster"; + /** + * Name is the name reference to the underlying data defined by `Source` + * e.g., the volume name. + * @example myvolume + */ + Name?: string; + /** + * Source location of the mount. + * + * For volumes, this contains the storage location of the volume (within + * `/var/lib/docker/volumes/`). For bind-mounts, and `npipe`, this contains + * the source (host) part of the bind-mount. For `tmpfs` mount points, this + * field is empty. + * @example /var/lib/docker/volumes/myvolume/_data + */ + Source?: string; + /** + * Destination is the path relative to the container root (`/`) where + * the `Source` is mounted inside the container. + * @example /usr/share/nginx/html/ + */ + Destination?: string; + /** + * Driver is the volume driver used to create the volume (if it is a volume). + * @example local + */ + Driver?: string; + /** + * Mode is a comma separated list of options supplied by the user when + * creating the bind/volume mount. + * + * The default is platform-specific (`"z"` on Linux, empty on Windows). + * @example z + */ + Mode?: string; + /** + * Whether the mount is mounted writable (read-write). + * @example true + */ + RW?: boolean; + /** + * Propagation describes how mounts are propagated from the host into the + * mount point, and vice-versa. Refer to the [Linux kernel + * documentation](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt) + * for details. This field is not used on Windows. + * @example + */ + Propagation?: string; +}; +/** A device mapping between the host and container */ +export type DeviceMapping = { + PathOnHost?: string; + PathInContainer?: string; + CgroupPermissions?: string; +}; +/** A request for devices to be sent to device drivers */ +export type DeviceRequest = { + Driver?: string; + Count?: number; + DeviceIDs?: readonly string[]; + /** + * A list of capabilities; an OR list of AND lists of capabilities. + * @example gpu,nvidia,compute + */ + Capabilities?: readonly (readonly string[])[]; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; +}; +export type ThrottleDevice = { + Path?: string; + Rate?: number; +}; +export type Mount = { + Target?: string; + Source?: string; + /** + * The mount type. Available types: + * + * - `bind` Mounts a file or directory from the host into the container. Must + * exist prior to creating the container. + * - `volume` Creates a volume with the given name and options (or uses a + * pre-existing volume with the same name and options). These are **not** + * removed when the container is removed. + * - `tmpfs` Create a tmpfs with the given options. The mount source cannot be + * specified for tmpfs. + * - `npipe` Mounts a named pipe from the host into the container. Must exist + * prior to creating the container. + * - `cluster` a Swarm cluster volume + * @enum bind,volume,tmpfs,npipe,cluster + */ + Type?: "bind" | "volume" | "tmpfs" | "npipe" | "cluster"; + ReadOnly?: boolean; + Consistency?: string; + BindOptions?: { + /** + * A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + * @enum private,rprivate,shared,rshared,slave,rslave + */ + Propagation?: + | "private" + | "rprivate" + | "shared" + | "rshared" + | "slave" + | "rslave"; + NonRecursive?: boolean; + CreateMountpoint?: boolean; + }; + VolumeOptions?: { + NoCopy?: boolean; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + DriverConfig?: { + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; + TmpfsOptions?: { + SizeBytes?: number; + Mode?: number; + }; +}; +/** + * The behavior to apply when the container exits. The default is not to + * restart. + * + * An ever increasing delay (double the previous delay, starting at 100ms) is + * added before each restart to prevent flooding the server. + */ +export type RestartPolicy = { + /** + * - Empty string means not to restart + * - `no` Do not automatically restart + * - `always` Always restart + * - `unless-stopped` Restart always except when the user has manually stopped + * the container + * - `on-failure` Restart only when the container exit code is non-zero + * @enum ,no,always,unless-stopped,on-failure + */ + Name?: "" | "no" | "always" | "unless-stopped" | "on-failure"; + MaximumRetryCount?: number; +}; +/** A container's resources (cgroups config, ulimits, etc) */ +export type Resources = { + CpuShares?: number; + Memory?: number; + CgroupParent?: string; + BlkioWeight?: number; + BlkioWeightDevice?: readonly { + Path?: string; + Weight?: number; + }[]; + BlkioDeviceReadBps?: readonly { + Path?: string; + Rate?: number; + }[]; + BlkioDeviceWriteBps?: readonly { + Path?: string; + Rate?: number; + }[]; + BlkioDeviceReadIOps?: readonly { + Path?: string; + Rate?: number; + }[]; + BlkioDeviceWriteIOps?: readonly { + Path?: string; + Rate?: number; + }[]; + CpuPeriod?: number; + CpuQuota?: number; + CpuRealtimePeriod?: number; + CpuRealtimeRuntime?: number; + /** + * CPUs in which to allow execution (e.g., `0-3`, `0,1`). + * @example 0-3 + */ + CpusetCpus?: string; + CpusetMems?: string; + Devices?: readonly { + PathOnHost?: string; + PathInContainer?: string; + CgroupPermissions?: string; + }[]; + DeviceCgroupRules?: readonly string[]; + DeviceRequests?: readonly { + Driver?: string; + Count?: number; + DeviceIDs?: readonly string[]; + /** + * A list of capabilities; an OR list of AND lists of capabilities. + * @example gpu,nvidia,compute + */ + Capabilities?: readonly (readonly string[])[]; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; + KernelMemoryTCP?: number; + MemoryReservation?: number; + MemorySwap?: number; + MemorySwappiness?: number; + NanoCpus?: number; + OomKillDisable?: boolean; + Init?: boolean | null; + PidsLimit?: number | null; + Ulimits?: readonly { + Name?: string; + Soft?: number; + Hard?: number; + }[]; + CpuCount?: number; + CpuPercent?: number; + IOMaximumIOps?: number; + IOMaximumBandwidth?: number; +}; +/** An object describing a limit on resources which can be requested by a task. */ +export type Limit = { + NanoCPUs?: number; + MemoryBytes?: number; + /** + * Limits the maximum number of PIDs in the container. Set `0` for unlimited. + * @example 100 + */ + Pids?: number; +}; +/** + * An object describing the resources which can be advertised by a node and + * requested by a task. + */ +export type ResourceObject = { + NanoCPUs?: number; + MemoryBytes?: number; + /** + * User-defined resources can be either Integer resources (e.g, `SSD=3`) or + * String resources (e.g, `GPU=UUID1`). + * @example [object Object],[object Object],[object Object] + */ + GenericResources?: readonly { + NamedResourceSpec?: { + Kind?: string; + Value?: string; + }; + DiscreteResourceSpec?: { + Kind?: string; + Value?: number; + }; + }[]; +}; +/** A test to perform to check that the container is healthy. */ +export type HealthConfig = { + Test?: readonly string[]; + Interval?: number; + Timeout?: number; + Retries?: number; + StartPeriod?: number; +}; +/** Health stores information about the container's healthcheck results. */ +export type Health = { + /** + * Status is one of `none`, `starting`, `healthy` or `unhealthy` + * + * - "none" Indicates there is no healthcheck + * - "starting" Starting indicates that the container is not yet ready + * - "healthy" Healthy indicates that the container is running correctly + * - "unhealthy" Unhealthy indicates that the container has a problem + * @enum none,starting,healthy,unhealthy + * @example healthy + */ + Status?: "none" | "starting" | "healthy" | "unhealthy"; + /** + * FailingStreak is the number of consecutive failures + * @example 0 + */ + FailingStreak?: number; + Log?: readonly { + /** + * Date and time at which this check started in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2020-01-04T10:44:24.496525531Z + */ + Start?: string; + /** + * Date and time at which this check ended in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2020-01-04T10:45:21.364524523Z + */ + End?: string; + /** + * ExitCode meanings: + * + * - `0` healthy + * - `1` unhealthy + * - `2` reserved (considered unhealthy) + * - other values: error running probe + * @example 0 + */ + ExitCode?: number; + Output?: string; + }[]; +}; +/** + * HealthcheckResult stores information about a single run of a healthcheck + * probe + */ +export type HealthcheckResult = { + /** + * Date and time at which this check started in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2020-01-04T10:44:24.496525531Z + */ + Start?: string; + /** + * Date and time at which this check ended in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2020-01-04T10:45:21.364524523Z + */ + End?: string; + /** + * ExitCode meanings: + * + * - `0` healthy + * - `1` unhealthy + * - `2` reserved (considered unhealthy) + * - other values: error running probe + * @example 0 + */ + ExitCode?: number; + Output?: string; +}; +/** Container configuration that depends on the host we are running on */ +export type HostConfig = { + CpuShares?: number; + Memory?: number; + CgroupParent?: string; + BlkioWeight?: number; + BlkioWeightDevice?: readonly { + Path?: string; + Weight?: number; + }[]; + BlkioDeviceReadBps?: readonly { + Path?: string; + Rate?: number; + }[]; + BlkioDeviceWriteBps?: readonly { + Path?: string; + Rate?: number; + }[]; + BlkioDeviceReadIOps?: readonly { + Path?: string; + Rate?: number; + }[]; + BlkioDeviceWriteIOps?: readonly { + Path?: string; + Rate?: number; + }[]; + CpuPeriod?: number; + CpuQuota?: number; + CpuRealtimePeriod?: number; + CpuRealtimeRuntime?: number; + /** + * CPUs in which to allow execution (e.g., `0-3`, `0,1`). + * @example 0-3 + */ + CpusetCpus?: string; + CpusetMems?: string; + Devices?: readonly { + PathOnHost?: string; + PathInContainer?: string; + CgroupPermissions?: string; + }[]; + DeviceCgroupRules?: readonly string[]; + DeviceRequests?: readonly { + Driver?: string; + Count?: number; + DeviceIDs?: readonly string[]; + /** + * A list of capabilities; an OR list of AND lists of capabilities. + * @example gpu,nvidia,compute + */ + Capabilities?: readonly (readonly string[])[]; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; + KernelMemoryTCP?: number; + MemoryReservation?: number; + MemorySwap?: number; + MemorySwappiness?: number; + NanoCpus?: number; + OomKillDisable?: boolean; + Init?: boolean | null; + PidsLimit?: number | null; + Ulimits?: readonly { + Name?: string; + Soft?: number; + Hard?: number; + }[]; + CpuCount?: number; + CpuPercent?: number; + IOMaximumIOps?: number; + IOMaximumBandwidth?: number; +} & { + Binds?: readonly string[]; + ContainerIDFile?: string; + LogConfig?: { + Type?: + | "json-file" + | "syslog" + | "journald" + | "gelf" + | "fluentd" + | "awslogs" + | "splunk" + | "etwlogs" + | "none"; + Config?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + NetworkMode?: string; + PortBindings?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + RestartPolicy?: { + /** + * - Empty string means not to restart + * - `no` Do not automatically restart + * - `always` Always restart + * - `unless-stopped` Restart always except when the user has manually stopped + * the container + * - `on-failure` Restart only when the container exit code is non-zero + * @enum ,no,always,unless-stopped,on-failure + */ + Name?: "" | "no" | "always" | "unless-stopped" | "on-failure"; + MaximumRetryCount?: number; + }; + AutoRemove?: boolean; + VolumeDriver?: string; + VolumesFrom?: readonly string[]; + Mounts?: readonly { + Target?: string; + Source?: string; + /** + * The mount type. Available types: + * + * - `bind` Mounts a file or directory from the host into the container. Must + * exist prior to creating the container. + * - `volume` Creates a volume with the given name and options (or uses a + * pre-existing volume with the same name and options). These are **not** + * removed when the container is removed. + * - `tmpfs` Create a tmpfs with the given options. The mount source cannot be + * specified for tmpfs. + * - `npipe` Mounts a named pipe from the host into the container. Must exist + * prior to creating the container. + * - `cluster` a Swarm cluster volume + * @enum bind,volume,tmpfs,npipe,cluster + */ + Type?: "bind" | "volume" | "tmpfs" | "npipe" | "cluster"; + ReadOnly?: boolean; + Consistency?: string; + BindOptions?: { + /** + * A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + * @enum private,rprivate,shared,rshared,slave,rslave + */ + Propagation?: + | "private" + | "rprivate" + | "shared" + | "rshared" + | "slave" + | "rslave"; + NonRecursive?: boolean; + CreateMountpoint?: boolean; + }; + VolumeOptions?: { + NoCopy?: boolean; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + DriverConfig?: { + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; + TmpfsOptions?: { + SizeBytes?: number; + Mode?: number; + }; + }[]; + ConsoleSize?: readonly number[]; + Annotations?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + CapAdd?: readonly string[]; + CapDrop?: readonly string[]; + /** + * cgroup namespace mode for the container. Possible values are: + * + * - `"private"`: the container runs in its own private cgroup namespace + * - `"host"`: use the host system's cgroup namespace + * + * If not specified, the daemon default is used, which can either be + * `"private"` + * or `"host"`, depending on daemon version, kernel support and configuration. + * @enum private,host + */ + CgroupnsMode?: "private" | "host"; + Dns?: readonly string[]; + DnsOptions?: readonly string[]; + DnsSearch?: readonly string[]; + ExtraHosts?: readonly string[]; + GroupAdd?: readonly string[]; + IpcMode?: string; + Cgroup?: string; + Links?: readonly string[]; + /** + * An integer value containing the score given to the container in + * order to tune OOM killer preferences. + * @example 500 + */ + OomScoreAdj?: number; + PidMode?: string; + Privileged?: boolean; + PublishAllPorts?: boolean; + ReadonlyRootfs?: boolean; + SecurityOpt?: readonly string[]; + StorageOpt?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Tmpfs?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + UTSMode?: string; + UsernsMode?: string; + ShmSize?: number; + Sysctls?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Runtime?: string; + /** + * Isolation technology of the container. (Windows only) + * @enum default,process,hyperv, + */ + Isolation?: "default" | "process" | "hyperv" | ""; + MaskedPaths?: readonly string[]; + ReadonlyPaths?: readonly string[]; +}; +/** + * Configuration for a container that is portable between hosts. + * + * When used as `ContainerConfig` field in an image, `ContainerConfig` is an + * optional field containing the configuration of the container that was last + * committed when creating the image. + * + * Previous versions of Docker builder used this field to store build cache, + * and it is not in active use anymore. + */ +export type ContainerConfig = { + /** + * The hostname to use for the container, as a valid RFC 1123 hostname. + * @example 439f4e91bd1d + */ + Hostname?: string; + Domainname?: string; + User?: string; + AttachStdin?: boolean; + /** + * Whether to attach to `stdout`. + * @default true + */ + AttachStdout?: boolean; + /** + * Whether to attach to `stderr`. + * @default true + */ + AttachStderr?: boolean; + ExposedPorts?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Tty?: boolean; + OpenStdin?: boolean; + StdinOnce?: boolean; + /** + * A list of environment variables to set inside the container in the + * form `["VAR=value", ...]`. A variable without `=` is removed from the + * environment, rather than to have an empty value. + * @example PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + */ + Env?: readonly string[]; + /** + * Command to run specified as a string or an array of strings. + * @example /bin/sh + */ + Cmd?: readonly string[]; + Healthcheck?: { + Test?: readonly string[]; + Interval?: number; + Timeout?: number; + Retries?: number; + StartPeriod?: number; + }; + /** + * Command is already escaped (Windows only) + * @example false + */ + ArgsEscaped?: boolean | null; + /** + * The name (or reference) of the image to use when creating the container, + * or which was used when the container was created. + * @example example-image:1.0 + */ + Image?: string; + Volumes?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * The working directory for commands to run in. + * @example /public/ + */ + WorkingDir?: string; + /** + * The entry point for the container as a string or an array of strings. + * + * If the array consists of exactly one empty string (`[""]`) then the + * entry point is reset to system default (i.e., the entry point used by + * docker when there is no `ENTRYPOINT` instruction in the `Dockerfile`). + * @example + */ + Entrypoint?: readonly string[]; + NetworkDisabled?: boolean | null; + MacAddress?: string; + /** + * `ONBUILD` metadata that were defined in the image's `Dockerfile`. + * @example + */ + OnBuild?: readonly string[]; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * Signal to stop a container as a string or unsigned integer. + * @example SIGTERM + */ + StopSignal?: string; + StopTimeout?: number | null; + /** + * Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell. + * @example /bin/sh,-c + */ + Shell?: readonly string[]; +}; +/** + * Configuration of the image. These fields are used as defaults + * when starting a container from the image. + */ +export type ImageConfig = { + /** + * The hostname to use for the container, as a valid RFC 1123 hostname. + * + *


+ * + * > **Note**: this field is always empty and must not be used. + * @example + */ + Hostname?: string; + /** + * The domain name to use for the container. + * + *


+ * + * > **Note**: this field is always empty and must not be used. + * @example + */ + Domainname?: string; + /** + * The user that commands are run as inside the container. + * @example web:web + */ + User?: string; + /** + * Whether to attach to `stdin`. + * + *


+ * + * > **Note**: this field is always false and must not be used. + * @example false + */ + AttachStdin?: boolean; + /** + * Whether to attach to `stdout`. + * + *


+ * + * > **Note**: this field is always false and must not be used. + * @example false + */ + AttachStdout?: boolean; + /** + * Whether to attach to `stderr`. + * + *


+ * + * > **Note**: this field is always false and must not be used. + * @example false + */ + AttachStderr?: boolean; + ExposedPorts?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * Attach standard streams to a TTY, including `stdin` if it is not closed. + * + *


+ * + * > **Note**: this field is always false and must not be used. + * @example false + */ + Tty?: boolean; + /** + * Open `stdin` + * + *


+ * + * > **Note**: this field is always false and must not be used. + * @example false + */ + OpenStdin?: boolean; + /** + * Close `stdin` after one attached client disconnects. + * + *


+ * + * > **Note**: this field is always false and must not be used. + * @example false + */ + StdinOnce?: boolean; + /** + * A list of environment variables to set inside the container in the + * form `["VAR=value", ...]`. A variable without `=` is removed from the + * environment, rather than to have an empty value. + * @example PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + */ + Env?: readonly string[]; + /** + * Command to run specified as a string or an array of strings. + * @example /bin/sh + */ + Cmd?: readonly string[]; + Healthcheck?: { + Test?: readonly string[]; + Interval?: number; + Timeout?: number; + Retries?: number; + StartPeriod?: number; + }; + /** + * Command is already escaped (Windows only) + * @example false + */ + ArgsEscaped?: boolean | null; + /** + * The name (or reference) of the image to use when creating the container, + * or which was used when the container was created. + * + *


+ * + * > **Note**: this field is always empty and must not be used. + * @example + */ + Image?: string; + Volumes?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * The working directory for commands to run in. + * @example /public/ + */ + WorkingDir?: string; + /** + * The entry point for the container as a string or an array of strings. + * + * If the array consists of exactly one empty string (`[""]`) then the + * entry point is reset to system default (i.e., the entry point used by + * docker when there is no `ENTRYPOINT` instruction in the `Dockerfile`). + * @example + */ + Entrypoint?: readonly string[]; + /** + * Disable networking for the container. + * + *


+ * + * > **Note**: this field is always omitted and must not be used. + * @example false + */ + NetworkDisabled?: boolean | null; + /** + * MAC address of the container. + * + *


+ * + * > **Note**: this field is always omitted and must not be used. + * @example + */ + MacAddress?: string; + /** + * `ONBUILD` metadata that were defined in the image's `Dockerfile`. + * @example + */ + OnBuild?: readonly string[]; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * Signal to stop a container as a string or unsigned integer. + * @example SIGTERM + */ + StopSignal?: string; + StopTimeout?: number | null; + /** + * Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell. + * @example /bin/sh,-c + */ + Shell?: readonly string[]; +}; +/** + * NetworkingConfig represents the container's networking configuration for + * each of its interfaces. + * It is used for the networking configs specified in the `docker create` + * and `docker network connect` commands. + */ +export type NetworkingConfig = { + EndpointsConfig?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; +}; +/** NetworkSettings exposes the network settings in the API */ +export type NetworkSettings = { + /** + * Name of the network's bridge (for example, `docker0`). + * @example docker0 + */ + Bridge?: string; + /** + * SandboxID uniquely represents a container's network stack. + * @example 9d12daf2c33f5959c8bf90aa513e4f65b561738661003029ec84830cd503a0c3 + */ + SandboxID?: string; + /** + * Indicates if hairpin NAT should be enabled on the virtual interface. + * @example false + */ + HairpinMode?: boolean; + /** + * IPv6 unicast address using the link-local prefix. + * @example fe80::42:acff:fe11:1 + */ + LinkLocalIPv6Address?: string; + /** + * Prefix length of the IPv6 unicast address. + * @example 64 + */ + LinkLocalIPv6PrefixLen?: number; + Ports?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * SandboxKey identifies the sandbox + * @example /var/run/docker/netns/8ab54b426c38 + */ + SandboxKey?: string; + SecondaryIPAddresses?: readonly { + Addr?: string; + PrefixLen?: number; + }[]; + SecondaryIPv6Addresses?: readonly { + Addr?: string; + PrefixLen?: number; + }[]; + /** + * EndpointID uniquely represents a service endpoint in a Sandbox. + * + *


+ * + * > **Deprecated**: This field is only propagated when attached to the + * > default "bridge" network. Use the information from the "bridge" + * > network inside the `Networks` map instead, which contains the same + * > information. This field was deprecated in Docker 1.9 and is scheduled + * > to be removed in Docker 17.12.0 + * @example b88f5b905aabf2893f3cbc4ee42d1ea7980bbc0a92e2c8922b1e1795298afb0b + */ + EndpointID?: string; + /** + * Gateway address for the default "bridge" network. + * + *


+ * + * > **Deprecated**: This field is only propagated when attached to the + * > default "bridge" network. Use the information from the "bridge" + * > network inside the `Networks` map instead, which contains the same + * > information. This field was deprecated in Docker 1.9 and is scheduled + * > to be removed in Docker 17.12.0 + * @example 172.17.0.1 + */ + Gateway?: string; + /** + * Global IPv6 address for the default "bridge" network. + * + *


+ * + * > **Deprecated**: This field is only propagated when attached to the + * > default "bridge" network. Use the information from the "bridge" + * > network inside the `Networks` map instead, which contains the same + * > information. This field was deprecated in Docker 1.9 and is scheduled + * > to be removed in Docker 17.12.0 + * @example 2001:db8::5689 + */ + GlobalIPv6Address?: string; + /** + * Mask length of the global IPv6 address. + * + *


+ * + * > **Deprecated**: This field is only propagated when attached to the + * > default "bridge" network. Use the information from the "bridge" + * > network inside the `Networks` map instead, which contains the same + * > information. This field was deprecated in Docker 1.9 and is scheduled + * > to be removed in Docker 17.12.0 + * @example 64 + */ + GlobalIPv6PrefixLen?: number; + /** + * IPv4 address for the default "bridge" network. + * + *


+ * + * > **Deprecated**: This field is only propagated when attached to the + * > default "bridge" network. Use the information from the "bridge" + * > network inside the `Networks` map instead, which contains the same + * > information. This field was deprecated in Docker 1.9 and is scheduled + * > to be removed in Docker 17.12.0 + * @example 172.17.0.4 + */ + IPAddress?: string; + /** + * Mask length of the IPv4 address. + * + *


+ * + * > **Deprecated**: This field is only propagated when attached to the + * > default "bridge" network. Use the information from the "bridge" + * > network inside the `Networks` map instead, which contains the same + * > information. This field was deprecated in Docker 1.9 and is scheduled + * > to be removed in Docker 17.12.0 + * @example 16 + */ + IPPrefixLen?: number; + /** + * IPv6 gateway address for this network. + * + *


+ * + * > **Deprecated**: This field is only propagated when attached to the + * > default "bridge" network. Use the information from the "bridge" + * > network inside the `Networks` map instead, which contains the same + * > information. This field was deprecated in Docker 1.9 and is scheduled + * > to be removed in Docker 17.12.0 + * @example 2001:db8:2::100 + */ + IPv6Gateway?: string; + /** + * MAC address for the container on the default "bridge" network. + * + *


+ * + * > **Deprecated**: This field is only propagated when attached to the + * > default "bridge" network. Use the information from the "bridge" + * > network inside the `Networks` map instead, which contains the same + * > information. This field was deprecated in Docker 1.9 and is scheduled + * > to be removed in Docker 17.12.0 + * @example 02:42:ac:11:00:04 + */ + MacAddress?: string; + Networks?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; +}; +/** Address represents an IPv4 or IPv6 IP address. */ +export type Address = { + Addr?: string; + PrefixLen?: number; +}; +/** + * PortMap describes the mapping of container ports to host ports, using the + * container's port-number and protocol as key in the format + * `/`, + * for example, `80/udp`. + * + * If a container's port is mapped for multiple protocols, separate entries + * are added to the mapping table. + */ +export type PortMap = Record; +/** + * PortBinding represents a binding between a host IP address and a host + * port. + */ +export type PortBinding = { + /** + * Host IP address that the container's port is mapped to. + * @example 127.0.0.1 + */ + HostIp?: string; + /** + * Host port number that the container's port is mapped to. + * @example 4443 + */ + HostPort?: string; +}; +/** + * Information about the storage driver used to store the container's and + * image's filesystem. + */ +export type GraphDriverData = { + /** + * Name of the storage driver. + * @example overlay2 + */ + Name: string; + Data: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; +}; +/** Change in the container's filesystem. */ +export type FilesystemChange = { + Path: string; + /** + * Kind of change + * + * Can be one of: + * + * - `0`: Modified ("C") + * - `1`: Added ("A") + * - `2`: Deleted ("D") + * @enum 0,1,2 + */ + Kind: number; +}; +/** + * Kind of change + * + * Can be one of: + * + * - `0`: Modified ("C") + * - `1`: Added ("A") + * - `2`: Deleted ("D") + */ +export type ChangeType = number; +/** Information about an image in the local image cache. */ +export type ImageInspect = { + /** + * ID is the content-addressable ID of an image. + * + * This identifier is a content-addressable digest calculated from the + * image's configuration (which includes the digests of layers used by + * the image). + * + * Note that this digest differs from the `RepoDigests` below, which + * holds digests of image manifests that reference the image. + * @example sha256:ec3f0931a6e6b6855d76b2d7b0be30e81860baccd891b2e243280bf1cd8ad710 + */ + Id?: string; + /** + * List of image names/tags in the local image cache that reference this + * image. + * + * Multiple image tags can refer to the same image, and this list may be + * empty if no tags reference the image, in which case the image is + * "untagged", in which case it can still be referenced by its ID. + * @example example:1.0,example:latest,example:stable,internal.registry.example.com:5000/example:1.0 + */ + RepoTags?: readonly string[]; + /** + * List of content-addressable digests of locally available image manifests + * that the image is referenced from. Multiple manifests can refer to the + * same image. + * + * These digests are usually only available if the image was either pulled + * from a registry, or if the image was pushed to a registry, which is when + * the manifest is generated and its digest calculated. + * @example example@sha256:afcc7f1ac1b49db317a7196c902e61c6c3c4607d63599ee1a82d702d249a0ccb,internal.registry.example.com:5000/example@sha256:b69959407d21e8a062e0416bf13405bb2b71ed7a84dde4158ebafacfa06f5578 + */ + RepoDigests?: readonly string[]; + /** + * ID of the parent image. + * + * Depending on how the image was created, this field may be empty and + * is only set for images that were built/created locally. This field + * is empty if the image was pulled from an image registry. + * @example + */ + Parent?: string; + /** + * Optional message that was set when committing or importing the image. + * @example + */ + Comment?: string; + /** + * Date and time at which the image was created, formatted in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2022-02-04T21:20:12.497794809Z + */ + Created?: string; + /** + * The ID of the container that was used to create the image. + * + * Depending on how the image was created, this field may be empty. + * @example 65974bc86f1770ae4bff79f651ebdbce166ae9aada632ee3fa9af3a264911735 + */ + Container?: string; + ContainerConfig?: { + /** + * The hostname to use for the container, as a valid RFC 1123 hostname. + * @example 439f4e91bd1d + */ + Hostname?: string; + Domainname?: string; + User?: string; + AttachStdin?: boolean; + /** + * Whether to attach to `stdout`. + * @default true + */ + AttachStdout?: boolean; + /** + * Whether to attach to `stderr`. + * @default true + */ + AttachStderr?: boolean; + ExposedPorts?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Tty?: boolean; + OpenStdin?: boolean; + StdinOnce?: boolean; + /** + * A list of environment variables to set inside the container in the + * form `["VAR=value", ...]`. A variable without `=` is removed from the + * environment, rather than to have an empty value. + * @example PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + */ + Env?: readonly string[]; + /** + * Command to run specified as a string or an array of strings. + * @example /bin/sh + */ + Cmd?: readonly string[]; + Healthcheck?: { + Test?: readonly string[]; + Interval?: number; + Timeout?: number; + Retries?: number; + StartPeriod?: number; + }; + /** + * Command is already escaped (Windows only) + * @example false + */ + ArgsEscaped?: boolean | null; + /** + * The name (or reference) of the image to use when creating the container, + * or which was used when the container was created. + * @example example-image:1.0 + */ + Image?: string; + Volumes?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * The working directory for commands to run in. + * @example /public/ + */ + WorkingDir?: string; + /** + * The entry point for the container as a string or an array of strings. + * + * If the array consists of exactly one empty string (`[""]`) then the + * entry point is reset to system default (i.e., the entry point used by + * docker when there is no `ENTRYPOINT` instruction in the `Dockerfile`). + * @example + */ + Entrypoint?: readonly string[]; + NetworkDisabled?: boolean | null; + MacAddress?: string; + /** + * `ONBUILD` metadata that were defined in the image's `Dockerfile`. + * @example + */ + OnBuild?: readonly string[]; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * Signal to stop a container as a string or unsigned integer. + * @example SIGTERM + */ + StopSignal?: string; + StopTimeout?: number | null; + /** + * Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell. + * @example /bin/sh,-c + */ + Shell?: readonly string[]; + }; + /** + * The version of Docker that was used to build the image. + * + * Depending on how the image was created, this field may be empty. + * @example 20.10.7 + */ + DockerVersion?: string; + /** + * Name of the author that was specified when committing the image, or as + * specified through MAINTAINER (deprecated) in the Dockerfile. + * @example + */ + Author?: string; + /** + * Configuration of the image. These fields are used as defaults + * when starting a container from the image. + * @example [object Object] + */ + Config?: { + /** + * The hostname to use for the container, as a valid RFC 1123 hostname. + * + *


+ * + * > **Note**: this field is always empty and must not be used. + * @example + */ + Hostname?: string; + /** + * The domain name to use for the container. + * + *


+ * + * > **Note**: this field is always empty and must not be used. + * @example + */ + Domainname?: string; + /** + * The user that commands are run as inside the container. + * @example web:web + */ + User?: string; + /** + * Whether to attach to `stdin`. + * + *


+ * + * > **Note**: this field is always false and must not be used. + * @example false + */ + AttachStdin?: boolean; + /** + * Whether to attach to `stdout`. + * + *


+ * + * > **Note**: this field is always false and must not be used. + * @example false + */ + AttachStdout?: boolean; + /** + * Whether to attach to `stderr`. + * + *


+ * + * > **Note**: this field is always false and must not be used. + * @example false + */ + AttachStderr?: boolean; + ExposedPorts?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * Attach standard streams to a TTY, including `stdin` if it is not closed. + * + *


+ * + * > **Note**: this field is always false and must not be used. + * @example false + */ + Tty?: boolean; + /** + * Open `stdin` + * + *


+ * + * > **Note**: this field is always false and must not be used. + * @example false + */ + OpenStdin?: boolean; + /** + * Close `stdin` after one attached client disconnects. + * + *


+ * + * > **Note**: this field is always false and must not be used. + * @example false + */ + StdinOnce?: boolean; + /** + * A list of environment variables to set inside the container in the + * form `["VAR=value", ...]`. A variable without `=` is removed from the + * environment, rather than to have an empty value. + * @example PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + */ + Env?: readonly string[]; + /** + * Command to run specified as a string or an array of strings. + * @example /bin/sh + */ + Cmd?: readonly string[]; + Healthcheck?: { + Test?: readonly string[]; + Interval?: number; + Timeout?: number; + Retries?: number; + StartPeriod?: number; + }; + /** + * Command is already escaped (Windows only) + * @example false + */ + ArgsEscaped?: boolean | null; + /** + * The name (or reference) of the image to use when creating the container, + * or which was used when the container was created. + * + *


+ * + * > **Note**: this field is always empty and must not be used. + * @example + */ + Image?: string; + Volumes?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * The working directory for commands to run in. + * @example /public/ + */ + WorkingDir?: string; + /** + * The entry point for the container as a string or an array of strings. + * + * If the array consists of exactly one empty string (`[""]`) then the + * entry point is reset to system default (i.e., the entry point used by + * docker when there is no `ENTRYPOINT` instruction in the `Dockerfile`). + * @example + */ + Entrypoint?: readonly string[]; + /** + * Disable networking for the container. + * + *


+ * + * > **Note**: this field is always omitted and must not be used. + * @example false + */ + NetworkDisabled?: boolean | null; + /** + * MAC address of the container. + * + *


+ * + * > **Note**: this field is always omitted and must not be used. + * @example + */ + MacAddress?: string; + /** + * `ONBUILD` metadata that were defined in the image's `Dockerfile`. + * @example + */ + OnBuild?: readonly string[]; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * Signal to stop a container as a string or unsigned integer. + * @example SIGTERM + */ + StopSignal?: string; + StopTimeout?: number | null; + /** + * Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell. + * @example /bin/sh,-c + */ + Shell?: readonly string[]; + }; + /** + * Hardware CPU architecture that the image runs on. + * @example arm + */ + Architecture?: string; + /** + * CPU architecture variant (presently ARM-only). + * @example v7 + */ + Variant?: string; + /** + * Operating System the image is built to run on. + * @example linux + */ + Os?: string; + /** + * Operating System version the image is built to run on (especially + * for Windows). + * @example + */ + OsVersion?: string; + /** + * Total size of the image including all layers it is composed of. + * @example 1239828 + */ + Size?: number; + /** + * Total size of the image including all layers it is composed of. + * + * In versions of Docker before v1.10, this field was calculated from + * the image itself and all of its parent images. Images are now stored + * self-contained, and no longer use a parent-chain, making this field + * an equivalent of the Size field. + * + * > **Deprecated**: this field is kept for backward compatibility, but + * > will be removed in API v1.44. + * @example 1239828 + */ + VirtualSize?: number; + GraphDriver?: { + /** + * Name of the storage driver. + * @example overlay2 + */ + Name: string; + Data: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + RootFS?: { + Type: string; + Layers?: readonly string[]; + }; + Metadata?: { + /** + * Date and time at which the image was last tagged in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * + * This information is only available if the image was tagged locally, + * and omitted otherwise. + * @example 2022-02-28T14:40:02.623929178Z + */ + LastTagTime?: string; + }; +}; +export type ImageSummary = { + /** + * ID is the content-addressable ID of an image. + * + * This identifier is a content-addressable digest calculated from the + * image's configuration (which includes the digests of layers used by + * the image). + * + * Note that this digest differs from the `RepoDigests` below, which + * holds digests of image manifests that reference the image. + * @example sha256:ec3f0931a6e6b6855d76b2d7b0be30e81860baccd891b2e243280bf1cd8ad710 + */ + Id: string; + /** + * ID of the parent image. + * + * Depending on how the image was created, this field may be empty and + * is only set for images that were built/created locally. This field + * is empty if the image was pulled from an image registry. + * @example + */ + ParentId: string; + /** + * List of image names/tags in the local image cache that reference this + * image. + * + * Multiple image tags can refer to the same image, and this list may be + * empty if no tags reference the image, in which case the image is + * "untagged", in which case it can still be referenced by its ID. + * @example example:1.0,example:latest,example:stable,internal.registry.example.com:5000/example:1.0 + */ + RepoTags: readonly string[]; + /** + * List of content-addressable digests of locally available image manifests + * that the image is referenced from. Multiple manifests can refer to the + * same image. + * + * These digests are usually only available if the image was either pulled + * from a registry, or if the image was pushed to a registry, which is when + * the manifest is generated and its digest calculated. + * @example example@sha256:afcc7f1ac1b49db317a7196c902e61c6c3c4607d63599ee1a82d702d249a0ccb,internal.registry.example.com:5000/example@sha256:b69959407d21e8a062e0416bf13405bb2b71ed7a84dde4158ebafacfa06f5578 + */ + RepoDigests: readonly string[]; + /** + * Date and time at which the image was created as a Unix timestamp + * (number of seconds since EPOCH). + * @example 1644009612 + */ + Created: number; + /** + * Total size of the image including all layers it is composed of. + * @example 172064416 + */ + Size: number; + /** + * Total size of image layers that are shared between this image and other + * images. + * + * This size is not calculated by default. `-1` indicates that the value + * has not been set / calculated. + * @example 1239828 + */ + SharedSize: number; + /** + * Total size of the image including all layers it is composed of. + * + * In versions of Docker before v1.10, this field was calculated from + * the image itself and all of its parent images. Images are now stored + * self-contained, and no longer use a parent-chain, making this field + * an equivalent of the Size field. + * + * Deprecated: this field is kept for backward compatibility, and will be + * removed in API v1.44. + * @example 172064416 + */ + VirtualSize?: number; + Labels: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * Number of containers using this image. Includes both stopped and running + * containers. + * + * This size is not calculated by default, and depends on which API endpoint + * is used. `-1` indicates that the value has not been set / calculated. + * @example 2 + */ + Containers: number; +}; +export type AuthConfig = { + username?: string; + password?: string; + email?: string; + serveraddress?: string; +}; +export type ProcessConfig = { + privileged?: boolean; + user?: string; + tty?: boolean; + entrypoint?: string; + arguments?: readonly string[]; +}; +export type Volume = { + /** + * Name of the volume. + * @example tardis + */ + Name: string; + /** + * Name of the volume driver used by the volume. + * @example custom + */ + Driver: string; + /** + * Mount path of the volume on the host. + * @example /var/lib/docker/volumes/tardis + */ + Mountpoint: string; + /** + * Date/Time the volume was created. + * @example 2016-06-07T20:31:11.853781916Z + */ + CreatedAt?: string; + Status?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Labels: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * The level at which the volume exists. Either `global` for cluster-wide, + * or `local` for machine level. + * @default local + * @enum local,global + * @example local + */ + Scope: "local" | "global"; + ClusterVolume?: { + ID?: string; + Version?: { + Index?: number; + }; + CreatedAt?: string; + UpdatedAt?: string; + Spec?: { + Group?: string; + AccessMode?: { + /** + * The set of nodes this volume can be used on at one time. + * - `single` The volume may only be scheduled to one node at a time. + * - `multi` the volume may be scheduled to any supported number of nodes at a + * time. + * @default single + * @enum single,multi + */ + Scope?: "single" | "multi"; + /** + * The number and way that different tasks can use this volume + * at one time. + * - `none` The volume may only be used by one task at a time. + * - `readonly` The volume may be used by any number of tasks, but they all + * must mount the volume as readonly + * - `onewriter` The volume may be used by any number of tasks, but only one + * may mount it as read/write. + * - `all` The volume may have any number of readers and writers. + * @default none + * @enum none,readonly,onewriter,all + */ + Sharing?: "none" | "readonly" | "onewriter" | "all"; + MountVolume?: {}; + Secrets?: readonly { + Key?: string; + Secret?: string; + }[]; + AccessibilityRequirements?: { + Requisite?: readonly Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >[]; + Preferred?: readonly Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >[]; + }; + CapacityRange?: { + RequiredBytes?: number; + LimitBytes?: number; + }; + /** + * The availability of the volume for use in tasks. + * - `active` The volume is fully available for scheduling on the cluster + * - `pause` No new workloads should use the volume, but existing workloads + * are not stopped. + * - `drain` All workloads using this volume should be stopped and + * rescheduled, and no new ones should be started. + * @default active + * @enum active,pause,drain + */ + Availability?: "active" | "pause" | "drain"; + }; + }; + Info?: { + CapacityBytes?: number; + VolumeContext?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + VolumeID?: string; + AccessibleTopology?: readonly Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >[]; + }; + PublishStatus?: readonly { + NodeID?: string; + /** + * The published state of the volume. + * * `pending-publish` The volume should be published to this node, but the + * call to the controller plugin to do so has not yet been successfully + * completed. + * * `published` The volume is published successfully to the node. + * * `pending-node-unpublish` The volume should be unpublished from the node, + * and the manager is awaiting confirmation from the worker that it has done + * so. + * * `pending-controller-unpublish` The volume is successfully unpublished + * from the node, but has not yet been successfully unpublished on the + * controller. + * @enum pending-publish,published,pending-node-unpublish,pending-controller-unpublish + */ + State?: + | "pending-publish" + | "published" + | "pending-node-unpublish" + | "pending-controller-unpublish"; + PublishContext?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; + }; + Options: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + UsageData?: { + /** + * Amount of disk space used by the volume (in bytes). This information + * is only available for volumes created with the `"local"` volume + * driver. For volumes created with other volume drivers, this field + * is set to `-1` ("not available") + * @default -1 + */ + Size: number; + /** + * The number of containers referencing this volume. This field + * is set to `-1` if the reference-count is not available. + * @default -1 + */ + RefCount: number; + }; +}; +/** Volume configuration */ +export type VolumeCreateOptions = { + /** + * The new volume's name. If not specified, Docker generates a name. + * @example tardis + */ + Name?: string; + /** + * Name of the volume driver to use. + * @default local + * @example custom + */ + Driver?: string; + DriverOpts?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + ClusterVolumeSpec?: { + Group?: string; + AccessMode?: { + /** + * The set of nodes this volume can be used on at one time. + * - `single` The volume may only be scheduled to one node at a time. + * - `multi` the volume may be scheduled to any supported number of nodes at a + * time. + * @default single + * @enum single,multi + */ + Scope?: "single" | "multi"; + /** + * The number and way that different tasks can use this volume + * at one time. + * - `none` The volume may only be used by one task at a time. + * - `readonly` The volume may be used by any number of tasks, but they all + * must mount the volume as readonly + * - `onewriter` The volume may be used by any number of tasks, but only one + * may mount it as read/write. + * - `all` The volume may have any number of readers and writers. + * @default none + * @enum none,readonly,onewriter,all + */ + Sharing?: "none" | "readonly" | "onewriter" | "all"; + MountVolume?: {}; + Secrets?: readonly { + Key?: string; + Secret?: string; + }[]; + AccessibilityRequirements?: { + Requisite?: readonly Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >[]; + Preferred?: readonly Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >[]; + }; + CapacityRange?: { + RequiredBytes?: number; + LimitBytes?: number; + }; + /** + * The availability of the volume for use in tasks. + * - `active` The volume is fully available for scheduling on the cluster + * - `pause` No new workloads should use the volume, but existing workloads + * are not stopped. + * - `drain` All workloads using this volume should be stopped and + * rescheduled, and no new ones should be started. + * @default active + * @enum active,pause,drain + */ + Availability?: "active" | "pause" | "drain"; + }; + }; +}; +/** Volume list response */ +export type VolumeListResponse = { + Volumes?: readonly { + /** + * Name of the volume. + * @example tardis + */ + Name: string; + /** + * Name of the volume driver used by the volume. + * @example custom + */ + Driver: string; + /** + * Mount path of the volume on the host. + * @example /var/lib/docker/volumes/tardis + */ + Mountpoint: string; + /** + * Date/Time the volume was created. + * @example 2016-06-07T20:31:11.853781916Z + */ + CreatedAt?: string; + Status?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Labels: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * The level at which the volume exists. Either `global` for cluster-wide, + * or `local` for machine level. + * @default local + * @enum local,global + * @example local + */ + Scope: "local" | "global"; + ClusterVolume?: { + ID?: string; + Version?: { + Index?: number; + }; + CreatedAt?: string; + UpdatedAt?: string; + Spec?: { + Group?: string; + AccessMode?: { + /** + * The set of nodes this volume can be used on at one time. + * - `single` The volume may only be scheduled to one node at a time. + * - `multi` the volume may be scheduled to any supported number of nodes at a + * time. + * @default single + * @enum single,multi + */ + Scope?: "single" | "multi"; + /** + * The number and way that different tasks can use this volume + * at one time. + * - `none` The volume may only be used by one task at a time. + * - `readonly` The volume may be used by any number of tasks, but they all + * must mount the volume as readonly + * - `onewriter` The volume may be used by any number of tasks, but only one + * may mount it as read/write. + * - `all` The volume may have any number of readers and writers. + * @default none + * @enum none,readonly,onewriter,all + */ + Sharing?: "none" | "readonly" | "onewriter" | "all"; + MountVolume?: {}; + Secrets?: readonly { + Key?: string; + Secret?: string; + }[]; + AccessibilityRequirements?: { + Requisite?: readonly Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >[]; + Preferred?: readonly Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >[]; + }; + CapacityRange?: { + RequiredBytes?: number; + LimitBytes?: number; + }; + /** + * The availability of the volume for use in tasks. + * - `active` The volume is fully available for scheduling on the cluster + * - `pause` No new workloads should use the volume, but existing workloads + * are not stopped. + * - `drain` All workloads using this volume should be stopped and + * rescheduled, and no new ones should be started. + * @default active + * @enum active,pause,drain + */ + Availability?: "active" | "pause" | "drain"; + }; + }; + Info?: { + CapacityBytes?: number; + VolumeContext?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + VolumeID?: string; + AccessibleTopology?: readonly Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >[]; + }; + PublishStatus?: readonly { + NodeID?: string; + /** + * The published state of the volume. + * * `pending-publish` The volume should be published to this node, but the + * call to the controller plugin to do so has not yet been successfully + * completed. + * * `published` The volume is published successfully to the node. + * * `pending-node-unpublish` The volume should be unpublished from the node, + * and the manager is awaiting confirmation from the worker that it has done + * so. + * * `pending-controller-unpublish` The volume is successfully unpublished + * from the node, but has not yet been successfully unpublished on the + * controller. + * @enum pending-publish,published,pending-node-unpublish,pending-controller-unpublish + */ + State?: + | "pending-publish" + | "published" + | "pending-node-unpublish" + | "pending-controller-unpublish"; + PublishContext?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; + }; + Options: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + UsageData?: { + /** + * Amount of disk space used by the volume (in bytes). This information + * is only available for volumes created with the `"local"` volume + * driver. For volumes created with other volume drivers, this field + * is set to `-1` ("not available") + * @default -1 + */ + Size: number; + /** + * The number of containers referencing this volume. This field + * is set to `-1` if the reference-count is not available. + * @default -1 + */ + RefCount: number; + }; + }[]; + /** + * Warnings that occurred when fetching the list of volumes. + * @example + */ + Warnings?: readonly string[]; +}; +export type Network = { + /** + * Name of the network. + * @example my_network + */ + Name?: string; + /** + * ID that uniquely identifies a network on a single machine. + * @example 7d86d31b1478e7cca9ebed7e73aa0fdeec46c5ca29497431d3007d2d9e15ed99 + */ + Id?: string; + /** + * Date and time at which the network was created in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2016-10-19T04:33:30.360899459Z + */ + Created?: string; + /** + * The level at which the network exists (e.g. `swarm` for cluster-wide + * or `local` for machine level) + * @example local + */ + Scope?: string; + /** + * The name of the driver used to create the network (e.g. `bridge`, + * `overlay`). + * @example overlay + */ + Driver?: string; + /** + * Whether the network was created with IPv6 enabled. + * @example false + */ + EnableIPv6?: boolean; + IPAM?: { + /** + * Name of the IPAM driver to use. + * @default default + * @example default + */ + Driver?: string; + Config?: readonly { + Subnet?: string; + IPRange?: string; + Gateway?: string; + AuxiliaryAddresses?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + /** + * Whether the network is created to only allow internal networking + * connectivity. + * @example false + */ + Internal?: boolean; + /** + * Whether a global / swarm scope network is manually attachable by regular + * containers from workers in swarm mode. + * @example false + */ + Attachable?: boolean; + /** + * Whether the network is providing the routing-mesh for the swarm cluster. + * @example false + */ + Ingress?: boolean; + ConfigFrom?: { + /** + * The name of the config-only network that provides the network's + * configuration. The specified network must be an existing config-only + * network. Only network names are allowed, not network IDs. + * @example config_only_network_01 + */ + Network?: string; + }; + ConfigOnly?: boolean; + Containers?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Peers?: readonly { + /** + * ID of the peer-node in the Swarm cluster. + * @example 6869d7c1732b + */ + Name?: string; + /** + * IP-address of the peer-node in the Swarm cluster. + * @example 10.133.77.91 + */ + IP?: string; + }[]; +}; +/** + * The config-only network source to provide the configuration for + * this network. + */ +export type ConfigReference = { + /** + * The name of the config-only network that provides the network's + * configuration. The specified network must be an existing config-only + * network. Only network names are allowed, not network IDs. + * @example config_only_network_01 + */ + Network?: string; +}; +export type Ipam = { + /** + * Name of the IPAM driver to use. + * @default default + * @example default + */ + Driver?: string; + Config?: readonly { + Subnet?: string; + IPRange?: string; + Gateway?: string; + AuxiliaryAddresses?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; +}; +export type IpamConfig = { + Subnet?: string; + IPRange?: string; + Gateway?: string; + AuxiliaryAddresses?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; +}; +export type NetworkContainer = { + Name?: string; + EndpointID?: string; + MacAddress?: string; + IPv4Address?: string; + IPv6Address?: string; +}; +/** PeerInfo represents one peer of an overlay network. */ +export type PeerInfo = { + /** + * ID of the peer-node in the Swarm cluster. + * @example 6869d7c1732b + */ + Name?: string; + /** + * IP-address of the peer-node in the Swarm cluster. + * @example 10.133.77.91 + */ + IP?: string; +}; +export type BuildInfo = { + id?: string; + stream?: string; + error?: string; + errorDetail?: { + code?: number; + message?: string; + }; + status?: string; + progress?: string; + progressDetail?: { + current?: number; + total?: number; + }; + /** + * Image ID or Digest + * @example [object Object] + */ + aux?: { + ID?: string; + }; +}; +/** BuildCache contains information about a build cache record. */ +export type BuildCache = { + /** + * Unique ID of the build cache record. + * @example ndlpt0hhvkqcdfkputsk4cq9c + */ + ID?: string; + /** + * ID of the parent build cache record. + * + * > **Deprecated**: This field is deprecated, and omitted if empty. + * @example + */ + Parent?: string; + /** + * List of parent build cache record IDs. + * @example hw53o5aio51xtltp5xjp8v7fx + */ + Parents?: readonly string[]; + /** + * Cache record type. + * @enum internal,frontend,source.local,source.git.checkout,exec.cachemount,regular + * @example regular + */ + Type?: + | "internal" + | "frontend" + | "source.local" + | "source.git.checkout" + | "exec.cachemount" + | "regular"; + /** + * Description of the build-step that produced the build cache. + * @example mount / from exec /bin/sh -c echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache + */ + Description?: string; + /** + * Indicates if the build cache is in use. + * @example false + */ + InUse?: boolean; + /** + * Indicates if the build cache is shared. + * @example true + */ + Shared?: boolean; + /** + * Amount of disk space used by the build cache (in bytes). + * @example 51 + */ + Size?: number; + /** + * Date and time at which the build cache was created in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2016-08-18T10:44:24.496525531Z + */ + CreatedAt?: string; + /** + * Date and time at which the build cache was last used in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2017-08-09T07:09:37.632105588Z + */ + LastUsedAt?: string; + UsageCount?: number; +}; +/** Image ID or Digest */ +export type ImageId = { + ID?: string; +}; +export type CreateImageInfo = { + id?: string; + error?: string; + errorDetail?: { + code?: number; + message?: string; + }; + status?: string; + progress?: string; + progressDetail?: { + current?: number; + total?: number; + }; +}; +export type PushImageInfo = { + error?: string; + status?: string; + progress?: string; + progressDetail?: { + current?: number; + total?: number; + }; +}; +export type ErrorDetail = { + code?: number; + message?: string; +}; +export type ProgressDetail = { + current?: number; + total?: number; +}; +/** Represents an error. */ +export type ErrorResponse = { + message: string; +}; +/** Response to an API call that returns just an Id */ +export type IdResponse = { + Id: string; +}; +/** Configuration for a network endpoint. */ +export type EndpointSettings = { + IPAMConfig?: { + IPv4Address?: string; + IPv6Address?: string; + LinkLocalIPs?: readonly string[]; + }; + Links?: readonly string[]; + Aliases?: readonly string[]; + /** + * Unique ID of the network. + * @example 08754567f1f40222263eab4102e1c733ae697e8e354aa9cd6e18d7402835292a + */ + NetworkID?: string; + /** + * Unique ID for the service endpoint in a Sandbox. + * @example b88f5b905aabf2893f3cbc4ee42d1ea7980bbc0a92e2c8922b1e1795298afb0b + */ + EndpointID?: string; + /** + * Gateway address for this network. + * @example 172.17.0.1 + */ + Gateway?: string; + /** + * IPv4 address. + * @example 172.17.0.4 + */ + IPAddress?: string; + /** + * Mask length of the IPv4 address. + * @example 16 + */ + IPPrefixLen?: number; + /** + * IPv6 gateway address. + * @example 2001:db8:2::100 + */ + IPv6Gateway?: string; + /** + * Global IPv6 address. + * @example 2001:db8::5689 + */ + GlobalIPv6Address?: string; + /** + * Mask length of the global IPv6 address. + * @example 64 + */ + GlobalIPv6PrefixLen?: number; + /** + * MAC address for the endpoint on this network. + * @example 02:42:ac:11:00:04 + */ + MacAddress?: string; + DriverOpts?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; +}; +/** EndpointIPAMConfig represents an endpoint's IPAM configuration. */ +export type EndpointIpamConfig = { + IPv4Address?: string; + IPv6Address?: string; + LinkLocalIPs?: readonly string[]; +}; +export type PluginMount = { + Name: string; + Description: string; + Settable: readonly string[]; + Source: string; + Destination: string; + Type: string; + Options: readonly string[]; +}; +export type PluginDevice = { + Name: string; + Description: string; + Settable: readonly string[]; + Path: string; +}; +export type PluginEnv = { + Name: string; + Description: string; + Settable: readonly string[]; + Value: string; +}; +export type PluginInterfaceType = { + Prefix: string; + Capability: string; + Version: string; +}; +/** + * Describes a permission the user has to accept upon installing + * the plugin. + */ +export type PluginPrivilege = { + Name?: string; + Description?: string; + Value?: readonly string[]; +}; +/** A plugin for the Engine API */ +export type Plugin = { + Id?: string; + Name: string; + /** + * True if the plugin is running. False if the plugin is not running, only + * installed. + * @example true + */ + Enabled: boolean; + Settings: { + Mounts: readonly { + Name: string; + Description: string; + Settable: readonly string[]; + Source: string; + Destination: string; + Type: string; + Options: readonly string[]; + }[]; + Env: readonly string[]; + Args: readonly string[]; + Devices: readonly { + Name: string; + Description: string; + Settable: readonly string[]; + Path: string; + }[]; + }; + /** + * plugin remote reference used to push/pull the plugin + * @example localhost:5000/tiborvass/sample-volume-plugin:latest + */ + PluginReference?: string; + Config: { + /** + * Docker Version used to create the plugin + * @example 17.06.0-ce + */ + DockerVersion?: string; + Description: string; + Documentation: string; + Interface: { + Types: readonly { + Prefix: string; + Capability: string; + Version: string; + }[]; + Socket: string; + /** + * Protocol to use for clients connecting to the plugin. + * @enum ,moby.plugins.http/v1 + * @example some.protocol/v1.0 + */ + ProtocolScheme?: "" | "moby.plugins.http/v1"; + }; + Entrypoint: readonly string[]; + WorkDir: string; + User?: { + UID?: number; + GID?: number; + }; + Network: { + Type: string; + }; + Linux: { + Capabilities: readonly string[]; + AllowAllDevices: boolean; + Devices: readonly { + Name: string; + Description: string; + Settable: readonly string[]; + Path: string; + }[]; + }; + PropagatedMount: string; + IpcHost: boolean; + PidHost: boolean; + Mounts: readonly { + Name: string; + Description: string; + Settable: readonly string[]; + Source: string; + Destination: string; + Type: string; + Options: readonly string[]; + }[]; + Env: readonly { + Name: string; + Description: string; + Settable: readonly string[]; + Value: string; + }[]; + Args: { + Name: string; + Description: string; + Settable: readonly string[]; + Value: readonly string[]; + }; + rootfs?: { + type?: string; + diff_ids?: readonly string[]; + }; + }; +}; +/** + * The version number of the object such as node, service, etc. This is needed + * to avoid conflicting writes. The client must send the version number along + * with the modified specification when updating these objects. + * + * This approach ensures safe concurrency and determinism in that the change + * on the object may not be applied if the version number has changed from the + * last read. In other words, if two update requests specify the same base + * version, only one of the requests can succeed. As a result, two separate + * update requests that happen at the same time will not unintentionally + * overwrite each other. + */ +export type ObjectVersion = { + Index?: number; +}; +export type NodeSpec = { + /** + * Name for the node. + * @example my-node + */ + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * Role of the node. + * @enum worker,manager + * @example manager + */ + Role?: "worker" | "manager"; + /** + * Availability of the node. + * @enum active,pause,drain + * @example active + */ + Availability?: "active" | "pause" | "drain"; +}; +export type Node = { + ID?: string; + Version?: { + Index?: number; + }; + /** + * Date and time at which the node was added to the swarm in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2016-08-18T10:44:24.496525531Z + */ + CreatedAt?: string; + /** + * Date and time at which the node was last updated in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2017-08-09T07:09:37.632105588Z + */ + UpdatedAt?: string; + Spec?: { + /** + * Name for the node. + * @example my-node + */ + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * Role of the node. + * @enum worker,manager + * @example manager + */ + Role?: "worker" | "manager"; + /** + * Availability of the node. + * @enum active,pause,drain + * @example active + */ + Availability?: "active" | "pause" | "drain"; + }; + Description?: { + Hostname?: string; + Platform?: { + /** + * Architecture represents the hardware architecture (for example, + * `x86_64`). + * @example x86_64 + */ + Architecture?: string; + /** + * OS represents the Operating System (for example, `linux` or `windows`). + * @example linux + */ + OS?: string; + }; + Resources?: { + NanoCPUs?: number; + MemoryBytes?: number; + /** + * User-defined resources can be either Integer resources (e.g, `SSD=3`) or + * String resources (e.g, `GPU=UUID1`). + * @example [object Object],[object Object],[object Object] + */ + GenericResources?: readonly { + NamedResourceSpec?: { + Kind?: string; + Value?: string; + }; + DiscreteResourceSpec?: { + Kind?: string; + Value?: number; + }; + }[]; + }; + Engine?: { + EngineVersion?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Plugins?: readonly { + Type?: string; + Name?: string; + }[]; + }; + /** + * Information about the issuer of leaf TLS certificates and the trusted root + * CA certificate. + * @example [object Object] + */ + TLSInfo?: { + TrustRoot?: string; + CertIssuerSubject?: string; + CertIssuerPublicKey?: string; + }; + }; + Status?: { + /** + * NodeState represents the state of a node. + * @enum unknown,down,ready,disconnected + * @example ready + */ + State?: "unknown" | "down" | "ready" | "disconnected"; + Message?: string; + /** + * IP address of the node. + * @example 172.17.0.2 + */ + Addr?: string; + }; + ManagerStatus?: { + Leader?: boolean; + /** + * Reachability represents the reachability of a node. + * @enum unknown,unreachable,reachable + * @example reachable + */ + Reachability?: "unknown" | "unreachable" | "reachable"; + /** + * The IP address and port at which the manager is reachable. + * @example 10.0.0.46:2377 + */ + Addr?: string; + }; +}; +/** + * NodeDescription encapsulates the properties of the Node as reported by the + * agent. + */ +export type NodeDescription = { + Hostname?: string; + Platform?: { + /** + * Architecture represents the hardware architecture (for example, + * `x86_64`). + * @example x86_64 + */ + Architecture?: string; + /** + * OS represents the Operating System (for example, `linux` or `windows`). + * @example linux + */ + OS?: string; + }; + Resources?: { + NanoCPUs?: number; + MemoryBytes?: number; + /** + * User-defined resources can be either Integer resources (e.g, `SSD=3`) or + * String resources (e.g, `GPU=UUID1`). + * @example [object Object],[object Object],[object Object] + */ + GenericResources?: readonly { + NamedResourceSpec?: { + Kind?: string; + Value?: string; + }; + DiscreteResourceSpec?: { + Kind?: string; + Value?: number; + }; + }[]; + }; + Engine?: { + EngineVersion?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Plugins?: readonly { + Type?: string; + Name?: string; + }[]; + }; + /** + * Information about the issuer of leaf TLS certificates and the trusted root + * CA certificate. + * @example [object Object] + */ + TLSInfo?: { + TrustRoot?: string; + CertIssuerSubject?: string; + CertIssuerPublicKey?: string; + }; +}; +/** Platform represents the platform (Arch/OS). */ +export type Platform = { + /** + * Architecture represents the hardware architecture (for example, + * `x86_64`). + * @example x86_64 + */ + Architecture?: string; + /** + * OS represents the Operating System (for example, `linux` or `windows`). + * @example linux + */ + OS?: string; +}; +/** EngineDescription provides information about an engine. */ +export type EngineDescription = { + EngineVersion?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Plugins?: readonly { + Type?: string; + Name?: string; + }[]; +}; +/** + * Information about the issuer of leaf TLS certificates and the trusted root + * CA certificate. + */ +export type TlsInfo = { + TrustRoot?: string; + CertIssuerSubject?: string; + CertIssuerPublicKey?: string; +}; +/** + * NodeStatus represents the status of a node. + * + * It provides the current status of the node, as seen by the manager. + */ +export type NodeStatus = { + /** + * NodeState represents the state of a node. + * @enum unknown,down,ready,disconnected + * @example ready + */ + State?: "unknown" | "down" | "ready" | "disconnected"; + Message?: string; + /** + * IP address of the node. + * @example 172.17.0.2 + */ + Addr?: string; +}; +/** NodeState represents the state of a node. */ +export type NodeState = "unknown" | "down" | "ready" | "disconnected"; +/** + * ManagerStatus represents the status of a manager. + * + * It provides the current status of a node's manager component, if the node + * is a manager. + */ +export type ManagerStatus = { + Leader?: boolean; + /** + * Reachability represents the reachability of a node. + * @enum unknown,unreachable,reachable + * @example reachable + */ + Reachability?: "unknown" | "unreachable" | "reachable"; + /** + * The IP address and port at which the manager is reachable. + * @example 10.0.0.46:2377 + */ + Addr?: string; +}; +/** Reachability represents the reachability of a node. */ +export type Reachability = "unknown" | "unreachable" | "reachable"; +/** User modifiable swarm configuration. */ +export type SwarmSpec = { + /** + * Name of the swarm. + * @example default + */ + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Orchestration?: { + /** + * The number of historic tasks to keep per instance or node. If + * negative, never remove completed or failed tasks. + * @example 10 + */ + TaskHistoryRetentionLimit?: number; + }; + Raft?: { + /** + * The number of log entries between snapshots. + * @example 10000 + */ + SnapshotInterval?: number; + KeepOldSnapshots?: number; + /** + * The number of log entries to keep around to sync up slow followers + * after a snapshot is created. + * @example 500 + */ + LogEntriesForSlowFollowers?: number; + /** + * The number of ticks that a follower will wait for a message from + * the leader before becoming a candidate and starting an election. + * `ElectionTick` must be greater than `HeartbeatTick`. + * + * A tick currently defaults to one second, so these translate + * directly to seconds currently, but this is NOT guaranteed. + * @example 3 + */ + ElectionTick?: number; + /** + * The number of ticks between heartbeats. Every HeartbeatTick ticks, + * the leader will send a heartbeat to the followers. + * + * A tick currently defaults to one second, so these translate + * directly to seconds currently, but this is NOT guaranteed. + * @example 1 + */ + HeartbeatTick?: number; + }; + Dispatcher?: { + /** + * The delay for an agent to send a heartbeat to the dispatcher. + * @example 5000000000 + */ + HeartbeatPeriod?: number; + }; + CAConfig?: { + /** + * The duration node certificates are issued for. + * @example 7776000000000000 + */ + NodeCertExpiry?: number; + ExternalCAs?: readonly { + /** + * Protocol for communication with the external CA (currently + * only `cfssl` is supported). + * @default cfssl + * @enum cfssl + */ + Protocol?: "cfssl"; + URL?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + CACert?: string; + }[]; + SigningCACert?: string; + SigningCAKey?: string; + ForceRotate?: number; + }; + EncryptionConfig?: { + /** + * If set, generate a key and use it to lock data stored on the + * managers. + * @example false + */ + AutoLockManagers?: boolean; + }; + TaskDefaults?: { + LogDriver?: { + /** + * The log driver to use as a default for new tasks. + * @example json-file + */ + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; +}; +/** + * ClusterInfo represents information about the swarm as is returned by the + * "/info" endpoint. Join-tokens are not included. + */ +export type ClusterInfo = { + /** + * The ID of the swarm. + * @example abajmipo7b4xz5ip2nrla6b11 + */ + ID?: string; + Version?: { + Index?: number; + }; + /** + * Date and time at which the swarm was initialised in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2016-08-18T10:44:24.496525531Z + */ + CreatedAt?: string; + /** + * Date and time at which the swarm was last updated in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2017-08-09T07:09:37.632105588Z + */ + UpdatedAt?: string; + Spec?: { + /** + * Name of the swarm. + * @example default + */ + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Orchestration?: { + /** + * The number of historic tasks to keep per instance or node. If + * negative, never remove completed or failed tasks. + * @example 10 + */ + TaskHistoryRetentionLimit?: number; + }; + Raft?: { + /** + * The number of log entries between snapshots. + * @example 10000 + */ + SnapshotInterval?: number; + KeepOldSnapshots?: number; + /** + * The number of log entries to keep around to sync up slow followers + * after a snapshot is created. + * @example 500 + */ + LogEntriesForSlowFollowers?: number; + /** + * The number of ticks that a follower will wait for a message from + * the leader before becoming a candidate and starting an election. + * `ElectionTick` must be greater than `HeartbeatTick`. + * + * A tick currently defaults to one second, so these translate + * directly to seconds currently, but this is NOT guaranteed. + * @example 3 + */ + ElectionTick?: number; + /** + * The number of ticks between heartbeats. Every HeartbeatTick ticks, + * the leader will send a heartbeat to the followers. + * + * A tick currently defaults to one second, so these translate + * directly to seconds currently, but this is NOT guaranteed. + * @example 1 + */ + HeartbeatTick?: number; + }; + Dispatcher?: { + /** + * The delay for an agent to send a heartbeat to the dispatcher. + * @example 5000000000 + */ + HeartbeatPeriod?: number; + }; + CAConfig?: { + /** + * The duration node certificates are issued for. + * @example 7776000000000000 + */ + NodeCertExpiry?: number; + ExternalCAs?: readonly { + /** + * Protocol for communication with the external CA (currently + * only `cfssl` is supported). + * @default cfssl + * @enum cfssl + */ + Protocol?: "cfssl"; + URL?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + CACert?: string; + }[]; + SigningCACert?: string; + SigningCAKey?: string; + ForceRotate?: number; + }; + EncryptionConfig?: { + /** + * If set, generate a key and use it to lock data stored on the + * managers. + * @example false + */ + AutoLockManagers?: boolean; + }; + TaskDefaults?: { + LogDriver?: { + /** + * The log driver to use as a default for new tasks. + * @example json-file + */ + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; + }; + /** + * Information about the issuer of leaf TLS certificates and the trusted root + * CA certificate. + * @example [object Object] + */ + TLSInfo?: { + TrustRoot?: string; + CertIssuerSubject?: string; + CertIssuerPublicKey?: string; + }; + /** + * Whether there is currently a root CA rotation in progress for the swarm + * @example false + */ + RootRotationInProgress?: boolean; + /** + * DataPathPort specifies the data path port number for data traffic. + * Acceptable port range is 1024 to 49151. + * If no port is set or is set to 0, the default port (4789) is used. + * @example 4789 + */ + DataPathPort?: number; + DefaultAddrPool?: readonly string[]; + /** + * SubnetSize specifies the subnet size of the networks created from the + * default subnet pool. + * @example 24 + */ + SubnetSize?: number; +}; +/** JoinTokens contains the tokens workers and managers need to join the swarm. */ +export type JoinTokens = { + /** + * The token workers can use to join the swarm. + * @example SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-1awxwuwd3z9j1z3puu7rcgdbx + */ + Worker?: string; + /** + * The token managers can use to join the swarm. + * @example SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-7p73s1dx5in4tatdymyhg9hu2 + */ + Manager?: string; +}; +export type Swarm = { + /** + * The ID of the swarm. + * @example abajmipo7b4xz5ip2nrla6b11 + */ + ID?: string; + Version?: { + Index?: number; + }; + /** + * Date and time at which the swarm was initialised in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2016-08-18T10:44:24.496525531Z + */ + CreatedAt?: string; + /** + * Date and time at which the swarm was last updated in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2017-08-09T07:09:37.632105588Z + */ + UpdatedAt?: string; + Spec?: { + /** + * Name of the swarm. + * @example default + */ + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Orchestration?: { + /** + * The number of historic tasks to keep per instance or node. If + * negative, never remove completed or failed tasks. + * @example 10 + */ + TaskHistoryRetentionLimit?: number; + }; + Raft?: { + /** + * The number of log entries between snapshots. + * @example 10000 + */ + SnapshotInterval?: number; + KeepOldSnapshots?: number; + /** + * The number of log entries to keep around to sync up slow followers + * after a snapshot is created. + * @example 500 + */ + LogEntriesForSlowFollowers?: number; + /** + * The number of ticks that a follower will wait for a message from + * the leader before becoming a candidate and starting an election. + * `ElectionTick` must be greater than `HeartbeatTick`. + * + * A tick currently defaults to one second, so these translate + * directly to seconds currently, but this is NOT guaranteed. + * @example 3 + */ + ElectionTick?: number; + /** + * The number of ticks between heartbeats. Every HeartbeatTick ticks, + * the leader will send a heartbeat to the followers. + * + * A tick currently defaults to one second, so these translate + * directly to seconds currently, but this is NOT guaranteed. + * @example 1 + */ + HeartbeatTick?: number; + }; + Dispatcher?: { + /** + * The delay for an agent to send a heartbeat to the dispatcher. + * @example 5000000000 + */ + HeartbeatPeriod?: number; + }; + CAConfig?: { + /** + * The duration node certificates are issued for. + * @example 7776000000000000 + */ + NodeCertExpiry?: number; + ExternalCAs?: readonly { + /** + * Protocol for communication with the external CA (currently + * only `cfssl` is supported). + * @default cfssl + * @enum cfssl + */ + Protocol?: "cfssl"; + URL?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + CACert?: string; + }[]; + SigningCACert?: string; + SigningCAKey?: string; + ForceRotate?: number; + }; + EncryptionConfig?: { + /** + * If set, generate a key and use it to lock data stored on the + * managers. + * @example false + */ + AutoLockManagers?: boolean; + }; + TaskDefaults?: { + LogDriver?: { + /** + * The log driver to use as a default for new tasks. + * @example json-file + */ + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; + }; + /** + * Information about the issuer of leaf TLS certificates and the trusted root + * CA certificate. + * @example [object Object] + */ + TLSInfo?: { + TrustRoot?: string; + CertIssuerSubject?: string; + CertIssuerPublicKey?: string; + }; + /** + * Whether there is currently a root CA rotation in progress for the swarm + * @example false + */ + RootRotationInProgress?: boolean; + /** + * DataPathPort specifies the data path port number for data traffic. + * Acceptable port range is 1024 to 49151. + * If no port is set or is set to 0, the default port (4789) is used. + * @example 4789 + */ + DataPathPort?: number; + DefaultAddrPool?: readonly string[]; + /** + * SubnetSize specifies the subnet size of the networks created from the + * default subnet pool. + * @example 24 + */ + SubnetSize?: number; +} & { + JoinTokens?: { + /** + * The token workers can use to join the swarm. + * @example SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-1awxwuwd3z9j1z3puu7rcgdbx + */ + Worker?: string; + /** + * The token managers can use to join the swarm. + * @example SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-7p73s1dx5in4tatdymyhg9hu2 + */ + Manager?: string; + }; +}; +/** User modifiable task configuration. */ +export type TaskSpec = { + PluginSpec?: { + Name?: string; + Remote?: string; + Disabled?: boolean; + PluginPrivilege?: readonly { + Name?: string; + Description?: string; + Value?: readonly string[]; + }[]; + }; + ContainerSpec?: { + Image?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Command?: readonly string[]; + Args?: readonly string[]; + Hostname?: string; + Env?: readonly string[]; + Dir?: string; + User?: string; + Groups?: readonly string[]; + Privileges?: { + CredentialSpec?: { + /** + * Load credential spec from a Swarm Config with the given ID. + * The specified config must also be present in the Configs + * field with the Runtime property set. + * + *


+ * + * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + * @example 0bt9dmxjvjiqermk6xrop3ekq + */ + Config?: string; + /** + * Load credential spec from this file. The file is read by + * the daemon, and must be present in the `CredentialSpecs` + * subdirectory in the docker data directory, which defaults + * to `C:\ProgramData\Docker\` on Windows. + * + * For example, specifying `spec.json` loads + * `C:\ProgramData\Docker\CredentialSpecs\spec.json`. + * + *


+ * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + * @example spec.json + */ + File?: string; + Registry?: string; + }; + SELinuxContext?: { + Disable?: boolean; + User?: string; + Role?: string; + Type?: string; + Level?: string; + }; + }; + TTY?: boolean; + OpenStdin?: boolean; + ReadOnly?: boolean; + Mounts?: readonly { + Target?: string; + Source?: string; + /** + * The mount type. Available types: + * + * - `bind` Mounts a file or directory from the host into the container. Must + * exist prior to creating the container. + * - `volume` Creates a volume with the given name and options (or uses a + * pre-existing volume with the same name and options). These are **not** + * removed when the container is removed. + * - `tmpfs` Create a tmpfs with the given options. The mount source cannot be + * specified for tmpfs. + * - `npipe` Mounts a named pipe from the host into the container. Must exist + * prior to creating the container. + * - `cluster` a Swarm cluster volume + * @enum bind,volume,tmpfs,npipe,cluster + */ + Type?: "bind" | "volume" | "tmpfs" | "npipe" | "cluster"; + ReadOnly?: boolean; + Consistency?: string; + BindOptions?: { + /** + * A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + * @enum private,rprivate,shared,rshared,slave,rslave + */ + Propagation?: + | "private" + | "rprivate" + | "shared" + | "rshared" + | "slave" + | "rslave"; + NonRecursive?: boolean; + CreateMountpoint?: boolean; + }; + VolumeOptions?: { + NoCopy?: boolean; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + DriverConfig?: { + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; + TmpfsOptions?: { + SizeBytes?: number; + Mode?: number; + }; + }[]; + StopSignal?: string; + StopGracePeriod?: number; + HealthCheck?: { + Test?: readonly string[]; + Interval?: number; + Timeout?: number; + Retries?: number; + StartPeriod?: number; + }; + Hosts?: readonly string[]; + DNSConfig?: { + Nameservers?: readonly string[]; + Search?: readonly string[]; + Options?: readonly string[]; + }; + Secrets?: readonly { + File?: { + Name?: string; + UID?: string; + GID?: string; + Mode?: number; + }; + SecretID?: string; + SecretName?: string; + }[]; + Configs?: readonly { + File?: { + Name?: string; + UID?: string; + GID?: string; + Mode?: number; + }; + Runtime?: {}; + ConfigID?: string; + ConfigName?: string; + }[]; + /** + * Isolation technology of the containers running the service. + * (Windows only) + * @enum default,process,hyperv, + */ + Isolation?: "default" | "process" | "hyperv" | ""; + Init?: boolean | null; + Sysctls?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * A list of kernel capabilities to add to the default set + * for the container. + * @example CAP_NET_RAW,CAP_SYS_ADMIN,CAP_SYS_CHROOT,CAP_SYSLOG + */ + CapabilityAdd?: readonly string[]; + /** + * A list of kernel capabilities to drop from the default set + * for the container. + * @example CAP_NET_RAW + */ + CapabilityDrop?: readonly string[]; + Ulimits?: readonly { + Name?: string; + Soft?: number; + Hard?: number; + }[]; + }; + NetworkAttachmentSpec?: { + ContainerID?: string; + }; + Resources?: { + Limits?: { + NanoCPUs?: number; + MemoryBytes?: number; + /** + * Limits the maximum number of PIDs in the container. Set `0` for unlimited. + * @example 100 + */ + Pids?: number; + }; + Reservations?: { + NanoCPUs?: number; + MemoryBytes?: number; + /** + * User-defined resources can be either Integer resources (e.g, `SSD=3`) or + * String resources (e.g, `GPU=UUID1`). + * @example [object Object],[object Object],[object Object] + */ + GenericResources?: readonly { + NamedResourceSpec?: { + Kind?: string; + Value?: string; + }; + DiscreteResourceSpec?: { + Kind?: string; + Value?: number; + }; + }[]; + }; + }; + RestartPolicy?: { + /** + * Condition for restart. + * @enum none,on-failure,any + */ + Condition?: "none" | "on-failure" | "any"; + Delay?: number; + MaxAttempts?: number; + Window?: number; + }; + Placement?: { + /** + * An array of constraint expressions to limit the set of nodes where + * a task can be scheduled. Constraint expressions can either use a + * _match_ (`==`) or _exclude_ (`!=`) rule. Multiple constraints find + * nodes that satisfy every expression (AND match). Constraints can + * match node or Docker Engine labels as follows: + * + * node attribute | matches | example + * ---------------------|--------------------------------|----------------------------------------------- + * `node.id` | Node ID | + * `node.id==2ivku8v2gvtg4` + * `node.hostname` | Node hostname | + * `node.hostname!=node-2` + * `node.role` | Node role (`manager`/`worker`) | + * `node.role==manager` + * `node.platform.os` | Node operating system | + * `node.platform.os==windows` + * `node.platform.arch` | Node architecture | + * `node.platform.arch==x86_64` + * `node.labels` | User-defined node labels | + * `node.labels.security==high` + * `engine.labels` | Docker Engine's labels | + * `engine.labels.operatingsystem==ubuntu-14.04` + * + * `engine.labels` apply to Docker Engine labels like operating system, + * drivers, etc. Swarm administrators add `node.labels` for operational + * purposes by using the [`node update endpoint`](#operation/NodeUpdate). + * @example node.hostname!=node3.corp.example.com,node.role!=manager,node.labels.type==production,node.platform.os==linux,node.platform.arch==x86_64 + */ + Constraints?: readonly string[]; + /** + * Preferences provide a way to make the scheduler aware of factors + * such as topology. They are provided in order from highest to + * lowest precedence. + * @example [object Object],[object Object] + */ + Preferences?: readonly { + Spread?: { + SpreadDescriptor?: string; + }; + }[]; + MaxReplicas?: number; + Platforms?: readonly { + /** + * Architecture represents the hardware architecture (for example, + * `x86_64`). + * @example x86_64 + */ + Architecture?: string; + /** + * OS represents the Operating System (for example, `linux` or `windows`). + * @example linux + */ + OS?: string; + }[]; + }; + ForceUpdate?: number; + Runtime?: string; + Networks?: readonly { + Target?: string; + Aliases?: readonly string[]; + DriverOpts?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; + LogDriver?: { + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; +}; +export type TaskState = + | "new" + | "allocated" + | "pending" + | "assigned" + | "accepted" + | "preparing" + | "ready" + | "starting" + | "running" + | "complete" + | "shutdown" + | "failed" + | "rejected" + | "remove" + | "orphaned"; +export type Task = { + ID?: string; + Version?: { + Index?: number; + }; + CreatedAt?: string; + UpdatedAt?: string; + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Spec?: { + PluginSpec?: { + Name?: string; + Remote?: string; + Disabled?: boolean; + PluginPrivilege?: readonly { + Name?: string; + Description?: string; + Value?: readonly string[]; + }[]; + }; + ContainerSpec?: { + Image?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Command?: readonly string[]; + Args?: readonly string[]; + Hostname?: string; + Env?: readonly string[]; + Dir?: string; + User?: string; + Groups?: readonly string[]; + Privileges?: { + CredentialSpec?: { + /** + * Load credential spec from a Swarm Config with the given ID. + * The specified config must also be present in the Configs + * field with the Runtime property set. + * + *


+ * + * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + * @example 0bt9dmxjvjiqermk6xrop3ekq + */ + Config?: string; + /** + * Load credential spec from this file. The file is read by + * the daemon, and must be present in the `CredentialSpecs` + * subdirectory in the docker data directory, which defaults + * to `C:\ProgramData\Docker\` on Windows. + * + * For example, specifying `spec.json` loads + * `C:\ProgramData\Docker\CredentialSpecs\spec.json`. + * + *


+ * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + * @example spec.json + */ + File?: string; + Registry?: string; + }; + SELinuxContext?: { + Disable?: boolean; + User?: string; + Role?: string; + Type?: string; + Level?: string; + }; + }; + TTY?: boolean; + OpenStdin?: boolean; + ReadOnly?: boolean; + Mounts?: readonly { + Target?: string; + Source?: string; + /** + * The mount type. Available types: + * + * - `bind` Mounts a file or directory from the host into the container. Must + * exist prior to creating the container. + * - `volume` Creates a volume with the given name and options (or uses a + * pre-existing volume with the same name and options). These are **not** + * removed when the container is removed. + * - `tmpfs` Create a tmpfs with the given options. The mount source cannot be + * specified for tmpfs. + * - `npipe` Mounts a named pipe from the host into the container. Must exist + * prior to creating the container. + * - `cluster` a Swarm cluster volume + * @enum bind,volume,tmpfs,npipe,cluster + */ + Type?: "bind" | "volume" | "tmpfs" | "npipe" | "cluster"; + ReadOnly?: boolean; + Consistency?: string; + BindOptions?: { + /** + * A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + * @enum private,rprivate,shared,rshared,slave,rslave + */ + Propagation?: + | "private" + | "rprivate" + | "shared" + | "rshared" + | "slave" + | "rslave"; + NonRecursive?: boolean; + CreateMountpoint?: boolean; + }; + VolumeOptions?: { + NoCopy?: boolean; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + DriverConfig?: { + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; + TmpfsOptions?: { + SizeBytes?: number; + Mode?: number; + }; + }[]; + StopSignal?: string; + StopGracePeriod?: number; + HealthCheck?: { + Test?: readonly string[]; + Interval?: number; + Timeout?: number; + Retries?: number; + StartPeriod?: number; + }; + Hosts?: readonly string[]; + DNSConfig?: { + Nameservers?: readonly string[]; + Search?: readonly string[]; + Options?: readonly string[]; + }; + Secrets?: readonly { + File?: { + Name?: string; + UID?: string; + GID?: string; + Mode?: number; + }; + SecretID?: string; + SecretName?: string; + }[]; + Configs?: readonly { + File?: { + Name?: string; + UID?: string; + GID?: string; + Mode?: number; + }; + Runtime?: {}; + ConfigID?: string; + ConfigName?: string; + }[]; + /** + * Isolation technology of the containers running the service. + * (Windows only) + * @enum default,process,hyperv, + */ + Isolation?: "default" | "process" | "hyperv" | ""; + Init?: boolean | null; + Sysctls?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * A list of kernel capabilities to add to the default set + * for the container. + * @example CAP_NET_RAW,CAP_SYS_ADMIN,CAP_SYS_CHROOT,CAP_SYSLOG + */ + CapabilityAdd?: readonly string[]; + /** + * A list of kernel capabilities to drop from the default set + * for the container. + * @example CAP_NET_RAW + */ + CapabilityDrop?: readonly string[]; + Ulimits?: readonly { + Name?: string; + Soft?: number; + Hard?: number; + }[]; + }; + NetworkAttachmentSpec?: { + ContainerID?: string; + }; + Resources?: { + Limits?: { + NanoCPUs?: number; + MemoryBytes?: number; + /** + * Limits the maximum number of PIDs in the container. Set `0` for unlimited. + * @example 100 + */ + Pids?: number; + }; + Reservations?: { + NanoCPUs?: number; + MemoryBytes?: number; + /** + * User-defined resources can be either Integer resources (e.g, `SSD=3`) or + * String resources (e.g, `GPU=UUID1`). + * @example [object Object],[object Object],[object Object] + */ + GenericResources?: readonly { + NamedResourceSpec?: { + Kind?: string; + Value?: string; + }; + DiscreteResourceSpec?: { + Kind?: string; + Value?: number; + }; + }[]; + }; + }; + RestartPolicy?: { + /** + * Condition for restart. + * @enum none,on-failure,any + */ + Condition?: "none" | "on-failure" | "any"; + Delay?: number; + MaxAttempts?: number; + Window?: number; + }; + Placement?: { + /** + * An array of constraint expressions to limit the set of nodes where + * a task can be scheduled. Constraint expressions can either use a + * _match_ (`==`) or _exclude_ (`!=`) rule. Multiple constraints find + * nodes that satisfy every expression (AND match). Constraints can + * match node or Docker Engine labels as follows: + * + * node attribute | matches | example + * ---------------------|--------------------------------|----------------------------------------------- + * `node.id` | Node ID | + * `node.id==2ivku8v2gvtg4` + * `node.hostname` | Node hostname | + * `node.hostname!=node-2` + * `node.role` | Node role (`manager`/`worker`) | + * `node.role==manager` + * `node.platform.os` | Node operating system | + * `node.platform.os==windows` + * `node.platform.arch` | Node architecture | + * `node.platform.arch==x86_64` + * `node.labels` | User-defined node labels | + * `node.labels.security==high` + * `engine.labels` | Docker Engine's labels | + * `engine.labels.operatingsystem==ubuntu-14.04` + * + * `engine.labels` apply to Docker Engine labels like operating system, + * drivers, etc. Swarm administrators add `node.labels` for operational + * purposes by using the [`node update endpoint`](#operation/NodeUpdate). + * @example node.hostname!=node3.corp.example.com,node.role!=manager,node.labels.type==production,node.platform.os==linux,node.platform.arch==x86_64 + */ + Constraints?: readonly string[]; + /** + * Preferences provide a way to make the scheduler aware of factors + * such as topology. They are provided in order from highest to + * lowest precedence. + * @example [object Object],[object Object] + */ + Preferences?: readonly { + Spread?: { + SpreadDescriptor?: string; + }; + }[]; + MaxReplicas?: number; + Platforms?: readonly { + /** + * Architecture represents the hardware architecture (for example, + * `x86_64`). + * @example x86_64 + */ + Architecture?: string; + /** + * OS represents the Operating System (for example, `linux` or `windows`). + * @example linux + */ + OS?: string; + }[]; + }; + ForceUpdate?: number; + Runtime?: string; + Networks?: readonly { + Target?: string; + Aliases?: readonly string[]; + DriverOpts?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; + LogDriver?: { + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; + ServiceID?: string; + Slot?: number; + NodeID?: string; + /** + * User-defined resources can be either Integer resources (e.g, `SSD=3`) or + * String resources (e.g, `GPU=UUID1`). + * @example [object Object],[object Object],[object Object] + */ + AssignedGenericResources?: readonly { + NamedResourceSpec?: { + Kind?: string; + Value?: string; + }; + DiscreteResourceSpec?: { + Kind?: string; + Value?: number; + }; + }[]; + Status?: { + Timestamp?: string; + State?: + | "new" + | "allocated" + | "pending" + | "assigned" + | "accepted" + | "preparing" + | "ready" + | "starting" + | "running" + | "complete" + | "shutdown" + | "failed" + | "rejected" + | "remove" + | "orphaned"; + Message?: string; + Err?: string; + ContainerStatus?: { + ContainerID?: string; + PID?: number; + ExitCode?: number; + }; + }; + DesiredState?: + | "new" + | "allocated" + | "pending" + | "assigned" + | "accepted" + | "preparing" + | "ready" + | "starting" + | "running" + | "complete" + | "shutdown" + | "failed" + | "rejected" + | "remove" + | "orphaned"; + JobIteration?: { + Index?: number; + }; +}; +/** User modifiable configuration for a service. */ +export type ServiceSpec = { + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + TaskTemplate?: { + PluginSpec?: { + Name?: string; + Remote?: string; + Disabled?: boolean; + PluginPrivilege?: readonly { + Name?: string; + Description?: string; + Value?: readonly string[]; + }[]; + }; + ContainerSpec?: { + Image?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Command?: readonly string[]; + Args?: readonly string[]; + Hostname?: string; + Env?: readonly string[]; + Dir?: string; + User?: string; + Groups?: readonly string[]; + Privileges?: { + CredentialSpec?: { + /** + * Load credential spec from a Swarm Config with the given ID. + * The specified config must also be present in the Configs + * field with the Runtime property set. + * + *


+ * + * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + * @example 0bt9dmxjvjiqermk6xrop3ekq + */ + Config?: string; + /** + * Load credential spec from this file. The file is read by + * the daemon, and must be present in the `CredentialSpecs` + * subdirectory in the docker data directory, which defaults + * to `C:\ProgramData\Docker\` on Windows. + * + * For example, specifying `spec.json` loads + * `C:\ProgramData\Docker\CredentialSpecs\spec.json`. + * + *


+ * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + * @example spec.json + */ + File?: string; + Registry?: string; + }; + SELinuxContext?: { + Disable?: boolean; + User?: string; + Role?: string; + Type?: string; + Level?: string; + }; + }; + TTY?: boolean; + OpenStdin?: boolean; + ReadOnly?: boolean; + Mounts?: readonly { + Target?: string; + Source?: string; + /** + * The mount type. Available types: + * + * - `bind` Mounts a file or directory from the host into the container. Must + * exist prior to creating the container. + * - `volume` Creates a volume with the given name and options (or uses a + * pre-existing volume with the same name and options). These are **not** + * removed when the container is removed. + * - `tmpfs` Create a tmpfs with the given options. The mount source cannot be + * specified for tmpfs. + * - `npipe` Mounts a named pipe from the host into the container. Must exist + * prior to creating the container. + * - `cluster` a Swarm cluster volume + * @enum bind,volume,tmpfs,npipe,cluster + */ + Type?: "bind" | "volume" | "tmpfs" | "npipe" | "cluster"; + ReadOnly?: boolean; + Consistency?: string; + BindOptions?: { + /** + * A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + * @enum private,rprivate,shared,rshared,slave,rslave + */ + Propagation?: + | "private" + | "rprivate" + | "shared" + | "rshared" + | "slave" + | "rslave"; + NonRecursive?: boolean; + CreateMountpoint?: boolean; + }; + VolumeOptions?: { + NoCopy?: boolean; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + DriverConfig?: { + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; + TmpfsOptions?: { + SizeBytes?: number; + Mode?: number; + }; + }[]; + StopSignal?: string; + StopGracePeriod?: number; + HealthCheck?: { + Test?: readonly string[]; + Interval?: number; + Timeout?: number; + Retries?: number; + StartPeriod?: number; + }; + Hosts?: readonly string[]; + DNSConfig?: { + Nameservers?: readonly string[]; + Search?: readonly string[]; + Options?: readonly string[]; + }; + Secrets?: readonly { + File?: { + Name?: string; + UID?: string; + GID?: string; + Mode?: number; + }; + SecretID?: string; + SecretName?: string; + }[]; + Configs?: readonly { + File?: { + Name?: string; + UID?: string; + GID?: string; + Mode?: number; + }; + Runtime?: {}; + ConfigID?: string; + ConfigName?: string; + }[]; + /** + * Isolation technology of the containers running the service. + * (Windows only) + * @enum default,process,hyperv, + */ + Isolation?: "default" | "process" | "hyperv" | ""; + Init?: boolean | null; + Sysctls?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * A list of kernel capabilities to add to the default set + * for the container. + * @example CAP_NET_RAW,CAP_SYS_ADMIN,CAP_SYS_CHROOT,CAP_SYSLOG + */ + CapabilityAdd?: readonly string[]; + /** + * A list of kernel capabilities to drop from the default set + * for the container. + * @example CAP_NET_RAW + */ + CapabilityDrop?: readonly string[]; + Ulimits?: readonly { + Name?: string; + Soft?: number; + Hard?: number; + }[]; + }; + NetworkAttachmentSpec?: { + ContainerID?: string; + }; + Resources?: { + Limits?: { + NanoCPUs?: number; + MemoryBytes?: number; + /** + * Limits the maximum number of PIDs in the container. Set `0` for unlimited. + * @example 100 + */ + Pids?: number; + }; + Reservations?: { + NanoCPUs?: number; + MemoryBytes?: number; + /** + * User-defined resources can be either Integer resources (e.g, `SSD=3`) or + * String resources (e.g, `GPU=UUID1`). + * @example [object Object],[object Object],[object Object] + */ + GenericResources?: readonly { + NamedResourceSpec?: { + Kind?: string; + Value?: string; + }; + DiscreteResourceSpec?: { + Kind?: string; + Value?: number; + }; + }[]; + }; + }; + RestartPolicy?: { + /** + * Condition for restart. + * @enum none,on-failure,any + */ + Condition?: "none" | "on-failure" | "any"; + Delay?: number; + MaxAttempts?: number; + Window?: number; + }; + Placement?: { + /** + * An array of constraint expressions to limit the set of nodes where + * a task can be scheduled. Constraint expressions can either use a + * _match_ (`==`) or _exclude_ (`!=`) rule. Multiple constraints find + * nodes that satisfy every expression (AND match). Constraints can + * match node or Docker Engine labels as follows: + * + * node attribute | matches | example + * ---------------------|--------------------------------|----------------------------------------------- + * `node.id` | Node ID | + * `node.id==2ivku8v2gvtg4` + * `node.hostname` | Node hostname | + * `node.hostname!=node-2` + * `node.role` | Node role (`manager`/`worker`) | + * `node.role==manager` + * `node.platform.os` | Node operating system | + * `node.platform.os==windows` + * `node.platform.arch` | Node architecture | + * `node.platform.arch==x86_64` + * `node.labels` | User-defined node labels | + * `node.labels.security==high` + * `engine.labels` | Docker Engine's labels | + * `engine.labels.operatingsystem==ubuntu-14.04` + * + * `engine.labels` apply to Docker Engine labels like operating system, + * drivers, etc. Swarm administrators add `node.labels` for operational + * purposes by using the [`node update endpoint`](#operation/NodeUpdate). + * @example node.hostname!=node3.corp.example.com,node.role!=manager,node.labels.type==production,node.platform.os==linux,node.platform.arch==x86_64 + */ + Constraints?: readonly string[]; + /** + * Preferences provide a way to make the scheduler aware of factors + * such as topology. They are provided in order from highest to + * lowest precedence. + * @example [object Object],[object Object] + */ + Preferences?: readonly { + Spread?: { + SpreadDescriptor?: string; + }; + }[]; + MaxReplicas?: number; + Platforms?: readonly { + /** + * Architecture represents the hardware architecture (for example, + * `x86_64`). + * @example x86_64 + */ + Architecture?: string; + /** + * OS represents the Operating System (for example, `linux` or `windows`). + * @example linux + */ + OS?: string; + }[]; + }; + ForceUpdate?: number; + Runtime?: string; + Networks?: readonly { + Target?: string; + Aliases?: readonly string[]; + DriverOpts?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; + LogDriver?: { + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; + Mode?: { + Replicated?: { + Replicas?: number; + }; + Global?: {}; + ReplicatedJob?: { + /** + * The maximum number of replicas to run simultaneously. + * @default 1 + */ + MaxConcurrent?: number; + TotalCompletions?: number; + }; + GlobalJob?: {}; + }; + UpdateConfig?: { + Parallelism?: number; + Delay?: number; + /** + * Action to take if an updated task fails to run, or stops running + * during the update. + * @enum continue,pause,rollback + */ + FailureAction?: "continue" | "pause" | "rollback"; + Monitor?: number; + MaxFailureRatio?: number; + /** + * The order of operations when rolling out an updated task. Either + * the old task is shut down before the new task is started, or the + * new task is started before the old task is shut down. + * @enum stop-first,start-first + */ + Order?: "stop-first" | "start-first"; + }; + RollbackConfig?: { + Parallelism?: number; + Delay?: number; + /** + * Action to take if an rolled back task fails to run, or stops + * running during the rollback. + * @enum continue,pause + */ + FailureAction?: "continue" | "pause"; + Monitor?: number; + MaxFailureRatio?: number; + /** + * The order of operations when rolling back a task. Either the old + * task is shut down before the new task is started, or the new task + * is started before the old task is shut down. + * @enum stop-first,start-first + */ + Order?: "stop-first" | "start-first"; + }; + Networks?: readonly { + Target?: string; + Aliases?: readonly string[]; + DriverOpts?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; + EndpointSpec?: { + /** + * The mode of resolution to use for internal load balancing between tasks. + * @default vip + * @enum vip,dnsrr + */ + Mode?: "vip" | "dnsrr"; + Ports?: readonly { + Name?: string; + Protocol?: "tcp" | "udp" | "sctp"; + TargetPort?: number; + PublishedPort?: number; + /** + * The mode in which port is published. + * + *


+ * + * - "ingress" makes the target port accessible on every node, + * + * regardless of whether there is a task for the service running on + * + * that node or not. + * - "host" bypasses the routing mesh and publish the port directly on + * + * the swarm node where that service is running. + * @default ingress + * @enum ingress,host + * @example ingress + */ + PublishMode?: "ingress" | "host"; + }[]; + }; +}; +export type EndpointPortConfig = { + Name?: string; + Protocol?: "tcp" | "udp" | "sctp"; + TargetPort?: number; + PublishedPort?: number; + /** + * The mode in which port is published. + * + *


+ * + * - "ingress" makes the target port accessible on every node, + * + * regardless of whether there is a task for the service running on + * + * that node or not. + * - "host" bypasses the routing mesh and publish the port directly on + * + * the swarm node where that service is running. + * @default ingress + * @enum ingress,host + * @example ingress + */ + PublishMode?: "ingress" | "host"; +}; +/** Properties that can be configured to access and load balance a service. */ +export type EndpointSpec = { + /** + * The mode of resolution to use for internal load balancing between tasks. + * @default vip + * @enum vip,dnsrr + */ + Mode?: "vip" | "dnsrr"; + Ports?: readonly { + Name?: string; + Protocol?: "tcp" | "udp" | "sctp"; + TargetPort?: number; + PublishedPort?: number; + /** + * The mode in which port is published. + * + *


+ * + * - "ingress" makes the target port accessible on every node, + * + * regardless of whether there is a task for the service running on + * + * that node or not. + * - "host" bypasses the routing mesh and publish the port directly on + * + * the swarm node where that service is running. + * @default ingress + * @enum ingress,host + * @example ingress + */ + PublishMode?: "ingress" | "host"; + }[]; +}; +export type Service = { + ID?: string; + Version?: { + Index?: number; + }; + CreatedAt?: string; + UpdatedAt?: string; + Spec?: { + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + TaskTemplate?: { + PluginSpec?: { + Name?: string; + Remote?: string; + Disabled?: boolean; + PluginPrivilege?: readonly { + Name?: string; + Description?: string; + Value?: readonly string[]; + }[]; + }; + ContainerSpec?: { + Image?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Command?: readonly string[]; + Args?: readonly string[]; + Hostname?: string; + Env?: readonly string[]; + Dir?: string; + User?: string; + Groups?: readonly string[]; + Privileges?: { + CredentialSpec?: { + /** + * Load credential spec from a Swarm Config with the given ID. + * The specified config must also be present in the Configs + * field with the Runtime property set. + * + *


+ * + * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + * @example 0bt9dmxjvjiqermk6xrop3ekq + */ + Config?: string; + /** + * Load credential spec from this file. The file is read by + * the daemon, and must be present in the `CredentialSpecs` + * subdirectory in the docker data directory, which defaults + * to `C:\ProgramData\Docker\` on Windows. + * + * For example, specifying `spec.json` loads + * `C:\ProgramData\Docker\CredentialSpecs\spec.json`. + * + *


+ * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + * @example spec.json + */ + File?: string; + Registry?: string; + }; + SELinuxContext?: { + Disable?: boolean; + User?: string; + Role?: string; + Type?: string; + Level?: string; + }; + }; + TTY?: boolean; + OpenStdin?: boolean; + ReadOnly?: boolean; + Mounts?: readonly { + Target?: string; + Source?: string; + /** + * The mount type. Available types: + * + * - `bind` Mounts a file or directory from the host into the container. Must + * exist prior to creating the container. + * - `volume` Creates a volume with the given name and options (or uses a + * pre-existing volume with the same name and options). These are **not** + * removed when the container is removed. + * - `tmpfs` Create a tmpfs with the given options. The mount source cannot be + * specified for tmpfs. + * - `npipe` Mounts a named pipe from the host into the container. Must exist + * prior to creating the container. + * - `cluster` a Swarm cluster volume + * @enum bind,volume,tmpfs,npipe,cluster + */ + Type?: "bind" | "volume" | "tmpfs" | "npipe" | "cluster"; + ReadOnly?: boolean; + Consistency?: string; + BindOptions?: { + /** + * A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + * @enum private,rprivate,shared,rshared,slave,rslave + */ + Propagation?: + | "private" + | "rprivate" + | "shared" + | "rshared" + | "slave" + | "rslave"; + NonRecursive?: boolean; + CreateMountpoint?: boolean; + }; + VolumeOptions?: { + NoCopy?: boolean; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + DriverConfig?: { + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; + TmpfsOptions?: { + SizeBytes?: number; + Mode?: number; + }; + }[]; + StopSignal?: string; + StopGracePeriod?: number; + HealthCheck?: { + Test?: readonly string[]; + Interval?: number; + Timeout?: number; + Retries?: number; + StartPeriod?: number; + }; + Hosts?: readonly string[]; + DNSConfig?: { + Nameservers?: readonly string[]; + Search?: readonly string[]; + Options?: readonly string[]; + }; + Secrets?: readonly { + File?: { + Name?: string; + UID?: string; + GID?: string; + Mode?: number; + }; + SecretID?: string; + SecretName?: string; + }[]; + Configs?: readonly { + File?: { + Name?: string; + UID?: string; + GID?: string; + Mode?: number; + }; + Runtime?: {}; + ConfigID?: string; + ConfigName?: string; + }[]; + /** + * Isolation technology of the containers running the service. + * (Windows only) + * @enum default,process,hyperv, + */ + Isolation?: "default" | "process" | "hyperv" | ""; + Init?: boolean | null; + Sysctls?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * A list of kernel capabilities to add to the default set + * for the container. + * @example CAP_NET_RAW,CAP_SYS_ADMIN,CAP_SYS_CHROOT,CAP_SYSLOG + */ + CapabilityAdd?: readonly string[]; + /** + * A list of kernel capabilities to drop from the default set + * for the container. + * @example CAP_NET_RAW + */ + CapabilityDrop?: readonly string[]; + Ulimits?: readonly { + Name?: string; + Soft?: number; + Hard?: number; + }[]; + }; + NetworkAttachmentSpec?: { + ContainerID?: string; + }; + Resources?: { + Limits?: { + NanoCPUs?: number; + MemoryBytes?: number; + /** + * Limits the maximum number of PIDs in the container. Set `0` for unlimited. + * @example 100 + */ + Pids?: number; + }; + Reservations?: { + NanoCPUs?: number; + MemoryBytes?: number; + /** + * User-defined resources can be either Integer resources (e.g, `SSD=3`) or + * String resources (e.g, `GPU=UUID1`). + * @example [object Object],[object Object],[object Object] + */ + GenericResources?: readonly { + NamedResourceSpec?: { + Kind?: string; + Value?: string; + }; + DiscreteResourceSpec?: { + Kind?: string; + Value?: number; + }; + }[]; + }; + }; + RestartPolicy?: { + /** + * Condition for restart. + * @enum none,on-failure,any + */ + Condition?: "none" | "on-failure" | "any"; + Delay?: number; + MaxAttempts?: number; + Window?: number; + }; + Placement?: { + /** + * An array of constraint expressions to limit the set of nodes where + * a task can be scheduled. Constraint expressions can either use a + * _match_ (`==`) or _exclude_ (`!=`) rule. Multiple constraints find + * nodes that satisfy every expression (AND match). Constraints can + * match node or Docker Engine labels as follows: + * + * node attribute | matches | example + * ---------------------|--------------------------------|----------------------------------------------- + * `node.id` | Node ID | + * `node.id==2ivku8v2gvtg4` + * `node.hostname` | Node hostname | + * `node.hostname!=node-2` + * `node.role` | Node role (`manager`/`worker`) | + * `node.role==manager` + * `node.platform.os` | Node operating system | + * `node.platform.os==windows` + * `node.platform.arch` | Node architecture | + * `node.platform.arch==x86_64` + * `node.labels` | User-defined node labels | + * `node.labels.security==high` + * `engine.labels` | Docker Engine's labels | + * `engine.labels.operatingsystem==ubuntu-14.04` + * + * `engine.labels` apply to Docker Engine labels like operating system, + * drivers, etc. Swarm administrators add `node.labels` for operational + * purposes by using the [`node update endpoint`](#operation/NodeUpdate). + * @example node.hostname!=node3.corp.example.com,node.role!=manager,node.labels.type==production,node.platform.os==linux,node.platform.arch==x86_64 + */ + Constraints?: readonly string[]; + /** + * Preferences provide a way to make the scheduler aware of factors + * such as topology. They are provided in order from highest to + * lowest precedence. + * @example [object Object],[object Object] + */ + Preferences?: readonly { + Spread?: { + SpreadDescriptor?: string; + }; + }[]; + MaxReplicas?: number; + Platforms?: readonly { + /** + * Architecture represents the hardware architecture (for example, + * `x86_64`). + * @example x86_64 + */ + Architecture?: string; + /** + * OS represents the Operating System (for example, `linux` or `windows`). + * @example linux + */ + OS?: string; + }[]; + }; + ForceUpdate?: number; + Runtime?: string; + Networks?: readonly { + Target?: string; + Aliases?: readonly string[]; + DriverOpts?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; + LogDriver?: { + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; + Mode?: { + Replicated?: { + Replicas?: number; + }; + Global?: {}; + ReplicatedJob?: { + /** + * The maximum number of replicas to run simultaneously. + * @default 1 + */ + MaxConcurrent?: number; + TotalCompletions?: number; + }; + GlobalJob?: {}; + }; + UpdateConfig?: { + Parallelism?: number; + Delay?: number; + /** + * Action to take if an updated task fails to run, or stops running + * during the update. + * @enum continue,pause,rollback + */ + FailureAction?: "continue" | "pause" | "rollback"; + Monitor?: number; + MaxFailureRatio?: number; + /** + * The order of operations when rolling out an updated task. Either + * the old task is shut down before the new task is started, or the + * new task is started before the old task is shut down. + * @enum stop-first,start-first + */ + Order?: "stop-first" | "start-first"; + }; + RollbackConfig?: { + Parallelism?: number; + Delay?: number; + /** + * Action to take if an rolled back task fails to run, or stops + * running during the rollback. + * @enum continue,pause + */ + FailureAction?: "continue" | "pause"; + Monitor?: number; + MaxFailureRatio?: number; + /** + * The order of operations when rolling back a task. Either the old + * task is shut down before the new task is started, or the new task + * is started before the old task is shut down. + * @enum stop-first,start-first + */ + Order?: "stop-first" | "start-first"; + }; + Networks?: readonly { + Target?: string; + Aliases?: readonly string[]; + DriverOpts?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; + EndpointSpec?: { + /** + * The mode of resolution to use for internal load balancing between tasks. + * @default vip + * @enum vip,dnsrr + */ + Mode?: "vip" | "dnsrr"; + Ports?: readonly { + Name?: string; + Protocol?: "tcp" | "udp" | "sctp"; + TargetPort?: number; + PublishedPort?: number; + /** + * The mode in which port is published. + * + *


+ * + * - "ingress" makes the target port accessible on every node, + * + * regardless of whether there is a task for the service running on + * + * that node or not. + * - "host" bypasses the routing mesh and publish the port directly on + * + * the swarm node where that service is running. + * @default ingress + * @enum ingress,host + * @example ingress + */ + PublishMode?: "ingress" | "host"; + }[]; + }; + }; + Endpoint?: { + Spec?: { + /** + * The mode of resolution to use for internal load balancing between tasks. + * @default vip + * @enum vip,dnsrr + */ + Mode?: "vip" | "dnsrr"; + Ports?: readonly { + Name?: string; + Protocol?: "tcp" | "udp" | "sctp"; + TargetPort?: number; + PublishedPort?: number; + /** + * The mode in which port is published. + * + *


+ * + * - "ingress" makes the target port accessible on every node, + * + * regardless of whether there is a task for the service running on + * + * that node or not. + * - "host" bypasses the routing mesh and publish the port directly on + * + * the swarm node where that service is running. + * @default ingress + * @enum ingress,host + * @example ingress + */ + PublishMode?: "ingress" | "host"; + }[]; + }; + Ports?: readonly { + Name?: string; + Protocol?: "tcp" | "udp" | "sctp"; + TargetPort?: number; + PublishedPort?: number; + /** + * The mode in which port is published. + * + *


+ * + * - "ingress" makes the target port accessible on every node, + * + * regardless of whether there is a task for the service running on + * + * that node or not. + * - "host" bypasses the routing mesh and publish the port directly on + * + * the swarm node where that service is running. + * @default ingress + * @enum ingress,host + * @example ingress + */ + PublishMode?: "ingress" | "host"; + }[]; + VirtualIPs?: readonly { + NetworkID?: string; + Addr?: string; + }[]; + }; + UpdateStatus?: { + State?: "updating" | "paused" | "completed"; + StartedAt?: string; + CompletedAt?: string; + Message?: string; + }; + ServiceStatus?: { + /** + * The number of tasks for the service currently in the Running state. + * @example 7 + */ + RunningTasks?: number; + /** + * The number of tasks for the service desired to be running. + * For replicated services, this is the replica count from the + * service spec. For global services, this is computed by taking + * count of all tasks for the service with a Desired State other + * than Shutdown. + * @example 10 + */ + DesiredTasks?: number; + CompletedTasks?: number; + }; + JobStatus?: { + JobIteration?: { + Index?: number; + }; + LastExecution?: string; + }; +}; +export type ImageDeleteResponseItem = { + Untagged?: string; + Deleted?: string; +}; +export type ServiceUpdateResponse = { + Warnings?: readonly string[]; +}; +export type ContainerSummary = { + Id?: string; + Names?: readonly string[]; + Image?: string; + ImageID?: string; + Command?: string; + Created?: number; + Ports?: readonly { + IP?: string; + PrivatePort: number; + PublicPort?: number; + Type: "tcp" | "udp" | "sctp"; + }[]; + SizeRw?: number; + SizeRootFs?: number; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + State?: string; + Status?: string; + HostConfig?: { + NetworkMode?: string; + }; + NetworkSettings?: { + Networks?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + Mounts?: readonly { + /** + * The mount type: + * + * - `bind` a mount of a file or directory from the host into the container. + * - `volume` a docker volume with the given `Name`. + * - `tmpfs` a `tmpfs`. + * - `npipe` a named pipe from the host into the container. + * - `cluster` a Swarm cluster volume + * @enum bind,volume,tmpfs,npipe,cluster + * @example volume + */ + Type?: "bind" | "volume" | "tmpfs" | "npipe" | "cluster"; + /** + * Name is the name reference to the underlying data defined by `Source` + * e.g., the volume name. + * @example myvolume + */ + Name?: string; + /** + * Source location of the mount. + * + * For volumes, this contains the storage location of the volume (within + * `/var/lib/docker/volumes/`). For bind-mounts, and `npipe`, this contains + * the source (host) part of the bind-mount. For `tmpfs` mount points, this + * field is empty. + * @example /var/lib/docker/volumes/myvolume/_data + */ + Source?: string; + /** + * Destination is the path relative to the container root (`/`) where + * the `Source` is mounted inside the container. + * @example /usr/share/nginx/html/ + */ + Destination?: string; + /** + * Driver is the volume driver used to create the volume (if it is a volume). + * @example local + */ + Driver?: string; + /** + * Mode is a comma separated list of options supplied by the user when + * creating the bind/volume mount. + * + * The default is platform-specific (`"z"` on Linux, empty on Windows). + * @example z + */ + Mode?: string; + /** + * Whether the mount is mounted writable (read-write). + * @example true + */ + RW?: boolean; + /** + * Propagation describes how mounts are propagated from the host into the + * mount point, and vice-versa. Refer to the [Linux kernel + * documentation](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt) + * for details. This field is not used on Windows. + * @example + */ + Propagation?: string; + }[]; +}; +/** Driver represents a driver (network, logging, secrets). */ +export type Driver = { + /** + * Name of the driver. + * @example some-driver + */ + Name: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; +}; +export type SecretSpec = { + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * Base64-url-safe-encoded ([RFC + * 4648](https://tools.ietf.org/html/rfc4648#section-5)) + * data to store as secret. + * + * This field is only used to _create_ a secret, and is not returned by + * other endpoints. + * @example + */ + Data?: string; + Driver?: { + /** + * Name of the driver. + * @example some-driver + */ + Name: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + Templating?: { + /** + * Name of the driver. + * @example some-driver + */ + Name: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; +}; +export type Secret = { + ID?: string; + Version?: { + Index?: number; + }; + CreatedAt?: string; + UpdatedAt?: string; + Spec?: { + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * Base64-url-safe-encoded ([RFC + * 4648](https://tools.ietf.org/html/rfc4648#section-5)) + * data to store as secret. + * + * This field is only used to _create_ a secret, and is not returned by + * other endpoints. + * @example + */ + Data?: string; + Driver?: { + /** + * Name of the driver. + * @example some-driver + */ + Name: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + Templating?: { + /** + * Name of the driver. + * @example some-driver + */ + Name: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; +}; +export type ConfigSpec = { + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Data?: string; + Templating?: { + /** + * Name of the driver. + * @example some-driver + */ + Name: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; +}; +export type Config = { + ID?: string; + Version?: { + Index?: number; + }; + CreatedAt?: string; + UpdatedAt?: string; + Spec?: { + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Data?: string; + Templating?: { + /** + * Name of the driver. + * @example some-driver + */ + Name: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; +}; +/** + * ContainerState stores container's running state. It's part of + * ContainerJSONBase + * and will be returned by the "inspect" command. + */ +export type ContainerState = { + /** + * String representation of the container state. Can be one of "created", + * "running", "paused", "restarting", "removing", "exited", or "dead". + * @enum created,running,paused,restarting,removing,exited,dead + * @example running + */ + Status?: + | "created" + | "running" + | "paused" + | "restarting" + | "removing" + | "exited" + | "dead"; + /** + * Whether this container is running. + * + * Note that a running container can be _paused_. The `Running` and `Paused` + * booleans are not mutually exclusive: + * + * When pausing a container (on Linux), the freezer cgroup is used to suspend + * all processes in the container. Freezing the process requires the process + * to + * be running. As a result, paused containers are both `Running` _and_ + * `Paused`. + * + * Use the `Status` field instead to determine if a container's state is + * "running". + * @example true + */ + Running?: boolean; + /** + * Whether this container is paused. + * @example false + */ + Paused?: boolean; + /** + * Whether this container is restarting. + * @example false + */ + Restarting?: boolean; + /** + * Whether a process within this container has been killed because it ran + * out of memory since the container was last started. + * @example false + */ + OOMKilled?: boolean; + Dead?: boolean; + /** + * The process ID of this container + * @example 1234 + */ + Pid?: number; + /** + * The last exit code of this container + * @example 0 + */ + ExitCode?: number; + Error?: string; + /** + * The time when this container was last started. + * @example 2020-01-06T09:06:59.461876391Z + */ + StartedAt?: string; + /** + * The time when this container last exited. + * @example 2020-01-06T09:07:59.461876391Z + */ + FinishedAt?: string; + Health?: { + /** + * Status is one of `none`, `starting`, `healthy` or `unhealthy` + * + * - "none" Indicates there is no healthcheck + * - "starting" Starting indicates that the container is not yet ready + * - "healthy" Healthy indicates that the container is running correctly + * - "unhealthy" Unhealthy indicates that the container has a problem + * @enum none,starting,healthy,unhealthy + * @example healthy + */ + Status?: "none" | "starting" | "healthy" | "unhealthy"; + /** + * FailingStreak is the number of consecutive failures + * @example 0 + */ + FailingStreak?: number; + Log?: readonly { + /** + * Date and time at which this check started in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2020-01-04T10:44:24.496525531Z + */ + Start?: string; + /** + * Date and time at which this check ended in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2020-01-04T10:45:21.364524523Z + */ + End?: string; + /** + * ExitCode meanings: + * + * - `0` healthy + * - `1` unhealthy + * - `2` reserved (considered unhealthy) + * - other values: error running probe + * @example 0 + */ + ExitCode?: number; + Output?: string; + }[]; + }; +}; +/** OK response to ContainerCreate operation */ +export type ContainerCreateResponse = { + /** + * The ID of the created container + * @example ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743 + */ + Id: string; + /** + * Warnings encountered when creating the container + * @example + */ + Warnings: readonly string[]; +}; +/** OK response to ContainerWait operation */ +export type ContainerWaitResponse = { + StatusCode: number; + Error?: { + Message?: string; + }; +}; +/** container waiting error, if any */ +export type ContainerWaitExitError = { + Message?: string; +}; +/** Response of Engine API: GET "/version" */ +export type SystemVersion = { + Platform?: { + Name: string; + }; + Components?: readonly { + /** + * Name of the component + * @example Engine + */ + Name: string; + /** + * Version of the component + * @example 19.03.12 + */ + Version: string; + Details?: {}; + }[]; + /** + * The version of the daemon + * @example 19.03.12 + */ + Version?: string; + /** + * The default (and highest) API version that is supported by the daemon + * @example 1.40 + */ + ApiVersion?: string; + /** + * The minimum API version that is supported by the daemon + * @example 1.12 + */ + MinAPIVersion?: string; + /** + * The Git commit of the source code that was used to build the daemon + * @example 48a66213fe + */ + GitCommit?: string; + /** + * The version Go used to compile the daemon, and the version of the Go + * runtime in use. + * @example go1.13.14 + */ + GoVersion?: string; + /** + * The operating system that the daemon is running on ("linux" or "windows") + * @example linux + */ + Os?: string; + /** + * The architecture that the daemon is running on + * @example amd64 + */ + Arch?: string; + /** + * The kernel version (`uname -r`) that the daemon is running on. + * + * This field is omitted when empty. + * @example 4.19.76-linuxkit + */ + KernelVersion?: string; + /** + * Indicates if the daemon is started with experimental features enabled. + * + * This field is omitted when empty / false. + * @example true + */ + Experimental?: boolean; + /** + * The date and time that the daemon was compiled. + * @example 2020-06-22T15:49:27.000000000+00:00 + */ + BuildTime?: string; +}; +export type SystemInfo = { + /** + * Unique identifier of the daemon. + * + *


+ * + * > **Note**: The format of the ID itself is not part of the API, and + * > should not be considered stable. + * @example 7TRN:IPZB:QYBB:VPBQ:UMPP:KARE:6ZNR:XE6T:7EWV:PKF4:ZOJD:TPYS + */ + ID?: string; + /** + * Total number of containers on the host. + * @example 14 + */ + Containers?: number; + /** + * Number of containers with status `"running"`. + * @example 3 + */ + ContainersRunning?: number; + /** + * Number of containers with status `"paused"`. + * @example 1 + */ + ContainersPaused?: number; + /** + * Number of containers with status `"stopped"`. + * @example 10 + */ + ContainersStopped?: number; + /** + * Total number of images on the host. + * + * Both _tagged_ and _untagged_ (dangling) images are counted. + * @example 508 + */ + Images?: number; + /** + * Name of the storage driver in use. + * @example overlay2 + */ + Driver?: string; + /** + * Information specific to the storage driver, provided as + * "label" / "value" pairs. + * + * This information is provided by the storage driver, and formatted + * in a way consistent with the output of `docker info` on the command + * line. + * + *


+ * + * > **Note**: The information returned in this field, including the + * > formatting of values and labels, should not be considered stable, + * > and may change without notice. + * @example Backing Filesystem,extfs,Supports d_type,true,Native Overlay Diff,true + */ + DriverStatus?: readonly (readonly string[])[]; + /** + * Root directory of persistent Docker state. + * + * Defaults to `/var/lib/docker` on Linux, and `C:\ProgramData\docker` + * on Windows. + * @example /var/lib/docker + */ + DockerRootDir?: string; + Plugins?: { + /** + * Names of available volume-drivers, and network-driver plugins. + * @example local + */ + Volume?: readonly string[]; + /** + * Names of available network-drivers, and network-driver plugins. + * @example bridge,host,ipvlan,macvlan,null,overlay + */ + Network?: readonly string[]; + /** + * Names of available authorization plugins. + * @example img-authz-plugin,hbm + */ + Authorization?: readonly string[]; + /** + * Names of available logging-drivers, and logging-driver plugins. + * @example awslogs,fluentd,gcplogs,gelf,journald,json-file,splunk,syslog + */ + Log?: readonly string[]; + }; + /** + * Indicates if the host has memory limit support enabled. + * @example true + */ + MemoryLimit?: boolean; + /** + * Indicates if the host has memory swap limit support enabled. + * @example true + */ + SwapLimit?: boolean; + /** + * Indicates if the host has kernel memory TCP limit support enabled. This + * field is omitted if not supported. + * + * Kernel memory TCP limits are not supported when using cgroups v2, which + * does not support the corresponding `memory.kmem.tcp.limit_in_bytes` cgroup. + * @example true + */ + KernelMemoryTCP?: boolean; + /** + * Indicates if CPU CFS(Completely Fair Scheduler) period is supported by + * the host. + * @example true + */ + CpuCfsPeriod?: boolean; + /** + * Indicates if CPU CFS(Completely Fair Scheduler) quota is supported by + * the host. + * @example true + */ + CpuCfsQuota?: boolean; + /** + * Indicates if CPU Shares limiting is supported by the host. + * @example true + */ + CPUShares?: boolean; + /** + * Indicates if CPUsets (cpuset.cpus, cpuset.mems) are supported by the host. + * + * See + * [cpuset(7)](https://www.kernel.org/doc/Documentation/cgroup-v1/cpusets.txt) + * @example true + */ + CPUSet?: boolean; + /** + * Indicates if the host kernel has PID limit support enabled. + * @example true + */ + PidsLimit?: boolean; + OomKillDisable?: boolean; + /** + * Indicates IPv4 forwarding is enabled. + * @example true + */ + IPv4Forwarding?: boolean; + /** + * Indicates if `bridge-nf-call-iptables` is available on the host. + * @example true + */ + BridgeNfIptables?: boolean; + /** + * Indicates if `bridge-nf-call-ip6tables` is available on the host. + * @example true + */ + BridgeNfIp6tables?: boolean; + /** + * Indicates if the daemon is running in debug-mode / with debug-level + * logging enabled. + * @example true + */ + Debug?: boolean; + /** + * The total number of file Descriptors in use by the daemon process. + * + * This information is only returned if debug-mode is enabled. + * @example 64 + */ + NFd?: number; + /** + * The number of goroutines that currently exist. + * + * This information is only returned if debug-mode is enabled. + * @example 174 + */ + NGoroutines?: number; + /** + * Current system-time in [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) + * format with nano-seconds. + * @example 2017-08-08T20:28:29.06202363Z + */ + SystemTime?: string; + LoggingDriver?: string; + /** + * The driver to use for managing cgroups. + * @default cgroupfs + * @enum cgroupfs,systemd,none + * @example cgroupfs + */ + CgroupDriver?: "cgroupfs" | "systemd" | "none"; + /** + * The version of the cgroup. + * @default 1 + * @enum 1,2 + * @example 1 + */ + CgroupVersion?: "1" | "2"; + /** + * Number of event listeners subscribed. + * @example 30 + */ + NEventsListener?: number; + /** + * Kernel version of the host. + * + * On Linux, this information obtained from `uname`. On Windows this + * information is queried from the + * HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows + * NT\\CurrentVersion\\ + * registry value, for example _"10.0 14393 + * (14393.1198.amd64fre.rs1_release_sec.170427-1353)"_. + * @example 4.9.38-moby + */ + KernelVersion?: string; + /** + * Name of the host's operating system, for example: "Ubuntu 16.04.2 LTS" + * or "Windows Server 2016 Datacenter" + * @example Alpine Linux v3.5 + */ + OperatingSystem?: string; + /** + * Version of the host's operating system + * + *


+ * + * > **Note**: The information returned in this field, including its + * > very existence, and the formatting of values, should not be considered + * > stable, and may change without notice. + * @example 16.04 + */ + OSVersion?: string; + /** + * Generic type of the operating system of the host, as returned by the + * Go runtime (`GOOS`). + * + * Currently returned values are "linux" and "windows". A full list of + * possible values can be found in the [Go + * documentation](https://go.dev/doc/install/source#environment). + * @example linux + */ + OSType?: string; + /** + * Hardware architecture of the host, as returned by the Go runtime + * (`GOARCH`). + * + * A full list of possible values can be found in the [Go + * documentation](https://go.dev/doc/install/source#environment). + * @example x86_64 + */ + Architecture?: string; + /** + * The number of logical CPUs usable by the daemon. + * + * The number of available CPUs is checked by querying the operating + * system when the daemon starts. Changes to operating system CPU + * allocation after the daemon is started are not reflected. + * @example 4 + */ + NCPU?: number; + /** + * Total amount of physical memory available on the host, in bytes. + * @example 2095882240 + */ + MemTotal?: number; + /** + * Address / URL of the index server that is used for image search, + * and as a default for user authentication for Docker Hub and Docker Cloud. + * @default https://index.docker.io/v1/ + * @example https://index.docker.io/v1/ + */ + IndexServerAddress?: string; + RegistryConfig?: { + /** + * List of IP ranges to which nondistributable artifacts can be pushed, + * using the CIDR syntax [RFC 4632](https://tools.ietf.org/html/4632). + * + * Some images (for example, Windows base images) contain artifacts + * whose distribution is restricted by license. When these images are + * pushed to a registry, restricted artifacts are not included. + * + * This configuration override this behavior, and enables the daemon to + * push nondistributable artifacts to all registries whose resolved IP + * address is within the subnet described by the CIDR syntax. + * + * This option is useful when pushing images containing + * nondistributable artifacts to a registry on an air-gapped network so + * hosts on that network can pull the images without connecting to + * another server. + * + * > **Warning**: Nondistributable artifacts typically have restrictions + * > on how and where they can be distributed and shared. Only use this + * > feature to push artifacts to private registries and ensure that you + * > are in compliance with any terms that cover redistributing + * > nondistributable artifacts. + * @example ::1/128,127.0.0.0/8 + */ + AllowNondistributableArtifactsCIDRs?: readonly string[]; + /** + * List of registry hostnames to which nondistributable artifacts can be + * pushed, using the format `[:]` or `[:]`. + * + * Some images (for example, Windows base images) contain artifacts + * whose distribution is restricted by license. When these images are + * pushed to a registry, restricted artifacts are not included. + * + * This configuration override this behavior for the specified + * registries. + * + * This option is useful when pushing images containing + * nondistributable artifacts to a registry on an air-gapped network so + * hosts on that network can pull the images without connecting to + * another server. + * + * > **Warning**: Nondistributable artifacts typically have restrictions + * > on how and where they can be distributed and shared. Only use this + * > feature to push artifacts to private registries and ensure that you + * > are in compliance with any terms that cover redistributing + * > nondistributable artifacts. + * @example registry.internal.corp.example.com:3000,[2001:db8:a0b:12f0::1]:443 + */ + AllowNondistributableArtifactsHostnames?: readonly string[]; + /** + * List of IP ranges of insecure registries, using the CIDR syntax + * ([RFC 4632](https://tools.ietf.org/html/4632)). Insecure registries + * accept un-encrypted (HTTP) and/or untrusted (HTTPS with certificates + * from unknown CAs) communication. + * + * By default, local registries (`127.0.0.0/8`) are configured as + * insecure. All other registries are secure. Communicating with an + * insecure registry is not possible if the daemon assumes that registry + * is secure. + * + * This configuration override this behavior, insecure communication with + * registries whose resolved IP address is within the subnet described by + * the CIDR syntax. + * + * Registries can also be marked insecure by hostname. Those registries + * are listed under `IndexConfigs` and have their `Secure` field set to + * `false`. + * + * > **Warning**: Using this option can be useful when running a local + * > registry, but introduces security vulnerabilities. This option + * > should therefore ONLY be used for testing purposes. For increased + * > security, users should add their CA to their system's list of trusted + * > CAs instead of enabling this option. + * @example ::1/128,127.0.0.0/8 + */ + InsecureRegistryCIDRs?: readonly string[]; + IndexConfigs?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * List of registry URLs that act as a mirror for the official + * (`docker.io`) registry. + * @example https://hub-mirror.corp.example.com:5000/,https://[2001:db8:a0b:12f0::1]/ + */ + Mirrors?: readonly string[]; + }; + /** + * User-defined resources can be either Integer resources (e.g, `SSD=3`) or + * String resources (e.g, `GPU=UUID1`). + * @example [object Object],[object Object],[object Object] + */ + GenericResources?: readonly { + NamedResourceSpec?: { + Kind?: string; + Value?: string; + }; + DiscreteResourceSpec?: { + Kind?: string; + Value?: number; + }; + }[]; + /** + * HTTP-proxy configured for the daemon. This value is obtained from the + * [`HTTP_PROXY`](https://www.gnu.org/software/wget/manual/html_node/Proxies.html) + * environment variable. + * Credentials ([user info + * component](https://tools.ietf.org/html/rfc3986#section-3.2.1)) in the proxy + * URL + * are masked in the API response. + * + * Containers do not automatically inherit this configuration. + * @example http://xxxxx:xxxxx@proxy.corp.example.com:8080 + */ + HttpProxy?: string; + /** + * HTTPS-proxy configured for the daemon. This value is obtained from the + * [`HTTPS_PROXY`](https://www.gnu.org/software/wget/manual/html_node/Proxies.html) + * environment variable. + * Credentials ([user info + * component](https://tools.ietf.org/html/rfc3986#section-3.2.1)) in the proxy + * URL + * are masked in the API response. + * + * Containers do not automatically inherit this configuration. + * @example https://xxxxx:xxxxx@proxy.corp.example.com:4443 + */ + HttpsProxy?: string; + /** + * Comma-separated list of domain extensions for which no proxy should be + * used. This value is obtained from the + * [`NO_PROXY`](https://www.gnu.org/software/wget/manual/html_node/Proxies.html) + * environment variable. + * + * Containers do not automatically inherit this configuration. + * @example *.local, 169.254/16 + */ + NoProxy?: string; + /** + * Hostname of the host. + * @example node5.corp.example.com + */ + Name?: string; + /** + * User-defined labels (key/value metadata) as set on the daemon. + * + *


+ * + * > **Note**: When part of a Swarm, nodes can both have _daemon_ labels, + * > set through the daemon configuration, and _node_ labels, set from a + * > manager node in the Swarm. Node labels are not included in this + * > field. Node labels can be retrieved using the `/nodes/(id)` endpoint + * > on a manager node in the Swarm. + * @example storage=ssd,production + */ + Labels?: readonly string[]; + /** + * Indicates if experimental features are enabled on the daemon. + * @example true + */ + ExperimentalBuild?: boolean; + /** + * Version string of the daemon. + * @example 24.0.2 + */ + ServerVersion?: string; + Runtimes?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * Name of the default OCI runtime that is used when starting containers. + * + * The default can be overridden per-container at create time. + * @default runc + * @example runc + */ + DefaultRuntime?: string; + Swarm?: { + /** + * Unique identifier of for this node in the swarm. + * @example k67qz4598weg5unwwffg6z1m1 + */ + NodeID?: string; + /** + * IP address at which this node can be reached by other nodes in the + * swarm. + * @example 10.0.0.46 + */ + NodeAddr?: string; + /** + * Current local status of this node. + * @enum ,inactive,pending,active,error,locked + * @example active + */ + LocalNodeState?: + | "" + | "inactive" + | "pending" + | "active" + | "error" + | "locked"; + ControlAvailable?: boolean; + Error?: string; + /** + * List of ID's and addresses of other managers in the swarm. + * @example [object Object],[object Object],[object Object] + */ + RemoteManagers?: readonly { + NodeID?: string; + Addr?: string; + }[]; + /** + * Total number of nodes in the swarm. + * @example 4 + */ + Nodes?: number | null; + /** + * Total number of managers in the swarm. + * @example 3 + */ + Managers?: number | null; + Cluster?: { + /** + * The ID of the swarm. + * @example abajmipo7b4xz5ip2nrla6b11 + */ + ID?: string; + Version?: { + Index?: number; + }; + /** + * Date and time at which the swarm was initialised in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2016-08-18T10:44:24.496525531Z + */ + CreatedAt?: string; + /** + * Date and time at which the swarm was last updated in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2017-08-09T07:09:37.632105588Z + */ + UpdatedAt?: string; + Spec?: { + /** + * Name of the swarm. + * @example default + */ + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Orchestration?: { + /** + * The number of historic tasks to keep per instance or node. If + * negative, never remove completed or failed tasks. + * @example 10 + */ + TaskHistoryRetentionLimit?: number; + }; + Raft?: { + /** + * The number of log entries between snapshots. + * @example 10000 + */ + SnapshotInterval?: number; + KeepOldSnapshots?: number; + /** + * The number of log entries to keep around to sync up slow followers + * after a snapshot is created. + * @example 500 + */ + LogEntriesForSlowFollowers?: number; + /** + * The number of ticks that a follower will wait for a message from + * the leader before becoming a candidate and starting an election. + * `ElectionTick` must be greater than `HeartbeatTick`. + * + * A tick currently defaults to one second, so these translate + * directly to seconds currently, but this is NOT guaranteed. + * @example 3 + */ + ElectionTick?: number; + /** + * The number of ticks between heartbeats. Every HeartbeatTick ticks, + * the leader will send a heartbeat to the followers. + * + * A tick currently defaults to one second, so these translate + * directly to seconds currently, but this is NOT guaranteed. + * @example 1 + */ + HeartbeatTick?: number; + }; + Dispatcher?: { + /** + * The delay for an agent to send a heartbeat to the dispatcher. + * @example 5000000000 + */ + HeartbeatPeriod?: number; + }; + CAConfig?: { + /** + * The duration node certificates are issued for. + * @example 7776000000000000 + */ + NodeCertExpiry?: number; + ExternalCAs?: readonly { + /** + * Protocol for communication with the external CA (currently + * only `cfssl` is supported). + * @default cfssl + * @enum cfssl + */ + Protocol?: "cfssl"; + URL?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + CACert?: string; + }[]; + SigningCACert?: string; + SigningCAKey?: string; + ForceRotate?: number; + }; + EncryptionConfig?: { + /** + * If set, generate a key and use it to lock data stored on the + * managers. + * @example false + */ + AutoLockManagers?: boolean; + }; + TaskDefaults?: { + LogDriver?: { + /** + * The log driver to use as a default for new tasks. + * @example json-file + */ + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; + }; + /** + * Information about the issuer of leaf TLS certificates and the trusted root + * CA certificate. + * @example [object Object] + */ + TLSInfo?: { + TrustRoot?: string; + CertIssuerSubject?: string; + CertIssuerPublicKey?: string; + }; + /** + * Whether there is currently a root CA rotation in progress for the swarm + * @example false + */ + RootRotationInProgress?: boolean; + /** + * DataPathPort specifies the data path port number for data traffic. + * Acceptable port range is 1024 to 49151. + * If no port is set or is set to 0, the default port (4789) is used. + * @example 4789 + */ + DataPathPort?: number; + DefaultAddrPool?: readonly string[]; + /** + * SubnetSize specifies the subnet size of the networks created from the + * default subnet pool. + * @example 24 + */ + SubnetSize?: number; + }; + }; + /** + * Indicates if live restore is enabled. + * + * If enabled, containers are kept running when the daemon is shutdown + * or upon daemon start if running containers are detected. + * @example false + */ + LiveRestoreEnabled?: boolean; + /** + * Represents the isolation technology to use as a default for containers. + * The supported values are platform-specific. + * + * If no isolation value is specified on daemon start, on Windows client, + * the default is `hyperv`, and on Windows server, the default is `process`. + * + * This option is currently not used on other platforms. + * @default default + * @enum default,hyperv,process, + */ + Isolation?: "default" | "hyperv" | "process" | ""; + /** + * Name and, optional, path of the `docker-init` binary. + * + * If the path is omitted, the daemon searches the host's `$PATH` for the + * binary and uses the first result. + * @example docker-init + */ + InitBinary?: string; + ContainerdCommit?: { + /** + * Actual commit ID of external tool. + * @example cfb82a876ecc11b5ca0977d1733adbe58599088a + */ + ID?: string; + /** + * Commit ID of external tool expected by dockerd as set at build time. + * @example 2d41c047c83e09a6d61d464906feb2a2f3c52aa4 + */ + Expected?: string; + }; + RuncCommit?: { + /** + * Actual commit ID of external tool. + * @example cfb82a876ecc11b5ca0977d1733adbe58599088a + */ + ID?: string; + /** + * Commit ID of external tool expected by dockerd as set at build time. + * @example 2d41c047c83e09a6d61d464906feb2a2f3c52aa4 + */ + Expected?: string; + }; + InitCommit?: { + /** + * Actual commit ID of external tool. + * @example cfb82a876ecc11b5ca0977d1733adbe58599088a + */ + ID?: string; + /** + * Commit ID of external tool expected by dockerd as set at build time. + * @example 2d41c047c83e09a6d61d464906feb2a2f3c52aa4 + */ + Expected?: string; + }; + /** + * List of security features that are enabled on the daemon, such as + * apparmor, seccomp, SELinux, user-namespaces (userns), rootless and + * no-new-privileges. + * + * Additional configuration options for each security feature may + * be present, and are included as a comma-separated list of key/value + * pairs. + * @example name=apparmor,name=seccomp,profile=default,name=selinux,name=userns,name=rootless + */ + SecurityOptions?: readonly string[]; + /** + * Reports a summary of the product license on the daemon. + * + * If a commercial license has been applied to the daemon, information + * such as number of nodes, and expiration are included. + * @example Community Engine + */ + ProductLicense?: string; + DefaultAddressPools?: readonly { + /** + * The network address in CIDR format + * @example 10.10.0.0/16 + */ + Base?: string; + /** + * The network pool size + * @example 24 + */ + Size?: number; + }[]; + /** + * List of warnings / informational messages about missing features, or + * issues related to the daemon configuration. + * + * These messages can be printed by the client as information to the user. + * @example WARNING: No memory limit support + */ + Warnings?: readonly string[]; +}; +/** + * Available plugins per type. + * + *


+ * + * > **Note**: Only unmanaged (V1) plugins are included in this list. + * > V1 plugins are "lazily" loaded, and are not returned in this list + * > if there is no resource using the plugin. + */ +export type PluginsInfo = { + /** + * Names of available volume-drivers, and network-driver plugins. + * @example local + */ + Volume?: readonly string[]; + /** + * Names of available network-drivers, and network-driver plugins. + * @example bridge,host,ipvlan,macvlan,null,overlay + */ + Network?: readonly string[]; + /** + * Names of available authorization plugins. + * @example img-authz-plugin,hbm + */ + Authorization?: readonly string[]; + /** + * Names of available logging-drivers, and logging-driver plugins. + * @example awslogs,fluentd,gcplogs,gelf,journald,json-file,splunk,syslog + */ + Log?: readonly string[]; +}; +/** RegistryServiceConfig stores daemon registry services configuration. */ +export type RegistryServiceConfig = { + /** + * List of IP ranges to which nondistributable artifacts can be pushed, + * using the CIDR syntax [RFC 4632](https://tools.ietf.org/html/4632). + * + * Some images (for example, Windows base images) contain artifacts + * whose distribution is restricted by license. When these images are + * pushed to a registry, restricted artifacts are not included. + * + * This configuration override this behavior, and enables the daemon to + * push nondistributable artifacts to all registries whose resolved IP + * address is within the subnet described by the CIDR syntax. + * + * This option is useful when pushing images containing + * nondistributable artifacts to a registry on an air-gapped network so + * hosts on that network can pull the images without connecting to + * another server. + * + * > **Warning**: Nondistributable artifacts typically have restrictions + * > on how and where they can be distributed and shared. Only use this + * > feature to push artifacts to private registries and ensure that you + * > are in compliance with any terms that cover redistributing + * > nondistributable artifacts. + * @example ::1/128,127.0.0.0/8 + */ + AllowNondistributableArtifactsCIDRs?: readonly string[]; + /** + * List of registry hostnames to which nondistributable artifacts can be + * pushed, using the format `[:]` or `[:]`. + * + * Some images (for example, Windows base images) contain artifacts + * whose distribution is restricted by license. When these images are + * pushed to a registry, restricted artifacts are not included. + * + * This configuration override this behavior for the specified + * registries. + * + * This option is useful when pushing images containing + * nondistributable artifacts to a registry on an air-gapped network so + * hosts on that network can pull the images without connecting to + * another server. + * + * > **Warning**: Nondistributable artifacts typically have restrictions + * > on how and where they can be distributed and shared. Only use this + * > feature to push artifacts to private registries and ensure that you + * > are in compliance with any terms that cover redistributing + * > nondistributable artifacts. + * @example registry.internal.corp.example.com:3000,[2001:db8:a0b:12f0::1]:443 + */ + AllowNondistributableArtifactsHostnames?: readonly string[]; + /** + * List of IP ranges of insecure registries, using the CIDR syntax + * ([RFC 4632](https://tools.ietf.org/html/4632)). Insecure registries + * accept un-encrypted (HTTP) and/or untrusted (HTTPS with certificates + * from unknown CAs) communication. + * + * By default, local registries (`127.0.0.0/8`) are configured as + * insecure. All other registries are secure. Communicating with an + * insecure registry is not possible if the daemon assumes that registry + * is secure. + * + * This configuration override this behavior, insecure communication with + * registries whose resolved IP address is within the subnet described by + * the CIDR syntax. + * + * Registries can also be marked insecure by hostname. Those registries + * are listed under `IndexConfigs` and have their `Secure` field set to + * `false`. + * + * > **Warning**: Using this option can be useful when running a local + * > registry, but introduces security vulnerabilities. This option + * > should therefore ONLY be used for testing purposes. For increased + * > security, users should add their CA to their system's list of trusted + * > CAs instead of enabling this option. + * @example ::1/128,127.0.0.0/8 + */ + InsecureRegistryCIDRs?: readonly string[]; + IndexConfigs?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * List of registry URLs that act as a mirror for the official + * (`docker.io`) registry. + * @example https://hub-mirror.corp.example.com:5000/,https://[2001:db8:a0b:12f0::1]/ + */ + Mirrors?: readonly string[]; +}; +/** IndexInfo contains information about a registry. */ +export type IndexInfo = { + /** + * Name of the registry, such as "docker.io". + * @example docker.io + */ + Name?: string; + /** + * List of mirrors, expressed as URIs. + * @example https://hub-mirror.corp.example.com:5000/,https://registry-2.docker.io/,https://registry-3.docker.io/ + */ + Mirrors?: readonly string[]; + /** + * Indicates if the registry is part of the list of insecure + * registries. + * + * If `false`, the registry is insecure. Insecure registries accept + * un-encrypted (HTTP) and/or untrusted (HTTPS with certificates from + * unknown CAs) communication. + * + * > **Warning**: Insecure registries can be useful when running a local + * > registry. However, because its use creates security vulnerabilities + * > it should ONLY be enabled for testing purposes. For increased + * > security, users should add their CA to their system's list of + * > trusted CAs instead of enabling this option. + * @example true + */ + Secure?: boolean; + /** + * Indicates whether this is an official registry (i.e., Docker Hub / + * docker.io) + * @example true + */ + Official?: boolean; +}; +/** + * Runtime describes an [OCI + * compliant](https://github.com/opencontainers/runtime-spec) + * runtime. + * + * The runtime is invoked by the daemon via the `containerd` daemon. OCI + * runtimes act as an interface to the Linux kernel namespaces, cgroups, + * and SELinux. + */ +export type Runtime = { + /** + * Name and, optional, path, of the OCI executable binary. + * + * If the path is omitted, the daemon searches the host's `$PATH` for the + * binary and uses the first result. + * @example /usr/local/bin/my-oci-runtime + */ + path?: string; + /** + * List of command-line arguments to pass to the runtime when invoked. + * @example --debug,--systemd-cgroup=false + */ + runtimeArgs?: readonly string[]; +}; +/** + * Commit holds the Git-commit (SHA1) that a binary was built from, as + * reported in the version-string of external tools, such as `containerd`, + * or `runC`. + */ +export type Commit = { + /** + * Actual commit ID of external tool. + * @example cfb82a876ecc11b5ca0977d1733adbe58599088a + */ + ID?: string; + /** + * Commit ID of external tool expected by dockerd as set at build time. + * @example 2d41c047c83e09a6d61d464906feb2a2f3c52aa4 + */ + Expected?: string; +}; +/** Represents generic information about swarm. */ +export type SwarmInfo = { + /** + * Unique identifier of for this node in the swarm. + * @example k67qz4598weg5unwwffg6z1m1 + */ + NodeID?: string; + /** + * IP address at which this node can be reached by other nodes in the + * swarm. + * @example 10.0.0.46 + */ + NodeAddr?: string; + /** + * Current local status of this node. + * @enum ,inactive,pending,active,error,locked + * @example active + */ + LocalNodeState?: "" | "inactive" | "pending" | "active" | "error" | "locked"; + ControlAvailable?: boolean; + Error?: string; + /** + * List of ID's and addresses of other managers in the swarm. + * @example [object Object],[object Object],[object Object] + */ + RemoteManagers?: readonly { + NodeID?: string; + Addr?: string; + }[]; + /** + * Total number of nodes in the swarm. + * @example 4 + */ + Nodes?: number | null; + /** + * Total number of managers in the swarm. + * @example 3 + */ + Managers?: number | null; + Cluster?: { + /** + * The ID of the swarm. + * @example abajmipo7b4xz5ip2nrla6b11 + */ + ID?: string; + Version?: { + Index?: number; + }; + /** + * Date and time at which the swarm was initialised in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2016-08-18T10:44:24.496525531Z + */ + CreatedAt?: string; + /** + * Date and time at which the swarm was last updated in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2017-08-09T07:09:37.632105588Z + */ + UpdatedAt?: string; + Spec?: { + /** + * Name of the swarm. + * @example default + */ + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Orchestration?: { + /** + * The number of historic tasks to keep per instance or node. If + * negative, never remove completed or failed tasks. + * @example 10 + */ + TaskHistoryRetentionLimit?: number; + }; + Raft?: { + /** + * The number of log entries between snapshots. + * @example 10000 + */ + SnapshotInterval?: number; + KeepOldSnapshots?: number; + /** + * The number of log entries to keep around to sync up slow followers + * after a snapshot is created. + * @example 500 + */ + LogEntriesForSlowFollowers?: number; + /** + * The number of ticks that a follower will wait for a message from + * the leader before becoming a candidate and starting an election. + * `ElectionTick` must be greater than `HeartbeatTick`. + * + * A tick currently defaults to one second, so these translate + * directly to seconds currently, but this is NOT guaranteed. + * @example 3 + */ + ElectionTick?: number; + /** + * The number of ticks between heartbeats. Every HeartbeatTick ticks, + * the leader will send a heartbeat to the followers. + * + * A tick currently defaults to one second, so these translate + * directly to seconds currently, but this is NOT guaranteed. + * @example 1 + */ + HeartbeatTick?: number; + }; + Dispatcher?: { + /** + * The delay for an agent to send a heartbeat to the dispatcher. + * @example 5000000000 + */ + HeartbeatPeriod?: number; + }; + CAConfig?: { + /** + * The duration node certificates are issued for. + * @example 7776000000000000 + */ + NodeCertExpiry?: number; + ExternalCAs?: readonly { + /** + * Protocol for communication with the external CA (currently + * only `cfssl` is supported). + * @default cfssl + * @enum cfssl + */ + Protocol?: "cfssl"; + URL?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + CACert?: string; + }[]; + SigningCACert?: string; + SigningCAKey?: string; + ForceRotate?: number; + }; + EncryptionConfig?: { + /** + * If set, generate a key and use it to lock data stored on the + * managers. + * @example false + */ + AutoLockManagers?: boolean; + }; + TaskDefaults?: { + LogDriver?: { + /** + * The log driver to use as a default for new tasks. + * @example json-file + */ + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; + }; + /** + * Information about the issuer of leaf TLS certificates and the trusted root + * CA certificate. + * @example [object Object] + */ + TLSInfo?: { + TrustRoot?: string; + CertIssuerSubject?: string; + CertIssuerPublicKey?: string; + }; + /** + * Whether there is currently a root CA rotation in progress for the swarm + * @example false + */ + RootRotationInProgress?: boolean; + /** + * DataPathPort specifies the data path port number for data traffic. + * Acceptable port range is 1024 to 49151. + * If no port is set or is set to 0, the default port (4789) is used. + * @example 4789 + */ + DataPathPort?: number; + DefaultAddrPool?: readonly string[]; + /** + * SubnetSize specifies the subnet size of the networks created from the + * default subnet pool. + * @example 24 + */ + SubnetSize?: number; + }; +}; +/** Current local status of this node. */ +export type LocalNodeState = + | "" + | "inactive" + | "pending" + | "active" + | "error" + | "locked"; +/** Represents a peer-node in the swarm */ +export type PeerNode = { + NodeID?: string; + Addr?: string; +}; +/** Specifies how a service should be attached to a particular network. */ +export type NetworkAttachmentConfig = { + Target?: string; + Aliases?: readonly string[]; + DriverOpts?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; +}; +/** + * Actor describes something that generates events, like a container, network, + * or a volume. + */ +export type EventActor = { + /** + * The ID of the object emitting the event + * @example ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743 + */ + ID?: string; + Attributes?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; +}; +/** EventMessage represents the information an event contains. */ +export type EventMessage = { + /** + * The type of object emitting the event + * @enum builder,config,container,daemon,image,network,node,plugin,secret,service,volume + * @example container + */ + Type?: + | "builder" + | "config" + | "container" + | "daemon" + | "image" + | "network" + | "node" + | "plugin" + | "secret" + | "service" + | "volume"; + /** + * The type of event + * @example create + */ + Action?: string; + Actor?: { + /** + * The ID of the object emitting the event + * @example ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743 + */ + ID?: string; + Attributes?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + /** + * Scope of the event. Engine events are `local` scope. Cluster (Swarm) + * events are `swarm` scope. + * @enum local,swarm + */ + scope?: "local" | "swarm"; + /** + * Timestamp of event + * @example 1629574695 + */ + time?: number; + /** + * Timestamp of event, with nanosecond accuracy + * @example 1629574695515050000 + */ + timeNano?: number; +}; +/** + * A descriptor struct containing digest, media type, and size, as defined in + * the [OCI Content Descriptors + * Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md). + */ +export type OciDescriptor = { + /** + * The media type of the object this schema refers to. + * @example application/vnd.docker.distribution.manifest.v2+json + */ + mediaType?: string; + /** + * The digest of the targeted content. + * @example sha256:c0537ff6a5218ef531ece93d4984efc99bbf3f7497c0a7726c88e2bb7584dc96 + */ + digest?: string; + /** + * The size in bytes of the blob. + * @example 3987495 + */ + size?: number; +}; +/** + * Describes the platform which the image in the manifest runs on, as defined + * in the [OCI Image Index + * Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md). + */ +export type OciPlatform = { + /** + * The CPU architecture, for example `amd64` or `ppc64`. + * @example arm + */ + architecture?: string; + /** + * The operating system, for example `linux` or `windows`. + * @example windows + */ + os?: string; + /** + * Optional field specifying the operating system version, for example on + * Windows `10.0.19041.1165`. + * @example 10.0.19041.1165 + */ + "os.version"?: string; + /** + * Optional field specifying an array of strings, each listing a required + * OS feature (for example on Windows `win32k`). + * @example win32k + */ + "os.features"?: readonly string[]; + /** + * Optional field specifying a variant of the CPU, for example `v7` to + * specify ARMv7 when architecture is `arm`. + * @example v7 + */ + variant?: string; +}; +/** + * Describes the result obtained from contacting the registry to retrieve + * image metadata. + */ +export type DistributionInspect = { + Descriptor: { + /** + * The media type of the object this schema refers to. + * @example application/vnd.docker.distribution.manifest.v2+json + */ + mediaType?: string; + /** + * The digest of the targeted content. + * @example sha256:c0537ff6a5218ef531ece93d4984efc99bbf3f7497c0a7726c88e2bb7584dc96 + */ + digest?: string; + /** + * The size in bytes of the blob. + * @example 3987495 + */ + size?: number; + }; + Platforms: readonly { + /** + * The CPU architecture, for example `amd64` or `ppc64`. + * @example arm + */ + architecture?: string; + /** + * The operating system, for example `linux` or `windows`. + * @example windows + */ + os?: string; + /** + * Optional field specifying the operating system version, for example on + * Windows `10.0.19041.1165`. + * @example 10.0.19041.1165 + */ + "os.version"?: string; + /** + * Optional field specifying an array of strings, each listing a required + * OS feature (for example on Windows `win32k`). + * @example win32k + */ + "os.features"?: readonly string[]; + /** + * Optional field specifying a variant of the CPU, for example `v7` to + * specify ARMv7 when architecture is `arm`. + * @example v7 + */ + variant?: string; + }[]; +}; +/** + * Options and information specific to, and only present on, Swarm CSI + * cluster volumes. + */ +export type ClusterVolume = { + ID?: string; + Version?: { + Index?: number; + }; + CreatedAt?: string; + UpdatedAt?: string; + Spec?: { + Group?: string; + AccessMode?: { + /** + * The set of nodes this volume can be used on at one time. + * - `single` The volume may only be scheduled to one node at a time. + * - `multi` the volume may be scheduled to any supported number of nodes at a + * time. + * @default single + * @enum single,multi + */ + Scope?: "single" | "multi"; + /** + * The number and way that different tasks can use this volume + * at one time. + * - `none` The volume may only be used by one task at a time. + * - `readonly` The volume may be used by any number of tasks, but they all + * must mount the volume as readonly + * - `onewriter` The volume may be used by any number of tasks, but only one + * may mount it as read/write. + * - `all` The volume may have any number of readers and writers. + * @default none + * @enum none,readonly,onewriter,all + */ + Sharing?: "none" | "readonly" | "onewriter" | "all"; + MountVolume?: {}; + Secrets?: readonly { + Key?: string; + Secret?: string; + }[]; + AccessibilityRequirements?: { + Requisite?: readonly Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >[]; + Preferred?: readonly Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >[]; + }; + CapacityRange?: { + RequiredBytes?: number; + LimitBytes?: number; + }; + /** + * The availability of the volume for use in tasks. + * - `active` The volume is fully available for scheduling on the cluster + * - `pause` No new workloads should use the volume, but existing workloads + * are not stopped. + * - `drain` All workloads using this volume should be stopped and + * rescheduled, and no new ones should be started. + * @default active + * @enum active,pause,drain + */ + Availability?: "active" | "pause" | "drain"; + }; + }; + Info?: { + CapacityBytes?: number; + VolumeContext?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + VolumeID?: string; + AccessibleTopology?: readonly Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >[]; + }; + PublishStatus?: readonly { + NodeID?: string; + /** + * The published state of the volume. + * * `pending-publish` The volume should be published to this node, but the + * call to the controller plugin to do so has not yet been successfully + * completed. + * * `published` The volume is published successfully to the node. + * * `pending-node-unpublish` The volume should be unpublished from the node, + * and the manager is awaiting confirmation from the worker that it has done + * so. + * * `pending-controller-unpublish` The volume is successfully unpublished + * from the node, but has not yet been successfully unpublished on the + * controller. + * @enum pending-publish,published,pending-node-unpublish,pending-controller-unpublish + */ + State?: + | "pending-publish" + | "published" + | "pending-node-unpublish" + | "pending-controller-unpublish"; + PublishContext?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; +}; +/** Cluster-specific options used to create the volume. */ +export type ClusterVolumeSpec = { + Group?: string; + AccessMode?: { + /** + * The set of nodes this volume can be used on at one time. + * - `single` The volume may only be scheduled to one node at a time. + * - `multi` the volume may be scheduled to any supported number of nodes at a + * time. + * @default single + * @enum single,multi + */ + Scope?: "single" | "multi"; + /** + * The number and way that different tasks can use this volume + * at one time. + * - `none` The volume may only be used by one task at a time. + * - `readonly` The volume may be used by any number of tasks, but they all + * must mount the volume as readonly + * - `onewriter` The volume may be used by any number of tasks, but only one + * may mount it as read/write. + * - `all` The volume may have any number of readers and writers. + * @default none + * @enum none,readonly,onewriter,all + */ + Sharing?: "none" | "readonly" | "onewriter" | "all"; + MountVolume?: {}; + Secrets?: readonly { + Key?: string; + Secret?: string; + }[]; + AccessibilityRequirements?: { + Requisite?: readonly Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >[]; + Preferred?: readonly Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >[]; + }; + CapacityRange?: { + RequiredBytes?: number; + LimitBytes?: number; + }; + /** + * The availability of the volume for use in tasks. + * - `active` The volume is fully available for scheduling on the cluster + * - `pause` No new workloads should use the volume, but existing workloads + * are not stopped. + * - `drain` All workloads using this volume should be stopped and + * rescheduled, and no new ones should be started. + * @default active + * @enum active,pause,drain + */ + Availability?: "active" | "pause" | "drain"; + }; +}; +/** + * A map of topological domains to topological segments. For in depth + * details, see documentation for the Topology object in the CSI + * specification. + */ +export type Topology = Record; +export type ContainerListCommandQuery = { + all?: "true" | "false"; + limit?: `${number}` | undefined; + size?: "true" | "false"; + filters?: string | undefined; +}; +export type ContainerListCommandInput = ContainerListCommandQuery; +export type ContainerListCommandOutput = readonly { + Id?: string; + Names?: readonly string[]; + Image?: string; + ImageID?: string; + Command?: string; + Created?: number; + Ports?: readonly { + IP?: string; + PrivatePort: number; + PublicPort?: number; + Type: "tcp" | "udp" | "sctp"; + }[]; + SizeRw?: number; + SizeRootFs?: number; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + State?: string; + Status?: string; + HostConfig?: { + NetworkMode?: string; + }; + NetworkSettings?: { + Networks?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + Mounts?: readonly { + /** + * The mount type: + * + * - `bind` a mount of a file or directory from the host into the container. + * - `volume` a docker volume with the given `Name`. + * - `tmpfs` a `tmpfs`. + * - `npipe` a named pipe from the host into the container. + * - `cluster` a Swarm cluster volume + * @enum bind,volume,tmpfs,npipe,cluster + * @example volume + */ + Type?: "bind" | "volume" | "tmpfs" | "npipe" | "cluster"; + /** + * Name is the name reference to the underlying data defined by `Source` + * e.g., the volume name. + * @example myvolume + */ + Name?: string; + /** + * Source location of the mount. + * + * For volumes, this contains the storage location of the volume (within + * `/var/lib/docker/volumes/`). For bind-mounts, and `npipe`, this contains + * the source (host) part of the bind-mount. For `tmpfs` mount points, this + * field is empty. + * @example /var/lib/docker/volumes/myvolume/_data + */ + Source?: string; + /** + * Destination is the path relative to the container root (`/`) where + * the `Source` is mounted inside the container. + * @example /usr/share/nginx/html/ + */ + Destination?: string; + /** + * Driver is the volume driver used to create the volume (if it is a volume). + * @example local + */ + Driver?: string; + /** + * Mode is a comma separated list of options supplied by the user when + * creating the bind/volume mount. + * + * The default is platform-specific (`"z"` on Linux, empty on Windows). + * @example z + */ + Mode?: string; + /** + * Whether the mount is mounted writable (read-write). + * @example true + */ + RW?: boolean; + /** + * Propagation describes how mounts are propagated from the host into the + * mount point, and vice-versa. Refer to the [Linux kernel + * documentation](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt) + * for details. This field is not used on Windows. + * @example + */ + Propagation?: string; + }[]; +}[]; +export type ContainerCreateCommandQuery = { + name?: string | undefined; + platform?: string | undefined; +}; +type ContainerCreateJsonBody = { + /** + * The hostname to use for the container, as a valid RFC 1123 hostname. + * @example 439f4e91bd1d + */ + Hostname?: string; + Domainname?: string; + User?: string; + AttachStdin?: boolean; + /** + * Whether to attach to `stdout`. + * @default true + */ + AttachStdout?: boolean; + /** + * Whether to attach to `stderr`. + * @default true + */ + AttachStderr?: boolean; + ExposedPorts?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Tty?: boolean; + OpenStdin?: boolean; + StdinOnce?: boolean; + /** + * A list of environment variables to set inside the container in the + * form `["VAR=value", ...]`. A variable without `=` is removed from the + * environment, rather than to have an empty value. + * @example PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + */ + Env?: readonly string[]; + /** + * Command to run specified as a string or an array of strings. + * @example /bin/sh + */ + Cmd?: readonly string[]; + Healthcheck?: { + Test?: readonly string[]; + Interval?: number; + Timeout?: number; + Retries?: number; + StartPeriod?: number; + }; + /** + * Command is already escaped (Windows only) + * @example false + */ + ArgsEscaped?: boolean | null; + /** + * The name (or reference) of the image to use when creating the container, + * or which was used when the container was created. + * @example example-image:1.0 + */ + Image?: string; + Volumes?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * The working directory for commands to run in. + * @example /public/ + */ + WorkingDir?: string; + /** + * The entry point for the container as a string or an array of strings. + * + * If the array consists of exactly one empty string (`[""]`) then the + * entry point is reset to system default (i.e., the entry point used by + * docker when there is no `ENTRYPOINT` instruction in the `Dockerfile`). + * @example + */ + Entrypoint?: readonly string[]; + NetworkDisabled?: boolean | null; + MacAddress?: string; + /** + * `ONBUILD` metadata that were defined in the image's `Dockerfile`. + * @example + */ + OnBuild?: readonly string[]; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * Signal to stop a container as a string or unsigned integer. + * @example SIGTERM + */ + StopSignal?: string; + StopTimeout?: number | null; + /** + * Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell. + * @example /bin/sh,-c + */ + Shell?: readonly string[]; +} & { + HostConfig?: { + CpuShares?: number; + Memory?: number; + CgroupParent?: string; + BlkioWeight?: number; + BlkioWeightDevice?: readonly { + Path?: string; + Weight?: number; + }[]; + BlkioDeviceReadBps?: readonly { + Path?: string; + Rate?: number; + }[]; + BlkioDeviceWriteBps?: readonly { + Path?: string; + Rate?: number; + }[]; + BlkioDeviceReadIOps?: readonly { + Path?: string; + Rate?: number; + }[]; + BlkioDeviceWriteIOps?: readonly { + Path?: string; + Rate?: number; + }[]; + CpuPeriod?: number; + CpuQuota?: number; + CpuRealtimePeriod?: number; + CpuRealtimeRuntime?: number; + /** + * CPUs in which to allow execution (e.g., `0-3`, `0,1`). + * @example 0-3 + */ + CpusetCpus?: string; + CpusetMems?: string; + Devices?: readonly { + PathOnHost?: string; + PathInContainer?: string; + CgroupPermissions?: string; + }[]; + DeviceCgroupRules?: readonly string[]; + DeviceRequests?: readonly { + Driver?: string; + Count?: number; + DeviceIDs?: readonly string[]; + /** + * A list of capabilities; an OR list of AND lists of capabilities. + * @example gpu,nvidia,compute + */ + Capabilities?: readonly (readonly string[])[]; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; + KernelMemoryTCP?: number; + MemoryReservation?: number; + MemorySwap?: number; + MemorySwappiness?: number; + NanoCpus?: number; + OomKillDisable?: boolean; + Init?: boolean | null; + PidsLimit?: number | null; + Ulimits?: readonly { + Name?: string; + Soft?: number; + Hard?: number; + }[]; + CpuCount?: number; + CpuPercent?: number; + IOMaximumIOps?: number; + IOMaximumBandwidth?: number; + } & { + Binds?: readonly string[]; + ContainerIDFile?: string; + LogConfig?: { + Type?: + | "json-file" + | "syslog" + | "journald" + | "gelf" + | "fluentd" + | "awslogs" + | "splunk" + | "etwlogs" + | "none"; + Config?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + NetworkMode?: string; + PortBindings?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + RestartPolicy?: { + /** + * - Empty string means not to restart + * - `no` Do not automatically restart + * - `always` Always restart + * - `unless-stopped` Restart always except when the user has manually stopped + * the container + * - `on-failure` Restart only when the container exit code is non-zero + * @enum ,no,always,unless-stopped,on-failure + */ + Name?: "" | "no" | "always" | "unless-stopped" | "on-failure"; + MaximumRetryCount?: number; + }; + AutoRemove?: boolean; + VolumeDriver?: string; + VolumesFrom?: readonly string[]; + Mounts?: readonly { + Target?: string; + Source?: string; + /** + * The mount type. Available types: + * + * - `bind` Mounts a file or directory from the host into the container. Must + * exist prior to creating the container. + * - `volume` Creates a volume with the given name and options (or uses a + * pre-existing volume with the same name and options). These are **not** + * removed when the container is removed. + * - `tmpfs` Create a tmpfs with the given options. The mount source cannot be + * specified for tmpfs. + * - `npipe` Mounts a named pipe from the host into the container. Must exist + * prior to creating the container. + * - `cluster` a Swarm cluster volume + * @enum bind,volume,tmpfs,npipe,cluster + */ + Type?: "bind" | "volume" | "tmpfs" | "npipe" | "cluster"; + ReadOnly?: boolean; + Consistency?: string; + BindOptions?: { + /** + * A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + * @enum private,rprivate,shared,rshared,slave,rslave + */ + Propagation?: + | "private" + | "rprivate" + | "shared" + | "rshared" + | "slave" + | "rslave"; + NonRecursive?: boolean; + CreateMountpoint?: boolean; + }; + VolumeOptions?: { + NoCopy?: boolean; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + DriverConfig?: { + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; + TmpfsOptions?: { + SizeBytes?: number; + Mode?: number; + }; + }[]; + ConsoleSize?: readonly number[]; + Annotations?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + CapAdd?: readonly string[]; + CapDrop?: readonly string[]; + /** + * cgroup namespace mode for the container. Possible values are: + * + * - `"private"`: the container runs in its own private cgroup namespace + * - `"host"`: use the host system's cgroup namespace + * + * If not specified, the daemon default is used, which can either be + * `"private"` + * or `"host"`, depending on daemon version, kernel support and configuration. + * @enum private,host + */ + CgroupnsMode?: "private" | "host"; + Dns?: readonly string[]; + DnsOptions?: readonly string[]; + DnsSearch?: readonly string[]; + ExtraHosts?: readonly string[]; + GroupAdd?: readonly string[]; + IpcMode?: string; + Cgroup?: string; + Links?: readonly string[]; + /** + * An integer value containing the score given to the container in + * order to tune OOM killer preferences. + * @example 500 + */ + OomScoreAdj?: number; + PidMode?: string; + Privileged?: boolean; + PublishAllPorts?: boolean; + ReadonlyRootfs?: boolean; + SecurityOpt?: readonly string[]; + StorageOpt?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Tmpfs?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + UTSMode?: string; + UsernsMode?: string; + ShmSize?: number; + Sysctls?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Runtime?: string; + /** + * Isolation technology of the container. (Windows only) + * @enum default,process,hyperv, + */ + Isolation?: "default" | "process" | "hyperv" | ""; + MaskedPaths?: readonly string[]; + ReadonlyPaths?: readonly string[]; + }; + /** + * NetworkingConfig represents the container's networking configuration for + * each of its interfaces. + * It is used for the networking configs specified in the `docker create` + * and `docker network connect` commands. + * @example [object Object] + */ + NetworkingConfig?: { + EndpointsConfig?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; +}; +export type ContainerCreateCommandBody = ContainerCreateJsonBody; +export type ContainerCreateCommandInput = ContainerCreateJsonBody & + ContainerCreateCommandQuery; +export type ContainerCreateCommandOutput = { + /** + * The ID of the created container + * @example ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743 + */ + Id: string; + /** + * Warnings encountered when creating the container + * @example + */ + Warnings: readonly string[]; +}; +export type ContainerInspectCommandQuery = { + size?: "true" | "false"; +}; +export type ContainerInspectCommandParams = { + id: string; +}; +export type ContainerInspectCommandInput = ContainerInspectCommandParams & + ContainerInspectCommandQuery; +export type ContainerInspectCommandOutput = { + Id?: string; + Created?: string; + Path?: string; + Args?: readonly string[]; + State?: { + /** + * String representation of the container state. Can be one of "created", + * "running", "paused", "restarting", "removing", "exited", or "dead". + * @enum created,running,paused,restarting,removing,exited,dead + * @example running + */ + Status?: + | "created" + | "running" + | "paused" + | "restarting" + | "removing" + | "exited" + | "dead"; + /** + * Whether this container is running. + * + * Note that a running container can be _paused_. The `Running` and `Paused` + * booleans are not mutually exclusive: + * + * When pausing a container (on Linux), the freezer cgroup is used to suspend + * all processes in the container. Freezing the process requires the process + * to + * be running. As a result, paused containers are both `Running` _and_ + * `Paused`. + * + * Use the `Status` field instead to determine if a container's state is + * "running". + * @example true + */ + Running?: boolean; + /** + * Whether this container is paused. + * @example false + */ + Paused?: boolean; + /** + * Whether this container is restarting. + * @example false + */ + Restarting?: boolean; + /** + * Whether a process within this container has been killed because it ran + * out of memory since the container was last started. + * @example false + */ + OOMKilled?: boolean; + Dead?: boolean; + /** + * The process ID of this container + * @example 1234 + */ + Pid?: number; + /** + * The last exit code of this container + * @example 0 + */ + ExitCode?: number; + Error?: string; + /** + * The time when this container was last started. + * @example 2020-01-06T09:06:59.461876391Z + */ + StartedAt?: string; + /** + * The time when this container last exited. + * @example 2020-01-06T09:07:59.461876391Z + */ + FinishedAt?: string; + Health?: { + /** + * Status is one of `none`, `starting`, `healthy` or `unhealthy` + * + * - "none" Indicates there is no healthcheck + * - "starting" Starting indicates that the container is not yet ready + * - "healthy" Healthy indicates that the container is running correctly + * - "unhealthy" Unhealthy indicates that the container has a problem + * @enum none,starting,healthy,unhealthy + * @example healthy + */ + Status?: "none" | "starting" | "healthy" | "unhealthy"; + /** + * FailingStreak is the number of consecutive failures + * @example 0 + */ + FailingStreak?: number; + Log?: readonly { + /** + * Date and time at which this check started in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2020-01-04T10:44:24.496525531Z + */ + Start?: string; + /** + * Date and time at which this check ended in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2020-01-04T10:45:21.364524523Z + */ + End?: string; + /** + * ExitCode meanings: + * + * - `0` healthy + * - `1` unhealthy + * - `2` reserved (considered unhealthy) + * - other values: error running probe + * @example 0 + */ + ExitCode?: number; + Output?: string; + }[]; + }; + }; + Image?: string; + ResolvConfPath?: string; + HostnamePath?: string; + HostsPath?: string; + LogPath?: string; + Name?: string; + RestartCount?: number; + Driver?: string; + Platform?: string; + MountLabel?: string; + ProcessLabel?: string; + AppArmorProfile?: string; + ExecIDs?: readonly string[]; + HostConfig?: { + CpuShares?: number; + Memory?: number; + CgroupParent?: string; + BlkioWeight?: number; + BlkioWeightDevice?: readonly { + Path?: string; + Weight?: number; + }[]; + BlkioDeviceReadBps?: readonly { + Path?: string; + Rate?: number; + }[]; + BlkioDeviceWriteBps?: readonly { + Path?: string; + Rate?: number; + }[]; + BlkioDeviceReadIOps?: readonly { + Path?: string; + Rate?: number; + }[]; + BlkioDeviceWriteIOps?: readonly { + Path?: string; + Rate?: number; + }[]; + CpuPeriod?: number; + CpuQuota?: number; + CpuRealtimePeriod?: number; + CpuRealtimeRuntime?: number; + /** + * CPUs in which to allow execution (e.g., `0-3`, `0,1`). + * @example 0-3 + */ + CpusetCpus?: string; + CpusetMems?: string; + Devices?: readonly { + PathOnHost?: string; + PathInContainer?: string; + CgroupPermissions?: string; + }[]; + DeviceCgroupRules?: readonly string[]; + DeviceRequests?: readonly { + Driver?: string; + Count?: number; + DeviceIDs?: readonly string[]; + /** + * A list of capabilities; an OR list of AND lists of capabilities. + * @example gpu,nvidia,compute + */ + Capabilities?: readonly (readonly string[])[]; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; + KernelMemoryTCP?: number; + MemoryReservation?: number; + MemorySwap?: number; + MemorySwappiness?: number; + NanoCpus?: number; + OomKillDisable?: boolean; + Init?: boolean | null; + PidsLimit?: number | null; + Ulimits?: readonly { + Name?: string; + Soft?: number; + Hard?: number; + }[]; + CpuCount?: number; + CpuPercent?: number; + IOMaximumIOps?: number; + IOMaximumBandwidth?: number; + } & { + Binds?: readonly string[]; + ContainerIDFile?: string; + LogConfig?: { + Type?: + | "json-file" + | "syslog" + | "journald" + | "gelf" + | "fluentd" + | "awslogs" + | "splunk" + | "etwlogs" + | "none"; + Config?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + NetworkMode?: string; + PortBindings?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + RestartPolicy?: { + /** + * - Empty string means not to restart + * - `no` Do not automatically restart + * - `always` Always restart + * - `unless-stopped` Restart always except when the user has manually stopped + * the container + * - `on-failure` Restart only when the container exit code is non-zero + * @enum ,no,always,unless-stopped,on-failure + */ + Name?: "" | "no" | "always" | "unless-stopped" | "on-failure"; + MaximumRetryCount?: number; + }; + AutoRemove?: boolean; + VolumeDriver?: string; + VolumesFrom?: readonly string[]; + Mounts?: readonly { + Target?: string; + Source?: string; + /** + * The mount type. Available types: + * + * - `bind` Mounts a file or directory from the host into the container. Must + * exist prior to creating the container. + * - `volume` Creates a volume with the given name and options (or uses a + * pre-existing volume with the same name and options). These are **not** + * removed when the container is removed. + * - `tmpfs` Create a tmpfs with the given options. The mount source cannot be + * specified for tmpfs. + * - `npipe` Mounts a named pipe from the host into the container. Must exist + * prior to creating the container. + * - `cluster` a Swarm cluster volume + * @enum bind,volume,tmpfs,npipe,cluster + */ + Type?: "bind" | "volume" | "tmpfs" | "npipe" | "cluster"; + ReadOnly?: boolean; + Consistency?: string; + BindOptions?: { + /** + * A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + * @enum private,rprivate,shared,rshared,slave,rslave + */ + Propagation?: + | "private" + | "rprivate" + | "shared" + | "rshared" + | "slave" + | "rslave"; + NonRecursive?: boolean; + CreateMountpoint?: boolean; + }; + VolumeOptions?: { + NoCopy?: boolean; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + DriverConfig?: { + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; + TmpfsOptions?: { + SizeBytes?: number; + Mode?: number; + }; + }[]; + ConsoleSize?: readonly number[]; + Annotations?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + CapAdd?: readonly string[]; + CapDrop?: readonly string[]; + /** + * cgroup namespace mode for the container. Possible values are: + * + * - `"private"`: the container runs in its own private cgroup namespace + * - `"host"`: use the host system's cgroup namespace + * + * If not specified, the daemon default is used, which can either be + * `"private"` + * or `"host"`, depending on daemon version, kernel support and configuration. + * @enum private,host + */ + CgroupnsMode?: "private" | "host"; + Dns?: readonly string[]; + DnsOptions?: readonly string[]; + DnsSearch?: readonly string[]; + ExtraHosts?: readonly string[]; + GroupAdd?: readonly string[]; + IpcMode?: string; + Cgroup?: string; + Links?: readonly string[]; + /** + * An integer value containing the score given to the container in + * order to tune OOM killer preferences. + * @example 500 + */ + OomScoreAdj?: number; + PidMode?: string; + Privileged?: boolean; + PublishAllPorts?: boolean; + ReadonlyRootfs?: boolean; + SecurityOpt?: readonly string[]; + StorageOpt?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Tmpfs?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + UTSMode?: string; + UsernsMode?: string; + ShmSize?: number; + Sysctls?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Runtime?: string; + /** + * Isolation technology of the container. (Windows only) + * @enum default,process,hyperv, + */ + Isolation?: "default" | "process" | "hyperv" | ""; + MaskedPaths?: readonly string[]; + ReadonlyPaths?: readonly string[]; + }; + GraphDriver?: { + /** + * Name of the storage driver. + * @example overlay2 + */ + Name: string; + Data: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + SizeRw?: number; + SizeRootFs?: number; + Mounts?: readonly { + /** + * The mount type: + * + * - `bind` a mount of a file or directory from the host into the container. + * - `volume` a docker volume with the given `Name`. + * - `tmpfs` a `tmpfs`. + * - `npipe` a named pipe from the host into the container. + * - `cluster` a Swarm cluster volume + * @enum bind,volume,tmpfs,npipe,cluster + * @example volume + */ + Type?: "bind" | "volume" | "tmpfs" | "npipe" | "cluster"; + /** + * Name is the name reference to the underlying data defined by `Source` + * e.g., the volume name. + * @example myvolume + */ + Name?: string; + /** + * Source location of the mount. + * + * For volumes, this contains the storage location of the volume (within + * `/var/lib/docker/volumes/`). For bind-mounts, and `npipe`, this contains + * the source (host) part of the bind-mount. For `tmpfs` mount points, this + * field is empty. + * @example /var/lib/docker/volumes/myvolume/_data + */ + Source?: string; + /** + * Destination is the path relative to the container root (`/`) where + * the `Source` is mounted inside the container. + * @example /usr/share/nginx/html/ + */ + Destination?: string; + /** + * Driver is the volume driver used to create the volume (if it is a volume). + * @example local + */ + Driver?: string; + /** + * Mode is a comma separated list of options supplied by the user when + * creating the bind/volume mount. + * + * The default is platform-specific (`"z"` on Linux, empty on Windows). + * @example z + */ + Mode?: string; + /** + * Whether the mount is mounted writable (read-write). + * @example true + */ + RW?: boolean; + /** + * Propagation describes how mounts are propagated from the host into the + * mount point, and vice-versa. Refer to the [Linux kernel + * documentation](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt) + * for details. This field is not used on Windows. + * @example + */ + Propagation?: string; + }[]; + Config?: { + /** + * The hostname to use for the container, as a valid RFC 1123 hostname. + * @example 439f4e91bd1d + */ + Hostname?: string; + Domainname?: string; + User?: string; + AttachStdin?: boolean; + /** + * Whether to attach to `stdout`. + * @default true + */ + AttachStdout?: boolean; + /** + * Whether to attach to `stderr`. + * @default true + */ + AttachStderr?: boolean; + ExposedPorts?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Tty?: boolean; + OpenStdin?: boolean; + StdinOnce?: boolean; + /** + * A list of environment variables to set inside the container in the + * form `["VAR=value", ...]`. A variable without `=` is removed from the + * environment, rather than to have an empty value. + * @example PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + */ + Env?: readonly string[]; + /** + * Command to run specified as a string or an array of strings. + * @example /bin/sh + */ + Cmd?: readonly string[]; + Healthcheck?: { + Test?: readonly string[]; + Interval?: number; + Timeout?: number; + Retries?: number; + StartPeriod?: number; + }; + /** + * Command is already escaped (Windows only) + * @example false + */ + ArgsEscaped?: boolean | null; + /** + * The name (or reference) of the image to use when creating the container, + * or which was used when the container was created. + * @example example-image:1.0 + */ + Image?: string; + Volumes?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * The working directory for commands to run in. + * @example /public/ + */ + WorkingDir?: string; + /** + * The entry point for the container as a string or an array of strings. + * + * If the array consists of exactly one empty string (`[""]`) then the + * entry point is reset to system default (i.e., the entry point used by + * docker when there is no `ENTRYPOINT` instruction in the `Dockerfile`). + * @example + */ + Entrypoint?: readonly string[]; + NetworkDisabled?: boolean | null; + MacAddress?: string; + /** + * `ONBUILD` metadata that were defined in the image's `Dockerfile`. + * @example + */ + OnBuild?: readonly string[]; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * Signal to stop a container as a string or unsigned integer. + * @example SIGTERM + */ + StopSignal?: string; + StopTimeout?: number | null; + /** + * Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell. + * @example /bin/sh,-c + */ + Shell?: readonly string[]; + }; + NetworkSettings?: { + /** + * Name of the network's bridge (for example, `docker0`). + * @example docker0 + */ + Bridge?: string; + /** + * SandboxID uniquely represents a container's network stack. + * @example 9d12daf2c33f5959c8bf90aa513e4f65b561738661003029ec84830cd503a0c3 + */ + SandboxID?: string; + /** + * Indicates if hairpin NAT should be enabled on the virtual interface. + * @example false + */ + HairpinMode?: boolean; + /** + * IPv6 unicast address using the link-local prefix. + * @example fe80::42:acff:fe11:1 + */ + LinkLocalIPv6Address?: string; + /** + * Prefix length of the IPv6 unicast address. + * @example 64 + */ + LinkLocalIPv6PrefixLen?: number; + Ports?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * SandboxKey identifies the sandbox + * @example /var/run/docker/netns/8ab54b426c38 + */ + SandboxKey?: string; + SecondaryIPAddresses?: readonly { + Addr?: string; + PrefixLen?: number; + }[]; + SecondaryIPv6Addresses?: readonly { + Addr?: string; + PrefixLen?: number; + }[]; + /** + * EndpointID uniquely represents a service endpoint in a Sandbox. + * + *


+ * + * > **Deprecated**: This field is only propagated when attached to the + * > default "bridge" network. Use the information from the "bridge" + * > network inside the `Networks` map instead, which contains the same + * > information. This field was deprecated in Docker 1.9 and is scheduled + * > to be removed in Docker 17.12.0 + * @example b88f5b905aabf2893f3cbc4ee42d1ea7980bbc0a92e2c8922b1e1795298afb0b + */ + EndpointID?: string; + /** + * Gateway address for the default "bridge" network. + * + *


+ * + * > **Deprecated**: This field is only propagated when attached to the + * > default "bridge" network. Use the information from the "bridge" + * > network inside the `Networks` map instead, which contains the same + * > information. This field was deprecated in Docker 1.9 and is scheduled + * > to be removed in Docker 17.12.0 + * @example 172.17.0.1 + */ + Gateway?: string; + /** + * Global IPv6 address for the default "bridge" network. + * + *


+ * + * > **Deprecated**: This field is only propagated when attached to the + * > default "bridge" network. Use the information from the "bridge" + * > network inside the `Networks` map instead, which contains the same + * > information. This field was deprecated in Docker 1.9 and is scheduled + * > to be removed in Docker 17.12.0 + * @example 2001:db8::5689 + */ + GlobalIPv6Address?: string; + /** + * Mask length of the global IPv6 address. + * + *


+ * + * > **Deprecated**: This field is only propagated when attached to the + * > default "bridge" network. Use the information from the "bridge" + * > network inside the `Networks` map instead, which contains the same + * > information. This field was deprecated in Docker 1.9 and is scheduled + * > to be removed in Docker 17.12.0 + * @example 64 + */ + GlobalIPv6PrefixLen?: number; + /** + * IPv4 address for the default "bridge" network. + * + *


+ * + * > **Deprecated**: This field is only propagated when attached to the + * > default "bridge" network. Use the information from the "bridge" + * > network inside the `Networks` map instead, which contains the same + * > information. This field was deprecated in Docker 1.9 and is scheduled + * > to be removed in Docker 17.12.0 + * @example 172.17.0.4 + */ + IPAddress?: string; + /** + * Mask length of the IPv4 address. + * + *


+ * + * > **Deprecated**: This field is only propagated when attached to the + * > default "bridge" network. Use the information from the "bridge" + * > network inside the `Networks` map instead, which contains the same + * > information. This field was deprecated in Docker 1.9 and is scheduled + * > to be removed in Docker 17.12.0 + * @example 16 + */ + IPPrefixLen?: number; + /** + * IPv6 gateway address for this network. + * + *


+ * + * > **Deprecated**: This field is only propagated when attached to the + * > default "bridge" network. Use the information from the "bridge" + * > network inside the `Networks` map instead, which contains the same + * > information. This field was deprecated in Docker 1.9 and is scheduled + * > to be removed in Docker 17.12.0 + * @example 2001:db8:2::100 + */ + IPv6Gateway?: string; + /** + * MAC address for the container on the default "bridge" network. + * + *


+ * + * > **Deprecated**: This field is only propagated when attached to the + * > default "bridge" network. Use the information from the "bridge" + * > network inside the `Networks` map instead, which contains the same + * > information. This field was deprecated in Docker 1.9 and is scheduled + * > to be removed in Docker 17.12.0 + * @example 02:42:ac:11:00:04 + */ + MacAddress?: string; + Networks?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; +}; +export type ContainerTopCommandQuery = { + ps_args?: string | undefined; +}; +export type ContainerTopCommandParams = { + id: string; +}; +export type ContainerTopCommandInput = ContainerTopCommandParams & + ContainerTopCommandQuery; +export type ContainerTopCommandOutput = { + Titles?: readonly string[]; + Processes?: readonly (readonly string[])[]; +}; +export type ContainerLogsCommandQuery = { + follow?: "true" | "false"; + stdout?: "true" | "false"; + stderr?: "true" | "false"; + since?: `${number}` | undefined; + until?: `${number}` | undefined; + timestamps?: "true" | "false"; + tail?: string | undefined; +}; +export type ContainerLogsCommandParams = { + id: string; +}; +export type ContainerLogsCommandInput = ContainerLogsCommandParams & + ContainerLogsCommandQuery; +export type ContainerChangesCommandParams = { + id: string; +}; +export type ContainerChangesCommandInput = ContainerChangesCommandParams; +export type ContainerChangesCommandOutput = readonly { + Path: string; + /** + * Kind of change + * + * Can be one of: + * + * - `0`: Modified ("C") + * - `1`: Added ("A") + * - `2`: Deleted ("D") + * @enum 0,1,2 + */ + Kind: number; +}[]; +export type ContainerExportCommandParams = { + id: string; +}; +export type ContainerExportCommandInput = ContainerExportCommandParams; +export type ContainerStatsCommandQuery = { + stream?: "true" | "false"; + oneshot?: "true" | "false"; +}; +export type ContainerStatsCommandParams = { + id: string; +}; +export type ContainerStatsCommandInput = ContainerStatsCommandParams & + ContainerStatsCommandQuery; +export type ContainerStatsCommandOutput = + | Record + | undefined; +export type ContainerResizeCommandQuery = { + h: `${number}`; + w: `${number}`; +}; +export type ContainerResizeCommandParams = { + id: string; +}; +export type ContainerResizeCommandInput = ContainerResizeCommandParams & + ContainerResizeCommandQuery; +export type ContainerStartCommandQuery = { + detachKeys?: string | undefined; +}; +export type ContainerStartCommandParams = { + id: string; +}; +export type ContainerStartCommandInput = ContainerStartCommandParams & + ContainerStartCommandQuery; +export type ContainerStopCommandQuery = { + signal?: string | undefined; + t?: `${number}` | undefined; +}; +export type ContainerStopCommandParams = { + id: string; +}; +export type ContainerStopCommandInput = ContainerStopCommandParams & + ContainerStopCommandQuery; +export type ContainerRestartCommandQuery = { + signal?: string | undefined; + t?: `${number}` | undefined; +}; +export type ContainerRestartCommandParams = { + id: string; +}; +export type ContainerRestartCommandInput = ContainerRestartCommandParams & + ContainerRestartCommandQuery; +export type ContainerKillCommandQuery = { + signal?: string | undefined; +}; +export type ContainerKillCommandParams = { + id: string; +}; +export type ContainerKillCommandInput = ContainerKillCommandParams & + ContainerKillCommandQuery; +type ContainerUpdateJsonBody = { + CpuShares?: number; + Memory?: number; + CgroupParent?: string; + BlkioWeight?: number; + BlkioWeightDevice?: readonly { + Path?: string; + Weight?: number; + }[]; + BlkioDeviceReadBps?: readonly { + Path?: string; + Rate?: number; + }[]; + BlkioDeviceWriteBps?: readonly { + Path?: string; + Rate?: number; + }[]; + BlkioDeviceReadIOps?: readonly { + Path?: string; + Rate?: number; + }[]; + BlkioDeviceWriteIOps?: readonly { + Path?: string; + Rate?: number; + }[]; + CpuPeriod?: number; + CpuQuota?: number; + CpuRealtimePeriod?: number; + CpuRealtimeRuntime?: number; + /** + * CPUs in which to allow execution (e.g., `0-3`, `0,1`). + * @example 0-3 + */ + CpusetCpus?: string; + CpusetMems?: string; + Devices?: readonly { + PathOnHost?: string; + PathInContainer?: string; + CgroupPermissions?: string; + }[]; + DeviceCgroupRules?: readonly string[]; + DeviceRequests?: readonly { + Driver?: string; + Count?: number; + DeviceIDs?: readonly string[]; + /** + * A list of capabilities; an OR list of AND lists of capabilities. + * @example gpu,nvidia,compute + */ + Capabilities?: readonly (readonly string[])[]; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; + KernelMemoryTCP?: number; + MemoryReservation?: number; + MemorySwap?: number; + MemorySwappiness?: number; + NanoCpus?: number; + OomKillDisable?: boolean; + Init?: boolean | null; + PidsLimit?: number | null; + Ulimits?: readonly { + Name?: string; + Soft?: number; + Hard?: number; + }[]; + CpuCount?: number; + CpuPercent?: number; + IOMaximumIOps?: number; + IOMaximumBandwidth?: number; +} & { + RestartPolicy?: { + /** + * - Empty string means not to restart + * - `no` Do not automatically restart + * - `always` Always restart + * - `unless-stopped` Restart always except when the user has manually stopped + * the container + * - `on-failure` Restart only when the container exit code is non-zero + * @enum ,no,always,unless-stopped,on-failure + */ + Name?: "" | "no" | "always" | "unless-stopped" | "on-failure"; + MaximumRetryCount?: number; + }; +}; +export type ContainerUpdateCommandParams = { + id: string; +}; +export type ContainerUpdateCommandBody = ContainerUpdateJsonBody; +export type ContainerUpdateCommandInput = ContainerUpdateJsonBody & + ContainerUpdateCommandParams; +export type ContainerUpdateCommandOutput = { + Warnings?: readonly string[]; +}; +export type ContainerRenameCommandQuery = { + name: string; +}; +export type ContainerRenameCommandParams = { + id: string; +}; +export type ContainerRenameCommandInput = ContainerRenameCommandParams & + ContainerRenameCommandQuery; +export type ContainerPauseCommandParams = { + id: string; +}; +export type ContainerPauseCommandInput = ContainerPauseCommandParams; +export type ContainerUnpauseCommandParams = { + id: string; +}; +export type ContainerUnpauseCommandInput = ContainerUnpauseCommandParams; +export type ContainerAttachCommandQuery = { + detachKeys?: string | undefined; + logs?: "true" | "false"; + stream?: "true" | "false"; + stdin?: "true" | "false"; + stdout?: "true" | "false"; + stderr?: "true" | "false"; +}; +export type ContainerAttachCommandParams = { + id: string; +}; +export type ContainerAttachCommandInput = ContainerAttachCommandParams & + ContainerAttachCommandQuery; +export type ContainerAttachWebsocketCommandQuery = { + detachKeys?: string | undefined; + logs?: "true" | "false"; + stream?: "true" | "false"; + stdin?: "true" | "false"; + stdout?: "true" | "false"; + stderr?: "true" | "false"; +}; +export type ContainerAttachWebsocketCommandParams = { + id: string; +}; +export type ContainerAttachWebsocketCommandInput = + ContainerAttachWebsocketCommandParams & ContainerAttachWebsocketCommandQuery; +export type ContainerWaitCommandQuery = { + condition?: "not-running" | "next-exit" | "removed"; +}; +export type ContainerWaitCommandParams = { + id: string; +}; +export type ContainerWaitCommandInput = ContainerWaitCommandParams & + ContainerWaitCommandQuery; +export type ContainerWaitCommandOutput = { + StatusCode: number; + Error?: { + Message?: string; + }; +}; +export type ContainerDeleteCommandQuery = { + v?: "true" | "false"; + force?: "true" | "false"; + link?: "true" | "false"; +}; +export type ContainerDeleteCommandParams = { + id: string; +}; +export type ContainerDeleteCommandInput = ContainerDeleteCommandParams & + ContainerDeleteCommandQuery; +export type ContainerArchiveCommandQuery = { + path: string; +}; +export type ContainerArchiveCommandParams = { + id: string; +}; +export type ContainerArchiveCommandInput = ContainerArchiveCommandParams & + ContainerArchiveCommandQuery; +export type PutContainerArchiveCommandQuery = { + path: string; + noOverwriteDirNonDir?: string | undefined; + copyUIDGID?: string | undefined; +}; +type PutContainerArchiveCommandBodyApplicationXTar = NonNullable< + RequestInit["body"] +>; +type PutContainerArchiveCommandBodyApplicationOctetStream = NonNullable< + RequestInit["body"] +>; +export type PutContainerArchiveCommandBodyNonJson = { + body: + | PutContainerArchiveCommandBodyApplicationOctetStream + | PutContainerArchiveCommandBodyApplicationXTar; +}; +export type PutContainerArchiveCommandParams = { + id: string; +}; +export type PutContainerArchiveCommandInput = + PutContainerArchiveCommandBodyNonJson & + PutContainerArchiveCommandParams & + PutContainerArchiveCommandQuery; +export type ContainerArchiveInfoCommandQuery = { + path: string; +}; +export type ContainerArchiveInfoCommandParams = { + id: string; +}; +export type ContainerArchiveInfoCommandInput = + ContainerArchiveInfoCommandParams & ContainerArchiveInfoCommandQuery; +export type ContainerPruneCommandQuery = { + filters?: string | undefined; +}; +export type ContainerPruneCommandInput = ContainerPruneCommandQuery; +export type ContainerPruneCommandOutput = { + ContainersDeleted?: readonly string[]; + SpaceReclaimed?: number; +}; +export type ImageListCommandQuery = { + all?: "true" | "false"; + filters?: string | undefined; + sharedsize?: "true" | "false"; + digests?: "true" | "false"; +}; +export type ImageListCommandInput = ImageListCommandQuery; +export type ImageListCommandOutput = readonly { + /** + * ID is the content-addressable ID of an image. + * + * This identifier is a content-addressable digest calculated from the + * image's configuration (which includes the digests of layers used by + * the image). + * + * Note that this digest differs from the `RepoDigests` below, which + * holds digests of image manifests that reference the image. + * @example sha256:ec3f0931a6e6b6855d76b2d7b0be30e81860baccd891b2e243280bf1cd8ad710 + */ + Id: string; + /** + * ID of the parent image. + * + * Depending on how the image was created, this field may be empty and + * is only set for images that were built/created locally. This field + * is empty if the image was pulled from an image registry. + * @example + */ + ParentId: string; + /** + * List of image names/tags in the local image cache that reference this + * image. + * + * Multiple image tags can refer to the same image, and this list may be + * empty if no tags reference the image, in which case the image is + * "untagged", in which case it can still be referenced by its ID. + * @example example:1.0,example:latest,example:stable,internal.registry.example.com:5000/example:1.0 + */ + RepoTags: readonly string[]; + /** + * List of content-addressable digests of locally available image manifests + * that the image is referenced from. Multiple manifests can refer to the + * same image. + * + * These digests are usually only available if the image was either pulled + * from a registry, or if the image was pushed to a registry, which is when + * the manifest is generated and its digest calculated. + * @example example@sha256:afcc7f1ac1b49db317a7196c902e61c6c3c4607d63599ee1a82d702d249a0ccb,internal.registry.example.com:5000/example@sha256:b69959407d21e8a062e0416bf13405bb2b71ed7a84dde4158ebafacfa06f5578 + */ + RepoDigests: readonly string[]; + /** + * Date and time at which the image was created as a Unix timestamp + * (number of seconds since EPOCH). + * @example 1644009612 + */ + Created: number; + /** + * Total size of the image including all layers it is composed of. + * @example 172064416 + */ + Size: number; + /** + * Total size of image layers that are shared between this image and other + * images. + * + * This size is not calculated by default. `-1` indicates that the value + * has not been set / calculated. + * @example 1239828 + */ + SharedSize: number; + /** + * Total size of the image including all layers it is composed of. + * + * In versions of Docker before v1.10, this field was calculated from + * the image itself and all of its parent images. Images are now stored + * self-contained, and no longer use a parent-chain, making this field + * an equivalent of the Size field. + * + * Deprecated: this field is kept for backward compatibility, and will be + * removed in API v1.44. + * @example 172064416 + */ + VirtualSize?: number; + Labels: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * Number of containers using this image. Includes both stopped and running + * containers. + * + * This size is not calculated by default, and depends on which API endpoint + * is used. `-1` indicates that the value has not been set / calculated. + * @example 2 + */ + Containers: number; +}[]; +export type ImageBuildCommandQuery = { + dockerfile?: string | undefined; + t?: string | undefined; + extrahosts?: string | undefined; + remote?: string | undefined; + q?: "true" | "false"; + nocache?: "true" | "false"; + cachefrom?: string | undefined; + pull?: string | undefined; + rm?: "true" | "false"; + forcerm?: "true" | "false"; + memory?: `${number}` | undefined; + memswap?: `${number}` | undefined; + cpushares?: `${number}` | undefined; + cpusetcpus?: string | undefined; + cpuperiod?: `${number}` | undefined; + cpuquota?: `${number}` | undefined; + buildargs?: string | undefined; + shmsize?: `${number}` | undefined; + squash?: "true" | "false"; + labels?: string | undefined; + networkmode?: string | undefined; + platform?: string | undefined; + target?: string | undefined; + outputs?: string | undefined; + version?: "1" | "2"; +}; +type ImageBuildCommandBodyApplicationOctetStream = NonNullable< + RequestInit["body"] +>; +export type ImageBuildCommandBodyNonJson = { + body: ImageBuildCommandBodyApplicationOctetStream; +}; +export type ImageBuildCommandInput = ImageBuildCommandBodyNonJson & + ImageBuildCommandQuery; +export type BuildPruneCommandQuery = { + keepstorage?: `${number}` | undefined; + all?: "true" | "false"; + filters?: string | undefined; +}; +export type BuildPruneCommandInput = BuildPruneCommandQuery; +export type BuildPruneCommandOutput = { + CachesDeleted?: readonly string[]; + SpaceReclaimed?: number; +}; +export type ImageCreateCommandQuery = { + fromImage?: string | undefined; + fromSrc?: string | undefined; + repo?: string | undefined; + tag?: string | undefined; + message?: string | undefined; + changes?: readonly string[] | undefined; + platform?: string | undefined; +}; +type ImageCreateCommandBodyTextPlain = NonNullable; +type ImageCreateCommandBodyApplicationOctetStream = NonNullable< + RequestInit["body"] +>; +export type ImageCreateCommandBodyNonJson = { + body: + | ImageCreateCommandBodyApplicationOctetStream + | ImageCreateCommandBodyTextPlain; +}; +export type ImageCreateCommandInput = ImageCreateCommandBodyNonJson & + ImageCreateCommandQuery; +export type ImageInspectCommandParams = { + name: string; +}; +export type ImageInspectCommandInput = ImageInspectCommandParams; +export type ImageInspectCommandOutput = { + /** + * ID is the content-addressable ID of an image. + * + * This identifier is a content-addressable digest calculated from the + * image's configuration (which includes the digests of layers used by + * the image). + * + * Note that this digest differs from the `RepoDigests` below, which + * holds digests of image manifests that reference the image. + * @example sha256:ec3f0931a6e6b6855d76b2d7b0be30e81860baccd891b2e243280bf1cd8ad710 + */ + Id?: string; + /** + * List of image names/tags in the local image cache that reference this + * image. + * + * Multiple image tags can refer to the same image, and this list may be + * empty if no tags reference the image, in which case the image is + * "untagged", in which case it can still be referenced by its ID. + * @example example:1.0,example:latest,example:stable,internal.registry.example.com:5000/example:1.0 + */ + RepoTags?: readonly string[]; + /** + * List of content-addressable digests of locally available image manifests + * that the image is referenced from. Multiple manifests can refer to the + * same image. + * + * These digests are usually only available if the image was either pulled + * from a registry, or if the image was pushed to a registry, which is when + * the manifest is generated and its digest calculated. + * @example example@sha256:afcc7f1ac1b49db317a7196c902e61c6c3c4607d63599ee1a82d702d249a0ccb,internal.registry.example.com:5000/example@sha256:b69959407d21e8a062e0416bf13405bb2b71ed7a84dde4158ebafacfa06f5578 + */ + RepoDigests?: readonly string[]; + /** + * ID of the parent image. + * + * Depending on how the image was created, this field may be empty and + * is only set for images that were built/created locally. This field + * is empty if the image was pulled from an image registry. + * @example + */ + Parent?: string; + /** + * Optional message that was set when committing or importing the image. + * @example + */ + Comment?: string; + /** + * Date and time at which the image was created, formatted in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2022-02-04T21:20:12.497794809Z + */ + Created?: string; + /** + * The ID of the container that was used to create the image. + * + * Depending on how the image was created, this field may be empty. + * @example 65974bc86f1770ae4bff79f651ebdbce166ae9aada632ee3fa9af3a264911735 + */ + Container?: string; + ContainerConfig?: { + /** + * The hostname to use for the container, as a valid RFC 1123 hostname. + * @example 439f4e91bd1d + */ + Hostname?: string; + Domainname?: string; + User?: string; + AttachStdin?: boolean; + /** + * Whether to attach to `stdout`. + * @default true + */ + AttachStdout?: boolean; + /** + * Whether to attach to `stderr`. + * @default true + */ + AttachStderr?: boolean; + ExposedPorts?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Tty?: boolean; + OpenStdin?: boolean; + StdinOnce?: boolean; + /** + * A list of environment variables to set inside the container in the + * form `["VAR=value", ...]`. A variable without `=` is removed from the + * environment, rather than to have an empty value. + * @example PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + */ + Env?: readonly string[]; + /** + * Command to run specified as a string or an array of strings. + * @example /bin/sh + */ + Cmd?: readonly string[]; + Healthcheck?: { + Test?: readonly string[]; + Interval?: number; + Timeout?: number; + Retries?: number; + StartPeriod?: number; + }; + /** + * Command is already escaped (Windows only) + * @example false + */ + ArgsEscaped?: boolean | null; + /** + * The name (or reference) of the image to use when creating the container, + * or which was used when the container was created. + * @example example-image:1.0 + */ + Image?: string; + Volumes?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * The working directory for commands to run in. + * @example /public/ + */ + WorkingDir?: string; + /** + * The entry point for the container as a string or an array of strings. + * + * If the array consists of exactly one empty string (`[""]`) then the + * entry point is reset to system default (i.e., the entry point used by + * docker when there is no `ENTRYPOINT` instruction in the `Dockerfile`). + * @example + */ + Entrypoint?: readonly string[]; + NetworkDisabled?: boolean | null; + MacAddress?: string; + /** + * `ONBUILD` metadata that were defined in the image's `Dockerfile`. + * @example + */ + OnBuild?: readonly string[]; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * Signal to stop a container as a string or unsigned integer. + * @example SIGTERM + */ + StopSignal?: string; + StopTimeout?: number | null; + /** + * Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell. + * @example /bin/sh,-c + */ + Shell?: readonly string[]; + }; + /** + * The version of Docker that was used to build the image. + * + * Depending on how the image was created, this field may be empty. + * @example 20.10.7 + */ + DockerVersion?: string; + /** + * Name of the author that was specified when committing the image, or as + * specified through MAINTAINER (deprecated) in the Dockerfile. + * @example + */ + Author?: string; + /** + * Configuration of the image. These fields are used as defaults + * when starting a container from the image. + * @example [object Object] + */ + Config?: { + /** + * The hostname to use for the container, as a valid RFC 1123 hostname. + * + *


+ * + * > **Note**: this field is always empty and must not be used. + * @example + */ + Hostname?: string; + /** + * The domain name to use for the container. + * + *


+ * + * > **Note**: this field is always empty and must not be used. + * @example + */ + Domainname?: string; + /** + * The user that commands are run as inside the container. + * @example web:web + */ + User?: string; + /** + * Whether to attach to `stdin`. + * + *


+ * + * > **Note**: this field is always false and must not be used. + * @example false + */ + AttachStdin?: boolean; + /** + * Whether to attach to `stdout`. + * + *


+ * + * > **Note**: this field is always false and must not be used. + * @example false + */ + AttachStdout?: boolean; + /** + * Whether to attach to `stderr`. + * + *


+ * + * > **Note**: this field is always false and must not be used. + * @example false + */ + AttachStderr?: boolean; + ExposedPorts?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * Attach standard streams to a TTY, including `stdin` if it is not closed. + * + *


+ * + * > **Note**: this field is always false and must not be used. + * @example false + */ + Tty?: boolean; + /** + * Open `stdin` + * + *


+ * + * > **Note**: this field is always false and must not be used. + * @example false + */ + OpenStdin?: boolean; + /** + * Close `stdin` after one attached client disconnects. + * + *


+ * + * > **Note**: this field is always false and must not be used. + * @example false + */ + StdinOnce?: boolean; + /** + * A list of environment variables to set inside the container in the + * form `["VAR=value", ...]`. A variable without `=` is removed from the + * environment, rather than to have an empty value. + * @example PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + */ + Env?: readonly string[]; + /** + * Command to run specified as a string or an array of strings. + * @example /bin/sh + */ + Cmd?: readonly string[]; + Healthcheck?: { + Test?: readonly string[]; + Interval?: number; + Timeout?: number; + Retries?: number; + StartPeriod?: number; + }; + /** + * Command is already escaped (Windows only) + * @example false + */ + ArgsEscaped?: boolean | null; + /** + * The name (or reference) of the image to use when creating the container, + * or which was used when the container was created. + * + *


+ * + * > **Note**: this field is always empty and must not be used. + * @example + */ + Image?: string; + Volumes?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * The working directory for commands to run in. + * @example /public/ + */ + WorkingDir?: string; + /** + * The entry point for the container as a string or an array of strings. + * + * If the array consists of exactly one empty string (`[""]`) then the + * entry point is reset to system default (i.e., the entry point used by + * docker when there is no `ENTRYPOINT` instruction in the `Dockerfile`). + * @example + */ + Entrypoint?: readonly string[]; + /** + * Disable networking for the container. + * + *


+ * + * > **Note**: this field is always omitted and must not be used. + * @example false + */ + NetworkDisabled?: boolean | null; + /** + * MAC address of the container. + * + *


+ * + * > **Note**: this field is always omitted and must not be used. + * @example + */ + MacAddress?: string; + /** + * `ONBUILD` metadata that were defined in the image's `Dockerfile`. + * @example + */ + OnBuild?: readonly string[]; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * Signal to stop a container as a string or unsigned integer. + * @example SIGTERM + */ + StopSignal?: string; + StopTimeout?: number | null; + /** + * Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell. + * @example /bin/sh,-c + */ + Shell?: readonly string[]; + }; + /** + * Hardware CPU architecture that the image runs on. + * @example arm + */ + Architecture?: string; + /** + * CPU architecture variant (presently ARM-only). + * @example v7 + */ + Variant?: string; + /** + * Operating System the image is built to run on. + * @example linux + */ + Os?: string; + /** + * Operating System version the image is built to run on (especially + * for Windows). + * @example + */ + OsVersion?: string; + /** + * Total size of the image including all layers it is composed of. + * @example 1239828 + */ + Size?: number; + /** + * Total size of the image including all layers it is composed of. + * + * In versions of Docker before v1.10, this field was calculated from + * the image itself and all of its parent images. Images are now stored + * self-contained, and no longer use a parent-chain, making this field + * an equivalent of the Size field. + * + * > **Deprecated**: this field is kept for backward compatibility, but + * > will be removed in API v1.44. + * @example 1239828 + */ + VirtualSize?: number; + GraphDriver?: { + /** + * Name of the storage driver. + * @example overlay2 + */ + Name: string; + Data: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + RootFS?: { + Type: string; + Layers?: readonly string[]; + }; + Metadata?: { + /** + * Date and time at which the image was last tagged in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * + * This information is only available if the image was tagged locally, + * and omitted otherwise. + * @example 2022-02-28T14:40:02.623929178Z + */ + LastTagTime?: string; + }; +}; +export type ImageHistoryCommandParams = { + name: string; +}; +export type ImageHistoryCommandInput = ImageHistoryCommandParams; +export type ImageHistoryCommandOutput = readonly { + Id: string; + Created: number; + CreatedBy: string; + Tags: readonly string[]; + Size: number; + Comment: string; +}[]; +export type ImagePushCommandQuery = { + tag?: string | undefined; +}; +export type ImagePushCommandParams = { + name: string; +}; +export type ImagePushCommandInput = ImagePushCommandParams & + ImagePushCommandQuery; +export type ImageTagCommandQuery = { + repo?: string | undefined; + tag?: string | undefined; +}; +export type ImageTagCommandParams = { + name: string; +}; +export type ImageTagCommandInput = ImageTagCommandParams & ImageTagCommandQuery; +export type ImageDeleteCommandQuery = { + force?: "true" | "false"; + noprune?: "true" | "false"; +}; +export type ImageDeleteCommandParams = { + name: string; +}; +export type ImageDeleteCommandInput = ImageDeleteCommandParams & + ImageDeleteCommandQuery; +export type ImageDeleteCommandOutput = readonly { + Untagged?: string; + Deleted?: string; +}[]; +export type ImageSearchCommandQuery = { + term: string; + limit?: `${number}` | undefined; + filters?: string | undefined; +}; +export type ImageSearchCommandInput = ImageSearchCommandQuery; +export type ImageSearchCommandOutput = readonly { + description?: string; + is_official?: boolean; + is_automated?: boolean; + name?: string; + star_count?: number; +}[]; +export type ImagePruneCommandQuery = { + filters?: string | undefined; +}; +export type ImagePruneCommandInput = ImagePruneCommandQuery; +export type ImagePruneCommandOutput = { + ImagesDeleted?: readonly { + Untagged?: string; + Deleted?: string; + }[]; + SpaceReclaimed?: number; +}; +type SystemAuthJsonBody = { + username?: string; + password?: string; + email?: string; + serveraddress?: string; +}; +export type SystemAuthCommandBody = SystemAuthJsonBody; +export type SystemAuthCommandInput = SystemAuthJsonBody; +export type SystemAuthCommandOutput = { + Status: string; + IdentityToken?: string; +}; +export type SystemInfoCommandInput = never; +export type SystemInfoCommandOutput = { + /** + * Unique identifier of the daemon. + * + *


+ * + * > **Note**: The format of the ID itself is not part of the API, and + * > should not be considered stable. + * @example 7TRN:IPZB:QYBB:VPBQ:UMPP:KARE:6ZNR:XE6T:7EWV:PKF4:ZOJD:TPYS + */ + ID?: string; + /** + * Total number of containers on the host. + * @example 14 + */ + Containers?: number; + /** + * Number of containers with status `"running"`. + * @example 3 + */ + ContainersRunning?: number; + /** + * Number of containers with status `"paused"`. + * @example 1 + */ + ContainersPaused?: number; + /** + * Number of containers with status `"stopped"`. + * @example 10 + */ + ContainersStopped?: number; + /** + * Total number of images on the host. + * + * Both _tagged_ and _untagged_ (dangling) images are counted. + * @example 508 + */ + Images?: number; + /** + * Name of the storage driver in use. + * @example overlay2 + */ + Driver?: string; + /** + * Information specific to the storage driver, provided as + * "label" / "value" pairs. + * + * This information is provided by the storage driver, and formatted + * in a way consistent with the output of `docker info` on the command + * line. + * + *


+ * + * > **Note**: The information returned in this field, including the + * > formatting of values and labels, should not be considered stable, + * > and may change without notice. + * @example Backing Filesystem,extfs,Supports d_type,true,Native Overlay Diff,true + */ + DriverStatus?: readonly (readonly string[])[]; + /** + * Root directory of persistent Docker state. + * + * Defaults to `/var/lib/docker` on Linux, and `C:\ProgramData\docker` + * on Windows. + * @example /var/lib/docker + */ + DockerRootDir?: string; + Plugins?: { + /** + * Names of available volume-drivers, and network-driver plugins. + * @example local + */ + Volume?: readonly string[]; + /** + * Names of available network-drivers, and network-driver plugins. + * @example bridge,host,ipvlan,macvlan,null,overlay + */ + Network?: readonly string[]; + /** + * Names of available authorization plugins. + * @example img-authz-plugin,hbm + */ + Authorization?: readonly string[]; + /** + * Names of available logging-drivers, and logging-driver plugins. + * @example awslogs,fluentd,gcplogs,gelf,journald,json-file,splunk,syslog + */ + Log?: readonly string[]; + }; + /** + * Indicates if the host has memory limit support enabled. + * @example true + */ + MemoryLimit?: boolean; + /** + * Indicates if the host has memory swap limit support enabled. + * @example true + */ + SwapLimit?: boolean; + /** + * Indicates if the host has kernel memory TCP limit support enabled. This + * field is omitted if not supported. + * + * Kernel memory TCP limits are not supported when using cgroups v2, which + * does not support the corresponding `memory.kmem.tcp.limit_in_bytes` cgroup. + * @example true + */ + KernelMemoryTCP?: boolean; + /** + * Indicates if CPU CFS(Completely Fair Scheduler) period is supported by + * the host. + * @example true + */ + CpuCfsPeriod?: boolean; + /** + * Indicates if CPU CFS(Completely Fair Scheduler) quota is supported by + * the host. + * @example true + */ + CpuCfsQuota?: boolean; + /** + * Indicates if CPU Shares limiting is supported by the host. + * @example true + */ + CPUShares?: boolean; + /** + * Indicates if CPUsets (cpuset.cpus, cpuset.mems) are supported by the host. + * + * See + * [cpuset(7)](https://www.kernel.org/doc/Documentation/cgroup-v1/cpusets.txt) + * @example true + */ + CPUSet?: boolean; + /** + * Indicates if the host kernel has PID limit support enabled. + * @example true + */ + PidsLimit?: boolean; + OomKillDisable?: boolean; + /** + * Indicates IPv4 forwarding is enabled. + * @example true + */ + IPv4Forwarding?: boolean; + /** + * Indicates if `bridge-nf-call-iptables` is available on the host. + * @example true + */ + BridgeNfIptables?: boolean; + /** + * Indicates if `bridge-nf-call-ip6tables` is available on the host. + * @example true + */ + BridgeNfIp6tables?: boolean; + /** + * Indicates if the daemon is running in debug-mode / with debug-level + * logging enabled. + * @example true + */ + Debug?: boolean; + /** + * The total number of file Descriptors in use by the daemon process. + * + * This information is only returned if debug-mode is enabled. + * @example 64 + */ + NFd?: number; + /** + * The number of goroutines that currently exist. + * + * This information is only returned if debug-mode is enabled. + * @example 174 + */ + NGoroutines?: number; + /** + * Current system-time in [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) + * format with nano-seconds. + * @example 2017-08-08T20:28:29.06202363Z + */ + SystemTime?: string; + LoggingDriver?: string; + /** + * The driver to use for managing cgroups. + * @default cgroupfs + * @enum cgroupfs,systemd,none + * @example cgroupfs + */ + CgroupDriver?: "cgroupfs" | "systemd" | "none"; + /** + * The version of the cgroup. + * @default 1 + * @enum 1,2 + * @example 1 + */ + CgroupVersion?: "1" | "2"; + /** + * Number of event listeners subscribed. + * @example 30 + */ + NEventsListener?: number; + /** + * Kernel version of the host. + * + * On Linux, this information obtained from `uname`. On Windows this + * information is queried from the + * HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows + * NT\\CurrentVersion\\ + * registry value, for example _"10.0 14393 + * (14393.1198.amd64fre.rs1_release_sec.170427-1353)"_. + * @example 4.9.38-moby + */ + KernelVersion?: string; + /** + * Name of the host's operating system, for example: "Ubuntu 16.04.2 LTS" + * or "Windows Server 2016 Datacenter" + * @example Alpine Linux v3.5 + */ + OperatingSystem?: string; + /** + * Version of the host's operating system + * + *


+ * + * > **Note**: The information returned in this field, including its + * > very existence, and the formatting of values, should not be considered + * > stable, and may change without notice. + * @example 16.04 + */ + OSVersion?: string; + /** + * Generic type of the operating system of the host, as returned by the + * Go runtime (`GOOS`). + * + * Currently returned values are "linux" and "windows". A full list of + * possible values can be found in the [Go + * documentation](https://go.dev/doc/install/source#environment). + * @example linux + */ + OSType?: string; + /** + * Hardware architecture of the host, as returned by the Go runtime + * (`GOARCH`). + * + * A full list of possible values can be found in the [Go + * documentation](https://go.dev/doc/install/source#environment). + * @example x86_64 + */ + Architecture?: string; + /** + * The number of logical CPUs usable by the daemon. + * + * The number of available CPUs is checked by querying the operating + * system when the daemon starts. Changes to operating system CPU + * allocation after the daemon is started are not reflected. + * @example 4 + */ + NCPU?: number; + /** + * Total amount of physical memory available on the host, in bytes. + * @example 2095882240 + */ + MemTotal?: number; + /** + * Address / URL of the index server that is used for image search, + * and as a default for user authentication for Docker Hub and Docker Cloud. + * @default https://index.docker.io/v1/ + * @example https://index.docker.io/v1/ + */ + IndexServerAddress?: string; + RegistryConfig?: { + /** + * List of IP ranges to which nondistributable artifacts can be pushed, + * using the CIDR syntax [RFC 4632](https://tools.ietf.org/html/4632). + * + * Some images (for example, Windows base images) contain artifacts + * whose distribution is restricted by license. When these images are + * pushed to a registry, restricted artifacts are not included. + * + * This configuration override this behavior, and enables the daemon to + * push nondistributable artifacts to all registries whose resolved IP + * address is within the subnet described by the CIDR syntax. + * + * This option is useful when pushing images containing + * nondistributable artifacts to a registry on an air-gapped network so + * hosts on that network can pull the images without connecting to + * another server. + * + * > **Warning**: Nondistributable artifacts typically have restrictions + * > on how and where they can be distributed and shared. Only use this + * > feature to push artifacts to private registries and ensure that you + * > are in compliance with any terms that cover redistributing + * > nondistributable artifacts. + * @example ::1/128,127.0.0.0/8 + */ + AllowNondistributableArtifactsCIDRs?: readonly string[]; + /** + * List of registry hostnames to which nondistributable artifacts can be + * pushed, using the format `[:]` or `[:]`. + * + * Some images (for example, Windows base images) contain artifacts + * whose distribution is restricted by license. When these images are + * pushed to a registry, restricted artifacts are not included. + * + * This configuration override this behavior for the specified + * registries. + * + * This option is useful when pushing images containing + * nondistributable artifacts to a registry on an air-gapped network so + * hosts on that network can pull the images without connecting to + * another server. + * + * > **Warning**: Nondistributable artifacts typically have restrictions + * > on how and where they can be distributed and shared. Only use this + * > feature to push artifacts to private registries and ensure that you + * > are in compliance with any terms that cover redistributing + * > nondistributable artifacts. + * @example registry.internal.corp.example.com:3000,[2001:db8:a0b:12f0::1]:443 + */ + AllowNondistributableArtifactsHostnames?: readonly string[]; + /** + * List of IP ranges of insecure registries, using the CIDR syntax + * ([RFC 4632](https://tools.ietf.org/html/4632)). Insecure registries + * accept un-encrypted (HTTP) and/or untrusted (HTTPS with certificates + * from unknown CAs) communication. + * + * By default, local registries (`127.0.0.0/8`) are configured as + * insecure. All other registries are secure. Communicating with an + * insecure registry is not possible if the daemon assumes that registry + * is secure. + * + * This configuration override this behavior, insecure communication with + * registries whose resolved IP address is within the subnet described by + * the CIDR syntax. + * + * Registries can also be marked insecure by hostname. Those registries + * are listed under `IndexConfigs` and have their `Secure` field set to + * `false`. + * + * > **Warning**: Using this option can be useful when running a local + * > registry, but introduces security vulnerabilities. This option + * > should therefore ONLY be used for testing purposes. For increased + * > security, users should add their CA to their system's list of trusted + * > CAs instead of enabling this option. + * @example ::1/128,127.0.0.0/8 + */ + InsecureRegistryCIDRs?: readonly string[]; + IndexConfigs?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * List of registry URLs that act as a mirror for the official + * (`docker.io`) registry. + * @example https://hub-mirror.corp.example.com:5000/,https://[2001:db8:a0b:12f0::1]/ + */ + Mirrors?: readonly string[]; + }; + /** + * User-defined resources can be either Integer resources (e.g, `SSD=3`) or + * String resources (e.g, `GPU=UUID1`). + * @example [object Object],[object Object],[object Object] + */ + GenericResources?: readonly { + NamedResourceSpec?: { + Kind?: string; + Value?: string; + }; + DiscreteResourceSpec?: { + Kind?: string; + Value?: number; + }; + }[]; + /** + * HTTP-proxy configured for the daemon. This value is obtained from the + * [`HTTP_PROXY`](https://www.gnu.org/software/wget/manual/html_node/Proxies.html) + * environment variable. + * Credentials ([user info + * component](https://tools.ietf.org/html/rfc3986#section-3.2.1)) in the proxy + * URL + * are masked in the API response. + * + * Containers do not automatically inherit this configuration. + * @example http://xxxxx:xxxxx@proxy.corp.example.com:8080 + */ + HttpProxy?: string; + /** + * HTTPS-proxy configured for the daemon. This value is obtained from the + * [`HTTPS_PROXY`](https://www.gnu.org/software/wget/manual/html_node/Proxies.html) + * environment variable. + * Credentials ([user info + * component](https://tools.ietf.org/html/rfc3986#section-3.2.1)) in the proxy + * URL + * are masked in the API response. + * + * Containers do not automatically inherit this configuration. + * @example https://xxxxx:xxxxx@proxy.corp.example.com:4443 + */ + HttpsProxy?: string; + /** + * Comma-separated list of domain extensions for which no proxy should be + * used. This value is obtained from the + * [`NO_PROXY`](https://www.gnu.org/software/wget/manual/html_node/Proxies.html) + * environment variable. + * + * Containers do not automatically inherit this configuration. + * @example *.local, 169.254/16 + */ + NoProxy?: string; + /** + * Hostname of the host. + * @example node5.corp.example.com + */ + Name?: string; + /** + * User-defined labels (key/value metadata) as set on the daemon. + * + *


+ * + * > **Note**: When part of a Swarm, nodes can both have _daemon_ labels, + * > set through the daemon configuration, and _node_ labels, set from a + * > manager node in the Swarm. Node labels are not included in this + * > field. Node labels can be retrieved using the `/nodes/(id)` endpoint + * > on a manager node in the Swarm. + * @example storage=ssd,production + */ + Labels?: readonly string[]; + /** + * Indicates if experimental features are enabled on the daemon. + * @example true + */ + ExperimentalBuild?: boolean; + /** + * Version string of the daemon. + * @example 24.0.2 + */ + ServerVersion?: string; + Runtimes?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * Name of the default OCI runtime that is used when starting containers. + * + * The default can be overridden per-container at create time. + * @default runc + * @example runc + */ + DefaultRuntime?: string; + Swarm?: { + /** + * Unique identifier of for this node in the swarm. + * @example k67qz4598weg5unwwffg6z1m1 + */ + NodeID?: string; + /** + * IP address at which this node can be reached by other nodes in the + * swarm. + * @example 10.0.0.46 + */ + NodeAddr?: string; + /** + * Current local status of this node. + * @enum ,inactive,pending,active,error,locked + * @example active + */ + LocalNodeState?: + | "" + | "inactive" + | "pending" + | "active" + | "error" + | "locked"; + ControlAvailable?: boolean; + Error?: string; + /** + * List of ID's and addresses of other managers in the swarm. + * @example [object Object],[object Object],[object Object] + */ + RemoteManagers?: readonly { + NodeID?: string; + Addr?: string; + }[]; + /** + * Total number of nodes in the swarm. + * @example 4 + */ + Nodes?: number | null; + /** + * Total number of managers in the swarm. + * @example 3 + */ + Managers?: number | null; + Cluster?: { + /** + * The ID of the swarm. + * @example abajmipo7b4xz5ip2nrla6b11 + */ + ID?: string; + Version?: { + Index?: number; + }; + /** + * Date and time at which the swarm was initialised in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2016-08-18T10:44:24.496525531Z + */ + CreatedAt?: string; + /** + * Date and time at which the swarm was last updated in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2017-08-09T07:09:37.632105588Z + */ + UpdatedAt?: string; + Spec?: { + /** + * Name of the swarm. + * @example default + */ + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Orchestration?: { + /** + * The number of historic tasks to keep per instance or node. If + * negative, never remove completed or failed tasks. + * @example 10 + */ + TaskHistoryRetentionLimit?: number; + }; + Raft?: { + /** + * The number of log entries between snapshots. + * @example 10000 + */ + SnapshotInterval?: number; + KeepOldSnapshots?: number; + /** + * The number of log entries to keep around to sync up slow followers + * after a snapshot is created. + * @example 500 + */ + LogEntriesForSlowFollowers?: number; + /** + * The number of ticks that a follower will wait for a message from + * the leader before becoming a candidate and starting an election. + * `ElectionTick` must be greater than `HeartbeatTick`. + * + * A tick currently defaults to one second, so these translate + * directly to seconds currently, but this is NOT guaranteed. + * @example 3 + */ + ElectionTick?: number; + /** + * The number of ticks between heartbeats. Every HeartbeatTick ticks, + * the leader will send a heartbeat to the followers. + * + * A tick currently defaults to one second, so these translate + * directly to seconds currently, but this is NOT guaranteed. + * @example 1 + */ + HeartbeatTick?: number; + }; + Dispatcher?: { + /** + * The delay for an agent to send a heartbeat to the dispatcher. + * @example 5000000000 + */ + HeartbeatPeriod?: number; + }; + CAConfig?: { + /** + * The duration node certificates are issued for. + * @example 7776000000000000 + */ + NodeCertExpiry?: number; + ExternalCAs?: readonly { + /** + * Protocol for communication with the external CA (currently + * only `cfssl` is supported). + * @default cfssl + * @enum cfssl + */ + Protocol?: "cfssl"; + URL?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + CACert?: string; + }[]; + SigningCACert?: string; + SigningCAKey?: string; + ForceRotate?: number; + }; + EncryptionConfig?: { + /** + * If set, generate a key and use it to lock data stored on the + * managers. + * @example false + */ + AutoLockManagers?: boolean; + }; + TaskDefaults?: { + LogDriver?: { + /** + * The log driver to use as a default for new tasks. + * @example json-file + */ + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; + }; + /** + * Information about the issuer of leaf TLS certificates and the trusted root + * CA certificate. + * @example [object Object] + */ + TLSInfo?: { + TrustRoot?: string; + CertIssuerSubject?: string; + CertIssuerPublicKey?: string; + }; + /** + * Whether there is currently a root CA rotation in progress for the swarm + * @example false + */ + RootRotationInProgress?: boolean; + /** + * DataPathPort specifies the data path port number for data traffic. + * Acceptable port range is 1024 to 49151. + * If no port is set or is set to 0, the default port (4789) is used. + * @example 4789 + */ + DataPathPort?: number; + DefaultAddrPool?: readonly string[]; + /** + * SubnetSize specifies the subnet size of the networks created from the + * default subnet pool. + * @example 24 + */ + SubnetSize?: number; + }; + }; + /** + * Indicates if live restore is enabled. + * + * If enabled, containers are kept running when the daemon is shutdown + * or upon daemon start if running containers are detected. + * @example false + */ + LiveRestoreEnabled?: boolean; + /** + * Represents the isolation technology to use as a default for containers. + * The supported values are platform-specific. + * + * If no isolation value is specified on daemon start, on Windows client, + * the default is `hyperv`, and on Windows server, the default is `process`. + * + * This option is currently not used on other platforms. + * @default default + * @enum default,hyperv,process, + */ + Isolation?: "default" | "hyperv" | "process" | ""; + /** + * Name and, optional, path of the `docker-init` binary. + * + * If the path is omitted, the daemon searches the host's `$PATH` for the + * binary and uses the first result. + * @example docker-init + */ + InitBinary?: string; + ContainerdCommit?: { + /** + * Actual commit ID of external tool. + * @example cfb82a876ecc11b5ca0977d1733adbe58599088a + */ + ID?: string; + /** + * Commit ID of external tool expected by dockerd as set at build time. + * @example 2d41c047c83e09a6d61d464906feb2a2f3c52aa4 + */ + Expected?: string; + }; + RuncCommit?: { + /** + * Actual commit ID of external tool. + * @example cfb82a876ecc11b5ca0977d1733adbe58599088a + */ + ID?: string; + /** + * Commit ID of external tool expected by dockerd as set at build time. + * @example 2d41c047c83e09a6d61d464906feb2a2f3c52aa4 + */ + Expected?: string; + }; + InitCommit?: { + /** + * Actual commit ID of external tool. + * @example cfb82a876ecc11b5ca0977d1733adbe58599088a + */ + ID?: string; + /** + * Commit ID of external tool expected by dockerd as set at build time. + * @example 2d41c047c83e09a6d61d464906feb2a2f3c52aa4 + */ + Expected?: string; + }; + /** + * List of security features that are enabled on the daemon, such as + * apparmor, seccomp, SELinux, user-namespaces (userns), rootless and + * no-new-privileges. + * + * Additional configuration options for each security feature may + * be present, and are included as a comma-separated list of key/value + * pairs. + * @example name=apparmor,name=seccomp,profile=default,name=selinux,name=userns,name=rootless + */ + SecurityOptions?: readonly string[]; + /** + * Reports a summary of the product license on the daemon. + * + * If a commercial license has been applied to the daemon, information + * such as number of nodes, and expiration are included. + * @example Community Engine + */ + ProductLicense?: string; + DefaultAddressPools?: readonly { + /** + * The network address in CIDR format + * @example 10.10.0.0/16 + */ + Base?: string; + /** + * The network pool size + * @example 24 + */ + Size?: number; + }[]; + /** + * List of warnings / informational messages about missing features, or + * issues related to the daemon configuration. + * + * These messages can be printed by the client as information to the user. + * @example WARNING: No memory limit support + */ + Warnings?: readonly string[]; +}; +export type SystemVersionCommandInput = never; +export type SystemVersionCommandOutput = { + Platform?: { + Name: string; + }; + Components?: readonly { + /** + * Name of the component + * @example Engine + */ + Name: string; + /** + * Version of the component + * @example 19.03.12 + */ + Version: string; + Details?: {}; + }[]; + /** + * The version of the daemon + * @example 19.03.12 + */ + Version?: string; + /** + * The default (and highest) API version that is supported by the daemon + * @example 1.40 + */ + ApiVersion?: string; + /** + * The minimum API version that is supported by the daemon + * @example 1.12 + */ + MinAPIVersion?: string; + /** + * The Git commit of the source code that was used to build the daemon + * @example 48a66213fe + */ + GitCommit?: string; + /** + * The version Go used to compile the daemon, and the version of the Go + * runtime in use. + * @example go1.13.14 + */ + GoVersion?: string; + /** + * The operating system that the daemon is running on ("linux" or "windows") + * @example linux + */ + Os?: string; + /** + * The architecture that the daemon is running on + * @example amd64 + */ + Arch?: string; + /** + * The kernel version (`uname -r`) that the daemon is running on. + * + * This field is omitted when empty. + * @example 4.19.76-linuxkit + */ + KernelVersion?: string; + /** + * Indicates if the daemon is started with experimental features enabled. + * + * This field is omitted when empty / false. + * @example true + */ + Experimental?: boolean; + /** + * The date and time that the daemon was compiled. + * @example 2020-06-22T15:49:27.000000000+00:00 + */ + BuildTime?: string; +}; +export type SystemPingCommandInput = never; +export type SystemPingHeadCommandInput = never; +export type ImageCommitCommandQuery = { + container?: string | undefined; + repo?: string | undefined; + tag?: string | undefined; + comment?: string | undefined; + author?: string | undefined; + pause?: "true" | "false"; + changes?: string | undefined; +}; +type ImageCommitJsonBody = { + /** + * The hostname to use for the container, as a valid RFC 1123 hostname. + * @example 439f4e91bd1d + */ + Hostname?: string; + Domainname?: string; + User?: string; + AttachStdin?: boolean; + /** + * Whether to attach to `stdout`. + * @default true + */ + AttachStdout?: boolean; + /** + * Whether to attach to `stderr`. + * @default true + */ + AttachStderr?: boolean; + ExposedPorts?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Tty?: boolean; + OpenStdin?: boolean; + StdinOnce?: boolean; + /** + * A list of environment variables to set inside the container in the + * form `["VAR=value", ...]`. A variable without `=` is removed from the + * environment, rather than to have an empty value. + * @example PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + */ + Env?: readonly string[]; + /** + * Command to run specified as a string or an array of strings. + * @example /bin/sh + */ + Cmd?: readonly string[]; + Healthcheck?: { + Test?: readonly string[]; + Interval?: number; + Timeout?: number; + Retries?: number; + StartPeriod?: number; + }; + /** + * Command is already escaped (Windows only) + * @example false + */ + ArgsEscaped?: boolean | null; + /** + * The name (or reference) of the image to use when creating the container, + * or which was used when the container was created. + * @example example-image:1.0 + */ + Image?: string; + Volumes?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * The working directory for commands to run in. + * @example /public/ + */ + WorkingDir?: string; + /** + * The entry point for the container as a string or an array of strings. + * + * If the array consists of exactly one empty string (`[""]`) then the + * entry point is reset to system default (i.e., the entry point used by + * docker when there is no `ENTRYPOINT` instruction in the `Dockerfile`). + * @example + */ + Entrypoint?: readonly string[]; + NetworkDisabled?: boolean | null; + MacAddress?: string; + /** + * `ONBUILD` metadata that were defined in the image's `Dockerfile`. + * @example + */ + OnBuild?: readonly string[]; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * Signal to stop a container as a string or unsigned integer. + * @example SIGTERM + */ + StopSignal?: string; + StopTimeout?: number | null; + /** + * Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell. + * @example /bin/sh,-c + */ + Shell?: readonly string[]; +}; +export type ImageCommitCommandBody = ImageCommitJsonBody; +export type ImageCommitCommandInput = ImageCommitJsonBody & + ImageCommitCommandQuery; +export type ImageCommitCommandOutput = { + Id: string; +}; +export type SystemEventsCommandQuery = { + since?: string | undefined; + until?: string | undefined; + filters?: string | undefined; +}; +export type SystemEventsCommandInput = SystemEventsCommandQuery; +export type SystemEventsCommandOutput = { + /** + * The type of object emitting the event + * @enum builder,config,container,daemon,image,network,node,plugin,secret,service,volume + * @example container + */ + Type?: + | "builder" + | "config" + | "container" + | "daemon" + | "image" + | "network" + | "node" + | "plugin" + | "secret" + | "service" + | "volume"; + /** + * The type of event + * @example create + */ + Action?: string; + Actor?: { + /** + * The ID of the object emitting the event + * @example ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743 + */ + ID?: string; + Attributes?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + /** + * Scope of the event. Engine events are `local` scope. Cluster (Swarm) + * events are `swarm` scope. + * @enum local,swarm + */ + scope?: "local" | "swarm"; + /** + * Timestamp of event + * @example 1629574695 + */ + time?: number; + /** + * Timestamp of event, with nanosecond accuracy + * @example 1629574695515050000 + */ + timeNano?: number; +}; +export type SystemDataUsageCommandQuery = { + type?: readonly ("container" | "image" | "volume" | "build-cache")[]; +}; +export type SystemDataUsageCommandInput = SystemDataUsageCommandQuery; +export type SystemDataUsageCommandOutput = { + LayersSize?: number; + Images?: readonly { + /** + * ID is the content-addressable ID of an image. + * + * This identifier is a content-addressable digest calculated from the + * image's configuration (which includes the digests of layers used by + * the image). + * + * Note that this digest differs from the `RepoDigests` below, which + * holds digests of image manifests that reference the image. + * @example sha256:ec3f0931a6e6b6855d76b2d7b0be30e81860baccd891b2e243280bf1cd8ad710 + */ + Id: string; + /** + * ID of the parent image. + * + * Depending on how the image was created, this field may be empty and + * is only set for images that were built/created locally. This field + * is empty if the image was pulled from an image registry. + * @example + */ + ParentId: string; + /** + * List of image names/tags in the local image cache that reference this + * image. + * + * Multiple image tags can refer to the same image, and this list may be + * empty if no tags reference the image, in which case the image is + * "untagged", in which case it can still be referenced by its ID. + * @example example:1.0,example:latest,example:stable,internal.registry.example.com:5000/example:1.0 + */ + RepoTags: readonly string[]; + /** + * List of content-addressable digests of locally available image manifests + * that the image is referenced from. Multiple manifests can refer to the + * same image. + * + * These digests are usually only available if the image was either pulled + * from a registry, or if the image was pushed to a registry, which is when + * the manifest is generated and its digest calculated. + * @example example@sha256:afcc7f1ac1b49db317a7196c902e61c6c3c4607d63599ee1a82d702d249a0ccb,internal.registry.example.com:5000/example@sha256:b69959407d21e8a062e0416bf13405bb2b71ed7a84dde4158ebafacfa06f5578 + */ + RepoDigests: readonly string[]; + /** + * Date and time at which the image was created as a Unix timestamp + * (number of seconds since EPOCH). + * @example 1644009612 + */ + Created: number; + /** + * Total size of the image including all layers it is composed of. + * @example 172064416 + */ + Size: number; + /** + * Total size of image layers that are shared between this image and other + * images. + * + * This size is not calculated by default. `-1` indicates that the value + * has not been set / calculated. + * @example 1239828 + */ + SharedSize: number; + /** + * Total size of the image including all layers it is composed of. + * + * In versions of Docker before v1.10, this field was calculated from + * the image itself and all of its parent images. Images are now stored + * self-contained, and no longer use a parent-chain, making this field + * an equivalent of the Size field. + * + * Deprecated: this field is kept for backward compatibility, and will be + * removed in API v1.44. + * @example 172064416 + */ + VirtualSize?: number; + Labels: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * Number of containers using this image. Includes both stopped and running + * containers. + * + * This size is not calculated by default, and depends on which API endpoint + * is used. `-1` indicates that the value has not been set / calculated. + * @example 2 + */ + Containers: number; + }[]; + Containers?: readonly { + Id?: string; + Names?: readonly string[]; + Image?: string; + ImageID?: string; + Command?: string; + Created?: number; + Ports?: readonly { + IP?: string; + PrivatePort: number; + PublicPort?: number; + Type: "tcp" | "udp" | "sctp"; + }[]; + SizeRw?: number; + SizeRootFs?: number; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + State?: string; + Status?: string; + HostConfig?: { + NetworkMode?: string; + }; + NetworkSettings?: { + Networks?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + Mounts?: readonly { + /** + * The mount type: + * + * - `bind` a mount of a file or directory from the host into the container. + * - `volume` a docker volume with the given `Name`. + * - `tmpfs` a `tmpfs`. + * - `npipe` a named pipe from the host into the container. + * - `cluster` a Swarm cluster volume + * @enum bind,volume,tmpfs,npipe,cluster + * @example volume + */ + Type?: "bind" | "volume" | "tmpfs" | "npipe" | "cluster"; + /** + * Name is the name reference to the underlying data defined by `Source` + * e.g., the volume name. + * @example myvolume + */ + Name?: string; + /** + * Source location of the mount. + * + * For volumes, this contains the storage location of the volume (within + * `/var/lib/docker/volumes/`). For bind-mounts, and `npipe`, this contains + * the source (host) part of the bind-mount. For `tmpfs` mount points, this + * field is empty. + * @example /var/lib/docker/volumes/myvolume/_data + */ + Source?: string; + /** + * Destination is the path relative to the container root (`/`) where + * the `Source` is mounted inside the container. + * @example /usr/share/nginx/html/ + */ + Destination?: string; + /** + * Driver is the volume driver used to create the volume (if it is a volume). + * @example local + */ + Driver?: string; + /** + * Mode is a comma separated list of options supplied by the user when + * creating the bind/volume mount. + * + * The default is platform-specific (`"z"` on Linux, empty on Windows). + * @example z + */ + Mode?: string; + /** + * Whether the mount is mounted writable (read-write). + * @example true + */ + RW?: boolean; + /** + * Propagation describes how mounts are propagated from the host into the + * mount point, and vice-versa. Refer to the [Linux kernel + * documentation](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt) + * for details. This field is not used on Windows. + * @example + */ + Propagation?: string; + }[]; + }[]; + Volumes?: readonly { + /** + * Name of the volume. + * @example tardis + */ + Name: string; + /** + * Name of the volume driver used by the volume. + * @example custom + */ + Driver: string; + /** + * Mount path of the volume on the host. + * @example /var/lib/docker/volumes/tardis + */ + Mountpoint: string; + /** + * Date/Time the volume was created. + * @example 2016-06-07T20:31:11.853781916Z + */ + CreatedAt?: string; + Status?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Labels: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * The level at which the volume exists. Either `global` for cluster-wide, + * or `local` for machine level. + * @default local + * @enum local,global + * @example local + */ + Scope: "local" | "global"; + ClusterVolume?: { + ID?: string; + Version?: { + Index?: number; + }; + CreatedAt?: string; + UpdatedAt?: string; + Spec?: { + Group?: string; + AccessMode?: { + /** + * The set of nodes this volume can be used on at one time. + * - `single` The volume may only be scheduled to one node at a time. + * - `multi` the volume may be scheduled to any supported number of nodes at a + * time. + * @default single + * @enum single,multi + */ + Scope?: "single" | "multi"; + /** + * The number and way that different tasks can use this volume + * at one time. + * - `none` The volume may only be used by one task at a time. + * - `readonly` The volume may be used by any number of tasks, but they all + * must mount the volume as readonly + * - `onewriter` The volume may be used by any number of tasks, but only one + * may mount it as read/write. + * - `all` The volume may have any number of readers and writers. + * @default none + * @enum none,readonly,onewriter,all + */ + Sharing?: "none" | "readonly" | "onewriter" | "all"; + MountVolume?: {}; + Secrets?: readonly { + Key?: string; + Secret?: string; + }[]; + AccessibilityRequirements?: { + Requisite?: readonly Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >[]; + Preferred?: readonly Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >[]; + }; + CapacityRange?: { + RequiredBytes?: number; + LimitBytes?: number; + }; + /** + * The availability of the volume for use in tasks. + * - `active` The volume is fully available for scheduling on the cluster + * - `pause` No new workloads should use the volume, but existing workloads + * are not stopped. + * - `drain` All workloads using this volume should be stopped and + * rescheduled, and no new ones should be started. + * @default active + * @enum active,pause,drain + */ + Availability?: "active" | "pause" | "drain"; + }; + }; + Info?: { + CapacityBytes?: number; + VolumeContext?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + VolumeID?: string; + AccessibleTopology?: readonly Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >[]; + }; + PublishStatus?: readonly { + NodeID?: string; + /** + * The published state of the volume. + * * `pending-publish` The volume should be published to this node, but the + * call to the controller plugin to do so has not yet been successfully + * completed. + * * `published` The volume is published successfully to the node. + * * `pending-node-unpublish` The volume should be unpublished from the node, + * and the manager is awaiting confirmation from the worker that it has done + * so. + * * `pending-controller-unpublish` The volume is successfully unpublished + * from the node, but has not yet been successfully unpublished on the + * controller. + * @enum pending-publish,published,pending-node-unpublish,pending-controller-unpublish + */ + State?: + | "pending-publish" + | "published" + | "pending-node-unpublish" + | "pending-controller-unpublish"; + PublishContext?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; + }; + Options: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + UsageData?: { + /** + * Amount of disk space used by the volume (in bytes). This information + * is only available for volumes created with the `"local"` volume + * driver. For volumes created with other volume drivers, this field + * is set to `-1` ("not available") + * @default -1 + */ + Size: number; + /** + * The number of containers referencing this volume. This field + * is set to `-1` if the reference-count is not available. + * @default -1 + */ + RefCount: number; + }; + }[]; + BuildCache?: readonly { + /** + * Unique ID of the build cache record. + * @example ndlpt0hhvkqcdfkputsk4cq9c + */ + ID?: string; + /** + * ID of the parent build cache record. + * + * > **Deprecated**: This field is deprecated, and omitted if empty. + * @example + */ + Parent?: string; + /** + * List of parent build cache record IDs. + * @example hw53o5aio51xtltp5xjp8v7fx + */ + Parents?: readonly string[]; + /** + * Cache record type. + * @enum internal,frontend,source.local,source.git.checkout,exec.cachemount,regular + * @example regular + */ + Type?: + | "internal" + | "frontend" + | "source.local" + | "source.git.checkout" + | "exec.cachemount" + | "regular"; + /** + * Description of the build-step that produced the build cache. + * @example mount / from exec /bin/sh -c echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache + */ + Description?: string; + /** + * Indicates if the build cache is in use. + * @example false + */ + InUse?: boolean; + /** + * Indicates if the build cache is shared. + * @example true + */ + Shared?: boolean; + /** + * Amount of disk space used by the build cache (in bytes). + * @example 51 + */ + Size?: number; + /** + * Date and time at which the build cache was created in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2016-08-18T10:44:24.496525531Z + */ + CreatedAt?: string; + /** + * Date and time at which the build cache was last used in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2017-08-09T07:09:37.632105588Z + */ + LastUsedAt?: string; + UsageCount?: number; + }[]; +}; +export type ImageGetCommandParams = { + name: string; +}; +export type ImageGetCommandInput = ImageGetCommandParams; +export type ImageGetAllCommandQuery = { + names?: readonly string[] | undefined; +}; +export type ImageGetAllCommandInput = ImageGetAllCommandQuery; +export type ImageLoadCommandQuery = { + quiet?: "true" | "false"; +}; +type ImageLoadCommandBodyApplicationXTar = NonNullable; +export type ImageLoadCommandBodyNonJson = { + body: ImageLoadCommandBodyApplicationXTar; +}; +export type ImageLoadCommandInput = ImageLoadCommandBodyNonJson & + ImageLoadCommandQuery; +type ContainerExecJsonBody = { + AttachStdin?: boolean; + AttachStdout?: boolean; + AttachStderr?: boolean; + ConsoleSize?: readonly number[]; + DetachKeys?: string; + Tty?: boolean; + Env?: readonly string[]; + Cmd?: readonly string[]; + Privileged?: boolean; + User?: string; + WorkingDir?: string; +}; +export type ContainerExecCommandParams = { + id: string; +}; +export type ContainerExecCommandBody = ContainerExecJsonBody; +export type ContainerExecCommandInput = ContainerExecJsonBody & + ContainerExecCommandParams; +export type ContainerExecCommandOutput = { + Id: string; +}; +type ExecStartJsonBody = { + Detach?: boolean; + Tty?: boolean; + ConsoleSize?: readonly number[]; +}; +export type ExecStartCommandParams = { + id: string; +}; +export type ExecStartCommandBody = ExecStartJsonBody; +export type ExecStartCommandInput = ExecStartJsonBody & ExecStartCommandParams; +export type ExecResizeCommandQuery = { + h: `${number}`; + w: `${number}`; +}; +export type ExecResizeCommandParams = { + id: string; +}; +export type ExecResizeCommandInput = ExecResizeCommandParams & + ExecResizeCommandQuery; +export type ExecInspectCommandParams = { + id: string; +}; +export type ExecInspectCommandInput = ExecInspectCommandParams; +export type ExecInspectCommandOutput = { + CanRemove?: boolean; + DetachKeys?: string; + ID?: string; + Running?: boolean; + ExitCode?: number; + ProcessConfig?: { + privileged?: boolean; + user?: string; + tty?: boolean; + entrypoint?: string; + arguments?: readonly string[]; + }; + OpenStdin?: boolean; + OpenStderr?: boolean; + OpenStdout?: boolean; + ContainerID?: string; + Pid?: number; +}; +export type VolumeListCommandQuery = { + filters?: string | undefined; +}; +export type VolumeListCommandInput = VolumeListCommandQuery; +export type VolumeListCommandOutput = { + Volumes?: readonly { + /** + * Name of the volume. + * @example tardis + */ + Name: string; + /** + * Name of the volume driver used by the volume. + * @example custom + */ + Driver: string; + /** + * Mount path of the volume on the host. + * @example /var/lib/docker/volumes/tardis + */ + Mountpoint: string; + /** + * Date/Time the volume was created. + * @example 2016-06-07T20:31:11.853781916Z + */ + CreatedAt?: string; + Status?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Labels: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * The level at which the volume exists. Either `global` for cluster-wide, + * or `local` for machine level. + * @default local + * @enum local,global + * @example local + */ + Scope: "local" | "global"; + ClusterVolume?: { + ID?: string; + Version?: { + Index?: number; + }; + CreatedAt?: string; + UpdatedAt?: string; + Spec?: { + Group?: string; + AccessMode?: { + /** + * The set of nodes this volume can be used on at one time. + * - `single` The volume may only be scheduled to one node at a time. + * - `multi` the volume may be scheduled to any supported number of nodes at a + * time. + * @default single + * @enum single,multi + */ + Scope?: "single" | "multi"; + /** + * The number and way that different tasks can use this volume + * at one time. + * - `none` The volume may only be used by one task at a time. + * - `readonly` The volume may be used by any number of tasks, but they all + * must mount the volume as readonly + * - `onewriter` The volume may be used by any number of tasks, but only one + * may mount it as read/write. + * - `all` The volume may have any number of readers and writers. + * @default none + * @enum none,readonly,onewriter,all + */ + Sharing?: "none" | "readonly" | "onewriter" | "all"; + MountVolume?: {}; + Secrets?: readonly { + Key?: string; + Secret?: string; + }[]; + AccessibilityRequirements?: { + Requisite?: readonly Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >[]; + Preferred?: readonly Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >[]; + }; + CapacityRange?: { + RequiredBytes?: number; + LimitBytes?: number; + }; + /** + * The availability of the volume for use in tasks. + * - `active` The volume is fully available for scheduling on the cluster + * - `pause` No new workloads should use the volume, but existing workloads + * are not stopped. + * - `drain` All workloads using this volume should be stopped and + * rescheduled, and no new ones should be started. + * @default active + * @enum active,pause,drain + */ + Availability?: "active" | "pause" | "drain"; + }; + }; + Info?: { + CapacityBytes?: number; + VolumeContext?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + VolumeID?: string; + AccessibleTopology?: readonly Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >[]; + }; + PublishStatus?: readonly { + NodeID?: string; + /** + * The published state of the volume. + * * `pending-publish` The volume should be published to this node, but the + * call to the controller plugin to do so has not yet been successfully + * completed. + * * `published` The volume is published successfully to the node. + * * `pending-node-unpublish` The volume should be unpublished from the node, + * and the manager is awaiting confirmation from the worker that it has done + * so. + * * `pending-controller-unpublish` The volume is successfully unpublished + * from the node, but has not yet been successfully unpublished on the + * controller. + * @enum pending-publish,published,pending-node-unpublish,pending-controller-unpublish + */ + State?: + | "pending-publish" + | "published" + | "pending-node-unpublish" + | "pending-controller-unpublish"; + PublishContext?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; + }; + Options: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + UsageData?: { + /** + * Amount of disk space used by the volume (in bytes). This information + * is only available for volumes created with the `"local"` volume + * driver. For volumes created with other volume drivers, this field + * is set to `-1` ("not available") + * @default -1 + */ + Size: number; + /** + * The number of containers referencing this volume. This field + * is set to `-1` if the reference-count is not available. + * @default -1 + */ + RefCount: number; + }; + }[]; + /** + * Warnings that occurred when fetching the list of volumes. + * @example + */ + Warnings?: readonly string[]; +}; +type VolumeCreateJsonBody = { + /** + * The new volume's name. If not specified, Docker generates a name. + * @example tardis + */ + Name?: string; + /** + * Name of the volume driver to use. + * @default local + * @example custom + */ + Driver?: string; + DriverOpts?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + ClusterVolumeSpec?: { + Group?: string; + AccessMode?: { + /** + * The set of nodes this volume can be used on at one time. + * - `single` The volume may only be scheduled to one node at a time. + * - `multi` the volume may be scheduled to any supported number of nodes at a + * time. + * @default single + * @enum single,multi + */ + Scope?: "single" | "multi"; + /** + * The number and way that different tasks can use this volume + * at one time. + * - `none` The volume may only be used by one task at a time. + * - `readonly` The volume may be used by any number of tasks, but they all + * must mount the volume as readonly + * - `onewriter` The volume may be used by any number of tasks, but only one + * may mount it as read/write. + * - `all` The volume may have any number of readers and writers. + * @default none + * @enum none,readonly,onewriter,all + */ + Sharing?: "none" | "readonly" | "onewriter" | "all"; + MountVolume?: {}; + Secrets?: readonly { + Key?: string; + Secret?: string; + }[]; + AccessibilityRequirements?: { + Requisite?: readonly Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >[]; + Preferred?: readonly Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >[]; + }; + CapacityRange?: { + RequiredBytes?: number; + LimitBytes?: number; + }; + /** + * The availability of the volume for use in tasks. + * - `active` The volume is fully available for scheduling on the cluster + * - `pause` No new workloads should use the volume, but existing workloads + * are not stopped. + * - `drain` All workloads using this volume should be stopped and + * rescheduled, and no new ones should be started. + * @default active + * @enum active,pause,drain + */ + Availability?: "active" | "pause" | "drain"; + }; + }; +}; +export type VolumeCreateCommandBody = VolumeCreateJsonBody; +export type VolumeCreateCommandInput = VolumeCreateJsonBody; +export type VolumeCreateCommandOutput = { + /** + * Name of the volume. + * @example tardis + */ + Name: string; + /** + * Name of the volume driver used by the volume. + * @example custom + */ + Driver: string; + /** + * Mount path of the volume on the host. + * @example /var/lib/docker/volumes/tardis + */ + Mountpoint: string; + /** + * Date/Time the volume was created. + * @example 2016-06-07T20:31:11.853781916Z + */ + CreatedAt?: string; + Status?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Labels: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * The level at which the volume exists. Either `global` for cluster-wide, + * or `local` for machine level. + * @default local + * @enum local,global + * @example local + */ + Scope: "local" | "global"; + ClusterVolume?: { + ID?: string; + Version?: { + Index?: number; + }; + CreatedAt?: string; + UpdatedAt?: string; + Spec?: { + Group?: string; + AccessMode?: { + /** + * The set of nodes this volume can be used on at one time. + * - `single` The volume may only be scheduled to one node at a time. + * - `multi` the volume may be scheduled to any supported number of nodes at a + * time. + * @default single + * @enum single,multi + */ + Scope?: "single" | "multi"; + /** + * The number and way that different tasks can use this volume + * at one time. + * - `none` The volume may only be used by one task at a time. + * - `readonly` The volume may be used by any number of tasks, but they all + * must mount the volume as readonly + * - `onewriter` The volume may be used by any number of tasks, but only one + * may mount it as read/write. + * - `all` The volume may have any number of readers and writers. + * @default none + * @enum none,readonly,onewriter,all + */ + Sharing?: "none" | "readonly" | "onewriter" | "all"; + MountVolume?: {}; + Secrets?: readonly { + Key?: string; + Secret?: string; + }[]; + AccessibilityRequirements?: { + Requisite?: readonly Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >[]; + Preferred?: readonly Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >[]; + }; + CapacityRange?: { + RequiredBytes?: number; + LimitBytes?: number; + }; + /** + * The availability of the volume for use in tasks. + * - `active` The volume is fully available for scheduling on the cluster + * - `pause` No new workloads should use the volume, but existing workloads + * are not stopped. + * - `drain` All workloads using this volume should be stopped and + * rescheduled, and no new ones should be started. + * @default active + * @enum active,pause,drain + */ + Availability?: "active" | "pause" | "drain"; + }; + }; + Info?: { + CapacityBytes?: number; + VolumeContext?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + VolumeID?: string; + AccessibleTopology?: readonly Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >[]; + }; + PublishStatus?: readonly { + NodeID?: string; + /** + * The published state of the volume. + * * `pending-publish` The volume should be published to this node, but the + * call to the controller plugin to do so has not yet been successfully + * completed. + * * `published` The volume is published successfully to the node. + * * `pending-node-unpublish` The volume should be unpublished from the node, + * and the manager is awaiting confirmation from the worker that it has done + * so. + * * `pending-controller-unpublish` The volume is successfully unpublished + * from the node, but has not yet been successfully unpublished on the + * controller. + * @enum pending-publish,published,pending-node-unpublish,pending-controller-unpublish + */ + State?: + | "pending-publish" + | "published" + | "pending-node-unpublish" + | "pending-controller-unpublish"; + PublishContext?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; + }; + Options: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + UsageData?: { + /** + * Amount of disk space used by the volume (in bytes). This information + * is only available for volumes created with the `"local"` volume + * driver. For volumes created with other volume drivers, this field + * is set to `-1` ("not available") + * @default -1 + */ + Size: number; + /** + * The number of containers referencing this volume. This field + * is set to `-1` if the reference-count is not available. + * @default -1 + */ + RefCount: number; + }; +}; +export type VolumeInspectCommandParams = { + name: string; +}; +export type VolumeInspectCommandInput = VolumeInspectCommandParams; +export type VolumeInspectCommandOutput = { + /** + * Name of the volume. + * @example tardis + */ + Name: string; + /** + * Name of the volume driver used by the volume. + * @example custom + */ + Driver: string; + /** + * Mount path of the volume on the host. + * @example /var/lib/docker/volumes/tardis + */ + Mountpoint: string; + /** + * Date/Time the volume was created. + * @example 2016-06-07T20:31:11.853781916Z + */ + CreatedAt?: string; + Status?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Labels: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * The level at which the volume exists. Either `global` for cluster-wide, + * or `local` for machine level. + * @default local + * @enum local,global + * @example local + */ + Scope: "local" | "global"; + ClusterVolume?: { + ID?: string; + Version?: { + Index?: number; + }; + CreatedAt?: string; + UpdatedAt?: string; + Spec?: { + Group?: string; + AccessMode?: { + /** + * The set of nodes this volume can be used on at one time. + * - `single` The volume may only be scheduled to one node at a time. + * - `multi` the volume may be scheduled to any supported number of nodes at a + * time. + * @default single + * @enum single,multi + */ + Scope?: "single" | "multi"; + /** + * The number and way that different tasks can use this volume + * at one time. + * - `none` The volume may only be used by one task at a time. + * - `readonly` The volume may be used by any number of tasks, but they all + * must mount the volume as readonly + * - `onewriter` The volume may be used by any number of tasks, but only one + * may mount it as read/write. + * - `all` The volume may have any number of readers and writers. + * @default none + * @enum none,readonly,onewriter,all + */ + Sharing?: "none" | "readonly" | "onewriter" | "all"; + MountVolume?: {}; + Secrets?: readonly { + Key?: string; + Secret?: string; + }[]; + AccessibilityRequirements?: { + Requisite?: readonly Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >[]; + Preferred?: readonly Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >[]; + }; + CapacityRange?: { + RequiredBytes?: number; + LimitBytes?: number; + }; + /** + * The availability of the volume for use in tasks. + * - `active` The volume is fully available for scheduling on the cluster + * - `pause` No new workloads should use the volume, but existing workloads + * are not stopped. + * - `drain` All workloads using this volume should be stopped and + * rescheduled, and no new ones should be started. + * @default active + * @enum active,pause,drain + */ + Availability?: "active" | "pause" | "drain"; + }; + }; + Info?: { + CapacityBytes?: number; + VolumeContext?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + VolumeID?: string; + AccessibleTopology?: readonly Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >[]; + }; + PublishStatus?: readonly { + NodeID?: string; + /** + * The published state of the volume. + * * `pending-publish` The volume should be published to this node, but the + * call to the controller plugin to do so has not yet been successfully + * completed. + * * `published` The volume is published successfully to the node. + * * `pending-node-unpublish` The volume should be unpublished from the node, + * and the manager is awaiting confirmation from the worker that it has done + * so. + * * `pending-controller-unpublish` The volume is successfully unpublished + * from the node, but has not yet been successfully unpublished on the + * controller. + * @enum pending-publish,published,pending-node-unpublish,pending-controller-unpublish + */ + State?: + | "pending-publish" + | "published" + | "pending-node-unpublish" + | "pending-controller-unpublish"; + PublishContext?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; + }; + Options: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + UsageData?: { + /** + * Amount of disk space used by the volume (in bytes). This information + * is only available for volumes created with the `"local"` volume + * driver. For volumes created with other volume drivers, this field + * is set to `-1` ("not available") + * @default -1 + */ + Size: number; + /** + * The number of containers referencing this volume. This field + * is set to `-1` if the reference-count is not available. + * @default -1 + */ + RefCount: number; + }; +}; +export type VolumeUpdateCommandQuery = { + version: `${number}`; +}; +type VolumeUpdateJsonBody = { + Spec?: { + Group?: string; + AccessMode?: { + /** + * The set of nodes this volume can be used on at one time. + * - `single` The volume may only be scheduled to one node at a time. + * - `multi` the volume may be scheduled to any supported number of nodes at a + * time. + * @default single + * @enum single,multi + */ + Scope?: "single" | "multi"; + /** + * The number and way that different tasks can use this volume + * at one time. + * - `none` The volume may only be used by one task at a time. + * - `readonly` The volume may be used by any number of tasks, but they all + * must mount the volume as readonly + * - `onewriter` The volume may be used by any number of tasks, but only one + * may mount it as read/write. + * - `all` The volume may have any number of readers and writers. + * @default none + * @enum none,readonly,onewriter,all + */ + Sharing?: "none" | "readonly" | "onewriter" | "all"; + MountVolume?: {}; + Secrets?: readonly { + Key?: string; + Secret?: string; + }[]; + AccessibilityRequirements?: { + Requisite?: readonly Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >[]; + Preferred?: readonly Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >[]; + }; + CapacityRange?: { + RequiredBytes?: number; + LimitBytes?: number; + }; + /** + * The availability of the volume for use in tasks. + * - `active` The volume is fully available for scheduling on the cluster + * - `pause` No new workloads should use the volume, but existing workloads + * are not stopped. + * - `drain` All workloads using this volume should be stopped and + * rescheduled, and no new ones should be started. + * @default active + * @enum active,pause,drain + */ + Availability?: "active" | "pause" | "drain"; + }; + }; +}; +export type VolumeUpdateCommandParams = { + name: string; +}; +export type VolumeUpdateCommandBody = VolumeUpdateJsonBody; +export type VolumeUpdateCommandInput = VolumeUpdateJsonBody & + VolumeUpdateCommandParams & + VolumeUpdateCommandQuery; +export type VolumeDeleteCommandQuery = { + force?: "true" | "false"; +}; +export type VolumeDeleteCommandParams = { + name: string; +}; +export type VolumeDeleteCommandInput = VolumeDeleteCommandParams & + VolumeDeleteCommandQuery; +export type VolumePruneCommandQuery = { + filters?: string | undefined; +}; +export type VolumePruneCommandInput = VolumePruneCommandQuery; +export type VolumePruneCommandOutput = { + VolumesDeleted?: readonly string[]; + SpaceReclaimed?: number; +}; +export type NetworkListCommandQuery = { + filters?: string | undefined; +}; +export type NetworkListCommandInput = NetworkListCommandQuery; +export type NetworkListCommandOutput = readonly { + /** + * Name of the network. + * @example my_network + */ + Name?: string; + /** + * ID that uniquely identifies a network on a single machine. + * @example 7d86d31b1478e7cca9ebed7e73aa0fdeec46c5ca29497431d3007d2d9e15ed99 + */ + Id?: string; + /** + * Date and time at which the network was created in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2016-10-19T04:33:30.360899459Z + */ + Created?: string; + /** + * The level at which the network exists (e.g. `swarm` for cluster-wide + * or `local` for machine level) + * @example local + */ + Scope?: string; + /** + * The name of the driver used to create the network (e.g. `bridge`, + * `overlay`). + * @example overlay + */ + Driver?: string; + /** + * Whether the network was created with IPv6 enabled. + * @example false + */ + EnableIPv6?: boolean; + IPAM?: { + /** + * Name of the IPAM driver to use. + * @default default + * @example default + */ + Driver?: string; + Config?: readonly { + Subnet?: string; + IPRange?: string; + Gateway?: string; + AuxiliaryAddresses?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + /** + * Whether the network is created to only allow internal networking + * connectivity. + * @example false + */ + Internal?: boolean; + /** + * Whether a global / swarm scope network is manually attachable by regular + * containers from workers in swarm mode. + * @example false + */ + Attachable?: boolean; + /** + * Whether the network is providing the routing-mesh for the swarm cluster. + * @example false + */ + Ingress?: boolean; + ConfigFrom?: { + /** + * The name of the config-only network that provides the network's + * configuration. The specified network must be an existing config-only + * network. Only network names are allowed, not network IDs. + * @example config_only_network_01 + */ + Network?: string; + }; + ConfigOnly?: boolean; + Containers?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Peers?: readonly { + /** + * ID of the peer-node in the Swarm cluster. + * @example 6869d7c1732b + */ + Name?: string; + /** + * IP-address of the peer-node in the Swarm cluster. + * @example 10.133.77.91 + */ + IP?: string; + }[]; +}[]; +export type NetworkInspectCommandQuery = { + verbose?: "true" | "false"; + scope?: string | undefined; +}; +export type NetworkInspectCommandParams = { + id: string; +}; +export type NetworkInspectCommandInput = NetworkInspectCommandParams & + NetworkInspectCommandQuery; +export type NetworkInspectCommandOutput = { + /** + * Name of the network. + * @example my_network + */ + Name?: string; + /** + * ID that uniquely identifies a network on a single machine. + * @example 7d86d31b1478e7cca9ebed7e73aa0fdeec46c5ca29497431d3007d2d9e15ed99 + */ + Id?: string; + /** + * Date and time at which the network was created in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2016-10-19T04:33:30.360899459Z + */ + Created?: string; + /** + * The level at which the network exists (e.g. `swarm` for cluster-wide + * or `local` for machine level) + * @example local + */ + Scope?: string; + /** + * The name of the driver used to create the network (e.g. `bridge`, + * `overlay`). + * @example overlay + */ + Driver?: string; + /** + * Whether the network was created with IPv6 enabled. + * @example false + */ + EnableIPv6?: boolean; + IPAM?: { + /** + * Name of the IPAM driver to use. + * @default default + * @example default + */ + Driver?: string; + Config?: readonly { + Subnet?: string; + IPRange?: string; + Gateway?: string; + AuxiliaryAddresses?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + /** + * Whether the network is created to only allow internal networking + * connectivity. + * @example false + */ + Internal?: boolean; + /** + * Whether a global / swarm scope network is manually attachable by regular + * containers from workers in swarm mode. + * @example false + */ + Attachable?: boolean; + /** + * Whether the network is providing the routing-mesh for the swarm cluster. + * @example false + */ + Ingress?: boolean; + ConfigFrom?: { + /** + * The name of the config-only network that provides the network's + * configuration. The specified network must be an existing config-only + * network. Only network names are allowed, not network IDs. + * @example config_only_network_01 + */ + Network?: string; + }; + ConfigOnly?: boolean; + Containers?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Peers?: readonly { + /** + * ID of the peer-node in the Swarm cluster. + * @example 6869d7c1732b + */ + Name?: string; + /** + * IP-address of the peer-node in the Swarm cluster. + * @example 10.133.77.91 + */ + IP?: string; + }[]; +}; +export type NetworkDeleteCommandParams = { + id: string; +}; +export type NetworkDeleteCommandInput = NetworkDeleteCommandParams; +type NetworkCreateJsonBody = { + /** + * The network's name. + * @example my_network + */ + Name: string; + /** + * Check for networks with duplicate names. Since Network is + * primarily keyed based on a random ID and not on the name, and + * network name is strictly a user-friendly alias to the network + * which is uniquely identified using ID, there is no guaranteed + * way to check for duplicates. CheckDuplicate is there to provide + * a best effort checking of any networks which has the same name + * but it is not guaranteed to catch all name collisions. + * @example true + */ + CheckDuplicate?: boolean; + /** + * Name of the network driver plugin to use. + * @default bridge + * @example bridge + */ + Driver?: string; + Scope?: string; + Internal?: boolean; + /** + * Globally scoped network is manually attachable by regular + * containers from workers in swarm mode. + * @example true + */ + Attachable?: boolean; + /** + * Ingress network is the network which provides the routing-mesh + * in swarm mode. + * @example false + */ + Ingress?: boolean; + /** + * Creates a config-only network. Config-only networks are placeholder + * networks for network configurations to be used by other networks. + * Config-only networks cannot be used directly to run containers + * or services. + * @example false + */ + ConfigOnly?: boolean; + ConfigFrom?: { + /** + * The name of the config-only network that provides the network's + * configuration. The specified network must be an existing config-only + * network. Only network names are allowed, not network IDs. + * @example config_only_network_01 + */ + Network?: string; + }; + IPAM?: { + /** + * Name of the IPAM driver to use. + * @default default + * @example default + */ + Driver?: string; + Config?: readonly { + Subnet?: string; + IPRange?: string; + Gateway?: string; + AuxiliaryAddresses?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + /** + * Enable IPv6 on the network. + * @example true + */ + EnableIPv6?: boolean; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; +}; +export type NetworkCreateCommandBody = NetworkCreateJsonBody; +export type NetworkCreateCommandInput = NetworkCreateJsonBody; +export type NetworkCreateCommandOutput = { + Id?: string; + Warning?: string; +}; +type NetworkConnectJsonBody = { + Container?: string; + EndpointConfig?: { + IPAMConfig?: { + IPv4Address?: string; + IPv6Address?: string; + LinkLocalIPs?: readonly string[]; + }; + Links?: readonly string[]; + Aliases?: readonly string[]; + /** + * Unique ID of the network. + * @example 08754567f1f40222263eab4102e1c733ae697e8e354aa9cd6e18d7402835292a + */ + NetworkID?: string; + /** + * Unique ID for the service endpoint in a Sandbox. + * @example b88f5b905aabf2893f3cbc4ee42d1ea7980bbc0a92e2c8922b1e1795298afb0b + */ + EndpointID?: string; + /** + * Gateway address for this network. + * @example 172.17.0.1 + */ + Gateway?: string; + /** + * IPv4 address. + * @example 172.17.0.4 + */ + IPAddress?: string; + /** + * Mask length of the IPv4 address. + * @example 16 + */ + IPPrefixLen?: number; + /** + * IPv6 gateway address. + * @example 2001:db8:2::100 + */ + IPv6Gateway?: string; + /** + * Global IPv6 address. + * @example 2001:db8::5689 + */ + GlobalIPv6Address?: string; + /** + * Mask length of the global IPv6 address. + * @example 64 + */ + GlobalIPv6PrefixLen?: number; + /** + * MAC address for the endpoint on this network. + * @example 02:42:ac:11:00:04 + */ + MacAddress?: string; + DriverOpts?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; +}; +export type NetworkConnectCommandParams = { + id: string; +}; +export type NetworkConnectCommandBody = NetworkConnectJsonBody; +export type NetworkConnectCommandInput = NetworkConnectJsonBody & + NetworkConnectCommandParams; +type NetworkDisconnectJsonBody = { + Container?: string; + Force?: boolean; +}; +export type NetworkDisconnectCommandParams = { + id: string; +}; +export type NetworkDisconnectCommandBody = NetworkDisconnectJsonBody; +export type NetworkDisconnectCommandInput = NetworkDisconnectJsonBody & + NetworkDisconnectCommandParams; +export type NetworkPruneCommandQuery = { + filters?: string | undefined; +}; +export type NetworkPruneCommandInput = NetworkPruneCommandQuery; +export type NetworkPruneCommandOutput = { + NetworksDeleted?: readonly string[]; +}; +export type PluginListCommandQuery = { + filters?: string | undefined; +}; +export type PluginListCommandInput = PluginListCommandQuery; +export type PluginListCommandOutput = readonly { + Id?: string; + Name: string; + /** + * True if the plugin is running. False if the plugin is not running, only + * installed. + * @example true + */ + Enabled: boolean; + Settings: { + Mounts: readonly { + Name: string; + Description: string; + Settable: readonly string[]; + Source: string; + Destination: string; + Type: string; + Options: readonly string[]; + }[]; + Env: readonly string[]; + Args: readonly string[]; + Devices: readonly { + Name: string; + Description: string; + Settable: readonly string[]; + Path: string; + }[]; + }; + /** + * plugin remote reference used to push/pull the plugin + * @example localhost:5000/tiborvass/sample-volume-plugin:latest + */ + PluginReference?: string; + Config: { + /** + * Docker Version used to create the plugin + * @example 17.06.0-ce + */ + DockerVersion?: string; + Description: string; + Documentation: string; + Interface: { + Types: readonly { + Prefix: string; + Capability: string; + Version: string; + }[]; + Socket: string; + /** + * Protocol to use for clients connecting to the plugin. + * @enum ,moby.plugins.http/v1 + * @example some.protocol/v1.0 + */ + ProtocolScheme?: "" | "moby.plugins.http/v1"; + }; + Entrypoint: readonly string[]; + WorkDir: string; + User?: { + UID?: number; + GID?: number; + }; + Network: { + Type: string; + }; + Linux: { + Capabilities: readonly string[]; + AllowAllDevices: boolean; + Devices: readonly { + Name: string; + Description: string; + Settable: readonly string[]; + Path: string; + }[]; + }; + PropagatedMount: string; + IpcHost: boolean; + PidHost: boolean; + Mounts: readonly { + Name: string; + Description: string; + Settable: readonly string[]; + Source: string; + Destination: string; + Type: string; + Options: readonly string[]; + }[]; + Env: readonly { + Name: string; + Description: string; + Settable: readonly string[]; + Value: string; + }[]; + Args: { + Name: string; + Description: string; + Settable: readonly string[]; + Value: readonly string[]; + }; + rootfs?: { + type?: string; + diff_ids?: readonly string[]; + }; + }; +}[]; +export type GetPluginPrivilegesCommandQuery = { + remote: string; +}; +export type GetPluginPrivilegesCommandInput = GetPluginPrivilegesCommandQuery; +export type GetPluginPrivilegesCommandOutput = readonly { + Name?: string; + Description?: string; + Value?: readonly string[]; +}[]; +export type PluginPullCommandQuery = { + remote: string; + name?: string | undefined; +}; +type PluginPullJsonBody = readonly { + Name?: string; + Description?: string; + Value?: readonly string[]; +}[]; +export type PluginPullCommandBody = PluginPullJsonBody; +export type PluginPullCommandInput = PluginPullJsonBody & + PluginPullCommandQuery; +export type PluginInspectCommandParams = { + name: string; +}; +export type PluginInspectCommandInput = PluginInspectCommandParams; +export type PluginInspectCommandOutput = { + Id?: string; + Name: string; + /** + * True if the plugin is running. False if the plugin is not running, only + * installed. + * @example true + */ + Enabled: boolean; + Settings: { + Mounts: readonly { + Name: string; + Description: string; + Settable: readonly string[]; + Source: string; + Destination: string; + Type: string; + Options: readonly string[]; + }[]; + Env: readonly string[]; + Args: readonly string[]; + Devices: readonly { + Name: string; + Description: string; + Settable: readonly string[]; + Path: string; + }[]; + }; + /** + * plugin remote reference used to push/pull the plugin + * @example localhost:5000/tiborvass/sample-volume-plugin:latest + */ + PluginReference?: string; + Config: { + /** + * Docker Version used to create the plugin + * @example 17.06.0-ce + */ + DockerVersion?: string; + Description: string; + Documentation: string; + Interface: { + Types: readonly { + Prefix: string; + Capability: string; + Version: string; + }[]; + Socket: string; + /** + * Protocol to use for clients connecting to the plugin. + * @enum ,moby.plugins.http/v1 + * @example some.protocol/v1.0 + */ + ProtocolScheme?: "" | "moby.plugins.http/v1"; + }; + Entrypoint: readonly string[]; + WorkDir: string; + User?: { + UID?: number; + GID?: number; + }; + Network: { + Type: string; + }; + Linux: { + Capabilities: readonly string[]; + AllowAllDevices: boolean; + Devices: readonly { + Name: string; + Description: string; + Settable: readonly string[]; + Path: string; + }[]; + }; + PropagatedMount: string; + IpcHost: boolean; + PidHost: boolean; + Mounts: readonly { + Name: string; + Description: string; + Settable: readonly string[]; + Source: string; + Destination: string; + Type: string; + Options: readonly string[]; + }[]; + Env: readonly { + Name: string; + Description: string; + Settable: readonly string[]; + Value: string; + }[]; + Args: { + Name: string; + Description: string; + Settable: readonly string[]; + Value: readonly string[]; + }; + rootfs?: { + type?: string; + diff_ids?: readonly string[]; + }; + }; +}; +export type PluginDeleteCommandQuery = { + force?: "true" | "false"; +}; +export type PluginDeleteCommandParams = { + name: string; +}; +export type PluginDeleteCommandInput = PluginDeleteCommandParams & + PluginDeleteCommandQuery; +export type PluginDeleteCommandOutput = { + Id?: string; + Name: string; + /** + * True if the plugin is running. False if the plugin is not running, only + * installed. + * @example true + */ + Enabled: boolean; + Settings: { + Mounts: readonly { + Name: string; + Description: string; + Settable: readonly string[]; + Source: string; + Destination: string; + Type: string; + Options: readonly string[]; + }[]; + Env: readonly string[]; + Args: readonly string[]; + Devices: readonly { + Name: string; + Description: string; + Settable: readonly string[]; + Path: string; + }[]; + }; + /** + * plugin remote reference used to push/pull the plugin + * @example localhost:5000/tiborvass/sample-volume-plugin:latest + */ + PluginReference?: string; + Config: { + /** + * Docker Version used to create the plugin + * @example 17.06.0-ce + */ + DockerVersion?: string; + Description: string; + Documentation: string; + Interface: { + Types: readonly { + Prefix: string; + Capability: string; + Version: string; + }[]; + Socket: string; + /** + * Protocol to use for clients connecting to the plugin. + * @enum ,moby.plugins.http/v1 + * @example some.protocol/v1.0 + */ + ProtocolScheme?: "" | "moby.plugins.http/v1"; + }; + Entrypoint: readonly string[]; + WorkDir: string; + User?: { + UID?: number; + GID?: number; + }; + Network: { + Type: string; + }; + Linux: { + Capabilities: readonly string[]; + AllowAllDevices: boolean; + Devices: readonly { + Name: string; + Description: string; + Settable: readonly string[]; + Path: string; + }[]; + }; + PropagatedMount: string; + IpcHost: boolean; + PidHost: boolean; + Mounts: readonly { + Name: string; + Description: string; + Settable: readonly string[]; + Source: string; + Destination: string; + Type: string; + Options: readonly string[]; + }[]; + Env: readonly { + Name: string; + Description: string; + Settable: readonly string[]; + Value: string; + }[]; + Args: { + Name: string; + Description: string; + Settable: readonly string[]; + Value: readonly string[]; + }; + rootfs?: { + type?: string; + diff_ids?: readonly string[]; + }; + }; +}; +export type PluginEnableCommandQuery = { + timeout?: `${number}` | undefined; +}; +export type PluginEnableCommandParams = { + name: string; +}; +export type PluginEnableCommandInput = PluginEnableCommandParams & + PluginEnableCommandQuery; +export type PluginDisableCommandQuery = { + force?: "true" | "false"; +}; +export type PluginDisableCommandParams = { + name: string; +}; +export type PluginDisableCommandInput = PluginDisableCommandParams & + PluginDisableCommandQuery; +export type PluginUpgradeCommandQuery = { + remote: string; +}; +type PluginUpgradeJsonBody = readonly { + Name?: string; + Description?: string; + Value?: readonly string[]; +}[]; +export type PluginUpgradeCommandParams = { + name: string; +}; +export type PluginUpgradeCommandBody = PluginUpgradeJsonBody; +export type PluginUpgradeCommandInput = PluginUpgradeJsonBody & + PluginUpgradeCommandParams & + PluginUpgradeCommandQuery; +export type PluginCreateCommandQuery = { + name: string; +}; +type PluginCreateCommandBodyApplicationXTar = NonNullable; +export type PluginCreateCommandBodyNonJson = { + body: PluginCreateCommandBodyApplicationXTar; +}; +export type PluginCreateCommandInput = PluginCreateCommandBodyNonJson & + PluginCreateCommandQuery; +export type PluginPushCommandParams = { + name: string; +}; +export type PluginPushCommandInput = PluginPushCommandParams; +type PluginSetJsonBody = readonly string[]; +export type PluginSetCommandParams = { + name: string; +}; +export type PluginSetCommandBody = PluginSetJsonBody; +export type PluginSetCommandInput = PluginSetJsonBody & PluginSetCommandParams; +export type NodeListCommandQuery = { + filters?: string | undefined; +}; +export type NodeListCommandInput = NodeListCommandQuery; +export type NodeListCommandOutput = readonly { + ID?: string; + Version?: { + Index?: number; + }; + /** + * Date and time at which the node was added to the swarm in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2016-08-18T10:44:24.496525531Z + */ + CreatedAt?: string; + /** + * Date and time at which the node was last updated in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2017-08-09T07:09:37.632105588Z + */ + UpdatedAt?: string; + Spec?: { + /** + * Name for the node. + * @example my-node + */ + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * Role of the node. + * @enum worker,manager + * @example manager + */ + Role?: "worker" | "manager"; + /** + * Availability of the node. + * @enum active,pause,drain + * @example active + */ + Availability?: "active" | "pause" | "drain"; + }; + Description?: { + Hostname?: string; + Platform?: { + /** + * Architecture represents the hardware architecture (for example, + * `x86_64`). + * @example x86_64 + */ + Architecture?: string; + /** + * OS represents the Operating System (for example, `linux` or `windows`). + * @example linux + */ + OS?: string; + }; + Resources?: { + NanoCPUs?: number; + MemoryBytes?: number; + /** + * User-defined resources can be either Integer resources (e.g, `SSD=3`) or + * String resources (e.g, `GPU=UUID1`). + * @example [object Object],[object Object],[object Object] + */ + GenericResources?: readonly { + NamedResourceSpec?: { + Kind?: string; + Value?: string; + }; + DiscreteResourceSpec?: { + Kind?: string; + Value?: number; + }; + }[]; + }; + Engine?: { + EngineVersion?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Plugins?: readonly { + Type?: string; + Name?: string; + }[]; + }; + /** + * Information about the issuer of leaf TLS certificates and the trusted root + * CA certificate. + * @example [object Object] + */ + TLSInfo?: { + TrustRoot?: string; + CertIssuerSubject?: string; + CertIssuerPublicKey?: string; + }; + }; + Status?: { + /** + * NodeState represents the state of a node. + * @enum unknown,down,ready,disconnected + * @example ready + */ + State?: "unknown" | "down" | "ready" | "disconnected"; + Message?: string; + /** + * IP address of the node. + * @example 172.17.0.2 + */ + Addr?: string; + }; + ManagerStatus?: { + Leader?: boolean; + /** + * Reachability represents the reachability of a node. + * @enum unknown,unreachable,reachable + * @example reachable + */ + Reachability?: "unknown" | "unreachable" | "reachable"; + /** + * The IP address and port at which the manager is reachable. + * @example 10.0.0.46:2377 + */ + Addr?: string; + }; +}[]; +export type NodeInspectCommandParams = { + id: string; +}; +export type NodeInspectCommandInput = NodeInspectCommandParams; +export type NodeInspectCommandOutput = { + ID?: string; + Version?: { + Index?: number; + }; + /** + * Date and time at which the node was added to the swarm in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2016-08-18T10:44:24.496525531Z + */ + CreatedAt?: string; + /** + * Date and time at which the node was last updated in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2017-08-09T07:09:37.632105588Z + */ + UpdatedAt?: string; + Spec?: { + /** + * Name for the node. + * @example my-node + */ + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * Role of the node. + * @enum worker,manager + * @example manager + */ + Role?: "worker" | "manager"; + /** + * Availability of the node. + * @enum active,pause,drain + * @example active + */ + Availability?: "active" | "pause" | "drain"; + }; + Description?: { + Hostname?: string; + Platform?: { + /** + * Architecture represents the hardware architecture (for example, + * `x86_64`). + * @example x86_64 + */ + Architecture?: string; + /** + * OS represents the Operating System (for example, `linux` or `windows`). + * @example linux + */ + OS?: string; + }; + Resources?: { + NanoCPUs?: number; + MemoryBytes?: number; + /** + * User-defined resources can be either Integer resources (e.g, `SSD=3`) or + * String resources (e.g, `GPU=UUID1`). + * @example [object Object],[object Object],[object Object] + */ + GenericResources?: readonly { + NamedResourceSpec?: { + Kind?: string; + Value?: string; + }; + DiscreteResourceSpec?: { + Kind?: string; + Value?: number; + }; + }[]; + }; + Engine?: { + EngineVersion?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Plugins?: readonly { + Type?: string; + Name?: string; + }[]; + }; + /** + * Information about the issuer of leaf TLS certificates and the trusted root + * CA certificate. + * @example [object Object] + */ + TLSInfo?: { + TrustRoot?: string; + CertIssuerSubject?: string; + CertIssuerPublicKey?: string; + }; + }; + Status?: { + /** + * NodeState represents the state of a node. + * @enum unknown,down,ready,disconnected + * @example ready + */ + State?: "unknown" | "down" | "ready" | "disconnected"; + Message?: string; + /** + * IP address of the node. + * @example 172.17.0.2 + */ + Addr?: string; + }; + ManagerStatus?: { + Leader?: boolean; + /** + * Reachability represents the reachability of a node. + * @enum unknown,unreachable,reachable + * @example reachable + */ + Reachability?: "unknown" | "unreachable" | "reachable"; + /** + * The IP address and port at which the manager is reachable. + * @example 10.0.0.46:2377 + */ + Addr?: string; + }; +}; +export type NodeDeleteCommandQuery = { + force?: "true" | "false"; +}; +export type NodeDeleteCommandParams = { + id: string; +}; +export type NodeDeleteCommandInput = NodeDeleteCommandParams & + NodeDeleteCommandQuery; +export type NodeUpdateCommandQuery = { + version: `${number}`; +}; +type NodeUpdateJsonBody = { + /** + * Name for the node. + * @example my-node + */ + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * Role of the node. + * @enum worker,manager + * @example manager + */ + Role?: "worker" | "manager"; + /** + * Availability of the node. + * @enum active,pause,drain + * @example active + */ + Availability?: "active" | "pause" | "drain"; +}; +export type NodeUpdateCommandParams = { + id: string; +}; +export type NodeUpdateCommandBody = NodeUpdateJsonBody; +export type NodeUpdateCommandInput = NodeUpdateJsonBody & + NodeUpdateCommandParams & + NodeUpdateCommandQuery; +export type SwarmInspectCommandInput = never; +export type SwarmInspectCommandOutput = { + /** + * The ID of the swarm. + * @example abajmipo7b4xz5ip2nrla6b11 + */ + ID?: string; + Version?: { + Index?: number; + }; + /** + * Date and time at which the swarm was initialised in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2016-08-18T10:44:24.496525531Z + */ + CreatedAt?: string; + /** + * Date and time at which the swarm was last updated in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * @example 2017-08-09T07:09:37.632105588Z + */ + UpdatedAt?: string; + Spec?: { + /** + * Name of the swarm. + * @example default + */ + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Orchestration?: { + /** + * The number of historic tasks to keep per instance or node. If + * negative, never remove completed or failed tasks. + * @example 10 + */ + TaskHistoryRetentionLimit?: number; + }; + Raft?: { + /** + * The number of log entries between snapshots. + * @example 10000 + */ + SnapshotInterval?: number; + KeepOldSnapshots?: number; + /** + * The number of log entries to keep around to sync up slow followers + * after a snapshot is created. + * @example 500 + */ + LogEntriesForSlowFollowers?: number; + /** + * The number of ticks that a follower will wait for a message from + * the leader before becoming a candidate and starting an election. + * `ElectionTick` must be greater than `HeartbeatTick`. + * + * A tick currently defaults to one second, so these translate + * directly to seconds currently, but this is NOT guaranteed. + * @example 3 + */ + ElectionTick?: number; + /** + * The number of ticks between heartbeats. Every HeartbeatTick ticks, + * the leader will send a heartbeat to the followers. + * + * A tick currently defaults to one second, so these translate + * directly to seconds currently, but this is NOT guaranteed. + * @example 1 + */ + HeartbeatTick?: number; + }; + Dispatcher?: { + /** + * The delay for an agent to send a heartbeat to the dispatcher. + * @example 5000000000 + */ + HeartbeatPeriod?: number; + }; + CAConfig?: { + /** + * The duration node certificates are issued for. + * @example 7776000000000000 + */ + NodeCertExpiry?: number; + ExternalCAs?: readonly { + /** + * Protocol for communication with the external CA (currently + * only `cfssl` is supported). + * @default cfssl + * @enum cfssl + */ + Protocol?: "cfssl"; + URL?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + CACert?: string; + }[]; + SigningCACert?: string; + SigningCAKey?: string; + ForceRotate?: number; + }; + EncryptionConfig?: { + /** + * If set, generate a key and use it to lock data stored on the + * managers. + * @example false + */ + AutoLockManagers?: boolean; + }; + TaskDefaults?: { + LogDriver?: { + /** + * The log driver to use as a default for new tasks. + * @example json-file + */ + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; + }; + /** + * Information about the issuer of leaf TLS certificates and the trusted root + * CA certificate. + * @example [object Object] + */ + TLSInfo?: { + TrustRoot?: string; + CertIssuerSubject?: string; + CertIssuerPublicKey?: string; + }; + /** + * Whether there is currently a root CA rotation in progress for the swarm + * @example false + */ + RootRotationInProgress?: boolean; + /** + * DataPathPort specifies the data path port number for data traffic. + * Acceptable port range is 1024 to 49151. + * If no port is set or is set to 0, the default port (4789) is used. + * @example 4789 + */ + DataPathPort?: number; + DefaultAddrPool?: readonly string[]; + /** + * SubnetSize specifies the subnet size of the networks created from the + * default subnet pool. + * @example 24 + */ + SubnetSize?: number; +} & { + JoinTokens?: { + /** + * The token workers can use to join the swarm. + * @example SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-1awxwuwd3z9j1z3puu7rcgdbx + */ + Worker?: string; + /** + * The token managers can use to join the swarm. + * @example SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-7p73s1dx5in4tatdymyhg9hu2 + */ + Manager?: string; + }; +}; +type SwarmInitJsonBody = { + ListenAddr?: string; + AdvertiseAddr?: string; + DataPathAddr?: string; + DataPathPort?: number; + DefaultAddrPool?: readonly string[]; + ForceNewCluster?: boolean; + SubnetSize?: number; + Spec?: { + /** + * Name of the swarm. + * @example default + */ + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Orchestration?: { + /** + * The number of historic tasks to keep per instance or node. If + * negative, never remove completed or failed tasks. + * @example 10 + */ + TaskHistoryRetentionLimit?: number; + }; + Raft?: { + /** + * The number of log entries between snapshots. + * @example 10000 + */ + SnapshotInterval?: number; + KeepOldSnapshots?: number; + /** + * The number of log entries to keep around to sync up slow followers + * after a snapshot is created. + * @example 500 + */ + LogEntriesForSlowFollowers?: number; + /** + * The number of ticks that a follower will wait for a message from + * the leader before becoming a candidate and starting an election. + * `ElectionTick` must be greater than `HeartbeatTick`. + * + * A tick currently defaults to one second, so these translate + * directly to seconds currently, but this is NOT guaranteed. + * @example 3 + */ + ElectionTick?: number; + /** + * The number of ticks between heartbeats. Every HeartbeatTick ticks, + * the leader will send a heartbeat to the followers. + * + * A tick currently defaults to one second, so these translate + * directly to seconds currently, but this is NOT guaranteed. + * @example 1 + */ + HeartbeatTick?: number; + }; + Dispatcher?: { + /** + * The delay for an agent to send a heartbeat to the dispatcher. + * @example 5000000000 + */ + HeartbeatPeriod?: number; + }; + CAConfig?: { + /** + * The duration node certificates are issued for. + * @example 7776000000000000 + */ + NodeCertExpiry?: number; + ExternalCAs?: readonly { + /** + * Protocol for communication with the external CA (currently + * only `cfssl` is supported). + * @default cfssl + * @enum cfssl + */ + Protocol?: "cfssl"; + URL?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + CACert?: string; + }[]; + SigningCACert?: string; + SigningCAKey?: string; + ForceRotate?: number; + }; + EncryptionConfig?: { + /** + * If set, generate a key and use it to lock data stored on the + * managers. + * @example false + */ + AutoLockManagers?: boolean; + }; + TaskDefaults?: { + LogDriver?: { + /** + * The log driver to use as a default for new tasks. + * @example json-file + */ + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; + }; +}; +export type SwarmInitCommandBody = SwarmInitJsonBody; +export type SwarmInitCommandInput = SwarmInitJsonBody; +export type SwarmInitCommandOutput = string | undefined; +type SwarmJoinJsonBody = { + ListenAddr?: string; + AdvertiseAddr?: string; + DataPathAddr?: string; + RemoteAddrs?: readonly string[]; + JoinToken?: string; +}; +export type SwarmJoinCommandBody = SwarmJoinJsonBody; +export type SwarmJoinCommandInput = SwarmJoinJsonBody; +export type SwarmLeaveCommandQuery = { + force?: "true" | "false"; +}; +export type SwarmLeaveCommandInput = SwarmLeaveCommandQuery; +export type SwarmUpdateCommandQuery = { + version: `${number}`; + rotateWorkerToken?: "true" | "false"; + rotateManagerToken?: "true" | "false"; + rotateManagerUnlockKey?: "true" | "false"; +}; +type SwarmUpdateJsonBody = { + /** + * Name of the swarm. + * @example default + */ + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Orchestration?: { + /** + * The number of historic tasks to keep per instance or node. If + * negative, never remove completed or failed tasks. + * @example 10 + */ + TaskHistoryRetentionLimit?: number; + }; + Raft?: { + /** + * The number of log entries between snapshots. + * @example 10000 + */ + SnapshotInterval?: number; + KeepOldSnapshots?: number; + /** + * The number of log entries to keep around to sync up slow followers + * after a snapshot is created. + * @example 500 + */ + LogEntriesForSlowFollowers?: number; + /** + * The number of ticks that a follower will wait for a message from + * the leader before becoming a candidate and starting an election. + * `ElectionTick` must be greater than `HeartbeatTick`. + * + * A tick currently defaults to one second, so these translate + * directly to seconds currently, but this is NOT guaranteed. + * @example 3 + */ + ElectionTick?: number; + /** + * The number of ticks between heartbeats. Every HeartbeatTick ticks, + * the leader will send a heartbeat to the followers. + * + * A tick currently defaults to one second, so these translate + * directly to seconds currently, but this is NOT guaranteed. + * @example 1 + */ + HeartbeatTick?: number; + }; + Dispatcher?: { + /** + * The delay for an agent to send a heartbeat to the dispatcher. + * @example 5000000000 + */ + HeartbeatPeriod?: number; + }; + CAConfig?: { + /** + * The duration node certificates are issued for. + * @example 7776000000000000 + */ + NodeCertExpiry?: number; + ExternalCAs?: readonly { + /** + * Protocol for communication with the external CA (currently + * only `cfssl` is supported). + * @default cfssl + * @enum cfssl + */ + Protocol?: "cfssl"; + URL?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + CACert?: string; + }[]; + SigningCACert?: string; + SigningCAKey?: string; + ForceRotate?: number; + }; + EncryptionConfig?: { + /** + * If set, generate a key and use it to lock data stored on the + * managers. + * @example false + */ + AutoLockManagers?: boolean; + }; + TaskDefaults?: { + LogDriver?: { + /** + * The log driver to use as a default for new tasks. + * @example json-file + */ + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; +}; +export type SwarmUpdateCommandBody = SwarmUpdateJsonBody; +export type SwarmUpdateCommandInput = SwarmUpdateJsonBody & + SwarmUpdateCommandQuery; +export type SwarmUnlockkeyCommandInput = never; +export type SwarmUnlockkeyCommandOutput = { + UnlockKey?: string; +}; +type SwarmUnlockJsonBody = { + UnlockKey?: string; +}; +export type SwarmUnlockCommandBody = SwarmUnlockJsonBody; +export type SwarmUnlockCommandInput = SwarmUnlockJsonBody; +export type ServiceListCommandQuery = { + filters?: string | undefined; + status?: "true" | "false"; +}; +export type ServiceListCommandInput = ServiceListCommandQuery; +export type ServiceListCommandOutput = readonly { + ID?: string; + Version?: { + Index?: number; + }; + CreatedAt?: string; + UpdatedAt?: string; + Spec?: { + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + TaskTemplate?: { + PluginSpec?: { + Name?: string; + Remote?: string; + Disabled?: boolean; + PluginPrivilege?: readonly { + Name?: string; + Description?: string; + Value?: readonly string[]; + }[]; + }; + ContainerSpec?: { + Image?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Command?: readonly string[]; + Args?: readonly string[]; + Hostname?: string; + Env?: readonly string[]; + Dir?: string; + User?: string; + Groups?: readonly string[]; + Privileges?: { + CredentialSpec?: { + /** + * Load credential spec from a Swarm Config with the given ID. + * The specified config must also be present in the Configs + * field with the Runtime property set. + * + *


+ * + * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + * @example 0bt9dmxjvjiqermk6xrop3ekq + */ + Config?: string; + /** + * Load credential spec from this file. The file is read by + * the daemon, and must be present in the `CredentialSpecs` + * subdirectory in the docker data directory, which defaults + * to `C:\ProgramData\Docker\` on Windows. + * + * For example, specifying `spec.json` loads + * `C:\ProgramData\Docker\CredentialSpecs\spec.json`. + * + *


+ * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + * @example spec.json + */ + File?: string; + Registry?: string; + }; + SELinuxContext?: { + Disable?: boolean; + User?: string; + Role?: string; + Type?: string; + Level?: string; + }; + }; + TTY?: boolean; + OpenStdin?: boolean; + ReadOnly?: boolean; + Mounts?: readonly { + Target?: string; + Source?: string; + /** + * The mount type. Available types: + * + * - `bind` Mounts a file or directory from the host into the container. Must + * exist prior to creating the container. + * - `volume` Creates a volume with the given name and options (or uses a + * pre-existing volume with the same name and options). These are **not** + * removed when the container is removed. + * - `tmpfs` Create a tmpfs with the given options. The mount source cannot be + * specified for tmpfs. + * - `npipe` Mounts a named pipe from the host into the container. Must exist + * prior to creating the container. + * - `cluster` a Swarm cluster volume + * @enum bind,volume,tmpfs,npipe,cluster + */ + Type?: "bind" | "volume" | "tmpfs" | "npipe" | "cluster"; + ReadOnly?: boolean; + Consistency?: string; + BindOptions?: { + /** + * A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + * @enum private,rprivate,shared,rshared,slave,rslave + */ + Propagation?: + | "private" + | "rprivate" + | "shared" + | "rshared" + | "slave" + | "rslave"; + NonRecursive?: boolean; + CreateMountpoint?: boolean; + }; + VolumeOptions?: { + NoCopy?: boolean; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + DriverConfig?: { + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; + TmpfsOptions?: { + SizeBytes?: number; + Mode?: number; + }; + }[]; + StopSignal?: string; + StopGracePeriod?: number; + HealthCheck?: { + Test?: readonly string[]; + Interval?: number; + Timeout?: number; + Retries?: number; + StartPeriod?: number; + }; + Hosts?: readonly string[]; + DNSConfig?: { + Nameservers?: readonly string[]; + Search?: readonly string[]; + Options?: readonly string[]; + }; + Secrets?: readonly { + File?: { + Name?: string; + UID?: string; + GID?: string; + Mode?: number; + }; + SecretID?: string; + SecretName?: string; + }[]; + Configs?: readonly { + File?: { + Name?: string; + UID?: string; + GID?: string; + Mode?: number; + }; + Runtime?: {}; + ConfigID?: string; + ConfigName?: string; + }[]; + /** + * Isolation technology of the containers running the service. + * (Windows only) + * @enum default,process,hyperv, + */ + Isolation?: "default" | "process" | "hyperv" | ""; + Init?: boolean | null; + Sysctls?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * A list of kernel capabilities to add to the default set + * for the container. + * @example CAP_NET_RAW,CAP_SYS_ADMIN,CAP_SYS_CHROOT,CAP_SYSLOG + */ + CapabilityAdd?: readonly string[]; + /** + * A list of kernel capabilities to drop from the default set + * for the container. + * @example CAP_NET_RAW + */ + CapabilityDrop?: readonly string[]; + Ulimits?: readonly { + Name?: string; + Soft?: number; + Hard?: number; + }[]; + }; + NetworkAttachmentSpec?: { + ContainerID?: string; + }; + Resources?: { + Limits?: { + NanoCPUs?: number; + MemoryBytes?: number; + /** + * Limits the maximum number of PIDs in the container. Set `0` for unlimited. + * @example 100 + */ + Pids?: number; + }; + Reservations?: { + NanoCPUs?: number; + MemoryBytes?: number; + /** + * User-defined resources can be either Integer resources (e.g, `SSD=3`) or + * String resources (e.g, `GPU=UUID1`). + * @example [object Object],[object Object],[object Object] + */ + GenericResources?: readonly { + NamedResourceSpec?: { + Kind?: string; + Value?: string; + }; + DiscreteResourceSpec?: { + Kind?: string; + Value?: number; + }; + }[]; + }; + }; + RestartPolicy?: { + /** + * Condition for restart. + * @enum none,on-failure,any + */ + Condition?: "none" | "on-failure" | "any"; + Delay?: number; + MaxAttempts?: number; + Window?: number; + }; + Placement?: { + /** + * An array of constraint expressions to limit the set of nodes where + * a task can be scheduled. Constraint expressions can either use a + * _match_ (`==`) or _exclude_ (`!=`) rule. Multiple constraints find + * nodes that satisfy every expression (AND match). Constraints can + * match node or Docker Engine labels as follows: + * + * node attribute | matches | example + * ---------------------|--------------------------------|----------------------------------------------- + * `node.id` | Node ID | + * `node.id==2ivku8v2gvtg4` + * `node.hostname` | Node hostname | + * `node.hostname!=node-2` + * `node.role` | Node role (`manager`/`worker`) | + * `node.role==manager` + * `node.platform.os` | Node operating system | + * `node.platform.os==windows` + * `node.platform.arch` | Node architecture | + * `node.platform.arch==x86_64` + * `node.labels` | User-defined node labels | + * `node.labels.security==high` + * `engine.labels` | Docker Engine's labels | + * `engine.labels.operatingsystem==ubuntu-14.04` + * + * `engine.labels` apply to Docker Engine labels like operating system, + * drivers, etc. Swarm administrators add `node.labels` for operational + * purposes by using the [`node update endpoint`](#operation/NodeUpdate). + * @example node.hostname!=node3.corp.example.com,node.role!=manager,node.labels.type==production,node.platform.os==linux,node.platform.arch==x86_64 + */ + Constraints?: readonly string[]; + /** + * Preferences provide a way to make the scheduler aware of factors + * such as topology. They are provided in order from highest to + * lowest precedence. + * @example [object Object],[object Object] + */ + Preferences?: readonly { + Spread?: { + SpreadDescriptor?: string; + }; + }[]; + MaxReplicas?: number; + Platforms?: readonly { + /** + * Architecture represents the hardware architecture (for example, + * `x86_64`). + * @example x86_64 + */ + Architecture?: string; + /** + * OS represents the Operating System (for example, `linux` or `windows`). + * @example linux + */ + OS?: string; + }[]; + }; + ForceUpdate?: number; + Runtime?: string; + Networks?: readonly { + Target?: string; + Aliases?: readonly string[]; + DriverOpts?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; + LogDriver?: { + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; + Mode?: { + Replicated?: { + Replicas?: number; + }; + Global?: {}; + ReplicatedJob?: { + /** + * The maximum number of replicas to run simultaneously. + * @default 1 + */ + MaxConcurrent?: number; + TotalCompletions?: number; + }; + GlobalJob?: {}; + }; + UpdateConfig?: { + Parallelism?: number; + Delay?: number; + /** + * Action to take if an updated task fails to run, or stops running + * during the update. + * @enum continue,pause,rollback + */ + FailureAction?: "continue" | "pause" | "rollback"; + Monitor?: number; + MaxFailureRatio?: number; + /** + * The order of operations when rolling out an updated task. Either + * the old task is shut down before the new task is started, or the + * new task is started before the old task is shut down. + * @enum stop-first,start-first + */ + Order?: "stop-first" | "start-first"; + }; + RollbackConfig?: { + Parallelism?: number; + Delay?: number; + /** + * Action to take if an rolled back task fails to run, or stops + * running during the rollback. + * @enum continue,pause + */ + FailureAction?: "continue" | "pause"; + Monitor?: number; + MaxFailureRatio?: number; + /** + * The order of operations when rolling back a task. Either the old + * task is shut down before the new task is started, or the new task + * is started before the old task is shut down. + * @enum stop-first,start-first + */ + Order?: "stop-first" | "start-first"; + }; + Networks?: readonly { + Target?: string; + Aliases?: readonly string[]; + DriverOpts?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; + EndpointSpec?: { + /** + * The mode of resolution to use for internal load balancing between tasks. + * @default vip + * @enum vip,dnsrr + */ + Mode?: "vip" | "dnsrr"; + Ports?: readonly { + Name?: string; + Protocol?: "tcp" | "udp" | "sctp"; + TargetPort?: number; + PublishedPort?: number; + /** + * The mode in which port is published. + * + *


+ * + * - "ingress" makes the target port accessible on every node, + * + * regardless of whether there is a task for the service running on + * + * that node or not. + * - "host" bypasses the routing mesh and publish the port directly on + * + * the swarm node where that service is running. + * @default ingress + * @enum ingress,host + * @example ingress + */ + PublishMode?: "ingress" | "host"; + }[]; + }; + }; + Endpoint?: { + Spec?: { + /** + * The mode of resolution to use for internal load balancing between tasks. + * @default vip + * @enum vip,dnsrr + */ + Mode?: "vip" | "dnsrr"; + Ports?: readonly { + Name?: string; + Protocol?: "tcp" | "udp" | "sctp"; + TargetPort?: number; + PublishedPort?: number; + /** + * The mode in which port is published. + * + *


+ * + * - "ingress" makes the target port accessible on every node, + * + * regardless of whether there is a task for the service running on + * + * that node or not. + * - "host" bypasses the routing mesh and publish the port directly on + * + * the swarm node where that service is running. + * @default ingress + * @enum ingress,host + * @example ingress + */ + PublishMode?: "ingress" | "host"; + }[]; + }; + Ports?: readonly { + Name?: string; + Protocol?: "tcp" | "udp" | "sctp"; + TargetPort?: number; + PublishedPort?: number; + /** + * The mode in which port is published. + * + *


+ * + * - "ingress" makes the target port accessible on every node, + * + * regardless of whether there is a task for the service running on + * + * that node or not. + * - "host" bypasses the routing mesh and publish the port directly on + * + * the swarm node where that service is running. + * @default ingress + * @enum ingress,host + * @example ingress + */ + PublishMode?: "ingress" | "host"; + }[]; + VirtualIPs?: readonly { + NetworkID?: string; + Addr?: string; + }[]; + }; + UpdateStatus?: { + State?: "updating" | "paused" | "completed"; + StartedAt?: string; + CompletedAt?: string; + Message?: string; + }; + ServiceStatus?: { + /** + * The number of tasks for the service currently in the Running state. + * @example 7 + */ + RunningTasks?: number; + /** + * The number of tasks for the service desired to be running. + * For replicated services, this is the replica count from the + * service spec. For global services, this is computed by taking + * count of all tasks for the service with a Desired State other + * than Shutdown. + * @example 10 + */ + DesiredTasks?: number; + CompletedTasks?: number; + }; + JobStatus?: { + JobIteration?: { + Index?: number; + }; + LastExecution?: string; + }; +}[]; +type ServiceCreateJsonBody = { + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + TaskTemplate?: { + PluginSpec?: { + Name?: string; + Remote?: string; + Disabled?: boolean; + PluginPrivilege?: readonly { + Name?: string; + Description?: string; + Value?: readonly string[]; + }[]; + }; + ContainerSpec?: { + Image?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Command?: readonly string[]; + Args?: readonly string[]; + Hostname?: string; + Env?: readonly string[]; + Dir?: string; + User?: string; + Groups?: readonly string[]; + Privileges?: { + CredentialSpec?: { + /** + * Load credential spec from a Swarm Config with the given ID. + * The specified config must also be present in the Configs + * field with the Runtime property set. + * + *


+ * + * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + * @example 0bt9dmxjvjiqermk6xrop3ekq + */ + Config?: string; + /** + * Load credential spec from this file. The file is read by + * the daemon, and must be present in the `CredentialSpecs` + * subdirectory in the docker data directory, which defaults + * to `C:\ProgramData\Docker\` on Windows. + * + * For example, specifying `spec.json` loads + * `C:\ProgramData\Docker\CredentialSpecs\spec.json`. + * + *


+ * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + * @example spec.json + */ + File?: string; + Registry?: string; + }; + SELinuxContext?: { + Disable?: boolean; + User?: string; + Role?: string; + Type?: string; + Level?: string; + }; + }; + TTY?: boolean; + OpenStdin?: boolean; + ReadOnly?: boolean; + Mounts?: readonly { + Target?: string; + Source?: string; + /** + * The mount type. Available types: + * + * - `bind` Mounts a file or directory from the host into the container. Must + * exist prior to creating the container. + * - `volume` Creates a volume with the given name and options (or uses a + * pre-existing volume with the same name and options). These are **not** + * removed when the container is removed. + * - `tmpfs` Create a tmpfs with the given options. The mount source cannot be + * specified for tmpfs. + * - `npipe` Mounts a named pipe from the host into the container. Must exist + * prior to creating the container. + * - `cluster` a Swarm cluster volume + * @enum bind,volume,tmpfs,npipe,cluster + */ + Type?: "bind" | "volume" | "tmpfs" | "npipe" | "cluster"; + ReadOnly?: boolean; + Consistency?: string; + BindOptions?: { + /** + * A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + * @enum private,rprivate,shared,rshared,slave,rslave + */ + Propagation?: + | "private" + | "rprivate" + | "shared" + | "rshared" + | "slave" + | "rslave"; + NonRecursive?: boolean; + CreateMountpoint?: boolean; + }; + VolumeOptions?: { + NoCopy?: boolean; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + DriverConfig?: { + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; + TmpfsOptions?: { + SizeBytes?: number; + Mode?: number; + }; + }[]; + StopSignal?: string; + StopGracePeriod?: number; + HealthCheck?: { + Test?: readonly string[]; + Interval?: number; + Timeout?: number; + Retries?: number; + StartPeriod?: number; + }; + Hosts?: readonly string[]; + DNSConfig?: { + Nameservers?: readonly string[]; + Search?: readonly string[]; + Options?: readonly string[]; + }; + Secrets?: readonly { + File?: { + Name?: string; + UID?: string; + GID?: string; + Mode?: number; + }; + SecretID?: string; + SecretName?: string; + }[]; + Configs?: readonly { + File?: { + Name?: string; + UID?: string; + GID?: string; + Mode?: number; + }; + Runtime?: {}; + ConfigID?: string; + ConfigName?: string; + }[]; + /** + * Isolation technology of the containers running the service. + * (Windows only) + * @enum default,process,hyperv, + */ + Isolation?: "default" | "process" | "hyperv" | ""; + Init?: boolean | null; + Sysctls?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * A list of kernel capabilities to add to the default set + * for the container. + * @example CAP_NET_RAW,CAP_SYS_ADMIN,CAP_SYS_CHROOT,CAP_SYSLOG + */ + CapabilityAdd?: readonly string[]; + /** + * A list of kernel capabilities to drop from the default set + * for the container. + * @example CAP_NET_RAW + */ + CapabilityDrop?: readonly string[]; + Ulimits?: readonly { + Name?: string; + Soft?: number; + Hard?: number; + }[]; + }; + NetworkAttachmentSpec?: { + ContainerID?: string; + }; + Resources?: { + Limits?: { + NanoCPUs?: number; + MemoryBytes?: number; + /** + * Limits the maximum number of PIDs in the container. Set `0` for unlimited. + * @example 100 + */ + Pids?: number; + }; + Reservations?: { + NanoCPUs?: number; + MemoryBytes?: number; + /** + * User-defined resources can be either Integer resources (e.g, `SSD=3`) or + * String resources (e.g, `GPU=UUID1`). + * @example [object Object],[object Object],[object Object] + */ + GenericResources?: readonly { + NamedResourceSpec?: { + Kind?: string; + Value?: string; + }; + DiscreteResourceSpec?: { + Kind?: string; + Value?: number; + }; + }[]; + }; + }; + RestartPolicy?: { + /** + * Condition for restart. + * @enum none,on-failure,any + */ + Condition?: "none" | "on-failure" | "any"; + Delay?: number; + MaxAttempts?: number; + Window?: number; + }; + Placement?: { + /** + * An array of constraint expressions to limit the set of nodes where + * a task can be scheduled. Constraint expressions can either use a + * _match_ (`==`) or _exclude_ (`!=`) rule. Multiple constraints find + * nodes that satisfy every expression (AND match). Constraints can + * match node or Docker Engine labels as follows: + * + * node attribute | matches | example + * ---------------------|--------------------------------|----------------------------------------------- + * `node.id` | Node ID | + * `node.id==2ivku8v2gvtg4` + * `node.hostname` | Node hostname | + * `node.hostname!=node-2` + * `node.role` | Node role (`manager`/`worker`) | + * `node.role==manager` + * `node.platform.os` | Node operating system | + * `node.platform.os==windows` + * `node.platform.arch` | Node architecture | + * `node.platform.arch==x86_64` + * `node.labels` | User-defined node labels | + * `node.labels.security==high` + * `engine.labels` | Docker Engine's labels | + * `engine.labels.operatingsystem==ubuntu-14.04` + * + * `engine.labels` apply to Docker Engine labels like operating system, + * drivers, etc. Swarm administrators add `node.labels` for operational + * purposes by using the [`node update endpoint`](#operation/NodeUpdate). + * @example node.hostname!=node3.corp.example.com,node.role!=manager,node.labels.type==production,node.platform.os==linux,node.platform.arch==x86_64 + */ + Constraints?: readonly string[]; + /** + * Preferences provide a way to make the scheduler aware of factors + * such as topology. They are provided in order from highest to + * lowest precedence. + * @example [object Object],[object Object] + */ + Preferences?: readonly { + Spread?: { + SpreadDescriptor?: string; + }; + }[]; + MaxReplicas?: number; + Platforms?: readonly { + /** + * Architecture represents the hardware architecture (for example, + * `x86_64`). + * @example x86_64 + */ + Architecture?: string; + /** + * OS represents the Operating System (for example, `linux` or `windows`). + * @example linux + */ + OS?: string; + }[]; + }; + ForceUpdate?: number; + Runtime?: string; + Networks?: readonly { + Target?: string; + Aliases?: readonly string[]; + DriverOpts?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; + LogDriver?: { + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; + Mode?: { + Replicated?: { + Replicas?: number; + }; + Global?: {}; + ReplicatedJob?: { + /** + * The maximum number of replicas to run simultaneously. + * @default 1 + */ + MaxConcurrent?: number; + TotalCompletions?: number; + }; + GlobalJob?: {}; + }; + UpdateConfig?: { + Parallelism?: number; + Delay?: number; + /** + * Action to take if an updated task fails to run, or stops running + * during the update. + * @enum continue,pause,rollback + */ + FailureAction?: "continue" | "pause" | "rollback"; + Monitor?: number; + MaxFailureRatio?: number; + /** + * The order of operations when rolling out an updated task. Either + * the old task is shut down before the new task is started, or the + * new task is started before the old task is shut down. + * @enum stop-first,start-first + */ + Order?: "stop-first" | "start-first"; + }; + RollbackConfig?: { + Parallelism?: number; + Delay?: number; + /** + * Action to take if an rolled back task fails to run, or stops + * running during the rollback. + * @enum continue,pause + */ + FailureAction?: "continue" | "pause"; + Monitor?: number; + MaxFailureRatio?: number; + /** + * The order of operations when rolling back a task. Either the old + * task is shut down before the new task is started, or the new task + * is started before the old task is shut down. + * @enum stop-first,start-first + */ + Order?: "stop-first" | "start-first"; + }; + Networks?: readonly { + Target?: string; + Aliases?: readonly string[]; + DriverOpts?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; + EndpointSpec?: { + /** + * The mode of resolution to use for internal load balancing between tasks. + * @default vip + * @enum vip,dnsrr + */ + Mode?: "vip" | "dnsrr"; + Ports?: readonly { + Name?: string; + Protocol?: "tcp" | "udp" | "sctp"; + TargetPort?: number; + PublishedPort?: number; + /** + * The mode in which port is published. + * + *


+ * + * - "ingress" makes the target port accessible on every node, + * + * regardless of whether there is a task for the service running on + * + * that node or not. + * - "host" bypasses the routing mesh and publish the port directly on + * + * the swarm node where that service is running. + * @default ingress + * @enum ingress,host + * @example ingress + */ + PublishMode?: "ingress" | "host"; + }[]; + }; +} & Record; +export type ServiceCreateCommandBody = ServiceCreateJsonBody; +export type ServiceCreateCommandInput = ServiceCreateJsonBody; +export type ServiceCreateCommandOutput = { + ID?: string; + Warning?: string; +}; +export type ServiceInspectCommandQuery = { + insertDefaults?: "true" | "false"; +}; +export type ServiceInspectCommandParams = { + id: string; +}; +export type ServiceInspectCommandInput = ServiceInspectCommandParams & + ServiceInspectCommandQuery; +export type ServiceInspectCommandOutput = { + ID?: string; + Version?: { + Index?: number; + }; + CreatedAt?: string; + UpdatedAt?: string; + Spec?: { + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + TaskTemplate?: { + PluginSpec?: { + Name?: string; + Remote?: string; + Disabled?: boolean; + PluginPrivilege?: readonly { + Name?: string; + Description?: string; + Value?: readonly string[]; + }[]; + }; + ContainerSpec?: { + Image?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Command?: readonly string[]; + Args?: readonly string[]; + Hostname?: string; + Env?: readonly string[]; + Dir?: string; + User?: string; + Groups?: readonly string[]; + Privileges?: { + CredentialSpec?: { + /** + * Load credential spec from a Swarm Config with the given ID. + * The specified config must also be present in the Configs + * field with the Runtime property set. + * + *


+ * + * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + * @example 0bt9dmxjvjiqermk6xrop3ekq + */ + Config?: string; + /** + * Load credential spec from this file. The file is read by + * the daemon, and must be present in the `CredentialSpecs` + * subdirectory in the docker data directory, which defaults + * to `C:\ProgramData\Docker\` on Windows. + * + * For example, specifying `spec.json` loads + * `C:\ProgramData\Docker\CredentialSpecs\spec.json`. + * + *


+ * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + * @example spec.json + */ + File?: string; + Registry?: string; + }; + SELinuxContext?: { + Disable?: boolean; + User?: string; + Role?: string; + Type?: string; + Level?: string; + }; + }; + TTY?: boolean; + OpenStdin?: boolean; + ReadOnly?: boolean; + Mounts?: readonly { + Target?: string; + Source?: string; + /** + * The mount type. Available types: + * + * - `bind` Mounts a file or directory from the host into the container. Must + * exist prior to creating the container. + * - `volume` Creates a volume with the given name and options (or uses a + * pre-existing volume with the same name and options). These are **not** + * removed when the container is removed. + * - `tmpfs` Create a tmpfs with the given options. The mount source cannot be + * specified for tmpfs. + * - `npipe` Mounts a named pipe from the host into the container. Must exist + * prior to creating the container. + * - `cluster` a Swarm cluster volume + * @enum bind,volume,tmpfs,npipe,cluster + */ + Type?: "bind" | "volume" | "tmpfs" | "npipe" | "cluster"; + ReadOnly?: boolean; + Consistency?: string; + BindOptions?: { + /** + * A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + * @enum private,rprivate,shared,rshared,slave,rslave + */ + Propagation?: + | "private" + | "rprivate" + | "shared" + | "rshared" + | "slave" + | "rslave"; + NonRecursive?: boolean; + CreateMountpoint?: boolean; + }; + VolumeOptions?: { + NoCopy?: boolean; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + DriverConfig?: { + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; + TmpfsOptions?: { + SizeBytes?: number; + Mode?: number; + }; + }[]; + StopSignal?: string; + StopGracePeriod?: number; + HealthCheck?: { + Test?: readonly string[]; + Interval?: number; + Timeout?: number; + Retries?: number; + StartPeriod?: number; + }; + Hosts?: readonly string[]; + DNSConfig?: { + Nameservers?: readonly string[]; + Search?: readonly string[]; + Options?: readonly string[]; + }; + Secrets?: readonly { + File?: { + Name?: string; + UID?: string; + GID?: string; + Mode?: number; + }; + SecretID?: string; + SecretName?: string; + }[]; + Configs?: readonly { + File?: { + Name?: string; + UID?: string; + GID?: string; + Mode?: number; + }; + Runtime?: {}; + ConfigID?: string; + ConfigName?: string; + }[]; + /** + * Isolation technology of the containers running the service. + * (Windows only) + * @enum default,process,hyperv, + */ + Isolation?: "default" | "process" | "hyperv" | ""; + Init?: boolean | null; + Sysctls?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * A list of kernel capabilities to add to the default set + * for the container. + * @example CAP_NET_RAW,CAP_SYS_ADMIN,CAP_SYS_CHROOT,CAP_SYSLOG + */ + CapabilityAdd?: readonly string[]; + /** + * A list of kernel capabilities to drop from the default set + * for the container. + * @example CAP_NET_RAW + */ + CapabilityDrop?: readonly string[]; + Ulimits?: readonly { + Name?: string; + Soft?: number; + Hard?: number; + }[]; + }; + NetworkAttachmentSpec?: { + ContainerID?: string; + }; + Resources?: { + Limits?: { + NanoCPUs?: number; + MemoryBytes?: number; + /** + * Limits the maximum number of PIDs in the container. Set `0` for unlimited. + * @example 100 + */ + Pids?: number; + }; + Reservations?: { + NanoCPUs?: number; + MemoryBytes?: number; + /** + * User-defined resources can be either Integer resources (e.g, `SSD=3`) or + * String resources (e.g, `GPU=UUID1`). + * @example [object Object],[object Object],[object Object] + */ + GenericResources?: readonly { + NamedResourceSpec?: { + Kind?: string; + Value?: string; + }; + DiscreteResourceSpec?: { + Kind?: string; + Value?: number; + }; + }[]; + }; + }; + RestartPolicy?: { + /** + * Condition for restart. + * @enum none,on-failure,any + */ + Condition?: "none" | "on-failure" | "any"; + Delay?: number; + MaxAttempts?: number; + Window?: number; + }; + Placement?: { + /** + * An array of constraint expressions to limit the set of nodes where + * a task can be scheduled. Constraint expressions can either use a + * _match_ (`==`) or _exclude_ (`!=`) rule. Multiple constraints find + * nodes that satisfy every expression (AND match). Constraints can + * match node or Docker Engine labels as follows: + * + * node attribute | matches | example + * ---------------------|--------------------------------|----------------------------------------------- + * `node.id` | Node ID | + * `node.id==2ivku8v2gvtg4` + * `node.hostname` | Node hostname | + * `node.hostname!=node-2` + * `node.role` | Node role (`manager`/`worker`) | + * `node.role==manager` + * `node.platform.os` | Node operating system | + * `node.platform.os==windows` + * `node.platform.arch` | Node architecture | + * `node.platform.arch==x86_64` + * `node.labels` | User-defined node labels | + * `node.labels.security==high` + * `engine.labels` | Docker Engine's labels | + * `engine.labels.operatingsystem==ubuntu-14.04` + * + * `engine.labels` apply to Docker Engine labels like operating system, + * drivers, etc. Swarm administrators add `node.labels` for operational + * purposes by using the [`node update endpoint`](#operation/NodeUpdate). + * @example node.hostname!=node3.corp.example.com,node.role!=manager,node.labels.type==production,node.platform.os==linux,node.platform.arch==x86_64 + */ + Constraints?: readonly string[]; + /** + * Preferences provide a way to make the scheduler aware of factors + * such as topology. They are provided in order from highest to + * lowest precedence. + * @example [object Object],[object Object] + */ + Preferences?: readonly { + Spread?: { + SpreadDescriptor?: string; + }; + }[]; + MaxReplicas?: number; + Platforms?: readonly { + /** + * Architecture represents the hardware architecture (for example, + * `x86_64`). + * @example x86_64 + */ + Architecture?: string; + /** + * OS represents the Operating System (for example, `linux` or `windows`). + * @example linux + */ + OS?: string; + }[]; + }; + ForceUpdate?: number; + Runtime?: string; + Networks?: readonly { + Target?: string; + Aliases?: readonly string[]; + DriverOpts?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; + LogDriver?: { + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; + Mode?: { + Replicated?: { + Replicas?: number; + }; + Global?: {}; + ReplicatedJob?: { + /** + * The maximum number of replicas to run simultaneously. + * @default 1 + */ + MaxConcurrent?: number; + TotalCompletions?: number; + }; + GlobalJob?: {}; + }; + UpdateConfig?: { + Parallelism?: number; + Delay?: number; + /** + * Action to take if an updated task fails to run, or stops running + * during the update. + * @enum continue,pause,rollback + */ + FailureAction?: "continue" | "pause" | "rollback"; + Monitor?: number; + MaxFailureRatio?: number; + /** + * The order of operations when rolling out an updated task. Either + * the old task is shut down before the new task is started, or the + * new task is started before the old task is shut down. + * @enum stop-first,start-first + */ + Order?: "stop-first" | "start-first"; + }; + RollbackConfig?: { + Parallelism?: number; + Delay?: number; + /** + * Action to take if an rolled back task fails to run, or stops + * running during the rollback. + * @enum continue,pause + */ + FailureAction?: "continue" | "pause"; + Monitor?: number; + MaxFailureRatio?: number; + /** + * The order of operations when rolling back a task. Either the old + * task is shut down before the new task is started, or the new task + * is started before the old task is shut down. + * @enum stop-first,start-first + */ + Order?: "stop-first" | "start-first"; + }; + Networks?: readonly { + Target?: string; + Aliases?: readonly string[]; + DriverOpts?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; + EndpointSpec?: { + /** + * The mode of resolution to use for internal load balancing between tasks. + * @default vip + * @enum vip,dnsrr + */ + Mode?: "vip" | "dnsrr"; + Ports?: readonly { + Name?: string; + Protocol?: "tcp" | "udp" | "sctp"; + TargetPort?: number; + PublishedPort?: number; + /** + * The mode in which port is published. + * + *


+ * + * - "ingress" makes the target port accessible on every node, + * + * regardless of whether there is a task for the service running on + * + * that node or not. + * - "host" bypasses the routing mesh and publish the port directly on + * + * the swarm node where that service is running. + * @default ingress + * @enum ingress,host + * @example ingress + */ + PublishMode?: "ingress" | "host"; + }[]; + }; + }; + Endpoint?: { + Spec?: { + /** + * The mode of resolution to use for internal load balancing between tasks. + * @default vip + * @enum vip,dnsrr + */ + Mode?: "vip" | "dnsrr"; + Ports?: readonly { + Name?: string; + Protocol?: "tcp" | "udp" | "sctp"; + TargetPort?: number; + PublishedPort?: number; + /** + * The mode in which port is published. + * + *


+ * + * - "ingress" makes the target port accessible on every node, + * + * regardless of whether there is a task for the service running on + * + * that node or not. + * - "host" bypasses the routing mesh and publish the port directly on + * + * the swarm node where that service is running. + * @default ingress + * @enum ingress,host + * @example ingress + */ + PublishMode?: "ingress" | "host"; + }[]; + }; + Ports?: readonly { + Name?: string; + Protocol?: "tcp" | "udp" | "sctp"; + TargetPort?: number; + PublishedPort?: number; + /** + * The mode in which port is published. + * + *


+ * + * - "ingress" makes the target port accessible on every node, + * + * regardless of whether there is a task for the service running on + * + * that node or not. + * - "host" bypasses the routing mesh and publish the port directly on + * + * the swarm node where that service is running. + * @default ingress + * @enum ingress,host + * @example ingress + */ + PublishMode?: "ingress" | "host"; + }[]; + VirtualIPs?: readonly { + NetworkID?: string; + Addr?: string; + }[]; + }; + UpdateStatus?: { + State?: "updating" | "paused" | "completed"; + StartedAt?: string; + CompletedAt?: string; + Message?: string; + }; + ServiceStatus?: { + /** + * The number of tasks for the service currently in the Running state. + * @example 7 + */ + RunningTasks?: number; + /** + * The number of tasks for the service desired to be running. + * For replicated services, this is the replica count from the + * service spec. For global services, this is computed by taking + * count of all tasks for the service with a Desired State other + * than Shutdown. + * @example 10 + */ + DesiredTasks?: number; + CompletedTasks?: number; + }; + JobStatus?: { + JobIteration?: { + Index?: number; + }; + LastExecution?: string; + }; +}; +export type ServiceDeleteCommandParams = { + id: string; +}; +export type ServiceDeleteCommandInput = ServiceDeleteCommandParams; +export type ServiceUpdateCommandQuery = { + version: `${number}`; + registryAuthFrom?: "spec" | "previous-spec"; + rollback?: string | undefined; +}; +type ServiceUpdateJsonBody = { + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + TaskTemplate?: { + PluginSpec?: { + Name?: string; + Remote?: string; + Disabled?: boolean; + PluginPrivilege?: readonly { + Name?: string; + Description?: string; + Value?: readonly string[]; + }[]; + }; + ContainerSpec?: { + Image?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Command?: readonly string[]; + Args?: readonly string[]; + Hostname?: string; + Env?: readonly string[]; + Dir?: string; + User?: string; + Groups?: readonly string[]; + Privileges?: { + CredentialSpec?: { + /** + * Load credential spec from a Swarm Config with the given ID. + * The specified config must also be present in the Configs + * field with the Runtime property set. + * + *


+ * + * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + * @example 0bt9dmxjvjiqermk6xrop3ekq + */ + Config?: string; + /** + * Load credential spec from this file. The file is read by + * the daemon, and must be present in the `CredentialSpecs` + * subdirectory in the docker data directory, which defaults + * to `C:\ProgramData\Docker\` on Windows. + * + * For example, specifying `spec.json` loads + * `C:\ProgramData\Docker\CredentialSpecs\spec.json`. + * + *


+ * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + * @example spec.json + */ + File?: string; + Registry?: string; + }; + SELinuxContext?: { + Disable?: boolean; + User?: string; + Role?: string; + Type?: string; + Level?: string; + }; + }; + TTY?: boolean; + OpenStdin?: boolean; + ReadOnly?: boolean; + Mounts?: readonly { + Target?: string; + Source?: string; + /** + * The mount type. Available types: + * + * - `bind` Mounts a file or directory from the host into the container. Must + * exist prior to creating the container. + * - `volume` Creates a volume with the given name and options (or uses a + * pre-existing volume with the same name and options). These are **not** + * removed when the container is removed. + * - `tmpfs` Create a tmpfs with the given options. The mount source cannot be + * specified for tmpfs. + * - `npipe` Mounts a named pipe from the host into the container. Must exist + * prior to creating the container. + * - `cluster` a Swarm cluster volume + * @enum bind,volume,tmpfs,npipe,cluster + */ + Type?: "bind" | "volume" | "tmpfs" | "npipe" | "cluster"; + ReadOnly?: boolean; + Consistency?: string; + BindOptions?: { + /** + * A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + * @enum private,rprivate,shared,rshared,slave,rslave + */ + Propagation?: + | "private" + | "rprivate" + | "shared" + | "rshared" + | "slave" + | "rslave"; + NonRecursive?: boolean; + CreateMountpoint?: boolean; + }; + VolumeOptions?: { + NoCopy?: boolean; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + DriverConfig?: { + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; + TmpfsOptions?: { + SizeBytes?: number; + Mode?: number; + }; + }[]; + StopSignal?: string; + StopGracePeriod?: number; + HealthCheck?: { + Test?: readonly string[]; + Interval?: number; + Timeout?: number; + Retries?: number; + StartPeriod?: number; + }; + Hosts?: readonly string[]; + DNSConfig?: { + Nameservers?: readonly string[]; + Search?: readonly string[]; + Options?: readonly string[]; + }; + Secrets?: readonly { + File?: { + Name?: string; + UID?: string; + GID?: string; + Mode?: number; + }; + SecretID?: string; + SecretName?: string; + }[]; + Configs?: readonly { + File?: { + Name?: string; + UID?: string; + GID?: string; + Mode?: number; + }; + Runtime?: {}; + ConfigID?: string; + ConfigName?: string; + }[]; + /** + * Isolation technology of the containers running the service. + * (Windows only) + * @enum default,process,hyperv, + */ + Isolation?: "default" | "process" | "hyperv" | ""; + Init?: boolean | null; + Sysctls?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * A list of kernel capabilities to add to the default set + * for the container. + * @example CAP_NET_RAW,CAP_SYS_ADMIN,CAP_SYS_CHROOT,CAP_SYSLOG + */ + CapabilityAdd?: readonly string[]; + /** + * A list of kernel capabilities to drop from the default set + * for the container. + * @example CAP_NET_RAW + */ + CapabilityDrop?: readonly string[]; + Ulimits?: readonly { + Name?: string; + Soft?: number; + Hard?: number; + }[]; + }; + NetworkAttachmentSpec?: { + ContainerID?: string; + }; + Resources?: { + Limits?: { + NanoCPUs?: number; + MemoryBytes?: number; + /** + * Limits the maximum number of PIDs in the container. Set `0` for unlimited. + * @example 100 + */ + Pids?: number; + }; + Reservations?: { + NanoCPUs?: number; + MemoryBytes?: number; + /** + * User-defined resources can be either Integer resources (e.g, `SSD=3`) or + * String resources (e.g, `GPU=UUID1`). + * @example [object Object],[object Object],[object Object] + */ + GenericResources?: readonly { + NamedResourceSpec?: { + Kind?: string; + Value?: string; + }; + DiscreteResourceSpec?: { + Kind?: string; + Value?: number; + }; + }[]; + }; + }; + RestartPolicy?: { + /** + * Condition for restart. + * @enum none,on-failure,any + */ + Condition?: "none" | "on-failure" | "any"; + Delay?: number; + MaxAttempts?: number; + Window?: number; + }; + Placement?: { + /** + * An array of constraint expressions to limit the set of nodes where + * a task can be scheduled. Constraint expressions can either use a + * _match_ (`==`) or _exclude_ (`!=`) rule. Multiple constraints find + * nodes that satisfy every expression (AND match). Constraints can + * match node or Docker Engine labels as follows: + * + * node attribute | matches | example + * ---------------------|--------------------------------|----------------------------------------------- + * `node.id` | Node ID | + * `node.id==2ivku8v2gvtg4` + * `node.hostname` | Node hostname | + * `node.hostname!=node-2` + * `node.role` | Node role (`manager`/`worker`) | + * `node.role==manager` + * `node.platform.os` | Node operating system | + * `node.platform.os==windows` + * `node.platform.arch` | Node architecture | + * `node.platform.arch==x86_64` + * `node.labels` | User-defined node labels | + * `node.labels.security==high` + * `engine.labels` | Docker Engine's labels | + * `engine.labels.operatingsystem==ubuntu-14.04` + * + * `engine.labels` apply to Docker Engine labels like operating system, + * drivers, etc. Swarm administrators add `node.labels` for operational + * purposes by using the [`node update endpoint`](#operation/NodeUpdate). + * @example node.hostname!=node3.corp.example.com,node.role!=manager,node.labels.type==production,node.platform.os==linux,node.platform.arch==x86_64 + */ + Constraints?: readonly string[]; + /** + * Preferences provide a way to make the scheduler aware of factors + * such as topology. They are provided in order from highest to + * lowest precedence. + * @example [object Object],[object Object] + */ + Preferences?: readonly { + Spread?: { + SpreadDescriptor?: string; + }; + }[]; + MaxReplicas?: number; + Platforms?: readonly { + /** + * Architecture represents the hardware architecture (for example, + * `x86_64`). + * @example x86_64 + */ + Architecture?: string; + /** + * OS represents the Operating System (for example, `linux` or `windows`). + * @example linux + */ + OS?: string; + }[]; + }; + ForceUpdate?: number; + Runtime?: string; + Networks?: readonly { + Target?: string; + Aliases?: readonly string[]; + DriverOpts?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; + LogDriver?: { + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; + Mode?: { + Replicated?: { + Replicas?: number; + }; + Global?: {}; + ReplicatedJob?: { + /** + * The maximum number of replicas to run simultaneously. + * @default 1 + */ + MaxConcurrent?: number; + TotalCompletions?: number; + }; + GlobalJob?: {}; + }; + UpdateConfig?: { + Parallelism?: number; + Delay?: number; + /** + * Action to take if an updated task fails to run, or stops running + * during the update. + * @enum continue,pause,rollback + */ + FailureAction?: "continue" | "pause" | "rollback"; + Monitor?: number; + MaxFailureRatio?: number; + /** + * The order of operations when rolling out an updated task. Either + * the old task is shut down before the new task is started, or the + * new task is started before the old task is shut down. + * @enum stop-first,start-first + */ + Order?: "stop-first" | "start-first"; + }; + RollbackConfig?: { + Parallelism?: number; + Delay?: number; + /** + * Action to take if an rolled back task fails to run, or stops + * running during the rollback. + * @enum continue,pause + */ + FailureAction?: "continue" | "pause"; + Monitor?: number; + MaxFailureRatio?: number; + /** + * The order of operations when rolling back a task. Either the old + * task is shut down before the new task is started, or the new task + * is started before the old task is shut down. + * @enum stop-first,start-first + */ + Order?: "stop-first" | "start-first"; + }; + Networks?: readonly { + Target?: string; + Aliases?: readonly string[]; + DriverOpts?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; + EndpointSpec?: { + /** + * The mode of resolution to use for internal load balancing between tasks. + * @default vip + * @enum vip,dnsrr + */ + Mode?: "vip" | "dnsrr"; + Ports?: readonly { + Name?: string; + Protocol?: "tcp" | "udp" | "sctp"; + TargetPort?: number; + PublishedPort?: number; + /** + * The mode in which port is published. + * + *


+ * + * - "ingress" makes the target port accessible on every node, + * + * regardless of whether there is a task for the service running on + * + * that node or not. + * - "host" bypasses the routing mesh and publish the port directly on + * + * the swarm node where that service is running. + * @default ingress + * @enum ingress,host + * @example ingress + */ + PublishMode?: "ingress" | "host"; + }[]; + }; +} & Record; +export type ServiceUpdateCommandParams = { + id: string; +}; +export type ServiceUpdateCommandBody = ServiceUpdateJsonBody; +export type ServiceUpdateCommandInput = ServiceUpdateJsonBody & + ServiceUpdateCommandParams & + ServiceUpdateCommandQuery; +export type ServiceUpdateCommandOutput = { + Warnings?: readonly string[]; +}; +export type ServiceLogsCommandQuery = { + details?: "true" | "false"; + follow?: "true" | "false"; + stdout?: "true" | "false"; + stderr?: "true" | "false"; + since?: `${number}` | undefined; + timestamps?: "true" | "false"; + tail?: string | undefined; +}; +export type ServiceLogsCommandParams = { + id: string; +}; +export type ServiceLogsCommandInput = ServiceLogsCommandParams & + ServiceLogsCommandQuery; +export type TaskListCommandQuery = { + filters?: string | undefined; +}; +export type TaskListCommandInput = TaskListCommandQuery; +export type TaskListCommandOutput = readonly { + ID?: string; + Version?: { + Index?: number; + }; + CreatedAt?: string; + UpdatedAt?: string; + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Spec?: { + PluginSpec?: { + Name?: string; + Remote?: string; + Disabled?: boolean; + PluginPrivilege?: readonly { + Name?: string; + Description?: string; + Value?: readonly string[]; + }[]; + }; + ContainerSpec?: { + Image?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Command?: readonly string[]; + Args?: readonly string[]; + Hostname?: string; + Env?: readonly string[]; + Dir?: string; + User?: string; + Groups?: readonly string[]; + Privileges?: { + CredentialSpec?: { + /** + * Load credential spec from a Swarm Config with the given ID. + * The specified config must also be present in the Configs + * field with the Runtime property set. + * + *


+ * + * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + * @example 0bt9dmxjvjiqermk6xrop3ekq + */ + Config?: string; + /** + * Load credential spec from this file. The file is read by + * the daemon, and must be present in the `CredentialSpecs` + * subdirectory in the docker data directory, which defaults + * to `C:\ProgramData\Docker\` on Windows. + * + * For example, specifying `spec.json` loads + * `C:\ProgramData\Docker\CredentialSpecs\spec.json`. + * + *


+ * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + * @example spec.json + */ + File?: string; + Registry?: string; + }; + SELinuxContext?: { + Disable?: boolean; + User?: string; + Role?: string; + Type?: string; + Level?: string; + }; + }; + TTY?: boolean; + OpenStdin?: boolean; + ReadOnly?: boolean; + Mounts?: readonly { + Target?: string; + Source?: string; + /** + * The mount type. Available types: + * + * - `bind` Mounts a file or directory from the host into the container. Must + * exist prior to creating the container. + * - `volume` Creates a volume with the given name and options (or uses a + * pre-existing volume with the same name and options). These are **not** + * removed when the container is removed. + * - `tmpfs` Create a tmpfs with the given options. The mount source cannot be + * specified for tmpfs. + * - `npipe` Mounts a named pipe from the host into the container. Must exist + * prior to creating the container. + * - `cluster` a Swarm cluster volume + * @enum bind,volume,tmpfs,npipe,cluster + */ + Type?: "bind" | "volume" | "tmpfs" | "npipe" | "cluster"; + ReadOnly?: boolean; + Consistency?: string; + BindOptions?: { + /** + * A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + * @enum private,rprivate,shared,rshared,slave,rslave + */ + Propagation?: + | "private" + | "rprivate" + | "shared" + | "rshared" + | "slave" + | "rslave"; + NonRecursive?: boolean; + CreateMountpoint?: boolean; + }; + VolumeOptions?: { + NoCopy?: boolean; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + DriverConfig?: { + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; + TmpfsOptions?: { + SizeBytes?: number; + Mode?: number; + }; + }[]; + StopSignal?: string; + StopGracePeriod?: number; + HealthCheck?: { + Test?: readonly string[]; + Interval?: number; + Timeout?: number; + Retries?: number; + StartPeriod?: number; + }; + Hosts?: readonly string[]; + DNSConfig?: { + Nameservers?: readonly string[]; + Search?: readonly string[]; + Options?: readonly string[]; + }; + Secrets?: readonly { + File?: { + Name?: string; + UID?: string; + GID?: string; + Mode?: number; + }; + SecretID?: string; + SecretName?: string; + }[]; + Configs?: readonly { + File?: { + Name?: string; + UID?: string; + GID?: string; + Mode?: number; + }; + Runtime?: {}; + ConfigID?: string; + ConfigName?: string; + }[]; + /** + * Isolation technology of the containers running the service. + * (Windows only) + * @enum default,process,hyperv, + */ + Isolation?: "default" | "process" | "hyperv" | ""; + Init?: boolean | null; + Sysctls?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * A list of kernel capabilities to add to the default set + * for the container. + * @example CAP_NET_RAW,CAP_SYS_ADMIN,CAP_SYS_CHROOT,CAP_SYSLOG + */ + CapabilityAdd?: readonly string[]; + /** + * A list of kernel capabilities to drop from the default set + * for the container. + * @example CAP_NET_RAW + */ + CapabilityDrop?: readonly string[]; + Ulimits?: readonly { + Name?: string; + Soft?: number; + Hard?: number; + }[]; + }; + NetworkAttachmentSpec?: { + ContainerID?: string; + }; + Resources?: { + Limits?: { + NanoCPUs?: number; + MemoryBytes?: number; + /** + * Limits the maximum number of PIDs in the container. Set `0` for unlimited. + * @example 100 + */ + Pids?: number; + }; + Reservations?: { + NanoCPUs?: number; + MemoryBytes?: number; + /** + * User-defined resources can be either Integer resources (e.g, `SSD=3`) or + * String resources (e.g, `GPU=UUID1`). + * @example [object Object],[object Object],[object Object] + */ + GenericResources?: readonly { + NamedResourceSpec?: { + Kind?: string; + Value?: string; + }; + DiscreteResourceSpec?: { + Kind?: string; + Value?: number; + }; + }[]; + }; + }; + RestartPolicy?: { + /** + * Condition for restart. + * @enum none,on-failure,any + */ + Condition?: "none" | "on-failure" | "any"; + Delay?: number; + MaxAttempts?: number; + Window?: number; + }; + Placement?: { + /** + * An array of constraint expressions to limit the set of nodes where + * a task can be scheduled. Constraint expressions can either use a + * _match_ (`==`) or _exclude_ (`!=`) rule. Multiple constraints find + * nodes that satisfy every expression (AND match). Constraints can + * match node or Docker Engine labels as follows: + * + * node attribute | matches | example + * ---------------------|--------------------------------|----------------------------------------------- + * `node.id` | Node ID | + * `node.id==2ivku8v2gvtg4` + * `node.hostname` | Node hostname | + * `node.hostname!=node-2` + * `node.role` | Node role (`manager`/`worker`) | + * `node.role==manager` + * `node.platform.os` | Node operating system | + * `node.platform.os==windows` + * `node.platform.arch` | Node architecture | + * `node.platform.arch==x86_64` + * `node.labels` | User-defined node labels | + * `node.labels.security==high` + * `engine.labels` | Docker Engine's labels | + * `engine.labels.operatingsystem==ubuntu-14.04` + * + * `engine.labels` apply to Docker Engine labels like operating system, + * drivers, etc. Swarm administrators add `node.labels` for operational + * purposes by using the [`node update endpoint`](#operation/NodeUpdate). + * @example node.hostname!=node3.corp.example.com,node.role!=manager,node.labels.type==production,node.platform.os==linux,node.platform.arch==x86_64 + */ + Constraints?: readonly string[]; + /** + * Preferences provide a way to make the scheduler aware of factors + * such as topology. They are provided in order from highest to + * lowest precedence. + * @example [object Object],[object Object] + */ + Preferences?: readonly { + Spread?: { + SpreadDescriptor?: string; + }; + }[]; + MaxReplicas?: number; + Platforms?: readonly { + /** + * Architecture represents the hardware architecture (for example, + * `x86_64`). + * @example x86_64 + */ + Architecture?: string; + /** + * OS represents the Operating System (for example, `linux` or `windows`). + * @example linux + */ + OS?: string; + }[]; + }; + ForceUpdate?: number; + Runtime?: string; + Networks?: readonly { + Target?: string; + Aliases?: readonly string[]; + DriverOpts?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; + LogDriver?: { + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; + ServiceID?: string; + Slot?: number; + NodeID?: string; + /** + * User-defined resources can be either Integer resources (e.g, `SSD=3`) or + * String resources (e.g, `GPU=UUID1`). + * @example [object Object],[object Object],[object Object] + */ + AssignedGenericResources?: readonly { + NamedResourceSpec?: { + Kind?: string; + Value?: string; + }; + DiscreteResourceSpec?: { + Kind?: string; + Value?: number; + }; + }[]; + Status?: { + Timestamp?: string; + State?: + | "new" + | "allocated" + | "pending" + | "assigned" + | "accepted" + | "preparing" + | "ready" + | "starting" + | "running" + | "complete" + | "shutdown" + | "failed" + | "rejected" + | "remove" + | "orphaned"; + Message?: string; + Err?: string; + ContainerStatus?: { + ContainerID?: string; + PID?: number; + ExitCode?: number; + }; + }; + DesiredState?: + | "new" + | "allocated" + | "pending" + | "assigned" + | "accepted" + | "preparing" + | "ready" + | "starting" + | "running" + | "complete" + | "shutdown" + | "failed" + | "rejected" + | "remove" + | "orphaned"; + JobIteration?: { + Index?: number; + }; +}[]; +export type TaskInspectCommandParams = { + id: string; +}; +export type TaskInspectCommandInput = TaskInspectCommandParams; +export type TaskInspectCommandOutput = { + ID?: string; + Version?: { + Index?: number; + }; + CreatedAt?: string; + UpdatedAt?: string; + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Spec?: { + PluginSpec?: { + Name?: string; + Remote?: string; + Disabled?: boolean; + PluginPrivilege?: readonly { + Name?: string; + Description?: string; + Value?: readonly string[]; + }[]; + }; + ContainerSpec?: { + Image?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Command?: readonly string[]; + Args?: readonly string[]; + Hostname?: string; + Env?: readonly string[]; + Dir?: string; + User?: string; + Groups?: readonly string[]; + Privileges?: { + CredentialSpec?: { + /** + * Load credential spec from a Swarm Config with the given ID. + * The specified config must also be present in the Configs + * field with the Runtime property set. + * + *


+ * + * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + * @example 0bt9dmxjvjiqermk6xrop3ekq + */ + Config?: string; + /** + * Load credential spec from this file. The file is read by + * the daemon, and must be present in the `CredentialSpecs` + * subdirectory in the docker data directory, which defaults + * to `C:\ProgramData\Docker\` on Windows. + * + * For example, specifying `spec.json` loads + * `C:\ProgramData\Docker\CredentialSpecs\spec.json`. + * + *


+ * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + * @example spec.json + */ + File?: string; + Registry?: string; + }; + SELinuxContext?: { + Disable?: boolean; + User?: string; + Role?: string; + Type?: string; + Level?: string; + }; + }; + TTY?: boolean; + OpenStdin?: boolean; + ReadOnly?: boolean; + Mounts?: readonly { + Target?: string; + Source?: string; + /** + * The mount type. Available types: + * + * - `bind` Mounts a file or directory from the host into the container. Must + * exist prior to creating the container. + * - `volume` Creates a volume with the given name and options (or uses a + * pre-existing volume with the same name and options). These are **not** + * removed when the container is removed. + * - `tmpfs` Create a tmpfs with the given options. The mount source cannot be + * specified for tmpfs. + * - `npipe` Mounts a named pipe from the host into the container. Must exist + * prior to creating the container. + * - `cluster` a Swarm cluster volume + * @enum bind,volume,tmpfs,npipe,cluster + */ + Type?: "bind" | "volume" | "tmpfs" | "npipe" | "cluster"; + ReadOnly?: boolean; + Consistency?: string; + BindOptions?: { + /** + * A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + * @enum private,rprivate,shared,rshared,slave,rslave + */ + Propagation?: + | "private" + | "rprivate" + | "shared" + | "rshared" + | "slave" + | "rslave"; + NonRecursive?: boolean; + CreateMountpoint?: boolean; + }; + VolumeOptions?: { + NoCopy?: boolean; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + DriverConfig?: { + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; + TmpfsOptions?: { + SizeBytes?: number; + Mode?: number; + }; + }[]; + StopSignal?: string; + StopGracePeriod?: number; + HealthCheck?: { + Test?: readonly string[]; + Interval?: number; + Timeout?: number; + Retries?: number; + StartPeriod?: number; + }; + Hosts?: readonly string[]; + DNSConfig?: { + Nameservers?: readonly string[]; + Search?: readonly string[]; + Options?: readonly string[]; + }; + Secrets?: readonly { + File?: { + Name?: string; + UID?: string; + GID?: string; + Mode?: number; + }; + SecretID?: string; + SecretName?: string; + }[]; + Configs?: readonly { + File?: { + Name?: string; + UID?: string; + GID?: string; + Mode?: number; + }; + Runtime?: {}; + ConfigID?: string; + ConfigName?: string; + }[]; + /** + * Isolation technology of the containers running the service. + * (Windows only) + * @enum default,process,hyperv, + */ + Isolation?: "default" | "process" | "hyperv" | ""; + Init?: boolean | null; + Sysctls?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * A list of kernel capabilities to add to the default set + * for the container. + * @example CAP_NET_RAW,CAP_SYS_ADMIN,CAP_SYS_CHROOT,CAP_SYSLOG + */ + CapabilityAdd?: readonly string[]; + /** + * A list of kernel capabilities to drop from the default set + * for the container. + * @example CAP_NET_RAW + */ + CapabilityDrop?: readonly string[]; + Ulimits?: readonly { + Name?: string; + Soft?: number; + Hard?: number; + }[]; + }; + NetworkAttachmentSpec?: { + ContainerID?: string; + }; + Resources?: { + Limits?: { + NanoCPUs?: number; + MemoryBytes?: number; + /** + * Limits the maximum number of PIDs in the container. Set `0` for unlimited. + * @example 100 + */ + Pids?: number; + }; + Reservations?: { + NanoCPUs?: number; + MemoryBytes?: number; + /** + * User-defined resources can be either Integer resources (e.g, `SSD=3`) or + * String resources (e.g, `GPU=UUID1`). + * @example [object Object],[object Object],[object Object] + */ + GenericResources?: readonly { + NamedResourceSpec?: { + Kind?: string; + Value?: string; + }; + DiscreteResourceSpec?: { + Kind?: string; + Value?: number; + }; + }[]; + }; + }; + RestartPolicy?: { + /** + * Condition for restart. + * @enum none,on-failure,any + */ + Condition?: "none" | "on-failure" | "any"; + Delay?: number; + MaxAttempts?: number; + Window?: number; + }; + Placement?: { + /** + * An array of constraint expressions to limit the set of nodes where + * a task can be scheduled. Constraint expressions can either use a + * _match_ (`==`) or _exclude_ (`!=`) rule. Multiple constraints find + * nodes that satisfy every expression (AND match). Constraints can + * match node or Docker Engine labels as follows: + * + * node attribute | matches | example + * ---------------------|--------------------------------|----------------------------------------------- + * `node.id` | Node ID | + * `node.id==2ivku8v2gvtg4` + * `node.hostname` | Node hostname | + * `node.hostname!=node-2` + * `node.role` | Node role (`manager`/`worker`) | + * `node.role==manager` + * `node.platform.os` | Node operating system | + * `node.platform.os==windows` + * `node.platform.arch` | Node architecture | + * `node.platform.arch==x86_64` + * `node.labels` | User-defined node labels | + * `node.labels.security==high` + * `engine.labels` | Docker Engine's labels | + * `engine.labels.operatingsystem==ubuntu-14.04` + * + * `engine.labels` apply to Docker Engine labels like operating system, + * drivers, etc. Swarm administrators add `node.labels` for operational + * purposes by using the [`node update endpoint`](#operation/NodeUpdate). + * @example node.hostname!=node3.corp.example.com,node.role!=manager,node.labels.type==production,node.platform.os==linux,node.platform.arch==x86_64 + */ + Constraints?: readonly string[]; + /** + * Preferences provide a way to make the scheduler aware of factors + * such as topology. They are provided in order from highest to + * lowest precedence. + * @example [object Object],[object Object] + */ + Preferences?: readonly { + Spread?: { + SpreadDescriptor?: string; + }; + }[]; + MaxReplicas?: number; + Platforms?: readonly { + /** + * Architecture represents the hardware architecture (for example, + * `x86_64`). + * @example x86_64 + */ + Architecture?: string; + /** + * OS represents the Operating System (for example, `linux` or `windows`). + * @example linux + */ + OS?: string; + }[]; + }; + ForceUpdate?: number; + Runtime?: string; + Networks?: readonly { + Target?: string; + Aliases?: readonly string[]; + DriverOpts?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }[]; + LogDriver?: { + Name?: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; + ServiceID?: string; + Slot?: number; + NodeID?: string; + /** + * User-defined resources can be either Integer resources (e.g, `SSD=3`) or + * String resources (e.g, `GPU=UUID1`). + * @example [object Object],[object Object],[object Object] + */ + AssignedGenericResources?: readonly { + NamedResourceSpec?: { + Kind?: string; + Value?: string; + }; + DiscreteResourceSpec?: { + Kind?: string; + Value?: number; + }; + }[]; + Status?: { + Timestamp?: string; + State?: + | "new" + | "allocated" + | "pending" + | "assigned" + | "accepted" + | "preparing" + | "ready" + | "starting" + | "running" + | "complete" + | "shutdown" + | "failed" + | "rejected" + | "remove" + | "orphaned"; + Message?: string; + Err?: string; + ContainerStatus?: { + ContainerID?: string; + PID?: number; + ExitCode?: number; + }; + }; + DesiredState?: + | "new" + | "allocated" + | "pending" + | "assigned" + | "accepted" + | "preparing" + | "ready" + | "starting" + | "running" + | "complete" + | "shutdown" + | "failed" + | "rejected" + | "remove" + | "orphaned"; + JobIteration?: { + Index?: number; + }; +}; +export type TaskLogsCommandQuery = { + details?: "true" | "false"; + follow?: "true" | "false"; + stdout?: "true" | "false"; + stderr?: "true" | "false"; + since?: `${number}` | undefined; + timestamps?: "true" | "false"; + tail?: string | undefined; +}; +export type TaskLogsCommandParams = { + id: string; +}; +export type TaskLogsCommandInput = TaskLogsCommandParams & TaskLogsCommandQuery; +export type SecretListCommandQuery = { + filters?: string | undefined; +}; +export type SecretListCommandInput = SecretListCommandQuery; +export type SecretListCommandOutput = readonly { + ID?: string; + Version?: { + Index?: number; + }; + CreatedAt?: string; + UpdatedAt?: string; + Spec?: { + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * Base64-url-safe-encoded ([RFC + * 4648](https://tools.ietf.org/html/rfc4648#section-5)) + * data to store as secret. + * + * This field is only used to _create_ a secret, and is not returned by + * other endpoints. + * @example + */ + Data?: string; + Driver?: { + /** + * Name of the driver. + * @example some-driver + */ + Name: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + Templating?: { + /** + * Name of the driver. + * @example some-driver + */ + Name: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; +}[]; +type SecretCreateJsonBody = { + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * Base64-url-safe-encoded ([RFC + * 4648](https://tools.ietf.org/html/rfc4648#section-5)) + * data to store as secret. + * + * This field is only used to _create_ a secret, and is not returned by + * other endpoints. + * @example + */ + Data?: string; + Driver?: { + /** + * Name of the driver. + * @example some-driver + */ + Name: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + Templating?: { + /** + * Name of the driver. + * @example some-driver + */ + Name: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; +} & Record; +export type SecretCreateCommandBody = SecretCreateJsonBody; +export type SecretCreateCommandInput = SecretCreateJsonBody; +export type SecretCreateCommandOutput = { + Id: string; +}; +export type SecretInspectCommandParams = { + id: string; +}; +export type SecretInspectCommandInput = SecretInspectCommandParams; +export type SecretInspectCommandOutput = { + ID?: string; + Version?: { + Index?: number; + }; + CreatedAt?: string; + UpdatedAt?: string; + Spec?: { + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * Base64-url-safe-encoded ([RFC + * 4648](https://tools.ietf.org/html/rfc4648#section-5)) + * data to store as secret. + * + * This field is only used to _create_ a secret, and is not returned by + * other endpoints. + * @example + */ + Data?: string; + Driver?: { + /** + * Name of the driver. + * @example some-driver + */ + Name: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + Templating?: { + /** + * Name of the driver. + * @example some-driver + */ + Name: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; +}; +export type SecretDeleteCommandParams = { + id: string; +}; +export type SecretDeleteCommandInput = SecretDeleteCommandParams; +export type SecretUpdateCommandQuery = { + version: `${number}`; +}; +type SecretUpdateJsonBody = { + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + /** + * Base64-url-safe-encoded ([RFC + * 4648](https://tools.ietf.org/html/rfc4648#section-5)) + * data to store as secret. + * + * This field is only used to _create_ a secret, and is not returned by + * other endpoints. + * @example + */ + Data?: string; + Driver?: { + /** + * Name of the driver. + * @example some-driver + */ + Name: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + Templating?: { + /** + * Name of the driver. + * @example some-driver + */ + Name: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; +}; +export type SecretUpdateCommandParams = { + id: string; +}; +export type SecretUpdateCommandBody = SecretUpdateJsonBody; +export type SecretUpdateCommandInput = SecretUpdateJsonBody & + SecretUpdateCommandParams & + SecretUpdateCommandQuery; +export type ConfigListCommandQuery = { + filters?: string | undefined; +}; +export type ConfigListCommandInput = ConfigListCommandQuery; +export type ConfigListCommandOutput = readonly { + ID?: string; + Version?: { + Index?: number; + }; + CreatedAt?: string; + UpdatedAt?: string; + Spec?: { + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Data?: string; + Templating?: { + /** + * Name of the driver. + * @example some-driver + */ + Name: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; +}[]; +type ConfigCreateJsonBody = { + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Data?: string; + Templating?: { + /** + * Name of the driver. + * @example some-driver + */ + Name: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; +} & Record; +export type ConfigCreateCommandBody = ConfigCreateJsonBody; +export type ConfigCreateCommandInput = ConfigCreateJsonBody; +export type ConfigCreateCommandOutput = { + Id: string; +}; +export type ConfigInspectCommandParams = { + id: string; +}; +export type ConfigInspectCommandInput = ConfigInspectCommandParams; +export type ConfigInspectCommandOutput = { + ID?: string; + Version?: { + Index?: number; + }; + CreatedAt?: string; + UpdatedAt?: string; + Spec?: { + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Data?: string; + Templating?: { + /** + * Name of the driver. + * @example some-driver + */ + Name: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; + }; +}; +export type ConfigDeleteCommandParams = { + id: string; +}; +export type ConfigDeleteCommandInput = ConfigDeleteCommandParams; +export type ConfigUpdateCommandQuery = { + version: `${number}`; +}; +type ConfigUpdateJsonBody = { + Name?: string; + Labels?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + Data?: string; + Templating?: { + /** + * Name of the driver. + * @example some-driver + */ + Name: string; + Options?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + }; +}; +export type ConfigUpdateCommandParams = { + id: string; +}; +export type ConfigUpdateCommandBody = ConfigUpdateJsonBody; +export type ConfigUpdateCommandInput = ConfigUpdateJsonBody & + ConfigUpdateCommandParams & + ConfigUpdateCommandQuery; +export type DistributionInspectCommandParams = { + name: string; +}; +export type DistributionInspectCommandInput = DistributionInspectCommandParams; +export type DistributionInspectCommandOutput = { + Descriptor: { + /** + * The media type of the object this schema refers to. + * @example application/vnd.docker.distribution.manifest.v2+json + */ + mediaType?: string; + /** + * The digest of the targeted content. + * @example sha256:c0537ff6a5218ef531ece93d4984efc99bbf3f7497c0a7726c88e2bb7584dc96 + */ + digest?: string; + /** + * The size in bytes of the blob. + * @example 3987495 + */ + size?: number; + }; + Platforms: readonly { + /** + * The CPU architecture, for example `amd64` or `ppc64`. + * @example arm + */ + architecture?: string; + /** + * The operating system, for example `linux` or `windows`. + * @example windows + */ + os?: string; + /** + * Optional field specifying the operating system version, for example on + * Windows `10.0.19041.1165`. + * @example 10.0.19041.1165 + */ + "os.version"?: string; + /** + * Optional field specifying an array of strings, each listing a required + * OS feature (for example on Windows `win32k`). + * @example win32k + */ + "os.features"?: readonly string[]; + /** + * Optional field specifying a variant of the CPU, for example `v7` to + * specify ARMv7 when architecture is `arm`. + * @example v7 + */ + variant?: string; + }[]; +}; +export type SessionCommandInput = never; diff --git a/__tests__/fixtures/docker/valibot.ts b/__tests__/fixtures/docker/valibot.ts new file mode 100644 index 0000000..4473684 --- /dev/null +++ b/__tests__/fixtures/docker/valibot.ts @@ -0,0 +1,16882 @@ +/** + * This file was auto generated by @block65/openapi-codegen + * + * WARN: Do not edit directly. + * + * Generated on 2026-03-06T07:45:59.608Z + * + */ +import * as v from "valibot"; + +/** + * An open port on a container + * @example { + * "PrivatePort": 8080, + * "PublicPort": 80, + * "Type": "tcp" + * } + */ +export const portSchema = v.strictObject({ + /** + * Host IP address that the container's port is mapped to + */ + IP: v.exactOptional(v.string()), + /** + * Port on the container + */ + PrivatePort: v.pipe(v.number(), v.integer()), + /** + * Port exposed on the host + */ + PublicPort: v.exactOptional(v.pipe(v.number(), v.integer())), + Type: v.picklist(["tcp", "udp", "sctp"]), +}); +/** + * MountPoint represents a mount point configuration inside the container. + * This is used for reporting the mountpoints in use by a container. + */ +export const mountPointSchema = v.strictObject({ + /** + * The mount type: + * + * - `bind` a mount of a file or directory from the host into the container. + * - `volume` a docker volume with the given `Name`. + * - `tmpfs` a `tmpfs`. + * - `npipe` a named pipe from the host into the container. + * - `cluster` a Swarm cluster volume + */ + Type: v.exactOptional( + v.picklist(["bind", "volume", "tmpfs", "npipe", "cluster"]), + ), + /** + * Name is the name reference to the underlying data defined by `Source` + * e.g., the volume name. + */ + Name: v.exactOptional(v.string()), + /** + * Source location of the mount. + * + * For volumes, this contains the storage location of the volume (within + * `/var/lib/docker/volumes/`). For bind-mounts, and `npipe`, this contains + * the source (host) part of the bind-mount. For `tmpfs` mount points, this + * field is empty. + */ + Source: v.exactOptional(v.string()), + /** + * Destination is the path relative to the container root (`/`) where + * the `Source` is mounted inside the container. + */ + Destination: v.exactOptional(v.string()), + /** + * Driver is the volume driver used to create the volume (if it is a volume). + */ + Driver: v.exactOptional(v.string()), + /** + * Mode is a comma separated list of options supplied by the user when + * creating the bind/volume mount. + * + * The default is platform-specific (`"z"` on Linux, empty on Windows). + */ + Mode: v.exactOptional(v.string()), + /** + * Whether the mount is mounted writable (read-write). + */ + RW: v.exactOptional(v.boolean()), + /** + * Propagation describes how mounts are propagated from the host into the + * mount point, and vice-versa. Refer to the [Linux kernel + * documentation](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt) + * for details. This field is not used on Windows. + */ + Propagation: v.exactOptional(v.string()), +}); +/** + * A device mapping between the host and container + * @example { + * "PathOnHost": "/dev/deviceName", + * "PathInContainer": "/dev/deviceName", + * "CgroupPermissions": "mrw" + * } + */ +export const deviceMappingSchema = v.strictObject({ + PathOnHost: v.exactOptional(v.string()), + PathInContainer: v.exactOptional(v.string()), + CgroupPermissions: v.exactOptional(v.string()), +}); +/** A request for devices to be sent to device drivers */ +export const deviceRequestSchema = v.strictObject({ + Driver: v.exactOptional(v.string()), + Count: v.exactOptional(v.pipe(v.number(), v.integer())), + DeviceIDs: v.exactOptional(v.array(v.string())), + /** + * A list of capabilities; an OR list of AND lists of capabilities. + */ + Capabilities: v.exactOptional(v.array(v.array(v.string()))), + /** + * Driver-specific options, specified as a key/value pairs. These options + * are passed directly to the driver. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), +}); +export const throttleDeviceSchema = v.strictObject({ + /** + * Device path + */ + Path: v.exactOptional(v.string()), + /** + * Rate + */ + Rate: v.exactOptional(v.pipe(v.number(), v.integer(), v.minValue(0))), +}); +export const mountSchema = v.strictObject({ + /** + * Container path. + */ + Target: v.exactOptional(v.string()), + /** + * Mount source (e.g. a volume name, a host path). + */ + Source: v.exactOptional(v.string()), + /** + * The mount type. Available types: + * + * - `bind` Mounts a file or directory from the host into the container. Must + * exist prior to creating the container. + * - `volume` Creates a volume with the given name and options (or uses a + * pre-existing volume with the same name and options). These are **not** + * removed when the container is removed. + * - `tmpfs` Create a tmpfs with the given options. The mount source cannot be + * specified for tmpfs. + * - `npipe` Mounts a named pipe from the host into the container. Must exist + * prior to creating the container. + * - `cluster` a Swarm cluster volume + */ + Type: v.exactOptional( + v.picklist(["bind", "volume", "tmpfs", "npipe", "cluster"]), + ), + /** + * Whether the mount should be read-only. + */ + ReadOnly: v.exactOptional(v.boolean()), + /** + * The consistency requirement for the mount: `default`, `consistent`, + * `cached`, or `delegated`. + */ + Consistency: v.exactOptional(v.string()), + /** + * Optional configuration for the `bind` type. + */ + BindOptions: v.exactOptional( + v.strictObject({ + /** + * A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + */ + Propagation: v.exactOptional( + v.picklist([ + "private", + "rprivate", + "shared", + "rshared", + "slave", + "rslave", + ]), + ), + /** + * Disable recursive bind mount. + */ + NonRecursive: v.exactOptional(v.boolean()), + /** + * Create mount point on host if missing + */ + CreateMountpoint: v.exactOptional(v.boolean()), + }), + ), + /** + * Optional configuration for the `volume` type. + */ + VolumeOptions: v.exactOptional( + v.strictObject({ + /** + * Populate volume with data from the target. + */ + NoCopy: v.exactOptional(v.boolean()), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Map of driver specific options + */ + DriverConfig: v.exactOptional( + v.strictObject({ + /** + * Name of the driver to use to create the volume. + */ + Name: v.exactOptional(v.string()), + /** + * key/value map of driver specific options. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + }), + ), + /** + * Optional configuration for the `tmpfs` type. + */ + TmpfsOptions: v.exactOptional( + v.strictObject({ + /** + * The size for the tmpfs mount in bytes. + */ + SizeBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The permission mode for the tmpfs mount in an integer. + */ + Mode: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), +}); +/** + * The behavior to apply when the container exits. The default is not to + * restart. + * + * An ever increasing delay (double the previous delay, starting at 100ms) is + * added before each restart to prevent flooding the server. + */ +export const restartPolicySchema = v.strictObject({ + /** + * - Empty string means not to restart + * - `no` Do not automatically restart + * - `always` Always restart + * - `unless-stopped` Restart always except when the user has manually stopped + * the container + * - `on-failure` Restart only when the container exit code is non-zero + */ + Name: v.exactOptional( + v.picklist(["", "no", "always", "unless-stopped", "on-failure"]), + ), + /** + * If `on-failure` is used, the number of times to retry before giving up. + */ + MaximumRetryCount: v.exactOptional(v.pipe(v.number(), v.integer())), +}); +/** A container's resources (cgroups config, ulimits, etc) */ +export const resourcesSchema = v.strictObject({ + /** + * An integer value representing this container's relative CPU weight + * versus other containers. + */ + CpuShares: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Memory limit in bytes. + */ + Memory: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Path to `cgroups` under which the container's `cgroup` is created. If + * the path is not absolute, the path is considered to be relative to the + * `cgroups` path of the init process. Cgroups are created if they do not + * already exist. + */ + CgroupParent: v.exactOptional(v.string()), + /** + * Block IO weight (relative weight). + */ + BlkioWeight: v.exactOptional( + v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(1000)), + ), + /** + * Block IO weight (relative device weight) in the form: + * + * ``` + * [{"Path": "device_path", "Weight": weight}] + * ``` + */ + BlkioWeightDevice: v.exactOptional( + v.array( + v.strictObject({ + Path: v.exactOptional(v.string()), + Weight: v.exactOptional(v.pipe(v.number(), v.integer(), v.minValue(0))), + }), + ), + ), + /** + * Limit read rate (bytes per second) from a device, in the form: + * + * ``` + * [{"Path": "device_path", "Rate": rate}] + * ``` + */ + BlkioDeviceReadBps: v.exactOptional( + v.array( + v.strictObject({ + /** + * Device path + */ + Path: v.exactOptional(v.string()), + /** + * Rate + */ + Rate: v.exactOptional(v.pipe(v.number(), v.integer(), v.minValue(0))), + }), + ), + ), + /** + * Limit write rate (bytes per second) to a device, in the form: + * + * ``` + * [{"Path": "device_path", "Rate": rate}] + * ``` + */ + BlkioDeviceWriteBps: v.exactOptional( + v.array( + v.strictObject({ + /** + * Device path + */ + Path: v.exactOptional(v.string()), + /** + * Rate + */ + Rate: v.exactOptional(v.pipe(v.number(), v.integer(), v.minValue(0))), + }), + ), + ), + /** + * Limit read rate (IO per second) from a device, in the form: + * + * ``` + * [{"Path": "device_path", "Rate": rate}] + * ``` + */ + BlkioDeviceReadIOps: v.exactOptional( + v.array( + v.strictObject({ + /** + * Device path + */ + Path: v.exactOptional(v.string()), + /** + * Rate + */ + Rate: v.exactOptional(v.pipe(v.number(), v.integer(), v.minValue(0))), + }), + ), + ), + /** + * Limit write rate (IO per second) to a device, in the form: + * + * ``` + * [{"Path": "device_path", "Rate": rate}] + * ``` + */ + BlkioDeviceWriteIOps: v.exactOptional( + v.array( + v.strictObject({ + /** + * Device path + */ + Path: v.exactOptional(v.string()), + /** + * Rate + */ + Rate: v.exactOptional(v.pipe(v.number(), v.integer(), v.minValue(0))), + }), + ), + ), + /** + * The length of a CPU period in microseconds. + */ + CpuPeriod: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Microseconds of CPU time that the container can get in a CPU period. + */ + CpuQuota: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The length of a CPU real-time period in microseconds. Set to 0 to + * allocate no time allocated to real-time tasks. + */ + CpuRealtimePeriod: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The length of a CPU real-time runtime in microseconds. Set to 0 to + * allocate no time allocated to real-time tasks. + */ + CpuRealtimeRuntime: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * CPUs in which to allow execution (e.g., `0-3`, `0,1`). + */ + CpusetCpus: v.exactOptional(v.string()), + /** + * Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only + * effective on NUMA systems. + */ + CpusetMems: v.exactOptional(v.string()), + /** + * A list of devices to add to the container. + */ + Devices: v.exactOptional( + v.array( + v.strictObject({ + PathOnHost: v.exactOptional(v.string()), + PathInContainer: v.exactOptional(v.string()), + CgroupPermissions: v.exactOptional(v.string()), + }), + ), + ), + /** + * a list of cgroup rules to apply to the container + */ + DeviceCgroupRules: v.exactOptional(v.array(v.string())), + /** + * A list of requests for devices to be sent to device drivers. + */ + DeviceRequests: v.exactOptional( + v.array( + v.strictObject({ + Driver: v.exactOptional(v.string()), + Count: v.exactOptional(v.pipe(v.number(), v.integer())), + DeviceIDs: v.exactOptional(v.array(v.string())), + /** + * A list of capabilities; an OR list of AND lists of capabilities. + */ + Capabilities: v.exactOptional(v.array(v.array(v.string()))), + /** + * Driver-specific options, specified as a key/value pairs. These options + * are passed directly to the driver. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + ), + /** + * Hard limit for kernel TCP buffer memory (in bytes). Depending on the + * OCI runtime in use, this option may be ignored. It is no longer supported + * by the default (runc) runtime. + * + * This field is omitted when empty. + */ + KernelMemoryTCP: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Memory soft limit in bytes. + */ + MemoryReservation: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Total memory limit (memory + swap). Set as `-1` to enable unlimited + * swap. + */ + MemorySwap: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Tune a container's memory swappiness behavior. Accepts an integer + * between 0 and 100. + */ + MemorySwappiness: v.exactOptional( + v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(100)), + ), + /** + * CPU quota in units of 10-9 CPUs. + */ + NanoCpus: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Disable OOM Killer for the container. + */ + OomKillDisable: v.exactOptional(v.boolean()), + /** + * Run an init inside the container that forwards signals and reaps + * processes. This field is omitted if empty, and the default (as + * configured on the daemon) is used. + */ + Init: v.exactOptional(v.nullable(v.boolean())), + /** + * Tune a container's PIDs limit. Set `0` or `-1` for unlimited, or `null` + * to not change. + */ + PidsLimit: v.exactOptional(v.nullable(v.pipe(v.number(), v.integer()))), + /** + * A list of resource limits to set in the container. For example: + * + * ``` + * {"Name": "nofile", "Soft": 1024, "Hard": 2048} + * ``` + */ + Ulimits: v.exactOptional( + v.array( + v.strictObject({ + /** + * Name of ulimit + */ + Name: v.exactOptional(v.string()), + /** + * Soft limit + */ + Soft: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Hard limit + */ + Hard: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + ), + /** + * The number of usable CPUs (Windows only). + * + * On Windows Server containers, the processor resource controls are + * mutually exclusive. The order of precedence is `CPUCount` first, then + * `CPUShares`, and `CPUPercent` last. + */ + CpuCount: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The usable percentage of the available CPUs (Windows only). + * + * On Windows Server containers, the processor resource controls are + * mutually exclusive. The order of precedence is `CPUCount` first, then + * `CPUShares`, and `CPUPercent` last. + */ + CpuPercent: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Maximum IOps for the container system drive (Windows only) + */ + IOMaximumIOps: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Maximum IO in bytes per second for the container system drive + * (Windows only). + */ + IOMaximumBandwidth: v.exactOptional(v.pipe(v.number(), v.integer())), +}); +/** An object describing a limit on resources which can be requested by a task. */ +export const limitSchema = v.strictObject({ + NanoCPUs: v.exactOptional(v.pipe(v.number(), v.integer())), + MemoryBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Limits the maximum number of PIDs in the container. Set `0` for unlimited. + */ + Pids: v.exactOptional(v.pipe(v.number(), v.integer())), +}); +/** + * An object describing the resources which can be advertised by a node and + * requested by a task. + */ +export const resourceObjectSchema = v.strictObject({ + NanoCPUs: v.exactOptional(v.pipe(v.number(), v.integer())), + MemoryBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * User-defined resources can be either Integer resources (e.g, `SSD=3`) or + * String resources (e.g, `GPU=UUID1`). + */ + GenericResources: v.exactOptional( + v.array( + v.strictObject({ + NamedResourceSpec: v.exactOptional( + v.strictObject({ + Kind: v.exactOptional(v.string()), + Value: v.exactOptional(v.string()), + }), + ), + DiscreteResourceSpec: v.exactOptional( + v.strictObject({ + Kind: v.exactOptional(v.string()), + Value: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + }), + ), + ), +}); +/** + * User-defined resources can be either Integer resources (e.g, `SSD=3`) or + * String resources (e.g, `GPU=UUID1`). + * @example [ + * { + * "DiscreteResourceSpec": { + * "Kind": "SSD", + * "Value": 3 + * } + * }, + * { + * "NamedResourceSpec": { + * "Kind": "GPU", + * "Value": "UUID1" + * } + * }, + * { + * "NamedResourceSpec": { + * "Kind": "GPU", + * "Value": "UUID2" + * } + * } + * ] + */ +export const genericResourcesSchema = v.array( + v.strictObject({ + NamedResourceSpec: v.exactOptional( + v.strictObject({ + Kind: v.exactOptional(v.string()), + Value: v.exactOptional(v.string()), + }), + ), + DiscreteResourceSpec: v.exactOptional( + v.strictObject({ + Kind: v.exactOptional(v.string()), + Value: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + }), +); +/** A test to perform to check that the container is healthy. */ +export const healthConfigSchema = v.strictObject({ + /** + * The test to perform. Possible values are: + * + * - `[]` inherit healthcheck from image or parent image + * - `["NONE"]` disable healthcheck + * - `["CMD", args...]` exec arguments directly + * - `["CMD-SHELL", command]` run command with system's default shell + */ + Test: v.exactOptional(v.array(v.string())), + /** + * The time to wait between checks in nanoseconds. It should be 0 or at + * least 1000000 (1 ms). 0 means inherit. + */ + Interval: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The time to wait before considering the check to have hung. It should + * be 0 or at least 1000000 (1 ms). 0 means inherit. + */ + Timeout: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The number of consecutive failures needed to consider a container as + * unhealthy. 0 means inherit. + */ + Retries: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Start period for the container to initialize before starting + * health-retries countdown in nanoseconds. It should be 0 or at least + * 1000000 (1 ms). 0 means inherit. + */ + StartPeriod: v.exactOptional(v.pipe(v.number(), v.integer())), +}); +/** Health stores information about the container's healthcheck results. */ +export const healthSchema = v.nullable( + v.strictObject({ + /** + * Status is one of `none`, `starting`, `healthy` or `unhealthy` + * + * - "none" Indicates there is no healthcheck + * - "starting" Starting indicates that the container is not yet ready + * - "healthy" Healthy indicates that the container is running correctly + * - "unhealthy" Unhealthy indicates that the container has a problem + */ + Status: v.exactOptional( + v.picklist(["none", "starting", "healthy", "unhealthy"]), + ), + /** + * FailingStreak is the number of consecutive failures + */ + FailingStreak: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Log contains the last few results (oldest first) + */ + Log: v.exactOptional( + v.array( + v.nullable( + v.strictObject({ + /** + * Date and time at which this check started in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + */ + Start: v.exactOptional(v.string()), + /** + * Date and time at which this check ended in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + */ + End: v.exactOptional(v.string()), + /** + * ExitCode meanings: + * + * - `0` healthy + * - `1` unhealthy + * - `2` reserved (considered unhealthy) + * - other values: error running probe + */ + ExitCode: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Output from last check + */ + Output: v.exactOptional(v.string()), + }), + ), + ), + ), + }), +); +/** + * HealthcheckResult stores information about a single run of a healthcheck + * probe + */ +export const healthcheckResultSchema = v.nullable( + v.strictObject({ + /** + * Date and time at which this check started in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + */ + Start: v.exactOptional(v.string()), + /** + * Date and time at which this check ended in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + */ + End: v.exactOptional(v.string()), + /** + * ExitCode meanings: + * + * - `0` healthy + * - `1` unhealthy + * - `2` reserved (considered unhealthy) + * - other values: error running probe + */ + ExitCode: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Output from last check + */ + Output: v.exactOptional(v.string()), + }), +); +/** Container configuration that depends on the host we are running on */ +export const hostConfigSchema = v.intersect([ + v.strictObject({ + /** + * An integer value representing this container's relative CPU weight + * versus other containers. + */ + CpuShares: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Memory limit in bytes. + */ + Memory: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Path to `cgroups` under which the container's `cgroup` is created. If + * the path is not absolute, the path is considered to be relative to the + * `cgroups` path of the init process. Cgroups are created if they do not + * already exist. + */ + CgroupParent: v.exactOptional(v.string()), + /** + * Block IO weight (relative weight). + */ + BlkioWeight: v.exactOptional( + v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(1000)), + ), + /** + * Block IO weight (relative device weight) in the form: + * + * ``` + * [{"Path": "device_path", "Weight": weight}] + * ``` + */ + BlkioWeightDevice: v.exactOptional( + v.array( + v.strictObject({ + Path: v.exactOptional(v.string()), + Weight: v.exactOptional( + v.pipe(v.number(), v.integer(), v.minValue(0)), + ), + }), + ), + ), + /** + * Limit read rate (bytes per second) from a device, in the form: + * + * ``` + * [{"Path": "device_path", "Rate": rate}] + * ``` + */ + BlkioDeviceReadBps: v.exactOptional( + v.array( + v.strictObject({ + /** + * Device path + */ + Path: v.exactOptional(v.string()), + /** + * Rate + */ + Rate: v.exactOptional(v.pipe(v.number(), v.integer(), v.minValue(0))), + }), + ), + ), + /** + * Limit write rate (bytes per second) to a device, in the form: + * + * ``` + * [{"Path": "device_path", "Rate": rate}] + * ``` + */ + BlkioDeviceWriteBps: v.exactOptional( + v.array( + v.strictObject({ + /** + * Device path + */ + Path: v.exactOptional(v.string()), + /** + * Rate + */ + Rate: v.exactOptional(v.pipe(v.number(), v.integer(), v.minValue(0))), + }), + ), + ), + /** + * Limit read rate (IO per second) from a device, in the form: + * + * ``` + * [{"Path": "device_path", "Rate": rate}] + * ``` + */ + BlkioDeviceReadIOps: v.exactOptional( + v.array( + v.strictObject({ + /** + * Device path + */ + Path: v.exactOptional(v.string()), + /** + * Rate + */ + Rate: v.exactOptional(v.pipe(v.number(), v.integer(), v.minValue(0))), + }), + ), + ), + /** + * Limit write rate (IO per second) to a device, in the form: + * + * ``` + * [{"Path": "device_path", "Rate": rate}] + * ``` + */ + BlkioDeviceWriteIOps: v.exactOptional( + v.array( + v.strictObject({ + /** + * Device path + */ + Path: v.exactOptional(v.string()), + /** + * Rate + */ + Rate: v.exactOptional(v.pipe(v.number(), v.integer(), v.minValue(0))), + }), + ), + ), + /** + * The length of a CPU period in microseconds. + */ + CpuPeriod: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Microseconds of CPU time that the container can get in a CPU period. + */ + CpuQuota: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The length of a CPU real-time period in microseconds. Set to 0 to + * allocate no time allocated to real-time tasks. + */ + CpuRealtimePeriod: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The length of a CPU real-time runtime in microseconds. Set to 0 to + * allocate no time allocated to real-time tasks. + */ + CpuRealtimeRuntime: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * CPUs in which to allow execution (e.g., `0-3`, `0,1`). + */ + CpusetCpus: v.exactOptional(v.string()), + /** + * Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only + * effective on NUMA systems. + */ + CpusetMems: v.exactOptional(v.string()), + /** + * A list of devices to add to the container. + */ + Devices: v.exactOptional( + v.array( + v.strictObject({ + PathOnHost: v.exactOptional(v.string()), + PathInContainer: v.exactOptional(v.string()), + CgroupPermissions: v.exactOptional(v.string()), + }), + ), + ), + /** + * a list of cgroup rules to apply to the container + */ + DeviceCgroupRules: v.exactOptional(v.array(v.string())), + /** + * A list of requests for devices to be sent to device drivers. + */ + DeviceRequests: v.exactOptional( + v.array( + v.strictObject({ + Driver: v.exactOptional(v.string()), + Count: v.exactOptional(v.pipe(v.number(), v.integer())), + DeviceIDs: v.exactOptional(v.array(v.string())), + /** + * A list of capabilities; an OR list of AND lists of capabilities. + */ + Capabilities: v.exactOptional(v.array(v.array(v.string()))), + /** + * Driver-specific options, specified as a key/value pairs. These options + * are passed directly to the driver. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + ), + /** + * Hard limit for kernel TCP buffer memory (in bytes). Depending on the + * OCI runtime in use, this option may be ignored. It is no longer supported + * by the default (runc) runtime. + * + * This field is omitted when empty. + */ + KernelMemoryTCP: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Memory soft limit in bytes. + */ + MemoryReservation: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Total memory limit (memory + swap). Set as `-1` to enable unlimited + * swap. + */ + MemorySwap: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Tune a container's memory swappiness behavior. Accepts an integer + * between 0 and 100. + */ + MemorySwappiness: v.exactOptional( + v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(100)), + ), + /** + * CPU quota in units of 10-9 CPUs. + */ + NanoCpus: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Disable OOM Killer for the container. + */ + OomKillDisable: v.exactOptional(v.boolean()), + /** + * Run an init inside the container that forwards signals and reaps + * processes. This field is omitted if empty, and the default (as + * configured on the daemon) is used. + */ + Init: v.exactOptional(v.nullable(v.boolean())), + /** + * Tune a container's PIDs limit. Set `0` or `-1` for unlimited, or `null` + * to not change. + */ + PidsLimit: v.exactOptional(v.nullable(v.pipe(v.number(), v.integer()))), + /** + * A list of resource limits to set in the container. For example: + * + * ``` + * {"Name": "nofile", "Soft": 1024, "Hard": 2048} + * ``` + */ + Ulimits: v.exactOptional( + v.array( + v.strictObject({ + /** + * Name of ulimit + */ + Name: v.exactOptional(v.string()), + /** + * Soft limit + */ + Soft: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Hard limit + */ + Hard: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + ), + /** + * The number of usable CPUs (Windows only). + * + * On Windows Server containers, the processor resource controls are + * mutually exclusive. The order of precedence is `CPUCount` first, then + * `CPUShares`, and `CPUPercent` last. + */ + CpuCount: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The usable percentage of the available CPUs (Windows only). + * + * On Windows Server containers, the processor resource controls are + * mutually exclusive. The order of precedence is `CPUCount` first, then + * `CPUShares`, and `CPUPercent` last. + */ + CpuPercent: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Maximum IOps for the container system drive (Windows only) + */ + IOMaximumIOps: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Maximum IO in bytes per second for the container system drive + * (Windows only). + */ + IOMaximumBandwidth: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + v.strictObject({ + /** + * A list of volume bindings for this container. Each volume binding + * is a string in one of these forms: + * + * - `host-src:container-dest[:options]` to bind-mount a host path + * + * into the container. Both `host-src`, and `container-dest` must + * + * be an _absolute_ path. + * - `volume-name:container-dest[:options]` to bind-mount a volume + * + * managed by a volume driver into the container. `container-dest` + * + * must be an _absolute_ path. + * + * `options` is an optional, comma-delimited list of: + * + * - `nocopy` disables automatic copying of data from the container + * + * path to the volume. The `nocopy` flag only applies to named volumes. + * - `[ro|rw]` mounts a volume read-only or read-write, respectively. + * + * If omitted or set to `rw`, volumes are mounted read-write. + * - `[z|Z]` applies SELinux labels to allow or deny multiple containers + * + * to read and write to the same volume. + * + * - `z`: a _shared_ content label is applied to the content. This + * + * label indicates that multiple containers can share the volume + * + * content, for both reading and writing. + * + * - `Z`: a _private unshared_ label is applied to the content. + * + * This label indicates that only the current container can use + * + * a private volume. Labeling systems such as SELinux require + * + * proper labels to be placed on volume content that is mounted + * + * into a container. Without a label, the security system can + * + * prevent a container's processes from using the content. By + * + * default, the labels set by the host operating system are not + * + * modified. + * - `[[r]shared|[r]slave|[r]private]` specifies mount + * + * [propagation + * behavior](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt). + * + * This only applies to bind-mounted volumes, not internal volumes + * + * or named volumes. Mount propagation requires the source mount + * + * point (the location where the source directory is mounted in the + * + * host operating system) to have the correct propagation properties. + * + * For shared volumes, the source mount point must be set to `shared`. + * + * For slave volumes, the mount must be set to either `shared` or + * + * `slave`. + */ + Binds: v.exactOptional(v.array(v.string())), + /** + * Path to a file where the container ID is written + */ + ContainerIDFile: v.exactOptional(v.string()), + /** + * The logging configuration for this container + */ + LogConfig: v.exactOptional( + v.strictObject({ + Type: v.exactOptional( + v.picklist([ + "json-file", + "syslog", + "journald", + "gelf", + "fluentd", + "awslogs", + "splunk", + "etwlogs", + "none", + ]), + ), + Config: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + /** + * Network mode to use for this container. Supported standard values + * are: `bridge`, `host`, `none`, and `container:`. Any + * other value is taken as a custom network's name to which this + * container should connect to. + */ + NetworkMode: v.exactOptional(v.string()), + /** + * PortMap describes the mapping of container ports to host ports, using the + * container's port-number and protocol as key in the format + * `/`, + * for example, `80/udp`. + * + * If a container's port is mapped for multiple protocols, separate entries + * are added to the mapping table. + */ + PortBindings: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * The behavior to apply when the container exits. The default is not to + * restart. + * + * An ever increasing delay (double the previous delay, starting at 100ms) is + * added before each restart to prevent flooding the server. + */ + RestartPolicy: v.exactOptional( + v.strictObject({ + /** + * - Empty string means not to restart + * - `no` Do not automatically restart + * - `always` Always restart + * - `unless-stopped` Restart always except when the user has manually stopped + * the container + * - `on-failure` Restart only when the container exit code is non-zero + */ + Name: v.exactOptional( + v.picklist(["", "no", "always", "unless-stopped", "on-failure"]), + ), + /** + * If `on-failure` is used, the number of times to retry before giving up. + */ + MaximumRetryCount: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * Automatically remove the container when the container's process + * exits. This has no effect if `RestartPolicy` is set. + */ + AutoRemove: v.exactOptional(v.boolean()), + /** + * Driver that this container uses to mount volumes. + */ + VolumeDriver: v.exactOptional(v.string()), + /** + * A list of volumes to inherit from another container, specified in + * the form `[:]`. + */ + VolumesFrom: v.exactOptional(v.array(v.string())), + /** + * Specification for mounts to be added to the container. + */ + Mounts: v.exactOptional( + v.array( + v.strictObject({ + /** + * Container path. + */ + Target: v.exactOptional(v.string()), + /** + * Mount source (e.g. a volume name, a host path). + */ + Source: v.exactOptional(v.string()), + /** + * The mount type. Available types: + * + * - `bind` Mounts a file or directory from the host into the container. Must + * exist prior to creating the container. + * - `volume` Creates a volume with the given name and options (or uses a + * pre-existing volume with the same name and options). These are **not** + * removed when the container is removed. + * - `tmpfs` Create a tmpfs with the given options. The mount source cannot be + * specified for tmpfs. + * - `npipe` Mounts a named pipe from the host into the container. Must exist + * prior to creating the container. + * - `cluster` a Swarm cluster volume + */ + Type: v.exactOptional( + v.picklist(["bind", "volume", "tmpfs", "npipe", "cluster"]), + ), + /** + * Whether the mount should be read-only. + */ + ReadOnly: v.exactOptional(v.boolean()), + /** + * The consistency requirement for the mount: `default`, `consistent`, + * `cached`, or `delegated`. + */ + Consistency: v.exactOptional(v.string()), + /** + * Optional configuration for the `bind` type. + */ + BindOptions: v.exactOptional( + v.strictObject({ + /** + * A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + */ + Propagation: v.exactOptional( + v.picklist([ + "private", + "rprivate", + "shared", + "rshared", + "slave", + "rslave", + ]), + ), + /** + * Disable recursive bind mount. + */ + NonRecursive: v.exactOptional(v.boolean()), + /** + * Create mount point on host if missing + */ + CreateMountpoint: v.exactOptional(v.boolean()), + }), + ), + /** + * Optional configuration for the `volume` type. + */ + VolumeOptions: v.exactOptional( + v.strictObject({ + /** + * Populate volume with data from the target. + */ + NoCopy: v.exactOptional(v.boolean()), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Map of driver specific options + */ + DriverConfig: v.exactOptional( + v.strictObject({ + /** + * Name of the driver to use to create the volume. + */ + Name: v.exactOptional(v.string()), + /** + * key/value map of driver specific options. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + }), + ), + /** + * Optional configuration for the `tmpfs` type. + */ + TmpfsOptions: v.exactOptional( + v.strictObject({ + /** + * The size for the tmpfs mount in bytes. + */ + SizeBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The permission mode for the tmpfs mount in an integer. + */ + Mode: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + }), + ), + ), + /** + * Initial console size, as an `[height, width]` array. + */ + ConsoleSize: v.exactOptional( + v.nullable( + v.pipe( + v.array(v.pipe(v.number(), v.integer(), v.minValue(0))), + v.minLength(2), + v.maxLength(2), + ), + ), + ), + /** + * Arbitrary non-identifying metadata attached to container and + * provided to the runtime when the container is started. + */ + Annotations: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * A list of kernel capabilities to add to the container. Conflicts + * with option 'Capabilities'. + */ + CapAdd: v.exactOptional(v.array(v.string())), + /** + * A list of kernel capabilities to drop from the container. Conflicts + * with option 'Capabilities'. + */ + CapDrop: v.exactOptional(v.array(v.string())), + /** + * cgroup namespace mode for the container. Possible values are: + * + * - `"private"`: the container runs in its own private cgroup namespace + * - `"host"`: use the host system's cgroup namespace + * + * If not specified, the daemon default is used, which can either be + * `"private"` + * or `"host"`, depending on daemon version, kernel support and configuration. + */ + CgroupnsMode: v.exactOptional(v.picklist(["private", "host"])), + /** + * A list of DNS servers for the container to use. + */ + Dns: v.exactOptional(v.array(v.string())), + /** + * A list of DNS options. + */ + DnsOptions: v.exactOptional(v.array(v.string())), + /** + * A list of DNS search domains. + */ + DnsSearch: v.exactOptional(v.array(v.string())), + /** + * A list of hostnames/IP mappings to add to the container's `/etc/hosts` + * file. Specified in the form `["hostname:IP"]`. + */ + ExtraHosts: v.exactOptional(v.array(v.string())), + /** + * A list of additional groups that the container process will run as. + */ + GroupAdd: v.exactOptional(v.array(v.string())), + /** + * IPC sharing mode for the container. Possible values are: + * + * - `"none"`: own private IPC namespace, with /dev/shm not mounted + * - `"private"`: own private IPC namespace + * - `"shareable"`: own private IPC namespace, with a possibility to share it + * with other containers + * - `"container:"`: join another (shareable) container's IPC + * namespace + * - `"host"`: use the host system's IPC namespace + * + * If not specified, daemon default is used, which can either be `"private"` + * or `"shareable"`, depending on daemon version and configuration. + */ + IpcMode: v.exactOptional(v.string()), + /** + * Cgroup to use for the container. + */ + Cgroup: v.exactOptional(v.string()), + /** + * A list of links for the container in the form `container_name:alias`. + */ + Links: v.exactOptional(v.array(v.string())), + /** + * An integer value containing the score given to the container in + * order to tune OOM killer preferences. + */ + OomScoreAdj: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Set the PID (Process) Namespace mode for the container. It can be + * either: + * + * - `"container:"`: joins another container's PID namespace + * - `"host"`: use the host's PID namespace inside the container + */ + PidMode: v.exactOptional(v.string()), + /** + * Gives the container full access to the host. + */ + Privileged: v.exactOptional(v.boolean()), + /** + * Allocates an ephemeral host port for all of a container's + * exposed ports. + * + * Ports are de-allocated when the container stops and allocated when + * the container starts. The allocated port might be changed when + * restarting the container. + * + * The port is selected from the ephemeral port range that depends on + * the kernel. For example, on Linux the range is defined by + * `/proc/sys/net/ipv4/ip_local_port_range`. + */ + PublishAllPorts: v.exactOptional(v.boolean()), + /** + * Mount the container's root filesystem as read only. + */ + ReadonlyRootfs: v.exactOptional(v.boolean()), + /** + * A list of string values to customize labels for MLS systems, such + * as SELinux. + */ + SecurityOpt: v.exactOptional(v.array(v.string())), + /** + * Storage driver options for this container, in the form `{"size": "120G"}`. + */ + StorageOpt: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * A map of container directories which should be replaced by tmpfs + * mounts, and their corresponding mount options. For example: + * + * ``` + * { "/run": "rw,noexec,nosuid,size=65536k" } + * ``` + */ + Tmpfs: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * UTS namespace to use for the container. + */ + UTSMode: v.exactOptional(v.string()), + /** + * Sets the usernamespace mode for the container when usernamespace + * remapping option is enabled. + */ + UsernsMode: v.exactOptional(v.string()), + /** + * Size of `/dev/shm` in bytes. If omitted, the system uses 64MB. + */ + ShmSize: v.exactOptional(v.pipe(v.number(), v.integer(), v.minValue(0))), + /** + * A list of kernel parameters (sysctls) to set in the container. + * For example: + * + * ``` + * {"net.ipv4.ip_forward": "1"} + * ``` + */ + Sysctls: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Runtime to use with this container. + */ + Runtime: v.exactOptional(v.string()), + /** + * Isolation technology of the container. (Windows only) + */ + Isolation: v.exactOptional( + v.picklist(["default", "process", "hyperv", ""]), + ), + /** + * The list of paths to be masked inside the container (this overrides + * the default set of paths). + */ + MaskedPaths: v.exactOptional(v.array(v.string())), + /** + * The list of paths to be set as read-only inside the container + * (this overrides the default set of paths). + */ + ReadonlyPaths: v.exactOptional(v.array(v.string())), + }), +]); +/** + * Configuration for a container that is portable between hosts. + * + * When used as `ContainerConfig` field in an image, `ContainerConfig` is an + * optional field containing the configuration of the container that was last + * committed when creating the image. + * + * Previous versions of Docker builder used this field to store build cache, + * and it is not in active use anymore. + */ +export const containerConfigSchema = v.strictObject({ + /** + * The hostname to use for the container, as a valid RFC 1123 hostname. + */ + Hostname: v.exactOptional(v.string()), + /** + * The domain name to use for the container. + */ + Domainname: v.exactOptional(v.string()), + /** + * The user that commands are run as inside the container. + */ + User: v.exactOptional(v.string()), + /** + * Whether to attach to `stdin`. + */ + AttachStdin: v.exactOptional(v.boolean()), + /** + * Whether to attach to `stdout`. + */ + AttachStdout: v.exactOptional(v.boolean()), + /** + * Whether to attach to `stderr`. + */ + AttachStderr: v.exactOptional(v.boolean()), + /** + * An object mapping ports to an empty object in the form: + * + * `{"/": {}}` + */ + ExposedPorts: v.exactOptional(v.nullable(v.record(v.string(), v.unknown()))), + /** + * Attach standard streams to a TTY, including `stdin` if it is not closed. + */ + Tty: v.exactOptional(v.boolean()), + /** + * Open `stdin` + */ + OpenStdin: v.exactOptional(v.boolean()), + /** + * Close `stdin` after one attached client disconnects + */ + StdinOnce: v.exactOptional(v.boolean()), + /** + * A list of environment variables to set inside the container in the + * form `["VAR=value", ...]`. A variable without `=` is removed from the + * environment, rather than to have an empty value. + */ + Env: v.exactOptional(v.array(v.string())), + /** + * Command to run specified as a string or an array of strings. + */ + Cmd: v.exactOptional(v.array(v.string())), + /** + * A test to perform to check that the container is healthy. + */ + Healthcheck: v.exactOptional( + v.strictObject({ + /** + * The test to perform. Possible values are: + * + * - `[]` inherit healthcheck from image or parent image + * - `["NONE"]` disable healthcheck + * - `["CMD", args...]` exec arguments directly + * - `["CMD-SHELL", command]` run command with system's default shell + */ + Test: v.exactOptional(v.array(v.string())), + /** + * The time to wait between checks in nanoseconds. It should be 0 or at + * least 1000000 (1 ms). 0 means inherit. + */ + Interval: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The time to wait before considering the check to have hung. It should + * be 0 or at least 1000000 (1 ms). 0 means inherit. + */ + Timeout: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The number of consecutive failures needed to consider a container as + * unhealthy. 0 means inherit. + */ + Retries: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Start period for the container to initialize before starting + * health-retries countdown in nanoseconds. It should be 0 or at least + * 1000000 (1 ms). 0 means inherit. + */ + StartPeriod: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * Command is already escaped (Windows only) + */ + ArgsEscaped: v.exactOptional(v.nullable(v.boolean())), + /** + * The name (or reference) of the image to use when creating the container, + * or which was used when the container was created. + */ + Image: v.exactOptional(v.string()), + /** + * An object mapping mount point paths inside the container to empty + * objects. + */ + Volumes: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * The working directory for commands to run in. + */ + WorkingDir: v.exactOptional(v.string()), + /** + * The entry point for the container as a string or an array of strings. + * + * If the array consists of exactly one empty string (`[""]`) then the + * entry point is reset to system default (i.e., the entry point used by + * docker when there is no `ENTRYPOINT` instruction in the `Dockerfile`). + */ + Entrypoint: v.exactOptional(v.array(v.string())), + /** + * Disable networking for the container. + */ + NetworkDisabled: v.exactOptional(v.nullable(v.boolean())), + /** + * MAC address of the container. + */ + MacAddress: v.exactOptional(v.nullable(v.string())), + /** + * `ONBUILD` metadata that were defined in the image's `Dockerfile`. + */ + OnBuild: v.exactOptional(v.nullable(v.array(v.string()))), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Signal to stop a container as a string or unsigned integer. + */ + StopSignal: v.exactOptional(v.nullable(v.string())), + /** + * Timeout to stop a container in seconds. + */ + StopTimeout: v.exactOptional(v.nullable(v.pipe(v.number(), v.integer()))), + /** + * Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell. + */ + Shell: v.exactOptional(v.nullable(v.array(v.string()))), +}); +/** + * Configuration of the image. These fields are used as defaults + * when starting a container from the image. + * @example { + * "Hostname": "", + * "Domainname": "", + * "User": "web:web", + * "AttachStdin": false, + * "AttachStdout": false, + * "AttachStderr": false, + * "ExposedPorts": { + * "80/tcp": {}, + * "443/tcp": {} + * }, + * "Tty": false, + * "OpenStdin": false, + * "StdinOnce": false, + * "Env": [ + * "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + * ], + * "Cmd": [ + * "/bin/sh" + * ], + * "Healthcheck": { + * "Test": [ + * "string" + * ], + * "Interval": 0, + * "Timeout": 0, + * "Retries": 0, + * "StartPeriod": 0, + * "StartInterval": 0 + * }, + * "ArgsEscaped": true, + * "Image": "", + * "Volumes": { + * "/app/data": {}, + * "/app/config": {} + * }, + * "WorkingDir": "/public/", + * "Entrypoint": [], + * "OnBuild": [], + * "Labels": { + * "com.example.some-label": "some-value", + * "com.example.some-other-label": "some-other-value" + * }, + * "StopSignal": "SIGTERM", + * "Shell": [ + * "/bin/sh", + * "-c" + * ] + * } + */ +export const imageConfigSchema = v.strictObject({ + /** + * The hostname to use for the container, as a valid RFC 1123 hostname. + * + *


+ * + * > **Note**: this field is always empty and must not be used. + */ + Hostname: v.exactOptional(v.string()), + /** + * The domain name to use for the container. + * + *


+ * + * > **Note**: this field is always empty and must not be used. + */ + Domainname: v.exactOptional(v.string()), + /** + * The user that commands are run as inside the container. + */ + User: v.exactOptional(v.string()), + /** + * Whether to attach to `stdin`. + * + *


+ * + * > **Note**: this field is always false and must not be used. + */ + AttachStdin: v.exactOptional(v.boolean()), + /** + * Whether to attach to `stdout`. + * + *


+ * + * > **Note**: this field is always false and must not be used. + */ + AttachStdout: v.exactOptional(v.boolean()), + /** + * Whether to attach to `stderr`. + * + *


+ * + * > **Note**: this field is always false and must not be used. + */ + AttachStderr: v.exactOptional(v.boolean()), + /** + * An object mapping ports to an empty object in the form: + * + * `{"/": {}}` + */ + ExposedPorts: v.exactOptional(v.nullable(v.record(v.string(), v.unknown()))), + /** + * Attach standard streams to a TTY, including `stdin` if it is not closed. + * + *


+ * + * > **Note**: this field is always false and must not be used. + */ + Tty: v.exactOptional(v.boolean()), + /** + * Open `stdin` + * + *


+ * + * > **Note**: this field is always false and must not be used. + */ + OpenStdin: v.exactOptional(v.boolean()), + /** + * Close `stdin` after one attached client disconnects. + * + *


+ * + * > **Note**: this field is always false and must not be used. + */ + StdinOnce: v.exactOptional(v.boolean()), + /** + * A list of environment variables to set inside the container in the + * form `["VAR=value", ...]`. A variable without `=` is removed from the + * environment, rather than to have an empty value. + */ + Env: v.exactOptional(v.array(v.string())), + /** + * Command to run specified as a string or an array of strings. + */ + Cmd: v.exactOptional(v.array(v.string())), + /** + * A test to perform to check that the container is healthy. + */ + Healthcheck: v.exactOptional( + v.strictObject({ + /** + * The test to perform. Possible values are: + * + * - `[]` inherit healthcheck from image or parent image + * - `["NONE"]` disable healthcheck + * - `["CMD", args...]` exec arguments directly + * - `["CMD-SHELL", command]` run command with system's default shell + */ + Test: v.exactOptional(v.array(v.string())), + /** + * The time to wait between checks in nanoseconds. It should be 0 or at + * least 1000000 (1 ms). 0 means inherit. + */ + Interval: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The time to wait before considering the check to have hung. It should + * be 0 or at least 1000000 (1 ms). 0 means inherit. + */ + Timeout: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The number of consecutive failures needed to consider a container as + * unhealthy. 0 means inherit. + */ + Retries: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Start period for the container to initialize before starting + * health-retries countdown in nanoseconds. It should be 0 or at least + * 1000000 (1 ms). 0 means inherit. + */ + StartPeriod: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * Command is already escaped (Windows only) + */ + ArgsEscaped: v.exactOptional(v.nullable(v.boolean())), + /** + * The name (or reference) of the image to use when creating the container, + * or which was used when the container was created. + * + *


+ * + * > **Note**: this field is always empty and must not be used. + */ + Image: v.exactOptional(v.string()), + /** + * An object mapping mount point paths inside the container to empty + * objects. + */ + Volumes: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * The working directory for commands to run in. + */ + WorkingDir: v.exactOptional(v.string()), + /** + * The entry point for the container as a string or an array of strings. + * + * If the array consists of exactly one empty string (`[""]`) then the + * entry point is reset to system default (i.e., the entry point used by + * docker when there is no `ENTRYPOINT` instruction in the `Dockerfile`). + */ + Entrypoint: v.exactOptional(v.array(v.string())), + /** + * Disable networking for the container. + * + *


+ * + * > **Note**: this field is always omitted and must not be used. + */ + NetworkDisabled: v.exactOptional(v.nullable(v.boolean())), + /** + * MAC address of the container. + * + *


+ * + * > **Note**: this field is always omitted and must not be used. + */ + MacAddress: v.exactOptional(v.nullable(v.string())), + /** + * `ONBUILD` metadata that were defined in the image's `Dockerfile`. + */ + OnBuild: v.exactOptional(v.nullable(v.array(v.string()))), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Signal to stop a container as a string or unsigned integer. + */ + StopSignal: v.exactOptional(v.nullable(v.string())), + /** + * Timeout to stop a container in seconds. + * + *


+ * + * > **Note**: this field is always omitted and must not be used. + */ + StopTimeout: v.exactOptional(v.nullable(v.pipe(v.number(), v.integer()))), + /** + * Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell. + */ + Shell: v.exactOptional(v.nullable(v.array(v.string()))), +}); +/** + * NetworkingConfig represents the container's networking configuration for + * each of its interfaces. + * It is used for the networking configs specified in the `docker create` + * and `docker network connect` commands. + * @example { + * "EndpointsConfig": { + * "isolated_nw": { + * "IPAMConfig": { + * "IPv4Address": "172.20.30.33", + * "IPv6Address": "2001:db8:abcd::3033", + * "LinkLocalIPs": [ + * "169.254.34.68", + * "fe80::3468" + * ] + * }, + * "Links": [ + * "container_1", + * "container_2" + * ], + * "Aliases": [ + * "server_x", + * "server_y" + * ] + * } + * } + * } + */ +export const networkingConfigSchema = v.strictObject({ + /** + * A mapping of network name to endpoint configuration for that network. + */ + EndpointsConfig: v.exactOptional(v.record(v.string(), v.unknown())), +}); +/** NetworkSettings exposes the network settings in the API */ +export const networkSettingsSchema = v.strictObject({ + /** + * Name of the network's bridge (for example, `docker0`). + */ + Bridge: v.exactOptional(v.string()), + /** + * SandboxID uniquely represents a container's network stack. + */ + SandboxID: v.exactOptional(v.string()), + /** + * Indicates if hairpin NAT should be enabled on the virtual interface. + */ + HairpinMode: v.exactOptional(v.boolean()), + /** + * IPv6 unicast address using the link-local prefix. + */ + LinkLocalIPv6Address: v.exactOptional(v.string()), + /** + * Prefix length of the IPv6 unicast address. + */ + LinkLocalIPv6PrefixLen: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * PortMap describes the mapping of container ports to host ports, using the + * container's port-number and protocol as key in the format + * `/`, + * for example, `80/udp`. + * + * If a container's port is mapped for multiple protocols, separate entries + * are added to the mapping table. + */ + Ports: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * SandboxKey identifies the sandbox + */ + SandboxKey: v.exactOptional(v.string()), + SecondaryIPAddresses: v.exactOptional( + v.nullable( + v.array( + v.strictObject({ + /** + * IP address. + */ + Addr: v.exactOptional(v.string()), + /** + * Mask length of the IP address. + */ + PrefixLen: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + ), + ), + SecondaryIPv6Addresses: v.exactOptional( + v.nullable( + v.array( + v.strictObject({ + /** + * IP address. + */ + Addr: v.exactOptional(v.string()), + /** + * Mask length of the IP address. + */ + PrefixLen: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + ), + ), + /** + * EndpointID uniquely represents a service endpoint in a Sandbox. + * + *


+ * + * > **Deprecated**: This field is only propagated when attached to the + * > default "bridge" network. Use the information from the "bridge" + * > network inside the `Networks` map instead, which contains the same + * > information. This field was deprecated in Docker 1.9 and is scheduled + * > to be removed in Docker 17.12.0 + */ + EndpointID: v.exactOptional(v.string()), + /** + * Gateway address for the default "bridge" network. + * + *


+ * + * > **Deprecated**: This field is only propagated when attached to the + * > default "bridge" network. Use the information from the "bridge" + * > network inside the `Networks` map instead, which contains the same + * > information. This field was deprecated in Docker 1.9 and is scheduled + * > to be removed in Docker 17.12.0 + */ + Gateway: v.exactOptional(v.string()), + /** + * Global IPv6 address for the default "bridge" network. + * + *


+ * + * > **Deprecated**: This field is only propagated when attached to the + * > default "bridge" network. Use the information from the "bridge" + * > network inside the `Networks` map instead, which contains the same + * > information. This field was deprecated in Docker 1.9 and is scheduled + * > to be removed in Docker 17.12.0 + */ + GlobalIPv6Address: v.exactOptional(v.string()), + /** + * Mask length of the global IPv6 address. + * + *


+ * + * > **Deprecated**: This field is only propagated when attached to the + * > default "bridge" network. Use the information from the "bridge" + * > network inside the `Networks` map instead, which contains the same + * > information. This field was deprecated in Docker 1.9 and is scheduled + * > to be removed in Docker 17.12.0 + */ + GlobalIPv6PrefixLen: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * IPv4 address for the default "bridge" network. + * + *


+ * + * > **Deprecated**: This field is only propagated when attached to the + * > default "bridge" network. Use the information from the "bridge" + * > network inside the `Networks` map instead, which contains the same + * > information. This field was deprecated in Docker 1.9 and is scheduled + * > to be removed in Docker 17.12.0 + */ + IPAddress: v.exactOptional(v.string()), + /** + * Mask length of the IPv4 address. + * + *


+ * + * > **Deprecated**: This field is only propagated when attached to the + * > default "bridge" network. Use the information from the "bridge" + * > network inside the `Networks` map instead, which contains the same + * > information. This field was deprecated in Docker 1.9 and is scheduled + * > to be removed in Docker 17.12.0 + */ + IPPrefixLen: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * IPv6 gateway address for this network. + * + *


+ * + * > **Deprecated**: This field is only propagated when attached to the + * > default "bridge" network. Use the information from the "bridge" + * > network inside the `Networks` map instead, which contains the same + * > information. This field was deprecated in Docker 1.9 and is scheduled + * > to be removed in Docker 17.12.0 + */ + IPv6Gateway: v.exactOptional(v.string()), + /** + * MAC address for the container on the default "bridge" network. + * + *


+ * + * > **Deprecated**: This field is only propagated when attached to the + * > default "bridge" network. Use the information from the "bridge" + * > network inside the `Networks` map instead, which contains the same + * > information. This field was deprecated in Docker 1.9 and is scheduled + * > to be removed in Docker 17.12.0 + */ + MacAddress: v.exactOptional(v.string()), + /** + * Information about all networks that the container is connected to. + */ + Networks: v.exactOptional(v.record(v.string(), v.unknown())), +}); +/** Address represents an IPv4 or IPv6 IP address. */ +export const addressSchema = v.strictObject({ + /** + * IP address. + */ + Addr: v.exactOptional(v.string()), + /** + * Mask length of the IP address. + */ + PrefixLen: v.exactOptional(v.pipe(v.number(), v.integer())), +}); +/** + * PortMap describes the mapping of container ports to host ports, using the + * container's port-number and protocol as key in the format + * `/`, + * for example, `80/udp`. + * + * If a container's port is mapped for multiple protocols, separate entries + * are added to the mapping table. + * @example { + * "443/tcp": [ + * { + * "HostIp": "127.0.0.1", + * "HostPort": "4443" + * } + * ], + * "80/tcp": [ + * { + * "HostIp": "0.0.0.0", + * "HostPort": "80" + * }, + * { + * "HostIp": "0.0.0.0", + * "HostPort": "8080" + * } + * ], + * "80/udp": [ + * { + * "HostIp": "0.0.0.0", + * "HostPort": "80" + * } + * ], + * "53/udp": [ + * { + * "HostIp": "0.0.0.0", + * "HostPort": "53" + * } + * ] + * } + */ +export const portMapSchema = v.record(v.string(), v.unknown()); +/** + * PortBinding represents a binding between a host IP address and a host + * port. + */ +export const portBindingSchema = v.strictObject({ + /** + * Host IP address that the container's port is mapped to. + */ + HostIp: v.exactOptional(v.string()), + /** + * Host port number that the container's port is mapped to. + */ + HostPort: v.exactOptional(v.string()), +}); +/** + * Information about the storage driver used to store the container's and + * image's filesystem. + */ +export const graphDriverDataSchema = v.strictObject({ + /** + * Name of the storage driver. + */ + Name: v.string(), + /** + * Low-level storage metadata, provided as key/value pairs. + * + * This information is driver-specific, and depends on the storage-driver + * in use, and should be used for informational purposes only. + */ + Data: v.record(v.string(), v.unknown()), +}); +/** Change in the container's filesystem. */ +export const filesystemChangeSchema = v.strictObject({ + /** + * Path to file or directory that has changed. + */ + Path: v.string(), + /** + * Kind of change + * + * Can be one of: + * + * - `0`: Modified ("C") + * - `1`: Added ("A") + * - `2`: Deleted ("D") + */ + Kind: v.pipe(v.number(), v.integer()), +}); +/** + * Kind of change + * + * Can be one of: + * + * - `0`: Modified ("C") + * - `1`: Added ("A") + * - `2`: Deleted ("D") + */ +export const changeTypeSchema = v.pipe(v.number(), v.integer()); +/** Information about an image in the local image cache. */ +export const imageInspectSchema = v.strictObject({ + /** + * ID is the content-addressable ID of an image. + * + * This identifier is a content-addressable digest calculated from the + * image's configuration (which includes the digests of layers used by + * the image). + * + * Note that this digest differs from the `RepoDigests` below, which + * holds digests of image manifests that reference the image. + */ + Id: v.exactOptional(v.string()), + /** + * List of image names/tags in the local image cache that reference this + * image. + * + * Multiple image tags can refer to the same image, and this list may be + * empty if no tags reference the image, in which case the image is + * "untagged", in which case it can still be referenced by its ID. + */ + RepoTags: v.exactOptional(v.array(v.string())), + /** + * List of content-addressable digests of locally available image manifests + * that the image is referenced from. Multiple manifests can refer to the + * same image. + * + * These digests are usually only available if the image was either pulled + * from a registry, or if the image was pushed to a registry, which is when + * the manifest is generated and its digest calculated. + */ + RepoDigests: v.exactOptional(v.array(v.string())), + /** + * ID of the parent image. + * + * Depending on how the image was created, this field may be empty and + * is only set for images that were built/created locally. This field + * is empty if the image was pulled from an image registry. + */ + Parent: v.exactOptional(v.string()), + /** + * Optional message that was set when committing or importing the image. + */ + Comment: v.exactOptional(v.string()), + /** + * Date and time at which the image was created, formatted in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + */ + Created: v.exactOptional(v.string()), + /** + * The ID of the container that was used to create the image. + * + * Depending on how the image was created, this field may be empty. + */ + Container: v.exactOptional(v.string()), + /** + * Configuration for a container that is portable between hosts. + * + * When used as `ContainerConfig` field in an image, `ContainerConfig` is an + * optional field containing the configuration of the container that was last + * committed when creating the image. + * + * Previous versions of Docker builder used this field to store build cache, + * and it is not in active use anymore. + */ + ContainerConfig: v.exactOptional( + v.strictObject({ + /** + * The hostname to use for the container, as a valid RFC 1123 hostname. + */ + Hostname: v.exactOptional(v.string()), + /** + * The domain name to use for the container. + */ + Domainname: v.exactOptional(v.string()), + /** + * The user that commands are run as inside the container. + */ + User: v.exactOptional(v.string()), + /** + * Whether to attach to `stdin`. + */ + AttachStdin: v.exactOptional(v.boolean()), + /** + * Whether to attach to `stdout`. + */ + AttachStdout: v.exactOptional(v.boolean()), + /** + * Whether to attach to `stderr`. + */ + AttachStderr: v.exactOptional(v.boolean()), + /** + * An object mapping ports to an empty object in the form: + * + * `{"/": {}}` + */ + ExposedPorts: v.exactOptional( + v.nullable(v.record(v.string(), v.unknown())), + ), + /** + * Attach standard streams to a TTY, including `stdin` if it is not closed. + */ + Tty: v.exactOptional(v.boolean()), + /** + * Open `stdin` + */ + OpenStdin: v.exactOptional(v.boolean()), + /** + * Close `stdin` after one attached client disconnects + */ + StdinOnce: v.exactOptional(v.boolean()), + /** + * A list of environment variables to set inside the container in the + * form `["VAR=value", ...]`. A variable without `=` is removed from the + * environment, rather than to have an empty value. + */ + Env: v.exactOptional(v.array(v.string())), + /** + * Command to run specified as a string or an array of strings. + */ + Cmd: v.exactOptional(v.array(v.string())), + /** + * A test to perform to check that the container is healthy. + */ + Healthcheck: v.exactOptional( + v.strictObject({ + /** + * The test to perform. Possible values are: + * + * - `[]` inherit healthcheck from image or parent image + * - `["NONE"]` disable healthcheck + * - `["CMD", args...]` exec arguments directly + * - `["CMD-SHELL", command]` run command with system's default shell + */ + Test: v.exactOptional(v.array(v.string())), + /** + * The time to wait between checks in nanoseconds. It should be 0 or at + * least 1000000 (1 ms). 0 means inherit. + */ + Interval: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The time to wait before considering the check to have hung. It should + * be 0 or at least 1000000 (1 ms). 0 means inherit. + */ + Timeout: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The number of consecutive failures needed to consider a container as + * unhealthy. 0 means inherit. + */ + Retries: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Start period for the container to initialize before starting + * health-retries countdown in nanoseconds. It should be 0 or at least + * 1000000 (1 ms). 0 means inherit. + */ + StartPeriod: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * Command is already escaped (Windows only) + */ + ArgsEscaped: v.exactOptional(v.nullable(v.boolean())), + /** + * The name (or reference) of the image to use when creating the container, + * or which was used when the container was created. + */ + Image: v.exactOptional(v.string()), + /** + * An object mapping mount point paths inside the container to empty + * objects. + */ + Volumes: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * The working directory for commands to run in. + */ + WorkingDir: v.exactOptional(v.string()), + /** + * The entry point for the container as a string or an array of strings. + * + * If the array consists of exactly one empty string (`[""]`) then the + * entry point is reset to system default (i.e., the entry point used by + * docker when there is no `ENTRYPOINT` instruction in the `Dockerfile`). + */ + Entrypoint: v.exactOptional(v.array(v.string())), + /** + * Disable networking for the container. + */ + NetworkDisabled: v.exactOptional(v.nullable(v.boolean())), + /** + * MAC address of the container. + */ + MacAddress: v.exactOptional(v.nullable(v.string())), + /** + * `ONBUILD` metadata that were defined in the image's `Dockerfile`. + */ + OnBuild: v.exactOptional(v.nullable(v.array(v.string()))), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Signal to stop a container as a string or unsigned integer. + */ + StopSignal: v.exactOptional(v.nullable(v.string())), + /** + * Timeout to stop a container in seconds. + */ + StopTimeout: v.exactOptional(v.nullable(v.pipe(v.number(), v.integer()))), + /** + * Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell. + */ + Shell: v.exactOptional(v.nullable(v.array(v.string()))), + }), + ), + /** + * The version of Docker that was used to build the image. + * + * Depending on how the image was created, this field may be empty. + */ + DockerVersion: v.exactOptional(v.string()), + /** + * Name of the author that was specified when committing the image, or as + * specified through MAINTAINER (deprecated) in the Dockerfile. + */ + Author: v.exactOptional(v.string()), + /** + * Configuration of the image. These fields are used as defaults + * when starting a container from the image. + */ + Config: v.exactOptional( + v.strictObject({ + /** + * The hostname to use for the container, as a valid RFC 1123 hostname. + * + *


+ * + * > **Note**: this field is always empty and must not be used. + */ + Hostname: v.exactOptional(v.string()), + /** + * The domain name to use for the container. + * + *


+ * + * > **Note**: this field is always empty and must not be used. + */ + Domainname: v.exactOptional(v.string()), + /** + * The user that commands are run as inside the container. + */ + User: v.exactOptional(v.string()), + /** + * Whether to attach to `stdin`. + * + *


+ * + * > **Note**: this field is always false and must not be used. + */ + AttachStdin: v.exactOptional(v.boolean()), + /** + * Whether to attach to `stdout`. + * + *


+ * + * > **Note**: this field is always false and must not be used. + */ + AttachStdout: v.exactOptional(v.boolean()), + /** + * Whether to attach to `stderr`. + * + *


+ * + * > **Note**: this field is always false and must not be used. + */ + AttachStderr: v.exactOptional(v.boolean()), + /** + * An object mapping ports to an empty object in the form: + * + * `{"/": {}}` + */ + ExposedPorts: v.exactOptional( + v.nullable(v.record(v.string(), v.unknown())), + ), + /** + * Attach standard streams to a TTY, including `stdin` if it is not closed. + * + *


+ * + * > **Note**: this field is always false and must not be used. + */ + Tty: v.exactOptional(v.boolean()), + /** + * Open `stdin` + * + *


+ * + * > **Note**: this field is always false and must not be used. + */ + OpenStdin: v.exactOptional(v.boolean()), + /** + * Close `stdin` after one attached client disconnects. + * + *


+ * + * > **Note**: this field is always false and must not be used. + */ + StdinOnce: v.exactOptional(v.boolean()), + /** + * A list of environment variables to set inside the container in the + * form `["VAR=value", ...]`. A variable without `=` is removed from the + * environment, rather than to have an empty value. + */ + Env: v.exactOptional(v.array(v.string())), + /** + * Command to run specified as a string or an array of strings. + */ + Cmd: v.exactOptional(v.array(v.string())), + /** + * A test to perform to check that the container is healthy. + */ + Healthcheck: v.exactOptional( + v.strictObject({ + /** + * The test to perform. Possible values are: + * + * - `[]` inherit healthcheck from image or parent image + * - `["NONE"]` disable healthcheck + * - `["CMD", args...]` exec arguments directly + * - `["CMD-SHELL", command]` run command with system's default shell + */ + Test: v.exactOptional(v.array(v.string())), + /** + * The time to wait between checks in nanoseconds. It should be 0 or at + * least 1000000 (1 ms). 0 means inherit. + */ + Interval: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The time to wait before considering the check to have hung. It should + * be 0 or at least 1000000 (1 ms). 0 means inherit. + */ + Timeout: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The number of consecutive failures needed to consider a container as + * unhealthy. 0 means inherit. + */ + Retries: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Start period for the container to initialize before starting + * health-retries countdown in nanoseconds. It should be 0 or at least + * 1000000 (1 ms). 0 means inherit. + */ + StartPeriod: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * Command is already escaped (Windows only) + */ + ArgsEscaped: v.exactOptional(v.nullable(v.boolean())), + /** + * The name (or reference) of the image to use when creating the container, + * or which was used when the container was created. + * + *


+ * + * > **Note**: this field is always empty and must not be used. + */ + Image: v.exactOptional(v.string()), + /** + * An object mapping mount point paths inside the container to empty + * objects. + */ + Volumes: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * The working directory for commands to run in. + */ + WorkingDir: v.exactOptional(v.string()), + /** + * The entry point for the container as a string or an array of strings. + * + * If the array consists of exactly one empty string (`[""]`) then the + * entry point is reset to system default (i.e., the entry point used by + * docker when there is no `ENTRYPOINT` instruction in the `Dockerfile`). + */ + Entrypoint: v.exactOptional(v.array(v.string())), + /** + * Disable networking for the container. + * + *


+ * + * > **Note**: this field is always omitted and must not be used. + */ + NetworkDisabled: v.exactOptional(v.nullable(v.boolean())), + /** + * MAC address of the container. + * + *


+ * + * > **Note**: this field is always omitted and must not be used. + */ + MacAddress: v.exactOptional(v.nullable(v.string())), + /** + * `ONBUILD` metadata that were defined in the image's `Dockerfile`. + */ + OnBuild: v.exactOptional(v.nullable(v.array(v.string()))), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Signal to stop a container as a string or unsigned integer. + */ + StopSignal: v.exactOptional(v.nullable(v.string())), + /** + * Timeout to stop a container in seconds. + * + *


+ * + * > **Note**: this field is always omitted and must not be used. + */ + StopTimeout: v.exactOptional(v.nullable(v.pipe(v.number(), v.integer()))), + /** + * Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell. + */ + Shell: v.exactOptional(v.nullable(v.array(v.string()))), + }), + ), + /** + * Hardware CPU architecture that the image runs on. + */ + Architecture: v.exactOptional(v.string()), + /** + * CPU architecture variant (presently ARM-only). + */ + Variant: v.exactOptional(v.nullable(v.string())), + /** + * Operating System the image is built to run on. + */ + Os: v.exactOptional(v.string()), + /** + * Operating System version the image is built to run on (especially + * for Windows). + */ + OsVersion: v.exactOptional(v.nullable(v.string())), + /** + * Total size of the image including all layers it is composed of. + */ + Size: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Total size of the image including all layers it is composed of. + * + * In versions of Docker before v1.10, this field was calculated from + * the image itself and all of its parent images. Images are now stored + * self-contained, and no longer use a parent-chain, making this field + * an equivalent of the Size field. + * + * > **Deprecated**: this field is kept for backward compatibility, but + * > will be removed in API v1.44. + */ + VirtualSize: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Information about the storage driver used to store the container's and + * image's filesystem. + */ + GraphDriver: v.exactOptional( + v.strictObject({ + /** + * Name of the storage driver. + */ + Name: v.string(), + /** + * Low-level storage metadata, provided as key/value pairs. + * + * This information is driver-specific, and depends on the storage-driver + * in use, and should be used for informational purposes only. + */ + Data: v.record(v.string(), v.unknown()), + }), + ), + /** + * Information about the image's RootFS, including the layer IDs. + */ + RootFS: v.exactOptional( + v.strictObject({ + Type: v.string(), + Layers: v.exactOptional(v.array(v.string())), + }), + ), + /** + * Additional metadata of the image in the local cache. This information + * is local to the daemon, and not part of the image itself. + */ + Metadata: v.exactOptional( + v.strictObject({ + /** + * Date and time at which the image was last tagged in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + * + * This information is only available if the image was tagged locally, + * and omitted otherwise. + */ + LastTagTime: v.exactOptional(v.nullable(v.string())), + }), + ), +}); +export const imageSummarySchema = v.strictObject({ + /** + * ID is the content-addressable ID of an image. + * + * This identifier is a content-addressable digest calculated from the + * image's configuration (which includes the digests of layers used by + * the image). + * + * Note that this digest differs from the `RepoDigests` below, which + * holds digests of image manifests that reference the image. + */ + Id: v.string(), + /** + * ID of the parent image. + * + * Depending on how the image was created, this field may be empty and + * is only set for images that were built/created locally. This field + * is empty if the image was pulled from an image registry. + */ + ParentId: v.string(), + /** + * List of image names/tags in the local image cache that reference this + * image. + * + * Multiple image tags can refer to the same image, and this list may be + * empty if no tags reference the image, in which case the image is + * "untagged", in which case it can still be referenced by its ID. + */ + RepoTags: v.array(v.string()), + /** + * List of content-addressable digests of locally available image manifests + * that the image is referenced from. Multiple manifests can refer to the + * same image. + * + * These digests are usually only available if the image was either pulled + * from a registry, or if the image was pushed to a registry, which is when + * the manifest is generated and its digest calculated. + */ + RepoDigests: v.array(v.string()), + /** + * Date and time at which the image was created as a Unix timestamp + * (number of seconds since EPOCH). + */ + Created: v.pipe(v.number(), v.integer()), + /** + * Total size of the image including all layers it is composed of. + */ + Size: v.pipe(v.number(), v.integer()), + /** + * Total size of image layers that are shared between this image and other + * images. + * + * This size is not calculated by default. `-1` indicates that the value + * has not been set / calculated. + */ + SharedSize: v.pipe(v.number(), v.integer()), + /** + * Total size of the image including all layers it is composed of. + * + * In versions of Docker before v1.10, this field was calculated from + * the image itself and all of its parent images. Images are now stored + * self-contained, and no longer use a parent-chain, making this field + * an equivalent of the Size field. + * + * Deprecated: this field is kept for backward compatibility, and will be + * removed in API v1.44. + */ + VirtualSize: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * User-defined key/value metadata. + */ + Labels: v.record(v.string(), v.unknown()), + /** + * Number of containers using this image. Includes both stopped and running + * containers. + * + * This size is not calculated by default, and depends on which API endpoint + * is used. `-1` indicates that the value has not been set / calculated. + */ + Containers: v.pipe(v.number(), v.integer()), +}); +export const authConfigSchema = v.strictObject({ + username: v.exactOptional(v.string()), + password: v.exactOptional(v.string()), + email: v.exactOptional(v.string()), + serveraddress: v.exactOptional(v.string()), +}); +export const processConfigSchema = v.strictObject({ + privileged: v.exactOptional(v.boolean()), + user: v.exactOptional(v.string()), + tty: v.exactOptional(v.boolean()), + entrypoint: v.exactOptional(v.string()), + arguments: v.exactOptional(v.array(v.string())), +}); +export const volumeSchema = v.strictObject({ + /** + * Name of the volume. + */ + Name: v.string(), + /** + * Name of the volume driver used by the volume. + */ + Driver: v.string(), + /** + * Mount path of the volume on the host. + */ + Mountpoint: v.string(), + /** + * Date/Time the volume was created. + */ + CreatedAt: v.exactOptional(v.string()), + /** + * Low-level details about the volume, provided by the volume driver. + * Details are returned as a map with key/value pairs: + * `{"key":"value","key2":"value2"}`. + * + * The `Status` field is optional, and is omitted if the volume driver + * does not support this feature. + */ + Status: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * User-defined key/value metadata. + */ + Labels: v.record(v.string(), v.unknown()), + /** + * The level at which the volume exists. Either `global` for cluster-wide, + * or `local` for machine level. + */ + Scope: v.picklist(["local", "global"]), + /** + * Options and information specific to, and only present on, Swarm CSI + * cluster volumes. + */ + ClusterVolume: v.exactOptional( + v.strictObject({ + /** + * The Swarm ID of this volume. Because cluster volumes are Swarm + * objects, they have an ID, unlike non-cluster volumes. This ID can + * be used to refer to the Volume instead of the name. + */ + ID: v.exactOptional(v.string()), + /** + * The version number of the object such as node, service, etc. This is needed + * to avoid conflicting writes. The client must send the version number along + * with the modified specification when updating these objects. + * + * This approach ensures safe concurrency and determinism in that the change + * on the object may not be applied if the version number has changed from the + * last read. In other words, if two update requests specify the same base + * version, only one of the requests can succeed. As a result, two separate + * update requests that happen at the same time will not unintentionally + * overwrite each other. + */ + Version: v.exactOptional( + v.strictObject({ + Index: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + CreatedAt: v.exactOptional(v.string()), + UpdatedAt: v.exactOptional(v.string()), + /** + * Cluster-specific options used to create the volume. + */ + Spec: v.exactOptional( + v.strictObject({ + /** + * 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: v.exactOptional(v.string()), + /** + * Defines how the volume is used by tasks. + */ + AccessMode: v.exactOptional( + v.strictObject({ + /** + * The set of nodes this volume can be used on at one time. + * - `single` The volume may only be scheduled to one node at a time. + * - `multi` the volume may be scheduled to any supported number of nodes at a + * time. + */ + Scope: v.exactOptional(v.picklist(["single", "multi"])), + /** + * The number and way that different tasks can use this volume + * at one time. + * - `none` The volume may only be used by one task at a time. + * - `readonly` The volume may be used by any number of tasks, but they all + * must mount the volume as readonly + * - `onewriter` The volume may be used by any number of tasks, but only one + * may mount it as read/write. + * - `all` The volume may have any number of readers and writers. + */ + Sharing: v.exactOptional( + v.picklist(["none", "readonly", "onewriter", "all"]), + ), + /** + * Options for using this volume as a Mount-type volume. + * + * + * Either MountVolume or BlockVolume, but not both, must be + * + * present. + * + * properties: + * + * FsType: + * + * type: "string" + * + * description: | + * + * Specifies the filesystem type for the mount volume. + * + * Optional. + * + * MountFlags: + * + * type: "array" + * + * description: | + * + * Flags to pass when mounting the volume. Optional. + * + * items: + * + * type: "string" + * BlockVolume: + * + * type: "object" + * + * description: | + * + * Options for using this volume as a Block-type volume. + * + * Intentionally empty. + */ + MountVolume: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Swarm Secrets that are passed to the CSI storage plugin when + * operating on this volume. + */ + Secrets: v.exactOptional( + v.array( + v.strictObject({ + /** + * Key is the name of the key of the key-value pair passed to + * the plugin. + */ + Key: v.exactOptional(v.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: v.exactOptional(v.string()), + }), + ), + ), + /** + * Requirements for the accessible topology of the volume. These + * fields are optional. For an in-depth description of what these + * fields mean, see the CSI specification. + */ + AccessibilityRequirements: v.exactOptional( + v.strictObject({ + /** + * A list of required topologies, at least one of which the + * volume must be accessible from. + */ + Requisite: v.exactOptional( + v.array(v.record(v.string(), v.unknown())), + ), + /** + * A list of topologies that the volume should attempt to be + * provisioned in. + */ + Preferred: v.exactOptional( + v.array(v.record(v.string(), v.unknown())), + ), + }), + ), + /** + * The desired capacity that the volume should be created with. If + * empty, the plugin will decide the capacity. + */ + CapacityRange: v.exactOptional( + v.strictObject({ + /** + * The volume must be at least this big. The value of 0 + * indicates an unspecified minimum + */ + RequiredBytes: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + /** + * The volume must not be bigger than this. The value of 0 + * indicates an unspecified maximum. + */ + LimitBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * The availability of the volume for use in tasks. + * - `active` The volume is fully available for scheduling on the cluster + * - `pause` No new workloads should use the volume, but existing workloads + * are not stopped. + * - `drain` All workloads using this volume should be stopped and + * rescheduled, and no new ones should be started. + */ + Availability: v.exactOptional( + v.picklist(["active", "pause", "drain"]), + ), + }), + ), + }), + ), + /** + * Information about the global status of the volume. + */ + Info: v.exactOptional( + v.strictObject({ + /** + * The capacity of the volume in bytes. A value of 0 indicates that + * the capacity is unknown. + */ + CapacityBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * A map of strings to strings returned from the storage plugin when + * the volume is created. + */ + VolumeContext: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * The ID of the volume as returned by the CSI storage plugin. This + * is distinct from the volume's ID as provided by Docker. This ID + * is never used by the user when communicating with Docker to refer + * to this volume. If the ID is blank, then the Volume has not been + * successfully created in the plugin yet. + */ + VolumeID: v.exactOptional(v.string()), + /** + * The topology this volume is actually accessible from. + */ + AccessibleTopology: v.exactOptional( + v.array(v.record(v.string(), v.unknown())), + ), + }), + ), + /** + * The status of the volume as it pertains to its publishing and use on + * specific nodes + */ + PublishStatus: v.exactOptional( + v.array( + v.strictObject({ + /** + * The ID of the Swarm node the volume is published on. + */ + NodeID: v.exactOptional(v.string()), + /** + * The published state of the volume. + * * `pending-publish` The volume should be published to this node, but the + * call to the controller plugin to do so has not yet been successfully + * completed. + * * `published` The volume is published successfully to the node. + * * `pending-node-unpublish` The volume should be unpublished from the node, + * and the manager is awaiting confirmation from the worker that it has done + * so. + * * `pending-controller-unpublish` The volume is successfully unpublished + * from the node, but has not yet been successfully unpublished on the + * controller. + */ + State: v.exactOptional( + v.picklist([ + "pending-publish", + "published", + "pending-node-unpublish", + "pending-controller-unpublish", + ]), + ), + /** + * A map of strings to strings returned by the CSI controller + * plugin when a volume is published. + */ + PublishContext: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + ), + }), + ), + /** + * The driver specific options used when creating the volume. + */ + Options: v.record(v.string(), v.unknown()), + /** + * Usage details about the volume. This information is used by the + * `GET /system/df` endpoint, and omitted in other endpoints. + */ + UsageData: v.exactOptional( + v.nullable( + v.strictObject({ + /** + * Amount of disk space used by the volume (in bytes). This information + * is only available for volumes created with the `"local"` volume + * driver. For volumes created with other volume drivers, this field + * is set to `-1` ("not available") + */ + Size: v.pipe(v.number(), v.integer()), + /** + * The number of containers referencing this volume. This field + * is set to `-1` if the reference-count is not available. + */ + RefCount: v.pipe(v.number(), v.integer()), + }), + ), + ), +}); +/** + * Volume configuration + * @title VolumeConfig + */ +export const volumeCreateOptionsSchema = v.strictObject({ + /** + * The new volume's name. If not specified, Docker generates a name. + */ + Name: v.exactOptional(v.string()), + /** + * Name of the volume driver to use. + */ + Driver: v.exactOptional(v.string()), + /** + * A mapping of driver options and values. These options are + * passed directly to the driver and are driver specific. + */ + DriverOpts: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Cluster-specific options used to create the volume. + */ + ClusterVolumeSpec: v.exactOptional( + v.strictObject({ + /** + * 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: v.exactOptional(v.string()), + /** + * Defines how the volume is used by tasks. + */ + AccessMode: v.exactOptional( + v.strictObject({ + /** + * The set of nodes this volume can be used on at one time. + * - `single` The volume may only be scheduled to one node at a time. + * - `multi` the volume may be scheduled to any supported number of nodes at a + * time. + */ + Scope: v.exactOptional(v.picklist(["single", "multi"])), + /** + * The number and way that different tasks can use this volume + * at one time. + * - `none` The volume may only be used by one task at a time. + * - `readonly` The volume may be used by any number of tasks, but they all + * must mount the volume as readonly + * - `onewriter` The volume may be used by any number of tasks, but only one + * may mount it as read/write. + * - `all` The volume may have any number of readers and writers. + */ + Sharing: v.exactOptional( + v.picklist(["none", "readonly", "onewriter", "all"]), + ), + /** + * Options for using this volume as a Mount-type volume. + * + * + * Either MountVolume or BlockVolume, but not both, must be + * + * present. + * + * properties: + * + * FsType: + * + * type: "string" + * + * description: | + * + * Specifies the filesystem type for the mount volume. + * + * Optional. + * + * MountFlags: + * + * type: "array" + * + * description: | + * + * Flags to pass when mounting the volume. Optional. + * + * items: + * + * type: "string" + * BlockVolume: + * + * type: "object" + * + * description: | + * + * Options for using this volume as a Block-type volume. + * + * Intentionally empty. + */ + MountVolume: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Swarm Secrets that are passed to the CSI storage plugin when + * operating on this volume. + */ + Secrets: v.exactOptional( + v.array( + v.strictObject({ + /** + * Key is the name of the key of the key-value pair passed to + * the plugin. + */ + Key: v.exactOptional(v.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: v.exactOptional(v.string()), + }), + ), + ), + /** + * Requirements for the accessible topology of the volume. These + * fields are optional. For an in-depth description of what these + * fields mean, see the CSI specification. + */ + AccessibilityRequirements: v.exactOptional( + v.strictObject({ + /** + * A list of required topologies, at least one of which the + * volume must be accessible from. + */ + Requisite: v.exactOptional( + v.array(v.record(v.string(), v.unknown())), + ), + /** + * A list of topologies that the volume should attempt to be + * provisioned in. + */ + Preferred: v.exactOptional( + v.array(v.record(v.string(), v.unknown())), + ), + }), + ), + /** + * The desired capacity that the volume should be created with. If + * empty, the plugin will decide the capacity. + */ + CapacityRange: v.exactOptional( + v.strictObject({ + /** + * The volume must be at least this big. The value of 0 + * indicates an unspecified minimum + */ + RequiredBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The volume must not be bigger than this. The value of 0 + * indicates an unspecified maximum. + */ + LimitBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * The availability of the volume for use in tasks. + * - `active` The volume is fully available for scheduling on the cluster + * - `pause` No new workloads should use the volume, but existing workloads + * are not stopped. + * - `drain` All workloads using this volume should be stopped and + * rescheduled, and no new ones should be started. + */ + Availability: v.exactOptional( + v.picklist(["active", "pause", "drain"]), + ), + }), + ), + }), + ), +}); +/** + * Volume list response + * @title VolumeListResponse + */ +export const volumeListResponseSchema = v.strictObject({ + /** + * List of volumes + */ + Volumes: v.exactOptional( + v.array( + v.strictObject({ + /** + * Name of the volume. + */ + Name: v.string(), + /** + * Name of the volume driver used by the volume. + */ + Driver: v.string(), + /** + * Mount path of the volume on the host. + */ + Mountpoint: v.string(), + /** + * Date/Time the volume was created. + */ + CreatedAt: v.exactOptional(v.string()), + /** + * Low-level details about the volume, provided by the volume driver. + * Details are returned as a map with key/value pairs: + * `{"key":"value","key2":"value2"}`. + * + * The `Status` field is optional, and is omitted if the volume driver + * does not support this feature. + */ + Status: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * User-defined key/value metadata. + */ + Labels: v.record(v.string(), v.unknown()), + /** + * The level at which the volume exists. Either `global` for cluster-wide, + * or `local` for machine level. + */ + Scope: v.picklist(["local", "global"]), + /** + * Options and information specific to, and only present on, Swarm CSI + * cluster volumes. + */ + ClusterVolume: v.exactOptional( + v.strictObject({ + /** + * The Swarm ID of this volume. Because cluster volumes are Swarm + * objects, they have an ID, unlike non-cluster volumes. This ID can + * be used to refer to the Volume instead of the name. + */ + ID: v.exactOptional(v.string()), + /** + * The version number of the object such as node, service, etc. This is needed + * to avoid conflicting writes. The client must send the version number along + * with the modified specification when updating these objects. + * + * This approach ensures safe concurrency and determinism in that the change + * on the object may not be applied if the version number has changed from the + * last read. In other words, if two update requests specify the same base + * version, only one of the requests can succeed. As a result, two separate + * update requests that happen at the same time will not unintentionally + * overwrite each other. + */ + Version: v.exactOptional( + v.strictObject({ + Index: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + CreatedAt: v.exactOptional(v.string()), + UpdatedAt: v.exactOptional(v.string()), + /** + * Cluster-specific options used to create the volume. + */ + Spec: v.exactOptional( + v.strictObject({ + /** + * 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: v.exactOptional(v.string()), + /** + * Defines how the volume is used by tasks. + */ + AccessMode: v.exactOptional( + v.strictObject({ + /** + * The set of nodes this volume can be used on at one time. + * - `single` The volume may only be scheduled to one node at a time. + * - `multi` the volume may be scheduled to any supported number of nodes at a + * time. + */ + Scope: v.exactOptional(v.picklist(["single", "multi"])), + /** + * The number and way that different tasks can use this volume + * at one time. + * - `none` The volume may only be used by one task at a time. + * - `readonly` The volume may be used by any number of tasks, but they all + * must mount the volume as readonly + * - `onewriter` The volume may be used by any number of tasks, but only one + * may mount it as read/write. + * - `all` The volume may have any number of readers and writers. + */ + Sharing: v.exactOptional( + v.picklist(["none", "readonly", "onewriter", "all"]), + ), + /** + * Options for using this volume as a Mount-type volume. + * + * + * Either MountVolume or BlockVolume, but not both, must be + * + * present. + * + * properties: + * + * FsType: + * + * type: "string" + * + * description: | + * + * Specifies the filesystem type for the mount volume. + * + * Optional. + * + * MountFlags: + * + * type: "array" + * + * description: | + * + * Flags to pass when mounting the volume. Optional. + * + * items: + * + * type: "string" + * BlockVolume: + * + * type: "object" + * + * description: | + * + * Options for using this volume as a Block-type volume. + * + * Intentionally empty. + */ + MountVolume: v.exactOptional( + v.record(v.string(), v.unknown()), + ), + /** + * Swarm Secrets that are passed to the CSI storage plugin when + * operating on this volume. + */ + Secrets: v.exactOptional( + v.array( + v.strictObject({ + /** + * Key is the name of the key of the key-value pair passed to + * the plugin. + */ + Key: v.exactOptional(v.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: v.exactOptional(v.string()), + }), + ), + ), + /** + * Requirements for the accessible topology of the volume. These + * fields are optional. For an in-depth description of what these + * fields mean, see the CSI specification. + */ + AccessibilityRequirements: v.exactOptional( + v.strictObject({ + /** + * A list of required topologies, at least one of which the + * volume must be accessible from. + */ + Requisite: v.exactOptional( + v.array(v.record(v.string(), v.unknown())), + ), + /** + * A list of topologies that the volume should attempt to be + * provisioned in. + */ + Preferred: v.exactOptional( + v.array(v.record(v.string(), v.unknown())), + ), + }), + ), + /** + * The desired capacity that the volume should be created with. If + * empty, the plugin will decide the capacity. + */ + CapacityRange: v.exactOptional( + v.strictObject({ + /** + * The volume must be at least this big. The value of 0 + * indicates an unspecified minimum + */ + RequiredBytes: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + /** + * The volume must not be bigger than this. The value of 0 + * indicates an unspecified maximum. + */ + LimitBytes: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + }), + ), + /** + * The availability of the volume for use in tasks. + * - `active` The volume is fully available for scheduling on the cluster + * - `pause` No new workloads should use the volume, but existing workloads + * are not stopped. + * - `drain` All workloads using this volume should be stopped and + * rescheduled, and no new ones should be started. + */ + Availability: v.exactOptional( + v.picklist(["active", "pause", "drain"]), + ), + }), + ), + }), + ), + /** + * Information about the global status of the volume. + */ + Info: v.exactOptional( + v.strictObject({ + /** + * The capacity of the volume in bytes. A value of 0 indicates that + * the capacity is unknown. + */ + CapacityBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * A map of strings to strings returned from the storage plugin when + * the volume is created. + */ + VolumeContext: v.exactOptional( + v.record(v.string(), v.unknown()), + ), + /** + * The ID of the volume as returned by the CSI storage plugin. This + * is distinct from the volume's ID as provided by Docker. This ID + * is never used by the user when communicating with Docker to refer + * to this volume. If the ID is blank, then the Volume has not been + * successfully created in the plugin yet. + */ + VolumeID: v.exactOptional(v.string()), + /** + * The topology this volume is actually accessible from. + */ + AccessibleTopology: v.exactOptional( + v.array(v.record(v.string(), v.unknown())), + ), + }), + ), + /** + * The status of the volume as it pertains to its publishing and use on + * specific nodes + */ + PublishStatus: v.exactOptional( + v.array( + v.strictObject({ + /** + * The ID of the Swarm node the volume is published on. + */ + NodeID: v.exactOptional(v.string()), + /** + * The published state of the volume. + * * `pending-publish` The volume should be published to this node, but the + * call to the controller plugin to do so has not yet been successfully + * completed. + * * `published` The volume is published successfully to the node. + * * `pending-node-unpublish` The volume should be unpublished from the node, + * and the manager is awaiting confirmation from the worker that it has done + * so. + * * `pending-controller-unpublish` The volume is successfully unpublished + * from the node, but has not yet been successfully unpublished on the + * controller. + */ + State: v.exactOptional( + v.picklist([ + "pending-publish", + "published", + "pending-node-unpublish", + "pending-controller-unpublish", + ]), + ), + /** + * A map of strings to strings returned by the CSI controller + * plugin when a volume is published. + */ + PublishContext: v.exactOptional( + v.record(v.string(), v.unknown()), + ), + }), + ), + ), + }), + ), + /** + * The driver specific options used when creating the volume. + */ + Options: v.record(v.string(), v.unknown()), + /** + * Usage details about the volume. This information is used by the + * `GET /system/df` endpoint, and omitted in other endpoints. + */ + UsageData: v.exactOptional( + v.nullable( + v.strictObject({ + /** + * Amount of disk space used by the volume (in bytes). This information + * is only available for volumes created with the `"local"` volume + * driver. For volumes created with other volume drivers, this field + * is set to `-1` ("not available") + */ + Size: v.pipe(v.number(), v.integer()), + /** + * The number of containers referencing this volume. This field + * is set to `-1` if the reference-count is not available. + */ + RefCount: v.pipe(v.number(), v.integer()), + }), + ), + ), + }), + ), + ), + /** + * Warnings that occurred when fetching the list of volumes. + */ + Warnings: v.exactOptional(v.array(v.string())), +}); +export const networkSchema = v.strictObject({ + /** + * Name of the network. + */ + Name: v.exactOptional(v.string()), + /** + * ID that uniquely identifies a network on a single machine. + */ + Id: v.exactOptional(v.string()), + /** + * Date and time at which the network was created in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + */ + Created: v.exactOptional(v.string()), + /** + * The level at which the network exists (e.g. `swarm` for cluster-wide + * or `local` for machine level) + */ + Scope: v.exactOptional(v.string()), + /** + * The name of the driver used to create the network (e.g. `bridge`, + * `overlay`). + */ + Driver: v.exactOptional(v.string()), + /** + * Whether the network was created with IPv6 enabled. + */ + EnableIPv6: v.exactOptional(v.boolean()), + IPAM: v.exactOptional( + v.strictObject({ + /** + * Name of the IPAM driver to use. + */ + Driver: v.exactOptional(v.string()), + /** + * List of IPAM configuration options, specified as a map: + * + * ``` + * {"Subnet": , "IPRange": , "Gateway": , + * "AuxAddress": } + * ``` + */ + Config: v.exactOptional( + v.array( + v.strictObject({ + Subnet: v.exactOptional(v.string()), + IPRange: v.exactOptional(v.string()), + Gateway: v.exactOptional(v.string()), + AuxiliaryAddresses: v.exactOptional( + v.record(v.string(), v.unknown()), + ), + }), + ), + ), + /** + * Driver-specific options, specified as a map. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + /** + * Whether the network is created to only allow internal networking + * connectivity. + */ + Internal: v.exactOptional(v.boolean()), + /** + * Whether a global / swarm scope network is manually attachable by regular + * containers from workers in swarm mode. + */ + Attachable: v.exactOptional(v.boolean()), + /** + * Whether the network is providing the routing-mesh for the swarm cluster. + */ + Ingress: v.exactOptional(v.boolean()), + /** + * The config-only network source to provide the configuration for + * this network. + */ + ConfigFrom: v.exactOptional( + v.strictObject({ + /** + * The name of the config-only network that provides the network's + * configuration. The specified network must be an existing config-only + * network. Only network names are allowed, not network IDs. + */ + Network: v.exactOptional(v.string()), + }), + ), + /** + * Whether the network is a config-only network. Config-only networks are + * placeholder networks for network configurations to be used by other + * networks. Config-only networks cannot be used directly to run containers + * or services. + */ + ConfigOnly: v.exactOptional(v.boolean()), + /** + * Contains endpoints attached to the network. + */ + Containers: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Network-specific options uses when creating the network. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * List of peer nodes for an overlay network. This field is only present + * for overlay networks, and omitted for other network types. + */ + Peers: v.exactOptional( + v.nullable( + v.array( + v.strictObject({ + /** + * ID of the peer-node in the Swarm cluster. + */ + Name: v.exactOptional(v.string()), + /** + * IP-address of the peer-node in the Swarm cluster. + */ + IP: v.exactOptional(v.string()), + }), + ), + ), + ), +}); +/** + * The config-only network source to provide the configuration for + * this network. + */ +export const configReferenceSchema = v.strictObject({ + /** + * The name of the config-only network that provides the network's + * configuration. The specified network must be an existing config-only + * network. Only network names are allowed, not network IDs. + */ + Network: v.exactOptional(v.string()), +}); +export const ipamSchema = v.strictObject({ + /** + * Name of the IPAM driver to use. + */ + Driver: v.exactOptional(v.string()), + /** + * List of IPAM configuration options, specified as a map: + * + * ``` + * {"Subnet": , "IPRange": , "Gateway": , + * "AuxAddress": } + * ``` + */ + Config: v.exactOptional( + v.array( + v.strictObject({ + Subnet: v.exactOptional(v.string()), + IPRange: v.exactOptional(v.string()), + Gateway: v.exactOptional(v.string()), + AuxiliaryAddresses: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + ), + /** + * Driver-specific options, specified as a map. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), +}); +export const ipamConfigSchema = v.strictObject({ + Subnet: v.exactOptional(v.string()), + IPRange: v.exactOptional(v.string()), + Gateway: v.exactOptional(v.string()), + AuxiliaryAddresses: v.exactOptional(v.record(v.string(), v.unknown())), +}); +export const networkContainerSchema = v.strictObject({ + Name: v.exactOptional(v.string()), + EndpointID: v.exactOptional(v.string()), + MacAddress: v.exactOptional(v.string()), + IPv4Address: v.exactOptional(v.string()), + IPv6Address: v.exactOptional(v.string()), +}); +/** PeerInfo represents one peer of an overlay network. */ +export const peerInfoSchema = v.strictObject({ + /** + * ID of the peer-node in the Swarm cluster. + */ + Name: v.exactOptional(v.string()), + /** + * IP-address of the peer-node in the Swarm cluster. + */ + IP: v.exactOptional(v.string()), +}); +export const buildInfoSchema = v.strictObject({ + id: v.exactOptional(v.string()), + stream: v.exactOptional(v.string()), + error: v.exactOptional(v.string()), + errorDetail: v.exactOptional( + v.strictObject({ + code: v.exactOptional(v.pipe(v.number(), v.integer())), + message: v.exactOptional(v.string()), + }), + ), + status: v.exactOptional(v.string()), + progress: v.exactOptional(v.string()), + progressDetail: v.exactOptional( + v.strictObject({ + current: v.exactOptional(v.pipe(v.number(), v.integer())), + total: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * Image ID or Digest + */ + aux: v.exactOptional( + v.strictObject({ + ID: v.exactOptional(v.string()), + }), + ), +}); +/** BuildCache contains information about a build cache record. */ +export const buildCacheSchema = v.strictObject({ + /** + * Unique ID of the build cache record. + */ + ID: v.exactOptional(v.string()), + /** + * ID of the parent build cache record. + * + * > **Deprecated**: This field is deprecated, and omitted if empty. + */ + Parent: v.exactOptional(v.nullable(v.string())), + /** + * List of parent build cache record IDs. + */ + Parents: v.exactOptional(v.nullable(v.array(v.string()))), + /** + * Cache record type. + */ + Type: v.exactOptional( + v.picklist([ + "internal", + "frontend", + "source.local", + "source.git.checkout", + "exec.cachemount", + "regular", + ]), + ), + /** + * Description of the build-step that produced the build cache. + */ + Description: v.exactOptional(v.string()), + /** + * Indicates if the build cache is in use. + */ + InUse: v.exactOptional(v.boolean()), + /** + * Indicates if the build cache is shared. + */ + Shared: v.exactOptional(v.boolean()), + /** + * Amount of disk space used by the build cache (in bytes). + */ + Size: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Date and time at which the build cache was created in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + */ + CreatedAt: v.exactOptional(v.string()), + /** + * Date and time at which the build cache was last used in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + */ + LastUsedAt: v.exactOptional(v.nullable(v.string())), + UsageCount: v.exactOptional(v.pipe(v.number(), v.integer())), +}); +/** + * Image ID or Digest + * @example { + * "ID": "sha256:85f05633ddc1c50679be2b16a0479ab6f7637f8884e0cfe0f4d20e1ebb3d6e7c" + * } + */ +export const imageIdSchema = v.strictObject({ + ID: v.exactOptional(v.string()), +}); +export const createImageInfoSchema = v.strictObject({ + id: v.exactOptional(v.string()), + error: v.exactOptional(v.string()), + errorDetail: v.exactOptional( + v.strictObject({ + code: v.exactOptional(v.pipe(v.number(), v.integer())), + message: v.exactOptional(v.string()), + }), + ), + status: v.exactOptional(v.string()), + progress: v.exactOptional(v.string()), + progressDetail: v.exactOptional( + v.strictObject({ + current: v.exactOptional(v.pipe(v.number(), v.integer())), + total: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), +}); +export const pushImageInfoSchema = v.strictObject({ + error: v.exactOptional(v.string()), + status: v.exactOptional(v.string()), + progress: v.exactOptional(v.string()), + progressDetail: v.exactOptional( + v.strictObject({ + current: v.exactOptional(v.pipe(v.number(), v.integer())), + total: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), +}); +export const errorDetailSchema = v.strictObject({ + code: v.exactOptional(v.pipe(v.number(), v.integer())), + message: v.exactOptional(v.string()), +}); +export const progressDetailSchema = v.strictObject({ + current: v.exactOptional(v.pipe(v.number(), v.integer())), + total: v.exactOptional(v.pipe(v.number(), v.integer())), +}); +/** + * Represents an error. + * @example { + * "message": "Something went wrong." + * } + */ +export const errorResponseSchema = v.strictObject({ + /** + * The error message. + */ + message: v.string(), +}); +/** Response to an API call that returns just an Id */ +export const idResponseSchema = v.strictObject({ + /** + * The id of the newly created object. + */ + Id: v.string(), +}); +/** Configuration for a network endpoint. */ +export const endpointSettingsSchema = v.strictObject({ + /** + * EndpointIPAMConfig represents an endpoint's IPAM configuration. + */ + IPAMConfig: v.exactOptional( + v.nullable( + v.strictObject({ + IPv4Address: v.exactOptional(v.string()), + IPv6Address: v.exactOptional(v.string()), + LinkLocalIPs: v.exactOptional(v.array(v.string())), + }), + ), + ), + Links: v.exactOptional(v.array(v.string())), + Aliases: v.exactOptional(v.array(v.string())), + /** + * Unique ID of the network. + */ + NetworkID: v.exactOptional(v.string()), + /** + * Unique ID for the service endpoint in a Sandbox. + */ + EndpointID: v.exactOptional(v.string()), + /** + * Gateway address for this network. + */ + Gateway: v.exactOptional(v.string()), + /** + * IPv4 address. + */ + IPAddress: v.exactOptional(v.string()), + /** + * Mask length of the IPv4 address. + */ + IPPrefixLen: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * IPv6 gateway address. + */ + IPv6Gateway: v.exactOptional(v.string()), + /** + * Global IPv6 address. + */ + GlobalIPv6Address: v.exactOptional(v.string()), + /** + * Mask length of the global IPv6 address. + */ + GlobalIPv6PrefixLen: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * MAC address for the endpoint on this network. + */ + MacAddress: v.exactOptional(v.string()), + /** + * DriverOpts is a mapping of driver options and values. These options + * are passed directly to the driver and are driver specific. + */ + DriverOpts: v.exactOptional(v.nullable(v.record(v.string(), v.unknown()))), +}); +/** EndpointIPAMConfig represents an endpoint's IPAM configuration. */ +export const endpointIpamConfigSchema = v.nullable( + v.strictObject({ + IPv4Address: v.exactOptional(v.string()), + IPv6Address: v.exactOptional(v.string()), + LinkLocalIPs: v.exactOptional(v.array(v.string())), + }), +); +export const pluginMountSchema = v.strictObject({ + Name: v.string(), + Description: v.string(), + Settable: v.array(v.string()), + Source: v.string(), + Destination: v.string(), + Type: v.string(), + Options: v.array(v.string()), +}); +export const pluginDeviceSchema = v.strictObject({ + Name: v.string(), + Description: v.string(), + Settable: v.array(v.string()), + Path: v.string(), +}); +export const pluginEnvSchema = v.strictObject({ + Name: v.string(), + Description: v.string(), + Settable: v.array(v.string()), + Value: v.string(), +}); +export const pluginInterfaceTypeSchema = v.strictObject({ + Prefix: v.string(), + Capability: v.string(), + Version: v.string(), +}); +/** + * Describes a permission the user has to accept upon installing + * the plugin. + */ +export const pluginPrivilegeSchema = v.strictObject({ + Name: v.exactOptional(v.string()), + Description: v.exactOptional(v.string()), + Value: v.exactOptional(v.array(v.string())), +}); +/** A plugin for the Engine API */ +export const pluginSchema = v.strictObject({ + Id: v.exactOptional(v.string()), + Name: v.string(), + /** + * True if the plugin is running. False if the plugin is not running, only + * installed. + */ + Enabled: v.boolean(), + /** + * Settings that can be modified by users. + */ + Settings: v.strictObject({ + Mounts: v.array( + v.strictObject({ + Name: v.string(), + Description: v.string(), + Settable: v.array(v.string()), + Source: v.string(), + Destination: v.string(), + Type: v.string(), + Options: v.array(v.string()), + }), + ), + Env: v.array(v.string()), + Args: v.array(v.string()), + Devices: v.array( + v.strictObject({ + Name: v.string(), + Description: v.string(), + Settable: v.array(v.string()), + Path: v.string(), + }), + ), + }), + /** + * plugin remote reference used to push/pull the plugin + */ + PluginReference: v.exactOptional(v.string()), + /** + * The config of a plugin. + */ + Config: v.strictObject({ + /** + * Docker Version used to create the plugin + */ + DockerVersion: v.exactOptional(v.string()), + Description: v.string(), + Documentation: v.string(), + /** + * The interface between Docker and the plugin + */ + Interface: v.strictObject({ + Types: v.array( + v.strictObject({ + Prefix: v.string(), + Capability: v.string(), + Version: v.string(), + }), + ), + Socket: v.string(), + /** + * Protocol to use for clients connecting to the plugin. + */ + ProtocolScheme: v.exactOptional(v.picklist(["", "moby.plugins.http/v1"])), + }), + Entrypoint: v.array(v.string()), + WorkDir: v.string(), + User: v.exactOptional( + v.strictObject({ + UID: v.exactOptional(v.pipe(v.number(), v.integer())), + GID: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + Network: v.strictObject({ + Type: v.string(), + }), + Linux: v.strictObject({ + Capabilities: v.array(v.string()), + AllowAllDevices: v.boolean(), + Devices: v.array( + v.strictObject({ + Name: v.string(), + Description: v.string(), + Settable: v.array(v.string()), + Path: v.string(), + }), + ), + }), + PropagatedMount: v.string(), + IpcHost: v.boolean(), + PidHost: v.boolean(), + Mounts: v.array( + v.strictObject({ + Name: v.string(), + Description: v.string(), + Settable: v.array(v.string()), + Source: v.string(), + Destination: v.string(), + Type: v.string(), + Options: v.array(v.string()), + }), + ), + Env: v.array( + v.strictObject({ + Name: v.string(), + Description: v.string(), + Settable: v.array(v.string()), + Value: v.string(), + }), + ), + Args: v.strictObject({ + Name: v.string(), + Description: v.string(), + Settable: v.array(v.string()), + Value: v.array(v.string()), + }), + rootfs: v.exactOptional( + v.strictObject({ + type: v.exactOptional(v.string()), + diff_ids: v.exactOptional(v.array(v.string())), + }), + ), + }), +}); +/** + * The version number of the object such as node, service, etc. This is needed + * to avoid conflicting writes. The client must send the version number along + * with the modified specification when updating these objects. + * + * This approach ensures safe concurrency and determinism in that the change + * on the object may not be applied if the version number has changed from the + * last read. In other words, if two update requests specify the same base + * version, only one of the requests can succeed. As a result, two separate + * update requests that happen at the same time will not unintentionally + * overwrite each other. + */ +export const objectVersionSchema = v.strictObject({ + Index: v.exactOptional(v.pipe(v.number(), v.integer())), +}); +export const nodeSpecSchema = v.strictObject({ + /** + * Name for the node. + */ + Name: v.exactOptional(v.string()), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Role of the node. + */ + Role: v.exactOptional(v.picklist(["worker", "manager"])), + /** + * Availability of the node. + */ + Availability: v.exactOptional(v.picklist(["active", "pause", "drain"])), +}); +export const nodeSchema = v.strictObject({ + ID: v.exactOptional(v.string()), + /** + * The version number of the object such as node, service, etc. This is needed + * to avoid conflicting writes. The client must send the version number along + * with the modified specification when updating these objects. + * + * This approach ensures safe concurrency and determinism in that the change + * on the object may not be applied if the version number has changed from the + * last read. In other words, if two update requests specify the same base + * version, only one of the requests can succeed. As a result, two separate + * update requests that happen at the same time will not unintentionally + * overwrite each other. + */ + Version: v.exactOptional( + v.strictObject({ + Index: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * Date and time at which the node was added to the swarm in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + */ + CreatedAt: v.exactOptional(v.string()), + /** + * Date and time at which the node was last updated in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + */ + UpdatedAt: v.exactOptional(v.string()), + Spec: v.exactOptional( + v.strictObject({ + /** + * Name for the node. + */ + Name: v.exactOptional(v.string()), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Role of the node. + */ + Role: v.exactOptional(v.picklist(["worker", "manager"])), + /** + * Availability of the node. + */ + Availability: v.exactOptional(v.picklist(["active", "pause", "drain"])), + }), + ), + /** + * NodeDescription encapsulates the properties of the Node as reported by the + * agent. + */ + Description: v.exactOptional( + v.strictObject({ + Hostname: v.exactOptional(v.string()), + /** + * Platform represents the platform (Arch/OS). + */ + Platform: v.exactOptional( + v.strictObject({ + /** + * Architecture represents the hardware architecture (for example, + * `x86_64`). + */ + Architecture: v.exactOptional(v.string()), + /** + * OS represents the Operating System (for example, `linux` or `windows`). + */ + OS: v.exactOptional(v.string()), + }), + ), + /** + * An object describing the resources which can be advertised by a node and + * requested by a task. + */ + Resources: v.exactOptional( + v.strictObject({ + NanoCPUs: v.exactOptional(v.pipe(v.number(), v.integer())), + MemoryBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * User-defined resources can be either Integer resources (e.g, `SSD=3`) or + * String resources (e.g, `GPU=UUID1`). + */ + GenericResources: v.exactOptional( + v.array( + v.strictObject({ + NamedResourceSpec: v.exactOptional( + v.strictObject({ + Kind: v.exactOptional(v.string()), + Value: v.exactOptional(v.string()), + }), + ), + DiscreteResourceSpec: v.exactOptional( + v.strictObject({ + Kind: v.exactOptional(v.string()), + Value: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + }), + ), + ), + }), + ), + /** + * EngineDescription provides information about an engine. + */ + Engine: v.exactOptional( + v.strictObject({ + EngineVersion: v.exactOptional(v.string()), + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + Plugins: v.exactOptional( + v.array( + v.strictObject({ + Type: v.exactOptional(v.string()), + Name: v.exactOptional(v.string()), + }), + ), + ), + }), + ), + /** + * Information about the issuer of leaf TLS certificates and the trusted root + * CA certificate. + */ + TLSInfo: v.exactOptional( + v.strictObject({ + /** + * The root CA certificate(s) that are used to validate leaf TLS + * certificates. + */ + TrustRoot: v.exactOptional(v.string()), + /** + * The base64-url-safe-encoded raw subject bytes of the issuer. + */ + CertIssuerSubject: v.exactOptional(v.string()), + /** + * The base64-url-safe-encoded raw public key bytes of the issuer. + */ + CertIssuerPublicKey: v.exactOptional(v.string()), + }), + ), + }), + ), + /** + * NodeStatus represents the status of a node. + * + * It provides the current status of the node, as seen by the manager. + */ + Status: v.exactOptional( + v.strictObject({ + /** + * NodeState represents the state of a node. + */ + State: v.exactOptional( + v.picklist(["unknown", "down", "ready", "disconnected"]), + ), + Message: v.exactOptional(v.string()), + /** + * IP address of the node. + */ + Addr: v.exactOptional(v.string()), + }), + ), + /** + * ManagerStatus represents the status of a manager. + * + * It provides the current status of a node's manager component, if the node + * is a manager. + */ + ManagerStatus: v.exactOptional( + v.nullable( + v.strictObject({ + Leader: v.exactOptional(v.boolean()), + /** + * Reachability represents the reachability of a node. + */ + Reachability: v.exactOptional( + v.picklist(["unknown", "unreachable", "reachable"]), + ), + /** + * The IP address and port at which the manager is reachable. + */ + Addr: v.exactOptional(v.string()), + }), + ), + ), +}); +/** + * NodeDescription encapsulates the properties of the Node as reported by the + * agent. + */ +export const nodeDescriptionSchema = v.strictObject({ + Hostname: v.exactOptional(v.string()), + /** + * Platform represents the platform (Arch/OS). + */ + Platform: v.exactOptional( + v.strictObject({ + /** + * Architecture represents the hardware architecture (for example, + * `x86_64`). + */ + Architecture: v.exactOptional(v.string()), + /** + * OS represents the Operating System (for example, `linux` or `windows`). + */ + OS: v.exactOptional(v.string()), + }), + ), + /** + * An object describing the resources which can be advertised by a node and + * requested by a task. + */ + Resources: v.exactOptional( + v.strictObject({ + NanoCPUs: v.exactOptional(v.pipe(v.number(), v.integer())), + MemoryBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * User-defined resources can be either Integer resources (e.g, `SSD=3`) or + * String resources (e.g, `GPU=UUID1`). + */ + GenericResources: v.exactOptional( + v.array( + v.strictObject({ + NamedResourceSpec: v.exactOptional( + v.strictObject({ + Kind: v.exactOptional(v.string()), + Value: v.exactOptional(v.string()), + }), + ), + DiscreteResourceSpec: v.exactOptional( + v.strictObject({ + Kind: v.exactOptional(v.string()), + Value: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + }), + ), + ), + }), + ), + /** + * EngineDescription provides information about an engine. + */ + Engine: v.exactOptional( + v.strictObject({ + EngineVersion: v.exactOptional(v.string()), + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + Plugins: v.exactOptional( + v.array( + v.strictObject({ + Type: v.exactOptional(v.string()), + Name: v.exactOptional(v.string()), + }), + ), + ), + }), + ), + /** + * Information about the issuer of leaf TLS certificates and the trusted root + * CA certificate. + */ + TLSInfo: v.exactOptional( + v.strictObject({ + /** + * The root CA certificate(s) that are used to validate leaf TLS + * certificates. + */ + TrustRoot: v.exactOptional(v.string()), + /** + * The base64-url-safe-encoded raw subject bytes of the issuer. + */ + CertIssuerSubject: v.exactOptional(v.string()), + /** + * The base64-url-safe-encoded raw public key bytes of the issuer. + */ + CertIssuerPublicKey: v.exactOptional(v.string()), + }), + ), +}); +/** Platform represents the platform (Arch/OS). */ +export const platformSchema = v.strictObject({ + /** + * Architecture represents the hardware architecture (for example, + * `x86_64`). + */ + Architecture: v.exactOptional(v.string()), + /** + * OS represents the Operating System (for example, `linux` or `windows`). + */ + OS: v.exactOptional(v.string()), +}); +/** EngineDescription provides information about an engine. */ +export const engineDescriptionSchema = v.strictObject({ + EngineVersion: v.exactOptional(v.string()), + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + Plugins: v.exactOptional( + v.array( + v.strictObject({ + Type: v.exactOptional(v.string()), + Name: v.exactOptional(v.string()), + }), + ), + ), +}); +/** + * Information about the issuer of leaf TLS certificates and the trusted root + * CA certificate. + * @example { + * "TrustRoot": "-----BEGIN CERTIFICATE-----\nMIIBajCCARCgAwIBAgIUbYqrLSOSQHoxD8CwG6Bi2PJi9c8wCgYIKoZIzj0EAwIw\nEzERMA8GA1UEAxMIc3dhcm0tY2EwHhcNMTcwNDI0MjE0MzAwWhcNMzcwNDE5MjE0\nMzAwWjATMREwDwYDVQQDEwhzd2FybS1jYTBZMBMGByqGSM49AgEGCCqGSM49AwEH\nA0IABJk/VyMPYdaqDXJb/VXh5n/1Yuv7iNrxV3Qb3l06XD46seovcDWs3IZNV1lf\n3Skyr0ofcchipoiHkXBODojJydSjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMB\nAf8EBTADAQH/MB0GA1UdDgQWBBRUXxuRcnFjDfR/RIAUQab8ZV/n4jAKBggqhkjO\nPQQDAgNIADBFAiAy+JTe6Uc3KyLCMiqGl2GyWGQqQDEcO3/YG36x7om65AIhAJvz\npxv6zFeVEkAEEkqIYi0omA9+CjanB/6Bz4n1uw8H\n-----END CERTIFICATE-----\n", + * "CertIssuerSubject": "MBMxETAPBgNVBAMTCHN3YXJtLWNh", + * "CertIssuerPublicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEmT9XIw9h1qoNclv9VeHmf/Vi6/uI2vFXdBveXTpcPjqx6i9wNazchk1XWV/dKTKvSh9xyGKmiIeRcE4OiMnJ1A==" + * } + */ +export const tlsInfoSchema = v.strictObject({ + /** + * The root CA certificate(s) that are used to validate leaf TLS + * certificates. + */ + TrustRoot: v.exactOptional(v.string()), + /** + * The base64-url-safe-encoded raw subject bytes of the issuer. + */ + CertIssuerSubject: v.exactOptional(v.string()), + /** + * The base64-url-safe-encoded raw public key bytes of the issuer. + */ + CertIssuerPublicKey: v.exactOptional(v.string()), +}); +/** + * NodeStatus represents the status of a node. + * + * It provides the current status of the node, as seen by the manager. + */ +export const nodeStatusSchema = v.strictObject({ + /** + * NodeState represents the state of a node. + */ + State: v.exactOptional( + v.picklist(["unknown", "down", "ready", "disconnected"]), + ), + Message: v.exactOptional(v.string()), + /** + * IP address of the node. + */ + Addr: v.exactOptional(v.string()), +}); +/** + * NodeState represents the state of a node. + * @example "ready" + */ +export const nodeStateSchema = v.picklist([ + "unknown", + "down", + "ready", + "disconnected", +]); +/** + * ManagerStatus represents the status of a manager. + * + * It provides the current status of a node's manager component, if the node + * is a manager. + */ +export const managerStatusSchema = v.nullable( + v.strictObject({ + Leader: v.exactOptional(v.boolean()), + /** + * Reachability represents the reachability of a node. + */ + Reachability: v.exactOptional( + v.picklist(["unknown", "unreachable", "reachable"]), + ), + /** + * The IP address and port at which the manager is reachable. + */ + Addr: v.exactOptional(v.string()), + }), +); +/** + * Reachability represents the reachability of a node. + * @example "reachable" + */ +export const reachabilitySchema = v.picklist([ + "unknown", + "unreachable", + "reachable", +]); +/** User modifiable swarm configuration. */ +export const swarmSpecSchema = v.strictObject({ + /** + * Name of the swarm. + */ + Name: v.exactOptional(v.string()), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Orchestration configuration. + */ + Orchestration: v.exactOptional( + v.nullable( + v.strictObject({ + /** + * The number of historic tasks to keep per instance or node. If + * negative, never remove completed or failed tasks. + */ + TaskHistoryRetentionLimit: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + }), + ), + ), + /** + * Raft configuration. + */ + Raft: v.exactOptional( + v.strictObject({ + /** + * The number of log entries between snapshots. + */ + SnapshotInterval: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The number of snapshots to keep beyond the current snapshot. + */ + KeepOldSnapshots: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The number of log entries to keep around to sync up slow followers + * after a snapshot is created. + */ + LogEntriesForSlowFollowers: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + /** + * The number of ticks that a follower will wait for a message from + * the leader before becoming a candidate and starting an election. + * `ElectionTick` must be greater than `HeartbeatTick`. + * + * A tick currently defaults to one second, so these translate + * directly to seconds currently, but this is NOT guaranteed. + */ + ElectionTick: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The number of ticks between heartbeats. Every HeartbeatTick ticks, + * the leader will send a heartbeat to the followers. + * + * A tick currently defaults to one second, so these translate + * directly to seconds currently, but this is NOT guaranteed. + */ + HeartbeatTick: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * Dispatcher configuration. + */ + Dispatcher: v.exactOptional( + v.nullable( + v.strictObject({ + /** + * The delay for an agent to send a heartbeat to the dispatcher. + */ + HeartbeatPeriod: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + ), + /** + * CA configuration. + */ + CAConfig: v.exactOptional( + v.nullable( + v.strictObject({ + /** + * The duration node certificates are issued for. + */ + NodeCertExpiry: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Configuration for forwarding signing requests to an external + * certificate authority. + */ + ExternalCAs: v.exactOptional( + v.array( + v.strictObject({ + /** + * Protocol for communication with the external CA (currently + * only `cfssl` is supported). + */ + Protocol: v.exactOptional(v.picklist(["cfssl"])), + /** + * URL where certificate signing requests should be sent. + */ + URL: v.exactOptional(v.string()), + /** + * An object with key/value pairs that are interpreted as + * protocol-specific options for the external CA driver. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * The root CA certificate (in PEM format) this external CA uses + * to issue TLS certificates (assumed to be to the current swarm + * root CA certificate if not provided). + */ + CACert: v.exactOptional(v.string()), + }), + ), + ), + /** + * The desired signing CA certificate for all swarm node TLS leaf + * certificates, in PEM format. + */ + SigningCACert: v.exactOptional(v.string()), + /** + * The desired signing CA key for all swarm node TLS leaf certificates, + * in PEM format. + */ + SigningCAKey: v.exactOptional(v.string()), + /** + * An integer whose purpose is to force swarm to generate a new + * signing CA certificate and key, if none have been specified in + * `SigningCACert` and `SigningCAKey` + */ + ForceRotate: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + ), + /** + * Parameters related to encryption-at-rest. + */ + EncryptionConfig: v.exactOptional( + v.strictObject({ + /** + * If set, generate a key and use it to lock data stored on the + * managers. + */ + AutoLockManagers: v.exactOptional(v.boolean()), + }), + ), + /** + * Defaults for creating tasks in this cluster. + */ + TaskDefaults: v.exactOptional( + v.strictObject({ + /** + * The log driver to use for tasks created in the orchestrator if + * unspecified by a service. + * + * Updating this value only affects new tasks. Existing tasks continue + * to use their previously configured log driver until recreated. + */ + LogDriver: v.exactOptional( + v.strictObject({ + /** + * The log driver to use as a default for new tasks. + */ + Name: v.exactOptional(v.string()), + /** + * Driver-specific options for the selected log driver, specified + * as key/value pairs. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + }), + ), +}); +/** + * ClusterInfo represents information about the swarm as is returned by the + * "/info" endpoint. Join-tokens are not included. + */ +export const clusterInfoSchema = v.nullable( + v.strictObject({ + /** + * The ID of the swarm. + */ + ID: v.exactOptional(v.string()), + /** + * The version number of the object such as node, service, etc. This is needed + * to avoid conflicting writes. The client must send the version number along + * with the modified specification when updating these objects. + * + * This approach ensures safe concurrency and determinism in that the change + * on the object may not be applied if the version number has changed from the + * last read. In other words, if two update requests specify the same base + * version, only one of the requests can succeed. As a result, two separate + * update requests that happen at the same time will not unintentionally + * overwrite each other. + */ + Version: v.exactOptional( + v.strictObject({ + Index: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * Date and time at which the swarm was initialised in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + */ + CreatedAt: v.exactOptional(v.string()), + /** + * Date and time at which the swarm was last updated in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + */ + UpdatedAt: v.exactOptional(v.string()), + /** + * User modifiable swarm configuration. + */ + Spec: v.exactOptional( + v.strictObject({ + /** + * Name of the swarm. + */ + Name: v.exactOptional(v.string()), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Orchestration configuration. + */ + Orchestration: v.exactOptional( + v.nullable( + v.strictObject({ + /** + * The number of historic tasks to keep per instance or node. If + * negative, never remove completed or failed tasks. + */ + TaskHistoryRetentionLimit: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + }), + ), + ), + /** + * Raft configuration. + */ + Raft: v.exactOptional( + v.strictObject({ + /** + * The number of log entries between snapshots. + */ + SnapshotInterval: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The number of snapshots to keep beyond the current snapshot. + */ + KeepOldSnapshots: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The number of log entries to keep around to sync up slow followers + * after a snapshot is created. + */ + LogEntriesForSlowFollowers: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + /** + * The number of ticks that a follower will wait for a message from + * the leader before becoming a candidate and starting an election. + * `ElectionTick` must be greater than `HeartbeatTick`. + * + * A tick currently defaults to one second, so these translate + * directly to seconds currently, but this is NOT guaranteed. + */ + ElectionTick: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The number of ticks between heartbeats. Every HeartbeatTick ticks, + * the leader will send a heartbeat to the followers. + * + * A tick currently defaults to one second, so these translate + * directly to seconds currently, but this is NOT guaranteed. + */ + HeartbeatTick: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * Dispatcher configuration. + */ + Dispatcher: v.exactOptional( + v.nullable( + v.strictObject({ + /** + * The delay for an agent to send a heartbeat to the dispatcher. + */ + HeartbeatPeriod: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + ), + /** + * CA configuration. + */ + CAConfig: v.exactOptional( + v.nullable( + v.strictObject({ + /** + * The duration node certificates are issued for. + */ + NodeCertExpiry: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Configuration for forwarding signing requests to an external + * certificate authority. + */ + ExternalCAs: v.exactOptional( + v.array( + v.strictObject({ + /** + * Protocol for communication with the external CA (currently + * only `cfssl` is supported). + */ + Protocol: v.exactOptional(v.picklist(["cfssl"])), + /** + * URL where certificate signing requests should be sent. + */ + URL: v.exactOptional(v.string()), + /** + * An object with key/value pairs that are interpreted as + * protocol-specific options for the external CA driver. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * The root CA certificate (in PEM format) this external CA uses + * to issue TLS certificates (assumed to be to the current swarm + * root CA certificate if not provided). + */ + CACert: v.exactOptional(v.string()), + }), + ), + ), + /** + * The desired signing CA certificate for all swarm node TLS leaf + * certificates, in PEM format. + */ + SigningCACert: v.exactOptional(v.string()), + /** + * The desired signing CA key for all swarm node TLS leaf certificates, + * in PEM format. + */ + SigningCAKey: v.exactOptional(v.string()), + /** + * An integer whose purpose is to force swarm to generate a new + * signing CA certificate and key, if none have been specified in + * `SigningCACert` and `SigningCAKey` + */ + ForceRotate: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + ), + /** + * Parameters related to encryption-at-rest. + */ + EncryptionConfig: v.exactOptional( + v.strictObject({ + /** + * If set, generate a key and use it to lock data stored on the + * managers. + */ + AutoLockManagers: v.exactOptional(v.boolean()), + }), + ), + /** + * Defaults for creating tasks in this cluster. + */ + TaskDefaults: v.exactOptional( + v.strictObject({ + /** + * The log driver to use for tasks created in the orchestrator if + * unspecified by a service. + * + * Updating this value only affects new tasks. Existing tasks continue + * to use their previously configured log driver until recreated. + */ + LogDriver: v.exactOptional( + v.strictObject({ + /** + * The log driver to use as a default for new tasks. + */ + Name: v.exactOptional(v.string()), + /** + * Driver-specific options for the selected log driver, specified + * as key/value pairs. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + }), + ), + }), + ), + /** + * Information about the issuer of leaf TLS certificates and the trusted root + * CA certificate. + */ + TLSInfo: v.exactOptional( + v.strictObject({ + /** + * The root CA certificate(s) that are used to validate leaf TLS + * certificates. + */ + TrustRoot: v.exactOptional(v.string()), + /** + * The base64-url-safe-encoded raw subject bytes of the issuer. + */ + CertIssuerSubject: v.exactOptional(v.string()), + /** + * The base64-url-safe-encoded raw public key bytes of the issuer. + */ + CertIssuerPublicKey: v.exactOptional(v.string()), + }), + ), + /** + * Whether there is currently a root CA rotation in progress for the swarm + */ + RootRotationInProgress: v.exactOptional(v.boolean()), + /** + * DataPathPort specifies the data path port number for data traffic. + * Acceptable port range is 1024 to 49151. + * If no port is set or is set to 0, the default port (4789) is used. + */ + DataPathPort: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Default Address Pool specifies default subnet pools for global scope + * networks. + */ + DefaultAddrPool: v.exactOptional(v.array(v.string())), + /** + * SubnetSize specifies the subnet size of the networks created from the + * default subnet pool. + */ + SubnetSize: v.exactOptional( + v.pipe(v.number(), v.integer(), v.maxValue(29)), + ), + }), +); +/** JoinTokens contains the tokens workers and managers need to join the swarm. */ +export const joinTokensSchema = v.strictObject({ + /** + * The token workers can use to join the swarm. + */ + Worker: v.exactOptional(v.string()), + /** + * The token managers can use to join the swarm. + */ + Manager: v.exactOptional(v.string()), +}); +export const swarmSchema = v.intersect([ + v.nullable( + v.strictObject({ + /** + * The ID of the swarm. + */ + ID: v.exactOptional(v.string()), + /** + * The version number of the object such as node, service, etc. This is needed + * to avoid conflicting writes. The client must send the version number along + * with the modified specification when updating these objects. + * + * This approach ensures safe concurrency and determinism in that the change + * on the object may not be applied if the version number has changed from the + * last read. In other words, if two update requests specify the same base + * version, only one of the requests can succeed. As a result, two separate + * update requests that happen at the same time will not unintentionally + * overwrite each other. + */ + Version: v.exactOptional( + v.strictObject({ + Index: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * Date and time at which the swarm was initialised in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + */ + CreatedAt: v.exactOptional(v.string()), + /** + * Date and time at which the swarm was last updated in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + */ + UpdatedAt: v.exactOptional(v.string()), + /** + * User modifiable swarm configuration. + */ + Spec: v.exactOptional( + v.strictObject({ + /** + * Name of the swarm. + */ + Name: v.exactOptional(v.string()), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Orchestration configuration. + */ + Orchestration: v.exactOptional( + v.nullable( + v.strictObject({ + /** + * The number of historic tasks to keep per instance or node. If + * negative, never remove completed or failed tasks. + */ + TaskHistoryRetentionLimit: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + }), + ), + ), + /** + * Raft configuration. + */ + Raft: v.exactOptional( + v.strictObject({ + /** + * The number of log entries between snapshots. + */ + SnapshotInterval: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + /** + * The number of snapshots to keep beyond the current snapshot. + */ + KeepOldSnapshots: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + /** + * The number of log entries to keep around to sync up slow followers + * after a snapshot is created. + */ + LogEntriesForSlowFollowers: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + /** + * The number of ticks that a follower will wait for a message from + * the leader before becoming a candidate and starting an election. + * `ElectionTick` must be greater than `HeartbeatTick`. + * + * A tick currently defaults to one second, so these translate + * directly to seconds currently, but this is NOT guaranteed. + */ + ElectionTick: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The number of ticks between heartbeats. Every HeartbeatTick ticks, + * the leader will send a heartbeat to the followers. + * + * A tick currently defaults to one second, so these translate + * directly to seconds currently, but this is NOT guaranteed. + */ + HeartbeatTick: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * Dispatcher configuration. + */ + Dispatcher: v.exactOptional( + v.nullable( + v.strictObject({ + /** + * The delay for an agent to send a heartbeat to the dispatcher. + */ + HeartbeatPeriod: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + }), + ), + ), + /** + * CA configuration. + */ + CAConfig: v.exactOptional( + v.nullable( + v.strictObject({ + /** + * The duration node certificates are issued for. + */ + NodeCertExpiry: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + /** + * Configuration for forwarding signing requests to an external + * certificate authority. + */ + ExternalCAs: v.exactOptional( + v.array( + v.strictObject({ + /** + * Protocol for communication with the external CA (currently + * only `cfssl` is supported). + */ + Protocol: v.exactOptional(v.picklist(["cfssl"])), + /** + * URL where certificate signing requests should be sent. + */ + URL: v.exactOptional(v.string()), + /** + * An object with key/value pairs that are interpreted as + * protocol-specific options for the external CA driver. + */ + Options: v.exactOptional( + v.record(v.string(), v.unknown()), + ), + /** + * The root CA certificate (in PEM format) this external CA uses + * to issue TLS certificates (assumed to be to the current swarm + * root CA certificate if not provided). + */ + CACert: v.exactOptional(v.string()), + }), + ), + ), + /** + * The desired signing CA certificate for all swarm node TLS leaf + * certificates, in PEM format. + */ + SigningCACert: v.exactOptional(v.string()), + /** + * The desired signing CA key for all swarm node TLS leaf certificates, + * in PEM format. + */ + SigningCAKey: v.exactOptional(v.string()), + /** + * An integer whose purpose is to force swarm to generate a new + * signing CA certificate and key, if none have been specified in + * `SigningCACert` and `SigningCAKey` + */ + ForceRotate: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + ), + /** + * Parameters related to encryption-at-rest. + */ + EncryptionConfig: v.exactOptional( + v.strictObject({ + /** + * If set, generate a key and use it to lock data stored on the + * managers. + */ + AutoLockManagers: v.exactOptional(v.boolean()), + }), + ), + /** + * Defaults for creating tasks in this cluster. + */ + TaskDefaults: v.exactOptional( + v.strictObject({ + /** + * The log driver to use for tasks created in the orchestrator if + * unspecified by a service. + * + * Updating this value only affects new tasks. Existing tasks continue + * to use their previously configured log driver until recreated. + */ + LogDriver: v.exactOptional( + v.strictObject({ + /** + * The log driver to use as a default for new tasks. + */ + Name: v.exactOptional(v.string()), + /** + * Driver-specific options for the selected log driver, specified + * as key/value pairs. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + }), + ), + }), + ), + /** + * Information about the issuer of leaf TLS certificates and the trusted root + * CA certificate. + */ + TLSInfo: v.exactOptional( + v.strictObject({ + /** + * The root CA certificate(s) that are used to validate leaf TLS + * certificates. + */ + TrustRoot: v.exactOptional(v.string()), + /** + * The base64-url-safe-encoded raw subject bytes of the issuer. + */ + CertIssuerSubject: v.exactOptional(v.string()), + /** + * The base64-url-safe-encoded raw public key bytes of the issuer. + */ + CertIssuerPublicKey: v.exactOptional(v.string()), + }), + ), + /** + * Whether there is currently a root CA rotation in progress for the swarm + */ + RootRotationInProgress: v.exactOptional(v.boolean()), + /** + * DataPathPort specifies the data path port number for data traffic. + * Acceptable port range is 1024 to 49151. + * If no port is set or is set to 0, the default port (4789) is used. + */ + DataPathPort: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Default Address Pool specifies default subnet pools for global scope + * networks. + */ + DefaultAddrPool: v.exactOptional(v.array(v.string())), + /** + * SubnetSize specifies the subnet size of the networks created from the + * default subnet pool. + */ + SubnetSize: v.exactOptional( + v.pipe(v.number(), v.integer(), v.maxValue(29)), + ), + }), + ), + v.strictObject({ + /** + * JoinTokens contains the tokens workers and managers need to join the swarm. + */ + JoinTokens: v.exactOptional( + v.strictObject({ + /** + * The token workers can use to join the swarm. + */ + Worker: v.exactOptional(v.string()), + /** + * The token managers can use to join the swarm. + */ + Manager: v.exactOptional(v.string()), + }), + ), + }), +]); +/** User modifiable task configuration. */ +export const taskSpecSchema = v.strictObject({ + /** + * Plugin spec for the service. *(Experimental release only.)* + * + *


+ * + * > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are + * > mutually exclusive. PluginSpec is only used when the Runtime field + * > is set to `plugin`. NetworkAttachmentSpec is used when the Runtime + * > field is set to `attachment`. + */ + PluginSpec: v.exactOptional( + v.strictObject({ + /** + * The name or 'alias' to use for the plugin. + */ + Name: v.exactOptional(v.string()), + /** + * The plugin image reference to use. + */ + Remote: v.exactOptional(v.string()), + /** + * Disable the plugin once scheduled. + */ + Disabled: v.exactOptional(v.boolean()), + PluginPrivilege: v.exactOptional( + v.array( + v.strictObject({ + Name: v.exactOptional(v.string()), + Description: v.exactOptional(v.string()), + Value: v.exactOptional(v.array(v.string())), + }), + ), + ), + }), + ), + /** + * Container spec for the service. + * + *


+ * + * > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are + * > mutually exclusive. PluginSpec is only used when the Runtime field + * > is set to `plugin`. NetworkAttachmentSpec is used when the Runtime + * > field is set to `attachment`. + */ + ContainerSpec: v.exactOptional( + v.strictObject({ + /** + * The image name to use for the container + */ + Image: v.exactOptional(v.string()), + /** + * User-defined key/value data. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * The command to be run in the image. + */ + Command: v.exactOptional(v.array(v.string())), + /** + * Arguments to the command. + */ + Args: v.exactOptional(v.array(v.string())), + /** + * The hostname to use for the container, as a valid + * [RFC 1123](https://tools.ietf.org/html/rfc1123) hostname. + */ + Hostname: v.exactOptional(v.string()), + /** + * A list of environment variables in the form `VAR=value`. + */ + Env: v.exactOptional(v.array(v.string())), + /** + * The working directory for commands to run in. + */ + Dir: v.exactOptional(v.string()), + /** + * The user inside the container. + */ + User: v.exactOptional(v.string()), + /** + * A list of additional groups that the container process will run as. + */ + Groups: v.exactOptional(v.array(v.string())), + /** + * Security options for the container + */ + Privileges: v.exactOptional( + v.strictObject({ + /** + * CredentialSpec for managed service account (Windows only) + */ + CredentialSpec: v.exactOptional( + v.strictObject({ + /** + * Load credential spec from a Swarm Config with the given ID. + * The specified config must also be present in the Configs + * field with the Runtime property set. + * + *


+ * + * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + */ + Config: v.exactOptional(v.string()), + /** + * Load credential spec from this file. The file is read by + * the daemon, and must be present in the `CredentialSpecs` + * subdirectory in the docker data directory, which defaults + * to `C:\ProgramData\Docker\` on Windows. + * + * For example, specifying `spec.json` loads + * `C:\ProgramData\Docker\CredentialSpecs\spec.json`. + * + *


+ * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + */ + File: v.exactOptional(v.string()), + /** + * Load credential spec from this value in the Windows + * registry. The specified registry value must be located in: + * + * `HKLM\SOFTWARE\Microsoft\Windows + * NT\CurrentVersion\Virtualization\Containers\CredentialSpecs` + * + *


+ * + * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + */ + Registry: v.exactOptional(v.string()), + }), + ), + /** + * SELinux labels of the container + */ + SELinuxContext: v.exactOptional( + v.strictObject({ + /** + * Disable SELinux + */ + Disable: v.exactOptional(v.boolean()), + /** + * SELinux user label + */ + User: v.exactOptional(v.string()), + /** + * SELinux role label + */ + Role: v.exactOptional(v.string()), + /** + * SELinux type label + */ + Type: v.exactOptional(v.string()), + /** + * SELinux level label + */ + Level: v.exactOptional(v.string()), + }), + ), + }), + ), + /** + * Whether a pseudo-TTY should be allocated. + */ + TTY: v.exactOptional(v.boolean()), + /** + * Open `stdin` + */ + OpenStdin: v.exactOptional(v.boolean()), + /** + * Mount the container's root filesystem as read only. + */ + ReadOnly: v.exactOptional(v.boolean()), + /** + * Specification for mounts to be added to containers created as part + * of the service. + */ + Mounts: v.exactOptional( + v.array( + v.strictObject({ + /** + * Container path. + */ + Target: v.exactOptional(v.string()), + /** + * Mount source (e.g. a volume name, a host path). + */ + Source: v.exactOptional(v.string()), + /** + * The mount type. Available types: + * + * - `bind` Mounts a file or directory from the host into the container. Must + * exist prior to creating the container. + * - `volume` Creates a volume with the given name and options (or uses a + * pre-existing volume with the same name and options). These are **not** + * removed when the container is removed. + * - `tmpfs` Create a tmpfs with the given options. The mount source cannot be + * specified for tmpfs. + * - `npipe` Mounts a named pipe from the host into the container. Must exist + * prior to creating the container. + * - `cluster` a Swarm cluster volume + */ + Type: v.exactOptional( + v.picklist(["bind", "volume", "tmpfs", "npipe", "cluster"]), + ), + /** + * Whether the mount should be read-only. + */ + ReadOnly: v.exactOptional(v.boolean()), + /** + * The consistency requirement for the mount: `default`, `consistent`, + * `cached`, or `delegated`. + */ + Consistency: v.exactOptional(v.string()), + /** + * Optional configuration for the `bind` type. + */ + BindOptions: v.exactOptional( + v.strictObject({ + /** + * A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + */ + Propagation: v.exactOptional( + v.picklist([ + "private", + "rprivate", + "shared", + "rshared", + "slave", + "rslave", + ]), + ), + /** + * Disable recursive bind mount. + */ + NonRecursive: v.exactOptional(v.boolean()), + /** + * Create mount point on host if missing + */ + CreateMountpoint: v.exactOptional(v.boolean()), + }), + ), + /** + * Optional configuration for the `volume` type. + */ + VolumeOptions: v.exactOptional( + v.strictObject({ + /** + * Populate volume with data from the target. + */ + NoCopy: v.exactOptional(v.boolean()), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Map of driver specific options + */ + DriverConfig: v.exactOptional( + v.strictObject({ + /** + * Name of the driver to use to create the volume. + */ + Name: v.exactOptional(v.string()), + /** + * key/value map of driver specific options. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + }), + ), + /** + * Optional configuration for the `tmpfs` type. + */ + TmpfsOptions: v.exactOptional( + v.strictObject({ + /** + * The size for the tmpfs mount in bytes. + */ + SizeBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The permission mode for the tmpfs mount in an integer. + */ + Mode: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + }), + ), + ), + /** + * Signal to stop the container. + */ + StopSignal: v.exactOptional(v.string()), + /** + * Amount of time to wait for the container to terminate before + * forcefully killing it. + */ + StopGracePeriod: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * A test to perform to check that the container is healthy. + */ + HealthCheck: v.exactOptional( + v.strictObject({ + /** + * The test to perform. Possible values are: + * + * - `[]` inherit healthcheck from image or parent image + * - `["NONE"]` disable healthcheck + * - `["CMD", args...]` exec arguments directly + * - `["CMD-SHELL", command]` run command with system's default shell + */ + Test: v.exactOptional(v.array(v.string())), + /** + * The time to wait between checks in nanoseconds. It should be 0 or at + * least 1000000 (1 ms). 0 means inherit. + */ + Interval: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The time to wait before considering the check to have hung. It should + * be 0 or at least 1000000 (1 ms). 0 means inherit. + */ + Timeout: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The number of consecutive failures needed to consider a container as + * unhealthy. 0 means inherit. + */ + Retries: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Start period for the container to initialize before starting + * health-retries countdown in nanoseconds. It should be 0 or at least + * 1000000 (1 ms). 0 means inherit. + */ + StartPeriod: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * A list of hostname/IP mappings to add to the container's `hosts` + * file. The format of extra hosts is specified in the + * [hosts(5)](http://man7.org/linux/man-pages/man5/hosts.5.html) + * man page: + * + * + * IP_address canonical_hostname [aliases...] + */ + Hosts: v.exactOptional(v.array(v.string())), + /** + * Specification for DNS related configurations in resolver configuration + * file (`resolv.conf`). + */ + DNSConfig: v.exactOptional( + v.strictObject({ + /** + * The IP addresses of the name servers. + */ + Nameservers: v.exactOptional(v.array(v.string())), + /** + * A search list for host-name lookup. + */ + Search: v.exactOptional(v.array(v.string())), + /** + * A list of internal resolver variables to be modified (e.g., + * `debug`, `ndots:3`, etc.). + */ + Options: v.exactOptional(v.array(v.string())), + }), + ), + /** + * Secrets contains references to zero or more secrets that will be + * exposed to the service. + */ + Secrets: v.exactOptional( + v.array( + v.strictObject({ + /** + * File represents a specific target that is backed by a file. + */ + File: v.exactOptional( + v.strictObject({ + /** + * Name represents the final filename in the filesystem. + */ + Name: v.exactOptional(v.string()), + /** + * UID represents the file UID. + */ + UID: v.exactOptional(v.string()), + /** + * GID represents the file GID. + */ + GID: v.exactOptional(v.string()), + /** + * Mode represents the FileMode of the file. + */ + Mode: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * SecretID represents the ID of the specific secret that we're + * referencing. + */ + SecretID: v.exactOptional(v.string()), + /** + * SecretName is the name of the secret that this references, + * but this is just provided for lookup/display purposes. The + * secret in the reference will be identified by its ID. + */ + SecretName: v.exactOptional(v.string()), + }), + ), + ), + /** + * Configs contains references to zero or more configs that will be + * exposed to the service. + */ + Configs: v.exactOptional( + v.array( + v.strictObject({ + /** + * File represents a specific target that is backed by a file. + * + *


+ * + * > **Note**: `Configs.File` and `Configs.Runtime` are mutually exclusive + */ + File: v.exactOptional( + v.strictObject({ + /** + * Name represents the final filename in the filesystem. + */ + Name: v.exactOptional(v.string()), + /** + * UID represents the file UID. + */ + UID: v.exactOptional(v.string()), + /** + * GID represents the file GID. + */ + GID: v.exactOptional(v.string()), + /** + * Mode represents the FileMode of the file. + */ + Mode: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * Runtime represents a target that is not mounted into the + * container but is used by the task + * + *


+ * + * > **Note**: `Configs.File` and `Configs.Runtime` are mutually + * > exclusive + */ + Runtime: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * ConfigID represents the ID of the specific config that we're + * referencing. + */ + ConfigID: v.exactOptional(v.string()), + /** + * ConfigName is the name of the config that this references, + * but this is just provided for lookup/display purposes. The + * config in the reference will be identified by its ID. + */ + ConfigName: v.exactOptional(v.string()), + }), + ), + ), + /** + * Isolation technology of the containers running the service. + * (Windows only) + */ + Isolation: v.exactOptional( + v.picklist(["default", "process", "hyperv", ""]), + ), + /** + * Run an init inside the container that forwards signals and reaps + * processes. This field is omitted if empty, and the default (as + * configured on the daemon) is used. + */ + Init: v.exactOptional(v.nullable(v.boolean())), + /** + * Set kernel namedspaced parameters (sysctls) in the container. + * The Sysctls option on services accepts the same sysctls as the + * are supported on containers. Note that while the same sysctls are + * supported, no guarantees or checks are made about their + * suitability for a clustered environment, and it's up to the user + * to determine whether a given sysctl will work properly in a + * Service. + */ + Sysctls: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * A list of kernel capabilities to add to the default set + * for the container. + */ + CapabilityAdd: v.exactOptional(v.array(v.string())), + /** + * A list of kernel capabilities to drop from the default set + * for the container. + */ + CapabilityDrop: v.exactOptional(v.array(v.string())), + /** + * A list of resource limits to set in the container. For example: `{"Name": + * "nofile", "Soft": 1024, "Hard": 2048}`" + */ + Ulimits: v.exactOptional( + v.array( + v.strictObject({ + /** + * Name of ulimit + */ + Name: v.exactOptional(v.string()), + /** + * Soft limit + */ + Soft: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Hard limit + */ + Hard: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + ), + }), + ), + /** + * Read-only spec type for non-swarm containers attached to swarm overlay + * networks. + * + *


+ * + * > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are + * > mutually exclusive. PluginSpec is only used when the Runtime field + * > is set to `plugin`. NetworkAttachmentSpec is used when the Runtime + * > field is set to `attachment`. + */ + NetworkAttachmentSpec: v.exactOptional( + v.strictObject({ + /** + * ID of the container represented by this task + */ + ContainerID: v.exactOptional(v.string()), + }), + ), + /** + * Resource requirements which apply to each individual container created + * as part of the service. + */ + Resources: v.exactOptional( + v.strictObject({ + /** + * An object describing a limit on resources which can be requested by a task. + */ + Limits: v.exactOptional( + v.strictObject({ + NanoCPUs: v.exactOptional(v.pipe(v.number(), v.integer())), + MemoryBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Limits the maximum number of PIDs in the container. Set `0` for unlimited. + */ + Pids: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * An object describing the resources which can be advertised by a node and + * requested by a task. + */ + Reservations: v.exactOptional( + v.strictObject({ + NanoCPUs: v.exactOptional(v.pipe(v.number(), v.integer())), + MemoryBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * User-defined resources can be either Integer resources (e.g, `SSD=3`) or + * String resources (e.g, `GPU=UUID1`). + */ + GenericResources: v.exactOptional( + v.array( + v.strictObject({ + NamedResourceSpec: v.exactOptional( + v.strictObject({ + Kind: v.exactOptional(v.string()), + Value: v.exactOptional(v.string()), + }), + ), + DiscreteResourceSpec: v.exactOptional( + v.strictObject({ + Kind: v.exactOptional(v.string()), + Value: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + }), + ), + ), + }), + ), + }), + ), + /** + * Specification for the restart policy which applies to containers + * created as part of this service. + */ + RestartPolicy: v.exactOptional( + v.strictObject({ + /** + * Condition for restart. + */ + Condition: v.exactOptional(v.picklist(["none", "on-failure", "any"])), + /** + * Delay between restart attempts. + */ + Delay: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Maximum attempts to restart a given container before giving up + * (default value is 0, which is ignored). + */ + MaxAttempts: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Windows is the time window used to evaluate the restart policy + * (default value is 0, which is unbounded). + */ + Window: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + Placement: v.exactOptional( + v.strictObject({ + /** + * An array of constraint expressions to limit the set of nodes where + * a task can be scheduled. Constraint expressions can either use a + * _match_ (`==`) or _exclude_ (`!=`) rule. Multiple constraints find + * nodes that satisfy every expression (AND match). Constraints can + * match node or Docker Engine labels as follows: + * + * node attribute | matches | example + * ---------------------|--------------------------------|----------------------------------------------- + * `node.id` | Node ID | + * `node.id==2ivku8v2gvtg4` + * `node.hostname` | Node hostname | + * `node.hostname!=node-2` + * `node.role` | Node role (`manager`/`worker`) | + * `node.role==manager` + * `node.platform.os` | Node operating system | + * `node.platform.os==windows` + * `node.platform.arch` | Node architecture | + * `node.platform.arch==x86_64` + * `node.labels` | User-defined node labels | + * `node.labels.security==high` + * `engine.labels` | Docker Engine's labels | + * `engine.labels.operatingsystem==ubuntu-14.04` + * + * `engine.labels` apply to Docker Engine labels like operating system, + * drivers, etc. Swarm administrators add `node.labels` for operational + * purposes by using the [`node update endpoint`](#operation/NodeUpdate). + */ + Constraints: v.exactOptional(v.array(v.string())), + /** + * Preferences provide a way to make the scheduler aware of factors + * such as topology. They are provided in order from highest to + * lowest precedence. + */ + Preferences: v.exactOptional( + v.array( + v.strictObject({ + Spread: v.exactOptional( + v.strictObject({ + /** + * label descriptor, such as `engine.labels.az`. + */ + SpreadDescriptor: v.exactOptional(v.string()), + }), + ), + }), + ), + ), + /** + * Maximum number of replicas for per node (default value is 0, which + * is unlimited) + */ + MaxReplicas: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Platforms stores all the platforms that the service's image can + * run on. This field is used in the platform filter for scheduling. + * If empty, then the platform filter is off, meaning there are no + * scheduling restrictions. + */ + Platforms: v.exactOptional( + v.array( + v.strictObject({ + /** + * Architecture represents the hardware architecture (for example, + * `x86_64`). + */ + Architecture: v.exactOptional(v.string()), + /** + * OS represents the Operating System (for example, `linux` or `windows`). + */ + OS: v.exactOptional(v.string()), + }), + ), + ), + }), + ), + /** + * A counter that triggers an update even if no relevant parameters have + * been changed. + */ + ForceUpdate: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Runtime is the type of runtime specified for the task executor. + */ + Runtime: v.exactOptional(v.string()), + /** + * Specifies which networks the service should attach to. + */ + Networks: v.exactOptional( + v.array( + v.strictObject({ + /** + * The target network for attachment. Must be a network name or ID. + */ + Target: v.exactOptional(v.string()), + /** + * Discoverable alternate names for the service on this network. + */ + Aliases: v.exactOptional(v.array(v.string())), + /** + * Driver attachment options for the network target. + */ + DriverOpts: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + ), + /** + * Specifies the log driver to use for tasks created from this spec. If + * not present, the default one for the swarm will be used, finally + * falling back to the engine default if not specified. + */ + LogDriver: v.exactOptional( + v.strictObject({ + Name: v.exactOptional(v.string()), + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), +}); +export const taskStateSchema = v.picklist([ + "new", + "allocated", + "pending", + "assigned", + "accepted", + "preparing", + "ready", + "starting", + "running", + "complete", + "shutdown", + "failed", + "rejected", + "remove", + "orphaned", +]); +export const taskSchema = v.strictObject({ + /** + * The ID of the task. + */ + ID: v.exactOptional(v.string()), + /** + * The version number of the object such as node, service, etc. This is needed + * to avoid conflicting writes. The client must send the version number along + * with the modified specification when updating these objects. + * + * This approach ensures safe concurrency and determinism in that the change + * on the object may not be applied if the version number has changed from the + * last read. In other words, if two update requests specify the same base + * version, only one of the requests can succeed. As a result, two separate + * update requests that happen at the same time will not unintentionally + * overwrite each other. + */ + Version: v.exactOptional( + v.strictObject({ + Index: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + CreatedAt: v.exactOptional(v.string()), + UpdatedAt: v.exactOptional(v.string()), + /** + * Name of the task. + */ + Name: v.exactOptional(v.string()), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * User modifiable task configuration. + */ + Spec: v.exactOptional( + v.strictObject({ + /** + * Plugin spec for the service. *(Experimental release only.)* + * + *


+ * + * > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are + * > mutually exclusive. PluginSpec is only used when the Runtime field + * > is set to `plugin`. NetworkAttachmentSpec is used when the Runtime + * > field is set to `attachment`. + */ + PluginSpec: v.exactOptional( + v.strictObject({ + /** + * The name or 'alias' to use for the plugin. + */ + Name: v.exactOptional(v.string()), + /** + * The plugin image reference to use. + */ + Remote: v.exactOptional(v.string()), + /** + * Disable the plugin once scheduled. + */ + Disabled: v.exactOptional(v.boolean()), + PluginPrivilege: v.exactOptional( + v.array( + v.strictObject({ + Name: v.exactOptional(v.string()), + Description: v.exactOptional(v.string()), + Value: v.exactOptional(v.array(v.string())), + }), + ), + ), + }), + ), + /** + * Container spec for the service. + * + *


+ * + * > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are + * > mutually exclusive. PluginSpec is only used when the Runtime field + * > is set to `plugin`. NetworkAttachmentSpec is used when the Runtime + * > field is set to `attachment`. + */ + ContainerSpec: v.exactOptional( + v.strictObject({ + /** + * The image name to use for the container + */ + Image: v.exactOptional(v.string()), + /** + * User-defined key/value data. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * The command to be run in the image. + */ + Command: v.exactOptional(v.array(v.string())), + /** + * Arguments to the command. + */ + Args: v.exactOptional(v.array(v.string())), + /** + * The hostname to use for the container, as a valid + * [RFC 1123](https://tools.ietf.org/html/rfc1123) hostname. + */ + Hostname: v.exactOptional(v.string()), + /** + * A list of environment variables in the form `VAR=value`. + */ + Env: v.exactOptional(v.array(v.string())), + /** + * The working directory for commands to run in. + */ + Dir: v.exactOptional(v.string()), + /** + * The user inside the container. + */ + User: v.exactOptional(v.string()), + /** + * A list of additional groups that the container process will run as. + */ + Groups: v.exactOptional(v.array(v.string())), + /** + * Security options for the container + */ + Privileges: v.exactOptional( + v.strictObject({ + /** + * CredentialSpec for managed service account (Windows only) + */ + CredentialSpec: v.exactOptional( + v.strictObject({ + /** + * Load credential spec from a Swarm Config with the given ID. + * The specified config must also be present in the Configs + * field with the Runtime property set. + * + *


+ * + * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + */ + Config: v.exactOptional(v.string()), + /** + * Load credential spec from this file. The file is read by + * the daemon, and must be present in the `CredentialSpecs` + * subdirectory in the docker data directory, which defaults + * to `C:\ProgramData\Docker\` on Windows. + * + * For example, specifying `spec.json` loads + * `C:\ProgramData\Docker\CredentialSpecs\spec.json`. + * + *


+ * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + */ + File: v.exactOptional(v.string()), + /** + * Load credential spec from this value in the Windows + * registry. The specified registry value must be located in: + * + * `HKLM\SOFTWARE\Microsoft\Windows + * NT\CurrentVersion\Virtualization\Containers\CredentialSpecs` + * + *


+ * + * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + */ + Registry: v.exactOptional(v.string()), + }), + ), + /** + * SELinux labels of the container + */ + SELinuxContext: v.exactOptional( + v.strictObject({ + /** + * Disable SELinux + */ + Disable: v.exactOptional(v.boolean()), + /** + * SELinux user label + */ + User: v.exactOptional(v.string()), + /** + * SELinux role label + */ + Role: v.exactOptional(v.string()), + /** + * SELinux type label + */ + Type: v.exactOptional(v.string()), + /** + * SELinux level label + */ + Level: v.exactOptional(v.string()), + }), + ), + }), + ), + /** + * Whether a pseudo-TTY should be allocated. + */ + TTY: v.exactOptional(v.boolean()), + /** + * Open `stdin` + */ + OpenStdin: v.exactOptional(v.boolean()), + /** + * Mount the container's root filesystem as read only. + */ + ReadOnly: v.exactOptional(v.boolean()), + /** + * Specification for mounts to be added to containers created as part + * of the service. + */ + Mounts: v.exactOptional( + v.array( + v.strictObject({ + /** + * Container path. + */ + Target: v.exactOptional(v.string()), + /** + * Mount source (e.g. a volume name, a host path). + */ + Source: v.exactOptional(v.string()), + /** + * The mount type. Available types: + * + * - `bind` Mounts a file or directory from the host into the container. Must + * exist prior to creating the container. + * - `volume` Creates a volume with the given name and options (or uses a + * pre-existing volume with the same name and options). These are **not** + * removed when the container is removed. + * - `tmpfs` Create a tmpfs with the given options. The mount source cannot be + * specified for tmpfs. + * - `npipe` Mounts a named pipe from the host into the container. Must exist + * prior to creating the container. + * - `cluster` a Swarm cluster volume + */ + Type: v.exactOptional( + v.picklist(["bind", "volume", "tmpfs", "npipe", "cluster"]), + ), + /** + * Whether the mount should be read-only. + */ + ReadOnly: v.exactOptional(v.boolean()), + /** + * The consistency requirement for the mount: `default`, `consistent`, + * `cached`, or `delegated`. + */ + Consistency: v.exactOptional(v.string()), + /** + * Optional configuration for the `bind` type. + */ + BindOptions: v.exactOptional( + v.strictObject({ + /** + * A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + */ + Propagation: v.exactOptional( + v.picklist([ + "private", + "rprivate", + "shared", + "rshared", + "slave", + "rslave", + ]), + ), + /** + * Disable recursive bind mount. + */ + NonRecursive: v.exactOptional(v.boolean()), + /** + * Create mount point on host if missing + */ + CreateMountpoint: v.exactOptional(v.boolean()), + }), + ), + /** + * Optional configuration for the `volume` type. + */ + VolumeOptions: v.exactOptional( + v.strictObject({ + /** + * Populate volume with data from the target. + */ + NoCopy: v.exactOptional(v.boolean()), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Map of driver specific options + */ + DriverConfig: v.exactOptional( + v.strictObject({ + /** + * Name of the driver to use to create the volume. + */ + Name: v.exactOptional(v.string()), + /** + * key/value map of driver specific options. + */ + Options: v.exactOptional( + v.record(v.string(), v.unknown()), + ), + }), + ), + }), + ), + /** + * Optional configuration for the `tmpfs` type. + */ + TmpfsOptions: v.exactOptional( + v.strictObject({ + /** + * The size for the tmpfs mount in bytes. + */ + SizeBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The permission mode for the tmpfs mount in an integer. + */ + Mode: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + }), + ), + ), + /** + * Signal to stop the container. + */ + StopSignal: v.exactOptional(v.string()), + /** + * Amount of time to wait for the container to terminate before + * forcefully killing it. + */ + StopGracePeriod: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * A test to perform to check that the container is healthy. + */ + HealthCheck: v.exactOptional( + v.strictObject({ + /** + * The test to perform. Possible values are: + * + * - `[]` inherit healthcheck from image or parent image + * - `["NONE"]` disable healthcheck + * - `["CMD", args...]` exec arguments directly + * - `["CMD-SHELL", command]` run command with system's default shell + */ + Test: v.exactOptional(v.array(v.string())), + /** + * The time to wait between checks in nanoseconds. It should be 0 or at + * least 1000000 (1 ms). 0 means inherit. + */ + Interval: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The time to wait before considering the check to have hung. It should + * be 0 or at least 1000000 (1 ms). 0 means inherit. + */ + Timeout: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The number of consecutive failures needed to consider a container as + * unhealthy. 0 means inherit. + */ + Retries: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Start period for the container to initialize before starting + * health-retries countdown in nanoseconds. It should be 0 or at least + * 1000000 (1 ms). 0 means inherit. + */ + StartPeriod: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * A list of hostname/IP mappings to add to the container's `hosts` + * file. The format of extra hosts is specified in the + * [hosts(5)](http://man7.org/linux/man-pages/man5/hosts.5.html) + * man page: + * + * + * IP_address canonical_hostname [aliases...] + */ + Hosts: v.exactOptional(v.array(v.string())), + /** + * Specification for DNS related configurations in resolver configuration + * file (`resolv.conf`). + */ + DNSConfig: v.exactOptional( + v.strictObject({ + /** + * The IP addresses of the name servers. + */ + Nameservers: v.exactOptional(v.array(v.string())), + /** + * A search list for host-name lookup. + */ + Search: v.exactOptional(v.array(v.string())), + /** + * A list of internal resolver variables to be modified (e.g., + * `debug`, `ndots:3`, etc.). + */ + Options: v.exactOptional(v.array(v.string())), + }), + ), + /** + * Secrets contains references to zero or more secrets that will be + * exposed to the service. + */ + Secrets: v.exactOptional( + v.array( + v.strictObject({ + /** + * File represents a specific target that is backed by a file. + */ + File: v.exactOptional( + v.strictObject({ + /** + * Name represents the final filename in the filesystem. + */ + Name: v.exactOptional(v.string()), + /** + * UID represents the file UID. + */ + UID: v.exactOptional(v.string()), + /** + * GID represents the file GID. + */ + GID: v.exactOptional(v.string()), + /** + * Mode represents the FileMode of the file. + */ + Mode: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * SecretID represents the ID of the specific secret that we're + * referencing. + */ + SecretID: v.exactOptional(v.string()), + /** + * SecretName is the name of the secret that this references, + * but this is just provided for lookup/display purposes. The + * secret in the reference will be identified by its ID. + */ + SecretName: v.exactOptional(v.string()), + }), + ), + ), + /** + * Configs contains references to zero or more configs that will be + * exposed to the service. + */ + Configs: v.exactOptional( + v.array( + v.strictObject({ + /** + * File represents a specific target that is backed by a file. + * + *


+ * + * > **Note**: `Configs.File` and `Configs.Runtime` are mutually exclusive + */ + File: v.exactOptional( + v.strictObject({ + /** + * Name represents the final filename in the filesystem. + */ + Name: v.exactOptional(v.string()), + /** + * UID represents the file UID. + */ + UID: v.exactOptional(v.string()), + /** + * GID represents the file GID. + */ + GID: v.exactOptional(v.string()), + /** + * Mode represents the FileMode of the file. + */ + Mode: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * Runtime represents a target that is not mounted into the + * container but is used by the task + * + *


+ * + * > **Note**: `Configs.File` and `Configs.Runtime` are mutually + * > exclusive + */ + Runtime: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * ConfigID represents the ID of the specific config that we're + * referencing. + */ + ConfigID: v.exactOptional(v.string()), + /** + * ConfigName is the name of the config that this references, + * but this is just provided for lookup/display purposes. The + * config in the reference will be identified by its ID. + */ + ConfigName: v.exactOptional(v.string()), + }), + ), + ), + /** + * Isolation technology of the containers running the service. + * (Windows only) + */ + Isolation: v.exactOptional( + v.picklist(["default", "process", "hyperv", ""]), + ), + /** + * Run an init inside the container that forwards signals and reaps + * processes. This field is omitted if empty, and the default (as + * configured on the daemon) is used. + */ + Init: v.exactOptional(v.nullable(v.boolean())), + /** + * Set kernel namedspaced parameters (sysctls) in the container. + * The Sysctls option on services accepts the same sysctls as the + * are supported on containers. Note that while the same sysctls are + * supported, no guarantees or checks are made about their + * suitability for a clustered environment, and it's up to the user + * to determine whether a given sysctl will work properly in a + * Service. + */ + Sysctls: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * A list of kernel capabilities to add to the default set + * for the container. + */ + CapabilityAdd: v.exactOptional(v.array(v.string())), + /** + * A list of kernel capabilities to drop from the default set + * for the container. + */ + CapabilityDrop: v.exactOptional(v.array(v.string())), + /** + * A list of resource limits to set in the container. For example: `{"Name": + * "nofile", "Soft": 1024, "Hard": 2048}`" + */ + Ulimits: v.exactOptional( + v.array( + v.strictObject({ + /** + * Name of ulimit + */ + Name: v.exactOptional(v.string()), + /** + * Soft limit + */ + Soft: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Hard limit + */ + Hard: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + ), + }), + ), + /** + * Read-only spec type for non-swarm containers attached to swarm overlay + * networks. + * + *


+ * + * > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are + * > mutually exclusive. PluginSpec is only used when the Runtime field + * > is set to `plugin`. NetworkAttachmentSpec is used when the Runtime + * > field is set to `attachment`. + */ + NetworkAttachmentSpec: v.exactOptional( + v.strictObject({ + /** + * ID of the container represented by this task + */ + ContainerID: v.exactOptional(v.string()), + }), + ), + /** + * Resource requirements which apply to each individual container created + * as part of the service. + */ + Resources: v.exactOptional( + v.strictObject({ + /** + * An object describing a limit on resources which can be requested by a task. + */ + Limits: v.exactOptional( + v.strictObject({ + NanoCPUs: v.exactOptional(v.pipe(v.number(), v.integer())), + MemoryBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Limits the maximum number of PIDs in the container. Set `0` for unlimited. + */ + Pids: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * An object describing the resources which can be advertised by a node and + * requested by a task. + */ + Reservations: v.exactOptional( + v.strictObject({ + NanoCPUs: v.exactOptional(v.pipe(v.number(), v.integer())), + MemoryBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * User-defined resources can be either Integer resources (e.g, `SSD=3`) or + * String resources (e.g, `GPU=UUID1`). + */ + GenericResources: v.exactOptional( + v.array( + v.strictObject({ + NamedResourceSpec: v.exactOptional( + v.strictObject({ + Kind: v.exactOptional(v.string()), + Value: v.exactOptional(v.string()), + }), + ), + DiscreteResourceSpec: v.exactOptional( + v.strictObject({ + Kind: v.exactOptional(v.string()), + Value: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + }), + ), + ), + }), + ), + }), + ), + /** + * Specification for the restart policy which applies to containers + * created as part of this service. + */ + RestartPolicy: v.exactOptional( + v.strictObject({ + /** + * Condition for restart. + */ + Condition: v.exactOptional(v.picklist(["none", "on-failure", "any"])), + /** + * Delay between restart attempts. + */ + Delay: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Maximum attempts to restart a given container before giving up + * (default value is 0, which is ignored). + */ + MaxAttempts: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Windows is the time window used to evaluate the restart policy + * (default value is 0, which is unbounded). + */ + Window: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + Placement: v.exactOptional( + v.strictObject({ + /** + * An array of constraint expressions to limit the set of nodes where + * a task can be scheduled. Constraint expressions can either use a + * _match_ (`==`) or _exclude_ (`!=`) rule. Multiple constraints find + * nodes that satisfy every expression (AND match). Constraints can + * match node or Docker Engine labels as follows: + * + * node attribute | matches | example + * ---------------------|--------------------------------|----------------------------------------------- + * `node.id` | Node ID | + * `node.id==2ivku8v2gvtg4` + * `node.hostname` | Node hostname | + * `node.hostname!=node-2` + * `node.role` | Node role (`manager`/`worker`) | + * `node.role==manager` + * `node.platform.os` | Node operating system | + * `node.platform.os==windows` + * `node.platform.arch` | Node architecture | + * `node.platform.arch==x86_64` + * `node.labels` | User-defined node labels | + * `node.labels.security==high` + * `engine.labels` | Docker Engine's labels | + * `engine.labels.operatingsystem==ubuntu-14.04` + * + * `engine.labels` apply to Docker Engine labels like operating system, + * drivers, etc. Swarm administrators add `node.labels` for operational + * purposes by using the [`node update endpoint`](#operation/NodeUpdate). + */ + Constraints: v.exactOptional(v.array(v.string())), + /** + * Preferences provide a way to make the scheduler aware of factors + * such as topology. They are provided in order from highest to + * lowest precedence. + */ + Preferences: v.exactOptional( + v.array( + v.strictObject({ + Spread: v.exactOptional( + v.strictObject({ + /** + * label descriptor, such as `engine.labels.az`. + */ + SpreadDescriptor: v.exactOptional(v.string()), + }), + ), + }), + ), + ), + /** + * Maximum number of replicas for per node (default value is 0, which + * is unlimited) + */ + MaxReplicas: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Platforms stores all the platforms that the service's image can + * run on. This field is used in the platform filter for scheduling. + * If empty, then the platform filter is off, meaning there are no + * scheduling restrictions. + */ + Platforms: v.exactOptional( + v.array( + v.strictObject({ + /** + * Architecture represents the hardware architecture (for example, + * `x86_64`). + */ + Architecture: v.exactOptional(v.string()), + /** + * OS represents the Operating System (for example, `linux` or `windows`). + */ + OS: v.exactOptional(v.string()), + }), + ), + ), + }), + ), + /** + * A counter that triggers an update even if no relevant parameters have + * been changed. + */ + ForceUpdate: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Runtime is the type of runtime specified for the task executor. + */ + Runtime: v.exactOptional(v.string()), + /** + * Specifies which networks the service should attach to. + */ + Networks: v.exactOptional( + v.array( + v.strictObject({ + /** + * The target network for attachment. Must be a network name or ID. + */ + Target: v.exactOptional(v.string()), + /** + * Discoverable alternate names for the service on this network. + */ + Aliases: v.exactOptional(v.array(v.string())), + /** + * Driver attachment options for the network target. + */ + DriverOpts: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + ), + /** + * Specifies the log driver to use for tasks created from this spec. If + * not present, the default one for the swarm will be used, finally + * falling back to the engine default if not specified. + */ + LogDriver: v.exactOptional( + v.strictObject({ + Name: v.exactOptional(v.string()), + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + }), + ), + /** + * The ID of the service this task is part of. + */ + ServiceID: v.exactOptional(v.string()), + Slot: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The ID of the node that this task is on. + */ + NodeID: v.exactOptional(v.string()), + /** + * User-defined resources can be either Integer resources (e.g, `SSD=3`) or + * String resources (e.g, `GPU=UUID1`). + */ + AssignedGenericResources: v.exactOptional( + v.array( + v.strictObject({ + NamedResourceSpec: v.exactOptional( + v.strictObject({ + Kind: v.exactOptional(v.string()), + Value: v.exactOptional(v.string()), + }), + ), + DiscreteResourceSpec: v.exactOptional( + v.strictObject({ + Kind: v.exactOptional(v.string()), + Value: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + }), + ), + ), + Status: v.exactOptional( + v.strictObject({ + Timestamp: v.exactOptional(v.string()), + State: v.exactOptional( + v.picklist([ + "new", + "allocated", + "pending", + "assigned", + "accepted", + "preparing", + "ready", + "starting", + "running", + "complete", + "shutdown", + "failed", + "rejected", + "remove", + "orphaned", + ]), + ), + Message: v.exactOptional(v.string()), + Err: v.exactOptional(v.string()), + ContainerStatus: v.exactOptional( + v.strictObject({ + ContainerID: v.exactOptional(v.string()), + PID: v.exactOptional(v.pipe(v.number(), v.integer())), + ExitCode: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + }), + ), + DesiredState: v.exactOptional( + v.picklist([ + "new", + "allocated", + "pending", + "assigned", + "accepted", + "preparing", + "ready", + "starting", + "running", + "complete", + "shutdown", + "failed", + "rejected", + "remove", + "orphaned", + ]), + ), + /** + * The version number of the object such as node, service, etc. This is needed + * to avoid conflicting writes. The client must send the version number along + * with the modified specification when updating these objects. + * + * This approach ensures safe concurrency and determinism in that the change + * on the object may not be applied if the version number has changed from the + * last read. In other words, if two update requests specify the same base + * version, only one of the requests can succeed. As a result, two separate + * update requests that happen at the same time will not unintentionally + * overwrite each other. + */ + JobIteration: v.exactOptional( + v.strictObject({ + Index: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), +}); +/** User modifiable configuration for a service. */ +export const serviceSpecSchema = v.strictObject({ + /** + * Name of the service. + */ + Name: v.exactOptional(v.string()), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * User modifiable task configuration. + */ + TaskTemplate: v.exactOptional( + v.strictObject({ + /** + * Plugin spec for the service. *(Experimental release only.)* + * + *


+ * + * > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are + * > mutually exclusive. PluginSpec is only used when the Runtime field + * > is set to `plugin`. NetworkAttachmentSpec is used when the Runtime + * > field is set to `attachment`. + */ + PluginSpec: v.exactOptional( + v.strictObject({ + /** + * The name or 'alias' to use for the plugin. + */ + Name: v.exactOptional(v.string()), + /** + * The plugin image reference to use. + */ + Remote: v.exactOptional(v.string()), + /** + * Disable the plugin once scheduled. + */ + Disabled: v.exactOptional(v.boolean()), + PluginPrivilege: v.exactOptional( + v.array( + v.strictObject({ + Name: v.exactOptional(v.string()), + Description: v.exactOptional(v.string()), + Value: v.exactOptional(v.array(v.string())), + }), + ), + ), + }), + ), + /** + * Container spec for the service. + * + *


+ * + * > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are + * > mutually exclusive. PluginSpec is only used when the Runtime field + * > is set to `plugin`. NetworkAttachmentSpec is used when the Runtime + * > field is set to `attachment`. + */ + ContainerSpec: v.exactOptional( + v.strictObject({ + /** + * The image name to use for the container + */ + Image: v.exactOptional(v.string()), + /** + * User-defined key/value data. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * The command to be run in the image. + */ + Command: v.exactOptional(v.array(v.string())), + /** + * Arguments to the command. + */ + Args: v.exactOptional(v.array(v.string())), + /** + * The hostname to use for the container, as a valid + * [RFC 1123](https://tools.ietf.org/html/rfc1123) hostname. + */ + Hostname: v.exactOptional(v.string()), + /** + * A list of environment variables in the form `VAR=value`. + */ + Env: v.exactOptional(v.array(v.string())), + /** + * The working directory for commands to run in. + */ + Dir: v.exactOptional(v.string()), + /** + * The user inside the container. + */ + User: v.exactOptional(v.string()), + /** + * A list of additional groups that the container process will run as. + */ + Groups: v.exactOptional(v.array(v.string())), + /** + * Security options for the container + */ + Privileges: v.exactOptional( + v.strictObject({ + /** + * CredentialSpec for managed service account (Windows only) + */ + CredentialSpec: v.exactOptional( + v.strictObject({ + /** + * Load credential spec from a Swarm Config with the given ID. + * The specified config must also be present in the Configs + * field with the Runtime property set. + * + *


+ * + * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + */ + Config: v.exactOptional(v.string()), + /** + * Load credential spec from this file. The file is read by + * the daemon, and must be present in the `CredentialSpecs` + * subdirectory in the docker data directory, which defaults + * to `C:\ProgramData\Docker\` on Windows. + * + * For example, specifying `spec.json` loads + * `C:\ProgramData\Docker\CredentialSpecs\spec.json`. + * + *


+ * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + */ + File: v.exactOptional(v.string()), + /** + * Load credential spec from this value in the Windows + * registry. The specified registry value must be located in: + * + * `HKLM\SOFTWARE\Microsoft\Windows + * NT\CurrentVersion\Virtualization\Containers\CredentialSpecs` + * + *


+ * + * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + */ + Registry: v.exactOptional(v.string()), + }), + ), + /** + * SELinux labels of the container + */ + SELinuxContext: v.exactOptional( + v.strictObject({ + /** + * Disable SELinux + */ + Disable: v.exactOptional(v.boolean()), + /** + * SELinux user label + */ + User: v.exactOptional(v.string()), + /** + * SELinux role label + */ + Role: v.exactOptional(v.string()), + /** + * SELinux type label + */ + Type: v.exactOptional(v.string()), + /** + * SELinux level label + */ + Level: v.exactOptional(v.string()), + }), + ), + }), + ), + /** + * Whether a pseudo-TTY should be allocated. + */ + TTY: v.exactOptional(v.boolean()), + /** + * Open `stdin` + */ + OpenStdin: v.exactOptional(v.boolean()), + /** + * Mount the container's root filesystem as read only. + */ + ReadOnly: v.exactOptional(v.boolean()), + /** + * Specification for mounts to be added to containers created as part + * of the service. + */ + Mounts: v.exactOptional( + v.array( + v.strictObject({ + /** + * Container path. + */ + Target: v.exactOptional(v.string()), + /** + * Mount source (e.g. a volume name, a host path). + */ + Source: v.exactOptional(v.string()), + /** + * The mount type. Available types: + * + * - `bind` Mounts a file or directory from the host into the container. Must + * exist prior to creating the container. + * - `volume` Creates a volume with the given name and options (or uses a + * pre-existing volume with the same name and options). These are **not** + * removed when the container is removed. + * - `tmpfs` Create a tmpfs with the given options. The mount source cannot be + * specified for tmpfs. + * - `npipe` Mounts a named pipe from the host into the container. Must exist + * prior to creating the container. + * - `cluster` a Swarm cluster volume + */ + Type: v.exactOptional( + v.picklist(["bind", "volume", "tmpfs", "npipe", "cluster"]), + ), + /** + * Whether the mount should be read-only. + */ + ReadOnly: v.exactOptional(v.boolean()), + /** + * The consistency requirement for the mount: `default`, `consistent`, + * `cached`, or `delegated`. + */ + Consistency: v.exactOptional(v.string()), + /** + * Optional configuration for the `bind` type. + */ + BindOptions: v.exactOptional( + v.strictObject({ + /** + * A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + */ + Propagation: v.exactOptional( + v.picklist([ + "private", + "rprivate", + "shared", + "rshared", + "slave", + "rslave", + ]), + ), + /** + * Disable recursive bind mount. + */ + NonRecursive: v.exactOptional(v.boolean()), + /** + * Create mount point on host if missing + */ + CreateMountpoint: v.exactOptional(v.boolean()), + }), + ), + /** + * Optional configuration for the `volume` type. + */ + VolumeOptions: v.exactOptional( + v.strictObject({ + /** + * Populate volume with data from the target. + */ + NoCopy: v.exactOptional(v.boolean()), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Map of driver specific options + */ + DriverConfig: v.exactOptional( + v.strictObject({ + /** + * Name of the driver to use to create the volume. + */ + Name: v.exactOptional(v.string()), + /** + * key/value map of driver specific options. + */ + Options: v.exactOptional( + v.record(v.string(), v.unknown()), + ), + }), + ), + }), + ), + /** + * Optional configuration for the `tmpfs` type. + */ + TmpfsOptions: v.exactOptional( + v.strictObject({ + /** + * The size for the tmpfs mount in bytes. + */ + SizeBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The permission mode for the tmpfs mount in an integer. + */ + Mode: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + }), + ), + ), + /** + * Signal to stop the container. + */ + StopSignal: v.exactOptional(v.string()), + /** + * Amount of time to wait for the container to terminate before + * forcefully killing it. + */ + StopGracePeriod: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * A test to perform to check that the container is healthy. + */ + HealthCheck: v.exactOptional( + v.strictObject({ + /** + * The test to perform. Possible values are: + * + * - `[]` inherit healthcheck from image or parent image + * - `["NONE"]` disable healthcheck + * - `["CMD", args...]` exec arguments directly + * - `["CMD-SHELL", command]` run command with system's default shell + */ + Test: v.exactOptional(v.array(v.string())), + /** + * The time to wait between checks in nanoseconds. It should be 0 or at + * least 1000000 (1 ms). 0 means inherit. + */ + Interval: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The time to wait before considering the check to have hung. It should + * be 0 or at least 1000000 (1 ms). 0 means inherit. + */ + Timeout: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The number of consecutive failures needed to consider a container as + * unhealthy. 0 means inherit. + */ + Retries: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Start period for the container to initialize before starting + * health-retries countdown in nanoseconds. It should be 0 or at least + * 1000000 (1 ms). 0 means inherit. + */ + StartPeriod: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * A list of hostname/IP mappings to add to the container's `hosts` + * file. The format of extra hosts is specified in the + * [hosts(5)](http://man7.org/linux/man-pages/man5/hosts.5.html) + * man page: + * + * + * IP_address canonical_hostname [aliases...] + */ + Hosts: v.exactOptional(v.array(v.string())), + /** + * Specification for DNS related configurations in resolver configuration + * file (`resolv.conf`). + */ + DNSConfig: v.exactOptional( + v.strictObject({ + /** + * The IP addresses of the name servers. + */ + Nameservers: v.exactOptional(v.array(v.string())), + /** + * A search list for host-name lookup. + */ + Search: v.exactOptional(v.array(v.string())), + /** + * A list of internal resolver variables to be modified (e.g., + * `debug`, `ndots:3`, etc.). + */ + Options: v.exactOptional(v.array(v.string())), + }), + ), + /** + * Secrets contains references to zero or more secrets that will be + * exposed to the service. + */ + Secrets: v.exactOptional( + v.array( + v.strictObject({ + /** + * File represents a specific target that is backed by a file. + */ + File: v.exactOptional( + v.strictObject({ + /** + * Name represents the final filename in the filesystem. + */ + Name: v.exactOptional(v.string()), + /** + * UID represents the file UID. + */ + UID: v.exactOptional(v.string()), + /** + * GID represents the file GID. + */ + GID: v.exactOptional(v.string()), + /** + * Mode represents the FileMode of the file. + */ + Mode: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * SecretID represents the ID of the specific secret that we're + * referencing. + */ + SecretID: v.exactOptional(v.string()), + /** + * SecretName is the name of the secret that this references, + * but this is just provided for lookup/display purposes. The + * secret in the reference will be identified by its ID. + */ + SecretName: v.exactOptional(v.string()), + }), + ), + ), + /** + * Configs contains references to zero or more configs that will be + * exposed to the service. + */ + Configs: v.exactOptional( + v.array( + v.strictObject({ + /** + * File represents a specific target that is backed by a file. + * + *


+ * + * > **Note**: `Configs.File` and `Configs.Runtime` are mutually exclusive + */ + File: v.exactOptional( + v.strictObject({ + /** + * Name represents the final filename in the filesystem. + */ + Name: v.exactOptional(v.string()), + /** + * UID represents the file UID. + */ + UID: v.exactOptional(v.string()), + /** + * GID represents the file GID. + */ + GID: v.exactOptional(v.string()), + /** + * Mode represents the FileMode of the file. + */ + Mode: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * Runtime represents a target that is not mounted into the + * container but is used by the task + * + *


+ * + * > **Note**: `Configs.File` and `Configs.Runtime` are mutually + * > exclusive + */ + Runtime: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * ConfigID represents the ID of the specific config that we're + * referencing. + */ + ConfigID: v.exactOptional(v.string()), + /** + * ConfigName is the name of the config that this references, + * but this is just provided for lookup/display purposes. The + * config in the reference will be identified by its ID. + */ + ConfigName: v.exactOptional(v.string()), + }), + ), + ), + /** + * Isolation technology of the containers running the service. + * (Windows only) + */ + Isolation: v.exactOptional( + v.picklist(["default", "process", "hyperv", ""]), + ), + /** + * Run an init inside the container that forwards signals and reaps + * processes. This field is omitted if empty, and the default (as + * configured on the daemon) is used. + */ + Init: v.exactOptional(v.nullable(v.boolean())), + /** + * Set kernel namedspaced parameters (sysctls) in the container. + * The Sysctls option on services accepts the same sysctls as the + * are supported on containers. Note that while the same sysctls are + * supported, no guarantees or checks are made about their + * suitability for a clustered environment, and it's up to the user + * to determine whether a given sysctl will work properly in a + * Service. + */ + Sysctls: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * A list of kernel capabilities to add to the default set + * for the container. + */ + CapabilityAdd: v.exactOptional(v.array(v.string())), + /** + * A list of kernel capabilities to drop from the default set + * for the container. + */ + CapabilityDrop: v.exactOptional(v.array(v.string())), + /** + * A list of resource limits to set in the container. For example: `{"Name": + * "nofile", "Soft": 1024, "Hard": 2048}`" + */ + Ulimits: v.exactOptional( + v.array( + v.strictObject({ + /** + * Name of ulimit + */ + Name: v.exactOptional(v.string()), + /** + * Soft limit + */ + Soft: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Hard limit + */ + Hard: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + ), + }), + ), + /** + * Read-only spec type for non-swarm containers attached to swarm overlay + * networks. + * + *


+ * + * > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are + * > mutually exclusive. PluginSpec is only used when the Runtime field + * > is set to `plugin`. NetworkAttachmentSpec is used when the Runtime + * > field is set to `attachment`. + */ + NetworkAttachmentSpec: v.exactOptional( + v.strictObject({ + /** + * ID of the container represented by this task + */ + ContainerID: v.exactOptional(v.string()), + }), + ), + /** + * Resource requirements which apply to each individual container created + * as part of the service. + */ + Resources: v.exactOptional( + v.strictObject({ + /** + * An object describing a limit on resources which can be requested by a task. + */ + Limits: v.exactOptional( + v.strictObject({ + NanoCPUs: v.exactOptional(v.pipe(v.number(), v.integer())), + MemoryBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Limits the maximum number of PIDs in the container. Set `0` for unlimited. + */ + Pids: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * An object describing the resources which can be advertised by a node and + * requested by a task. + */ + Reservations: v.exactOptional( + v.strictObject({ + NanoCPUs: v.exactOptional(v.pipe(v.number(), v.integer())), + MemoryBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * User-defined resources can be either Integer resources (e.g, `SSD=3`) or + * String resources (e.g, `GPU=UUID1`). + */ + GenericResources: v.exactOptional( + v.array( + v.strictObject({ + NamedResourceSpec: v.exactOptional( + v.strictObject({ + Kind: v.exactOptional(v.string()), + Value: v.exactOptional(v.string()), + }), + ), + DiscreteResourceSpec: v.exactOptional( + v.strictObject({ + Kind: v.exactOptional(v.string()), + Value: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + }), + ), + ), + }), + ), + }), + ), + /** + * Specification for the restart policy which applies to containers + * created as part of this service. + */ + RestartPolicy: v.exactOptional( + v.strictObject({ + /** + * Condition for restart. + */ + Condition: v.exactOptional(v.picklist(["none", "on-failure", "any"])), + /** + * Delay between restart attempts. + */ + Delay: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Maximum attempts to restart a given container before giving up + * (default value is 0, which is ignored). + */ + MaxAttempts: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Windows is the time window used to evaluate the restart policy + * (default value is 0, which is unbounded). + */ + Window: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + Placement: v.exactOptional( + v.strictObject({ + /** + * An array of constraint expressions to limit the set of nodes where + * a task can be scheduled. Constraint expressions can either use a + * _match_ (`==`) or _exclude_ (`!=`) rule. Multiple constraints find + * nodes that satisfy every expression (AND match). Constraints can + * match node or Docker Engine labels as follows: + * + * node attribute | matches | example + * ---------------------|--------------------------------|----------------------------------------------- + * `node.id` | Node ID | + * `node.id==2ivku8v2gvtg4` + * `node.hostname` | Node hostname | + * `node.hostname!=node-2` + * `node.role` | Node role (`manager`/`worker`) | + * `node.role==manager` + * `node.platform.os` | Node operating system | + * `node.platform.os==windows` + * `node.platform.arch` | Node architecture | + * `node.platform.arch==x86_64` + * `node.labels` | User-defined node labels | + * `node.labels.security==high` + * `engine.labels` | Docker Engine's labels | + * `engine.labels.operatingsystem==ubuntu-14.04` + * + * `engine.labels` apply to Docker Engine labels like operating system, + * drivers, etc. Swarm administrators add `node.labels` for operational + * purposes by using the [`node update endpoint`](#operation/NodeUpdate). + */ + Constraints: v.exactOptional(v.array(v.string())), + /** + * Preferences provide a way to make the scheduler aware of factors + * such as topology. They are provided in order from highest to + * lowest precedence. + */ + Preferences: v.exactOptional( + v.array( + v.strictObject({ + Spread: v.exactOptional( + v.strictObject({ + /** + * label descriptor, such as `engine.labels.az`. + */ + SpreadDescriptor: v.exactOptional(v.string()), + }), + ), + }), + ), + ), + /** + * Maximum number of replicas for per node (default value is 0, which + * is unlimited) + */ + MaxReplicas: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Platforms stores all the platforms that the service's image can + * run on. This field is used in the platform filter for scheduling. + * If empty, then the platform filter is off, meaning there are no + * scheduling restrictions. + */ + Platforms: v.exactOptional( + v.array( + v.strictObject({ + /** + * Architecture represents the hardware architecture (for example, + * `x86_64`). + */ + Architecture: v.exactOptional(v.string()), + /** + * OS represents the Operating System (for example, `linux` or `windows`). + */ + OS: v.exactOptional(v.string()), + }), + ), + ), + }), + ), + /** + * A counter that triggers an update even if no relevant parameters have + * been changed. + */ + ForceUpdate: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Runtime is the type of runtime specified for the task executor. + */ + Runtime: v.exactOptional(v.string()), + /** + * Specifies which networks the service should attach to. + */ + Networks: v.exactOptional( + v.array( + v.strictObject({ + /** + * The target network for attachment. Must be a network name or ID. + */ + Target: v.exactOptional(v.string()), + /** + * Discoverable alternate names for the service on this network. + */ + Aliases: v.exactOptional(v.array(v.string())), + /** + * Driver attachment options for the network target. + */ + DriverOpts: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + ), + /** + * Specifies the log driver to use for tasks created from this spec. If + * not present, the default one for the swarm will be used, finally + * falling back to the engine default if not specified. + */ + LogDriver: v.exactOptional( + v.strictObject({ + Name: v.exactOptional(v.string()), + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + }), + ), + /** + * Scheduling mode for the service. + */ + Mode: v.exactOptional( + v.strictObject({ + Replicated: v.exactOptional( + v.strictObject({ + Replicas: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + Global: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * The mode used for services with a finite number of tasks that run + * to a completed state. + */ + ReplicatedJob: v.exactOptional( + v.strictObject({ + /** + * The maximum number of replicas to run simultaneously. + */ + MaxConcurrent: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The total number of replicas desired to reach the Completed + * state. If unset, will default to the value of `MaxConcurrent` + */ + TotalCompletions: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * The mode used for services which run a task to the completed state + * on each valid node. + */ + GlobalJob: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + /** + * Specification for the update strategy of the service. + */ + UpdateConfig: v.exactOptional( + v.strictObject({ + /** + * Maximum number of tasks to be updated in one iteration (0 means + * unlimited parallelism). + */ + Parallelism: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Amount of time between updates, in nanoseconds. + */ + Delay: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Action to take if an updated task fails to run, or stops running + * during the update. + */ + FailureAction: v.exactOptional( + v.picklist(["continue", "pause", "rollback"]), + ), + /** + * Amount of time to monitor each updated task for failures, in + * nanoseconds. + */ + Monitor: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The fraction of tasks that may fail during an update before the + * failure action is invoked, specified as a floating point number + * between 0 and 1. + */ + MaxFailureRatio: v.exactOptional(v.number()), + /** + * The order of operations when rolling out an updated task. Either + * the old task is shut down before the new task is started, or the + * new task is started before the old task is shut down. + */ + Order: v.exactOptional(v.picklist(["stop-first", "start-first"])), + }), + ), + /** + * Specification for the rollback strategy of the service. + */ + RollbackConfig: v.exactOptional( + v.strictObject({ + /** + * Maximum number of tasks to be rolled back in one iteration (0 means + * unlimited parallelism). + */ + Parallelism: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Amount of time between rollback iterations, in nanoseconds. + */ + Delay: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Action to take if an rolled back task fails to run, or stops + * running during the rollback. + */ + FailureAction: v.exactOptional(v.picklist(["continue", "pause"])), + /** + * Amount of time to monitor each rolled back task for failures, in + * nanoseconds. + */ + Monitor: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The fraction of tasks that may fail during a rollback before the + * failure action is invoked, specified as a floating point number + * between 0 and 1. + */ + MaxFailureRatio: v.exactOptional(v.number()), + /** + * The order of operations when rolling back a task. Either the old + * task is shut down before the new task is started, or the new task + * is started before the old task is shut down. + */ + Order: v.exactOptional(v.picklist(["stop-first", "start-first"])), + }), + ), + /** + * Specifies which networks the service should attach to. + */ + Networks: v.exactOptional( + v.array( + v.strictObject({ + /** + * The target network for attachment. Must be a network name or ID. + */ + Target: v.exactOptional(v.string()), + /** + * Discoverable alternate names for the service on this network. + */ + Aliases: v.exactOptional(v.array(v.string())), + /** + * Driver attachment options for the network target. + */ + DriverOpts: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + ), + /** + * Properties that can be configured to access and load balance a service. + */ + EndpointSpec: v.exactOptional( + v.strictObject({ + /** + * The mode of resolution to use for internal load balancing between tasks. + */ + Mode: v.exactOptional(v.picklist(["vip", "dnsrr"])), + /** + * List of exposed ports that this service is accessible on from the + * outside. Ports can only be provided if `vip` resolution mode is used. + */ + Ports: v.exactOptional( + v.array( + v.strictObject({ + Name: v.exactOptional(v.string()), + Protocol: v.exactOptional(v.picklist(["tcp", "udp", "sctp"])), + /** + * The port inside the container. + */ + TargetPort: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The port on the swarm hosts. + */ + PublishedPort: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The mode in which port is published. + * + *


+ * + * - "ingress" makes the target port accessible on every node, + * + * regardless of whether there is a task for the service running on + * + * that node or not. + * - "host" bypasses the routing mesh and publish the port directly on + * + * the swarm node where that service is running. + */ + PublishMode: v.exactOptional(v.picklist(["ingress", "host"])), + }), + ), + ), + }), + ), +}); +export const endpointPortConfigSchema = v.strictObject({ + Name: v.exactOptional(v.string()), + Protocol: v.exactOptional(v.picklist(["tcp", "udp", "sctp"])), + /** + * The port inside the container. + */ + TargetPort: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The port on the swarm hosts. + */ + PublishedPort: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The mode in which port is published. + * + *


+ * + * - "ingress" makes the target port accessible on every node, + * + * regardless of whether there is a task for the service running on + * + * that node or not. + * - "host" bypasses the routing mesh and publish the port directly on + * + * the swarm node where that service is running. + */ + PublishMode: v.exactOptional(v.picklist(["ingress", "host"])), +}); +/** Properties that can be configured to access and load balance a service. */ +export const endpointSpecSchema = v.strictObject({ + /** + * The mode of resolution to use for internal load balancing between tasks. + */ + Mode: v.exactOptional(v.picklist(["vip", "dnsrr"])), + /** + * List of exposed ports that this service is accessible on from the + * outside. Ports can only be provided if `vip` resolution mode is used. + */ + Ports: v.exactOptional( + v.array( + v.strictObject({ + Name: v.exactOptional(v.string()), + Protocol: v.exactOptional(v.picklist(["tcp", "udp", "sctp"])), + /** + * The port inside the container. + */ + TargetPort: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The port on the swarm hosts. + */ + PublishedPort: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The mode in which port is published. + * + *


+ * + * - "ingress" makes the target port accessible on every node, + * + * regardless of whether there is a task for the service running on + * + * that node or not. + * - "host" bypasses the routing mesh and publish the port directly on + * + * the swarm node where that service is running. + */ + PublishMode: v.exactOptional(v.picklist(["ingress", "host"])), + }), + ), + ), +}); +export const serviceSchema = v.strictObject({ + ID: v.exactOptional(v.string()), + /** + * The version number of the object such as node, service, etc. This is needed + * to avoid conflicting writes. The client must send the version number along + * with the modified specification when updating these objects. + * + * This approach ensures safe concurrency and determinism in that the change + * on the object may not be applied if the version number has changed from the + * last read. In other words, if two update requests specify the same base + * version, only one of the requests can succeed. As a result, two separate + * update requests that happen at the same time will not unintentionally + * overwrite each other. + */ + Version: v.exactOptional( + v.strictObject({ + Index: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + CreatedAt: v.exactOptional(v.string()), + UpdatedAt: v.exactOptional(v.string()), + /** + * User modifiable configuration for a service. + */ + Spec: v.exactOptional( + v.strictObject({ + /** + * Name of the service. + */ + Name: v.exactOptional(v.string()), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * User modifiable task configuration. + */ + TaskTemplate: v.exactOptional( + v.strictObject({ + /** + * Plugin spec for the service. *(Experimental release only.)* + * + *


+ * + * > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are + * > mutually exclusive. PluginSpec is only used when the Runtime field + * > is set to `plugin`. NetworkAttachmentSpec is used when the Runtime + * > field is set to `attachment`. + */ + PluginSpec: v.exactOptional( + v.strictObject({ + /** + * The name or 'alias' to use for the plugin. + */ + Name: v.exactOptional(v.string()), + /** + * The plugin image reference to use. + */ + Remote: v.exactOptional(v.string()), + /** + * Disable the plugin once scheduled. + */ + Disabled: v.exactOptional(v.boolean()), + PluginPrivilege: v.exactOptional( + v.array( + v.strictObject({ + Name: v.exactOptional(v.string()), + Description: v.exactOptional(v.string()), + Value: v.exactOptional(v.array(v.string())), + }), + ), + ), + }), + ), + /** + * Container spec for the service. + * + *


+ * + * > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are + * > mutually exclusive. PluginSpec is only used when the Runtime field + * > is set to `plugin`. NetworkAttachmentSpec is used when the Runtime + * > field is set to `attachment`. + */ + ContainerSpec: v.exactOptional( + v.strictObject({ + /** + * The image name to use for the container + */ + Image: v.exactOptional(v.string()), + /** + * User-defined key/value data. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * The command to be run in the image. + */ + Command: v.exactOptional(v.array(v.string())), + /** + * Arguments to the command. + */ + Args: v.exactOptional(v.array(v.string())), + /** + * The hostname to use for the container, as a valid + * [RFC 1123](https://tools.ietf.org/html/rfc1123) hostname. + */ + Hostname: v.exactOptional(v.string()), + /** + * A list of environment variables in the form `VAR=value`. + */ + Env: v.exactOptional(v.array(v.string())), + /** + * The working directory for commands to run in. + */ + Dir: v.exactOptional(v.string()), + /** + * The user inside the container. + */ + User: v.exactOptional(v.string()), + /** + * A list of additional groups that the container process will run as. + */ + Groups: v.exactOptional(v.array(v.string())), + /** + * Security options for the container + */ + Privileges: v.exactOptional( + v.strictObject({ + /** + * CredentialSpec for managed service account (Windows only) + */ + CredentialSpec: v.exactOptional( + v.strictObject({ + /** + * Load credential spec from a Swarm Config with the given ID. + * The specified config must also be present in the Configs + * field with the Runtime property set. + * + *


+ * + * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + */ + Config: v.exactOptional(v.string()), + /** + * Load credential spec from this file. The file is read by + * the daemon, and must be present in the `CredentialSpecs` + * subdirectory in the docker data directory, which defaults + * to `C:\ProgramData\Docker\` on Windows. + * + * For example, specifying `spec.json` loads + * `C:\ProgramData\Docker\CredentialSpecs\spec.json`. + * + *


+ * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + */ + File: v.exactOptional(v.string()), + /** + * Load credential spec from this value in the Windows + * registry. The specified registry value must be located in: + * + * `HKLM\SOFTWARE\Microsoft\Windows + * NT\CurrentVersion\Virtualization\Containers\CredentialSpecs` + * + *


+ * + * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + */ + Registry: v.exactOptional(v.string()), + }), + ), + /** + * SELinux labels of the container + */ + SELinuxContext: v.exactOptional( + v.strictObject({ + /** + * Disable SELinux + */ + Disable: v.exactOptional(v.boolean()), + /** + * SELinux user label + */ + User: v.exactOptional(v.string()), + /** + * SELinux role label + */ + Role: v.exactOptional(v.string()), + /** + * SELinux type label + */ + Type: v.exactOptional(v.string()), + /** + * SELinux level label + */ + Level: v.exactOptional(v.string()), + }), + ), + }), + ), + /** + * Whether a pseudo-TTY should be allocated. + */ + TTY: v.exactOptional(v.boolean()), + /** + * Open `stdin` + */ + OpenStdin: v.exactOptional(v.boolean()), + /** + * Mount the container's root filesystem as read only. + */ + ReadOnly: v.exactOptional(v.boolean()), + /** + * Specification for mounts to be added to containers created as part + * of the service. + */ + Mounts: v.exactOptional( + v.array( + v.strictObject({ + /** + * Container path. + */ + Target: v.exactOptional(v.string()), + /** + * Mount source (e.g. a volume name, a host path). + */ + Source: v.exactOptional(v.string()), + /** + * The mount type. Available types: + * + * - `bind` Mounts a file or directory from the host into the container. Must + * exist prior to creating the container. + * - `volume` Creates a volume with the given name and options (or uses a + * pre-existing volume with the same name and options). These are **not** + * removed when the container is removed. + * - `tmpfs` Create a tmpfs with the given options. The mount source cannot be + * specified for tmpfs. + * - `npipe` Mounts a named pipe from the host into the container. Must exist + * prior to creating the container. + * - `cluster` a Swarm cluster volume + */ + Type: v.exactOptional( + v.picklist([ + "bind", + "volume", + "tmpfs", + "npipe", + "cluster", + ]), + ), + /** + * Whether the mount should be read-only. + */ + ReadOnly: v.exactOptional(v.boolean()), + /** + * The consistency requirement for the mount: `default`, `consistent`, + * `cached`, or `delegated`. + */ + Consistency: v.exactOptional(v.string()), + /** + * Optional configuration for the `bind` type. + */ + BindOptions: v.exactOptional( + v.strictObject({ + /** + * A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + */ + Propagation: v.exactOptional( + v.picklist([ + "private", + "rprivate", + "shared", + "rshared", + "slave", + "rslave", + ]), + ), + /** + * Disable recursive bind mount. + */ + NonRecursive: v.exactOptional(v.boolean()), + /** + * Create mount point on host if missing + */ + CreateMountpoint: v.exactOptional(v.boolean()), + }), + ), + /** + * Optional configuration for the `volume` type. + */ + VolumeOptions: v.exactOptional( + v.strictObject({ + /** + * Populate volume with data from the target. + */ + NoCopy: v.exactOptional(v.boolean()), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional( + v.record(v.string(), v.unknown()), + ), + /** + * Map of driver specific options + */ + DriverConfig: v.exactOptional( + v.strictObject({ + /** + * Name of the driver to use to create the volume. + */ + Name: v.exactOptional(v.string()), + /** + * key/value map of driver specific options. + */ + Options: v.exactOptional( + v.record(v.string(), v.unknown()), + ), + }), + ), + }), + ), + /** + * Optional configuration for the `tmpfs` type. + */ + TmpfsOptions: v.exactOptional( + v.strictObject({ + /** + * The size for the tmpfs mount in bytes. + */ + SizeBytes: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + /** + * The permission mode for the tmpfs mount in an integer. + */ + Mode: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + }), + ), + ), + /** + * Signal to stop the container. + */ + StopSignal: v.exactOptional(v.string()), + /** + * Amount of time to wait for the container to terminate before + * forcefully killing it. + */ + StopGracePeriod: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * A test to perform to check that the container is healthy. + */ + HealthCheck: v.exactOptional( + v.strictObject({ + /** + * The test to perform. Possible values are: + * + * - `[]` inherit healthcheck from image or parent image + * - `["NONE"]` disable healthcheck + * - `["CMD", args...]` exec arguments directly + * - `["CMD-SHELL", command]` run command with system's default shell + */ + Test: v.exactOptional(v.array(v.string())), + /** + * The time to wait between checks in nanoseconds. It should be 0 or at + * least 1000000 (1 ms). 0 means inherit. + */ + Interval: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The time to wait before considering the check to have hung. It should + * be 0 or at least 1000000 (1 ms). 0 means inherit. + */ + Timeout: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The number of consecutive failures needed to consider a container as + * unhealthy. 0 means inherit. + */ + Retries: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Start period for the container to initialize before starting + * health-retries countdown in nanoseconds. It should be 0 or at least + * 1000000 (1 ms). 0 means inherit. + */ + StartPeriod: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * A list of hostname/IP mappings to add to the container's `hosts` + * file. The format of extra hosts is specified in the + * [hosts(5)](http://man7.org/linux/man-pages/man5/hosts.5.html) + * man page: + * + * + * IP_address canonical_hostname [aliases...] + */ + Hosts: v.exactOptional(v.array(v.string())), + /** + * Specification for DNS related configurations in resolver configuration + * file (`resolv.conf`). + */ + DNSConfig: v.exactOptional( + v.strictObject({ + /** + * The IP addresses of the name servers. + */ + Nameservers: v.exactOptional(v.array(v.string())), + /** + * A search list for host-name lookup. + */ + Search: v.exactOptional(v.array(v.string())), + /** + * A list of internal resolver variables to be modified (e.g., + * `debug`, `ndots:3`, etc.). + */ + Options: v.exactOptional(v.array(v.string())), + }), + ), + /** + * Secrets contains references to zero or more secrets that will be + * exposed to the service. + */ + Secrets: v.exactOptional( + v.array( + v.strictObject({ + /** + * File represents a specific target that is backed by a file. + */ + File: v.exactOptional( + v.strictObject({ + /** + * Name represents the final filename in the filesystem. + */ + Name: v.exactOptional(v.string()), + /** + * UID represents the file UID. + */ + UID: v.exactOptional(v.string()), + /** + * GID represents the file GID. + */ + GID: v.exactOptional(v.string()), + /** + * Mode represents the FileMode of the file. + */ + Mode: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * SecretID represents the ID of the specific secret that we're + * referencing. + */ + SecretID: v.exactOptional(v.string()), + /** + * SecretName is the name of the secret that this references, + * but this is just provided for lookup/display purposes. The + * secret in the reference will be identified by its ID. + */ + SecretName: v.exactOptional(v.string()), + }), + ), + ), + /** + * Configs contains references to zero or more configs that will be + * exposed to the service. + */ + Configs: v.exactOptional( + v.array( + v.strictObject({ + /** + * File represents a specific target that is backed by a file. + * + *


+ * + * > **Note**: `Configs.File` and `Configs.Runtime` are mutually exclusive + */ + File: v.exactOptional( + v.strictObject({ + /** + * Name represents the final filename in the filesystem. + */ + Name: v.exactOptional(v.string()), + /** + * UID represents the file UID. + */ + UID: v.exactOptional(v.string()), + /** + * GID represents the file GID. + */ + GID: v.exactOptional(v.string()), + /** + * Mode represents the FileMode of the file. + */ + Mode: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * Runtime represents a target that is not mounted into the + * container but is used by the task + * + *


+ * + * > **Note**: `Configs.File` and `Configs.Runtime` are mutually + * > exclusive + */ + Runtime: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * ConfigID represents the ID of the specific config that we're + * referencing. + */ + ConfigID: v.exactOptional(v.string()), + /** + * ConfigName is the name of the config that this references, + * but this is just provided for lookup/display purposes. The + * config in the reference will be identified by its ID. + */ + ConfigName: v.exactOptional(v.string()), + }), + ), + ), + /** + * Isolation technology of the containers running the service. + * (Windows only) + */ + Isolation: v.exactOptional( + v.picklist(["default", "process", "hyperv", ""]), + ), + /** + * Run an init inside the container that forwards signals and reaps + * processes. This field is omitted if empty, and the default (as + * configured on the daemon) is used. + */ + Init: v.exactOptional(v.nullable(v.boolean())), + /** + * Set kernel namedspaced parameters (sysctls) in the container. + * The Sysctls option on services accepts the same sysctls as the + * are supported on containers. Note that while the same sysctls are + * supported, no guarantees or checks are made about their + * suitability for a clustered environment, and it's up to the user + * to determine whether a given sysctl will work properly in a + * Service. + */ + Sysctls: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * A list of kernel capabilities to add to the default set + * for the container. + */ + CapabilityAdd: v.exactOptional(v.array(v.string())), + /** + * A list of kernel capabilities to drop from the default set + * for the container. + */ + CapabilityDrop: v.exactOptional(v.array(v.string())), + /** + * A list of resource limits to set in the container. For example: `{"Name": + * "nofile", "Soft": 1024, "Hard": 2048}`" + */ + Ulimits: v.exactOptional( + v.array( + v.strictObject({ + /** + * Name of ulimit + */ + Name: v.exactOptional(v.string()), + /** + * Soft limit + */ + Soft: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Hard limit + */ + Hard: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + ), + }), + ), + /** + * Read-only spec type for non-swarm containers attached to swarm overlay + * networks. + * + *


+ * + * > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are + * > mutually exclusive. PluginSpec is only used when the Runtime field + * > is set to `plugin`. NetworkAttachmentSpec is used when the Runtime + * > field is set to `attachment`. + */ + NetworkAttachmentSpec: v.exactOptional( + v.strictObject({ + /** + * ID of the container represented by this task + */ + ContainerID: v.exactOptional(v.string()), + }), + ), + /** + * Resource requirements which apply to each individual container created + * as part of the service. + */ + Resources: v.exactOptional( + v.strictObject({ + /** + * An object describing a limit on resources which can be requested by a task. + */ + Limits: v.exactOptional( + v.strictObject({ + NanoCPUs: v.exactOptional(v.pipe(v.number(), v.integer())), + MemoryBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Limits the maximum number of PIDs in the container. Set `0` for unlimited. + */ + Pids: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * An object describing the resources which can be advertised by a node and + * requested by a task. + */ + Reservations: v.exactOptional( + v.strictObject({ + NanoCPUs: v.exactOptional(v.pipe(v.number(), v.integer())), + MemoryBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * User-defined resources can be either Integer resources (e.g, `SSD=3`) or + * String resources (e.g, `GPU=UUID1`). + */ + GenericResources: v.exactOptional( + v.array( + v.strictObject({ + NamedResourceSpec: v.exactOptional( + v.strictObject({ + Kind: v.exactOptional(v.string()), + Value: v.exactOptional(v.string()), + }), + ), + DiscreteResourceSpec: v.exactOptional( + v.strictObject({ + Kind: v.exactOptional(v.string()), + Value: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + }), + ), + }), + ), + ), + }), + ), + }), + ), + /** + * Specification for the restart policy which applies to containers + * created as part of this service. + */ + RestartPolicy: v.exactOptional( + v.strictObject({ + /** + * Condition for restart. + */ + Condition: v.exactOptional( + v.picklist(["none", "on-failure", "any"]), + ), + /** + * Delay between restart attempts. + */ + Delay: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Maximum attempts to restart a given container before giving up + * (default value is 0, which is ignored). + */ + MaxAttempts: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Windows is the time window used to evaluate the restart policy + * (default value is 0, which is unbounded). + */ + Window: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + Placement: v.exactOptional( + v.strictObject({ + /** + * An array of constraint expressions to limit the set of nodes where + * a task can be scheduled. Constraint expressions can either use a + * _match_ (`==`) or _exclude_ (`!=`) rule. Multiple constraints find + * nodes that satisfy every expression (AND match). Constraints can + * match node or Docker Engine labels as follows: + * + * node attribute | matches | example + * ---------------------|--------------------------------|----------------------------------------------- + * `node.id` | Node ID | + * `node.id==2ivku8v2gvtg4` + * `node.hostname` | Node hostname | + * `node.hostname!=node-2` + * `node.role` | Node role (`manager`/`worker`) | + * `node.role==manager` + * `node.platform.os` | Node operating system | + * `node.platform.os==windows` + * `node.platform.arch` | Node architecture | + * `node.platform.arch==x86_64` + * `node.labels` | User-defined node labels | + * `node.labels.security==high` + * `engine.labels` | Docker Engine's labels | + * `engine.labels.operatingsystem==ubuntu-14.04` + * + * `engine.labels` apply to Docker Engine labels like operating system, + * drivers, etc. Swarm administrators add `node.labels` for operational + * purposes by using the [`node update endpoint`](#operation/NodeUpdate). + */ + Constraints: v.exactOptional(v.array(v.string())), + /** + * Preferences provide a way to make the scheduler aware of factors + * such as topology. They are provided in order from highest to + * lowest precedence. + */ + Preferences: v.exactOptional( + v.array( + v.strictObject({ + Spread: v.exactOptional( + v.strictObject({ + /** + * label descriptor, such as `engine.labels.az`. + */ + SpreadDescriptor: v.exactOptional(v.string()), + }), + ), + }), + ), + ), + /** + * Maximum number of replicas for per node (default value is 0, which + * is unlimited) + */ + MaxReplicas: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Platforms stores all the platforms that the service's image can + * run on. This field is used in the platform filter for scheduling. + * If empty, then the platform filter is off, meaning there are no + * scheduling restrictions. + */ + Platforms: v.exactOptional( + v.array( + v.strictObject({ + /** + * Architecture represents the hardware architecture (for example, + * `x86_64`). + */ + Architecture: v.exactOptional(v.string()), + /** + * OS represents the Operating System (for example, `linux` or `windows`). + */ + OS: v.exactOptional(v.string()), + }), + ), + ), + }), + ), + /** + * A counter that triggers an update even if no relevant parameters have + * been changed. + */ + ForceUpdate: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Runtime is the type of runtime specified for the task executor. + */ + Runtime: v.exactOptional(v.string()), + /** + * Specifies which networks the service should attach to. + */ + Networks: v.exactOptional( + v.array( + v.strictObject({ + /** + * The target network for attachment. Must be a network name or ID. + */ + Target: v.exactOptional(v.string()), + /** + * Discoverable alternate names for the service on this network. + */ + Aliases: v.exactOptional(v.array(v.string())), + /** + * Driver attachment options for the network target. + */ + DriverOpts: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + ), + /** + * Specifies the log driver to use for tasks created from this spec. If + * not present, the default one for the swarm will be used, finally + * falling back to the engine default if not specified. + */ + LogDriver: v.exactOptional( + v.strictObject({ + Name: v.exactOptional(v.string()), + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + }), + ), + /** + * Scheduling mode for the service. + */ + Mode: v.exactOptional( + v.strictObject({ + Replicated: v.exactOptional( + v.strictObject({ + Replicas: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + Global: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * The mode used for services with a finite number of tasks that run + * to a completed state. + */ + ReplicatedJob: v.exactOptional( + v.strictObject({ + /** + * The maximum number of replicas to run simultaneously. + */ + MaxConcurrent: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The total number of replicas desired to reach the Completed + * state. If unset, will default to the value of `MaxConcurrent` + */ + TotalCompletions: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + }), + ), + /** + * The mode used for services which run a task to the completed state + * on each valid node. + */ + GlobalJob: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + /** + * Specification for the update strategy of the service. + */ + UpdateConfig: v.exactOptional( + v.strictObject({ + /** + * Maximum number of tasks to be updated in one iteration (0 means + * unlimited parallelism). + */ + Parallelism: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Amount of time between updates, in nanoseconds. + */ + Delay: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Action to take if an updated task fails to run, or stops running + * during the update. + */ + FailureAction: v.exactOptional( + v.picklist(["continue", "pause", "rollback"]), + ), + /** + * Amount of time to monitor each updated task for failures, in + * nanoseconds. + */ + Monitor: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The fraction of tasks that may fail during an update before the + * failure action is invoked, specified as a floating point number + * between 0 and 1. + */ + MaxFailureRatio: v.exactOptional(v.number()), + /** + * The order of operations when rolling out an updated task. Either + * the old task is shut down before the new task is started, or the + * new task is started before the old task is shut down. + */ + Order: v.exactOptional(v.picklist(["stop-first", "start-first"])), + }), + ), + /** + * Specification for the rollback strategy of the service. + */ + RollbackConfig: v.exactOptional( + v.strictObject({ + /** + * Maximum number of tasks to be rolled back in one iteration (0 means + * unlimited parallelism). + */ + Parallelism: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Amount of time between rollback iterations, in nanoseconds. + */ + Delay: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Action to take if an rolled back task fails to run, or stops + * running during the rollback. + */ + FailureAction: v.exactOptional(v.picklist(["continue", "pause"])), + /** + * Amount of time to monitor each rolled back task for failures, in + * nanoseconds. + */ + Monitor: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The fraction of tasks that may fail during a rollback before the + * failure action is invoked, specified as a floating point number + * between 0 and 1. + */ + MaxFailureRatio: v.exactOptional(v.number()), + /** + * The order of operations when rolling back a task. Either the old + * task is shut down before the new task is started, or the new task + * is started before the old task is shut down. + */ + Order: v.exactOptional(v.picklist(["stop-first", "start-first"])), + }), + ), + /** + * Specifies which networks the service should attach to. + */ + Networks: v.exactOptional( + v.array( + v.strictObject({ + /** + * The target network for attachment. Must be a network name or ID. + */ + Target: v.exactOptional(v.string()), + /** + * Discoverable alternate names for the service on this network. + */ + Aliases: v.exactOptional(v.array(v.string())), + /** + * Driver attachment options for the network target. + */ + DriverOpts: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + ), + /** + * Properties that can be configured to access and load balance a service. + */ + EndpointSpec: v.exactOptional( + v.strictObject({ + /** + * The mode of resolution to use for internal load balancing between tasks. + */ + Mode: v.exactOptional(v.picklist(["vip", "dnsrr"])), + /** + * List of exposed ports that this service is accessible on from the + * outside. Ports can only be provided if `vip` resolution mode is used. + */ + Ports: v.exactOptional( + v.array( + v.strictObject({ + Name: v.exactOptional(v.string()), + Protocol: v.exactOptional(v.picklist(["tcp", "udp", "sctp"])), + /** + * The port inside the container. + */ + TargetPort: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The port on the swarm hosts. + */ + PublishedPort: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The mode in which port is published. + * + *


+ * + * - "ingress" makes the target port accessible on every node, + * + * regardless of whether there is a task for the service running on + * + * that node or not. + * - "host" bypasses the routing mesh and publish the port directly on + * + * the swarm node where that service is running. + */ + PublishMode: v.exactOptional(v.picklist(["ingress", "host"])), + }), + ), + ), + }), + ), + }), + ), + Endpoint: v.exactOptional( + v.strictObject({ + /** + * Properties that can be configured to access and load balance a service. + */ + Spec: v.exactOptional( + v.strictObject({ + /** + * The mode of resolution to use for internal load balancing between tasks. + */ + Mode: v.exactOptional(v.picklist(["vip", "dnsrr"])), + /** + * List of exposed ports that this service is accessible on from the + * outside. Ports can only be provided if `vip` resolution mode is used. + */ + Ports: v.exactOptional( + v.array( + v.strictObject({ + Name: v.exactOptional(v.string()), + Protocol: v.exactOptional(v.picklist(["tcp", "udp", "sctp"])), + /** + * The port inside the container. + */ + TargetPort: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The port on the swarm hosts. + */ + PublishedPort: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The mode in which port is published. + * + *


+ * + * - "ingress" makes the target port accessible on every node, + * + * regardless of whether there is a task for the service running on + * + * that node or not. + * - "host" bypasses the routing mesh and publish the port directly on + * + * the swarm node where that service is running. + */ + PublishMode: v.exactOptional(v.picklist(["ingress", "host"])), + }), + ), + ), + }), + ), + Ports: v.exactOptional( + v.array( + v.strictObject({ + Name: v.exactOptional(v.string()), + Protocol: v.exactOptional(v.picklist(["tcp", "udp", "sctp"])), + /** + * The port inside the container. + */ + TargetPort: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The port on the swarm hosts. + */ + PublishedPort: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The mode in which port is published. + * + *


+ * + * - "ingress" makes the target port accessible on every node, + * + * regardless of whether there is a task for the service running on + * + * that node or not. + * - "host" bypasses the routing mesh and publish the port directly on + * + * the swarm node where that service is running. + */ + PublishMode: v.exactOptional(v.picklist(["ingress", "host"])), + }), + ), + ), + VirtualIPs: v.exactOptional( + v.array( + v.strictObject({ + NetworkID: v.exactOptional(v.string()), + Addr: v.exactOptional(v.string()), + }), + ), + ), + }), + ), + /** + * The status of a service update. + */ + UpdateStatus: v.exactOptional( + v.strictObject({ + State: v.exactOptional(v.picklist(["updating", "paused", "completed"])), + StartedAt: v.exactOptional(v.string()), + CompletedAt: v.exactOptional(v.string()), + Message: v.exactOptional(v.string()), + }), + ), + /** + * The status of the service's tasks. Provided only when requested as + * part of a ServiceList operation. + */ + ServiceStatus: v.exactOptional( + v.strictObject({ + /** + * The number of tasks for the service currently in the Running state. + */ + RunningTasks: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The number of tasks for the service desired to be running. + * For replicated services, this is the replica count from the + * service spec. For global services, this is computed by taking + * count of all tasks for the service with a Desired State other + * than Shutdown. + */ + DesiredTasks: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The number of tasks for a job that are in the Completed state. + * This field must be cross-referenced with the service type, as the + * value of 0 may mean the service is not in a job mode, or it may + * mean the job-mode service has no tasks yet Completed. + */ + CompletedTasks: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * The status of the service when it is in one of ReplicatedJob or + * GlobalJob modes. Absent on Replicated and Global mode services. The + * JobIteration is an ObjectVersion, but unlike the Service's version, + * does not need to be sent with an update request. + */ + JobStatus: v.exactOptional( + v.strictObject({ + /** + * The version number of the object such as node, service, etc. This is needed + * to avoid conflicting writes. The client must send the version number along + * with the modified specification when updating these objects. + * + * This approach ensures safe concurrency and determinism in that the change + * on the object may not be applied if the version number has changed from the + * last read. In other words, if two update requests specify the same base + * version, only one of the requests can succeed. As a result, two separate + * update requests that happen at the same time will not unintentionally + * overwrite each other. + */ + JobIteration: v.exactOptional( + v.strictObject({ + Index: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * The last time, as observed by the server, that this job was + * started. + */ + LastExecution: v.exactOptional(v.string()), + }), + ), +}); +export const imageDeleteResponseItemSchema = v.strictObject({ + /** + * The image ID of an image that was untagged + */ + Untagged: v.exactOptional(v.string()), + /** + * The image ID of an image that was deleted + */ + Deleted: v.exactOptional(v.string()), +}); +export const serviceUpdateResponseSchema = v.strictObject({ + /** + * Optional warning messages + */ + Warnings: v.exactOptional(v.array(v.string())), +}); +export const containerSummarySchema = v.strictObject({ + /** + * The ID of this container + */ + Id: v.exactOptional(v.string()), + /** + * The names that this container has been given + */ + Names: v.exactOptional(v.array(v.string())), + /** + * The name of the image used when creating this container + */ + Image: v.exactOptional(v.string()), + /** + * The ID of the image that this container was created from + */ + ImageID: v.exactOptional(v.string()), + /** + * Command to run when starting the container + */ + Command: v.exactOptional(v.string()), + /** + * When the container was created + */ + Created: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The ports exposed by this container + */ + Ports: v.exactOptional( + v.array( + v.strictObject({ + /** + * Host IP address that the container's port is mapped to + */ + IP: v.exactOptional(v.string()), + /** + * Port on the container + */ + PrivatePort: v.pipe(v.number(), v.integer()), + /** + * Port exposed on the host + */ + PublicPort: v.exactOptional(v.pipe(v.number(), v.integer())), + Type: v.picklist(["tcp", "udp", "sctp"]), + }), + ), + ), + /** + * The size of files that have been created or changed by this container + */ + SizeRw: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The total size of all the files in this container + */ + SizeRootFs: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * The state of this container (e.g. `Exited`) + */ + State: v.exactOptional(v.string()), + /** + * Additional human-readable status of this container (e.g. `Exit 0`) + */ + Status: v.exactOptional(v.string()), + HostConfig: v.exactOptional( + v.strictObject({ + NetworkMode: v.exactOptional(v.string()), + }), + ), + /** + * A summary of the container's network settings + */ + NetworkSettings: v.exactOptional( + v.strictObject({ + Networks: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + Mounts: v.exactOptional( + v.array( + v.strictObject({ + /** + * The mount type: + * + * - `bind` a mount of a file or directory from the host into the container. + * - `volume` a docker volume with the given `Name`. + * - `tmpfs` a `tmpfs`. + * - `npipe` a named pipe from the host into the container. + * - `cluster` a Swarm cluster volume + */ + Type: v.exactOptional( + v.picklist(["bind", "volume", "tmpfs", "npipe", "cluster"]), + ), + /** + * Name is the name reference to the underlying data defined by `Source` + * e.g., the volume name. + */ + Name: v.exactOptional(v.string()), + /** + * Source location of the mount. + * + * For volumes, this contains the storage location of the volume (within + * `/var/lib/docker/volumes/`). For bind-mounts, and `npipe`, this contains + * the source (host) part of the bind-mount. For `tmpfs` mount points, this + * field is empty. + */ + Source: v.exactOptional(v.string()), + /** + * Destination is the path relative to the container root (`/`) where + * the `Source` is mounted inside the container. + */ + Destination: v.exactOptional(v.string()), + /** + * Driver is the volume driver used to create the volume (if it is a volume). + */ + Driver: v.exactOptional(v.string()), + /** + * Mode is a comma separated list of options supplied by the user when + * creating the bind/volume mount. + * + * The default is platform-specific (`"z"` on Linux, empty on Windows). + */ + Mode: v.exactOptional(v.string()), + /** + * Whether the mount is mounted writable (read-write). + */ + RW: v.exactOptional(v.boolean()), + /** + * Propagation describes how mounts are propagated from the host into the + * mount point, and vice-versa. Refer to the [Linux kernel + * documentation](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt) + * for details. This field is not used on Windows. + */ + Propagation: v.exactOptional(v.string()), + }), + ), + ), +}); +/** Driver represents a driver (network, logging, secrets). */ +export const driverSchema = v.strictObject({ + /** + * Name of the driver. + */ + Name: v.string(), + /** + * Key/value map of driver-specific options. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), +}); +export const secretSpecSchema = v.strictObject({ + /** + * User-defined name of the secret. + */ + Name: v.exactOptional(v.string()), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Base64-url-safe-encoded ([RFC + * 4648](https://tools.ietf.org/html/rfc4648#section-5)) + * data to store as secret. + * + * This field is only used to _create_ a secret, and is not returned by + * other endpoints. + */ + Data: v.exactOptional(v.string()), + /** + * Driver represents a driver (network, logging, secrets). + */ + Driver: v.exactOptional( + v.strictObject({ + /** + * Name of the driver. + */ + Name: v.string(), + /** + * Key/value map of driver-specific options. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + /** + * Driver represents a driver (network, logging, secrets). + */ + Templating: v.exactOptional( + v.strictObject({ + /** + * Name of the driver. + */ + Name: v.string(), + /** + * Key/value map of driver-specific options. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), +}); +export const secretSchema = v.strictObject({ + ID: v.exactOptional(v.string()), + /** + * The version number of the object such as node, service, etc. This is needed + * to avoid conflicting writes. The client must send the version number along + * with the modified specification when updating these objects. + * + * This approach ensures safe concurrency and determinism in that the change + * on the object may not be applied if the version number has changed from the + * last read. In other words, if two update requests specify the same base + * version, only one of the requests can succeed. As a result, two separate + * update requests that happen at the same time will not unintentionally + * overwrite each other. + */ + Version: v.exactOptional( + v.strictObject({ + Index: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + CreatedAt: v.exactOptional(v.string()), + UpdatedAt: v.exactOptional(v.string()), + Spec: v.exactOptional( + v.strictObject({ + /** + * User-defined name of the secret. + */ + Name: v.exactOptional(v.string()), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Base64-url-safe-encoded ([RFC + * 4648](https://tools.ietf.org/html/rfc4648#section-5)) + * data to store as secret. + * + * This field is only used to _create_ a secret, and is not returned by + * other endpoints. + */ + Data: v.exactOptional(v.string()), + /** + * Driver represents a driver (network, logging, secrets). + */ + Driver: v.exactOptional( + v.strictObject({ + /** + * Name of the driver. + */ + Name: v.string(), + /** + * Key/value map of driver-specific options. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + /** + * Driver represents a driver (network, logging, secrets). + */ + Templating: v.exactOptional( + v.strictObject({ + /** + * Name of the driver. + */ + Name: v.string(), + /** + * Key/value map of driver-specific options. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + }), + ), +}); +export const configSpecSchema = v.strictObject({ + /** + * User-defined name of the config. + */ + Name: v.exactOptional(v.string()), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Base64-url-safe-encoded ([RFC + * 4648](https://tools.ietf.org/html/rfc4648#section-5)) + * config data. + */ + Data: v.exactOptional(v.string()), + /** + * Driver represents a driver (network, logging, secrets). + */ + Templating: v.exactOptional( + v.strictObject({ + /** + * Name of the driver. + */ + Name: v.string(), + /** + * Key/value map of driver-specific options. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), +}); +export const configSchema = v.strictObject({ + ID: v.exactOptional(v.string()), + /** + * The version number of the object such as node, service, etc. This is needed + * to avoid conflicting writes. The client must send the version number along + * with the modified specification when updating these objects. + * + * This approach ensures safe concurrency and determinism in that the change + * on the object may not be applied if the version number has changed from the + * last read. In other words, if two update requests specify the same base + * version, only one of the requests can succeed. As a result, two separate + * update requests that happen at the same time will not unintentionally + * overwrite each other. + */ + Version: v.exactOptional( + v.strictObject({ + Index: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + CreatedAt: v.exactOptional(v.string()), + UpdatedAt: v.exactOptional(v.string()), + Spec: v.exactOptional( + v.strictObject({ + /** + * User-defined name of the config. + */ + Name: v.exactOptional(v.string()), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Base64-url-safe-encoded ([RFC + * 4648](https://tools.ietf.org/html/rfc4648#section-5)) + * config data. + */ + Data: v.exactOptional(v.string()), + /** + * Driver represents a driver (network, logging, secrets). + */ + Templating: v.exactOptional( + v.strictObject({ + /** + * Name of the driver. + */ + Name: v.string(), + /** + * Key/value map of driver-specific options. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + }), + ), +}); +/** + * ContainerState stores container's running state. It's part of + * ContainerJSONBase + * and will be returned by the "inspect" command. + */ +export const containerStateSchema = v.nullable( + v.strictObject({ + /** + * String representation of the container state. Can be one of "created", + * "running", "paused", "restarting", "removing", "exited", or "dead". + */ + Status: v.exactOptional( + v.picklist([ + "created", + "running", + "paused", + "restarting", + "removing", + "exited", + "dead", + ]), + ), + /** + * Whether this container is running. + * + * Note that a running container can be _paused_. The `Running` and `Paused` + * booleans are not mutually exclusive: + * + * When pausing a container (on Linux), the freezer cgroup is used to suspend + * all processes in the container. Freezing the process requires the process + * to + * be running. As a result, paused containers are both `Running` _and_ + * `Paused`. + * + * Use the `Status` field instead to determine if a container's state is + * "running". + */ + Running: v.exactOptional(v.boolean()), + /** + * Whether this container is paused. + */ + Paused: v.exactOptional(v.boolean()), + /** + * Whether this container is restarting. + */ + Restarting: v.exactOptional(v.boolean()), + /** + * Whether a process within this container has been killed because it ran + * out of memory since the container was last started. + */ + OOMKilled: v.exactOptional(v.boolean()), + Dead: v.exactOptional(v.boolean()), + /** + * The process ID of this container + */ + Pid: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The last exit code of this container + */ + ExitCode: v.exactOptional(v.pipe(v.number(), v.integer())), + Error: v.exactOptional(v.string()), + /** + * The time when this container was last started. + */ + StartedAt: v.exactOptional(v.string()), + /** + * The time when this container last exited. + */ + FinishedAt: v.exactOptional(v.string()), + /** + * Health stores information about the container's healthcheck results. + */ + Health: v.exactOptional( + v.nullable( + v.strictObject({ + /** + * Status is one of `none`, `starting`, `healthy` or `unhealthy` + * + * - "none" Indicates there is no healthcheck + * - "starting" Starting indicates that the container is not yet ready + * - "healthy" Healthy indicates that the container is running correctly + * - "unhealthy" Unhealthy indicates that the container has a problem + */ + Status: v.exactOptional( + v.picklist(["none", "starting", "healthy", "unhealthy"]), + ), + /** + * FailingStreak is the number of consecutive failures + */ + FailingStreak: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Log contains the last few results (oldest first) + */ + Log: v.exactOptional( + v.array( + v.nullable( + v.strictObject({ + /** + * Date and time at which this check started in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + */ + Start: v.exactOptional(v.string()), + /** + * Date and time at which this check ended in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + */ + End: v.exactOptional(v.string()), + /** + * ExitCode meanings: + * + * - `0` healthy + * - `1` unhealthy + * - `2` reserved (considered unhealthy) + * - other values: error running probe + */ + ExitCode: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Output from last check + */ + Output: v.exactOptional(v.string()), + }), + ), + ), + ), + }), + ), + ), + }), +); +/** + * OK response to ContainerCreate operation + * @title ContainerCreateResponse + */ +export const containerCreateResponseSchema = v.strictObject({ + /** + * The ID of the created container + */ + Id: v.string(), + /** + * Warnings encountered when creating the container + */ + Warnings: v.array(v.string()), +}); +/** + * OK response to ContainerWait operation + * @title ContainerWaitResponse + */ +export const containerWaitResponseSchema = v.strictObject({ + /** + * Exit code of the container + */ + StatusCode: v.pipe(v.number(), v.integer()), + /** + * container waiting error, if any + */ + Error: v.exactOptional( + v.strictObject({ + /** + * Details of an error + */ + Message: v.exactOptional(v.string()), + }), + ), +}); +/** container waiting error, if any */ +export const containerWaitExitErrorSchema = v.strictObject({ + /** + * Details of an error + */ + Message: v.exactOptional(v.string()), +}); +/** Response of Engine API: GET "/version" */ +export const systemVersionSchema = v.strictObject({ + Platform: v.exactOptional( + v.strictObject({ + Name: v.string(), + }), + ), + /** + * Information about system components + */ + Components: v.exactOptional( + v.array( + v.strictObject({ + /** + * Name of the component + */ + Name: v.string(), + /** + * Version of the component + */ + Version: v.string(), + /** + * Key/value pairs of strings with additional information about the + * component. These values are intended for informational purposes + * only, and their content is not defined, and not part of the API + * specification. + * + * These messages can be printed by the client as information to the user. + */ + Details: v.exactOptional(v.nullable(v.record(v.string(), v.unknown()))), + }), + ), + ), + /** + * The version of the daemon + */ + Version: v.exactOptional(v.string()), + /** + * The default (and highest) API version that is supported by the daemon + */ + ApiVersion: v.exactOptional(v.string()), + /** + * The minimum API version that is supported by the daemon + */ + MinAPIVersion: v.exactOptional(v.string()), + /** + * The Git commit of the source code that was used to build the daemon + */ + GitCommit: v.exactOptional(v.string()), + /** + * The version Go used to compile the daemon, and the version of the Go + * runtime in use. + */ + GoVersion: v.exactOptional(v.string()), + /** + * The operating system that the daemon is running on ("linux" or "windows") + */ + Os: v.exactOptional(v.string()), + /** + * The architecture that the daemon is running on + */ + Arch: v.exactOptional(v.string()), + /** + * The kernel version (`uname -r`) that the daemon is running on. + * + * This field is omitted when empty. + */ + KernelVersion: v.exactOptional(v.string()), + /** + * Indicates if the daemon is started with experimental features enabled. + * + * This field is omitted when empty / false. + */ + Experimental: v.exactOptional(v.boolean()), + /** + * The date and time that the daemon was compiled. + */ + BuildTime: v.exactOptional(v.string()), +}); +export const systemInfoSchema = v.strictObject({ + /** + * Unique identifier of the daemon. + * + *


+ * + * > **Note**: The format of the ID itself is not part of the API, and + * > should not be considered stable. + */ + ID: v.exactOptional(v.string()), + /** + * Total number of containers on the host. + */ + Containers: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Number of containers with status `"running"`. + */ + ContainersRunning: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Number of containers with status `"paused"`. + */ + ContainersPaused: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Number of containers with status `"stopped"`. + */ + ContainersStopped: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Total number of images on the host. + * + * Both _tagged_ and _untagged_ (dangling) images are counted. + */ + Images: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Name of the storage driver in use. + */ + Driver: v.exactOptional(v.string()), + /** + * Information specific to the storage driver, provided as + * "label" / "value" pairs. + * + * This information is provided by the storage driver, and formatted + * in a way consistent with the output of `docker info` on the command + * line. + * + *


+ * + * > **Note**: The information returned in this field, including the + * > formatting of values and labels, should not be considered stable, + * > and may change without notice. + */ + DriverStatus: v.exactOptional(v.array(v.array(v.string()))), + /** + * Root directory of persistent Docker state. + * + * Defaults to `/var/lib/docker` on Linux, and `C:\ProgramData\docker` + * on Windows. + */ + DockerRootDir: v.exactOptional(v.string()), + /** + * Available plugins per type. + * + *


+ * + * > **Note**: Only unmanaged (V1) plugins are included in this list. + * > V1 plugins are "lazily" loaded, and are not returned in this list + * > if there is no resource using the plugin. + */ + Plugins: v.exactOptional( + v.strictObject({ + /** + * Names of available volume-drivers, and network-driver plugins. + */ + Volume: v.exactOptional(v.array(v.string())), + /** + * Names of available network-drivers, and network-driver plugins. + */ + Network: v.exactOptional(v.array(v.string())), + /** + * Names of available authorization plugins. + */ + Authorization: v.exactOptional(v.array(v.string())), + /** + * Names of available logging-drivers, and logging-driver plugins. + */ + Log: v.exactOptional(v.array(v.string())), + }), + ), + /** + * Indicates if the host has memory limit support enabled. + */ + MemoryLimit: v.exactOptional(v.boolean()), + /** + * Indicates if the host has memory swap limit support enabled. + */ + SwapLimit: v.exactOptional(v.boolean()), + /** + * Indicates if the host has kernel memory TCP limit support enabled. This + * field is omitted if not supported. + * + * Kernel memory TCP limits are not supported when using cgroups v2, which + * does not support the corresponding `memory.kmem.tcp.limit_in_bytes` cgroup. + */ + KernelMemoryTCP: v.exactOptional(v.boolean()), + /** + * Indicates if CPU CFS(Completely Fair Scheduler) period is supported by + * the host. + */ + CpuCfsPeriod: v.exactOptional(v.boolean()), + /** + * Indicates if CPU CFS(Completely Fair Scheduler) quota is supported by + * the host. + */ + CpuCfsQuota: v.exactOptional(v.boolean()), + /** + * Indicates if CPU Shares limiting is supported by the host. + */ + CPUShares: v.exactOptional(v.boolean()), + /** + * Indicates if CPUsets (cpuset.cpus, cpuset.mems) are supported by the host. + * + * See + * [cpuset(7)](https://www.kernel.org/doc/Documentation/cgroup-v1/cpusets.txt) + */ + CPUSet: v.exactOptional(v.boolean()), + /** + * Indicates if the host kernel has PID limit support enabled. + */ + PidsLimit: v.exactOptional(v.boolean()), + /** + * Indicates if OOM killer disable is supported on the host. + */ + OomKillDisable: v.exactOptional(v.boolean()), + /** + * Indicates IPv4 forwarding is enabled. + */ + IPv4Forwarding: v.exactOptional(v.boolean()), + /** + * Indicates if `bridge-nf-call-iptables` is available on the host. + */ + BridgeNfIptables: v.exactOptional(v.boolean()), + /** + * Indicates if `bridge-nf-call-ip6tables` is available on the host. + */ + BridgeNfIp6tables: v.exactOptional(v.boolean()), + /** + * Indicates if the daemon is running in debug-mode / with debug-level + * logging enabled. + */ + Debug: v.exactOptional(v.boolean()), + /** + * The total number of file Descriptors in use by the daemon process. + * + * This information is only returned if debug-mode is enabled. + */ + NFd: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The number of goroutines that currently exist. + * + * This information is only returned if debug-mode is enabled. + */ + NGoroutines: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Current system-time in [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) + * format with nano-seconds. + */ + SystemTime: v.exactOptional(v.string()), + /** + * The logging driver to use as a default for new containers. + */ + LoggingDriver: v.exactOptional(v.string()), + /** + * The driver to use for managing cgroups. + */ + CgroupDriver: v.exactOptional(v.picklist(["cgroupfs", "systemd", "none"])), + /** + * The version of the cgroup. + */ + CgroupVersion: v.exactOptional(v.picklist(["1", "2"])), + /** + * Number of event listeners subscribed. + */ + NEventsListener: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Kernel version of the host. + * + * On Linux, this information obtained from `uname`. On Windows this + * information is queried from the + * HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows + * NT\\CurrentVersion\\ + * registry value, for example _"10.0 14393 + * (14393.1198.amd64fre.rs1_release_sec.170427-1353)"_. + */ + KernelVersion: v.exactOptional(v.string()), + /** + * Name of the host's operating system, for example: "Ubuntu 16.04.2 LTS" + * or "Windows Server 2016 Datacenter" + */ + OperatingSystem: v.exactOptional(v.string()), + /** + * Version of the host's operating system + * + *


+ * + * > **Note**: The information returned in this field, including its + * > very existence, and the formatting of values, should not be considered + * > stable, and may change without notice. + */ + OSVersion: v.exactOptional(v.string()), + /** + * Generic type of the operating system of the host, as returned by the + * Go runtime (`GOOS`). + * + * Currently returned values are "linux" and "windows". A full list of + * possible values can be found in the [Go + * documentation](https://go.dev/doc/install/source#environment). + */ + OSType: v.exactOptional(v.string()), + /** + * Hardware architecture of the host, as returned by the Go runtime + * (`GOARCH`). + * + * A full list of possible values can be found in the [Go + * documentation](https://go.dev/doc/install/source#environment). + */ + Architecture: v.exactOptional(v.string()), + /** + * The number of logical CPUs usable by the daemon. + * + * The number of available CPUs is checked by querying the operating + * system when the daemon starts. Changes to operating system CPU + * allocation after the daemon is started are not reflected. + */ + NCPU: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Total amount of physical memory available on the host, in bytes. + */ + MemTotal: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Address / URL of the index server that is used for image search, + * and as a default for user authentication for Docker Hub and Docker Cloud. + */ + IndexServerAddress: v.exactOptional(v.string()), + /** + * RegistryServiceConfig stores daemon registry services configuration. + */ + RegistryConfig: v.exactOptional( + v.nullable( + v.strictObject({ + /** + * List of IP ranges to which nondistributable artifacts can be pushed, + * using the CIDR syntax [RFC 4632](https://tools.ietf.org/html/4632). + * + * Some images (for example, Windows base images) contain artifacts + * whose distribution is restricted by license. When these images are + * pushed to a registry, restricted artifacts are not included. + * + * This configuration override this behavior, and enables the daemon to + * push nondistributable artifacts to all registries whose resolved IP + * address is within the subnet described by the CIDR syntax. + * + * This option is useful when pushing images containing + * nondistributable artifacts to a registry on an air-gapped network so + * hosts on that network can pull the images without connecting to + * another server. + * + * > **Warning**: Nondistributable artifacts typically have restrictions + * > on how and where they can be distributed and shared. Only use this + * > feature to push artifacts to private registries and ensure that you + * > are in compliance with any terms that cover redistributing + * > nondistributable artifacts. + */ + AllowNondistributableArtifactsCIDRs: v.exactOptional( + v.array(v.string()), + ), + /** + * List of registry hostnames to which nondistributable artifacts can be + * pushed, using the format `[:]` or `[:]`. + * + * Some images (for example, Windows base images) contain artifacts + * whose distribution is restricted by license. When these images are + * pushed to a registry, restricted artifacts are not included. + * + * This configuration override this behavior for the specified + * registries. + * + * This option is useful when pushing images containing + * nondistributable artifacts to a registry on an air-gapped network so + * hosts on that network can pull the images without connecting to + * another server. + * + * > **Warning**: Nondistributable artifacts typically have restrictions + * > on how and where they can be distributed and shared. Only use this + * > feature to push artifacts to private registries and ensure that you + * > are in compliance with any terms that cover redistributing + * > nondistributable artifacts. + */ + AllowNondistributableArtifactsHostnames: v.exactOptional( + v.array(v.string()), + ), + /** + * List of IP ranges of insecure registries, using the CIDR syntax + * ([RFC 4632](https://tools.ietf.org/html/4632)). Insecure registries + * accept un-encrypted (HTTP) and/or untrusted (HTTPS with certificates + * from unknown CAs) communication. + * + * By default, local registries (`127.0.0.0/8`) are configured as + * insecure. All other registries are secure. Communicating with an + * insecure registry is not possible if the daemon assumes that registry + * is secure. + * + * This configuration override this behavior, insecure communication with + * registries whose resolved IP address is within the subnet described by + * the CIDR syntax. + * + * Registries can also be marked insecure by hostname. Those registries + * are listed under `IndexConfigs` and have their `Secure` field set to + * `false`. + * + * > **Warning**: Using this option can be useful when running a local + * > registry, but introduces security vulnerabilities. This option + * > should therefore ONLY be used for testing purposes. For increased + * > security, users should add their CA to their system's list of trusted + * > CAs instead of enabling this option. + */ + InsecureRegistryCIDRs: v.exactOptional(v.array(v.string())), + IndexConfigs: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * List of registry URLs that act as a mirror for the official + * (`docker.io`) registry. + */ + Mirrors: v.exactOptional(v.array(v.string())), + }), + ), + ), + /** + * User-defined resources can be either Integer resources (e.g, `SSD=3`) or + * String resources (e.g, `GPU=UUID1`). + */ + GenericResources: v.exactOptional( + v.array( + v.strictObject({ + NamedResourceSpec: v.exactOptional( + v.strictObject({ + Kind: v.exactOptional(v.string()), + Value: v.exactOptional(v.string()), + }), + ), + DiscreteResourceSpec: v.exactOptional( + v.strictObject({ + Kind: v.exactOptional(v.string()), + Value: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + }), + ), + ), + /** + * HTTP-proxy configured for the daemon. This value is obtained from the + * [`HTTP_PROXY`](https://www.gnu.org/software/wget/manual/html_node/Proxies.html) + * environment variable. + * Credentials ([user info + * component](https://tools.ietf.org/html/rfc3986#section-3.2.1)) in the proxy + * URL + * are masked in the API response. + * + * Containers do not automatically inherit this configuration. + */ + HttpProxy: v.exactOptional(v.string()), + /** + * HTTPS-proxy configured for the daemon. This value is obtained from the + * [`HTTPS_PROXY`](https://www.gnu.org/software/wget/manual/html_node/Proxies.html) + * environment variable. + * Credentials ([user info + * component](https://tools.ietf.org/html/rfc3986#section-3.2.1)) in the proxy + * URL + * are masked in the API response. + * + * Containers do not automatically inherit this configuration. + */ + HttpsProxy: v.exactOptional(v.string()), + /** + * Comma-separated list of domain extensions for which no proxy should be + * used. This value is obtained from the + * [`NO_PROXY`](https://www.gnu.org/software/wget/manual/html_node/Proxies.html) + * environment variable. + * + * Containers do not automatically inherit this configuration. + */ + NoProxy: v.exactOptional(v.string()), + /** + * Hostname of the host. + */ + Name: v.exactOptional(v.string()), + /** + * User-defined labels (key/value metadata) as set on the daemon. + * + *


+ * + * > **Note**: When part of a Swarm, nodes can both have _daemon_ labels, + * > set through the daemon configuration, and _node_ labels, set from a + * > manager node in the Swarm. Node labels are not included in this + * > field. Node labels can be retrieved using the `/nodes/(id)` endpoint + * > on a manager node in the Swarm. + */ + Labels: v.exactOptional(v.array(v.string())), + /** + * Indicates if experimental features are enabled on the daemon. + */ + ExperimentalBuild: v.exactOptional(v.boolean()), + /** + * Version string of the daemon. + */ + ServerVersion: v.exactOptional(v.string()), + /** + * List of [OCI compliant](https://github.com/opencontainers/runtime-spec) + * runtimes configured on the daemon. Keys hold the "name" used to + * reference the runtime. + * + * The Docker daemon relies on an OCI compliant runtime (invoked via the + * `containerd` daemon) as its interface to the Linux kernel namespaces, + * cgroups, and SELinux. + * + * The default runtime is `runc`, and automatically configured. Additional + * runtimes can be configured by the user and will be listed here. + */ + Runtimes: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Name of the default OCI runtime that is used when starting containers. + * + * The default can be overridden per-container at create time. + */ + DefaultRuntime: v.exactOptional(v.string()), + /** + * Represents generic information about swarm. + */ + Swarm: v.exactOptional( + v.strictObject({ + /** + * Unique identifier of for this node in the swarm. + */ + NodeID: v.exactOptional(v.string()), + /** + * IP address at which this node can be reached by other nodes in the + * swarm. + */ + NodeAddr: v.exactOptional(v.string()), + /** + * Current local status of this node. + */ + LocalNodeState: v.exactOptional( + v.picklist(["", "inactive", "pending", "active", "error", "locked"]), + ), + ControlAvailable: v.exactOptional(v.boolean()), + Error: v.exactOptional(v.string()), + /** + * List of ID's and addresses of other managers in the swarm. + */ + RemoteManagers: v.exactOptional( + v.nullable( + v.array( + v.strictObject({ + /** + * Unique identifier of for this node in the swarm. + */ + NodeID: v.exactOptional(v.string()), + /** + * IP address and ports at which this node can be reached. + */ + Addr: v.exactOptional(v.string()), + }), + ), + ), + ), + /** + * Total number of nodes in the swarm. + */ + Nodes: v.exactOptional(v.nullable(v.pipe(v.number(), v.integer()))), + /** + * Total number of managers in the swarm. + */ + Managers: v.exactOptional(v.nullable(v.pipe(v.number(), v.integer()))), + /** + * ClusterInfo represents information about the swarm as is returned by the + * "/info" endpoint. Join-tokens are not included. + */ + Cluster: v.exactOptional( + v.nullable( + v.strictObject({ + /** + * The ID of the swarm. + */ + ID: v.exactOptional(v.string()), + /** + * The version number of the object such as node, service, etc. This is needed + * to avoid conflicting writes. The client must send the version number along + * with the modified specification when updating these objects. + * + * This approach ensures safe concurrency and determinism in that the change + * on the object may not be applied if the version number has changed from the + * last read. In other words, if two update requests specify the same base + * version, only one of the requests can succeed. As a result, two separate + * update requests that happen at the same time will not unintentionally + * overwrite each other. + */ + Version: v.exactOptional( + v.strictObject({ + Index: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * Date and time at which the swarm was initialised in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + */ + CreatedAt: v.exactOptional(v.string()), + /** + * Date and time at which the swarm was last updated in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + */ + UpdatedAt: v.exactOptional(v.string()), + /** + * User modifiable swarm configuration. + */ + Spec: v.exactOptional( + v.strictObject({ + /** + * Name of the swarm. + */ + Name: v.exactOptional(v.string()), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Orchestration configuration. + */ + Orchestration: v.exactOptional( + v.nullable( + v.strictObject({ + /** + * The number of historic tasks to keep per instance or node. If + * negative, never remove completed or failed tasks. + */ + TaskHistoryRetentionLimit: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + }), + ), + ), + /** + * Raft configuration. + */ + Raft: v.exactOptional( + v.strictObject({ + /** + * The number of log entries between snapshots. + */ + SnapshotInterval: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + /** + * The number of snapshots to keep beyond the current snapshot. + */ + KeepOldSnapshots: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + /** + * The number of log entries to keep around to sync up slow followers + * after a snapshot is created. + */ + LogEntriesForSlowFollowers: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + /** + * The number of ticks that a follower will wait for a message from + * the leader before becoming a candidate and starting an election. + * `ElectionTick` must be greater than `HeartbeatTick`. + * + * A tick currently defaults to one second, so these translate + * directly to seconds currently, but this is NOT guaranteed. + */ + ElectionTick: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + /** + * The number of ticks between heartbeats. Every HeartbeatTick ticks, + * the leader will send a heartbeat to the followers. + * + * A tick currently defaults to one second, so these translate + * directly to seconds currently, but this is NOT guaranteed. + */ + HeartbeatTick: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + }), + ), + /** + * Dispatcher configuration. + */ + Dispatcher: v.exactOptional( + v.nullable( + v.strictObject({ + /** + * The delay for an agent to send a heartbeat to the dispatcher. + */ + HeartbeatPeriod: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + }), + ), + ), + /** + * CA configuration. + */ + CAConfig: v.exactOptional( + v.nullable( + v.strictObject({ + /** + * The duration node certificates are issued for. + */ + NodeCertExpiry: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + /** + * Configuration for forwarding signing requests to an external + * certificate authority. + */ + ExternalCAs: v.exactOptional( + v.array( + v.strictObject({ + /** + * Protocol for communication with the external CA (currently + * only `cfssl` is supported). + */ + Protocol: v.exactOptional(v.picklist(["cfssl"])), + /** + * URL where certificate signing requests should be sent. + */ + URL: v.exactOptional(v.string()), + /** + * An object with key/value pairs that are interpreted as + * protocol-specific options for the external CA driver. + */ + Options: v.exactOptional( + v.record(v.string(), v.unknown()), + ), + /** + * The root CA certificate (in PEM format) this external CA uses + * to issue TLS certificates (assumed to be to the current swarm + * root CA certificate if not provided). + */ + CACert: v.exactOptional(v.string()), + }), + ), + ), + /** + * The desired signing CA certificate for all swarm node TLS leaf + * certificates, in PEM format. + */ + SigningCACert: v.exactOptional(v.string()), + /** + * The desired signing CA key for all swarm node TLS leaf certificates, + * in PEM format. + */ + SigningCAKey: v.exactOptional(v.string()), + /** + * An integer whose purpose is to force swarm to generate a new + * signing CA certificate and key, if none have been specified in + * `SigningCACert` and `SigningCAKey` + */ + ForceRotate: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + }), + ), + ), + /** + * Parameters related to encryption-at-rest. + */ + EncryptionConfig: v.exactOptional( + v.strictObject({ + /** + * If set, generate a key and use it to lock data stored on the + * managers. + */ + AutoLockManagers: v.exactOptional(v.boolean()), + }), + ), + /** + * Defaults for creating tasks in this cluster. + */ + TaskDefaults: v.exactOptional( + v.strictObject({ + /** + * The log driver to use for tasks created in the orchestrator if + * unspecified by a service. + * + * Updating this value only affects new tasks. Existing tasks continue + * to use their previously configured log driver until recreated. + */ + LogDriver: v.exactOptional( + v.strictObject({ + /** + * The log driver to use as a default for new tasks. + */ + Name: v.exactOptional(v.string()), + /** + * Driver-specific options for the selected log driver, specified + * as key/value pairs. + */ + Options: v.exactOptional( + v.record(v.string(), v.unknown()), + ), + }), + ), + }), + ), + }), + ), + /** + * Information about the issuer of leaf TLS certificates and the trusted root + * CA certificate. + */ + TLSInfo: v.exactOptional( + v.strictObject({ + /** + * The root CA certificate(s) that are used to validate leaf TLS + * certificates. + */ + TrustRoot: v.exactOptional(v.string()), + /** + * The base64-url-safe-encoded raw subject bytes of the issuer. + */ + CertIssuerSubject: v.exactOptional(v.string()), + /** + * The base64-url-safe-encoded raw public key bytes of the issuer. + */ + CertIssuerPublicKey: v.exactOptional(v.string()), + }), + ), + /** + * Whether there is currently a root CA rotation in progress for the swarm + */ + RootRotationInProgress: v.exactOptional(v.boolean()), + /** + * DataPathPort specifies the data path port number for data traffic. + * Acceptable port range is 1024 to 49151. + * If no port is set or is set to 0, the default port (4789) is used. + */ + DataPathPort: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Default Address Pool specifies default subnet pools for global scope + * networks. + */ + DefaultAddrPool: v.exactOptional(v.array(v.string())), + /** + * SubnetSize specifies the subnet size of the networks created from the + * default subnet pool. + */ + SubnetSize: v.exactOptional( + v.pipe(v.number(), v.integer(), v.maxValue(29)), + ), + }), + ), + ), + }), + ), + /** + * Indicates if live restore is enabled. + * + * If enabled, containers are kept running when the daemon is shutdown + * or upon daemon start if running containers are detected. + */ + LiveRestoreEnabled: v.exactOptional(v.boolean()), + /** + * Represents the isolation technology to use as a default for containers. + * The supported values are platform-specific. + * + * If no isolation value is specified on daemon start, on Windows client, + * the default is `hyperv`, and on Windows server, the default is `process`. + * + * This option is currently not used on other platforms. + */ + Isolation: v.exactOptional(v.picklist(["default", "hyperv", "process", ""])), + /** + * Name and, optional, path of the `docker-init` binary. + * + * If the path is omitted, the daemon searches the host's `$PATH` for the + * binary and uses the first result. + */ + InitBinary: v.exactOptional(v.string()), + /** + * Commit holds the Git-commit (SHA1) that a binary was built from, as + * reported in the version-string of external tools, such as `containerd`, + * or `runC`. + */ + ContainerdCommit: v.exactOptional( + v.strictObject({ + /** + * Actual commit ID of external tool. + */ + ID: v.exactOptional(v.string()), + /** + * Commit ID of external tool expected by dockerd as set at build time. + */ + Expected: v.exactOptional(v.string()), + }), + ), + /** + * Commit holds the Git-commit (SHA1) that a binary was built from, as + * reported in the version-string of external tools, such as `containerd`, + * or `runC`. + */ + RuncCommit: v.exactOptional( + v.strictObject({ + /** + * Actual commit ID of external tool. + */ + ID: v.exactOptional(v.string()), + /** + * Commit ID of external tool expected by dockerd as set at build time. + */ + Expected: v.exactOptional(v.string()), + }), + ), + /** + * Commit holds the Git-commit (SHA1) that a binary was built from, as + * reported in the version-string of external tools, such as `containerd`, + * or `runC`. + */ + InitCommit: v.exactOptional( + v.strictObject({ + /** + * Actual commit ID of external tool. + */ + ID: v.exactOptional(v.string()), + /** + * Commit ID of external tool expected by dockerd as set at build time. + */ + Expected: v.exactOptional(v.string()), + }), + ), + /** + * List of security features that are enabled on the daemon, such as + * apparmor, seccomp, SELinux, user-namespaces (userns), rootless and + * no-new-privileges. + * + * Additional configuration options for each security feature may + * be present, and are included as a comma-separated list of key/value + * pairs. + */ + SecurityOptions: v.exactOptional(v.array(v.string())), + /** + * Reports a summary of the product license on the daemon. + * + * If a commercial license has been applied to the daemon, information + * such as number of nodes, and expiration are included. + */ + ProductLicense: v.exactOptional(v.string()), + /** + * List of custom default address pools for local networks, which can be + * specified in the daemon.json file or dockerd option. + * + * Example: a Base "10.10.0.0/16" with Size 24 will define the set of 256 + * 10.10.[0-255].0/24 address pools. + */ + DefaultAddressPools: v.exactOptional( + v.array( + v.strictObject({ + /** + * The network address in CIDR format + */ + Base: v.exactOptional(v.string()), + /** + * The network pool size + */ + Size: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + ), + /** + * List of warnings / informational messages about missing features, or + * issues related to the daemon configuration. + * + * These messages can be printed by the client as information to the user. + */ + Warnings: v.exactOptional(v.array(v.string())), +}); +/** + * Available plugins per type. + * + *


+ * + * > **Note**: Only unmanaged (V1) plugins are included in this list. + * > V1 plugins are "lazily" loaded, and are not returned in this list + * > if there is no resource using the plugin. + */ +export const pluginsInfoSchema = v.strictObject({ + /** + * Names of available volume-drivers, and network-driver plugins. + */ + Volume: v.exactOptional(v.array(v.string())), + /** + * Names of available network-drivers, and network-driver plugins. + */ + Network: v.exactOptional(v.array(v.string())), + /** + * Names of available authorization plugins. + */ + Authorization: v.exactOptional(v.array(v.string())), + /** + * Names of available logging-drivers, and logging-driver plugins. + */ + Log: v.exactOptional(v.array(v.string())), +}); +/** RegistryServiceConfig stores daemon registry services configuration. */ +export const registryServiceConfigSchema = v.nullable( + v.strictObject({ + /** + * List of IP ranges to which nondistributable artifacts can be pushed, + * using the CIDR syntax [RFC 4632](https://tools.ietf.org/html/4632). + * + * Some images (for example, Windows base images) contain artifacts + * whose distribution is restricted by license. When these images are + * pushed to a registry, restricted artifacts are not included. + * + * This configuration override this behavior, and enables the daemon to + * push nondistributable artifacts to all registries whose resolved IP + * address is within the subnet described by the CIDR syntax. + * + * This option is useful when pushing images containing + * nondistributable artifacts to a registry on an air-gapped network so + * hosts on that network can pull the images without connecting to + * another server. + * + * > **Warning**: Nondistributable artifacts typically have restrictions + * > on how and where they can be distributed and shared. Only use this + * > feature to push artifacts to private registries and ensure that you + * > are in compliance with any terms that cover redistributing + * > nondistributable artifacts. + */ + AllowNondistributableArtifactsCIDRs: v.exactOptional(v.array(v.string())), + /** + * List of registry hostnames to which nondistributable artifacts can be + * pushed, using the format `[:]` or `[:]`. + * + * Some images (for example, Windows base images) contain artifacts + * whose distribution is restricted by license. When these images are + * pushed to a registry, restricted artifacts are not included. + * + * This configuration override this behavior for the specified + * registries. + * + * This option is useful when pushing images containing + * nondistributable artifacts to a registry on an air-gapped network so + * hosts on that network can pull the images without connecting to + * another server. + * + * > **Warning**: Nondistributable artifacts typically have restrictions + * > on how and where they can be distributed and shared. Only use this + * > feature to push artifacts to private registries and ensure that you + * > are in compliance with any terms that cover redistributing + * > nondistributable artifacts. + */ + AllowNondistributableArtifactsHostnames: v.exactOptional( + v.array(v.string()), + ), + /** + * List of IP ranges of insecure registries, using the CIDR syntax + * ([RFC 4632](https://tools.ietf.org/html/4632)). Insecure registries + * accept un-encrypted (HTTP) and/or untrusted (HTTPS with certificates + * from unknown CAs) communication. + * + * By default, local registries (`127.0.0.0/8`) are configured as + * insecure. All other registries are secure. Communicating with an + * insecure registry is not possible if the daemon assumes that registry + * is secure. + * + * This configuration override this behavior, insecure communication with + * registries whose resolved IP address is within the subnet described by + * the CIDR syntax. + * + * Registries can also be marked insecure by hostname. Those registries + * are listed under `IndexConfigs` and have their `Secure` field set to + * `false`. + * + * > **Warning**: Using this option can be useful when running a local + * > registry, but introduces security vulnerabilities. This option + * > should therefore ONLY be used for testing purposes. For increased + * > security, users should add their CA to their system's list of trusted + * > CAs instead of enabling this option. + */ + InsecureRegistryCIDRs: v.exactOptional(v.array(v.string())), + IndexConfigs: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * List of registry URLs that act as a mirror for the official + * (`docker.io`) registry. + */ + Mirrors: v.exactOptional(v.array(v.string())), + }), +); +/** IndexInfo contains information about a registry. */ +export const indexInfoSchema = v.nullable( + v.strictObject({ + /** + * Name of the registry, such as "docker.io". + */ + Name: v.exactOptional(v.string()), + /** + * List of mirrors, expressed as URIs. + */ + Mirrors: v.exactOptional(v.array(v.string())), + /** + * Indicates if the registry is part of the list of insecure + * registries. + * + * If `false`, the registry is insecure. Insecure registries accept + * un-encrypted (HTTP) and/or untrusted (HTTPS with certificates from + * unknown CAs) communication. + * + * > **Warning**: Insecure registries can be useful when running a local + * > registry. However, because its use creates security vulnerabilities + * > it should ONLY be enabled for testing purposes. For increased + * > security, users should add their CA to their system's list of + * > trusted CAs instead of enabling this option. + */ + Secure: v.exactOptional(v.boolean()), + /** + * Indicates whether this is an official registry (i.e., Docker Hub / + * docker.io) + */ + Official: v.exactOptional(v.boolean()), + }), +); +/** + * Runtime describes an [OCI + * compliant](https://github.com/opencontainers/runtime-spec) + * runtime. + * + * The runtime is invoked by the daemon via the `containerd` daemon. OCI + * runtimes act as an interface to the Linux kernel namespaces, cgroups, + * and SELinux. + */ +export const runtimeSchema = v.strictObject({ + /** + * Name and, optional, path, of the OCI executable binary. + * + * If the path is omitted, the daemon searches the host's `$PATH` for the + * binary and uses the first result. + */ + path: v.exactOptional(v.string()), + /** + * List of command-line arguments to pass to the runtime when invoked. + */ + runtimeArgs: v.exactOptional(v.nullable(v.array(v.string()))), +}); +/** + * Commit holds the Git-commit (SHA1) that a binary was built from, as + * reported in the version-string of external tools, such as `containerd`, + * or `runC`. + */ +export const commitSchema = v.strictObject({ + /** + * Actual commit ID of external tool. + */ + ID: v.exactOptional(v.string()), + /** + * Commit ID of external tool expected by dockerd as set at build time. + */ + Expected: v.exactOptional(v.string()), +}); +/** Represents generic information about swarm. */ +export const swarmInfoSchema = v.strictObject({ + /** + * Unique identifier of for this node in the swarm. + */ + NodeID: v.exactOptional(v.string()), + /** + * IP address at which this node can be reached by other nodes in the + * swarm. + */ + NodeAddr: v.exactOptional(v.string()), + /** + * Current local status of this node. + */ + LocalNodeState: v.exactOptional( + v.picklist(["", "inactive", "pending", "active", "error", "locked"]), + ), + ControlAvailable: v.exactOptional(v.boolean()), + Error: v.exactOptional(v.string()), + /** + * List of ID's and addresses of other managers in the swarm. + */ + RemoteManagers: v.exactOptional( + v.nullable( + v.array( + v.strictObject({ + /** + * Unique identifier of for this node in the swarm. + */ + NodeID: v.exactOptional(v.string()), + /** + * IP address and ports at which this node can be reached. + */ + Addr: v.exactOptional(v.string()), + }), + ), + ), + ), + /** + * Total number of nodes in the swarm. + */ + Nodes: v.exactOptional(v.nullable(v.pipe(v.number(), v.integer()))), + /** + * Total number of managers in the swarm. + */ + Managers: v.exactOptional(v.nullable(v.pipe(v.number(), v.integer()))), + /** + * ClusterInfo represents information about the swarm as is returned by the + * "/info" endpoint. Join-tokens are not included. + */ + Cluster: v.exactOptional( + v.nullable( + v.strictObject({ + /** + * The ID of the swarm. + */ + ID: v.exactOptional(v.string()), + /** + * The version number of the object such as node, service, etc. This is needed + * to avoid conflicting writes. The client must send the version number along + * with the modified specification when updating these objects. + * + * This approach ensures safe concurrency and determinism in that the change + * on the object may not be applied if the version number has changed from the + * last read. In other words, if two update requests specify the same base + * version, only one of the requests can succeed. As a result, two separate + * update requests that happen at the same time will not unintentionally + * overwrite each other. + */ + Version: v.exactOptional( + v.strictObject({ + Index: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * Date and time at which the swarm was initialised in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + */ + CreatedAt: v.exactOptional(v.string()), + /** + * Date and time at which the swarm was last updated in + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + */ + UpdatedAt: v.exactOptional(v.string()), + /** + * User modifiable swarm configuration. + */ + Spec: v.exactOptional( + v.strictObject({ + /** + * Name of the swarm. + */ + Name: v.exactOptional(v.string()), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Orchestration configuration. + */ + Orchestration: v.exactOptional( + v.nullable( + v.strictObject({ + /** + * The number of historic tasks to keep per instance or node. If + * negative, never remove completed or failed tasks. + */ + TaskHistoryRetentionLimit: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + }), + ), + ), + /** + * Raft configuration. + */ + Raft: v.exactOptional( + v.strictObject({ + /** + * The number of log entries between snapshots. + */ + SnapshotInterval: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + /** + * The number of snapshots to keep beyond the current snapshot. + */ + KeepOldSnapshots: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + /** + * The number of log entries to keep around to sync up slow followers + * after a snapshot is created. + */ + LogEntriesForSlowFollowers: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + /** + * The number of ticks that a follower will wait for a message from + * the leader before becoming a candidate and starting an election. + * `ElectionTick` must be greater than `HeartbeatTick`. + * + * A tick currently defaults to one second, so these translate + * directly to seconds currently, but this is NOT guaranteed. + */ + ElectionTick: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The number of ticks between heartbeats. Every HeartbeatTick ticks, + * the leader will send a heartbeat to the followers. + * + * A tick currently defaults to one second, so these translate + * directly to seconds currently, but this is NOT guaranteed. + */ + HeartbeatTick: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * Dispatcher configuration. + */ + Dispatcher: v.exactOptional( + v.nullable( + v.strictObject({ + /** + * The delay for an agent to send a heartbeat to the dispatcher. + */ + HeartbeatPeriod: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + }), + ), + ), + /** + * CA configuration. + */ + CAConfig: v.exactOptional( + v.nullable( + v.strictObject({ + /** + * The duration node certificates are issued for. + */ + NodeCertExpiry: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + /** + * Configuration for forwarding signing requests to an external + * certificate authority. + */ + ExternalCAs: v.exactOptional( + v.array( + v.strictObject({ + /** + * Protocol for communication with the external CA (currently + * only `cfssl` is supported). + */ + Protocol: v.exactOptional(v.picklist(["cfssl"])), + /** + * URL where certificate signing requests should be sent. + */ + URL: v.exactOptional(v.string()), + /** + * An object with key/value pairs that are interpreted as + * protocol-specific options for the external CA driver. + */ + Options: v.exactOptional( + v.record(v.string(), v.unknown()), + ), + /** + * The root CA certificate (in PEM format) this external CA uses + * to issue TLS certificates (assumed to be to the current swarm + * root CA certificate if not provided). + */ + CACert: v.exactOptional(v.string()), + }), + ), + ), + /** + * The desired signing CA certificate for all swarm node TLS leaf + * certificates, in PEM format. + */ + SigningCACert: v.exactOptional(v.string()), + /** + * The desired signing CA key for all swarm node TLS leaf certificates, + * in PEM format. + */ + SigningCAKey: v.exactOptional(v.string()), + /** + * An integer whose purpose is to force swarm to generate a new + * signing CA certificate and key, if none have been specified in + * `SigningCACert` and `SigningCAKey` + */ + ForceRotate: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + ), + /** + * Parameters related to encryption-at-rest. + */ + EncryptionConfig: v.exactOptional( + v.strictObject({ + /** + * If set, generate a key and use it to lock data stored on the + * managers. + */ + AutoLockManagers: v.exactOptional(v.boolean()), + }), + ), + /** + * Defaults for creating tasks in this cluster. + */ + TaskDefaults: v.exactOptional( + v.strictObject({ + /** + * The log driver to use for tasks created in the orchestrator if + * unspecified by a service. + * + * Updating this value only affects new tasks. Existing tasks continue + * to use their previously configured log driver until recreated. + */ + LogDriver: v.exactOptional( + v.strictObject({ + /** + * The log driver to use as a default for new tasks. + */ + Name: v.exactOptional(v.string()), + /** + * Driver-specific options for the selected log driver, specified + * as key/value pairs. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + }), + ), + }), + ), + /** + * Information about the issuer of leaf TLS certificates and the trusted root + * CA certificate. + */ + TLSInfo: v.exactOptional( + v.strictObject({ + /** + * The root CA certificate(s) that are used to validate leaf TLS + * certificates. + */ + TrustRoot: v.exactOptional(v.string()), + /** + * The base64-url-safe-encoded raw subject bytes of the issuer. + */ + CertIssuerSubject: v.exactOptional(v.string()), + /** + * The base64-url-safe-encoded raw public key bytes of the issuer. + */ + CertIssuerPublicKey: v.exactOptional(v.string()), + }), + ), + /** + * Whether there is currently a root CA rotation in progress for the swarm + */ + RootRotationInProgress: v.exactOptional(v.boolean()), + /** + * DataPathPort specifies the data path port number for data traffic. + * Acceptable port range is 1024 to 49151. + * If no port is set or is set to 0, the default port (4789) is used. + */ + DataPathPort: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Default Address Pool specifies default subnet pools for global scope + * networks. + */ + DefaultAddrPool: v.exactOptional(v.array(v.string())), + /** + * SubnetSize specifies the subnet size of the networks created from the + * default subnet pool. + */ + SubnetSize: v.exactOptional( + v.pipe(v.number(), v.integer(), v.maxValue(29)), + ), + }), + ), + ), +}); +/** + * Current local status of this node. + * @example "active" + */ +export const localNodeStateSchema = v.picklist([ + "", + "inactive", + "pending", + "active", + "error", + "locked", +]); +/** Represents a peer-node in the swarm */ +export const peerNodeSchema = v.strictObject({ + /** + * Unique identifier of for this node in the swarm. + */ + NodeID: v.exactOptional(v.string()), + /** + * IP address and ports at which this node can be reached. + */ + Addr: v.exactOptional(v.string()), +}); +/** Specifies how a service should be attached to a particular network. */ +export const networkAttachmentConfigSchema = v.strictObject({ + /** + * The target network for attachment. Must be a network name or ID. + */ + Target: v.exactOptional(v.string()), + /** + * Discoverable alternate names for the service on this network. + */ + Aliases: v.exactOptional(v.array(v.string())), + /** + * Driver attachment options for the network target. + */ + DriverOpts: v.exactOptional(v.record(v.string(), v.unknown())), +}); +/** + * Actor describes something that generates events, like a container, network, + * or a volume. + */ +export const eventActorSchema = v.strictObject({ + /** + * The ID of the object emitting the event + */ + ID: v.exactOptional(v.string()), + /** + * Various key/value attributes of the object, depending on its type. + */ + Attributes: v.exactOptional(v.record(v.string(), v.unknown())), +}); +/** + * EventMessage represents the information an event contains. + * @title SystemEventsResponse + */ +export const eventMessageSchema = v.strictObject({ + /** + * The type of object emitting the event + */ + Type: v.exactOptional( + v.picklist([ + "builder", + "config", + "container", + "daemon", + "image", + "network", + "node", + "plugin", + "secret", + "service", + "volume", + ]), + ), + /** + * The type of event + */ + Action: v.exactOptional(v.string()), + /** + * Actor describes something that generates events, like a container, network, + * or a volume. + */ + Actor: v.exactOptional( + v.strictObject({ + /** + * The ID of the object emitting the event + */ + ID: v.exactOptional(v.string()), + /** + * Various key/value attributes of the object, depending on its type. + */ + Attributes: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + /** + * Scope of the event. Engine events are `local` scope. Cluster (Swarm) + * events are `swarm` scope. + */ + scope: v.exactOptional(v.picklist(["local", "swarm"])), + /** + * Timestamp of event + */ + time: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Timestamp of event, with nanosecond accuracy + */ + timeNano: v.exactOptional(v.pipe(v.number(), v.integer())), +}); +/** + * A descriptor struct containing digest, media type, and size, as defined in + * the [OCI Content Descriptors + * Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md). + */ +export const ociDescriptorSchema = v.strictObject({ + /** + * The media type of the object this schema refers to. + */ + mediaType: v.exactOptional(v.string()), + /** + * The digest of the targeted content. + */ + digest: v.exactOptional(v.string()), + /** + * The size in bytes of the blob. + */ + size: v.exactOptional(v.pipe(v.number(), v.integer())), +}); +/** + * Describes the platform which the image in the manifest runs on, as defined + * in the [OCI Image Index + * Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md). + */ +export const ociPlatformSchema = v.strictObject({ + /** + * The CPU architecture, for example `amd64` or `ppc64`. + */ + architecture: v.exactOptional(v.string()), + /** + * The operating system, for example `linux` or `windows`. + */ + os: v.exactOptional(v.string()), + /** + * Optional field specifying the operating system version, for example on + * Windows `10.0.19041.1165`. + */ + "os.version": v.exactOptional(v.string()), + /** + * Optional field specifying an array of strings, each listing a required + * OS feature (for example on Windows `win32k`). + */ + "os.features": v.exactOptional(v.array(v.string())), + /** + * Optional field specifying a variant of the CPU, for example `v7` to + * specify ARMv7 when architecture is `arm`. + */ + variant: v.exactOptional(v.string()), +}); +/** + * Describes the result obtained from contacting the registry to retrieve + * image metadata. + * @title DistributionInspectResponse + */ +export const distributionInspectSchema = v.strictObject({ + /** + * A descriptor struct containing digest, media type, and size, as defined in + * the [OCI Content Descriptors + * Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md). + */ + Descriptor: v.strictObject({ + /** + * The media type of the object this schema refers to. + */ + mediaType: v.exactOptional(v.string()), + /** + * The digest of the targeted content. + */ + digest: v.exactOptional(v.string()), + /** + * The size in bytes of the blob. + */ + size: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + /** + * An array containing all platforms supported by the image. + */ + Platforms: v.array( + v.strictObject({ + /** + * The CPU architecture, for example `amd64` or `ppc64`. + */ + architecture: v.exactOptional(v.string()), + /** + * The operating system, for example `linux` or `windows`. + */ + os: v.exactOptional(v.string()), + /** + * Optional field specifying the operating system version, for example on + * Windows `10.0.19041.1165`. + */ + "os.version": v.exactOptional(v.string()), + /** + * Optional field specifying an array of strings, each listing a required + * OS feature (for example on Windows `win32k`). + */ + "os.features": v.exactOptional(v.array(v.string())), + /** + * Optional field specifying a variant of the CPU, for example `v7` to + * specify ARMv7 when architecture is `arm`. + */ + variant: v.exactOptional(v.string()), + }), + ), +}); +/** + * Options and information specific to, and only present on, Swarm CSI + * cluster volumes. + */ +export const clusterVolumeSchema = v.strictObject({ + /** + * The Swarm ID of this volume. Because cluster volumes are Swarm + * objects, they have an ID, unlike non-cluster volumes. This ID can + * be used to refer to the Volume instead of the name. + */ + ID: v.exactOptional(v.string()), + /** + * The version number of the object such as node, service, etc. This is needed + * to avoid conflicting writes. The client must send the version number along + * with the modified specification when updating these objects. + * + * This approach ensures safe concurrency and determinism in that the change + * on the object may not be applied if the version number has changed from the + * last read. In other words, if two update requests specify the same base + * version, only one of the requests can succeed. As a result, two separate + * update requests that happen at the same time will not unintentionally + * overwrite each other. + */ + Version: v.exactOptional( + v.strictObject({ + Index: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + CreatedAt: v.exactOptional(v.string()), + UpdatedAt: v.exactOptional(v.string()), + /** + * Cluster-specific options used to create the volume. + */ + Spec: v.exactOptional( + v.strictObject({ + /** + * 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: v.exactOptional(v.string()), + /** + * Defines how the volume is used by tasks. + */ + AccessMode: v.exactOptional( + v.strictObject({ + /** + * The set of nodes this volume can be used on at one time. + * - `single` The volume may only be scheduled to one node at a time. + * - `multi` the volume may be scheduled to any supported number of nodes at a + * time. + */ + Scope: v.exactOptional(v.picklist(["single", "multi"])), + /** + * The number and way that different tasks can use this volume + * at one time. + * - `none` The volume may only be used by one task at a time. + * - `readonly` The volume may be used by any number of tasks, but they all + * must mount the volume as readonly + * - `onewriter` The volume may be used by any number of tasks, but only one + * may mount it as read/write. + * - `all` The volume may have any number of readers and writers. + */ + Sharing: v.exactOptional( + v.picklist(["none", "readonly", "onewriter", "all"]), + ), + /** + * Options for using this volume as a Mount-type volume. + * + * + * Either MountVolume or BlockVolume, but not both, must be + * + * present. + * + * properties: + * + * FsType: + * + * type: "string" + * + * description: | + * + * Specifies the filesystem type for the mount volume. + * + * Optional. + * + * MountFlags: + * + * type: "array" + * + * description: | + * + * Flags to pass when mounting the volume. Optional. + * + * items: + * + * type: "string" + * BlockVolume: + * + * type: "object" + * + * description: | + * + * Options for using this volume as a Block-type volume. + * + * Intentionally empty. + */ + MountVolume: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Swarm Secrets that are passed to the CSI storage plugin when + * operating on this volume. + */ + Secrets: v.exactOptional( + v.array( + v.strictObject({ + /** + * Key is the name of the key of the key-value pair passed to + * the plugin. + */ + Key: v.exactOptional(v.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: v.exactOptional(v.string()), + }), + ), + ), + /** + * Requirements for the accessible topology of the volume. These + * fields are optional. For an in-depth description of what these + * fields mean, see the CSI specification. + */ + AccessibilityRequirements: v.exactOptional( + v.strictObject({ + /** + * A list of required topologies, at least one of which the + * volume must be accessible from. + */ + Requisite: v.exactOptional( + v.array(v.record(v.string(), v.unknown())), + ), + /** + * A list of topologies that the volume should attempt to be + * provisioned in. + */ + Preferred: v.exactOptional( + v.array(v.record(v.string(), v.unknown())), + ), + }), + ), + /** + * The desired capacity that the volume should be created with. If + * empty, the plugin will decide the capacity. + */ + CapacityRange: v.exactOptional( + v.strictObject({ + /** + * The volume must be at least this big. The value of 0 + * indicates an unspecified minimum + */ + RequiredBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The volume must not be bigger than this. The value of 0 + * indicates an unspecified maximum. + */ + LimitBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * The availability of the volume for use in tasks. + * - `active` The volume is fully available for scheduling on the cluster + * - `pause` No new workloads should use the volume, but existing workloads + * are not stopped. + * - `drain` All workloads using this volume should be stopped and + * rescheduled, and no new ones should be started. + */ + Availability: v.exactOptional( + v.picklist(["active", "pause", "drain"]), + ), + }), + ), + }), + ), + /** + * Information about the global status of the volume. + */ + Info: v.exactOptional( + v.strictObject({ + /** + * The capacity of the volume in bytes. A value of 0 indicates that + * the capacity is unknown. + */ + CapacityBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * A map of strings to strings returned from the storage plugin when + * the volume is created. + */ + VolumeContext: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * The ID of the volume as returned by the CSI storage plugin. This + * is distinct from the volume's ID as provided by Docker. This ID + * is never used by the user when communicating with Docker to refer + * to this volume. If the ID is blank, then the Volume has not been + * successfully created in the plugin yet. + */ + VolumeID: v.exactOptional(v.string()), + /** + * The topology this volume is actually accessible from. + */ + AccessibleTopology: v.exactOptional( + v.array(v.record(v.string(), v.unknown())), + ), + }), + ), + /** + * The status of the volume as it pertains to its publishing and use on + * specific nodes + */ + PublishStatus: v.exactOptional( + v.array( + v.strictObject({ + /** + * The ID of the Swarm node the volume is published on. + */ + NodeID: v.exactOptional(v.string()), + /** + * The published state of the volume. + * * `pending-publish` The volume should be published to this node, but the + * call to the controller plugin to do so has not yet been successfully + * completed. + * * `published` The volume is published successfully to the node. + * * `pending-node-unpublish` The volume should be unpublished from the node, + * and the manager is awaiting confirmation from the worker that it has done + * so. + * * `pending-controller-unpublish` The volume is successfully unpublished + * from the node, but has not yet been successfully unpublished on the + * controller. + */ + State: v.exactOptional( + v.picklist([ + "pending-publish", + "published", + "pending-node-unpublish", + "pending-controller-unpublish", + ]), + ), + /** + * A map of strings to strings returned by the CSI controller + * plugin when a volume is published. + */ + PublishContext: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + ), +}); +/** Cluster-specific options used to create the volume. */ +export const clusterVolumeSpecSchema = v.strictObject({ + /** + * 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: v.exactOptional(v.string()), + /** + * Defines how the volume is used by tasks. + */ + AccessMode: v.exactOptional( + v.strictObject({ + /** + * The set of nodes this volume can be used on at one time. + * - `single` The volume may only be scheduled to one node at a time. + * - `multi` the volume may be scheduled to any supported number of nodes at a + * time. + */ + Scope: v.exactOptional(v.picklist(["single", "multi"])), + /** + * The number and way that different tasks can use this volume + * at one time. + * - `none` The volume may only be used by one task at a time. + * - `readonly` The volume may be used by any number of tasks, but they all + * must mount the volume as readonly + * - `onewriter` The volume may be used by any number of tasks, but only one + * may mount it as read/write. + * - `all` The volume may have any number of readers and writers. + */ + Sharing: v.exactOptional( + v.picklist(["none", "readonly", "onewriter", "all"]), + ), + /** + * Options for using this volume as a Mount-type volume. + * + * + * Either MountVolume or BlockVolume, but not both, must be + * + * present. + * + * properties: + * + * FsType: + * + * type: "string" + * + * description: | + * + * Specifies the filesystem type for the mount volume. + * + * Optional. + * + * MountFlags: + * + * type: "array" + * + * description: | + * + * Flags to pass when mounting the volume. Optional. + * + * items: + * + * type: "string" + * BlockVolume: + * + * type: "object" + * + * description: | + * + * Options for using this volume as a Block-type volume. + * + * Intentionally empty. + */ + MountVolume: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Swarm Secrets that are passed to the CSI storage plugin when + * operating on this volume. + */ + Secrets: v.exactOptional( + v.array( + v.strictObject({ + /** + * Key is the name of the key of the key-value pair passed to + * the plugin. + */ + Key: v.exactOptional(v.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: v.exactOptional(v.string()), + }), + ), + ), + /** + * Requirements for the accessible topology of the volume. These + * fields are optional. For an in-depth description of what these + * fields mean, see the CSI specification. + */ + AccessibilityRequirements: v.exactOptional( + v.strictObject({ + /** + * A list of required topologies, at least one of which the + * volume must be accessible from. + */ + Requisite: v.exactOptional( + v.array(v.record(v.string(), v.unknown())), + ), + /** + * A list of topologies that the volume should attempt to be + * provisioned in. + */ + Preferred: v.exactOptional( + v.array(v.record(v.string(), v.unknown())), + ), + }), + ), + /** + * The desired capacity that the volume should be created with. If + * empty, the plugin will decide the capacity. + */ + CapacityRange: v.exactOptional( + v.strictObject({ + /** + * The volume must be at least this big. The value of 0 + * indicates an unspecified minimum + */ + RequiredBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The volume must not be bigger than this. The value of 0 + * indicates an unspecified maximum. + */ + LimitBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * The availability of the volume for use in tasks. + * - `active` The volume is fully available for scheduling on the cluster + * - `pause` No new workloads should use the volume, but existing workloads + * are not stopped. + * - `drain` All workloads using this volume should be stopped and + * rescheduled, and no new ones should be started. + */ + Availability: v.exactOptional(v.picklist(["active", "pause", "drain"])), + }), + ), +}); +/** + * A map of topological domains to topological segments. For in depth + * details, see documentation for the Topology object in the CSI + * specification. + */ +export const topologySchema = v.record(v.string(), v.unknown()); +export const containerListCommandQuerySchema = v.strictObject({ + all: v.exactOptional(v.boolean()), + limit: v.exactOptional(v.pipe(v.number(), v.integer())), + size: v.exactOptional(v.boolean()), + filters: v.exactOptional(v.string()), +}); +export const containerCreateCommandBodySchema = v.intersect([ + v.strictObject({ + /** + * The hostname to use for the container, as a valid RFC 1123 hostname. + */ + Hostname: v.exactOptional(v.string()), + /** + * The domain name to use for the container. + */ + Domainname: v.exactOptional(v.string()), + /** + * The user that commands are run as inside the container. + */ + User: v.exactOptional(v.string()), + /** + * Whether to attach to `stdin`. + */ + AttachStdin: v.exactOptional(v.boolean()), + /** + * Whether to attach to `stdout`. + */ + AttachStdout: v.exactOptional(v.boolean()), + /** + * Whether to attach to `stderr`. + */ + AttachStderr: v.exactOptional(v.boolean()), + /** + * An object mapping ports to an empty object in the form: + * + * `{"/": {}}` + */ + ExposedPorts: v.exactOptional( + v.nullable(v.record(v.string(), v.unknown())), + ), + /** + * Attach standard streams to a TTY, including `stdin` if it is not closed. + */ + Tty: v.exactOptional(v.boolean()), + /** + * Open `stdin` + */ + OpenStdin: v.exactOptional(v.boolean()), + /** + * Close `stdin` after one attached client disconnects + */ + StdinOnce: v.exactOptional(v.boolean()), + /** + * A list of environment variables to set inside the container in the + * form `["VAR=value", ...]`. A variable without `=` is removed from the + * environment, rather than to have an empty value. + */ + Env: v.exactOptional(v.array(v.string())), + /** + * Command to run specified as a string or an array of strings. + */ + Cmd: v.exactOptional(v.array(v.string())), + /** + * A test to perform to check that the container is healthy. + */ + Healthcheck: v.exactOptional( + v.strictObject({ + /** + * The test to perform. Possible values are: + * + * - `[]` inherit healthcheck from image or parent image + * - `["NONE"]` disable healthcheck + * - `["CMD", args...]` exec arguments directly + * - `["CMD-SHELL", command]` run command with system's default shell + */ + Test: v.exactOptional(v.array(v.string())), + /** + * The time to wait between checks in nanoseconds. It should be 0 or at + * least 1000000 (1 ms). 0 means inherit. + */ + Interval: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The time to wait before considering the check to have hung. It should + * be 0 or at least 1000000 (1 ms). 0 means inherit. + */ + Timeout: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The number of consecutive failures needed to consider a container as + * unhealthy. 0 means inherit. + */ + Retries: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Start period for the container to initialize before starting + * health-retries countdown in nanoseconds. It should be 0 or at least + * 1000000 (1 ms). 0 means inherit. + */ + StartPeriod: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * Command is already escaped (Windows only) + */ + ArgsEscaped: v.exactOptional(v.nullable(v.boolean())), + /** + * The name (or reference) of the image to use when creating the container, + * or which was used when the container was created. + */ + Image: v.exactOptional(v.string()), + /** + * An object mapping mount point paths inside the container to empty + * objects. + */ + Volumes: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * The working directory for commands to run in. + */ + WorkingDir: v.exactOptional(v.string()), + /** + * The entry point for the container as a string or an array of strings. + * + * If the array consists of exactly one empty string (`[""]`) then the + * entry point is reset to system default (i.e., the entry point used by + * docker when there is no `ENTRYPOINT` instruction in the `Dockerfile`). + */ + Entrypoint: v.exactOptional(v.array(v.string())), + /** + * Disable networking for the container. + */ + NetworkDisabled: v.exactOptional(v.nullable(v.boolean())), + /** + * MAC address of the container. + */ + MacAddress: v.exactOptional(v.nullable(v.string())), + /** + * `ONBUILD` metadata that were defined in the image's `Dockerfile`. + */ + OnBuild: v.exactOptional(v.nullable(v.array(v.string()))), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Signal to stop a container as a string or unsigned integer. + */ + StopSignal: v.exactOptional(v.nullable(v.string())), + /** + * Timeout to stop a container in seconds. + */ + StopTimeout: v.exactOptional(v.nullable(v.pipe(v.number(), v.integer()))), + /** + * Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell. + */ + Shell: v.exactOptional(v.nullable(v.array(v.string()))), + }), + v.strictObject({ + /** + * Container configuration that depends on the host we are running on + */ + HostConfig: v.exactOptional( + v.intersect([ + v.strictObject({ + /** + * An integer value representing this container's relative CPU weight + * versus other containers. + */ + CpuShares: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Memory limit in bytes. + */ + Memory: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Path to `cgroups` under which the container's `cgroup` is created. If + * the path is not absolute, the path is considered to be relative to the + * `cgroups` path of the init process. Cgroups are created if they do not + * already exist. + */ + CgroupParent: v.exactOptional(v.string()), + /** + * Block IO weight (relative weight). + */ + BlkioWeight: v.exactOptional( + v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(1000)), + ), + /** + * Block IO weight (relative device weight) in the form: + * + * ``` + * [{"Path": "device_path", "Weight": weight}] + * ``` + */ + BlkioWeightDevice: v.exactOptional( + v.array( + v.strictObject({ + Path: v.exactOptional(v.string()), + Weight: v.exactOptional( + v.pipe(v.number(), v.integer(), v.minValue(0)), + ), + }), + ), + ), + /** + * Limit read rate (bytes per second) from a device, in the form: + * + * ``` + * [{"Path": "device_path", "Rate": rate}] + * ``` + */ + BlkioDeviceReadBps: v.exactOptional( + v.array( + v.strictObject({ + /** + * Device path + */ + Path: v.exactOptional(v.string()), + /** + * Rate + */ + Rate: v.exactOptional( + v.pipe(v.number(), v.integer(), v.minValue(0)), + ), + }), + ), + ), + /** + * Limit write rate (bytes per second) to a device, in the form: + * + * ``` + * [{"Path": "device_path", "Rate": rate}] + * ``` + */ + BlkioDeviceWriteBps: v.exactOptional( + v.array( + v.strictObject({ + /** + * Device path + */ + Path: v.exactOptional(v.string()), + /** + * Rate + */ + Rate: v.exactOptional( + v.pipe(v.number(), v.integer(), v.minValue(0)), + ), + }), + ), + ), + /** + * Limit read rate (IO per second) from a device, in the form: + * + * ``` + * [{"Path": "device_path", "Rate": rate}] + * ``` + */ + BlkioDeviceReadIOps: v.exactOptional( + v.array( + v.strictObject({ + /** + * Device path + */ + Path: v.exactOptional(v.string()), + /** + * Rate + */ + Rate: v.exactOptional( + v.pipe(v.number(), v.integer(), v.minValue(0)), + ), + }), + ), + ), + /** + * Limit write rate (IO per second) to a device, in the form: + * + * ``` + * [{"Path": "device_path", "Rate": rate}] + * ``` + */ + BlkioDeviceWriteIOps: v.exactOptional( + v.array( + v.strictObject({ + /** + * Device path + */ + Path: v.exactOptional(v.string()), + /** + * Rate + */ + Rate: v.exactOptional( + v.pipe(v.number(), v.integer(), v.minValue(0)), + ), + }), + ), + ), + /** + * The length of a CPU period in microseconds. + */ + CpuPeriod: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Microseconds of CPU time that the container can get in a CPU period. + */ + CpuQuota: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The length of a CPU real-time period in microseconds. Set to 0 to + * allocate no time allocated to real-time tasks. + */ + CpuRealtimePeriod: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The length of a CPU real-time runtime in microseconds. Set to 0 to + * allocate no time allocated to real-time tasks. + */ + CpuRealtimeRuntime: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * CPUs in which to allow execution (e.g., `0-3`, `0,1`). + */ + CpusetCpus: v.exactOptional(v.string()), + /** + * Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only + * effective on NUMA systems. + */ + CpusetMems: v.exactOptional(v.string()), + /** + * A list of devices to add to the container. + */ + Devices: v.exactOptional( + v.array( + v.strictObject({ + PathOnHost: v.exactOptional(v.string()), + PathInContainer: v.exactOptional(v.string()), + CgroupPermissions: v.exactOptional(v.string()), + }), + ), + ), + /** + * a list of cgroup rules to apply to the container + */ + DeviceCgroupRules: v.exactOptional(v.array(v.string())), + /** + * A list of requests for devices to be sent to device drivers. + */ + DeviceRequests: v.exactOptional( + v.array( + v.strictObject({ + Driver: v.exactOptional(v.string()), + Count: v.exactOptional(v.pipe(v.number(), v.integer())), + DeviceIDs: v.exactOptional(v.array(v.string())), + /** + * A list of capabilities; an OR list of AND lists of capabilities. + */ + Capabilities: v.exactOptional(v.array(v.array(v.string()))), + /** + * Driver-specific options, specified as a key/value pairs. These options + * are passed directly to the driver. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + ), + /** + * Hard limit for kernel TCP buffer memory (in bytes). Depending on the + * OCI runtime in use, this option may be ignored. It is no longer supported + * by the default (runc) runtime. + * + * This field is omitted when empty. + */ + KernelMemoryTCP: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Memory soft limit in bytes. + */ + MemoryReservation: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Total memory limit (memory + swap). Set as `-1` to enable unlimited + * swap. + */ + MemorySwap: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Tune a container's memory swappiness behavior. Accepts an integer + * between 0 and 100. + */ + MemorySwappiness: v.exactOptional( + v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(100)), + ), + /** + * CPU quota in units of 10-9 CPUs. + */ + NanoCpus: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Disable OOM Killer for the container. + */ + OomKillDisable: v.exactOptional(v.boolean()), + /** + * Run an init inside the container that forwards signals and reaps + * processes. This field is omitted if empty, and the default (as + * configured on the daemon) is used. + */ + Init: v.exactOptional(v.nullable(v.boolean())), + /** + * Tune a container's PIDs limit. Set `0` or `-1` for unlimited, or `null` + * to not change. + */ + PidsLimit: v.exactOptional( + v.nullable(v.pipe(v.number(), v.integer())), + ), + /** + * A list of resource limits to set in the container. For example: + * + * ``` + * {"Name": "nofile", "Soft": 1024, "Hard": 2048} + * ``` + */ + Ulimits: v.exactOptional( + v.array( + v.strictObject({ + /** + * Name of ulimit + */ + Name: v.exactOptional(v.string()), + /** + * Soft limit + */ + Soft: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Hard limit + */ + Hard: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + ), + /** + * The number of usable CPUs (Windows only). + * + * On Windows Server containers, the processor resource controls are + * mutually exclusive. The order of precedence is `CPUCount` first, then + * `CPUShares`, and `CPUPercent` last. + */ + CpuCount: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The usable percentage of the available CPUs (Windows only). + * + * On Windows Server containers, the processor resource controls are + * mutually exclusive. The order of precedence is `CPUCount` first, then + * `CPUShares`, and `CPUPercent` last. + */ + CpuPercent: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Maximum IOps for the container system drive (Windows only) + */ + IOMaximumIOps: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Maximum IO in bytes per second for the container system drive + * (Windows only). + */ + IOMaximumBandwidth: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + v.strictObject({ + /** + * A list of volume bindings for this container. Each volume binding + * is a string in one of these forms: + * + * - `host-src:container-dest[:options]` to bind-mount a host path + * + * into the container. Both `host-src`, and `container-dest` must + * + * be an _absolute_ path. + * - `volume-name:container-dest[:options]` to bind-mount a volume + * + * managed by a volume driver into the container. `container-dest` + * + * must be an _absolute_ path. + * + * `options` is an optional, comma-delimited list of: + * + * - `nocopy` disables automatic copying of data from the container + * + * path to the volume. The `nocopy` flag only applies to named volumes. + * - `[ro|rw]` mounts a volume read-only or read-write, respectively. + * + * If omitted or set to `rw`, volumes are mounted read-write. + * - `[z|Z]` applies SELinux labels to allow or deny multiple containers + * + * to read and write to the same volume. + * + * - `z`: a _shared_ content label is applied to the content. This + * + * label indicates that multiple containers can share the volume + * + * content, for both reading and writing. + * + * - `Z`: a _private unshared_ label is applied to the content. + * + * This label indicates that only the current container can use + * + * a private volume. Labeling systems such as SELinux require + * + * proper labels to be placed on volume content that is mounted + * + * into a container. Without a label, the security system can + * + * prevent a container's processes from using the content. By + * + * default, the labels set by the host operating system are not + * + * modified. + * - `[[r]shared|[r]slave|[r]private]` specifies mount + * + * [propagation + * behavior](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt). + * + * This only applies to bind-mounted volumes, not internal volumes + * + * or named volumes. Mount propagation requires the source mount + * + * point (the location where the source directory is mounted in the + * + * host operating system) to have the correct propagation properties. + * + * For shared volumes, the source mount point must be set to `shared`. + * + * For slave volumes, the mount must be set to either `shared` or + * + * `slave`. + */ + Binds: v.exactOptional(v.array(v.string())), + /** + * Path to a file where the container ID is written + */ + ContainerIDFile: v.exactOptional(v.string()), + /** + * The logging configuration for this container + */ + LogConfig: v.exactOptional( + v.strictObject({ + Type: v.exactOptional( + v.picklist([ + "json-file", + "syslog", + "journald", + "gelf", + "fluentd", + "awslogs", + "splunk", + "etwlogs", + "none", + ]), + ), + Config: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + /** + * Network mode to use for this container. Supported standard values + * are: `bridge`, `host`, `none`, and `container:`. Any + * other value is taken as a custom network's name to which this + * container should connect to. + */ + NetworkMode: v.exactOptional(v.string()), + /** + * PortMap describes the mapping of container ports to host ports, using the + * container's port-number and protocol as key in the format + * `/`, + * for example, `80/udp`. + * + * If a container's port is mapped for multiple protocols, separate entries + * are added to the mapping table. + */ + PortBindings: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * The behavior to apply when the container exits. The default is not to + * restart. + * + * An ever increasing delay (double the previous delay, starting at 100ms) is + * added before each restart to prevent flooding the server. + */ + RestartPolicy: v.exactOptional( + v.strictObject({ + /** + * - Empty string means not to restart + * - `no` Do not automatically restart + * - `always` Always restart + * - `unless-stopped` Restart always except when the user has manually stopped + * the container + * - `on-failure` Restart only when the container exit code is non-zero + */ + Name: v.exactOptional( + v.picklist([ + "", + "no", + "always", + "unless-stopped", + "on-failure", + ]), + ), + /** + * If `on-failure` is used, the number of times to retry before giving up. + */ + MaximumRetryCount: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + }), + ), + /** + * Automatically remove the container when the container's process + * exits. This has no effect if `RestartPolicy` is set. + */ + AutoRemove: v.exactOptional(v.boolean()), + /** + * Driver that this container uses to mount volumes. + */ + VolumeDriver: v.exactOptional(v.string()), + /** + * A list of volumes to inherit from another container, specified in + * the form `[:]`. + */ + VolumesFrom: v.exactOptional(v.array(v.string())), + /** + * Specification for mounts to be added to the container. + */ + Mounts: v.exactOptional( + v.array( + v.strictObject({ + /** + * Container path. + */ + Target: v.exactOptional(v.string()), + /** + * Mount source (e.g. a volume name, a host path). + */ + Source: v.exactOptional(v.string()), + /** + * The mount type. Available types: + * + * - `bind` Mounts a file or directory from the host into the container. Must + * exist prior to creating the container. + * - `volume` Creates a volume with the given name and options (or uses a + * pre-existing volume with the same name and options). These are **not** + * removed when the container is removed. + * - `tmpfs` Create a tmpfs with the given options. The mount source cannot be + * specified for tmpfs. + * - `npipe` Mounts a named pipe from the host into the container. Must exist + * prior to creating the container. + * - `cluster` a Swarm cluster volume + */ + Type: v.exactOptional( + v.picklist(["bind", "volume", "tmpfs", "npipe", "cluster"]), + ), + /** + * Whether the mount should be read-only. + */ + ReadOnly: v.exactOptional(v.boolean()), + /** + * The consistency requirement for the mount: `default`, `consistent`, + * `cached`, or `delegated`. + */ + Consistency: v.exactOptional(v.string()), + /** + * Optional configuration for the `bind` type. + */ + BindOptions: v.exactOptional( + v.strictObject({ + /** + * A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + */ + Propagation: v.exactOptional( + v.picklist([ + "private", + "rprivate", + "shared", + "rshared", + "slave", + "rslave", + ]), + ), + /** + * Disable recursive bind mount. + */ + NonRecursive: v.exactOptional(v.boolean()), + /** + * Create mount point on host if missing + */ + CreateMountpoint: v.exactOptional(v.boolean()), + }), + ), + /** + * Optional configuration for the `volume` type. + */ + VolumeOptions: v.exactOptional( + v.strictObject({ + /** + * Populate volume with data from the target. + */ + NoCopy: v.exactOptional(v.boolean()), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Map of driver specific options + */ + DriverConfig: v.exactOptional( + v.strictObject({ + /** + * Name of the driver to use to create the volume. + */ + Name: v.exactOptional(v.string()), + /** + * key/value map of driver specific options. + */ + Options: v.exactOptional( + v.record(v.string(), v.unknown()), + ), + }), + ), + }), + ), + /** + * Optional configuration for the `tmpfs` type. + */ + TmpfsOptions: v.exactOptional( + v.strictObject({ + /** + * The size for the tmpfs mount in bytes. + */ + SizeBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The permission mode for the tmpfs mount in an integer. + */ + Mode: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + }), + ), + ), + /** + * Initial console size, as an `[height, width]` array. + */ + ConsoleSize: v.exactOptional( + v.nullable( + v.pipe( + v.array(v.pipe(v.number(), v.integer(), v.minValue(0))), + v.minLength(2), + v.maxLength(2), + ), + ), + ), + /** + * Arbitrary non-identifying metadata attached to container and + * provided to the runtime when the container is started. + */ + Annotations: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * A list of kernel capabilities to add to the container. Conflicts + * with option 'Capabilities'. + */ + CapAdd: v.exactOptional(v.array(v.string())), + /** + * A list of kernel capabilities to drop from the container. Conflicts + * with option 'Capabilities'. + */ + CapDrop: v.exactOptional(v.array(v.string())), + /** + * cgroup namespace mode for the container. Possible values are: + * + * - `"private"`: the container runs in its own private cgroup namespace + * - `"host"`: use the host system's cgroup namespace + * + * If not specified, the daemon default is used, which can either be + * `"private"` + * or `"host"`, depending on daemon version, kernel support and configuration. + */ + CgroupnsMode: v.exactOptional(v.picklist(["private", "host"])), + /** + * A list of DNS servers for the container to use. + */ + Dns: v.exactOptional(v.array(v.string())), + /** + * A list of DNS options. + */ + DnsOptions: v.exactOptional(v.array(v.string())), + /** + * A list of DNS search domains. + */ + DnsSearch: v.exactOptional(v.array(v.string())), + /** + * A list of hostnames/IP mappings to add to the container's `/etc/hosts` + * file. Specified in the form `["hostname:IP"]`. + */ + ExtraHosts: v.exactOptional(v.array(v.string())), + /** + * A list of additional groups that the container process will run as. + */ + GroupAdd: v.exactOptional(v.array(v.string())), + /** + * IPC sharing mode for the container. Possible values are: + * + * - `"none"`: own private IPC namespace, with /dev/shm not mounted + * - `"private"`: own private IPC namespace + * - `"shareable"`: own private IPC namespace, with a possibility to share it + * with other containers + * - `"container:"`: join another (shareable) container's IPC + * namespace + * - `"host"`: use the host system's IPC namespace + * + * If not specified, daemon default is used, which can either be `"private"` + * or `"shareable"`, depending on daemon version and configuration. + */ + IpcMode: v.exactOptional(v.string()), + /** + * Cgroup to use for the container. + */ + Cgroup: v.exactOptional(v.string()), + /** + * A list of links for the container in the form `container_name:alias`. + */ + Links: v.exactOptional(v.array(v.string())), + /** + * An integer value containing the score given to the container in + * order to tune OOM killer preferences. + */ + OomScoreAdj: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Set the PID (Process) Namespace mode for the container. It can be + * either: + * + * - `"container:"`: joins another container's PID namespace + * - `"host"`: use the host's PID namespace inside the container + */ + PidMode: v.exactOptional(v.string()), + /** + * Gives the container full access to the host. + */ + Privileged: v.exactOptional(v.boolean()), + /** + * Allocates an ephemeral host port for all of a container's + * exposed ports. + * + * Ports are de-allocated when the container stops and allocated when + * the container starts. The allocated port might be changed when + * restarting the container. + * + * The port is selected from the ephemeral port range that depends on + * the kernel. For example, on Linux the range is defined by + * `/proc/sys/net/ipv4/ip_local_port_range`. + */ + PublishAllPorts: v.exactOptional(v.boolean()), + /** + * Mount the container's root filesystem as read only. + */ + ReadonlyRootfs: v.exactOptional(v.boolean()), + /** + * A list of string values to customize labels for MLS systems, such + * as SELinux. + */ + SecurityOpt: v.exactOptional(v.array(v.string())), + /** + * Storage driver options for this container, in the form `{"size": "120G"}`. + */ + StorageOpt: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * A map of container directories which should be replaced by tmpfs + * mounts, and their corresponding mount options. For example: + * + * ``` + * { "/run": "rw,noexec,nosuid,size=65536k" } + * ``` + */ + Tmpfs: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * UTS namespace to use for the container. + */ + UTSMode: v.exactOptional(v.string()), + /** + * Sets the usernamespace mode for the container when usernamespace + * remapping option is enabled. + */ + UsernsMode: v.exactOptional(v.string()), + /** + * Size of `/dev/shm` in bytes. If omitted, the system uses 64MB. + */ + ShmSize: v.exactOptional( + v.pipe(v.number(), v.integer(), v.minValue(0)), + ), + /** + * A list of kernel parameters (sysctls) to set in the container. + * For example: + * + * ``` + * {"net.ipv4.ip_forward": "1"} + * ``` + */ + Sysctls: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Runtime to use with this container. + */ + Runtime: v.exactOptional(v.string()), + /** + * Isolation technology of the container. (Windows only) + */ + Isolation: v.exactOptional( + v.picklist(["default", "process", "hyperv", ""]), + ), + /** + * The list of paths to be masked inside the container (this overrides + * the default set of paths). + */ + MaskedPaths: v.exactOptional(v.array(v.string())), + /** + * The list of paths to be set as read-only inside the container + * (this overrides the default set of paths). + */ + ReadonlyPaths: v.exactOptional(v.array(v.string())), + }), + ]), + ), + /** + * NetworkingConfig represents the container's networking configuration for + * each of its interfaces. + * It is used for the networking configs specified in the `docker create` + * and `docker network connect` commands. + */ + NetworkingConfig: v.exactOptional( + v.strictObject({ + /** + * A mapping of network name to endpoint configuration for that network. + */ + EndpointsConfig: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + }), +]); +export const containerCreateCommandQuerySchema = v.strictObject({ + name: v.exactOptional( + v.pipe(v.string(), v.regex(/^\/?[a-zA-Z0-9][a-zA-Z0-9_.-]+$/)), + ), + platform: v.exactOptional(v.string()), +}); +export const containerInspectCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const containerInspectCommandQuerySchema = v.strictObject({ + size: v.exactOptional(v.boolean()), +}); +export const containerTopCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const containerTopCommandQuerySchema = v.strictObject({ + ps_args: v.exactOptional(v.string()), +}); +export const containerLogsCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const containerLogsCommandQuerySchema = v.strictObject({ + follow: v.exactOptional(v.boolean()), + stdout: v.exactOptional(v.boolean()), + stderr: v.exactOptional(v.boolean()), + since: v.exactOptional(v.pipe(v.number(), v.integer())), + until: v.exactOptional(v.pipe(v.number(), v.integer())), + timestamps: v.exactOptional(v.boolean()), + tail: v.exactOptional(v.string()), +}); +export const containerChangesCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const containerExportCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const containerStatsCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const containerStatsCommandQuerySchema = v.strictObject({ + stream: v.exactOptional(v.boolean()), + "one-shot": v.exactOptional(v.boolean()), +}); +export const containerResizeCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const containerResizeCommandQuerySchema = v.strictObject({ + h: v.pipe(v.number(), v.integer()), + w: v.pipe(v.number(), v.integer()), +}); +export const containerStartCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const containerStartCommandQuerySchema = v.strictObject({ + detachKeys: v.exactOptional(v.string()), +}); +export const containerStopCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const containerStopCommandQuerySchema = v.strictObject({ + signal: v.exactOptional(v.string()), + t: v.exactOptional(v.pipe(v.number(), v.integer())), +}); +export const containerRestartCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const containerRestartCommandQuerySchema = v.strictObject({ + signal: v.exactOptional(v.string()), + t: v.exactOptional(v.pipe(v.number(), v.integer())), +}); +export const containerKillCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const containerKillCommandQuerySchema = v.strictObject({ + signal: v.exactOptional(v.string()), +}); +export const containerUpdateCommandBodySchema = v.intersect([ + v.strictObject({ + /** + * An integer value representing this container's relative CPU weight + * versus other containers. + */ + CpuShares: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Memory limit in bytes. + */ + Memory: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Path to `cgroups` under which the container's `cgroup` is created. If + * the path is not absolute, the path is considered to be relative to the + * `cgroups` path of the init process. Cgroups are created if they do not + * already exist. + */ + CgroupParent: v.exactOptional(v.string()), + /** + * Block IO weight (relative weight). + */ + BlkioWeight: v.exactOptional( + v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(1000)), + ), + /** + * Block IO weight (relative device weight) in the form: + * + * ``` + * [{"Path": "device_path", "Weight": weight}] + * ``` + */ + BlkioWeightDevice: v.exactOptional( + v.array( + v.strictObject({ + Path: v.exactOptional(v.string()), + Weight: v.exactOptional( + v.pipe(v.number(), v.integer(), v.minValue(0)), + ), + }), + ), + ), + /** + * Limit read rate (bytes per second) from a device, in the form: + * + * ``` + * [{"Path": "device_path", "Rate": rate}] + * ``` + */ + BlkioDeviceReadBps: v.exactOptional( + v.array( + v.strictObject({ + /** + * Device path + */ + Path: v.exactOptional(v.string()), + /** + * Rate + */ + Rate: v.exactOptional(v.pipe(v.number(), v.integer(), v.minValue(0))), + }), + ), + ), + /** + * Limit write rate (bytes per second) to a device, in the form: + * + * ``` + * [{"Path": "device_path", "Rate": rate}] + * ``` + */ + BlkioDeviceWriteBps: v.exactOptional( + v.array( + v.strictObject({ + /** + * Device path + */ + Path: v.exactOptional(v.string()), + /** + * Rate + */ + Rate: v.exactOptional(v.pipe(v.number(), v.integer(), v.minValue(0))), + }), + ), + ), + /** + * Limit read rate (IO per second) from a device, in the form: + * + * ``` + * [{"Path": "device_path", "Rate": rate}] + * ``` + */ + BlkioDeviceReadIOps: v.exactOptional( + v.array( + v.strictObject({ + /** + * Device path + */ + Path: v.exactOptional(v.string()), + /** + * Rate + */ + Rate: v.exactOptional(v.pipe(v.number(), v.integer(), v.minValue(0))), + }), + ), + ), + /** + * Limit write rate (IO per second) to a device, in the form: + * + * ``` + * [{"Path": "device_path", "Rate": rate}] + * ``` + */ + BlkioDeviceWriteIOps: v.exactOptional( + v.array( + v.strictObject({ + /** + * Device path + */ + Path: v.exactOptional(v.string()), + /** + * Rate + */ + Rate: v.exactOptional(v.pipe(v.number(), v.integer(), v.minValue(0))), + }), + ), + ), + /** + * The length of a CPU period in microseconds. + */ + CpuPeriod: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Microseconds of CPU time that the container can get in a CPU period. + */ + CpuQuota: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The length of a CPU real-time period in microseconds. Set to 0 to + * allocate no time allocated to real-time tasks. + */ + CpuRealtimePeriod: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The length of a CPU real-time runtime in microseconds. Set to 0 to + * allocate no time allocated to real-time tasks. + */ + CpuRealtimeRuntime: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * CPUs in which to allow execution (e.g., `0-3`, `0,1`). + */ + CpusetCpus: v.exactOptional(v.string()), + /** + * Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only + * effective on NUMA systems. + */ + CpusetMems: v.exactOptional(v.string()), + /** + * A list of devices to add to the container. + */ + Devices: v.exactOptional( + v.array( + v.strictObject({ + PathOnHost: v.exactOptional(v.string()), + PathInContainer: v.exactOptional(v.string()), + CgroupPermissions: v.exactOptional(v.string()), + }), + ), + ), + /** + * a list of cgroup rules to apply to the container + */ + DeviceCgroupRules: v.exactOptional(v.array(v.string())), + /** + * A list of requests for devices to be sent to device drivers. + */ + DeviceRequests: v.exactOptional( + v.array( + v.strictObject({ + Driver: v.exactOptional(v.string()), + Count: v.exactOptional(v.pipe(v.number(), v.integer())), + DeviceIDs: v.exactOptional(v.array(v.string())), + /** + * A list of capabilities; an OR list of AND lists of capabilities. + */ + Capabilities: v.exactOptional(v.array(v.array(v.string()))), + /** + * Driver-specific options, specified as a key/value pairs. These options + * are passed directly to the driver. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + ), + /** + * Hard limit for kernel TCP buffer memory (in bytes). Depending on the + * OCI runtime in use, this option may be ignored. It is no longer supported + * by the default (runc) runtime. + * + * This field is omitted when empty. + */ + KernelMemoryTCP: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Memory soft limit in bytes. + */ + MemoryReservation: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Total memory limit (memory + swap). Set as `-1` to enable unlimited + * swap. + */ + MemorySwap: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Tune a container's memory swappiness behavior. Accepts an integer + * between 0 and 100. + */ + MemorySwappiness: v.exactOptional( + v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(100)), + ), + /** + * CPU quota in units of 10-9 CPUs. + */ + NanoCpus: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Disable OOM Killer for the container. + */ + OomKillDisable: v.exactOptional(v.boolean()), + /** + * Run an init inside the container that forwards signals and reaps + * processes. This field is omitted if empty, and the default (as + * configured on the daemon) is used. + */ + Init: v.exactOptional(v.nullable(v.boolean())), + /** + * Tune a container's PIDs limit. Set `0` or `-1` for unlimited, or `null` + * to not change. + */ + PidsLimit: v.exactOptional(v.nullable(v.pipe(v.number(), v.integer()))), + /** + * A list of resource limits to set in the container. For example: + * + * ``` + * {"Name": "nofile", "Soft": 1024, "Hard": 2048} + * ``` + */ + Ulimits: v.exactOptional( + v.array( + v.strictObject({ + /** + * Name of ulimit + */ + Name: v.exactOptional(v.string()), + /** + * Soft limit + */ + Soft: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Hard limit + */ + Hard: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + ), + /** + * The number of usable CPUs (Windows only). + * + * On Windows Server containers, the processor resource controls are + * mutually exclusive. The order of precedence is `CPUCount` first, then + * `CPUShares`, and `CPUPercent` last. + */ + CpuCount: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The usable percentage of the available CPUs (Windows only). + * + * On Windows Server containers, the processor resource controls are + * mutually exclusive. The order of precedence is `CPUCount` first, then + * `CPUShares`, and `CPUPercent` last. + */ + CpuPercent: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Maximum IOps for the container system drive (Windows only) + */ + IOMaximumIOps: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Maximum IO in bytes per second for the container system drive + * (Windows only). + */ + IOMaximumBandwidth: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + v.strictObject({ + /** + * The behavior to apply when the container exits. The default is not to + * restart. + * + * An ever increasing delay (double the previous delay, starting at 100ms) is + * added before each restart to prevent flooding the server. + */ + RestartPolicy: v.exactOptional( + v.strictObject({ + /** + * - Empty string means not to restart + * - `no` Do not automatically restart + * - `always` Always restart + * - `unless-stopped` Restart always except when the user has manually stopped + * the container + * - `on-failure` Restart only when the container exit code is non-zero + */ + Name: v.exactOptional( + v.picklist(["", "no", "always", "unless-stopped", "on-failure"]), + ), + /** + * If `on-failure` is used, the number of times to retry before giving up. + */ + MaximumRetryCount: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + }), +]); +export const containerUpdateCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const containerRenameCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const containerRenameCommandQuerySchema = v.strictObject({ + name: v.string(), +}); +export const containerPauseCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const containerUnpauseCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const containerAttachCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const containerAttachCommandQuerySchema = v.strictObject({ + detachKeys: v.exactOptional(v.string()), + logs: v.exactOptional(v.boolean()), + stream: v.exactOptional(v.boolean()), + stdin: v.exactOptional(v.boolean()), + stdout: v.exactOptional(v.boolean()), + stderr: v.exactOptional(v.boolean()), +}); +export const containerAttachWebsocketCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const containerAttachWebsocketCommandQuerySchema = v.strictObject({ + detachKeys: v.exactOptional(v.string()), + logs: v.exactOptional(v.boolean()), + stream: v.exactOptional(v.boolean()), + stdin: v.exactOptional(v.boolean()), + stdout: v.exactOptional(v.boolean()), + stderr: v.exactOptional(v.boolean()), +}); +export const containerWaitCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const containerWaitCommandQuerySchema = v.strictObject({ + condition: v.exactOptional( + v.picklist(["not-running", "next-exit", "removed"]), + ), +}); +export const containerDeleteCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const containerDeleteCommandQuerySchema = v.strictObject({ + v: v.exactOptional(v.boolean()), + force: v.exactOptional(v.boolean()), + link: v.exactOptional(v.boolean()), +}); +export const containerArchiveCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const containerArchiveCommandQuerySchema = v.strictObject({ + path: v.string(), +}); +export const putContainerArchiveCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const putContainerArchiveCommandQuerySchema = v.strictObject({ + path: v.string(), + noOverwriteDirNonDir: v.exactOptional(v.string()), + copyUIDGID: v.exactOptional(v.string()), +}); +export const containerArchiveInfoCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const containerArchiveInfoCommandQuerySchema = v.strictObject({ + path: v.string(), +}); +export const containerPruneCommandQuerySchema = v.strictObject({ + filters: v.exactOptional(v.string()), +}); +export const imageListCommandQuerySchema = v.strictObject({ + all: v.exactOptional(v.boolean()), + filters: v.exactOptional(v.string()), + "shared-size": v.exactOptional(v.boolean()), + digests: v.exactOptional(v.boolean()), +}); +export const imageBuildCommandQuerySchema = v.strictObject({ + dockerfile: v.exactOptional(v.string()), + t: v.exactOptional(v.string()), + extrahosts: v.exactOptional(v.string()), + remote: v.exactOptional(v.string()), + q: v.exactOptional(v.boolean()), + nocache: v.exactOptional(v.boolean()), + cachefrom: v.exactOptional(v.string()), + pull: v.exactOptional(v.string()), + rm: v.exactOptional(v.boolean()), + forcerm: v.exactOptional(v.boolean()), + memory: v.exactOptional(v.pipe(v.number(), v.integer())), + memswap: v.exactOptional(v.pipe(v.number(), v.integer())), + cpushares: v.exactOptional(v.pipe(v.number(), v.integer())), + cpusetcpus: v.exactOptional(v.string()), + cpuperiod: v.exactOptional(v.pipe(v.number(), v.integer())), + cpuquota: v.exactOptional(v.pipe(v.number(), v.integer())), + buildargs: v.exactOptional(v.string()), + shmsize: v.exactOptional(v.pipe(v.number(), v.integer())), + squash: v.exactOptional(v.boolean()), + labels: v.exactOptional(v.string()), + networkmode: v.exactOptional(v.string()), + platform: v.exactOptional(v.string()), + target: v.exactOptional(v.string()), + outputs: v.exactOptional(v.string()), + version: v.exactOptional(v.picklist(["1", "2"])), +}); +export const buildPruneCommandQuerySchema = v.strictObject({ + "keep-storage": v.exactOptional(v.pipe(v.number(), v.integer())), + all: v.exactOptional(v.boolean()), + filters: v.exactOptional(v.string()), +}); +export const imageCreateCommandQuerySchema = v.strictObject({ + fromImage: v.exactOptional(v.string()), + fromSrc: v.exactOptional(v.string()), + repo: v.exactOptional(v.string()), + tag: v.exactOptional(v.string()), + message: v.exactOptional(v.string()), + changes: v.exactOptional(v.array(v.string())), + platform: v.exactOptional(v.string()), +}); +export const imageInspectCommandParamsSchema = v.strictObject({ + name: v.string(), +}); +export const imageHistoryCommandParamsSchema = v.strictObject({ + name: v.string(), +}); +export const imagePushCommandParamsSchema = v.strictObject({ + name: v.string(), +}); +export const imagePushCommandQuerySchema = v.strictObject({ + tag: v.exactOptional(v.string()), +}); +export const imageTagCommandParamsSchema = v.strictObject({ + name: v.string(), +}); +export const imageTagCommandQuerySchema = v.strictObject({ + repo: v.exactOptional(v.string()), + tag: v.exactOptional(v.string()), +}); +export const imageDeleteCommandParamsSchema = v.strictObject({ + name: v.string(), +}); +export const imageDeleteCommandQuerySchema = v.strictObject({ + force: v.exactOptional(v.boolean()), + noprune: v.exactOptional(v.boolean()), +}); +export const imageSearchCommandQuerySchema = v.strictObject({ + term: v.string(), + limit: v.exactOptional(v.pipe(v.number(), v.integer())), + filters: v.exactOptional(v.string()), +}); +export const imagePruneCommandQuerySchema = v.strictObject({ + filters: v.exactOptional(v.string()), +}); +export const systemAuthCommandBodySchema = v.strictObject({ + username: v.exactOptional(v.string()), + password: v.exactOptional(v.string()), + email: v.exactOptional(v.string()), + serveraddress: v.exactOptional(v.string()), +}); +export const imageCommitCommandBodySchema = v.strictObject({ + /** + * The hostname to use for the container, as a valid RFC 1123 hostname. + */ + Hostname: v.exactOptional(v.string()), + /** + * The domain name to use for the container. + */ + Domainname: v.exactOptional(v.string()), + /** + * The user that commands are run as inside the container. + */ + User: v.exactOptional(v.string()), + /** + * Whether to attach to `stdin`. + */ + AttachStdin: v.exactOptional(v.boolean()), + /** + * Whether to attach to `stdout`. + */ + AttachStdout: v.exactOptional(v.boolean()), + /** + * Whether to attach to `stderr`. + */ + AttachStderr: v.exactOptional(v.boolean()), + /** + * An object mapping ports to an empty object in the form: + * + * `{"/": {}}` + */ + ExposedPorts: v.exactOptional(v.nullable(v.record(v.string(), v.unknown()))), + /** + * Attach standard streams to a TTY, including `stdin` if it is not closed. + */ + Tty: v.exactOptional(v.boolean()), + /** + * Open `stdin` + */ + OpenStdin: v.exactOptional(v.boolean()), + /** + * Close `stdin` after one attached client disconnects + */ + StdinOnce: v.exactOptional(v.boolean()), + /** + * A list of environment variables to set inside the container in the + * form `["VAR=value", ...]`. A variable without `=` is removed from the + * environment, rather than to have an empty value. + */ + Env: v.exactOptional(v.array(v.string())), + /** + * Command to run specified as a string or an array of strings. + */ + Cmd: v.exactOptional(v.array(v.string())), + /** + * A test to perform to check that the container is healthy. + */ + Healthcheck: v.exactOptional( + v.strictObject({ + /** + * The test to perform. Possible values are: + * + * - `[]` inherit healthcheck from image or parent image + * - `["NONE"]` disable healthcheck + * - `["CMD", args...]` exec arguments directly + * - `["CMD-SHELL", command]` run command with system's default shell + */ + Test: v.exactOptional(v.array(v.string())), + /** + * The time to wait between checks in nanoseconds. It should be 0 or at + * least 1000000 (1 ms). 0 means inherit. + */ + Interval: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The time to wait before considering the check to have hung. It should + * be 0 or at least 1000000 (1 ms). 0 means inherit. + */ + Timeout: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The number of consecutive failures needed to consider a container as + * unhealthy. 0 means inherit. + */ + Retries: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Start period for the container to initialize before starting + * health-retries countdown in nanoseconds. It should be 0 or at least + * 1000000 (1 ms). 0 means inherit. + */ + StartPeriod: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * Command is already escaped (Windows only) + */ + ArgsEscaped: v.exactOptional(v.nullable(v.boolean())), + /** + * The name (or reference) of the image to use when creating the container, + * or which was used when the container was created. + */ + Image: v.exactOptional(v.string()), + /** + * An object mapping mount point paths inside the container to empty + * objects. + */ + Volumes: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * The working directory for commands to run in. + */ + WorkingDir: v.exactOptional(v.string()), + /** + * The entry point for the container as a string or an array of strings. + * + * If the array consists of exactly one empty string (`[""]`) then the + * entry point is reset to system default (i.e., the entry point used by + * docker when there is no `ENTRYPOINT` instruction in the `Dockerfile`). + */ + Entrypoint: v.exactOptional(v.array(v.string())), + /** + * Disable networking for the container. + */ + NetworkDisabled: v.exactOptional(v.nullable(v.boolean())), + /** + * MAC address of the container. + */ + MacAddress: v.exactOptional(v.nullable(v.string())), + /** + * `ONBUILD` metadata that were defined in the image's `Dockerfile`. + */ + OnBuild: v.exactOptional(v.nullable(v.array(v.string()))), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Signal to stop a container as a string or unsigned integer. + */ + StopSignal: v.exactOptional(v.nullable(v.string())), + /** + * Timeout to stop a container in seconds. + */ + StopTimeout: v.exactOptional(v.nullable(v.pipe(v.number(), v.integer()))), + /** + * Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell. + */ + Shell: v.exactOptional(v.nullable(v.array(v.string()))), +}); +export const imageCommitCommandQuerySchema = v.strictObject({ + container: v.exactOptional(v.string()), + repo: v.exactOptional(v.string()), + tag: v.exactOptional(v.string()), + comment: v.exactOptional(v.string()), + author: v.exactOptional(v.string()), + pause: v.exactOptional(v.boolean()), + changes: v.exactOptional(v.string()), +}); +export const systemEventsCommandQuerySchema = v.strictObject({ + since: v.exactOptional(v.string()), + until: v.exactOptional(v.string()), + filters: v.exactOptional(v.string()), +}); +export const systemDataUsageCommandQuerySchema = v.strictObject({ + type: v.exactOptional( + v.array(v.picklist(["container", "image", "volume", "build-cache"])), + ), +}); +export const imageGetCommandParamsSchema = v.strictObject({ + name: v.string(), +}); +export const imageGetAllCommandQuerySchema = v.strictObject({ + names: v.exactOptional(v.array(v.string())), +}); +export const imageLoadCommandQuerySchema = v.strictObject({ + quiet: v.exactOptional(v.boolean()), +}); +export const containerExecCommandBodySchema = v.strictObject({ + /** + * Attach to `stdin` of the exec command. + */ + AttachStdin: v.exactOptional(v.boolean()), + /** + * Attach to `stdout` of the exec command. + */ + AttachStdout: v.exactOptional(v.boolean()), + /** + * Attach to `stderr` of the exec command. + */ + AttachStderr: v.exactOptional(v.boolean()), + /** + * Initial console size, as an `[height, width]` array. + */ + ConsoleSize: v.exactOptional( + v.nullable( + v.pipe( + v.array(v.pipe(v.number(), v.integer(), v.minValue(0))), + v.minLength(2), + v.maxLength(2), + ), + ), + ), + /** + * Override the key sequence for detaching a container. Format is + * a single character `[a-Z]` or `ctrl-` where `` + * is one of: `a-z`, `@`, `^`, `[`, `,` or `_`. + */ + DetachKeys: v.exactOptional(v.string()), + /** + * Allocate a pseudo-TTY. + */ + Tty: v.exactOptional(v.boolean()), + /** + * A list of environment variables in the form `["VAR=value", ...]`. + */ + Env: v.exactOptional(v.array(v.string())), + /** + * Command to run, as a string or array of strings. + */ + Cmd: v.exactOptional(v.array(v.string())), + /** + * Runs the exec process with extended privileges. + */ + Privileged: v.exactOptional(v.boolean()), + /** + * The user, and optionally, group to run the exec process inside + * the container. Format is one of: `user`, `user:group`, `uid`, + * or `uid:gid`. + */ + User: v.exactOptional(v.string()), + /** + * The working directory for the exec process inside the container. + */ + WorkingDir: v.exactOptional(v.string()), +}); +export const containerExecCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const execStartCommandBodySchema = v.strictObject({ + /** + * Detach from the command. + */ + Detach: v.exactOptional(v.boolean()), + /** + * Allocate a pseudo-TTY. + */ + Tty: v.exactOptional(v.boolean()), + /** + * Initial console size, as an `[height, width]` array. + */ + ConsoleSize: v.exactOptional( + v.nullable( + v.pipe( + v.array(v.pipe(v.number(), v.integer(), v.minValue(0))), + v.minLength(2), + v.maxLength(2), + ), + ), + ), +}); +export const execStartCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const execResizeCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const execResizeCommandQuerySchema = v.strictObject({ + h: v.pipe(v.number(), v.integer()), + w: v.pipe(v.number(), v.integer()), +}); +export const execInspectCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const volumeListCommandQuerySchema = v.strictObject({ + filters: v.exactOptional(v.string()), +}); +export const volumeCreateCommandBodySchema = v.strictObject({ + /** + * The new volume's name. If not specified, Docker generates a name. + */ + Name: v.exactOptional(v.string()), + /** + * Name of the volume driver to use. + */ + Driver: v.exactOptional(v.string()), + /** + * A mapping of driver options and values. These options are + * passed directly to the driver and are driver specific. + */ + DriverOpts: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Cluster-specific options used to create the volume. + */ + ClusterVolumeSpec: v.exactOptional( + v.strictObject({ + /** + * 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: v.exactOptional(v.string()), + /** + * Defines how the volume is used by tasks. + */ + AccessMode: v.exactOptional( + v.strictObject({ + /** + * The set of nodes this volume can be used on at one time. + * - `single` The volume may only be scheduled to one node at a time. + * - `multi` the volume may be scheduled to any supported number of nodes at a + * time. + */ + Scope: v.exactOptional(v.picklist(["single", "multi"])), + /** + * The number and way that different tasks can use this volume + * at one time. + * - `none` The volume may only be used by one task at a time. + * - `readonly` The volume may be used by any number of tasks, but they all + * must mount the volume as readonly + * - `onewriter` The volume may be used by any number of tasks, but only one + * may mount it as read/write. + * - `all` The volume may have any number of readers and writers. + */ + Sharing: v.exactOptional( + v.picklist(["none", "readonly", "onewriter", "all"]), + ), + /** + * Options for using this volume as a Mount-type volume. + * + * + * Either MountVolume or BlockVolume, but not both, must be + * + * present. + * + * properties: + * + * FsType: + * + * type: "string" + * + * description: | + * + * Specifies the filesystem type for the mount volume. + * + * Optional. + * + * MountFlags: + * + * type: "array" + * + * description: | + * + * Flags to pass when mounting the volume. Optional. + * + * items: + * + * type: "string" + * BlockVolume: + * + * type: "object" + * + * description: | + * + * Options for using this volume as a Block-type volume. + * + * Intentionally empty. + */ + MountVolume: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Swarm Secrets that are passed to the CSI storage plugin when + * operating on this volume. + */ + Secrets: v.exactOptional( + v.array( + v.strictObject({ + /** + * Key is the name of the key of the key-value pair passed to + * the plugin. + */ + Key: v.exactOptional(v.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: v.exactOptional(v.string()), + }), + ), + ), + /** + * Requirements for the accessible topology of the volume. These + * fields are optional. For an in-depth description of what these + * fields mean, see the CSI specification. + */ + AccessibilityRequirements: v.exactOptional( + v.strictObject({ + /** + * A list of required topologies, at least one of which the + * volume must be accessible from. + */ + Requisite: v.exactOptional( + v.array(v.record(v.string(), v.unknown())), + ), + /** + * A list of topologies that the volume should attempt to be + * provisioned in. + */ + Preferred: v.exactOptional( + v.array(v.record(v.string(), v.unknown())), + ), + }), + ), + /** + * The desired capacity that the volume should be created with. If + * empty, the plugin will decide the capacity. + */ + CapacityRange: v.exactOptional( + v.strictObject({ + /** + * The volume must be at least this big. The value of 0 + * indicates an unspecified minimum + */ + RequiredBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The volume must not be bigger than this. The value of 0 + * indicates an unspecified maximum. + */ + LimitBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * The availability of the volume for use in tasks. + * - `active` The volume is fully available for scheduling on the cluster + * - `pause` No new workloads should use the volume, but existing workloads + * are not stopped. + * - `drain` All workloads using this volume should be stopped and + * rescheduled, and no new ones should be started. + */ + Availability: v.exactOptional( + v.picklist(["active", "pause", "drain"]), + ), + }), + ), + }), + ), +}); +export const volumeInspectCommandParamsSchema = v.strictObject({ + name: v.string(), +}); +export const volumeUpdateCommandBodySchema = v.strictObject({ + /** + * Cluster-specific options used to create the volume. + */ + Spec: v.exactOptional( + v.strictObject({ + /** + * 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: v.exactOptional(v.string()), + /** + * Defines how the volume is used by tasks. + */ + AccessMode: v.exactOptional( + v.strictObject({ + /** + * The set of nodes this volume can be used on at one time. + * - `single` The volume may only be scheduled to one node at a time. + * - `multi` the volume may be scheduled to any supported number of nodes at a + * time. + */ + Scope: v.exactOptional(v.picklist(["single", "multi"])), + /** + * The number and way that different tasks can use this volume + * at one time. + * - `none` The volume may only be used by one task at a time. + * - `readonly` The volume may be used by any number of tasks, but they all + * must mount the volume as readonly + * - `onewriter` The volume may be used by any number of tasks, but only one + * may mount it as read/write. + * - `all` The volume may have any number of readers and writers. + */ + Sharing: v.exactOptional( + v.picklist(["none", "readonly", "onewriter", "all"]), + ), + /** + * Options for using this volume as a Mount-type volume. + * + * + * Either MountVolume or BlockVolume, but not both, must be + * + * present. + * + * properties: + * + * FsType: + * + * type: "string" + * + * description: | + * + * Specifies the filesystem type for the mount volume. + * + * Optional. + * + * MountFlags: + * + * type: "array" + * + * description: | + * + * Flags to pass when mounting the volume. Optional. + * + * items: + * + * type: "string" + * BlockVolume: + * + * type: "object" + * + * description: | + * + * Options for using this volume as a Block-type volume. + * + * Intentionally empty. + */ + MountVolume: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Swarm Secrets that are passed to the CSI storage plugin when + * operating on this volume. + */ + Secrets: v.exactOptional( + v.array( + v.strictObject({ + /** + * Key is the name of the key of the key-value pair passed to + * the plugin. + */ + Key: v.exactOptional(v.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: v.exactOptional(v.string()), + }), + ), + ), + /** + * Requirements for the accessible topology of the volume. These + * fields are optional. For an in-depth description of what these + * fields mean, see the CSI specification. + */ + AccessibilityRequirements: v.exactOptional( + v.strictObject({ + /** + * A list of required topologies, at least one of which the + * volume must be accessible from. + */ + Requisite: v.exactOptional( + v.array(v.record(v.string(), v.unknown())), + ), + /** + * A list of topologies that the volume should attempt to be + * provisioned in. + */ + Preferred: v.exactOptional( + v.array(v.record(v.string(), v.unknown())), + ), + }), + ), + /** + * The desired capacity that the volume should be created with. If + * empty, the plugin will decide the capacity. + */ + CapacityRange: v.exactOptional( + v.strictObject({ + /** + * The volume must be at least this big. The value of 0 + * indicates an unspecified minimum + */ + RequiredBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The volume must not be bigger than this. The value of 0 + * indicates an unspecified maximum. + */ + LimitBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * The availability of the volume for use in tasks. + * - `active` The volume is fully available for scheduling on the cluster + * - `pause` No new workloads should use the volume, but existing workloads + * are not stopped. + * - `drain` All workloads using this volume should be stopped and + * rescheduled, and no new ones should be started. + */ + Availability: v.exactOptional( + v.picklist(["active", "pause", "drain"]), + ), + }), + ), + }), + ), +}); +export const volumeUpdateCommandParamsSchema = v.strictObject({ + name: v.string(), +}); +export const volumeUpdateCommandQuerySchema = v.strictObject({ + version: v.pipe(v.number(), v.integer()), +}); +export const volumeDeleteCommandParamsSchema = v.strictObject({ + name: v.string(), +}); +export const volumeDeleteCommandQuerySchema = v.strictObject({ + force: v.exactOptional(v.boolean()), +}); +export const volumePruneCommandQuerySchema = v.strictObject({ + filters: v.exactOptional(v.string()), +}); +export const networkListCommandQuerySchema = v.strictObject({ + filters: v.exactOptional(v.string()), +}); +export const networkInspectCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const networkInspectCommandQuerySchema = v.strictObject({ + verbose: v.exactOptional(v.boolean()), + scope: v.exactOptional(v.string()), +}); +export const networkDeleteCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const networkCreateCommandBodySchema = v.strictObject({ + /** + * The network's name. + */ + Name: v.string(), + /** + * Check for networks with duplicate names. Since Network is + * primarily keyed based on a random ID and not on the name, and + * network name is strictly a user-friendly alias to the network + * which is uniquely identified using ID, there is no guaranteed + * way to check for duplicates. CheckDuplicate is there to provide + * a best effort checking of any networks which has the same name + * but it is not guaranteed to catch all name collisions. + */ + CheckDuplicate: v.exactOptional(v.boolean()), + /** + * Name of the network driver plugin to use. + */ + Driver: v.exactOptional(v.string()), + /** + * The level at which the network exists (e.g. `swarm` for cluster-wide + * or `local` for machine level). + */ + Scope: v.exactOptional(v.string()), + /** + * Restrict external access to the network. + */ + Internal: v.exactOptional(v.boolean()), + /** + * Globally scoped network is manually attachable by regular + * containers from workers in swarm mode. + */ + Attachable: v.exactOptional(v.boolean()), + /** + * Ingress network is the network which provides the routing-mesh + * in swarm mode. + */ + Ingress: v.exactOptional(v.boolean()), + /** + * Creates a config-only network. Config-only networks are placeholder + * networks for network configurations to be used by other networks. + * Config-only networks cannot be used directly to run containers + * or services. + */ + ConfigOnly: v.exactOptional(v.boolean()), + /** + * The config-only network source to provide the configuration for + * this network. + */ + ConfigFrom: v.exactOptional( + v.strictObject({ + /** + * The name of the config-only network that provides the network's + * configuration. The specified network must be an existing config-only + * network. Only network names are allowed, not network IDs. + */ + Network: v.exactOptional(v.string()), + }), + ), + IPAM: v.exactOptional( + v.strictObject({ + /** + * Name of the IPAM driver to use. + */ + Driver: v.exactOptional(v.string()), + /** + * List of IPAM configuration options, specified as a map: + * + * ``` + * {"Subnet": , "IPRange": , "Gateway": , + * "AuxAddress": } + * ``` + */ + Config: v.exactOptional( + v.array( + v.strictObject({ + Subnet: v.exactOptional(v.string()), + IPRange: v.exactOptional(v.string()), + Gateway: v.exactOptional(v.string()), + AuxiliaryAddresses: v.exactOptional( + v.record(v.string(), v.unknown()), + ), + }), + ), + ), + /** + * Driver-specific options, specified as a map. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + /** + * Enable IPv6 on the network. + */ + EnableIPv6: v.exactOptional(v.boolean()), + /** + * Network specific options to be used by the drivers. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), +}); +export const networkConnectCommandBodySchema = v.strictObject({ + /** + * The ID or name of the container to connect to the network. + */ + Container: v.exactOptional(v.string()), + /** + * Configuration for a network endpoint. + */ + EndpointConfig: v.exactOptional( + v.strictObject({ + /** + * EndpointIPAMConfig represents an endpoint's IPAM configuration. + */ + IPAMConfig: v.exactOptional( + v.nullable( + v.strictObject({ + IPv4Address: v.exactOptional(v.string()), + IPv6Address: v.exactOptional(v.string()), + LinkLocalIPs: v.exactOptional(v.array(v.string())), + }), + ), + ), + Links: v.exactOptional(v.array(v.string())), + Aliases: v.exactOptional(v.array(v.string())), + /** + * Unique ID of the network. + */ + NetworkID: v.exactOptional(v.string()), + /** + * Unique ID for the service endpoint in a Sandbox. + */ + EndpointID: v.exactOptional(v.string()), + /** + * Gateway address for this network. + */ + Gateway: v.exactOptional(v.string()), + /** + * IPv4 address. + */ + IPAddress: v.exactOptional(v.string()), + /** + * Mask length of the IPv4 address. + */ + IPPrefixLen: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * IPv6 gateway address. + */ + IPv6Gateway: v.exactOptional(v.string()), + /** + * Global IPv6 address. + */ + GlobalIPv6Address: v.exactOptional(v.string()), + /** + * Mask length of the global IPv6 address. + */ + GlobalIPv6PrefixLen: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * MAC address for the endpoint on this network. + */ + MacAddress: v.exactOptional(v.string()), + /** + * DriverOpts is a mapping of driver options and values. These options + * are passed directly to the driver and are driver specific. + */ + DriverOpts: v.exactOptional( + v.nullable(v.record(v.string(), v.unknown())), + ), + }), + ), +}); +export const networkConnectCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const networkDisconnectCommandBodySchema = v.strictObject({ + /** + * The ID or name of the container to disconnect from the network. + */ + Container: v.exactOptional(v.string()), + /** + * Force the container to disconnect from the network. + */ + Force: v.exactOptional(v.boolean()), +}); +export const networkDisconnectCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const networkPruneCommandQuerySchema = v.strictObject({ + filters: v.exactOptional(v.string()), +}); +export const pluginListCommandQuerySchema = v.strictObject({ + filters: v.exactOptional(v.string()), +}); +export const getPluginPrivilegesCommandQuerySchema = v.strictObject({ + remote: v.string(), +}); +export const pluginPullCommandBodySchema = v.array( + v.strictObject({ + Name: v.exactOptional(v.string()), + Description: v.exactOptional(v.string()), + Value: v.exactOptional(v.array(v.string())), + }), +); +export const pluginPullCommandQuerySchema = v.strictObject({ + remote: v.string(), + name: v.exactOptional(v.string()), +}); +export const pluginInspectCommandParamsSchema = v.strictObject({ + name: v.string(), +}); +export const pluginDeleteCommandParamsSchema = v.strictObject({ + name: v.string(), +}); +export const pluginDeleteCommandQuerySchema = v.strictObject({ + force: v.exactOptional(v.boolean()), +}); +export const pluginEnableCommandParamsSchema = v.strictObject({ + name: v.string(), +}); +export const pluginEnableCommandQuerySchema = v.strictObject({ + timeout: v.exactOptional(v.pipe(v.number(), v.integer())), +}); +export const pluginDisableCommandParamsSchema = v.strictObject({ + name: v.string(), +}); +export const pluginDisableCommandQuerySchema = v.strictObject({ + force: v.exactOptional(v.boolean()), +}); +export const pluginUpgradeCommandBodySchema = v.array( + v.strictObject({ + Name: v.exactOptional(v.string()), + Description: v.exactOptional(v.string()), + Value: v.exactOptional(v.array(v.string())), + }), +); +export const pluginUpgradeCommandParamsSchema = v.strictObject({ + name: v.string(), +}); +export const pluginUpgradeCommandQuerySchema = v.strictObject({ + remote: v.string(), +}); +export const pluginCreateCommandQuerySchema = v.strictObject({ + name: v.string(), +}); +export const pluginPushCommandParamsSchema = v.strictObject({ + name: v.string(), +}); +export const pluginSetCommandBodySchema = v.array(v.string()); +export const pluginSetCommandParamsSchema = v.strictObject({ + name: v.string(), +}); +export const nodeListCommandQuerySchema = v.strictObject({ + filters: v.exactOptional(v.string()), +}); +export const nodeInspectCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const nodeDeleteCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const nodeDeleteCommandQuerySchema = v.strictObject({ + force: v.exactOptional(v.boolean()), +}); +export const nodeUpdateCommandBodySchema = v.strictObject({ + /** + * Name for the node. + */ + Name: v.exactOptional(v.string()), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Role of the node. + */ + Role: v.exactOptional(v.picklist(["worker", "manager"])), + /** + * Availability of the node. + */ + Availability: v.exactOptional(v.picklist(["active", "pause", "drain"])), +}); +export const nodeUpdateCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const nodeUpdateCommandQuerySchema = v.strictObject({ + version: v.pipe(v.number(), v.integer()), +}); +export const swarmInitCommandBodySchema = v.strictObject({ + /** + * Listen address used for inter-manager communication, as well + * as determining the networking interface used for the VXLAN + * Tunnel Endpoint (VTEP). This can either be an address/port + * combination in the form `192.168.1.1:4567`, or an interface + * followed by a port number, like `eth0:4567`. If the port number + * is omitted, the default swarm listening port is used. + */ + ListenAddr: v.exactOptional(v.string()), + /** + * Externally reachable address advertised to other nodes. This + * can either be an address/port combination in the form + * `192.168.1.1:4567`, or an interface followed by a port number, + * like `eth0:4567`. If the port number is omitted, the port + * number from the listen address is used. If `AdvertiseAddr` is + * not specified, it will be automatically detected when possible. + */ + AdvertiseAddr: v.exactOptional(v.string()), + /** + * Address or interface to use for data path traffic (format: + * ``), for example, `192.168.1.1`, or an interface, + * like `eth0`. If `DataPathAddr` is unspecified, the same address + * as `AdvertiseAddr` is used. + * + * The `DataPathAddr` specifies the address that global scope + * network drivers will publish towards other nodes in order to + * reach the containers running on this node. Using this parameter + * it is possible to separate the container data traffic from the + * management traffic of the cluster. + */ + DataPathAddr: v.exactOptional(v.string()), + /** + * DataPathPort specifies the data path port number for data traffic. + * Acceptable port range is 1024 to 49151. + * if no port is set or is set to 0, default port 4789 will be used. + */ + DataPathPort: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Default Address Pool specifies default subnet pools for global + * scope networks. + */ + DefaultAddrPool: v.exactOptional(v.array(v.string())), + /** + * Force creation of a new swarm. + */ + ForceNewCluster: v.exactOptional(v.boolean()), + /** + * SubnetSize specifies the subnet size of the networks created + * from the default subnet pool. + */ + SubnetSize: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * User modifiable swarm configuration. + */ + Spec: v.exactOptional( + v.strictObject({ + /** + * Name of the swarm. + */ + Name: v.exactOptional(v.string()), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Orchestration configuration. + */ + Orchestration: v.exactOptional( + v.nullable( + v.strictObject({ + /** + * The number of historic tasks to keep per instance or node. If + * negative, never remove completed or failed tasks. + */ + TaskHistoryRetentionLimit: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + }), + ), + ), + /** + * Raft configuration. + */ + Raft: v.exactOptional( + v.strictObject({ + /** + * The number of log entries between snapshots. + */ + SnapshotInterval: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The number of snapshots to keep beyond the current snapshot. + */ + KeepOldSnapshots: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The number of log entries to keep around to sync up slow followers + * after a snapshot is created. + */ + LogEntriesForSlowFollowers: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + /** + * The number of ticks that a follower will wait for a message from + * the leader before becoming a candidate and starting an election. + * `ElectionTick` must be greater than `HeartbeatTick`. + * + * A tick currently defaults to one second, so these translate + * directly to seconds currently, but this is NOT guaranteed. + */ + ElectionTick: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The number of ticks between heartbeats. Every HeartbeatTick ticks, + * the leader will send a heartbeat to the followers. + * + * A tick currently defaults to one second, so these translate + * directly to seconds currently, but this is NOT guaranteed. + */ + HeartbeatTick: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * Dispatcher configuration. + */ + Dispatcher: v.exactOptional( + v.nullable( + v.strictObject({ + /** + * The delay for an agent to send a heartbeat to the dispatcher. + */ + HeartbeatPeriod: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + ), + /** + * CA configuration. + */ + CAConfig: v.exactOptional( + v.nullable( + v.strictObject({ + /** + * The duration node certificates are issued for. + */ + NodeCertExpiry: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Configuration for forwarding signing requests to an external + * certificate authority. + */ + ExternalCAs: v.exactOptional( + v.array( + v.strictObject({ + /** + * Protocol for communication with the external CA (currently + * only `cfssl` is supported). + */ + Protocol: v.exactOptional(v.picklist(["cfssl"])), + /** + * URL where certificate signing requests should be sent. + */ + URL: v.exactOptional(v.string()), + /** + * An object with key/value pairs that are interpreted as + * protocol-specific options for the external CA driver. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * The root CA certificate (in PEM format) this external CA uses + * to issue TLS certificates (assumed to be to the current swarm + * root CA certificate if not provided). + */ + CACert: v.exactOptional(v.string()), + }), + ), + ), + /** + * The desired signing CA certificate for all swarm node TLS leaf + * certificates, in PEM format. + */ + SigningCACert: v.exactOptional(v.string()), + /** + * The desired signing CA key for all swarm node TLS leaf certificates, + * in PEM format. + */ + SigningCAKey: v.exactOptional(v.string()), + /** + * An integer whose purpose is to force swarm to generate a new + * signing CA certificate and key, if none have been specified in + * `SigningCACert` and `SigningCAKey` + */ + ForceRotate: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + ), + /** + * Parameters related to encryption-at-rest. + */ + EncryptionConfig: v.exactOptional( + v.strictObject({ + /** + * If set, generate a key and use it to lock data stored on the + * managers. + */ + AutoLockManagers: v.exactOptional(v.boolean()), + }), + ), + /** + * Defaults for creating tasks in this cluster. + */ + TaskDefaults: v.exactOptional( + v.strictObject({ + /** + * The log driver to use for tasks created in the orchestrator if + * unspecified by a service. + * + * Updating this value only affects new tasks. Existing tasks continue + * to use their previously configured log driver until recreated. + */ + LogDriver: v.exactOptional( + v.strictObject({ + /** + * The log driver to use as a default for new tasks. + */ + Name: v.exactOptional(v.string()), + /** + * Driver-specific options for the selected log driver, specified + * as key/value pairs. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + }), + ), + }), + ), +}); +export const swarmJoinCommandBodySchema = v.strictObject({ + /** + * Listen address used for inter-manager communication if the node + * gets promoted to manager, as well as determining the networking + * interface used for the VXLAN Tunnel Endpoint (VTEP). + */ + ListenAddr: v.exactOptional(v.string()), + /** + * Externally reachable address advertised to other nodes. This + * can either be an address/port combination in the form + * `192.168.1.1:4567`, or an interface followed by a port number, + * like `eth0:4567`. If the port number is omitted, the port + * number from the listen address is used. If `AdvertiseAddr` is + * not specified, it will be automatically detected when possible. + */ + AdvertiseAddr: v.exactOptional(v.string()), + /** + * Address or interface to use for data path traffic (format: + * ``), for example, `192.168.1.1`, or an interface, + * like `eth0`. If `DataPathAddr` is unspecified, the same address + * as `AdvertiseAddr` is used. + * + * The `DataPathAddr` specifies the address that global scope + * network drivers will publish towards other nodes in order to + * reach the containers running on this node. Using this parameter + * it is possible to separate the container data traffic from the + * management traffic of the cluster. + */ + DataPathAddr: v.exactOptional(v.string()), + /** + * Addresses of manager nodes already participating in the swarm. + */ + RemoteAddrs: v.exactOptional(v.array(v.string())), + /** + * Secret token for joining this swarm. + */ + JoinToken: v.exactOptional(v.string()), +}); +export const swarmLeaveCommandQuerySchema = v.strictObject({ + force: v.exactOptional(v.boolean()), +}); +export const swarmUpdateCommandBodySchema = v.strictObject({ + /** + * Name of the swarm. + */ + Name: v.exactOptional(v.string()), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Orchestration configuration. + */ + Orchestration: v.exactOptional( + v.nullable( + v.strictObject({ + /** + * The number of historic tasks to keep per instance or node. If + * negative, never remove completed or failed tasks. + */ + TaskHistoryRetentionLimit: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + }), + ), + ), + /** + * Raft configuration. + */ + Raft: v.exactOptional( + v.strictObject({ + /** + * The number of log entries between snapshots. + */ + SnapshotInterval: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The number of snapshots to keep beyond the current snapshot. + */ + KeepOldSnapshots: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The number of log entries to keep around to sync up slow followers + * after a snapshot is created. + */ + LogEntriesForSlowFollowers: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + /** + * The number of ticks that a follower will wait for a message from + * the leader before becoming a candidate and starting an election. + * `ElectionTick` must be greater than `HeartbeatTick`. + * + * A tick currently defaults to one second, so these translate + * directly to seconds currently, but this is NOT guaranteed. + */ + ElectionTick: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The number of ticks between heartbeats. Every HeartbeatTick ticks, + * the leader will send a heartbeat to the followers. + * + * A tick currently defaults to one second, so these translate + * directly to seconds currently, but this is NOT guaranteed. + */ + HeartbeatTick: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * Dispatcher configuration. + */ + Dispatcher: v.exactOptional( + v.nullable( + v.strictObject({ + /** + * The delay for an agent to send a heartbeat to the dispatcher. + */ + HeartbeatPeriod: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + ), + /** + * CA configuration. + */ + CAConfig: v.exactOptional( + v.nullable( + v.strictObject({ + /** + * The duration node certificates are issued for. + */ + NodeCertExpiry: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Configuration for forwarding signing requests to an external + * certificate authority. + */ + ExternalCAs: v.exactOptional( + v.array( + v.strictObject({ + /** + * Protocol for communication with the external CA (currently + * only `cfssl` is supported). + */ + Protocol: v.exactOptional(v.picklist(["cfssl"])), + /** + * URL where certificate signing requests should be sent. + */ + URL: v.exactOptional(v.string()), + /** + * An object with key/value pairs that are interpreted as + * protocol-specific options for the external CA driver. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * The root CA certificate (in PEM format) this external CA uses + * to issue TLS certificates (assumed to be to the current swarm + * root CA certificate if not provided). + */ + CACert: v.exactOptional(v.string()), + }), + ), + ), + /** + * The desired signing CA certificate for all swarm node TLS leaf + * certificates, in PEM format. + */ + SigningCACert: v.exactOptional(v.string()), + /** + * The desired signing CA key for all swarm node TLS leaf certificates, + * in PEM format. + */ + SigningCAKey: v.exactOptional(v.string()), + /** + * An integer whose purpose is to force swarm to generate a new + * signing CA certificate and key, if none have been specified in + * `SigningCACert` and `SigningCAKey` + */ + ForceRotate: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + ), + /** + * Parameters related to encryption-at-rest. + */ + EncryptionConfig: v.exactOptional( + v.strictObject({ + /** + * If set, generate a key and use it to lock data stored on the + * managers. + */ + AutoLockManagers: v.exactOptional(v.boolean()), + }), + ), + /** + * Defaults for creating tasks in this cluster. + */ + TaskDefaults: v.exactOptional( + v.strictObject({ + /** + * The log driver to use for tasks created in the orchestrator if + * unspecified by a service. + * + * Updating this value only affects new tasks. Existing tasks continue + * to use their previously configured log driver until recreated. + */ + LogDriver: v.exactOptional( + v.strictObject({ + /** + * The log driver to use as a default for new tasks. + */ + Name: v.exactOptional(v.string()), + /** + * Driver-specific options for the selected log driver, specified + * as key/value pairs. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + }), + ), +}); +export const swarmUpdateCommandQuerySchema = v.strictObject({ + version: v.pipe(v.number(), v.integer()), + rotateWorkerToken: v.exactOptional(v.boolean()), + rotateManagerToken: v.exactOptional(v.boolean()), + rotateManagerUnlockKey: v.exactOptional(v.boolean()), +}); +export const swarmUnlockCommandBodySchema = v.strictObject({ + /** + * The swarm's unlock key. + */ + UnlockKey: v.exactOptional(v.string()), +}); +export const serviceListCommandQuerySchema = v.strictObject({ + filters: v.exactOptional(v.string()), + status: v.exactOptional(v.boolean()), +}); +export const serviceCreateCommandBodySchema = v.intersect([ + v.strictObject({ + /** + * Name of the service. + */ + Name: v.exactOptional(v.string()), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * User modifiable task configuration. + */ + TaskTemplate: v.exactOptional( + v.strictObject({ + /** + * Plugin spec for the service. *(Experimental release only.)* + * + *


+ * + * > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are + * > mutually exclusive. PluginSpec is only used when the Runtime field + * > is set to `plugin`. NetworkAttachmentSpec is used when the Runtime + * > field is set to `attachment`. + */ + PluginSpec: v.exactOptional( + v.strictObject({ + /** + * The name or 'alias' to use for the plugin. + */ + Name: v.exactOptional(v.string()), + /** + * The plugin image reference to use. + */ + Remote: v.exactOptional(v.string()), + /** + * Disable the plugin once scheduled. + */ + Disabled: v.exactOptional(v.boolean()), + PluginPrivilege: v.exactOptional( + v.array( + v.strictObject({ + Name: v.exactOptional(v.string()), + Description: v.exactOptional(v.string()), + Value: v.exactOptional(v.array(v.string())), + }), + ), + ), + }), + ), + /** + * Container spec for the service. + * + *


+ * + * > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are + * > mutually exclusive. PluginSpec is only used when the Runtime field + * > is set to `plugin`. NetworkAttachmentSpec is used when the Runtime + * > field is set to `attachment`. + */ + ContainerSpec: v.exactOptional( + v.strictObject({ + /** + * The image name to use for the container + */ + Image: v.exactOptional(v.string()), + /** + * User-defined key/value data. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * The command to be run in the image. + */ + Command: v.exactOptional(v.array(v.string())), + /** + * Arguments to the command. + */ + Args: v.exactOptional(v.array(v.string())), + /** + * The hostname to use for the container, as a valid + * [RFC 1123](https://tools.ietf.org/html/rfc1123) hostname. + */ + Hostname: v.exactOptional(v.string()), + /** + * A list of environment variables in the form `VAR=value`. + */ + Env: v.exactOptional(v.array(v.string())), + /** + * The working directory for commands to run in. + */ + Dir: v.exactOptional(v.string()), + /** + * The user inside the container. + */ + User: v.exactOptional(v.string()), + /** + * A list of additional groups that the container process will run as. + */ + Groups: v.exactOptional(v.array(v.string())), + /** + * Security options for the container + */ + Privileges: v.exactOptional( + v.strictObject({ + /** + * CredentialSpec for managed service account (Windows only) + */ + CredentialSpec: v.exactOptional( + v.strictObject({ + /** + * Load credential spec from a Swarm Config with the given ID. + * The specified config must also be present in the Configs + * field with the Runtime property set. + * + *


+ * + * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + */ + Config: v.exactOptional(v.string()), + /** + * Load credential spec from this file. The file is read by + * the daemon, and must be present in the `CredentialSpecs` + * subdirectory in the docker data directory, which defaults + * to `C:\ProgramData\Docker\` on Windows. + * + * For example, specifying `spec.json` loads + * `C:\ProgramData\Docker\CredentialSpecs\spec.json`. + * + *


+ * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + */ + File: v.exactOptional(v.string()), + /** + * Load credential spec from this value in the Windows + * registry. The specified registry value must be located in: + * + * `HKLM\SOFTWARE\Microsoft\Windows + * NT\CurrentVersion\Virtualization\Containers\CredentialSpecs` + * + *


+ * + * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + */ + Registry: v.exactOptional(v.string()), + }), + ), + /** + * SELinux labels of the container + */ + SELinuxContext: v.exactOptional( + v.strictObject({ + /** + * Disable SELinux + */ + Disable: v.exactOptional(v.boolean()), + /** + * SELinux user label + */ + User: v.exactOptional(v.string()), + /** + * SELinux role label + */ + Role: v.exactOptional(v.string()), + /** + * SELinux type label + */ + Type: v.exactOptional(v.string()), + /** + * SELinux level label + */ + Level: v.exactOptional(v.string()), + }), + ), + }), + ), + /** + * Whether a pseudo-TTY should be allocated. + */ + TTY: v.exactOptional(v.boolean()), + /** + * Open `stdin` + */ + OpenStdin: v.exactOptional(v.boolean()), + /** + * Mount the container's root filesystem as read only. + */ + ReadOnly: v.exactOptional(v.boolean()), + /** + * Specification for mounts to be added to containers created as part + * of the service. + */ + Mounts: v.exactOptional( + v.array( + v.strictObject({ + /** + * Container path. + */ + Target: v.exactOptional(v.string()), + /** + * Mount source (e.g. a volume name, a host path). + */ + Source: v.exactOptional(v.string()), + /** + * The mount type. Available types: + * + * - `bind` Mounts a file or directory from the host into the container. Must + * exist prior to creating the container. + * - `volume` Creates a volume with the given name and options (or uses a + * pre-existing volume with the same name and options). These are **not** + * removed when the container is removed. + * - `tmpfs` Create a tmpfs with the given options. The mount source cannot be + * specified for tmpfs. + * - `npipe` Mounts a named pipe from the host into the container. Must exist + * prior to creating the container. + * - `cluster` a Swarm cluster volume + */ + Type: v.exactOptional( + v.picklist(["bind", "volume", "tmpfs", "npipe", "cluster"]), + ), + /** + * Whether the mount should be read-only. + */ + ReadOnly: v.exactOptional(v.boolean()), + /** + * The consistency requirement for the mount: `default`, `consistent`, + * `cached`, or `delegated`. + */ + Consistency: v.exactOptional(v.string()), + /** + * Optional configuration for the `bind` type. + */ + BindOptions: v.exactOptional( + v.strictObject({ + /** + * A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + */ + Propagation: v.exactOptional( + v.picklist([ + "private", + "rprivate", + "shared", + "rshared", + "slave", + "rslave", + ]), + ), + /** + * Disable recursive bind mount. + */ + NonRecursive: v.exactOptional(v.boolean()), + /** + * Create mount point on host if missing + */ + CreateMountpoint: v.exactOptional(v.boolean()), + }), + ), + /** + * Optional configuration for the `volume` type. + */ + VolumeOptions: v.exactOptional( + v.strictObject({ + /** + * Populate volume with data from the target. + */ + NoCopy: v.exactOptional(v.boolean()), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional( + v.record(v.string(), v.unknown()), + ), + /** + * Map of driver specific options + */ + DriverConfig: v.exactOptional( + v.strictObject({ + /** + * Name of the driver to use to create the volume. + */ + Name: v.exactOptional(v.string()), + /** + * key/value map of driver specific options. + */ + Options: v.exactOptional( + v.record(v.string(), v.unknown()), + ), + }), + ), + }), + ), + /** + * Optional configuration for the `tmpfs` type. + */ + TmpfsOptions: v.exactOptional( + v.strictObject({ + /** + * The size for the tmpfs mount in bytes. + */ + SizeBytes: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + /** + * The permission mode for the tmpfs mount in an integer. + */ + Mode: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + }), + ), + ), + /** + * Signal to stop the container. + */ + StopSignal: v.exactOptional(v.string()), + /** + * Amount of time to wait for the container to terminate before + * forcefully killing it. + */ + StopGracePeriod: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * A test to perform to check that the container is healthy. + */ + HealthCheck: v.exactOptional( + v.strictObject({ + /** + * The test to perform. Possible values are: + * + * - `[]` inherit healthcheck from image or parent image + * - `["NONE"]` disable healthcheck + * - `["CMD", args...]` exec arguments directly + * - `["CMD-SHELL", command]` run command with system's default shell + */ + Test: v.exactOptional(v.array(v.string())), + /** + * The time to wait between checks in nanoseconds. It should be 0 or at + * least 1000000 (1 ms). 0 means inherit. + */ + Interval: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The time to wait before considering the check to have hung. It should + * be 0 or at least 1000000 (1 ms). 0 means inherit. + */ + Timeout: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The number of consecutive failures needed to consider a container as + * unhealthy. 0 means inherit. + */ + Retries: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Start period for the container to initialize before starting + * health-retries countdown in nanoseconds. It should be 0 or at least + * 1000000 (1 ms). 0 means inherit. + */ + StartPeriod: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * A list of hostname/IP mappings to add to the container's `hosts` + * file. The format of extra hosts is specified in the + * [hosts(5)](http://man7.org/linux/man-pages/man5/hosts.5.html) + * man page: + * + * + * IP_address canonical_hostname [aliases...] + */ + Hosts: v.exactOptional(v.array(v.string())), + /** + * Specification for DNS related configurations in resolver configuration + * file (`resolv.conf`). + */ + DNSConfig: v.exactOptional( + v.strictObject({ + /** + * The IP addresses of the name servers. + */ + Nameservers: v.exactOptional(v.array(v.string())), + /** + * A search list for host-name lookup. + */ + Search: v.exactOptional(v.array(v.string())), + /** + * A list of internal resolver variables to be modified (e.g., + * `debug`, `ndots:3`, etc.). + */ + Options: v.exactOptional(v.array(v.string())), + }), + ), + /** + * Secrets contains references to zero or more secrets that will be + * exposed to the service. + */ + Secrets: v.exactOptional( + v.array( + v.strictObject({ + /** + * File represents a specific target that is backed by a file. + */ + File: v.exactOptional( + v.strictObject({ + /** + * Name represents the final filename in the filesystem. + */ + Name: v.exactOptional(v.string()), + /** + * UID represents the file UID. + */ + UID: v.exactOptional(v.string()), + /** + * GID represents the file GID. + */ + GID: v.exactOptional(v.string()), + /** + * Mode represents the FileMode of the file. + */ + Mode: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * SecretID represents the ID of the specific secret that we're + * referencing. + */ + SecretID: v.exactOptional(v.string()), + /** + * SecretName is the name of the secret that this references, + * but this is just provided for lookup/display purposes. The + * secret in the reference will be identified by its ID. + */ + SecretName: v.exactOptional(v.string()), + }), + ), + ), + /** + * Configs contains references to zero or more configs that will be + * exposed to the service. + */ + Configs: v.exactOptional( + v.array( + v.strictObject({ + /** + * File represents a specific target that is backed by a file. + * + *


+ * + * > **Note**: `Configs.File` and `Configs.Runtime` are mutually exclusive + */ + File: v.exactOptional( + v.strictObject({ + /** + * Name represents the final filename in the filesystem. + */ + Name: v.exactOptional(v.string()), + /** + * UID represents the file UID. + */ + UID: v.exactOptional(v.string()), + /** + * GID represents the file GID. + */ + GID: v.exactOptional(v.string()), + /** + * Mode represents the FileMode of the file. + */ + Mode: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * Runtime represents a target that is not mounted into the + * container but is used by the task + * + *


+ * + * > **Note**: `Configs.File` and `Configs.Runtime` are mutually + * > exclusive + */ + Runtime: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * ConfigID represents the ID of the specific config that we're + * referencing. + */ + ConfigID: v.exactOptional(v.string()), + /** + * ConfigName is the name of the config that this references, + * but this is just provided for lookup/display purposes. The + * config in the reference will be identified by its ID. + */ + ConfigName: v.exactOptional(v.string()), + }), + ), + ), + /** + * Isolation technology of the containers running the service. + * (Windows only) + */ + Isolation: v.exactOptional( + v.picklist(["default", "process", "hyperv", ""]), + ), + /** + * Run an init inside the container that forwards signals and reaps + * processes. This field is omitted if empty, and the default (as + * configured on the daemon) is used. + */ + Init: v.exactOptional(v.nullable(v.boolean())), + /** + * Set kernel namedspaced parameters (sysctls) in the container. + * The Sysctls option on services accepts the same sysctls as the + * are supported on containers. Note that while the same sysctls are + * supported, no guarantees or checks are made about their + * suitability for a clustered environment, and it's up to the user + * to determine whether a given sysctl will work properly in a + * Service. + */ + Sysctls: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * A list of kernel capabilities to add to the default set + * for the container. + */ + CapabilityAdd: v.exactOptional(v.array(v.string())), + /** + * A list of kernel capabilities to drop from the default set + * for the container. + */ + CapabilityDrop: v.exactOptional(v.array(v.string())), + /** + * A list of resource limits to set in the container. For example: `{"Name": + * "nofile", "Soft": 1024, "Hard": 2048}`" + */ + Ulimits: v.exactOptional( + v.array( + v.strictObject({ + /** + * Name of ulimit + */ + Name: v.exactOptional(v.string()), + /** + * Soft limit + */ + Soft: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Hard limit + */ + Hard: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + ), + }), + ), + /** + * Read-only spec type for non-swarm containers attached to swarm overlay + * networks. + * + *


+ * + * > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are + * > mutually exclusive. PluginSpec is only used when the Runtime field + * > is set to `plugin`. NetworkAttachmentSpec is used when the Runtime + * > field is set to `attachment`. + */ + NetworkAttachmentSpec: v.exactOptional( + v.strictObject({ + /** + * ID of the container represented by this task + */ + ContainerID: v.exactOptional(v.string()), + }), + ), + /** + * Resource requirements which apply to each individual container created + * as part of the service. + */ + Resources: v.exactOptional( + v.strictObject({ + /** + * An object describing a limit on resources which can be requested by a task. + */ + Limits: v.exactOptional( + v.strictObject({ + NanoCPUs: v.exactOptional(v.pipe(v.number(), v.integer())), + MemoryBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Limits the maximum number of PIDs in the container. Set `0` for unlimited. + */ + Pids: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * An object describing the resources which can be advertised by a node and + * requested by a task. + */ + Reservations: v.exactOptional( + v.strictObject({ + NanoCPUs: v.exactOptional(v.pipe(v.number(), v.integer())), + MemoryBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * User-defined resources can be either Integer resources (e.g, `SSD=3`) or + * String resources (e.g, `GPU=UUID1`). + */ + GenericResources: v.exactOptional( + v.array( + v.strictObject({ + NamedResourceSpec: v.exactOptional( + v.strictObject({ + Kind: v.exactOptional(v.string()), + Value: v.exactOptional(v.string()), + }), + ), + DiscreteResourceSpec: v.exactOptional( + v.strictObject({ + Kind: v.exactOptional(v.string()), + Value: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + }), + ), + }), + ), + ), + }), + ), + }), + ), + /** + * Specification for the restart policy which applies to containers + * created as part of this service. + */ + RestartPolicy: v.exactOptional( + v.strictObject({ + /** + * Condition for restart. + */ + Condition: v.exactOptional( + v.picklist(["none", "on-failure", "any"]), + ), + /** + * Delay between restart attempts. + */ + Delay: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Maximum attempts to restart a given container before giving up + * (default value is 0, which is ignored). + */ + MaxAttempts: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Windows is the time window used to evaluate the restart policy + * (default value is 0, which is unbounded). + */ + Window: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + Placement: v.exactOptional( + v.strictObject({ + /** + * An array of constraint expressions to limit the set of nodes where + * a task can be scheduled. Constraint expressions can either use a + * _match_ (`==`) or _exclude_ (`!=`) rule. Multiple constraints find + * nodes that satisfy every expression (AND match). Constraints can + * match node or Docker Engine labels as follows: + * + * node attribute | matches | example + * ---------------------|--------------------------------|----------------------------------------------- + * `node.id` | Node ID | + * `node.id==2ivku8v2gvtg4` + * `node.hostname` | Node hostname | + * `node.hostname!=node-2` + * `node.role` | Node role (`manager`/`worker`) | + * `node.role==manager` + * `node.platform.os` | Node operating system | + * `node.platform.os==windows` + * `node.platform.arch` | Node architecture | + * `node.platform.arch==x86_64` + * `node.labels` | User-defined node labels | + * `node.labels.security==high` + * `engine.labels` | Docker Engine's labels | + * `engine.labels.operatingsystem==ubuntu-14.04` + * + * `engine.labels` apply to Docker Engine labels like operating system, + * drivers, etc. Swarm administrators add `node.labels` for operational + * purposes by using the [`node update endpoint`](#operation/NodeUpdate). + */ + Constraints: v.exactOptional(v.array(v.string())), + /** + * Preferences provide a way to make the scheduler aware of factors + * such as topology. They are provided in order from highest to + * lowest precedence. + */ + Preferences: v.exactOptional( + v.array( + v.strictObject({ + Spread: v.exactOptional( + v.strictObject({ + /** + * label descriptor, such as `engine.labels.az`. + */ + SpreadDescriptor: v.exactOptional(v.string()), + }), + ), + }), + ), + ), + /** + * Maximum number of replicas for per node (default value is 0, which + * is unlimited) + */ + MaxReplicas: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Platforms stores all the platforms that the service's image can + * run on. This field is used in the platform filter for scheduling. + * If empty, then the platform filter is off, meaning there are no + * scheduling restrictions. + */ + Platforms: v.exactOptional( + v.array( + v.strictObject({ + /** + * Architecture represents the hardware architecture (for example, + * `x86_64`). + */ + Architecture: v.exactOptional(v.string()), + /** + * OS represents the Operating System (for example, `linux` or `windows`). + */ + OS: v.exactOptional(v.string()), + }), + ), + ), + }), + ), + /** + * A counter that triggers an update even if no relevant parameters have + * been changed. + */ + ForceUpdate: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Runtime is the type of runtime specified for the task executor. + */ + Runtime: v.exactOptional(v.string()), + /** + * Specifies which networks the service should attach to. + */ + Networks: v.exactOptional( + v.array( + v.strictObject({ + /** + * The target network for attachment. Must be a network name or ID. + */ + Target: v.exactOptional(v.string()), + /** + * Discoverable alternate names for the service on this network. + */ + Aliases: v.exactOptional(v.array(v.string())), + /** + * Driver attachment options for the network target. + */ + DriverOpts: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + ), + /** + * Specifies the log driver to use for tasks created from this spec. If + * not present, the default one for the swarm will be used, finally + * falling back to the engine default if not specified. + */ + LogDriver: v.exactOptional( + v.strictObject({ + Name: v.exactOptional(v.string()), + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + }), + ), + /** + * Scheduling mode for the service. + */ + Mode: v.exactOptional( + v.strictObject({ + Replicated: v.exactOptional( + v.strictObject({ + Replicas: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + Global: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * The mode used for services with a finite number of tasks that run + * to a completed state. + */ + ReplicatedJob: v.exactOptional( + v.strictObject({ + /** + * The maximum number of replicas to run simultaneously. + */ + MaxConcurrent: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The total number of replicas desired to reach the Completed + * state. If unset, will default to the value of `MaxConcurrent` + */ + TotalCompletions: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * The mode used for services which run a task to the completed state + * on each valid node. + */ + GlobalJob: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + /** + * Specification for the update strategy of the service. + */ + UpdateConfig: v.exactOptional( + v.strictObject({ + /** + * Maximum number of tasks to be updated in one iteration (0 means + * unlimited parallelism). + */ + Parallelism: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Amount of time between updates, in nanoseconds. + */ + Delay: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Action to take if an updated task fails to run, or stops running + * during the update. + */ + FailureAction: v.exactOptional( + v.picklist(["continue", "pause", "rollback"]), + ), + /** + * Amount of time to monitor each updated task for failures, in + * nanoseconds. + */ + Monitor: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The fraction of tasks that may fail during an update before the + * failure action is invoked, specified as a floating point number + * between 0 and 1. + */ + MaxFailureRatio: v.exactOptional(v.number()), + /** + * The order of operations when rolling out an updated task. Either + * the old task is shut down before the new task is started, or the + * new task is started before the old task is shut down. + */ + Order: v.exactOptional(v.picklist(["stop-first", "start-first"])), + }), + ), + /** + * Specification for the rollback strategy of the service. + */ + RollbackConfig: v.exactOptional( + v.strictObject({ + /** + * Maximum number of tasks to be rolled back in one iteration (0 means + * unlimited parallelism). + */ + Parallelism: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Amount of time between rollback iterations, in nanoseconds. + */ + Delay: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Action to take if an rolled back task fails to run, or stops + * running during the rollback. + */ + FailureAction: v.exactOptional(v.picklist(["continue", "pause"])), + /** + * Amount of time to monitor each rolled back task for failures, in + * nanoseconds. + */ + Monitor: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The fraction of tasks that may fail during a rollback before the + * failure action is invoked, specified as a floating point number + * between 0 and 1. + */ + MaxFailureRatio: v.exactOptional(v.number()), + /** + * The order of operations when rolling back a task. Either the old + * task is shut down before the new task is started, or the new task + * is started before the old task is shut down. + */ + Order: v.exactOptional(v.picklist(["stop-first", "start-first"])), + }), + ), + /** + * Specifies which networks the service should attach to. + */ + Networks: v.exactOptional( + v.array( + v.strictObject({ + /** + * The target network for attachment. Must be a network name or ID. + */ + Target: v.exactOptional(v.string()), + /** + * Discoverable alternate names for the service on this network. + */ + Aliases: v.exactOptional(v.array(v.string())), + /** + * Driver attachment options for the network target. + */ + DriverOpts: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + ), + /** + * Properties that can be configured to access and load balance a service. + */ + EndpointSpec: v.exactOptional( + v.strictObject({ + /** + * The mode of resolution to use for internal load balancing between tasks. + */ + Mode: v.exactOptional(v.picklist(["vip", "dnsrr"])), + /** + * List of exposed ports that this service is accessible on from the + * outside. Ports can only be provided if `vip` resolution mode is used. + */ + Ports: v.exactOptional( + v.array( + v.strictObject({ + Name: v.exactOptional(v.string()), + Protocol: v.exactOptional(v.picklist(["tcp", "udp", "sctp"])), + /** + * The port inside the container. + */ + TargetPort: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The port on the swarm hosts. + */ + PublishedPort: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The mode in which port is published. + * + *


+ * + * - "ingress" makes the target port accessible on every node, + * + * regardless of whether there is a task for the service running on + * + * that node or not. + * - "host" bypasses the routing mesh and publish the port directly on + * + * the swarm node where that service is running. + */ + PublishMode: v.exactOptional(v.picklist(["ingress", "host"])), + }), + ), + ), + }), + ), + }), + v.record(v.string(), v.unknown()), +]); +export const serviceInspectCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const serviceInspectCommandQuerySchema = v.strictObject({ + insertDefaults: v.exactOptional(v.boolean()), +}); +export const serviceDeleteCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const serviceUpdateCommandBodySchema = v.intersect([ + v.strictObject({ + /** + * Name of the service. + */ + Name: v.exactOptional(v.string()), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * User modifiable task configuration. + */ + TaskTemplate: v.exactOptional( + v.strictObject({ + /** + * Plugin spec for the service. *(Experimental release only.)* + * + *


+ * + * > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are + * > mutually exclusive. PluginSpec is only used when the Runtime field + * > is set to `plugin`. NetworkAttachmentSpec is used when the Runtime + * > field is set to `attachment`. + */ + PluginSpec: v.exactOptional( + v.strictObject({ + /** + * The name or 'alias' to use for the plugin. + */ + Name: v.exactOptional(v.string()), + /** + * The plugin image reference to use. + */ + Remote: v.exactOptional(v.string()), + /** + * Disable the plugin once scheduled. + */ + Disabled: v.exactOptional(v.boolean()), + PluginPrivilege: v.exactOptional( + v.array( + v.strictObject({ + Name: v.exactOptional(v.string()), + Description: v.exactOptional(v.string()), + Value: v.exactOptional(v.array(v.string())), + }), + ), + ), + }), + ), + /** + * Container spec for the service. + * + *


+ * + * > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are + * > mutually exclusive. PluginSpec is only used when the Runtime field + * > is set to `plugin`. NetworkAttachmentSpec is used when the Runtime + * > field is set to `attachment`. + */ + ContainerSpec: v.exactOptional( + v.strictObject({ + /** + * The image name to use for the container + */ + Image: v.exactOptional(v.string()), + /** + * User-defined key/value data. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * The command to be run in the image. + */ + Command: v.exactOptional(v.array(v.string())), + /** + * Arguments to the command. + */ + Args: v.exactOptional(v.array(v.string())), + /** + * The hostname to use for the container, as a valid + * [RFC 1123](https://tools.ietf.org/html/rfc1123) hostname. + */ + Hostname: v.exactOptional(v.string()), + /** + * A list of environment variables in the form `VAR=value`. + */ + Env: v.exactOptional(v.array(v.string())), + /** + * The working directory for commands to run in. + */ + Dir: v.exactOptional(v.string()), + /** + * The user inside the container. + */ + User: v.exactOptional(v.string()), + /** + * A list of additional groups that the container process will run as. + */ + Groups: v.exactOptional(v.array(v.string())), + /** + * Security options for the container + */ + Privileges: v.exactOptional( + v.strictObject({ + /** + * CredentialSpec for managed service account (Windows only) + */ + CredentialSpec: v.exactOptional( + v.strictObject({ + /** + * Load credential spec from a Swarm Config with the given ID. + * The specified config must also be present in the Configs + * field with the Runtime property set. + * + *


+ * + * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + */ + Config: v.exactOptional(v.string()), + /** + * Load credential spec from this file. The file is read by + * the daemon, and must be present in the `CredentialSpecs` + * subdirectory in the docker data directory, which defaults + * to `C:\ProgramData\Docker\` on Windows. + * + * For example, specifying `spec.json` loads + * `C:\ProgramData\Docker\CredentialSpecs\spec.json`. + * + *


+ * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + */ + File: v.exactOptional(v.string()), + /** + * Load credential spec from this value in the Windows + * registry. The specified registry value must be located in: + * + * `HKLM\SOFTWARE\Microsoft\Windows + * NT\CurrentVersion\Virtualization\Containers\CredentialSpecs` + * + *


+ * + * + * > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + * > and `CredentialSpec.Config` are mutually exclusive. + */ + Registry: v.exactOptional(v.string()), + }), + ), + /** + * SELinux labels of the container + */ + SELinuxContext: v.exactOptional( + v.strictObject({ + /** + * Disable SELinux + */ + Disable: v.exactOptional(v.boolean()), + /** + * SELinux user label + */ + User: v.exactOptional(v.string()), + /** + * SELinux role label + */ + Role: v.exactOptional(v.string()), + /** + * SELinux type label + */ + Type: v.exactOptional(v.string()), + /** + * SELinux level label + */ + Level: v.exactOptional(v.string()), + }), + ), + }), + ), + /** + * Whether a pseudo-TTY should be allocated. + */ + TTY: v.exactOptional(v.boolean()), + /** + * Open `stdin` + */ + OpenStdin: v.exactOptional(v.boolean()), + /** + * Mount the container's root filesystem as read only. + */ + ReadOnly: v.exactOptional(v.boolean()), + /** + * Specification for mounts to be added to containers created as part + * of the service. + */ + Mounts: v.exactOptional( + v.array( + v.strictObject({ + /** + * Container path. + */ + Target: v.exactOptional(v.string()), + /** + * Mount source (e.g. a volume name, a host path). + */ + Source: v.exactOptional(v.string()), + /** + * The mount type. Available types: + * + * - `bind` Mounts a file or directory from the host into the container. Must + * exist prior to creating the container. + * - `volume` Creates a volume with the given name and options (or uses a + * pre-existing volume with the same name and options). These are **not** + * removed when the container is removed. + * - `tmpfs` Create a tmpfs with the given options. The mount source cannot be + * specified for tmpfs. + * - `npipe` Mounts a named pipe from the host into the container. Must exist + * prior to creating the container. + * - `cluster` a Swarm cluster volume + */ + Type: v.exactOptional( + v.picklist(["bind", "volume", "tmpfs", "npipe", "cluster"]), + ), + /** + * Whether the mount should be read-only. + */ + ReadOnly: v.exactOptional(v.boolean()), + /** + * The consistency requirement for the mount: `default`, `consistent`, + * `cached`, or `delegated`. + */ + Consistency: v.exactOptional(v.string()), + /** + * Optional configuration for the `bind` type. + */ + BindOptions: v.exactOptional( + v.strictObject({ + /** + * A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + */ + Propagation: v.exactOptional( + v.picklist([ + "private", + "rprivate", + "shared", + "rshared", + "slave", + "rslave", + ]), + ), + /** + * Disable recursive bind mount. + */ + NonRecursive: v.exactOptional(v.boolean()), + /** + * Create mount point on host if missing + */ + CreateMountpoint: v.exactOptional(v.boolean()), + }), + ), + /** + * Optional configuration for the `volume` type. + */ + VolumeOptions: v.exactOptional( + v.strictObject({ + /** + * Populate volume with data from the target. + */ + NoCopy: v.exactOptional(v.boolean()), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional( + v.record(v.string(), v.unknown()), + ), + /** + * Map of driver specific options + */ + DriverConfig: v.exactOptional( + v.strictObject({ + /** + * Name of the driver to use to create the volume. + */ + Name: v.exactOptional(v.string()), + /** + * key/value map of driver specific options. + */ + Options: v.exactOptional( + v.record(v.string(), v.unknown()), + ), + }), + ), + }), + ), + /** + * Optional configuration for the `tmpfs` type. + */ + TmpfsOptions: v.exactOptional( + v.strictObject({ + /** + * The size for the tmpfs mount in bytes. + */ + SizeBytes: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + /** + * The permission mode for the tmpfs mount in an integer. + */ + Mode: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + }), + ), + ), + /** + * Signal to stop the container. + */ + StopSignal: v.exactOptional(v.string()), + /** + * Amount of time to wait for the container to terminate before + * forcefully killing it. + */ + StopGracePeriod: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * A test to perform to check that the container is healthy. + */ + HealthCheck: v.exactOptional( + v.strictObject({ + /** + * The test to perform. Possible values are: + * + * - `[]` inherit healthcheck from image or parent image + * - `["NONE"]` disable healthcheck + * - `["CMD", args...]` exec arguments directly + * - `["CMD-SHELL", command]` run command with system's default shell + */ + Test: v.exactOptional(v.array(v.string())), + /** + * The time to wait between checks in nanoseconds. It should be 0 or at + * least 1000000 (1 ms). 0 means inherit. + */ + Interval: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The time to wait before considering the check to have hung. It should + * be 0 or at least 1000000 (1 ms). 0 means inherit. + */ + Timeout: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The number of consecutive failures needed to consider a container as + * unhealthy. 0 means inherit. + */ + Retries: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Start period for the container to initialize before starting + * health-retries countdown in nanoseconds. It should be 0 or at least + * 1000000 (1 ms). 0 means inherit. + */ + StartPeriod: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * A list of hostname/IP mappings to add to the container's `hosts` + * file. The format of extra hosts is specified in the + * [hosts(5)](http://man7.org/linux/man-pages/man5/hosts.5.html) + * man page: + * + * + * IP_address canonical_hostname [aliases...] + */ + Hosts: v.exactOptional(v.array(v.string())), + /** + * Specification for DNS related configurations in resolver configuration + * file (`resolv.conf`). + */ + DNSConfig: v.exactOptional( + v.strictObject({ + /** + * The IP addresses of the name servers. + */ + Nameservers: v.exactOptional(v.array(v.string())), + /** + * A search list for host-name lookup. + */ + Search: v.exactOptional(v.array(v.string())), + /** + * A list of internal resolver variables to be modified (e.g., + * `debug`, `ndots:3`, etc.). + */ + Options: v.exactOptional(v.array(v.string())), + }), + ), + /** + * Secrets contains references to zero or more secrets that will be + * exposed to the service. + */ + Secrets: v.exactOptional( + v.array( + v.strictObject({ + /** + * File represents a specific target that is backed by a file. + */ + File: v.exactOptional( + v.strictObject({ + /** + * Name represents the final filename in the filesystem. + */ + Name: v.exactOptional(v.string()), + /** + * UID represents the file UID. + */ + UID: v.exactOptional(v.string()), + /** + * GID represents the file GID. + */ + GID: v.exactOptional(v.string()), + /** + * Mode represents the FileMode of the file. + */ + Mode: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * SecretID represents the ID of the specific secret that we're + * referencing. + */ + SecretID: v.exactOptional(v.string()), + /** + * SecretName is the name of the secret that this references, + * but this is just provided for lookup/display purposes. The + * secret in the reference will be identified by its ID. + */ + SecretName: v.exactOptional(v.string()), + }), + ), + ), + /** + * Configs contains references to zero or more configs that will be + * exposed to the service. + */ + Configs: v.exactOptional( + v.array( + v.strictObject({ + /** + * File represents a specific target that is backed by a file. + * + *


+ * + * > **Note**: `Configs.File` and `Configs.Runtime` are mutually exclusive + */ + File: v.exactOptional( + v.strictObject({ + /** + * Name represents the final filename in the filesystem. + */ + Name: v.exactOptional(v.string()), + /** + * UID represents the file UID. + */ + UID: v.exactOptional(v.string()), + /** + * GID represents the file GID. + */ + GID: v.exactOptional(v.string()), + /** + * Mode represents the FileMode of the file. + */ + Mode: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * Runtime represents a target that is not mounted into the + * container but is used by the task + * + *


+ * + * > **Note**: `Configs.File` and `Configs.Runtime` are mutually + * > exclusive + */ + Runtime: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * ConfigID represents the ID of the specific config that we're + * referencing. + */ + ConfigID: v.exactOptional(v.string()), + /** + * ConfigName is the name of the config that this references, + * but this is just provided for lookup/display purposes. The + * config in the reference will be identified by its ID. + */ + ConfigName: v.exactOptional(v.string()), + }), + ), + ), + /** + * Isolation technology of the containers running the service. + * (Windows only) + */ + Isolation: v.exactOptional( + v.picklist(["default", "process", "hyperv", ""]), + ), + /** + * Run an init inside the container that forwards signals and reaps + * processes. This field is omitted if empty, and the default (as + * configured on the daemon) is used. + */ + Init: v.exactOptional(v.nullable(v.boolean())), + /** + * Set kernel namedspaced parameters (sysctls) in the container. + * The Sysctls option on services accepts the same sysctls as the + * are supported on containers. Note that while the same sysctls are + * supported, no guarantees or checks are made about their + * suitability for a clustered environment, and it's up to the user + * to determine whether a given sysctl will work properly in a + * Service. + */ + Sysctls: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * A list of kernel capabilities to add to the default set + * for the container. + */ + CapabilityAdd: v.exactOptional(v.array(v.string())), + /** + * A list of kernel capabilities to drop from the default set + * for the container. + */ + CapabilityDrop: v.exactOptional(v.array(v.string())), + /** + * A list of resource limits to set in the container. For example: `{"Name": + * "nofile", "Soft": 1024, "Hard": 2048}`" + */ + Ulimits: v.exactOptional( + v.array( + v.strictObject({ + /** + * Name of ulimit + */ + Name: v.exactOptional(v.string()), + /** + * Soft limit + */ + Soft: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Hard limit + */ + Hard: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + ), + }), + ), + /** + * Read-only spec type for non-swarm containers attached to swarm overlay + * networks. + * + *


+ * + * > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are + * > mutually exclusive. PluginSpec is only used when the Runtime field + * > is set to `plugin`. NetworkAttachmentSpec is used when the Runtime + * > field is set to `attachment`. + */ + NetworkAttachmentSpec: v.exactOptional( + v.strictObject({ + /** + * ID of the container represented by this task + */ + ContainerID: v.exactOptional(v.string()), + }), + ), + /** + * Resource requirements which apply to each individual container created + * as part of the service. + */ + Resources: v.exactOptional( + v.strictObject({ + /** + * An object describing a limit on resources which can be requested by a task. + */ + Limits: v.exactOptional( + v.strictObject({ + NanoCPUs: v.exactOptional(v.pipe(v.number(), v.integer())), + MemoryBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Limits the maximum number of PIDs in the container. Set `0` for unlimited. + */ + Pids: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * An object describing the resources which can be advertised by a node and + * requested by a task. + */ + Reservations: v.exactOptional( + v.strictObject({ + NanoCPUs: v.exactOptional(v.pipe(v.number(), v.integer())), + MemoryBytes: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * User-defined resources can be either Integer resources (e.g, `SSD=3`) or + * String resources (e.g, `GPU=UUID1`). + */ + GenericResources: v.exactOptional( + v.array( + v.strictObject({ + NamedResourceSpec: v.exactOptional( + v.strictObject({ + Kind: v.exactOptional(v.string()), + Value: v.exactOptional(v.string()), + }), + ), + DiscreteResourceSpec: v.exactOptional( + v.strictObject({ + Kind: v.exactOptional(v.string()), + Value: v.exactOptional( + v.pipe(v.number(), v.integer()), + ), + }), + ), + }), + ), + ), + }), + ), + }), + ), + /** + * Specification for the restart policy which applies to containers + * created as part of this service. + */ + RestartPolicy: v.exactOptional( + v.strictObject({ + /** + * Condition for restart. + */ + Condition: v.exactOptional( + v.picklist(["none", "on-failure", "any"]), + ), + /** + * Delay between restart attempts. + */ + Delay: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Maximum attempts to restart a given container before giving up + * (default value is 0, which is ignored). + */ + MaxAttempts: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Windows is the time window used to evaluate the restart policy + * (default value is 0, which is unbounded). + */ + Window: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + Placement: v.exactOptional( + v.strictObject({ + /** + * An array of constraint expressions to limit the set of nodes where + * a task can be scheduled. Constraint expressions can either use a + * _match_ (`==`) or _exclude_ (`!=`) rule. Multiple constraints find + * nodes that satisfy every expression (AND match). Constraints can + * match node or Docker Engine labels as follows: + * + * node attribute | matches | example + * ---------------------|--------------------------------|----------------------------------------------- + * `node.id` | Node ID | + * `node.id==2ivku8v2gvtg4` + * `node.hostname` | Node hostname | + * `node.hostname!=node-2` + * `node.role` | Node role (`manager`/`worker`) | + * `node.role==manager` + * `node.platform.os` | Node operating system | + * `node.platform.os==windows` + * `node.platform.arch` | Node architecture | + * `node.platform.arch==x86_64` + * `node.labels` | User-defined node labels | + * `node.labels.security==high` + * `engine.labels` | Docker Engine's labels | + * `engine.labels.operatingsystem==ubuntu-14.04` + * + * `engine.labels` apply to Docker Engine labels like operating system, + * drivers, etc. Swarm administrators add `node.labels` for operational + * purposes by using the [`node update endpoint`](#operation/NodeUpdate). + */ + Constraints: v.exactOptional(v.array(v.string())), + /** + * Preferences provide a way to make the scheduler aware of factors + * such as topology. They are provided in order from highest to + * lowest precedence. + */ + Preferences: v.exactOptional( + v.array( + v.strictObject({ + Spread: v.exactOptional( + v.strictObject({ + /** + * label descriptor, such as `engine.labels.az`. + */ + SpreadDescriptor: v.exactOptional(v.string()), + }), + ), + }), + ), + ), + /** + * Maximum number of replicas for per node (default value is 0, which + * is unlimited) + */ + MaxReplicas: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Platforms stores all the platforms that the service's image can + * run on. This field is used in the platform filter for scheduling. + * If empty, then the platform filter is off, meaning there are no + * scheduling restrictions. + */ + Platforms: v.exactOptional( + v.array( + v.strictObject({ + /** + * Architecture represents the hardware architecture (for example, + * `x86_64`). + */ + Architecture: v.exactOptional(v.string()), + /** + * OS represents the Operating System (for example, `linux` or `windows`). + */ + OS: v.exactOptional(v.string()), + }), + ), + ), + }), + ), + /** + * A counter that triggers an update even if no relevant parameters have + * been changed. + */ + ForceUpdate: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Runtime is the type of runtime specified for the task executor. + */ + Runtime: v.exactOptional(v.string()), + /** + * Specifies which networks the service should attach to. + */ + Networks: v.exactOptional( + v.array( + v.strictObject({ + /** + * The target network for attachment. Must be a network name or ID. + */ + Target: v.exactOptional(v.string()), + /** + * Discoverable alternate names for the service on this network. + */ + Aliases: v.exactOptional(v.array(v.string())), + /** + * Driver attachment options for the network target. + */ + DriverOpts: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + ), + /** + * Specifies the log driver to use for tasks created from this spec. If + * not present, the default one for the swarm will be used, finally + * falling back to the engine default if not specified. + */ + LogDriver: v.exactOptional( + v.strictObject({ + Name: v.exactOptional(v.string()), + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + }), + ), + /** + * Scheduling mode for the service. + */ + Mode: v.exactOptional( + v.strictObject({ + Replicated: v.exactOptional( + v.strictObject({ + Replicas: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + Global: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * The mode used for services with a finite number of tasks that run + * to a completed state. + */ + ReplicatedJob: v.exactOptional( + v.strictObject({ + /** + * The maximum number of replicas to run simultaneously. + */ + MaxConcurrent: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The total number of replicas desired to reach the Completed + * state. If unset, will default to the value of `MaxConcurrent` + */ + TotalCompletions: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + /** + * The mode used for services which run a task to the completed state + * on each valid node. + */ + GlobalJob: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + /** + * Specification for the update strategy of the service. + */ + UpdateConfig: v.exactOptional( + v.strictObject({ + /** + * Maximum number of tasks to be updated in one iteration (0 means + * unlimited parallelism). + */ + Parallelism: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Amount of time between updates, in nanoseconds. + */ + Delay: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Action to take if an updated task fails to run, or stops running + * during the update. + */ + FailureAction: v.exactOptional( + v.picklist(["continue", "pause", "rollback"]), + ), + /** + * Amount of time to monitor each updated task for failures, in + * nanoseconds. + */ + Monitor: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The fraction of tasks that may fail during an update before the + * failure action is invoked, specified as a floating point number + * between 0 and 1. + */ + MaxFailureRatio: v.exactOptional(v.number()), + /** + * The order of operations when rolling out an updated task. Either + * the old task is shut down before the new task is started, or the + * new task is started before the old task is shut down. + */ + Order: v.exactOptional(v.picklist(["stop-first", "start-first"])), + }), + ), + /** + * Specification for the rollback strategy of the service. + */ + RollbackConfig: v.exactOptional( + v.strictObject({ + /** + * Maximum number of tasks to be rolled back in one iteration (0 means + * unlimited parallelism). + */ + Parallelism: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Amount of time between rollback iterations, in nanoseconds. + */ + Delay: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Action to take if an rolled back task fails to run, or stops + * running during the rollback. + */ + FailureAction: v.exactOptional(v.picklist(["continue", "pause"])), + /** + * Amount of time to monitor each rolled back task for failures, in + * nanoseconds. + */ + Monitor: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The fraction of tasks that may fail during a rollback before the + * failure action is invoked, specified as a floating point number + * between 0 and 1. + */ + MaxFailureRatio: v.exactOptional(v.number()), + /** + * The order of operations when rolling back a task. Either the old + * task is shut down before the new task is started, or the new task + * is started before the old task is shut down. + */ + Order: v.exactOptional(v.picklist(["stop-first", "start-first"])), + }), + ), + /** + * Specifies which networks the service should attach to. + */ + Networks: v.exactOptional( + v.array( + v.strictObject({ + /** + * The target network for attachment. Must be a network name or ID. + */ + Target: v.exactOptional(v.string()), + /** + * Discoverable alternate names for the service on this network. + */ + Aliases: v.exactOptional(v.array(v.string())), + /** + * Driver attachment options for the network target. + */ + DriverOpts: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + ), + /** + * Properties that can be configured to access and load balance a service. + */ + EndpointSpec: v.exactOptional( + v.strictObject({ + /** + * The mode of resolution to use for internal load balancing between tasks. + */ + Mode: v.exactOptional(v.picklist(["vip", "dnsrr"])), + /** + * List of exposed ports that this service is accessible on from the + * outside. Ports can only be provided if `vip` resolution mode is used. + */ + Ports: v.exactOptional( + v.array( + v.strictObject({ + Name: v.exactOptional(v.string()), + Protocol: v.exactOptional(v.picklist(["tcp", "udp", "sctp"])), + /** + * The port inside the container. + */ + TargetPort: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The port on the swarm hosts. + */ + PublishedPort: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The mode in which port is published. + * + *


+ * + * - "ingress" makes the target port accessible on every node, + * + * regardless of whether there is a task for the service running on + * + * that node or not. + * - "host" bypasses the routing mesh and publish the port directly on + * + * the swarm node where that service is running. + */ + PublishMode: v.exactOptional(v.picklist(["ingress", "host"])), + }), + ), + ), + }), + ), + }), + v.record(v.string(), v.unknown()), +]); +export const serviceUpdateCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const serviceUpdateCommandQuerySchema = v.strictObject({ + version: v.pipe(v.number(), v.integer()), + registryAuthFrom: v.exactOptional(v.picklist(["spec", "previous-spec"])), + rollback: v.exactOptional(v.string()), +}); +export const serviceLogsCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const serviceLogsCommandQuerySchema = v.strictObject({ + details: v.exactOptional(v.boolean()), + follow: v.exactOptional(v.boolean()), + stdout: v.exactOptional(v.boolean()), + stderr: v.exactOptional(v.boolean()), + since: v.exactOptional(v.pipe(v.number(), v.integer())), + timestamps: v.exactOptional(v.boolean()), + tail: v.exactOptional(v.string()), +}); +export const taskListCommandQuerySchema = v.strictObject({ + filters: v.exactOptional(v.string()), +}); +export const taskInspectCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const taskLogsCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const taskLogsCommandQuerySchema = v.strictObject({ + details: v.exactOptional(v.boolean()), + follow: v.exactOptional(v.boolean()), + stdout: v.exactOptional(v.boolean()), + stderr: v.exactOptional(v.boolean()), + since: v.exactOptional(v.pipe(v.number(), v.integer())), + timestamps: v.exactOptional(v.boolean()), + tail: v.exactOptional(v.string()), +}); +export const secretListCommandQuerySchema = v.strictObject({ + filters: v.exactOptional(v.string()), +}); +export const secretCreateCommandBodySchema = v.intersect([ + v.strictObject({ + /** + * User-defined name of the secret. + */ + Name: v.exactOptional(v.string()), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Base64-url-safe-encoded ([RFC + * 4648](https://tools.ietf.org/html/rfc4648#section-5)) + * data to store as secret. + * + * This field is only used to _create_ a secret, and is not returned by + * other endpoints. + */ + Data: v.exactOptional(v.string()), + /** + * Driver represents a driver (network, logging, secrets). + */ + Driver: v.exactOptional( + v.strictObject({ + /** + * Name of the driver. + */ + Name: v.string(), + /** + * Key/value map of driver-specific options. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + /** + * Driver represents a driver (network, logging, secrets). + */ + Templating: v.exactOptional( + v.strictObject({ + /** + * Name of the driver. + */ + Name: v.string(), + /** + * Key/value map of driver-specific options. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + }), + v.record(v.string(), v.unknown()), +]); +export const secretInspectCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const secretDeleteCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const secretUpdateCommandBodySchema = v.strictObject({ + /** + * User-defined name of the secret. + */ + Name: v.exactOptional(v.string()), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Base64-url-safe-encoded ([RFC + * 4648](https://tools.ietf.org/html/rfc4648#section-5)) + * data to store as secret. + * + * This field is only used to _create_ a secret, and is not returned by + * other endpoints. + */ + Data: v.exactOptional(v.string()), + /** + * Driver represents a driver (network, logging, secrets). + */ + Driver: v.exactOptional( + v.strictObject({ + /** + * Name of the driver. + */ + Name: v.string(), + /** + * Key/value map of driver-specific options. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + /** + * Driver represents a driver (network, logging, secrets). + */ + Templating: v.exactOptional( + v.strictObject({ + /** + * Name of the driver. + */ + Name: v.string(), + /** + * Key/value map of driver-specific options. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), +}); +export const secretUpdateCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const secretUpdateCommandQuerySchema = v.strictObject({ + version: v.pipe(v.number(), v.integer()), +}); +export const configListCommandQuerySchema = v.strictObject({ + filters: v.exactOptional(v.string()), +}); +export const configCreateCommandBodySchema = v.intersect([ + v.strictObject({ + /** + * User-defined name of the config. + */ + Name: v.exactOptional(v.string()), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Base64-url-safe-encoded ([RFC + * 4648](https://tools.ietf.org/html/rfc4648#section-5)) + * config data. + */ + Data: v.exactOptional(v.string()), + /** + * Driver represents a driver (network, logging, secrets). + */ + Templating: v.exactOptional( + v.strictObject({ + /** + * Name of the driver. + */ + Name: v.string(), + /** + * Key/value map of driver-specific options. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + }), + v.record(v.string(), v.unknown()), +]); +export const configInspectCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const configDeleteCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const configUpdateCommandBodySchema = v.strictObject({ + /** + * User-defined name of the config. + */ + Name: v.exactOptional(v.string()), + /** + * User-defined key/value metadata. + */ + Labels: v.exactOptional(v.record(v.string(), v.unknown())), + /** + * Base64-url-safe-encoded ([RFC + * 4648](https://tools.ietf.org/html/rfc4648#section-5)) + * config data. + */ + Data: v.exactOptional(v.string()), + /** + * Driver represents a driver (network, logging, secrets). + */ + Templating: v.exactOptional( + v.strictObject({ + /** + * Name of the driver. + */ + Name: v.string(), + /** + * Key/value map of driver-specific options. + */ + Options: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), +}); +export const configUpdateCommandParamsSchema = v.strictObject({ + id: v.string(), +}); +export const configUpdateCommandQuerySchema = v.strictObject({ + version: v.pipe(v.number(), v.integer()), +}); +export const distributionInspectCommandParamsSchema = v.strictObject({ + name: v.string(), +}); diff --git a/__tests__/fixtures/openai.json b/__tests__/fixtures/openai.json index edecaa9..d92b6a3 100644 --- a/__tests__/fixtures/openai.json +++ b/__tests__/fixtures/openai.json @@ -1,16914 +1,15331 @@ { - "openapi": "3.0.0", - "info": { - "title": "OpenAI API", - "description": "The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details.", - "version": "2.3.0", - "termsOfService": "https://openai.com/policies/terms-of-use", - "contact": { - "name": "OpenAI Support", - "url": "https://help.openai.com/" - }, - "license": { - "name": "MIT", - "url": "https://github.com/openai/openai-openapi/blob/master/LICENSE" - } - }, - "servers": [ - { - "url": "https://api.openai.com/v1" - } - ], - "tags": [ - { - "name": "Assistants", - "description": "Build Assistants that can call models and use tools." - }, - { - "name": "Audio", - "description": "Turn audio into text or text into audio." - }, - { - "name": "Chat", - "description": "Given a list of messages comprising a conversation, the model will return a response." - }, - { - "name": "Completions", - "description": "Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position." - }, - { - "name": "Embeddings", - "description": "Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms." - }, - { - "name": "Fine-tuning", - "description": "Manage fine-tuning jobs to tailor a model to your specific training data." - }, - { - "name": "Batch", - "description": "Create large batches of API requests to run asynchronously." - }, - { - "name": "Files", - "description": "Files are used to upload documents that can be used with features like Assistants and Fine-tuning." - }, - { - "name": "Uploads", - "description": "Use Uploads to upload large files in multiple parts." - }, - { - "name": "Images", - "description": "Given a prompt and/or an input image, the model will generate a new image." - }, - { - "name": "Models", - "description": "List and describe the various models available in the API." - }, - { - "name": "Moderations", - "description": "Given text and/or image inputs, classifies if those inputs are potentially harmful." - }, - { - "name": "Audit Logs", - "description": "List user actions and configuration changes within this organization." - } - ], - "paths": { - "/chat/completions": { - "post": { - "operationId": "createChatCompletion", - "tags": [ - "Chat" - ], - "summary": "Creates a model response for the given chat conversation.", - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateChatCompletionRequest" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateChatCompletionResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Create chat completion", - "group": "chat", - "returns": "Returns a [chat completion](/docs/api-reference/chat/object) object, or a streamed sequence of [chat completion chunk](/docs/api-reference/chat/streaming) objects if the request is streamed.\n", - "path": "create", - "examples": [ - { - "title": "Default", - "request": { - "curl": "curl https://api.openai.com/v1/chat/completions \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"VAR_model_id\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are a helpful assistant.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Hello!\"\n }\n ]\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\ncompletion = client.chat.completions.create(\n model=\"VAR_model_id\",\n messages=[\n {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n {\"role\": \"user\", \"content\": \"Hello!\"}\n ]\n)\n\nprint(completion.choices[0].message)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const completion = await openai.chat.completions.create({\n messages: [{ role: \"system\", content: \"You are a helpful assistant.\" }],\n model: \"VAR_model_id\",\n });\n\n console.log(completion.choices[0]);\n}\n\nmain();" - }, - "response": "{\n \"id\": \"chatcmpl-123\",\n \"object\": \"chat.completion\",\n \"created\": 1677652288,\n \"model\": \"gpt-4o-mini\",\n \"system_fingerprint\": \"fp_44709d6fcb\",\n \"choices\": [{\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": \"\\n\\nHello there, how may I assist you today?\",\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }],\n \"usage\": {\n \"prompt_tokens\": 9,\n \"completion_tokens\": 12,\n \"total_tokens\": 21,\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0\n }\n }\n}\n" - }, - { - "title": "Image input", - "request": { - "curl": "curl https://api.openai.com/v1/chat/completions \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-4o\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"What'\\''s in this image?\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": {\n \"url\": \"https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg\"\n }\n }\n ]\n }\n ],\n \"max_tokens\": 300\n }'\n", - "python": "from openai import OpenAI\n\nclient = OpenAI()\n\nresponse = client.chat.completions.create(\n model=\"gpt-4o\",\n messages=[\n {\n \"role\": \"user\",\n \"content\": [\n {\"type\": \"text\", \"text\": \"What's in this image?\"},\n {\n \"type\": \"image_url\",\n \"image_url\": {\n \"url\": \"https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg\",\n }\n },\n ],\n }\n ],\n max_tokens=300,\n)\n\nprint(response.choices[0])\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const response = await openai.chat.completions.create({\n model: \"gpt-4o\",\n messages: [\n {\n role: \"user\",\n content: [\n { type: \"text\", text: \"What's in this image?\" },\n {\n type: \"image_url\",\n image_url: {\n \"url\": \"https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg\",\n },\n }\n ],\n },\n ],\n });\n console.log(response.choices[0]);\n}\nmain();" - }, - "response": "{\n \"id\": \"chatcmpl-123\",\n \"object\": \"chat.completion\",\n \"created\": 1677652288,\n \"model\": \"gpt-4o-mini\",\n \"system_fingerprint\": \"fp_44709d6fcb\",\n \"choices\": [{\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": \"\\n\\nThis image shows a wooden boardwalk extending through a lush green marshland.\",\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }],\n \"usage\": {\n \"prompt_tokens\": 9,\n \"completion_tokens\": 12,\n \"total_tokens\": 21,\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0\n }\n }\n}\n" - }, - { - "title": "Streaming", - "request": { - "curl": "curl https://api.openai.com/v1/chat/completions \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"VAR_model_id\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are a helpful assistant.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Hello!\"\n }\n ],\n \"stream\": true\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\ncompletion = client.chat.completions.create(\n model=\"VAR_model_id\",\n messages=[\n {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n {\"role\": \"user\", \"content\": \"Hello!\"}\n ],\n stream=True\n)\n\nfor chunk in completion:\n print(chunk.choices[0].delta)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const completion = await openai.chat.completions.create({\n model: \"VAR_model_id\",\n messages: [\n {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n {\"role\": \"user\", \"content\": \"Hello!\"}\n ],\n stream: true,\n });\n\n for await (const chunk of completion) {\n console.log(chunk.choices[0].delta.content);\n }\n}\n\nmain();" - }, - "response": "{\"id\":\"chatcmpl-123\",\"object\":\"chat.completion.chunk\",\"created\":1694268190,\"model\":\"gpt-4o-mini\", \"system_fingerprint\": \"fp_44709d6fcb\", \"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":\"\"},\"logprobs\":null,\"finish_reason\":null}]}\n\n{\"id\":\"chatcmpl-123\",\"object\":\"chat.completion.chunk\",\"created\":1694268190,\"model\":\"gpt-4o-mini\", \"system_fingerprint\": \"fp_44709d6fcb\", \"choices\":[{\"index\":0,\"delta\":{\"content\":\"Hello\"},\"logprobs\":null,\"finish_reason\":null}]}\n\n....\n\n{\"id\":\"chatcmpl-123\",\"object\":\"chat.completion.chunk\",\"created\":1694268190,\"model\":\"gpt-4o-mini\", \"system_fingerprint\": \"fp_44709d6fcb\", \"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n" - }, - { - "title": "Functions", - "request": { - "curl": "curl https://api.openai.com/v1/chat/completions \\\n-H \"Content-Type: application/json\" \\\n-H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n-d '{\n \"model\": \"gpt-4o\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What'\\''s the weather like in Boston today?\"\n }\n ],\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather in a given location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\"\n },\n \"unit\": {\n \"type\": \"string\",\n \"enum\": [\"celsius\", \"fahrenheit\"]\n }\n },\n \"required\": [\"location\"]\n }\n }\n }\n ],\n \"tool_choice\": \"auto\"\n}'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\ntools = [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather in a given location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\",\n },\n \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"]},\n },\n \"required\": [\"location\"],\n },\n }\n }\n]\nmessages = [{\"role\": \"user\", \"content\": \"What's the weather like in Boston today?\"}]\ncompletion = client.chat.completions.create(\n model=\"VAR_model_id\",\n messages=messages,\n tools=tools,\n tool_choice=\"auto\"\n)\n\nprint(completion)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const messages = [{\"role\": \"user\", \"content\": \"What's the weather like in Boston today?\"}];\n const tools = [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather in a given location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\",\n },\n \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"]},\n },\n \"required\": [\"location\"],\n },\n }\n }\n ];\n\n const response = await openai.chat.completions.create({\n model: \"gpt-4o\",\n messages: messages,\n tools: tools,\n tool_choice: \"auto\",\n });\n\n console.log(response);\n}\n\nmain();" - }, - "response": "{\n \"id\": \"chatcmpl-abc123\",\n \"object\": \"chat.completion\",\n \"created\": 1699896916,\n \"model\": \"gpt-4o-mini\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_abc123\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"arguments\": \"{\\n\\\"location\\\": \\\"Boston, MA\\\"\\n}\"\n }\n }\n ]\n },\n \"logprobs\": null,\n \"finish_reason\": \"tool_calls\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 82,\n \"completion_tokens\": 17,\n \"total_tokens\": 99,\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0\n }\n }\n}\n" - }, - { - "title": "Logprobs", - "request": { - "curl": "curl https://api.openai.com/v1/chat/completions \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"VAR_model_id\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello!\"\n }\n ],\n \"logprobs\": true,\n \"top_logprobs\": 2\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\ncompletion = client.chat.completions.create(\n model=\"VAR_model_id\",\n messages=[\n {\"role\": \"user\", \"content\": \"Hello!\"}\n ],\n logprobs=True,\n top_logprobs=2\n)\n\nprint(completion.choices[0].message)\nprint(completion.choices[0].logprobs)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const completion = await openai.chat.completions.create({\n messages: [{ role: \"user\", content: \"Hello!\" }],\n model: \"VAR_model_id\",\n logprobs: true,\n top_logprobs: 2,\n });\n\n console.log(completion.choices[0]);\n}\n\nmain();" - }, - "response": "{\n \"id\": \"chatcmpl-123\",\n \"object\": \"chat.completion\",\n \"created\": 1702685778,\n \"model\": \"gpt-4o-mini\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": \"Hello! How can I assist you today?\"\n },\n \"logprobs\": {\n \"content\": [\n {\n \"token\": \"Hello\",\n \"logprob\": -0.31725305,\n \"bytes\": [72, 101, 108, 108, 111],\n \"top_logprobs\": [\n {\n \"token\": \"Hello\",\n \"logprob\": -0.31725305,\n \"bytes\": [72, 101, 108, 108, 111]\n },\n {\n \"token\": \"Hi\",\n \"logprob\": -1.3190403,\n \"bytes\": [72, 105]\n }\n ]\n },\n {\n \"token\": \"!\",\n \"logprob\": -0.02380986,\n \"bytes\": [\n 33\n ],\n \"top_logprobs\": [\n {\n \"token\": \"!\",\n \"logprob\": -0.02380986,\n \"bytes\": [33]\n },\n {\n \"token\": \" there\",\n \"logprob\": -3.787621,\n \"bytes\": [32, 116, 104, 101, 114, 101]\n }\n ]\n },\n {\n \"token\": \" How\",\n \"logprob\": -0.000054669687,\n \"bytes\": [32, 72, 111, 119],\n \"top_logprobs\": [\n {\n \"token\": \" How\",\n \"logprob\": -0.000054669687,\n \"bytes\": [32, 72, 111, 119]\n },\n {\n \"token\": \"<|end|>\",\n \"logprob\": -10.953937,\n \"bytes\": null\n }\n ]\n },\n {\n \"token\": \" can\",\n \"logprob\": -0.015801601,\n \"bytes\": [32, 99, 97, 110],\n \"top_logprobs\": [\n {\n \"token\": \" can\",\n \"logprob\": -0.015801601,\n \"bytes\": [32, 99, 97, 110]\n },\n {\n \"token\": \" may\",\n \"logprob\": -4.161023,\n \"bytes\": [32, 109, 97, 121]\n }\n ]\n },\n {\n \"token\": \" I\",\n \"logprob\": -3.7697225e-6,\n \"bytes\": [\n 32,\n 73\n ],\n \"top_logprobs\": [\n {\n \"token\": \" I\",\n \"logprob\": -3.7697225e-6,\n \"bytes\": [32, 73]\n },\n {\n \"token\": \" assist\",\n \"logprob\": -13.596657,\n \"bytes\": [32, 97, 115, 115, 105, 115, 116]\n }\n ]\n },\n {\n \"token\": \" assist\",\n \"logprob\": -0.04571125,\n \"bytes\": [32, 97, 115, 115, 105, 115, 116],\n \"top_logprobs\": [\n {\n \"token\": \" assist\",\n \"logprob\": -0.04571125,\n \"bytes\": [32, 97, 115, 115, 105, 115, 116]\n },\n {\n \"token\": \" help\",\n \"logprob\": -3.1089056,\n \"bytes\": [32, 104, 101, 108, 112]\n }\n ]\n },\n {\n \"token\": \" you\",\n \"logprob\": -5.4385737e-6,\n \"bytes\": [32, 121, 111, 117],\n \"top_logprobs\": [\n {\n \"token\": \" you\",\n \"logprob\": -5.4385737e-6,\n \"bytes\": [32, 121, 111, 117]\n },\n {\n \"token\": \" today\",\n \"logprob\": -12.807695,\n \"bytes\": [32, 116, 111, 100, 97, 121]\n }\n ]\n },\n {\n \"token\": \" today\",\n \"logprob\": -0.0040071653,\n \"bytes\": [32, 116, 111, 100, 97, 121],\n \"top_logprobs\": [\n {\n \"token\": \" today\",\n \"logprob\": -0.0040071653,\n \"bytes\": [32, 116, 111, 100, 97, 121]\n },\n {\n \"token\": \"?\",\n \"logprob\": -5.5247097,\n \"bytes\": [63]\n }\n ]\n },\n {\n \"token\": \"?\",\n \"logprob\": -0.0008108172,\n \"bytes\": [63],\n \"top_logprobs\": [\n {\n \"token\": \"?\",\n \"logprob\": -0.0008108172,\n \"bytes\": [63]\n },\n {\n \"token\": \"?\\n\",\n \"logprob\": -7.184561,\n \"bytes\": [63, 10]\n }\n ]\n }\n ]\n },\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 9,\n \"completion_tokens\": 9,\n \"total_tokens\": 18,\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0\n }\n },\n \"system_fingerprint\": null\n}\n" - } - ] - } - } - }, - "/completions": { - "post": { - "operationId": "createCompletion", - "tags": [ - "Completions" - ], - "summary": "Creates a completion for the provided prompt and parameters.", - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateCompletionRequest" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateCompletionResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Create completion", - "group": "completions", - "returns": "Returns a [completion](/docs/api-reference/completions/object) object, or a sequence of completion objects if the request is streamed.\n", - "legacy": true, - "examples": [ - { - "title": "No streaming", - "request": { - "curl": "curl https://api.openai.com/v1/completions \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"VAR_model_id\",\n \"prompt\": \"Say this is a test\",\n \"max_tokens\": 7,\n \"temperature\": 0\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.completions.create(\n model=\"VAR_model_id\",\n prompt=\"Say this is a test\",\n max_tokens=7,\n temperature=0\n)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const completion = await openai.completions.create({\n model: \"VAR_model_id\",\n prompt: \"Say this is a test.\",\n max_tokens: 7,\n temperature: 0,\n });\n\n console.log(completion);\n}\nmain();" - }, - "response": "{\n \"id\": \"cmpl-uqkvlQyYK7bGYrRHQ0eXlWi7\",\n \"object\": \"text_completion\",\n \"created\": 1589478378,\n \"model\": \"VAR_model_id\",\n \"system_fingerprint\": \"fp_44709d6fcb\",\n \"choices\": [\n {\n \"text\": \"\\n\\nThis is indeed a test\",\n \"index\": 0,\n \"logprobs\": null,\n \"finish_reason\": \"length\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 5,\n \"completion_tokens\": 7,\n \"total_tokens\": 12\n }\n}\n" - }, - { - "title": "Streaming", - "request": { - "curl": "curl https://api.openai.com/v1/completions \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"VAR_model_id\",\n \"prompt\": \"Say this is a test\",\n \"max_tokens\": 7,\n \"temperature\": 0,\n \"stream\": true\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nfor chunk in client.completions.create(\n model=\"VAR_model_id\",\n prompt=\"Say this is a test\",\n max_tokens=7,\n temperature=0,\n stream=True\n):\n print(chunk.choices[0].text)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const stream = await openai.completions.create({\n model: \"VAR_model_id\",\n prompt: \"Say this is a test.\",\n stream: true,\n });\n\n for await (const chunk of stream) {\n console.log(chunk.choices[0].text)\n }\n}\nmain();" - }, - "response": "{\n \"id\": \"cmpl-7iA7iJjj8V2zOkCGvWF2hAkDWBQZe\",\n \"object\": \"text_completion\",\n \"created\": 1690759702,\n \"choices\": [\n {\n \"text\": \"This\",\n \"index\": 0,\n \"logprobs\": null,\n \"finish_reason\": null\n }\n ],\n \"model\": \"gpt-3.5-turbo-instruct\"\n \"system_fingerprint\": \"fp_44709d6fcb\",\n}\n" - } - ] - } - } - }, - "/images/generations": { - "post": { - "operationId": "createImage", - "tags": [ - "Images" - ], - "summary": "Creates an image given a prompt.", - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateImageRequest" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ImagesResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Create image", - "group": "images", - "returns": "Returns a list of [image](/docs/api-reference/images/object) objects.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/images/generations \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"dall-e-3\",\n \"prompt\": \"A cute baby sea otter\",\n \"n\": 1,\n \"size\": \"1024x1024\"\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.images.generate(\n model=\"dall-e-3\",\n prompt=\"A cute baby sea otter\",\n n=1,\n size=\"1024x1024\"\n)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const image = await openai.images.generate({ model: \"dall-e-3\", prompt: \"A cute baby sea otter\" });\n\n console.log(image.data);\n}\nmain();" - }, - "response": "{\n \"created\": 1589478378,\n \"data\": [\n {\n \"url\": \"https://...\"\n },\n {\n \"url\": \"https://...\"\n }\n ]\n}\n" - } - } - } - }, - "/images/edits": { - "post": { - "operationId": "createImageEdit", - "tags": [ - "Images" - ], - "summary": "Creates an edited or extended image given an original image and a prompt.", - "requestBody": { - "required": true, - "content": { - "multipart/form-data": { - "schema": { - "$ref": "#/components/schemas/CreateImageEditRequest" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ImagesResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Create image edit", - "group": "images", - "returns": "Returns a list of [image](/docs/api-reference/images/object) objects.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/images/edits \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -F image=\"@otter.png\" \\\n -F mask=\"@mask.png\" \\\n -F prompt=\"A cute baby sea otter wearing a beret\" \\\n -F n=2 \\\n -F size=\"1024x1024\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.images.edit(\n image=open(\"otter.png\", \"rb\"),\n mask=open(\"mask.png\", \"rb\"),\n prompt=\"A cute baby sea otter wearing a beret\",\n n=2,\n size=\"1024x1024\"\n)\n", - "node.js": "import fs from \"fs\";\nimport OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const image = await openai.images.edit({\n image: fs.createReadStream(\"otter.png\"),\n mask: fs.createReadStream(\"mask.png\"),\n prompt: \"A cute baby sea otter wearing a beret\",\n });\n\n console.log(image.data);\n}\nmain();" - }, - "response": "{\n \"created\": 1589478378,\n \"data\": [\n {\n \"url\": \"https://...\"\n },\n {\n \"url\": \"https://...\"\n }\n ]\n}\n" - } - } - } - }, - "/images/variations": { - "post": { - "operationId": "createImageVariation", - "tags": [ - "Images" - ], - "summary": "Creates a variation of a given image.", - "requestBody": { - "required": true, - "content": { - "multipart/form-data": { - "schema": { - "$ref": "#/components/schemas/CreateImageVariationRequest" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ImagesResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Create image variation", - "group": "images", - "returns": "Returns a list of [image](/docs/api-reference/images/object) objects.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/images/variations \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -F image=\"@otter.png\" \\\n -F n=2 \\\n -F size=\"1024x1024\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nresponse = client.images.create_variation(\n image=open(\"image_edit_original.png\", \"rb\"),\n n=2,\n size=\"1024x1024\"\n)\n", - "node.js": "import fs from \"fs\";\nimport OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const image = await openai.images.createVariation({\n image: fs.createReadStream(\"otter.png\"),\n });\n\n console.log(image.data);\n}\nmain();" - }, - "response": "{\n \"created\": 1589478378,\n \"data\": [\n {\n \"url\": \"https://...\"\n },\n {\n \"url\": \"https://...\"\n }\n ]\n}\n" - } - } - } - }, - "/embeddings": { - "post": { - "operationId": "createEmbedding", - "tags": [ - "Embeddings" - ], - "summary": "Creates an embedding vector representing the input text.", - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateEmbeddingRequest" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateEmbeddingResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Create embeddings", - "group": "embeddings", - "returns": "A list of [embedding](/docs/api-reference/embeddings/object) objects.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/embeddings \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"input\": \"The food was delicious and the waiter...\",\n \"model\": \"text-embedding-ada-002\",\n \"encoding_format\": \"float\"\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.embeddings.create(\n model=\"text-embedding-ada-002\",\n input=\"The food was delicious and the waiter...\",\n encoding_format=\"float\"\n)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const embedding = await openai.embeddings.create({\n model: \"text-embedding-ada-002\",\n input: \"The quick brown fox jumped over the lazy dog\",\n encoding_format: \"float\",\n });\n\n console.log(embedding);\n}\n\nmain();" - }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"embedding\",\n \"embedding\": [\n 0.0023064255,\n -0.009327292,\n .... (1536 floats total for ada-002)\n -0.0028842222,\n ],\n \"index\": 0\n }\n ],\n \"model\": \"text-embedding-ada-002\",\n \"usage\": {\n \"prompt_tokens\": 8,\n \"total_tokens\": 8\n }\n}\n" - } - } - } - }, - "/audio/speech": { - "post": { - "operationId": "createSpeech", - "tags": [ - "Audio" - ], - "summary": "Generates audio from the input text.", - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateSpeechRequest" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "headers": { - "Transfer-Encoding": { - "schema": { - "type": "string" - }, - "description": "chunked" - } - }, - "content": { - "application/octet-stream": { - "schema": { - "type": "string", - "format": "binary" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Create speech", - "group": "audio", - "returns": "The audio file content.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/audio/speech \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"model\": \"tts-1\",\n \"input\": \"The quick brown fox jumped over the lazy dog.\",\n \"voice\": \"alloy\"\n }' \\\n --output speech.mp3\n", - "python": "from pathlib import Path\nimport openai\n\nspeech_file_path = Path(__file__).parent / \"speech.mp3\"\nresponse = openai.audio.speech.create(\n model=\"tts-1\",\n voice=\"alloy\",\n input=\"The quick brown fox jumped over the lazy dog.\"\n)\nresponse.stream_to_file(speech_file_path)\n", - "node": "import fs from \"fs\";\nimport path from \"path\";\nimport OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst speechFile = path.resolve(\"./speech.mp3\");\n\nasync function main() {\n const mp3 = await openai.audio.speech.create({\n model: \"tts-1\",\n voice: \"alloy\",\n input: \"Today is a wonderful day to build something people love!\",\n });\n console.log(speechFile);\n const buffer = Buffer.from(await mp3.arrayBuffer());\n await fs.promises.writeFile(speechFile, buffer);\n}\nmain();\n" - } - } - } - } - }, - "/audio/transcriptions": { - "post": { - "operationId": "createTranscription", - "tags": [ - "Audio" - ], - "summary": "Transcribes audio into the input language.", - "requestBody": { - "required": true, - "content": { - "multipart/form-data": { - "schema": { - "$ref": "#/components/schemas/CreateTranscriptionRequest" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/CreateTranscriptionResponseJson" - }, - { - "$ref": "#/components/schemas/CreateTranscriptionResponseVerboseJson" - } - ] - } - } - } - } - }, - "x-oaiMeta": { - "name": "Create transcription", - "group": "audio", - "returns": "The [transcription object](/docs/api-reference/audio/json-object) or a [verbose transcription object](/docs/api-reference/audio/verbose-json-object).", - "examples": [ - { - "title": "Default", - "request": { - "curl": "curl https://api.openai.com/v1/audio/transcriptions \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: multipart/form-data\" \\\n -F file=\"@/path/to/file/audio.mp3\" \\\n -F model=\"whisper-1\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\naudio_file = open(\"speech.mp3\", \"rb\")\ntranscript = client.audio.transcriptions.create(\n model=\"whisper-1\",\n file=audio_file\n)\n", - "node": "import fs from \"fs\";\nimport OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const transcription = await openai.audio.transcriptions.create({\n file: fs.createReadStream(\"audio.mp3\"),\n model: \"whisper-1\",\n });\n\n console.log(transcription.text);\n}\nmain();\n" - }, - "response": "{\n \"text\": \"Imagine the wildest idea that you've ever had, and you're curious about how it might scale to something that's a 100, a 1,000 times bigger. This is a place where you can get to do that.\"\n}\n" - }, - { - "title": "Word timestamps", - "request": { - "curl": "curl https://api.openai.com/v1/audio/transcriptions \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: multipart/form-data\" \\\n -F file=\"@/path/to/file/audio.mp3\" \\\n -F \"timestamp_granularities[]=word\" \\\n -F model=\"whisper-1\" \\\n -F response_format=\"verbose_json\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\naudio_file = open(\"speech.mp3\", \"rb\")\ntranscript = client.audio.transcriptions.create(\n file=audio_file,\n model=\"whisper-1\",\n response_format=\"verbose_json\",\n timestamp_granularities=[\"word\"]\n)\n\nprint(transcript.words)\n", - "node": "import fs from \"fs\";\nimport OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const transcription = await openai.audio.transcriptions.create({\n file: fs.createReadStream(\"audio.mp3\"),\n model: \"whisper-1\",\n response_format: \"verbose_json\",\n timestamp_granularities: [\"word\"]\n });\n\n console.log(transcription.text);\n}\nmain();\n" - }, - "response": "{\n \"task\": \"transcribe\",\n \"language\": \"english\",\n \"duration\": 8.470000267028809,\n \"text\": \"The beach was a popular spot on a hot summer day. People were swimming in the ocean, building sandcastles, and playing beach volleyball.\",\n \"words\": [\n {\n \"word\": \"The\",\n \"start\": 0.0,\n \"end\": 0.23999999463558197\n },\n ...\n {\n \"word\": \"volleyball\",\n \"start\": 7.400000095367432,\n \"end\": 7.900000095367432\n }\n ]\n}\n" - }, - { - "title": "Segment timestamps", - "request": { - "curl": "curl https://api.openai.com/v1/audio/transcriptions \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: multipart/form-data\" \\\n -F file=\"@/path/to/file/audio.mp3\" \\\n -F \"timestamp_granularities[]=segment\" \\\n -F model=\"whisper-1\" \\\n -F response_format=\"verbose_json\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\naudio_file = open(\"speech.mp3\", \"rb\")\ntranscript = client.audio.transcriptions.create(\n file=audio_file,\n model=\"whisper-1\",\n response_format=\"verbose_json\",\n timestamp_granularities=[\"segment\"]\n)\n\nprint(transcript.words)\n", - "node": "import fs from \"fs\";\nimport OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const transcription = await openai.audio.transcriptions.create({\n file: fs.createReadStream(\"audio.mp3\"),\n model: \"whisper-1\",\n response_format: \"verbose_json\",\n timestamp_granularities: [\"segment\"]\n });\n\n console.log(transcription.text);\n}\nmain();\n" - }, - "response": "{\n \"task\": \"transcribe\",\n \"language\": \"english\",\n \"duration\": 8.470000267028809,\n \"text\": \"The beach was a popular spot on a hot summer day. People were swimming in the ocean, building sandcastles, and playing beach volleyball.\",\n \"segments\": [\n {\n \"id\": 0,\n \"seek\": 0,\n \"start\": 0.0,\n \"end\": 3.319999933242798,\n \"text\": \" The beach was a popular spot on a hot summer day.\",\n \"tokens\": [\n 50364, 440, 7534, 390, 257, 3743, 4008, 322, 257, 2368, 4266, 786, 13, 50530\n ],\n \"temperature\": 0.0,\n \"avg_logprob\": -0.2860786020755768,\n \"compression_ratio\": 1.2363636493682861,\n \"no_speech_prob\": 0.00985979475080967\n },\n ...\n ]\n}\n" - } - ] - } - } - }, - "/audio/translations": { - "post": { - "operationId": "createTranslation", - "tags": [ - "Audio" - ], - "summary": "Translates audio into English.", - "requestBody": { - "required": true, - "content": { - "multipart/form-data": { - "schema": { - "$ref": "#/components/schemas/CreateTranslationRequest" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/CreateTranslationResponseJson" - }, - { - "$ref": "#/components/schemas/CreateTranslationResponseVerboseJson" - } - ] - } - } - } - } - }, - "x-oaiMeta": { - "name": "Create translation", - "group": "audio", - "returns": "The translated text.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/audio/translations \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: multipart/form-data\" \\\n -F file=\"@/path/to/file/german.m4a\" \\\n -F model=\"whisper-1\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\naudio_file = open(\"speech.mp3\", \"rb\")\ntranscript = client.audio.translations.create(\n model=\"whisper-1\",\n file=audio_file\n)\n", - "node": "import fs from \"fs\";\nimport OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const translation = await openai.audio.translations.create({\n file: fs.createReadStream(\"speech.mp3\"),\n model: \"whisper-1\",\n });\n\n console.log(translation.text);\n}\nmain();\n" - }, - "response": "{\n \"text\": \"Hello, my name is Wolfgang and I come from Germany. Where are you heading today?\"\n}\n" - } - } - } - }, - "/files": { - "get": { - "operationId": "listFiles", - "tags": [ - "Files" - ], - "summary": "Returns a list of files that belong to the user's organization.", - "parameters": [ - { - "in": "query", - "name": "purpose", - "required": false, - "schema": { - "type": "string" - }, - "description": "Only return files with the given purpose." - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ListFilesResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "List files", - "group": "files", - "returns": "A list of [File](/docs/api-reference/files/object) objects.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/files \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.files.list()\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const list = await openai.files.list();\n\n for await (const file of list) {\n console.log(file);\n }\n}\n\nmain();" - }, - "response": "{\n \"data\": [\n {\n \"id\": \"file-abc123\",\n \"object\": \"file\",\n \"bytes\": 175,\n \"created_at\": 1613677385,\n \"filename\": \"salesOverview.pdf\",\n \"purpose\": \"assistants\",\n },\n {\n \"id\": \"file-abc123\",\n \"object\": \"file\",\n \"bytes\": 140,\n \"created_at\": 1613779121,\n \"filename\": \"puppy.jsonl\",\n \"purpose\": \"fine-tune\",\n }\n ],\n \"object\": \"list\"\n}\n" - } - } - }, - "post": { - "operationId": "createFile", - "tags": [ - "Files" - ], - "summary": "Upload a file that can be used across various endpoints. Individual files can be up to 512 MB, and the size of all files uploaded by one organization can be up to 100 GB.\n\nThe Assistants API supports files up to 2 million tokens and of specific file types. See the [Assistants Tools guide](/docs/assistants/tools) for details.\n\nThe Fine-tuning API only supports `.jsonl` files. The input also has certain required formats for fine-tuning [chat](/docs/api-reference/fine-tuning/chat-input) or [completions](/docs/api-reference/fine-tuning/completions-input) models.\n\nThe Batch API only supports `.jsonl` files up to 100 MB in size. The input also has a specific required [format](/docs/api-reference/batch/request-input).\n\nPlease [contact us](https://help.openai.com/) if you need to increase these storage limits.\n", - "requestBody": { - "required": true, - "content": { - "multipart/form-data": { - "schema": { - "$ref": "#/components/schemas/CreateFileRequest" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OpenAIFile" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Upload file", - "group": "files", - "returns": "The uploaded [File](/docs/api-reference/files/object) object.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/files \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -F purpose=\"fine-tune\" \\\n -F file=\"@mydata.jsonl\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.files.create(\n file=open(\"mydata.jsonl\", \"rb\"),\n purpose=\"fine-tune\"\n)\n", - "node.js": "import fs from \"fs\";\nimport OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const file = await openai.files.create({\n file: fs.createReadStream(\"mydata.jsonl\"),\n purpose: \"fine-tune\",\n });\n\n console.log(file);\n}\n\nmain();" - }, - "response": "{\n \"id\": \"file-abc123\",\n \"object\": \"file\",\n \"bytes\": 120000,\n \"created_at\": 1677610602,\n \"filename\": \"mydata.jsonl\",\n \"purpose\": \"fine-tune\",\n}\n" - } - } - } - }, - "/files/{file_id}": { - "delete": { - "operationId": "deleteFile", - "tags": [ - "Files" - ], - "summary": "Delete a file.", - "parameters": [ - { - "in": "path", - "name": "file_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the file to use for this request." - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DeleteFileResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Delete file", - "group": "files", - "returns": "Deletion status.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/files/file-abc123 \\\n -X DELETE \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.files.delete(\"file-abc123\")\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const file = await openai.files.del(\"file-abc123\");\n\n console.log(file);\n}\n\nmain();" - }, - "response": "{\n \"id\": \"file-abc123\",\n \"object\": \"file\",\n \"deleted\": true\n}\n" - } - } - }, - "get": { - "operationId": "retrieveFile", - "tags": [ - "Files" - ], - "summary": "Returns information about a specific file.", - "parameters": [ - { - "in": "path", - "name": "file_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the file to use for this request." - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OpenAIFile" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Retrieve file", - "group": "files", - "returns": "The [File](/docs/api-reference/files/object) object matching the specified ID.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/files/file-abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.files.retrieve(\"file-abc123\")\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const file = await openai.files.retrieve(\"file-abc123\");\n\n console.log(file);\n}\n\nmain();" - }, - "response": "{\n \"id\": \"file-abc123\",\n \"object\": \"file\",\n \"bytes\": 120000,\n \"created_at\": 1677610602,\n \"filename\": \"mydata.jsonl\",\n \"purpose\": \"fine-tune\",\n}\n" - } - } - } - }, - "/files/{file_id}/content": { - "get": { - "operationId": "downloadFile", - "tags": [ - "Files" - ], - "summary": "Returns the contents of the specified file.", - "parameters": [ - { - "in": "path", - "name": "file_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the file to use for this request." - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "string" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Retrieve file content", - "group": "files", - "returns": "The file content.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/files/file-abc123/content \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" > file.jsonl\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\ncontent = client.files.content(\"file-abc123\")\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const file = await openai.files.content(\"file-abc123\");\n\n console.log(file);\n}\n\nmain();\n" - } - } - } - } - }, - "/uploads": { - "post": { - "operationId": "createUpload", - "tags": [ - "Uploads" - ], - "summary": "Creates an intermediate [Upload](/docs/api-reference/uploads/object) object that you can add [Parts](/docs/api-reference/uploads/part-object) to. Currently, an Upload can accept at most 8 GB in total and expires after an hour after you create it.\n\nOnce you complete the Upload, we will create a [File](/docs/api-reference/files/object) object that contains all the parts you uploaded. This File is usable in the rest of our platform as a regular File object.\n\nFor certain `purpose`s, the correct `mime_type` must be specified. Please refer to documentation for the supported MIME types for your use case:\n- [Assistants](/docs/assistants/tools/file-search/supported-files)\n\nFor guidance on the proper filename extensions for each purpose, please follow the documentation on [creating a File](/docs/api-reference/files/create).\n", - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateUploadRequest" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Upload" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Create upload", - "group": "uploads", - "returns": "The [Upload](/docs/api-reference/uploads/object) object with status `pending`.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/uploads \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"purpose\": \"fine-tune\",\n \"filename\": \"training_examples.jsonl\",\n \"bytes\": 2147483648,\n \"mime_type\": \"text/jsonl\"\n }'\n" - }, - "response": "{\n \"id\": \"upload_abc123\",\n \"object\": \"upload\",\n \"bytes\": 2147483648,\n \"created_at\": 1719184911,\n \"filename\": \"training_examples.jsonl\",\n \"purpose\": \"fine-tune\",\n \"status\": \"pending\",\n \"expires_at\": 1719127296\n}\n" - } - } - } - }, - "/uploads/{upload_id}/parts": { - "post": { - "operationId": "addUploadPart", - "tags": [ - "Uploads" - ], - "summary": "Adds a [Part](/docs/api-reference/uploads/part-object) to an [Upload](/docs/api-reference/uploads/object) object. A Part represents a chunk of bytes from the file you are trying to upload.\n\nEach Part can be at most 64 MB, and you can add Parts until you hit the Upload maximum of 8 GB.\n\nIt is possible to add multiple Parts in parallel. You can decide the intended order of the Parts when you [complete the Upload](/docs/api-reference/uploads/complete).\n", - "parameters": [ - { - "in": "path", - "name": "upload_id", - "required": true, - "schema": { - "type": "string", - "example": "upload_abc123" - }, - "description": "The ID of the Upload.\n" - } - ], - "requestBody": { - "required": true, - "content": { - "multipart/form-data": { - "schema": { - "$ref": "#/components/schemas/AddUploadPartRequest" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UploadPart" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Add upload part", - "group": "uploads", - "returns": "The upload [Part](/docs/api-reference/uploads/part-object) object.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/uploads/upload_abc123/parts\n -F data=\"aHR0cHM6Ly9hcGkub3BlbmFpLmNvbS92MS91cGxvYWRz...\"\n" - }, - "response": "{\n \"id\": \"part_def456\",\n \"object\": \"upload.part\",\n \"created_at\": 1719185911,\n \"upload_id\": \"upload_abc123\"\n}\n" - } - } - } - }, - "/uploads/{upload_id}/complete": { - "post": { - "operationId": "completeUpload", - "tags": [ - "Uploads" - ], - "summary": "Completes the [Upload](/docs/api-reference/uploads/object).\n\nWithin the returned Upload object, there is a nested [File](/docs/api-reference/files/object) object that is ready to use in the rest of the platform.\n\nYou can specify the order of the Parts by passing in an ordered list of the Part IDs.\n\nThe number of bytes uploaded upon completion must match the number of bytes initially specified when creating the Upload object. No Parts may be added after an Upload is completed.\n", - "parameters": [ - { - "in": "path", - "name": "upload_id", - "required": true, - "schema": { - "type": "string", - "example": "upload_abc123" - }, - "description": "The ID of the Upload.\n" - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CompleteUploadRequest" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Upload" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Complete upload", - "group": "uploads", - "returns": "The [Upload](/docs/api-reference/uploads/object) object with status `completed` with an additional `file` property containing the created usable File object.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/uploads/upload_abc123/complete\n -d '{\n \"part_ids\": [\"part_def456\", \"part_ghi789\"]\n }'\n" - }, - "response": "{\n \"id\": \"upload_abc123\",\n \"object\": \"upload\",\n \"bytes\": 2147483648,\n \"created_at\": 1719184911,\n \"filename\": \"training_examples.jsonl\",\n \"purpose\": \"fine-tune\",\n \"status\": \"completed\",\n \"expires_at\": 1719127296,\n \"file\": {\n \"id\": \"file-xyz321\",\n \"object\": \"file\",\n \"bytes\": 2147483648,\n \"created_at\": 1719186911,\n \"filename\": \"training_examples.jsonl\",\n \"purpose\": \"fine-tune\",\n }\n}\n" - } - } - } - }, - "/uploads/{upload_id}/cancel": { - "post": { - "operationId": "cancelUpload", - "tags": [ - "Uploads" - ], - "summary": "Cancels the Upload. No Parts may be added after an Upload is cancelled.\n", - "parameters": [ - { - "in": "path", - "name": "upload_id", - "required": true, - "schema": { - "type": "string", - "example": "upload_abc123" - }, - "description": "The ID of the Upload.\n" - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Upload" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Cancel upload", - "group": "uploads", - "returns": "The [Upload](/docs/api-reference/uploads/object) object with status `cancelled`.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/uploads/upload_abc123/cancel\n" - }, - "response": "{\n \"id\": \"upload_abc123\",\n \"object\": \"upload\",\n \"bytes\": 2147483648,\n \"created_at\": 1719184911,\n \"filename\": \"training_examples.jsonl\",\n \"purpose\": \"fine-tune\",\n \"status\": \"cancelled\",\n \"expires_at\": 1719127296\n}\n" - } - } - } - }, - "/fine_tuning/jobs": { - "post": { - "operationId": "createFineTuningJob", - "tags": [ - "Fine-tuning" - ], - "summary": "Creates a fine-tuning job which begins the process of creating a new model from a given dataset.\n\nResponse includes details of the enqueued job including job status and the name of the fine-tuned models once complete.\n\n[Learn more about fine-tuning](/docs/guides/fine-tuning)\n", - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateFineTuningJobRequest" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/FineTuningJob" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Create fine-tuning job", - "group": "fine-tuning", - "returns": "A [fine-tuning.job](/docs/api-reference/fine-tuning/object) object.", - "examples": [ - { - "title": "Default", - "request": { - "curl": "curl https://api.openai.com/v1/fine_tuning/jobs \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"training_file\": \"file-BK7bzQj3FfZFXr7DbL6xJwfo\",\n \"model\": \"gpt-4o-mini\"\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.fine_tuning.jobs.create(\n training_file=\"file-abc123\",\n model=\"gpt-4o-mini\"\n)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const fineTune = await openai.fineTuning.jobs.create({\n training_file: \"file-abc123\"\n });\n\n console.log(fineTune);\n}\n\nmain();\n" - }, - "response": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \"created_at\": 1721764800,\n \"fine_tuned_model\": null,\n \"organization_id\": \"org-123\",\n \"result_files\": [],\n \"status\": \"queued\",\n \"validation_file\": null,\n \"training_file\": \"file-abc123\",\n}\n" - }, - { - "title": "Epochs", - "request": { - "curl": "curl https://api.openai.com/v1/fine_tuning/jobs \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"training_file\": \"file-abc123\",\n \"model\": \"gpt-4o-mini\",\n \"hyperparameters\": {\n \"n_epochs\": 2\n }\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.fine_tuning.jobs.create(\n training_file=\"file-abc123\",\n model=\"gpt-4o-mini\",\n hyperparameters={\n \"n_epochs\":2\n }\n)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const fineTune = await openai.fineTuning.jobs.create({\n training_file: \"file-abc123\",\n model: \"gpt-4o-mini\",\n hyperparameters: { n_epochs: 2 }\n });\n\n console.log(fineTune);\n}\n\nmain();\n" - }, - "response": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \"created_at\": 1721764800,\n \"fine_tuned_model\": null,\n \"organization_id\": \"org-123\",\n \"result_files\": [],\n \"status\": \"queued\",\n \"validation_file\": null,\n \"training_file\": \"file-abc123\",\n \"hyperparameters\": {\"n_epochs\": 2},\n}\n" - }, - { - "title": "Validation file", - "request": { - "curl": "curl https://api.openai.com/v1/fine_tuning/jobs \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"training_file\": \"file-abc123\",\n \"validation_file\": \"file-abc123\",\n \"model\": \"gpt-4o-mini\"\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.fine_tuning.jobs.create(\n training_file=\"file-abc123\",\n validation_file=\"file-def456\",\n model=\"gpt-4o-mini\"\n)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const fineTune = await openai.fineTuning.jobs.create({\n training_file: \"file-abc123\",\n validation_file: \"file-abc123\"\n });\n\n console.log(fineTune);\n}\n\nmain();\n" - }, - "response": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \"created_at\": 1721764800,\n \"fine_tuned_model\": null,\n \"organization_id\": \"org-123\",\n \"result_files\": [],\n \"status\": \"queued\",\n \"validation_file\": \"file-abc123\",\n \"training_file\": \"file-abc123\",\n}\n" - }, - { - "title": "W&B Integration", - "request": { - "curl": "curl https://api.openai.com/v1/fine_tuning/jobs \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"training_file\": \"file-abc123\",\n \"validation_file\": \"file-abc123\",\n \"model\": \"gpt-4o-mini\",\n \"integrations\": [\n {\n \"type\": \"wandb\",\n \"wandb\": {\n \"project\": \"my-wandb-project\",\n \"name\": \"ft-run-display-name\"\n \"tags\": [\n \"first-experiment\", \"v2\"\n ]\n }\n }\n ]\n }'\n" - }, - "response": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \"created_at\": 1721764800,\n \"fine_tuned_model\": null,\n \"organization_id\": \"org-123\",\n \"result_files\": [],\n \"status\": \"queued\",\n \"validation_file\": \"file-abc123\",\n \"training_file\": \"file-abc123\",\n \"integrations\": [\n {\n \"type\": \"wandb\",\n \"wandb\": {\n \"project\": \"my-wandb-project\",\n \"entity\": None,\n \"run_id\": \"ftjob-abc123\"\n }\n }\n ]\n}\n" - } - ] - } - }, - "get": { - "operationId": "listPaginatedFineTuningJobs", - "tags": [ - "Fine-tuning" - ], - "summary": "List your organization's fine-tuning jobs\n", - "parameters": [ - { - "name": "after", - "in": "query", - "description": "Identifier for the last job from the previous pagination request.", - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "limit", - "in": "query", - "description": "Number of fine-tuning jobs to retrieve.", - "required": false, - "schema": { - "type": "integer", - "default": 20 - } - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ListPaginatedFineTuningJobsResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "List fine-tuning jobs", - "group": "fine-tuning", - "returns": "A list of paginated [fine-tuning job](/docs/api-reference/fine-tuning/object) objects.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/fine_tuning/jobs?limit=2 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.fine_tuning.jobs.list()\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const list = await openai.fineTuning.jobs.list();\n\n for await (const fineTune of list) {\n console.log(fineTune);\n }\n}\n\nmain();" - }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"fine_tuning.job.event\",\n \"id\": \"ft-event-TjX0lMfOniCZX64t9PUQT5hn\",\n \"created_at\": 1689813489,\n \"level\": \"warn\",\n \"message\": \"Fine tuning process stopping due to job cancellation\",\n \"data\": null,\n \"type\": \"message\"\n },\n { ... },\n { ... }\n ], \"has_more\": true\n}\n" - } - } - } - }, - "/fine_tuning/jobs/{fine_tuning_job_id}": { - "get": { - "operationId": "retrieveFineTuningJob", - "tags": [ - "Fine-tuning" - ], - "summary": "Get info about a fine-tuning job.\n\n[Learn more about fine-tuning](/docs/guides/fine-tuning)\n", - "parameters": [ - { - "in": "path", - "name": "fine_tuning_job_id", - "required": true, - "schema": { - "type": "string", - "example": "ft-AF1WoRqd3aJAHsqc9NY7iL8F" - }, - "description": "The ID of the fine-tuning job.\n" - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/FineTuningJob" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Retrieve fine-tuning job", - "group": "fine-tuning", - "returns": "The [fine-tuning](/docs/api-reference/fine-tuning/object) object with the given ID.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/fine_tuning/jobs/ft-AF1WoRqd3aJAHsqc9NY7iL8F \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.fine_tuning.jobs.retrieve(\"ftjob-abc123\")\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const fineTune = await openai.fineTuning.jobs.retrieve(\"ftjob-abc123\");\n\n console.log(fineTune);\n}\n\nmain();\n" - }, - "response": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"davinci-002\",\n \"created_at\": 1692661014,\n \"finished_at\": 1692661190,\n \"fine_tuned_model\": \"ft:davinci-002:my-org:custom_suffix:7q8mpxmy\",\n \"organization_id\": \"org-123\",\n \"result_files\": [\n \"file-abc123\"\n ],\n \"status\": \"succeeded\",\n \"validation_file\": null,\n \"training_file\": \"file-abc123\",\n \"hyperparameters\": {\n \"n_epochs\": 4,\n \"batch_size\": 1,\n \"learning_rate_multiplier\": 1.0\n },\n \"trained_tokens\": 5768,\n \"integrations\": [],\n \"seed\": 0,\n \"estimated_finish\": 0\n}\n" - } - } - } - }, - "/fine_tuning/jobs/{fine_tuning_job_id}/events": { - "get": { - "operationId": "listFineTuningEvents", - "tags": [ - "Fine-tuning" - ], - "summary": "Get status updates for a fine-tuning job.\n", - "parameters": [ - { - "in": "path", - "name": "fine_tuning_job_id", - "required": true, - "schema": { - "type": "string", - "example": "ft-AF1WoRqd3aJAHsqc9NY7iL8F" - }, - "description": "The ID of the fine-tuning job to get events for.\n" - }, - { - "name": "after", - "in": "query", - "description": "Identifier for the last event from the previous pagination request.", - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "limit", - "in": "query", - "description": "Number of events to retrieve.", - "required": false, - "schema": { - "type": "integer", - "default": 20 - } - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ListFineTuningJobEventsResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "List fine-tuning events", - "group": "fine-tuning", - "returns": "A list of fine-tuning event objects.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/events \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.fine_tuning.jobs.list_events(\n fine_tuning_job_id=\"ftjob-abc123\",\n limit=2\n)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const list = await openai.fineTuning.list_events(id=\"ftjob-abc123\", limit=2);\n\n for await (const fineTune of list) {\n console.log(fineTune);\n }\n}\n\nmain();" - }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"fine_tuning.job.event\",\n \"id\": \"ft-event-ddTJfwuMVpfLXseO0Am0Gqjm\",\n \"created_at\": 1721764800,\n \"level\": \"info\",\n \"message\": \"Fine tuning job successfully completed\",\n \"data\": null,\n \"type\": \"message\"\n },\n {\n \"object\": \"fine_tuning.job.event\",\n \"id\": \"ft-event-tyiGuB72evQncpH87xe505Sv\",\n \"created_at\": 1721764800,\n \"level\": \"info\",\n \"message\": \"New fine-tuned model created: ft:gpt-4o-mini:openai::7p4lURel\",\n \"data\": null,\n \"type\": \"message\"\n }\n ],\n \"has_more\": true\n}\n" - } - } - } - }, - "/fine_tuning/jobs/{fine_tuning_job_id}/cancel": { - "post": { - "operationId": "cancelFineTuningJob", - "tags": [ - "Fine-tuning" - ], - "summary": "Immediately cancel a fine-tune job.\n", - "parameters": [ - { - "in": "path", - "name": "fine_tuning_job_id", - "required": true, - "schema": { - "type": "string", - "example": "ft-AF1WoRqd3aJAHsqc9NY7iL8F" - }, - "description": "The ID of the fine-tuning job to cancel.\n" - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/FineTuningJob" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Cancel fine-tuning", - "group": "fine-tuning", - "returns": "The cancelled [fine-tuning](/docs/api-reference/fine-tuning/object) object.", - "examples": { - "request": { - "curl": "curl -X POST https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/cancel \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.fine_tuning.jobs.cancel(\"ftjob-abc123\")\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const fineTune = await openai.fineTuning.jobs.cancel(\"ftjob-abc123\");\n\n console.log(fineTune);\n}\nmain();" - }, - "response": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \"created_at\": 1721764800,\n \"fine_tuned_model\": null,\n \"organization_id\": \"org-123\",\n \"result_files\": [],\n \"hyperparameters\": {\n \"n_epochs\": \"auto\"\n },\n \"status\": \"cancelled\",\n \"validation_file\": \"file-abc123\",\n \"training_file\": \"file-abc123\"\n}\n" - } - } - } - }, - "/fine_tuning/jobs/{fine_tuning_job_id}/checkpoints": { - "get": { - "operationId": "listFineTuningJobCheckpoints", - "tags": [ - "Fine-tuning" - ], - "summary": "List checkpoints for a fine-tuning job.\n", - "parameters": [ - { - "in": "path", - "name": "fine_tuning_job_id", - "required": true, - "schema": { - "type": "string", - "example": "ft-AF1WoRqd3aJAHsqc9NY7iL8F" - }, - "description": "The ID of the fine-tuning job to get checkpoints for.\n" - }, - { - "name": "after", - "in": "query", - "description": "Identifier for the last checkpoint ID from the previous pagination request.", - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "limit", - "in": "query", - "description": "Number of checkpoints to retrieve.", - "required": false, - "schema": { - "type": "integer", - "default": 10 - } - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ListFineTuningJobCheckpointsResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "List fine-tuning checkpoints", - "group": "fine-tuning", - "returns": "A list of fine-tuning [checkpoint objects](/docs/api-reference/fine-tuning/checkpoint-object) for a fine-tuning job.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/checkpoints \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n" - }, - "response": "{\n \"object\": \"list\"\n \"data\": [\n {\n \"object\": \"fine_tuning.job.checkpoint\",\n \"id\": \"ftckpt_zc4Q7MP6XxulcVzj4MZdwsAB\",\n \"created_at\": 1721764867,\n \"fine_tuned_model_checkpoint\": \"ft:gpt-4o-mini-2024-07-18:my-org:custom-suffix:96olL566:ckpt-step-2000\",\n \"metrics\": {\n \"full_valid_loss\": 0.134,\n \"full_valid_mean_token_accuracy\": 0.874\n },\n \"fine_tuning_job_id\": \"ftjob-abc123\",\n \"step_number\": 2000,\n },\n {\n \"object\": \"fine_tuning.job.checkpoint\",\n \"id\": \"ftckpt_enQCFmOTGj3syEpYVhBRLTSy\",\n \"created_at\": 1721764800,\n \"fine_tuned_model_checkpoint\": \"ft:gpt-4o-mini-2024-07-18:my-org:custom-suffix:7q8mpxmy:ckpt-step-1000\",\n \"metrics\": {\n \"full_valid_loss\": 0.167,\n \"full_valid_mean_token_accuracy\": 0.781\n },\n \"fine_tuning_job_id\": \"ftjob-abc123\",\n \"step_number\": 1000,\n },\n ],\n \"first_id\": \"ftckpt_zc4Q7MP6XxulcVzj4MZdwsAB\",\n \"last_id\": \"ftckpt_enQCFmOTGj3syEpYVhBRLTSy\",\n \"has_more\": true\n}\n" - } - } - } - }, - "/models": { - "get": { - "operationId": "listModels", - "tags": [ - "Models" - ], - "summary": "Lists the currently available models, and provides basic information about each one such as the owner and availability.", - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ListModelsResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "List models", - "group": "models", - "returns": "A list of [model](/docs/api-reference/models/object) objects.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/models \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.models.list()\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const list = await openai.models.list();\n\n for await (const model of list) {\n console.log(model);\n }\n}\nmain();" - }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"model-id-0\",\n \"object\": \"model\",\n \"created\": 1686935002,\n \"owned_by\": \"organization-owner\"\n },\n {\n \"id\": \"model-id-1\",\n \"object\": \"model\",\n \"created\": 1686935002,\n \"owned_by\": \"organization-owner\",\n },\n {\n \"id\": \"model-id-2\",\n \"object\": \"model\",\n \"created\": 1686935002,\n \"owned_by\": \"openai\"\n },\n ],\n \"object\": \"list\"\n}\n" - } - } - } - }, - "/models/{model}": { - "get": { - "operationId": "retrieveModel", - "tags": [ - "Models" - ], - "summary": "Retrieves a model instance, providing basic information about the model such as the owner and permissioning.", - "parameters": [ - { - "in": "path", - "name": "model", - "required": true, - "schema": { - "type": "string", - "example": "gpt-4o-mini" - }, - "description": "The ID of the model to use for this request" - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Model" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Retrieve model", - "group": "models", - "returns": "The [model](/docs/api-reference/models/object) object matching the specified ID.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/models/VAR_model_id \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.models.retrieve(\"VAR_model_id\")\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const model = await openai.models.retrieve(\"VAR_model_id\");\n\n console.log(model);\n}\n\nmain();" - }, - "response": "{\n \"id\": \"VAR_model_id\",\n \"object\": \"model\",\n \"created\": 1686935002,\n \"owned_by\": \"openai\"\n}\n" - } - } - }, - "delete": { - "operationId": "deleteModel", - "tags": [ - "Models" - ], - "summary": "Delete a fine-tuned model. You must have the Owner role in your organization to delete a model.", - "parameters": [ - { - "in": "path", - "name": "model", - "required": true, - "schema": { - "type": "string", - "example": "ft:gpt-4o-mini:acemeco:suffix:abc123" - }, - "description": "The model to delete" - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DeleteModelResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Delete a fine-tuned model", - "group": "models", - "returns": "Deletion status.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/models/ft:gpt-4o-mini:acemeco:suffix:abc123 \\\n -X DELETE \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.models.delete(\"ft:gpt-4o-mini:acemeco:suffix:abc123\")\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const model = await openai.models.del(\"ft:gpt-4o-mini:acemeco:suffix:abc123\");\n\n console.log(model);\n}\nmain();" - }, - "response": "{\n \"id\": \"ft:gpt-4o-mini:acemeco:suffix:abc123\",\n \"object\": \"model\",\n \"deleted\": true\n}\n" - } - } - } - }, - "/moderations": { - "post": { - "operationId": "createModeration", - "tags": [ - "Moderations" - ], - "summary": "Classifies if text and/or image inputs are potentially harmful. Learn\nmore in the [moderation guide](/docs/guides/moderation).\n", - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateModerationRequest" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateModerationResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Create moderation", - "group": "moderations", - "returns": "A [moderation](/docs/api-reference/moderations/object) object.", - "examples": [ - { - "title": "Single string", - "request": { - "curl": "curl https://api.openai.com/v1/moderations \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"input\": \"I want to kill them.\"\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nmoderation = client.moderations.create(input=\"I want to kill them.\")\nprint(moderation)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const moderation = await openai.moderations.create({ input: \"I want to kill them.\" });\n\n console.log(moderation);\n}\nmain();\n" - }, - "response": "{\n \"id\": \"modr-AB8CjOTu2jiq12hp1AQPfeqFWaORR\",\n \"model\": \"text-moderation-007\",\n \"results\": [\n {\n \"flagged\": true,\n \"categories\": {\n \"sexual\": false,\n \"hate\": false,\n \"harassment\": true,\n \"self-harm\": false,\n \"sexual/minors\": false,\n \"hate/threatening\": false,\n \"violence/graphic\": false,\n \"self-harm/intent\": false,\n \"self-harm/instructions\": false,\n \"harassment/threatening\": true,\n \"violence\": true\n },\n \"category_scores\": {\n \"sexual\": 0.000011726012417057063,\n \"hate\": 0.22706663608551025,\n \"harassment\": 0.5215635299682617,\n \"self-harm\": 2.227119921371923e-6,\n \"sexual/minors\": 7.107352217872176e-8,\n \"hate/threatening\": 0.023547329008579254,\n \"violence/graphic\": 0.00003391829886822961,\n \"self-harm/intent\": 1.646940972932498e-6,\n \"self-harm/instructions\": 1.1198755256458526e-9,\n \"harassment/threatening\": 0.5694745779037476,\n \"violence\": 0.9971134662628174\n }\n }\n ]\n}\n" - }, - { - "title": "Image and text", - "request": { - "curl": "curl https://api.openai.com/v1/moderations \\\n -X POST \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"omni-moderation-latest\",\n \"input\": [\n { \"type\": \"text\", \"text\": \"...text to classify goes here...\" },\n {\n \"type\": \"image_url\",\n \"image_url\": {\n \"url\": \"https://example.com/image.png\"\n }\n }\n ]\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nresponse = client.moderations.create(\n model=\"omni-moderation-latest\",\n input=[\n {\"type\": \"text\", \"text\": \"...text to classify goes here...\"},\n {\n \"type\": \"image_url\",\n \"image_url\": {\n \"url\": \"https://example.com/image.png\",\n # can also use base64 encoded image URLs\n # \"url\": \"data:image/jpeg;base64,abcdefg...\"\n }\n },\n ],\n)\n\nprint(response)\n", - "node.js": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nconst moderation = await openai.moderations.create({\n model: \"omni-moderation-latest\",\n input: [\n { type: \"text\", text: \"...text to classify goes here...\" },\n {\n type: \"image_url\",\n image_url: {\n url: \"https://example.com/image.png\"\n // can also use base64 encoded image URLs\n // url: \"data:image/jpeg;base64,abcdefg...\"\n }\n }\n ],\n});\n\nconsole.log(moderation);\n" - }, - "response": "{\n \"id\": \"modr-0d9740456c391e43c445bf0f010940c7\",\n \"model\": \"omni-moderation-latest\",\n \"results\": [\n {\n \"flagged\": true,\n \"categories\": {\n \"harassment\": true,\n \"harassment/threatening\": true,\n \"sexual\": false,\n \"hate\": false,\n \"hate/threatening\": false,\n \"illicit\": false,\n \"illicit/violent\": false,\n \"self-harm/intent\": false,\n \"self-harm/instructions\": false,\n \"self-harm\": false,\n \"sexual/minors\": false,\n \"violence\": true,\n \"violence/graphic\": true\n },\n \"category_scores\": {\n \"harassment\": 0.8189693396524255,\n \"harassment/threatening\": 0.804985420696006,\n \"sexual\": 1.573112165348997e-6,\n \"hate\": 0.007562942636942845,\n \"hate/threatening\": 0.004208854591835476,\n \"illicit\": 0.030535955153511665,\n \"illicit/violent\": 0.008925306722380033,\n \"self-harm/intent\": 0.00023023930975076432,\n \"self-harm/instructions\": 0.0002293869201073356,\n \"self-harm\": 0.012598046106750154,\n \"sexual/minors\": 2.212566909570261e-8,\n \"violence\": 0.9999992735124786,\n \"violence/graphic\": 0.843064871157054\n },\n \"category_applied_input_types\": {\n \"harassment\": [\n \"text\"\n ],\n \"harassment/threatening\": [\n \"text\"\n ],\n \"sexual\": [\n \"text\",\n \"image\"\n ],\n \"hate\": [\n \"text\"\n ],\n \"hate/threatening\": [\n \"text\"\n ],\n \"illicit\": [\n \"text\"\n ],\n \"illicit/violent\": [\n \"text\"\n ],\n \"self-harm/intent\": [\n \"text\",\n \"image\"\n ],\n \"self-harm/instructions\": [\n \"text\",\n \"image\"\n ],\n \"self-harm\": [\n \"text\",\n \"image\"\n ],\n \"sexual/minors\": [\n \"text\"\n ],\n \"violence\": [\n \"text\",\n \"image\"\n ],\n \"violence/graphic\": [\n \"text\",\n \"image\"\n ]\n }\n }\n ]\n}\n" - } - ] - } - } - }, - "/assistants": { - "get": { - "operationId": "listAssistants", - "tags": [ - "Assistants" - ], - "summary": "Returns a list of assistants.", - "parameters": [ - { - "name": "limit", - "in": "query", - "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n", - "required": false, - "schema": { - "type": "integer", - "default": 20 - } - }, - { - "name": "order", - "in": "query", - "description": "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n", - "schema": { - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ] - } - }, - { - "name": "after", - "in": "query", - "description": "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n", - "schema": { - "type": "string" - } - }, - { - "name": "before", - "in": "query", - "description": "A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.\n", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ListAssistantsResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "List assistants", - "group": "assistants", - "beta": true, - "returns": "A list of [assistant](/docs/api-reference/assistants/object) objects.", - "examples": { - "request": { - "curl": "curl \"https://api.openai.com/v1/assistants?order=desc&limit=20\" \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nmy_assistants = client.beta.assistants.list(\n order=\"desc\",\n limit=\"20\",\n)\nprint(my_assistants.data)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const myAssistants = await openai.beta.assistants.list({\n order: \"desc\",\n limit: \"20\",\n });\n\n console.log(myAssistants.data);\n}\n\nmain();" - }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"asst_abc123\",\n \"object\": \"assistant\",\n \"created_at\": 1698982736,\n \"name\": \"Coding Tutor\",\n \"description\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": \"You are a helpful assistant designed to make me better at coding!\",\n \"tools\": [],\n \"tool_resources\": {},\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n },\n {\n \"id\": \"asst_abc456\",\n \"object\": \"assistant\",\n \"created_at\": 1698982718,\n \"name\": \"My Assistant\",\n \"description\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": \"You are a helpful assistant designed to make me better at coding!\",\n \"tools\": [],\n \"tool_resources\": {},\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n },\n {\n \"id\": \"asst_abc789\",\n \"object\": \"assistant\",\n \"created_at\": 1698982643,\n \"name\": null,\n \"description\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": null,\n \"tools\": [],\n \"tool_resources\": {},\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n }\n ],\n \"first_id\": \"asst_abc123\",\n \"last_id\": \"asst_abc789\",\n \"has_more\": false\n}\n" - } - } - }, - "post": { - "operationId": "createAssistant", - "tags": [ - "Assistants" - ], - "summary": "Create an assistant with a model and instructions.", - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateAssistantRequest" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AssistantObject" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Create assistant", - "group": "assistants", - "beta": true, - "returns": "An [assistant](/docs/api-reference/assistants/object) object.", - "examples": [ - { - "title": "Code Interpreter", - "request": { - "curl": "curl \"https://api.openai.com/v1/assistants\" \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"instructions\": \"You are a personal math tutor. When asked a question, write and run Python code to answer the question.\",\n \"name\": \"Math Tutor\",\n \"tools\": [{\"type\": \"code_interpreter\"}],\n \"model\": \"gpt-4o\"\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nmy_assistant = client.beta.assistants.create(\n instructions=\"You are a personal math tutor. When asked a question, write and run Python code to answer the question.\",\n name=\"Math Tutor\",\n tools=[{\"type\": \"code_interpreter\"}],\n model=\"gpt-4o\",\n)\nprint(my_assistant)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const myAssistant = await openai.beta.assistants.create({\n instructions:\n \"You are a personal math tutor. When asked a question, write and run Python code to answer the question.\",\n name: \"Math Tutor\",\n tools: [{ type: \"code_interpreter\" }],\n model: \"gpt-4o\",\n });\n\n console.log(myAssistant);\n}\n\nmain();" - }, - "response": "{\n \"id\": \"asst_abc123\",\n \"object\": \"assistant\",\n \"created_at\": 1698984975,\n \"name\": \"Math Tutor\",\n \"description\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": \"You are a personal math tutor. When asked a question, write and run Python code to answer the question.\",\n \"tools\": [\n {\n \"type\": \"code_interpreter\"\n }\n ],\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n}\n" - }, - { - "title": "Files", - "request": { - "curl": "curl https://api.openai.com/v1/assistants \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"instructions\": \"You are an HR bot, and you have access to files to answer employee questions about company policies.\",\n \"tools\": [{\"type\": \"file_search\"}],\n \"tool_resources\": {\"file_search\": {\"vector_store_ids\": [\"vs_123\"]}},\n \"model\": \"gpt-4o\"\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nmy_assistant = client.beta.assistants.create(\n instructions=\"You are an HR bot, and you have access to files to answer employee questions about company policies.\",\n name=\"HR Helper\",\n tools=[{\"type\": \"file_search\"}],\n tool_resources={\"file_search\": {\"vector_store_ids\": [\"vs_123\"]}},\n model=\"gpt-4o\"\n)\nprint(my_assistant)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const myAssistant = await openai.beta.assistants.create({\n instructions:\n \"You are an HR bot, and you have access to files to answer employee questions about company policies.\",\n name: \"HR Helper\",\n tools: [{ type: \"file_search\" }],\n tool_resources: {\n file_search: {\n vector_store_ids: [\"vs_123\"]\n }\n },\n model: \"gpt-4o\"\n });\n\n console.log(myAssistant);\n}\n\nmain();" - }, - "response": "{\n \"id\": \"asst_abc123\",\n \"object\": \"assistant\",\n \"created_at\": 1699009403,\n \"name\": \"HR Helper\",\n \"description\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": \"You are an HR bot, and you have access to files to answer employee questions about company policies.\",\n \"tools\": [\n {\n \"type\": \"file_search\"\n }\n ],\n \"tool_resources\": {\n \"file_search\": {\n \"vector_store_ids\": [\"vs_123\"]\n }\n },\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n}\n" - } - ] - } - } - }, - "/assistants/{assistant_id}": { - "get": { - "operationId": "getAssistant", - "tags": [ - "Assistants" - ], - "summary": "Retrieves an assistant.", - "parameters": [ - { - "in": "path", - "name": "assistant_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the assistant to retrieve." - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AssistantObject" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Retrieve assistant", - "group": "assistants", - "beta": true, - "returns": "The [assistant](/docs/api-reference/assistants/object) object matching the specified ID.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/assistants/asst_abc123 \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nmy_assistant = client.beta.assistants.retrieve(\"asst_abc123\")\nprint(my_assistant)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const myAssistant = await openai.beta.assistants.retrieve(\n \"asst_abc123\"\n );\n\n console.log(myAssistant);\n}\n\nmain();" - }, - "response": "{\n \"id\": \"asst_abc123\",\n \"object\": \"assistant\",\n \"created_at\": 1699009709,\n \"name\": \"HR Helper\",\n \"description\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": \"You are an HR bot, and you have access to files to answer employee questions about company policies.\",\n \"tools\": [\n {\n \"type\": \"file_search\"\n }\n ],\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n}\n" - } - } - }, - "post": { - "operationId": "modifyAssistant", - "tags": [ - "Assistants" - ], - "summary": "Modifies an assistant.", - "parameters": [ - { - "in": "path", - "name": "assistant_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the assistant to modify." - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ModifyAssistantRequest" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AssistantObject" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Modify assistant", - "group": "assistants", - "beta": true, - "returns": "The modified [assistant](/docs/api-reference/assistants/object) object.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/assistants/asst_abc123 \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"instructions\": \"You are an HR bot, and you have access to files to answer employee questions about company policies. Always response with info from either of the files.\",\n \"tools\": [{\"type\": \"file_search\"}],\n \"model\": \"gpt-4o\"\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nmy_updated_assistant = client.beta.assistants.update(\n \"asst_abc123\",\n instructions=\"You are an HR bot, and you have access to files to answer employee questions about company policies. Always response with info from either of the files.\",\n name=\"HR Helper\",\n tools=[{\"type\": \"file_search\"}],\n model=\"gpt-4o\"\n)\n\nprint(my_updated_assistant)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const myUpdatedAssistant = await openai.beta.assistants.update(\n \"asst_abc123\",\n {\n instructions:\n \"You are an HR bot, and you have access to files to answer employee questions about company policies. Always response with info from either of the files.\",\n name: \"HR Helper\",\n tools: [{ type: \"file_search\" }],\n model: \"gpt-4o\"\n }\n );\n\n console.log(myUpdatedAssistant);\n}\n\nmain();" - }, - "response": "{\n \"id\": \"asst_123\",\n \"object\": \"assistant\",\n \"created_at\": 1699009709,\n \"name\": \"HR Helper\",\n \"description\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": \"You are an HR bot, and you have access to files to answer employee questions about company policies. Always response with info from either of the files.\",\n \"tools\": [\n {\n \"type\": \"file_search\"\n }\n ],\n \"tool_resources\": {\n \"file_search\": {\n \"vector_store_ids\": []\n }\n },\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n}\n" - } - } - }, - "delete": { - "operationId": "deleteAssistant", - "tags": [ - "Assistants" - ], - "summary": "Delete an assistant.", - "parameters": [ - { - "in": "path", - "name": "assistant_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the assistant to delete." - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DeleteAssistantResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Delete assistant", - "group": "assistants", - "beta": true, - "returns": "Deletion status", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/assistants/asst_abc123 \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -X DELETE\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nresponse = client.beta.assistants.delete(\"asst_abc123\")\nprint(response)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const response = await openai.beta.assistants.del(\"asst_abc123\");\n\n console.log(response);\n}\nmain();" - }, - "response": "{\n \"id\": \"asst_abc123\",\n \"object\": \"assistant.deleted\",\n \"deleted\": true\n}\n" - } - } - } - }, - "/threads": { - "post": { - "operationId": "createThread", - "tags": [ - "Assistants" - ], - "summary": "Create a thread.", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateThreadRequest" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ThreadObject" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Create thread", - "group": "threads", - "beta": true, - "returns": "A [thread](/docs/api-reference/threads) object.", - "examples": [ - { - "title": "Empty", - "request": { - "curl": "curl https://api.openai.com/v1/threads \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d ''\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nempty_thread = client.beta.threads.create()\nprint(empty_thread)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const emptyThread = await openai.beta.threads.create();\n\n console.log(emptyThread);\n}\n\nmain();" - }, - "response": "{\n \"id\": \"thread_abc123\",\n \"object\": \"thread\",\n \"created_at\": 1699012949,\n \"metadata\": {},\n \"tool_resources\": {}\n}\n" - }, - { - "title": "Messages", - "request": { - "curl": "curl https://api.openai.com/v1/threads \\\n-H \"Content-Type: application/json\" \\\n-H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n-H \"OpenAI-Beta: assistants=v2\" \\\n-d '{\n \"messages\": [{\n \"role\": \"user\",\n \"content\": \"Hello, what is AI?\"\n }, {\n \"role\": \"user\",\n \"content\": \"How does AI work? Explain it in simple terms.\"\n }]\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nmessage_thread = client.beta.threads.create(\n messages=[\n {\n \"role\": \"user\",\n \"content\": \"Hello, what is AI?\"\n },\n {\n \"role\": \"user\",\n \"content\": \"How does AI work? Explain it in simple terms.\"\n },\n ]\n)\n\nprint(message_thread)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const messageThread = await openai.beta.threads.create({\n messages: [\n {\n role: \"user\",\n content: \"Hello, what is AI?\"\n },\n {\n role: \"user\",\n content: \"How does AI work? Explain it in simple terms.\",\n },\n ],\n });\n\n console.log(messageThread);\n}\n\nmain();" - }, - "response": "{\n \"id\": \"thread_abc123\",\n \"object\": \"thread\",\n \"created_at\": 1699014083,\n \"metadata\": {},\n \"tool_resources\": {}\n}\n" - } - ] - } - } - }, - "/threads/{thread_id}": { - "get": { - "operationId": "getThread", - "tags": [ - "Assistants" - ], - "summary": "Retrieves a thread.", - "parameters": [ - { - "in": "path", - "name": "thread_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the thread to retrieve." - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ThreadObject" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Retrieve thread", - "group": "threads", - "beta": true, - "returns": "The [thread](/docs/api-reference/threads/object) object matching the specified ID.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/threads/thread_abc123 \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nmy_thread = client.beta.threads.retrieve(\"thread_abc123\")\nprint(my_thread)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const myThread = await openai.beta.threads.retrieve(\n \"thread_abc123\"\n );\n\n console.log(myThread);\n}\n\nmain();" - }, - "response": "{\n \"id\": \"thread_abc123\",\n \"object\": \"thread\",\n \"created_at\": 1699014083,\n \"metadata\": {},\n \"tool_resources\": {\n \"code_interpreter\": {\n \"file_ids\": []\n }\n }\n}\n" - } - } - }, - "post": { - "operationId": "modifyThread", - "tags": [ - "Assistants" - ], - "summary": "Modifies a thread.", - "parameters": [ - { - "in": "path", - "name": "thread_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the thread to modify. Only the `metadata` can be modified." - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ModifyThreadRequest" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ThreadObject" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Modify thread", - "group": "threads", - "beta": true, - "returns": "The modified [thread](/docs/api-reference/threads/object) object matching the specified ID.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/threads/thread_abc123 \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"metadata\": {\n \"modified\": \"true\",\n \"user\": \"abc123\"\n }\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nmy_updated_thread = client.beta.threads.update(\n \"thread_abc123\",\n metadata={\n \"modified\": \"true\",\n \"user\": \"abc123\"\n }\n)\nprint(my_updated_thread)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const updatedThread = await openai.beta.threads.update(\n \"thread_abc123\",\n {\n metadata: { modified: \"true\", user: \"abc123\" },\n }\n );\n\n console.log(updatedThread);\n}\n\nmain();" - }, - "response": "{\n \"id\": \"thread_abc123\",\n \"object\": \"thread\",\n \"created_at\": 1699014083,\n \"metadata\": {\n \"modified\": \"true\",\n \"user\": \"abc123\"\n },\n \"tool_resources\": {}\n}\n" - } - } - }, - "delete": { - "operationId": "deleteThread", - "tags": [ - "Assistants" - ], - "summary": "Delete a thread.", - "parameters": [ - { - "in": "path", - "name": "thread_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the thread to delete." - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DeleteThreadResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Delete thread", - "group": "threads", - "beta": true, - "returns": "Deletion status", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/threads/thread_abc123 \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -X DELETE\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nresponse = client.beta.threads.delete(\"thread_abc123\")\nprint(response)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const response = await openai.beta.threads.del(\"thread_abc123\");\n\n console.log(response);\n}\nmain();" - }, - "response": "{\n \"id\": \"thread_abc123\",\n \"object\": \"thread.deleted\",\n \"deleted\": true\n}\n" - } - } - } - }, - "/threads/{thread_id}/messages": { - "get": { - "operationId": "listMessages", - "tags": [ - "Assistants" - ], - "summary": "Returns a list of messages for a given thread.", - "parameters": [ - { - "in": "path", - "name": "thread_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the [thread](/docs/api-reference/threads) the messages belong to." - }, - { - "name": "limit", - "in": "query", - "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n", - "required": false, - "schema": { - "type": "integer", - "default": 20 - } - }, - { - "name": "order", - "in": "query", - "description": "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n", - "schema": { - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ] - } - }, - { - "name": "after", - "in": "query", - "description": "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n", - "schema": { - "type": "string" - } - }, - { - "name": "before", - "in": "query", - "description": "A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.\n", - "schema": { - "type": "string" - } - }, - { - "name": "run_id", - "in": "query", - "description": "Filter messages by the run ID that generated them.\n", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ListMessagesResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "List messages", - "group": "threads", - "beta": true, - "returns": "A list of [message](/docs/api-reference/messages) objects.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/threads/thread_abc123/messages \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nthread_messages = client.beta.threads.messages.list(\"thread_abc123\")\nprint(thread_messages.data)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const threadMessages = await openai.beta.threads.messages.list(\n \"thread_abc123\"\n );\n\n console.log(threadMessages.data);\n}\n\nmain();" - }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"msg_abc123\",\n \"object\": \"thread.message\",\n \"created_at\": 1699016383,\n \"assistant_id\": null,\n \"thread_id\": \"thread_abc123\",\n \"run_id\": null,\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": {\n \"value\": \"How does AI work? Explain it in simple terms.\",\n \"annotations\": []\n }\n }\n ],\n \"attachments\": [],\n \"metadata\": {}\n },\n {\n \"id\": \"msg_abc456\",\n \"object\": \"thread.message\",\n \"created_at\": 1699016383,\n \"assistant_id\": null,\n \"thread_id\": \"thread_abc123\",\n \"run_id\": null,\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": {\n \"value\": \"Hello, what is AI?\",\n \"annotations\": []\n }\n }\n ],\n \"attachments\": [],\n \"metadata\": {}\n }\n ],\n \"first_id\": \"msg_abc123\",\n \"last_id\": \"msg_abc456\",\n \"has_more\": false\n}\n" - } - } - }, - "post": { - "operationId": "createMessage", - "tags": [ - "Assistants" - ], - "summary": "Create a message.", - "parameters": [ - { - "in": "path", - "name": "thread_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the [thread](/docs/api-reference/threads) to create a message for." - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateMessageRequest" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/MessageObject" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Create message", - "group": "threads", - "beta": true, - "returns": "A [message](/docs/api-reference/messages/object) object.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/threads/thread_abc123/messages \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"role\": \"user\",\n \"content\": \"How does AI work? Explain it in simple terms.\"\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nthread_message = client.beta.threads.messages.create(\n \"thread_abc123\",\n role=\"user\",\n content=\"How does AI work? Explain it in simple terms.\",\n)\nprint(thread_message)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const threadMessages = await openai.beta.threads.messages.create(\n \"thread_abc123\",\n { role: \"user\", content: \"How does AI work? Explain it in simple terms.\" }\n );\n\n console.log(threadMessages);\n}\n\nmain();" - }, - "response": "{\n \"id\": \"msg_abc123\",\n \"object\": \"thread.message\",\n \"created_at\": 1713226573,\n \"assistant_id\": null,\n \"thread_id\": \"thread_abc123\",\n \"run_id\": null,\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": {\n \"value\": \"How does AI work? Explain it in simple terms.\",\n \"annotations\": []\n }\n }\n ],\n \"attachments\": [],\n \"metadata\": {}\n}\n" - } - } - } - }, - "/threads/{thread_id}/messages/{message_id}": { - "get": { - "operationId": "getMessage", - "tags": [ - "Assistants" - ], - "summary": "Retrieve a message.", - "parameters": [ - { - "in": "path", - "name": "thread_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the [thread](/docs/api-reference/threads) to which this message belongs." - }, - { - "in": "path", - "name": "message_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the message to retrieve." - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/MessageObject" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Retrieve message", - "group": "threads", - "beta": true, - "returns": "The [message](/docs/api-reference/messages/object) object matching the specified ID.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nmessage = client.beta.threads.messages.retrieve(\n message_id=\"msg_abc123\",\n thread_id=\"thread_abc123\",\n)\nprint(message)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const message = await openai.beta.threads.messages.retrieve(\n \"thread_abc123\",\n \"msg_abc123\"\n );\n\n console.log(message);\n}\n\nmain();" - }, - "response": "{\n \"id\": \"msg_abc123\",\n \"object\": \"thread.message\",\n \"created_at\": 1699017614,\n \"assistant_id\": null,\n \"thread_id\": \"thread_abc123\",\n \"run_id\": null,\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": {\n \"value\": \"How does AI work? Explain it in simple terms.\",\n \"annotations\": []\n }\n }\n ],\n \"attachments\": [],\n \"metadata\": {}\n}\n" - } - } - }, - "post": { - "operationId": "modifyMessage", - "tags": [ - "Assistants" - ], - "summary": "Modifies a message.", - "parameters": [ - { - "in": "path", - "name": "thread_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the thread to which this message belongs." - }, - { - "in": "path", - "name": "message_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the message to modify." - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ModifyMessageRequest" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/MessageObject" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Modify message", - "group": "threads", - "beta": true, - "returns": "The modified [message](/docs/api-reference/messages/object) object.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"metadata\": {\n \"modified\": \"true\",\n \"user\": \"abc123\"\n }\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nmessage = client.beta.threads.messages.update(\n message_id=\"msg_abc12\",\n thread_id=\"thread_abc123\",\n metadata={\n \"modified\": \"true\",\n \"user\": \"abc123\",\n },\n)\nprint(message)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const message = await openai.beta.threads.messages.update(\n \"thread_abc123\",\n \"msg_abc123\",\n {\n metadata: {\n modified: \"true\",\n user: \"abc123\",\n },\n }\n }'" - }, - "response": "{\n \"id\": \"msg_abc123\",\n \"object\": \"thread.message\",\n \"created_at\": 1699017614,\n \"assistant_id\": null,\n \"thread_id\": \"thread_abc123\",\n \"run_id\": null,\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": {\n \"value\": \"How does AI work? Explain it in simple terms.\",\n \"annotations\": []\n }\n }\n ],\n \"file_ids\": [],\n \"metadata\": {\n \"modified\": \"true\",\n \"user\": \"abc123\"\n }\n}\n" - } - } - }, - "delete": { - "operationId": "deleteMessage", - "tags": [ - "Assistants" - ], - "summary": "Deletes a message.", - "parameters": [ - { - "in": "path", - "name": "thread_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the thread to which this message belongs." - }, - { - "in": "path", - "name": "message_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the message to delete." - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DeleteMessageResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Delete message", - "group": "threads", - "beta": true, - "returns": "Deletion status", - "examples": { - "request": { - "curl": "curl -X DELETE https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\ndeleted_message = client.beta.threads.messages.delete(\n message_id=\"msg_abc12\",\n thread_id=\"thread_abc123\",\n)\nprint(deleted_message)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const deletedMessage = await openai.beta.threads.messages.del(\n \"thread_abc123\",\n \"msg_abc123\"\n );\n\n console.log(deletedMessage);\n}" - }, - "response": "{\n \"id\": \"msg_abc123\",\n \"object\": \"thread.message.deleted\",\n \"deleted\": true\n}\n" - } - } - } - }, - "/threads/runs": { - "post": { - "operationId": "createThreadAndRun", - "tags": [ - "Assistants" - ], - "summary": "Create a thread and run it in one request.", - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateThreadAndRunRequest" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RunObject" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Create thread and run", - "group": "threads", - "beta": true, - "returns": "A [run](/docs/api-reference/runs/object) object.", - "examples": [ - { - "title": "Default", - "request": { - "curl": "curl https://api.openai.com/v1/threads/runs \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"assistant_id\": \"asst_abc123\",\n \"thread\": {\n \"messages\": [\n {\"role\": \"user\", \"content\": \"Explain deep learning to a 5 year old.\"}\n ]\n }\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nrun = client.beta.threads.create_and_run(\n assistant_id=\"asst_abc123\",\n thread={\n \"messages\": [\n {\"role\": \"user\", \"content\": \"Explain deep learning to a 5 year old.\"}\n ]\n }\n)\n\nprint(run)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const run = await openai.beta.threads.createAndRun({\n assistant_id: \"asst_abc123\",\n thread: {\n messages: [\n { role: \"user\", content: \"Explain deep learning to a 5 year old.\" },\n ],\n },\n });\n\n console.log(run);\n}\n\nmain();\n" - }, - "response": "{\n \"id\": \"run_abc123\",\n \"object\": \"thread.run\",\n \"created_at\": 1699076792,\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"status\": \"queued\",\n \"started_at\": null,\n \"expires_at\": 1699077392,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": null,\n \"required_action\": null,\n \"last_error\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": \"You are a helpful assistant.\",\n \"tools\": [],\n \"tool_resources\": {},\n \"metadata\": {},\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"max_completion_tokens\": null,\n \"max_prompt_tokens\": null,\n \"truncation_strategy\": {\n \"type\": \"auto\",\n \"last_messages\": null\n },\n \"incomplete_details\": null,\n \"usage\": null,\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true\n}\n" - }, - { - "title": "Streaming", - "request": { - "curl": "curl https://api.openai.com/v1/threads/runs \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"assistant_id\": \"asst_123\",\n \"thread\": {\n \"messages\": [\n {\"role\": \"user\", \"content\": \"Hello\"}\n ]\n },\n \"stream\": true\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nstream = client.beta.threads.create_and_run(\n assistant_id=\"asst_123\",\n thread={\n \"messages\": [\n {\"role\": \"user\", \"content\": \"Hello\"}\n ]\n },\n stream=True\n)\n\nfor event in stream:\n print(event)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const stream = await openai.beta.threads.createAndRun({\n assistant_id: \"asst_123\",\n thread: {\n messages: [\n { role: \"user\", content: \"Hello\" },\n ],\n },\n stream: true\n });\n\n for await (const event of stream) {\n console.log(event);\n }\n}\n\nmain();\n" - }, - "response": "event: thread.created\ndata: {\"id\":\"thread_123\",\"object\":\"thread\",\"created_at\":1710348075,\"metadata\":{}}\n\nevent: thread.run.created\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710348075,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":null,\"expires_at\":1710348675,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[],\"tool_resources\":{},\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}\n\nevent: thread.run.queued\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710348075,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":null,\"expires_at\":1710348675,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[],\"tool_resources\":{},\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}\n\nevent: thread.run.in_progress\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710348075,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"in_progress\",\"started_at\":null,\"expires_at\":1710348675,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[],\"tool_resources\":{},\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}\n\nevent: thread.run.step.created\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710348076,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710348675,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":null}\n\nevent: thread.run.step.in_progress\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710348076,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710348675,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":null}\n\nevent: thread.message.created\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710348076,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"in_progress\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":null,\"role\":\"assistant\",\"content\":[], \"metadata\":{}}\n\nevent: thread.message.in_progress\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710348076,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"in_progress\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":null,\"role\":\"assistant\",\"content\":[], \"metadata\":{}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\"Hello\",\"annotations\":[]}}]}}\n\n...\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\" today\"}}]}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\"?\"}}]}}\n\nevent: thread.message.completed\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710348076,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"completed\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":1710348077,\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":{\"value\":\"Hello! How can I assist you today?\",\"annotations\":[]}}], \"metadata\":{}}\n\nevent: thread.run.step.completed\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710348076,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"completed\",\"cancelled_at\":null,\"completed_at\":1710348077,\"expires_at\":1710348675,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":{\"prompt_tokens\":20,\"completion_tokens\":11,\"total_tokens\":31}}\n\nevent: thread.run.completed\n{\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710348076,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"completed\",\"started_at\":1713226836,\"expires_at\":null,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":1713226837,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":{\"prompt_tokens\":345,\"completion_tokens\":11,\"total_tokens\":356},\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}\n\nevent: done\ndata: [DONE]\n" - }, - { - "title": "Streaming with Functions", - "request": { - "curl": "curl https://api.openai.com/v1/threads/runs \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"assistant_id\": \"asst_abc123\",\n \"thread\": {\n \"messages\": [\n {\"role\": \"user\", \"content\": \"What is the weather like in San Francisco?\"}\n ]\n },\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather in a given location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\"\n },\n \"unit\": {\n \"type\": \"string\",\n \"enum\": [\"celsius\", \"fahrenheit\"]\n }\n },\n \"required\": [\"location\"]\n }\n }\n }\n ],\n \"stream\": true\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\ntools = [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather in a given location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\",\n },\n \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"]},\n },\n \"required\": [\"location\"],\n },\n }\n }\n]\n\nstream = client.beta.threads.create_and_run(\n thread={\n \"messages\": [\n {\"role\": \"user\", \"content\": \"What is the weather like in San Francisco?\"}\n ]\n },\n assistant_id=\"asst_abc123\",\n tools=tools,\n stream=True\n)\n\nfor event in stream:\n print(event)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst tools = [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather in a given location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\",\n },\n \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"]},\n },\n \"required\": [\"location\"],\n },\n }\n }\n];\n\nasync function main() {\n const stream = await openai.beta.threads.createAndRun({\n assistant_id: \"asst_123\",\n thread: {\n messages: [\n { role: \"user\", content: \"What is the weather like in San Francisco?\" },\n ],\n },\n tools: tools,\n stream: true\n });\n\n for await (const event of stream) {\n console.log(event);\n }\n}\n\nmain();\n" - }, - "response": "event: thread.created\ndata: {\"id\":\"thread_123\",\"object\":\"thread\",\"created_at\":1710351818,\"metadata\":{}}\n\nevent: thread.run.created\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710351818,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":null,\"expires_at\":1710352418,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"description\":\"Get the current weather in a given location\",\"parameters\":{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\",\"description\":\"The city and state, e.g. San Francisco, CA\"},\"unit\":{\"type\":\"string\",\"enum\":[\"celsius\",\"fahrenheit\"]}},\"required\":[\"location\"]}}}],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.queued\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710351818,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":null,\"expires_at\":1710352418,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"description\":\"Get the current weather in a given location\",\"parameters\":{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\",\"description\":\"The city and state, e.g. San Francisco, CA\"},\"unit\":{\"type\":\"string\",\"enum\":[\"celsius\",\"fahrenheit\"]}},\"required\":[\"location\"]}}}],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.in_progress\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710351818,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"in_progress\",\"started_at\":1710351818,\"expires_at\":1710352418,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"description\":\"Get the current weather in a given location\",\"parameters\":{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\",\"description\":\"The city and state, e.g. San Francisco, CA\"},\"unit\":{\"type\":\"string\",\"enum\":[\"celsius\",\"fahrenheit\"]}},\"required\":[\"location\"]}}}],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.step.created\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710351819,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"tool_calls\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710352418,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"tool_calls\",\"tool_calls\":[]},\"usage\":null}\n\nevent: thread.run.step.in_progress\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710351819,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"tool_calls\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710352418,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"tool_calls\",\"tool_calls\":[]},\"usage\":null}\n\nevent: thread.run.step.delta\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step.delta\",\"delta\":{\"step_details\":{\"type\":\"tool_calls\",\"tool_calls\":[{\"index\":0,\"id\":\"call_XXNp8YGaFrjrSjgqxtC8JJ1B\",\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"arguments\":\"\",\"output\":null}}]}}}\n\nevent: thread.run.step.delta\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step.delta\",\"delta\":{\"step_details\":{\"type\":\"tool_calls\",\"tool_calls\":[{\"index\":0,\"type\":\"function\",\"function\":{\"arguments\":\"{\\\"\"}}]}}}\n\nevent: thread.run.step.delta\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step.delta\",\"delta\":{\"step_details\":{\"type\":\"tool_calls\",\"tool_calls\":[{\"index\":0,\"type\":\"function\",\"function\":{\"arguments\":\"location\"}}]}}}\n\n...\n\nevent: thread.run.step.delta\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step.delta\",\"delta\":{\"step_details\":{\"type\":\"tool_calls\",\"tool_calls\":[{\"index\":0,\"type\":\"function\",\"function\":{\"arguments\":\"ahrenheit\"}}]}}}\n\nevent: thread.run.step.delta\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step.delta\",\"delta\":{\"step_details\":{\"type\":\"tool_calls\",\"tool_calls\":[{\"index\":0,\"type\":\"function\",\"function\":{\"arguments\":\"\\\"}\"}}]}}}\n\nevent: thread.run.requires_action\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710351818,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"requires_action\",\"started_at\":1710351818,\"expires_at\":1710352418,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":{\"type\":\"submit_tool_outputs\",\"submit_tool_outputs\":{\"tool_calls\":[{\"id\":\"call_XXNp8YGaFrjrSjgqxtC8JJ1B\",\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"arguments\":\"{\\\"location\\\":\\\"San Francisco, CA\\\",\\\"unit\\\":\\\"fahrenheit\\\"}\"}}]}},\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"description\":\"Get the current weather in a given location\",\"parameters\":{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\",\"description\":\"The city and state, e.g. San Francisco, CA\"},\"unit\":{\"type\":\"string\",\"enum\":[\"celsius\",\"fahrenheit\"]}},\"required\":[\"location\"]}}}],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":{\"prompt_tokens\":345,\"completion_tokens\":11,\"total_tokens\":356},\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: done\ndata: [DONE]\n" - } - ] - } - } - }, - "/threads/{thread_id}/runs": { - "get": { - "operationId": "listRuns", - "tags": [ - "Assistants" - ], - "summary": "Returns a list of runs belonging to a thread.", - "parameters": [ - { - "name": "thread_id", - "in": "path", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the thread the run belongs to." - }, - { - "name": "limit", - "in": "query", - "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n", - "required": false, - "schema": { - "type": "integer", - "default": 20 - } - }, - { - "name": "order", - "in": "query", - "description": "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n", - "schema": { - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ] - } - }, - { - "name": "after", - "in": "query", - "description": "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n", - "schema": { - "type": "string" - } - }, - { - "name": "before", - "in": "query", - "description": "A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.\n", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ListRunsResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "List runs", - "group": "threads", - "beta": true, - "returns": "A list of [run](/docs/api-reference/runs/object) objects.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/threads/thread_abc123/runs \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nruns = client.beta.threads.runs.list(\n \"thread_abc123\"\n)\n\nprint(runs)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const runs = await openai.beta.threads.runs.list(\n \"thread_abc123\"\n );\n\n console.log(runs);\n}\n\nmain();\n" - }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"run_abc123\",\n \"object\": \"thread.run\",\n \"created_at\": 1699075072,\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"status\": \"completed\",\n \"started_at\": 1699075072,\n \"expires_at\": null,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": 1699075073,\n \"last_error\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": null,\n \"incomplete_details\": null,\n \"tools\": [\n {\n \"type\": \"code_interpreter\"\n }\n ],\n \"tool_resources\": {\n \"code_interpreter\": {\n \"file_ids\": [\n \"file-abc123\",\n \"file-abc456\"\n ]\n }\n },\n \"metadata\": {},\n \"usage\": {\n \"prompt_tokens\": 123,\n \"completion_tokens\": 456,\n \"total_tokens\": 579\n },\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"max_prompt_tokens\": 1000,\n \"max_completion_tokens\": 1000,\n \"truncation_strategy\": {\n \"type\": \"auto\",\n \"last_messages\": null\n },\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true\n },\n {\n \"id\": \"run_abc456\",\n \"object\": \"thread.run\",\n \"created_at\": 1699063290,\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"status\": \"completed\",\n \"started_at\": 1699063290,\n \"expires_at\": null,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": 1699063291,\n \"last_error\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": null,\n \"incomplete_details\": null,\n \"tools\": [\n {\n \"type\": \"code_interpreter\"\n }\n ],\n \"tool_resources\": {\n \"code_interpreter\": {\n \"file_ids\": [\n \"file-abc123\",\n \"file-abc456\"\n ]\n }\n },\n \"metadata\": {},\n \"usage\": {\n \"prompt_tokens\": 123,\n \"completion_tokens\": 456,\n \"total_tokens\": 579\n },\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"max_prompt_tokens\": 1000,\n \"max_completion_tokens\": 1000,\n \"truncation_strategy\": {\n \"type\": \"auto\",\n \"last_messages\": null\n },\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true\n }\n ],\n \"first_id\": \"run_abc123\",\n \"last_id\": \"run_abc456\",\n \"has_more\": false\n}\n" - } - } - }, - "post": { - "operationId": "createRun", - "tags": [ - "Assistants" - ], - "summary": "Create a run.", - "parameters": [ - { - "in": "path", - "name": "thread_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the thread to run." - }, - { - "name": "include[]", - "in": "query", - "description": "A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content.\n\nSee the [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) for more information.\n", - "schema": { - "type": "array", - "items": { - "type": "string", - "enum": [ - "step_details.tool_calls[*].file_search.results[*].content" - ] - } - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateRunRequest" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RunObject" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Create run", - "group": "threads", - "beta": true, - "returns": "A [run](/docs/api-reference/runs/object) object.", - "examples": [ - { - "title": "Default", - "request": { - "curl": "curl https://api.openai.com/v1/threads/thread_abc123/runs \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"assistant_id\": \"asst_abc123\"\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nrun = client.beta.threads.runs.create(\n thread_id=\"thread_abc123\",\n assistant_id=\"asst_abc123\"\n)\n\nprint(run)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const run = await openai.beta.threads.runs.create(\n \"thread_abc123\",\n { assistant_id: \"asst_abc123\" }\n );\n\n console.log(run);\n}\n\nmain();\n" - }, - "response": "{\n \"id\": \"run_abc123\",\n \"object\": \"thread.run\",\n \"created_at\": 1699063290,\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"status\": \"queued\",\n \"started_at\": 1699063290,\n \"expires_at\": null,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": 1699063291,\n \"last_error\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": null,\n \"incomplete_details\": null,\n \"tools\": [\n {\n \"type\": \"code_interpreter\"\n }\n ],\n \"metadata\": {},\n \"usage\": null,\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"max_prompt_tokens\": 1000,\n \"max_completion_tokens\": 1000,\n \"truncation_strategy\": {\n \"type\": \"auto\",\n \"last_messages\": null\n },\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true\n}\n" - }, - { - "title": "Streaming", - "request": { - "curl": "curl https://api.openai.com/v1/threads/thread_123/runs \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"assistant_id\": \"asst_123\",\n \"stream\": true\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nstream = client.beta.threads.runs.create(\n thread_id=\"thread_123\",\n assistant_id=\"asst_123\",\n stream=True\n)\n\nfor event in stream:\n print(event)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const stream = await openai.beta.threads.runs.create(\n \"thread_123\",\n { assistant_id: \"asst_123\", stream: true }\n );\n\n for await (const event of stream) {\n console.log(event);\n }\n}\n\nmain();\n" - }, - "response": "event: thread.run.created\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710330640,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":null,\"expires_at\":1710331240,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.queued\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710330640,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":null,\"expires_at\":1710331240,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.in_progress\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710330640,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"in_progress\",\"started_at\":1710330641,\"expires_at\":1710331240,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.step.created\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710330641,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710331240,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":null}\n\nevent: thread.run.step.in_progress\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710330641,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710331240,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":null}\n\nevent: thread.message.created\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710330641,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"in_progress\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":null,\"role\":\"assistant\",\"content\":[],\"metadata\":{}}\n\nevent: thread.message.in_progress\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710330641,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"in_progress\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":null,\"role\":\"assistant\",\"content\":[],\"metadata\":{}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\"Hello\",\"annotations\":[]}}]}}\n\n...\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\" today\"}}]}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\"?\"}}]}}\n\nevent: thread.message.completed\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710330641,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"completed\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":1710330642,\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":{\"value\":\"Hello! How can I assist you today?\",\"annotations\":[]}}],\"metadata\":{}}\n\nevent: thread.run.step.completed\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710330641,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"completed\",\"cancelled_at\":null,\"completed_at\":1710330642,\"expires_at\":1710331240,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":{\"prompt_tokens\":20,\"completion_tokens\":11,\"total_tokens\":31}}\n\nevent: thread.run.completed\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710330640,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"completed\",\"started_at\":1710330641,\"expires_at\":null,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":1710330642,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":{\"prompt_tokens\":20,\"completion_tokens\":11,\"total_tokens\":31},\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: done\ndata: [DONE]\n" - }, - { - "title": "Streaming with Functions", - "request": { - "curl": "curl https://api.openai.com/v1/threads/thread_abc123/runs \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"assistant_id\": \"asst_abc123\",\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather in a given location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\"\n },\n \"unit\": {\n \"type\": \"string\",\n \"enum\": [\"celsius\", \"fahrenheit\"]\n }\n },\n \"required\": [\"location\"]\n }\n }\n }\n ],\n \"stream\": true\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\ntools = [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather in a given location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\",\n },\n \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"]},\n },\n \"required\": [\"location\"],\n },\n }\n }\n]\n\nstream = client.beta.threads.runs.create(\n thread_id=\"thread_abc123\",\n assistant_id=\"asst_abc123\",\n tools=tools,\n stream=True\n)\n\nfor event in stream:\n print(event)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst tools = [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather in a given location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\",\n },\n \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"]},\n },\n \"required\": [\"location\"],\n },\n }\n }\n];\n\nasync function main() {\n const stream = await openai.beta.threads.runs.create(\n \"thread_abc123\",\n {\n assistant_id: \"asst_abc123\",\n tools: tools,\n stream: true\n }\n );\n\n for await (const event of stream) {\n console.log(event);\n }\n}\n\nmain();\n" - }, - "response": "event: thread.run.created\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710348075,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":null,\"expires_at\":1710348675,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.queued\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710348075,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":null,\"expires_at\":1710348675,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.in_progress\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710348075,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"in_progress\",\"started_at\":1710348075,\"expires_at\":1710348675,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.step.created\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710348076,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710348675,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":null}\n\nevent: thread.run.step.in_progress\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710348076,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710348675,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":null}\n\nevent: thread.message.created\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710348076,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"in_progress\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":null,\"role\":\"assistant\",\"content\":[],\"metadata\":{}}\n\nevent: thread.message.in_progress\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710348076,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"in_progress\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":null,\"role\":\"assistant\",\"content\":[],\"metadata\":{}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\"Hello\",\"annotations\":[]}}]}}\n\n...\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\" today\"}}]}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\"?\"}}]}}\n\nevent: thread.message.completed\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710348076,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"completed\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":1710348077,\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":{\"value\":\"Hello! How can I assist you today?\",\"annotations\":[]}}],\"metadata\":{}}\n\nevent: thread.run.step.completed\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710348076,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"completed\",\"cancelled_at\":null,\"completed_at\":1710348077,\"expires_at\":1710348675,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":{\"prompt_tokens\":20,\"completion_tokens\":11,\"total_tokens\":31}}\n\nevent: thread.run.completed\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710348075,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"completed\",\"started_at\":1710348075,\"expires_at\":null,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":1710348077,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":{\"prompt_tokens\":20,\"completion_tokens\":11,\"total_tokens\":31},\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: done\ndata: [DONE]\n" - } - ] - } - } - }, - "/threads/{thread_id}/runs/{run_id}": { - "get": { - "operationId": "getRun", - "tags": [ - "Assistants" - ], - "summary": "Retrieves a run.", - "parameters": [ - { - "in": "path", - "name": "thread_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the [thread](/docs/api-reference/threads) that was run." - }, - { - "in": "path", - "name": "run_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the run to retrieve." - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RunObject" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Retrieve run", - "group": "threads", - "beta": true, - "returns": "The [run](/docs/api-reference/runs/object) object matching the specified ID.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nrun = client.beta.threads.runs.retrieve(\n thread_id=\"thread_abc123\",\n run_id=\"run_abc123\"\n)\n\nprint(run)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const run = await openai.beta.threads.runs.retrieve(\n \"thread_abc123\",\n \"run_abc123\"\n );\n\n console.log(run);\n}\n\nmain();\n" - }, - "response": "{\n \"id\": \"run_abc123\",\n \"object\": \"thread.run\",\n \"created_at\": 1699075072,\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"status\": \"completed\",\n \"started_at\": 1699075072,\n \"expires_at\": null,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": 1699075073,\n \"last_error\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": null,\n \"incomplete_details\": null,\n \"tools\": [\n {\n \"type\": \"code_interpreter\"\n }\n ],\n \"metadata\": {},\n \"usage\": {\n \"prompt_tokens\": 123,\n \"completion_tokens\": 456,\n \"total_tokens\": 579\n },\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"max_prompt_tokens\": 1000,\n \"max_completion_tokens\": 1000,\n \"truncation_strategy\": {\n \"type\": \"auto\",\n \"last_messages\": null\n },\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true\n}\n" - } - } - }, - "post": { - "operationId": "modifyRun", - "tags": [ - "Assistants" - ], - "summary": "Modifies a run.", - "parameters": [ - { - "in": "path", - "name": "thread_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the [thread](/docs/api-reference/threads) that was run." - }, - { - "in": "path", - "name": "run_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the run to modify." - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ModifyRunRequest" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RunObject" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Modify run", - "group": "threads", - "beta": true, - "returns": "The modified [run](/docs/api-reference/runs/object) object matching the specified ID.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"metadata\": {\n \"user_id\": \"user_abc123\"\n }\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nrun = client.beta.threads.runs.update(\n thread_id=\"thread_abc123\",\n run_id=\"run_abc123\",\n metadata={\"user_id\": \"user_abc123\"},\n)\n\nprint(run)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const run = await openai.beta.threads.runs.update(\n \"thread_abc123\",\n \"run_abc123\",\n {\n metadata: {\n user_id: \"user_abc123\",\n },\n }\n );\n\n console.log(run);\n}\n\nmain();\n" - }, - "response": "{\n \"id\": \"run_abc123\",\n \"object\": \"thread.run\",\n \"created_at\": 1699075072,\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"status\": \"completed\",\n \"started_at\": 1699075072,\n \"expires_at\": null,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": 1699075073,\n \"last_error\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": null,\n \"incomplete_details\": null,\n \"tools\": [\n {\n \"type\": \"code_interpreter\"\n }\n ],\n \"tool_resources\": {\n \"code_interpreter\": {\n \"file_ids\": [\n \"file-abc123\",\n \"file-abc456\"\n ]\n }\n },\n \"metadata\": {\n \"user_id\": \"user_abc123\"\n },\n \"usage\": {\n \"prompt_tokens\": 123,\n \"completion_tokens\": 456,\n \"total_tokens\": 579\n },\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"max_prompt_tokens\": 1000,\n \"max_completion_tokens\": 1000,\n \"truncation_strategy\": {\n \"type\": \"auto\",\n \"last_messages\": null\n },\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true\n}\n" - } - } - } - }, - "/threads/{thread_id}/runs/{run_id}/submit_tool_outputs": { - "post": { - "operationId": "submitToolOuputsToRun", - "tags": [ - "Assistants" - ], - "summary": "When a run has the `status: \"requires_action\"` and `required_action.type` is `submit_tool_outputs`, this endpoint can be used to submit the outputs from the tool calls once they're all completed. All outputs must be submitted in a single request.\n", - "parameters": [ - { - "in": "path", - "name": "thread_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the [thread](/docs/api-reference/threads) to which this run belongs." - }, - { - "in": "path", - "name": "run_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the run that requires the tool output submission." - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SubmitToolOutputsRunRequest" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RunObject" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Submit tool outputs to run", - "group": "threads", - "beta": true, - "returns": "The modified [run](/docs/api-reference/runs/object) object matching the specified ID.", - "examples": [ - { - "title": "Default", - "request": { - "curl": "curl https://api.openai.com/v1/threads/thread_123/runs/run_123/submit_tool_outputs \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"tool_outputs\": [\n {\n \"tool_call_id\": \"call_001\",\n \"output\": \"70 degrees and sunny.\"\n }\n ]\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nrun = client.beta.threads.runs.submit_tool_outputs(\n thread_id=\"thread_123\",\n run_id=\"run_123\",\n tool_outputs=[\n {\n \"tool_call_id\": \"call_001\",\n \"output\": \"70 degrees and sunny.\"\n }\n ]\n)\n\nprint(run)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const run = await openai.beta.threads.runs.submitToolOutputs(\n \"thread_123\",\n \"run_123\",\n {\n tool_outputs: [\n {\n tool_call_id: \"call_001\",\n output: \"70 degrees and sunny.\",\n },\n ],\n }\n );\n\n console.log(run);\n}\n\nmain();\n" - }, - "response": "{\n \"id\": \"run_123\",\n \"object\": \"thread.run\",\n \"created_at\": 1699075592,\n \"assistant_id\": \"asst_123\",\n \"thread_id\": \"thread_123\",\n \"status\": \"queued\",\n \"started_at\": 1699075592,\n \"expires_at\": 1699076192,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": null,\n \"last_error\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": null,\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather in a given location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\"\n },\n \"unit\": {\n \"type\": \"string\",\n \"enum\": [\"celsius\", \"fahrenheit\"]\n }\n },\n \"required\": [\"location\"]\n }\n }\n }\n ],\n \"metadata\": {},\n \"usage\": null,\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"max_prompt_tokens\": 1000,\n \"max_completion_tokens\": 1000,\n \"truncation_strategy\": {\n \"type\": \"auto\",\n \"last_messages\": null\n },\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true\n}\n" - }, - { - "title": "Streaming", - "request": { - "curl": "curl https://api.openai.com/v1/threads/thread_123/runs/run_123/submit_tool_outputs \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"tool_outputs\": [\n {\n \"tool_call_id\": \"call_001\",\n \"output\": \"70 degrees and sunny.\"\n }\n ],\n \"stream\": true\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nstream = client.beta.threads.runs.submit_tool_outputs(\n thread_id=\"thread_123\",\n run_id=\"run_123\",\n tool_outputs=[\n {\n \"tool_call_id\": \"call_001\",\n \"output\": \"70 degrees and sunny.\"\n }\n ],\n stream=True\n)\n\nfor event in stream:\n print(event)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const stream = await openai.beta.threads.runs.submitToolOutputs(\n \"thread_123\",\n \"run_123\",\n {\n tool_outputs: [\n {\n tool_call_id: \"call_001\",\n output: \"70 degrees and sunny.\",\n },\n ],\n }\n );\n\n for await (const event of stream) {\n console.log(event);\n }\n}\n\nmain();\n" - }, - "response": "event: thread.run.step.completed\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710352449,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"tool_calls\",\"status\":\"completed\",\"cancelled_at\":null,\"completed_at\":1710352475,\"expires_at\":1710353047,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"tool_calls\",\"tool_calls\":[{\"id\":\"call_iWr0kQ2EaYMaxNdl0v3KYkx7\",\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"arguments\":\"{\\\"location\\\":\\\"San Francisco, CA\\\",\\\"unit\\\":\\\"fahrenheit\\\"}\",\"output\":\"70 degrees and sunny.\"}}]},\"usage\":{\"prompt_tokens\":291,\"completion_tokens\":24,\"total_tokens\":315}}\n\nevent: thread.run.queued\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710352447,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":1710352448,\"expires_at\":1710353047,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"description\":\"Get the current weather in a given location\",\"parameters\":{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\",\"description\":\"The city and state, e.g. San Francisco, CA\"},\"unit\":{\"type\":\"string\",\"enum\":[\"celsius\",\"fahrenheit\"]}},\"required\":[\"location\"]}}}],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.in_progress\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710352447,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"in_progress\",\"started_at\":1710352475,\"expires_at\":1710353047,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"description\":\"Get the current weather in a given location\",\"parameters\":{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\",\"description\":\"The city and state, e.g. San Francisco, CA\"},\"unit\":{\"type\":\"string\",\"enum\":[\"celsius\",\"fahrenheit\"]}},\"required\":[\"location\"]}}}],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.step.created\ndata: {\"id\":\"step_002\",\"object\":\"thread.run.step\",\"created_at\":1710352476,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710353047,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_002\"}},\"usage\":null}\n\nevent: thread.run.step.in_progress\ndata: {\"id\":\"step_002\",\"object\":\"thread.run.step\",\"created_at\":1710352476,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710353047,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_002\"}},\"usage\":null}\n\nevent: thread.message.created\ndata: {\"id\":\"msg_002\",\"object\":\"thread.message\",\"created_at\":1710352476,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"in_progress\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":null,\"role\":\"assistant\",\"content\":[],\"metadata\":{}}\n\nevent: thread.message.in_progress\ndata: {\"id\":\"msg_002\",\"object\":\"thread.message\",\"created_at\":1710352476,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"in_progress\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":null,\"role\":\"assistant\",\"content\":[],\"metadata\":{}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_002\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\"The\",\"annotations\":[]}}]}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_002\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\" current\"}}]}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_002\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\" weather\"}}]}}\n\n...\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_002\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\" sunny\"}}]}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_002\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\".\"}}]}}\n\nevent: thread.message.completed\ndata: {\"id\":\"msg_002\",\"object\":\"thread.message\",\"created_at\":1710352476,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"completed\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":1710352477,\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":{\"value\":\"The current weather in San Francisco, CA is 70 degrees Fahrenheit and sunny.\",\"annotations\":[]}}],\"metadata\":{}}\n\nevent: thread.run.step.completed\ndata: {\"id\":\"step_002\",\"object\":\"thread.run.step\",\"created_at\":1710352476,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"completed\",\"cancelled_at\":null,\"completed_at\":1710352477,\"expires_at\":1710353047,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_002\"}},\"usage\":{\"prompt_tokens\":329,\"completion_tokens\":18,\"total_tokens\":347}}\n\nevent: thread.run.completed\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710352447,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"completed\",\"started_at\":1710352475,\"expires_at\":null,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":1710352477,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"description\":\"Get the current weather in a given location\",\"parameters\":{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\",\"description\":\"The city and state, e.g. San Francisco, CA\"},\"unit\":{\"type\":\"string\",\"enum\":[\"celsius\",\"fahrenheit\"]}},\"required\":[\"location\"]}}}],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":{\"prompt_tokens\":20,\"completion_tokens\":11,\"total_tokens\":31},\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: done\ndata: [DONE]\n" - } - ] - } - } - }, - "/threads/{thread_id}/runs/{run_id}/cancel": { - "post": { - "operationId": "cancelRun", - "tags": [ - "Assistants" - ], - "summary": "Cancels a run that is `in_progress`.", - "parameters": [ - { - "in": "path", - "name": "thread_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the thread to which this run belongs." - }, - { - "in": "path", - "name": "run_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the run to cancel." - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RunObject" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Cancel a run", - "group": "threads", - "beta": true, - "returns": "The modified [run](/docs/api-reference/runs/object) object matching the specified ID.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/cancel \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -X POST\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nrun = client.beta.threads.runs.cancel(\n thread_id=\"thread_abc123\",\n run_id=\"run_abc123\"\n)\n\nprint(run)\n", - "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const run = await openai.beta.threads.runs.cancel(\n \"thread_abc123\",\n \"run_abc123\"\n );\n\n console.log(run);\n}\n\nmain();\n" - }, - "response": "{\n \"id\": \"run_abc123\",\n \"object\": \"thread.run\",\n \"created_at\": 1699076126,\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"status\": \"cancelling\",\n \"started_at\": 1699076126,\n \"expires_at\": 1699076726,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": null,\n \"last_error\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": \"You summarize books.\",\n \"tools\": [\n {\n \"type\": \"file_search\"\n }\n ],\n \"tool_resources\": {\n \"file_search\": {\n \"vector_store_ids\": [\"vs_123\"]\n }\n },\n \"metadata\": {},\n \"usage\": null,\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true\n}\n" - } - } - } - }, - "/threads/{thread_id}/runs/{run_id}/steps": { - "get": { - "operationId": "listRunSteps", - "tags": [ - "Assistants" - ], - "summary": "Returns a list of run steps belonging to a run.", - "parameters": [ - { - "name": "thread_id", - "in": "path", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the thread the run and run steps belong to." - }, - { - "name": "run_id", - "in": "path", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the run the run steps belong to." - }, - { - "name": "limit", - "in": "query", - "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n", - "required": false, - "schema": { - "type": "integer", - "default": 20 - } - }, - { - "name": "order", - "in": "query", - "description": "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n", - "schema": { - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ] - } - }, - { - "name": "after", - "in": "query", - "description": "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n", - "schema": { - "type": "string" - } - }, - { - "name": "before", - "in": "query", - "description": "A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.\n", - "schema": { - "type": "string" - } - }, - { - "name": "include[]", - "in": "query", - "description": "A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content.\n\nSee the [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) for more information.\n", - "schema": { - "type": "array", - "items": { - "type": "string", - "enum": [ - "step_details.tool_calls[*].file_search.results[*].content" - ] - } - } - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ListRunStepsResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "List run steps", - "group": "threads", - "beta": true, - "returns": "A list of [run step](/docs/api-reference/run-steps/step-object) objects.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/steps \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nrun_steps = client.beta.threads.runs.steps.list(\n thread_id=\"thread_abc123\",\n run_id=\"run_abc123\"\n)\n\nprint(run_steps)\n", - "node.js": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const runStep = await openai.beta.threads.runs.steps.list(\n \"thread_abc123\",\n \"run_abc123\"\n );\n console.log(runStep);\n}\n\nmain();\n" - }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"step_abc123\",\n \"object\": \"thread.run.step\",\n \"created_at\": 1699063291,\n \"run_id\": \"run_abc123\",\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"type\": \"message_creation\",\n \"status\": \"completed\",\n \"cancelled_at\": null,\n \"completed_at\": 1699063291,\n \"expired_at\": null,\n \"failed_at\": null,\n \"last_error\": null,\n \"step_details\": {\n \"type\": \"message_creation\",\n \"message_creation\": {\n \"message_id\": \"msg_abc123\"\n }\n },\n \"usage\": {\n \"prompt_tokens\": 123,\n \"completion_tokens\": 456,\n \"total_tokens\": 579\n }\n }\n ],\n \"first_id\": \"step_abc123\",\n \"last_id\": \"step_abc456\",\n \"has_more\": false\n}\n" - } - } - } - }, - "/threads/{thread_id}/runs/{run_id}/steps/{step_id}": { - "get": { - "operationId": "getRunStep", - "tags": [ - "Assistants" - ], - "summary": "Retrieves a run step.", - "parameters": [ - { - "in": "path", - "name": "thread_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the thread to which the run and run step belongs." - }, - { - "in": "path", - "name": "run_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the run to which the run step belongs." - }, - { - "in": "path", - "name": "step_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the run step to retrieve." - }, - { - "name": "include[]", - "in": "query", - "description": "A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content.\n\nSee the [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) for more information.\n", - "schema": { - "type": "array", - "items": { - "type": "string", - "enum": [ - "step_details.tool_calls[*].file_search.results[*].content" - ] - } - } - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RunStepObject" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Retrieve run step", - "group": "threads", - "beta": true, - "returns": "The [run step](/docs/api-reference/run-steps/step-object) object matching the specified ID.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/steps/step_abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nrun_step = client.beta.threads.runs.steps.retrieve(\n thread_id=\"thread_abc123\",\n run_id=\"run_abc123\",\n step_id=\"step_abc123\"\n)\n\nprint(run_step)\n", - "node.js": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const runStep = await openai.beta.threads.runs.steps.retrieve(\n \"thread_abc123\",\n \"run_abc123\",\n \"step_abc123\"\n );\n console.log(runStep);\n}\n\nmain();\n" - }, - "response": "{\n \"id\": \"step_abc123\",\n \"object\": \"thread.run.step\",\n \"created_at\": 1699063291,\n \"run_id\": \"run_abc123\",\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"type\": \"message_creation\",\n \"status\": \"completed\",\n \"cancelled_at\": null,\n \"completed_at\": 1699063291,\n \"expired_at\": null,\n \"failed_at\": null,\n \"last_error\": null,\n \"step_details\": {\n \"type\": \"message_creation\",\n \"message_creation\": {\n \"message_id\": \"msg_abc123\"\n }\n },\n \"usage\": {\n \"prompt_tokens\": 123,\n \"completion_tokens\": 456,\n \"total_tokens\": 579\n }\n}\n" - } - } - } - }, - "/vector_stores": { - "get": { - "operationId": "listVectorStores", - "tags": [ - "Vector Stores" - ], - "summary": "Returns a list of vector stores.", - "parameters": [ - { - "name": "limit", - "in": "query", - "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n", - "required": false, - "schema": { - "type": "integer", - "default": 20 - } - }, - { - "name": "order", - "in": "query", - "description": "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n", - "schema": { - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ] - } - }, - { - "name": "after", - "in": "query", - "description": "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n", - "schema": { - "type": "string" - } - }, - { - "name": "before", - "in": "query", - "description": "A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.\n", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ListVectorStoresResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "List vector stores", - "group": "vector_stores", - "beta": true, - "returns": "A list of [vector store](/docs/api-reference/vector-stores/object) objects.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/vector_stores \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nvector_stores = client.beta.vector_stores.list()\nprint(vector_stores)\n", - "node.js": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStores = await openai.beta.vectorStores.list();\n console.log(vectorStores);\n}\n\nmain();\n" - }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"vs_abc123\",\n \"object\": \"vector_store\",\n \"created_at\": 1699061776,\n \"name\": \"Support FAQ\",\n \"bytes\": 139920,\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 3,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 3\n }\n },\n {\n \"id\": \"vs_abc456\",\n \"object\": \"vector_store\",\n \"created_at\": 1699061776,\n \"name\": \"Support FAQ v2\",\n \"bytes\": 139920,\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 3,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 3\n }\n }\n ],\n \"first_id\": \"vs_abc123\",\n \"last_id\": \"vs_abc456\",\n \"has_more\": false\n}\n" - } - } - }, - "post": { - "operationId": "createVectorStore", - "tags": [ - "Vector Stores" - ], - "summary": "Create a vector store.", - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateVectorStoreRequest" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/VectorStoreObject" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Create vector store", - "group": "vector_stores", - "beta": true, - "returns": "A [vector store](/docs/api-reference/vector-stores/object) object.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/vector_stores \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n -d '{\n \"name\": \"Support FAQ\"\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nvector_store = client.beta.vector_stores.create(\n name=\"Support FAQ\"\n)\nprint(vector_store)\n", - "node.js": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStore = await openai.beta.vectorStores.create({\n name: \"Support FAQ\"\n });\n console.log(vectorStore);\n}\n\nmain();\n" - }, - "response": "{\n \"id\": \"vs_abc123\",\n \"object\": \"vector_store\",\n \"created_at\": 1699061776,\n \"name\": \"Support FAQ\",\n \"bytes\": 139920,\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 3,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 3\n }\n}\n" - } - } - } - }, - "/vector_stores/{vector_store_id}": { - "get": { - "operationId": "getVectorStore", - "tags": [ - "Vector Stores" - ], - "summary": "Retrieves a vector store.", - "parameters": [ - { - "in": "path", - "name": "vector_store_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the vector store to retrieve." - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/VectorStoreObject" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Retrieve vector store", - "group": "vector_stores", - "beta": true, - "returns": "The [vector store](/docs/api-reference/vector-stores/object) object matching the specified ID.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/vector_stores/vs_abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nvector_store = client.beta.vector_stores.retrieve(\n vector_store_id=\"vs_abc123\"\n)\nprint(vector_store)\n", - "node.js": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStore = await openai.beta.vectorStores.retrieve(\n \"vs_abc123\"\n );\n console.log(vectorStore);\n}\n\nmain();\n" - }, - "response": "{\n \"id\": \"vs_abc123\",\n \"object\": \"vector_store\",\n \"created_at\": 1699061776\n}\n" - } - } - }, - "post": { - "operationId": "modifyVectorStore", - "tags": [ - "Vector Stores" - ], - "summary": "Modifies a vector store.", - "parameters": [ - { - "in": "path", - "name": "vector_store_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the vector store to modify." - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UpdateVectorStoreRequest" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/VectorStoreObject" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Modify vector store", - "group": "vector_stores", - "beta": true, - "returns": "The modified [vector store](/docs/api-reference/vector-stores/object) object.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/vector_stores/vs_abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n -d '{\n \"name\": \"Support FAQ\"\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nvector_store = client.beta.vector_stores.update(\n vector_store_id=\"vs_abc123\",\n name=\"Support FAQ\"\n)\nprint(vector_store)\n", - "node.js": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStore = await openai.beta.vectorStores.update(\n \"vs_abc123\",\n {\n name: \"Support FAQ\"\n }\n );\n console.log(vectorStore);\n}\n\nmain();\n" - }, - "response": "{\n \"id\": \"vs_abc123\",\n \"object\": \"vector_store\",\n \"created_at\": 1699061776,\n \"name\": \"Support FAQ\",\n \"bytes\": 139920,\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 3,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 3\n }\n}\n" - } - } - }, - "delete": { - "operationId": "deleteVectorStore", - "tags": [ - "Vector Stores" - ], - "summary": "Delete a vector store.", - "parameters": [ - { - "in": "path", - "name": "vector_store_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the vector store to delete." - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DeleteVectorStoreResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Delete vector store", - "group": "vector_stores", - "beta": true, - "returns": "Deletion status", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/vector_stores/vs_abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -X DELETE\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\ndeleted_vector_store = client.beta.vector_stores.delete(\n vector_store_id=\"vs_abc123\"\n)\nprint(deleted_vector_store)\n", - "node.js": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const deletedVectorStore = await openai.beta.vectorStores.del(\n \"vs_abc123\"\n );\n console.log(deletedVectorStore);\n}\n\nmain();\n" - }, - "response": "{\n id: \"vs_abc123\",\n object: \"vector_store.deleted\",\n deleted: true\n}\n" - } - } - } - }, - "/vector_stores/{vector_store_id}/files": { - "get": { - "operationId": "listVectorStoreFiles", - "tags": [ - "Vector Stores" - ], - "summary": "Returns a list of vector store files.", - "parameters": [ - { - "name": "vector_store_id", - "in": "path", - "description": "The ID of the vector store that the files belong to.", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "limit", - "in": "query", - "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n", - "required": false, - "schema": { - "type": "integer", - "default": 20 - } - }, - { - "name": "order", - "in": "query", - "description": "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n", - "schema": { - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ] - } - }, - { - "name": "after", - "in": "query", - "description": "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n", - "schema": { - "type": "string" - } - }, - { - "name": "before", - "in": "query", - "description": "A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.\n", - "schema": { - "type": "string" - } - }, - { - "name": "filter", - "in": "query", - "description": "Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`.", - "schema": { - "type": "string", - "enum": [ - "in_progress", - "completed", - "failed", - "cancelled" - ] - } - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ListVectorStoreFilesResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "List vector store files", - "group": "vector_stores", - "beta": true, - "returns": "A list of [vector store file](/docs/api-reference/vector-stores-files/file-object) objects.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/vector_stores/vs_abc123/files \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nvector_store_files = client.beta.vector_stores.files.list(\n vector_store_id=\"vs_abc123\"\n)\nprint(vector_store_files)\n", - "node.js": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStoreFiles = await openai.beta.vectorStores.files.list(\n \"vs_abc123\"\n );\n console.log(vectorStoreFiles);\n}\n\nmain();\n" - }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"file-abc123\",\n \"object\": \"vector_store.file\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\"\n },\n {\n \"id\": \"file-abc456\",\n \"object\": \"vector_store.file\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\"\n }\n ],\n \"first_id\": \"file-abc123\",\n \"last_id\": \"file-abc456\",\n \"has_more\": false\n}\n" - } - } - }, - "post": { - "operationId": "createVectorStoreFile", - "tags": [ - "Vector Stores" - ], - "summary": "Create a vector store file by attaching a [File](/docs/api-reference/files) to a [vector store](/docs/api-reference/vector-stores/object).", - "parameters": [ - { - "in": "path", - "name": "vector_store_id", - "required": true, - "schema": { - "type": "string", - "example": "vs_abc123" - }, - "description": "The ID of the vector store for which to create a File.\n" - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateVectorStoreFileRequest" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/VectorStoreFileObject" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Create vector store file", - "group": "vector_stores", - "beta": true, - "returns": "A [vector store file](/docs/api-reference/vector-stores-files/file-object) object.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/vector_stores/vs_abc123/files \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"file_id\": \"file-abc123\"\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nvector_store_file = client.beta.vector_stores.files.create(\n vector_store_id=\"vs_abc123\",\n file_id=\"file-abc123\"\n)\nprint(vector_store_file)\n", - "node.js": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const myVectorStoreFile = await openai.beta.vectorStores.files.create(\n \"vs_abc123\",\n {\n file_id: \"file-abc123\"\n }\n );\n console.log(myVectorStoreFile);\n}\n\nmain();\n" - }, - "response": "{\n \"id\": \"file-abc123\",\n \"object\": \"vector_store.file\",\n \"created_at\": 1699061776,\n \"usage_bytes\": 1234,\n \"vector_store_id\": \"vs_abcd\",\n \"status\": \"completed\",\n \"last_error\": null\n}\n" - } - } - } - }, - "/vector_stores/{vector_store_id}/files/{file_id}": { - "get": { - "operationId": "getVectorStoreFile", - "tags": [ - "Vector Stores" - ], - "summary": "Retrieves a vector store file.", - "parameters": [ - { - "in": "path", - "name": "vector_store_id", - "required": true, - "schema": { - "type": "string", - "example": "vs_abc123" - }, - "description": "The ID of the vector store that the file belongs to." - }, - { - "in": "path", - "name": "file_id", - "required": true, - "schema": { - "type": "string", - "example": "file-abc123" - }, - "description": "The ID of the file being retrieved." - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/VectorStoreFileObject" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Retrieve vector store file", - "group": "vector_stores", - "beta": true, - "returns": "The [vector store file](/docs/api-reference/vector-stores-files/file-object) object.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/vector_stores/vs_abc123/files/file-abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nvector_store_file = client.beta.vector_stores.files.retrieve(\n vector_store_id=\"vs_abc123\",\n file_id=\"file-abc123\"\n)\nprint(vector_store_file)\n", - "node.js": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStoreFile = await openai.beta.vectorStores.files.retrieve(\n \"vs_abc123\",\n \"file-abc123\"\n );\n console.log(vectorStoreFile);\n}\n\nmain();\n" - }, - "response": "{\n \"id\": \"file-abc123\",\n \"object\": \"vector_store.file\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abcd\",\n \"status\": \"completed\",\n \"last_error\": null\n}\n" - } - } - }, - "delete": { - "operationId": "deleteVectorStoreFile", - "tags": [ - "Vector Stores" - ], - "summary": "Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. To delete the file, use the [delete file](/docs/api-reference/files/delete) endpoint.", - "parameters": [ - { - "in": "path", - "name": "vector_store_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the vector store that the file belongs to." - }, - { - "in": "path", - "name": "file_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the file to delete." - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DeleteVectorStoreFileResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Delete vector store file", - "group": "vector_stores", - "beta": true, - "returns": "Deletion status", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/vector_stores/vs_abc123/files/file-abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -X DELETE\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\ndeleted_vector_store_file = client.beta.vector_stores.files.delete(\n vector_store_id=\"vs_abc123\",\n file_id=\"file-abc123\"\n)\nprint(deleted_vector_store_file)\n", - "node.js": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const deletedVectorStoreFile = await openai.beta.vectorStores.files.del(\n \"vs_abc123\",\n \"file-abc123\"\n );\n console.log(deletedVectorStoreFile);\n}\n\nmain();\n" - }, - "response": "{\n id: \"file-abc123\",\n object: \"vector_store.file.deleted\",\n deleted: true\n}\n" - } - } - } - }, - "/vector_stores/{vector_store_id}/file_batches": { - "post": { - "operationId": "createVectorStoreFileBatch", - "tags": [ - "Vector Stores" - ], - "summary": "Create a vector store file batch.", - "parameters": [ - { - "in": "path", - "name": "vector_store_id", - "required": true, - "schema": { - "type": "string", - "example": "vs_abc123" - }, - "description": "The ID of the vector store for which to create a File Batch.\n" - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateVectorStoreFileBatchRequest" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/VectorStoreFileBatchObject" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Create vector store file batch", - "group": "vector_stores", - "beta": true, - "returns": "A [vector store file batch](/docs/api-reference/vector-stores-file-batches/batch-object) object.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/vector_stores/vs_abc123/file_batches \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"file_ids\": [\"file-abc123\", \"file-abc456\"]\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nvector_store_file_batch = client.beta.vector_stores.file_batches.create(\n vector_store_id=\"vs_abc123\",\n file_ids=[\"file-abc123\", \"file-abc456\"]\n)\nprint(vector_store_file_batch)\n", - "node.js": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const myVectorStoreFileBatch = await openai.beta.vectorStores.fileBatches.create(\n \"vs_abc123\",\n {\n file_ids: [\"file-abc123\", \"file-abc456\"]\n }\n );\n console.log(myVectorStoreFileBatch);\n}\n\nmain();\n" - }, - "response": "{\n \"id\": \"vsfb_abc123\",\n \"object\": \"vector_store.file_batch\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\",\n \"status\": \"in_progress\",\n \"file_counts\": {\n \"in_progress\": 1,\n \"completed\": 1,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 0,\n }\n}\n" - } - } - } - }, - "/vector_stores/{vector_store_id}/file_batches/{batch_id}": { - "get": { - "operationId": "getVectorStoreFileBatch", - "tags": [ - "Vector Stores" - ], - "summary": "Retrieves a vector store file batch.", - "parameters": [ - { - "in": "path", - "name": "vector_store_id", - "required": true, - "schema": { - "type": "string", - "example": "vs_abc123" - }, - "description": "The ID of the vector store that the file batch belongs to." - }, - { - "in": "path", - "name": "batch_id", - "required": true, - "schema": { - "type": "string", - "example": "vsfb_abc123" - }, - "description": "The ID of the file batch being retrieved." - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/VectorStoreFileBatchObject" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Retrieve vector store file batch", - "group": "vector_stores", - "beta": true, - "returns": "The [vector store file batch](/docs/api-reference/vector-stores-file-batches/batch-object) object.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nvector_store_file_batch = client.beta.vector_stores.file_batches.retrieve(\n vector_store_id=\"vs_abc123\",\n batch_id=\"vsfb_abc123\"\n)\nprint(vector_store_file_batch)\n", - "node.js": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStoreFileBatch = await openai.beta.vectorStores.fileBatches.retrieve(\n \"vs_abc123\",\n \"vsfb_abc123\"\n );\n console.log(vectorStoreFileBatch);\n}\n\nmain();\n" - }, - "response": "{\n \"id\": \"vsfb_abc123\",\n \"object\": \"vector_store.file_batch\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\",\n \"status\": \"in_progress\",\n \"file_counts\": {\n \"in_progress\": 1,\n \"completed\": 1,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 0,\n }\n}\n" - } - } - } - }, - "/vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel": { - "post": { - "operationId": "cancelVectorStoreFileBatch", - "tags": [ - "Vector Stores" - ], - "summary": "Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible.", - "parameters": [ - { - "in": "path", - "name": "vector_store_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the vector store that the file batch belongs to." - }, - { - "in": "path", - "name": "batch_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the file batch to cancel." - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/VectorStoreFileBatchObject" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Cancel vector store file batch", - "group": "vector_stores", - "beta": true, - "returns": "The modified vector store file batch object.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123/cancel \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -X POST\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\ndeleted_vector_store_file_batch = client.beta.vector_stores.file_batches.cancel(\n vector_store_id=\"vs_abc123\",\n file_batch_id=\"vsfb_abc123\"\n)\nprint(deleted_vector_store_file_batch)\n", - "node.js": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const deletedVectorStoreFileBatch = await openai.vector_stores.fileBatches.cancel(\n \"vs_abc123\",\n \"vsfb_abc123\"\n );\n console.log(deletedVectorStoreFileBatch);\n}\n\nmain();\n" - }, - "response": "{\n \"id\": \"vsfb_abc123\",\n \"object\": \"vector_store.file_batch\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\",\n \"status\": \"cancelling\",\n \"file_counts\": {\n \"in_progress\": 12,\n \"completed\": 3,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 15,\n }\n}\n" - } - } - } - }, - "/vector_stores/{vector_store_id}/file_batches/{batch_id}/files": { - "get": { - "operationId": "listFilesInVectorStoreBatch", - "tags": [ - "Vector Stores" - ], - "summary": "Returns a list of vector store files in a batch.", - "parameters": [ - { - "name": "vector_store_id", - "in": "path", - "description": "The ID of the vector store that the files belong to.", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "batch_id", - "in": "path", - "description": "The ID of the file batch that the files belong to.", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "limit", - "in": "query", - "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n", - "required": false, - "schema": { - "type": "integer", - "default": 20 - } - }, - { - "name": "order", - "in": "query", - "description": "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n", - "schema": { - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ] - } - }, - { - "name": "after", - "in": "query", - "description": "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n", - "schema": { - "type": "string" - } - }, - { - "name": "before", - "in": "query", - "description": "A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.\n", - "schema": { - "type": "string" - } - }, - { - "name": "filter", - "in": "query", - "description": "Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`.", - "schema": { - "type": "string", - "enum": [ - "in_progress", - "completed", - "failed", - "cancelled" - ] - } - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ListVectorStoreFilesResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "List vector store files in a batch", - "group": "vector_stores", - "beta": true, - "returns": "A list of [vector store file](/docs/api-reference/vector-stores-files/file-object) objects.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123/files \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nvector_store_files = client.beta.vector_stores.file_batches.list_files(\n vector_store_id=\"vs_abc123\",\n batch_id=\"vsfb_abc123\"\n)\nprint(vector_store_files)\n", - "node.js": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStoreFiles = await openai.beta.vectorStores.fileBatches.listFiles(\n \"vs_abc123\",\n \"vsfb_abc123\"\n );\n console.log(vectorStoreFiles);\n}\n\nmain();\n" - }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"file-abc123\",\n \"object\": \"vector_store.file\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\"\n },\n {\n \"id\": \"file-abc456\",\n \"object\": \"vector_store.file\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\"\n }\n ],\n \"first_id\": \"file-abc123\",\n \"last_id\": \"file-abc456\",\n \"has_more\": false\n}\n" - } - } - } - }, - "/batches": { - "post": { - "summary": "Creates and executes a batch from an uploaded file of requests", - "operationId": "createBatch", - "tags": [ - "Batch" - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "input_file_id", - "endpoint", - "completion_window" - ], - "properties": { - "input_file_id": { - "type": "string", - "description": "The ID of an uploaded file that contains requests for the new batch.\n\nSee [upload file](/docs/api-reference/files/create) for how to upload a file.\n\nYour input file must be formatted as a [JSONL file](/docs/api-reference/batch/request-input), and must be uploaded with the purpose `batch`. The file can contain up to 50,000 requests, and can be up to 100 MB in size.\n" - }, - "endpoint": { - "type": "string", - "enum": [ - "/v1/chat/completions", - "/v1/embeddings", - "/v1/completions" - ], - "description": "The endpoint to be used for all requests in the batch. Currently `/v1/chat/completions`, `/v1/embeddings`, and `/v1/completions` are supported. Note that `/v1/embeddings` batches are also restricted to a maximum of 50,000 embedding inputs across all requests in the batch." - }, - "completion_window": { - "type": "string", - "enum": [ - "24h" - ], - "description": "The time frame within which the batch should be processed. Currently only `24h` is supported." - }, - "metadata": { - "type": "object", - "additionalProperties": { - "type": "string" - }, - "description": "Optional custom metadata for the batch.", - "nullable": true - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Batch created successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Batch" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Create batch", - "group": "batch", - "returns": "The created [Batch](/docs/api-reference/batch/object) object.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/batches \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"input_file_id\": \"file-abc123\",\n \"endpoint\": \"/v1/chat/completions\",\n \"completion_window\": \"24h\"\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.batches.create(\n input_file_id=\"file-abc123\",\n endpoint=\"/v1/chat/completions\",\n completion_window=\"24h\"\n)\n", - "node": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const batch = await openai.batches.create({\n input_file_id: \"file-abc123\",\n endpoint: \"/v1/chat/completions\",\n completion_window: \"24h\"\n });\n\n console.log(batch);\n}\n\nmain();\n" - }, - "response": "{\n \"id\": \"batch_abc123\",\n \"object\": \"batch\",\n \"endpoint\": \"/v1/chat/completions\",\n \"errors\": null,\n \"input_file_id\": \"file-abc123\",\n \"completion_window\": \"24h\",\n \"status\": \"validating\",\n \"output_file_id\": null,\n \"error_file_id\": null,\n \"created_at\": 1711471533,\n \"in_progress_at\": null,\n \"expires_at\": null,\n \"finalizing_at\": null,\n \"completed_at\": null,\n \"failed_at\": null,\n \"expired_at\": null,\n \"cancelling_at\": null,\n \"cancelled_at\": null,\n \"request_counts\": {\n \"total\": 0,\n \"completed\": 0,\n \"failed\": 0\n },\n \"metadata\": {\n \"customer_id\": \"user_123456789\",\n \"batch_description\": \"Nightly eval job\",\n }\n}\n" - } - } - }, - "get": { - "operationId": "listBatches", - "tags": [ - "Batch" - ], - "summary": "List your organization's batches.", - "parameters": [ - { - "in": "query", - "name": "after", - "required": false, - "schema": { - "type": "string" - }, - "description": "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n" - }, - { - "name": "limit", - "in": "query", - "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n", - "required": false, - "schema": { - "type": "integer", - "default": 20 - } - } - ], - "responses": { - "200": { - "description": "Batch listed successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ListBatchesResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "List batch", - "group": "batch", - "returns": "A list of paginated [Batch](/docs/api-reference/batch/object) objects.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/batches?limit=2 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.batches.list()\n", - "node": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const list = await openai.batches.list();\n\n for await (const batch of list) {\n console.log(batch);\n }\n}\n\nmain();\n" - }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"batch_abc123\",\n \"object\": \"batch\",\n \"endpoint\": \"/v1/chat/completions\",\n \"errors\": null,\n \"input_file_id\": \"file-abc123\",\n \"completion_window\": \"24h\",\n \"status\": \"completed\",\n \"output_file_id\": \"file-cvaTdG\",\n \"error_file_id\": \"file-HOWS94\",\n \"created_at\": 1711471533,\n \"in_progress_at\": 1711471538,\n \"expires_at\": 1711557933,\n \"finalizing_at\": 1711493133,\n \"completed_at\": 1711493163,\n \"failed_at\": null,\n \"expired_at\": null,\n \"cancelling_at\": null,\n \"cancelled_at\": null,\n \"request_counts\": {\n \"total\": 100,\n \"completed\": 95,\n \"failed\": 5\n },\n \"metadata\": {\n \"customer_id\": \"user_123456789\",\n \"batch_description\": \"Nightly job\",\n }\n },\n { ... },\n ],\n \"first_id\": \"batch_abc123\",\n \"last_id\": \"batch_abc456\",\n \"has_more\": true\n}\n" - } - } - } - }, - "/batches/{batch_id}": { - "get": { - "operationId": "retrieveBatch", - "tags": [ - "Batch" - ], - "summary": "Retrieves a batch.", - "parameters": [ - { - "in": "path", - "name": "batch_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the batch to retrieve." - } - ], - "responses": { - "200": { - "description": "Batch retrieved successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Batch" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Retrieve batch", - "group": "batch", - "returns": "The [Batch](/docs/api-reference/batch/object) object matching the specified ID.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/batches/batch_abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.batches.retrieve(\"batch_abc123\")\n", - "node": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const batch = await openai.batches.retrieve(\"batch_abc123\");\n\n console.log(batch);\n}\n\nmain();\n" - }, - "response": "{\n \"id\": \"batch_abc123\",\n \"object\": \"batch\",\n \"endpoint\": \"/v1/completions\",\n \"errors\": null,\n \"input_file_id\": \"file-abc123\",\n \"completion_window\": \"24h\",\n \"status\": \"completed\",\n \"output_file_id\": \"file-cvaTdG\",\n \"error_file_id\": \"file-HOWS94\",\n \"created_at\": 1711471533,\n \"in_progress_at\": 1711471538,\n \"expires_at\": 1711557933,\n \"finalizing_at\": 1711493133,\n \"completed_at\": 1711493163,\n \"failed_at\": null,\n \"expired_at\": null,\n \"cancelling_at\": null,\n \"cancelled_at\": null,\n \"request_counts\": {\n \"total\": 100,\n \"completed\": 95,\n \"failed\": 5\n },\n \"metadata\": {\n \"customer_id\": \"user_123456789\",\n \"batch_description\": \"Nightly eval job\",\n }\n}\n" - } - } - } - }, - "/batches/{batch_id}/cancel": { - "post": { - "operationId": "cancelBatch", - "tags": [ - "Batch" - ], - "summary": "Cancels an in-progress batch. The batch will be in status `cancelling` for up to 10 minutes, before changing to `cancelled`, where it will have partial results (if any) available in the output file.", - "parameters": [ - { - "in": "path", - "name": "batch_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the batch to cancel." - } - ], - "responses": { - "200": { - "description": "Batch is cancelling. Returns the cancelling batch's details.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Batch" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Cancel batch", - "group": "batch", - "returns": "The [Batch](/docs/api-reference/batch/object) object matching the specified ID.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/batches/batch_abc123/cancel \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -X POST\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.batches.cancel(\"batch_abc123\")\n", - "node": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const batch = await openai.batches.cancel(\"batch_abc123\");\n\n console.log(batch);\n}\n\nmain();\n" - }, - "response": "{\n \"id\": \"batch_abc123\",\n \"object\": \"batch\",\n \"endpoint\": \"/v1/chat/completions\",\n \"errors\": null,\n \"input_file_id\": \"file-abc123\",\n \"completion_window\": \"24h\",\n \"status\": \"cancelling\",\n \"output_file_id\": null,\n \"error_file_id\": null,\n \"created_at\": 1711471533,\n \"in_progress_at\": 1711471538,\n \"expires_at\": 1711557933,\n \"finalizing_at\": null,\n \"completed_at\": null,\n \"failed_at\": null,\n \"expired_at\": null,\n \"cancelling_at\": 1711475133,\n \"cancelled_at\": null,\n \"request_counts\": {\n \"total\": 100,\n \"completed\": 23,\n \"failed\": 1\n },\n \"metadata\": {\n \"customer_id\": \"user_123456789\",\n \"batch_description\": \"Nightly eval job\",\n }\n}\n" - } - } - } - }, - "/organization/audit_logs": { - "get": { - "summary": "List user actions and configuration changes within this organization.", - "operationId": "list-audit-logs", - "tags": [ - "Audit Logs" - ], - "parameters": [ - { - "name": "effective_at", - "in": "query", - "description": "Return only events whose `effective_at` (Unix seconds) is in this range.", - "required": false, - "schema": { - "type": "object", - "properties": { - "gt": { - "type": "integer", - "description": "Return only events whose `effective_at` (Unix seconds) is greater than this value." - }, - "gte": { - "type": "integer", - "description": "Return only events whose `effective_at` (Unix seconds) is greater than or equal to this value." - }, - "lt": { - "type": "integer", - "description": "Return only events whose `effective_at` (Unix seconds) is less than this value." - }, - "lte": { - "type": "integer", - "description": "Return only events whose `effective_at` (Unix seconds) is less than or equal to this value." - } - } - } - }, - { - "name": "project_ids[]", - "in": "query", - "description": "Return only events for these projects.", - "required": false, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - }, - { - "name": "event_types[]", - "in": "query", - "description": "Return only events with a `type` in one of these values. For example, `project.created`. For all options, see the documentation for the [audit log object](/docs/api-reference/audit-logs/object).", - "required": false, - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/AuditLogEventType" - } - } - }, - { - "name": "actor_ids[]", - "in": "query", - "description": "Return only events performed by these actors. Can be a user ID, a service account ID, or an api key tracking ID.", - "required": false, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - }, - { - "name": "actor_emails[]", - "in": "query", - "description": "Return only events performed by users with these emails.", - "required": false, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - }, - { - "name": "resource_ids[]", - "in": "query", - "description": "Return only events performed on these targets. For example, a project ID updated.", - "required": false, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - }, - { - "name": "limit", - "in": "query", - "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n", - "required": false, - "schema": { - "type": "integer", - "default": 20 - } - }, - { - "name": "after", - "in": "query", - "description": "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n", - "schema": { - "type": "string" - } - }, - { - "name": "before", - "in": "query", - "description": "A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.\n", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Audit logs listed successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ListAuditLogsResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "List audit logs", - "group": "audit-logs", - "returns": "A list of paginated [Audit Log](/docs/api-reference/audit-logs/object) objects.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/organization/audit_logs \\\n-H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n-H \"Content-Type: application/json\" \\\n" - }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"audit_log-xxx_yyyymmdd\",\n \"type\": \"project.archived\",\n \"effective_at\": 1722461446,\n \"actor\": {\n \"type\": \"api_key\",\n \"api_key\": {\n \"type\": \"user\",\n \"user\": {\n \"id\": \"user-xxx\",\n \"email\": \"user@example.com\"\n }\n }\n },\n \"project.archived\": {\n \"id\": \"proj_abc\"\n },\n },\n {\n \"id\": \"audit_log-yyy__20240101\",\n \"type\": \"api_key.updated\",\n \"effective_at\": 1720804190,\n \"actor\": {\n \"type\": \"session\",\n \"session\": {\n \"user\": {\n \"id\": \"user-xxx\",\n \"email\": \"user@example.com\"\n },\n \"ip_address\": \"127.0.0.1\",\n \"user_agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36\"\n }\n },\n \"api_key.updated\": {\n \"id\": \"key_xxxx\",\n \"data\": {\n \"scopes\": [\"resource_2.operation_2\"]\n }\n },\n }\n ],\n \"first_id\": \"audit_log-xxx__20240101\",\n \"last_id\": \"audit_log_yyy__20240101\",\n \"has_more\": true\n}\n" - } - } - } - }, - "/organization/invites": { - "get": { - "summary": "Returns a list of invites in the organization.", - "operationId": "list-invites", - "tags": [ - "Invites" - ], - "parameters": [ - { - "name": "limit", - "in": "query", - "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n", - "required": false, - "schema": { - "type": "integer", - "default": 20 - } - }, - { - "name": "after", - "in": "query", - "description": "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n", - "required": false, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Invites listed successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/InviteListResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "List invites", - "group": "administration", - "returns": "A list of [Invite](/docs/api-reference/invite/object) objects.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/organization/invites?after=invite-abc&limit=20 \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" - }, - "response": { - "content": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"organization.invite\",\n \"id\": \"invite-abc\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"status\": \"accepted\",\n \"invited_at\": 1711471533,\n \"expires_at\": 1711471533,\n \"accepted_at\": 1711471533\n }\n ],\n \"first_id\": \"invite-abc\",\n \"last_id\": \"invite-abc\",\n \"has_more\": false\n}\n" - } - } - } - }, - "post": { - "summary": "Create an invite for a user to the organization. The invite must be accepted by the user before they have access to the organization.", - "operationId": "inviteUser", - "tags": [ - "Invites" - ], - "requestBody": { - "description": "The invite request payload.", - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/InviteRequest" - } - } - } - }, - "responses": { - "200": { - "description": "User invited successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Invite" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Create invite", - "group": "administration", - "returns": "The created [Invite](/docs/api-reference/invite/object) object.", - "examples": { - "request": { - "curl": "curl -X POST https://api.openai.com/v1/organization/invites \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"email\": \"user@example.com\",\n \"role\": \"owner\"\n }'\n" - }, - "response": { - "content": "{\n \"object\": \"organization.invite\",\n \"id\": \"invite-abc\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"invited_at\": 1711471533,\n \"expires_at\": 1711471533,\n \"accepted_at\": null\n}\n" - } - } - } - } - }, - "/organization/invites/{invite_id}": { - "get": { - "summary": "Retrieves an invite.", - "operationId": "retrieve-invite", - "tags": [ - "Invites" - ], - "parameters": [ - { - "in": "path", - "name": "invite_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the invite to retrieve." - } - ], - "responses": { - "200": { - "description": "Invite retrieved successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Invite" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Retrieve invite", - "group": "administration", - "returns": "The [Invite](/docs/api-reference/invite/object) object matching the specified ID.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/organization/invites/invite-abc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" - }, - "response": { - "content": "{\n \"object\": \"organization.invite\",\n \"id\": \"invite-abc\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"status\": \"accepted\",\n \"invited_at\": 1711471533,\n \"expires_at\": 1711471533,\n \"accepted_at\": 1711471533\n}\n" - } - } - } - }, - "delete": { - "summary": "Delete an invite. If the invite has already been accepted, it cannot be deleted.", - "operationId": "delete-invite", - "tags": [ - "Invites" - ], - "parameters": [ - { - "in": "path", - "name": "invite_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the invite to delete." - } - ], - "responses": { - "200": { - "description": "Invite deleted successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/InviteDeleteResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Delete invite", - "group": "administration", - "returns": "Confirmation that the invite has been deleted", - "examples": { - "request": { - "curl": "curl -X DELETE https://api.openai.com/v1/organization/invites/invite-abc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" - }, - "response": { - "content": "{\n \"object\": \"organization.invite.deleted\",\n \"id\": \"invite-abc\",\n \"deleted\": true\n}\n" - } - } - } - } - }, - "/organization/users": { - "get": { - "summary": "Lists all of the users in the organization.", - "operationId": "list-users", - "tags": [ - "Users" - ], - "parameters": [ - { - "name": "limit", - "in": "query", - "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n", - "required": false, - "schema": { - "type": "integer", - "default": 20 - } - }, - { - "name": "after", - "in": "query", - "description": "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n", - "required": false, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Users listed successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserListResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "List users", - "group": "administration", - "returns": "A list of [User](/docs/api-reference/users/object) objects.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/organization/users?after=user_abc&limit=20 \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" - }, - "response": { - "content": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"organization.user\",\n \"id\": \"user_abc\",\n \"name\": \"First Last\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"added_at\": 1711471533\n }\n ],\n \"first_id\": \"user-abc\",\n \"last_id\": \"user-xyz\",\n \"has_more\": false\n}\n" - } - } - } - } - }, - "/organization/users/{user_id}": { - "get": { - "summary": "Retrieves a user by their identifier.", - "operationId": "retrieve-user", - "tags": [ - "Users" - ], - "parameters": [ - { - "name": "user_id", - "in": "path", - "description": "The ID of the user.", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "User retrieved successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/User" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Retrieve user", - "group": "administration", - "returns": "The [User](/docs/api-reference/users/object) object matching the specified ID.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/organization/users/user_abc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" - }, - "response": { - "content": "{\n \"object\": \"organization.user\",\n \"id\": \"user_abc\",\n \"name\": \"First Last\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"added_at\": 1711471533\n}\n" - } - } - } - }, - "post": { - "summary": "Modifies a user's role in the organization.", - "operationId": "modify-user", - "tags": [ - "Users" - ], - "requestBody": { - "description": "The new user role to modify. This must be one of `owner` or `member`.", - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserRoleUpdateRequest" - } - } - } - }, - "responses": { - "200": { - "description": "User role updated successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/User" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Modify user", - "group": "administration", - "returns": "The updated [User](/docs/api-reference/users/object) object.", - "examples": { - "request": { - "curl": "curl -X POST https://api.openai.com/v1/organization/users/user_abc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"role\": \"owner\"\n }'\n" - }, - "response": { - "content": "{\n \"object\": \"organization.user\",\n \"id\": \"user_abc\",\n \"name\": \"First Last\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"added_at\": 1711471533\n}\n" - } - } - } - }, - "delete": { - "summary": "Deletes a user from the organization.", - "operationId": "delete-user", - "tags": [ - "Users" - ], - "parameters": [ - { - "name": "user_id", - "in": "path", - "description": "The ID of the user.", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "User deleted successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserDeleteResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Delete user", - "group": "administration", - "returns": "Confirmation of the deleted user", - "examples": { - "request": { - "curl": "curl -X DELETE https://api.openai.com/v1/organization/users/user_abc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" - }, - "response": { - "content": "{\n \"object\": \"organization.user.deleted\",\n \"id\": \"user_abc\",\n \"deleted\": true\n}\n" - } - } - } - } - }, - "/organization/projects": { - "get": { - "summary": "Returns a list of projects.", - "operationId": "list-projects", - "tags": [ - "Projects" - ], - "parameters": [ - { - "name": "limit", - "in": "query", - "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n", - "required": false, - "schema": { - "type": "integer", - "default": 20 - } - }, - { - "name": "after", - "in": "query", - "description": "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n", - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "include_archived", - "in": "query", - "schema": { - "type": "boolean", - "default": false - }, - "description": "If `true` returns all projects including those that have been `archived`. Archived projects are not included by default." - } - ], - "responses": { - "200": { - "description": "Projects listed successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProjectListResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "List projects", - "group": "administration", - "returns": "A list of [Project](/docs/api-reference/projects/object) objects.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/organization/projects?after=proj_abc&limit=20&include_archived=false \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" - }, - "response": { - "content": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"proj_abc\",\n \"object\": \"organization.project\",\n \"name\": \"Project example\",\n \"created_at\": 1711471533,\n \"archived_at\": null,\n \"status\": \"active\"\n }\n ],\n \"first_id\": \"proj-abc\",\n \"last_id\": \"proj-xyz\",\n \"has_more\": false\n}\n" - } - } - } - }, - "post": { - "summary": "Create a new project in the organization. Projects can be created and archived, but cannot be deleted.", - "operationId": "create-project", - "tags": [ - "Projects" - ], - "requestBody": { - "description": "The project create request payload.", - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProjectCreateRequest" - } - } - } - }, - "responses": { - "200": { - "description": "Project created successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Project" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Create project", - "group": "administration", - "returns": "The created [Project](/docs/api-reference/projects/object) object.", - "examples": { - "request": { - "curl": "curl -X POST https://api.openai.com/v1/organization/projects \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"name\": \"Project ABC\",\n \"app_use_case\": \"Your project use case here\",\n \"business_website\": \"https://example.com\"\n }'\n" - }, - "response": { - "content": "{\n \"id\": \"proj_abc\",\n \"object\": \"organization.project\",\n \"name\": \"Project ABC\",\n \"created_at\": 1711471533,\n \"archived_at\": null,\n \"status\": \"active\",\n \"app_use_case\": \"Your project use case here\",\n \"business_website\": \"https://example.com\"\n}\n" - } - } - } - } - }, - "/organization/projects/{project_id}": { - "get": { - "summary": "Retrieves a project.", - "operationId": "retrieve-project", - "tags": [ - "Projects" - ], - "parameters": [ - { - "name": "project_id", - "in": "path", - "description": "The ID of the project.", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Project retrieved successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Project" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Retrieve project", - "group": "administration", - "description": "Retrieve a project.", - "returns": "The [Project](/docs/api-reference/projects/object) object matching the specified ID.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/organization/projects/proj_abc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" - }, - "response": { - "content": "{\n \"id\": \"proj_abc\",\n \"object\": \"organization.project\",\n \"name\": \"Project example\",\n \"created_at\": 1711471533,\n \"archived_at\": null,\n \"status\": \"active\"\n}\n" - } - } - } - }, - "post": { - "summary": "Modifies a project in the organization.", - "operationId": "modify-project", - "tags": [ - "Projects" - ], - "requestBody": { - "description": "The project update request payload.", - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProjectUpdateRequest" - } - } - } - }, - "responses": { - "200": { - "description": "Project updated successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Project" - } - } - } - }, - "400": { - "description": "Error response when updating the default project.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Modify project", - "group": "administration", - "returns": "The updated [Project](/docs/api-reference/projects/object) object.", - "examples": { - "request": { - "curl": "curl -X POST https://api.openai.com/v1/organization/projects/proj_abc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"name\": \"Project DEF\",\n \"app_use_case\": \"Your project use case here\",\n \"business_website\": \"https://example.com\"\n }'\n" - } - } - } - } - }, - "/organization/projects/{project_id}/archive": { - "post": { - "summary": "Archives a project in the organization. Archived projects cannot be used or updated.", - "operationId": "archive-project", - "tags": [ - "Projects" - ], - "parameters": [ - { - "name": "project_id", - "in": "path", - "description": "The ID of the project.", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Project archived successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Project" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Archive project", - "group": "administration", - "returns": "The archived [Project](/docs/api-reference/projects/object) object.", - "examples": { - "request": { - "curl": "curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/archive \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" - }, - "response": { - "content": "{\n \"id\": \"proj_abc\",\n \"object\": \"organization.project\",\n \"name\": \"Project DEF\",\n \"created_at\": 1711471533,\n \"archived_at\": 1711471533,\n \"status\": \"archived\"\n}\n" - } - } - } - } - }, - "/organization/projects/{project_id}/users": { - "get": { - "summary": "Returns a list of users in the project.", - "operationId": "list-project-users", - "tags": [ - "Projects" - ], - "parameters": [ - { - "name": "project_id", - "in": "path", - "description": "The ID of the project.", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "limit", - "in": "query", - "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n", - "required": false, - "schema": { - "type": "integer", - "default": 20 - } - }, - { - "name": "after", - "in": "query", - "description": "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n", - "required": false, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Project users listed successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProjectUserListResponse" - } - } - } - }, - "400": { - "description": "Error response when project is archived.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "List project users", - "group": "administration", - "returns": "A list of [ProjectUser](/docs/api-reference/project-users/object) objects.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/organization/projects/proj_abc/users?after=user_abc&limit=20 \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" - }, - "response": { - "content": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"organization.project.user\",\n \"id\": \"user_abc\",\n \"name\": \"First Last\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"added_at\": 1711471533\n }\n ],\n \"first_id\": \"user-abc\",\n \"last_id\": \"user-xyz\",\n \"has_more\": false\n}\n" - }, - "error_response": { - "content": "{\n \"code\": 400,\n \"message\": \"Project {name} is archived\"\n}\n" - } - } - } - }, - "post": { - "summary": "Adds a user to the project. Users must already be members of the organization to be added to a project.", - "operationId": "create-project-user", - "parameters": [ - { - "name": "project_id", - "in": "path", - "description": "The ID of the project.", - "required": true, - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Projects" - ], - "requestBody": { - "description": "The project user create request payload.", - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProjectUserCreateRequest" - } - } - } - }, - "responses": { - "200": { - "description": "User added to project successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProjectUser" - } - } - } - }, - "400": { - "description": "Error response for various conditions.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Create project user", - "group": "administration", - "returns": "The created [ProjectUser](/docs/api-reference/project-users/object) object.", - "examples": { - "request": { - "curl": "curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/users \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"user_id\": \"user_abc\",\n \"role\": \"member\"\n }'\n" - }, - "response": { - "content": "{\n \"object\": \"organization.project.user\",\n \"id\": \"user_abc\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"added_at\": 1711471533\n}\n" - }, - "error_response": { - "content": "{\n \"code\": 400,\n \"message\": \"Project {name} is archived\"\n}\n" - } - } - } - } - }, - "/organization/projects/{project_id}/users/{user_id}": { - "get": { - "summary": "Retrieves a user in the project.", - "operationId": "retrieve-project-user", - "tags": [ - "Projects" - ], - "parameters": [ - { - "name": "project_id", - "in": "path", - "description": "The ID of the project.", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "user_id", - "in": "path", - "description": "The ID of the user.", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Project user retrieved successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProjectUser" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Retrieve project user", - "group": "administration", - "returns": "The [ProjectUser](/docs/api-reference/project-users/object) object matching the specified ID.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/organization/projects/proj_abc/users/user_abc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" - }, - "response": { - "content": "{\n \"object\": \"organization.project.user\",\n \"id\": \"user_abc\",\n \"name\": \"First Last\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"added_at\": 1711471533\n}\n" - } - } - } - }, - "post": { - "summary": "Modifies a user's role in the project.", - "operationId": "modify-project-user", - "tags": [ - "Projects" - ], - "requestBody": { - "description": "The project user update request payload.", - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProjectUserUpdateRequest" - } - } - } - }, - "responses": { - "200": { - "description": "Project user's role updated successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProjectUser" - } - } - } - }, - "400": { - "description": "Error response for various conditions.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Modify project user", - "group": "administration", - "returns": "The updated [ProjectUser](/docs/api-reference/project-users/object) object.", - "examples": { - "request": { - "curl": "curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/users/user_abc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"role\": \"owner\"\n }'\n" - }, - "response": { - "content": "{\n \"object\": \"organization.project.user\",\n \"id\": \"user_abc\",\n \"name\": \"First Last\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"added_at\": 1711471533\n}\n" - } - } - } - }, - "delete": { - "summary": "Deletes a user from the project.", - "operationId": "delete-project-user", - "tags": [ - "Projects" - ], - "parameters": [ - { - "name": "project_id", - "in": "path", - "description": "The ID of the project.", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "user_id", - "in": "path", - "description": "The ID of the user.", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Project user deleted successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProjectUserDeleteResponse" - } - } - } - }, - "400": { - "description": "Error response for various conditions.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Delete project user", - "group": "administration", - "returns": "Confirmation that project has been deleted or an error in case of an archived project, which has no users", - "examples": { - "request": { - "curl": "curl -X DELETE https://api.openai.com/v1/organization/projects/proj_abc/users/user_abc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" - }, - "response": { - "content": "{\n \"object\": \"organization.project.user.deleted\",\n \"id\": \"user_abc\",\n \"deleted\": true\n}\n" - } - } - } - } - }, - "/organization/projects/{project_id}/service_accounts": { - "get": { - "summary": "Returns a list of service accounts in the project.", - "operationId": "list-project-service-accounts", - "tags": [ - "Projects" - ], - "parameters": [ - { - "name": "project_id", - "in": "path", - "description": "The ID of the project.", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "limit", - "in": "query", - "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n", - "required": false, - "schema": { - "type": "integer", - "default": 20 - } - }, - { - "name": "after", - "in": "query", - "description": "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n", - "required": false, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Project service accounts listed successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProjectServiceAccountListResponse" - } - } - } - }, - "400": { - "description": "Error response when project is archived.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "List project service accounts", - "group": "administration", - "returns": "A list of [ProjectServiceAccount](/docs/api-reference/project-service-accounts/object) objects.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/organization/projects/proj_abc/service_accounts?after=custom_id&limit=20 \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" - }, - "response": { - "content": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"organization.project.service_account\",\n \"id\": \"svc_acct_abc\",\n \"name\": \"Service Account\",\n \"role\": \"owner\",\n \"created_at\": 1711471533\n }\n ],\n \"first_id\": \"svc_acct_abc\",\n \"last_id\": \"svc_acct_xyz\",\n \"has_more\": false\n}\n" - } - } - } - }, - "post": { - "summary": "Creates a new service account in the project. This also returns an unredacted API key for the service account.", - "operationId": "create-project-service-account", - "tags": [ - "Projects" - ], - "parameters": [ - { - "name": "project_id", - "in": "path", - "description": "The ID of the project.", - "required": true, - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "description": "The project service account create request payload.", - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProjectServiceAccountCreateRequest" - } - } - } - }, - "responses": { - "200": { - "description": "Project service account created successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProjectServiceAccountCreateResponse" - } - } - } - }, - "400": { - "description": "Error response when project is archived.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Create project service account", - "group": "administration", - "returns": "The created [ProjectServiceAccount](/docs/api-reference/project-service-accounts/object) object.", - "examples": { - "request": { - "curl": "curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/service_accounts \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"name\": \"Production App\"\n }'\n" - }, - "response": { - "content": "{\n \"object\": \"organization.project.service_account\",\n \"id\": \"svc_acct_abc\",\n \"name\": \"Production App\",\n \"role\": \"member\",\n \"created_at\": 1711471533,\n \"api_key\": {\n \"object\": \"organization.project.service_account.api_key\",\n \"value\": \"sk-abcdefghijklmnop123\",\n \"name\": \"Secret Key\",\n \"created_at\": 1711471533,\n \"id\": \"key_abc\"\n }\n}\n" - } - } - } - } - }, - "/organization/projects/{project_id}/service_accounts/{service_account_id}": { - "get": { - "summary": "Retrieves a service account in the project.", - "operationId": "retrieve-project-service-account", - "tags": [ - "Projects" - ], - "parameters": [ - { - "name": "project_id", - "in": "path", - "description": "The ID of the project.", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "service_account_id", - "in": "path", - "description": "The ID of the service account.", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Project service account retrieved successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProjectServiceAccount" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Retrieve project service account", - "group": "administration", - "returns": "The [ProjectServiceAccount](/docs/api-reference/project-service-accounts/object) object matching the specified ID.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/organization/projects/proj_abc/service_accounts/svc_acct_abc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" - }, - "response": { - "content": "{\n \"object\": \"organization.project.service_account\",\n \"id\": \"svc_acct_abc\",\n \"name\": \"Service Account\",\n \"role\": \"owner\",\n \"created_at\": 1711471533\n}\n" - } - } - } - }, - "delete": { - "summary": "Deletes a service account from the project.", - "operationId": "delete-project-service-account", - "tags": [ - "Projects" - ], - "parameters": [ - { - "name": "project_id", - "in": "path", - "description": "The ID of the project.", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "service_account_id", - "in": "path", - "description": "The ID of the service account.", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Project service account deleted successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProjectServiceAccountDeleteResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Delete project service account", - "group": "administration", - "returns": "Confirmation of service account being deleted, or an error in case of an archived project, which has no service accounts", - "examples": { - "request": { - "curl": "curl -X DELETE https://api.openai.com/v1/organization/projects/proj_abc/service_accounts/svc_acct_abc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" - }, - "response": { - "content": "{\n \"object\": \"organization.project.service_account.deleted\",\n \"id\": \"svc_acct_abc\",\n \"deleted\": true\n}\n" - } - } - } - } - }, - "/organization/projects/{project_id}/api_keys": { - "get": { - "summary": "Returns a list of API keys in the project.", - "operationId": "list-project-api-keys", - "tags": [ - "Projects" - ], - "parameters": [ - { - "name": "project_id", - "in": "path", - "description": "The ID of the project.", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "limit", - "in": "query", - "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n", - "required": false, - "schema": { - "type": "integer", - "default": 20 - } - }, - { - "name": "after", - "in": "query", - "description": "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n", - "required": false, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Project API keys listed successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProjectApiKeyListResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "List project API keys", - "group": "administration", - "returns": "A list of [ProjectApiKey](/docs/api-reference/project-api-keys/object) objects.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/organization/projects/proj_abc/api_keys?after=key_abc&limit=20 \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" - }, - "response": { - "content": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"organization.project.api_key\",\n \"redacted_value\": \"sk-abc...def\",\n \"name\": \"My API Key\",\n \"created_at\": 1711471533,\n \"id\": \"key_abc\",\n \"owner\": {\n \"type\": \"user\",\n \"user\": {\n \"object\": \"organization.project.user\",\n \"id\": \"user_abc\",\n \"name\": \"First Last\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"added_at\": 1711471533\n }\n }\n }\n ],\n \"first_id\": \"key_abc\",\n \"last_id\": \"key_xyz\",\n \"has_more\": false\n}\n" - }, - "error_response": { - "content": "{\n \"code\": 400,\n \"message\": \"Project {name} is archived\"\n}\n" - } - } - } - } - }, - "/organization/projects/{project_id}/api_keys/{key_id}": { - "get": { - "summary": "Retrieves an API key in the project.", - "operationId": "retrieve-project-api-key", - "tags": [ - "Projects" - ], - "parameters": [ - { - "name": "project_id", - "in": "path", - "description": "The ID of the project.", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "key_id", - "in": "path", - "description": "The ID of the API key.", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Project API key retrieved successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProjectApiKey" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Retrieve project API key", - "group": "administration", - "returns": "The [ProjectApiKey](/docs/api-reference/project-api-keys/object) object matching the specified ID.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/organization/projects/proj_abc/api_keys/key_abc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" - }, - "response": { - "content": "{\n \"object\": \"organization.project.api_key\",\n \"redacted_value\": \"sk-abc...def\",\n \"name\": \"My API Key\",\n \"created_at\": 1711471533,\n \"id\": \"key_abc\",\n \"owner\": {\n \"type\": \"user\",\n \"user\": {\n \"object\": \"organization.project.user\",\n \"id\": \"user_abc\",\n \"name\": \"First Last\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"added_at\": 1711471533\n }\n }\n}\n" - } - } - } - }, - "delete": { - "summary": "Deletes an API key from the project.", - "operationId": "delete-project-api-key", - "tags": [ - "Projects" - ], - "parameters": [ - { - "name": "project_id", - "in": "path", - "description": "The ID of the project.", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "key_id", - "in": "path", - "description": "The ID of the API key.", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Project API key deleted successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProjectApiKeyDeleteResponse" - } - } - } - }, - "400": { - "description": "Error response for various conditions.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Delete project API key", - "group": "administration", - "returns": "Confirmation of the key's deletion or an error if the key belonged to a service account", - "examples": { - "request": { - "curl": "curl -X DELETE https://api.openai.com/v1/organization/projects/proj_abc/api_keys/key_abc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" - }, - "response": { - "content": "{\n \"object\": \"organization.project.api_key.deleted\",\n \"id\": \"key_abc\",\n \"deleted\": true\n}\n" - }, - "error_response": { - "content": "{\n \"code\": 400,\n \"message\": \"API keys cannot be deleted for service accounts, please delete the service account\"\n}\n" - } - } - } - } - } - }, - "components": { - "securitySchemes": { - "ApiKeyAuth": { - "type": "http", - "scheme": "bearer" - } - }, - "schemas": { - "Error": { - "type": "object", - "properties": { - "code": { - "type": "string", - "nullable": true - }, - "message": { - "type": "string", - "nullable": false - }, - "param": { - "type": "string", - "nullable": true - }, - "type": { - "type": "string", - "nullable": false - } - }, - "required": [ - "type", - "message", - "param", - "code" - ] - }, - "ErrorResponse": { - "type": "object", - "properties": { - "error": { - "$ref": "#/components/schemas/Error" - } - }, - "required": [ - "error" - ] - }, - "ListModelsResponse": { - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ] - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Model" - } - } - }, - "required": [ - "object", - "data" - ] - }, - "DeleteModelResponse": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "deleted": { - "type": "boolean" - }, - "object": { - "type": "string" - } - }, - "required": [ - "id", - "object", - "deleted" - ] - }, - "CreateCompletionRequest": { - "type": "object", - "properties": { - "model": { - "description": "ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them.\n", - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "gpt-3.5-turbo-instruct", - "davinci-002", - "babbage-002" - ] - } - ], - "x-oaiTypeLabel": "string" - }, - "prompt": { - "description": "The prompt(s) to generate completions for, encoded as a string, array of strings, array of tokens, or array of token arrays.\n\nNote that <|endoftext|> is the document separator that the model sees during training, so if a prompt is not specified the model will generate as if from the beginning of a new document.\n", - "default": "<|endoftext|>", - "nullable": true, - "oneOf": [ - { - "type": "string", - "default": "", - "example": "This is a test." - }, - { - "type": "array", - "items": { - "type": "string", - "default": "", - "example": "This is a test." - } - }, - { - "type": "array", - "minItems": 1, - "items": { - "type": "integer" - }, - "example": "[1212, 318, 257, 1332, 13]" - }, - { - "type": "array", - "minItems": 1, - "items": { - "type": "array", - "minItems": 1, - "items": { - "type": "integer" - } - }, - "example": "[[1212, 318, 257, 1332, 13]]" - } - ] - }, - "best_of": { - "type": "integer", - "default": 1, - "minimum": 0, - "maximum": 20, - "nullable": true, - "description": "Generates `best_of` completions server-side and returns the \"best\" (the one with the highest log probability per token). Results cannot be streamed.\n\nWhen used with `n`, `best_of` controls the number of candidate completions and `n` specifies how many to return – `best_of` must be greater than `n`.\n\n**Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`.\n" - }, - "echo": { - "type": "boolean", - "default": false, - "nullable": true, - "description": "Echo back the prompt in addition to the completion\n" - }, - "frequency_penalty": { - "type": "number", - "default": 0, - "minimum": -2, - "maximum": 2, - "nullable": true, - "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.\n\n[See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details)\n" - }, - "logit_bias": { - "type": "object", - "x-oaiTypeLabel": "map", - "default": null, - "nullable": true, - "additionalProperties": { - "type": "integer" - }, - "description": "Modify the likelihood of specified tokens appearing in the completion.\n\nAccepts a JSON object that maps tokens (specified by their token ID in the GPT tokenizer) to an associated bias value from -100 to 100. You can use this [tokenizer tool](/tokenizer?view=bpe) to convert text to token IDs. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token.\n\nAs an example, you can pass `{\"50256\": -100}` to prevent the <|endoftext|> token from being generated.\n" - }, - "logprobs": { - "type": "integer", - "minimum": 0, - "maximum": 5, - "default": null, - "nullable": true, - "description": "Include the log probabilities on the `logprobs` most likely output tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response.\n\nThe maximum value for `logprobs` is 5.\n" - }, - "max_tokens": { - "type": "integer", - "minimum": 0, - "default": 16, - "example": 16, - "nullable": true, - "description": "The maximum number of [tokens](/tokenizer) that can be generated in the completion.\n\nThe token count of your prompt plus `max_tokens` cannot exceed the model's context length. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens.\n" - }, - "n": { - "type": "integer", - "minimum": 1, - "maximum": 128, - "default": 1, - "example": 1, - "nullable": true, - "description": "How many completions to generate for each prompt.\n\n**Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`.\n" - }, - "presence_penalty": { - "type": "number", - "default": 0, - "minimum": -2, - "maximum": 2, - "nullable": true, - "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.\n\n[See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details)\n" - }, - "seed": { - "type": "integer", - "minimum": -9223372036854776000, - "maximum": 9223372036854776000, - "nullable": true, - "description": "If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result.\n\nDeterminism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend.\n" - }, - "stop": { - "description": "Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.\n", - "default": null, - "nullable": true, - "oneOf": [ - { - "type": "string", - "default": "<|endoftext|>", - "example": "\n", - "nullable": true - }, - { - "type": "array", - "minItems": 1, - "maxItems": 4, - "items": { - "type": "string", - "example": "[\"\\n\"]" - } - } - ] - }, - "stream": { - "description": "Whether to stream back partial progress. If set, tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions).\n", - "type": "boolean", - "nullable": true, - "default": false - }, - "stream_options": { - "$ref": "#/components/schemas/ChatCompletionStreamOptions" - }, - "suffix": { - "description": "The suffix that comes after a completion of inserted text.\n\nThis parameter is only supported for `gpt-3.5-turbo-instruct`.\n", - "default": null, - "nullable": true, - "type": "string", - "example": "test." - }, - "temperature": { - "type": "number", - "minimum": 0, - "maximum": 2, - "default": 1, - "example": 1, - "nullable": true, - "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n\nWe generally recommend altering this or `top_p` but not both.\n" - }, - "top_p": { - "type": "number", - "minimum": 0, - "maximum": 1, - "default": 1, - "example": 1, - "nullable": true, - "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or `temperature` but not both.\n" - }, - "user": { - "type": "string", - "example": "user-1234", - "description": "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).\n" - } - }, - "required": [ - "model", - "prompt" - ] - }, - "CreateCompletionResponse": { - "type": "object", - "description": "Represents a completion response from the API. Note: both the streamed and non-streamed response objects share the same shape (unlike the chat endpoint).\n", - "properties": { - "id": { - "type": "string", - "description": "A unique identifier for the completion." - }, - "choices": { - "type": "array", - "description": "The list of completion choices the model generated for the input prompt.", - "items": { - "type": "object", - "required": [ - "finish_reason", - "index", - "logprobs", - "text" - ], - "properties": { - "finish_reason": { - "type": "string", - "description": "The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,\n`length` if the maximum number of tokens specified in the request was reached,\nor `content_filter` if content was omitted due to a flag from our content filters.\n", - "enum": [ - "stop", - "length", - "content_filter" - ] - }, - "index": { - "type": "integer" - }, - "logprobs": { - "type": "object", - "nullable": true, - "properties": { - "text_offset": { - "type": "array", - "items": { - "type": "integer" - } - }, - "token_logprobs": { - "type": "array", - "items": { - "type": "number" - } - }, - "tokens": { - "type": "array", - "items": { - "type": "string" - } - }, - "top_logprobs": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": { - "type": "number" - } - } - } - } - }, - "text": { - "type": "string" - } - } - } - }, - "created": { - "type": "integer", - "description": "The Unix timestamp (in seconds) of when the completion was created." - }, - "model": { - "type": "string", - "description": "The model used for completion." - }, - "system_fingerprint": { - "type": "string", - "description": "This fingerprint represents the backend configuration that the model runs with.\n\nCan be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.\n" - }, - "object": { - "type": "string", - "description": "The object type, which is always \"text_completion\"", - "enum": [ - "text_completion" - ] - }, - "usage": { - "$ref": "#/components/schemas/CompletionUsage" - } - }, - "required": [ - "id", - "object", - "created", - "model", - "choices" - ], - "x-oaiMeta": { - "name": "The completion object", - "legacy": true, - "example": "{\n \"id\": \"cmpl-uqkvlQyYK7bGYrRHQ0eXlWi7\",\n \"object\": \"text_completion\",\n \"created\": 1589478378,\n \"model\": \"gpt-4-turbo\",\n \"choices\": [\n {\n \"text\": \"\\n\\nThis is indeed a test\",\n \"index\": 0,\n \"logprobs\": null,\n \"finish_reason\": \"length\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 5,\n \"completion_tokens\": 7,\n \"total_tokens\": 12\n }\n}\n" - } - }, - "ChatCompletionRequestMessageContentPartText": { - "type": "object", - "title": "Text content part", - "properties": { - "type": { - "type": "string", - "enum": [ - "text" - ], - "description": "The type of the content part." - }, - "text": { - "type": "string", - "description": "The text content." - } - }, - "required": [ - "type", - "text" - ] - }, - "ChatCompletionRequestMessageContentPartImage": { - "type": "object", - "title": "Image content part", - "properties": { - "type": { - "type": "string", - "enum": [ - "image_url" - ], - "description": "The type of the content part." - }, - "image_url": { - "type": "object", - "properties": { - "url": { - "type": "string", - "description": "Either a URL of the image or the base64 encoded image data.", - "format": "uri" - }, - "detail": { - "type": "string", - "description": "Specifies the detail level of the image. Learn more in the [Vision guide](/docs/guides/vision/low-or-high-fidelity-image-understanding).", - "enum": [ - "auto", - "low", - "high" - ], - "default": "auto" - } - }, - "required": [ - "url" - ] - } - }, - "required": [ - "type", - "image_url" - ] - }, - "ChatCompletionRequestMessageContentPartRefusal": { - "type": "object", - "title": "Refusal content part", - "properties": { - "type": { - "type": "string", - "enum": [ - "refusal" - ], - "description": "The type of the content part." - }, - "refusal": { - "type": "string", - "description": "The refusal message generated by the model." - } - }, - "required": [ - "type", - "refusal" - ] - }, - "ChatCompletionRequestMessage": { - "oneOf": [ - { - "$ref": "#/components/schemas/ChatCompletionRequestSystemMessage" - }, - { - "$ref": "#/components/schemas/ChatCompletionRequestUserMessage" - }, - { - "$ref": "#/components/schemas/ChatCompletionRequestAssistantMessage" - }, - { - "$ref": "#/components/schemas/ChatCompletionRequestToolMessage" - }, - { - "$ref": "#/components/schemas/ChatCompletionRequestFunctionMessage" - } - ], - "x-oaiExpandable": true - }, - "ChatCompletionRequestSystemMessageContentPart": { - "oneOf": [ - { - "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartText" - } - ], - "x-oaiExpandable": true - }, - "ChatCompletionRequestUserMessageContentPart": { - "oneOf": [ - { - "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartText" - }, - { - "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartImage" - } - ], - "x-oaiExpandable": true - }, - "ChatCompletionRequestAssistantMessageContentPart": { - "oneOf": [ - { - "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartText" - }, - { - "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartRefusal" - } - ], - "x-oaiExpandable": true - }, - "ChatCompletionRequestToolMessageContentPart": { - "oneOf": [ - { - "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartText" - } - ], - "x-oaiExpandable": true - }, - "ChatCompletionRequestSystemMessage": { - "type": "object", - "title": "System message", - "properties": { - "content": { - "description": "The contents of the system message.", - "oneOf": [ - { - "type": "string", - "description": "The contents of the system message.", - "title": "Text content" - }, - { - "type": "array", - "description": "An array of content parts with a defined type. For system messages, only type `text` is supported.", - "title": "Array of content parts", - "items": { - "$ref": "#/components/schemas/ChatCompletionRequestSystemMessageContentPart" - }, - "minItems": 1 - } - ] - }, - "role": { - "type": "string", - "enum": [ - "system" - ], - "description": "The role of the messages author, in this case `system`." - }, - "name": { - "type": "string", - "description": "An optional name for the participant. Provides the model information to differentiate between participants of the same role." - } - }, - "required": [ - "content", - "role" - ] - }, - "ChatCompletionRequestUserMessage": { - "type": "object", - "title": "User message", - "properties": { - "content": { - "description": "The contents of the user message.\n", - "oneOf": [ - { - "type": "string", - "description": "The text contents of the message.", - "title": "Text content" - }, - { - "type": "array", - "description": "An array of content parts with a defined type, each can be of type `text` or `image_url` when passing in images. You can pass multiple images by adding multiple `image_url` content parts. Image input is only supported when using the `gpt-4o` model.", - "title": "Array of content parts", - "items": { - "$ref": "#/components/schemas/ChatCompletionRequestUserMessageContentPart" - }, - "minItems": 1 - } - ], - "x-oaiExpandable": true - }, - "role": { - "type": "string", - "enum": [ - "user" - ], - "description": "The role of the messages author, in this case `user`." - }, - "name": { - "type": "string", - "description": "An optional name for the participant. Provides the model information to differentiate between participants of the same role." - } - }, - "required": [ - "content", - "role" - ] - }, - "ChatCompletionRequestAssistantMessage": { - "type": "object", - "title": "Assistant message", - "properties": { - "content": { - "nullable": true, - "oneOf": [ - { - "type": "string", - "description": "The contents of the assistant message.", - "title": "Text content" - }, - { - "type": "array", - "description": "An array of content parts with a defined type. Can be one or more of type `text`, or exactly one of type `refusal`.", - "title": "Array of content parts", - "items": { - "$ref": "#/components/schemas/ChatCompletionRequestAssistantMessageContentPart" - }, - "minItems": 1 - } - ], - "description": "The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified.\n" - }, - "refusal": { - "nullable": true, - "type": "string", - "description": "The refusal message by the assistant." - }, - "role": { - "type": "string", - "enum": [ - "assistant" - ], - "description": "The role of the messages author, in this case `assistant`." - }, - "name": { - "type": "string", - "description": "An optional name for the participant. Provides the model information to differentiate between participants of the same role." - }, - "tool_calls": { - "$ref": "#/components/schemas/ChatCompletionMessageToolCalls" - }, - "function_call": { - "type": "object", - "deprecated": true, - "description": "Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.", - "nullable": true, - "properties": { - "arguments": { - "type": "string", - "description": "The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function." - }, - "name": { - "type": "string", - "description": "The name of the function to call." - } - }, - "required": [ - "arguments", - "name" - ] - } - }, - "required": [ - "role" - ] - }, - "FineTuneChatCompletionRequestAssistantMessage": { - "allOf": [ - { - "type": "object", - "title": "Assistant message", - "deprecated": false, - "properties": { - "weight": { - "type": "integer", - "enum": [ - 0, - 1 - ], - "description": "Controls whether the assistant message is trained against (0 or 1)" - } - } - }, - { - "$ref": "#/components/schemas/ChatCompletionRequestAssistantMessage" - } - ], - "required": [ - "role" - ] - }, - "ChatCompletionRequestToolMessage": { - "type": "object", - "title": "Tool message", - "properties": { - "role": { - "type": "string", - "enum": [ - "tool" - ], - "description": "The role of the messages author, in this case `tool`." - }, - "content": { - "oneOf": [ - { - "type": "string", - "description": "The contents of the tool message.", - "title": "Text content" - }, - { - "type": "array", - "description": "An array of content parts with a defined type. For tool messages, only type `text` is supported.", - "title": "Array of content parts", - "items": { - "$ref": "#/components/schemas/ChatCompletionRequestToolMessageContentPart" - }, - "minItems": 1 - } - ], - "description": "The contents of the tool message." - }, - "tool_call_id": { - "type": "string", - "description": "Tool call that this message is responding to." - } - }, - "required": [ - "role", - "content", - "tool_call_id" - ] - }, - "ChatCompletionRequestFunctionMessage": { - "type": "object", - "title": "Function message", - "deprecated": true, - "properties": { - "role": { - "type": "string", - "enum": [ - "function" - ], - "description": "The role of the messages author, in this case `function`." - }, - "content": { - "nullable": true, - "type": "string", - "description": "The contents of the function message." - }, - "name": { - "type": "string", - "description": "The name of the function to call." - } - }, - "required": [ - "role", - "content", - "name" - ] - }, - "FunctionParameters": { - "type": "object", - "description": "The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. \n\nOmitting `parameters` defines a function with an empty parameter list.", - "additionalProperties": true - }, - "ChatCompletionFunctions": { - "type": "object", - "deprecated": true, - "properties": { - "description": { - "type": "string", - "description": "A description of what the function does, used by the model to choose when and how to call the function." - }, - "name": { - "type": "string", - "description": "The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64." - }, - "parameters": { - "$ref": "#/components/schemas/FunctionParameters" - } - }, - "required": [ - "name" - ] - }, - "ChatCompletionFunctionCallOption": { - "type": "object", - "description": "Specifying a particular function via `{\"name\": \"my_function\"}` forces the model to call that function.\n", - "properties": { - "name": { - "type": "string", - "description": "The name of the function to call." - } - }, - "required": [ - "name" - ] - }, - "ChatCompletionTool": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "function" - ], - "description": "The type of the tool. Currently, only `function` is supported." - }, - "function": { - "$ref": "#/components/schemas/FunctionObject" - } - }, - "required": [ - "type", - "function" - ] - }, - "FunctionObject": { - "type": "object", - "properties": { - "description": { - "type": "string", - "description": "A description of what the function does, used by the model to choose when and how to call the function." - }, - "name": { - "type": "string", - "description": "The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64." - }, - "parameters": { - "$ref": "#/components/schemas/FunctionParameters" - }, - "strict": { - "type": "boolean", - "nullable": true, - "default": false, - "description": "Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](docs/guides/function-calling)." - } - }, - "required": [ - "name" - ] - }, - "ResponseFormatText": { - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "The type of response format being defined: `text`", - "enum": [ - "text" - ] - } - }, - "required": [ - "type" - ] - }, - "ResponseFormatJsonObject": { - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "The type of response format being defined: `json_object`", - "enum": [ - "json_object" - ] - } - }, - "required": [ - "type" - ] - }, - "ResponseFormatJsonSchemaSchema": { - "type": "object", - "description": "The schema for the response format, described as a JSON Schema object.", - "additionalProperties": true - }, - "ResponseFormatJsonSchema": { - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "The type of response format being defined: `json_schema`", - "enum": [ - "json_schema" - ] - }, - "json_schema": { - "type": "object", - "properties": { - "description": { - "type": "string", - "description": "A description of what the response format is for, used by the model to determine how to respond in the format." - }, - "name": { - "type": "string", - "description": "The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64." - }, - "schema": { - "$ref": "#/components/schemas/ResponseFormatJsonSchemaSchema" - }, - "strict": { - "type": "boolean", - "nullable": true, - "default": false, - "description": "Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the `schema` field. Only a subset of JSON Schema is supported when `strict` is `true`. To learn more, read the [Structured Outputs guide](/docs/guides/structured-outputs)." - } - }, - "required": [ - "type", - "name" - ] - } - }, - "required": [ - "type", - "json_schema" - ] - }, - "ChatCompletionToolChoiceOption": { - "description": "Controls which (if any) tool is called by the model.\n`none` means the model will not call any tool and instead generates a message.\n`auto` means the model can pick between generating a message or calling one or more tools.\n`required` means the model must call one or more tools.\nSpecifying a particular tool via `{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}` forces the model to call that tool.\n\n`none` is the default when no tools are present. `auto` is the default if tools are present.\n", - "oneOf": [ - { - "type": "string", - "description": "`none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools.\n", - "enum": [ - "none", - "auto", - "required" - ] - }, - { - "$ref": "#/components/schemas/ChatCompletionNamedToolChoice" - } - ], - "x-oaiExpandable": true - }, - "ChatCompletionNamedToolChoice": { - "type": "object", - "description": "Specifies a tool the model should use. Use to force the model to call a specific function.", - "properties": { - "type": { - "type": "string", - "enum": [ - "function" - ], - "description": "The type of the tool. Currently, only `function` is supported." - }, - "function": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The name of the function to call." - } - }, - "required": [ - "name" - ] - } - }, - "required": [ - "type", - "function" - ] - }, - "ParallelToolCalls": { - "description": "Whether to enable [parallel function calling](/docs/guides/function-calling/parallel-function-calling) during tool use.", - "type": "boolean", - "default": true - }, - "ChatCompletionMessageToolCalls": { - "type": "array", - "description": "The tool calls generated by the model, such as function calls.", - "items": { - "$ref": "#/components/schemas/ChatCompletionMessageToolCall" - } - }, - "ChatCompletionMessageToolCall": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "The ID of the tool call." - }, - "type": { - "type": "string", - "enum": [ - "function" - ], - "description": "The type of the tool. Currently, only `function` is supported." - }, - "function": { - "type": "object", - "description": "The function that the model called.", - "properties": { - "name": { - "type": "string", - "description": "The name of the function to call." - }, - "arguments": { - "type": "string", - "description": "The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function." - } - }, - "required": [ - "name", - "arguments" - ] - } - }, - "required": [ - "id", - "type", - "function" - ] - }, - "ChatCompletionMessageToolCallChunk": { - "type": "object", - "properties": { - "index": { - "type": "integer" - }, - "id": { - "type": "string", - "description": "The ID of the tool call." - }, - "type": { - "type": "string", - "enum": [ - "function" - ], - "description": "The type of the tool. Currently, only `function` is supported." - }, - "function": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The name of the function to call." - }, - "arguments": { - "type": "string", - "description": "The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function." - } - } - } - }, - "required": [ - "index" - ] - }, - "ChatCompletionRole": { - "type": "string", - "description": "The role of the author of a message", - "enum": [ - "system", - "user", - "assistant", - "tool", - "function" - ] - }, - "ChatCompletionStreamOptions": { - "description": "Options for streaming response. Only set this when you set `stream: true`.\n", - "type": "object", - "nullable": true, - "default": null, - "properties": { - "include_usage": { - "type": "boolean", - "description": "If set, an additional chunk will be streamed before the `data: [DONE]` message. The `usage` field on this chunk shows the token usage statistics for the entire request, and the `choices` field will always be an empty array. All other chunks will also include a `usage` field, but with a null value.\n" - } - } - }, - "ChatCompletionResponseMessage": { - "type": "object", - "description": "A chat completion message generated by the model.", - "properties": { - "content": { - "type": "string", - "description": "The contents of the message.", - "nullable": true - }, - "refusal": { - "type": "string", - "description": "The refusal message generated by the model.", - "nullable": true - }, - "tool_calls": { - "$ref": "#/components/schemas/ChatCompletionMessageToolCalls" - }, - "role": { - "type": "string", - "enum": [ - "assistant" - ], - "description": "The role of the author of this message." - }, - "function_call": { - "type": "object", - "deprecated": true, - "description": "Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.", - "properties": { - "arguments": { - "type": "string", - "description": "The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function." - }, - "name": { - "type": "string", - "description": "The name of the function to call." - } - }, - "required": [ - "name", - "arguments" - ] - } - }, - "required": [ - "role", - "content", - "refusal" - ] - }, - "ChatCompletionStreamResponseDelta": { - "type": "object", - "description": "A chat completion delta generated by streamed model responses.", - "properties": { - "content": { - "type": "string", - "description": "The contents of the chunk message.", - "nullable": true - }, - "function_call": { - "deprecated": true, - "type": "object", - "description": "Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.", - "properties": { - "arguments": { - "type": "string", - "description": "The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function." - }, - "name": { - "type": "string", - "description": "The name of the function to call." - } - } - }, - "tool_calls": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ChatCompletionMessageToolCallChunk" - } - }, - "role": { - "type": "string", - "enum": [ - "system", - "user", - "assistant", - "tool" - ], - "description": "The role of the author of this message." - }, - "refusal": { - "type": "string", - "description": "The refusal message generated by the model.", - "nullable": true - } - } - }, - "CreateChatCompletionRequest": { - "type": "object", - "properties": { - "messages": { - "description": "A list of messages comprising the conversation so far. [Example Python code](https://cookbook.openai.com/examples/how_to_format_inputs_to_chatgpt_models).", - "type": "array", - "minItems": 1, - "items": { - "$ref": "#/components/schemas/ChatCompletionRequestMessage" - } - }, - "model": { - "description": "ID of the model to use. See the [model endpoint compatibility](/docs/models/model-endpoint-compatibility) table for details on which models work with the Chat API.", - "example": "gpt-4o", - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "o1-preview", - "o1-preview-2024-09-12", - "o1-mini", - "o1-mini-2024-09-12", - "gpt-4o", - "gpt-4o-2024-08-06", - "gpt-4o-2024-05-13", - "gpt-4o-2024-08-06", - "chatgpt-4o-latest", - "gpt-4o-mini", - "gpt-4o-mini-2024-07-18", - "gpt-4-turbo", - "gpt-4-turbo-2024-04-09", - "gpt-4-0125-preview", - "gpt-4-turbo-preview", - "gpt-4-1106-preview", - "gpt-4-vision-preview", - "gpt-4", - "gpt-4-0314", - "gpt-4-0613", - "gpt-4-32k", - "gpt-4-32k-0314", - "gpt-4-32k-0613", - "gpt-3.5-turbo", - "gpt-3.5-turbo-16k", - "gpt-3.5-turbo-0301", - "gpt-3.5-turbo-0613", - "gpt-3.5-turbo-1106", - "gpt-3.5-turbo-0125", - "gpt-3.5-turbo-16k-0613" - ] - } - ], - "x-oaiTypeLabel": "string" - }, - "frequency_penalty": { - "type": "number", - "default": 0, - "minimum": -2, - "maximum": 2, - "nullable": true, - "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.\n\n[See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details)\n" - }, - "logit_bias": { - "type": "object", - "x-oaiTypeLabel": "map", - "default": null, - "nullable": true, - "additionalProperties": { - "type": "integer" - }, - "description": "Modify the likelihood of specified tokens appearing in the completion.\n\nAccepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token.\n" - }, - "logprobs": { - "description": "Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the `content` of `message`.", - "type": "boolean", - "default": false, - "nullable": true - }, - "top_logprobs": { - "description": "An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. `logprobs` must be set to `true` if this parameter is used.", - "type": "integer", - "minimum": 0, - "maximum": 20, - "nullable": true - }, - "max_tokens": { - "description": "The maximum number of [tokens](/tokenizer) that can be generated in the chat completion. This value can be used to control [costs](https://openai.com/api/pricing/) for text generated via API.\n\nThis value is now deprecated in favor of `max_completion_tokens`, and is not compatible with [o1 series models](/docs/guides/reasoning).\n", - "type": "integer", - "nullable": true, - "deprecated": true - }, - "max_completion_tokens": { - "description": "An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and [reasoning tokens](/docs/guides/reasoning).\n", - "type": "integer", - "nullable": true - }, - "n": { - "type": "integer", - "minimum": 1, - "maximum": 128, - "default": 1, - "example": 1, - "nullable": true, - "description": "How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs." - }, - "presence_penalty": { - "type": "number", - "default": 0, - "minimum": -2, - "maximum": 2, - "nullable": true, - "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.\n\n[See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details)\n" - }, - "response_format": { - "description": "An object specifying the format that the model must output. Compatible with [GPT-4o](/docs/models/gpt-4o), [GPT-4o mini](/docs/models/gpt-4o-mini), [GPT-4 Turbo](/docs/models/gpt-4-and-gpt-4-turbo) and all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`.\n\nSetting to `{ \"type\": \"json_schema\", \"json_schema\": {...} }` enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the [Structured Outputs guide](/docs/guides/structured-outputs).\n\nSetting to `{ \"type\": \"json_object\" }` enables JSON mode, which ensures the message the model generates is valid JSON.\n\n**Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly \"stuck\" request. Also note that the message content may be partially cut off if `finish_reason=\"length\"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length.\n", - "oneOf": [ - { - "$ref": "#/components/schemas/ResponseFormatText" - }, - { - "$ref": "#/components/schemas/ResponseFormatJsonObject" - }, - { - "$ref": "#/components/schemas/ResponseFormatJsonSchema" - } - ], - "x-oaiExpandable": true - }, - "seed": { - "type": "integer", - "minimum": -9223372036854776000, - "maximum": 9223372036854776000, - "nullable": true, - "description": "This feature is in Beta.\nIf specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result.\nDeterminism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend.\n", - "x-oaiMeta": { - "beta": true - } - }, - "service_tier": { - "description": "Specifies the latency tier to use for processing the request. This parameter is relevant for customers subscribed to the scale tier service:\n - If set to 'auto', and the Project is Scale tier enabled, the system will utilize scale tier credits until they are exhausted.\n - If set to 'auto', and the Project is not Scale tier enabled, the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee.\n - If set to 'default', the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee.\n - When not set, the default behavior is 'auto'.\n\n When this parameter is set, the response body will include the `service_tier` utilized.\n", - "type": "string", - "enum": [ - "auto", - "default" - ], - "nullable": true, - "default": null - }, - "stop": { - "description": "Up to 4 sequences where the API will stop generating further tokens.\n", - "default": null, - "oneOf": [ - { - "type": "string", - "nullable": true - }, - { - "type": "array", - "minItems": 1, - "maxItems": 4, - "items": { - "type": "string" - } - } - ] - }, - "stream": { - "description": "If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions).\n", - "type": "boolean", - "nullable": true, - "default": false - }, - "stream_options": { - "$ref": "#/components/schemas/ChatCompletionStreamOptions" - }, - "temperature": { - "type": "number", - "minimum": 0, - "maximum": 2, - "default": 1, - "example": 1, - "nullable": true, - "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n\nWe generally recommend altering this or `top_p` but not both.\n" - }, - "top_p": { - "type": "number", - "minimum": 0, - "maximum": 1, - "default": 1, - "example": 1, - "nullable": true, - "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or `temperature` but not both.\n" - }, - "tools": { - "type": "array", - "description": "A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.\n", - "items": { - "$ref": "#/components/schemas/ChatCompletionTool" - } - }, - "tool_choice": { - "$ref": "#/components/schemas/ChatCompletionToolChoiceOption" - }, - "parallel_tool_calls": { - "$ref": "#/components/schemas/ParallelToolCalls" - }, - "user": { - "type": "string", - "example": "user-1234", - "description": "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).\n" - }, - "function_call": { - "deprecated": true, - "description": "Deprecated in favor of `tool_choice`.\n\nControls which (if any) function is called by the model.\n`none` means the model will not call a function and instead generates a message.\n`auto` means the model can pick between generating a message or calling a function.\nSpecifying a particular function via `{\"name\": \"my_function\"}` forces the model to call that function.\n\n`none` is the default when no functions are present. `auto` is the default if functions are present.\n", - "oneOf": [ - { - "type": "string", - "description": "`none` means the model will not call a function and instead generates a message. `auto` means the model can pick between generating a message or calling a function.\n", - "enum": [ - "none", - "auto" - ] - }, - { - "$ref": "#/components/schemas/ChatCompletionFunctionCallOption" - } - ], - "x-oaiExpandable": true - }, - "functions": { - "deprecated": true, - "description": "Deprecated in favor of `tools`.\n\nA list of functions the model may generate JSON inputs for.\n", - "type": "array", - "minItems": 1, - "maxItems": 128, - "items": { - "$ref": "#/components/schemas/ChatCompletionFunctions" - } - } - }, - "required": [ - "model", - "messages" - ] - }, - "CreateChatCompletionResponse": { - "type": "object", - "description": "Represents a chat completion response returned by model, based on the provided input.", - "properties": { - "id": { - "type": "string", - "description": "A unique identifier for the chat completion." - }, - "choices": { - "type": "array", - "description": "A list of chat completion choices. Can be more than one if `n` is greater than 1.", - "items": { - "type": "object", - "required": [ - "finish_reason", - "index", - "message", - "logprobs" - ], - "properties": { - "finish_reason": { - "type": "string", - "description": "The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,\n`length` if the maximum number of tokens specified in the request was reached,\n`content_filter` if content was omitted due to a flag from our content filters,\n`tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.\n", - "enum": [ - "stop", - "length", - "tool_calls", - "content_filter", - "function_call" - ] - }, - "index": { - "type": "integer", - "description": "The index of the choice in the list of choices." - }, - "message": { - "$ref": "#/components/schemas/ChatCompletionResponseMessage" - }, - "logprobs": { - "description": "Log probability information for the choice.", - "type": "object", - "nullable": true, - "properties": { - "content": { - "description": "A list of message content tokens with log probability information.", - "type": "array", - "items": { - "$ref": "#/components/schemas/ChatCompletionTokenLogprob" - }, - "nullable": true - }, - "refusal": { - "description": "A list of message refusal tokens with log probability information.", - "type": "array", - "items": { - "$ref": "#/components/schemas/ChatCompletionTokenLogprob" - }, - "nullable": true - } - }, - "required": [ - "content", - "refusal" - ] - } - } - } - }, - "created": { - "type": "integer", - "description": "The Unix timestamp (in seconds) of when the chat completion was created." - }, - "model": { - "type": "string", - "description": "The model used for the chat completion." - }, - "service_tier": { - "description": "The service tier used for processing the request. This field is only included if the `service_tier` parameter is specified in the request.", - "type": "string", - "enum": [ - "scale", - "default" - ], - "example": "scale", - "nullable": true - }, - "system_fingerprint": { - "type": "string", - "description": "This fingerprint represents the backend configuration that the model runs with.\n\nCan be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.\n" - }, - "object": { - "type": "string", - "description": "The object type, which is always `chat.completion`.", - "enum": [ - "chat.completion" - ] - }, - "usage": { - "$ref": "#/components/schemas/CompletionUsage" - } - }, - "required": [ - "choices", - "created", - "id", - "model", - "object" - ], - "x-oaiMeta": { - "name": "The chat completion object", - "group": "chat", - "example": "{\n \"id\": \"chatcmpl-123\",\n \"object\": \"chat.completion\",\n \"created\": 1677652288,\n \"model\": \"gpt-4o-mini\",\n \"system_fingerprint\": \"fp_44709d6fcb\",\n \"choices\": [{\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": \"\\n\\nHello there, how may I assist you today?\",\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }],\n \"usage\": {\n \"prompt_tokens\": 9,\n \"completion_tokens\": 12,\n \"total_tokens\": 21,\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0\n }\n }\n}\n" - } - }, - "CreateChatCompletionFunctionResponse": { - "type": "object", - "description": "Represents a chat completion response returned by model, based on the provided input.", - "properties": { - "id": { - "type": "string", - "description": "A unique identifier for the chat completion." - }, - "choices": { - "type": "array", - "description": "A list of chat completion choices. Can be more than one if `n` is greater than 1.", - "items": { - "type": "object", - "required": [ - "finish_reason", - "index", - "message", - "logprobs" - ], - "properties": { - "finish_reason": { - "type": "string", - "description": "The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, `length` if the maximum number of tokens specified in the request was reached, `content_filter` if content was omitted due to a flag from our content filters, or `function_call` if the model called a function.\n", - "enum": [ - "stop", - "length", - "function_call", - "content_filter" - ] - }, - "index": { - "type": "integer", - "description": "The index of the choice in the list of choices." - }, - "message": { - "$ref": "#/components/schemas/ChatCompletionResponseMessage" - } - } - } - }, - "created": { - "type": "integer", - "description": "The Unix timestamp (in seconds) of when the chat completion was created." - }, - "model": { - "type": "string", - "description": "The model used for the chat completion." - }, - "system_fingerprint": { - "type": "string", - "description": "This fingerprint represents the backend configuration that the model runs with.\n\nCan be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.\n" - }, - "object": { - "type": "string", - "description": "The object type, which is always `chat.completion`.", - "enum": [ - "chat.completion" - ] - }, - "usage": { - "$ref": "#/components/schemas/CompletionUsage" - } - }, - "required": [ - "choices", - "created", - "id", - "model", - "object" - ], - "x-oaiMeta": { - "name": "The chat completion object", - "group": "chat", - "example": "{\n \"id\": \"chatcmpl-abc123\",\n \"object\": \"chat.completion\",\n \"created\": 1699896916,\n \"model\": \"gpt-4o-mini\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_abc123\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"arguments\": \"{\\n\\\"location\\\": \\\"Boston, MA\\\"\\n}\"\n }\n }\n ]\n },\n \"logprobs\": null,\n \"finish_reason\": \"tool_calls\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 82,\n \"completion_tokens\": 17,\n \"total_tokens\": 99,\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0\n }\n }\n}\n" - } - }, - "ChatCompletionTokenLogprob": { - "type": "object", - "properties": { - "token": { - "description": "The token.", - "type": "string" - }, - "logprob": { - "description": "The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.", - "type": "number" - }, - "bytes": { - "description": "A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.", - "type": "array", - "items": { - "type": "integer" - }, - "nullable": true - }, - "top_logprobs": { - "description": "List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested `top_logprobs` returned.", - "type": "array", - "items": { - "type": "object", - "properties": { - "token": { - "description": "The token.", - "type": "string" - }, - "logprob": { - "description": "The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.", - "type": "number" - }, - "bytes": { - "description": "A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.", - "type": "array", - "items": { - "type": "integer" - }, - "nullable": true - } - }, - "required": [ - "token", - "logprob", - "bytes" - ] - } - } - }, - "required": [ - "token", - "logprob", - "bytes", - "top_logprobs" - ] - }, - "ListPaginatedFineTuningJobsResponse": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FineTuningJob" - } - }, - "has_more": { - "type": "boolean" - }, - "object": { - "type": "string", - "enum": [ - "list" - ] - } - }, - "required": [ - "object", - "data", - "has_more" - ] - }, - "CreateChatCompletionStreamResponse": { - "type": "object", - "description": "Represents a streamed chunk of a chat completion response returned by model, based on the provided input.", - "properties": { - "id": { - "type": "string", - "description": "A unique identifier for the chat completion. Each chunk has the same ID." - }, - "choices": { - "type": "array", - "description": "A list of chat completion choices. Can contain more than one elements if `n` is greater than 1. Can also be empty for the\nlast chunk if you set `stream_options: {\"include_usage\": true}`.\n", - "items": { - "type": "object", - "required": [ - "delta", - "finish_reason", - "index" - ], - "properties": { - "delta": { - "$ref": "#/components/schemas/ChatCompletionStreamResponseDelta" - }, - "logprobs": { - "description": "Log probability information for the choice.", - "type": "object", - "nullable": true, - "properties": { - "content": { - "description": "A list of message content tokens with log probability information.", - "type": "array", - "items": { - "$ref": "#/components/schemas/ChatCompletionTokenLogprob" - }, - "nullable": true - }, - "refusal": { - "description": "A list of message refusal tokens with log probability information.", - "type": "array", - "items": { - "$ref": "#/components/schemas/ChatCompletionTokenLogprob" - }, - "nullable": true - } - }, - "required": [ - "content", - "refusal" - ] - }, - "finish_reason": { - "type": "string", - "description": "The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,\n`length` if the maximum number of tokens specified in the request was reached,\n`content_filter` if content was omitted due to a flag from our content filters,\n`tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.\n", - "enum": [ - "stop", - "length", - "tool_calls", - "content_filter", - "function_call" - ], - "nullable": true - }, - "index": { - "type": "integer", - "description": "The index of the choice in the list of choices." - } - } - } - }, - "created": { - "type": "integer", - "description": "The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has the same timestamp." - }, - "model": { - "type": "string", - "description": "The model to generate the completion." - }, - "service_tier": { - "description": "The service tier used for processing the request. This field is only included if the `service_tier` parameter is specified in the request.", - "type": "string", - "enum": [ - "scale", - "default" - ], - "example": "scale", - "nullable": true - }, - "system_fingerprint": { - "type": "string", - "description": "This fingerprint represents the backend configuration that the model runs with.\nCan be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.\n" - }, - "object": { - "type": "string", - "description": "The object type, which is always `chat.completion.chunk`.", - "enum": [ - "chat.completion.chunk" - ] - }, - "usage": { - "type": "object", - "description": "An optional field that will only be present when you set `stream_options: {\"include_usage\": true}` in your request.\nWhen present, it contains a null value except for the last chunk which contains the token usage statistics for the entire request.\n", - "properties": { - "completion_tokens": { - "type": "integer", - "description": "Number of tokens in the generated completion." - }, - "prompt_tokens": { - "type": "integer", - "description": "Number of tokens in the prompt." - }, - "total_tokens": { - "type": "integer", - "description": "Total number of tokens used in the request (prompt + completion)." - } - }, - "required": [ - "prompt_tokens", - "completion_tokens", - "total_tokens" - ] - } - }, - "required": [ - "choices", - "created", - "id", - "model", - "object" - ], - "x-oaiMeta": { - "name": "The chat completion chunk object", - "group": "chat", - "example": "{\"id\":\"chatcmpl-123\",\"object\":\"chat.completion.chunk\",\"created\":1694268190,\"model\":\"gpt-4o-mini\", \"system_fingerprint\": \"fp_44709d6fcb\", \"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":\"\"},\"logprobs\":null,\"finish_reason\":null}]}\n\n{\"id\":\"chatcmpl-123\",\"object\":\"chat.completion.chunk\",\"created\":1694268190,\"model\":\"gpt-4o-mini\", \"system_fingerprint\": \"fp_44709d6fcb\", \"choices\":[{\"index\":0,\"delta\":{\"content\":\"Hello\"},\"logprobs\":null,\"finish_reason\":null}]}\n\n....\n\n{\"id\":\"chatcmpl-123\",\"object\":\"chat.completion.chunk\",\"created\":1694268190,\"model\":\"gpt-4o-mini\", \"system_fingerprint\": \"fp_44709d6fcb\", \"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n" - } - }, - "CreateChatCompletionImageResponse": { - "type": "object", - "description": "Represents a streamed chunk of a chat completion response returned by model, based on the provided input.", - "x-oaiMeta": { - "name": "The chat completion chunk object", - "group": "chat", - "example": "{\n \"id\": \"chatcmpl-123\",\n \"object\": \"chat.completion\",\n \"created\": 1677652288,\n \"model\": \"gpt-4o-mini\",\n \"system_fingerprint\": \"fp_44709d6fcb\",\n \"choices\": [{\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": \"\\n\\nThis image shows a wooden boardwalk extending through a lush green marshland.\",\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }],\n \"usage\": {\n \"prompt_tokens\": 9,\n \"completion_tokens\": 12,\n \"total_tokens\": 21,\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0\n }\n }\n}\n" - } - }, - "CreateImageRequest": { - "type": "object", - "properties": { - "prompt": { - "description": "A text description of the desired image(s). The maximum length is 1000 characters for `dall-e-2` and 4000 characters for `dall-e-3`.", - "type": "string", - "example": "A cute baby sea otter" - }, - "model": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "dall-e-2", - "dall-e-3" - ] - } - ], - "x-oaiTypeLabel": "string", - "default": "dall-e-2", - "example": "dall-e-3", - "nullable": true, - "description": "The model to use for image generation." - }, - "n": { - "type": "integer", - "minimum": 1, - "maximum": 10, - "default": 1, - "example": 1, - "nullable": true, - "description": "The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only `n=1` is supported." - }, - "quality": { - "type": "string", - "enum": [ - "standard", - "hd" - ], - "default": "standard", - "example": "standard", - "description": "The quality of the image that will be generated. `hd` creates images with finer details and greater consistency across the image. This param is only supported for `dall-e-3`." - }, - "response_format": { - "type": "string", - "enum": [ - "url", - "b64_json" - ], - "default": "url", - "example": "url", - "nullable": true, - "description": "The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated." - }, - "size": { - "type": "string", - "enum": [ - "256x256", - "512x512", - "1024x1024", - "1792x1024", - "1024x1792" - ], - "default": "1024x1024", - "example": "1024x1024", - "nullable": true, - "description": "The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`. Must be one of `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3` models." - }, - "style": { - "type": "string", - "enum": [ - "vivid", - "natural" - ], - "default": "vivid", - "example": "vivid", - "nullable": true, - "description": "The style of the generated images. Must be one of `vivid` or `natural`. Vivid causes the model to lean towards generating hyper-real and dramatic images. Natural causes the model to produce more natural, less hyper-real looking images. This param is only supported for `dall-e-3`." - }, - "user": { - "type": "string", - "example": "user-1234", - "description": "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).\n" - } - }, - "required": [ - "prompt" - ] - }, - "ImagesResponse": { - "properties": { - "created": { - "type": "integer" - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Image" - } - } - }, - "required": [ - "created", - "data" - ] - }, - "Image": { - "type": "object", - "description": "Represents the url or the content of an image generated by the OpenAI API.", - "properties": { - "b64_json": { - "type": "string", - "description": "The base64-encoded JSON of the generated image, if `response_format` is `b64_json`." - }, - "url": { - "type": "string", - "description": "The URL of the generated image, if `response_format` is `url` (default)." - }, - "revised_prompt": { - "type": "string", - "description": "The prompt that was used to generate the image, if there was any revision to the prompt." - } - }, - "x-oaiMeta": { - "name": "The image object", - "example": "{\n \"url\": \"...\",\n \"revised_prompt\": \"...\"\n}\n" - } - }, - "CreateImageEditRequest": { - "type": "object", - "properties": { - "image": { - "description": "The image to edit. Must be a valid PNG file, less than 4MB, and square. If mask is not provided, image must have transparency, which will be used as the mask.", - "type": "string", - "format": "binary" - }, - "prompt": { - "description": "A text description of the desired image(s). The maximum length is 1000 characters.", - "type": "string", - "example": "A cute baby sea otter wearing a beret" - }, - "mask": { - "description": "An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`.", - "type": "string", - "format": "binary" - }, - "model": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "dall-e-2" - ] - } - ], - "x-oaiTypeLabel": "string", - "default": "dall-e-2", - "example": "dall-e-2", - "nullable": true, - "description": "The model to use for image generation. Only `dall-e-2` is supported at this time." - }, - "n": { - "type": "integer", - "minimum": 1, - "maximum": 10, - "default": 1, - "example": 1, - "nullable": true, - "description": "The number of images to generate. Must be between 1 and 10." - }, - "size": { - "type": "string", - "enum": [ - "256x256", - "512x512", - "1024x1024" - ], - "default": "1024x1024", - "example": "1024x1024", - "nullable": true, - "description": "The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`." - }, - "response_format": { - "type": "string", - "enum": [ - "url", - "b64_json" - ], - "default": "url", - "example": "url", - "nullable": true, - "description": "The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated." - }, - "user": { - "type": "string", - "example": "user-1234", - "description": "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).\n" - } - }, - "required": [ - "prompt", - "image" - ] - }, - "CreateImageVariationRequest": { - "type": "object", - "properties": { - "image": { - "description": "The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square.", - "type": "string", - "format": "binary" - }, - "model": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "dall-e-2" - ] - } - ], - "x-oaiTypeLabel": "string", - "default": "dall-e-2", - "example": "dall-e-2", - "nullable": true, - "description": "The model to use for image generation. Only `dall-e-2` is supported at this time." - }, - "n": { - "type": "integer", - "minimum": 1, - "maximum": 10, - "default": 1, - "example": 1, - "nullable": true, - "description": "The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only `n=1` is supported." - }, - "response_format": { - "type": "string", - "enum": [ - "url", - "b64_json" - ], - "default": "url", - "example": "url", - "nullable": true, - "description": "The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated." - }, - "size": { - "type": "string", - "enum": [ - "256x256", - "512x512", - "1024x1024" - ], - "default": "1024x1024", - "example": "1024x1024", - "nullable": true, - "description": "The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`." - }, - "user": { - "type": "string", - "example": "user-1234", - "description": "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).\n" - } - }, - "required": [ - "image" - ] - }, - "CreateModerationRequest": { - "type": "object", - "properties": { - "input": { - "description": "Input (or inputs) to classify. Can be a single string, an array of strings, or\nan array of multi-modal input objects similar to other models.\n", - "oneOf": [ - { - "type": "string", - "description": "A string of text to classify for moderation.", - "default": "", - "example": "I want to kill them." - }, - { - "type": "array", - "description": "An array of strings to classify for moderation.", - "items": { - "type": "string", - "default": "", - "example": "I want to kill them." - } - }, - { - "type": "array", - "description": "An array of multi-modal inputs to the moderation model.", - "items": { - "x-oaiExpandable": true, - "oneOf": [ - { - "type": "object", - "description": "An object describing an image to classify.", - "properties": { - "type": { - "description": "Always `image_url`.", - "type": "string", - "enum": [ - "image_url" - ] - }, - "image_url": { - "type": "object", - "description": "Contains either an image URL or a data URL for a base64 encoded image.", - "properties": { - "url": { - "type": "string", - "description": "Either a URL of the image or the base64 encoded image data.", - "format": "uri", - "example": "https://example.com/image.jpg" - } - }, - "required": [ - "url" - ] - } - }, - "required": [ - "type", - "image_url" - ] - }, - { - "type": "object", - "description": "An object describing text to classify.", - "properties": { - "type": { - "description": "Always `text`.", - "type": "string", - "enum": [ - "text" - ] - }, - "text": { - "description": "A string of text to classify.", - "type": "string", - "example": "I want to kill them" - } - }, - "required": [ - "type", - "text" - ] - } - ] - } - } - ], - "x-oaiExpandable": true - }, - "model": { - "description": "The content moderation model you would like to use. Learn more in\n[the moderation guide](/docs/guides/moderation), and learn about\navailable models [here](/docs/models/moderation).\n", - "nullable": false, - "default": "omni-moderation-latest", - "example": "omni-moderation-2024-09-26", - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "omni-moderation-latest", - "omni-moderation-2024-09-26", - "text-moderation-latest", - "text-moderation-stable" - ] - } - ], - "x-oaiTypeLabel": "string" - } - }, - "required": [ - "input" - ] - }, - "CreateModerationResponse": { - "type": "object", - "description": "Represents if a given text input is potentially harmful.", - "properties": { - "id": { - "type": "string", - "description": "The unique identifier for the moderation request." - }, - "model": { - "type": "string", - "description": "The model used to generate the moderation results." - }, - "results": { - "type": "array", - "description": "A list of moderation objects.", - "items": { - "type": "object", - "properties": { - "flagged": { - "type": "boolean", - "description": "Whether any of the below categories are flagged." - }, - "categories": { - "type": "object", - "description": "A list of the categories, and whether they are flagged or not.", - "properties": { - "hate": { - "type": "boolean", - "description": "Content that expresses, incites, or promotes hate based on race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste. Hateful content aimed at non-protected groups (e.g., chess players) is harassment." - }, - "hate/threatening": { - "type": "boolean", - "description": "Hateful content that also includes violence or serious harm towards the targeted group based on race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste." - }, - "harassment": { - "type": "boolean", - "description": "Content that expresses, incites, or promotes harassing language towards any target." - }, - "harassment/threatening": { - "type": "boolean", - "description": "Harassment content that also includes violence or serious harm towards any target." - }, - "illicit": { - "type": "boolean", - "description": "Content that includes instructions or advice that facilitate the planning or execution of wrongdoing, or that gives advice or instruction on how to commit illicit acts. For example, \"how to shoplift\" would fit this category." - }, - "illicit/violent": { - "type": "boolean", - "description": "Content that includes instructions or advice that facilitate the planning or execution of wrongdoing that also includes violence, or that gives advice or instruction on the procurement of any weapon." - }, - "self-harm": { - "type": "boolean", - "description": "Content that promotes, encourages, or depicts acts of self-harm, such as suicide, cutting, and eating disorders." - }, - "self-harm/intent": { - "type": "boolean", - "description": "Content where the speaker expresses that they are engaging or intend to engage in acts of self-harm, such as suicide, cutting, and eating disorders." - }, - "self-harm/instructions": { - "type": "boolean", - "description": "Content that encourages performing acts of self-harm, such as suicide, cutting, and eating disorders, or that gives instructions or advice on how to commit such acts." - }, - "sexual": { - "type": "boolean", - "description": "Content meant to arouse sexual excitement, such as the description of sexual activity, or that promotes sexual services (excluding sex education and wellness)." - }, - "sexual/minors": { - "type": "boolean", - "description": "Sexual content that includes an individual who is under 18 years old." - }, - "violence": { - "type": "boolean", - "description": "Content that depicts death, violence, or physical injury." - }, - "violence/graphic": { - "type": "boolean", - "description": "Content that depicts death, violence, or physical injury in graphic detail." - } - }, - "required": [ - "hate", - "hate/threatening", - "harassment", - "harassment/threatening", - "illicit", - "illicit/violent", - "self-harm", - "self-harm/intent", - "self-harm/instructions", - "sexual", - "sexual/minors", - "violence", - "violence/graphic" - ] - }, - "category_scores": { - "type": "object", - "description": "A list of the categories along with their scores as predicted by model.", - "properties": { - "hate": { - "type": "number", - "description": "The score for the category 'hate'." - }, - "hate/threatening": { - "type": "number", - "description": "The score for the category 'hate/threatening'." - }, - "harassment": { - "type": "number", - "description": "The score for the category 'harassment'." - }, - "harassment/threatening": { - "type": "number", - "description": "The score for the category 'harassment/threatening'." - }, - "illicit": { - "type": "number", - "description": "The score for the category 'illicit'." - }, - "illicit/violent": { - "type": "number", - "description": "The score for the category 'illicit/violent'." - }, - "self-harm": { - "type": "number", - "description": "The score for the category 'self-harm'." - }, - "self-harm/intent": { - "type": "number", - "description": "The score for the category 'self-harm/intent'." - }, - "self-harm/instructions": { - "type": "number", - "description": "The score for the category 'self-harm/instructions'." - }, - "sexual": { - "type": "number", - "description": "The score for the category 'sexual'." - }, - "sexual/minors": { - "type": "number", - "description": "The score for the category 'sexual/minors'." - }, - "violence": { - "type": "number", - "description": "The score for the category 'violence'." - }, - "violence/graphic": { - "type": "number", - "description": "The score for the category 'violence/graphic'." - } - }, - "required": [ - "hate", - "hate/threatening", - "harassment", - "harassment/threatening", - "illicit", - "illicit/violent", - "self-harm", - "self-harm/intent", - "self-harm/instructions", - "sexual", - "sexual/minors", - "violence", - "violence/graphic" - ] - }, - "category_applied_input_types": { - "type": "object", - "description": "A list of the categories along with the input type(s) that the score applies to.", - "properties": { - "hate": { - "type": "array", - "description": "The applied input type(s) for the category 'hate'.", - "items": { - "type": "string", - "enum": [ - "text" - ] - } - }, - "hate/threatening": { - "type": "array", - "description": "The applied input type(s) for the category 'hate/threatening'.", - "items": { - "type": "string", - "enum": [ - "text" - ] - } - }, - "harassment": { - "type": "array", - "description": "The applied input type(s) for the category 'harassment'.", - "items": { - "type": "string", - "enum": [ - "text" - ] - } - }, - "harassment/threatening": { - "type": "array", - "description": "The applied input type(s) for the category 'harassment/threatening'.", - "items": { - "type": "string", - "enum": [ - "text" - ] - } - }, - "illicit": { - "type": "array", - "description": "The applied input type(s) for the category 'illicit'.", - "items": { - "type": "string", - "enum": [ - "text" - ] - } - }, - "illicit/violent": { - "type": "array", - "description": "The applied input type(s) for the category 'illicit/violent'.", - "items": { - "type": "string", - "enum": [ - "text" - ] - } - }, - "self-harm": { - "type": "array", - "description": "The applied input type(s) for the category 'self-harm'.", - "items": { - "type": "string", - "enum": [ - "text", - "image" - ] - } - }, - "self-harm/intent": { - "type": "array", - "description": "The applied input type(s) for the category 'self-harm/intent'.", - "items": { - "type": "string", - "enum": [ - "text", - "image" - ] - } - }, - "self-harm/instructions": { - "type": "array", - "description": "The applied input type(s) for the category 'self-harm/instructions'.", - "items": { - "type": "string", - "enum": [ - "text", - "image" - ] - } - }, - "sexual": { - "type": "array", - "description": "The applied input type(s) for the category 'sexual'.", - "items": { - "type": "string", - "enum": [ - "text", - "image" - ] - } - }, - "sexual/minors": { - "type": "array", - "description": "The applied input type(s) for the category 'sexual/minors'.", - "items": { - "type": "string", - "enum": [ - "text" - ] - } - }, - "violence": { - "type": "array", - "description": "The applied input type(s) for the category 'violence'.", - "items": { - "type": "string", - "enum": [ - "text", - "image" - ] - } - }, - "violence/graphic": { - "type": "array", - "description": "The applied input type(s) for the category 'violence/graphic'.", - "items": { - "type": "string", - "enum": [ - "text", - "image" - ] - } - } - }, - "required": [ - "hate", - "hate/threatening", - "harassment", - "harassment/threatening", - "illicit", - "illicit/violent", - "self-harm", - "self-harm/intent", - "self-harm/instructions", - "sexual", - "sexual/minors", - "violence", - "violence/graphic" - ] - } - }, - "required": [ - "flagged", - "categories", - "category_scores", - "category_applied_input_types" - ] - } - } - }, - "required": [ - "id", - "model", - "results" - ], - "x-oaiMeta": { - "name": "The moderation object", - "example": "{\n \"id\": \"modr-0d9740456c391e43c445bf0f010940c7\",\n \"model\": \"omni-moderation-latest\",\n \"results\": [\n {\n \"flagged\": true,\n \"categories\": {\n \"harassment\": true,\n \"harassment/threatening\": true,\n \"sexual\": false,\n \"hate\": false,\n \"hate/threatening\": false,\n \"illicit\": false,\n \"illicit/violent\": false,\n \"self-harm/intent\": false,\n \"self-harm/instructions\": false,\n \"self-harm\": false,\n \"sexual/minors\": false,\n \"violence\": true,\n \"violence/graphic\": true\n },\n \"category_scores\": {\n \"harassment\": 0.8189693396524255,\n \"harassment/threatening\": 0.804985420696006,\n \"sexual\": 1.573112165348997e-6,\n \"hate\": 0.007562942636942845,\n \"hate/threatening\": 0.004208854591835476,\n \"illicit\": 0.030535955153511665,\n \"illicit/violent\": 0.008925306722380033,\n \"self-harm/intent\": 0.00023023930975076432,\n \"self-harm/instructions\": 0.0002293869201073356,\n \"self-harm\": 0.012598046106750154,\n \"sexual/minors\": 2.212566909570261e-8,\n \"violence\": 0.9999992735124786,\n \"violence/graphic\": 0.843064871157054\n },\n \"category_applied_input_types\": {\n \"harassment\": [\n \"text\"\n ],\n \"harassment/threatening\": [\n \"text\"\n ],\n \"sexual\": [\n \"text\",\n \"image\"\n ],\n \"hate\": [\n \"text\"\n ],\n \"hate/threatening\": [\n \"text\"\n ],\n \"illicit\": [\n \"text\"\n ],\n \"illicit/violent\": [\n \"text\"\n ],\n \"self-harm/intent\": [\n \"text\",\n \"image\"\n ],\n \"self-harm/instructions\": [\n \"text\",\n \"image\"\n ],\n \"self-harm\": [\n \"text\",\n \"image\"\n ],\n \"sexual/minors\": [\n \"text\"\n ],\n \"violence\": [\n \"text\",\n \"image\"\n ],\n \"violence/graphic\": [\n \"text\",\n \"image\"\n ]\n }\n }\n ]\n}\n" - } - }, - "ListFilesResponse": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/OpenAIFile" - } - }, - "object": { - "type": "string", - "enum": [ - "list" - ] - } - }, - "required": [ - "object", - "data" - ] - }, - "CreateFileRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "file": { - "description": "The File object (not file name) to be uploaded.\n", - "type": "string", - "format": "binary" - }, - "purpose": { - "description": "The intended purpose of the uploaded file.\n\nUse \"assistants\" for [Assistants](/docs/api-reference/assistants) and [Message](/docs/api-reference/messages) files, \"vision\" for Assistants image file inputs, \"batch\" for [Batch API](/docs/guides/batch), and \"fine-tune\" for [Fine-tuning](/docs/api-reference/fine-tuning).\n", - "type": "string", - "enum": [ - "assistants", - "batch", - "fine-tune", - "vision" - ] - } - }, - "required": [ - "file", - "purpose" - ] - }, - "DeleteFileResponse": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "object": { - "type": "string", - "enum": [ - "file" - ] - }, - "deleted": { - "type": "boolean" - } - }, - "required": [ - "id", - "object", - "deleted" - ] - }, - "CreateUploadRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "filename": { - "description": "The name of the file to upload.\n", - "type": "string" - }, - "purpose": { - "description": "The intended purpose of the uploaded file.\n\nSee the [documentation on File purposes](/docs/api-reference/files/create#files-create-purpose).\n", - "type": "string", - "enum": [ - "assistants", - "batch", - "fine-tune", - "vision" - ] - }, - "bytes": { - "description": "The number of bytes in the file you are uploading.\n", - "type": "integer" - }, - "mime_type": { - "description": "The MIME type of the file.\n\nThis must fall within the supported MIME types for your file purpose. See the supported MIME types for assistants and vision.\n", - "type": "string" - } - }, - "required": [ - "filename", - "purpose", - "bytes", - "mime_type" - ] - }, - "AddUploadPartRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "data": { - "description": "The chunk of bytes for this Part.\n", - "type": "string", - "format": "binary" - } - }, - "required": [ - "data" - ] - }, - "CompleteUploadRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "part_ids": { - "type": "array", - "description": "The ordered list of Part IDs.\n", - "items": { - "type": "string" - } - }, - "md5": { - "description": "The optional md5 checksum for the file contents to verify if the bytes uploaded matches what you expect.\n", - "type": "string" - } - }, - "required": [ - "part_ids" - ] - }, - "CancelUploadRequest": { - "type": "object", - "additionalProperties": false - }, - "CreateFineTuningJobRequest": { - "type": "object", - "properties": { - "model": { - "description": "The name of the model to fine-tune. You can select one of the\n[supported models](/docs/guides/fine-tuning/which-models-can-be-fine-tuned).\n", - "example": "gpt-4o-mini", - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "babbage-002", - "davinci-002", - "gpt-3.5-turbo", - "gpt-4o-mini" - ] - } - ], - "x-oaiTypeLabel": "string" - }, - "training_file": { - "description": "The ID of an uploaded file that contains training data.\n\nSee [upload file](/docs/api-reference/files/create) for how to upload a file.\n\nYour dataset must be formatted as a JSONL file. Additionally, you must upload your file with the purpose `fine-tune`.\n\nThe contents of the file should differ depending on if the model uses the [chat](/docs/api-reference/fine-tuning/chat-input) or [completions](/docs/api-reference/fine-tuning/completions-input) format.\n\nSee the [fine-tuning guide](/docs/guides/fine-tuning) for more details.\n", - "type": "string", - "example": "file-abc123" - }, - "hyperparameters": { - "type": "object", - "description": "The hyperparameters used for the fine-tuning job.", - "properties": { - "batch_size": { - "description": "Number of examples in each batch. A larger batch size means that model parameters\nare updated less frequently, but with lower variance.\n", - "oneOf": [ - { - "type": "string", - "enum": [ - "auto" - ] - }, - { - "type": "integer", - "minimum": 1, - "maximum": 256 - } - ], - "default": "auto" - }, - "learning_rate_multiplier": { - "description": "Scaling factor for the learning rate. A smaller learning rate may be useful to avoid\noverfitting.\n", - "oneOf": [ - { - "type": "string", - "enum": [ - "auto" - ] - }, - { - "type": "number", - "minimum": 0, - "exclusiveMinimum": true - } - ], - "default": "auto" - }, - "n_epochs": { - "description": "The number of epochs to train the model for. An epoch refers to one full cycle\nthrough the training dataset.\n", - "oneOf": [ - { - "type": "string", - "enum": [ - "auto" - ] - }, - { - "type": "integer", - "minimum": 1, - "maximum": 50 - } - ], - "default": "auto" - } - } - }, - "suffix": { - "description": "A string of up to 64 characters that will be added to your fine-tuned model name.\n\nFor example, a `suffix` of \"custom-model-name\" would produce a model name like `ft:gpt-4o-mini:openai:custom-model-name:7p4lURel`.\n", - "type": "string", - "minLength": 1, - "maxLength": 64, - "default": null, - "nullable": true - }, - "validation_file": { - "description": "The ID of an uploaded file that contains validation data.\n\nIf you provide this file, the data is used to generate validation\nmetrics periodically during fine-tuning. These metrics can be viewed in\nthe fine-tuning results file.\nThe same data should not be present in both train and validation files.\n\nYour dataset must be formatted as a JSONL file. You must upload your file with the purpose `fine-tune`.\n\nSee the [fine-tuning guide](/docs/guides/fine-tuning) for more details.\n", - "type": "string", - "nullable": true, - "example": "file-abc123" - }, - "integrations": { - "type": "array", - "description": "A list of integrations to enable for your fine-tuning job.", - "nullable": true, - "items": { - "type": "object", - "required": [ - "type", - "wandb" - ], - "properties": { - "type": { - "description": "The type of integration to enable. Currently, only \"wandb\" (Weights and Biases) is supported.\n", - "oneOf": [ - { - "type": "string", - "enum": [ - "wandb" - ] - } - ] - }, - "wandb": { - "type": "object", - "description": "The settings for your integration with Weights and Biases. This payload specifies the project that\nmetrics will be sent to. Optionally, you can set an explicit display name for your run, add tags\nto your run, and set a default entity (team, username, etc) to be associated with your run.\n", - "required": [ - "project" - ], - "properties": { - "project": { - "description": "The name of the project that the new run will be created under.\n", - "type": "string", - "example": "my-wandb-project" - }, - "name": { - "description": "A display name to set for the run. If not set, we will use the Job ID as the name.\n", - "nullable": true, - "type": "string" - }, - "entity": { - "description": "The entity to use for the run. This allows you to set the team or username of the WandB user that you would\nlike associated with the run. If not set, the default entity for the registered WandB API key is used.\n", - "nullable": true, - "type": "string" - }, - "tags": { - "description": "A list of tags to be attached to the newly created run. These tags are passed through directly to WandB. Some\ndefault tags are generated by OpenAI: \"openai/finetune\", \"openai/{base-model}\", \"openai/{ftjob-abcdef}\".\n", - "type": "array", - "items": { - "type": "string", - "example": "custom-tag" - } - } - } - } - } - } - }, - "seed": { - "description": "The seed controls the reproducibility of the job. Passing in the same seed and job parameters should produce the same results, but may differ in rare cases.\nIf a seed is not specified, one will be generated for you.\n", - "type": "integer", - "nullable": true, - "minimum": 0, - "maximum": 2147483647, - "example": 42 - } - }, - "required": [ - "model", - "training_file" - ] - }, - "ListFineTuningJobEventsResponse": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FineTuningJobEvent" - } - }, - "object": { - "type": "string", - "enum": [ - "list" - ] - } - }, - "required": [ - "object", - "data" - ] - }, - "ListFineTuningJobCheckpointsResponse": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FineTuningJobCheckpoint" - } - }, - "object": { - "type": "string", - "enum": [ - "list" - ] - }, - "first_id": { - "type": "string", - "nullable": true - }, - "last_id": { - "type": "string", - "nullable": true - }, - "has_more": { - "type": "boolean" - } - }, - "required": [ - "object", - "data", - "has_more" - ] - }, - "CreateEmbeddingRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "input": { - "description": "Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for `text-embedding-ada-002`), cannot be an empty string, and any array must be 2048 dimensions or less. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens.\n", - "example": "The quick brown fox jumped over the lazy dog", - "oneOf": [ - { - "type": "string", - "title": "string", - "description": "The string that will be turned into an embedding.", - "default": "", - "example": "This is a test." - }, - { - "type": "array", - "title": "array", - "description": "The array of strings that will be turned into an embedding.", - "minItems": 1, - "maxItems": 2048, - "items": { - "type": "string", - "default": "", - "example": "['This is a test.']" - } - }, - { - "type": "array", - "title": "array", - "description": "The array of integers that will be turned into an embedding.", - "minItems": 1, - "maxItems": 2048, - "items": { - "type": "integer" - }, - "example": "[1212, 318, 257, 1332, 13]" - }, - { - "type": "array", - "title": "array", - "description": "The array of arrays containing integers that will be turned into an embedding.", - "minItems": 1, - "maxItems": 2048, - "items": { - "type": "array", - "minItems": 1, - "items": { - "type": "integer" - } - }, - "example": "[[1212, 318, 257, 1332, 13]]" - } - ], - "x-oaiExpandable": true - }, - "model": { - "description": "ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them.\n", - "example": "text-embedding-3-small", - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "text-embedding-ada-002", - "text-embedding-3-small", - "text-embedding-3-large" - ] - } - ], - "x-oaiTypeLabel": "string" - }, - "encoding_format": { - "description": "The format to return the embeddings in. Can be either `float` or [`base64`](https://pypi.org/project/pybase64/).", - "example": "float", - "default": "float", - "type": "string", - "enum": [ - "float", - "base64" - ] - }, - "dimensions": { - "description": "The number of dimensions the resulting output embeddings should have. Only supported in `text-embedding-3` and later models.\n", - "type": "integer", - "minimum": 1 - }, - "user": { - "type": "string", - "example": "user-1234", - "description": "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).\n" - } - }, - "required": [ - "model", - "input" - ] - }, - "CreateEmbeddingResponse": { - "type": "object", - "properties": { - "data": { - "type": "array", - "description": "The list of embeddings generated by the model.", - "items": { - "$ref": "#/components/schemas/Embedding" - } - }, - "model": { - "type": "string", - "description": "The name of the model used to generate the embedding." - }, - "object": { - "type": "string", - "description": "The object type, which is always \"list\".", - "enum": [ - "list" - ] - }, - "usage": { - "type": "object", - "description": "The usage information for the request.", - "properties": { - "prompt_tokens": { - "type": "integer", - "description": "The number of tokens used by the prompt." - }, - "total_tokens": { - "type": "integer", - "description": "The total number of tokens used by the request." - } - }, - "required": [ - "prompt_tokens", - "total_tokens" - ] - } - }, - "required": [ - "object", - "model", - "data", - "usage" - ] - }, - "CreateTranscriptionRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "file": { - "description": "The audio file object (not file name) to transcribe, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.\n", - "type": "string", - "x-oaiTypeLabel": "file", - "format": "binary" - }, - "model": { - "description": "ID of the model to use. Only `whisper-1` (which is powered by our open source Whisper V2 model) is currently available.\n", - "example": "whisper-1", - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "whisper-1" - ] - } - ], - "x-oaiTypeLabel": "string" - }, - "language": { - "description": "The language of the input audio. Supplying the input language in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format will improve accuracy and latency.\n", - "type": "string" - }, - "prompt": { - "description": "An optional text to guide the model's style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text/prompting) should match the audio language.\n", - "type": "string" - }, - "response_format": { - "$ref": "#/components/schemas/AudioResponseFormat" - }, - "temperature": { - "description": "The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit.\n", - "type": "number", - "default": 0 - }, - "timestamp_granularities[]": { - "description": "The timestamp granularities to populate for this transcription. `response_format` must be set `verbose_json` to use timestamp granularities. Either or both of these options are supported: `word`, or `segment`. Note: There is no additional latency for segment timestamps, but generating word timestamps incurs additional latency.\n", - "type": "array", - "items": { - "type": "string", - "enum": [ - "word", - "segment" - ] - }, - "default": [ - "segment" - ] - } - }, - "required": [ - "file", - "model" - ] - }, - "CreateTranscriptionResponseJson": { - "type": "object", - "description": "Represents a transcription response returned by model, based on the provided input.", - "properties": { - "text": { - "type": "string", - "description": "The transcribed text." - } - }, - "required": [ - "text" - ], - "x-oaiMeta": { - "name": "The transcription object (JSON)", - "group": "audio", - "example": "{\n \"text\": \"Imagine the wildest idea that you've ever had, and you're curious about how it might scale to something that's a 100, a 1,000 times bigger. This is a place where you can get to do that.\"\n}\n" - } - }, - "TranscriptionSegment": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "description": "Unique identifier of the segment." - }, - "seek": { - "type": "integer", - "description": "Seek offset of the segment." - }, - "start": { - "type": "number", - "format": "float", - "description": "Start time of the segment in seconds." - }, - "end": { - "type": "number", - "format": "float", - "description": "End time of the segment in seconds." - }, - "text": { - "type": "string", - "description": "Text content of the segment." - }, - "tokens": { - "type": "array", - "items": { - "type": "integer" - }, - "description": "Array of token IDs for the text content." - }, - "temperature": { - "type": "number", - "format": "float", - "description": "Temperature parameter used for generating the segment." - }, - "avg_logprob": { - "type": "number", - "format": "float", - "description": "Average logprob of the segment. If the value is lower than -1, consider the logprobs failed." - }, - "compression_ratio": { - "type": "number", - "format": "float", - "description": "Compression ratio of the segment. If the value is greater than 2.4, consider the compression failed." - }, - "no_speech_prob": { - "type": "number", - "format": "float", - "description": "Probability of no speech in the segment. If the value is higher than 1.0 and the `avg_logprob` is below -1, consider this segment silent." - } - }, - "required": [ - "id", - "seek", - "start", - "end", - "text", - "tokens", - "temperature", - "avg_logprob", - "compression_ratio", - "no_speech_prob" - ] - }, - "TranscriptionWord": { - "type": "object", - "properties": { - "word": { - "type": "string", - "description": "The text content of the word." - }, - "start": { - "type": "number", - "format": "float", - "description": "Start time of the word in seconds." - }, - "end": { - "type": "number", - "format": "float", - "description": "End time of the word in seconds." - } - }, - "required": [ - "word", - "start", - "end" - ] - }, - "CreateTranscriptionResponseVerboseJson": { - "type": "object", - "description": "Represents a verbose json transcription response returned by model, based on the provided input.", - "properties": { - "language": { - "type": "string", - "description": "The language of the input audio." - }, - "duration": { - "type": "string", - "description": "The duration of the input audio." - }, - "text": { - "type": "string", - "description": "The transcribed text." - }, - "words": { - "type": "array", - "description": "Extracted words and their corresponding timestamps.", - "items": { - "$ref": "#/components/schemas/TranscriptionWord" - } - }, - "segments": { - "type": "array", - "description": "Segments of the transcribed text and their corresponding details.", - "items": { - "$ref": "#/components/schemas/TranscriptionSegment" - } - } - }, - "required": [ - "language", - "duration", - "text" - ], - "x-oaiMeta": { - "name": "The transcription object (Verbose JSON)", - "group": "audio", - "example": "{\n \"task\": \"transcribe\",\n \"language\": \"english\",\n \"duration\": 8.470000267028809,\n \"text\": \"The beach was a popular spot on a hot summer day. People were swimming in the ocean, building sandcastles, and playing beach volleyball.\",\n \"segments\": [\n {\n \"id\": 0,\n \"seek\": 0,\n \"start\": 0.0,\n \"end\": 3.319999933242798,\n \"text\": \" The beach was a popular spot on a hot summer day.\",\n \"tokens\": [\n 50364, 440, 7534, 390, 257, 3743, 4008, 322, 257, 2368, 4266, 786, 13, 50530\n ],\n \"temperature\": 0.0,\n \"avg_logprob\": -0.2860786020755768,\n \"compression_ratio\": 1.2363636493682861,\n \"no_speech_prob\": 0.00985979475080967\n },\n ...\n ]\n}\n" - } - }, - "AudioResponseFormat": { - "description": "The format of the output, in one of these options: `json`, `text`, `srt`, `verbose_json`, or `vtt`.\n", - "type": "string", - "enum": [ - "json", - "text", - "srt", - "verbose_json", - "vtt" - ], - "default": "json" - }, - "CreateTranslationRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "file": { - "description": "The audio file object (not file name) translate, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.\n", - "type": "string", - "x-oaiTypeLabel": "file", - "format": "binary" - }, - "model": { - "description": "ID of the model to use. Only `whisper-1` (which is powered by our open source Whisper V2 model) is currently available.\n", - "example": "whisper-1", - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "whisper-1" - ] - } - ], - "x-oaiTypeLabel": "string" - }, - "prompt": { - "description": "An optional text to guide the model's style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text/prompting) should be in English.\n", - "type": "string" - }, - "response_format": { - "$ref": "#/components/schemas/AudioResponseFormat" - }, - "temperature": { - "description": "The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit.\n", - "type": "number", - "default": 0 - } - }, - "required": [ - "file", - "model" - ] - }, - "CreateTranslationResponseJson": { - "type": "object", - "properties": { - "text": { - "type": "string" - } - }, - "required": [ - "text" - ] - }, - "CreateTranslationResponseVerboseJson": { - "type": "object", - "properties": { - "language": { - "type": "string", - "description": "The language of the output translation (always `english`)." - }, - "duration": { - "type": "string", - "description": "The duration of the input audio." - }, - "text": { - "type": "string", - "description": "The translated text." - }, - "segments": { - "type": "array", - "description": "Segments of the translated text and their corresponding details.", - "items": { - "$ref": "#/components/schemas/TranscriptionSegment" - } - } - }, - "required": [ - "language", - "duration", - "text" - ] - }, - "CreateSpeechRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "model": { - "description": "One of the available [TTS models](/docs/models/tts): `tts-1` or `tts-1-hd`\n", - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "tts-1", - "tts-1-hd" - ] - } - ], - "x-oaiTypeLabel": "string" - }, - "input": { - "type": "string", - "description": "The text to generate audio for. The maximum length is 4096 characters.", - "maxLength": 4096 - }, - "voice": { - "description": "The voice to use when generating the audio. Supported voices are `alloy`, `echo`, `fable`, `onyx`, `nova`, and `shimmer`. Previews of the voices are available in the [Text to speech guide](/docs/guides/text-to-speech/voice-options).", - "type": "string", - "enum": [ - "alloy", - "echo", - "fable", - "onyx", - "nova", - "shimmer" - ] - }, - "response_format": { - "description": "The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, `wav`, and `pcm`.", - "default": "mp3", - "type": "string", - "enum": [ - "mp3", - "opus", - "aac", - "flac", - "wav", - "pcm" - ] - }, - "speed": { - "description": "The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is the default.", - "type": "number", - "default": 1, - "minimum": 0.25, - "maximum": 4 - } - }, - "required": [ - "model", - "input", - "voice" - ] - }, - "Model": { - "title": "Model", - "description": "Describes an OpenAI model offering that can be used with the API.", - "properties": { - "id": { - "type": "string", - "description": "The model identifier, which can be referenced in the API endpoints." - }, - "created": { - "type": "integer", - "description": "The Unix timestamp (in seconds) when the model was created." - }, - "object": { - "type": "string", - "description": "The object type, which is always \"model\".", - "enum": [ - "model" - ] - }, - "owned_by": { - "type": "string", - "description": "The organization that owns the model." - } - }, - "required": [ - "id", - "object", - "created", - "owned_by" - ], - "x-oaiMeta": { - "name": "The model object", - "example": "{\n \"id\": \"VAR_model_id\",\n \"object\": \"model\",\n \"created\": 1686935002,\n \"owned_by\": \"openai\"\n}\n" - } - }, - "OpenAIFile": { - "title": "OpenAIFile", - "description": "The `File` object represents a document that has been uploaded to OpenAI.", - "properties": { - "id": { - "type": "string", - "description": "The file identifier, which can be referenced in the API endpoints." - }, - "bytes": { - "type": "integer", - "description": "The size of the file, in bytes." - }, - "created_at": { - "type": "integer", - "description": "The Unix timestamp (in seconds) for when the file was created." - }, - "filename": { - "type": "string", - "description": "The name of the file." - }, - "object": { - "type": "string", - "description": "The object type, which is always `file`.", - "enum": [ - "file" - ] - }, - "purpose": { - "type": "string", - "description": "The intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results` and `vision`.", - "enum": [ - "assistants", - "assistants_output", - "batch", - "batch_output", - "fine-tune", - "fine-tune-results", - "vision" - ] - }, - "status": { - "type": "string", - "deprecated": true, - "description": "Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`.", - "enum": [ - "uploaded", - "processed", - "error" - ] - }, - "status_details": { - "type": "string", - "deprecated": true, - "description": "Deprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`." - } - }, - "required": [ - "id", - "object", - "bytes", - "created_at", - "filename", - "purpose", - "status" - ], - "x-oaiMeta": { - "name": "The file object", - "example": "{\n \"id\": \"file-abc123\",\n \"object\": \"file\",\n \"bytes\": 120000,\n \"created_at\": 1677610602,\n \"filename\": \"salesOverview.pdf\",\n \"purpose\": \"assistants\",\n}\n" - } - }, - "Upload": { - "type": "object", - "title": "Upload", - "description": "The Upload object can accept byte chunks in the form of Parts.\n", - "properties": { - "id": { - "type": "string", - "description": "The Upload unique identifier, which can be referenced in API endpoints." - }, - "created_at": { - "type": "integer", - "description": "The Unix timestamp (in seconds) for when the Upload was created." - }, - "filename": { - "type": "string", - "description": "The name of the file to be uploaded." - }, - "bytes": { - "type": "integer", - "description": "The intended number of bytes to be uploaded." - }, - "purpose": { - "type": "string", - "description": "The intended purpose of the file. [Please refer here](/docs/api-reference/files/object#files/object-purpose) for acceptable values." - }, - "status": { - "type": "string", - "description": "The status of the Upload.", - "enum": [ - "pending", - "completed", - "cancelled", - "expired" - ] - }, - "expires_at": { - "type": "integer", - "description": "The Unix timestamp (in seconds) for when the Upload was created." - }, - "object": { - "type": "string", - "description": "The object type, which is always \"upload\".", - "enum": [ - "upload" - ] - }, - "file": { - "$ref": "#/components/schemas/OpenAIFile", - "nullable": true, - "description": "The ready File object after the Upload is completed." - } - }, - "required": [ - "bytes", - "created_at", - "expires_at", - "filename", - "id", - "purpose", - "status", - "step_number" - ], - "x-oaiMeta": { - "name": "The upload object", - "example": "{\n \"id\": \"upload_abc123\",\n \"object\": \"upload\",\n \"bytes\": 2147483648,\n \"created_at\": 1719184911,\n \"filename\": \"training_examples.jsonl\",\n \"purpose\": \"fine-tune\",\n \"status\": \"completed\",\n \"expires_at\": 1719127296,\n \"file\": {\n \"id\": \"file-xyz321\",\n \"object\": \"file\",\n \"bytes\": 2147483648,\n \"created_at\": 1719186911,\n \"filename\": \"training_examples.jsonl\",\n \"purpose\": \"fine-tune\",\n }\n}\n" - } - }, - "UploadPart": { - "type": "object", - "title": "UploadPart", - "description": "The upload Part represents a chunk of bytes we can add to an Upload object.\n", - "properties": { - "id": { - "type": "string", - "description": "The upload Part unique identifier, which can be referenced in API endpoints." - }, - "created_at": { - "type": "integer", - "description": "The Unix timestamp (in seconds) for when the Part was created." - }, - "upload_id": { - "type": "string", - "description": "The ID of the Upload object that this Part was added to." - }, - "object": { - "type": "string", - "description": "The object type, which is always `upload.part`.", - "enum": [ - "upload.part" - ] - } - }, - "required": [ - "created_at", - "id", - "object", - "upload_id" - ], - "x-oaiMeta": { - "name": "The upload part object", - "example": "{\n \"id\": \"part_def456\",\n \"object\": \"upload.part\",\n \"created_at\": 1719186911,\n \"upload_id\": \"upload_abc123\"\n}\n" - } - }, - "Embedding": { - "type": "object", - "description": "Represents an embedding vector returned by embedding endpoint.\n", - "properties": { - "index": { - "type": "integer", - "description": "The index of the embedding in the list of embeddings." - }, - "embedding": { - "type": "array", - "description": "The embedding vector, which is a list of floats. The length of vector depends on the model as listed in the [embedding guide](/docs/guides/embeddings).\n", - "items": { - "type": "number" - } - }, - "object": { - "type": "string", - "description": "The object type, which is always \"embedding\".", - "enum": [ - "embedding" - ] - } - }, - "required": [ - "index", - "object", - "embedding" - ], - "x-oaiMeta": { - "name": "The embedding object", - "example": "{\n \"object\": \"embedding\",\n \"embedding\": [\n 0.0023064255,\n -0.009327292,\n .... (1536 floats total for ada-002)\n -0.0028842222,\n ],\n \"index\": 0\n}\n" - } - }, - "FineTuningJob": { - "type": "object", - "title": "FineTuningJob", - "description": "The `fine_tuning.job` object represents a fine-tuning job that has been created through the API.\n", - "properties": { - "id": { - "type": "string", - "description": "The object identifier, which can be referenced in the API endpoints." - }, - "created_at": { - "type": "integer", - "description": "The Unix timestamp (in seconds) for when the fine-tuning job was created." - }, - "error": { - "type": "object", - "nullable": true, - "description": "For fine-tuning jobs that have `failed`, this will contain more information on the cause of the failure.", - "properties": { - "code": { - "type": "string", - "description": "A machine-readable error code." - }, - "message": { - "type": "string", - "description": "A human-readable error message." - }, - "param": { - "type": "string", - "description": "The parameter that was invalid, usually `training_file` or `validation_file`. This field will be null if the failure was not parameter-specific.", - "nullable": true - } - }, - "required": [ - "code", - "message", - "param" - ] - }, - "fine_tuned_model": { - "type": "string", - "nullable": true, - "description": "The name of the fine-tuned model that is being created. The value will be null if the fine-tuning job is still running." - }, - "finished_at": { - "type": "integer", - "nullable": true, - "description": "The Unix timestamp (in seconds) for when the fine-tuning job was finished. The value will be null if the fine-tuning job is still running." - }, - "hyperparameters": { - "type": "object", - "description": "The hyperparameters used for the fine-tuning job. See the [fine-tuning guide](/docs/guides/fine-tuning) for more details.", - "properties": { - "n_epochs": { - "oneOf": [ - { - "type": "string", - "enum": [ - "auto" - ] - }, - { - "type": "integer", - "minimum": 1, - "maximum": 50 - } - ], - "default": "auto", - "description": "The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.\n\"auto\" decides the optimal number of epochs based on the size of the dataset. If setting the number manually, we support any number between 1 and 50 epochs." - } - }, - "required": [ - "n_epochs" - ] - }, - "model": { - "type": "string", - "description": "The base model that is being fine-tuned." - }, - "object": { - "type": "string", - "description": "The object type, which is always \"fine_tuning.job\".", - "enum": [ - "fine_tuning.job" - ] - }, - "organization_id": { - "type": "string", - "description": "The organization that owns the fine-tuning job." - }, - "result_files": { - "type": "array", - "description": "The compiled results file ID(s) for the fine-tuning job. You can retrieve the results with the [Files API](/docs/api-reference/files/retrieve-contents).", - "items": { - "type": "string", - "example": "file-abc123" - } - }, - "status": { - "type": "string", - "description": "The current status of the fine-tuning job, which can be either `validating_files`, `queued`, `running`, `succeeded`, `failed`, or `cancelled`.", - "enum": [ - "validating_files", - "queued", - "running", - "succeeded", - "failed", - "cancelled" - ] - }, - "trained_tokens": { - "type": "integer", - "nullable": true, - "description": "The total number of billable tokens processed by this fine-tuning job. The value will be null if the fine-tuning job is still running." - }, - "training_file": { - "type": "string", - "description": "The file ID used for training. You can retrieve the training data with the [Files API](/docs/api-reference/files/retrieve-contents)." - }, - "validation_file": { - "type": "string", - "nullable": true, - "description": "The file ID used for validation. You can retrieve the validation results with the [Files API](/docs/api-reference/files/retrieve-contents)." - }, - "integrations": { - "type": "array", - "nullable": true, - "description": "A list of integrations to enable for this fine-tuning job.", - "maxItems": 5, - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/FineTuningIntegration" - } - ], - "x-oaiExpandable": true - } - }, - "seed": { - "type": "integer", - "description": "The seed used for the fine-tuning job." - }, - "estimated_finish": { - "type": "integer", - "nullable": true, - "description": "The Unix timestamp (in seconds) for when the fine-tuning job is estimated to finish. The value will be null if the fine-tuning job is not running." - } - }, - "required": [ - "created_at", - "error", - "finished_at", - "fine_tuned_model", - "hyperparameters", - "id", - "model", - "object", - "organization_id", - "result_files", - "status", - "trained_tokens", - "training_file", - "validation_file", - "seed" - ], - "x-oaiMeta": { - "name": "The fine-tuning job object", - "example": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"davinci-002\",\n \"created_at\": 1692661014,\n \"finished_at\": 1692661190,\n \"fine_tuned_model\": \"ft:davinci-002:my-org:custom_suffix:7q8mpxmy\",\n \"organization_id\": \"org-123\",\n \"result_files\": [\n \"file-abc123\"\n ],\n \"status\": \"succeeded\",\n \"validation_file\": null,\n \"training_file\": \"file-abc123\",\n \"hyperparameters\": {\n \"n_epochs\": 4,\n \"batch_size\": 1,\n \"learning_rate_multiplier\": 1.0\n },\n \"trained_tokens\": 5768,\n \"integrations\": [],\n \"seed\": 0,\n \"estimated_finish\": 0\n}\n" - } - }, - "FineTuningIntegration": { - "type": "object", - "title": "Fine-Tuning Job Integration", - "required": [ - "type", - "wandb" - ], - "properties": { - "type": { - "type": "string", - "description": "The type of the integration being enabled for the fine-tuning job", - "enum": [ - "wandb" - ] - }, - "wandb": { - "type": "object", - "description": "The settings for your integration with Weights and Biases. This payload specifies the project that\nmetrics will be sent to. Optionally, you can set an explicit display name for your run, add tags\nto your run, and set a default entity (team, username, etc) to be associated with your run.\n", - "required": [ - "project" - ], - "properties": { - "project": { - "description": "The name of the project that the new run will be created under.\n", - "type": "string", - "example": "my-wandb-project" - }, - "name": { - "description": "A display name to set for the run. If not set, we will use the Job ID as the name.\n", - "nullable": true, - "type": "string" - }, - "entity": { - "description": "The entity to use for the run. This allows you to set the team or username of the WandB user that you would\nlike associated with the run. If not set, the default entity for the registered WandB API key is used.\n", - "nullable": true, - "type": "string" - }, - "tags": { - "description": "A list of tags to be attached to the newly created run. These tags are passed through directly to WandB. Some\ndefault tags are generated by OpenAI: \"openai/finetune\", \"openai/{base-model}\", \"openai/{ftjob-abcdef}\".\n", - "type": "array", - "items": { - "type": "string", - "example": "custom-tag" - } - } - } - } - } - }, - "FineTuningJobEvent": { - "type": "object", - "description": "Fine-tuning job event object", - "properties": { - "id": { - "type": "string" - }, - "created_at": { - "type": "integer" - }, - "level": { - "type": "string", - "enum": [ - "info", - "warn", - "error" - ] - }, - "message": { - "type": "string" - }, - "object": { - "type": "string", - "enum": [ - "fine_tuning.job.event" - ] - } - }, - "required": [ - "id", - "object", - "created_at", - "level", - "message" - ], - "x-oaiMeta": { - "name": "The fine-tuning job event object", - "example": "{\n \"object\": \"fine_tuning.job.event\",\n \"id\": \"ftevent-abc123\"\n \"created_at\": 1677610602,\n \"level\": \"info\",\n \"message\": \"Created fine-tuning job\"\n}\n" - } - }, - "FineTuningJobCheckpoint": { - "type": "object", - "title": "FineTuningJobCheckpoint", - "description": "The `fine_tuning.job.checkpoint` object represents a model checkpoint for a fine-tuning job that is ready to use.\n", - "properties": { - "id": { - "type": "string", - "description": "The checkpoint identifier, which can be referenced in the API endpoints." - }, - "created_at": { - "type": "integer", - "description": "The Unix timestamp (in seconds) for when the checkpoint was created." - }, - "fine_tuned_model_checkpoint": { - "type": "string", - "description": "The name of the fine-tuned checkpoint model that is created." - }, - "step_number": { - "type": "integer", - "description": "The step number that the checkpoint was created at." - }, - "metrics": { - "type": "object", - "description": "Metrics at the step number during the fine-tuning job.", - "properties": { - "step": { - "type": "number" - }, - "train_loss": { - "type": "number" - }, - "train_mean_token_accuracy": { - "type": "number" - }, - "valid_loss": { - "type": "number" - }, - "valid_mean_token_accuracy": { - "type": "number" - }, - "full_valid_loss": { - "type": "number" - }, - "full_valid_mean_token_accuracy": { - "type": "number" - } - } - }, - "fine_tuning_job_id": { - "type": "string", - "description": "The name of the fine-tuning job that this checkpoint was created from." - }, - "object": { - "type": "string", - "description": "The object type, which is always \"fine_tuning.job.checkpoint\".", - "enum": [ - "fine_tuning.job.checkpoint" - ] - } - }, - "required": [ - "created_at", - "fine_tuning_job_id", - "fine_tuned_model_checkpoint", - "id", - "metrics", - "object", - "step_number" - ], - "x-oaiMeta": { - "name": "The fine-tuning job checkpoint object", - "example": "{\n \"object\": \"fine_tuning.job.checkpoint\",\n \"id\": \"ftckpt_qtZ5Gyk4BLq1SfLFWp3RtO3P\",\n \"created_at\": 1712211699,\n \"fine_tuned_model_checkpoint\": \"ft:gpt-4o-mini-2024-07-18:my-org:custom_suffix:9ABel2dg:ckpt-step-88\",\n \"fine_tuning_job_id\": \"ftjob-fpbNQ3H1GrMehXRf8cO97xTN\",\n \"metrics\": {\n \"step\": 88,\n \"train_loss\": 0.478,\n \"train_mean_token_accuracy\": 0.924,\n \"valid_loss\": 10.112,\n \"valid_mean_token_accuracy\": 0.145,\n \"full_valid_loss\": 0.567,\n \"full_valid_mean_token_accuracy\": 0.944\n },\n \"step_number\": 88\n}\n" - } - }, - "FinetuneChatRequestInput": { - "type": "object", - "description": "The per-line training example of a fine-tuning input file for chat models", - "properties": { - "messages": { - "type": "array", - "minItems": 1, - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/ChatCompletionRequestSystemMessage" - }, - { - "$ref": "#/components/schemas/ChatCompletionRequestUserMessage" - }, - { - "$ref": "#/components/schemas/FineTuneChatCompletionRequestAssistantMessage" - }, - { - "$ref": "#/components/schemas/ChatCompletionRequestToolMessage" - }, - { - "$ref": "#/components/schemas/ChatCompletionRequestFunctionMessage" - } - ], - "x-oaiExpandable": true - } - }, - "tools": { - "type": "array", - "description": "A list of tools the model may generate JSON inputs for.", - "items": { - "$ref": "#/components/schemas/ChatCompletionTool" - } - }, - "parallel_tool_calls": { - "$ref": "#/components/schemas/ParallelToolCalls" - }, - "functions": { - "deprecated": true, - "description": "A list of functions the model may generate JSON inputs for.", - "type": "array", - "minItems": 1, - "maxItems": 128, - "items": { - "$ref": "#/components/schemas/ChatCompletionFunctions" - } - } - }, - "x-oaiMeta": { - "name": "Training format for chat models", - "example": "{\n \"messages\": [\n { \"role\": \"user\", \"content\": \"What is the weather in San Francisco?\" },\n {\n \"role\": \"assistant\",\n \"tool_calls\": [\n {\n \"id\": \"call_id\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"arguments\": \"{\\\"location\\\": \\\"San Francisco, USA\\\", \\\"format\\\": \\\"celsius\\\"}\"\n }\n }\n ]\n }\n ],\n \"parallel_tool_calls\": false,\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and country, eg. San Francisco, USA\"\n },\n \"format\": { \"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"] }\n },\n \"required\": [\"location\", \"format\"]\n }\n }\n }\n ]\n}\n" - } - }, - "FinetuneCompletionRequestInput": { - "type": "object", - "description": "The per-line training example of a fine-tuning input file for completions models", - "properties": { - "prompt": { - "type": "string", - "description": "The input prompt for this training example." - }, - "completion": { - "type": "string", - "description": "The desired completion for this training example." - } - }, - "x-oaiMeta": { - "name": "Training format for completions models", - "example": "{\n \"prompt\": \"What is the answer to 2+2\",\n \"completion\": \"4\"\n}\n" - } - }, - "CompletionUsage": { - "type": "object", - "description": "Usage statistics for the completion request.", - "properties": { - "completion_tokens": { - "type": "integer", - "description": "Number of tokens in the generated completion." - }, - "prompt_tokens": { - "type": "integer", - "description": "Number of tokens in the prompt." - }, - "total_tokens": { - "type": "integer", - "description": "Total number of tokens used in the request (prompt + completion)." - }, - "completion_tokens_details": { - "type": "object", - "description": "Breakdown of tokens used in a completion.", - "properties": { - "reasoning_tokens": { - "type": "integer", - "description": "Tokens generated by the model for reasoning." - } - } - } - }, - "required": [ - "prompt_tokens", - "completion_tokens", - "total_tokens" - ] - }, - "RunCompletionUsage": { - "type": "object", - "description": "Usage statistics related to the run. This value will be `null` if the run is not in a terminal state (i.e. `in_progress`, `queued`, etc.).", - "properties": { - "completion_tokens": { - "type": "integer", - "description": "Number of completion tokens used over the course of the run." - }, - "prompt_tokens": { - "type": "integer", - "description": "Number of prompt tokens used over the course of the run." - }, - "total_tokens": { - "type": "integer", - "description": "Total number of tokens used (prompt + completion)." - } - }, - "required": [ - "prompt_tokens", - "completion_tokens", - "total_tokens" - ], - "nullable": true - }, - "RunStepCompletionUsage": { - "type": "object", - "description": "Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`.", - "properties": { - "completion_tokens": { - "type": "integer", - "description": "Number of completion tokens used over the course of the run step." - }, - "prompt_tokens": { - "type": "integer", - "description": "Number of prompt tokens used over the course of the run step." - }, - "total_tokens": { - "type": "integer", - "description": "Total number of tokens used (prompt + completion)." - } - }, - "required": [ - "prompt_tokens", - "completion_tokens", - "total_tokens" - ], - "nullable": true - }, - "AssistantsApiResponseFormatOption": { - "description": "Specifies the format that the model must output. Compatible with [GPT-4o](/docs/models/gpt-4o), [GPT-4 Turbo](/docs/models/gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.\n\nSetting to `{ \"type\": \"json_schema\", \"json_schema\": {...} }` enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the [Structured Outputs guide](/docs/guides/structured-outputs).\n\nSetting to `{ \"type\": \"json_object\" }` enables JSON mode, which ensures the message the model generates is valid JSON.\n\n**Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly \"stuck\" request. Also note that the message content may be partially cut off if `finish_reason=\"length\"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length.\n", - "oneOf": [ - { - "type": "string", - "description": "`auto` is the default value\n", - "enum": [ - "auto" - ] - }, - { - "$ref": "#/components/schemas/ResponseFormatText" - }, - { - "$ref": "#/components/schemas/ResponseFormatJsonObject" - }, - { - "$ref": "#/components/schemas/ResponseFormatJsonSchema" - } - ], - "x-oaiExpandable": true - }, - "AssistantObject": { - "type": "object", - "title": "Assistant", - "description": "Represents an `assistant` that can call the model and use tools.", - "properties": { - "id": { - "description": "The identifier, which can be referenced in API endpoints.", - "type": "string" - }, - "object": { - "description": "The object type, which is always `assistant`.", - "type": "string", - "enum": [ - "assistant" - ] - }, - "created_at": { - "description": "The Unix timestamp (in seconds) for when the assistant was created.", - "type": "integer" - }, - "name": { - "description": "The name of the assistant. The maximum length is 256 characters.\n", - "type": "string", - "maxLength": 256, - "nullable": true - }, - "description": { - "description": "The description of the assistant. The maximum length is 512 characters.\n", - "type": "string", - "maxLength": 512, - "nullable": true - }, - "model": { - "description": "ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them.\n", - "type": "string" - }, - "instructions": { - "description": "The system instructions that the assistant uses. The maximum length is 256,000 characters.\n", - "type": "string", - "maxLength": 256000, - "nullable": true - }, - "tools": { - "description": "A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.\n", - "default": [], - "type": "array", - "maxItems": 128, - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/AssistantToolsCode" - }, - { - "$ref": "#/components/schemas/AssistantToolsFileSearch" - }, - { - "$ref": "#/components/schemas/AssistantToolsFunction" - } - ], - "x-oaiExpandable": true - } - }, - "tool_resources": { - "type": "object", - "description": "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n", - "properties": { - "code_interpreter": { - "type": "object", - "properties": { - "file_ids": { - "type": "array", - "description": "A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter`` tool. There can be a maximum of 20 files associated with the tool.\n", - "default": [], - "maxItems": 20, - "items": { - "type": "string" - } - } - } - }, - "file_search": { - "type": "object", - "properties": { - "vector_store_ids": { - "type": "array", - "description": "The ID of the [vector store](/docs/api-reference/vector-stores/object) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n", - "maxItems": 1, - "items": { - "type": "string" - } - } - } - } - }, - "nullable": true - }, - "metadata": { - "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", - "type": "object", - "x-oaiTypeLabel": "map", - "nullable": true - }, - "temperature": { - "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n", - "type": "number", - "minimum": 0, - "maximum": 2, - "default": 1, - "example": 1, - "nullable": true - }, - "top_p": { - "type": "number", - "minimum": 0, - "maximum": 1, - "default": 1, - "example": 1, - "nullable": true, - "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.\n" - }, - "response_format": { - "$ref": "#/components/schemas/AssistantsApiResponseFormatOption", - "nullable": true - } - }, - "required": [ - "id", - "object", - "created_at", - "name", - "description", - "model", - "instructions", - "tools", - "metadata" - ], - "x-oaiMeta": { - "name": "The assistant object", - "beta": true, - "example": "{\n \"id\": \"asst_abc123\",\n \"object\": \"assistant\",\n \"created_at\": 1698984975,\n \"name\": \"Math Tutor\",\n \"description\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": \"You are a personal math tutor. When asked a question, write and run Python code to answer the question.\",\n \"tools\": [\n {\n \"type\": \"code_interpreter\"\n }\n ],\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n}\n" - } - }, - "CreateAssistantRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "model": { - "description": "ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them.\n", - "example": "gpt-4o", - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "gpt-4o", - "gpt-4o-2024-08-06", - "gpt-4o-2024-05-13", - "gpt-4o-2024-08-06", - "gpt-4o-mini", - "gpt-4o-mini-2024-07-18", - "gpt-4-turbo", - "gpt-4-turbo-2024-04-09", - "gpt-4-0125-preview", - "gpt-4-turbo-preview", - "gpt-4-1106-preview", - "gpt-4-vision-preview", - "gpt-4", - "gpt-4-0314", - "gpt-4-0613", - "gpt-4-32k", - "gpt-4-32k-0314", - "gpt-4-32k-0613", - "gpt-3.5-turbo", - "gpt-3.5-turbo-16k", - "gpt-3.5-turbo-0613", - "gpt-3.5-turbo-1106", - "gpt-3.5-turbo-0125", - "gpt-3.5-turbo-16k-0613" - ] - } - ], - "x-oaiTypeLabel": "string" - }, - "name": { - "description": "The name of the assistant. The maximum length is 256 characters.\n", - "type": "string", - "nullable": true, - "maxLength": 256 - }, - "description": { - "description": "The description of the assistant. The maximum length is 512 characters.\n", - "type": "string", - "nullable": true, - "maxLength": 512 - }, - "instructions": { - "description": "The system instructions that the assistant uses. The maximum length is 256,000 characters.\n", - "type": "string", - "nullable": true, - "maxLength": 256000 - }, - "tools": { - "description": "A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.\n", - "default": [], - "type": "array", - "maxItems": 128, - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/AssistantToolsCode" - }, - { - "$ref": "#/components/schemas/AssistantToolsFileSearch" - }, - { - "$ref": "#/components/schemas/AssistantToolsFunction" - } - ], - "x-oaiExpandable": true - } - }, - "tool_resources": { - "type": "object", - "description": "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n", - "properties": { - "code_interpreter": { - "type": "object", - "properties": { - "file_ids": { - "type": "array", - "description": "A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n", - "default": [], - "maxItems": 20, - "items": { - "type": "string" - } - } - } - }, - "file_search": { - "type": "object", - "properties": { - "vector_store_ids": { - "type": "array", - "description": "The [vector store](/docs/api-reference/vector-stores/object) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n", - "maxItems": 1, - "items": { - "type": "string" - } - }, - "vector_stores": { - "type": "array", - "description": "A helper to create a [vector store](/docs/api-reference/vector-stores/object) with file_ids and attach it to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n", - "maxItems": 1, - "items": { - "type": "object", - "properties": { - "file_ids": { - "type": "array", - "description": "A list of [file](/docs/api-reference/files) IDs to add to the vector store. There can be a maximum of 10000 files in a vector store.\n", - "maxItems": 10000, - "items": { - "type": "string" - } - }, - "chunking_strategy": { - "type": "object", - "description": "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy.", - "oneOf": [ - { - "type": "object", - "title": "Auto Chunking Strategy", - "description": "The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.", - "additionalProperties": false, - "properties": { - "type": { - "type": "string", - "description": "Always `auto`.", - "enum": [ - "auto" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "title": "Static Chunking Strategy", - "additionalProperties": false, - "properties": { - "type": { - "type": "string", - "description": "Always `static`.", - "enum": [ - "static" - ] - }, - "static": { - "type": "object", - "additionalProperties": false, - "properties": { - "max_chunk_size_tokens": { - "type": "integer", - "minimum": 100, - "maximum": 4096, - "description": "The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`." - }, - "chunk_overlap_tokens": { - "type": "integer", - "description": "The number of tokens that overlap between chunks. The default value is `400`.\n\nNote that the overlap must not exceed half of `max_chunk_size_tokens`.\n" - } - }, - "required": [ - "max_chunk_size_tokens", - "chunk_overlap_tokens" - ] - } - }, - "required": [ - "type", - "static" - ] - } - ], - "x-oaiExpandable": true - }, - "metadata": { - "type": "object", - "description": "Set of 16 key-value pairs that can be attached to a vector store. This can be useful for storing additional information about the vector store in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", - "x-oaiTypeLabel": "map" - } - } - } - } - }, - "oneOf": [ - { - "required": [ - "vector_store_ids" - ] - }, - { - "required": [ - "vector_stores" - ] - } - ] - } - }, - "nullable": true - }, - "metadata": { - "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", - "type": "object", - "x-oaiTypeLabel": "map", - "nullable": true - }, - "temperature": { - "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n", - "type": "number", - "minimum": 0, - "maximum": 2, - "default": 1, - "example": 1, - "nullable": true - }, - "top_p": { - "type": "number", - "minimum": 0, - "maximum": 1, - "default": 1, - "example": 1, - "nullable": true, - "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.\n" - }, - "response_format": { - "$ref": "#/components/schemas/AssistantsApiResponseFormatOption", - "nullable": true - } - }, - "required": [ - "model" - ] - }, - "ModifyAssistantRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "model": { - "description": "ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them.\n", - "anyOf": [ - { - "type": "string" - } - ] - }, - "name": { - "description": "The name of the assistant. The maximum length is 256 characters.\n", - "type": "string", - "nullable": true, - "maxLength": 256 - }, - "description": { - "description": "The description of the assistant. The maximum length is 512 characters.\n", - "type": "string", - "nullable": true, - "maxLength": 512 - }, - "instructions": { - "description": "The system instructions that the assistant uses. The maximum length is 256,000 characters.\n", - "type": "string", - "nullable": true, - "maxLength": 256000 - }, - "tools": { - "description": "A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.\n", - "default": [], - "type": "array", - "maxItems": 128, - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/AssistantToolsCode" - }, - { - "$ref": "#/components/schemas/AssistantToolsFileSearch" - }, - { - "$ref": "#/components/schemas/AssistantToolsFunction" - } - ], - "x-oaiExpandable": true - } - }, - "tool_resources": { - "type": "object", - "description": "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n", - "properties": { - "code_interpreter": { - "type": "object", - "properties": { - "file_ids": { - "type": "array", - "description": "Overrides the list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n", - "default": [], - "maxItems": 20, - "items": { - "type": "string" - } - } - } - }, - "file_search": { - "type": "object", - "properties": { - "vector_store_ids": { - "type": "array", - "description": "Overrides the [vector store](/docs/api-reference/vector-stores/object) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n", - "maxItems": 1, - "items": { - "type": "string" - } - } - } - } - }, - "nullable": true - }, - "metadata": { - "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", - "type": "object", - "x-oaiTypeLabel": "map", - "nullable": true - }, - "temperature": { - "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n", - "type": "number", - "minimum": 0, - "maximum": 2, - "default": 1, - "example": 1, - "nullable": true - }, - "top_p": { - "type": "number", - "minimum": 0, - "maximum": 1, - "default": 1, - "example": 1, - "nullable": true, - "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.\n" - }, - "response_format": { - "$ref": "#/components/schemas/AssistantsApiResponseFormatOption", - "nullable": true - } - } - }, - "DeleteAssistantResponse": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "deleted": { - "type": "boolean" - }, - "object": { - "type": "string", - "enum": [ - "assistant.deleted" - ] - } - }, - "required": [ - "id", - "object", - "deleted" - ] - }, - "ListAssistantsResponse": { - "type": "object", - "properties": { - "object": { - "type": "string", - "example": "list" - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/AssistantObject" - } - }, - "first_id": { - "type": "string", - "example": "asst_abc123" - }, - "last_id": { - "type": "string", - "example": "asst_abc456" - }, - "has_more": { - "type": "boolean", - "example": false - } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ], - "x-oaiMeta": { - "name": "List assistants response object", - "group": "chat", - "example": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"asst_abc123\",\n \"object\": \"assistant\",\n \"created_at\": 1698982736,\n \"name\": \"Coding Tutor\",\n \"description\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": \"You are a helpful assistant designed to make me better at coding!\",\n \"tools\": [],\n \"tool_resources\": {},\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n },\n {\n \"id\": \"asst_abc456\",\n \"object\": \"assistant\",\n \"created_at\": 1698982718,\n \"name\": \"My Assistant\",\n \"description\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": \"You are a helpful assistant designed to make me better at coding!\",\n \"tools\": [],\n \"tool_resources\": {},\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n },\n {\n \"id\": \"asst_abc789\",\n \"object\": \"assistant\",\n \"created_at\": 1698982643,\n \"name\": null,\n \"description\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": null,\n \"tools\": [],\n \"tool_resources\": {},\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n }\n ],\n \"first_id\": \"asst_abc123\",\n \"last_id\": \"asst_abc789\",\n \"has_more\": false\n}\n" - } - }, - "AssistantToolsCode": { - "type": "object", - "title": "Code interpreter tool", - "properties": { - "type": { - "type": "string", - "description": "The type of tool being defined: `code_interpreter`", - "enum": [ - "code_interpreter" - ] - } - }, - "required": [ - "type" - ] - }, - "AssistantToolsFileSearch": { - "type": "object", - "title": "FileSearch tool", - "properties": { - "type": { - "type": "string", - "description": "The type of tool being defined: `file_search`", - "enum": [ - "file_search" - ] - }, - "file_search": { - "type": "object", - "description": "Overrides for the file search tool.", - "properties": { - "max_num_results": { - "type": "integer", - "minimum": 1, - "maximum": 50, - "description": "The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive.\n\nNote that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) for more information.\n" - }, - "ranking_options": { - "$ref": "#/components/schemas/FileSearchRankingOptions" - } - } - } - }, - "required": [ - "type" - ] - }, - "FileSearchRankingOptions": { - "title": "File search tool call ranking options", - "type": "object", - "description": "The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0.\n\nSee the [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) for more information.\n", - "properties": { - "ranker": { - "type": "string", - "description": "The ranker to use for the file search. If not specified will use the `auto` ranker.", - "enum": [ - "auto", - "default_2024_08_21" - ] - }, - "score_threshold": { - "type": "number", - "description": "The score threshold for the file search. All values must be a floating point number between 0 and 1.", - "minimum": 0, - "maximum": 1 - } - }, - "required": [ - "score_threshold" - ] - }, - "AssistantToolsFileSearchTypeOnly": { - "type": "object", - "title": "FileSearch tool", - "properties": { - "type": { - "type": "string", - "description": "The type of tool being defined: `file_search`", - "enum": [ - "file_search" - ] - } - }, - "required": [ - "type" - ] - }, - "AssistantToolsFunction": { - "type": "object", - "title": "Function tool", - "properties": { - "type": { - "type": "string", - "description": "The type of tool being defined: `function`", - "enum": [ - "function" - ] - }, - "function": { - "$ref": "#/components/schemas/FunctionObject" - } - }, - "required": [ - "type", - "function" - ] - }, - "TruncationObject": { - "type": "object", - "title": "Thread Truncation Controls", - "description": "Controls for how a thread will be truncated prior to the run. Use this to control the intial context window of the run.", - "properties": { - "type": { - "type": "string", - "description": "The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will be truncated to the n most recent messages in the thread. When set to `auto`, messages in the middle of the thread will be dropped to fit the context length of the model, `max_prompt_tokens`.", - "enum": [ - "auto", - "last_messages" - ] - }, - "last_messages": { - "type": "integer", - "description": "The number of most recent messages from the thread when constructing the context for the run.", - "minimum": 1, - "nullable": true - } - }, - "required": [ - "type" - ] - }, - "AssistantsApiToolChoiceOption": { - "description": "Controls which (if any) tool is called by the model.\n`none` means the model will not call any tools and instead generates a message.\n`auto` is the default value and means the model can pick between generating a message or calling one or more tools.\n`required` means the model must call one or more tools before responding to the user.\nSpecifying a particular tool like `{\"type\": \"file_search\"}` or `{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}` forces the model to call that tool.\n", - "oneOf": [ - { - "type": "string", - "description": "`none` means the model will not call any tools and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools before responding to the user.\n", - "enum": [ - "none", - "auto", - "required" - ] - }, - { - "$ref": "#/components/schemas/AssistantsNamedToolChoice" - } - ], - "x-oaiExpandable": true - }, - "AssistantsNamedToolChoice": { - "type": "object", - "description": "Specifies a tool the model should use. Use to force the model to call a specific tool.", - "properties": { - "type": { - "type": "string", - "enum": [ - "function", - "code_interpreter", - "file_search" - ], - "description": "The type of the tool. If type is `function`, the function name must be set" - }, - "function": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The name of the function to call." - } - }, - "required": [ - "name" - ] - } - }, - "required": [ - "type" - ] - }, - "RunObject": { - "type": "object", - "title": "A run on a thread", - "description": "Represents an execution run on a [thread](/docs/api-reference/threads).", - "properties": { - "id": { - "description": "The identifier, which can be referenced in API endpoints.", - "type": "string" - }, - "object": { - "description": "The object type, which is always `thread.run`.", - "type": "string", - "enum": [ - "thread.run" - ] - }, - "created_at": { - "description": "The Unix timestamp (in seconds) for when the run was created.", - "type": "integer" - }, - "thread_id": { - "description": "The ID of the [thread](/docs/api-reference/threads) that was executed on as a part of this run.", - "type": "string" - }, - "assistant_id": { - "description": "The ID of the [assistant](/docs/api-reference/assistants) used for execution of this run.", - "type": "string" - }, - "status": { - "description": "The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, `incomplete`, or `expired`.", - "type": "string", - "enum": [ - "queued", - "in_progress", - "requires_action", - "cancelling", - "cancelled", - "failed", - "completed", - "incomplete", - "expired" - ] - }, - "required_action": { - "type": "object", - "description": "Details on the action required to continue the run. Will be `null` if no action is required.", - "nullable": true, - "properties": { - "type": { - "description": "For now, this is always `submit_tool_outputs`.", - "type": "string", - "enum": [ - "submit_tool_outputs" - ] - }, - "submit_tool_outputs": { - "type": "object", - "description": "Details on the tool outputs needed for this run to continue.", - "properties": { - "tool_calls": { - "type": "array", - "description": "A list of the relevant tool calls.", - "items": { - "$ref": "#/components/schemas/RunToolCallObject" - } - } - }, - "required": [ - "tool_calls" - ] - } - }, - "required": [ - "type", - "submit_tool_outputs" - ] - }, - "last_error": { - "type": "object", - "description": "The last error associated with this run. Will be `null` if there are no errors.", - "nullable": true, - "properties": { - "code": { - "type": "string", - "description": "One of `server_error`, `rate_limit_exceeded`, or `invalid_prompt`.", - "enum": [ - "server_error", - "rate_limit_exceeded", - "invalid_prompt" - ] - }, - "message": { - "type": "string", - "description": "A human-readable description of the error." - } - }, - "required": [ - "code", - "message" - ] - }, - "expires_at": { - "description": "The Unix timestamp (in seconds) for when the run will expire.", - "type": "integer", - "nullable": true - }, - "started_at": { - "description": "The Unix timestamp (in seconds) for when the run was started.", - "type": "integer", - "nullable": true - }, - "cancelled_at": { - "description": "The Unix timestamp (in seconds) for when the run was cancelled.", - "type": "integer", - "nullable": true - }, - "failed_at": { - "description": "The Unix timestamp (in seconds) for when the run failed.", - "type": "integer", - "nullable": true - }, - "completed_at": { - "description": "The Unix timestamp (in seconds) for when the run was completed.", - "type": "integer", - "nullable": true - }, - "incomplete_details": { - "description": "Details on why the run is incomplete. Will be `null` if the run is not incomplete.", - "type": "object", - "nullable": true, - "properties": { - "reason": { - "description": "The reason why the run is incomplete. This will point to which specific token limit was reached over the course of the run.", - "type": "string", - "enum": [ - "max_completion_tokens", - "max_prompt_tokens" - ] - } - } - }, - "model": { - "description": "The model that the [assistant](/docs/api-reference/assistants) used for this run.", - "type": "string" - }, - "instructions": { - "description": "The instructions that the [assistant](/docs/api-reference/assistants) used for this run.", - "type": "string" - }, - "tools": { - "description": "The list of tools that the [assistant](/docs/api-reference/assistants) used for this run.", - "default": [], - "type": "array", - "maxItems": 20, - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/AssistantToolsCode" - }, - { - "$ref": "#/components/schemas/AssistantToolsFileSearch" - }, - { - "$ref": "#/components/schemas/AssistantToolsFunction" - } - ], - "x-oaiExpandable": true - } - }, - "metadata": { - "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", - "type": "object", - "x-oaiTypeLabel": "map", - "nullable": true - }, - "usage": { - "$ref": "#/components/schemas/RunCompletionUsage" - }, - "temperature": { - "description": "The sampling temperature used for this run. If not set, defaults to 1.", - "type": "number", - "nullable": true - }, - "top_p": { - "description": "The nucleus sampling value used for this run. If not set, defaults to 1.", - "type": "number", - "nullable": true - }, - "max_prompt_tokens": { - "type": "integer", - "nullable": true, - "description": "The maximum number of prompt tokens specified to have been used over the course of the run.\n", - "minimum": 256 - }, - "max_completion_tokens": { - "type": "integer", - "nullable": true, - "description": "The maximum number of completion tokens specified to have been used over the course of the run.\n", - "minimum": 256 - }, - "truncation_strategy": { - "$ref": "#/components/schemas/TruncationObject", - "nullable": true - }, - "tool_choice": { - "$ref": "#/components/schemas/AssistantsApiToolChoiceOption", - "nullable": true - }, - "parallel_tool_calls": { - "$ref": "#/components/schemas/ParallelToolCalls" - }, - "response_format": { - "$ref": "#/components/schemas/AssistantsApiResponseFormatOption", - "nullable": true - } - }, - "required": [ - "id", - "object", - "created_at", - "thread_id", - "assistant_id", - "status", - "required_action", - "last_error", - "expires_at", - "started_at", - "cancelled_at", - "failed_at", - "completed_at", - "model", - "instructions", - "tools", - "metadata", - "usage", - "incomplete_details", - "max_prompt_tokens", - "max_completion_tokens", - "truncation_strategy", - "tool_choice", - "parallel_tool_calls", - "response_format" - ], - "x-oaiMeta": { - "name": "The run object", - "beta": true, - "example": "{\n \"id\": \"run_abc123\",\n \"object\": \"thread.run\",\n \"created_at\": 1698107661,\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"status\": \"completed\",\n \"started_at\": 1699073476,\n \"expires_at\": null,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": 1699073498,\n \"last_error\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": null,\n \"tools\": [{\"type\": \"file_search\"}, {\"type\": \"code_interpreter\"}],\n \"metadata\": {},\n \"incomplete_details\": null,\n \"usage\": {\n \"prompt_tokens\": 123,\n \"completion_tokens\": 456,\n \"total_tokens\": 579\n },\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"max_prompt_tokens\": 1000,\n \"max_completion_tokens\": 1000,\n \"truncation_strategy\": {\n \"type\": \"auto\",\n \"last_messages\": null\n },\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true\n}\n" - } - }, - "CreateRunRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "assistant_id": { - "description": "The ID of the [assistant](/docs/api-reference/assistants) to use to execute this run.", - "type": "string" - }, - "model": { - "description": "The ID of the [Model](/docs/api-reference/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used.", - "example": "gpt-4o", - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "gpt-4o", - "gpt-4o-2024-08-06", - "gpt-4o-2024-05-13", - "gpt-4o-2024-08-06", - "gpt-4o-mini", - "gpt-4o-mini-2024-07-18", - "gpt-4-turbo", - "gpt-4-turbo-2024-04-09", - "gpt-4-0125-preview", - "gpt-4-turbo-preview", - "gpt-4-1106-preview", - "gpt-4-vision-preview", - "gpt-4", - "gpt-4-0314", - "gpt-4-0613", - "gpt-4-32k", - "gpt-4-32k-0314", - "gpt-4-32k-0613", - "gpt-3.5-turbo", - "gpt-3.5-turbo-16k", - "gpt-3.5-turbo-0613", - "gpt-3.5-turbo-1106", - "gpt-3.5-turbo-0125", - "gpt-3.5-turbo-16k-0613" - ] - } - ], - "x-oaiTypeLabel": "string", - "nullable": true - }, - "instructions": { - "description": "Overrides the [instructions](/docs/api-reference/assistants/createAssistant) of the assistant. This is useful for modifying the behavior on a per-run basis.", - "type": "string", - "nullable": true - }, - "additional_instructions": { - "description": "Appends additional instructions at the end of the instructions for the run. This is useful for modifying the behavior on a per-run basis without overriding other instructions.", - "type": "string", - "nullable": true - }, - "additional_messages": { - "description": "Adds additional messages to the thread before creating the run.", - "type": "array", - "items": { - "$ref": "#/components/schemas/CreateMessageRequest" - }, - "nullable": true - }, - "tools": { - "description": "Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis.", - "nullable": true, - "type": "array", - "maxItems": 20, - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/AssistantToolsCode" - }, - { - "$ref": "#/components/schemas/AssistantToolsFileSearch" - }, - { - "$ref": "#/components/schemas/AssistantToolsFunction" - } - ], - "x-oaiExpandable": true - } - }, - "metadata": { - "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", - "type": "object", - "x-oaiTypeLabel": "map", - "nullable": true - }, - "temperature": { - "type": "number", - "minimum": 0, - "maximum": 2, - "default": 1, - "example": 1, - "nullable": true, - "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n" - }, - "top_p": { - "type": "number", - "minimum": 0, - "maximum": 1, - "default": 1, - "example": 1, - "nullable": true, - "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.\n" - }, - "stream": { - "type": "boolean", - "nullable": true, - "description": "If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message.\n" - }, - "max_prompt_tokens": { - "type": "integer", - "nullable": true, - "description": "The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.\n", - "minimum": 256 - }, - "max_completion_tokens": { - "type": "integer", - "nullable": true, - "description": "The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.\n", - "minimum": 256 - }, - "truncation_strategy": { - "$ref": "#/components/schemas/TruncationObject", - "nullable": true - }, - "tool_choice": { - "$ref": "#/components/schemas/AssistantsApiToolChoiceOption", - "nullable": true - }, - "parallel_tool_calls": { - "$ref": "#/components/schemas/ParallelToolCalls" - }, - "response_format": { - "$ref": "#/components/schemas/AssistantsApiResponseFormatOption", - "nullable": true - } - }, - "required": [ - "thread_id", - "assistant_id" - ] - }, - "ListRunsResponse": { - "type": "object", - "properties": { - "object": { - "type": "string", - "example": "list" - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RunObject" - } - }, - "first_id": { - "type": "string", - "example": "run_abc123" - }, - "last_id": { - "type": "string", - "example": "run_abc456" - }, - "has_more": { - "type": "boolean", - "example": false - } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] - }, - "ModifyRunRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "metadata": { - "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", - "type": "object", - "x-oaiTypeLabel": "map", - "nullable": true - } - } - }, - "SubmitToolOutputsRunRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "tool_outputs": { - "description": "A list of tools for which the outputs are being submitted.", - "type": "array", - "items": { - "type": "object", - "properties": { - "tool_call_id": { - "type": "string", - "description": "The ID of the tool call in the `required_action` object within the run object the output is being submitted for." - }, - "output": { - "type": "string", - "description": "The output of the tool call to be submitted to continue the run." - } - } - } - }, - "stream": { - "type": "boolean", - "nullable": true, - "description": "If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message.\n" - } - }, - "required": [ - "tool_outputs" - ] - }, - "RunToolCallObject": { - "type": "object", - "description": "Tool call objects", - "properties": { - "id": { - "type": "string", - "description": "The ID of the tool call. This ID must be referenced when you submit the tool outputs in using the [Submit tool outputs to run](/docs/api-reference/runs/submitToolOutputs) endpoint." - }, - "type": { - "type": "string", - "description": "The type of tool call the output is required for. For now, this is always `function`.", - "enum": [ - "function" - ] - }, - "function": { - "type": "object", - "description": "The function definition.", - "properties": { - "name": { - "type": "string", - "description": "The name of the function." - }, - "arguments": { - "type": "string", - "description": "The arguments that the model expects you to pass to the function." - } - }, - "required": [ - "name", - "arguments" - ] - } - }, - "required": [ - "id", - "type", - "function" - ] - }, - "CreateThreadAndRunRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "assistant_id": { - "description": "The ID of the [assistant](/docs/api-reference/assistants) to use to execute this run.", - "type": "string" - }, - "thread": { - "$ref": "#/components/schemas/CreateThreadRequest", - "description": "If no thread is provided, an empty thread will be created." - }, - "model": { - "description": "The ID of the [Model](/docs/api-reference/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used.", - "example": "gpt-4o", - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "gpt-4o", - "gpt-4o-2024-08-06", - "gpt-4o-2024-05-13", - "gpt-4o-2024-08-06", - "gpt-4o-mini", - "gpt-4o-mini-2024-07-18", - "gpt-4-turbo", - "gpt-4-turbo-2024-04-09", - "gpt-4-0125-preview", - "gpt-4-turbo-preview", - "gpt-4-1106-preview", - "gpt-4-vision-preview", - "gpt-4", - "gpt-4-0314", - "gpt-4-0613", - "gpt-4-32k", - "gpt-4-32k-0314", - "gpt-4-32k-0613", - "gpt-3.5-turbo", - "gpt-3.5-turbo-16k", - "gpt-3.5-turbo-0613", - "gpt-3.5-turbo-1106", - "gpt-3.5-turbo-0125", - "gpt-3.5-turbo-16k-0613" - ] - } - ], - "x-oaiTypeLabel": "string", - "nullable": true - }, - "instructions": { - "description": "Override the default system message of the assistant. This is useful for modifying the behavior on a per-run basis.", - "type": "string", - "nullable": true - }, - "tools": { - "description": "Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis.", - "nullable": true, - "type": "array", - "maxItems": 20, - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/AssistantToolsCode" - }, - { - "$ref": "#/components/schemas/AssistantToolsFileSearch" - }, - { - "$ref": "#/components/schemas/AssistantToolsFunction" - } - ] - } - }, - "tool_resources": { - "type": "object", - "description": "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n", - "properties": { - "code_interpreter": { - "type": "object", - "properties": { - "file_ids": { - "type": "array", - "description": "A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n", - "default": [], - "maxItems": 20, - "items": { - "type": "string" - } - } - } - }, - "file_search": { - "type": "object", - "properties": { - "vector_store_ids": { - "type": "array", - "description": "The ID of the [vector store](/docs/api-reference/vector-stores/object) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n", - "maxItems": 1, - "items": { - "type": "string" - } - } - } - } - }, - "nullable": true - }, - "metadata": { - "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", - "type": "object", - "x-oaiTypeLabel": "map", - "nullable": true - }, - "temperature": { - "type": "number", - "minimum": 0, - "maximum": 2, - "default": 1, - "example": 1, - "nullable": true, - "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n" - }, - "top_p": { - "type": "number", - "minimum": 0, - "maximum": 1, - "default": 1, - "example": 1, - "nullable": true, - "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.\n" - }, - "stream": { - "type": "boolean", - "nullable": true, - "description": "If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message.\n" - }, - "max_prompt_tokens": { - "type": "integer", - "nullable": true, - "description": "The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.\n", - "minimum": 256 - }, - "max_completion_tokens": { - "type": "integer", - "nullable": true, - "description": "The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.\n", - "minimum": 256 - }, - "truncation_strategy": { - "$ref": "#/components/schemas/TruncationObject", - "nullable": true - }, - "tool_choice": { - "$ref": "#/components/schemas/AssistantsApiToolChoiceOption", - "nullable": true - }, - "parallel_tool_calls": { - "$ref": "#/components/schemas/ParallelToolCalls" - }, - "response_format": { - "$ref": "#/components/schemas/AssistantsApiResponseFormatOption", - "nullable": true - } - }, - "required": [ - "thread_id", - "assistant_id" - ] - }, - "ThreadObject": { - "type": "object", - "title": "Thread", - "description": "Represents a thread that contains [messages](/docs/api-reference/messages).", - "properties": { - "id": { - "description": "The identifier, which can be referenced in API endpoints.", - "type": "string" - }, - "object": { - "description": "The object type, which is always `thread`.", - "type": "string", - "enum": [ - "thread" - ] - }, - "created_at": { - "description": "The Unix timestamp (in seconds) for when the thread was created.", - "type": "integer" - }, - "tool_resources": { - "type": "object", - "description": "A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n", - "properties": { - "code_interpreter": { - "type": "object", - "properties": { - "file_ids": { - "type": "array", - "description": "A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n", - "default": [], - "maxItems": 20, - "items": { - "type": "string" - } - } - } - }, - "file_search": { - "type": "object", - "properties": { - "vector_store_ids": { - "type": "array", - "description": "The [vector store](/docs/api-reference/vector-stores/object) attached to this thread. There can be a maximum of 1 vector store attached to the thread.\n", - "maxItems": 1, - "items": { - "type": "string" - } - } - } - } - }, - "nullable": true - }, - "metadata": { - "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", - "type": "object", - "x-oaiTypeLabel": "map", - "nullable": true - } - }, - "required": [ - "id", - "object", - "created_at", - "tool_resources", - "metadata" - ], - "x-oaiMeta": { - "name": "The thread object", - "beta": true, - "example": "{\n \"id\": \"thread_abc123\",\n \"object\": \"thread\",\n \"created_at\": 1698107661,\n \"metadata\": {}\n}\n" - } - }, - "CreateThreadRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "messages": { - "description": "A list of [messages](/docs/api-reference/messages) to start the thread with.", - "type": "array", - "items": { - "$ref": "#/components/schemas/CreateMessageRequest" - } - }, - "tool_resources": { - "type": "object", - "description": "A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n", - "properties": { - "code_interpreter": { - "type": "object", - "properties": { - "file_ids": { - "type": "array", - "description": "A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n", - "default": [], - "maxItems": 20, - "items": { - "type": "string" - } - } - } - }, - "file_search": { - "type": "object", - "properties": { - "vector_store_ids": { - "type": "array", - "description": "The [vector store](/docs/api-reference/vector-stores/object) attached to this thread. There can be a maximum of 1 vector store attached to the thread.\n", - "maxItems": 1, - "items": { - "type": "string" - } - }, - "vector_stores": { - "type": "array", - "description": "A helper to create a [vector store](/docs/api-reference/vector-stores/object) with file_ids and attach it to this thread. There can be a maximum of 1 vector store attached to the thread.\n", - "maxItems": 1, - "items": { - "type": "object", - "properties": { - "file_ids": { - "type": "array", - "description": "A list of [file](/docs/api-reference/files) IDs to add to the vector store. There can be a maximum of 10000 files in a vector store.\n", - "maxItems": 10000, - "items": { - "type": "string" - } - }, - "chunking_strategy": { - "type": "object", - "description": "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy.", - "oneOf": [ - { - "type": "object", - "title": "Auto Chunking Strategy", - "description": "The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.", - "additionalProperties": false, - "properties": { - "type": { - "type": "string", - "description": "Always `auto`.", - "enum": [ - "auto" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "title": "Static Chunking Strategy", - "additionalProperties": false, - "properties": { - "type": { - "type": "string", - "description": "Always `static`.", - "enum": [ - "static" - ] - }, - "static": { - "type": "object", - "additionalProperties": false, - "properties": { - "max_chunk_size_tokens": { - "type": "integer", - "minimum": 100, - "maximum": 4096, - "description": "The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`." - }, - "chunk_overlap_tokens": { - "type": "integer", - "description": "The number of tokens that overlap between chunks. The default value is `400`.\n\nNote that the overlap must not exceed half of `max_chunk_size_tokens`.\n" - } - }, - "required": [ - "max_chunk_size_tokens", - "chunk_overlap_tokens" - ] - } - }, - "required": [ - "type", - "static" - ] - } - ], - "x-oaiExpandable": true - }, - "metadata": { - "type": "object", - "description": "Set of 16 key-value pairs that can be attached to a vector store. This can be useful for storing additional information about the vector store in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", - "x-oaiTypeLabel": "map" - } - }, - "x-oaiExpandable": true - } - } - }, - "oneOf": [ - { - "required": [ - "vector_store_ids" - ] - }, - { - "required": [ - "vector_stores" - ] - } - ] - } - }, - "nullable": true - }, - "metadata": { - "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", - "type": "object", - "x-oaiTypeLabel": "map", - "nullable": true - } - } - }, - "ModifyThreadRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "tool_resources": { - "type": "object", - "description": "A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n", - "properties": { - "code_interpreter": { - "type": "object", - "properties": { - "file_ids": { - "type": "array", - "description": "A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n", - "default": [], - "maxItems": 20, - "items": { - "type": "string" - } - } - } - }, - "file_search": { - "type": "object", - "properties": { - "vector_store_ids": { - "type": "array", - "description": "The [vector store](/docs/api-reference/vector-stores/object) attached to this thread. There can be a maximum of 1 vector store attached to the thread.\n", - "maxItems": 1, - "items": { - "type": "string" - } - } - } - } - }, - "nullable": true - }, - "metadata": { - "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", - "type": "object", - "x-oaiTypeLabel": "map", - "nullable": true - } - } - }, - "DeleteThreadResponse": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "deleted": { - "type": "boolean" - }, - "object": { - "type": "string", - "enum": [ - "thread.deleted" - ] - } - }, - "required": [ - "id", - "object", - "deleted" - ] - }, - "ListThreadsResponse": { - "properties": { - "object": { - "type": "string", - "example": "list" - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ThreadObject" - } - }, - "first_id": { - "type": "string", - "example": "asst_abc123" - }, - "last_id": { - "type": "string", - "example": "asst_abc456" - }, - "has_more": { - "type": "boolean", - "example": false - } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] - }, - "MessageObject": { - "type": "object", - "title": "The message object", - "description": "Represents a message within a [thread](/docs/api-reference/threads).", - "properties": { - "id": { - "description": "The identifier, which can be referenced in API endpoints.", - "type": "string" - }, - "object": { - "description": "The object type, which is always `thread.message`.", - "type": "string", - "enum": [ - "thread.message" - ] - }, - "created_at": { - "description": "The Unix timestamp (in seconds) for when the message was created.", - "type": "integer" - }, - "thread_id": { - "description": "The [thread](/docs/api-reference/threads) ID that this message belongs to.", - "type": "string" - }, - "status": { - "description": "The status of the message, which can be either `in_progress`, `incomplete`, or `completed`.", - "type": "string", - "enum": [ - "in_progress", - "incomplete", - "completed" - ] - }, - "incomplete_details": { - "description": "On an incomplete message, details about why the message is incomplete.", - "type": "object", - "properties": { - "reason": { - "type": "string", - "description": "The reason the message is incomplete.", - "enum": [ - "content_filter", - "max_tokens", - "run_cancelled", - "run_expired", - "run_failed" - ] - } - }, - "nullable": true, - "required": [ - "reason" - ] - }, - "completed_at": { - "description": "The Unix timestamp (in seconds) for when the message was completed.", - "type": "integer", - "nullable": true - }, - "incomplete_at": { - "description": "The Unix timestamp (in seconds) for when the message was marked as incomplete.", - "type": "integer", - "nullable": true - }, - "role": { - "description": "The entity that produced the message. One of `user` or `assistant`.", - "type": "string", - "enum": [ - "user", - "assistant" - ] - }, - "content": { - "description": "The content of the message in array of text and/or images.", - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/MessageContentImageFileObject" - }, - { - "$ref": "#/components/schemas/MessageContentImageUrlObject" - }, - { - "$ref": "#/components/schemas/MessageContentTextObject" - }, - { - "$ref": "#/components/schemas/MessageContentRefusalObject" - } - ], - "x-oaiExpandable": true - } - }, - "assistant_id": { - "description": "If applicable, the ID of the [assistant](/docs/api-reference/assistants) that authored this message.", - "type": "string", - "nullable": true - }, - "run_id": { - "description": "The ID of the [run](/docs/api-reference/runs) associated with the creation of this message. Value is `null` when messages are created manually using the create message or create thread endpoints.", - "type": "string", - "nullable": true - }, - "attachments": { - "type": "array", - "items": { - "type": "object", - "properties": { - "file_id": { - "type": "string", - "description": "The ID of the file to attach to the message." - }, - "tools": { - "description": "The tools to add this file to.", - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/AssistantToolsCode" - }, - { - "$ref": "#/components/schemas/AssistantToolsFileSearchTypeOnly" - } - ], - "x-oaiExpandable": true - } - } - } - }, - "description": "A list of files attached to the message, and the tools they were added to.", - "nullable": true - }, - "metadata": { - "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", - "type": "object", - "x-oaiTypeLabel": "map", - "nullable": true - } - }, - "required": [ - "id", - "object", - "created_at", - "thread_id", - "status", - "incomplete_details", - "completed_at", - "incomplete_at", - "role", - "content", - "assistant_id", - "run_id", - "attachments", - "metadata" - ], - "x-oaiMeta": { - "name": "The message object", - "beta": true, - "example": "{\n \"id\": \"msg_abc123\",\n \"object\": \"thread.message\",\n \"created_at\": 1698983503,\n \"thread_id\": \"thread_abc123\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": {\n \"value\": \"Hi! How can I help you today?\",\n \"annotations\": []\n }\n }\n ],\n \"assistant_id\": \"asst_abc123\",\n \"run_id\": \"run_abc123\",\n \"attachments\": [],\n \"metadata\": {}\n}\n" - } - }, - "MessageDeltaObject": { - "type": "object", - "title": "Message delta object", - "description": "Represents a message delta i.e. any changed fields on a message during streaming.\n", - "properties": { - "id": { - "description": "The identifier of the message, which can be referenced in API endpoints.", - "type": "string" - }, - "object": { - "description": "The object type, which is always `thread.message.delta`.", - "type": "string", - "enum": [ - "thread.message.delta" - ] - }, - "delta": { - "description": "The delta containing the fields that have changed on the Message.", - "type": "object", - "properties": { - "role": { - "description": "The entity that produced the message. One of `user` or `assistant`.", - "type": "string", - "enum": [ - "user", - "assistant" - ] - }, - "content": { - "description": "The content of the message in array of text and/or images.", - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/MessageDeltaContentImageFileObject" - }, - { - "$ref": "#/components/schemas/MessageDeltaContentTextObject" - }, - { - "$ref": "#/components/schemas/MessageDeltaContentRefusalObject" - }, - { - "$ref": "#/components/schemas/MessageDeltaContentImageUrlObject" - } - ], - "x-oaiExpandable": true - } - } - } - } - }, - "required": [ - "id", - "object", - "delta" - ], - "x-oaiMeta": { - "name": "The message delta object", - "beta": true, - "example": "{\n \"id\": \"msg_123\",\n \"object\": \"thread.message.delta\",\n \"delta\": {\n \"content\": [\n {\n \"index\": 0,\n \"type\": \"text\",\n \"text\": { \"value\": \"Hello\", \"annotations\": [] }\n }\n ]\n }\n}\n" - } - }, - "CreateMessageRequest": { - "type": "object", - "additionalProperties": false, - "required": [ - "role", - "content" - ], - "properties": { - "role": { - "type": "string", - "enum": [ - "user", - "assistant" - ], - "description": "The role of the entity that is creating the message. Allowed values include:\n- `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages.\n- `assistant`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation.\n" - }, - "content": { - "oneOf": [ - { - "type": "string", - "description": "The text contents of the message.", - "title": "Text content" - }, - { - "type": "array", - "description": "An array of content parts with a defined type, each can be of type `text` or images can be passed with `image_url` or `image_file`. Image types are only supported on [Vision-compatible models](/docs/models/overview).", - "title": "Array of content parts", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/MessageContentImageFileObject" - }, - { - "$ref": "#/components/schemas/MessageContentImageUrlObject" - }, - { - "$ref": "#/components/schemas/MessageRequestContentTextObject" - } - ], - "x-oaiExpandable": true - }, - "minItems": 1 - } - ], - "x-oaiExpandable": true - }, - "attachments": { - "type": "array", - "items": { - "type": "object", - "properties": { - "file_id": { - "type": "string", - "description": "The ID of the file to attach to the message." - }, - "tools": { - "description": "The tools to add this file to.", - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/AssistantToolsCode" - }, - { - "$ref": "#/components/schemas/AssistantToolsFileSearchTypeOnly" - } - ], - "x-oaiExpandable": true - } - } - } - }, - "description": "A list of files attached to the message, and the tools they should be added to.", - "required": [ - "file_id", - "tools" - ], - "nullable": true - }, - "metadata": { - "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", - "type": "object", - "x-oaiTypeLabel": "map", - "nullable": true - } - } - }, - "ModifyMessageRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "metadata": { - "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", - "type": "object", - "x-oaiTypeLabel": "map", - "nullable": true - } - } - }, - "DeleteMessageResponse": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "deleted": { - "type": "boolean" - }, - "object": { - "type": "string", - "enum": [ - "thread.message.deleted" - ] - } - }, - "required": [ - "id", - "object", - "deleted" - ] - }, - "ListMessagesResponse": { - "properties": { - "object": { - "type": "string", - "example": "list" - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/MessageObject" - } - }, - "first_id": { - "type": "string", - "example": "msg_abc123" - }, - "last_id": { - "type": "string", - "example": "msg_abc123" - }, - "has_more": { - "type": "boolean", - "example": false - } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] - }, - "MessageContentImageFileObject": { - "title": "Image file", - "type": "object", - "description": "References an image [File](/docs/api-reference/files) in the content of a message.", - "properties": { - "type": { - "description": "Always `image_file`.", - "type": "string", - "enum": [ - "image_file" - ] - }, - "image_file": { - "type": "object", - "properties": { - "file_id": { - "description": "The [File](/docs/api-reference/files) ID of the image in the message content. Set `purpose=\"vision\"` when uploading the File if you need to later display the file content.", - "type": "string" - }, - "detail": { - "type": "string", - "description": "Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`.", - "enum": [ - "auto", - "low", - "high" - ], - "default": "auto" - } - }, - "required": [ - "file_id" - ] - } - }, - "required": [ - "type", - "image_file" - ] - }, - "MessageDeltaContentImageFileObject": { - "title": "Image file", - "type": "object", - "description": "References an image [File](/docs/api-reference/files) in the content of a message.", - "properties": { - "index": { - "type": "integer", - "description": "The index of the content part in the message." - }, - "type": { - "description": "Always `image_file`.", - "type": "string", - "enum": [ - "image_file" - ] - }, - "image_file": { - "type": "object", - "properties": { - "file_id": { - "description": "The [File](/docs/api-reference/files) ID of the image in the message content. Set `purpose=\"vision\"` when uploading the File if you need to later display the file content.", - "type": "string" - }, - "detail": { - "type": "string", - "description": "Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`.", - "enum": [ - "auto", - "low", - "high" - ], - "default": "auto" - } - } - } - }, - "required": [ - "index", - "type" - ] - }, - "MessageContentImageUrlObject": { - "title": "Image URL", - "type": "object", - "description": "References an image URL in the content of a message.", - "properties": { - "type": { - "type": "string", - "enum": [ - "image_url" - ], - "description": "The type of the content part." - }, - "image_url": { - "type": "object", - "properties": { - "url": { - "type": "string", - "description": "The external URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp.", - "format": "uri" - }, - "detail": { - "type": "string", - "description": "Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. Default value is `auto`", - "enum": [ - "auto", - "low", - "high" - ], - "default": "auto" - } - }, - "required": [ - "url" - ] - } - }, - "required": [ - "type", - "image_url" - ] - }, - "MessageDeltaContentImageUrlObject": { - "title": "Image URL", - "type": "object", - "description": "References an image URL in the content of a message.", - "properties": { - "index": { - "type": "integer", - "description": "The index of the content part in the message." - }, - "type": { - "description": "Always `image_url`.", - "type": "string", - "enum": [ - "image_url" - ] - }, - "image_url": { - "type": "object", - "properties": { - "url": { - "description": "The URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp.", - "type": "string" - }, - "detail": { - "type": "string", - "description": "Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`.", - "enum": [ - "auto", - "low", - "high" - ], - "default": "auto" - } - } - } - }, - "required": [ - "index", - "type" - ] - }, - "MessageContentTextObject": { - "title": "Text", - "type": "object", - "description": "The text content that is part of a message.", - "properties": { - "type": { - "description": "Always `text`.", - "type": "string", - "enum": [ - "text" - ] - }, - "text": { - "type": "object", - "properties": { - "value": { - "description": "The data that makes up the text.", - "type": "string" - }, - "annotations": { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/MessageContentTextAnnotationsFileCitationObject" - }, - { - "$ref": "#/components/schemas/MessageContentTextAnnotationsFilePathObject" - } - ], - "x-oaiExpandable": true - } - } - }, - "required": [ - "value", - "annotations" - ] - } - }, - "required": [ - "type", - "text" - ] - }, - "MessageContentRefusalObject": { - "title": "Refusal", - "type": "object", - "description": "The refusal content generated by the assistant.", - "properties": { - "type": { - "description": "Always `refusal`.", - "type": "string", - "enum": [ - "refusal" - ] - }, - "refusal": { - "type": "string", - "nullable": false - } - }, - "required": [ - "type", - "refusal" - ] - }, - "MessageRequestContentTextObject": { - "title": "Text", - "type": "object", - "description": "The text content that is part of a message.", - "properties": { - "type": { - "description": "Always `text`.", - "type": "string", - "enum": [ - "text" - ] - }, - "text": { - "type": "string", - "description": "Text content to be sent to the model" - } - }, - "required": [ - "type", - "text" - ] - }, - "MessageContentTextAnnotationsFileCitationObject": { - "title": "File citation", - "type": "object", - "description": "A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the \"file_search\" tool to search files.", - "properties": { - "type": { - "description": "Always `file_citation`.", - "type": "string", - "enum": [ - "file_citation" - ] - }, - "text": { - "description": "The text in the message content that needs to be replaced.", - "type": "string" - }, - "file_citation": { - "type": "object", - "properties": { - "file_id": { - "description": "The ID of the specific File the citation is from.", - "type": "string" - } - }, - "required": [ - "file_id" - ] - }, - "start_index": { - "type": "integer", - "minimum": 0 - }, - "end_index": { - "type": "integer", - "minimum": 0 - } - }, - "required": [ - "type", - "text", - "file_citation", - "start_index", - "end_index" - ] - }, - "MessageContentTextAnnotationsFilePathObject": { - "title": "File path", - "type": "object", - "description": "A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.", - "properties": { - "type": { - "description": "Always `file_path`.", - "type": "string", - "enum": [ - "file_path" - ] - }, - "text": { - "description": "The text in the message content that needs to be replaced.", - "type": "string" - }, - "file_path": { - "type": "object", - "properties": { - "file_id": { - "description": "The ID of the file that was generated.", - "type": "string" - } - }, - "required": [ - "file_id" - ] - }, - "start_index": { - "type": "integer", - "minimum": 0 - }, - "end_index": { - "type": "integer", - "minimum": 0 - } - }, - "required": [ - "type", - "text", - "file_path", - "start_index", - "end_index" - ] - }, - "MessageDeltaContentTextObject": { - "title": "Text", - "type": "object", - "description": "The text content that is part of a message.", - "properties": { - "index": { - "type": "integer", - "description": "The index of the content part in the message." - }, - "type": { - "description": "Always `text`.", - "type": "string", - "enum": [ - "text" - ] - }, - "text": { - "type": "object", - "properties": { - "value": { - "description": "The data that makes up the text.", - "type": "string" - }, - "annotations": { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/MessageDeltaContentTextAnnotationsFileCitationObject" - }, - { - "$ref": "#/components/schemas/MessageDeltaContentTextAnnotationsFilePathObject" - } - ], - "x-oaiExpandable": true - } - } - } - } - }, - "required": [ - "index", - "type" - ] - }, - "MessageDeltaContentRefusalObject": { - "title": "Refusal", - "type": "object", - "description": "The refusal content that is part of a message.", - "properties": { - "index": { - "type": "integer", - "description": "The index of the refusal part in the message." - }, - "type": { - "description": "Always `refusal`.", - "type": "string", - "enum": [ - "refusal" - ] - }, - "refusal": { - "type": "string" - } - }, - "required": [ - "index", - "type" - ] - }, - "MessageDeltaContentTextAnnotationsFileCitationObject": { - "title": "File citation", - "type": "object", - "description": "A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the \"file_search\" tool to search files.", - "properties": { - "index": { - "type": "integer", - "description": "The index of the annotation in the text content part." - }, - "type": { - "description": "Always `file_citation`.", - "type": "string", - "enum": [ - "file_citation" - ] - }, - "text": { - "description": "The text in the message content that needs to be replaced.", - "type": "string" - }, - "file_citation": { - "type": "object", - "properties": { - "file_id": { - "description": "The ID of the specific File the citation is from.", - "type": "string" - }, - "quote": { - "description": "The specific quote in the file.", - "type": "string" - } - } - }, - "start_index": { - "type": "integer", - "minimum": 0 - }, - "end_index": { - "type": "integer", - "minimum": 0 - } - }, - "required": [ - "index", - "type" - ] - }, - "MessageDeltaContentTextAnnotationsFilePathObject": { - "title": "File path", - "type": "object", - "description": "A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.", - "properties": { - "index": { - "type": "integer", - "description": "The index of the annotation in the text content part." - }, - "type": { - "description": "Always `file_path`.", - "type": "string", - "enum": [ - "file_path" - ] - }, - "text": { - "description": "The text in the message content that needs to be replaced.", - "type": "string" - }, - "file_path": { - "type": "object", - "properties": { - "file_id": { - "description": "The ID of the file that was generated.", - "type": "string" - } - } - }, - "start_index": { - "type": "integer", - "minimum": 0 - }, - "end_index": { - "type": "integer", - "minimum": 0 - } - }, - "required": [ - "index", - "type" - ] - }, - "RunStepObject": { - "type": "object", - "title": "Run steps", - "description": "Represents a step in execution of a run.\n", - "properties": { - "id": { - "description": "The identifier of the run step, which can be referenced in API endpoints.", - "type": "string" - }, - "object": { - "description": "The object type, which is always `thread.run.step`.", - "type": "string", - "enum": [ - "thread.run.step" - ] - }, - "created_at": { - "description": "The Unix timestamp (in seconds) for when the run step was created.", - "type": "integer" - }, - "assistant_id": { - "description": "The ID of the [assistant](/docs/api-reference/assistants) associated with the run step.", - "type": "string" - }, - "thread_id": { - "description": "The ID of the [thread](/docs/api-reference/threads) that was run.", - "type": "string" - }, - "run_id": { - "description": "The ID of the [run](/docs/api-reference/runs) that this run step is a part of.", - "type": "string" - }, - "type": { - "description": "The type of run step, which can be either `message_creation` or `tool_calls`.", - "type": "string", - "enum": [ - "message_creation", - "tool_calls" - ] - }, - "status": { - "description": "The status of the run step, which can be either `in_progress`, `cancelled`, `failed`, `completed`, or `expired`.", - "type": "string", - "enum": [ - "in_progress", - "cancelled", - "failed", - "completed", - "expired" - ] - }, - "step_details": { - "type": "object", - "description": "The details of the run step.", - "oneOf": [ - { - "$ref": "#/components/schemas/RunStepDetailsMessageCreationObject" - }, - { - "$ref": "#/components/schemas/RunStepDetailsToolCallsObject" - } - ], - "x-oaiExpandable": true - }, - "last_error": { - "type": "object", - "description": "The last error associated with this run step. Will be `null` if there are no errors.", - "nullable": true, - "properties": { - "code": { - "type": "string", - "description": "One of `server_error` or `rate_limit_exceeded`.", - "enum": [ - "server_error", - "rate_limit_exceeded" - ] - }, - "message": { - "type": "string", - "description": "A human-readable description of the error." - } - }, - "required": [ - "code", - "message" - ] - }, - "expired_at": { - "description": "The Unix timestamp (in seconds) for when the run step expired. A step is considered expired if the parent run is expired.", - "type": "integer", - "nullable": true - }, - "cancelled_at": { - "description": "The Unix timestamp (in seconds) for when the run step was cancelled.", - "type": "integer", - "nullable": true - }, - "failed_at": { - "description": "The Unix timestamp (in seconds) for when the run step failed.", - "type": "integer", - "nullable": true - }, - "completed_at": { - "description": "The Unix timestamp (in seconds) for when the run step completed.", - "type": "integer", - "nullable": true - }, - "metadata": { - "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", - "type": "object", - "x-oaiTypeLabel": "map", - "nullable": true - }, - "usage": { - "$ref": "#/components/schemas/RunStepCompletionUsage" - } - }, - "required": [ - "id", - "object", - "created_at", - "assistant_id", - "thread_id", - "run_id", - "type", - "status", - "step_details", - "last_error", - "expired_at", - "cancelled_at", - "failed_at", - "completed_at", - "metadata", - "usage" - ], - "x-oaiMeta": { - "name": "The run step object", - "beta": true, - "example": "{\n \"id\": \"step_abc123\",\n \"object\": \"thread.run.step\",\n \"created_at\": 1699063291,\n \"run_id\": \"run_abc123\",\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"type\": \"message_creation\",\n \"status\": \"completed\",\n \"cancelled_at\": null,\n \"completed_at\": 1699063291,\n \"expired_at\": null,\n \"failed_at\": null,\n \"last_error\": null,\n \"step_details\": {\n \"type\": \"message_creation\",\n \"message_creation\": {\n \"message_id\": \"msg_abc123\"\n }\n },\n \"usage\": {\n \"prompt_tokens\": 123,\n \"completion_tokens\": 456,\n \"total_tokens\": 579\n }\n}\n" - } - }, - "RunStepDeltaObject": { - "type": "object", - "title": "Run step delta object", - "description": "Represents a run step delta i.e. any changed fields on a run step during streaming.\n", - "properties": { - "id": { - "description": "The identifier of the run step, which can be referenced in API endpoints.", - "type": "string" - }, - "object": { - "description": "The object type, which is always `thread.run.step.delta`.", - "type": "string", - "enum": [ - "thread.run.step.delta" - ] - }, - "delta": { - "description": "The delta containing the fields that have changed on the run step.", - "type": "object", - "properties": { - "step_details": { - "type": "object", - "description": "The details of the run step.", - "oneOf": [ - { - "$ref": "#/components/schemas/RunStepDeltaStepDetailsMessageCreationObject" - }, - { - "$ref": "#/components/schemas/RunStepDeltaStepDetailsToolCallsObject" - } - ], - "x-oaiExpandable": true - } - } - } - }, - "required": [ - "id", - "object", - "delta" - ], - "x-oaiMeta": { - "name": "The run step delta object", - "beta": true, - "example": "{\n \"id\": \"step_123\",\n \"object\": \"thread.run.step.delta\",\n \"delta\": {\n \"step_details\": {\n \"type\": \"tool_calls\",\n \"tool_calls\": [\n {\n \"index\": 0,\n \"id\": \"call_123\",\n \"type\": \"code_interpreter\",\n \"code_interpreter\": { \"input\": \"\", \"outputs\": [] }\n }\n ]\n }\n }\n}\n" - } - }, - "ListRunStepsResponse": { - "properties": { - "object": { - "type": "string", - "example": "list" - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RunStepObject" - } - }, - "first_id": { - "type": "string", - "example": "step_abc123" - }, - "last_id": { - "type": "string", - "example": "step_abc456" - }, - "has_more": { - "type": "boolean", - "example": false - } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] - }, - "RunStepDetailsMessageCreationObject": { - "title": "Message creation", - "type": "object", - "description": "Details of the message creation by the run step.", - "properties": { - "type": { - "description": "Always `message_creation`.", - "type": "string", - "enum": [ - "message_creation" - ] - }, - "message_creation": { - "type": "object", - "properties": { - "message_id": { - "type": "string", - "description": "The ID of the message that was created by this run step." - } - }, - "required": [ - "message_id" - ] - } - }, - "required": [ - "type", - "message_creation" - ] - }, - "RunStepDeltaStepDetailsMessageCreationObject": { - "title": "Message creation", - "type": "object", - "description": "Details of the message creation by the run step.", - "properties": { - "type": { - "description": "Always `message_creation`.", - "type": "string", - "enum": [ - "message_creation" - ] - }, - "message_creation": { - "type": "object", - "properties": { - "message_id": { - "type": "string", - "description": "The ID of the message that was created by this run step." - } - } - } - }, - "required": [ - "type" - ] - }, - "RunStepDetailsToolCallsObject": { - "title": "Tool calls", - "type": "object", - "description": "Details of the tool call.", - "properties": { - "type": { - "description": "Always `tool_calls`.", - "type": "string", - "enum": [ - "tool_calls" - ] - }, - "tool_calls": { - "type": "array", - "description": "An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `file_search`, or `function`.\n", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/RunStepDetailsToolCallsCodeObject" - }, - { - "$ref": "#/components/schemas/RunStepDetailsToolCallsFileSearchObject" - }, - { - "$ref": "#/components/schemas/RunStepDetailsToolCallsFunctionObject" - } - ], - "x-oaiExpandable": true - } - } - }, - "required": [ - "type", - "tool_calls" - ] - }, - "RunStepDeltaStepDetailsToolCallsObject": { - "title": "Tool calls", - "type": "object", - "description": "Details of the tool call.", - "properties": { - "type": { - "description": "Always `tool_calls`.", - "type": "string", - "enum": [ - "tool_calls" - ] - }, - "tool_calls": { - "type": "array", - "description": "An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `file_search`, or `function`.\n", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/RunStepDeltaStepDetailsToolCallsCodeObject" - }, - { - "$ref": "#/components/schemas/RunStepDeltaStepDetailsToolCallsFileSearchObject" - }, - { - "$ref": "#/components/schemas/RunStepDeltaStepDetailsToolCallsFunctionObject" - } - ], - "x-oaiExpandable": true - } - } - }, - "required": [ - "type" - ] - }, - "RunStepDetailsToolCallsCodeObject": { - "title": "Code Interpreter tool call", - "type": "object", - "description": "Details of the Code Interpreter tool call the run step was involved in.", - "properties": { - "id": { - "type": "string", - "description": "The ID of the tool call." - }, - "type": { - "type": "string", - "description": "The type of tool call. This is always going to be `code_interpreter` for this type of tool call.", - "enum": [ - "code_interpreter" - ] - }, - "code_interpreter": { - "type": "object", - "description": "The Code Interpreter tool call definition.", - "required": [ - "input", - "outputs" - ], - "properties": { - "input": { - "type": "string", - "description": "The input to the Code Interpreter tool call." - }, - "outputs": { - "type": "array", - "description": "The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type.", - "items": { - "type": "object", - "oneOf": [ - { - "$ref": "#/components/schemas/RunStepDetailsToolCallsCodeOutputLogsObject" - }, - { - "$ref": "#/components/schemas/RunStepDetailsToolCallsCodeOutputImageObject" - } - ], - "x-oaiExpandable": true - } - } - } - } - }, - "required": [ - "id", - "type", - "code_interpreter" - ] - }, - "RunStepDeltaStepDetailsToolCallsCodeObject": { - "title": "Code interpreter tool call", - "type": "object", - "description": "Details of the Code Interpreter tool call the run step was involved in.", - "properties": { - "index": { - "type": "integer", - "description": "The index of the tool call in the tool calls array." - }, - "id": { - "type": "string", - "description": "The ID of the tool call." - }, - "type": { - "type": "string", - "description": "The type of tool call. This is always going to be `code_interpreter` for this type of tool call.", - "enum": [ - "code_interpreter" - ] - }, - "code_interpreter": { - "type": "object", - "description": "The Code Interpreter tool call definition.", - "properties": { - "input": { - "type": "string", - "description": "The input to the Code Interpreter tool call." - }, - "outputs": { - "type": "array", - "description": "The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type.", - "items": { - "type": "object", - "oneOf": [ - { - "$ref": "#/components/schemas/RunStepDeltaStepDetailsToolCallsCodeOutputLogsObject" - }, - { - "$ref": "#/components/schemas/RunStepDeltaStepDetailsToolCallsCodeOutputImageObject" - } - ], - "x-oaiExpandable": true - } - } - } - } - }, - "required": [ - "index", - "type" - ] - }, - "RunStepDetailsToolCallsCodeOutputLogsObject": { - "title": "Code Interpreter log output", - "type": "object", - "description": "Text output from the Code Interpreter tool call as part of a run step.", - "properties": { - "type": { - "description": "Always `logs`.", - "type": "string", - "enum": [ - "logs" - ] - }, - "logs": { - "type": "string", - "description": "The text output from the Code Interpreter tool call." - } - }, - "required": [ - "type", - "logs" - ] - }, - "RunStepDeltaStepDetailsToolCallsCodeOutputLogsObject": { - "title": "Code interpreter log output", - "type": "object", - "description": "Text output from the Code Interpreter tool call as part of a run step.", - "properties": { - "index": { - "type": "integer", - "description": "The index of the output in the outputs array." - }, - "type": { - "description": "Always `logs`.", - "type": "string", - "enum": [ - "logs" - ] - }, - "logs": { - "type": "string", - "description": "The text output from the Code Interpreter tool call." - } - }, - "required": [ - "index", - "type" - ] - }, - "RunStepDetailsToolCallsCodeOutputImageObject": { - "title": "Code Interpreter image output", - "type": "object", - "properties": { - "type": { - "description": "Always `image`.", - "type": "string", - "enum": [ - "image" - ] - }, - "image": { - "type": "object", - "properties": { - "file_id": { - "description": "The [file](/docs/api-reference/files) ID of the image.", - "type": "string" - } - }, - "required": [ - "file_id" - ] - } - }, - "required": [ - "type", - "image" - ] - }, - "RunStepDeltaStepDetailsToolCallsCodeOutputImageObject": { - "title": "Code interpreter image output", - "type": "object", - "properties": { - "index": { - "type": "integer", - "description": "The index of the output in the outputs array." - }, - "type": { - "description": "Always `image`.", - "type": "string", - "enum": [ - "image" - ] - }, - "image": { - "type": "object", - "properties": { - "file_id": { - "description": "The [file](/docs/api-reference/files) ID of the image.", - "type": "string" - } - } - } - }, - "required": [ - "index", - "type" - ] - }, - "RunStepDetailsToolCallsFileSearchObject": { - "title": "File search tool call", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "The ID of the tool call object." - }, - "type": { - "type": "string", - "description": "The type of tool call. This is always going to be `file_search` for this type of tool call.", - "enum": [ - "file_search" - ] - }, - "file_search": { - "type": "object", - "description": "For now, this is always going to be an empty object.", - "x-oaiTypeLabel": "map", - "properties": { - "ranking_options": { - "$ref": "#/components/schemas/RunStepDetailsToolCallsFileSearchRankingOptionsObject" - }, - "results": { - "type": "array", - "description": "The results of the file search.", - "items": { - "$ref": "#/components/schemas/RunStepDetailsToolCallsFileSearchResultObject" - } - } - } - } - }, - "required": [ - "id", - "type", - "file_search" - ] - }, - "RunStepDetailsToolCallsFileSearchRankingOptionsObject": { - "title": "File search tool call ranking options", - "type": "object", - "description": "The ranking options for the file search.", - "properties": { - "ranker": { - "type": "string", - "description": "The ranker used for the file search.", - "enum": [ - "default_2024_08_21" - ] - }, - "score_threshold": { - "type": "number", - "description": "The score threshold for the file search. All values must be a floating point number between 0 and 1.", - "minimum": 0, - "maximum": 1 - } - }, - "required": [ - "ranker", - "score_threshold" - ] - }, - "RunStepDetailsToolCallsFileSearchResultObject": { - "title": "File search tool call result", - "type": "object", - "description": "A result instance of the file search.", - "x-oaiTypeLabel": "map", - "properties": { - "file_id": { - "type": "string", - "description": "The ID of the file that result was found in." - }, - "file_name": { - "type": "string", - "description": "The name of the file that result was found in." - }, - "score": { - "type": "number", - "description": "The score of the result. All values must be a floating point number between 0 and 1.", - "minimum": 0, - "maximum": 1 - }, - "content": { - "type": "array", - "description": "The content of the result that was found. The content is only included if requested via the include query parameter.", - "items": { - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "The type of the content.", - "enum": [ - "text" - ] - }, - "text": { - "type": "string", - "description": "The text content of the file." - } - } - } - } - }, - "required": [ - "file_id", - "file_name", - "score" - ] - }, - "RunStepDeltaStepDetailsToolCallsFileSearchObject": { - "title": "File search tool call", - "type": "object", - "properties": { - "index": { - "type": "integer", - "description": "The index of the tool call in the tool calls array." - }, - "id": { - "type": "string", - "description": "The ID of the tool call object." - }, - "type": { - "type": "string", - "description": "The type of tool call. This is always going to be `file_search` for this type of tool call.", - "enum": [ - "file_search" - ] - }, - "file_search": { - "type": "object", - "description": "For now, this is always going to be an empty object.", - "x-oaiTypeLabel": "map" - } - }, - "required": [ - "index", - "type", - "file_search" - ] - }, - "RunStepDetailsToolCallsFunctionObject": { - "type": "object", - "title": "Function tool call", - "properties": { - "id": { - "type": "string", - "description": "The ID of the tool call object." - }, - "type": { - "type": "string", - "description": "The type of tool call. This is always going to be `function` for this type of tool call.", - "enum": [ - "function" - ] - }, - "function": { - "type": "object", - "description": "The definition of the function that was called.", - "properties": { - "name": { - "type": "string", - "description": "The name of the function." - }, - "arguments": { - "type": "string", - "description": "The arguments passed to the function." - }, - "output": { - "type": "string", - "description": "The output of the function. This will be `null` if the outputs have not been [submitted](/docs/api-reference/runs/submitToolOutputs) yet.", - "nullable": true - } - }, - "required": [ - "name", - "arguments", - "output" - ] - } - }, - "required": [ - "id", - "type", - "function" - ] - }, - "RunStepDeltaStepDetailsToolCallsFunctionObject": { - "type": "object", - "title": "Function tool call", - "properties": { - "index": { - "type": "integer", - "description": "The index of the tool call in the tool calls array." - }, - "id": { - "type": "string", - "description": "The ID of the tool call object." - }, - "type": { - "type": "string", - "description": "The type of tool call. This is always going to be `function` for this type of tool call.", - "enum": [ - "function" - ] - }, - "function": { - "type": "object", - "description": "The definition of the function that was called.", - "properties": { - "name": { - "type": "string", - "description": "The name of the function." - }, - "arguments": { - "type": "string", - "description": "The arguments passed to the function." - }, - "output": { - "type": "string", - "description": "The output of the function. This will be `null` if the outputs have not been [submitted](/docs/api-reference/runs/submitToolOutputs) yet.", - "nullable": true - } - } - } - }, - "required": [ - "index", - "type" - ] - }, - "VectorStoreExpirationAfter": { - "type": "object", - "title": "Vector store expiration policy", - "description": "The expiration policy for a vector store.", - "properties": { - "anchor": { - "description": "Anchor timestamp after which the expiration policy applies. Supported anchors: `last_active_at`.", - "type": "string", - "enum": [ - "last_active_at" - ] - }, - "days": { - "description": "The number of days after the anchor time that the vector store will expire.", - "type": "integer", - "minimum": 1, - "maximum": 365 - } - }, - "required": [ - "anchor", - "days" - ] - }, - "VectorStoreObject": { - "type": "object", - "title": "Vector store", - "description": "A vector store is a collection of processed files can be used by the `file_search` tool.", - "properties": { - "id": { - "description": "The identifier, which can be referenced in API endpoints.", - "type": "string" - }, - "object": { - "description": "The object type, which is always `vector_store`.", - "type": "string", - "enum": [ - "vector_store" - ] - }, - "created_at": { - "description": "The Unix timestamp (in seconds) for when the vector store was created.", - "type": "integer" - }, - "name": { - "description": "The name of the vector store.", - "type": "string" - }, - "usage_bytes": { - "description": "The total number of bytes used by the files in the vector store.", - "type": "integer" - }, - "file_counts": { - "type": "object", - "properties": { - "in_progress": { - "description": "The number of files that are currently being processed.", - "type": "integer" - }, - "completed": { - "description": "The number of files that have been successfully processed.", - "type": "integer" - }, - "failed": { - "description": "The number of files that have failed to process.", - "type": "integer" - }, - "cancelled": { - "description": "The number of files that were cancelled.", - "type": "integer" - }, - "total": { - "description": "The total number of files.", - "type": "integer" - } - }, - "required": [ - "in_progress", - "completed", - "failed", - "cancelled", - "total" - ] - }, - "status": { - "description": "The status of the vector store, which can be either `expired`, `in_progress`, or `completed`. A status of `completed` indicates that the vector store is ready for use.", - "type": "string", - "enum": [ - "expired", - "in_progress", - "completed" - ] - }, - "expires_after": { - "$ref": "#/components/schemas/VectorStoreExpirationAfter" - }, - "expires_at": { - "description": "The Unix timestamp (in seconds) for when the vector store will expire.", - "type": "integer", - "nullable": true - }, - "last_active_at": { - "description": "The Unix timestamp (in seconds) for when the vector store was last active.", - "type": "integer", - "nullable": true - }, - "metadata": { - "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", - "type": "object", - "x-oaiTypeLabel": "map", - "nullable": true - } - }, - "required": [ - "id", - "object", - "usage_bytes", - "created_at", - "status", - "last_active_at", - "name", - "file_counts", - "metadata" - ], - "x-oaiMeta": { - "name": "The vector store object", - "beta": true, - "example": "{\n \"id\": \"vs_123\",\n \"object\": \"vector_store\",\n \"created_at\": 1698107661,\n \"usage_bytes\": 123456,\n \"last_active_at\": 1698107661,\n \"name\": \"my_vector_store\",\n \"status\": \"completed\",\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 100,\n \"cancelled\": 0,\n \"failed\": 0,\n \"total\": 100\n },\n \"metadata\": {},\n \"last_used_at\": 1698107661\n}\n" - } - }, - "CreateVectorStoreRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "file_ids": { - "description": "A list of [File](/docs/api-reference/files) IDs that the vector store should use. Useful for tools like `file_search` that can access files.", - "type": "array", - "maxItems": 500, - "items": { - "type": "string" - } - }, - "name": { - "description": "The name of the vector store.", - "type": "string" - }, - "expires_after": { - "$ref": "#/components/schemas/VectorStoreExpirationAfter" - }, - "chunking_strategy": { - "type": "object", - "description": "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy. Only applicable if `file_ids` is non-empty.", - "oneOf": [ - { - "$ref": "#/components/schemas/AutoChunkingStrategyRequestParam" - }, - { - "$ref": "#/components/schemas/StaticChunkingStrategyRequestParam" - } - ], - "x-oaiExpandable": true - }, - "metadata": { - "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", - "type": "object", - "x-oaiTypeLabel": "map", - "nullable": true - } - } - }, - "UpdateVectorStoreRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "name": { - "description": "The name of the vector store.", - "type": "string", - "nullable": true - }, - "expires_after": { - "$ref": "#/components/schemas/VectorStoreExpirationAfter", - "nullable": true - }, - "metadata": { - "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", - "type": "object", - "x-oaiTypeLabel": "map", - "nullable": true - } - } - }, - "ListVectorStoresResponse": { - "properties": { - "object": { - "type": "string", - "example": "list" - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/VectorStoreObject" - } - }, - "first_id": { - "type": "string", - "example": "vs_abc123" - }, - "last_id": { - "type": "string", - "example": "vs_abc456" - }, - "has_more": { - "type": "boolean", - "example": false - } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] - }, - "DeleteVectorStoreResponse": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "deleted": { - "type": "boolean" - }, - "object": { - "type": "string", - "enum": [ - "vector_store.deleted" - ] - } - }, - "required": [ - "id", - "object", - "deleted" - ] - }, - "VectorStoreFileObject": { - "type": "object", - "title": "Vector store files", - "description": "A list of files attached to a vector store.", - "properties": { - "id": { - "description": "The identifier, which can be referenced in API endpoints.", - "type": "string" - }, - "object": { - "description": "The object type, which is always `vector_store.file`.", - "type": "string", - "enum": [ - "vector_store.file" - ] - }, - "usage_bytes": { - "description": "The total vector store usage in bytes. Note that this may be different from the original file size.", - "type": "integer" - }, - "created_at": { - "description": "The Unix timestamp (in seconds) for when the vector store file was created.", - "type": "integer" - }, - "vector_store_id": { - "description": "The ID of the [vector store](/docs/api-reference/vector-stores/object) that the [File](/docs/api-reference/files) is attached to.", - "type": "string" - }, - "status": { - "description": "The status of the vector store file, which can be either `in_progress`, `completed`, `cancelled`, or `failed`. The status `completed` indicates that the vector store file is ready for use.", - "type": "string", - "enum": [ - "in_progress", - "completed", - "cancelled", - "failed" - ] - }, - "last_error": { - "type": "object", - "description": "The last error associated with this vector store file. Will be `null` if there are no errors.", - "nullable": true, - "properties": { - "code": { - "type": "string", - "description": "One of `server_error` or `rate_limit_exceeded`.", - "enum": [ - "server_error", - "unsupported_file", - "invalid_file" - ] - }, - "message": { - "type": "string", - "description": "A human-readable description of the error." - } - }, - "required": [ - "code", - "message" - ] - }, - "chunking_strategy": { - "type": "object", - "description": "The strategy used to chunk the file.", - "oneOf": [ - { - "$ref": "#/components/schemas/StaticChunkingStrategyResponseParam" - }, - { - "$ref": "#/components/schemas/OtherChunkingStrategyResponseParam" - } - ], - "x-oaiExpandable": true - } - }, - "required": [ - "id", - "object", - "usage_bytes", - "created_at", - "vector_store_id", - "status", - "last_error" - ], - "x-oaiMeta": { - "name": "The vector store file object", - "beta": true, - "example": "{\n \"id\": \"file-abc123\",\n \"object\": \"vector_store.file\",\n \"usage_bytes\": 1234,\n \"created_at\": 1698107661,\n \"vector_store_id\": \"vs_abc123\",\n \"status\": \"completed\",\n \"last_error\": null,\n \"chunking_strategy\": {\n \"type\": \"static\",\n \"static\": {\n \"max_chunk_size_tokens\": 800,\n \"chunk_overlap_tokens\": 400\n }\n }\n}\n" - } - }, - "OtherChunkingStrategyResponseParam": { - "type": "object", - "title": "Other Chunking Strategy", - "description": "This is returned when the chunking strategy is unknown. Typically, this is because the file was indexed before the `chunking_strategy` concept was introduced in the API.", - "additionalProperties": false, - "properties": { - "type": { - "type": "string", - "description": "Always `other`.", - "enum": [ - "other" - ] - } - }, - "required": [ - "type" - ] - }, - "StaticChunkingStrategyResponseParam": { - "type": "object", - "title": "Static Chunking Strategy", - "additionalProperties": false, - "properties": { - "type": { - "type": "string", - "description": "Always `static`.", - "enum": [ - "static" - ] - }, - "static": { - "$ref": "#/components/schemas/StaticChunkingStrategy" - } - }, - "required": [ - "type", - "static" - ] - }, - "StaticChunkingStrategy": { - "type": "object", - "additionalProperties": false, - "properties": { - "max_chunk_size_tokens": { - "type": "integer", - "minimum": 100, - "maximum": 4096, - "description": "The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`." - }, - "chunk_overlap_tokens": { - "type": "integer", - "description": "The number of tokens that overlap between chunks. The default value is `400`.\n\nNote that the overlap must not exceed half of `max_chunk_size_tokens`.\n" - } - }, - "required": [ - "max_chunk_size_tokens", - "chunk_overlap_tokens" - ] - }, - "AutoChunkingStrategyRequestParam": { - "type": "object", - "title": "Auto Chunking Strategy", - "description": "The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.", - "additionalProperties": false, - "properties": { - "type": { - "type": "string", - "description": "Always `auto`.", - "enum": [ - "auto" - ] - } - }, - "required": [ - "type" - ] - }, - "StaticChunkingStrategyRequestParam": { - "type": "object", - "title": "Static Chunking Strategy", - "additionalProperties": false, - "properties": { - "type": { - "type": "string", - "description": "Always `static`.", - "enum": [ - "static" - ] - }, - "static": { - "$ref": "#/components/schemas/StaticChunkingStrategy" - } - }, - "required": [ - "type", - "static" - ] - }, - "ChunkingStrategyRequestParam": { - "type": "object", - "description": "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy.", - "oneOf": [ - { - "$ref": "#/components/schemas/AutoChunkingStrategyRequestParam" - }, - { - "$ref": "#/components/schemas/StaticChunkingStrategyRequestParam" - } - ], - "x-oaiExpandable": true - }, - "CreateVectorStoreFileRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "file_id": { - "description": "A [File](/docs/api-reference/files) ID that the vector store should use. Useful for tools like `file_search` that can access files.", - "type": "string" - }, - "chunking_strategy": { - "$ref": "#/components/schemas/ChunkingStrategyRequestParam" - } - }, - "required": [ - "file_id" - ] - }, - "ListVectorStoreFilesResponse": { - "properties": { - "object": { - "type": "string", - "example": "list" - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/VectorStoreFileObject" - } - }, - "first_id": { - "type": "string", - "example": "file-abc123" - }, - "last_id": { - "type": "string", - "example": "file-abc456" - }, - "has_more": { - "type": "boolean", - "example": false - } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] - }, - "DeleteVectorStoreFileResponse": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "deleted": { - "type": "boolean" - }, - "object": { - "type": "string", - "enum": [ - "vector_store.file.deleted" - ] - } - }, - "required": [ - "id", - "object", - "deleted" - ] - }, - "VectorStoreFileBatchObject": { - "type": "object", - "title": "Vector store file batch", - "description": "A batch of files attached to a vector store.", - "properties": { - "id": { - "description": "The identifier, which can be referenced in API endpoints.", - "type": "string" - }, - "object": { - "description": "The object type, which is always `vector_store.file_batch`.", - "type": "string", - "enum": [ - "vector_store.files_batch" - ] - }, - "created_at": { - "description": "The Unix timestamp (in seconds) for when the vector store files batch was created.", - "type": "integer" - }, - "vector_store_id": { - "description": "The ID of the [vector store](/docs/api-reference/vector-stores/object) that the [File](/docs/api-reference/files) is attached to.", - "type": "string" - }, - "status": { - "description": "The status of the vector store files batch, which can be either `in_progress`, `completed`, `cancelled` or `failed`.", - "type": "string", - "enum": [ - "in_progress", - "completed", - "cancelled", - "failed" - ] - }, - "file_counts": { - "type": "object", - "properties": { - "in_progress": { - "description": "The number of files that are currently being processed.", - "type": "integer" - }, - "completed": { - "description": "The number of files that have been processed.", - "type": "integer" - }, - "failed": { - "description": "The number of files that have failed to process.", - "type": "integer" - }, - "cancelled": { - "description": "The number of files that where cancelled.", - "type": "integer" - }, - "total": { - "description": "The total number of files.", - "type": "integer" - } - }, - "required": [ - "in_progress", - "completed", - "cancelled", - "failed", - "total" - ] - } - }, - "required": [ - "id", - "object", - "created_at", - "vector_store_id", - "status", - "file_counts" - ], - "x-oaiMeta": { - "name": "The vector store files batch object", - "beta": true, - "example": "{\n \"id\": \"vsfb_123\",\n \"object\": \"vector_store.files_batch\",\n \"created_at\": 1698107661,\n \"vector_store_id\": \"vs_abc123\",\n \"status\": \"completed\",\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 100,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 100\n }\n}\n" - } - }, - "CreateVectorStoreFileBatchRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "file_ids": { - "description": "A list of [File](/docs/api-reference/files) IDs that the vector store should use. Useful for tools like `file_search` that can access files.", - "type": "array", - "minItems": 1, - "maxItems": 500, - "items": { - "type": "string" - } - }, - "chunking_strategy": { - "$ref": "#/components/schemas/ChunkingStrategyRequestParam" - } - }, - "required": [ - "file_ids" - ] - }, - "AssistantStreamEvent": { - "description": "Represents an event emitted when streaming a Run.\n\nEach event in a server-sent events stream has an `event` and `data` property:\n\n```\nevent: thread.created\ndata: {\"id\": \"thread_123\", \"object\": \"thread\", ...}\n```\n\nWe emit events whenever a new object is created, transitions to a new state, or is being\nstreamed in parts (deltas). For example, we emit `thread.run.created` when a new run\nis created, `thread.run.completed` when a run completes, and so on. When an Assistant chooses\nto create a message during a run, we emit a `thread.message.created event`, a\n`thread.message.in_progress` event, many `thread.message.delta` events, and finally a\n`thread.message.completed` event.\n\nWe may add additional events over time, so we recommend handling unknown events gracefully\nin your code. See the [Assistants API quickstart](/docs/assistants/overview) to learn how to\nintegrate the Assistants API with streaming.\n", - "oneOf": [ - { - "$ref": "#/components/schemas/ThreadStreamEvent" - }, - { - "$ref": "#/components/schemas/RunStreamEvent" - }, - { - "$ref": "#/components/schemas/RunStepStreamEvent" - }, - { - "$ref": "#/components/schemas/MessageStreamEvent" - }, - { - "$ref": "#/components/schemas/ErrorEvent" - }, - { - "$ref": "#/components/schemas/DoneEvent" - } - ], - "x-oaiMeta": { - "name": "Assistant stream events", - "beta": true - } - }, - "ThreadStreamEvent": { - "oneOf": [ - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.created" - ] - }, - "data": { - "$ref": "#/components/schemas/ThreadObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a new [thread](/docs/api-reference/threads/object) is created.", - "x-oaiMeta": { - "dataDescription": "`data` is a [thread](/docs/api-reference/threads/object)" - } - } - ] - }, - "RunStreamEvent": { - "oneOf": [ - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.run.created" - ] - }, - "data": { - "$ref": "#/components/schemas/RunObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a new [run](/docs/api-reference/runs/object) is created.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run](/docs/api-reference/runs/object)" - } - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.run.queued" - ] - }, - "data": { - "$ref": "#/components/schemas/RunObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a [run](/docs/api-reference/runs/object) moves to a `queued` status.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run](/docs/api-reference/runs/object)" - } - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.run.in_progress" - ] - }, - "data": { - "$ref": "#/components/schemas/RunObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a [run](/docs/api-reference/runs/object) moves to an `in_progress` status.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run](/docs/api-reference/runs/object)" - } - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.run.requires_action" - ] - }, - "data": { - "$ref": "#/components/schemas/RunObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a [run](/docs/api-reference/runs/object) moves to a `requires_action` status.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run](/docs/api-reference/runs/object)" - } - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.run.completed" - ] - }, - "data": { - "$ref": "#/components/schemas/RunObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a [run](/docs/api-reference/runs/object) is completed.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run](/docs/api-reference/runs/object)" - } - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.run.incomplete" - ] - }, - "data": { - "$ref": "#/components/schemas/RunObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a [run](/docs/api-reference/runs/object) ends with status `incomplete`.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run](/docs/api-reference/runs/object)" - } - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.run.failed" - ] - }, - "data": { - "$ref": "#/components/schemas/RunObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a [run](/docs/api-reference/runs/object) fails.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run](/docs/api-reference/runs/object)" - } - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.run.cancelling" - ] - }, - "data": { - "$ref": "#/components/schemas/RunObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a [run](/docs/api-reference/runs/object) moves to a `cancelling` status.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run](/docs/api-reference/runs/object)" - } - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.run.cancelled" - ] - }, - "data": { - "$ref": "#/components/schemas/RunObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a [run](/docs/api-reference/runs/object) is cancelled.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run](/docs/api-reference/runs/object)" - } - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.run.expired" - ] - }, - "data": { - "$ref": "#/components/schemas/RunObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a [run](/docs/api-reference/runs/object) expires.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run](/docs/api-reference/runs/object)" - } - } - ] - }, - "RunStepStreamEvent": { - "oneOf": [ - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.run.step.created" - ] - }, - "data": { - "$ref": "#/components/schemas/RunStepObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a [run step](/docs/api-reference/run-steps/step-object) is created.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run step](/docs/api-reference/run-steps/step-object)" - } - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.run.step.in_progress" - ] - }, - "data": { - "$ref": "#/components/schemas/RunStepObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a [run step](/docs/api-reference/run-steps/step-object) moves to an `in_progress` state.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run step](/docs/api-reference/run-steps/step-object)" - } - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.run.step.delta" - ] - }, - "data": { - "$ref": "#/components/schemas/RunStepDeltaObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when parts of a [run step](/docs/api-reference/run-steps/step-object) are being streamed.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run step delta](/docs/api-reference/assistants-streaming/run-step-delta-object)" - } - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.run.step.completed" - ] - }, - "data": { - "$ref": "#/components/schemas/RunStepObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a [run step](/docs/api-reference/run-steps/step-object) is completed.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run step](/docs/api-reference/run-steps/step-object)" - } - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.run.step.failed" - ] - }, - "data": { - "$ref": "#/components/schemas/RunStepObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a [run step](/docs/api-reference/run-steps/step-object) fails.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run step](/docs/api-reference/run-steps/step-object)" - } - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.run.step.cancelled" - ] - }, - "data": { - "$ref": "#/components/schemas/RunStepObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a [run step](/docs/api-reference/run-steps/step-object) is cancelled.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run step](/docs/api-reference/run-steps/step-object)" - } - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.run.step.expired" - ] - }, - "data": { - "$ref": "#/components/schemas/RunStepObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a [run step](/docs/api-reference/run-steps/step-object) expires.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run step](/docs/api-reference/run-steps/step-object)" - } - } - ] - }, - "MessageStreamEvent": { - "oneOf": [ - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.message.created" - ] - }, - "data": { - "$ref": "#/components/schemas/MessageObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a [message](/docs/api-reference/messages/object) is created.", - "x-oaiMeta": { - "dataDescription": "`data` is a [message](/docs/api-reference/messages/object)" - } - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.message.in_progress" - ] - }, - "data": { - "$ref": "#/components/schemas/MessageObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a [message](/docs/api-reference/messages/object) moves to an `in_progress` state.", - "x-oaiMeta": { - "dataDescription": "`data` is a [message](/docs/api-reference/messages/object)" - } - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.message.delta" - ] - }, - "data": { - "$ref": "#/components/schemas/MessageDeltaObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when parts of a [Message](/docs/api-reference/messages/object) are being streamed.", - "x-oaiMeta": { - "dataDescription": "`data` is a [message delta](/docs/api-reference/assistants-streaming/message-delta-object)" - } - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.message.completed" - ] - }, - "data": { - "$ref": "#/components/schemas/MessageObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a [message](/docs/api-reference/messages/object) is completed.", - "x-oaiMeta": { - "dataDescription": "`data` is a [message](/docs/api-reference/messages/object)" - } - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.message.incomplete" - ] - }, - "data": { - "$ref": "#/components/schemas/MessageObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a [message](/docs/api-reference/messages/object) ends before it is completed.", - "x-oaiMeta": { - "dataDescription": "`data` is a [message](/docs/api-reference/messages/object)" - } - } - ] - }, - "ErrorEvent": { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "error" - ] - }, - "data": { - "$ref": "#/components/schemas/Error" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when an [error](/docs/guides/error-codes/api-errors) occurs. This can happen due to an internal server error or a timeout.", - "x-oaiMeta": { - "dataDescription": "`data` is an [error](/docs/guides/error-codes/api-errors)" - } - }, - "DoneEvent": { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "done" - ] - }, - "data": { - "type": "string", - "enum": [ - "[DONE]" - ] - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a stream ends.", - "x-oaiMeta": { - "dataDescription": "`data` is `[DONE]`" - } - }, - "Batch": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "object": { - "type": "string", - "enum": [ - "batch" - ], - "description": "The object type, which is always `batch`." - }, - "endpoint": { - "type": "string", - "description": "The OpenAI API endpoint used by the batch." - }, - "errors": { - "type": "object", - "properties": { - "object": { - "type": "string", - "description": "The object type, which is always `list`." - }, - "data": { - "type": "array", - "items": { - "type": "object", - "properties": { - "code": { - "type": "string", - "description": "An error code identifying the error type." - }, - "message": { - "type": "string", - "description": "A human-readable message providing more details about the error." - }, - "param": { - "type": "string", - "description": "The name of the parameter that caused the error, if applicable.", - "nullable": true - }, - "line": { - "type": "integer", - "description": "The line number of the input file where the error occurred, if applicable.", - "nullable": true - } - } - } - } - } - }, - "input_file_id": { - "type": "string", - "description": "The ID of the input file for the batch." - }, - "completion_window": { - "type": "string", - "description": "The time frame within which the batch should be processed." - }, - "status": { - "type": "string", - "description": "The current status of the batch.", - "enum": [ - "validating", - "failed", - "in_progress", - "finalizing", - "completed", - "expired", - "cancelling", - "cancelled" - ] - }, - "output_file_id": { - "type": "string", - "description": "The ID of the file containing the outputs of successfully executed requests." - }, - "error_file_id": { - "type": "string", - "description": "The ID of the file containing the outputs of requests with errors." - }, - "created_at": { - "type": "integer", - "description": "The Unix timestamp (in seconds) for when the batch was created." - }, - "in_progress_at": { - "type": "integer", - "description": "The Unix timestamp (in seconds) for when the batch started processing." - }, - "expires_at": { - "type": "integer", - "description": "The Unix timestamp (in seconds) for when the batch will expire." - }, - "finalizing_at": { - "type": "integer", - "description": "The Unix timestamp (in seconds) for when the batch started finalizing." - }, - "completed_at": { - "type": "integer", - "description": "The Unix timestamp (in seconds) for when the batch was completed." - }, - "failed_at": { - "type": "integer", - "description": "The Unix timestamp (in seconds) for when the batch failed." - }, - "expired_at": { - "type": "integer", - "description": "The Unix timestamp (in seconds) for when the batch expired." - }, - "cancelling_at": { - "type": "integer", - "description": "The Unix timestamp (in seconds) for when the batch started cancelling." - }, - "cancelled_at": { - "type": "integer", - "description": "The Unix timestamp (in seconds) for when the batch was cancelled." - }, - "request_counts": { - "type": "object", - "properties": { - "total": { - "type": "integer", - "description": "Total number of requests in the batch." - }, - "completed": { - "type": "integer", - "description": "Number of requests that have been completed successfully." - }, - "failed": { - "type": "integer", - "description": "Number of requests that have failed." - } - }, - "required": [ - "total", - "completed", - "failed" - ], - "description": "The request counts for different statuses within the batch." - }, - "metadata": { - "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", - "type": "object", - "x-oaiTypeLabel": "map", - "nullable": true - } - }, - "required": [ - "id", - "object", - "endpoint", - "input_file_id", - "completion_window", - "status", - "created_at" - ], - "x-oaiMeta": { - "name": "The batch object", - "example": "{\n \"id\": \"batch_abc123\",\n \"object\": \"batch\",\n \"endpoint\": \"/v1/completions\",\n \"errors\": null,\n \"input_file_id\": \"file-abc123\",\n \"completion_window\": \"24h\",\n \"status\": \"completed\",\n \"output_file_id\": \"file-cvaTdG\",\n \"error_file_id\": \"file-HOWS94\",\n \"created_at\": 1711471533,\n \"in_progress_at\": 1711471538,\n \"expires_at\": 1711557933,\n \"finalizing_at\": 1711493133,\n \"completed_at\": 1711493163,\n \"failed_at\": null,\n \"expired_at\": null,\n \"cancelling_at\": null,\n \"cancelled_at\": null,\n \"request_counts\": {\n \"total\": 100,\n \"completed\": 95,\n \"failed\": 5\n },\n \"metadata\": {\n \"customer_id\": \"user_123456789\",\n \"batch_description\": \"Nightly eval job\",\n }\n}\n" - } - }, - "BatchRequestInput": { - "type": "object", - "description": "The per-line object of the batch input file", - "properties": { - "custom_id": { - "type": "string", - "description": "A developer-provided per-request id that will be used to match outputs to inputs. Must be unique for each request in a batch." - }, - "method": { - "type": "string", - "enum": [ - "POST" - ], - "description": "The HTTP method to be used for the request. Currently only `POST` is supported." - }, - "url": { - "type": "string", - "description": "The OpenAI API relative URL to be used for the request. Currently `/v1/chat/completions`, `/v1/embeddings`, and `/v1/completions` are supported." - } - }, - "x-oaiMeta": { - "name": "The request input object", - "example": "{\"custom_id\": \"request-1\", \"method\": \"POST\", \"url\": \"/v1/chat/completions\", \"body\": {\"model\": \"gpt-4o-mini\", \"messages\": [{\"role\": \"system\", \"content\": \"You are a helpful assistant.\"}, {\"role\": \"user\", \"content\": \"What is 2+2?\"}]}}\n" - } - }, - "BatchRequestOutput": { - "type": "object", - "description": "The per-line object of the batch output and error files", - "properties": { - "id": { - "type": "string" - }, - "custom_id": { - "type": "string", - "description": "A developer-provided per-request id that will be used to match outputs to inputs." - }, - "response": { - "type": "object", - "nullable": true, - "properties": { - "status_code": { - "type": "integer", - "description": "The HTTP status code of the response" - }, - "request_id": { - "type": "string", - "description": "An unique identifier for the OpenAI API request. Please include this request ID when contacting support." - }, - "body": { - "type": "object", - "x-oaiTypeLabel": "map", - "description": "The JSON body of the response" - } - } - }, - "error": { - "type": "object", - "nullable": true, - "description": "For requests that failed with a non-HTTP error, this will contain more information on the cause of the failure.", - "properties": { - "code": { - "type": "string", - "description": "A machine-readable error code." - }, - "message": { - "type": "string", - "description": "A human-readable error message." - } - } - } - }, - "x-oaiMeta": { - "name": "The request output object", - "example": "{\"id\": \"batch_req_wnaDys\", \"custom_id\": \"request-2\", \"response\": {\"status_code\": 200, \"request_id\": \"req_c187b3\", \"body\": {\"id\": \"chatcmpl-9758Iw\", \"object\": \"chat.completion\", \"created\": 1711475054, \"model\": \"gpt-4o-mini\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"2 + 2 equals 4.\"}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 24, \"completion_tokens\": 15, \"total_tokens\": 39}, \"system_fingerprint\": null}}, \"error\": null}\n" - } - }, - "ListBatchesResponse": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Batch" - } - }, - "first_id": { - "type": "string", - "example": "batch_abc123" - }, - "last_id": { - "type": "string", - "example": "batch_abc456" - }, - "has_more": { - "type": "boolean" - }, - "object": { - "type": "string", - "enum": [ - "list" - ] - } - }, - "required": [ - "object", - "data", - "has_more" - ] - }, - "AuditLogActorServiceAccount": { - "type": "object", - "description": "The service account that performed the audit logged action.", - "properties": { - "id": { - "type": "string", - "description": "The service account id." - } - } - }, - "AuditLogActorUser": { - "type": "object", - "description": "The user who performed the audit logged action.", - "properties": { - "id": { - "type": "string", - "description": "The user id." - }, - "email": { - "type": "string", - "description": "The user email." - } - } - }, - "AuditLogActorApiKey": { - "type": "object", - "description": "The API Key used to perform the audit logged action.", - "properties": { - "id": { - "type": "string", - "description": "The tracking id of the API key." - }, - "type": { - "type": "string", - "description": "The type of API key. Can be either `user` or `service_account`.", - "enum": [ - "user", - "service_account" - ] - }, - "user": { - "$ref": "#/components/schemas/AuditLogActorUser" - }, - "service_account": { - "$ref": "#/components/schemas/AuditLogActorServiceAccount" - } - } - }, - "AuditLogActorSession": { - "type": "object", - "description": "The session in which the audit logged action was performed.", - "properties": { - "user": { - "$ref": "#/components/schemas/AuditLogActorUser" - }, - "ip_address": { - "type": "string", - "description": "The IP address from which the action was performed." - } - } - }, - "AuditLogActor": { - "type": "object", - "description": "The actor who performed the audit logged action.", - "properties": { - "type": { - "type": "string", - "description": "The type of actor. Is either `session` or `api_key`.", - "enum": [ - "session", - "api_key" - ] - }, - "session": { - "type": "object", - "$ref": "#/components/schemas/AuditLogActorSession" - }, - "api_key": { - "type": "object", - "$ref": "#/components/schemas/AuditLogActorApiKey" - } - } - }, - "AuditLogEventType": { - "type": "string", - "description": "The event type.", - "x-oaiExpandable": true, - "enum": [ - "api_key.created", - "api_key.updated", - "api_key.deleted", - "invite.sent", - "invite.accepted", - "invite.deleted", - "login.succeeded", - "login.failed", - "logout.succeeded", - "logout.failed", - "organization.updated", - "project.created", - "project.updated", - "project.archived", - "service_account.created", - "service_account.updated", - "service_account.deleted", - "user.added", - "user.updated", - "user.deleted" - ] - }, - "AuditLog": { - "type": "object", - "description": "A log of a user action or configuration change within this organization.", - "properties": { - "id": { - "type": "string", - "description": "The ID of this log." - }, - "type": { - "$ref": "#/components/schemas/AuditLogEventType" - }, - "effective_at": { - "type": "integer", - "description": "The Unix timestamp (in seconds) of the event." - }, - "project": { - "type": "object", - "description": "The project that the action was scoped to. Absent for actions not scoped to projects.", - "properties": { - "id": { - "type": "string", - "description": "The project ID." - }, - "name": { - "type": "string", - "description": "The project title." - } - } - }, - "actor": { - "$ref": "#/components/schemas/AuditLogActor" - }, - "api_key.created": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The tracking ID of the API key." - }, - "data": { - "type": "object", - "description": "The payload used to create the API key.", - "properties": { - "scopes": { - "type": "array", - "items": { - "type": "string" - }, - "description": "A list of scopes allowed for the API key, e.g. `[\"api.model.request\"]`" - } - } - } - } - }, - "api_key.updated": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The tracking ID of the API key." - }, - "changes_requested": { - "type": "object", - "description": "The payload used to update the API key.", - "properties": { - "scopes": { - "type": "array", - "items": { - "type": "string" - }, - "description": "A list of scopes allowed for the API key, e.g. `[\"api.model.request\"]`" - } - } - } - } - }, - "api_key.deleted": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The tracking ID of the API key." - } - } - }, - "invite.sent": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The ID of the invite." - }, - "data": { - "type": "object", - "description": "The payload used to create the invite.", - "properties": { - "email": { - "type": "string", - "description": "The email invited to the organization." - }, - "role": { - "type": "string", - "description": "The role the email was invited to be. Is either `owner` or `member`." - } - } - } - } - }, - "invite.accepted": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The ID of the invite." - } - } - }, - "invite.deleted": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The ID of the invite." - } - } - }, - "login.failed": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "error_code": { - "type": "string", - "description": "The error code of the failure." - }, - "error_message": { - "type": "string", - "description": "The error message of the failure." - } - } - }, - "logout.failed": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "error_code": { - "type": "string", - "description": "The error code of the failure." - }, - "error_message": { - "type": "string", - "description": "The error message of the failure." - } - } - }, - "organization.updated": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The organization ID." - }, - "changes_requested": { - "type": "object", - "description": "The payload used to update the organization settings.", - "properties": { - "title": { - "type": "string", - "description": "The organization title." - }, - "description": { - "type": "string", - "description": "The organization description." - }, - "name": { - "type": "string", - "description": "The organization name." - }, - "settings": { - "type": "object", - "properties": { - "threads_ui_visibility": { - "type": "string", - "description": "Visibility of the threads page which shows messages created with the Assistants API and Playground. One of `ANY_ROLE`, `OWNERS`, or `NONE`." - }, - "usage_dashboard_visibility": { - "type": "string", - "description": "Visibility of the usage dashboard which shows activity and costs for your organization. One of `ANY_ROLE` or `OWNERS`." - } - } - } - } - } - } - }, - "project.created": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The project ID." - }, - "data": { - "type": "object", - "description": "The payload used to create the project.", - "properties": { - "name": { - "type": "string", - "description": "The project name." - }, - "title": { - "type": "string", - "description": "The title of the project as seen on the dashboard." - } - } - } - } - }, - "project.updated": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The project ID." - }, - "changes_requested": { - "type": "object", - "description": "The payload used to update the project.", - "properties": { - "title": { - "type": "string", - "description": "The title of the project as seen on the dashboard." - } - } - } - } - }, - "project.archived": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The project ID." - } - } - }, - "service_account.created": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The service account ID." - }, - "data": { - "type": "object", - "description": "The payload used to create the service account.", - "properties": { - "role": { - "type": "string", - "description": "The role of the service account. Is either `owner` or `member`." - } - } - } - } - }, - "service_account.updated": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The service account ID." - }, - "changes_requested": { - "type": "object", - "description": "The payload used to updated the service account.", - "properties": { - "role": { - "type": "string", - "description": "The role of the service account. Is either `owner` or `member`." - } - } - } - } - }, - "service_account.deleted": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The service account ID." - } - } - }, - "user.added": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The user ID." - }, - "data": { - "type": "object", - "description": "The payload used to add the user to the project.", - "properties": { - "role": { - "type": "string", - "description": "The role of the user. Is either `owner` or `member`." - } - } - } - } - }, - "user.updated": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The project ID." - }, - "changes_requested": { - "type": "object", - "description": "The payload used to update the user.", - "properties": { - "role": { - "type": "string", - "description": "The role of the user. Is either `owner` or `member`." - } - } - } - } - }, - "user.deleted": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The user ID." - } - } - } - }, - "required": [ - "id", - "type", - "effective_at", - "actor" - ], - "x-oaiMeta": { - "name": "The audit log object", - "example": "{\n \"id\": \"req_xxx_20240101\",\n \"type\": \"api_key.created\",\n \"effective_at\": 1720804090,\n \"actor\": {\n \"type\": \"session\",\n \"session\": {\n \"user\": {\n \"id\": \"user-xxx\",\n \"email\": \"user@example.com\"\n },\n \"ip_address\": \"127.0.0.1\",\n \"user_agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36\"\n }\n },\n \"api_key.created\": {\n \"id\": \"key_xxxx\",\n \"data\": {\n \"scopes\": [\"resource.operation\"]\n }\n }\n}\n" - } - }, - "ListAuditLogsResponse": { - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ] - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/AuditLog" - } - }, - "first_id": { - "type": "string", - "example": "audit_log-defb456h8dks" - }, - "last_id": { - "type": "string", - "example": "audit_log-hnbkd8s93s" - }, - "has_more": { - "type": "boolean" - } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] - }, - "Invite": { - "type": "object", - "description": "Represents an individual `invite` to the organization.", - "properties": { - "object": { - "type": "string", - "enum": [ - "organization.invite" - ], - "description": "The object type, which is always `organization.invite`" - }, - "id": { - "type": "string", - "description": "The identifier, which can be referenced in API endpoints" - }, - "email": { - "type": "string", - "description": "The email address of the individual to whom the invite was sent" - }, - "role": { - "type": "string", - "enum": [ - "owner", - "reader" - ], - "description": "`owner` or `reader`" - }, - "status": { - "type": "string", - "enum": [ - "accepted", - "expired", - "pending" - ], - "description": "`accepted`,`expired`, or `pending`" - }, - "invited_at": { - "type": "integer", - "description": "The Unix timestamp (in seconds) of when the invite was sent." - }, - "expires_at": { - "type": "integer", - "description": "The Unix timestamp (in seconds) of when the invite expires." - }, - "accepted_at": { - "type": "integer", - "description": "The Unix timestamp (in seconds) of when the invite was accepted." - } - }, - "required": [ - "object", - "id", - "email", - "role", - "status", - "invited_at", - "expires_at" - ], - "x-oaiMeta": { - "name": "The invite object", - "example": "{\n \"object\": \"organization.invite\",\n \"id\": \"invite-abc\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"status\": \"accepted\",\n \"invited_at\": 1711471533,\n \"expires_at\": 1711471533,\n \"accepted_at\": 1711471533\n}\n" - } - }, - "InviteListResponse": { - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ], - "description": "The object type, which is always `list`" - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Invite" - } - }, - "first_id": { - "type": "string", - "description": "The first `invite_id` in the retrieved `list`" - }, - "last_id": { - "type": "string", - "description": "The last `invite_id` in the retrieved `list`" - }, - "has_more": { - "type": "boolean", - "description": "The `has_more` property is used for pagination to indicate there are additional results." - } - }, - "required": [ - "object", - "data" - ] - }, - "InviteRequest": { - "type": "object", - "properties": { - "email": { - "type": "string", - "description": "Send an email to this address" - }, - "role": { - "type": "string", - "enum": [ - "reader", - "owner" - ], - "description": "`owner` or `reader`" - } - }, - "required": [ - "email", - "role" - ] - }, - "InviteDeleteResponse": { - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "organization.invite.deleted" - ], - "description": "The object type, which is always `organization.invite.deleted`" - }, - "id": { - "type": "string" - }, - "deleted": { - "type": "boolean" - } - }, - "required": [ - "object", - "id", - "deleted" - ] - }, - "User": { - "type": "object", - "description": "Represents an individual `user` within an organization.", - "properties": { - "object": { - "type": "string", - "enum": [ - "organization.user" - ], - "description": "The object type, which is always `organization.user`" - }, - "id": { - "type": "string", - "description": "The identifier, which can be referenced in API endpoints" - }, - "name": { - "type": "string", - "description": "The name of the user" - }, - "email": { - "type": "string", - "description": "The email address of the user" - }, - "role": { - "type": "string", - "enum": [ - "owner", - "reader" - ], - "description": "`owner` or `reader`" - }, - "added_at": { - "type": "integer", - "description": "The Unix timestamp (in seconds) of when the user was added." - } - }, - "required": [ - "object", - "id", - "name", - "email", - "role", - "added_at" - ], - "x-oaiMeta": { - "name": "The user object", - "example": "{\n \"object\": \"organization.user\",\n \"id\": \"user_abc\",\n \"name\": \"First Last\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"added_at\": 1711471533\n}\n" - } - }, - "UserListResponse": { - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ] - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/User" - } - }, - "first_id": { - "type": "string" - }, - "last_id": { - "type": "string" - }, - "has_more": { - "type": "boolean" - } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] - }, - "UserRoleUpdateRequest": { - "type": "object", - "properties": { - "role": { - "type": "string", - "enum": [ - "owner", - "reader" - ], - "description": "`owner` or `reader`" - } - }, - "required": [ - "role" - ] - }, - "UserDeleteResponse": { - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "organization.user.deleted" - ] - }, - "id": { - "type": "string" - }, - "deleted": { - "type": "boolean" - } - }, - "required": [ - "object", - "id", - "deleted" - ] - }, - "Project": { - "type": "object", - "description": "Represents an individual project.", - "properties": { - "id": { - "type": "string", - "description": "The identifier, which can be referenced in API endpoints" - }, - "object": { - "type": "string", - "enum": [ - "organization.project" - ], - "description": "The object type, which is always `organization.project`" - }, - "name": { - "type": "string", - "description": "The name of the project. This appears in reporting." - }, - "created_at": { - "type": "integer", - "description": "The Unix timestamp (in seconds) of when the project was created." - }, - "archived_at": { - "type": "integer", - "nullable": true, - "description": "The Unix timestamp (in seconds) of when the project was archived or `null`." - }, - "status": { - "type": "string", - "enum": [ - "active", - "archived" - ], - "description": "`active` or `archived`" - }, - "app_use_case": { - "type": "string", - "description": "A description of your business, project, or use case. [Why we need this information](https://help.openai.com/en/articles/9824607-api-platform-verifications)." - }, - "business_website": { - "type": "string", - "description": "Your business URL, or if you don't have one yet, a URL to your LinkedIn or other social media. [Why we need this information](https://help.openai.com/en/articles/9824607-api-platform-verifications)." - } - }, - "required": [ - "id", - "object", - "name", - "created_at", - "status" - ], - "x-oaiMeta": { - "name": "The project object", - "example": "{\n \"id\": \"proj_abc\",\n \"object\": \"organization.project\",\n \"name\": \"Project example\",\n \"created_at\": 1711471533,\n \"archived_at\": null,\n \"status\": \"active\",\n \"app_use_case\": \"Your project use case here\",\n \"business_website\": \"https://example.com\"\n}\n" - } - }, - "ProjectListResponse": { - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ] - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Project" - } - }, - "first_id": { - "type": "string" - }, - "last_id": { - "type": "string" - }, - "has_more": { - "type": "boolean" - } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] - }, - "ProjectCreateRequest": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The friendly name of the project, this name appears in reports." - }, - "app_use_case": { - "type": "string", - "description": "A description of your business, project, or use case. [Why we need this information](https://help.openai.com/en/articles/9824607-api-platform-verifications)." - }, - "business_website": { - "type": "string", - "description": "Your business URL, or if you don't have one yet, a URL to your LinkedIn or other social media. [Why we need this information](https://help.openai.com/en/articles/9824607-api-platform-verifications)." - } - }, - "required": [ - "name" - ] - }, - "ProjectUpdateRequest": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The updated name of the project, this name appears in reports." - }, - "app_use_case": { - "type": "string", - "description": "A description of your business, project, or use case. [Why we need this information](https://help.openai.com/en/articles/9824607-api-platform-verifications)." - }, - "business_website": { - "type": "string", - "description": "Your business URL, or if you don't have one yet, a URL to your LinkedIn or other social media. [Why we need this information](https://help.openai.com/en/articles/9824607-api-platform-verifications)." - } - }, - "required": [ - "name" - ] - }, - "DefaultProjectErrorResponse": { - "type": "object", - "properties": { - "code": { - "type": "integer" - }, - "message": { - "type": "string" - } - }, - "required": [ - "code", - "message" - ] - }, - "ProjectUser": { - "type": "object", - "description": "Represents an individual user in a project.", - "properties": { - "object": { - "type": "string", - "enum": [ - "organization.project.user" - ], - "description": "The object type, which is always `organization.project.user`" - }, - "id": { - "type": "string", - "description": "The identifier, which can be referenced in API endpoints" - }, - "name": { - "type": "string", - "description": "The name of the user" - }, - "email": { - "type": "string", - "description": "The email address of the user" - }, - "role": { - "type": "string", - "enum": [ - "owner", - "member" - ], - "description": "`owner` or `member`" - }, - "added_at": { - "type": "integer", - "description": "The Unix timestamp (in seconds) of when the project was added." - } - }, - "required": [ - "object", - "id", - "name", - "email", - "role", - "added_at" - ], - "x-oaiMeta": { - "name": "The project user object", - "example": "{\n \"object\": \"organization.project.user\",\n \"id\": \"user_abc\",\n \"name\": \"First Last\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"added_at\": 1711471533\n}\n" - } - }, - "ProjectUserListResponse": { - "type": "object", - "properties": { - "object": { - "type": "string" - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ProjectUser" - } - }, - "first_id": { - "type": "string" - }, - "last_id": { - "type": "string" - }, - "has_more": { - "type": "boolean" - } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] - }, - "ProjectUserCreateRequest": { - "type": "object", - "properties": { - "user_id": { - "type": "string", - "description": "The ID of the user." - }, - "role": { - "type": "string", - "enum": [ - "owner", - "member" - ], - "description": "`owner` or `member`" - } - }, - "required": [ - "user_id", - "role" - ] - }, - "ProjectUserUpdateRequest": { - "type": "object", - "properties": { - "role": { - "type": "string", - "enum": [ - "owner", - "member" - ], - "description": "`owner` or `member`" - } - }, - "required": [ - "role" - ] - }, - "ProjectUserDeleteResponse": { - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "organization.project.user.deleted" - ] - }, - "id": { - "type": "string" - }, - "deleted": { - "type": "boolean" - } - }, - "required": [ - "object", - "id", - "deleted" - ] - }, - "ProjectServiceAccount": { - "type": "object", - "description": "Represents an individual service account in a project.", - "properties": { - "object": { - "type": "string", - "enum": [ - "organization.project.service_account" - ], - "description": "The object type, which is always `organization.project.service_account`" - }, - "id": { - "type": "string", - "description": "The identifier, which can be referenced in API endpoints" - }, - "name": { - "type": "string", - "description": "The name of the service account" - }, - "role": { - "type": "string", - "enum": [ - "owner", - "member" - ], - "description": "`owner` or `member`" - }, - "created_at": { - "type": "integer", - "description": "The Unix timestamp (in seconds) of when the service account was created" - } - }, - "required": [ - "object", - "id", - "name", - "role", - "created_at" - ], - "x-oaiMeta": { - "name": "The project service account object", - "example": "{\n \"object\": \"organization.project.service_account\",\n \"id\": \"svc_acct_abc\",\n \"name\": \"Service Account\",\n \"role\": \"owner\",\n \"created_at\": 1711471533\n}\n" - } - }, - "ProjectServiceAccountListResponse": { - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ] - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ProjectServiceAccount" - } - }, - "first_id": { - "type": "string" - }, - "last_id": { - "type": "string" - }, - "has_more": { - "type": "boolean" - } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] - }, - "ProjectServiceAccountCreateRequest": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The name of the service account being created." - } - }, - "required": [ - "name" - ] - }, - "ProjectServiceAccountCreateResponse": { - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "organization.project.service_account" - ] - }, - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "role": { - "type": "string", - "enum": [ - "member" - ], - "description": "Service accounts can only have one role of type `member`" - }, - "created_at": { - "type": "integer" - }, - "api_key": { - "$ref": "#/components/schemas/ProjectServiceAccountApiKey" - } - }, - "required": [ - "object", - "id", - "name", - "role", - "created_at", - "api_key" - ] - }, - "ProjectServiceAccountApiKey": { - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "organization.project.service_account.api_key" - ], - "description": "The object type, which is always `organization.project.service_account.api_key`" - }, - "value": { - "type": "string" - }, - "name": { - "type": "string" - }, - "created_at": { - "type": "integer" - }, - "id": { - "type": "string" - } - }, - "required": [ - "object", - "value", - "name", - "created_at", - "id" - ] - }, - "ProjectServiceAccountDeleteResponse": { - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "organization.project.service_account.deleted" - ] - }, - "id": { - "type": "string" - }, - "deleted": { - "type": "boolean" - } - }, - "required": [ - "object", - "id", - "deleted" - ] - }, - "ProjectApiKey": { - "type": "object", - "description": "Represents an individual API key in a project.", - "properties": { - "object": { - "type": "string", - "enum": [ - "organization.project.api_key" - ], - "description": "The object type, which is always `organization.project.api_key`" - }, - "redacted_value": { - "type": "string", - "description": "The redacted value of the API key" - }, - "name": { - "type": "string", - "description": "The name of the API key" - }, - "created_at": { - "type": "integer", - "description": "The Unix timestamp (in seconds) of when the API key was created" - }, - "id": { - "type": "string", - "description": "The identifier, which can be referenced in API endpoints" - }, - "owner": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "user", - "service_account" - ], - "description": "`user` or `service_account`" - }, - "user": { - "$ref": "#/components/schemas/ProjectUser" - }, - "service_account": { - "$ref": "#/components/schemas/ProjectServiceAccount" - } - } - } - }, - "required": [ - "object", - "redacted_value", - "name", - "created_at", - "id", - "owner" - ], - "x-oaiMeta": { - "name": "The project API key object", - "example": "{\n \"object\": \"organization.project.api_key\",\n \"redacted_value\": \"sk-abc...def\",\n \"name\": \"My API Key\",\n \"created_at\": 1711471533,\n \"id\": \"key_abc\",\n \"owner\": {\n \"type\": \"user\",\n \"user\": {\n \"object\": \"organization.project.user\",\n \"id\": \"user_abc\",\n \"name\": \"First Last\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"created_at\": 1711471533\n }\n }\n}\n" - } - }, - "ProjectApiKeyListResponse": { - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ] - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ProjectApiKey" - } - }, - "first_id": { - "type": "string" - }, - "last_id": { - "type": "string" - }, - "has_more": { - "type": "boolean" - } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] - }, - "ProjectApiKeyDeleteResponse": { - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "organization.project.api_key.deleted" - ] - }, - "id": { - "type": "string" - }, - "deleted": { - "type": "boolean" - } - }, - "required": [ - "object", - "id", - "deleted" - ] - } - } - }, - "security": [ - { - "ApiKeyAuth": [] - } - ], - "x-oaiMeta": { - "navigationGroups": [ - { - "id": "endpoints", - "title": "Endpoints" - }, - { - "id": "assistants", - "title": "Assistants" - }, - { - "id": "administration", - "title": "Administration" - }, - { - "id": "legacy", - "title": "Legacy" - } - ], - "groups": [ - { - "id": "audio", - "title": "Audio", - "description": "Learn how to turn audio into text or text into audio.\n\nRelated guide: [Speech to text](/docs/guides/speech-to-text)\n", - "navigationGroup": "endpoints", - "sections": [ - { - "type": "endpoint", - "key": "createSpeech", - "path": "createSpeech" - }, - { - "type": "endpoint", - "key": "createTranscription", - "path": "createTranscription" - }, - { - "type": "endpoint", - "key": "createTranslation", - "path": "createTranslation" - }, - { - "type": "object", - "key": "CreateTranscriptionResponseJson", - "path": "json-object" - }, - { - "type": "object", - "key": "CreateTranscriptionResponseVerboseJson", - "path": "verbose-json-object" - } - ] - }, - { - "id": "chat", - "title": "Chat", - "description": "Given a list of messages comprising a conversation, the model will return a response.\n\nRelated guide: [Chat Completions](/docs/guides/text-generation)\n", - "navigationGroup": "endpoints", - "sections": [ - { - "type": "endpoint", - "key": "createChatCompletion", - "path": "create" - }, - { - "type": "object", - "key": "CreateChatCompletionResponse", - "path": "object" - }, - { - "type": "object", - "key": "CreateChatCompletionStreamResponse", - "path": "streaming" - } - ] - }, - { - "id": "embeddings", - "title": "Embeddings", - "description": "Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.\n\nRelated guide: [Embeddings](/docs/guides/embeddings)\n", - "navigationGroup": "endpoints", - "sections": [ - { - "type": "endpoint", - "key": "createEmbedding", - "path": "create" - }, - { - "type": "object", - "key": "Embedding", - "path": "object" - } - ] - }, - { - "id": "fine-tuning", - "title": "Fine-tuning", - "description": "Manage fine-tuning jobs to tailor a model to your specific training data.\n\nRelated guide: [Fine-tune models](/docs/guides/fine-tuning)\n", - "navigationGroup": "endpoints", - "sections": [ - { - "type": "endpoint", - "key": "createFineTuningJob", - "path": "create" - }, - { - "type": "endpoint", - "key": "listPaginatedFineTuningJobs", - "path": "list" - }, - { - "type": "endpoint", - "key": "listFineTuningEvents", - "path": "list-events" - }, - { - "type": "endpoint", - "key": "listFineTuningJobCheckpoints", - "path": "list-checkpoints" - }, - { - "type": "endpoint", - "key": "retrieveFineTuningJob", - "path": "retrieve" - }, - { - "type": "endpoint", - "key": "cancelFineTuningJob", - "path": "cancel" - }, - { - "type": "object", - "key": "FinetuneChatRequestInput", - "path": "chat-input" - }, - { - "type": "object", - "key": "FinetuneCompletionRequestInput", - "path": "completions-input" - }, - { - "type": "object", - "key": "FineTuningJob", - "path": "object" - }, - { - "type": "object", - "key": "FineTuningJobEvent", - "path": "event-object" - }, - { - "type": "object", - "key": "FineTuningJobCheckpoint", - "path": "checkpoint-object" - } - ] - }, - { - "id": "batch", - "title": "Batch", - "description": "Create large batches of API requests for asynchronous processing. The Batch API returns completions within 24 hours for a 50% discount.\n\nRelated guide: [Batch](/docs/guides/batch)\n", - "navigationGroup": "endpoints", - "sections": [ - { - "type": "endpoint", - "key": "createBatch", - "path": "create" - }, - { - "type": "endpoint", - "key": "retrieveBatch", - "path": "retrieve" - }, - { - "type": "endpoint", - "key": "cancelBatch", - "path": "cancel" - }, - { - "type": "endpoint", - "key": "listBatches", - "path": "list" - }, - { - "type": "object", - "key": "Batch", - "path": "object" - }, - { - "type": "object", - "key": "BatchRequestInput", - "path": "request-input" - }, - { - "type": "object", - "key": "BatchRequestOutput", - "path": "request-output" - } - ] - }, - { - "id": "files", - "title": "Files", - "description": "Files are used to upload documents that can be used with features like [Assistants](/docs/api-reference/assistants), [Fine-tuning](/docs/api-reference/fine-tuning), and [Batch API](/docs/guides/batch).\n", - "navigationGroup": "endpoints", - "sections": [ - { - "type": "endpoint", - "key": "createFile", - "path": "create" - }, - { - "type": "endpoint", - "key": "listFiles", - "path": "list" - }, - { - "type": "endpoint", - "key": "retrieveFile", - "path": "retrieve" - }, - { - "type": "endpoint", - "key": "deleteFile", - "path": "delete" - }, - { - "type": "endpoint", - "key": "downloadFile", - "path": "retrieve-contents" - }, - { - "type": "object", - "key": "OpenAIFile", - "path": "object" - } - ] - }, - { - "id": "uploads", - "title": "Uploads", - "description": "Allows you to upload large files in multiple parts.\n", - "navigationGroup": "endpoints", - "sections": [ - { - "type": "endpoint", - "key": "createUpload", - "path": "create" - }, - { - "type": "endpoint", - "key": "addUploadPart", - "path": "add-part" - }, - { - "type": "endpoint", - "key": "completeUpload", - "path": "complete" - }, - { - "type": "endpoint", - "key": "cancelUpload", - "path": "cancel" - }, - { - "type": "object", - "key": "Upload", - "path": "object" - }, - { - "type": "object", - "key": "UploadPart", - "path": "part-object" - } - ] - }, - { - "id": "images", - "title": "Images", - "description": "Given a prompt and/or an input image, the model will generate a new image.\n\nRelated guide: [Image generation](/docs/guides/images)\n", - "navigationGroup": "endpoints", - "sections": [ - { - "type": "endpoint", - "key": "createImage", - "path": "create" - }, - { - "type": "endpoint", - "key": "createImageEdit", - "path": "createEdit" - }, - { - "type": "endpoint", - "key": "createImageVariation", - "path": "createVariation" - }, - { - "type": "object", - "key": "Image", - "path": "object" - } - ] - }, - { - "id": "models", - "title": "Models", - "description": "List and describe the various models available in the API. You can refer to the [Models](/docs/models) documentation to understand what models are available and the differences between them.\n", - "navigationGroup": "endpoints", - "sections": [ - { - "type": "endpoint", - "key": "listModels", - "path": "list" - }, - { - "type": "endpoint", - "key": "retrieveModel", - "path": "retrieve" - }, - { - "type": "endpoint", - "key": "deleteModel", - "path": "delete" - }, - { - "type": "object", - "key": "Model", - "path": "object" - } - ] - }, - { - "id": "moderations", - "title": "Moderations", - "description": "Given text and/or image inputs, classifies if those inputs are potentially harmful across several categories.\n\nRelated guide: [Moderations](/docs/guides/moderation)\n", - "navigationGroup": "endpoints", - "sections": [ - { - "type": "endpoint", - "key": "createModeration", - "path": "create" - }, - { - "type": "object", - "key": "CreateModerationResponse", - "path": "object" - } - ] - }, - { - "id": "assistants", - "title": "Assistants", - "beta": true, - "description": "Build assistants that can call models and use tools to perform tasks.\n\n[Get started with the Assistants API](/docs/assistants)\n", - "navigationGroup": "assistants", - "sections": [ - { - "type": "endpoint", - "key": "createAssistant", - "path": "createAssistant" - }, - { - "type": "endpoint", - "key": "listAssistants", - "path": "listAssistants" - }, - { - "type": "endpoint", - "key": "getAssistant", - "path": "getAssistant" - }, - { - "type": "endpoint", - "key": "modifyAssistant", - "path": "modifyAssistant" - }, - { - "type": "endpoint", - "key": "deleteAssistant", - "path": "deleteAssistant" - }, - { - "type": "object", - "key": "AssistantObject", - "path": "object" - } - ] - }, - { - "id": "threads", - "title": "Threads", - "beta": true, - "description": "Create threads that assistants can interact with.\n\nRelated guide: [Assistants](/docs/assistants/overview)\n", - "navigationGroup": "assistants", - "sections": [ - { - "type": "endpoint", - "key": "createThread", - "path": "createThread" - }, - { - "type": "endpoint", - "key": "getThread", - "path": "getThread" - }, - { - "type": "endpoint", - "key": "modifyThread", - "path": "modifyThread" - }, - { - "type": "endpoint", - "key": "deleteThread", - "path": "deleteThread" - }, - { - "type": "object", - "key": "ThreadObject", - "path": "object" - } - ] - }, - { - "id": "messages", - "title": "Messages", - "beta": true, - "description": "Create messages within threads\n\nRelated guide: [Assistants](/docs/assistants/overview)\n", - "navigationGroup": "assistants", - "sections": [ - { - "type": "endpoint", - "key": "createMessage", - "path": "createMessage" - }, - { - "type": "endpoint", - "key": "listMessages", - "path": "listMessages" - }, - { - "type": "endpoint", - "key": "getMessage", - "path": "getMessage" - }, - { - "type": "endpoint", - "key": "modifyMessage", - "path": "modifyMessage" - }, - { - "type": "endpoint", - "key": "deleteMessage", - "path": "deleteMessage" - }, - { - "type": "object", - "key": "MessageObject", - "path": "object" - } - ] - }, - { - "id": "runs", - "title": "Runs", - "beta": true, - "description": "Represents an execution run on a thread.\n\nRelated guide: [Assistants](/docs/assistants/overview)\n", - "navigationGroup": "assistants", - "sections": [ - { - "type": "endpoint", - "key": "createRun", - "path": "createRun" - }, - { - "type": "endpoint", - "key": "createThreadAndRun", - "path": "createThreadAndRun" - }, - { - "type": "endpoint", - "key": "listRuns", - "path": "listRuns" - }, - { - "type": "endpoint", - "key": "getRun", - "path": "getRun" - }, - { - "type": "endpoint", - "key": "modifyRun", - "path": "modifyRun" - }, - { - "type": "endpoint", - "key": "submitToolOuputsToRun", - "path": "submitToolOutputs" - }, - { - "type": "endpoint", - "key": "cancelRun", - "path": "cancelRun" - }, - { - "type": "object", - "key": "RunObject", - "path": "object" - } - ] - }, - { - "id": "run-steps", - "title": "Run Steps", - "beta": true, - "description": "Represents the steps (model and tool calls) taken during the run.\n\nRelated guide: [Assistants](/docs/assistants/overview)\n", - "navigationGroup": "assistants", - "sections": [ - { - "type": "endpoint", - "key": "listRunSteps", - "path": "listRunSteps" - }, - { - "type": "endpoint", - "key": "getRunStep", - "path": "getRunStep" - }, - { - "type": "object", - "key": "RunStepObject", - "path": "step-object" - } - ] - }, - { - "id": "vector-stores", - "title": "Vector Stores", - "beta": true, - "description": "Vector stores are used to store files for use by the `file_search` tool.\n\nRelated guide: [File Search](/docs/assistants/tools/file-search)\n", - "navigationGroup": "assistants", - "sections": [ - { - "type": "endpoint", - "key": "createVectorStore", - "path": "create" - }, - { - "type": "endpoint", - "key": "listVectorStores", - "path": "list" - }, - { - "type": "endpoint", - "key": "getVectorStore", - "path": "retrieve" - }, - { - "type": "endpoint", - "key": "modifyVectorStore", - "path": "modify" - }, - { - "type": "endpoint", - "key": "deleteVectorStore", - "path": "delete" - }, - { - "type": "object", - "key": "VectorStoreObject", - "path": "object" - } - ] - }, - { - "id": "vector-stores-files", - "title": "Vector Store Files", - "beta": true, - "description": "Vector store files represent files inside a vector store.\n\nRelated guide: [File Search](/docs/assistants/tools/file-search)\n", - "navigationGroup": "assistants", - "sections": [ - { - "type": "endpoint", - "key": "createVectorStoreFile", - "path": "createFile" - }, - { - "type": "endpoint", - "key": "listVectorStoreFiles", - "path": "listFiles" - }, - { - "type": "endpoint", - "key": "getVectorStoreFile", - "path": "getFile" - }, - { - "type": "endpoint", - "key": "deleteVectorStoreFile", - "path": "deleteFile" - }, - { - "type": "object", - "key": "VectorStoreFileObject", - "path": "file-object" - } - ] - }, - { - "id": "vector-stores-file-batches", - "title": "Vector Store File Batches", - "beta": true, - "description": "Vector store file batches represent operations to add multiple files to a vector store.\n\nRelated guide: [File Search](/docs/assistants/tools/file-search)\n", - "navigationGroup": "assistants", - "sections": [ - { - "type": "endpoint", - "key": "createVectorStoreFileBatch", - "path": "createBatch" - }, - { - "type": "endpoint", - "key": "getVectorStoreFileBatch", - "path": "getBatch" - }, - { - "type": "endpoint", - "key": "cancelVectorStoreFileBatch", - "path": "cancelBatch" - }, - { - "type": "endpoint", - "key": "listFilesInVectorStoreBatch", - "path": "listBatchFiles" - }, - { - "type": "object", - "key": "VectorStoreFileBatchObject", - "path": "batch-object" - } - ] - }, - { - "id": "assistants-streaming", - "title": "Streaming", - "beta": true, - "description": "Stream the result of executing a Run or resuming a Run after submitting tool outputs.\n\nYou can stream events from the [Create Thread and Run](/docs/api-reference/runs/createThreadAndRun),\n[Create Run](/docs/api-reference/runs/createRun), and [Submit Tool Outputs](/docs/api-reference/runs/submitToolOutputs)\nendpoints by passing `\"stream\": true`. The response will be a [Server-Sent events](https://html.spec.whatwg.org/multipage/server-sent-events.html#server-sent-events) stream.\n\nOur Node and Python SDKs provide helpful utilities to make streaming easy. Reference the\n[Assistants API quickstart](/docs/assistants/overview) to learn more.\n", - "navigationGroup": "assistants", - "sections": [ - { - "type": "object", - "key": "MessageDeltaObject", - "path": "message-delta-object" - }, - { - "type": "object", - "key": "RunStepDeltaObject", - "path": "run-step-delta-object" - }, - { - "type": "object", - "key": "AssistantStreamEvent", - "path": "events" - } - ] - }, - { - "id": "administration", - "title": "Overview", - "description": "Programmatically manage your organization.\n\nThe Audit Logs endpoint provides a log of all actions taken in the\norganization for security and monitoring purposes.\n\nTo access these endpoints please generate an Admin API Key through the [API Platform Organization overview](/organization/admin-keys). Admin API keys cannot be used for non-administration endpoints.\n\nFor best practices on setting up your organization, please refer to this [guide](/docs/guides/production-best-practices/setting-up-your-organization)\n", - "navigationGroup": "administration" - }, - { - "id": "invite", - "title": "Invites", - "description": "Invite and manage invitations for an organization. Invited users are automatically added to the Default project.", - "navigationGroup": "administration", - "sections": [ - { - "type": "endpoint", - "key": "list-invites", - "path": "list" - }, - { - "type": "endpoint", - "key": "inviteUser", - "path": "create" - }, - { - "type": "endpoint", - "key": "retrieve-invite", - "path": "retrieve" - }, - { - "type": "endpoint", - "key": "delete-invite", - "path": "delete" - }, - { - "type": "object", - "key": "Invite", - "path": "object" - } - ] - }, - { - "id": "users", - "title": "Users", - "description": "Manage users and their role in an organization. Users will be automatically added to the Default project.\n", - "navigationGroup": "administration", - "sections": [ - { - "type": "endpoint", - "key": "list-users", - "path": "list" - }, - { - "type": "endpoint", - "key": "modify-user", - "path": "modify" - }, - { - "type": "endpoint", - "key": "retrieve-user", - "path": "retrieve" - }, - { - "type": "endpoint", - "key": "delete-user", - "path": "delete" - }, - { - "type": "object", - "key": "User", - "path": "object" - } - ] - }, - { - "id": "projects", - "title": "Projects", - "description": "Manage the projects within an orgnanization includes creation, updating, and archiving or projects.\nThe Default project cannot be modified or archived.\n", - "navigationGroup": "administration", - "sections": [ - { - "type": "endpoint", - "key": "list-projects", - "path": "list" - }, - { - "type": "endpoint", - "key": "create-project", - "path": "create" - }, - { - "type": "endpoint", - "key": "retrieve-project", - "path": "retrieve" - }, - { - "type": "endpoint", - "key": "modify-project", - "path": "modify" - }, - { - "type": "endpoint", - "key": "archive-project", - "path": "archive" - }, - { - "type": "object", - "key": "Project", - "path": "object" - } - ] - }, - { - "id": "project-users", - "title": "Project Users", - "description": "Manage users within a project, including adding, updating roles, and removing users.\nUsers cannot be removed from the Default project, unless they are being removed from the organization.\n", - "navigationGroup": "administration", - "sections": [ - { - "type": "endpoint", - "key": "list-project-users", - "path": "list" - }, - { - "type": "endpoint", - "key": "create-project-user", - "path": "creeate" - }, - { - "type": "endpoint", - "key": "retrieve-project-user", - "path": "retrieve" - }, - { - "type": "endpoint", - "key": "modify-project-user", - "path": "modify" - }, - { - "type": "endpoint", - "key": "delete-project-user", - "path": "delete" - }, - { - "type": "object", - "key": "ProjectUser", - "path": "object" - } - ] - }, - { - "id": "project-service-accounts", - "title": "Project Service Accounts", - "description": "Manage service accounts within a project. A service account is a bot user that is not associated with a user.\nIf a user leaves an organization, their keys and membership in projects will no longer work. Service accounts\ndo not have this limitation. However, service accounts can also be deleted from a project.\n", - "navigationGroup": "administration", - "sections": [ - { - "type": "endpoint", - "key": "list-project-service-accounts", - "path": "list" - }, - { - "type": "endpoint", - "key": "create-project-service-account", - "path": "create" - }, - { - "type": "endpoint", - "key": "retrieve-project-service-account", - "path": "retrieve" - }, - { - "type": "endpoint", - "key": "delete-project-service-account", - "path": "delete" - }, - { - "type": "object", - "key": "ProjectServiceAccount", - "path": "object" - } - ] - }, - { - "id": "project-api-keys", - "title": "Project API Keys", - "description": "Manage API keys for a given project. Supports listing and deleting keys for users.\nThis API does not allow issuing keys for users, as users need to authorize themselves to generate keys.\n", - "navigationGroup": "administration", - "sections": [ - { - "type": "endpoint", - "key": "list-project-api-keys", - "path": "list" - }, - { - "type": "endpoint", - "key": "retrieve-project-api-key", - "path": "retrieve" - }, - { - "type": "endpoint", - "key": "delete-project-api-key", - "path": "delete" - }, - { - "type": "object", - "key": "ProjectApiKey", - "path": "object" - } - ] - }, - { - "id": "audit-logs", - "title": "Audit Logs", - "description": "Logs of user actions and configuration changes within this organization.\n\nTo log events, you must activate logging in the [Organization Settings](/settings/organization/general).\nOnce activated, for security reasons, logging cannot be deactivated.\n", - "navigationGroup": "administration", - "sections": [ - { - "type": "endpoint", - "key": "list-audit-logs", - "path": "list" - }, - { - "type": "object", - "key": "AuditLog", - "path": "object" - } - ] - }, - { - "id": "completions", - "title": "Completions", - "legacy": true, - "navigationGroup": "legacy", - "description": "Given a prompt, the model will return one or more predicted completions along with the probabilities of alternative tokens at each position. Most developer should use our [Chat Completions API](/docs/guides/text-generation/text-generation-models) to leverage our best and newest models.\n", - "sections": [ - { - "type": "endpoint", - "key": "createCompletion", - "path": "create" - }, - { - "type": "object", - "key": "CreateCompletionResponse", - "path": "object" - } - ] - } - ] - } + "openapi": "3.0.0", + "info": { + "title": "OpenAI API", + "description": "The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details.", + "version": "2.3.0", + "termsOfService": "https://openai.com/policies/terms-of-use", + "contact": { + "name": "OpenAI Support", + "url": "https://help.openai.com/" + }, + "license": { + "name": "MIT", + "url": "https://github.com/openai/openai-openapi/blob/master/LICENSE" + } + }, + "servers": [ + { + "url": "https://api.openai.com/v1" + } + ], + "tags": [ + { + "name": "Assistants", + "description": "Build Assistants that can call models and use tools." + }, + { + "name": "Audio", + "description": "Turn audio into text or text into audio." + }, + { + "name": "Chat", + "description": "Given a list of messages comprising a conversation, the model will return a response." + }, + { + "name": "Completions", + "description": "Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position." + }, + { + "name": "Embeddings", + "description": "Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms." + }, + { + "name": "Fine-tuning", + "description": "Manage fine-tuning jobs to tailor a model to your specific training data." + }, + { + "name": "Batch", + "description": "Create large batches of API requests to run asynchronously." + }, + { + "name": "Files", + "description": "Files are used to upload documents that can be used with features like Assistants and Fine-tuning." + }, + { + "name": "Uploads", + "description": "Use Uploads to upload large files in multiple parts." + }, + { + "name": "Images", + "description": "Given a prompt and/or an input image, the model will generate a new image." + }, + { + "name": "Models", + "description": "List and describe the various models available in the API." + }, + { + "name": "Moderations", + "description": "Given text and/or image inputs, classifies if those inputs are potentially harmful." + }, + { + "name": "Audit Logs", + "description": "List user actions and configuration changes within this organization." + } + ], + "paths": { + "/chat/completions": { + "post": { + "operationId": "createChatCompletion", + "tags": ["Chat"], + "summary": "Creates a model response for the given chat conversation.", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateChatCompletionRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateChatCompletionResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Create chat completion", + "group": "chat", + "returns": "Returns a [chat completion](/docs/api-reference/chat/object) object, or a streamed sequence of [chat completion chunk](/docs/api-reference/chat/streaming) objects if the request is streamed.\n", + "path": "create", + "examples": [ + { + "title": "Default", + "request": { + "curl": "curl https://api.openai.com/v1/chat/completions \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"VAR_model_id\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are a helpful assistant.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Hello!\"\n }\n ]\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\ncompletion = client.chat.completions.create(\n model=\"VAR_model_id\",\n messages=[\n {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n {\"role\": \"user\", \"content\": \"Hello!\"}\n ]\n)\n\nprint(completion.choices[0].message)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const completion = await openai.chat.completions.create({\n messages: [{ role: \"system\", content: \"You are a helpful assistant.\" }],\n model: \"VAR_model_id\",\n });\n\n console.log(completion.choices[0]);\n}\n\nmain();" + }, + "response": "{\n \"id\": \"chatcmpl-123\",\n \"object\": \"chat.completion\",\n \"created\": 1677652288,\n \"model\": \"gpt-4o-mini\",\n \"system_fingerprint\": \"fp_44709d6fcb\",\n \"choices\": [{\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": \"\\n\\nHello there, how may I assist you today?\",\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }],\n \"usage\": {\n \"prompt_tokens\": 9,\n \"completion_tokens\": 12,\n \"total_tokens\": 21,\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0\n }\n }\n}\n" + }, + { + "title": "Image input", + "request": { + "curl": "curl https://api.openai.com/v1/chat/completions \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-4o\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"What'\\''s in this image?\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": {\n \"url\": \"https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg\"\n }\n }\n ]\n }\n ],\n \"max_tokens\": 300\n }'\n", + "python": "from openai import OpenAI\n\nclient = OpenAI()\n\nresponse = client.chat.completions.create(\n model=\"gpt-4o\",\n messages=[\n {\n \"role\": \"user\",\n \"content\": [\n {\"type\": \"text\", \"text\": \"What's in this image?\"},\n {\n \"type\": \"image_url\",\n \"image_url\": {\n \"url\": \"https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg\",\n }\n },\n ],\n }\n ],\n max_tokens=300,\n)\n\nprint(response.choices[0])\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const response = await openai.chat.completions.create({\n model: \"gpt-4o\",\n messages: [\n {\n role: \"user\",\n content: [\n { type: \"text\", text: \"What's in this image?\" },\n {\n type: \"image_url\",\n image_url: {\n \"url\": \"https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg\",\n },\n }\n ],\n },\n ],\n });\n console.log(response.choices[0]);\n}\nmain();" + }, + "response": "{\n \"id\": \"chatcmpl-123\",\n \"object\": \"chat.completion\",\n \"created\": 1677652288,\n \"model\": \"gpt-4o-mini\",\n \"system_fingerprint\": \"fp_44709d6fcb\",\n \"choices\": [{\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": \"\\n\\nThis image shows a wooden boardwalk extending through a lush green marshland.\",\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }],\n \"usage\": {\n \"prompt_tokens\": 9,\n \"completion_tokens\": 12,\n \"total_tokens\": 21,\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0\n }\n }\n}\n" + }, + { + "title": "Streaming", + "request": { + "curl": "curl https://api.openai.com/v1/chat/completions \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"VAR_model_id\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are a helpful assistant.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Hello!\"\n }\n ],\n \"stream\": true\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\ncompletion = client.chat.completions.create(\n model=\"VAR_model_id\",\n messages=[\n {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n {\"role\": \"user\", \"content\": \"Hello!\"}\n ],\n stream=True\n)\n\nfor chunk in completion:\n print(chunk.choices[0].delta)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const completion = await openai.chat.completions.create({\n model: \"VAR_model_id\",\n messages: [\n {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n {\"role\": \"user\", \"content\": \"Hello!\"}\n ],\n stream: true,\n });\n\n for await (const chunk of completion) {\n console.log(chunk.choices[0].delta.content);\n }\n}\n\nmain();" + }, + "response": "{\"id\":\"chatcmpl-123\",\"object\":\"chat.completion.chunk\",\"created\":1694268190,\"model\":\"gpt-4o-mini\", \"system_fingerprint\": \"fp_44709d6fcb\", \"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":\"\"},\"logprobs\":null,\"finish_reason\":null}]}\n\n{\"id\":\"chatcmpl-123\",\"object\":\"chat.completion.chunk\",\"created\":1694268190,\"model\":\"gpt-4o-mini\", \"system_fingerprint\": \"fp_44709d6fcb\", \"choices\":[{\"index\":0,\"delta\":{\"content\":\"Hello\"},\"logprobs\":null,\"finish_reason\":null}]}\n\n....\n\n{\"id\":\"chatcmpl-123\",\"object\":\"chat.completion.chunk\",\"created\":1694268190,\"model\":\"gpt-4o-mini\", \"system_fingerprint\": \"fp_44709d6fcb\", \"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n" + }, + { + "title": "Functions", + "request": { + "curl": "curl https://api.openai.com/v1/chat/completions \\\n-H \"Content-Type: application/json\" \\\n-H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n-d '{\n \"model\": \"gpt-4o\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What'\\''s the weather like in Boston today?\"\n }\n ],\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather in a given location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\"\n },\n \"unit\": {\n \"type\": \"string\",\n \"enum\": [\"celsius\", \"fahrenheit\"]\n }\n },\n \"required\": [\"location\"]\n }\n }\n }\n ],\n \"tool_choice\": \"auto\"\n}'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\ntools = [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather in a given location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\",\n },\n \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"]},\n },\n \"required\": [\"location\"],\n },\n }\n }\n]\nmessages = [{\"role\": \"user\", \"content\": \"What's the weather like in Boston today?\"}]\ncompletion = client.chat.completions.create(\n model=\"VAR_model_id\",\n messages=messages,\n tools=tools,\n tool_choice=\"auto\"\n)\n\nprint(completion)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const messages = [{\"role\": \"user\", \"content\": \"What's the weather like in Boston today?\"}];\n const tools = [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather in a given location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\",\n },\n \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"]},\n },\n \"required\": [\"location\"],\n },\n }\n }\n ];\n\n const response = await openai.chat.completions.create({\n model: \"gpt-4o\",\n messages: messages,\n tools: tools,\n tool_choice: \"auto\",\n });\n\n console.log(response);\n}\n\nmain();" + }, + "response": "{\n \"id\": \"chatcmpl-abc123\",\n \"object\": \"chat.completion\",\n \"created\": 1699896916,\n \"model\": \"gpt-4o-mini\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_abc123\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"arguments\": \"{\\n\\\"location\\\": \\\"Boston, MA\\\"\\n}\"\n }\n }\n ]\n },\n \"logprobs\": null,\n \"finish_reason\": \"tool_calls\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 82,\n \"completion_tokens\": 17,\n \"total_tokens\": 99,\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0\n }\n }\n}\n" + }, + { + "title": "Logprobs", + "request": { + "curl": "curl https://api.openai.com/v1/chat/completions \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"VAR_model_id\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello!\"\n }\n ],\n \"logprobs\": true,\n \"top_logprobs\": 2\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\ncompletion = client.chat.completions.create(\n model=\"VAR_model_id\",\n messages=[\n {\"role\": \"user\", \"content\": \"Hello!\"}\n ],\n logprobs=True,\n top_logprobs=2\n)\n\nprint(completion.choices[0].message)\nprint(completion.choices[0].logprobs)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const completion = await openai.chat.completions.create({\n messages: [{ role: \"user\", content: \"Hello!\" }],\n model: \"VAR_model_id\",\n logprobs: true,\n top_logprobs: 2,\n });\n\n console.log(completion.choices[0]);\n}\n\nmain();" + }, + "response": "{\n \"id\": \"chatcmpl-123\",\n \"object\": \"chat.completion\",\n \"created\": 1702685778,\n \"model\": \"gpt-4o-mini\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": \"Hello! How can I assist you today?\"\n },\n \"logprobs\": {\n \"content\": [\n {\n \"token\": \"Hello\",\n \"logprob\": -0.31725305,\n \"bytes\": [72, 101, 108, 108, 111],\n \"top_logprobs\": [\n {\n \"token\": \"Hello\",\n \"logprob\": -0.31725305,\n \"bytes\": [72, 101, 108, 108, 111]\n },\n {\n \"token\": \"Hi\",\n \"logprob\": -1.3190403,\n \"bytes\": [72, 105]\n }\n ]\n },\n {\n \"token\": \"!\",\n \"logprob\": -0.02380986,\n \"bytes\": [\n 33\n ],\n \"top_logprobs\": [\n {\n \"token\": \"!\",\n \"logprob\": -0.02380986,\n \"bytes\": [33]\n },\n {\n \"token\": \" there\",\n \"logprob\": -3.787621,\n \"bytes\": [32, 116, 104, 101, 114, 101]\n }\n ]\n },\n {\n \"token\": \" How\",\n \"logprob\": -0.000054669687,\n \"bytes\": [32, 72, 111, 119],\n \"top_logprobs\": [\n {\n \"token\": \" How\",\n \"logprob\": -0.000054669687,\n \"bytes\": [32, 72, 111, 119]\n },\n {\n \"token\": \"<|end|>\",\n \"logprob\": -10.953937,\n \"bytes\": null\n }\n ]\n },\n {\n \"token\": \" can\",\n \"logprob\": -0.015801601,\n \"bytes\": [32, 99, 97, 110],\n \"top_logprobs\": [\n {\n \"token\": \" can\",\n \"logprob\": -0.015801601,\n \"bytes\": [32, 99, 97, 110]\n },\n {\n \"token\": \" may\",\n \"logprob\": -4.161023,\n \"bytes\": [32, 109, 97, 121]\n }\n ]\n },\n {\n \"token\": \" I\",\n \"logprob\": -3.7697225e-6,\n \"bytes\": [\n 32,\n 73\n ],\n \"top_logprobs\": [\n {\n \"token\": \" I\",\n \"logprob\": -3.7697225e-6,\n \"bytes\": [32, 73]\n },\n {\n \"token\": \" assist\",\n \"logprob\": -13.596657,\n \"bytes\": [32, 97, 115, 115, 105, 115, 116]\n }\n ]\n },\n {\n \"token\": \" assist\",\n \"logprob\": -0.04571125,\n \"bytes\": [32, 97, 115, 115, 105, 115, 116],\n \"top_logprobs\": [\n {\n \"token\": \" assist\",\n \"logprob\": -0.04571125,\n \"bytes\": [32, 97, 115, 115, 105, 115, 116]\n },\n {\n \"token\": \" help\",\n \"logprob\": -3.1089056,\n \"bytes\": [32, 104, 101, 108, 112]\n }\n ]\n },\n {\n \"token\": \" you\",\n \"logprob\": -5.4385737e-6,\n \"bytes\": [32, 121, 111, 117],\n \"top_logprobs\": [\n {\n \"token\": \" you\",\n \"logprob\": -5.4385737e-6,\n \"bytes\": [32, 121, 111, 117]\n },\n {\n \"token\": \" today\",\n \"logprob\": -12.807695,\n \"bytes\": [32, 116, 111, 100, 97, 121]\n }\n ]\n },\n {\n \"token\": \" today\",\n \"logprob\": -0.0040071653,\n \"bytes\": [32, 116, 111, 100, 97, 121],\n \"top_logprobs\": [\n {\n \"token\": \" today\",\n \"logprob\": -0.0040071653,\n \"bytes\": [32, 116, 111, 100, 97, 121]\n },\n {\n \"token\": \"?\",\n \"logprob\": -5.5247097,\n \"bytes\": [63]\n }\n ]\n },\n {\n \"token\": \"?\",\n \"logprob\": -0.0008108172,\n \"bytes\": [63],\n \"top_logprobs\": [\n {\n \"token\": \"?\",\n \"logprob\": -0.0008108172,\n \"bytes\": [63]\n },\n {\n \"token\": \"?\\n\",\n \"logprob\": -7.184561,\n \"bytes\": [63, 10]\n }\n ]\n }\n ]\n },\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 9,\n \"completion_tokens\": 9,\n \"total_tokens\": 18,\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0\n }\n },\n \"system_fingerprint\": null\n}\n" + } + ] + } + } + }, + "/completions": { + "post": { + "operationId": "createCompletion", + "tags": ["Completions"], + "summary": "Creates a completion for the provided prompt and parameters.", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateCompletionRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateCompletionResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Create completion", + "group": "completions", + "returns": "Returns a [completion](/docs/api-reference/completions/object) object, or a sequence of completion objects if the request is streamed.\n", + "legacy": true, + "examples": [ + { + "title": "No streaming", + "request": { + "curl": "curl https://api.openai.com/v1/completions \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"VAR_model_id\",\n \"prompt\": \"Say this is a test\",\n \"max_tokens\": 7,\n \"temperature\": 0\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.completions.create(\n model=\"VAR_model_id\",\n prompt=\"Say this is a test\",\n max_tokens=7,\n temperature=0\n)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const completion = await openai.completions.create({\n model: \"VAR_model_id\",\n prompt: \"Say this is a test.\",\n max_tokens: 7,\n temperature: 0,\n });\n\n console.log(completion);\n}\nmain();" + }, + "response": "{\n \"id\": \"cmpl-uqkvlQyYK7bGYrRHQ0eXlWi7\",\n \"object\": \"text_completion\",\n \"created\": 1589478378,\n \"model\": \"VAR_model_id\",\n \"system_fingerprint\": \"fp_44709d6fcb\",\n \"choices\": [\n {\n \"text\": \"\\n\\nThis is indeed a test\",\n \"index\": 0,\n \"logprobs\": null,\n \"finish_reason\": \"length\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 5,\n \"completion_tokens\": 7,\n \"total_tokens\": 12\n }\n}\n" + }, + { + "title": "Streaming", + "request": { + "curl": "curl https://api.openai.com/v1/completions \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"VAR_model_id\",\n \"prompt\": \"Say this is a test\",\n \"max_tokens\": 7,\n \"temperature\": 0,\n \"stream\": true\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nfor chunk in client.completions.create(\n model=\"VAR_model_id\",\n prompt=\"Say this is a test\",\n max_tokens=7,\n temperature=0,\n stream=True\n):\n print(chunk.choices[0].text)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const stream = await openai.completions.create({\n model: \"VAR_model_id\",\n prompt: \"Say this is a test.\",\n stream: true,\n });\n\n for await (const chunk of stream) {\n console.log(chunk.choices[0].text)\n }\n}\nmain();" + }, + "response": "{\n \"id\": \"cmpl-7iA7iJjj8V2zOkCGvWF2hAkDWBQZe\",\n \"object\": \"text_completion\",\n \"created\": 1690759702,\n \"choices\": [\n {\n \"text\": \"This\",\n \"index\": 0,\n \"logprobs\": null,\n \"finish_reason\": null\n }\n ],\n \"model\": \"gpt-3.5-turbo-instruct\"\n \"system_fingerprint\": \"fp_44709d6fcb\",\n}\n" + } + ] + } + } + }, + "/images/generations": { + "post": { + "operationId": "createImage", + "tags": ["Images"], + "summary": "Creates an image given a prompt.", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateImageRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ImagesResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Create image", + "group": "images", + "returns": "Returns a list of [image](/docs/api-reference/images/object) objects.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/images/generations \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"dall-e-3\",\n \"prompt\": \"A cute baby sea otter\",\n \"n\": 1,\n \"size\": \"1024x1024\"\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.images.generate(\n model=\"dall-e-3\",\n prompt=\"A cute baby sea otter\",\n n=1,\n size=\"1024x1024\"\n)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const image = await openai.images.generate({ model: \"dall-e-3\", prompt: \"A cute baby sea otter\" });\n\n console.log(image.data);\n}\nmain();" + }, + "response": "{\n \"created\": 1589478378,\n \"data\": [\n {\n \"url\": \"https://...\"\n },\n {\n \"url\": \"https://...\"\n }\n ]\n}\n" + } + } + } + }, + "/images/edits": { + "post": { + "operationId": "createImageEdit", + "tags": ["Images"], + "summary": "Creates an edited or extended image given an original image and a prompt.", + "requestBody": { + "required": true, + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/CreateImageEditRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ImagesResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Create image edit", + "group": "images", + "returns": "Returns a list of [image](/docs/api-reference/images/object) objects.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/images/edits \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -F image=\"@otter.png\" \\\n -F mask=\"@mask.png\" \\\n -F prompt=\"A cute baby sea otter wearing a beret\" \\\n -F n=2 \\\n -F size=\"1024x1024\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.images.edit(\n image=open(\"otter.png\", \"rb\"),\n mask=open(\"mask.png\", \"rb\"),\n prompt=\"A cute baby sea otter wearing a beret\",\n n=2,\n size=\"1024x1024\"\n)\n", + "node.js": "import fs from \"fs\";\nimport OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const image = await openai.images.edit({\n image: fs.createReadStream(\"otter.png\"),\n mask: fs.createReadStream(\"mask.png\"),\n prompt: \"A cute baby sea otter wearing a beret\",\n });\n\n console.log(image.data);\n}\nmain();" + }, + "response": "{\n \"created\": 1589478378,\n \"data\": [\n {\n \"url\": \"https://...\"\n },\n {\n \"url\": \"https://...\"\n }\n ]\n}\n" + } + } + } + }, + "/images/variations": { + "post": { + "operationId": "createImageVariation", + "tags": ["Images"], + "summary": "Creates a variation of a given image.", + "requestBody": { + "required": true, + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/CreateImageVariationRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ImagesResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Create image variation", + "group": "images", + "returns": "Returns a list of [image](/docs/api-reference/images/object) objects.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/images/variations \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -F image=\"@otter.png\" \\\n -F n=2 \\\n -F size=\"1024x1024\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nresponse = client.images.create_variation(\n image=open(\"image_edit_original.png\", \"rb\"),\n n=2,\n size=\"1024x1024\"\n)\n", + "node.js": "import fs from \"fs\";\nimport OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const image = await openai.images.createVariation({\n image: fs.createReadStream(\"otter.png\"),\n });\n\n console.log(image.data);\n}\nmain();" + }, + "response": "{\n \"created\": 1589478378,\n \"data\": [\n {\n \"url\": \"https://...\"\n },\n {\n \"url\": \"https://...\"\n }\n ]\n}\n" + } + } + } + }, + "/embeddings": { + "post": { + "operationId": "createEmbedding", + "tags": ["Embeddings"], + "summary": "Creates an embedding vector representing the input text.", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateEmbeddingRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateEmbeddingResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Create embeddings", + "group": "embeddings", + "returns": "A list of [embedding](/docs/api-reference/embeddings/object) objects.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/embeddings \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"input\": \"The food was delicious and the waiter...\",\n \"model\": \"text-embedding-ada-002\",\n \"encoding_format\": \"float\"\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.embeddings.create(\n model=\"text-embedding-ada-002\",\n input=\"The food was delicious and the waiter...\",\n encoding_format=\"float\"\n)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const embedding = await openai.embeddings.create({\n model: \"text-embedding-ada-002\",\n input: \"The quick brown fox jumped over the lazy dog\",\n encoding_format: \"float\",\n });\n\n console.log(embedding);\n}\n\nmain();" + }, + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"embedding\",\n \"embedding\": [\n 0.0023064255,\n -0.009327292,\n .... (1536 floats total for ada-002)\n -0.0028842222,\n ],\n \"index\": 0\n }\n ],\n \"model\": \"text-embedding-ada-002\",\n \"usage\": {\n \"prompt_tokens\": 8,\n \"total_tokens\": 8\n }\n}\n" + } + } + } + }, + "/audio/speech": { + "post": { + "operationId": "createSpeech", + "tags": ["Audio"], + "summary": "Generates audio from the input text.", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateSpeechRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "headers": { + "Transfer-Encoding": { + "schema": { + "type": "string" + }, + "description": "chunked" + } + }, + "content": { + "application/octet-stream": { + "schema": { + "type": "string", + "format": "binary" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Create speech", + "group": "audio", + "returns": "The audio file content.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/audio/speech \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"model\": \"tts-1\",\n \"input\": \"The quick brown fox jumped over the lazy dog.\",\n \"voice\": \"alloy\"\n }' \\\n --output speech.mp3\n", + "python": "from pathlib import Path\nimport openai\n\nspeech_file_path = Path(__file__).parent / \"speech.mp3\"\nresponse = openai.audio.speech.create(\n model=\"tts-1\",\n voice=\"alloy\",\n input=\"The quick brown fox jumped over the lazy dog.\"\n)\nresponse.stream_to_file(speech_file_path)\n", + "node": "import fs from \"fs\";\nimport path from \"path\";\nimport OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst speechFile = path.resolve(\"./speech.mp3\");\n\nasync function main() {\n const mp3 = await openai.audio.speech.create({\n model: \"tts-1\",\n voice: \"alloy\",\n input: \"Today is a wonderful day to build something people love!\",\n });\n console.log(speechFile);\n const buffer = Buffer.from(await mp3.arrayBuffer());\n await fs.promises.writeFile(speechFile, buffer);\n}\nmain();\n" + } + } + } + } + }, + "/audio/transcriptions": { + "post": { + "operationId": "createTranscription", + "tags": ["Audio"], + "summary": "Transcribes audio into the input language.", + "requestBody": { + "required": true, + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/CreateTranscriptionRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/CreateTranscriptionResponseJson" + }, + { + "$ref": "#/components/schemas/CreateTranscriptionResponseVerboseJson" + } + ] + } + } + } + } + }, + "x-oaiMeta": { + "name": "Create transcription", + "group": "audio", + "returns": "The [transcription object](/docs/api-reference/audio/json-object) or a [verbose transcription object](/docs/api-reference/audio/verbose-json-object).", + "examples": [ + { + "title": "Default", + "request": { + "curl": "curl https://api.openai.com/v1/audio/transcriptions \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: multipart/form-data\" \\\n -F file=\"@/path/to/file/audio.mp3\" \\\n -F model=\"whisper-1\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\naudio_file = open(\"speech.mp3\", \"rb\")\ntranscript = client.audio.transcriptions.create(\n model=\"whisper-1\",\n file=audio_file\n)\n", + "node": "import fs from \"fs\";\nimport OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const transcription = await openai.audio.transcriptions.create({\n file: fs.createReadStream(\"audio.mp3\"),\n model: \"whisper-1\",\n });\n\n console.log(transcription.text);\n}\nmain();\n" + }, + "response": "{\n \"text\": \"Imagine the wildest idea that you've ever had, and you're curious about how it might scale to something that's a 100, a 1,000 times bigger. This is a place where you can get to do that.\"\n}\n" + }, + { + "title": "Word timestamps", + "request": { + "curl": "curl https://api.openai.com/v1/audio/transcriptions \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: multipart/form-data\" \\\n -F file=\"@/path/to/file/audio.mp3\" \\\n -F \"timestamp_granularities[]=word\" \\\n -F model=\"whisper-1\" \\\n -F response_format=\"verbose_json\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\naudio_file = open(\"speech.mp3\", \"rb\")\ntranscript = client.audio.transcriptions.create(\n file=audio_file,\n model=\"whisper-1\",\n response_format=\"verbose_json\",\n timestamp_granularities=[\"word\"]\n)\n\nprint(transcript.words)\n", + "node": "import fs from \"fs\";\nimport OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const transcription = await openai.audio.transcriptions.create({\n file: fs.createReadStream(\"audio.mp3\"),\n model: \"whisper-1\",\n response_format: \"verbose_json\",\n timestamp_granularities: [\"word\"]\n });\n\n console.log(transcription.text);\n}\nmain();\n" + }, + "response": "{\n \"task\": \"transcribe\",\n \"language\": \"english\",\n \"duration\": 8.470000267028809,\n \"text\": \"The beach was a popular spot on a hot summer day. People were swimming in the ocean, building sandcastles, and playing beach volleyball.\",\n \"words\": [\n {\n \"word\": \"The\",\n \"start\": 0.0,\n \"end\": 0.23999999463558197\n },\n ...\n {\n \"word\": \"volleyball\",\n \"start\": 7.400000095367432,\n \"end\": 7.900000095367432\n }\n ]\n}\n" + }, + { + "title": "Segment timestamps", + "request": { + "curl": "curl https://api.openai.com/v1/audio/transcriptions \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: multipart/form-data\" \\\n -F file=\"@/path/to/file/audio.mp3\" \\\n -F \"timestamp_granularities[]=segment\" \\\n -F model=\"whisper-1\" \\\n -F response_format=\"verbose_json\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\naudio_file = open(\"speech.mp3\", \"rb\")\ntranscript = client.audio.transcriptions.create(\n file=audio_file,\n model=\"whisper-1\",\n response_format=\"verbose_json\",\n timestamp_granularities=[\"segment\"]\n)\n\nprint(transcript.words)\n", + "node": "import fs from \"fs\";\nimport OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const transcription = await openai.audio.transcriptions.create({\n file: fs.createReadStream(\"audio.mp3\"),\n model: \"whisper-1\",\n response_format: \"verbose_json\",\n timestamp_granularities: [\"segment\"]\n });\n\n console.log(transcription.text);\n}\nmain();\n" + }, + "response": "{\n \"task\": \"transcribe\",\n \"language\": \"english\",\n \"duration\": 8.470000267028809,\n \"text\": \"The beach was a popular spot on a hot summer day. People were swimming in the ocean, building sandcastles, and playing beach volleyball.\",\n \"segments\": [\n {\n \"id\": 0,\n \"seek\": 0,\n \"start\": 0.0,\n \"end\": 3.319999933242798,\n \"text\": \" The beach was a popular spot on a hot summer day.\",\n \"tokens\": [\n 50364, 440, 7534, 390, 257, 3743, 4008, 322, 257, 2368, 4266, 786, 13, 50530\n ],\n \"temperature\": 0.0,\n \"avg_logprob\": -0.2860786020755768,\n \"compression_ratio\": 1.2363636493682861,\n \"no_speech_prob\": 0.00985979475080967\n },\n ...\n ]\n}\n" + } + ] + } + } + }, + "/audio/translations": { + "post": { + "operationId": "createTranslation", + "tags": ["Audio"], + "summary": "Translates audio into English.", + "requestBody": { + "required": true, + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/CreateTranslationRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/CreateTranslationResponseJson" + }, + { + "$ref": "#/components/schemas/CreateTranslationResponseVerboseJson" + } + ] + } + } + } + } + }, + "x-oaiMeta": { + "name": "Create translation", + "group": "audio", + "returns": "The translated text.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/audio/translations \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: multipart/form-data\" \\\n -F file=\"@/path/to/file/german.m4a\" \\\n -F model=\"whisper-1\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\naudio_file = open(\"speech.mp3\", \"rb\")\ntranscript = client.audio.translations.create(\n model=\"whisper-1\",\n file=audio_file\n)\n", + "node": "import fs from \"fs\";\nimport OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const translation = await openai.audio.translations.create({\n file: fs.createReadStream(\"speech.mp3\"),\n model: \"whisper-1\",\n });\n\n console.log(translation.text);\n}\nmain();\n" + }, + "response": "{\n \"text\": \"Hello, my name is Wolfgang and I come from Germany. Where are you heading today?\"\n}\n" + } + } + } + }, + "/files": { + "get": { + "operationId": "listFiles", + "tags": ["Files"], + "summary": "Returns a list of files that belong to the user's organization.", + "parameters": [ + { + "in": "query", + "name": "purpose", + "required": false, + "schema": { + "type": "string" + }, + "description": "Only return files with the given purpose." + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListFilesResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "List files", + "group": "files", + "returns": "A list of [File](/docs/api-reference/files/object) objects.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/files \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.files.list()\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const list = await openai.files.list();\n\n for await (const file of list) {\n console.log(file);\n }\n}\n\nmain();" + }, + "response": "{\n \"data\": [\n {\n \"id\": \"file-abc123\",\n \"object\": \"file\",\n \"bytes\": 175,\n \"created_at\": 1613677385,\n \"filename\": \"salesOverview.pdf\",\n \"purpose\": \"assistants\",\n },\n {\n \"id\": \"file-abc123\",\n \"object\": \"file\",\n \"bytes\": 140,\n \"created_at\": 1613779121,\n \"filename\": \"puppy.jsonl\",\n \"purpose\": \"fine-tune\",\n }\n ],\n \"object\": \"list\"\n}\n" + } + } + }, + "post": { + "operationId": "createFile", + "tags": ["Files"], + "summary": "Upload a file that can be used across various endpoints. Individual files can be up to 512 MB, and the size of all files uploaded by one organization can be up to 100 GB.\n\nThe Assistants API supports files up to 2 million tokens and of specific file types. See the [Assistants Tools guide](/docs/assistants/tools) for details.\n\nThe Fine-tuning API only supports `.jsonl` files. The input also has certain required formats for fine-tuning [chat](/docs/api-reference/fine-tuning/chat-input) or [completions](/docs/api-reference/fine-tuning/completions-input) models.\n\nThe Batch API only supports `.jsonl` files up to 100 MB in size. The input also has a specific required [format](/docs/api-reference/batch/request-input).\n\nPlease [contact us](https://help.openai.com/) if you need to increase these storage limits.\n", + "requestBody": { + "required": true, + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/CreateFileRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OpenAIFile" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Upload file", + "group": "files", + "returns": "The uploaded [File](/docs/api-reference/files/object) object.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/files \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -F purpose=\"fine-tune\" \\\n -F file=\"@mydata.jsonl\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.files.create(\n file=open(\"mydata.jsonl\", \"rb\"),\n purpose=\"fine-tune\"\n)\n", + "node.js": "import fs from \"fs\";\nimport OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const file = await openai.files.create({\n file: fs.createReadStream(\"mydata.jsonl\"),\n purpose: \"fine-tune\",\n });\n\n console.log(file);\n}\n\nmain();" + }, + "response": "{\n \"id\": \"file-abc123\",\n \"object\": \"file\",\n \"bytes\": 120000,\n \"created_at\": 1677610602,\n \"filename\": \"mydata.jsonl\",\n \"purpose\": \"fine-tune\",\n}\n" + } + } + } + }, + "/files/{file_id}": { + "delete": { + "operationId": "deleteFile", + "tags": ["Files"], + "summary": "Delete a file.", + "parameters": [ + { + "in": "path", + "name": "file_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the file to use for this request." + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeleteFileResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Delete file", + "group": "files", + "returns": "Deletion status.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/files/file-abc123 \\\n -X DELETE \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.files.delete(\"file-abc123\")\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const file = await openai.files.del(\"file-abc123\");\n\n console.log(file);\n}\n\nmain();" + }, + "response": "{\n \"id\": \"file-abc123\",\n \"object\": \"file\",\n \"deleted\": true\n}\n" + } + } + }, + "get": { + "operationId": "retrieveFile", + "tags": ["Files"], + "summary": "Returns information about a specific file.", + "parameters": [ + { + "in": "path", + "name": "file_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the file to use for this request." + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OpenAIFile" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Retrieve file", + "group": "files", + "returns": "The [File](/docs/api-reference/files/object) object matching the specified ID.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/files/file-abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.files.retrieve(\"file-abc123\")\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const file = await openai.files.retrieve(\"file-abc123\");\n\n console.log(file);\n}\n\nmain();" + }, + "response": "{\n \"id\": \"file-abc123\",\n \"object\": \"file\",\n \"bytes\": 120000,\n \"created_at\": 1677610602,\n \"filename\": \"mydata.jsonl\",\n \"purpose\": \"fine-tune\",\n}\n" + } + } + } + }, + "/files/{file_id}/content": { + "get": { + "operationId": "downloadFile", + "tags": ["Files"], + "summary": "Returns the contents of the specified file.", + "parameters": [ + { + "in": "path", + "name": "file_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the file to use for this request." + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Retrieve file content", + "group": "files", + "returns": "The file content.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/files/file-abc123/content \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" > file.jsonl\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\ncontent = client.files.content(\"file-abc123\")\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const file = await openai.files.content(\"file-abc123\");\n\n console.log(file);\n}\n\nmain();\n" + } + } + } + } + }, + "/uploads": { + "post": { + "operationId": "createUpload", + "tags": ["Uploads"], + "summary": "Creates an intermediate [Upload](/docs/api-reference/uploads/object) object that you can add [Parts](/docs/api-reference/uploads/part-object) to. Currently, an Upload can accept at most 8 GB in total and expires after an hour after you create it.\n\nOnce you complete the Upload, we will create a [File](/docs/api-reference/files/object) object that contains all the parts you uploaded. This File is usable in the rest of our platform as a regular File object.\n\nFor certain `purpose`s, the correct `mime_type` must be specified. Please refer to documentation for the supported MIME types for your use case:\n- [Assistants](/docs/assistants/tools/file-search/supported-files)\n\nFor guidance on the proper filename extensions for each purpose, please follow the documentation on [creating a File](/docs/api-reference/files/create).\n", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateUploadRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Upload" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Create upload", + "group": "uploads", + "returns": "The [Upload](/docs/api-reference/uploads/object) object with status `pending`.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/uploads \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"purpose\": \"fine-tune\",\n \"filename\": \"training_examples.jsonl\",\n \"bytes\": 2147483648,\n \"mime_type\": \"text/jsonl\"\n }'\n" + }, + "response": "{\n \"id\": \"upload_abc123\",\n \"object\": \"upload\",\n \"bytes\": 2147483648,\n \"created_at\": 1719184911,\n \"filename\": \"training_examples.jsonl\",\n \"purpose\": \"fine-tune\",\n \"status\": \"pending\",\n \"expires_at\": 1719127296\n}\n" + } + } + } + }, + "/uploads/{upload_id}/parts": { + "post": { + "operationId": "addUploadPart", + "tags": ["Uploads"], + "summary": "Adds a [Part](/docs/api-reference/uploads/part-object) to an [Upload](/docs/api-reference/uploads/object) object. A Part represents a chunk of bytes from the file you are trying to upload.\n\nEach Part can be at most 64 MB, and you can add Parts until you hit the Upload maximum of 8 GB.\n\nIt is possible to add multiple Parts in parallel. You can decide the intended order of the Parts when you [complete the Upload](/docs/api-reference/uploads/complete).\n", + "parameters": [ + { + "in": "path", + "name": "upload_id", + "required": true, + "schema": { + "type": "string", + "example": "upload_abc123" + }, + "description": "The ID of the Upload.\n" + } + ], + "requestBody": { + "required": true, + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/AddUploadPartRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UploadPart" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Add upload part", + "group": "uploads", + "returns": "The upload [Part](/docs/api-reference/uploads/part-object) object.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/uploads/upload_abc123/parts\n -F data=\"aHR0cHM6Ly9hcGkub3BlbmFpLmNvbS92MS91cGxvYWRz...\"\n" + }, + "response": "{\n \"id\": \"part_def456\",\n \"object\": \"upload.part\",\n \"created_at\": 1719185911,\n \"upload_id\": \"upload_abc123\"\n}\n" + } + } + } + }, + "/uploads/{upload_id}/complete": { + "post": { + "operationId": "completeUpload", + "tags": ["Uploads"], + "summary": "Completes the [Upload](/docs/api-reference/uploads/object).\n\nWithin the returned Upload object, there is a nested [File](/docs/api-reference/files/object) object that is ready to use in the rest of the platform.\n\nYou can specify the order of the Parts by passing in an ordered list of the Part IDs.\n\nThe number of bytes uploaded upon completion must match the number of bytes initially specified when creating the Upload object. No Parts may be added after an Upload is completed.\n", + "parameters": [ + { + "in": "path", + "name": "upload_id", + "required": true, + "schema": { + "type": "string", + "example": "upload_abc123" + }, + "description": "The ID of the Upload.\n" + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CompleteUploadRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Upload" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Complete upload", + "group": "uploads", + "returns": "The [Upload](/docs/api-reference/uploads/object) object with status `completed` with an additional `file` property containing the created usable File object.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/uploads/upload_abc123/complete\n -d '{\n \"part_ids\": [\"part_def456\", \"part_ghi789\"]\n }'\n" + }, + "response": "{\n \"id\": \"upload_abc123\",\n \"object\": \"upload\",\n \"bytes\": 2147483648,\n \"created_at\": 1719184911,\n \"filename\": \"training_examples.jsonl\",\n \"purpose\": \"fine-tune\",\n \"status\": \"completed\",\n \"expires_at\": 1719127296,\n \"file\": {\n \"id\": \"file-xyz321\",\n \"object\": \"file\",\n \"bytes\": 2147483648,\n \"created_at\": 1719186911,\n \"filename\": \"training_examples.jsonl\",\n \"purpose\": \"fine-tune\",\n }\n}\n" + } + } + } + }, + "/uploads/{upload_id}/cancel": { + "post": { + "operationId": "cancelUpload", + "tags": ["Uploads"], + "summary": "Cancels the Upload. No Parts may be added after an Upload is cancelled.\n", + "parameters": [ + { + "in": "path", + "name": "upload_id", + "required": true, + "schema": { + "type": "string", + "example": "upload_abc123" + }, + "description": "The ID of the Upload.\n" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Upload" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Cancel upload", + "group": "uploads", + "returns": "The [Upload](/docs/api-reference/uploads/object) object with status `cancelled`.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/uploads/upload_abc123/cancel\n" + }, + "response": "{\n \"id\": \"upload_abc123\",\n \"object\": \"upload\",\n \"bytes\": 2147483648,\n \"created_at\": 1719184911,\n \"filename\": \"training_examples.jsonl\",\n \"purpose\": \"fine-tune\",\n \"status\": \"cancelled\",\n \"expires_at\": 1719127296\n}\n" + } + } + } + }, + "/fine_tuning/jobs": { + "post": { + "operationId": "createFineTuningJob", + "tags": ["Fine-tuning"], + "summary": "Creates a fine-tuning job which begins the process of creating a new model from a given dataset.\n\nResponse includes details of the enqueued job including job status and the name of the fine-tuned models once complete.\n\n[Learn more about fine-tuning](/docs/guides/fine-tuning)\n", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateFineTuningJobRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FineTuningJob" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Create fine-tuning job", + "group": "fine-tuning", + "returns": "A [fine-tuning.job](/docs/api-reference/fine-tuning/object) object.", + "examples": [ + { + "title": "Default", + "request": { + "curl": "curl https://api.openai.com/v1/fine_tuning/jobs \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"training_file\": \"file-BK7bzQj3FfZFXr7DbL6xJwfo\",\n \"model\": \"gpt-4o-mini\"\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.fine_tuning.jobs.create(\n training_file=\"file-abc123\",\n model=\"gpt-4o-mini\"\n)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const fineTune = await openai.fineTuning.jobs.create({\n training_file: \"file-abc123\"\n });\n\n console.log(fineTune);\n}\n\nmain();\n" + }, + "response": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \"created_at\": 1721764800,\n \"fine_tuned_model\": null,\n \"organization_id\": \"org-123\",\n \"result_files\": [],\n \"status\": \"queued\",\n \"validation_file\": null,\n \"training_file\": \"file-abc123\",\n}\n" + }, + { + "title": "Epochs", + "request": { + "curl": "curl https://api.openai.com/v1/fine_tuning/jobs \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"training_file\": \"file-abc123\",\n \"model\": \"gpt-4o-mini\",\n \"hyperparameters\": {\n \"n_epochs\": 2\n }\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.fine_tuning.jobs.create(\n training_file=\"file-abc123\",\n model=\"gpt-4o-mini\",\n hyperparameters={\n \"n_epochs\":2\n }\n)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const fineTune = await openai.fineTuning.jobs.create({\n training_file: \"file-abc123\",\n model: \"gpt-4o-mini\",\n hyperparameters: { n_epochs: 2 }\n });\n\n console.log(fineTune);\n}\n\nmain();\n" + }, + "response": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \"created_at\": 1721764800,\n \"fine_tuned_model\": null,\n \"organization_id\": \"org-123\",\n \"result_files\": [],\n \"status\": \"queued\",\n \"validation_file\": null,\n \"training_file\": \"file-abc123\",\n \"hyperparameters\": {\"n_epochs\": 2},\n}\n" + }, + { + "title": "Validation file", + "request": { + "curl": "curl https://api.openai.com/v1/fine_tuning/jobs \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"training_file\": \"file-abc123\",\n \"validation_file\": \"file-abc123\",\n \"model\": \"gpt-4o-mini\"\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.fine_tuning.jobs.create(\n training_file=\"file-abc123\",\n validation_file=\"file-def456\",\n model=\"gpt-4o-mini\"\n)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const fineTune = await openai.fineTuning.jobs.create({\n training_file: \"file-abc123\",\n validation_file: \"file-abc123\"\n });\n\n console.log(fineTune);\n}\n\nmain();\n" + }, + "response": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \"created_at\": 1721764800,\n \"fine_tuned_model\": null,\n \"organization_id\": \"org-123\",\n \"result_files\": [],\n \"status\": \"queued\",\n \"validation_file\": \"file-abc123\",\n \"training_file\": \"file-abc123\",\n}\n" + }, + { + "title": "W&B Integration", + "request": { + "curl": "curl https://api.openai.com/v1/fine_tuning/jobs \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"training_file\": \"file-abc123\",\n \"validation_file\": \"file-abc123\",\n \"model\": \"gpt-4o-mini\",\n \"integrations\": [\n {\n \"type\": \"wandb\",\n \"wandb\": {\n \"project\": \"my-wandb-project\",\n \"name\": \"ft-run-display-name\"\n \"tags\": [\n \"first-experiment\", \"v2\"\n ]\n }\n }\n ]\n }'\n" + }, + "response": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \"created_at\": 1721764800,\n \"fine_tuned_model\": null,\n \"organization_id\": \"org-123\",\n \"result_files\": [],\n \"status\": \"queued\",\n \"validation_file\": \"file-abc123\",\n \"training_file\": \"file-abc123\",\n \"integrations\": [\n {\n \"type\": \"wandb\",\n \"wandb\": {\n \"project\": \"my-wandb-project\",\n \"entity\": None,\n \"run_id\": \"ftjob-abc123\"\n }\n }\n ]\n}\n" + } + ] + } + }, + "get": { + "operationId": "listPaginatedFineTuningJobs", + "tags": ["Fine-tuning"], + "summary": "List your organization's fine-tuning jobs\n", + "parameters": [ + { + "name": "after", + "in": "query", + "description": "Identifier for the last job from the previous pagination request.", + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "limit", + "in": "query", + "description": "Number of fine-tuning jobs to retrieve.", + "required": false, + "schema": { + "type": "integer", + "default": 20 + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListPaginatedFineTuningJobsResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "List fine-tuning jobs", + "group": "fine-tuning", + "returns": "A list of paginated [fine-tuning job](/docs/api-reference/fine-tuning/object) objects.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/fine_tuning/jobs?limit=2 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.fine_tuning.jobs.list()\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const list = await openai.fineTuning.jobs.list();\n\n for await (const fineTune of list) {\n console.log(fineTune);\n }\n}\n\nmain();" + }, + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"fine_tuning.job.event\",\n \"id\": \"ft-event-TjX0lMfOniCZX64t9PUQT5hn\",\n \"created_at\": 1689813489,\n \"level\": \"warn\",\n \"message\": \"Fine tuning process stopping due to job cancellation\",\n \"data\": null,\n \"type\": \"message\"\n },\n { ... },\n { ... }\n ], \"has_more\": true\n}\n" + } + } + } + }, + "/fine_tuning/jobs/{fine_tuning_job_id}": { + "get": { + "operationId": "retrieveFineTuningJob", + "tags": ["Fine-tuning"], + "summary": "Get info about a fine-tuning job.\n\n[Learn more about fine-tuning](/docs/guides/fine-tuning)\n", + "parameters": [ + { + "in": "path", + "name": "fine_tuning_job_id", + "required": true, + "schema": { + "type": "string", + "example": "ft-AF1WoRqd3aJAHsqc9NY7iL8F" + }, + "description": "The ID of the fine-tuning job.\n" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FineTuningJob" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Retrieve fine-tuning job", + "group": "fine-tuning", + "returns": "The [fine-tuning](/docs/api-reference/fine-tuning/object) object with the given ID.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/fine_tuning/jobs/ft-AF1WoRqd3aJAHsqc9NY7iL8F \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.fine_tuning.jobs.retrieve(\"ftjob-abc123\")\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const fineTune = await openai.fineTuning.jobs.retrieve(\"ftjob-abc123\");\n\n console.log(fineTune);\n}\n\nmain();\n" + }, + "response": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"davinci-002\",\n \"created_at\": 1692661014,\n \"finished_at\": 1692661190,\n \"fine_tuned_model\": \"ft:davinci-002:my-org:custom_suffix:7q8mpxmy\",\n \"organization_id\": \"org-123\",\n \"result_files\": [\n \"file-abc123\"\n ],\n \"status\": \"succeeded\",\n \"validation_file\": null,\n \"training_file\": \"file-abc123\",\n \"hyperparameters\": {\n \"n_epochs\": 4,\n \"batch_size\": 1,\n \"learning_rate_multiplier\": 1.0\n },\n \"trained_tokens\": 5768,\n \"integrations\": [],\n \"seed\": 0,\n \"estimated_finish\": 0\n}\n" + } + } + } + }, + "/fine_tuning/jobs/{fine_tuning_job_id}/events": { + "get": { + "operationId": "listFineTuningEvents", + "tags": ["Fine-tuning"], + "summary": "Get status updates for a fine-tuning job.\n", + "parameters": [ + { + "in": "path", + "name": "fine_tuning_job_id", + "required": true, + "schema": { + "type": "string", + "example": "ft-AF1WoRqd3aJAHsqc9NY7iL8F" + }, + "description": "The ID of the fine-tuning job to get events for.\n" + }, + { + "name": "after", + "in": "query", + "description": "Identifier for the last event from the previous pagination request.", + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "limit", + "in": "query", + "description": "Number of events to retrieve.", + "required": false, + "schema": { + "type": "integer", + "default": 20 + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListFineTuningJobEventsResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "List fine-tuning events", + "group": "fine-tuning", + "returns": "A list of fine-tuning event objects.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/events \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.fine_tuning.jobs.list_events(\n fine_tuning_job_id=\"ftjob-abc123\",\n limit=2\n)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const list = await openai.fineTuning.list_events(id=\"ftjob-abc123\", limit=2);\n\n for await (const fineTune of list) {\n console.log(fineTune);\n }\n}\n\nmain();" + }, + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"fine_tuning.job.event\",\n \"id\": \"ft-event-ddTJfwuMVpfLXseO0Am0Gqjm\",\n \"created_at\": 1721764800,\n \"level\": \"info\",\n \"message\": \"Fine tuning job successfully completed\",\n \"data\": null,\n \"type\": \"message\"\n },\n {\n \"object\": \"fine_tuning.job.event\",\n \"id\": \"ft-event-tyiGuB72evQncpH87xe505Sv\",\n \"created_at\": 1721764800,\n \"level\": \"info\",\n \"message\": \"New fine-tuned model created: ft:gpt-4o-mini:openai::7p4lURel\",\n \"data\": null,\n \"type\": \"message\"\n }\n ],\n \"has_more\": true\n}\n" + } + } + } + }, + "/fine_tuning/jobs/{fine_tuning_job_id}/cancel": { + "post": { + "operationId": "cancelFineTuningJob", + "tags": ["Fine-tuning"], + "summary": "Immediately cancel a fine-tune job.\n", + "parameters": [ + { + "in": "path", + "name": "fine_tuning_job_id", + "required": true, + "schema": { + "type": "string", + "example": "ft-AF1WoRqd3aJAHsqc9NY7iL8F" + }, + "description": "The ID of the fine-tuning job to cancel.\n" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FineTuningJob" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Cancel fine-tuning", + "group": "fine-tuning", + "returns": "The cancelled [fine-tuning](/docs/api-reference/fine-tuning/object) object.", + "examples": { + "request": { + "curl": "curl -X POST https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/cancel \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.fine_tuning.jobs.cancel(\"ftjob-abc123\")\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const fineTune = await openai.fineTuning.jobs.cancel(\"ftjob-abc123\");\n\n console.log(fineTune);\n}\nmain();" + }, + "response": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \"created_at\": 1721764800,\n \"fine_tuned_model\": null,\n \"organization_id\": \"org-123\",\n \"result_files\": [],\n \"hyperparameters\": {\n \"n_epochs\": \"auto\"\n },\n \"status\": \"cancelled\",\n \"validation_file\": \"file-abc123\",\n \"training_file\": \"file-abc123\"\n}\n" + } + } + } + }, + "/fine_tuning/jobs/{fine_tuning_job_id}/checkpoints": { + "get": { + "operationId": "listFineTuningJobCheckpoints", + "tags": ["Fine-tuning"], + "summary": "List checkpoints for a fine-tuning job.\n", + "parameters": [ + { + "in": "path", + "name": "fine_tuning_job_id", + "required": true, + "schema": { + "type": "string", + "example": "ft-AF1WoRqd3aJAHsqc9NY7iL8F" + }, + "description": "The ID of the fine-tuning job to get checkpoints for.\n" + }, + { + "name": "after", + "in": "query", + "description": "Identifier for the last checkpoint ID from the previous pagination request.", + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "limit", + "in": "query", + "description": "Number of checkpoints to retrieve.", + "required": false, + "schema": { + "type": "integer", + "default": 10 + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListFineTuningJobCheckpointsResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "List fine-tuning checkpoints", + "group": "fine-tuning", + "returns": "A list of fine-tuning [checkpoint objects](/docs/api-reference/fine-tuning/checkpoint-object) for a fine-tuning job.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/checkpoints \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n" + }, + "response": "{\n \"object\": \"list\"\n \"data\": [\n {\n \"object\": \"fine_tuning.job.checkpoint\",\n \"id\": \"ftckpt_zc4Q7MP6XxulcVzj4MZdwsAB\",\n \"created_at\": 1721764867,\n \"fine_tuned_model_checkpoint\": \"ft:gpt-4o-mini-2024-07-18:my-org:custom-suffix:96olL566:ckpt-step-2000\",\n \"metrics\": {\n \"full_valid_loss\": 0.134,\n \"full_valid_mean_token_accuracy\": 0.874\n },\n \"fine_tuning_job_id\": \"ftjob-abc123\",\n \"step_number\": 2000,\n },\n {\n \"object\": \"fine_tuning.job.checkpoint\",\n \"id\": \"ftckpt_enQCFmOTGj3syEpYVhBRLTSy\",\n \"created_at\": 1721764800,\n \"fine_tuned_model_checkpoint\": \"ft:gpt-4o-mini-2024-07-18:my-org:custom-suffix:7q8mpxmy:ckpt-step-1000\",\n \"metrics\": {\n \"full_valid_loss\": 0.167,\n \"full_valid_mean_token_accuracy\": 0.781\n },\n \"fine_tuning_job_id\": \"ftjob-abc123\",\n \"step_number\": 1000,\n },\n ],\n \"first_id\": \"ftckpt_zc4Q7MP6XxulcVzj4MZdwsAB\",\n \"last_id\": \"ftckpt_enQCFmOTGj3syEpYVhBRLTSy\",\n \"has_more\": true\n}\n" + } + } + } + }, + "/models": { + "get": { + "operationId": "listModels", + "tags": ["Models"], + "summary": "Lists the currently available models, and provides basic information about each one such as the owner and availability.", + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListModelsResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "List models", + "group": "models", + "returns": "A list of [model](/docs/api-reference/models/object) objects.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/models \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.models.list()\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const list = await openai.models.list();\n\n for await (const model of list) {\n console.log(model);\n }\n}\nmain();" + }, + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"model-id-0\",\n \"object\": \"model\",\n \"created\": 1686935002,\n \"owned_by\": \"organization-owner\"\n },\n {\n \"id\": \"model-id-1\",\n \"object\": \"model\",\n \"created\": 1686935002,\n \"owned_by\": \"organization-owner\",\n },\n {\n \"id\": \"model-id-2\",\n \"object\": \"model\",\n \"created\": 1686935002,\n \"owned_by\": \"openai\"\n },\n ],\n \"object\": \"list\"\n}\n" + } + } + } + }, + "/models/{model}": { + "get": { + "operationId": "retrieveModel", + "tags": ["Models"], + "summary": "Retrieves a model instance, providing basic information about the model such as the owner and permissioning.", + "parameters": [ + { + "in": "path", + "name": "model", + "required": true, + "schema": { + "type": "string", + "example": "gpt-4o-mini" + }, + "description": "The ID of the model to use for this request" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Model" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Retrieve model", + "group": "models", + "returns": "The [model](/docs/api-reference/models/object) object matching the specified ID.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/models/VAR_model_id \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.models.retrieve(\"VAR_model_id\")\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const model = await openai.models.retrieve(\"VAR_model_id\");\n\n console.log(model);\n}\n\nmain();" + }, + "response": "{\n \"id\": \"VAR_model_id\",\n \"object\": \"model\",\n \"created\": 1686935002,\n \"owned_by\": \"openai\"\n}\n" + } + } + }, + "delete": { + "operationId": "deleteModel", + "tags": ["Models"], + "summary": "Delete a fine-tuned model. You must have the Owner role in your organization to delete a model.", + "parameters": [ + { + "in": "path", + "name": "model", + "required": true, + "schema": { + "type": "string", + "example": "ft:gpt-4o-mini:acemeco:suffix:abc123" + }, + "description": "The model to delete" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeleteModelResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Delete a fine-tuned model", + "group": "models", + "returns": "Deletion status.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/models/ft:gpt-4o-mini:acemeco:suffix:abc123 \\\n -X DELETE \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.models.delete(\"ft:gpt-4o-mini:acemeco:suffix:abc123\")\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const model = await openai.models.del(\"ft:gpt-4o-mini:acemeco:suffix:abc123\");\n\n console.log(model);\n}\nmain();" + }, + "response": "{\n \"id\": \"ft:gpt-4o-mini:acemeco:suffix:abc123\",\n \"object\": \"model\",\n \"deleted\": true\n}\n" + } + } + } + }, + "/moderations": { + "post": { + "operationId": "createModeration", + "tags": ["Moderations"], + "summary": "Classifies if text and/or image inputs are potentially harmful. Learn\nmore in the [moderation guide](/docs/guides/moderation).\n", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateModerationRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateModerationResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Create moderation", + "group": "moderations", + "returns": "A [moderation](/docs/api-reference/moderations/object) object.", + "examples": [ + { + "title": "Single string", + "request": { + "curl": "curl https://api.openai.com/v1/moderations \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"input\": \"I want to kill them.\"\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nmoderation = client.moderations.create(input=\"I want to kill them.\")\nprint(moderation)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const moderation = await openai.moderations.create({ input: \"I want to kill them.\" });\n\n console.log(moderation);\n}\nmain();\n" + }, + "response": "{\n \"id\": \"modr-AB8CjOTu2jiq12hp1AQPfeqFWaORR\",\n \"model\": \"text-moderation-007\",\n \"results\": [\n {\n \"flagged\": true,\n \"categories\": {\n \"sexual\": false,\n \"hate\": false,\n \"harassment\": true,\n \"self-harm\": false,\n \"sexual/minors\": false,\n \"hate/threatening\": false,\n \"violence/graphic\": false,\n \"self-harm/intent\": false,\n \"self-harm/instructions\": false,\n \"harassment/threatening\": true,\n \"violence\": true\n },\n \"category_scores\": {\n \"sexual\": 0.000011726012417057063,\n \"hate\": 0.22706663608551025,\n \"harassment\": 0.5215635299682617,\n \"self-harm\": 2.227119921371923e-6,\n \"sexual/minors\": 7.107352217872176e-8,\n \"hate/threatening\": 0.023547329008579254,\n \"violence/graphic\": 0.00003391829886822961,\n \"self-harm/intent\": 1.646940972932498e-6,\n \"self-harm/instructions\": 1.1198755256458526e-9,\n \"harassment/threatening\": 0.5694745779037476,\n \"violence\": 0.9971134662628174\n }\n }\n ]\n}\n" + }, + { + "title": "Image and text", + "request": { + "curl": "curl https://api.openai.com/v1/moderations \\\n -X POST \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"omni-moderation-latest\",\n \"input\": [\n { \"type\": \"text\", \"text\": \"...text to classify goes here...\" },\n {\n \"type\": \"image_url\",\n \"image_url\": {\n \"url\": \"https://example.com/image.png\"\n }\n }\n ]\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nresponse = client.moderations.create(\n model=\"omni-moderation-latest\",\n input=[\n {\"type\": \"text\", \"text\": \"...text to classify goes here...\"},\n {\n \"type\": \"image_url\",\n \"image_url\": {\n \"url\": \"https://example.com/image.png\",\n # can also use base64 encoded image URLs\n # \"url\": \"data:image/jpeg;base64,abcdefg...\"\n }\n },\n ],\n)\n\nprint(response)\n", + "node.js": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nconst moderation = await openai.moderations.create({\n model: \"omni-moderation-latest\",\n input: [\n { type: \"text\", text: \"...text to classify goes here...\" },\n {\n type: \"image_url\",\n image_url: {\n url: \"https://example.com/image.png\"\n // can also use base64 encoded image URLs\n // url: \"data:image/jpeg;base64,abcdefg...\"\n }\n }\n ],\n});\n\nconsole.log(moderation);\n" + }, + "response": "{\n \"id\": \"modr-0d9740456c391e43c445bf0f010940c7\",\n \"model\": \"omni-moderation-latest\",\n \"results\": [\n {\n \"flagged\": true,\n \"categories\": {\n \"harassment\": true,\n \"harassment/threatening\": true,\n \"sexual\": false,\n \"hate\": false,\n \"hate/threatening\": false,\n \"illicit\": false,\n \"illicit/violent\": false,\n \"self-harm/intent\": false,\n \"self-harm/instructions\": false,\n \"self-harm\": false,\n \"sexual/minors\": false,\n \"violence\": true,\n \"violence/graphic\": true\n },\n \"category_scores\": {\n \"harassment\": 0.8189693396524255,\n \"harassment/threatening\": 0.804985420696006,\n \"sexual\": 1.573112165348997e-6,\n \"hate\": 0.007562942636942845,\n \"hate/threatening\": 0.004208854591835476,\n \"illicit\": 0.030535955153511665,\n \"illicit/violent\": 0.008925306722380033,\n \"self-harm/intent\": 0.00023023930975076432,\n \"self-harm/instructions\": 0.0002293869201073356,\n \"self-harm\": 0.012598046106750154,\n \"sexual/minors\": 2.212566909570261e-8,\n \"violence\": 0.9999992735124786,\n \"violence/graphic\": 0.843064871157054\n },\n \"category_applied_input_types\": {\n \"harassment\": [\n \"text\"\n ],\n \"harassment/threatening\": [\n \"text\"\n ],\n \"sexual\": [\n \"text\",\n \"image\"\n ],\n \"hate\": [\n \"text\"\n ],\n \"hate/threatening\": [\n \"text\"\n ],\n \"illicit\": [\n \"text\"\n ],\n \"illicit/violent\": [\n \"text\"\n ],\n \"self-harm/intent\": [\n \"text\",\n \"image\"\n ],\n \"self-harm/instructions\": [\n \"text\",\n \"image\"\n ],\n \"self-harm\": [\n \"text\",\n \"image\"\n ],\n \"sexual/minors\": [\n \"text\"\n ],\n \"violence\": [\n \"text\",\n \"image\"\n ],\n \"violence/graphic\": [\n \"text\",\n \"image\"\n ]\n }\n }\n ]\n}\n" + } + ] + } + } + }, + "/assistants": { + "get": { + "operationId": "listAssistants", + "tags": ["Assistants"], + "summary": "Returns a list of assistants.", + "parameters": [ + { + "name": "limit", + "in": "query", + "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n", + "required": false, + "schema": { + "type": "integer", + "default": 20 + } + }, + { + "name": "order", + "in": "query", + "description": "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n", + "schema": { + "type": "string", + "default": "desc", + "enum": ["asc", "desc"] + } + }, + { + "name": "after", + "in": "query", + "description": "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n", + "schema": { + "type": "string" + } + }, + { + "name": "before", + "in": "query", + "description": "A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.\n", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListAssistantsResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "List assistants", + "group": "assistants", + "beta": true, + "returns": "A list of [assistant](/docs/api-reference/assistants/object) objects.", + "examples": { + "request": { + "curl": "curl \"https://api.openai.com/v1/assistants?order=desc&limit=20\" \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nmy_assistants = client.beta.assistants.list(\n order=\"desc\",\n limit=\"20\",\n)\nprint(my_assistants.data)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const myAssistants = await openai.beta.assistants.list({\n order: \"desc\",\n limit: \"20\",\n });\n\n console.log(myAssistants.data);\n}\n\nmain();" + }, + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"asst_abc123\",\n \"object\": \"assistant\",\n \"created_at\": 1698982736,\n \"name\": \"Coding Tutor\",\n \"description\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": \"You are a helpful assistant designed to make me better at coding!\",\n \"tools\": [],\n \"tool_resources\": {},\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n },\n {\n \"id\": \"asst_abc456\",\n \"object\": \"assistant\",\n \"created_at\": 1698982718,\n \"name\": \"My Assistant\",\n \"description\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": \"You are a helpful assistant designed to make me better at coding!\",\n \"tools\": [],\n \"tool_resources\": {},\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n },\n {\n \"id\": \"asst_abc789\",\n \"object\": \"assistant\",\n \"created_at\": 1698982643,\n \"name\": null,\n \"description\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": null,\n \"tools\": [],\n \"tool_resources\": {},\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n }\n ],\n \"first_id\": \"asst_abc123\",\n \"last_id\": \"asst_abc789\",\n \"has_more\": false\n}\n" + } + } + }, + "post": { + "operationId": "createAssistant", + "tags": ["Assistants"], + "summary": "Create an assistant with a model and instructions.", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateAssistantRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AssistantObject" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Create assistant", + "group": "assistants", + "beta": true, + "returns": "An [assistant](/docs/api-reference/assistants/object) object.", + "examples": [ + { + "title": "Code Interpreter", + "request": { + "curl": "curl \"https://api.openai.com/v1/assistants\" \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"instructions\": \"You are a personal math tutor. When asked a question, write and run Python code to answer the question.\",\n \"name\": \"Math Tutor\",\n \"tools\": [{\"type\": \"code_interpreter\"}],\n \"model\": \"gpt-4o\"\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nmy_assistant = client.beta.assistants.create(\n instructions=\"You are a personal math tutor. When asked a question, write and run Python code to answer the question.\",\n name=\"Math Tutor\",\n tools=[{\"type\": \"code_interpreter\"}],\n model=\"gpt-4o\",\n)\nprint(my_assistant)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const myAssistant = await openai.beta.assistants.create({\n instructions:\n \"You are a personal math tutor. When asked a question, write and run Python code to answer the question.\",\n name: \"Math Tutor\",\n tools: [{ type: \"code_interpreter\" }],\n model: \"gpt-4o\",\n });\n\n console.log(myAssistant);\n}\n\nmain();" + }, + "response": "{\n \"id\": \"asst_abc123\",\n \"object\": \"assistant\",\n \"created_at\": 1698984975,\n \"name\": \"Math Tutor\",\n \"description\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": \"You are a personal math tutor. When asked a question, write and run Python code to answer the question.\",\n \"tools\": [\n {\n \"type\": \"code_interpreter\"\n }\n ],\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n}\n" + }, + { + "title": "Files", + "request": { + "curl": "curl https://api.openai.com/v1/assistants \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"instructions\": \"You are an HR bot, and you have access to files to answer employee questions about company policies.\",\n \"tools\": [{\"type\": \"file_search\"}],\n \"tool_resources\": {\"file_search\": {\"vector_store_ids\": [\"vs_123\"]}},\n \"model\": \"gpt-4o\"\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nmy_assistant = client.beta.assistants.create(\n instructions=\"You are an HR bot, and you have access to files to answer employee questions about company policies.\",\n name=\"HR Helper\",\n tools=[{\"type\": \"file_search\"}],\n tool_resources={\"file_search\": {\"vector_store_ids\": [\"vs_123\"]}},\n model=\"gpt-4o\"\n)\nprint(my_assistant)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const myAssistant = await openai.beta.assistants.create({\n instructions:\n \"You are an HR bot, and you have access to files to answer employee questions about company policies.\",\n name: \"HR Helper\",\n tools: [{ type: \"file_search\" }],\n tool_resources: {\n file_search: {\n vector_store_ids: [\"vs_123\"]\n }\n },\n model: \"gpt-4o\"\n });\n\n console.log(myAssistant);\n}\n\nmain();" + }, + "response": "{\n \"id\": \"asst_abc123\",\n \"object\": \"assistant\",\n \"created_at\": 1699009403,\n \"name\": \"HR Helper\",\n \"description\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": \"You are an HR bot, and you have access to files to answer employee questions about company policies.\",\n \"tools\": [\n {\n \"type\": \"file_search\"\n }\n ],\n \"tool_resources\": {\n \"file_search\": {\n \"vector_store_ids\": [\"vs_123\"]\n }\n },\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n}\n" + } + ] + } + } + }, + "/assistants/{assistant_id}": { + "get": { + "operationId": "getAssistant", + "tags": ["Assistants"], + "summary": "Retrieves an assistant.", + "parameters": [ + { + "in": "path", + "name": "assistant_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the assistant to retrieve." + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AssistantObject" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Retrieve assistant", + "group": "assistants", + "beta": true, + "returns": "The [assistant](/docs/api-reference/assistants/object) object matching the specified ID.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/assistants/asst_abc123 \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nmy_assistant = client.beta.assistants.retrieve(\"asst_abc123\")\nprint(my_assistant)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const myAssistant = await openai.beta.assistants.retrieve(\n \"asst_abc123\"\n );\n\n console.log(myAssistant);\n}\n\nmain();" + }, + "response": "{\n \"id\": \"asst_abc123\",\n \"object\": \"assistant\",\n \"created_at\": 1699009709,\n \"name\": \"HR Helper\",\n \"description\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": \"You are an HR bot, and you have access to files to answer employee questions about company policies.\",\n \"tools\": [\n {\n \"type\": \"file_search\"\n }\n ],\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n}\n" + } + } + }, + "post": { + "operationId": "modifyAssistant", + "tags": ["Assistants"], + "summary": "Modifies an assistant.", + "parameters": [ + { + "in": "path", + "name": "assistant_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the assistant to modify." + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ModifyAssistantRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AssistantObject" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Modify assistant", + "group": "assistants", + "beta": true, + "returns": "The modified [assistant](/docs/api-reference/assistants/object) object.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/assistants/asst_abc123 \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"instructions\": \"You are an HR bot, and you have access to files to answer employee questions about company policies. Always response with info from either of the files.\",\n \"tools\": [{\"type\": \"file_search\"}],\n \"model\": \"gpt-4o\"\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nmy_updated_assistant = client.beta.assistants.update(\n \"asst_abc123\",\n instructions=\"You are an HR bot, and you have access to files to answer employee questions about company policies. Always response with info from either of the files.\",\n name=\"HR Helper\",\n tools=[{\"type\": \"file_search\"}],\n model=\"gpt-4o\"\n)\n\nprint(my_updated_assistant)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const myUpdatedAssistant = await openai.beta.assistants.update(\n \"asst_abc123\",\n {\n instructions:\n \"You are an HR bot, and you have access to files to answer employee questions about company policies. Always response with info from either of the files.\",\n name: \"HR Helper\",\n tools: [{ type: \"file_search\" }],\n model: \"gpt-4o\"\n }\n );\n\n console.log(myUpdatedAssistant);\n}\n\nmain();" + }, + "response": "{\n \"id\": \"asst_123\",\n \"object\": \"assistant\",\n \"created_at\": 1699009709,\n \"name\": \"HR Helper\",\n \"description\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": \"You are an HR bot, and you have access to files to answer employee questions about company policies. Always response with info from either of the files.\",\n \"tools\": [\n {\n \"type\": \"file_search\"\n }\n ],\n \"tool_resources\": {\n \"file_search\": {\n \"vector_store_ids\": []\n }\n },\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n}\n" + } + } + }, + "delete": { + "operationId": "deleteAssistant", + "tags": ["Assistants"], + "summary": "Delete an assistant.", + "parameters": [ + { + "in": "path", + "name": "assistant_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the assistant to delete." + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeleteAssistantResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Delete assistant", + "group": "assistants", + "beta": true, + "returns": "Deletion status", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/assistants/asst_abc123 \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -X DELETE\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nresponse = client.beta.assistants.delete(\"asst_abc123\")\nprint(response)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const response = await openai.beta.assistants.del(\"asst_abc123\");\n\n console.log(response);\n}\nmain();" + }, + "response": "{\n \"id\": \"asst_abc123\",\n \"object\": \"assistant.deleted\",\n \"deleted\": true\n}\n" + } + } + } + }, + "/threads": { + "post": { + "operationId": "createThread", + "tags": ["Assistants"], + "summary": "Create a thread.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateThreadRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ThreadObject" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Create thread", + "group": "threads", + "beta": true, + "returns": "A [thread](/docs/api-reference/threads) object.", + "examples": [ + { + "title": "Empty", + "request": { + "curl": "curl https://api.openai.com/v1/threads \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d ''\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nempty_thread = client.beta.threads.create()\nprint(empty_thread)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const emptyThread = await openai.beta.threads.create();\n\n console.log(emptyThread);\n}\n\nmain();" + }, + "response": "{\n \"id\": \"thread_abc123\",\n \"object\": \"thread\",\n \"created_at\": 1699012949,\n \"metadata\": {},\n \"tool_resources\": {}\n}\n" + }, + { + "title": "Messages", + "request": { + "curl": "curl https://api.openai.com/v1/threads \\\n-H \"Content-Type: application/json\" \\\n-H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n-H \"OpenAI-Beta: assistants=v2\" \\\n-d '{\n \"messages\": [{\n \"role\": \"user\",\n \"content\": \"Hello, what is AI?\"\n }, {\n \"role\": \"user\",\n \"content\": \"How does AI work? Explain it in simple terms.\"\n }]\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nmessage_thread = client.beta.threads.create(\n messages=[\n {\n \"role\": \"user\",\n \"content\": \"Hello, what is AI?\"\n },\n {\n \"role\": \"user\",\n \"content\": \"How does AI work? Explain it in simple terms.\"\n },\n ]\n)\n\nprint(message_thread)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const messageThread = await openai.beta.threads.create({\n messages: [\n {\n role: \"user\",\n content: \"Hello, what is AI?\"\n },\n {\n role: \"user\",\n content: \"How does AI work? Explain it in simple terms.\",\n },\n ],\n });\n\n console.log(messageThread);\n}\n\nmain();" + }, + "response": "{\n \"id\": \"thread_abc123\",\n \"object\": \"thread\",\n \"created_at\": 1699014083,\n \"metadata\": {},\n \"tool_resources\": {}\n}\n" + } + ] + } + } + }, + "/threads/{thread_id}": { + "get": { + "operationId": "getThread", + "tags": ["Assistants"], + "summary": "Retrieves a thread.", + "parameters": [ + { + "in": "path", + "name": "thread_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the thread to retrieve." + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ThreadObject" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Retrieve thread", + "group": "threads", + "beta": true, + "returns": "The [thread](/docs/api-reference/threads/object) object matching the specified ID.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/threads/thread_abc123 \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nmy_thread = client.beta.threads.retrieve(\"thread_abc123\")\nprint(my_thread)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const myThread = await openai.beta.threads.retrieve(\n \"thread_abc123\"\n );\n\n console.log(myThread);\n}\n\nmain();" + }, + "response": "{\n \"id\": \"thread_abc123\",\n \"object\": \"thread\",\n \"created_at\": 1699014083,\n \"metadata\": {},\n \"tool_resources\": {\n \"code_interpreter\": {\n \"file_ids\": []\n }\n }\n}\n" + } + } + }, + "post": { + "operationId": "modifyThread", + "tags": ["Assistants"], + "summary": "Modifies a thread.", + "parameters": [ + { + "in": "path", + "name": "thread_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the thread to modify. Only the `metadata` can be modified." + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ModifyThreadRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ThreadObject" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Modify thread", + "group": "threads", + "beta": true, + "returns": "The modified [thread](/docs/api-reference/threads/object) object matching the specified ID.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/threads/thread_abc123 \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"metadata\": {\n \"modified\": \"true\",\n \"user\": \"abc123\"\n }\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nmy_updated_thread = client.beta.threads.update(\n \"thread_abc123\",\n metadata={\n \"modified\": \"true\",\n \"user\": \"abc123\"\n }\n)\nprint(my_updated_thread)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const updatedThread = await openai.beta.threads.update(\n \"thread_abc123\",\n {\n metadata: { modified: \"true\", user: \"abc123\" },\n }\n );\n\n console.log(updatedThread);\n}\n\nmain();" + }, + "response": "{\n \"id\": \"thread_abc123\",\n \"object\": \"thread\",\n \"created_at\": 1699014083,\n \"metadata\": {\n \"modified\": \"true\",\n \"user\": \"abc123\"\n },\n \"tool_resources\": {}\n}\n" + } + } + }, + "delete": { + "operationId": "deleteThread", + "tags": ["Assistants"], + "summary": "Delete a thread.", + "parameters": [ + { + "in": "path", + "name": "thread_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the thread to delete." + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeleteThreadResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Delete thread", + "group": "threads", + "beta": true, + "returns": "Deletion status", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/threads/thread_abc123 \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -X DELETE\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nresponse = client.beta.threads.delete(\"thread_abc123\")\nprint(response)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const response = await openai.beta.threads.del(\"thread_abc123\");\n\n console.log(response);\n}\nmain();" + }, + "response": "{\n \"id\": \"thread_abc123\",\n \"object\": \"thread.deleted\",\n \"deleted\": true\n}\n" + } + } + } + }, + "/threads/{thread_id}/messages": { + "get": { + "operationId": "listMessages", + "tags": ["Assistants"], + "summary": "Returns a list of messages for a given thread.", + "parameters": [ + { + "in": "path", + "name": "thread_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the [thread](/docs/api-reference/threads) the messages belong to." + }, + { + "name": "limit", + "in": "query", + "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n", + "required": false, + "schema": { + "type": "integer", + "default": 20 + } + }, + { + "name": "order", + "in": "query", + "description": "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n", + "schema": { + "type": "string", + "default": "desc", + "enum": ["asc", "desc"] + } + }, + { + "name": "after", + "in": "query", + "description": "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n", + "schema": { + "type": "string" + } + }, + { + "name": "before", + "in": "query", + "description": "A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.\n", + "schema": { + "type": "string" + } + }, + { + "name": "run_id", + "in": "query", + "description": "Filter messages by the run ID that generated them.\n", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListMessagesResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "List messages", + "group": "threads", + "beta": true, + "returns": "A list of [message](/docs/api-reference/messages) objects.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/threads/thread_abc123/messages \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nthread_messages = client.beta.threads.messages.list(\"thread_abc123\")\nprint(thread_messages.data)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const threadMessages = await openai.beta.threads.messages.list(\n \"thread_abc123\"\n );\n\n console.log(threadMessages.data);\n}\n\nmain();" + }, + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"msg_abc123\",\n \"object\": \"thread.message\",\n \"created_at\": 1699016383,\n \"assistant_id\": null,\n \"thread_id\": \"thread_abc123\",\n \"run_id\": null,\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": {\n \"value\": \"How does AI work? Explain it in simple terms.\",\n \"annotations\": []\n }\n }\n ],\n \"attachments\": [],\n \"metadata\": {}\n },\n {\n \"id\": \"msg_abc456\",\n \"object\": \"thread.message\",\n \"created_at\": 1699016383,\n \"assistant_id\": null,\n \"thread_id\": \"thread_abc123\",\n \"run_id\": null,\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": {\n \"value\": \"Hello, what is AI?\",\n \"annotations\": []\n }\n }\n ],\n \"attachments\": [],\n \"metadata\": {}\n }\n ],\n \"first_id\": \"msg_abc123\",\n \"last_id\": \"msg_abc456\",\n \"has_more\": false\n}\n" + } + } + }, + "post": { + "operationId": "createMessage", + "tags": ["Assistants"], + "summary": "Create a message.", + "parameters": [ + { + "in": "path", + "name": "thread_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the [thread](/docs/api-reference/threads) to create a message for." + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateMessageRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MessageObject" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Create message", + "group": "threads", + "beta": true, + "returns": "A [message](/docs/api-reference/messages/object) object.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/threads/thread_abc123/messages \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"role\": \"user\",\n \"content\": \"How does AI work? Explain it in simple terms.\"\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nthread_message = client.beta.threads.messages.create(\n \"thread_abc123\",\n role=\"user\",\n content=\"How does AI work? Explain it in simple terms.\",\n)\nprint(thread_message)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const threadMessages = await openai.beta.threads.messages.create(\n \"thread_abc123\",\n { role: \"user\", content: \"How does AI work? Explain it in simple terms.\" }\n );\n\n console.log(threadMessages);\n}\n\nmain();" + }, + "response": "{\n \"id\": \"msg_abc123\",\n \"object\": \"thread.message\",\n \"created_at\": 1713226573,\n \"assistant_id\": null,\n \"thread_id\": \"thread_abc123\",\n \"run_id\": null,\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": {\n \"value\": \"How does AI work? Explain it in simple terms.\",\n \"annotations\": []\n }\n }\n ],\n \"attachments\": [],\n \"metadata\": {}\n}\n" + } + } + } + }, + "/threads/{thread_id}/messages/{message_id}": { + "get": { + "operationId": "getMessage", + "tags": ["Assistants"], + "summary": "Retrieve a message.", + "parameters": [ + { + "in": "path", + "name": "thread_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the [thread](/docs/api-reference/threads) to which this message belongs." + }, + { + "in": "path", + "name": "message_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the message to retrieve." + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MessageObject" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Retrieve message", + "group": "threads", + "beta": true, + "returns": "The [message](/docs/api-reference/messages/object) object matching the specified ID.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nmessage = client.beta.threads.messages.retrieve(\n message_id=\"msg_abc123\",\n thread_id=\"thread_abc123\",\n)\nprint(message)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const message = await openai.beta.threads.messages.retrieve(\n \"thread_abc123\",\n \"msg_abc123\"\n );\n\n console.log(message);\n}\n\nmain();" + }, + "response": "{\n \"id\": \"msg_abc123\",\n \"object\": \"thread.message\",\n \"created_at\": 1699017614,\n \"assistant_id\": null,\n \"thread_id\": \"thread_abc123\",\n \"run_id\": null,\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": {\n \"value\": \"How does AI work? Explain it in simple terms.\",\n \"annotations\": []\n }\n }\n ],\n \"attachments\": [],\n \"metadata\": {}\n}\n" + } + } + }, + "post": { + "operationId": "modifyMessage", + "tags": ["Assistants"], + "summary": "Modifies a message.", + "parameters": [ + { + "in": "path", + "name": "thread_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the thread to which this message belongs." + }, + { + "in": "path", + "name": "message_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the message to modify." + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ModifyMessageRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MessageObject" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Modify message", + "group": "threads", + "beta": true, + "returns": "The modified [message](/docs/api-reference/messages/object) object.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"metadata\": {\n \"modified\": \"true\",\n \"user\": \"abc123\"\n }\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nmessage = client.beta.threads.messages.update(\n message_id=\"msg_abc12\",\n thread_id=\"thread_abc123\",\n metadata={\n \"modified\": \"true\",\n \"user\": \"abc123\",\n },\n)\nprint(message)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const message = await openai.beta.threads.messages.update(\n \"thread_abc123\",\n \"msg_abc123\",\n {\n metadata: {\n modified: \"true\",\n user: \"abc123\",\n },\n }\n }'" + }, + "response": "{\n \"id\": \"msg_abc123\",\n \"object\": \"thread.message\",\n \"created_at\": 1699017614,\n \"assistant_id\": null,\n \"thread_id\": \"thread_abc123\",\n \"run_id\": null,\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": {\n \"value\": \"How does AI work? Explain it in simple terms.\",\n \"annotations\": []\n }\n }\n ],\n \"file_ids\": [],\n \"metadata\": {\n \"modified\": \"true\",\n \"user\": \"abc123\"\n }\n}\n" + } + } + }, + "delete": { + "operationId": "deleteMessage", + "tags": ["Assistants"], + "summary": "Deletes a message.", + "parameters": [ + { + "in": "path", + "name": "thread_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the thread to which this message belongs." + }, + { + "in": "path", + "name": "message_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the message to delete." + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeleteMessageResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Delete message", + "group": "threads", + "beta": true, + "returns": "Deletion status", + "examples": { + "request": { + "curl": "curl -X DELETE https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\ndeleted_message = client.beta.threads.messages.delete(\n message_id=\"msg_abc12\",\n thread_id=\"thread_abc123\",\n)\nprint(deleted_message)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const deletedMessage = await openai.beta.threads.messages.del(\n \"thread_abc123\",\n \"msg_abc123\"\n );\n\n console.log(deletedMessage);\n}" + }, + "response": "{\n \"id\": \"msg_abc123\",\n \"object\": \"thread.message.deleted\",\n \"deleted\": true\n}\n" + } + } + } + }, + "/threads/runs": { + "post": { + "operationId": "createThreadAndRun", + "tags": ["Assistants"], + "summary": "Create a thread and run it in one request.", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateThreadAndRunRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RunObject" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Create thread and run", + "group": "threads", + "beta": true, + "returns": "A [run](/docs/api-reference/runs/object) object.", + "examples": [ + { + "title": "Default", + "request": { + "curl": "curl https://api.openai.com/v1/threads/runs \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"assistant_id\": \"asst_abc123\",\n \"thread\": {\n \"messages\": [\n {\"role\": \"user\", \"content\": \"Explain deep learning to a 5 year old.\"}\n ]\n }\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nrun = client.beta.threads.create_and_run(\n assistant_id=\"asst_abc123\",\n thread={\n \"messages\": [\n {\"role\": \"user\", \"content\": \"Explain deep learning to a 5 year old.\"}\n ]\n }\n)\n\nprint(run)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const run = await openai.beta.threads.createAndRun({\n assistant_id: \"asst_abc123\",\n thread: {\n messages: [\n { role: \"user\", content: \"Explain deep learning to a 5 year old.\" },\n ],\n },\n });\n\n console.log(run);\n}\n\nmain();\n" + }, + "response": "{\n \"id\": \"run_abc123\",\n \"object\": \"thread.run\",\n \"created_at\": 1699076792,\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"status\": \"queued\",\n \"started_at\": null,\n \"expires_at\": 1699077392,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": null,\n \"required_action\": null,\n \"last_error\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": \"You are a helpful assistant.\",\n \"tools\": [],\n \"tool_resources\": {},\n \"metadata\": {},\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"max_completion_tokens\": null,\n \"max_prompt_tokens\": null,\n \"truncation_strategy\": {\n \"type\": \"auto\",\n \"last_messages\": null\n },\n \"incomplete_details\": null,\n \"usage\": null,\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true\n}\n" + }, + { + "title": "Streaming", + "request": { + "curl": "curl https://api.openai.com/v1/threads/runs \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"assistant_id\": \"asst_123\",\n \"thread\": {\n \"messages\": [\n {\"role\": \"user\", \"content\": \"Hello\"}\n ]\n },\n \"stream\": true\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nstream = client.beta.threads.create_and_run(\n assistant_id=\"asst_123\",\n thread={\n \"messages\": [\n {\"role\": \"user\", \"content\": \"Hello\"}\n ]\n },\n stream=True\n)\n\nfor event in stream:\n print(event)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const stream = await openai.beta.threads.createAndRun({\n assistant_id: \"asst_123\",\n thread: {\n messages: [\n { role: \"user\", content: \"Hello\" },\n ],\n },\n stream: true\n });\n\n for await (const event of stream) {\n console.log(event);\n }\n}\n\nmain();\n" + }, + "response": "event: thread.created\ndata: {\"id\":\"thread_123\",\"object\":\"thread\",\"created_at\":1710348075,\"metadata\":{}}\n\nevent: thread.run.created\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710348075,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":null,\"expires_at\":1710348675,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[],\"tool_resources\":{},\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}\n\nevent: thread.run.queued\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710348075,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":null,\"expires_at\":1710348675,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[],\"tool_resources\":{},\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}\n\nevent: thread.run.in_progress\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710348075,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"in_progress\",\"started_at\":null,\"expires_at\":1710348675,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[],\"tool_resources\":{},\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}\n\nevent: thread.run.step.created\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710348076,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710348675,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":null}\n\nevent: thread.run.step.in_progress\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710348076,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710348675,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":null}\n\nevent: thread.message.created\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710348076,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"in_progress\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":null,\"role\":\"assistant\",\"content\":[], \"metadata\":{}}\n\nevent: thread.message.in_progress\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710348076,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"in_progress\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":null,\"role\":\"assistant\",\"content\":[], \"metadata\":{}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\"Hello\",\"annotations\":[]}}]}}\n\n...\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\" today\"}}]}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\"?\"}}]}}\n\nevent: thread.message.completed\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710348076,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"completed\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":1710348077,\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":{\"value\":\"Hello! How can I assist you today?\",\"annotations\":[]}}], \"metadata\":{}}\n\nevent: thread.run.step.completed\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710348076,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"completed\",\"cancelled_at\":null,\"completed_at\":1710348077,\"expires_at\":1710348675,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":{\"prompt_tokens\":20,\"completion_tokens\":11,\"total_tokens\":31}}\n\nevent: thread.run.completed\n{\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710348076,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"completed\",\"started_at\":1713226836,\"expires_at\":null,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":1713226837,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":{\"prompt_tokens\":345,\"completion_tokens\":11,\"total_tokens\":356},\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}\n\nevent: done\ndata: [DONE]\n" + }, + { + "title": "Streaming with Functions", + "request": { + "curl": "curl https://api.openai.com/v1/threads/runs \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"assistant_id\": \"asst_abc123\",\n \"thread\": {\n \"messages\": [\n {\"role\": \"user\", \"content\": \"What is the weather like in San Francisco?\"}\n ]\n },\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather in a given location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\"\n },\n \"unit\": {\n \"type\": \"string\",\n \"enum\": [\"celsius\", \"fahrenheit\"]\n }\n },\n \"required\": [\"location\"]\n }\n }\n }\n ],\n \"stream\": true\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\ntools = [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather in a given location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\",\n },\n \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"]},\n },\n \"required\": [\"location\"],\n },\n }\n }\n]\n\nstream = client.beta.threads.create_and_run(\n thread={\n \"messages\": [\n {\"role\": \"user\", \"content\": \"What is the weather like in San Francisco?\"}\n ]\n },\n assistant_id=\"asst_abc123\",\n tools=tools,\n stream=True\n)\n\nfor event in stream:\n print(event)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst tools = [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather in a given location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\",\n },\n \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"]},\n },\n \"required\": [\"location\"],\n },\n }\n }\n];\n\nasync function main() {\n const stream = await openai.beta.threads.createAndRun({\n assistant_id: \"asst_123\",\n thread: {\n messages: [\n { role: \"user\", content: \"What is the weather like in San Francisco?\" },\n ],\n },\n tools: tools,\n stream: true\n });\n\n for await (const event of stream) {\n console.log(event);\n }\n}\n\nmain();\n" + }, + "response": "event: thread.created\ndata: {\"id\":\"thread_123\",\"object\":\"thread\",\"created_at\":1710351818,\"metadata\":{}}\n\nevent: thread.run.created\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710351818,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":null,\"expires_at\":1710352418,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"description\":\"Get the current weather in a given location\",\"parameters\":{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\",\"description\":\"The city and state, e.g. San Francisco, CA\"},\"unit\":{\"type\":\"string\",\"enum\":[\"celsius\",\"fahrenheit\"]}},\"required\":[\"location\"]}}}],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.queued\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710351818,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":null,\"expires_at\":1710352418,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"description\":\"Get the current weather in a given location\",\"parameters\":{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\",\"description\":\"The city and state, e.g. San Francisco, CA\"},\"unit\":{\"type\":\"string\",\"enum\":[\"celsius\",\"fahrenheit\"]}},\"required\":[\"location\"]}}}],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.in_progress\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710351818,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"in_progress\",\"started_at\":1710351818,\"expires_at\":1710352418,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"description\":\"Get the current weather in a given location\",\"parameters\":{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\",\"description\":\"The city and state, e.g. San Francisco, CA\"},\"unit\":{\"type\":\"string\",\"enum\":[\"celsius\",\"fahrenheit\"]}},\"required\":[\"location\"]}}}],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.step.created\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710351819,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"tool_calls\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710352418,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"tool_calls\",\"tool_calls\":[]},\"usage\":null}\n\nevent: thread.run.step.in_progress\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710351819,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"tool_calls\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710352418,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"tool_calls\",\"tool_calls\":[]},\"usage\":null}\n\nevent: thread.run.step.delta\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step.delta\",\"delta\":{\"step_details\":{\"type\":\"tool_calls\",\"tool_calls\":[{\"index\":0,\"id\":\"call_XXNp8YGaFrjrSjgqxtC8JJ1B\",\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"arguments\":\"\",\"output\":null}}]}}}\n\nevent: thread.run.step.delta\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step.delta\",\"delta\":{\"step_details\":{\"type\":\"tool_calls\",\"tool_calls\":[{\"index\":0,\"type\":\"function\",\"function\":{\"arguments\":\"{\\\"\"}}]}}}\n\nevent: thread.run.step.delta\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step.delta\",\"delta\":{\"step_details\":{\"type\":\"tool_calls\",\"tool_calls\":[{\"index\":0,\"type\":\"function\",\"function\":{\"arguments\":\"location\"}}]}}}\n\n...\n\nevent: thread.run.step.delta\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step.delta\",\"delta\":{\"step_details\":{\"type\":\"tool_calls\",\"tool_calls\":[{\"index\":0,\"type\":\"function\",\"function\":{\"arguments\":\"ahrenheit\"}}]}}}\n\nevent: thread.run.step.delta\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step.delta\",\"delta\":{\"step_details\":{\"type\":\"tool_calls\",\"tool_calls\":[{\"index\":0,\"type\":\"function\",\"function\":{\"arguments\":\"\\\"}\"}}]}}}\n\nevent: thread.run.requires_action\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710351818,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"requires_action\",\"started_at\":1710351818,\"expires_at\":1710352418,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":{\"type\":\"submit_tool_outputs\",\"submit_tool_outputs\":{\"tool_calls\":[{\"id\":\"call_XXNp8YGaFrjrSjgqxtC8JJ1B\",\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"arguments\":\"{\\\"location\\\":\\\"San Francisco, CA\\\",\\\"unit\\\":\\\"fahrenheit\\\"}\"}}]}},\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"description\":\"Get the current weather in a given location\",\"parameters\":{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\",\"description\":\"The city and state, e.g. San Francisco, CA\"},\"unit\":{\"type\":\"string\",\"enum\":[\"celsius\",\"fahrenheit\"]}},\"required\":[\"location\"]}}}],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":{\"prompt_tokens\":345,\"completion_tokens\":11,\"total_tokens\":356},\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: done\ndata: [DONE]\n" + } + ] + } + } + }, + "/threads/{thread_id}/runs": { + "get": { + "operationId": "listRuns", + "tags": ["Assistants"], + "summary": "Returns a list of runs belonging to a thread.", + "parameters": [ + { + "name": "thread_id", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the thread the run belongs to." + }, + { + "name": "limit", + "in": "query", + "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n", + "required": false, + "schema": { + "type": "integer", + "default": 20 + } + }, + { + "name": "order", + "in": "query", + "description": "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n", + "schema": { + "type": "string", + "default": "desc", + "enum": ["asc", "desc"] + } + }, + { + "name": "after", + "in": "query", + "description": "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n", + "schema": { + "type": "string" + } + }, + { + "name": "before", + "in": "query", + "description": "A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.\n", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListRunsResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "List runs", + "group": "threads", + "beta": true, + "returns": "A list of [run](/docs/api-reference/runs/object) objects.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/threads/thread_abc123/runs \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nruns = client.beta.threads.runs.list(\n \"thread_abc123\"\n)\n\nprint(runs)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const runs = await openai.beta.threads.runs.list(\n \"thread_abc123\"\n );\n\n console.log(runs);\n}\n\nmain();\n" + }, + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"run_abc123\",\n \"object\": \"thread.run\",\n \"created_at\": 1699075072,\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"status\": \"completed\",\n \"started_at\": 1699075072,\n \"expires_at\": null,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": 1699075073,\n \"last_error\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": null,\n \"incomplete_details\": null,\n \"tools\": [\n {\n \"type\": \"code_interpreter\"\n }\n ],\n \"tool_resources\": {\n \"code_interpreter\": {\n \"file_ids\": [\n \"file-abc123\",\n \"file-abc456\"\n ]\n }\n },\n \"metadata\": {},\n \"usage\": {\n \"prompt_tokens\": 123,\n \"completion_tokens\": 456,\n \"total_tokens\": 579\n },\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"max_prompt_tokens\": 1000,\n \"max_completion_tokens\": 1000,\n \"truncation_strategy\": {\n \"type\": \"auto\",\n \"last_messages\": null\n },\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true\n },\n {\n \"id\": \"run_abc456\",\n \"object\": \"thread.run\",\n \"created_at\": 1699063290,\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"status\": \"completed\",\n \"started_at\": 1699063290,\n \"expires_at\": null,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": 1699063291,\n \"last_error\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": null,\n \"incomplete_details\": null,\n \"tools\": [\n {\n \"type\": \"code_interpreter\"\n }\n ],\n \"tool_resources\": {\n \"code_interpreter\": {\n \"file_ids\": [\n \"file-abc123\",\n \"file-abc456\"\n ]\n }\n },\n \"metadata\": {},\n \"usage\": {\n \"prompt_tokens\": 123,\n \"completion_tokens\": 456,\n \"total_tokens\": 579\n },\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"max_prompt_tokens\": 1000,\n \"max_completion_tokens\": 1000,\n \"truncation_strategy\": {\n \"type\": \"auto\",\n \"last_messages\": null\n },\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true\n }\n ],\n \"first_id\": \"run_abc123\",\n \"last_id\": \"run_abc456\",\n \"has_more\": false\n}\n" + } + } + }, + "post": { + "operationId": "createRun", + "tags": ["Assistants"], + "summary": "Create a run.", + "parameters": [ + { + "in": "path", + "name": "thread_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the thread to run." + }, + { + "name": "include[]", + "in": "query", + "description": "A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content.\n\nSee the [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) for more information.\n", + "schema": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "step_details.tool_calls[*].file_search.results[*].content" + ] + } + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateRunRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RunObject" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Create run", + "group": "threads", + "beta": true, + "returns": "A [run](/docs/api-reference/runs/object) object.", + "examples": [ + { + "title": "Default", + "request": { + "curl": "curl https://api.openai.com/v1/threads/thread_abc123/runs \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"assistant_id\": \"asst_abc123\"\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nrun = client.beta.threads.runs.create(\n thread_id=\"thread_abc123\",\n assistant_id=\"asst_abc123\"\n)\n\nprint(run)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const run = await openai.beta.threads.runs.create(\n \"thread_abc123\",\n { assistant_id: \"asst_abc123\" }\n );\n\n console.log(run);\n}\n\nmain();\n" + }, + "response": "{\n \"id\": \"run_abc123\",\n \"object\": \"thread.run\",\n \"created_at\": 1699063290,\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"status\": \"queued\",\n \"started_at\": 1699063290,\n \"expires_at\": null,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": 1699063291,\n \"last_error\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": null,\n \"incomplete_details\": null,\n \"tools\": [\n {\n \"type\": \"code_interpreter\"\n }\n ],\n \"metadata\": {},\n \"usage\": null,\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"max_prompt_tokens\": 1000,\n \"max_completion_tokens\": 1000,\n \"truncation_strategy\": {\n \"type\": \"auto\",\n \"last_messages\": null\n },\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true\n}\n" + }, + { + "title": "Streaming", + "request": { + "curl": "curl https://api.openai.com/v1/threads/thread_123/runs \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"assistant_id\": \"asst_123\",\n \"stream\": true\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nstream = client.beta.threads.runs.create(\n thread_id=\"thread_123\",\n assistant_id=\"asst_123\",\n stream=True\n)\n\nfor event in stream:\n print(event)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const stream = await openai.beta.threads.runs.create(\n \"thread_123\",\n { assistant_id: \"asst_123\", stream: true }\n );\n\n for await (const event of stream) {\n console.log(event);\n }\n}\n\nmain();\n" + }, + "response": "event: thread.run.created\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710330640,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":null,\"expires_at\":1710331240,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.queued\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710330640,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":null,\"expires_at\":1710331240,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.in_progress\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710330640,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"in_progress\",\"started_at\":1710330641,\"expires_at\":1710331240,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.step.created\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710330641,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710331240,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":null}\n\nevent: thread.run.step.in_progress\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710330641,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710331240,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":null}\n\nevent: thread.message.created\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710330641,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"in_progress\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":null,\"role\":\"assistant\",\"content\":[],\"metadata\":{}}\n\nevent: thread.message.in_progress\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710330641,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"in_progress\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":null,\"role\":\"assistant\",\"content\":[],\"metadata\":{}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\"Hello\",\"annotations\":[]}}]}}\n\n...\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\" today\"}}]}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\"?\"}}]}}\n\nevent: thread.message.completed\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710330641,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"completed\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":1710330642,\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":{\"value\":\"Hello! How can I assist you today?\",\"annotations\":[]}}],\"metadata\":{}}\n\nevent: thread.run.step.completed\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710330641,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"completed\",\"cancelled_at\":null,\"completed_at\":1710330642,\"expires_at\":1710331240,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":{\"prompt_tokens\":20,\"completion_tokens\":11,\"total_tokens\":31}}\n\nevent: thread.run.completed\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710330640,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"completed\",\"started_at\":1710330641,\"expires_at\":null,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":1710330642,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":{\"prompt_tokens\":20,\"completion_tokens\":11,\"total_tokens\":31},\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: done\ndata: [DONE]\n" + }, + { + "title": "Streaming with Functions", + "request": { + "curl": "curl https://api.openai.com/v1/threads/thread_abc123/runs \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"assistant_id\": \"asst_abc123\",\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather in a given location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\"\n },\n \"unit\": {\n \"type\": \"string\",\n \"enum\": [\"celsius\", \"fahrenheit\"]\n }\n },\n \"required\": [\"location\"]\n }\n }\n }\n ],\n \"stream\": true\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\ntools = [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather in a given location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\",\n },\n \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"]},\n },\n \"required\": [\"location\"],\n },\n }\n }\n]\n\nstream = client.beta.threads.runs.create(\n thread_id=\"thread_abc123\",\n assistant_id=\"asst_abc123\",\n tools=tools,\n stream=True\n)\n\nfor event in stream:\n print(event)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst tools = [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather in a given location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\",\n },\n \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"]},\n },\n \"required\": [\"location\"],\n },\n }\n }\n];\n\nasync function main() {\n const stream = await openai.beta.threads.runs.create(\n \"thread_abc123\",\n {\n assistant_id: \"asst_abc123\",\n tools: tools,\n stream: true\n }\n );\n\n for await (const event of stream) {\n console.log(event);\n }\n}\n\nmain();\n" + }, + "response": "event: thread.run.created\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710348075,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":null,\"expires_at\":1710348675,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.queued\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710348075,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":null,\"expires_at\":1710348675,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.in_progress\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710348075,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"in_progress\",\"started_at\":1710348075,\"expires_at\":1710348675,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.step.created\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710348076,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710348675,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":null}\n\nevent: thread.run.step.in_progress\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710348076,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710348675,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":null}\n\nevent: thread.message.created\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710348076,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"in_progress\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":null,\"role\":\"assistant\",\"content\":[],\"metadata\":{}}\n\nevent: thread.message.in_progress\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710348076,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"in_progress\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":null,\"role\":\"assistant\",\"content\":[],\"metadata\":{}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\"Hello\",\"annotations\":[]}}]}}\n\n...\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\" today\"}}]}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\"?\"}}]}}\n\nevent: thread.message.completed\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710348076,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"completed\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":1710348077,\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":{\"value\":\"Hello! How can I assist you today?\",\"annotations\":[]}}],\"metadata\":{}}\n\nevent: thread.run.step.completed\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710348076,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"completed\",\"cancelled_at\":null,\"completed_at\":1710348077,\"expires_at\":1710348675,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":{\"prompt_tokens\":20,\"completion_tokens\":11,\"total_tokens\":31}}\n\nevent: thread.run.completed\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710348075,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"completed\",\"started_at\":1710348075,\"expires_at\":null,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":1710348077,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":{\"prompt_tokens\":20,\"completion_tokens\":11,\"total_tokens\":31},\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: done\ndata: [DONE]\n" + } + ] + } + } + }, + "/threads/{thread_id}/runs/{run_id}": { + "get": { + "operationId": "getRun", + "tags": ["Assistants"], + "summary": "Retrieves a run.", + "parameters": [ + { + "in": "path", + "name": "thread_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the [thread](/docs/api-reference/threads) that was run." + }, + { + "in": "path", + "name": "run_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the run to retrieve." + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RunObject" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Retrieve run", + "group": "threads", + "beta": true, + "returns": "The [run](/docs/api-reference/runs/object) object matching the specified ID.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nrun = client.beta.threads.runs.retrieve(\n thread_id=\"thread_abc123\",\n run_id=\"run_abc123\"\n)\n\nprint(run)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const run = await openai.beta.threads.runs.retrieve(\n \"thread_abc123\",\n \"run_abc123\"\n );\n\n console.log(run);\n}\n\nmain();\n" + }, + "response": "{\n \"id\": \"run_abc123\",\n \"object\": \"thread.run\",\n \"created_at\": 1699075072,\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"status\": \"completed\",\n \"started_at\": 1699075072,\n \"expires_at\": null,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": 1699075073,\n \"last_error\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": null,\n \"incomplete_details\": null,\n \"tools\": [\n {\n \"type\": \"code_interpreter\"\n }\n ],\n \"metadata\": {},\n \"usage\": {\n \"prompt_tokens\": 123,\n \"completion_tokens\": 456,\n \"total_tokens\": 579\n },\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"max_prompt_tokens\": 1000,\n \"max_completion_tokens\": 1000,\n \"truncation_strategy\": {\n \"type\": \"auto\",\n \"last_messages\": null\n },\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true\n}\n" + } + } + }, + "post": { + "operationId": "modifyRun", + "tags": ["Assistants"], + "summary": "Modifies a run.", + "parameters": [ + { + "in": "path", + "name": "thread_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the [thread](/docs/api-reference/threads) that was run." + }, + { + "in": "path", + "name": "run_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the run to modify." + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ModifyRunRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RunObject" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Modify run", + "group": "threads", + "beta": true, + "returns": "The modified [run](/docs/api-reference/runs/object) object matching the specified ID.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"metadata\": {\n \"user_id\": \"user_abc123\"\n }\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nrun = client.beta.threads.runs.update(\n thread_id=\"thread_abc123\",\n run_id=\"run_abc123\",\n metadata={\"user_id\": \"user_abc123\"},\n)\n\nprint(run)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const run = await openai.beta.threads.runs.update(\n \"thread_abc123\",\n \"run_abc123\",\n {\n metadata: {\n user_id: \"user_abc123\",\n },\n }\n );\n\n console.log(run);\n}\n\nmain();\n" + }, + "response": "{\n \"id\": \"run_abc123\",\n \"object\": \"thread.run\",\n \"created_at\": 1699075072,\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"status\": \"completed\",\n \"started_at\": 1699075072,\n \"expires_at\": null,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": 1699075073,\n \"last_error\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": null,\n \"incomplete_details\": null,\n \"tools\": [\n {\n \"type\": \"code_interpreter\"\n }\n ],\n \"tool_resources\": {\n \"code_interpreter\": {\n \"file_ids\": [\n \"file-abc123\",\n \"file-abc456\"\n ]\n }\n },\n \"metadata\": {\n \"user_id\": \"user_abc123\"\n },\n \"usage\": {\n \"prompt_tokens\": 123,\n \"completion_tokens\": 456,\n \"total_tokens\": 579\n },\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"max_prompt_tokens\": 1000,\n \"max_completion_tokens\": 1000,\n \"truncation_strategy\": {\n \"type\": \"auto\",\n \"last_messages\": null\n },\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true\n}\n" + } + } + } + }, + "/threads/{thread_id}/runs/{run_id}/submit_tool_outputs": { + "post": { + "operationId": "submitToolOuputsToRun", + "tags": ["Assistants"], + "summary": "When a run has the `status: \"requires_action\"` and `required_action.type` is `submit_tool_outputs`, this endpoint can be used to submit the outputs from the tool calls once they're all completed. All outputs must be submitted in a single request.\n", + "parameters": [ + { + "in": "path", + "name": "thread_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the [thread](/docs/api-reference/threads) to which this run belongs." + }, + { + "in": "path", + "name": "run_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the run that requires the tool output submission." + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SubmitToolOutputsRunRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RunObject" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Submit tool outputs to run", + "group": "threads", + "beta": true, + "returns": "The modified [run](/docs/api-reference/runs/object) object matching the specified ID.", + "examples": [ + { + "title": "Default", + "request": { + "curl": "curl https://api.openai.com/v1/threads/thread_123/runs/run_123/submit_tool_outputs \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"tool_outputs\": [\n {\n \"tool_call_id\": \"call_001\",\n \"output\": \"70 degrees and sunny.\"\n }\n ]\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nrun = client.beta.threads.runs.submit_tool_outputs(\n thread_id=\"thread_123\",\n run_id=\"run_123\",\n tool_outputs=[\n {\n \"tool_call_id\": \"call_001\",\n \"output\": \"70 degrees and sunny.\"\n }\n ]\n)\n\nprint(run)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const run = await openai.beta.threads.runs.submitToolOutputs(\n \"thread_123\",\n \"run_123\",\n {\n tool_outputs: [\n {\n tool_call_id: \"call_001\",\n output: \"70 degrees and sunny.\",\n },\n ],\n }\n );\n\n console.log(run);\n}\n\nmain();\n" + }, + "response": "{\n \"id\": \"run_123\",\n \"object\": \"thread.run\",\n \"created_at\": 1699075592,\n \"assistant_id\": \"asst_123\",\n \"thread_id\": \"thread_123\",\n \"status\": \"queued\",\n \"started_at\": 1699075592,\n \"expires_at\": 1699076192,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": null,\n \"last_error\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": null,\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather in a given location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\"\n },\n \"unit\": {\n \"type\": \"string\",\n \"enum\": [\"celsius\", \"fahrenheit\"]\n }\n },\n \"required\": [\"location\"]\n }\n }\n }\n ],\n \"metadata\": {},\n \"usage\": null,\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"max_prompt_tokens\": 1000,\n \"max_completion_tokens\": 1000,\n \"truncation_strategy\": {\n \"type\": \"auto\",\n \"last_messages\": null\n },\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true\n}\n" + }, + { + "title": "Streaming", + "request": { + "curl": "curl https://api.openai.com/v1/threads/thread_123/runs/run_123/submit_tool_outputs \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"tool_outputs\": [\n {\n \"tool_call_id\": \"call_001\",\n \"output\": \"70 degrees and sunny.\"\n }\n ],\n \"stream\": true\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nstream = client.beta.threads.runs.submit_tool_outputs(\n thread_id=\"thread_123\",\n run_id=\"run_123\",\n tool_outputs=[\n {\n \"tool_call_id\": \"call_001\",\n \"output\": \"70 degrees and sunny.\"\n }\n ],\n stream=True\n)\n\nfor event in stream:\n print(event)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const stream = await openai.beta.threads.runs.submitToolOutputs(\n \"thread_123\",\n \"run_123\",\n {\n tool_outputs: [\n {\n tool_call_id: \"call_001\",\n output: \"70 degrees and sunny.\",\n },\n ],\n }\n );\n\n for await (const event of stream) {\n console.log(event);\n }\n}\n\nmain();\n" + }, + "response": "event: thread.run.step.completed\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710352449,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"tool_calls\",\"status\":\"completed\",\"cancelled_at\":null,\"completed_at\":1710352475,\"expires_at\":1710353047,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"tool_calls\",\"tool_calls\":[{\"id\":\"call_iWr0kQ2EaYMaxNdl0v3KYkx7\",\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"arguments\":\"{\\\"location\\\":\\\"San Francisco, CA\\\",\\\"unit\\\":\\\"fahrenheit\\\"}\",\"output\":\"70 degrees and sunny.\"}}]},\"usage\":{\"prompt_tokens\":291,\"completion_tokens\":24,\"total_tokens\":315}}\n\nevent: thread.run.queued\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710352447,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":1710352448,\"expires_at\":1710353047,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"description\":\"Get the current weather in a given location\",\"parameters\":{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\",\"description\":\"The city and state, e.g. San Francisco, CA\"},\"unit\":{\"type\":\"string\",\"enum\":[\"celsius\",\"fahrenheit\"]}},\"required\":[\"location\"]}}}],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.in_progress\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710352447,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"in_progress\",\"started_at\":1710352475,\"expires_at\":1710353047,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"description\":\"Get the current weather in a given location\",\"parameters\":{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\",\"description\":\"The city and state, e.g. San Francisco, CA\"},\"unit\":{\"type\":\"string\",\"enum\":[\"celsius\",\"fahrenheit\"]}},\"required\":[\"location\"]}}}],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.step.created\ndata: {\"id\":\"step_002\",\"object\":\"thread.run.step\",\"created_at\":1710352476,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710353047,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_002\"}},\"usage\":null}\n\nevent: thread.run.step.in_progress\ndata: {\"id\":\"step_002\",\"object\":\"thread.run.step\",\"created_at\":1710352476,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710353047,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_002\"}},\"usage\":null}\n\nevent: thread.message.created\ndata: {\"id\":\"msg_002\",\"object\":\"thread.message\",\"created_at\":1710352476,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"in_progress\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":null,\"role\":\"assistant\",\"content\":[],\"metadata\":{}}\n\nevent: thread.message.in_progress\ndata: {\"id\":\"msg_002\",\"object\":\"thread.message\",\"created_at\":1710352476,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"in_progress\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":null,\"role\":\"assistant\",\"content\":[],\"metadata\":{}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_002\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\"The\",\"annotations\":[]}}]}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_002\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\" current\"}}]}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_002\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\" weather\"}}]}}\n\n...\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_002\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\" sunny\"}}]}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_002\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\".\"}}]}}\n\nevent: thread.message.completed\ndata: {\"id\":\"msg_002\",\"object\":\"thread.message\",\"created_at\":1710352476,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"completed\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":1710352477,\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":{\"value\":\"The current weather in San Francisco, CA is 70 degrees Fahrenheit and sunny.\",\"annotations\":[]}}],\"metadata\":{}}\n\nevent: thread.run.step.completed\ndata: {\"id\":\"step_002\",\"object\":\"thread.run.step\",\"created_at\":1710352476,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"completed\",\"cancelled_at\":null,\"completed_at\":1710352477,\"expires_at\":1710353047,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_002\"}},\"usage\":{\"prompt_tokens\":329,\"completion_tokens\":18,\"total_tokens\":347}}\n\nevent: thread.run.completed\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710352447,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"completed\",\"started_at\":1710352475,\"expires_at\":null,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":1710352477,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4o\",\"instructions\":null,\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"description\":\"Get the current weather in a given location\",\"parameters\":{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\",\"description\":\"The city and state, e.g. San Francisco, CA\"},\"unit\":{\"type\":\"string\",\"enum\":[\"celsius\",\"fahrenheit\"]}},\"required\":[\"location\"]}}}],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":{\"prompt_tokens\":20,\"completion_tokens\":11,\"total_tokens\":31},\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: done\ndata: [DONE]\n" + } + ] + } + } + }, + "/threads/{thread_id}/runs/{run_id}/cancel": { + "post": { + "operationId": "cancelRun", + "tags": ["Assistants"], + "summary": "Cancels a run that is `in_progress`.", + "parameters": [ + { + "in": "path", + "name": "thread_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the thread to which this run belongs." + }, + { + "in": "path", + "name": "run_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the run to cancel." + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RunObject" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Cancel a run", + "group": "threads", + "beta": true, + "returns": "The modified [run](/docs/api-reference/runs/object) object matching the specified ID.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/cancel \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -X POST\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nrun = client.beta.threads.runs.cancel(\n thread_id=\"thread_abc123\",\n run_id=\"run_abc123\"\n)\n\nprint(run)\n", + "node.js": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const run = await openai.beta.threads.runs.cancel(\n \"thread_abc123\",\n \"run_abc123\"\n );\n\n console.log(run);\n}\n\nmain();\n" + }, + "response": "{\n \"id\": \"run_abc123\",\n \"object\": \"thread.run\",\n \"created_at\": 1699076126,\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"status\": \"cancelling\",\n \"started_at\": 1699076126,\n \"expires_at\": 1699076726,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": null,\n \"last_error\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": \"You summarize books.\",\n \"tools\": [\n {\n \"type\": \"file_search\"\n }\n ],\n \"tool_resources\": {\n \"file_search\": {\n \"vector_store_ids\": [\"vs_123\"]\n }\n },\n \"metadata\": {},\n \"usage\": null,\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true\n}\n" + } + } + } + }, + "/threads/{thread_id}/runs/{run_id}/steps": { + "get": { + "operationId": "listRunSteps", + "tags": ["Assistants"], + "summary": "Returns a list of run steps belonging to a run.", + "parameters": [ + { + "name": "thread_id", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the thread the run and run steps belong to." + }, + { + "name": "run_id", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the run the run steps belong to." + }, + { + "name": "limit", + "in": "query", + "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n", + "required": false, + "schema": { + "type": "integer", + "default": 20 + } + }, + { + "name": "order", + "in": "query", + "description": "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n", + "schema": { + "type": "string", + "default": "desc", + "enum": ["asc", "desc"] + } + }, + { + "name": "after", + "in": "query", + "description": "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n", + "schema": { + "type": "string" + } + }, + { + "name": "before", + "in": "query", + "description": "A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.\n", + "schema": { + "type": "string" + } + }, + { + "name": "include[]", + "in": "query", + "description": "A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content.\n\nSee the [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) for more information.\n", + "schema": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "step_details.tool_calls[*].file_search.results[*].content" + ] + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListRunStepsResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "List run steps", + "group": "threads", + "beta": true, + "returns": "A list of [run step](/docs/api-reference/run-steps/step-object) objects.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/steps \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nrun_steps = client.beta.threads.runs.steps.list(\n thread_id=\"thread_abc123\",\n run_id=\"run_abc123\"\n)\n\nprint(run_steps)\n", + "node.js": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const runStep = await openai.beta.threads.runs.steps.list(\n \"thread_abc123\",\n \"run_abc123\"\n );\n console.log(runStep);\n}\n\nmain();\n" + }, + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"step_abc123\",\n \"object\": \"thread.run.step\",\n \"created_at\": 1699063291,\n \"run_id\": \"run_abc123\",\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"type\": \"message_creation\",\n \"status\": \"completed\",\n \"cancelled_at\": null,\n \"completed_at\": 1699063291,\n \"expired_at\": null,\n \"failed_at\": null,\n \"last_error\": null,\n \"step_details\": {\n \"type\": \"message_creation\",\n \"message_creation\": {\n \"message_id\": \"msg_abc123\"\n }\n },\n \"usage\": {\n \"prompt_tokens\": 123,\n \"completion_tokens\": 456,\n \"total_tokens\": 579\n }\n }\n ],\n \"first_id\": \"step_abc123\",\n \"last_id\": \"step_abc456\",\n \"has_more\": false\n}\n" + } + } + } + }, + "/threads/{thread_id}/runs/{run_id}/steps/{step_id}": { + "get": { + "operationId": "getRunStep", + "tags": ["Assistants"], + "summary": "Retrieves a run step.", + "parameters": [ + { + "in": "path", + "name": "thread_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the thread to which the run and run step belongs." + }, + { + "in": "path", + "name": "run_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the run to which the run step belongs." + }, + { + "in": "path", + "name": "step_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the run step to retrieve." + }, + { + "name": "include[]", + "in": "query", + "description": "A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content.\n\nSee the [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) for more information.\n", + "schema": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "step_details.tool_calls[*].file_search.results[*].content" + ] + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RunStepObject" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Retrieve run step", + "group": "threads", + "beta": true, + "returns": "The [run step](/docs/api-reference/run-steps/step-object) object matching the specified ID.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/steps/step_abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nrun_step = client.beta.threads.runs.steps.retrieve(\n thread_id=\"thread_abc123\",\n run_id=\"run_abc123\",\n step_id=\"step_abc123\"\n)\n\nprint(run_step)\n", + "node.js": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const runStep = await openai.beta.threads.runs.steps.retrieve(\n \"thread_abc123\",\n \"run_abc123\",\n \"step_abc123\"\n );\n console.log(runStep);\n}\n\nmain();\n" + }, + "response": "{\n \"id\": \"step_abc123\",\n \"object\": \"thread.run.step\",\n \"created_at\": 1699063291,\n \"run_id\": \"run_abc123\",\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"type\": \"message_creation\",\n \"status\": \"completed\",\n \"cancelled_at\": null,\n \"completed_at\": 1699063291,\n \"expired_at\": null,\n \"failed_at\": null,\n \"last_error\": null,\n \"step_details\": {\n \"type\": \"message_creation\",\n \"message_creation\": {\n \"message_id\": \"msg_abc123\"\n }\n },\n \"usage\": {\n \"prompt_tokens\": 123,\n \"completion_tokens\": 456,\n \"total_tokens\": 579\n }\n}\n" + } + } + } + }, + "/vector_stores": { + "get": { + "operationId": "listVectorStores", + "tags": ["Vector Stores"], + "summary": "Returns a list of vector stores.", + "parameters": [ + { + "name": "limit", + "in": "query", + "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n", + "required": false, + "schema": { + "type": "integer", + "default": 20 + } + }, + { + "name": "order", + "in": "query", + "description": "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n", + "schema": { + "type": "string", + "default": "desc", + "enum": ["asc", "desc"] + } + }, + { + "name": "after", + "in": "query", + "description": "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n", + "schema": { + "type": "string" + } + }, + { + "name": "before", + "in": "query", + "description": "A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.\n", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListVectorStoresResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "List vector stores", + "group": "vector_stores", + "beta": true, + "returns": "A list of [vector store](/docs/api-reference/vector-stores/object) objects.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/vector_stores \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nvector_stores = client.beta.vector_stores.list()\nprint(vector_stores)\n", + "node.js": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStores = await openai.beta.vectorStores.list();\n console.log(vectorStores);\n}\n\nmain();\n" + }, + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"vs_abc123\",\n \"object\": \"vector_store\",\n \"created_at\": 1699061776,\n \"name\": \"Support FAQ\",\n \"bytes\": 139920,\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 3,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 3\n }\n },\n {\n \"id\": \"vs_abc456\",\n \"object\": \"vector_store\",\n \"created_at\": 1699061776,\n \"name\": \"Support FAQ v2\",\n \"bytes\": 139920,\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 3,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 3\n }\n }\n ],\n \"first_id\": \"vs_abc123\",\n \"last_id\": \"vs_abc456\",\n \"has_more\": false\n}\n" + } + } + }, + "post": { + "operationId": "createVectorStore", + "tags": ["Vector Stores"], + "summary": "Create a vector store.", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateVectorStoreRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VectorStoreObject" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Create vector store", + "group": "vector_stores", + "beta": true, + "returns": "A [vector store](/docs/api-reference/vector-stores/object) object.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/vector_stores \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n -d '{\n \"name\": \"Support FAQ\"\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nvector_store = client.beta.vector_stores.create(\n name=\"Support FAQ\"\n)\nprint(vector_store)\n", + "node.js": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStore = await openai.beta.vectorStores.create({\n name: \"Support FAQ\"\n });\n console.log(vectorStore);\n}\n\nmain();\n" + }, + "response": "{\n \"id\": \"vs_abc123\",\n \"object\": \"vector_store\",\n \"created_at\": 1699061776,\n \"name\": \"Support FAQ\",\n \"bytes\": 139920,\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 3,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 3\n }\n}\n" + } + } + } + }, + "/vector_stores/{vector_store_id}": { + "get": { + "operationId": "getVectorStore", + "tags": ["Vector Stores"], + "summary": "Retrieves a vector store.", + "parameters": [ + { + "in": "path", + "name": "vector_store_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the vector store to retrieve." + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VectorStoreObject" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Retrieve vector store", + "group": "vector_stores", + "beta": true, + "returns": "The [vector store](/docs/api-reference/vector-stores/object) object matching the specified ID.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/vector_stores/vs_abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nvector_store = client.beta.vector_stores.retrieve(\n vector_store_id=\"vs_abc123\"\n)\nprint(vector_store)\n", + "node.js": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStore = await openai.beta.vectorStores.retrieve(\n \"vs_abc123\"\n );\n console.log(vectorStore);\n}\n\nmain();\n" + }, + "response": "{\n \"id\": \"vs_abc123\",\n \"object\": \"vector_store\",\n \"created_at\": 1699061776\n}\n" + } + } + }, + "post": { + "operationId": "modifyVectorStore", + "tags": ["Vector Stores"], + "summary": "Modifies a vector store.", + "parameters": [ + { + "in": "path", + "name": "vector_store_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the vector store to modify." + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateVectorStoreRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VectorStoreObject" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Modify vector store", + "group": "vector_stores", + "beta": true, + "returns": "The modified [vector store](/docs/api-reference/vector-stores/object) object.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/vector_stores/vs_abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n -d '{\n \"name\": \"Support FAQ\"\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nvector_store = client.beta.vector_stores.update(\n vector_store_id=\"vs_abc123\",\n name=\"Support FAQ\"\n)\nprint(vector_store)\n", + "node.js": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStore = await openai.beta.vectorStores.update(\n \"vs_abc123\",\n {\n name: \"Support FAQ\"\n }\n );\n console.log(vectorStore);\n}\n\nmain();\n" + }, + "response": "{\n \"id\": \"vs_abc123\",\n \"object\": \"vector_store\",\n \"created_at\": 1699061776,\n \"name\": \"Support FAQ\",\n \"bytes\": 139920,\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 3,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 3\n }\n}\n" + } + } + }, + "delete": { + "operationId": "deleteVectorStore", + "tags": ["Vector Stores"], + "summary": "Delete a vector store.", + "parameters": [ + { + "in": "path", + "name": "vector_store_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the vector store to delete." + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeleteVectorStoreResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Delete vector store", + "group": "vector_stores", + "beta": true, + "returns": "Deletion status", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/vector_stores/vs_abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -X DELETE\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\ndeleted_vector_store = client.beta.vector_stores.delete(\n vector_store_id=\"vs_abc123\"\n)\nprint(deleted_vector_store)\n", + "node.js": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const deletedVectorStore = await openai.beta.vectorStores.del(\n \"vs_abc123\"\n );\n console.log(deletedVectorStore);\n}\n\nmain();\n" + }, + "response": "{\n id: \"vs_abc123\",\n object: \"vector_store.deleted\",\n deleted: true\n}\n" + } + } + } + }, + "/vector_stores/{vector_store_id}/files": { + "get": { + "operationId": "listVectorStoreFiles", + "tags": ["Vector Stores"], + "summary": "Returns a list of vector store files.", + "parameters": [ + { + "name": "vector_store_id", + "in": "path", + "description": "The ID of the vector store that the files belong to.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "limit", + "in": "query", + "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n", + "required": false, + "schema": { + "type": "integer", + "default": 20 + } + }, + { + "name": "order", + "in": "query", + "description": "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n", + "schema": { + "type": "string", + "default": "desc", + "enum": ["asc", "desc"] + } + }, + { + "name": "after", + "in": "query", + "description": "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n", + "schema": { + "type": "string" + } + }, + { + "name": "before", + "in": "query", + "description": "A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.\n", + "schema": { + "type": "string" + } + }, + { + "name": "filter", + "in": "query", + "description": "Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`.", + "schema": { + "type": "string", + "enum": ["in_progress", "completed", "failed", "cancelled"] + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListVectorStoreFilesResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "List vector store files", + "group": "vector_stores", + "beta": true, + "returns": "A list of [vector store file](/docs/api-reference/vector-stores-files/file-object) objects.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/vector_stores/vs_abc123/files \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nvector_store_files = client.beta.vector_stores.files.list(\n vector_store_id=\"vs_abc123\"\n)\nprint(vector_store_files)\n", + "node.js": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStoreFiles = await openai.beta.vectorStores.files.list(\n \"vs_abc123\"\n );\n console.log(vectorStoreFiles);\n}\n\nmain();\n" + }, + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"file-abc123\",\n \"object\": \"vector_store.file\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\"\n },\n {\n \"id\": \"file-abc456\",\n \"object\": \"vector_store.file\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\"\n }\n ],\n \"first_id\": \"file-abc123\",\n \"last_id\": \"file-abc456\",\n \"has_more\": false\n}\n" + } + } + }, + "post": { + "operationId": "createVectorStoreFile", + "tags": ["Vector Stores"], + "summary": "Create a vector store file by attaching a [File](/docs/api-reference/files) to a [vector store](/docs/api-reference/vector-stores/object).", + "parameters": [ + { + "in": "path", + "name": "vector_store_id", + "required": true, + "schema": { + "type": "string", + "example": "vs_abc123" + }, + "description": "The ID of the vector store for which to create a File.\n" + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateVectorStoreFileRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VectorStoreFileObject" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Create vector store file", + "group": "vector_stores", + "beta": true, + "returns": "A [vector store file](/docs/api-reference/vector-stores-files/file-object) object.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/vector_stores/vs_abc123/files \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"file_id\": \"file-abc123\"\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nvector_store_file = client.beta.vector_stores.files.create(\n vector_store_id=\"vs_abc123\",\n file_id=\"file-abc123\"\n)\nprint(vector_store_file)\n", + "node.js": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const myVectorStoreFile = await openai.beta.vectorStores.files.create(\n \"vs_abc123\",\n {\n file_id: \"file-abc123\"\n }\n );\n console.log(myVectorStoreFile);\n}\n\nmain();\n" + }, + "response": "{\n \"id\": \"file-abc123\",\n \"object\": \"vector_store.file\",\n \"created_at\": 1699061776,\n \"usage_bytes\": 1234,\n \"vector_store_id\": \"vs_abcd\",\n \"status\": \"completed\",\n \"last_error\": null\n}\n" + } + } + } + }, + "/vector_stores/{vector_store_id}/files/{file_id}": { + "get": { + "operationId": "getVectorStoreFile", + "tags": ["Vector Stores"], + "summary": "Retrieves a vector store file.", + "parameters": [ + { + "in": "path", + "name": "vector_store_id", + "required": true, + "schema": { + "type": "string", + "example": "vs_abc123" + }, + "description": "The ID of the vector store that the file belongs to." + }, + { + "in": "path", + "name": "file_id", + "required": true, + "schema": { + "type": "string", + "example": "file-abc123" + }, + "description": "The ID of the file being retrieved." + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VectorStoreFileObject" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Retrieve vector store file", + "group": "vector_stores", + "beta": true, + "returns": "The [vector store file](/docs/api-reference/vector-stores-files/file-object) object.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/vector_stores/vs_abc123/files/file-abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nvector_store_file = client.beta.vector_stores.files.retrieve(\n vector_store_id=\"vs_abc123\",\n file_id=\"file-abc123\"\n)\nprint(vector_store_file)\n", + "node.js": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStoreFile = await openai.beta.vectorStores.files.retrieve(\n \"vs_abc123\",\n \"file-abc123\"\n );\n console.log(vectorStoreFile);\n}\n\nmain();\n" + }, + "response": "{\n \"id\": \"file-abc123\",\n \"object\": \"vector_store.file\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abcd\",\n \"status\": \"completed\",\n \"last_error\": null\n}\n" + } + } + }, + "delete": { + "operationId": "deleteVectorStoreFile", + "tags": ["Vector Stores"], + "summary": "Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. To delete the file, use the [delete file](/docs/api-reference/files/delete) endpoint.", + "parameters": [ + { + "in": "path", + "name": "vector_store_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the vector store that the file belongs to." + }, + { + "in": "path", + "name": "file_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the file to delete." + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeleteVectorStoreFileResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Delete vector store file", + "group": "vector_stores", + "beta": true, + "returns": "Deletion status", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/vector_stores/vs_abc123/files/file-abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -X DELETE\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\ndeleted_vector_store_file = client.beta.vector_stores.files.delete(\n vector_store_id=\"vs_abc123\",\n file_id=\"file-abc123\"\n)\nprint(deleted_vector_store_file)\n", + "node.js": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const deletedVectorStoreFile = await openai.beta.vectorStores.files.del(\n \"vs_abc123\",\n \"file-abc123\"\n );\n console.log(deletedVectorStoreFile);\n}\n\nmain();\n" + }, + "response": "{\n id: \"file-abc123\",\n object: \"vector_store.file.deleted\",\n deleted: true\n}\n" + } + } + } + }, + "/vector_stores/{vector_store_id}/file_batches": { + "post": { + "operationId": "createVectorStoreFileBatch", + "tags": ["Vector Stores"], + "summary": "Create a vector store file batch.", + "parameters": [ + { + "in": "path", + "name": "vector_store_id", + "required": true, + "schema": { + "type": "string", + "example": "vs_abc123" + }, + "description": "The ID of the vector store for which to create a File Batch.\n" + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateVectorStoreFileBatchRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VectorStoreFileBatchObject" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Create vector store file batch", + "group": "vector_stores", + "beta": true, + "returns": "A [vector store file batch](/docs/api-reference/vector-stores-file-batches/batch-object) object.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/vector_stores/vs_abc123/file_batches \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"file_ids\": [\"file-abc123\", \"file-abc456\"]\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nvector_store_file_batch = client.beta.vector_stores.file_batches.create(\n vector_store_id=\"vs_abc123\",\n file_ids=[\"file-abc123\", \"file-abc456\"]\n)\nprint(vector_store_file_batch)\n", + "node.js": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const myVectorStoreFileBatch = await openai.beta.vectorStores.fileBatches.create(\n \"vs_abc123\",\n {\n file_ids: [\"file-abc123\", \"file-abc456\"]\n }\n );\n console.log(myVectorStoreFileBatch);\n}\n\nmain();\n" + }, + "response": "{\n \"id\": \"vsfb_abc123\",\n \"object\": \"vector_store.file_batch\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\",\n \"status\": \"in_progress\",\n \"file_counts\": {\n \"in_progress\": 1,\n \"completed\": 1,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 0,\n }\n}\n" + } + } + } + }, + "/vector_stores/{vector_store_id}/file_batches/{batch_id}": { + "get": { + "operationId": "getVectorStoreFileBatch", + "tags": ["Vector Stores"], + "summary": "Retrieves a vector store file batch.", + "parameters": [ + { + "in": "path", + "name": "vector_store_id", + "required": true, + "schema": { + "type": "string", + "example": "vs_abc123" + }, + "description": "The ID of the vector store that the file batch belongs to." + }, + { + "in": "path", + "name": "batch_id", + "required": true, + "schema": { + "type": "string", + "example": "vsfb_abc123" + }, + "description": "The ID of the file batch being retrieved." + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VectorStoreFileBatchObject" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Retrieve vector store file batch", + "group": "vector_stores", + "beta": true, + "returns": "The [vector store file batch](/docs/api-reference/vector-stores-file-batches/batch-object) object.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nvector_store_file_batch = client.beta.vector_stores.file_batches.retrieve(\n vector_store_id=\"vs_abc123\",\n batch_id=\"vsfb_abc123\"\n)\nprint(vector_store_file_batch)\n", + "node.js": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStoreFileBatch = await openai.beta.vectorStores.fileBatches.retrieve(\n \"vs_abc123\",\n \"vsfb_abc123\"\n );\n console.log(vectorStoreFileBatch);\n}\n\nmain();\n" + }, + "response": "{\n \"id\": \"vsfb_abc123\",\n \"object\": \"vector_store.file_batch\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\",\n \"status\": \"in_progress\",\n \"file_counts\": {\n \"in_progress\": 1,\n \"completed\": 1,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 0,\n }\n}\n" + } + } + } + }, + "/vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel": { + "post": { + "operationId": "cancelVectorStoreFileBatch", + "tags": ["Vector Stores"], + "summary": "Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible.", + "parameters": [ + { + "in": "path", + "name": "vector_store_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the vector store that the file batch belongs to." + }, + { + "in": "path", + "name": "batch_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the file batch to cancel." + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VectorStoreFileBatchObject" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Cancel vector store file batch", + "group": "vector_stores", + "beta": true, + "returns": "The modified vector store file batch object.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123/cancel \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -X POST\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\ndeleted_vector_store_file_batch = client.beta.vector_stores.file_batches.cancel(\n vector_store_id=\"vs_abc123\",\n file_batch_id=\"vsfb_abc123\"\n)\nprint(deleted_vector_store_file_batch)\n", + "node.js": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const deletedVectorStoreFileBatch = await openai.vector_stores.fileBatches.cancel(\n \"vs_abc123\",\n \"vsfb_abc123\"\n );\n console.log(deletedVectorStoreFileBatch);\n}\n\nmain();\n" + }, + "response": "{\n \"id\": \"vsfb_abc123\",\n \"object\": \"vector_store.file_batch\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\",\n \"status\": \"cancelling\",\n \"file_counts\": {\n \"in_progress\": 12,\n \"completed\": 3,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 15,\n }\n}\n" + } + } + } + }, + "/vector_stores/{vector_store_id}/file_batches/{batch_id}/files": { + "get": { + "operationId": "listFilesInVectorStoreBatch", + "tags": ["Vector Stores"], + "summary": "Returns a list of vector store files in a batch.", + "parameters": [ + { + "name": "vector_store_id", + "in": "path", + "description": "The ID of the vector store that the files belong to.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "batch_id", + "in": "path", + "description": "The ID of the file batch that the files belong to.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "limit", + "in": "query", + "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n", + "required": false, + "schema": { + "type": "integer", + "default": 20 + } + }, + { + "name": "order", + "in": "query", + "description": "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n", + "schema": { + "type": "string", + "default": "desc", + "enum": ["asc", "desc"] + } + }, + { + "name": "after", + "in": "query", + "description": "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n", + "schema": { + "type": "string" + } + }, + { + "name": "before", + "in": "query", + "description": "A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.\n", + "schema": { + "type": "string" + } + }, + { + "name": "filter", + "in": "query", + "description": "Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`.", + "schema": { + "type": "string", + "enum": ["in_progress", "completed", "failed", "cancelled"] + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListVectorStoreFilesResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "List vector store files in a batch", + "group": "vector_stores", + "beta": true, + "returns": "A list of [vector store file](/docs/api-reference/vector-stores-files/file-object) objects.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123/files \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nvector_store_files = client.beta.vector_stores.file_batches.list_files(\n vector_store_id=\"vs_abc123\",\n batch_id=\"vsfb_abc123\"\n)\nprint(vector_store_files)\n", + "node.js": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStoreFiles = await openai.beta.vectorStores.fileBatches.listFiles(\n \"vs_abc123\",\n \"vsfb_abc123\"\n );\n console.log(vectorStoreFiles);\n}\n\nmain();\n" + }, + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"file-abc123\",\n \"object\": \"vector_store.file\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\"\n },\n {\n \"id\": \"file-abc456\",\n \"object\": \"vector_store.file\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\"\n }\n ],\n \"first_id\": \"file-abc123\",\n \"last_id\": \"file-abc456\",\n \"has_more\": false\n}\n" + } + } + } + }, + "/batches": { + "post": { + "summary": "Creates and executes a batch from an uploaded file of requests", + "operationId": "createBatch", + "tags": ["Batch"], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": ["input_file_id", "endpoint", "completion_window"], + "properties": { + "input_file_id": { + "type": "string", + "description": "The ID of an uploaded file that contains requests for the new batch.\n\nSee [upload file](/docs/api-reference/files/create) for how to upload a file.\n\nYour input file must be formatted as a [JSONL file](/docs/api-reference/batch/request-input), and must be uploaded with the purpose `batch`. The file can contain up to 50,000 requests, and can be up to 100 MB in size.\n" + }, + "endpoint": { + "type": "string", + "enum": [ + "/v1/chat/completions", + "/v1/embeddings", + "/v1/completions" + ], + "description": "The endpoint to be used for all requests in the batch. Currently `/v1/chat/completions`, `/v1/embeddings`, and `/v1/completions` are supported. Note that `/v1/embeddings` batches are also restricted to a maximum of 50,000 embedding inputs across all requests in the batch." + }, + "completion_window": { + "type": "string", + "enum": ["24h"], + "description": "The time frame within which the batch should be processed. Currently only `24h` is supported." + }, + "metadata": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Optional custom metadata for the batch.", + "nullable": true + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Batch created successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Batch" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Create batch", + "group": "batch", + "returns": "The created [Batch](/docs/api-reference/batch/object) object.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/batches \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"input_file_id\": \"file-abc123\",\n \"endpoint\": \"/v1/chat/completions\",\n \"completion_window\": \"24h\"\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.batches.create(\n input_file_id=\"file-abc123\",\n endpoint=\"/v1/chat/completions\",\n completion_window=\"24h\"\n)\n", + "node": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const batch = await openai.batches.create({\n input_file_id: \"file-abc123\",\n endpoint: \"/v1/chat/completions\",\n completion_window: \"24h\"\n });\n\n console.log(batch);\n}\n\nmain();\n" + }, + "response": "{\n \"id\": \"batch_abc123\",\n \"object\": \"batch\",\n \"endpoint\": \"/v1/chat/completions\",\n \"errors\": null,\n \"input_file_id\": \"file-abc123\",\n \"completion_window\": \"24h\",\n \"status\": \"validating\",\n \"output_file_id\": null,\n \"error_file_id\": null,\n \"created_at\": 1711471533,\n \"in_progress_at\": null,\n \"expires_at\": null,\n \"finalizing_at\": null,\n \"completed_at\": null,\n \"failed_at\": null,\n \"expired_at\": null,\n \"cancelling_at\": null,\n \"cancelled_at\": null,\n \"request_counts\": {\n \"total\": 0,\n \"completed\": 0,\n \"failed\": 0\n },\n \"metadata\": {\n \"customer_id\": \"user_123456789\",\n \"batch_description\": \"Nightly eval job\",\n }\n}\n" + } + } + }, + "get": { + "operationId": "listBatches", + "tags": ["Batch"], + "summary": "List your organization's batches.", + "parameters": [ + { + "in": "query", + "name": "after", + "required": false, + "schema": { + "type": "string" + }, + "description": "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n" + }, + { + "name": "limit", + "in": "query", + "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n", + "required": false, + "schema": { + "type": "integer", + "default": 20 + } + } + ], + "responses": { + "200": { + "description": "Batch listed successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListBatchesResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "List batch", + "group": "batch", + "returns": "A list of paginated [Batch](/docs/api-reference/batch/object) objects.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/batches?limit=2 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.batches.list()\n", + "node": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const list = await openai.batches.list();\n\n for await (const batch of list) {\n console.log(batch);\n }\n}\n\nmain();\n" + }, + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"batch_abc123\",\n \"object\": \"batch\",\n \"endpoint\": \"/v1/chat/completions\",\n \"errors\": null,\n \"input_file_id\": \"file-abc123\",\n \"completion_window\": \"24h\",\n \"status\": \"completed\",\n \"output_file_id\": \"file-cvaTdG\",\n \"error_file_id\": \"file-HOWS94\",\n \"created_at\": 1711471533,\n \"in_progress_at\": 1711471538,\n \"expires_at\": 1711557933,\n \"finalizing_at\": 1711493133,\n \"completed_at\": 1711493163,\n \"failed_at\": null,\n \"expired_at\": null,\n \"cancelling_at\": null,\n \"cancelled_at\": null,\n \"request_counts\": {\n \"total\": 100,\n \"completed\": 95,\n \"failed\": 5\n },\n \"metadata\": {\n \"customer_id\": \"user_123456789\",\n \"batch_description\": \"Nightly job\",\n }\n },\n { ... },\n ],\n \"first_id\": \"batch_abc123\",\n \"last_id\": \"batch_abc456\",\n \"has_more\": true\n}\n" + } + } + } + }, + "/batches/{batch_id}": { + "get": { + "operationId": "retrieveBatch", + "tags": ["Batch"], + "summary": "Retrieves a batch.", + "parameters": [ + { + "in": "path", + "name": "batch_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the batch to retrieve." + } + ], + "responses": { + "200": { + "description": "Batch retrieved successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Batch" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Retrieve batch", + "group": "batch", + "returns": "The [Batch](/docs/api-reference/batch/object) object matching the specified ID.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/batches/batch_abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.batches.retrieve(\"batch_abc123\")\n", + "node": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const batch = await openai.batches.retrieve(\"batch_abc123\");\n\n console.log(batch);\n}\n\nmain();\n" + }, + "response": "{\n \"id\": \"batch_abc123\",\n \"object\": \"batch\",\n \"endpoint\": \"/v1/completions\",\n \"errors\": null,\n \"input_file_id\": \"file-abc123\",\n \"completion_window\": \"24h\",\n \"status\": \"completed\",\n \"output_file_id\": \"file-cvaTdG\",\n \"error_file_id\": \"file-HOWS94\",\n \"created_at\": 1711471533,\n \"in_progress_at\": 1711471538,\n \"expires_at\": 1711557933,\n \"finalizing_at\": 1711493133,\n \"completed_at\": 1711493163,\n \"failed_at\": null,\n \"expired_at\": null,\n \"cancelling_at\": null,\n \"cancelled_at\": null,\n \"request_counts\": {\n \"total\": 100,\n \"completed\": 95,\n \"failed\": 5\n },\n \"metadata\": {\n \"customer_id\": \"user_123456789\",\n \"batch_description\": \"Nightly eval job\",\n }\n}\n" + } + } + } + }, + "/batches/{batch_id}/cancel": { + "post": { + "operationId": "cancelBatch", + "tags": ["Batch"], + "summary": "Cancels an in-progress batch. The batch will be in status `cancelling` for up to 10 minutes, before changing to `cancelled`, where it will have partial results (if any) available in the output file.", + "parameters": [ + { + "in": "path", + "name": "batch_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the batch to cancel." + } + ], + "responses": { + "200": { + "description": "Batch is cancelling. Returns the cancelling batch's details.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Batch" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Cancel batch", + "group": "batch", + "returns": "The [Batch](/docs/api-reference/batch/object) object matching the specified ID.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/batches/batch_abc123/cancel \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -X POST\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.batches.cancel(\"batch_abc123\")\n", + "node": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const batch = await openai.batches.cancel(\"batch_abc123\");\n\n console.log(batch);\n}\n\nmain();\n" + }, + "response": "{\n \"id\": \"batch_abc123\",\n \"object\": \"batch\",\n \"endpoint\": \"/v1/chat/completions\",\n \"errors\": null,\n \"input_file_id\": \"file-abc123\",\n \"completion_window\": \"24h\",\n \"status\": \"cancelling\",\n \"output_file_id\": null,\n \"error_file_id\": null,\n \"created_at\": 1711471533,\n \"in_progress_at\": 1711471538,\n \"expires_at\": 1711557933,\n \"finalizing_at\": null,\n \"completed_at\": null,\n \"failed_at\": null,\n \"expired_at\": null,\n \"cancelling_at\": 1711475133,\n \"cancelled_at\": null,\n \"request_counts\": {\n \"total\": 100,\n \"completed\": 23,\n \"failed\": 1\n },\n \"metadata\": {\n \"customer_id\": \"user_123456789\",\n \"batch_description\": \"Nightly eval job\",\n }\n}\n" + } + } + } + }, + "/organization/audit_logs": { + "get": { + "summary": "List user actions and configuration changes within this organization.", + "operationId": "list-audit-logs", + "tags": ["Audit Logs"], + "parameters": [ + { + "name": "effective_at", + "in": "query", + "description": "Return only events whose `effective_at` (Unix seconds) is in this range.", + "required": false, + "schema": { + "type": "object", + "properties": { + "gt": { + "type": "integer", + "description": "Return only events whose `effective_at` (Unix seconds) is greater than this value." + }, + "gte": { + "type": "integer", + "description": "Return only events whose `effective_at` (Unix seconds) is greater than or equal to this value." + }, + "lt": { + "type": "integer", + "description": "Return only events whose `effective_at` (Unix seconds) is less than this value." + }, + "lte": { + "type": "integer", + "description": "Return only events whose `effective_at` (Unix seconds) is less than or equal to this value." + } + } + } + }, + { + "name": "project_ids[]", + "in": "query", + "description": "Return only events for these projects.", + "required": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "name": "event_types[]", + "in": "query", + "description": "Return only events with a `type` in one of these values. For example, `project.created`. For all options, see the documentation for the [audit log object](/docs/api-reference/audit-logs/object).", + "required": false, + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AuditLogEventType" + } + } + }, + { + "name": "actor_ids[]", + "in": "query", + "description": "Return only events performed by these actors. Can be a user ID, a service account ID, or an api key tracking ID.", + "required": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "name": "actor_emails[]", + "in": "query", + "description": "Return only events performed by users with these emails.", + "required": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "name": "resource_ids[]", + "in": "query", + "description": "Return only events performed on these targets. For example, a project ID updated.", + "required": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "name": "limit", + "in": "query", + "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n", + "required": false, + "schema": { + "type": "integer", + "default": 20 + } + }, + { + "name": "after", + "in": "query", + "description": "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n", + "schema": { + "type": "string" + } + }, + { + "name": "before", + "in": "query", + "description": "A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.\n", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Audit logs listed successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListAuditLogsResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "List audit logs", + "group": "audit-logs", + "returns": "A list of paginated [Audit Log](/docs/api-reference/audit-logs/object) objects.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/organization/audit_logs \\\n-H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n-H \"Content-Type: application/json\" \\\n" + }, + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"audit_log-xxx_yyyymmdd\",\n \"type\": \"project.archived\",\n \"effective_at\": 1722461446,\n \"actor\": {\n \"type\": \"api_key\",\n \"api_key\": {\n \"type\": \"user\",\n \"user\": {\n \"id\": \"user-xxx\",\n \"email\": \"user@example.com\"\n }\n }\n },\n \"project.archived\": {\n \"id\": \"proj_abc\"\n },\n },\n {\n \"id\": \"audit_log-yyy__20240101\",\n \"type\": \"api_key.updated\",\n \"effective_at\": 1720804190,\n \"actor\": {\n \"type\": \"session\",\n \"session\": {\n \"user\": {\n \"id\": \"user-xxx\",\n \"email\": \"user@example.com\"\n },\n \"ip_address\": \"127.0.0.1\",\n \"user_agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36\"\n }\n },\n \"api_key.updated\": {\n \"id\": \"key_xxxx\",\n \"data\": {\n \"scopes\": [\"resource_2.operation_2\"]\n }\n },\n }\n ],\n \"first_id\": \"audit_log-xxx__20240101\",\n \"last_id\": \"audit_log_yyy__20240101\",\n \"has_more\": true\n}\n" + } + } + } + }, + "/organization/invites": { + "get": { + "summary": "Returns a list of invites in the organization.", + "operationId": "list-invites", + "tags": ["Invites"], + "parameters": [ + { + "name": "limit", + "in": "query", + "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n", + "required": false, + "schema": { + "type": "integer", + "default": 20 + } + }, + { + "name": "after", + "in": "query", + "description": "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n", + "required": false, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Invites listed successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InviteListResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "List invites", + "group": "administration", + "returns": "A list of [Invite](/docs/api-reference/invite/object) objects.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/organization/invites?after=invite-abc&limit=20 \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" + }, + "response": { + "content": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"organization.invite\",\n \"id\": \"invite-abc\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"status\": \"accepted\",\n \"invited_at\": 1711471533,\n \"expires_at\": 1711471533,\n \"accepted_at\": 1711471533\n }\n ],\n \"first_id\": \"invite-abc\",\n \"last_id\": \"invite-abc\",\n \"has_more\": false\n}\n" + } + } + } + }, + "post": { + "summary": "Create an invite for a user to the organization. The invite must be accepted by the user before they have access to the organization.", + "operationId": "inviteUser", + "tags": ["Invites"], + "requestBody": { + "description": "The invite request payload.", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InviteRequest" + } + } + } + }, + "responses": { + "200": { + "description": "User invited successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Invite" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Create invite", + "group": "administration", + "returns": "The created [Invite](/docs/api-reference/invite/object) object.", + "examples": { + "request": { + "curl": "curl -X POST https://api.openai.com/v1/organization/invites \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"email\": \"user@example.com\",\n \"role\": \"owner\"\n }'\n" + }, + "response": { + "content": "{\n \"object\": \"organization.invite\",\n \"id\": \"invite-abc\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"invited_at\": 1711471533,\n \"expires_at\": 1711471533,\n \"accepted_at\": null\n}\n" + } + } + } + } + }, + "/organization/invites/{invite_id}": { + "get": { + "summary": "Retrieves an invite.", + "operationId": "retrieve-invite", + "tags": ["Invites"], + "parameters": [ + { + "in": "path", + "name": "invite_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the invite to retrieve." + } + ], + "responses": { + "200": { + "description": "Invite retrieved successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Invite" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Retrieve invite", + "group": "administration", + "returns": "The [Invite](/docs/api-reference/invite/object) object matching the specified ID.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/organization/invites/invite-abc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" + }, + "response": { + "content": "{\n \"object\": \"organization.invite\",\n \"id\": \"invite-abc\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"status\": \"accepted\",\n \"invited_at\": 1711471533,\n \"expires_at\": 1711471533,\n \"accepted_at\": 1711471533\n}\n" + } + } + } + }, + "delete": { + "summary": "Delete an invite. If the invite has already been accepted, it cannot be deleted.", + "operationId": "delete-invite", + "tags": ["Invites"], + "parameters": [ + { + "in": "path", + "name": "invite_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the invite to delete." + } + ], + "responses": { + "200": { + "description": "Invite deleted successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InviteDeleteResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Delete invite", + "group": "administration", + "returns": "Confirmation that the invite has been deleted", + "examples": { + "request": { + "curl": "curl -X DELETE https://api.openai.com/v1/organization/invites/invite-abc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" + }, + "response": { + "content": "{\n \"object\": \"organization.invite.deleted\",\n \"id\": \"invite-abc\",\n \"deleted\": true\n}\n" + } + } + } + } + }, + "/organization/users": { + "get": { + "summary": "Lists all of the users in the organization.", + "operationId": "list-users", + "tags": ["Users"], + "parameters": [ + { + "name": "limit", + "in": "query", + "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n", + "required": false, + "schema": { + "type": "integer", + "default": 20 + } + }, + { + "name": "after", + "in": "query", + "description": "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n", + "required": false, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Users listed successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserListResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "List users", + "group": "administration", + "returns": "A list of [User](/docs/api-reference/users/object) objects.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/organization/users?after=user_abc&limit=20 \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" + }, + "response": { + "content": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"organization.user\",\n \"id\": \"user_abc\",\n \"name\": \"First Last\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"added_at\": 1711471533\n }\n ],\n \"first_id\": \"user-abc\",\n \"last_id\": \"user-xyz\",\n \"has_more\": false\n}\n" + } + } + } + } + }, + "/organization/users/{user_id}": { + "get": { + "summary": "Retrieves a user by their identifier.", + "operationId": "retrieve-user", + "tags": ["Users"], + "parameters": [ + { + "name": "user_id", + "in": "path", + "description": "The ID of the user.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "User retrieved successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/User" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Retrieve user", + "group": "administration", + "returns": "The [User](/docs/api-reference/users/object) object matching the specified ID.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/organization/users/user_abc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" + }, + "response": { + "content": "{\n \"object\": \"organization.user\",\n \"id\": \"user_abc\",\n \"name\": \"First Last\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"added_at\": 1711471533\n}\n" + } + } + } + }, + "post": { + "summary": "Modifies a user's role in the organization.", + "operationId": "modify-user", + "tags": ["Users"], + "requestBody": { + "description": "The new user role to modify. This must be one of `owner` or `member`.", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserRoleUpdateRequest" + } + } + } + }, + "responses": { + "200": { + "description": "User role updated successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/User" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Modify user", + "group": "administration", + "returns": "The updated [User](/docs/api-reference/users/object) object.", + "examples": { + "request": { + "curl": "curl -X POST https://api.openai.com/v1/organization/users/user_abc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"role\": \"owner\"\n }'\n" + }, + "response": { + "content": "{\n \"object\": \"organization.user\",\n \"id\": \"user_abc\",\n \"name\": \"First Last\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"added_at\": 1711471533\n}\n" + } + } + } + }, + "delete": { + "summary": "Deletes a user from the organization.", + "operationId": "delete-user", + "tags": ["Users"], + "parameters": [ + { + "name": "user_id", + "in": "path", + "description": "The ID of the user.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "User deleted successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserDeleteResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Delete user", + "group": "administration", + "returns": "Confirmation of the deleted user", + "examples": { + "request": { + "curl": "curl -X DELETE https://api.openai.com/v1/organization/users/user_abc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" + }, + "response": { + "content": "{\n \"object\": \"organization.user.deleted\",\n \"id\": \"user_abc\",\n \"deleted\": true\n}\n" + } + } + } + } + }, + "/organization/projects": { + "get": { + "summary": "Returns a list of projects.", + "operationId": "list-projects", + "tags": ["Projects"], + "parameters": [ + { + "name": "limit", + "in": "query", + "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n", + "required": false, + "schema": { + "type": "integer", + "default": 20 + } + }, + { + "name": "after", + "in": "query", + "description": "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n", + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "include_archived", + "in": "query", + "schema": { + "type": "boolean", + "default": false + }, + "description": "If `true` returns all projects including those that have been `archived`. Archived projects are not included by default." + } + ], + "responses": { + "200": { + "description": "Projects listed successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProjectListResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "List projects", + "group": "administration", + "returns": "A list of [Project](/docs/api-reference/projects/object) objects.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/organization/projects?after=proj_abc&limit=20&include_archived=false \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" + }, + "response": { + "content": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"proj_abc\",\n \"object\": \"organization.project\",\n \"name\": \"Project example\",\n \"created_at\": 1711471533,\n \"archived_at\": null,\n \"status\": \"active\"\n }\n ],\n \"first_id\": \"proj-abc\",\n \"last_id\": \"proj-xyz\",\n \"has_more\": false\n}\n" + } + } + } + }, + "post": { + "summary": "Create a new project in the organization. Projects can be created and archived, but cannot be deleted.", + "operationId": "create-project", + "tags": ["Projects"], + "requestBody": { + "description": "The project create request payload.", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProjectCreateRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Project created successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Project" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Create project", + "group": "administration", + "returns": "The created [Project](/docs/api-reference/projects/object) object.", + "examples": { + "request": { + "curl": "curl -X POST https://api.openai.com/v1/organization/projects \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"name\": \"Project ABC\",\n \"app_use_case\": \"Your project use case here\",\n \"business_website\": \"https://example.com\"\n }'\n" + }, + "response": { + "content": "{\n \"id\": \"proj_abc\",\n \"object\": \"organization.project\",\n \"name\": \"Project ABC\",\n \"created_at\": 1711471533,\n \"archived_at\": null,\n \"status\": \"active\",\n \"app_use_case\": \"Your project use case here\",\n \"business_website\": \"https://example.com\"\n}\n" + } + } + } + } + }, + "/organization/projects/{project_id}": { + "get": { + "summary": "Retrieves a project.", + "operationId": "retrieve-project", + "tags": ["Projects"], + "parameters": [ + { + "name": "project_id", + "in": "path", + "description": "The ID of the project.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Project retrieved successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Project" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Retrieve project", + "group": "administration", + "description": "Retrieve a project.", + "returns": "The [Project](/docs/api-reference/projects/object) object matching the specified ID.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/organization/projects/proj_abc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" + }, + "response": { + "content": "{\n \"id\": \"proj_abc\",\n \"object\": \"organization.project\",\n \"name\": \"Project example\",\n \"created_at\": 1711471533,\n \"archived_at\": null,\n \"status\": \"active\"\n}\n" + } + } + } + }, + "post": { + "summary": "Modifies a project in the organization.", + "operationId": "modify-project", + "tags": ["Projects"], + "requestBody": { + "description": "The project update request payload.", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProjectUpdateRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Project updated successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Project" + } + } + } + }, + "400": { + "description": "Error response when updating the default project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Modify project", + "group": "administration", + "returns": "The updated [Project](/docs/api-reference/projects/object) object.", + "examples": { + "request": { + "curl": "curl -X POST https://api.openai.com/v1/organization/projects/proj_abc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"name\": \"Project DEF\",\n \"app_use_case\": \"Your project use case here\",\n \"business_website\": \"https://example.com\"\n }'\n" + } + } + } + } + }, + "/organization/projects/{project_id}/archive": { + "post": { + "summary": "Archives a project in the organization. Archived projects cannot be used or updated.", + "operationId": "archive-project", + "tags": ["Projects"], + "parameters": [ + { + "name": "project_id", + "in": "path", + "description": "The ID of the project.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Project archived successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Project" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Archive project", + "group": "administration", + "returns": "The archived [Project](/docs/api-reference/projects/object) object.", + "examples": { + "request": { + "curl": "curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/archive \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" + }, + "response": { + "content": "{\n \"id\": \"proj_abc\",\n \"object\": \"organization.project\",\n \"name\": \"Project DEF\",\n \"created_at\": 1711471533,\n \"archived_at\": 1711471533,\n \"status\": \"archived\"\n}\n" + } + } + } + } + }, + "/organization/projects/{project_id}/users": { + "get": { + "summary": "Returns a list of users in the project.", + "operationId": "list-project-users", + "tags": ["Projects"], + "parameters": [ + { + "name": "project_id", + "in": "path", + "description": "The ID of the project.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "limit", + "in": "query", + "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n", + "required": false, + "schema": { + "type": "integer", + "default": 20 + } + }, + { + "name": "after", + "in": "query", + "description": "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n", + "required": false, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Project users listed successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProjectUserListResponse" + } + } + } + }, + "400": { + "description": "Error response when project is archived.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "List project users", + "group": "administration", + "returns": "A list of [ProjectUser](/docs/api-reference/project-users/object) objects.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/organization/projects/proj_abc/users?after=user_abc&limit=20 \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" + }, + "response": { + "content": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"organization.project.user\",\n \"id\": \"user_abc\",\n \"name\": \"First Last\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"added_at\": 1711471533\n }\n ],\n \"first_id\": \"user-abc\",\n \"last_id\": \"user-xyz\",\n \"has_more\": false\n}\n" + }, + "error_response": { + "content": "{\n \"code\": 400,\n \"message\": \"Project {name} is archived\"\n}\n" + } + } + } + }, + "post": { + "summary": "Adds a user to the project. Users must already be members of the organization to be added to a project.", + "operationId": "create-project-user", + "parameters": [ + { + "name": "project_id", + "in": "path", + "description": "The ID of the project.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "tags": ["Projects"], + "requestBody": { + "description": "The project user create request payload.", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProjectUserCreateRequest" + } + } + } + }, + "responses": { + "200": { + "description": "User added to project successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProjectUser" + } + } + } + }, + "400": { + "description": "Error response for various conditions.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Create project user", + "group": "administration", + "returns": "The created [ProjectUser](/docs/api-reference/project-users/object) object.", + "examples": { + "request": { + "curl": "curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/users \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"user_id\": \"user_abc\",\n \"role\": \"member\"\n }'\n" + }, + "response": { + "content": "{\n \"object\": \"organization.project.user\",\n \"id\": \"user_abc\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"added_at\": 1711471533\n}\n" + }, + "error_response": { + "content": "{\n \"code\": 400,\n \"message\": \"Project {name} is archived\"\n}\n" + } + } + } + } + }, + "/organization/projects/{project_id}/users/{user_id}": { + "get": { + "summary": "Retrieves a user in the project.", + "operationId": "retrieve-project-user", + "tags": ["Projects"], + "parameters": [ + { + "name": "project_id", + "in": "path", + "description": "The ID of the project.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "user_id", + "in": "path", + "description": "The ID of the user.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Project user retrieved successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProjectUser" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Retrieve project user", + "group": "administration", + "returns": "The [ProjectUser](/docs/api-reference/project-users/object) object matching the specified ID.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/organization/projects/proj_abc/users/user_abc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" + }, + "response": { + "content": "{\n \"object\": \"organization.project.user\",\n \"id\": \"user_abc\",\n \"name\": \"First Last\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"added_at\": 1711471533\n}\n" + } + } + } + }, + "post": { + "summary": "Modifies a user's role in the project.", + "operationId": "modify-project-user", + "tags": ["Projects"], + "requestBody": { + "description": "The project user update request payload.", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProjectUserUpdateRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Project user's role updated successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProjectUser" + } + } + } + }, + "400": { + "description": "Error response for various conditions.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Modify project user", + "group": "administration", + "returns": "The updated [ProjectUser](/docs/api-reference/project-users/object) object.", + "examples": { + "request": { + "curl": "curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/users/user_abc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"role\": \"owner\"\n }'\n" + }, + "response": { + "content": "{\n \"object\": \"organization.project.user\",\n \"id\": \"user_abc\",\n \"name\": \"First Last\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"added_at\": 1711471533\n}\n" + } + } + } + }, + "delete": { + "summary": "Deletes a user from the project.", + "operationId": "delete-project-user", + "tags": ["Projects"], + "parameters": [ + { + "name": "project_id", + "in": "path", + "description": "The ID of the project.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "user_id", + "in": "path", + "description": "The ID of the user.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Project user deleted successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProjectUserDeleteResponse" + } + } + } + }, + "400": { + "description": "Error response for various conditions.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Delete project user", + "group": "administration", + "returns": "Confirmation that project has been deleted or an error in case of an archived project, which has no users", + "examples": { + "request": { + "curl": "curl -X DELETE https://api.openai.com/v1/organization/projects/proj_abc/users/user_abc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" + }, + "response": { + "content": "{\n \"object\": \"organization.project.user.deleted\",\n \"id\": \"user_abc\",\n \"deleted\": true\n}\n" + } + } + } + } + }, + "/organization/projects/{project_id}/service_accounts": { + "get": { + "summary": "Returns a list of service accounts in the project.", + "operationId": "list-project-service-accounts", + "tags": ["Projects"], + "parameters": [ + { + "name": "project_id", + "in": "path", + "description": "The ID of the project.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "limit", + "in": "query", + "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n", + "required": false, + "schema": { + "type": "integer", + "default": 20 + } + }, + { + "name": "after", + "in": "query", + "description": "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n", + "required": false, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Project service accounts listed successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProjectServiceAccountListResponse" + } + } + } + }, + "400": { + "description": "Error response when project is archived.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "List project service accounts", + "group": "administration", + "returns": "A list of [ProjectServiceAccount](/docs/api-reference/project-service-accounts/object) objects.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/organization/projects/proj_abc/service_accounts?after=custom_id&limit=20 \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" + }, + "response": { + "content": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"organization.project.service_account\",\n \"id\": \"svc_acct_abc\",\n \"name\": \"Service Account\",\n \"role\": \"owner\",\n \"created_at\": 1711471533\n }\n ],\n \"first_id\": \"svc_acct_abc\",\n \"last_id\": \"svc_acct_xyz\",\n \"has_more\": false\n}\n" + } + } + } + }, + "post": { + "summary": "Creates a new service account in the project. This also returns an unredacted API key for the service account.", + "operationId": "create-project-service-account", + "tags": ["Projects"], + "parameters": [ + { + "name": "project_id", + "in": "path", + "description": "The ID of the project.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The project service account create request payload.", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProjectServiceAccountCreateRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Project service account created successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProjectServiceAccountCreateResponse" + } + } + } + }, + "400": { + "description": "Error response when project is archived.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Create project service account", + "group": "administration", + "returns": "The created [ProjectServiceAccount](/docs/api-reference/project-service-accounts/object) object.", + "examples": { + "request": { + "curl": "curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/service_accounts \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"name\": \"Production App\"\n }'\n" + }, + "response": { + "content": "{\n \"object\": \"organization.project.service_account\",\n \"id\": \"svc_acct_abc\",\n \"name\": \"Production App\",\n \"role\": \"member\",\n \"created_at\": 1711471533,\n \"api_key\": {\n \"object\": \"organization.project.service_account.api_key\",\n \"value\": \"sk-abcdefghijklmnop123\",\n \"name\": \"Secret Key\",\n \"created_at\": 1711471533,\n \"id\": \"key_abc\"\n }\n}\n" + } + } + } + } + }, + "/organization/projects/{project_id}/service_accounts/{service_account_id}": { + "get": { + "summary": "Retrieves a service account in the project.", + "operationId": "retrieve-project-service-account", + "tags": ["Projects"], + "parameters": [ + { + "name": "project_id", + "in": "path", + "description": "The ID of the project.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "service_account_id", + "in": "path", + "description": "The ID of the service account.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Project service account retrieved successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProjectServiceAccount" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Retrieve project service account", + "group": "administration", + "returns": "The [ProjectServiceAccount](/docs/api-reference/project-service-accounts/object) object matching the specified ID.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/organization/projects/proj_abc/service_accounts/svc_acct_abc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" + }, + "response": { + "content": "{\n \"object\": \"organization.project.service_account\",\n \"id\": \"svc_acct_abc\",\n \"name\": \"Service Account\",\n \"role\": \"owner\",\n \"created_at\": 1711471533\n}\n" + } + } + } + }, + "delete": { + "summary": "Deletes a service account from the project.", + "operationId": "delete-project-service-account", + "tags": ["Projects"], + "parameters": [ + { + "name": "project_id", + "in": "path", + "description": "The ID of the project.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "service_account_id", + "in": "path", + "description": "The ID of the service account.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Project service account deleted successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProjectServiceAccountDeleteResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Delete project service account", + "group": "administration", + "returns": "Confirmation of service account being deleted, or an error in case of an archived project, which has no service accounts", + "examples": { + "request": { + "curl": "curl -X DELETE https://api.openai.com/v1/organization/projects/proj_abc/service_accounts/svc_acct_abc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" + }, + "response": { + "content": "{\n \"object\": \"organization.project.service_account.deleted\",\n \"id\": \"svc_acct_abc\",\n \"deleted\": true\n}\n" + } + } + } + } + }, + "/organization/projects/{project_id}/api_keys": { + "get": { + "summary": "Returns a list of API keys in the project.", + "operationId": "list-project-api-keys", + "tags": ["Projects"], + "parameters": [ + { + "name": "project_id", + "in": "path", + "description": "The ID of the project.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "limit", + "in": "query", + "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n", + "required": false, + "schema": { + "type": "integer", + "default": 20 + } + }, + { + "name": "after", + "in": "query", + "description": "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n", + "required": false, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Project API keys listed successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProjectApiKeyListResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "List project API keys", + "group": "administration", + "returns": "A list of [ProjectApiKey](/docs/api-reference/project-api-keys/object) objects.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/organization/projects/proj_abc/api_keys?after=key_abc&limit=20 \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" + }, + "response": { + "content": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"organization.project.api_key\",\n \"redacted_value\": \"sk-abc...def\",\n \"name\": \"My API Key\",\n \"created_at\": 1711471533,\n \"id\": \"key_abc\",\n \"owner\": {\n \"type\": \"user\",\n \"user\": {\n \"object\": \"organization.project.user\",\n \"id\": \"user_abc\",\n \"name\": \"First Last\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"added_at\": 1711471533\n }\n }\n }\n ],\n \"first_id\": \"key_abc\",\n \"last_id\": \"key_xyz\",\n \"has_more\": false\n}\n" + }, + "error_response": { + "content": "{\n \"code\": 400,\n \"message\": \"Project {name} is archived\"\n}\n" + } + } + } + } + }, + "/organization/projects/{project_id}/api_keys/{key_id}": { + "get": { + "summary": "Retrieves an API key in the project.", + "operationId": "retrieve-project-api-key", + "tags": ["Projects"], + "parameters": [ + { + "name": "project_id", + "in": "path", + "description": "The ID of the project.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "key_id", + "in": "path", + "description": "The ID of the API key.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Project API key retrieved successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProjectApiKey" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Retrieve project API key", + "group": "administration", + "returns": "The [ProjectApiKey](/docs/api-reference/project-api-keys/object) object matching the specified ID.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/organization/projects/proj_abc/api_keys/key_abc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" + }, + "response": { + "content": "{\n \"object\": \"organization.project.api_key\",\n \"redacted_value\": \"sk-abc...def\",\n \"name\": \"My API Key\",\n \"created_at\": 1711471533,\n \"id\": \"key_abc\",\n \"owner\": {\n \"type\": \"user\",\n \"user\": {\n \"object\": \"organization.project.user\",\n \"id\": \"user_abc\",\n \"name\": \"First Last\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"added_at\": 1711471533\n }\n }\n}\n" + } + } + } + }, + "delete": { + "summary": "Deletes an API key from the project.", + "operationId": "delete-project-api-key", + "tags": ["Projects"], + "parameters": [ + { + "name": "project_id", + "in": "path", + "description": "The ID of the project.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "key_id", + "in": "path", + "description": "The ID of the API key.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Project API key deleted successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProjectApiKeyDeleteResponse" + } + } + } + }, + "400": { + "description": "Error response for various conditions.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "x-oaiMeta": { + "name": "Delete project API key", + "group": "administration", + "returns": "Confirmation of the key's deletion or an error if the key belonged to a service account", + "examples": { + "request": { + "curl": "curl -X DELETE https://api.openai.com/v1/organization/projects/proj_abc/api_keys/key_abc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" + }, + "response": { + "content": "{\n \"object\": \"organization.project.api_key.deleted\",\n \"id\": \"key_abc\",\n \"deleted\": true\n}\n" + }, + "error_response": { + "content": "{\n \"code\": 400,\n \"message\": \"API keys cannot be deleted for service accounts, please delete the service account\"\n}\n" + } + } + } + } + } + }, + "components": { + "securitySchemes": { + "ApiKeyAuth": { + "type": "http", + "scheme": "bearer" + } + }, + "schemas": { + "Error": { + "type": "object", + "properties": { + "code": { + "type": "string", + "nullable": true + }, + "message": { + "type": "string", + "nullable": false + }, + "param": { + "type": "string", + "nullable": true + }, + "type": { + "type": "string", + "nullable": false + } + }, + "required": ["type", "message", "param", "code"] + }, + "ErrorResponse": { + "type": "object", + "properties": { + "error": { + "$ref": "#/components/schemas/Error" + } + }, + "required": ["error"] + }, + "ListModelsResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": ["list"] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Model" + } + } + }, + "required": ["object", "data"] + }, + "DeleteModelResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "deleted": { + "type": "boolean" + }, + "object": { + "type": "string" + } + }, + "required": ["id", "object", "deleted"] + }, + "CreateCompletionRequest": { + "type": "object", + "properties": { + "model": { + "description": "ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them.\n", + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": ["gpt-3.5-turbo-instruct", "davinci-002", "babbage-002"] + } + ], + "x-oaiTypeLabel": "string" + }, + "prompt": { + "description": "The prompt(s) to generate completions for, encoded as a string, array of strings, array of tokens, or array of token arrays.\n\nNote that <|endoftext|> is the document separator that the model sees during training, so if a prompt is not specified the model will generate as if from the beginning of a new document.\n", + "default": "<|endoftext|>", + "nullable": true, + "oneOf": [ + { + "type": "string", + "default": "", + "example": "This is a test." + }, + { + "type": "array", + "items": { + "type": "string", + "default": "", + "example": "This is a test." + } + }, + { + "type": "array", + "minItems": 1, + "items": { + "type": "integer" + }, + "example": "[1212, 318, 257, 1332, 13]" + }, + { + "type": "array", + "minItems": 1, + "items": { + "type": "array", + "minItems": 1, + "items": { + "type": "integer" + } + }, + "example": "[[1212, 318, 257, 1332, 13]]" + } + ] + }, + "best_of": { + "type": "integer", + "default": 1, + "minimum": 0, + "maximum": 20, + "nullable": true, + "description": "Generates `best_of` completions server-side and returns the \"best\" (the one with the highest log probability per token). Results cannot be streamed.\n\nWhen used with `n`, `best_of` controls the number of candidate completions and `n` specifies how many to return – `best_of` must be greater than `n`.\n\n**Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`.\n" + }, + "echo": { + "type": "boolean", + "default": false, + "nullable": true, + "description": "Echo back the prompt in addition to the completion\n" + }, + "frequency_penalty": { + "type": "number", + "default": 0, + "minimum": -2, + "maximum": 2, + "nullable": true, + "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.\n\n[See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details)\n" + }, + "logit_bias": { + "type": "object", + "x-oaiTypeLabel": "map", + "default": null, + "nullable": true, + "additionalProperties": { + "type": "integer" + }, + "description": "Modify the likelihood of specified tokens appearing in the completion.\n\nAccepts a JSON object that maps tokens (specified by their token ID in the GPT tokenizer) to an associated bias value from -100 to 100. You can use this [tokenizer tool](/tokenizer?view=bpe) to convert text to token IDs. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token.\n\nAs an example, you can pass `{\"50256\": -100}` to prevent the <|endoftext|> token from being generated.\n" + }, + "logprobs": { + "type": "integer", + "minimum": 0, + "maximum": 5, + "default": null, + "nullable": true, + "description": "Include the log probabilities on the `logprobs` most likely output tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response.\n\nThe maximum value for `logprobs` is 5.\n" + }, + "max_tokens": { + "type": "integer", + "minimum": 0, + "default": 16, + "example": 16, + "nullable": true, + "description": "The maximum number of [tokens](/tokenizer) that can be generated in the completion.\n\nThe token count of your prompt plus `max_tokens` cannot exceed the model's context length. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens.\n" + }, + "n": { + "type": "integer", + "minimum": 1, + "maximum": 128, + "default": 1, + "example": 1, + "nullable": true, + "description": "How many completions to generate for each prompt.\n\n**Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`.\n" + }, + "presence_penalty": { + "type": "number", + "default": 0, + "minimum": -2, + "maximum": 2, + "nullable": true, + "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.\n\n[See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details)\n" + }, + "seed": { + "type": "integer", + "minimum": -9223372036854776000, + "maximum": 9223372036854776000, + "nullable": true, + "description": "If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result.\n\nDeterminism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend.\n" + }, + "stop": { + "description": "Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.\n", + "default": null, + "nullable": true, + "oneOf": [ + { + "type": "string", + "default": "<|endoftext|>", + "example": "\n", + "nullable": true + }, + { + "type": "array", + "minItems": 1, + "maxItems": 4, + "items": { + "type": "string", + "example": "[\"\\n\"]" + } + } + ] + }, + "stream": { + "description": "Whether to stream back partial progress. If set, tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions).\n", + "type": "boolean", + "nullable": true, + "default": false + }, + "stream_options": { + "$ref": "#/components/schemas/ChatCompletionStreamOptions" + }, + "suffix": { + "description": "The suffix that comes after a completion of inserted text.\n\nThis parameter is only supported for `gpt-3.5-turbo-instruct`.\n", + "default": null, + "nullable": true, + "type": "string", + "example": "test." + }, + "temperature": { + "type": "number", + "minimum": 0, + "maximum": 2, + "default": 1, + "example": 1, + "nullable": true, + "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n\nWe generally recommend altering this or `top_p` but not both.\n" + }, + "top_p": { + "type": "number", + "minimum": 0, + "maximum": 1, + "default": 1, + "example": 1, + "nullable": true, + "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or `temperature` but not both.\n" + }, + "user": { + "type": "string", + "example": "user-1234", + "description": "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).\n" + } + }, + "required": ["model", "prompt"] + }, + "CreateCompletionResponse": { + "type": "object", + "description": "Represents a completion response from the API. Note: both the streamed and non-streamed response objects share the same shape (unlike the chat endpoint).\n", + "properties": { + "id": { + "type": "string", + "description": "A unique identifier for the completion." + }, + "choices": { + "type": "array", + "description": "The list of completion choices the model generated for the input prompt.", + "items": { + "type": "object", + "required": ["finish_reason", "index", "logprobs", "text"], + "properties": { + "finish_reason": { + "type": "string", + "description": "The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,\n`length` if the maximum number of tokens specified in the request was reached,\nor `content_filter` if content was omitted due to a flag from our content filters.\n", + "enum": ["stop", "length", "content_filter"] + }, + "index": { + "type": "integer" + }, + "logprobs": { + "type": "object", + "nullable": true, + "properties": { + "text_offset": { + "type": "array", + "items": { + "type": "integer" + } + }, + "token_logprobs": { + "type": "array", + "items": { + "type": "number" + } + }, + "tokens": { + "type": "array", + "items": { + "type": "string" + } + }, + "top_logprobs": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "number" + } + } + } + } + }, + "text": { + "type": "string" + } + } + } + }, + "created": { + "type": "integer", + "description": "The Unix timestamp (in seconds) of when the completion was created." + }, + "model": { + "type": "string", + "description": "The model used for completion." + }, + "system_fingerprint": { + "type": "string", + "description": "This fingerprint represents the backend configuration that the model runs with.\n\nCan be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.\n" + }, + "object": { + "type": "string", + "description": "The object type, which is always \"text_completion\"", + "enum": ["text_completion"] + }, + "usage": { + "$ref": "#/components/schemas/CompletionUsage" + } + }, + "required": ["id", "object", "created", "model", "choices"], + "x-oaiMeta": { + "name": "The completion object", + "legacy": true, + "example": "{\n \"id\": \"cmpl-uqkvlQyYK7bGYrRHQ0eXlWi7\",\n \"object\": \"text_completion\",\n \"created\": 1589478378,\n \"model\": \"gpt-4-turbo\",\n \"choices\": [\n {\n \"text\": \"\\n\\nThis is indeed a test\",\n \"index\": 0,\n \"logprobs\": null,\n \"finish_reason\": \"length\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 5,\n \"completion_tokens\": 7,\n \"total_tokens\": 12\n }\n}\n" + } + }, + "ChatCompletionRequestMessageContentPartText": { + "type": "object", + "title": "Text content part", + "properties": { + "type": { + "type": "string", + "enum": ["text"], + "description": "The type of the content part." + }, + "text": { + "type": "string", + "description": "The text content." + } + }, + "required": ["type", "text"] + }, + "ChatCompletionRequestMessageContentPartImage": { + "type": "object", + "title": "Image content part", + "properties": { + "type": { + "type": "string", + "enum": ["image_url"], + "description": "The type of the content part." + }, + "image_url": { + "type": "object", + "properties": { + "url": { + "type": "string", + "description": "Either a URL of the image or the base64 encoded image data.", + "format": "uri" + }, + "detail": { + "type": "string", + "description": "Specifies the detail level of the image. Learn more in the [Vision guide](/docs/guides/vision/low-or-high-fidelity-image-understanding).", + "enum": ["auto", "low", "high"], + "default": "auto" + } + }, + "required": ["url"] + } + }, + "required": ["type", "image_url"] + }, + "ChatCompletionRequestMessageContentPartRefusal": { + "type": "object", + "title": "Refusal content part", + "properties": { + "type": { + "type": "string", + "enum": ["refusal"], + "description": "The type of the content part." + }, + "refusal": { + "type": "string", + "description": "The refusal message generated by the model." + } + }, + "required": ["type", "refusal"] + }, + "ChatCompletionRequestMessage": { + "oneOf": [ + { + "$ref": "#/components/schemas/ChatCompletionRequestSystemMessage" + }, + { + "$ref": "#/components/schemas/ChatCompletionRequestUserMessage" + }, + { + "$ref": "#/components/schemas/ChatCompletionRequestAssistantMessage" + }, + { + "$ref": "#/components/schemas/ChatCompletionRequestToolMessage" + }, + { + "$ref": "#/components/schemas/ChatCompletionRequestFunctionMessage" + } + ], + "x-oaiExpandable": true + }, + "ChatCompletionRequestSystemMessageContentPart": { + "oneOf": [ + { + "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartText" + } + ], + "x-oaiExpandable": true + }, + "ChatCompletionRequestUserMessageContentPart": { + "oneOf": [ + { + "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartText" + }, + { + "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartImage" + } + ], + "x-oaiExpandable": true + }, + "ChatCompletionRequestAssistantMessageContentPart": { + "oneOf": [ + { + "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartText" + }, + { + "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartRefusal" + } + ], + "x-oaiExpandable": true + }, + "ChatCompletionRequestToolMessageContentPart": { + "oneOf": [ + { + "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartText" + } + ], + "x-oaiExpandable": true + }, + "ChatCompletionRequestSystemMessage": { + "type": "object", + "title": "System message", + "properties": { + "content": { + "description": "The contents of the system message.", + "oneOf": [ + { + "type": "string", + "description": "The contents of the system message.", + "title": "Text content" + }, + { + "type": "array", + "description": "An array of content parts with a defined type. For system messages, only type `text` is supported.", + "title": "Array of content parts", + "items": { + "$ref": "#/components/schemas/ChatCompletionRequestSystemMessageContentPart" + }, + "minItems": 1 + } + ] + }, + "role": { + "type": "string", + "enum": ["system"], + "description": "The role of the messages author, in this case `system`." + }, + "name": { + "type": "string", + "description": "An optional name for the participant. Provides the model information to differentiate between participants of the same role." + } + }, + "required": ["content", "role"] + }, + "ChatCompletionRequestUserMessage": { + "type": "object", + "title": "User message", + "properties": { + "content": { + "description": "The contents of the user message.\n", + "oneOf": [ + { + "type": "string", + "description": "The text contents of the message.", + "title": "Text content" + }, + { + "type": "array", + "description": "An array of content parts with a defined type, each can be of type `text` or `image_url` when passing in images. You can pass multiple images by adding multiple `image_url` content parts. Image input is only supported when using the `gpt-4o` model.", + "title": "Array of content parts", + "items": { + "$ref": "#/components/schemas/ChatCompletionRequestUserMessageContentPart" + }, + "minItems": 1 + } + ], + "x-oaiExpandable": true + }, + "role": { + "type": "string", + "enum": ["user"], + "description": "The role of the messages author, in this case `user`." + }, + "name": { + "type": "string", + "description": "An optional name for the participant. Provides the model information to differentiate between participants of the same role." + } + }, + "required": ["content", "role"] + }, + "ChatCompletionRequestAssistantMessage": { + "type": "object", + "title": "Assistant message", + "properties": { + "content": { + "nullable": true, + "oneOf": [ + { + "type": "string", + "description": "The contents of the assistant message.", + "title": "Text content" + }, + { + "type": "array", + "description": "An array of content parts with a defined type. Can be one or more of type `text`, or exactly one of type `refusal`.", + "title": "Array of content parts", + "items": { + "$ref": "#/components/schemas/ChatCompletionRequestAssistantMessageContentPart" + }, + "minItems": 1 + } + ], + "description": "The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified.\n" + }, + "refusal": { + "nullable": true, + "type": "string", + "description": "The refusal message by the assistant." + }, + "role": { + "type": "string", + "enum": ["assistant"], + "description": "The role of the messages author, in this case `assistant`." + }, + "name": { + "type": "string", + "description": "An optional name for the participant. Provides the model information to differentiate between participants of the same role." + }, + "tool_calls": { + "$ref": "#/components/schemas/ChatCompletionMessageToolCalls" + }, + "function_call": { + "type": "object", + "deprecated": true, + "description": "Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.", + "nullable": true, + "properties": { + "arguments": { + "type": "string", + "description": "The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function." + }, + "name": { + "type": "string", + "description": "The name of the function to call." + } + }, + "required": ["arguments", "name"] + } + }, + "required": ["role"] + }, + "FineTuneChatCompletionRequestAssistantMessage": { + "allOf": [ + { + "type": "object", + "title": "Assistant message", + "deprecated": false, + "properties": { + "weight": { + "type": "integer", + "enum": [0, 1], + "description": "Controls whether the assistant message is trained against (0 or 1)" + } + } + }, + { + "$ref": "#/components/schemas/ChatCompletionRequestAssistantMessage" + } + ], + "required": ["role"] + }, + "ChatCompletionRequestToolMessage": { + "type": "object", + "title": "Tool message", + "properties": { + "role": { + "type": "string", + "enum": ["tool"], + "description": "The role of the messages author, in this case `tool`." + }, + "content": { + "oneOf": [ + { + "type": "string", + "description": "The contents of the tool message.", + "title": "Text content" + }, + { + "type": "array", + "description": "An array of content parts with a defined type. For tool messages, only type `text` is supported.", + "title": "Array of content parts", + "items": { + "$ref": "#/components/schemas/ChatCompletionRequestToolMessageContentPart" + }, + "minItems": 1 + } + ], + "description": "The contents of the tool message." + }, + "tool_call_id": { + "type": "string", + "description": "Tool call that this message is responding to." + } + }, + "required": ["role", "content", "tool_call_id"] + }, + "ChatCompletionRequestFunctionMessage": { + "type": "object", + "title": "Function message", + "deprecated": true, + "properties": { + "role": { + "type": "string", + "enum": ["function"], + "description": "The role of the messages author, in this case `function`." + }, + "content": { + "nullable": true, + "type": "string", + "description": "The contents of the function message." + }, + "name": { + "type": "string", + "description": "The name of the function to call." + } + }, + "required": ["role", "content", "name"] + }, + "FunctionParameters": { + "type": "object", + "description": "The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. \n\nOmitting `parameters` defines a function with an empty parameter list.", + "additionalProperties": true + }, + "ChatCompletionFunctions": { + "type": "object", + "deprecated": true, + "properties": { + "description": { + "type": "string", + "description": "A description of what the function does, used by the model to choose when and how to call the function." + }, + "name": { + "type": "string", + "description": "The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64." + }, + "parameters": { + "$ref": "#/components/schemas/FunctionParameters" + } + }, + "required": ["name"] + }, + "ChatCompletionFunctionCallOption": { + "type": "object", + "description": "Specifying a particular function via `{\"name\": \"my_function\"}` forces the model to call that function.\n", + "properties": { + "name": { + "type": "string", + "description": "The name of the function to call." + } + }, + "required": ["name"] + }, + "ChatCompletionTool": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["function"], + "description": "The type of the tool. Currently, only `function` is supported." + }, + "function": { + "$ref": "#/components/schemas/FunctionObject" + } + }, + "required": ["type", "function"] + }, + "FunctionObject": { + "type": "object", + "properties": { + "description": { + "type": "string", + "description": "A description of what the function does, used by the model to choose when and how to call the function." + }, + "name": { + "type": "string", + "description": "The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64." + }, + "parameters": { + "$ref": "#/components/schemas/FunctionParameters" + }, + "strict": { + "type": "boolean", + "nullable": true, + "default": false, + "description": "Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](docs/guides/function-calling)." + } + }, + "required": ["name"] + }, + "ResponseFormatText": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The type of response format being defined: `text`", + "enum": ["text"] + } + }, + "required": ["type"] + }, + "ResponseFormatJsonObject": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The type of response format being defined: `json_object`", + "enum": ["json_object"] + } + }, + "required": ["type"] + }, + "ResponseFormatJsonSchemaSchema": { + "type": "object", + "description": "The schema for the response format, described as a JSON Schema object.", + "additionalProperties": true + }, + "ResponseFormatJsonSchema": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The type of response format being defined: `json_schema`", + "enum": ["json_schema"] + }, + "json_schema": { + "type": "object", + "properties": { + "description": { + "type": "string", + "description": "A description of what the response format is for, used by the model to determine how to respond in the format." + }, + "name": { + "type": "string", + "description": "The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64." + }, + "schema": { + "$ref": "#/components/schemas/ResponseFormatJsonSchemaSchema" + }, + "strict": { + "type": "boolean", + "nullable": true, + "default": false, + "description": "Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the `schema` field. Only a subset of JSON Schema is supported when `strict` is `true`. To learn more, read the [Structured Outputs guide](/docs/guides/structured-outputs)." + } + }, + "required": ["type", "name"] + } + }, + "required": ["type", "json_schema"] + }, + "ChatCompletionToolChoiceOption": { + "description": "Controls which (if any) tool is called by the model.\n`none` means the model will not call any tool and instead generates a message.\n`auto` means the model can pick between generating a message or calling one or more tools.\n`required` means the model must call one or more tools.\nSpecifying a particular tool via `{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}` forces the model to call that tool.\n\n`none` is the default when no tools are present. `auto` is the default if tools are present.\n", + "oneOf": [ + { + "type": "string", + "description": "`none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools.\n", + "enum": ["none", "auto", "required"] + }, + { + "$ref": "#/components/schemas/ChatCompletionNamedToolChoice" + } + ], + "x-oaiExpandable": true + }, + "ChatCompletionNamedToolChoice": { + "type": "object", + "description": "Specifies a tool the model should use. Use to force the model to call a specific function.", + "properties": { + "type": { + "type": "string", + "enum": ["function"], + "description": "The type of the tool. Currently, only `function` is supported." + }, + "function": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the function to call." + } + }, + "required": ["name"] + } + }, + "required": ["type", "function"] + }, + "ParallelToolCalls": { + "description": "Whether to enable [parallel function calling](/docs/guides/function-calling/parallel-function-calling) during tool use.", + "type": "boolean", + "default": true + }, + "ChatCompletionMessageToolCalls": { + "type": "array", + "description": "The tool calls generated by the model, such as function calls.", + "items": { + "$ref": "#/components/schemas/ChatCompletionMessageToolCall" + } + }, + "ChatCompletionMessageToolCall": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The ID of the tool call." + }, + "type": { + "type": "string", + "enum": ["function"], + "description": "The type of the tool. Currently, only `function` is supported." + }, + "function": { + "type": "object", + "description": "The function that the model called.", + "properties": { + "name": { + "type": "string", + "description": "The name of the function to call." + }, + "arguments": { + "type": "string", + "description": "The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function." + } + }, + "required": ["name", "arguments"] + } + }, + "required": ["id", "type", "function"] + }, + "ChatCompletionMessageToolCallChunk": { + "type": "object", + "properties": { + "index": { + "type": "integer" + }, + "id": { + "type": "string", + "description": "The ID of the tool call." + }, + "type": { + "type": "string", + "enum": ["function"], + "description": "The type of the tool. Currently, only `function` is supported." + }, + "function": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the function to call." + }, + "arguments": { + "type": "string", + "description": "The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function." + } + } + } + }, + "required": ["index"] + }, + "ChatCompletionRole": { + "type": "string", + "description": "The role of the author of a message", + "enum": ["system", "user", "assistant", "tool", "function"] + }, + "ChatCompletionStreamOptions": { + "description": "Options for streaming response. Only set this when you set `stream: true`.\n", + "type": "object", + "nullable": true, + "default": null, + "properties": { + "include_usage": { + "type": "boolean", + "description": "If set, an additional chunk will be streamed before the `data: [DONE]` message. The `usage` field on this chunk shows the token usage statistics for the entire request, and the `choices` field will always be an empty array. All other chunks will also include a `usage` field, but with a null value.\n" + } + } + }, + "ChatCompletionResponseMessage": { + "type": "object", + "description": "A chat completion message generated by the model.", + "properties": { + "content": { + "type": "string", + "description": "The contents of the message.", + "nullable": true + }, + "refusal": { + "type": "string", + "description": "The refusal message generated by the model.", + "nullable": true + }, + "tool_calls": { + "$ref": "#/components/schemas/ChatCompletionMessageToolCalls" + }, + "role": { + "type": "string", + "enum": ["assistant"], + "description": "The role of the author of this message." + }, + "function_call": { + "type": "object", + "deprecated": true, + "description": "Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.", + "properties": { + "arguments": { + "type": "string", + "description": "The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function." + }, + "name": { + "type": "string", + "description": "The name of the function to call." + } + }, + "required": ["name", "arguments"] + } + }, + "required": ["role", "content", "refusal"] + }, + "ChatCompletionStreamResponseDelta": { + "type": "object", + "description": "A chat completion delta generated by streamed model responses.", + "properties": { + "content": { + "type": "string", + "description": "The contents of the chunk message.", + "nullable": true + }, + "function_call": { + "deprecated": true, + "type": "object", + "description": "Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.", + "properties": { + "arguments": { + "type": "string", + "description": "The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function." + }, + "name": { + "type": "string", + "description": "The name of the function to call." + } + } + }, + "tool_calls": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ChatCompletionMessageToolCallChunk" + } + }, + "role": { + "type": "string", + "enum": ["system", "user", "assistant", "tool"], + "description": "The role of the author of this message." + }, + "refusal": { + "type": "string", + "description": "The refusal message generated by the model.", + "nullable": true + } + } + }, + "CreateChatCompletionRequest": { + "type": "object", + "properties": { + "messages": { + "description": "A list of messages comprising the conversation so far. [Example Python code](https://cookbook.openai.com/examples/how_to_format_inputs_to_chatgpt_models).", + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/components/schemas/ChatCompletionRequestMessage" + } + }, + "model": { + "description": "ID of the model to use. See the [model endpoint compatibility](/docs/models/model-endpoint-compatibility) table for details on which models work with the Chat API.", + "example": "gpt-4o", + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "o1-preview", + "o1-preview-2024-09-12", + "o1-mini", + "o1-mini-2024-09-12", + "gpt-4o", + "gpt-4o-2024-08-06", + "gpt-4o-2024-05-13", + "gpt-4o-2024-08-06", + "chatgpt-4o-latest", + "gpt-4o-mini", + "gpt-4o-mini-2024-07-18", + "gpt-4-turbo", + "gpt-4-turbo-2024-04-09", + "gpt-4-0125-preview", + "gpt-4-turbo-preview", + "gpt-4-1106-preview", + "gpt-4-vision-preview", + "gpt-4", + "gpt-4-0314", + "gpt-4-0613", + "gpt-4-32k", + "gpt-4-32k-0314", + "gpt-4-32k-0613", + "gpt-3.5-turbo", + "gpt-3.5-turbo-16k", + "gpt-3.5-turbo-0301", + "gpt-3.5-turbo-0613", + "gpt-3.5-turbo-1106", + "gpt-3.5-turbo-0125", + "gpt-3.5-turbo-16k-0613" + ] + } + ], + "x-oaiTypeLabel": "string" + }, + "frequency_penalty": { + "type": "number", + "default": 0, + "minimum": -2, + "maximum": 2, + "nullable": true, + "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.\n\n[See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details)\n" + }, + "logit_bias": { + "type": "object", + "x-oaiTypeLabel": "map", + "default": null, + "nullable": true, + "additionalProperties": { + "type": "integer" + }, + "description": "Modify the likelihood of specified tokens appearing in the completion.\n\nAccepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token.\n" + }, + "logprobs": { + "description": "Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the `content` of `message`.", + "type": "boolean", + "default": false, + "nullable": true + }, + "top_logprobs": { + "description": "An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. `logprobs` must be set to `true` if this parameter is used.", + "type": "integer", + "minimum": 0, + "maximum": 20, + "nullable": true + }, + "max_tokens": { + "description": "The maximum number of [tokens](/tokenizer) that can be generated in the chat completion. This value can be used to control [costs](https://openai.com/api/pricing/) for text generated via API.\n\nThis value is now deprecated in favor of `max_completion_tokens`, and is not compatible with [o1 series models](/docs/guides/reasoning).\n", + "type": "integer", + "nullable": true, + "deprecated": true + }, + "max_completion_tokens": { + "description": "An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and [reasoning tokens](/docs/guides/reasoning).\n", + "type": "integer", + "nullable": true + }, + "n": { + "type": "integer", + "minimum": 1, + "maximum": 128, + "default": 1, + "example": 1, + "nullable": true, + "description": "How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs." + }, + "presence_penalty": { + "type": "number", + "default": 0, + "minimum": -2, + "maximum": 2, + "nullable": true, + "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.\n\n[See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details)\n" + }, + "response_format": { + "description": "An object specifying the format that the model must output. Compatible with [GPT-4o](/docs/models/gpt-4o), [GPT-4o mini](/docs/models/gpt-4o-mini), [GPT-4 Turbo](/docs/models/gpt-4-and-gpt-4-turbo) and all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`.\n\nSetting to `{ \"type\": \"json_schema\", \"json_schema\": {...} }` enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the [Structured Outputs guide](/docs/guides/structured-outputs).\n\nSetting to `{ \"type\": \"json_object\" }` enables JSON mode, which ensures the message the model generates is valid JSON.\n\n**Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly \"stuck\" request. Also note that the message content may be partially cut off if `finish_reason=\"length\"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length.\n", + "oneOf": [ + { + "$ref": "#/components/schemas/ResponseFormatText" + }, + { + "$ref": "#/components/schemas/ResponseFormatJsonObject" + }, + { + "$ref": "#/components/schemas/ResponseFormatJsonSchema" + } + ], + "x-oaiExpandable": true + }, + "seed": { + "type": "integer", + "minimum": -9223372036854776000, + "maximum": 9223372036854776000, + "nullable": true, + "description": "This feature is in Beta.\nIf specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result.\nDeterminism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend.\n", + "x-oaiMeta": { + "beta": true + } + }, + "service_tier": { + "description": "Specifies the latency tier to use for processing the request. This parameter is relevant for customers subscribed to the scale tier service:\n - If set to 'auto', and the Project is Scale tier enabled, the system will utilize scale tier credits until they are exhausted.\n - If set to 'auto', and the Project is not Scale tier enabled, the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee.\n - If set to 'default', the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee.\n - When not set, the default behavior is 'auto'.\n\n When this parameter is set, the response body will include the `service_tier` utilized.\n", + "type": "string", + "enum": ["auto", "default"], + "nullable": true, + "default": null + }, + "stop": { + "description": "Up to 4 sequences where the API will stop generating further tokens.\n", + "default": null, + "oneOf": [ + { + "type": "string", + "nullable": true + }, + { + "type": "array", + "minItems": 1, + "maxItems": 4, + "items": { + "type": "string" + } + } + ] + }, + "stream": { + "description": "If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions).\n", + "type": "boolean", + "nullable": true, + "default": false + }, + "stream_options": { + "$ref": "#/components/schemas/ChatCompletionStreamOptions" + }, + "temperature": { + "type": "number", + "minimum": 0, + "maximum": 2, + "default": 1, + "example": 1, + "nullable": true, + "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n\nWe generally recommend altering this or `top_p` but not both.\n" + }, + "top_p": { + "type": "number", + "minimum": 0, + "maximum": 1, + "default": 1, + "example": 1, + "nullable": true, + "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or `temperature` but not both.\n" + }, + "tools": { + "type": "array", + "description": "A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.\n", + "items": { + "$ref": "#/components/schemas/ChatCompletionTool" + } + }, + "tool_choice": { + "$ref": "#/components/schemas/ChatCompletionToolChoiceOption" + }, + "parallel_tool_calls": { + "$ref": "#/components/schemas/ParallelToolCalls" + }, + "user": { + "type": "string", + "example": "user-1234", + "description": "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).\n" + }, + "function_call": { + "deprecated": true, + "description": "Deprecated in favor of `tool_choice`.\n\nControls which (if any) function is called by the model.\n`none` means the model will not call a function and instead generates a message.\n`auto` means the model can pick between generating a message or calling a function.\nSpecifying a particular function via `{\"name\": \"my_function\"}` forces the model to call that function.\n\n`none` is the default when no functions are present. `auto` is the default if functions are present.\n", + "oneOf": [ + { + "type": "string", + "description": "`none` means the model will not call a function and instead generates a message. `auto` means the model can pick between generating a message or calling a function.\n", + "enum": ["none", "auto"] + }, + { + "$ref": "#/components/schemas/ChatCompletionFunctionCallOption" + } + ], + "x-oaiExpandable": true + }, + "functions": { + "deprecated": true, + "description": "Deprecated in favor of `tools`.\n\nA list of functions the model may generate JSON inputs for.\n", + "type": "array", + "minItems": 1, + "maxItems": 128, + "items": { + "$ref": "#/components/schemas/ChatCompletionFunctions" + } + } + }, + "required": ["model", "messages"] + }, + "CreateChatCompletionResponse": { + "type": "object", + "description": "Represents a chat completion response returned by model, based on the provided input.", + "properties": { + "id": { + "type": "string", + "description": "A unique identifier for the chat completion." + }, + "choices": { + "type": "array", + "description": "A list of chat completion choices. Can be more than one if `n` is greater than 1.", + "items": { + "type": "object", + "required": ["finish_reason", "index", "message", "logprobs"], + "properties": { + "finish_reason": { + "type": "string", + "description": "The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,\n`length` if the maximum number of tokens specified in the request was reached,\n`content_filter` if content was omitted due to a flag from our content filters,\n`tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.\n", + "enum": [ + "stop", + "length", + "tool_calls", + "content_filter", + "function_call" + ] + }, + "index": { + "type": "integer", + "description": "The index of the choice in the list of choices." + }, + "message": { + "$ref": "#/components/schemas/ChatCompletionResponseMessage" + }, + "logprobs": { + "description": "Log probability information for the choice.", + "type": "object", + "nullable": true, + "properties": { + "content": { + "description": "A list of message content tokens with log probability information.", + "type": "array", + "items": { + "$ref": "#/components/schemas/ChatCompletionTokenLogprob" + }, + "nullable": true + }, + "refusal": { + "description": "A list of message refusal tokens with log probability information.", + "type": "array", + "items": { + "$ref": "#/components/schemas/ChatCompletionTokenLogprob" + }, + "nullable": true + } + }, + "required": ["content", "refusal"] + } + } + } + }, + "created": { + "type": "integer", + "description": "The Unix timestamp (in seconds) of when the chat completion was created." + }, + "model": { + "type": "string", + "description": "The model used for the chat completion." + }, + "service_tier": { + "description": "The service tier used for processing the request. This field is only included if the `service_tier` parameter is specified in the request.", + "type": "string", + "enum": ["scale", "default"], + "example": "scale", + "nullable": true + }, + "system_fingerprint": { + "type": "string", + "description": "This fingerprint represents the backend configuration that the model runs with.\n\nCan be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.\n" + }, + "object": { + "type": "string", + "description": "The object type, which is always `chat.completion`.", + "enum": ["chat.completion"] + }, + "usage": { + "$ref": "#/components/schemas/CompletionUsage" + } + }, + "required": ["choices", "created", "id", "model", "object"], + "x-oaiMeta": { + "name": "The chat completion object", + "group": "chat", + "example": "{\n \"id\": \"chatcmpl-123\",\n \"object\": \"chat.completion\",\n \"created\": 1677652288,\n \"model\": \"gpt-4o-mini\",\n \"system_fingerprint\": \"fp_44709d6fcb\",\n \"choices\": [{\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": \"\\n\\nHello there, how may I assist you today?\",\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }],\n \"usage\": {\n \"prompt_tokens\": 9,\n \"completion_tokens\": 12,\n \"total_tokens\": 21,\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0\n }\n }\n}\n" + } + }, + "CreateChatCompletionFunctionResponse": { + "type": "object", + "description": "Represents a chat completion response returned by model, based on the provided input.", + "properties": { + "id": { + "type": "string", + "description": "A unique identifier for the chat completion." + }, + "choices": { + "type": "array", + "description": "A list of chat completion choices. Can be more than one if `n` is greater than 1.", + "items": { + "type": "object", + "required": ["finish_reason", "index", "message", "logprobs"], + "properties": { + "finish_reason": { + "type": "string", + "description": "The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, `length` if the maximum number of tokens specified in the request was reached, `content_filter` if content was omitted due to a flag from our content filters, or `function_call` if the model called a function.\n", + "enum": ["stop", "length", "function_call", "content_filter"] + }, + "index": { + "type": "integer", + "description": "The index of the choice in the list of choices." + }, + "message": { + "$ref": "#/components/schemas/ChatCompletionResponseMessage" + } + } + } + }, + "created": { + "type": "integer", + "description": "The Unix timestamp (in seconds) of when the chat completion was created." + }, + "model": { + "type": "string", + "description": "The model used for the chat completion." + }, + "system_fingerprint": { + "type": "string", + "description": "This fingerprint represents the backend configuration that the model runs with.\n\nCan be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.\n" + }, + "object": { + "type": "string", + "description": "The object type, which is always `chat.completion`.", + "enum": ["chat.completion"] + }, + "usage": { + "$ref": "#/components/schemas/CompletionUsage" + } + }, + "required": ["choices", "created", "id", "model", "object"], + "x-oaiMeta": { + "name": "The chat completion object", + "group": "chat", + "example": "{\n \"id\": \"chatcmpl-abc123\",\n \"object\": \"chat.completion\",\n \"created\": 1699896916,\n \"model\": \"gpt-4o-mini\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_abc123\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"arguments\": \"{\\n\\\"location\\\": \\\"Boston, MA\\\"\\n}\"\n }\n }\n ]\n },\n \"logprobs\": null,\n \"finish_reason\": \"tool_calls\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 82,\n \"completion_tokens\": 17,\n \"total_tokens\": 99,\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0\n }\n }\n}\n" + } + }, + "ChatCompletionTokenLogprob": { + "type": "object", + "properties": { + "token": { + "description": "The token.", + "type": "string" + }, + "logprob": { + "description": "The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.", + "type": "number" + }, + "bytes": { + "description": "A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.", + "type": "array", + "items": { + "type": "integer" + }, + "nullable": true + }, + "top_logprobs": { + "description": "List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested `top_logprobs` returned.", + "type": "array", + "items": { + "type": "object", + "properties": { + "token": { + "description": "The token.", + "type": "string" + }, + "logprob": { + "description": "The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.", + "type": "number" + }, + "bytes": { + "description": "A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.", + "type": "array", + "items": { + "type": "integer" + }, + "nullable": true + } + }, + "required": ["token", "logprob", "bytes"] + } + } + }, + "required": ["token", "logprob", "bytes", "top_logprobs"] + }, + "ListPaginatedFineTuningJobsResponse": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FineTuningJob" + } + }, + "has_more": { + "type": "boolean" + }, + "object": { + "type": "string", + "enum": ["list"] + } + }, + "required": ["object", "data", "has_more"] + }, + "CreateChatCompletionStreamResponse": { + "type": "object", + "description": "Represents a streamed chunk of a chat completion response returned by model, based on the provided input.", + "properties": { + "id": { + "type": "string", + "description": "A unique identifier for the chat completion. Each chunk has the same ID." + }, + "choices": { + "type": "array", + "description": "A list of chat completion choices. Can contain more than one elements if `n` is greater than 1. Can also be empty for the\nlast chunk if you set `stream_options: {\"include_usage\": true}`.\n", + "items": { + "type": "object", + "required": ["delta", "finish_reason", "index"], + "properties": { + "delta": { + "$ref": "#/components/schemas/ChatCompletionStreamResponseDelta" + }, + "logprobs": { + "description": "Log probability information for the choice.", + "type": "object", + "nullable": true, + "properties": { + "content": { + "description": "A list of message content tokens with log probability information.", + "type": "array", + "items": { + "$ref": "#/components/schemas/ChatCompletionTokenLogprob" + }, + "nullable": true + }, + "refusal": { + "description": "A list of message refusal tokens with log probability information.", + "type": "array", + "items": { + "$ref": "#/components/schemas/ChatCompletionTokenLogprob" + }, + "nullable": true + } + }, + "required": ["content", "refusal"] + }, + "finish_reason": { + "type": "string", + "description": "The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,\n`length` if the maximum number of tokens specified in the request was reached,\n`content_filter` if content was omitted due to a flag from our content filters,\n`tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.\n", + "enum": [ + "stop", + "length", + "tool_calls", + "content_filter", + "function_call" + ], + "nullable": true + }, + "index": { + "type": "integer", + "description": "The index of the choice in the list of choices." + } + } + } + }, + "created": { + "type": "integer", + "description": "The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has the same timestamp." + }, + "model": { + "type": "string", + "description": "The model to generate the completion." + }, + "service_tier": { + "description": "The service tier used for processing the request. This field is only included if the `service_tier` parameter is specified in the request.", + "type": "string", + "enum": ["scale", "default"], + "example": "scale", + "nullable": true + }, + "system_fingerprint": { + "type": "string", + "description": "This fingerprint represents the backend configuration that the model runs with.\nCan be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.\n" + }, + "object": { + "type": "string", + "description": "The object type, which is always `chat.completion.chunk`.", + "enum": ["chat.completion.chunk"] + }, + "usage": { + "type": "object", + "description": "An optional field that will only be present when you set `stream_options: {\"include_usage\": true}` in your request.\nWhen present, it contains a null value except for the last chunk which contains the token usage statistics for the entire request.\n", + "properties": { + "completion_tokens": { + "type": "integer", + "description": "Number of tokens in the generated completion." + }, + "prompt_tokens": { + "type": "integer", + "description": "Number of tokens in the prompt." + }, + "total_tokens": { + "type": "integer", + "description": "Total number of tokens used in the request (prompt + completion)." + } + }, + "required": ["prompt_tokens", "completion_tokens", "total_tokens"] + } + }, + "required": ["choices", "created", "id", "model", "object"], + "x-oaiMeta": { + "name": "The chat completion chunk object", + "group": "chat", + "example": "{\"id\":\"chatcmpl-123\",\"object\":\"chat.completion.chunk\",\"created\":1694268190,\"model\":\"gpt-4o-mini\", \"system_fingerprint\": \"fp_44709d6fcb\", \"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":\"\"},\"logprobs\":null,\"finish_reason\":null}]}\n\n{\"id\":\"chatcmpl-123\",\"object\":\"chat.completion.chunk\",\"created\":1694268190,\"model\":\"gpt-4o-mini\", \"system_fingerprint\": \"fp_44709d6fcb\", \"choices\":[{\"index\":0,\"delta\":{\"content\":\"Hello\"},\"logprobs\":null,\"finish_reason\":null}]}\n\n....\n\n{\"id\":\"chatcmpl-123\",\"object\":\"chat.completion.chunk\",\"created\":1694268190,\"model\":\"gpt-4o-mini\", \"system_fingerprint\": \"fp_44709d6fcb\", \"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n" + } + }, + "CreateChatCompletionImageResponse": { + "type": "object", + "description": "Represents a streamed chunk of a chat completion response returned by model, based on the provided input.", + "x-oaiMeta": { + "name": "The chat completion chunk object", + "group": "chat", + "example": "{\n \"id\": \"chatcmpl-123\",\n \"object\": \"chat.completion\",\n \"created\": 1677652288,\n \"model\": \"gpt-4o-mini\",\n \"system_fingerprint\": \"fp_44709d6fcb\",\n \"choices\": [{\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": \"\\n\\nThis image shows a wooden boardwalk extending through a lush green marshland.\",\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }],\n \"usage\": {\n \"prompt_tokens\": 9,\n \"completion_tokens\": 12,\n \"total_tokens\": 21,\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0\n }\n }\n}\n" + } + }, + "CreateImageRequest": { + "type": "object", + "properties": { + "prompt": { + "description": "A text description of the desired image(s). The maximum length is 1000 characters for `dall-e-2` and 4000 characters for `dall-e-3`.", + "type": "string", + "example": "A cute baby sea otter" + }, + "model": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": ["dall-e-2", "dall-e-3"] + } + ], + "x-oaiTypeLabel": "string", + "default": "dall-e-2", + "example": "dall-e-3", + "nullable": true, + "description": "The model to use for image generation." + }, + "n": { + "type": "integer", + "minimum": 1, + "maximum": 10, + "default": 1, + "example": 1, + "nullable": true, + "description": "The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only `n=1` is supported." + }, + "quality": { + "type": "string", + "enum": ["standard", "hd"], + "default": "standard", + "example": "standard", + "description": "The quality of the image that will be generated. `hd` creates images with finer details and greater consistency across the image. This param is only supported for `dall-e-3`." + }, + "response_format": { + "type": "string", + "enum": ["url", "b64_json"], + "default": "url", + "example": "url", + "nullable": true, + "description": "The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated." + }, + "size": { + "type": "string", + "enum": [ + "256x256", + "512x512", + "1024x1024", + "1792x1024", + "1024x1792" + ], + "default": "1024x1024", + "example": "1024x1024", + "nullable": true, + "description": "The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`. Must be one of `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3` models." + }, + "style": { + "type": "string", + "enum": ["vivid", "natural"], + "default": "vivid", + "example": "vivid", + "nullable": true, + "description": "The style of the generated images. Must be one of `vivid` or `natural`. Vivid causes the model to lean towards generating hyper-real and dramatic images. Natural causes the model to produce more natural, less hyper-real looking images. This param is only supported for `dall-e-3`." + }, + "user": { + "type": "string", + "example": "user-1234", + "description": "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).\n" + } + }, + "required": ["prompt"] + }, + "ImagesResponse": { + "properties": { + "created": { + "type": "integer" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Image" + } + } + }, + "required": ["created", "data"] + }, + "Image": { + "type": "object", + "description": "Represents the url or the content of an image generated by the OpenAI API.", + "properties": { + "b64_json": { + "type": "string", + "description": "The base64-encoded JSON of the generated image, if `response_format` is `b64_json`." + }, + "url": { + "type": "string", + "description": "The URL of the generated image, if `response_format` is `url` (default)." + }, + "revised_prompt": { + "type": "string", + "description": "The prompt that was used to generate the image, if there was any revision to the prompt." + } + }, + "x-oaiMeta": { + "name": "The image object", + "example": "{\n \"url\": \"...\",\n \"revised_prompt\": \"...\"\n}\n" + } + }, + "CreateImageEditRequest": { + "type": "object", + "properties": { + "image": { + "description": "The image to edit. Must be a valid PNG file, less than 4MB, and square. If mask is not provided, image must have transparency, which will be used as the mask.", + "type": "string", + "format": "binary" + }, + "prompt": { + "description": "A text description of the desired image(s). The maximum length is 1000 characters.", + "type": "string", + "example": "A cute baby sea otter wearing a beret" + }, + "mask": { + "description": "An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`.", + "type": "string", + "format": "binary" + }, + "model": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": ["dall-e-2"] + } + ], + "x-oaiTypeLabel": "string", + "default": "dall-e-2", + "example": "dall-e-2", + "nullable": true, + "description": "The model to use for image generation. Only `dall-e-2` is supported at this time." + }, + "n": { + "type": "integer", + "minimum": 1, + "maximum": 10, + "default": 1, + "example": 1, + "nullable": true, + "description": "The number of images to generate. Must be between 1 and 10." + }, + "size": { + "type": "string", + "enum": ["256x256", "512x512", "1024x1024"], + "default": "1024x1024", + "example": "1024x1024", + "nullable": true, + "description": "The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`." + }, + "response_format": { + "type": "string", + "enum": ["url", "b64_json"], + "default": "url", + "example": "url", + "nullable": true, + "description": "The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated." + }, + "user": { + "type": "string", + "example": "user-1234", + "description": "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).\n" + } + }, + "required": ["prompt", "image"] + }, + "CreateImageVariationRequest": { + "type": "object", + "properties": { + "image": { + "description": "The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square.", + "type": "string", + "format": "binary" + }, + "model": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": ["dall-e-2"] + } + ], + "x-oaiTypeLabel": "string", + "default": "dall-e-2", + "example": "dall-e-2", + "nullable": true, + "description": "The model to use for image generation. Only `dall-e-2` is supported at this time." + }, + "n": { + "type": "integer", + "minimum": 1, + "maximum": 10, + "default": 1, + "example": 1, + "nullable": true, + "description": "The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only `n=1` is supported." + }, + "response_format": { + "type": "string", + "enum": ["url", "b64_json"], + "default": "url", + "example": "url", + "nullable": true, + "description": "The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated." + }, + "size": { + "type": "string", + "enum": ["256x256", "512x512", "1024x1024"], + "default": "1024x1024", + "example": "1024x1024", + "nullable": true, + "description": "The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`." + }, + "user": { + "type": "string", + "example": "user-1234", + "description": "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).\n" + } + }, + "required": ["image"] + }, + "CreateModerationRequest": { + "type": "object", + "properties": { + "input": { + "description": "Input (or inputs) to classify. Can be a single string, an array of strings, or\nan array of multi-modal input objects similar to other models.\n", + "oneOf": [ + { + "type": "string", + "description": "A string of text to classify for moderation.", + "default": "", + "example": "I want to kill them." + }, + { + "type": "array", + "description": "An array of strings to classify for moderation.", + "items": { + "type": "string", + "default": "", + "example": "I want to kill them." + } + }, + { + "type": "array", + "description": "An array of multi-modal inputs to the moderation model.", + "items": { + "x-oaiExpandable": true, + "oneOf": [ + { + "type": "object", + "description": "An object describing an image to classify.", + "properties": { + "type": { + "description": "Always `image_url`.", + "type": "string", + "enum": ["image_url"] + }, + "image_url": { + "type": "object", + "description": "Contains either an image URL or a data URL for a base64 encoded image.", + "properties": { + "url": { + "type": "string", + "description": "Either a URL of the image or the base64 encoded image data.", + "format": "uri", + "example": "https://example.com/image.jpg" + } + }, + "required": ["url"] + } + }, + "required": ["type", "image_url"] + }, + { + "type": "object", + "description": "An object describing text to classify.", + "properties": { + "type": { + "description": "Always `text`.", + "type": "string", + "enum": ["text"] + }, + "text": { + "description": "A string of text to classify.", + "type": "string", + "example": "I want to kill them" + } + }, + "required": ["type", "text"] + } + ] + } + } + ], + "x-oaiExpandable": true + }, + "model": { + "description": "The content moderation model you would like to use. Learn more in\n[the moderation guide](/docs/guides/moderation), and learn about\navailable models [here](/docs/models/moderation).\n", + "nullable": false, + "default": "omni-moderation-latest", + "example": "omni-moderation-2024-09-26", + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "omni-moderation-latest", + "omni-moderation-2024-09-26", + "text-moderation-latest", + "text-moderation-stable" + ] + } + ], + "x-oaiTypeLabel": "string" + } + }, + "required": ["input"] + }, + "CreateModerationResponse": { + "type": "object", + "description": "Represents if a given text input is potentially harmful.", + "properties": { + "id": { + "type": "string", + "description": "The unique identifier for the moderation request." + }, + "model": { + "type": "string", + "description": "The model used to generate the moderation results." + }, + "results": { + "type": "array", + "description": "A list of moderation objects.", + "items": { + "type": "object", + "properties": { + "flagged": { + "type": "boolean", + "description": "Whether any of the below categories are flagged." + }, + "categories": { + "type": "object", + "description": "A list of the categories, and whether they are flagged or not.", + "properties": { + "hate": { + "type": "boolean", + "description": "Content that expresses, incites, or promotes hate based on race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste. Hateful content aimed at non-protected groups (e.g., chess players) is harassment." + }, + "hate/threatening": { + "type": "boolean", + "description": "Hateful content that also includes violence or serious harm towards the targeted group based on race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste." + }, + "harassment": { + "type": "boolean", + "description": "Content that expresses, incites, or promotes harassing language towards any target." + }, + "harassment/threatening": { + "type": "boolean", + "description": "Harassment content that also includes violence or serious harm towards any target." + }, + "illicit": { + "type": "boolean", + "description": "Content that includes instructions or advice that facilitate the planning or execution of wrongdoing, or that gives advice or instruction on how to commit illicit acts. For example, \"how to shoplift\" would fit this category." + }, + "illicit/violent": { + "type": "boolean", + "description": "Content that includes instructions or advice that facilitate the planning or execution of wrongdoing that also includes violence, or that gives advice or instruction on the procurement of any weapon." + }, + "self-harm": { + "type": "boolean", + "description": "Content that promotes, encourages, or depicts acts of self-harm, such as suicide, cutting, and eating disorders." + }, + "self-harm/intent": { + "type": "boolean", + "description": "Content where the speaker expresses that they are engaging or intend to engage in acts of self-harm, such as suicide, cutting, and eating disorders." + }, + "self-harm/instructions": { + "type": "boolean", + "description": "Content that encourages performing acts of self-harm, such as suicide, cutting, and eating disorders, or that gives instructions or advice on how to commit such acts." + }, + "sexual": { + "type": "boolean", + "description": "Content meant to arouse sexual excitement, such as the description of sexual activity, or that promotes sexual services (excluding sex education and wellness)." + }, + "sexual/minors": { + "type": "boolean", + "description": "Sexual content that includes an individual who is under 18 years old." + }, + "violence": { + "type": "boolean", + "description": "Content that depicts death, violence, or physical injury." + }, + "violence/graphic": { + "type": "boolean", + "description": "Content that depicts death, violence, or physical injury in graphic detail." + } + }, + "required": [ + "hate", + "hate/threatening", + "harassment", + "harassment/threatening", + "illicit", + "illicit/violent", + "self-harm", + "self-harm/intent", + "self-harm/instructions", + "sexual", + "sexual/minors", + "violence", + "violence/graphic" + ] + }, + "category_scores": { + "type": "object", + "description": "A list of the categories along with their scores as predicted by model.", + "properties": { + "hate": { + "type": "number", + "description": "The score for the category 'hate'." + }, + "hate/threatening": { + "type": "number", + "description": "The score for the category 'hate/threatening'." + }, + "harassment": { + "type": "number", + "description": "The score for the category 'harassment'." + }, + "harassment/threatening": { + "type": "number", + "description": "The score for the category 'harassment/threatening'." + }, + "illicit": { + "type": "number", + "description": "The score for the category 'illicit'." + }, + "illicit/violent": { + "type": "number", + "description": "The score for the category 'illicit/violent'." + }, + "self-harm": { + "type": "number", + "description": "The score for the category 'self-harm'." + }, + "self-harm/intent": { + "type": "number", + "description": "The score for the category 'self-harm/intent'." + }, + "self-harm/instructions": { + "type": "number", + "description": "The score for the category 'self-harm/instructions'." + }, + "sexual": { + "type": "number", + "description": "The score for the category 'sexual'." + }, + "sexual/minors": { + "type": "number", + "description": "The score for the category 'sexual/minors'." + }, + "violence": { + "type": "number", + "description": "The score for the category 'violence'." + }, + "violence/graphic": { + "type": "number", + "description": "The score for the category 'violence/graphic'." + } + }, + "required": [ + "hate", + "hate/threatening", + "harassment", + "harassment/threatening", + "illicit", + "illicit/violent", + "self-harm", + "self-harm/intent", + "self-harm/instructions", + "sexual", + "sexual/minors", + "violence", + "violence/graphic" + ] + }, + "category_applied_input_types": { + "type": "object", + "description": "A list of the categories along with the input type(s) that the score applies to.", + "properties": { + "hate": { + "type": "array", + "description": "The applied input type(s) for the category 'hate'.", + "items": { + "type": "string", + "enum": ["text"] + } + }, + "hate/threatening": { + "type": "array", + "description": "The applied input type(s) for the category 'hate/threatening'.", + "items": { + "type": "string", + "enum": ["text"] + } + }, + "harassment": { + "type": "array", + "description": "The applied input type(s) for the category 'harassment'.", + "items": { + "type": "string", + "enum": ["text"] + } + }, + "harassment/threatening": { + "type": "array", + "description": "The applied input type(s) for the category 'harassment/threatening'.", + "items": { + "type": "string", + "enum": ["text"] + } + }, + "illicit": { + "type": "array", + "description": "The applied input type(s) for the category 'illicit'.", + "items": { + "type": "string", + "enum": ["text"] + } + }, + "illicit/violent": { + "type": "array", + "description": "The applied input type(s) for the category 'illicit/violent'.", + "items": { + "type": "string", + "enum": ["text"] + } + }, + "self-harm": { + "type": "array", + "description": "The applied input type(s) for the category 'self-harm'.", + "items": { + "type": "string", + "enum": ["text", "image"] + } + }, + "self-harm/intent": { + "type": "array", + "description": "The applied input type(s) for the category 'self-harm/intent'.", + "items": { + "type": "string", + "enum": ["text", "image"] + } + }, + "self-harm/instructions": { + "type": "array", + "description": "The applied input type(s) for the category 'self-harm/instructions'.", + "items": { + "type": "string", + "enum": ["text", "image"] + } + }, + "sexual": { + "type": "array", + "description": "The applied input type(s) for the category 'sexual'.", + "items": { + "type": "string", + "enum": ["text", "image"] + } + }, + "sexual/minors": { + "type": "array", + "description": "The applied input type(s) for the category 'sexual/minors'.", + "items": { + "type": "string", + "enum": ["text"] + } + }, + "violence": { + "type": "array", + "description": "The applied input type(s) for the category 'violence'.", + "items": { + "type": "string", + "enum": ["text", "image"] + } + }, + "violence/graphic": { + "type": "array", + "description": "The applied input type(s) for the category 'violence/graphic'.", + "items": { + "type": "string", + "enum": ["text", "image"] + } + } + }, + "required": [ + "hate", + "hate/threatening", + "harassment", + "harassment/threatening", + "illicit", + "illicit/violent", + "self-harm", + "self-harm/intent", + "self-harm/instructions", + "sexual", + "sexual/minors", + "violence", + "violence/graphic" + ] + } + }, + "required": [ + "flagged", + "categories", + "category_scores", + "category_applied_input_types" + ] + } + } + }, + "required": ["id", "model", "results"], + "x-oaiMeta": { + "name": "The moderation object", + "example": "{\n \"id\": \"modr-0d9740456c391e43c445bf0f010940c7\",\n \"model\": \"omni-moderation-latest\",\n \"results\": [\n {\n \"flagged\": true,\n \"categories\": {\n \"harassment\": true,\n \"harassment/threatening\": true,\n \"sexual\": false,\n \"hate\": false,\n \"hate/threatening\": false,\n \"illicit\": false,\n \"illicit/violent\": false,\n \"self-harm/intent\": false,\n \"self-harm/instructions\": false,\n \"self-harm\": false,\n \"sexual/minors\": false,\n \"violence\": true,\n \"violence/graphic\": true\n },\n \"category_scores\": {\n \"harassment\": 0.8189693396524255,\n \"harassment/threatening\": 0.804985420696006,\n \"sexual\": 1.573112165348997e-6,\n \"hate\": 0.007562942636942845,\n \"hate/threatening\": 0.004208854591835476,\n \"illicit\": 0.030535955153511665,\n \"illicit/violent\": 0.008925306722380033,\n \"self-harm/intent\": 0.00023023930975076432,\n \"self-harm/instructions\": 0.0002293869201073356,\n \"self-harm\": 0.012598046106750154,\n \"sexual/minors\": 2.212566909570261e-8,\n \"violence\": 0.9999992735124786,\n \"violence/graphic\": 0.843064871157054\n },\n \"category_applied_input_types\": {\n \"harassment\": [\n \"text\"\n ],\n \"harassment/threatening\": [\n \"text\"\n ],\n \"sexual\": [\n \"text\",\n \"image\"\n ],\n \"hate\": [\n \"text\"\n ],\n \"hate/threatening\": [\n \"text\"\n ],\n \"illicit\": [\n \"text\"\n ],\n \"illicit/violent\": [\n \"text\"\n ],\n \"self-harm/intent\": [\n \"text\",\n \"image\"\n ],\n \"self-harm/instructions\": [\n \"text\",\n \"image\"\n ],\n \"self-harm\": [\n \"text\",\n \"image\"\n ],\n \"sexual/minors\": [\n \"text\"\n ],\n \"violence\": [\n \"text\",\n \"image\"\n ],\n \"violence/graphic\": [\n \"text\",\n \"image\"\n ]\n }\n }\n ]\n}\n" + } + }, + "ListFilesResponse": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/OpenAIFile" + } + }, + "object": { + "type": "string", + "enum": ["list"] + } + }, + "required": ["object", "data"] + }, + "CreateFileRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "file": { + "description": "The File object (not file name) to be uploaded.\n", + "type": "string", + "format": "binary" + }, + "purpose": { + "description": "The intended purpose of the uploaded file.\n\nUse \"assistants\" for [Assistants](/docs/api-reference/assistants) and [Message](/docs/api-reference/messages) files, \"vision\" for Assistants image file inputs, \"batch\" for [Batch API](/docs/guides/batch), and \"fine-tune\" for [Fine-tuning](/docs/api-reference/fine-tuning).\n", + "type": "string", + "enum": ["assistants", "batch", "fine-tune", "vision"] + } + }, + "required": ["file", "purpose"] + }, + "DeleteFileResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "object": { + "type": "string", + "enum": ["file"] + }, + "deleted": { + "type": "boolean" + } + }, + "required": ["id", "object", "deleted"] + }, + "CreateUploadRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "filename": { + "description": "The name of the file to upload.\n", + "type": "string" + }, + "purpose": { + "description": "The intended purpose of the uploaded file.\n\nSee the [documentation on File purposes](/docs/api-reference/files/create#files-create-purpose).\n", + "type": "string", + "enum": ["assistants", "batch", "fine-tune", "vision"] + }, + "bytes": { + "description": "The number of bytes in the file you are uploading.\n", + "type": "integer" + }, + "mime_type": { + "description": "The MIME type of the file.\n\nThis must fall within the supported MIME types for your file purpose. See the supported MIME types for assistants and vision.\n", + "type": "string" + } + }, + "required": ["filename", "purpose", "bytes", "mime_type"] + }, + "AddUploadPartRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "data": { + "description": "The chunk of bytes for this Part.\n", + "type": "string", + "format": "binary" + } + }, + "required": ["data"] + }, + "CompleteUploadRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "part_ids": { + "type": "array", + "description": "The ordered list of Part IDs.\n", + "items": { + "type": "string" + } + }, + "md5": { + "description": "The optional md5 checksum for the file contents to verify if the bytes uploaded matches what you expect.\n", + "type": "string" + } + }, + "required": ["part_ids"] + }, + "CancelUploadRequest": { + "type": "object", + "additionalProperties": false + }, + "CreateFineTuningJobRequest": { + "type": "object", + "properties": { + "model": { + "description": "The name of the model to fine-tune. You can select one of the\n[supported models](/docs/guides/fine-tuning/which-models-can-be-fine-tuned).\n", + "example": "gpt-4o-mini", + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "babbage-002", + "davinci-002", + "gpt-3.5-turbo", + "gpt-4o-mini" + ] + } + ], + "x-oaiTypeLabel": "string" + }, + "training_file": { + "description": "The ID of an uploaded file that contains training data.\n\nSee [upload file](/docs/api-reference/files/create) for how to upload a file.\n\nYour dataset must be formatted as a JSONL file. Additionally, you must upload your file with the purpose `fine-tune`.\n\nThe contents of the file should differ depending on if the model uses the [chat](/docs/api-reference/fine-tuning/chat-input) or [completions](/docs/api-reference/fine-tuning/completions-input) format.\n\nSee the [fine-tuning guide](/docs/guides/fine-tuning) for more details.\n", + "type": "string", + "example": "file-abc123" + }, + "hyperparameters": { + "type": "object", + "description": "The hyperparameters used for the fine-tuning job.", + "properties": { + "batch_size": { + "description": "Number of examples in each batch. A larger batch size means that model parameters\nare updated less frequently, but with lower variance.\n", + "oneOf": [ + { + "type": "string", + "enum": ["auto"] + }, + { + "type": "integer", + "minimum": 1, + "maximum": 256 + } + ], + "default": "auto" + }, + "learning_rate_multiplier": { + "description": "Scaling factor for the learning rate. A smaller learning rate may be useful to avoid\noverfitting.\n", + "oneOf": [ + { + "type": "string", + "enum": ["auto"] + }, + { + "type": "number", + "minimum": 0, + "exclusiveMinimum": true + } + ], + "default": "auto" + }, + "n_epochs": { + "description": "The number of epochs to train the model for. An epoch refers to one full cycle\nthrough the training dataset.\n", + "oneOf": [ + { + "type": "string", + "enum": ["auto"] + }, + { + "type": "integer", + "minimum": 1, + "maximum": 50 + } + ], + "default": "auto" + } + } + }, + "suffix": { + "description": "A string of up to 64 characters that will be added to your fine-tuned model name.\n\nFor example, a `suffix` of \"custom-model-name\" would produce a model name like `ft:gpt-4o-mini:openai:custom-model-name:7p4lURel`.\n", + "type": "string", + "minLength": 1, + "maxLength": 64, + "default": null, + "nullable": true + }, + "validation_file": { + "description": "The ID of an uploaded file that contains validation data.\n\nIf you provide this file, the data is used to generate validation\nmetrics periodically during fine-tuning. These metrics can be viewed in\nthe fine-tuning results file.\nThe same data should not be present in both train and validation files.\n\nYour dataset must be formatted as a JSONL file. You must upload your file with the purpose `fine-tune`.\n\nSee the [fine-tuning guide](/docs/guides/fine-tuning) for more details.\n", + "type": "string", + "nullable": true, + "example": "file-abc123" + }, + "integrations": { + "type": "array", + "description": "A list of integrations to enable for your fine-tuning job.", + "nullable": true, + "items": { + "type": "object", + "required": ["type", "wandb"], + "properties": { + "type": { + "description": "The type of integration to enable. Currently, only \"wandb\" (Weights and Biases) is supported.\n", + "oneOf": [ + { + "type": "string", + "enum": ["wandb"] + } + ] + }, + "wandb": { + "type": "object", + "description": "The settings for your integration with Weights and Biases. This payload specifies the project that\nmetrics will be sent to. Optionally, you can set an explicit display name for your run, add tags\nto your run, and set a default entity (team, username, etc) to be associated with your run.\n", + "required": ["project"], + "properties": { + "project": { + "description": "The name of the project that the new run will be created under.\n", + "type": "string", + "example": "my-wandb-project" + }, + "name": { + "description": "A display name to set for the run. If not set, we will use the Job ID as the name.\n", + "nullable": true, + "type": "string" + }, + "entity": { + "description": "The entity to use for the run. This allows you to set the team or username of the WandB user that you would\nlike associated with the run. If not set, the default entity for the registered WandB API key is used.\n", + "nullable": true, + "type": "string" + }, + "tags": { + "description": "A list of tags to be attached to the newly created run. These tags are passed through directly to WandB. Some\ndefault tags are generated by OpenAI: \"openai/finetune\", \"openai/{base-model}\", \"openai/{ftjob-abcdef}\".\n", + "type": "array", + "items": { + "type": "string", + "example": "custom-tag" + } + } + } + } + } + } + }, + "seed": { + "description": "The seed controls the reproducibility of the job. Passing in the same seed and job parameters should produce the same results, but may differ in rare cases.\nIf a seed is not specified, one will be generated for you.\n", + "type": "integer", + "nullable": true, + "minimum": 0, + "maximum": 2147483647, + "example": 42 + } + }, + "required": ["model", "training_file"] + }, + "ListFineTuningJobEventsResponse": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FineTuningJobEvent" + } + }, + "object": { + "type": "string", + "enum": ["list"] + } + }, + "required": ["object", "data"] + }, + "ListFineTuningJobCheckpointsResponse": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FineTuningJobCheckpoint" + } + }, + "object": { + "type": "string", + "enum": ["list"] + }, + "first_id": { + "type": "string", + "nullable": true + }, + "last_id": { + "type": "string", + "nullable": true + }, + "has_more": { + "type": "boolean" + } + }, + "required": ["object", "data", "has_more"] + }, + "CreateEmbeddingRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "input": { + "description": "Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for `text-embedding-ada-002`), cannot be an empty string, and any array must be 2048 dimensions or less. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens.\n", + "example": "The quick brown fox jumped over the lazy dog", + "oneOf": [ + { + "type": "string", + "title": "string", + "description": "The string that will be turned into an embedding.", + "default": "", + "example": "This is a test." + }, + { + "type": "array", + "title": "array", + "description": "The array of strings that will be turned into an embedding.", + "minItems": 1, + "maxItems": 2048, + "items": { + "type": "string", + "default": "", + "example": "['This is a test.']" + } + }, + { + "type": "array", + "title": "array", + "description": "The array of integers that will be turned into an embedding.", + "minItems": 1, + "maxItems": 2048, + "items": { + "type": "integer" + }, + "example": "[1212, 318, 257, 1332, 13]" + }, + { + "type": "array", + "title": "array", + "description": "The array of arrays containing integers that will be turned into an embedding.", + "minItems": 1, + "maxItems": 2048, + "items": { + "type": "array", + "minItems": 1, + "items": { + "type": "integer" + } + }, + "example": "[[1212, 318, 257, 1332, 13]]" + } + ], + "x-oaiExpandable": true + }, + "model": { + "description": "ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them.\n", + "example": "text-embedding-3-small", + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "text-embedding-ada-002", + "text-embedding-3-small", + "text-embedding-3-large" + ] + } + ], + "x-oaiTypeLabel": "string" + }, + "encoding_format": { + "description": "The format to return the embeddings in. Can be either `float` or [`base64`](https://pypi.org/project/pybase64/).", + "example": "float", + "default": "float", + "type": "string", + "enum": ["float", "base64"] + }, + "dimensions": { + "description": "The number of dimensions the resulting output embeddings should have. Only supported in `text-embedding-3` and later models.\n", + "type": "integer", + "minimum": 1 + }, + "user": { + "type": "string", + "example": "user-1234", + "description": "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).\n" + } + }, + "required": ["model", "input"] + }, + "CreateEmbeddingResponse": { + "type": "object", + "properties": { + "data": { + "type": "array", + "description": "The list of embeddings generated by the model.", + "items": { + "$ref": "#/components/schemas/Embedding" + } + }, + "model": { + "type": "string", + "description": "The name of the model used to generate the embedding." + }, + "object": { + "type": "string", + "description": "The object type, which is always \"list\".", + "enum": ["list"] + }, + "usage": { + "type": "object", + "description": "The usage information for the request.", + "properties": { + "prompt_tokens": { + "type": "integer", + "description": "The number of tokens used by the prompt." + }, + "total_tokens": { + "type": "integer", + "description": "The total number of tokens used by the request." + } + }, + "required": ["prompt_tokens", "total_tokens"] + } + }, + "required": ["object", "model", "data", "usage"] + }, + "CreateTranscriptionRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "file": { + "description": "The audio file object (not file name) to transcribe, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.\n", + "type": "string", + "x-oaiTypeLabel": "file", + "format": "binary" + }, + "model": { + "description": "ID of the model to use. Only `whisper-1` (which is powered by our open source Whisper V2 model) is currently available.\n", + "example": "whisper-1", + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": ["whisper-1"] + } + ], + "x-oaiTypeLabel": "string" + }, + "language": { + "description": "The language of the input audio. Supplying the input language in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format will improve accuracy and latency.\n", + "type": "string" + }, + "prompt": { + "description": "An optional text to guide the model's style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text/prompting) should match the audio language.\n", + "type": "string" + }, + "response_format": { + "$ref": "#/components/schemas/AudioResponseFormat" + }, + "temperature": { + "description": "The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit.\n", + "type": "number", + "default": 0 + }, + "timestamp_granularities[]": { + "description": "The timestamp granularities to populate for this transcription. `response_format` must be set `verbose_json` to use timestamp granularities. Either or both of these options are supported: `word`, or `segment`. Note: There is no additional latency for segment timestamps, but generating word timestamps incurs additional latency.\n", + "type": "array", + "items": { + "type": "string", + "enum": ["word", "segment"] + }, + "default": ["segment"] + } + }, + "required": ["file", "model"] + }, + "CreateTranscriptionResponseJson": { + "type": "object", + "description": "Represents a transcription response returned by model, based on the provided input.", + "properties": { + "text": { + "type": "string", + "description": "The transcribed text." + } + }, + "required": ["text"], + "x-oaiMeta": { + "name": "The transcription object (JSON)", + "group": "audio", + "example": "{\n \"text\": \"Imagine the wildest idea that you've ever had, and you're curious about how it might scale to something that's a 100, a 1,000 times bigger. This is a place where you can get to do that.\"\n}\n" + } + }, + "TranscriptionSegment": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "Unique identifier of the segment." + }, + "seek": { + "type": "integer", + "description": "Seek offset of the segment." + }, + "start": { + "type": "number", + "format": "float", + "description": "Start time of the segment in seconds." + }, + "end": { + "type": "number", + "format": "float", + "description": "End time of the segment in seconds." + }, + "text": { + "type": "string", + "description": "Text content of the segment." + }, + "tokens": { + "type": "array", + "items": { + "type": "integer" + }, + "description": "Array of token IDs for the text content." + }, + "temperature": { + "type": "number", + "format": "float", + "description": "Temperature parameter used for generating the segment." + }, + "avg_logprob": { + "type": "number", + "format": "float", + "description": "Average logprob of the segment. If the value is lower than -1, consider the logprobs failed." + }, + "compression_ratio": { + "type": "number", + "format": "float", + "description": "Compression ratio of the segment. If the value is greater than 2.4, consider the compression failed." + }, + "no_speech_prob": { + "type": "number", + "format": "float", + "description": "Probability of no speech in the segment. If the value is higher than 1.0 and the `avg_logprob` is below -1, consider this segment silent." + } + }, + "required": [ + "id", + "seek", + "start", + "end", + "text", + "tokens", + "temperature", + "avg_logprob", + "compression_ratio", + "no_speech_prob" + ] + }, + "TranscriptionWord": { + "type": "object", + "properties": { + "word": { + "type": "string", + "description": "The text content of the word." + }, + "start": { + "type": "number", + "format": "float", + "description": "Start time of the word in seconds." + }, + "end": { + "type": "number", + "format": "float", + "description": "End time of the word in seconds." + } + }, + "required": ["word", "start", "end"] + }, + "CreateTranscriptionResponseVerboseJson": { + "type": "object", + "description": "Represents a verbose json transcription response returned by model, based on the provided input.", + "properties": { + "language": { + "type": "string", + "description": "The language of the input audio." + }, + "duration": { + "type": "string", + "description": "The duration of the input audio." + }, + "text": { + "type": "string", + "description": "The transcribed text." + }, + "words": { + "type": "array", + "description": "Extracted words and their corresponding timestamps.", + "items": { + "$ref": "#/components/schemas/TranscriptionWord" + } + }, + "segments": { + "type": "array", + "description": "Segments of the transcribed text and their corresponding details.", + "items": { + "$ref": "#/components/schemas/TranscriptionSegment" + } + } + }, + "required": ["language", "duration", "text"], + "x-oaiMeta": { + "name": "The transcription object (Verbose JSON)", + "group": "audio", + "example": "{\n \"task\": \"transcribe\",\n \"language\": \"english\",\n \"duration\": 8.470000267028809,\n \"text\": \"The beach was a popular spot on a hot summer day. People were swimming in the ocean, building sandcastles, and playing beach volleyball.\",\n \"segments\": [\n {\n \"id\": 0,\n \"seek\": 0,\n \"start\": 0.0,\n \"end\": 3.319999933242798,\n \"text\": \" The beach was a popular spot on a hot summer day.\",\n \"tokens\": [\n 50364, 440, 7534, 390, 257, 3743, 4008, 322, 257, 2368, 4266, 786, 13, 50530\n ],\n \"temperature\": 0.0,\n \"avg_logprob\": -0.2860786020755768,\n \"compression_ratio\": 1.2363636493682861,\n \"no_speech_prob\": 0.00985979475080967\n },\n ...\n ]\n}\n" + } + }, + "AudioResponseFormat": { + "description": "The format of the output, in one of these options: `json`, `text`, `srt`, `verbose_json`, or `vtt`.\n", + "type": "string", + "enum": ["json", "text", "srt", "verbose_json", "vtt"], + "default": "json" + }, + "CreateTranslationRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "file": { + "description": "The audio file object (not file name) translate, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.\n", + "type": "string", + "x-oaiTypeLabel": "file", + "format": "binary" + }, + "model": { + "description": "ID of the model to use. Only `whisper-1` (which is powered by our open source Whisper V2 model) is currently available.\n", + "example": "whisper-1", + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": ["whisper-1"] + } + ], + "x-oaiTypeLabel": "string" + }, + "prompt": { + "description": "An optional text to guide the model's style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text/prompting) should be in English.\n", + "type": "string" + }, + "response_format": { + "$ref": "#/components/schemas/AudioResponseFormat" + }, + "temperature": { + "description": "The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit.\n", + "type": "number", + "default": 0 + } + }, + "required": ["file", "model"] + }, + "CreateTranslationResponseJson": { + "type": "object", + "properties": { + "text": { + "type": "string" + } + }, + "required": ["text"] + }, + "CreateTranslationResponseVerboseJson": { + "type": "object", + "properties": { + "language": { + "type": "string", + "description": "The language of the output translation (always `english`)." + }, + "duration": { + "type": "string", + "description": "The duration of the input audio." + }, + "text": { + "type": "string", + "description": "The translated text." + }, + "segments": { + "type": "array", + "description": "Segments of the translated text and their corresponding details.", + "items": { + "$ref": "#/components/schemas/TranscriptionSegment" + } + } + }, + "required": ["language", "duration", "text"] + }, + "CreateSpeechRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "model": { + "description": "One of the available [TTS models](/docs/models/tts): `tts-1` or `tts-1-hd`\n", + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": ["tts-1", "tts-1-hd"] + } + ], + "x-oaiTypeLabel": "string" + }, + "input": { + "type": "string", + "description": "The text to generate audio for. The maximum length is 4096 characters.", + "maxLength": 4096 + }, + "voice": { + "description": "The voice to use when generating the audio. Supported voices are `alloy`, `echo`, `fable`, `onyx`, `nova`, and `shimmer`. Previews of the voices are available in the [Text to speech guide](/docs/guides/text-to-speech/voice-options).", + "type": "string", + "enum": ["alloy", "echo", "fable", "onyx", "nova", "shimmer"] + }, + "response_format": { + "description": "The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, `wav`, and `pcm`.", + "default": "mp3", + "type": "string", + "enum": ["mp3", "opus", "aac", "flac", "wav", "pcm"] + }, + "speed": { + "description": "The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is the default.", + "type": "number", + "default": 1, + "minimum": 0.25, + "maximum": 4 + } + }, + "required": ["model", "input", "voice"] + }, + "Model": { + "title": "Model", + "description": "Describes an OpenAI model offering that can be used with the API.", + "properties": { + "id": { + "type": "string", + "description": "The model identifier, which can be referenced in the API endpoints." + }, + "created": { + "type": "integer", + "description": "The Unix timestamp (in seconds) when the model was created." + }, + "object": { + "type": "string", + "description": "The object type, which is always \"model\".", + "enum": ["model"] + }, + "owned_by": { + "type": "string", + "description": "The organization that owns the model." + } + }, + "required": ["id", "object", "created", "owned_by"], + "x-oaiMeta": { + "name": "The model object", + "example": "{\n \"id\": \"VAR_model_id\",\n \"object\": \"model\",\n \"created\": 1686935002,\n \"owned_by\": \"openai\"\n}\n" + } + }, + "OpenAIFile": { + "title": "OpenAIFile", + "description": "The `File` object represents a document that has been uploaded to OpenAI.", + "properties": { + "id": { + "type": "string", + "description": "The file identifier, which can be referenced in the API endpoints." + }, + "bytes": { + "type": "integer", + "description": "The size of the file, in bytes." + }, + "created_at": { + "type": "integer", + "description": "The Unix timestamp (in seconds) for when the file was created." + }, + "filename": { + "type": "string", + "description": "The name of the file." + }, + "object": { + "type": "string", + "description": "The object type, which is always `file`.", + "enum": ["file"] + }, + "purpose": { + "type": "string", + "description": "The intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results` and `vision`.", + "enum": [ + "assistants", + "assistants_output", + "batch", + "batch_output", + "fine-tune", + "fine-tune-results", + "vision" + ] + }, + "status": { + "type": "string", + "deprecated": true, + "description": "Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`.", + "enum": ["uploaded", "processed", "error"] + }, + "status_details": { + "type": "string", + "deprecated": true, + "description": "Deprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`." + } + }, + "required": [ + "id", + "object", + "bytes", + "created_at", + "filename", + "purpose", + "status" + ], + "x-oaiMeta": { + "name": "The file object", + "example": "{\n \"id\": \"file-abc123\",\n \"object\": \"file\",\n \"bytes\": 120000,\n \"created_at\": 1677610602,\n \"filename\": \"salesOverview.pdf\",\n \"purpose\": \"assistants\",\n}\n" + } + }, + "Upload": { + "type": "object", + "title": "Upload", + "description": "The Upload object can accept byte chunks in the form of Parts.\n", + "properties": { + "id": { + "type": "string", + "description": "The Upload unique identifier, which can be referenced in API endpoints." + }, + "created_at": { + "type": "integer", + "description": "The Unix timestamp (in seconds) for when the Upload was created." + }, + "filename": { + "type": "string", + "description": "The name of the file to be uploaded." + }, + "bytes": { + "type": "integer", + "description": "The intended number of bytes to be uploaded." + }, + "purpose": { + "type": "string", + "description": "The intended purpose of the file. [Please refer here](/docs/api-reference/files/object#files/object-purpose) for acceptable values." + }, + "status": { + "type": "string", + "description": "The status of the Upload.", + "enum": ["pending", "completed", "cancelled", "expired"] + }, + "expires_at": { + "type": "integer", + "description": "The Unix timestamp (in seconds) for when the Upload was created." + }, + "object": { + "type": "string", + "description": "The object type, which is always \"upload\".", + "enum": ["upload"] + }, + "file": { + "$ref": "#/components/schemas/OpenAIFile", + "nullable": true, + "description": "The ready File object after the Upload is completed." + } + }, + "required": [ + "bytes", + "created_at", + "expires_at", + "filename", + "id", + "purpose", + "status", + "step_number" + ], + "x-oaiMeta": { + "name": "The upload object", + "example": "{\n \"id\": \"upload_abc123\",\n \"object\": \"upload\",\n \"bytes\": 2147483648,\n \"created_at\": 1719184911,\n \"filename\": \"training_examples.jsonl\",\n \"purpose\": \"fine-tune\",\n \"status\": \"completed\",\n \"expires_at\": 1719127296,\n \"file\": {\n \"id\": \"file-xyz321\",\n \"object\": \"file\",\n \"bytes\": 2147483648,\n \"created_at\": 1719186911,\n \"filename\": \"training_examples.jsonl\",\n \"purpose\": \"fine-tune\",\n }\n}\n" + } + }, + "UploadPart": { + "type": "object", + "title": "UploadPart", + "description": "The upload Part represents a chunk of bytes we can add to an Upload object.\n", + "properties": { + "id": { + "type": "string", + "description": "The upload Part unique identifier, which can be referenced in API endpoints." + }, + "created_at": { + "type": "integer", + "description": "The Unix timestamp (in seconds) for when the Part was created." + }, + "upload_id": { + "type": "string", + "description": "The ID of the Upload object that this Part was added to." + }, + "object": { + "type": "string", + "description": "The object type, which is always `upload.part`.", + "enum": ["upload.part"] + } + }, + "required": ["created_at", "id", "object", "upload_id"], + "x-oaiMeta": { + "name": "The upload part object", + "example": "{\n \"id\": \"part_def456\",\n \"object\": \"upload.part\",\n \"created_at\": 1719186911,\n \"upload_id\": \"upload_abc123\"\n}\n" + } + }, + "Embedding": { + "type": "object", + "description": "Represents an embedding vector returned by embedding endpoint.\n", + "properties": { + "index": { + "type": "integer", + "description": "The index of the embedding in the list of embeddings." + }, + "embedding": { + "type": "array", + "description": "The embedding vector, which is a list of floats. The length of vector depends on the model as listed in the [embedding guide](/docs/guides/embeddings).\n", + "items": { + "type": "number" + } + }, + "object": { + "type": "string", + "description": "The object type, which is always \"embedding\".", + "enum": ["embedding"] + } + }, + "required": ["index", "object", "embedding"], + "x-oaiMeta": { + "name": "The embedding object", + "example": "{\n \"object\": \"embedding\",\n \"embedding\": [\n 0.0023064255,\n -0.009327292,\n .... (1536 floats total for ada-002)\n -0.0028842222,\n ],\n \"index\": 0\n}\n" + } + }, + "FineTuningJob": { + "type": "object", + "title": "FineTuningJob", + "description": "The `fine_tuning.job` object represents a fine-tuning job that has been created through the API.\n", + "properties": { + "id": { + "type": "string", + "description": "The object identifier, which can be referenced in the API endpoints." + }, + "created_at": { + "type": "integer", + "description": "The Unix timestamp (in seconds) for when the fine-tuning job was created." + }, + "error": { + "type": "object", + "nullable": true, + "description": "For fine-tuning jobs that have `failed`, this will contain more information on the cause of the failure.", + "properties": { + "code": { + "type": "string", + "description": "A machine-readable error code." + }, + "message": { + "type": "string", + "description": "A human-readable error message." + }, + "param": { + "type": "string", + "description": "The parameter that was invalid, usually `training_file` or `validation_file`. This field will be null if the failure was not parameter-specific.", + "nullable": true + } + }, + "required": ["code", "message", "param"] + }, + "fine_tuned_model": { + "type": "string", + "nullable": true, + "description": "The name of the fine-tuned model that is being created. The value will be null if the fine-tuning job is still running." + }, + "finished_at": { + "type": "integer", + "nullable": true, + "description": "The Unix timestamp (in seconds) for when the fine-tuning job was finished. The value will be null if the fine-tuning job is still running." + }, + "hyperparameters": { + "type": "object", + "description": "The hyperparameters used for the fine-tuning job. See the [fine-tuning guide](/docs/guides/fine-tuning) for more details.", + "properties": { + "n_epochs": { + "oneOf": [ + { + "type": "string", + "enum": ["auto"] + }, + { + "type": "integer", + "minimum": 1, + "maximum": 50 + } + ], + "default": "auto", + "description": "The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.\n\"auto\" decides the optimal number of epochs based on the size of the dataset. If setting the number manually, we support any number between 1 and 50 epochs." + } + }, + "required": ["n_epochs"] + }, + "model": { + "type": "string", + "description": "The base model that is being fine-tuned." + }, + "object": { + "type": "string", + "description": "The object type, which is always \"fine_tuning.job\".", + "enum": ["fine_tuning.job"] + }, + "organization_id": { + "type": "string", + "description": "The organization that owns the fine-tuning job." + }, + "result_files": { + "type": "array", + "description": "The compiled results file ID(s) for the fine-tuning job. You can retrieve the results with the [Files API](/docs/api-reference/files/retrieve-contents).", + "items": { + "type": "string", + "example": "file-abc123" + } + }, + "status": { + "type": "string", + "description": "The current status of the fine-tuning job, which can be either `validating_files`, `queued`, `running`, `succeeded`, `failed`, or `cancelled`.", + "enum": [ + "validating_files", + "queued", + "running", + "succeeded", + "failed", + "cancelled" + ] + }, + "trained_tokens": { + "type": "integer", + "nullable": true, + "description": "The total number of billable tokens processed by this fine-tuning job. The value will be null if the fine-tuning job is still running." + }, + "training_file": { + "type": "string", + "description": "The file ID used for training. You can retrieve the training data with the [Files API](/docs/api-reference/files/retrieve-contents)." + }, + "validation_file": { + "type": "string", + "nullable": true, + "description": "The file ID used for validation. You can retrieve the validation results with the [Files API](/docs/api-reference/files/retrieve-contents)." + }, + "integrations": { + "type": "array", + "nullable": true, + "description": "A list of integrations to enable for this fine-tuning job.", + "maxItems": 5, + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/FineTuningIntegration" + } + ], + "x-oaiExpandable": true + } + }, + "seed": { + "type": "integer", + "description": "The seed used for the fine-tuning job." + }, + "estimated_finish": { + "type": "integer", + "nullable": true, + "description": "The Unix timestamp (in seconds) for when the fine-tuning job is estimated to finish. The value will be null if the fine-tuning job is not running." + } + }, + "required": [ + "created_at", + "error", + "finished_at", + "fine_tuned_model", + "hyperparameters", + "id", + "model", + "object", + "organization_id", + "result_files", + "status", + "trained_tokens", + "training_file", + "validation_file", + "seed" + ], + "x-oaiMeta": { + "name": "The fine-tuning job object", + "example": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"davinci-002\",\n \"created_at\": 1692661014,\n \"finished_at\": 1692661190,\n \"fine_tuned_model\": \"ft:davinci-002:my-org:custom_suffix:7q8mpxmy\",\n \"organization_id\": \"org-123\",\n \"result_files\": [\n \"file-abc123\"\n ],\n \"status\": \"succeeded\",\n \"validation_file\": null,\n \"training_file\": \"file-abc123\",\n \"hyperparameters\": {\n \"n_epochs\": 4,\n \"batch_size\": 1,\n \"learning_rate_multiplier\": 1.0\n },\n \"trained_tokens\": 5768,\n \"integrations\": [],\n \"seed\": 0,\n \"estimated_finish\": 0\n}\n" + } + }, + "FineTuningIntegration": { + "type": "object", + "title": "Fine-Tuning Job Integration", + "required": ["type", "wandb"], + "properties": { + "type": { + "type": "string", + "description": "The type of the integration being enabled for the fine-tuning job", + "enum": ["wandb"] + }, + "wandb": { + "type": "object", + "description": "The settings for your integration with Weights and Biases. This payload specifies the project that\nmetrics will be sent to. Optionally, you can set an explicit display name for your run, add tags\nto your run, and set a default entity (team, username, etc) to be associated with your run.\n", + "required": ["project"], + "properties": { + "project": { + "description": "The name of the project that the new run will be created under.\n", + "type": "string", + "example": "my-wandb-project" + }, + "name": { + "description": "A display name to set for the run. If not set, we will use the Job ID as the name.\n", + "nullable": true, + "type": "string" + }, + "entity": { + "description": "The entity to use for the run. This allows you to set the team or username of the WandB user that you would\nlike associated with the run. If not set, the default entity for the registered WandB API key is used.\n", + "nullable": true, + "type": "string" + }, + "tags": { + "description": "A list of tags to be attached to the newly created run. These tags are passed through directly to WandB. Some\ndefault tags are generated by OpenAI: \"openai/finetune\", \"openai/{base-model}\", \"openai/{ftjob-abcdef}\".\n", + "type": "array", + "items": { + "type": "string", + "example": "custom-tag" + } + } + } + } + } + }, + "FineTuningJobEvent": { + "type": "object", + "description": "Fine-tuning job event object", + "properties": { + "id": { + "type": "string" + }, + "created_at": { + "type": "integer" + }, + "level": { + "type": "string", + "enum": ["info", "warn", "error"] + }, + "message": { + "type": "string" + }, + "object": { + "type": "string", + "enum": ["fine_tuning.job.event"] + } + }, + "required": ["id", "object", "created_at", "level", "message"], + "x-oaiMeta": { + "name": "The fine-tuning job event object", + "example": "{\n \"object\": \"fine_tuning.job.event\",\n \"id\": \"ftevent-abc123\"\n \"created_at\": 1677610602,\n \"level\": \"info\",\n \"message\": \"Created fine-tuning job\"\n}\n" + } + }, + "FineTuningJobCheckpoint": { + "type": "object", + "title": "FineTuningJobCheckpoint", + "description": "The `fine_tuning.job.checkpoint` object represents a model checkpoint for a fine-tuning job that is ready to use.\n", + "properties": { + "id": { + "type": "string", + "description": "The checkpoint identifier, which can be referenced in the API endpoints." + }, + "created_at": { + "type": "integer", + "description": "The Unix timestamp (in seconds) for when the checkpoint was created." + }, + "fine_tuned_model_checkpoint": { + "type": "string", + "description": "The name of the fine-tuned checkpoint model that is created." + }, + "step_number": { + "type": "integer", + "description": "The step number that the checkpoint was created at." + }, + "metrics": { + "type": "object", + "description": "Metrics at the step number during the fine-tuning job.", + "properties": { + "step": { + "type": "number" + }, + "train_loss": { + "type": "number" + }, + "train_mean_token_accuracy": { + "type": "number" + }, + "valid_loss": { + "type": "number" + }, + "valid_mean_token_accuracy": { + "type": "number" + }, + "full_valid_loss": { + "type": "number" + }, + "full_valid_mean_token_accuracy": { + "type": "number" + } + } + }, + "fine_tuning_job_id": { + "type": "string", + "description": "The name of the fine-tuning job that this checkpoint was created from." + }, + "object": { + "type": "string", + "description": "The object type, which is always \"fine_tuning.job.checkpoint\".", + "enum": ["fine_tuning.job.checkpoint"] + } + }, + "required": [ + "created_at", + "fine_tuning_job_id", + "fine_tuned_model_checkpoint", + "id", + "metrics", + "object", + "step_number" + ], + "x-oaiMeta": { + "name": "The fine-tuning job checkpoint object", + "example": "{\n \"object\": \"fine_tuning.job.checkpoint\",\n \"id\": \"ftckpt_qtZ5Gyk4BLq1SfLFWp3RtO3P\",\n \"created_at\": 1712211699,\n \"fine_tuned_model_checkpoint\": \"ft:gpt-4o-mini-2024-07-18:my-org:custom_suffix:9ABel2dg:ckpt-step-88\",\n \"fine_tuning_job_id\": \"ftjob-fpbNQ3H1GrMehXRf8cO97xTN\",\n \"metrics\": {\n \"step\": 88,\n \"train_loss\": 0.478,\n \"train_mean_token_accuracy\": 0.924,\n \"valid_loss\": 10.112,\n \"valid_mean_token_accuracy\": 0.145,\n \"full_valid_loss\": 0.567,\n \"full_valid_mean_token_accuracy\": 0.944\n },\n \"step_number\": 88\n}\n" + } + }, + "FinetuneChatRequestInput": { + "type": "object", + "description": "The per-line training example of a fine-tuning input file for chat models", + "properties": { + "messages": { + "type": "array", + "minItems": 1, + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/ChatCompletionRequestSystemMessage" + }, + { + "$ref": "#/components/schemas/ChatCompletionRequestUserMessage" + }, + { + "$ref": "#/components/schemas/FineTuneChatCompletionRequestAssistantMessage" + }, + { + "$ref": "#/components/schemas/ChatCompletionRequestToolMessage" + }, + { + "$ref": "#/components/schemas/ChatCompletionRequestFunctionMessage" + } + ], + "x-oaiExpandable": true + } + }, + "tools": { + "type": "array", + "description": "A list of tools the model may generate JSON inputs for.", + "items": { + "$ref": "#/components/schemas/ChatCompletionTool" + } + }, + "parallel_tool_calls": { + "$ref": "#/components/schemas/ParallelToolCalls" + }, + "functions": { + "deprecated": true, + "description": "A list of functions the model may generate JSON inputs for.", + "type": "array", + "minItems": 1, + "maxItems": 128, + "items": { + "$ref": "#/components/schemas/ChatCompletionFunctions" + } + } + }, + "x-oaiMeta": { + "name": "Training format for chat models", + "example": "{\n \"messages\": [\n { \"role\": \"user\", \"content\": \"What is the weather in San Francisco?\" },\n {\n \"role\": \"assistant\",\n \"tool_calls\": [\n {\n \"id\": \"call_id\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"arguments\": \"{\\\"location\\\": \\\"San Francisco, USA\\\", \\\"format\\\": \\\"celsius\\\"}\"\n }\n }\n ]\n }\n ],\n \"parallel_tool_calls\": false,\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and country, eg. San Francisco, USA\"\n },\n \"format\": { \"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"] }\n },\n \"required\": [\"location\", \"format\"]\n }\n }\n }\n ]\n}\n" + } + }, + "FinetuneCompletionRequestInput": { + "type": "object", + "description": "The per-line training example of a fine-tuning input file for completions models", + "properties": { + "prompt": { + "type": "string", + "description": "The input prompt for this training example." + }, + "completion": { + "type": "string", + "description": "The desired completion for this training example." + } + }, + "x-oaiMeta": { + "name": "Training format for completions models", + "example": "{\n \"prompt\": \"What is the answer to 2+2\",\n \"completion\": \"4\"\n}\n" + } + }, + "CompletionUsage": { + "type": "object", + "description": "Usage statistics for the completion request.", + "properties": { + "completion_tokens": { + "type": "integer", + "description": "Number of tokens in the generated completion." + }, + "prompt_tokens": { + "type": "integer", + "description": "Number of tokens in the prompt." + }, + "total_tokens": { + "type": "integer", + "description": "Total number of tokens used in the request (prompt + completion)." + }, + "completion_tokens_details": { + "type": "object", + "description": "Breakdown of tokens used in a completion.", + "properties": { + "reasoning_tokens": { + "type": "integer", + "description": "Tokens generated by the model for reasoning." + } + } + } + }, + "required": ["prompt_tokens", "completion_tokens", "total_tokens"] + }, + "RunCompletionUsage": { + "type": "object", + "description": "Usage statistics related to the run. This value will be `null` if the run is not in a terminal state (i.e. `in_progress`, `queued`, etc.).", + "properties": { + "completion_tokens": { + "type": "integer", + "description": "Number of completion tokens used over the course of the run." + }, + "prompt_tokens": { + "type": "integer", + "description": "Number of prompt tokens used over the course of the run." + }, + "total_tokens": { + "type": "integer", + "description": "Total number of tokens used (prompt + completion)." + } + }, + "required": ["prompt_tokens", "completion_tokens", "total_tokens"], + "nullable": true + }, + "RunStepCompletionUsage": { + "type": "object", + "description": "Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`.", + "properties": { + "completion_tokens": { + "type": "integer", + "description": "Number of completion tokens used over the course of the run step." + }, + "prompt_tokens": { + "type": "integer", + "description": "Number of prompt tokens used over the course of the run step." + }, + "total_tokens": { + "type": "integer", + "description": "Total number of tokens used (prompt + completion)." + } + }, + "required": ["prompt_tokens", "completion_tokens", "total_tokens"], + "nullable": true + }, + "AssistantsApiResponseFormatOption": { + "description": "Specifies the format that the model must output. Compatible with [GPT-4o](/docs/models/gpt-4o), [GPT-4 Turbo](/docs/models/gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.\n\nSetting to `{ \"type\": \"json_schema\", \"json_schema\": {...} }` enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the [Structured Outputs guide](/docs/guides/structured-outputs).\n\nSetting to `{ \"type\": \"json_object\" }` enables JSON mode, which ensures the message the model generates is valid JSON.\n\n**Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly \"stuck\" request. Also note that the message content may be partially cut off if `finish_reason=\"length\"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length.\n", + "oneOf": [ + { + "type": "string", + "description": "`auto` is the default value\n", + "enum": ["auto"] + }, + { + "$ref": "#/components/schemas/ResponseFormatText" + }, + { + "$ref": "#/components/schemas/ResponseFormatJsonObject" + }, + { + "$ref": "#/components/schemas/ResponseFormatJsonSchema" + } + ], + "x-oaiExpandable": true + }, + "AssistantObject": { + "type": "object", + "title": "Assistant", + "description": "Represents an `assistant` that can call the model and use tools.", + "properties": { + "id": { + "description": "The identifier, which can be referenced in API endpoints.", + "type": "string" + }, + "object": { + "description": "The object type, which is always `assistant`.", + "type": "string", + "enum": ["assistant"] + }, + "created_at": { + "description": "The Unix timestamp (in seconds) for when the assistant was created.", + "type": "integer" + }, + "name": { + "description": "The name of the assistant. The maximum length is 256 characters.\n", + "type": "string", + "maxLength": 256, + "nullable": true + }, + "description": { + "description": "The description of the assistant. The maximum length is 512 characters.\n", + "type": "string", + "maxLength": 512, + "nullable": true + }, + "model": { + "description": "ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them.\n", + "type": "string" + }, + "instructions": { + "description": "The system instructions that the assistant uses. The maximum length is 256,000 characters.\n", + "type": "string", + "maxLength": 256000, + "nullable": true + }, + "tools": { + "description": "A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.\n", + "default": [], + "type": "array", + "maxItems": 128, + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/AssistantToolsCode" + }, + { + "$ref": "#/components/schemas/AssistantToolsFileSearch" + }, + { + "$ref": "#/components/schemas/AssistantToolsFunction" + } + ], + "x-oaiExpandable": true + } + }, + "tool_resources": { + "type": "object", + "description": "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n", + "properties": { + "code_interpreter": { + "type": "object", + "properties": { + "file_ids": { + "type": "array", + "description": "A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter`` tool. There can be a maximum of 20 files associated with the tool.\n", + "default": [], + "maxItems": 20, + "items": { + "type": "string" + } + } + } + }, + "file_search": { + "type": "object", + "properties": { + "vector_store_ids": { + "type": "array", + "description": "The ID of the [vector store](/docs/api-reference/vector-stores/object) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n", + "maxItems": 1, + "items": { + "type": "string" + } + } + } + } + }, + "nullable": true + }, + "metadata": { + "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", + "type": "object", + "x-oaiTypeLabel": "map", + "nullable": true + }, + "temperature": { + "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n", + "type": "number", + "minimum": 0, + "maximum": 2, + "default": 1, + "example": 1, + "nullable": true + }, + "top_p": { + "type": "number", + "minimum": 0, + "maximum": 1, + "default": 1, + "example": 1, + "nullable": true, + "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.\n" + }, + "response_format": { + "$ref": "#/components/schemas/AssistantsApiResponseFormatOption", + "nullable": true + } + }, + "required": [ + "id", + "object", + "created_at", + "name", + "description", + "model", + "instructions", + "tools", + "metadata" + ], + "x-oaiMeta": { + "name": "The assistant object", + "beta": true, + "example": "{\n \"id\": \"asst_abc123\",\n \"object\": \"assistant\",\n \"created_at\": 1698984975,\n \"name\": \"Math Tutor\",\n \"description\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": \"You are a personal math tutor. When asked a question, write and run Python code to answer the question.\",\n \"tools\": [\n {\n \"type\": \"code_interpreter\"\n }\n ],\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n}\n" + } + }, + "CreateAssistantRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "model": { + "description": "ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them.\n", + "example": "gpt-4o", + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "gpt-4o", + "gpt-4o-2024-08-06", + "gpt-4o-2024-05-13", + "gpt-4o-2024-08-06", + "gpt-4o-mini", + "gpt-4o-mini-2024-07-18", + "gpt-4-turbo", + "gpt-4-turbo-2024-04-09", + "gpt-4-0125-preview", + "gpt-4-turbo-preview", + "gpt-4-1106-preview", + "gpt-4-vision-preview", + "gpt-4", + "gpt-4-0314", + "gpt-4-0613", + "gpt-4-32k", + "gpt-4-32k-0314", + "gpt-4-32k-0613", + "gpt-3.5-turbo", + "gpt-3.5-turbo-16k", + "gpt-3.5-turbo-0613", + "gpt-3.5-turbo-1106", + "gpt-3.5-turbo-0125", + "gpt-3.5-turbo-16k-0613" + ] + } + ], + "x-oaiTypeLabel": "string" + }, + "name": { + "description": "The name of the assistant. The maximum length is 256 characters.\n", + "type": "string", + "nullable": true, + "maxLength": 256 + }, + "description": { + "description": "The description of the assistant. The maximum length is 512 characters.\n", + "type": "string", + "nullable": true, + "maxLength": 512 + }, + "instructions": { + "description": "The system instructions that the assistant uses. The maximum length is 256,000 characters.\n", + "type": "string", + "nullable": true, + "maxLength": 256000 + }, + "tools": { + "description": "A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.\n", + "default": [], + "type": "array", + "maxItems": 128, + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/AssistantToolsCode" + }, + { + "$ref": "#/components/schemas/AssistantToolsFileSearch" + }, + { + "$ref": "#/components/schemas/AssistantToolsFunction" + } + ], + "x-oaiExpandable": true + } + }, + "tool_resources": { + "type": "object", + "description": "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n", + "properties": { + "code_interpreter": { + "type": "object", + "properties": { + "file_ids": { + "type": "array", + "description": "A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n", + "default": [], + "maxItems": 20, + "items": { + "type": "string" + } + } + } + }, + "file_search": { + "type": "object", + "properties": { + "vector_store_ids": { + "type": "array", + "description": "The [vector store](/docs/api-reference/vector-stores/object) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n", + "maxItems": 1, + "items": { + "type": "string" + } + }, + "vector_stores": { + "type": "array", + "description": "A helper to create a [vector store](/docs/api-reference/vector-stores/object) with file_ids and attach it to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n", + "maxItems": 1, + "items": { + "type": "object", + "properties": { + "file_ids": { + "type": "array", + "description": "A list of [file](/docs/api-reference/files) IDs to add to the vector store. There can be a maximum of 10000 files in a vector store.\n", + "maxItems": 10000, + "items": { + "type": "string" + } + }, + "chunking_strategy": { + "type": "object", + "description": "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy.", + "oneOf": [ + { + "type": "object", + "title": "Auto Chunking Strategy", + "description": "The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.", + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "description": "Always `auto`.", + "enum": ["auto"] + } + }, + "required": ["type"] + }, + { + "type": "object", + "title": "Static Chunking Strategy", + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "description": "Always `static`.", + "enum": ["static"] + }, + "static": { + "type": "object", + "additionalProperties": false, + "properties": { + "max_chunk_size_tokens": { + "type": "integer", + "minimum": 100, + "maximum": 4096, + "description": "The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`." + }, + "chunk_overlap_tokens": { + "type": "integer", + "description": "The number of tokens that overlap between chunks. The default value is `400`.\n\nNote that the overlap must not exceed half of `max_chunk_size_tokens`.\n" + } + }, + "required": [ + "max_chunk_size_tokens", + "chunk_overlap_tokens" + ] + } + }, + "required": ["type", "static"] + } + ], + "x-oaiExpandable": true + }, + "metadata": { + "type": "object", + "description": "Set of 16 key-value pairs that can be attached to a vector store. This can be useful for storing additional information about the vector store in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", + "x-oaiTypeLabel": "map" + } + } + } + } + }, + "oneOf": [ + { + "required": ["vector_store_ids"] + }, + { + "required": ["vector_stores"] + } + ] + } + }, + "nullable": true + }, + "metadata": { + "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", + "type": "object", + "x-oaiTypeLabel": "map", + "nullable": true + }, + "temperature": { + "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n", + "type": "number", + "minimum": 0, + "maximum": 2, + "default": 1, + "example": 1, + "nullable": true + }, + "top_p": { + "type": "number", + "minimum": 0, + "maximum": 1, + "default": 1, + "example": 1, + "nullable": true, + "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.\n" + }, + "response_format": { + "$ref": "#/components/schemas/AssistantsApiResponseFormatOption", + "nullable": true + } + }, + "required": ["model"] + }, + "ModifyAssistantRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "model": { + "description": "ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them.\n", + "anyOf": [ + { + "type": "string" + } + ] + }, + "name": { + "description": "The name of the assistant. The maximum length is 256 characters.\n", + "type": "string", + "nullable": true, + "maxLength": 256 + }, + "description": { + "description": "The description of the assistant. The maximum length is 512 characters.\n", + "type": "string", + "nullable": true, + "maxLength": 512 + }, + "instructions": { + "description": "The system instructions that the assistant uses. The maximum length is 256,000 characters.\n", + "type": "string", + "nullable": true, + "maxLength": 256000 + }, + "tools": { + "description": "A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.\n", + "default": [], + "type": "array", + "maxItems": 128, + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/AssistantToolsCode" + }, + { + "$ref": "#/components/schemas/AssistantToolsFileSearch" + }, + { + "$ref": "#/components/schemas/AssistantToolsFunction" + } + ], + "x-oaiExpandable": true + } + }, + "tool_resources": { + "type": "object", + "description": "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n", + "properties": { + "code_interpreter": { + "type": "object", + "properties": { + "file_ids": { + "type": "array", + "description": "Overrides the list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n", + "default": [], + "maxItems": 20, + "items": { + "type": "string" + } + } + } + }, + "file_search": { + "type": "object", + "properties": { + "vector_store_ids": { + "type": "array", + "description": "Overrides the [vector store](/docs/api-reference/vector-stores/object) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n", + "maxItems": 1, + "items": { + "type": "string" + } + } + } + } + }, + "nullable": true + }, + "metadata": { + "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", + "type": "object", + "x-oaiTypeLabel": "map", + "nullable": true + }, + "temperature": { + "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n", + "type": "number", + "minimum": 0, + "maximum": 2, + "default": 1, + "example": 1, + "nullable": true + }, + "top_p": { + "type": "number", + "minimum": 0, + "maximum": 1, + "default": 1, + "example": 1, + "nullable": true, + "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.\n" + }, + "response_format": { + "$ref": "#/components/schemas/AssistantsApiResponseFormatOption", + "nullable": true + } + } + }, + "DeleteAssistantResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "deleted": { + "type": "boolean" + }, + "object": { + "type": "string", + "enum": ["assistant.deleted"] + } + }, + "required": ["id", "object", "deleted"] + }, + "ListAssistantsResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "example": "list" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AssistantObject" + } + }, + "first_id": { + "type": "string", + "example": "asst_abc123" + }, + "last_id": { + "type": "string", + "example": "asst_abc456" + }, + "has_more": { + "type": "boolean", + "example": false + } + }, + "required": ["object", "data", "first_id", "last_id", "has_more"], + "x-oaiMeta": { + "name": "List assistants response object", + "group": "chat", + "example": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"asst_abc123\",\n \"object\": \"assistant\",\n \"created_at\": 1698982736,\n \"name\": \"Coding Tutor\",\n \"description\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": \"You are a helpful assistant designed to make me better at coding!\",\n \"tools\": [],\n \"tool_resources\": {},\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n },\n {\n \"id\": \"asst_abc456\",\n \"object\": \"assistant\",\n \"created_at\": 1698982718,\n \"name\": \"My Assistant\",\n \"description\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": \"You are a helpful assistant designed to make me better at coding!\",\n \"tools\": [],\n \"tool_resources\": {},\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n },\n {\n \"id\": \"asst_abc789\",\n \"object\": \"assistant\",\n \"created_at\": 1698982643,\n \"name\": null,\n \"description\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": null,\n \"tools\": [],\n \"tool_resources\": {},\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n }\n ],\n \"first_id\": \"asst_abc123\",\n \"last_id\": \"asst_abc789\",\n \"has_more\": false\n}\n" + } + }, + "AssistantToolsCode": { + "type": "object", + "title": "Code interpreter tool", + "properties": { + "type": { + "type": "string", + "description": "The type of tool being defined: `code_interpreter`", + "enum": ["code_interpreter"] + } + }, + "required": ["type"] + }, + "AssistantToolsFileSearch": { + "type": "object", + "title": "FileSearch tool", + "properties": { + "type": { + "type": "string", + "description": "The type of tool being defined: `file_search`", + "enum": ["file_search"] + }, + "file_search": { + "type": "object", + "description": "Overrides for the file search tool.", + "properties": { + "max_num_results": { + "type": "integer", + "minimum": 1, + "maximum": 50, + "description": "The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive.\n\nNote that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) for more information.\n" + }, + "ranking_options": { + "$ref": "#/components/schemas/FileSearchRankingOptions" + } + } + } + }, + "required": ["type"] + }, + "FileSearchRankingOptions": { + "title": "File search tool call ranking options", + "type": "object", + "description": "The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0.\n\nSee the [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) for more information.\n", + "properties": { + "ranker": { + "type": "string", + "description": "The ranker to use for the file search. If not specified will use the `auto` ranker.", + "enum": ["auto", "default_2024_08_21"] + }, + "score_threshold": { + "type": "number", + "description": "The score threshold for the file search. All values must be a floating point number between 0 and 1.", + "minimum": 0, + "maximum": 1 + } + }, + "required": ["score_threshold"] + }, + "AssistantToolsFileSearchTypeOnly": { + "type": "object", + "title": "FileSearch tool", + "properties": { + "type": { + "type": "string", + "description": "The type of tool being defined: `file_search`", + "enum": ["file_search"] + } + }, + "required": ["type"] + }, + "AssistantToolsFunction": { + "type": "object", + "title": "Function tool", + "properties": { + "type": { + "type": "string", + "description": "The type of tool being defined: `function`", + "enum": ["function"] + }, + "function": { + "$ref": "#/components/schemas/FunctionObject" + } + }, + "required": ["type", "function"] + }, + "TruncationObject": { + "type": "object", + "title": "Thread Truncation Controls", + "description": "Controls for how a thread will be truncated prior to the run. Use this to control the intial context window of the run.", + "properties": { + "type": { + "type": "string", + "description": "The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will be truncated to the n most recent messages in the thread. When set to `auto`, messages in the middle of the thread will be dropped to fit the context length of the model, `max_prompt_tokens`.", + "enum": ["auto", "last_messages"] + }, + "last_messages": { + "type": "integer", + "description": "The number of most recent messages from the thread when constructing the context for the run.", + "minimum": 1, + "nullable": true + } + }, + "required": ["type"] + }, + "AssistantsApiToolChoiceOption": { + "description": "Controls which (if any) tool is called by the model.\n`none` means the model will not call any tools and instead generates a message.\n`auto` is the default value and means the model can pick between generating a message or calling one or more tools.\n`required` means the model must call one or more tools before responding to the user.\nSpecifying a particular tool like `{\"type\": \"file_search\"}` or `{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}` forces the model to call that tool.\n", + "oneOf": [ + { + "type": "string", + "description": "`none` means the model will not call any tools and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools before responding to the user.\n", + "enum": ["none", "auto", "required"] + }, + { + "$ref": "#/components/schemas/AssistantsNamedToolChoice" + } + ], + "x-oaiExpandable": true + }, + "AssistantsNamedToolChoice": { + "type": "object", + "description": "Specifies a tool the model should use. Use to force the model to call a specific tool.", + "properties": { + "type": { + "type": "string", + "enum": ["function", "code_interpreter", "file_search"], + "description": "The type of the tool. If type is `function`, the function name must be set" + }, + "function": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the function to call." + } + }, + "required": ["name"] + } + }, + "required": ["type"] + }, + "RunObject": { + "type": "object", + "title": "A run on a thread", + "description": "Represents an execution run on a [thread](/docs/api-reference/threads).", + "properties": { + "id": { + "description": "The identifier, which can be referenced in API endpoints.", + "type": "string" + }, + "object": { + "description": "The object type, which is always `thread.run`.", + "type": "string", + "enum": ["thread.run"] + }, + "created_at": { + "description": "The Unix timestamp (in seconds) for when the run was created.", + "type": "integer" + }, + "thread_id": { + "description": "The ID of the [thread](/docs/api-reference/threads) that was executed on as a part of this run.", + "type": "string" + }, + "assistant_id": { + "description": "The ID of the [assistant](/docs/api-reference/assistants) used for execution of this run.", + "type": "string" + }, + "status": { + "description": "The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, `incomplete`, or `expired`.", + "type": "string", + "enum": [ + "queued", + "in_progress", + "requires_action", + "cancelling", + "cancelled", + "failed", + "completed", + "incomplete", + "expired" + ] + }, + "required_action": { + "type": "object", + "description": "Details on the action required to continue the run. Will be `null` if no action is required.", + "nullable": true, + "properties": { + "type": { + "description": "For now, this is always `submit_tool_outputs`.", + "type": "string", + "enum": ["submit_tool_outputs"] + }, + "submit_tool_outputs": { + "type": "object", + "description": "Details on the tool outputs needed for this run to continue.", + "properties": { + "tool_calls": { + "type": "array", + "description": "A list of the relevant tool calls.", + "items": { + "$ref": "#/components/schemas/RunToolCallObject" + } + } + }, + "required": ["tool_calls"] + } + }, + "required": ["type", "submit_tool_outputs"] + }, + "last_error": { + "type": "object", + "description": "The last error associated with this run. Will be `null` if there are no errors.", + "nullable": true, + "properties": { + "code": { + "type": "string", + "description": "One of `server_error`, `rate_limit_exceeded`, or `invalid_prompt`.", + "enum": [ + "server_error", + "rate_limit_exceeded", + "invalid_prompt" + ] + }, + "message": { + "type": "string", + "description": "A human-readable description of the error." + } + }, + "required": ["code", "message"] + }, + "expires_at": { + "description": "The Unix timestamp (in seconds) for when the run will expire.", + "type": "integer", + "nullable": true + }, + "started_at": { + "description": "The Unix timestamp (in seconds) for when the run was started.", + "type": "integer", + "nullable": true + }, + "cancelled_at": { + "description": "The Unix timestamp (in seconds) for when the run was cancelled.", + "type": "integer", + "nullable": true + }, + "failed_at": { + "description": "The Unix timestamp (in seconds) for when the run failed.", + "type": "integer", + "nullable": true + }, + "completed_at": { + "description": "The Unix timestamp (in seconds) for when the run was completed.", + "type": "integer", + "nullable": true + }, + "incomplete_details": { + "description": "Details on why the run is incomplete. Will be `null` if the run is not incomplete.", + "type": "object", + "nullable": true, + "properties": { + "reason": { + "description": "The reason why the run is incomplete. This will point to which specific token limit was reached over the course of the run.", + "type": "string", + "enum": ["max_completion_tokens", "max_prompt_tokens"] + } + } + }, + "model": { + "description": "The model that the [assistant](/docs/api-reference/assistants) used for this run.", + "type": "string" + }, + "instructions": { + "description": "The instructions that the [assistant](/docs/api-reference/assistants) used for this run.", + "type": "string" + }, + "tools": { + "description": "The list of tools that the [assistant](/docs/api-reference/assistants) used for this run.", + "default": [], + "type": "array", + "maxItems": 20, + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/AssistantToolsCode" + }, + { + "$ref": "#/components/schemas/AssistantToolsFileSearch" + }, + { + "$ref": "#/components/schemas/AssistantToolsFunction" + } + ], + "x-oaiExpandable": true + } + }, + "metadata": { + "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", + "type": "object", + "x-oaiTypeLabel": "map", + "nullable": true + }, + "usage": { + "$ref": "#/components/schemas/RunCompletionUsage" + }, + "temperature": { + "description": "The sampling temperature used for this run. If not set, defaults to 1.", + "type": "number", + "nullable": true + }, + "top_p": { + "description": "The nucleus sampling value used for this run. If not set, defaults to 1.", + "type": "number", + "nullable": true + }, + "max_prompt_tokens": { + "type": "integer", + "nullable": true, + "description": "The maximum number of prompt tokens specified to have been used over the course of the run.\n", + "minimum": 256 + }, + "max_completion_tokens": { + "type": "integer", + "nullable": true, + "description": "The maximum number of completion tokens specified to have been used over the course of the run.\n", + "minimum": 256 + }, + "truncation_strategy": { + "$ref": "#/components/schemas/TruncationObject", + "nullable": true + }, + "tool_choice": { + "$ref": "#/components/schemas/AssistantsApiToolChoiceOption", + "nullable": true + }, + "parallel_tool_calls": { + "$ref": "#/components/schemas/ParallelToolCalls" + }, + "response_format": { + "$ref": "#/components/schemas/AssistantsApiResponseFormatOption", + "nullable": true + } + }, + "required": [ + "id", + "object", + "created_at", + "thread_id", + "assistant_id", + "status", + "required_action", + "last_error", + "expires_at", + "started_at", + "cancelled_at", + "failed_at", + "completed_at", + "model", + "instructions", + "tools", + "metadata", + "usage", + "incomplete_details", + "max_prompt_tokens", + "max_completion_tokens", + "truncation_strategy", + "tool_choice", + "parallel_tool_calls", + "response_format" + ], + "x-oaiMeta": { + "name": "The run object", + "beta": true, + "example": "{\n \"id\": \"run_abc123\",\n \"object\": \"thread.run\",\n \"created_at\": 1698107661,\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"status\": \"completed\",\n \"started_at\": 1699073476,\n \"expires_at\": null,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": 1699073498,\n \"last_error\": null,\n \"model\": \"gpt-4o\",\n \"instructions\": null,\n \"tools\": [{\"type\": \"file_search\"}, {\"type\": \"code_interpreter\"}],\n \"metadata\": {},\n \"incomplete_details\": null,\n \"usage\": {\n \"prompt_tokens\": 123,\n \"completion_tokens\": 456,\n \"total_tokens\": 579\n },\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"max_prompt_tokens\": 1000,\n \"max_completion_tokens\": 1000,\n \"truncation_strategy\": {\n \"type\": \"auto\",\n \"last_messages\": null\n },\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true\n}\n" + } + }, + "CreateRunRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "assistant_id": { + "description": "The ID of the [assistant](/docs/api-reference/assistants) to use to execute this run.", + "type": "string" + }, + "model": { + "description": "The ID of the [Model](/docs/api-reference/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used.", + "example": "gpt-4o", + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "gpt-4o", + "gpt-4o-2024-08-06", + "gpt-4o-2024-05-13", + "gpt-4o-2024-08-06", + "gpt-4o-mini", + "gpt-4o-mini-2024-07-18", + "gpt-4-turbo", + "gpt-4-turbo-2024-04-09", + "gpt-4-0125-preview", + "gpt-4-turbo-preview", + "gpt-4-1106-preview", + "gpt-4-vision-preview", + "gpt-4", + "gpt-4-0314", + "gpt-4-0613", + "gpt-4-32k", + "gpt-4-32k-0314", + "gpt-4-32k-0613", + "gpt-3.5-turbo", + "gpt-3.5-turbo-16k", + "gpt-3.5-turbo-0613", + "gpt-3.5-turbo-1106", + "gpt-3.5-turbo-0125", + "gpt-3.5-turbo-16k-0613" + ] + } + ], + "x-oaiTypeLabel": "string", + "nullable": true + }, + "instructions": { + "description": "Overrides the [instructions](/docs/api-reference/assistants/createAssistant) of the assistant. This is useful for modifying the behavior on a per-run basis.", + "type": "string", + "nullable": true + }, + "additional_instructions": { + "description": "Appends additional instructions at the end of the instructions for the run. This is useful for modifying the behavior on a per-run basis without overriding other instructions.", + "type": "string", + "nullable": true + }, + "additional_messages": { + "description": "Adds additional messages to the thread before creating the run.", + "type": "array", + "items": { + "$ref": "#/components/schemas/CreateMessageRequest" + }, + "nullable": true + }, + "tools": { + "description": "Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis.", + "nullable": true, + "type": "array", + "maxItems": 20, + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/AssistantToolsCode" + }, + { + "$ref": "#/components/schemas/AssistantToolsFileSearch" + }, + { + "$ref": "#/components/schemas/AssistantToolsFunction" + } + ], + "x-oaiExpandable": true + } + }, + "metadata": { + "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", + "type": "object", + "x-oaiTypeLabel": "map", + "nullable": true + }, + "temperature": { + "type": "number", + "minimum": 0, + "maximum": 2, + "default": 1, + "example": 1, + "nullable": true, + "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n" + }, + "top_p": { + "type": "number", + "minimum": 0, + "maximum": 1, + "default": 1, + "example": 1, + "nullable": true, + "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.\n" + }, + "stream": { + "type": "boolean", + "nullable": true, + "description": "If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message.\n" + }, + "max_prompt_tokens": { + "type": "integer", + "nullable": true, + "description": "The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.\n", + "minimum": 256 + }, + "max_completion_tokens": { + "type": "integer", + "nullable": true, + "description": "The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.\n", + "minimum": 256 + }, + "truncation_strategy": { + "$ref": "#/components/schemas/TruncationObject", + "nullable": true + }, + "tool_choice": { + "$ref": "#/components/schemas/AssistantsApiToolChoiceOption", + "nullable": true + }, + "parallel_tool_calls": { + "$ref": "#/components/schemas/ParallelToolCalls" + }, + "response_format": { + "$ref": "#/components/schemas/AssistantsApiResponseFormatOption", + "nullable": true + } + }, + "required": ["thread_id", "assistant_id"] + }, + "ListRunsResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "example": "list" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RunObject" + } + }, + "first_id": { + "type": "string", + "example": "run_abc123" + }, + "last_id": { + "type": "string", + "example": "run_abc456" + }, + "has_more": { + "type": "boolean", + "example": false + } + }, + "required": ["object", "data", "first_id", "last_id", "has_more"] + }, + "ModifyRunRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "metadata": { + "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", + "type": "object", + "x-oaiTypeLabel": "map", + "nullable": true + } + } + }, + "SubmitToolOutputsRunRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "tool_outputs": { + "description": "A list of tools for which the outputs are being submitted.", + "type": "array", + "items": { + "type": "object", + "properties": { + "tool_call_id": { + "type": "string", + "description": "The ID of the tool call in the `required_action` object within the run object the output is being submitted for." + }, + "output": { + "type": "string", + "description": "The output of the tool call to be submitted to continue the run." + } + } + } + }, + "stream": { + "type": "boolean", + "nullable": true, + "description": "If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message.\n" + } + }, + "required": ["tool_outputs"] + }, + "RunToolCallObject": { + "type": "object", + "description": "Tool call objects", + "properties": { + "id": { + "type": "string", + "description": "The ID of the tool call. This ID must be referenced when you submit the tool outputs in using the [Submit tool outputs to run](/docs/api-reference/runs/submitToolOutputs) endpoint." + }, + "type": { + "type": "string", + "description": "The type of tool call the output is required for. For now, this is always `function`.", + "enum": ["function"] + }, + "function": { + "type": "object", + "description": "The function definition.", + "properties": { + "name": { + "type": "string", + "description": "The name of the function." + }, + "arguments": { + "type": "string", + "description": "The arguments that the model expects you to pass to the function." + } + }, + "required": ["name", "arguments"] + } + }, + "required": ["id", "type", "function"] + }, + "CreateThreadAndRunRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "assistant_id": { + "description": "The ID of the [assistant](/docs/api-reference/assistants) to use to execute this run.", + "type": "string" + }, + "thread": { + "$ref": "#/components/schemas/CreateThreadRequest", + "description": "If no thread is provided, an empty thread will be created." + }, + "model": { + "description": "The ID of the [Model](/docs/api-reference/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used.", + "example": "gpt-4o", + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "gpt-4o", + "gpt-4o-2024-08-06", + "gpt-4o-2024-05-13", + "gpt-4o-2024-08-06", + "gpt-4o-mini", + "gpt-4o-mini-2024-07-18", + "gpt-4-turbo", + "gpt-4-turbo-2024-04-09", + "gpt-4-0125-preview", + "gpt-4-turbo-preview", + "gpt-4-1106-preview", + "gpt-4-vision-preview", + "gpt-4", + "gpt-4-0314", + "gpt-4-0613", + "gpt-4-32k", + "gpt-4-32k-0314", + "gpt-4-32k-0613", + "gpt-3.5-turbo", + "gpt-3.5-turbo-16k", + "gpt-3.5-turbo-0613", + "gpt-3.5-turbo-1106", + "gpt-3.5-turbo-0125", + "gpt-3.5-turbo-16k-0613" + ] + } + ], + "x-oaiTypeLabel": "string", + "nullable": true + }, + "instructions": { + "description": "Override the default system message of the assistant. This is useful for modifying the behavior on a per-run basis.", + "type": "string", + "nullable": true + }, + "tools": { + "description": "Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis.", + "nullable": true, + "type": "array", + "maxItems": 20, + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/AssistantToolsCode" + }, + { + "$ref": "#/components/schemas/AssistantToolsFileSearch" + }, + { + "$ref": "#/components/schemas/AssistantToolsFunction" + } + ] + } + }, + "tool_resources": { + "type": "object", + "description": "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n", + "properties": { + "code_interpreter": { + "type": "object", + "properties": { + "file_ids": { + "type": "array", + "description": "A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n", + "default": [], + "maxItems": 20, + "items": { + "type": "string" + } + } + } + }, + "file_search": { + "type": "object", + "properties": { + "vector_store_ids": { + "type": "array", + "description": "The ID of the [vector store](/docs/api-reference/vector-stores/object) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n", + "maxItems": 1, + "items": { + "type": "string" + } + } + } + } + }, + "nullable": true + }, + "metadata": { + "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", + "type": "object", + "x-oaiTypeLabel": "map", + "nullable": true + }, + "temperature": { + "type": "number", + "minimum": 0, + "maximum": 2, + "default": 1, + "example": 1, + "nullable": true, + "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n" + }, + "top_p": { + "type": "number", + "minimum": 0, + "maximum": 1, + "default": 1, + "example": 1, + "nullable": true, + "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.\n" + }, + "stream": { + "type": "boolean", + "nullable": true, + "description": "If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message.\n" + }, + "max_prompt_tokens": { + "type": "integer", + "nullable": true, + "description": "The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.\n", + "minimum": 256 + }, + "max_completion_tokens": { + "type": "integer", + "nullable": true, + "description": "The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.\n", + "minimum": 256 + }, + "truncation_strategy": { + "$ref": "#/components/schemas/TruncationObject", + "nullable": true + }, + "tool_choice": { + "$ref": "#/components/schemas/AssistantsApiToolChoiceOption", + "nullable": true + }, + "parallel_tool_calls": { + "$ref": "#/components/schemas/ParallelToolCalls" + }, + "response_format": { + "$ref": "#/components/schemas/AssistantsApiResponseFormatOption", + "nullable": true + } + }, + "required": ["thread_id", "assistant_id"] + }, + "ThreadObject": { + "type": "object", + "title": "Thread", + "description": "Represents a thread that contains [messages](/docs/api-reference/messages).", + "properties": { + "id": { + "description": "The identifier, which can be referenced in API endpoints.", + "type": "string" + }, + "object": { + "description": "The object type, which is always `thread`.", + "type": "string", + "enum": ["thread"] + }, + "created_at": { + "description": "The Unix timestamp (in seconds) for when the thread was created.", + "type": "integer" + }, + "tool_resources": { + "type": "object", + "description": "A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n", + "properties": { + "code_interpreter": { + "type": "object", + "properties": { + "file_ids": { + "type": "array", + "description": "A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n", + "default": [], + "maxItems": 20, + "items": { + "type": "string" + } + } + } + }, + "file_search": { + "type": "object", + "properties": { + "vector_store_ids": { + "type": "array", + "description": "The [vector store](/docs/api-reference/vector-stores/object) attached to this thread. There can be a maximum of 1 vector store attached to the thread.\n", + "maxItems": 1, + "items": { + "type": "string" + } + } + } + } + }, + "nullable": true + }, + "metadata": { + "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", + "type": "object", + "x-oaiTypeLabel": "map", + "nullable": true + } + }, + "required": [ + "id", + "object", + "created_at", + "tool_resources", + "metadata" + ], + "x-oaiMeta": { + "name": "The thread object", + "beta": true, + "example": "{\n \"id\": \"thread_abc123\",\n \"object\": \"thread\",\n \"created_at\": 1698107661,\n \"metadata\": {}\n}\n" + } + }, + "CreateThreadRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "messages": { + "description": "A list of [messages](/docs/api-reference/messages) to start the thread with.", + "type": "array", + "items": { + "$ref": "#/components/schemas/CreateMessageRequest" + } + }, + "tool_resources": { + "type": "object", + "description": "A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n", + "properties": { + "code_interpreter": { + "type": "object", + "properties": { + "file_ids": { + "type": "array", + "description": "A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n", + "default": [], + "maxItems": 20, + "items": { + "type": "string" + } + } + } + }, + "file_search": { + "type": "object", + "properties": { + "vector_store_ids": { + "type": "array", + "description": "The [vector store](/docs/api-reference/vector-stores/object) attached to this thread. There can be a maximum of 1 vector store attached to the thread.\n", + "maxItems": 1, + "items": { + "type": "string" + } + }, + "vector_stores": { + "type": "array", + "description": "A helper to create a [vector store](/docs/api-reference/vector-stores/object) with file_ids and attach it to this thread. There can be a maximum of 1 vector store attached to the thread.\n", + "maxItems": 1, + "items": { + "type": "object", + "properties": { + "file_ids": { + "type": "array", + "description": "A list of [file](/docs/api-reference/files) IDs to add to the vector store. There can be a maximum of 10000 files in a vector store.\n", + "maxItems": 10000, + "items": { + "type": "string" + } + }, + "chunking_strategy": { + "type": "object", + "description": "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy.", + "oneOf": [ + { + "type": "object", + "title": "Auto Chunking Strategy", + "description": "The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.", + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "description": "Always `auto`.", + "enum": ["auto"] + } + }, + "required": ["type"] + }, + { + "type": "object", + "title": "Static Chunking Strategy", + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "description": "Always `static`.", + "enum": ["static"] + }, + "static": { + "type": "object", + "additionalProperties": false, + "properties": { + "max_chunk_size_tokens": { + "type": "integer", + "minimum": 100, + "maximum": 4096, + "description": "The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`." + }, + "chunk_overlap_tokens": { + "type": "integer", + "description": "The number of tokens that overlap between chunks. The default value is `400`.\n\nNote that the overlap must not exceed half of `max_chunk_size_tokens`.\n" + } + }, + "required": [ + "max_chunk_size_tokens", + "chunk_overlap_tokens" + ] + } + }, + "required": ["type", "static"] + } + ], + "x-oaiExpandable": true + }, + "metadata": { + "type": "object", + "description": "Set of 16 key-value pairs that can be attached to a vector store. This can be useful for storing additional information about the vector store in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", + "x-oaiTypeLabel": "map" + } + }, + "x-oaiExpandable": true + } + } + }, + "oneOf": [ + { + "required": ["vector_store_ids"] + }, + { + "required": ["vector_stores"] + } + ] + } + }, + "nullable": true + }, + "metadata": { + "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", + "type": "object", + "x-oaiTypeLabel": "map", + "nullable": true + } + } + }, + "ModifyThreadRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "tool_resources": { + "type": "object", + "description": "A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n", + "properties": { + "code_interpreter": { + "type": "object", + "properties": { + "file_ids": { + "type": "array", + "description": "A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n", + "default": [], + "maxItems": 20, + "items": { + "type": "string" + } + } + } + }, + "file_search": { + "type": "object", + "properties": { + "vector_store_ids": { + "type": "array", + "description": "The [vector store](/docs/api-reference/vector-stores/object) attached to this thread. There can be a maximum of 1 vector store attached to the thread.\n", + "maxItems": 1, + "items": { + "type": "string" + } + } + } + } + }, + "nullable": true + }, + "metadata": { + "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", + "type": "object", + "x-oaiTypeLabel": "map", + "nullable": true + } + } + }, + "DeleteThreadResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "deleted": { + "type": "boolean" + }, + "object": { + "type": "string", + "enum": ["thread.deleted"] + } + }, + "required": ["id", "object", "deleted"] + }, + "ListThreadsResponse": { + "properties": { + "object": { + "type": "string", + "example": "list" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ThreadObject" + } + }, + "first_id": { + "type": "string", + "example": "asst_abc123" + }, + "last_id": { + "type": "string", + "example": "asst_abc456" + }, + "has_more": { + "type": "boolean", + "example": false + } + }, + "required": ["object", "data", "first_id", "last_id", "has_more"] + }, + "MessageObject": { + "type": "object", + "title": "The message object", + "description": "Represents a message within a [thread](/docs/api-reference/threads).", + "properties": { + "id": { + "description": "The identifier, which can be referenced in API endpoints.", + "type": "string" + }, + "object": { + "description": "The object type, which is always `thread.message`.", + "type": "string", + "enum": ["thread.message"] + }, + "created_at": { + "description": "The Unix timestamp (in seconds) for when the message was created.", + "type": "integer" + }, + "thread_id": { + "description": "The [thread](/docs/api-reference/threads) ID that this message belongs to.", + "type": "string" + }, + "status": { + "description": "The status of the message, which can be either `in_progress`, `incomplete`, or `completed`.", + "type": "string", + "enum": ["in_progress", "incomplete", "completed"] + }, + "incomplete_details": { + "description": "On an incomplete message, details about why the message is incomplete.", + "type": "object", + "properties": { + "reason": { + "type": "string", + "description": "The reason the message is incomplete.", + "enum": [ + "content_filter", + "max_tokens", + "run_cancelled", + "run_expired", + "run_failed" + ] + } + }, + "nullable": true, + "required": ["reason"] + }, + "completed_at": { + "description": "The Unix timestamp (in seconds) for when the message was completed.", + "type": "integer", + "nullable": true + }, + "incomplete_at": { + "description": "The Unix timestamp (in seconds) for when the message was marked as incomplete.", + "type": "integer", + "nullable": true + }, + "role": { + "description": "The entity that produced the message. One of `user` or `assistant`.", + "type": "string", + "enum": ["user", "assistant"] + }, + "content": { + "description": "The content of the message in array of text and/or images.", + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/MessageContentImageFileObject" + }, + { + "$ref": "#/components/schemas/MessageContentImageUrlObject" + }, + { + "$ref": "#/components/schemas/MessageContentTextObject" + }, + { + "$ref": "#/components/schemas/MessageContentRefusalObject" + } + ], + "x-oaiExpandable": true + } + }, + "assistant_id": { + "description": "If applicable, the ID of the [assistant](/docs/api-reference/assistants) that authored this message.", + "type": "string", + "nullable": true + }, + "run_id": { + "description": "The ID of the [run](/docs/api-reference/runs) associated with the creation of this message. Value is `null` when messages are created manually using the create message or create thread endpoints.", + "type": "string", + "nullable": true + }, + "attachments": { + "type": "array", + "items": { + "type": "object", + "properties": { + "file_id": { + "type": "string", + "description": "The ID of the file to attach to the message." + }, + "tools": { + "description": "The tools to add this file to.", + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/AssistantToolsCode" + }, + { + "$ref": "#/components/schemas/AssistantToolsFileSearchTypeOnly" + } + ], + "x-oaiExpandable": true + } + } + } + }, + "description": "A list of files attached to the message, and the tools they were added to.", + "nullable": true + }, + "metadata": { + "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", + "type": "object", + "x-oaiTypeLabel": "map", + "nullable": true + } + }, + "required": [ + "id", + "object", + "created_at", + "thread_id", + "status", + "incomplete_details", + "completed_at", + "incomplete_at", + "role", + "content", + "assistant_id", + "run_id", + "attachments", + "metadata" + ], + "x-oaiMeta": { + "name": "The message object", + "beta": true, + "example": "{\n \"id\": \"msg_abc123\",\n \"object\": \"thread.message\",\n \"created_at\": 1698983503,\n \"thread_id\": \"thread_abc123\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": {\n \"value\": \"Hi! How can I help you today?\",\n \"annotations\": []\n }\n }\n ],\n \"assistant_id\": \"asst_abc123\",\n \"run_id\": \"run_abc123\",\n \"attachments\": [],\n \"metadata\": {}\n}\n" + } + }, + "MessageDeltaObject": { + "type": "object", + "title": "Message delta object", + "description": "Represents a message delta i.e. any changed fields on a message during streaming.\n", + "properties": { + "id": { + "description": "The identifier of the message, which can be referenced in API endpoints.", + "type": "string" + }, + "object": { + "description": "The object type, which is always `thread.message.delta`.", + "type": "string", + "enum": ["thread.message.delta"] + }, + "delta": { + "description": "The delta containing the fields that have changed on the Message.", + "type": "object", + "properties": { + "role": { + "description": "The entity that produced the message. One of `user` or `assistant`.", + "type": "string", + "enum": ["user", "assistant"] + }, + "content": { + "description": "The content of the message in array of text and/or images.", + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/MessageDeltaContentImageFileObject" + }, + { + "$ref": "#/components/schemas/MessageDeltaContentTextObject" + }, + { + "$ref": "#/components/schemas/MessageDeltaContentRefusalObject" + }, + { + "$ref": "#/components/schemas/MessageDeltaContentImageUrlObject" + } + ], + "x-oaiExpandable": true + } + } + } + } + }, + "required": ["id", "object", "delta"], + "x-oaiMeta": { + "name": "The message delta object", + "beta": true, + "example": "{\n \"id\": \"msg_123\",\n \"object\": \"thread.message.delta\",\n \"delta\": {\n \"content\": [\n {\n \"index\": 0,\n \"type\": \"text\",\n \"text\": { \"value\": \"Hello\", \"annotations\": [] }\n }\n ]\n }\n}\n" + } + }, + "CreateMessageRequest": { + "type": "object", + "additionalProperties": false, + "required": ["role", "content"], + "properties": { + "role": { + "type": "string", + "enum": ["user", "assistant"], + "description": "The role of the entity that is creating the message. Allowed values include:\n- `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages.\n- `assistant`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation.\n" + }, + "content": { + "oneOf": [ + { + "type": "string", + "description": "The text contents of the message.", + "title": "Text content" + }, + { + "type": "array", + "description": "An array of content parts with a defined type, each can be of type `text` or images can be passed with `image_url` or `image_file`. Image types are only supported on [Vision-compatible models](/docs/models/overview).", + "title": "Array of content parts", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/MessageContentImageFileObject" + }, + { + "$ref": "#/components/schemas/MessageContentImageUrlObject" + }, + { + "$ref": "#/components/schemas/MessageRequestContentTextObject" + } + ], + "x-oaiExpandable": true + }, + "minItems": 1 + } + ], + "x-oaiExpandable": true + }, + "attachments": { + "type": "array", + "items": { + "type": "object", + "properties": { + "file_id": { + "type": "string", + "description": "The ID of the file to attach to the message." + }, + "tools": { + "description": "The tools to add this file to.", + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/AssistantToolsCode" + }, + { + "$ref": "#/components/schemas/AssistantToolsFileSearchTypeOnly" + } + ], + "x-oaiExpandable": true + } + } + } + }, + "description": "A list of files attached to the message, and the tools they should be added to.", + "required": ["file_id", "tools"], + "nullable": true + }, + "metadata": { + "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", + "type": "object", + "x-oaiTypeLabel": "map", + "nullable": true + } + } + }, + "ModifyMessageRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "metadata": { + "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", + "type": "object", + "x-oaiTypeLabel": "map", + "nullable": true + } + } + }, + "DeleteMessageResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "deleted": { + "type": "boolean" + }, + "object": { + "type": "string", + "enum": ["thread.message.deleted"] + } + }, + "required": ["id", "object", "deleted"] + }, + "ListMessagesResponse": { + "properties": { + "object": { + "type": "string", + "example": "list" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/MessageObject" + } + }, + "first_id": { + "type": "string", + "example": "msg_abc123" + }, + "last_id": { + "type": "string", + "example": "msg_abc123" + }, + "has_more": { + "type": "boolean", + "example": false + } + }, + "required": ["object", "data", "first_id", "last_id", "has_more"] + }, + "MessageContentImageFileObject": { + "title": "Image file", + "type": "object", + "description": "References an image [File](/docs/api-reference/files) in the content of a message.", + "properties": { + "type": { + "description": "Always `image_file`.", + "type": "string", + "enum": ["image_file"] + }, + "image_file": { + "type": "object", + "properties": { + "file_id": { + "description": "The [File](/docs/api-reference/files) ID of the image in the message content. Set `purpose=\"vision\"` when uploading the File if you need to later display the file content.", + "type": "string" + }, + "detail": { + "type": "string", + "description": "Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`.", + "enum": ["auto", "low", "high"], + "default": "auto" + } + }, + "required": ["file_id"] + } + }, + "required": ["type", "image_file"] + }, + "MessageDeltaContentImageFileObject": { + "title": "Image file", + "type": "object", + "description": "References an image [File](/docs/api-reference/files) in the content of a message.", + "properties": { + "index": { + "type": "integer", + "description": "The index of the content part in the message." + }, + "type": { + "description": "Always `image_file`.", + "type": "string", + "enum": ["image_file"] + }, + "image_file": { + "type": "object", + "properties": { + "file_id": { + "description": "The [File](/docs/api-reference/files) ID of the image in the message content. Set `purpose=\"vision\"` when uploading the File if you need to later display the file content.", + "type": "string" + }, + "detail": { + "type": "string", + "description": "Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`.", + "enum": ["auto", "low", "high"], + "default": "auto" + } + } + } + }, + "required": ["index", "type"] + }, + "MessageContentImageUrlObject": { + "title": "Image URL", + "type": "object", + "description": "References an image URL in the content of a message.", + "properties": { + "type": { + "type": "string", + "enum": ["image_url"], + "description": "The type of the content part." + }, + "image_url": { + "type": "object", + "properties": { + "url": { + "type": "string", + "description": "The external URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp.", + "format": "uri" + }, + "detail": { + "type": "string", + "description": "Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. Default value is `auto`", + "enum": ["auto", "low", "high"], + "default": "auto" + } + }, + "required": ["url"] + } + }, + "required": ["type", "image_url"] + }, + "MessageDeltaContentImageUrlObject": { + "title": "Image URL", + "type": "object", + "description": "References an image URL in the content of a message.", + "properties": { + "index": { + "type": "integer", + "description": "The index of the content part in the message." + }, + "type": { + "description": "Always `image_url`.", + "type": "string", + "enum": ["image_url"] + }, + "image_url": { + "type": "object", + "properties": { + "url": { + "description": "The URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp.", + "type": "string" + }, + "detail": { + "type": "string", + "description": "Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`.", + "enum": ["auto", "low", "high"], + "default": "auto" + } + } + } + }, + "required": ["index", "type"] + }, + "MessageContentTextObject": { + "title": "Text", + "type": "object", + "description": "The text content that is part of a message.", + "properties": { + "type": { + "description": "Always `text`.", + "type": "string", + "enum": ["text"] + }, + "text": { + "type": "object", + "properties": { + "value": { + "description": "The data that makes up the text.", + "type": "string" + }, + "annotations": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/MessageContentTextAnnotationsFileCitationObject" + }, + { + "$ref": "#/components/schemas/MessageContentTextAnnotationsFilePathObject" + } + ], + "x-oaiExpandable": true + } + } + }, + "required": ["value", "annotations"] + } + }, + "required": ["type", "text"] + }, + "MessageContentRefusalObject": { + "title": "Refusal", + "type": "object", + "description": "The refusal content generated by the assistant.", + "properties": { + "type": { + "description": "Always `refusal`.", + "type": "string", + "enum": ["refusal"] + }, + "refusal": { + "type": "string", + "nullable": false + } + }, + "required": ["type", "refusal"] + }, + "MessageRequestContentTextObject": { + "title": "Text", + "type": "object", + "description": "The text content that is part of a message.", + "properties": { + "type": { + "description": "Always `text`.", + "type": "string", + "enum": ["text"] + }, + "text": { + "type": "string", + "description": "Text content to be sent to the model" + } + }, + "required": ["type", "text"] + }, + "MessageContentTextAnnotationsFileCitationObject": { + "title": "File citation", + "type": "object", + "description": "A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the \"file_search\" tool to search files.", + "properties": { + "type": { + "description": "Always `file_citation`.", + "type": "string", + "enum": ["file_citation"] + }, + "text": { + "description": "The text in the message content that needs to be replaced.", + "type": "string" + }, + "file_citation": { + "type": "object", + "properties": { + "file_id": { + "description": "The ID of the specific File the citation is from.", + "type": "string" + } + }, + "required": ["file_id"] + }, + "start_index": { + "type": "integer", + "minimum": 0 + }, + "end_index": { + "type": "integer", + "minimum": 0 + } + }, + "required": [ + "type", + "text", + "file_citation", + "start_index", + "end_index" + ] + }, + "MessageContentTextAnnotationsFilePathObject": { + "title": "File path", + "type": "object", + "description": "A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.", + "properties": { + "type": { + "description": "Always `file_path`.", + "type": "string", + "enum": ["file_path"] + }, + "text": { + "description": "The text in the message content that needs to be replaced.", + "type": "string" + }, + "file_path": { + "type": "object", + "properties": { + "file_id": { + "description": "The ID of the file that was generated.", + "type": "string" + } + }, + "required": ["file_id"] + }, + "start_index": { + "type": "integer", + "minimum": 0 + }, + "end_index": { + "type": "integer", + "minimum": 0 + } + }, + "required": ["type", "text", "file_path", "start_index", "end_index"] + }, + "MessageDeltaContentTextObject": { + "title": "Text", + "type": "object", + "description": "The text content that is part of a message.", + "properties": { + "index": { + "type": "integer", + "description": "The index of the content part in the message." + }, + "type": { + "description": "Always `text`.", + "type": "string", + "enum": ["text"] + }, + "text": { + "type": "object", + "properties": { + "value": { + "description": "The data that makes up the text.", + "type": "string" + }, + "annotations": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/MessageDeltaContentTextAnnotationsFileCitationObject" + }, + { + "$ref": "#/components/schemas/MessageDeltaContentTextAnnotationsFilePathObject" + } + ], + "x-oaiExpandable": true + } + } + } + } + }, + "required": ["index", "type"] + }, + "MessageDeltaContentRefusalObject": { + "title": "Refusal", + "type": "object", + "description": "The refusal content that is part of a message.", + "properties": { + "index": { + "type": "integer", + "description": "The index of the refusal part in the message." + }, + "type": { + "description": "Always `refusal`.", + "type": "string", + "enum": ["refusal"] + }, + "refusal": { + "type": "string" + } + }, + "required": ["index", "type"] + }, + "MessageDeltaContentTextAnnotationsFileCitationObject": { + "title": "File citation", + "type": "object", + "description": "A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the \"file_search\" tool to search files.", + "properties": { + "index": { + "type": "integer", + "description": "The index of the annotation in the text content part." + }, + "type": { + "description": "Always `file_citation`.", + "type": "string", + "enum": ["file_citation"] + }, + "text": { + "description": "The text in the message content that needs to be replaced.", + "type": "string" + }, + "file_citation": { + "type": "object", + "properties": { + "file_id": { + "description": "The ID of the specific File the citation is from.", + "type": "string" + }, + "quote": { + "description": "The specific quote in the file.", + "type": "string" + } + } + }, + "start_index": { + "type": "integer", + "minimum": 0 + }, + "end_index": { + "type": "integer", + "minimum": 0 + } + }, + "required": ["index", "type"] + }, + "MessageDeltaContentTextAnnotationsFilePathObject": { + "title": "File path", + "type": "object", + "description": "A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.", + "properties": { + "index": { + "type": "integer", + "description": "The index of the annotation in the text content part." + }, + "type": { + "description": "Always `file_path`.", + "type": "string", + "enum": ["file_path"] + }, + "text": { + "description": "The text in the message content that needs to be replaced.", + "type": "string" + }, + "file_path": { + "type": "object", + "properties": { + "file_id": { + "description": "The ID of the file that was generated.", + "type": "string" + } + } + }, + "start_index": { + "type": "integer", + "minimum": 0 + }, + "end_index": { + "type": "integer", + "minimum": 0 + } + }, + "required": ["index", "type"] + }, + "RunStepObject": { + "type": "object", + "title": "Run steps", + "description": "Represents a step in execution of a run.\n", + "properties": { + "id": { + "description": "The identifier of the run step, which can be referenced in API endpoints.", + "type": "string" + }, + "object": { + "description": "The object type, which is always `thread.run.step`.", + "type": "string", + "enum": ["thread.run.step"] + }, + "created_at": { + "description": "The Unix timestamp (in seconds) for when the run step was created.", + "type": "integer" + }, + "assistant_id": { + "description": "The ID of the [assistant](/docs/api-reference/assistants) associated with the run step.", + "type": "string" + }, + "thread_id": { + "description": "The ID of the [thread](/docs/api-reference/threads) that was run.", + "type": "string" + }, + "run_id": { + "description": "The ID of the [run](/docs/api-reference/runs) that this run step is a part of.", + "type": "string" + }, + "type": { + "description": "The type of run step, which can be either `message_creation` or `tool_calls`.", + "type": "string", + "enum": ["message_creation", "tool_calls"] + }, + "status": { + "description": "The status of the run step, which can be either `in_progress`, `cancelled`, `failed`, `completed`, or `expired`.", + "type": "string", + "enum": [ + "in_progress", + "cancelled", + "failed", + "completed", + "expired" + ] + }, + "step_details": { + "type": "object", + "description": "The details of the run step.", + "oneOf": [ + { + "$ref": "#/components/schemas/RunStepDetailsMessageCreationObject" + }, + { + "$ref": "#/components/schemas/RunStepDetailsToolCallsObject" + } + ], + "x-oaiExpandable": true + }, + "last_error": { + "type": "object", + "description": "The last error associated with this run step. Will be `null` if there are no errors.", + "nullable": true, + "properties": { + "code": { + "type": "string", + "description": "One of `server_error` or `rate_limit_exceeded`.", + "enum": ["server_error", "rate_limit_exceeded"] + }, + "message": { + "type": "string", + "description": "A human-readable description of the error." + } + }, + "required": ["code", "message"] + }, + "expired_at": { + "description": "The Unix timestamp (in seconds) for when the run step expired. A step is considered expired if the parent run is expired.", + "type": "integer", + "nullable": true + }, + "cancelled_at": { + "description": "The Unix timestamp (in seconds) for when the run step was cancelled.", + "type": "integer", + "nullable": true + }, + "failed_at": { + "description": "The Unix timestamp (in seconds) for when the run step failed.", + "type": "integer", + "nullable": true + }, + "completed_at": { + "description": "The Unix timestamp (in seconds) for when the run step completed.", + "type": "integer", + "nullable": true + }, + "metadata": { + "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", + "type": "object", + "x-oaiTypeLabel": "map", + "nullable": true + }, + "usage": { + "$ref": "#/components/schemas/RunStepCompletionUsage" + } + }, + "required": [ + "id", + "object", + "created_at", + "assistant_id", + "thread_id", + "run_id", + "type", + "status", + "step_details", + "last_error", + "expired_at", + "cancelled_at", + "failed_at", + "completed_at", + "metadata", + "usage" + ], + "x-oaiMeta": { + "name": "The run step object", + "beta": true, + "example": "{\n \"id\": \"step_abc123\",\n \"object\": \"thread.run.step\",\n \"created_at\": 1699063291,\n \"run_id\": \"run_abc123\",\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"type\": \"message_creation\",\n \"status\": \"completed\",\n \"cancelled_at\": null,\n \"completed_at\": 1699063291,\n \"expired_at\": null,\n \"failed_at\": null,\n \"last_error\": null,\n \"step_details\": {\n \"type\": \"message_creation\",\n \"message_creation\": {\n \"message_id\": \"msg_abc123\"\n }\n },\n \"usage\": {\n \"prompt_tokens\": 123,\n \"completion_tokens\": 456,\n \"total_tokens\": 579\n }\n}\n" + } + }, + "RunStepDeltaObject": { + "type": "object", + "title": "Run step delta object", + "description": "Represents a run step delta i.e. any changed fields on a run step during streaming.\n", + "properties": { + "id": { + "description": "The identifier of the run step, which can be referenced in API endpoints.", + "type": "string" + }, + "object": { + "description": "The object type, which is always `thread.run.step.delta`.", + "type": "string", + "enum": ["thread.run.step.delta"] + }, + "delta": { + "description": "The delta containing the fields that have changed on the run step.", + "type": "object", + "properties": { + "step_details": { + "type": "object", + "description": "The details of the run step.", + "oneOf": [ + { + "$ref": "#/components/schemas/RunStepDeltaStepDetailsMessageCreationObject" + }, + { + "$ref": "#/components/schemas/RunStepDeltaStepDetailsToolCallsObject" + } + ], + "x-oaiExpandable": true + } + } + } + }, + "required": ["id", "object", "delta"], + "x-oaiMeta": { + "name": "The run step delta object", + "beta": true, + "example": "{\n \"id\": \"step_123\",\n \"object\": \"thread.run.step.delta\",\n \"delta\": {\n \"step_details\": {\n \"type\": \"tool_calls\",\n \"tool_calls\": [\n {\n \"index\": 0,\n \"id\": \"call_123\",\n \"type\": \"code_interpreter\",\n \"code_interpreter\": { \"input\": \"\", \"outputs\": [] }\n }\n ]\n }\n }\n}\n" + } + }, + "ListRunStepsResponse": { + "properties": { + "object": { + "type": "string", + "example": "list" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RunStepObject" + } + }, + "first_id": { + "type": "string", + "example": "step_abc123" + }, + "last_id": { + "type": "string", + "example": "step_abc456" + }, + "has_more": { + "type": "boolean", + "example": false + } + }, + "required": ["object", "data", "first_id", "last_id", "has_more"] + }, + "RunStepDetailsMessageCreationObject": { + "title": "Message creation", + "type": "object", + "description": "Details of the message creation by the run step.", + "properties": { + "type": { + "description": "Always `message_creation`.", + "type": "string", + "enum": ["message_creation"] + }, + "message_creation": { + "type": "object", + "properties": { + "message_id": { + "type": "string", + "description": "The ID of the message that was created by this run step." + } + }, + "required": ["message_id"] + } + }, + "required": ["type", "message_creation"] + }, + "RunStepDeltaStepDetailsMessageCreationObject": { + "title": "Message creation", + "type": "object", + "description": "Details of the message creation by the run step.", + "properties": { + "type": { + "description": "Always `message_creation`.", + "type": "string", + "enum": ["message_creation"] + }, + "message_creation": { + "type": "object", + "properties": { + "message_id": { + "type": "string", + "description": "The ID of the message that was created by this run step." + } + } + } + }, + "required": ["type"] + }, + "RunStepDetailsToolCallsObject": { + "title": "Tool calls", + "type": "object", + "description": "Details of the tool call.", + "properties": { + "type": { + "description": "Always `tool_calls`.", + "type": "string", + "enum": ["tool_calls"] + }, + "tool_calls": { + "type": "array", + "description": "An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `file_search`, or `function`.\n", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/RunStepDetailsToolCallsCodeObject" + }, + { + "$ref": "#/components/schemas/RunStepDetailsToolCallsFileSearchObject" + }, + { + "$ref": "#/components/schemas/RunStepDetailsToolCallsFunctionObject" + } + ], + "x-oaiExpandable": true + } + } + }, + "required": ["type", "tool_calls"] + }, + "RunStepDeltaStepDetailsToolCallsObject": { + "title": "Tool calls", + "type": "object", + "description": "Details of the tool call.", + "properties": { + "type": { + "description": "Always `tool_calls`.", + "type": "string", + "enum": ["tool_calls"] + }, + "tool_calls": { + "type": "array", + "description": "An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `file_search`, or `function`.\n", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/RunStepDeltaStepDetailsToolCallsCodeObject" + }, + { + "$ref": "#/components/schemas/RunStepDeltaStepDetailsToolCallsFileSearchObject" + }, + { + "$ref": "#/components/schemas/RunStepDeltaStepDetailsToolCallsFunctionObject" + } + ], + "x-oaiExpandable": true + } + } + }, + "required": ["type"] + }, + "RunStepDetailsToolCallsCodeObject": { + "title": "Code Interpreter tool call", + "type": "object", + "description": "Details of the Code Interpreter tool call the run step was involved in.", + "properties": { + "id": { + "type": "string", + "description": "The ID of the tool call." + }, + "type": { + "type": "string", + "description": "The type of tool call. This is always going to be `code_interpreter` for this type of tool call.", + "enum": ["code_interpreter"] + }, + "code_interpreter": { + "type": "object", + "description": "The Code Interpreter tool call definition.", + "required": ["input", "outputs"], + "properties": { + "input": { + "type": "string", + "description": "The input to the Code Interpreter tool call." + }, + "outputs": { + "type": "array", + "description": "The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type.", + "items": { + "type": "object", + "oneOf": [ + { + "$ref": "#/components/schemas/RunStepDetailsToolCallsCodeOutputLogsObject" + }, + { + "$ref": "#/components/schemas/RunStepDetailsToolCallsCodeOutputImageObject" + } + ], + "x-oaiExpandable": true + } + } + } + } + }, + "required": ["id", "type", "code_interpreter"] + }, + "RunStepDeltaStepDetailsToolCallsCodeObject": { + "title": "Code interpreter tool call", + "type": "object", + "description": "Details of the Code Interpreter tool call the run step was involved in.", + "properties": { + "index": { + "type": "integer", + "description": "The index of the tool call in the tool calls array." + }, + "id": { + "type": "string", + "description": "The ID of the tool call." + }, + "type": { + "type": "string", + "description": "The type of tool call. This is always going to be `code_interpreter` for this type of tool call.", + "enum": ["code_interpreter"] + }, + "code_interpreter": { + "type": "object", + "description": "The Code Interpreter tool call definition.", + "properties": { + "input": { + "type": "string", + "description": "The input to the Code Interpreter tool call." + }, + "outputs": { + "type": "array", + "description": "The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type.", + "items": { + "type": "object", + "oneOf": [ + { + "$ref": "#/components/schemas/RunStepDeltaStepDetailsToolCallsCodeOutputLogsObject" + }, + { + "$ref": "#/components/schemas/RunStepDeltaStepDetailsToolCallsCodeOutputImageObject" + } + ], + "x-oaiExpandable": true + } + } + } + } + }, + "required": ["index", "type"] + }, + "RunStepDetailsToolCallsCodeOutputLogsObject": { + "title": "Code Interpreter log output", + "type": "object", + "description": "Text output from the Code Interpreter tool call as part of a run step.", + "properties": { + "type": { + "description": "Always `logs`.", + "type": "string", + "enum": ["logs"] + }, + "logs": { + "type": "string", + "description": "The text output from the Code Interpreter tool call." + } + }, + "required": ["type", "logs"] + }, + "RunStepDeltaStepDetailsToolCallsCodeOutputLogsObject": { + "title": "Code interpreter log output", + "type": "object", + "description": "Text output from the Code Interpreter tool call as part of a run step.", + "properties": { + "index": { + "type": "integer", + "description": "The index of the output in the outputs array." + }, + "type": { + "description": "Always `logs`.", + "type": "string", + "enum": ["logs"] + }, + "logs": { + "type": "string", + "description": "The text output from the Code Interpreter tool call." + } + }, + "required": ["index", "type"] + }, + "RunStepDetailsToolCallsCodeOutputImageObject": { + "title": "Code Interpreter image output", + "type": "object", + "properties": { + "type": { + "description": "Always `image`.", + "type": "string", + "enum": ["image"] + }, + "image": { + "type": "object", + "properties": { + "file_id": { + "description": "The [file](/docs/api-reference/files) ID of the image.", + "type": "string" + } + }, + "required": ["file_id"] + } + }, + "required": ["type", "image"] + }, + "RunStepDeltaStepDetailsToolCallsCodeOutputImageObject": { + "title": "Code interpreter image output", + "type": "object", + "properties": { + "index": { + "type": "integer", + "description": "The index of the output in the outputs array." + }, + "type": { + "description": "Always `image`.", + "type": "string", + "enum": ["image"] + }, + "image": { + "type": "object", + "properties": { + "file_id": { + "description": "The [file](/docs/api-reference/files) ID of the image.", + "type": "string" + } + } + } + }, + "required": ["index", "type"] + }, + "RunStepDetailsToolCallsFileSearchObject": { + "title": "File search tool call", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The ID of the tool call object." + }, + "type": { + "type": "string", + "description": "The type of tool call. This is always going to be `file_search` for this type of tool call.", + "enum": ["file_search"] + }, + "file_search": { + "type": "object", + "description": "For now, this is always going to be an empty object.", + "x-oaiTypeLabel": "map", + "properties": { + "ranking_options": { + "$ref": "#/components/schemas/RunStepDetailsToolCallsFileSearchRankingOptionsObject" + }, + "results": { + "type": "array", + "description": "The results of the file search.", + "items": { + "$ref": "#/components/schemas/RunStepDetailsToolCallsFileSearchResultObject" + } + } + } + } + }, + "required": ["id", "type", "file_search"] + }, + "RunStepDetailsToolCallsFileSearchRankingOptionsObject": { + "title": "File search tool call ranking options", + "type": "object", + "description": "The ranking options for the file search.", + "properties": { + "ranker": { + "type": "string", + "description": "The ranker used for the file search.", + "enum": ["default_2024_08_21"] + }, + "score_threshold": { + "type": "number", + "description": "The score threshold for the file search. All values must be a floating point number between 0 and 1.", + "minimum": 0, + "maximum": 1 + } + }, + "required": ["ranker", "score_threshold"] + }, + "RunStepDetailsToolCallsFileSearchResultObject": { + "title": "File search tool call result", + "type": "object", + "description": "A result instance of the file search.", + "x-oaiTypeLabel": "map", + "properties": { + "file_id": { + "type": "string", + "description": "The ID of the file that result was found in." + }, + "file_name": { + "type": "string", + "description": "The name of the file that result was found in." + }, + "score": { + "type": "number", + "description": "The score of the result. All values must be a floating point number between 0 and 1.", + "minimum": 0, + "maximum": 1 + }, + "content": { + "type": "array", + "description": "The content of the result that was found. The content is only included if requested via the include query parameter.", + "items": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The type of the content.", + "enum": ["text"] + }, + "text": { + "type": "string", + "description": "The text content of the file." + } + } + } + } + }, + "required": ["file_id", "file_name", "score"] + }, + "RunStepDeltaStepDetailsToolCallsFileSearchObject": { + "title": "File search tool call", + "type": "object", + "properties": { + "index": { + "type": "integer", + "description": "The index of the tool call in the tool calls array." + }, + "id": { + "type": "string", + "description": "The ID of the tool call object." + }, + "type": { + "type": "string", + "description": "The type of tool call. This is always going to be `file_search` for this type of tool call.", + "enum": ["file_search"] + }, + "file_search": { + "type": "object", + "description": "For now, this is always going to be an empty object.", + "x-oaiTypeLabel": "map" + } + }, + "required": ["index", "type", "file_search"] + }, + "RunStepDetailsToolCallsFunctionObject": { + "type": "object", + "title": "Function tool call", + "properties": { + "id": { + "type": "string", + "description": "The ID of the tool call object." + }, + "type": { + "type": "string", + "description": "The type of tool call. This is always going to be `function` for this type of tool call.", + "enum": ["function"] + }, + "function": { + "type": "object", + "description": "The definition of the function that was called.", + "properties": { + "name": { + "type": "string", + "description": "The name of the function." + }, + "arguments": { + "type": "string", + "description": "The arguments passed to the function." + }, + "output": { + "type": "string", + "description": "The output of the function. This will be `null` if the outputs have not been [submitted](/docs/api-reference/runs/submitToolOutputs) yet.", + "nullable": true + } + }, + "required": ["name", "arguments", "output"] + } + }, + "required": ["id", "type", "function"] + }, + "RunStepDeltaStepDetailsToolCallsFunctionObject": { + "type": "object", + "title": "Function tool call", + "properties": { + "index": { + "type": "integer", + "description": "The index of the tool call in the tool calls array." + }, + "id": { + "type": "string", + "description": "The ID of the tool call object." + }, + "type": { + "type": "string", + "description": "The type of tool call. This is always going to be `function` for this type of tool call.", + "enum": ["function"] + }, + "function": { + "type": "object", + "description": "The definition of the function that was called.", + "properties": { + "name": { + "type": "string", + "description": "The name of the function." + }, + "arguments": { + "type": "string", + "description": "The arguments passed to the function." + }, + "output": { + "type": "string", + "description": "The output of the function. This will be `null` if the outputs have not been [submitted](/docs/api-reference/runs/submitToolOutputs) yet.", + "nullable": true + } + } + } + }, + "required": ["index", "type"] + }, + "VectorStoreExpirationAfter": { + "type": "object", + "title": "Vector store expiration policy", + "description": "The expiration policy for a vector store.", + "properties": { + "anchor": { + "description": "Anchor timestamp after which the expiration policy applies. Supported anchors: `last_active_at`.", + "type": "string", + "enum": ["last_active_at"] + }, + "days": { + "description": "The number of days after the anchor time that the vector store will expire.", + "type": "integer", + "minimum": 1, + "maximum": 365 + } + }, + "required": ["anchor", "days"] + }, + "VectorStoreObject": { + "type": "object", + "title": "Vector store", + "description": "A vector store is a collection of processed files can be used by the `file_search` tool.", + "properties": { + "id": { + "description": "The identifier, which can be referenced in API endpoints.", + "type": "string" + }, + "object": { + "description": "The object type, which is always `vector_store`.", + "type": "string", + "enum": ["vector_store"] + }, + "created_at": { + "description": "The Unix timestamp (in seconds) for when the vector store was created.", + "type": "integer" + }, + "name": { + "description": "The name of the vector store.", + "type": "string" + }, + "usage_bytes": { + "description": "The total number of bytes used by the files in the vector store.", + "type": "integer" + }, + "file_counts": { + "type": "object", + "properties": { + "in_progress": { + "description": "The number of files that are currently being processed.", + "type": "integer" + }, + "completed": { + "description": "The number of files that have been successfully processed.", + "type": "integer" + }, + "failed": { + "description": "The number of files that have failed to process.", + "type": "integer" + }, + "cancelled": { + "description": "The number of files that were cancelled.", + "type": "integer" + }, + "total": { + "description": "The total number of files.", + "type": "integer" + } + }, + "required": [ + "in_progress", + "completed", + "failed", + "cancelled", + "total" + ] + }, + "status": { + "description": "The status of the vector store, which can be either `expired`, `in_progress`, or `completed`. A status of `completed` indicates that the vector store is ready for use.", + "type": "string", + "enum": ["expired", "in_progress", "completed"] + }, + "expires_after": { + "$ref": "#/components/schemas/VectorStoreExpirationAfter" + }, + "expires_at": { + "description": "The Unix timestamp (in seconds) for when the vector store will expire.", + "type": "integer", + "nullable": true + }, + "last_active_at": { + "description": "The Unix timestamp (in seconds) for when the vector store was last active.", + "type": "integer", + "nullable": true + }, + "metadata": { + "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", + "type": "object", + "x-oaiTypeLabel": "map", + "nullable": true + } + }, + "required": [ + "id", + "object", + "usage_bytes", + "created_at", + "status", + "last_active_at", + "name", + "file_counts", + "metadata" + ], + "x-oaiMeta": { + "name": "The vector store object", + "beta": true, + "example": "{\n \"id\": \"vs_123\",\n \"object\": \"vector_store\",\n \"created_at\": 1698107661,\n \"usage_bytes\": 123456,\n \"last_active_at\": 1698107661,\n \"name\": \"my_vector_store\",\n \"status\": \"completed\",\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 100,\n \"cancelled\": 0,\n \"failed\": 0,\n \"total\": 100\n },\n \"metadata\": {},\n \"last_used_at\": 1698107661\n}\n" + } + }, + "CreateVectorStoreRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "file_ids": { + "description": "A list of [File](/docs/api-reference/files) IDs that the vector store should use. Useful for tools like `file_search` that can access files.", + "type": "array", + "maxItems": 500, + "items": { + "type": "string" + } + }, + "name": { + "description": "The name of the vector store.", + "type": "string" + }, + "expires_after": { + "$ref": "#/components/schemas/VectorStoreExpirationAfter" + }, + "chunking_strategy": { + "type": "object", + "description": "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy. Only applicable if `file_ids` is non-empty.", + "oneOf": [ + { + "$ref": "#/components/schemas/AutoChunkingStrategyRequestParam" + }, + { + "$ref": "#/components/schemas/StaticChunkingStrategyRequestParam" + } + ], + "x-oaiExpandable": true + }, + "metadata": { + "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", + "type": "object", + "x-oaiTypeLabel": "map", + "nullable": true + } + } + }, + "UpdateVectorStoreRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "description": "The name of the vector store.", + "type": "string", + "nullable": true + }, + "expires_after": { + "$ref": "#/components/schemas/VectorStoreExpirationAfter", + "nullable": true + }, + "metadata": { + "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", + "type": "object", + "x-oaiTypeLabel": "map", + "nullable": true + } + } + }, + "ListVectorStoresResponse": { + "properties": { + "object": { + "type": "string", + "example": "list" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/VectorStoreObject" + } + }, + "first_id": { + "type": "string", + "example": "vs_abc123" + }, + "last_id": { + "type": "string", + "example": "vs_abc456" + }, + "has_more": { + "type": "boolean", + "example": false + } + }, + "required": ["object", "data", "first_id", "last_id", "has_more"] + }, + "DeleteVectorStoreResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "deleted": { + "type": "boolean" + }, + "object": { + "type": "string", + "enum": ["vector_store.deleted"] + } + }, + "required": ["id", "object", "deleted"] + }, + "VectorStoreFileObject": { + "type": "object", + "title": "Vector store files", + "description": "A list of files attached to a vector store.", + "properties": { + "id": { + "description": "The identifier, which can be referenced in API endpoints.", + "type": "string" + }, + "object": { + "description": "The object type, which is always `vector_store.file`.", + "type": "string", + "enum": ["vector_store.file"] + }, + "usage_bytes": { + "description": "The total vector store usage in bytes. Note that this may be different from the original file size.", + "type": "integer" + }, + "created_at": { + "description": "The Unix timestamp (in seconds) for when the vector store file was created.", + "type": "integer" + }, + "vector_store_id": { + "description": "The ID of the [vector store](/docs/api-reference/vector-stores/object) that the [File](/docs/api-reference/files) is attached to.", + "type": "string" + }, + "status": { + "description": "The status of the vector store file, which can be either `in_progress`, `completed`, `cancelled`, or `failed`. The status `completed` indicates that the vector store file is ready for use.", + "type": "string", + "enum": ["in_progress", "completed", "cancelled", "failed"] + }, + "last_error": { + "type": "object", + "description": "The last error associated with this vector store file. Will be `null` if there are no errors.", + "nullable": true, + "properties": { + "code": { + "type": "string", + "description": "One of `server_error` or `rate_limit_exceeded`.", + "enum": ["server_error", "unsupported_file", "invalid_file"] + }, + "message": { + "type": "string", + "description": "A human-readable description of the error." + } + }, + "required": ["code", "message"] + }, + "chunking_strategy": { + "type": "object", + "description": "The strategy used to chunk the file.", + "oneOf": [ + { + "$ref": "#/components/schemas/StaticChunkingStrategyResponseParam" + }, + { + "$ref": "#/components/schemas/OtherChunkingStrategyResponseParam" + } + ], + "x-oaiExpandable": true + } + }, + "required": [ + "id", + "object", + "usage_bytes", + "created_at", + "vector_store_id", + "status", + "last_error" + ], + "x-oaiMeta": { + "name": "The vector store file object", + "beta": true, + "example": "{\n \"id\": \"file-abc123\",\n \"object\": \"vector_store.file\",\n \"usage_bytes\": 1234,\n \"created_at\": 1698107661,\n \"vector_store_id\": \"vs_abc123\",\n \"status\": \"completed\",\n \"last_error\": null,\n \"chunking_strategy\": {\n \"type\": \"static\",\n \"static\": {\n \"max_chunk_size_tokens\": 800,\n \"chunk_overlap_tokens\": 400\n }\n }\n}\n" + } + }, + "OtherChunkingStrategyResponseParam": { + "type": "object", + "title": "Other Chunking Strategy", + "description": "This is returned when the chunking strategy is unknown. Typically, this is because the file was indexed before the `chunking_strategy` concept was introduced in the API.", + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "description": "Always `other`.", + "enum": ["other"] + } + }, + "required": ["type"] + }, + "StaticChunkingStrategyResponseParam": { + "type": "object", + "title": "Static Chunking Strategy", + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "description": "Always `static`.", + "enum": ["static"] + }, + "static": { + "$ref": "#/components/schemas/StaticChunkingStrategy" + } + }, + "required": ["type", "static"] + }, + "StaticChunkingStrategy": { + "type": "object", + "additionalProperties": false, + "properties": { + "max_chunk_size_tokens": { + "type": "integer", + "minimum": 100, + "maximum": 4096, + "description": "The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`." + }, + "chunk_overlap_tokens": { + "type": "integer", + "description": "The number of tokens that overlap between chunks. The default value is `400`.\n\nNote that the overlap must not exceed half of `max_chunk_size_tokens`.\n" + } + }, + "required": ["max_chunk_size_tokens", "chunk_overlap_tokens"] + }, + "AutoChunkingStrategyRequestParam": { + "type": "object", + "title": "Auto Chunking Strategy", + "description": "The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.", + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "description": "Always `auto`.", + "enum": ["auto"] + } + }, + "required": ["type"] + }, + "StaticChunkingStrategyRequestParam": { + "type": "object", + "title": "Static Chunking Strategy", + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "description": "Always `static`.", + "enum": ["static"] + }, + "static": { + "$ref": "#/components/schemas/StaticChunkingStrategy" + } + }, + "required": ["type", "static"] + }, + "ChunkingStrategyRequestParam": { + "type": "object", + "description": "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy.", + "oneOf": [ + { + "$ref": "#/components/schemas/AutoChunkingStrategyRequestParam" + }, + { + "$ref": "#/components/schemas/StaticChunkingStrategyRequestParam" + } + ], + "x-oaiExpandable": true + }, + "CreateVectorStoreFileRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "file_id": { + "description": "A [File](/docs/api-reference/files) ID that the vector store should use. Useful for tools like `file_search` that can access files.", + "type": "string" + }, + "chunking_strategy": { + "$ref": "#/components/schemas/ChunkingStrategyRequestParam" + } + }, + "required": ["file_id"] + }, + "ListVectorStoreFilesResponse": { + "properties": { + "object": { + "type": "string", + "example": "list" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/VectorStoreFileObject" + } + }, + "first_id": { + "type": "string", + "example": "file-abc123" + }, + "last_id": { + "type": "string", + "example": "file-abc456" + }, + "has_more": { + "type": "boolean", + "example": false + } + }, + "required": ["object", "data", "first_id", "last_id", "has_more"] + }, + "DeleteVectorStoreFileResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "deleted": { + "type": "boolean" + }, + "object": { + "type": "string", + "enum": ["vector_store.file.deleted"] + } + }, + "required": ["id", "object", "deleted"] + }, + "VectorStoreFileBatchObject": { + "type": "object", + "title": "Vector store file batch", + "description": "A batch of files attached to a vector store.", + "properties": { + "id": { + "description": "The identifier, which can be referenced in API endpoints.", + "type": "string" + }, + "object": { + "description": "The object type, which is always `vector_store.file_batch`.", + "type": "string", + "enum": ["vector_store.files_batch"] + }, + "created_at": { + "description": "The Unix timestamp (in seconds) for when the vector store files batch was created.", + "type": "integer" + }, + "vector_store_id": { + "description": "The ID of the [vector store](/docs/api-reference/vector-stores/object) that the [File](/docs/api-reference/files) is attached to.", + "type": "string" + }, + "status": { + "description": "The status of the vector store files batch, which can be either `in_progress`, `completed`, `cancelled` or `failed`.", + "type": "string", + "enum": ["in_progress", "completed", "cancelled", "failed"] + }, + "file_counts": { + "type": "object", + "properties": { + "in_progress": { + "description": "The number of files that are currently being processed.", + "type": "integer" + }, + "completed": { + "description": "The number of files that have been processed.", + "type": "integer" + }, + "failed": { + "description": "The number of files that have failed to process.", + "type": "integer" + }, + "cancelled": { + "description": "The number of files that where cancelled.", + "type": "integer" + }, + "total": { + "description": "The total number of files.", + "type": "integer" + } + }, + "required": [ + "in_progress", + "completed", + "cancelled", + "failed", + "total" + ] + } + }, + "required": [ + "id", + "object", + "created_at", + "vector_store_id", + "status", + "file_counts" + ], + "x-oaiMeta": { + "name": "The vector store files batch object", + "beta": true, + "example": "{\n \"id\": \"vsfb_123\",\n \"object\": \"vector_store.files_batch\",\n \"created_at\": 1698107661,\n \"vector_store_id\": \"vs_abc123\",\n \"status\": \"completed\",\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 100,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 100\n }\n}\n" + } + }, + "CreateVectorStoreFileBatchRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "file_ids": { + "description": "A list of [File](/docs/api-reference/files) IDs that the vector store should use. Useful for tools like `file_search` that can access files.", + "type": "array", + "minItems": 1, + "maxItems": 500, + "items": { + "type": "string" + } + }, + "chunking_strategy": { + "$ref": "#/components/schemas/ChunkingStrategyRequestParam" + } + }, + "required": ["file_ids"] + }, + "AssistantStreamEvent": { + "description": "Represents an event emitted when streaming a Run.\n\nEach event in a server-sent events stream has an `event` and `data` property:\n\n```\nevent: thread.created\ndata: {\"id\": \"thread_123\", \"object\": \"thread\", ...}\n```\n\nWe emit events whenever a new object is created, transitions to a new state, or is being\nstreamed in parts (deltas). For example, we emit `thread.run.created` when a new run\nis created, `thread.run.completed` when a run completes, and so on. When an Assistant chooses\nto create a message during a run, we emit a `thread.message.created event`, a\n`thread.message.in_progress` event, many `thread.message.delta` events, and finally a\n`thread.message.completed` event.\n\nWe may add additional events over time, so we recommend handling unknown events gracefully\nin your code. See the [Assistants API quickstart](/docs/assistants/overview) to learn how to\nintegrate the Assistants API with streaming.\n", + "oneOf": [ + { + "$ref": "#/components/schemas/ThreadStreamEvent" + }, + { + "$ref": "#/components/schemas/RunStreamEvent" + }, + { + "$ref": "#/components/schemas/RunStepStreamEvent" + }, + { + "$ref": "#/components/schemas/MessageStreamEvent" + }, + { + "$ref": "#/components/schemas/ErrorEvent" + }, + { + "$ref": "#/components/schemas/DoneEvent" + } + ], + "x-oaiMeta": { + "name": "Assistant stream events", + "beta": true + } + }, + "ThreadStreamEvent": { + "oneOf": [ + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": ["thread.created"] + }, + "data": { + "$ref": "#/components/schemas/ThreadObject" + } + }, + "required": ["event", "data"], + "description": "Occurs when a new [thread](/docs/api-reference/threads/object) is created.", + "x-oaiMeta": { + "dataDescription": "`data` is a [thread](/docs/api-reference/threads/object)" + } + } + ] + }, + "RunStreamEvent": { + "oneOf": [ + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": ["thread.run.created"] + }, + "data": { + "$ref": "#/components/schemas/RunObject" + } + }, + "required": ["event", "data"], + "description": "Occurs when a new [run](/docs/api-reference/runs/object) is created.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run](/docs/api-reference/runs/object)" + } + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": ["thread.run.queued"] + }, + "data": { + "$ref": "#/components/schemas/RunObject" + } + }, + "required": ["event", "data"], + "description": "Occurs when a [run](/docs/api-reference/runs/object) moves to a `queued` status.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run](/docs/api-reference/runs/object)" + } + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": ["thread.run.in_progress"] + }, + "data": { + "$ref": "#/components/schemas/RunObject" + } + }, + "required": ["event", "data"], + "description": "Occurs when a [run](/docs/api-reference/runs/object) moves to an `in_progress` status.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run](/docs/api-reference/runs/object)" + } + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": ["thread.run.requires_action"] + }, + "data": { + "$ref": "#/components/schemas/RunObject" + } + }, + "required": ["event", "data"], + "description": "Occurs when a [run](/docs/api-reference/runs/object) moves to a `requires_action` status.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run](/docs/api-reference/runs/object)" + } + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": ["thread.run.completed"] + }, + "data": { + "$ref": "#/components/schemas/RunObject" + } + }, + "required": ["event", "data"], + "description": "Occurs when a [run](/docs/api-reference/runs/object) is completed.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run](/docs/api-reference/runs/object)" + } + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": ["thread.run.incomplete"] + }, + "data": { + "$ref": "#/components/schemas/RunObject" + } + }, + "required": ["event", "data"], + "description": "Occurs when a [run](/docs/api-reference/runs/object) ends with status `incomplete`.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run](/docs/api-reference/runs/object)" + } + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": ["thread.run.failed"] + }, + "data": { + "$ref": "#/components/schemas/RunObject" + } + }, + "required": ["event", "data"], + "description": "Occurs when a [run](/docs/api-reference/runs/object) fails.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run](/docs/api-reference/runs/object)" + } + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": ["thread.run.cancelling"] + }, + "data": { + "$ref": "#/components/schemas/RunObject" + } + }, + "required": ["event", "data"], + "description": "Occurs when a [run](/docs/api-reference/runs/object) moves to a `cancelling` status.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run](/docs/api-reference/runs/object)" + } + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": ["thread.run.cancelled"] + }, + "data": { + "$ref": "#/components/schemas/RunObject" + } + }, + "required": ["event", "data"], + "description": "Occurs when a [run](/docs/api-reference/runs/object) is cancelled.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run](/docs/api-reference/runs/object)" + } + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": ["thread.run.expired"] + }, + "data": { + "$ref": "#/components/schemas/RunObject" + } + }, + "required": ["event", "data"], + "description": "Occurs when a [run](/docs/api-reference/runs/object) expires.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run](/docs/api-reference/runs/object)" + } + } + ] + }, + "RunStepStreamEvent": { + "oneOf": [ + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": ["thread.run.step.created"] + }, + "data": { + "$ref": "#/components/schemas/RunStepObject" + } + }, + "required": ["event", "data"], + "description": "Occurs when a [run step](/docs/api-reference/run-steps/step-object) is created.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run step](/docs/api-reference/run-steps/step-object)" + } + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": ["thread.run.step.in_progress"] + }, + "data": { + "$ref": "#/components/schemas/RunStepObject" + } + }, + "required": ["event", "data"], + "description": "Occurs when a [run step](/docs/api-reference/run-steps/step-object) moves to an `in_progress` state.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run step](/docs/api-reference/run-steps/step-object)" + } + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": ["thread.run.step.delta"] + }, + "data": { + "$ref": "#/components/schemas/RunStepDeltaObject" + } + }, + "required": ["event", "data"], + "description": "Occurs when parts of a [run step](/docs/api-reference/run-steps/step-object) are being streamed.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run step delta](/docs/api-reference/assistants-streaming/run-step-delta-object)" + } + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": ["thread.run.step.completed"] + }, + "data": { + "$ref": "#/components/schemas/RunStepObject" + } + }, + "required": ["event", "data"], + "description": "Occurs when a [run step](/docs/api-reference/run-steps/step-object) is completed.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run step](/docs/api-reference/run-steps/step-object)" + } + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": ["thread.run.step.failed"] + }, + "data": { + "$ref": "#/components/schemas/RunStepObject" + } + }, + "required": ["event", "data"], + "description": "Occurs when a [run step](/docs/api-reference/run-steps/step-object) fails.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run step](/docs/api-reference/run-steps/step-object)" + } + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": ["thread.run.step.cancelled"] + }, + "data": { + "$ref": "#/components/schemas/RunStepObject" + } + }, + "required": ["event", "data"], + "description": "Occurs when a [run step](/docs/api-reference/run-steps/step-object) is cancelled.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run step](/docs/api-reference/run-steps/step-object)" + } + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": ["thread.run.step.expired"] + }, + "data": { + "$ref": "#/components/schemas/RunStepObject" + } + }, + "required": ["event", "data"], + "description": "Occurs when a [run step](/docs/api-reference/run-steps/step-object) expires.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run step](/docs/api-reference/run-steps/step-object)" + } + } + ] + }, + "MessageStreamEvent": { + "oneOf": [ + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": ["thread.message.created"] + }, + "data": { + "$ref": "#/components/schemas/MessageObject" + } + }, + "required": ["event", "data"], + "description": "Occurs when a [message](/docs/api-reference/messages/object) is created.", + "x-oaiMeta": { + "dataDescription": "`data` is a [message](/docs/api-reference/messages/object)" + } + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": ["thread.message.in_progress"] + }, + "data": { + "$ref": "#/components/schemas/MessageObject" + } + }, + "required": ["event", "data"], + "description": "Occurs when a [message](/docs/api-reference/messages/object) moves to an `in_progress` state.", + "x-oaiMeta": { + "dataDescription": "`data` is a [message](/docs/api-reference/messages/object)" + } + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": ["thread.message.delta"] + }, + "data": { + "$ref": "#/components/schemas/MessageDeltaObject" + } + }, + "required": ["event", "data"], + "description": "Occurs when parts of a [Message](/docs/api-reference/messages/object) are being streamed.", + "x-oaiMeta": { + "dataDescription": "`data` is a [message delta](/docs/api-reference/assistants-streaming/message-delta-object)" + } + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": ["thread.message.completed"] + }, + "data": { + "$ref": "#/components/schemas/MessageObject" + } + }, + "required": ["event", "data"], + "description": "Occurs when a [message](/docs/api-reference/messages/object) is completed.", + "x-oaiMeta": { + "dataDescription": "`data` is a [message](/docs/api-reference/messages/object)" + } + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": ["thread.message.incomplete"] + }, + "data": { + "$ref": "#/components/schemas/MessageObject" + } + }, + "required": ["event", "data"], + "description": "Occurs when a [message](/docs/api-reference/messages/object) ends before it is completed.", + "x-oaiMeta": { + "dataDescription": "`data` is a [message](/docs/api-reference/messages/object)" + } + } + ] + }, + "ErrorEvent": { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": ["error"] + }, + "data": { + "$ref": "#/components/schemas/Error" + } + }, + "required": ["event", "data"], + "description": "Occurs when an [error](/docs/guides/error-codes/api-errors) occurs. This can happen due to an internal server error or a timeout.", + "x-oaiMeta": { + "dataDescription": "`data` is an [error](/docs/guides/error-codes/api-errors)" + } + }, + "DoneEvent": { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": ["done"] + }, + "data": { + "type": "string", + "enum": ["[DONE]"] + } + }, + "required": ["event", "data"], + "description": "Occurs when a stream ends.", + "x-oaiMeta": { + "dataDescription": "`data` is `[DONE]`" + } + }, + "Batch": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "object": { + "type": "string", + "enum": ["batch"], + "description": "The object type, which is always `batch`." + }, + "endpoint": { + "type": "string", + "description": "The OpenAI API endpoint used by the batch." + }, + "errors": { + "type": "object", + "properties": { + "object": { + "type": "string", + "description": "The object type, which is always `list`." + }, + "data": { + "type": "array", + "items": { + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "An error code identifying the error type." + }, + "message": { + "type": "string", + "description": "A human-readable message providing more details about the error." + }, + "param": { + "type": "string", + "description": "The name of the parameter that caused the error, if applicable.", + "nullable": true + }, + "line": { + "type": "integer", + "description": "The line number of the input file where the error occurred, if applicable.", + "nullable": true + } + } + } + } + } + }, + "input_file_id": { + "type": "string", + "description": "The ID of the input file for the batch." + }, + "completion_window": { + "type": "string", + "description": "The time frame within which the batch should be processed." + }, + "status": { + "type": "string", + "description": "The current status of the batch.", + "enum": [ + "validating", + "failed", + "in_progress", + "finalizing", + "completed", + "expired", + "cancelling", + "cancelled" + ] + }, + "output_file_id": { + "type": "string", + "description": "The ID of the file containing the outputs of successfully executed requests." + }, + "error_file_id": { + "type": "string", + "description": "The ID of the file containing the outputs of requests with errors." + }, + "created_at": { + "type": "integer", + "description": "The Unix timestamp (in seconds) for when the batch was created." + }, + "in_progress_at": { + "type": "integer", + "description": "The Unix timestamp (in seconds) for when the batch started processing." + }, + "expires_at": { + "type": "integer", + "description": "The Unix timestamp (in seconds) for when the batch will expire." + }, + "finalizing_at": { + "type": "integer", + "description": "The Unix timestamp (in seconds) for when the batch started finalizing." + }, + "completed_at": { + "type": "integer", + "description": "The Unix timestamp (in seconds) for when the batch was completed." + }, + "failed_at": { + "type": "integer", + "description": "The Unix timestamp (in seconds) for when the batch failed." + }, + "expired_at": { + "type": "integer", + "description": "The Unix timestamp (in seconds) for when the batch expired." + }, + "cancelling_at": { + "type": "integer", + "description": "The Unix timestamp (in seconds) for when the batch started cancelling." + }, + "cancelled_at": { + "type": "integer", + "description": "The Unix timestamp (in seconds) for when the batch was cancelled." + }, + "request_counts": { + "type": "object", + "properties": { + "total": { + "type": "integer", + "description": "Total number of requests in the batch." + }, + "completed": { + "type": "integer", + "description": "Number of requests that have been completed successfully." + }, + "failed": { + "type": "integer", + "description": "Number of requests that have failed." + } + }, + "required": ["total", "completed", "failed"], + "description": "The request counts for different statuses within the batch." + }, + "metadata": { + "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n", + "type": "object", + "x-oaiTypeLabel": "map", + "nullable": true + } + }, + "required": [ + "id", + "object", + "endpoint", + "input_file_id", + "completion_window", + "status", + "created_at" + ], + "x-oaiMeta": { + "name": "The batch object", + "example": "{\n \"id\": \"batch_abc123\",\n \"object\": \"batch\",\n \"endpoint\": \"/v1/completions\",\n \"errors\": null,\n \"input_file_id\": \"file-abc123\",\n \"completion_window\": \"24h\",\n \"status\": \"completed\",\n \"output_file_id\": \"file-cvaTdG\",\n \"error_file_id\": \"file-HOWS94\",\n \"created_at\": 1711471533,\n \"in_progress_at\": 1711471538,\n \"expires_at\": 1711557933,\n \"finalizing_at\": 1711493133,\n \"completed_at\": 1711493163,\n \"failed_at\": null,\n \"expired_at\": null,\n \"cancelling_at\": null,\n \"cancelled_at\": null,\n \"request_counts\": {\n \"total\": 100,\n \"completed\": 95,\n \"failed\": 5\n },\n \"metadata\": {\n \"customer_id\": \"user_123456789\",\n \"batch_description\": \"Nightly eval job\",\n }\n}\n" + } + }, + "BatchRequestInput": { + "type": "object", + "description": "The per-line object of the batch input file", + "properties": { + "custom_id": { + "type": "string", + "description": "A developer-provided per-request id that will be used to match outputs to inputs. Must be unique for each request in a batch." + }, + "method": { + "type": "string", + "enum": ["POST"], + "description": "The HTTP method to be used for the request. Currently only `POST` is supported." + }, + "url": { + "type": "string", + "description": "The OpenAI API relative URL to be used for the request. Currently `/v1/chat/completions`, `/v1/embeddings`, and `/v1/completions` are supported." + } + }, + "x-oaiMeta": { + "name": "The request input object", + "example": "{\"custom_id\": \"request-1\", \"method\": \"POST\", \"url\": \"/v1/chat/completions\", \"body\": {\"model\": \"gpt-4o-mini\", \"messages\": [{\"role\": \"system\", \"content\": \"You are a helpful assistant.\"}, {\"role\": \"user\", \"content\": \"What is 2+2?\"}]}}\n" + } + }, + "BatchRequestOutput": { + "type": "object", + "description": "The per-line object of the batch output and error files", + "properties": { + "id": { + "type": "string" + }, + "custom_id": { + "type": "string", + "description": "A developer-provided per-request id that will be used to match outputs to inputs." + }, + "response": { + "type": "object", + "nullable": true, + "properties": { + "status_code": { + "type": "integer", + "description": "The HTTP status code of the response" + }, + "request_id": { + "type": "string", + "description": "An unique identifier for the OpenAI API request. Please include this request ID when contacting support." + }, + "body": { + "type": "object", + "x-oaiTypeLabel": "map", + "description": "The JSON body of the response" + } + } + }, + "error": { + "type": "object", + "nullable": true, + "description": "For requests that failed with a non-HTTP error, this will contain more information on the cause of the failure.", + "properties": { + "code": { + "type": "string", + "description": "A machine-readable error code." + }, + "message": { + "type": "string", + "description": "A human-readable error message." + } + } + } + }, + "x-oaiMeta": { + "name": "The request output object", + "example": "{\"id\": \"batch_req_wnaDys\", \"custom_id\": \"request-2\", \"response\": {\"status_code\": 200, \"request_id\": \"req_c187b3\", \"body\": {\"id\": \"chatcmpl-9758Iw\", \"object\": \"chat.completion\", \"created\": 1711475054, \"model\": \"gpt-4o-mini\", \"choices\": [{\"index\": 0, \"message\": {\"role\": \"assistant\", \"content\": \"2 + 2 equals 4.\"}, \"finish_reason\": \"stop\"}], \"usage\": {\"prompt_tokens\": 24, \"completion_tokens\": 15, \"total_tokens\": 39}, \"system_fingerprint\": null}}, \"error\": null}\n" + } + }, + "ListBatchesResponse": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Batch" + } + }, + "first_id": { + "type": "string", + "example": "batch_abc123" + }, + "last_id": { + "type": "string", + "example": "batch_abc456" + }, + "has_more": { + "type": "boolean" + }, + "object": { + "type": "string", + "enum": ["list"] + } + }, + "required": ["object", "data", "has_more"] + }, + "AuditLogActorServiceAccount": { + "type": "object", + "description": "The service account that performed the audit logged action.", + "properties": { + "id": { + "type": "string", + "description": "The service account id." + } + } + }, + "AuditLogActorUser": { + "type": "object", + "description": "The user who performed the audit logged action.", + "properties": { + "id": { + "type": "string", + "description": "The user id." + }, + "email": { + "type": "string", + "description": "The user email." + } + } + }, + "AuditLogActorApiKey": { + "type": "object", + "description": "The API Key used to perform the audit logged action.", + "properties": { + "id": { + "type": "string", + "description": "The tracking id of the API key." + }, + "type": { + "type": "string", + "description": "The type of API key. Can be either `user` or `service_account`.", + "enum": ["user", "service_account"] + }, + "user": { + "$ref": "#/components/schemas/AuditLogActorUser" + }, + "service_account": { + "$ref": "#/components/schemas/AuditLogActorServiceAccount" + } + } + }, + "AuditLogActorSession": { + "type": "object", + "description": "The session in which the audit logged action was performed.", + "properties": { + "user": { + "$ref": "#/components/schemas/AuditLogActorUser" + }, + "ip_address": { + "type": "string", + "description": "The IP address from which the action was performed." + } + } + }, + "AuditLogActor": { + "type": "object", + "description": "The actor who performed the audit logged action.", + "properties": { + "type": { + "type": "string", + "description": "The type of actor. Is either `session` or `api_key`.", + "enum": ["session", "api_key"] + }, + "session": { + "type": "object", + "$ref": "#/components/schemas/AuditLogActorSession" + }, + "api_key": { + "type": "object", + "$ref": "#/components/schemas/AuditLogActorApiKey" + } + } + }, + "AuditLogEventType": { + "type": "string", + "description": "The event type.", + "x-oaiExpandable": true, + "enum": [ + "api_key.created", + "api_key.updated", + "api_key.deleted", + "invite.sent", + "invite.accepted", + "invite.deleted", + "login.succeeded", + "login.failed", + "logout.succeeded", + "logout.failed", + "organization.updated", + "project.created", + "project.updated", + "project.archived", + "service_account.created", + "service_account.updated", + "service_account.deleted", + "user.added", + "user.updated", + "user.deleted" + ] + }, + "AuditLog": { + "type": "object", + "description": "A log of a user action or configuration change within this organization.", + "properties": { + "id": { + "type": "string", + "description": "The ID of this log." + }, + "type": { + "$ref": "#/components/schemas/AuditLogEventType" + }, + "effective_at": { + "type": "integer", + "description": "The Unix timestamp (in seconds) of the event." + }, + "project": { + "type": "object", + "description": "The project that the action was scoped to. Absent for actions not scoped to projects.", + "properties": { + "id": { + "type": "string", + "description": "The project ID." + }, + "name": { + "type": "string", + "description": "The project title." + } + } + }, + "actor": { + "$ref": "#/components/schemas/AuditLogActor" + }, + "api_key.created": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The tracking ID of the API key." + }, + "data": { + "type": "object", + "description": "The payload used to create the API key.", + "properties": { + "scopes": { + "type": "array", + "items": { + "type": "string" + }, + "description": "A list of scopes allowed for the API key, e.g. `[\"api.model.request\"]`" + } + } + } + } + }, + "api_key.updated": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The tracking ID of the API key." + }, + "changes_requested": { + "type": "object", + "description": "The payload used to update the API key.", + "properties": { + "scopes": { + "type": "array", + "items": { + "type": "string" + }, + "description": "A list of scopes allowed for the API key, e.g. `[\"api.model.request\"]`" + } + } + } + } + }, + "api_key.deleted": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The tracking ID of the API key." + } + } + }, + "invite.sent": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The ID of the invite." + }, + "data": { + "type": "object", + "description": "The payload used to create the invite.", + "properties": { + "email": { + "type": "string", + "description": "The email invited to the organization." + }, + "role": { + "type": "string", + "description": "The role the email was invited to be. Is either `owner` or `member`." + } + } + } + } + }, + "invite.accepted": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The ID of the invite." + } + } + }, + "invite.deleted": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The ID of the invite." + } + } + }, + "login.failed": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "error_code": { + "type": "string", + "description": "The error code of the failure." + }, + "error_message": { + "type": "string", + "description": "The error message of the failure." + } + } + }, + "logout.failed": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "error_code": { + "type": "string", + "description": "The error code of the failure." + }, + "error_message": { + "type": "string", + "description": "The error message of the failure." + } + } + }, + "organization.updated": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The organization ID." + }, + "changes_requested": { + "type": "object", + "description": "The payload used to update the organization settings.", + "properties": { + "title": { + "type": "string", + "description": "The organization title." + }, + "description": { + "type": "string", + "description": "The organization description." + }, + "name": { + "type": "string", + "description": "The organization name." + }, + "settings": { + "type": "object", + "properties": { + "threads_ui_visibility": { + "type": "string", + "description": "Visibility of the threads page which shows messages created with the Assistants API and Playground. One of `ANY_ROLE`, `OWNERS`, or `NONE`." + }, + "usage_dashboard_visibility": { + "type": "string", + "description": "Visibility of the usage dashboard which shows activity and costs for your organization. One of `ANY_ROLE` or `OWNERS`." + } + } + } + } + } + } + }, + "project.created": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The project ID." + }, + "data": { + "type": "object", + "description": "The payload used to create the project.", + "properties": { + "name": { + "type": "string", + "description": "The project name." + }, + "title": { + "type": "string", + "description": "The title of the project as seen on the dashboard." + } + } + } + } + }, + "project.updated": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The project ID." + }, + "changes_requested": { + "type": "object", + "description": "The payload used to update the project.", + "properties": { + "title": { + "type": "string", + "description": "The title of the project as seen on the dashboard." + } + } + } + } + }, + "project.archived": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The project ID." + } + } + }, + "service_account.created": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The service account ID." + }, + "data": { + "type": "object", + "description": "The payload used to create the service account.", + "properties": { + "role": { + "type": "string", + "description": "The role of the service account. Is either `owner` or `member`." + } + } + } + } + }, + "service_account.updated": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The service account ID." + }, + "changes_requested": { + "type": "object", + "description": "The payload used to updated the service account.", + "properties": { + "role": { + "type": "string", + "description": "The role of the service account. Is either `owner` or `member`." + } + } + } + } + }, + "service_account.deleted": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The service account ID." + } + } + }, + "user.added": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The user ID." + }, + "data": { + "type": "object", + "description": "The payload used to add the user to the project.", + "properties": { + "role": { + "type": "string", + "description": "The role of the user. Is either `owner` or `member`." + } + } + } + } + }, + "user.updated": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The project ID." + }, + "changes_requested": { + "type": "object", + "description": "The payload used to update the user.", + "properties": { + "role": { + "type": "string", + "description": "The role of the user. Is either `owner` or `member`." + } + } + } + } + }, + "user.deleted": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The user ID." + } + } + } + }, + "required": ["id", "type", "effective_at", "actor"], + "x-oaiMeta": { + "name": "The audit log object", + "example": "{\n \"id\": \"req_xxx_20240101\",\n \"type\": \"api_key.created\",\n \"effective_at\": 1720804090,\n \"actor\": {\n \"type\": \"session\",\n \"session\": {\n \"user\": {\n \"id\": \"user-xxx\",\n \"email\": \"user@example.com\"\n },\n \"ip_address\": \"127.0.0.1\",\n \"user_agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36\"\n }\n },\n \"api_key.created\": {\n \"id\": \"key_xxxx\",\n \"data\": {\n \"scopes\": [\"resource.operation\"]\n }\n }\n}\n" + } + }, + "ListAuditLogsResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": ["list"] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AuditLog" + } + }, + "first_id": { + "type": "string", + "example": "audit_log-defb456h8dks" + }, + "last_id": { + "type": "string", + "example": "audit_log-hnbkd8s93s" + }, + "has_more": { + "type": "boolean" + } + }, + "required": ["object", "data", "first_id", "last_id", "has_more"] + }, + "Invite": { + "type": "object", + "description": "Represents an individual `invite` to the organization.", + "properties": { + "object": { + "type": "string", + "enum": ["organization.invite"], + "description": "The object type, which is always `organization.invite`" + }, + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints" + }, + "email": { + "type": "string", + "description": "The email address of the individual to whom the invite was sent" + }, + "role": { + "type": "string", + "enum": ["owner", "reader"], + "description": "`owner` or `reader`" + }, + "status": { + "type": "string", + "enum": ["accepted", "expired", "pending"], + "description": "`accepted`,`expired`, or `pending`" + }, + "invited_at": { + "type": "integer", + "description": "The Unix timestamp (in seconds) of when the invite was sent." + }, + "expires_at": { + "type": "integer", + "description": "The Unix timestamp (in seconds) of when the invite expires." + }, + "accepted_at": { + "type": "integer", + "description": "The Unix timestamp (in seconds) of when the invite was accepted." + } + }, + "required": [ + "object", + "id", + "email", + "role", + "status", + "invited_at", + "expires_at" + ], + "x-oaiMeta": { + "name": "The invite object", + "example": "{\n \"object\": \"organization.invite\",\n \"id\": \"invite-abc\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"status\": \"accepted\",\n \"invited_at\": 1711471533,\n \"expires_at\": 1711471533,\n \"accepted_at\": 1711471533\n}\n" + } + }, + "InviteListResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": ["list"], + "description": "The object type, which is always `list`" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Invite" + } + }, + "first_id": { + "type": "string", + "description": "The first `invite_id` in the retrieved `list`" + }, + "last_id": { + "type": "string", + "description": "The last `invite_id` in the retrieved `list`" + }, + "has_more": { + "type": "boolean", + "description": "The `has_more` property is used for pagination to indicate there are additional results." + } + }, + "required": ["object", "data"] + }, + "InviteRequest": { + "type": "object", + "properties": { + "email": { + "type": "string", + "description": "Send an email to this address" + }, + "role": { + "type": "string", + "enum": ["reader", "owner"], + "description": "`owner` or `reader`" + } + }, + "required": ["email", "role"] + }, + "InviteDeleteResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": ["organization.invite.deleted"], + "description": "The object type, which is always `organization.invite.deleted`" + }, + "id": { + "type": "string" + }, + "deleted": { + "type": "boolean" + } + }, + "required": ["object", "id", "deleted"] + }, + "User": { + "type": "object", + "description": "Represents an individual `user` within an organization.", + "properties": { + "object": { + "type": "string", + "enum": ["organization.user"], + "description": "The object type, which is always `organization.user`" + }, + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints" + }, + "name": { + "type": "string", + "description": "The name of the user" + }, + "email": { + "type": "string", + "description": "The email address of the user" + }, + "role": { + "type": "string", + "enum": ["owner", "reader"], + "description": "`owner` or `reader`" + }, + "added_at": { + "type": "integer", + "description": "The Unix timestamp (in seconds) of when the user was added." + } + }, + "required": ["object", "id", "name", "email", "role", "added_at"], + "x-oaiMeta": { + "name": "The user object", + "example": "{\n \"object\": \"organization.user\",\n \"id\": \"user_abc\",\n \"name\": \"First Last\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"added_at\": 1711471533\n}\n" + } + }, + "UserListResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": ["list"] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/User" + } + }, + "first_id": { + "type": "string" + }, + "last_id": { + "type": "string" + }, + "has_more": { + "type": "boolean" + } + }, + "required": ["object", "data", "first_id", "last_id", "has_more"] + }, + "UserRoleUpdateRequest": { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": ["owner", "reader"], + "description": "`owner` or `reader`" + } + }, + "required": ["role"] + }, + "UserDeleteResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": ["organization.user.deleted"] + }, + "id": { + "type": "string" + }, + "deleted": { + "type": "boolean" + } + }, + "required": ["object", "id", "deleted"] + }, + "Project": { + "type": "object", + "description": "Represents an individual project.", + "properties": { + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints" + }, + "object": { + "type": "string", + "enum": ["organization.project"], + "description": "The object type, which is always `organization.project`" + }, + "name": { + "type": "string", + "description": "The name of the project. This appears in reporting." + }, + "created_at": { + "type": "integer", + "description": "The Unix timestamp (in seconds) of when the project was created." + }, + "archived_at": { + "type": "integer", + "nullable": true, + "description": "The Unix timestamp (in seconds) of when the project was archived or `null`." + }, + "status": { + "type": "string", + "enum": ["active", "archived"], + "description": "`active` or `archived`" + }, + "app_use_case": { + "type": "string", + "description": "A description of your business, project, or use case. [Why we need this information](https://help.openai.com/en/articles/9824607-api-platform-verifications)." + }, + "business_website": { + "type": "string", + "description": "Your business URL, or if you don't have one yet, a URL to your LinkedIn or other social media. [Why we need this information](https://help.openai.com/en/articles/9824607-api-platform-verifications)." + } + }, + "required": ["id", "object", "name", "created_at", "status"], + "x-oaiMeta": { + "name": "The project object", + "example": "{\n \"id\": \"proj_abc\",\n \"object\": \"organization.project\",\n \"name\": \"Project example\",\n \"created_at\": 1711471533,\n \"archived_at\": null,\n \"status\": \"active\",\n \"app_use_case\": \"Your project use case here\",\n \"business_website\": \"https://example.com\"\n}\n" + } + }, + "ProjectListResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": ["list"] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Project" + } + }, + "first_id": { + "type": "string" + }, + "last_id": { + "type": "string" + }, + "has_more": { + "type": "boolean" + } + }, + "required": ["object", "data", "first_id", "last_id", "has_more"] + }, + "ProjectCreateRequest": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The friendly name of the project, this name appears in reports." + }, + "app_use_case": { + "type": "string", + "description": "A description of your business, project, or use case. [Why we need this information](https://help.openai.com/en/articles/9824607-api-platform-verifications)." + }, + "business_website": { + "type": "string", + "description": "Your business URL, or if you don't have one yet, a URL to your LinkedIn or other social media. [Why we need this information](https://help.openai.com/en/articles/9824607-api-platform-verifications)." + } + }, + "required": ["name"] + }, + "ProjectUpdateRequest": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The updated name of the project, this name appears in reports." + }, + "app_use_case": { + "type": "string", + "description": "A description of your business, project, or use case. [Why we need this information](https://help.openai.com/en/articles/9824607-api-platform-verifications)." + }, + "business_website": { + "type": "string", + "description": "Your business URL, or if you don't have one yet, a URL to your LinkedIn or other social media. [Why we need this information](https://help.openai.com/en/articles/9824607-api-platform-verifications)." + } + }, + "required": ["name"] + }, + "DefaultProjectErrorResponse": { + "type": "object", + "properties": { + "code": { + "type": "integer" + }, + "message": { + "type": "string" + } + }, + "required": ["code", "message"] + }, + "ProjectUser": { + "type": "object", + "description": "Represents an individual user in a project.", + "properties": { + "object": { + "type": "string", + "enum": ["organization.project.user"], + "description": "The object type, which is always `organization.project.user`" + }, + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints" + }, + "name": { + "type": "string", + "description": "The name of the user" + }, + "email": { + "type": "string", + "description": "The email address of the user" + }, + "role": { + "type": "string", + "enum": ["owner", "member"], + "description": "`owner` or `member`" + }, + "added_at": { + "type": "integer", + "description": "The Unix timestamp (in seconds) of when the project was added." + } + }, + "required": ["object", "id", "name", "email", "role", "added_at"], + "x-oaiMeta": { + "name": "The project user object", + "example": "{\n \"object\": \"organization.project.user\",\n \"id\": \"user_abc\",\n \"name\": \"First Last\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"added_at\": 1711471533\n}\n" + } + }, + "ProjectUserListResponse": { + "type": "object", + "properties": { + "object": { + "type": "string" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ProjectUser" + } + }, + "first_id": { + "type": "string" + }, + "last_id": { + "type": "string" + }, + "has_more": { + "type": "boolean" + } + }, + "required": ["object", "data", "first_id", "last_id", "has_more"] + }, + "ProjectUserCreateRequest": { + "type": "object", + "properties": { + "user_id": { + "type": "string", + "description": "The ID of the user." + }, + "role": { + "type": "string", + "enum": ["owner", "member"], + "description": "`owner` or `member`" + } + }, + "required": ["user_id", "role"] + }, + "ProjectUserUpdateRequest": { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": ["owner", "member"], + "description": "`owner` or `member`" + } + }, + "required": ["role"] + }, + "ProjectUserDeleteResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": ["organization.project.user.deleted"] + }, + "id": { + "type": "string" + }, + "deleted": { + "type": "boolean" + } + }, + "required": ["object", "id", "deleted"] + }, + "ProjectServiceAccount": { + "type": "object", + "description": "Represents an individual service account in a project.", + "properties": { + "object": { + "type": "string", + "enum": ["organization.project.service_account"], + "description": "The object type, which is always `organization.project.service_account`" + }, + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints" + }, + "name": { + "type": "string", + "description": "The name of the service account" + }, + "role": { + "type": "string", + "enum": ["owner", "member"], + "description": "`owner` or `member`" + }, + "created_at": { + "type": "integer", + "description": "The Unix timestamp (in seconds) of when the service account was created" + } + }, + "required": ["object", "id", "name", "role", "created_at"], + "x-oaiMeta": { + "name": "The project service account object", + "example": "{\n \"object\": \"organization.project.service_account\",\n \"id\": \"svc_acct_abc\",\n \"name\": \"Service Account\",\n \"role\": \"owner\",\n \"created_at\": 1711471533\n}\n" + } + }, + "ProjectServiceAccountListResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": ["list"] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ProjectServiceAccount" + } + }, + "first_id": { + "type": "string" + }, + "last_id": { + "type": "string" + }, + "has_more": { + "type": "boolean" + } + }, + "required": ["object", "data", "first_id", "last_id", "has_more"] + }, + "ProjectServiceAccountCreateRequest": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the service account being created." + } + }, + "required": ["name"] + }, + "ProjectServiceAccountCreateResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": ["organization.project.service_account"] + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "role": { + "type": "string", + "enum": ["member"], + "description": "Service accounts can only have one role of type `member`" + }, + "created_at": { + "type": "integer" + }, + "api_key": { + "$ref": "#/components/schemas/ProjectServiceAccountApiKey" + } + }, + "required": ["object", "id", "name", "role", "created_at", "api_key"] + }, + "ProjectServiceAccountApiKey": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": ["organization.project.service_account.api_key"], + "description": "The object type, which is always `organization.project.service_account.api_key`" + }, + "value": { + "type": "string" + }, + "name": { + "type": "string" + }, + "created_at": { + "type": "integer" + }, + "id": { + "type": "string" + } + }, + "required": ["object", "value", "name", "created_at", "id"] + }, + "ProjectServiceAccountDeleteResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": ["organization.project.service_account.deleted"] + }, + "id": { + "type": "string" + }, + "deleted": { + "type": "boolean" + } + }, + "required": ["object", "id", "deleted"] + }, + "ProjectApiKey": { + "type": "object", + "description": "Represents an individual API key in a project.", + "properties": { + "object": { + "type": "string", + "enum": ["organization.project.api_key"], + "description": "The object type, which is always `organization.project.api_key`" + }, + "redacted_value": { + "type": "string", + "description": "The redacted value of the API key" + }, + "name": { + "type": "string", + "description": "The name of the API key" + }, + "created_at": { + "type": "integer", + "description": "The Unix timestamp (in seconds) of when the API key was created" + }, + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints" + }, + "owner": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["user", "service_account"], + "description": "`user` or `service_account`" + }, + "user": { + "$ref": "#/components/schemas/ProjectUser" + }, + "service_account": { + "$ref": "#/components/schemas/ProjectServiceAccount" + } + } + } + }, + "required": [ + "object", + "redacted_value", + "name", + "created_at", + "id", + "owner" + ], + "x-oaiMeta": { + "name": "The project API key object", + "example": "{\n \"object\": \"organization.project.api_key\",\n \"redacted_value\": \"sk-abc...def\",\n \"name\": \"My API Key\",\n \"created_at\": 1711471533,\n \"id\": \"key_abc\",\n \"owner\": {\n \"type\": \"user\",\n \"user\": {\n \"object\": \"organization.project.user\",\n \"id\": \"user_abc\",\n \"name\": \"First Last\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"created_at\": 1711471533\n }\n }\n}\n" + } + }, + "ProjectApiKeyListResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": ["list"] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ProjectApiKey" + } + }, + "first_id": { + "type": "string" + }, + "last_id": { + "type": "string" + }, + "has_more": { + "type": "boolean" + } + }, + "required": ["object", "data", "first_id", "last_id", "has_more"] + }, + "ProjectApiKeyDeleteResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": ["organization.project.api_key.deleted"] + }, + "id": { + "type": "string" + }, + "deleted": { + "type": "boolean" + } + }, + "required": ["object", "id", "deleted"] + } + } + }, + "security": [ + { + "ApiKeyAuth": [] + } + ], + "x-oaiMeta": { + "navigationGroups": [ + { + "id": "endpoints", + "title": "Endpoints" + }, + { + "id": "assistants", + "title": "Assistants" + }, + { + "id": "administration", + "title": "Administration" + }, + { + "id": "legacy", + "title": "Legacy" + } + ], + "groups": [ + { + "id": "audio", + "title": "Audio", + "description": "Learn how to turn audio into text or text into audio.\n\nRelated guide: [Speech to text](/docs/guides/speech-to-text)\n", + "navigationGroup": "endpoints", + "sections": [ + { + "type": "endpoint", + "key": "createSpeech", + "path": "createSpeech" + }, + { + "type": "endpoint", + "key": "createTranscription", + "path": "createTranscription" + }, + { + "type": "endpoint", + "key": "createTranslation", + "path": "createTranslation" + }, + { + "type": "object", + "key": "CreateTranscriptionResponseJson", + "path": "json-object" + }, + { + "type": "object", + "key": "CreateTranscriptionResponseVerboseJson", + "path": "verbose-json-object" + } + ] + }, + { + "id": "chat", + "title": "Chat", + "description": "Given a list of messages comprising a conversation, the model will return a response.\n\nRelated guide: [Chat Completions](/docs/guides/text-generation)\n", + "navigationGroup": "endpoints", + "sections": [ + { + "type": "endpoint", + "key": "createChatCompletion", + "path": "create" + }, + { + "type": "object", + "key": "CreateChatCompletionResponse", + "path": "object" + }, + { + "type": "object", + "key": "CreateChatCompletionStreamResponse", + "path": "streaming" + } + ] + }, + { + "id": "embeddings", + "title": "Embeddings", + "description": "Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.\n\nRelated guide: [Embeddings](/docs/guides/embeddings)\n", + "navigationGroup": "endpoints", + "sections": [ + { + "type": "endpoint", + "key": "createEmbedding", + "path": "create" + }, + { + "type": "object", + "key": "Embedding", + "path": "object" + } + ] + }, + { + "id": "fine-tuning", + "title": "Fine-tuning", + "description": "Manage fine-tuning jobs to tailor a model to your specific training data.\n\nRelated guide: [Fine-tune models](/docs/guides/fine-tuning)\n", + "navigationGroup": "endpoints", + "sections": [ + { + "type": "endpoint", + "key": "createFineTuningJob", + "path": "create" + }, + { + "type": "endpoint", + "key": "listPaginatedFineTuningJobs", + "path": "list" + }, + { + "type": "endpoint", + "key": "listFineTuningEvents", + "path": "list-events" + }, + { + "type": "endpoint", + "key": "listFineTuningJobCheckpoints", + "path": "list-checkpoints" + }, + { + "type": "endpoint", + "key": "retrieveFineTuningJob", + "path": "retrieve" + }, + { + "type": "endpoint", + "key": "cancelFineTuningJob", + "path": "cancel" + }, + { + "type": "object", + "key": "FinetuneChatRequestInput", + "path": "chat-input" + }, + { + "type": "object", + "key": "FinetuneCompletionRequestInput", + "path": "completions-input" + }, + { + "type": "object", + "key": "FineTuningJob", + "path": "object" + }, + { + "type": "object", + "key": "FineTuningJobEvent", + "path": "event-object" + }, + { + "type": "object", + "key": "FineTuningJobCheckpoint", + "path": "checkpoint-object" + } + ] + }, + { + "id": "batch", + "title": "Batch", + "description": "Create large batches of API requests for asynchronous processing. The Batch API returns completions within 24 hours for a 50% discount.\n\nRelated guide: [Batch](/docs/guides/batch)\n", + "navigationGroup": "endpoints", + "sections": [ + { + "type": "endpoint", + "key": "createBatch", + "path": "create" + }, + { + "type": "endpoint", + "key": "retrieveBatch", + "path": "retrieve" + }, + { + "type": "endpoint", + "key": "cancelBatch", + "path": "cancel" + }, + { + "type": "endpoint", + "key": "listBatches", + "path": "list" + }, + { + "type": "object", + "key": "Batch", + "path": "object" + }, + { + "type": "object", + "key": "BatchRequestInput", + "path": "request-input" + }, + { + "type": "object", + "key": "BatchRequestOutput", + "path": "request-output" + } + ] + }, + { + "id": "files", + "title": "Files", + "description": "Files are used to upload documents that can be used with features like [Assistants](/docs/api-reference/assistants), [Fine-tuning](/docs/api-reference/fine-tuning), and [Batch API](/docs/guides/batch).\n", + "navigationGroup": "endpoints", + "sections": [ + { + "type": "endpoint", + "key": "createFile", + "path": "create" + }, + { + "type": "endpoint", + "key": "listFiles", + "path": "list" + }, + { + "type": "endpoint", + "key": "retrieveFile", + "path": "retrieve" + }, + { + "type": "endpoint", + "key": "deleteFile", + "path": "delete" + }, + { + "type": "endpoint", + "key": "downloadFile", + "path": "retrieve-contents" + }, + { + "type": "object", + "key": "OpenAIFile", + "path": "object" + } + ] + }, + { + "id": "uploads", + "title": "Uploads", + "description": "Allows you to upload large files in multiple parts.\n", + "navigationGroup": "endpoints", + "sections": [ + { + "type": "endpoint", + "key": "createUpload", + "path": "create" + }, + { + "type": "endpoint", + "key": "addUploadPart", + "path": "add-part" + }, + { + "type": "endpoint", + "key": "completeUpload", + "path": "complete" + }, + { + "type": "endpoint", + "key": "cancelUpload", + "path": "cancel" + }, + { + "type": "object", + "key": "Upload", + "path": "object" + }, + { + "type": "object", + "key": "UploadPart", + "path": "part-object" + } + ] + }, + { + "id": "images", + "title": "Images", + "description": "Given a prompt and/or an input image, the model will generate a new image.\n\nRelated guide: [Image generation](/docs/guides/images)\n", + "navigationGroup": "endpoints", + "sections": [ + { + "type": "endpoint", + "key": "createImage", + "path": "create" + }, + { + "type": "endpoint", + "key": "createImageEdit", + "path": "createEdit" + }, + { + "type": "endpoint", + "key": "createImageVariation", + "path": "createVariation" + }, + { + "type": "object", + "key": "Image", + "path": "object" + } + ] + }, + { + "id": "models", + "title": "Models", + "description": "List and describe the various models available in the API. You can refer to the [Models](/docs/models) documentation to understand what models are available and the differences between them.\n", + "navigationGroup": "endpoints", + "sections": [ + { + "type": "endpoint", + "key": "listModels", + "path": "list" + }, + { + "type": "endpoint", + "key": "retrieveModel", + "path": "retrieve" + }, + { + "type": "endpoint", + "key": "deleteModel", + "path": "delete" + }, + { + "type": "object", + "key": "Model", + "path": "object" + } + ] + }, + { + "id": "moderations", + "title": "Moderations", + "description": "Given text and/or image inputs, classifies if those inputs are potentially harmful across several categories.\n\nRelated guide: [Moderations](/docs/guides/moderation)\n", + "navigationGroup": "endpoints", + "sections": [ + { + "type": "endpoint", + "key": "createModeration", + "path": "create" + }, + { + "type": "object", + "key": "CreateModerationResponse", + "path": "object" + } + ] + }, + { + "id": "assistants", + "title": "Assistants", + "beta": true, + "description": "Build assistants that can call models and use tools to perform tasks.\n\n[Get started with the Assistants API](/docs/assistants)\n", + "navigationGroup": "assistants", + "sections": [ + { + "type": "endpoint", + "key": "createAssistant", + "path": "createAssistant" + }, + { + "type": "endpoint", + "key": "listAssistants", + "path": "listAssistants" + }, + { + "type": "endpoint", + "key": "getAssistant", + "path": "getAssistant" + }, + { + "type": "endpoint", + "key": "modifyAssistant", + "path": "modifyAssistant" + }, + { + "type": "endpoint", + "key": "deleteAssistant", + "path": "deleteAssistant" + }, + { + "type": "object", + "key": "AssistantObject", + "path": "object" + } + ] + }, + { + "id": "threads", + "title": "Threads", + "beta": true, + "description": "Create threads that assistants can interact with.\n\nRelated guide: [Assistants](/docs/assistants/overview)\n", + "navigationGroup": "assistants", + "sections": [ + { + "type": "endpoint", + "key": "createThread", + "path": "createThread" + }, + { + "type": "endpoint", + "key": "getThread", + "path": "getThread" + }, + { + "type": "endpoint", + "key": "modifyThread", + "path": "modifyThread" + }, + { + "type": "endpoint", + "key": "deleteThread", + "path": "deleteThread" + }, + { + "type": "object", + "key": "ThreadObject", + "path": "object" + } + ] + }, + { + "id": "messages", + "title": "Messages", + "beta": true, + "description": "Create messages within threads\n\nRelated guide: [Assistants](/docs/assistants/overview)\n", + "navigationGroup": "assistants", + "sections": [ + { + "type": "endpoint", + "key": "createMessage", + "path": "createMessage" + }, + { + "type": "endpoint", + "key": "listMessages", + "path": "listMessages" + }, + { + "type": "endpoint", + "key": "getMessage", + "path": "getMessage" + }, + { + "type": "endpoint", + "key": "modifyMessage", + "path": "modifyMessage" + }, + { + "type": "endpoint", + "key": "deleteMessage", + "path": "deleteMessage" + }, + { + "type": "object", + "key": "MessageObject", + "path": "object" + } + ] + }, + { + "id": "runs", + "title": "Runs", + "beta": true, + "description": "Represents an execution run on a thread.\n\nRelated guide: [Assistants](/docs/assistants/overview)\n", + "navigationGroup": "assistants", + "sections": [ + { + "type": "endpoint", + "key": "createRun", + "path": "createRun" + }, + { + "type": "endpoint", + "key": "createThreadAndRun", + "path": "createThreadAndRun" + }, + { + "type": "endpoint", + "key": "listRuns", + "path": "listRuns" + }, + { + "type": "endpoint", + "key": "getRun", + "path": "getRun" + }, + { + "type": "endpoint", + "key": "modifyRun", + "path": "modifyRun" + }, + { + "type": "endpoint", + "key": "submitToolOuputsToRun", + "path": "submitToolOutputs" + }, + { + "type": "endpoint", + "key": "cancelRun", + "path": "cancelRun" + }, + { + "type": "object", + "key": "RunObject", + "path": "object" + } + ] + }, + { + "id": "run-steps", + "title": "Run Steps", + "beta": true, + "description": "Represents the steps (model and tool calls) taken during the run.\n\nRelated guide: [Assistants](/docs/assistants/overview)\n", + "navigationGroup": "assistants", + "sections": [ + { + "type": "endpoint", + "key": "listRunSteps", + "path": "listRunSteps" + }, + { + "type": "endpoint", + "key": "getRunStep", + "path": "getRunStep" + }, + { + "type": "object", + "key": "RunStepObject", + "path": "step-object" + } + ] + }, + { + "id": "vector-stores", + "title": "Vector Stores", + "beta": true, + "description": "Vector stores are used to store files for use by the `file_search` tool.\n\nRelated guide: [File Search](/docs/assistants/tools/file-search)\n", + "navigationGroup": "assistants", + "sections": [ + { + "type": "endpoint", + "key": "createVectorStore", + "path": "create" + }, + { + "type": "endpoint", + "key": "listVectorStores", + "path": "list" + }, + { + "type": "endpoint", + "key": "getVectorStore", + "path": "retrieve" + }, + { + "type": "endpoint", + "key": "modifyVectorStore", + "path": "modify" + }, + { + "type": "endpoint", + "key": "deleteVectorStore", + "path": "delete" + }, + { + "type": "object", + "key": "VectorStoreObject", + "path": "object" + } + ] + }, + { + "id": "vector-stores-files", + "title": "Vector Store Files", + "beta": true, + "description": "Vector store files represent files inside a vector store.\n\nRelated guide: [File Search](/docs/assistants/tools/file-search)\n", + "navigationGroup": "assistants", + "sections": [ + { + "type": "endpoint", + "key": "createVectorStoreFile", + "path": "createFile" + }, + { + "type": "endpoint", + "key": "listVectorStoreFiles", + "path": "listFiles" + }, + { + "type": "endpoint", + "key": "getVectorStoreFile", + "path": "getFile" + }, + { + "type": "endpoint", + "key": "deleteVectorStoreFile", + "path": "deleteFile" + }, + { + "type": "object", + "key": "VectorStoreFileObject", + "path": "file-object" + } + ] + }, + { + "id": "vector-stores-file-batches", + "title": "Vector Store File Batches", + "beta": true, + "description": "Vector store file batches represent operations to add multiple files to a vector store.\n\nRelated guide: [File Search](/docs/assistants/tools/file-search)\n", + "navigationGroup": "assistants", + "sections": [ + { + "type": "endpoint", + "key": "createVectorStoreFileBatch", + "path": "createBatch" + }, + { + "type": "endpoint", + "key": "getVectorStoreFileBatch", + "path": "getBatch" + }, + { + "type": "endpoint", + "key": "cancelVectorStoreFileBatch", + "path": "cancelBatch" + }, + { + "type": "endpoint", + "key": "listFilesInVectorStoreBatch", + "path": "listBatchFiles" + }, + { + "type": "object", + "key": "VectorStoreFileBatchObject", + "path": "batch-object" + } + ] + }, + { + "id": "assistants-streaming", + "title": "Streaming", + "beta": true, + "description": "Stream the result of executing a Run or resuming a Run after submitting tool outputs.\n\nYou can stream events from the [Create Thread and Run](/docs/api-reference/runs/createThreadAndRun),\n[Create Run](/docs/api-reference/runs/createRun), and [Submit Tool Outputs](/docs/api-reference/runs/submitToolOutputs)\nendpoints by passing `\"stream\": true`. The response will be a [Server-Sent events](https://html.spec.whatwg.org/multipage/server-sent-events.html#server-sent-events) stream.\n\nOur Node and Python SDKs provide helpful utilities to make streaming easy. Reference the\n[Assistants API quickstart](/docs/assistants/overview) to learn more.\n", + "navigationGroup": "assistants", + "sections": [ + { + "type": "object", + "key": "MessageDeltaObject", + "path": "message-delta-object" + }, + { + "type": "object", + "key": "RunStepDeltaObject", + "path": "run-step-delta-object" + }, + { + "type": "object", + "key": "AssistantStreamEvent", + "path": "events" + } + ] + }, + { + "id": "administration", + "title": "Overview", + "description": "Programmatically manage your organization.\n\nThe Audit Logs endpoint provides a log of all actions taken in the\norganization for security and monitoring purposes.\n\nTo access these endpoints please generate an Admin API Key through the [API Platform Organization overview](/organization/admin-keys). Admin API keys cannot be used for non-administration endpoints.\n\nFor best practices on setting up your organization, please refer to this [guide](/docs/guides/production-best-practices/setting-up-your-organization)\n", + "navigationGroup": "administration" + }, + { + "id": "invite", + "title": "Invites", + "description": "Invite and manage invitations for an organization. Invited users are automatically added to the Default project.", + "navigationGroup": "administration", + "sections": [ + { + "type": "endpoint", + "key": "list-invites", + "path": "list" + }, + { + "type": "endpoint", + "key": "inviteUser", + "path": "create" + }, + { + "type": "endpoint", + "key": "retrieve-invite", + "path": "retrieve" + }, + { + "type": "endpoint", + "key": "delete-invite", + "path": "delete" + }, + { + "type": "object", + "key": "Invite", + "path": "object" + } + ] + }, + { + "id": "users", + "title": "Users", + "description": "Manage users and their role in an organization. Users will be automatically added to the Default project.\n", + "navigationGroup": "administration", + "sections": [ + { + "type": "endpoint", + "key": "list-users", + "path": "list" + }, + { + "type": "endpoint", + "key": "modify-user", + "path": "modify" + }, + { + "type": "endpoint", + "key": "retrieve-user", + "path": "retrieve" + }, + { + "type": "endpoint", + "key": "delete-user", + "path": "delete" + }, + { + "type": "object", + "key": "User", + "path": "object" + } + ] + }, + { + "id": "projects", + "title": "Projects", + "description": "Manage the projects within an orgnanization includes creation, updating, and archiving or projects.\nThe Default project cannot be modified or archived.\n", + "navigationGroup": "administration", + "sections": [ + { + "type": "endpoint", + "key": "list-projects", + "path": "list" + }, + { + "type": "endpoint", + "key": "create-project", + "path": "create" + }, + { + "type": "endpoint", + "key": "retrieve-project", + "path": "retrieve" + }, + { + "type": "endpoint", + "key": "modify-project", + "path": "modify" + }, + { + "type": "endpoint", + "key": "archive-project", + "path": "archive" + }, + { + "type": "object", + "key": "Project", + "path": "object" + } + ] + }, + { + "id": "project-users", + "title": "Project Users", + "description": "Manage users within a project, including adding, updating roles, and removing users.\nUsers cannot be removed from the Default project, unless they are being removed from the organization.\n", + "navigationGroup": "administration", + "sections": [ + { + "type": "endpoint", + "key": "list-project-users", + "path": "list" + }, + { + "type": "endpoint", + "key": "create-project-user", + "path": "creeate" + }, + { + "type": "endpoint", + "key": "retrieve-project-user", + "path": "retrieve" + }, + { + "type": "endpoint", + "key": "modify-project-user", + "path": "modify" + }, + { + "type": "endpoint", + "key": "delete-project-user", + "path": "delete" + }, + { + "type": "object", + "key": "ProjectUser", + "path": "object" + } + ] + }, + { + "id": "project-service-accounts", + "title": "Project Service Accounts", + "description": "Manage service accounts within a project. A service account is a bot user that is not associated with a user.\nIf a user leaves an organization, their keys and membership in projects will no longer work. Service accounts\ndo not have this limitation. However, service accounts can also be deleted from a project.\n", + "navigationGroup": "administration", + "sections": [ + { + "type": "endpoint", + "key": "list-project-service-accounts", + "path": "list" + }, + { + "type": "endpoint", + "key": "create-project-service-account", + "path": "create" + }, + { + "type": "endpoint", + "key": "retrieve-project-service-account", + "path": "retrieve" + }, + { + "type": "endpoint", + "key": "delete-project-service-account", + "path": "delete" + }, + { + "type": "object", + "key": "ProjectServiceAccount", + "path": "object" + } + ] + }, + { + "id": "project-api-keys", + "title": "Project API Keys", + "description": "Manage API keys for a given project. Supports listing and deleting keys for users.\nThis API does not allow issuing keys for users, as users need to authorize themselves to generate keys.\n", + "navigationGroup": "administration", + "sections": [ + { + "type": "endpoint", + "key": "list-project-api-keys", + "path": "list" + }, + { + "type": "endpoint", + "key": "retrieve-project-api-key", + "path": "retrieve" + }, + { + "type": "endpoint", + "key": "delete-project-api-key", + "path": "delete" + }, + { + "type": "object", + "key": "ProjectApiKey", + "path": "object" + } + ] + }, + { + "id": "audit-logs", + "title": "Audit Logs", + "description": "Logs of user actions and configuration changes within this organization.\n\nTo log events, you must activate logging in the [Organization Settings](/settings/organization/general).\nOnce activated, for security reasons, logging cannot be deactivated.\n", + "navigationGroup": "administration", + "sections": [ + { + "type": "endpoint", + "key": "list-audit-logs", + "path": "list" + }, + { + "type": "object", + "key": "AuditLog", + "path": "object" + } + ] + }, + { + "id": "completions", + "title": "Completions", + "legacy": true, + "navigationGroup": "legacy", + "description": "Given a prompt, the model will return one or more predicted completions along with the probabilities of alternative tokens at each position. Most developer should use our [Chat Completions API](/docs/guides/text-generation/text-generation-models) to leverage our best and newest models.\n", + "sections": [ + { + "type": "endpoint", + "key": "createCompletion", + "path": "create" + }, + { + "type": "object", + "key": "CreateCompletionResponse", + "path": "object" + } + ] + } + ] + } } diff --git a/__tests__/fixtures/openai/commands.ts b/__tests__/fixtures/openai/commands.ts index 08ddfc1..fb1c04a 100644 --- a/__tests__/fixtures/openai/commands.ts +++ b/__tests__/fixtures/openai/commands.ts @@ -3,215 +3,188 @@ * * WARN: Do not edit directly. * - * Generated on 2024-10-13T02:06:31.654Z + * Generated on 2026-03-06T07:45:26.343Z * */ /** eslint-disable max-classes */ -import { Command } from '@block65/rest-client'; +import { Command, jsonStringify, stripUndefined } from "@block65/rest-client"; import type { - CreateChatCompletionCommandInput, - CreateChatCompletionCommandBody, - CreateChatCompletionResponse, - CreateCompletionCommandInput, - CreateCompletionCommandBody, - CreateCompletionResponse, - CreateImageCommandInput, - CreateImageCommandBody, - ImagesResponse, - CreateImageEditCommandInput, - CreateImageVariationCommandInput, - CreateEmbeddingCommandInput, - CreateEmbeddingCommandBody, - CreateEmbeddingResponse, - CreateSpeechCommandInput, - CreateSpeechCommandBody, - CreateTranscriptionCommandInput, - CreateTranslationCommandInput, - ListFilesCommandQuery, - ListFilesCommandInput, - ListFilesResponse, - CreateFileCommandInput, - OpenAiFile, - DeleteFileCommandInput, - DeleteFileResponse, - RetrieveFileCommandInput, - DownloadFileCommandInput, - CreateUploadCommandInput, - CreateUploadCommandBody, - Upload, - AddUploadPartCommandInput, - UploadPart, - CompleteUploadCommandInput, - CompleteUploadCommandBody, - CancelUploadCommandInput, - CreateFineTuningJobCommandInput, - CreateFineTuningJobCommandBody, - FineTuningJob, - ListPaginatedFineTuningJobsCommandQuery, - ListPaginatedFineTuningJobsCommandInput, - ListPaginatedFineTuningJobsResponse, - RetrieveFineTuningJobCommandInput, - ListFineTuningEventsCommandQuery, - ListFineTuningEventsCommandInput, - ListFineTuningJobEventsResponse, - CancelFineTuningJobCommandInput, - ListFineTuningJobCheckpointsCommandQuery, - ListFineTuningJobCheckpointsCommandInput, - ListFineTuningJobCheckpointsResponse, - ListModelsCommandInput, - ListModelsResponse, - RetrieveModelCommandInput, - Model, - DeleteModelCommandInput, - DeleteModelResponse, - CreateModerationCommandInput, - CreateModerationCommandBody, - CreateModerationResponse, - ListAssistantsCommandQuery, - ListAssistantsCommandInput, - ListAssistantsResponse, - CreateAssistantCommandInput, - CreateAssistantCommandBody, - AssistantObject, - GetAssistantCommandInput, - ModifyAssistantCommandInput, - ModifyAssistantCommandBody, - DeleteAssistantCommandInput, - DeleteAssistantResponse, - CreateThreadCommandInput, - CreateThreadCommandBody, - ThreadObject, - GetThreadCommandInput, - ModifyThreadCommandInput, - ModifyThreadCommandBody, - DeleteThreadCommandInput, - DeleteThreadResponse, - ListMessagesCommandQuery, - ListMessagesCommandInput, - ListMessagesResponse, - CreateMessageCommandInput, - CreateMessageCommandBody, - MessageObject, - GetMessageCommandInput, - ModifyMessageCommandInput, - ModifyMessageCommandBody, - DeleteMessageCommandInput, - DeleteMessageResponse, - CreateThreadAndRunCommandInput, - CreateThreadAndRunCommandBody, - RunObject, - ListRunsCommandQuery, - ListRunsCommandInput, - ListRunsResponse, - CreateRunCommandQuery, - CreateRunCommandInput, - CreateRunCommandBody, - GetRunCommandInput, - ModifyRunCommandInput, - ModifyRunCommandBody, - SubmitToolOuputsToRunCommandInput, - SubmitToolOuputsToRunCommandBody, - CancelRunCommandInput, - ListRunStepsCommandQuery, - ListRunStepsCommandInput, - ListRunStepsResponse, - GetRunStepCommandQuery, - GetRunStepCommandInput, - RunStepObject, - ListVectorStoresCommandQuery, - ListVectorStoresCommandInput, - ListVectorStoresResponse, - CreateVectorStoreCommandInput, - CreateVectorStoreCommandBody, - VectorStoreObject, - GetVectorStoreCommandInput, - ModifyVectorStoreCommandInput, - ModifyVectorStoreCommandBody, - DeleteVectorStoreCommandInput, - DeleteVectorStoreResponse, - ListVectorStoreFilesCommandQuery, - ListVectorStoreFilesCommandInput, - ListVectorStoreFilesResponse, - CreateVectorStoreFileCommandInput, - CreateVectorStoreFileCommandBody, - VectorStoreFileObject, - GetVectorStoreFileCommandInput, - DeleteVectorStoreFileCommandInput, - DeleteVectorStoreFileResponse, - CreateVectorStoreFileBatchCommandInput, - CreateVectorStoreFileBatchCommandBody, - VectorStoreFileBatchObject, - GetVectorStoreFileBatchCommandInput, - CancelVectorStoreFileBatchCommandInput, - ListFilesInVectorStoreBatchCommandQuery, - ListFilesInVectorStoreBatchCommandInput, - CreateBatchCommandInput, - Batch, - ListBatchesCommandQuery, - ListBatchesCommandInput, - ListBatchesResponse, - RetrieveBatchCommandInput, - CancelBatchCommandInput, - ListAuditLogsCommandQuery, - ListAuditLogsCommandInput, - ListAuditLogsResponse, - ListInvitesCommandQuery, - ListInvitesCommandInput, - InviteListResponse, - InviteUserCommandInput, - InviteUserCommandBody, - Invite, - RetrieveInviteCommandInput, - DeleteInviteCommandInput, - InviteDeleteResponse, - ListUsersCommandQuery, - ListUsersCommandInput, - UserListResponse, - RetrieveUserCommandInput, - User, - ModifyUserCommandInput, - ModifyUserCommandBody, - DeleteUserCommandInput, - UserDeleteResponse, - ListProjectsCommandQuery, - ListProjectsCommandInput, - ProjectListResponse, - CreateProjectCommandInput, - CreateProjectCommandBody, - Project, - RetrieveProjectCommandInput, - ModifyProjectCommandInput, - ModifyProjectCommandBody, - ArchiveProjectCommandInput, - ListProjectUsersCommandQuery, - ListProjectUsersCommandInput, - ProjectUserListResponse, - CreateProjectUserCommandInput, - CreateProjectUserCommandBody, - ProjectUser, - RetrieveProjectUserCommandInput, - ModifyProjectUserCommandInput, - ModifyProjectUserCommandBody, - DeleteProjectUserCommandInput, - ProjectUserDeleteResponse, - ListProjectServiceAccountsCommandQuery, - ListProjectServiceAccountsCommandInput, - ProjectServiceAccountListResponse, - CreateProjectServiceAccountCommandInput, - CreateProjectServiceAccountCommandBody, - ProjectServiceAccountCreateResponse, - RetrieveProjectServiceAccountCommandInput, - ProjectServiceAccount, - DeleteProjectServiceAccountCommandInput, - ProjectServiceAccountDeleteResponse, - ListProjectApiKeysCommandQuery, - ListProjectApiKeysCommandInput, - ProjectApiKeyListResponse, - RetrieveProjectApiKeyCommandInput, - ProjectApiKey, - DeleteProjectApiKeyCommandInput, - ProjectApiKeyDeleteResponse, -} from './types.js'; + AddUploadPartCommandInput, + ArchiveProjectCommandInput, + AssistantObject, + Batch, + CancelBatchCommandInput, + CancelFineTuningJobCommandInput, + CancelRunCommandInput, + CancelUploadCommandInput, + CancelVectorStoreFileBatchCommandInput, + CompleteUploadCommandInput, + CreateAssistantCommandInput, + CreateBatchCommandInput, + CreateChatCompletionCommandInput, + CreateChatCompletionResponse, + CreateCompletionCommandInput, + CreateCompletionResponse, + CreateEmbeddingCommandInput, + CreateEmbeddingResponse, + CreateFileCommandInput, + CreateFineTuningJobCommandInput, + CreateImageCommandInput, + CreateImageEditCommandInput, + CreateImageVariationCommandInput, + CreateMessageCommandInput, + CreateModerationCommandInput, + CreateModerationResponse, + CreateProjectCommandInput, + CreateProjectServiceAccountCommandInput, + CreateProjectUserCommandInput, + CreateRunCommandInput, + CreateRunCommandQuery, + CreateSpeechCommandInput, + CreateThreadAndRunCommandInput, + CreateThreadCommandInput, + CreateTranscriptionCommandInput, + CreateTranscriptionCommandOutput, + CreateTranslationCommandInput, + CreateTranslationCommandOutput, + CreateUploadCommandInput, + CreateVectorStoreCommandInput, + CreateVectorStoreFileBatchCommandInput, + CreateVectorStoreFileCommandInput, + DeleteAssistantCommandInput, + DeleteAssistantResponse, + DeleteFileCommandInput, + DeleteFileResponse, + DeleteInviteCommandInput, + DeleteMessageCommandInput, + DeleteMessageResponse, + DeleteModelCommandInput, + DeleteModelResponse, + DeleteProjectApiKeyCommandInput, + DeleteProjectServiceAccountCommandInput, + DeleteProjectUserCommandInput, + DeleteThreadCommandInput, + DeleteThreadResponse, + DeleteUserCommandInput, + DeleteVectorStoreCommandInput, + DeleteVectorStoreFileCommandInput, + DeleteVectorStoreFileResponse, + DeleteVectorStoreResponse, + DownloadFileCommandInput, + DownloadFileCommandOutput, + FineTuningJob, + GetAssistantCommandInput, + GetMessageCommandInput, + GetRunCommandInput, + GetRunStepCommandInput, + GetRunStepCommandQuery, + GetThreadCommandInput, + GetVectorStoreCommandInput, + GetVectorStoreFileBatchCommandInput, + GetVectorStoreFileCommandInput, + ImagesResponse, + Invite, + InviteDeleteResponse, + InviteListResponse, + InviteUserCommandInput, + ListAssistantsCommandInput, + ListAssistantsCommandQuery, + ListAssistantsResponse, + ListAuditLogsCommandInput, + ListAuditLogsCommandQuery, + ListAuditLogsResponse, + ListBatchesCommandInput, + ListBatchesCommandQuery, + ListBatchesResponse, + ListFilesCommandInput, + ListFilesCommandQuery, + ListFilesInVectorStoreBatchCommandInput, + ListFilesInVectorStoreBatchCommandQuery, + ListFilesResponse, + ListFineTuningEventsCommandInput, + ListFineTuningEventsCommandQuery, + ListFineTuningJobCheckpointsCommandInput, + ListFineTuningJobCheckpointsCommandQuery, + ListFineTuningJobCheckpointsResponse, + ListFineTuningJobEventsResponse, + ListInvitesCommandInput, + ListInvitesCommandQuery, + ListMessagesCommandInput, + ListMessagesCommandQuery, + ListMessagesResponse, + ListModelsCommandInput, + ListModelsResponse, + ListPaginatedFineTuningJobsCommandInput, + ListPaginatedFineTuningJobsCommandQuery, + ListPaginatedFineTuningJobsResponse, + ListProjectApiKeysCommandInput, + ListProjectApiKeysCommandQuery, + ListProjectServiceAccountsCommandInput, + ListProjectServiceAccountsCommandQuery, + ListProjectsCommandInput, + ListProjectsCommandQuery, + ListProjectUsersCommandInput, + ListProjectUsersCommandQuery, + ListRunStepsCommandInput, + ListRunStepsCommandQuery, + ListRunStepsResponse, + ListRunsCommandInput, + ListRunsCommandQuery, + ListRunsResponse, + ListUsersCommandInput, + ListUsersCommandQuery, + ListVectorStoreFilesCommandInput, + ListVectorStoreFilesCommandQuery, + ListVectorStoreFilesResponse, + ListVectorStoresCommandInput, + ListVectorStoresCommandQuery, + ListVectorStoresResponse, + MessageObject, + Model, + ModifyAssistantCommandInput, + ModifyMessageCommandInput, + ModifyProjectCommandInput, + ModifyProjectUserCommandInput, + ModifyRunCommandInput, + ModifyThreadCommandInput, + ModifyUserCommandInput, + ModifyVectorStoreCommandInput, + OpenAiFile, + Project, + ProjectApiKey, + ProjectApiKeyDeleteResponse, + ProjectApiKeyListResponse, + ProjectListResponse, + ProjectServiceAccount, + ProjectServiceAccountCreateResponse, + ProjectServiceAccountDeleteResponse, + ProjectServiceAccountListResponse, + ProjectUser, + ProjectUserDeleteResponse, + ProjectUserListResponse, + RetrieveBatchCommandInput, + RetrieveFileCommandInput, + RetrieveFineTuningJobCommandInput, + RetrieveInviteCommandInput, + RetrieveModelCommandInput, + RetrieveProjectApiKeyCommandInput, + RetrieveProjectCommandInput, + RetrieveProjectServiceAccountCommandInput, + RetrieveProjectUserCommandInput, + RetrieveUserCommandInput, + RunObject, + RunStepObject, + SubmitToolOuputsToRunCommandInput, + ThreadObject, + Upload, + UploadPart, + User, + UserDeleteResponse, + UserListResponse, + VectorStoreFileBatchObject, + VectorStoreFileObject, + VectorStoreObject, +} from "./types.js"; /** * CreateChatCompletionCommand @@ -219,16 +192,15 @@ import type { * @summary Creates a model response for the given chat conversation. */ export class CreateChatCompletionCommand extends Command< - CreateChatCompletionCommandInput, - CreateChatCompletionResponse, - CreateChatCompletionCommandBody + CreateChatCompletionCommandInput, + CreateChatCompletionResponse > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: CreateChatCompletionCommandInput) { - const body = input; - super(`/chat/completions`, body); - } + constructor(input: CreateChatCompletionCommandInput) { + const body = input; + super("/chat/completions", jsonStringify(body)); + } } /** @@ -237,16 +209,15 @@ export class CreateChatCompletionCommand extends Command< * @summary Creates a completion for the provided prompt and parameters. */ export class CreateCompletionCommand extends Command< - CreateCompletionCommandInput, - CreateCompletionResponse, - CreateCompletionCommandBody + CreateCompletionCommandInput, + CreateCompletionResponse > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: CreateCompletionCommandInput) { - const body = input; - super(`/completions`, body); - } + constructor(input: CreateCompletionCommandInput) { + const body = input; + super("/completions", jsonStringify(body)); + } } /** @@ -255,16 +226,15 @@ export class CreateCompletionCommand extends Command< * @summary Creates an image given a prompt. */ export class CreateImageCommand extends Command< - CreateImageCommandInput, - ImagesResponse, - CreateImageCommandBody + CreateImageCommandInput, + ImagesResponse > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: CreateImageCommandInput) { - const body = input; - super(`/images/generations`, body); - } + constructor(input: CreateImageCommandInput) { + const body = input; + super("/images/generations", jsonStringify(body)); + } } /** @@ -273,11 +243,15 @@ export class CreateImageCommand extends Command< * @summary Creates an edited or extended image given an original image and a prompt. */ export class CreateImageEditCommand extends Command< - CreateImageEditCommandInput, - ImagesResponse, - never + CreateImageEditCommandInput, + ImagesResponse > { - public override method = 'post' as const; + public override method = "post" as const; + + constructor(input: CreateImageEditCommandInput) { + const { body } = input; + super("/images/edits", body); + } } /** @@ -286,11 +260,15 @@ export class CreateImageEditCommand extends Command< * @summary Creates a variation of a given image. */ export class CreateImageVariationCommand extends Command< - CreateImageVariationCommandInput, - ImagesResponse, - never + CreateImageVariationCommandInput, + ImagesResponse > { - public override method = 'post' as const; + public override method = "post" as const; + + constructor(input: CreateImageVariationCommandInput) { + const { body } = input; + super("/images/variations", body); + } } /** @@ -299,16 +277,15 @@ export class CreateImageVariationCommand extends Command< * @summary Creates an embedding vector representing the input text. */ export class CreateEmbeddingCommand extends Command< - CreateEmbeddingCommandInput, - CreateEmbeddingResponse, - CreateEmbeddingCommandBody + CreateEmbeddingCommandInput, + CreateEmbeddingResponse > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: CreateEmbeddingCommandInput) { - const body = input; - super(`/embeddings`, body); - } + constructor(input: CreateEmbeddingCommandInput) { + const body = input; + super("/embeddings", jsonStringify(body)); + } } /** @@ -317,16 +294,15 @@ export class CreateEmbeddingCommand extends Command< * @summary Generates audio from the input text. */ export class CreateSpeechCommand extends Command< - CreateSpeechCommandInput, - unknown, - CreateSpeechCommandBody + CreateSpeechCommandInput, + unknown > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: CreateSpeechCommandInput) { - const body = input; - super(`/audio/speech`, body); - } + constructor(input: CreateSpeechCommandInput) { + const body = input; + super("/audio/speech", jsonStringify(body)); + } } /** @@ -335,11 +311,15 @@ export class CreateSpeechCommand extends Command< * @summary Transcribes audio into the input language. */ export class CreateTranscriptionCommand extends Command< - CreateTranscriptionCommandInput, - unknown, - never + CreateTranscriptionCommandInput, + CreateTranscriptionCommandOutput > { - public override method = 'post' as const; + public override method = "post" as const; + + constructor(input: CreateTranscriptionCommandInput) { + const { body } = input; + super("/audio/transcriptions", body); + } } /** @@ -348,11 +328,15 @@ export class CreateTranscriptionCommand extends Command< * @summary Translates audio into English. */ export class CreateTranslationCommand extends Command< - CreateTranslationCommandInput, - unknown, - never + CreateTranslationCommandInput, + CreateTranslationCommandOutput > { - public override method = 'post' as const; + public override method = "post" as const; + + constructor(input: CreateTranslationCommandInput) { + const { body } = input; + super("/audio/translations", body); + } } /** @@ -361,17 +345,16 @@ export class CreateTranslationCommand extends Command< * @summary Returns a list of files that belong to the user's organization. */ export class ListFilesCommand extends Command< - ListFilesCommandInput, - ListFilesResponse, - never, - ListFilesCommandQuery + ListFilesCommandInput, + ListFilesResponse, + ListFilesCommandQuery > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: ListFilesCommandInput) { - const { purpose } = input; - super(`/files`, undefined, { purpose }); - } + constructor(input: ListFilesCommandInput) { + const { purpose } = input; + super("/files", undefined, stripUndefined({ purpose })); + } } /** @@ -398,11 +381,15 @@ export class ListFilesCommand extends Command< * storage limits. */ export class CreateFileCommand extends Command< - CreateFileCommandInput, - OpenAiFile, - never + CreateFileCommandInput, + OpenAiFile > { - public override method = 'post' as const; + public override method = "post" as const; + + constructor(input: CreateFileCommandInput) { + const { body } = input; + super("/files", body); + } } /** @@ -411,16 +398,15 @@ export class CreateFileCommand extends Command< * @summary Delete a file. */ export class DeleteFileCommand extends Command< - DeleteFileCommandInput, - DeleteFileResponse, - never + DeleteFileCommandInput, + DeleteFileResponse > { - public override method = 'delete' as const; + public override method = "delete" as const; - constructor(input: DeleteFileCommandInput) { - const { file_id } = input; - super(`/files/${file_id}`); - } + constructor(input: DeleteFileCommandInput) { + const { file_id } = input; + super(`/files/${file_id}`); + } } /** @@ -429,16 +415,15 @@ export class DeleteFileCommand extends Command< * @summary Returns information about a specific file. */ export class RetrieveFileCommand extends Command< - RetrieveFileCommandInput, - OpenAiFile, - never + RetrieveFileCommandInput, + OpenAiFile > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: RetrieveFileCommandInput) { - const { file_id } = input; - super(`/files/${file_id}`); - } + constructor(input: RetrieveFileCommandInput) { + const { file_id } = input; + super(`/files/${file_id}`); + } } /** @@ -447,16 +432,15 @@ export class RetrieveFileCommand extends Command< * @summary Returns the contents of the specified file. */ export class DownloadFileCommand extends Command< - DownloadFileCommandInput, - unknown, - never + DownloadFileCommandInput, + DownloadFileCommandOutput > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: DownloadFileCommandInput) { - const { file_id } = input; - super(`/files/${file_id}/content`); - } + constructor(input: DownloadFileCommandInput) { + const { file_id } = input; + super(`/files/${file_id}/content`); + } } /** @@ -481,16 +465,15 @@ export class DownloadFileCommand extends Command< * File](/docs/api-reference/files/create). */ export class CreateUploadCommand extends Command< - CreateUploadCommandInput, - Upload, - CreateUploadCommandBody + CreateUploadCommandInput, + Upload > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: CreateUploadCommandInput) { - const body = input; - super(`/uploads`, body); - } + constructor(input: CreateUploadCommandInput) { + const body = input; + super("/uploads", jsonStringify(body)); + } } /** @@ -508,16 +491,15 @@ export class CreateUploadCommand extends Command< * Upload](/docs/api-reference/uploads/complete). */ export class AddUploadPartCommand extends Command< - AddUploadPartCommandInput, - UploadPart, - never + AddUploadPartCommandInput, + UploadPart > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: AddUploadPartCommandInput) { - const { upload_id } = input; - super(`/uploads/${upload_id}/parts`); - } + constructor(input: AddUploadPartCommandInput) { + const { upload_id, body } = input; + super(`/uploads/${upload_id}/parts`, body); + } } /** @@ -537,16 +519,15 @@ export class AddUploadPartCommand extends Command< * after an Upload is completed. */ export class CompleteUploadCommand extends Command< - CompleteUploadCommandInput, - Upload, - CompleteUploadCommandBody + CompleteUploadCommandInput, + Upload > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: CompleteUploadCommandInput) { - const { upload_id, ...body } = input; - super(`/uploads/${upload_id}/complete`, body); - } + constructor(input: CompleteUploadCommandInput) { + const { upload_id, ...body } = input; + super(`/uploads/${upload_id}/complete`, jsonStringify(body)); + } } /** @@ -555,16 +536,15 @@ export class CompleteUploadCommand extends Command< * @summary Cancels the Upload. No Parts may be added after an Upload is cancelled. */ export class CancelUploadCommand extends Command< - CancelUploadCommandInput, - Upload, - never + CancelUploadCommandInput, + Upload > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: CancelUploadCommandInput) { - const { upload_id } = input; - super(`/uploads/${upload_id}/cancel`); - } + constructor(input: CancelUploadCommandInput) { + const { upload_id } = input; + super(`/uploads/${upload_id}/cancel`); + } } /** @@ -579,16 +559,15 @@ export class CancelUploadCommand extends Command< * [Learn more about fine-tuning](/docs/guides/fine-tuning) */ export class CreateFineTuningJobCommand extends Command< - CreateFineTuningJobCommandInput, - FineTuningJob, - CreateFineTuningJobCommandBody + CreateFineTuningJobCommandInput, + FineTuningJob > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: CreateFineTuningJobCommandInput) { - const body = input; - super(`/fine_tuning/jobs`, body); - } + constructor(input: CreateFineTuningJobCommandInput) { + const body = input; + super("/fine_tuning/jobs", jsonStringify(body)); + } } /** @@ -597,17 +576,16 @@ export class CreateFineTuningJobCommand extends Command< * @summary List your organization's fine-tuning jobs */ export class ListPaginatedFineTuningJobsCommand extends Command< - ListPaginatedFineTuningJobsCommandInput, - ListPaginatedFineTuningJobsResponse, - never, - ListPaginatedFineTuningJobsCommandQuery + ListPaginatedFineTuningJobsCommandInput, + ListPaginatedFineTuningJobsResponse, + ListPaginatedFineTuningJobsCommandQuery > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: ListPaginatedFineTuningJobsCommandInput) { - const { after, limit } = input; - super(`/fine_tuning/jobs`, undefined, { after, limit }); - } + constructor(input: ListPaginatedFineTuningJobsCommandInput) { + const { after, limit } = input; + super("/fine_tuning/jobs", undefined, stripUndefined({ after, limit })); + } } /** @@ -618,16 +596,15 @@ export class ListPaginatedFineTuningJobsCommand extends Command< * [Learn more about fine-tuning](/docs/guides/fine-tuning) */ export class RetrieveFineTuningJobCommand extends Command< - RetrieveFineTuningJobCommandInput, - FineTuningJob, - never + RetrieveFineTuningJobCommandInput, + FineTuningJob > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: RetrieveFineTuningJobCommandInput) { - const { fine_tuning_job_id } = input; - super(`/fine_tuning/jobs/${fine_tuning_job_id}`); - } + constructor(input: RetrieveFineTuningJobCommandInput) { + const { fine_tuning_job_id } = input; + super(`/fine_tuning/jobs/${fine_tuning_job_id}`); + } } /** @@ -636,20 +613,20 @@ export class RetrieveFineTuningJobCommand extends Command< * @summary Get status updates for a fine-tuning job. */ export class ListFineTuningEventsCommand extends Command< - ListFineTuningEventsCommandInput, - ListFineTuningJobEventsResponse, - never, - ListFineTuningEventsCommandQuery + ListFineTuningEventsCommandInput, + ListFineTuningJobEventsResponse, + ListFineTuningEventsCommandQuery > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: ListFineTuningEventsCommandInput) { - const { fine_tuning_job_id, after, limit } = input; - super(`/fine_tuning/jobs/${fine_tuning_job_id}/events`, undefined, { - after, - limit, - }); - } + constructor(input: ListFineTuningEventsCommandInput) { + const { fine_tuning_job_id, after, limit } = input; + super( + `/fine_tuning/jobs/${fine_tuning_job_id}/events`, + undefined, + stripUndefined({ after, limit }), + ); + } } /** @@ -658,16 +635,15 @@ export class ListFineTuningEventsCommand extends Command< * @summary Immediately cancel a fine-tune job. */ export class CancelFineTuningJobCommand extends Command< - CancelFineTuningJobCommandInput, - FineTuningJob, - never + CancelFineTuningJobCommandInput, + FineTuningJob > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: CancelFineTuningJobCommandInput) { - const { fine_tuning_job_id } = input; - super(`/fine_tuning/jobs/${fine_tuning_job_id}/cancel`); - } + constructor(input: CancelFineTuningJobCommandInput) { + const { fine_tuning_job_id } = input; + super(`/fine_tuning/jobs/${fine_tuning_job_id}/cancel`); + } } /** @@ -676,20 +652,20 @@ export class CancelFineTuningJobCommand extends Command< * @summary List checkpoints for a fine-tuning job. */ export class ListFineTuningJobCheckpointsCommand extends Command< - ListFineTuningJobCheckpointsCommandInput, - ListFineTuningJobCheckpointsResponse, - never, - ListFineTuningJobCheckpointsCommandQuery + ListFineTuningJobCheckpointsCommandInput, + ListFineTuningJobCheckpointsResponse, + ListFineTuningJobCheckpointsCommandQuery > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: ListFineTuningJobCheckpointsCommandInput) { - const { fine_tuning_job_id, after, limit } = input; - super(`/fine_tuning/jobs/${fine_tuning_job_id}/checkpoints`, undefined, { - after, - limit, - }); - } + constructor(input: ListFineTuningJobCheckpointsCommandInput) { + const { fine_tuning_job_id, after, limit } = input; + super( + `/fine_tuning/jobs/${fine_tuning_job_id}/checkpoints`, + undefined, + stripUndefined({ after, limit }), + ); + } } /** @@ -699,11 +675,10 @@ export class ListFineTuningJobCheckpointsCommand extends Command< * each one such as the owner and availability. */ export class ListModelsCommand extends Command< - ListModelsCommandInput, - ListModelsResponse, - never + ListModelsCommandInput, + ListModelsResponse > { - public override method = 'get' as const; + public override method = "get" as const; } /** @@ -713,16 +688,15 @@ export class ListModelsCommand extends Command< * such as the owner and permissioning. */ export class RetrieveModelCommand extends Command< - RetrieveModelCommandInput, - Model, - never + RetrieveModelCommandInput, + Model > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: RetrieveModelCommandInput) { - const { model } = input; - super(`/models/${model}`); - } + constructor(input: RetrieveModelCommandInput) { + const { model } = input; + super(`/models/${model}`); + } } /** @@ -732,16 +706,15 @@ export class RetrieveModelCommand extends Command< * organization to delete a model. */ export class DeleteModelCommand extends Command< - DeleteModelCommandInput, - DeleteModelResponse, - never + DeleteModelCommandInput, + DeleteModelResponse > { - public override method = 'delete' as const; + public override method = "delete" as const; - constructor(input: DeleteModelCommandInput) { - const { model } = input; - super(`/models/${model}`); - } + constructor(input: DeleteModelCommandInput) { + const { model } = input; + super(`/models/${model}`); + } } /** @@ -751,16 +724,15 @@ export class DeleteModelCommand extends Command< * more in the [moderation guide](/docs/guides/moderation). */ export class CreateModerationCommand extends Command< - CreateModerationCommandInput, - CreateModerationResponse, - CreateModerationCommandBody + CreateModerationCommandInput, + CreateModerationResponse > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: CreateModerationCommandInput) { - const body = input; - super(`/moderations`, body); - } + constructor(input: CreateModerationCommandInput) { + const body = input; + super("/moderations", jsonStringify(body)); + } } /** @@ -769,17 +741,20 @@ export class CreateModerationCommand extends Command< * @summary Returns a list of assistants. */ export class ListAssistantsCommand extends Command< - ListAssistantsCommandInput, - ListAssistantsResponse, - never, - ListAssistantsCommandQuery + ListAssistantsCommandInput, + ListAssistantsResponse, + ListAssistantsCommandQuery > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: ListAssistantsCommandInput) { - const { limit, order, after, before } = input; - super(`/assistants`, undefined, { limit, order, after, before }); - } + constructor(input: ListAssistantsCommandInput) { + const { limit, order, after, before } = input; + super( + "/assistants", + undefined, + stripUndefined({ limit, order, after, before }), + ); + } } /** @@ -788,16 +763,15 @@ export class ListAssistantsCommand extends Command< * @summary Create an assistant with a model and instructions. */ export class CreateAssistantCommand extends Command< - CreateAssistantCommandInput, - AssistantObject, - CreateAssistantCommandBody + CreateAssistantCommandInput, + AssistantObject > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: CreateAssistantCommandInput) { - const body = input; - super(`/assistants`, body); - } + constructor(input: CreateAssistantCommandInput) { + const body = input; + super("/assistants", jsonStringify(body)); + } } /** @@ -806,16 +780,15 @@ export class CreateAssistantCommand extends Command< * @summary Retrieves an assistant. */ export class GetAssistantCommand extends Command< - GetAssistantCommandInput, - AssistantObject, - never + GetAssistantCommandInput, + AssistantObject > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: GetAssistantCommandInput) { - const { assistant_id } = input; - super(`/assistants/${assistant_id}`); - } + constructor(input: GetAssistantCommandInput) { + const { assistant_id } = input; + super(`/assistants/${assistant_id}`); + } } /** @@ -824,16 +797,15 @@ export class GetAssistantCommand extends Command< * @summary Modifies an assistant. */ export class ModifyAssistantCommand extends Command< - ModifyAssistantCommandInput, - AssistantObject, - ModifyAssistantCommandBody + ModifyAssistantCommandInput, + AssistantObject > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: ModifyAssistantCommandInput) { - const { assistant_id, ...body } = input; - super(`/assistants/${assistant_id}`, body); - } + constructor(input: ModifyAssistantCommandInput) { + const { assistant_id, ...body } = input; + super(`/assistants/${assistant_id}`, jsonStringify(body)); + } } /** @@ -842,16 +814,15 @@ export class ModifyAssistantCommand extends Command< * @summary Delete an assistant. */ export class DeleteAssistantCommand extends Command< - DeleteAssistantCommandInput, - DeleteAssistantResponse, - never + DeleteAssistantCommandInput, + DeleteAssistantResponse > { - public override method = 'delete' as const; + public override method = "delete" as const; - constructor(input: DeleteAssistantCommandInput) { - const { assistant_id } = input; - super(`/assistants/${assistant_id}`); - } + constructor(input: DeleteAssistantCommandInput) { + const { assistant_id } = input; + super(`/assistants/${assistant_id}`); + } } /** @@ -860,16 +831,15 @@ export class DeleteAssistantCommand extends Command< * @summary Create a thread. */ export class CreateThreadCommand extends Command< - CreateThreadCommandInput, - ThreadObject, - CreateThreadCommandBody + CreateThreadCommandInput, + ThreadObject > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: CreateThreadCommandInput) { - const body = input; - super(`/threads`, body); - } + constructor(input: CreateThreadCommandInput) { + const body = input; + super("/threads", jsonStringify(body)); + } } /** @@ -878,16 +848,15 @@ export class CreateThreadCommand extends Command< * @summary Retrieves a thread. */ export class GetThreadCommand extends Command< - GetThreadCommandInput, - ThreadObject, - never + GetThreadCommandInput, + ThreadObject > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: GetThreadCommandInput) { - const { thread_id } = input; - super(`/threads/${thread_id}`); - } + constructor(input: GetThreadCommandInput) { + const { thread_id } = input; + super(`/threads/${thread_id}`); + } } /** @@ -896,16 +865,15 @@ export class GetThreadCommand extends Command< * @summary Modifies a thread. */ export class ModifyThreadCommand extends Command< - ModifyThreadCommandInput, - ThreadObject, - ModifyThreadCommandBody + ModifyThreadCommandInput, + ThreadObject > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: ModifyThreadCommandInput) { - const { thread_id, ...body } = input; - super(`/threads/${thread_id}`, body); - } + constructor(input: ModifyThreadCommandInput) { + const { thread_id, ...body } = input; + super(`/threads/${thread_id}`, jsonStringify(body)); + } } /** @@ -914,16 +882,15 @@ export class ModifyThreadCommand extends Command< * @summary Delete a thread. */ export class DeleteThreadCommand extends Command< - DeleteThreadCommandInput, - DeleteThreadResponse, - never + DeleteThreadCommandInput, + DeleteThreadResponse > { - public override method = 'delete' as const; + public override method = "delete" as const; - constructor(input: DeleteThreadCommandInput) { - const { thread_id } = input; - super(`/threads/${thread_id}`); - } + constructor(input: DeleteThreadCommandInput) { + const { thread_id } = input; + super(`/threads/${thread_id}`); + } } /** @@ -932,23 +899,20 @@ export class DeleteThreadCommand extends Command< * @summary Returns a list of messages for a given thread. */ export class ListMessagesCommand extends Command< - ListMessagesCommandInput, - ListMessagesResponse, - never, - ListMessagesCommandQuery + ListMessagesCommandInput, + ListMessagesResponse, + ListMessagesCommandQuery > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: ListMessagesCommandInput) { - const { thread_id, limit, order, after, before, run_id } = input; - super(`/threads/${thread_id}/messages`, undefined, { - limit, - order, - after, - before, - run_id, - }); - } + constructor(input: ListMessagesCommandInput) { + const { thread_id, limit, order, after, before, run_id } = input; + super( + `/threads/${thread_id}/messages`, + undefined, + stripUndefined({ limit, order, after, before, run_id }), + ); + } } /** @@ -957,16 +921,15 @@ export class ListMessagesCommand extends Command< * @summary Create a message. */ export class CreateMessageCommand extends Command< - CreateMessageCommandInput, - MessageObject, - CreateMessageCommandBody + CreateMessageCommandInput, + MessageObject > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: CreateMessageCommandInput) { - const { thread_id, ...body } = input; - super(`/threads/${thread_id}/messages`, body); - } + constructor(input: CreateMessageCommandInput) { + const { thread_id, ...body } = input; + super(`/threads/${thread_id}/messages`, jsonStringify(body)); + } } /** @@ -975,16 +938,15 @@ export class CreateMessageCommand extends Command< * @summary Retrieve a message. */ export class GetMessageCommand extends Command< - GetMessageCommandInput, - MessageObject, - never + GetMessageCommandInput, + MessageObject > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: GetMessageCommandInput) { - const { thread_id, message_id } = input; - super(`/threads/${thread_id}/messages/${message_id}`); - } + constructor(input: GetMessageCommandInput) { + const { thread_id, message_id } = input; + super(`/threads/${thread_id}/messages/${message_id}`); + } } /** @@ -993,16 +955,15 @@ export class GetMessageCommand extends Command< * @summary Modifies a message. */ export class ModifyMessageCommand extends Command< - ModifyMessageCommandInput, - MessageObject, - ModifyMessageCommandBody + ModifyMessageCommandInput, + MessageObject > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: ModifyMessageCommandInput) { - const { thread_id, message_id, ...body } = input; - super(`/threads/${thread_id}/messages/${message_id}`, body); - } + constructor(input: ModifyMessageCommandInput) { + const { thread_id, message_id, ...body } = input; + super(`/threads/${thread_id}/messages/${message_id}`, jsonStringify(body)); + } } /** @@ -1011,16 +972,15 @@ export class ModifyMessageCommand extends Command< * @summary Deletes a message. */ export class DeleteMessageCommand extends Command< - DeleteMessageCommandInput, - DeleteMessageResponse, - never + DeleteMessageCommandInput, + DeleteMessageResponse > { - public override method = 'delete' as const; + public override method = "delete" as const; - constructor(input: DeleteMessageCommandInput) { - const { thread_id, message_id } = input; - super(`/threads/${thread_id}/messages/${message_id}`); - } + constructor(input: DeleteMessageCommandInput) { + const { thread_id, message_id } = input; + super(`/threads/${thread_id}/messages/${message_id}`); + } } /** @@ -1029,16 +989,15 @@ export class DeleteMessageCommand extends Command< * @summary Create a thread and run it in one request. */ export class CreateThreadAndRunCommand extends Command< - CreateThreadAndRunCommandInput, - RunObject, - CreateThreadAndRunCommandBody + CreateThreadAndRunCommandInput, + RunObject > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: CreateThreadAndRunCommandInput) { - const body = input; - super(`/threads/runs`, body); - } + constructor(input: CreateThreadAndRunCommandInput) { + const body = input; + super("/threads/runs", jsonStringify(body)); + } } /** @@ -1047,22 +1006,20 @@ export class CreateThreadAndRunCommand extends Command< * @summary Returns a list of runs belonging to a thread. */ export class ListRunsCommand extends Command< - ListRunsCommandInput, - ListRunsResponse, - never, - ListRunsCommandQuery + ListRunsCommandInput, + ListRunsResponse, + ListRunsCommandQuery > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: ListRunsCommandInput) { - const { thread_id, limit, order, after, before } = input; - super(`/threads/${thread_id}/runs`, undefined, { - limit, - order, - after, - before, - }); - } + constructor(input: ListRunsCommandInput) { + const { thread_id, limit, order, after, before } = input; + super( + `/threads/${thread_id}/runs`, + undefined, + stripUndefined({ limit, order, after, before }), + ); + } } /** @@ -1071,17 +1028,20 @@ export class ListRunsCommand extends Command< * @summary Create a run. */ export class CreateRunCommand extends Command< - CreateRunCommandInput, - RunObject, - CreateRunCommandBody, - CreateRunCommandQuery + CreateRunCommandInput, + RunObject, + CreateRunCommandQuery > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: CreateRunCommandInput) { - const { thread_id, include, ...body } = input; - super(`/threads/${thread_id}/runs`, body, { include }); - } + constructor(input: CreateRunCommandInput) { + const { thread_id, include, ...body } = input; + super( + `/threads/${thread_id}/runs`, + jsonStringify(body), + stripUndefined({ include }), + ); + } } /** @@ -1089,17 +1049,13 @@ export class CreateRunCommand extends Command< * * @summary Retrieves a run. */ -export class GetRunCommand extends Command< - GetRunCommandInput, - RunObject, - never -> { - public override method = 'get' as const; +export class GetRunCommand extends Command { + public override method = "get" as const; - constructor(input: GetRunCommandInput) { - const { thread_id, run_id } = input; - super(`/threads/${thread_id}/runs/${run_id}`); - } + constructor(input: GetRunCommandInput) { + const { thread_id, run_id } = input; + super(`/threads/${thread_id}/runs/${run_id}`); + } } /** @@ -1108,16 +1064,15 @@ export class GetRunCommand extends Command< * @summary Modifies a run. */ export class ModifyRunCommand extends Command< - ModifyRunCommandInput, - RunObject, - ModifyRunCommandBody + ModifyRunCommandInput, + RunObject > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: ModifyRunCommandInput) { - const { thread_id, run_id, ...body } = input; - super(`/threads/${thread_id}/runs/${run_id}`, body); - } + constructor(input: ModifyRunCommandInput) { + const { thread_id, run_id, ...body } = input; + super(`/threads/${thread_id}/runs/${run_id}`, jsonStringify(body)); + } } /** @@ -1129,16 +1084,18 @@ export class ModifyRunCommand extends Command< * submitted in a single request. */ export class SubmitToolOuputsToRunCommand extends Command< - SubmitToolOuputsToRunCommandInput, - RunObject, - SubmitToolOuputsToRunCommandBody + SubmitToolOuputsToRunCommandInput, + RunObject > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: SubmitToolOuputsToRunCommandInput) { - const { thread_id, run_id, ...body } = input; - super(`/threads/${thread_id}/runs/${run_id}/submit_tool_outputs`, body); - } + constructor(input: SubmitToolOuputsToRunCommandInput) { + const { thread_id, run_id, ...body } = input; + super( + `/threads/${thread_id}/runs/${run_id}/submit_tool_outputs`, + jsonStringify(body), + ); + } } /** @@ -1147,16 +1104,15 @@ export class SubmitToolOuputsToRunCommand extends Command< * @summary Cancels a run that is `in_progress`. */ export class CancelRunCommand extends Command< - CancelRunCommandInput, - RunObject, - never + CancelRunCommandInput, + RunObject > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: CancelRunCommandInput) { - const { thread_id, run_id } = input; - super(`/threads/${thread_id}/runs/${run_id}/cancel`); - } + constructor(input: CancelRunCommandInput) { + const { thread_id, run_id } = input; + super(`/threads/${thread_id}/runs/${run_id}/cancel`); + } } /** @@ -1165,23 +1121,20 @@ export class CancelRunCommand extends Command< * @summary Returns a list of run steps belonging to a run. */ export class ListRunStepsCommand extends Command< - ListRunStepsCommandInput, - ListRunStepsResponse, - never, - ListRunStepsCommandQuery + ListRunStepsCommandInput, + ListRunStepsResponse, + ListRunStepsCommandQuery > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: ListRunStepsCommandInput) { - const { thread_id, run_id, limit, order, after, before, include } = input; - super(`/threads/${thread_id}/runs/${run_id}/steps`, undefined, { - limit, - order, - after, - before, - include, - }); - } + constructor(input: ListRunStepsCommandInput) { + const { thread_id, run_id, limit, order, after, before, include } = input; + super( + `/threads/${thread_id}/runs/${run_id}/steps`, + undefined, + stripUndefined({ limit, order, after, before, include }), + ); + } } /** @@ -1190,19 +1143,20 @@ export class ListRunStepsCommand extends Command< * @summary Retrieves a run step. */ export class GetRunStepCommand extends Command< - GetRunStepCommandInput, - RunStepObject, - never, - GetRunStepCommandQuery + GetRunStepCommandInput, + RunStepObject, + GetRunStepCommandQuery > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: GetRunStepCommandInput) { - const { thread_id, run_id, step_id, include } = input; - super(`/threads/${thread_id}/runs/${run_id}/steps/${step_id}`, undefined, { - include, - }); - } + constructor(input: GetRunStepCommandInput) { + const { thread_id, run_id, step_id, include } = input; + super( + `/threads/${thread_id}/runs/${run_id}/steps/${step_id}`, + undefined, + stripUndefined({ include }), + ); + } } /** @@ -1211,17 +1165,20 @@ export class GetRunStepCommand extends Command< * @summary Returns a list of vector stores. */ export class ListVectorStoresCommand extends Command< - ListVectorStoresCommandInput, - ListVectorStoresResponse, - never, - ListVectorStoresCommandQuery + ListVectorStoresCommandInput, + ListVectorStoresResponse, + ListVectorStoresCommandQuery > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: ListVectorStoresCommandInput) { - const { limit, order, after, before } = input; - super(`/vector_stores`, undefined, { limit, order, after, before }); - } + constructor(input: ListVectorStoresCommandInput) { + const { limit, order, after, before } = input; + super( + "/vector_stores", + undefined, + stripUndefined({ limit, order, after, before }), + ); + } } /** @@ -1230,16 +1187,15 @@ export class ListVectorStoresCommand extends Command< * @summary Create a vector store. */ export class CreateVectorStoreCommand extends Command< - CreateVectorStoreCommandInput, - VectorStoreObject, - CreateVectorStoreCommandBody + CreateVectorStoreCommandInput, + VectorStoreObject > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: CreateVectorStoreCommandInput) { - const body = input; - super(`/vector_stores`, body); - } + constructor(input: CreateVectorStoreCommandInput) { + const body = input; + super("/vector_stores", jsonStringify(body)); + } } /** @@ -1248,16 +1204,15 @@ export class CreateVectorStoreCommand extends Command< * @summary Retrieves a vector store. */ export class GetVectorStoreCommand extends Command< - GetVectorStoreCommandInput, - VectorStoreObject, - never + GetVectorStoreCommandInput, + VectorStoreObject > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: GetVectorStoreCommandInput) { - const { vector_store_id } = input; - super(`/vector_stores/${vector_store_id}`); - } + constructor(input: GetVectorStoreCommandInput) { + const { vector_store_id } = input; + super(`/vector_stores/${vector_store_id}`); + } } /** @@ -1266,16 +1221,15 @@ export class GetVectorStoreCommand extends Command< * @summary Modifies a vector store. */ export class ModifyVectorStoreCommand extends Command< - ModifyVectorStoreCommandInput, - VectorStoreObject, - ModifyVectorStoreCommandBody + ModifyVectorStoreCommandInput, + VectorStoreObject > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: ModifyVectorStoreCommandInput) { - const { vector_store_id, ...body } = input; - super(`/vector_stores/${vector_store_id}`, body); - } + constructor(input: ModifyVectorStoreCommandInput) { + const { vector_store_id, ...body } = input; + super(`/vector_stores/${vector_store_id}`, jsonStringify(body)); + } } /** @@ -1284,16 +1238,15 @@ export class ModifyVectorStoreCommand extends Command< * @summary Delete a vector store. */ export class DeleteVectorStoreCommand extends Command< - DeleteVectorStoreCommandInput, - DeleteVectorStoreResponse, - never + DeleteVectorStoreCommandInput, + DeleteVectorStoreResponse > { - public override method = 'delete' as const; + public override method = "delete" as const; - constructor(input: DeleteVectorStoreCommandInput) { - const { vector_store_id } = input; - super(`/vector_stores/${vector_store_id}`); - } + constructor(input: DeleteVectorStoreCommandInput) { + const { vector_store_id } = input; + super(`/vector_stores/${vector_store_id}`); + } } /** @@ -1302,23 +1255,20 @@ export class DeleteVectorStoreCommand extends Command< * @summary Returns a list of vector store files. */ export class ListVectorStoreFilesCommand extends Command< - ListVectorStoreFilesCommandInput, - ListVectorStoreFilesResponse, - never, - ListVectorStoreFilesCommandQuery + ListVectorStoreFilesCommandInput, + ListVectorStoreFilesResponse, + ListVectorStoreFilesCommandQuery > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: ListVectorStoreFilesCommandInput) { - const { vector_store_id, limit, order, after, before, filter } = input; - super(`/vector_stores/${vector_store_id}/files`, undefined, { - limit, - order, - after, - before, - filter, - }); - } + constructor(input: ListVectorStoreFilesCommandInput) { + const { vector_store_id, limit, order, after, before, filter } = input; + super( + `/vector_stores/${vector_store_id}/files`, + undefined, + stripUndefined({ limit, order, after, before, filter }), + ); + } } /** @@ -1328,16 +1278,15 @@ export class ListVectorStoreFilesCommand extends Command< * to a [vector store](/docs/api-reference/vector-stores/object). */ export class CreateVectorStoreFileCommand extends Command< - CreateVectorStoreFileCommandInput, - VectorStoreFileObject, - CreateVectorStoreFileCommandBody + CreateVectorStoreFileCommandInput, + VectorStoreFileObject > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: CreateVectorStoreFileCommandInput) { - const { vector_store_id, ...body } = input; - super(`/vector_stores/${vector_store_id}/files`, body); - } + constructor(input: CreateVectorStoreFileCommandInput) { + const { vector_store_id, ...body } = input; + super(`/vector_stores/${vector_store_id}/files`, jsonStringify(body)); + } } /** @@ -1346,16 +1295,15 @@ export class CreateVectorStoreFileCommand extends Command< * @summary Retrieves a vector store file. */ export class GetVectorStoreFileCommand extends Command< - GetVectorStoreFileCommandInput, - VectorStoreFileObject, - never + GetVectorStoreFileCommandInput, + VectorStoreFileObject > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: GetVectorStoreFileCommandInput) { - const { vector_store_id, file_id } = input; - super(`/vector_stores/${vector_store_id}/files/${file_id}`); - } + constructor(input: GetVectorStoreFileCommandInput) { + const { vector_store_id, file_id } = input; + super(`/vector_stores/${vector_store_id}/files/${file_id}`); + } } /** @@ -1366,16 +1314,15 @@ export class GetVectorStoreFileCommand extends Command< * [delete file](/docs/api-reference/files/delete) endpoint. */ export class DeleteVectorStoreFileCommand extends Command< - DeleteVectorStoreFileCommandInput, - DeleteVectorStoreFileResponse, - never + DeleteVectorStoreFileCommandInput, + DeleteVectorStoreFileResponse > { - public override method = 'delete' as const; + public override method = "delete" as const; - constructor(input: DeleteVectorStoreFileCommandInput) { - const { vector_store_id, file_id } = input; - super(`/vector_stores/${vector_store_id}/files/${file_id}`); - } + constructor(input: DeleteVectorStoreFileCommandInput) { + const { vector_store_id, file_id } = input; + super(`/vector_stores/${vector_store_id}/files/${file_id}`); + } } /** @@ -1384,16 +1331,18 @@ export class DeleteVectorStoreFileCommand extends Command< * @summary Create a vector store file batch. */ export class CreateVectorStoreFileBatchCommand extends Command< - CreateVectorStoreFileBatchCommandInput, - VectorStoreFileBatchObject, - CreateVectorStoreFileBatchCommandBody + CreateVectorStoreFileBatchCommandInput, + VectorStoreFileBatchObject > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: CreateVectorStoreFileBatchCommandInput) { - const { vector_store_id, ...body } = input; - super(`/vector_stores/${vector_store_id}/file_batches`, body); - } + constructor(input: CreateVectorStoreFileBatchCommandInput) { + const { vector_store_id, ...body } = input; + super( + `/vector_stores/${vector_store_id}/file_batches`, + jsonStringify(body), + ); + } } /** @@ -1402,16 +1351,15 @@ export class CreateVectorStoreFileBatchCommand extends Command< * @summary Retrieves a vector store file batch. */ export class GetVectorStoreFileBatchCommand extends Command< - GetVectorStoreFileBatchCommandInput, - VectorStoreFileBatchObject, - never + GetVectorStoreFileBatchCommandInput, + VectorStoreFileBatchObject > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: GetVectorStoreFileBatchCommandInput) { - const { vector_store_id, batch_id } = input; - super(`/vector_stores/${vector_store_id}/file_batches/${batch_id}`); - } + constructor(input: GetVectorStoreFileBatchCommandInput) { + const { vector_store_id, batch_id } = input; + super(`/vector_stores/${vector_store_id}/file_batches/${batch_id}`); + } } /** @@ -1421,16 +1369,15 @@ export class GetVectorStoreFileBatchCommand extends Command< * files in this batch as soon as possible. */ export class CancelVectorStoreFileBatchCommand extends Command< - CancelVectorStoreFileBatchCommandInput, - VectorStoreFileBatchObject, - never + CancelVectorStoreFileBatchCommandInput, + VectorStoreFileBatchObject > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: CancelVectorStoreFileBatchCommandInput) { - const { vector_store_id, batch_id } = input; - super(`/vector_stores/${vector_store_id}/file_batches/${batch_id}/cancel`); - } + constructor(input: CancelVectorStoreFileBatchCommandInput) { + const { vector_store_id, batch_id } = input; + super(`/vector_stores/${vector_store_id}/file_batches/${batch_id}/cancel`); + } } /** @@ -1439,22 +1386,21 @@ export class CancelVectorStoreFileBatchCommand extends Command< * @summary Returns a list of vector store files in a batch. */ export class ListFilesInVectorStoreBatchCommand extends Command< - ListFilesInVectorStoreBatchCommandInput, - ListVectorStoreFilesResponse, - never, - ListFilesInVectorStoreBatchCommandQuery + ListFilesInVectorStoreBatchCommandInput, + ListVectorStoreFilesResponse, + ListFilesInVectorStoreBatchCommandQuery > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: ListFilesInVectorStoreBatchCommandInput) { - const { vector_store_id, batch_id, limit, order, after, before, filter } = - input; - super( - `/vector_stores/${vector_store_id}/file_batches/${batch_id}/files`, - undefined, - { limit, order, after, before, filter }, - ); - } + constructor(input: ListFilesInVectorStoreBatchCommandInput) { + const { vector_store_id, batch_id, limit, order, after, before, filter } = + input; + super( + `/vector_stores/${vector_store_id}/file_batches/${batch_id}/files`, + undefined, + stripUndefined({ limit, order, after, before, filter }), + ); + } } /** @@ -1463,11 +1409,15 @@ export class ListFilesInVectorStoreBatchCommand extends Command< * @summary Creates and executes a batch from an uploaded file of requests */ export class CreateBatchCommand extends Command< - CreateBatchCommandInput, - Batch, - never + CreateBatchCommandInput, + Batch > { - public override method = 'post' as const; + public override method = "post" as const; + + constructor(input: CreateBatchCommandInput) { + const body = input; + super("/batches", jsonStringify(body)); + } } /** @@ -1476,17 +1426,16 @@ export class CreateBatchCommand extends Command< * @summary List your organization's batches. */ export class ListBatchesCommand extends Command< - ListBatchesCommandInput, - ListBatchesResponse, - never, - ListBatchesCommandQuery + ListBatchesCommandInput, + ListBatchesResponse, + ListBatchesCommandQuery > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: ListBatchesCommandInput) { - const { after, limit } = input; - super(`/batches`, undefined, { after, limit }); - } + constructor(input: ListBatchesCommandInput) { + const { after, limit } = input; + super("/batches", undefined, stripUndefined({ after, limit })); + } } /** @@ -1495,16 +1444,15 @@ export class ListBatchesCommand extends Command< * @summary Retrieves a batch. */ export class RetrieveBatchCommand extends Command< - RetrieveBatchCommandInput, - Batch, - never + RetrieveBatchCommandInput, + Batch > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: RetrieveBatchCommandInput) { - const { batch_id } = input; - super(`/batches/${batch_id}`); - } + constructor(input: RetrieveBatchCommandInput) { + const { batch_id } = input; + super(`/batches/${batch_id}`); + } } /** @@ -1515,16 +1463,15 @@ export class RetrieveBatchCommand extends Command< * partial results (if any) available in the output file. */ export class CancelBatchCommand extends Command< - CancelBatchCommandInput, - Batch, - never + CancelBatchCommandInput, + Batch > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: CancelBatchCommandInput) { - const { batch_id } = input; - super(`/batches/${batch_id}/cancel`); - } + constructor(input: CancelBatchCommandInput) { + const { batch_id } = input; + super(`/batches/${batch_id}/cancel`); + } } /** @@ -1533,37 +1480,40 @@ export class CancelBatchCommand extends Command< * @summary List user actions and configuration changes within this organization. */ export class ListAuditLogsCommand extends Command< - ListAuditLogsCommandInput, - ListAuditLogsResponse, - never, - ListAuditLogsCommandQuery -> { - public override method = 'get' as const; - - constructor(input: ListAuditLogsCommandInput) { - const { - effective_at, - project_ids, - event_types, - actor_ids, - actor_emails, - resource_ids, - limit, - after, - before, - } = input; - super(`/organization/audit_logs`, undefined, { - effective_at, - project_ids, - event_types, - actor_ids, - actor_emails, - resource_ids, - limit, - after, - before, - }); - } + ListAuditLogsCommandInput, + ListAuditLogsResponse, + ListAuditLogsCommandQuery +> { + public override method = "get" as const; + + constructor(input: ListAuditLogsCommandInput) { + const { + effective_at, + project_ids, + event_types, + actor_ids, + actor_emails, + resource_ids, + limit, + after, + before, + } = input; + super( + "/organization/audit_logs", + undefined, + stripUndefined({ + effective_at, + project_ids, + event_types, + actor_ids, + actor_emails, + resource_ids, + limit, + after, + before, + }), + ); + } } /** @@ -1572,17 +1522,16 @@ export class ListAuditLogsCommand extends Command< * @summary Returns a list of invites in the organization. */ export class ListInvitesCommand extends Command< - ListInvitesCommandInput, - InviteListResponse, - never, - ListInvitesCommandQuery + ListInvitesCommandInput, + InviteListResponse, + ListInvitesCommandQuery > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: ListInvitesCommandInput) { - const { limit, after } = input; - super(`/organization/invites`, undefined, { limit, after }); - } + constructor(input: ListInvitesCommandInput) { + const { limit, after } = input; + super("/organization/invites", undefined, stripUndefined({ limit, after })); + } } /** @@ -1591,17 +1540,13 @@ export class ListInvitesCommand extends Command< * @summary Create an invite for a user to the organization. The invite must be * accepted by the user before they have access to the organization. */ -export class InviteUserCommand extends Command< - InviteUserCommandInput, - Invite, - InviteUserCommandBody -> { - public override method = 'post' as const; +export class InviteUserCommand extends Command { + public override method = "post" as const; - constructor(input: InviteUserCommandInput) { - const body = input; - super(`/organization/invites`, body); - } + constructor(input: InviteUserCommandInput) { + const body = input; + super("/organization/invites", jsonStringify(body)); + } } /** @@ -1610,16 +1555,15 @@ export class InviteUserCommand extends Command< * @summary Retrieves an invite. */ export class RetrieveInviteCommand extends Command< - RetrieveInviteCommandInput, - Invite, - never + RetrieveInviteCommandInput, + Invite > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: RetrieveInviteCommandInput) { - const { invite_id } = input; - super(`/organization/invites/${invite_id}`); - } + constructor(input: RetrieveInviteCommandInput) { + const { invite_id } = input; + super(`/organization/invites/${invite_id}`); + } } /** @@ -1629,16 +1573,15 @@ export class RetrieveInviteCommand extends Command< * deleted. */ export class DeleteInviteCommand extends Command< - DeleteInviteCommandInput, - InviteDeleteResponse, - never + DeleteInviteCommandInput, + InviteDeleteResponse > { - public override method = 'delete' as const; + public override method = "delete" as const; - constructor(input: DeleteInviteCommandInput) { - const { invite_id } = input; - super(`/organization/invites/${invite_id}`); - } + constructor(input: DeleteInviteCommandInput) { + const { invite_id } = input; + super(`/organization/invites/${invite_id}`); + } } /** @@ -1647,17 +1590,16 @@ export class DeleteInviteCommand extends Command< * @summary Lists all of the users in the organization. */ export class ListUsersCommand extends Command< - ListUsersCommandInput, - UserListResponse, - never, - ListUsersCommandQuery + ListUsersCommandInput, + UserListResponse, + ListUsersCommandQuery > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: ListUsersCommandInput) { - const { limit, after } = input; - super(`/organization/users`, undefined, { limit, after }); - } + constructor(input: ListUsersCommandInput) { + const { limit, after } = input; + super("/organization/users", undefined, stripUndefined({ limit, after })); + } } /** @@ -1666,16 +1608,15 @@ export class ListUsersCommand extends Command< * @summary Retrieves a user by their identifier. */ export class RetrieveUserCommand extends Command< - RetrieveUserCommandInput, - User, - never + RetrieveUserCommandInput, + User > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: RetrieveUserCommandInput) { - const { user_id } = input; - super(`/organization/users/${user_id}`); - } + constructor(input: RetrieveUserCommandInput) { + const { user_id } = input; + super(`/organization/users/${user_id}`); + } } /** @@ -1683,17 +1624,13 @@ export class RetrieveUserCommand extends Command< * * @summary Modifies a user's role in the organization. */ -export class ModifyUserCommand extends Command< - ModifyUserCommandInput, - User, - ModifyUserCommandBody -> { - public override method = 'post' as const; +export class ModifyUserCommand extends Command { + public override method = "post" as const; - constructor(input: ModifyUserCommandInput) { - const body = input; - super(`/organization/users/${user_id}`, body); - } + constructor(input: ModifyUserCommandInput) { + const { user_id, ...body } = input; + super(`/organization/users/${user_id}`, jsonStringify(body)); + } } /** @@ -1702,16 +1639,15 @@ export class ModifyUserCommand extends Command< * @summary Deletes a user from the organization. */ export class DeleteUserCommand extends Command< - DeleteUserCommandInput, - UserDeleteResponse, - never + DeleteUserCommandInput, + UserDeleteResponse > { - public override method = 'delete' as const; + public override method = "delete" as const; - constructor(input: DeleteUserCommandInput) { - const { user_id } = input; - super(`/organization/users/${user_id}`); - } + constructor(input: DeleteUserCommandInput) { + const { user_id } = input; + super(`/organization/users/${user_id}`); + } } /** @@ -1720,21 +1656,20 @@ export class DeleteUserCommand extends Command< * @summary Returns a list of projects. */ export class ListProjectsCommand extends Command< - ListProjectsCommandInput, - ProjectListResponse, - never, - ListProjectsCommandQuery + ListProjectsCommandInput, + ProjectListResponse, + ListProjectsCommandQuery > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: ListProjectsCommandInput) { - const { limit, after, include_archived } = input; - super(`/organization/projects`, undefined, { - limit, - after, - include_archived, - }); - } + constructor(input: ListProjectsCommandInput) { + const { limit, after, include_archived } = input; + super( + "/organization/projects", + undefined, + stripUndefined({ limit, after, include_archived }), + ); + } } /** @@ -1744,16 +1679,15 @@ export class ListProjectsCommand extends Command< * archived, but cannot be deleted. */ export class CreateProjectCommand extends Command< - CreateProjectCommandInput, - Project, - CreateProjectCommandBody + CreateProjectCommandInput, + Project > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: CreateProjectCommandInput) { - const body = input; - super(`/organization/projects`, body); - } + constructor(input: CreateProjectCommandInput) { + const body = input; + super("/organization/projects", jsonStringify(body)); + } } /** @@ -1762,16 +1696,15 @@ export class CreateProjectCommand extends Command< * @summary Retrieves a project. */ export class RetrieveProjectCommand extends Command< - RetrieveProjectCommandInput, - Project, - never + RetrieveProjectCommandInput, + Project > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: RetrieveProjectCommandInput) { - const { project_id } = input; - super(`/organization/projects/${project_id}`); - } + constructor(input: RetrieveProjectCommandInput) { + const { project_id } = input; + super(`/organization/projects/${project_id}`); + } } /** @@ -1780,16 +1713,15 @@ export class RetrieveProjectCommand extends Command< * @summary Modifies a project in the organization. */ export class ModifyProjectCommand extends Command< - ModifyProjectCommandInput, - Project, - ModifyProjectCommandBody + ModifyProjectCommandInput, + Project > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: ModifyProjectCommandInput) { - const body = input; - super(`/organization/projects/${project_id}`, body); - } + constructor(input: ModifyProjectCommandInput) { + const { project_id, ...body } = input; + super(`/organization/projects/${project_id}`, jsonStringify(body)); + } } /** @@ -1799,16 +1731,15 @@ export class ModifyProjectCommand extends Command< * updated. */ export class ArchiveProjectCommand extends Command< - ArchiveProjectCommandInput, - Project, - never + ArchiveProjectCommandInput, + Project > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: ArchiveProjectCommandInput) { - const { project_id } = input; - super(`/organization/projects/${project_id}/archive`); - } + constructor(input: ArchiveProjectCommandInput) { + const { project_id } = input; + super(`/organization/projects/${project_id}/archive`); + } } /** @@ -1817,20 +1748,20 @@ export class ArchiveProjectCommand extends Command< * @summary Returns a list of users in the project. */ export class ListProjectUsersCommand extends Command< - ListProjectUsersCommandInput, - ProjectUserListResponse, - never, - ListProjectUsersCommandQuery + ListProjectUsersCommandInput, + ProjectUserListResponse, + ListProjectUsersCommandQuery > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: ListProjectUsersCommandInput) { - const { project_id, limit, after } = input; - super(`/organization/projects/${project_id}/users`, undefined, { - limit, - after, - }); - } + constructor(input: ListProjectUsersCommandInput) { + const { project_id, limit, after } = input; + super( + `/organization/projects/${project_id}/users`, + undefined, + stripUndefined({ limit, after }), + ); + } } /** @@ -1840,16 +1771,15 @@ export class ListProjectUsersCommand extends Command< * organization to be added to a project. */ export class CreateProjectUserCommand extends Command< - CreateProjectUserCommandInput, - ProjectUser, - CreateProjectUserCommandBody + CreateProjectUserCommandInput, + ProjectUser > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: CreateProjectUserCommandInput) { - const { project_id, ...body } = input; - super(`/organization/projects/${project_id}/users`, body); - } + constructor(input: CreateProjectUserCommandInput) { + const { project_id, ...body } = input; + super(`/organization/projects/${project_id}/users`, jsonStringify(body)); + } } /** @@ -1858,16 +1788,15 @@ export class CreateProjectUserCommand extends Command< * @summary Retrieves a user in the project. */ export class RetrieveProjectUserCommand extends Command< - RetrieveProjectUserCommandInput, - ProjectUser, - never + RetrieveProjectUserCommandInput, + ProjectUser > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: RetrieveProjectUserCommandInput) { - const { project_id, user_id } = input; - super(`/organization/projects/${project_id}/users/${user_id}`); - } + constructor(input: RetrieveProjectUserCommandInput) { + const { project_id, user_id } = input; + super(`/organization/projects/${project_id}/users/${user_id}`); + } } /** @@ -1876,16 +1805,18 @@ export class RetrieveProjectUserCommand extends Command< * @summary Modifies a user's role in the project. */ export class ModifyProjectUserCommand extends Command< - ModifyProjectUserCommandInput, - ProjectUser, - ModifyProjectUserCommandBody + ModifyProjectUserCommandInput, + ProjectUser > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: ModifyProjectUserCommandInput) { - const body = input; - super(`/organization/projects/${project_id}/users/${user_id}`, body); - } + constructor(input: ModifyProjectUserCommandInput) { + const { project_id, user_id, ...body } = input; + super( + `/organization/projects/${project_id}/users/${user_id}`, + jsonStringify(body), + ); + } } /** @@ -1894,16 +1825,15 @@ export class ModifyProjectUserCommand extends Command< * @summary Deletes a user from the project. */ export class DeleteProjectUserCommand extends Command< - DeleteProjectUserCommandInput, - ProjectUserDeleteResponse, - never + DeleteProjectUserCommandInput, + ProjectUserDeleteResponse > { - public override method = 'delete' as const; + public override method = "delete" as const; - constructor(input: DeleteProjectUserCommandInput) { - const { project_id, user_id } = input; - super(`/organization/projects/${project_id}/users/${user_id}`); - } + constructor(input: DeleteProjectUserCommandInput) { + const { project_id, user_id } = input; + super(`/organization/projects/${project_id}/users/${user_id}`); + } } /** @@ -1912,20 +1842,20 @@ export class DeleteProjectUserCommand extends Command< * @summary Returns a list of service accounts in the project. */ export class ListProjectServiceAccountsCommand extends Command< - ListProjectServiceAccountsCommandInput, - ProjectServiceAccountListResponse, - never, - ListProjectServiceAccountsCommandQuery + ListProjectServiceAccountsCommandInput, + ProjectServiceAccountListResponse, + ListProjectServiceAccountsCommandQuery > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: ListProjectServiceAccountsCommandInput) { - const { project_id, limit, after } = input; - super(`/organization/projects/${project_id}/service_accounts`, undefined, { - limit, - after, - }); - } + constructor(input: ListProjectServiceAccountsCommandInput) { + const { project_id, limit, after } = input; + super( + `/organization/projects/${project_id}/service_accounts`, + undefined, + stripUndefined({ limit, after }), + ); + } } /** @@ -1935,16 +1865,18 @@ export class ListProjectServiceAccountsCommand extends Command< * unredacted API key for the service account. */ export class CreateProjectServiceAccountCommand extends Command< - CreateProjectServiceAccountCommandInput, - ProjectServiceAccountCreateResponse, - CreateProjectServiceAccountCommandBody + CreateProjectServiceAccountCommandInput, + ProjectServiceAccountCreateResponse > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: CreateProjectServiceAccountCommandInput) { - const { project_id, ...body } = input; - super(`/organization/projects/${project_id}/service_accounts`, body); - } + constructor(input: CreateProjectServiceAccountCommandInput) { + const { project_id, ...body } = input; + super( + `/organization/projects/${project_id}/service_accounts`, + jsonStringify(body), + ); + } } /** @@ -1953,18 +1885,17 @@ export class CreateProjectServiceAccountCommand extends Command< * @summary Retrieves a service account in the project. */ export class RetrieveProjectServiceAccountCommand extends Command< - RetrieveProjectServiceAccountCommandInput, - ProjectServiceAccount, - never + RetrieveProjectServiceAccountCommandInput, + ProjectServiceAccount > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: RetrieveProjectServiceAccountCommandInput) { - const { project_id, service_account_id } = input; - super( - `/organization/projects/${project_id}/service_accounts/${service_account_id}`, - ); - } + constructor(input: RetrieveProjectServiceAccountCommandInput) { + const { project_id, service_account_id } = input; + super( + `/organization/projects/${project_id}/service_accounts/${service_account_id}`, + ); + } } /** @@ -1973,18 +1904,17 @@ export class RetrieveProjectServiceAccountCommand extends Command< * @summary Deletes a service account from the project. */ export class DeleteProjectServiceAccountCommand extends Command< - DeleteProjectServiceAccountCommandInput, - ProjectServiceAccountDeleteResponse, - never + DeleteProjectServiceAccountCommandInput, + ProjectServiceAccountDeleteResponse > { - public override method = 'delete' as const; + public override method = "delete" as const; - constructor(input: DeleteProjectServiceAccountCommandInput) { - const { project_id, service_account_id } = input; - super( - `/organization/projects/${project_id}/service_accounts/${service_account_id}`, - ); - } + constructor(input: DeleteProjectServiceAccountCommandInput) { + const { project_id, service_account_id } = input; + super( + `/organization/projects/${project_id}/service_accounts/${service_account_id}`, + ); + } } /** @@ -1993,20 +1923,20 @@ export class DeleteProjectServiceAccountCommand extends Command< * @summary Returns a list of API keys in the project. */ export class ListProjectApiKeysCommand extends Command< - ListProjectApiKeysCommandInput, - ProjectApiKeyListResponse, - never, - ListProjectApiKeysCommandQuery + ListProjectApiKeysCommandInput, + ProjectApiKeyListResponse, + ListProjectApiKeysCommandQuery > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: ListProjectApiKeysCommandInput) { - const { project_id, limit, after } = input; - super(`/organization/projects/${project_id}/api_keys`, undefined, { - limit, - after, - }); - } + constructor(input: ListProjectApiKeysCommandInput) { + const { project_id, limit, after } = input; + super( + `/organization/projects/${project_id}/api_keys`, + undefined, + stripUndefined({ limit, after }), + ); + } } /** @@ -2015,16 +1945,15 @@ export class ListProjectApiKeysCommand extends Command< * @summary Retrieves an API key in the project. */ export class RetrieveProjectApiKeyCommand extends Command< - RetrieveProjectApiKeyCommandInput, - ProjectApiKey, - never + RetrieveProjectApiKeyCommandInput, + ProjectApiKey > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: RetrieveProjectApiKeyCommandInput) { - const { project_id, key_id } = input; - super(`/organization/projects/${project_id}/api_keys/${key_id}`); - } + constructor(input: RetrieveProjectApiKeyCommandInput) { + const { project_id, key_id } = input; + super(`/organization/projects/${project_id}/api_keys/${key_id}`); + } } /** @@ -2033,14 +1962,13 @@ export class RetrieveProjectApiKeyCommand extends Command< * @summary Deletes an API key from the project. */ export class DeleteProjectApiKeyCommand extends Command< - DeleteProjectApiKeyCommandInput, - ProjectApiKeyDeleteResponse, - never + DeleteProjectApiKeyCommandInput, + ProjectApiKeyDeleteResponse > { - public override method = 'delete' as const; + public override method = "delete" as const; - constructor(input: DeleteProjectApiKeyCommandInput) { - const { project_id, key_id } = input; - super(`/organization/projects/${project_id}/api_keys/${key_id}`); - } + constructor(input: DeleteProjectApiKeyCommandInput) { + const { project_id, key_id } = input; + super(`/organization/projects/${project_id}/api_keys/${key_id}`); + } } diff --git a/__tests__/fixtures/openai/hono-valibot.ts b/__tests__/fixtures/openai/hono-valibot.ts new file mode 100644 index 0000000..9876188 --- /dev/null +++ b/__tests__/fixtures/openai/hono-valibot.ts @@ -0,0 +1,900 @@ +/** + * This file was auto generated by @block65/openapi-codegen + * + * WARN: Do not edit directly. + * + * Generated on 2026-03-06T07:45:26.343Z + * + */ + +import { PublicValibotHonoError } from "@block65/rest-client"; +import { validator } from "hono/validator"; +import * as v from "valibot"; +import { + addUploadPartCommandParamsSchema, + archiveProjectCommandParamsSchema, + cancelBatchCommandParamsSchema, + cancelFineTuningJobCommandParamsSchema, + cancelRunCommandParamsSchema, + cancelUploadCommandParamsSchema, + cancelVectorStoreFileBatchCommandParamsSchema, + completeUploadCommandBodySchema, + completeUploadCommandParamsSchema, + createAssistantCommandBodySchema, + createBatchCommandBodySchema, + createChatCompletionCommandBodySchema, + createCompletionCommandBodySchema, + createEmbeddingCommandBodySchema, + createFineTuningJobCommandBodySchema, + createImageCommandBodySchema, + createMessageCommandBodySchema, + createMessageCommandParamsSchema, + createModerationCommandBodySchema, + createProjectCommandBodySchema, + createProjectServiceAccountCommandBodySchema, + createProjectServiceAccountCommandParamsSchema, + createProjectUserCommandBodySchema, + createProjectUserCommandParamsSchema, + createRunCommandBodySchema, + createRunCommandParamsSchema, + createRunCommandQuerySchema, + createSpeechCommandBodySchema, + createThreadAndRunCommandBodySchema, + createThreadCommandBodySchema, + createUploadCommandBodySchema, + createVectorStoreCommandBodySchema, + createVectorStoreFileBatchCommandBodySchema, + createVectorStoreFileBatchCommandParamsSchema, + createVectorStoreFileCommandBodySchema, + createVectorStoreFileCommandParamsSchema, + deleteAssistantCommandParamsSchema, + deleteFileCommandParamsSchema, + deleteInviteCommandParamsSchema, + deleteMessageCommandParamsSchema, + deleteModelCommandParamsSchema, + deleteProjectApiKeyCommandParamsSchema, + deleteProjectServiceAccountCommandParamsSchema, + deleteProjectUserCommandParamsSchema, + deleteThreadCommandParamsSchema, + deleteUserCommandParamsSchema, + deleteVectorStoreCommandParamsSchema, + deleteVectorStoreFileCommandParamsSchema, + downloadFileCommandParamsSchema, + getAssistantCommandParamsSchema, + getMessageCommandParamsSchema, + getRunCommandParamsSchema, + getRunStepCommandParamsSchema, + getRunStepCommandQuerySchema, + getThreadCommandParamsSchema, + getVectorStoreCommandParamsSchema, + getVectorStoreFileBatchCommandParamsSchema, + getVectorStoreFileCommandParamsSchema, + inviteUserCommandBodySchema, + listAssistantsCommandQuerySchema, + listAuditLogsCommandQuerySchema, + listBatchesCommandQuerySchema, + listFilesCommandQuerySchema, + listFilesInVectorStoreBatchCommandParamsSchema, + listFilesInVectorStoreBatchCommandQuerySchema, + listFineTuningEventsCommandParamsSchema, + listFineTuningEventsCommandQuerySchema, + listFineTuningJobCheckpointsCommandParamsSchema, + listFineTuningJobCheckpointsCommandQuerySchema, + listInvitesCommandQuerySchema, + listMessagesCommandParamsSchema, + listMessagesCommandQuerySchema, + listPaginatedFineTuningJobsCommandQuerySchema, + listProjectApiKeysCommandParamsSchema, + listProjectApiKeysCommandQuerySchema, + listProjectServiceAccountsCommandParamsSchema, + listProjectServiceAccountsCommandQuerySchema, + listProjectsCommandQuerySchema, + listProjectUsersCommandParamsSchema, + listProjectUsersCommandQuerySchema, + listRunStepsCommandParamsSchema, + listRunStepsCommandQuerySchema, + listRunsCommandParamsSchema, + listRunsCommandQuerySchema, + listUsersCommandQuerySchema, + listVectorStoreFilesCommandParamsSchema, + listVectorStoreFilesCommandQuerySchema, + listVectorStoresCommandQuerySchema, + modifyAssistantCommandBodySchema, + modifyAssistantCommandParamsSchema, + modifyMessageCommandBodySchema, + modifyMessageCommandParamsSchema, + modifyProjectCommandBodySchema, + modifyProjectCommandParamsSchema, + modifyProjectUserCommandBodySchema, + modifyProjectUserCommandParamsSchema, + modifyRunCommandBodySchema, + modifyRunCommandParamsSchema, + modifyThreadCommandBodySchema, + modifyThreadCommandParamsSchema, + modifyUserCommandBodySchema, + modifyUserCommandParamsSchema, + modifyVectorStoreCommandBodySchema, + modifyVectorStoreCommandParamsSchema, + retrieveBatchCommandParamsSchema, + retrieveFileCommandParamsSchema, + retrieveFineTuningJobCommandParamsSchema, + retrieveInviteCommandParamsSchema, + retrieveModelCommandParamsSchema, + retrieveProjectApiKeyCommandParamsSchema, + retrieveProjectCommandParamsSchema, + retrieveProjectServiceAccountCommandParamsSchema, + retrieveProjectUserCommandParamsSchema, + retrieveUserCommandParamsSchema, + submitToolOuputsToRunCommandBodySchema, + submitToolOuputsToRunCommandParamsSchema, +} from "./valibot.js"; + +function toPublicValibotHonoError(err: unknown): never { + if (err instanceof v.ValiError) { + throw PublicValibotHonoError.from(err); + } + throw err; +} + +export const createChatCompletion = [ + validator("json", (value) => { + return v + .parseAsync(createChatCompletionCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const createCompletion = [ + validator("json", (value) => { + return v + .parseAsync(createCompletionCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const createImage = [ + validator("json", (value) => { + return v + .parseAsync(createImageCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const createImageEdit = [] as const; +export const createImageVariation = [] as const; +export const createEmbedding = [ + validator("json", (value) => { + return v + .parseAsync(createEmbeddingCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const createSpeech = [ + validator("json", (value) => { + return v + .parseAsync(createSpeechCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const createTranscription = [] as const; +export const createTranslation = [] as const; +export const listFiles = [ + validator("query", (value) => { + return v + .parseAsync(listFilesCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const createFile = [] as const; +export const deleteFile = [ + validator("param", (value) => { + return v + .parseAsync(deleteFileCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const retrieveFile = [ + validator("param", (value) => { + return v + .parseAsync(retrieveFileCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const downloadFile = [ + validator("param", (value) => { + return v + .parseAsync(downloadFileCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const createUpload = [ + validator("json", (value) => { + return v + .parseAsync(createUploadCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const addUploadPart = [ + validator("param", (value) => { + return v + .parseAsync(addUploadPartCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const completeUpload = [ + validator("json", (value) => { + return v + .parseAsync(completeUploadCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(completeUploadCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const cancelUpload = [ + validator("param", (value) => { + return v + .parseAsync(cancelUploadCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const createFineTuningJob = [ + validator("json", (value) => { + return v + .parseAsync(createFineTuningJobCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const listPaginatedFineTuningJobs = [ + validator("query", (value) => { + return v + .parseAsync(listPaginatedFineTuningJobsCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const retrieveFineTuningJob = [ + validator("param", (value) => { + return v + .parseAsync(retrieveFineTuningJobCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const listFineTuningEvents = [ + validator("param", (value) => { + return v + .parseAsync(listFineTuningEventsCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(listFineTuningEventsCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const cancelFineTuningJob = [ + validator("param", (value) => { + return v + .parseAsync(cancelFineTuningJobCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const listFineTuningJobCheckpoints = [ + validator("param", (value) => { + return v + .parseAsync(listFineTuningJobCheckpointsCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(listFineTuningJobCheckpointsCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const listModels = [] as const; +export const retrieveModel = [ + validator("param", (value) => { + return v + .parseAsync(retrieveModelCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const deleteModel = [ + validator("param", (value) => { + return v + .parseAsync(deleteModelCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const createModeration = [ + validator("json", (value) => { + return v + .parseAsync(createModerationCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const listAssistants = [ + validator("query", (value) => { + return v + .parseAsync(listAssistantsCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const createAssistant = [ + validator("json", (value) => { + return v + .parseAsync(createAssistantCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const getAssistant = [ + validator("param", (value) => { + return v + .parseAsync(getAssistantCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const modifyAssistant = [ + validator("json", (value) => { + return v + .parseAsync(modifyAssistantCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(modifyAssistantCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const deleteAssistant = [ + validator("param", (value) => { + return v + .parseAsync(deleteAssistantCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const createThread = [ + validator("json", (value) => { + return v + .parseAsync(createThreadCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const getThread = [ + validator("param", (value) => { + return v + .parseAsync(getThreadCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const modifyThread = [ + validator("json", (value) => { + return v + .parseAsync(modifyThreadCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(modifyThreadCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const deleteThread = [ + validator("param", (value) => { + return v + .parseAsync(deleteThreadCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const listMessages = [ + validator("param", (value) => { + return v + .parseAsync(listMessagesCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(listMessagesCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const createMessage = [ + validator("json", (value) => { + return v + .parseAsync(createMessageCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(createMessageCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const getMessage = [ + validator("param", (value) => { + return v + .parseAsync(getMessageCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const modifyMessage = [ + validator("json", (value) => { + return v + .parseAsync(modifyMessageCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(modifyMessageCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const deleteMessage = [ + validator("param", (value) => { + return v + .parseAsync(deleteMessageCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const createThreadAndRun = [ + validator("json", (value) => { + return v + .parseAsync(createThreadAndRunCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const listRuns = [ + validator("param", (value) => { + return v + .parseAsync(listRunsCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(listRunsCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const createRun = [ + validator("json", (value) => { + return v + .parseAsync(createRunCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(createRunCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(createRunCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const getRun = [ + validator("param", (value) => { + return v + .parseAsync(getRunCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const modifyRun = [ + validator("json", (value) => { + return v + .parseAsync(modifyRunCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(modifyRunCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const submitToolOuputsToRun = [ + validator("json", (value) => { + return v + .parseAsync(submitToolOuputsToRunCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(submitToolOuputsToRunCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const cancelRun = [ + validator("param", (value) => { + return v + .parseAsync(cancelRunCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const listRunSteps = [ + validator("param", (value) => { + return v + .parseAsync(listRunStepsCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(listRunStepsCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const getRunStep = [ + validator("param", (value) => { + return v + .parseAsync(getRunStepCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(getRunStepCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const listVectorStores = [ + validator("query", (value) => { + return v + .parseAsync(listVectorStoresCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const createVectorStore = [ + validator("json", (value) => { + return v + .parseAsync(createVectorStoreCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const getVectorStore = [ + validator("param", (value) => { + return v + .parseAsync(getVectorStoreCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const modifyVectorStore = [ + validator("json", (value) => { + return v + .parseAsync(modifyVectorStoreCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(modifyVectorStoreCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const deleteVectorStore = [ + validator("param", (value) => { + return v + .parseAsync(deleteVectorStoreCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const listVectorStoreFiles = [ + validator("param", (value) => { + return v + .parseAsync(listVectorStoreFilesCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(listVectorStoreFilesCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const createVectorStoreFile = [ + validator("json", (value) => { + return v + .parseAsync(createVectorStoreFileCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(createVectorStoreFileCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const getVectorStoreFile = [ + validator("param", (value) => { + return v + .parseAsync(getVectorStoreFileCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const deleteVectorStoreFile = [ + validator("param", (value) => { + return v + .parseAsync(deleteVectorStoreFileCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const createVectorStoreFileBatch = [ + validator("json", (value) => { + return v + .parseAsync(createVectorStoreFileBatchCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(createVectorStoreFileBatchCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const getVectorStoreFileBatch = [ + validator("param", (value) => { + return v + .parseAsync(getVectorStoreFileBatchCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const cancelVectorStoreFileBatch = [ + validator("param", (value) => { + return v + .parseAsync(cancelVectorStoreFileBatchCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const listFilesInVectorStoreBatch = [ + validator("param", (value) => { + return v + .parseAsync(listFilesInVectorStoreBatchCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(listFilesInVectorStoreBatchCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const createBatch = [ + validator("json", (value) => { + return v + .parseAsync(createBatchCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const listBatches = [ + validator("query", (value) => { + return v + .parseAsync(listBatchesCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const retrieveBatch = [ + validator("param", (value) => { + return v + .parseAsync(retrieveBatchCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const cancelBatch = [ + validator("param", (value) => { + return v + .parseAsync(cancelBatchCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const listauditlogs = [ + validator("query", (value) => { + return v + .parseAsync(listAuditLogsCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const listinvites = [ + validator("query", (value) => { + return v + .parseAsync(listInvitesCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const inviteUser = [ + validator("json", (value) => { + return v + .parseAsync(inviteUserCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const retrieveinvite = [ + validator("param", (value) => { + return v + .parseAsync(retrieveInviteCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const deleteinvite = [ + validator("param", (value) => { + return v + .parseAsync(deleteInviteCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const listusers = [ + validator("query", (value) => { + return v + .parseAsync(listUsersCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const retrieveuser = [ + validator("param", (value) => { + return v + .parseAsync(retrieveUserCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const modifyuser = [ + validator("json", (value) => { + return v + .parseAsync(modifyUserCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(modifyUserCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const deleteuser = [ + validator("param", (value) => { + return v + .parseAsync(deleteUserCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const listprojects = [ + validator("query", (value) => { + return v + .parseAsync(listProjectsCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const createproject = [ + validator("json", (value) => { + return v + .parseAsync(createProjectCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const retrieveproject = [ + validator("param", (value) => { + return v + .parseAsync(retrieveProjectCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const modifyproject = [ + validator("json", (value) => { + return v + .parseAsync(modifyProjectCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(modifyProjectCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const archiveproject = [ + validator("param", (value) => { + return v + .parseAsync(archiveProjectCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const listprojectusers = [ + validator("param", (value) => { + return v + .parseAsync(listProjectUsersCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(listProjectUsersCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const createprojectuser = [ + validator("json", (value) => { + return v + .parseAsync(createProjectUserCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(createProjectUserCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const retrieveprojectuser = [ + validator("param", (value) => { + return v + .parseAsync(retrieveProjectUserCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const modifyprojectuser = [ + validator("json", (value) => { + return v + .parseAsync(modifyProjectUserCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(modifyProjectUserCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const deleteprojectuser = [ + validator("param", (value) => { + return v + .parseAsync(deleteProjectUserCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const listprojectserviceaccounts = [ + validator("param", (value) => { + return v + .parseAsync(listProjectServiceAccountsCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(listProjectServiceAccountsCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const createprojectserviceaccount = [ + validator("json", (value) => { + return v + .parseAsync(createProjectServiceAccountCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(createProjectServiceAccountCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const retrieveprojectserviceaccount = [ + validator("param", (value) => { + return v + .parseAsync(retrieveProjectServiceAccountCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const deleteprojectserviceaccount = [ + validator("param", (value) => { + return v + .parseAsync(deleteProjectServiceAccountCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const listprojectapikeys = [ + validator("param", (value) => { + return v + .parseAsync(listProjectApiKeysCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), + validator("query", (value) => { + return v + .parseAsync(listProjectApiKeysCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const retrieveprojectapikey = [ + validator("param", (value) => { + return v + .parseAsync(retrieveProjectApiKeyCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const deleteprojectapikey = [ + validator("param", (value) => { + return v + .parseAsync(deleteProjectApiKeyCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; diff --git a/__tests__/fixtures/openai/main.ts b/__tests__/fixtures/openai/main.ts index 96ccd06..dc06a81 100644 --- a/__tests__/fixtures/openai/main.ts +++ b/__tests__/fixtures/openai/main.ts @@ -3,336 +3,342 @@ * * WARN: Do not edit directly. * - * Generated on 2024-10-13T02:06:31.654Z + * Generated on 2026-03-06T07:45:26.343Z * */ import { - RestServiceClient, - type RestServiceClientConfig, -} from '@block65/rest-client'; + RestServiceClient, + type RestServiceClientConfig, +} from "@block65/rest-client"; import type { - AddUploadPartCommandInput, - ArchiveProjectCommandInput, - AssistantObject, - Batch, - BatchRequestInput, - CancelBatchCommandInput, - CancelFineTuningJobCommandInput, - CancelRunCommandInput, - CancelUploadCommandInput, - CancelVectorStoreFileBatchCommandInput, - CompleteUploadCommandInput, - CreateAssistantCommandInput, - CreateBatchCommandInput, - CreateChatCompletionCommandInput, - CreateChatCompletionResponse, - CreateCompletionCommandInput, - CreateCompletionResponse, - CreateEmbeddingCommandInput, - CreateEmbeddingResponse, - CreateFileCommandInput, - CreateFineTuningJobCommandInput, - CreateImageCommandInput, - CreateImageEditCommandInput, - CreateImageVariationCommandInput, - CreateMessageCommandInput, - CreateModerationCommandInput, - CreateModerationResponse, - CreateProjectCommandInput, - CreateProjectServiceAccountCommandInput, - CreateProjectUserCommandInput, - CreateRunCommandInput, - CreateSpeechCommandInput, - CreateThreadAndRunCommandInput, - CreateThreadCommandInput, - CreateTranscriptionCommandInput, - CreateTranslationCommandInput, - CreateUploadCommandInput, - CreateVectorStoreCommandInput, - CreateVectorStoreFileBatchCommandInput, - CreateVectorStoreFileCommandInput, - DeleteAssistantCommandInput, - DeleteAssistantResponse, - DeleteFileCommandInput, - DeleteFileResponse, - DeleteInviteCommandInput, - DeleteMessageCommandInput, - DeleteMessageResponse, - DeleteModelCommandInput, - DeleteModelResponse, - DeleteProjectApiKeyCommandInput, - DeleteProjectServiceAccountCommandInput, - DeleteProjectUserCommandInput, - DeleteThreadCommandInput, - DeleteThreadResponse, - DeleteUserCommandInput, - DeleteVectorStoreCommandInput, - DeleteVectorStoreFileCommandInput, - DeleteVectorStoreFileResponse, - DeleteVectorStoreResponse, - DownloadFileCommandInput, - FinetuneChatRequestInput, - FinetuneCompletionRequestInput, - FineTuningJob, - GetAssistantCommandInput, - GetMessageCommandInput, - GetRunCommandInput, - GetRunStepCommandInput, - GetThreadCommandInput, - GetVectorStoreCommandInput, - GetVectorStoreFileBatchCommandInput, - GetVectorStoreFileCommandInput, - ImagesResponse, - Invite, - InviteDeleteResponse, - InviteListResponse, - InviteUserCommandInput, - ListAssistantsCommandInput, - ListAssistantsResponse, - ListAuditLogsCommandInput, - ListAuditLogsResponse, - ListBatchesCommandInput, - ListBatchesResponse, - ListFilesCommandInput, - ListFilesInVectorStoreBatchCommandInput, - ListFilesResponse, - ListFineTuningEventsCommandInput, - ListFineTuningJobCheckpointsCommandInput, - ListFineTuningJobCheckpointsResponse, - ListFineTuningJobEventsResponse, - ListInvitesCommandInput, - ListMessagesCommandInput, - ListMessagesResponse, - ListModelsCommandInput, - ListModelsResponse, - ListPaginatedFineTuningJobsCommandInput, - ListPaginatedFineTuningJobsResponse, - ListProjectApiKeysCommandInput, - ListProjectsCommandInput, - ListProjectServiceAccountsCommandInput, - ListProjectUsersCommandInput, - ListRunsCommandInput, - ListRunsResponse, - ListRunStepsCommandInput, - ListRunStepsResponse, - ListUsersCommandInput, - ListVectorStoreFilesCommandInput, - ListVectorStoreFilesResponse, - ListVectorStoresCommandInput, - ListVectorStoresResponse, - MessageObject, - Model, - ModifyAssistantCommandInput, - ModifyMessageCommandInput, - ModifyProjectCommandInput, - ModifyProjectUserCommandInput, - ModifyRunCommandInput, - ModifyThreadCommandInput, - ModifyUserCommandInput, - ModifyVectorStoreCommandInput, - OpenAiFile, - Project, - ProjectApiKey, - ProjectApiKeyDeleteResponse, - ProjectApiKeyListResponse, - ProjectListResponse, - ProjectServiceAccount, - ProjectServiceAccountCreateResponse, - ProjectServiceAccountDeleteResponse, - ProjectServiceAccountListResponse, - ProjectUser, - ProjectUserDeleteResponse, - ProjectUserListResponse, - RetrieveBatchCommandInput, - RetrieveFileCommandInput, - RetrieveFineTuningJobCommandInput, - RetrieveInviteCommandInput, - RetrieveModelCommandInput, - RetrieveProjectApiKeyCommandInput, - RetrieveProjectCommandInput, - RetrieveProjectServiceAccountCommandInput, - RetrieveProjectUserCommandInput, - RetrieveUserCommandInput, - RunObject, - RunStepObject, - SubmitToolOuputsToRunCommandInput, - ThreadObject, - Upload, - UploadPart, - User, - UserDeleteResponse, - UserListResponse, - VectorStoreFileBatchObject, - VectorStoreFileObject, - VectorStoreObject, -} from './types.js'; + AddUploadPartCommandInput, + ArchiveProjectCommandInput, + AssistantObject, + Batch, + BatchRequestInput, + CancelBatchCommandInput, + CancelFineTuningJobCommandInput, + CancelRunCommandInput, + CancelUploadCommandInput, + CancelVectorStoreFileBatchCommandInput, + CompleteUploadCommandInput, + CreateAssistantCommandInput, + CreateBatchCommandInput, + CreateChatCompletionCommandInput, + CreateChatCompletionResponse, + CreateCompletionCommandInput, + CreateCompletionResponse, + CreateEmbeddingCommandInput, + CreateEmbeddingResponse, + CreateFileCommandInput, + CreateFineTuningJobCommandInput, + CreateImageCommandInput, + CreateImageEditCommandInput, + CreateImageVariationCommandInput, + CreateMessageCommandInput, + CreateModerationCommandInput, + CreateModerationResponse, + CreateProjectCommandInput, + CreateProjectServiceAccountCommandInput, + CreateProjectUserCommandInput, + CreateRunCommandInput, + CreateSpeechCommandInput, + CreateThreadAndRunCommandInput, + CreateThreadCommandInput, + CreateTranscriptionCommandInput, + CreateTranscriptionCommandOutput, + CreateTranslationCommandInput, + CreateTranslationCommandOutput, + CreateUploadCommandInput, + CreateVectorStoreCommandInput, + CreateVectorStoreFileBatchCommandInput, + CreateVectorStoreFileCommandInput, + DeleteAssistantCommandInput, + DeleteAssistantResponse, + DeleteFileCommandInput, + DeleteFileResponse, + DeleteInviteCommandInput, + DeleteMessageCommandInput, + DeleteMessageResponse, + DeleteModelCommandInput, + DeleteModelResponse, + DeleteProjectApiKeyCommandInput, + DeleteProjectServiceAccountCommandInput, + DeleteProjectUserCommandInput, + DeleteThreadCommandInput, + DeleteThreadResponse, + DeleteUserCommandInput, + DeleteVectorStoreCommandInput, + DeleteVectorStoreFileCommandInput, + DeleteVectorStoreFileResponse, + DeleteVectorStoreResponse, + DownloadFileCommandInput, + DownloadFileCommandOutput, + FineTuningJob, + FinetuneChatRequestInput, + FinetuneCompletionRequestInput, + GetAssistantCommandInput, + GetMessageCommandInput, + GetRunCommandInput, + GetRunStepCommandInput, + GetThreadCommandInput, + GetVectorStoreCommandInput, + GetVectorStoreFileBatchCommandInput, + GetVectorStoreFileCommandInput, + ImagesResponse, + Invite, + InviteDeleteResponse, + InviteListResponse, + InviteUserCommandInput, + ListAssistantsCommandInput, + ListAssistantsResponse, + ListAuditLogsCommandInput, + ListAuditLogsResponse, + ListBatchesCommandInput, + ListBatchesResponse, + ListFilesCommandInput, + ListFilesInVectorStoreBatchCommandInput, + ListFilesResponse, + ListFineTuningEventsCommandInput, + ListFineTuningJobCheckpointsCommandInput, + ListFineTuningJobCheckpointsResponse, + ListFineTuningJobEventsResponse, + ListInvitesCommandInput, + ListMessagesCommandInput, + ListMessagesResponse, + ListModelsCommandInput, + ListModelsResponse, + ListPaginatedFineTuningJobsCommandInput, + ListPaginatedFineTuningJobsResponse, + ListProjectApiKeysCommandInput, + ListProjectServiceAccountsCommandInput, + ListProjectsCommandInput, + ListProjectUsersCommandInput, + ListRunStepsCommandInput, + ListRunStepsResponse, + ListRunsCommandInput, + ListRunsResponse, + ListUsersCommandInput, + ListVectorStoreFilesCommandInput, + ListVectorStoreFilesResponse, + ListVectorStoresCommandInput, + ListVectorStoresResponse, + MessageObject, + Model, + ModifyAssistantCommandInput, + ModifyMessageCommandInput, + ModifyProjectCommandInput, + ModifyProjectUserCommandInput, + ModifyRunCommandInput, + ModifyThreadCommandInput, + ModifyUserCommandInput, + ModifyVectorStoreCommandInput, + OpenAiFile, + Project, + ProjectApiKey, + ProjectApiKeyDeleteResponse, + ProjectApiKeyListResponse, + ProjectListResponse, + ProjectServiceAccount, + ProjectServiceAccountCreateResponse, + ProjectServiceAccountDeleteResponse, + ProjectServiceAccountListResponse, + ProjectUser, + ProjectUserDeleteResponse, + ProjectUserListResponse, + RetrieveBatchCommandInput, + RetrieveFileCommandInput, + RetrieveFineTuningJobCommandInput, + RetrieveInviteCommandInput, + RetrieveModelCommandInput, + RetrieveProjectApiKeyCommandInput, + RetrieveProjectCommandInput, + RetrieveProjectServiceAccountCommandInput, + RetrieveProjectUserCommandInput, + RetrieveUserCommandInput, + RunObject, + RunStepObject, + SubmitToolOuputsToRunCommandInput, + ThreadObject, + Upload, + UploadPart, + User, + UserDeleteResponse, + UserListResponse, + VectorStoreFileBatchObject, + VectorStoreFileObject, + VectorStoreObject, +} from "./types.js"; type AllInputs = - | AddUploadPartCommandInput - | ArchiveProjectCommandInput - | BatchRequestInput - | CancelBatchCommandInput - | CancelFineTuningJobCommandInput - | CancelRunCommandInput - | CancelUploadCommandInput - | CancelVectorStoreFileBatchCommandInput - | CompleteUploadCommandInput - | CreateAssistantCommandInput - | CreateBatchCommandInput - | CreateChatCompletionCommandInput - | CreateCompletionCommandInput - | CreateEmbeddingCommandInput - | CreateFileCommandInput - | CreateFineTuningJobCommandInput - | CreateImageCommandInput - | CreateImageEditCommandInput - | CreateImageVariationCommandInput - | CreateMessageCommandInput - | CreateModerationCommandInput - | CreateProjectCommandInput - | CreateProjectServiceAccountCommandInput - | CreateProjectUserCommandInput - | CreateRunCommandInput - | CreateSpeechCommandInput - | CreateThreadAndRunCommandInput - | CreateThreadCommandInput - | CreateTranscriptionCommandInput - | CreateTranslationCommandInput - | CreateUploadCommandInput - | CreateVectorStoreCommandInput - | CreateVectorStoreFileBatchCommandInput - | CreateVectorStoreFileCommandInput - | DeleteAssistantCommandInput - | DeleteFileCommandInput - | DeleteInviteCommandInput - | DeleteMessageCommandInput - | DeleteModelCommandInput - | DeleteProjectApiKeyCommandInput - | DeleteProjectServiceAccountCommandInput - | DeleteProjectUserCommandInput - | DeleteThreadCommandInput - | DeleteUserCommandInput - | DeleteVectorStoreCommandInput - | DeleteVectorStoreFileCommandInput - | DownloadFileCommandInput - | FinetuneChatRequestInput - | FinetuneCompletionRequestInput - | GetAssistantCommandInput - | GetMessageCommandInput - | GetRunCommandInput - | GetRunStepCommandInput - | GetThreadCommandInput - | GetVectorStoreCommandInput - | GetVectorStoreFileBatchCommandInput - | GetVectorStoreFileCommandInput - | InviteUserCommandInput - | ListAssistantsCommandInput - | ListAuditLogsCommandInput - | ListBatchesCommandInput - | ListFilesCommandInput - | ListFilesInVectorStoreBatchCommandInput - | ListFineTuningEventsCommandInput - | ListFineTuningJobCheckpointsCommandInput - | ListInvitesCommandInput - | ListMessagesCommandInput - | ListModelsCommandInput - | ListPaginatedFineTuningJobsCommandInput - | ListProjectApiKeysCommandInput - | ListProjectsCommandInput - | ListProjectServiceAccountsCommandInput - | ListProjectUsersCommandInput - | ListRunsCommandInput - | ListRunStepsCommandInput - | ListUsersCommandInput - | ListVectorStoreFilesCommandInput - | ListVectorStoresCommandInput - | ModifyAssistantCommandInput - | ModifyMessageCommandInput - | ModifyProjectCommandInput - | ModifyProjectUserCommandInput - | ModifyRunCommandInput - | ModifyThreadCommandInput - | ModifyUserCommandInput - | ModifyVectorStoreCommandInput - | RetrieveBatchCommandInput - | RetrieveFileCommandInput - | RetrieveFineTuningJobCommandInput - | RetrieveInviteCommandInput - | RetrieveModelCommandInput - | RetrieveProjectApiKeyCommandInput - | RetrieveProjectCommandInput - | RetrieveProjectServiceAccountCommandInput - | RetrieveProjectUserCommandInput - | RetrieveUserCommandInput - | SubmitToolOuputsToRunCommandInput; + | AddUploadPartCommandInput + | ArchiveProjectCommandInput + | BatchRequestInput + | CancelBatchCommandInput + | CancelFineTuningJobCommandInput + | CancelRunCommandInput + | CancelUploadCommandInput + | CancelVectorStoreFileBatchCommandInput + | CompleteUploadCommandInput + | CreateAssistantCommandInput + | CreateBatchCommandInput + | CreateChatCompletionCommandInput + | CreateCompletionCommandInput + | CreateEmbeddingCommandInput + | CreateFileCommandInput + | CreateFineTuningJobCommandInput + | CreateImageCommandInput + | CreateImageEditCommandInput + | CreateImageVariationCommandInput + | CreateMessageCommandInput + | CreateModerationCommandInput + | CreateProjectCommandInput + | CreateProjectServiceAccountCommandInput + | CreateProjectUserCommandInput + | CreateRunCommandInput + | CreateSpeechCommandInput + | CreateThreadAndRunCommandInput + | CreateThreadCommandInput + | CreateTranscriptionCommandInput + | CreateTranslationCommandInput + | CreateUploadCommandInput + | CreateVectorStoreCommandInput + | CreateVectorStoreFileBatchCommandInput + | CreateVectorStoreFileCommandInput + | DeleteAssistantCommandInput + | DeleteFileCommandInput + | DeleteInviteCommandInput + | DeleteMessageCommandInput + | DeleteModelCommandInput + | DeleteProjectApiKeyCommandInput + | DeleteProjectServiceAccountCommandInput + | DeleteProjectUserCommandInput + | DeleteThreadCommandInput + | DeleteUserCommandInput + | DeleteVectorStoreCommandInput + | DeleteVectorStoreFileCommandInput + | DownloadFileCommandInput + | FinetuneChatRequestInput + | FinetuneCompletionRequestInput + | GetAssistantCommandInput + | GetMessageCommandInput + | GetRunCommandInput + | GetRunStepCommandInput + | GetThreadCommandInput + | GetVectorStoreCommandInput + | GetVectorStoreFileBatchCommandInput + | GetVectorStoreFileCommandInput + | InviteUserCommandInput + | ListAssistantsCommandInput + | ListAuditLogsCommandInput + | ListBatchesCommandInput + | ListFilesCommandInput + | ListFilesInVectorStoreBatchCommandInput + | ListFineTuningEventsCommandInput + | ListFineTuningJobCheckpointsCommandInput + | ListInvitesCommandInput + | ListMessagesCommandInput + | ListModelsCommandInput + | ListPaginatedFineTuningJobsCommandInput + | ListProjectApiKeysCommandInput + | ListProjectsCommandInput + | ListProjectServiceAccountsCommandInput + | ListProjectUsersCommandInput + | ListRunsCommandInput + | ListRunStepsCommandInput + | ListUsersCommandInput + | ListVectorStoreFilesCommandInput + | ListVectorStoresCommandInput + | ModifyAssistantCommandInput + | ModifyMessageCommandInput + | ModifyProjectCommandInput + | ModifyProjectUserCommandInput + | ModifyRunCommandInput + | ModifyThreadCommandInput + | ModifyUserCommandInput + | ModifyVectorStoreCommandInput + | RetrieveBatchCommandInput + | RetrieveFileCommandInput + | RetrieveFineTuningJobCommandInput + | RetrieveInviteCommandInput + | RetrieveModelCommandInput + | RetrieveProjectApiKeyCommandInput + | RetrieveProjectCommandInput + | RetrieveProjectServiceAccountCommandInput + | RetrieveProjectUserCommandInput + | RetrieveUserCommandInput + | SubmitToolOuputsToRunCommandInput; type AllOutputs = - | AssistantObject - | Batch - | CreateChatCompletionResponse - | CreateCompletionResponse - | CreateEmbeddingResponse - | CreateModerationResponse - | DeleteAssistantResponse - | DeleteFileResponse - | DeleteMessageResponse - | DeleteModelResponse - | DeleteThreadResponse - | DeleteVectorStoreFileResponse - | DeleteVectorStoreResponse - | FineTuningJob - | ImagesResponse - | Invite - | InviteDeleteResponse - | InviteListResponse - | ListAssistantsResponse - | ListAuditLogsResponse - | ListBatchesResponse - | ListFilesResponse - | ListFineTuningJobCheckpointsResponse - | ListFineTuningJobEventsResponse - | ListMessagesResponse - | ListModelsResponse - | ListPaginatedFineTuningJobsResponse - | ListRunsResponse - | ListRunStepsResponse - | ListVectorStoreFilesResponse - | ListVectorStoresResponse - | MessageObject - | Model - | OpenAiFile - | Project - | ProjectApiKey - | ProjectApiKeyDeleteResponse - | ProjectApiKeyListResponse - | ProjectListResponse - | ProjectServiceAccount - | ProjectServiceAccountCreateResponse - | ProjectServiceAccountDeleteResponse - | ProjectServiceAccountListResponse - | ProjectUser - | ProjectUserDeleteResponse - | ProjectUserListResponse - | RunObject - | RunStepObject - | ThreadObject - | unknown - | Upload - | UploadPart - | User - | UserDeleteResponse - | UserListResponse - | VectorStoreFileBatchObject - | VectorStoreFileObject - | VectorStoreObject; + | AssistantObject + | Batch + | CreateChatCompletionResponse + | CreateCompletionResponse + | CreateEmbeddingResponse + | CreateModerationResponse + | CreateTranscriptionCommandOutput + | CreateTranslationCommandOutput + | DeleteAssistantResponse + | DeleteFileResponse + | DeleteMessageResponse + | DeleteModelResponse + | DeleteThreadResponse + | DeleteVectorStoreFileResponse + | DeleteVectorStoreResponse + | DownloadFileCommandOutput + | FineTuningJob + | ImagesResponse + | Invite + | InviteDeleteResponse + | InviteListResponse + | ListAssistantsResponse + | ListAuditLogsResponse + | ListBatchesResponse + | ListFilesResponse + | ListFineTuningJobCheckpointsResponse + | ListFineTuningJobEventsResponse + | ListMessagesResponse + | ListModelsResponse + | ListPaginatedFineTuningJobsResponse + | ListRunsResponse + | ListRunStepsResponse + | ListVectorStoreFilesResponse + | ListVectorStoresResponse + | MessageObject + | Model + | OpenAiFile + | Project + | ProjectApiKey + | ProjectApiKeyDeleteResponse + | ProjectApiKeyListResponse + | ProjectListResponse + | ProjectServiceAccount + | ProjectServiceAccountCreateResponse + | ProjectServiceAccountDeleteResponse + | ProjectServiceAccountListResponse + | ProjectUser + | ProjectUserDeleteResponse + | ProjectUserListResponse + | RunObject + | RunStepObject + | ThreadObject + | unknown + | Upload + | UploadPart + | User + | UserDeleteResponse + | UserListResponse + | VectorStoreFileBatchObject + | VectorStoreFileObject + | VectorStoreObject; export class OpenAiApiRestClient extends RestServiceClient< - AllInputs, - AllOutputs + AllInputs, + AllOutputs > { - constructor( - baseUrl: string | URL = new URL('https://api.openai.com/v1/'), - config?: RestServiceClientConfig, - ) { - super(baseUrl, config); - } + constructor( + baseUrl: string | URL = new URL("https://api.openai.com/v1/"), + config?: RestServiceClientConfig, + ) { + super(baseUrl, config); + } } diff --git a/__tests__/fixtures/openai/types.ts b/__tests__/fixtures/openai/types.ts index aa03560..2ce5e98 100644 --- a/__tests__/fixtures/openai/types.ts +++ b/__tests__/fixtures/openai/types.ts @@ -3,768 +3,760 @@ * * WARN: Do not edit directly. * - * Generated on 2024-10-13T02:06:31.654Z + * Generated on 2026-03-06T07:45:26.343Z * */ -import type { JsonifiableObject } from 'type-fest/source/jsonifiable.js'; +import type { Jsonifiable } from "type-fest"; export type DeleteModelResponse = { - id: string; - deleted: boolean; - object: string; + id: string; + deleted: boolean; + object: string; }; - -export enum ChatCompletionRoleEnum { - System = 'system', - User = 'user', - Assistant = 'assistant', - Tool = 'tool', - Function = 'function', -} - /** The role of the author of a message */ export type ChatCompletionRole = - | ChatCompletionRoleEnum - | 'system' - | 'user' - | 'assistant' - | 'tool' - | 'function'; + | "system" + | "user" + | "assistant" + | "tool" + | "function"; export type ChatCompletionTokenLogprob = { - token: string; - logprob: number; - readonly bytes: number[]; - readonly top_logprobs: { - token: string; - logprob: number; - readonly bytes: number[]; - }[]; + token: string; + logprob: number; + bytes: readonly number[]; + top_logprobs: readonly { + token: string; + logprob: number; + bytes: readonly number[]; + }[]; }; /** * Represents a streamed chunk of a chat completion response returned by * model, based on the provided input. */ export type CreateChatCompletionStreamResponse = { - id: string; - readonly choices: { - /** WARN: $ref used before available - #/components/schemas/ChatCompletionStreamResponseDelta */ - delta: never; - logprobs?: { - readonly content: ChatCompletionTokenLogprob[]; - readonly refusal: ChatCompletionTokenLogprob[]; - }; - /** - * The reason the model stopped generating tokens. This will be `stop` if the - * model hit a natural stop point or a provided stop sequence, - * `length` if the maximum number of tokens specified in the request was - * reached, - * `content_filter` if content was omitted due to a flag from our content - * filters, - * `tool_calls` if the model called a tool, or `function_call` (deprecated) if - * the model called a function. - * @enum stop,length,tool_calls,content_filter,function_call - */ - finish_reason: - | 'stop' - | 'length' - | 'tool_calls' - | 'content_filter' - | 'function_call'; - index: number; - }[]; - created: number; - model: string; - /** - * The service tier used for processing the request. This field is only - * included if the `service_tier` parameter is specified in the request. - * @enum scale,default - * @example scale - */ - service_tier?: 'scale' | 'default'; - system_fingerprint?: string; - /** - * The object type, which is always `chat.completion.chunk`. - * @enum chat.completion.chunk - */ - object: 'chat.completion.chunk'; - usage?: { - completion_tokens: number; - prompt_tokens: number; - total_tokens: number; - }; + id: string; + choices: readonly { + /** WARN: $ref used before available - schema={"$ref":"#/components/schemas/ChatCompletionStreamResponseDelta"} */ + delta: never; + logprobs?: { + content: readonly ChatCompletionTokenLogprob[]; + refusal: readonly ChatCompletionTokenLogprob[]; + }; + /** + * The reason the model stopped generating tokens. This will be `stop` if the + * model hit a natural stop point or a provided stop sequence, + * `length` if the maximum number of tokens specified in the request was + * reached, + * `content_filter` if content was omitted due to a flag from our content + * filters, + * `tool_calls` if the model called a tool, or `function_call` (deprecated) if + * the model called a function. + * @enum stop,length,tool_calls,content_filter,function_call + */ + finish_reason: + | "stop" + | "length" + | "tool_calls" + | "content_filter" + | "function_call"; + index: number; + }[]; + created: number; + model: string; + /** + * The service tier used for processing the request. This field is only + * included if the `service_tier` parameter is specified in the request. + * @enum scale,default + * @example scale + */ + service_tier?: "scale" | "default"; + system_fingerprint?: string; + /** + * The object type, which is always `chat.completion.chunk`. + * @enum chat.completion.chunk + */ + object: "chat.completion.chunk"; + usage?: { + completion_tokens: number; + prompt_tokens: number; + total_tokens: number; + }; }; /** * Represents a streamed chunk of a chat completion response returned by * model, based on the provided input. */ -export type CreateChatCompletionImageResponse = JsonifiableObject; +export type CreateChatCompletionImageResponse = Record< + string | number, + Jsonifiable +>; export type CreateImageRequest = { - /** - * A text description of the desired image(s). The maximum length is 1000 - * characters for `dall-e-2` and 4000 characters for `dall-e-3`. - * @example A cute baby sea otter - */ - prompt: string; - /** - * The model to use for image generation. - * @default dall-e-2 - * @example dall-e-3 - */ - model?: string | 'dall-e-2' | 'dall-e-3' | null; - /** - * The number of images to generate. Must be between 1 and 10. For `dall-e-3`, - * only `n=1` is supported. - * @default 1 - * @example 1 - */ - n?: number | null; - /** - * The quality of the image that will be generated. `hd` creates images with - * finer details and greater consistency across the image. This param is only - * supported for `dall-e-3`. - * @default standard - * @enum standard,hd - * @example standard - */ - quality?: 'standard' | 'hd'; - /** - * The format in which the generated images are returned. Must be one of `url` - * or `b64_json`. URLs are only valid for 60 minutes after the image has been - * generated. - * @default url - * @enum url,b64_json - * @example url - */ - response_format?: 'url' | 'b64_json'; - /** - * The size of the generated images. Must be one of `256x256`, `512x512`, or - * `1024x1024` for `dall-e-2`. Must be one of `1024x1024`, `1792x1024`, or - * `1024x1792` for `dall-e-3` models. - * @default 1024x1024 - * @enum 256x256,512x512,1024x1024,1792x1024,1024x1792 - * @example 1024x1024 - */ - size?: '256x256' | '512x512' | '1024x1024' | '1792x1024' | '1024x1792'; - /** - * The style of the generated images. Must be one of `vivid` or `natural`. - * Vivid causes the model to lean towards generating hyper-real and dramatic - * images. Natural causes the model to produce more natural, less hyper-real - * looking images. This param is only supported for `dall-e-3`. - * @default vivid - * @enum vivid,natural - * @example vivid - */ - style?: 'vivid' | 'natural'; - /** - * A unique identifier representing your end-user, which can help OpenAI to - * monitor and detect abuse. [Learn - * more](/docs/guides/safety-best-practices/end-user-ids). - * @example user-1234 - */ - user?: string; + /** + * A text description of the desired image(s). The maximum length is 1000 + * characters for `dall-e-2` and 4000 characters for `dall-e-3`. + * @example A cute baby sea otter + */ + prompt: string; + /** + * The model to use for image generation. + * @default dall-e-2 + * @example dall-e-3 + */ + model?: string | "dall-e-2" | "dall-e-3" | null; + /** + * The number of images to generate. Must be between 1 and 10. For `dall-e-3`, + * only `n=1` is supported. + * @default 1 + * @example 1 + */ + n?: number | null; + /** + * The quality of the image that will be generated. `hd` creates images with + * finer details and greater consistency across the image. This param is only + * supported for `dall-e-3`. + * @default standard + * @enum standard,hd + * @example standard + */ + quality?: "standard" | "hd"; + /** + * The format in which the generated images are returned. Must be one of `url` + * or `b64_json`. URLs are only valid for 60 minutes after the image has been + * generated. + * @default url + * @enum url,b64_json + * @example url + */ + response_format?: "url" | "b64_json"; + /** + * The size of the generated images. Must be one of `256x256`, `512x512`, or + * `1024x1024` for `dall-e-2`. Must be one of `1024x1024`, `1792x1024`, or + * `1024x1792` for `dall-e-3` models. + * @default 1024x1024 + * @enum 256x256,512x512,1024x1024,1792x1024,1024x1792 + * @example 1024x1024 + */ + size?: "256x256" | "512x512" | "1024x1024" | "1792x1024" | "1024x1792"; + /** + * The style of the generated images. Must be one of `vivid` or `natural`. + * Vivid causes the model to lean towards generating hyper-real and dramatic + * images. Natural causes the model to produce more natural, less hyper-real + * looking images. This param is only supported for `dall-e-3`. + * @default vivid + * @enum vivid,natural + * @example vivid + */ + style?: "vivid" | "natural"; + /** + * A unique identifier representing your end-user, which can help OpenAI to + * monitor and detect abuse. [Learn + * more](/docs/guides/safety-best-practices/end-user-ids). + * @example user-1234 + */ + user?: string; }; export type CreateImageEditRequest = { - image: string; - /** - * A text description of the desired image(s). The maximum length is 1000 - * characters. - * @example A cute baby sea otter wearing a beret - */ - prompt: string; - mask?: string; - /** - * The model to use for image generation. Only `dall-e-2` is supported at this - * time. - * @default dall-e-2 - * @example dall-e-2 - */ - model?: string | 'dall-e-2' | null; - /** - * The number of images to generate. Must be between 1 and 10. - * @default 1 - * @example 1 - */ - n?: number | null; - /** - * The size of the generated images. Must be one of `256x256`, `512x512`, or - * `1024x1024`. - * @default 1024x1024 - * @enum 256x256,512x512,1024x1024 - * @example 1024x1024 - */ - size?: '256x256' | '512x512' | '1024x1024'; - /** - * The format in which the generated images are returned. Must be one of `url` - * or `b64_json`. URLs are only valid for 60 minutes after the image has been - * generated. - * @default url - * @enum url,b64_json - * @example url - */ - response_format?: 'url' | 'b64_json'; - /** - * A unique identifier representing your end-user, which can help OpenAI to - * monitor and detect abuse. [Learn - * more](/docs/guides/safety-best-practices/end-user-ids). - * @example user-1234 - */ - user?: string; + image: string; + /** + * A text description of the desired image(s). The maximum length is 1000 + * characters. + * @example A cute baby sea otter wearing a beret + */ + prompt: string; + mask?: string; + /** + * The model to use for image generation. Only `dall-e-2` is supported at this + * time. + * @default dall-e-2 + * @example dall-e-2 + */ + model?: string | "dall-e-2" | null; + /** + * The number of images to generate. Must be between 1 and 10. + * @default 1 + * @example 1 + */ + n?: number | null; + /** + * The size of the generated images. Must be one of `256x256`, `512x512`, or + * `1024x1024`. + * @default 1024x1024 + * @enum 256x256,512x512,1024x1024 + * @example 1024x1024 + */ + size?: "256x256" | "512x512" | "1024x1024"; + /** + * The format in which the generated images are returned. Must be one of `url` + * or `b64_json`. URLs are only valid for 60 minutes after the image has been + * generated. + * @default url + * @enum url,b64_json + * @example url + */ + response_format?: "url" | "b64_json"; + /** + * A unique identifier representing your end-user, which can help OpenAI to + * monitor and detect abuse. [Learn + * more](/docs/guides/safety-best-practices/end-user-ids). + * @example user-1234 + */ + user?: string; }; export type CreateImageVariationRequest = { - image: string; - /** - * The model to use for image generation. Only `dall-e-2` is supported at this - * time. - * @default dall-e-2 - * @example dall-e-2 - */ - model?: string | 'dall-e-2' | null; - /** - * The number of images to generate. Must be between 1 and 10. For `dall-e-3`, - * only `n=1` is supported. - * @default 1 - * @example 1 - */ - n?: number | null; - /** - * The format in which the generated images are returned. Must be one of `url` - * or `b64_json`. URLs are only valid for 60 minutes after the image has been - * generated. - * @default url - * @enum url,b64_json - * @example url - */ - response_format?: 'url' | 'b64_json'; - /** - * The size of the generated images. Must be one of `256x256`, `512x512`, or - * `1024x1024`. - * @default 1024x1024 - * @enum 256x256,512x512,1024x1024 - * @example 1024x1024 - */ - size?: '256x256' | '512x512' | '1024x1024'; - /** - * A unique identifier representing your end-user, which can help OpenAI to - * monitor and detect abuse. [Learn - * more](/docs/guides/safety-best-practices/end-user-ids). - * @example user-1234 - */ - user?: string; + image: string; + /** + * The model to use for image generation. Only `dall-e-2` is supported at this + * time. + * @default dall-e-2 + * @example dall-e-2 + */ + model?: string | "dall-e-2" | null; + /** + * The number of images to generate. Must be between 1 and 10. For `dall-e-3`, + * only `n=1` is supported. + * @default 1 + * @example 1 + */ + n?: number | null; + /** + * The format in which the generated images are returned. Must be one of `url` + * or `b64_json`. URLs are only valid for 60 minutes after the image has been + * generated. + * @default url + * @enum url,b64_json + * @example url + */ + response_format?: "url" | "b64_json"; + /** + * The size of the generated images. Must be one of `256x256`, `512x512`, or + * `1024x1024`. + * @default 1024x1024 + * @enum 256x256,512x512,1024x1024 + * @example 1024x1024 + */ + size?: "256x256" | "512x512" | "1024x1024"; + /** + * A unique identifier representing your end-user, which can help OpenAI to + * monitor and detect abuse. [Learn + * more](/docs/guides/safety-best-practices/end-user-ids). + * @example user-1234 + */ + user?: string; }; export type CreateModerationRequest = { - input: - | string - | string[] - | ( - | { - /** - * Always `image_url`. - * @enum image_url - */ - type: 'image_url'; - image_url: { - /** - * Either a URL of the image or the base64 encoded image data. - * @example https://example.com/image.jpg - */ - url: string; - }; - } - | { - /** - * Always `text`. - * @enum text - */ - type: 'text'; - /** - * A string of text to classify. - * @example I want to kill them - */ - text: string; - } - | null - )[] - | null; - /** - * The content moderation model you would like to use. Learn more in - * [the moderation guide](/docs/guides/moderation), and learn about - * available models [here](/docs/models/moderation). - * @default omni-moderation-latest - * @example omni-moderation-2024-09-26 - */ - model?: - | string - | 'omni-moderation-latest' - | 'omni-moderation-2024-09-26' - | 'text-moderation-latest' - | 'text-moderation-stable' - | null; + input: + | string + | readonly string[] + | readonly ( + | { + /** + * Always `image_url`. + * @enum image_url + */ + type: "image_url"; + image_url: { + /** + * Either a URL of the image or the base64 encoded image data. + * @example https://example.com/image.jpg + */ + url: string; + }; + } + | { + /** + * Always `text`. + * @enum text + */ + type: "text"; + /** + * A string of text to classify. + * @example I want to kill them + */ + text: string; + } + )[]; + /** + * The content moderation model you would like to use. Learn more in + * [the moderation guide](/docs/guides/moderation), and learn about + * available models [here](/docs/models/moderation). + * @default omni-moderation-latest + * @example omni-moderation-2024-09-26 + */ + model?: + | string + | "omni-moderation-latest" + | "omni-moderation-2024-09-26" + | "text-moderation-latest" + | "text-moderation-stable"; }; /** Represents if a given text input is potentially harmful. */ export type CreateModerationResponse = { - id: string; - model: string; - readonly results: { - flagged: boolean; - categories: { - hate: boolean; - 'hate/threatening': boolean; - harassment: boolean; - 'harassment/threatening': boolean; - illicit: boolean; - 'illicit/violent': boolean; - 'self-harm': boolean; - 'self-harm/intent': boolean; - 'self-harm/instructions': boolean; - sexual: boolean; - 'sexual/minors': boolean; - violence: boolean; - 'violence/graphic': boolean; - }; - category_scores: { - hate: number; - 'hate/threatening': number; - harassment: number; - 'harassment/threatening': number; - illicit: number; - 'illicit/violent': number; - 'self-harm': number; - 'self-harm/intent': number; - 'self-harm/instructions': number; - sexual: number; - 'sexual/minors': number; - violence: number; - 'violence/graphic': number; - }; - category_applied_input_types: { - readonly hate: 'text'[]; - readonly 'hate/threatening': 'text'[]; - readonly harassment: 'text'[]; - readonly 'harassment/threatening': 'text'[]; - readonly illicit: 'text'[]; - readonly 'illicit/violent': 'text'[]; - readonly 'self-harm': ('text' | 'image')[]; - readonly 'self-harm/intent': ('text' | 'image')[]; - readonly 'self-harm/instructions': ('text' | 'image')[]; - readonly sexual: ('text' | 'image')[]; - readonly 'sexual/minors': 'text'[]; - readonly violence: ('text' | 'image')[]; - readonly 'violence/graphic': ('text' | 'image')[]; - }; - }[]; + id: string; + model: string; + results: readonly { + flagged: boolean; + categories: { + hate: boolean; + "hate/threatening": boolean; + harassment: boolean; + "harassment/threatening": boolean; + illicit: boolean; + "illicit/violent": boolean; + "self-harm": boolean; + "self-harm/intent": boolean; + "self-harm/instructions": boolean; + sexual: boolean; + "sexual/minors": boolean; + violence: boolean; + "violence/graphic": boolean; + }; + category_scores: { + hate: number; + "hate/threatening": number; + harassment: number; + "harassment/threatening": number; + illicit: number; + "illicit/violent": number; + "self-harm": number; + "self-harm/intent": number; + "self-harm/instructions": number; + sexual: number; + "sexual/minors": number; + violence: number; + "violence/graphic": number; + }; + category_applied_input_types: { + hate: readonly "text"[]; + "hate/threatening": readonly "text"[]; + harassment: readonly "text"[]; + "harassment/threatening": readonly "text"[]; + illicit: readonly "text"[]; + "illicit/violent": readonly "text"[]; + "self-harm": readonly ("text" | "image")[]; + "self-harm/intent": readonly ("text" | "image")[]; + "self-harm/instructions": readonly ("text" | "image")[]; + sexual: readonly ("text" | "image")[]; + "sexual/minors": readonly "text"[]; + violence: readonly ("text" | "image")[]; + "violence/graphic": readonly ("text" | "image")[]; + }; + }[]; }; export type CreateFileRequest = { - file: string; - /** - * The intended purpose of the uploaded file. - * - * Use "assistants" for [Assistants](/docs/api-reference/assistants) and - * [Message](/docs/api-reference/messages) files, "vision" for Assistants - * image file inputs, "batch" for [Batch API](/docs/guides/batch), and - * "fine-tune" for [Fine-tuning](/docs/api-reference/fine-tuning). - * @enum assistants,batch,fine-tune,vision - */ - purpose: 'assistants' | 'batch' | 'fine-tune' | 'vision'; + file: string; + /** + * The intended purpose of the uploaded file. + * + * Use "assistants" for [Assistants](/docs/api-reference/assistants) and + * [Message](/docs/api-reference/messages) files, "vision" for Assistants + * image file inputs, "batch" for [Batch API](/docs/guides/batch), and + * "fine-tune" for [Fine-tuning](/docs/api-reference/fine-tuning). + * @enum assistants,batch,fine-tune,vision + */ + purpose: "assistants" | "batch" | "fine-tune" | "vision"; }; export type DeleteFileResponse = { - id: string; - object: 'file'; - deleted: boolean; + id: string; + object: "file"; + deleted: boolean; }; export type CreateUploadRequest = { - filename: string; - /** - * The intended purpose of the uploaded file. - * - * See the [documentation on File - * purposes](/docs/api-reference/files/create#files-create-purpose). - * @enum assistants,batch,fine-tune,vision - */ - purpose: 'assistants' | 'batch' | 'fine-tune' | 'vision'; - bytes: number; - mime_type: string; + filename: string; + /** + * The intended purpose of the uploaded file. + * + * See the [documentation on File + * purposes](/docs/api-reference/files/create#files-create-purpose). + * @enum assistants,batch,fine-tune,vision + */ + purpose: "assistants" | "batch" | "fine-tune" | "vision"; + bytes: number; + mime_type: string; }; export type AddUploadPartRequest = { - data: string; + data: string; }; export type CompleteUploadRequest = { - readonly part_ids: string[]; - md5?: string; + part_ids: readonly string[]; + md5?: string; }; -export type CancelUploadRequest = JsonifiableObject; +export type CancelUploadRequest = Record; export type CreateFineTuningJobRequest = { - /** - * The name of the model to fine-tune. You can select one of the - * [supported - * models](/docs/guides/fine-tuning/which-models-can-be-fine-tuned). - * @example gpt-4o-mini - */ - model: - | string - | 'babbage-002' - | 'davinci-002' - | 'gpt-3.5-turbo' - | 'gpt-4o-mini' - | null; - /** - * The ID of an uploaded file that contains training data. - * - * See [upload file](/docs/api-reference/files/create) for how to upload a - * file. - * - * Your dataset must be formatted as a JSONL file. Additionally, you must - * upload your file with the purpose `fine-tune`. - * - * The contents of the file should differ depending on if the model uses the - * [chat](/docs/api-reference/fine-tuning/chat-input) or - * [completions](/docs/api-reference/fine-tuning/completions-input) format. - * - * See the [fine-tuning guide](/docs/guides/fine-tuning) for more details. - * @example file-abc123 - */ - training_file: string; - hyperparameters?: { - /** - * Number of examples in each batch. A larger batch size means that model - * parameters - * are updated less frequently, but with lower variance. - * @default auto - */ - batch_size?: 'auto' | number | null; - /** - * Scaling factor for the learning rate. A smaller learning rate may be useful - * to avoid - * overfitting. - * @default auto - */ - learning_rate_multiplier?: 'auto' | number | null; - /** - * The number of epochs to train the model for. An epoch refers to one full - * cycle - * through the training dataset. - * @default auto - */ - n_epochs?: 'auto' | number | null; - }; - suffix?: string; - /** - * The ID of an uploaded file that contains validation data. - * - * If you provide this file, the data is used to generate validation - * metrics periodically during fine-tuning. These metrics can be viewed in - * the fine-tuning results file. - * The same data should not be present in both train and validation files. - * - * Your dataset must be formatted as a JSONL file. You must upload your file - * with the purpose `fine-tune`. - * - * See the [fine-tuning guide](/docs/guides/fine-tuning) for more details. - * @example file-abc123 - */ - validation_file?: string; - readonly integrations?: { - type: 'wandb'; - wandb: { - /** - * The name of the project that the new run will be created under. - * @example my-wandb-project - */ - project: string; - name?: string; - entity?: string; - readonly tags?: string[]; - }; - }[]; - /** - * The seed controls the reproducibility of the job. Passing in the same seed - * and job parameters should produce the same results, but may differ in rare - * cases. - * If a seed is not specified, one will be generated for you. - * @example 42 - */ - seed?: number | null; + /** + * The name of the model to fine-tune. You can select one of the + * [supported + * models](/docs/guides/fine-tuning/which-models-can-be-fine-tuned). + * @example gpt-4o-mini + */ + model: + | string + | "babbage-002" + | "davinci-002" + | "gpt-3.5-turbo" + | "gpt-4o-mini"; + /** + * The ID of an uploaded file that contains training data. + * + * See [upload file](/docs/api-reference/files/create) for how to upload a + * file. + * + * Your dataset must be formatted as a JSONL file. Additionally, you must + * upload your file with the purpose `fine-tune`. + * + * The contents of the file should differ depending on if the model uses the + * [chat](/docs/api-reference/fine-tuning/chat-input) or + * [completions](/docs/api-reference/fine-tuning/completions-input) format. + * + * See the [fine-tuning guide](/docs/guides/fine-tuning) for more details. + * @example file-abc123 + */ + training_file: string; + hyperparameters?: { + /** + * Number of examples in each batch. A larger batch size means that model + * parameters + * are updated less frequently, but with lower variance. + * @default auto + */ + batch_size?: "auto" | number; + /** + * Scaling factor for the learning rate. A smaller learning rate may be useful + * to avoid + * overfitting. + * @default auto + */ + learning_rate_multiplier?: "auto" | number; + /** + * The number of epochs to train the model for. An epoch refers to one full + * cycle + * through the training dataset. + * @default auto + */ + n_epochs?: "auto" | number; + }; + suffix?: string; + /** + * The ID of an uploaded file that contains validation data. + * + * If you provide this file, the data is used to generate validation + * metrics periodically during fine-tuning. These metrics can be viewed in + * the fine-tuning results file. + * The same data should not be present in both train and validation files. + * + * Your dataset must be formatted as a JSONL file. You must upload your file + * with the purpose `fine-tune`. + * + * See the [fine-tuning guide](/docs/guides/fine-tuning) for more details. + * @example file-abc123 + */ + validation_file?: string; + integrations?: readonly { + type: "wandb"; + wandb: { + /** + * The name of the project that the new run will be created under. + * @example my-wandb-project + */ + project: string; + name?: string; + entity?: string; + tags?: readonly string[]; + }; + }[]; + /** + * The seed controls the reproducibility of the job. Passing in the same seed + * and job parameters should produce the same results, but may differ in rare + * cases. + * If a seed is not specified, one will be generated for you. + * @example 42 + */ + seed?: number | null; }; export type CreateEmbeddingRequest = { - /** - * Input text to embed, encoded as a string or array of tokens. To embed - * multiple inputs in a single request, pass an array of strings or array of - * token arrays. The input must not exceed the max input tokens for the model - * (8192 tokens for `text-embedding-ada-002`), cannot be an empty string, and - * any array must be 2048 dimensions or less. [Example Python - * code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) - * for counting tokens. - * @example The quick brown fox jumped over the lazy dog - */ - input: string | string[] | number[] | number[][] | null; - /** - * ID of the model to use. You can use the [List - * models](/docs/api-reference/models/list) API to see all of your available - * models, or see our [Model overview](/docs/models/overview) for descriptions - * of them. - * @example text-embedding-3-small - */ - model: - | string - | 'text-embedding-ada-002' - | 'text-embedding-3-small' - | 'text-embedding-3-large' - | null; - /** - * The format to return the embeddings in. Can be either `float` or - * [`base64`](https://pypi.org/project/pybase64/). - * @default float - * @enum float,base64 - * @example float - */ - encoding_format?: 'float' | 'base64'; - dimensions?: number; - /** - * A unique identifier representing your end-user, which can help OpenAI to - * monitor and detect abuse. [Learn - * more](/docs/guides/safety-best-practices/end-user-ids). - * @example user-1234 - */ - user?: string; + /** + * Input text to embed, encoded as a string or array of tokens. To embed + * multiple inputs in a single request, pass an array of strings or array of + * token arrays. The input must not exceed the max input tokens for the model + * (8192 tokens for `text-embedding-ada-002`), cannot be an empty string, and + * any array must be 2048 dimensions or less. [Example Python + * code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) + * for counting tokens. + * @example The quick brown fox jumped over the lazy dog + */ + input: + | string + | readonly string[] + | readonly number[] + | readonly (readonly number[])[]; + /** + * ID of the model to use. You can use the [List + * models](/docs/api-reference/models/list) API to see all of your available + * models, or see our [Model overview](/docs/models/overview) for descriptions + * of them. + * @example text-embedding-3-small + */ + model: + | string + | "text-embedding-ada-002" + | "text-embedding-3-small" + | "text-embedding-3-large"; + /** + * The format to return the embeddings in. Can be either `float` or + * [`base64`](https://pypi.org/project/pybase64/). + * @default float + * @enum float,base64 + * @example float + */ + encoding_format?: "float" | "base64"; + dimensions?: number; + /** + * A unique identifier representing your end-user, which can help OpenAI to + * monitor and detect abuse. [Learn + * more](/docs/guides/safety-best-practices/end-user-ids). + * @example user-1234 + */ + user?: string; }; /** * Represents a transcription response returned by model, based on the * provided input. */ export type CreateTranscriptionResponseJson = { - text: string; + text: string; }; export type CreateTranslationResponseJson = { - text: string; + text: string; }; export type CreateSpeechRequest = { - model: string | 'tts-1' | 'tts-1-hd' | null; - input: string; - /** - * The voice to use when generating the audio. Supported voices are `alloy`, - * `echo`, `fable`, `onyx`, `nova`, and `shimmer`. Previews of the voices are - * available in the [Text to speech - * guide](/docs/guides/text-to-speech/voice-options). - * @enum alloy,echo,fable,onyx,nova,shimmer - */ - voice: 'alloy' | 'echo' | 'fable' | 'onyx' | 'nova' | 'shimmer'; - /** - * The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, - * `wav`, and `pcm`. - * @default mp3 - * @enum mp3,opus,aac,flac,wav,pcm - */ - response_format?: 'mp3' | 'opus' | 'aac' | 'flac' | 'wav' | 'pcm'; - /** - * The speed of the generated audio. Select a value from `0.25` to `4.0`. - * `1.0` is the default. - * @default 1 - */ - speed?: number; + model: string | "tts-1" | "tts-1-hd"; + input: string; + /** + * The voice to use when generating the audio. Supported voices are `alloy`, + * `echo`, `fable`, `onyx`, `nova`, and `shimmer`. Previews of the voices are + * available in the [Text to speech + * guide](/docs/guides/text-to-speech/voice-options). + * @enum alloy,echo,fable,onyx,nova,shimmer + */ + voice: "alloy" | "echo" | "fable" | "onyx" | "nova" | "shimmer"; + /** + * The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, + * `wav`, and `pcm`. + * @default mp3 + * @enum mp3,opus,aac,flac,wav,pcm + */ + response_format?: "mp3" | "opus" | "aac" | "flac" | "wav" | "pcm"; + /** + * The speed of the generated audio. Select a value from `0.25` to `4.0`. + * `1.0` is the default. + * @default 1 + */ + speed?: number; }; /** The upload Part represents a chunk of bytes we can add to an Upload object. */ export type UploadPart = { - id: string; - created_at: number; - upload_id: string; - /** - * The object type, which is always `upload.part`. - * @enum upload.part - */ - object: 'upload.part'; + id: string; + created_at: number; + upload_id: string; + /** + * The object type, which is always `upload.part`. + * @enum upload.part + */ + object: "upload.part"; }; export type FineTuningIntegration = { - /** - * The type of the integration being enabled for the fine-tuning job - * @enum wandb - */ - type: 'wandb'; - wandb: { - /** - * The name of the project that the new run will be created under. - * @example my-wandb-project - */ - project: string; - name?: string; - entity?: string; - readonly tags?: string[]; - }; + /** + * The type of the integration being enabled for the fine-tuning job + * @enum wandb + */ + type: "wandb"; + wandb: { + /** + * The name of the project that the new run will be created under. + * @example my-wandb-project + */ + project: string; + name?: string; + entity?: string; + tags?: readonly string[]; + }; }; /** * The per-line training example of a fine-tuning input file for completions * models */ export type FinetuneCompletionRequestInput = { - prompt?: string; - completion?: string; + prompt?: string; + completion?: string; }; export type DeleteAssistantResponse = { - id: string; - deleted: boolean; - object: 'assistant.deleted'; + id: string; + deleted: boolean; + object: "assistant.deleted"; }; export type AssistantToolsCode = { - /** - * The type of tool being defined: `code_interpreter` - * @enum code_interpreter - */ - type: 'code_interpreter'; + /** + * The type of tool being defined: `code_interpreter` + * @enum code_interpreter + */ + type: "code_interpreter"; }; export type AssistantToolsFileSearchTypeOnly = { - /** - * The type of tool being defined: `file_search` - * @enum file_search - */ - type: 'file_search'; + /** + * The type of tool being defined: `file_search` + * @enum file_search + */ + type: "file_search"; }; export type ModifyRunRequest = { - metadata?: JsonifiableObject; + metadata?: Record; }; export type SubmitToolOutputsRunRequest = { - readonly tool_outputs: { - tool_call_id?: string; - output?: string; - }[]; - stream?: boolean | null; + tool_outputs: readonly { + tool_call_id?: string; + output?: string; + }[]; + stream?: boolean | null; }; export type ModifyThreadRequest = { - tool_resources?: { - code_interpreter?: { - /** - * A list of [file](/docs/api-reference/files) IDs made available to the - * `code_interpreter` tool. There can be a maximum of 20 files associated with - * the tool. - * @default - */ - readonly file_ids?: string[]; - }; - file_search?: { - readonly vector_store_ids?: string[]; - }; - }; - metadata?: JsonifiableObject; + tool_resources?: { + code_interpreter?: { + /** + * A list of [file](/docs/api-reference/files) IDs made available to the + * `code_interpreter` tool. There can be a maximum of 20 files associated with + * the tool. + * @default + */ + file_ids?: readonly string[]; + }; + file_search?: { + vector_store_ids?: readonly string[]; + }; + }; + metadata?: Record; }; export type DeleteThreadResponse = { - id: string; - deleted: boolean; - object: 'thread.deleted'; + id: string; + deleted: boolean; + object: "thread.deleted"; }; export type ModifyMessageRequest = { - metadata?: JsonifiableObject; + metadata?: Record; }; export type DeleteMessageResponse = { - id: string; - deleted: boolean; - object: 'thread.message.deleted'; + id: string; + deleted: boolean; + object: "thread.message.deleted"; }; /** * References an image [File](/docs/api-reference/files) in the content of a * message. */ export type MessageContentImageFileObject = { - /** - * Always `image_file`. - * @enum image_file - */ - type: 'image_file'; - image_file: { - file_id: string; - /** - * Specifies the detail level of the image if specified by the user. `low` - * uses fewer tokens, you can opt in to high resolution using `high`. - * @default auto - * @enum auto,low,high - */ - detail?: 'auto' | 'low' | 'high'; - }; + /** + * Always `image_file`. + * @enum image_file + */ + type: "image_file"; + image_file: { + file_id: string; + /** + * Specifies the detail level of the image if specified by the user. `low` + * uses fewer tokens, you can opt in to high resolution using `high`. + * @default auto + * @enum auto,low,high + */ + detail?: "auto" | "low" | "high"; + }; }; /** * References an image [File](/docs/api-reference/files) in the content of a * message. */ export type MessageDeltaContentImageFileObject = { - index: number; - /** - * Always `image_file`. - * @enum image_file - */ - type: 'image_file'; - image_file?: { - file_id?: string; - /** - * Specifies the detail level of the image if specified by the user. `low` - * uses fewer tokens, you can opt in to high resolution using `high`. - * @default auto - * @enum auto,low,high - */ - detail?: 'auto' | 'low' | 'high'; - }; + index: number; + /** + * Always `image_file`. + * @enum image_file + */ + type: "image_file"; + image_file?: { + file_id?: string; + /** + * Specifies the detail level of the image if specified by the user. `low` + * uses fewer tokens, you can opt in to high resolution using `high`. + * @default auto + * @enum auto,low,high + */ + detail?: "auto" | "low" | "high"; + }; }; /** References an image URL in the content of a message. */ export type MessageContentImageUrlObject = { - /** - * The type of the content part. - * @enum image_url - */ - type: 'image_url'; - image_url: { - url: string; - /** - * Specifies the detail level of the image. `low` uses fewer tokens, you can - * opt in to high resolution using `high`. Default value is `auto` - * @default auto - * @enum auto,low,high - */ - detail?: 'auto' | 'low' | 'high'; - }; + /** + * The type of the content part. + * @enum image_url + */ + type: "image_url"; + image_url: { + url: string; + /** + * Specifies the detail level of the image. `low` uses fewer tokens, you can + * opt in to high resolution using `high`. Default value is `auto` + * @default auto + * @enum auto,low,high + */ + detail?: "auto" | "low" | "high"; + }; }; /** References an image URL in the content of a message. */ export type MessageDeltaContentImageUrlObject = { - index: number; - /** - * Always `image_url`. - * @enum image_url - */ - type: 'image_url'; - image_url?: { - url?: string; - /** - * Specifies the detail level of the image. `low` uses fewer tokens, you can - * opt in to high resolution using `high`. - * @default auto - * @enum auto,low,high - */ - detail?: 'auto' | 'low' | 'high'; - }; + index: number; + /** + * Always `image_url`. + * @enum image_url + */ + type: "image_url"; + image_url?: { + url?: string; + /** + * Specifies the detail level of the image. `low` uses fewer tokens, you can + * opt in to high resolution using `high`. + * @default auto + * @enum auto,low,high + */ + detail?: "auto" | "low" | "high"; + }; }; /** The text content that is part of a message. */ export type MessageContentTextObject = { - /** - * Always `text`. - * @enum text - */ - type: 'text'; - text: { - value: string; - readonly annotations: (never | never | null)[]; - }; + /** + * Always `text`. + * @enum text + */ + type: "text"; + text: { + value: string; + annotations: readonly (never | never)[]; + }; }; /** The refusal content generated by the assistant. */ export type MessageContentRefusalObject = { - /** - * Always `refusal`. - * @enum refusal - */ - type: 'refusal'; - refusal: string; + /** + * Always `refusal`. + * @enum refusal + */ + type: "refusal"; + refusal: string; }; /** The text content that is part of a message. */ export type MessageRequestContentTextObject = { - /** - * Always `text`. - * @enum text - */ - type: 'text'; - text: string; + /** + * Always `text`. + * @enum text + */ + type: "text"; + text: string; }; /** * A citation within the message that points to a specific quote from a @@ -772,57 +764,57 @@ export type MessageRequestContentTextObject = { * the assistant uses the "file_search" tool to search files. */ export type MessageContentTextAnnotationsFileCitationObject = { - /** - * Always `file_citation`. - * @enum file_citation - */ - type: 'file_citation'; - text: string; - file_citation: { - file_id: string; - }; - start_index: number; - end_index: number; + /** + * Always `file_citation`. + * @enum file_citation + */ + type: "file_citation"; + text: string; + file_citation: { + file_id: string; + }; + start_index: number; + end_index: number; }; /** * A URL for the file that's generated when the assistant used the * `code_interpreter` tool to generate a file. */ export type MessageContentTextAnnotationsFilePathObject = { - /** - * Always `file_path`. - * @enum file_path - */ - type: 'file_path'; - text: string; - file_path: { - file_id: string; - }; - start_index: number; - end_index: number; + /** + * Always `file_path`. + * @enum file_path + */ + type: "file_path"; + text: string; + file_path: { + file_id: string; + }; + start_index: number; + end_index: number; }; /** The text content that is part of a message. */ export type MessageDeltaContentTextObject = { - index: number; - /** - * Always `text`. - * @enum text - */ - type: 'text'; - text?: { - value?: string; - readonly annotations?: (never | never | null)[]; - }; + index: number; + /** + * Always `text`. + * @enum text + */ + type: "text"; + text?: { + value?: string; + annotations?: readonly (never | never)[]; + }; }; /** The refusal content that is part of a message. */ export type MessageDeltaContentRefusalObject = { - index: number; - /** - * Always `refusal`. - * @enum refusal - */ - type: 'refusal'; - refusal?: string; + index: number; + /** + * Always `refusal`. + * @enum refusal + */ + type: "refusal"; + refusal?: string; }; /** * A citation within the message that points to a specific quote from a @@ -830,1013 +822,1013 @@ export type MessageDeltaContentRefusalObject = { * the assistant uses the "file_search" tool to search files. */ export type MessageDeltaContentTextAnnotationsFileCitationObject = { - index: number; - /** - * Always `file_citation`. - * @enum file_citation - */ - type: 'file_citation'; - text?: string; - file_citation?: { - file_id?: string; - quote?: string; - }; - start_index?: number; - end_index?: number; + index: number; + /** + * Always `file_citation`. + * @enum file_citation + */ + type: "file_citation"; + text?: string; + file_citation?: { + file_id?: string; + quote?: string; + }; + start_index?: number; + end_index?: number; }; /** * A URL for the file that's generated when the assistant used the * `code_interpreter` tool to generate a file. */ export type MessageDeltaContentTextAnnotationsFilePathObject = { - index: number; - /** - * Always `file_path`. - * @enum file_path - */ - type: 'file_path'; - text?: string; - file_path?: { - file_id?: string; - }; - start_index?: number; - end_index?: number; + index: number; + /** + * Always `file_path`. + * @enum file_path + */ + type: "file_path"; + text?: string; + file_path?: { + file_id?: string; + }; + start_index?: number; + end_index?: number; }; /** Details of the Code Interpreter tool call the run step was involved in. */ export type RunStepDetailsToolCallsCodeObject = { - id: string; - /** - * The type of tool call. This is always going to be `code_interpreter` for - * this type of tool call. - * @enum code_interpreter - */ - type: 'code_interpreter'; - code_interpreter: { - input: string; - readonly outputs: (never | never | null)[]; - }; + id: string; + /** + * The type of tool call. This is always going to be `code_interpreter` for + * this type of tool call. + * @enum code_interpreter + */ + type: "code_interpreter"; + code_interpreter: { + input: string; + outputs: readonly (never | never)[]; + }; }; /** Details of the Code Interpreter tool call the run step was involved in. */ export type RunStepDeltaStepDetailsToolCallsCodeObject = { - index: number; - id?: string; - /** - * The type of tool call. This is always going to be `code_interpreter` for - * this type of tool call. - * @enum code_interpreter - */ - type: 'code_interpreter'; - code_interpreter?: { - input?: string; - readonly outputs?: (never | never | null)[]; - }; + index: number; + id?: string; + /** + * The type of tool call. This is always going to be `code_interpreter` for + * this type of tool call. + * @enum code_interpreter + */ + type: "code_interpreter"; + code_interpreter?: { + input?: string; + outputs?: readonly (never | never)[]; + }; }; /** Text output from the Code Interpreter tool call as part of a run step. */ export type RunStepDetailsToolCallsCodeOutputLogsObject = { - /** - * Always `logs`. - * @enum logs - */ - type: 'logs'; - logs: string; + /** + * Always `logs`. + * @enum logs + */ + type: "logs"; + logs: string; }; /** Text output from the Code Interpreter tool call as part of a run step. */ export type RunStepDeltaStepDetailsToolCallsCodeOutputLogsObject = { - index: number; - /** - * Always `logs`. - * @enum logs - */ - type: 'logs'; - logs?: string; + index: number; + /** + * Always `logs`. + * @enum logs + */ + type: "logs"; + logs?: string; }; export type RunStepDetailsToolCallsCodeOutputImageObject = { - /** - * Always `image`. - * @enum image - */ - type: 'image'; - image: { - file_id: string; - }; + /** + * Always `image`. + * @enum image + */ + type: "image"; + image: { + file_id: string; + }; }; export type RunStepDeltaStepDetailsToolCallsCodeOutputImageObject = { - index: number; - /** - * Always `image`. - * @enum image - */ - type: 'image'; - image?: { - file_id?: string; - }; + index: number; + /** + * Always `image`. + * @enum image + */ + type: "image"; + image?: { + file_id?: string; + }; }; export type RunStepDeltaStepDetailsToolCallsFileSearchObject = { - index: number; - id?: string; - /** - * The type of tool call. This is always going to be `file_search` for this - * type of tool call. - * @enum file_search - */ - type: 'file_search'; - file_search: JsonifiableObject; + index: number; + id?: string; + /** + * The type of tool call. This is always going to be `file_search` for this + * type of tool call. + * @enum file_search + */ + type: "file_search"; + file_search: Record; }; export type RunStepDetailsToolCallsFunctionObject = { - id: string; - /** - * The type of tool call. This is always going to be `function` for this type - * of tool call. - * @enum function - */ - type: 'function'; - function: { - name: string; - arguments: string; - output: string; - }; + id: string; + /** + * The type of tool call. This is always going to be `function` for this type + * of tool call. + * @enum function + */ + type: "function"; + function: { + name: string; + arguments: string; + output: string; + }; }; export type RunStepDeltaStepDetailsToolCallsFunctionObject = { - index: number; - id?: string; - /** - * The type of tool call. This is always going to be `function` for this type - * of tool call. - * @enum function - */ - type: 'function'; - function?: { - name?: string; - arguments?: string; - output?: string; - }; + index: number; + id?: string; + /** + * The type of tool call. This is always going to be `function` for this type + * of tool call. + * @enum function + */ + type: "function"; + function?: { + name?: string; + arguments?: string; + output?: string; + }; }; export type DeleteVectorStoreResponse = { - id: string; - deleted: boolean; - object: 'vector_store.deleted'; + id: string; + deleted: boolean; + object: "vector_store.deleted"; }; export type DeleteVectorStoreFileResponse = { - id: string; - deleted: boolean; - object: 'vector_store.file.deleted'; + id: string; + deleted: boolean; + object: "vector_store.file.deleted"; }; /** A batch of files attached to a vector store. */ export type VectorStoreFileBatchObject = { - id: string; - /** - * The object type, which is always `vector_store.file_batch`. - * @enum vector_store.files_batch - */ - object: 'vector_store.files_batch'; - created_at: number; - vector_store_id: string; - /** - * The status of the vector store files batch, which can be either - * `in_progress`, `completed`, `cancelled` or `failed`. - * @enum in_progress,completed,cancelled,failed - */ - status: 'in_progress' | 'completed' | 'cancelled' | 'failed'; - file_counts: { - in_progress: number; - completed: number; - failed: number; - cancelled: number; - total: number; - }; + id: string; + /** + * The object type, which is always `vector_store.file_batch`. + * @enum vector_store.files_batch + */ + object: "vector_store.files_batch"; + created_at: number; + vector_store_id: string; + /** + * The status of the vector store files batch, which can be either + * `in_progress`, `completed`, `cancelled` or `failed`. + * @enum in_progress,completed,cancelled,failed + */ + status: "in_progress" | "completed" | "cancelled" | "failed"; + file_counts: { + in_progress: number; + completed: number; + failed: number; + cancelled: number; + total: number; + }; }; /** The per-line object of the batch input file */ export type BatchRequestInput = { - custom_id?: string; - /** - * The HTTP method to be used for the request. Currently only `POST` is - * supported. - * @enum POST - */ - method?: 'POST'; - url?: string; + custom_id?: string; + /** + * The HTTP method to be used for the request. Currently only `POST` is + * supported. + * @enum POST + */ + method?: "POST"; + url?: string; }; /** The per-line object of the batch output and error files */ export type BatchRequestOutput = { - id?: string; - custom_id?: string; - response?: { - status_code?: number; - request_id?: string; - body?: JsonifiableObject; - }; - error?: { - code?: string; - message?: string; - }; + id?: string; + custom_id?: string; + response?: { + status_code?: number; + request_id?: string; + body?: Record; + }; + error?: { + code?: string; + message?: string; + }; }; export type InviteRequest = { - email: string; - /** - * `owner` or `reader` - * @enum reader,owner - */ - role: 'reader' | 'owner'; + email: string; + /** + * `owner` or `reader` + * @enum reader,owner + */ + role: "reader" | "owner"; }; export type InviteDeleteResponse = { - /** - * The object type, which is always `organization.invite.deleted` - * @enum organization.invite.deleted - */ - object: 'organization.invite.deleted'; - id: string; - deleted: boolean; + /** + * The object type, which is always `organization.invite.deleted` + * @enum organization.invite.deleted + */ + object: "organization.invite.deleted"; + id: string; + deleted: boolean; }; export type UserRoleUpdateRequest = { - /** - * `owner` or `reader` - * @enum owner,reader - */ - role: 'owner' | 'reader'; + /** + * `owner` or `reader` + * @enum owner,reader + */ + role: "owner" | "reader"; }; export type UserDeleteResponse = { - object: 'organization.user.deleted'; - id: string; - deleted: boolean; + object: "organization.user.deleted"; + id: string; + deleted: boolean; }; export type ProjectCreateRequest = { - name: string; - app_use_case?: string; - business_website?: string; + name: string; + app_use_case?: string; + business_website?: string; }; export type ProjectUpdateRequest = { - name: string; - app_use_case?: string; - business_website?: string; + name: string; + app_use_case?: string; + business_website?: string; }; export type DefaultProjectErrorResponse = { - code: number; - message: string; + code: number; + message: string; }; export type ProjectUserCreateRequest = { - user_id: string; - /** - * `owner` or `member` - * @enum owner,member - */ - role: 'owner' | 'member'; + user_id: string; + /** + * `owner` or `member` + * @enum owner,member + */ + role: "owner" | "member"; }; export type ProjectUserUpdateRequest = { - /** - * `owner` or `member` - * @enum owner,member - */ - role: 'owner' | 'member'; + /** + * `owner` or `member` + * @enum owner,member + */ + role: "owner" | "member"; }; export type ProjectUserDeleteResponse = { - object: 'organization.project.user.deleted'; - id: string; - deleted: boolean; + object: "organization.project.user.deleted"; + id: string; + deleted: boolean; }; export type ProjectServiceAccountCreateRequest = { - name: string; + name: string; }; export type ProjectServiceAccountDeleteResponse = { - object: 'organization.project.service_account.deleted'; - id: string; - deleted: boolean; + object: "organization.project.service_account.deleted"; + id: string; + deleted: boolean; }; export type ProjectApiKeyDeleteResponse = { - object: 'organization.project.api_key.deleted'; - id: string; - deleted: boolean; + object: "organization.project.api_key.deleted"; + id: string; + deleted: boolean; }; /** Represents an individual service account in a project. */ export type ProjectServiceAccount = { - /** - * The object type, which is always `organization.project.service_account` - * @enum organization.project.service_account - */ - object: 'organization.project.service_account'; - id: string; - name: string; - /** - * `owner` or `member` - * @enum owner,member - */ - role: 'owner' | 'member'; - created_at: number; + /** + * The object type, which is always `organization.project.service_account` + * @enum organization.project.service_account + */ + object: "organization.project.service_account"; + id: string; + name: string; + /** + * `owner` or `member` + * @enum owner,member + */ + role: "owner" | "member"; + created_at: number; }; /** Represents an individual user in a project. */ export type ProjectUser = { - /** - * The object type, which is always `organization.project.user` - * @enum organization.project.user - */ - object: 'organization.project.user'; - id: string; - name: string; - email: string; - /** - * `owner` or `member` - * @enum owner,member - */ - role: 'owner' | 'member'; - added_at: number; + /** + * The object type, which is always `organization.project.user` + * @enum organization.project.user + */ + object: "organization.project.user"; + id: string; + name: string; + email: string; + /** + * `owner` or `member` + * @enum owner,member + */ + role: "owner" | "member"; + added_at: number; }; /** Represents an individual API key in a project. */ export type ProjectApiKey = { - /** - * The object type, which is always `organization.project.api_key` - * @enum organization.project.api_key - */ - object: 'organization.project.api_key'; - redacted_value: string; - name: string; - created_at: number; - id: string; - owner: { - /** - * `user` or `service_account` - * @enum user,service_account - */ - type?: 'user' | 'service_account'; - user?: ProjectUser; - service_account?: ProjectServiceAccount; - }; + /** + * The object type, which is always `organization.project.api_key` + * @enum organization.project.api_key + */ + object: "organization.project.api_key"; + redacted_value: string; + name: string; + created_at: number; + id: string; + owner: { + /** + * `user` or `service_account` + * @enum user,service_account + */ + type?: "user" | "service_account"; + /** Represents an individual user in a project. */ + user?: ProjectUser; + /** Represents an individual service account in a project. */ + service_account?: ProjectServiceAccount; + }; }; export type ProjectApiKeyListResponse = { - object: 'list'; - readonly data: ProjectApiKey[]; - first_id: string; - last_id: string; - has_more: boolean; + object: "list"; + data: readonly ProjectApiKey[]; + first_id: string; + last_id: string; + has_more: boolean; }; export type ProjectServiceAccountApiKey = { - /** - * The object type, which is always - * `organization.project.service_account.api_key` - * @enum organization.project.service_account.api_key - */ - object: 'organization.project.service_account.api_key'; - value: string; - name: string; - created_at: number; - id: string; + /** + * The object type, which is always + * `organization.project.service_account.api_key` + * @enum organization.project.service_account.api_key + */ + object: "organization.project.service_account.api_key"; + value: string; + name: string; + created_at: number; + id: string; }; export type ProjectServiceAccountCreateResponse = { - object: 'organization.project.service_account'; - id: string; - name: string; - /** - * Service accounts can only have one role of type `member` - * @enum member - */ - role: 'member'; - created_at: number; - api_key: ProjectServiceAccountApiKey; + object: "organization.project.service_account"; + id: string; + name: string; + /** + * Service accounts can only have one role of type `member` + * @enum member + */ + role: "member"; + created_at: number; + api_key: ProjectServiceAccountApiKey; }; export type ProjectServiceAccountListResponse = { - object: 'list'; - readonly data: ProjectServiceAccount[]; - first_id: string; - last_id: string; - has_more: boolean; + object: "list"; + data: readonly ProjectServiceAccount[]; + first_id: string; + last_id: string; + has_more: boolean; }; export type ProjectUserListResponse = { - object: string; - readonly data: ProjectUser[]; - first_id: string; - last_id: string; - has_more: boolean; + object: string; + data: readonly ProjectUser[]; + first_id: string; + last_id: string; + has_more: boolean; }; /** Represents an individual project. */ export type Project = { - id: string; - /** - * The object type, which is always `organization.project` - * @enum organization.project - */ - object: 'organization.project'; - name: string; - created_at: number; - archived_at?: number | null; - /** - * `active` or `archived` - * @enum active,archived - */ - status: 'active' | 'archived'; - app_use_case?: string; - business_website?: string; + id: string; + /** + * The object type, which is always `organization.project` + * @enum organization.project + */ + object: "organization.project"; + name: string; + created_at: number; + archived_at?: number | null; + /** + * `active` or `archived` + * @enum active,archived + */ + status: "active" | "archived"; + app_use_case?: string; + business_website?: string; }; export type ProjectListResponse = { - object: 'list'; - readonly data: Project[]; - first_id: string; - last_id: string; - has_more: boolean; + object: "list"; + data: readonly Project[]; + first_id: string; + last_id: string; + has_more: boolean; }; /** Represents an individual `user` within an organization. */ export type User = { - /** - * The object type, which is always `organization.user` - * @enum organization.user - */ - object: 'organization.user'; - id: string; - name: string; - email: string; - /** - * `owner` or `reader` - * @enum owner,reader - */ - role: 'owner' | 'reader'; - added_at: number; + /** + * The object type, which is always `organization.user` + * @enum organization.user + */ + object: "organization.user"; + id: string; + name: string; + email: string; + /** + * `owner` or `reader` + * @enum owner,reader + */ + role: "owner" | "reader"; + added_at: number; }; export type UserListResponse = { - object: 'list'; - readonly data: User[]; - first_id: string; - last_id: string; - has_more: boolean; + object: "list"; + data: readonly User[]; + first_id: string; + last_id: string; + has_more: boolean; }; /** Represents an individual `invite` to the organization. */ export type Invite = { - /** - * The object type, which is always `organization.invite` - * @enum organization.invite - */ - object: 'organization.invite'; - id: string; - email: string; - /** - * `owner` or `reader` - * @enum owner,reader - */ - role: 'owner' | 'reader'; - /** - * `accepted`,`expired`, or `pending` - * @enum accepted,expired,pending - */ - status: 'accepted' | 'expired' | 'pending'; - invited_at: number; - expires_at: number; - accepted_at?: number; + /** + * The object type, which is always `organization.invite` + * @enum organization.invite + */ + object: "organization.invite"; + id: string; + email: string; + /** + * `owner` or `reader` + * @enum owner,reader + */ + role: "owner" | "reader"; + /** + * `accepted`,`expired`, or `pending` + * @enum accepted,expired,pending + */ + status: "accepted" | "expired" | "pending"; + invited_at: number; + expires_at: number; + accepted_at?: number; }; export type InviteListResponse = { - /** - * The object type, which is always `list` - * @enum list - */ - object: 'list'; - readonly data: Invite[]; - first_id?: string; - last_id?: string; - has_more?: boolean; + /** + * The object type, which is always `list` + * @enum list + */ + object: "list"; + data: readonly Invite[]; + first_id?: string; + last_id?: string; + has_more?: boolean; }; /** The service account that performed the audit logged action. */ export type AuditLogActorServiceAccount = { - id?: string; + id?: string; }; /** The user who performed the audit logged action. */ export type AuditLogActorUser = { - id?: string; - email?: string; + id?: string; + email?: string; }; /** The API Key used to perform the audit logged action. */ export type AuditLogActorApiKey = { - id?: string; - /** - * The type of API key. Can be either `user` or `service_account`. - * @enum user,service_account - */ - type?: 'user' | 'service_account'; - user?: AuditLogActorUser; - service_account?: AuditLogActorServiceAccount; + id?: string; + /** + * The type of API key. Can be either `user` or `service_account`. + * @enum user,service_account + */ + type?: "user" | "service_account"; + /** The user who performed the audit logged action. */ + user?: AuditLogActorUser; + /** The service account that performed the audit logged action. */ + service_account?: AuditLogActorServiceAccount; }; /** The session in which the audit logged action was performed. */ export type AuditLogActorSession = { - user?: AuditLogActorUser; - ip_address?: string; + /** The user who performed the audit logged action. */ + user?: AuditLogActorUser; + ip_address?: string; }; /** The actor who performed the audit logged action. */ export type AuditLogActor = { - /** - * The type of actor. Is either `session` or `api_key`. - * @enum session,api_key - */ - type?: 'session' | 'api_key'; - session?: AuditLogActorSession; - api_key?: AuditLogActorApiKey; + /** + * The type of actor. Is either `session` or `api_key`. + * @enum session,api_key + */ + type?: "session" | "api_key"; + /** The session in which the audit logged action was performed. */ + session?: AuditLogActorSession; + /** The API Key used to perform the audit logged action. */ + api_key?: AuditLogActorApiKey; }; - -export enum AuditLogEventTypeEnum { - ApiKeyCreated = 'api_key.created', - ApiKeyUpdated = 'api_key.updated', - ApiKeyDeleted = 'api_key.deleted', - InviteSent = 'invite.sent', - InviteAccepted = 'invite.accepted', - InviteDeleted = 'invite.deleted', - LoginSucceeded = 'login.succeeded', - LoginFailed = 'login.failed', - LogoutSucceeded = 'logout.succeeded', - LogoutFailed = 'logout.failed', - OrganizationUpdated = 'organization.updated', - ProjectCreated = 'project.created', - ProjectUpdated = 'project.updated', - ProjectArchived = 'project.archived', - ServiceAccountCreated = 'service_account.created', - ServiceAccountUpdated = 'service_account.updated', - ServiceAccountDeleted = 'service_account.deleted', - UserAdded = 'user.added', - UserUpdated = 'user.updated', - UserDeleted = 'user.deleted', -} - /** The event type. */ export type AuditLogEventType = - | AuditLogEventTypeEnum - | 'api_key.created' - | 'api_key.updated' - | 'api_key.deleted' - | 'invite.sent' - | 'invite.accepted' - | 'invite.deleted' - | 'login.succeeded' - | 'login.failed' - | 'logout.succeeded' - | 'logout.failed' - | 'organization.updated' - | 'project.created' - | 'project.updated' - | 'project.archived' - | 'service_account.created' - | 'service_account.updated' - | 'service_account.deleted' - | 'user.added' - | 'user.updated' - | 'user.deleted'; + | "api_key.created" + | "api_key.updated" + | "api_key.deleted" + | "invite.sent" + | "invite.accepted" + | "invite.deleted" + | "login.succeeded" + | "login.failed" + | "logout.succeeded" + | "logout.failed" + | "organization.updated" + | "project.created" + | "project.updated" + | "project.archived" + | "service_account.created" + | "service_account.updated" + | "service_account.deleted" + | "user.added" + | "user.updated" + | "user.deleted"; /** A log of a user action or configuration change within this organization. */ export type AuditLog = { - id: string; - type: AuditLogEventType; - effective_at: number; - project?: { - id?: string; - name?: string; - }; - actor: AuditLogActor; - 'api_key.created'?: { - id?: string; - data?: { - readonly scopes?: string[]; - }; - }; - 'api_key.updated'?: { - id?: string; - changes_requested?: { - readonly scopes?: string[]; - }; - }; - 'api_key.deleted'?: { - id?: string; - }; - 'invite.sent'?: { - id?: string; - data?: { - email?: string; - role?: string; - }; - }; - 'invite.accepted'?: { - id?: string; - }; - 'invite.deleted'?: { - id?: string; - }; - 'login.failed'?: { - error_code?: string; - error_message?: string; - }; - 'logout.failed'?: { - error_code?: string; - error_message?: string; - }; - 'organization.updated'?: { - id?: string; - changes_requested?: { - title?: string; - description?: string; - name?: string; - settings?: { - threads_ui_visibility?: string; - usage_dashboard_visibility?: string; - }; - }; - }; - 'project.created'?: { - id?: string; - data?: { - name?: string; - title?: string; - }; - }; - 'project.updated'?: { - id?: string; - changes_requested?: { - title?: string; - }; - }; - 'project.archived'?: { - id?: string; - }; - 'service_account.created'?: { - id?: string; - data?: { - role?: string; - }; - }; - 'service_account.updated'?: { - id?: string; - changes_requested?: { - role?: string; - }; - }; - 'service_account.deleted'?: { - id?: string; - }; - 'user.added'?: { - id?: string; - data?: { - role?: string; - }; - }; - 'user.updated'?: { - id?: string; - changes_requested?: { - role?: string; - }; - }; - 'user.deleted'?: { - id?: string; - }; + id: string; + /** The event type. */ + type: AuditLogEventType; + effective_at: number; + project?: { + id?: string; + name?: string; + }; + /** The actor who performed the audit logged action. */ + actor: AuditLogActor; + "api_key.created"?: { + id?: string; + data?: { + scopes?: readonly string[]; + }; + }; + "api_key.updated"?: { + id?: string; + changes_requested?: { + scopes?: readonly string[]; + }; + }; + "api_key.deleted"?: { + id?: string; + }; + "invite.sent"?: { + id?: string; + data?: { + email?: string; + role?: string; + }; + }; + "invite.accepted"?: { + id?: string; + }; + "invite.deleted"?: { + id?: string; + }; + "login.failed"?: { + error_code?: string; + error_message?: string; + }; + "logout.failed"?: { + error_code?: string; + error_message?: string; + }; + "organization.updated"?: { + id?: string; + changes_requested?: { + title?: string; + description?: string; + name?: string; + settings?: { + threads_ui_visibility?: string; + usage_dashboard_visibility?: string; + }; + }; + }; + "project.created"?: { + id?: string; + data?: { + name?: string; + title?: string; + }; + }; + "project.updated"?: { + id?: string; + changes_requested?: { + title?: string; + }; + }; + "project.archived"?: { + id?: string; + }; + "service_account.created"?: { + id?: string; + data?: { + role?: string; + }; + }; + "service_account.updated"?: { + id?: string; + changes_requested?: { + role?: string; + }; + }; + "service_account.deleted"?: { + id?: string; + }; + "user.added"?: { + id?: string; + data?: { + role?: string; + }; + }; + "user.updated"?: { + id?: string; + changes_requested?: { + role?: string; + }; + }; + "user.deleted"?: { + id?: string; + }; }; export type ListAuditLogsResponse = { - object: 'list'; - readonly data: AuditLog[]; - first_id: string; - last_id: string; - has_more: boolean; + object: "list"; + data: readonly AuditLog[]; + first_id: string; + last_id: string; + has_more: boolean; }; export type Batch = { - id: string; - /** - * The object type, which is always `batch`. - * @enum batch - */ - object: 'batch'; - endpoint: string; - errors?: { - object?: string; - readonly data?: { - code?: string; - message?: string; - param?: string; - line?: number | null; - }[]; - }; - input_file_id: string; - completion_window: string; - /** - * The current status of the batch. - * @enum validating,failed,in_progress,finalizing,completed,expired,cancelling,cancelled - */ - status: - | 'validating' - | 'failed' - | 'in_progress' - | 'finalizing' - | 'completed' - | 'expired' - | 'cancelling' - | 'cancelled'; - output_file_id?: string; - error_file_id?: string; - created_at: number; - in_progress_at?: number; - expires_at?: number; - finalizing_at?: number; - completed_at?: number; - failed_at?: number; - expired_at?: number; - cancelling_at?: number; - cancelled_at?: number; - request_counts?: { - total: number; - completed: number; - failed: number; - }; - metadata?: JsonifiableObject; + id: string; + /** + * The object type, which is always `batch`. + * @enum batch + */ + object: "batch"; + endpoint: string; + errors?: { + object?: string; + data?: readonly { + code?: string; + message?: string; + param?: string; + line?: number | null; + }[]; + }; + input_file_id: string; + completion_window: string; + /** + * The current status of the batch. + * @enum validating,failed,in_progress,finalizing,completed,expired,cancelling,cancelled + */ + status: + | "validating" + | "failed" + | "in_progress" + | "finalizing" + | "completed" + | "expired" + | "cancelling" + | "cancelled"; + output_file_id?: string; + error_file_id?: string; + created_at: number; + in_progress_at?: number; + expires_at?: number; + finalizing_at?: number; + completed_at?: number; + failed_at?: number; + expired_at?: number; + cancelling_at?: number; + cancelled_at?: number; + request_counts?: { + total: number; + completed: number; + failed: number; + }; + metadata?: Record; }; export type ListBatchesResponse = { - readonly data: Batch[]; - first_id?: string; - last_id?: string; - has_more: boolean; - object: 'list'; + data: readonly Batch[]; + first_id?: string; + last_id?: string; + has_more: boolean; + object: "list"; }; /** * Represents a message delta i.e. any changed fields on a message during * streaming. */ export type MessageDeltaObject = { - id: string; - /** - * The object type, which is always `thread.message.delta`. - * @enum thread.message.delta - */ - object: 'thread.message.delta'; - delta: { - /** - * The entity that produced the message. One of `user` or `assistant`. - * @enum user,assistant - */ - role?: 'user' | 'assistant'; - readonly content?: ( - | MessageDeltaContentImageFileObject - | MessageDeltaContentTextObject - | MessageDeltaContentRefusalObject - | MessageDeltaContentImageUrlObject - | null - )[]; - }; + id: string; + /** + * The object type, which is always `thread.message.delta`. + * @enum thread.message.delta + */ + object: "thread.message.delta"; + delta: { + /** + * The entity that produced the message. One of `user` or `assistant`. + * @enum user,assistant + */ + role?: "user" | "assistant"; + content?: readonly ( + | MessageDeltaContentImageFileObject + | MessageDeltaContentTextObject + | MessageDeltaContentRefusalObject + | MessageDeltaContentImageUrlObject + )[]; + }; }; /** Occurs when a stream ends. */ export type DoneEvent = { - event: 'done'; - data: '[DONE]'; + event: "done"; + data: "[DONE]"; }; export type Error = { - code: string; - message: string; - param: string; - type: string; + code: string; + message: string; + param: string; + type: string; }; /** * Occurs when an [error](/docs/guides/error-codes/api-errors) occurs. This * can happen due to an internal server error or a timeout. */ export type ErrorEvent = { - event: 'error'; - data: Error; + event: "error"; + data: Error; }; /** Represents a message within a [thread](/docs/api-reference/threads). */ export type MessageObject = { - id: string; - /** - * The object type, which is always `thread.message`. - * @enum thread.message - */ - object: 'thread.message'; - created_at: number; - thread_id: string; - /** - * The status of the message, which can be either `in_progress`, `incomplete`, - * or `completed`. - * @enum in_progress,incomplete,completed - */ - status: 'in_progress' | 'incomplete' | 'completed'; - incomplete_details: { - /** - * The reason the message is incomplete. - * @enum content_filter,max_tokens,run_cancelled,run_expired,run_failed - */ - reason: - | 'content_filter' - | 'max_tokens' - | 'run_cancelled' - | 'run_expired' - | 'run_failed'; - }; - completed_at: number | null; - incomplete_at: number | null; - /** - * The entity that produced the message. One of `user` or `assistant`. - * @enum user,assistant - */ - role: 'user' | 'assistant'; - readonly content: ( - | MessageContentImageFileObject - | MessageContentImageUrlObject - | MessageContentTextObject - | MessageContentRefusalObject - | null - )[]; - assistant_id: string; - run_id: string; - readonly attachments: { - file_id?: string; - readonly tools?: ( - | AssistantToolsCode - | AssistantToolsFileSearchTypeOnly - | null - )[]; - }[]; - metadata: JsonifiableObject; + id: string; + /** + * The object type, which is always `thread.message`. + * @enum thread.message + */ + object: "thread.message"; + created_at: number; + thread_id: string; + /** + * The status of the message, which can be either `in_progress`, `incomplete`, + * or `completed`. + * @enum in_progress,incomplete,completed + */ + status: "in_progress" | "incomplete" | "completed"; + incomplete_details: { + /** + * The reason the message is incomplete. + * @enum content_filter,max_tokens,run_cancelled,run_expired,run_failed + */ + reason: + | "content_filter" + | "max_tokens" + | "run_cancelled" + | "run_expired" + | "run_failed"; + }; + completed_at: number | null; + incomplete_at: number | null; + /** + * The entity that produced the message. One of `user` or `assistant`. + * @enum user,assistant + */ + role: "user" | "assistant"; + content: readonly ( + | MessageContentImageFileObject + | MessageContentImageUrlObject + | MessageContentTextObject + | MessageContentRefusalObject + )[]; + assistant_id: string; + run_id: string; + attachments: readonly { + file_id?: string; + tools?: readonly (AssistantToolsCode | AssistantToolsFileSearchTypeOnly)[]; + }[]; + metadata: Record; }; export type MessageStreamEvent = - | { - event: 'thread.message.created'; - data: MessageObject; - } - | { - event: 'thread.message.in_progress'; - data: MessageObject; - } - | { - event: 'thread.message.delta'; - data: MessageDeltaObject; - } - | { - event: 'thread.message.completed'; - data: MessageObject; - } - | { - event: 'thread.message.incomplete'; - data: MessageObject; - }; + | { + event: "thread.message.created"; + /** Represents a message within a [thread](/docs/api-reference/threads). */ + data: MessageObject; + } + | { + event: "thread.message.in_progress"; + /** Represents a message within a [thread](/docs/api-reference/threads). */ + data: MessageObject; + } + | { + event: "thread.message.delta"; + /** + * Represents a message delta i.e. any changed fields on a message during + * streaming. + */ + data: MessageDeltaObject; + } + | { + event: "thread.message.completed"; + /** Represents a message within a [thread](/docs/api-reference/threads). */ + data: MessageObject; + } + | { + event: "thread.message.incomplete"; + /** Represents a message within a [thread](/docs/api-reference/threads). */ + data: MessageObject; + }; /** Details of the tool call. */ export type RunStepDeltaStepDetailsToolCallsObject = { - /** - * Always `tool_calls`. - * @enum tool_calls - */ - type: 'tool_calls'; - readonly tool_calls?: ( - | RunStepDeltaStepDetailsToolCallsCodeObject - | RunStepDeltaStepDetailsToolCallsFileSearchObject - | RunStepDeltaStepDetailsToolCallsFunctionObject - | null - )[]; + /** + * Always `tool_calls`. + * @enum tool_calls + */ + type: "tool_calls"; + tool_calls?: readonly ( + | RunStepDeltaStepDetailsToolCallsCodeObject + | RunStepDeltaStepDetailsToolCallsFileSearchObject + | RunStepDeltaStepDetailsToolCallsFunctionObject + )[]; }; /** Details of the message creation by the run step. */ export type RunStepDeltaStepDetailsMessageCreationObject = { - /** - * Always `message_creation`. - * @enum message_creation - */ - type: 'message_creation'; - message_creation?: { - message_id?: string; - }; + /** + * Always `message_creation`. + * @enum message_creation + */ + type: "message_creation"; + message_creation?: { + message_id?: string; + }; }; /** * Represents a run step delta i.e. any changed fields on a run step during * streaming. */ export type RunStepDeltaObject = { - id: string; - /** - * The object type, which is always `thread.run.step.delta`. - * @enum thread.run.step.delta - */ - object: 'thread.run.step.delta'; - delta: { - step_details?: - | RunStepDeltaStepDetailsMessageCreationObject - | RunStepDeltaStepDetailsToolCallsObject - | null; - }; + id: string; + /** + * The object type, which is always `thread.run.step.delta`. + * @enum thread.run.step.delta + */ + object: "thread.run.step.delta"; + delta: { + step_details?: + | RunStepDeltaStepDetailsMessageCreationObject + | RunStepDeltaStepDetailsToolCallsObject; + }; }; /** * Usage statistics related to the run step. This value will be `null` while * the run step's status is `in_progress`. */ export type RunStepCompletionUsage = { - completion_tokens: number; - prompt_tokens: number; - total_tokens: number; + completion_tokens: number; + prompt_tokens: number; + total_tokens: number; }; /** Details of the tool call. */ export type RunStepDetailsToolCallsObject = { - /** - * Always `tool_calls`. - * @enum tool_calls - */ - type: 'tool_calls'; - readonly tool_calls: ( - | RunStepDetailsToolCallsCodeObject - | never - | RunStepDetailsToolCallsFunctionObject - | null - )[]; + /** + * Always `tool_calls`. + * @enum tool_calls + */ + type: "tool_calls"; + tool_calls: readonly ( + | RunStepDetailsToolCallsCodeObject + | never + | RunStepDetailsToolCallsFunctionObject + )[]; }; /** Details of the message creation by the run step. */ export type RunStepDetailsMessageCreationObject = { - /** - * Always `message_creation`. - * @enum message_creation - */ - type: 'message_creation'; - message_creation: { - message_id: string; - }; + /** + * Always `message_creation`. + * @enum message_creation + */ + type: "message_creation"; + message_creation: { + message_id: string; + }; }; /** Represents a step in execution of a run. */ export type RunStepObject = { - id: string; - /** - * The object type, which is always `thread.run.step`. - * @enum thread.run.step - */ - object: 'thread.run.step'; - created_at: number; - assistant_id: string; - thread_id: string; - run_id: string; - /** - * The type of run step, which can be either `message_creation` or - * `tool_calls`. - * @enum message_creation,tool_calls - */ - type: 'message_creation' | 'tool_calls'; - /** - * The status of the run step, which can be either `in_progress`, `cancelled`, - * `failed`, `completed`, or `expired`. - * @enum in_progress,cancelled,failed,completed,expired - */ - status: 'in_progress' | 'cancelled' | 'failed' | 'completed' | 'expired'; - step_details: - | RunStepDetailsMessageCreationObject - | RunStepDetailsToolCallsObject - | null; - last_error: { - /** - * One of `server_error` or `rate_limit_exceeded`. - * @enum server_error,rate_limit_exceeded - */ - code: 'server_error' | 'rate_limit_exceeded'; - message: string; - }; - expired_at: number | null; - cancelled_at: number | null; - failed_at: number | null; - completed_at: number | null; - metadata: JsonifiableObject; - usage: RunStepCompletionUsage; + id: string; + /** + * The object type, which is always `thread.run.step`. + * @enum thread.run.step + */ + object: "thread.run.step"; + created_at: number; + assistant_id: string; + thread_id: string; + run_id: string; + /** + * The type of run step, which can be either `message_creation` or + * `tool_calls`. + * @enum message_creation,tool_calls + */ + type: "message_creation" | "tool_calls"; + /** + * The status of the run step, which can be either `in_progress`, `cancelled`, + * `failed`, `completed`, or `expired`. + * @enum in_progress,cancelled,failed,completed,expired + */ + status: "in_progress" | "cancelled" | "failed" | "completed" | "expired"; + step_details: + | RunStepDetailsMessageCreationObject + | RunStepDetailsToolCallsObject; + last_error: { + /** + * One of `server_error` or `rate_limit_exceeded`. + * @enum server_error,rate_limit_exceeded + */ + code: "server_error" | "rate_limit_exceeded"; + message: string; + }; + expired_at: number | null; + cancelled_at: number | null; + failed_at: number | null; + completed_at: number | null; + metadata: Record; + /** + * Usage statistics related to the run step. This value will be `null` while + * the run step's status is `in_progress`. + */ + usage: RunStepCompletionUsage; }; export type RunStepStreamEvent = - | { - event: 'thread.run.step.created'; - data: RunStepObject; - } - | { - event: 'thread.run.step.in_progress'; - data: RunStepObject; - } - | { - event: 'thread.run.step.delta'; - data: RunStepDeltaObject; - } - | { - event: 'thread.run.step.completed'; - data: RunStepObject; - } - | { - event: 'thread.run.step.failed'; - data: RunStepObject; - } - | { - event: 'thread.run.step.cancelled'; - data: RunStepObject; - } - | { - event: 'thread.run.step.expired'; - data: RunStepObject; - }; + | { + event: "thread.run.step.created"; + /** Represents a step in execution of a run. */ + data: RunStepObject; + } + | { + event: "thread.run.step.in_progress"; + /** Represents a step in execution of a run. */ + data: RunStepObject; + } + | { + event: "thread.run.step.delta"; + /** + * Represents a run step delta i.e. any changed fields on a run step during + * streaming. + */ + data: RunStepDeltaObject; + } + | { + event: "thread.run.step.completed"; + /** Represents a step in execution of a run. */ + data: RunStepObject; + } + | { + event: "thread.run.step.failed"; + /** Represents a step in execution of a run. */ + data: RunStepObject; + } + | { + event: "thread.run.step.cancelled"; + /** Represents a step in execution of a run. */ + data: RunStepObject; + } + | { + event: "thread.run.step.expired"; + /** Represents a step in execution of a run. */ + data: RunStepObject; + }; /** The schema for the response format, described as a JSON Schema object. */ -export type ResponseFormatJsonSchemaSchema = JsonifiableObject; +export type ResponseFormatJsonSchemaSchema = Record< + string | number, + Jsonifiable +>; export type ResponseFormatJsonSchema = { - /** - * The type of response format being defined: `json_schema` - * @enum json_schema - */ - type: 'json_schema'; - json_schema: { - description?: string; - name: string; - schema?: ResponseFormatJsonSchemaSchema; - strict?: boolean | null; - }; + /** + * The type of response format being defined: `json_schema` + * @enum json_schema + */ + type: "json_schema"; + json_schema: { + description?: string; + name: string; + /** The schema for the response format, described as a JSON Schema object. */ + schema?: ResponseFormatJsonSchemaSchema; + strict?: boolean | null; + }; }; export type ResponseFormatJsonObject = { - /** - * The type of response format being defined: `json_object` - * @enum json_object - */ - type: 'json_object'; + /** + * The type of response format being defined: `json_object` + * @enum json_object + */ + type: "json_object"; }; export type ResponseFormatText = { - /** - * The type of response format being defined: `text` - * @enum text - */ - type: 'text'; + /** + * The type of response format being defined: `text` + * @enum text + */ + type: "text"; }; /** * Specifies the format that the model must output. Compatible with @@ -1861,10 +1853,10 @@ export type ResponseFormatText = { * `max_tokens` or the conversation exceeded the max context length. */ export type AssistantsApiResponseFormatOption = - | ResponseFormatText - | ResponseFormatJsonObject - | ResponseFormatJsonSchema - | 'auto'; + | ResponseFormatText + | ResponseFormatJsonObject + | ResponseFormatJsonSchema + | "auto"; /** * Whether to enable [parallel function * calling](/docs/guides/function-calling/parallel-function-calling) during @@ -1876,14 +1868,14 @@ export type ParallelToolCalls = boolean; * specific tool. */ export type AssistantsNamedToolChoice = { - /** - * The type of the tool. If type is `function`, the function name must be set - * @enum function,code_interpreter,file_search - */ - type: 'function' | 'code_interpreter' | 'file_search'; - function?: { - name: string; - }; + /** + * The type of the tool. If type is `function`, the function name must be set + * @enum function,code_interpreter,file_search + */ + type: "function" | "code_interpreter" | "file_search"; + function?: { + name: string; + }; }; /** * Controls which (if any) tool is called by the model. @@ -1898,195 +1890,253 @@ export type AssistantsNamedToolChoice = { * that tool. */ export type AssistantsApiToolChoiceOption = - | AssistantsNamedToolChoice - | 'none' - | 'auto' - | 'required'; + | AssistantsNamedToolChoice + | "none" + | "auto" + | "required"; /** * Controls for how a thread will be truncated prior to the run. Use this to * control the intial context window of the run. */ export type TruncationObject = { - /** - * The truncation strategy to use for the thread. The default is `auto`. If - * set to `last_messages`, the thread will be truncated to the n most recent - * messages in the thread. When set to `auto`, messages in the middle of the - * thread will be dropped to fit the context length of the model, - * `max_prompt_tokens`. - * @enum auto,last_messages - */ - type: 'auto' | 'last_messages'; - last_messages?: number | null; + /** + * The truncation strategy to use for the thread. The default is `auto`. If + * set to `last_messages`, the thread will be truncated to the n most recent + * messages in the thread. When set to `auto`, messages in the middle of the + * thread will be dropped to fit the context length of the model, + * `max_prompt_tokens`. + * @enum auto,last_messages + */ + type: "auto" | "last_messages"; + last_messages?: number | null; }; /** * Usage statistics related to the run. This value will be `null` if the run * is not in a terminal state (i.e. `in_progress`, `queued`, etc.). */ export type RunCompletionUsage = { - completion_tokens: number; - prompt_tokens: number; - total_tokens: number; + completion_tokens: number; + prompt_tokens: number; + total_tokens: number; }; /** Tool call objects */ export type RunToolCallObject = { - id: string; - /** - * The type of tool call the output is required for. For now, this is always - * `function`. - * @enum function - */ - type: 'function'; - function: { - name: string; - arguments: string; - }; + id: string; + /** + * The type of tool call the output is required for. For now, this is always + * `function`. + * @enum function + */ + type: "function"; + function: { + name: string; + arguments: string; + }; }; /** Represents an execution run on a [thread](/docs/api-reference/threads). */ export type RunObject = { - id: string; - /** - * The object type, which is always `thread.run`. - * @enum thread.run - */ - object: 'thread.run'; - created_at: number; - thread_id: string; - assistant_id: string; - /** - * The status of the run, which can be either `queued`, `in_progress`, - * `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, - * `incomplete`, or `expired`. - * @enum queued,in_progress,requires_action,cancelling,cancelled,failed,completed,incomplete,expired - */ - status: - | 'queued' - | 'in_progress' - | 'requires_action' - | 'cancelling' - | 'cancelled' - | 'failed' - | 'completed' - | 'incomplete' - | 'expired'; - required_action: { - /** - * For now, this is always `submit_tool_outputs`. - * @enum submit_tool_outputs - */ - type: 'submit_tool_outputs'; - submit_tool_outputs: { - readonly tool_calls: RunToolCallObject[]; - }; - }; - last_error: { - /** - * One of `server_error`, `rate_limit_exceeded`, or `invalid_prompt`. - * @enum server_error,rate_limit_exceeded,invalid_prompt - */ - code: 'server_error' | 'rate_limit_exceeded' | 'invalid_prompt'; - message: string; - }; - expires_at: number | null; - started_at: number | null; - cancelled_at: number | null; - failed_at: number | null; - completed_at: number | null; - incomplete_details: { - /** - * The reason why the run is incomplete. This will point to which specific - * token limit was reached over the course of the run. - * @enum max_completion_tokens,max_prompt_tokens - */ - reason?: 'max_completion_tokens' | 'max_prompt_tokens'; - }; - model: string; - instructions: string; - /** - * The list of tools that the [assistant](/docs/api-reference/assistants) used - * for this run. - * @default - */ - readonly tools: (AssistantToolsCode | never | never | null)[]; - metadata: JsonifiableObject; - usage: RunCompletionUsage; - temperature?: number | null; - top_p?: number | null; - max_prompt_tokens: number | null; - max_completion_tokens: number | null; - truncation_strategy: TruncationObject; - tool_choice: AssistantsApiToolChoiceOption; - parallel_tool_calls: ParallelToolCalls; - response_format: AssistantsApiResponseFormatOption; + id: string; + /** + * The object type, which is always `thread.run`. + * @enum thread.run + */ + object: "thread.run"; + created_at: number; + thread_id: string; + assistant_id: string; + /** + * The status of the run, which can be either `queued`, `in_progress`, + * `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, + * `incomplete`, or `expired`. + * @enum queued,in_progress,requires_action,cancelling,cancelled,failed,completed,incomplete,expired + */ + status: + | "queued" + | "in_progress" + | "requires_action" + | "cancelling" + | "cancelled" + | "failed" + | "completed" + | "incomplete" + | "expired"; + required_action: { + /** + * For now, this is always `submit_tool_outputs`. + * @enum submit_tool_outputs + */ + type: "submit_tool_outputs"; + submit_tool_outputs: { + tool_calls: readonly RunToolCallObject[]; + }; + }; + last_error: { + /** + * One of `server_error`, `rate_limit_exceeded`, or `invalid_prompt`. + * @enum server_error,rate_limit_exceeded,invalid_prompt + */ + code: "server_error" | "rate_limit_exceeded" | "invalid_prompt"; + message: string; + }; + expires_at: number | null; + started_at: number | null; + cancelled_at: number | null; + failed_at: number | null; + completed_at: number | null; + incomplete_details: { + /** + * The reason why the run is incomplete. This will point to which specific + * token limit was reached over the course of the run. + * @enum max_completion_tokens,max_prompt_tokens + */ + reason?: "max_completion_tokens" | "max_prompt_tokens"; + }; + model: string; + instructions: string; + /** + * The list of tools that the [assistant](/docs/api-reference/assistants) used + * for this run. + * @default + */ + tools: readonly (AssistantToolsCode | never | never)[]; + metadata: Record; + /** + * Usage statistics related to the run. This value will be `null` if the run + * is not in a terminal state (i.e. `in_progress`, `queued`, etc.). + */ + usage: RunCompletionUsage; + temperature?: number | null; + top_p?: number | null; + max_prompt_tokens: number | null; + max_completion_tokens: number | null; + /** + * Controls for how a thread will be truncated prior to the run. Use this to + * control the intial context window of the run. + */ + truncation_strategy: TruncationObject; + /** + * Controls which (if any) tool is called by the model. + * `none` means the model will not call any tools and instead generates a + * message. + * `auto` is the default value and means the model can pick between generating + * a message or calling one or more tools. + * `required` means the model must call one or more tools before responding to + * the user. + * Specifying a particular tool like `{"type": "file_search"}` or `{"type": + * "function", "function": {"name": "my_function"}}` forces the model to call + * that tool. + */ + tool_choice: AssistantsApiToolChoiceOption; + /** + * Whether to enable [parallel function + * calling](/docs/guides/function-calling/parallel-function-calling) during + * tool use. + */ + parallel_tool_calls: ParallelToolCalls; + /** + * Specifies the format that the model must output. Compatible with + * [GPT-4o](/docs/models/gpt-4o), [GPT-4 + * Turbo](/docs/models/gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models + * since `gpt-3.5-turbo-1106`. + * + * Setting to `{ "type": "json_schema", "json_schema": {...} }` enables + * Structured Outputs which ensures the model will match your supplied JSON + * schema. Learn more in the [Structured Outputs + * guide](/docs/guides/structured-outputs). + * + * Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the + * message the model generates is valid JSON. + * + * **Important:** when using JSON mode, you **must** also instruct the model + * to produce JSON yourself via a system or user message. Without this, the + * model may generate an unending stream of whitespace until the generation + * reaches the token limit, resulting in a long-running and seemingly "stuck" + * request. Also note that the message content may be partially cut off if + * `finish_reason="length"`, which indicates the generation exceeded + * `max_tokens` or the conversation exceeded the max context length. + */ + response_format: AssistantsApiResponseFormatOption; }; export type RunStreamEvent = - | { - event: 'thread.run.created'; - data: RunObject; - } - | { - event: 'thread.run.queued'; - data: RunObject; - } - | { - event: 'thread.run.in_progress'; - data: RunObject; - } - | { - event: 'thread.run.requires_action'; - data: RunObject; - } - | { - event: 'thread.run.completed'; - data: RunObject; - } - | { - event: 'thread.run.incomplete'; - data: RunObject; - } - | { - event: 'thread.run.failed'; - data: RunObject; - } - | { - event: 'thread.run.cancelling'; - data: RunObject; - } - | { - event: 'thread.run.cancelled'; - data: RunObject; - } - | { - event: 'thread.run.expired'; - data: RunObject; - }; + | { + event: "thread.run.created"; + /** Represents an execution run on a [thread](/docs/api-reference/threads). */ + data: RunObject; + } + | { + event: "thread.run.queued"; + /** Represents an execution run on a [thread](/docs/api-reference/threads). */ + data: RunObject; + } + | { + event: "thread.run.in_progress"; + /** Represents an execution run on a [thread](/docs/api-reference/threads). */ + data: RunObject; + } + | { + event: "thread.run.requires_action"; + /** Represents an execution run on a [thread](/docs/api-reference/threads). */ + data: RunObject; + } + | { + event: "thread.run.completed"; + /** Represents an execution run on a [thread](/docs/api-reference/threads). */ + data: RunObject; + } + | { + event: "thread.run.incomplete"; + /** Represents an execution run on a [thread](/docs/api-reference/threads). */ + data: RunObject; + } + | { + event: "thread.run.failed"; + /** Represents an execution run on a [thread](/docs/api-reference/threads). */ + data: RunObject; + } + | { + event: "thread.run.cancelling"; + /** Represents an execution run on a [thread](/docs/api-reference/threads). */ + data: RunObject; + } + | { + event: "thread.run.cancelled"; + /** Represents an execution run on a [thread](/docs/api-reference/threads). */ + data: RunObject; + } + | { + event: "thread.run.expired"; + /** Represents an execution run on a [thread](/docs/api-reference/threads). */ + data: RunObject; + }; /** Represents a thread that contains [messages](/docs/api-reference/messages). */ export type ThreadObject = { - id: string; - /** - * The object type, which is always `thread`. - * @enum thread - */ - object: 'thread'; - created_at: number; - tool_resources: { - code_interpreter?: { - /** - * A list of [file](/docs/api-reference/files) IDs made available to the - * `code_interpreter` tool. There can be a maximum of 20 files associated with - * the tool. - * @default - */ - readonly file_ids?: string[]; - }; - file_search?: { - readonly vector_store_ids?: string[]; - }; - }; - metadata: JsonifiableObject; + id: string; + /** + * The object type, which is always `thread`. + * @enum thread + */ + object: "thread"; + created_at: number; + tool_resources: { + code_interpreter?: { + /** + * A list of [file](/docs/api-reference/files) IDs made available to the + * `code_interpreter` tool. There can be a maximum of 20 files associated with + * the tool. + * @default + */ + file_ids?: readonly string[]; + }; + file_search?: { + vector_store_ids?: readonly string[]; + }; + }; + metadata: Record; }; export type ThreadStreamEvent = { - event: 'thread.created'; - data: ThreadObject; + event: "thread.created"; + /** Represents a thread that contains [messages](/docs/api-reference/messages). */ + data: ThreadObject; }; /** * Represents an event emitted when streaming a Run. @@ -2118,45 +2168,49 @@ export type ThreadStreamEvent = { * integrate the Assistants API with streaming. */ export type AssistantStreamEvent = - | ThreadStreamEvent - | RunStreamEvent - | RunStepStreamEvent - | MessageStreamEvent - | ErrorEvent - | DoneEvent; + | ThreadStreamEvent + | RunStreamEvent + | RunStepStreamEvent + | MessageStreamEvent + | ErrorEvent + | DoneEvent; export type StaticChunkingStrategy = { - max_chunk_size_tokens: number; - chunk_overlap_tokens: number; + max_chunk_size_tokens: number; + chunk_overlap_tokens: number; }; export type StaticChunkingStrategyRequestParam = { - /** - * Always `static`. - * @enum static - */ - type: 'static'; - static: StaticChunkingStrategy; + /** + * Always `static`. + * @enum static + */ + type: "static"; + static: StaticChunkingStrategy; }; /** * The default strategy. This strategy currently uses a * `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`. */ export type AutoChunkingStrategyRequestParam = { - /** - * Always `auto`. - * @enum auto - */ - type: 'auto'; + /** + * Always `auto`. + * @enum auto + */ + type: "auto"; }; /** * The chunking strategy used to chunk the file(s). If not set, will use the * `auto` strategy. */ export type ChunkingStrategyRequestParam = - | AutoChunkingStrategyRequestParam - | StaticChunkingStrategyRequestParam; + | AutoChunkingStrategyRequestParam + | StaticChunkingStrategyRequestParam; export type CreateVectorStoreFileBatchRequest = { - readonly file_ids: string[]; - chunking_strategy?: ChunkingStrategyRequestParam; + file_ids: readonly string[]; + /** + * The chunking strategy used to chunk the file(s). If not set, will use the + * `auto` strategy. + */ + chunking_strategy?: ChunkingStrategyRequestParam; }; /** * This is returned when the chunking strategy is unknown. Typically, this is @@ -2164,385 +2218,471 @@ export type CreateVectorStoreFileBatchRequest = { * introduced in the API. */ export type OtherChunkingStrategyResponseParam = { - /** - * Always `other`. - * @enum other - */ - type: 'other'; + /** + * Always `other`. + * @enum other + */ + type: "other"; }; export type StaticChunkingStrategyResponseParam = { - /** - * Always `static`. - * @enum static - */ - type: 'static'; - static: StaticChunkingStrategy; + /** + * Always `static`. + * @enum static + */ + type: "static"; + static: StaticChunkingStrategy; }; /** A list of files attached to a vector store. */ export type VectorStoreFileObject = { - id: string; - /** - * The object type, which is always `vector_store.file`. - * @enum vector_store.file - */ - object: 'vector_store.file'; - usage_bytes: number; - created_at: number; - vector_store_id: string; - /** - * The status of the vector store file, which can be either `in_progress`, - * `completed`, `cancelled`, or `failed`. The status `completed` indicates - * that the vector store file is ready for use. - * @enum in_progress,completed,cancelled,failed - */ - status: 'in_progress' | 'completed' | 'cancelled' | 'failed'; - last_error: { - /** - * One of `server_error` or `rate_limit_exceeded`. - * @enum server_error,unsupported_file,invalid_file - */ - code: 'server_error' | 'unsupported_file' | 'invalid_file'; - message: string; - }; - chunking_strategy?: - | StaticChunkingStrategyResponseParam - | OtherChunkingStrategyResponseParam - | null; + id: string; + /** + * The object type, which is always `vector_store.file`. + * @enum vector_store.file + */ + object: "vector_store.file"; + usage_bytes: number; + created_at: number; + vector_store_id: string; + /** + * The status of the vector store file, which can be either `in_progress`, + * `completed`, `cancelled`, or `failed`. The status `completed` indicates + * that the vector store file is ready for use. + * @enum in_progress,completed,cancelled,failed + */ + status: "in_progress" | "completed" | "cancelled" | "failed"; + last_error: { + /** + * One of `server_error` or `rate_limit_exceeded`. + * @enum server_error,unsupported_file,invalid_file + */ + code: "server_error" | "unsupported_file" | "invalid_file"; + message: string; + }; + chunking_strategy?: + | StaticChunkingStrategyResponseParam + | OtherChunkingStrategyResponseParam; }; export type ListVectorStoreFilesResponse = { - object: string; - readonly data: VectorStoreFileObject[]; - first_id: string; - last_id: string; - has_more: boolean; + object: string; + data: readonly VectorStoreFileObject[]; + first_id: string; + last_id: string; + has_more: boolean; }; export type CreateVectorStoreFileRequest = { - file_id: string; - chunking_strategy?: ChunkingStrategyRequestParam; + file_id: string; + /** + * The chunking strategy used to chunk the file(s). If not set, will use the + * `auto` strategy. + */ + chunking_strategy?: ChunkingStrategyRequestParam; }; /** The expiration policy for a vector store. */ export type VectorStoreExpirationAfter = { - /** - * Anchor timestamp after which the expiration policy applies. Supported - * anchors: `last_active_at`. - * @enum last_active_at - */ - anchor: 'last_active_at'; - days: number; + /** + * Anchor timestamp after which the expiration policy applies. Supported + * anchors: `last_active_at`. + * @enum last_active_at + */ + anchor: "last_active_at"; + days: number; }; /** * A vector store is a collection of processed files can be used by the * `file_search` tool. */ export type VectorStoreObject = { - id: string; - /** - * The object type, which is always `vector_store`. - * @enum vector_store - */ - object: 'vector_store'; - created_at: number; - name: string; - usage_bytes: number; - file_counts: { - in_progress: number; - completed: number; - failed: number; - cancelled: number; - total: number; - }; - /** - * The status of the vector store, which can be either `expired`, - * `in_progress`, or `completed`. A status of `completed` indicates that the - * vector store is ready for use. - * @enum expired,in_progress,completed - */ - status: 'expired' | 'in_progress' | 'completed'; - expires_after?: VectorStoreExpirationAfter; - expires_at?: number | null; - last_active_at: number | null; - metadata: JsonifiableObject; + id: string; + /** + * The object type, which is always `vector_store`. + * @enum vector_store + */ + object: "vector_store"; + created_at: number; + name: string; + usage_bytes: number; + file_counts: { + in_progress: number; + completed: number; + failed: number; + cancelled: number; + total: number; + }; + /** + * The status of the vector store, which can be either `expired`, + * `in_progress`, or `completed`. A status of `completed` indicates that the + * vector store is ready for use. + * @enum expired,in_progress,completed + */ + status: "expired" | "in_progress" | "completed"; + /** The expiration policy for a vector store. */ + expires_after?: VectorStoreExpirationAfter; + expires_at?: number | null; + last_active_at: number | null; + metadata: Record; }; export type ListVectorStoresResponse = { - object: string; - readonly data: VectorStoreObject[]; - first_id: string; - last_id: string; - has_more: boolean; + object: string; + data: readonly VectorStoreObject[]; + first_id: string; + last_id: string; + has_more: boolean; }; export type UpdateVectorStoreRequest = { - name?: string; - expires_after?: VectorStoreExpirationAfter; - metadata?: JsonifiableObject; + name?: string; + /** The expiration policy for a vector store. */ + expires_after?: VectorStoreExpirationAfter; + metadata?: Record; }; export type CreateVectorStoreRequest = { - readonly file_ids?: string[]; - name?: string; - expires_after?: VectorStoreExpirationAfter; - chunking_strategy?: - | AutoChunkingStrategyRequestParam - | StaticChunkingStrategyRequestParam - | null; - metadata?: JsonifiableObject; + file_ids?: readonly string[]; + name?: string; + /** The expiration policy for a vector store. */ + expires_after?: VectorStoreExpirationAfter; + chunking_strategy?: + | AutoChunkingStrategyRequestParam + | StaticChunkingStrategyRequestParam; + metadata?: Record; }; /** A result instance of the file search. */ export type RunStepDetailsToolCallsFileSearchResultObject = { - file_id: string; - file_name: string; - score: number; - readonly content?: { - /** - * The type of the content. - * @enum text - */ - type?: 'text'; - text?: string; - }[]; + file_id: string; + file_name: string; + score: number; + content?: readonly { + /** + * The type of the content. + * @enum text + */ + type?: "text"; + text?: string; + }[]; }; /** The ranking options for the file search. */ export type RunStepDetailsToolCallsFileSearchRankingOptionsObject = { - /** - * The ranker used for the file search. - * @enum default_2024_08_21 - */ - ranker: 'default_2024_08_21'; - score_threshold: number; + /** + * The ranker used for the file search. + * @enum default_2024_08_21 + */ + ranker: "default_2024_08_21"; + score_threshold: number; }; export type RunStepDetailsToolCallsFileSearchObject = { - id: string; - /** - * The type of tool call. This is always going to be `file_search` for this - * type of tool call. - * @enum file_search - */ - type: 'file_search'; - file_search: { - ranking_options?: RunStepDetailsToolCallsFileSearchRankingOptionsObject; - readonly results?: RunStepDetailsToolCallsFileSearchResultObject[]; - }; + id: string; + /** + * The type of tool call. This is always going to be `file_search` for this + * type of tool call. + * @enum file_search + */ + type: "file_search"; + file_search: { + /** The ranking options for the file search. */ + ranking_options?: RunStepDetailsToolCallsFileSearchRankingOptionsObject; + results?: readonly RunStepDetailsToolCallsFileSearchResultObject[]; + }; }; export type ListRunStepsResponse = { - object: string; - readonly data: RunStepObject[]; - first_id: string; - last_id: string; - has_more: boolean; + object: string; + data: readonly RunStepObject[]; + first_id: string; + last_id: string; + has_more: boolean; }; export type ListMessagesResponse = { - object: string; - readonly data: MessageObject[]; - first_id: string; - last_id: string; - has_more: boolean; + object: string; + data: readonly MessageObject[]; + first_id: string; + last_id: string; + has_more: boolean; }; export type ListThreadsResponse = { - object: string; - readonly data: ThreadObject[]; - first_id: string; - last_id: string; - has_more: boolean; + object: string; + data: readonly ThreadObject[]; + first_id: string; + last_id: string; + has_more: boolean; }; export type CreateMessageRequest = { - /** - * The role of the entity that is creating the message. Allowed values - * include: - * - `user`: Indicates the message is sent by an actual user and should be - * used in most cases to represent user-generated messages. - * - `assistant`: Indicates the message is generated by the assistant. Use - * this value to insert messages from the assistant into the conversation. - * @enum user,assistant - */ - role: 'user' | 'assistant'; - content: - | string - | ( - | MessageContentImageFileObject - | MessageContentImageUrlObject - | MessageRequestContentTextObject - | null - )[] - | null; - readonly attachments?: { - file_id?: string; - readonly tools?: ( - | AssistantToolsCode - | AssistantToolsFileSearchTypeOnly - | null - )[]; - }[]; - metadata?: JsonifiableObject; + /** + * The role of the entity that is creating the message. Allowed values + * include: + * - `user`: Indicates the message is sent by an actual user and should be + * used in most cases to represent user-generated messages. + * - `assistant`: Indicates the message is generated by the assistant. Use + * this value to insert messages from the assistant into the conversation. + * @enum user,assistant + */ + role: "user" | "assistant"; + content: + | string + | readonly ( + | MessageContentImageFileObject + | MessageContentImageUrlObject + | MessageRequestContentTextObject + )[]; + attachments?: readonly { + file_id?: string; + tools?: readonly (AssistantToolsCode | AssistantToolsFileSearchTypeOnly)[]; + }[]; + metadata?: Record; }; export type CreateThreadRequest = { - readonly messages?: CreateMessageRequest[]; - tool_resources?: { - code_interpreter?: { - /** - * A list of [file](/docs/api-reference/files) IDs made available to the - * `code_interpreter` tool. There can be a maximum of 20 files associated with - * the tool. - * @default - */ - readonly file_ids?: string[]; - }; - file_search?: unknown | unknown | null; - }; - metadata?: JsonifiableObject; + messages?: readonly CreateMessageRequest[]; + tool_resources?: { + code_interpreter?: { + /** + * A list of [file](/docs/api-reference/files) IDs made available to the + * `code_interpreter` tool. There can be a maximum of 20 files associated with + * the tool. + * @default + */ + file_ids?: readonly string[]; + }; + file_search?: unknown | unknown; + }; + metadata?: Record; }; export type CreateThreadAndRunRequest = { - assistant_id: string; - thread?: CreateThreadRequest; - /** - * The ID of the [Model](/docs/api-reference/models) to be used to execute - * this run. If a value is provided here, it will override the model - * associated with the assistant. If not, the model associated with the - * assistant will be used. - * @example gpt-4o - */ - model?: - | string - | 'gpt-4o' - | 'gpt-4o-2024-08-06' - | 'gpt-4o-2024-05-13' - | 'gpt-4o-2024-08-06' - | 'gpt-4o-mini' - | 'gpt-4o-mini-2024-07-18' - | 'gpt-4-turbo' - | 'gpt-4-turbo-2024-04-09' - | 'gpt-4-0125-preview' - | 'gpt-4-turbo-preview' - | 'gpt-4-1106-preview' - | 'gpt-4-vision-preview' - | 'gpt-4' - | 'gpt-4-0314' - | 'gpt-4-0613' - | 'gpt-4-32k' - | 'gpt-4-32k-0314' - | 'gpt-4-32k-0613' - | 'gpt-3.5-turbo' - | 'gpt-3.5-turbo-16k' - | 'gpt-3.5-turbo-0613' - | 'gpt-3.5-turbo-1106' - | 'gpt-3.5-turbo-0125' - | 'gpt-3.5-turbo-16k-0613' - | null; - instructions?: string; - readonly tools?: (AssistantToolsCode | never | never | null)[]; - tool_resources?: { - code_interpreter?: { - /** - * A list of [file](/docs/api-reference/files) IDs made available to the - * `code_interpreter` tool. There can be a maximum of 20 files associated with - * the tool. - * @default - */ - readonly file_ids?: string[]; - }; - file_search?: { - readonly vector_store_ids?: string[]; - }; - }; - metadata?: JsonifiableObject; - /** - * What sampling temperature to use, between 0 and 2. Higher values like 0.8 - * will make the output more random, while lower values like 0.2 will make it - * more focused and deterministic. - * @default 1 - * @example 1 - */ - temperature?: number | null; - /** - * An alternative to sampling with temperature, called nucleus sampling, where - * the model considers the results of the tokens with top_p probability mass. - * So 0.1 means only the tokens comprising the top 10% probability mass are - * considered. - * - * We generally recommend altering this or temperature but not both. - * @default 1 - * @example 1 - */ - top_p?: number | null; - stream?: boolean | null; - max_prompt_tokens?: number | null; - max_completion_tokens?: number | null; - truncation_strategy?: TruncationObject; - tool_choice?: AssistantsApiToolChoiceOption; - parallel_tool_calls?: ParallelToolCalls; - response_format?: AssistantsApiResponseFormatOption; + assistant_id: string; + thread?: CreateThreadRequest; + /** + * The ID of the [Model](/docs/api-reference/models) to be used to execute + * this run. If a value is provided here, it will override the model + * associated with the assistant. If not, the model associated with the + * assistant will be used. + * @example gpt-4o + */ + model?: + | string + | "gpt-4o" + | "gpt-4o-2024-08-06" + | "gpt-4o-2024-05-13" + | "gpt-4o-2024-08-06" + | "gpt-4o-mini" + | "gpt-4o-mini-2024-07-18" + | "gpt-4-turbo" + | "gpt-4-turbo-2024-04-09" + | "gpt-4-0125-preview" + | "gpt-4-turbo-preview" + | "gpt-4-1106-preview" + | "gpt-4-vision-preview" + | "gpt-4" + | "gpt-4-0314" + | "gpt-4-0613" + | "gpt-4-32k" + | "gpt-4-32k-0314" + | "gpt-4-32k-0613" + | "gpt-3.5-turbo" + | "gpt-3.5-turbo-16k" + | "gpt-3.5-turbo-0613" + | "gpt-3.5-turbo-1106" + | "gpt-3.5-turbo-0125" + | "gpt-3.5-turbo-16k-0613" + | null; + instructions?: string; + tools?: readonly (AssistantToolsCode | never | never)[]; + tool_resources?: { + code_interpreter?: { + /** + * A list of [file](/docs/api-reference/files) IDs made available to the + * `code_interpreter` tool. There can be a maximum of 20 files associated with + * the tool. + * @default + */ + file_ids?: readonly string[]; + }; + file_search?: { + vector_store_ids?: readonly string[]; + }; + }; + metadata?: Record; + /** + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 + * will make the output more random, while lower values like 0.2 will make it + * more focused and deterministic. + * @default 1 + * @example 1 + */ + temperature?: number | null; + /** + * An alternative to sampling with temperature, called nucleus sampling, where + * the model considers the results of the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are + * considered. + * + * We generally recommend altering this or temperature but not both. + * @default 1 + * @example 1 + */ + top_p?: number | null; + stream?: boolean | null; + max_prompt_tokens?: number | null; + max_completion_tokens?: number | null; + /** + * Controls for how a thread will be truncated prior to the run. Use this to + * control the intial context window of the run. + */ + truncation_strategy?: TruncationObject; + /** + * Controls which (if any) tool is called by the model. + * `none` means the model will not call any tools and instead generates a + * message. + * `auto` is the default value and means the model can pick between generating + * a message or calling one or more tools. + * `required` means the model must call one or more tools before responding to + * the user. + * Specifying a particular tool like `{"type": "file_search"}` or `{"type": + * "function", "function": {"name": "my_function"}}` forces the model to call + * that tool. + */ + tool_choice?: AssistantsApiToolChoiceOption; + /** + * Whether to enable [parallel function + * calling](/docs/guides/function-calling/parallel-function-calling) during + * tool use. + */ + parallel_tool_calls?: ParallelToolCalls; + /** + * Specifies the format that the model must output. Compatible with + * [GPT-4o](/docs/models/gpt-4o), [GPT-4 + * Turbo](/docs/models/gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models + * since `gpt-3.5-turbo-1106`. + * + * Setting to `{ "type": "json_schema", "json_schema": {...} }` enables + * Structured Outputs which ensures the model will match your supplied JSON + * schema. Learn more in the [Structured Outputs + * guide](/docs/guides/structured-outputs). + * + * Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the + * message the model generates is valid JSON. + * + * **Important:** when using JSON mode, you **must** also instruct the model + * to produce JSON yourself via a system or user message. Without this, the + * model may generate an unending stream of whitespace until the generation + * reaches the token limit, resulting in a long-running and seemingly "stuck" + * request. Also note that the message content may be partially cut off if + * `finish_reason="length"`, which indicates the generation exceeded + * `max_tokens` or the conversation exceeded the max context length. + */ + response_format?: AssistantsApiResponseFormatOption; }; export type ListRunsResponse = { - object: string; - readonly data: RunObject[]; - first_id: string; - last_id: string; - has_more: boolean; + object: string; + data: readonly RunObject[]; + first_id: string; + last_id: string; + has_more: boolean; }; export type CreateRunRequest = { - assistant_id: string; - /** - * The ID of the [Model](/docs/api-reference/models) to be used to execute - * this run. If a value is provided here, it will override the model - * associated with the assistant. If not, the model associated with the - * assistant will be used. - * @example gpt-4o - */ - model?: - | string - | 'gpt-4o' - | 'gpt-4o-2024-08-06' - | 'gpt-4o-2024-05-13' - | 'gpt-4o-2024-08-06' - | 'gpt-4o-mini' - | 'gpt-4o-mini-2024-07-18' - | 'gpt-4-turbo' - | 'gpt-4-turbo-2024-04-09' - | 'gpt-4-0125-preview' - | 'gpt-4-turbo-preview' - | 'gpt-4-1106-preview' - | 'gpt-4-vision-preview' - | 'gpt-4' - | 'gpt-4-0314' - | 'gpt-4-0613' - | 'gpt-4-32k' - | 'gpt-4-32k-0314' - | 'gpt-4-32k-0613' - | 'gpt-3.5-turbo' - | 'gpt-3.5-turbo-16k' - | 'gpt-3.5-turbo-0613' - | 'gpt-3.5-turbo-1106' - | 'gpt-3.5-turbo-0125' - | 'gpt-3.5-turbo-16k-0613' - | null; - instructions?: string; - additional_instructions?: string; - readonly additional_messages?: CreateMessageRequest[]; - readonly tools?: (AssistantToolsCode | never | never | null)[]; - metadata?: JsonifiableObject; - /** - * What sampling temperature to use, between 0 and 2. Higher values like 0.8 - * will make the output more random, while lower values like 0.2 will make it - * more focused and deterministic. - * @default 1 - * @example 1 - */ - temperature?: number | null; - /** - * An alternative to sampling with temperature, called nucleus sampling, where - * the model considers the results of the tokens with top_p probability mass. - * So 0.1 means only the tokens comprising the top 10% probability mass are - * considered. - * - * We generally recommend altering this or temperature but not both. - * @default 1 - * @example 1 - */ - top_p?: number | null; - stream?: boolean | null; - max_prompt_tokens?: number | null; - max_completion_tokens?: number | null; - truncation_strategy?: TruncationObject; - tool_choice?: AssistantsApiToolChoiceOption; - parallel_tool_calls?: ParallelToolCalls; - response_format?: AssistantsApiResponseFormatOption; + assistant_id: string; + /** + * The ID of the [Model](/docs/api-reference/models) to be used to execute + * this run. If a value is provided here, it will override the model + * associated with the assistant. If not, the model associated with the + * assistant will be used. + * @example gpt-4o + */ + model?: + | string + | "gpt-4o" + | "gpt-4o-2024-08-06" + | "gpt-4o-2024-05-13" + | "gpt-4o-2024-08-06" + | "gpt-4o-mini" + | "gpt-4o-mini-2024-07-18" + | "gpt-4-turbo" + | "gpt-4-turbo-2024-04-09" + | "gpt-4-0125-preview" + | "gpt-4-turbo-preview" + | "gpt-4-1106-preview" + | "gpt-4-vision-preview" + | "gpt-4" + | "gpt-4-0314" + | "gpt-4-0613" + | "gpt-4-32k" + | "gpt-4-32k-0314" + | "gpt-4-32k-0613" + | "gpt-3.5-turbo" + | "gpt-3.5-turbo-16k" + | "gpt-3.5-turbo-0613" + | "gpt-3.5-turbo-1106" + | "gpt-3.5-turbo-0125" + | "gpt-3.5-turbo-16k-0613" + | null; + instructions?: string; + additional_instructions?: string; + additional_messages?: readonly CreateMessageRequest[]; + tools?: readonly (AssistantToolsCode | never | never)[]; + metadata?: Record; + /** + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 + * will make the output more random, while lower values like 0.2 will make it + * more focused and deterministic. + * @default 1 + * @example 1 + */ + temperature?: number | null; + /** + * An alternative to sampling with temperature, called nucleus sampling, where + * the model considers the results of the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are + * considered. + * + * We generally recommend altering this or temperature but not both. + * @default 1 + * @example 1 + */ + top_p?: number | null; + stream?: boolean | null; + max_prompt_tokens?: number | null; + max_completion_tokens?: number | null; + /** + * Controls for how a thread will be truncated prior to the run. Use this to + * control the intial context window of the run. + */ + truncation_strategy?: TruncationObject; + /** + * Controls which (if any) tool is called by the model. + * `none` means the model will not call any tools and instead generates a + * message. + * `auto` is the default value and means the model can pick between generating + * a message or calling one or more tools. + * `required` means the model must call one or more tools before responding to + * the user. + * Specifying a particular tool like `{"type": "file_search"}` or `{"type": + * "function", "function": {"name": "my_function"}}` forces the model to call + * that tool. + */ + tool_choice?: AssistantsApiToolChoiceOption; + /** + * Whether to enable [parallel function + * calling](/docs/guides/function-calling/parallel-function-calling) during + * tool use. + */ + parallel_tool_calls?: ParallelToolCalls; + /** + * Specifies the format that the model must output. Compatible with + * [GPT-4o](/docs/models/gpt-4o), [GPT-4 + * Turbo](/docs/models/gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models + * since `gpt-3.5-turbo-1106`. + * + * Setting to `{ "type": "json_schema", "json_schema": {...} }` enables + * Structured Outputs which ensures the model will match your supplied JSON + * schema. Learn more in the [Structured Outputs + * guide](/docs/guides/structured-outputs). + * + * Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the + * message the model generates is valid JSON. + * + * **Important:** when using JSON mode, you **must** also instruct the model + * to produce JSON yourself via a system or user message. Without this, the + * model may generate an unending stream of whitespace until the generation + * reaches the token limit, resulting in a long-running and seemingly "stuck" + * request. Also note that the message content may be partially cut off if + * `finish_reason="length"`, which indicates the generation exceeded + * `max_tokens` or the conversation exceeded the max context length. + */ + response_format?: AssistantsApiResponseFormatOption; }; /** * The parameters the functions accepts, described as a JSON Schema object. @@ -2552,20 +2692,28 @@ export type CreateRunRequest = { * * Omitting `parameters` defines a function with an empty parameter list. */ -export type FunctionParameters = JsonifiableObject; +export type FunctionParameters = Record; export type FunctionObject = { - description?: string; - name: string; - parameters?: FunctionParameters; - strict?: boolean | null; + description?: string; + name: string; + /** + * The parameters the functions accepts, described as a JSON Schema object. + * See the [guide](/docs/guides/function-calling) for examples, and the [JSON + * Schema reference](https://json-schema.org/understanding-json-schema/) for + * documentation about the format. + * + * Omitting `parameters` defines a function with an empty parameter list. + */ + parameters?: FunctionParameters; + strict?: boolean | null; }; export type AssistantToolsFunction = { - /** - * The type of tool being defined: `function` - * @enum function - */ - type: 'function'; - function: FunctionObject; + /** + * The type of tool being defined: `function` + * @enum function + */ + type: "function"; + function: FunctionObject; }; /** * The ranking options for the file search. If not specified, the file search @@ -2576,648 +2724,732 @@ export type AssistantToolsFunction = { * for more information. */ export type FileSearchRankingOptions = { - /** - * The ranker to use for the file search. If not specified will use the `auto` - * ranker. - * @enum auto,default_2024_08_21 - */ - ranker?: 'auto' | 'default_2024_08_21'; - score_threshold: number; + /** + * The ranker to use for the file search. If not specified will use the `auto` + * ranker. + * @enum auto,default_2024_08_21 + */ + ranker?: "auto" | "default_2024_08_21"; + score_threshold: number; }; export type AssistantToolsFileSearch = { - /** - * The type of tool being defined: `file_search` - * @enum file_search - */ - type: 'file_search'; - file_search?: { - max_num_results?: number; - ranking_options?: FileSearchRankingOptions; - }; + /** + * The type of tool being defined: `file_search` + * @enum file_search + */ + type: "file_search"; + file_search?: { + max_num_results?: number; + /** + * The ranking options for the file search. If not specified, the file search + * tool will use the `auto` ranker and a score_threshold of 0. + * + * See the [file search tool + * documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) + * for more information. + */ + ranking_options?: FileSearchRankingOptions; + }; }; /** Represents an `assistant` that can call the model and use tools. */ export type AssistantObject = { - id: string; - /** - * The object type, which is always `assistant`. - * @enum assistant - */ - object: 'assistant'; - created_at: number; - name: string; - description: string; - model: string; - instructions: string; - /** - * A list of tool enabled on the assistant. There can be a maximum of 128 - * tools per assistant. Tools can be of types `code_interpreter`, - * `file_search`, or `function`. - * @default - */ - readonly tools: ( - | AssistantToolsCode - | AssistantToolsFileSearch - | AssistantToolsFunction - | null - )[]; - tool_resources?: { - code_interpreter?: { - /** - * A list of [file](/docs/api-reference/files) IDs made available to the - * `code_interpreter`` tool. There can be a maximum of 20 files associated - * with the tool. - * @default - */ - readonly file_ids?: string[]; - }; - file_search?: { - readonly vector_store_ids?: string[]; - }; - }; - metadata: JsonifiableObject; - /** - * What sampling temperature to use, between 0 and 2. Higher values like 0.8 - * will make the output more random, while lower values like 0.2 will make it - * more focused and deterministic. - * @default 1 - * @example 1 - */ - temperature?: number | null; - /** - * An alternative to sampling with temperature, called nucleus sampling, where - * the model considers the results of the tokens with top_p probability mass. - * So 0.1 means only the tokens comprising the top 10% probability mass are - * considered. - * - * We generally recommend altering this or temperature but not both. - * @default 1 - * @example 1 - */ - top_p?: number | null; - response_format?: AssistantsApiResponseFormatOption; + id: string; + /** + * The object type, which is always `assistant`. + * @enum assistant + */ + object: "assistant"; + created_at: number; + name: string; + description: string; + model: string; + instructions: string; + /** + * A list of tool enabled on the assistant. There can be a maximum of 128 + * tools per assistant. Tools can be of types `code_interpreter`, + * `file_search`, or `function`. + * @default + */ + tools: readonly ( + | AssistantToolsCode + | AssistantToolsFileSearch + | AssistantToolsFunction + )[]; + tool_resources?: { + code_interpreter?: { + /** + * A list of [file](/docs/api-reference/files) IDs made available to the + * `code_interpreter`` tool. There can be a maximum of 20 files associated + * with the tool. + * @default + */ + file_ids?: readonly string[]; + }; + file_search?: { + vector_store_ids?: readonly string[]; + }; + }; + metadata: Record; + /** + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 + * will make the output more random, while lower values like 0.2 will make it + * more focused and deterministic. + * @default 1 + * @example 1 + */ + temperature?: number | null; + /** + * An alternative to sampling with temperature, called nucleus sampling, where + * the model considers the results of the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are + * considered. + * + * We generally recommend altering this or temperature but not both. + * @default 1 + * @example 1 + */ + top_p?: number | null; + /** + * Specifies the format that the model must output. Compatible with + * [GPT-4o](/docs/models/gpt-4o), [GPT-4 + * Turbo](/docs/models/gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models + * since `gpt-3.5-turbo-1106`. + * + * Setting to `{ "type": "json_schema", "json_schema": {...} }` enables + * Structured Outputs which ensures the model will match your supplied JSON + * schema. Learn more in the [Structured Outputs + * guide](/docs/guides/structured-outputs). + * + * Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the + * message the model generates is valid JSON. + * + * **Important:** when using JSON mode, you **must** also instruct the model + * to produce JSON yourself via a system or user message. Without this, the + * model may generate an unending stream of whitespace until the generation + * reaches the token limit, resulting in a long-running and seemingly "stuck" + * request. Also note that the message content may be partially cut off if + * `finish_reason="length"`, which indicates the generation exceeded + * `max_tokens` or the conversation exceeded the max context length. + */ + response_format?: AssistantsApiResponseFormatOption; }; export type ListAssistantsResponse = { - object: string; - readonly data: AssistantObject[]; - first_id: string; - last_id: string; - has_more: boolean; + object: string; + data: readonly AssistantObject[]; + first_id: string; + last_id: string; + has_more: boolean; }; export type ModifyAssistantRequest = { - model?: string; - name?: string; - description?: string; - instructions?: string; - /** - * A list of tool enabled on the assistant. There can be a maximum of 128 - * tools per assistant. Tools can be of types `code_interpreter`, - * `file_search`, or `function`. - * @default - */ - readonly tools?: ( - | AssistantToolsCode - | AssistantToolsFileSearch - | AssistantToolsFunction - | null - )[]; - tool_resources?: { - code_interpreter?: { - /** - * Overrides the list of [file](/docs/api-reference/files) IDs made available - * to the `code_interpreter` tool. There can be a maximum of 20 files - * associated with the tool. - * @default - */ - readonly file_ids?: string[]; - }; - file_search?: { - readonly vector_store_ids?: string[]; - }; - }; - metadata?: JsonifiableObject; - /** - * What sampling temperature to use, between 0 and 2. Higher values like 0.8 - * will make the output more random, while lower values like 0.2 will make it - * more focused and deterministic. - * @default 1 - * @example 1 - */ - temperature?: number | null; - /** - * An alternative to sampling with temperature, called nucleus sampling, where - * the model considers the results of the tokens with top_p probability mass. - * So 0.1 means only the tokens comprising the top 10% probability mass are - * considered. - * - * We generally recommend altering this or temperature but not both. - * @default 1 - * @example 1 - */ - top_p?: number | null; - response_format?: AssistantsApiResponseFormatOption; + model?: string; + name?: string; + description?: string; + instructions?: string; + /** + * A list of tool enabled on the assistant. There can be a maximum of 128 + * tools per assistant. Tools can be of types `code_interpreter`, + * `file_search`, or `function`. + * @default + */ + tools?: readonly ( + | AssistantToolsCode + | AssistantToolsFileSearch + | AssistantToolsFunction + )[]; + tool_resources?: { + code_interpreter?: { + /** + * Overrides the list of [file](/docs/api-reference/files) IDs made available + * to the `code_interpreter` tool. There can be a maximum of 20 files + * associated with the tool. + * @default + */ + file_ids?: readonly string[]; + }; + file_search?: { + vector_store_ids?: readonly string[]; + }; + }; + metadata?: Record; + /** + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 + * will make the output more random, while lower values like 0.2 will make it + * more focused and deterministic. + * @default 1 + * @example 1 + */ + temperature?: number | null; + /** + * An alternative to sampling with temperature, called nucleus sampling, where + * the model considers the results of the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are + * considered. + * + * We generally recommend altering this or temperature but not both. + * @default 1 + * @example 1 + */ + top_p?: number | null; + /** + * Specifies the format that the model must output. Compatible with + * [GPT-4o](/docs/models/gpt-4o), [GPT-4 + * Turbo](/docs/models/gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models + * since `gpt-3.5-turbo-1106`. + * + * Setting to `{ "type": "json_schema", "json_schema": {...} }` enables + * Structured Outputs which ensures the model will match your supplied JSON + * schema. Learn more in the [Structured Outputs + * guide](/docs/guides/structured-outputs). + * + * Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the + * message the model generates is valid JSON. + * + * **Important:** when using JSON mode, you **must** also instruct the model + * to produce JSON yourself via a system or user message. Without this, the + * model may generate an unending stream of whitespace until the generation + * reaches the token limit, resulting in a long-running and seemingly "stuck" + * request. Also note that the message content may be partially cut off if + * `finish_reason="length"`, which indicates the generation exceeded + * `max_tokens` or the conversation exceeded the max context length. + */ + response_format?: AssistantsApiResponseFormatOption; }; export type CreateAssistantRequest = { - /** - * ID of the model to use. You can use the [List - * models](/docs/api-reference/models/list) API to see all of your available - * models, or see our [Model overview](/docs/models/overview) for descriptions - * of them. - * @example gpt-4o - */ - model: - | string - | 'gpt-4o' - | 'gpt-4o-2024-08-06' - | 'gpt-4o-2024-05-13' - | 'gpt-4o-2024-08-06' - | 'gpt-4o-mini' - | 'gpt-4o-mini-2024-07-18' - | 'gpt-4-turbo' - | 'gpt-4-turbo-2024-04-09' - | 'gpt-4-0125-preview' - | 'gpt-4-turbo-preview' - | 'gpt-4-1106-preview' - | 'gpt-4-vision-preview' - | 'gpt-4' - | 'gpt-4-0314' - | 'gpt-4-0613' - | 'gpt-4-32k' - | 'gpt-4-32k-0314' - | 'gpt-4-32k-0613' - | 'gpt-3.5-turbo' - | 'gpt-3.5-turbo-16k' - | 'gpt-3.5-turbo-0613' - | 'gpt-3.5-turbo-1106' - | 'gpt-3.5-turbo-0125' - | 'gpt-3.5-turbo-16k-0613' - | null; - name?: string; - description?: string; - instructions?: string; - /** - * A list of tool enabled on the assistant. There can be a maximum of 128 - * tools per assistant. Tools can be of types `code_interpreter`, - * `file_search`, or `function`. - * @default - */ - readonly tools?: ( - | AssistantToolsCode - | AssistantToolsFileSearch - | AssistantToolsFunction - | null - )[]; - tool_resources?: { - code_interpreter?: { - /** - * A list of [file](/docs/api-reference/files) IDs made available to the - * `code_interpreter` tool. There can be a maximum of 20 files associated with - * the tool. - * @default - */ - readonly file_ids?: string[]; - }; - file_search?: unknown | unknown | null; - }; - metadata?: JsonifiableObject; - /** - * What sampling temperature to use, between 0 and 2. Higher values like 0.8 - * will make the output more random, while lower values like 0.2 will make it - * more focused and deterministic. - * @default 1 - * @example 1 - */ - temperature?: number | null; - /** - * An alternative to sampling with temperature, called nucleus sampling, where - * the model considers the results of the tokens with top_p probability mass. - * So 0.1 means only the tokens comprising the top 10% probability mass are - * considered. - * - * We generally recommend altering this or temperature but not both. - * @default 1 - * @example 1 - */ - top_p?: number | null; - response_format?: AssistantsApiResponseFormatOption; + /** + * ID of the model to use. You can use the [List + * models](/docs/api-reference/models/list) API to see all of your available + * models, or see our [Model overview](/docs/models/overview) for descriptions + * of them. + * @example gpt-4o + */ + model: + | string + | "gpt-4o" + | "gpt-4o-2024-08-06" + | "gpt-4o-2024-05-13" + | "gpt-4o-2024-08-06" + | "gpt-4o-mini" + | "gpt-4o-mini-2024-07-18" + | "gpt-4-turbo" + | "gpt-4-turbo-2024-04-09" + | "gpt-4-0125-preview" + | "gpt-4-turbo-preview" + | "gpt-4-1106-preview" + | "gpt-4-vision-preview" + | "gpt-4" + | "gpt-4-0314" + | "gpt-4-0613" + | "gpt-4-32k" + | "gpt-4-32k-0314" + | "gpt-4-32k-0613" + | "gpt-3.5-turbo" + | "gpt-3.5-turbo-16k" + | "gpt-3.5-turbo-0613" + | "gpt-3.5-turbo-1106" + | "gpt-3.5-turbo-0125" + | "gpt-3.5-turbo-16k-0613"; + name?: string; + description?: string; + instructions?: string; + /** + * A list of tool enabled on the assistant. There can be a maximum of 128 + * tools per assistant. Tools can be of types `code_interpreter`, + * `file_search`, or `function`. + * @default + */ + tools?: readonly ( + | AssistantToolsCode + | AssistantToolsFileSearch + | AssistantToolsFunction + )[]; + tool_resources?: { + code_interpreter?: { + /** + * A list of [file](/docs/api-reference/files) IDs made available to the + * `code_interpreter` tool. There can be a maximum of 20 files associated with + * the tool. + * @default + */ + file_ids?: readonly string[]; + }; + file_search?: unknown | unknown; + }; + metadata?: Record; + /** + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 + * will make the output more random, while lower values like 0.2 will make it + * more focused and deterministic. + * @default 1 + * @example 1 + */ + temperature?: number | null; + /** + * An alternative to sampling with temperature, called nucleus sampling, where + * the model considers the results of the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are + * considered. + * + * We generally recommend altering this or temperature but not both. + * @default 1 + * @example 1 + */ + top_p?: number | null; + /** + * Specifies the format that the model must output. Compatible with + * [GPT-4o](/docs/models/gpt-4o), [GPT-4 + * Turbo](/docs/models/gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models + * since `gpt-3.5-turbo-1106`. + * + * Setting to `{ "type": "json_schema", "json_schema": {...} }` enables + * Structured Outputs which ensures the model will match your supplied JSON + * schema. Learn more in the [Structured Outputs + * guide](/docs/guides/structured-outputs). + * + * Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the + * message the model generates is valid JSON. + * + * **Important:** when using JSON mode, you **must** also instruct the model + * to produce JSON yourself via a system or user message. Without this, the + * model may generate an unending stream of whitespace until the generation + * reaches the token limit, resulting in a long-running and seemingly "stuck" + * request. Also note that the message content may be partially cut off if + * `finish_reason="length"`, which indicates the generation exceeded + * `max_tokens` or the conversation exceeded the max context length. + */ + response_format?: AssistantsApiResponseFormatOption; }; export type ChatCompletionFunctions = { - description?: string; - name: string; - parameters?: FunctionParameters; + description?: string; + name: string; + /** + * The parameters the functions accepts, described as a JSON Schema object. + * See the [guide](/docs/guides/function-calling) for examples, and the [JSON + * Schema reference](https://json-schema.org/understanding-json-schema/) for + * documentation about the format. + * + * Omitting `parameters` defines a function with an empty parameter list. + */ + parameters?: FunctionParameters; }; export type ChatCompletionTool = { - /** - * The type of the tool. Currently, only `function` is supported. - * @enum function - */ - type: 'function'; - function: FunctionObject; + /** + * The type of the tool. Currently, only `function` is supported. + * @enum function + */ + type: "function"; + function: FunctionObject; }; /** The per-line training example of a fine-tuning input file for chat models */ export type FinetuneChatRequestInput = { - readonly messages?: (never | never | never | never | never | null)[]; - readonly tools?: ChatCompletionTool[]; - parallel_tool_calls?: ParallelToolCalls; - /** - * A list of functions the model may generate JSON inputs for. - * @deprecated - */ - readonly functions?: ChatCompletionFunctions[]; + messages?: readonly (never | never | never | never | never)[]; + tools?: readonly ChatCompletionTool[]; + /** + * Whether to enable [parallel function + * calling](/docs/guides/function-calling/parallel-function-calling) during + * tool use. + */ + parallel_tool_calls?: ParallelToolCalls; + /** + * A list of functions the model may generate JSON inputs for. + * @deprecated + */ + functions?: readonly ChatCompletionFunctions[]; }; /** The `File` object represents a document that has been uploaded to OpenAI. */ export type OpenAiFile = { - id: string; - bytes: number; - created_at: number; - filename: string; - /** - * The object type, which is always `file`. - * @enum file - */ - object: 'file'; - /** - * The intended purpose of the file. Supported values are `assistants`, - * `assistants_output`, `batch`, `batch_output`, `fine-tune`, - * `fine-tune-results` and `vision`. - * @enum assistants,assistants_output,batch,batch_output,fine-tune,fine-tune-results,vision - */ - purpose: - | 'assistants' - | 'assistants_output' - | 'batch' - | 'batch_output' - | 'fine-tune' - | 'fine-tune-results' - | 'vision'; - /** - * Deprecated. The current status of the file, which can be either `uploaded`, - * `processed`, or `error`. - * @enum uploaded,processed,error - * @deprecated - */ - status: 'uploaded' | 'processed' | 'error'; - /** - * Deprecated. For details on why a fine-tuning training file failed - * validation, see the `error` field on `fine_tuning.job`. - * @deprecated - */ - status_details: string; + id: string; + bytes: number; + created_at: number; + filename: string; + /** + * The object type, which is always `file`. + * @enum file + */ + object: "file"; + /** + * The intended purpose of the file. Supported values are `assistants`, + * `assistants_output`, `batch`, `batch_output`, `fine-tune`, + * `fine-tune-results` and `vision`. + * @enum assistants,assistants_output,batch,batch_output,fine-tune,fine-tune-results,vision + */ + purpose: + | "assistants" + | "assistants_output" + | "batch" + | "batch_output" + | "fine-tune" + | "fine-tune-results" + | "vision"; + /** + * Deprecated. The current status of the file, which can be either `uploaded`, + * `processed`, or `error`. + * @enum uploaded,processed,error + * @deprecated + */ + status: "uploaded" | "processed" | "error"; + /** + * Deprecated. For details on why a fine-tuning training file failed + * validation, see the `error` field on `fine_tuning.job`. + * @deprecated + */ + status_details: string; }; /** The Upload object can accept byte chunks in the form of Parts. */ export type Upload = { - id: string; - created_at: number; - filename: string; - bytes: number; - purpose: string; - /** - * The status of the Upload. - * @enum pending,completed,cancelled,expired - */ - status: 'pending' | 'completed' | 'cancelled' | 'expired'; - expires_at: number; - /** - * The object type, which is always "upload". - * @enum upload - */ - object?: 'upload'; - file?: OpenAiFile; + id: string; + created_at: number; + filename: string; + bytes: number; + purpose: string; + /** + * The status of the Upload. + * @enum pending,completed,cancelled,expired + */ + status: "pending" | "completed" | "cancelled" | "expired"; + expires_at: number; + /** + * The object type, which is always "upload". + * @enum upload + */ + object?: "upload"; + /** The `File` object represents a document that has been uploaded to OpenAI. */ + file?: OpenAiFile; }; export type TranscriptionSegment = { - id: number; - seek: number; - start: number; - end: number; - text: string; - readonly tokens: number[]; - temperature: number; - avg_logprob: number; - compression_ratio: number; - no_speech_prob: number; + id: number; + seek: number; + start: number; + end: number; + text: string; + tokens: readonly number[]; + temperature: number; + avg_logprob: number; + compression_ratio: number; + no_speech_prob: number; }; export type CreateTranslationResponseVerboseJson = { - language: string; - duration: string; - text: string; - readonly segments?: TranscriptionSegment[]; + language: string; + duration: string; + text: string; + segments?: readonly TranscriptionSegment[]; }; - -export enum AudioResponseFormatEnum { - Json = 'json', - Text = 'text', - Srt = 'srt', - VerboseJson = 'verbose_json', - Vtt = 'vtt', -} - /** * The format of the output, in one of these options: `json`, `text`, `srt`, * `verbose_json`, or `vtt`. */ export type AudioResponseFormat = - | AudioResponseFormatEnum - | 'json' - | 'text' - | 'srt' - | 'verbose_json' - | 'vtt'; + | "json" + | "text" + | "srt" + | "verbose_json" + | "vtt"; export type CreateTranslationRequest = { - file: string; - /** - * ID of the model to use. Only `whisper-1` (which is powered by our open - * source Whisper V2 model) is currently available. - * @example whisper-1 - */ - model: string | 'whisper-1' | null; - prompt?: string; - response_format?: AudioResponseFormat; - temperature?: number; + file: string; + /** + * ID of the model to use. Only `whisper-1` (which is powered by our open + * source Whisper V2 model) is currently available. + * @example whisper-1 + */ + model: string | "whisper-1"; + prompt?: string; + /** + * The format of the output, in one of these options: `json`, `text`, `srt`, + * `verbose_json`, or `vtt`. + */ + response_format?: AudioResponseFormat; + temperature?: number; }; export type TranscriptionWord = { - word: string; - start: number; - end: number; + word: string; + start: number; + end: number; }; /** * Represents a verbose json transcription response returned by model, based * on the provided input. */ export type CreateTranscriptionResponseVerboseJson = { - language: string; - duration: string; - text: string; - readonly words?: TranscriptionWord[]; - readonly segments?: TranscriptionSegment[]; + language: string; + duration: string; + text: string; + words?: readonly TranscriptionWord[]; + segments?: readonly TranscriptionSegment[]; }; export type CreateTranscriptionRequest = { - file: string; - /** - * ID of the model to use. Only `whisper-1` (which is powered by our open - * source Whisper V2 model) is currently available. - * @example whisper-1 - */ - model: string | 'whisper-1' | null; - language?: string; - prompt?: string; - response_format?: AudioResponseFormat; - temperature?: number; - /** - * The timestamp granularities to populate for this transcription. - * `response_format` must be set `verbose_json` to use timestamp - * granularities. Either or both of these options are supported: `word`, or - * `segment`. Note: There is no additional latency for segment timestamps, but - * generating word timestamps incurs additional latency. - * @default segment - */ - readonly 'timestamp_granularities[]'?: ('word' | 'segment')[]; + file: string; + /** + * ID of the model to use. Only `whisper-1` (which is powered by our open + * source Whisper V2 model) is currently available. + * @example whisper-1 + */ + model: string | "whisper-1"; + language?: string; + prompt?: string; + /** + * The format of the output, in one of these options: `json`, `text`, `srt`, + * `verbose_json`, or `vtt`. + */ + response_format?: AudioResponseFormat; + temperature?: number; + /** + * The timestamp granularities to populate for this transcription. + * `response_format` must be set `verbose_json` to use timestamp + * granularities. Either or both of these options are supported: `word`, or + * `segment`. Note: There is no additional latency for segment timestamps, but + * generating word timestamps incurs additional latency. + * @default segment + */ + "timestamp_granularities[]"?: readonly ("word" | "segment")[]; }; /** Represents an embedding vector returned by embedding endpoint. */ export type Embedding = { - index: number; - readonly embedding: number[]; - /** - * The object type, which is always "embedding". - * @enum embedding - */ - object: 'embedding'; + index: number; + embedding: readonly number[]; + /** + * The object type, which is always "embedding". + * @enum embedding + */ + object: "embedding"; }; export type CreateEmbeddingResponse = { - readonly data: Embedding[]; - model: string; - /** - * The object type, which is always "list". - * @enum list - */ - object: 'list'; - usage: { - prompt_tokens: number; - total_tokens: number; - }; + data: readonly Embedding[]; + model: string; + /** + * The object type, which is always "list". + * @enum list + */ + object: "list"; + usage: { + prompt_tokens: number; + total_tokens: number; + }; }; /** * The `fine_tuning.job.checkpoint` object represents a model checkpoint for a * fine-tuning job that is ready to use. */ export type FineTuningJobCheckpoint = { - id: string; - created_at: number; - fine_tuned_model_checkpoint: string; - step_number: number; - metrics: { - step?: number; - train_loss?: number; - train_mean_token_accuracy?: number; - valid_loss?: number; - valid_mean_token_accuracy?: number; - full_valid_loss?: number; - full_valid_mean_token_accuracy?: number; - }; - fine_tuning_job_id: string; - /** - * The object type, which is always "fine_tuning.job.checkpoint". - * @enum fine_tuning.job.checkpoint - */ - object: 'fine_tuning.job.checkpoint'; + id: string; + created_at: number; + fine_tuned_model_checkpoint: string; + step_number: number; + metrics: { + step?: number; + train_loss?: number; + train_mean_token_accuracy?: number; + valid_loss?: number; + valid_mean_token_accuracy?: number; + full_valid_loss?: number; + full_valid_mean_token_accuracy?: number; + }; + fine_tuning_job_id: string; + /** + * The object type, which is always "fine_tuning.job.checkpoint". + * @enum fine_tuning.job.checkpoint + */ + object: "fine_tuning.job.checkpoint"; }; export type ListFineTuningJobCheckpointsResponse = { - readonly data: FineTuningJobCheckpoint[]; - object: 'list'; - first_id?: string; - last_id?: string; - has_more: boolean; + data: readonly FineTuningJobCheckpoint[]; + object: "list"; + first_id?: string; + last_id?: string; + has_more: boolean; }; /** Fine-tuning job event object */ export type FineTuningJobEvent = { - id: string; - created_at: number; - level: 'info' | 'warn' | 'error'; - message: string; - object: 'fine_tuning.job.event'; + id: string; + created_at: number; + level: "info" | "warn" | "error"; + message: string; + object: "fine_tuning.job.event"; }; export type ListFineTuningJobEventsResponse = { - readonly data: FineTuningJobEvent[]; - object: 'list'; + data: readonly FineTuningJobEvent[]; + object: "list"; }; export type ListFilesResponse = { - readonly data: OpenAiFile[]; - object: 'list'; + data: readonly OpenAiFile[]; + object: "list"; }; /** Represents the url or the content of an image generated by the OpenAI API. */ export type Image = { - b64_json?: string; - url?: string; - revised_prompt?: string; + b64_json?: string; + url?: string; + revised_prompt?: string; }; export type ImagesResponse = { - created: number; - readonly data: Image[]; + created: number; + data: readonly Image[]; }; /** * The `fine_tuning.job` object represents a fine-tuning job that has been * created through the API. */ export type FineTuningJob = { - id: string; - created_at: number; - error: { - code: string; - message: string; - param: string; - }; - fine_tuned_model: string; - finished_at: number | null; - hyperparameters: { - /** - * The number of epochs to train the model for. An epoch refers to one full - * cycle through the training dataset. - * "auto" decides the optimal number of epochs based on the size of the - * dataset. If setting the number manually, we support any number between 1 - * and 50 epochs. - * @default auto - */ - n_epochs: 'auto' | number | null; - }; - model: string; - /** - * The object type, which is always "fine_tuning.job". - * @enum fine_tuning.job - */ - object: 'fine_tuning.job'; - organization_id: string; - readonly result_files: string[]; - /** - * The current status of the fine-tuning job, which can be either - * `validating_files`, `queued`, `running`, `succeeded`, `failed`, or - * `cancelled`. - * @enum validating_files,queued,running,succeeded,failed,cancelled - */ - status: - | 'validating_files' - | 'queued' - | 'running' - | 'succeeded' - | 'failed' - | 'cancelled'; - trained_tokens: number | null; - training_file: string; - validation_file: string; - readonly integrations?: FineTuningIntegration[]; - seed: number; - estimated_finish?: number | null; + id: string; + created_at: number; + error: { + code: string; + message: string; + param: string; + }; + fine_tuned_model: string; + finished_at: number | null; + hyperparameters: { + /** + * The number of epochs to train the model for. An epoch refers to one full + * cycle through the training dataset. + * "auto" decides the optimal number of epochs based on the size of the + * dataset. If setting the number manually, we support any number between 1 + * and 50 epochs. + * @default auto + */ + n_epochs: "auto" | number; + }; + model: string; + /** + * The object type, which is always "fine_tuning.job". + * @enum fine_tuning.job + */ + object: "fine_tuning.job"; + organization_id: string; + result_files: readonly string[]; + /** + * The current status of the fine-tuning job, which can be either + * `validating_files`, `queued`, `running`, `succeeded`, `failed`, or + * `cancelled`. + * @enum validating_files,queued,running,succeeded,failed,cancelled + */ + status: + | "validating_files" + | "queued" + | "running" + | "succeeded" + | "failed" + | "cancelled"; + trained_tokens: number | null; + training_file: string; + validation_file: string; + integrations?: readonly FineTuningIntegration[]; + seed: number; + estimated_finish?: number | null; }; export type ListPaginatedFineTuningJobsResponse = { - readonly data: FineTuningJob[]; - has_more: boolean; - object: 'list'; + data: readonly FineTuningJob[]; + has_more: boolean; + object: "list"; }; /** Usage statistics for the completion request. */ export type CompletionUsage = { - completion_tokens: number; - prompt_tokens: number; - total_tokens: number; - completion_tokens_details?: { - reasoning_tokens?: number; - }; + completion_tokens: number; + prompt_tokens: number; + total_tokens: number; + completion_tokens_details?: { + reasoning_tokens?: number; + }; }; /** * Represents a chat completion response returned by model, based on the * provided input. */ export type CreateChatCompletionFunctionResponse = { - id: string; - readonly choices: { - /** - * The reason the model stopped generating tokens. This will be `stop` if the - * model hit a natural stop point or a provided stop sequence, `length` if the - * maximum number of tokens specified in the request was reached, - * `content_filter` if content was omitted due to a flag from our content - * filters, or `function_call` if the model called a function. - * @enum stop,length,function_call,content_filter - */ - finish_reason: 'stop' | 'length' | 'function_call' | 'content_filter'; - index: number; - /** WARN: $ref used before available - #/components/schemas/ChatCompletionResponseMessage */ - message: never; - }[]; - created: number; - model: string; - system_fingerprint?: string; - /** - * The object type, which is always `chat.completion`. - * @enum chat.completion - */ - object: 'chat.completion'; - usage?: CompletionUsage; + id: string; + choices: readonly { + /** + * The reason the model stopped generating tokens. This will be `stop` if the + * model hit a natural stop point or a provided stop sequence, `length` if the + * maximum number of tokens specified in the request was reached, + * `content_filter` if content was omitted due to a flag from our content + * filters, or `function_call` if the model called a function. + * @enum stop,length,function_call,content_filter + */ + finish_reason: "stop" | "length" | "function_call" | "content_filter"; + index: number; + /** WARN: $ref used before available - schema={"$ref":"#/components/schemas/ChatCompletionResponseMessage"} */ + message: never; + }[]; + created: number; + model: string; + system_fingerprint?: string; + /** + * The object type, which is always `chat.completion`. + * @enum chat.completion + */ + object: "chat.completion"; + /** Usage statistics for the completion request. */ + usage?: CompletionUsage; }; /** * Represents a chat completion response returned by model, based on the * provided input. */ export type CreateChatCompletionResponse = { - id: string; - readonly choices: { - /** - * The reason the model stopped generating tokens. This will be `stop` if the - * model hit a natural stop point or a provided stop sequence, - * `length` if the maximum number of tokens specified in the request was - * reached, - * `content_filter` if content was omitted due to a flag from our content - * filters, - * `tool_calls` if the model called a tool, or `function_call` (deprecated) if - * the model called a function. - * @enum stop,length,tool_calls,content_filter,function_call - */ - finish_reason: - | 'stop' - | 'length' - | 'tool_calls' - | 'content_filter' - | 'function_call'; - index: number; - /** WARN: $ref used before available - #/components/schemas/ChatCompletionResponseMessage */ - message: never; - logprobs: { - readonly content: ChatCompletionTokenLogprob[]; - readonly refusal: ChatCompletionTokenLogprob[]; - }; - }[]; - created: number; - model: string; - /** - * The service tier used for processing the request. This field is only - * included if the `service_tier` parameter is specified in the request. - * @enum scale,default - * @example scale - */ - service_tier?: 'scale' | 'default'; - system_fingerprint?: string; - /** - * The object type, which is always `chat.completion`. - * @enum chat.completion - */ - object: 'chat.completion'; - usage?: CompletionUsage; + id: string; + choices: readonly { + /** + * The reason the model stopped generating tokens. This will be `stop` if the + * model hit a natural stop point or a provided stop sequence, + * `length` if the maximum number of tokens specified in the request was + * reached, + * `content_filter` if content was omitted due to a flag from our content + * filters, + * `tool_calls` if the model called a tool, or `function_call` (deprecated) if + * the model called a function. + * @enum stop,length,tool_calls,content_filter,function_call + */ + finish_reason: + | "stop" + | "length" + | "tool_calls" + | "content_filter" + | "function_call"; + index: number; + /** WARN: $ref used before available - schema={"$ref":"#/components/schemas/ChatCompletionResponseMessage"} */ + message: never; + logprobs: { + content: readonly ChatCompletionTokenLogprob[]; + refusal: readonly ChatCompletionTokenLogprob[]; + }; + }[]; + created: number; + model: string; + /** + * The service tier used for processing the request. This field is only + * included if the `service_tier` parameter is specified in the request. + * @enum scale,default + * @example scale + */ + service_tier?: "scale" | "default"; + system_fingerprint?: string; + /** + * The object type, which is always `chat.completion`. + * @enum chat.completion + */ + object: "chat.completion"; + /** Usage statistics for the completion request. */ + usage?: CompletionUsage; }; /** * Specifying a particular function via `{"name": "my_function"}` forces the * model to call that function. */ export type ChatCompletionFunctionCallOption = { - name: string; + name: string; }; /** * Specifies a tool the model should use. Use to force the model to call a * specific function. */ export type ChatCompletionNamedToolChoice = { - /** - * The type of the tool. Currently, only `function` is supported. - * @enum function - */ - type: 'function'; - function: { - name: string; - }; + /** + * The type of the tool. Currently, only `function` is supported. + * @enum function + */ + type: "function"; + function: { + name: string; + }; }; /** * Controls which (if any) tool is called by the model. @@ -3233,976 +3465,1088 @@ export type ChatCompletionNamedToolChoice = { * tools are present. */ export type ChatCompletionToolChoiceOption = - | ChatCompletionNamedToolChoice - | 'none' - | 'auto' - | 'required'; + | ChatCompletionNamedToolChoice + | "none" + | "auto" + | "required"; /** Options for streaming response. Only set this when you set `stream: true`. */ export type ChatCompletionStreamOptions = { - include_usage?: boolean; + include_usage?: boolean; }; export type ChatCompletionRequestFunctionMessage = { - /** - * The role of the messages author, in this case `function`. - * @enum function - */ - role: 'function'; - content: string; - name: string; + /** + * The role of the messages author, in this case `function`. + * @enum function + */ + role: "function"; + content: string; + name: string; }; export type ChatCompletionRequestMessageContentPartText = { - /** - * The type of the content part. - * @enum text - */ - type: 'text'; - text: string; + /** + * The type of the content part. + * @enum text + */ + type: "text"; + text: string; }; export type ChatCompletionRequestToolMessageContentPart = - ChatCompletionRequestMessageContentPartText; + ChatCompletionRequestMessageContentPartText; export type ChatCompletionRequestToolMessage = { - /** - * The role of the messages author, in this case `tool`. - * @enum tool - */ - role: 'tool'; - content: string | ChatCompletionRequestToolMessageContentPart[] | null; - tool_call_id: string; + /** + * The role of the messages author, in this case `tool`. + * @enum tool + */ + role: "tool"; + content: string | readonly ChatCompletionRequestToolMessageContentPart[]; + tool_call_id: string; }; export type ChatCompletionMessageToolCall = { - id: string; - /** - * The type of the tool. Currently, only `function` is supported. - * @enum function - */ - type: 'function'; - function: { - name: string; - arguments: string; - }; + id: string; + /** + * The type of the tool. Currently, only `function` is supported. + * @enum function + */ + type: "function"; + function: { + name: string; + arguments: string; + }; }; /** The tool calls generated by the model, such as function calls. */ export type ChatCompletionMessageToolCalls = ChatCompletionMessageToolCall[]; export type ChatCompletionRequestMessageContentPartRefusal = { - /** - * The type of the content part. - * @enum refusal - */ - type: 'refusal'; - refusal: string; + /** + * The type of the content part. + * @enum refusal + */ + type: "refusal"; + refusal: string; }; export type ChatCompletionRequestAssistantMessageContentPart = - | ChatCompletionRequestMessageContentPartText - | ChatCompletionRequestMessageContentPartRefusal; + | ChatCompletionRequestMessageContentPartText + | ChatCompletionRequestMessageContentPartRefusal; export type ChatCompletionRequestAssistantMessage = { - content?: string | ChatCompletionRequestAssistantMessageContentPart[] | null; - refusal?: string; - /** - * The role of the messages author, in this case `assistant`. - * @enum assistant - */ - role: 'assistant'; - name?: string; - tool_calls?: ChatCompletionMessageToolCalls; - /** - * Deprecated and replaced by `tool_calls`. The name and arguments of a - * function that should be called, as generated by the model. - * @deprecated - */ - function_call?: { - arguments: string; - name: string; - }; + content?: + | string + | readonly ChatCompletionRequestAssistantMessageContentPart[] + | null; + refusal?: string; + /** + * The role of the messages author, in this case `assistant`. + * @enum assistant + */ + role: "assistant"; + name?: string; + /** The tool calls generated by the model, such as function calls. */ + tool_calls?: ChatCompletionMessageToolCalls; + /** + * Deprecated and replaced by `tool_calls`. The name and arguments of a + * function that should be called, as generated by the model. + * @deprecated + */ + function_call?: { + arguments: string; + name: string; + }; }; export type ChatCompletionRequestMessageContentPartImage = { - /** - * The type of the content part. - * @enum image_url - */ - type: 'image_url'; - image_url: { - url: string; - /** - * Specifies the detail level of the image. Learn more in the [Vision - * guide](/docs/guides/vision/low-or-high-fidelity-image-understanding). - * @default auto - * @enum auto,low,high - */ - detail?: 'auto' | 'low' | 'high'; - }; + /** + * The type of the content part. + * @enum image_url + */ + type: "image_url"; + image_url: { + url: string; + /** + * Specifies the detail level of the image. Learn more in the [Vision + * guide](/docs/guides/vision/low-or-high-fidelity-image-understanding). + * @default auto + * @enum auto,low,high + */ + detail?: "auto" | "low" | "high"; + }; }; export type ChatCompletionRequestUserMessageContentPart = - | ChatCompletionRequestMessageContentPartText - | ChatCompletionRequestMessageContentPartImage; + | ChatCompletionRequestMessageContentPartText + | ChatCompletionRequestMessageContentPartImage; export type ChatCompletionRequestUserMessage = { - content: string | ChatCompletionRequestUserMessageContentPart[] | null; - /** - * The role of the messages author, in this case `user`. - * @enum user - */ - role: 'user'; - name?: string; + content: string | readonly ChatCompletionRequestUserMessageContentPart[]; + /** + * The role of the messages author, in this case `user`. + * @enum user + */ + role: "user"; + name?: string; }; export type ChatCompletionRequestSystemMessageContentPart = - ChatCompletionRequestMessageContentPartText; + ChatCompletionRequestMessageContentPartText; export type ChatCompletionRequestSystemMessage = { - content: string | ChatCompletionRequestSystemMessageContentPart[] | null; - /** - * The role of the messages author, in this case `system`. - * @enum system - */ - role: 'system'; - name?: string; + content: string | readonly ChatCompletionRequestSystemMessageContentPart[]; + /** + * The role of the messages author, in this case `system`. + * @enum system + */ + role: "system"; + name?: string; }; export type ChatCompletionRequestMessage = - | ChatCompletionRequestSystemMessage - | ChatCompletionRequestUserMessage - | ChatCompletionRequestAssistantMessage - | ChatCompletionRequestToolMessage - | ChatCompletionRequestFunctionMessage; + | ChatCompletionRequestSystemMessage + | ChatCompletionRequestUserMessage + | ChatCompletionRequestAssistantMessage + | ChatCompletionRequestToolMessage + | ChatCompletionRequestFunctionMessage; export type CreateChatCompletionRequest = { - readonly messages: ChatCompletionRequestMessage[]; - /** - * ID of the model to use. See the [model endpoint - * compatibility](/docs/models/model-endpoint-compatibility) table for details - * on which models work with the Chat API. - * @example gpt-4o - */ - model: - | string - | 'o1-preview' - | 'o1-preview-2024-09-12' - | 'o1-mini' - | 'o1-mini-2024-09-12' - | 'gpt-4o' - | 'gpt-4o-2024-08-06' - | 'gpt-4o-2024-05-13' - | 'gpt-4o-2024-08-06' - | 'chatgpt-4o-latest' - | 'gpt-4o-mini' - | 'gpt-4o-mini-2024-07-18' - | 'gpt-4-turbo' - | 'gpt-4-turbo-2024-04-09' - | 'gpt-4-0125-preview' - | 'gpt-4-turbo-preview' - | 'gpt-4-1106-preview' - | 'gpt-4-vision-preview' - | 'gpt-4' - | 'gpt-4-0314' - | 'gpt-4-0613' - | 'gpt-4-32k' - | 'gpt-4-32k-0314' - | 'gpt-4-32k-0613' - | 'gpt-3.5-turbo' - | 'gpt-3.5-turbo-16k' - | 'gpt-3.5-turbo-0301' - | 'gpt-3.5-turbo-0613' - | 'gpt-3.5-turbo-1106' - | 'gpt-3.5-turbo-0125' - | 'gpt-3.5-turbo-16k-0613' - | null; - frequency_penalty?: number | null; - logit_bias?: JsonifiableObject; - logprobs?: boolean | null; - top_logprobs?: number | null; - /** - * The maximum number of [tokens](/tokenizer) that can be generated in the - * chat completion. This value can be used to control - * [costs](https://openai.com/api/pricing/) for text generated via API. - * - * This value is now deprecated in favor of `max_completion_tokens`, and is - * not compatible with [o1 series models](/docs/guides/reasoning). - * @deprecated - */ - max_tokens?: number | null; - max_completion_tokens?: number | null; - /** - * How many chat completion choices to generate for each input message. Note - * that you will be charged based on the number of generated tokens across all - * of the choices. Keep `n` as `1` to minimize costs. - * @default 1 - * @example 1 - */ - n?: number | null; - presence_penalty?: number | null; - response_format?: - | ResponseFormatText - | ResponseFormatJsonObject - | ResponseFormatJsonSchema - | null; - seed?: number | null; - /** - * Specifies the latency tier to use for processing the request. This - * parameter is relevant for customers subscribed to the scale tier service: - * - * - If set to 'auto', and the Project is Scale tier enabled, the system will - * utilize scale tier credits until they are exhausted. - * - * - If set to 'auto', and the Project is not Scale tier enabled, the request - * will be processed using the default service tier with a lower uptime SLA - * and no latency guarentee. - * - * - If set to 'default', the request will be processed using the default - * service tier with a lower uptime SLA and no latency guarentee. - * - * - When not set, the default behavior is 'auto'. - * - * - * When this parameter is set, the response body will include the - * `service_tier` utilized. - * @enum auto,default - */ - service_tier?: 'auto' | 'default'; - stop?: string | string[] | null; - stream?: boolean | null; - stream_options?: ChatCompletionStreamOptions; - /** - * What sampling temperature to use, between 0 and 2. Higher values like 0.8 - * will make the output more random, while lower values like 0.2 will make it - * more focused and deterministic. - * - * We generally recommend altering this or `top_p` but not both. - * @default 1 - * @example 1 - */ - temperature?: number | null; - /** - * An alternative to sampling with temperature, called nucleus sampling, where - * the model considers the results of the tokens with top_p probability mass. - * So 0.1 means only the tokens comprising the top 10% probability mass are - * considered. - * - * We generally recommend altering this or `temperature` but not both. - * @default 1 - * @example 1 - */ - top_p?: number | null; - readonly tools?: ChatCompletionTool[]; - tool_choice?: ChatCompletionToolChoiceOption; - parallel_tool_calls?: ParallelToolCalls; - /** - * A unique identifier representing your end-user, which can help OpenAI to - * monitor and detect abuse. [Learn - * more](/docs/guides/safety-best-practices/end-user-ids). - * @example user-1234 - */ - user?: string; - /** - * Deprecated in favor of `tool_choice`. - * - * Controls which (if any) function is called by the model. - * `none` means the model will not call a function and instead generates a - * message. - * `auto` means the model can pick between generating a message or calling a - * function. - * Specifying a particular function via `{"name": "my_function"}` forces the - * model to call that function. - * - * `none` is the default when no functions are present. `auto` is the default - * if functions are present. - * @deprecated - */ - function_call?: 'none' | 'auto' | ChatCompletionFunctionCallOption | null; - /** - * Deprecated in favor of `tools`. - * - * A list of functions the model may generate JSON inputs for. - * @deprecated - */ - readonly functions?: ChatCompletionFunctions[]; + messages: readonly ChatCompletionRequestMessage[]; + /** + * ID of the model to use. See the [model endpoint + * compatibility](/docs/models/model-endpoint-compatibility) table for details + * on which models work with the Chat API. + * @example gpt-4o + */ + model: + | string + | "o1-preview" + | "o1-preview-2024-09-12" + | "o1-mini" + | "o1-mini-2024-09-12" + | "gpt-4o" + | "gpt-4o-2024-08-06" + | "gpt-4o-2024-05-13" + | "gpt-4o-2024-08-06" + | "chatgpt-4o-latest" + | "gpt-4o-mini" + | "gpt-4o-mini-2024-07-18" + | "gpt-4-turbo" + | "gpt-4-turbo-2024-04-09" + | "gpt-4-0125-preview" + | "gpt-4-turbo-preview" + | "gpt-4-1106-preview" + | "gpt-4-vision-preview" + | "gpt-4" + | "gpt-4-0314" + | "gpt-4-0613" + | "gpt-4-32k" + | "gpt-4-32k-0314" + | "gpt-4-32k-0613" + | "gpt-3.5-turbo" + | "gpt-3.5-turbo-16k" + | "gpt-3.5-turbo-0301" + | "gpt-3.5-turbo-0613" + | "gpt-3.5-turbo-1106" + | "gpt-3.5-turbo-0125" + | "gpt-3.5-turbo-16k-0613"; + frequency_penalty?: number | null; + logit_bias?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + logprobs?: boolean | null; + top_logprobs?: number | null; + /** + * The maximum number of [tokens](/tokenizer) that can be generated in the + * chat completion. This value can be used to control + * [costs](https://openai.com/api/pricing/) for text generated via API. + * + * This value is now deprecated in favor of `max_completion_tokens`, and is + * not compatible with [o1 series models](/docs/guides/reasoning). + * @deprecated + */ + max_tokens?: number | null; + max_completion_tokens?: number | null; + /** + * How many chat completion choices to generate for each input message. Note + * that you will be charged based on the number of generated tokens across all + * of the choices. Keep `n` as `1` to minimize costs. + * @default 1 + * @example 1 + */ + n?: number | null; + presence_penalty?: number | null; + response_format?: + | ResponseFormatText + | ResponseFormatJsonObject + | ResponseFormatJsonSchema; + seed?: number | null; + /** + * Specifies the latency tier to use for processing the request. This + * parameter is relevant for customers subscribed to the scale tier service: + * + * - If set to 'auto', and the Project is Scale tier enabled, the system will + * utilize scale tier credits until they are exhausted. + * + * - If set to 'auto', and the Project is not Scale tier enabled, the request + * will be processed using the default service tier with a lower uptime SLA + * and no latency guarentee. + * + * - If set to 'default', the request will be processed using the default + * service tier with a lower uptime SLA and no latency guarentee. + * + * - When not set, the default behavior is 'auto'. + * + * + * When this parameter is set, the response body will include the + * `service_tier` utilized. + * @enum auto,default + */ + service_tier?: "auto" | "default"; + stop?: string | readonly string[]; + stream?: boolean | null; + /** Options for streaming response. Only set this when you set `stream: true`. */ + stream_options?: ChatCompletionStreamOptions; + /** + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 + * will make the output more random, while lower values like 0.2 will make it + * more focused and deterministic. + * + * We generally recommend altering this or `top_p` but not both. + * @default 1 + * @example 1 + */ + temperature?: number | null; + /** + * An alternative to sampling with temperature, called nucleus sampling, where + * the model considers the results of the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are + * considered. + * + * We generally recommend altering this or `temperature` but not both. + * @default 1 + * @example 1 + */ + top_p?: number | null; + tools?: readonly ChatCompletionTool[]; + /** + * Controls which (if any) tool is called by the model. + * `none` means the model will not call any tool and instead generates a + * message. + * `auto` means the model can pick between generating a message or calling one + * or more tools. + * `required` means the model must call one or more tools. + * Specifying a particular tool via `{"type": "function", "function": {"name": + * "my_function"}}` forces the model to call that tool. + * + * `none` is the default when no tools are present. `auto` is the default if + * tools are present. + */ + tool_choice?: ChatCompletionToolChoiceOption; + /** + * Whether to enable [parallel function + * calling](/docs/guides/function-calling/parallel-function-calling) during + * tool use. + */ + parallel_tool_calls?: ParallelToolCalls; + /** + * A unique identifier representing your end-user, which can help OpenAI to + * monitor and detect abuse. [Learn + * more](/docs/guides/safety-best-practices/end-user-ids). + * @example user-1234 + */ + user?: string; + /** + * Deprecated in favor of `tool_choice`. + * + * Controls which (if any) function is called by the model. + * `none` means the model will not call a function and instead generates a + * message. + * `auto` means the model can pick between generating a message or calling a + * function. + * Specifying a particular function via `{"name": "my_function"}` forces the + * model to call that function. + * + * `none` is the default when no functions are present. `auto` is the default + * if functions are present. + * @deprecated + */ + function_call?: "none" | "auto" | ChatCompletionFunctionCallOption; + /** + * Deprecated in favor of `tools`. + * + * A list of functions the model may generate JSON inputs for. + * @deprecated + */ + functions?: readonly ChatCompletionFunctions[]; }; export type ChatCompletionMessageToolCallChunk = { - index: number; - id?: string; - /** - * The type of the tool. Currently, only `function` is supported. - * @enum function - */ - type?: 'function'; - function?: { - name?: string; - arguments?: string; - }; + index: number; + id?: string; + /** + * The type of the tool. Currently, only `function` is supported. + * @enum function + */ + type?: "function"; + function?: { + name?: string; + arguments?: string; + }; }; /** A chat completion delta generated by streamed model responses. */ export type ChatCompletionStreamResponseDelta = { - content?: string; - /** - * Deprecated and replaced by `tool_calls`. The name and arguments of a - * function that should be called, as generated by the model. - * @deprecated - */ - function_call?: { - arguments?: string; - name?: string; - }; - readonly tool_calls?: ChatCompletionMessageToolCallChunk[]; - /** - * The role of the author of this message. - * @enum system,user,assistant,tool - */ - role?: 'system' | 'user' | 'assistant' | 'tool'; - refusal?: string; + content?: string; + /** + * Deprecated and replaced by `tool_calls`. The name and arguments of a + * function that should be called, as generated by the model. + * @deprecated + */ + function_call?: { + arguments?: string; + name?: string; + }; + tool_calls?: readonly ChatCompletionMessageToolCallChunk[]; + /** + * The role of the author of this message. + * @enum system,user,assistant,tool + */ + role?: "system" | "user" | "assistant" | "tool"; + refusal?: string; }; /** A chat completion message generated by the model. */ export type ChatCompletionResponseMessage = { - content: string; - refusal: string; - tool_calls?: ChatCompletionMessageToolCalls; - /** - * The role of the author of this message. - * @enum assistant - */ - role: 'assistant'; - /** - * Deprecated and replaced by `tool_calls`. The name and arguments of a - * function that should be called, as generated by the model. - * @deprecated - */ - function_call?: { - arguments: string; - name: string; - }; + content: string; + refusal: string; + /** The tool calls generated by the model, such as function calls. */ + tool_calls?: ChatCompletionMessageToolCalls; + /** + * The role of the author of this message. + * @enum assistant + */ + role: "assistant"; + /** + * Deprecated and replaced by `tool_calls`. The name and arguments of a + * function that should be called, as generated by the model. + * @deprecated + */ + function_call?: { + arguments: string; + name: string; + }; }; export type FineTuneChatCompletionRequestAssistantMessage = - ChatCompletionRequestAssistantMessage & { - /** - * Controls whether the assistant message is trained against (0 or 1) - * @enum 0,1 - */ - weight?: number; - }; + ChatCompletionRequestAssistantMessage & { + /** + * Controls whether the assistant message is trained against (0 or 1) + * @enum 0,1 + */ + weight?: number; + }; /** * Represents a completion response from the API. Note: both the streamed and * non-streamed response objects share the same shape (unlike the chat * endpoint). */ export type CreateCompletionResponse = { - id: string; - readonly choices: { - /** - * The reason the model stopped generating tokens. This will be `stop` if the - * model hit a natural stop point or a provided stop sequence, - * `length` if the maximum number of tokens specified in the request was - * reached, - * or `content_filter` if content was omitted due to a flag from our content - * filters. - * @enum stop,length,content_filter - */ - finish_reason: 'stop' | 'length' | 'content_filter'; - index: number; - logprobs: { - readonly text_offset?: number[]; - readonly token_logprobs?: number[]; - readonly tokens?: string[]; - readonly top_logprobs?: JsonifiableObject[]; - }; - text: string; - }[]; - created: number; - model: string; - system_fingerprint?: string; - /** - * The object type, which is always "text_completion" - * @enum text_completion - */ - object: 'text_completion'; - usage?: CompletionUsage; + id: string; + choices: readonly { + /** + * The reason the model stopped generating tokens. This will be `stop` if the + * model hit a natural stop point or a provided stop sequence, + * `length` if the maximum number of tokens specified in the request was + * reached, + * or `content_filter` if content was omitted due to a flag from our content + * filters. + * @enum stop,length,content_filter + */ + finish_reason: "stop" | "length" | "content_filter"; + index: number; + logprobs: { + text_offset?: readonly number[]; + token_logprobs?: readonly number[]; + tokens?: readonly string[]; + top_logprobs?: readonly Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >[]; + }; + text: string; + }[]; + created: number; + model: string; + system_fingerprint?: string; + /** + * The object type, which is always "text_completion" + * @enum text_completion + */ + object: "text_completion"; + /** Usage statistics for the completion request. */ + usage?: CompletionUsage; }; export type CreateCompletionRequest = { - model: - | string - | 'gpt-3.5-turbo-instruct' - | 'davinci-002' - | 'babbage-002' - | null; - /** - * The prompt(s) to generate completions for, encoded as a string, array of - * strings, array of tokens, or array of token arrays. - * - * Note that <|endoftext|> is the document separator that the model sees - * during training, so if a prompt is not specified the model will generate as - * if from the beginning of a new document. - * @default <|endoftext|> - */ - prompt: string | string[] | number[] | number[][] | null; - /** - * Generates `best_of` completions server-side and returns the "best" (the one - * with the highest log probability per token). Results cannot be streamed. - * - * When used with `n`, `best_of` controls the number of candidate completions - * and `n` specifies how many to return – `best_of` must be greater than `n`. - * - * **Note:** Because this parameter generates many completions, it can quickly - * consume your token quota. Use carefully and ensure that you have reasonable - * settings for `max_tokens` and `stop`. - * @default 1 - */ - best_of?: number | null; - echo?: boolean | null; - frequency_penalty?: number | null; - logit_bias?: JsonifiableObject; - logprobs?: number | null; - /** - * The maximum number of [tokens](/tokenizer) that can be generated in the - * completion. - * - * The token count of your prompt plus `max_tokens` cannot exceed the model's - * context length. [Example Python - * code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) - * for counting tokens. - * @default 16 - * @example 16 - */ - max_tokens?: number | null; - /** - * How many completions to generate for each prompt. - * - * **Note:** Because this parameter generates many completions, it can quickly - * consume your token quota. Use carefully and ensure that you have reasonable - * settings for `max_tokens` and `stop`. - * @default 1 - * @example 1 - */ - n?: number | null; - presence_penalty?: number | null; - seed?: number | null; - stop?: string | string[] | null; - stream?: boolean | null; - stream_options?: ChatCompletionStreamOptions; - /** - * The suffix that comes after a completion of inserted text. - * - * This parameter is only supported for `gpt-3.5-turbo-instruct`. - * @example test. - */ - suffix?: string; - /** - * What sampling temperature to use, between 0 and 2. Higher values like 0.8 - * will make the output more random, while lower values like 0.2 will make it - * more focused and deterministic. - * - * We generally recommend altering this or `top_p` but not both. - * @default 1 - * @example 1 - */ - temperature?: number | null; - /** - * An alternative to sampling with temperature, called nucleus sampling, where - * the model considers the results of the tokens with top_p probability mass. - * So 0.1 means only the tokens comprising the top 10% probability mass are - * considered. - * - * We generally recommend altering this or `temperature` but not both. - * @default 1 - * @example 1 - */ - top_p?: number | null; - /** - * A unique identifier representing your end-user, which can help OpenAI to - * monitor and detect abuse. [Learn - * more](/docs/guides/safety-best-practices/end-user-ids). - * @example user-1234 - */ - user?: string; + model: string | "gpt-3.5-turbo-instruct" | "davinci-002" | "babbage-002"; + /** + * The prompt(s) to generate completions for, encoded as a string, array of + * strings, array of tokens, or array of token arrays. + * + * Note that <|endoftext|> is the document separator that the model sees + * during training, so if a prompt is not specified the model will generate as + * if from the beginning of a new document. + * @default <|endoftext|> + */ + prompt: + | string + | readonly string[] + | readonly number[] + | readonly (readonly number[])[] + | null; + /** + * Generates `best_of` completions server-side and returns the "best" (the one + * with the highest log probability per token). Results cannot be streamed. + * + * When used with `n`, `best_of` controls the number of candidate completions + * and `n` specifies how many to return – `best_of` must be greater than `n`. + * + * **Note:** Because this parameter generates many completions, it can quickly + * consume your token quota. Use carefully and ensure that you have reasonable + * settings for `max_tokens` and `stop`. + * @default 1 + */ + best_of?: number | null; + echo?: boolean | null; + frequency_penalty?: number | null; + logit_bias?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; + logprobs?: number | null; + /** + * The maximum number of [tokens](/tokenizer) that can be generated in the + * completion. + * + * The token count of your prompt plus `max_tokens` cannot exceed the model's + * context length. [Example Python + * code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) + * for counting tokens. + * @default 16 + * @example 16 + */ + max_tokens?: number | null; + /** + * How many completions to generate for each prompt. + * + * **Note:** Because this parameter generates many completions, it can quickly + * consume your token quota. Use carefully and ensure that you have reasonable + * settings for `max_tokens` and `stop`. + * @default 1 + * @example 1 + */ + n?: number | null; + presence_penalty?: number | null; + seed?: number | null; + stop?: string | readonly string[] | null; + stream?: boolean | null; + /** Options for streaming response. Only set this when you set `stream: true`. */ + stream_options?: ChatCompletionStreamOptions; + /** + * The suffix that comes after a completion of inserted text. + * + * This parameter is only supported for `gpt-3.5-turbo-instruct`. + * @example test. + */ + suffix?: string; + /** + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 + * will make the output more random, while lower values like 0.2 will make it + * more focused and deterministic. + * + * We generally recommend altering this or `top_p` but not both. + * @default 1 + * @example 1 + */ + temperature?: number | null; + /** + * An alternative to sampling with temperature, called nucleus sampling, where + * the model considers the results of the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are + * considered. + * + * We generally recommend altering this or `temperature` but not both. + * @default 1 + * @example 1 + */ + top_p?: number | null; + /** + * A unique identifier representing your end-user, which can help OpenAI to + * monitor and detect abuse. [Learn + * more](/docs/guides/safety-best-practices/end-user-ids). + * @example user-1234 + */ + user?: string; }; /** Describes an OpenAI model offering that can be used with the API. */ export type Model = { - id: string; - created: number; - /** - * The object type, which is always "model". - * @enum model - */ - object: 'model'; - owned_by: string; + id: string; + created: number; + /** + * The object type, which is always "model". + * @enum model + */ + object: "model"; + owned_by: string; }; export type ListModelsResponse = { - object: 'list'; - readonly data: Model[]; + object: "list"; + data: readonly Model[]; }; export type ErrorResponse = { - error: Error; + error: Error; }; -export type CreateChatCompletionCommandInput = CreateChatCompletionRequest; export type CreateChatCompletionCommandBody = CreateChatCompletionRequest; -export type CreateCompletionCommandInput = CreateCompletionRequest; +export type CreateChatCompletionCommandInput = CreateChatCompletionRequest; export type CreateCompletionCommandBody = CreateCompletionRequest; -export type CreateImageCommandInput = CreateImageRequest; +export type CreateCompletionCommandInput = CreateCompletionRequest; export type CreateImageCommandBody = CreateImageRequest; -export type CreateImageEditCommandInput = never; -export type CreateImageVariationCommandInput = never; -export type CreateEmbeddingCommandInput = CreateEmbeddingRequest; +export type CreateImageCommandInput = CreateImageRequest; +type CreateImageEditCommandBodyMultipartFormData = NonNullable< + RequestInit["body"] +>; +export type CreateImageEditCommandBodyNonJson = { + body: CreateImageEditCommandBodyMultipartFormData; +}; +export type CreateImageEditCommandInput = CreateImageEditCommandBodyNonJson; +type CreateImageVariationCommandBodyMultipartFormData = NonNullable< + RequestInit["body"] +>; +export type CreateImageVariationCommandBodyNonJson = { + body: CreateImageVariationCommandBodyMultipartFormData; +}; +export type CreateImageVariationCommandInput = + CreateImageVariationCommandBodyNonJson; export type CreateEmbeddingCommandBody = CreateEmbeddingRequest; -export type CreateSpeechCommandInput = CreateSpeechRequest; +export type CreateEmbeddingCommandInput = CreateEmbeddingRequest; export type CreateSpeechCommandBody = CreateSpeechRequest; -export type CreateTranscriptionCommandInput = never; -export type CreateTranslationCommandInput = never; +export type CreateSpeechCommandInput = CreateSpeechRequest; +type CreateTranscriptionCommandBodyMultipartFormData = NonNullable< + RequestInit["body"] +>; +export type CreateTranscriptionCommandBodyNonJson = { + body: CreateTranscriptionCommandBodyMultipartFormData; +}; +export type CreateTranscriptionCommandInput = + CreateTranscriptionCommandBodyNonJson; +export type CreateTranscriptionCommandOutput = + | CreateTranscriptionResponseJson + | CreateTranscriptionResponseVerboseJson; +type CreateTranslationCommandBodyMultipartFormData = NonNullable< + RequestInit["body"] +>; +export type CreateTranslationCommandBodyNonJson = { + body: CreateTranslationCommandBodyMultipartFormData; +}; +export type CreateTranslationCommandInput = CreateTranslationCommandBodyNonJson; +export type CreateTranslationCommandOutput = + | CreateTranslationResponseJson + | CreateTranslationResponseVerboseJson; export type ListFilesCommandQuery = { - purpose?: string | undefined; + purpose?: string | undefined; }; export type ListFilesCommandInput = ListFilesCommandQuery; -export type CreateFileCommandInput = never; +type CreateFileCommandBodyMultipartFormData = NonNullable; +export type CreateFileCommandBodyNonJson = { + body: CreateFileCommandBodyMultipartFormData; +}; +export type CreateFileCommandInput = CreateFileCommandBodyNonJson; export type DeleteFileCommandParams = { - file_id: string; + file_id: string; }; export type DeleteFileCommandInput = DeleteFileCommandParams; export type RetrieveFileCommandParams = { - file_id: string; + file_id: string; }; export type RetrieveFileCommandInput = RetrieveFileCommandParams; export type DownloadFileCommandParams = { - file_id: string; + file_id: string; }; export type DownloadFileCommandInput = DownloadFileCommandParams; -export type CreateUploadCommandInput = CreateUploadRequest; +export type DownloadFileCommandOutput = string | undefined; export type CreateUploadCommandBody = CreateUploadRequest; +export type CreateUploadCommandInput = CreateUploadRequest; +type AddUploadPartCommandBodyMultipartFormData = NonNullable< + RequestInit["body"] +>; +export type AddUploadPartCommandBodyNonJson = { + body: AddUploadPartCommandBodyMultipartFormData; +}; export type AddUploadPartCommandParams = { - upload_id: string; + upload_id: string; }; -export type AddUploadPartCommandInput = AddUploadPartCommandParams; +export type AddUploadPartCommandInput = AddUploadPartCommandBodyNonJson & + AddUploadPartCommandParams; export type CompleteUploadCommandParams = { - upload_id: string; + upload_id: string; }; -export type CompleteUploadCommandInput = CompleteUploadRequest & - CompleteUploadCommandParams; export type CompleteUploadCommandBody = CompleteUploadRequest; +export type CompleteUploadCommandInput = CompleteUploadRequest & + CompleteUploadCommandParams; export type CancelUploadCommandParams = { - upload_id: string; + upload_id: string; }; export type CancelUploadCommandInput = CancelUploadCommandParams; -export type CreateFineTuningJobCommandInput = CreateFineTuningJobRequest; export type CreateFineTuningJobCommandBody = CreateFineTuningJobRequest; +export type CreateFineTuningJobCommandInput = CreateFineTuningJobRequest; export type ListPaginatedFineTuningJobsCommandQuery = { - after?: string | undefined; - limit?: `${number}` | undefined; + after?: string | undefined; + limit?: `${number}` | undefined; }; export type ListPaginatedFineTuningJobsCommandInput = - ListPaginatedFineTuningJobsCommandQuery; + ListPaginatedFineTuningJobsCommandQuery; export type RetrieveFineTuningJobCommandParams = { - fine_tuning_job_id: string; + fine_tuning_job_id: string; }; export type RetrieveFineTuningJobCommandInput = - RetrieveFineTuningJobCommandParams; + RetrieveFineTuningJobCommandParams; export type ListFineTuningEventsCommandQuery = { - after?: string | undefined; - limit?: `${number}` | undefined; + after?: string | undefined; + limit?: `${number}` | undefined; }; export type ListFineTuningEventsCommandParams = { - fine_tuning_job_id: string; + fine_tuning_job_id: string; }; export type ListFineTuningEventsCommandInput = - ListFineTuningEventsCommandParams & ListFineTuningEventsCommandQuery; + ListFineTuningEventsCommandParams & ListFineTuningEventsCommandQuery; export type CancelFineTuningJobCommandParams = { - fine_tuning_job_id: string; + fine_tuning_job_id: string; }; export type CancelFineTuningJobCommandInput = CancelFineTuningJobCommandParams; export type ListFineTuningJobCheckpointsCommandQuery = { - after?: string | undefined; - limit?: `${number}` | undefined; + after?: string | undefined; + limit?: `${number}` | undefined; }; export type ListFineTuningJobCheckpointsCommandParams = { - fine_tuning_job_id: string; + fine_tuning_job_id: string; }; export type ListFineTuningJobCheckpointsCommandInput = - ListFineTuningJobCheckpointsCommandParams & - ListFineTuningJobCheckpointsCommandQuery; + ListFineTuningJobCheckpointsCommandParams & + ListFineTuningJobCheckpointsCommandQuery; export type ListModelsCommandInput = never; export type RetrieveModelCommandParams = { - model: string; + model: string; }; export type RetrieveModelCommandInput = RetrieveModelCommandParams; export type DeleteModelCommandParams = { - model: string; + model: string; }; export type DeleteModelCommandInput = DeleteModelCommandParams; -export type CreateModerationCommandInput = CreateModerationRequest; export type CreateModerationCommandBody = CreateModerationRequest; +export type CreateModerationCommandInput = CreateModerationRequest; export type ListAssistantsCommandQuery = { - limit?: `${number}` | undefined; - order?: 'asc' | 'desc'; - after?: string | undefined; - before?: string | undefined; + limit?: `${number}` | undefined; + order?: "asc" | "desc"; + after?: string | undefined; + before?: string | undefined; }; export type ListAssistantsCommandInput = ListAssistantsCommandQuery; -export type CreateAssistantCommandInput = CreateAssistantRequest; export type CreateAssistantCommandBody = CreateAssistantRequest; +export type CreateAssistantCommandInput = CreateAssistantRequest; export type GetAssistantCommandParams = { - assistant_id: string; + assistant_id: string; }; export type GetAssistantCommandInput = GetAssistantCommandParams; export type ModifyAssistantCommandParams = { - assistant_id: string; + assistant_id: string; }; -export type ModifyAssistantCommandInput = ModifyAssistantRequest & - ModifyAssistantCommandParams; export type ModifyAssistantCommandBody = ModifyAssistantRequest; +export type ModifyAssistantCommandInput = ModifyAssistantRequest & + ModifyAssistantCommandParams; export type DeleteAssistantCommandParams = { - assistant_id: string; + assistant_id: string; }; export type DeleteAssistantCommandInput = DeleteAssistantCommandParams; -export type CreateThreadCommandInput = CreateThreadRequest; export type CreateThreadCommandBody = CreateThreadRequest; +export type CreateThreadCommandInput = CreateThreadRequest; export type GetThreadCommandParams = { - thread_id: string; + thread_id: string; }; export type GetThreadCommandInput = GetThreadCommandParams; export type ModifyThreadCommandParams = { - thread_id: string; + thread_id: string; }; -export type ModifyThreadCommandInput = ModifyThreadRequest & - ModifyThreadCommandParams; export type ModifyThreadCommandBody = ModifyThreadRequest; +export type ModifyThreadCommandInput = ModifyThreadRequest & + ModifyThreadCommandParams; export type DeleteThreadCommandParams = { - thread_id: string; + thread_id: string; }; export type DeleteThreadCommandInput = DeleteThreadCommandParams; export type ListMessagesCommandQuery = { - limit?: `${number}` | undefined; - order?: 'asc' | 'desc'; - after?: string | undefined; - before?: string | undefined; - run_id?: string | undefined; + limit?: `${number}` | undefined; + order?: "asc" | "desc"; + after?: string | undefined; + before?: string | undefined; + run_id?: string | undefined; }; export type ListMessagesCommandParams = { - thread_id: string; + thread_id: string; }; export type ListMessagesCommandInput = ListMessagesCommandParams & - ListMessagesCommandQuery; + ListMessagesCommandQuery; export type CreateMessageCommandParams = { - thread_id: string; + thread_id: string; }; -export type CreateMessageCommandInput = CreateMessageRequest & - CreateMessageCommandParams; export type CreateMessageCommandBody = CreateMessageRequest; +export type CreateMessageCommandInput = CreateMessageRequest & + CreateMessageCommandParams; export type GetMessageCommandParams = { - thread_id: string; - message_id: string; + thread_id: string; + message_id: string; }; export type GetMessageCommandInput = GetMessageCommandParams; export type ModifyMessageCommandParams = { - thread_id: string; - message_id: string; + thread_id: string; + message_id: string; }; -export type ModifyMessageCommandInput = ModifyMessageRequest & - ModifyMessageCommandParams; export type ModifyMessageCommandBody = ModifyMessageRequest; +export type ModifyMessageCommandInput = ModifyMessageRequest & + ModifyMessageCommandParams; export type DeleteMessageCommandParams = { - thread_id: string; - message_id: string; + thread_id: string; + message_id: string; }; export type DeleteMessageCommandInput = DeleteMessageCommandParams; -export type CreateThreadAndRunCommandInput = CreateThreadAndRunRequest; export type CreateThreadAndRunCommandBody = CreateThreadAndRunRequest; +export type CreateThreadAndRunCommandInput = CreateThreadAndRunRequest; export type ListRunsCommandQuery = { - limit?: `${number}` | undefined; - order?: 'asc' | 'desc'; - after?: string | undefined; - before?: string | undefined; + limit?: `${number}` | undefined; + order?: "asc" | "desc"; + after?: string | undefined; + before?: string | undefined; }; export type ListRunsCommandParams = { - thread_id: string; + thread_id: string; }; export type ListRunsCommandInput = ListRunsCommandParams & ListRunsCommandQuery; export type CreateRunCommandQuery = { - include?: - | 'step_details.tool_calls[*].file_search.results[*].content'[] - | undefined; + include?: + | readonly "step_details.tool_calls[*].file_search.results[*].content"[] + | undefined; }; export type CreateRunCommandParams = { - thread_id: string; + thread_id: string; }; -export type CreateRunCommandInput = CreateRunRequest & - CreateRunCommandParams & - CreateRunCommandQuery; export type CreateRunCommandBody = CreateRunRequest; +export type CreateRunCommandInput = CreateRunRequest & + CreateRunCommandParams & + CreateRunCommandQuery; export type GetRunCommandParams = { - thread_id: string; - run_id: string; + thread_id: string; + run_id: string; }; export type GetRunCommandInput = GetRunCommandParams; export type ModifyRunCommandParams = { - thread_id: string; - run_id: string; + thread_id: string; + run_id: string; }; -export type ModifyRunCommandInput = ModifyRunRequest & ModifyRunCommandParams; export type ModifyRunCommandBody = ModifyRunRequest; +export type ModifyRunCommandInput = ModifyRunRequest & ModifyRunCommandParams; export type SubmitToolOuputsToRunCommandParams = { - thread_id: string; - run_id: string; + thread_id: string; + run_id: string; }; -export type SubmitToolOuputsToRunCommandInput = SubmitToolOutputsRunRequest & - SubmitToolOuputsToRunCommandParams; export type SubmitToolOuputsToRunCommandBody = SubmitToolOutputsRunRequest; +export type SubmitToolOuputsToRunCommandInput = SubmitToolOutputsRunRequest & + SubmitToolOuputsToRunCommandParams; export type CancelRunCommandParams = { - thread_id: string; - run_id: string; + thread_id: string; + run_id: string; }; export type CancelRunCommandInput = CancelRunCommandParams; export type ListRunStepsCommandQuery = { - limit?: `${number}` | undefined; - order?: 'asc' | 'desc'; - after?: string | undefined; - before?: string | undefined; - include?: - | 'step_details.tool_calls[*].file_search.results[*].content'[] - | undefined; + limit?: `${number}` | undefined; + order?: "asc" | "desc"; + after?: string | undefined; + before?: string | undefined; + include?: + | readonly "step_details.tool_calls[*].file_search.results[*].content"[] + | undefined; }; export type ListRunStepsCommandParams = { - thread_id: string; - run_id: string; + thread_id: string; + run_id: string; }; export type ListRunStepsCommandInput = ListRunStepsCommandParams & - ListRunStepsCommandQuery; + ListRunStepsCommandQuery; export type GetRunStepCommandQuery = { - include?: - | 'step_details.tool_calls[*].file_search.results[*].content'[] - | undefined; + include?: + | readonly "step_details.tool_calls[*].file_search.results[*].content"[] + | undefined; }; export type GetRunStepCommandParams = { - thread_id: string; - run_id: string; - step_id: string; + thread_id: string; + run_id: string; + step_id: string; }; export type GetRunStepCommandInput = GetRunStepCommandParams & - GetRunStepCommandQuery; + GetRunStepCommandQuery; export type ListVectorStoresCommandQuery = { - limit?: `${number}` | undefined; - order?: 'asc' | 'desc'; - after?: string | undefined; - before?: string | undefined; + limit?: `${number}` | undefined; + order?: "asc" | "desc"; + after?: string | undefined; + before?: string | undefined; }; export type ListVectorStoresCommandInput = ListVectorStoresCommandQuery; -export type CreateVectorStoreCommandInput = CreateVectorStoreRequest; export type CreateVectorStoreCommandBody = CreateVectorStoreRequest; +export type CreateVectorStoreCommandInput = CreateVectorStoreRequest; export type GetVectorStoreCommandParams = { - vector_store_id: string; + vector_store_id: string; }; export type GetVectorStoreCommandInput = GetVectorStoreCommandParams; export type ModifyVectorStoreCommandParams = { - vector_store_id: string; + vector_store_id: string; }; -export type ModifyVectorStoreCommandInput = UpdateVectorStoreRequest & - ModifyVectorStoreCommandParams; export type ModifyVectorStoreCommandBody = UpdateVectorStoreRequest; +export type ModifyVectorStoreCommandInput = UpdateVectorStoreRequest & + ModifyVectorStoreCommandParams; export type DeleteVectorStoreCommandParams = { - vector_store_id: string; + vector_store_id: string; }; export type DeleteVectorStoreCommandInput = DeleteVectorStoreCommandParams; export type ListVectorStoreFilesCommandQuery = { - limit?: `${number}` | undefined; - order?: 'asc' | 'desc'; - after?: string | undefined; - before?: string | undefined; - filter?: 'in_progress' | 'completed' | 'failed' | 'cancelled'; + limit?: `${number}` | undefined; + order?: "asc" | "desc"; + after?: string | undefined; + before?: string | undefined; + filter?: "in_progress" | "completed" | "failed" | "cancelled"; }; export type ListVectorStoreFilesCommandParams = { - vector_store_id: string; + vector_store_id: string; }; export type ListVectorStoreFilesCommandInput = - ListVectorStoreFilesCommandParams & ListVectorStoreFilesCommandQuery; + ListVectorStoreFilesCommandParams & ListVectorStoreFilesCommandQuery; export type CreateVectorStoreFileCommandParams = { - vector_store_id: string; + vector_store_id: string; }; -export type CreateVectorStoreFileCommandInput = CreateVectorStoreFileRequest & - CreateVectorStoreFileCommandParams; export type CreateVectorStoreFileCommandBody = CreateVectorStoreFileRequest; +export type CreateVectorStoreFileCommandInput = CreateVectorStoreFileRequest & + CreateVectorStoreFileCommandParams; export type GetVectorStoreFileCommandParams = { - vector_store_id: string; - file_id: string; + vector_store_id: string; + file_id: string; }; export type GetVectorStoreFileCommandInput = GetVectorStoreFileCommandParams; export type DeleteVectorStoreFileCommandParams = { - vector_store_id: string; - file_id: string; + vector_store_id: string; + file_id: string; }; export type DeleteVectorStoreFileCommandInput = - DeleteVectorStoreFileCommandParams; + DeleteVectorStoreFileCommandParams; export type CreateVectorStoreFileBatchCommandParams = { - vector_store_id: string; + vector_store_id: string; }; -export type CreateVectorStoreFileBatchCommandInput = - CreateVectorStoreFileBatchRequest & CreateVectorStoreFileBatchCommandParams; export type CreateVectorStoreFileBatchCommandBody = - CreateVectorStoreFileBatchRequest; + CreateVectorStoreFileBatchRequest; +export type CreateVectorStoreFileBatchCommandInput = + CreateVectorStoreFileBatchRequest & CreateVectorStoreFileBatchCommandParams; export type GetVectorStoreFileBatchCommandParams = { - vector_store_id: string; - batch_id: string; + vector_store_id: string; + batch_id: string; }; export type GetVectorStoreFileBatchCommandInput = - GetVectorStoreFileBatchCommandParams; + GetVectorStoreFileBatchCommandParams; export type CancelVectorStoreFileBatchCommandParams = { - vector_store_id: string; - batch_id: string; + vector_store_id: string; + batch_id: string; }; export type CancelVectorStoreFileBatchCommandInput = - CancelVectorStoreFileBatchCommandParams; + CancelVectorStoreFileBatchCommandParams; export type ListFilesInVectorStoreBatchCommandQuery = { - limit?: `${number}` | undefined; - order?: 'asc' | 'desc'; - after?: string | undefined; - before?: string | undefined; - filter?: 'in_progress' | 'completed' | 'failed' | 'cancelled'; + limit?: `${number}` | undefined; + order?: "asc" | "desc"; + after?: string | undefined; + before?: string | undefined; + filter?: "in_progress" | "completed" | "failed" | "cancelled"; }; export type ListFilesInVectorStoreBatchCommandParams = { - vector_store_id: string; - batch_id: string; + vector_store_id: string; + batch_id: string; }; export type ListFilesInVectorStoreBatchCommandInput = - ListFilesInVectorStoreBatchCommandParams & - ListFilesInVectorStoreBatchCommandQuery; -export type CreateBatchCommandInput = never; + ListFilesInVectorStoreBatchCommandParams & + ListFilesInVectorStoreBatchCommandQuery; +type createBatchJsonBody = { + input_file_id: string; + /** + * The endpoint to be used for all requests in the batch. Currently + * `/v1/chat/completions`, `/v1/embeddings`, and `/v1/completions` are + * supported. Note that `/v1/embeddings` batches are also restricted to a + * maximum of 50,000 embedding inputs across all requests in the batch. + * @enum /v1/chat/completions,/v1/embeddings,/v1/completions + */ + endpoint: "/v1/chat/completions" | "/v1/embeddings" | "/v1/completions"; + /** + * The time frame within which the batch should be processed. Currently only + * `24h` is supported. + * @enum 24h + */ + completion_window: "24h"; + metadata?: Record< + string | number, + /* additionalProperties is not handled yet */ unknown + >; +}; +export type CreateBatchCommandBody = createBatchJsonBody; +export type CreateBatchCommandInput = createBatchJsonBody; export type ListBatchesCommandQuery = { - after?: string | undefined; - limit?: `${number}` | undefined; + after?: string | undefined; + limit?: `${number}` | undefined; }; export type ListBatchesCommandInput = ListBatchesCommandQuery; export type RetrieveBatchCommandParams = { - batch_id: string; + batch_id: string; }; export type RetrieveBatchCommandInput = RetrieveBatchCommandParams; export type CancelBatchCommandParams = { - batch_id: string; + batch_id: string; }; export type CancelBatchCommandInput = CancelBatchCommandParams; export type ListAuditLogsCommandQuery = { - effective_at?: { - gt?: number; - gte?: number; - lt?: number; - lte?: number; - }; - project_ids?: string[] | undefined; - event_types?: AuditLogEventType[] | undefined; - actor_ids?: string[] | undefined; - actor_emails?: string[] | undefined; - resource_ids?: string[] | undefined; - limit?: `${number}` | undefined; - after?: string | undefined; - before?: string | undefined; + effective_at?: { + gt?: number; + gte?: number; + lt?: number; + lte?: number; + }; + project_ids?: readonly string[] | undefined; + event_types?: readonly AuditLogEventType[] | undefined; + actor_ids?: readonly string[] | undefined; + actor_emails?: readonly string[] | undefined; + resource_ids?: readonly string[] | undefined; + limit?: `${number}` | undefined; + after?: string | undefined; + before?: string | undefined; }; export type ListAuditLogsCommandInput = ListAuditLogsCommandQuery; export type ListInvitesCommandQuery = { - limit?: `${number}` | undefined; - after?: string | undefined; + limit?: `${number}` | undefined; + after?: string | undefined; }; export type ListInvitesCommandInput = ListInvitesCommandQuery; -export type InviteUserCommandInput = InviteRequest; export type InviteUserCommandBody = InviteRequest; +export type InviteUserCommandInput = InviteRequest; export type RetrieveInviteCommandParams = { - invite_id: string; + invite_id: string; }; export type RetrieveInviteCommandInput = RetrieveInviteCommandParams; export type DeleteInviteCommandParams = { - invite_id: string; + invite_id: string; }; export type DeleteInviteCommandInput = DeleteInviteCommandParams; export type ListUsersCommandQuery = { - limit?: `${number}` | undefined; - after?: string | undefined; + limit?: `${number}` | undefined; + after?: string | undefined; }; export type ListUsersCommandInput = ListUsersCommandQuery; export type RetrieveUserCommandParams = { - user_id: string; + user_id: string; }; export type RetrieveUserCommandInput = RetrieveUserCommandParams; -export type ModifyUserCommandInput = UserRoleUpdateRequest; +export type ModifyUserCommandParams = { + user_id: string; +}; export type ModifyUserCommandBody = UserRoleUpdateRequest; +export type ModifyUserCommandInput = UserRoleUpdateRequest & + ModifyUserCommandParams; export type DeleteUserCommandParams = { - user_id: string; + user_id: string; }; export type DeleteUserCommandInput = DeleteUserCommandParams; export type ListProjectsCommandQuery = { - limit?: `${number}` | undefined; - after?: string | undefined; - include_archived?: 'true' | 'false'; + limit?: `${number}` | undefined; + after?: string | undefined; + include_archived?: "true" | "false"; }; export type ListProjectsCommandInput = ListProjectsCommandQuery; -export type CreateProjectCommandInput = ProjectCreateRequest; export type CreateProjectCommandBody = ProjectCreateRequest; +export type CreateProjectCommandInput = ProjectCreateRequest; export type RetrieveProjectCommandParams = { - project_id: string; + project_id: string; }; export type RetrieveProjectCommandInput = RetrieveProjectCommandParams; -export type ModifyProjectCommandInput = ProjectUpdateRequest; +export type ModifyProjectCommandParams = { + project_id: string; +}; export type ModifyProjectCommandBody = ProjectUpdateRequest; +export type ModifyProjectCommandInput = ProjectUpdateRequest & + ModifyProjectCommandParams; export type ArchiveProjectCommandParams = { - project_id: string; + project_id: string; }; export type ArchiveProjectCommandInput = ArchiveProjectCommandParams; export type ListProjectUsersCommandQuery = { - limit?: `${number}` | undefined; - after?: string | undefined; + limit?: `${number}` | undefined; + after?: string | undefined; }; export type ListProjectUsersCommandParams = { - project_id: string; + project_id: string; }; export type ListProjectUsersCommandInput = ListProjectUsersCommandParams & - ListProjectUsersCommandQuery; + ListProjectUsersCommandQuery; export type CreateProjectUserCommandParams = { - project_id: string; + project_id: string; }; -export type CreateProjectUserCommandInput = ProjectUserCreateRequest & - CreateProjectUserCommandParams; export type CreateProjectUserCommandBody = ProjectUserCreateRequest; +export type CreateProjectUserCommandInput = ProjectUserCreateRequest & + CreateProjectUserCommandParams; export type RetrieveProjectUserCommandParams = { - project_id: string; - user_id: string; + project_id: string; + user_id: string; }; export type RetrieveProjectUserCommandInput = RetrieveProjectUserCommandParams; -export type ModifyProjectUserCommandInput = ProjectUserUpdateRequest; +export type ModifyProjectUserCommandParams = { + project_id: string; + user_id: string; +}; export type ModifyProjectUserCommandBody = ProjectUserUpdateRequest; +export type ModifyProjectUserCommandInput = ProjectUserUpdateRequest & + ModifyProjectUserCommandParams; export type DeleteProjectUserCommandParams = { - project_id: string; - user_id: string; + project_id: string; + user_id: string; }; export type DeleteProjectUserCommandInput = DeleteProjectUserCommandParams; export type ListProjectServiceAccountsCommandQuery = { - limit?: `${number}` | undefined; - after?: string | undefined; + limit?: `${number}` | undefined; + after?: string | undefined; }; export type ListProjectServiceAccountsCommandParams = { - project_id: string; + project_id: string; }; export type ListProjectServiceAccountsCommandInput = - ListProjectServiceAccountsCommandParams & - ListProjectServiceAccountsCommandQuery; + ListProjectServiceAccountsCommandParams & + ListProjectServiceAccountsCommandQuery; export type CreateProjectServiceAccountCommandParams = { - project_id: string; + project_id: string; }; -export type CreateProjectServiceAccountCommandInput = - ProjectServiceAccountCreateRequest & CreateProjectServiceAccountCommandParams; export type CreateProjectServiceAccountCommandBody = - ProjectServiceAccountCreateRequest; + ProjectServiceAccountCreateRequest; +export type CreateProjectServiceAccountCommandInput = + ProjectServiceAccountCreateRequest & CreateProjectServiceAccountCommandParams; export type RetrieveProjectServiceAccountCommandParams = { - project_id: string; - service_account_id: string; + project_id: string; + service_account_id: string; }; export type RetrieveProjectServiceAccountCommandInput = - RetrieveProjectServiceAccountCommandParams; + RetrieveProjectServiceAccountCommandParams; export type DeleteProjectServiceAccountCommandParams = { - project_id: string; - service_account_id: string; + project_id: string; + service_account_id: string; }; export type DeleteProjectServiceAccountCommandInput = - DeleteProjectServiceAccountCommandParams; + DeleteProjectServiceAccountCommandParams; export type ListProjectApiKeysCommandQuery = { - limit?: `${number}` | undefined; - after?: string | undefined; + limit?: `${number}` | undefined; + after?: string | undefined; }; export type ListProjectApiKeysCommandParams = { - project_id: string; + project_id: string; }; export type ListProjectApiKeysCommandInput = ListProjectApiKeysCommandParams & - ListProjectApiKeysCommandQuery; + ListProjectApiKeysCommandQuery; export type RetrieveProjectApiKeyCommandParams = { - project_id: string; - key_id: string; + project_id: string; + key_id: string; }; export type RetrieveProjectApiKeyCommandInput = - RetrieveProjectApiKeyCommandParams; + RetrieveProjectApiKeyCommandParams; export type DeleteProjectApiKeyCommandParams = { - project_id: string; - key_id: string; + project_id: string; + key_id: string; }; export type DeleteProjectApiKeyCommandInput = DeleteProjectApiKeyCommandParams; diff --git a/__tests__/fixtures/openai/valibot.ts b/__tests__/fixtures/openai/valibot.ts new file mode 100644 index 0000000..612ac84 --- /dev/null +++ b/__tests__/fixtures/openai/valibot.ts @@ -0,0 +1,6997 @@ +/** + * This file was auto generated by @block65/openapi-codegen + * + * WARN: Do not edit directly. + * + * Generated on 2026-03-06T07:45:26.343Z + * + */ +import * as v from "valibot"; + +export const deleteModelResponseSchema = v.strictObject({ + id: v.string(), + deleted: v.boolean(), + object: v.string(), +}); +/** The role of the author of a message */ +export const chatCompletionRoleSchema = v.picklist([ + "system", + "user", + "assistant", + "tool", + "function", +]); +export const chatCompletionTokenLogprobSchema = v.strictObject({ + /** + * The token. + */ + token: v.string(), + /** + * The log probability of this token, if it is within the top 20 most likely + * tokens. Otherwise, the value `-9999.0` is used to signify that the token is + * very unlikely. + */ + logprob: v.number(), + /** + * A list of integers representing the UTF-8 bytes representation of the + * token. Useful in instances where characters are represented by multiple + * tokens and their byte representations must be combined to generate the + * correct text representation. Can be `null` if there is no bytes + * representation for the token. + */ + bytes: v.nullable(v.array(v.pipe(v.number(), v.integer()))), + /** + * List of the most likely tokens and their log probability, at this token + * position. In rare cases, there may be fewer than the number of requested + * `top_logprobs` returned. + */ + top_logprobs: v.array( + v.strictObject({ + /** + * The token. + */ + token: v.string(), + /** + * The log probability of this token, if it is within the top 20 most likely + * tokens. Otherwise, the value `-9999.0` is used to signify that the token is + * very unlikely. + */ + logprob: v.number(), + /** + * A list of integers representing the UTF-8 bytes representation of the + * token. Useful in instances where characters are represented by multiple + * tokens and their byte representations must be combined to generate the + * correct text representation. Can be `null` if there is no bytes + * representation for the token. + */ + bytes: v.nullable(v.array(v.pipe(v.number(), v.integer()))), + }), + ), +}); +/** + * Represents a streamed chunk of a chat completion response returned by + * model, based on the provided input. + */ +export const createChatCompletionStreamResponseSchema = v.strictObject({ + /** + * A unique identifier for the chat completion. Each chunk has the same ID. + */ + id: v.string(), + /** + * A list of chat completion choices. Can contain more than one elements if + * `n` is greater than 1. Can also be empty for the + * last chunk if you set `stream_options: {"include_usage": true}`. + */ + choices: v.array( + v.strictObject({ + delta: v.unknown(), + /** + * Log probability information for the choice. + */ + logprobs: v.exactOptional( + v.nullable( + v.strictObject({ + /** + * A list of message content tokens with log probability information. + */ + content: v.nullable(v.array(chatCompletionTokenLogprobSchema)), + /** + * A list of message refusal tokens with log probability information. + */ + refusal: v.nullable(v.array(chatCompletionTokenLogprobSchema)), + }), + ), + ), + /** + * The reason the model stopped generating tokens. This will be `stop` if the + * model hit a natural stop point or a provided stop sequence, + * `length` if the maximum number of tokens specified in the request was + * reached, + * `content_filter` if content was omitted due to a flag from our content + * filters, + * `tool_calls` if the model called a tool, or `function_call` (deprecated) if + * the model called a function. + */ + finish_reason: v.nullable( + v.picklist([ + "stop", + "length", + "tool_calls", + "content_filter", + "function_call", + ]), + ), + /** + * The index of the choice in the list of choices. + */ + index: v.pipe(v.number(), v.integer()), + }), + ), + /** + * The Unix timestamp (in seconds) of when the chat completion was created. + * Each chunk has the same timestamp. + */ + created: v.pipe(v.number(), v.integer()), + /** + * The model to generate the completion. + */ + model: v.string(), + /** + * The service tier used for processing the request. This field is only + * included if the `service_tier` parameter is specified in the request. + */ + service_tier: v.exactOptional(v.nullable(v.picklist(["scale", "default"]))), + /** + * This fingerprint represents the backend configuration that the model runs + * with. + * Can be used in conjunction with the `seed` request parameter to understand + * when backend changes have been made that might impact determinism. + */ + system_fingerprint: v.exactOptional(v.string()), + /** + * The object type, which is always `chat.completion.chunk`. + */ + object: v.picklist(["chat.completion.chunk"]), + /** + * An optional field that will only be present when you set `stream_options: + * {"include_usage": true}` in your request. + * When present, it contains a null value except for the last chunk which + * contains the token usage statistics for the entire request. + */ + usage: v.exactOptional( + v.strictObject({ + /** + * Number of tokens in the generated completion. + */ + completion_tokens: v.pipe(v.number(), v.integer()), + /** + * Number of tokens in the prompt. + */ + prompt_tokens: v.pipe(v.number(), v.integer()), + /** + * Total number of tokens used in the request (prompt + completion). + */ + total_tokens: v.pipe(v.number(), v.integer()), + }), + ), +}); +/** + * Represents a streamed chunk of a chat completion response returned by + * model, based on the provided input. + */ +export const createChatCompletionImageResponseSchema = v.record( + v.string(), + v.unknown(), +); +export const createImageRequestSchema = v.strictObject({ + /** + * A text description of the desired image(s). The maximum length is 1000 + * characters for `dall-e-2` and 4000 characters for `dall-e-3`. + */ + prompt: v.string(), + /** + * The model to use for image generation. + */ + model: v.exactOptional( + v.nullable(v.union([v.string(), v.picklist(["dall-e-2", "dall-e-3"])])), + ), + /** + * The number of images to generate. Must be between 1 and 10. For `dall-e-3`, + * only `n=1` is supported. + */ + n: v.exactOptional( + v.nullable(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(10))), + ), + /** + * The quality of the image that will be generated. `hd` creates images with + * finer details and greater consistency across the image. This param is only + * supported for `dall-e-3`. + */ + quality: v.exactOptional(v.picklist(["standard", "hd"])), + /** + * The format in which the generated images are returned. Must be one of `url` + * or `b64_json`. URLs are only valid for 60 minutes after the image has been + * generated. + */ + response_format: v.exactOptional(v.nullable(v.picklist(["url", "b64_json"]))), + /** + * The size of the generated images. Must be one of `256x256`, `512x512`, or + * `1024x1024` for `dall-e-2`. Must be one of `1024x1024`, `1792x1024`, or + * `1024x1792` for `dall-e-3` models. + */ + size: v.exactOptional( + v.nullable( + v.picklist(["256x256", "512x512", "1024x1024", "1792x1024", "1024x1792"]), + ), + ), + /** + * The style of the generated images. Must be one of `vivid` or `natural`. + * Vivid causes the model to lean towards generating hyper-real and dramatic + * images. Natural causes the model to produce more natural, less hyper-real + * looking images. This param is only supported for `dall-e-3`. + */ + style: v.exactOptional(v.nullable(v.picklist(["vivid", "natural"]))), + /** + * A unique identifier representing your end-user, which can help OpenAI to + * monitor and detect abuse. [Learn + * more](/docs/guides/safety-best-practices/end-user-ids). + */ + user: v.exactOptional(v.string()), +}); +export const createImageEditRequestSchema = v.strictObject({ + /** + * The image to edit. Must be a valid PNG file, less than 4MB, and square. If + * mask is not provided, image must have transparency, which will be used as + * the mask. + */ + image: v.string(), + /** + * A text description of the desired image(s). The maximum length is 1000 + * characters. + */ + prompt: v.string(), + /** + * An additional image whose fully transparent areas (e.g. where alpha is + * zero) indicate where `image` should be edited. Must be a valid PNG file, + * less than 4MB, and have the same dimensions as `image`. + */ + mask: v.exactOptional(v.string()), + /** + * The model to use for image generation. Only `dall-e-2` is supported at this + * time. + */ + model: v.exactOptional( + v.nullable(v.union([v.string(), v.picklist(["dall-e-2"])])), + ), + /** + * The number of images to generate. Must be between 1 and 10. + */ + n: v.exactOptional( + v.nullable(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(10))), + ), + /** + * The size of the generated images. Must be one of `256x256`, `512x512`, or + * `1024x1024`. + */ + size: v.exactOptional( + v.nullable(v.picklist(["256x256", "512x512", "1024x1024"])), + ), + /** + * The format in which the generated images are returned. Must be one of `url` + * or `b64_json`. URLs are only valid for 60 minutes after the image has been + * generated. + */ + response_format: v.exactOptional(v.nullable(v.picklist(["url", "b64_json"]))), + /** + * A unique identifier representing your end-user, which can help OpenAI to + * monitor and detect abuse. [Learn + * more](/docs/guides/safety-best-practices/end-user-ids). + */ + user: v.exactOptional(v.string()), +}); +export const createImageVariationRequestSchema = v.strictObject({ + /** + * The image to use as the basis for the variation(s). Must be a valid PNG + * file, less than 4MB, and square. + */ + image: v.string(), + /** + * The model to use for image generation. Only `dall-e-2` is supported at this + * time. + */ + model: v.exactOptional( + v.nullable(v.union([v.string(), v.picklist(["dall-e-2"])])), + ), + /** + * The number of images to generate. Must be between 1 and 10. For `dall-e-3`, + * only `n=1` is supported. + */ + n: v.exactOptional( + v.nullable(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(10))), + ), + /** + * The format in which the generated images are returned. Must be one of `url` + * or `b64_json`. URLs are only valid for 60 minutes after the image has been + * generated. + */ + response_format: v.exactOptional(v.nullable(v.picklist(["url", "b64_json"]))), + /** + * The size of the generated images. Must be one of `256x256`, `512x512`, or + * `1024x1024`. + */ + size: v.exactOptional( + v.nullable(v.picklist(["256x256", "512x512", "1024x1024"])), + ), + /** + * A unique identifier representing your end-user, which can help OpenAI to + * monitor and detect abuse. [Learn + * more](/docs/guides/safety-best-practices/end-user-ids). + */ + user: v.exactOptional(v.string()), +}); +export const createModerationRequestSchema = v.strictObject({ + /** + * Input (or inputs) to classify. Can be a single string, an array of strings, + * or + * an array of multi-modal input objects similar to other models. + */ + input: v.union([ + v.string(), + v.array(v.string()), + v.array( + v.union([ + v.strictObject({ + /** + * Always `image_url`. + */ + type: v.picklist(["image_url"]), + /** + * Contains either an image URL or a data URL for a base64 encoded image. + */ + image_url: v.strictObject({ + /** + * Either a URL of the image or the base64 encoded image data. + */ + url: v.string(), + }), + }), + v.strictObject({ + /** + * Always `text`. + */ + type: v.picklist(["text"]), + /** + * A string of text to classify. + */ + text: v.string(), + }), + ]), + ), + ]), + /** + * The content moderation model you would like to use. Learn more in + * [the moderation guide](/docs/guides/moderation), and learn about + * available models [here](/docs/models/moderation). + */ + model: v.exactOptional( + v.union([ + v.string(), + v.picklist([ + "omni-moderation-latest", + "omni-moderation-2024-09-26", + "text-moderation-latest", + "text-moderation-stable", + ]), + ]), + ), +}); +/** Represents if a given text input is potentially harmful. */ +export const createModerationResponseSchema = v.strictObject({ + /** + * The unique identifier for the moderation request. + */ + id: v.string(), + /** + * The model used to generate the moderation results. + */ + model: v.string(), + /** + * A list of moderation objects. + */ + results: v.array( + v.strictObject({ + /** + * Whether any of the below categories are flagged. + */ + flagged: v.boolean(), + /** + * A list of the categories, and whether they are flagged or not. + */ + categories: v.strictObject({ + /** + * Content that expresses, incites, or promotes hate based on race, gender, + * ethnicity, religion, nationality, sexual orientation, disability status, or + * caste. Hateful content aimed at non-protected groups (e.g., chess players) + * is harassment. + */ + hate: v.boolean(), + /** + * Hateful content that also includes violence or serious harm towards the + * targeted group based on race, gender, ethnicity, religion, nationality, + * sexual orientation, disability status, or caste. + */ + "hate/threatening": v.boolean(), + /** + * Content that expresses, incites, or promotes harassing language towards any + * target. + */ + harassment: v.boolean(), + /** + * Harassment content that also includes violence or serious harm towards any + * target. + */ + "harassment/threatening": v.boolean(), + /** + * Content that includes instructions or advice that facilitate the planning + * or execution of wrongdoing, or that gives advice or instruction on how to + * commit illicit acts. For example, "how to shoplift" would fit this + * category. + */ + illicit: v.boolean(), + /** + * Content that includes instructions or advice that facilitate the planning + * or execution of wrongdoing that also includes violence, or that gives + * advice or instruction on the procurement of any weapon. + */ + "illicit/violent": v.boolean(), + /** + * Content that promotes, encourages, or depicts acts of self-harm, such as + * suicide, cutting, and eating disorders. + */ + "self-harm": v.boolean(), + /** + * Content where the speaker expresses that they are engaging or intend to + * engage in acts of self-harm, such as suicide, cutting, and eating + * disorders. + */ + "self-harm/intent": v.boolean(), + /** + * Content that encourages performing acts of self-harm, such as suicide, + * cutting, and eating disorders, or that gives instructions or advice on how + * to commit such acts. + */ + "self-harm/instructions": v.boolean(), + /** + * Content meant to arouse sexual excitement, such as the description of + * sexual activity, or that promotes sexual services (excluding sex education + * and wellness). + */ + sexual: v.boolean(), + /** + * Sexual content that includes an individual who is under 18 years old. + */ + "sexual/minors": v.boolean(), + /** + * Content that depicts death, violence, or physical injury. + */ + violence: v.boolean(), + /** + * Content that depicts death, violence, or physical injury in graphic detail. + */ + "violence/graphic": v.boolean(), + }), + /** + * A list of the categories along with their scores as predicted by model. + */ + category_scores: v.strictObject({ + /** + * The score for the category 'hate'. + */ + hate: v.number(), + /** + * The score for the category 'hate/threatening'. + */ + "hate/threatening": v.number(), + /** + * The score for the category 'harassment'. + */ + harassment: v.number(), + /** + * The score for the category 'harassment/threatening'. + */ + "harassment/threatening": v.number(), + /** + * The score for the category 'illicit'. + */ + illicit: v.number(), + /** + * The score for the category 'illicit/violent'. + */ + "illicit/violent": v.number(), + /** + * The score for the category 'self-harm'. + */ + "self-harm": v.number(), + /** + * The score for the category 'self-harm/intent'. + */ + "self-harm/intent": v.number(), + /** + * The score for the category 'self-harm/instructions'. + */ + "self-harm/instructions": v.number(), + /** + * The score for the category 'sexual'. + */ + sexual: v.number(), + /** + * The score for the category 'sexual/minors'. + */ + "sexual/minors": v.number(), + /** + * The score for the category 'violence'. + */ + violence: v.number(), + /** + * The score for the category 'violence/graphic'. + */ + "violence/graphic": v.number(), + }), + /** + * A list of the categories along with the input type(s) that the score + * applies to. + */ + category_applied_input_types: v.strictObject({ + /** + * The applied input type(s) for the category 'hate'. + */ + hate: v.array(v.picklist(["text"])), + /** + * The applied input type(s) for the category 'hate/threatening'. + */ + "hate/threatening": v.array(v.picklist(["text"])), + /** + * The applied input type(s) for the category 'harassment'. + */ + harassment: v.array(v.picklist(["text"])), + /** + * The applied input type(s) for the category 'harassment/threatening'. + */ + "harassment/threatening": v.array(v.picklist(["text"])), + /** + * The applied input type(s) for the category 'illicit'. + */ + illicit: v.array(v.picklist(["text"])), + /** + * The applied input type(s) for the category 'illicit/violent'. + */ + "illicit/violent": v.array(v.picklist(["text"])), + /** + * The applied input type(s) for the category 'self-harm'. + */ + "self-harm": v.array(v.picklist(["text", "image"])), + /** + * The applied input type(s) for the category 'self-harm/intent'. + */ + "self-harm/intent": v.array(v.picklist(["text", "image"])), + /** + * The applied input type(s) for the category 'self-harm/instructions'. + */ + "self-harm/instructions": v.array(v.picklist(["text", "image"])), + /** + * The applied input type(s) for the category 'sexual'. + */ + sexual: v.array(v.picklist(["text", "image"])), + /** + * The applied input type(s) for the category 'sexual/minors'. + */ + "sexual/minors": v.array(v.picklist(["text"])), + /** + * The applied input type(s) for the category 'violence'. + */ + violence: v.array(v.picklist(["text", "image"])), + /** + * The applied input type(s) for the category 'violence/graphic'. + */ + "violence/graphic": v.array(v.picklist(["text", "image"])), + }), + }), + ), +}); +export const createFileRequestSchema = v.strictObject({ + /** + * The File object (not file name) to be uploaded. + */ + file: v.string(), + /** + * The intended purpose of the uploaded file. + * + * Use "assistants" for [Assistants](/docs/api-reference/assistants) and + * [Message](/docs/api-reference/messages) files, "vision" for Assistants + * image file inputs, "batch" for [Batch API](/docs/guides/batch), and + * "fine-tune" for [Fine-tuning](/docs/api-reference/fine-tuning). + */ + purpose: v.picklist(["assistants", "batch", "fine-tune", "vision"]), +}); +export const deleteFileResponseSchema = v.strictObject({ + id: v.string(), + object: v.picklist(["file"]), + deleted: v.boolean(), +}); +export const createUploadRequestSchema = v.strictObject({ + /** + * The name of the file to upload. + */ + filename: v.string(), + /** + * The intended purpose of the uploaded file. + * + * See the [documentation on File + * purposes](/docs/api-reference/files/create#files-create-purpose). + */ + purpose: v.picklist(["assistants", "batch", "fine-tune", "vision"]), + /** + * The number of bytes in the file you are uploading. + */ + bytes: v.pipe(v.number(), v.integer()), + /** + * The MIME type of the file. + * + * This must fall within the supported MIME types for your file purpose. See + * the supported MIME types for assistants and vision. + */ + mime_type: v.string(), +}); +export const addUploadPartRequestSchema = v.strictObject({ + /** + * The chunk of bytes for this Part. + */ + data: v.string(), +}); +export const completeUploadRequestSchema = v.strictObject({ + /** + * The ordered list of Part IDs. + */ + part_ids: v.array(v.string()), + /** + * The optional md5 checksum for the file contents to verify if the bytes + * uploaded matches what you expect. + */ + md5: v.exactOptional(v.string()), +}); +export const cancelUploadRequestSchema = v.record(v.string(), v.unknown()); +export const createFineTuningJobRequestSchema = v.strictObject({ + /** + * The name of the model to fine-tune. You can select one of the + * [supported + * models](/docs/guides/fine-tuning/which-models-can-be-fine-tuned). + */ + model: v.union([ + v.string(), + v.picklist(["babbage-002", "davinci-002", "gpt-3.5-turbo", "gpt-4o-mini"]), + ]), + /** + * The ID of an uploaded file that contains training data. + * + * See [upload file](/docs/api-reference/files/create) for how to upload a + * file. + * + * Your dataset must be formatted as a JSONL file. Additionally, you must + * upload your file with the purpose `fine-tune`. + * + * The contents of the file should differ depending on if the model uses the + * [chat](/docs/api-reference/fine-tuning/chat-input) or + * [completions](/docs/api-reference/fine-tuning/completions-input) format. + * + * See the [fine-tuning guide](/docs/guides/fine-tuning) for more details. + */ + training_file: v.string(), + /** + * The hyperparameters used for the fine-tuning job. + */ + hyperparameters: v.exactOptional( + v.strictObject({ + /** + * Number of examples in each batch. A larger batch size means that model + * parameters + * are updated less frequently, but with lower variance. + */ + batch_size: v.exactOptional( + v.union([ + v.picklist(["auto"]), + v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(256)), + ]), + ), + /** + * Scaling factor for the learning rate. A smaller learning rate may be useful + * to avoid + * overfitting. + */ + learning_rate_multiplier: v.exactOptional( + v.union([v.picklist(["auto"]), v.pipe(v.number(), v.minValue(0))]), + ), + /** + * The number of epochs to train the model for. An epoch refers to one full + * cycle + * through the training dataset. + */ + n_epochs: v.exactOptional( + v.union([ + v.picklist(["auto"]), + v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(50)), + ]), + ), + }), + ), + /** + * A string of up to 64 characters that will be added to your fine-tuned model + * name. + * + * For example, a `suffix` of "custom-model-name" would produce a model name + * like `ft:gpt-4o-mini:openai:custom-model-name:7p4lURel`. + */ + suffix: v.exactOptional( + v.nullable(v.pipe(v.string(), v.minLength(1), v.maxLength(64))), + ), + /** + * The ID of an uploaded file that contains validation data. + * + * If you provide this file, the data is used to generate validation + * metrics periodically during fine-tuning. These metrics can be viewed in + * the fine-tuning results file. + * The same data should not be present in both train and validation files. + * + * Your dataset must be formatted as a JSONL file. You must upload your file + * with the purpose `fine-tune`. + * + * See the [fine-tuning guide](/docs/guides/fine-tuning) for more details. + */ + validation_file: v.exactOptional(v.nullable(v.string())), + /** + * A list of integrations to enable for your fine-tuning job. + */ + integrations: v.exactOptional( + v.nullable( + v.array( + v.strictObject({ + /** + * The type of integration to enable. Currently, only "wandb" (Weights and + * Biases) is supported. + */ + type: v.union([v.picklist(["wandb"])]), + /** + * The settings for your integration with Weights and Biases. This payload + * specifies the project that + * metrics will be sent to. Optionally, you can set an explicit display name + * for your run, add tags + * to your run, and set a default entity (team, username, etc) to be + * associated with your run. + */ + wandb: v.strictObject({ + /** + * The name of the project that the new run will be created under. + */ + project: v.string(), + /** + * A display name to set for the run. If not set, we will use the Job ID as + * the name. + */ + name: v.exactOptional(v.nullable(v.string())), + /** + * The entity to use for the run. This allows you to set the team or username + * of the WandB user that you would + * like associated with the run. If not set, the default entity for the + * registered WandB API key is used. + */ + entity: v.exactOptional(v.nullable(v.string())), + /** + * A list of tags to be attached to the newly created run. These tags are + * passed through directly to WandB. Some + * default tags are generated by OpenAI: "openai/finetune", + * "openai/{base-model}", "openai/{ftjob-abcdef}". + */ + tags: v.exactOptional(v.array(v.string())), + }), + }), + ), + ), + ), + /** + * The seed controls the reproducibility of the job. Passing in the same seed + * and job parameters should produce the same results, but may differ in rare + * cases. + * If a seed is not specified, one will be generated for you. + */ + seed: v.exactOptional( + v.nullable( + v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(2147483647)), + ), + ), +}); +export const createEmbeddingRequestSchema = v.strictObject({ + /** + * Input text to embed, encoded as a string or array of tokens. To embed + * multiple inputs in a single request, pass an array of strings or array of + * token arrays. The input must not exceed the max input tokens for the model + * (8192 tokens for `text-embedding-ada-002`), cannot be an empty string, and + * any array must be 2048 dimensions or less. [Example Python + * code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) + * for counting tokens. + */ + input: v.union([ + v.string(), + v.pipe(v.array(v.string()), v.minLength(1), v.maxLength(2048)), + v.pipe( + v.array(v.pipe(v.number(), v.integer())), + v.minLength(1), + v.maxLength(2048), + ), + v.pipe( + v.array(v.pipe(v.array(v.pipe(v.number(), v.integer())), v.minLength(1))), + v.minLength(1), + v.maxLength(2048), + ), + ]), + /** + * ID of the model to use. You can use the [List + * models](/docs/api-reference/models/list) API to see all of your available + * models, or see our [Model overview](/docs/models/overview) for descriptions + * of them. + */ + model: v.union([ + v.string(), + v.picklist([ + "text-embedding-ada-002", + "text-embedding-3-small", + "text-embedding-3-large", + ]), + ]), + /** + * The format to return the embeddings in. Can be either `float` or + * [`base64`](https://pypi.org/project/pybase64/). + */ + encoding_format: v.exactOptional(v.picklist(["float", "base64"])), + /** + * The number of dimensions the resulting output embeddings should have. Only + * supported in `text-embedding-3` and later models. + */ + dimensions: v.exactOptional(v.pipe(v.number(), v.integer(), v.minValue(1))), + /** + * A unique identifier representing your end-user, which can help OpenAI to + * monitor and detect abuse. [Learn + * more](/docs/guides/safety-best-practices/end-user-ids). + */ + user: v.exactOptional(v.string()), +}); +/** + * Represents a transcription response returned by model, based on the + * provided input. + */ +export const createTranscriptionResponseJsonSchema = v.strictObject({ + /** + * The transcribed text. + */ + text: v.string(), +}); +export const createTranslationResponseJsonSchema = v.strictObject({ + text: v.string(), +}); +export const createSpeechRequestSchema = v.strictObject({ + /** + * One of the available [TTS models](/docs/models/tts): `tts-1` or `tts-1-hd` + */ + model: v.union([v.string(), v.picklist(["tts-1", "tts-1-hd"])]), + /** + * The text to generate audio for. The maximum length is 4096 characters. + */ + input: v.pipe(v.string(), v.maxLength(4096)), + /** + * The voice to use when generating the audio. Supported voices are `alloy`, + * `echo`, `fable`, `onyx`, `nova`, and `shimmer`. Previews of the voices are + * available in the [Text to speech + * guide](/docs/guides/text-to-speech/voice-options). + */ + voice: v.picklist(["alloy", "echo", "fable", "onyx", "nova", "shimmer"]), + /** + * The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, + * `wav`, and `pcm`. + */ + response_format: v.exactOptional( + v.picklist(["mp3", "opus", "aac", "flac", "wav", "pcm"]), + ), + /** + * The speed of the generated audio. Select a value from `0.25` to `4.0`. + * `1.0` is the default. + */ + speed: v.exactOptional(v.pipe(v.number(), v.minValue(0.25), v.maxValue(4))), +}); +/** + * The upload Part represents a chunk of bytes we can add to an Upload object. + * @title UploadPart + */ +export const uploadPartSchema = v.strictObject({ + /** + * The upload Part unique identifier, which can be referenced in API + * endpoints. + */ + id: v.string(), + /** + * The Unix timestamp (in seconds) for when the Part was created. + */ + created_at: v.pipe(v.number(), v.integer()), + /** + * The ID of the Upload object that this Part was added to. + */ + upload_id: v.string(), + /** + * The object type, which is always `upload.part`. + */ + object: v.picklist(["upload.part"]), +}); +export const fineTuningIntegrationSchema = v.strictObject({ + /** + * The type of the integration being enabled for the fine-tuning job + */ + type: v.picklist(["wandb"]), + /** + * The settings for your integration with Weights and Biases. This payload + * specifies the project that + * metrics will be sent to. Optionally, you can set an explicit display name + * for your run, add tags + * to your run, and set a default entity (team, username, etc) to be + * associated with your run. + */ + wandb: v.strictObject({ + /** + * The name of the project that the new run will be created under. + */ + project: v.string(), + /** + * A display name to set for the run. If not set, we will use the Job ID as + * the name. + */ + name: v.exactOptional(v.nullable(v.string())), + /** + * The entity to use for the run. This allows you to set the team or username + * of the WandB user that you would + * like associated with the run. If not set, the default entity for the + * registered WandB API key is used. + */ + entity: v.exactOptional(v.nullable(v.string())), + /** + * A list of tags to be attached to the newly created run. These tags are + * passed through directly to WandB. Some + * default tags are generated by OpenAI: "openai/finetune", + * "openai/{base-model}", "openai/{ftjob-abcdef}". + */ + tags: v.exactOptional(v.array(v.string())), + }), +}); +/** + * The per-line training example of a fine-tuning input file for completions + * models + */ +export const finetuneCompletionRequestInputSchema = v.strictObject({ + /** + * The input prompt for this training example. + */ + prompt: v.exactOptional(v.string()), + /** + * The desired completion for this training example. + */ + completion: v.exactOptional(v.string()), +}); +export const deleteAssistantResponseSchema = v.strictObject({ + id: v.string(), + deleted: v.boolean(), + object: v.picklist(["assistant.deleted"]), +}); +export const assistantToolsCodeSchema = v.strictObject({ + /** + * The type of tool being defined: `code_interpreter` + */ + type: v.picklist(["code_interpreter"]), +}); +export const assistantToolsFileSearchTypeOnlySchema = v.strictObject({ + /** + * The type of tool being defined: `file_search` + */ + type: v.picklist(["file_search"]), +}); +export const modifyRunRequestSchema = v.strictObject({ + /** + * Set of 16 key-value pairs that can be attached to an object. This can be + * useful for storing additional information about the object in a structured + * format. Keys can be a maximum of 64 characters long and values can be a + * maximum of 512 characters long. + */ + metadata: v.exactOptional(v.nullable(v.record(v.string(), v.unknown()))), +}); +export const submitToolOutputsRunRequestSchema = v.strictObject({ + /** + * A list of tools for which the outputs are being submitted. + */ + tool_outputs: v.array( + v.strictObject({ + /** + * The ID of the tool call in the `required_action` object within the run + * object the output is being submitted for. + */ + tool_call_id: v.exactOptional(v.string()), + /** + * The output of the tool call to be submitted to continue the run. + */ + output: v.exactOptional(v.string()), + }), + ), + /** + * If `true`, returns a stream of events that happen during the Run as + * server-sent events, terminating when the Run enters a terminal state with a + * `data: [DONE]` message. + */ + stream: v.exactOptional(v.nullable(v.boolean())), +}); +export const modifyThreadRequestSchema = v.strictObject({ + /** + * A set of resources that are made available to the assistant's tools in this + * thread. The resources are specific to the type of tool. For example, the + * `code_interpreter` tool requires a list of file IDs, while the + * `file_search` tool requires a list of vector store IDs. + */ + tool_resources: v.exactOptional( + v.nullable( + v.strictObject({ + code_interpreter: v.exactOptional( + v.strictObject({ + /** + * A list of [file](/docs/api-reference/files) IDs made available to the + * `code_interpreter` tool. There can be a maximum of 20 files associated with + * the tool. + */ + file_ids: v.exactOptional( + v.pipe(v.array(v.string()), v.maxLength(20)), + ), + }), + ), + file_search: v.exactOptional( + v.strictObject({ + /** + * The [vector store](/docs/api-reference/vector-stores/object) attached to + * this thread. There can be a maximum of 1 vector store attached to the + * thread. + */ + vector_store_ids: v.exactOptional( + v.pipe(v.array(v.string()), v.maxLength(1)), + ), + }), + ), + }), + ), + ), + /** + * Set of 16 key-value pairs that can be attached to an object. This can be + * useful for storing additional information about the object in a structured + * format. Keys can be a maximum of 64 characters long and values can be a + * maximum of 512 characters long. + */ + metadata: v.exactOptional(v.nullable(v.record(v.string(), v.unknown()))), +}); +export const deleteThreadResponseSchema = v.strictObject({ + id: v.string(), + deleted: v.boolean(), + object: v.picklist(["thread.deleted"]), +}); +export const modifyMessageRequestSchema = v.strictObject({ + /** + * Set of 16 key-value pairs that can be attached to an object. This can be + * useful for storing additional information about the object in a structured + * format. Keys can be a maximum of 64 characters long and values can be a + * maximum of 512 characters long. + */ + metadata: v.exactOptional(v.nullable(v.record(v.string(), v.unknown()))), +}); +export const deleteMessageResponseSchema = v.strictObject({ + id: v.string(), + deleted: v.boolean(), + object: v.picklist(["thread.message.deleted"]), +}); +/** + * References an image [File](/docs/api-reference/files) in the content of a + * message. + * @title Image file + */ +export const messageContentImageFileObjectSchema = v.strictObject({ + /** + * Always `image_file`. + */ + type: v.picklist(["image_file"]), + image_file: v.strictObject({ + /** + * The [File](/docs/api-reference/files) ID of the image in the message + * content. Set `purpose="vision"` when uploading the File if you need to + * later display the file content. + */ + file_id: v.string(), + /** + * Specifies the detail level of the image if specified by the user. `low` + * uses fewer tokens, you can opt in to high resolution using `high`. + */ + detail: v.exactOptional(v.picklist(["auto", "low", "high"])), + }), +}); +/** + * References an image [File](/docs/api-reference/files) in the content of a + * message. + * @title Image file + */ +export const messageDeltaContentImageFileObjectSchema = v.strictObject({ + /** + * The index of the content part in the message. + */ + index: v.pipe(v.number(), v.integer()), + /** + * Always `image_file`. + */ + type: v.picklist(["image_file"]), + image_file: v.exactOptional( + v.strictObject({ + /** + * The [File](/docs/api-reference/files) ID of the image in the message + * content. Set `purpose="vision"` when uploading the File if you need to + * later display the file content. + */ + file_id: v.exactOptional(v.string()), + /** + * Specifies the detail level of the image if specified by the user. `low` + * uses fewer tokens, you can opt in to high resolution using `high`. + */ + detail: v.exactOptional(v.picklist(["auto", "low", "high"])), + }), + ), +}); +/** + * References an image URL in the content of a message. + * @title Image URL + */ +export const messageContentImageUrlObjectSchema = v.strictObject({ + /** + * The type of the content part. + */ + type: v.picklist(["image_url"]), + image_url: v.strictObject({ + /** + * The external URL of the image, must be a supported image types: jpeg, jpg, + * png, gif, webp. + */ + url: v.string(), + /** + * Specifies the detail level of the image. `low` uses fewer tokens, you can + * opt in to high resolution using `high`. Default value is `auto` + */ + detail: v.exactOptional(v.picklist(["auto", "low", "high"])), + }), +}); +/** + * References an image URL in the content of a message. + * @title Image URL + */ +export const messageDeltaContentImageUrlObjectSchema = v.strictObject({ + /** + * The index of the content part in the message. + */ + index: v.pipe(v.number(), v.integer()), + /** + * Always `image_url`. + */ + type: v.picklist(["image_url"]), + image_url: v.exactOptional( + v.strictObject({ + /** + * The URL of the image, must be a supported image types: jpeg, jpg, png, gif, + * webp. + */ + url: v.exactOptional(v.string()), + /** + * Specifies the detail level of the image. `low` uses fewer tokens, you can + * opt in to high resolution using `high`. + */ + detail: v.exactOptional(v.picklist(["auto", "low", "high"])), + }), + ), +}); +/** + * The text content that is part of a message. + * @title Text + */ +export const messageContentTextObjectSchema = v.strictObject({ + /** + * Always `text`. + */ + type: v.picklist(["text"]), + text: v.strictObject({ + /** + * The data that makes up the text. + */ + value: v.string(), + annotations: v.array(v.union([v.unknown(), v.unknown()])), + }), +}); +/** + * The refusal content generated by the assistant. + * @title Refusal + */ +export const messageContentRefusalObjectSchema = v.strictObject({ + /** + * Always `refusal`. + */ + type: v.picklist(["refusal"]), + refusal: v.string(), +}); +/** + * The text content that is part of a message. + * @title Text + */ +export const messageRequestContentTextObjectSchema = v.strictObject({ + /** + * Always `text`. + */ + type: v.picklist(["text"]), + /** + * Text content to be sent to the model + */ + text: v.string(), +}); +/** + * A citation within the message that points to a specific quote from a + * specific File associated with the assistant or the message. Generated when + * the assistant uses the "file_search" tool to search files. + * @title File citation + */ +export const messageContentTextAnnotationsFileCitationObjectSchema = + v.strictObject({ + /** + * Always `file_citation`. + */ + type: v.picklist(["file_citation"]), + /** + * The text in the message content that needs to be replaced. + */ + text: v.string(), + file_citation: v.strictObject({ + /** + * The ID of the specific File the citation is from. + */ + file_id: v.string(), + }), + start_index: v.pipe(v.number(), v.integer(), v.minValue(0)), + end_index: v.pipe(v.number(), v.integer(), v.minValue(0)), + }); +/** + * A URL for the file that's generated when the assistant used the + * `code_interpreter` tool to generate a file. + * @title File path + */ +export const messageContentTextAnnotationsFilePathObjectSchema = v.strictObject( + { + /** + * Always `file_path`. + */ + type: v.picklist(["file_path"]), + /** + * The text in the message content that needs to be replaced. + */ + text: v.string(), + file_path: v.strictObject({ + /** + * The ID of the file that was generated. + */ + file_id: v.string(), + }), + start_index: v.pipe(v.number(), v.integer(), v.minValue(0)), + end_index: v.pipe(v.number(), v.integer(), v.minValue(0)), + }, +); +/** + * The text content that is part of a message. + * @title Text + */ +export const messageDeltaContentTextObjectSchema = v.strictObject({ + /** + * The index of the content part in the message. + */ + index: v.pipe(v.number(), v.integer()), + /** + * Always `text`. + */ + type: v.picklist(["text"]), + text: v.exactOptional( + v.strictObject({ + /** + * The data that makes up the text. + */ + value: v.exactOptional(v.string()), + annotations: v.exactOptional( + v.array(v.union([v.unknown(), v.unknown()])), + ), + }), + ), +}); +/** + * The refusal content that is part of a message. + * @title Refusal + */ +export const messageDeltaContentRefusalObjectSchema = v.strictObject({ + /** + * The index of the refusal part in the message. + */ + index: v.pipe(v.number(), v.integer()), + /** + * Always `refusal`. + */ + type: v.picklist(["refusal"]), + refusal: v.exactOptional(v.string()), +}); +/** + * A citation within the message that points to a specific quote from a + * specific File associated with the assistant or the message. Generated when + * the assistant uses the "file_search" tool to search files. + * @title File citation + */ +export const messageDeltaContentTextAnnotationsFileCitationObjectSchema = + v.strictObject({ + /** + * The index of the annotation in the text content part. + */ + index: v.pipe(v.number(), v.integer()), + /** + * Always `file_citation`. + */ + type: v.picklist(["file_citation"]), + /** + * The text in the message content that needs to be replaced. + */ + text: v.exactOptional(v.string()), + file_citation: v.exactOptional( + v.strictObject({ + /** + * The ID of the specific File the citation is from. + */ + file_id: v.exactOptional(v.string()), + /** + * The specific quote in the file. + */ + quote: v.exactOptional(v.string()), + }), + ), + start_index: v.exactOptional( + v.pipe(v.number(), v.integer(), v.minValue(0)), + ), + end_index: v.exactOptional(v.pipe(v.number(), v.integer(), v.minValue(0))), + }); +/** + * A URL for the file that's generated when the assistant used the + * `code_interpreter` tool to generate a file. + * @title File path + */ +export const messageDeltaContentTextAnnotationsFilePathObjectSchema = + v.strictObject({ + /** + * The index of the annotation in the text content part. + */ + index: v.pipe(v.number(), v.integer()), + /** + * Always `file_path`. + */ + type: v.picklist(["file_path"]), + /** + * The text in the message content that needs to be replaced. + */ + text: v.exactOptional(v.string()), + file_path: v.exactOptional( + v.strictObject({ + /** + * The ID of the file that was generated. + */ + file_id: v.exactOptional(v.string()), + }), + ), + start_index: v.exactOptional( + v.pipe(v.number(), v.integer(), v.minValue(0)), + ), + end_index: v.exactOptional(v.pipe(v.number(), v.integer(), v.minValue(0))), + }); +/** + * Details of the Code Interpreter tool call the run step was involved in. + * @title Code Interpreter tool call + */ +export const runStepDetailsToolCallsCodeObjectSchema = v.strictObject({ + /** + * The ID of the tool call. + */ + id: v.string(), + /** + * The type of tool call. This is always going to be `code_interpreter` for + * this type of tool call. + */ + type: v.picklist(["code_interpreter"]), + /** + * The Code Interpreter tool call definition. + */ + code_interpreter: v.strictObject({ + /** + * The input to the Code Interpreter tool call. + */ + input: v.string(), + /** + * The outputs from the Code Interpreter tool call. Code Interpreter can + * output one or more items, including text (`logs`) or images (`image`). Each + * of these are represented by a different object type. + */ + outputs: v.array(v.union([v.unknown(), v.unknown()])), + }), +}); +/** + * Details of the Code Interpreter tool call the run step was involved in. + * @title Code interpreter tool call + */ +export const runStepDeltaStepDetailsToolCallsCodeObjectSchema = v.strictObject({ + /** + * The index of the tool call in the tool calls array. + */ + index: v.pipe(v.number(), v.integer()), + /** + * The ID of the tool call. + */ + id: v.exactOptional(v.string()), + /** + * The type of tool call. This is always going to be `code_interpreter` for + * this type of tool call. + */ + type: v.picklist(["code_interpreter"]), + /** + * The Code Interpreter tool call definition. + */ + code_interpreter: v.exactOptional( + v.strictObject({ + /** + * The input to the Code Interpreter tool call. + */ + input: v.exactOptional(v.string()), + /** + * The outputs from the Code Interpreter tool call. Code Interpreter can + * output one or more items, including text (`logs`) or images (`image`). Each + * of these are represented by a different object type. + */ + outputs: v.exactOptional(v.array(v.union([v.unknown(), v.unknown()]))), + }), + ), +}); +/** + * Text output from the Code Interpreter tool call as part of a run step. + * @title Code Interpreter log output + */ +export const runStepDetailsToolCallsCodeOutputLogsObjectSchema = v.strictObject( + { + /** + * Always `logs`. + */ + type: v.picklist(["logs"]), + /** + * The text output from the Code Interpreter tool call. + */ + logs: v.string(), + }, +); +/** + * Text output from the Code Interpreter tool call as part of a run step. + * @title Code interpreter log output + */ +export const runStepDeltaStepDetailsToolCallsCodeOutputLogsObjectSchema = + v.strictObject({ + /** + * The index of the output in the outputs array. + */ + index: v.pipe(v.number(), v.integer()), + /** + * Always `logs`. + */ + type: v.picklist(["logs"]), + /** + * The text output from the Code Interpreter tool call. + */ + logs: v.exactOptional(v.string()), + }); +export const runStepDetailsToolCallsCodeOutputImageObjectSchema = + v.strictObject({ + /** + * Always `image`. + */ + type: v.picklist(["image"]), + image: v.strictObject({ + /** + * The [file](/docs/api-reference/files) ID of the image. + */ + file_id: v.string(), + }), + }); +export const runStepDeltaStepDetailsToolCallsCodeOutputImageObjectSchema = + v.strictObject({ + /** + * The index of the output in the outputs array. + */ + index: v.pipe(v.number(), v.integer()), + /** + * Always `image`. + */ + type: v.picklist(["image"]), + image: v.exactOptional( + v.strictObject({ + /** + * The [file](/docs/api-reference/files) ID of the image. + */ + file_id: v.exactOptional(v.string()), + }), + ), + }); +export const runStepDeltaStepDetailsToolCallsFileSearchObjectSchema = + v.strictObject({ + /** + * The index of the tool call in the tool calls array. + */ + index: v.pipe(v.number(), v.integer()), + /** + * The ID of the tool call object. + */ + id: v.exactOptional(v.string()), + /** + * The type of tool call. This is always going to be `file_search` for this + * type of tool call. + */ + type: v.picklist(["file_search"]), + /** + * For now, this is always going to be an empty object. + */ + file_search: v.record(v.string(), v.unknown()), + }); +export const runStepDetailsToolCallsFunctionObjectSchema = v.strictObject({ + /** + * The ID of the tool call object. + */ + id: v.string(), + /** + * The type of tool call. This is always going to be `function` for this type + * of tool call. + */ + type: v.picklist(["function"]), + /** + * The definition of the function that was called. + */ + function: v.strictObject({ + /** + * The name of the function. + */ + name: v.string(), + /** + * The arguments passed to the function. + */ + arguments: v.string(), + /** + * The output of the function. This will be `null` if the outputs have not + * been [submitted](/docs/api-reference/runs/submitToolOutputs) yet. + */ + output: v.nullable(v.string()), + }), +}); +export const runStepDeltaStepDetailsToolCallsFunctionObjectSchema = + v.strictObject({ + /** + * The index of the tool call in the tool calls array. + */ + index: v.pipe(v.number(), v.integer()), + /** + * The ID of the tool call object. + */ + id: v.exactOptional(v.string()), + /** + * The type of tool call. This is always going to be `function` for this type + * of tool call. + */ + type: v.picklist(["function"]), + /** + * The definition of the function that was called. + */ + function: v.exactOptional( + v.strictObject({ + /** + * The name of the function. + */ + name: v.exactOptional(v.string()), + /** + * The arguments passed to the function. + */ + arguments: v.exactOptional(v.string()), + /** + * The output of the function. This will be `null` if the outputs have not + * been [submitted](/docs/api-reference/runs/submitToolOutputs) yet. + */ + output: v.exactOptional(v.nullable(v.string())), + }), + ), + }); +export const deleteVectorStoreResponseSchema = v.strictObject({ + id: v.string(), + deleted: v.boolean(), + object: v.picklist(["vector_store.deleted"]), +}); +export const deleteVectorStoreFileResponseSchema = v.strictObject({ + id: v.string(), + deleted: v.boolean(), + object: v.picklist(["vector_store.file.deleted"]), +}); +/** + * A batch of files attached to a vector store. + * @title Vector store file batch + */ +export const vectorStoreFileBatchObjectSchema = v.strictObject({ + /** + * The identifier, which can be referenced in API endpoints. + */ + id: v.string(), + /** + * The object type, which is always `vector_store.file_batch`. + */ + object: v.picklist(["vector_store.files_batch"]), + /** + * The Unix timestamp (in seconds) for when the vector store files batch was + * created. + */ + created_at: v.pipe(v.number(), v.integer()), + /** + * The ID of the [vector store](/docs/api-reference/vector-stores/object) that + * the [File](/docs/api-reference/files) is attached to. + */ + vector_store_id: v.string(), + /** + * The status of the vector store files batch, which can be either + * `in_progress`, `completed`, `cancelled` or `failed`. + */ + status: v.picklist(["in_progress", "completed", "cancelled", "failed"]), + file_counts: v.strictObject({ + /** + * The number of files that are currently being processed. + */ + in_progress: v.pipe(v.number(), v.integer()), + /** + * The number of files that have been processed. + */ + completed: v.pipe(v.number(), v.integer()), + /** + * The number of files that have failed to process. + */ + failed: v.pipe(v.number(), v.integer()), + /** + * The number of files that where cancelled. + */ + cancelled: v.pipe(v.number(), v.integer()), + /** + * The total number of files. + */ + total: v.pipe(v.number(), v.integer()), + }), +}); +/** The per-line object of the batch input file */ +export const batchRequestInputSchema = v.strictObject({ + /** + * A developer-provided per-request id that will be used to match outputs to + * inputs. Must be unique for each request in a batch. + */ + custom_id: v.exactOptional(v.string()), + /** + * The HTTP method to be used for the request. Currently only `POST` is + * supported. + */ + method: v.exactOptional(v.picklist(["POST"])), + /** + * The OpenAI API relative URL to be used for the request. Currently + * `/v1/chat/completions`, `/v1/embeddings`, and `/v1/completions` are + * supported. + */ + url: v.exactOptional(v.string()), +}); +/** The per-line object of the batch output and error files */ +export const batchRequestOutputSchema = v.strictObject({ + id: v.exactOptional(v.string()), + /** + * A developer-provided per-request id that will be used to match outputs to + * inputs. + */ + custom_id: v.exactOptional(v.string()), + response: v.exactOptional( + v.nullable( + v.strictObject({ + /** + * The HTTP status code of the response + */ + status_code: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * An unique identifier for the OpenAI API request. Please include this + * request ID when contacting support. + */ + request_id: v.exactOptional(v.string()), + /** + * The JSON body of the response + */ + body: v.exactOptional(v.record(v.string(), v.unknown())), + }), + ), + ), + /** + * For requests that failed with a non-HTTP error, this will contain more + * information on the cause of the failure. + */ + error: v.exactOptional( + v.nullable( + v.strictObject({ + /** + * A machine-readable error code. + */ + code: v.exactOptional(v.string()), + /** + * A human-readable error message. + */ + message: v.exactOptional(v.string()), + }), + ), + ), +}); +export const inviteRequestSchema = v.strictObject({ + /** + * Send an email to this address + */ + email: v.string(), + /** + * `owner` or `reader` + */ + role: v.picklist(["reader", "owner"]), +}); +export const inviteDeleteResponseSchema = v.strictObject({ + /** + * The object type, which is always `organization.invite.deleted` + */ + object: v.picklist(["organization.invite.deleted"]), + id: v.string(), + deleted: v.boolean(), +}); +export const userRoleUpdateRequestSchema = v.strictObject({ + /** + * `owner` or `reader` + */ + role: v.picklist(["owner", "reader"]), +}); +export const userDeleteResponseSchema = v.strictObject({ + object: v.picklist(["organization.user.deleted"]), + id: v.string(), + deleted: v.boolean(), +}); +export const projectCreateRequestSchema = v.strictObject({ + /** + * The friendly name of the project, this name appears in reports. + */ + name: v.string(), + /** + * A description of your business, project, or use case. [Why we need this + * information](https://help.openai.com/en/articles/9824607-api-platform-verifications). + */ + app_use_case: v.exactOptional(v.string()), + /** + * Your business URL, or if you don't have one yet, a URL to your LinkedIn or + * other social media. [Why we need this + * information](https://help.openai.com/en/articles/9824607-api-platform-verifications). + */ + business_website: v.exactOptional(v.string()), +}); +export const projectUpdateRequestSchema = v.strictObject({ + /** + * The updated name of the project, this name appears in reports. + */ + name: v.string(), + /** + * A description of your business, project, or use case. [Why we need this + * information](https://help.openai.com/en/articles/9824607-api-platform-verifications). + */ + app_use_case: v.exactOptional(v.string()), + /** + * Your business URL, or if you don't have one yet, a URL to your LinkedIn or + * other social media. [Why we need this + * information](https://help.openai.com/en/articles/9824607-api-platform-verifications). + */ + business_website: v.exactOptional(v.string()), +}); +export const defaultProjectErrorResponseSchema = v.strictObject({ + code: v.pipe(v.number(), v.integer()), + message: v.string(), +}); +export const projectUserCreateRequestSchema = v.strictObject({ + /** + * The ID of the user. + */ + user_id: v.string(), + /** + * `owner` or `member` + */ + role: v.picklist(["owner", "member"]), +}); +export const projectUserUpdateRequestSchema = v.strictObject({ + /** + * `owner` or `member` + */ + role: v.picklist(["owner", "member"]), +}); +export const projectUserDeleteResponseSchema = v.strictObject({ + object: v.picklist(["organization.project.user.deleted"]), + id: v.string(), + deleted: v.boolean(), +}); +export const projectServiceAccountCreateRequestSchema = v.strictObject({ + /** + * The name of the service account being created. + */ + name: v.string(), +}); +export const projectServiceAccountDeleteResponseSchema = v.strictObject({ + object: v.picklist(["organization.project.service_account.deleted"]), + id: v.string(), + deleted: v.boolean(), +}); +export const projectApiKeyDeleteResponseSchema = v.strictObject({ + object: v.picklist(["organization.project.api_key.deleted"]), + id: v.string(), + deleted: v.boolean(), +}); +/** Represents an individual service account in a project. */ +export const projectServiceAccountSchema = v.strictObject({ + /** + * The object type, which is always `organization.project.service_account` + */ + object: v.picklist(["organization.project.service_account"]), + /** + * The identifier, which can be referenced in API endpoints + */ + id: v.string(), + /** + * The name of the service account + */ + name: v.string(), + /** + * `owner` or `member` + */ + role: v.picklist(["owner", "member"]), + /** + * The Unix timestamp (in seconds) of when the service account was created + */ + created_at: v.pipe(v.number(), v.integer()), +}); +/** Represents an individual user in a project. */ +export const projectUserSchema = v.strictObject({ + /** + * The object type, which is always `organization.project.user` + */ + object: v.picklist(["organization.project.user"]), + /** + * The identifier, which can be referenced in API endpoints + */ + id: v.string(), + /** + * The name of the user + */ + name: v.string(), + /** + * The email address of the user + */ + email: v.string(), + /** + * `owner` or `member` + */ + role: v.picklist(["owner", "member"]), + /** + * The Unix timestamp (in seconds) of when the project was added. + */ + added_at: v.pipe(v.number(), v.integer()), +}); +/** Represents an individual API key in a project. */ +export const projectApiKeySchema = v.strictObject({ + /** + * The object type, which is always `organization.project.api_key` + */ + object: v.picklist(["organization.project.api_key"]), + /** + * The redacted value of the API key + */ + redacted_value: v.string(), + /** + * The name of the API key + */ + name: v.string(), + /** + * The Unix timestamp (in seconds) of when the API key was created + */ + created_at: v.pipe(v.number(), v.integer()), + /** + * The identifier, which can be referenced in API endpoints + */ + id: v.string(), + owner: v.strictObject({ + /** + * `user` or `service_account` + */ + type: v.exactOptional(v.picklist(["user", "service_account"])), + user: v.exactOptional(projectUserSchema), + service_account: v.exactOptional(projectServiceAccountSchema), + }), +}); +export const projectApiKeyListResponseSchema = v.strictObject({ + object: v.picklist(["list"]), + data: v.array(projectApiKeySchema), + first_id: v.string(), + last_id: v.string(), + has_more: v.boolean(), +}); +export const projectServiceAccountApiKeySchema = v.strictObject({ + /** + * The object type, which is always + * `organization.project.service_account.api_key` + */ + object: v.picklist(["organization.project.service_account.api_key"]), + value: v.string(), + name: v.string(), + created_at: v.pipe(v.number(), v.integer()), + id: v.string(), +}); +export const projectServiceAccountCreateResponseSchema = v.strictObject({ + object: v.picklist(["organization.project.service_account"]), + id: v.string(), + name: v.string(), + /** + * Service accounts can only have one role of type `member` + */ + role: v.picklist(["member"]), + created_at: v.pipe(v.number(), v.integer()), + api_key: projectServiceAccountApiKeySchema, +}); +export const projectServiceAccountListResponseSchema = v.strictObject({ + object: v.picklist(["list"]), + data: v.array(projectServiceAccountSchema), + first_id: v.string(), + last_id: v.string(), + has_more: v.boolean(), +}); +export const projectUserListResponseSchema = v.strictObject({ + object: v.string(), + data: v.array(projectUserSchema), + first_id: v.string(), + last_id: v.string(), + has_more: v.boolean(), +}); +/** Represents an individual project. */ +export const projectSchema = v.strictObject({ + /** + * The identifier, which can be referenced in API endpoints + */ + id: v.string(), + /** + * The object type, which is always `organization.project` + */ + object: v.picklist(["organization.project"]), + /** + * The name of the project. This appears in reporting. + */ + name: v.string(), + /** + * The Unix timestamp (in seconds) of when the project was created. + */ + created_at: v.pipe(v.number(), v.integer()), + /** + * The Unix timestamp (in seconds) of when the project was archived or `null`. + */ + archived_at: v.exactOptional(v.nullable(v.pipe(v.number(), v.integer()))), + /** + * `active` or `archived` + */ + status: v.picklist(["active", "archived"]), + /** + * A description of your business, project, or use case. [Why we need this + * information](https://help.openai.com/en/articles/9824607-api-platform-verifications). + */ + app_use_case: v.exactOptional(v.string()), + /** + * Your business URL, or if you don't have one yet, a URL to your LinkedIn or + * other social media. [Why we need this + * information](https://help.openai.com/en/articles/9824607-api-platform-verifications). + */ + business_website: v.exactOptional(v.string()), +}); +export const projectListResponseSchema = v.strictObject({ + object: v.picklist(["list"]), + data: v.array(projectSchema), + first_id: v.string(), + last_id: v.string(), + has_more: v.boolean(), +}); +/** Represents an individual `user` within an organization. */ +export const userSchema = v.strictObject({ + /** + * The object type, which is always `organization.user` + */ + object: v.picklist(["organization.user"]), + /** + * The identifier, which can be referenced in API endpoints + */ + id: v.string(), + /** + * The name of the user + */ + name: v.string(), + /** + * The email address of the user + */ + email: v.string(), + /** + * `owner` or `reader` + */ + role: v.picklist(["owner", "reader"]), + /** + * The Unix timestamp (in seconds) of when the user was added. + */ + added_at: v.pipe(v.number(), v.integer()), +}); +export const userListResponseSchema = v.strictObject({ + object: v.picklist(["list"]), + data: v.array(userSchema), + first_id: v.string(), + last_id: v.string(), + has_more: v.boolean(), +}); +/** Represents an individual `invite` to the organization. */ +export const inviteSchema = v.strictObject({ + /** + * The object type, which is always `organization.invite` + */ + object: v.picklist(["organization.invite"]), + /** + * The identifier, which can be referenced in API endpoints + */ + id: v.string(), + /** + * The email address of the individual to whom the invite was sent + */ + email: v.string(), + /** + * `owner` or `reader` + */ + role: v.picklist(["owner", "reader"]), + /** + * `accepted`,`expired`, or `pending` + */ + status: v.picklist(["accepted", "expired", "pending"]), + /** + * The Unix timestamp (in seconds) of when the invite was sent. + */ + invited_at: v.pipe(v.number(), v.integer()), + /** + * The Unix timestamp (in seconds) of when the invite expires. + */ + expires_at: v.pipe(v.number(), v.integer()), + /** + * The Unix timestamp (in seconds) of when the invite was accepted. + */ + accepted_at: v.exactOptional(v.pipe(v.number(), v.integer())), +}); +export const inviteListResponseSchema = v.strictObject({ + /** + * The object type, which is always `list` + */ + object: v.picklist(["list"]), + data: v.array(inviteSchema), + /** + * The first `invite_id` in the retrieved `list` + */ + first_id: v.exactOptional(v.string()), + /** + * The last `invite_id` in the retrieved `list` + */ + last_id: v.exactOptional(v.string()), + /** + * The `has_more` property is used for pagination to indicate there are + * additional results. + */ + has_more: v.exactOptional(v.boolean()), +}); +/** The service account that performed the audit logged action. */ +export const auditLogActorServiceAccountSchema = v.strictObject({ + /** + * The service account id. + */ + id: v.exactOptional(v.string()), +}); +/** The user who performed the audit logged action. */ +export const auditLogActorUserSchema = v.strictObject({ + /** + * The user id. + */ + id: v.exactOptional(v.string()), + /** + * The user email. + */ + email: v.exactOptional(v.string()), +}); +/** The API Key used to perform the audit logged action. */ +export const auditLogActorApiKeySchema = v.strictObject({ + /** + * The tracking id of the API key. + */ + id: v.exactOptional(v.string()), + /** + * The type of API key. Can be either `user` or `service_account`. + */ + type: v.exactOptional(v.picklist(["user", "service_account"])), + user: v.exactOptional(auditLogActorUserSchema), + service_account: v.exactOptional(auditLogActorServiceAccountSchema), +}); +/** The session in which the audit logged action was performed. */ +export const auditLogActorSessionSchema = v.strictObject({ + user: v.exactOptional(auditLogActorUserSchema), + /** + * The IP address from which the action was performed. + */ + ip_address: v.exactOptional(v.string()), +}); +/** The actor who performed the audit logged action. */ +export const auditLogActorSchema = v.strictObject({ + /** + * The type of actor. Is either `session` or `api_key`. + */ + type: v.exactOptional(v.picklist(["session", "api_key"])), + session: v.exactOptional(auditLogActorSessionSchema), + api_key: v.exactOptional(auditLogActorApiKeySchema), +}); +/** The event type. */ +export const auditLogEventTypeSchema = v.picklist([ + "api_key.created", + "api_key.updated", + "api_key.deleted", + "invite.sent", + "invite.accepted", + "invite.deleted", + "login.succeeded", + "login.failed", + "logout.succeeded", + "logout.failed", + "organization.updated", + "project.created", + "project.updated", + "project.archived", + "service_account.created", + "service_account.updated", + "service_account.deleted", + "user.added", + "user.updated", + "user.deleted", +]); +/** A log of a user action or configuration change within this organization. */ +export const auditLogSchema = v.strictObject({ + /** + * The ID of this log. + */ + id: v.string(), + type: auditLogEventTypeSchema, + /** + * The Unix timestamp (in seconds) of the event. + */ + effective_at: v.pipe(v.number(), v.integer()), + /** + * The project that the action was scoped to. Absent for actions not scoped to + * projects. + */ + project: v.exactOptional( + v.strictObject({ + /** + * The project ID. + */ + id: v.exactOptional(v.string()), + /** + * The project title. + */ + name: v.exactOptional(v.string()), + }), + ), + actor: auditLogActorSchema, + /** + * The details for events with this `type`. + */ + "api_key.created": v.exactOptional( + v.strictObject({ + /** + * The tracking ID of the API key. + */ + id: v.exactOptional(v.string()), + /** + * The payload used to create the API key. + */ + data: v.exactOptional( + v.strictObject({ + /** + * A list of scopes allowed for the API key, e.g. `["api.model.request"]` + */ + scopes: v.exactOptional(v.array(v.string())), + }), + ), + }), + ), + /** + * The details for events with this `type`. + */ + "api_key.updated": v.exactOptional( + v.strictObject({ + /** + * The tracking ID of the API key. + */ + id: v.exactOptional(v.string()), + /** + * The payload used to update the API key. + */ + changes_requested: v.exactOptional( + v.strictObject({ + /** + * A list of scopes allowed for the API key, e.g. `["api.model.request"]` + */ + scopes: v.exactOptional(v.array(v.string())), + }), + ), + }), + ), + /** + * The details for events with this `type`. + */ + "api_key.deleted": v.exactOptional( + v.strictObject({ + /** + * The tracking ID of the API key. + */ + id: v.exactOptional(v.string()), + }), + ), + /** + * The details for events with this `type`. + */ + "invite.sent": v.exactOptional( + v.strictObject({ + /** + * The ID of the invite. + */ + id: v.exactOptional(v.string()), + /** + * The payload used to create the invite. + */ + data: v.exactOptional( + v.strictObject({ + /** + * The email invited to the organization. + */ + email: v.exactOptional(v.string()), + /** + * The role the email was invited to be. Is either `owner` or `member`. + */ + role: v.exactOptional(v.string()), + }), + ), + }), + ), + /** + * The details for events with this `type`. + */ + "invite.accepted": v.exactOptional( + v.strictObject({ + /** + * The ID of the invite. + */ + id: v.exactOptional(v.string()), + }), + ), + /** + * The details for events with this `type`. + */ + "invite.deleted": v.exactOptional( + v.strictObject({ + /** + * The ID of the invite. + */ + id: v.exactOptional(v.string()), + }), + ), + /** + * The details for events with this `type`. + */ + "login.failed": v.exactOptional( + v.strictObject({ + /** + * The error code of the failure. + */ + error_code: v.exactOptional(v.string()), + /** + * The error message of the failure. + */ + error_message: v.exactOptional(v.string()), + }), + ), + /** + * The details for events with this `type`. + */ + "logout.failed": v.exactOptional( + v.strictObject({ + /** + * The error code of the failure. + */ + error_code: v.exactOptional(v.string()), + /** + * The error message of the failure. + */ + error_message: v.exactOptional(v.string()), + }), + ), + /** + * The details for events with this `type`. + */ + "organization.updated": v.exactOptional( + v.strictObject({ + /** + * The organization ID. + */ + id: v.exactOptional(v.string()), + /** + * The payload used to update the organization settings. + */ + changes_requested: v.exactOptional( + v.strictObject({ + /** + * The organization title. + */ + title: v.exactOptional(v.string()), + /** + * The organization description. + */ + description: v.exactOptional(v.string()), + /** + * The organization name. + */ + name: v.exactOptional(v.string()), + settings: v.exactOptional( + v.strictObject({ + /** + * Visibility of the threads page which shows messages created with the + * Assistants API and Playground. One of `ANY_ROLE`, `OWNERS`, or `NONE`. + */ + threads_ui_visibility: v.exactOptional(v.string()), + /** + * Visibility of the usage dashboard which shows activity and costs for your + * organization. One of `ANY_ROLE` or `OWNERS`. + */ + usage_dashboard_visibility: v.exactOptional(v.string()), + }), + ), + }), + ), + }), + ), + /** + * The details for events with this `type`. + */ + "project.created": v.exactOptional( + v.strictObject({ + /** + * The project ID. + */ + id: v.exactOptional(v.string()), + /** + * The payload used to create the project. + */ + data: v.exactOptional( + v.strictObject({ + /** + * The project name. + */ + name: v.exactOptional(v.string()), + /** + * The title of the project as seen on the dashboard. + */ + title: v.exactOptional(v.string()), + }), + ), + }), + ), + /** + * The details for events with this `type`. + */ + "project.updated": v.exactOptional( + v.strictObject({ + /** + * The project ID. + */ + id: v.exactOptional(v.string()), + /** + * The payload used to update the project. + */ + changes_requested: v.exactOptional( + v.strictObject({ + /** + * The title of the project as seen on the dashboard. + */ + title: v.exactOptional(v.string()), + }), + ), + }), + ), + /** + * The details for events with this `type`. + */ + "project.archived": v.exactOptional( + v.strictObject({ + /** + * The project ID. + */ + id: v.exactOptional(v.string()), + }), + ), + /** + * The details for events with this `type`. + */ + "service_account.created": v.exactOptional( + v.strictObject({ + /** + * The service account ID. + */ + id: v.exactOptional(v.string()), + /** + * The payload used to create the service account. + */ + data: v.exactOptional( + v.strictObject({ + /** + * The role of the service account. Is either `owner` or `member`. + */ + role: v.exactOptional(v.string()), + }), + ), + }), + ), + /** + * The details for events with this `type`. + */ + "service_account.updated": v.exactOptional( + v.strictObject({ + /** + * The service account ID. + */ + id: v.exactOptional(v.string()), + /** + * The payload used to updated the service account. + */ + changes_requested: v.exactOptional( + v.strictObject({ + /** + * The role of the service account. Is either `owner` or `member`. + */ + role: v.exactOptional(v.string()), + }), + ), + }), + ), + /** + * The details for events with this `type`. + */ + "service_account.deleted": v.exactOptional( + v.strictObject({ + /** + * The service account ID. + */ + id: v.exactOptional(v.string()), + }), + ), + /** + * The details for events with this `type`. + */ + "user.added": v.exactOptional( + v.strictObject({ + /** + * The user ID. + */ + id: v.exactOptional(v.string()), + /** + * The payload used to add the user to the project. + */ + data: v.exactOptional( + v.strictObject({ + /** + * The role of the user. Is either `owner` or `member`. + */ + role: v.exactOptional(v.string()), + }), + ), + }), + ), + /** + * The details for events with this `type`. + */ + "user.updated": v.exactOptional( + v.strictObject({ + /** + * The project ID. + */ + id: v.exactOptional(v.string()), + /** + * The payload used to update the user. + */ + changes_requested: v.exactOptional( + v.strictObject({ + /** + * The role of the user. Is either `owner` or `member`. + */ + role: v.exactOptional(v.string()), + }), + ), + }), + ), + /** + * The details for events with this `type`. + */ + "user.deleted": v.exactOptional( + v.strictObject({ + /** + * The user ID. + */ + id: v.exactOptional(v.string()), + }), + ), +}); +export const listAuditLogsResponseSchema = v.strictObject({ + object: v.picklist(["list"]), + data: v.array(auditLogSchema), + first_id: v.string(), + last_id: v.string(), + has_more: v.boolean(), +}); +export const batchSchema = v.strictObject({ + id: v.string(), + /** + * The object type, which is always `batch`. + */ + object: v.picklist(["batch"]), + /** + * The OpenAI API endpoint used by the batch. + */ + endpoint: v.string(), + errors: v.exactOptional( + v.strictObject({ + /** + * The object type, which is always `list`. + */ + object: v.exactOptional(v.string()), + data: v.exactOptional( + v.array( + v.strictObject({ + /** + * An error code identifying the error type. + */ + code: v.exactOptional(v.string()), + /** + * A human-readable message providing more details about the error. + */ + message: v.exactOptional(v.string()), + /** + * The name of the parameter that caused the error, if applicable. + */ + param: v.exactOptional(v.nullable(v.string())), + /** + * The line number of the input file where the error occurred, if applicable. + */ + line: v.exactOptional(v.nullable(v.pipe(v.number(), v.integer()))), + }), + ), + ), + }), + ), + /** + * The ID of the input file for the batch. + */ + input_file_id: v.string(), + /** + * The time frame within which the batch should be processed. + */ + completion_window: v.string(), + /** + * The current status of the batch. + */ + status: v.picklist([ + "validating", + "failed", + "in_progress", + "finalizing", + "completed", + "expired", + "cancelling", + "cancelled", + ]), + /** + * The ID of the file containing the outputs of successfully executed + * requests. + */ + output_file_id: v.exactOptional(v.string()), + /** + * The ID of the file containing the outputs of requests with errors. + */ + error_file_id: v.exactOptional(v.string()), + /** + * The Unix timestamp (in seconds) for when the batch was created. + */ + created_at: v.pipe(v.number(), v.integer()), + /** + * The Unix timestamp (in seconds) for when the batch started processing. + */ + in_progress_at: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The Unix timestamp (in seconds) for when the batch will expire. + */ + expires_at: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The Unix timestamp (in seconds) for when the batch started finalizing. + */ + finalizing_at: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The Unix timestamp (in seconds) for when the batch was completed. + */ + completed_at: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The Unix timestamp (in seconds) for when the batch failed. + */ + failed_at: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The Unix timestamp (in seconds) for when the batch expired. + */ + expired_at: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The Unix timestamp (in seconds) for when the batch started cancelling. + */ + cancelling_at: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The Unix timestamp (in seconds) for when the batch was cancelled. + */ + cancelled_at: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * The request counts for different statuses within the batch. + */ + request_counts: v.exactOptional( + v.strictObject({ + /** + * Total number of requests in the batch. + */ + total: v.pipe(v.number(), v.integer()), + /** + * Number of requests that have been completed successfully. + */ + completed: v.pipe(v.number(), v.integer()), + /** + * Number of requests that have failed. + */ + failed: v.pipe(v.number(), v.integer()), + }), + ), + /** + * Set of 16 key-value pairs that can be attached to an object. This can be + * useful for storing additional information about the object in a structured + * format. Keys can be a maximum of 64 characters long and values can be a + * maximum of 512 characters long. + */ + metadata: v.exactOptional(v.nullable(v.record(v.string(), v.unknown()))), +}); +export const listBatchesResponseSchema = v.strictObject({ + data: v.array(batchSchema), + first_id: v.exactOptional(v.string()), + last_id: v.exactOptional(v.string()), + has_more: v.boolean(), + object: v.picklist(["list"]), +}); +/** + * Represents a message delta i.e. any changed fields on a message during + * streaming. + * @title Message delta object + */ +export const messageDeltaObjectSchema = v.strictObject({ + /** + * The identifier of the message, which can be referenced in API endpoints. + */ + id: v.string(), + /** + * The object type, which is always `thread.message.delta`. + */ + object: v.picklist(["thread.message.delta"]), + /** + * The delta containing the fields that have changed on the Message. + */ + delta: v.strictObject({ + /** + * The entity that produced the message. One of `user` or `assistant`. + */ + role: v.exactOptional(v.picklist(["user", "assistant"])), + /** + * The content of the message in array of text and/or images. + */ + content: v.exactOptional( + v.array( + v.union([ + messageDeltaContentImageFileObjectSchema, + messageDeltaContentTextObjectSchema, + messageDeltaContentRefusalObjectSchema, + messageDeltaContentImageUrlObjectSchema, + ]), + ), + ), + }), +}); +/** Occurs when a stream ends. */ +export const doneEventSchema = v.strictObject({ + event: v.picklist(["done"]), + data: v.picklist(["[DONE]"]), +}); +export const errorSchema = v.strictObject({ + code: v.nullable(v.string()), + message: v.string(), + param: v.nullable(v.string()), + type: v.string(), +}); +/** + * Occurs when an [error](/docs/guides/error-codes/api-errors) occurs. This + * can happen due to an internal server error or a timeout. + */ +export const errorEventSchema = v.strictObject({ + event: v.picklist(["error"]), + data: errorSchema, +}); +/** + * Represents a message within a [thread](/docs/api-reference/threads). + * @title The message object + */ +export const messageObjectSchema = v.strictObject({ + /** + * The identifier, which can be referenced in API endpoints. + */ + id: v.string(), + /** + * The object type, which is always `thread.message`. + */ + object: v.picklist(["thread.message"]), + /** + * The Unix timestamp (in seconds) for when the message was created. + */ + created_at: v.pipe(v.number(), v.integer()), + /** + * The [thread](/docs/api-reference/threads) ID that this message belongs to. + */ + thread_id: v.string(), + /** + * The status of the message, which can be either `in_progress`, `incomplete`, + * or `completed`. + */ + status: v.picklist(["in_progress", "incomplete", "completed"]), + /** + * On an incomplete message, details about why the message is incomplete. + */ + incomplete_details: v.nullable( + v.strictObject({ + /** + * The reason the message is incomplete. + */ + reason: v.picklist([ + "content_filter", + "max_tokens", + "run_cancelled", + "run_expired", + "run_failed", + ]), + }), + ), + /** + * The Unix timestamp (in seconds) for when the message was completed. + */ + completed_at: v.nullable(v.pipe(v.number(), v.integer())), + /** + * The Unix timestamp (in seconds) for when the message was marked as + * incomplete. + */ + incomplete_at: v.nullable(v.pipe(v.number(), v.integer())), + /** + * The entity that produced the message. One of `user` or `assistant`. + */ + role: v.picklist(["user", "assistant"]), + /** + * The content of the message in array of text and/or images. + */ + content: v.array( + v.union([ + messageContentImageFileObjectSchema, + messageContentImageUrlObjectSchema, + messageContentTextObjectSchema, + messageContentRefusalObjectSchema, + ]), + ), + /** + * If applicable, the ID of the [assistant](/docs/api-reference/assistants) + * that authored this message. + */ + assistant_id: v.nullable(v.string()), + /** + * The ID of the [run](/docs/api-reference/runs) associated with the creation + * of this message. Value is `null` when messages are created manually using + * the create message or create thread endpoints. + */ + run_id: v.nullable(v.string()), + /** + * A list of files attached to the message, and the tools they were added to. + */ + attachments: v.nullable( + v.array( + v.strictObject({ + /** + * The ID of the file to attach to the message. + */ + file_id: v.exactOptional(v.string()), + /** + * The tools to add this file to. + */ + tools: v.exactOptional( + v.array( + v.union([ + assistantToolsCodeSchema, + assistantToolsFileSearchTypeOnlySchema, + ]), + ), + ), + }), + ), + ), + /** + * Set of 16 key-value pairs that can be attached to an object. This can be + * useful for storing additional information about the object in a structured + * format. Keys can be a maximum of 64 characters long and values can be a + * maximum of 512 characters long. + */ + metadata: v.nullable(v.record(v.string(), v.unknown())), +}); +export const messageStreamEventSchema = v.union([ + v.strictObject({ + event: v.picklist(["thread.message.created"]), + data: messageObjectSchema, + }), + v.strictObject({ + event: v.picklist(["thread.message.in_progress"]), + data: messageObjectSchema, + }), + v.strictObject({ + event: v.picklist(["thread.message.delta"]), + data: messageDeltaObjectSchema, + }), + v.strictObject({ + event: v.picklist(["thread.message.completed"]), + data: messageObjectSchema, + }), + v.strictObject({ + event: v.picklist(["thread.message.incomplete"]), + data: messageObjectSchema, + }), +]); +/** + * Details of the tool call. + * @title Tool calls + */ +export const runStepDeltaStepDetailsToolCallsObjectSchema = v.strictObject({ + /** + * Always `tool_calls`. + */ + type: v.picklist(["tool_calls"]), + /** + * An array of tool calls the run step was involved in. These can be + * associated with one of three types of tools: `code_interpreter`, + * `file_search`, or `function`. + */ + tool_calls: v.exactOptional( + v.array( + v.union([ + runStepDeltaStepDetailsToolCallsCodeObjectSchema, + runStepDeltaStepDetailsToolCallsFileSearchObjectSchema, + runStepDeltaStepDetailsToolCallsFunctionObjectSchema, + ]), + ), + ), +}); +/** + * Details of the message creation by the run step. + * @title Message creation + */ +export const runStepDeltaStepDetailsMessageCreationObjectSchema = + v.strictObject({ + /** + * Always `message_creation`. + */ + type: v.picklist(["message_creation"]), + message_creation: v.exactOptional( + v.strictObject({ + /** + * The ID of the message that was created by this run step. + */ + message_id: v.exactOptional(v.string()), + }), + ), + }); +/** + * Represents a run step delta i.e. any changed fields on a run step during + * streaming. + * @title Run step delta object + */ +export const runStepDeltaObjectSchema = v.strictObject({ + /** + * The identifier of the run step, which can be referenced in API endpoints. + */ + id: v.string(), + /** + * The object type, which is always `thread.run.step.delta`. + */ + object: v.picklist(["thread.run.step.delta"]), + /** + * The delta containing the fields that have changed on the run step. + */ + delta: v.strictObject({ + /** + * The details of the run step. + */ + step_details: v.exactOptional( + v.union([ + runStepDeltaStepDetailsMessageCreationObjectSchema, + runStepDeltaStepDetailsToolCallsObjectSchema, + ]), + ), + }), +}); +/** + * Usage statistics related to the run step. This value will be `null` while + * the run step's status is `in_progress`. + */ +export const runStepCompletionUsageSchema = v.nullable( + v.strictObject({ + /** + * Number of completion tokens used over the course of the run step. + */ + completion_tokens: v.pipe(v.number(), v.integer()), + /** + * Number of prompt tokens used over the course of the run step. + */ + prompt_tokens: v.pipe(v.number(), v.integer()), + /** + * Total number of tokens used (prompt + completion). + */ + total_tokens: v.pipe(v.number(), v.integer()), + }), +); +/** + * Details of the tool call. + * @title Tool calls + */ +export const runStepDetailsToolCallsObjectSchema = v.strictObject({ + /** + * Always `tool_calls`. + */ + type: v.picklist(["tool_calls"]), + /** + * An array of tool calls the run step was involved in. These can be + * associated with one of three types of tools: `code_interpreter`, + * `file_search`, or `function`. + */ + tool_calls: v.array( + v.union([ + runStepDetailsToolCallsCodeObjectSchema, + v.unknown(), + runStepDetailsToolCallsFunctionObjectSchema, + ]), + ), +}); +/** + * Details of the message creation by the run step. + * @title Message creation + */ +export const runStepDetailsMessageCreationObjectSchema = v.strictObject({ + /** + * Always `message_creation`. + */ + type: v.picklist(["message_creation"]), + message_creation: v.strictObject({ + /** + * The ID of the message that was created by this run step. + */ + message_id: v.string(), + }), +}); +/** + * Represents a step in execution of a run. + * @title Run steps + */ +export const runStepObjectSchema = v.strictObject({ + /** + * The identifier of the run step, which can be referenced in API endpoints. + */ + id: v.string(), + /** + * The object type, which is always `thread.run.step`. + */ + object: v.picklist(["thread.run.step"]), + /** + * The Unix timestamp (in seconds) for when the run step was created. + */ + created_at: v.pipe(v.number(), v.integer()), + /** + * The ID of the [assistant](/docs/api-reference/assistants) associated with + * the run step. + */ + assistant_id: v.string(), + /** + * The ID of the [thread](/docs/api-reference/threads) that was run. + */ + thread_id: v.string(), + /** + * The ID of the [run](/docs/api-reference/runs) that this run step is a part + * of. + */ + run_id: v.string(), + /** + * The type of run step, which can be either `message_creation` or + * `tool_calls`. + */ + type: v.picklist(["message_creation", "tool_calls"]), + /** + * The status of the run step, which can be either `in_progress`, `cancelled`, + * `failed`, `completed`, or `expired`. + */ + status: v.picklist([ + "in_progress", + "cancelled", + "failed", + "completed", + "expired", + ]), + /** + * The details of the run step. + */ + step_details: v.union([ + runStepDetailsMessageCreationObjectSchema, + runStepDetailsToolCallsObjectSchema, + ]), + /** + * The last error associated with this run step. Will be `null` if there are + * no errors. + */ + last_error: v.nullable( + v.strictObject({ + /** + * One of `server_error` or `rate_limit_exceeded`. + */ + code: v.picklist(["server_error", "rate_limit_exceeded"]), + /** + * A human-readable description of the error. + */ + message: v.string(), + }), + ), + /** + * The Unix timestamp (in seconds) for when the run step expired. A step is + * considered expired if the parent run is expired. + */ + expired_at: v.nullable(v.pipe(v.number(), v.integer())), + /** + * The Unix timestamp (in seconds) for when the run step was cancelled. + */ + cancelled_at: v.nullable(v.pipe(v.number(), v.integer())), + /** + * The Unix timestamp (in seconds) for when the run step failed. + */ + failed_at: v.nullable(v.pipe(v.number(), v.integer())), + /** + * The Unix timestamp (in seconds) for when the run step completed. + */ + completed_at: v.nullable(v.pipe(v.number(), v.integer())), + /** + * Set of 16 key-value pairs that can be attached to an object. This can be + * useful for storing additional information about the object in a structured + * format. Keys can be a maximum of 64 characters long and values can be a + * maximum of 512 characters long. + */ + metadata: v.nullable(v.record(v.string(), v.unknown())), + usage: runStepCompletionUsageSchema, +}); +export const runStepStreamEventSchema = v.union([ + v.strictObject({ + event: v.picklist(["thread.run.step.created"]), + data: runStepObjectSchema, + }), + v.strictObject({ + event: v.picklist(["thread.run.step.in_progress"]), + data: runStepObjectSchema, + }), + v.strictObject({ + event: v.picklist(["thread.run.step.delta"]), + data: runStepDeltaObjectSchema, + }), + v.strictObject({ + event: v.picklist(["thread.run.step.completed"]), + data: runStepObjectSchema, + }), + v.strictObject({ + event: v.picklist(["thread.run.step.failed"]), + data: runStepObjectSchema, + }), + v.strictObject({ + event: v.picklist(["thread.run.step.cancelled"]), + data: runStepObjectSchema, + }), + v.strictObject({ + event: v.picklist(["thread.run.step.expired"]), + data: runStepObjectSchema, + }), +]); +/** The schema for the response format, described as a JSON Schema object. */ +export const responseFormatJsonSchemaSchemaSchema = v.record( + v.string(), + v.unknown(), +); +export const responseFormatJsonSchemaSchema = v.strictObject({ + /** + * The type of response format being defined: `json_schema` + */ + type: v.picklist(["json_schema"]), + json_schema: v.strictObject({ + /** + * A description of what the response format is for, used by the model to + * determine how to respond in the format. + */ + description: v.exactOptional(v.string()), + /** + * The name of the response format. Must be a-z, A-Z, 0-9, or contain + * underscores and dashes, with a maximum length of 64. + */ + name: v.string(), + schema: v.exactOptional(responseFormatJsonSchemaSchemaSchema), + /** + * Whether to enable strict schema adherence when generating the output. If + * set to true, the model will always follow the exact schema defined in the + * `schema` field. Only a subset of JSON Schema is supported when `strict` is + * `true`. To learn more, read the [Structured Outputs + * guide](/docs/guides/structured-outputs). + */ + strict: v.exactOptional(v.nullable(v.boolean())), + }), +}); +export const responseFormatJsonObjectSchema = v.strictObject({ + /** + * The type of response format being defined: `json_object` + */ + type: v.picklist(["json_object"]), +}); +export const responseFormatTextSchema = v.strictObject({ + /** + * The type of response format being defined: `text` + */ + type: v.picklist(["text"]), +}); +/** + * Specifies the format that the model must output. Compatible with + * [GPT-4o](/docs/models/gpt-4o), [GPT-4 + * Turbo](/docs/models/gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models + * since `gpt-3.5-turbo-1106`. + * + * Setting to `{ "type": "json_schema", "json_schema": {...} }` enables + * Structured Outputs which ensures the model will match your supplied JSON + * schema. Learn more in the [Structured Outputs + * guide](/docs/guides/structured-outputs). + * + * Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the + * message the model generates is valid JSON. + * + * **Important:** when using JSON mode, you **must** also instruct the model + * to produce JSON yourself via a system or user message. Without this, the + * model may generate an unending stream of whitespace until the generation + * reaches the token limit, resulting in a long-running and seemingly "stuck" + * request. Also note that the message content may be partially cut off if + * `finish_reason="length"`, which indicates the generation exceeded + * `max_tokens` or the conversation exceeded the max context length. + */ +export const assistantsApiResponseFormatOptionSchema = v.union([ + v.picklist(["auto"]), + responseFormatTextSchema, + responseFormatJsonObjectSchema, + responseFormatJsonSchemaSchema, +]); +/** + * Whether to enable [parallel function + * calling](/docs/guides/function-calling/parallel-function-calling) during + * tool use. + */ +export const parallelToolCallsSchema = v.boolean(); +/** + * Specifies a tool the model should use. Use to force the model to call a + * specific tool. + */ +export const assistantsNamedToolChoiceSchema = v.strictObject({ + /** + * The type of the tool. If type is `function`, the function name must be set + */ + type: v.picklist(["function", "code_interpreter", "file_search"]), + function: v.exactOptional( + v.strictObject({ + /** + * The name of the function to call. + */ + name: v.string(), + }), + ), +}); +/** + * Controls which (if any) tool is called by the model. + * `none` means the model will not call any tools and instead generates a + * message. + * `auto` is the default value and means the model can pick between generating + * a message or calling one or more tools. + * `required` means the model must call one or more tools before responding to + * the user. + * Specifying a particular tool like `{"type": "file_search"}` or `{"type": + * "function", "function": {"name": "my_function"}}` forces the model to call + * that tool. + */ +export const assistantsApiToolChoiceOptionSchema = v.union([ + v.picklist(["none", "auto", "required"]), + assistantsNamedToolChoiceSchema, +]); +/** + * Controls for how a thread will be truncated prior to the run. Use this to + * control the intial context window of the run. + * @title Thread Truncation Controls + */ +export const truncationObjectSchema = v.strictObject({ + /** + * The truncation strategy to use for the thread. The default is `auto`. If + * set to `last_messages`, the thread will be truncated to the n most recent + * messages in the thread. When set to `auto`, messages in the middle of the + * thread will be dropped to fit the context length of the model, + * `max_prompt_tokens`. + */ + type: v.picklist(["auto", "last_messages"]), + /** + * The number of most recent messages from the thread when constructing the + * context for the run. + */ + last_messages: v.exactOptional( + v.nullable(v.pipe(v.number(), v.integer(), v.minValue(1))), + ), +}); +/** + * Usage statistics related to the run. This value will be `null` if the run + * is not in a terminal state (i.e. `in_progress`, `queued`, etc.). + */ +export const runCompletionUsageSchema = v.nullable( + v.strictObject({ + /** + * Number of completion tokens used over the course of the run. + */ + completion_tokens: v.pipe(v.number(), v.integer()), + /** + * Number of prompt tokens used over the course of the run. + */ + prompt_tokens: v.pipe(v.number(), v.integer()), + /** + * Total number of tokens used (prompt + completion). + */ + total_tokens: v.pipe(v.number(), v.integer()), + }), +); +/** Tool call objects */ +export const runToolCallObjectSchema = v.strictObject({ + /** + * The ID of the tool call. This ID must be referenced when you submit the + * tool outputs in using the [Submit tool outputs to + * run](/docs/api-reference/runs/submitToolOutputs) endpoint. + */ + id: v.string(), + /** + * The type of tool call the output is required for. For now, this is always + * `function`. + */ + type: v.picklist(["function"]), + /** + * The function definition. + */ + function: v.strictObject({ + /** + * The name of the function. + */ + name: v.string(), + /** + * The arguments that the model expects you to pass to the function. + */ + arguments: v.string(), + }), +}); +/** + * Represents an execution run on a [thread](/docs/api-reference/threads). + * @title A run on a thread + */ +export const runObjectSchema = v.strictObject({ + /** + * The identifier, which can be referenced in API endpoints. + */ + id: v.string(), + /** + * The object type, which is always `thread.run`. + */ + object: v.picklist(["thread.run"]), + /** + * The Unix timestamp (in seconds) for when the run was created. + */ + created_at: v.pipe(v.number(), v.integer()), + /** + * The ID of the [thread](/docs/api-reference/threads) that was executed on as + * a part of this run. + */ + thread_id: v.string(), + /** + * The ID of the [assistant](/docs/api-reference/assistants) used for + * execution of this run. + */ + assistant_id: v.string(), + /** + * The status of the run, which can be either `queued`, `in_progress`, + * `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, + * `incomplete`, or `expired`. + */ + status: v.picklist([ + "queued", + "in_progress", + "requires_action", + "cancelling", + "cancelled", + "failed", + "completed", + "incomplete", + "expired", + ]), + /** + * Details on the action required to continue the run. Will be `null` if no + * action is required. + */ + required_action: v.nullable( + v.strictObject({ + /** + * For now, this is always `submit_tool_outputs`. + */ + type: v.picklist(["submit_tool_outputs"]), + /** + * Details on the tool outputs needed for this run to continue. + */ + submit_tool_outputs: v.strictObject({ + /** + * A list of the relevant tool calls. + */ + tool_calls: v.array(runToolCallObjectSchema), + }), + }), + ), + /** + * The last error associated with this run. Will be `null` if there are no + * errors. + */ + last_error: v.nullable( + v.strictObject({ + /** + * One of `server_error`, `rate_limit_exceeded`, or `invalid_prompt`. + */ + code: v.picklist([ + "server_error", + "rate_limit_exceeded", + "invalid_prompt", + ]), + /** + * A human-readable description of the error. + */ + message: v.string(), + }), + ), + /** + * The Unix timestamp (in seconds) for when the run will expire. + */ + expires_at: v.nullable(v.pipe(v.number(), v.integer())), + /** + * The Unix timestamp (in seconds) for when the run was started. + */ + started_at: v.nullable(v.pipe(v.number(), v.integer())), + /** + * The Unix timestamp (in seconds) for when the run was cancelled. + */ + cancelled_at: v.nullable(v.pipe(v.number(), v.integer())), + /** + * The Unix timestamp (in seconds) for when the run failed. + */ + failed_at: v.nullable(v.pipe(v.number(), v.integer())), + /** + * The Unix timestamp (in seconds) for when the run was completed. + */ + completed_at: v.nullable(v.pipe(v.number(), v.integer())), + /** + * Details on why the run is incomplete. Will be `null` if the run is not + * incomplete. + */ + incomplete_details: v.nullable( + v.strictObject({ + /** + * The reason why the run is incomplete. This will point to which specific + * token limit was reached over the course of the run. + */ + reason: v.exactOptional( + v.picklist(["max_completion_tokens", "max_prompt_tokens"]), + ), + }), + ), + /** + * The model that the [assistant](/docs/api-reference/assistants) used for + * this run. + */ + model: v.string(), + /** + * The instructions that the [assistant](/docs/api-reference/assistants) used + * for this run. + */ + instructions: v.string(), + /** + * The list of tools that the [assistant](/docs/api-reference/assistants) used + * for this run. + */ + tools: v.pipe( + v.array(v.union([assistantToolsCodeSchema, v.unknown(), v.unknown()])), + v.maxLength(20), + ), + /** + * Set of 16 key-value pairs that can be attached to an object. This can be + * useful for storing additional information about the object in a structured + * format. Keys can be a maximum of 64 characters long and values can be a + * maximum of 512 characters long. + */ + metadata: v.nullable(v.record(v.string(), v.unknown())), + usage: runCompletionUsageSchema, + /** + * The sampling temperature used for this run. If not set, defaults to 1. + */ + temperature: v.exactOptional(v.nullable(v.number())), + /** + * The nucleus sampling value used for this run. If not set, defaults to 1. + */ + top_p: v.exactOptional(v.nullable(v.number())), + /** + * The maximum number of prompt tokens specified to have been used over the + * course of the run. + */ + max_prompt_tokens: v.nullable( + v.pipe(v.number(), v.integer(), v.minValue(256)), + ), + /** + * The maximum number of completion tokens specified to have been used over + * the course of the run. + */ + max_completion_tokens: v.nullable( + v.pipe(v.number(), v.integer(), v.minValue(256)), + ), + truncation_strategy: truncationObjectSchema, + tool_choice: assistantsApiToolChoiceOptionSchema, + parallel_tool_calls: parallelToolCallsSchema, + response_format: assistantsApiResponseFormatOptionSchema, +}); +export const runStreamEventSchema = v.union([ + v.strictObject({ + event: v.picklist(["thread.run.created"]), + data: runObjectSchema, + }), + v.strictObject({ + event: v.picklist(["thread.run.queued"]), + data: runObjectSchema, + }), + v.strictObject({ + event: v.picklist(["thread.run.in_progress"]), + data: runObjectSchema, + }), + v.strictObject({ + event: v.picklist(["thread.run.requires_action"]), + data: runObjectSchema, + }), + v.strictObject({ + event: v.picklist(["thread.run.completed"]), + data: runObjectSchema, + }), + v.strictObject({ + event: v.picklist(["thread.run.incomplete"]), + data: runObjectSchema, + }), + v.strictObject({ + event: v.picklist(["thread.run.failed"]), + data: runObjectSchema, + }), + v.strictObject({ + event: v.picklist(["thread.run.cancelling"]), + data: runObjectSchema, + }), + v.strictObject({ + event: v.picklist(["thread.run.cancelled"]), + data: runObjectSchema, + }), + v.strictObject({ + event: v.picklist(["thread.run.expired"]), + data: runObjectSchema, + }), +]); +/** + * Represents a thread that contains [messages](/docs/api-reference/messages). + * @title Thread + */ +export const threadObjectSchema = v.strictObject({ + /** + * The identifier, which can be referenced in API endpoints. + */ + id: v.string(), + /** + * The object type, which is always `thread`. + */ + object: v.picklist(["thread"]), + /** + * The Unix timestamp (in seconds) for when the thread was created. + */ + created_at: v.pipe(v.number(), v.integer()), + /** + * A set of resources that are made available to the assistant's tools in this + * thread. The resources are specific to the type of tool. For example, the + * `code_interpreter` tool requires a list of file IDs, while the + * `file_search` tool requires a list of vector store IDs. + */ + tool_resources: v.nullable( + v.strictObject({ + code_interpreter: v.exactOptional( + v.strictObject({ + /** + * A list of [file](/docs/api-reference/files) IDs made available to the + * `code_interpreter` tool. There can be a maximum of 20 files associated with + * the tool. + */ + file_ids: v.exactOptional( + v.pipe(v.array(v.string()), v.maxLength(20)), + ), + }), + ), + file_search: v.exactOptional( + v.strictObject({ + /** + * The [vector store](/docs/api-reference/vector-stores/object) attached to + * this thread. There can be a maximum of 1 vector store attached to the + * thread. + */ + vector_store_ids: v.exactOptional( + v.pipe(v.array(v.string()), v.maxLength(1)), + ), + }), + ), + }), + ), + /** + * Set of 16 key-value pairs that can be attached to an object. This can be + * useful for storing additional information about the object in a structured + * format. Keys can be a maximum of 64 characters long and values can be a + * maximum of 512 characters long. + */ + metadata: v.nullable(v.record(v.string(), v.unknown())), +}); +export const threadStreamEventSchema = v.union([ + v.strictObject({ + event: v.picklist(["thread.created"]), + data: threadObjectSchema, + }), +]); +/** + * Represents an event emitted when streaming a Run. + * + * Each event in a server-sent events stream has an `event` and `data` + * property: + * + * ``` + * event: thread.created + * data: {"id": "thread_123", "object": "thread", ...} + * ``` + * + * We emit events whenever a new object is created, transitions to a new + * state, or is being + * streamed in parts (deltas). For example, we emit `thread.run.created` when + * a new run + * is created, `thread.run.completed` when a run completes, and so on. When an + * Assistant chooses + * to create a message during a run, we emit a `thread.message.created event`, + * a + * `thread.message.in_progress` event, many `thread.message.delta` events, and + * finally a + * `thread.message.completed` event. + * + * We may add additional events over time, so we recommend handling unknown + * events gracefully + * in your code. See the [Assistants API + * quickstart](/docs/assistants/overview) to learn how to + * integrate the Assistants API with streaming. + */ +export const assistantStreamEventSchema = v.union([ + threadStreamEventSchema, + runStreamEventSchema, + runStepStreamEventSchema, + messageStreamEventSchema, + errorEventSchema, + doneEventSchema, +]); +export const staticChunkingStrategySchema = v.strictObject({ + /** + * The maximum number of tokens in each chunk. The default value is `800`. The + * minimum value is `100` and the maximum value is `4096`. + */ + max_chunk_size_tokens: v.pipe( + v.number(), + v.integer(), + v.minValue(100), + v.maxValue(4096), + ), + /** + * The number of tokens that overlap between chunks. The default value is + * `400`. + * + * Note that the overlap must not exceed half of `max_chunk_size_tokens`. + */ + chunk_overlap_tokens: v.pipe(v.number(), v.integer()), +}); +export const staticChunkingStrategyRequestParamSchema = v.strictObject({ + /** + * Always `static`. + */ + type: v.picklist(["static"]), + static: staticChunkingStrategySchema, +}); +/** + * The default strategy. This strategy currently uses a + * `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`. + * @title Auto Chunking Strategy + */ +export const autoChunkingStrategyRequestParamSchema = v.strictObject({ + /** + * Always `auto`. + */ + type: v.picklist(["auto"]), +}); +/** + * The chunking strategy used to chunk the file(s). If not set, will use the + * `auto` strategy. + */ +export const chunkingStrategyRequestParamSchema = v.union([ + autoChunkingStrategyRequestParamSchema, + staticChunkingStrategyRequestParamSchema, +]); +export const createVectorStoreFileBatchRequestSchema = v.strictObject({ + /** + * A list of [File](/docs/api-reference/files) IDs that the vector store + * should use. Useful for tools like `file_search` that can access files. + */ + file_ids: v.pipe(v.array(v.string()), v.minLength(1), v.maxLength(500)), + chunking_strategy: v.exactOptional(chunkingStrategyRequestParamSchema), +}); +/** + * This is returned when the chunking strategy is unknown. Typically, this is + * because the file was indexed before the `chunking_strategy` concept was + * introduced in the API. + * @title Other Chunking Strategy + */ +export const otherChunkingStrategyResponseParamSchema = v.strictObject({ + /** + * Always `other`. + */ + type: v.picklist(["other"]), +}); +export const staticChunkingStrategyResponseParamSchema = v.strictObject({ + /** + * Always `static`. + */ + type: v.picklist(["static"]), + static: staticChunkingStrategySchema, +}); +/** + * A list of files attached to a vector store. + * @title Vector store files + */ +export const vectorStoreFileObjectSchema = v.strictObject({ + /** + * The identifier, which can be referenced in API endpoints. + */ + id: v.string(), + /** + * The object type, which is always `vector_store.file`. + */ + object: v.picklist(["vector_store.file"]), + /** + * The total vector store usage in bytes. Note that this may be different from + * the original file size. + */ + usage_bytes: v.pipe(v.number(), v.integer()), + /** + * The Unix timestamp (in seconds) for when the vector store file was created. + */ + created_at: v.pipe(v.number(), v.integer()), + /** + * The ID of the [vector store](/docs/api-reference/vector-stores/object) that + * the [File](/docs/api-reference/files) is attached to. + */ + vector_store_id: v.string(), + /** + * The status of the vector store file, which can be either `in_progress`, + * `completed`, `cancelled`, or `failed`. The status `completed` indicates + * that the vector store file is ready for use. + */ + status: v.picklist(["in_progress", "completed", "cancelled", "failed"]), + /** + * The last error associated with this vector store file. Will be `null` if + * there are no errors. + */ + last_error: v.nullable( + v.strictObject({ + /** + * One of `server_error` or `rate_limit_exceeded`. + */ + code: v.picklist(["server_error", "unsupported_file", "invalid_file"]), + /** + * A human-readable description of the error. + */ + message: v.string(), + }), + ), + /** + * The strategy used to chunk the file. + */ + chunking_strategy: v.exactOptional( + v.union([ + staticChunkingStrategyResponseParamSchema, + otherChunkingStrategyResponseParamSchema, + ]), + ), +}); +export const listVectorStoreFilesResponseSchema = v.strictObject({ + object: v.string(), + data: v.array(vectorStoreFileObjectSchema), + first_id: v.string(), + last_id: v.string(), + has_more: v.boolean(), +}); +export const createVectorStoreFileRequestSchema = v.strictObject({ + /** + * A [File](/docs/api-reference/files) ID that the vector store should use. + * Useful for tools like `file_search` that can access files. + */ + file_id: v.string(), + chunking_strategy: v.exactOptional(chunkingStrategyRequestParamSchema), +}); +/** + * The expiration policy for a vector store. + * @title Vector store expiration policy + */ +export const vectorStoreExpirationAfterSchema = v.strictObject({ + /** + * Anchor timestamp after which the expiration policy applies. Supported + * anchors: `last_active_at`. + */ + anchor: v.picklist(["last_active_at"]), + /** + * The number of days after the anchor time that the vector store will expire. + */ + days: v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(365)), +}); +/** + * A vector store is a collection of processed files can be used by the + * `file_search` tool. + * @title Vector store + */ +export const vectorStoreObjectSchema = v.strictObject({ + /** + * The identifier, which can be referenced in API endpoints. + */ + id: v.string(), + /** + * The object type, which is always `vector_store`. + */ + object: v.picklist(["vector_store"]), + /** + * The Unix timestamp (in seconds) for when the vector store was created. + */ + created_at: v.pipe(v.number(), v.integer()), + /** + * The name of the vector store. + */ + name: v.string(), + /** + * The total number of bytes used by the files in the vector store. + */ + usage_bytes: v.pipe(v.number(), v.integer()), + file_counts: v.strictObject({ + /** + * The number of files that are currently being processed. + */ + in_progress: v.pipe(v.number(), v.integer()), + /** + * The number of files that have been successfully processed. + */ + completed: v.pipe(v.number(), v.integer()), + /** + * The number of files that have failed to process. + */ + failed: v.pipe(v.number(), v.integer()), + /** + * The number of files that were cancelled. + */ + cancelled: v.pipe(v.number(), v.integer()), + /** + * The total number of files. + */ + total: v.pipe(v.number(), v.integer()), + }), + /** + * The status of the vector store, which can be either `expired`, + * `in_progress`, or `completed`. A status of `completed` indicates that the + * vector store is ready for use. + */ + status: v.picklist(["expired", "in_progress", "completed"]), + expires_after: v.exactOptional(vectorStoreExpirationAfterSchema), + /** + * The Unix timestamp (in seconds) for when the vector store will expire. + */ + expires_at: v.exactOptional(v.nullable(v.pipe(v.number(), v.integer()))), + /** + * The Unix timestamp (in seconds) for when the vector store was last active. + */ + last_active_at: v.nullable(v.pipe(v.number(), v.integer())), + /** + * Set of 16 key-value pairs that can be attached to an object. This can be + * useful for storing additional information about the object in a structured + * format. Keys can be a maximum of 64 characters long and values can be a + * maximum of 512 characters long. + */ + metadata: v.nullable(v.record(v.string(), v.unknown())), +}); +export const listVectorStoresResponseSchema = v.strictObject({ + object: v.string(), + data: v.array(vectorStoreObjectSchema), + first_id: v.string(), + last_id: v.string(), + has_more: v.boolean(), +}); +export const updateVectorStoreRequestSchema = v.strictObject({ + /** + * The name of the vector store. + */ + name: v.exactOptional(v.nullable(v.string())), + expires_after: v.exactOptional(vectorStoreExpirationAfterSchema), + /** + * Set of 16 key-value pairs that can be attached to an object. This can be + * useful for storing additional information about the object in a structured + * format. Keys can be a maximum of 64 characters long and values can be a + * maximum of 512 characters long. + */ + metadata: v.exactOptional(v.nullable(v.record(v.string(), v.unknown()))), +}); +export const createVectorStoreRequestSchema = v.strictObject({ + /** + * A list of [File](/docs/api-reference/files) IDs that the vector store + * should use. Useful for tools like `file_search` that can access files. + */ + file_ids: v.exactOptional(v.pipe(v.array(v.string()), v.maxLength(500))), + /** + * The name of the vector store. + */ + name: v.exactOptional(v.string()), + expires_after: v.exactOptional(vectorStoreExpirationAfterSchema), + /** + * The chunking strategy used to chunk the file(s). If not set, will use the + * `auto` strategy. Only applicable if `file_ids` is non-empty. + */ + chunking_strategy: v.exactOptional( + v.union([ + autoChunkingStrategyRequestParamSchema, + staticChunkingStrategyRequestParamSchema, + ]), + ), + /** + * Set of 16 key-value pairs that can be attached to an object. This can be + * useful for storing additional information about the object in a structured + * format. Keys can be a maximum of 64 characters long and values can be a + * maximum of 512 characters long. + */ + metadata: v.exactOptional(v.nullable(v.record(v.string(), v.unknown()))), +}); +/** + * A result instance of the file search. + * @title File search tool call result + */ +export const runStepDetailsToolCallsFileSearchResultObjectSchema = + v.strictObject({ + /** + * The ID of the file that result was found in. + */ + file_id: v.string(), + /** + * The name of the file that result was found in. + */ + file_name: v.string(), + /** + * The score of the result. All values must be a floating point number between + * 0 and 1. + */ + score: v.pipe(v.number(), v.minValue(0), v.maxValue(1)), + /** + * The content of the result that was found. The content is only included if + * requested via the include query parameter. + */ + content: v.exactOptional( + v.array( + v.strictObject({ + /** + * The type of the content. + */ + type: v.exactOptional(v.picklist(["text"])), + /** + * The text content of the file. + */ + text: v.exactOptional(v.string()), + }), + ), + ), + }); +/** + * The ranking options for the file search. + * @title File search tool call ranking options + */ +export const runStepDetailsToolCallsFileSearchRankingOptionsObjectSchema = + v.strictObject({ + /** + * The ranker used for the file search. + */ + ranker: v.picklist(["default_2024_08_21"]), + /** + * The score threshold for the file search. All values must be a floating + * point number between 0 and 1. + */ + score_threshold: v.pipe(v.number(), v.minValue(0), v.maxValue(1)), + }); +export const runStepDetailsToolCallsFileSearchObjectSchema = v.strictObject({ + /** + * The ID of the tool call object. + */ + id: v.string(), + /** + * The type of tool call. This is always going to be `file_search` for this + * type of tool call. + */ + type: v.picklist(["file_search"]), + /** + * For now, this is always going to be an empty object. + */ + file_search: v.strictObject({ + ranking_options: v.exactOptional( + runStepDetailsToolCallsFileSearchRankingOptionsObjectSchema, + ), + /** + * The results of the file search. + */ + results: v.exactOptional( + v.array(runStepDetailsToolCallsFileSearchResultObjectSchema), + ), + }), +}); +export const listRunStepsResponseSchema = v.strictObject({ + object: v.string(), + data: v.array(runStepObjectSchema), + first_id: v.string(), + last_id: v.string(), + has_more: v.boolean(), +}); +export const listMessagesResponseSchema = v.strictObject({ + object: v.string(), + data: v.array(messageObjectSchema), + first_id: v.string(), + last_id: v.string(), + has_more: v.boolean(), +}); +export const listThreadsResponseSchema = v.strictObject({ + object: v.string(), + data: v.array(threadObjectSchema), + first_id: v.string(), + last_id: v.string(), + has_more: v.boolean(), +}); +export const createMessageRequestSchema = v.strictObject({ + /** + * The role of the entity that is creating the message. Allowed values + * include: + * - `user`: Indicates the message is sent by an actual user and should be + * used in most cases to represent user-generated messages. + * - `assistant`: Indicates the message is generated by the assistant. Use + * this value to insert messages from the assistant into the conversation. + */ + role: v.picklist(["user", "assistant"]), + content: v.union([ + v.string(), + v.pipe( + v.array( + v.union([ + messageContentImageFileObjectSchema, + messageContentImageUrlObjectSchema, + messageRequestContentTextObjectSchema, + ]), + ), + v.minLength(1), + ), + ]), + /** + * A list of files attached to the message, and the tools they should be added + * to. + */ + attachments: v.exactOptional( + v.nullable( + v.array( + v.strictObject({ + /** + * The ID of the file to attach to the message. + */ + file_id: v.exactOptional(v.string()), + /** + * The tools to add this file to. + */ + tools: v.exactOptional( + v.array( + v.union([ + assistantToolsCodeSchema, + assistantToolsFileSearchTypeOnlySchema, + ]), + ), + ), + }), + ), + ), + ), + /** + * Set of 16 key-value pairs that can be attached to an object. This can be + * useful for storing additional information about the object in a structured + * format. Keys can be a maximum of 64 characters long and values can be a + * maximum of 512 characters long. + */ + metadata: v.exactOptional(v.nullable(v.record(v.string(), v.unknown()))), +}); +export const createThreadRequestSchema = v.strictObject({ + /** + * A list of [messages](/docs/api-reference/messages) to start the thread + * with. + */ + messages: v.exactOptional(v.array(createMessageRequestSchema)), + /** + * A set of resources that are made available to the assistant's tools in this + * thread. The resources are specific to the type of tool. For example, the + * `code_interpreter` tool requires a list of file IDs, while the + * `file_search` tool requires a list of vector store IDs. + */ + tool_resources: v.exactOptional( + v.nullable( + v.strictObject({ + code_interpreter: v.exactOptional( + v.strictObject({ + /** + * A list of [file](/docs/api-reference/files) IDs made available to the + * `code_interpreter` tool. There can be a maximum of 20 files associated with + * the tool. + */ + file_ids: v.exactOptional( + v.pipe(v.array(v.string()), v.maxLength(20)), + ), + }), + ), + file_search: v.exactOptional( + v.union([ + v.record(v.string(), v.unknown()), + v.record(v.string(), v.unknown()), + ]), + ), + }), + ), + ), + /** + * Set of 16 key-value pairs that can be attached to an object. This can be + * useful for storing additional information about the object in a structured + * format. Keys can be a maximum of 64 characters long and values can be a + * maximum of 512 characters long. + */ + metadata: v.exactOptional(v.nullable(v.record(v.string(), v.unknown()))), +}); +export const createThreadAndRunRequestSchema = v.strictObject({ + /** + * The ID of the [assistant](/docs/api-reference/assistants) to use to execute + * this run. + */ + assistant_id: v.string(), + thread: v.exactOptional(createThreadRequestSchema), + /** + * The ID of the [Model](/docs/api-reference/models) to be used to execute + * this run. If a value is provided here, it will override the model + * associated with the assistant. If not, the model associated with the + * assistant will be used. + */ + model: v.exactOptional( + v.nullable( + v.union([ + v.string(), + v.picklist([ + "gpt-4o", + "gpt-4o-2024-08-06", + "gpt-4o-2024-05-13", + "gpt-4o-2024-08-06", + "gpt-4o-mini", + "gpt-4o-mini-2024-07-18", + "gpt-4-turbo", + "gpt-4-turbo-2024-04-09", + "gpt-4-0125-preview", + "gpt-4-turbo-preview", + "gpt-4-1106-preview", + "gpt-4-vision-preview", + "gpt-4", + "gpt-4-0314", + "gpt-4-0613", + "gpt-4-32k", + "gpt-4-32k-0314", + "gpt-4-32k-0613", + "gpt-3.5-turbo", + "gpt-3.5-turbo-16k", + "gpt-3.5-turbo-0613", + "gpt-3.5-turbo-1106", + "gpt-3.5-turbo-0125", + "gpt-3.5-turbo-16k-0613", + ]), + ]), + ), + ), + /** + * Override the default system message of the assistant. This is useful for + * modifying the behavior on a per-run basis. + */ + instructions: v.exactOptional(v.nullable(v.string())), + /** + * Override the tools the assistant can use for this run. This is useful for + * modifying the behavior on a per-run basis. + */ + tools: v.exactOptional( + v.nullable( + v.pipe( + v.array(v.union([assistantToolsCodeSchema, v.unknown(), v.unknown()])), + v.maxLength(20), + ), + ), + ), + /** + * A set of resources that are used by the assistant's tools. The resources + * are specific to the type of tool. For example, the `code_interpreter` tool + * requires a list of file IDs, while the `file_search` tool requires a list + * of vector store IDs. + */ + tool_resources: v.exactOptional( + v.nullable( + v.strictObject({ + code_interpreter: v.exactOptional( + v.strictObject({ + /** + * A list of [file](/docs/api-reference/files) IDs made available to the + * `code_interpreter` tool. There can be a maximum of 20 files associated with + * the tool. + */ + file_ids: v.exactOptional( + v.pipe(v.array(v.string()), v.maxLength(20)), + ), + }), + ), + file_search: v.exactOptional( + v.strictObject({ + /** + * The ID of the [vector store](/docs/api-reference/vector-stores/object) + * attached to this assistant. There can be a maximum of 1 vector store + * attached to the assistant. + */ + vector_store_ids: v.exactOptional( + v.pipe(v.array(v.string()), v.maxLength(1)), + ), + }), + ), + }), + ), + ), + /** + * Set of 16 key-value pairs that can be attached to an object. This can be + * useful for storing additional information about the object in a structured + * format. Keys can be a maximum of 64 characters long and values can be a + * maximum of 512 characters long. + */ + metadata: v.exactOptional(v.nullable(v.record(v.string(), v.unknown()))), + /** + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 + * will make the output more random, while lower values like 0.2 will make it + * more focused and deterministic. + */ + temperature: v.exactOptional( + v.nullable(v.pipe(v.number(), v.minValue(0), v.maxValue(2))), + ), + /** + * An alternative to sampling with temperature, called nucleus sampling, where + * the model considers the results of the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are + * considered. + * + * We generally recommend altering this or temperature but not both. + */ + top_p: v.exactOptional( + v.nullable(v.pipe(v.number(), v.minValue(0), v.maxValue(1))), + ), + /** + * If `true`, returns a stream of events that happen during the Run as + * server-sent events, terminating when the Run enters a terminal state with a + * `data: [DONE]` message. + */ + stream: v.exactOptional(v.nullable(v.boolean())), + /** + * The maximum number of prompt tokens that may be used over the course of the + * run. The run will make a best effort to use only the number of prompt + * tokens specified, across multiple turns of the run. If the run exceeds the + * number of prompt tokens specified, the run will end with status + * `incomplete`. See `incomplete_details` for more info. + */ + max_prompt_tokens: v.exactOptional( + v.nullable(v.pipe(v.number(), v.integer(), v.minValue(256))), + ), + /** + * The maximum number of completion tokens that may be used over the course of + * the run. The run will make a best effort to use only the number of + * completion tokens specified, across multiple turns of the run. If the run + * exceeds the number of completion tokens specified, the run will end with + * status `incomplete`. See `incomplete_details` for more info. + */ + max_completion_tokens: v.exactOptional( + v.nullable(v.pipe(v.number(), v.integer(), v.minValue(256))), + ), + truncation_strategy: v.exactOptional(truncationObjectSchema), + tool_choice: v.exactOptional(assistantsApiToolChoiceOptionSchema), + parallel_tool_calls: v.exactOptional(parallelToolCallsSchema), + response_format: v.exactOptional(assistantsApiResponseFormatOptionSchema), +}); +export const listRunsResponseSchema = v.strictObject({ + object: v.string(), + data: v.array(runObjectSchema), + first_id: v.string(), + last_id: v.string(), + has_more: v.boolean(), +}); +export const createRunRequestSchema = v.strictObject({ + /** + * The ID of the [assistant](/docs/api-reference/assistants) to use to execute + * this run. + */ + assistant_id: v.string(), + /** + * The ID of the [Model](/docs/api-reference/models) to be used to execute + * this run. If a value is provided here, it will override the model + * associated with the assistant. If not, the model associated with the + * assistant will be used. + */ + model: v.exactOptional( + v.nullable( + v.union([ + v.string(), + v.picklist([ + "gpt-4o", + "gpt-4o-2024-08-06", + "gpt-4o-2024-05-13", + "gpt-4o-2024-08-06", + "gpt-4o-mini", + "gpt-4o-mini-2024-07-18", + "gpt-4-turbo", + "gpt-4-turbo-2024-04-09", + "gpt-4-0125-preview", + "gpt-4-turbo-preview", + "gpt-4-1106-preview", + "gpt-4-vision-preview", + "gpt-4", + "gpt-4-0314", + "gpt-4-0613", + "gpt-4-32k", + "gpt-4-32k-0314", + "gpt-4-32k-0613", + "gpt-3.5-turbo", + "gpt-3.5-turbo-16k", + "gpt-3.5-turbo-0613", + "gpt-3.5-turbo-1106", + "gpt-3.5-turbo-0125", + "gpt-3.5-turbo-16k-0613", + ]), + ]), + ), + ), + /** + * Overrides the + * [instructions](/docs/api-reference/assistants/createAssistant) of the + * assistant. This is useful for modifying the behavior on a per-run basis. + */ + instructions: v.exactOptional(v.nullable(v.string())), + /** + * Appends additional instructions at the end of the instructions for the run. + * This is useful for modifying the behavior on a per-run basis without + * overriding other instructions. + */ + additional_instructions: v.exactOptional(v.nullable(v.string())), + /** + * Adds additional messages to the thread before creating the run. + */ + additional_messages: v.exactOptional( + v.nullable(v.array(createMessageRequestSchema)), + ), + /** + * Override the tools the assistant can use for this run. This is useful for + * modifying the behavior on a per-run basis. + */ + tools: v.exactOptional( + v.nullable( + v.pipe( + v.array(v.union([assistantToolsCodeSchema, v.unknown(), v.unknown()])), + v.maxLength(20), + ), + ), + ), + /** + * Set of 16 key-value pairs that can be attached to an object. This can be + * useful for storing additional information about the object in a structured + * format. Keys can be a maximum of 64 characters long and values can be a + * maximum of 512 characters long. + */ + metadata: v.exactOptional(v.nullable(v.record(v.string(), v.unknown()))), + /** + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 + * will make the output more random, while lower values like 0.2 will make it + * more focused and deterministic. + */ + temperature: v.exactOptional( + v.nullable(v.pipe(v.number(), v.minValue(0), v.maxValue(2))), + ), + /** + * An alternative to sampling with temperature, called nucleus sampling, where + * the model considers the results of the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are + * considered. + * + * We generally recommend altering this or temperature but not both. + */ + top_p: v.exactOptional( + v.nullable(v.pipe(v.number(), v.minValue(0), v.maxValue(1))), + ), + /** + * If `true`, returns a stream of events that happen during the Run as + * server-sent events, terminating when the Run enters a terminal state with a + * `data: [DONE]` message. + */ + stream: v.exactOptional(v.nullable(v.boolean())), + /** + * The maximum number of prompt tokens that may be used over the course of the + * run. The run will make a best effort to use only the number of prompt + * tokens specified, across multiple turns of the run. If the run exceeds the + * number of prompt tokens specified, the run will end with status + * `incomplete`. See `incomplete_details` for more info. + */ + max_prompt_tokens: v.exactOptional( + v.nullable(v.pipe(v.number(), v.integer(), v.minValue(256))), + ), + /** + * The maximum number of completion tokens that may be used over the course of + * the run. The run will make a best effort to use only the number of + * completion tokens specified, across multiple turns of the run. If the run + * exceeds the number of completion tokens specified, the run will end with + * status `incomplete`. See `incomplete_details` for more info. + */ + max_completion_tokens: v.exactOptional( + v.nullable(v.pipe(v.number(), v.integer(), v.minValue(256))), + ), + truncation_strategy: v.exactOptional(truncationObjectSchema), + tool_choice: v.exactOptional(assistantsApiToolChoiceOptionSchema), + parallel_tool_calls: v.exactOptional(parallelToolCallsSchema), + response_format: v.exactOptional(assistantsApiResponseFormatOptionSchema), +}); +/** + * The parameters the functions accepts, described as a JSON Schema object. + * See the [guide](/docs/guides/function-calling) for examples, and the [JSON + * Schema reference](https://json-schema.org/understanding-json-schema/) for + * documentation about the format. + * + * Omitting `parameters` defines a function with an empty parameter list. + */ +export const functionParametersSchema = v.record(v.string(), v.unknown()); +export const functionObjectSchema = v.strictObject({ + /** + * A description of what the function does, used by the model to choose when + * and how to call the function. + */ + description: v.exactOptional(v.string()), + /** + * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain + * underscores and dashes, with a maximum length of 64. + */ + name: v.string(), + parameters: v.exactOptional(functionParametersSchema), + /** + * Whether to enable strict schema adherence when generating the function + * call. If set to true, the model will follow the exact schema defined in the + * `parameters` field. Only a subset of JSON Schema is supported when `strict` + * is `true`. Learn more about Structured Outputs in the [function calling + * guide](docs/guides/function-calling). + */ + strict: v.exactOptional(v.nullable(v.boolean())), +}); +export const assistantToolsFunctionSchema = v.strictObject({ + /** + * The type of tool being defined: `function` + */ + type: v.picklist(["function"]), + function: functionObjectSchema, +}); +/** + * The ranking options for the file search. If not specified, the file search + * tool will use the `auto` ranker and a score_threshold of 0. + * + * See the [file search tool + * documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) + * for more information. + * @title File search tool call ranking options + */ +export const fileSearchRankingOptionsSchema = v.strictObject({ + /** + * The ranker to use for the file search. If not specified will use the `auto` + * ranker. + */ + ranker: v.exactOptional(v.picklist(["auto", "default_2024_08_21"])), + /** + * The score threshold for the file search. All values must be a floating + * point number between 0 and 1. + */ + score_threshold: v.pipe(v.number(), v.minValue(0), v.maxValue(1)), +}); +export const assistantToolsFileSearchSchema = v.strictObject({ + /** + * The type of tool being defined: `file_search` + */ + type: v.picklist(["file_search"]), + /** + * Overrides for the file search tool. + */ + file_search: v.exactOptional( + v.strictObject({ + /** + * The maximum number of results the file search tool should output. The + * default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number + * should be between 1 and 50 inclusive. + * + * Note that the file search tool may output fewer than `max_num_results` + * results. See the [file search tool + * documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) + * for more information. + */ + max_num_results: v.exactOptional( + v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(50)), + ), + ranking_options: v.exactOptional(fileSearchRankingOptionsSchema), + }), + ), +}); +/** + * Represents an `assistant` that can call the model and use tools. + * @title Assistant + */ +export const assistantObjectSchema = v.strictObject({ + /** + * The identifier, which can be referenced in API endpoints. + */ + id: v.string(), + /** + * The object type, which is always `assistant`. + */ + object: v.picklist(["assistant"]), + /** + * The Unix timestamp (in seconds) for when the assistant was created. + */ + created_at: v.pipe(v.number(), v.integer()), + /** + * The name of the assistant. The maximum length is 256 characters. + */ + name: v.nullable(v.pipe(v.string(), v.maxLength(256))), + /** + * The description of the assistant. The maximum length is 512 characters. + */ + description: v.nullable(v.pipe(v.string(), v.maxLength(512))), + /** + * ID of the model to use. You can use the [List + * models](/docs/api-reference/models/list) API to see all of your available + * models, or see our [Model overview](/docs/models/overview) for descriptions + * of them. + */ + model: v.string(), + /** + * The system instructions that the assistant uses. The maximum length is + * 256,000 characters. + */ + instructions: v.nullable(v.pipe(v.string(), v.maxLength(256000))), + /** + * A list of tool enabled on the assistant. There can be a maximum of 128 + * tools per assistant. Tools can be of types `code_interpreter`, + * `file_search`, or `function`. + */ + tools: v.pipe( + v.array( + v.union([ + assistantToolsCodeSchema, + assistantToolsFileSearchSchema, + assistantToolsFunctionSchema, + ]), + ), + v.maxLength(128), + ), + /** + * A set of resources that are used by the assistant's tools. The resources + * are specific to the type of tool. For example, the `code_interpreter` tool + * requires a list of file IDs, while the `file_search` tool requires a list + * of vector store IDs. + */ + tool_resources: v.exactOptional( + v.nullable( + v.strictObject({ + code_interpreter: v.exactOptional( + v.strictObject({ + /** + * A list of [file](/docs/api-reference/files) IDs made available to the + * `code_interpreter`` tool. There can be a maximum of 20 files associated + * with the tool. + */ + file_ids: v.exactOptional( + v.pipe(v.array(v.string()), v.maxLength(20)), + ), + }), + ), + file_search: v.exactOptional( + v.strictObject({ + /** + * The ID of the [vector store](/docs/api-reference/vector-stores/object) + * attached to this assistant. There can be a maximum of 1 vector store + * attached to the assistant. + */ + vector_store_ids: v.exactOptional( + v.pipe(v.array(v.string()), v.maxLength(1)), + ), + }), + ), + }), + ), + ), + /** + * Set of 16 key-value pairs that can be attached to an object. This can be + * useful for storing additional information about the object in a structured + * format. Keys can be a maximum of 64 characters long and values can be a + * maximum of 512 characters long. + */ + metadata: v.nullable(v.record(v.string(), v.unknown())), + /** + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 + * will make the output more random, while lower values like 0.2 will make it + * more focused and deterministic. + */ + temperature: v.exactOptional( + v.nullable(v.pipe(v.number(), v.minValue(0), v.maxValue(2))), + ), + /** + * An alternative to sampling with temperature, called nucleus sampling, where + * the model considers the results of the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are + * considered. + * + * We generally recommend altering this or temperature but not both. + */ + top_p: v.exactOptional( + v.nullable(v.pipe(v.number(), v.minValue(0), v.maxValue(1))), + ), + response_format: v.exactOptional(assistantsApiResponseFormatOptionSchema), +}); +export const listAssistantsResponseSchema = v.strictObject({ + object: v.string(), + data: v.array(assistantObjectSchema), + first_id: v.string(), + last_id: v.string(), + has_more: v.boolean(), +}); +export const modifyAssistantRequestSchema = v.strictObject({ + /** + * ID of the model to use. You can use the [List + * models](/docs/api-reference/models/list) API to see all of your available + * models, or see our [Model overview](/docs/models/overview) for descriptions + * of them. + */ + model: v.exactOptional(v.union([v.string()])), + /** + * The name of the assistant. The maximum length is 256 characters. + */ + name: v.exactOptional(v.nullable(v.pipe(v.string(), v.maxLength(256)))), + /** + * The description of the assistant. The maximum length is 512 characters. + */ + description: v.exactOptional( + v.nullable(v.pipe(v.string(), v.maxLength(512))), + ), + /** + * The system instructions that the assistant uses. The maximum length is + * 256,000 characters. + */ + instructions: v.exactOptional( + v.nullable(v.pipe(v.string(), v.maxLength(256000))), + ), + /** + * A list of tool enabled on the assistant. There can be a maximum of 128 + * tools per assistant. Tools can be of types `code_interpreter`, + * `file_search`, or `function`. + */ + tools: v.exactOptional( + v.pipe( + v.array( + v.union([ + assistantToolsCodeSchema, + assistantToolsFileSearchSchema, + assistantToolsFunctionSchema, + ]), + ), + v.maxLength(128), + ), + ), + /** + * A set of resources that are used by the assistant's tools. The resources + * are specific to the type of tool. For example, the `code_interpreter` tool + * requires a list of file IDs, while the `file_search` tool requires a list + * of vector store IDs. + */ + tool_resources: v.exactOptional( + v.nullable( + v.strictObject({ + code_interpreter: v.exactOptional( + v.strictObject({ + /** + * Overrides the list of [file](/docs/api-reference/files) IDs made available + * to the `code_interpreter` tool. There can be a maximum of 20 files + * associated with the tool. + */ + file_ids: v.exactOptional( + v.pipe(v.array(v.string()), v.maxLength(20)), + ), + }), + ), + file_search: v.exactOptional( + v.strictObject({ + /** + * Overrides the [vector store](/docs/api-reference/vector-stores/object) + * attached to this assistant. There can be a maximum of 1 vector store + * attached to the assistant. + */ + vector_store_ids: v.exactOptional( + v.pipe(v.array(v.string()), v.maxLength(1)), + ), + }), + ), + }), + ), + ), + /** + * Set of 16 key-value pairs that can be attached to an object. This can be + * useful for storing additional information about the object in a structured + * format. Keys can be a maximum of 64 characters long and values can be a + * maximum of 512 characters long. + */ + metadata: v.exactOptional(v.nullable(v.record(v.string(), v.unknown()))), + /** + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 + * will make the output more random, while lower values like 0.2 will make it + * more focused and deterministic. + */ + temperature: v.exactOptional( + v.nullable(v.pipe(v.number(), v.minValue(0), v.maxValue(2))), + ), + /** + * An alternative to sampling with temperature, called nucleus sampling, where + * the model considers the results of the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are + * considered. + * + * We generally recommend altering this or temperature but not both. + */ + top_p: v.exactOptional( + v.nullable(v.pipe(v.number(), v.minValue(0), v.maxValue(1))), + ), + response_format: v.exactOptional(assistantsApiResponseFormatOptionSchema), +}); +export const createAssistantRequestSchema = v.strictObject({ + /** + * ID of the model to use. You can use the [List + * models](/docs/api-reference/models/list) API to see all of your available + * models, or see our [Model overview](/docs/models/overview) for descriptions + * of them. + */ + model: v.union([ + v.string(), + v.picklist([ + "gpt-4o", + "gpt-4o-2024-08-06", + "gpt-4o-2024-05-13", + "gpt-4o-2024-08-06", + "gpt-4o-mini", + "gpt-4o-mini-2024-07-18", + "gpt-4-turbo", + "gpt-4-turbo-2024-04-09", + "gpt-4-0125-preview", + "gpt-4-turbo-preview", + "gpt-4-1106-preview", + "gpt-4-vision-preview", + "gpt-4", + "gpt-4-0314", + "gpt-4-0613", + "gpt-4-32k", + "gpt-4-32k-0314", + "gpt-4-32k-0613", + "gpt-3.5-turbo", + "gpt-3.5-turbo-16k", + "gpt-3.5-turbo-0613", + "gpt-3.5-turbo-1106", + "gpt-3.5-turbo-0125", + "gpt-3.5-turbo-16k-0613", + ]), + ]), + /** + * The name of the assistant. The maximum length is 256 characters. + */ + name: v.exactOptional(v.nullable(v.pipe(v.string(), v.maxLength(256)))), + /** + * The description of the assistant. The maximum length is 512 characters. + */ + description: v.exactOptional( + v.nullable(v.pipe(v.string(), v.maxLength(512))), + ), + /** + * The system instructions that the assistant uses. The maximum length is + * 256,000 characters. + */ + instructions: v.exactOptional( + v.nullable(v.pipe(v.string(), v.maxLength(256000))), + ), + /** + * A list of tool enabled on the assistant. There can be a maximum of 128 + * tools per assistant. Tools can be of types `code_interpreter`, + * `file_search`, or `function`. + */ + tools: v.exactOptional( + v.pipe( + v.array( + v.union([ + assistantToolsCodeSchema, + assistantToolsFileSearchSchema, + assistantToolsFunctionSchema, + ]), + ), + v.maxLength(128), + ), + ), + /** + * A set of resources that are used by the assistant's tools. The resources + * are specific to the type of tool. For example, the `code_interpreter` tool + * requires a list of file IDs, while the `file_search` tool requires a list + * of vector store IDs. + */ + tool_resources: v.exactOptional( + v.nullable( + v.strictObject({ + code_interpreter: v.exactOptional( + v.strictObject({ + /** + * A list of [file](/docs/api-reference/files) IDs made available to the + * `code_interpreter` tool. There can be a maximum of 20 files associated with + * the tool. + */ + file_ids: v.exactOptional( + v.pipe(v.array(v.string()), v.maxLength(20)), + ), + }), + ), + file_search: v.exactOptional( + v.union([ + v.record(v.string(), v.unknown()), + v.record(v.string(), v.unknown()), + ]), + ), + }), + ), + ), + /** + * Set of 16 key-value pairs that can be attached to an object. This can be + * useful for storing additional information about the object in a structured + * format. Keys can be a maximum of 64 characters long and values can be a + * maximum of 512 characters long. + */ + metadata: v.exactOptional(v.nullable(v.record(v.string(), v.unknown()))), + /** + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 + * will make the output more random, while lower values like 0.2 will make it + * more focused and deterministic. + */ + temperature: v.exactOptional( + v.nullable(v.pipe(v.number(), v.minValue(0), v.maxValue(2))), + ), + /** + * An alternative to sampling with temperature, called nucleus sampling, where + * the model considers the results of the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are + * considered. + * + * We generally recommend altering this or temperature but not both. + */ + top_p: v.exactOptional( + v.nullable(v.pipe(v.number(), v.minValue(0), v.maxValue(1))), + ), + response_format: v.exactOptional(assistantsApiResponseFormatOptionSchema), +}); +export const chatCompletionFunctionsSchema = v.strictObject({ + /** + * A description of what the function does, used by the model to choose when + * and how to call the function. + */ + description: v.exactOptional(v.string()), + /** + * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain + * underscores and dashes, with a maximum length of 64. + */ + name: v.string(), + parameters: v.exactOptional(functionParametersSchema), +}); +export const chatCompletionToolSchema = v.strictObject({ + /** + * The type of the tool. Currently, only `function` is supported. + */ + type: v.picklist(["function"]), + function: functionObjectSchema, +}); +/** The per-line training example of a fine-tuning input file for chat models */ +export const finetuneChatRequestInputSchema = v.strictObject({ + messages: v.exactOptional( + v.pipe( + v.array( + v.union([ + v.unknown(), + v.unknown(), + v.unknown(), + v.unknown(), + v.unknown(), + ]), + ), + v.minLength(1), + ), + ), + /** + * A list of tools the model may generate JSON inputs for. + */ + tools: v.exactOptional(v.array(chatCompletionToolSchema)), + parallel_tool_calls: v.exactOptional(parallelToolCallsSchema), + /** + * A list of functions the model may generate JSON inputs for. + */ + functions: v.exactOptional( + v.pipe( + v.array(chatCompletionFunctionsSchema), + v.minLength(1), + v.maxLength(128), + ), + ), +}); +/** + * The `File` object represents a document that has been uploaded to OpenAI. + * @title OpenAIFile + */ +export const openAiFileSchema = v.strictObject({ + /** + * The file identifier, which can be referenced in the API endpoints. + */ + id: v.string(), + /** + * The size of the file, in bytes. + */ + bytes: v.pipe(v.number(), v.integer()), + /** + * The Unix timestamp (in seconds) for when the file was created. + */ + created_at: v.pipe(v.number(), v.integer()), + /** + * The name of the file. + */ + filename: v.string(), + /** + * The object type, which is always `file`. + */ + object: v.picklist(["file"]), + /** + * The intended purpose of the file. Supported values are `assistants`, + * `assistants_output`, `batch`, `batch_output`, `fine-tune`, + * `fine-tune-results` and `vision`. + */ + purpose: v.picklist([ + "assistants", + "assistants_output", + "batch", + "batch_output", + "fine-tune", + "fine-tune-results", + "vision", + ]), + /** + * Deprecated. The current status of the file, which can be either `uploaded`, + * `processed`, or `error`. + */ + status: v.picklist(["uploaded", "processed", "error"]), + /** + * Deprecated. For details on why a fine-tuning training file failed + * validation, see the `error` field on `fine_tuning.job`. + */ + status_details: v.exactOptional(v.string()), +}); +/** + * The Upload object can accept byte chunks in the form of Parts. + * @title Upload + */ +export const uploadSchema = v.strictObject({ + /** + * The Upload unique identifier, which can be referenced in API endpoints. + */ + id: v.string(), + /** + * The Unix timestamp (in seconds) for when the Upload was created. + */ + created_at: v.pipe(v.number(), v.integer()), + /** + * The name of the file to be uploaded. + */ + filename: v.string(), + /** + * The intended number of bytes to be uploaded. + */ + bytes: v.pipe(v.number(), v.integer()), + /** + * The intended purpose of the file. [Please refer + * here](/docs/api-reference/files/object#files/object-purpose) for acceptable + * values. + */ + purpose: v.string(), + /** + * The status of the Upload. + */ + status: v.picklist(["pending", "completed", "cancelled", "expired"]), + /** + * The Unix timestamp (in seconds) for when the Upload was created. + */ + expires_at: v.pipe(v.number(), v.integer()), + /** + * The object type, which is always "upload". + */ + object: v.exactOptional(v.picklist(["upload"])), + file: v.exactOptional(openAiFileSchema), +}); +export const transcriptionSegmentSchema = v.strictObject({ + /** + * Unique identifier of the segment. + */ + id: v.pipe(v.number(), v.integer()), + /** + * Seek offset of the segment. + */ + seek: v.pipe(v.number(), v.integer()), + /** + * Start time of the segment in seconds. + */ + start: v.number(), + /** + * End time of the segment in seconds. + */ + end: v.number(), + /** + * Text content of the segment. + */ + text: v.string(), + /** + * Array of token IDs for the text content. + */ + tokens: v.array(v.pipe(v.number(), v.integer())), + /** + * Temperature parameter used for generating the segment. + */ + temperature: v.number(), + /** + * Average logprob of the segment. If the value is lower than -1, consider the + * logprobs failed. + */ + avg_logprob: v.number(), + /** + * Compression ratio of the segment. If the value is greater than 2.4, + * consider the compression failed. + */ + compression_ratio: v.number(), + /** + * Probability of no speech in the segment. If the value is higher than 1.0 + * and the `avg_logprob` is below -1, consider this segment silent. + */ + no_speech_prob: v.number(), +}); +export const createTranslationResponseVerboseJsonSchema = v.strictObject({ + /** + * The language of the output translation (always `english`). + */ + language: v.string(), + /** + * The duration of the input audio. + */ + duration: v.string(), + /** + * The translated text. + */ + text: v.string(), + /** + * Segments of the translated text and their corresponding details. + */ + segments: v.exactOptional(v.array(transcriptionSegmentSchema)), +}); +/** + * The format of the output, in one of these options: `json`, `text`, `srt`, + * `verbose_json`, or `vtt`. + */ +export const audioResponseFormatSchema = v.picklist([ + "json", + "text", + "srt", + "verbose_json", + "vtt", +]); +export const createTranslationRequestSchema = v.strictObject({ + /** + * The audio file object (not file name) translate, in one of these formats: + * flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. + */ + file: v.string(), + /** + * ID of the model to use. Only `whisper-1` (which is powered by our open + * source Whisper V2 model) is currently available. + */ + model: v.union([v.string(), v.picklist(["whisper-1"])]), + /** + * An optional text to guide the model's style or continue a previous audio + * segment. The [prompt](/docs/guides/speech-to-text/prompting) should be in + * English. + */ + prompt: v.exactOptional(v.string()), + response_format: v.exactOptional(audioResponseFormatSchema), + /** + * The sampling temperature, between 0 and 1. Higher values like 0.8 will make + * the output more random, while lower values like 0.2 will make it more + * focused and deterministic. If set to 0, the model will use [log + * probability](https://en.wikipedia.org/wiki/Log_probability) to + * automatically increase the temperature until certain thresholds are hit. + */ + temperature: v.exactOptional(v.number()), +}); +export const transcriptionWordSchema = v.strictObject({ + /** + * The text content of the word. + */ + word: v.string(), + /** + * Start time of the word in seconds. + */ + start: v.number(), + /** + * End time of the word in seconds. + */ + end: v.number(), +}); +/** + * Represents a verbose json transcription response returned by model, based + * on the provided input. + */ +export const createTranscriptionResponseVerboseJsonSchema = v.strictObject({ + /** + * The language of the input audio. + */ + language: v.string(), + /** + * The duration of the input audio. + */ + duration: v.string(), + /** + * The transcribed text. + */ + text: v.string(), + /** + * Extracted words and their corresponding timestamps. + */ + words: v.exactOptional(v.array(transcriptionWordSchema)), + /** + * Segments of the transcribed text and their corresponding details. + */ + segments: v.exactOptional(v.array(transcriptionSegmentSchema)), +}); +export const createTranscriptionRequestSchema = v.strictObject({ + /** + * The audio file object (not file name) to transcribe, in one of these + * formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. + */ + file: v.string(), + /** + * ID of the model to use. Only `whisper-1` (which is powered by our open + * source Whisper V2 model) is currently available. + */ + model: v.union([v.string(), v.picklist(["whisper-1"])]), + /** + * The language of the input audio. Supplying the input language in + * [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format + * will improve accuracy and latency. + */ + language: v.exactOptional(v.string()), + /** + * An optional text to guide the model's style or continue a previous audio + * segment. The [prompt](/docs/guides/speech-to-text/prompting) should match + * the audio language. + */ + prompt: v.exactOptional(v.string()), + response_format: v.exactOptional(audioResponseFormatSchema), + /** + * The sampling temperature, between 0 and 1. Higher values like 0.8 will make + * the output more random, while lower values like 0.2 will make it more + * focused and deterministic. If set to 0, the model will use [log + * probability](https://en.wikipedia.org/wiki/Log_probability) to + * automatically increase the temperature until certain thresholds are hit. + */ + temperature: v.exactOptional(v.number()), + /** + * The timestamp granularities to populate for this transcription. + * `response_format` must be set `verbose_json` to use timestamp + * granularities. Either or both of these options are supported: `word`, or + * `segment`. Note: There is no additional latency for segment timestamps, but + * generating word timestamps incurs additional latency. + */ + "timestamp_granularities[]": v.exactOptional( + v.array(v.picklist(["word", "segment"])), + ), +}); +/** Represents an embedding vector returned by embedding endpoint. */ +export const embeddingSchema = v.strictObject({ + /** + * The index of the embedding in the list of embeddings. + */ + index: v.pipe(v.number(), v.integer()), + /** + * The embedding vector, which is a list of floats. The length of vector + * depends on the model as listed in the [embedding + * guide](/docs/guides/embeddings). + */ + embedding: v.array(v.number()), + /** + * The object type, which is always "embedding". + */ + object: v.picklist(["embedding"]), +}); +export const createEmbeddingResponseSchema = v.strictObject({ + /** + * The list of embeddings generated by the model. + */ + data: v.array(embeddingSchema), + /** + * The name of the model used to generate the embedding. + */ + model: v.string(), + /** + * The object type, which is always "list". + */ + object: v.picklist(["list"]), + /** + * The usage information for the request. + */ + usage: v.strictObject({ + /** + * The number of tokens used by the prompt. + */ + prompt_tokens: v.pipe(v.number(), v.integer()), + /** + * The total number of tokens used by the request. + */ + total_tokens: v.pipe(v.number(), v.integer()), + }), +}); +/** + * The `fine_tuning.job.checkpoint` object represents a model checkpoint for a + * fine-tuning job that is ready to use. + * @title FineTuningJobCheckpoint + */ +export const fineTuningJobCheckpointSchema = v.strictObject({ + /** + * The checkpoint identifier, which can be referenced in the API endpoints. + */ + id: v.string(), + /** + * The Unix timestamp (in seconds) for when the checkpoint was created. + */ + created_at: v.pipe(v.number(), v.integer()), + /** + * The name of the fine-tuned checkpoint model that is created. + */ + fine_tuned_model_checkpoint: v.string(), + /** + * The step number that the checkpoint was created at. + */ + step_number: v.pipe(v.number(), v.integer()), + /** + * Metrics at the step number during the fine-tuning job. + */ + metrics: v.strictObject({ + step: v.exactOptional(v.number()), + train_loss: v.exactOptional(v.number()), + train_mean_token_accuracy: v.exactOptional(v.number()), + valid_loss: v.exactOptional(v.number()), + valid_mean_token_accuracy: v.exactOptional(v.number()), + full_valid_loss: v.exactOptional(v.number()), + full_valid_mean_token_accuracy: v.exactOptional(v.number()), + }), + /** + * The name of the fine-tuning job that this checkpoint was created from. + */ + fine_tuning_job_id: v.string(), + /** + * The object type, which is always "fine_tuning.job.checkpoint". + */ + object: v.picklist(["fine_tuning.job.checkpoint"]), +}); +export const listFineTuningJobCheckpointsResponseSchema = v.strictObject({ + data: v.array(fineTuningJobCheckpointSchema), + object: v.picklist(["list"]), + first_id: v.exactOptional(v.nullable(v.string())), + last_id: v.exactOptional(v.nullable(v.string())), + has_more: v.boolean(), +}); +/** Fine-tuning job event object */ +export const fineTuningJobEventSchema = v.strictObject({ + id: v.string(), + created_at: v.pipe(v.number(), v.integer()), + level: v.picklist(["info", "warn", "error"]), + message: v.string(), + object: v.picklist(["fine_tuning.job.event"]), +}); +export const listFineTuningJobEventsResponseSchema = v.strictObject({ + data: v.array(fineTuningJobEventSchema), + object: v.picklist(["list"]), +}); +export const listFilesResponseSchema = v.strictObject({ + data: v.array(openAiFileSchema), + object: v.picklist(["list"]), +}); +/** Represents the url or the content of an image generated by the OpenAI API. */ +export const imageSchema = v.strictObject({ + /** + * The base64-encoded JSON of the generated image, if `response_format` is + * `b64_json`. + */ + b64_json: v.exactOptional(v.string()), + /** + * The URL of the generated image, if `response_format` is `url` (default). + */ + url: v.exactOptional(v.string()), + /** + * The prompt that was used to generate the image, if there was any revision + * to the prompt. + */ + revised_prompt: v.exactOptional(v.string()), +}); +export const imagesResponseSchema = v.strictObject({ + created: v.pipe(v.number(), v.integer()), + data: v.array(imageSchema), +}); +/** + * The `fine_tuning.job` object represents a fine-tuning job that has been + * created through the API. + * @title FineTuningJob + */ +export const fineTuningJobSchema = v.strictObject({ + /** + * The object identifier, which can be referenced in the API endpoints. + */ + id: v.string(), + /** + * The Unix timestamp (in seconds) for when the fine-tuning job was created. + */ + created_at: v.pipe(v.number(), v.integer()), + /** + * For fine-tuning jobs that have `failed`, this will contain more information + * on the cause of the failure. + */ + error: v.nullable( + v.strictObject({ + /** + * A machine-readable error code. + */ + code: v.string(), + /** + * A human-readable error message. + */ + message: v.string(), + /** + * The parameter that was invalid, usually `training_file` or + * `validation_file`. This field will be null if the failure was not + * parameter-specific. + */ + param: v.nullable(v.string()), + }), + ), + /** + * The name of the fine-tuned model that is being created. The value will be + * null if the fine-tuning job is still running. + */ + fine_tuned_model: v.nullable(v.string()), + /** + * The Unix timestamp (in seconds) for when the fine-tuning job was finished. + * The value will be null if the fine-tuning job is still running. + */ + finished_at: v.nullable(v.pipe(v.number(), v.integer())), + /** + * The hyperparameters used for the fine-tuning job. See the [fine-tuning + * guide](/docs/guides/fine-tuning) for more details. + */ + hyperparameters: v.strictObject({ + /** + * The number of epochs to train the model for. An epoch refers to one full + * cycle through the training dataset. + * "auto" decides the optimal number of epochs based on the size of the + * dataset. If setting the number manually, we support any number between 1 + * and 50 epochs. + */ + n_epochs: v.union([ + v.picklist(["auto"]), + v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(50)), + ]), + }), + /** + * The base model that is being fine-tuned. + */ + model: v.string(), + /** + * The object type, which is always "fine_tuning.job". + */ + object: v.picklist(["fine_tuning.job"]), + /** + * The organization that owns the fine-tuning job. + */ + organization_id: v.string(), + /** + * The compiled results file ID(s) for the fine-tuning job. You can retrieve + * the results with the [Files + * API](/docs/api-reference/files/retrieve-contents). + */ + result_files: v.array(v.string()), + /** + * The current status of the fine-tuning job, which can be either + * `validating_files`, `queued`, `running`, `succeeded`, `failed`, or + * `cancelled`. + */ + status: v.picklist([ + "validating_files", + "queued", + "running", + "succeeded", + "failed", + "cancelled", + ]), + /** + * The total number of billable tokens processed by this fine-tuning job. The + * value will be null if the fine-tuning job is still running. + */ + trained_tokens: v.nullable(v.pipe(v.number(), v.integer())), + /** + * The file ID used for training. You can retrieve the training data with the + * [Files API](/docs/api-reference/files/retrieve-contents). + */ + training_file: v.string(), + /** + * The file ID used for validation. You can retrieve the validation results + * with the [Files API](/docs/api-reference/files/retrieve-contents). + */ + validation_file: v.nullable(v.string()), + /** + * A list of integrations to enable for this fine-tuning job. + */ + integrations: v.exactOptional( + v.nullable( + v.pipe(v.array(v.union([fineTuningIntegrationSchema])), v.maxLength(5)), + ), + ), + /** + * The seed used for the fine-tuning job. + */ + seed: v.pipe(v.number(), v.integer()), + /** + * The Unix timestamp (in seconds) for when the fine-tuning job is estimated + * to finish. The value will be null if the fine-tuning job is not running. + */ + estimated_finish: v.exactOptional( + v.nullable(v.pipe(v.number(), v.integer())), + ), +}); +export const listPaginatedFineTuningJobsResponseSchema = v.strictObject({ + data: v.array(fineTuningJobSchema), + has_more: v.boolean(), + object: v.picklist(["list"]), +}); +/** Usage statistics for the completion request. */ +export const completionUsageSchema = v.strictObject({ + /** + * Number of tokens in the generated completion. + */ + completion_tokens: v.pipe(v.number(), v.integer()), + /** + * Number of tokens in the prompt. + */ + prompt_tokens: v.pipe(v.number(), v.integer()), + /** + * Total number of tokens used in the request (prompt + completion). + */ + total_tokens: v.pipe(v.number(), v.integer()), + /** + * Breakdown of tokens used in a completion. + */ + completion_tokens_details: v.exactOptional( + v.strictObject({ + /** + * Tokens generated by the model for reasoning. + */ + reasoning_tokens: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), +}); +/** + * Represents a chat completion response returned by model, based on the + * provided input. + */ +export const createChatCompletionFunctionResponseSchema = v.strictObject({ + /** + * A unique identifier for the chat completion. + */ + id: v.string(), + /** + * A list of chat completion choices. Can be more than one if `n` is greater + * than 1. + */ + choices: v.array( + v.strictObject({ + /** + * The reason the model stopped generating tokens. This will be `stop` if the + * model hit a natural stop point or a provided stop sequence, `length` if the + * maximum number of tokens specified in the request was reached, + * `content_filter` if content was omitted due to a flag from our content + * filters, or `function_call` if the model called a function. + */ + finish_reason: v.picklist([ + "stop", + "length", + "function_call", + "content_filter", + ]), + /** + * The index of the choice in the list of choices. + */ + index: v.pipe(v.number(), v.integer()), + message: v.unknown(), + }), + ), + /** + * The Unix timestamp (in seconds) of when the chat completion was created. + */ + created: v.pipe(v.number(), v.integer()), + /** + * The model used for the chat completion. + */ + model: v.string(), + /** + * This fingerprint represents the backend configuration that the model runs + * with. + * + * Can be used in conjunction with the `seed` request parameter to understand + * when backend changes have been made that might impact determinism. + */ + system_fingerprint: v.exactOptional(v.string()), + /** + * The object type, which is always `chat.completion`. + */ + object: v.picklist(["chat.completion"]), + usage: v.exactOptional(completionUsageSchema), +}); +/** + * Represents a chat completion response returned by model, based on the + * provided input. + */ +export const createChatCompletionResponseSchema = v.strictObject({ + /** + * A unique identifier for the chat completion. + */ + id: v.string(), + /** + * A list of chat completion choices. Can be more than one if `n` is greater + * than 1. + */ + choices: v.array( + v.strictObject({ + /** + * The reason the model stopped generating tokens. This will be `stop` if the + * model hit a natural stop point or a provided stop sequence, + * `length` if the maximum number of tokens specified in the request was + * reached, + * `content_filter` if content was omitted due to a flag from our content + * filters, + * `tool_calls` if the model called a tool, or `function_call` (deprecated) if + * the model called a function. + */ + finish_reason: v.picklist([ + "stop", + "length", + "tool_calls", + "content_filter", + "function_call", + ]), + /** + * The index of the choice in the list of choices. + */ + index: v.pipe(v.number(), v.integer()), + message: v.unknown(), + /** + * Log probability information for the choice. + */ + logprobs: v.nullable( + v.strictObject({ + /** + * A list of message content tokens with log probability information. + */ + content: v.nullable(v.array(chatCompletionTokenLogprobSchema)), + /** + * A list of message refusal tokens with log probability information. + */ + refusal: v.nullable(v.array(chatCompletionTokenLogprobSchema)), + }), + ), + }), + ), + /** + * The Unix timestamp (in seconds) of when the chat completion was created. + */ + created: v.pipe(v.number(), v.integer()), + /** + * The model used for the chat completion. + */ + model: v.string(), + /** + * The service tier used for processing the request. This field is only + * included if the `service_tier` parameter is specified in the request. + */ + service_tier: v.exactOptional(v.nullable(v.picklist(["scale", "default"]))), + /** + * This fingerprint represents the backend configuration that the model runs + * with. + * + * Can be used in conjunction with the `seed` request parameter to understand + * when backend changes have been made that might impact determinism. + */ + system_fingerprint: v.exactOptional(v.string()), + /** + * The object type, which is always `chat.completion`. + */ + object: v.picklist(["chat.completion"]), + usage: v.exactOptional(completionUsageSchema), +}); +/** + * Specifying a particular function via `{"name": "my_function"}` forces the + * model to call that function. + */ +export const chatCompletionFunctionCallOptionSchema = v.strictObject({ + /** + * The name of the function to call. + */ + name: v.string(), +}); +/** + * Specifies a tool the model should use. Use to force the model to call a + * specific function. + */ +export const chatCompletionNamedToolChoiceSchema = v.strictObject({ + /** + * The type of the tool. Currently, only `function` is supported. + */ + type: v.picklist(["function"]), + function: v.strictObject({ + /** + * The name of the function to call. + */ + name: v.string(), + }), +}); +/** + * Controls which (if any) tool is called by the model. + * `none` means the model will not call any tool and instead generates a + * message. + * `auto` means the model can pick between generating a message or calling one + * or more tools. + * `required` means the model must call one or more tools. + * Specifying a particular tool via `{"type": "function", "function": {"name": + * "my_function"}}` forces the model to call that tool. + * + * `none` is the default when no tools are present. `auto` is the default if + * tools are present. + */ +export const chatCompletionToolChoiceOptionSchema = v.union([ + v.picklist(["none", "auto", "required"]), + chatCompletionNamedToolChoiceSchema, +]); +/** Options for streaming response. Only set this when you set `stream: true`. */ +export const chatCompletionStreamOptionsSchema = v.nullable( + v.strictObject({ + /** + * If set, an additional chunk will be streamed before the `data: [DONE]` + * message. The `usage` field on this chunk shows the token usage statistics + * for the entire request, and the `choices` field will always be an empty + * array. All other chunks will also include a `usage` field, but with a null + * value. + */ + include_usage: v.exactOptional(v.boolean()), + }), +); +export const chatCompletionRequestFunctionMessageSchema = v.strictObject({ + /** + * The role of the messages author, in this case `function`. + */ + role: v.picklist(["function"]), + /** + * The contents of the function message. + */ + content: v.nullable(v.string()), + /** + * The name of the function to call. + */ + name: v.string(), +}); +export const chatCompletionRequestMessageContentPartTextSchema = v.strictObject( + { + /** + * The type of the content part. + */ + type: v.picklist(["text"]), + /** + * The text content. + */ + text: v.string(), + }, +); +export const chatCompletionRequestToolMessageContentPartSchema = v.union([ + chatCompletionRequestMessageContentPartTextSchema, +]); +export const chatCompletionRequestToolMessageSchema = v.strictObject({ + /** + * The role of the messages author, in this case `tool`. + */ + role: v.picklist(["tool"]), + /** + * The contents of the tool message. + */ + content: v.union([ + v.string(), + v.pipe( + v.array(chatCompletionRequestToolMessageContentPartSchema), + v.minLength(1), + ), + ]), + /** + * Tool call that this message is responding to. + */ + tool_call_id: v.string(), +}); +export const chatCompletionMessageToolCallSchema = v.strictObject({ + /** + * The ID of the tool call. + */ + id: v.string(), + /** + * The type of the tool. Currently, only `function` is supported. + */ + type: v.picklist(["function"]), + /** + * The function that the model called. + */ + function: v.strictObject({ + /** + * The name of the function to call. + */ + name: v.string(), + /** + * The arguments to call the function with, as generated by the model in JSON + * format. Note that the model does not always generate valid JSON, and may + * hallucinate parameters not defined by your function schema. Validate the + * arguments in your code before calling your function. + */ + arguments: v.string(), + }), +}); +/** The tool calls generated by the model, such as function calls. */ +export const chatCompletionMessageToolCallsSchema = v.array( + chatCompletionMessageToolCallSchema, +); +export const chatCompletionRequestMessageContentPartRefusalSchema = + v.strictObject({ + /** + * The type of the content part. + */ + type: v.picklist(["refusal"]), + /** + * The refusal message generated by the model. + */ + refusal: v.string(), + }); +export const chatCompletionRequestAssistantMessageContentPartSchema = v.union([ + chatCompletionRequestMessageContentPartTextSchema, + chatCompletionRequestMessageContentPartRefusalSchema, +]); +export const chatCompletionRequestAssistantMessageSchema = v.strictObject({ + /** + * The contents of the assistant message. Required unless `tool_calls` or + * `function_call` is specified. + */ + content: v.exactOptional( + v.nullable( + v.union([ + v.string(), + v.pipe( + v.array(chatCompletionRequestAssistantMessageContentPartSchema), + v.minLength(1), + ), + ]), + ), + ), + /** + * The refusal message by the assistant. + */ + refusal: v.exactOptional(v.nullable(v.string())), + /** + * The role of the messages author, in this case `assistant`. + */ + role: v.picklist(["assistant"]), + /** + * An optional name for the participant. Provides the model information to + * differentiate between participants of the same role. + */ + name: v.exactOptional(v.string()), + tool_calls: v.exactOptional(chatCompletionMessageToolCallsSchema), + /** + * Deprecated and replaced by `tool_calls`. The name and arguments of a + * function that should be called, as generated by the model. + */ + function_call: v.exactOptional( + v.nullable( + v.strictObject({ + /** + * The arguments to call the function with, as generated by the model in JSON + * format. Note that the model does not always generate valid JSON, and may + * hallucinate parameters not defined by your function schema. Validate the + * arguments in your code before calling your function. + */ + arguments: v.string(), + /** + * The name of the function to call. + */ + name: v.string(), + }), + ), + ), +}); +export const chatCompletionRequestMessageContentPartImageSchema = + v.strictObject({ + /** + * The type of the content part. + */ + type: v.picklist(["image_url"]), + image_url: v.strictObject({ + /** + * Either a URL of the image or the base64 encoded image data. + */ + url: v.string(), + /** + * Specifies the detail level of the image. Learn more in the [Vision + * guide](/docs/guides/vision/low-or-high-fidelity-image-understanding). + */ + detail: v.exactOptional(v.picklist(["auto", "low", "high"])), + }), + }); +export const chatCompletionRequestUserMessageContentPartSchema = v.union([ + chatCompletionRequestMessageContentPartTextSchema, + chatCompletionRequestMessageContentPartImageSchema, +]); +export const chatCompletionRequestUserMessageSchema = v.strictObject({ + /** + * The contents of the user message. + */ + content: v.union([ + v.string(), + v.pipe( + v.array(chatCompletionRequestUserMessageContentPartSchema), + v.minLength(1), + ), + ]), + /** + * The role of the messages author, in this case `user`. + */ + role: v.picklist(["user"]), + /** + * An optional name for the participant. Provides the model information to + * differentiate between participants of the same role. + */ + name: v.exactOptional(v.string()), +}); +export const chatCompletionRequestSystemMessageContentPartSchema = v.union([ + chatCompletionRequestMessageContentPartTextSchema, +]); +export const chatCompletionRequestSystemMessageSchema = v.strictObject({ + /** + * The contents of the system message. + */ + content: v.union([ + v.string(), + v.pipe( + v.array(chatCompletionRequestSystemMessageContentPartSchema), + v.minLength(1), + ), + ]), + /** + * The role of the messages author, in this case `system`. + */ + role: v.picklist(["system"]), + /** + * An optional name for the participant. Provides the model information to + * differentiate between participants of the same role. + */ + name: v.exactOptional(v.string()), +}); +export const chatCompletionRequestMessageSchema = v.union([ + chatCompletionRequestSystemMessageSchema, + chatCompletionRequestUserMessageSchema, + chatCompletionRequestAssistantMessageSchema, + chatCompletionRequestToolMessageSchema, + chatCompletionRequestFunctionMessageSchema, +]); +export const createChatCompletionRequestSchema = v.strictObject({ + /** + * A list of messages comprising the conversation so far. [Example Python + * code](https://cookbook.openai.com/examples/how_to_format_inputs_to_chatgpt_models). + */ + messages: v.pipe(v.array(chatCompletionRequestMessageSchema), v.minLength(1)), + /** + * ID of the model to use. See the [model endpoint + * compatibility](/docs/models/model-endpoint-compatibility) table for details + * on which models work with the Chat API. + */ + model: v.union([ + v.string(), + v.picklist([ + "o1-preview", + "o1-preview-2024-09-12", + "o1-mini", + "o1-mini-2024-09-12", + "gpt-4o", + "gpt-4o-2024-08-06", + "gpt-4o-2024-05-13", + "gpt-4o-2024-08-06", + "chatgpt-4o-latest", + "gpt-4o-mini", + "gpt-4o-mini-2024-07-18", + "gpt-4-turbo", + "gpt-4-turbo-2024-04-09", + "gpt-4-0125-preview", + "gpt-4-turbo-preview", + "gpt-4-1106-preview", + "gpt-4-vision-preview", + "gpt-4", + "gpt-4-0314", + "gpt-4-0613", + "gpt-4-32k", + "gpt-4-32k-0314", + "gpt-4-32k-0613", + "gpt-3.5-turbo", + "gpt-3.5-turbo-16k", + "gpt-3.5-turbo-0301", + "gpt-3.5-turbo-0613", + "gpt-3.5-turbo-1106", + "gpt-3.5-turbo-0125", + "gpt-3.5-turbo-16k-0613", + ]), + ]), + /** + * Number between -2.0 and 2.0. Positive values penalize new tokens based on + * their existing frequency in the text so far, decreasing the model's + * likelihood to repeat the same line verbatim. + * + * [See more information about frequency and presence + * penalties.](/docs/guides/text-generation/parameter-details) + */ + frequency_penalty: v.exactOptional( + v.nullable(v.pipe(v.number(), v.minValue(-2), v.maxValue(2))), + ), + /** + * Modify the likelihood of specified tokens appearing in the completion. + * + * Accepts a JSON object that maps tokens (specified by their token ID in the + * tokenizer) to an associated bias value from -100 to 100. Mathematically, + * the bias is added to the logits generated by the model prior to sampling. + * The exact effect will vary per model, but values between -1 and 1 should + * decrease or increase likelihood of selection; values like -100 or 100 + * should result in a ban or exclusive selection of the relevant token. + */ + logit_bias: v.exactOptional(v.nullable(v.record(v.string(), v.unknown()))), + /** + * Whether to return log probabilities of the output tokens or not. If true, + * returns the log probabilities of each output token returned in the + * `content` of `message`. + */ + logprobs: v.exactOptional(v.nullable(v.boolean())), + /** + * An integer between 0 and 20 specifying the number of most likely tokens to + * return at each token position, each with an associated log probability. + * `logprobs` must be set to `true` if this parameter is used. + */ + top_logprobs: v.exactOptional( + v.nullable(v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(20))), + ), + /** + * The maximum number of [tokens](/tokenizer) that can be generated in the + * chat completion. This value can be used to control + * [costs](https://openai.com/api/pricing/) for text generated via API. + * + * This value is now deprecated in favor of `max_completion_tokens`, and is + * not compatible with [o1 series models](/docs/guides/reasoning). + */ + max_tokens: v.exactOptional(v.nullable(v.pipe(v.number(), v.integer()))), + /** + * An upper bound for the number of tokens that can be generated for a + * completion, including visible output tokens and [reasoning + * tokens](/docs/guides/reasoning). + */ + max_completion_tokens: v.exactOptional( + v.nullable(v.pipe(v.number(), v.integer())), + ), + /** + * How many chat completion choices to generate for each input message. Note + * that you will be charged based on the number of generated tokens across all + * of the choices. Keep `n` as `1` to minimize costs. + */ + n: v.exactOptional( + v.nullable(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(128))), + ), + /** + * Number between -2.0 and 2.0. Positive values penalize new tokens based on + * whether they appear in the text so far, increasing the model's likelihood + * to talk about new topics. + * + * [See more information about frequency and presence + * penalties.](/docs/guides/text-generation/parameter-details) + */ + presence_penalty: v.exactOptional( + v.nullable(v.pipe(v.number(), v.minValue(-2), v.maxValue(2))), + ), + /** + * An object specifying the format that the model must output. Compatible with + * [GPT-4o](/docs/models/gpt-4o), [GPT-4o mini](/docs/models/gpt-4o-mini), + * [GPT-4 Turbo](/docs/models/gpt-4-and-gpt-4-turbo) and all GPT-3.5 Turbo + * models newer than `gpt-3.5-turbo-1106`. + * + * Setting to `{ "type": "json_schema", "json_schema": {...} }` enables + * Structured Outputs which ensures the model will match your supplied JSON + * schema. Learn more in the [Structured Outputs + * guide](/docs/guides/structured-outputs). + * + * Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the + * message the model generates is valid JSON. + * + * **Important:** when using JSON mode, you **must** also instruct the model + * to produce JSON yourself via a system or user message. Without this, the + * model may generate an unending stream of whitespace until the generation + * reaches the token limit, resulting in a long-running and seemingly "stuck" + * request. Also note that the message content may be partially cut off if + * `finish_reason="length"`, which indicates the generation exceeded + * `max_tokens` or the conversation exceeded the max context length. + */ + response_format: v.exactOptional( + v.union([ + responseFormatTextSchema, + responseFormatJsonObjectSchema, + responseFormatJsonSchemaSchema, + ]), + ), + /** + * This feature is in Beta. + * If specified, our system will make a best effort to sample + * deterministically, such that repeated requests with the same `seed` and + * parameters should return the same result. + * Determinism is not guaranteed, and you should refer to the + * `system_fingerprint` response parameter to monitor changes in the backend. + */ + seed: v.exactOptional( + v.nullable( + v.pipe( + v.number(), + v.integer(), + v.minValue(-9223372036854776000), + v.maxValue(9223372036854776000), + ), + ), + ), + /** + * Specifies the latency tier to use for processing the request. This + * parameter is relevant for customers subscribed to the scale tier service: + * + * - If set to 'auto', and the Project is Scale tier enabled, the system will + * utilize scale tier credits until they are exhausted. + * + * - If set to 'auto', and the Project is not Scale tier enabled, the request + * will be processed using the default service tier with a lower uptime SLA + * and no latency guarentee. + * + * - If set to 'default', the request will be processed using the default + * service tier with a lower uptime SLA and no latency guarentee. + * + * - When not set, the default behavior is 'auto'. + * + * + * When this parameter is set, the response body will include the + * `service_tier` utilized. + */ + service_tier: v.exactOptional(v.nullable(v.picklist(["auto", "default"]))), + /** + * Up to 4 sequences where the API will stop generating further tokens. + */ + stop: v.exactOptional( + v.union([ + v.nullable(v.string()), + v.pipe(v.array(v.string()), v.minLength(1), v.maxLength(4)), + ]), + ), + /** + * If set, partial message deltas will be sent, like in ChatGPT. Tokens will + * be sent as data-only [server-sent + * events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) + * as they become available, with the stream terminated by a `data: [DONE]` + * message. [Example Python + * code](https://cookbook.openai.com/examples/how_to_stream_completions). + */ + stream: v.exactOptional(v.nullable(v.boolean())), + stream_options: v.exactOptional(chatCompletionStreamOptionsSchema), + /** + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 + * will make the output more random, while lower values like 0.2 will make it + * more focused and deterministic. + * + * We generally recommend altering this or `top_p` but not both. + */ + temperature: v.exactOptional( + v.nullable(v.pipe(v.number(), v.minValue(0), v.maxValue(2))), + ), + /** + * An alternative to sampling with temperature, called nucleus sampling, where + * the model considers the results of the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are + * considered. + * + * We generally recommend altering this or `temperature` but not both. + */ + top_p: v.exactOptional( + v.nullable(v.pipe(v.number(), v.minValue(0), v.maxValue(1))), + ), + /** + * A list of tools the model may call. Currently, only functions are supported + * as a tool. Use this to provide a list of functions the model may generate + * JSON inputs for. A max of 128 functions are supported. + */ + tools: v.exactOptional(v.array(chatCompletionToolSchema)), + tool_choice: v.exactOptional(chatCompletionToolChoiceOptionSchema), + parallel_tool_calls: v.exactOptional(parallelToolCallsSchema), + /** + * A unique identifier representing your end-user, which can help OpenAI to + * monitor and detect abuse. [Learn + * more](/docs/guides/safety-best-practices/end-user-ids). + */ + user: v.exactOptional(v.string()), + /** + * Deprecated in favor of `tool_choice`. + * + * Controls which (if any) function is called by the model. + * `none` means the model will not call a function and instead generates a + * message. + * `auto` means the model can pick between generating a message or calling a + * function. + * Specifying a particular function via `{"name": "my_function"}` forces the + * model to call that function. + * + * `none` is the default when no functions are present. `auto` is the default + * if functions are present. + */ + function_call: v.exactOptional( + v.union([ + v.picklist(["none", "auto"]), + chatCompletionFunctionCallOptionSchema, + ]), + ), + /** + * Deprecated in favor of `tools`. + * + * A list of functions the model may generate JSON inputs for. + */ + functions: v.exactOptional( + v.pipe( + v.array(chatCompletionFunctionsSchema), + v.minLength(1), + v.maxLength(128), + ), + ), +}); +export const chatCompletionMessageToolCallChunkSchema = v.strictObject({ + index: v.pipe(v.number(), v.integer()), + /** + * The ID of the tool call. + */ + id: v.exactOptional(v.string()), + /** + * The type of the tool. Currently, only `function` is supported. + */ + type: v.exactOptional(v.picklist(["function"])), + function: v.exactOptional( + v.strictObject({ + /** + * The name of the function to call. + */ + name: v.exactOptional(v.string()), + /** + * The arguments to call the function with, as generated by the model in JSON + * format. Note that the model does not always generate valid JSON, and may + * hallucinate parameters not defined by your function schema. Validate the + * arguments in your code before calling your function. + */ + arguments: v.exactOptional(v.string()), + }), + ), +}); +/** A chat completion delta generated by streamed model responses. */ +export const chatCompletionStreamResponseDeltaSchema = v.strictObject({ + /** + * The contents of the chunk message. + */ + content: v.exactOptional(v.nullable(v.string())), + /** + * Deprecated and replaced by `tool_calls`. The name and arguments of a + * function that should be called, as generated by the model. + */ + function_call: v.exactOptional( + v.strictObject({ + /** + * The arguments to call the function with, as generated by the model in JSON + * format. Note that the model does not always generate valid JSON, and may + * hallucinate parameters not defined by your function schema. Validate the + * arguments in your code before calling your function. + */ + arguments: v.exactOptional(v.string()), + /** + * The name of the function to call. + */ + name: v.exactOptional(v.string()), + }), + ), + tool_calls: v.exactOptional( + v.array(chatCompletionMessageToolCallChunkSchema), + ), + /** + * The role of the author of this message. + */ + role: v.exactOptional(v.picklist(["system", "user", "assistant", "tool"])), + /** + * The refusal message generated by the model. + */ + refusal: v.exactOptional(v.nullable(v.string())), +}); +/** A chat completion message generated by the model. */ +export const chatCompletionResponseMessageSchema = v.strictObject({ + /** + * The contents of the message. + */ + content: v.nullable(v.string()), + /** + * The refusal message generated by the model. + */ + refusal: v.nullable(v.string()), + tool_calls: v.exactOptional(chatCompletionMessageToolCallsSchema), + /** + * The role of the author of this message. + */ + role: v.picklist(["assistant"]), + /** + * Deprecated and replaced by `tool_calls`. The name and arguments of a + * function that should be called, as generated by the model. + */ + function_call: v.exactOptional( + v.strictObject({ + /** + * The arguments to call the function with, as generated by the model in JSON + * format. Note that the model does not always generate valid JSON, and may + * hallucinate parameters not defined by your function schema. Validate the + * arguments in your code before calling your function. + */ + arguments: v.string(), + /** + * The name of the function to call. + */ + name: v.string(), + }), + ), +}); +export const fineTuneChatCompletionRequestAssistantMessageSchema = v.intersect([ + v.strictObject({ + /** + * Controls whether the assistant message is trained against (0 or 1) + */ + weight: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + chatCompletionRequestAssistantMessageSchema, +]); +/** + * Represents a completion response from the API. Note: both the streamed and + * non-streamed response objects share the same shape (unlike the chat + * endpoint). + */ +export const createCompletionResponseSchema = v.strictObject({ + /** + * A unique identifier for the completion. + */ + id: v.string(), + /** + * The list of completion choices the model generated for the input prompt. + */ + choices: v.array( + v.strictObject({ + /** + * The reason the model stopped generating tokens. This will be `stop` if the + * model hit a natural stop point or a provided stop sequence, + * `length` if the maximum number of tokens specified in the request was + * reached, + * or `content_filter` if content was omitted due to a flag from our content + * filters. + */ + finish_reason: v.picklist(["stop", "length", "content_filter"]), + index: v.pipe(v.number(), v.integer()), + logprobs: v.nullable( + v.strictObject({ + text_offset: v.exactOptional( + v.array(v.pipe(v.number(), v.integer())), + ), + token_logprobs: v.exactOptional(v.array(v.number())), + tokens: v.exactOptional(v.array(v.string())), + top_logprobs: v.exactOptional( + v.array(v.record(v.string(), v.unknown())), + ), + }), + ), + text: v.string(), + }), + ), + /** + * The Unix timestamp (in seconds) of when the completion was created. + */ + created: v.pipe(v.number(), v.integer()), + /** + * The model used for completion. + */ + model: v.string(), + /** + * This fingerprint represents the backend configuration that the model runs + * with. + * + * Can be used in conjunction with the `seed` request parameter to understand + * when backend changes have been made that might impact determinism. + */ + system_fingerprint: v.exactOptional(v.string()), + /** + * The object type, which is always "text_completion" + */ + object: v.picklist(["text_completion"]), + usage: v.exactOptional(completionUsageSchema), +}); +export const createCompletionRequestSchema = v.strictObject({ + /** + * ID of the model to use. You can use the [List + * models](/docs/api-reference/models/list) API to see all of your available + * models, or see our [Model overview](/docs/models/overview) for descriptions + * of them. + */ + model: v.union([ + v.string(), + v.picklist(["gpt-3.5-turbo-instruct", "davinci-002", "babbage-002"]), + ]), + /** + * The prompt(s) to generate completions for, encoded as a string, array of + * strings, array of tokens, or array of token arrays. + * + * Note that <|endoftext|> is the document separator that the model sees + * during training, so if a prompt is not specified the model will generate as + * if from the beginning of a new document. + */ + prompt: v.nullable( + v.union([ + v.string(), + v.array(v.string()), + v.pipe(v.array(v.pipe(v.number(), v.integer())), v.minLength(1)), + v.pipe( + v.array( + v.pipe(v.array(v.pipe(v.number(), v.integer())), v.minLength(1)), + ), + v.minLength(1), + ), + ]), + ), + /** + * Generates `best_of` completions server-side and returns the "best" (the one + * with the highest log probability per token). Results cannot be streamed. + * + * When used with `n`, `best_of` controls the number of candidate completions + * and `n` specifies how many to return – `best_of` must be greater than `n`. + * + * **Note:** Because this parameter generates many completions, it can quickly + * consume your token quota. Use carefully and ensure that you have reasonable + * settings for `max_tokens` and `stop`. + */ + best_of: v.exactOptional( + v.nullable(v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(20))), + ), + /** + * Echo back the prompt in addition to the completion + */ + echo: v.exactOptional(v.nullable(v.boolean())), + /** + * Number between -2.0 and 2.0. Positive values penalize new tokens based on + * their existing frequency in the text so far, decreasing the model's + * likelihood to repeat the same line verbatim. + * + * [See more information about frequency and presence + * penalties.](/docs/guides/text-generation/parameter-details) + */ + frequency_penalty: v.exactOptional( + v.nullable(v.pipe(v.number(), v.minValue(-2), v.maxValue(2))), + ), + /** + * Modify the likelihood of specified tokens appearing in the completion. + * + * Accepts a JSON object that maps tokens (specified by their token ID in the + * GPT tokenizer) to an associated bias value from -100 to 100. You can use + * this [tokenizer tool](/tokenizer?view=bpe) to convert text to token IDs. + * Mathematically, the bias is added to the logits generated by the model + * prior to sampling. The exact effect will vary per model, but values between + * -1 and 1 should decrease or increase likelihood of selection; values like + * -100 or 100 should result in a ban or exclusive selection of the relevant + * token. + * + * As an example, you can pass `{"50256": -100}` to prevent the <|endoftext|> + * token from being generated. + */ + logit_bias: v.exactOptional(v.nullable(v.record(v.string(), v.unknown()))), + /** + * Include the log probabilities on the `logprobs` most likely output tokens, + * as well the chosen tokens. For example, if `logprobs` is 5, the API will + * return a list of the 5 most likely tokens. The API will always return the + * `logprob` of the sampled token, so there may be up to `logprobs+1` elements + * in the response. + * + * The maximum value for `logprobs` is 5. + */ + logprobs: v.exactOptional( + v.nullable(v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(5))), + ), + /** + * The maximum number of [tokens](/tokenizer) that can be generated in the + * completion. + * + * The token count of your prompt plus `max_tokens` cannot exceed the model's + * context length. [Example Python + * code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) + * for counting tokens. + */ + max_tokens: v.exactOptional( + v.nullable(v.pipe(v.number(), v.integer(), v.minValue(0))), + ), + /** + * How many completions to generate for each prompt. + * + * **Note:** Because this parameter generates many completions, it can quickly + * consume your token quota. Use carefully and ensure that you have reasonable + * settings for `max_tokens` and `stop`. + */ + n: v.exactOptional( + v.nullable(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(128))), + ), + /** + * Number between -2.0 and 2.0. Positive values penalize new tokens based on + * whether they appear in the text so far, increasing the model's likelihood + * to talk about new topics. + * + * [See more information about frequency and presence + * penalties.](/docs/guides/text-generation/parameter-details) + */ + presence_penalty: v.exactOptional( + v.nullable(v.pipe(v.number(), v.minValue(-2), v.maxValue(2))), + ), + /** + * If specified, our system will make a best effort to sample + * deterministically, such that repeated requests with the same `seed` and + * parameters should return the same result. + * + * Determinism is not guaranteed, and you should refer to the + * `system_fingerprint` response parameter to monitor changes in the backend. + */ + seed: v.exactOptional( + v.nullable( + v.pipe( + v.number(), + v.integer(), + v.minValue(-9223372036854776000), + v.maxValue(9223372036854776000), + ), + ), + ), + /** + * Up to 4 sequences where the API will stop generating further tokens. The + * returned text will not contain the stop sequence. + */ + stop: v.exactOptional( + v.nullable( + v.union([ + v.nullable(v.string()), + v.pipe(v.array(v.string()), v.minLength(1), v.maxLength(4)), + ]), + ), + ), + /** + * Whether to stream back partial progress. If set, tokens will be sent as + * data-only [server-sent + * events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) + * as they become available, with the stream terminated by a `data: [DONE]` + * message. [Example Python + * code](https://cookbook.openai.com/examples/how_to_stream_completions). + */ + stream: v.exactOptional(v.nullable(v.boolean())), + stream_options: v.exactOptional(chatCompletionStreamOptionsSchema), + /** + * The suffix that comes after a completion of inserted text. + * + * This parameter is only supported for `gpt-3.5-turbo-instruct`. + */ + suffix: v.exactOptional(v.nullable(v.string())), + /** + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 + * will make the output more random, while lower values like 0.2 will make it + * more focused and deterministic. + * + * We generally recommend altering this or `top_p` but not both. + */ + temperature: v.exactOptional( + v.nullable(v.pipe(v.number(), v.minValue(0), v.maxValue(2))), + ), + /** + * An alternative to sampling with temperature, called nucleus sampling, where + * the model considers the results of the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are + * considered. + * + * We generally recommend altering this or `temperature` but not both. + */ + top_p: v.exactOptional( + v.nullable(v.pipe(v.number(), v.minValue(0), v.maxValue(1))), + ), + /** + * A unique identifier representing your end-user, which can help OpenAI to + * monitor and detect abuse. [Learn + * more](/docs/guides/safety-best-practices/end-user-ids). + */ + user: v.exactOptional(v.string()), +}); +/** + * Describes an OpenAI model offering that can be used with the API. + * @title Model + */ +export const modelSchema = v.strictObject({ + /** + * The model identifier, which can be referenced in the API endpoints. + */ + id: v.string(), + /** + * The Unix timestamp (in seconds) when the model was created. + */ + created: v.pipe(v.number(), v.integer()), + /** + * The object type, which is always "model". + */ + object: v.picklist(["model"]), + /** + * The organization that owns the model. + */ + owned_by: v.string(), +}); +export const listModelsResponseSchema = v.strictObject({ + object: v.picklist(["list"]), + data: v.array(modelSchema), +}); +export const errorResponseSchema = v.strictObject({ + error: errorSchema, +}); +export const createChatCompletionCommandBodySchema = + createChatCompletionRequestSchema; +export const createCompletionCommandBodySchema = createCompletionRequestSchema; +export const createImageCommandBodySchema = createImageRequestSchema; +export const createEmbeddingCommandBodySchema = createEmbeddingRequestSchema; +export const createSpeechCommandBodySchema = createSpeechRequestSchema; +export const listFilesCommandQuerySchema = v.strictObject({ + purpose: v.exactOptional(v.string()), +}); +export const deleteFileCommandParamsSchema = v.strictObject({ + file_id: v.string(), +}); +export const retrieveFileCommandParamsSchema = v.strictObject({ + file_id: v.string(), +}); +export const downloadFileCommandParamsSchema = v.strictObject({ + file_id: v.string(), +}); +export const createUploadCommandBodySchema = createUploadRequestSchema; +export const addUploadPartCommandParamsSchema = v.strictObject({ + upload_id: v.string(), +}); +export const completeUploadCommandBodySchema = completeUploadRequestSchema; +export const completeUploadCommandParamsSchema = v.strictObject({ + upload_id: v.string(), +}); +export const cancelUploadCommandParamsSchema = v.strictObject({ + upload_id: v.string(), +}); +export const createFineTuningJobCommandBodySchema = + createFineTuningJobRequestSchema; +export const listPaginatedFineTuningJobsCommandQuerySchema = v.strictObject({ + after: v.exactOptional(v.string()), + limit: v.exactOptional(v.pipe(v.number(), v.integer())), +}); +export const retrieveFineTuningJobCommandParamsSchema = v.strictObject({ + fine_tuning_job_id: v.string(), +}); +export const listFineTuningEventsCommandParamsSchema = v.strictObject({ + fine_tuning_job_id: v.string(), +}); +export const listFineTuningEventsCommandQuerySchema = v.strictObject({ + after: v.exactOptional(v.string()), + limit: v.exactOptional(v.pipe(v.number(), v.integer())), +}); +export const cancelFineTuningJobCommandParamsSchema = v.strictObject({ + fine_tuning_job_id: v.string(), +}); +export const listFineTuningJobCheckpointsCommandParamsSchema = v.strictObject({ + fine_tuning_job_id: v.string(), +}); +export const listFineTuningJobCheckpointsCommandQuerySchema = v.strictObject({ + after: v.exactOptional(v.string()), + limit: v.exactOptional(v.pipe(v.number(), v.integer())), +}); +export const retrieveModelCommandParamsSchema = v.strictObject({ + model: v.string(), +}); +export const deleteModelCommandParamsSchema = v.strictObject({ + model: v.string(), +}); +export const createModerationCommandBodySchema = createModerationRequestSchema; +export const listAssistantsCommandQuerySchema = v.strictObject({ + limit: v.exactOptional(v.pipe(v.number(), v.integer())), + order: v.exactOptional(v.picklist(["asc", "desc"])), + after: v.exactOptional(v.string()), + before: v.exactOptional(v.string()), +}); +export const createAssistantCommandBodySchema = createAssistantRequestSchema; +export const getAssistantCommandParamsSchema = v.strictObject({ + assistant_id: v.string(), +}); +export const modifyAssistantCommandBodySchema = modifyAssistantRequestSchema; +export const modifyAssistantCommandParamsSchema = v.strictObject({ + assistant_id: v.string(), +}); +export const deleteAssistantCommandParamsSchema = v.strictObject({ + assistant_id: v.string(), +}); +export const createThreadCommandBodySchema = createThreadRequestSchema; +export const getThreadCommandParamsSchema = v.strictObject({ + thread_id: v.string(), +}); +export const modifyThreadCommandBodySchema = modifyThreadRequestSchema; +export const modifyThreadCommandParamsSchema = v.strictObject({ + thread_id: v.string(), +}); +export const deleteThreadCommandParamsSchema = v.strictObject({ + thread_id: v.string(), +}); +export const listMessagesCommandParamsSchema = v.strictObject({ + thread_id: v.string(), +}); +export const listMessagesCommandQuerySchema = v.strictObject({ + limit: v.exactOptional(v.pipe(v.number(), v.integer())), + order: v.exactOptional(v.picklist(["asc", "desc"])), + after: v.exactOptional(v.string()), + before: v.exactOptional(v.string()), + run_id: v.exactOptional(v.string()), +}); +export const createMessageCommandBodySchema = createMessageRequestSchema; +export const createMessageCommandParamsSchema = v.strictObject({ + thread_id: v.string(), +}); +export const getMessageCommandParamsSchema = v.strictObject({ + thread_id: v.string(), + message_id: v.string(), +}); +export const modifyMessageCommandBodySchema = modifyMessageRequestSchema; +export const modifyMessageCommandParamsSchema = v.strictObject({ + thread_id: v.string(), + message_id: v.string(), +}); +export const deleteMessageCommandParamsSchema = v.strictObject({ + thread_id: v.string(), + message_id: v.string(), +}); +export const createThreadAndRunCommandBodySchema = + createThreadAndRunRequestSchema; +export const listRunsCommandParamsSchema = v.strictObject({ + thread_id: v.string(), +}); +export const listRunsCommandQuerySchema = v.strictObject({ + limit: v.exactOptional(v.pipe(v.number(), v.integer())), + order: v.exactOptional(v.picklist(["asc", "desc"])), + after: v.exactOptional(v.string()), + before: v.exactOptional(v.string()), +}); +export const createRunCommandBodySchema = createRunRequestSchema; +export const createRunCommandParamsSchema = v.strictObject({ + thread_id: v.string(), +}); +export const createRunCommandQuerySchema = v.strictObject({ + "include[]": v.exactOptional( + v.array( + v.picklist(["step_details.tool_calls[*].file_search.results[*].content"]), + ), + ), +}); +export const getRunCommandParamsSchema = v.strictObject({ + thread_id: v.string(), + run_id: v.string(), +}); +export const modifyRunCommandBodySchema = modifyRunRequestSchema; +export const modifyRunCommandParamsSchema = v.strictObject({ + thread_id: v.string(), + run_id: v.string(), +}); +export const submitToolOuputsToRunCommandBodySchema = + submitToolOutputsRunRequestSchema; +export const submitToolOuputsToRunCommandParamsSchema = v.strictObject({ + thread_id: v.string(), + run_id: v.string(), +}); +export const cancelRunCommandParamsSchema = v.strictObject({ + thread_id: v.string(), + run_id: v.string(), +}); +export const listRunStepsCommandParamsSchema = v.strictObject({ + thread_id: v.string(), + run_id: v.string(), +}); +export const listRunStepsCommandQuerySchema = v.strictObject({ + limit: v.exactOptional(v.pipe(v.number(), v.integer())), + order: v.exactOptional(v.picklist(["asc", "desc"])), + after: v.exactOptional(v.string()), + before: v.exactOptional(v.string()), + "include[]": v.exactOptional( + v.array( + v.picklist(["step_details.tool_calls[*].file_search.results[*].content"]), + ), + ), +}); +export const getRunStepCommandParamsSchema = v.strictObject({ + thread_id: v.string(), + run_id: v.string(), + step_id: v.string(), +}); +export const getRunStepCommandQuerySchema = v.strictObject({ + "include[]": v.exactOptional( + v.array( + v.picklist(["step_details.tool_calls[*].file_search.results[*].content"]), + ), + ), +}); +export const listVectorStoresCommandQuerySchema = v.strictObject({ + limit: v.exactOptional(v.pipe(v.number(), v.integer())), + order: v.exactOptional(v.picklist(["asc", "desc"])), + after: v.exactOptional(v.string()), + before: v.exactOptional(v.string()), +}); +export const createVectorStoreCommandBodySchema = + createVectorStoreRequestSchema; +export const getVectorStoreCommandParamsSchema = v.strictObject({ + vector_store_id: v.string(), +}); +export const modifyVectorStoreCommandBodySchema = + updateVectorStoreRequestSchema; +export const modifyVectorStoreCommandParamsSchema = v.strictObject({ + vector_store_id: v.string(), +}); +export const deleteVectorStoreCommandParamsSchema = v.strictObject({ + vector_store_id: v.string(), +}); +export const listVectorStoreFilesCommandParamsSchema = v.strictObject({ + vector_store_id: v.string(), +}); +export const listVectorStoreFilesCommandQuerySchema = v.strictObject({ + limit: v.exactOptional(v.pipe(v.number(), v.integer())), + order: v.exactOptional(v.picklist(["asc", "desc"])), + after: v.exactOptional(v.string()), + before: v.exactOptional(v.string()), + filter: v.exactOptional( + v.picklist(["in_progress", "completed", "failed", "cancelled"]), + ), +}); +export const createVectorStoreFileCommandBodySchema = + createVectorStoreFileRequestSchema; +export const createVectorStoreFileCommandParamsSchema = v.strictObject({ + vector_store_id: v.string(), +}); +export const getVectorStoreFileCommandParamsSchema = v.strictObject({ + vector_store_id: v.string(), + file_id: v.string(), +}); +export const deleteVectorStoreFileCommandParamsSchema = v.strictObject({ + vector_store_id: v.string(), + file_id: v.string(), +}); +export const createVectorStoreFileBatchCommandBodySchema = + createVectorStoreFileBatchRequestSchema; +export const createVectorStoreFileBatchCommandParamsSchema = v.strictObject({ + vector_store_id: v.string(), +}); +export const getVectorStoreFileBatchCommandParamsSchema = v.strictObject({ + vector_store_id: v.string(), + batch_id: v.string(), +}); +export const cancelVectorStoreFileBatchCommandParamsSchema = v.strictObject({ + vector_store_id: v.string(), + batch_id: v.string(), +}); +export const listFilesInVectorStoreBatchCommandParamsSchema = v.strictObject({ + vector_store_id: v.string(), + batch_id: v.string(), +}); +export const listFilesInVectorStoreBatchCommandQuerySchema = v.strictObject({ + limit: v.exactOptional(v.pipe(v.number(), v.integer())), + order: v.exactOptional(v.picklist(["asc", "desc"])), + after: v.exactOptional(v.string()), + before: v.exactOptional(v.string()), + filter: v.exactOptional( + v.picklist(["in_progress", "completed", "failed", "cancelled"]), + ), +}); +export const createBatchCommandBodySchema = v.strictObject({ + /** + * The ID of an uploaded file that contains requests for the new batch. + * + * See [upload file](/docs/api-reference/files/create) for how to upload a + * file. + * + * Your input file must be formatted as a [JSONL + * file](/docs/api-reference/batch/request-input), and must be uploaded with + * the purpose `batch`. The file can contain up to 50,000 requests, and can be + * up to 100 MB in size. + */ + input_file_id: v.string(), + /** + * The endpoint to be used for all requests in the batch. Currently + * `/v1/chat/completions`, `/v1/embeddings`, and `/v1/completions` are + * supported. Note that `/v1/embeddings` batches are also restricted to a + * maximum of 50,000 embedding inputs across all requests in the batch. + */ + endpoint: v.picklist([ + "/v1/chat/completions", + "/v1/embeddings", + "/v1/completions", + ]), + /** + * The time frame within which the batch should be processed. Currently only + * `24h` is supported. + */ + completion_window: v.picklist(["24h"]), + /** + * Optional custom metadata for the batch. + */ + metadata: v.exactOptional(v.nullable(v.record(v.string(), v.unknown()))), +}); +export const listBatchesCommandQuerySchema = v.strictObject({ + after: v.exactOptional(v.string()), + limit: v.exactOptional(v.pipe(v.number(), v.integer())), +}); +export const retrieveBatchCommandParamsSchema = v.strictObject({ + batch_id: v.string(), +}); +export const cancelBatchCommandParamsSchema = v.strictObject({ + batch_id: v.string(), +}); +export const listAuditLogsCommandQuerySchema = v.strictObject({ + effective_at: v.exactOptional( + v.strictObject({ + /** + * Return only events whose `effective_at` (Unix seconds) is greater than this + * value. + */ + gt: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Return only events whose `effective_at` (Unix seconds) is greater than or + * equal to this value. + */ + gte: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Return only events whose `effective_at` (Unix seconds) is less than this + * value. + */ + lt: v.exactOptional(v.pipe(v.number(), v.integer())), + /** + * Return only events whose `effective_at` (Unix seconds) is less than or + * equal to this value. + */ + lte: v.exactOptional(v.pipe(v.number(), v.integer())), + }), + ), + "project_ids[]": v.exactOptional(v.array(v.string())), + "event_types[]": v.exactOptional(v.array(auditLogEventTypeSchema)), + "actor_ids[]": v.exactOptional(v.array(v.string())), + "actor_emails[]": v.exactOptional(v.array(v.string())), + "resource_ids[]": v.exactOptional(v.array(v.string())), + limit: v.exactOptional(v.pipe(v.number(), v.integer())), + after: v.exactOptional(v.string()), + before: v.exactOptional(v.string()), +}); +export const listInvitesCommandQuerySchema = v.strictObject({ + limit: v.exactOptional(v.pipe(v.number(), v.integer())), + after: v.exactOptional(v.string()), +}); +export const inviteUserCommandBodySchema = inviteRequestSchema; +export const retrieveInviteCommandParamsSchema = v.strictObject({ + invite_id: v.string(), +}); +export const deleteInviteCommandParamsSchema = v.strictObject({ + invite_id: v.string(), +}); +export const listUsersCommandQuerySchema = v.strictObject({ + limit: v.exactOptional(v.pipe(v.number(), v.integer())), + after: v.exactOptional(v.string()), +}); +export const retrieveUserCommandParamsSchema = v.strictObject({ + user_id: v.string(), +}); +export const modifyUserCommandBodySchema = userRoleUpdateRequestSchema; +export const modifyUserCommandParamsSchema = v.strictObject({ + user_id: v.string(), +}); +export const deleteUserCommandParamsSchema = v.strictObject({ + user_id: v.string(), +}); +export const listProjectsCommandQuerySchema = v.strictObject({ + limit: v.exactOptional(v.pipe(v.number(), v.integer())), + after: v.exactOptional(v.string()), + include_archived: v.exactOptional(v.boolean()), +}); +export const createProjectCommandBodySchema = projectCreateRequestSchema; +export const retrieveProjectCommandParamsSchema = v.strictObject({ + project_id: v.string(), +}); +export const modifyProjectCommandBodySchema = projectUpdateRequestSchema; +export const modifyProjectCommandParamsSchema = v.strictObject({ + project_id: v.string(), +}); +export const archiveProjectCommandParamsSchema = v.strictObject({ + project_id: v.string(), +}); +export const listProjectUsersCommandParamsSchema = v.strictObject({ + project_id: v.string(), +}); +export const listProjectUsersCommandQuerySchema = v.strictObject({ + limit: v.exactOptional(v.pipe(v.number(), v.integer())), + after: v.exactOptional(v.string()), +}); +export const createProjectUserCommandBodySchema = + projectUserCreateRequestSchema; +export const createProjectUserCommandParamsSchema = v.strictObject({ + project_id: v.string(), +}); +export const retrieveProjectUserCommandParamsSchema = v.strictObject({ + project_id: v.string(), + user_id: v.string(), +}); +export const modifyProjectUserCommandBodySchema = + projectUserUpdateRequestSchema; +export const modifyProjectUserCommandParamsSchema = v.strictObject({ + project_id: v.string(), + user_id: v.string(), +}); +export const deleteProjectUserCommandParamsSchema = v.strictObject({ + project_id: v.string(), + user_id: v.string(), +}); +export const listProjectServiceAccountsCommandParamsSchema = v.strictObject({ + project_id: v.string(), +}); +export const listProjectServiceAccountsCommandQuerySchema = v.strictObject({ + limit: v.exactOptional(v.pipe(v.number(), v.integer())), + after: v.exactOptional(v.string()), +}); +export const createProjectServiceAccountCommandBodySchema = + projectServiceAccountCreateRequestSchema; +export const createProjectServiceAccountCommandParamsSchema = v.strictObject({ + project_id: v.string(), +}); +export const retrieveProjectServiceAccountCommandParamsSchema = v.strictObject({ + project_id: v.string(), + service_account_id: v.string(), +}); +export const deleteProjectServiceAccountCommandParamsSchema = v.strictObject({ + project_id: v.string(), + service_account_id: v.string(), +}); +export const listProjectApiKeysCommandParamsSchema = v.strictObject({ + project_id: v.string(), +}); +export const listProjectApiKeysCommandQuerySchema = v.strictObject({ + limit: v.exactOptional(v.pipe(v.number(), v.integer())), + after: v.exactOptional(v.string()), +}); +export const retrieveProjectApiKeyCommandParamsSchema = v.strictObject({ + project_id: v.string(), + key_id: v.string(), +}); +export const deleteProjectApiKeyCommandParamsSchema = v.strictObject({ + project_id: v.string(), + key_id: v.string(), +}); diff --git a/__tests__/fixtures/petstore.json b/__tests__/fixtures/petstore.json index 9fd517b..7baecb2 100644 --- a/__tests__/fixtures/petstore.json +++ b/__tests__/fixtures/petstore.json @@ -1,235 +1,235 @@ { - "openapi": "3.0.0", - "info": { - "version": "1.0.0", - "title": "Swagger Petstore", - "description": "A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification", - "termsOfService": "http://swagger.io/terms/", - "contact": { - "name": "Swagger API Team", - "email": "apiteam@swagger.io", - "url": "http://swagger.io" - }, - "license": { - "name": "Apache 2.0", - "url": "https://www.apache.org/licenses/LICENSE-2.0.html" - } - }, - "servers": [ - { - "url": "http://petstore.swagger.io/api" - } - ], - "paths": { - "/pets": { - "get": { - "description": "Returns all pets from the system that the user has access to\nNam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia.\n\nSed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien.\n", - "operationId": "findPets", - "parameters": [ - { - "name": "tags", - "in": "query", - "description": "tags to filter by", - "required": false, - "style": "form", - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - }, - { - "name": "limit", - "in": "query", - "description": "maximum number of results to return", - "required": false, - "schema": { - "type": "integer", - "format": "int32" - } - } - ], - "responses": { - "200": { - "description": "pet response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - }, - "default": { - "description": "unexpected error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - } - }, - "post": { - "description": "Creates a new pet in the store. Duplicates are allowed", - "operationId": "addPet", - "requestBody": { - "description": "Pet to add to the store", - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/NewPet" - } - } - } - }, - "responses": { - "200": { - "description": "pet response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Pet" - } - } - } - }, - "default": { - "description": "unexpected error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - } - } - }, - "/pets/{id}": { - "get": { - "description": "Returns a user based on a single ID, if the user does not have access to the pet", - "operationId": "find pet by id", - "parameters": [ - { - "name": "id", - "in": "path", - "description": "ID of pet to fetch", - "required": true, - "schema": { - "type": "integer", - "format": "int64" - } - } - ], - "responses": { - "200": { - "description": "pet response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Pet" - } - } - } - }, - "default": { - "description": "unexpected error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - } - }, - "delete": { - "description": "deletes a single pet based on the ID supplied", - "operationId": "deletePet", - "parameters": [ - { - "name": "id", - "in": "path", - "description": "ID of pet to delete", - "required": true, - "schema": { - "type": "integer", - "format": "int64" - } - } - ], - "responses": { - "204": { - "description": "pet deleted" - }, - "default": { - "description": "unexpected error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "allOf": [ - { - "$ref": "#/components/schemas/NewPet" - }, - { - "type": "object", - "required": ["id"], - "properties": { - "id": { - "type": "integer", - "format": "int64" - } - } - } - ] - }, - "NewPet": { - "type": "object", - "required": ["name"], - "properties": { - "name": { - "type": "string" - }, - "tag": { - "type": "string" - } - } - }, - "Error": { - "type": "object", - "required": ["code", "message"], - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - } - } - } - } - } + "openapi": "3.0.0", + "info": { + "version": "1.0.0", + "title": "Swagger Petstore", + "description": "A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification", + "termsOfService": "http://swagger.io/terms/", + "contact": { + "name": "Swagger API Team", + "email": "apiteam@swagger.io", + "url": "http://swagger.io" + }, + "license": { + "name": "Apache 2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "servers": [ + { + "url": "http://petstore.swagger.io/api" + } + ], + "paths": { + "/pets": { + "get": { + "description": "Returns all pets from the system that the user has access to\nNam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia.\n\nSed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien.\n", + "operationId": "findPets", + "parameters": [ + { + "name": "tags", + "in": "query", + "description": "tags to filter by", + "required": false, + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "name": "limit", + "in": "query", + "description": "maximum number of results to return", + "required": false, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "pet response", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Pet" + } + } + } + } + }, + "default": { + "description": "unexpected error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "post": { + "description": "Creates a new pet in the store. Duplicates are allowed", + "operationId": "addPet", + "requestBody": { + "description": "Pet to add to the store", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NewPet" + } + } + } + }, + "responses": { + "200": { + "description": "pet response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Pet" + } + } + } + }, + "default": { + "description": "unexpected error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/pets/{id}": { + "get": { + "description": "Returns a user based on a single ID, if the user does not have access to the pet", + "operationId": "find pet by id", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID of pet to fetch", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "200": { + "description": "pet response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Pet" + } + } + } + }, + "default": { + "description": "unexpected error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "delete": { + "description": "deletes a single pet based on the ID supplied", + "operationId": "deletePet", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID of pet to delete", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "pet deleted" + }, + "default": { + "description": "unexpected error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "Pet": { + "allOf": [ + { + "$ref": "#/components/schemas/NewPet" + }, + { + "type": "object", + "required": ["id"], + "properties": { + "id": { + "type": "integer", + "format": "int64" + } + } + } + ] + }, + "NewPet": { + "type": "object", + "required": ["name"], + "properties": { + "name": { + "type": "string" + }, + "tag": { + "type": "string" + } + } + }, + "Error": { + "type": "object", + "required": ["code", "message"], + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + } + } + } + } + } } diff --git a/__tests__/fixtures/petstore/PublicValibotHonoError.ts b/__tests__/fixtures/petstore/PublicValibotHonoError.ts new file mode 100644 index 0000000..67819ee --- /dev/null +++ b/__tests__/fixtures/petstore/PublicValibotHonoError.ts @@ -0,0 +1,19 @@ +import { CustomError } from "@block65/custom-error"; +import type * as v from "valibot"; + +export class PublicValibotHonoError extends CustomError { + static from( + err: v.ValiError< + | v.BaseSchema> + | v.BaseSchemaAsync> + >, + ) { + return new PublicValibotHonoError(err.message, err).addDetail({ + violations: err.issues.map((issue) => ({ + field: issue.path?.join(".") || "", + description: issue.message, + })), + description: err.message, + }); + } +} diff --git a/__tests__/fixtures/petstore/commands.ts b/__tests__/fixtures/petstore/commands.ts index 5c769f8..55a92ed 100644 --- a/__tests__/fixtures/petstore/commands.ts +++ b/__tests__/fixtures/petstore/commands.ts @@ -3,20 +3,19 @@ * * WARN: Do not edit directly. * - * Generated on 2024-10-13T02:06:27.975Z + * Generated on 2026-03-06T07:45:20.003Z * */ /** eslint-disable max-classes */ -import { Command } from '@block65/rest-client'; +import { Command, jsonStringify, stripUndefined } from "@block65/rest-client"; import type { - FindPetsCommandQuery, - FindPetsCommandInput, - Pet, - AddPetCommandInput, - AddPetCommandBody, - FindPetByIdCommandInput, - DeletePetCommandInput, -} from './types.js'; + AddPetCommandInput, + DeletePetCommandInput, + FindPetByIdCommandInput, + FindPetsCommandInput, + FindPetsCommandQuery, + Pet, +} from "./types.js"; /** * Returns all pets from the system that the user has access to @@ -45,34 +44,29 @@ import type { * */ export class FindPetsCommand extends Command< - FindPetsCommandInput, - Pet[], - never, - FindPetsCommandQuery + FindPetsCommandInput, + Pet[], + FindPetsCommandQuery > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: FindPetsCommandInput) { - const { tags, limit } = input; - super(`/pets`, undefined, { tags, limit }); - } + constructor(input: FindPetsCommandInput) { + const { tags, limit } = input; + super("/pets", undefined, stripUndefined({ tags, limit })); + } } /** * Creates a new pet in the store. Duplicates are allowed * */ -export class AddPetCommand extends Command< - AddPetCommandInput, - Pet, - AddPetCommandBody -> { - public override method = 'post' as const; +export class AddPetCommand extends Command { + public override method = "post" as const; - constructor(input: AddPetCommandInput) { - const body = input; - super(`/pets`, body); - } + constructor(input: AddPetCommandInput) { + const body = input; + super("/pets", jsonStringify(body)); + } } /** @@ -80,17 +74,13 @@ export class AddPetCommand extends Command< * the pet * */ -export class FindPetByIdCommand extends Command< - FindPetByIdCommandInput, - Pet, - never -> { - public override method = 'get' as const; +export class FindPetByIdCommand extends Command { + public override method = "get" as const; - constructor(input: FindPetByIdCommandInput) { - const { id } = input; - super(`/pets/${id}`); - } + constructor(input: FindPetByIdCommandInput) { + const { id } = input; + super(`/pets/${id}`); + } } /** @@ -98,14 +88,13 @@ export class FindPetByIdCommand extends Command< * */ export class DeletePetCommand extends Command< - DeletePetCommandInput, - undefined, - never + DeletePetCommandInput, + undefined > { - public override method = 'delete' as const; + public override method = "delete" as const; - constructor(input: DeletePetCommandInput) { - const { id } = input; - super(`/pets/${id}`); - } + constructor(input: DeletePetCommandInput) { + const { id } = input; + super(`/pets/${id}`); + } } diff --git a/__tests__/fixtures/petstore/hono-valibot.ts b/__tests__/fixtures/petstore/hono-valibot.ts new file mode 100644 index 0000000..3c9ec57 --- /dev/null +++ b/__tests__/fixtures/petstore/hono-valibot.ts @@ -0,0 +1,54 @@ +/** + * This file was auto generated by @block65/openapi-codegen + * + * WARN: Do not edit directly. + * + * Generated on 2026-03-06T07:45:20.003Z + * + */ + +import { PublicValibotHonoError } from "@block65/rest-client"; +import { validator } from "hono/validator"; +import * as v from "valibot"; +import { + addPetCommandBodySchema, + deletePetCommandParamsSchema, + findPetByIdCommandParamsSchema, + findPetsCommandQuerySchema, +} from "./valibot.js"; + +function toPublicValibotHonoError(err: unknown): never { + if (err instanceof v.ValiError) { + throw PublicValibotHonoError.from(err); + } + throw err; +} + +export const findPets = [ + validator("query", (value) => { + return v + .parseAsync(findPetsCommandQuerySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const addPet = [ + validator("json", (value) => { + return v + .parseAsync(addPetCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const findpetbyid = [ + validator("param", (value) => { + return v + .parseAsync(findPetByIdCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const deletePet = [ + validator("param", (value) => { + return v + .parseAsync(deletePetCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; diff --git a/__tests__/fixtures/petstore/main.ts b/__tests__/fixtures/petstore/main.ts index d508984..47c4a93 100644 --- a/__tests__/fixtures/petstore/main.ts +++ b/__tests__/fixtures/petstore/main.ts @@ -3,36 +3,36 @@ * * WARN: Do not edit directly. * - * Generated on 2024-10-13T02:06:27.975Z + * Generated on 2026-03-06T07:45:20.003Z * */ import { - RestServiceClient, - type RestServiceClientConfig, -} from '@block65/rest-client'; + RestServiceClient, + type RestServiceClientConfig, +} from "@block65/rest-client"; import type { - AddPetCommandInput, - DeletePetCommandInput, - FindPetByIdCommandInput, - FindPetsCommandInput, - Pet, -} from './types.js'; + AddPetCommandInput, + DeletePetCommandInput, + FindPetByIdCommandInput, + FindPetsCommandInput, + Pet, +} from "./types.js"; type AllInputs = - | AddPetCommandInput - | DeletePetCommandInput - | FindPetByIdCommandInput - | FindPetsCommandInput; + | AddPetCommandInput + | DeletePetCommandInput + | FindPetByIdCommandInput + | FindPetsCommandInput; type AllOutputs = Pet | Pet[] | undefined; export class SwaggerPetstoreRestClient extends RestServiceClient< - AllInputs, - AllOutputs + AllInputs, + AllOutputs > { - constructor( - baseUrl: string | URL = new URL('http://petstore.swagger.io/api/'), - config?: RestServiceClientConfig, - ) { - super(baseUrl, config); - } + constructor( + baseUrl: string | URL = new URL("http://petstore.swagger.io/api/"), + config?: RestServiceClientConfig, + ) { + super(baseUrl, config); + } } diff --git a/__tests__/fixtures/petstore/types.ts b/__tests__/fixtures/petstore/types.ts index 7eb1cff..2884e32 100644 --- a/__tests__/fixtures/petstore/types.ts +++ b/__tests__/fixtures/petstore/types.ts @@ -3,33 +3,33 @@ * * WARN: Do not edit directly. * - * Generated on 2024-10-13T02:06:27.975Z + * Generated on 2026-03-06T07:45:20.003Z * */ export type Error = { - code: number; - message: string; + code: number; + message: string; }; export type NewPet = { - name: string; - tag?: string; + name: string; + tag?: string; }; export type Pet = NewPet & { - id: number; + id: number; }; export type FindPetsCommandQuery = { - tags?: string[] | undefined; - limit?: `${number}` | undefined; + tags?: readonly string[] | undefined; + limit?: `${number}` | undefined; }; export type FindPetsCommandInput = FindPetsCommandQuery; -export type AddPetCommandInput = NewPet; export type AddPetCommandBody = NewPet; +export type AddPetCommandInput = NewPet; export type FindPetByIdCommandParams = { - id: `${number}`; + id: `${number}`; }; export type FindPetByIdCommandInput = FindPetByIdCommandParams; export type DeletePetCommandParams = { - id: `${number}`; + id: `${number}`; }; export type DeletePetCommandInput = DeletePetCommandParams; diff --git a/__tests__/fixtures/petstore/valibot.ts b/__tests__/fixtures/petstore/valibot.ts new file mode 100644 index 0000000..57644f1 --- /dev/null +++ b/__tests__/fixtures/petstore/valibot.ts @@ -0,0 +1,35 @@ +/** + * This file was auto generated by @block65/openapi-codegen + * + * WARN: Do not edit directly. + * + * Generated on 2026-03-06T07:45:20.003Z + * + */ +import * as v from "valibot"; + +export const errorSchema = v.strictObject({ + code: v.pipe(v.number(), v.integer()), + message: v.string(), +}); +export const newPetSchema = v.strictObject({ + name: v.string(), + tag: v.exactOptional(v.string()), +}); +export const petSchema = v.intersect([ + newPetSchema, + v.strictObject({ + id: v.pipe(v.number(), v.integer()), + }), +]); +export const findPetsCommandQuerySchema = v.strictObject({ + tags: v.exactOptional(v.array(v.string())), + limit: v.exactOptional(v.pipe(v.number(), v.integer())), +}); +export const addPetCommandBodySchema = newPetSchema; +export const findPetByIdCommandParamsSchema = v.strictObject({ + id: v.pipe(v.number(), v.integer()), +}); +export const deletePetCommandParamsSchema = v.strictObject({ + id: v.pipe(v.number(), v.integer()), +}); diff --git a/__tests__/fixtures/test1.json b/__tests__/fixtures/test1.json index 8902c89..3eb96d0 100644 --- a/__tests__/fixtures/test1.json +++ b/__tests__/fixtures/test1.json @@ -1,1324 +1,1324 @@ { - "openapi": "3.0.3", - "info": { - "title": "Billing Service REST API", - "version": "1.0.0" - }, - "components": { - "schemas": { - "Uuid": { - "type": "string", - "format": "uuid" - }, - "Id": { - "type": "string", - "minLength": 1, - "maxLength": 16, - "pattern": "^[a-zA-Z0-9]+$" - }, - "Origin": { - "type": "string", - "format": "uri", - "pattern": "^https://.*$", - "minLength": 1, - "maxLength": 263 - }, - "Url": { - "type": "string", - "format": "uri", - "pattern": "^https://.*", - "minLength": 1, - "maxLength": 2048 - }, - "Name": { - "description": "Reasonable string to be used as a name of a person, or an object", - "type": "string", - "minLength": 2, - "maxLength": 512 - }, - "DateTime": { - "type": "string", - "format": "date-time" - }, - "Email": { - "description": "Valid email address with fully qualified public top-level domain", - "type": "string", - "minLength": 6, - "maxLength": 512, - "format": "email" - }, - "StringU8": { - "type": "string", - "minLength": 1, - "maxLength": 256 - }, - "PromoCode": { - "type": "string", - "minLength": 1, - "maxLength": 256, - "pattern": "/^[A-Z0-9]$/" - }, - "LongRunningOperationIndeterminate": { - "type": "object", - "additionalProperties": false, - "required": ["done", "operationId"], - "properties": { - "operationId": { - "$ref": "#/components/schemas/Uuid" - }, - "done": { - "type": "boolean" - } - } - }, - "LongRunningOperationFail": { - "type": "object", - "required": ["done", "operationId", "result"], - "properties": { - "operationId": { - "$ref": "#/components/schemas/Uuid" - }, - "done": { - "type": "boolean", - "enum": [true] - }, - "result": { - "type": "object", - "additionalProperties": false, - "required": ["error"], - "properties": { - "error": { - "type": "number" - } - } - } - } - }, - "LongRunningOperationSuccess": { - "type": "object", - "required": ["done", "result", "operationId"], - "additionalProperties": false, - "properties": { - "operationId": { - "$ref": "#/components/schemas/Uuid" - }, - "done": { - "type": "boolean", - "enum": [true] - }, - "result": { - "type": "object", - "required": ["response"], - "additionalProperties": false, - "properties": { - "response": { - "type": "object" - } - } - } - } - }, - "LongRunningOperation": { - "oneOf": [ - { - "$ref": "#/components/schemas/LongRunningOperationIndeterminate" - }, - { - "$ref": "#/components/schemas/LongRunningOperationFail" - }, - { - "$ref": "#/components/schemas/LongRunningOperationSuccess" - } - ] - }, - "BillingAccountStatus": { - "type": "string", - "enum": ["nominal", "delinquent"] - }, - "BillingAccountType": { - "type": "string", - "enum": ["standard", "agency", "reseller"] - }, - "BillingLocale": { - "type": "string", - "enum": ["en"] - }, - "BillingCountry": { - "type": "string", - "enum": ["us", "au", "sg", "my", "gb"] - }, - "Currency": { - "type": "string", - "enum": ["usd", "aud", "sgd", "myr", "gbp"] - }, - "TimeZone": { - "type": "string", - "pattern": "^\\w{1,32}/\\w{1,32}$" - }, - "BillingAccountIdentifiers": { - "type": "object", - "required": ["billingAccountId"], - "additionalProperties": false, - "properties": { - "billingAccountId": { - "$ref": "#/components/schemas/Id" - } - } - }, - "BillingAccount": { - "allOf": [ - { - "$ref": "#/components/schemas/BillingAccountIdentifiers" - }, - { - "type": "object", - "required": [ - "name", - "email", - "country", - "status", - "currency", - "type", - "createdTime" - ], - "additionalProperties": false, - "properties": { - "name": { - "$ref": "#/components/schemas/Name" - }, - "email": { - "$ref": "#/components/schemas/Email" - }, - "country": { - "$ref": "#/components/schemas/BillingCountry" - }, - "status": { - "$ref": "#/components/schemas/BillingAccountStatus" - }, - "currency": { - "$ref": "#/components/schemas/Currency" - }, - "type": { - "$ref": "#/components/schemas/BillingAccountType" - }, - "createdTime": { - "$ref": "#/components/schemas/DateTime" - }, - "updatedTime": { - "$ref": "#/components/schemas/DateTime" - }, - "locale": { - "$ref": "#/components/schemas/BillingLocale" - }, - "purchaseOrder": { - "$ref": "#/components/schemas/StringU8" - }, - "taxId": { - "$ref": "#/components/schemas/StringU8" - }, - "timeZone": { - "$ref": "#/components/schemas/TimeZone" - }, - "defaultPaymentMethodId": { - "$ref": "#/components/schemas/Id" - } - } - } - ] - }, - "BillingAccountCreateRequest": { - "type": "object", - "additionalProperties": false, - "required": ["name", "email", "country", "timeZone", "currency"], - "properties": { - "name": { - "$ref": "#/components/schemas/Name" - }, - "email": { - "$ref": "#/components/schemas/Email" - }, - "country": { - "$ref": "#/components/schemas/BillingCountry" - }, - "timeZone": { - "$ref": "#/components/schemas/TimeZone" - }, - "currency": { - "$ref": "#/components/schemas/Currency" - }, - "locale": { - "oneOf": [ - { - "$ref": "#/components/schemas/BillingLocale" - }, - { - "type": "object", - "additionalProperties": false, - "nullable": true, - "enum": [null] - } - ] - }, - "purchaseOrder": { - "oneOf": [ - { - "$ref": "#/components/schemas/StringU8" - }, - { - "type": "object", - "additionalProperties": false, - "nullable": true, - "enum": [null] - } - ] - }, - "taxId": { - "oneOf": [ - { - "$ref": "#/components/schemas/StringU8" - }, - { - "type": "object", - "additionalProperties": false, - "nullable": true, - "enum": [null] - } - ] - } - } - }, - "BillingAccountUpdateRequest": { - "type": "object", - "additionalProperties": false, - "minProperties": 1, - "properties": { - "name": { - "$ref": "#/components/schemas/Name" - }, - "email": { - "$ref": "#/components/schemas/Email" - }, - "country": { - "$ref": "#/components/schemas/BillingCountry" - }, - "timeZone": { - "$ref": "#/components/schemas/TimeZone" - }, - "currency": { - "$ref": "#/components/schemas/Currency" - }, - "locale": { - "oneOf": [ - { - "$ref": "#/components/schemas/BillingLocale" - }, - { - "type": "object", - "additionalProperties": false, - "nullable": true, - "enum": [null] - } - ] - }, - "purchaseOrder": { - "oneOf": [ - { - "$ref": "#/components/schemas/StringU8" - }, - { - "type": "object", - "additionalProperties": false, - "nullable": true, - "enum": [null] - } - ] - }, - "taxId": { - "oneOf": [ - { - "$ref": "#/components/schemas/StringU8" - }, - { - "type": "object", - "additionalProperties": false, - "nullable": true, - "enum": [null] - } - ] - } - } - }, - "BillingAccountList": { - "type": "array", - "items": { - "$ref": "#/components/schemas/BillingAccount" - } - }, - "BillingAccountPortalRequest": { - "type": "object", - "required": ["origin", "accountId"], - "additionalProperties": false, - "properties": { - "origin": { - "$ref": "#/components/schemas/Origin" - }, - "accountId": { - "$ref": "#/components/schemas/Id" - } - } - }, - "BillingAccountPortal": { - "type": "object", - "required": ["url"], - "additionalProperties": false, - "properties": { - "url": { - "$ref": "#/components/schemas/Url" - } - } - }, - "LinkBillingAccountRequest": { - "type": "object", - "required": ["accountId"], - "additionalProperties": false, - "properties": { - "accountId": { - "$ref": "#/components/schemas/Id" - } - } - }, - "PaymentMethodIdentifiers": { - "type": "object", - "required": ["billingAccountId", "paymentMethodId"], - "additionalProperties": false, - "properties": { - "billingAccountId": { - "$ref": "#/components/schemas/Id" - }, - "paymentMethodId": { - "$ref": "#/components/schemas/Id" - } - } - }, - "StripeId": { - "type": "string", - "minLength": 11, - "maxLength": 255, - "pattern": "^(pm|cus|sub)_\\w{8,}$" - }, - "PaymentMethodBrand": { - "type": "string", - "enum": [ - "amex", - "diners", - "discover", - "jcb", - "mastercard", - "unionpay", - "visa", - "unknown" - ] - }, - "PaymentMethod": { - "allOf": [ - { - "$ref": "#/components/schemas/PaymentMethodIdentifiers" - }, - { - "required": ["expireTime", "label", "humanId"], - "type": "object", - "additionalProperties": false, - "properties": { - "label": { - "$ref": "#/components/schemas/Name" - }, - "expireTime": { - "$ref": "#/components/schemas/DateTime" - }, - "humanId": { - "$ref": "#/components/schemas/StringU8" - }, - "brand": { - "$ref": "#/components/schemas/PaymentMethodBrand" - } - } - } - ] - }, - "UpdatePaymentMethodRequest": { - "type": "object", - "additionalProperties": false, - "minProperties": 1, - "properties": { - "label": { - "$ref": "#/components/schemas/Name" - }, - "isDefault": { - "type": "boolean" - } - } - }, - "PaymentMethodLongRunningOperationSuccess": { - "type": "object", - "required": ["done", "result", "operationId"], - "additionalProperties": false, - "properties": { - "operationId": { - "$ref": "#/components/schemas/Uuid" - }, - "done": { - "type": "boolean", - "enum": [true] - }, - "result": { - "type": "object", - "required": ["response"], - "additionalProperties": false, - "properties": { - "response": { - "type": "object", - "additionalProperties": false, - "required": ["clientSecret"], - "properties": { - "clientSecret": { - "type": "string" - } - } - } - } - } - } - }, - "PaymentMethodDeletedLongRunningOperationSuccess": { - "type": "object", - "required": ["done", "result", "operationId"], - "additionalProperties": false, - "properties": { - "operationId": { - "$ref": "#/components/schemas/Uuid" - }, - "done": { - "type": "boolean", - "enum": [true] - }, - "result": { - "type": "object", - "required": ["response"], - "additionalProperties": false, - "properties": { - "response": { - "type": "object", - "additionalProperties": false, - "required": ["ok"], - "properties": { - "ok": { - "type": "boolean" - } - } - } - } - } - } - }, - "PaymentMethodIntendedLro": { - "anyOf": [ - { - "$ref": "#/components/schemas/LongRunningOperationIndeterminate" - }, - { - "$ref": "#/components/schemas/PaymentMethodLongRunningOperationSuccess" - }, - { - "$ref": "#/components/schemas/LongRunningOperationFail" - } - ] - }, - "PaymentMethodDeletedLro": { - "anyOf": [ - { - "$ref": "#/components/schemas/LongRunningOperationIndeterminate" - }, - { - "$ref": "#/components/schemas/PaymentMethodDeletedLongRunningOperationSuccess" - }, - { - "$ref": "#/components/schemas/LongRunningOperationFail" - } - ] - }, - "PaymentMethods": { - "type": "array", - "uniqueItems": true, - "items": { - "$ref": "#/components/schemas/PaymentMethod" - } - }, - "PlanSku": { - "type": "string", - "enum": ["donotuse", "plasku1", "plasku2", "plasku3", "plasku4"] - }, - "BillingSubscriptionStatus": { - "type": "string", - "enum": ["active", "inactive"] - }, - "BillingSubscriptionInterval": { - "type": "string", - "enum": ["monthly", "yearly"] - }, - "BillingSubscriptionIdentifiers": { - "type": "object", - "required": ["billingAccountId", "subscriptionId"], - "additionalProperties": false, - "properties": { - "billingAccountId": { - "$ref": "#/components/schemas/Id" - }, - "subscriptionId": { - "$ref": "#/components/schemas/Id" - } - } - }, - "BillingSubscription": { - "allOf": [ - { - "$ref": "#/components/schemas/BillingSubscriptionIdentifiers" - }, - { - "type": "object", - "additionalProperties": false, - "required": [ - "planSku", - "interval", - "status", - "cycleTime", - "createdTime" - ], - "properties": { - "accountId": { - "$ref": "#/components/schemas/Id" - }, - "planSku": { - "$ref": "#/components/schemas/PlanSku" - }, - "interval": { - "$ref": "#/components/schemas/BillingSubscriptionInterval" - }, - "status": { - "$ref": "#/components/schemas/BillingSubscriptionStatus" - }, - "cycleTime": { - "$ref": "#/components/schemas/DateTime" - }, - "trialEndTime": { - "$ref": "#/components/schemas/DateTime" - }, - "createdTime": { - "$ref": "#/components/schemas/DateTime" - }, - "updatedTime": { - "$ref": "#/components/schemas/DateTime" - } - } - } - ] - }, - "CreateBillingSubscriptionRequest": { - "type": "object", - "additionalProperties": false, - "required": ["accountId", "planSku", "interval"], - "properties": { - "accountId": { - "$ref": "#/components/schemas/Id" - }, - "planSku": { - "$ref": "#/components/schemas/PlanSku" - }, - "interval": { - "$ref": "#/components/schemas/BillingSubscriptionInterval" - }, - "promoCode": { - "$ref": "#/components/schemas/StringU8" - } - } - }, - "UpdateBillingSubscriptionRequest": { - "type": "object", - "additionalProperties": false, - "minProperties": 1, - "properties": { - "label": { - "$ref": "#/components/schemas/Name" - }, - "trialEndTime": { - "$ref": "#/components/schemas/DateTime" - } - } - }, - "UpdateBillingSubscriptionPromoCodeRequest": { - "type": "object", - "additionalProperties": false, - "minProperties": 1, - "required": ["promoCode"], - "properties": { - "promoCode": { - "oneOf": [ - { - "$ref": "#/components/schemas/StringU8" - }, - { - "type": "object", - "additionalProperties": false, - "nullable": true, - "enum": [null] - } - ] - } - } - }, - "BillingSubscriptionPromoCodeLongRunningOperationSuccess": { - "type": "object", - "required": ["done", "result", "operationId"], - "additionalProperties": false, - "properties": { - "operationId": { - "$ref": "#/components/schemas/Uuid" - }, - "done": { - "type": "boolean", - "enum": [true] - }, - "result": { - "type": "object", - "required": ["response"], - "additionalProperties": false, - "properties": { - "response": { - "type": "object", - "additionalProperties": false, - "required": ["promoCode"], - "properties": { - "promoCode": { - "$ref": "#/components/schemas/StringU8" - } - } - } - } - } - } - }, - "BillingSubscriptionLro": { - "anyOf": [ - { - "$ref": "#/components/schemas/LongRunningOperationIndeterminate" - }, - { - "$ref": "#/components/schemas/BillingSubscriptionPromoCodeLongRunningOperationSuccess" - }, - { - "$ref": "#/components/schemas/LongRunningOperationFail" - } - ] - }, - "BillingSubscriptions": { - "type": "array", - "uniqueItems": true, - "items": { - "$ref": "#/components/schemas/BillingSubscription" - } - } - }, - "parameters": { - "OperationIdParam": { - "name": "operationId", - "in": "path", - "required": true, - "schema": { - "$ref": "#/components/schemas/Uuid" - } - }, - "BillingAccountIdParameter": { - "name": "billingAccountId", - "in": "path", - "required": true, - "schema": { - "$ref": "#/components/schemas/Id" - } - }, - "SubscriptionIdParameter": { - "name": "subscriptionId", - "in": "path", - "required": true, - "schema": { - "$ref": "#/components/schemas/Id" - } - }, - "PaymentMethodIdParameter": { - "name": "paymentMethodId", - "in": "path", - "required": true, - "schema": { - "$ref": "#/components/schemas/Id" - } - }, - "StripePaymentMethodIdParameter": { - "name": "stripePaymentMethodId", - "in": "path", - "required": true, - "schema": { - "$ref": "#/components/schemas/StripeId" - } - } - }, - "securitySchemes": { - "HttpBearerJwtScheme": { - "type": "http", - "scheme": "bearer", - "bearerFormat": "JWT" - } - } - }, - "paths": { - "/operations/{operationId}": { - "get": { - "operationId": "getOperationCommand", - "security": [ - { - "HttpBearerJwtScheme": ["billing.read"] - } - ], - "tags": [], - "responses": { - "200": { - "description": "Operation 200 response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/LongRunningOperation" - } - } - } - } - } - }, - "parameters": [ - { - "$ref": "#/components/parameters/OperationIdParam" - } - ] - }, - "/billing-accounts": { - "get": { - "operationId": "listBillingAccountsCommand", - "security": [ - { - "HttpBearerJwtScheme": ["billing.read"] - } - ], - "tags": [], - "responses": { - "200": { - "description": "List Billing Accounts 200 response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/BillingAccountList" - } - } - } - } - } - }, - "post": { - "operationId": "createBillingAccountCommand", - "security": [ - { - "HttpBearerJwtScheme": ["billing.write"] - } - ], - "tags": [], - "requestBody": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/BillingAccountCreateRequest" - } - } - } - }, - "responses": { - "200": { - "description": "Billing Account 200 response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/BillingAccount" - } - } - } - } - } - } - }, - "/billing-accounts/{billingAccountId}": { - "get": { - "operationId": "getBillingAccountCommand", - "security": [ - { - "HttpBearerJwtScheme": ["billing.read"] - } - ], - "tags": [], - "responses": { - "200": { - "description": "Billing Account 200 response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/BillingAccount" - } - } - } - } - } - }, - "put": { - "operationId": "updateBillingAccountCommand", - "security": [ - { - "HttpBearerJwtScheme": ["billing.write"] - } - ], - "tags": [], - "requestBody": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/BillingAccountUpdateRequest" - } - } - } - }, - "responses": { - "200": { - "description": "Billing Account 200 response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/BillingAccount" - } - } - } - } - } - }, - "parameters": [ - { - "$ref": "#/components/parameters/BillingAccountIdParameter" - } - ] - }, - "/billing-accounts/{billingAccountId}/portal": { - "post": { - "operationId": "getBillingAccountPortalCommand", - "security": [ - { - "HttpBearerJwtScheme": ["billing.read"] - } - ], - "tags": [], - "requestBody": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/BillingAccountPortalRequest" - } - } - } - }, - "responses": { - "200": { - "description": "Billing Account Portal 200 response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/BillingAccountPortal" - } - } - } - } - } - }, - "parameters": [ - { - "$ref": "#/components/parameters/BillingAccountIdParameter" - } - ] - }, - "/billing-accounts/{billingAccountId}/link": { - "post": { - "operationId": "linkBillingAccountCommand", - "security": [ - { - "HttpBearerJwtScheme": ["billing.write"] - } - ], - "tags": [], - "requestBody": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/LinkBillingAccountRequest" - } - } - } - }, - "responses": {} - }, - "parameters": [ - { - "$ref": "#/components/parameters/BillingAccountIdParameter" - } - ] - }, - "/billing-accounts/{billingAccountId}/payment-methods": { - "get": { - "operationId": "listPaymentMethodsCommand", - "security": [ - { - "HttpBearerJwtScheme": ["billing.read"] - } - ], - "tags": [], - "responses": { - "200": { - "description": "Payment Method 200 response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PaymentMethods" - } - } - } - } - } - }, - "post": { - "operationId": "createPaymentMethodCommand", - "security": [ - { - "HttpBearerJwtScheme": ["billing.write"] - } - ], - "tags": [], - "responses": { - "200": { - "description": "Payment Method 200 response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PaymentMethodIntendedLro" - } - } - } - } - } - }, - "parameters": [ - { - "$ref": "#/components/parameters/BillingAccountIdParameter" - } - ] - }, - "/billing-accounts/{billingAccountId}/payment-methods/stripe/{stripePaymentMethodId}": { - "get": { - "operationId": "getPaymentMethodFromStripeCommand", - "security": [ - { - "HttpBearerJwtScheme": ["billing.read"] - } - ], - "tags": [], - "responses": { - "200": { - "description": "Payment Method 200 response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PaymentMethod" - } - } - } - } - } - }, - "parameters": [ - { - "$ref": "#/components/parameters/BillingAccountIdParameter" - }, - { - "$ref": "#/components/parameters/StripePaymentMethodIdParameter" - } - ] - }, - "/billing-accounts/{billingAccountId}/payment-methods/{paymentMethodId}": { - "get": { - "operationId": "getPaymentMethodCommand", - "security": [ - { - "HttpBearerJwtScheme": ["billing.read"] - } - ], - "tags": [], - "responses": { - "200": { - "description": "Payment Method 200 response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PaymentMethod" - } - } - } - } - } - }, - "put": { - "operationId": "updatePaymentMethodCommand", - "security": [ - { - "HttpBearerJwtScheme": ["billing.write"] - } - ], - "tags": [], - "requestBody": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UpdatePaymentMethodRequest" - } - } - } - }, - "responses": { - "204": { - "description": "Payment Method 200 response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PaymentMethod" - } - } - } - } - } - }, - "delete": { - "operationId": "deletePaymentMethodCommand", - "security": [ - { - "HttpBearerJwtScheme": ["billing.write"] - } - ], - "tags": [], - "responses": { - "200": { - "description": "Long Running Operation 200 response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PaymentMethodDeletedLro" - } - } - } - } - } - }, - "parameters": [ - { - "$ref": "#/components/parameters/BillingAccountIdParameter" - }, - { - "$ref": "#/components/parameters/PaymentMethodIdParameter" - } - ] - }, - "/billing-accounts/{billingAccountId}/subscriptions": { - "get": { - "operationId": "listBillingSubscriptionsCommand", - "security": [ - { - "HttpBearerJwtScheme": ["billing.read"] - } - ], - "tags": [], - "responses": { - "200": { - "description": "Payment Method 200 response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/BillingSubscriptions" - } - } - } - } - } - }, - "post": { - "operationId": "createBillingSubscriptionCommand", - "security": [ - { - "HttpBearerJwtScheme": ["billing.write"] - } - ], - "tags": [], - "requestBody": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateBillingSubscriptionRequest" - } - } - } - }, - "responses": { - "200": { - "description": "Subscription 200 response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/BillingSubscriptionLro" - } - } - } - } - } - }, - "parameters": [ - { - "$ref": "#/components/parameters/BillingAccountIdParameter" - } - ] - }, - "/billing-accounts/{billingAccountId}/subscriptions/{subscriptionId}": { - "put": { - "operationId": "updateBillingSubscriptionCommand", - "security": [ - { - "HttpBearerJwtScheme": ["billing.write"] - } - ], - "tags": [], - "requestBody": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UpdateBillingSubscriptionRequest" - } - } - } - }, - "responses": { - "204": { - "description": "Subscription 200 response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UpdateBillingSubscriptionRequest" - } - } - } - } - } - }, - "delete": { - "operationId": "cancelSubscriptionCommand", - "security": [ - { - "HttpBearerJwtScheme": ["billing.write"] - } - ], - "tags": [], - "responses": { - "204": { - "description": "Subscription 204 response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/BillingSubscription" - } - } - } - } - } - }, - "parameters": [ - { - "$ref": "#/components/parameters/BillingAccountIdParameter" - }, - { - "$ref": "#/components/parameters/SubscriptionIdParameter" - } - ] - }, - "/billing-accounts/{billingAccountId}/subscriptions/{subscriptionId}/promo-code": { - "put": { - "operationId": "updateBillingSubscriptionPromoCodeCommand", - "security": [ - { - "HttpBearerJwtScheme": ["billing.write"] - } - ], - "tags": [], - "requestBody": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UpdateBillingSubscriptionPromoCodeRequest" - } - } - } - }, - "responses": { - "200": { - "description": "Subscription 200 response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/BillingSubscriptionLro" - } - } - } - } - } - }, - "parameters": [ - { - "$ref": "#/components/parameters/BillingAccountIdParameter" - }, - { - "$ref": "#/components/parameters/SubscriptionIdParameter" - } - ] - } - }, - "security": [ - { - "HttpBearerJwtScheme": [] - }, - { - "HttpBearerJwtScheme": ["billing.read"] - }, - { - "HttpBearerJwtScheme": ["billing.write"] - } - ] + "openapi": "3.0.3", + "info": { + "title": "Billing Service REST API", + "version": "1.0.0" + }, + "components": { + "schemas": { + "Uuid": { + "type": "string", + "format": "uuid" + }, + "Id": { + "type": "string", + "minLength": 1, + "maxLength": 16, + "pattern": "^[a-zA-Z0-9]+$" + }, + "Origin": { + "type": "string", + "format": "uri", + "pattern": "^https://.*$", + "minLength": 1, + "maxLength": 263 + }, + "Url": { + "type": "string", + "format": "uri", + "pattern": "^https://.*", + "minLength": 1, + "maxLength": 2048 + }, + "Name": { + "description": "Reasonable string to be used as a name of a person, or an object", + "type": "string", + "minLength": 2, + "maxLength": 512 + }, + "DateTime": { + "type": "string", + "format": "date-time" + }, + "Email": { + "description": "Valid email address with fully qualified public top-level domain", + "type": "string", + "minLength": 6, + "maxLength": 512, + "format": "email" + }, + "StringU8": { + "type": "string", + "minLength": 1, + "maxLength": 256 + }, + "PromoCode": { + "type": "string", + "minLength": 1, + "maxLength": 256, + "pattern": "/^[A-Z0-9]$/" + }, + "LongRunningOperationIndeterminate": { + "type": "object", + "additionalProperties": false, + "required": ["done", "operationId"], + "properties": { + "operationId": { + "$ref": "#/components/schemas/Uuid" + }, + "done": { + "type": "boolean" + } + } + }, + "LongRunningOperationFail": { + "type": "object", + "required": ["done", "operationId", "result"], + "properties": { + "operationId": { + "$ref": "#/components/schemas/Uuid" + }, + "done": { + "type": "boolean", + "enum": [true] + }, + "result": { + "type": "object", + "additionalProperties": false, + "required": ["error"], + "properties": { + "error": { + "type": "number" + } + } + } + } + }, + "LongRunningOperationSuccess": { + "type": "object", + "required": ["done", "result", "operationId"], + "additionalProperties": false, + "properties": { + "operationId": { + "$ref": "#/components/schemas/Uuid" + }, + "done": { + "type": "boolean", + "enum": [true] + }, + "result": { + "type": "object", + "required": ["response"], + "additionalProperties": false, + "properties": { + "response": { + "type": "object" + } + } + } + } + }, + "LongRunningOperation": { + "oneOf": [ + { + "$ref": "#/components/schemas/LongRunningOperationIndeterminate" + }, + { + "$ref": "#/components/schemas/LongRunningOperationFail" + }, + { + "$ref": "#/components/schemas/LongRunningOperationSuccess" + } + ] + }, + "BillingAccountStatus": { + "type": "string", + "enum": ["nominal", "delinquent"] + }, + "BillingAccountType": { + "type": "string", + "enum": ["standard", "agency", "reseller"] + }, + "BillingLocale": { + "type": "string", + "enum": ["en"] + }, + "BillingCountry": { + "type": "string", + "enum": ["us", "au", "sg", "my", "gb"] + }, + "Currency": { + "type": "string", + "enum": ["usd", "aud", "sgd", "myr", "gbp"] + }, + "TimeZone": { + "type": "string", + "pattern": "^\\w{1,32}/\\w{1,32}$" + }, + "BillingAccountIdentifiers": { + "type": "object", + "required": ["billingAccountId"], + "additionalProperties": false, + "properties": { + "billingAccountId": { + "$ref": "#/components/schemas/Id" + } + } + }, + "BillingAccount": { + "allOf": [ + { + "$ref": "#/components/schemas/BillingAccountIdentifiers" + }, + { + "type": "object", + "required": [ + "name", + "email", + "country", + "status", + "currency", + "type", + "createdTime" + ], + "additionalProperties": false, + "properties": { + "name": { + "$ref": "#/components/schemas/Name" + }, + "email": { + "$ref": "#/components/schemas/Email" + }, + "country": { + "$ref": "#/components/schemas/BillingCountry" + }, + "status": { + "$ref": "#/components/schemas/BillingAccountStatus" + }, + "currency": { + "$ref": "#/components/schemas/Currency" + }, + "type": { + "$ref": "#/components/schemas/BillingAccountType" + }, + "createdTime": { + "$ref": "#/components/schemas/DateTime" + }, + "updatedTime": { + "$ref": "#/components/schemas/DateTime" + }, + "locale": { + "$ref": "#/components/schemas/BillingLocale" + }, + "purchaseOrder": { + "$ref": "#/components/schemas/StringU8" + }, + "taxId": { + "$ref": "#/components/schemas/StringU8" + }, + "timeZone": { + "$ref": "#/components/schemas/TimeZone" + }, + "defaultPaymentMethodId": { + "$ref": "#/components/schemas/Id" + } + } + } + ] + }, + "BillingAccountCreateRequest": { + "type": "object", + "additionalProperties": false, + "required": ["name", "email", "country", "timeZone", "currency"], + "properties": { + "name": { + "$ref": "#/components/schemas/Name" + }, + "email": { + "$ref": "#/components/schemas/Email" + }, + "country": { + "$ref": "#/components/schemas/BillingCountry" + }, + "timeZone": { + "$ref": "#/components/schemas/TimeZone" + }, + "currency": { + "$ref": "#/components/schemas/Currency" + }, + "locale": { + "oneOf": [ + { + "$ref": "#/components/schemas/BillingLocale" + }, + { + "type": "object", + "additionalProperties": false, + "nullable": true, + "enum": [null] + } + ] + }, + "purchaseOrder": { + "oneOf": [ + { + "$ref": "#/components/schemas/StringU8" + }, + { + "type": "object", + "additionalProperties": false, + "nullable": true, + "enum": [null] + } + ] + }, + "taxId": { + "oneOf": [ + { + "$ref": "#/components/schemas/StringU8" + }, + { + "type": "object", + "additionalProperties": false, + "nullable": true, + "enum": [null] + } + ] + } + } + }, + "BillingAccountUpdateRequest": { + "type": "object", + "additionalProperties": false, + "minProperties": 1, + "properties": { + "name": { + "$ref": "#/components/schemas/Name" + }, + "email": { + "$ref": "#/components/schemas/Email" + }, + "country": { + "$ref": "#/components/schemas/BillingCountry" + }, + "timeZone": { + "$ref": "#/components/schemas/TimeZone" + }, + "currency": { + "$ref": "#/components/schemas/Currency" + }, + "locale": { + "oneOf": [ + { + "$ref": "#/components/schemas/BillingLocale" + }, + { + "type": "object", + "additionalProperties": false, + "nullable": true, + "enum": [null] + } + ] + }, + "purchaseOrder": { + "oneOf": [ + { + "$ref": "#/components/schemas/StringU8" + }, + { + "type": "object", + "additionalProperties": false, + "nullable": true, + "enum": [null] + } + ] + }, + "taxId": { + "oneOf": [ + { + "$ref": "#/components/schemas/StringU8" + }, + { + "type": "object", + "additionalProperties": false, + "nullable": true, + "enum": [null] + } + ] + } + } + }, + "BillingAccountList": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BillingAccount" + } + }, + "BillingAccountPortalRequest": { + "type": "object", + "required": ["origin", "accountId"], + "additionalProperties": false, + "properties": { + "origin": { + "$ref": "#/components/schemas/Origin" + }, + "accountId": { + "$ref": "#/components/schemas/Id" + } + } + }, + "BillingAccountPortal": { + "type": "object", + "required": ["url"], + "additionalProperties": false, + "properties": { + "url": { + "$ref": "#/components/schemas/Url" + } + } + }, + "LinkBillingAccountRequest": { + "type": "object", + "required": ["accountId"], + "additionalProperties": false, + "properties": { + "accountId": { + "$ref": "#/components/schemas/Id" + } + } + }, + "PaymentMethodIdentifiers": { + "type": "object", + "required": ["billingAccountId", "paymentMethodId"], + "additionalProperties": false, + "properties": { + "billingAccountId": { + "$ref": "#/components/schemas/Id" + }, + "paymentMethodId": { + "$ref": "#/components/schemas/Id" + } + } + }, + "StripeId": { + "type": "string", + "minLength": 11, + "maxLength": 255, + "pattern": "^(pm|cus|sub)_\\w{8,}$" + }, + "PaymentMethodBrand": { + "type": "string", + "enum": [ + "amex", + "diners", + "discover", + "jcb", + "mastercard", + "unionpay", + "visa", + "unknown" + ] + }, + "PaymentMethod": { + "allOf": [ + { + "$ref": "#/components/schemas/PaymentMethodIdentifiers" + }, + { + "required": ["expireTime", "label", "humanId"], + "type": "object", + "additionalProperties": false, + "properties": { + "label": { + "$ref": "#/components/schemas/Name" + }, + "expireTime": { + "$ref": "#/components/schemas/DateTime" + }, + "humanId": { + "$ref": "#/components/schemas/StringU8" + }, + "brand": { + "$ref": "#/components/schemas/PaymentMethodBrand" + } + } + } + ] + }, + "UpdatePaymentMethodRequest": { + "type": "object", + "additionalProperties": false, + "minProperties": 1, + "properties": { + "label": { + "$ref": "#/components/schemas/Name" + }, + "isDefault": { + "type": "boolean" + } + } + }, + "PaymentMethodLongRunningOperationSuccess": { + "type": "object", + "required": ["done", "result", "operationId"], + "additionalProperties": false, + "properties": { + "operationId": { + "$ref": "#/components/schemas/Uuid" + }, + "done": { + "type": "boolean", + "enum": [true] + }, + "result": { + "type": "object", + "required": ["response"], + "additionalProperties": false, + "properties": { + "response": { + "type": "object", + "additionalProperties": false, + "required": ["clientSecret"], + "properties": { + "clientSecret": { + "type": "string" + } + } + } + } + } + } + }, + "PaymentMethodDeletedLongRunningOperationSuccess": { + "type": "object", + "required": ["done", "result", "operationId"], + "additionalProperties": false, + "properties": { + "operationId": { + "$ref": "#/components/schemas/Uuid" + }, + "done": { + "type": "boolean", + "enum": [true] + }, + "result": { + "type": "object", + "required": ["response"], + "additionalProperties": false, + "properties": { + "response": { + "type": "object", + "additionalProperties": false, + "required": ["ok"], + "properties": { + "ok": { + "type": "boolean" + } + } + } + } + } + } + }, + "PaymentMethodIntendedLro": { + "anyOf": [ + { + "$ref": "#/components/schemas/LongRunningOperationIndeterminate" + }, + { + "$ref": "#/components/schemas/PaymentMethodLongRunningOperationSuccess" + }, + { + "$ref": "#/components/schemas/LongRunningOperationFail" + } + ] + }, + "PaymentMethodDeletedLro": { + "anyOf": [ + { + "$ref": "#/components/schemas/LongRunningOperationIndeterminate" + }, + { + "$ref": "#/components/schemas/PaymentMethodDeletedLongRunningOperationSuccess" + }, + { + "$ref": "#/components/schemas/LongRunningOperationFail" + } + ] + }, + "PaymentMethods": { + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/components/schemas/PaymentMethod" + } + }, + "PlanSku": { + "type": "string", + "enum": ["donotuse", "plasku1", "plasku2", "plasku3", "plasku4"] + }, + "BillingSubscriptionStatus": { + "type": "string", + "enum": ["active", "inactive"] + }, + "BillingSubscriptionInterval": { + "type": "string", + "enum": ["monthly", "yearly"] + }, + "BillingSubscriptionIdentifiers": { + "type": "object", + "required": ["billingAccountId", "subscriptionId"], + "additionalProperties": false, + "properties": { + "billingAccountId": { + "$ref": "#/components/schemas/Id" + }, + "subscriptionId": { + "$ref": "#/components/schemas/Id" + } + } + }, + "BillingSubscription": { + "allOf": [ + { + "$ref": "#/components/schemas/BillingSubscriptionIdentifiers" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "planSku", + "interval", + "status", + "cycleTime", + "createdTime" + ], + "properties": { + "accountId": { + "$ref": "#/components/schemas/Id" + }, + "planSku": { + "$ref": "#/components/schemas/PlanSku" + }, + "interval": { + "$ref": "#/components/schemas/BillingSubscriptionInterval" + }, + "status": { + "$ref": "#/components/schemas/BillingSubscriptionStatus" + }, + "cycleTime": { + "$ref": "#/components/schemas/DateTime" + }, + "trialEndTime": { + "$ref": "#/components/schemas/DateTime" + }, + "createdTime": { + "$ref": "#/components/schemas/DateTime" + }, + "updatedTime": { + "$ref": "#/components/schemas/DateTime" + } + } + } + ] + }, + "CreateBillingSubscriptionRequest": { + "type": "object", + "additionalProperties": false, + "required": ["accountId", "planSku", "interval"], + "properties": { + "accountId": { + "$ref": "#/components/schemas/Id" + }, + "planSku": { + "$ref": "#/components/schemas/PlanSku" + }, + "interval": { + "$ref": "#/components/schemas/BillingSubscriptionInterval" + }, + "promoCode": { + "$ref": "#/components/schemas/StringU8" + } + } + }, + "UpdateBillingSubscriptionRequest": { + "type": "object", + "additionalProperties": false, + "minProperties": 1, + "properties": { + "label": { + "$ref": "#/components/schemas/Name" + }, + "trialEndTime": { + "$ref": "#/components/schemas/DateTime" + } + } + }, + "UpdateBillingSubscriptionPromoCodeRequest": { + "type": "object", + "additionalProperties": false, + "minProperties": 1, + "required": ["promoCode"], + "properties": { + "promoCode": { + "oneOf": [ + { + "$ref": "#/components/schemas/StringU8" + }, + { + "type": "object", + "additionalProperties": false, + "nullable": true, + "enum": [null] + } + ] + } + } + }, + "BillingSubscriptionPromoCodeLongRunningOperationSuccess": { + "type": "object", + "required": ["done", "result", "operationId"], + "additionalProperties": false, + "properties": { + "operationId": { + "$ref": "#/components/schemas/Uuid" + }, + "done": { + "type": "boolean", + "enum": [true] + }, + "result": { + "type": "object", + "required": ["response"], + "additionalProperties": false, + "properties": { + "response": { + "type": "object", + "additionalProperties": false, + "required": ["promoCode"], + "properties": { + "promoCode": { + "$ref": "#/components/schemas/StringU8" + } + } + } + } + } + } + }, + "BillingSubscriptionLro": { + "anyOf": [ + { + "$ref": "#/components/schemas/LongRunningOperationIndeterminate" + }, + { + "$ref": "#/components/schemas/BillingSubscriptionPromoCodeLongRunningOperationSuccess" + }, + { + "$ref": "#/components/schemas/LongRunningOperationFail" + } + ] + }, + "BillingSubscriptions": { + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/components/schemas/BillingSubscription" + } + } + }, + "parameters": { + "OperationIdParam": { + "name": "operationId", + "in": "path", + "required": true, + "schema": { + "$ref": "#/components/schemas/Uuid" + } + }, + "BillingAccountIdParameter": { + "name": "billingAccountId", + "in": "path", + "required": true, + "schema": { + "$ref": "#/components/schemas/Id" + } + }, + "SubscriptionIdParameter": { + "name": "subscriptionId", + "in": "path", + "required": true, + "schema": { + "$ref": "#/components/schemas/Id" + } + }, + "PaymentMethodIdParameter": { + "name": "paymentMethodId", + "in": "path", + "required": true, + "schema": { + "$ref": "#/components/schemas/Id" + } + }, + "StripePaymentMethodIdParameter": { + "name": "stripePaymentMethodId", + "in": "path", + "required": true, + "schema": { + "$ref": "#/components/schemas/StripeId" + } + } + }, + "securitySchemes": { + "HttpBearerJwtScheme": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "JWT" + } + } + }, + "paths": { + "/operations/{operationId}": { + "get": { + "operationId": "getOperationCommand", + "security": [ + { + "HttpBearerJwtScheme": ["billing.read"] + } + ], + "tags": [], + "responses": { + "200": { + "description": "Operation 200 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LongRunningOperation" + } + } + } + } + } + }, + "parameters": [ + { + "$ref": "#/components/parameters/OperationIdParam" + } + ] + }, + "/billing-accounts": { + "get": { + "operationId": "listBillingAccountsCommand", + "security": [ + { + "HttpBearerJwtScheme": ["billing.read"] + } + ], + "tags": [], + "responses": { + "200": { + "description": "List Billing Accounts 200 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BillingAccountList" + } + } + } + } + } + }, + "post": { + "operationId": "createBillingAccountCommand", + "security": [ + { + "HttpBearerJwtScheme": ["billing.write"] + } + ], + "tags": [], + "requestBody": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BillingAccountCreateRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Billing Account 200 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BillingAccount" + } + } + } + } + } + } + }, + "/billing-accounts/{billingAccountId}": { + "get": { + "operationId": "getBillingAccountCommand", + "security": [ + { + "HttpBearerJwtScheme": ["billing.read"] + } + ], + "tags": [], + "responses": { + "200": { + "description": "Billing Account 200 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BillingAccount" + } + } + } + } + } + }, + "put": { + "operationId": "updateBillingAccountCommand", + "security": [ + { + "HttpBearerJwtScheme": ["billing.write"] + } + ], + "tags": [], + "requestBody": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BillingAccountUpdateRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Billing Account 200 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BillingAccount" + } + } + } + } + } + }, + "parameters": [ + { + "$ref": "#/components/parameters/BillingAccountIdParameter" + } + ] + }, + "/billing-accounts/{billingAccountId}/portal": { + "post": { + "operationId": "getBillingAccountPortalCommand", + "security": [ + { + "HttpBearerJwtScheme": ["billing.read"] + } + ], + "tags": [], + "requestBody": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BillingAccountPortalRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Billing Account Portal 200 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BillingAccountPortal" + } + } + } + } + } + }, + "parameters": [ + { + "$ref": "#/components/parameters/BillingAccountIdParameter" + } + ] + }, + "/billing-accounts/{billingAccountId}/link": { + "post": { + "operationId": "linkBillingAccountCommand", + "security": [ + { + "HttpBearerJwtScheme": ["billing.write"] + } + ], + "tags": [], + "requestBody": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LinkBillingAccountRequest" + } + } + } + }, + "responses": {} + }, + "parameters": [ + { + "$ref": "#/components/parameters/BillingAccountIdParameter" + } + ] + }, + "/billing-accounts/{billingAccountId}/payment-methods": { + "get": { + "operationId": "listPaymentMethodsCommand", + "security": [ + { + "HttpBearerJwtScheme": ["billing.read"] + } + ], + "tags": [], + "responses": { + "200": { + "description": "Payment Method 200 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PaymentMethods" + } + } + } + } + } + }, + "post": { + "operationId": "createPaymentMethodCommand", + "security": [ + { + "HttpBearerJwtScheme": ["billing.write"] + } + ], + "tags": [], + "responses": { + "200": { + "description": "Payment Method 200 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PaymentMethodIntendedLro" + } + } + } + } + } + }, + "parameters": [ + { + "$ref": "#/components/parameters/BillingAccountIdParameter" + } + ] + }, + "/billing-accounts/{billingAccountId}/payment-methods/stripe/{stripePaymentMethodId}": { + "get": { + "operationId": "getPaymentMethodFromStripeCommand", + "security": [ + { + "HttpBearerJwtScheme": ["billing.read"] + } + ], + "tags": [], + "responses": { + "200": { + "description": "Payment Method 200 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PaymentMethod" + } + } + } + } + } + }, + "parameters": [ + { + "$ref": "#/components/parameters/BillingAccountIdParameter" + }, + { + "$ref": "#/components/parameters/StripePaymentMethodIdParameter" + } + ] + }, + "/billing-accounts/{billingAccountId}/payment-methods/{paymentMethodId}": { + "get": { + "operationId": "getPaymentMethodCommand", + "security": [ + { + "HttpBearerJwtScheme": ["billing.read"] + } + ], + "tags": [], + "responses": { + "200": { + "description": "Payment Method 200 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PaymentMethod" + } + } + } + } + } + }, + "put": { + "operationId": "updatePaymentMethodCommand", + "security": [ + { + "HttpBearerJwtScheme": ["billing.write"] + } + ], + "tags": [], + "requestBody": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdatePaymentMethodRequest" + } + } + } + }, + "responses": { + "204": { + "description": "Payment Method 200 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PaymentMethod" + } + } + } + } + } + }, + "delete": { + "operationId": "deletePaymentMethodCommand", + "security": [ + { + "HttpBearerJwtScheme": ["billing.write"] + } + ], + "tags": [], + "responses": { + "200": { + "description": "Long Running Operation 200 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PaymentMethodDeletedLro" + } + } + } + } + } + }, + "parameters": [ + { + "$ref": "#/components/parameters/BillingAccountIdParameter" + }, + { + "$ref": "#/components/parameters/PaymentMethodIdParameter" + } + ] + }, + "/billing-accounts/{billingAccountId}/subscriptions": { + "get": { + "operationId": "listBillingSubscriptionsCommand", + "security": [ + { + "HttpBearerJwtScheme": ["billing.read"] + } + ], + "tags": [], + "responses": { + "200": { + "description": "Payment Method 200 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BillingSubscriptions" + } + } + } + } + } + }, + "post": { + "operationId": "createBillingSubscriptionCommand", + "security": [ + { + "HttpBearerJwtScheme": ["billing.write"] + } + ], + "tags": [], + "requestBody": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateBillingSubscriptionRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Subscription 200 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BillingSubscriptionLro" + } + } + } + } + } + }, + "parameters": [ + { + "$ref": "#/components/parameters/BillingAccountIdParameter" + } + ] + }, + "/billing-accounts/{billingAccountId}/subscriptions/{subscriptionId}": { + "put": { + "operationId": "updateBillingSubscriptionCommand", + "security": [ + { + "HttpBearerJwtScheme": ["billing.write"] + } + ], + "tags": [], + "requestBody": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateBillingSubscriptionRequest" + } + } + } + }, + "responses": { + "204": { + "description": "Subscription 200 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateBillingSubscriptionRequest" + } + } + } + } + } + }, + "delete": { + "operationId": "cancelSubscriptionCommand", + "security": [ + { + "HttpBearerJwtScheme": ["billing.write"] + } + ], + "tags": [], + "responses": { + "204": { + "description": "Subscription 204 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BillingSubscription" + } + } + } + } + } + }, + "parameters": [ + { + "$ref": "#/components/parameters/BillingAccountIdParameter" + }, + { + "$ref": "#/components/parameters/SubscriptionIdParameter" + } + ] + }, + "/billing-accounts/{billingAccountId}/subscriptions/{subscriptionId}/promo-code": { + "put": { + "operationId": "updateBillingSubscriptionPromoCodeCommand", + "security": [ + { + "HttpBearerJwtScheme": ["billing.write"] + } + ], + "tags": [], + "requestBody": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateBillingSubscriptionPromoCodeRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Subscription 200 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BillingSubscriptionLro" + } + } + } + } + } + }, + "parameters": [ + { + "$ref": "#/components/parameters/BillingAccountIdParameter" + }, + { + "$ref": "#/components/parameters/SubscriptionIdParameter" + } + ] + } + }, + "security": [ + { + "HttpBearerJwtScheme": [] + }, + { + "HttpBearerJwtScheme": ["billing.read"] + }, + { + "HttpBearerJwtScheme": ["billing.write"] + } + ] } diff --git a/__tests__/fixtures/test1/commands.ts b/__tests__/fixtures/test1/commands.ts index 87b7844..594bd7c 100644 --- a/__tests__/fixtures/test1/commands.ts +++ b/__tests__/fixtures/test1/commands.ts @@ -3,65 +3,56 @@ * * WARN: Do not edit directly. * - * Generated on 2024-10-13T02:06:29.480Z + * Generated on 2026-03-06T07:45:22.551Z * */ /** eslint-disable max-classes */ -import { Command } from '@block65/rest-client'; +import { Command, jsonStringify } from "@block65/rest-client"; import type { - GetOperationCommandInput, - LongRunningOperation, - ListBillingAccountsCommandInput, - BillingAccountList, - CreateBillingAccountCommandInput, - CreateBillingAccountCommandBody, - BillingAccount, - GetBillingAccountCommandInput, - UpdateBillingAccountCommandInput, - UpdateBillingAccountCommandBody, - GetBillingAccountPortalCommandInput, - GetBillingAccountPortalCommandBody, - BillingAccountPortal, - LinkBillingAccountCommandInput, - LinkBillingAccountCommandBody, - ListPaymentMethodsCommandInput, - PaymentMethods, - CreatePaymentMethodCommandInput, - PaymentMethodIntendedLro, - GetPaymentMethodFromStripeCommandInput, - PaymentMethod, - GetPaymentMethodCommandInput, - UpdatePaymentMethodCommandInput, - UpdatePaymentMethodCommandBody, - DeletePaymentMethodCommandInput, - PaymentMethodDeletedLro, - ListBillingSubscriptionsCommandInput, - BillingSubscriptions, - CreateBillingSubscriptionCommandInput, - CreateBillingSubscriptionCommandBody, - BillingSubscriptionLro, - UpdateBillingSubscriptionCommandInput, - UpdateBillingSubscriptionCommandBody, - CancelSubscriptionCommandInput, - UpdateBillingSubscriptionPromoCodeCommandInput, - UpdateBillingSubscriptionPromoCodeCommandBody, -} from './types.js'; + BillingAccount, + BillingAccountList, + BillingAccountPortal, + BillingSubscriptionLro, + BillingSubscriptions, + CancelSubscriptionCommandInput, + CreateBillingAccountCommandInput, + CreateBillingSubscriptionCommandInput, + CreatePaymentMethodCommandInput, + DeletePaymentMethodCommandInput, + GetBillingAccountCommandInput, + GetBillingAccountPortalCommandInput, + GetOperationCommandInput, + GetPaymentMethodCommandInput, + GetPaymentMethodFromStripeCommandInput, + LinkBillingAccountCommandInput, + ListBillingAccountsCommandInput, + ListBillingSubscriptionsCommandInput, + ListPaymentMethodsCommandInput, + LongRunningOperation, + PaymentMethod, + PaymentMethodDeletedLro, + PaymentMethodIntendedLro, + PaymentMethods, + UpdateBillingAccountCommandInput, + UpdateBillingSubscriptionCommandInput, + UpdateBillingSubscriptionPromoCodeCommandInput, + UpdatePaymentMethodCommandInput, +} from "./types.js"; /** * GetOperationCommand * */ export class GetOperationCommand extends Command< - GetOperationCommandInput, - LongRunningOperation, - never + GetOperationCommandInput, + LongRunningOperation > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: GetOperationCommandInput) { - const { operationId } = input; - super(`/operations/${operationId}`); - } + constructor(input: GetOperationCommandInput) { + const { operationId } = input; + super(`/operations/${operationId}`); + } } /** @@ -69,11 +60,10 @@ export class GetOperationCommand extends Command< * */ export class ListBillingAccountsCommand extends Command< - ListBillingAccountsCommandInput, - BillingAccountList, - never + ListBillingAccountsCommandInput, + BillingAccountList > { - public override method = 'get' as const; + public override method = "get" as const; } /** @@ -81,16 +71,15 @@ export class ListBillingAccountsCommand extends Command< * */ export class CreateBillingAccountCommand extends Command< - CreateBillingAccountCommandInput, - BillingAccount, - CreateBillingAccountCommandBody + CreateBillingAccountCommandInput, + BillingAccount > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: CreateBillingAccountCommandInput) { - const body = input; - super(`/billing-accounts`, body); - } + constructor(input: CreateBillingAccountCommandInput) { + const body = input; + super("/billing-accounts", jsonStringify(body)); + } } /** @@ -98,16 +87,15 @@ export class CreateBillingAccountCommand extends Command< * */ export class GetBillingAccountCommand extends Command< - GetBillingAccountCommandInput, - BillingAccount, - never + GetBillingAccountCommandInput, + BillingAccount > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: GetBillingAccountCommandInput) { - const { billingAccountId } = input; - super(`/billing-accounts/${billingAccountId}`); - } + constructor(input: GetBillingAccountCommandInput) { + const { billingAccountId } = input; + super(`/billing-accounts/${billingAccountId}`); + } } /** @@ -115,16 +103,15 @@ export class GetBillingAccountCommand extends Command< * */ export class UpdateBillingAccountCommand extends Command< - UpdateBillingAccountCommandInput, - BillingAccount, - UpdateBillingAccountCommandBody + UpdateBillingAccountCommandInput, + BillingAccount > { - public override method = 'put' as const; + public override method = "put" as const; - constructor(input: UpdateBillingAccountCommandInput) { - const { billingAccountId, ...body } = input; - super(`/billing-accounts/${billingAccountId}`, body); - } + constructor(input: UpdateBillingAccountCommandInput) { + const { billingAccountId, ...body } = input; + super(`/billing-accounts/${billingAccountId}`, jsonStringify(body)); + } } /** @@ -132,16 +119,15 @@ export class UpdateBillingAccountCommand extends Command< * */ export class GetBillingAccountPortalCommand extends Command< - GetBillingAccountPortalCommandInput, - BillingAccountPortal, - GetBillingAccountPortalCommandBody + GetBillingAccountPortalCommandInput, + BillingAccountPortal > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: GetBillingAccountPortalCommandInput) { - const { billingAccountId, ...body } = input; - super(`/billing-accounts/${billingAccountId}/portal`, body); - } + constructor(input: GetBillingAccountPortalCommandInput) { + const { billingAccountId, ...body } = input; + super(`/billing-accounts/${billingAccountId}/portal`, jsonStringify(body)); + } } /** @@ -149,16 +135,15 @@ export class GetBillingAccountPortalCommand extends Command< * */ export class LinkBillingAccountCommand extends Command< - LinkBillingAccountCommandInput, - unknown, - LinkBillingAccountCommandBody + LinkBillingAccountCommandInput, + unknown > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: LinkBillingAccountCommandInput) { - const { billingAccountId, ...body } = input; - super(`/billing-accounts/${billingAccountId}/link`, body); - } + constructor(input: LinkBillingAccountCommandInput) { + const { billingAccountId, ...body } = input; + super(`/billing-accounts/${billingAccountId}/link`, jsonStringify(body)); + } } /** @@ -166,16 +151,15 @@ export class LinkBillingAccountCommand extends Command< * */ export class ListPaymentMethodsCommand extends Command< - ListPaymentMethodsCommandInput, - PaymentMethods, - never + ListPaymentMethodsCommandInput, + PaymentMethods > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: ListPaymentMethodsCommandInput) { - const { billingAccountId } = input; - super(`/billing-accounts/${billingAccountId}/payment-methods`); - } + constructor(input: ListPaymentMethodsCommandInput) { + const { billingAccountId } = input; + super(`/billing-accounts/${billingAccountId}/payment-methods`); + } } /** @@ -183,16 +167,15 @@ export class ListPaymentMethodsCommand extends Command< * */ export class CreatePaymentMethodCommand extends Command< - CreatePaymentMethodCommandInput, - PaymentMethodIntendedLro, - never + CreatePaymentMethodCommandInput, + PaymentMethodIntendedLro > { - public override method = 'post' as const; + public override method = "post" as const; - constructor(input: CreatePaymentMethodCommandInput) { - const { billingAccountId } = input; - super(`/billing-accounts/${billingAccountId}/payment-methods`); - } + constructor(input: CreatePaymentMethodCommandInput) { + const { billingAccountId } = input; + super(`/billing-accounts/${billingAccountId}/payment-methods`); + } } /** @@ -200,18 +183,17 @@ export class CreatePaymentMethodCommand extends Command< * */ export class GetPaymentMethodFromStripeCommand extends Command< - GetPaymentMethodFromStripeCommandInput, - PaymentMethod, - never + GetPaymentMethodFromStripeCommandInput, + PaymentMethod > { - public override method = 'get' as const; - - constructor(input: GetPaymentMethodFromStripeCommandInput) { - const { billingAccountId, stripePaymentMethodId } = input; - super( - `/billing-accounts/${billingAccountId}/payment-methods/stripe/${stripePaymentMethodId}`, - ); - } + public override method = "get" as const; + + constructor(input: GetPaymentMethodFromStripeCommandInput) { + const { billingAccountId, stripePaymentMethodId } = input; + super( + `/billing-accounts/${billingAccountId}/payment-methods/stripe/${stripePaymentMethodId}`, + ); + } } /** @@ -219,18 +201,17 @@ export class GetPaymentMethodFromStripeCommand extends Command< * */ export class GetPaymentMethodCommand extends Command< - GetPaymentMethodCommandInput, - PaymentMethod, - never + GetPaymentMethodCommandInput, + PaymentMethod > { - public override method = 'get' as const; - - constructor(input: GetPaymentMethodCommandInput) { - const { billingAccountId, paymentMethodId } = input; - super( - `/billing-accounts/${billingAccountId}/payment-methods/${paymentMethodId}`, - ); - } + public override method = "get" as const; + + constructor(input: GetPaymentMethodCommandInput) { + const { billingAccountId, paymentMethodId } = input; + super( + `/billing-accounts/${billingAccountId}/payment-methods/${paymentMethodId}`, + ); + } } /** @@ -238,19 +219,18 @@ export class GetPaymentMethodCommand extends Command< * */ export class UpdatePaymentMethodCommand extends Command< - UpdatePaymentMethodCommandInput, - undefined, - UpdatePaymentMethodCommandBody + UpdatePaymentMethodCommandInput, + undefined > { - public override method = 'put' as const; - - constructor(input: UpdatePaymentMethodCommandInput) { - const { billingAccountId, paymentMethodId, ...body } = input; - super( - `/billing-accounts/${billingAccountId}/payment-methods/${paymentMethodId}`, - body, - ); - } + public override method = "put" as const; + + constructor(input: UpdatePaymentMethodCommandInput) { + const { billingAccountId, paymentMethodId, ...body } = input; + super( + `/billing-accounts/${billingAccountId}/payment-methods/${paymentMethodId}`, + jsonStringify(body), + ); + } } /** @@ -258,18 +238,17 @@ export class UpdatePaymentMethodCommand extends Command< * */ export class DeletePaymentMethodCommand extends Command< - DeletePaymentMethodCommandInput, - PaymentMethodDeletedLro, - never + DeletePaymentMethodCommandInput, + PaymentMethodDeletedLro > { - public override method = 'delete' as const; - - constructor(input: DeletePaymentMethodCommandInput) { - const { billingAccountId, paymentMethodId } = input; - super( - `/billing-accounts/${billingAccountId}/payment-methods/${paymentMethodId}`, - ); - } + public override method = "delete" as const; + + constructor(input: DeletePaymentMethodCommandInput) { + const { billingAccountId, paymentMethodId } = input; + super( + `/billing-accounts/${billingAccountId}/payment-methods/${paymentMethodId}`, + ); + } } /** @@ -277,16 +256,15 @@ export class DeletePaymentMethodCommand extends Command< * */ export class ListBillingSubscriptionsCommand extends Command< - ListBillingSubscriptionsCommandInput, - BillingSubscriptions, - never + ListBillingSubscriptionsCommandInput, + BillingSubscriptions > { - public override method = 'get' as const; + public override method = "get" as const; - constructor(input: ListBillingSubscriptionsCommandInput) { - const { billingAccountId } = input; - super(`/billing-accounts/${billingAccountId}/subscriptions`); - } + constructor(input: ListBillingSubscriptionsCommandInput) { + const { billingAccountId } = input; + super(`/billing-accounts/${billingAccountId}/subscriptions`); + } } /** @@ -294,16 +272,18 @@ export class ListBillingSubscriptionsCommand extends Command< * */ export class CreateBillingSubscriptionCommand extends Command< - CreateBillingSubscriptionCommandInput, - BillingSubscriptionLro, - CreateBillingSubscriptionCommandBody + CreateBillingSubscriptionCommandInput, + BillingSubscriptionLro > { - public override method = 'post' as const; - - constructor(input: CreateBillingSubscriptionCommandInput) { - const { billingAccountId, ...body } = input; - super(`/billing-accounts/${billingAccountId}/subscriptions`, body); - } + public override method = "post" as const; + + constructor(input: CreateBillingSubscriptionCommandInput) { + const { billingAccountId, ...body } = input; + super( + `/billing-accounts/${billingAccountId}/subscriptions`, + jsonStringify(body), + ); + } } /** @@ -311,19 +291,18 @@ export class CreateBillingSubscriptionCommand extends Command< * */ export class UpdateBillingSubscriptionCommand extends Command< - UpdateBillingSubscriptionCommandInput, - undefined, - UpdateBillingSubscriptionCommandBody + UpdateBillingSubscriptionCommandInput, + undefined > { - public override method = 'put' as const; - - constructor(input: UpdateBillingSubscriptionCommandInput) { - const { billingAccountId, subscriptionId, ...body } = input; - super( - `/billing-accounts/${billingAccountId}/subscriptions/${subscriptionId}`, - body, - ); - } + public override method = "put" as const; + + constructor(input: UpdateBillingSubscriptionCommandInput) { + const { billingAccountId, subscriptionId, ...body } = input; + super( + `/billing-accounts/${billingAccountId}/subscriptions/${subscriptionId}`, + jsonStringify(body), + ); + } } /** @@ -331,18 +310,17 @@ export class UpdateBillingSubscriptionCommand extends Command< * */ export class CancelSubscriptionCommand extends Command< - CancelSubscriptionCommandInput, - undefined, - never + CancelSubscriptionCommandInput, + undefined > { - public override method = 'delete' as const; - - constructor(input: CancelSubscriptionCommandInput) { - const { billingAccountId, subscriptionId } = input; - super( - `/billing-accounts/${billingAccountId}/subscriptions/${subscriptionId}`, - ); - } + public override method = "delete" as const; + + constructor(input: CancelSubscriptionCommandInput) { + const { billingAccountId, subscriptionId } = input; + super( + `/billing-accounts/${billingAccountId}/subscriptions/${subscriptionId}`, + ); + } } /** @@ -350,17 +328,16 @@ export class CancelSubscriptionCommand extends Command< * */ export class UpdateBillingSubscriptionPromoCodeCommand extends Command< - UpdateBillingSubscriptionPromoCodeCommandInput, - BillingSubscriptionLro, - UpdateBillingSubscriptionPromoCodeCommandBody + UpdateBillingSubscriptionPromoCodeCommandInput, + BillingSubscriptionLro > { - public override method = 'put' as const; - - constructor(input: UpdateBillingSubscriptionPromoCodeCommandInput) { - const { billingAccountId, subscriptionId, ...body } = input; - super( - `/billing-accounts/${billingAccountId}/subscriptions/${subscriptionId}/promo-code`, - body, - ); - } + public override method = "put" as const; + + constructor(input: UpdateBillingSubscriptionPromoCodeCommandInput) { + const { billingAccountId, subscriptionId, ...body } = input; + super( + `/billing-accounts/${billingAccountId}/subscriptions/${subscriptionId}/promo-code`, + jsonStringify(body), + ); + } } diff --git a/__tests__/fixtures/test1/hono-valibot.ts b/__tests__/fixtures/test1/hono-valibot.ts new file mode 100644 index 0000000..3412770 --- /dev/null +++ b/__tests__/fixtures/test1/hono-valibot.ts @@ -0,0 +1,201 @@ +/** + * This file was auto generated by @block65/openapi-codegen + * + * WARN: Do not edit directly. + * + * Generated on 2026-03-06T07:45:22.551Z + * + */ + +import { PublicValibotHonoError } from "@block65/rest-client"; +import { validator } from "hono/validator"; +import * as v from "valibot"; +import { + cancelSubscriptionCommandParamsSchema, + createBillingAccountCommandBodySchema, + createBillingSubscriptionCommandBodySchema, + createBillingSubscriptionCommandParamsSchema, + createPaymentMethodCommandParamsSchema, + deletePaymentMethodCommandParamsSchema, + getBillingAccountCommandParamsSchema, + getBillingAccountPortalCommandBodySchema, + getBillingAccountPortalCommandParamsSchema, + getOperationCommandParamsSchema, + getPaymentMethodCommandParamsSchema, + getPaymentMethodFromStripeCommandParamsSchema, + linkBillingAccountCommandBodySchema, + linkBillingAccountCommandParamsSchema, + listBillingSubscriptionsCommandParamsSchema, + listPaymentMethodsCommandParamsSchema, + updateBillingAccountCommandBodySchema, + updateBillingAccountCommandParamsSchema, + updateBillingSubscriptionCommandBodySchema, + updateBillingSubscriptionCommandParamsSchema, + updateBillingSubscriptionPromoCodeCommandBodySchema, + updateBillingSubscriptionPromoCodeCommandParamsSchema, + updatePaymentMethodCommandBodySchema, + updatePaymentMethodCommandParamsSchema, +} from "./valibot.js"; + +function toPublicValibotHonoError(err: unknown): never { + if (err instanceof v.ValiError) { + throw PublicValibotHonoError.from(err); + } + throw err; +} + +export const getOperation = [ + validator("param", (value) => { + return v + .parseAsync(getOperationCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const listBillingAccounts = [] as const; +export const createBillingAccount = [ + validator("json", (value) => { + return v + .parseAsync(createBillingAccountCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const getBillingAccount = [ + validator("param", (value) => { + return v + .parseAsync(getBillingAccountCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const updateBillingAccount = [ + validator("json", (value) => { + return v + .parseAsync(updateBillingAccountCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(updateBillingAccountCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const getBillingAccountPortal = [ + validator("json", (value) => { + return v + .parseAsync(getBillingAccountPortalCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(getBillingAccountPortalCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const linkBillingAccount = [ + validator("json", (value) => { + return v + .parseAsync(linkBillingAccountCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(linkBillingAccountCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const listPaymentMethods = [ + validator("param", (value) => { + return v + .parseAsync(listPaymentMethodsCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const createPaymentMethod = [ + validator("param", (value) => { + return v + .parseAsync(createPaymentMethodCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const getPaymentMethodFromStripe = [ + validator("param", (value) => { + return v + .parseAsync(getPaymentMethodFromStripeCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const getPaymentMethod = [ + validator("param", (value) => { + return v + .parseAsync(getPaymentMethodCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const updatePaymentMethod = [ + validator("json", (value) => { + return v + .parseAsync(updatePaymentMethodCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(updatePaymentMethodCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const deletePaymentMethod = [ + validator("param", (value) => { + return v + .parseAsync(deletePaymentMethodCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const listBillingSubscriptions = [ + validator("param", (value) => { + return v + .parseAsync(listBillingSubscriptionsCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const createBillingSubscription = [ + validator("json", (value) => { + return v + .parseAsync(createBillingSubscriptionCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(createBillingSubscriptionCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const updateBillingSubscription = [ + validator("json", (value) => { + return v + .parseAsync(updateBillingSubscriptionCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(updateBillingSubscriptionCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const cancelSubscription = [ + validator("param", (value) => { + return v + .parseAsync(cancelSubscriptionCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; +export const updateBillingSubscriptionPromoCode = [ + validator("json", (value) => { + return v + .parseAsync(updateBillingSubscriptionPromoCodeCommandBodySchema, value) + .catch(toPublicValibotHonoError); + }), + validator("param", (value) => { + return v + .parseAsync(updateBillingSubscriptionPromoCodeCommandParamsSchema, value) + .catch(toPublicValibotHonoError); + }), +] as const; diff --git a/__tests__/fixtures/test1/main.ts b/__tests__/fixtures/test1/main.ts index 52541c3..d710438 100644 --- a/__tests__/fixtures/test1/main.ts +++ b/__tests__/fixtures/test1/main.ts @@ -3,84 +3,84 @@ * * WARN: Do not edit directly. * - * Generated on 2024-10-13T02:06:29.480Z + * Generated on 2026-03-06T07:45:22.551Z * */ import { - RestServiceClient, - type RestServiceClientConfig, -} from '@block65/rest-client'; + RestServiceClient, + type RestServiceClientConfig, +} from "@block65/rest-client"; import type { - BillingAccount, - BillingAccountList, - BillingAccountPortal, - BillingSubscriptionLro, - BillingSubscriptions, - CancelSubscriptionCommandInput, - CreateBillingAccountCommandInput, - CreateBillingSubscriptionCommandInput, - CreatePaymentMethodCommandInput, - DeletePaymentMethodCommandInput, - GetBillingAccountCommandInput, - GetBillingAccountPortalCommandInput, - GetOperationCommandInput, - GetPaymentMethodCommandInput, - GetPaymentMethodFromStripeCommandInput, - LinkBillingAccountCommandInput, - ListBillingAccountsCommandInput, - ListBillingSubscriptionsCommandInput, - ListPaymentMethodsCommandInput, - LongRunningOperation, - PaymentMethod, - PaymentMethodDeletedLro, - PaymentMethodIntendedLro, - PaymentMethods, - UpdateBillingAccountCommandInput, - UpdateBillingSubscriptionCommandInput, - UpdateBillingSubscriptionPromoCodeCommandInput, - UpdatePaymentMethodCommandInput, -} from './types.js'; + BillingAccount, + BillingAccountList, + BillingAccountPortal, + BillingSubscriptionLro, + BillingSubscriptions, + CancelSubscriptionCommandInput, + CreateBillingAccountCommandInput, + CreateBillingSubscriptionCommandInput, + CreatePaymentMethodCommandInput, + DeletePaymentMethodCommandInput, + GetBillingAccountCommandInput, + GetBillingAccountPortalCommandInput, + GetOperationCommandInput, + GetPaymentMethodCommandInput, + GetPaymentMethodFromStripeCommandInput, + LinkBillingAccountCommandInput, + ListBillingAccountsCommandInput, + ListBillingSubscriptionsCommandInput, + ListPaymentMethodsCommandInput, + LongRunningOperation, + PaymentMethod, + PaymentMethodDeletedLro, + PaymentMethodIntendedLro, + PaymentMethods, + UpdateBillingAccountCommandInput, + UpdateBillingSubscriptionCommandInput, + UpdateBillingSubscriptionPromoCodeCommandInput, + UpdatePaymentMethodCommandInput, +} from "./types.js"; type AllInputs = - | CancelSubscriptionCommandInput - | CreateBillingAccountCommandInput - | CreateBillingSubscriptionCommandInput - | CreatePaymentMethodCommandInput - | DeletePaymentMethodCommandInput - | GetBillingAccountCommandInput - | GetBillingAccountPortalCommandInput - | GetOperationCommandInput - | GetPaymentMethodCommandInput - | GetPaymentMethodFromStripeCommandInput - | LinkBillingAccountCommandInput - | ListBillingAccountsCommandInput - | ListBillingSubscriptionsCommandInput - | ListPaymentMethodsCommandInput - | UpdateBillingAccountCommandInput - | UpdateBillingSubscriptionCommandInput - | UpdateBillingSubscriptionPromoCodeCommandInput - | UpdatePaymentMethodCommandInput; + | CancelSubscriptionCommandInput + | CreateBillingAccountCommandInput + | CreateBillingSubscriptionCommandInput + | CreatePaymentMethodCommandInput + | DeletePaymentMethodCommandInput + | GetBillingAccountCommandInput + | GetBillingAccountPortalCommandInput + | GetOperationCommandInput + | GetPaymentMethodCommandInput + | GetPaymentMethodFromStripeCommandInput + | LinkBillingAccountCommandInput + | ListBillingAccountsCommandInput + | ListBillingSubscriptionsCommandInput + | ListPaymentMethodsCommandInput + | UpdateBillingAccountCommandInput + | UpdateBillingSubscriptionCommandInput + | UpdateBillingSubscriptionPromoCodeCommandInput + | UpdatePaymentMethodCommandInput; type AllOutputs = - | BillingAccount - | BillingAccountList - | BillingAccountPortal - | BillingSubscriptionLro - | BillingSubscriptions - | LongRunningOperation - | PaymentMethod - | PaymentMethodDeletedLro - | PaymentMethodIntendedLro - | PaymentMethods - | undefined; + | BillingAccount + | BillingAccountList + | BillingAccountPortal + | BillingSubscriptionLro + | BillingSubscriptions + | LongRunningOperation + | PaymentMethod + | PaymentMethodDeletedLro + | PaymentMethodIntendedLro + | PaymentMethods + | undefined; export class BillingServiceRestApiRestClient extends RestServiceClient< - AllInputs, - AllOutputs + AllInputs, + AllOutputs > { - constructor( - baseUrl: string | URL = new URL('https://api.example.com/'), - config?: RestServiceClientConfig, - ) { - super(baseUrl, config); - } + constructor( + baseUrl: string | URL = new URL("https://api.example.com/"), + config?: RestServiceClientConfig, + ) { + super(baseUrl, config); + } } diff --git a/__tests__/fixtures/test1/types.ts b/__tests__/fixtures/test1/types.ts index dd7ec2c..253be45 100644 --- a/__tests__/fixtures/test1/types.ts +++ b/__tests__/fixtures/test1/types.ts @@ -3,381 +3,299 @@ * * WARN: Do not edit directly. * - * Generated on 2024-10-13T02:06:29.480Z + * Generated on 2026-03-06T07:45:22.551Z * */ -import type { Jsonify } from 'type-fest'; -import type { JsonifiableObject } from 'type-fest/source/jsonifiable.js'; +import type { Jsonifiable, Jsonify } from "type-fest"; export type PromoCode = string; export type StripeId = string; export type DateTime = Jsonify; - -export enum BillingSubscriptionStatusEnum { - Active = 'active', - Inactive = 'inactive', -} - -export type BillingSubscriptionStatus = - | BillingSubscriptionStatusEnum - | 'active' - | 'inactive'; - -export enum BillingSubscriptionIntervalEnum { - Monthly = 'monthly', - Yearly = 'yearly', -} - -export type BillingSubscriptionInterval = - | BillingSubscriptionIntervalEnum - | 'monthly' - | 'yearly'; - -export enum PlanSkuEnum { - Donotuse = 'donotuse', - Plasku1 = 'plasku1', - Plasku2 = 'plasku2', - Plasku3 = 'plasku3', - Plasku4 = 'plasku4', -} - +export type BillingSubscriptionStatus = "active" | "inactive"; +export type BillingSubscriptionInterval = "monthly" | "yearly"; export type PlanSku = - | PlanSkuEnum - | 'donotuse' - | 'plasku1' - | 'plasku2' - | 'plasku3' - | 'plasku4'; + | "donotuse" + | "plasku1" + | "plasku2" + | "plasku3" + | "plasku4"; export type Id = string; export type BillingSubscriptionIdentifiers = { - billingAccountId: Id; - subscriptionId: Id; + billingAccountId: Id; + subscriptionId: Id; }; export type BillingSubscription = BillingSubscriptionIdentifiers & { - accountId?: Id; - planSku: PlanSku; - interval: BillingSubscriptionInterval; - status: BillingSubscriptionStatus; - cycleTime: DateTime; - trialEndTime?: DateTime; - createdTime: DateTime; - updatedTime?: DateTime; + accountId?: Id; + planSku: PlanSku; + interval: BillingSubscriptionInterval; + status: BillingSubscriptionStatus; + cycleTime: DateTime; + trialEndTime?: DateTime; + createdTime: DateTime; + updatedTime?: DateTime; }; export type BillingSubscriptions = BillingSubscription[]; export type Uuid = string; export type LongRunningOperationFail = { - operationId: Uuid; - done: boolean; - result: { - error: number; - }; + operationId: Uuid; + done: boolean; + result: { + error: number; + }; }; export type StringU8 = string; export type BillingSubscriptionPromoCodeLongRunningOperationSuccess = { - operationId: Uuid; - done: boolean; - result: { - response: { - promoCode: StringU8; - }; - }; + operationId: Uuid; + done: boolean; + result: { + response: { + promoCode: StringU8; + }; + }; }; export type LongRunningOperationIndeterminate = { - operationId: Uuid; - done: boolean; + operationId: Uuid; + done: boolean; }; export type BillingSubscriptionLro = - | LongRunningOperationIndeterminate - | BillingSubscriptionPromoCodeLongRunningOperationSuccess - | LongRunningOperationFail; + | LongRunningOperationIndeterminate + | BillingSubscriptionPromoCodeLongRunningOperationSuccess + | LongRunningOperationFail; export type UpdateBillingSubscriptionPromoCodeRequest = { - promoCode: StringU8 | null; + promoCode: StringU8 | null; }; /** Reasonable string to be used as a name of a person, or an object */ export type Name = string; export type UpdateBillingSubscriptionRequest = { - label?: Name; - trialEndTime?: DateTime; + /** Reasonable string to be used as a name of a person, or an object */ + label?: Name; + trialEndTime?: DateTime; }; export type CreateBillingSubscriptionRequest = { - accountId: Id; - planSku: PlanSku; - interval: BillingSubscriptionInterval; - promoCode?: StringU8; + accountId: Id; + planSku: PlanSku; + interval: BillingSubscriptionInterval; + promoCode?: StringU8; }; - -export enum PaymentMethodBrandEnum { - Amex = 'amex', - Diners = 'diners', - Discover = 'discover', - Jcb = 'jcb', - Mastercard = 'mastercard', - Unionpay = 'unionpay', - Visa = 'visa', - Unknown = 'unknown', -} - export type PaymentMethodBrand = - | PaymentMethodBrandEnum - | 'amex' - | 'diners' - | 'discover' - | 'jcb' - | 'mastercard' - | 'unionpay' - | 'visa' - | 'unknown'; + | "amex" + | "diners" + | "discover" + | "jcb" + | "mastercard" + | "unionpay" + | "visa" + | "unknown"; export type PaymentMethodIdentifiers = { - billingAccountId: Id; - paymentMethodId: Id; + billingAccountId: Id; + paymentMethodId: Id; }; export type PaymentMethod = PaymentMethodIdentifiers & { - label: Name; - expireTime: DateTime; - humanId: StringU8; - brand?: PaymentMethodBrand; + /** Reasonable string to be used as a name of a person, or an object */ + label: Name; + expireTime: DateTime; + humanId: StringU8; + brand?: PaymentMethodBrand; }; export type PaymentMethods = PaymentMethod[]; export type PaymentMethodDeletedLongRunningOperationSuccess = { - operationId: Uuid; - done: boolean; - result: { - response: { - ok: boolean; - }; - }; + operationId: Uuid; + done: boolean; + result: { + response: { + ok: boolean; + }; + }; }; export type PaymentMethodDeletedLro = - | LongRunningOperationIndeterminate - | PaymentMethodDeletedLongRunningOperationSuccess - | LongRunningOperationFail; + | LongRunningOperationIndeterminate + | PaymentMethodDeletedLongRunningOperationSuccess + | LongRunningOperationFail; export type PaymentMethodLongRunningOperationSuccess = { - operationId: Uuid; - done: boolean; - result: { - response: { - clientSecret: string; - }; - }; + operationId: Uuid; + done: boolean; + result: { + response: { + clientSecret: string; + }; + }; }; export type PaymentMethodIntendedLro = - | LongRunningOperationIndeterminate - | PaymentMethodLongRunningOperationSuccess - | LongRunningOperationFail; + | LongRunningOperationIndeterminate + | PaymentMethodLongRunningOperationSuccess + | LongRunningOperationFail; export type UpdatePaymentMethodRequest = { - label?: Name; - isDefault?: boolean; + /** Reasonable string to be used as a name of a person, or an object */ + label?: Name; + isDefault?: boolean; }; export type LinkBillingAccountRequest = { - accountId: Id; + accountId: Id; }; export type Url = string; export type BillingAccountPortal = { - url: Url; + url: Url; }; export type Origin = string; export type BillingAccountPortalRequest = { - origin: Origin; - accountId: Id; + origin: Origin; + accountId: Id; }; export type TimeZone = string; - -export enum BillingLocaleEnum { - En = 'en', -} - -export type BillingLocale = BillingLocaleEnum | 'en'; - -export enum BillingAccountTypeEnum { - Standard = 'standard', - Agency = 'agency', - Reseller = 'reseller', -} - -export type BillingAccountType = - | BillingAccountTypeEnum - | 'standard' - | 'agency' - | 'reseller'; - -export enum CurrencyEnum { - Usd = 'usd', - Aud = 'aud', - Sgd = 'sgd', - Myr = 'myr', - Gbp = 'gbp', -} - -export type Currency = CurrencyEnum | 'usd' | 'aud' | 'sgd' | 'myr' | 'gbp'; - -export enum BillingAccountStatusEnum { - Nominal = 'nominal', - Delinquent = 'delinquent', -} - -export type BillingAccountStatus = - | BillingAccountStatusEnum - | 'nominal' - | 'delinquent'; - -export enum BillingCountryEnum { - Us = 'us', - Au = 'au', - Sg = 'sg', - My = 'my', - Gb = 'gb', -} - -export type BillingCountry = - | BillingCountryEnum - | 'us' - | 'au' - | 'sg' - | 'my' - | 'gb'; +export type BillingLocale = "en"; +export type BillingAccountType = "standard" | "agency" | "reseller"; +export type Currency = "usd" | "aud" | "sgd" | "myr" | "gbp"; +export type BillingAccountStatus = "nominal" | "delinquent"; +export type BillingCountry = "us" | "au" | "sg" | "my" | "gb"; /** Valid email address with fully qualified public top-level domain */ export type Email = string; export type BillingAccountIdentifiers = { - billingAccountId: Id; + billingAccountId: Id; }; export type BillingAccount = BillingAccountIdentifiers & { - name: Name; - email: Email; - country: BillingCountry; - status: BillingAccountStatus; - currency: Currency; - type: BillingAccountType; - createdTime: DateTime; - updatedTime?: DateTime; - locale?: BillingLocale; - purchaseOrder?: StringU8; - taxId?: StringU8; - timeZone?: TimeZone; - defaultPaymentMethodId?: Id; + /** Reasonable string to be used as a name of a person, or an object */ + name: Name; + /** Valid email address with fully qualified public top-level domain */ + email: Email; + country: BillingCountry; + status: BillingAccountStatus; + currency: Currency; + type: BillingAccountType; + createdTime: DateTime; + updatedTime?: DateTime; + locale?: BillingLocale; + purchaseOrder?: StringU8; + taxId?: StringU8; + timeZone?: TimeZone; + defaultPaymentMethodId?: Id; }; export type BillingAccountList = BillingAccount[]; export type BillingAccountUpdateRequest = { - name?: Name; - email?: Email; - country?: BillingCountry; - timeZone?: TimeZone; - currency?: Currency; - locale?: BillingLocale | null; - purchaseOrder?: StringU8 | null; - taxId?: StringU8 | null; + /** Reasonable string to be used as a name of a person, or an object */ + name?: Name; + /** Valid email address with fully qualified public top-level domain */ + email?: Email; + country?: BillingCountry; + timeZone?: TimeZone; + currency?: Currency; + locale?: BillingLocale | null; + purchaseOrder?: StringU8 | null; + taxId?: StringU8 | null; }; export type BillingAccountCreateRequest = { - name: Name; - email: Email; - country: BillingCountry; - timeZone: TimeZone; - currency: Currency; - locale?: BillingLocale | null; - purchaseOrder?: StringU8 | null; - taxId?: StringU8 | null; + /** Reasonable string to be used as a name of a person, or an object */ + name: Name; + /** Valid email address with fully qualified public top-level domain */ + email: Email; + country: BillingCountry; + timeZone: TimeZone; + currency: Currency; + locale?: BillingLocale | null; + purchaseOrder?: StringU8 | null; + taxId?: StringU8 | null; }; export type LongRunningOperationSuccess = { - operationId: Uuid; - done: boolean; - result: { - response: JsonifiableObject; - }; + operationId: Uuid; + done: boolean; + result: { + response: Record; + }; }; export type LongRunningOperation = - | LongRunningOperationIndeterminate - | LongRunningOperationFail - | LongRunningOperationSuccess; + | LongRunningOperationIndeterminate + | LongRunningOperationFail + | LongRunningOperationSuccess; export type GetOperationCommandParams = { - operationId: Uuid; + operationId: Uuid; }; export type GetOperationCommandInput = GetOperationCommandParams; export type ListBillingAccountsCommandInput = never; -export type CreateBillingAccountCommandInput = BillingAccountCreateRequest; export type CreateBillingAccountCommandBody = BillingAccountCreateRequest; +export type CreateBillingAccountCommandInput = BillingAccountCreateRequest; export type GetBillingAccountCommandParams = { - billingAccountId: Id; + billingAccountId: Id; }; export type GetBillingAccountCommandInput = GetBillingAccountCommandParams; export type UpdateBillingAccountCommandParams = { - billingAccountId: Id; + billingAccountId: Id; }; -export type UpdateBillingAccountCommandInput = BillingAccountUpdateRequest & - UpdateBillingAccountCommandParams; export type UpdateBillingAccountCommandBody = BillingAccountUpdateRequest; +export type UpdateBillingAccountCommandInput = BillingAccountUpdateRequest & + UpdateBillingAccountCommandParams; export type GetBillingAccountPortalCommandParams = { - billingAccountId: Id; + billingAccountId: Id; }; -export type GetBillingAccountPortalCommandInput = BillingAccountPortalRequest & - GetBillingAccountPortalCommandParams; export type GetBillingAccountPortalCommandBody = BillingAccountPortalRequest; +export type GetBillingAccountPortalCommandInput = BillingAccountPortalRequest & + GetBillingAccountPortalCommandParams; export type LinkBillingAccountCommandParams = { - billingAccountId: Id; + billingAccountId: Id; }; -export type LinkBillingAccountCommandInput = LinkBillingAccountRequest & - LinkBillingAccountCommandParams; export type LinkBillingAccountCommandBody = LinkBillingAccountRequest; +export type LinkBillingAccountCommandInput = LinkBillingAccountRequest & + LinkBillingAccountCommandParams; export type ListPaymentMethodsCommandParams = { - billingAccountId: Id; + billingAccountId: Id; }; export type ListPaymentMethodsCommandInput = ListPaymentMethodsCommandParams; export type CreatePaymentMethodCommandParams = { - billingAccountId: Id; + billingAccountId: Id; }; export type CreatePaymentMethodCommandInput = CreatePaymentMethodCommandParams; export type GetPaymentMethodFromStripeCommandParams = { - billingAccountId: Id; - stripePaymentMethodId: StripeId; + billingAccountId: Id; + stripePaymentMethodId: StripeId; }; export type GetPaymentMethodFromStripeCommandInput = - GetPaymentMethodFromStripeCommandParams; + GetPaymentMethodFromStripeCommandParams; export type GetPaymentMethodCommandParams = { - billingAccountId: Id; - paymentMethodId: Id; + billingAccountId: Id; + paymentMethodId: Id; }; export type GetPaymentMethodCommandInput = GetPaymentMethodCommandParams; export type UpdatePaymentMethodCommandParams = { - billingAccountId: Id; - paymentMethodId: Id; + billingAccountId: Id; + paymentMethodId: Id; }; -export type UpdatePaymentMethodCommandInput = UpdatePaymentMethodRequest & - UpdatePaymentMethodCommandParams; export type UpdatePaymentMethodCommandBody = UpdatePaymentMethodRequest; +export type UpdatePaymentMethodCommandInput = UpdatePaymentMethodRequest & + UpdatePaymentMethodCommandParams; export type DeletePaymentMethodCommandParams = { - billingAccountId: Id; - paymentMethodId: Id; + billingAccountId: Id; + paymentMethodId: Id; }; export type DeletePaymentMethodCommandInput = DeletePaymentMethodCommandParams; export type ListBillingSubscriptionsCommandParams = { - billingAccountId: Id; + billingAccountId: Id; }; export type ListBillingSubscriptionsCommandInput = - ListBillingSubscriptionsCommandParams; + ListBillingSubscriptionsCommandParams; export type CreateBillingSubscriptionCommandParams = { - billingAccountId: Id; + billingAccountId: Id; }; -export type CreateBillingSubscriptionCommandInput = - CreateBillingSubscriptionRequest & CreateBillingSubscriptionCommandParams; export type CreateBillingSubscriptionCommandBody = - CreateBillingSubscriptionRequest; + CreateBillingSubscriptionRequest; +export type CreateBillingSubscriptionCommandInput = + CreateBillingSubscriptionRequest & CreateBillingSubscriptionCommandParams; export type UpdateBillingSubscriptionCommandParams = { - billingAccountId: Id; - subscriptionId: Id; + billingAccountId: Id; + subscriptionId: Id; }; -export type UpdateBillingSubscriptionCommandInput = - UpdateBillingSubscriptionRequest & UpdateBillingSubscriptionCommandParams; export type UpdateBillingSubscriptionCommandBody = - UpdateBillingSubscriptionRequest; + UpdateBillingSubscriptionRequest; +export type UpdateBillingSubscriptionCommandInput = + UpdateBillingSubscriptionRequest & UpdateBillingSubscriptionCommandParams; export type CancelSubscriptionCommandParams = { - billingAccountId: Id; - subscriptionId: Id; + billingAccountId: Id; + subscriptionId: Id; }; export type CancelSubscriptionCommandInput = CancelSubscriptionCommandParams; export type UpdateBillingSubscriptionPromoCodeCommandParams = { - billingAccountId: Id; - subscriptionId: Id; + billingAccountId: Id; + subscriptionId: Id; }; -export type UpdateBillingSubscriptionPromoCodeCommandInput = - UpdateBillingSubscriptionPromoCodeRequest & - UpdateBillingSubscriptionPromoCodeCommandParams; export type UpdateBillingSubscriptionPromoCodeCommandBody = - UpdateBillingSubscriptionPromoCodeRequest; + UpdateBillingSubscriptionPromoCodeRequest; +export type UpdateBillingSubscriptionPromoCodeCommandInput = + UpdateBillingSubscriptionPromoCodeRequest & + UpdateBillingSubscriptionPromoCodeCommandParams; diff --git a/__tests__/fixtures/test1/valibot.ts b/__tests__/fixtures/test1/valibot.ts new file mode 100644 index 0000000..4923cab --- /dev/null +++ b/__tests__/fixtures/test1/valibot.ts @@ -0,0 +1,355 @@ +/** + * This file was auto generated by @block65/openapi-codegen + * + * WARN: Do not edit directly. + * + * Generated on 2026-03-06T07:45:22.551Z + * + */ +import * as v from "valibot"; + +export const promoCodeSchema = v.pipe( + v.string(), + v.minLength(1), + v.maxLength(256), + v.regex(/\/^[A-Z0-9]$\//), +); +export const stripeIdSchema = v.pipe( + v.string(), + v.minLength(11), + v.maxLength(255), + v.regex(/^(pm|cus|sub)_\w{8,}$/), +); +export const dateTimeSchema = v.string(); +export const billingSubscriptionStatusSchema = v.picklist([ + "active", + "inactive", +]); +export const billingSubscriptionIntervalSchema = v.picklist([ + "monthly", + "yearly", +]); +export const planSkuSchema = v.picklist([ + "donotuse", + "plasku1", + "plasku2", + "plasku3", + "plasku4", +]); +export const idSchema = v.pipe( + v.string(), + v.minLength(1), + v.maxLength(16), + v.regex(/^[a-zA-Z0-9]+$/), +); +export const billingSubscriptionIdentifiersSchema = v.strictObject({ + billingAccountId: idSchema, + subscriptionId: idSchema, +}); +export const billingSubscriptionSchema = v.intersect([ + billingSubscriptionIdentifiersSchema, + v.strictObject({ + accountId: v.exactOptional(idSchema), + planSku: planSkuSchema, + interval: billingSubscriptionIntervalSchema, + status: billingSubscriptionStatusSchema, + cycleTime: dateTimeSchema, + trialEndTime: v.exactOptional(dateTimeSchema), + createdTime: dateTimeSchema, + updatedTime: v.exactOptional(dateTimeSchema), + }), +]); +export const billingSubscriptionsSchema = v.array(billingSubscriptionSchema); +export const uuidSchema = v.pipe(v.string(), v.uuid()); +export const longRunningOperationFailSchema = v.strictObject({ + operationId: uuidSchema, + done: v.boolean(), + result: v.strictObject({ + error: v.number(), + }), +}); +export const stringU8Schema = v.pipe( + v.string(), + v.minLength(1), + v.maxLength(256), +); +export const billingSubscriptionPromoCodeLongRunningOperationSuccessSchema = + v.strictObject({ + operationId: uuidSchema, + done: v.boolean(), + result: v.strictObject({ + response: v.strictObject({ + promoCode: stringU8Schema, + }), + }), + }); +export const longRunningOperationIndeterminateSchema = v.strictObject({ + operationId: uuidSchema, + done: v.boolean(), +}); +export const billingSubscriptionLroSchema = v.union([ + longRunningOperationIndeterminateSchema, + billingSubscriptionPromoCodeLongRunningOperationSuccessSchema, + longRunningOperationFailSchema, +]); +export const updateBillingSubscriptionPromoCodeRequestSchema = v.strictObject({ + promoCode: v.union([ + stringU8Schema, + v.nullable(v.record(v.string(), v.unknown())), + ]), +}); +/** Reasonable string to be used as a name of a person, or an object */ +export const nameSchema = v.pipe(v.string(), v.minLength(2), v.maxLength(512)); +export const updateBillingSubscriptionRequestSchema = v.strictObject({ + label: v.exactOptional(nameSchema), + trialEndTime: v.exactOptional(dateTimeSchema), +}); +export const createBillingSubscriptionRequestSchema = v.strictObject({ + accountId: idSchema, + planSku: planSkuSchema, + interval: billingSubscriptionIntervalSchema, + promoCode: v.exactOptional(stringU8Schema), +}); +export const paymentMethodBrandSchema = v.picklist([ + "amex", + "diners", + "discover", + "jcb", + "mastercard", + "unionpay", + "visa", + "unknown", +]); +export const paymentMethodIdentifiersSchema = v.strictObject({ + billingAccountId: idSchema, + paymentMethodId: idSchema, +}); +export const paymentMethodSchema = v.intersect([ + paymentMethodIdentifiersSchema, + v.strictObject({ + label: nameSchema, + expireTime: dateTimeSchema, + humanId: stringU8Schema, + brand: v.exactOptional(paymentMethodBrandSchema), + }), +]); +export const paymentMethodsSchema = v.array(paymentMethodSchema); +export const paymentMethodDeletedLongRunningOperationSuccessSchema = + v.strictObject({ + operationId: uuidSchema, + done: v.boolean(), + result: v.strictObject({ + response: v.strictObject({ + ok: v.boolean(), + }), + }), + }); +export const paymentMethodDeletedLroSchema = v.union([ + longRunningOperationIndeterminateSchema, + paymentMethodDeletedLongRunningOperationSuccessSchema, + longRunningOperationFailSchema, +]); +export const paymentMethodLongRunningOperationSuccessSchema = v.strictObject({ + operationId: uuidSchema, + done: v.boolean(), + result: v.strictObject({ + response: v.strictObject({ + clientSecret: v.string(), + }), + }), +}); +export const paymentMethodIntendedLroSchema = v.union([ + longRunningOperationIndeterminateSchema, + paymentMethodLongRunningOperationSuccessSchema, + longRunningOperationFailSchema, +]); +export const updatePaymentMethodRequestSchema = v.strictObject({ + label: v.exactOptional(nameSchema), + isDefault: v.exactOptional(v.boolean()), +}); +export const linkBillingAccountRequestSchema = v.strictObject({ + accountId: idSchema, +}); +export const urlSchema = v.pipe( + v.string(), + v.minLength(1), + v.maxLength(2048), + v.regex(/^https:\/\/.*/), +); +export const billingAccountPortalSchema = v.strictObject({ + url: urlSchema, +}); +export const originSchema = v.pipe( + v.string(), + v.minLength(1), + v.maxLength(263), + v.regex(/^https:\/\/.*$/), +); +export const billingAccountPortalRequestSchema = v.strictObject({ + origin: originSchema, + accountId: idSchema, +}); +export const timeZoneSchema = v.pipe( + v.string(), + v.regex(/^\w{1,32}\/\w{1,32}$/), +); +export const billingLocaleSchema = v.picklist(["en"]); +export const billingAccountTypeSchema = v.picklist([ + "standard", + "agency", + "reseller", +]); +export const currencySchema = v.picklist(["usd", "aud", "sgd", "myr", "gbp"]); +export const billingAccountStatusSchema = v.picklist(["nominal", "delinquent"]); +export const billingCountrySchema = v.picklist(["us", "au", "sg", "my", "gb"]); +/** Valid email address with fully qualified public top-level domain */ +export const emailSchema = v.pipe( + v.string(), + v.email(), + v.minLength(6), + v.maxLength(512), +); +export const billingAccountIdentifiersSchema = v.strictObject({ + billingAccountId: idSchema, +}); +export const billingAccountSchema = v.intersect([ + billingAccountIdentifiersSchema, + v.strictObject({ + name: nameSchema, + email: emailSchema, + country: billingCountrySchema, + status: billingAccountStatusSchema, + currency: currencySchema, + type: billingAccountTypeSchema, + createdTime: dateTimeSchema, + updatedTime: v.exactOptional(dateTimeSchema), + locale: v.exactOptional(billingLocaleSchema), + purchaseOrder: v.exactOptional(stringU8Schema), + taxId: v.exactOptional(stringU8Schema), + timeZone: v.exactOptional(timeZoneSchema), + defaultPaymentMethodId: v.exactOptional(idSchema), + }), +]); +export const billingAccountListSchema = v.array(billingAccountSchema); +export const billingAccountUpdateRequestSchema = v.strictObject({ + name: v.exactOptional(nameSchema), + email: v.exactOptional(emailSchema), + country: v.exactOptional(billingCountrySchema), + timeZone: v.exactOptional(timeZoneSchema), + currency: v.exactOptional(currencySchema), + locale: v.exactOptional( + v.union([ + billingLocaleSchema, + v.nullable(v.record(v.string(), v.unknown())), + ]), + ), + purchaseOrder: v.exactOptional( + v.union([stringU8Schema, v.nullable(v.record(v.string(), v.unknown()))]), + ), + taxId: v.exactOptional( + v.union([stringU8Schema, v.nullable(v.record(v.string(), v.unknown()))]), + ), +}); +export const billingAccountCreateRequestSchema = v.strictObject({ + name: nameSchema, + email: emailSchema, + country: billingCountrySchema, + timeZone: timeZoneSchema, + currency: currencySchema, + locale: v.exactOptional( + v.union([ + billingLocaleSchema, + v.nullable(v.record(v.string(), v.unknown())), + ]), + ), + purchaseOrder: v.exactOptional( + v.union([stringU8Schema, v.nullable(v.record(v.string(), v.unknown()))]), + ), + taxId: v.exactOptional( + v.union([stringU8Schema, v.nullable(v.record(v.string(), v.unknown()))]), + ), +}); +export const longRunningOperationSuccessSchema = v.strictObject({ + operationId: uuidSchema, + done: v.boolean(), + result: v.strictObject({ + response: v.record(v.string(), v.unknown()), + }), +}); +export const longRunningOperationSchema = v.union([ + longRunningOperationIndeterminateSchema, + longRunningOperationFailSchema, + longRunningOperationSuccessSchema, +]); +export const getOperationCommandParamsSchema = v.strictObject({ + operationId: uuidSchema, +}); +export const createBillingAccountCommandBodySchema = + billingAccountCreateRequestSchema; +export const getBillingAccountCommandParamsSchema = v.strictObject({ + billingAccountId: idSchema, +}); +export const updateBillingAccountCommandBodySchema = + billingAccountUpdateRequestSchema; +export const updateBillingAccountCommandParamsSchema = v.strictObject({ + billingAccountId: idSchema, +}); +export const getBillingAccountPortalCommandBodySchema = + billingAccountPortalRequestSchema; +export const getBillingAccountPortalCommandParamsSchema = v.strictObject({ + billingAccountId: idSchema, +}); +export const linkBillingAccountCommandBodySchema = + linkBillingAccountRequestSchema; +export const linkBillingAccountCommandParamsSchema = v.strictObject({ + billingAccountId: idSchema, +}); +export const listPaymentMethodsCommandParamsSchema = v.strictObject({ + billingAccountId: idSchema, +}); +export const createPaymentMethodCommandParamsSchema = v.strictObject({ + billingAccountId: idSchema, +}); +export const getPaymentMethodFromStripeCommandParamsSchema = v.strictObject({ + billingAccountId: idSchema, + stripePaymentMethodId: stripeIdSchema, +}); +export const getPaymentMethodCommandParamsSchema = v.strictObject({ + billingAccountId: idSchema, + paymentMethodId: idSchema, +}); +export const updatePaymentMethodCommandBodySchema = + updatePaymentMethodRequestSchema; +export const updatePaymentMethodCommandParamsSchema = v.strictObject({ + billingAccountId: idSchema, + paymentMethodId: idSchema, +}); +export const deletePaymentMethodCommandParamsSchema = v.strictObject({ + billingAccountId: idSchema, + paymentMethodId: idSchema, +}); +export const listBillingSubscriptionsCommandParamsSchema = v.strictObject({ + billingAccountId: idSchema, +}); +export const createBillingSubscriptionCommandBodySchema = + createBillingSubscriptionRequestSchema; +export const createBillingSubscriptionCommandParamsSchema = v.strictObject({ + billingAccountId: idSchema, +}); +export const updateBillingSubscriptionCommandBodySchema = + updateBillingSubscriptionRequestSchema; +export const updateBillingSubscriptionCommandParamsSchema = v.strictObject({ + billingAccountId: idSchema, + subscriptionId: idSchema, +}); +export const cancelSubscriptionCommandParamsSchema = v.strictObject({ + billingAccountId: idSchema, + subscriptionId: idSchema, +}); +export const updateBillingSubscriptionPromoCodeCommandBodySchema = + updateBillingSubscriptionPromoCodeRequestSchema; +export const updateBillingSubscriptionPromoCodeCommandParamsSchema = + v.strictObject({ + billingAccountId: idSchema, + subscriptionId: idSchema, + }); diff --git a/__tests__/nullables.test.ts b/__tests__/nullables.test.ts index 67f63ca..fc4dc97 100644 --- a/__tests__/nullables.test.ts +++ b/__tests__/nullables.test.ts @@ -1,31 +1,31 @@ -import { expect, test } from 'vitest'; -import { processOpenApiDocument } from '../lib/process-document.js'; +import { expect, test } from "vitest"; +import { processOpenApiDocument } from "../lib/process-document.ts"; -test('nullables', async () => { - const result = await processOpenApiDocument( - '/tmp/like-you-know-whatever', // if we dont call .save() it doesnt matter what this path is - { - openapi: '3.1.0', - info: { - title: 'Test', - version: '1.0.0', - }, - paths: {}, - components: { - schemas: { - MySchemaLolOrNullable: { - oneOf: [ - { - type: ['string', 'null'], - enum: ['lol', 'kek'], - }, - ], - }, - }, - }, - }, - [], - ); +test("nullables", async () => { + const result = await processOpenApiDocument( + "/tmp/like-you-know-whatever", // if we dont call .save() it doesnt matter what this path is + { + openapi: "3.1.0", + info: { + title: "Test", + version: "1.0.0", + }, + paths: {}, + components: { + schemas: { + MySchemaLolOrNullable: { + oneOf: [ + { + type: ["string", "null"], + enum: ["lol", "kek"], + }, + ], + }, + }, + }, + }, + [], + ); - expect(result.typesFile.getText()).toMatchSnapshot(); + expect(result.typesFile.getText()).toMatchSnapshot(); }); diff --git a/__tests__/openai.test.ts b/__tests__/openai.test.ts index 88c5703..30e0def 100644 --- a/__tests__/openai.test.ts +++ b/__tests__/openai.test.ts @@ -1,15 +1,15 @@ -import { test, expect } from 'vitest'; -import { CreateModerationCommand } from './fixtures/openai/commands.js'; -import { OpenAiApiRestClient } from './fixtures/openai/main.js'; +import { expect, test } from "vitest"; +import { CreateModerationCommand } from "./fixtures/openai/commands.ts"; +import { OpenAiApiRestClient } from "./fixtures/openai/main.ts"; -test('OpenAI CreateModeration', async () => { - const openAiClient = new OpenAiApiRestClient(new URL('http://invalid')); +test("OpenAI CreateModeration", async () => { + const openAiClient = new OpenAiApiRestClient(new URL("http://invalid")); - const command = new CreateModerationCommand({ - input: 'This is a test', - }); + const command = new CreateModerationCommand({ + input: "This is a test", + }); - const result = await openAiClient.json(command).catch((err) => err); + const result = await openAiClient.json(command).catch((err) => err); - expect(result).toBeTruthy(); + expect(result).toBeTruthy(); }); diff --git a/__tests__/petstore.test.ts b/__tests__/petstore.test.ts index bd05ec7..4ff7cd2 100644 --- a/__tests__/petstore.test.ts +++ b/__tests__/petstore.test.ts @@ -1,52 +1,52 @@ -import { MockAgent, setGlobalDispatcher } from 'undici'; -import { afterAll, beforeAll, describe, expect, test, vi } from 'vitest'; -import { FindPetsCommand } from './fixtures/petstore/commands.js'; -import { SwaggerPetstoreRestClient } from './fixtures/petstore/main.js'; +import { MockAgent, setGlobalDispatcher } from "undici"; +import { afterAll, beforeAll, describe, expect, test, vi } from "vitest"; +import { FindPetsCommand } from "./fixtures/petstore/commands.ts"; +import { SwaggerPetstoreRestClient } from "./fixtures/petstore/main.ts"; const mockAgent = new MockAgent(); setGlobalDispatcher(mockAgent); beforeAll(() => { - mockAgent.activate(); - mockAgent.disableNetConnect(); + mockAgent.activate(); + mockAgent.disableNetConnect(); }); afterAll(() => { - mockAgent.assertNoPendingInterceptors(); + mockAgent.assertNoPendingInterceptors(); }); mockAgent.disableNetConnect(); -const apiUrl = 'http://192.2.0.1'; - -describe('Petstore', () => { - const pool = mockAgent.get(apiUrl); - - const bodySpy = vi.fn(() => ({ ok: true })); - - pool - .intercept({ - path: '/pets?tags=tag1%2Ctag2&limit=10', - // query: { limit: '10', tags: ['tag1', 'tag2'] }, - method: 'GET', - body(body) { - bodySpy(body); - return true; - }, - }) - .reply(200, { ok: 1 }) - .times(1); - - test('find pets', async () => { - const petStoreClient = new SwaggerPetstoreRestClient(apiUrl, { - logger: console.log, - }); - const command = new FindPetsCommand({ - limit: '10', - tags: ['tag1', 'tag2'], - }); - - const result = await petStoreClient.json(command).catch((err) => err); - - expect(result).toBeTruthy(); - }); +const apiUrl = "http://192.2.0.1"; + +describe("Petstore", () => { + const pool = mockAgent.get(apiUrl); + + const bodySpy = vi.fn((_body: string) => ({ ok: true })); + + pool + .intercept({ + path: "/pets?tags=tag1%2Ctag2&limit=10", + // query: { limit: '10', tags: ['tag1', 'tag2'] }, + method: "GET", + body(body) { + bodySpy(body); + return true; + }, + }) + .reply(200, { ok: 1 }) + .times(1); + + test("find pets", async () => { + const petStoreClient = new SwaggerPetstoreRestClient(apiUrl, { + logger: console.log, + }); + const command = new FindPetsCommand({ + limit: "10", + tags: ["tag1", "tag2"], + }); + + const result = await petStoreClient.json(command).catch((err) => err); + + expect(result).toBeTruthy(); + }); }); diff --git a/__tests__/reference-client.ts b/__tests__/reference-client.ts index f123715..ca06b2c 100644 --- a/__tests__/reference-client.ts +++ b/__tests__/reference-client.ts @@ -1,3 +1,3 @@ -import { RestServiceClient } from '@block65/rest-client'; +import { RestServiceClient } from "@block65/rest-client"; export class NewClient extends RestServiceClient {} diff --git a/__tests__/test1.test.ts b/__tests__/test1.test.ts index ddb8056..546394a 100644 --- a/__tests__/test1.test.ts +++ b/__tests__/test1.test.ts @@ -1,51 +1,51 @@ -import { MockAgent, setGlobalDispatcher } from 'undici'; -import { afterAll, beforeAll, describe, expect, test, vi } from 'vitest'; -import { GetBillingAccountCommand } from './fixtures/test1/commands.js'; -import { BillingServiceRestApiRestClient } from './fixtures/test1/main.js'; +import { MockAgent, setGlobalDispatcher } from "undici"; +import { afterAll, beforeAll, describe, expect, test, vi } from "vitest"; +import { GetBillingAccountCommand } from "./fixtures/test1/commands.ts"; +import { BillingServiceRestApiRestClient } from "./fixtures/test1/main.ts"; const mockAgent = new MockAgent(); beforeAll(() => { - mockAgent.activate(); - mockAgent.disableNetConnect(); - setGlobalDispatcher(mockAgent); + mockAgent.activate(); + mockAgent.disableNetConnect(); + setGlobalDispatcher(mockAgent); }); afterAll(() => { - mockAgent.assertNoPendingInterceptors(); + mockAgent.assertNoPendingInterceptors(); }); mockAgent.disableNetConnect(); // setGlobalDispatcher(mockAgent); -const apiUrl = 'http://192.2.0.1'; - -describe('Test1', () => { - const pool = mockAgent.get(apiUrl); - - const bodySpy = vi.fn(() => ({ ok: true })); - - pool - .intercept({ - path: '/billing-accounts/1234', - method: 'GET', - body(body) { - bodySpy(body); - return true; - }, - }) - .reply(200, { ok: 1 }) - .times(1); - - test('get billing account', async () => { - const client = new BillingServiceRestApiRestClient(apiUrl, { - logger: console.debug, - }); - const command = new GetBillingAccountCommand({ - billingAccountId: '1234', - }); - - await client.json(command); - - expect(bodySpy).toBeTruthy(); - }); +const apiUrl = "http://192.2.0.1"; + +describe("Test1", () => { + const pool = mockAgent.get(apiUrl); + + const bodySpy = vi.fn((_body: string) => ({ ok: true })); + + pool + .intercept({ + path: "/billing-accounts/1234", + method: "GET", + body(body) { + bodySpy(body); + return true; + }, + }) + .reply(200, { ok: 1 }) + .times(1); + + test("get billing account", async () => { + const client = new BillingServiceRestApiRestClient(apiUrl, { + logger: console.debug, + }); + const command = new GetBillingAccountCommand({ + billingAccountId: "1234", + }); + + await client.json(command); + + expect(bodySpy).toBeTruthy(); + }); }); diff --git a/bin/index.ts b/bin/index.ts old mode 100644 new mode 100755 index ad51ee9..85c35a1 --- a/bin/index.ts +++ b/bin/index.ts @@ -1,36 +1,36 @@ #!/usr/bin/env node -import { join } from 'node:path'; -import yargs from 'yargs'; -import { hideBin } from 'yargs/helpers'; -import { build } from '../lib/build.js'; +import { join } from "node:path"; +import yargs from "yargs"; +import { hideBin } from "yargs/helpers"; +import { build } from "../lib/build.ts"; const cliArgs = await yargs(hideBin(process.argv)) - .usage('Usage: $0 -i [string] -o [string]') - .demandOption(['i', 'o']) - .command('$0', '', (y) => { - y.option('output-dir', { - alias: 'o', - type: 'string', - description: 'Output dir', - }) - .option('input-file', { - alias: 'i', - type: 'string', - description: 'OpenAPI schema input file', - }) - .option('tags', { - alias: 't', - type: 'array', - description: 'tags', - coerce(arg: string[] | string): string[] { - return Array.isArray(arg) ? arg : [arg]; - }, - }); - }) - .help().argv; + .usage("Usage: $0 -i [string] -o [string]") + .demandOption(["i", "o"]) + .command("$0", "", (y) => { + y.option("output-dir", { + alias: "o", + type: "string", + description: "Output dir", + }) + .option("input-file", { + alias: "i", + type: "string", + description: "OpenAPI schema input file", + }) + .option("tags", { + alias: "t", + type: "array", + description: "tags", + coerce(arg: string[] | string): string[] { + return Array.isArray(arg) ? arg : [arg]; + }, + }); + }) + .help().argv; await build( - join(process.cwd(), String(cliArgs.i)), - join(process.cwd(), String(cliArgs.o)), - cliArgs['t'] as Array, + join(process.cwd(), String(cliArgs.i)), + join(process.cwd(), String(cliArgs.o)), + cliArgs.t as Array, ); diff --git a/lib/build.ts b/lib/build.ts index 2cbadfb..76b7865 100644 --- a/lib/build.ts +++ b/lib/build.ts @@ -1,19 +1,17 @@ -import { writeFile } from 'node:fs/promises'; -import prettierConfig from '@block65/eslint-config/prettier'; -import type { oas31 } from 'openapi3-ts'; -import { format as prettier } from 'prettier'; -import { processOpenApiDocument } from './process-document.js'; +import { writeFile } from "node:fs/promises"; +import type { oas31 } from "openapi3-ts"; +import { processOpenApiDocument } from "./process-document.ts"; export async function build( - inputFile: string, - outputDir: string, - tags?: string[], + inputFile: string, + outputDir: string, + tags?: string[], ) { - const apischema = (await import(inputFile, { - with: { type: 'json' }, - })) as { default: oas31.OpenAPIObject }; + const apischema = (await import(inputFile, { + with: { type: "json" }, + })) as { default: oas31.OpenAPIObject }; - const banner = ` + const banner = ` /** * This file was auto generated by @block65/openapi-codegen * @@ -23,27 +21,31 @@ export async function build( * */`.trim(); - const { commandsFile, typesFile, mainFile } = await processOpenApiDocument( - outputDir, - apischema.default, - tags, - ); - - const files = [commandsFile, typesFile, mainFile]; - - commandsFile.insertStatements(0, '/** eslint-disable max-classes */'); - - // eslint-disable-next-line no-restricted-syntax - for await (const file of files) { - file.insertStatements(0, banner); - file.formatText(); - - await file.save(); - - const data = await prettier(file.getFullText(), { - parser: 'typescript', - ...prettierConfig, - }); - await writeFile(file.getFilePath(), data); - } + const { commandsFile, typesFile, mainFile, valibotFile, honoValibotFile } = + await processOpenApiDocument(outputDir, apischema.default, tags); + + const files = [ + commandsFile, + typesFile, + mainFile, + valibotFile, + honoValibotFile, + ]; + + commandsFile.insertStatements(0, "/** eslint-disable max-classes */"); + + // eslint-disable-next-line no-restricted-syntax + for await (const file of files) { + try { + file.insertStatements(0, banner); + file.formatText(); + + await file.save(); + + await writeFile(file.getFilePath(), file.getFullText()); + } catch (err) { + console.warn(err); + await writeFile(file.getFilePath(), file.getFullText()); + } + } } diff --git a/lib/hono-valibot.ts b/lib/hono-valibot.ts new file mode 100644 index 0000000..3ee68cf --- /dev/null +++ b/lib/hono-valibot.ts @@ -0,0 +1,90 @@ +import { join } from "node:path"; +import type { Project, SourceFile } from "ts-morph"; +import { VariableDeclarationKind } from "ts-morph"; + +export function createHonoValibotFile( + project: Project, + outputDir: string, +): SourceFile { + const file = project.createSourceFile( + join(outputDir, "hono-valibot.ts"), + "", + { overwrite: true }, + ); + + file.addImportDeclaration({ + moduleSpecifier: "hono/validator", + namedImports: ["validator"], + }); + + file.addImportDeclaration({ + moduleSpecifier: "valibot", + namespaceImport: "v", + }); + + file.addImportDeclaration({ + moduleSpecifier: "@block65/rest-client", + namedImports: ["PublicValibotHonoError"], + }); + + file.addFunction({ + name: "toPublicValibotHonoError", + parameters: [{ name: "err", type: "unknown" }], + returnType: "never", + statements: ` + if (err instanceof v.ValiError) { + throw PublicValibotHonoError.from(err); + } + throw err; + `, + }); + + return file; +} + +export function createHonoValibotMiddleware( + honoValibotFile: SourceFile, + exportName: string, + schemas: { json?: string; param?: string; query?: string }, +): void { + honoValibotFile.addVariableStatement({ + isExported: true, + declarationKind: VariableDeclarationKind.Const, + declarations: [ + { + name: exportName, + initializer: (writer) => { + writer.write("["); + writer.indent(() => { + for (const [target, schemaName] of Object.entries(schemas)) { + writer.writeLine( + `validator(${JSON.stringify(target)}, (value) => {`, + ); + writer.indent(() => { + writer.writeLine( + `return v.parseAsync(${schemaName}, value).catch(toPublicValibotHonoError);`, + ); + }); + writer.writeLine("}),"); + } + }); + writer.write("] as const"); + }, + }, + ], + }); +} + +export function addValibotImportsToHonoValibotFile( + honoValibotFile: SourceFile, + schemaNames: string[], +): void { + if (schemaNames.length === 0) { + return; + } + + honoValibotFile.addImportDeclaration({ + moduleSpecifier: "./valibot.js", + namedImports: schemaNames.sort(), + }); +} diff --git a/lib/process-document.ts b/lib/process-document.ts index 7421fc0..9a96a08 100644 --- a/lib/process-document.ts +++ b/lib/process-document.ts @@ -1,776 +1,1052 @@ /* eslint-disable no-restricted-syntax */ -import { join, relative } from 'node:path'; -import { $RefParser } from '@apidevtools/json-schema-ref-parser'; -import type { oas30, oas31 } from 'openapi3-ts'; -import toposort from 'toposort'; + +import { join, relative } from "node:path"; +import { $RefParser } from "@apidevtools/json-schema-ref-parser"; +import type { oas30, oas31 } from "openapi3-ts"; +import toposort from "toposort"; +import { + type InterfaceDeclaration, + type JSDocStructure, + Node, + type OptionalKind, + Project, + Scope, + StructureKind, + SyntaxKind, + type TypeAliasDeclaration, + VariableDeclarationKind, + Writers, +} from "ts-morph"; +import type { Simplify } from "type-fest"; +import { + addValibotImportsToHonoValibotFile, + createHonoValibotFile, + createHonoValibotMiddleware, +} from "./hono-valibot.ts"; +import { registerTypesFromSchema, schemaToType } from "./process-schema.ts"; import { - InterfaceDeclaration, - Node, - Project, - Scope, - StructureKind, - SyntaxKind, - TypeAliasDeclaration, - VariableDeclarationKind, - Writers, -} from 'ts-morph'; -import type { Simplify } from 'type-fest'; -import { registerTypesFromSchema, schemaToType } from './process-schema.js'; + castToValidJsIdentifier, + getDependents, + iife, + pascalCase, + wordWrap, +} from "./utils.ts"; import { - castToValidJsIdentifier, - getDependents, - iife, - pascalCase, - wordWrap, -} from './utils.js'; - -const neverKeyword = 'never' as const; + createValibotFile, + createValidatorForOperationInput, + registerValidatorFromSchema, +} from "./valibot.ts"; + +interface OperationMiddlewareInfo { + exportName: string; + schemas: { json?: string; param?: string; query?: string }; +} + +const neverKeyword = "never" as const; // function isNeverKeyword(type: TypeAliasDeclaration) { // return type?.getTypeNode()?.getKindName() === neverKeyword; // } -const unspecifiedKeyword = 'unknown' as const; +const unspecifiedKeyword = "unknown" as const; function isUnspecifiedKeyword(type: TypeAliasDeclaration) { - return type?.getTypeNode()?.getKindName() === unspecifiedKeyword; + return type?.getTypeNode()?.getKindName() === unspecifiedKeyword; } -const emptyKeyword = 'undefined' as const; +const emptyKeyword = "undefined" as const; // function isEmptyKeyword(type: TypeAliasDeclaration) { // return type?.getTypeNode()?.getKindName() === emptyKeyword; // } // the union/intersect helpers keep typescript happy due to ts-morph typings function createIntersection(...types: (string | undefined)[]) { - // create a type of all the inputs - const [type1, type2, ...typeX] = types.filter((t): t is string => !!t); - return ( - (type1 && type2 - ? Writers.intersectionType(type1, type2, ...typeX) - : type1) || neverKeyword - ); + // create a type of all the inputs + const [type1, type2, ...typeX] = types.filter((t): t is string => !!t); + return ( + (type1 && type2 + ? Writers.intersectionType(type1, type2, ...typeX) + : type1) || neverKeyword + ); } // the union/intersect helpers keep typescript happy due to ts-morph typings function createUnion(...types: (string | undefined)[]) { - // create a type of all the inputs - const [type1, type2, ...typeX] = types - .filter((t): t is string => !!t) - .sort((a, b) => a.localeCompare(b)); - return type1 && type2 ? Writers.unionType(type1, type2, ...typeX) : type1; + // create a type of all the inputs + const [type1, type2, ...typeX] = types + .filter((t): t is string => !!t) + .sort((a, b) => a.localeCompare(b)); + return ( + (type1 && type2 ? Writers.unionType(type1, type2, ...typeX) : type1) || + neverKeyword + ); } export async function processOpenApiDocument( - outputDir: string, - schema: Simplify, - tags?: string[] | undefined, + outputDir: string, + schema: Simplify, + tags?: string[] | undefined, ) { - const project = new Project(); - - const commandsFile = project.createSourceFile( - join(outputDir, 'commands.ts'), - '', - { - overwrite: true, - }, - ); - - const typesFile = project.createSourceFile( - join(outputDir, 'types.ts'), - '', - - { - overwrite: true, - }, - ); - - const mainFile = project.createSourceFile(join(outputDir, 'main.ts'), '', { - overwrite: true, - }); - - const outputTypes = new Set< - | InterfaceDeclaration - | TypeAliasDeclaration - | typeof unspecifiedKeyword - | string - >(); - - const refs = await $RefParser.resolve(schema); - - commandsFile.addImportDeclaration({ - namedImports: [ - // command classes - 'Command', - ], - moduleSpecifier: '@block65/rest-client', - }); - - commandsFile.addImportDeclaration({ - namedImports: ['Jsonifiable'], - moduleSpecifier: 'type-fest', - isTypeOnly: true, - }); - - typesFile.addImportDeclaration({ - namedImports: ['Jsonifiable', 'Jsonify'], - moduleSpecifier: 'type-fest', - isTypeOnly: true, - }); - - typesFile.addImportDeclaration({ - namedImports: ['JsonifiableObject'], - moduleSpecifier: 'type-fest/source/jsonifiable.js', - isTypeOnly: true, - }); - - const typesModuleSpecifier = - `./${typesFile.getBaseNameWithoutExtension()}.js` || - relative(commandsFile.getDirectoryPath(), typesFile.getFilePath()); - - const typesImportDecl = - commandsFile - .getImportDeclaration( - (decl) => - decl.getModuleSpecifier().getLiteralValue() === typesModuleSpecifier, - ) - ?.setIsTypeOnly(true) || - commandsFile.addImportDeclaration({ - moduleSpecifier: typesModuleSpecifier, - namedImports: [], - }); - - const ensureImport = ( - type: TypeAliasDeclaration | InterfaceDeclaration | undefined, - alias?: string, - ) => { - if ( - type && - !typesImportDecl - .getNamedImports() - .some((namedImport) => namedImport.getName() === type.getName()) - ) { - typesImportDecl?.addNamedImport({ - name: type.getName(), - ...(alias && { alias }), - }); - typesImportDecl.setIsTypeOnly(true); - } - }; - - const typesAndInterfaces = new Map< - string, - InterfaceDeclaration | TypeAliasDeclaration - >(); - - const schemaGraph = Object.entries(schema.components?.schemas || {}).flatMap( - ([schemaName, schemaObject]) => { - const deps = getDependents(schemaObject); - return deps.map((dep): [string, string] => [ - `#/components/schemas/${schemaName}`, - dep, - ]); - }, - ); - - const sorted = toposort(schemaGraph).reverse(); - - const sortedSchemas = Object.entries(schema.components?.schemas || {}).sort( - ([a], [b]) => - sorted.findIndex( - (schemaName) => schemaName === `#/components/schemas/${a}`, - ) - - sorted.findIndex( - (schemaName) => schemaName === `#/components/schemas/${b}`, - ), - ); - - for (const [schemaName, schemaObject] of sortedSchemas) { - registerTypesFromSchema( - typesAndInterfaces, - typesFile, - schemaName, - schemaObject, - ); - } - - for (const [path, pathItemObject] of Object.entries( - schema.paths || {}, - )) { - if (pathItemObject) { - for (const [method, operationObject] of Object.entries(pathItemObject) - // ensure op is an object - .filter( - (e): e is [string, oas31.OperationObject] => typeof e[1] === 'object', - ) - // tags - .filter(([, o]) => !tags || o.tags?.some((t) => tags?.includes(t)))) { - if ( - typeof operationObject === 'object' && - 'operationId' in operationObject - ) { - const pathParameters: oas30.ParameterObject[] = []; - - const commandName = pascalCase( - operationObject.operationId.replace(/command$/i, ''), - 'Command', - ); - - const commandClassDeclaration = commandsFile.addClass({ - name: commandName, - isExported: true, - extends: 'Command', - properties: [ - { - name: 'method', - initializer: Writers.assertion((w) => w.quote(method), 'const'), - hasOverrideKeyword: true, - scope: Scope.Public, - }, - ], - }); - - const jsDocStructure = { - description: `\n${wordWrap( - operationObject.description || commandName, - )}\n`, - - tags: [ - ...(operationObject.summary - ? [ - { - tagName: 'summary', - text: wordWrap(operationObject.summary), - }, - ] - : []), - ], - }; - - const jsdoc = commandClassDeclaration.addJsDoc(jsDocStructure); - - if (operationObject.deprecated) { - jsdoc.addTag({ - tagName: 'deprecated', - }); - } - - const requestBodyObject = - operationObject.requestBody && - !('$ref' in operationObject.requestBody) - ? operationObject.requestBody - : undefined; - - const queryParameters: oas30.ParameterObject[] = []; - - for (const parameter of [ - ...(operationObject.parameters || []), - ...(pathItemObject.parameters || []), - ]) { - const resolvedParameter: oas30.ParameterObject = - '$ref' in parameter ? refs.get(parameter.$ref) : parameter; - - if (resolvedParameter.in === 'path') { - pathParameters.push(resolvedParameter); - - // jsdoc.addTag({ - // tagName: 'param', - // text: wordWrap( - // `${parameterName} {String} ${ - // resolvedParameter.description || '' - // }`, - // ).trim(), - // }); - } - - if (resolvedParameter.in === 'query') { - queryParameters.push(resolvedParameter); - } - } - - const queryType = - queryParameters.length > 0 - ? typesFile.addTypeAlias({ - name: pascalCase( - commandClassDeclaration.getName() || 'INVALID', - 'Query', - ), - isExported: true, - type: Writers.objectType({ - properties: queryParameters.map((qp) => { - const name = castToValidJsIdentifier(qp.name); - - if (!qp.schema) { - return { - name, - hasQuestionToken: !qp.required, - }; - } - - const type = schemaToType( - typesAndInterfaces, - qp.required - ? { - required: [name], - } - : {}, - name, - qp.schema, - { - // query parameters can't be strictly "boolean" - booleanAsStringish: true, - integerAsStringish: true, - }, - ); - - if (qp.required) { - return type; - } - - return { - // ...type, - name, - // query parameters need to allow undefined due to the - // rest client spreading all of the parameters - hasQuestionToken: true, - type: - // I dont know how to do nested writer functions - typeof type.type === 'function' - ? type.type - : Writers.unionType(`${type.type}`, 'undefined'), - }; - }), - }), - }) - : undefined; - - ensureImport(queryType); - - const requestBodyObjectJson = - requestBodyObject?.content['application/json']; - - const requestBodyIsArray = - requestBodyObjectJson?.schema && - 'type' in requestBodyObjectJson.schema && - requestBodyObjectJson.schema?.type === 'array'; - - // get the ref from the schema or the array items - const requestBodyObjectJsonSchema = - (requestBodyObjectJson?.schema && - (('$ref' in requestBodyObjectJson.schema && - requestBodyObjectJson?.schema) || - (requestBodyIsArray && - 'items' in requestBodyObjectJson.schema && - '$ref' in requestBodyObjectJson.schema.items && - requestBodyObjectJson.schema.items))) || - undefined; - - const bodyType = - requestBodyObjectJsonSchema && - typesAndInterfaces.get(requestBodyObjectJsonSchema.$ref); - - // ensureImport(bodyType); - - // const paramsParamName = 'parameters'; - // if (bodyType) { - // jsdoc.addTag({ - // tagName: 'param', - // text: wordWrap( - // `${paramsParamName}.body {${bodyType.getName()}} ${maybeJsDocDescription()}`, - // ).trim(), - // }); - // } - - const paramsType = - pathParameters.length > 0 - ? typesFile.addTypeAlias({ - name: pascalCase( - `${commandClassDeclaration.getName() || 'INVALID'}Params`, - ), - type: Writers.objectType({ - properties: pathParameters.map((p) => { - const name = castToValidJsIdentifier(p.name); - - const type = schemaToType( - typesAndInterfaces, - p.required - ? { - required: [name], - } - : {}, - name, - p.schema || { - type: 'string', - description: - '// TODO: check this? no path param schema was found', - }, - { - // parameters can't be strictly "boolean" - booleanAsStringish: true, - integerAsStringish: true, - }, - ); - - return { - name, - type: type.type || unspecifiedKeyword, - }; - }), - }), - isExported: true, - }) - : null; - - const inputType = typesFile.addTypeAlias({ - name: pascalCase(commandClassDeclaration.getName() || '', 'Input'), - type: createIntersection( - bodyType?.getName(), - paramsType?.getName(), - queryType?.getName(), - ), - isExported: true, - }); - ensureImport(inputType); - - const inputBodyType = - bodyType && - typesFile.addTypeAlias({ - name: pascalCase(commandClassDeclaration.getName() || '', 'Body'), - type: bodyType.getName() || unspecifiedKeyword, - isExported: true, - }); - - if (inputBodyType) { - ensureImport(inputBodyType); - } - - // CommandInput - commandClassDeclaration - .getExtends() - ?.addTypeArgument(inputType?.getName() || unspecifiedKeyword); - - // if (queryType && !isVoidKeyword(queryType)) { - // ctor.addParameter({ - // name: 'query', - // type: queryType.getName(), - // }); - // } - - // for (const queryParam of queryParameters) { - // const queryParameterName = camelcase(queryParam.name); - - // jsdoc.addTag({ - // tagName: 'param', - // text: wordWrap( - // `${paramsParamName}.query.${queryParameterName}${ - // queryParam.required ? '' : '?' - // } {String} ${maybeJsDocDescription( - // queryParam.deprecated && 'DEPRECATED', - // queryParam.description, - // String(queryParam.example || ''), - // )}`, - // ).trim(), - // }); - // } - - // this is just like a 204 response. - if ( - !operationObject.responses || - Object.keys(operationObject.responses).length === 0 - ) { - commandClassDeclaration - .getExtends() - ?.addTypeArgument(unspecifiedKeyword); - } - - for (const [statusCode, response] of Object.entries( - operationObject.responses || {}, - ).filter(([s]) => s.startsWith('2'))) { - // early out if response is 204 - if (statusCode === '204') { - commandClassDeclaration - .getExtends() - ?.addTypeArgument(emptyKeyword); - - outputTypes.add(emptyKeyword); - break; - } - - // we dont support refs as response objects - if ('$ref' in response) { - break; - } - - const jsonResponse = response.content?.['application/json']; - - const arrayRef = - jsonResponse?.schema && - 'items' in jsonResponse.schema && - '$ref' in jsonResponse.schema.items && - jsonResponse.schema.items.$ref; - - const regularRef = - jsonResponse?.schema && - '$ref' in jsonResponse.schema && - jsonResponse.schema.$ref; - - const outputRef = arrayRef || regularRef; - - if (outputRef) { - const outputType = typesAndInterfaces.get(outputRef); - - if (outputType) { - outputTypes.add(outputType); - ensureImport(outputType); - } - - const outputTypeName = `${outputType?.getName()}${ - arrayRef ? '[]' : '' - }`; - - if (arrayRef) { - outputTypes.add(outputTypeName); - } - - commandClassDeclaration - .getExtends() - ?.addTypeArgument(`${outputTypeName}`); - - // jsdoc.addTag({ - // tagName: 'returns', - // text: `{${retVal}} HTTP ${statusCode}`, - // }); - } else { - const retVal = unspecifiedKeyword; - commandClassDeclaration.getExtends()?.addTypeArgument(retVal); - outputTypes.add(retVal); - - // jsdoc.addTag({ - // tagName: 'returns', - // text: `{${retVal}} HTTP ${statusCode}`, - // }); - } - } - - // body - commandClassDeclaration - .getExtends() - ?.addTypeArgument( - inputBodyType ? inputBodyType.getName() : neverKeyword, - ); - - // query - if (queryType) { - commandClassDeclaration - .getExtends() - ?.addTypeArgument(queryType.getName()); - } - - const pathname = `\`${path - // .replaceAll(/\{(\w+)\}/g, camelcase) - .replaceAll(/{/g, '${')}\``; - - const bodyName = 'body'; - - const hasBody = !!inputBodyType; - const hasQuery = - queryType && - !isUnspecifiedKeyword(queryType) && - queryParameters.length > 0; - - const hasParams = - paramsType && - !isUnspecifiedKeyword(paramsType) && - pathParameters.length > 0; - - if (hasBody || hasQuery || hasParams) { - const ctor = commandClassDeclaration.addConstructor(); - - const queryParameterNames = queryParameters - .map((q) => q.name) - .map(castToValidJsIdentifier); - - const pathParameterNames = pathParameters - .map((q) => q.name) - .map(castToValidJsIdentifier); - - const paramsToDestructure = [ - ...pathParameterNames, - ...queryParameterNames, - ]; - - if (!isUnspecifiedKeyword(inputType)) { - const cctorParam = ctor.addParameter({ - name: 'input', - type: inputType.getName(), - }); - - ctor.addStatements([ - { - kind: StructureKind.VariableStatement, - declarationKind: VariableDeclarationKind.Const, - declarations: [ - { - kind: StructureKind.VariableDeclaration, - initializer: cctorParam.getName(), - name: iife(() => { - switch (true) { - case paramsToDestructure.length > 0 && hasBody: - return `{${[ - ...paramsToDestructure, - `...${bodyName}`, - ].join(', ')} }`; - case paramsToDestructure.length > 0 && !hasBody: - return `{${paramsToDestructure.join(', ')} }`; - case hasBody: - return bodyName; - default: - return '_'; - } - }), - }, - ], - }, - 'super();', - ]); - } - - const superKeyword = ctor.getFirstDescendantByKind( - SyntaxKind.SuperKeyword, - ); - - const callExpr = superKeyword?.getParentIfKindOrThrow( - SyntaxKind.CallExpression, - ); - - // type narrowing - if (Node.isCallExpression(callExpr)) { - callExpr.addArguments( - hasBody || hasQuery - ? [ - pathname, - hasBody ? bodyName : emptyKeyword, - ...(hasQuery - ? [`{${queryParameterNames.join(', ')}}`] - : []), - ] - : [pathname], - ); - } - } - } - } - } - } - - const isInput = (t: TypeAliasDeclaration | InterfaceDeclaration) => - t.getName()?.endsWith('Input'); - // const isOutput = (t: string) => t.endsWith('Output'); - - const inputTypes = typesFile.getTypeAliases().filter((t) => isInput(t)); - const inputUnion = createUnion( - ...new Set(inputTypes.sort().map((t) => t.getName())), - ); - const outputUnion = createUnion( - ...[...outputTypes].map((t) => (typeof t === 'string' ? t : t.getName())), - ); - - const allInputs = inputUnion - ? mainFile.addTypeAlias({ - name: 'AllInputs', - type: inputUnion, - }) - : undefined; - - const allOutputs = outputUnion - ? mainFile.addTypeAlias({ - name: 'AllOutputs', - type: outputUnion, - }) - : undefined; - - const serviceClientClassName = 'RestServiceClient'; - const fetcherName = 'createIsomorphicNativeFetcher'; - const configType = 'RestServiceClientConfig'; - - mainFile.addImportDeclaration({ - moduleSpecifier: '@block65/rest-client', - namedImports: [ - serviceClientClassName, - fetcherName, - { - name: configType, - isTypeOnly: true, - }, - ], - }); - - const namedImports = [...new Set([...inputTypes, ...outputTypes])].filter( - (t: T | string | typeof unspecifiedKeyword): t is T => - typeof t !== 'string', - ); - - if (namedImports.length > 0) { - mainFile.addImportDeclaration({ - moduleSpecifier: typesModuleSpecifier, - namedImports: namedImports - .sort((a, b) => a.getName().localeCompare(b.getName())) - .map((t) => ({ - name: t.getName(), - })), - isTypeOnly: true, - }); - } - - const clientClassDeclaration = mainFile.addClass({ - name: pascalCase(schema.info.title, 'RestClient'), - isExported: true, - extends: `${serviceClientClassName}<${allInputs?.getName() || unspecifiedKeyword}, ${ - allOutputs?.getName() || unspecifiedKeyword - }>`, - }); - - const ctor = clientClassDeclaration.addConstructor(); - - const baseUrl = ctor.addParameter({ - name: 'baseUrl', - type: Writers.unionType('string', 'URL'), - initializer: `new URL('${new URL( - `${schema.servers?.[0]?.url || 'https://api.example.com'}/`, - )}')`, - }); - - // const fetcherParam = ctor.addParameter({ - // name: 'fetcher', - // // type: fetcherMethodType, - // initializer: `${fetcherName}()`, - // }); - - const configParam = ctor.addParameter({ - name: 'config', - type: configType, - hasQuestionToken: true, - }); - - ctor.addStatements(['super();']); - - const superKeyword = ctor.getFirstDescendantByKind(SyntaxKind.SuperKeyword); - const callExpr = superKeyword?.getParentIfKindOrThrow( - SyntaxKind.CallExpression, - ); - - // type narrowing - if (Node.isCallExpression(callExpr)) { - callExpr?.addArguments([ - baseUrl.getName(), - // fetcherParam.getName(), - configParam.getName(), - ]); - } - - mainFile.organizeImports(); - - // tidies up any unused type-fest imports - typesFile.fixUnusedIdentifiers(); - commandsFile.fixUnusedIdentifiers(); - - return { commandsFile, typesFile, mainFile }; + const project = new Project(); + + const commandsFile = project.createSourceFile( + join(outputDir, "commands.ts"), + "", + { + overwrite: true, + }, + ); + + const typesFile = project.createSourceFile( + join(outputDir, "types.ts"), + "", + + { + overwrite: true, + }, + ); + + const mainFile = project.createSourceFile(join(outputDir, "main.ts"), "", { + overwrite: true, + }); + + // Validators file for Valibot schemas + const valibotFile = createValibotFile(project, outputDir); + + // Track registered validators by their $ref path + const validators = new Map(); + + // Track all operations for middleware generation + const allOperations: OperationMiddlewareInfo[] = []; + + const outputTypes = new Set< + | InterfaceDeclaration + | TypeAliasDeclaration + | typeof unspecifiedKeyword + | string + >(); + + const refs = await $RefParser.resolve(schema); + + commandsFile.addImportDeclaration({ + namedImports: [ + // command classes + "Command", + "stripUndefined", + "jsonStringify", + ], + moduleSpecifier: "@block65/rest-client", + }); + + commandsFile.addImportDeclaration({ + namedImports: ["Jsonifiable"], + moduleSpecifier: "type-fest", + isTypeOnly: true, + }); + + typesFile.addImportDeclaration({ + namedImports: ["Jsonifiable", "Jsonify"], + moduleSpecifier: "type-fest", + isTypeOnly: true, + }); + + const typesModuleSpecifier = + `./${typesFile.getBaseNameWithoutExtension()}.js` || + relative(commandsFile.getDirectoryPath(), typesFile.getFilePath()); + + const typesImportDecl = + commandsFile + .getImportDeclaration( + (decl) => + decl.getModuleSpecifier().getLiteralValue() === typesModuleSpecifier, + ) + ?.setIsTypeOnly(true) || + commandsFile.addImportDeclaration({ + moduleSpecifier: typesModuleSpecifier, + namedImports: [], + }); + + const ensureImport = ( + type: TypeAliasDeclaration | InterfaceDeclaration | undefined, + alias?: string, + ) => { + if ( + type && + !typesImportDecl + .getNamedImports() + .some((namedImport) => namedImport.getName() === type.getName()) + ) { + typesImportDecl?.addNamedImport({ + name: type.getName(), + ...(alias && { alias }), + }); + typesImportDecl.setIsTypeOnly(true); + } + }; + + const typesAndInterfaces = new Map< + string, + InterfaceDeclaration | TypeAliasDeclaration + >(); + + const schemaGraph = Object.entries(schema.components?.schemas || {}).flatMap( + ([schemaName, schemaObject]) => { + const deps = getDependents(schemaObject); + return deps.map((dep): [string, string] => [ + `#/components/schemas/${schemaName}`, + dep, + ]); + }, + ); + + const sorted = toposort(schemaGraph).reverse(); + + const sortedSchemas = Object.entries(schema.components?.schemas || {}).sort( + ([a], [b]) => + sorted.indexOf(`#/components/schemas/${a}`) - + sorted.indexOf(`#/components/schemas/${b}`), + ); + + for (const [schemaName, schemaObject] of sortedSchemas) { + registerTypesFromSchema( + typesAndInterfaces, + typesFile, + schemaName, + schemaObject, + ); + + registerValidatorFromSchema( + validators, + valibotFile, + schemaName, + schemaObject, + ); + } + + for (const [path, pathItemObject] of Object.entries( + schema.paths || {}, + )) { + if (pathItemObject) { + for (const [method, operationObject] of Object.entries(pathItemObject) + // ensure op is an object + .filter( + (e): e is [string, oas31.OperationObject] => typeof e[1] === "object", + ) + // tags + .filter(([, o]) => !tags || o.tags?.some((t) => tags?.includes(t)))) { + if ( + typeof operationObject === "object" && + "operationId" in operationObject + ) { + const isOperationDeprecated = operationObject.deprecated === true; + const deprecationDocs: (OptionalKind | string)[] = + isOperationDeprecated + ? [ + { + kind: StructureKind.JSDoc, + tags: [ + { + tagName: "deprecated", + }, + ], + }, + ] + : []; + + const pathParameters: oas30.ParameterObject[] = []; + + const commandName = pascalCase( + operationObject.operationId.replace(/command$/i, ""), + "Command", + ); + + const commandClassDeclaration = commandsFile.addClass({ + name: commandName, + isExported: true, + extends: "Command", + docs: [...deprecationDocs], + properties: [ + { + name: "method", + initializer: Writers.assertion((w) => w.quote(method), "const"), + hasOverrideKeyword: true, + scope: Scope.Public, + }, + ], + }); + + const jsDocStructure = { + description: `\n${wordWrap( + operationObject.description || commandName, + )}\n`, + + tags: [ + ...(operationObject.summary + ? [ + { + tagName: "summary", + text: wordWrap(operationObject.summary), + }, + ] + : []), + ], + }; + + const jsdoc = commandClassDeclaration.addJsDoc(jsDocStructure); + + if (isOperationDeprecated) { + jsdoc.addTag({ + tagName: "deprecated", + }); + } + + const requestBodyObject = + operationObject.requestBody && + !("$ref" in operationObject.requestBody) + ? operationObject.requestBody + : undefined; + + const queryParameters: oas30.ParameterObject[] = []; + + for (const parameter of [ + ...(operationObject.parameters || []), + ...(pathItemObject.parameters || []), + ]) { + const resolvedParameter = + ("$ref" in parameter + ? refs.get(parameter.$ref) + : parameter) as oas30.ParameterObject; + + if (resolvedParameter.in === "path") { + pathParameters.push(resolvedParameter); + + // jsdoc.addTag({ + // tagName: 'param', + // text: wordWrap( + // `${parameterName} {String} ${ + // resolvedParameter.description || '' + // }`, + // ).trim(), + // }); + } + + if (resolvedParameter.in === "query") { + queryParameters.push(resolvedParameter); + } + } + + // Extract path parameters from URL pattern that weren't declared this + // is technically against the spec but we are the good guys + for (const [, paramName] of path.matchAll(/\{(\w+)\}/g)) { + const alreadyDeclared = pathParameters.some( + (p) => p.name === paramName, + ); + if (!alreadyDeclared && paramName) { + pathParameters.push({ + name: paramName, + in: "path", + required: true, + schema: { type: "string" }, + }); + } + } + + const queryType = + queryParameters.length > 0 + ? typesFile.addTypeAlias({ + name: pascalCase( + commandClassDeclaration.getName() || "INVALID", + "Query", + ), + docs: deprecationDocs, + isExported: true, + type: Writers.objectType({ + properties: queryParameters.map((qp) => { + const name = castToValidJsIdentifier(qp.name); + + if (!qp.schema) { + return { + name, + hasQuestionToken: !qp.required, + }; + } + + const type = schemaToType( + typesAndInterfaces, + qp.required + ? { + required: [name], + } + : {}, + name, + qp.schema, + { + // query parameters can't be strictly "boolean" + booleanAsStringish: true, + integerAsStringish: true, + }, + ); + + const resolvedType = qp.required + ? type.type + : typeof type.type === "function" + ? type.type + : type.type + ? Writers.unionType(`${type.type}`, "undefined") + : undefined; + + return { + ...type, + name, + hasQuestionToken: !qp.required, + ...(resolvedType !== undefined && { type: resolvedType }), + }; + }), + }), + }) + : undefined; + + ensureImport(queryType); + + const jsonRequestBodyObject = + requestBodyObject?.content["application/json"]; + + const jsonBodyType = iife(() => { + if (!jsonRequestBodyObject?.schema) { + return undefined; + } + + if ("$ref" in jsonRequestBodyObject.schema) { + return typesAndInterfaces.get(jsonRequestBodyObject.schema.$ref); + } + + if ( + jsonRequestBodyObject.schema.type === "array" && + "items" in jsonRequestBodyObject.schema && + "$ref" in jsonRequestBodyObject.schema.items + ) { + return typesAndInterfaces.get( + jsonRequestBodyObject.schema.items.$ref, + ); + } + + // named as such because we only support the json request body atm + const name = castToValidJsIdentifier( + `${operationObject.operationId} JsonBody`, + ); + + // if (!requestBodySchema) { + // return { + // name, + // hasQuestionToken: !requestBodyObjectJson.schema.required, + // }; + // } + + const type = schemaToType( + typesAndInterfaces, + jsonRequestBodyObject.schema.required + ? { + required: [name], + } + : {}, + name, + jsonRequestBodyObject.schema, + { + // query parameters can't be strictly "boolean" + booleanAsStringish: true, + integerAsStringish: true, + }, + ); + + return typesFile.addTypeAlias({ + name, + docs: deprecationDocs, + type: + // I dont know how to do nested writer functions + typeof type.type === "function" ? type.type : String(type.type), + }); + + // console.warn("Couldn't find a body type for", requestBodyObjectJson.schema); + + // return undefined; + }); + + const nonJsonBodyEntries = requestBodyObject?.content + ? Object.entries(requestBodyObject.content).filter( + ([, o]) => o !== jsonRequestBodyObject, + ) + : []; + + if (jsonBodyType && nonJsonBodyEntries.length > 0) { + console.warn( + commandClassDeclaration.getName(), + "Non-json and json body types are not supported together yet", + ); + } + + const nonJsonBodyPropName = "body"; + const inputBodyName = "body"; + + const nonJsonBodyType = + !jsonBodyType && nonJsonBodyEntries.length > 0 + ? typesFile.addTypeAlias({ + docs: deprecationDocs, + name: pascalCase( + `${commandClassDeclaration.getName() || "INVALID"} Body NonJson`, + ), + isExported: true, + type: Writers.objectType({ + properties: [ + { + name: nonJsonBodyPropName, + type: createUnion( + ...nonJsonBodyEntries.map( + ([contentType, _mediaTypeObj]) => { + const nonJsonBody = typesFile.addTypeAlias({ + name: pascalCase( + `${commandClassDeclaration.getName() || "INVALID"} Body ${contentType}`, + ), + type: "NonNullable", + }); + + // nonJsonBody.addJsDoc({ + // description: `The body of the request, encoded as ${contentType}`, + // tags: [ + // { + // tagName: 'param', + // text: wordWrap( + // `body {${nonJsonBody.getName()}} ${mediaTypeObj.schema?.description || '' + // }`, + // ).trim(), + // }, + // ], + // }); + + return nonJsonBody.getName(); + }, + ), + ), + }, + ], + }), + }) + : undefined; + + // ensureImport(bodyType); + + // const paramsParamName = 'parameters'; + // if (bodyType) { + // jsdoc.addTag({ + // tagName: 'param', + // text: wordWrap( + // `${paramsParamName}.body {${bodyType.getName()}} ${maybeJsDocDescription()}`, + // ).trim(), + // }); + // } + + const paramsType = + pathParameters.length > 0 + ? typesFile.addTypeAlias({ + name: pascalCase( + `${commandClassDeclaration.getName() || "INVALID"}Params`, + ), + docs: deprecationDocs, + type: Writers.objectType({ + properties: pathParameters.map((p) => { + const name = castToValidJsIdentifier(p.name); + + const type = schemaToType( + typesAndInterfaces, + p.required + ? { + required: [name], + } + : {}, + name, + p.schema || { + type: "string", + description: + "// TODO: check this? no path param schema was found", + }, + { + // parameters can't be strictly "boolean" + booleanAsStringish: true, + integerAsStringish: true, + }, + ); + + return { + ...type, + name, + type: type.type || unspecifiedKeyword, + }; + }), + }), + isExported: true, + }) + : null; + + const bodyType = + (jsonBodyType && + typesFile.addTypeAlias({ + name: pascalCase( + commandClassDeclaration.getName() || "", + "Body", + ), + type: jsonBodyType.getName(), + isExported: true, + })) || + nonJsonBodyType; + + if (bodyType) { + ensureImport(bodyType); + } + + const inputType = typesFile.addTypeAlias({ + name: pascalCase(commandClassDeclaration.getName() || "", "Input"), + type: createIntersection( + jsonBodyType?.getName() || nonJsonBodyType?.getName(), + paramsType?.getName(), + queryType?.getName(), + ), + isExported: true, + }); + ensureImport(inputType); + + // Hook: Generate Valibot validator for operation input + const operationSchemas = createValidatorForOperationInput( + validators, + valibotFile, + commandName, + { + ...(jsonRequestBodyObject?.schema && { + body: jsonRequestBodyObject?.schema, + }), + params: pathParameters, + query: queryParameters, + }, + ); + + // Track operation for middleware generation + const middlewareExportName = castToValidJsIdentifier( + operationObject.operationId.replace(/Command$/i, ""), + ); + allOperations.push({ + exportName: middlewareExportName, + schemas: operationSchemas, + }); + + // CommandInput + commandClassDeclaration + .getExtends() + ?.addTypeArgument(inputType?.getName() || unspecifiedKeyword); + + // if (queryType && !isVoidKeyword(queryType)) { + // ctor.addParameter({ + // name: 'query', + // type: queryType.getName(), + // }); + // } + + // for (const queryParam of queryParameters) { + // const queryParameterName = camelcase(queryParam.name); + + // jsdoc.addTag({ + // tagName: 'param', + // text: wordWrap( + // `${paramsParamName}.query.${queryParameterName}${ + // queryParam.required ? '' : '?' + // } {String} ${maybeJsDocDescription( + // queryParam.deprecated && 'DEPRECATED', + // queryParam.description, + // String(queryParam.example || ''), + // )}`, + // ).trim(), + // }); + // } + + // this is just like a 204 response. + if ( + !operationObject.responses || + Object.keys(operationObject.responses).length === 0 + ) { + commandClassDeclaration + .getExtends() + ?.addTypeArgument(unspecifiedKeyword); + } + + for (const [statusCode, response] of Object.entries({ + ...operationObject.responses, + }).filter(([s]) => s.startsWith("2"))) { + // early out if response is 204 + if (statusCode === "204") { + commandClassDeclaration + .getExtends() + ?.addTypeArgument(emptyKeyword); + + outputTypes.add(emptyKeyword); + break; + } + + // we dont support refs as response objects + if ("$ref" in response) { + break; + } + + const jsonResponse = response.content?.["application/json"]; + + const arrayRef = + jsonResponse?.schema && + "items" in jsonResponse.schema && + "$ref" in jsonResponse.schema.items && + jsonResponse.schema.items.$ref; + + const regularRef = + jsonResponse?.schema && + "$ref" in jsonResponse.schema && + jsonResponse.schema.$ref; + + const outputRef = arrayRef || regularRef; + + if (outputRef) { + const outputType = typesAndInterfaces.get(outputRef); + + if (outputType) { + outputTypes.add(outputType); + ensureImport(outputType); + } + + const outputTypeName = `${outputType?.getName()}${ + arrayRef ? "[]" : "" + }`; + + if (arrayRef) { + outputTypes.add(outputTypeName); + } + + commandClassDeclaration + .getExtends() + ?.addTypeArgument(`${outputTypeName}`); + + // jsdoc.addTag({ + // tagName: 'returns', + // text: `{${retVal}} HTTP ${statusCode}`, + // }); + } else if (jsonResponse?.schema) { + const outputType = schemaToType( + typesAndInterfaces, + {}, + "", + jsonResponse.schema, + ); + + const responseTypeAlias = typesFile.addTypeAlias({ + name: pascalCase( + commandClassDeclaration.getName() || "INVALID", + "Output", + ), + type: + // I dont know how to do nested writer functions + typeof outputType.type === "function" + ? outputType.type + : Writers.unionType(`${outputType.type}`, "undefined"), + isExported: true, + }); + + ensureImport(responseTypeAlias); + + commandClassDeclaration + .getExtends() + ?.addTypeArgument(responseTypeAlias.getName()); + outputTypes.add(responseTypeAlias); + + // jsdoc.addTag({ + // tagName: 'returns', + // text: `{${retVal}} HTTP ${statusCode}`, + // }); + } else { + const retVal = unspecifiedKeyword; + + commandClassDeclaration.getExtends()?.addTypeArgument(retVal); + outputTypes.add(retVal); + } + } + + // body + // commandClassDeclaration + // .getExtends() + // ?.addTypeArgument( + // bodyType ? bodyType.getName() : + + // neverKeyword, + // ); + + // query + if (queryType) { + commandClassDeclaration + .getExtends() + ?.addTypeArgument(queryType.getName()); + } + + const pathname = `\`${path + // .replaceAll(/\{(\w+)\}/g, camelcase) + .replaceAll(/{/g, "${")}\``; + + const hasJsonBody = !!jsonBodyType; + + const hasNonJsonBody = !!nonJsonBodyType; + + const hasQuery = + queryType && + !isUnspecifiedKeyword(queryType) && + queryParameters.length > 0; + + const hasParams = + paramsType && + !isUnspecifiedKeyword(paramsType) && + pathParameters.length > 0; + + if (hasNonJsonBody || hasJsonBody || hasQuery || hasParams) { + const ctor = commandClassDeclaration.addConstructor(); + + const queryParameterNames = queryParameters + .map((q) => q.name) + .map(castToValidJsIdentifier); + + const pathParameterNames = pathParameters + .map((q) => q.name) + .map(castToValidJsIdentifier); + + const paramsToDestructure = [ + ...pathParameterNames, + ...queryParameterNames, + ]; + + if (!isUnspecifiedKeyword(inputType)) { + const cctorParam = ctor.addParameter({ + name: "input", + type: inputType.getName(), + }); + + ctor.addStatements([ + { + kind: StructureKind.VariableStatement, + declarationKind: VariableDeclarationKind.Const, + declarations: [ + { + kind: StructureKind.VariableDeclaration, + initializer: cctorParam.getName(), + name: iife(() => { + switch (true) { + case paramsToDestructure.length > 0 && hasNonJsonBody: + return `{${[ + ...paramsToDestructure, + nonJsonBodyPropName, + ].join(", ")} }`; + case paramsToDestructure.length > 0 && hasJsonBody: + return `{${[ + ...paramsToDestructure, + `...${inputBodyName}`, + ].join(", ")} }`; + case paramsToDestructure.length > 0 && !hasJsonBody: + return `{${paramsToDestructure.join(", ")} }`; + case hasNonJsonBody: + return `{${nonJsonBodyPropName}}`; + case hasJsonBody: + return inputBodyName; + default: + return "_"; + } + }), + }, + ], + }, + "super();", + ]); + } + + const superKeyword = ctor.getFirstDescendantByKind( + SyntaxKind.SuperKeyword, + ); + + const callExpr = superKeyword?.getParentIfKindOrThrow( + SyntaxKind.CallExpression, + ); + + // type narrowing + if (Node.isCallExpression(callExpr)) { + if (hasJsonBody) { + callExpr.addArguments([ + pathname, + `jsonStringify(${inputBodyName})`, + ...(hasQuery + ? [`stripUndefined({${queryParameterNames.join(", ")}})`] + : []), + ]); + } else if (hasNonJsonBody) { + callExpr.addArguments([ + pathname, + nonJsonBodyPropName, + ...(hasQuery + ? [`stripUndefined({${queryParameterNames.join(", ")}})`] + : []), + ]); + } else if (hasQuery) { + callExpr.addArguments([ + pathname, + emptyKeyword, + ...(hasQuery + ? [`stripUndefined({${queryParameterNames.join(", ")}})`] + : []), + ]); + } else { + callExpr.addArguments([pathname]); + } + } + } + } + } + } + } + + const isInput = (t: TypeAliasDeclaration | InterfaceDeclaration) => + t.getName()?.endsWith("Input"); + // const isOutput = (t: string) => t.endsWith('Output'); + + const inputTypes = typesFile.getTypeAliases().filter((t) => isInput(t)); + const inputUnion = createUnion( + ...new Set(inputTypes.sort().map((t) => t.getName())), + ); + const outputUnion = createUnion( + ...[...outputTypes].map((t) => (typeof t === "string" ? t : t.getName())), + ); + + const allInputs = inputUnion + ? mainFile.addTypeAlias({ + name: "AllInputs", + type: inputUnion, + }) + : undefined; + + const allOutputs = outputUnion + ? mainFile.addTypeAlias({ + name: "AllOutputs", + type: outputUnion, + }) + : undefined; + + const serviceClientClassName = "RestServiceClient"; + const fetcherName = "createIsomorphicNativeFetcher"; + const configType = "RestServiceClientConfig"; + + mainFile.addImportDeclaration({ + moduleSpecifier: "@block65/rest-client", + namedImports: [ + serviceClientClassName, + fetcherName, + { + name: configType, + isTypeOnly: true, + }, + ], + }); + + const namedImports = [...new Set([...inputTypes, ...outputTypes])].filter( + (t: T | string | typeof unspecifiedKeyword): t is T => + typeof t !== "string", + ); + + if (namedImports.length > 0) { + mainFile.addImportDeclaration({ + moduleSpecifier: typesModuleSpecifier, + namedImports: namedImports + .sort((a, b) => a.getName().localeCompare(b.getName())) + .map((t) => ({ + name: t.getName(), + })), + isTypeOnly: true, + }); + } + + const clientClassDeclaration = mainFile.addClass({ + name: pascalCase(schema.info.title, "RestClient"), + isExported: true, + extends: `${serviceClientClassName}<${allInputs?.getName() || unspecifiedKeyword}, ${ + allOutputs?.getName() || unspecifiedKeyword + }>`, + }); + + const ctor = clientClassDeclaration.addConstructor(); + + const baseUrl = ctor.addParameter({ + name: "baseUrl", + type: Writers.unionType("string", "URL"), + initializer: `new URL('${new URL( + `${schema.servers?.[0]?.url || "https://api.example.com"}/`, + )}')`, + }); + + // const fetcherParam = ctor.addParameter({ + // name: 'fetcher', + // // type: fetcherMethodType, + // initializer: `${fetcherName}()`, + // }); + + const configParam = ctor.addParameter({ + name: "config", + type: configType, + hasQuestionToken: true, + }); + + ctor.addStatements(["super();"]); + + const superKeyword = ctor.getFirstDescendantByKind(SyntaxKind.SuperKeyword); + const callExpr = superKeyword?.getParentIfKindOrThrow( + SyntaxKind.CallExpression, + ); + + // type narrowing + if (Node.isCallExpression(callExpr)) { + callExpr?.addArguments([ + baseUrl.getName(), + // fetcherParam.getName(), + configParam.getName(), + ]); + } + + mainFile.organizeImports(); + + // tidies up any unused type-fest imports + typesFile.fixUnusedIdentifiers(); + commandsFile.fixUnusedIdentifiers(); + valibotFile.fixUnusedIdentifiers(); + + // Generate hono-valibot file + const honoValibotFile = createHonoValibotFile(project, outputDir); + + // Collect all schema names needed + const schemaImports = new Set(); + for (const op of allOperations) { + for (const schemaName of Object.values(op.schemas)) { + if (schemaName) { + schemaImports.add(schemaName); + } + } + } + + // Add imports from valibot.ts + addValibotImportsToHonoValibotFile(honoValibotFile, [...schemaImports]); + + // Generate middleware exports for each operation + for (const op of allOperations) { + createHonoValibotMiddleware(honoValibotFile, op.exportName, op.schemas); + } + + honoValibotFile.fixUnusedIdentifiers(); + + return { + commandsFile, + typesFile, + mainFile, + valibotFile, + honoValibotFile, + }; } diff --git a/lib/process-schema.ts b/lib/process-schema.ts index f909334..2afc2a3 100644 --- a/lib/process-schema.ts +++ b/lib/process-schema.ts @@ -1,721 +1,770 @@ /* eslint-disable no-console */ -import type { oas31, oas30 } from 'openapi3-ts'; +import type { oas30, oas31 } from "openapi3-ts"; import { - Writers, - type CodeBlockWriter, - type EnumDeclaration, - type InterfaceDeclaration, - type JSDocStructure, - type OptionalKind, - type PropertySignatureStructure, - type SourceFile, - type TypeAliasDeclaration, - type WriterFunction, -} from 'ts-morph'; + type CodeBlockWriter, + type EnumDeclaration, + type InterfaceDeclaration, + type JSDocStructure, + type OptionalKind, + type PropertySignatureStructure, + type SourceFile, + type TypeAliasDeclaration, + type WriterFunction, + Writers, +} from "ts-morph"; import { - isNotNullOrUndefined, - isNotReferenceObject, - isReferenceObject, - pascalCase, - wordWrap, -} from './utils.js'; + isNotNullOrUndefined, + isNotReferenceObject, + isReferenceObject, + pascalCase, + wordWrap, +} from "./utils.ts"; function maybeWithNullUnion(type: string | WriterFunction, withNull = false) { - return withNull && type !== 'null' ? Writers.unionType(type, 'null') : type; + return withNull && type !== "null" ? Writers.unionType(type, "null") : type; } function schemaTypeIsNull(schema: oas30.SchemaObject | oas31.SchemaObject) { - return ( - schema.type === 'null' || - ('nullable' in schema && schema.nullable) || - schema.enum?.every((e) => e === 'null') - ); + return ( + schema.type === "null" || + ("nullable" in schema && schema.nullable) || + schema.enum?.every((e) => e === "null") + ); } function maybeUnion(...types: (string | WriterFunction)[]) { - const [first, second, ...rest] = types; + const [first, second, ...rest] = types; - if (typeof first === 'undefined') { - return 'unknown'; - } + if (typeof first === "undefined") { + return "unknown"; + } - return typeof second === 'undefined' - ? first - : Writers.unionType(first, second, ...rest); + return typeof second === "undefined" + ? first + : Writers.unionType(first, second, ...rest); } function maybeIntersection(...types: (string | WriterFunction)[]) { - const [first, second, ...rest] = types; + const [first, second, ...rest] = types; - if (typeof first === 'undefined') { - return 'unknown'; - } + if (typeof first === "undefined") { + return "unknown"; + } - return typeof second === 'undefined' - ? first - : Writers.intersectionType(first, second, ...rest); + return typeof second === "undefined" + ? first + : Writers.intersectionType(first, second, ...rest); } export function schemaToType( - typesAndInterfaces: Map< - string, - InterfaceDeclaration | TypeAliasDeclaration | EnumDeclaration - >, - parentSchema: oas31.SchemaObject | oas30.SchemaObject, - propertyName: string, - schemaObject: oas31.SchemaObject | oas30.SchemaObject | oas31.ReferenceObject, - options: { - exactOptionalPropertyTypes?: boolean; - booleanAsStringish?: boolean; - integerAsStringish?: boolean; - } = {}, + typesAndInterfaces: Map< + string, + InterfaceDeclaration | TypeAliasDeclaration | EnumDeclaration + >, + parentSchema: oas31.SchemaObject | oas30.SchemaObject, + propertyName: string, + schemaObject: oas31.SchemaObject | oas30.SchemaObject | oas31.ReferenceObject, + options: { + exactOptionalPropertyTypes?: boolean; + booleanAsStringish?: boolean; + integerAsStringish?: boolean; + } = {}, ): OptionalKind { - const name = `"${propertyName}"`; - const hasQuestionToken = - parentSchema.type === 'object' && - !parentSchema.required?.includes(propertyName); - - if ('$ref' in schemaObject) { - const existingSchema = typesAndInterfaces.get(schemaObject.$ref); - - if (!existingSchema) { - // throw new Error(`ref used before available: ${schemaObject.$ref}`); - console.warn(`ref used before available: ${schemaObject.$ref}`); - return { - name, - hasQuestionToken, - type: 'never', - docs: [ - { - description: `WARN: $ref used before available - ${schemaObject.$ref}`, - }, - ], - }; - } - - return { - name, - hasQuestionToken, - type: existingSchema.getName(), - }; - } - - const jsdocTags = [ - ...(schemaObject.default - ? [{ tagName: 'default', text: String(schemaObject.default) }] - : []), - ...(schemaObject.enum - ? [{ tagName: 'enum', text: schemaObject.enum.join(',') }] - : []), - ...(schemaObject.externalDocs - ? [ - { - tagName: 'see', - text: wordWrap( - [ - schemaObject.externalDocs.description, - schemaObject.externalDocs.url, - ] - .filter(Boolean) - .join(' - '), - ), - }, - ] - : []), - - // 3 - ...('example' in schemaObject - ? [{ tagName: 'example', text: String(schemaObject.example) }] - : []), - - // 3.1 - ...('examples' in schemaObject - ? schemaObject.examples.map((example) => ({ - tagName: 'example', - text: JSON.stringify(example), - })) - : []), - ...(schemaObject.deprecated ? [{ tagName: 'deprecated' }] : []), - ]; - - const maybeJsDoc = { - ...(schemaObject.description && { - description: wordWrap(`\n${schemaObject.description}`), - }), - ...(jsdocTags.length > 0 && { tags: jsdocTags }), - }; - - const docs: (OptionalKind | string)[] = - Object.keys(maybeJsDoc).length > 1 ? [maybeJsDoc] : []; - - if (Array.isArray(schemaObject.type)) { - // - if (schemaObject.type.length === 1) { - return { - name, - hasQuestionToken, - type: maybeWithNullUnion( - schemaObject.type[0] || 'unknown', // weird edge case - schemaTypeIsNull(schemaObject), - ), - docs, - }; - } - - return { - name, - hasQuestionToken, - type: maybeUnion( - ...schemaObject.type.map((type) => { - const schema = - type === 'array' - ? ({ - items: {}, - ...schemaObject, - type: 'array', - } satisfies typeof schemaObject) - : ({ - ...schemaObject, - type, - } satisfies typeof schemaObject); - - return ( - schemaToType(typesAndInterfaces, schemaObject, name, schema).type || - 'never' - ); - }), - ), - docs, - }; - } - - if ('const' in schemaObject) { - return { - name, - hasQuestionToken, - type: Array.isArray(schemaObject.const) - ? maybeUnion(...schemaObject.const) - : JSON.stringify(schemaObject.const), - - docs, - }; - } - - if (schemaObject.type === 'array') { - const type = schemaToType( - typesAndInterfaces, - schemaObject, - propertyName, - schemaObject.items || {}, - ); - - if (type.type instanceof Function) { - const typeWriter = type.type; - return { - name, - hasQuestionToken, - type: (writer: CodeBlockWriter) => { - writer.write('('); - typeWriter(writer); - writer.write(')[]'); - }, - isReadonly: true, - docs, - }; - } - - return { - name, - hasQuestionToken, - type: `(${type.type})[]`, - isReadonly: true, - docs, - }; - } - - if ( - 'allOf' in schemaObject || - 'oneOf' in schemaObject || - 'anyOf' in schemaObject - ) { - const schemaItems = - schemaObject.allOf || schemaObject.oneOf || schemaObject.anyOf || []; - - const types = schemaItems - .map((schema) => - schemaToType(typesAndInterfaces, parentSchema, propertyName, schema, { - // forcibly disallow undefined, we will handle it later - exactOptionalPropertyTypes: true, - }), - ) - .map((t) => t.type); - - // only one type, so just return that type - if (types.length === 1) { - return { - name, - hasQuestionToken, - type: `${types[0]}`, - docs, - }; - } - - const intersect = 'allOf' in schemaObject; - - // already got a null type, no need to add another null - if (types.some((t) => t === 'null')) { - return { - name, - hasQuestionToken, - type: intersect - ? maybeIntersection(...types.filter(isNotNullOrUndefined)) - : maybeUnion(...types.filter(isNotNullOrUndefined)), - docs, - }; - } - - // add null - return { - name, - hasQuestionToken, - type: intersect - ? maybeIntersection(...types.filter(isNotNullOrUndefined), 'null') - : maybeUnion(...types.filter(isNotNullOrUndefined), 'null'), - docs, - }; - } - - if (schemaObject.type === 'object') { - // type=object and enum null is common openapi workaround - // we convert it to null type - if (schemaObject.enum?.every((e) => e === null)) { - return { - name, - hasQuestionToken, - type: 'null', - docs, - }; - } - - // if (!schemaObject.properties) { - // return { - // name, - // hasQuestionToken, - // type: 'Jsonifiable', - // docs, - // }; - // } - - return { - name, - hasQuestionToken, - // WARN: Duplicated code - the recursion beat me - type: schemaObject.properties - ? Writers.objectType({ - properties: Object.entries(schemaObject.properties).map( - ([key, schema]) => { - const type = schemaToType( - typesAndInterfaces, - schemaObject, - key, - schema, - ); - - return type; - }, - ), - }) - : 'JsonifiableObject', - docs, - }; - } - - if (schemaObject.type === 'integer' || schemaObject.type === 'number') { - return { - name, - hasQuestionToken, - type: maybeWithNullUnion( - // eslint-disable-next-line no-template-curly-in-string - options.integerAsStringish ? '`${number}`' : 'number', - schemaTypeIsNull(schemaObject), - ), - docs, - }; - } - - if (schemaObject.type === 'boolean') { - return { - name, - hasQuestionToken, - type: maybeWithNullUnion( - options.booleanAsStringish - ? Writers.unionType('"true"', '"false"') - : 'boolean', - schemaTypeIsNull(schemaObject), - ), - docs, - }; - } - - if (schemaObject.type === 'string') { - if ('enum' in schemaObject) { - return { - name, - hasQuestionToken, - type: maybeUnion(...schemaObject.enum.map((e) => JSON.stringify(e))), - docs, - }; - } - - return { - name, - hasQuestionToken, - type: 'string', - docs, - }; - } - - // empty schemaObject - if (Object.keys(schemaObject).length === 0) { - return { - name, - hasQuestionToken, - type: maybeWithNullUnion('Jsonifiable', schemaTypeIsNull(schemaObject)), - docs, - isReadonly: !!schemaObject.readOnly, - }; - } - - if ( - schemaObject.type === 'null' || - // legacy nullables - ('nullable' in schemaObject && schemaObject.nullable) || - ('enum' in schemaObject && schemaObject.enum?.every((e) => e === 'null')) - ) { - return { - name, - hasQuestionToken, - type: 'null', - docs, - }; - } - - console.warn( - 'WARN: unhandled type %s in %j', // with parent %j', - schemaObject.type, - schemaObject, - // parentSchema, - ); - - return { - name, - hasQuestionToken, - type: 'unknown', - docs, - }; + const name = `"${propertyName}"`; + const hasQuestionToken = + parentSchema.type === "object" && + !parentSchema.required?.includes(propertyName); + + if ("$ref" in schemaObject) { + const existingSchema = typesAndInterfaces.get(schemaObject.$ref); + + if (!existingSchema) { + // throw new Error(`ref used before available: ${schemaObject.$ref}`); + console.warn("ref used before available: schema=%j", schemaObject); + return { + name, + hasQuestionToken, + type: "never", + docs: [ + { + description: `WARN: $ref used before available - schema=${JSON.stringify(schemaObject)}`, + }, + ], + }; + } + + // Propagate JSDoc from the referenced type to the property + const refDocs = existingSchema.getJsDocs(); + const docs: OptionalKind[] = refDocs.flatMap((jsDoc) => { + const description = jsDoc.getDescription(); + const tags = jsDoc + .getTags() + .map((tag) => { + const text = tag.getCommentText(); + return text ? { tagName: tag.getTagName(), text } : undefined; + }) + .filter((tag): tag is { tagName: string; text: string } => !!tag); + + if (!description && tags.length === 0) { + return []; + } + + return [ + { + ...(description && { description }), + ...(tags.length > 0 && { tags }), + }, + ]; + }); + + return { + name, + hasQuestionToken, + type: existingSchema.getName(), + ...(docs.length > 0 && { docs }), + }; + } + + const jsdocTags = [ + ...(schemaObject.default + ? [{ tagName: "default", text: String(schemaObject.default) }] + : []), + ...(schemaObject.enum + ? [{ tagName: "enum", text: schemaObject.enum.join(",") }] + : []), + ...(schemaObject.externalDocs + ? [ + { + tagName: "see", + text: wordWrap( + [ + schemaObject.externalDocs.description, + schemaObject.externalDocs.url, + ] + .filter(Boolean) + .join(" - "), + ), + }, + ] + : []), + + // 3 + ...("example" in schemaObject + ? [{ tagName: "example", text: String(schemaObject.example) }] + : []), + + // 3.1 + ...("examples" in schemaObject + ? schemaObject.examples.map((example) => ({ + tagName: "example", + text: JSON.stringify(example), + })) + : []), + ...(schemaObject.deprecated ? [{ tagName: "deprecated" }] : []), + ]; + + const maybeJsDoc = { + ...(schemaObject.description && { + description: wordWrap(`\n${schemaObject.description}`), + }), + ...(jsdocTags.length > 0 && { tags: jsdocTags }), + }; + + const docs: (OptionalKind | string)[] = + Object.keys(maybeJsDoc).length > 1 ? [maybeJsDoc] : []; + + if (Array.isArray(schemaObject.type)) { + // + if (schemaObject.type.length === 1) { + return { + name, + hasQuestionToken, + type: maybeWithNullUnion( + schemaObject.type[0] || "unknown", // weird edge case + schemaTypeIsNull(schemaObject), + ), + docs, + }; + } + + return { + name, + hasQuestionToken, + type: maybeUnion( + ...schemaObject.type.map((type) => { + const schema = + type === "array" + ? ({ + items: {}, + ...schemaObject, + type: "array", + } satisfies typeof schemaObject) + : ({ + ...schemaObject, + type, + } satisfies typeof schemaObject); + + return ( + schemaToType(typesAndInterfaces, schemaObject, name, schema).type || + "never" + ); + }), + ), + docs, + }; + } + + if ("const" in schemaObject) { + return { + name, + hasQuestionToken, + type: Array.isArray(schemaObject.const) + ? maybeUnion(...schemaObject.const) + : JSON.stringify(schemaObject.const), + + docs, + }; + } + + if (schemaObject.type === "array") { + const type = schemaToType( + typesAndInterfaces, + schemaObject, + propertyName, + schemaObject.items || {}, + ); + + if (type.type instanceof Function) { + const typeWriter = type.type; + return { + name, + hasQuestionToken, + type: (writer: CodeBlockWriter) => { + writer.write("readonly "); + writer.write("("); + typeWriter(writer); + writer.write(")[]"); + }, + isReadonly: !!type.isReadonly, + docs, + }; + } + + return { + name, + hasQuestionToken, + type: `readonly (${type.type})[]`, + isReadonly: !!type.isReadonly, + docs, + }; + } + + if ( + "allOf" in schemaObject || + "oneOf" in schemaObject || + "anyOf" in schemaObject + ) { + const schemaItems = + schemaObject.allOf || schemaObject.oneOf || schemaObject.anyOf || []; + + const types = schemaItems + .map((schema) => + schemaToType(typesAndInterfaces, parentSchema, propertyName, schema, { + // forcibly disallow undefined, we will handle it later + exactOptionalPropertyTypes: true, + }), + ) + .map((t) => t.type); + + // only one type, so just return that type + if (types.length === 1) { + return { + name, + hasQuestionToken, + type: `${types[0]}`, + docs, + }; + } + + const intersect = "allOf" in schemaObject; + + const filteredTypes = types.filter(isNotNullOrUndefined); + const hasNullType = types.some((t) => t === "null"); + const isNullable = schemaTypeIsNull(schemaObject); + + if (intersect) { + // For allOf: intersect non-null types, wrap in union with null if nullable + const nonNullTypes = filteredTypes.filter((t) => t !== "null"); + const intersectionType = maybeIntersection(...nonNullTypes); + return { + name, + hasQuestionToken, + type: isNullable + ? maybeUnion(intersectionType, "null") + : intersectionType, + docs, + }; + } + + // For oneOf/anyOf: union all types (include null if present or if nullable) + return { + name, + hasQuestionToken, + type: + hasNullType || isNullable + ? maybeUnion(...filteredTypes.filter((t) => t !== "null"), "null") + : maybeUnion(...filteredTypes), + docs, + }; + } + + if (schemaObject.type === "object") { + // type=object and enum null is common openapi workaround + // we convert it to null type + if (schemaObject.enum?.every((e) => e === null)) { + return { + name, + hasQuestionToken, + type: "null", + isReadonly: !!schemaObject.readOnly, + docs, + }; + } + + if (schemaObject.properties) { + return { + name, + hasQuestionToken, + type: Writers.objectType({ + properties: Object.entries(schemaObject.properties).map( + ([key, schema]) => { + const type = schemaToType( + typesAndInterfaces, + schemaObject, + key, + schema, + ); + + return type; + }, + ), + }), + docs, + }; + } + + if ( + typeof schemaObject.additionalProperties === "object" && + "type" in schemaObject.additionalProperties + ) { + return { + name, + hasQuestionToken, + type: "Record ", + isReadonly: !!schemaObject.readOnly, + }; + } + + return { + name, + hasQuestionToken, + // WARN: Duplicated code - the recursion beat me + type: "Record", + docs, + }; + } + + if (schemaObject.type === "integer" || schemaObject.type === "number") { + return { + name, + hasQuestionToken, + type: maybeWithNullUnion( + // eslint-disable-next-line no-template-curly-in-string + // biome-ignore lint/suspicious/noTemplateCurlyInString: intentional + options.integerAsStringish ? "`${number}`" : "number", + schemaTypeIsNull(schemaObject), + ), + docs, + }; + } + + if (schemaObject.type === "boolean") { + return { + name, + hasQuestionToken, + type: maybeWithNullUnion( + options.booleanAsStringish + ? Writers.unionType('"true"', '"false"') + : "boolean", + schemaTypeIsNull(schemaObject), + ), + docs, + }; + } + + if (schemaObject.type === "string") { + if ("enum" in schemaObject) { + return { + name, + hasQuestionToken, + type: maybeUnion(...schemaObject.enum.map((e) => JSON.stringify(e))), + docs, + }; + } + + return { + name, + hasQuestionToken, + type: "string", + docs, + }; + } + + // empty schemaObject + if (Object.keys(schemaObject).length === 0) { + return { + name, + hasQuestionToken, + type: maybeWithNullUnion("Jsonifiable", schemaTypeIsNull(schemaObject)), + docs, + isReadonly: !!schemaObject.readOnly, + }; + } + + if ( + schemaObject.type === "null" || + // legacy nullables + ("nullable" in schemaObject && schemaObject.nullable) || + ("enum" in schemaObject && schemaObject.enum?.every((e) => e === "null")) + ) { + return { + name, + hasQuestionToken, + type: "null", + docs, + }; + } + + console.warn( + "WARN: unhandled type %s in %j", // with parent %j', + schemaObject.type, + schemaObject, + // parentSchema, + ); + + return { + name, + hasQuestionToken, + type: "unknown", + docs, + }; } export function registerTypesFromSchema( - typesAndInterfaces: Map< - string, - InterfaceDeclaration | TypeAliasDeclaration | EnumDeclaration - >, - typesFile: SourceFile, - schemaName: string, - schemaObject: - | oas30.SchemaObject - | oas30.ReferenceObject - | oas31.SchemaObject - | oas31.ReferenceObject, + typesAndInterfaces: Map< + string, + InterfaceDeclaration | TypeAliasDeclaration | EnumDeclaration + >, + typesFile: SourceFile, + schemaName: string, + schemaObject: + | oas30.SchemaObject + | oas30.ReferenceObject + | oas31.SchemaObject + | oas31.ReferenceObject, ) { - // deal with refs - if ('$ref' in schemaObject) { - const iface = typesAndInterfaces.get(schemaObject.$ref); - - if (!iface) { - throw new Error(`ref used before available: ${schemaObject.$ref}`); - } - - const typeAlias = typesFile.addTypeAlias({ - name: pascalCase(schemaName), - isExported: true, - type: iface.getName(), - }); - - typesAndInterfaces.set(`#/components/schemas/${schemaName}`, typeAlias); - } - - // deal with unions and intersections - else if ( - 'allOf' in schemaObject || - 'oneOf' in schemaObject || - 'anyOf' in schemaObject - ) { - const schemaItems = - schemaObject.allOf || schemaObject.oneOf || schemaObject.anyOf || []; - - const intersect = 'allOf' in schemaObject; - - const typeAliases = schemaItems.filter(isReferenceObject).map((s) => { - const alias = typesAndInterfaces.get(s.$ref); - if (!alias) { - throw new Error(`ref used before available: ${s.$ref}`); - } - return alias; - }); - - const objectTypesFromNonRefSchemas = schemaItems - .filter(isNotReferenceObject) - .filter((schema) => schema.type === 'object') - .map((subSchemaObject) => - Writers.objectType({ - properties: Object.entries(subSchemaObject.properties || {}).map( - ([propertyName, propertySchema]) => - schemaToType( - typesAndInterfaces, - subSchemaObject, - propertyName, - propertySchema, - ), - ), - }), - ) - .filter(isNotNullOrUndefined); - - const nonObjectTypesFromNonRefSchemas = schemaItems - .filter(isNotReferenceObject) - .filter((schema) => schema.type !== 'object') - .map( - (subSchemaObject) => - schemaToType( - typesAndInterfaces, - {}, // no parent schema - schemaName, - subSchemaObject, - ).type, - ) - .filter(isNotNullOrUndefined); - - // concat and dedupe - const typeArgs = [ - ...new Set([ - ...typeAliases.map((t) => t.getName()), - ...objectTypesFromNonRefSchemas, - ...nonObjectTypesFromNonRefSchemas, - ]), - ]; - - const typeAlias = typesFile.addTypeAlias({ - name: pascalCase(schemaName), - isExported: true, - type: intersect - ? maybeIntersection(...typeArgs) - : maybeUnion(...typeArgs), - }); - - if (schemaObject.description) { - typeAlias.addJsDoc({ - description: wordWrap(schemaObject.description), - }); - } - - typesAndInterfaces.set(`#/components/schemas/${schemaName}`, typeAlias); - } - - // deal with objects - else if (!schemaObject.type || schemaObject.type === 'object') { - const newIf = typesFile.addTypeAlias({ - name: pascalCase(schemaName), - isExported: true, - // WARN: Duplicated code - the recursion beat me - type: schemaObject.properties - ? Writers.objectType({ - properties: Object.entries(schemaObject.properties).map( - ([key, schema]) => { - const type = schemaToType( - typesAndInterfaces, - schemaObject, - key, - schema, - ); - - return type; - }, - ), - }) - : 'JsonifiableObject', - }); - - if (schemaObject.description) { - newIf.addJsDoc({ - description: wordWrap(schemaObject.description), - }); - } - - typesAndInterfaces.set(`#/components/schemas/${schemaName}`, newIf); - } - - // deal with enums - else if (schemaObject.type === 'string' && schemaObject.enum) { - const docs = schemaObject.description - ? [ - { - description: wordWrap(schemaObject.description), - }, - ] - : []; - - // bonus enum interface for the same set of strings - // handy for looping over the enum values - const enumDeclaration = typesFile.addEnum({ - name: pascalCase(schemaName, 'Enum'), - isExported: true, - members: schemaObject.enum.map((e: unknown) => ({ - name: typeof e === 'string' ? pascalCase(e) : String(e), - value: String(e), - })), - }); - - const stringUnion = typesFile.addTypeAlias({ - name: pascalCase(schemaName /* , schemaObject.type */), - isExported: true, - type: maybeUnion( - enumDeclaration.getName(), - ...schemaObject.enum.map((e) => JSON.stringify(e)), - ), - docs, - }); - - typesAndInterfaces.set(`#/components/schemas/${schemaName}`, stringUnion); - - typesAndInterfaces.set( - `#/components/schemas/${enumDeclaration.getName()}`, - enumDeclaration, - ); - } - - // deal with string consts - else if (schemaObject.type === 'string' && 'const' in schemaObject) { - const constDeclaration = typesFile.addTypeAlias({ - isExported: true, - name: pascalCase(schemaName), - type: JSON.stringify(schemaObject.const), - }); - - if (schemaObject.description) { - constDeclaration.addJsDoc({ - description: wordWrap(schemaObject.description), - }); - } - - typesAndInterfaces.set( - `#/components/schemas/${schemaName}`, - constDeclaration, - ); - } - - // deal with non-enum strings - else if (schemaObject.type === 'string' && !schemaObject.enum) { - const typeAlias = typesFile.addTypeAlias({ - name: pascalCase(schemaName), - isExported: true, - // default - type: maybeWithNullUnion('string', schemaTypeIsNull(schemaObject)), - - // date format - ...(schemaObject.format === 'date-time' && { - type: 'Jsonify', - }), - - // custom extension - ...('typescriptHint' in schemaObject && - typeof schemaObject.typescriptHint === 'string' && { - type: maybeWithNullUnion( - schemaObject.typescriptHint, - schemaTypeIsNull(schemaObject), - ), - }), - }); - - if (schemaObject.description) { - typeAlias.addJsDoc({ - description: wordWrap(schemaObject.description), - }); - } - - typesAndInterfaces.set(`#/components/schemas/${schemaName}`, typeAlias); - } - - // deal with numberish things - else if (schemaObject.type === 'number' || schemaObject.type === 'integer') { - const typeAlias = typesFile.addTypeAlias({ - name: pascalCase(schemaName), - isExported: true, - type: maybeWithNullUnion( - schemaObject.type, - schemaTypeIsNull(schemaObject), - ), - }); - - if (schemaObject.description) { - typeAlias.addJsDoc({ - description: wordWrap(schemaObject.description), - }); - } - - typesAndInterfaces.set(`#/components/schemas/${schemaName}`, typeAlias); - } - - // deal with boolean things - else if (schemaObject.type === 'boolean') { - const typeAlias = typesFile.addTypeAlias({ - name: pascalCase(schemaName), - isExported: true, - type: maybeWithNullUnion( - schemaObject.type, - schemaTypeIsNull(schemaObject), - ), - }); - - if (schemaObject.description) { - typeAlias.addJsDoc({ - description: wordWrap(schemaObject.description), - }); - } - - typesAndInterfaces.set(`#/components/schemas/${schemaName}`, typeAlias); - } - - // deal with arrays of refs - else if ( - schemaObject.type === 'array' && - schemaObject.items && - '$ref' in schemaObject.items - ) { - const iface = typesAndInterfaces.get(schemaObject.items.$ref); - - if (!iface) { - throw new Error(`ref used before available: ${schemaObject.items.$ref}`); - } - - const typeAlias = typesFile.addTypeAlias({ - name: pascalCase(schemaName), - isExported: true, - type: `${iface.getName()}[]`, - }); - - if (schemaObject.description) { - typeAlias.addJsDoc({ - description: wordWrap(schemaObject.description), - }); - } - - typesAndInterfaces.set(`#/components/schemas/${schemaName}`, typeAlias); - } - - // not supported yet - else { - console.warn(`unsupported type "${schemaObject.type}"`); - // throw new Error(`unsupported type "${schemaObject.type}"`); - } + // deal with refs + if ("$ref" in schemaObject) { + const iface = typesAndInterfaces.get(schemaObject.$ref); + + if (!iface) { + throw new Error(`ref used before available: ${schemaObject.$ref}`); + } + + const typeAlias = typesFile.addTypeAlias({ + name: pascalCase(schemaName), + isExported: true, + type: iface.getName(), + }); + + typesAndInterfaces.set(`#/components/schemas/${schemaName}`, typeAlias); + } + + // deal with unions and intersections + else if ( + "allOf" in schemaObject || + "oneOf" in schemaObject || + "anyOf" in schemaObject + ) { + const schemaItems = + schemaObject.allOf || schemaObject.oneOf || schemaObject.anyOf || []; + + const intersect = "allOf" in schemaObject; + + const typeAliases = schemaItems.filter(isReferenceObject).map((s) => { + const alias = typesAndInterfaces.get(s.$ref); + if (!alias) { + throw new Error(`ref used before available: ${s.$ref}`); + } + return alias; + }); + + const objectTypesFromNonRefSchemas = schemaItems + .filter(isNotReferenceObject) + .filter((schema) => schema.type === "object") + .map((subSchemaObject) => + Writers.objectType({ + properties: Object.entries(subSchemaObject.properties || {}).map( + ([propertyName, propertySchema]) => + schemaToType( + typesAndInterfaces, + subSchemaObject, + propertyName, + propertySchema, + ), + ), + }), + ) + .filter(isNotNullOrUndefined); + + const nonObjectTypesFromNonRefSchemas = schemaItems + .filter(isNotReferenceObject) + .filter((schema) => schema.type !== "object") + .map((subSchemaObject) => + schemaToType( + typesAndInterfaces, + {}, // no parent schema + schemaName, + subSchemaObject, + ), + ) + .filter(isNotNullOrUndefined); + + // concat and dedupe + const typeArgs = [ + ...new Set([ + ...typeAliases.map((t) => t.getName()), + ...objectTypesFromNonRefSchemas, + ...nonObjectTypesFromNonRefSchemas + .map((t) => (t.isReadonly ? `Readonly<${t.type}>` : t.type)) + .filter(isNotNullOrUndefined), + ]), + ]; + + const typeAlias = typesFile.addTypeAlias({ + name: pascalCase(schemaName), + isExported: true, + type: intersect + ? maybeIntersection(...typeArgs) + : maybeUnion(...typeArgs), + }); + + if (schemaObject.description) { + typeAlias.addJsDoc({ + description: wordWrap(schemaObject.description), + }); + } + + typesAndInterfaces.set(`#/components/schemas/${schemaName}`, typeAlias); + } + + // deal with objects + else if (!schemaObject.type || schemaObject.type === "object") { + const newIf = typesFile.addTypeAlias({ + name: pascalCase(schemaName), + isExported: true, + // WARN: Duplicated code - the recursion beat me + type: schemaObject.properties + ? Writers.objectType({ + properties: Object.entries(schemaObject.properties).map( + ([key, schema]) => { + const type = schemaToType( + typesAndInterfaces, + schemaObject, + key, + schema, + ); + + return type; + }, + ), + }) + : typeof schemaObject.additionalProperties === "object" && + "type" in schemaObject.additionalProperties + ? `Record` + : "Record", + }); + + if (schemaObject.description) { + newIf.addJsDoc({ + description: wordWrap(schemaObject.description), + }); + } + + typesAndInterfaces.set(`#/components/schemas/${schemaName}`, newIf); + } + + // deal with enums + else if (schemaObject.type === "string" && schemaObject.enum) { + const docs = schemaObject.description + ? [ + { + description: wordWrap(schemaObject.description), + }, + ] + : []; + + // bonus enum interface for the same set of strings + // handy for looping over the enum values + // const enumDeclaration = typesFile.addEnum({ + // name: pascalCase(schemaName, 'Enum'), + // isExported: true, + // members: schemaObject.enum.map((e: unknown) => ({ + // name: typeof e === 'string' ? pascalCase(e) : String(e), + // value: String(e), + // })), + // }); + + const stringUnion = typesFile.addTypeAlias({ + name: pascalCase(schemaName /* , schemaObject.type */), + isExported: true, + type: maybeUnion( + // enumDeclaration.getName(), + ...schemaObject.enum.map((e) => JSON.stringify(e)), + ), + docs, + }); + + typesAndInterfaces.set(`#/components/schemas/${schemaName}`, stringUnion); + + // typesAndInterfaces.set( + // `#/components/schemas/${enumDeclaration.getName()}`, + // enumDeclaration, + // ); + } + + // deal with string consts + else if (schemaObject.type === "string" && "const" in schemaObject) { + const constDeclaration = typesFile.addTypeAlias({ + isExported: true, + name: pascalCase(schemaName), + type: JSON.stringify(schemaObject.const), + }); + + if (schemaObject.description) { + constDeclaration.addJsDoc({ + description: wordWrap(schemaObject.description), + }); + } + + typesAndInterfaces.set( + `#/components/schemas/${schemaName}`, + constDeclaration, + ); + } + + // deal with non-enum strings + else if (schemaObject.type === "string" && !schemaObject.enum) { + const typeAlias = typesFile.addTypeAlias({ + name: pascalCase(schemaName), + isExported: true, + // default + type: maybeWithNullUnion("string", schemaTypeIsNull(schemaObject)), + + // date format + ...(schemaObject.format === "date-time" && { + type: "Jsonify", + }), + + // custom extension + ...("x-typescript-hint" in schemaObject && + typeof schemaObject["x-typescript-hint"] === "string" && { + type: maybeWithNullUnion( + schemaObject["x-typescript-hint"], + schemaTypeIsNull(schemaObject), + ), + }), + }); + + if (schemaObject.description) { + typeAlias.addJsDoc({ + description: wordWrap(schemaObject.description), + }); + } + + typesAndInterfaces.set(`#/components/schemas/${schemaName}`, typeAlias); + } + + // deal with numberish things + else if (schemaObject.type === "number" || schemaObject.type === "integer") { + const typeAlias = typesFile.addTypeAlias({ + name: pascalCase(schemaName), + isExported: true, + type: maybeWithNullUnion("number", schemaTypeIsNull(schemaObject)), + }); + + if (schemaObject.description) { + typeAlias.addJsDoc({ + description: wordWrap(schemaObject.description), + }); + } + + typesAndInterfaces.set(`#/components/schemas/${schemaName}`, typeAlias); + } + + // deal with boolean things + else if (schemaObject.type === "boolean") { + const typeAlias = typesFile.addTypeAlias({ + name: pascalCase(schemaName), + isExported: true, + type: maybeWithNullUnion( + schemaObject.type, + schemaTypeIsNull(schemaObject), + ), + }); + + if (schemaObject.description) { + typeAlias.addJsDoc({ + description: wordWrap(schemaObject.description), + }); + } + + typesAndInterfaces.set(`#/components/schemas/${schemaName}`, typeAlias); + } + + // deal with arrays of refs + else if ( + schemaObject.type === "array" && + schemaObject.items && + "$ref" in schemaObject.items + ) { + const iface = typesAndInterfaces.get(schemaObject.items.$ref); + + if (!iface) { + throw new Error(`ref used before available: ${schemaObject.items.$ref}`); + } + + const typeAlias = typesFile.addTypeAlias({ + name: pascalCase(schemaName), + isExported: true, + type: `${iface.getName()}[]`, + }); + + if (schemaObject.description) { + typeAlias.addJsDoc({ + description: wordWrap(schemaObject.description), + }); + } + + typesAndInterfaces.set(`#/components/schemas/${schemaName}`, typeAlias); + } + + // not supported yet + else { + console.warn( + `unsupported ${schemaObject.type} schema object: %j`, + schemaObject, + ); + // throw new Error(`unsupported type "${schemaObject.type}"`); + } } diff --git a/lib/utils.ts b/lib/utils.ts index 17ceadd..792459e 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -1,87 +1,90 @@ -import camelcase from 'camelcase'; -import type { oas31 } from 'openapi3-ts'; -import wrap from 'word-wrap'; +import camelcase from "camelcase"; +import type { oas31 } from "openapi3-ts"; +import wrap from "word-wrap"; export function maybeJsDocDescription( - ...str: (string | undefined | false | null)[] + ...str: (string | undefined | false | null)[] ): string { - return str.length > 0 ? ['', ...str].filter(Boolean).join(' - ').trim() : ''; + return str.length > 0 ? ["", ...str].filter(Boolean).join(" - ").trim() : ""; } export function isReferenceObject(obj: unknown): obj is oas31.ReferenceObject { - return typeof obj === 'object' && obj !== null && '$ref' in obj; + return typeof obj === "object" && obj !== null && "$ref" in obj; } export function getDependency(obj: unknown): string | undefined { - return isReferenceObject(obj) ? obj.$ref : undefined; + return isReferenceObject(obj) ? obj.$ref : undefined; } export function isNotReferenceObject( - obj: T, + obj: T, ): obj is Exclude { - return !isReferenceObject(obj); + return !isReferenceObject(obj); } export function isNotNullOrUndefined(obj: T | null | undefined): obj is T { - return obj !== null && typeof obj !== undefined; + return obj !== null && typeof obj !== "undefined"; } export function getDependents( - obj: oas31.ReferenceObject | oas31.SchemaObject, + obj: oas31.ReferenceObject | oas31.SchemaObject, ): string[] { - const strOnly = (x: string | undefined): x is string => typeof x === 'string'; + const strOnly = (x: string | undefined): x is string => typeof x === "string"; - if (isReferenceObject(obj)) { - return [getDependency(obj)].filter(strOnly); - } + if (isReferenceObject(obj)) { + return [getDependency(obj)].filter(strOnly); + } - if ('properties' in obj) { - const properties = Object.values(obj.properties); - return properties.flatMap(getDependents).filter(strOnly); - } + if ("properties" in obj) { + const properties = Object.values(obj.properties); + return properties.flatMap(getDependents).filter(strOnly); + } - if ('items' in obj) { - if (isReferenceObject(obj.items)) { - return [getDependency(obj.items)].filter(strOnly); - } - } + if ("items" in obj) { + if (isReferenceObject(obj.items)) { + return [getDependency(obj.items)].filter(strOnly); + } + } - if ('anyOf' in obj) { - return obj.anyOf.flatMap(getDependents).filter(strOnly); - } + if ("anyOf" in obj) { + return obj.anyOf.flatMap(getDependents).filter(strOnly); + } - if ('allOf' in obj) { - return obj.allOf.flatMap(getDependents).filter(strOnly); - } + if ("allOf" in obj) { + return obj.allOf.flatMap(getDependents).filter(strOnly); + } - if ('oneOf' in obj) { - return obj.oneOf.flatMap(getDependents).filter(strOnly); - } + if ("oneOf" in obj) { + return obj.oneOf.flatMap(getDependents).filter(strOnly); + } - return []; + return []; } export function refToName(ref: string): string { - const name = ref.split('/').at(-1); - if (!name) { - throw new Error(`invalid ref: ${ref}`); - } - return name; + const name = ref.split("/").at(-1); + if (!name) { + throw new Error(`invalid ref: ${ref}`); + } + return name; } export function pascalCase(...str: string[]): string { - return camelcase(str, { pascalCase: true }); + return camelcase( + str.flatMap((s) => s.split("/")), + { pascalCase: true }, + ); } export function wordWrap(text: string) { - // max width is 75 as it will be indented already inside a multi-line comment - return wrap(text, { width: 75, indent: '' }); + // max width is 75 as it will be indented already inside a multi-line comment + return wrap(text, { width: 75, indent: "" }); } export function castToValidJsIdentifier(name: string) { - return name.replace(/^(\d+)/, '_$1').replaceAll(/[^a-zA-Z0-9_]/g, ''); + return name.replace(/^(\d+)/, "_$1").replaceAll(/[^a-zA-Z0-9_]/g, ""); } export function iife(fn: () => T): T { - return fn(); + return fn(); } diff --git a/lib/valibot.ts b/lib/valibot.ts new file mode 100644 index 0000000..667bf56 --- /dev/null +++ b/lib/valibot.ts @@ -0,0 +1,394 @@ +import { join } from "node:path"; +import camelcase from "camelcase"; +import type { oas30, oas31 } from "openapi3-ts"; +import { + type CodeBlockWriter, + type Project, + type SourceFile, + VariableDeclarationKind, + type WriterFunction, + Writers, +} from "ts-morph"; +import type { Primitive } from "type-fest"; +import type * as v from "valibot"; +import { wordWrap } from "./utils.ts"; + +/** + * Helper to generate v.name(...args) using ts-morph Writers + */ +function vcall( + name: { [k in keyof typeof v]: k extends string ? k : never }[keyof typeof v], + ...args: ( + | string + | WriterFunction + | Primitive + | (string | WriterFunction | Primitive)[] + )[] +): WriterFunction { + return (writer) => { + writer.write(`v.${name}(`); + args.forEach((arg, index) => { + if (typeof arg === "function") { + arg(writer); + } else if (Array.isArray(arg)) { + writer.write("["); + arg.forEach((item, itemIndex) => { + if (typeof item === "function") { + item(writer); + } else { + writer.write(String(item)); + } + if (itemIndex < arg.length - 1) writer.write(", "); + }); + writer.write("]"); + } else { + writer.write(String(arg)); + } + if (index < args.length - 1) writer.write(", "); + }); + writer.write(")"); + }; +} + +function schemaIsNullable(schema: oas30.SchemaObject | oas31.SchemaObject) { + return ( + schema.type === "null" || + ("nullable" in schema && schema.nullable) || + (Array.isArray(schema.type) && schema.type.includes("null")) + ); +} + +function maybeNullable( + validator: WriterFunction | string, + isNullable: boolean, +) { + return isNullable ? vcall("nullable", validator) : validator; +} + +function maybePipe( + base: WriterFunction | string, + ...constraints: (WriterFunction | string | undefined)[] +) { + const valid = constraints.filter(Boolean); + return valid.length > 0 ? vcall("pipe", base, ...valid) : base; +} + +export function schemaToValidator( + validators: Map, + schema: oas30.SchemaObject | oas31.SchemaObject | oas31.ReferenceObject, +): WriterFunction | string { + if ("$ref" in schema) { + return validators.get(schema.$ref) ?? vcall("unknown"); + } + + const isNullable = schemaIsNullable(schema); + + const typescriptHint = + "x-typescript-hint" in schema && + typeof schema["x-typescript-hint"] === "string" + ? schema["x-typescript-hint"] + : undefined; + + const typescriptHintSchema = typescriptHint + ? `v.custom<${typescriptHint}>(() => true)` + : undefined; + + if (schema.type === "string") { + if (schema.enum) { + return maybeNullable( + vcall( + "picklist", + schema.enum.map((e) => JSON.stringify(e)), + ), + isNullable, + ); + } + + // NOTE: these should be ordered so the most helpful validations come first + // (ie digits before maxLen) and also it must ensure that valibot type check + // is not violated + return maybeNullable( + maybePipe( + vcall("string"), + schema.format === "email" ? vcall("email") : undefined, + schema.format === "uuid" ? vcall("uuid") : undefined, + schema.format === "int32" ? vcall("digits") : undefined, + schema.format === "int64" ? vcall("digits") : undefined, + + schema.minLength !== undefined + ? vcall("minLength", schema.minLength) + : undefined, + schema.maxLength !== undefined + ? vcall("maxLength", schema.maxLength) + : undefined, + schema.pattern + ? vcall("regex", `/${schema.pattern.replaceAll("/", "\\/")}/`) + : undefined, + + ...(schema.format?.startsWith("int") + ? [ + "v.transform((n) => Number.parseInt(n, 10))", + vcall("number"), + vcall("integer"), + schema.minimum !== undefined + ? vcall("minValue", schema.minimum) + : undefined, + schema.maximum !== undefined + ? vcall("maxValue", schema.maximum) + : undefined, + ] + : []), + typescriptHintSchema, + ), + isNullable, + ); + } + + if (schema.type === "number" || schema.type === "integer") { + return maybeNullable( + maybePipe( + vcall("number"), + schema.type.startsWith("int") ? vcall("integer") : undefined, + schema.minimum !== undefined + ? vcall("minValue", schema.minimum) + : undefined, + schema.maximum !== undefined + ? vcall("maxValue", schema.maximum) + : undefined, + typescriptHintSchema, + ), + isNullable, + ); + } + + if (schema.type === "boolean") { + return maybeNullable(vcall("boolean"), isNullable); + } + + if (schema.type === "array") { + const items = schema.items + ? schemaToValidator(validators, schema.items) + : vcall("unknown"); + + return maybeNullable( + maybePipe( + vcall("array", items), + schema.minItems !== undefined + ? vcall("minLength", schema.minItems) + : undefined, + schema.maxItems !== undefined + ? vcall("maxLength", schema.maxItems) + : undefined, + ), + isNullable, + ); + } + + const combinator = schema.oneOf || schema.anyOf || schema.allOf; + if (combinator) { + const variants = combinator.map((s) => schemaToValidator(validators, s)); + const type = schema.allOf ? "intersect" : "union"; + + if (schema.oneOf && schema.discriminator?.propertyName) { + return maybeNullable( + vcall( + "variant", + JSON.stringify(schema.discriminator.propertyName), + variants, + ), + isNullable, + ); + } + return maybeNullable(vcall(type, variants), isNullable); + } + + if (schema.type === "object" || schema.properties || !schema.type) { + const props = schema.properties ?? {}; + if (Object.keys(props).length === 0) { + return maybeNullable( + vcall("record", vcall("string"), vcall("unknown")), + isNullable, + ); + } + + const requiredProps = new Set(schema.required ?? []); + + const strictObjectWriter = (writer: CodeBlockWriter) => { + writer.writeLine("{"); + writer.indent(() => { + Object.entries(props).forEach(([name, s]) => { + const isRequired = requiredProps.has(name); + const validator = schemaToValidator(validators, s); + const finalValidator = isRequired + ? validator + : vcall("exactOptional", validator); + + // write comment + if (!("$ref" in s) && s.description) { + writer.writeLine("/**"); + writer.writeLine( + ` * ${wordWrap(s.description).split("\n").join("\n * ")}`, + ); + writer.writeLine(" */"); + } + + writer.write(`${JSON.stringify(name)}: `); + if (typeof finalValidator === "function") { + finalValidator(writer); + } else { + writer.write(finalValidator); + } + writer.writeLine(","); + }); + }); + writer.write("}"); + }; + + return maybeNullable(vcall("strictObject", strictObjectWriter), isNullable); + } + + return vcall("unknown"); +} + +export function createValibotFile(project: Project, outputDir: string) { + const file = project.createSourceFile(join(outputDir, "valibot.ts"), "", { + overwrite: true, + }); + + // Valibot import + file.addImportDeclaration({ + moduleSpecifier: "valibot", + namespaceImport: "v", + }); + + return file; +} + +export function registerValidatorFromSchema( + validators: Map, + valibotFile: SourceFile, + schemaName: string, + schemaObject: oas30.SchemaObject | oas31.SchemaObject | oas31.ReferenceObject, +) { + const validatorName = camelcase([schemaName, "schema"]); + + validators.set(`#/components/schemas/${schemaName}`, validatorName); + + valibotFile.addVariableStatement({ + isExported: true, + declarationKind: VariableDeclarationKind.Const, + docs: + !("$ref" in schemaObject) && schemaObject.description + ? [ + { + description: wordWrap(schemaObject.description), + tags: [ + ...(schemaObject.deprecated + ? [ + { + tagName: "deprecated", + }, + ] + : []), + ...(schemaObject.title + ? [ + { + tagName: "title", + text: schemaObject.title, + }, + ] + : []), + ...(schemaObject.example + ? [ + { + tagName: "example", + text: JSON.stringify(schemaObject.example, null, 2), + }, + ] + : []), + ].filter(Boolean), + }, + ] + : [], + declarations: [ + { + name: validatorName, + initializer: schemaToValidator(validators, schemaObject), + }, + ], + }); +} + +/** + * Creates validator schemas for operation input (body, params, query) in the + * valibot file. Returns the schema names for use in middleware generation. + */ +export function createValidatorForOperationInput( + validatorSchemas: Map, + valibotFile: SourceFile, + commandName: string, + input: { + body?: oas30.SchemaObject | oas31.SchemaObject | oas31.ReferenceObject; + params: oas30.ParameterObject[]; + query: oas30.ParameterObject[]; + }, +): { json?: string; param?: string; query?: string } { + const schemas: { json?: string; param?: string; query?: string } = {}; + + // 1. Generate the JSON Body Schema + if (input.body) { + const name = camelcase([commandName, "body", "schema"]); + schemas.json = name; + valibotFile.addVariableStatement({ + isExported: true, + declarationKind: VariableDeclarationKind.Const, + declarations: [ + { + name, + initializer: schemaToValidator(validatorSchemas, input.body), + }, + ], + }); + } + + // 2. Helper for Params/Query (Strict Objects) + const addParams = ( + type: "params" | "query", + list: oas30.ParameterObject[], + ) => { + if (list.length === 0) return; + const name = camelcase([commandName, type, "schema"]); + schemas[type === "params" ? "param" : "query"] = name; + + const propertyMap = Object.fromEntries( + list.map((p) => [ + JSON.stringify(p.name), + p.required + ? schemaToValidator(validatorSchemas, p.schema ?? { type: "string" }) + : vcall( + "exactOptional", + schemaToValidator( + validatorSchemas, + p.schema ?? { type: "string" }, + ), + ), + ]), + ); + + valibotFile.addVariableStatement({ + isExported: true, + declarationKind: VariableDeclarationKind.Const, + declarations: [ + { + name, + initializer: vcall("strictObject", Writers.object(propertyMap)), + }, + ], + }); + }; + + addParams("params", input.params); + addParams("query", input.query); + + return schemas; +} diff --git a/package.json b/package.json index 9bf59db..4803a91 100644 --- a/package.json +++ b/package.json @@ -1,70 +1,66 @@ { - "name": "@block65/openapi-codegen", - "version": "8.0.1", - "private": false, - "license": "UNLICENSED", - "sideEffects": false, - "type": "module", - "exports": { - ".": { - "types": "./dist/lib/index.d.ts", - "default": "./dist/lib/index.js" - } - }, - "bin": { - "openapi-codegen": "./dist/bin/index.js" - }, - "files": [ - "dist/bin/*.js", - "dist/bin/*.d.ts", - "dist/lib/*.js", - "dist/lib/*.d.ts" - ], - "scripts": { - "preversion": "make test" - }, - "dependencies": { - "@apidevtools/json-schema-ref-parser": "^11.7.0", - "@block65/eslint-config": "^12.0.1", - "camelcase": "^8.0.0", - "prettier": "^3.3.3", - "toposort": "^2.0.2", - "ts-morph": "^23.0.0", - "type-fest": "^4.26.1", - "word-wrap": "^1.2.5", - "yargs": "^17.7.2" - }, - "devDependencies": { - "@babel/core": "^7.25.2", - "@babel/preset-env": "^7.25.4", - "@babel/preset-typescript": "^7.24.7", - "@block65/rest-client": "^11.0.3", - "@hapi/bourne": "^3.0.0", - "@ts-morph/common": "^0.24.0", - "@types/eslint": "^8.56.12", - "@types/node": "^22.7.4", - "@types/toposort": "^2.0.7", - "@types/yargs": "^17.0.33", - "@typescript-eslint/eslint-plugin": "^7.18.0", - "@typescript-eslint/parser": "^7.18.0", - "eslint": "^8.57.1", - "eslint-plugin-import": "^2.30.0", - "eslint-plugin-jsx-a11y": "^6.10.0", - "eslint-plugin-prettier": "^5.2.1", - "eslint-plugin-react": "^7.37.1", - "eslint-plugin-react-hooks": "^4.6.2", - "js-yaml": "^4.1.0", - "openapi3-ts": "^4.4.0", - "prettier": "^2.8.8", - "typescript": "^5.6.2", - "undici": "^6.19.8", - "vitest": "^2.1.1" - }, - "peerDependencies": { - "@block65/rest-client": "^11.0.3" - }, - "packageManager": "pnpm@9.9.0+sha512.60c18acd138bff695d339be6ad13f7e936eea6745660d4cc4a776d5247c540d0edee1a563695c183a66eb917ef88f2b4feb1fc25f32a7adcadc7aaf3438e99c1", - "engines": { - "node": ">=20.0.0" - } + "name": "@block65/openapi-codegen", + "version": "9.0.0", + "private": false, + "license": "UNLICENSED", + "repository": { + "type": "git", + "url": "https://github.com/block65/openapi-codegen" + }, + "sideEffects": false, + "type": "module", + "bin": { + "openapi-codegen": "./bin/index.ts" + }, + "files": [ + "bin", + "lib" + ], + "scripts": { + "preversion": "make test" + }, + "dependencies": { + "@apidevtools/json-schema-ref-parser": "^15.2.2", + "camelcase": "^9.0.0", + "toposort": "^2.0.2", + "ts-morph": "^27.0.2", + "type-fest": "^5.0.0", + "word-wrap": "^1.2.5", + "yargs": "^18.0.0" + }, + "devDependencies": { + "@biomejs/biome": "^2.0.0", + "@block65/custom-error": "^14.0.0", + "@block65/rest-client": "^12.0.2", + "@hapi/bourne": "^3.0.0", + "@ts-morph/common": "^0.28.1", + "@tsconfig/node24": "^24.0.0", + "@tsconfig/strictest": "^2.0.0", + "@types/eslint": "^9.6.1", + "@types/node": "^24.0.0", + "@types/toposort": "^2.0.7", + "@types/yargs": "^17.0.35", + "@typescript-eslint/eslint-plugin": "^8.53.1", + "@typescript-eslint/parser": "^8.53.1", + "eslint": "^9.0.0", + "eslint-plugin-import": "^2.32.0", + "hono": "^4.0.0", + "js-yaml": "^4.1.1", + "openapi3-ts": "^4.0.0", + "prettier": "^3.8.1", + "typescript": "^5.8.0", + "undici": "^7.19.0", + "valibot": "^1.0.0", + "vitest": "^3.0.0" + }, + "peerDependencies": { + "@block65/custom-error": "^14.0.0", + "@block65/rest-client": "^12.0.0", + "hono": "^4.0.0", + "valibot": "^1.0.0" + }, + "engines": { + "node": ">=24.0.0" + }, + "packageManager": "pnpm@10.30.3" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f0cbb11..66c6ca8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,746 +9,169 @@ importers: .: dependencies: '@apidevtools/json-schema-ref-parser': - specifier: ^11.7.0 - version: 11.7.0 - '@block65/eslint-config': - specifier: ^12.0.1 - version: 12.0.1(@typescript-eslint/eslint-plugin@7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1)(typescript@5.6.2))(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint-plugin-import@2.30.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1))(eslint-plugin-jsx-a11y@6.10.0(eslint@8.57.1))(eslint-plugin-react-hooks@4.6.2(eslint@8.57.1))(eslint-plugin-react@7.37.1(eslint@8.57.1))(eslint@8.57.1)(prettier@3.3.3)(typescript@5.6.2) + specifier: ^15.2.2 + version: 15.3.1(@types/json-schema@7.0.15) camelcase: - specifier: ^8.0.0 - version: 8.0.0 - prettier: - specifier: ^3.3.3 - version: 3.3.3 + specifier: ^9.0.0 + version: 9.0.0 toposort: specifier: ^2.0.2 version: 2.0.2 ts-morph: - specifier: ^23.0.0 - version: 23.0.0 + specifier: ^27.0.2 + version: 27.0.2 type-fest: - specifier: ^4.26.1 - version: 4.26.1 + specifier: ^5.0.0 + version: 5.4.4 word-wrap: specifier: ^1.2.5 version: 1.2.5 yargs: - specifier: ^17.7.2 - version: 17.7.2 + specifier: ^18.0.0 + version: 18.0.0 devDependencies: - '@babel/core': - specifier: ^7.25.2 - version: 7.25.2 - '@babel/preset-env': - specifier: ^7.25.4 - version: 7.25.4(@babel/core@7.25.2) - '@babel/preset-typescript': - specifier: ^7.24.7 - version: 7.24.7(@babel/core@7.25.2) + '@biomejs/biome': + specifier: ^2.0.0 + version: 2.4.6 + '@block65/custom-error': + specifier: ^14.0.0 + version: 14.0.0 '@block65/rest-client': - specifier: ^11.0.3 - version: 11.0.3 + specifier: ^12.0.2 + version: 12.0.2 '@hapi/bourne': specifier: ^3.0.0 version: 3.0.0 '@ts-morph/common': - specifier: ^0.24.0 - version: 0.24.0 + specifier: ^0.28.1 + version: 0.28.1 + '@tsconfig/node24': + specifier: ^24.0.0 + version: 24.0.4 + '@tsconfig/strictest': + specifier: ^2.0.0 + version: 2.0.8 '@types/eslint': - specifier: ^8.56.12 - version: 8.56.12 + specifier: ^9.6.1 + version: 9.6.1 '@types/node': - specifier: ^22.7.4 - version: 22.7.4 + specifier: ^24.0.0 + version: 24.12.0 '@types/toposort': specifier: ^2.0.7 version: 2.0.7 '@types/yargs': - specifier: ^17.0.33 - version: 17.0.33 + specifier: ^17.0.35 + version: 17.0.35 '@typescript-eslint/eslint-plugin': - specifier: ^7.18.0 - version: 7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1)(typescript@5.6.2) + specifier: ^8.53.1 + version: 8.56.1(@typescript-eslint/parser@8.56.1(eslint@9.39.3)(typescript@5.9.3))(eslint@9.39.3)(typescript@5.9.3) '@typescript-eslint/parser': - specifier: ^7.18.0 - version: 7.18.0(eslint@8.57.1)(typescript@5.6.2) + specifier: ^8.53.1 + version: 8.56.1(eslint@9.39.3)(typescript@5.9.3) eslint: - specifier: ^8.57.1 - version: 8.57.1 + specifier: ^9.0.0 + version: 9.39.3 eslint-plugin-import: - specifier: ^2.30.0 - version: 2.30.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1) - eslint-plugin-jsx-a11y: - specifier: ^6.10.0 - version: 6.10.0(eslint@8.57.1) - eslint-plugin-prettier: - specifier: ^5.2.1 - version: 5.2.1(@types/eslint@8.56.12)(eslint-config-prettier@9.1.0(eslint@8.57.1))(eslint@8.57.1)(prettier@3.3.3) - eslint-plugin-react: - specifier: ^7.37.1 - version: 7.37.1(eslint@8.57.1) - eslint-plugin-react-hooks: - specifier: ^4.6.2 - version: 4.6.2(eslint@8.57.1) + specifier: ^2.32.0 + version: 2.32.0(@typescript-eslint/parser@8.56.1(eslint@9.39.3)(typescript@5.9.3))(eslint@9.39.3) + hono: + specifier: ^4.0.0 + version: 4.12.5 js-yaml: - specifier: ^4.1.0 - version: 4.1.0 + specifier: ^4.1.1 + version: 4.1.1 openapi3-ts: - specifier: ^4.4.0 + specifier: ^4.0.0 version: 4.4.0 + prettier: + specifier: ^3.8.1 + version: 3.8.1 typescript: - specifier: ^5.6.2 - version: 5.6.2 + specifier: ^5.8.0 + version: 5.9.3 undici: - specifier: ^6.19.8 - version: 6.19.8 + specifier: ^7.19.0 + version: 7.22.0 + valibot: + specifier: ^1.0.0 + version: 1.2.0(typescript@5.9.3) vitest: - specifier: ^2.1.1 - version: 2.1.1(@types/node@22.7.4) + specifier: ^3.0.0 + version: 3.2.4(@types/node@24.12.0) packages: - '@ampproject/remapping@2.3.0': - resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==} - engines: {node: '>=6.0.0'} - - '@apidevtools/json-schema-ref-parser@11.7.0': - resolution: {integrity: sha512-pRrmXMCwnmrkS3MLgAIW5dXRzeTv6GLjkjb4HmxNnvAKXN1Nfzp4KmGADBQvlVUcqi+a5D+hfGDLLnd5NnYxog==} - engines: {node: '>= 16'} - - '@babel/code-frame@7.24.7': - resolution: {integrity: sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==} - engines: {node: '>=6.9.0'} - - '@babel/compat-data@7.25.4': - resolution: {integrity: sha512-+LGRog6RAsCJrrrg/IO6LGmpphNe5DiK30dGjCoxxeGv49B10/3XYGxPsAwrDlMFcFEvdAUavDT8r9k/hSyQqQ==} - engines: {node: '>=6.9.0'} - - '@babel/core@7.25.2': - resolution: {integrity: sha512-BBt3opiCOxUr9euZ5/ro/Xv8/V7yJ5bjYMqG/C1YAo8MIKAnumZalCN+msbci3Pigy4lIQfPUpfMM27HMGaYEA==} - engines: {node: '>=6.9.0'} - - '@babel/generator@7.25.6': - resolution: {integrity: sha512-VPC82gr1seXOpkjAAKoLhP50vx4vGNlF4msF64dSFq1P8RfB+QAuJWGHPXXPc8QyfVWwwB/TNNU4+ayZmHNbZw==} - engines: {node: '>=6.9.0'} - - '@babel/helper-annotate-as-pure@7.24.7': - resolution: {integrity: sha512-BaDeOonYvhdKw+JoMVkAixAAJzG2jVPIwWoKBPdYuY9b452e2rPuI9QPYh3KpofZ3pW2akOmwZLOiOsHMiqRAg==} - engines: {node: '>=6.9.0'} - - '@babel/helper-builder-binary-assignment-operator-visitor@7.24.7': - resolution: {integrity: sha512-xZeCVVdwb4MsDBkkyZ64tReWYrLRHlMN72vP7Bdm3OUOuyFZExhsHUUnuWnm2/XOlAJzR0LfPpB56WXZn0X/lA==} - engines: {node: '>=6.9.0'} - - '@babel/helper-compilation-targets@7.25.2': - resolution: {integrity: sha512-U2U5LsSaZ7TAt3cfaymQ8WHh0pxvdHoEk6HVpaexxixjyEquMh0L0YNJNM6CTGKMXV1iksi0iZkGw4AcFkPaaw==} - engines: {node: '>=6.9.0'} - - '@babel/helper-create-class-features-plugin@7.25.4': - resolution: {integrity: sha512-ro/bFs3/84MDgDmMwbcHgDa8/E6J3QKNTk4xJJnVeFtGE+tL0K26E3pNxhYz2b67fJpt7Aphw5XcploKXuCvCQ==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0 - - '@babel/helper-create-regexp-features-plugin@7.25.2': - resolution: {integrity: sha512-+wqVGP+DFmqwFD3EH6TMTfUNeqDehV3E/dl+Sd54eaXqm17tEUNbEIn4sVivVowbvUpOtIGxdo3GoXyDH9N/9g==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0 - - '@babel/helper-define-polyfill-provider@0.6.2': - resolution: {integrity: sha512-LV76g+C502biUK6AyZ3LK10vDpDyCzZnhZFXkH1L75zHPj68+qc8Zfpx2th+gzwA2MzyK+1g/3EPl62yFnVttQ==} - peerDependencies: - '@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0 - - '@babel/helper-member-expression-to-functions@7.24.8': - resolution: {integrity: sha512-LABppdt+Lp/RlBxqrh4qgf1oEH/WxdzQNDJIu5gC/W1GyvPVrOBiItmmM8wan2fm4oYqFuFfkXmlGpLQhPY8CA==} - engines: {node: '>=6.9.0'} - - '@babel/helper-module-imports@7.24.7': - resolution: {integrity: sha512-8AyH3C+74cgCVVXow/myrynrAGv+nTVg5vKu2nZph9x7RcRwzmh0VFallJuFTZ9mx6u4eSdXZfcOzSqTUm0HCA==} - engines: {node: '>=6.9.0'} - - '@babel/helper-module-transforms@7.25.2': - resolution: {integrity: sha512-BjyRAbix6j/wv83ftcVJmBt72QtHI56C7JXZoG2xATiLpmoC7dpd8WnkikExHDVPpi/3qCmO6WY1EaXOluiecQ==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0 - - '@babel/helper-optimise-call-expression@7.24.7': - resolution: {integrity: sha512-jKiTsW2xmWwxT1ixIdfXUZp+P5yURx2suzLZr5Hi64rURpDYdMW0pv+Uf17EYk2Rd428Lx4tLsnjGJzYKDM/6A==} - engines: {node: '>=6.9.0'} - - '@babel/helper-plugin-utils@7.24.8': - resolution: {integrity: sha512-FFWx5142D8h2Mgr/iPVGH5G7w6jDn4jUSpZTyDnQO0Yn7Ks2Kuz6Pci8H6MPCoUJegd/UZQ3tAvfLCxQSnWWwg==} - engines: {node: '>=6.9.0'} - - '@babel/helper-remap-async-to-generator@7.25.0': - resolution: {integrity: sha512-NhavI2eWEIz/H9dbrG0TuOicDhNexze43i5z7lEqwYm0WEZVTwnPpA0EafUTP7+6/W79HWIP2cTe3Z5NiSTVpw==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0 - - '@babel/helper-replace-supers@7.25.0': - resolution: {integrity: sha512-q688zIvQVYtZu+i2PsdIu/uWGRpfxzr5WESsfpShfZECkO+d2o+WROWezCi/Q6kJ0tfPa5+pUGUlfx2HhrA3Bg==} - engines: {node: '>=6.9.0'} + '@apidevtools/json-schema-ref-parser@15.3.1': + resolution: {integrity: sha512-FIweGOR9zrNuskfDXn8dfsA4eJEe8LmmGsGSDikEZvgYm36SO36yMhasXSOX7/OTGZ3b7I9iPhOxB24D8xL5uQ==} + engines: {node: '>=20'} peerDependencies: - '@babel/core': ^7.0.0 - - '@babel/helper-simple-access@7.24.7': - resolution: {integrity: sha512-zBAIvbCMh5Ts+b86r/CjU+4XGYIs+R1j951gxI3KmmxBMhCg4oQMsv6ZXQ64XOm/cvzfU1FmoCyt6+owc5QMYg==} - engines: {node: '>=6.9.0'} - - '@babel/helper-skip-transparent-expression-wrappers@7.24.7': - resolution: {integrity: sha512-IO+DLT3LQUElMbpzlatRASEyQtfhSE0+m465v++3jyyXeBTBUjtVZg28/gHeV5mrTJqvEKhKroBGAvhW+qPHiQ==} - engines: {node: '>=6.9.0'} - - '@babel/helper-string-parser@7.24.8': - resolution: {integrity: sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ==} - engines: {node: '>=6.9.0'} - - '@babel/helper-validator-identifier@7.24.7': - resolution: {integrity: sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==} - engines: {node: '>=6.9.0'} - - '@babel/helper-validator-option@7.24.8': - resolution: {integrity: sha512-xb8t9tD1MHLungh/AIoWYN+gVHaB9kwlu8gffXGSt3FFEIT7RjS+xWbc2vUD1UTZdIpKj/ab3rdqJ7ufngyi2Q==} - engines: {node: '>=6.9.0'} + '@types/json-schema': ^7.0.15 - '@babel/helper-wrap-function@7.25.0': - resolution: {integrity: sha512-s6Q1ebqutSiZnEjaofc/UKDyC4SbzV5n5SrA2Gq8UawLycr3i04f1dX4OzoQVnexm6aOCh37SQNYlJ/8Ku+PMQ==} - engines: {node: '>=6.9.0'} - - '@babel/helpers@7.25.6': - resolution: {integrity: sha512-Xg0tn4HcfTijTwfDwYlvVCl43V6h4KyVVX2aEm4qdO/PC6L2YvzLHFdmxhoeSA3eslcE6+ZVXHgWwopXYLNq4Q==} - engines: {node: '>=6.9.0'} - - '@babel/highlight@7.24.7': - resolution: {integrity: sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==} - engines: {node: '>=6.9.0'} - - '@babel/parser@7.25.6': - resolution: {integrity: sha512-trGdfBdbD0l1ZPmcJ83eNxB9rbEax4ALFTF7fN386TMYbeCQbyme5cOEXQhbGXKebwGaB/J52w1mrklMcbgy6Q==} - engines: {node: '>=6.0.0'} + '@biomejs/biome@2.4.6': + resolution: {integrity: sha512-QnHe81PMslpy3mnpL8DnO2M4S4ZnYPkjlGCLWBZT/3R9M6b5daArWMMtEfP52/n174RKnwRIf3oT8+wc9ihSfQ==} + engines: {node: '>=14.21.3'} hasBin: true - '@babel/plugin-bugfix-firefox-class-in-computed-class-key@7.25.3': - resolution: {integrity: sha512-wUrcsxZg6rqBXG05HG1FPYgsP6EvwF4WpBbxIpWIIYnH8wG0gzx3yZY3dtEHas4sTAOGkbTsc9EGPxwff8lRoA==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0 - - '@babel/plugin-bugfix-safari-class-field-initializer-scope@7.25.0': - resolution: {integrity: sha512-Bm4bH2qsX880b/3ziJ8KD711LT7z4u8CFudmjqle65AZj/HNUFhEf90dqYv6O86buWvSBmeQDjv0Tn2aF/bIBA==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0 - - '@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@7.25.0': - resolution: {integrity: sha512-lXwdNZtTmeVOOFtwM/WDe7yg1PL8sYhRk/XH0FzbR2HDQ0xC+EnQ/JHeoMYSavtU115tnUk0q9CDyq8si+LMAA==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0 - - '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.24.7': - resolution: {integrity: sha512-+izXIbke1T33mY4MSNnrqhPXDz01WYhEf3yF5NbnUtkiNnm+XBZJl3kNfoK6NKmYlz/D07+l2GWVK/QfDkNCuQ==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.13.0 - - '@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@7.25.0': - resolution: {integrity: sha512-tggFrk1AIShG/RUQbEwt2Tr/E+ObkfwrPjR6BjbRvsx24+PSjK8zrq0GWPNCjo8qpRx4DuJzlcvWJqlm+0h3kw==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0 - - '@babel/plugin-proposal-private-property-in-object@7.21.0-placeholder-for-preset-env.2': - resolution: {integrity: sha512-SOSkfJDddaM7mak6cPEpswyTRnuRltl429hMraQEglW+OkovnCzsiszTmsrlY//qLFjCpQDFRvjdm2wA5pPm9w==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-async-generators@7.8.4': - resolution: {integrity: sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-class-properties@7.12.13': - resolution: {integrity: sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-class-static-block@7.14.5': - resolution: {integrity: sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-dynamic-import@7.8.3': - resolution: {integrity: sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-export-namespace-from@7.8.3': - resolution: {integrity: sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-import-assertions@7.25.6': - resolution: {integrity: sha512-aABl0jHw9bZ2karQ/uUD6XP4u0SG22SJrOHFoL6XB1R7dTovOP4TzTlsxOYC5yQ1pdscVK2JTUnF6QL3ARoAiQ==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-import-attributes@7.25.6': - resolution: {integrity: sha512-sXaDXaJN9SNLymBdlWFA+bjzBhFD617ZaFiY13dGt7TVslVvVgA6fkZOP7Ki3IGElC45lwHdOTrCtKZGVAWeLQ==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-import-meta@7.10.4': - resolution: {integrity: sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-json-strings@7.8.3': - resolution: {integrity: sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-jsx@7.24.7': - resolution: {integrity: sha512-6ddciUPe/mpMnOKv/U+RSd2vvVy+Yw/JfBB0ZHYjEZt9NLHmCUylNYlsbqCCS1Bffjlb0fCwC9Vqz+sBz6PsiQ==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-logical-assignment-operators@7.10.4': - resolution: {integrity: sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-nullish-coalescing-operator@7.8.3': - resolution: {integrity: sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-numeric-separator@7.10.4': - resolution: {integrity: sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-object-rest-spread@7.8.3': - resolution: {integrity: sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-optional-catch-binding@7.8.3': - resolution: {integrity: sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-optional-chaining@7.8.3': - resolution: {integrity: sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-private-property-in-object@7.14.5': - resolution: {integrity: sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-top-level-await@7.14.5': - resolution: {integrity: sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-typescript@7.25.4': - resolution: {integrity: sha512-uMOCoHVU52BsSWxPOMVv5qKRdeSlPuImUCB2dlPuBSU+W2/ROE7/Zg8F2Kepbk+8yBa68LlRKxO+xgEVWorsDg==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-unicode-sets-regex@7.18.6': - resolution: {integrity: sha512-727YkEAPwSIQTv5im8QHz3upqp92JTWhidIC81Tdx4VJYIte/VndKf1qKrfnnhPLiPghStWfvC/iFaMCQu7Nqg==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0 - - '@babel/plugin-transform-arrow-functions@7.24.7': - resolution: {integrity: sha512-Dt9LQs6iEY++gXUwY03DNFat5C2NbO48jj+j/bSAz6b3HgPs39qcPiYt77fDObIcFwj3/C2ICX9YMwGflUoSHQ==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-async-generator-functions@7.25.4': - resolution: {integrity: sha512-jz8cV2XDDTqjKPwVPJBIjORVEmSGYhdRa8e5k5+vN+uwcjSrSxUaebBRa4ko1jqNF2uxyg8G6XYk30Jv285xzg==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-async-to-generator@7.24.7': - resolution: {integrity: sha512-SQY01PcJfmQ+4Ash7NE+rpbLFbmqA2GPIgqzxfFTL4t1FKRq4zTms/7htKpoCUI9OcFYgzqfmCdH53s6/jn5fA==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-block-scoped-functions@7.24.7': - resolution: {integrity: sha512-yO7RAz6EsVQDaBH18IDJcMB1HnrUn2FJ/Jslc/WtPPWcjhpUJXU/rjbwmluzp7v/ZzWcEhTMXELnnsz8djWDwQ==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-block-scoping@7.25.0': - resolution: {integrity: sha512-yBQjYoOjXlFv9nlXb3f1casSHOZkWr29NX+zChVanLg5Nc157CrbEX9D7hxxtTpuFy7Q0YzmmWfJxzvps4kXrQ==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-class-properties@7.25.4': - resolution: {integrity: sha512-nZeZHyCWPfjkdU5pA/uHiTaDAFUEqkpzf1YoQT2NeSynCGYq9rxfyI3XpQbfx/a0hSnFH6TGlEXvae5Vi7GD8g==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-class-static-block@7.24.7': - resolution: {integrity: sha512-HMXK3WbBPpZQufbMG4B46A90PkuuhN9vBCb5T8+VAHqvAqvcLi+2cKoukcpmUYkszLhScU3l1iudhrks3DggRQ==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.12.0 - - '@babel/plugin-transform-classes@7.25.4': - resolution: {integrity: sha512-oexUfaQle2pF/b6E0dwsxQtAol9TLSO88kQvym6HHBWFliV2lGdrPieX+WgMRLSJDVzdYywk7jXbLPuO2KLTLg==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-computed-properties@7.24.7': - resolution: {integrity: sha512-25cS7v+707Gu6Ds2oY6tCkUwsJ9YIDbggd9+cu9jzzDgiNq7hR/8dkzxWfKWnTic26vsI3EsCXNd4iEB6e8esQ==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-destructuring@7.24.8': - resolution: {integrity: sha512-36e87mfY8TnRxc7yc6M9g9gOB7rKgSahqkIKwLpz4Ppk2+zC2Cy1is0uwtuSG6AE4zlTOUa+7JGz9jCJGLqQFQ==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-dotall-regex@7.24.7': - resolution: {integrity: sha512-ZOA3W+1RRTSWvyqcMJDLqbchh7U4NRGqwRfFSVbOLS/ePIP4vHB5e8T8eXcuqyN1QkgKyj5wuW0lcS85v4CrSw==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-duplicate-keys@7.24.7': - resolution: {integrity: sha512-JdYfXyCRihAe46jUIliuL2/s0x0wObgwwiGxw/UbgJBr20gQBThrokO4nYKgWkD7uBaqM7+9x5TU7NkExZJyzw==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-duplicate-named-capturing-groups-regex@7.25.0': - resolution: {integrity: sha512-YLpb4LlYSc3sCUa35un84poXoraOiQucUTTu8X1j18JV+gNa8E0nyUf/CjZ171IRGr4jEguF+vzJU66QZhn29g==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0 - - '@babel/plugin-transform-dynamic-import@7.24.7': - resolution: {integrity: sha512-sc3X26PhZQDb3JhORmakcbvkeInvxz+A8oda99lj7J60QRuPZvNAk9wQlTBS1ZynelDrDmTU4pw1tyc5d5ZMUg==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-exponentiation-operator@7.24.7': - resolution: {integrity: sha512-Rqe/vSc9OYgDajNIK35u7ot+KeCoetqQYFXM4Epf7M7ez3lWlOjrDjrwMei6caCVhfdw+mIKD4cgdGNy5JQotQ==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-export-namespace-from@7.24.7': - resolution: {integrity: sha512-v0K9uNYsPL3oXZ/7F9NNIbAj2jv1whUEtyA6aujhekLs56R++JDQuzRcP2/z4WX5Vg/c5lE9uWZA0/iUoFhLTA==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-for-of@7.24.7': - resolution: {integrity: sha512-wo9ogrDG1ITTTBsy46oGiN1dS9A7MROBTcYsfS8DtsImMkHk9JXJ3EWQM6X2SUw4x80uGPlwj0o00Uoc6nEE3g==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-function-name@7.25.1': - resolution: {integrity: sha512-TVVJVdW9RKMNgJJlLtHsKDTydjZAbwIsn6ySBPQaEAUU5+gVvlJt/9nRmqVbsV/IBanRjzWoaAQKLoamWVOUuA==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-json-strings@7.24.7': - resolution: {integrity: sha512-2yFnBGDvRuxAaE/f0vfBKvtnvvqU8tGpMHqMNpTN2oWMKIR3NqFkjaAgGwawhqK/pIN2T3XdjGPdaG0vDhOBGw==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-literals@7.25.2': - resolution: {integrity: sha512-HQI+HcTbm9ur3Z2DkO+jgESMAMcYLuN/A7NRw9juzxAezN9AvqvUTnpKP/9kkYANz6u7dFlAyOu44ejuGySlfw==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-logical-assignment-operators@7.24.7': - resolution: {integrity: sha512-4D2tpwlQ1odXmTEIFWy9ELJcZHqrStlzK/dAOWYyxX3zT0iXQB6banjgeOJQXzEc4S0E0a5A+hahxPaEFYftsw==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-member-expression-literals@7.24.7': - resolution: {integrity: sha512-T/hRC1uqrzXMKLQ6UCwMT85S3EvqaBXDGf0FaMf4446Qx9vKwlghvee0+uuZcDUCZU5RuNi4781UQ7R308zzBw==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-modules-amd@7.24.7': - resolution: {integrity: sha512-9+pB1qxV3vs/8Hdmz/CulFB8w2tuu6EB94JZFsjdqxQokwGa9Unap7Bo2gGBGIvPmDIVvQrom7r5m/TCDMURhg==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-modules-commonjs@7.24.8': - resolution: {integrity: sha512-WHsk9H8XxRs3JXKWFiqtQebdh9b/pTk4EgueygFzYlTKAg0Ud985mSevdNjdXdFBATSKVJGQXP1tv6aGbssLKA==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-modules-systemjs@7.25.0': - resolution: {integrity: sha512-YPJfjQPDXxyQWg/0+jHKj1llnY5f/R6a0p/vP4lPymxLu7Lvl4k2WMitqi08yxwQcCVUUdG9LCUj4TNEgAp3Jw==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-modules-umd@7.24.7': - resolution: {integrity: sha512-3aytQvqJ/h9z4g8AsKPLvD4Zqi2qT+L3j7XoFFu1XBlZWEl2/1kWnhmAbxpLgPrHSY0M6UA02jyTiwUVtiKR6A==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-named-capturing-groups-regex@7.24.7': - resolution: {integrity: sha512-/jr7h/EWeJtk1U/uz2jlsCioHkZk1JJZVcc8oQsJ1dUlaJD83f4/6Zeh2aHt9BIFokHIsSeDfhUmju0+1GPd6g==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0 - - '@babel/plugin-transform-new-target@7.24.7': - resolution: {integrity: sha512-RNKwfRIXg4Ls/8mMTza5oPF5RkOW8Wy/WgMAp1/F1yZ8mMbtwXW+HDoJiOsagWrAhI5f57Vncrmr9XeT4CVapA==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-nullish-coalescing-operator@7.24.7': - resolution: {integrity: sha512-Ts7xQVk1OEocqzm8rHMXHlxvsfZ0cEF2yomUqpKENHWMF4zKk175Y4q8H5knJes6PgYad50uuRmt3UJuhBw8pQ==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-numeric-separator@7.24.7': - resolution: {integrity: sha512-e6q1TiVUzvH9KRvicuxdBTUj4AdKSRwzIyFFnfnezpCfP2/7Qmbb8qbU2j7GODbl4JMkblitCQjKYUaX/qkkwA==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-object-rest-spread@7.24.7': - resolution: {integrity: sha512-4QrHAr0aXQCEFni2q4DqKLD31n2DL+RxcwnNjDFkSG0eNQ/xCavnRkfCUjsyqGC2OviNJvZOF/mQqZBw7i2C5Q==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-object-super@7.24.7': - resolution: {integrity: sha512-A/vVLwN6lBrMFmMDmPPz0jnE6ZGx7Jq7d6sT/Ev4H65RER6pZ+kczlf1DthF5N0qaPHBsI7UXiE8Zy66nmAovg==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-optional-catch-binding@7.24.7': - resolution: {integrity: sha512-uLEndKqP5BfBbC/5jTwPxLh9kqPWWgzN/f8w6UwAIirAEqiIVJWWY312X72Eub09g5KF9+Zn7+hT7sDxmhRuKA==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-optional-chaining@7.24.8': - resolution: {integrity: sha512-5cTOLSMs9eypEy8JUVvIKOu6NgvbJMnpG62VpIHrTmROdQ+L5mDAaI40g25k5vXti55JWNX5jCkq3HZxXBQANw==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-parameters@7.24.7': - resolution: {integrity: sha512-yGWW5Rr+sQOhK0Ot8hjDJuxU3XLRQGflvT4lhlSY0DFvdb3TwKaY26CJzHtYllU0vT9j58hc37ndFPsqT1SrzA==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-private-methods@7.25.4': - resolution: {integrity: sha512-ao8BG7E2b/URaUQGqN3Tlsg+M3KlHY6rJ1O1gXAEUnZoyNQnvKyH87Kfg+FoxSeyWUB8ISZZsC91C44ZuBFytw==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-private-property-in-object@7.24.7': - resolution: {integrity: sha512-9z76mxwnwFxMyxZWEgdgECQglF2Q7cFLm0kMf8pGwt+GSJsY0cONKj/UuO4bOH0w/uAel3ekS4ra5CEAyJRmDA==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-property-literals@7.24.7': - resolution: {integrity: sha512-EMi4MLQSHfd2nrCqQEWxFdha2gBCqU4ZcCng4WBGZ5CJL4bBRW0ptdqqDdeirGZcpALazVVNJqRmsO8/+oNCBA==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-regenerator@7.24.7': - resolution: {integrity: sha512-lq3fvXPdimDrlg6LWBoqj+r/DEWgONuwjuOuQCSYgRroXDH/IdM1C0IZf59fL5cHLpjEH/O6opIRBbqv7ELnuA==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-reserved-words@7.24.7': - resolution: {integrity: sha512-0DUq0pHcPKbjFZCfTss/pGkYMfy3vFWydkUBd9r0GHpIyfs2eCDENvqadMycRS9wZCXR41wucAfJHJmwA0UmoQ==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-shorthand-properties@7.24.7': - resolution: {integrity: sha512-KsDsevZMDsigzbA09+vacnLpmPH4aWjcZjXdyFKGzpplxhbeB4wYtury3vglQkg6KM/xEPKt73eCjPPf1PgXBA==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-spread@7.24.7': - resolution: {integrity: sha512-x96oO0I09dgMDxJaANcRyD4ellXFLLiWhuwDxKZX5g2rWP1bTPkBSwCYv96VDXVT1bD9aPj8tppr5ITIh8hBng==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-sticky-regex@7.24.7': - resolution: {integrity: sha512-kHPSIJc9v24zEml5geKg9Mjx5ULpfncj0wRpYtxbvKyTtHCYDkVE3aHQ03FrpEo4gEe2vrJJS1Y9CJTaThA52g==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-template-literals@7.24.7': - resolution: {integrity: sha512-AfDTQmClklHCOLxtGoP7HkeMw56k1/bTQjwsfhL6pppo/M4TOBSq+jjBUBLmV/4oeFg4GWMavIl44ZeCtmmZTw==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-typeof-symbol@7.24.8': - resolution: {integrity: sha512-adNTUpDCVnmAE58VEqKlAA6ZBlNkMnWD0ZcW76lyNFN3MJniyGFZfNwERVk8Ap56MCnXztmDr19T4mPTztcuaw==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-typescript@7.25.2': - resolution: {integrity: sha512-lBwRvjSmqiMYe/pS0+1gggjJleUJi7NzjvQ1Fkqtt69hBa/0t1YuW/MLQMAPixfwaQOHUXsd6jeU3Z+vdGv3+A==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-unicode-escapes@7.24.7': - resolution: {integrity: sha512-U3ap1gm5+4edc2Q/P+9VrBNhGkfnf+8ZqppY71Bo/pzZmXhhLdqgaUl6cuB07O1+AQJtCLfaOmswiNbSQ9ivhw==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-unicode-property-regex@7.24.7': - resolution: {integrity: sha512-uH2O4OV5M9FZYQrwc7NdVmMxQJOCCzFeYudlZSzUAHRFeOujQefa92E74TQDVskNHCzOXoigEuoyzHDhaEaK5w==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-unicode-regex@7.24.7': - resolution: {integrity: sha512-hlQ96MBZSAXUq7ltkjtu3FJCCSMx/j629ns3hA3pXnBXjanNP0LHi+JpPeA81zaWgVK1VGH95Xuy7u0RyQ8kMg==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-transform-unicode-sets-regex@7.25.4': - resolution: {integrity: sha512-qesBxiWkgN1Q+31xUE9RcMk79eOXXDCv6tfyGMRSs4RGlioSg2WVyQAm07k726cSE56pa+Kb0y9epX2qaXzTvA==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0 - - '@babel/preset-env@7.25.4': - resolution: {integrity: sha512-W9Gyo+KmcxjGahtt3t9fb14vFRWvPpu5pT6GBlovAK6BTBcxgjfVMSQCfJl4oi35ODrxP6xx2Wr8LNST57Mraw==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/preset-modules@0.1.6-no-external-plugins': - resolution: {integrity: sha512-HrcgcIESLm9aIR842yhJ5RWan/gebQUJ6E/E5+rf0y9o6oj7w0Br+sWuL6kEQ/o/AdfvR1Je9jG18/gnpwjEyA==} - peerDependencies: - '@babel/core': ^7.0.0-0 || ^8.0.0-0 <8.0.0 + '@biomejs/cli-darwin-arm64@2.4.6': + resolution: {integrity: sha512-NW18GSyxr+8sJIqgoGwVp5Zqm4SALH4b4gftIA0n62PTuBs6G2tHlwNAOj0Vq0KKSs7Sf88VjjmHh0O36EnzrQ==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [darwin] - '@babel/preset-typescript@7.24.7': - resolution: {integrity: sha512-SyXRe3OdWwIwalxDg5UtJnJQO+YPcTfwiIY2B0Xlddh9o7jpWLvv8X1RthIeDOxQ+O1ML5BLPCONToObyVQVuQ==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 + '@biomejs/cli-darwin-x64@2.4.6': + resolution: {integrity: sha512-4uiE/9tuI7cnjtY9b07RgS7gGyYOAfIAGeVJWEfeCnAarOAS7qVmuRyX6d7JTKw28/mt+rUzMasYeZ+0R/U1Mw==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [darwin] - '@babel/regjsgen@0.8.0': - resolution: {integrity: sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA==} + '@biomejs/cli-linux-arm64-musl@2.4.6': + resolution: {integrity: sha512-F/JdB7eN22txiTqHM5KhIVt0jVkzZwVYrdTR1O3Y4auBOQcXxHK4dxULf4z43QyZI5tsnQJrRBHZy7wwtL+B3A==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [linux] + libc: [musl] - '@babel/runtime@7.25.6': - resolution: {integrity: sha512-VBj9MYyDb9tuLq7yzqjgzt6Q+IBQLrGZfdjOekyEirZPHxXWoTSGUTMrpsfi58Up73d13NfYLv8HT9vmznjzhQ==} - engines: {node: '>=6.9.0'} + '@biomejs/cli-linux-arm64@2.4.6': + resolution: {integrity: sha512-kMLaI7OF5GN1Q8Doymjro1P8rVEoy7BKQALNz6fiR8IC1WKduoNyteBtJlHT7ASIL0Cx2jR6VUOBIbcB1B8pew==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [linux] + libc: [glibc] - '@babel/template@7.25.0': - resolution: {integrity: sha512-aOOgh1/5XzKvg1jvVz7AVrx2piJ2XBi227DHmbY6y+bM9H2FlN+IfecYu4Xl0cNiiVejlsCri89LUsbj8vJD9Q==} - engines: {node: '>=6.9.0'} + '@biomejs/cli-linux-x64-musl@2.4.6': + resolution: {integrity: sha512-C9s98IPDu7DYarjlZNuzJKTjVHN03RUnmHV5htvqsx6vEUXCDSJ59DNwjKVD5XYoSS4N+BYhq3RTBAL8X6svEg==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [linux] + libc: [musl] - '@babel/traverse@7.25.6': - resolution: {integrity: sha512-9Vrcx5ZW6UwK5tvqsj0nGpp/XzqthkT0dqIc9g1AdtygFToNtTF67XzYS//dm+SAK9cp3B9R4ZO/46p63SCjlQ==} - engines: {node: '>=6.9.0'} + '@biomejs/cli-linux-x64@2.4.6': + resolution: {integrity: sha512-oHXmUFEoH8Lql1xfc3QkFLiC1hGR7qedv5eKNlC185or+o4/4HiaU7vYODAH3peRCfsuLr1g6v2fK9dFFOYdyw==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [linux] + libc: [glibc] - '@babel/types@7.25.6': - resolution: {integrity: sha512-/l42B1qxpG6RdfYf343Uw1vmDjeNhneUXtzhojE7pDgfpEypmRhI6j1kr17XCVv4Cgl9HdAiQY2x0GwKm7rWCw==} - engines: {node: '>=6.9.0'} + '@biomejs/cli-win32-arm64@2.4.6': + resolution: {integrity: sha512-xzThn87Pf3YrOGTEODFGONmqXpTwUNxovQb72iaUOdcw8sBSY3+3WD8Hm9IhMYLnPi0n32s3L3NWU6+eSjfqFg==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [win32] - '@block65/custom-error@12.2.0': - resolution: {integrity: sha512-OH3qt4aY9W2kfpI5BY075Mc/M5HNJHjtYkxwUV62OZhKrKQeSUcIXHZkB6H+9YQ5a7D0po3JCouV3egeQDS2pA==} - engines: {node: '>=18.0.0'} + '@biomejs/cli-win32-x64@2.4.6': + resolution: {integrity: sha512-7++XhnsPlr1HDbor5amovPjOH6vsrFOCdp93iKXhFn6bcMUI6soodj3WWKfgEO6JosKU1W5n3uky3WW9RlRjTg==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [win32] - '@block65/eslint-config@12.0.1': - resolution: {integrity: sha512-WmWNVVqudxHcVnS+WtrfZCkVAIIPCuiPiRErT06lJPGC9uw8jKxuOA1yycw3Fc59y/1w/XQVv7y6cCLWmRf03w==} - engines: {node: '>=16'} - peerDependencies: - '@typescript-eslint/eslint-plugin': ^7.10.0 - '@typescript-eslint/parser': ^7.10.0 - eslint: ^8.57.0 - eslint-plugin-formatjs: ^4.13.3 - eslint-plugin-import: ^2.29.1 - eslint-plugin-jsx-a11y: ^6.8.0 - eslint-plugin-react: ^7.34.1 - eslint-plugin-react-hooks: ^4.6.2 - eslint-plugin-react-refresh: ^0.4.7 - eslint-plugin-unicorn: ^53.0.0 - prettier: ^3.2.5 - typescript: ^5.4.5 - peerDependenciesMeta: - eslint-plugin-formatjs: - optional: true - eslint-plugin-jsx-a11y: - optional: true - eslint-plugin-react: - optional: true - eslint-plugin-react-hooks: - optional: true - eslint-plugin-react-refresh: - optional: true - eslint-plugin-unicorn: - optional: true + '@block65/custom-error@14.0.0': + resolution: {integrity: sha512-0tfPO9G/br2ihRJQcGMwk5DylGrBKd12cX0gICsDf66mEsK3yk20tPwPFXItASgE4rfpMiy2M0M29HTyMZhS7A==} + engines: {node: '>=24.0.0'} - '@block65/rest-client@11.0.3': - resolution: {integrity: sha512-SeINosfeH622zmBnPSttf2OgA+26MskC0fQJ/jIc8/hB+dSqmiwA3Ae5baZ+yetNOIVwGJGi6g0cZZDUtDQUcg==} - engines: {node: '>=22.0.0'} + '@block65/rest-client@12.0.2': + resolution: {integrity: sha512-ANQ4IQhGCXro62A99No8puvh7WETziPoZSc1e5H8wMP+fEy+mx2ZKbzq3zraIbpS0TVQis1P0B4gfMdhICgxpA==} + engines: {node: '>=24.0.0'} '@esbuild/aix-ppc64@0.21.5': resolution: {integrity: sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==} @@ -888,80 +311,65 @@ packages: cpu: [x64] os: [win32] - '@eslint-community/eslint-utils@4.4.0': - resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} + '@eslint-community/eslint-utils@4.9.1': + resolution: {integrity: sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 - '@eslint-community/regexpp@4.11.1': - resolution: {integrity: sha512-m4DVN9ZqskZoLU5GlWZadwDnYo3vAEydiUayB9widCl9ffWx2IvPnp6n3on5rJmziJSw9Bv+Z3ChDVdMwXCY8Q==} + '@eslint-community/regexpp@4.12.2': + resolution: {integrity: sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} - '@eslint/eslintrc@2.1.4': - resolution: {integrity: sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - - '@eslint/js@8.57.1': - resolution: {integrity: sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - - '@hapi/bourne@3.0.0': - resolution: {integrity: sha512-Waj1cwPXJDucOib4a3bAISsKJVb15MKi9IvmTI/7ssVEm6sywXGjVJDhl6/umt1pK1ZS7PacXU3A1PmFKHEZ2w==} - - '@humanwhocodes/config-array@0.13.0': - resolution: {integrity: sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==} - engines: {node: '>=10.10.0'} - deprecated: Use @eslint/config-array instead - - '@humanwhocodes/module-importer@1.0.1': - resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==} - engines: {node: '>=12.22'} + '@eslint/config-array@0.21.1': + resolution: {integrity: sha512-aw1gNayWpdI/jSYVgzN5pL0cfzU02GT3NBpeT/DXbx1/1x7ZKxFPd9bwrzygx/qiwIQiJ1sw/zD8qY/kRvlGHA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@humanwhocodes/object-schema@2.0.3': - resolution: {integrity: sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==} - deprecated: Use @eslint/object-schema instead + '@eslint/config-helpers@0.4.2': + resolution: {integrity: sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@jridgewell/gen-mapping@0.3.5': - resolution: {integrity: sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==} - engines: {node: '>=6.0.0'} + '@eslint/core@0.17.0': + resolution: {integrity: sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@jridgewell/resolve-uri@3.1.2': - resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} - engines: {node: '>=6.0.0'} + '@eslint/eslintrc@3.3.4': + resolution: {integrity: sha512-4h4MVF8pmBsncB60r0wSJiIeUKTSD4m7FmTFThG8RHlsg9ajqckLm9OraguFGZE4vVdpiI1Q4+hFnisopmG6gQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@jridgewell/set-array@1.2.1': - resolution: {integrity: sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==} - engines: {node: '>=6.0.0'} + '@eslint/js@9.39.3': + resolution: {integrity: sha512-1B1VkCq6FuUNlQvlBYb+1jDu/gV297TIs/OeiaSR9l1H27SVW55ONE1e1Vp16NqP683+xEGzxYtv4XCiDPaQiw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@jridgewell/sourcemap-codec@1.5.0': - resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==} + '@eslint/object-schema@2.1.7': + resolution: {integrity: sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@jridgewell/trace-mapping@0.3.25': - resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} + '@eslint/plugin-kit@0.4.1': + resolution: {integrity: sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@jsdevtools/ono@7.1.3': - resolution: {integrity: sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==} + '@hapi/bourne@3.0.0': + resolution: {integrity: sha512-Waj1cwPXJDucOib4a3bAISsKJVb15MKi9IvmTI/7ssVEm6sywXGjVJDhl6/umt1pK1ZS7PacXU3A1PmFKHEZ2w==} - '@nodelib/fs.scandir@2.1.5': - resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} - engines: {node: '>= 8'} + '@humanfs/core@0.19.1': + resolution: {integrity: sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==} + engines: {node: '>=18.18.0'} - '@nodelib/fs.stat@2.0.5': - resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} - engines: {node: '>= 8'} + '@humanfs/node@0.16.7': + resolution: {integrity: sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ==} + engines: {node: '>=18.18.0'} - '@nodelib/fs.walk@1.2.8': - resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} - engines: {node: '>= 8'} + '@humanwhocodes/module-importer@1.0.1': + resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==} + engines: {node: '>=12.22'} - '@nolyfill/is-core-module@1.0.39': - resolution: {integrity: sha512-nn5ozdjYQpUCZlWGuxcJY/KpxkWQs4DcbMCmKojjyrYDEAGy4Ce19NN4v5MduafTwJlbKc99UA8YhSVqq9yPZA==} - engines: {node: '>=12.4.0'} + '@humanwhocodes/retry@0.4.3': + resolution: {integrity: sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==} + engines: {node: '>=18.18'} - '@pkgr/core@0.1.1': - resolution: {integrity: sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==} - engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} + '@jridgewell/sourcemap-codec@1.5.5': + resolution: {integrity: sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==} '@rollup/rollup-android-arm-eabi@4.24.0': resolution: {integrity: sha512-Q6HJd7Y6xdB48x8ZNVDOqsbh2uByBhgK8PiQgPhwkIw/HC/YX5Ghq2mQY5sRMZWHb3VsFkWooUVOZHKr7DmDIA==} @@ -987,46 +395,55 @@ packages: resolution: {integrity: sha512-0KXvIJQMOImLCVCz9uvvdPgfyWo93aHHp8ui3FrtOP57svqrF/roSSR5pjqL2hcMp0ljeGlU4q9o/rQaAQ3AYA==} cpu: [arm] os: [linux] + libc: [glibc] '@rollup/rollup-linux-arm-musleabihf@4.24.0': resolution: {integrity: sha512-it2BW6kKFVh8xk/BnHfakEeoLPv8STIISekpoF+nBgWM4d55CZKc7T4Dx1pEbTnYm/xEKMgy1MNtYuoA8RFIWw==} cpu: [arm] os: [linux] + libc: [musl] '@rollup/rollup-linux-arm64-gnu@4.24.0': resolution: {integrity: sha512-i0xTLXjqap2eRfulFVlSnM5dEbTVque/3Pi4g2y7cxrs7+a9De42z4XxKLYJ7+OhE3IgxvfQM7vQc43bwTgPwA==} cpu: [arm64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-arm64-musl@4.24.0': resolution: {integrity: sha512-9E6MKUJhDuDh604Qco5yP/3qn3y7SLXYuiC0Rpr89aMScS2UAmK1wHP2b7KAa1nSjWJc/f/Lc0Wl1L47qjiyQw==} cpu: [arm64] os: [linux] + libc: [musl] '@rollup/rollup-linux-powerpc64le-gnu@4.24.0': resolution: {integrity: sha512-2XFFPJ2XMEiF5Zi2EBf4h73oR1V/lycirxZxHZNc93SqDN/IWhYYSYj8I9381ikUFXZrz2v7r2tOVk2NBwxrWw==} cpu: [ppc64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-riscv64-gnu@4.24.0': resolution: {integrity: sha512-M3Dg4hlwuntUCdzU7KjYqbbd+BLq3JMAOhCKdBE3TcMGMZbKkDdJ5ivNdehOssMCIokNHFOsv7DO4rlEOfyKpg==} cpu: [riscv64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-s390x-gnu@4.24.0': resolution: {integrity: sha512-mjBaoo4ocxJppTorZVKWFpy1bfFj9FeCMJqzlMQGjpNPY9JwQi7OuS1axzNIk0nMX6jSgy6ZURDZ2w0QW6D56g==} cpu: [s390x] os: [linux] + libc: [glibc] '@rollup/rollup-linux-x64-gnu@4.24.0': resolution: {integrity: sha512-ZXFk7M72R0YYFN5q13niV0B7G8/5dcQ9JDp8keJSfr3GoZeXEoMHP/HlvqROA3OMbMdfr19IjCeNAnPUG93b6A==} cpu: [x64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-x64-musl@4.24.0': resolution: {integrity: sha512-w1i+L7kAXZNdYl+vFvzSZy8Y1arS7vMgIy8wusXJzRrPyof5LAb02KGr1PD2EkRcl73kHulIID0M501lN+vobQ==} cpu: [x64] os: [linux] + libc: [musl] '@rollup/rollup-win32-arm64-msvc@4.24.0': resolution: {integrity: sha512-VXBrnPWgBpVDCVY6XF3LEW0pOU51KbaHhccHw6AS6vBWIC60eqsH19DAeeObl+g8nKAz04QFdl/Cefta0xQtUQ==} @@ -1046,11 +463,23 @@ packages: '@rtsao/scc@1.1.0': resolution: {integrity: sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==} - '@ts-morph/common@0.24.0': - resolution: {integrity: sha512-c1xMmNHWpNselmpIqursHeOHHBTIsJLbB+NuovbTTRCNiTLEr/U9dbJ8qy0jd/O2x5pc3seWuOUN5R2IoOTp8A==} + '@ts-morph/common@0.28.1': + resolution: {integrity: sha512-W74iWf7ILp1ZKNYXY5qbddNaml7e9Sedv5lvU1V8lftlitkc9Pq1A+jlH23ltDgWYeZFFEqGCD1Ies9hqu3O+g==} + + '@tsconfig/node24@24.0.4': + resolution: {integrity: sha512-2A933l5P5oCbv6qSxHs7ckKwobs8BDAe9SJ/Xr2Hy+nDlwmLE1GhFh/g/vXGRZWgxBg9nX/5piDtHR9Dkw/XuA==} - '@types/eslint@8.56.12': - resolution: {integrity: sha512-03ruubjWyOHlmljCVoxSuNDdmfZDzsrrz0P2LeJsOXr+ZwFQ+0yQIwNCwt/GYhV7Z31fgtXJTAEs+FYlEL851g==} + '@tsconfig/strictest@2.0.8': + resolution: {integrity: sha512-XnQ7vNz5HRN0r88GYf1J9JJjqtZPiHt2woGJOo2dYqyHGGcd6OLGqSlBB6p1j9mpzja6Oe5BoPqWmeDx6X9rLw==} + + '@types/chai@5.2.3': + resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==} + + '@types/deep-eql@4.0.2': + resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==} + + '@types/eslint@9.6.1': + resolution: {integrity: sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==} '@types/estree@1.0.6': resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==} @@ -1061,11 +490,8 @@ packages: '@types/json5@0.0.29': resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==} - '@types/node@22.7.4': - resolution: {integrity: sha512-y+NPi1rFzDs1NdQHHToqeiX2TIS79SWEAw9GYhkkx8bD0ChpfqC+n2j5OXOCpzfojBEBt6DnEnnG9MY0zk1XLg==} - - '@types/retry@0.12.2': - resolution: {integrity: sha512-XISRgDJ2Tc5q4TRqvgJtzsRkFYNJzZrhTdtMoGVBttwzzQJkPnS3WWTFc7kuDRoPtPakl+T+OfdEUjYJj7Jbow==} + '@types/node@24.12.0': + resolution: {integrity: sha512-GYDxsZi3ChgmckRT9HPU0WEhKLP08ev/Yfcq2AstjrDASOYCSXeyjDsHg4v5t4jOj7cyDX3vmprafKlWIG9MXQ==} '@types/toposort@2.0.7': resolution: {integrity: sha512-sQNk65vbC36+UixCkcky+dCr7MlflHcVILg1FVGqlUntsLFv9xd9ToWIVko/gTuin+cVe16t+2YubEFkhnSuPQ==} @@ -1073,245 +499,213 @@ packages: '@types/yargs-parser@21.0.3': resolution: {integrity: sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==} - '@types/yargs@17.0.33': - resolution: {integrity: sha512-WpxBCKWPLr4xSsHgz511rFJAM+wS28w2zEO1QDNY5zM/S8ok70NNfztH0xwhqKyaK0OHCbN98LDAZuy1ctxDkA==} + '@types/yargs@17.0.35': + resolution: {integrity: sha512-qUHkeCyQFxMXg79wQfTtfndEC+N9ZZg76HJftDJp+qH2tV7Gj4OJi7l+PiWwJ+pWtW8GwSmqsDj/oymhrTWXjg==} - '@typescript-eslint/eslint-plugin@7.18.0': - resolution: {integrity: sha512-94EQTWZ40mzBc42ATNIBimBEDltSJ9RQHCC8vc/PDbxi4k8dVwUAv4o98dk50M1zB+JGFxp43FP7f8+FP8R6Sw==} - engines: {node: ^18.18.0 || >=20.0.0} + '@typescript-eslint/eslint-plugin@8.56.1': + resolution: {integrity: sha512-Jz9ZztpB37dNC+HU2HI28Bs9QXpzCz+y/twHOwhyrIRdbuVDxSytJNDl6z/aAKlaRIwC7y8wJdkBv7FxYGgi0A==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: - '@typescript-eslint/parser': ^7.0.0 - eslint: ^8.56.0 - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true + '@typescript-eslint/parser': ^8.56.1 + eslint: ^8.57.0 || ^9.0.0 || ^10.0.0 + typescript: '>=4.8.4 <6.0.0' - '@typescript-eslint/parser@7.18.0': - resolution: {integrity: sha512-4Z+L8I2OqhZV8qA132M4wNL30ypZGYOQVBfMgxDH/K5UX0PNqTu1c6za9ST5r9+tavvHiTWmBnKzpCJ/GlVFtg==} - engines: {node: ^18.18.0 || >=20.0.0} + '@typescript-eslint/parser@8.56.1': + resolution: {integrity: sha512-klQbnPAAiGYFyI02+znpBRLyjL4/BrBd0nyWkdC0s/6xFLkXYQ8OoRrSkqacS1ddVxf/LDyODIKbQ5TgKAf/Fg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: - eslint: ^8.56.0 - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true + eslint: ^8.57.0 || ^9.0.0 || ^10.0.0 + typescript: '>=4.8.4 <6.0.0' - '@typescript-eslint/scope-manager@7.18.0': - resolution: {integrity: sha512-jjhdIE/FPF2B7Z1uzc6i3oWKbGcHb87Qw7AWj6jmEqNOfDFbJWtjt/XfwCpvNkpGWlcJaog5vTR+VV8+w9JflA==} - engines: {node: ^18.18.0 || >=20.0.0} - - '@typescript-eslint/type-utils@7.18.0': - resolution: {integrity: sha512-XL0FJXuCLaDuX2sYqZUUSOJ2sG5/i1AAze+axqmLnSkNEVMVYLF+cbwlB2w8D1tinFuSikHmFta+P+HOofrLeA==} - engines: {node: ^18.18.0 || >=20.0.0} + '@typescript-eslint/project-service@8.56.1': + resolution: {integrity: sha512-TAdqQTzHNNvlVFfR+hu2PDJrURiwKsUvxFn1M0h95BB8ah5jejas08jUWG4dBA68jDMI988IvtfdAI53JzEHOQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: - eslint: ^8.56.0 - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true + typescript: '>=4.8.4 <6.0.0' - '@typescript-eslint/types@7.18.0': - resolution: {integrity: sha512-iZqi+Ds1y4EDYUtlOOC+aUmxnE9xS/yCigkjA7XpTKV6nCBd3Hp/PRGGmdwnfkV2ThMyYldP1wRpm/id99spTQ==} - engines: {node: ^18.18.0 || >=20.0.0} + '@typescript-eslint/scope-manager@8.56.1': + resolution: {integrity: sha512-YAi4VDKcIZp0O4tz/haYKhmIDZFEUPOreKbfdAN3SzUDMcPhJ8QI99xQXqX+HoUVq8cs85eRKnD+rne2UAnj2w==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/typescript-estree@7.18.0': - resolution: {integrity: sha512-aP1v/BSPnnyhMHts8cf1qQ6Q1IFwwRvAQGRvBFkWlo3/lH29OXA3Pts+c10nxRxIBrDnoMqzhgdwVe5f2D6OzA==} - engines: {node: ^18.18.0 || >=20.0.0} + '@typescript-eslint/tsconfig-utils@8.56.1': + resolution: {integrity: sha512-qOtCYzKEeyr3aR9f28mPJqBty7+DBqsdd63eO0yyDwc6vgThj2UjWfJIcsFeSucYydqcuudMOprZ+x1SpF3ZuQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true + typescript: '>=4.8.4 <6.0.0' - '@typescript-eslint/utils@7.18.0': - resolution: {integrity: sha512-kK0/rNa2j74XuHVcoCZxdFBMF+aq/vH83CXAOHieC+2Gis4mF8jJXT5eAfyD3K0sAxtPuwxaIOIOvhwzVDt/kw==} - engines: {node: ^18.18.0 || >=20.0.0} + '@typescript-eslint/type-utils@8.56.1': + resolution: {integrity: sha512-yB/7dxi7MgTtGhZdaHCemf7PuwrHMenHjmzgUW1aJpO+bBU43OycnM3Wn+DdvDO/8zzA9HlhaJ0AUGuvri4oGg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: - eslint: ^8.56.0 - - '@typescript-eslint/visitor-keys@7.18.0': - resolution: {integrity: sha512-cDF0/Gf81QpY3xYyJKDV14Zwdmid5+uuENhjH2EqFaF0ni+yAyq/LzMaIJdhNJXZI7uLzwIlA+V7oWoyn6Curg==} - engines: {node: ^18.18.0 || >=20.0.0} + eslint: ^8.57.0 || ^9.0.0 || ^10.0.0 + typescript: '>=4.8.4 <6.0.0' - '@ungap/structured-clone@1.2.0': - resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} + '@typescript-eslint/types@8.56.1': + resolution: {integrity: sha512-dbMkdIUkIkchgGDIv7KLUpa0Mda4IYjo4IAMJUZ+3xNoUXxMsk9YtKpTHSChRS85o+H9ftm51gsK1dZReY9CVw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@vitest/expect@2.1.1': - resolution: {integrity: sha512-YeueunS0HiHiQxk+KEOnq/QMzlUuOzbU1Go+PgAsHvvv3tUkJPm9xWt+6ITNTlzsMXUjmgm5T+U7KBPK2qQV6w==} + '@typescript-eslint/typescript-estree@8.56.1': + resolution: {integrity: sha512-qzUL1qgalIvKWAf9C1HpvBjif+Vm6rcT5wZd4VoMb9+Km3iS3Cv9DY6dMRMDtPnwRAFyAi7YXJpTIEXLvdfPxg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + typescript: '>=4.8.4 <6.0.0' - '@vitest/mocker@2.1.1': - resolution: {integrity: sha512-LNN5VwOEdJqCmJ/2XJBywB11DLlkbY0ooDJW3uRX5cZyYCrc4PI/ePX0iQhE3BiEGiQmK4GE7Q/PqCkkaiPnrA==} + '@typescript-eslint/utils@8.56.1': + resolution: {integrity: sha512-HPAVNIME3tABJ61siYlHzSWCGtOoeP2RTIaHXFMPqjrQKCGB9OgUVdiNgH7TJS2JNIQ5qQ4RsAUDuGaGme/KOA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: - '@vitest/spy': 2.1.1 - msw: ^2.3.5 - vite: ^5.0.0 - peerDependenciesMeta: + eslint: ^8.57.0 || ^9.0.0 || ^10.0.0 + typescript: '>=4.8.4 <6.0.0' + + '@typescript-eslint/visitor-keys@8.56.1': + resolution: {integrity: sha512-KiROIzYdEV85YygXw6BI/Dx4fnBlFQu6Mq4QE4MOH9fFnhohw6wX/OAvDY2/C+ut0I3RSPKenvZJIVYqJNkhEw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@vitest/expect@3.2.4': + resolution: {integrity: sha512-Io0yyORnB6sikFlt8QW5K7slY4OjqNX9jmJQ02QDda8lyM6B5oNgVWoSoKPac8/kgnCUzuHQKrSLtu/uOqqrig==} + + '@vitest/mocker@3.2.4': + resolution: {integrity: sha512-46ryTE9RZO/rfDd7pEqFl7etuyzekzEhUbTW3BvmeO/BcCMEgq59BKhek3dXDWgAj4oMK6OZi+vRr1wPW6qjEQ==} + peerDependencies: + msw: ^2.4.9 + vite: ^5.0.0 || ^6.0.0 || ^7.0.0-0 + peerDependenciesMeta: msw: optional: true vite: optional: true - '@vitest/pretty-format@2.1.1': - resolution: {integrity: sha512-SjxPFOtuINDUW8/UkElJYQSFtnWX7tMksSGW0vfjxMneFqxVr8YJ979QpMbDW7g+BIiq88RAGDjf7en6rvLPPQ==} + '@vitest/pretty-format@3.2.4': + resolution: {integrity: sha512-IVNZik8IVRJRTr9fxlitMKeJeXFFFN0JaB9PHPGQ8NKQbGpfjlTx9zO4RefN8gp7eqjNy8nyK3NZmBzOPeIxtA==} - '@vitest/runner@2.1.1': - resolution: {integrity: sha512-uTPuY6PWOYitIkLPidaY5L3t0JJITdGTSwBtwMjKzo5O6RCOEncz9PUN+0pDidX8kTHYjO0EwUIvhlGpnGpxmA==} + '@vitest/runner@3.2.4': + resolution: {integrity: sha512-oukfKT9Mk41LreEW09vt45f8wx7DordoWUZMYdY/cyAk7w5TWkTRCNZYF7sX7n2wB7jyGAl74OxgwhPgKaqDMQ==} - '@vitest/snapshot@2.1.1': - resolution: {integrity: sha512-BnSku1WFy7r4mm96ha2FzN99AZJgpZOWrAhtQfoxjUU5YMRpq1zmHRq7a5K9/NjqonebO7iVDla+VvZS8BOWMw==} + '@vitest/snapshot@3.2.4': + resolution: {integrity: sha512-dEYtS7qQP2CjU27QBC5oUOxLE/v5eLkGqPE0ZKEIDGMs4vKWe7IjgLOeauHsR0D5YuuycGRO5oSRXnwnmA78fQ==} - '@vitest/spy@2.1.1': - resolution: {integrity: sha512-ZM39BnZ9t/xZ/nF4UwRH5il0Sw93QnZXd9NAZGRpIgj0yvVwPpLd702s/Cx955rGaMlyBQkZJ2Ir7qyY48VZ+g==} + '@vitest/spy@3.2.4': + resolution: {integrity: sha512-vAfasCOe6AIK70iP5UD11Ac4siNUNJ9i/9PZ3NKx07sG6sUxeag1LWdNrMWeKKYBLlzuK+Gn65Yd5nyL6ds+nw==} - '@vitest/utils@2.1.1': - resolution: {integrity: sha512-Y6Q9TsI+qJ2CC0ZKj6VBb+T8UPz593N113nnUykqwANqhgf3QkZeHFlusgKLTqrnVHbj/XDKZcDHol+dxVT+rQ==} + '@vitest/utils@3.2.4': + resolution: {integrity: sha512-fB2V0JFrQSMsCo9HiSq3Ezpdv4iYaXRG1Sx8edX3MwxfyNn83mKiGzOcH+Fkxt4MHxr3y42fQi1oeAInqgX2QA==} acorn-jsx@5.3.2: resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 - acorn@8.12.1: - resolution: {integrity: sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==} + acorn@8.16.0: + resolution: {integrity: sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==} engines: {node: '>=0.4.0'} hasBin: true ajv@6.12.6: resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} - ansi-regex@5.0.1: - resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} - engines: {node: '>=8'} + ajv@6.14.0: + resolution: {integrity: sha512-IWrosm/yrn43eiKqkfkHis7QioDleaXQHdDVPKg0FSwwd/DuvyX79TZnFOnYpB7dcsFAMmtFztZuXPDvSePkFw==} - ansi-styles@3.2.1: - resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==} - engines: {node: '>=4'} + ansi-regex@6.2.2: + resolution: {integrity: sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==} + engines: {node: '>=12'} ansi-styles@4.3.0: resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} engines: {node: '>=8'} + ansi-styles@6.2.3: + resolution: {integrity: sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==} + engines: {node: '>=12'} + argparse@2.0.1: resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} - aria-query@5.1.3: - resolution: {integrity: sha512-R5iJ5lkuHybztUfuOAznmboyjWq8O6sqNqtK7CLOqdydi54VNbORp49mb14KbWgG1QD3JFO9hJdZ+y4KutfdOQ==} - array-buffer-byte-length@1.0.1: resolution: {integrity: sha512-ahC5W1xgou+KTXix4sAO8Ki12Q+jf4i0+tmk3sC+zgcynshkHxzpXdImBehiUYKKKDwvfFiJl1tZt6ewscS1Mg==} engines: {node: '>= 0.4'} - array-includes@3.1.8: - resolution: {integrity: sha512-itaWrbYbqpGXkGhZPGUulwnhVf5Hpy1xiCFsGqyIGglbBxmG5vSjxQen3/WGOjPpNEv1RtBLKxbmVXm8HpJStQ==} - engines: {node: '>= 0.4'} - - array-union@2.1.0: - resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} - engines: {node: '>=8'} - - array.prototype.findlast@1.2.5: - resolution: {integrity: sha512-CVvd6FHg1Z3POpBLxO6E6zr+rSKEQ9L6rZHAaY7lLfhKsWYUBBOuMs0e9o24oopj6H+geRCX0YJ+TJLBK2eHyQ==} + array-buffer-byte-length@1.0.2: + resolution: {integrity: sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==} engines: {node: '>= 0.4'} - array.prototype.findlastindex@1.2.5: - resolution: {integrity: sha512-zfETvRFA8o7EiNn++N5f/kaCw221hrpGsDmcpndVupkPzEc1Wuf3VgC0qby1BbHs7f5DVYjgtEU2LLh5bqeGfQ==} + array-includes@3.1.9: + resolution: {integrity: sha512-FmeCCAenzH0KH381SPT5FZmiA/TmpndpcaShhfgEN9eCVjnFBqq3l1xrI42y8+PPLI6hypzou4GXw00WHmPBLQ==} engines: {node: '>= 0.4'} - array.prototype.flat@1.3.2: - resolution: {integrity: sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==} + array.prototype.findlastindex@1.2.6: + resolution: {integrity: sha512-F/TKATkzseUExPlfvmwQKGITM3DGTK+vkAsCZoDc5daVygbJBnjEUCbgkAvVFsgfXfX4YIqZ/27G3k3tdXrTxQ==} engines: {node: '>= 0.4'} - array.prototype.flatmap@1.3.2: - resolution: {integrity: sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ==} + array.prototype.flat@1.3.3: + resolution: {integrity: sha512-rwG/ja1neyLqCuGZ5YYrznA62D4mZXg0i1cIskIUKSiqF3Cje9/wXAls9B9s1Wa2fomMsIv8czB8jZcPmxCXFg==} engines: {node: '>= 0.4'} - array.prototype.tosorted@1.1.4: - resolution: {integrity: sha512-p6Fx8B7b7ZhL/gmUsAy0D15WhvDccw3mnGNbZpi3pmeJdxtWsj2jEaI4Y6oo3XiHfzuSgPwKc04MYt6KgvC/wA==} + array.prototype.flatmap@1.3.3: + resolution: {integrity: sha512-Y7Wt51eKJSyi80hFrJCePGGNo5ktJCslFuboqJsbf57CCPcm5zztluPlc4/aD8sWsKvlwatezpV4U1efk8kpjg==} engines: {node: '>= 0.4'} arraybuffer.prototype.slice@1.0.3: resolution: {integrity: sha512-bMxMKAjg13EBSVscxTaYA4mRc5t1UAXa2kXiGTNfZ079HIWXEkKmkgFrh/nJqamaLSrXO5H4WFFkPEaLJWbs3A==} engines: {node: '>= 0.4'} + arraybuffer.prototype.slice@1.0.4: + resolution: {integrity: sha512-BNoCY6SXXPQ7gF2opIP4GBE+Xw7U+pHMYKuzjgCN3GwiaIR09UUeKfheyIry77QtrCBlC0KK0q5/TER/tYh3PQ==} + engines: {node: '>= 0.4'} + assertion-error@2.0.1: resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} engines: {node: '>=12'} - ast-types-flow@0.0.8: - resolution: {integrity: sha512-OH/2E5Fg20h2aPrbe+QL8JZQFko0YZaF+j4mnQ7BGhfavO7OpSLa8a0y9sBwomHdSbkhTS8TQNayBfnW5DwbvQ==} - available-typed-arrays@1.0.7: resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==} engines: {node: '>= 0.4'} - axe-core@4.10.0: - resolution: {integrity: sha512-Mr2ZakwQ7XUAjp7pAwQWRhhK8mQQ6JAaNWSjmjxil0R8BPioMtQsTLOolGYkji1rcL++3dCqZA3zWqpT+9Ew6g==} - engines: {node: '>=4'} - - axobject-query@4.1.0: - resolution: {integrity: sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==} - engines: {node: '>= 0.4'} - - babel-plugin-polyfill-corejs2@0.4.11: - resolution: {integrity: sha512-sMEJ27L0gRHShOh5G54uAAPaiCOygY/5ratXuiyb2G46FmlSpc9eFCzYVyDiPxfNbwzA7mYahmjQc5q+CZQ09Q==} - peerDependencies: - '@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0 - - babel-plugin-polyfill-corejs3@0.10.6: - resolution: {integrity: sha512-b37+KR2i/khY5sKmWNVQAnitvquQbNdWy6lJdsr0kmquCKEEUgMKK4SboVM3HtfnZilfjr4MMQ7vY58FVWDtIA==} - peerDependencies: - '@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0 - - babel-plugin-polyfill-regenerator@0.6.2: - resolution: {integrity: sha512-2R25rQZWP63nGwaAswvDazbPXfrM3HwVoBXK6HcqeKrSrL/JqcC/rDcf95l4r7LXLyxDXc8uQDa064GubtCABg==} - peerDependencies: - '@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0 - balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} + balanced-match@4.0.4: + resolution: {integrity: sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==} + engines: {node: 18 || 20 || >=22} + brace-expansion@1.1.11: resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} - brace-expansion@2.0.1: - resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} - - braces@3.0.3: - resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} - engines: {node: '>=8'} - - browserslist@4.24.0: - resolution: {integrity: sha512-Rmb62sR1Zpjql25eSanFGEhAxcFwfA1K0GuQcLoaJBAcENegrQut3hYdhXFF1obQfiDyqIW/cLM5HSJ/9k884A==} - engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} - hasBin: true + brace-expansion@5.0.4: + resolution: {integrity: sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg==} + engines: {node: 18 || 20 || >=22} cac@6.7.14: resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} engines: {node: '>=8'} + call-bind-apply-helpers@1.0.2: + resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==} + engines: {node: '>= 0.4'} + call-bind@1.0.7: resolution: {integrity: sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==} engines: {node: '>= 0.4'} + call-bind@1.0.8: + resolution: {integrity: sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==} + engines: {node: '>= 0.4'} + + call-bound@1.0.4: + resolution: {integrity: sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==} + engines: {node: '>= 0.4'} + callsites@3.1.0: resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} engines: {node: '>=6'} - camelcase@8.0.0: - resolution: {integrity: sha512-8WB3Jcas3swSvjIeA2yvCJ+Miyz5l1ZmB6HFb9R1317dt9LCQoswg/BGrmAmkWVEszSrrg4RwmO46qIm2OEnSA==} - engines: {node: '>=16'} - - caniuse-lite@1.0.30001666: - resolution: {integrity: sha512-gD14ICmoV5ZZM1OdzPWmpx+q4GyefaK06zi8hmfHV5xe4/2nOQX3+Dw5o+fSqOws2xVwL9j+anOPFwHzdEdV4g==} - - chai@5.1.1: - resolution: {integrity: sha512-pT1ZgP8rPNqUgieVaEY+ryQr6Q4HXNg8Ei9UnLUrjN4IA7dvQC5JB+/kxVcPNDHyBcc/26CXPkbNzq3qwrOEKA==} - engines: {node: '>=12'} + camelcase@9.0.0: + resolution: {integrity: sha512-TO9xmyXTZ9HUHI8M1OnvExxYB0eYVS/1e5s7IDMTAoIcwUd+aNcFODs6Xk83mobk0velyHFQgA1yIrvYc6wclw==} + engines: {node: '>=20'} - chalk@2.4.2: - resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} - engines: {node: '>=4'} + chai@5.3.3: + resolution: {integrity: sha512-4zNhdJD/iOjSH0A05ea+Ke6MU5mmpQcbQsSOkgdaUMJ9zTlDTD/GYlwohmIE2u0gaxHYiVHEn1Fw9mZ/ktJWgw==} + engines: {node: '>=18'} chalk@4.1.2: resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} @@ -1321,57 +715,51 @@ packages: resolution: {integrity: sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==} engines: {node: '>= 16'} - cliui@8.0.1: - resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} - engines: {node: '>=12'} - - code-block-writer@13.0.2: - resolution: {integrity: sha512-XfXzAGiStXSmCIwrkdfvc7FS5Dtj8yelCtyOf2p2skCAfvLd6zu0rGzuS9NSCO3bq1JKpFZ7tbKdKlcd5occQA==} + cliui@9.0.1: + resolution: {integrity: sha512-k7ndgKhwoQveBL+/1tqGJYNz097I7WOvwbmmU2AR5+magtbjPWQTS1C5vzGkBC8Ym8UWRzfKUzUUqFLypY4Q+w==} + engines: {node: '>=20'} - color-convert@1.9.3: - resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} + code-block-writer@13.0.3: + resolution: {integrity: sha512-Oofo0pq3IKnsFtuHqSF7TqBfr71aeyZDVJ0HpmqB7FBM2qEigL0iPONSCZSO9pE9dZTAxANe5XHG9Uy0YMv8cg==} color-convert@2.0.1: resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} engines: {node: '>=7.0.0'} - color-name@1.1.3: - resolution: {integrity: sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==} - color-name@1.1.4: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} - confusing-browser-globals@1.0.11: - resolution: {integrity: sha512-JsPKdmh8ZkmnHxDk55FZ1TqVLvEQTvoByJZRN9jzI0UjxK/QgAmsphz7PGtqgPieQZ/CQcHWXCR7ATDNhGe+YA==} - - convert-source-map@2.0.0: - resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} - - core-js-compat@3.38.1: - resolution: {integrity: sha512-JRH6gfXxGmrzF3tZ57lFx97YARxCXPaMzPo6jELZhv88pBH5VXpQ+y0znKGlFnzuaihqhLbefxSJxWJMPtfDzw==} - - cross-spawn@7.0.3: - resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} + cross-spawn@7.0.6: + resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} engines: {node: '>= 8'} - damerau-levenshtein@1.0.8: - resolution: {integrity: sha512-sdQSFB7+llfUcQHUQO3+B8ERRj0Oa4w9POWMI/puGtuf7gFywGmkaLCElnudfTiKZV+NvHqL0ifzdrI8Ro7ESA==} - data-view-buffer@1.0.1: resolution: {integrity: sha512-0lht7OugA5x3iJLOWFhWK/5ehONdprk0ISXqVFn/NFrDu+cuc8iADFrGQz5BnRK7LLU3JmkbXSxaqX+/mXYtUA==} engines: {node: '>= 0.4'} + data-view-buffer@1.0.2: + resolution: {integrity: sha512-EmKO5V3OLXh1rtK2wgXRansaK1/mtVdTUEiEI0W8RkvgT05kfxaH29PliLnpLP73yYO6142Q72QNa8Wx/A5CqQ==} + engines: {node: '>= 0.4'} + data-view-byte-length@1.0.1: resolution: {integrity: sha512-4J7wRJD3ABAzr8wP+OcIcqq2dlUKp4DVflx++hs5h5ZKydWMI6/D/fAot+yh6g2tHh8fLFTvNOaVN357NvSrOQ==} engines: {node: '>= 0.4'} + data-view-byte-length@1.0.2: + resolution: {integrity: sha512-tuhGbE6CfTM9+5ANGf+oQb72Ky/0+s3xKUpHvShfiz2RxMFgFPjsXuRLBVMtvMs15awe45SRb83D6wH4ew6wlQ==} + engines: {node: '>= 0.4'} + data-view-byte-offset@1.0.0: resolution: {integrity: sha512-t/Ygsytq+R995EJ5PZlD4Cu56sWa8InXySaViRzw9apusqsOO2bQP+SbYzAhR0pFKoB+43lYy8rWban9JSuXnA==} engines: {node: '>= 0.4'} + data-view-byte-offset@1.0.1: + resolution: {integrity: sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==} + engines: {node: '>= 0.4'} + debug@3.2.7: resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==} peerDependencies: @@ -1389,14 +777,19 @@ packages: supports-color: optional: true + debug@4.4.3: + resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + deep-eql@5.0.2: resolution: {integrity: sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==} engines: {node: '>=6'} - deep-equal@2.2.3: - resolution: {integrity: sha512-ZIwpnevOurS8bpT4192sqAowWM76JDKSHYzMLty3BZGSswgq6pBaH3DhCSW5xVAZICZyKdOBPjwww5wfgT/6PA==} - engines: {node: '>= 0.4'} - deep-is@0.1.4: resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} @@ -1408,65 +801,71 @@ packages: resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==} engines: {node: '>= 0.4'} - dir-glob@3.0.1: - resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} - engines: {node: '>=8'} - doctrine@2.1.0: resolution: {integrity: sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==} engines: {node: '>=0.10.0'} - doctrine@3.0.0: - resolution: {integrity: sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==} - engines: {node: '>=6.0.0'} - - electron-to-chromium@1.5.31: - resolution: {integrity: sha512-QcDoBbQeYt0+3CWcK/rEbuHvwpbT/8SV9T3OSgs6cX1FlcUAkgrkqbg9zLnDrMM/rLamzQwal4LYFCiWk861Tg==} - - emoji-regex@8.0.0: - resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} - - emoji-regex@9.2.2: - resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} + dunder-proto@1.0.1: + resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} + engines: {node: '>= 0.4'} - enhanced-resolve@5.17.1: - resolution: {integrity: sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg==} - engines: {node: '>=10.13.0'} + emoji-regex@10.6.0: + resolution: {integrity: sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==} es-abstract@1.23.3: resolution: {integrity: sha512-e+HfNH61Bj1X9/jLc5v1owaLYuHdeHHSQlkhCBiTK8rBvKaULl/beGMxwrMXjpYrv4pz22BlY570vVePA2ho4A==} engines: {node: '>= 0.4'} + es-abstract@1.24.1: + resolution: {integrity: sha512-zHXBLhP+QehSSbsS9Pt23Gg964240DPd6QCf8WpkqEXxQ7fhdZzYsocOr5u7apWonsS5EjZDmTF+/slGMyasvw==} + engines: {node: '>= 0.4'} + es-define-property@1.0.0: resolution: {integrity: sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==} engines: {node: '>= 0.4'} + es-define-property@1.0.1: + resolution: {integrity: sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==} + engines: {node: '>= 0.4'} + es-errors@1.3.0: resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} engines: {node: '>= 0.4'} - es-get-iterator@1.1.3: - resolution: {integrity: sha512-sPZmqHBe6JIiTfN5q2pEi//TwxmAFHwj/XEuYjTuse78i8KxaqMTTzxPoFKuzRpDpTJ+0NAbpfenkmH2rePtuw==} - - es-iterator-helpers@1.0.19: - resolution: {integrity: sha512-zoMwbCcH5hwUkKJkT8kDIBZSz9I6mVG//+lDCinLCGov4+r7NIy0ld8o03M0cJxl2spVf6ESYVS6/gpIfq1FFw==} - engines: {node: '>= 0.4'} + es-module-lexer@1.7.0: + resolution: {integrity: sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==} es-object-atoms@1.0.0: resolution: {integrity: sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw==} engines: {node: '>= 0.4'} + es-object-atoms@1.1.1: + resolution: {integrity: sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==} + engines: {node: '>= 0.4'} + es-set-tostringtag@2.0.3: resolution: {integrity: sha512-3T8uNMC3OQTHkFUsFq8r/BwAXLHvU/9O9mE0fBc/MY5iq/8H7ncvO947LmYA6ldWw9Uh8Yhf25zu6n7nML5QWQ==} engines: {node: '>= 0.4'} + es-set-tostringtag@2.1.0: + resolution: {integrity: sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==} + engines: {node: '>= 0.4'} + es-shim-unscopables@1.0.2: resolution: {integrity: sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw==} + es-shim-unscopables@1.1.0: + resolution: {integrity: sha512-d9T8ucsEhh8Bi1woXCf+TIKDIROLG5WCkxg8geBCbvk22kzwC5G2OnXVMO6FUsvQlgUUXQ2itephWDLqDzbeCw==} + engines: {node: '>= 0.4'} + es-to-primitive@1.2.1: resolution: {integrity: sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==} engines: {node: '>= 0.4'} + es-to-primitive@1.3.0: + resolution: {integrity: sha512-w+5mJ3GuFL+NjVtJlvydShqE1eN3h3PbI7/5LAsYJP/2qtuMXjfL2LpHSRqo4b4eSF5K/DH1JXKUAHSB2UW50g==} + engines: {node: '>= 0.4'} + esbuild@0.21.5: resolution: {integrity: sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==} engines: {node: '>=12'} @@ -1476,62 +875,15 @@ packages: resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==} engines: {node: '>=6'} - escape-string-regexp@1.0.5: - resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==} - engines: {node: '>=0.8.0'} - escape-string-regexp@4.0.0: resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} engines: {node: '>=10'} - eslint-config-airbnb-base@15.0.0: - resolution: {integrity: sha512-xaX3z4ZZIcFLvh2oUNvcX5oEofXda7giYmuplVxoOg5A7EXJMrUyqRgR+mhDhPK8LZ4PttFOBvCYDbX3sUoUig==} - engines: {node: ^10.12.0 || >=12.0.0} - peerDependencies: - eslint: ^7.32.0 || ^8.2.0 - eslint-plugin-import: ^2.25.2 - - eslint-config-airbnb-typescript@18.0.0: - resolution: {integrity: sha512-oc+Lxzgzsu8FQyFVa4QFaVKiitTYiiW3frB9KYW5OWdPrqFc7FzxgB20hP4cHMlr+MBzGcLl3jnCOVOydL9mIg==} - peerDependencies: - '@typescript-eslint/eslint-plugin': ^7.0.0 - '@typescript-eslint/parser': ^7.0.0 - eslint: ^8.56.0 - - eslint-config-airbnb@19.0.4: - resolution: {integrity: sha512-T75QYQVQX57jiNgpF9r1KegMICE94VYwoFQyMGhrvc+lB8YF2E/M/PYDaQe1AJcWaEgqLE+ErXV1Og/+6Vyzew==} - engines: {node: ^10.12.0 || ^12.22.0 || ^14.17.0 || >=16.0.0} - peerDependencies: - eslint: ^7.32.0 || ^8.2.0 - eslint-plugin-import: ^2.25.3 - eslint-plugin-jsx-a11y: ^6.5.1 - eslint-plugin-react: ^7.28.0 - eslint-plugin-react-hooks: ^4.3.0 - - eslint-config-prettier@9.1.0: - resolution: {integrity: sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==} - hasBin: true - peerDependencies: - eslint: '>=7.0.0' - eslint-import-resolver-node@0.3.9: resolution: {integrity: sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==} - eslint-import-resolver-typescript@3.6.3: - resolution: {integrity: sha512-ud9aw4szY9cCT1EWWdGv1L1XR6hh2PaRWif0j2QjQ0pgTY/69iw+W0Z4qZv5wHahOl8isEr+k/JnyAqNQkLkIA==} - engines: {node: ^14.18.0 || >=16.0.0} - peerDependencies: - eslint: '*' - eslint-plugin-import: '*' - eslint-plugin-import-x: '*' - peerDependenciesMeta: - eslint-plugin-import: - optional: true - eslint-plugin-import-x: - optional: true - - eslint-module-utils@2.12.0: - resolution: {integrity: sha512-wALZ0HFoytlyh/1+4wuZ9FJCD/leWHQzzrxJ8+rebyReSLk7LApMyd3WJaLVoN+D5+WIdJyDK1c6JnE65V4Zyg==} + eslint-module-utils@2.12.1: + resolution: {integrity: sha512-L8jSWTze7K2mTg0vos/RuLRS5soomksDPoJLXIslC7c8Wmut3bx7CPpJijDcBZtxQ5lrbUdM+s0OlNbz0DCDNw==} engines: {node: '>=4'} peerDependencies: '@typescript-eslint/parser': '*' @@ -1551,64 +903,45 @@ packages: eslint-import-resolver-webpack: optional: true - eslint-plugin-import@2.30.0: - resolution: {integrity: sha512-/mHNE9jINJfiD2EKkg1BKyPyUk4zdnT54YgbOgfjSakWT5oyX/qQLVNTkehyfpcMxZXMy1zyonZ2v7hZTX43Yw==} + eslint-plugin-import@2.32.0: + resolution: {integrity: sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA==} engines: {node: '>=4'} peerDependencies: '@typescript-eslint/parser': '*' - eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 + eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 || ^9 peerDependenciesMeta: '@typescript-eslint/parser': optional: true - eslint-plugin-jsx-a11y@6.10.0: - resolution: {integrity: sha512-ySOHvXX8eSN6zz8Bywacm7CvGNhUtdjvqfQDVe6020TUK34Cywkw7m0KsCCk1Qtm9G1FayfTN1/7mMYnYO2Bhg==} - engines: {node: '>=4.0'} - peerDependencies: - eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9 - - eslint-plugin-prettier@5.2.1: - resolution: {integrity: sha512-gH3iR3g4JfF+yYPaJYkN7jEl9QbweL/YfkoRlNnuIEHEz1vHVlCmWOS+eGGiRuzHQXdJFCOTxRgvju9b8VUmrw==} - engines: {node: ^14.18.0 || >=16.0.0} - peerDependencies: - '@types/eslint': '>=8.0.0' - eslint: '>=8.0.0' - eslint-config-prettier: '*' - prettier: '>=3.0.0' - peerDependenciesMeta: - '@types/eslint': - optional: true - eslint-config-prettier: - optional: true - - eslint-plugin-react-hooks@4.6.2: - resolution: {integrity: sha512-QzliNJq4GinDBcD8gPB5v0wh6g8q3SUi6EFF0x8N/BL9PoVs0atuGc47ozMRyOWAKdwaZ5OnbOEa3WR+dSGKuQ==} - engines: {node: '>=10'} - peerDependencies: - eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 - - eslint-plugin-react@7.37.1: - resolution: {integrity: sha512-xwTnwDqzbDRA8uJ7BMxPs/EXRB3i8ZfnOIp8BsxEQkT0nHPp+WWceqGgo6rKb9ctNi8GJLDT4Go5HAWELa/WMg==} - engines: {node: '>=4'} - peerDependencies: - eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9.7 - - eslint-scope@7.2.2: - resolution: {integrity: sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + eslint-scope@8.4.0: + resolution: {integrity: sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} eslint-visitor-keys@3.4.3: resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - eslint@8.57.1: - resolution: {integrity: sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + eslint-visitor-keys@4.2.1: + resolution: {integrity: sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + eslint-visitor-keys@5.0.1: + resolution: {integrity: sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==} + engines: {node: ^20.19.0 || ^22.13.0 || >=24} + + eslint@9.39.3: + resolution: {integrity: sha512-VmQ+sifHUbI/IcSopBCF/HO3YiHQx/AVd3UVyYL6weuwW+HvON9VYn5l6Zl1WZzPWXPNZrSQpxwkkZ/VuvJZzg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} hasBin: true + peerDependencies: + jiti: '*' + peerDependenciesMeta: + jiti: + optional: true - espree@9.6.1: - resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + espree@10.4.0: + resolution: {integrity: sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} esquery@1.6.0: resolution: {integrity: sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==} @@ -1629,40 +962,39 @@ packages: resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} engines: {node: '>=0.10.0'} + expect-type@1.3.0: + resolution: {integrity: sha512-knvyeauYhqjOYvQ66MznSMs83wmHrCycNEN6Ao+2AeYEfxUIkuiVxdEa1qlGEPK+We3n0THiDciYSsCcgW/DoA==} + engines: {node: '>=12.0.0'} + fast-deep-equal@3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} - fast-diff@1.3.0: - resolution: {integrity: sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==} - - fast-glob@3.3.2: - resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==} - engines: {node: '>=8.6.0'} - fast-json-stable-stringify@2.1.0: resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} fast-levenshtein@2.0.6: resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} - fastq@1.17.1: - resolution: {integrity: sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==} - - file-entry-cache@6.0.1: - resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==} - engines: {node: ^10.12.0 || >=12.0.0} + fdir@6.5.0: + resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==} + engines: {node: '>=12.0.0'} + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true - fill-range@7.1.1: - resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} - engines: {node: '>=8'} + file-entry-cache@8.0.0: + resolution: {integrity: sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==} + engines: {node: '>=16.0.0'} find-up@5.0.0: resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==} engines: {node: '>=10'} - flat-cache@3.2.0: - resolution: {integrity: sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==} - engines: {node: ^10.12.0 || >=12.0.0} + flat-cache@4.0.1: + resolution: {integrity: sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==} + engines: {node: '>=16'} flatted@3.3.1: resolution: {integrity: sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==} @@ -1670,8 +1002,9 @@ packages: for-each@0.3.3: resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} - fs.realpath@1.0.0: - resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} + for-each@0.3.5: + resolution: {integrity: sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==} + engines: {node: '>= 0.4'} fsevents@2.3.3: resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} @@ -1685,17 +1018,21 @@ packages: resolution: {integrity: sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==} engines: {node: '>= 0.4'} + function.prototype.name@1.1.8: + resolution: {integrity: sha512-e5iwyodOHhbMr/yNrc7fDYG4qlbIvI5gajyzPnb5TCwyhjApznQh1BMFou9b30SevY43gCJKXycoCBjMbsuW0Q==} + engines: {node: '>= 0.4'} + functions-have-names@1.2.3: resolution: {integrity: sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==} - gensync@1.0.0-beta.2: - resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} - engines: {node: '>=6.9.0'} - get-caller-file@2.0.5: resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} engines: {node: 6.* || 8.* || >= 10.*} + get-east-asian-width@1.5.0: + resolution: {integrity: sha512-CQ+bEO+Tva/qlmw24dCejulK5pMzVnUOFOijVogd3KQs07HnRIgp8TGipvCCRT06xeYEbpbgwaCxglFyiuIcmA==} + engines: {node: '>=18'} + get-func-name@2.0.2: resolution: {integrity: sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==} @@ -1703,57 +1040,44 @@ packages: resolution: {integrity: sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==} engines: {node: '>= 0.4'} + get-intrinsic@1.3.0: + resolution: {integrity: sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==} + engines: {node: '>= 0.4'} + + get-proto@1.0.1: + resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==} + engines: {node: '>= 0.4'} + get-symbol-description@1.0.2: resolution: {integrity: sha512-g0QYk1dZBxGwk+Ngc+ltRH2IBp2f7zBkBMBJZCDerh6EhlhSR6+9irMCuT/09zD6qkarHUSn529sK/yL4S27mg==} engines: {node: '>= 0.4'} - get-tsconfig@4.8.1: - resolution: {integrity: sha512-k9PN+cFBmaLWtVz29SkUoqU5O0slLuHJXt/2P+tMVFT+phsSGXGkp9t3rQIqdz0e+06EHNGs3oM6ZX1s2zHxRg==} - - glob-parent@5.1.2: - resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} - engines: {node: '>= 6'} + get-symbol-description@1.1.0: + resolution: {integrity: sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==} + engines: {node: '>= 0.4'} glob-parent@6.0.2: resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} engines: {node: '>=10.13.0'} - glob@7.2.3: - resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} - deprecated: Glob versions prior to v9 are no longer supported - - globals@11.12.0: - resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==} - engines: {node: '>=4'} - - globals@13.24.0: - resolution: {integrity: sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==} - engines: {node: '>=8'} + globals@14.0.0: + resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==} + engines: {node: '>=18'} globalthis@1.0.4: resolution: {integrity: sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==} engines: {node: '>= 0.4'} - globby@11.1.0: - resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==} - engines: {node: '>=10'} - gopd@1.0.1: resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==} - graceful-fs@4.2.11: - resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} - - graphemer@1.4.0: - resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} + gopd@1.2.0: + resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==} + engines: {node: '>= 0.4'} has-bigints@1.0.2: resolution: {integrity: sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==} - has-flag@3.0.0: - resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==} - engines: {node: '>=4'} - has-flag@4.0.0: resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} engines: {node: '>=8'} @@ -1765,10 +1089,18 @@ packages: resolution: {integrity: sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==} engines: {node: '>= 0.4'} + has-proto@1.2.0: + resolution: {integrity: sha512-KIL7eQPfHQRC8+XluaIw7BHUwwqL19bQn4hzNgdr+1wXoU0KKj6rufu47lhY7KbJR2C6T6+PfyN0Ea7wkSS+qQ==} + engines: {node: '>= 0.4'} + has-symbols@1.0.3: resolution: {integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==} engines: {node: '>= 0.4'} + has-symbols@1.1.0: + resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==} + engines: {node: '>= 0.4'} + has-tostringtag@1.0.2: resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==} engines: {node: '>= 0.4'} @@ -1777,10 +1109,18 @@ packages: resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} engines: {node: '>= 0.4'} + hono@4.12.5: + resolution: {integrity: sha512-3qq+FUBtlTHhtYxbxheZgY8NIFnkkC/MR8u5TTsr7YZ3wixryQ3cCwn3iZbg8p8B88iDBBAYSfZDS75t8MN7Vg==} + engines: {node: '>=16.9.0'} + ignore@5.3.2: resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} engines: {node: '>= 4'} + ignore@7.0.5: + resolution: {integrity: sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==} + engines: {node: '>= 4'} + import-fresh@3.3.0: resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==} engines: {node: '>=6'} @@ -1789,25 +1129,22 @@ packages: resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} engines: {node: '>=0.8.19'} - inflight@1.0.6: - resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} - deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. - - inherits@2.0.4: - resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} - internal-slot@1.0.7: resolution: {integrity: sha512-NGnrKwXzSms2qUUih/ILZ5JBqNTSa1+ZmP6flaIp6KmSElgE9qdndzS3cqjrDovwFdmwsGsLdeFgB6suw+1e9g==} engines: {node: '>= 0.4'} - is-arguments@1.1.1: - resolution: {integrity: sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==} + internal-slot@1.1.0: + resolution: {integrity: sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==} engines: {node: '>= 0.4'} is-array-buffer@3.0.4: resolution: {integrity: sha512-wcjaerHw0ydZwfhiKbXJWLDY8A7yV7KhjQOpb83hGgGfId/aQa4TOvwyzn2PuswW2gPCYEL/nEAiSVpdOj1lXw==} engines: {node: '>= 0.4'} + is-array-buffer@3.0.5: + resolution: {integrity: sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==} + engines: {node: '>= 0.4'} + is-async-function@2.0.0: resolution: {integrity: sha512-Y1JXKrfykRJGdlDwdKlLpLyMIiWqWvuSd17TvZk68PLAOGOoF4Xyav1z0Xhoi+gCYjZVeC5SI+hYFOfvXmGRCA==} engines: {node: '>= 0.4'} @@ -1815,29 +1152,42 @@ packages: is-bigint@1.0.4: resolution: {integrity: sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==} + is-bigint@1.1.0: + resolution: {integrity: sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ==} + engines: {node: '>= 0.4'} + is-boolean-object@1.1.2: resolution: {integrity: sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==} engines: {node: '>= 0.4'} - is-bun-module@1.2.1: - resolution: {integrity: sha512-AmidtEM6D6NmUiLOvvU7+IePxjEjOzra2h0pSrsfSAcXwl/83zLLXDByafUJy9k/rKK0pvXMLdwKwGHlX2Ke6Q==} + is-boolean-object@1.2.2: + resolution: {integrity: sha512-wa56o2/ElJMYqjCjGkXri7it5FbebW5usLw/nPmCMs5DeZ7eziSYZhSmPRn0txqeW4LnAmQQU7FgqLpsEFKM4A==} + engines: {node: '>= 0.4'} is-callable@1.2.7: resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} engines: {node: '>= 0.4'} - is-core-module@2.15.1: - resolution: {integrity: sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==} + is-core-module@2.16.1: + resolution: {integrity: sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==} engines: {node: '>= 0.4'} is-data-view@1.0.1: resolution: {integrity: sha512-AHkaJrsUVW6wq6JS8y3JnM/GJF/9cf+k20+iDzlSaJrinEo5+7vRiteOSwBhHRiAyQATN1AmY4hwzxJKPmYf+w==} engines: {node: '>= 0.4'} + is-data-view@1.0.2: + resolution: {integrity: sha512-RKtWF8pGmS87i2D6gqQu/l7EYRlVdfzemCJN/P3UOs//x1QE7mfhvzHIApBTRf7axvT6DMGwSwBXYCT0nfB9xw==} + engines: {node: '>= 0.4'} + is-date-object@1.0.5: resolution: {integrity: sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==} engines: {node: '>= 0.4'} + is-date-object@1.1.0: + resolution: {integrity: sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==} + engines: {node: '>= 0.4'} + is-extglob@2.1.1: resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} engines: {node: '>=0.10.0'} @@ -1845,9 +1195,9 @@ packages: is-finalizationregistry@1.0.2: resolution: {integrity: sha512-0by5vtUJs8iFQb5TYUHHPudOR+qXYIMKtiUzvLIZITZUjknFmziyBJuLhVRc+Ds0dREFlskDNJKYIdIzu/9pfw==} - is-fullwidth-code-point@3.0.0: - resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} - engines: {node: '>=8'} + is-finalizationregistry@1.1.1: + resolution: {integrity: sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg==} + engines: {node: '>= 0.4'} is-generator-function@1.0.10: resolution: {integrity: sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==} @@ -1873,18 +1223,18 @@ packages: resolution: {integrity: sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==} engines: {node: '>= 0.4'} - is-number@7.0.0: - resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} - engines: {node: '>=0.12.0'} - - is-path-inside@3.0.3: - resolution: {integrity: sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==} - engines: {node: '>=8'} + is-number-object@1.1.1: + resolution: {integrity: sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw==} + engines: {node: '>= 0.4'} is-regex@1.1.4: resolution: {integrity: sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==} engines: {node: '>= 0.4'} + is-regex@1.2.1: + resolution: {integrity: sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==} + engines: {node: '>= 0.4'} + is-set@2.0.3: resolution: {integrity: sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==} engines: {node: '>= 0.4'} @@ -1893,18 +1243,34 @@ packages: resolution: {integrity: sha512-nA2hv5XIhLR3uVzDDfCIknerhx8XUKnstuOERPNNIinXG7v9u+ohXF67vxm4TPTEPU6lm61ZkwP3c9PCB97rhg==} engines: {node: '>= 0.4'} + is-shared-array-buffer@1.0.4: + resolution: {integrity: sha512-ISWac8drv4ZGfwKl5slpHG9OwPNty4jOWPRIhBpxOoD+hqITiwuipOQ2bNthAzwA3B4fIjO4Nln74N0S9byq8A==} + engines: {node: '>= 0.4'} + is-string@1.0.7: resolution: {integrity: sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==} engines: {node: '>= 0.4'} + is-string@1.1.1: + resolution: {integrity: sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA==} + engines: {node: '>= 0.4'} + is-symbol@1.0.4: resolution: {integrity: sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==} engines: {node: '>= 0.4'} + is-symbol@1.1.1: + resolution: {integrity: sha512-9gGx6GTtCQM73BgmHQXfDmLtfjjTUDSyoxTCbp5WtoixAhfgsDirWIcVQ/IHpvI5Vgd5i/J5F7B9cN/WlVbC/w==} + engines: {node: '>= 0.4'} + is-typed-array@1.1.13: resolution: {integrity: sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw==} engines: {node: '>= 0.4'} + is-typed-array@1.1.15: + resolution: {integrity: sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==} + engines: {node: '>= 0.4'} + is-weakmap@2.0.2: resolution: {integrity: sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==} engines: {node: '>= 0.4'} @@ -1912,6 +1278,10 @@ packages: is-weakref@1.0.2: resolution: {integrity: sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==} + is-weakref@1.1.1: + resolution: {integrity: sha512-6i9mGWSlqzNMEqpCp93KwRS1uUOodk2OJ6b+sq7ZPDSy2WuI5NFIxp/254TytR8ftefexkWn5xNiHUNpPOfSew==} + engines: {node: '>= 0.4'} + is-weakset@2.0.3: resolution: {integrity: sha512-LvIm3/KWzS9oRFHugab7d+M/GcBXuXX5xZkzPmN+NxihdQlZUQ4dWuSV1xR/sq6upL1TJEDrfBgRepHFdBtSNQ==} engines: {node: '>= 0.4'} @@ -1922,23 +1292,11 @@ packages: isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} - iterator.prototype@1.1.2: - resolution: {integrity: sha512-DR33HMMr8EzwuRL8Y9D3u2BMj8+RqSE850jfGu59kS7tbmPLzGkZmVSfyCFSDxuZiEY6Rzt3T2NA/qU+NwVj1w==} - - js-tokens@4.0.0: - resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} + js-tokens@9.0.1: + resolution: {integrity: sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ==} - js-yaml@4.1.0: - resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} - hasBin: true - - jsesc@0.5.0: - resolution: {integrity: sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==} - hasBin: true - - jsesc@2.5.2: - resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==} - engines: {node: '>=4'} + js-yaml@4.1.1: + resolution: {integrity: sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==} hasBin: true json-buffer@3.0.1: @@ -1954,25 +1312,9 @@ packages: resolution: {integrity: sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==} hasBin: true - json5@2.2.3: - resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==} - engines: {node: '>=6'} - hasBin: true - - jsx-ast-utils@3.3.5: - resolution: {integrity: sha512-ZZow9HBI5O6EPgSJLUb8n2NKgmVWTwCvHGwFuJlMjvLFqlGG6pjirPhtdsseaLZjSibD8eegzmYpUZwoIlj2cQ==} - engines: {node: '>=4.0'} - keyv@4.5.4: resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==} - language-subtag-registry@0.3.23: - resolution: {integrity: sha512-0K65Lea881pHotoGEa5gDlMxt3pctLi2RplBb7Ezh4rRdLEOtgi7n4EwK9lamnUCkKBqaeKRVebTq6BAxSkpXQ==} - - language-tags@1.0.9: - resolution: {integrity: sha512-MbjN408fEndfiQXbFQ1vnd+1NoLDsnQW41410oQBXiyXDMYH5z505juWa4KUE1LqxRC7DgOgZDbKLxHIwm27hA==} - engines: {node: '>=0.10'} - levn@0.4.1: resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} engines: {node: '>= 0.8.0'} @@ -1981,48 +1323,35 @@ packages: resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} engines: {node: '>=10'} - lodash.debounce@4.0.8: - resolution: {integrity: sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==} - lodash.merge@4.6.2: resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} - loose-envify@1.4.0: - resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==} - hasBin: true - loupe@3.1.1: resolution: {integrity: sha512-edNu/8D5MKVfGVFRhFf8aAxiTM6Wumfz5XsaatSxlD3w4R1d/WEKUTydCdPGbl9K7QG/Ca3GnDV2sIKIpXRQcw==} - lru-cache@5.1.1: - resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==} + loupe@3.2.1: + resolution: {integrity: sha512-CdzqowRJCeLU72bHvWqwRBBlLcMEtIvGrlvef74kMnV2AolS9Y8xUv1I0U/MNAWMhBlKIoyuEgoJ0t/bbwHbLQ==} - magic-string@0.30.11: - resolution: {integrity: sha512-+Wri9p0QHMy+545hKww7YAu5NyzF8iomPL/RQazugQ9+Ez4Ic3mERMd8ZTX5rfK944j+560ZJi8iAwgak1Ac7A==} + magic-string@0.30.21: + resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==} - merge2@1.4.1: - resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} - engines: {node: '>= 8'} + math-intrinsics@1.1.0: + resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==} + engines: {node: '>= 0.4'} - micromatch@4.0.8: - resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} - engines: {node: '>=8.6'} + minimatch@10.2.4: + resolution: {integrity: sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg==} + engines: {node: 18 || 20 || >=22} minimatch@3.1.2: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} - minimatch@9.0.5: - resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==} - engines: {node: '>=16 || 14 >=14.17'} + minimatch@3.1.5: + resolution: {integrity: sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==} minimist@1.2.8: resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} - mkdirp@3.0.1: - resolution: {integrity: sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==} - engines: {node: '>=10'} - hasBin: true - ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} @@ -2034,19 +1363,16 @@ packages: natural-compare@1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} - node-releases@2.0.18: - resolution: {integrity: sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==} - - object-assign@4.1.1: - resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} - engines: {node: '>=0.10.0'} + non-error@0.1.0: + resolution: {integrity: sha512-TMB1uHiGsHRGv1uYclfhivcnf0/PdFp2pNqRxXjncaAsjYMoisaQJI+SSZCqRq+VliwRTC8tsMQfmrWjDMhkPQ==} + engines: {node: '>=20'} object-inspect@1.13.2: resolution: {integrity: sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==} engines: {node: '>= 0.4'} - object-is@1.1.6: - resolution: {integrity: sha512-F8cZ+KfGlSGi09lJT7/Nd6KJZ9ygtvYC0/UYYLI9nmQKLMnydpB9yvbv9K1uSkEu7FU9vYPmVwLg328tX+ot3Q==} + object-inspect@1.13.4: + resolution: {integrity: sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==} engines: {node: '>= 0.4'} object-keys@1.1.1: @@ -2057,8 +1383,8 @@ packages: resolution: {integrity: sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ==} engines: {node: '>= 0.4'} - object.entries@1.1.8: - resolution: {integrity: sha512-cmopxi8VwRIAw/fkijJohSfpef5PdN0pMQJN6VC/ZKvn0LIknWD8KtgY6KlQdEc4tIjcQ3HxSMmnvtzIscdaYQ==} + object.assign@4.1.7: + resolution: {integrity: sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==} engines: {node: '>= 0.4'} object.fromentries@2.0.8: @@ -2069,13 +1395,10 @@ packages: resolution: {integrity: sha512-+Lhy3TQTuzXI5hevh8sBGqbmurHbbIjAi0Z4S63nthVLmLxfbj4T54a4CfZrXIrt9iP4mVAPYMo/v99taj3wjQ==} engines: {node: '>= 0.4'} - object.values@1.2.0: - resolution: {integrity: sha512-yBYjY9QX2hnRmZHAjG/f13MzmBzxzYgQhFrke06TTyKY5zSTEqkOeukBzIdVA3j3ulu8Qa3MbVFShV7T2RmGtQ==} + object.values@1.2.1: + resolution: {integrity: sha512-gXah6aZrcUxjWg2zR2MwouP2eHlCBzdV4pygudehaKXSGW4v2AsRQUK+lwwXhii6KFZcunEnmSUoYp5CXibxtA==} engines: {node: '>= 0.4'} - once@1.4.0: - resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} - openapi3-ts@4.4.0: resolution: {integrity: sha512-9asTNB9IkKEzWMcHmVZE7Ts3kC9G7AFHfs8i7caD8HbI76gEjdkId4z/AkP83xdZsH7PLAnnbl47qZkXuxpArw==} @@ -2083,6 +1406,10 @@ packages: resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==} engines: {node: '>= 0.8.0'} + own-keys@1.0.1: + resolution: {integrity: sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==} + engines: {node: '>= 0.4'} + p-limit@3.1.0: resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} engines: {node: '>=10'} @@ -2091,9 +1418,9 @@ packages: resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==} engines: {node: '>=10'} - p-retry@6.2.0: - resolution: {integrity: sha512-JA6nkq6hKyWLLasXQXUrO4z8BUZGUt/LjlJxx8Gb2+2ntodU/SS63YZ8b0LUTbQ8ZB9iwOfhEPhg4ykKnn2KsA==} - engines: {node: '>=16.17'} + p-retry@7.1.1: + resolution: {integrity: sha512-J5ApzjyRkkf601HpEeykoiCvzHQjWxPAHhyjFcEUP2SWq0+35NKh8TLhpLw+Dkq5TZBFvUM6UigdE9hIVYTl5w==} + engines: {node: '>=20'} parent-module@1.0.1: resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} @@ -2106,10 +1433,6 @@ packages: resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} engines: {node: '>=8'} - path-is-absolute@1.0.1: - resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} - engines: {node: '>=0.10.0'} - path-key@3.1.1: resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} engines: {node: '>=8'} @@ -2117,12 +1440,8 @@ packages: path-parse@1.0.7: resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} - path-type@4.0.0: - resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} - engines: {node: '>=8'} - - pathe@1.1.2: - resolution: {integrity: sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==} + pathe@2.0.3: + resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==} pathval@2.0.0: resolution: {integrity: sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==} @@ -2131,9 +1450,9 @@ packages: picocolors@1.1.0: resolution: {integrity: sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==} - picomatch@2.3.1: - resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} - engines: {node: '>=8.6'} + picomatch@4.0.3: + resolution: {integrity: sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==} + engines: {node: '>=12'} possible-typed-array-names@1.0.0: resolution: {integrity: sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==} @@ -2147,117 +1466,76 @@ packages: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} - prettier-linter-helpers@1.0.0: - resolution: {integrity: sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==} - engines: {node: '>=6.0.0'} - - prettier@3.3.3: - resolution: {integrity: sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==} + prettier@3.8.1: + resolution: {integrity: sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg==} engines: {node: '>=14'} hasBin: true - prop-types@15.8.1: - resolution: {integrity: sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==} - punycode@2.3.1: resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} engines: {node: '>=6'} - queue-microtask@1.2.3: - resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} - - react-is@16.13.1: - resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==} + reflect.getprototypeof@1.0.10: + resolution: {integrity: sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw==} + engines: {node: '>= 0.4'} reflect.getprototypeof@1.0.6: resolution: {integrity: sha512-fmfw4XgoDke3kdI6h4xcUz1dG8uaiv5q9gcEwLS4Pnth2kxT+GZ7YehS1JTMGBQmtV7Y4GFGbs2re2NqhdozUg==} engines: {node: '>= 0.4'} - regenerate-unicode-properties@10.2.0: - resolution: {integrity: sha512-DqHn3DwbmmPVzeKj9woBadqmXxLvQoQIwu7nopMc72ztvxVmVk2SBhSnx67zuye5TP+lJsb/TBQsjLKhnDf3MA==} - engines: {node: '>=4'} - - regenerate@1.4.2: - resolution: {integrity: sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==} - - regenerator-runtime@0.14.1: - resolution: {integrity: sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==} - - regenerator-transform@0.15.2: - resolution: {integrity: sha512-hfMp2BoF0qOk3uc5V20ALGDS2ddjQaLrdl7xrGXvAIow7qeWRM2VA2HuCHkUKk9slq3VwEwLNK3DFBqDfPGYtg==} - regexp.prototype.flags@1.5.2: resolution: {integrity: sha512-NcDiDkTLuPR+++OCKB0nWafEmhg/Da8aUPLPMQbK+bxKKCm1/S5he+AqYa4PlMCVBalb4/yxIRub6qkEx5yJbw==} engines: {node: '>= 0.4'} - regexpu-core@5.3.2: - resolution: {integrity: sha512-RAM5FlZz+Lhmo7db9L298p2vHP5ZywrVXmVXpmAD9GuL5MPH6t9ROw1iA/wfHkQ76Qe7AaPF0nGuim96/IrQMQ==} - engines: {node: '>=4'} - - regjsparser@0.9.1: - resolution: {integrity: sha512-dQUtn90WanSNl+7mQKcXAgZxvUe7Z0SqXlgzv0za4LwiUhyzBC58yQO3liFoUgu8GiJVInAhJjkj1N0EtQ5nkQ==} - hasBin: true - - require-directory@2.1.1: - resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} - engines: {node: '>=0.10.0'} + regexp.prototype.flags@1.5.4: + resolution: {integrity: sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA==} + engines: {node: '>= 0.4'} resolve-from@4.0.0: resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} engines: {node: '>=4'} - resolve-pkg-maps@1.0.0: - resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} - resolve@1.22.8: resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} hasBin: true - resolve@2.0.0-next.5: - resolution: {integrity: sha512-U7WjGVG9sH8tvjW5SmGbQuui75FiyjAX72HX15DwBBwF9dNiQZRQAg9nnPhYy+TUnE0+VcrttuvNI8oSxZcocA==} - hasBin: true - - retry@0.13.1: - resolution: {integrity: sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==} - engines: {node: '>= 4'} - - reusify@1.0.4: - resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} - engines: {iojs: '>=1.0.0', node: '>=0.10.0'} - - rimraf@3.0.2: - resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==} - deprecated: Rimraf versions prior to v4 are no longer supported - hasBin: true - rollup@4.24.0: resolution: {integrity: sha512-DOmrlGSXNk1DM0ljiQA+i+o0rSLhtii1je5wgk60j49d1jHT5YYttBv1iWOnYSTG+fZZESUOSNiAl89SIet+Cg==} engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true - run-parallel@1.2.0: - resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} - safe-array-concat@1.1.2: resolution: {integrity: sha512-vj6RsCsWBCf19jIeHEfkRMw8DPiBb+DMXklQ/1SGDHOMlHdPUkZXFQ2YdplS23zESTijAcurb1aSgJA3AgMu1Q==} engines: {node: '>=0.4'} + safe-array-concat@1.1.3: + resolution: {integrity: sha512-AURm5f0jYEOydBj7VQlVvDrjeFgthDdEF5H1dP+6mNpoXOMo1quQqJ4wvJDyRZ9+pO3kGWoOdmV08cSv2aJV6Q==} + engines: {node: '>=0.4'} + + safe-push-apply@1.0.0: + resolution: {integrity: sha512-iKE9w/Z7xCzUMIZqdBsp6pEQvwuEebH4vdpjcDWnyzaI6yl6O9FHvVpmGelvEHNsoY6wGblkxR6Zty/h00WiSA==} + engines: {node: '>= 0.4'} + safe-regex-test@1.0.3: resolution: {integrity: sha512-CdASjNJPvRa7roO6Ra/gLYBTzYzzPyyBXxIMdGW3USQLyjWEls2RgW5UBTXaQVp+OrpeCK3bLem8smtmheoRuw==} engines: {node: '>= 0.4'} + safe-regex-test@1.1.0: + resolution: {integrity: sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==} + engines: {node: '>= 0.4'} + semver@6.3.1: resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} hasBin: true - semver@7.6.3: - resolution: {integrity: sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==} + semver@7.7.4: + resolution: {integrity: sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==} engines: {node: '>=10'} hasBin: true - serialize-error@11.0.3: - resolution: {integrity: sha512-2G2y++21dhj2R7iHAdd0FIzjGwuKZld+7Pl/bTU6YIkrC2ZMbVUjm+luj6A6V34Rv9XfKJDKpTWu9W4Gse1D9g==} - engines: {node: '>=14.16'} + serialize-error@13.0.1: + resolution: {integrity: sha512-bBZaRwLH9PN5HbLCjPId4dP5bNGEtumcErgOX952IsvOhVPrm3/AeK1y0UHA/QaPG701eg0yEnOKsCOC6X/kaA==} + engines: {node: '>=20'} set-function-length@1.2.2: resolution: {integrity: sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==} @@ -2267,6 +1545,10 @@ packages: resolution: {integrity: sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==} engines: {node: '>= 0.4'} + set-proto@1.0.0: + resolution: {integrity: sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw==} + engines: {node: '>= 0.4'} + shebang-command@2.0.0: resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} engines: {node: '>=8'} @@ -2275,17 +1557,29 @@ packages: resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} engines: {node: '>=8'} - side-channel@1.0.6: + side-channel-list@1.0.0: + resolution: {integrity: sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==} + engines: {node: '>= 0.4'} + + side-channel-map@1.0.1: + resolution: {integrity: sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==} + engines: {node: '>= 0.4'} + + side-channel-weakmap@1.0.2: + resolution: {integrity: sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==} + engines: {node: '>= 0.4'} + + side-channel@1.0.6: resolution: {integrity: sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==} engines: {node: '>= 0.4'} + side-channel@1.1.0: + resolution: {integrity: sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==} + engines: {node: '>= 0.4'} + siginfo@2.0.0: resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} - slash@3.0.0: - resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} - engines: {node: '>=8'} - source-map-js@1.2.1: resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} engines: {node: '>=0.10.0'} @@ -2293,41 +1587,36 @@ packages: stackback@0.0.2: resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} - std-env@3.7.0: - resolution: {integrity: sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg==} + std-env@3.10.0: + resolution: {integrity: sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg==} - stop-iteration-iterator@1.0.0: - resolution: {integrity: sha512-iCGQj+0l0HOdZ2AEeBADlsRC+vsnDsZsbdSiH1yNSjcfKM7fdpCMfqAL/dwF5BLiw/XhRft/Wax6zQbhq2BcjQ==} + stop-iteration-iterator@1.1.0: + resolution: {integrity: sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==} engines: {node: '>= 0.4'} - string-width@4.2.3: - resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} - engines: {node: '>=8'} - - string.prototype.includes@2.0.0: - resolution: {integrity: sha512-E34CkBgyeqNDcrbU76cDjL5JLcVrtSdYq0MEh/B10r17pRP4ciHLwTgnuLV8Ay6cgEMLkcBkFCKyFZ43YldYzg==} + string-width@7.2.0: + resolution: {integrity: sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==} + engines: {node: '>=18'} - string.prototype.matchall@4.0.11: - resolution: {integrity: sha512-NUdh0aDavY2og7IbBPenWqR9exH+E26Sv8e0/eTe1tltDGZL+GtBkDAnnyBtmekfK6/Dq3MkcGtzXFEd1LQrtg==} + string.prototype.trim@1.2.10: + resolution: {integrity: sha512-Rs66F0P/1kedk5lyYyH9uBzuiI/kNRmwJAR9quK6VOtIpZ2G+hMZd+HQbbv25MgCA6gEffoMZYxlTod4WcdrKA==} engines: {node: '>= 0.4'} - string.prototype.repeat@1.0.0: - resolution: {integrity: sha512-0u/TldDbKD8bFCQ/4f5+mNRrXwZ8hg2w7ZR8wa16e8z9XpePWl3eGEcUD0OXpEH/VJH/2G3gjUtR3ZOiBe2S/w==} - string.prototype.trim@1.2.9: resolution: {integrity: sha512-klHuCNxiMZ8MlsOihJhJEBJAiMVqU3Z2nEXWfWnIqjN0gEFS9J9+IxKozWWtQGcgoa1WUZzLjKPTr4ZHNFTFxw==} engines: {node: '>= 0.4'} - string.prototype.trimend@1.0.8: - resolution: {integrity: sha512-p73uL5VCHCO2BZZ6krwwQE3kCzM7NKmis8S//xEC6fQonchbum4eP6kR4DLEjQFO3Wnj3Fuo8NM0kOSjVdHjZQ==} + string.prototype.trimend@1.0.9: + resolution: {integrity: sha512-G7Ok5C6E/j4SGfyLCloXTrngQIQU3PWtXGst3yM7Bea9FRURf1S42ZHlZZtsNque2FN2PoUhfZXYLNWwEr4dLQ==} + engines: {node: '>= 0.4'} string.prototype.trimstart@1.0.8: resolution: {integrity: sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==} engines: {node: '>= 0.4'} - strip-ansi@6.0.1: - resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} - engines: {node: '>=8'} + strip-ansi@7.2.0: + resolution: {integrity: sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==} + engines: {node: '>=12'} strip-bom@3.0.0: resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==} @@ -2337,9 +1626,8 @@ packages: resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} engines: {node: '>=8'} - supports-color@5.5.0: - resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} - engines: {node: '>=4'} + strip-literal@3.1.0: + resolution: {integrity: sha512-8r3mkIM/2+PpjHoOtiAW8Rg3jJLHaV7xPwG+YRGrv6FP0wwk/toTpATxWYOW0BKdWwl82VT2tFYi5DlROa0Mxg==} supports-color@7.2.0: resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} @@ -2349,136 +1637,120 @@ packages: resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} engines: {node: '>= 0.4'} - synckit@0.9.1: - resolution: {integrity: sha512-7gr8p9TQP6RAHusBOSLs46F4564ZrjV8xFmw5zCmgmhGUcw2hxsShhJ6CEiHQMgPDwAQ1fWHPM0ypc4RMAig4A==} - engines: {node: ^14.18.0 || >=16.0.0} - - tapable@2.2.1: - resolution: {integrity: sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==} - engines: {node: '>=6'} - - text-table@0.2.0: - resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} + tagged-tag@1.0.0: + resolution: {integrity: sha512-yEFYrVhod+hdNyx7g5Bnkkb0G6si8HJurOoOEgC8B/O0uXLHlaey/65KRv6cuWBNhBgHKAROVpc7QyYqE5gFng==} + engines: {node: '>=20'} tinybench@2.9.0: resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} - tinyexec@0.3.0: - resolution: {integrity: sha512-tVGE0mVJPGb0chKhqmsoosjsS+qUnJVGJpZgsHYQcGoPlG3B51R3PouqTgEGH2Dc9jjFyOqOpix6ZHNMXp1FZg==} + tinyexec@0.3.2: + resolution: {integrity: sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==} - tinypool@1.0.1: - resolution: {integrity: sha512-URZYihUbRPcGv95En+sz6MfghfIc2OJ1sv/RmhWZLouPY0/8Vo80viwPvg3dlaS9fuq7fQMEfgRRK7BBZThBEA==} + tinyglobby@0.2.15: + resolution: {integrity: sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==} + engines: {node: '>=12.0.0'} + + tinypool@1.1.1: + resolution: {integrity: sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg==} engines: {node: ^18.0.0 || >=20.0.0} - tinyrainbow@1.2.0: - resolution: {integrity: sha512-weEDEq7Z5eTHPDh4xjX789+fHfF+P8boiFB+0vbWzpbnbsEr/GRaohi/uMKxg8RZMXnl1ItAi/IUHWMsjDV7kQ==} + tinyrainbow@2.0.0: + resolution: {integrity: sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==} engines: {node: '>=14.0.0'} - tinyspy@3.0.2: - resolution: {integrity: sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q==} + tinyspy@4.0.4: + resolution: {integrity: sha512-azl+t0z7pw/z958Gy9svOTuzqIk6xq+NSheJzn5MMWtWTFywIacg2wUlzKFGtt3cthx0r2SxMK0yzJOR0IES7Q==} engines: {node: '>=14.0.0'} - to-fast-properties@2.0.0: - resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} - engines: {node: '>=4'} - - to-regex-range@5.0.1: - resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} - engines: {node: '>=8.0'} - toposort@2.0.2: resolution: {integrity: sha512-0a5EOkAUp8D4moMi2W8ZF8jcga7BgZd91O/yabJCFY8az+XSzeGyTKs0Aoo897iV1Nj6guFq8orWDS96z91oGg==} - ts-api-utils@1.3.0: - resolution: {integrity: sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==} - engines: {node: '>=16'} + ts-api-utils@2.4.0: + resolution: {integrity: sha512-3TaVTaAv2gTiMB35i3FiGJaRfwb3Pyn/j3m/bfAvGe8FB7CF6u+LMYqYlDh7reQf7UNvoTvdfAqHGmPGOSsPmA==} + engines: {node: '>=18.12'} peerDependencies: - typescript: '>=4.2.0' + typescript: '>=4.8.4' - ts-morph@23.0.0: - resolution: {integrity: sha512-FcvFx7a9E8TUe6T3ShihXJLiJOiqyafzFKUO4aqIHDUCIvADdGNShcbc2W5PMr3LerXRv7mafvFZ9lRENxJmug==} + ts-morph@27.0.2: + resolution: {integrity: sha512-fhUhgeljcrdZ+9DZND1De1029PrE+cMkIP7ooqkLRTrRLTqcki2AstsyJm0vRNbTbVCNJ0idGlbBrfqc7/nA8w==} tsconfig-paths@3.15.0: resolution: {integrity: sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==} - tslib@2.7.0: - resolution: {integrity: sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==} - type-check@0.4.0: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} - type-fest@0.20.2: - resolution: {integrity: sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==} - engines: {node: '>=10'} - - type-fest@2.19.0: - resolution: {integrity: sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==} - engines: {node: '>=12.20'} - - type-fest@4.26.1: - resolution: {integrity: sha512-yOGpmOAL7CkKe/91I5O3gPICmJNLJ1G4zFYVAsRHg7M64biSnPtRj0WNQt++bRkjYOqjWXrhnUw1utzmVErAdg==} - engines: {node: '>=16'} + type-fest@5.4.4: + resolution: {integrity: sha512-JnTrzGu+zPV3aXIUhnyWJj4z/wigMsdYajGLIYakqyOW1nPllzXEJee0QQbHj+CTIQtXGlAjuK0UY+2xTyjVAw==} + engines: {node: '>=20'} typed-array-buffer@1.0.2: resolution: {integrity: sha512-gEymJYKZtKXzzBzM4jqa9w6Q1Jjm7x2d+sh19AdsD4wqnMPDYyvwpsIc2Q/835kHuo3BEQ7CjelGhfTsoBb2MQ==} engines: {node: '>= 0.4'} + typed-array-buffer@1.0.3: + resolution: {integrity: sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==} + engines: {node: '>= 0.4'} + typed-array-byte-length@1.0.1: resolution: {integrity: sha512-3iMJ9q0ao7WE9tWcaYKIptkNBuOIcZCCT0d4MRvuuH88fEoEH62IuQe0OtraD3ebQEoTRk8XCBoknUNc1Y67pw==} engines: {node: '>= 0.4'} + typed-array-byte-length@1.0.3: + resolution: {integrity: sha512-BaXgOuIxz8n8pIq3e7Atg/7s+DpiYrxn4vdot3w9KbnBhcRQq6o3xemQdIfynqSeXeDrF32x+WvfzmOjPiY9lg==} + engines: {node: '>= 0.4'} + typed-array-byte-offset@1.0.2: resolution: {integrity: sha512-Ous0vodHa56FviZucS2E63zkgtgrACj7omjwd/8lTEMEPFFyjfixMZ1ZXenpgCFBBt4EC1J2XsyVS2gkG0eTFA==} engines: {node: '>= 0.4'} + typed-array-byte-offset@1.0.4: + resolution: {integrity: sha512-bTlAFB/FBYMcuX81gbL4OcpH5PmlFHqlCCpAl8AlEzMz5k53oNDvN8p1PNOWLEmI2x4orp3raOFB51tv9X+MFQ==} + engines: {node: '>= 0.4'} + typed-array-length@1.0.6: resolution: {integrity: sha512-/OxDN6OtAk5KBpGb28T+HZc2M+ADtvRxXrKKbUwtsLgdoxgX13hyy7ek6bFRl5+aBs2yZzB0c4CnQfAtVypW/g==} engines: {node: '>= 0.4'} - typescript@5.6.2: - resolution: {integrity: sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==} + typed-array-length@1.0.7: + resolution: {integrity: sha512-3KS2b+kL7fsuk/eJZ7EQdnEmQoaho/r6KUef7hxvltNA5DR8NAUM+8wJMbJyZ4G9/7i3v5zPBIMN5aybAh2/Jg==} + engines: {node: '>= 0.4'} + + typescript@5.9.3: + resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==} engines: {node: '>=14.17'} hasBin: true unbox-primitive@1.0.2: resolution: {integrity: sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==} - undici-types@6.19.8: - resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==} - - undici@6.19.8: - resolution: {integrity: sha512-U8uCCl2x9TK3WANvmBavymRzxbfFYG+tAu+fgx3zxQy3qdagQqBLwJVrdyO1TBfUXvfKveMKJZhpvUYoOjM+4g==} - engines: {node: '>=18.17'} - - unicode-canonical-property-names-ecmascript@2.0.1: - resolution: {integrity: sha512-dA8WbNeb2a6oQzAQ55YlT5vQAWGV9WXOsi3SskE3bcCdM0P4SDd+24zS/OCacdRq5BkdsRj9q3Pg6YyQoxIGqg==} - engines: {node: '>=4'} - - unicode-match-property-ecmascript@2.0.0: - resolution: {integrity: sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q==} - engines: {node: '>=4'} - - unicode-match-property-value-ecmascript@2.2.0: - resolution: {integrity: sha512-4IehN3V/+kkr5YeSSDDQG8QLqO26XpL2XP3GQtqwlT/QYSECAwFztxVHjlbh0+gjJ3XmNLS0zDsbgs9jWKExLg==} - engines: {node: '>=4'} + unbox-primitive@1.1.0: + resolution: {integrity: sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==} + engines: {node: '>= 0.4'} - unicode-property-aliases-ecmascript@2.1.0: - resolution: {integrity: sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w==} - engines: {node: '>=4'} + undici-types@7.16.0: + resolution: {integrity: sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==} - update-browserslist-db@1.1.1: - resolution: {integrity: sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A==} - hasBin: true - peerDependencies: - browserslist: '>= 4.21.0' + undici@7.22.0: + resolution: {integrity: sha512-RqslV2Us5BrllB+JeiZnK4peryVTndy9Dnqq62S3yYRRTj0tFQCwEniUy2167skdGOy3vqRzEvl1Dm4sV2ReDg==} + engines: {node: '>=20.18.1'} uri-js@4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} - vite-node@2.1.1: - resolution: {integrity: sha512-N/mGckI1suG/5wQI35XeR9rsMsPqKXzq1CdUndzVstBj/HvyxxGctwnK6WX43NGt5L3Z5tcRf83g4TITKJhPrA==} - engines: {node: ^18.0.0 || >=20.0.0} + valibot@1.2.0: + resolution: {integrity: sha512-mm1rxUsmOxzrwnX5arGS+U4T25RdvpPjPN4yR0u9pUBov9+zGVtO84tif1eY4r6zWxVxu3KzIyknJy3rxfRZZg==} + peerDependencies: + typescript: '>=5' + peerDependenciesMeta: + typescript: + optional: true + + vite-node@3.2.4: + resolution: {integrity: sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg==} + engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} hasBin: true vite@5.4.8: @@ -2512,20 +1784,23 @@ packages: terser: optional: true - vitest@2.1.1: - resolution: {integrity: sha512-97We7/VC0e9X5zBVkvt7SGQMGrRtn3KtySFQG5fpaMlS+l62eeXRQO633AYhSTC3z7IMebnPPNjGXVGNRFlxBA==} - engines: {node: ^18.0.0 || >=20.0.0} + vitest@3.2.4: + resolution: {integrity: sha512-LUCP5ev3GURDysTWiP47wRRUpLKMOfPh+yKTx3kVIEiu5KOMeqzpnYNsKyOoVrULivR8tLcks4+lga33Whn90A==} + engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} hasBin: true peerDependencies: '@edge-runtime/vm': '*' - '@types/node': ^18.0.0 || >=20.0.0 - '@vitest/browser': 2.1.1 - '@vitest/ui': 2.1.1 + '@types/debug': ^4.1.12 + '@types/node': ^18.0.0 || ^20.0.0 || >=22.0.0 + '@vitest/browser': 3.2.4 + '@vitest/ui': 3.2.4 happy-dom: '*' jsdom: '*' peerDependenciesMeta: '@edge-runtime/vm': optional: true + '@types/debug': + optional: true '@types/node': optional: true '@vitest/browser': @@ -2540,10 +1815,18 @@ packages: which-boxed-primitive@1.0.2: resolution: {integrity: sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==} + which-boxed-primitive@1.1.1: + resolution: {integrity: sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==} + engines: {node: '>= 0.4'} + which-builtin-type@1.1.4: resolution: {integrity: sha512-bppkmBSsHFmIMSl8BO9TbsyzsvGjVoppt8xUiGzwiu/bhDCGxnpOKCxgqj6GuyHE0mINMDecBFPlOm2hzY084w==} engines: {node: '>= 0.4'} + which-builtin-type@1.2.1: + resolution: {integrity: sha512-6iBczoX+kDQ7a3+YJBnh3T+KZRxM/iYNPXicqk66/Qfm1b93iu+yOImkg0zHbj5LNOcNv1TEADiZ0xa34B4q6Q==} + engines: {node: '>= 0.4'} + which-collection@1.0.2: resolution: {integrity: sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==} engines: {node: '>= 0.4'} @@ -2552,6 +1835,10 @@ packages: resolution: {integrity: sha512-oV0jmFtUky6CXfkqehVvBP/LSWJ2sy4vWMioiENyJLePrBO/yKyV9OyJySfAKosh+RYkIl5zJCNZ8/4JncrpdA==} engines: {node: '>= 0.4'} + which-typed-array@1.1.20: + resolution: {integrity: sha512-LYfpUkmqwl0h9A2HL09Mms427Q1RZWuOHsukfVcKRq9q95iQxdw0ix1JQrqbcDR9PH1QDwf5Qo8OZb5lksZ8Xg==} + engines: {node: '>= 0.4'} + which@2.0.2: resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} engines: {node: '>= 8'} @@ -2566,32 +1853,26 @@ packages: resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==} engines: {node: '>=0.10.0'} - wrap-ansi@7.0.0: - resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} - engines: {node: '>=10'} - - wrappy@1.0.2: - resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + wrap-ansi@9.0.2: + resolution: {integrity: sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==} + engines: {node: '>=18'} y18n@5.0.8: resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} engines: {node: '>=10'} - yallist@3.1.1: - resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} - yaml@2.5.1: resolution: {integrity: sha512-bLQOjaX/ADgQ20isPJRvF0iRUHIxVhYvr53Of7wGcWlO2jvtUlH5m87DsmulFVxRpNLOnI4tB6p/oh8D7kpn9Q==} engines: {node: '>= 14'} hasBin: true - yargs-parser@21.1.1: - resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} - engines: {node: '>=12'} + yargs-parser@22.0.0: + resolution: {integrity: sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==} + engines: {node: ^20.19.0 || ^22.12.0 || >=23} - yargs@17.7.2: - resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} - engines: {node: '>=12'} + yargs@18.0.0: + resolution: {integrity: sha512-4UEqdc2RYGHZc7Doyqkrqiln3p9X2DZVxaGbwhn2pi7MrRagKaOcIKe8L3OxYcbhXLgLFUS3zAYuQjKBQgmuNg==} + engines: {node: ^20.19.0 || ^22.12.0 || >=23} yocto-queue@0.1.0: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} @@ -2599,842 +1880,54 @@ packages: snapshots: - '@ampproject/remapping@2.3.0': - dependencies: - '@jridgewell/gen-mapping': 0.3.5 - '@jridgewell/trace-mapping': 0.3.25 - - '@apidevtools/json-schema-ref-parser@11.7.0': + '@apidevtools/json-schema-ref-parser@15.3.1(@types/json-schema@7.0.15)': dependencies: - '@jsdevtools/ono': 7.1.3 '@types/json-schema': 7.0.15 - js-yaml: 4.1.0 - - '@babel/code-frame@7.24.7': - dependencies: - '@babel/highlight': 7.24.7 - picocolors: 1.1.0 - - '@babel/compat-data@7.25.4': {} - - '@babel/core@7.25.2': - dependencies: - '@ampproject/remapping': 2.3.0 - '@babel/code-frame': 7.24.7 - '@babel/generator': 7.25.6 - '@babel/helper-compilation-targets': 7.25.2 - '@babel/helper-module-transforms': 7.25.2(@babel/core@7.25.2) - '@babel/helpers': 7.25.6 - '@babel/parser': 7.25.6 - '@babel/template': 7.25.0 - '@babel/traverse': 7.25.6 - '@babel/types': 7.25.6 - convert-source-map: 2.0.0 - debug: 4.3.7 - gensync: 1.0.0-beta.2 - json5: 2.2.3 - semver: 6.3.1 - transitivePeerDependencies: - - supports-color - - '@babel/generator@7.25.6': - dependencies: - '@babel/types': 7.25.6 - '@jridgewell/gen-mapping': 0.3.5 - '@jridgewell/trace-mapping': 0.3.25 - jsesc: 2.5.2 - - '@babel/helper-annotate-as-pure@7.24.7': - dependencies: - '@babel/types': 7.25.6 - - '@babel/helper-builder-binary-assignment-operator-visitor@7.24.7': - dependencies: - '@babel/traverse': 7.25.6 - '@babel/types': 7.25.6 - transitivePeerDependencies: - - supports-color - - '@babel/helper-compilation-targets@7.25.2': - dependencies: - '@babel/compat-data': 7.25.4 - '@babel/helper-validator-option': 7.24.8 - browserslist: 4.24.0 - lru-cache: 5.1.1 - semver: 6.3.1 - - '@babel/helper-create-class-features-plugin@7.25.4(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-annotate-as-pure': 7.24.7 - '@babel/helper-member-expression-to-functions': 7.24.8 - '@babel/helper-optimise-call-expression': 7.24.7 - '@babel/helper-replace-supers': 7.25.0(@babel/core@7.25.2) - '@babel/helper-skip-transparent-expression-wrappers': 7.24.7 - '@babel/traverse': 7.25.6 - semver: 6.3.1 - transitivePeerDependencies: - - supports-color - - '@babel/helper-create-regexp-features-plugin@7.25.2(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-annotate-as-pure': 7.24.7 - regexpu-core: 5.3.2 - semver: 6.3.1 - - '@babel/helper-define-polyfill-provider@0.6.2(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-compilation-targets': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - debug: 4.3.7 - lodash.debounce: 4.0.8 - resolve: 1.22.8 - transitivePeerDependencies: - - supports-color - - '@babel/helper-member-expression-to-functions@7.24.8': - dependencies: - '@babel/traverse': 7.25.6 - '@babel/types': 7.25.6 - transitivePeerDependencies: - - supports-color - - '@babel/helper-module-imports@7.24.7': - dependencies: - '@babel/traverse': 7.25.6 - '@babel/types': 7.25.6 - transitivePeerDependencies: - - supports-color - - '@babel/helper-module-transforms@7.25.2(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-module-imports': 7.24.7 - '@babel/helper-simple-access': 7.24.7 - '@babel/helper-validator-identifier': 7.24.7 - '@babel/traverse': 7.25.6 - transitivePeerDependencies: - - supports-color - - '@babel/helper-optimise-call-expression@7.24.7': - dependencies: - '@babel/types': 7.25.6 - - '@babel/helper-plugin-utils@7.24.8': {} - - '@babel/helper-remap-async-to-generator@7.25.0(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-annotate-as-pure': 7.24.7 - '@babel/helper-wrap-function': 7.25.0 - '@babel/traverse': 7.25.6 - transitivePeerDependencies: - - supports-color - - '@babel/helper-replace-supers@7.25.0(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-member-expression-to-functions': 7.24.8 - '@babel/helper-optimise-call-expression': 7.24.7 - '@babel/traverse': 7.25.6 - transitivePeerDependencies: - - supports-color - - '@babel/helper-simple-access@7.24.7': - dependencies: - '@babel/traverse': 7.25.6 - '@babel/types': 7.25.6 - transitivePeerDependencies: - - supports-color - - '@babel/helper-skip-transparent-expression-wrappers@7.24.7': - dependencies: - '@babel/traverse': 7.25.6 - '@babel/types': 7.25.6 - transitivePeerDependencies: - - supports-color - - '@babel/helper-string-parser@7.24.8': {} - - '@babel/helper-validator-identifier@7.24.7': {} - - '@babel/helper-validator-option@7.24.8': {} - - '@babel/helper-wrap-function@7.25.0': - dependencies: - '@babel/template': 7.25.0 - '@babel/traverse': 7.25.6 - '@babel/types': 7.25.6 - transitivePeerDependencies: - - supports-color - - '@babel/helpers@7.25.6': - dependencies: - '@babel/template': 7.25.0 - '@babel/types': 7.25.6 - - '@babel/highlight@7.24.7': - dependencies: - '@babel/helper-validator-identifier': 7.24.7 - chalk: 2.4.2 - js-tokens: 4.0.0 - picocolors: 1.1.0 - - '@babel/parser@7.25.6': - dependencies: - '@babel/types': 7.25.6 - - '@babel/plugin-bugfix-firefox-class-in-computed-class-key@7.25.3(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - '@babel/traverse': 7.25.6 - transitivePeerDependencies: - - supports-color - - '@babel/plugin-bugfix-safari-class-field-initializer-scope@7.25.0(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@7.25.0(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - '@babel/helper-skip-transparent-expression-wrappers': 7.24.7 - '@babel/plugin-transform-optional-chaining': 7.24.8(@babel/core@7.25.2) - transitivePeerDependencies: - - supports-color - - '@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@7.25.0(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - '@babel/traverse': 7.25.6 - transitivePeerDependencies: - - supports-color - - '@babel/plugin-proposal-private-property-in-object@7.21.0-placeholder-for-preset-env.2(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - - '@babel/plugin-syntax-async-generators@7.8.4(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-syntax-class-properties@7.12.13(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-syntax-class-static-block@7.14.5(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-syntax-dynamic-import@7.8.3(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-syntax-export-namespace-from@7.8.3(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-syntax-import-assertions@7.25.6(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-syntax-import-attributes@7.25.6(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-syntax-import-meta@7.10.4(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-syntax-json-strings@7.8.3(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-syntax-jsx@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-syntax-logical-assignment-operators@7.10.4(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-syntax-nullish-coalescing-operator@7.8.3(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 + js-yaml: 4.1.1 - '@babel/plugin-syntax-numeric-separator@7.10.4(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-syntax-object-rest-spread@7.8.3(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-syntax-optional-catch-binding@7.8.3(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-syntax-optional-chaining@7.8.3(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-syntax-private-property-in-object@7.14.5(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-syntax-top-level-await@7.14.5(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-syntax-typescript@7.25.4(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-syntax-unicode-sets-regex@7.18.6(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-create-regexp-features-plugin': 7.25.2(@babel/core@7.25.2) - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-transform-arrow-functions@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-transform-async-generator-functions@7.25.4(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - '@babel/helper-remap-async-to-generator': 7.25.0(@babel/core@7.25.2) - '@babel/plugin-syntax-async-generators': 7.8.4(@babel/core@7.25.2) - '@babel/traverse': 7.25.6 - transitivePeerDependencies: - - supports-color - - '@babel/plugin-transform-async-to-generator@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-module-imports': 7.24.7 - '@babel/helper-plugin-utils': 7.24.8 - '@babel/helper-remap-async-to-generator': 7.25.0(@babel/core@7.25.2) - transitivePeerDependencies: - - supports-color - - '@babel/plugin-transform-block-scoped-functions@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-transform-block-scoping@7.25.0(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-transform-class-properties@7.25.4(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-create-class-features-plugin': 7.25.4(@babel/core@7.25.2) - '@babel/helper-plugin-utils': 7.24.8 - transitivePeerDependencies: - - supports-color - - '@babel/plugin-transform-class-static-block@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-create-class-features-plugin': 7.25.4(@babel/core@7.25.2) - '@babel/helper-plugin-utils': 7.24.8 - '@babel/plugin-syntax-class-static-block': 7.14.5(@babel/core@7.25.2) - transitivePeerDependencies: - - supports-color - - '@babel/plugin-transform-classes@7.25.4(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-annotate-as-pure': 7.24.7 - '@babel/helper-compilation-targets': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - '@babel/helper-replace-supers': 7.25.0(@babel/core@7.25.2) - '@babel/traverse': 7.25.6 - globals: 11.12.0 - transitivePeerDependencies: - - supports-color - - '@babel/plugin-transform-computed-properties@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - '@babel/template': 7.25.0 - - '@babel/plugin-transform-destructuring@7.24.8(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-transform-dotall-regex@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-create-regexp-features-plugin': 7.25.2(@babel/core@7.25.2) - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-transform-duplicate-keys@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-transform-duplicate-named-capturing-groups-regex@7.25.0(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-create-regexp-features-plugin': 7.25.2(@babel/core@7.25.2) - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-transform-dynamic-import@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - '@babel/plugin-syntax-dynamic-import': 7.8.3(@babel/core@7.25.2) - - '@babel/plugin-transform-exponentiation-operator@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-builder-binary-assignment-operator-visitor': 7.24.7 - '@babel/helper-plugin-utils': 7.24.8 - transitivePeerDependencies: - - supports-color - - '@babel/plugin-transform-export-namespace-from@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - '@babel/plugin-syntax-export-namespace-from': 7.8.3(@babel/core@7.25.2) - - '@babel/plugin-transform-for-of@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - '@babel/helper-skip-transparent-expression-wrappers': 7.24.7 - transitivePeerDependencies: - - supports-color - - '@babel/plugin-transform-function-name@7.25.1(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-compilation-targets': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - '@babel/traverse': 7.25.6 - transitivePeerDependencies: - - supports-color - - '@babel/plugin-transform-json-strings@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - '@babel/plugin-syntax-json-strings': 7.8.3(@babel/core@7.25.2) - - '@babel/plugin-transform-literals@7.25.2(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-transform-logical-assignment-operators@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - '@babel/plugin-syntax-logical-assignment-operators': 7.10.4(@babel/core@7.25.2) - - '@babel/plugin-transform-member-expression-literals@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-transform-modules-amd@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-module-transforms': 7.25.2(@babel/core@7.25.2) - '@babel/helper-plugin-utils': 7.24.8 - transitivePeerDependencies: - - supports-color - - '@babel/plugin-transform-modules-commonjs@7.24.8(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-module-transforms': 7.25.2(@babel/core@7.25.2) - '@babel/helper-plugin-utils': 7.24.8 - '@babel/helper-simple-access': 7.24.7 - transitivePeerDependencies: - - supports-color - - '@babel/plugin-transform-modules-systemjs@7.25.0(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-module-transforms': 7.25.2(@babel/core@7.25.2) - '@babel/helper-plugin-utils': 7.24.8 - '@babel/helper-validator-identifier': 7.24.7 - '@babel/traverse': 7.25.6 - transitivePeerDependencies: - - supports-color - - '@babel/plugin-transform-modules-umd@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-module-transforms': 7.25.2(@babel/core@7.25.2) - '@babel/helper-plugin-utils': 7.24.8 - transitivePeerDependencies: - - supports-color - - '@babel/plugin-transform-named-capturing-groups-regex@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-create-regexp-features-plugin': 7.25.2(@babel/core@7.25.2) - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-transform-new-target@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-transform-nullish-coalescing-operator@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - '@babel/plugin-syntax-nullish-coalescing-operator': 7.8.3(@babel/core@7.25.2) - - '@babel/plugin-transform-numeric-separator@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - '@babel/plugin-syntax-numeric-separator': 7.10.4(@babel/core@7.25.2) - - '@babel/plugin-transform-object-rest-spread@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-compilation-targets': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - '@babel/plugin-syntax-object-rest-spread': 7.8.3(@babel/core@7.25.2) - '@babel/plugin-transform-parameters': 7.24.7(@babel/core@7.25.2) - - '@babel/plugin-transform-object-super@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - '@babel/helper-replace-supers': 7.25.0(@babel/core@7.25.2) - transitivePeerDependencies: - - supports-color - - '@babel/plugin-transform-optional-catch-binding@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - '@babel/plugin-syntax-optional-catch-binding': 7.8.3(@babel/core@7.25.2) - - '@babel/plugin-transform-optional-chaining@7.24.8(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - '@babel/helper-skip-transparent-expression-wrappers': 7.24.7 - '@babel/plugin-syntax-optional-chaining': 7.8.3(@babel/core@7.25.2) - transitivePeerDependencies: - - supports-color - - '@babel/plugin-transform-parameters@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-transform-private-methods@7.25.4(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-create-class-features-plugin': 7.25.4(@babel/core@7.25.2) - '@babel/helper-plugin-utils': 7.24.8 - transitivePeerDependencies: - - supports-color - - '@babel/plugin-transform-private-property-in-object@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-annotate-as-pure': 7.24.7 - '@babel/helper-create-class-features-plugin': 7.25.4(@babel/core@7.25.2) - '@babel/helper-plugin-utils': 7.24.8 - '@babel/plugin-syntax-private-property-in-object': 7.14.5(@babel/core@7.25.2) - transitivePeerDependencies: - - supports-color - - '@babel/plugin-transform-property-literals@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-transform-regenerator@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - regenerator-transform: 0.15.2 - - '@babel/plugin-transform-reserved-words@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-transform-shorthand-properties@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-transform-spread@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - '@babel/helper-skip-transparent-expression-wrappers': 7.24.7 - transitivePeerDependencies: - - supports-color - - '@babel/plugin-transform-sticky-regex@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-transform-template-literals@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-transform-typeof-symbol@7.24.8(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-transform-typescript@7.25.2(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-annotate-as-pure': 7.24.7 - '@babel/helper-create-class-features-plugin': 7.25.4(@babel/core@7.25.2) - '@babel/helper-plugin-utils': 7.24.8 - '@babel/helper-skip-transparent-expression-wrappers': 7.24.7 - '@babel/plugin-syntax-typescript': 7.25.4(@babel/core@7.25.2) - transitivePeerDependencies: - - supports-color - - '@babel/plugin-transform-unicode-escapes@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-transform-unicode-property-regex@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-create-regexp-features-plugin': 7.25.2(@babel/core@7.25.2) - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-transform-unicode-regex@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-create-regexp-features-plugin': 7.25.2(@babel/core@7.25.2) - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-transform-unicode-sets-regex@7.25.4(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-create-regexp-features-plugin': 7.25.2(@babel/core@7.25.2) - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/preset-env@7.25.4(@babel/core@7.25.2)': - dependencies: - '@babel/compat-data': 7.25.4 - '@babel/core': 7.25.2 - '@babel/helper-compilation-targets': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - '@babel/helper-validator-option': 7.24.8 - '@babel/plugin-bugfix-firefox-class-in-computed-class-key': 7.25.3(@babel/core@7.25.2) - '@babel/plugin-bugfix-safari-class-field-initializer-scope': 7.25.0(@babel/core@7.25.2) - '@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression': 7.25.0(@babel/core@7.25.2) - '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly': 7.25.0(@babel/core@7.25.2) - '@babel/plugin-proposal-private-property-in-object': 7.21.0-placeholder-for-preset-env.2(@babel/core@7.25.2) - '@babel/plugin-syntax-async-generators': 7.8.4(@babel/core@7.25.2) - '@babel/plugin-syntax-class-properties': 7.12.13(@babel/core@7.25.2) - '@babel/plugin-syntax-class-static-block': 7.14.5(@babel/core@7.25.2) - '@babel/plugin-syntax-dynamic-import': 7.8.3(@babel/core@7.25.2) - '@babel/plugin-syntax-export-namespace-from': 7.8.3(@babel/core@7.25.2) - '@babel/plugin-syntax-import-assertions': 7.25.6(@babel/core@7.25.2) - '@babel/plugin-syntax-import-attributes': 7.25.6(@babel/core@7.25.2) - '@babel/plugin-syntax-import-meta': 7.10.4(@babel/core@7.25.2) - '@babel/plugin-syntax-json-strings': 7.8.3(@babel/core@7.25.2) - '@babel/plugin-syntax-logical-assignment-operators': 7.10.4(@babel/core@7.25.2) - '@babel/plugin-syntax-nullish-coalescing-operator': 7.8.3(@babel/core@7.25.2) - '@babel/plugin-syntax-numeric-separator': 7.10.4(@babel/core@7.25.2) - '@babel/plugin-syntax-object-rest-spread': 7.8.3(@babel/core@7.25.2) - '@babel/plugin-syntax-optional-catch-binding': 7.8.3(@babel/core@7.25.2) - '@babel/plugin-syntax-optional-chaining': 7.8.3(@babel/core@7.25.2) - '@babel/plugin-syntax-private-property-in-object': 7.14.5(@babel/core@7.25.2) - '@babel/plugin-syntax-top-level-await': 7.14.5(@babel/core@7.25.2) - '@babel/plugin-syntax-unicode-sets-regex': 7.18.6(@babel/core@7.25.2) - '@babel/plugin-transform-arrow-functions': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-async-generator-functions': 7.25.4(@babel/core@7.25.2) - '@babel/plugin-transform-async-to-generator': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-block-scoped-functions': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-block-scoping': 7.25.0(@babel/core@7.25.2) - '@babel/plugin-transform-class-properties': 7.25.4(@babel/core@7.25.2) - '@babel/plugin-transform-class-static-block': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-classes': 7.25.4(@babel/core@7.25.2) - '@babel/plugin-transform-computed-properties': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-destructuring': 7.24.8(@babel/core@7.25.2) - '@babel/plugin-transform-dotall-regex': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-duplicate-keys': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-duplicate-named-capturing-groups-regex': 7.25.0(@babel/core@7.25.2) - '@babel/plugin-transform-dynamic-import': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-exponentiation-operator': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-export-namespace-from': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-for-of': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-function-name': 7.25.1(@babel/core@7.25.2) - '@babel/plugin-transform-json-strings': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-literals': 7.25.2(@babel/core@7.25.2) - '@babel/plugin-transform-logical-assignment-operators': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-member-expression-literals': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-modules-amd': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-modules-commonjs': 7.24.8(@babel/core@7.25.2) - '@babel/plugin-transform-modules-systemjs': 7.25.0(@babel/core@7.25.2) - '@babel/plugin-transform-modules-umd': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-named-capturing-groups-regex': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-new-target': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-nullish-coalescing-operator': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-numeric-separator': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-object-rest-spread': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-object-super': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-optional-catch-binding': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-optional-chaining': 7.24.8(@babel/core@7.25.2) - '@babel/plugin-transform-parameters': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-private-methods': 7.25.4(@babel/core@7.25.2) - '@babel/plugin-transform-private-property-in-object': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-property-literals': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-regenerator': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-reserved-words': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-shorthand-properties': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-spread': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-sticky-regex': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-template-literals': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-typeof-symbol': 7.24.8(@babel/core@7.25.2) - '@babel/plugin-transform-unicode-escapes': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-unicode-property-regex': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-unicode-regex': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-unicode-sets-regex': 7.25.4(@babel/core@7.25.2) - '@babel/preset-modules': 0.1.6-no-external-plugins(@babel/core@7.25.2) - babel-plugin-polyfill-corejs2: 0.4.11(@babel/core@7.25.2) - babel-plugin-polyfill-corejs3: 0.10.6(@babel/core@7.25.2) - babel-plugin-polyfill-regenerator: 0.6.2(@babel/core@7.25.2) - core-js-compat: 3.38.1 - semver: 6.3.1 - transitivePeerDependencies: - - supports-color - - '@babel/preset-modules@0.1.6-no-external-plugins(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - '@babel/types': 7.25.6 - esutils: 2.0.3 + '@biomejs/biome@2.4.6': + optionalDependencies: + '@biomejs/cli-darwin-arm64': 2.4.6 + '@biomejs/cli-darwin-x64': 2.4.6 + '@biomejs/cli-linux-arm64': 2.4.6 + '@biomejs/cli-linux-arm64-musl': 2.4.6 + '@biomejs/cli-linux-x64': 2.4.6 + '@biomejs/cli-linux-x64-musl': 2.4.6 + '@biomejs/cli-win32-arm64': 2.4.6 + '@biomejs/cli-win32-x64': 2.4.6 + + '@biomejs/cli-darwin-arm64@2.4.6': + optional: true - '@babel/preset-typescript@7.24.7(@babel/core@7.25.2)': - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-plugin-utils': 7.24.8 - '@babel/helper-validator-option': 7.24.8 - '@babel/plugin-syntax-jsx': 7.24.7(@babel/core@7.25.2) - '@babel/plugin-transform-modules-commonjs': 7.24.8(@babel/core@7.25.2) - '@babel/plugin-transform-typescript': 7.25.2(@babel/core@7.25.2) - transitivePeerDependencies: - - supports-color + '@biomejs/cli-darwin-x64@2.4.6': + optional: true - '@babel/regjsgen@0.8.0': {} + '@biomejs/cli-linux-arm64-musl@2.4.6': + optional: true - '@babel/runtime@7.25.6': - dependencies: - regenerator-runtime: 0.14.1 + '@biomejs/cli-linux-arm64@2.4.6': + optional: true - '@babel/template@7.25.0': - dependencies: - '@babel/code-frame': 7.24.7 - '@babel/parser': 7.25.6 - '@babel/types': 7.25.6 + '@biomejs/cli-linux-x64-musl@2.4.6': + optional: true - '@babel/traverse@7.25.6': - dependencies: - '@babel/code-frame': 7.24.7 - '@babel/generator': 7.25.6 - '@babel/parser': 7.25.6 - '@babel/template': 7.25.0 - '@babel/types': 7.25.6 - debug: 4.3.7 - globals: 11.12.0 - transitivePeerDependencies: - - supports-color + '@biomejs/cli-linux-x64@2.4.6': + optional: true - '@babel/types@7.25.6': - dependencies: - '@babel/helper-string-parser': 7.24.8 - '@babel/helper-validator-identifier': 7.24.7 - to-fast-properties: 2.0.0 + '@biomejs/cli-win32-arm64@2.4.6': + optional: true - '@block65/custom-error@12.2.0': - dependencies: - serialize-error: 11.0.3 + '@biomejs/cli-win32-x64@2.4.6': + optional: true - '@block65/eslint-config@12.0.1(@typescript-eslint/eslint-plugin@7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1)(typescript@5.6.2))(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint-plugin-import@2.30.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1))(eslint-plugin-jsx-a11y@6.10.0(eslint@8.57.1))(eslint-plugin-react-hooks@4.6.2(eslint@8.57.1))(eslint-plugin-react@7.37.1(eslint@8.57.1))(eslint@8.57.1)(prettier@3.3.3)(typescript@5.6.2)': + '@block65/custom-error@14.0.0': dependencies: - '@typescript-eslint/eslint-plugin': 7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1)(typescript@5.6.2) - '@typescript-eslint/parser': 7.18.0(eslint@8.57.1)(typescript@5.6.2) - eslint: 8.57.1 - eslint-config-airbnb: 19.0.4(eslint-plugin-import@2.30.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1))(eslint-plugin-jsx-a11y@6.10.0(eslint@8.57.1))(eslint-plugin-react-hooks@4.6.2(eslint@8.57.1))(eslint-plugin-react@7.37.1(eslint@8.57.1))(eslint@8.57.1) - eslint-config-airbnb-base: 15.0.0(eslint-plugin-import@2.30.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1))(eslint@8.57.1) - eslint-config-airbnb-typescript: 18.0.0(@typescript-eslint/eslint-plugin@7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1)(typescript@5.6.2))(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint-plugin-import@2.30.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1))(eslint@8.57.1) - eslint-config-prettier: 9.1.0(eslint@8.57.1) - eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint-plugin-import@2.30.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1))(eslint@8.57.1) - eslint-plugin-import: 2.30.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1) - prettier: 3.3.3 - typescript: 5.6.2 - optionalDependencies: - eslint-plugin-jsx-a11y: 6.10.0(eslint@8.57.1) - eslint-plugin-react: 7.37.1(eslint@8.57.1) - eslint-plugin-react-hooks: 4.6.2(eslint@8.57.1) - transitivePeerDependencies: - - eslint-import-resolver-node - - eslint-import-resolver-webpack - - eslint-plugin-import-x - - supports-color + serialize-error: 13.0.1 - '@block65/rest-client@11.0.3': + '@block65/rest-client@12.0.2': dependencies: - '@block65/custom-error': 12.2.0 - '@hapi/bourne': 3.0.0 - p-retry: 6.2.0 + '@block65/custom-error': 14.0.0 + p-retry: 7.1.1 '@esbuild/aix-ppc64@0.21.5': optional: true @@ -3505,77 +1998,66 @@ snapshots: '@esbuild/win32-x64@0.21.5': optional: true - '@eslint-community/eslint-utils@4.4.0(eslint@8.57.1)': + '@eslint-community/eslint-utils@4.9.1(eslint@9.39.3)': dependencies: - eslint: 8.57.1 + eslint: 9.39.3 eslint-visitor-keys: 3.4.3 - '@eslint-community/regexpp@4.11.1': {} + '@eslint-community/regexpp@4.12.2': {} - '@eslint/eslintrc@2.1.4': + '@eslint/config-array@0.21.1': dependencies: - ajv: 6.12.6 + '@eslint/object-schema': 2.1.7 debug: 4.3.7 - espree: 9.6.1 - globals: 13.24.0 - ignore: 5.3.2 - import-fresh: 3.3.0 - js-yaml: 4.1.0 minimatch: 3.1.2 - strip-json-comments: 3.1.1 transitivePeerDependencies: - supports-color - '@eslint/js@8.57.1': {} + '@eslint/config-helpers@0.4.2': + dependencies: + '@eslint/core': 0.17.0 - '@hapi/bourne@3.0.0': {} + '@eslint/core@0.17.0': + dependencies: + '@types/json-schema': 7.0.15 - '@humanwhocodes/config-array@0.13.0': + '@eslint/eslintrc@3.3.4': dependencies: - '@humanwhocodes/object-schema': 2.0.3 + ajv: 6.14.0 debug: 4.3.7 - minimatch: 3.1.2 + espree: 10.4.0 + globals: 14.0.0 + ignore: 5.3.2 + import-fresh: 3.3.0 + js-yaml: 4.1.1 + minimatch: 3.1.5 + strip-json-comments: 3.1.1 transitivePeerDependencies: - supports-color - '@humanwhocodes/module-importer@1.0.1': {} - - '@humanwhocodes/object-schema@2.0.3': {} - - '@jridgewell/gen-mapping@0.3.5': - dependencies: - '@jridgewell/set-array': 1.2.1 - '@jridgewell/sourcemap-codec': 1.5.0 - '@jridgewell/trace-mapping': 0.3.25 - - '@jridgewell/resolve-uri@3.1.2': {} - - '@jridgewell/set-array@1.2.1': {} + '@eslint/js@9.39.3': {} - '@jridgewell/sourcemap-codec@1.5.0': {} + '@eslint/object-schema@2.1.7': {} - '@jridgewell/trace-mapping@0.3.25': + '@eslint/plugin-kit@0.4.1': dependencies: - '@jridgewell/resolve-uri': 3.1.2 - '@jridgewell/sourcemap-codec': 1.5.0 - - '@jsdevtools/ono@7.1.3': {} + '@eslint/core': 0.17.0 + levn: 0.4.1 - '@nodelib/fs.scandir@2.1.5': - dependencies: - '@nodelib/fs.stat': 2.0.5 - run-parallel: 1.2.0 + '@hapi/bourne@3.0.0': {} - '@nodelib/fs.stat@2.0.5': {} + '@humanfs/core@0.19.1': {} - '@nodelib/fs.walk@1.2.8': + '@humanfs/node@0.16.7': dependencies: - '@nodelib/fs.scandir': 2.1.5 - fastq: 1.17.1 + '@humanfs/core': 0.19.1 + '@humanwhocodes/retry': 0.4.3 - '@nolyfill/is-core-module@1.0.39': {} + '@humanwhocodes/module-importer@1.0.1': {} + + '@humanwhocodes/retry@0.4.3': {} - '@pkgr/core@0.1.1': {} + '@jridgewell/sourcemap-codec@1.5.5': {} '@rollup/rollup-android-arm-eabi@4.24.0': optional: true @@ -3627,14 +2109,24 @@ snapshots: '@rtsao/scc@1.1.0': {} - '@ts-morph/common@0.24.0': + '@ts-morph/common@0.28.1': dependencies: - fast-glob: 3.3.2 - minimatch: 9.0.5 - mkdirp: 3.0.1 + minimatch: 10.2.4 path-browserify: 1.0.1 + tinyglobby: 0.2.15 + + '@tsconfig/node24@24.0.4': {} + + '@tsconfig/strictest@2.0.8': {} - '@types/eslint@8.56.12': + '@types/chai@5.2.3': + dependencies: + '@types/deep-eql': 4.0.2 + assertion-error: 2.0.1 + + '@types/deep-eql@4.0.2': {} + + '@types/eslint@9.6.1': dependencies: '@types/estree': 1.0.6 '@types/json-schema': 7.0.15 @@ -3645,148 +2137,156 @@ snapshots: '@types/json5@0.0.29': {} - '@types/node@22.7.4': + '@types/node@24.12.0': dependencies: - undici-types: 6.19.8 - - '@types/retry@0.12.2': {} + undici-types: 7.16.0 '@types/toposort@2.0.7': {} '@types/yargs-parser@21.0.3': {} - '@types/yargs@17.0.33': + '@types/yargs@17.0.35': dependencies: '@types/yargs-parser': 21.0.3 - '@typescript-eslint/eslint-plugin@7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1)(typescript@5.6.2)': + '@typescript-eslint/eslint-plugin@8.56.1(@typescript-eslint/parser@8.56.1(eslint@9.39.3)(typescript@5.9.3))(eslint@9.39.3)(typescript@5.9.3)': dependencies: - '@eslint-community/regexpp': 4.11.1 - '@typescript-eslint/parser': 7.18.0(eslint@8.57.1)(typescript@5.6.2) - '@typescript-eslint/scope-manager': 7.18.0 - '@typescript-eslint/type-utils': 7.18.0(eslint@8.57.1)(typescript@5.6.2) - '@typescript-eslint/utils': 7.18.0(eslint@8.57.1)(typescript@5.6.2) - '@typescript-eslint/visitor-keys': 7.18.0 - eslint: 8.57.1 - graphemer: 1.4.0 - ignore: 5.3.2 + '@eslint-community/regexpp': 4.12.2 + '@typescript-eslint/parser': 8.56.1(eslint@9.39.3)(typescript@5.9.3) + '@typescript-eslint/scope-manager': 8.56.1 + '@typescript-eslint/type-utils': 8.56.1(eslint@9.39.3)(typescript@5.9.3) + '@typescript-eslint/utils': 8.56.1(eslint@9.39.3)(typescript@5.9.3) + '@typescript-eslint/visitor-keys': 8.56.1 + eslint: 9.39.3 + ignore: 7.0.5 natural-compare: 1.4.0 - ts-api-utils: 1.3.0(typescript@5.6.2) - optionalDependencies: - typescript: 5.6.2 + ts-api-utils: 2.4.0(typescript@5.9.3) + typescript: 5.9.3 transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2)': + '@typescript-eslint/parser@8.56.1(eslint@9.39.3)(typescript@5.9.3)': dependencies: - '@typescript-eslint/scope-manager': 7.18.0 - '@typescript-eslint/types': 7.18.0 - '@typescript-eslint/typescript-estree': 7.18.0(typescript@5.6.2) - '@typescript-eslint/visitor-keys': 7.18.0 - debug: 4.3.7 - eslint: 8.57.1 - optionalDependencies: - typescript: 5.6.2 + '@typescript-eslint/scope-manager': 8.56.1 + '@typescript-eslint/types': 8.56.1 + '@typescript-eslint/typescript-estree': 8.56.1(typescript@5.9.3) + '@typescript-eslint/visitor-keys': 8.56.1 + debug: 4.4.3 + eslint: 9.39.3 + typescript: 5.9.3 transitivePeerDependencies: - supports-color - '@typescript-eslint/scope-manager@7.18.0': + '@typescript-eslint/project-service@8.56.1(typescript@5.9.3)': dependencies: - '@typescript-eslint/types': 7.18.0 - '@typescript-eslint/visitor-keys': 7.18.0 + '@typescript-eslint/tsconfig-utils': 8.56.1(typescript@5.9.3) + '@typescript-eslint/types': 8.56.1 + debug: 4.4.3 + typescript: 5.9.3 + transitivePeerDependencies: + - supports-color - '@typescript-eslint/type-utils@7.18.0(eslint@8.57.1)(typescript@5.6.2)': + '@typescript-eslint/scope-manager@8.56.1': dependencies: - '@typescript-eslint/typescript-estree': 7.18.0(typescript@5.6.2) - '@typescript-eslint/utils': 7.18.0(eslint@8.57.1)(typescript@5.6.2) - debug: 4.3.7 - eslint: 8.57.1 - ts-api-utils: 1.3.0(typescript@5.6.2) - optionalDependencies: - typescript: 5.6.2 + '@typescript-eslint/types': 8.56.1 + '@typescript-eslint/visitor-keys': 8.56.1 + + '@typescript-eslint/tsconfig-utils@8.56.1(typescript@5.9.3)': + dependencies: + typescript: 5.9.3 + + '@typescript-eslint/type-utils@8.56.1(eslint@9.39.3)(typescript@5.9.3)': + dependencies: + '@typescript-eslint/types': 8.56.1 + '@typescript-eslint/typescript-estree': 8.56.1(typescript@5.9.3) + '@typescript-eslint/utils': 8.56.1(eslint@9.39.3)(typescript@5.9.3) + debug: 4.4.3 + eslint: 9.39.3 + ts-api-utils: 2.4.0(typescript@5.9.3) + typescript: 5.9.3 transitivePeerDependencies: - supports-color - '@typescript-eslint/types@7.18.0': {} + '@typescript-eslint/types@8.56.1': {} - '@typescript-eslint/typescript-estree@7.18.0(typescript@5.6.2)': + '@typescript-eslint/typescript-estree@8.56.1(typescript@5.9.3)': dependencies: - '@typescript-eslint/types': 7.18.0 - '@typescript-eslint/visitor-keys': 7.18.0 - debug: 4.3.7 - globby: 11.1.0 - is-glob: 4.0.3 - minimatch: 9.0.5 - semver: 7.6.3 - ts-api-utils: 1.3.0(typescript@5.6.2) - optionalDependencies: - typescript: 5.6.2 + '@typescript-eslint/project-service': 8.56.1(typescript@5.9.3) + '@typescript-eslint/tsconfig-utils': 8.56.1(typescript@5.9.3) + '@typescript-eslint/types': 8.56.1 + '@typescript-eslint/visitor-keys': 8.56.1 + debug: 4.4.3 + minimatch: 10.2.4 + semver: 7.7.4 + tinyglobby: 0.2.15 + ts-api-utils: 2.4.0(typescript@5.9.3) + typescript: 5.9.3 transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@7.18.0(eslint@8.57.1)(typescript@5.6.2)': + '@typescript-eslint/utils@8.56.1(eslint@9.39.3)(typescript@5.9.3)': dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.1) - '@typescript-eslint/scope-manager': 7.18.0 - '@typescript-eslint/types': 7.18.0 - '@typescript-eslint/typescript-estree': 7.18.0(typescript@5.6.2) - eslint: 8.57.1 + '@eslint-community/eslint-utils': 4.9.1(eslint@9.39.3) + '@typescript-eslint/scope-manager': 8.56.1 + '@typescript-eslint/types': 8.56.1 + '@typescript-eslint/typescript-estree': 8.56.1(typescript@5.9.3) + eslint: 9.39.3 + typescript: 5.9.3 transitivePeerDependencies: - supports-color - - typescript - '@typescript-eslint/visitor-keys@7.18.0': + '@typescript-eslint/visitor-keys@8.56.1': dependencies: - '@typescript-eslint/types': 7.18.0 - eslint-visitor-keys: 3.4.3 - - '@ungap/structured-clone@1.2.0': {} + '@typescript-eslint/types': 8.56.1 + eslint-visitor-keys: 5.0.1 - '@vitest/expect@2.1.1': + '@vitest/expect@3.2.4': dependencies: - '@vitest/spy': 2.1.1 - '@vitest/utils': 2.1.1 - chai: 5.1.1 - tinyrainbow: 1.2.0 + '@types/chai': 5.2.3 + '@vitest/spy': 3.2.4 + '@vitest/utils': 3.2.4 + chai: 5.3.3 + tinyrainbow: 2.0.0 - '@vitest/mocker@2.1.1(@vitest/spy@2.1.1)(vite@5.4.8(@types/node@22.7.4))': + '@vitest/mocker@3.2.4(vite@5.4.8(@types/node@24.12.0))': dependencies: - '@vitest/spy': 2.1.1 + '@vitest/spy': 3.2.4 estree-walker: 3.0.3 - magic-string: 0.30.11 + magic-string: 0.30.21 optionalDependencies: - vite: 5.4.8(@types/node@22.7.4) + vite: 5.4.8(@types/node@24.12.0) - '@vitest/pretty-format@2.1.1': + '@vitest/pretty-format@3.2.4': dependencies: - tinyrainbow: 1.2.0 + tinyrainbow: 2.0.0 - '@vitest/runner@2.1.1': + '@vitest/runner@3.2.4': dependencies: - '@vitest/utils': 2.1.1 - pathe: 1.1.2 + '@vitest/utils': 3.2.4 + pathe: 2.0.3 + strip-literal: 3.1.0 - '@vitest/snapshot@2.1.1': + '@vitest/snapshot@3.2.4': dependencies: - '@vitest/pretty-format': 2.1.1 - magic-string: 0.30.11 - pathe: 1.1.2 + '@vitest/pretty-format': 3.2.4 + magic-string: 0.30.21 + pathe: 2.0.3 - '@vitest/spy@2.1.1': + '@vitest/spy@3.2.4': dependencies: - tinyspy: 3.0.2 + tinyspy: 4.0.4 - '@vitest/utils@2.1.1': + '@vitest/utils@3.2.4': dependencies: - '@vitest/pretty-format': 2.1.1 - loupe: 3.1.1 - tinyrainbow: 1.2.0 + '@vitest/pretty-format': 3.2.4 + loupe: 3.2.1 + tinyrainbow: 2.0.0 - acorn-jsx@5.3.2(acorn@8.12.1): + acorn-jsx@5.3.2(acorn@8.16.0): dependencies: - acorn: 8.12.1 + acorn: 8.16.0 - acorn@8.12.1: {} + acorn@8.16.0: {} ajv@6.12.6: dependencies: @@ -3795,76 +2295,66 @@ snapshots: json-schema-traverse: 0.4.1 uri-js: 4.4.1 - ansi-regex@5.0.1: {} - - ansi-styles@3.2.1: + ajv@6.14.0: dependencies: - color-convert: 1.9.3 + fast-deep-equal: 3.1.3 + fast-json-stable-stringify: 2.1.0 + json-schema-traverse: 0.4.1 + uri-js: 4.4.1 + + ansi-regex@6.2.2: {} ansi-styles@4.3.0: dependencies: color-convert: 2.0.1 - argparse@2.0.1: {} + ansi-styles@6.2.3: {} - aria-query@5.1.3: - dependencies: - deep-equal: 2.2.3 + argparse@2.0.1: {} array-buffer-byte-length@1.0.1: dependencies: call-bind: 1.0.7 is-array-buffer: 3.0.4 - array-includes@3.1.8: + array-buffer-byte-length@1.0.2: dependencies: - call-bind: 1.0.7 - define-properties: 1.2.1 - es-abstract: 1.23.3 - es-object-atoms: 1.0.0 - get-intrinsic: 1.2.4 - is-string: 1.0.7 + call-bound: 1.0.4 + is-array-buffer: 3.0.5 - array-union@2.1.0: {} - - array.prototype.findlast@1.2.5: + array-includes@3.1.9: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 + call-bound: 1.0.4 define-properties: 1.2.1 - es-abstract: 1.23.3 - es-errors: 1.3.0 - es-object-atoms: 1.0.0 - es-shim-unscopables: 1.0.2 + es-abstract: 1.24.1 + es-object-atoms: 1.1.1 + get-intrinsic: 1.3.0 + is-string: 1.1.1 + math-intrinsics: 1.1.0 - array.prototype.findlastindex@1.2.5: + array.prototype.findlastindex@1.2.6: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 + call-bound: 1.0.4 define-properties: 1.2.1 - es-abstract: 1.23.3 + es-abstract: 1.24.1 es-errors: 1.3.0 - es-object-atoms: 1.0.0 - es-shim-unscopables: 1.0.2 + es-object-atoms: 1.1.1 + es-shim-unscopables: 1.1.0 - array.prototype.flat@1.3.2: + array.prototype.flat@1.3.3: dependencies: - call-bind: 1.0.7 - define-properties: 1.2.1 - es-abstract: 1.23.3 - es-shim-unscopables: 1.0.2 - - array.prototype.flatmap@1.3.2: - dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 define-properties: 1.2.1 - es-abstract: 1.23.3 + es-abstract: 1.24.1 es-shim-unscopables: 1.0.2 - array.prototype.tosorted@1.1.4: + array.prototype.flatmap@1.3.3: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 define-properties: 1.2.1 - es-abstract: 1.23.3 - es-errors: 1.3.0 + es-abstract: 1.24.1 es-shim-unscopables: 1.0.2 arraybuffer.prototype.slice@1.0.3: @@ -3878,65 +2368,41 @@ snapshots: is-array-buffer: 3.0.4 is-shared-array-buffer: 1.0.3 - assertion-error@2.0.1: {} + arraybuffer.prototype.slice@1.0.4: + dependencies: + array-buffer-byte-length: 1.0.2 + call-bind: 1.0.8 + define-properties: 1.2.1 + es-abstract: 1.24.1 + es-errors: 1.3.0 + get-intrinsic: 1.3.0 + is-array-buffer: 3.0.5 - ast-types-flow@0.0.8: {} + assertion-error@2.0.1: {} available-typed-arrays@1.0.7: dependencies: possible-typed-array-names: 1.0.0 - axe-core@4.10.0: {} - - axobject-query@4.1.0: {} - - babel-plugin-polyfill-corejs2@0.4.11(@babel/core@7.25.2): - dependencies: - '@babel/compat-data': 7.25.4 - '@babel/core': 7.25.2 - '@babel/helper-define-polyfill-provider': 0.6.2(@babel/core@7.25.2) - semver: 6.3.1 - transitivePeerDependencies: - - supports-color - - babel-plugin-polyfill-corejs3@0.10.6(@babel/core@7.25.2): - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-define-polyfill-provider': 0.6.2(@babel/core@7.25.2) - core-js-compat: 3.38.1 - transitivePeerDependencies: - - supports-color - - babel-plugin-polyfill-regenerator@0.6.2(@babel/core@7.25.2): - dependencies: - '@babel/core': 7.25.2 - '@babel/helper-define-polyfill-provider': 0.6.2(@babel/core@7.25.2) - transitivePeerDependencies: - - supports-color - balanced-match@1.0.2: {} + balanced-match@4.0.4: {} + brace-expansion@1.1.11: dependencies: balanced-match: 1.0.2 concat-map: 0.0.1 - brace-expansion@2.0.1: + brace-expansion@5.0.4: dependencies: - balanced-match: 1.0.2 + balanced-match: 4.0.4 - braces@3.0.3: - dependencies: - fill-range: 7.1.1 + cac@6.7.14: {} - browserslist@4.24.0: + call-bind-apply-helpers@1.0.2: dependencies: - caniuse-lite: 1.0.30001666 - electron-to-chromium: 1.5.31 - node-releases: 2.0.18 - update-browserslist-db: 1.1.1(browserslist@4.24.0) - - cac@6.7.14: {} + es-errors: 1.3.0 + function-bind: 1.1.2 call-bind@1.0.7: dependencies: @@ -3946,13 +2412,23 @@ snapshots: get-intrinsic: 1.2.4 set-function-length: 1.2.2 - callsites@3.1.0: {} + call-bind@1.0.8: + dependencies: + call-bind-apply-helpers: 1.0.2 + es-define-property: 1.0.0 + get-intrinsic: 1.2.4 + set-function-length: 1.2.2 - camelcase@8.0.0: {} + call-bound@1.0.4: + dependencies: + call-bind-apply-helpers: 1.0.2 + get-intrinsic: 1.3.0 + + callsites@3.1.0: {} - caniuse-lite@1.0.30001666: {} + camelcase@9.0.0: {} - chai@5.1.1: + chai@5.3.3: dependencies: assertion-error: 2.0.1 check-error: 2.1.1 @@ -3960,12 +2436,6 @@ snapshots: loupe: 3.1.1 pathval: 2.0.0 - chalk@2.4.2: - dependencies: - ansi-styles: 3.2.1 - escape-string-regexp: 1.0.5 - supports-color: 5.5.0 - chalk@4.1.2: dependencies: ansi-styles: 4.3.0 @@ -3973,62 +2443,64 @@ snapshots: check-error@2.1.1: {} - cliui@8.0.1: + cliui@9.0.1: dependencies: - string-width: 4.2.3 - strip-ansi: 6.0.1 - wrap-ansi: 7.0.0 - - code-block-writer@13.0.2: {} + string-width: 7.2.0 + strip-ansi: 7.2.0 + wrap-ansi: 9.0.2 - color-convert@1.9.3: - dependencies: - color-name: 1.1.3 + code-block-writer@13.0.3: {} color-convert@2.0.1: dependencies: color-name: 1.1.4 - color-name@1.1.3: {} - color-name@1.1.4: {} concat-map@0.0.1: {} - confusing-browser-globals@1.0.11: {} - - convert-source-map@2.0.0: {} - - core-js-compat@3.38.1: - dependencies: - browserslist: 4.24.0 - - cross-spawn@7.0.3: + cross-spawn@7.0.6: dependencies: path-key: 3.1.1 shebang-command: 2.0.0 which: 2.0.2 - damerau-levenshtein@1.0.8: {} - data-view-buffer@1.0.1: dependencies: call-bind: 1.0.7 es-errors: 1.3.0 is-data-view: 1.0.1 + data-view-buffer@1.0.2: + dependencies: + call-bound: 1.0.4 + es-errors: 1.3.0 + is-data-view: 1.0.2 + data-view-byte-length@1.0.1: dependencies: call-bind: 1.0.7 es-errors: 1.3.0 is-data-view: 1.0.1 + data-view-byte-length@1.0.2: + dependencies: + call-bound: 1.0.4 + es-errors: 1.3.0 + is-data-view: 1.0.2 + data-view-byte-offset@1.0.0: dependencies: call-bind: 1.0.7 es-errors: 1.3.0 is-data-view: 1.0.1 + data-view-byte-offset@1.0.1: + dependencies: + call-bound: 1.0.4 + es-errors: 1.3.0 + is-data-view: 1.0.2 + debug@3.2.7: dependencies: ms: 2.1.3 @@ -4037,28 +2509,11 @@ snapshots: dependencies: ms: 2.1.3 - deep-eql@5.0.2: {} - - deep-equal@2.2.3: + debug@4.4.3: dependencies: - array-buffer-byte-length: 1.0.1 - call-bind: 1.0.7 - es-get-iterator: 1.1.3 - get-intrinsic: 1.2.4 - is-arguments: 1.1.1 - is-array-buffer: 3.0.4 - is-date-object: 1.0.5 - is-regex: 1.1.4 - is-shared-array-buffer: 1.0.3 - isarray: 2.0.5 - object-is: 1.1.6 - object-keys: 1.1.1 - object.assign: 4.1.5 - regexp.prototype.flags: 1.5.2 - side-channel: 1.0.6 - which-boxed-primitive: 1.0.2 - which-collection: 1.0.2 - which-typed-array: 1.1.15 + ms: 2.1.3 + + deep-eql@5.0.2: {} deep-is@0.1.4: {} @@ -4074,28 +2529,17 @@ snapshots: has-property-descriptors: 1.0.2 object-keys: 1.1.1 - dir-glob@3.0.1: - dependencies: - path-type: 4.0.0 - doctrine@2.1.0: dependencies: esutils: 2.0.3 - doctrine@3.0.0: + dunder-proto@1.0.1: dependencies: - esutils: 2.0.3 - - electron-to-chromium@1.5.31: {} - - emoji-regex@8.0.0: {} - - emoji-regex@9.2.2: {} + call-bind-apply-helpers: 1.0.2 + es-errors: 1.3.0 + gopd: 1.2.0 - enhanced-resolve@5.17.1: - dependencies: - graceful-fs: 4.2.11 - tapable: 2.2.1 + emoji-regex@10.6.0: {} es-abstract@1.23.3: dependencies: @@ -4137,7 +2581,7 @@ snapshots: safe-array-concat: 1.1.2 safe-regex-test: 1.0.3 string.prototype.trim: 1.2.9 - string.prototype.trimend: 1.0.8 + string.prototype.trimend: 1.0.9 string.prototype.trimstart: 1.0.8 typed-array-buffer: 1.0.2 typed-array-byte-length: 1.0.1 @@ -4146,42 +2590,78 @@ snapshots: unbox-primitive: 1.0.2 which-typed-array: 1.1.15 + es-abstract@1.24.1: + dependencies: + array-buffer-byte-length: 1.0.2 + arraybuffer.prototype.slice: 1.0.4 + available-typed-arrays: 1.0.7 + call-bind: 1.0.8 + call-bound: 1.0.4 + data-view-buffer: 1.0.2 + data-view-byte-length: 1.0.2 + data-view-byte-offset: 1.0.1 + es-define-property: 1.0.1 + es-errors: 1.3.0 + es-object-atoms: 1.1.1 + es-set-tostringtag: 2.1.0 + es-to-primitive: 1.3.0 + function.prototype.name: 1.1.8 + get-intrinsic: 1.3.0 + get-proto: 1.0.1 + get-symbol-description: 1.1.0 + globalthis: 1.0.4 + gopd: 1.2.0 + has-property-descriptors: 1.0.2 + has-proto: 1.2.0 + has-symbols: 1.1.0 + hasown: 2.0.2 + internal-slot: 1.1.0 + is-array-buffer: 3.0.5 + is-callable: 1.2.7 + is-data-view: 1.0.2 + is-negative-zero: 2.0.3 + is-regex: 1.2.1 + is-set: 2.0.3 + is-shared-array-buffer: 1.0.4 + is-string: 1.1.1 + is-typed-array: 1.1.15 + is-weakref: 1.1.1 + math-intrinsics: 1.1.0 + object-inspect: 1.13.4 + object-keys: 1.1.1 + object.assign: 4.1.7 + own-keys: 1.0.1 + regexp.prototype.flags: 1.5.4 + safe-array-concat: 1.1.3 + safe-push-apply: 1.0.0 + safe-regex-test: 1.1.0 + set-proto: 1.0.0 + stop-iteration-iterator: 1.1.0 + string.prototype.trim: 1.2.10 + string.prototype.trimend: 1.0.9 + string.prototype.trimstart: 1.0.8 + typed-array-buffer: 1.0.3 + typed-array-byte-length: 1.0.3 + typed-array-byte-offset: 1.0.4 + typed-array-length: 1.0.7 + unbox-primitive: 1.1.0 + which-typed-array: 1.1.20 + es-define-property@1.0.0: dependencies: get-intrinsic: 1.2.4 + es-define-property@1.0.1: {} + es-errors@1.3.0: {} - es-get-iterator@1.1.3: - dependencies: - call-bind: 1.0.7 - get-intrinsic: 1.2.4 - has-symbols: 1.0.3 - is-arguments: 1.1.1 - is-map: 2.0.3 - is-set: 2.0.3 - is-string: 1.0.7 - isarray: 2.0.5 - stop-iteration-iterator: 1.0.0 + es-module-lexer@1.7.0: {} - es-iterator-helpers@1.0.19: + es-object-atoms@1.0.0: dependencies: - call-bind: 1.0.7 - define-properties: 1.2.1 - es-abstract: 1.23.3 es-errors: 1.3.0 - es-set-tostringtag: 2.0.3 - function-bind: 1.1.2 - get-intrinsic: 1.2.4 - globalthis: 1.0.4 - has-property-descriptors: 1.0.2 - has-proto: 1.0.3 - has-symbols: 1.0.3 - internal-slot: 1.0.7 - iterator.prototype: 1.1.2 - safe-array-concat: 1.1.2 - es-object-atoms@1.0.0: + es-object-atoms@1.1.1: dependencies: es-errors: 1.3.0 @@ -4191,16 +2671,33 @@ snapshots: has-tostringtag: 1.0.2 hasown: 2.0.2 + es-set-tostringtag@2.1.0: + dependencies: + es-errors: 1.3.0 + get-intrinsic: 1.3.0 + has-tostringtag: 1.0.2 + hasown: 2.0.2 + es-shim-unscopables@1.0.2: dependencies: hasown: 2.0.2 + es-shim-unscopables@1.1.0: + dependencies: + hasown: 2.0.2 + es-to-primitive@1.2.1: dependencies: is-callable: 1.2.7 is-date-object: 1.0.5 is-symbol: 1.0.4 + es-to-primitive@1.3.0: + dependencies: + is-callable: 1.2.7 + is-date-object: 1.0.5 + is-symbol: 1.0.4 + esbuild@0.21.5: optionalDependencies: '@esbuild/aix-ppc64': 0.21.5 @@ -4229,229 +2726,110 @@ snapshots: escalade@3.2.0: {} - escape-string-regexp@1.0.5: {} - escape-string-regexp@4.0.0: {} - eslint-config-airbnb-base@15.0.0(eslint-plugin-import@2.30.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1))(eslint@8.57.1): - dependencies: - confusing-browser-globals: 1.0.11 - eslint: 8.57.1 - eslint-plugin-import: 2.30.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1) - object.assign: 4.1.5 - object.entries: 1.1.8 - semver: 6.3.1 - - eslint-config-airbnb-typescript@18.0.0(@typescript-eslint/eslint-plugin@7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1)(typescript@5.6.2))(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint-plugin-import@2.30.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1))(eslint@8.57.1): - dependencies: - '@typescript-eslint/eslint-plugin': 7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1)(typescript@5.6.2) - '@typescript-eslint/parser': 7.18.0(eslint@8.57.1)(typescript@5.6.2) - eslint: 8.57.1 - eslint-config-airbnb-base: 15.0.0(eslint-plugin-import@2.30.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1))(eslint@8.57.1) - transitivePeerDependencies: - - eslint-plugin-import - - eslint-config-airbnb@19.0.4(eslint-plugin-import@2.30.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1))(eslint-plugin-jsx-a11y@6.10.0(eslint@8.57.1))(eslint-plugin-react-hooks@4.6.2(eslint@8.57.1))(eslint-plugin-react@7.37.1(eslint@8.57.1))(eslint@8.57.1): - dependencies: - eslint: 8.57.1 - eslint-config-airbnb-base: 15.0.0(eslint-plugin-import@2.30.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1))(eslint@8.57.1) - eslint-plugin-import: 2.30.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1) - eslint-plugin-jsx-a11y: 6.10.0(eslint@8.57.1) - eslint-plugin-react: 7.37.1(eslint@8.57.1) - eslint-plugin-react-hooks: 4.6.2(eslint@8.57.1) - object.assign: 4.1.5 - object.entries: 1.1.8 - - eslint-config-prettier@9.1.0(eslint@8.57.1): - dependencies: - eslint: 8.57.1 - eslint-import-resolver-node@0.3.9: dependencies: debug: 3.2.7 - is-core-module: 2.15.1 + is-core-module: 2.16.1 resolve: 1.22.8 transitivePeerDependencies: - supports-color - eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint-plugin-import@2.30.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1))(eslint@8.57.1): - dependencies: - '@nolyfill/is-core-module': 1.0.39 - debug: 4.3.7 - enhanced-resolve: 5.17.1 - eslint: 8.57.1 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint-plugin-import@2.30.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1) - fast-glob: 3.3.2 - get-tsconfig: 4.8.1 - is-bun-module: 1.2.1 - is-glob: 4.0.3 - optionalDependencies: - eslint-plugin-import: 2.30.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1) - transitivePeerDependencies: - - '@typescript-eslint/parser' - - eslint-import-resolver-node - - eslint-import-resolver-webpack - - supports-color - - eslint-module-utils@2.12.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint@8.57.1): + eslint-module-utils@2.12.1(@typescript-eslint/parser@8.56.1(eslint@9.39.3)(typescript@5.9.3))(eslint-import-resolver-node@0.3.9)(eslint@9.39.3): dependencies: debug: 3.2.7 optionalDependencies: - '@typescript-eslint/parser': 7.18.0(eslint@8.57.1)(typescript@5.6.2) - eslint: 8.57.1 + '@typescript-eslint/parser': 8.56.1(eslint@9.39.3)(typescript@5.9.3) + eslint: 9.39.3 eslint-import-resolver-node: 0.3.9 transitivePeerDependencies: - supports-color - eslint-module-utils@2.12.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint-plugin-import@2.30.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1): - dependencies: - debug: 3.2.7 - optionalDependencies: - '@typescript-eslint/parser': 7.18.0(eslint@8.57.1)(typescript@5.6.2) - eslint: 8.57.1 - eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint-plugin-import@2.30.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1))(eslint@8.57.1) - transitivePeerDependencies: - - supports-color - - eslint-plugin-import@2.30.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1): + eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.56.1(eslint@9.39.3)(typescript@5.9.3))(eslint@9.39.3): dependencies: '@rtsao/scc': 1.1.0 - array-includes: 3.1.8 - array.prototype.findlastindex: 1.2.5 - array.prototype.flat: 1.3.2 - array.prototype.flatmap: 1.3.2 + array-includes: 3.1.9 + array.prototype.findlastindex: 1.2.6 + array.prototype.flat: 1.3.3 + array.prototype.flatmap: 1.3.3 debug: 3.2.7 doctrine: 2.1.0 - eslint: 8.57.1 + eslint: 9.39.3 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint@8.57.1) + eslint-module-utils: 2.12.1(@typescript-eslint/parser@8.56.1(eslint@9.39.3)(typescript@5.9.3))(eslint-import-resolver-node@0.3.9)(eslint@9.39.3) hasown: 2.0.2 - is-core-module: 2.15.1 + is-core-module: 2.16.1 is-glob: 4.0.3 minimatch: 3.1.2 object.fromentries: 2.0.8 object.groupby: 1.0.3 - object.values: 1.2.0 + object.values: 1.2.1 semver: 6.3.1 + string.prototype.trimend: 1.0.9 tsconfig-paths: 3.15.0 optionalDependencies: - '@typescript-eslint/parser': 7.18.0(eslint@8.57.1)(typescript@5.6.2) + '@typescript-eslint/parser': 8.56.1(eslint@9.39.3)(typescript@5.9.3) transitivePeerDependencies: - eslint-import-resolver-typescript - eslint-import-resolver-webpack - supports-color - eslint-plugin-jsx-a11y@6.10.0(eslint@8.57.1): - dependencies: - aria-query: 5.1.3 - array-includes: 3.1.8 - array.prototype.flatmap: 1.3.2 - ast-types-flow: 0.0.8 - axe-core: 4.10.0 - axobject-query: 4.1.0 - damerau-levenshtein: 1.0.8 - emoji-regex: 9.2.2 - es-iterator-helpers: 1.0.19 - eslint: 8.57.1 - hasown: 2.0.2 - jsx-ast-utils: 3.3.5 - language-tags: 1.0.9 - minimatch: 3.1.2 - object.fromentries: 2.0.8 - safe-regex-test: 1.0.3 - string.prototype.includes: 2.0.0 - - eslint-plugin-prettier@5.2.1(@types/eslint@8.56.12)(eslint-config-prettier@9.1.0(eslint@8.57.1))(eslint@8.57.1)(prettier@3.3.3): - dependencies: - eslint: 8.57.1 - prettier: 3.3.3 - prettier-linter-helpers: 1.0.0 - synckit: 0.9.1 - optionalDependencies: - '@types/eslint': 8.56.12 - eslint-config-prettier: 9.1.0(eslint@8.57.1) - - eslint-plugin-react-hooks@4.6.2(eslint@8.57.1): - dependencies: - eslint: 8.57.1 - - eslint-plugin-react@7.37.1(eslint@8.57.1): - dependencies: - array-includes: 3.1.8 - array.prototype.findlast: 1.2.5 - array.prototype.flatmap: 1.3.2 - array.prototype.tosorted: 1.1.4 - doctrine: 2.1.0 - es-iterator-helpers: 1.0.19 - eslint: 8.57.1 - estraverse: 5.3.0 - hasown: 2.0.2 - jsx-ast-utils: 3.3.5 - minimatch: 3.1.2 - object.entries: 1.1.8 - object.fromentries: 2.0.8 - object.values: 1.2.0 - prop-types: 15.8.1 - resolve: 2.0.0-next.5 - semver: 6.3.1 - string.prototype.matchall: 4.0.11 - string.prototype.repeat: 1.0.0 - - eslint-scope@7.2.2: + eslint-scope@8.4.0: dependencies: esrecurse: 4.3.0 estraverse: 5.3.0 eslint-visitor-keys@3.4.3: {} - eslint@8.57.1: + eslint-visitor-keys@4.2.1: {} + + eslint-visitor-keys@5.0.1: {} + + eslint@9.39.3: dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.1) - '@eslint-community/regexpp': 4.11.1 - '@eslint/eslintrc': 2.1.4 - '@eslint/js': 8.57.1 - '@humanwhocodes/config-array': 0.13.0 + '@eslint-community/eslint-utils': 4.9.1(eslint@9.39.3) + '@eslint-community/regexpp': 4.12.2 + '@eslint/config-array': 0.21.1 + '@eslint/config-helpers': 0.4.2 + '@eslint/core': 0.17.0 + '@eslint/eslintrc': 3.3.4 + '@eslint/js': 9.39.3 + '@eslint/plugin-kit': 0.4.1 + '@humanfs/node': 0.16.7 '@humanwhocodes/module-importer': 1.0.1 - '@nodelib/fs.walk': 1.2.8 - '@ungap/structured-clone': 1.2.0 + '@humanwhocodes/retry': 0.4.3 + '@types/estree': 1.0.6 ajv: 6.12.6 chalk: 4.1.2 - cross-spawn: 7.0.3 + cross-spawn: 7.0.6 debug: 4.3.7 - doctrine: 3.0.0 escape-string-regexp: 4.0.0 - eslint-scope: 7.2.2 - eslint-visitor-keys: 3.4.3 - espree: 9.6.1 + eslint-scope: 8.4.0 + eslint-visitor-keys: 4.2.1 + espree: 10.4.0 esquery: 1.6.0 esutils: 2.0.3 fast-deep-equal: 3.1.3 - file-entry-cache: 6.0.1 + file-entry-cache: 8.0.0 find-up: 5.0.0 glob-parent: 6.0.2 - globals: 13.24.0 - graphemer: 1.4.0 ignore: 5.3.2 imurmurhash: 0.1.4 is-glob: 4.0.3 - is-path-inside: 3.0.3 - js-yaml: 4.1.0 json-stable-stringify-without-jsonify: 1.0.1 - levn: 0.4.1 lodash.merge: 4.6.2 minimatch: 3.1.2 natural-compare: 1.4.0 optionator: 0.9.4 - strip-ansi: 6.0.1 - text-table: 0.2.0 transitivePeerDependencies: - supports-color - espree@9.6.1: + espree@10.4.0: dependencies: - acorn: 8.12.1 - acorn-jsx: 5.3.2(acorn@8.12.1) - eslint-visitor-keys: 3.4.3 + acorn: 8.16.0 + acorn-jsx: 5.3.2(acorn@8.16.0) + eslint-visitor-keys: 4.2.1 esquery@1.6.0: dependencies: @@ -4469,44 +2847,31 @@ snapshots: esutils@2.0.3: {} - fast-deep-equal@3.1.3: {} - - fast-diff@1.3.0: {} + expect-type@1.3.0: {} - fast-glob@3.3.2: - dependencies: - '@nodelib/fs.stat': 2.0.5 - '@nodelib/fs.walk': 1.2.8 - glob-parent: 5.1.2 - merge2: 1.4.1 - micromatch: 4.0.8 + fast-deep-equal@3.1.3: {} fast-json-stable-stringify@2.1.0: {} fast-levenshtein@2.0.6: {} - fastq@1.17.1: - dependencies: - reusify: 1.0.4 - - file-entry-cache@6.0.1: - dependencies: - flat-cache: 3.2.0 + fdir@6.5.0(picomatch@4.0.3): + optionalDependencies: + picomatch: 4.0.3 - fill-range@7.1.1: + file-entry-cache@8.0.0: dependencies: - to-regex-range: 5.0.1 + flat-cache: 4.0.1 find-up@5.0.0: dependencies: locate-path: 6.0.0 path-exists: 4.0.0 - flat-cache@3.2.0: + flat-cache@4.0.1: dependencies: flatted: 3.3.1 keyv: 4.5.4 - rimraf: 3.0.2 flatted@3.3.1: {} @@ -4514,7 +2879,9 @@ snapshots: dependencies: is-callable: 1.2.7 - fs.realpath@1.0.0: {} + for-each@0.3.5: + dependencies: + is-callable: 1.2.7 fsevents@2.3.3: optional: true @@ -4528,12 +2895,21 @@ snapshots: es-abstract: 1.23.3 functions-have-names: 1.2.3 - functions-have-names@1.2.3: {} + function.prototype.name@1.1.8: + dependencies: + call-bind: 1.0.8 + call-bound: 1.0.4 + define-properties: 1.2.1 + functions-have-names: 1.2.3 + hasown: 2.0.2 + is-callable: 1.2.7 - gensync@1.0.0-beta.2: {} + functions-have-names@1.2.3: {} get-caller-file@2.0.5: {} + get-east-asian-width@1.5.0: {} + get-func-name@2.0.2: {} get-intrinsic@1.2.4: @@ -4544,65 +2920,55 @@ snapshots: has-symbols: 1.0.3 hasown: 2.0.2 + get-intrinsic@1.3.0: + dependencies: + call-bind-apply-helpers: 1.0.2 + es-define-property: 1.0.1 + es-errors: 1.3.0 + es-object-atoms: 1.1.1 + function-bind: 1.1.2 + get-proto: 1.0.1 + gopd: 1.2.0 + has-symbols: 1.1.0 + hasown: 2.0.2 + math-intrinsics: 1.1.0 + + get-proto@1.0.1: + dependencies: + dunder-proto: 1.0.1 + es-object-atoms: 1.1.1 + get-symbol-description@1.0.2: dependencies: call-bind: 1.0.7 es-errors: 1.3.0 get-intrinsic: 1.2.4 - get-tsconfig@4.8.1: - dependencies: - resolve-pkg-maps: 1.0.0 - - glob-parent@5.1.2: + get-symbol-description@1.1.0: dependencies: - is-glob: 4.0.3 + call-bound: 1.0.4 + es-errors: 1.3.0 + get-intrinsic: 1.3.0 glob-parent@6.0.2: dependencies: is-glob: 4.0.3 - glob@7.2.3: - dependencies: - fs.realpath: 1.0.0 - inflight: 1.0.6 - inherits: 2.0.4 - minimatch: 3.1.2 - once: 1.4.0 - path-is-absolute: 1.0.1 - - globals@11.12.0: {} - - globals@13.24.0: - dependencies: - type-fest: 0.20.2 + globals@14.0.0: {} globalthis@1.0.4: dependencies: define-properties: 1.2.1 gopd: 1.0.1 - globby@11.1.0: - dependencies: - array-union: 2.1.0 - dir-glob: 3.0.1 - fast-glob: 3.3.2 - ignore: 5.3.2 - merge2: 1.4.1 - slash: 3.0.0 - gopd@1.0.1: dependencies: get-intrinsic: 1.2.4 - graceful-fs@4.2.11: {} - - graphemer@1.4.0: {} + gopd@1.2.0: {} has-bigints@1.0.2: {} - has-flag@3.0.0: {} - has-flag@4.0.0: {} has-property-descriptors@1.0.2: @@ -4611,8 +2977,14 @@ snapshots: has-proto@1.0.3: {} + has-proto@1.2.0: + dependencies: + dunder-proto: 1.0.1 + has-symbols@1.0.3: {} + has-symbols@1.1.0: {} + has-tostringtag@1.0.2: dependencies: has-symbols: 1.0.3 @@ -4621,8 +2993,12 @@ snapshots: dependencies: function-bind: 1.1.2 + hono@4.12.5: {} + ignore@5.3.2: {} + ignore@7.0.5: {} + import-fresh@3.3.0: dependencies: parent-module: 1.0.1 @@ -4630,29 +3006,29 @@ snapshots: imurmurhash@0.1.4: {} - inflight@1.0.6: - dependencies: - once: 1.4.0 - wrappy: 1.0.2 - - inherits@2.0.4: {} - internal-slot@1.0.7: dependencies: es-errors: 1.3.0 hasown: 2.0.2 side-channel: 1.0.6 - is-arguments@1.1.1: + internal-slot@1.1.0: dependencies: - call-bind: 1.0.7 - has-tostringtag: 1.0.2 + es-errors: 1.3.0 + hasown: 2.0.2 + side-channel: 1.1.0 is-array-buffer@3.0.4: dependencies: call-bind: 1.0.7 get-intrinsic: 1.2.4 + is-array-buffer@3.0.5: + dependencies: + call-bind: 1.0.8 + call-bound: 1.0.4 + get-intrinsic: 1.3.0 + is-async-function@2.0.0: dependencies: has-tostringtag: 1.0.2 @@ -4661,18 +3037,23 @@ snapshots: dependencies: has-bigints: 1.0.2 + is-bigint@1.1.0: + dependencies: + has-bigints: 1.0.2 + is-boolean-object@1.1.2: dependencies: call-bind: 1.0.7 has-tostringtag: 1.0.2 - is-bun-module@1.2.1: + is-boolean-object@1.2.2: dependencies: - semver: 7.6.3 + call-bound: 1.0.4 + has-tostringtag: 1.0.2 is-callable@1.2.7: {} - is-core-module@2.15.1: + is-core-module@2.16.1: dependencies: hasown: 2.0.2 @@ -4680,17 +3061,30 @@ snapshots: dependencies: is-typed-array: 1.1.13 + is-data-view@1.0.2: + dependencies: + call-bound: 1.0.4 + get-intrinsic: 1.3.0 + is-typed-array: 1.1.15 + is-date-object@1.0.5: dependencies: has-tostringtag: 1.0.2 + is-date-object@1.1.0: + dependencies: + call-bound: 1.0.4 + has-tostringtag: 1.0.2 + is-extglob@2.1.1: {} is-finalizationregistry@1.0.2: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 - is-fullwidth-code-point@3.0.0: {} + is-finalizationregistry@1.1.1: + dependencies: + call-bound: 1.0.4 is-generator-function@1.0.10: dependencies: @@ -4710,66 +3104,85 @@ snapshots: dependencies: has-tostringtag: 1.0.2 - is-number@7.0.0: {} - - is-path-inside@3.0.3: {} + is-number-object@1.1.1: + dependencies: + call-bound: 1.0.4 + has-tostringtag: 1.0.2 is-regex@1.1.4: dependencies: call-bind: 1.0.7 has-tostringtag: 1.0.2 + is-regex@1.2.1: + dependencies: + call-bound: 1.0.4 + gopd: 1.2.0 + has-tostringtag: 1.0.2 + hasown: 2.0.2 + is-set@2.0.3: {} is-shared-array-buffer@1.0.3: dependencies: call-bind: 1.0.7 + is-shared-array-buffer@1.0.4: + dependencies: + call-bound: 1.0.4 + is-string@1.0.7: dependencies: has-tostringtag: 1.0.2 + is-string@1.1.1: + dependencies: + call-bound: 1.0.4 + has-tostringtag: 1.0.2 + is-symbol@1.0.4: dependencies: has-symbols: 1.0.3 + is-symbol@1.1.1: + dependencies: + call-bound: 1.0.4 + has-symbols: 1.1.0 + safe-regex-test: 1.1.0 + is-typed-array@1.1.13: dependencies: which-typed-array: 1.1.15 + is-typed-array@1.1.15: + dependencies: + which-typed-array: 1.1.20 + is-weakmap@2.0.2: {} is-weakref@1.0.2: dependencies: call-bind: 1.0.7 + is-weakref@1.1.1: + dependencies: + call-bound: 1.0.4 + is-weakset@2.0.3: dependencies: - call-bind: 1.0.7 - get-intrinsic: 1.2.4 + call-bind: 1.0.8 + get-intrinsic: 1.3.0 isarray@2.0.5: {} isexe@2.0.0: {} - iterator.prototype@1.1.2: - dependencies: - define-properties: 1.2.1 - get-intrinsic: 1.2.4 - has-symbols: 1.0.3 - reflect.getprototypeof: 1.0.6 - set-function-name: 2.0.2 - - js-tokens@4.0.0: {} + js-tokens@9.0.1: {} - js-yaml@4.1.0: + js-yaml@4.1.1: dependencies: argparse: 2.0.1 - jsesc@0.5.0: {} - - jsesc@2.5.2: {} - json-buffer@3.0.1: {} json-schema-traverse@0.4.1: {} @@ -4780,25 +3193,10 @@ snapshots: dependencies: minimist: 1.2.8 - json5@2.2.3: {} - - jsx-ast-utils@3.3.5: - dependencies: - array-includes: 3.1.8 - array.prototype.flat: 1.3.2 - object.assign: 4.1.5 - object.values: 1.2.0 - keyv@4.5.4: dependencies: json-buffer: 3.0.1 - language-subtag-registry@0.3.23: {} - - language-tags@1.0.9: - dependencies: - language-subtag-registry: 0.3.23 - levn@0.4.1: dependencies: prelude-ls: 1.2.1 @@ -4808,61 +3206,45 @@ snapshots: dependencies: p-locate: 5.0.0 - lodash.debounce@4.0.8: {} - lodash.merge@4.6.2: {} - loose-envify@1.4.0: - dependencies: - js-tokens: 4.0.0 - loupe@3.1.1: dependencies: get-func-name: 2.0.2 - lru-cache@5.1.1: - dependencies: - yallist: 3.1.1 + loupe@3.2.1: {} - magic-string@0.30.11: + magic-string@0.30.21: dependencies: - '@jridgewell/sourcemap-codec': 1.5.0 + '@jridgewell/sourcemap-codec': 1.5.5 - merge2@1.4.1: {} + math-intrinsics@1.1.0: {} - micromatch@4.0.8: + minimatch@10.2.4: dependencies: - braces: 3.0.3 - picomatch: 2.3.1 + brace-expansion: 5.0.4 minimatch@3.1.2: dependencies: brace-expansion: 1.1.11 - minimatch@9.0.5: + minimatch@3.1.5: dependencies: - brace-expansion: 2.0.1 + brace-expansion: 1.1.11 minimist@1.2.8: {} - mkdirp@3.0.1: {} - ms@2.1.3: {} nanoid@3.3.7: {} natural-compare@1.4.0: {} - node-releases@2.0.18: {} - - object-assign@4.1.1: {} + non-error@0.1.0: {} object-inspect@1.13.2: {} - object-is@1.1.6: - dependencies: - call-bind: 1.0.7 - define-properties: 1.2.1 + object-inspect@1.13.4: {} object-keys@1.1.1: {} @@ -4873,11 +3255,14 @@ snapshots: has-symbols: 1.0.3 object-keys: 1.1.1 - object.entries@1.1.8: + object.assign@4.1.7: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 + call-bound: 1.0.4 define-properties: 1.2.1 - es-object-atoms: 1.0.0 + es-object-atoms: 1.1.1 + has-symbols: 1.1.0 + object-keys: 1.1.1 object.fromentries@2.0.8: dependencies: @@ -4892,16 +3277,13 @@ snapshots: define-properties: 1.2.1 es-abstract: 1.23.3 - object.values@1.2.0: + object.values@1.2.1: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 + call-bound: 1.0.4 define-properties: 1.2.1 es-object-atoms: 1.0.0 - once@1.4.0: - dependencies: - wrappy: 1.0.2 - openapi3-ts@4.4.0: dependencies: yaml: 2.5.1 @@ -4915,6 +3297,12 @@ snapshots: type-check: 0.4.0 word-wrap: 1.2.5 + own-keys@1.0.1: + dependencies: + get-intrinsic: 1.3.0 + object-keys: 1.1.1 + safe-push-apply: 1.0.0 + p-limit@3.1.0: dependencies: yocto-queue: 0.1.0 @@ -4923,11 +3311,9 @@ snapshots: dependencies: p-limit: 3.1.0 - p-retry@6.2.0: + p-retry@7.1.1: dependencies: - '@types/retry': 0.12.2 is-network-error: 1.1.0 - retry: 0.13.1 parent-module@1.0.1: dependencies: @@ -4937,21 +3323,17 @@ snapshots: path-exists@4.0.0: {} - path-is-absolute@1.0.1: {} - path-key@3.1.1: {} path-parse@1.0.7: {} - path-type@4.0.0: {} - - pathe@1.1.2: {} + pathe@2.0.3: {} pathval@2.0.0: {} picocolors@1.1.0: {} - picomatch@2.3.1: {} + picomatch@4.0.3: {} possible-typed-array-names@1.0.0: {} @@ -4963,46 +3345,31 @@ snapshots: prelude-ls@1.2.1: {} - prettier-linter-helpers@1.0.0: - dependencies: - fast-diff: 1.3.0 - - prettier@3.3.3: {} - - prop-types@15.8.1: - dependencies: - loose-envify: 1.4.0 - object-assign: 4.1.1 - react-is: 16.13.1 + prettier@3.8.1: {} punycode@2.3.1: {} - queue-microtask@1.2.3: {} - - react-is@16.13.1: {} + reflect.getprototypeof@1.0.10: + dependencies: + call-bind: 1.0.8 + define-properties: 1.2.1 + es-abstract: 1.24.1 + es-errors: 1.3.0 + es-object-atoms: 1.1.1 + get-intrinsic: 1.3.0 + get-proto: 1.0.1 + which-builtin-type: 1.2.1 reflect.getprototypeof@1.0.6: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 define-properties: 1.2.1 - es-abstract: 1.23.3 + es-abstract: 1.24.1 es-errors: 1.3.0 - get-intrinsic: 1.2.4 + get-intrinsic: 1.3.0 globalthis: 1.0.4 which-builtin-type: 1.1.4 - regenerate-unicode-properties@10.2.0: - dependencies: - regenerate: 1.4.2 - - regenerate@1.4.2: {} - - regenerator-runtime@0.14.1: {} - - regenerator-transform@0.15.2: - dependencies: - '@babel/runtime': 7.25.6 - regexp.prototype.flags@1.5.2: dependencies: call-bind: 1.0.7 @@ -5010,45 +3377,23 @@ snapshots: es-errors: 1.3.0 set-function-name: 2.0.2 - regexpu-core@5.3.2: - dependencies: - '@babel/regjsgen': 0.8.0 - regenerate: 1.4.2 - regenerate-unicode-properties: 10.2.0 - regjsparser: 0.9.1 - unicode-match-property-ecmascript: 2.0.0 - unicode-match-property-value-ecmascript: 2.2.0 - - regjsparser@0.9.1: + regexp.prototype.flags@1.5.4: dependencies: - jsesc: 0.5.0 - - require-directory@2.1.1: {} + call-bind: 1.0.8 + define-properties: 1.2.1 + es-errors: 1.3.0 + get-proto: 1.0.1 + gopd: 1.2.0 + set-function-name: 2.0.2 resolve-from@4.0.0: {} - resolve-pkg-maps@1.0.0: {} - resolve@1.22.8: dependencies: - is-core-module: 2.15.1 - path-parse: 1.0.7 - supports-preserve-symlinks-flag: 1.0.0 - - resolve@2.0.0-next.5: - dependencies: - is-core-module: 2.15.1 + is-core-module: 2.16.1 path-parse: 1.0.7 supports-preserve-symlinks-flag: 1.0.0 - retry@0.13.1: {} - - reusify@1.0.4: {} - - rimraf@3.0.2: - dependencies: - glob: 7.2.3 - rollup@4.24.0: dependencies: '@types/estree': 1.0.6 @@ -5071,10 +3416,6 @@ snapshots: '@rollup/rollup-win32-x64-msvc': 4.24.0 fsevents: 2.3.3 - run-parallel@1.2.0: - dependencies: - queue-microtask: 1.2.3 - safe-array-concat@1.1.2: dependencies: call-bind: 1.0.7 @@ -5082,19 +3423,39 @@ snapshots: has-symbols: 1.0.3 isarray: 2.0.5 + safe-array-concat@1.1.3: + dependencies: + call-bind: 1.0.8 + call-bound: 1.0.4 + get-intrinsic: 1.3.0 + has-symbols: 1.1.0 + isarray: 2.0.5 + + safe-push-apply@1.0.0: + dependencies: + es-errors: 1.3.0 + isarray: 2.0.5 + safe-regex-test@1.0.3: dependencies: call-bind: 1.0.7 es-errors: 1.3.0 is-regex: 1.1.4 + safe-regex-test@1.1.0: + dependencies: + call-bound: 1.0.4 + es-errors: 1.3.0 + is-regex: 1.2.1 + semver@6.3.1: {} - semver@7.6.3: {} + semver@7.7.4: {} - serialize-error@11.0.3: + serialize-error@13.0.1: dependencies: - type-fest: 2.19.0 + non-error: 0.1.0 + type-fest: 5.4.4 set-function-length@1.2.2: dependencies: @@ -5112,12 +3473,38 @@ snapshots: functions-have-names: 1.2.3 has-property-descriptors: 1.0.2 + set-proto@1.0.0: + dependencies: + dunder-proto: 1.0.1 + es-errors: 1.3.0 + es-object-atoms: 1.1.1 + shebang-command@2.0.0: dependencies: shebang-regex: 3.0.0 shebang-regex@3.0.0: {} + side-channel-list@1.0.0: + dependencies: + es-errors: 1.3.0 + object-inspect: 1.13.4 + + side-channel-map@1.0.1: + dependencies: + call-bound: 1.0.4 + es-errors: 1.3.0 + get-intrinsic: 1.3.0 + object-inspect: 1.13.4 + + side-channel-weakmap@1.0.2: + dependencies: + call-bound: 1.0.4 + es-errors: 1.3.0 + get-intrinsic: 1.3.0 + object-inspect: 1.13.4 + side-channel-map: 1.0.1 + side-channel@1.0.6: dependencies: call-bind: 1.0.7 @@ -5125,50 +3512,42 @@ snapshots: get-intrinsic: 1.2.4 object-inspect: 1.13.2 - siginfo@2.0.0: {} + side-channel@1.1.0: + dependencies: + es-errors: 1.3.0 + object-inspect: 1.13.4 + side-channel-list: 1.0.0 + side-channel-map: 1.0.1 + side-channel-weakmap: 1.0.2 - slash@3.0.0: {} + siginfo@2.0.0: {} source-map-js@1.2.1: {} stackback@0.0.2: {} - std-env@3.7.0: {} - - stop-iteration-iterator@1.0.0: - dependencies: - internal-slot: 1.0.7 - - string-width@4.2.3: - dependencies: - emoji-regex: 8.0.0 - is-fullwidth-code-point: 3.0.0 - strip-ansi: 6.0.1 + std-env@3.10.0: {} - string.prototype.includes@2.0.0: + stop-iteration-iterator@1.1.0: dependencies: - define-properties: 1.2.1 - es-abstract: 1.23.3 + es-errors: 1.3.0 + internal-slot: 1.1.0 - string.prototype.matchall@4.0.11: + string-width@7.2.0: dependencies: - call-bind: 1.0.7 - define-properties: 1.2.1 - es-abstract: 1.23.3 - es-errors: 1.3.0 - es-object-atoms: 1.0.0 - get-intrinsic: 1.2.4 - gopd: 1.0.1 - has-symbols: 1.0.3 - internal-slot: 1.0.7 - regexp.prototype.flags: 1.5.2 - set-function-name: 2.0.2 - side-channel: 1.0.6 + emoji-regex: 10.6.0 + get-east-asian-width: 1.5.0 + strip-ansi: 7.2.0 - string.prototype.repeat@1.0.0: + string.prototype.trim@1.2.10: dependencies: + call-bind: 1.0.8 + call-bound: 1.0.4 + define-data-property: 1.1.4 define-properties: 1.2.1 - es-abstract: 1.23.3 + es-abstract: 1.24.1 + es-object-atoms: 1.1.1 + has-property-descriptors: 1.0.2 string.prototype.trim@1.2.9: dependencies: @@ -5177,9 +3556,10 @@ snapshots: es-abstract: 1.23.3 es-object-atoms: 1.0.0 - string.prototype.trimend@1.0.8: + string.prototype.trimend@1.0.9: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 + call-bound: 1.0.4 define-properties: 1.2.1 es-object-atoms: 1.0.0 @@ -5189,17 +3569,17 @@ snapshots: define-properties: 1.2.1 es-object-atoms: 1.0.0 - strip-ansi@6.0.1: + strip-ansi@7.2.0: dependencies: - ansi-regex: 5.0.1 + ansi-regex: 6.2.2 strip-bom@3.0.0: {} strip-json-comments@3.1.1: {} - supports-color@5.5.0: + strip-literal@3.1.0: dependencies: - has-flag: 3.0.0 + js-tokens: 9.0.1 supports-color@7.2.0: dependencies: @@ -5207,41 +3587,33 @@ snapshots: supports-preserve-symlinks-flag@1.0.0: {} - synckit@0.9.1: - dependencies: - '@pkgr/core': 0.1.1 - tslib: 2.7.0 - - tapable@2.2.1: {} - - text-table@0.2.0: {} + tagged-tag@1.0.0: {} tinybench@2.9.0: {} - tinyexec@0.3.0: {} - - tinypool@1.0.1: {} + tinyexec@0.3.2: {} - tinyrainbow@1.2.0: {} + tinyglobby@0.2.15: + dependencies: + fdir: 6.5.0(picomatch@4.0.3) + picomatch: 4.0.3 - tinyspy@3.0.2: {} + tinypool@1.1.1: {} - to-fast-properties@2.0.0: {} + tinyrainbow@2.0.0: {} - to-regex-range@5.0.1: - dependencies: - is-number: 7.0.0 + tinyspy@4.0.4: {} toposort@2.0.2: {} - ts-api-utils@1.3.0(typescript@5.6.2): + ts-api-utils@2.4.0(typescript@5.9.3): dependencies: - typescript: 5.6.2 + typescript: 5.9.3 - ts-morph@23.0.0: + ts-morph@27.0.2: dependencies: - '@ts-morph/common': 0.24.0 - code-block-writer: 13.0.2 + '@ts-morph/common': 0.28.1 + code-block-writer: 13.0.3 tsconfig-paths@3.15.0: dependencies: @@ -5250,17 +3622,13 @@ snapshots: minimist: 1.2.8 strip-bom: 3.0.0 - tslib@2.7.0: {} - type-check@0.4.0: dependencies: prelude-ls: 1.2.1 - type-fest@0.20.2: {} - - type-fest@2.19.0: {} - - type-fest@4.26.1: {} + type-fest@5.4.4: + dependencies: + tagged-tag: 1.0.0 typed-array-buffer@1.0.2: dependencies: @@ -5268,6 +3636,12 @@ snapshots: es-errors: 1.3.0 is-typed-array: 1.1.13 + typed-array-buffer@1.0.3: + dependencies: + call-bound: 1.0.4 + es-errors: 1.3.0 + is-typed-array: 1.1.15 + typed-array-byte-length@1.0.1: dependencies: call-bind: 1.0.7 @@ -5276,6 +3650,14 @@ snapshots: has-proto: 1.0.3 is-typed-array: 1.1.13 + typed-array-byte-length@1.0.3: + dependencies: + call-bind: 1.0.8 + for-each: 0.3.3 + gopd: 1.2.0 + has-proto: 1.2.0 + is-typed-array: 1.1.15 + typed-array-byte-offset@1.0.2: dependencies: available-typed-arrays: 1.0.7 @@ -5285,6 +3667,16 @@ snapshots: has-proto: 1.0.3 is-typed-array: 1.1.13 + typed-array-byte-offset@1.0.4: + dependencies: + available-typed-arrays: 1.0.7 + call-bind: 1.0.8 + for-each: 0.3.3 + gopd: 1.2.0 + has-proto: 1.2.0 + is-typed-array: 1.1.15 + reflect.getprototypeof: 1.0.10 + typed-array-length@1.0.6: dependencies: call-bind: 1.0.7 @@ -5294,7 +3686,16 @@ snapshots: is-typed-array: 1.1.13 possible-typed-array-names: 1.0.0 - typescript@5.6.2: {} + typed-array-length@1.0.7: + dependencies: + call-bind: 1.0.8 + for-each: 0.3.3 + gopd: 1.2.0 + is-typed-array: 1.1.15 + possible-typed-array-names: 1.0.0 + reflect.getprototypeof: 1.0.6 + + typescript@5.9.3: {} unbox-primitive@1.0.2: dependencies: @@ -5303,37 +3704,32 @@ snapshots: has-symbols: 1.0.3 which-boxed-primitive: 1.0.2 - undici-types@6.19.8: {} - - undici@6.19.8: {} - - unicode-canonical-property-names-ecmascript@2.0.1: {} - - unicode-match-property-ecmascript@2.0.0: + unbox-primitive@1.1.0: dependencies: - unicode-canonical-property-names-ecmascript: 2.0.1 - unicode-property-aliases-ecmascript: 2.1.0 - - unicode-match-property-value-ecmascript@2.2.0: {} + call-bound: 1.0.4 + has-bigints: 1.0.2 + has-symbols: 1.1.0 + which-boxed-primitive: 1.1.1 - unicode-property-aliases-ecmascript@2.1.0: {} + undici-types@7.16.0: {} - update-browserslist-db@1.1.1(browserslist@4.24.0): - dependencies: - browserslist: 4.24.0 - escalade: 3.2.0 - picocolors: 1.1.0 + undici@7.22.0: {} uri-js@4.4.1: dependencies: punycode: 2.3.1 - vite-node@2.1.1(@types/node@22.7.4): + valibot@1.2.0(typescript@5.9.3): + optionalDependencies: + typescript: 5.9.3 + + vite-node@3.2.4(@types/node@24.12.0): dependencies: cac: 6.7.14 - debug: 4.3.7 - pathe: 1.1.2 - vite: 5.4.8(@types/node@22.7.4) + debug: 4.4.3 + es-module-lexer: 1.7.0 + pathe: 2.0.3 + vite: 5.4.8(@types/node@24.12.0) transitivePeerDependencies: - '@types/node' - less @@ -5345,38 +3741,42 @@ snapshots: - supports-color - terser - vite@5.4.8(@types/node@22.7.4): + vite@5.4.8(@types/node@24.12.0): dependencies: esbuild: 0.21.5 postcss: 8.4.47 rollup: 4.24.0 optionalDependencies: - '@types/node': 22.7.4 + '@types/node': 24.12.0 fsevents: 2.3.3 - vitest@2.1.1(@types/node@22.7.4): - dependencies: - '@vitest/expect': 2.1.1 - '@vitest/mocker': 2.1.1(@vitest/spy@2.1.1)(vite@5.4.8(@types/node@22.7.4)) - '@vitest/pretty-format': 2.1.1 - '@vitest/runner': 2.1.1 - '@vitest/snapshot': 2.1.1 - '@vitest/spy': 2.1.1 - '@vitest/utils': 2.1.1 - chai: 5.1.1 - debug: 4.3.7 - magic-string: 0.30.11 - pathe: 1.1.2 - std-env: 3.7.0 + vitest@3.2.4(@types/node@24.12.0): + dependencies: + '@types/chai': 5.2.3 + '@vitest/expect': 3.2.4 + '@vitest/mocker': 3.2.4(vite@5.4.8(@types/node@24.12.0)) + '@vitest/pretty-format': 3.2.4 + '@vitest/runner': 3.2.4 + '@vitest/snapshot': 3.2.4 + '@vitest/spy': 3.2.4 + '@vitest/utils': 3.2.4 + chai: 5.3.3 + debug: 4.4.3 + expect-type: 1.3.0 + magic-string: 0.30.21 + pathe: 2.0.3 + picomatch: 4.0.3 + std-env: 3.10.0 tinybench: 2.9.0 - tinyexec: 0.3.0 - tinypool: 1.0.1 - tinyrainbow: 1.2.0 - vite: 5.4.8(@types/node@22.7.4) - vite-node: 2.1.1(@types/node@22.7.4) + tinyexec: 0.3.2 + tinyglobby: 0.2.15 + tinypool: 1.1.1 + tinyrainbow: 2.0.0 + vite: 5.4.8(@types/node@24.12.0) + vite-node: 3.2.4(@types/node@24.12.0) why-is-node-running: 2.3.0 optionalDependencies: - '@types/node': 22.7.4 + '@types/node': 24.12.0 transitivePeerDependencies: - less - lightningcss @@ -5396,20 +3796,44 @@ snapshots: is-string: 1.0.7 is-symbol: 1.0.4 + which-boxed-primitive@1.1.1: + dependencies: + is-bigint: 1.1.0 + is-boolean-object: 1.2.2 + is-number-object: 1.1.1 + is-string: 1.1.1 + is-symbol: 1.1.1 + which-builtin-type@1.1.4: dependencies: - function.prototype.name: 1.1.6 + function.prototype.name: 1.1.8 has-tostringtag: 1.0.2 is-async-function: 2.0.0 is-date-object: 1.0.5 is-finalizationregistry: 1.0.2 is-generator-function: 1.0.10 - is-regex: 1.1.4 - is-weakref: 1.0.2 + is-regex: 1.2.1 + is-weakref: 1.1.1 isarray: 2.0.5 which-boxed-primitive: 1.0.2 which-collection: 1.0.2 - which-typed-array: 1.1.15 + which-typed-array: 1.1.20 + + which-builtin-type@1.2.1: + dependencies: + call-bound: 1.0.4 + function.prototype.name: 1.1.8 + has-tostringtag: 1.0.2 + is-async-function: 2.0.0 + is-date-object: 1.1.0 + is-finalizationregistry: 1.1.1 + is-generator-function: 1.0.10 + is-regex: 1.2.1 + is-weakref: 1.1.1 + isarray: 2.0.5 + which-boxed-primitive: 1.1.1 + which-collection: 1.0.2 + which-typed-array: 1.1.20 which-collection@1.0.2: dependencies: @@ -5426,6 +3850,16 @@ snapshots: gopd: 1.0.1 has-tostringtag: 1.0.2 + which-typed-array@1.1.20: + dependencies: + available-typed-arrays: 1.0.7 + call-bind: 1.0.8 + call-bound: 1.0.4 + for-each: 0.3.5 + get-proto: 1.0.1 + gopd: 1.2.0 + has-tostringtag: 1.0.2 + which@2.0.2: dependencies: isexe: 2.0.0 @@ -5437,30 +3871,25 @@ snapshots: word-wrap@1.2.5: {} - wrap-ansi@7.0.0: + wrap-ansi@9.0.2: dependencies: - ansi-styles: 4.3.0 - string-width: 4.2.3 - strip-ansi: 6.0.1 - - wrappy@1.0.2: {} + ansi-styles: 6.2.3 + string-width: 7.2.0 + strip-ansi: 7.2.0 y18n@5.0.8: {} - yallist@3.1.1: {} - yaml@2.5.1: {} - yargs-parser@21.1.1: {} + yargs-parser@22.0.0: {} - yargs@17.7.2: + yargs@18.0.0: dependencies: - cliui: 8.0.1 + cliui: 9.0.1 escalade: 3.2.0 get-caller-file: 2.0.5 - require-directory: 2.1.1 - string-width: 4.2.3 + string-width: 7.2.0 y18n: 5.0.8 - yargs-parser: 21.1.1 + yargs-parser: 22.0.0 yocto-queue@0.1.0: {} diff --git a/tsconfig.json b/tsconfig.json index 015965c..3289b9d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,33 +1,12 @@ { - "compilerOptions": { - "moduleResolution": "node16", - "target": "es2022", - "lib": ["es2022"], - "module": "node16", - "composite": true, - "incremental": true, - "strict": true, - "declaration": true, - "outDir": "./dist", - "esModuleInterop": true, - "preserveSymlinks": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "allowUnusedLabels": false, - "allowUnreachableCode": false, - "exactOptionalPropertyTypes": true, - "noFallthroughCasesInSwitch": true, - "noImplicitOverride": true, - "noImplicitReturns": true, - "noPropertyAccessFromIndexSignature": true, - "noUncheckedIndexedAccess": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "verbatimModuleSyntax": true, - "removeComments": true, - "resolveJsonModule": true, - "sourceMap": true - }, - "include": ["./lib", "./bin"], - "exclude": ["./dist", "node_modules"] + "extends": ["@tsconfig/node24", "@tsconfig/strictest"], + "compilerOptions": { + "noEmit": true, + "allowImportingTsExtensions": true, + "noPropertyAccessFromIndexSignature": false, + "resolveJsonModule": true, + "skipLibCheck": true + }, + "include": ["./lib", "./bin", "__tests__"], + "exclude": ["./dist", "node_modules"] }