reorganize ILM tier commands (#4385)
This commit is contained in:
@@ -0,0 +1,208 @@
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This file is part of MinIO Object Storage stack
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package cmd
|
||||
|
||||
import "github.com/minio/cli"
|
||||
|
||||
var adminTierDepCmds = []cli.Command{
|
||||
adminTierDepInfoCmd,
|
||||
adminTierDepListCmd,
|
||||
adminTierDepAddCmd,
|
||||
adminTierDepEditCmd,
|
||||
adminTierDepVerifyCmd,
|
||||
adminTierDepRmCmd,
|
||||
}
|
||||
|
||||
var (
|
||||
adminTierDepInfoCmd = cli.Command{
|
||||
Name: "info",
|
||||
Usage: "display tier statistics",
|
||||
Action: mainAdminTierInfo,
|
||||
Hidden: true,
|
||||
OnUsageError: onUsageError,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: globalFlags,
|
||||
CustomHelpTemplate: `NAME:
|
||||
{{.HelpName}} - {{.Usage}}
|
||||
|
||||
USAGE:
|
||||
{{.HelpName}} ALIAS [NAME]
|
||||
|
||||
FLAGS:
|
||||
{{range .VisibleFlags}}{{.}}
|
||||
{{end}}
|
||||
|
||||
EXAMPLES:
|
||||
1. Prints per-tier statistics of all remote tier targets configured on 'myminio':
|
||||
{{.Prompt}} {{.HelpName}} myminio
|
||||
|
||||
2. Print per-tier statistics of given tier name 'MINIOTIER-1':
|
||||
{{.Prompt}} {{.HelpName}} myminio MINIOTIER-1
|
||||
`,
|
||||
}
|
||||
|
||||
adminTierDepListCmd = cli.Command{
|
||||
Name: "ls",
|
||||
Usage: "lists configured remote tier targets",
|
||||
Action: mainAdminTierList,
|
||||
Hidden: true,
|
||||
OnUsageError: onUsageError,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: globalFlags,
|
||||
CustomHelpTemplate: `NAME:
|
||||
{{.HelpName}} - {{.Usage}}
|
||||
|
||||
USAGE:
|
||||
{{.HelpName}} ALIAS
|
||||
|
||||
FLAGS:
|
||||
{{range .VisibleFlags}}{{.}}
|
||||
{{end}}
|
||||
|
||||
EXAMPLES:
|
||||
1. List remote tier targets configured on 'myminio':
|
||||
{{.Prompt}} {{.HelpName}} myminio
|
||||
`,
|
||||
}
|
||||
|
||||
adminTierDepAddCmd = cli.Command{
|
||||
Name: "add",
|
||||
Usage: "add a new remote tier target",
|
||||
Action: mainAdminTierAdd,
|
||||
Hidden: true,
|
||||
OnUsageError: onUsageError,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: append(globalFlags, adminTierAddFlags...),
|
||||
CustomHelpTemplate: `NAME:
|
||||
{{.HelpName}} - {{.Usage}}
|
||||
|
||||
USAGE:
|
||||
{{.HelpName}} TYPE ALIAS NAME [FLAGS]
|
||||
|
||||
TYPE:
|
||||
Type of the cloud storage backend to add. Supported values are minio, s3, azure and gcs.
|
||||
|
||||
NAME:
|
||||
Name of the remote tier target. e.g WARM-TIER
|
||||
|
||||
FLAGS:
|
||||
{{range .VisibleFlags}}{{.}}
|
||||
{{end}}
|
||||
EXAMPLES:
|
||||
1. Configure a new remote tier which transitions objects to a bucket in a MinIO deployment:
|
||||
{{.Prompt}} {{.HelpName}} minio myminio WARM-MINIO-TIER --endpoint https://warm-minio.com \
|
||||
--access-key ACCESSKEY --secret-key SECRETKEY --bucket mybucket --prefix myprefix/
|
||||
|
||||
2. Configure a new remote tier which transitions objects to a bucket in Azure Blob Storage:
|
||||
{{.Prompt}} {{.HelpName}} azure myminio AZTIER --account-name ACCOUNT-NAME --account-key ACCOUNT-KEY \
|
||||
--bucket myazurebucket --prefix myazureprefix/
|
||||
|
||||
3. Configure a new remote tier which transitions objects to a bucket in AWS S3 with STANDARD storage class:
|
||||
{{.Prompt}} {{.HelpName}} s3 myminio S3TIER --endpoint https://s3.amazonaws.com \
|
||||
--access-key ACCESSKEY --secret-key SECRETKEY --bucket mys3bucket --prefix mys3prefix/ \
|
||||
--storage-class "STANDARD" --region us-west-2
|
||||
|
||||
4. Configure a new remote tier which transitions objects to a bucket in Google Cloud Storage:
|
||||
{{.Prompt}} {{.HelpName}} gcs myminio GCSTIER --credentials-file /path/to/credentials.json \
|
||||
--bucket mygcsbucket --prefix mygcsprefix/
|
||||
`,
|
||||
}
|
||||
adminTierDepEditCmd = cli.Command{
|
||||
Name: "edit",
|
||||
Usage: "update an existing remote tier configuration",
|
||||
Action: mainAdminTierEdit,
|
||||
Hidden: true,
|
||||
OnUsageError: onUsageError,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: append(globalFlags, adminTierEditFlags...),
|
||||
CustomHelpTemplate: `NAME:
|
||||
{{.HelpName}} - {{.Usage}}
|
||||
|
||||
USAGE:
|
||||
{{.HelpName}} ALIAS NAME
|
||||
|
||||
NAME:
|
||||
Name of remote tier. e.g WARM-TIER
|
||||
|
||||
FLAGS:
|
||||
{{range .VisibleFlags}}{{.}}
|
||||
{{end}}
|
||||
EXAMPLES:
|
||||
1. Update credentials for an existing Azure Blob Storage remote tier:
|
||||
{{.Prompt}} {{.HelpName}} myminio AZTIER --account-key ACCOUNT-KEY
|
||||
|
||||
2. Update credentials for an existing AWS S3 compatible remote tier:
|
||||
{{.Prompt}} {{.HelpName}} myminio S3TIER --access-key ACCESS-KEY --secret-key SECRET-KEY
|
||||
|
||||
3. Update credentials for an existing Google Cloud Storage remote tier:
|
||||
{{.Prompt}} {{.HelpName}} myminio GCSTIER --credentials-file /path/to/credentials.json
|
||||
`,
|
||||
}
|
||||
|
||||
adminTierDepVerifyCmd = cli.Command{
|
||||
Name: "verify",
|
||||
Usage: "verifies if remote tier configuration is valid",
|
||||
Action: mainAdminTierVerify,
|
||||
Hidden: true,
|
||||
OnUsageError: onUsageError,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: globalFlags,
|
||||
CustomHelpTemplate: `NAME:
|
||||
{{.HelpName}} - {{.Usage}}
|
||||
|
||||
USAGE:
|
||||
{{.HelpName}} TARGET NAME
|
||||
|
||||
NAME:
|
||||
Name of remote tier target. e.g WARM-TIER
|
||||
|
||||
FLAGS:
|
||||
{{range .VisibleFlags}}{{.}}
|
||||
{{end}}
|
||||
EXAMPLES:
|
||||
1. Verify if a tier config is valid.
|
||||
{{.Prompt}} {{.HelpName}} myminio WARM-TIER
|
||||
`,
|
||||
}
|
||||
|
||||
adminTierDepRmCmd = cli.Command{
|
||||
Name: "rm",
|
||||
Usage: "removes an empty remote tier",
|
||||
Action: mainAdminTierRm,
|
||||
Hidden: true,
|
||||
OnUsageError: onUsageError,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: globalFlags,
|
||||
CustomHelpTemplate: `NAME:
|
||||
{{.HelpName}} - {{.Usage}}
|
||||
|
||||
USAGE:
|
||||
{{.HelpName}} ALIAS NAME
|
||||
|
||||
NAME:
|
||||
Name of remote tier target. e.g WARM-TIER
|
||||
|
||||
FLAGS:
|
||||
{{range .VisibleFlags}}{{.}}
|
||||
{{end}}
|
||||
EXAMPLES:
|
||||
1. Remove an empty tier by name 'WARM-TIER':
|
||||
{{.Prompt}} {{.HelpName}} myminio WARM-TIER
|
||||
`,
|
||||
}
|
||||
)
|
||||
+6
-13
@@ -17,16 +17,10 @@
|
||||
|
||||
package cmd
|
||||
|
||||
import "github.com/minio/cli"
|
||||
|
||||
var adminTierSubCommands = []cli.Command{
|
||||
adminTierAddCmd,
|
||||
adminTierListCmd,
|
||||
adminTierEditCmd,
|
||||
adminTierRmCmd,
|
||||
adminTierVerifyCmd,
|
||||
adminTierInfoCmd,
|
||||
}
|
||||
import (
|
||||
"github.com/minio/cli"
|
||||
"github.com/minio/pkg/console"
|
||||
)
|
||||
|
||||
var adminTierCmd = cli.Command{
|
||||
Name: "tier",
|
||||
@@ -34,13 +28,12 @@ var adminTierCmd = cli.Command{
|
||||
Action: mainAdminTier,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: globalFlags,
|
||||
Subcommands: adminTierSubCommands,
|
||||
HideHelpCommand: true,
|
||||
Subcommands: adminTierDepCmds,
|
||||
}
|
||||
|
||||
// mainAdminTier is the handle for "mc admin tier" command.
|
||||
func mainAdminTier(ctx *cli.Context) error {
|
||||
commandNotFound(ctx, adminTierSubCommands)
|
||||
console.Println("Please use 'mc ilm tier' instead.")
|
||||
return nil
|
||||
// Sub-commands like "add", "ls", "edit", "rm" and "verify" have their own main.
|
||||
}
|
||||
|
||||
@@ -304,6 +304,14 @@ var completeCmds = map[string]complete.Predictor{
|
||||
"/ilm/import": s3Complete{deepLevel: 2},
|
||||
"/ilm/restore": s3Completer,
|
||||
|
||||
"/ilm/rule/ls": s3Complete{deepLevel: 2},
|
||||
"/ilm/rule/add": s3Complete{deepLevel: 2},
|
||||
"/ilm/rule/edit": s3Complete{deepLevel: 2},
|
||||
"/ilm/rule/rm": s3Complete{deepLevel: 2},
|
||||
"/ilm/rule/export": s3Complete{deepLevel: 2},
|
||||
"/ilm/rule/import": s3Complete{deepLevel: 2},
|
||||
"/ilm/rule/restore": s3Completer,
|
||||
|
||||
"/undo": s3Completer,
|
||||
|
||||
// Admin API commands MinIO only.
|
||||
@@ -432,6 +440,13 @@ var completeCmds = map[string]complete.Predictor{
|
||||
"/admin/tier/rm": nil,
|
||||
"/admin/tier/verify": nil,
|
||||
|
||||
"/ilm/tier/info": nil,
|
||||
"/ilm/tier/ls": nil,
|
||||
"/ilm/tier/add": nil,
|
||||
"/ilm/tier/update": nil,
|
||||
"/ilm/tier/check": nil,
|
||||
"/ilm/tier/rm": nil,
|
||||
|
||||
"/admin/replicate/add": aliasCompleter,
|
||||
"/admin/replicate/edit": aliasCompleter,
|
||||
"/admin/replicate/info": aliasCompleter,
|
||||
|
||||
@@ -0,0 +1,224 @@
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This file is part of MinIO Object Storage stack
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package cmd
|
||||
|
||||
import "github.com/minio/cli"
|
||||
|
||||
var ilmDepCmds = []cli.Command{
|
||||
ilmDepAddCmd,
|
||||
ilmDepEditCmd,
|
||||
ilmDepLsCmd,
|
||||
ilmDepRmCmd,
|
||||
ilmDepExportCmd,
|
||||
ilmDepImportCmd,
|
||||
}
|
||||
|
||||
var (
|
||||
ilmDepAddCmd = cli.Command{
|
||||
Name: "add",
|
||||
Usage: "add a lifecycle configuration rule for a bucket",
|
||||
Action: mainILMAdd,
|
||||
Hidden: true, // to avoid being listed in `mc ilm`
|
||||
OnUsageError: onUsageError,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: append(ilmAddFlags, globalFlags...),
|
||||
CustomHelpTemplate: `NAME:
|
||||
{{.HelpName}} - {{.Usage}}
|
||||
|
||||
USAGE:
|
||||
{{.HelpName}} [COMMAND FLAGS] TARGET
|
||||
|
||||
FLAGS:
|
||||
{{range .VisibleFlags}}{{.}}
|
||||
{{end}}
|
||||
DESCRIPTION:
|
||||
Add a lifecycle configuration rule.
|
||||
|
||||
EXAMPLES:
|
||||
1. Add a lifecycle rule with an expiration action for all objects in mybucket.
|
||||
{{.Prompt}} {{.HelpName}} --expire-days "200" myminio/mybucket
|
||||
|
||||
2. Add a lifecycle rule with a transition and a noncurrent version transition action for objects with prefix doc/ in mybucket.
|
||||
Tiers must exist in MinIO. Use existing tiers or add new tiers.
|
||||
{{.Prompt}} mc tier add minio myminio MINIOTIER-1 --endpoint https://warm-minio-1.com \
|
||||
--access-key ACCESSKEY --secret-key SECRETKEY --bucket bucket1 --prefix prefix1
|
||||
|
||||
{{.Prompt}} mc tier add minio myminio MINIOTIER-2 --endpoint https://warm-minio-2.com \
|
||||
--access-key ACCESSKEY --secret-key SECRETKEY --bucket bucket2 --prefix prefix2
|
||||
|
||||
{{.Prompt}} {{.HelpName}} --prefix "doc/" --transition-days "90" --transition-tier "MINIOTIER-1" \
|
||||
--noncurrent-transition-days "45" --noncurrent-transition-tier "MINIOTIER-2" \
|
||||
myminio/mybucket/
|
||||
|
||||
3. Add a lifecycle rule with an expiration and a noncurrent version expiration action for all objects with prefix doc/ in mybucket.
|
||||
{{.Prompt}} {{.HelpName}} --prefix "doc/" --expire-days "300" --noncurrent-expire-days "100" \
|
||||
myminio/mybucket/
|
||||
`,
|
||||
}
|
||||
ilmDepRmCmd = cli.Command{
|
||||
Name: "rm",
|
||||
Usage: "remove (if any) existing lifecycle configuration rule",
|
||||
Action: mainILMRemove,
|
||||
Hidden: true, // to avoid being listed in `mc ilm`
|
||||
OnUsageError: onUsageError,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: append(ilmRemoveFlags, globalFlags...),
|
||||
CustomHelpTemplate: `NAME:
|
||||
{{.HelpName}} - {{.Usage}}
|
||||
|
||||
USAGE:
|
||||
{{.HelpName}} [FLAGS] TARGET
|
||||
|
||||
FLAGS:
|
||||
{{range .VisibleFlags}}{{.}}
|
||||
{{end}}
|
||||
DESCRIPTION:
|
||||
Remove a lifecycle configuration rule for the bucket by ID, optionally you can remove
|
||||
all the lifecycle rules on a bucket with '--all --force' option.
|
||||
|
||||
EXAMPLES:
|
||||
1. Remove the lifecycle management configuration rule given by ID "bgrt1ghju" for mybucket on alias 'myminio'. ID is case sensitive.
|
||||
{{.Prompt}} {{.HelpName}} --id "bgrt1ghju" myminio/mybucket
|
||||
|
||||
2. Remove ALL the lifecycle management configuration rules for mybucket on alias 'myminio'.
|
||||
Because the result is complete removal, the use of --force flag is enforced.
|
||||
{{.Prompt}} {{.HelpName}} --all --force myminio/mybucket
|
||||
`,
|
||||
}
|
||||
|
||||
ilmDepEditCmd = cli.Command{
|
||||
Name: "edit",
|
||||
Usage: "modify a lifecycle configuration rule with given id",
|
||||
Action: mainILMEdit,
|
||||
Hidden: true, // to avoid being listed in `mc ilm`
|
||||
OnUsageError: onUsageError,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: append(ilmEditFlags, globalFlags...),
|
||||
CustomHelpTemplate: `NAME:
|
||||
{{.HelpName}} - {{.Usage}}
|
||||
|
||||
USAGE:
|
||||
{{.HelpName}} [COMMAND FLAGS] TARGET
|
||||
|
||||
FLAGS:
|
||||
{{range .VisibleFlags}}{{.}}
|
||||
{{end}}
|
||||
DESCRIPTION:
|
||||
Modify a lifecycle configuration rule with given id.
|
||||
|
||||
EXAMPLES:
|
||||
1. Modify the expiration date for an existing rule with id "rHTY.a123".
|
||||
{{.Prompt}} {{.HelpName}} --id "rHTY.a123" --expiry-date "2020-09-17" s3/mybucket
|
||||
|
||||
2. Modify the expiration and transition days for an existing rule with id "hGHKijqpo123".
|
||||
{{.Prompt}} {{.HelpName}} --id "hGHKijqpo123" --expiry-days "300" \
|
||||
--transition-days "200" --storage-class "GLACIER" s3/mybucket
|
||||
|
||||
3. Disable the rule with id "rHTY.a123".
|
||||
{{.Prompt}} {{.HelpName}} --id "rHTY.a123" --disable s3/mybucket
|
||||
|
||||
`,
|
||||
}
|
||||
|
||||
ilmDepLsCmd = cli.Command{
|
||||
Name: "ls",
|
||||
Usage: "lists lifecycle configuration rules set on a bucket",
|
||||
Action: mainILMList,
|
||||
Hidden: true, // to avoid being listed in `mc ilm`
|
||||
OnUsageError: onUsageError,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: append(ilmListFlags, globalFlags...),
|
||||
CustomHelpTemplate: `NAME:
|
||||
{{.HelpName}} - {{.Usage}}
|
||||
|
||||
USAGE:
|
||||
{{.HelpName}} [FLAGS] TARGET
|
||||
|
||||
FLAGS:
|
||||
{{range .VisibleFlags}}{{.}}
|
||||
{{end}}
|
||||
DESCRIPTION:
|
||||
List lifecycle configuration rules set on a bucket.
|
||||
|
||||
EXAMPLES:
|
||||
1. List the lifecycle management rules (all fields) for mybucket on alias 'myminio'.
|
||||
{{.Prompt}} {{.HelpName}} myminio/mybucket
|
||||
|
||||
2. List the lifecycle management rules (expration date/days fields) for mybucket on alias 'myminio'.
|
||||
{{.Prompt}} {{.HelpName}} --expiry myminio/mybucket
|
||||
|
||||
3. List the lifecycle management rules (transition date/days, storage class fields) for mybucket on alias 'myminio'.
|
||||
{{.Prompt}} {{.HelpName}} --transition myminio/mybucket
|
||||
|
||||
4. List the lifecycle management rules in JSON format for mybucket on alias 'myminio'.
|
||||
{{.Prompt}} {{.HelpName}} --json myminio/mybucket
|
||||
`,
|
||||
}
|
||||
|
||||
ilmDepExportCmd = cli.Command{
|
||||
Name: "export",
|
||||
Usage: "export lifecycle configuration in JSON format",
|
||||
Action: mainILMExport,
|
||||
Hidden: true, // to avoid being listed in `mc ilm`
|
||||
OnUsageError: onUsageError,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: globalFlags,
|
||||
CustomHelpTemplate: `NAME:
|
||||
{{.HelpName}} - {{.Usage}}
|
||||
|
||||
USAGE:
|
||||
{{.HelpName}} TARGET
|
||||
|
||||
DESCRIPTION:
|
||||
Exports lifecycle configuration in JSON format to STDOUT.
|
||||
|
||||
EXAMPLES:
|
||||
1. Export lifecycle configuration for 'mybucket' to 'lifecycle.json' file.
|
||||
{{.Prompt}} {{.HelpName}} myminio/mybucket > lifecycle.json
|
||||
|
||||
2. Print lifecycle configuration for 'mybucket' to STDOUT.
|
||||
{{.Prompt}} {{.HelpName}} play/mybucket
|
||||
`,
|
||||
}
|
||||
|
||||
ilmDepImportCmd = cli.Command{
|
||||
Name: "import",
|
||||
Usage: "import lifecycle configuration in JSON format",
|
||||
Action: mainILMImport,
|
||||
Hidden: true, // to avoid being listed in `mc ilm`
|
||||
OnUsageError: onUsageError,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: globalFlags,
|
||||
CustomHelpTemplate: `NAME:
|
||||
{{.HelpName}} - {{.Usage}}
|
||||
|
||||
USAGE:
|
||||
{{.HelpName}} TARGET
|
||||
|
||||
DESCRIPTION:
|
||||
Import entire lifecycle configuration from STDIN, input file is expected to be in JSON format.
|
||||
|
||||
EXAMPLES:
|
||||
1. Set lifecycle configuration for the mybucket on alias 'myminio' to the rules imported from lifecycle.json
|
||||
{{.Prompt}} {{.HelpName}} myminio/mybucket < lifecycle.json
|
||||
|
||||
2. Set lifecycle configuration for the mybucket on alias 'myminio'. User is expected to enter the JSON contents on STDIN
|
||||
{{.Prompt}} {{.HelpName}} myminio/mybucket
|
||||
`,
|
||||
}
|
||||
)
|
||||
+3
-7
@@ -24,12 +24,8 @@ import (
|
||||
)
|
||||
|
||||
var ilmSubcommands = []cli.Command{
|
||||
ilmAddCmd,
|
||||
ilmEditCmd,
|
||||
ilmLsCmd,
|
||||
ilmRmCmd,
|
||||
ilmExportCmd,
|
||||
ilmImportCmd,
|
||||
ilmRuleCmd,
|
||||
ilmTierCmd,
|
||||
ilmRestoreCmd,
|
||||
}
|
||||
|
||||
@@ -40,7 +36,7 @@ var ilmCmd = cli.Command{
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: globalFlags,
|
||||
HideHelpCommand: true,
|
||||
Subcommands: ilmSubcommands,
|
||||
Subcommands: append(ilmSubcommands, ilmDepCmds...),
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
+2
-3
@@ -65,8 +65,8 @@ USAGE:
|
||||
{{.HelpName}} TARGET
|
||||
|
||||
DESCRIPTION:
|
||||
Create a restored copy of one or more objects archived on a remote tier. The copy automatically expires
|
||||
after the specified number of days (Default 1 day).
|
||||
Restore a copy of one or more objects from its remote tier. This copy automatically expires
|
||||
after the specified number of days (Default 1 day).
|
||||
|
||||
FLAGS:
|
||||
{{range .VisibleFlags}}{{.}}
|
||||
@@ -84,7 +84,6 @@ EXAMPLES:
|
||||
|
||||
4. Restore all objects with all versions under a specific prefix
|
||||
{{.Prompt}} {{.HelpName}} --recursive --versions myminio/mybucket/dir/
|
||||
|
||||
`,
|
||||
}
|
||||
|
||||
|
||||
@@ -49,20 +49,20 @@ DESCRIPTION:
|
||||
Add a lifecycle configuration rule.
|
||||
|
||||
EXAMPLES:
|
||||
1. Add a lifecycle rule with an expiration action for all objects in mybucket.
|
||||
{{.Prompt}} {{.HelpName}} --expire-days "200" myminio/mybucket
|
||||
|
||||
2. Add a lifecycle rule with a transition and a noncurrent version transition action for objects with prefix doc/ in mybucket.
|
||||
1. Add a lifecycle rule with a transition and a noncurrent version transition action for objects with prefix doc/ in mybucket.
|
||||
Tiers must exist in MinIO. Use existing tiers or add new tiers.
|
||||
{{.Prompt}} mc tier add minio myminio MINIOTIER-1 --endpoint https://warm-minio-1.com \
|
||||
|
||||
{{.Prompt}} mc ilm tier add minio myminio MINIOTIER-1 --endpoint https://warm-minio-1.com \
|
||||
--access-key ACCESSKEY --secret-key SECRETKEY --bucket bucket1 --prefix prefix1
|
||||
|
||||
{{.Prompt}} mc tier add minio myminio MINIOTIER-2 --endpoint https://warm-minio-2.com \
|
||||
--access-key ACCESSKEY --secret-key SECRETKEY --bucket bucket2 --prefix prefix2
|
||||
|
||||
{{.Prompt}} {{.HelpName}} --prefix "doc/" --transition-days "90" --transition-tier "MINIOTIER-1" \
|
||||
--noncurrent-transition-days "45" --noncurrent-transition-tier "MINIOTIER-2" \
|
||||
myminio/mybucket/
|
||||
--noncurrent-transition-days "45" --noncurrent-transition-tier "MINIOTIER-1" \
|
||||
myminio/mybucket/
|
||||
|
||||
|
||||
2. Add a lifecycle rule with an expiration action for all objects in mybucket.
|
||||
{{.Prompt}} {{.HelpName}} --expire-days "200" myminio/mybucket
|
||||
|
||||
|
||||
3. Add a lifecycle rule with an expiration and a noncurrent version expiration action for all objects with prefix doc/ in mybucket.
|
||||
{{.Prompt}} {{.HelpName}} --prefix "doc/" --expire-days "300" --noncurrent-expire-days "100" \
|
||||
@@ -0,0 +1,44 @@
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This file is part of MinIO Object Storage stack
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package cmd
|
||||
|
||||
import "github.com/minio/cli"
|
||||
|
||||
var ilmRuleSubcommands = []cli.Command{
|
||||
ilmAddCmd,
|
||||
ilmEditCmd,
|
||||
ilmLsCmd,
|
||||
ilmRmCmd,
|
||||
ilmExportCmd,
|
||||
ilmImportCmd,
|
||||
}
|
||||
|
||||
var ilmRuleCmd = cli.Command{
|
||||
Name: "rule",
|
||||
Usage: "manage bucket lifecycle rules",
|
||||
Before: setGlobalsFromContext,
|
||||
Action: mainILMRule,
|
||||
Subcommands: ilmRuleSubcommands,
|
||||
Flags: globalFlags,
|
||||
HideHelpCommand: true,
|
||||
}
|
||||
|
||||
func mainILMRule(ctx *cli.Context) error {
|
||||
commandNotFound(ctx, ilmRuleSubcommands)
|
||||
return nil
|
||||
}
|
||||
@@ -325,6 +325,9 @@ func (msg *tierMessage) String() string {
|
||||
case "verify":
|
||||
verifyMsg := fmt.Sprintf("Verified remote tier %s", msg.TierName)
|
||||
return console.Colorize("TierMessage", verifyMsg)
|
||||
case "check":
|
||||
checkMsg := fmt.Sprintf("Remote tier connectivity check for %s was successful", msg.TierName)
|
||||
return console.Colorize("TierMessage", checkMsg)
|
||||
case "edit":
|
||||
editMsg := fmt.Sprintf("Updated remote tier %s", msg.TierName)
|
||||
return console.Colorize("TierMessage", editMsg)
|
||||
@@ -0,0 +1,45 @@
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This file is part of MinIO Object Storage stack
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package cmd
|
||||
|
||||
import "github.com/minio/cli"
|
||||
|
||||
var ilmTierCheckCmd = cli.Command{
|
||||
Name: "check",
|
||||
Usage: "validate remote tier configuration",
|
||||
Action: mainAdminTierVerify,
|
||||
OnUsageError: onUsageError,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: globalFlags,
|
||||
CustomHelpTemplate: `NAME:
|
||||
{{.HelpName}} - {{.Usage}}
|
||||
|
||||
USAGE:
|
||||
{{.HelpName}} TARGET NAME
|
||||
|
||||
NAME:
|
||||
Name of remote tier target. e.g WARM-TIER
|
||||
|
||||
FLAGS:
|
||||
{{range .VisibleFlags}}{{.}}
|
||||
{{end}}
|
||||
EXAMPLES:
|
||||
1. Validate a tier config given by name.
|
||||
{{.Prompt}} {{.HelpName}} myminio WARM-TIER
|
||||
`,
|
||||
}
|
||||
@@ -58,6 +58,7 @@ var adminTierEditCmd = cli.Command{
|
||||
Name: "edit",
|
||||
Usage: "update an existing remote tier configuration",
|
||||
Action: mainAdminTierEdit,
|
||||
Hidden: true,
|
||||
OnUsageError: onUsageError,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: append(globalFlags, adminTierEditFlags...),
|
||||
@@ -28,7 +28,7 @@ import (
|
||||
|
||||
var adminTierListCmd = cli.Command{
|
||||
Name: "ls",
|
||||
Usage: "lists configured remote tier targets",
|
||||
Usage: "list configured remote tier targets",
|
||||
Action: mainAdminTierList,
|
||||
OnUsageError: onUsageError,
|
||||
Before: setGlobalsFromContext,
|
||||
@@ -0,0 +1,46 @@
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This file is part of MinIO Object Storage stack
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package cmd
|
||||
|
||||
import "github.com/minio/cli"
|
||||
|
||||
var ilmTierSubcommands = []cli.Command{
|
||||
adminTierInfoCmd,
|
||||
adminTierListCmd,
|
||||
adminTierAddCmd,
|
||||
adminTierEditCmd,
|
||||
ilmTierUpdateCmd,
|
||||
adminTierVerifyCmd,
|
||||
ilmTierCheckCmd,
|
||||
adminTierRmCmd,
|
||||
}
|
||||
|
||||
var ilmTierCmd = cli.Command{
|
||||
Name: "tier",
|
||||
Usage: "manage remote tiers",
|
||||
Action: mainILMTier,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: globalFlags,
|
||||
Subcommands: ilmTierSubcommands,
|
||||
HideHelpCommand: true,
|
||||
}
|
||||
|
||||
func mainILMTier(ctx *cli.Context) error {
|
||||
commandNotFound(ctx, ilmTierSubcommands)
|
||||
return nil
|
||||
}
|
||||
@@ -24,7 +24,7 @@ import (
|
||||
|
||||
var adminTierRmCmd = cli.Command{
|
||||
Name: "rm",
|
||||
Usage: "removes an empty remote tier",
|
||||
Usage: "remove an empty remote tier",
|
||||
Action: mainAdminTierRm,
|
||||
OnUsageError: onUsageError,
|
||||
Before: setGlobalsFromContext,
|
||||
@@ -0,0 +1,51 @@
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This file is part of MinIO Object Storage stack
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package cmd
|
||||
|
||||
import "github.com/minio/cli"
|
||||
|
||||
var ilmTierUpdateCmd = cli.Command{
|
||||
Name: "update",
|
||||
Usage: "update an existing remote tier configuration",
|
||||
Action: mainAdminTierEdit,
|
||||
OnUsageError: onUsageError,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: append(globalFlags, adminTierEditFlags...),
|
||||
CustomHelpTemplate: `NAME:
|
||||
{{.HelpName}} - {{.Usage}}
|
||||
|
||||
USAGE:
|
||||
{{.HelpName}} ALIAS NAME
|
||||
|
||||
NAME:
|
||||
Name of remote tier. e.g WARM-TIER
|
||||
|
||||
FLAGS:
|
||||
{{range .VisibleFlags}}{{.}}
|
||||
{{end}}
|
||||
EXAMPLES:
|
||||
1. Update credentials for an existing Azure Blob Storage remote tier:
|
||||
{{.Prompt}} {{.HelpName}} myminio AZTIER --account-key ACCOUNT-KEY
|
||||
|
||||
2. Update credentials for an existing AWS S3 compatible remote tier:
|
||||
{{.Prompt}} {{.HelpName}} myminio S3TIER --access-key ACCESS-KEY --secret-key SECRET-KEY
|
||||
|
||||
3. Update credentials for an existing Google Cloud Storage remote tier:
|
||||
{{.Prompt}} {{.HelpName}} myminio GCSTIER --credentials-file /path/to/credentials.json
|
||||
`,
|
||||
}
|
||||
@@ -26,6 +26,7 @@ var adminTierVerifyCmd = cli.Command{
|
||||
Name: "verify",
|
||||
Usage: "verifies if remote tier configuration is valid",
|
||||
Action: mainAdminTierVerify,
|
||||
Hidden: true,
|
||||
OnUsageError: onUsageError,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: globalFlags,
|
||||
Reference in New Issue
Block a user