This topic describes how to install SDKs for Go and provides sample code.

Background information

  • Alibaba Cloud provides OpenAPI Explorer to simplify API usage. You can use OpenAPI Explorer to debug API operations and dynamically generate SDK sample code.
  • For more information about Resource Management API operations, see List of operations by function.

Installation

For information about how to install the SDKs for Go, see Get started.

You can download the installation packages of the SDKs for Go from the following links:

Example

The following example shows how to use Resource Management SDK for Go to call the CreateResourceAccount API operation. You can visit OpenAPI Explorer to debug other API operations and obtain their sample code.

package main

import (
    "fmt"
    "github.com/aliyun/alibaba-cloud-sdk-go/services/resourcemanager"

)

func main() {
    // Construct an Alibaba Cloud client that is used to initiate requests.
    // When you construct the client, specify your AccessKey ID and AccessKey secret.
    client, err := resourcemanager.NewClientWithAccessKey("cn-shanghai", "<accessKeyId>", "<accessSecret>")

    // Construct the request object.
    request := resourcemanager.CreateResourceAccountRequest()
    request.Scheme = "https"

    // Configure parameters.
    request.DisplayName = "<DisplayName>"

    // Initiate a request and obtain a response.
    response, err := client.CreateResourceAccount(request)
    if err ! = nil {
        fmt.Print(err.Error())
    }
    fmt.Printf("response is %#v\n", response)
}