mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user