Skip to content

Commit 95234d6

Browse files
committed
/me/tokens -> /me/device-tokens
1 parent ca7b150 commit 95234d6

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
@@ -7066,7 +7066,7 @@ impl NexusExternalApi for NexusExternalApiImpl {
70667066
.await
70677067
}
70687068

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

7100-
async fn current_user_token_delete(
7100+
async fn current_user_device_token_delete(
71017101
rqctx: RequestContext<Self::Context>,
71027102
path_params: Path<params::TokenPath>,
71037103
) -> 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
@@ -5450,6 +5450,99 @@
54505450
}
54515451
}
54525452
},
5453+
"/v1/me/device-tokens": {
5454+
"get": {
5455+
"tags": [
5456+
"tokens"
5457+
],
5458+
"summary": "List device tokens",
5459+
"description": "List device access tokens for the currently authenticated user.",
5460+
"operationId": "current_user_device_token_list",
5461+
"parameters": [
5462+
{
5463+
"in": "query",
5464+
"name": "limit",
5465+
"description": "Maximum number of items returned by a single call",
5466+
"schema": {
5467+
"nullable": true,
5468+
"type": "integer",
5469+
"format": "uint32",
5470+
"minimum": 1
5471+
}
5472+
},
5473+
{
5474+
"in": "query",
5475+
"name": "page_token",
5476+
"description": "Token returned by previous call to retrieve the subsequent page",
5477+
"schema": {
5478+
"nullable": true,
5479+
"type": "string"
5480+
}
5481+
},
5482+
{
5483+
"in": "query",
5484+
"name": "sort_by",
5485+
"schema": {
5486+
"$ref": "#/components/schemas/IdSortMode"
5487+
}
5488+
}
5489+
],
5490+
"responses": {
5491+
"200": {
5492+
"description": "successful operation",
5493+
"content": {
5494+
"application/json": {
5495+
"schema": {
5496+
"$ref": "#/components/schemas/DeviceAccessTokenResultsPage"
5497+
}
5498+
}
5499+
}
5500+
},
5501+
"4XX": {
5502+
"$ref": "#/components/responses/Error"
5503+
},
5504+
"5XX": {
5505+
"$ref": "#/components/responses/Error"
5506+
}
5507+
},
5508+
"x-dropshot-pagination": {
5509+
"required": []
5510+
}
5511+
}
5512+
},
5513+
"/v1/me/device-tokens/{token_id}": {
5514+
"delete": {
5515+
"tags": [
5516+
"tokens"
5517+
],
5518+
"summary": "Delete device token",
5519+
"description": "Delete a device access token for the currently authenticated user.",
5520+
"operationId": "current_user_device_token_delete",
5521+
"parameters": [
5522+
{
5523+
"in": "path",
5524+
"name": "token_id",
5525+
"description": "ID of the token",
5526+
"required": true,
5527+
"schema": {
5528+
"type": "string",
5529+
"format": "uuid"
5530+
}
5531+
}
5532+
],
5533+
"responses": {
5534+
"204": {
5535+
"description": "successful deletion"
5536+
},
5537+
"4XX": {
5538+
"$ref": "#/components/responses/Error"
5539+
},
5540+
"5XX": {
5541+
"$ref": "#/components/responses/Error"
5542+
}
5543+
}
5544+
}
5545+
},
54535546
"/v1/me/groups": {
54545547
"get": {
54555548
"tags": [
@@ -5674,99 +5767,6 @@
56745767
}
56755768
}
56765769
},
5677-
"/v1/me/tokens": {
5678-
"get": {
5679-
"tags": [
5680-
"tokens"
5681-
],
5682-
"summary": "List device access tokens",
5683-
"description": "List device access tokens for the currently authenticated user.",
5684-
"operationId": "current_user_token_list",
5685-
"parameters": [
5686-
{
5687-
"in": "query",
5688-
"name": "limit",
5689-
"description": "Maximum number of items returned by a single call",
5690-
"schema": {
5691-
"nullable": true,
5692-
"type": "integer",
5693-
"format": "uint32",
5694-
"minimum": 1
5695-
}
5696-
},
5697-
{
5698-
"in": "query",
5699-
"name": "page_token",
5700-
"description": "Token returned by previous call to retrieve the subsequent page",
5701-
"schema": {
5702-
"nullable": true,
5703-
"type": "string"
5704-
}
5705-
},
5706-
{
5707-
"in": "query",
5708-
"name": "sort_by",
5709-
"schema": {
5710-
"$ref": "#/components/schemas/IdSortMode"
5711-
}
5712-
}
5713-
],
5714-
"responses": {
5715-
"200": {
5716-
"description": "successful operation",
5717-
"content": {
5718-
"application/json": {
5719-
"schema": {
5720-
"$ref": "#/components/schemas/DeviceAccessTokenResultsPage"
5721-
}
5722-
}
5723-
}
5724-
},
5725-
"4XX": {
5726-
"$ref": "#/components/responses/Error"
5727-
},
5728-
"5XX": {
5729-
"$ref": "#/components/responses/Error"
5730-
}
5731-
},
5732-
"x-dropshot-pagination": {
5733-
"required": []
5734-
}
5735-
}
5736-
},
5737-
"/v1/me/tokens/{token_id}": {
5738-
"delete": {
5739-
"tags": [
5740-
"tokens"
5741-
],
5742-
"summary": "Delete device access token",
5743-
"description": "Delete a device access token for the currently authenticated user.",
5744-
"operationId": "current_user_token_delete",
5745-
"parameters": [
5746-
{
5747-
"in": "path",
5748-
"name": "token_id",
5749-
"description": "ID of the token",
5750-
"required": true,
5751-
"schema": {
5752-
"type": "string",
5753-
"format": "uuid"
5754-
}
5755-
}
5756-
],
5757-
"responses": {
5758-
"204": {
5759-
"description": "successful deletion"
5760-
},
5761-
"4XX": {
5762-
"$ref": "#/components/responses/Error"
5763-
},
5764-
"5XX": {
5765-
"$ref": "#/components/responses/Error"
5766-
}
5767-
}
5768-
}
5769-
},
57705770
"/v1/metrics/{metric_name}": {
57715771
"get": {
57725772
"tags": [

0 commit comments

Comments
 (0)