Add --remote-bucket as flag in mc replicate add/set (#3349)

This commit is contained in:
poornas
2020-08-14 13:59:52 -07:00
committed by GitHub
parent a80eca5af8
commit eafc9ee7b4
5 changed files with 28 additions and 12 deletions
+14 -5
View File
@@ -53,6 +53,10 @@ var replicateAddFlags = []cli.Flag{
Name: "priority",
Usage: "priority of the rule, should be unique and is a required field",
},
cli.StringFlag{
Name: "remote-bucket",
Usage: "remote bucket, should be a unique value for the configuration",
},
}
var replicateAddCmd = cli.Command{
@@ -74,12 +78,16 @@ EXAMPLES:
1. Add replication configuration rule on bucket "mybucket" for alias "myminio".
{{.Prompt}} {{.HelpName}} myminio/mybucket/prefix --tags "key1=value1&key2=value2" \
--storage-class "STANDARD" \
--arn 'arn:minio:replica::c5be6b16-769d-432a-9ef1-4567081f3566:destbucket' --priority 1
--arn 'arn:minio:replication::c5be6b16-769d-432a-9ef1-4567081f3566:destbucket' \
--priority 1 \
--remote-bucket "destbucket"
2. Add replication configuration rule with Disabled status on bucket "mybucket" for alias "myminio".
{{.Prompt}} {{.HelpName}} myminio/mybucket/prefix --tags "key1=value1&key2=value2" \
--storage-class "STANDARD" --disable
--arn 'arn:minio:replica::c5be6b16-769d-432a-9ef1-4567081f3566:destbucket' --priority 1
{{.Prompt}} {{.HelpName}} myminio/mybucket/prefix --tags "key1=value1&key2=value2" \
--storage-class "STANDARD" --disable \
--arn 'arn:minio:replica::c5be6b16-769d-432a-9ef1-4567081f3566:destbucket' \
--priority 1 \
--remote-bucket "destbucket"
`,
}
@@ -133,11 +141,12 @@ func mainReplicateAdd(cliCtx *cli.Context) error {
}
opts := replication.Options{
TagString: cliCtx.String("tags"),
Arn: cliCtx.String("arn"),
RoleArn: cliCtx.String("arn"),
StorageClass: cliCtx.String("storage-class"),
Priority: strconv.Itoa(cliCtx.Int("priority")),
RuleStatus: ruleStatus,
ID: cliCtx.String("id"),
DestBucket: cliCtx.String("remote-bucket"),
Op: replication.AddOption,
}
fatalIf(client.SetReplication(ctx, &rcfg, opts), "Could not add replication rule")
+10 -2
View File
@@ -50,6 +50,10 @@ var replicateSetFlags = []cli.Flag{
Name: "priority",
Usage: "priority of the rule, should be unique and is a required field",
},
cli.StringFlag{
Name: "remote-bucket",
Usage: "destination bucket, should be a unique value for the configuration",
},
}
var replicateSetCmd = cli.Command{
@@ -74,7 +78,8 @@ var replicateSetCmd = cli.Command{
2. Disable a replication configuration rule with rule ID "bsibgh8t874dnjst8hkg" on target myminio/bucket
{{.Prompt}} {{.HelpName}} myminio/mybucket --id "bsibgh8t874dnjst8hkg" --state disable
3. Set tags and storage class on a replication configuration with rule ID "kMYD.491" on target myminio/bucket/prefix.
3. Set tags and storage class on a replication configuration with rule ID "kMYD.491" on target
myminio/bucket/prefix.
{{.Prompt}} {{.HelpName}} myminio/mybucket --id "kMYD.491" --tags "key1=value1&key2=value2" \
--storage-class "STANDARD" --priority 2
@@ -140,11 +145,14 @@ func mainReplicateSet(cliCtx *cli.Context) error {
}
opts := replication.Options{
TagString: cliCtx.String("tags"),
Arn: cliCtx.String("arn"),
RoleArn: cliCtx.String("arn"),
StorageClass: cliCtx.String("storage-class"),
RuleStatus: state,
ID: cliCtx.String("id"),
Op: replication.SetOption,
DestBucket: cliCtx.String("remote-bucket"),
IsSCSet: cliCtx.IsSet("storage-class"),
IsTagSet: cliCtx.IsSet("tags"),
}
if cliCtx.IsSet("priority") {
opts.Priority = strconv.Itoa(cliCtx.Int("priority"))