rename versioning to version (#3345)
This commit is contained in:
@@ -30,8 +30,8 @@ policy manage anonymous access to buckets and objects
|
||||
tag manage tags for bucket(s) and object(s)
|
||||
lock manage default bucket object lock configuration
|
||||
ilm manage bucket lifecycle
|
||||
versioning manage bucket versioning
|
||||
replicate manage bucket replication
|
||||
version manage bucket versioning
|
||||
replicate configure server side bucket replication
|
||||
admin manage MinIO servers
|
||||
update update mc to latest release
|
||||
```
|
||||
|
||||
@@ -266,9 +266,9 @@ var completeCmds = map[string]complete.Predictor{
|
||||
"/tag/remove": s3Completer,
|
||||
"/tag/set": s3Completer,
|
||||
|
||||
"/versioning/info": s3Complete{deepLevel: 2},
|
||||
"/versioning/enable": s3Complete{deepLevel: 2},
|
||||
"/versioning/suspend": s3Complete{deepLevel: 2},
|
||||
"/version/info": s3Complete{deepLevel: 2},
|
||||
"/version/enable": s3Complete{deepLevel: 2},
|
||||
"/version/suspend": s3Complete{deepLevel: 2},
|
||||
|
||||
"/lock/compliance": s3Completer,
|
||||
"/lock/governance": s3Completer,
|
||||
|
||||
+6
-6
@@ -1130,18 +1130,18 @@ func (f *fsClient) SetLifecycle(ctx context.Context, _ *lifecycle.Configuration)
|
||||
})
|
||||
}
|
||||
|
||||
// Get versioning info for a bucket, not implemented.
|
||||
func (f *fsClient) GetVersioning(ctx context.Context) (minio.BucketVersioningConfiguration, *probe.Error) {
|
||||
// Get version info for a bucket, not implemented.
|
||||
func (f *fsClient) GetVersion(ctx context.Context) (minio.BucketVersioningConfiguration, *probe.Error) {
|
||||
return minio.BucketVersioningConfiguration{}, probe.NewError(APINotImplemented{
|
||||
API: "GetVersioning",
|
||||
API: "GetVersion",
|
||||
APIType: "filesystem",
|
||||
})
|
||||
}
|
||||
|
||||
// SetVersioning - Set versioning configuration on a bucket, not implemented
|
||||
func (f *fsClient) SetVersioning(ctx context.Context, status string) *probe.Error {
|
||||
// SetVersion - Set version configuration on a bucket, not implemented
|
||||
func (f *fsClient) SetVersion(ctx context.Context, status string) *probe.Error {
|
||||
return probe.NewError(APINotImplemented{
|
||||
API: "SetVersioning",
|
||||
API: "SetVersion",
|
||||
APIType: "filesystem",
|
||||
})
|
||||
}
|
||||
|
||||
+4
-4
@@ -2393,8 +2393,8 @@ func (c *S3Client) SetLifecycle(ctx context.Context, config *lifecycle.Configura
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetVersioning - gets bucket versioning info.
|
||||
func (c *S3Client) GetVersioning(ctx context.Context) (config minio.BucketVersioningConfiguration, err *probe.Error) {
|
||||
// GetVersion - gets bucket version info.
|
||||
func (c *S3Client) GetVersion(ctx context.Context) (config minio.BucketVersioningConfiguration, err *probe.Error) {
|
||||
bucket, _ := c.url2BucketAndObject()
|
||||
if bucket == "" {
|
||||
return config, probe.NewError(BucketNameEmpty{})
|
||||
@@ -2408,8 +2408,8 @@ func (c *S3Client) GetVersioning(ctx context.Context) (config minio.BucketVersio
|
||||
return config, nil
|
||||
}
|
||||
|
||||
// SetVersioning - Set versioning configuration on a bucket
|
||||
func (c *S3Client) SetVersioning(ctx context.Context, status string) *probe.Error {
|
||||
// SetVersion - Set version configuration on a bucket
|
||||
func (c *S3Client) SetVersion(ctx context.Context, status string) *probe.Error {
|
||||
bucket, _ := c.url2BucketAndObject()
|
||||
if bucket == "" {
|
||||
return probe.NewError(BucketNameEmpty{})
|
||||
|
||||
+2
-2
@@ -137,8 +137,8 @@ type Client interface {
|
||||
SetLifecycle(ctx context.Context, config *lifecycle.Configuration) *probe.Error
|
||||
|
||||
// Versioning operations
|
||||
GetVersioning(ctx context.Context) (minio.BucketVersioningConfiguration, *probe.Error)
|
||||
SetVersioning(ctx context.Context, status string) *probe.Error
|
||||
GetVersion(ctx context.Context) (minio.BucketVersioningConfiguration, *probe.Error)
|
||||
SetVersion(ctx context.Context, status string) *probe.Error
|
||||
// Replication operations
|
||||
GetReplication(ctx context.Context) (replication.Config, *probe.Error)
|
||||
SetReplication(ctx context.Context, cfg *replication.Config, opts replication.Options) *probe.Error
|
||||
|
||||
+1
-1
@@ -339,7 +339,7 @@ var appCmds = []cli.Command{
|
||||
legalHoldCmd,
|
||||
diffCmd,
|
||||
rmCmd,
|
||||
versioningCmd,
|
||||
versionCmd,
|
||||
bucketLockCmd,
|
||||
bucketILMCmd,
|
||||
encryptCmd,
|
||||
|
||||
@@ -20,7 +20,7 @@ import "github.com/minio/cli"
|
||||
|
||||
var replicateCmd = cli.Command{
|
||||
Name: "replicate",
|
||||
Usage: "manage bucket server side replication",
|
||||
Usage: "configure server side bucket replication",
|
||||
HideHelpCommand: true,
|
||||
Action: mainReplicate,
|
||||
Before: setGlobalsFromContext,
|
||||
|
||||
@@ -27,10 +27,10 @@ import (
|
||||
"github.com/minio/minio/pkg/console"
|
||||
)
|
||||
|
||||
var versioningEnableCmd = cli.Command{
|
||||
var versionEnableCmd = cli.Command{
|
||||
Name: "enable",
|
||||
Usage: "Enable bucket versioning",
|
||||
Action: mainVersioningEnable,
|
||||
Action: mainVersionEnable,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: globalFlags,
|
||||
CustomHelpTemplate: `NAME:
|
||||
@@ -47,8 +47,8 @@ EXAMPLES:
|
||||
`,
|
||||
}
|
||||
|
||||
// checkVersioningEnableSyntax - validate all the passed arguments
|
||||
func checkVersioningEnableSyntax(ctx *cli.Context) {
|
||||
// checkVersionEnableSyntax - validate all the passed arguments
|
||||
func checkVersionEnableSyntax(ctx *cli.Context) {
|
||||
if len(ctx.Args()) != 1 {
|
||||
cli.ShowCommandHelpAndExit(ctx, "enable", 1) // last argument is exit code
|
||||
}
|
||||
@@ -75,13 +75,13 @@ func (v versionEnableMessage) String() string {
|
||||
return console.Colorize("versionEnableMessage", fmt.Sprintf("%s versioning is enabled", v.URL))
|
||||
}
|
||||
|
||||
func mainVersioningEnable(cliCtx *cli.Context) error {
|
||||
ctx, cancelVersioningEnable := context.WithCancel(globalContext)
|
||||
defer cancelVersioningEnable()
|
||||
func mainVersionEnable(cliCtx *cli.Context) error {
|
||||
ctx, cancelVersionEnable := context.WithCancel(globalContext)
|
||||
defer cancelVersionEnable()
|
||||
|
||||
console.SetColor("versionEnableMessage", color.New(color.FgGreen))
|
||||
|
||||
checkVersioningEnableSyntax(cliCtx)
|
||||
checkVersionEnableSyntax(cliCtx)
|
||||
|
||||
// Get the alias parameter from cli
|
||||
args := cliCtx.Args()
|
||||
@@ -89,7 +89,7 @@ func mainVersioningEnable(cliCtx *cli.Context) error {
|
||||
// Create a new Client
|
||||
client, err := newClient(aliasedURL)
|
||||
fatalIf(err, "Unable to initialize connection.")
|
||||
fatalIf(client.SetVersioning(ctx, "enable"), "Cannot enable versioning")
|
||||
fatalIf(client.SetVersion(ctx, "enable"), "Cannot enable versioning")
|
||||
printMsg(versionEnableMessage{
|
||||
Op: "enable",
|
||||
Status: "success",
|
||||
@@ -28,10 +28,10 @@ import (
|
||||
"github.com/minio/minio/pkg/console"
|
||||
)
|
||||
|
||||
var versioningInfoCmd = cli.Command{
|
||||
var versionInfoCmd = cli.Command{
|
||||
Name: "info",
|
||||
Usage: "Show bucket versioning status",
|
||||
Action: mainVersioningInfo,
|
||||
Action: mainVersionInfo,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: globalFlags,
|
||||
CustomHelpTemplate: `NAME:
|
||||
@@ -49,8 +49,8 @@ EXAMPLES:
|
||||
`,
|
||||
}
|
||||
|
||||
// checkVersioningInfoSyntax - validate all the passed arguments
|
||||
func checkVersioningInfoSyntax(ctx *cli.Context) {
|
||||
// checkVersionInfoSyntax - validate all the passed arguments
|
||||
func checkVersionInfoSyntax(ctx *cli.Context) {
|
||||
if len(ctx.Args()) != 1 {
|
||||
cli.ShowCommandHelpAndExit(ctx, "info", 1) // last argument is exit code
|
||||
}
|
||||
@@ -77,20 +77,20 @@ func (v versioningInfoMessage) String() string {
|
||||
msg := ""
|
||||
switch v.Versioning.Status {
|
||||
case "":
|
||||
msg = fmt.Sprintf("%s is un-versioninged", v.URL)
|
||||
msg = fmt.Sprintf("%s is un-versioned", v.URL)
|
||||
default:
|
||||
msg = fmt.Sprintf("%s versioning status is %s", v.URL, strings.ToLower(v.Versioning.Status))
|
||||
}
|
||||
return console.Colorize("versioningInfoMessage", msg)
|
||||
}
|
||||
|
||||
func mainVersioningInfo(cliCtx *cli.Context) error {
|
||||
func mainVersionInfo(cliCtx *cli.Context) error {
|
||||
ctx, cancelVersioningInfo := context.WithCancel(globalContext)
|
||||
defer cancelVersioningInfo()
|
||||
|
||||
console.SetColor("versioningInfoMessage", color.New(color.FgGreen))
|
||||
|
||||
checkVersioningInfoSyntax(cliCtx)
|
||||
checkVersionInfoSyntax(cliCtx)
|
||||
|
||||
// Get the alias parameter from cli
|
||||
args := cliCtx.Args()
|
||||
@@ -98,7 +98,7 @@ func mainVersioningInfo(cliCtx *cli.Context) error {
|
||||
// Create a new Client
|
||||
client, err := newClient(aliasedURL)
|
||||
fatalIf(err, "Unable to initialize connection.")
|
||||
vConfig, e := client.GetVersioning(ctx)
|
||||
vConfig, e := client.GetVersion(ctx)
|
||||
fatalIf(e, "Cannot get versioning info")
|
||||
vMsg := versioningInfoMessage{
|
||||
Op: "info",
|
||||
@@ -18,22 +18,22 @@ package cmd
|
||||
|
||||
import "github.com/minio/cli"
|
||||
|
||||
var versioningCmd = cli.Command{
|
||||
Name: "versioning",
|
||||
var versionCmd = cli.Command{
|
||||
Name: "version",
|
||||
Usage: "manage bucket versioning",
|
||||
HideHelpCommand: true,
|
||||
Action: mainVersioning,
|
||||
Action: mainVersion,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: globalFlags,
|
||||
Subcommands: []cli.Command{
|
||||
versioningEnableCmd,
|
||||
versioningSuspendCmd,
|
||||
versioningInfoCmd,
|
||||
versionEnableCmd,
|
||||
versionSuspendCmd,
|
||||
versionInfoCmd,
|
||||
},
|
||||
}
|
||||
|
||||
// mainVersioning is the handle for "mc versioning" command.
|
||||
func mainVersioning(ctx *cli.Context) error {
|
||||
// mainVersion is the handle for "mc version" command.
|
||||
func mainVersion(ctx *cli.Context) error {
|
||||
cli.ShowCommandHelp(ctx, ctx.Args().First())
|
||||
return nil
|
||||
// Sub-commands like "info", "enable", "suspend" have their own main.
|
||||
@@ -27,10 +27,10 @@ import (
|
||||
"github.com/minio/minio/pkg/console"
|
||||
)
|
||||
|
||||
var versioningSuspendCmd = cli.Command{
|
||||
var versionSuspendCmd = cli.Command{
|
||||
Name: "suspend",
|
||||
Usage: "Suspend bucket versioning",
|
||||
Action: mainVersioningSuspend,
|
||||
Action: mainVersionSuspend,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: globalFlags,
|
||||
CustomHelpTemplate: `NAME:
|
||||
@@ -47,8 +47,8 @@ EXAMPLES:
|
||||
`,
|
||||
}
|
||||
|
||||
// checkVersioningSuspendSyntax - validate all the passed arguments
|
||||
func checkVersioningSuspendSyntax(ctx *cli.Context) {
|
||||
// checkVersionSuspendSyntax - validate all the passed arguments
|
||||
func checkVersionSuspendSyntax(ctx *cli.Context) {
|
||||
if len(ctx.Args()) != 1 {
|
||||
cli.ShowCommandHelpAndExit(ctx, "suspend", 1) // last argument is exit code
|
||||
}
|
||||
@@ -75,13 +75,13 @@ func (v versionSuspendMessage) String() string {
|
||||
return console.Colorize("versionSuspendMessage", fmt.Sprintf("%s versioning is suspended", v.URL))
|
||||
}
|
||||
|
||||
func mainVersioningSuspend(cliCtx *cli.Context) error {
|
||||
ctx, cancelVersioningSuspend := context.WithCancel(globalContext)
|
||||
defer cancelVersioningSuspend()
|
||||
func mainVersionSuspend(cliCtx *cli.Context) error {
|
||||
ctx, cancelVersionSuspend := context.WithCancel(globalContext)
|
||||
defer cancelVersionSuspend()
|
||||
|
||||
console.SetColor("versionSuspendMessage", color.New(color.FgGreen))
|
||||
|
||||
checkVersioningSuspendSyntax(cliCtx)
|
||||
checkVersionSuspendSyntax(cliCtx)
|
||||
|
||||
// Get the alias parameter from cli
|
||||
args := cliCtx.Args()
|
||||
@@ -89,7 +89,7 @@ func mainVersioningSuspend(cliCtx *cli.Context) error {
|
||||
// Create a new Client
|
||||
client, err := newClient(aliasedURL)
|
||||
fatalIf(err, "Unable to initialize connection.")
|
||||
fatalIf(client.SetVersioning(ctx, "suspend"), "Cannot suspend versioning")
|
||||
fatalIf(client.SetVersion(ctx, "suspend"), "Cannot suspend versioning")
|
||||
printMsg(versionSuspendMessage{
|
||||
Op: "suspend",
|
||||
Status: "success",
|
||||
@@ -23,7 +23,7 @@ retention set retention for object(s)
|
||||
legalhold set legal hold for object(s)
|
||||
diff list differences in object name, size, and date between two buckets
|
||||
rm remove objects
|
||||
versioning manage bucket versioning
|
||||
version manage bucket versioning
|
||||
lock manage default bucket object lock configuration
|
||||
ilm manage bucket lifecycle
|
||||
encrypt manage bucket encryption config
|
||||
@@ -31,7 +31,7 @@ event manage object notifications
|
||||
watch listen for object notification events
|
||||
policy manage anonymous access to buckets and objects
|
||||
tag manage tags for bucket(s) and object(s)
|
||||
replicate manage bucket server side replication
|
||||
replicate configure server side bucket replication
|
||||
admin manage MinIO servers
|
||||
update update mc to latest release
|
||||
```
|
||||
@@ -1504,16 +1504,16 @@ Metadata :
|
||||
Content-Type: application/octet-stream
|
||||
```
|
||||
|
||||
<a name="versioning"></a>
|
||||
### Command `versioning`
|
||||
`versioning` manage bucket versioning
|
||||
<a name="version"></a>
|
||||
### Command `version`
|
||||
`version` manage bucket versioning
|
||||
|
||||
```
|
||||
NAME:
|
||||
mc versioning - manage bucket versioning
|
||||
mc version - manage bucket versioning
|
||||
|
||||
USAGE:
|
||||
mc versioning TARGET [enable | suspend | info]
|
||||
mc version TARGET [enable | suspend | info]
|
||||
|
||||
COMMANDS:
|
||||
enable Enable bucket versioning
|
||||
@@ -1524,20 +1524,20 @@ COMMANDS:
|
||||
*Example: Enable versioning on bucket `mybucket`*
|
||||
|
||||
```
|
||||
mc versioning enable myminio/mybucket
|
||||
mc version enable myminio/mybucket
|
||||
myminio/mybucket versioning is enabled
|
||||
```
|
||||
|
||||
*Example: Display the versioning configuration for bucket `mybucket`*
|
||||
*Example: Display the version configuration for bucket `mybucket`*
|
||||
|
||||
```
|
||||
mc versioning info myminio/mybucket
|
||||
mc version info myminio/mybucket
|
||||
myminio/mybucket versioning status is enabled
|
||||
|
||||
```
|
||||
*Example: Suspend versioning for bucket `mybucket`*
|
||||
```
|
||||
mc versioning suspend myminio/mybucket
|
||||
mc version suspend myminio/mybucket
|
||||
myminio/mybucket versioning is suspended
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user