openapi: 3.2.0 info: contact: email: lxd@lists.canonical.com name: LXD upstream url: https://github.com/canonical/lxd description: 'This is the REST API used by all LXD clients. Internal endpoints aren''t included in this documentation. The LXD API is available over both a local unix+http and remote https API. Authentication for local users relies on group membership and access to the unix socket. For remote users, the default authentication method is TLS client.' license: name: AGPL-3.0-only url: https://www.gnu.org/licenses/agpl-3.0.en.html title: LXD external REST Network Forwards API version: '1.0' tags: - name: network-forwards paths: /1.0/networks/{networkName}/forwards: get: description: Returns a list of network address forwards (URLs). operationId: network_forwards_get parameters: - description: Project name example: default in: query name: project schema: type: string responses: '200': description: API endpoints content: application/json: schema: description: Sync response properties: metadata: description: List of endpoints example: "[\n \"/1.0/networks/lxdbr0/forwards/192.0.2.1\",\n \"/1.0/networks/lxdbr0/forwards/192.0.2.2\"\n]" items: type: string type: array status: description: Status description example: Success type: string status_code: description: Status code example: 200 type: integer type: description: Response type example: sync type: string type: object '403': $ref: '#/components/responses/Forbidden' '500': $ref: '#/components/responses/InternalServerError' summary: Get the network address forwards tags: - network-forwards post: description: Creates a new network address forward. operationId: network_forwards_post parameters: - description: Project name example: default in: query name: project schema: type: string responses: '202': $ref: '#/components/responses/Operation' '400': $ref: '#/components/responses/BadRequest' '403': $ref: '#/components/responses/Forbidden' '500': $ref: '#/components/responses/InternalServerError' summary: Add a network address forward tags: - network-forwards requestBody: content: application/json: schema: $ref: '#/components/schemas/NetworkForwardsPost' description: Forward required: true /1.0/networks/{networkName}/forwards/{listenAddress}: delete: description: Removes the network address forward. operationId: network_forward_delete parameters: - description: Project name example: default in: query name: project schema: type: string responses: '202': $ref: '#/components/responses/Operation' '400': $ref: '#/components/responses/BadRequest' '403': $ref: '#/components/responses/Forbidden' '500': $ref: '#/components/responses/InternalServerError' summary: Delete the network address forward tags: - network-forwards get: description: Gets a specific network address forward. operationId: network_forward_get parameters: - description: Project name example: default in: query name: project schema: type: string responses: '200': description: Address forward content: application/json: schema: description: Sync response properties: metadata: $ref: '#/components/schemas/NetworkForward' status: description: Status description example: Success type: string status_code: description: Status code example: 200 type: integer type: description: Response type example: sync type: string type: object '403': $ref: '#/components/responses/Forbidden' '500': $ref: '#/components/responses/InternalServerError' summary: Get the network address forward tags: - network-forwards patch: description: Updates a subset of the network address forward configuration. operationId: network_forward_patch parameters: - description: Project name example: default in: query name: project schema: type: string responses: '202': $ref: '#/components/responses/Operation' '400': $ref: '#/components/responses/BadRequest' '403': $ref: '#/components/responses/Forbidden' '412': $ref: '#/components/responses/PreconditionFailed' '500': $ref: '#/components/responses/InternalServerError' summary: Partially update the network address forward tags: - network-forwards requestBody: content: application/json: schema: $ref: '#/components/schemas/NetworkForwardPut' description: Address forward configuration required: true put: description: Updates the entire network address forward configuration. operationId: network_forward_put parameters: - description: Project name example: default in: query name: project schema: type: string responses: '202': $ref: '#/components/responses/Operation' '400': $ref: '#/components/responses/BadRequest' '403': $ref: '#/components/responses/Forbidden' '412': $ref: '#/components/responses/PreconditionFailed' '500': $ref: '#/components/responses/InternalServerError' summary: Update the network address forward tags: - network-forwards requestBody: content: application/json: schema: $ref: '#/components/schemas/NetworkForwardPut' description: Address forward configuration required: true /1.0/networks/{networkName}/forwards?recursion=1: get: description: Returns a list of network address forwards (structs). operationId: network_forward_get_recursion1 parameters: - description: Project name example: default in: query name: project schema: type: string responses: '200': description: API endpoints content: application/json: schema: description: Sync response properties: metadata: description: List of network address forwards items: $ref: '#/components/schemas/NetworkForward' type: array status: description: Status description example: Success type: string status_code: description: Status code example: 200 type: integer type: description: Response type example: sync type: string type: object '403': $ref: '#/components/responses/Forbidden' '500': $ref: '#/components/responses/InternalServerError' summary: Get the network address forwards tags: - network-forwards components: schemas: NetworkForwardPut: description: NetworkForwardPut represents the modifiable fields of a LXD network address forward properties: config: additionalProperties: type: string description: Forward configuration map (refer to doc/network-forwards.md) example: target_address: 198.51.100.99 user.mykey: foo type: object x-go-name: Config description: description: Description of the forward listen IP example: My public IP forward type: string x-go-name: Description ports: description: Port forwards (optional) items: $ref: '#/components/schemas/NetworkForwardPort' type: array x-go-name: Ports type: object x-go-package: github.com/canonical/lxd/shared/api NetworkForward: properties: config: additionalProperties: type: string description: Forward configuration map (refer to doc/network-forwards.md) example: target_address: 198.51.100.99 user.mykey: foo type: object x-go-name: Config description: description: Description of the forward listen IP example: My public IP forward type: string x-go-name: Description listen_address: description: The listen address of the forward example: 192.0.2.1 type: string x-go-name: ListenAddress location: description: What cluster member this record was found on example: lxd01 type: string x-go-name: Location ports: description: Port forwards (optional) items: $ref: '#/components/schemas/NetworkForwardPort' type: array x-go-name: Ports title: NetworkForward used for displaying an network address forward. type: object x-go-package: github.com/canonical/lxd/shared/api NetworkForwardsPost: description: NetworkForwardsPost represents the fields of a new LXD network address forward properties: config: additionalProperties: type: string description: Forward configuration map (refer to doc/network-forwards.md) example: target_address: 198.51.100.99 user.mykey: foo type: object x-go-name: Config description: description: Description of the forward listen IP example: My public IP forward type: string x-go-name: Description listen_address: description: 'The listen address of the forward For OVN networks only, you can dynamically allocate the listen address from a pre-defined range. To do so for an IPv4 address, provide a listen_address of `0.0.0.0`. For an IPv6 address, provide a listen_address of `::`. These are equivalent to the `allocate=ipv{4|6}` flag used to create a network forward via the CLI.' example: 192.0.2.1 type: string x-go-name: ListenAddress ports: description: Port forwards (optional) items: $ref: '#/components/schemas/NetworkForwardPort' type: array x-go-name: Ports type: object x-go-package: github.com/canonical/lxd/shared/api NetworkForwardPort: description: NetworkForwardPort represents a port specification in a network address forward properties: description: description: Description of the forward port example: My web server forward type: string x-go-name: Description listen_port: description: ListenPort(s) to forward (comma delimited ranges) example: 80,81,8080-8090 type: string x-go-name: ListenPort protocol: description: Protocol for port forward (either tcp or udp) example: tcp type: string x-go-name: Protocol target_address: description: TargetAddress to forward ListenPorts to example: 198.51.100.2 type: string x-go-name: TargetAddress target_port: description: TargetPort(s) to forward ListenPorts to (allows for many-to-one) example: 80,81,8080-8090 type: string x-go-name: TargetPort type: object x-go-package: github.com/canonical/lxd/shared/api StatusCode: format: int64 title: StatusCode represents a valid LXD operation and container status. type: integer x-go-package: github.com/canonical/lxd/shared/api Operation: description: Operation represents a LXD background operation properties: child_count: description: 'Number of child operations. API extension: operation_child_count' example: 2 format: int64 type: integer x-go-name: ChildCount class: description: Type of operation (task, token or websocket) example: websocket type: string x-go-name: Class created_at: description: Operation creation time example: '2021-03-23T17:38:37.753398689-04:00' format: date-time type: string x-go-name: CreatedAt description: description: Description of the operation example: Executing command type: string x-go-name: Description err: description: Operation error message example: Some error message type: string x-go-name: Err err_code: description: 'Operation error code API extension: bulk_operations' example: 404 format: int64 type: integer x-go-name: ErrCode id: description: UUID of the operation example: 6916c8a6-9b7d-4abd-90b3-aedfec7ec7da type: string x-go-name: ID location: description: 'Which cluster member this record was found on API extension: operation_location' example: lxd01 type: string x-go-name: Location may_cancel: description: Whether the operation can be canceled example: false type: boolean x-go-name: MayCancel metadata: additionalProperties: {} description: Operation specific metadata example: command: - bash environment: HOME: /root LANG: C.UTF-8 PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin TERM: xterm USER: root fds: '0': da3046cf02c0116febf4ef3fe4eaecdf308e720c05e5a9c730ce1a6f15417f66 '1': 05896879d8692607bd6e4a09475667da3b5f6714418ab0ee0e5720b4c57f754b interactive: true type: object x-go-name: Metadata requestor: $ref: '#/components/schemas/OperationRequestor' resources: additionalProperties: items: type: string type: array description: Affected resources example: instances: - /1.0/instances/foo - /1.0/instances/bar type: object x-go-name: Resources status: description: Status name example: Running type: string x-go-name: Status status_code: $ref: '#/components/schemas/StatusCode' updated_at: description: Operation last change example: '2021-03-23T17:38:37.753398689-04:00' format: date-time type: string x-go-name: UpdatedAt type: object x-go-package: github.com/canonical/lxd/shared/api OperationRequestor: description: 'API extension: operation_requestor.' properties: address: description: Address is the origin address of the request. example: 10.0.2.15 type: string x-go-name: Address protocol: description: Protocol represents the method used to authenticate the requestor. example: oidc type: string x-go-name: Protocol username: description: Username is the username of the requestor. This is the identifier of the identity, or the username if using the unix socket. example: jane.doe@example.com type: string x-go-name: Username title: OperationRequestor represents the initial requestor of an operation type: object x-go-package: github.com/canonical/lxd/shared/api responses: InternalServerError: description: Internal Server Error content: application/json: schema: properties: error: example: internal server error type: string x-go-name: Error error_code: example: 500 format: int64 type: integer x-go-name: ErrorCode type: example: error type: string x-go-name: Type type: object PreconditionFailed: description: Precondition Failed content: application/json: schema: properties: error: example: precondition failed type: string x-go-name: Error error_code: example: 412 format: int64 type: integer x-go-name: ErrorCode type: example: error type: string x-go-name: Type type: object BadRequest: description: Bad Request content: application/json: schema: properties: error: example: bad request type: string x-go-name: Error error_code: example: 400 format: int64 type: integer x-go-name: ErrorCode type: example: error type: string x-go-name: Type type: object Forbidden: description: Forbidden content: application/json: schema: properties: error: example: not authorized type: string x-go-name: Error error_code: example: 403 format: int64 type: integer x-go-name: ErrorCode type: example: error type: string x-go-name: Type type: object Operation: description: Operation content: application/json: schema: properties: metadata: $ref: '#/components/schemas/Operation' operation: example: /1.0/operations/66e83638-9dd7-4a26-aef2-5462814869a1 type: string x-go-name: Operation status: example: Operation created type: string x-go-name: Status status_code: example: 100 format: int64 type: integer x-go-name: StatusCode type: example: async type: string x-go-name: Type type: object