From 507b9ece5e45a0d5bfee0653887733fd746a6f8c Mon Sep 17 00:00:00 2001 From: Timo Furrer Date: Fri, 3 Mar 2023 22:16:15 +0100 Subject: [PATCH 1/2] Expose Revoked and Expired field for Deploy Tokens --- deploy_tokens.go | 2 ++ deploy_tokens_test.go | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/deploy_tokens.go b/deploy_tokens.go index 351901629..fb13124c2 100644 --- a/deploy_tokens.go +++ b/deploy_tokens.go @@ -36,6 +36,8 @@ type DeployToken struct { Name string `json:"name"` Username string `json:"username"` ExpiresAt *time.Time `json:"expires_at"` + Expired bool `json:"expired"` + Revoked bool `json:"revoked"` Token string `json:"token,omitempty"` Scopes []string `json:"scopes"` } diff --git a/deploy_tokens_test.go b/deploy_tokens_test.go index f67bc36e3..0b8b1814b 100644 --- a/deploy_tokens_test.go +++ b/deploy_tokens_test.go @@ -39,7 +39,9 @@ func TestListAllDeployTokens(t *testing.T) { "scopes": [ "read_repository", "read_registry" - ] + ], + "expired": true, + "revoked": true } ] `) @@ -62,6 +64,8 @@ func TestListAllDeployTokens(t *testing.T) { "read_repository", "read_registry", }, + Expired: true, + Revoked: true, }, } From 74e732fb037ea2480da4c502ec22de323e01a136 Mon Sep 17 00:00:00 2001 From: Sander van Harmelen Date: Sat, 4 Mar 2023 17:44:00 +0100 Subject: [PATCH 2/2] =?UTF-8?q?Tweak=20PR=20just=20a=20little=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy_tokens.go | 2 +- deploy_tokens_test.go | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/deploy_tokens.go b/deploy_tokens.go index fb13124c2..07c53cc20 100644 --- a/deploy_tokens.go +++ b/deploy_tokens.go @@ -36,8 +36,8 @@ type DeployToken struct { Name string `json:"name"` Username string `json:"username"` ExpiresAt *time.Time `json:"expires_at"` - Expired bool `json:"expired"` Revoked bool `json:"revoked"` + Expired bool `json:"expired"` Token string `json:"token,omitempty"` Scopes []string `json:"scopes"` } diff --git a/deploy_tokens_test.go b/deploy_tokens_test.go index 0b8b1814b..01b917b09 100644 --- a/deploy_tokens_test.go +++ b/deploy_tokens_test.go @@ -36,12 +36,12 @@ func TestListAllDeployTokens(t *testing.T) { "name": "MyToken", "username": "gitlab+deploy-token-1", "expires_at": "2020-02-14T00:00:00.000Z", + "revoked": true, + "expired": true, "scopes": [ "read_repository", "read_registry" - ], - "expired": true, - "revoked": true + ] } ] `) @@ -60,12 +60,12 @@ func TestListAllDeployTokens(t *testing.T) { Name: "MyToken", Username: "gitlab+deploy-token-1", ExpiresAt: &wantExpiresAt, + Revoked: true, + Expired: true, Scopes: []string{ "read_repository", "read_registry", }, - Expired: true, - Revoked: true, }, }