Incus network-forwards API

The network-forwards API from Incus — 3 operation(s) for network-forwards.

OpenAPI Specification

incus-network-forwards-api-openapi.yml Raw ↑
swagger: '2.0'
info:
  contact:
    email: lxc-devel@lists.linuxcontainers.org
    name: Incus upstream
    url: https://github.com/lxc/incus
  description: 'This is the REST API used by all Incus clients.

    Internal endpoints aren''t included in this documentation.


    The Incus 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

    certificates.'
  license:
    name: Apache-2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
  title: Incus external REST certificates 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: Network name
        in: path
        name: networkName
        required: true
        type: string
      - description: Project name
        example: default
        in: query
        name: project
        type: string
      - description: Collection filter
        example: default
        in: query
        name: filter
        type: string
      produces:
      - application/json
      responses:
        '200':
          description: API endpoints
          schema:
            description: Sync response
            properties:
              metadata:
                description: List of endpoints
                example: "[\n  \"/1.0/networks/mybr0/forwards/192.0.2.1\",\n  \"/1.0/networks/mybr0/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: '#/responses/Forbidden'
        '500':
          $ref: '#/responses/InternalServerError'
      summary: Get the network address forwards
      tags:
      - network-forwards
    post:
      consumes:
      - application/json
      description: Creates a new network address forward.
      operationId: network_forwards_post
      parameters:
      - description: Network name
        in: path
        name: networkName
        required: true
        type: string
      - description: Project name
        example: default
        in: query
        name: project
        type: string
      - description: Forward
        in: body
        name: forward
        required: true
        schema:
          $ref: '#/definitions/NetworkForwardsPost'
      produces:
      - application/json
      responses:
        '200':
          $ref: '#/responses/EmptySyncResponse'
        '400':
          $ref: '#/responses/BadRequest'
        '403':
          $ref: '#/responses/Forbidden'
        '500':
          $ref: '#/responses/InternalServerError'
      summary: Add a network address forward
      tags:
      - network-forwards
  /1.0/networks/{networkName}/forwards/{listenAddress}:
    delete:
      description: Removes the network address forward.
      operationId: network_forward_delete
      parameters:
      - description: Network name
        in: path
        name: networkName
        required: true
        type: string
      - description: Listen address
        in: path
        name: listenAddress
        required: true
        type: string
      - description: Project name
        example: default
        in: query
        name: project
        type: string
      produces:
      - application/json
      responses:
        '200':
          $ref: '#/responses/EmptySyncResponse'
        '400':
          $ref: '#/responses/BadRequest'
        '403':
          $ref: '#/responses/Forbidden'
        '500':
          $ref: '#/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: Network name
        in: path
        name: networkName
        required: true
        type: string
      - description: Listen address
        in: path
        name: listenAddress
        required: true
        type: string
      - description: Project name
        example: default
        in: query
        name: project
        type: string
      produces:
      - application/json
      responses:
        '200':
          description: Address forward
          schema:
            description: Sync response
            properties:
              metadata:
                $ref: '#/definitions/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: '#/responses/Forbidden'
        '500':
          $ref: '#/responses/InternalServerError'
      summary: Get the network address forward
      tags:
      - network-forwards
    patch:
      consumes:
      - application/json
      description: Updates a subset of the network address forward configuration.
      operationId: network_forward_patch
      parameters:
      - description: Network name
        in: path
        name: networkName
        required: true
        type: string
      - description: Listen address
        in: path
        name: listenAddress
        required: true
        type: string
      - description: Project name
        example: default
        in: query
        name: project
        type: string
      - description: Address forward configuration
        in: body
        name: forward
        required: true
        schema:
          $ref: '#/definitions/NetworkForwardPut'
      produces:
      - application/json
      responses:
        '200':
          $ref: '#/responses/EmptySyncResponse'
        '400':
          $ref: '#/responses/BadRequest'
        '403':
          $ref: '#/responses/Forbidden'
        '412':
          $ref: '#/responses/PreconditionFailed'
        '500':
          $ref: '#/responses/InternalServerError'
      summary: Partially update the network address forward
      tags:
      - network-forwards
    put:
      consumes:
      - application/json
      description: Updates the entire network address forward configuration.
      operationId: network_forward_put
      parameters:
      - description: Network name
        in: path
        name: networkName
        required: true
        type: string
      - description: Listen address
        in: path
        name: listenAddress
        required: true
        type: string
      - description: Project name
        example: default
        in: query
        name: project
        type: string
      - description: Address forward configuration
        in: body
        name: forward
        required: true
        schema:
          $ref: '#/definitions/NetworkForwardPut'
      produces:
      - application/json
      responses:
        '200':
          $ref: '#/responses/EmptySyncResponse'
        '400':
          $ref: '#/responses/BadRequest'
        '403':
          $ref: '#/responses/Forbidden'
        '412':
          $ref: '#/responses/PreconditionFailed'
        '500':
          $ref: '#/responses/InternalServerError'
      summary: Update the network address forward
      tags:
      - network-forwards
  /1.0/networks/{networkName}/forwards?recursion=1:
    get:
      description: Returns a list of network address forwards (structs).
      operationId: network_forward_get_recursion1
      parameters:
      - description: Network name
        in: path
        name: networkName
        required: true
        type: string
      - description: Project name
        example: default
        in: query
        name: project
        type: string
      - description: Collection filter
        example: default
        in: query
        name: filter
        type: string
      produces:
      - application/json
      responses:
        '200':
          description: API endpoints
          schema:
            description: Sync response
            properties:
              metadata:
                description: List of network address forwards
                items:
                  $ref: '#/definitions/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: '#/responses/Forbidden'
        '500':
          $ref: '#/responses/InternalServerError'
      summary: Get the network address forwards
      tags:
      - network-forwards
