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

Feature/17 implement service accounts #23

Merged
merged 10 commits into from
Oct 17, 2023

Conversation

maikelpoot
Copy link
Collaborator

@maikelpoot maikelpoot commented Feb 3, 2023

This PR will allow the listing and creation of Services accounts:

List All:

res, _ := client.ServiceAccounts.List()
for _, sa := range res {
	fmt.Println("Service account: ", sa.Name, sa.System.Name, sa.System.Type)
}

Create new

newSA := model.NewServiceAccount()
newSA.Name = "A Service Account"
newSA.Username = "service-account"

newSA.System = provSys
newSA.TechnicalAdministrator = group

tmp, _ := client.ServiceAccounts.Create(newSA)

Update existing

existingSa, _ := client.ServiceAccounts.GetByUUID(uuid.MustParse("00000-00-000"))
existingSa.Name = "Example"
existingSa.Username = "example"

updatedSA, _ := client.ServiceAccounts.Update(existingSa)

Delete

// By Object
existingSa, _ := client.ServiceAccounts.GetByUUID(uuid.MustParse("00000-00-000"))
_ := client.ServiceAccounts.Delete(existingSa)
// By UUID
_ := client.ServiceAccounts.DeleteByUUID(uuid.MustParse("00000-00-000"))
// By ID
_ := client.ServiceAccounts.DeleteByID(1337)

@maikelpoot maikelpoot changed the title Feature/15 implement service accounts Feature/17 implement service accounts Feb 28, 2023
@maikelpoot maikelpoot marked this pull request as ready for review October 17, 2023 09:43
@maikelpoot maikelpoot merged commit 7dad85b into master Oct 17, 2023
1 check passed
@maikelpoot maikelpoot deleted the feature/15_implement_service_accounts branch October 17, 2023 09:48
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.

1 participant