baiducloud-sdk-go

module
v0.0.0-...-5b6f272 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2019 License: Apache-2.0

README

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.

Directories

Path Synopsis
Package bce defined a set of core data structure and functions for Baidu Cloud API.
Package bce defined a set of core data structure and functions for Baidu Cloud API.
Package bos defined a set of core data structure and functions for Baidu Cloud BOS API.
Package bos defined a set of core data structure and functions for Baidu Cloud BOS API.
example
Package util implements a set of util functions.
Package util implements a set of util functions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL