Move mc admin bucket quota to mc quota (#4389)
This commit is contained in:
+9
-130
@@ -18,14 +18,7 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
humanize "github.com/dustin/go-humanize"
|
||||
"github.com/fatih/color"
|
||||
"github.com/minio/cli"
|
||||
json "github.com/minio/colorjson"
|
||||
"github.com/minio/madmin-go/v2"
|
||||
"github.com/minio/mc/pkg/probe"
|
||||
"github.com/minio/pkg/console"
|
||||
)
|
||||
|
||||
@@ -40,133 +33,19 @@ var adminQuotaFlags = []cli.Flag{
|
||||
},
|
||||
}
|
||||
|
||||
// quotaMessage container for content message structure
|
||||
type quotaMessage struct {
|
||||
op string
|
||||
Status string `json:"status"`
|
||||
Bucket string `json:"bucket"`
|
||||
Quota uint64 `json:"quota,omitempty"`
|
||||
QuotaType string `json:"type,omitempty"`
|
||||
}
|
||||
|
||||
func (q quotaMessage) String() string {
|
||||
switch q.op {
|
||||
case "set":
|
||||
return console.Colorize("QuotaMessage",
|
||||
fmt.Sprintf("Successfully set bucket quota of %s with %s type on `%s`", humanize.IBytes(q.Quota), q.QuotaType, q.Bucket))
|
||||
case "unset":
|
||||
return console.Colorize("QuotaMessage",
|
||||
fmt.Sprintf("Successfully cleared bucket quota configured on `%s`", q.Bucket))
|
||||
default:
|
||||
return console.Colorize("QuotaInfo",
|
||||
fmt.Sprintf("Bucket `%s` has %s quota of %s", q.Bucket, q.QuotaType, humanize.IBytes(q.Quota)))
|
||||
}
|
||||
}
|
||||
|
||||
func (q quotaMessage) JSON() string {
|
||||
jsonMessageBytes, e := json.MarshalIndent(q, "", " ")
|
||||
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
|
||||
|
||||
return string(jsonMessageBytes)
|
||||
}
|
||||
|
||||
var adminBucketQuotaCmd = cli.Command{
|
||||
Name: "quota",
|
||||
Usage: "manage bucket quota",
|
||||
Action: mainAdminBucketQuota,
|
||||
OnUsageError: onUsageError,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: append(adminQuotaFlags, globalFlags...),
|
||||
CustomHelpTemplate: `NAME:
|
||||
{{.HelpName}} - {{.Usage}}
|
||||
|
||||
USAGE:
|
||||
{{.HelpName}} TARGET [--hard QUOTA | --clear]
|
||||
|
||||
QUOTA
|
||||
quota accepts human-readable case-insensitive number
|
||||
suffixes such as "k", "m", "g" and "t" referring to the metric units KB,
|
||||
MB, GB and TB respectively. Adding an "i" to these prefixes, uses the IEC
|
||||
units, so that "gi" refers to "gibibyte" or "GiB". A "b" at the end is
|
||||
also accepted. Without suffixes the unit is bytes.
|
||||
|
||||
FLAGS:
|
||||
{{range .VisibleFlags}}{{.}}
|
||||
{{end}}
|
||||
EXAMPLES:
|
||||
1. Display bucket quota configured for "mybucket" on MinIO.
|
||||
{{.Prompt}} {{.HelpName}} myminio/mybucket
|
||||
|
||||
3. Set hard quota of 1gb for a bucket "mybucket" on MinIO.
|
||||
{{.Prompt}} {{.HelpName}} myminio/mybucket --hard 1GB
|
||||
|
||||
4. Clear bucket quota configured for bucket "mybucket" on MinIO.
|
||||
{{.Prompt}} {{.HelpName}} myminio/mybucket --clear
|
||||
`,
|
||||
}
|
||||
|
||||
// checkAdminBucketQuotaSyntax - validate all the passed arguments
|
||||
func checkAdminBucketQuotaSyntax(ctx *cli.Context) {
|
||||
if len(ctx.Args()) == 0 || len(ctx.Args()) > 1 {
|
||||
showCommandHelpAndExit(ctx, 1) // last argument is exit code
|
||||
}
|
||||
Name: "quota",
|
||||
Usage: "manage bucket quota",
|
||||
Action: mainAdminBucketQuota,
|
||||
OnUsageError: onUsageError,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: append(adminQuotaFlags, globalFlags...),
|
||||
HideHelpCommand: true,
|
||||
Hidden: true,
|
||||
}
|
||||
|
||||
// mainAdminBucketQuota is the handler for "mc admin bucket quota" command.
|
||||
func mainAdminBucketQuota(ctx *cli.Context) error {
|
||||
checkAdminBucketQuotaSyntax(ctx)
|
||||
|
||||
console.SetColor("QuotaMessage", color.New(color.FgGreen))
|
||||
console.SetColor("QuotaInfo", color.New(color.FgBlue))
|
||||
|
||||
// Get the alias parameter from cli
|
||||
args := ctx.Args()
|
||||
aliasedURL := args.Get(0)
|
||||
|
||||
// Create a new MinIO Admin Client
|
||||
client, err := newAdminClient(aliasedURL)
|
||||
fatalIf(err, "Unable to initialize admin connection.")
|
||||
|
||||
_, targetURL := url2Alias(args[0])
|
||||
if ctx.IsSet("hard") {
|
||||
qType := madmin.HardQuota
|
||||
quotaStr := ctx.String("hard")
|
||||
quota, e := humanize.ParseBytes(quotaStr)
|
||||
fatalIf(probe.NewError(e).Trace(quotaStr), "Unable to parse quota")
|
||||
|
||||
fatalIf(probe.NewError(client.SetBucketQuota(globalContext, targetURL, &madmin.BucketQuota{
|
||||
Quota: quota,
|
||||
Type: qType,
|
||||
})).Trace(args...), "Unable to set bucket quota")
|
||||
|
||||
printMsg(quotaMessage{
|
||||
op: ctx.Command.Name,
|
||||
Bucket: targetURL,
|
||||
Quota: quota,
|
||||
QuotaType: string(qType),
|
||||
Status: "success",
|
||||
})
|
||||
} else if ctx.Bool("clear") {
|
||||
if e := client.SetBucketQuota(globalContext, targetURL, &madmin.BucketQuota{}); e != nil {
|
||||
fatalIf(probe.NewError(e).Trace(args...), "Unable to clear bucket quota config")
|
||||
}
|
||||
printMsg(quotaMessage{
|
||||
op: ctx.Command.Name,
|
||||
Bucket: targetURL,
|
||||
Status: "success",
|
||||
})
|
||||
|
||||
} else {
|
||||
qCfg, e := client.GetBucketQuota(globalContext, targetURL)
|
||||
fatalIf(probe.NewError(e).Trace(args...), "Unable to get bucket quota")
|
||||
printMsg(quotaMessage{
|
||||
op: ctx.Command.Name,
|
||||
Bucket: targetURL,
|
||||
Quota: qCfg.Quota,
|
||||
QuotaType: string(qCfg.Type),
|
||||
Status: "success",
|
||||
})
|
||||
}
|
||||
|
||||
console.Infoln("Please use 'mc quota'")
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -478,6 +478,9 @@ var completeCmds = map[string]complete.Predictor{
|
||||
"/batch/list": aliasCompleter,
|
||||
"/batch/status": aliasCompleter,
|
||||
"/batch/describe": aliasCompleter,
|
||||
"/quota/set": aliasCompleter,
|
||||
"/quota/info": aliasCompleter,
|
||||
"/quota/clear": aliasCompleter,
|
||||
}
|
||||
|
||||
// flagsToCompleteFlags transforms a cli.Flag to complete.Flags
|
||||
|
||||
@@ -442,6 +442,7 @@ var appCmds = []cli.Command{
|
||||
shareCmd,
|
||||
versionCmd,
|
||||
ilmCmd,
|
||||
quotaCmd,
|
||||
encryptCmd,
|
||||
eventCmd,
|
||||
watchCmd,
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
// Copyright (c) 2015-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/fatih/color"
|
||||
"github.com/minio/cli"
|
||||
"github.com/minio/madmin-go/v2"
|
||||
"github.com/minio/mc/pkg/probe"
|
||||
"github.com/minio/pkg/console"
|
||||
)
|
||||
|
||||
var quotaClearCmd = cli.Command{
|
||||
Name: "clear",
|
||||
Usage: "clear bucket quota",
|
||||
Action: mainQuotaClear,
|
||||
OnUsageError: onUsageError,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: globalFlags,
|
||||
CustomHelpTemplate: `NAME:
|
||||
{{.HelpName}} - {{.Usage}}
|
||||
|
||||
USAGE:
|
||||
{{.HelpName}} TARGET
|
||||
|
||||
FLAGS:
|
||||
{{range .VisibleFlags}}{{.}}
|
||||
{{end}}
|
||||
EXAMPLES:
|
||||
1. Clear bucket quota configured for bucket "mybucket" on MinIO.
|
||||
{{.Prompt}} {{.HelpName}} myminio/mybucket
|
||||
`,
|
||||
}
|
||||
|
||||
// checkQuotaClearSyntax - validate all the passed arguments
|
||||
func checkQuotaClearSyntax(ctx *cli.Context) {
|
||||
if len(ctx.Args()) == 0 || len(ctx.Args()) > 1 {
|
||||
showCommandHelpAndExit(ctx, 1) // last argument is exit code
|
||||
}
|
||||
}
|
||||
|
||||
// mainQuotaClear is the handler for "mc quota clear" command.
|
||||
func mainQuotaClear(ctx *cli.Context) error {
|
||||
checkQuotaClearSyntax(ctx)
|
||||
|
||||
console.SetColor("QuotaMessage", color.New(color.FgGreen))
|
||||
console.SetColor("QuotaInfo", color.New(color.FgCyan))
|
||||
|
||||
// Get the alias parameter from cli
|
||||
args := ctx.Args()
|
||||
aliasedURL := args.Get(0)
|
||||
|
||||
// Create a new MinIO Admin Client
|
||||
client, err := newAdminClient(aliasedURL)
|
||||
fatalIf(err, "Unable to initialize admin connection.")
|
||||
|
||||
_, targetURL := url2Alias(args[0])
|
||||
if e := client.SetBucketQuota(globalContext, targetURL, &madmin.BucketQuota{}); e != nil {
|
||||
fatalIf(probe.NewError(e).Trace(args...), "Unable to clear bucket quota config")
|
||||
}
|
||||
printMsg(quotaMessage{
|
||||
op: ctx.Command.Name,
|
||||
Bucket: targetURL,
|
||||
Status: "success",
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
// Copyright (c) 2015-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/fatih/color"
|
||||
"github.com/minio/cli"
|
||||
"github.com/minio/mc/pkg/probe"
|
||||
"github.com/minio/pkg/console"
|
||||
)
|
||||
|
||||
var quotaInfoCmd = cli.Command{
|
||||
Name: "info",
|
||||
Usage: "show bucket quota",
|
||||
Action: mainQuotaInfo,
|
||||
OnUsageError: onUsageError,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: globalFlags,
|
||||
CustomHelpTemplate: `NAME:
|
||||
{{.HelpName}} - {{.Usage}}
|
||||
|
||||
USAGE:
|
||||
{{.HelpName}} TARGET
|
||||
|
||||
FLAGS:
|
||||
{{range .VisibleFlags}}{{.}}
|
||||
{{end}}
|
||||
EXAMPLES:
|
||||
1. Display bucket quota configured for "mybucket" on MinIO.
|
||||
{{.Prompt}} {{.HelpName}} myminio/mybucket
|
||||
`,
|
||||
}
|
||||
|
||||
// checkQuotaInfoSyntax - validate all the passed arguments
|
||||
func checkQuotaInfoSyntax(ctx *cli.Context) {
|
||||
if len(ctx.Args()) == 0 || len(ctx.Args()) > 1 {
|
||||
showCommandHelpAndExit(ctx, 1) // last argument is exit code
|
||||
}
|
||||
}
|
||||
|
||||
// mainQuotaInfo is the handler for "mc quota info" command.
|
||||
func mainQuotaInfo(ctx *cli.Context) error {
|
||||
checkQuotaInfoSyntax(ctx)
|
||||
|
||||
console.SetColor("QuotaMessage", color.New(color.FgGreen))
|
||||
console.SetColor("QuotaInfo", color.New(color.FgCyan))
|
||||
|
||||
// Get the alias parameter from cli
|
||||
args := ctx.Args()
|
||||
aliasedURL := args.Get(0)
|
||||
|
||||
// Create a new MinIO Admin Client
|
||||
client, err := newAdminClient(aliasedURL)
|
||||
fatalIf(err, "Unable to initialize admin connection.")
|
||||
|
||||
_, targetURL := url2Alias(args[0])
|
||||
qCfg, e := client.GetBucketQuota(globalContext, targetURL)
|
||||
fatalIf(probe.NewError(e).Trace(args...), "Unable to get bucket quota")
|
||||
printMsg(quotaMessage{
|
||||
op: ctx.Command.Name,
|
||||
Bucket: targetURL,
|
||||
Quota: qCfg.Quota,
|
||||
QuotaType: string(qCfg.Type),
|
||||
Status: "success",
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
// Copyright (c) 2015-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 quotaSubcommands = []cli.Command{
|
||||
quotaSetCmd,
|
||||
quotaInfoCmd,
|
||||
quotaClearCmd,
|
||||
}
|
||||
|
||||
var quotaCmd = cli.Command{
|
||||
Name: "quota",
|
||||
Usage: "manage bucket quota",
|
||||
Action: mainQuota,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: globalFlags,
|
||||
Subcommands: quotaSubcommands,
|
||||
HideHelpCommand: true,
|
||||
}
|
||||
|
||||
// mainQuota is the handle for "mc quota" command.
|
||||
func mainQuota(ctx *cli.Context) error {
|
||||
commandNotFound(ctx, quotaSubcommands)
|
||||
return nil
|
||||
// Sub-commands like "set", "clear", "info" have their own main.
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
// Copyright (c) 2015-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 (
|
||||
"fmt"
|
||||
|
||||
"github.com/dustin/go-humanize"
|
||||
"github.com/fatih/color"
|
||||
"github.com/minio/cli"
|
||||
json "github.com/minio/colorjson"
|
||||
"github.com/minio/madmin-go/v2"
|
||||
"github.com/minio/mc/pkg/probe"
|
||||
"github.com/minio/pkg/console"
|
||||
)
|
||||
|
||||
var quotaSetFlags = []cli.Flag{
|
||||
cli.StringFlag{
|
||||
Name: "size",
|
||||
Usage: "set a hard quota, disallowing writes after quota is reached",
|
||||
},
|
||||
}
|
||||
|
||||
var quotaSetCmd = cli.Command{
|
||||
Name: "set",
|
||||
Usage: "set bucket quota",
|
||||
Action: mainQuotaSet,
|
||||
OnUsageError: onUsageError,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: append(quotaSetFlags, globalFlags...),
|
||||
CustomHelpTemplate: `NAME:
|
||||
{{.HelpName}} - {{.Usage}}
|
||||
|
||||
USAGE:
|
||||
{{.HelpName}} TARGET [--size QUOTA]
|
||||
|
||||
QUOTA
|
||||
quota accepts human-readable case-insensitive number
|
||||
suffixes such as "k", "m", "g" and "t" referring to the metric units KB,
|
||||
MB, GB and TB respectively. Adding an "i" to these prefixes, uses the IEC
|
||||
units, so that "gi" refers to "gibibyte" or "GiB". A "b" at the end is
|
||||
also accepted. Without suffixes the unit is bytes.
|
||||
|
||||
FLAGS:
|
||||
{{range .VisibleFlags}}{{.}}
|
||||
{{end}}
|
||||
EXAMPLES:
|
||||
1. Set hard quota of 1gb for a bucket "mybucket" on MinIO.
|
||||
{{.Prompt}} {{.HelpName}} myminio/mybucket --size 1GB
|
||||
`,
|
||||
}
|
||||
|
||||
// quotaMessage container for content message structure
|
||||
type quotaMessage struct {
|
||||
op string
|
||||
Status string `json:"status"`
|
||||
Bucket string `json:"bucket"`
|
||||
Quota uint64 `json:"quota,omitempty"`
|
||||
QuotaType string `json:"type,omitempty"`
|
||||
}
|
||||
|
||||
func (q quotaMessage) String() string {
|
||||
switch q.op {
|
||||
case "set":
|
||||
return console.Colorize("QuotaMessage",
|
||||
fmt.Sprintf("Successfully set bucket quota of %s on `%s`", humanize.IBytes(q.Quota), q.Bucket))
|
||||
case "clear":
|
||||
return console.Colorize("QuotaMessage",
|
||||
fmt.Sprintf("Successfully cleared bucket quota configured on `%s`", q.Bucket))
|
||||
default:
|
||||
return console.Colorize("QuotaInfo",
|
||||
fmt.Sprintf("Bucket `%s` has %s quota of %s", q.Bucket, q.QuotaType, humanize.IBytes(q.Quota)))
|
||||
}
|
||||
}
|
||||
|
||||
func (q quotaMessage) JSON() string {
|
||||
jsonMessageBytes, e := json.MarshalIndent(q, "", " ")
|
||||
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
|
||||
|
||||
return string(jsonMessageBytes)
|
||||
}
|
||||
|
||||
// checkQuotaSetSyntax - validate all the passed arguments
|
||||
func checkQuotaSetSyntax(ctx *cli.Context) {
|
||||
if len(ctx.Args()) == 0 || len(ctx.Args()) > 1 {
|
||||
showCommandHelpAndExit(ctx, 1) // last argument is exit code
|
||||
}
|
||||
}
|
||||
|
||||
// mainQuotaSet is the handler for "mc quota set" command.
|
||||
func mainQuotaSet(ctx *cli.Context) error {
|
||||
checkQuotaSetSyntax(ctx)
|
||||
|
||||
console.SetColor("QuotaMessage", color.New(color.FgGreen))
|
||||
console.SetColor("QuotaInfo", color.New(color.FgBlue))
|
||||
|
||||
// Get the alias parameter from cli
|
||||
args := ctx.Args()
|
||||
aliasedURL := args.Get(0)
|
||||
|
||||
// Create a new MinIO Admin Client
|
||||
client, err := newAdminClient(aliasedURL)
|
||||
fatalIf(err, "Unable to initialize admin connection.")
|
||||
|
||||
_, targetURL := url2Alias(args[0])
|
||||
if !ctx.IsSet("size") {
|
||||
fatalIf(errInvalidArgument().Trace(ctx.Args().Tail()...),
|
||||
"--size flag needs to be set.")
|
||||
}
|
||||
qType := madmin.HardQuota
|
||||
quotaStr := ctx.String("size")
|
||||
quota, e := humanize.ParseBytes(quotaStr)
|
||||
fatalIf(probe.NewError(e).Trace(quotaStr), "Unable to parse quota")
|
||||
|
||||
fatalIf(probe.NewError(client.SetBucketQuota(globalContext, targetURL, &madmin.BucketQuota{
|
||||
Quota: quota,
|
||||
Type: qType,
|
||||
})).Trace(args...), "Unable to set bucket quota")
|
||||
|
||||
printMsg(quotaMessage{
|
||||
op: ctx.Command.Name,
|
||||
Bucket: targetURL,
|
||||
Quota: quota,
|
||||
QuotaType: string(qType),
|
||||
Status: "success",
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -771,42 +771,7 @@ Key: my-key
|
||||
```
|
||||
<a name = "bucket"></a>
|
||||
<a name="quota"></a>
|
||||
### Command `quota` - Set/Get bucket quota
|
||||
`quota` command to set or get bucket quota on MinIO server.
|
||||
|
||||
```
|
||||
NAME:
|
||||
mc admin bucket quota - manage bucket quota
|
||||
|
||||
USAGE:
|
||||
mc admin bucket quota TARGET [--hard QUOTA | --clear]
|
||||
|
||||
QUOTA
|
||||
quota accepts human-readable case-insensitive number
|
||||
suffixes such as "k", "m", "g" and "t" referring to the metric units KB,
|
||||
MB, GB and TB respectively. Adding an "i" to these prefixes, uses the IEC
|
||||
units, so that "gi" refers to "gibibyte" or "GiB". A "b" at the end is
|
||||
also accepted. Without suffixes the unit is bytes.
|
||||
|
||||
```
|
||||
*Example: List bucket quota on bucket 'mybucket' on MinIO.*
|
||||
|
||||
```
|
||||
mc admin bucket quota myminio/mybucket
|
||||
```
|
||||
|
||||
*Example: Set a hard bucket quota of 64Mb for bucket 'mybucket' on MinIO.*
|
||||
|
||||
```
|
||||
mc admin bucket quota myminio/mybucket --hard 64MB
|
||||
```
|
||||
|
||||
*Example: Reset bucket quota configured for bucket 'mybucket' on MinIO.*
|
||||
|
||||
```
|
||||
mc admin bucket quota myminio/mybucket --clear
|
||||
```
|
||||
|
||||
This command is deprecated and will be removed in a future release. Use 'mc quota set|info|clear' instead.
|
||||
<a name="remote"></a>
|
||||
### Command `remote` - configure remote target buckets
|
||||
`remote` command manages remote bucket targets on MinIO server.
|
||||
|
||||
@@ -36,6 +36,7 @@ admin manage MinIO servers
|
||||
update update mc to latest release
|
||||
support supportability tools like profile, register, callhome, inspect
|
||||
ping perform liveness check
|
||||
quota manage bucket quota
|
||||
```
|
||||
|
||||
## 1. Download MinIO Client
|
||||
@@ -2007,3 +2008,43 @@ mc ping play
|
||||
2: https://play.min.io: min=278.356ms max=919.538ms average=598.947ms errors=0 roundtrip=278.356ms
|
||||
3: https://play.min.io: min=278.356ms max=919.538ms average=504.759ms errors=0 roundtrip=316.384ms
|
||||
```
|
||||
|
||||
<a name="quota"></a>
|
||||
|
||||
### Command `quota` - Manage bucket quota
|
||||
`quota` command to set or get bucket quota on MinIO server.
|
||||
|
||||
```
|
||||
NAME:
|
||||
mc quota - manage bucket quota
|
||||
|
||||
USAGE:
|
||||
set set bucket quota
|
||||
info show bucket quota
|
||||
clear clear bucket quota
|
||||
|
||||
QUOTA
|
||||
quota accepts human-readable case-insensitive number
|
||||
suffixes such as "k", "m", "g" and "t" referring to the metric units KB,
|
||||
MB, GB and TB respectively. Adding an "i" to these prefixes, uses the IEC
|
||||
units, so that "gi" refers to "gibibyte" or "GiB". A "b" at the end is
|
||||
also accepted. Without suffixes the unit is bytes.
|
||||
|
||||
```
|
||||
*Example: Show bucket quota on bucket 'mybucket' on MinIO.*
|
||||
|
||||
```
|
||||
mc quota info myminio/mybucket
|
||||
```
|
||||
|
||||
*Example: Set a hard bucket quota of 64Mb for bucket 'mybucket' on MinIO.*
|
||||
|
||||
```
|
||||
mc quota set myminio/mybucket --size 64MB
|
||||
```
|
||||
|
||||
*Example: Reset bucket quota configured for bucket 'mybucket' on MinIO.*
|
||||
|
||||
```
|
||||
mc quota clear myminio/mybucket
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user