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

     1  // Copyright (c) 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 adminTierDepCmds = []cli.Command{
    23  	adminTierDepInfoCmd,
    24  	adminTierDepListCmd,
    25  	adminTierDepAddCmd,
    26  	adminTierDepEditCmd,
    27  	adminTierDepVerifyCmd,
    28  	adminTierDepRmCmd,
    29  }
    30  
    31  var (
    32  	adminTierDepInfoCmd = cli.Command{
    33  		Name:         "info",
    34  		Usage:        "display tier statistics",
    35  		Action:       mainAdminTierInfo,
    36  		Hidden:       true,
    37  		OnUsageError: onUsageError,
    38  		Before:       setGlobalsFromContext,
    39  		Flags:        globalFlags,
    40  		CustomHelpTemplate: `NAME:
    41    {{.HelpName}} - {{.Usage}}
    42  
    43  USAGE:
    44    {{.HelpName}} ALIAS [NAME]
    45  
    46  FLAGS:
    47    {{range .VisibleFlags}}{{.}}
    48    {{end}}
    49  
    50  EXAMPLES:
    51    1. Prints per-tier statistics of all remote tier targets configured on 'myminio':
    52       {{.Prompt}} {{.HelpName}} myminio
    53  
    54    2. Print per-tier statistics of given tier name 'MINIOTIER-1':
    55       {{.Prompt}} {{.HelpName}} myminio MINIOTIER-1
    56  `,
    57  	}
    58  
    59  	adminTierDepListCmd = cli.Command{
    60  		Name:         "ls",
    61  		Usage:        "lists configured remote tier targets",
    62  		Action:       mainAdminTierList,
    63  		Hidden:       true,
    64  		OnUsageError: onUsageError,
    65  		Before:       setGlobalsFromContext,
    66  		Flags:        globalFlags,
    67  		CustomHelpTemplate: `NAME:
    68    {{.HelpName}} - {{.Usage}}
    69  
    70  USAGE:
    71    {{.HelpName}} ALIAS
    72  
    73  FLAGS:
    74    {{range .VisibleFlags}}{{.}}
    75    {{end}}
    76  
    77  EXAMPLES:
    78    1. List remote tier targets configured on 'myminio':
    79       {{.Prompt}} {{.HelpName}} myminio
    80  `,
    81  	}
    82  
    83  	adminTierDepAddCmd = cli.Command{
    84  		Name:         "add",
    85  		Usage:        "add a new remote tier target",
    86  		Action:       mainAdminTierAdd,
    87  		Hidden:       true,
    88  		OnUsageError: onUsageError,
    89  		Before:       setGlobalsFromContext,
    90  		Flags:        append(globalFlags, adminTierAddFlags...),
    91  		CustomHelpTemplate: `NAME:
    92    {{.HelpName}} - {{.Usage}}
    93  
    94  USAGE:
    95    {{.HelpName}} TYPE ALIAS NAME [FLAGS]
    96  
    97  TYPE:
    98    Type of the cloud storage backend to add. Supported values are minio, s3, azure and gcs.
    99  
   100  NAME:
   101    Name of the remote tier target. e.g WARM-TIER
   102  
   103  FLAGS:
   104    {{range .VisibleFlags}}{{.}}
   105    {{end}}
   106  EXAMPLES:
   107    1. Configure a new remote tier which transitions objects to a bucket in a MinIO deployment:
   108       {{.Prompt}} {{.HelpName}} minio myminio WARM-MINIO-TIER --endpoint https://warm-minio.com \
   109          --access-key ACCESSKEY --secret-key SECRETKEY --bucket mybucket --prefix myprefix/
   110  
   111    2. Configure a new remote tier which transitions objects to a bucket in Azure Blob Storage:
   112       {{.Prompt}} {{.HelpName}} azure myminio AZTIER --account-name ACCOUNT-NAME --account-key ACCOUNT-KEY \
   113          --bucket myazurebucket --prefix myazureprefix/
   114  
   115    3. Configure a new remote tier which transitions objects to a bucket in AWS S3 with STANDARD storage class:
   116       {{.Prompt}} {{.HelpName}} s3 myminio S3TIER --endpoint https://s3.amazonaws.com \
   117          --access-key ACCESSKEY --secret-key SECRETKEY --bucket mys3bucket --prefix mys3prefix/ \
   118          --storage-class "STANDARD" --region us-west-2
   119  
   120    4. Configure a new remote tier which transitions objects to a bucket in Google Cloud Storage:
   121       {{.Prompt}} {{.HelpName}} gcs myminio GCSTIER --credentials-file /path/to/credentials.json \
   122          --bucket mygcsbucket  --prefix mygcsprefix/
   123  `,
   124  	}
   125  	adminTierDepEditCmd = cli.Command{
   126  		Name:         "edit",
   127  		Usage:        "update an existing remote tier configuration",
   128  		Action:       mainAdminTierEdit,
   129  		Hidden:       true,
   130  		OnUsageError: onUsageError,
   131  		Before:       setGlobalsFromContext,
   132  		Flags:        append(globalFlags, adminTierEditFlags...),
   133  		CustomHelpTemplate: `NAME:
   134    {{.HelpName}} - {{.Usage}}
   135  
   136  USAGE:
   137    {{.HelpName}} ALIAS NAME
   138  
   139  NAME:
   140    Name of remote tier. e.g WARM-TIER
   141  
   142  FLAGS:
   143    {{range .VisibleFlags}}{{.}}
   144    {{end}}
   145  EXAMPLES:
   146    1. Update credentials for an existing Azure Blob Storage remote tier:
   147       {{.Prompt}} {{.HelpName}} myminio AZTIER --account-key ACCOUNT-KEY
   148  
   149    2. Update credentials for an existing AWS S3 compatible remote tier:
   150       {{.Prompt}} {{.HelpName}} myminio S3TIER --access-key ACCESS-KEY --secret-key SECRET-KEY
   151  
   152    3. Update credentials for an existing Google Cloud Storage remote tier:
   153       {{.Prompt}} {{.HelpName}} myminio GCSTIER --credentials-file /path/to/credentials.json
   154  `,
   155  	}
   156  
   157  	adminTierDepVerifyCmd = cli.Command{
   158  		Name:         "verify",
   159  		Usage:        "verifies if remote tier configuration is valid",
   160  		Action:       mainAdminTierVerify,
   161  		Hidden:       true,
   162  		OnUsageError: onUsageError,
   163  		Before:       setGlobalsFromContext,
   164  		Flags:        globalFlags,
   165  		CustomHelpTemplate: `NAME:
   166    {{.HelpName}} - {{.Usage}}
   167  
   168  USAGE:
   169    {{.HelpName}} TARGET NAME
   170  
   171  NAME:
   172    Name of remote tier target. e.g WARM-TIER
   173  
   174  FLAGS:
   175    {{range .VisibleFlags}}{{.}}
   176    {{end}}
   177  EXAMPLES:
   178    1. Verify if a tier config is valid.
   179       {{.Prompt}} {{.HelpName}} myminio WARM-TIER
   180  `,
   181  	}
   182  
   183  	adminTierDepRmCmd = cli.Command{
   184  		Name:         "rm",
   185  		Usage:        "removes an empty remote tier",
   186  		Action:       mainAdminTierRm,
   187  		Hidden:       true,
   188  		OnUsageError: onUsageError,
   189  		Before:       setGlobalsFromContext,
   190  		Flags:        globalFlags,
   191  		CustomHelpTemplate: `NAME:
   192    {{.HelpName}} - {{.Usage}}
   193  
   194  USAGE:
   195    {{.HelpName}} ALIAS NAME
   196  
   197  NAME:
   198    Name of remote tier target. e.g WARM-TIER
   199  
   200  FLAGS:
   201    {{range .VisibleFlags}}{{.}}
   202    {{end}}
   203  EXAMPLES:
   204    1. Remove an empty tier by name 'WARM-TIER':
   205       {{.Prompt}} {{.HelpName}} myminio WARM-TIER
   206  `,
   207  	}
   208  )