in oss/lib/bucket_replication.go [259:304]
func (replicationc *ReplicationCommand) RunCommand() error {
strMethod, _ := GetString(OptionMethod, replicationc.command.options)
strItem, _ := GetString(OptionItem, replicationc.command.options)
if strMethod == "" {
return fmt.Errorf("--method value is empty")
}
strMethod = strings.ToLower(strMethod)
if strMethod != "put" && strMethod != "get" && strMethod != "delete" {
return fmt.Errorf("--method value is not in the optional value:put|get|delete")
}
strItem = strings.ToLower(strItem)
if strMethod == "get" && strItem != "" && strItem != "location" && strItem != "progress" {
return fmt.Errorf("--item value is not in the optional value:location|progress")
}
srcBucketUrL, err := GetCloudUrl(replicationc.command.args[0], "")
if err != nil {
return err
}
replicationc.bucketName = srcBucketUrL.bucket
switch strMethod {
case "put":
switch strItem {
case "":
err = replicationc.PutBucketReplication()
case "rtc":
err = replicationc.PutBucketRTC()
}
case "get":
switch strItem {
case "":
err = replicationc.GetBucketReplication()
case "location":
err = replicationc.GetBucketReplicationLocation()
case "progress":
err = replicationc.GetBucketReplicationProgress()
}
case "delete":
err = replicationc.DeleteBucketReplication()
}
return err
}