Skip to content

guoyao/baiducloud-sdk-go

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Go SDK for Baidu Cloud

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%