diff --git a/go.mod b/go.mod index 736bdc0..a2909f5 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ replace github.com/imdario/mergo => github.com/imdario/mergo v0.3.16 require ( bunnyshell.com/dev v0.7.2 - bunnyshell.com/sdk v0.20.3 + bunnyshell.com/sdk v0.20.4 github.com/AlecAivazis/survey/v2 v2.3.7 github.com/MakeNowJust/heredoc v1.0.0 github.com/avast/retry-go/v4 v4.6.0 diff --git a/go.sum b/go.sum index 8aefd0c..94ecb77 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ bunnyshell.com/dev v0.7.2 h1:fa0ZvnIAXLVJINCJqo7uenjHmjPrlHmY18Zc8ypo/6E= bunnyshell.com/dev v0.7.2/go.mod h1:+Xk46UXX9AW0nHrFMdO/IwpUPfALrck1/qI+LIXsDmE= -bunnyshell.com/sdk v0.20.3 h1:Kd2s/fhkMrn6Jqp9UmnXfNu12Oiwg+hgNSNBOIBYPH8= -bunnyshell.com/sdk v0.20.3/go.mod h1:RfgfUzZ4WHZGCkToUfu2/hoQS6XsQc8IdPTVAlpS138= +bunnyshell.com/sdk v0.20.4 h1:Na2e4xKdtbnZZ/+ACpjzM7fvBFriJWC3bVgNFSmqcJs= +bunnyshell.com/sdk v0.20.4/go.mod h1:RfgfUzZ4WHZGCkToUfu2/hoQS6XsQc8IdPTVAlpS138= github.com/AlecAivazis/survey/v2 v2.3.7 h1:6I/u8FvytdGsgonrYsVn2t8t4QiRnh6QSTqkkhIiSjQ= github.com/AlecAivazis/survey/v2 v2.3.7/go.mod h1:xUTIdE4KCOIjsBAE1JYsUPoCqYdZ1reCfTwbto0Fduo= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= diff --git a/pkg/api/environment/action_delete.go b/pkg/api/environment/action_delete.go index 0628980..7553ba8 100644 --- a/pkg/api/environment/action_delete.go +++ b/pkg/api/environment/action_delete.go @@ -1,6 +1,7 @@ package environment import ( + "github.com/spf13/pflag" "net/http" "bunnyshell.com/cli/pkg/api" @@ -11,14 +12,23 @@ import ( type DeleteOptions struct { common.ActionOptions + + QueueIfSomethingInProgress bool } func NewDeleteOptions(id string) *DeleteOptions { return &DeleteOptions{ - ActionOptions: *common.NewActionOptions(id), + ActionOptions: *common.NewActionOptions(id), + QueueIfSomethingInProgress: false, } } +func (options *DeleteOptions) UpdateFlagSet(flags *pflag.FlagSet) { + options.ActionOptions.UpdateFlagSet(flags) + + //flags.BoolVar(&options.QueueIfSomethingInProgress, "queue", options.QueueIfSomethingInProgress, "Queue the delete pipeline if another operation is in progress now") +} + func Delete(options *DeleteOptions) (*sdk.EventItem, error) { model, resp, err := DeleteRaw(options) if err != nil { diff --git a/pkg/api/environment/action_deploy.go b/pkg/api/environment/action_deploy.go index f29fc8d..3e1222d 100644 --- a/pkg/api/environment/action_deploy.go +++ b/pkg/api/environment/action_deploy.go @@ -11,28 +11,32 @@ import ( ) const ( - IncludedDepdendenciesNone string = "none" - IncludedDepdendenciesAll string = "all" - IncludedDepdendenciesMissing string = "missing" + IncludedDependenciesNone string = "none" + IncludedDependenciesAll string = "all" + IncludedDependenciesMissing string = "missing" ) type DeployOptions struct { common.PartialActionOptions - IncludedDepdendencies string + IncludedDependencies string + + QueueIfSomethingInProgress bool } func NewDeployOptions(id string) *DeployOptions { return &DeployOptions{ - PartialActionOptions: *common.NewPartialActionOptions(id), - IncludedDepdendencies: IncludedDepdendenciesNone, + PartialActionOptions: *common.NewPartialActionOptions(id), + IncludedDependencies: IncludedDependenciesNone, + QueueIfSomethingInProgress: false, } } func (options *DeployOptions) UpdateFlagSet(flags *pflag.FlagSet) { options.PartialActionOptions.UpdateFlagSet(flags) - flags.StringVar(&options.IncludedDepdendencies, "included-dependencies", options.IncludedDepdendencies, "Include dependencies in the deployment (none, all, missing)") + flags.StringVar(&options.IncludedDependencies, "included-dependencies", options.IncludedDependencies, "Include dependencies in the deployment (none, all, missing)") + flags.BoolVar(&options.QueueIfSomethingInProgress, "queue", options.QueueIfSomethingInProgress, "Queue the deploy pipeline if another operation is in progress now") } func Deploy(options *DeployOptions) (*sdk.EventItem, error) { @@ -54,9 +58,10 @@ func DeployRaw(options *DeployOptions) (*sdk.EventItem, *http.Response, error) { request := lib.GetAPIFromProfile(profile).EnvironmentAPI.EnvironmentDeploy(ctx, options.ID). EnvironmentPartialDeployAction(sdk.EnvironmentPartialDeployAction{ - IsPartial: &isPartialAction, - Components: options.GetActionComponents(), - IncludedDependencies: &options.IncludedDepdendencies, + IsPartial: &isPartialAction, + Components: options.GetActionComponents(), + IncludedDependencies: &options.IncludedDependencies, + QueueIfSomethingInProgress: &options.QueueIfSomethingInProgress, }) return request.Execute() diff --git a/pkg/formatter/stylish.go b/pkg/formatter/stylish.go index 9bc650a..6c3f0f0 100644 --- a/pkg/formatter/stylish.go +++ b/pkg/formatter/stylish.go @@ -228,11 +228,12 @@ func tabulateEnvironmentItem(w *tabwriter.Writer, item *sdk.EnvironmentItem) { fmt.Fprintf(w, "%v\t %v\n", "Create Ephemeral On PR", item.GetHasEphemeralCreateOnPr()) fmt.Fprintf(w, "%v\t %v\n", "Destroy Ephemeral On PR Close", item.GetHasEphemeralDestroyOnPrClose()) fmt.Fprintf(w, "%v\t %v\n", "Auto Deploy Ephemeral", item.GetHasEphemeralAutoDeploy()) - fmt.Fprintf(w, "%v\t %v\n", "Termination Protection", item.GetHasTerminationProtection()) - if item.GetHasEphemeralBranchWhitelist() { fmt.Fprintf(w, "%v\t %v\n", "Ephemeral Branch Whitelist", item.GetEphemeralBranchWhitelistRegex()) } + + fmt.Fprintf(w, "%v\t %v\n", "Termination Protection", item.GetHasTerminationProtection()) + fmt.Fprintf(w, "%v\t %v\n", "Auto Update", item.GetHasAutoUpdate()) } }