diff --git a/cmd/agent/pause.go b/cmd/agent/pause.go index 12a2d71c..e222cfeb 100644 --- a/cmd/agent/pause.go +++ b/cmd/agent/pause.go @@ -12,7 +12,7 @@ import ( ) type PauseCmd struct { - AgentID string `arg:"" help:"Agent ID to pause"` + AgentID string `arg:"" help:"Agent UUID to pause"` Note string `help:"A descriptive note to record why the agent is paused"` TimeoutInMinutes int `help:"Timeout after which the agent is automatically resumed, in minutes" default:"5"` } diff --git a/cmd/agent/resume.go b/cmd/agent/resume.go index 7e04f0a6..5e61027b 100644 --- a/cmd/agent/resume.go +++ b/cmd/agent/resume.go @@ -11,7 +11,7 @@ import ( ) type ResumeCmd struct { - AgentID string `arg:"" help:"Agent ID to resume"` + AgentID string `arg:"" help:"Agent UUID to resume"` } func (c *ResumeCmd) Help() string { diff --git a/cmd/cluster/cluster_test.go b/cmd/cluster/cluster_test.go index 233695d5..21411dbe 100644 --- a/cmd/cluster/cluster_test.go +++ b/cmd/cluster/cluster_test.go @@ -361,8 +361,8 @@ func TestUpdateCmdValidate(t *testing.T) { wantErr: false, }, { - name: "only default-queue-id", - cmd: UpdateCmd{ClusterUUID: "cluster-1", DefaultQueueID: "queue-123"}, + name: "only default-queue-uuid", + cmd: UpdateCmd{ClusterUUID: "cluster-1", DefaultQueueUUID: "queue-123"}, wantErr: false, }, { diff --git a/cmd/cluster/update.go b/cmd/cluster/update.go index 58480983..4335968d 100644 --- a/cmd/cluster/update.go +++ b/cmd/cluster/update.go @@ -17,12 +17,12 @@ import ( ) type UpdateCmd struct { - ClusterUUID string `arg:"" help:"Cluster UUID to update" name:"cluster-uuid"` - Name string `help:"New name for the cluster" optional:""` - Description string `help:"New description for the cluster" optional:""` - Emoji string `help:"New emoji for the cluster (e.g. :rocket:)" optional:""` - Color string `help:"New color hex code for the cluster (e.g. #FF0000)" optional:""` - DefaultQueueID string `help:"UUID of the queue to set as the default" optional:"" name:"default-queue-id"` + ClusterUUID string `arg:"" help:"Cluster UUID to update" name:"cluster-uuid"` + Name string `help:"New name for the cluster" optional:""` + Description string `help:"New description for the cluster" optional:""` + Emoji string `help:"New emoji for the cluster (e.g. :rocket:)" optional:""` + Color string `help:"New color hex code for the cluster (e.g. #FF0000)" optional:""` + DefaultQueueUUID string `help:"UUID of the queue to set as the default" optional:"" name:"default-queue-uuid" aliases:"default-queue-id"` output.OutputFlags } @@ -30,7 +30,7 @@ func (c *UpdateCmd) Help() string { return ` Update a cluster's settings. -At least one of --name, --description, --emoji, --color, or --default-queue-id must be provided. +At least one of --name, --description, --emoji, --color, or --default-queue-uuid must be provided. Examples: # Update a cluster's name @@ -40,7 +40,7 @@ Examples: $ bk cluster update my-cluster-uuid --description "Updated description" --color "#00FF00" # Set the default queue - $ bk cluster update my-cluster-uuid --default-queue-id my-queue-uuid + $ bk cluster update my-cluster-uuid --default-queue-uuid my-queue-uuid # Output the updated cluster as JSON $ bk cluster update my-cluster-uuid --name "New Name" -o json @@ -48,8 +48,8 @@ Examples: } func (c *UpdateCmd) Validate() error { - if c.Name == "" && c.Description == "" && c.Emoji == "" && c.Color == "" && c.DefaultQueueID == "" { - return fmt.Errorf("at least one of --name, --description, --emoji, --color, or --default-queue-id must be provided") + if c.Name == "" && c.Description == "" && c.Emoji == "" && c.Color == "" && c.DefaultQueueUUID == "" { + return fmt.Errorf("at least one of --name, --description, --emoji, --color, or --default-queue-uuid must be provided") } return nil } @@ -79,7 +79,7 @@ func (c *UpdateCmd) Run(kongCtx *kong.Context, globals cli.GlobalFlags) error { Description: c.Description, Emoji: c.Emoji, Color: c.Color, - DefaultQueueID: c.DefaultQueueID, + DefaultQueueID: c.DefaultQueueUUID, } var cluster buildkite.Cluster diff --git a/cmd/job/cancel.go b/cmd/job/cancel.go index 6dfbace3..28f96328 100644 --- a/cmd/job/cancel.go +++ b/cmd/job/cancel.go @@ -14,7 +14,7 @@ import ( ) type CancelCmd struct { - JobID string `arg:"" help:"Job ID to cancel" required:""` + JobID string `arg:"" help:"Job UUID to cancel" required:""` Web bool `help:"Open the job in a web browser after it has been cancelled" short:"w"` } diff --git a/cmd/secret/delete.go b/cmd/secret/delete.go index 0e1672d9..e62f9f18 100644 --- a/cmd/secret/delete.go +++ b/cmd/secret/delete.go @@ -16,7 +16,7 @@ import ( type DeleteCmd struct { ClusterUUID string `help:"The UUID of the cluster" required:"" name:"cluster-uuid"` - SecretID string `help:"The UUID of the secret to delete" required:"" name:"secret-id"` + SecretUUID string `help:"The UUID of the secret to delete" required:"" name:"secret-uuid" aliases:"secret-id"` } func (c *DeleteCmd) Help() string { @@ -27,10 +27,10 @@ You will be prompted to confirm deletion unless --yes is set. Examples: # Delete a secret (with confirmation prompt) - $ bk secret delete --cluster-uuid my-cluster-uuid --secret-id my-secret-id + $ bk secret delete --cluster-uuid my-cluster-uuid --secret-uuid my-secret-uuid # Delete a secret without confirmation - $ bk secret delete --cluster-uuid my-cluster-uuid --secret-id my-secret-id --yes + $ bk secret delete --cluster-uuid my-cluster-uuid --secret-uuid my-secret-uuid --yes ` } @@ -51,7 +51,7 @@ func (c *DeleteCmd) Run(kongCtx *kong.Context, globals cli.GlobalFlags) error { ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM) defer stop() - confirmed, err := bkIO.Confirm(f, fmt.Sprintf("Are you sure you want to delete secret %s?", c.SecretID)) + confirmed, err := bkIO.Confirm(f, fmt.Sprintf("Are you sure you want to delete secret %s?", c.SecretUUID)) if err != nil { return err } @@ -61,7 +61,7 @@ func (c *DeleteCmd) Run(kongCtx *kong.Context, globals cli.GlobalFlags) error { } if err = bkIO.SpinWhile(f, "Deleting secret", func() error { - _, err = f.RestAPIClient.ClusterSecrets.Delete(ctx, f.Config.OrganizationSlug(), c.ClusterUUID, c.SecretID) + _, err = f.RestAPIClient.ClusterSecrets.Delete(ctx, f.Config.OrganizationSlug(), c.ClusterUUID, c.SecretUUID) return err }); err != nil { return fmt.Errorf("error deleting secret: %v", err) diff --git a/cmd/secret/get.go b/cmd/secret/get.go index e7948a38..e6b51aa7 100644 --- a/cmd/secret/get.go +++ b/cmd/secret/get.go @@ -20,7 +20,7 @@ import ( type GetCmd struct { ClusterUUID string `help:"The UUID of the cluster" required:"" name:"cluster-uuid"` - SecretID string `help:"The UUID of the secret to view" required:"" name:"secret-id"` + SecretUUID string `help:"The UUID of the secret to view" required:"" name:"secret-uuid" aliases:"secret-id"` output.OutputFlags } @@ -30,10 +30,10 @@ View details of a cluster secret. Examples: # View a secret - $ bk secret get --cluster-uuid my-cluster-uuid --secret-id my-secret-id + $ bk secret get --cluster-uuid my-cluster-uuid --secret-uuid my-secret-uuid # View a secret in JSON format - $ bk secret get --cluster-uuid my-cluster-uuid --secret-id my-secret-id -o json + $ bk secret get --cluster-uuid my-cluster-uuid --secret-uuid my-secret-uuid -o json ` } @@ -60,7 +60,7 @@ func (c *GetCmd) Run(kongCtx *kong.Context, globals cli.GlobalFlags) error { var secret buildkite.ClusterSecret if err = bkIO.SpinWhile(f, "Loading secret", func() error { var apiErr error - secret, _, apiErr = f.RestAPIClient.ClusterSecrets.Get(ctx, f.Config.OrganizationSlug(), c.ClusterUUID, c.SecretID) + secret, _, apiErr = f.RestAPIClient.ClusterSecrets.Get(ctx, f.Config.OrganizationSlug(), c.ClusterUUID, c.SecretUUID) return apiErr }); err != nil { return fmt.Errorf("error fetching secret: %v", err) diff --git a/cmd/secret/secret_test.go b/cmd/secret/secret_test.go index 648f10fe..6d361152 100644 --- a/cmd/secret/secret_test.go +++ b/cmd/secret/secret_test.go @@ -307,27 +307,27 @@ func TestUpdateCmdValidate(t *testing.T) { }{ { name: "no flags set", - cmd: UpdateCmd{ClusterUUID: "c", SecretID: "s"}, + cmd: UpdateCmd{ClusterUUID: "c", SecretUUID: "s"}, wantErr: true, }, { name: "only description", - cmd: UpdateCmd{ClusterUUID: "c", SecretID: "s", Description: "new desc"}, + cmd: UpdateCmd{ClusterUUID: "c", SecretUUID: "s", Description: "new desc"}, wantErr: false, }, { name: "only policy", - cmd: UpdateCmd{ClusterUUID: "c", SecretID: "s", Policy: "new policy"}, + cmd: UpdateCmd{ClusterUUID: "c", SecretUUID: "s", Policy: "new policy"}, wantErr: false, }, { name: "only update-value", - cmd: UpdateCmd{ClusterUUID: "c", SecretID: "s", UpdateValue: true}, + cmd: UpdateCmd{ClusterUUID: "c", SecretUUID: "s", UpdateValue: true}, wantErr: false, }, { name: "description and update-value", - cmd: UpdateCmd{ClusterUUID: "c", SecretID: "s", Description: "desc", UpdateValue: true}, + cmd: UpdateCmd{ClusterUUID: "c", SecretUUID: "s", Description: "desc", UpdateValue: true}, wantErr: false, }, } diff --git a/cmd/secret/update.go b/cmd/secret/update.go index bea59944..42c1ffd8 100644 --- a/cmd/secret/update.go +++ b/cmd/secret/update.go @@ -18,7 +18,7 @@ import ( type UpdateCmd struct { ClusterUUID string `help:"The UUID of the cluster" required:"" name:"cluster-uuid"` - SecretID string `help:"The UUID of the secret to update" required:"" name:"secret-id"` + SecretUUID string `help:"The UUID of the secret to update" required:"" name:"secret-uuid" aliases:"secret-id"` Description string `help:"Update the description of the secret" optional:""` Policy string `help:"Update the access policy for the secret (YAML format)" optional:""` UpdateValue bool `help:"Prompt to update the secret value" optional:"" name:"update-value"` @@ -33,13 +33,13 @@ Use --update-value to be prompted for a new secret value (input will be masked). Examples: # Update a secret's description - $ bk secret update --cluster-uuid my-cluster-uuid --secret-id my-secret-id --description "New description" + $ bk secret update --cluster-uuid my-cluster-uuid --secret-uuid my-secret-uuid --description "New description" # Update a secret's value - $ bk secret update --cluster-uuid my-cluster-uuid --secret-id my-secret-id --update-value + $ bk secret update --cluster-uuid my-cluster-uuid --secret-uuid my-secret-uuid --update-value # Update both description and value - $ bk secret update --cluster-uuid my-cluster-uuid --secret-id my-secret-id --description "New description" --update-value + $ bk secret update --cluster-uuid my-cluster-uuid --secret-uuid my-secret-uuid --description "New description" --update-value ` } @@ -85,7 +85,7 @@ func (c *UpdateCmd) Run(kongCtx *kong.Context, globals cli.GlobalFlags) error { } if err = bkIO.SpinWhile(f, "Updating secret value", func() error { - _, err = f.RestAPIClient.ClusterSecrets.UpdateValue(ctx, org, c.ClusterUUID, c.SecretID, buildkite.ClusterSecretValueUpdate{ + _, err = f.RestAPIClient.ClusterSecrets.UpdateValue(ctx, org, c.ClusterUUID, c.SecretUUID, buildkite.ClusterSecretValueUpdate{ Value: value, }) return err @@ -98,7 +98,7 @@ func (c *UpdateCmd) Run(kongCtx *kong.Context, globals cli.GlobalFlags) error { if c.Description != "" || c.Policy != "" { if err = bkIO.SpinWhile(f, "Updating secret", func() error { var apiErr error - secret, _, apiErr = f.RestAPIClient.ClusterSecrets.Update(ctx, org, c.ClusterUUID, c.SecretID, buildkite.ClusterSecretUpdate{ + secret, _, apiErr = f.RestAPIClient.ClusterSecrets.Update(ctx, org, c.ClusterUUID, c.SecretUUID, buildkite.ClusterSecretUpdate{ Description: c.Description, Policy: c.Policy, }) @@ -110,7 +110,7 @@ func (c *UpdateCmd) Run(kongCtx *kong.Context, globals cli.GlobalFlags) error { // Fetch the secret to display current state if err = bkIO.SpinWhile(f, "Loading secret", func() error { var apiErr error - secret, _, apiErr = f.RestAPIClient.ClusterSecrets.Get(ctx, org, c.ClusterUUID, c.SecretID) + secret, _, apiErr = f.RestAPIClient.ClusterSecrets.Get(ctx, org, c.ClusterUUID, c.SecretUUID) return apiErr }); err != nil { return fmt.Errorf("error fetching secret: %v", err)