configure

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ConfigureCmd = &cobra.Command{
		Use:          "configure",
		Short:        "configure subcommand configures the bucket level settings",
		SilenceUsage: true,
		PreRunE: func(cmd *cobra.Command, args []string) (err error) {
			rootOpts := cmd.Context().Value(rootopts.OptsKey{}).(*rootopts.RootOptions)
			svc = cmd.Context().Value(rootopts.S3SvcKey{}).(*s3.S3)

			configureOpts.RootOptions = rootOpts
			logger = logging.GetLogger(rootOpts)

			return nil
		},
		RunE: func(cmd *cobra.Command, args []string) (err error) {
			versioning, err := aws.GetBucketVersioning(svc, configureOpts)
			if err != nil {
				return err
			}

			if *versioning.Status == "Enabled" && configureOpts.Versioning || *versioning.Status == "Suspended" && !configureOpts.Versioning {
				logger.Info().
					Str("state", *versioning.Status).
					Msg("versioning is already at the desired state, skipping")
				return nil
			}

			logger.Info().Msgf("setting versioning as %v", configureOpts.Versioning)
			_, err = aws.SetBucketVersioning(svc, configureOpts, configureOpts.Versioning)
			if err != nil {
				return err
			}

			return nil
		},
	}
)

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL