Skip to content

Conversation

@CBenoit
Copy link
Member

@CBenoit CBenoit commented Mar 19, 2025

Possible operations:

  • get-version
  • get-agent-version
  • get-running-session-count
  • get-recording-storage-health
  • push-token
  • push-credentials
  • lookup-host

Possible results:

  • version
  • agent-version
  • running-session-count
  • recording-storage-health
  • resolved-host
  • alert

Issue: DGW-245

@CBenoit CBenoit requested a review from pacmancoder March 19, 2025 06:31
Possible operations:

- `get-version`
- `get-agent-version`
- `get-running-session-count`
- `get-recording-storage-health`
- `push-token`
- `push-credentials`
- `lookup-host`

Possible results:

- `version`
- `agent-version`
- `running-session-count`
- `recording-storage-health`
- `resolved-host`
- `alert`

Issue: DGW-245
Comment on lines +215 to +235
PreflightOperationKind::PushToken { token_id, token } => {
results.push(PreflightResult {
operation_id: operation.id,
kind: PreflightResultKind::Alert {
status: PreflightAlertStatus::GeneralFailure,
message: "unimplemented".to_owned(),
},
});
}
PreflightOperationKind::PushCredentials {
credentials_id,
credentials,
} => {
results.push(PreflightResult {
operation_id: operation.id,
kind: PreflightResultKind::Alert {
status: PreflightAlertStatus::GeneralFailure,
message: "unimplemented".to_owned(),
},
});
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a follow up PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The OpenAPI clients will be regenerated in a follow up PR.

@CBenoit CBenoit enabled auto-merge (squash) March 19, 2025 06:37
@CBenoit
Copy link
Member Author

CBenoit commented Mar 19, 2025

Demo

Generate a scope token with the scope gateway.preflight or * using tokengen (or alternatively, the New-DGatewayToken cmdlet):

tokengen --provisioner-key <path/to/provisioner.key> scope 'gateway.preflight'
New-DGatewayToken -Type SCOPE -Scope 'gateway.preflight'

Perform preflight operations using curl:

$ curl "127.0.0.1:7171/jet/preflight?token=$(cargo run --manifest-path ./tools/tokengen/Cargo.toml '--' sign --provisioner-key ./config/provisioner.key scope "gateway.preflight")" \
  -X POST -H "Content-Type: application/json" \
  --data '[
    {"id": "a86ae982-e4be-4f84-8ff2-893d66df9bdd", "kind": "get-version"},
    {"id": "ef1a3ae9-e55d-48b8-92b0-ae67c29b2e4e", "kind": "push-token", "token": "hello", "token_id": "3d1d3c45-e377-4713-b8d5-45b07514cf22"},
    {"id": "55821d24-d1df-481c-8b88-66c06f879835", "kind": "lookup-host", "host_to_lookup": "devolutions.net"},
    {"id": "8ec4ab6b-39a5-411d-b191-54df2d976820", "kind": "get-running-session-count"}
  ]'

And here is how the response looks like:

[
  {"operation_id":"a86ae982-e4be-4f84-8ff2-893d66df9bdd","kind":"version","version":"2025.1.3"},
  {"operation_id":"55821d24-d1df-481c-8b88-66c06f879835","kind":"resolved-host","resolved_host":"devolutions.net","resolved_addresses":["20.24.122.172"]},
  {"operation_id":"8ec4ab6b-39a5-411d-b191-54df2d976820","kind":"running-session-count","running_session_count":0}
]

Copy link
Contributor

@pacmancoder pacmancoder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@CBenoit CBenoit merged commit 8d4f737 into master Mar 19, 2025
39 checks passed
@CBenoit CBenoit deleted the DGW-245 branch March 19, 2025 07:22
CBenoit added a commit that referenced this pull request Mar 21, 2025
CBenoit added a commit that referenced this pull request Mar 21, 2025
CBenoit added a commit that referenced this pull request Mar 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants