Skip to content

Commit 263ecb0

Browse files
committed
/me/tokens -> /me/device-tokens
1 parent 338807a commit 263ecb0

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
@@ -5512,6 +5512,99 @@
55125512
}
55135513
}
55145514
},
5515+
"/v1/me/device-tokens": {
5516+
"get": {
5517+
"tags": [
5518+
"tokens"
5519+
],
5520+
"summary": "List device tokens",
5521+
"description": "List device access tokens for the currently authenticated user.",
5522+
"operationId": "current_user_device_token_list",
5523+
"parameters": [
5524+
{
5525+
"in": "query",
5526+
"name": "limit",
5527+
"description": "Maximum number of items returned by a single call",
5528+
"schema": {
5529+
"nullable": true,
5530+
"type": "integer",
5531+
"format": "uint32",
5532+
"minimum": 1
5533+
}
5534+
},
5535+
{
5536+
"in": "query",
5537+
"name": "page_token",
5538+
"description": "Token returned by previous call to retrieve the subsequent page",
5539+
"schema": {
5540+
"nullable": true,
5541+
"type": "string"
5542+
}
5543+
},
5544+
{
5545+
"in": "query",
5546+
"name": "sort_by",
5547+
"schema": {
5548+
"$ref": "#/components/schemas/IdSortMode"
5549+
}
5550+
}
5551+
],
5552+
"responses": {
5553+
"200": {
5554+
"description": "successful operation",
5555+
"content": {
5556+
"application/json": {
5557+
"schema": {
5558+
"$ref": "#/components/schemas/DeviceAccessTokenResultsPage"
5559+
}
5560+
}
5561+
}
5562+
},
5563+
"4XX": {
5564+
"$ref": "#/components/responses/Error"
5565+
},
5566+
"5XX": {
5567+
"$ref": "#/components/responses/Error"
5568+
}
5569+
},
5570+
"x-dropshot-pagination": {
5571+
"required": []
5572+
}
5573+
}
5574+
},
5575+
"/v1/me/device-tokens/{token_id}": {
5576+
"delete": {
5577+
"tags": [
5578+
"tokens"
5579+
],
5580+
"summary": "Delete device token",
5581+
"description": "Delete a device access token for the currently authenticated user.",
5582+
"operationId": "current_user_device_token_delete",
5583+
"parameters": [
5584+
{
5585+
"in": "path",
5586+
"name": "token_id",
5587+
"description": "ID of the token",
5588+
"required": true,
5589+
"schema": {
5590+
"type": "string",
5591+
"format": "uuid"
5592+
}
5593+
}
5594+
],
5595+
"responses": {
5596+
"204": {
5597+
"description": "successful deletion"
5598+
},
5599+
"4XX": {
5600+
"$ref": "#/components/responses/Error"
5601+
},
5602+
"5XX": {
5603+
"$ref": "#/components/responses/Error"
5604+
}
5605+
}
5606+
}
5607+
},
55155608
"/v1/me/groups": {
55165609
"get": {
55175610
"tags": [
@@ -5736,99 +5829,6 @@
57365829
}
57375830
}
57385831
},
5739-
"/v1/me/tokens": {
5740-
"get": {
5741-
"tags": [
5742-
"tokens"
5743-
],
5744-
"summary": "List device access tokens",
5745-
"description": "List device access tokens for the currently authenticated user.",
5746-
"operationId": "current_user_token_list",
5747-
"parameters": [
5748-
{
5749-
"in": "query",
5750-
"name": "limit",
5751-
"description": "Maximum number of items returned by a single call",
5752-
"schema": {
5753-
"nullable": true,
5754-
"type": "integer",
5755-
"format": "uint32",
5756-
"minimum": 1
5757-
}
5758-
},
5759-
{
5760-
"in": "query",
5761-
"name": "page_token",
5762-
"description": "Token returned by previous call to retrieve the subsequent page",
5763-
"schema": {
5764-
"nullable": true,
5765-
"type": "string"
5766-
}
5767-
},
5768-
{
5769-
"in": "query",
5770-
"name": "sort_by",
5771-
"schema": {
5772-
"$ref": "#/components/schemas/IdSortMode"
5773-
}
5774-
}
5775-
],
5776-
"responses": {
5777-
"200": {
5778-
"description": "successful operation",
5779-
"content": {
5780-
"application/json": {
5781-
"schema": {
5782-
"$ref": "#/components/schemas/DeviceAccessTokenResultsPage"
5783-
}
5784-
}
5785-
}
5786-
},
5787-
"4XX": {
5788-
"$ref": "#/components/responses/Error"
5789-
},
5790-
"5XX": {
5791-
"$ref": "#/components/responses/Error"
5792-
}
5793-
},
5794-
"x-dropshot-pagination": {
5795-
"required": []
5796-
}
5797-
}
5798-
},
5799-
"/v1/me/tokens/{token_id}": {
5800-
"delete": {
5801-
"tags": [
5802-
"tokens"
5803-
],
5804-
"summary": "Delete device access token",
5805-
"description": "Delete a device access token for the currently authenticated user.",
5806-
"operationId": "current_user_token_delete",
5807-
"parameters": [
5808-
{
5809-
"in": "path",
5810-
"name": "token_id",
5811-
"description": "ID of the token",
5812-
"required": true,
5813-
"schema": {
5814-
"type": "string",
5815-
"format": "uuid"
5816-
}
5817-
}
5818-
],
5819-
"responses": {
5820-
"204": {
5821-
"description": "successful deletion"
5822-
},
5823-
"4XX": {
5824-
"$ref": "#/components/responses/Error"
5825-
},
5826-
"5XX": {
5827-
"$ref": "#/components/responses/Error"
5828-
}
5829-
}
5830-
}
5831-
},
58325832
"/v1/metrics/{metric_name}": {
58335833
"get": {
58345834
"tags": [

0 commit comments

Comments
 (0)