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/14 create a launchpadtile #26

Merged
merged 8 commits into from
Oct 17, 2023

Conversation

maikelpoot
Copy link
Collaborator

This PR will add the ability to create LaunchPadTiles

grp, _ := client.Groups.GetByUUID(uuid.MustParse("00000000-0000-0000-0000-000000000000"))
vr, _ := client.Vaults.GetByUUID(grp, uuid.MustParse("00000000-0000-0000-0000-000000000000"), nil)
app, _ := client.ClientApplications.GetByUUID(uuid.MustParse("00000000-0000-0000-0000-000000000000"))

recordTile := model.NewVaultRecordLaunchPadTile(vr)
manualTile := model.NewManualLaunchPadTile("title", "https://localhost", grp)
applicationTile := model.NewApplicationLaunchPadTile("https://localhost22", app)

result, err := client.LaunchPadTile.Create(recordTile)
if err != nil {
  var apiError model.KeyhubApiError
  if errors.As(err, &apiError) {
	  fmt.Println("ErrorReport: ", strings.Join(apiError.Report.StackTrace, "\n"))
  } else {
	  fmt.Println("Error: ", err.Error())
  }
}

# Delete launchpad tile
error := client.LaunchPadTile.DeleteById(result.Self().ID)


# No query params
list,error := client.LaunchPadTile.List(nil)

# Query by Group Id
queryParams := model.LaunchPadTileQueryParams{Group: grp.Self().ID, Additional: model.LaunchPadTileAdditionalQueryParams{Audit: true}}
_,_ := client.LaunchPadTile.List(&queryParams)

# Query by one or more VaultRecord
queryParams = model.LaunchPadTileQueryParams{VaultRecord: vr.Self().ID}
_,_ := client.LaunchPadTile.List(&queryParams)

# Query by more VaultRecord
queryParams = model.LaunchPadTileQueryParams{VaultRecords: []int64{vr.Self().ID, vr.Self().ID}}
_,_ := client.LaunchPadTile.List(&queryParams)


# Query by title exact match
queryParams = model.LaunchPadTileQueryParams{Title: "Launchpad Item"}
_,_ := client.LaunchPadTile.List(&queryParams)

@maikelpoot maikelpoot merged commit 0b64ad7 into master Oct 17, 2023
1 check passed
@maikelpoot maikelpoot deleted the feature/14_create_a_launchpadtile branch October 17, 2023 09:43
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