Refresh a media asset upload credential

Updated at:

You can call the RefreshUploadMedia operation by using a server SDK to refresh a media asset upload credential.

Sample code

You can debug this operation online in the Alibaba Cloud OpenAPI Developer Portal.

package main

import (
    "fmt"
    openapi "github.com/alibabacloud-go/darabonba-openapi/v2/client"
    ice "github.com/alibabacloud-go/ice-20201109/v2/client"
    "github.com/aliyun/credentials-go/credentials"
    "github.com/alibabacloud-go/tea/tea"
)

func main() {

    // An AccessKey of an Alibaba Cloud account has full access permissions for all APIs. For security, use a Resource Access Management (RAM) user for API calls or routine O&M.
    // This example shows how to store the AccessKey ID and AccessKey secret in environment variables. For more information, see https://help.aliyun.com/document_detail/378661.html.
    credential, _err := credentials.NewCredential(nil)
    if _err != nil {
      panic(_err)
    }
    iceClient, _err := ice.NewClient(&openapi.Config{
      Credential: credential,
      Endpoint: tea.String("ice.cn-shanghai.aliyuncs.com"),
    })

    // To hard-code your AccessKey ID and AccessKey secret, use the following code. Do not store your AccessKey ID and AccessKey secret in your project code. Storing them in your code may lead to an AccessKey leak, which compromises the security of all resources in your account.
    // config := new(openapi.Config)
    // config.SetAccessKeyId("<accessKeyId>").
    //     SetAccessKeySecret("<accessKeySecret>").
    //     SetRegionId("<regionId>").
    //     SetEndpoint("<endpoint>")
    // iceClient, _err := ice.NewClient(config)

    if _err != nil {
      panic(_err)
    }

    // Refresh the media asset upload credential.
    mediaId := "09c6aa40491c71ed9520472190a9xxxx"
    request := &ice.RefreshUploadMediaRequest{
        MediaId: &mediaId,
    }
    response, err := iceClient.RefreshUploadMedia(request)
    fmt.Println(response, err)
}

Related API operations

RefreshUploadMedia - Refresh a media asset upload credential