chore: fix api param name (#20172)

In https://github.com/coder/coder/pull/20137, we added a new flag to
`coder provisioner jobs list`, namely `--initiator`.

To make some follow-up worth it, I need to rename an API param used in
the process before it becomes part of our released and tagged API.

Instead of only accepting UUIDs, we accept an arbitrary string.
We still validate it as a UUID now, but we will expand its validation to
allow any string and then resolve that string the same way that we
resolve the user parameter elsewhere in the API.
This commit is contained in:
Sas Swart
2025-10-06 13:58:37 +02:00
committed by GitHub
parent dd99d40ad6
commit a7c9e623fe
5 changed files with 23 additions and 25 deletions
+4 -6
View File
@@ -66,20 +66,18 @@ func (r *RootCmd) provisionerJobsList() *serpent.Command {
return xerrors.Errorf("current organization: %w", err)
}
var initiatorID *uuid.UUID
if initiator != "" {
user, err := client.User(ctx, initiator)
if err != nil {
return xerrors.Errorf("initiator not found: %s", initiator)
}
initiatorID = &user.ID
initiator = user.ID.String()
}
jobs, err := client.OrganizationProvisionerJobs(ctx, org.ID, &codersdk.OrganizationProvisionerJobsOptions{
Status: slice.StringEnums[codersdk.ProvisionerJobStatus](status),
Limit: int(limit),
InitiatorID: initiatorID,
Status: slice.StringEnums[codersdk.ProvisionerJobStatus](status),
Limit: int(limit),
Initiator: initiator,
})
if err != nil {
return xerrors.Errorf("list provisioner jobs: %w", err)