github.com/minio/mc@v0.0.0-20240503112107-b471de8d1882/cmd/admin-main.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 adminFlags = []cli.Flag{}
    23  
    24  const (
    25  	// dot represents a list item, for eg. server status - online (green) or offline (red)
    26  	dot = "●"
    27  	// check represents successful operation
    28  	check = "✔"
    29  )
    30  
    31  var adminCmdSubcommands = []cli.Command{
    32  	adminServiceCmd,
    33  	adminServerUpdateCmd,
    34  	adminInfoCmd,
    35  	adminInspectCmd,
    36  	adminUserCmd,
    37  	adminGroupCmd,
    38  	adminPolicyCmd,
    39  	adminReplicateCmd,
    40  	adminIDPCmd,
    41  	adminConfigCmd,
    42  	adminDecommissionCmd,
    43  	adminHealCmd,
    44  	adminPrometheusCmd,
    45  	adminKMSCmd,
    46  	adminHealthCmd(),
    47  	adminSubnetCmd,
    48  	adminBucketCmd,
    49  	adminTierCmd,
    50  	adminSpeedtestCmd,
    51  	adminProfileCmd,
    52  	adminScannerCmd,
    53  	adminTopCmd,
    54  	adminTraceCmd,
    55  	adminConsoleCmd,
    56  	adminClusterCmd,
    57  	adminRebalanceCmd,
    58  	adminLogsCmd,
    59  }
    60  
    61  var adminCmd = cli.Command{
    62  	Name:            "admin",
    63  	Usage:           "manage MinIO servers",
    64  	Action:          mainAdmin,
    65  	Subcommands:     adminCmdSubcommands,
    66  	HideHelpCommand: true,
    67  	Before:          setGlobalsFromContext,
    68  	Flags:           append(adminFlags, globalFlags...),
    69  }
    70  
    71  const dateTimeFormatFilename = "2006-01-02T15-04-05.999999-07-00"
    72  
    73  // mainAdmin is the handle for "mc admin" command.
    74  func mainAdmin(ctx *cli.Context) error {
    75  	commandNotFound(ctx, adminCmdSubcommands)
    76  	return nil
    77  	// Sub-commands like "service", "heal", "top" have their own main.
    78  }