Skip to content

Commit

Permalink
update batch
Browse files Browse the repository at this point in the history
  • Loading branch information
jojoliang committed Jan 19, 2020
1 parent 156deae commit 699fef2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
20 changes: 10 additions & 10 deletions batch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"reflect"
"testing"

"github.com/google/uuid"
"github.com/google/uuid"
)

func TestBatchService_CreateJob(t *testing.T) {
Expand All @@ -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"},
Expand All @@ -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",
Expand Down Expand Up @@ -104,7 +104,7 @@ func TestBatchService_DescribeJob(t *testing.T) {
<Manifest>
<Location>
<ETag>&quot;15150651828fa9cdcb8356b6d1c7638b&quot;</ETag>
<ObjectArn>qcs::cos:ap-chengdu::sourcebucket-1250000000/manifests/batch-copy-manifest.csv</ObjectArn>
<ObjectArn>qcs::cos:ap-chengdu:uid/1250000000:sourcebucket-1250000000/manifests/batch-copy-manifest.csv</ObjectArn>
</Location>
<Spec>
<Fields>
Expand All @@ -116,7 +116,7 @@ func TestBatchService_DescribeJob(t *testing.T) {
</Manifest>
<Operation>
<COSPutObjectCopy>
<TargetResource>qcs::cos:ap-chengdu::destinationbucket-1250000000</TargetResource>
<TargetResource>qcs::cos:ap-chengdu:uid/1250000000:destinationbucket-1250000000</TargetResource>
</COSPutObjectCopy>
</Operation>
<Priority>10</Priority>
Expand All @@ -126,7 +126,7 @@ func TestBatchService_DescribeJob(t *testing.T) {
<TotalNumberOfTasks>10</TotalNumberOfTasks>
</ProgressSummary>
<Report>
<Bucket>qcs::cos:ap-chengdu::sourcebucket-1250000000</Bucket>
<Bucket>qcs::cos:ap-chengdu:uid/1250000000:sourcebucket-1250000000</Bucket>
<Enabled>true</Enabled>
<Format>Report_CSV_V1</Format>
<Prefix>job-result</Prefix>
Expand Down Expand Up @@ -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"},
Expand All @@ -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,
Expand All @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions costesting/ci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand All @@ -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",
Expand Down
9 changes: 5 additions & 4 deletions example/batch/create_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 699fef2

Please sign in to comment.