[management] add openapi specs and generate types for port forwarding proxy (#3236)

This commit is contained in:
Pascal Fischer
2025-01-27 17:47:40 +01:00
committed by GitHub
parent 5c05131a94
commit f6a71f4193
2 changed files with 668 additions and 0 deletions

View File

@@ -29,6 +29,9 @@ tags:
description: View information about the account and network events.
- name: Accounts
description: View information about the accounts.
- name: Proxies
description: Interact with and view information about the proxy.
x-cloud-only: true
components:
schemas:
Account:
@@ -1581,6 +1584,193 @@ components:
- initiator_email
- target_id
- meta
ProxyCreateRequest:
type: object
properties:
peer_id:
description: ID of the peer that is used as a proxy
type: string
example: ch8i4ug6lnn4g9hqv7m0
enabled:
description: Defines if a proxy is enabled
type: boolean
example: true
fallback:
description: Defines if a proxy can be used as a fallback if no proxy can be found in the region of the forwarded peer
type: boolean
example: true
required:
- peer_id
- enabled
- fallback
ProxyUpdateRequest:
type: object
properties:
enabled:
description: Defines if a proxy is enabled
type: boolean
example: true
fallback:
description: Defines if a proxy can be used as a fallback if no proxy can be found in the region of the forwarded peer
type: boolean
example: true
required:
- enabled
- fallback
Proxy:
type: object
properties:
id:
description: ID of the proxy
type: string
example: ch8i4ug6lnn4g9hqv7m0
peer_id:
description: ID of the peer that is used as a proxy
type: string
example: x7p3kqf2rdd8j5zxw4n9
ingress_ip:
description: Ingress IP address of the proxy where the traffic arrives
type: string
example: 192.34.0.123
available_ports:
description: Number of available ports left on the proxy
type: integer
example: 45765
enabled:
description: Indicates if a proxy is enabled
type: boolean
example: true
connected:
description: Indicates if a proxy is connected to the management server
type: boolean
example: true
fallback:
description: Indicates if a proxy can be used as a fallback if no proxy can be found in the region of the forwarded peer
type: boolean
example: true
region:
description: Region of the proxy
type: string
example: germany
required:
- id
- peer_id
- ingress_ip
- available_ports
- enabled
- connected
- fallback
- region
ProxyConfigurationRequest:
type: object
properties:
name:
description: Name of the proxy configuration
type: string
example: Proxy Configuration 1
enabled:
description: Indicates if a proxy configuration is enabled
type: boolean
example: true
port_ranges:
description: List of port ranges that are forwarded by the proxy
type: array
items:
$ref: '#/components/schemas/ProxyConfigurationRequestPortRange'
required:
- name
- enabled
- port_ranges
ProxyConfigurationRequestPortRange:
type: object
properties:
start:
description: The starting port of the range of forwarded ports
type: integer
example: 80
end:
description: The ending port of the range of forwarded ports
type: integer
example: 320
protocol:
description: The protocol accepted by the port range
type: string
enum: [ "tcp", "udp" ]
example: tcp
required:
- start
- end
- protocol
ProxyConfiguration:
type: object
properties:
id:
description: ID of the proxy configuration
type: string
example: ch8i4ug6lnn4g9hqv7m0
name:
description: Name of the proxy configuration
type: string
example: Proxy Configuration 1
proxy_id:
description: ID of the proxy that forwards the ports
type: string
example: x7p3kqf2rdd8j5zxw4n9
region:
description: Region of the proxy
type: string
example: germany
enabled:
description: Indicates if a proxy configuration is enabled
type: boolean
example: true
ingress_ip:
description: Ingress IP address of the proxy where the traffic arrives
type: string
example:
port_range_mappings:
description: List of port ranges that are allowed to be used by the proxy
type: array
items:
$ref: '#/components/schemas/ProxyConfigurationPortMapping'
required:
- id
- name
- proxy_id
- region
- enabled
- ingress_ip
- port_range_mappings
ProxyConfigurationPortMapping:
type: object
properties:
translated_start:
description: The starting port of the translated range of forwarded ports
type: integer
example: 80
translated_end:
description: The ending port of the translated range of forwarded ports
type: integer
example: 320
ingress_start:
description: The starting port of the range of ingress ports mapped to the forwarded ports
type: integer
example: 1080
ingress_end:
description: The ending port of the range of ingress ports mapped to the forwarded ports
type: integer
example: 1320
protocol:
description: Protocol accepted by the ports
type: string
enum: [ "tcp", "udp" ]
example: tcp
required:
- translated_start
- translated_end
- ingress_start
- ingress_end
- protocol
responses:
not_found:
description: Resource not found
@@ -2136,6 +2326,334 @@ paths:
"$ref": "#/components/responses/forbidden"
'500':
"$ref": "#/components/responses/internal_error"
/api/peers/{peerId}/proxy_configurations:
get:
summary: List all Proxy Configurations
description: Returns a list of all proxy configurations for a peer
tags: [ Peers ]
security:
- BearerAuth: [ ]
- TokenAuth: [ ]
parameters:
- in: path
name: peerId
required: true
schema:
type: string
description: The unique identifier of a peer
- in: query
name: name
schema:
type: string
description: Filters proxy configurations by name
responses:
'200':
description: A JSON Array of Proxy Configurations
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/ProxyConfiguration'
'400':
"$ref": "#/components/responses/bad_request"
'401':
"$ref": "#/components/responses/requires_authentication"
'403':
"$ref": "#/components/responses/forbidden"
'500':
"$ref": "#/components/responses/internal_error"
post:
x-cloud-only: true
summary: Create a Proxy Configuration
description: Creates a new proxy configuration for a peer
tags: [ Peers ]
security:
- BearerAuth: [ ]
- TokenAuth: [ ]
parameters:
- in: path
name: peerId
required: true
schema:
type: string
description: The unique identifier of a peer
requestBody:
description: New Proxy Configuration request
content:
'application/json':
schema:
$ref: '#/components/schemas/ProxyConfigurationRequest'
responses:
'200':
description: A Proxy Configuration object
content:
application/json:
schema:
$ref: '#/components/schemas/ProxyConfiguration'
'400':
"$ref": "#/components/responses/bad_request"
'401':
"$ref": "#/components/responses/requires_authentication"
'403':
"$ref": "#/components/responses/forbidden"
'500':
"$ref": "#/components/responses/internal_error"
/api/peers/{peerId}/proxy_configurations/{configurationId}:
get:
x-cloud-only: true
summary: Retrieve a Proxy Configuration
description: Get information about a proxy configuration
tags: [ Peers ]
security:
- BearerAuth: [ ]
- TokenAuth: [ ]
parameters:
- in: path
name: peerId
required: true
schema:
type: string
description: The unique identifier of a peer
- in: path
name: configurationId
required: true
schema:
type: string
description: The unique identifier of a proxy configuration
responses:
'200':
description: A Proxy Configuration object
content:
application/json:
schema:
$ref: '#/components/schemas/ProxyConfiguration'
'400':
"$ref": "#/components/responses/bad_request"
'401':
"$ref": "#/components/responses/requires_authentication"
'403':
"$ref": "#/components/responses/forbidden"
'500':
"$ref": "#/components/responses/internal_error"
put:
x-cloud-only: true
parameters:
- in: path
name: peerId
required: true
schema:
type: string
description: The unique identifier of a peer
- in: path
name: configurationId
required: true
schema:
type: string
description: The unique identifier of a proxy configuration
requestBody:
description: update a proxy configuration
content:
application/json:
schema:
$ref: '#/components/schemas/ProxyConfigurationRequest'
responses:
'200':
description: A Proxy Configuration object
content:
application/json:
schema:
$ref: '#/components/schemas/ProxyConfiguration'
'400':
"$ref": "#/components/responses/bad_request"
'401':
"$ref": "#/components/responses/requires_authentication"
'403':
"$ref": "#/components/responses/forbidden"
'500':
"$ref": "#/components/responses/internal_error"
delete:
x-cloud-only: true
summary: Delete a Proxy Configuration
description: Delete a proxy configuration
tags: [ Peers ]
security:
- BearerAuth: [ ]
- TokenAuth: [ ]
parameters:
- in: path
name: peerId
required: true
schema:
type: string
description: The unique identifier of a peer
- in: path
name: configurationId
required: true
schema:
type: string
description: The unique identifier of a proxy configuration
responses:
'200':
description: Delete status code
content: { }
'400':
"$ref": "#/components/responses/bad_request"
'401':
"$ref": "#/components/responses/requires_authentication"
'403':
"$ref": "#/components/responses/forbidden"
'500':
"$ref": "#/components/responses/internal_error"
/api/proxies:
get:
x-cloud-only: true
summary: List all Proxies
description: Returns a list of all proxies
tags: [ Proxies ]
security:
- BearerAuth: [ ]
- TokenAuth: [ ]
responses:
'200':
description: A JSON Array of Proxies
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Proxy'
'400':
"$ref": "#/components/responses/bad_request"
'401':
"$ref": "#/components/responses/requires_authentication"
'403':
"$ref": "#/components/responses/forbidden"
'500':
"$ref": "#/components/responses/internal_error"
post:
x-cloud-only: true
summary: Create a Proxy
description: Creates a new proxy
tags: [ Proxies ]
security:
- BearerAuth: [ ]
- TokenAuth: [ ]
requestBody:
description: New Proxy request
content:
'application/json':
schema:
$ref: '#/components/schemas/ProxyCreateRequest'
responses:
'200':
description: A Proxy object
content:
application/json:
schema:
$ref: '#/components/schemas/Proxy'
'400':
"$ref": "#/components/responses/bad_request"
'401':
"$ref": "#/components/responses/requires_authentication"
'403':
"$ref": "#/components/responses/forbidden"
'500':
"$ref": "#/components/responses/internal_error"
/api/proxies/{proxyId}:
get:
x-cloud-only: true
summary: Retrieve a Proxy
description: Get information about a proxy
tags: [ Proxies ]
security:
- BearerAuth: [ ]
- TokenAuth: [ ]
parameters:
- in: path
name: proxyId
required: true
schema:
type: string
description: The unique identifier of a proxy
responses:
'200':
description: A Proxy object
content:
application/json:
schema:
$ref: '#/components/schemas/Proxy'
'400':
"$ref": "#/components/responses/bad_request"
'401':
"$ref": "#/components/responses/requires_authentication"
'403':
"$ref": "#/components/responses/forbidden"
'500':
"$ref": "#/components/responses/internal_error"
put:
x-cloud-only: true
summary: Update a Proxy
description: Update information about a proxy
tags: [ Proxies ]
security:
- BearerAuth: [ ]
- TokenAuth: [ ]
parameters:
- in: path
name: proxyId
required: true
schema:
type: string
description: The unique identifier of a proxy
requestBody:
description: update a proxy
content:
'application/json':
schema:
$ref: '#/components/schemas/ProxyUpdateRequest'
responses:
'200':
description: A Proxy object
content:
application/json:
schema:
$ref: '#/components/schemas/Proxy'
'400':
"$ref": "#/components/responses/bad_request"
'401':
"$ref": "#/components/responses/requires_authentication"
'403':
"$ref": "#/components/responses/forbidden"
'500':
"$ref": "#/components/responses/internal_error"
delete:
x-cloud-only: true
summary: Delete a Proxy
description: Delete a proxy
tags: [ Proxies ]
security:
- BearerAuth: [ ]
- TokenAuth: [ ]
parameters:
- in: path
name: proxyId
required: true
schema:
type: string
description: The unique identifier of a proxy
responses:
'200':
description: Delete status code
content: { }
'400':
"$ref": "#/components/responses/bad_request"
'401':
"$ref": "#/components/responses/requires_authentication"
'403':
"$ref": "#/components/responses/forbidden"
'500':
"$ref": "#/components/responses/internal_error"
/api/setup-keys:
get:
summary: List all Setup Keys