Skip to content

Latest commit

 

History

History
34 lines (26 loc) · 907 Bytes

get_bucket_external_mirror.md

File metadata and controls

34 lines (26 loc) · 907 Bytes

GET Bucket External Mirror

Code Snippet

Initialize the Qingstor object with your AccessKeyID and SecretAccessKey.

import (
	"github.com/qingstor/qingstor-sdk-go/v4/config"
	"github.com/qingstor/qingstor-sdk-go/v4/service"
)

var conf, _ = config.New("YOUR-ACCESS-KEY-ID", "YOUR--SECRET-ACCESS-KEY")
var qingStor, _ = service.Init(conf)

Initialize a Bucket object according to the bucket name you set for subsequent creation:

bucketName := "your-bucket-name"
zoneName := "pek3b"
bucketService, _ := qingStor.Bucket(bucketName, zoneName)

then you can GET Bucket External Mirror

	if output, err := bucketService.GetExternalMirror(); err != nil {
		fmt.Printf("Get external mirror of bucket(name: %s) failed with given error: %s\n", bucketName, err)
	} else {
		b, _ := json.Marshal(output.SourceSite)
		fmt.Println("The external mirror of this bucket: ", string(b))
	}