Skip to content

Commit e004510

Browse files
committed
Updated OpenAPI
1 parent f52d4f5 commit e004510

File tree

3 files changed

+222
-23
lines changed

3 files changed

+222
-23
lines changed

devolutions-gateway/openapi/gateway-api.yaml

Lines changed: 214 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ info:
77
email: infos@devolutions.net
88
license:
99
name: MIT/Apache-2.0
10-
version: 2025.3.2
10+
version: 2026.1.0
1111
paths:
1212
/jet/config:
1313
patch:
@@ -598,22 +598,40 @@ paths:
598598
post:
599599
tags:
600600
- Update
601-
summary: Triggers Devolutions Gateway update process.
601+
summary: Trigger an update for one or more Devolutions products.
602602
description: |-
603-
This is done via updating `Agent/update.json` file, which is then read by Devolutions Agent
604-
when changes are detected. If the version written to `update.json` is indeed higher than the
605-
currently installed version, Devolutions Agent will proceed with the update process.
603+
Writes the requested version(s) into `Agent/update.json`, which is watched by Devolutions
604+
Agent. When a requested version is higher than the installed version the agent proceeds
605+
with the update.
606+
607+
**Body form** (preferred): pass a JSON body with a `Products` map.
608+
609+
**Query-param form** (legacy, gateway-only): `POST /jet/update?version=latest`.
610+
This form updates only the Gateway product and is kept for backward compatibility.
611+
612+
Both forms cannot be used simultaneously; doing so returns HTTP 400.
606613
operationId: TriggerUpdate
607614
parameters:
608615
- name: version
609616
in: query
610-
description: The version to install; use 'latest' for the latest version, or 'w.x.y.z' for a specific version
611-
required: true
617+
description: Gateway-only target version; use the request body for multi-product updates
618+
required: false
619+
deprecated: true
612620
schema:
613621
type: string
622+
nullable: true
623+
requestBody:
624+
description: Products and target versions to update
625+
content:
626+
application/json:
627+
schema:
628+
allOf:
629+
- $ref: '#/components/schemas/UpdateRequest'
630+
nullable: true
631+
required: false
614632
responses:
615633
'200':
616-
description: Update request has been processed successfully
634+
description: Update request accepted
617635
content:
618636
application/json:
619637
schema:
@@ -625,7 +643,72 @@ paths:
625643
'403':
626644
description: Insufficient permissions
627645
'500':
628-
description: Agent updater service is malfunctioning
646+
description: Failed to write update manifest
647+
'503':
648+
description: Agent updater service is unavailable
649+
security:
650+
- scope_token:
651+
- gateway.update
652+
/jet/update/schedule:
653+
get:
654+
tags:
655+
- Update
656+
summary: Retrieve the current Devolutions Agent auto-update schedule.
657+
description: |-
658+
Reads the `Schedule` field from `update.json`. When the field is absent the response
659+
contains zeroed defaults (`Enabled: false`, interval `0`, window start `0`, no products).
660+
operationId: GetUpdateSchedule
661+
responses:
662+
'200':
663+
description: Current auto-update schedule
664+
content:
665+
application/json:
666+
schema:
667+
$ref: '#/components/schemas/GetUpdateScheduleResponse'
668+
'401':
669+
description: Invalid or missing authorization token
670+
'403':
671+
description: Insufficient permissions
672+
'500':
673+
description: Failed to read update manifest
674+
'503':
675+
description: Agent updater service is unavailable
676+
security:
677+
- scope_token:
678+
- gateway.update
679+
post:
680+
tags:
681+
- Update
682+
summary: Set the Devolutions Agent auto-update schedule.
683+
description: |-
684+
Writes the `Schedule` field into `update.json`. The agent watches this file and
685+
applies the new schedule immediately, then persists it to `agent.json`.
686+
687+
All other fields in `update.json` are preserved; the `VersionMinor` field is reset to
688+
the minor version this gateway build understands so the agent does not see an unknown
689+
future version.
690+
operationId: SetUpdateSchedule
691+
requestBody:
692+
content:
693+
application/json:
694+
schema:
695+
$ref: '#/components/schemas/SetUpdateScheduleRequest'
696+
required: true
697+
responses:
698+
'200':
699+
description: Auto-update schedule applied
700+
content:
701+
application/json:
702+
schema:
703+
$ref: '#/components/schemas/SetUpdateScheduleResponse'
704+
'400':
705+
description: Bad request
706+
'401':
707+
description: Invalid or missing authorization token
708+
'403':
709+
description: Insufficient permissions
710+
'500':
711+
description: Failed to write update manifest
629712
'503':
630713
description: Agent updater service is unavailable
631714
security:
@@ -885,6 +968,43 @@ components:
885968
- connect_failure
886969
- normal_termination
887970
- abnormal_termination
971+
GetUpdateScheduleResponse:
972+
type: object
973+
description: Current auto-update schedule for Devolutions Agent.
974+
required:
975+
- Enabled
976+
- Interval
977+
- UpdateWindowStart
978+
properties:
979+
Enabled:
980+
type: boolean
981+
description: Enable periodic Devolutions Agent self-update checks.
982+
Interval:
983+
type: integer
984+
format: int64
985+
description: |-
986+
Minimum interval between auto-update checks, in seconds.
987+
988+
`0` means check once at `UpdateWindowStart`.
989+
minimum: 0
990+
Products:
991+
type: array
992+
items:
993+
$ref: '#/components/schemas/UpdateProduct'
994+
description: Products the agent autonomously polls for new versions.
995+
UpdateWindowEnd:
996+
type: integer
997+
format: int32
998+
description: |-
999+
End of the maintenance window as seconds past midnight (local time, exclusive).
1000+
`None` means no upper bound (single check at `UpdateWindowStart`).
1001+
nullable: true
1002+
minimum: 0
1003+
UpdateWindowStart:
1004+
type: integer
1005+
format: int32
1006+
description: Start of the maintenance window as seconds past midnight (local time).
1007+
minimum: 0
8881008
Heartbeat:
8891009
type: object
8901010
required:
@@ -1361,6 +1481,45 @@ components:
13611481
$ref: '#/components/schemas/MonitorDefinitionProbeTypeError'
13621482
description: An optional list of probes that this server could not parse.
13631483
nullable: true
1484+
SetUpdateScheduleRequest:
1485+
type: object
1486+
description: Desired auto-update schedule to apply to Devolutions Agent.
1487+
required:
1488+
- Enabled
1489+
properties:
1490+
Enabled:
1491+
type: boolean
1492+
description: Enable periodic Devolutions Agent self-update checks.
1493+
Interval:
1494+
type: integer
1495+
format: int64
1496+
description: |-
1497+
Minimum interval between auto-update checks, in seconds.
1498+
1499+
`0` means check once at `UpdateWindowStart` (default).
1500+
minimum: 0
1501+
Products:
1502+
type: array
1503+
items:
1504+
$ref: '#/components/schemas/UpdateProduct'
1505+
description: 'Products the agent autonomously polls for new versions (default: empty).'
1506+
UpdateWindowEnd:
1507+
type: integer
1508+
format: int32
1509+
description: |-
1510+
End of the maintenance window as seconds past midnight in local time, exclusive.
1511+
1512+
`null` (default) means no upper bound -- a single check fires at `UpdateWindowStart`.
1513+
When end < start the window crosses midnight.
1514+
nullable: true
1515+
minimum: 0
1516+
UpdateWindowStart:
1517+
type: integer
1518+
format: int32
1519+
description: 'Start of the maintenance window as seconds past midnight in local time (default: `7200` = 02:00).'
1520+
minimum: 0
1521+
SetUpdateScheduleResponse:
1522+
type: object
13641523
SubProvisionerKey:
13651524
type: object
13661525
required:
@@ -1455,8 +1614,54 @@ components:
14551614
enum:
14561615
- tcp
14571616
- udp
1617+
UpdateProduct:
1618+
oneOf:
1619+
- type: string
1620+
enum:
1621+
- Gateway
1622+
- type: string
1623+
enum:
1624+
- HubService
1625+
- type: string
1626+
enum:
1627+
- Agent
1628+
- type: object
1629+
required:
1630+
- Other
1631+
properties:
1632+
Other:
1633+
type: string
1634+
description: A product name not recognised by this gateway version.
1635+
description: |-
1636+
Known product names accepted by the update endpoint.
1637+
1638+
`Other` captures any product name not yet known to this gateway version;
1639+
it is forwarded to the agent unchanged so future agents can act on it.
1640+
UpdateProductRequest:
1641+
type: object
1642+
description: Per-product version request.
1643+
required:
1644+
- Version
1645+
properties:
1646+
Version:
1647+
$ref: '#/components/schemas/VersionSpecification'
1648+
UpdateRequest:
1649+
type: object
1650+
description: |-
1651+
Request body for the unified update endpoint.
1652+
1653+
Every key in `Products` is a product name. Known products (`Gateway`, `Agent`,
1654+
`HubService`) are processed natively; any other name is forwarded as-is to the
1655+
agent so future product types are supported transparently.
1656+
properties:
1657+
Products:
1658+
type: object
1659+
description: Map of product name to version specification.
1660+
additionalProperties:
1661+
$ref: '#/components/schemas/UpdateProductRequest'
14581662
UpdateResponse:
14591663
type: object
1664+
description: Response returned by the update endpoint.
14601665
securitySchemes:
14611666
jrec_token:
14621667
type: http