definitions:
  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
      snat:
        description: SNAT controls whether to apply a matching SNAT rule to new outgoing traffic from the target
        example: false
        type: boolean
        x-go-name: SNAT
      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/lxc/incus/v7/shared/api
  NetworkForward:
    properties:
      config:
        description: Forward configuration map (refer to doc/network-forwards.md)
        example:
          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: server01
        type: string
        x-go-name: Location
      ports:
        description: Port forwards (optional)
        items:
          $ref: '#/definitions/NetworkForwardPort'
        type: array
        x-go-name: Ports
    title: NetworkForward used for displaying an network address forward.
    type: object
    x-go-package: github.com/lxc/incus/v7/shared/api
  NetworkForwardPut:
    description: NetworkForwardPut represents the modifiable fields of a network address forward
    properties:
      config:
        description: Forward configuration map (refer to doc/network-forwards.md)
        example:
          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: '#/definitions/NetworkForwardPort'
        type: array
        x-go-name: Ports
    type: object
    x-go-package: github.com/lxc/incus/v7/shared/api
  NetworkForwardsPost:
    description: NetworkForwardsPost represents the fields of a new network address forward
    properties:
      config:
        description: Forward configuration map (refer to doc/network-forwards.md)
        example:
          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
      ports:
        description: Port forwards (optional)
        items:
          $ref: '#/definitions/NetworkForwardPort'
        type: array
        x-go-name: Ports
    type: object
    x-go-package: github.com/lxc/incus/v7/shared/api
responses:
  Forbidden:
    description: Forbidden
    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
  BadRequest:
    description: Bad Request
    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
  EmptySyncResponse:
    description: Empty sync response
    schema:
      properties:
        status:
          example: Success
          type: string
          x-go-name: Status
        status_code:
          example: 200
          format: int64
          type: integer
          x-go-name: StatusCode
        type:
          example: sync
          type: string
          x-go-name: Type
      type: object
  PreconditionFailed:
    description: Precondition Failed
    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
  InternalServerError:
    description: Internal Server Error
    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