Repository navigation
Add service-token update for name and expiry - #1526
Open
mscoutermarsh wants to merge 1 commit into
Open
mscoutermarsh wants to merge 1 commit into
mscoutermarsh wants to merge 1 commit into
Conversation
Co-authored-by: Mike Coutermarsh <[email protected]>
mscoutermarsh
marked this pull request as ready for review
November 15, 2026 00:01
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Add
pscale service-token updateso a service token's name or expiry can be changed without rotating its secret.Details
Decisions
pscale service-token update <id>sends PATCH to/v1/organizations/{org}/service-tokens/{id}, the member path get and delete already use.nameandttl. The id stays in the path. Grants are not sent. There is no secret field, so the secret is neither printed nor rotated.--nameand--ttlare each optional. At least one is required. A flag that is left off is left out of the body, so that value stays as it is.--ttlis a number of seconds, the same unit asservice-token create. Create's integer flag treats0as no expiry by omittingttl. Update cannot use omission for that, because an omitted--ttlmeans leave the expiry.--ttl neversendsttlas JSON null to clear it. Any other integer, including0, is sent as that number.--name ""is sent as an empty string.Test
TestServiceToken_UpdateCmdininternal/cmd/token/create_test.go. It runsservice-token updatethrough the real client and checks the PATCH body is{"name":"renamed","ttl":3600}and does not contain the secret. The printed JSON also omits the secret the server returned.Checked against a local API: rename leaves the secret, id, and grants in place;
--ttlseconds sets expiry;--ttl neverclears it;--ttl 0is rejected.Skipped
Interactive prompts, a new HTTP client, shell completions beyond what the sibling commands already get, duration strings such as
30m(create takes raw seconds), documentation, and any change to grants or the secret.Risks
--ttl neveris encoded as JSON null. The local API accepts that and clearsexpires_at. The focused test does not cover--ttl never, a name-only update, or the one-year and expired-token errors.