@@ -27,41 +27,28 @@ func newCASBackendUpdateAWSS3Cmd() *cobra.Command {
2727 Use : "aws-s3" ,
2828 Short : "Update a AWS S3 CAS Backend description, credentials or default status" ,
2929 RunE : func (cmd * cobra.Command , args []string ) error {
30- // If we are setting the default, we list existing CAS backends
31- // and ask the user to confirm the rewrite
32- isDefault , err := cmd .Flags ().GetBool ("default" )
33- cobra .CheckErr (err )
34-
35- description , err := cmd .Flags ().GetString ("description" )
36- cobra .CheckErr (err )
30+ // capture flags only when explicitly set
31+ if err := captureUpdateFlags (cmd ); err != nil {
32+ return err
33+ }
3734
38- // If we are overriding the default we ask for confirmation
39- if isDefault {
40- if confirmed , err := confirmDefaultCASBackendOverride (actionOpts , backendName ); err != nil {
41- return err
42- } else if ! confirmed {
43- log .Info ("Aborting..." )
44- return nil
45- }
46- } else {
47- // If we are removing the default we ask for confirmation too
48- if confirmed , err := confirmDefaultCASBackendUnset (backendName , "You are setting the default CAS backend to false" , actionOpts ); err != nil {
49- return err
50- } else if ! confirmed {
51- log .Info ("Aborting..." )
52- return nil
53- }
35+ // If we are overriding/unsetting the default we ask for confirmation
36+ if ok , err := handleDefaultUpdateConfirmation (actionOpts , backendName ); err != nil {
37+ return err
38+ } else if ! ok {
39+ log .Info ("Aborting..." )
40+ return nil
5441 }
5542
5643 opts := & action.NewCASBackendUpdateOpts {
5744 Name : backendName ,
58- Description : description ,
45+ Description : descriptionCASBackendUpdateOption ,
5946 Credentials : map [string ]any {
6047 "accessKeyID" : accessKeyID ,
6148 "secretAccessKey" : secretAccessKey ,
6249 "region" : region ,
6350 },
64- Default : isDefault ,
51+ Default : isDefaultCASBackendUpdateOption ,
6552 }
6653
6754 // this means that we are not updating credentials
0 commit comments