Global Acceleration

Last updated: 2021-05-25 16:22:15

    Overview

    This document provides an overview of APIs and SDK code samples related to global acceleration.

    API Operation Description
    PUT Bucket Accelerate Setting global acceleration Enables/Suspends global acceleration for a bucket
    GET Bucket Accelerate Querying global acceleration Queries the global acceleration configuration of a bucket

    Setting Global Acceleration

    API description

    This API is used to enable or suspend global acceleration.

    Method prototype

    func (s *BucketService) PutAccelerate(ctx context.Context, opt *BucketPutAccelerateOptions) (*Response, error)

    Sample request

    opt := &cos.BucketPutAccelerateOptions{
       Status: "Enabled",
       Type:   "COS",
    }
    _, err = c.Bucket.PutAccelerate(context.Background(), opt)
    if err != nil {
       // ERROR
    }

    Parameter description

    type BucketPutAccelerateOptions struct {
      Status  string
    }
    Parameter Description Type Required
    Status Whether to enable global acceleration. Valid values: Suspended, Enabled string Yes

    Querying global acceleration

    API description

    This API is used to query the global acceleration configuration of a bucket.

    Method prototype

    func (s *BucketService) GetAccelerate(ctx context.Context) (*BucketGetAccelerateResult, *Response, error)

    Sample request

    res, _, err = c.Bucket.GetAccelerate(context.Background())
    if err != nil {
       // ERROR
    }

    Response description

    type BucketGetAccelerateResult struct {
      Status  string
    }
    Parameter Description Type Required
    Status Whether global acceleration is enabled. Valid values: Suspended, Enabled string Yes