Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support managing API tokens and Service Accounts #577

Merged
merged 38 commits into from
Jul 12, 2023
Merged

Conversation

adezxc
Copy link

@adezxc adezxc commented May 26, 2023

Add methods for managing API tokens and Service Accounts

New public methods for token management:
*VCDClient.CreateToken,*VCDClient.GetTokenById,*VCDClient.GetAllTokens,*VCDClient.GetTokenByNameAndUsername, *VCDClient.RegisterToken , *Token.GetInitialApiToken, *Token.Delete

*Client.GetApiToken - get the structure containing the access token and the bearer token using the Service Account/API token

Public methods for service account management:
*Org.GetServiceAccountById, *Org.GetAllServiceAccounts, *Org.GetServiceAccountByName

*VCDClient.CreateServiceAccount

*ServiceAccount.Update, *ServiceAccount.Authorize, *ServiceAccount.Grant, *ServiceAccount.Refresh, *ServiceAccount.Revoke, *ServiceAccount.Delete, *ServiceAccount.GetInitialApiToken

Public OpenAPI function for sending a POST request in x-www-form-urlencoded format: client.OpenApiPostUrlEncoded

Adam Jasinski added 4 commits May 25, 2023 15:10
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
Adam Jasinski added 2 commits May 29, 2023 14:23
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
@adezxc adezxc changed the title Api tokens Support managing API tokens and Service Accounts May 31, 2023
Adam Jasinski added 2 commits May 31, 2023 18:39
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
@adezxc adezxc marked this pull request as ready for review May 31, 2023 15:48
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
@adezxc adezxc marked this pull request as draft June 2, 2023 09:47
Adam Jasinski added 10 commits June 5, 2023 16:16
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
@adezxc adezxc marked this pull request as ready for review June 19, 2023 18:50
Adam Jasinski added 2 commits June 19, 2023 21:58
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
Copy link
Contributor

@dataclouder dataclouder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First pass

.changes/v2.21.0/577-features.md Outdated Show resolved Hide resolved
govcd/api_token_test.go Outdated Show resolved Hide resolved
govcd/service_account.go Show resolved Hide resolved
govcd/service_account.go Show resolved Hide resolved
govcd/service_account.go Outdated Show resolved Hide resolved
govcd/service_account_test.go Outdated Show resolved Hide resolved
Adam Jasinski added 4 commits June 21, 2023 12:47
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
Copy link
Collaborator

@Didainius Didainius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A quick scan with a few notes. I will get back for a more in depth review.

types/v56/types.go Show resolved Hide resolved
govcd/api_token.go Show resolved Hide resolved
Adam Jasinski added 2 commits June 22, 2023 16:34
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
Copy link
Collaborator

@Didainius Didainius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for it - I have left improvement comments inline

govcd/api_token.go Outdated Show resolved Hide resolved
govcd/api_token.go Outdated Show resolved Hide resolved
govcd/api_token.go Outdated Show resolved Hide resolved
govcd/api_token.go Outdated Show resolved Hide resolved
govcd/service_account.go Outdated Show resolved Hide resolved
govcd/api_token.go Outdated Show resolved Hide resolved
govcd/api_token.go Outdated Show resolved Hide resolved
govcd/api_token.go Outdated Show resolved Hide resolved
govcd/api_token.go Outdated Show resolved Hide resolved
govcd/api_token.go Outdated Show resolved Hide resolved
Adam Jasinski added 5 commits June 28, 2023 14:51
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
…coded

Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
Copy link
Collaborator

@Didainius Didainius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for all these fixes. I am actually good now - the only remaining comment from is to see if we could use OpenApiPostItem instead of OpenApiPostUrlEncoded as they look to be very very similar (see my comment inline). Not insisting on that if it doesn't feel like a good approach.

govcd/openapi.go Outdated Show resolved Hide resolved
govcd/openapi.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@adambarreiro adambarreiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, approved.

.changes/v2.21.0/577-features.md Outdated Show resolved Hide resolved
govcd/api_token.go Outdated Show resolved Hide resolved
govcd/api_token.go Show resolved Hide resolved
govcd/api_token_test.go Show resolved Hide resolved
govcd/service_account.go Show resolved Hide resolved
govcd/service_account.go Outdated Show resolved Hide resolved
Adam Jasinski added 4 commits July 2, 2023 21:00
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
@adezxc adezxc requested a review from dataclouder July 3, 2023 11:20
Signed-off-by: Adam Jasinski <jasinskia@vmware.com>
@adezxc adezxc merged commit e160052 into vmware:main Jul 12, 2023
@adezxc adezxc deleted the api-tokens branch July 12, 2023 13:43
@adezxc adezxc restored the api-tokens branch July 12, 2023 13:43
@adezxc adezxc deleted the api-tokens branch July 12, 2023 13:43
@adezxc adezxc restored the api-tokens branch July 12, 2023 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants