Skip to content

Commit f12c148

Browse files
committed
/me/tokens -> /me/device-tokens
1 parent 8f6c7cb commit f12c148

File tree

7 files changed

+109
-109
lines changed

7 files changed

+109
-109
lines changed

nexus/external-api/output/nexus_tags.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,8 @@ ping GET /v1/ping
289289

290290
API operations found with tag "tokens"
291291
OPERATION ID METHOD URL PATH
292-
current_user_token_delete DELETE /v1/me/tokens/{token_id}
293-
current_user_token_list GET /v1/me/tokens
292+
current_user_device_token_delete DELETE /v1/me/device-tokens/{token_id}
293+
current_user_device_token_list GET /v1/me/device-tokens
294294

295295
API operations found with tag "vpcs"
296296
OPERATION ID METHOD URL PATH

nexus/external-api/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3152,28 +3152,28 @@ pub trait NexusExternalApi {
31523152
path_params: Path<params::SshKeyPath>,
31533153
) -> Result<HttpResponseDeleted, HttpError>;
31543154

3155-
/// List device access tokens
3155+
/// List device tokens
31563156
///
31573157
/// List device access tokens for the currently authenticated user.
31583158
#[endpoint {
31593159
method = GET,
3160-
path = "/v1/me/tokens",
3160+
path = "/v1/me/device-tokens",
31613161
tags = ["tokens"],
31623162
}]
3163-
async fn current_user_token_list(
3163+
async fn current_user_device_token_list(
31643164
rqctx: RequestContext<Self::Context>,
31653165
query_params: Query<PaginatedById>,
31663166
) -> Result<HttpResponseOk<ResultsPage<views::DeviceAccessToken>>, HttpError>;
31673167

3168-
/// Delete device access token
3168+
/// Delete device token
31693169
///
31703170
/// Delete a device access token for the currently authenticated user.
31713171
#[endpoint {
31723172
method = DELETE,
3173-
path = "/v1/me/tokens/{token_id}",
3173+
path = "/v1/me/device-tokens/{token_id}",
31743174
tags = ["tokens"],
31753175
}]
3176-
async fn current_user_token_delete(
3176+
async fn current_user_device_token_delete(
31773177
rqctx: RequestContext<Self::Context>,
31783178
path_params: Path<params::TokenPath>,
31793179
) -> Result<HttpResponseDeleted, HttpError>;

nexus/src/external_api/http_entrypoints.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7067,7 +7067,7 @@ impl NexusExternalApi for NexusExternalApiImpl {
70677067
.await
70687068
}
70697069

7070-
async fn current_user_token_list(
7070+
async fn current_user_device_token_list(
70717071
rqctx: RequestContext<Self::Context>,
70727072
query_params: Query<PaginatedById>,
70737073
) -> Result<HttpResponseOk<ResultsPage<views::DeviceAccessToken>>, HttpError>
@@ -7098,7 +7098,7 @@ impl NexusExternalApi for NexusExternalApiImpl {
70987098
.await
70997099
}
71007100

7101-
async fn current_user_token_delete(
7101+
async fn current_user_device_token_delete(
71027102
rqctx: RequestContext<Self::Context>,
71037103
path_params: Path<params::TokenPath>,
71047104
) -> Result<HttpResponseDeleted, HttpError> {

nexus/tests/integration_tests/device_auth.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ async fn test_device_auth_flow(cptestctx: &ControlPlaneTestContext) {
203203

204204
// Test that privileged user cannot delete unpriv's token through this
205205
// endpoint, though it will probably be able to do it via a different one
206-
let token_url = format!("/v1/me/tokens/{}", token_id);
206+
let token_url = format!("/v1/me/device-tokens/{}", token_id);
207207
NexusRequest::new(
208208
RequestBuilder::new(testctx, Method::DELETE, &token_url)
209209
.expect_status(Some(StatusCode::NOT_FOUND)),
@@ -432,7 +432,7 @@ async fn test_device_token_expiration(cptestctx: &ControlPlaneTestContext) {
432432
async fn get_tokens_priv(
433433
testctx: &ClientTestContext,
434434
) -> Vec<views::DeviceAccessToken> {
435-
NexusRequest::object_get(testctx, "/v1/me/tokens")
435+
NexusRequest::object_get(testctx, "/v1/me/device-tokens")
436436
.authn_as(AuthnMode::PrivilegedUser)
437437
.execute_and_parse_unwrap::<ResultsPage<views::DeviceAccessToken>>()
438438
.await
@@ -442,7 +442,7 @@ async fn get_tokens_priv(
442442
async fn get_tokens_unpriv(
443443
testctx: &ClientTestContext,
444444
) -> Vec<views::DeviceAccessToken> {
445-
NexusRequest::object_get(testctx, "/v1/me/tokens")
445+
NexusRequest::object_get(testctx, "/v1/me/device-tokens")
446446
.authn_as(AuthnMode::UnprivilegedUser)
447447
.execute_and_parse_unwrap::<ResultsPage<views::DeviceAccessToken>>()
448448
.await

nexus/tests/integration_tests/endpoints.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2599,7 +2599,7 @@ pub static VERIFY_ENDPOINTS: LazyLock<Vec<VerifyEndpoint>> =
25992599
},
26002600
/* Tokens */
26012601
VerifyEndpoint {
2602-
url: "/v1/me/tokens",
2602+
url: "/v1/me/device-tokens",
26032603
visibility: Visibility::Public,
26042604
unprivileged_access: UnprivilegedAccess::ReadOnly,
26052605
allowed_methods: vec![AllowedMethod::Get],
@@ -2610,7 +2610,7 @@ pub static VERIFY_ENDPOINTS: LazyLock<Vec<VerifyEndpoint>> =
26102610
// and opt out.
26112611

26122612
// VerifyEndpoint {
2613-
// url: "/v1/me/tokens/token-id",
2613+
// url: "/v1/me/device-tokens/token-id",
26142614
// visibility: Visibility::Public,
26152615
// unprivileged_access: UnprivilegedAccess::None,
26162616
// allowed_methods: vec![AllowedMethod::Delete],

nexus/tests/output/uncovered-authz-endpoints.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
API endpoints with no coverage in authz tests:
22
probe_delete (delete "/experimental/v1/probes/{probe}")
3-
current_user_token_delete (delete "/v1/me/tokens/{token_id}")
3+
current_user_token_delete (delete "/v1/me/device-tokens/{token_id}")
44
probe_list (get "/experimental/v1/probes")
55
probe_view (get "/experimental/v1/probes/{probe}")
66
support_bundle_download (get "/experimental/v1/system/support-bundles/{bundle_id}/download")

openapi/nexus.json

Lines changed: 93 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -5418,6 +5418,99 @@
54185418
}
54195419
}
54205420
},
5421+
"/v1/me/device-tokens": {
5422+
"get": {
5423+
"tags": [
5424+
"tokens"
5425+
],
5426+
"summary": "List device tokens",
5427+
"description": "List device access tokens for the currently authenticated user.",
5428+
"operationId": "current_user_device_token_list",
5429+
"parameters": [
5430+
{
5431+
"in": "query",
5432+
"name": "limit",
5433+
"description": "Maximum number of items returned by a single call",
5434+
"schema": {
5435+
"nullable": true,
5436+
"type": "integer",
5437+
"format": "uint32",
5438+
"minimum": 1
5439+
}
5440+
},
5441+
{
5442+
"in": "query",
5443+
"name": "page_token",
5444+
"description": "Token returned by previous call to retrieve the subsequent page",
5445+
"schema": {
5446+
"nullable": true,
5447+
"type": "string"
5448+
}
5449+
},
5450+
{
5451+
"in": "query",
5452+
"name": "sort_by",
5453+
"schema": {
5454+
"$ref": "#/components/schemas/IdSortMode"
5455+
}
5456+
}
5457+
],
5458+
"responses": {
5459+
"200": {
5460+
"description": "successful operation",
5461+
"content": {
5462+
"application/json": {
5463+
"schema": {
5464+
"$ref": "#/components/schemas/DeviceAccessTokenResultsPage"
5465+
}
5466+
}
5467+
}
5468+
},
5469+
"4XX": {
5470+
"$ref": "#/components/responses/Error"
5471+
},
5472+
"5XX": {
5473+
"$ref": "#/components/responses/Error"
5474+
}
5475+
},
5476+
"x-dropshot-pagination": {
5477+
"required": []
5478+
}
5479+
}
5480+
},
5481+
"/v1/me/device-tokens/{token_id}": {
5482+
"delete": {
5483+
"tags": [
5484+
"tokens"
5485+
],
5486+
"summary": "Delete device token",
5487+
"description": "Delete a device access token for the currently authenticated user.",
5488+
"operationId": "current_user_device_token_delete",
5489+
"parameters": [
5490+
{
5491+
"in": "path",
5492+
"name": "token_id",
5493+
"description": "ID of the token",
5494+
"required": true,
5495+
"schema": {
5496+
"type": "string",
5497+
"format": "uuid"
5498+
}
5499+
}
5500+
],
5501+
"responses": {
5502+
"204": {
5503+
"description": "successful deletion"
5504+
},
5505+
"4XX": {
5506+
"$ref": "#/components/responses/Error"
5507+
},
5508+
"5XX": {
5509+
"$ref": "#/components/responses/Error"
5510+
}
5511+
}
5512+
}
5513+
},
54215514
"/v1/me/groups": {
54225515
"get": {
54235516
"tags": [
@@ -5642,99 +5735,6 @@
56425735
}
56435736
}
56445737
},
5645-
"/v1/me/tokens": {
5646-
"get": {
5647-
"tags": [
5648-
"tokens"
5649-
],
5650-
"summary": "List device access tokens",
5651-
"description": "List device access tokens for the currently authenticated user.",
5652-
"operationId": "current_user_token_list",
5653-
"parameters": [
5654-
{
5655-
"in": "query",
5656-
"name": "limit",
5657-
"description": "Maximum number of items returned by a single call",
5658-
"schema": {
5659-
"nullable": true,
5660-
"type": "integer",
5661-
"format": "uint32",
5662-
"minimum": 1
5663-
}
5664-
},
5665-
{
5666-
"in": "query",
5667-
"name": "page_token",
5668-
"description": "Token returned by previous call to retrieve the subsequent page",
5669-
"schema": {
5670-
"nullable": true,
5671-
"type": "string"
5672-
}
5673-
},
5674-
{
5675-
"in": "query",
5676-
"name": "sort_by",
5677-
"schema": {
5678-
"$ref": "#/components/schemas/IdSortMode"
5679-
}
5680-
}
5681-
],
5682-
"responses": {
5683-
"200": {
5684-
"description": "successful operation",
5685-
"content": {
5686-
"application/json": {
5687-
"schema": {
5688-
"$ref": "#/components/schemas/DeviceAccessTokenResultsPage"
5689-
}
5690-
}
5691-
}
5692-
},
5693-
"4XX": {
5694-
"$ref": "#/components/responses/Error"
5695-
},
5696-
"5XX": {
5697-
"$ref": "#/components/responses/Error"
5698-
}
5699-
},
5700-
"x-dropshot-pagination": {
5701-
"required": []
5702-
}
5703-
}
5704-
},
5705-
"/v1/me/tokens/{token_id}": {
5706-
"delete": {
5707-
"tags": [
5708-
"tokens"
5709-
],
5710-
"summary": "Delete device access token",
5711-
"description": "Delete a device access token for the currently authenticated user.",
5712-
"operationId": "current_user_token_delete",
5713-
"parameters": [
5714-
{
5715-
"in": "path",
5716-
"name": "token_id",
5717-
"description": "ID of the token",
5718-
"required": true,
5719-
"schema": {
5720-
"type": "string",
5721-
"format": "uuid"
5722-
}
5723-
}
5724-
],
5725-
"responses": {
5726-
"204": {
5727-
"description": "successful deletion"
5728-
},
5729-
"4XX": {
5730-
"$ref": "#/components/responses/Error"
5731-
},
5732-
"5XX": {
5733-
"$ref": "#/components/responses/Error"
5734-
}
5735-
}
5736-
}
5737-
},
57385738
"/v1/metrics/{metric_name}": {
57395739
"get": {
57405740
"tags": [

0 commit comments

Comments
 (0)