github.com/minio/mc@v0.0.0-20240503112107-b471de8d1882/cmd/config-deprecated.go (about)

     1  // Copyright (c) 2015-2022 MinIO, Inc.
     2  //
     3  // This file is part of MinIO Object Storage stack
     4  //
     5  // This program is free software: you can redistribute it and/or modify
     6  // it under the terms of the GNU Affero General Public License as published by
     7  // the Free Software Foundation, either version 3 of the License, or
     8  // (at your option) any later version.
     9  //
    10  // This program is distributed in the hope that it will be useful
    11  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13  // GNU Affero General Public License for more details.
    14  //
    15  // You should have received a copy of the GNU Affero General Public License
    16  // along with this program.  If not, see <http://www.gnu.org/licenses/>.
    17  
    18  package cmd
    19  
    20  import "github.com/minio/cli"
    21  
    22  var configCmd = cli.Command{
    23  	Name:  "config",
    24  	Usage: "configure MinIO client",
    25  	Action: func(ctx *cli.Context) error {
    26  		cli.ShowCommandHelp(ctx, ctx.Args().First())
    27  		return nil
    28  	},
    29  	Hidden:          true,
    30  	Before:          setGlobalsFromContext,
    31  	HideHelpCommand: true,
    32  	Flags:           globalFlags,
    33  	Subcommands: []cli.Command{
    34  		configHostCmd,
    35  	},
    36  }
    37  
    38  var configHostCmd = cli.Command{
    39  	Name:  "host",
    40  	Usage: "add, remove and list hosts in configuration file",
    41  	Action: func(ctx *cli.Context) error {
    42  		cli.ShowCommandHelp(ctx, ctx.Args().First())
    43  		return nil
    44  	},
    45  	Before: setGlobalsFromContext,
    46  	Flags:  globalFlags,
    47  	Subcommands: []cli.Command{
    48  		configHostAddCmd,
    49  		configHostRemoveCmd,
    50  		configHostListCmd,
    51  	},
    52  	HideHelpCommand: true,
    53  }
    54  
    55  var configHostAddFlags = []cli.Flag{
    56  	cli.StringFlag{
    57  		Name:  "lookup",
    58  		Value: "auto",
    59  		Usage: "bucket lookup supported by the server. Valid options are '[dns, path, auto]'",
    60  	},
    61  	cli.StringFlag{
    62  		Name:  "api",
    63  		Usage: "API signature. Valid options are '[S3v4, S3v2]'",
    64  	},
    65  }
    66  
    67  var configHostAddCmd = cli.Command{
    68  	Name:      "add",
    69  	ShortName: "a",
    70  	Usage:     "add a new host to configuration file",
    71  	Action: func(cli *cli.Context) error {
    72  		return mainAliasSet(cli, true)
    73  	},
    74  	Before:          setGlobalsFromContext,
    75  	Flags:           append(configHostAddFlags, globalFlags...),
    76  	HideHelpCommand: true,
    77  }
    78  
    79  var configHostListCmd = cli.Command{
    80  	Name:      "list",
    81  	ShortName: "ls",
    82  	Usage:     "list hosts in configuration file",
    83  	Action: func(cli *cli.Context) error {
    84  		return mainAliasList(cli, true)
    85  	},
    86  	Before:          setGlobalsFromContext,
    87  	Flags:           globalFlags,
    88  	HideHelpCommand: true,
    89  }
    90  
    91  var configHostRemoveCmd = cli.Command{
    92  	Name:      "remove",
    93  	ShortName: "rm",
    94  	Usage:     "remove a host from configuration file",
    95  	Action: func(cli *cli.Context) error {
    96  		return mainAliasRemove(cli)
    97  	},
    98  	Before:          setGlobalsFromContext,
    99  	Flags:           globalFlags,
   100  	HideHelpCommand: true,
   101  }