Skip to content

Latest commit

 

History

History
69 lines (53 loc) · 2.17 KB

README.md

File metadata and controls

69 lines (53 loc) · 2.17 KB

BaiduCloud SDK for Go

GoDoc Build Status Go Report Card

This sdk is still under development and may be changed frequently.

baiudcloud-sdk-go is the official BaiudCloud SDK for the Go programming language, supporting convenient access to cloud resources, including Baidu Cloud Compute (BCC), Baidu Load Balancer (BLB), Baidu Object Storage (BOS), Cloud Disk Service (CDS), Elastic IP (EIP), Virtual Private Cloud (VPC), etc.

Installing

Go >= 1.8 is required.

go get -u github.com/baidu/baiducloud-sdk-go/...

Usage

This example shows a complete example to list all eips in some region.

package main

import (
	"fmt"
	"time"

	"github.com/baidu/baiducloud-sdk-go/bce"
	"github.com/baidu/baiducloud-sdk-go/eip"
)

func main() {
	cred, err := bce.NewCredentialsFromFile("example/main/aksk.json")
	if err != nil {
		panic(err)
	}
	bceConf := &bce.Config{
		Credentials: cred,
		Checksum:    true,
		Timeout:     5 * time.Second,
		Region:      "bj",
	}

	eipClient := eip.NewEIPClient(bceConf)
	eipClient.SetDebug(true)
	eips, err := eipClient.GetEips(nil, nil)
	if err != nil {
		panic(err)
	}
	for idx, ip := range eips {
		fmt.Printf("%d, %s\n", idx, ip.Eip)
	}
	return
}

Contributors

  • Guoyao Wu @guoyao
  • Guoyan Chen @drinktee
  • Yuxiao Song
  • Hongbin Mao @hello2mao
  • Yang Meng @m3ngyang
  • Weidong Cai @cwdsuzhou

License

This SDK is distributed under the Apache License, Version 2.0.