devolutions-gateway/src/api/update.rs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ async fn write_manifest(mut manifest: UpdateManifestV2) -> Result<(), HttpError>
8181

8282
// ── OpenAPI request / response types ─────────────────────────────────────────
8383

84-
/// Version specification string: `"latest"` or a specific version like `"2026.1.0"`.
84+
/// Per-product version request.
8585
#[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))]
8686
#[derive(Debug, Deserialize)]
8787
#[serde(rename_all = "PascalCase")]
@@ -141,22 +141,11 @@ impl serde::Serialize for UpdateProduct {
141141
/// Every key in `Products` is a product name. Known products (`Gateway`, `Agent`,
142142
/// `HubService`) are processed natively; any other name is forwarded as-is to the
143143
/// agent so future product types are supported transparently.
144-
///
145-
/// # Example
146-
///
147-
/// ```json
148-
/// {
149-
/// "Products": {
150-
/// "Gateway": { "Version": "2026.1.0" },
151-
/// "Agent": { "Version": "latest" }
152-
/// }
153-
/// }
154-
/// ```
155144
#[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))]
156145
#[derive(Debug, Default, Deserialize)]
157146
#[serde(rename_all = "PascalCase")]
158147
pub(crate) struct UpdateRequest {
159-
/// Map of product name version specification.
148+
/// Map of product name to version specification.
160149
#[serde(default)]
161150
pub products: HashMap<UpdateProduct, UpdateProductRequest>,
162151
}
@@ -371,7 +360,7 @@ pub(crate) struct SetUpdateScheduleRequest {
371360
pub update_window_start: u32,
372361
/// End of the maintenance window as seconds past midnight in local time, exclusive.
373362
///
374-
/// `null` (default) means no upper bound a single check fires at `UpdateWindowStart`.
363+
/// `null` (default) means no upper bound - a single check fires at `UpdateWindowStart`.
375364
/// When end < start the window crosses midnight.
376365
#[serde(rename = "UpdateWindowEnd", default)]
377366
pub update_window_end: Option<u32>,

devolutions-gateway/src/openapi.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ use crate::config::dto::{DataEncoding, PubKeyFormat, Subscriber};
2626
crate::api::webapp::sign_app_token,
2727
crate::api::webapp::sign_session_token,
2828
crate::api::update::trigger_update_check,
29+
crate::api::update::get_update_schedule,
30+
crate::api::update::set_update_schedule,
2931
crate::api::preflight::post_preflight,
3032
crate::api::net::get_net_config,
3133
crate::api::monitoring::handle_set_monitoring_config,
@@ -55,6 +57,9 @@ use crate::config::dto::{DataEncoding, PubKeyFormat, Subscriber};
5557
crate::api::update::UpdateProduct,
5658
crate::api::update::UpdateProductRequest,
5759
crate::api::update::UpdateResponse,
60+
crate::api::update::GetUpdateScheduleResponse,
61+
crate::api::update::SetUpdateScheduleRequest,
62+
crate::api::update::SetUpdateScheduleResponse,
5863
PreflightOperation,
5964
PreflightOperationKind,
6065
AppCredential,

0 commit comments

Comments
 (0)