From 699fef215987bcf7f2459b9843ce8641900135f7 Mon Sep 17 00:00:00 2001 From: jojoliang Date: Sun, 19 Jan 2020 16:48:48 +0800 Subject: [PATCH] update batch --- batch_test.go | 20 ++++++++++---------- costesting/ci_test.go | 6 +++--- example/batch/create_job.go | 9 +++++---- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/batch_test.go b/batch_test.go index e54bbe8..8421486 100644 --- a/batch_test.go +++ b/batch_test.go @@ -8,7 +8,7 @@ import ( "reflect" "testing" - "github.com/google/uuid" + "github.com/google/uuid" ) func TestBatchService_CreateJob(t *testing.T) { @@ -21,7 +21,7 @@ func TestBatchService_CreateJob(t *testing.T) { Manifest: &BatchJobManifest{ Location: &BatchJobManifestLocation{ ETag: "15150651828fa9cdcb8356b6d1c7638b", - ObjectArn: "qcs::cos:ap-chengdu::sourcebucket-1250000000/manifests/batch-copy-manifest.csv", + ObjectArn: "qcs::cos:ap-chengdu:uid/1250000000:sourcebucket-1250000000/manifests/batch-copy-manifest.csv", }, Spec: &BatchJobManifestSpec{ Fields: []string{"Bucket", "Key"}, @@ -30,12 +30,12 @@ func TestBatchService_CreateJob(t *testing.T) { }, Operation: &BatchJobOperation{ PutObjectCopy: &BatchJobOperationCopy{ - TargetResource: "qcs::cos:ap-chengdu::destinationbucket-1250000000", + TargetResource: "qcs::cos:ap-chengdu:uid/1250000000:destinationbucket-1250000000", }, }, Priority: 1, Report: &BatchJobReport{ - Bucket: "qcs::cos:ap-chengdu::sourcebucket-1250000000", + Bucket: "qcs::cos:ap-chengdu:uid/1250000000:sourcebucket-1250000000", Enabled: "true", Format: "Report_CSV_V1", Prefix: "job-result", @@ -104,7 +104,7 @@ func TestBatchService_DescribeJob(t *testing.T) { "15150651828fa9cdcb8356b6d1c7638b" - qcs::cos:ap-chengdu::sourcebucket-1250000000/manifests/batch-copy-manifest.csv + qcs::cos:ap-chengdu:uid/1250000000:sourcebucket-1250000000/manifests/batch-copy-manifest.csv @@ -116,7 +116,7 @@ func TestBatchService_DescribeJob(t *testing.T) { - qcs::cos:ap-chengdu::destinationbucket-1250000000 + qcs::cos:ap-chengdu:uid/1250000000:destinationbucket-1250000000 10 @@ -126,7 +126,7 @@ func TestBatchService_DescribeJob(t *testing.T) { 10 - qcs::cos:ap-chengdu::sourcebucket-1250000000 + qcs::cos:ap-chengdu:uid/1250000000:sourcebucket-1250000000 true Report_CSV_V1 job-result @@ -159,7 +159,7 @@ func TestBatchService_DescribeJob(t *testing.T) { Manifest: &BatchJobManifest{ Location: &BatchJobManifestLocation{ ETag: "\"15150651828fa9cdcb8356b6d1c7638b\"", - ObjectArn: "qcs::cos:ap-chengdu::sourcebucket-1250000000/manifests/batch-copy-manifest.csv", + ObjectArn: "qcs::cos:ap-chengdu:uid/1250000000:sourcebucket-1250000000/manifests/batch-copy-manifest.csv", }, Spec: &BatchJobManifestSpec{ Fields: []string{"Bucket", "Key"}, @@ -168,7 +168,7 @@ func TestBatchService_DescribeJob(t *testing.T) { }, Operation: &BatchJobOperation{ PutObjectCopy: &BatchJobOperationCopy{ - TargetResource: "qcs::cos:ap-chengdu::destinationbucket-1250000000", + TargetResource: "qcs::cos:ap-chengdu:uid/1250000000:destinationbucket-1250000000", }, }, Priority: 10, @@ -178,7 +178,7 @@ func TestBatchService_DescribeJob(t *testing.T) { TotalNumberOfTasks: 10, }, Report: &BatchJobReport{ - Bucket: "qcs::cos:ap-chengdu::sourcebucket-1250000000", + Bucket: "qcs::cos:ap-chengdu:uid/1250000000:sourcebucket-1250000000", Enabled: "true", Format: "Report_CSV_V1", Prefix: "job-result", diff --git a/costesting/ci_test.go b/costesting/ci_test.go index 79389f4..01d5006 100644 --- a/costesting/ci_test.go +++ b/costesting/ci_test.go @@ -751,7 +751,7 @@ func (s *CosTestSuite) TestBatch() { Manifest: &cos.BatchJobManifest{ Location: &cos.BatchJobManifestLocation{ ETag: etag, - ObjectArn: "qcs::cos:" + kBatchRegion + "::" + kBatchBucket + "/" + manifest_name, + ObjectArn: "qcs::cos:" + kBatchRegion + ":uid/" + s.Appid + ":" + kBatchBucket + "/" + manifest_name, }, Spec: &cos.BatchJobManifestSpec{ Fields: []string{"Bucket", "Key"}, @@ -760,12 +760,12 @@ func (s *CosTestSuite) TestBatch() { }, Operation: &cos.BatchJobOperation{ PutObjectCopy: &cos.BatchJobOperationCopy{ - TargetResource: "qcs::cos:" + kBatchRegion + "::" + kTargetBatchBucket, + TargetResource: "qcs::cos:" + kBatchRegion + ":uid/" + s.Appid + ":" + kTargetBatchBucket, }, }, Priority: 1, Report: &cos.BatchJobReport{ - Bucket: "qcs::cos:" + kBatchRegion + "::" + kBatchBucket, + Bucket: "qcs::cos:" + kBatchRegion + ":uid/" + s.Appid + ":" + kBatchBucket, Enabled: "true", Format: "Report_CSV_V1", Prefix: "job-result", diff --git a/example/batch/create_job.go b/example/batch/create_job.go index 63d3720..223f6bb 100644 --- a/example/batch/create_job.go +++ b/example/batch/create_job.go @@ -2,20 +2,21 @@ package main import ( "context" + "fmt" "net/http" "net/url" "os" + "strconv" "strings" - "fmt" + "github.com/google/uuid" "github.com/tencentyun/cos-go-sdk-v5" "github.com/tencentyun/cos-go-sdk-v5/debug" - "github.com/google/uuid" ) func main() { test_batch_bucket := "testcd-1259654469" - target_batch_bucket := "targetcd-1259654469" + target_batch_bucket := "cosgosdkreptest-1259654469" appid := 1259654469 uin := "100010805041" region := "ap-chengdu" @@ -73,7 +74,7 @@ func main() { }, Operation: &cos.BatchJobOperation{ PutObjectCopy: &cos.BatchJobOperationCopy{ - TargetResource: "qcs::cos:" + region + "::" + target_batch_bucket, + TargetResource: "qcs::cos:" + region + ":uid/" + strconv.Itoa(appid) + ":" + target_batch_bucket, }, }, Priority: 1,