Skip to content

add DI token management operations (CreateToken, ListTokens, RevokeToken)#966

Merged
DO-rrao merged 4 commits intodigitalocean:mainfrom
Rachana888:feature/dedicated-inference-tokens(create/list/revoke)
Mar 13, 2026
Merged

add DI token management operations (CreateToken, ListTokens, RevokeToken)#966
DO-rrao merged 4 commits intodigitalocean:mainfrom
Rachana888:feature/dedicated-inference-tokens(create/list/revoke)

Conversation

@Rachana888
Copy link
Copy Markdown
Contributor

@Rachana888 Rachana888 commented Mar 12, 2026

Summary

  • Adds support for managing authentication tokens for Dedicated Inference instances
  • Implements token management endpoints for creating, listing, and revoking tokens

Changes

  • Added CreateToken, ListTokens, and RevokeToken methods to DedicatedInferenceService interface
  • Added DedicatedInferenceTokenCreateRequest struct for create token request body
  • Added dedicatedInferenceTokenRoot struct for single token JSON deserialization
  • Added dedicatedInferenceTokensRoot struct for token list JSON deserialization with pagination
  • Implemented token management methods in DedicatedInferenceServiceOp:
    • CreateToken: Sends POST request with token name and returns token including secret value
    • ListTokens: Sends GET request with optional pagination and returns list of tokens
    • RevokeToken: Sends DELETE request and returns no response body
  • Added unit tests for all token management operations

API Specification

Method Endpoint Response
POST /v2/dedicated-inferences/{id}/tokens 201 Created with token (includes value)
GET /v2/dedicated-inferences/{id}/tokens 200 OK with paginated list
DELETE /v2/dedicated-inferences/{id}/tokens/{token_id} 204 No Content

Testing

Commands
go test -v -run "TestDedicatedInference_CreateToken
go test -v -run "TestDedicatedInference_ListTokens
go test -v -run "TestDedicatedInference_ListTokensWithPagination
go test -v -run "TestDedicatedInference_RevokeToken

Results

=== RUN   TestDedicatedInference_CreateToken
--- PASS: TestDedicatedInference_CreateToken (0.00s)
=== RUN   TestDedicatedInference_ListTokens
--- PASS: TestDedicatedInference_ListTokens (0.00s)
=== RUN   TestDedicatedInference_ListTokensWithPagination
--- PASS: TestDedicatedInference_ListTokensWithPagination (0.00s)
=== RUN   TestDedicatedInference_RevokeToken
--- PASS: TestDedicatedInference_RevokeToken (0.00s)
PASS
ok      github.com/digitalocean/godo    1.495s

Unit Tests Added

  • TestDedicatedInference_CreateToken – Verifies token creation with name validation
  • TestDedicatedInference_ListTokens – Lists tokens without pagination
  • TestDedicatedInference_ListTokensWithPagination – Lists tokens with page / per_page
  • TestDedicatedInference_RevokeToken – Revokes (deletes) a token

@gitguardian
Copy link
Copy Markdown

gitguardian bot commented Mar 12, 2026

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
While these secrets were previously flagged, we no longer have a reference to the
specific commits where they were detected. Once a secret has been leaked into a git
repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@Rachana888 Rachana888 force-pushed the feature/dedicated-inference-tokens(create/list/revoke) branch from 1261939 to 1ce7cd8 Compare March 12, 2026 08:22
@DO-rrao DO-rrao merged commit 79fa6b0 into digitalocean:main Mar 13, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants