Add --remote-bucket as flag in mc replicate add/set (#3349)
This commit is contained in:
+14
-5
@@ -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
@@ -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"))
|
||||
|
||||
@@ -1632,7 +1632,7 @@ FLAGS:
|
||||
*Example: Add replication configuration rule on `mybucket` on alias `myminio`*
|
||||
|
||||
```
|
||||
mc replicate add myminio/mybucket/prefix --tags "key1=value1&key2=value2" --storage-class "STANDARD" --arn 'arn:minio:replication:us-east-1:c5be6b16-769d-432a-9ef1-4567081f3566:destbucket' --priority 1
|
||||
mc replicate add myminio/mybucket/prefix --tags "key1=value1&key2=value2" --storage-class "STANDARD" --arn 'arn:minio:replication:us-east-1:c5be6b16-769d-432a-9ef1-4567081f3566:destbucket' --priority 1 --remote-bucket destbucket
|
||||
Replication configuration rule applied to myminio/mybucket/prefix.
|
||||
```
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ require (
|
||||
github.com/mattn/go-isatty v0.0.8
|
||||
github.com/minio/cli v1.22.0
|
||||
github.com/minio/minio v0.0.0-20200812095314-79ed7ce451ae
|
||||
github.com/minio/minio-go/v7 v7.0.5-0.20200807085956-d7db33ea7618
|
||||
github.com/minio/minio-go/v7 v7.0.5-0.20200812191821-9cc34d660436
|
||||
github.com/minio/sha256-simd v0.1.1
|
||||
github.com/mitchellh/go-homedir v1.1.0
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
|
||||
|
||||
@@ -278,13 +278,12 @@ github.com/minio/md5-simd v1.1.0/go.mod h1:XpBqgZULrMYD3R+M28PcmP0CkI7PEMzB3U77Z
|
||||
github.com/minio/minio v0.0.0-20200812095314-79ed7ce451ae h1:3mI/g3f70ZFIskMtNvUACTK2o2jeVysiB5p7wi+ay8I=
|
||||
github.com/minio/minio v0.0.0-20200812095314-79ed7ce451ae/go.mod h1:hnj2ntFYZ9U3L80leozb00ROk4/AdF0kj72n3A5e/60=
|
||||
github.com/minio/minio-go/v7 v7.0.3/go.mod h1:TA0CQCjJZHM5SJj9IjqR0NmpmQJ6bCbXifAJ3mUU6Hw=
|
||||
github.com/minio/minio-go/v7 v7.0.5-0.20200807085956-d7db33ea7618 h1:8iTb0TFs6kDGAUnhI/s2QCZOYcSTtYmY9dF+Cbc0WJo=
|
||||
github.com/minio/minio-go/v7 v7.0.5-0.20200807085956-d7db33ea7618/go.mod h1:CSt2ETZNs+bIIhWTse0mcZKZWMGrFU7Er7RR0TmkDYk=
|
||||
github.com/minio/minio-go/v7 v7.0.5-0.20200812191821-9cc34d660436 h1:EAaWyeXb1t0dR5a9rzSMoDiH1XdvKw8f8O2lEAoQZdw=
|
||||
github.com/minio/minio-go/v7 v7.0.5-0.20200812191821-9cc34d660436/go.mod h1:TA0CQCjJZHM5SJj9IjqR0NmpmQJ6bCbXifAJ3mUU6Hw=
|
||||
github.com/minio/selfupdate v0.3.1 h1:BWEFSNnrZVMUWXbXIgLDNDjbejkmpAmZvy/nCz1HlEs=
|
||||
github.com/minio/selfupdate v0.3.1/go.mod h1:b8ThJzzH7u2MkF6PcIra7KaXO9Khf6alWPvMSyTDCFM=
|
||||
github.com/minio/sha256-simd v0.1.1 h1:5QHSlgo3nt5yKOJrC7W8w7X+NFl8cMPZm96iu8kKUJU=
|
||||
github.com/minio/sha256-simd v0.1.1/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM=
|
||||
github.com/minio/simdjson-go v0.1.5 h1:6T5mHh7r3kUvgwhmFWQAjoPV5Yt5oD/VPjAI9ViH1kM=
|
||||
github.com/minio/simdjson-go v0.1.5/go.mod h1:oKURrZZEBtqObgJrSjN1Ln2n9MJj2icuBTkeJzZnvSI=
|
||||
github.com/minio/sio v0.2.0 h1:NCRCFLx0r5pRbXf65LVNjxbCGZgNQvNFQkgX3XF4BoA=
|
||||
github.com/minio/sio v0.2.0/go.mod h1:nKM5GIWSrqbOZp0uhyj6M1iA0X6xQzSGtYSaTKSCut0=
|
||||
|
||||
Reference in New Issue
Block a user