Merge pull request #5641 from zhuzhih2017/master
Add security token supported and TLS handshake timeout support
This commit is contained in:
commit
bdc1fa0527
|
@ -15,6 +15,7 @@ type AlicloudAccessConfig struct {
|
|||
AlicloudSecretKey string `mapstructure:"secret_key"`
|
||||
AlicloudRegion string `mapstructure:"region"`
|
||||
AlicloudSkipValidation bool `mapstructure:"skip_region_validation"`
|
||||
SecurityToken string `mapstructure:"security_token"`
|
||||
}
|
||||
|
||||
// Client for AlicloudClient
|
||||
|
@ -22,7 +23,12 @@ func (c *AlicloudAccessConfig) Client() (*ecs.Client, error) {
|
|||
if err := c.loadAndValidate(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := ecs.NewECSClient(c.AlicloudAccessKey, c.AlicloudSecretKey, common.Region(c.AlicloudRegion))
|
||||
if c.SecurityToken == "" {
|
||||
c.SecurityToken = os.Getenv("SECURITY_TOKEN")
|
||||
}
|
||||
client := ecs.NewECSClientWithSecurityToken(c.AlicloudAccessKey, c.AlicloudSecretKey,
|
||||
c.SecurityToken, common.Region(c.AlicloudRegion))
|
||||
|
||||
client.SetBusinessInfo("Packer")
|
||||
if _, err := client.DescribeRegions(); err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
"secret_key":"{{user `secret_key`}}",
|
||||
"region":"cn-beijing",
|
||||
"image_name":"packer_basic",
|
||||
"source_image":"centos_7_2_64_40G_base_20170222.vhd",
|
||||
"source_image":"centos_7_03_64_20G_alibase_20170818.vhd",
|
||||
"ssh_username":"root",
|
||||
"instance_type":"ecs.n1.tiny",
|
||||
"internet_charge_type":"PayByTraffic",
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
"secret_key":"{{user `secret_key`}}",
|
||||
"region":"cn-beijing",
|
||||
"image_name":"packer_with_data_disk",
|
||||
"source_image":"centos_7_2_64_40G_base_20170222.vhd",
|
||||
"source_image":"centos_7_03_64_20G_alibase_20170818.vhd",
|
||||
"ssh_username":"root",
|
||||
"instance_type":"ecs.n1.tiny",
|
||||
"internet_charge_type":"PayByTraffic",
|
||||
|
|
|
@ -3,12 +3,16 @@ package common
|
|||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"github.com/denverdino/aliyungo/util"
|
||||
)
|
||||
|
@ -25,6 +29,7 @@ type UnderlineString string
|
|||
type Client struct {
|
||||
AccessKeyId string //Access Key Id
|
||||
AccessKeySecret string //Access Key Secret
|
||||
securityToken string
|
||||
debug bool
|
||||
httpClient *http.Client
|
||||
endpoint string
|
||||
|
@ -32,19 +37,30 @@ type Client struct {
|
|||
serviceCode string
|
||||
regionID Region
|
||||
businessInfo string
|
||||
userAgent string
|
||||
userAgent string
|
||||
}
|
||||
|
||||
// NewClient creates a new instance of ECS client
|
||||
// Initialize properties of a client instance
|
||||
func (client *Client) Init(endpoint, version, accessKeyId, accessKeySecret string) {
|
||||
client.AccessKeyId = accessKeyId
|
||||
client.AccessKeySecret = accessKeySecret + "&"
|
||||
client.debug = false
|
||||
client.httpClient = &http.Client{}
|
||||
handshakeTimeout, err := strconv.Atoi(os.Getenv("TLSHandshakeTimeout"))
|
||||
if err != nil {
|
||||
handshakeTimeout = 0
|
||||
}
|
||||
if handshakeTimeout == 0 {
|
||||
client.httpClient = &http.Client{}
|
||||
} else {
|
||||
t := &http.Transport{
|
||||
TLSHandshakeTimeout: time.Duration(handshakeTimeout) * time.Second,}
|
||||
client.httpClient = &http.Client{Transport: t,}
|
||||
}
|
||||
client.endpoint = endpoint
|
||||
client.version = version
|
||||
}
|
||||
|
||||
// Initialize properties of a client instance including regionID
|
||||
func (client *Client) NewInit(endpoint, version, accessKeyId, accessKeySecret, serviceCode string, regionID Region) {
|
||||
client.Init(endpoint, version, accessKeyId, accessKeySecret)
|
||||
client.serviceCode = serviceCode
|
||||
|
@ -52,6 +68,24 @@ func (client *Client) NewInit(endpoint, version, accessKeyId, accessKeySecret, s
|
|||
client.setEndpointByLocation(regionID, serviceCode, accessKeyId, accessKeySecret)
|
||||
}
|
||||
|
||||
// Intialize client object when all properties are ready
|
||||
func (client *Client) InitClient() *Client {
|
||||
client.debug = false
|
||||
handshakeTimeout, err := strconv.Atoi(os.Getenv("TLSHandshakeTimeout"))
|
||||
if err != nil {
|
||||
handshakeTimeout = 0
|
||||
}
|
||||
if handshakeTimeout == 0 {
|
||||
client.httpClient = &http.Client{}
|
||||
} else {
|
||||
t := &http.Transport{
|
||||
TLSHandshakeTimeout: time.Duration(handshakeTimeout) * time.Second,}
|
||||
client.httpClient = &http.Client{Transport: t,}
|
||||
}
|
||||
client.setEndpointByLocation(client.regionID, client.serviceCode, client.AccessKeyId, client.AccessKeySecret)
|
||||
return client
|
||||
}
|
||||
|
||||
//NewClient using location service
|
||||
func (client *Client) setEndpointByLocation(region Region, serviceCode, accessKeyId, accessKeySecret string) {
|
||||
locationClient := NewLocationClient(accessKeyId, accessKeySecret)
|
||||
|
@ -65,6 +99,95 @@ func (client *Client) setEndpointByLocation(region Region, serviceCode, accessKe
|
|||
}
|
||||
}
|
||||
|
||||
// Ensure all necessary properties are valid
|
||||
func (client *Client) ensureProperties() error {
|
||||
var msg string
|
||||
|
||||
if client.endpoint == "" {
|
||||
msg = fmt.Sprintf("endpoint cannot be empty!")
|
||||
} else if client.version == "" {
|
||||
msg = fmt.Sprintf("version cannot be empty!")
|
||||
} else if client.AccessKeyId == "" {
|
||||
msg = fmt.Sprintf("AccessKeyId cannot be empty!")
|
||||
} else if client.AccessKeySecret == "" {
|
||||
msg = fmt.Sprintf("AccessKeySecret cannot be empty!")
|
||||
}
|
||||
|
||||
if msg != "" {
|
||||
return errors.New(msg)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ----------------------------------------------------
|
||||
// WithXXX methods
|
||||
// ----------------------------------------------------
|
||||
|
||||
// WithEndpoint sets custom endpoint
|
||||
func (client *Client) WithEndpoint(endpoint string) *Client {
|
||||
client.SetEndpoint(endpoint)
|
||||
return client
|
||||
}
|
||||
|
||||
// WithVersion sets custom version
|
||||
func (client *Client) WithVersion(version string) *Client {
|
||||
client.SetVersion(version)
|
||||
return client
|
||||
}
|
||||
|
||||
// WithRegionID sets Region ID
|
||||
func (client *Client) WithRegionID(regionID Region) *Client {
|
||||
client.SetRegionID(regionID)
|
||||
return client
|
||||
}
|
||||
|
||||
//WithServiceCode sets serviceCode
|
||||
func (client *Client) WithServiceCode(serviceCode string) *Client {
|
||||
client.SetServiceCode(serviceCode)
|
||||
return client
|
||||
}
|
||||
|
||||
// WithAccessKeyId sets new AccessKeyId
|
||||
func (client *Client) WithAccessKeyId(id string) *Client {
|
||||
client.SetAccessKeyId(id)
|
||||
return client
|
||||
}
|
||||
|
||||
// WithAccessKeySecret sets new AccessKeySecret
|
||||
func (client *Client) WithAccessKeySecret(secret string) *Client {
|
||||
client.SetAccessKeySecret(secret)
|
||||
return client
|
||||
}
|
||||
|
||||
// WithSecurityToken sets securityToken
|
||||
func (client *Client) WithSecurityToken(securityToken string) *Client {
|
||||
client.SetSecurityToken(securityToken)
|
||||
return client
|
||||
}
|
||||
|
||||
// WithDebug sets debug mode to log the request/response message
|
||||
func (client *Client) WithDebug(debug bool) *Client {
|
||||
client.SetDebug(debug)
|
||||
return client
|
||||
}
|
||||
|
||||
// WithBusinessInfo sets business info to log the request/response message
|
||||
func (client *Client) WithBusinessInfo(businessInfo string) *Client {
|
||||
client.SetBusinessInfo(businessInfo)
|
||||
return client
|
||||
}
|
||||
|
||||
// WithUserAgent sets user agent to the request/response message
|
||||
func (client *Client) WithUserAgent(userAgent string) *Client {
|
||||
client.SetUserAgent(userAgent)
|
||||
return client
|
||||
}
|
||||
|
||||
// ----------------------------------------------------
|
||||
// SetXXX methods
|
||||
// ----------------------------------------------------
|
||||
|
||||
// SetEndpoint sets custom endpoint
|
||||
func (client *Client) SetEndpoint(endpoint string) {
|
||||
client.endpoint = endpoint
|
||||
|
@ -75,6 +198,7 @@ func (client *Client) SetVersion(version string) {
|
|||
client.version = version
|
||||
}
|
||||
|
||||
// SetEndpoint sets Region ID
|
||||
func (client *Client) SetRegionID(regionID Region) {
|
||||
client.regionID = regionID
|
||||
}
|
||||
|
@ -94,6 +218,11 @@ func (client *Client) SetAccessKeySecret(secret string) {
|
|||
client.AccessKeySecret = secret + "&"
|
||||
}
|
||||
|
||||
// SetAccessKeySecret sets securityToken
|
||||
func (client *Client) SetSecurityToken(securityToken string) {
|
||||
client.securityToken = securityToken
|
||||
}
|
||||
|
||||
// SetDebug sets debug mode to log the request/response message
|
||||
func (client *Client) SetDebug(debug bool) {
|
||||
client.debug = debug
|
||||
|
@ -115,9 +244,12 @@ func (client *Client) SetUserAgent(userAgent string) {
|
|||
|
||||
// Invoke sends the raw HTTP request for ECS services
|
||||
func (client *Client) Invoke(action string, args interface{}, response interface{}) error {
|
||||
if err := client.ensureProperties(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
request := Request{}
|
||||
request.init(client.version, action, client.AccessKeyId)
|
||||
request.init(client.version, action, client.AccessKeyId, client.securityToken, client.regionID)
|
||||
|
||||
query := util.ConvertToQueryValues(request)
|
||||
util.SetQueryValues(args, &query)
|
||||
|
@ -136,8 +268,7 @@ func (client *Client) Invoke(action string, args interface{}, response interface
|
|||
|
||||
// TODO move to util and add build val flag
|
||||
httpReq.Header.Set("X-SDK-Client", `AliyunGO/`+Version+client.businessInfo)
|
||||
|
||||
httpReq.Header.Set("User-Agent", httpReq.UserAgent()+ " " +client.userAgent)
|
||||
httpReq.Header.Set("User-Agent", httpReq.UserAgent()+" "+client.userAgent)
|
||||
|
||||
t0 := time.Now()
|
||||
httpResp, err := client.httpClient.Do(httpReq)
|
||||
|
@ -185,9 +316,12 @@ func (client *Client) Invoke(action string, args interface{}, response interface
|
|||
|
||||
// Invoke sends the raw HTTP request for ECS services
|
||||
func (client *Client) InvokeByFlattenMethod(action string, args interface{}, response interface{}) error {
|
||||
if err := client.ensureProperties(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
request := Request{}
|
||||
request.init(client.version, action, client.AccessKeyId)
|
||||
request.init(client.version, action, client.AccessKeyId, client.securityToken, client.regionID)
|
||||
|
||||
query := util.ConvertToQueryValues(request)
|
||||
|
||||
|
@ -207,8 +341,7 @@ func (client *Client) InvokeByFlattenMethod(action string, args interface{}, res
|
|||
|
||||
// TODO move to util and add build val flag
|
||||
httpReq.Header.Set("X-SDK-Client", `AliyunGO/`+Version+client.businessInfo)
|
||||
|
||||
httpReq.Header.Set("User-Agent", httpReq.UserAgent()+ " " +client.userAgent)
|
||||
httpReq.Header.Set("User-Agent", httpReq.UserAgent()+" "+client.userAgent)
|
||||
|
||||
t0 := time.Now()
|
||||
httpResp, err := client.httpClient.Do(httpReq)
|
||||
|
@ -258,9 +391,12 @@ func (client *Client) InvokeByFlattenMethod(action string, args interface{}, res
|
|||
//改进了一下上面那个方法,可以使用各种Http方法
|
||||
//2017.1.30 增加了一个path参数,用来拓展访问的地址
|
||||
func (client *Client) InvokeByAnyMethod(method, action, path string, args interface{}, response interface{}) error {
|
||||
if err := client.ensureProperties(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
request := Request{}
|
||||
request.init(client.version, action, client.AccessKeyId)
|
||||
request.init(client.version, action, client.AccessKeyId, client.securityToken, client.regionID)
|
||||
|
||||
data := util.ConvertToQueryValues(request)
|
||||
util.SetQueryValues(args, &data)
|
||||
|
@ -290,8 +426,7 @@ func (client *Client) InvokeByAnyMethod(method, action, path string, args interf
|
|||
|
||||
// TODO move to util and add build val flag
|
||||
httpReq.Header.Set("X-SDK-Client", `AliyunGO/`+Version+client.businessInfo)
|
||||
|
||||
httpReq.Header.Set("User-Agent", httpReq.Header.Get("User-Agent")+ " " +client.userAgent)
|
||||
httpReq.Header.Set("User-Agent", httpReq.Header.Get("User-Agent")+" "+client.userAgent)
|
||||
|
||||
t0 := time.Now()
|
||||
httpResp, err := client.httpClient.Do(httpReq)
|
||||
|
|
|
@ -16,6 +16,7 @@ const (
|
|||
APSouthEast1 = Region("ap-southeast-1")
|
||||
APNorthEast1 = Region("ap-northeast-1")
|
||||
APSouthEast2 = Region("ap-southeast-2")
|
||||
APSouthEast3 = Region("ap-southeast-3")
|
||||
|
||||
USWest1 = Region("us-west-1")
|
||||
USEast1 = Region("us-east-1")
|
||||
|
@ -28,7 +29,7 @@ const (
|
|||
var ValidRegions = []Region{
|
||||
Hangzhou, Qingdao, Beijing, Shenzhen, Hongkong, Shanghai, Zhangjiakou,
|
||||
USWest1, USEast1,
|
||||
APNorthEast1, APSouthEast1, APSouthEast2,
|
||||
APNorthEast1, APSouthEast1, APSouthEast2, APSouthEast3,
|
||||
MEEast1,
|
||||
EUCentral1,
|
||||
}
|
||||
|
|
|
@ -20,7 +20,9 @@ const (
|
|||
type Request struct {
|
||||
Format string
|
||||
Version string
|
||||
RegionId Region
|
||||
AccessKeyId string
|
||||
SecurityToken string
|
||||
Signature string
|
||||
SignatureMethod string
|
||||
Timestamp util.ISO6801Time
|
||||
|
@ -30,7 +32,7 @@ type Request struct {
|
|||
Action string
|
||||
}
|
||||
|
||||
func (request *Request) init(version string, action string, AccessKeyId string) {
|
||||
func (request *Request) init(version string, action string, AccessKeyId string, securityToken string, regionId Region) {
|
||||
request.Format = JSONResponseFormat
|
||||
request.Timestamp = util.NewISO6801Time(time.Now().UTC())
|
||||
request.Version = version
|
||||
|
@ -39,6 +41,8 @@ func (request *Request) init(version string, action string, AccessKeyId string)
|
|||
request.SignatureNonce = util.CreateRandomString()
|
||||
request.Action = action
|
||||
request.AccessKeyId = AccessKeyId
|
||||
request.SecurityToken = securityToken
|
||||
request.RegionId = regionId
|
||||
}
|
||||
|
||||
type Response struct {
|
||||
|
|
|
@ -20,8 +20,7 @@ const (
|
|||
// ECSDefaultEndpoint is the default API endpoint of ECS services
|
||||
ECSDefaultEndpoint = "https://ecs-cn-hangzhou.aliyuncs.com"
|
||||
ECSAPIVersion = "2014-05-26"
|
||||
|
||||
ECSServiceCode = "ecs"
|
||||
ECSServiceCode = "ecs"
|
||||
|
||||
VPCDefaultEndpoint = "https://vpc.aliyuncs.com"
|
||||
VPCAPIVersion = "2016-04-28"
|
||||
|
@ -37,38 +36,80 @@ func NewClient(accessKeyId, accessKeySecret string) *Client {
|
|||
return NewClientWithEndpoint(endpoint, accessKeyId, accessKeySecret)
|
||||
}
|
||||
|
||||
func NewECSClient(accessKeyId, accessKeySecret string, regionID common.Region) *Client {
|
||||
endpoint := os.Getenv("ECS_ENDPOINT")
|
||||
if endpoint == "" {
|
||||
endpoint = ECSDefaultEndpoint
|
||||
}
|
||||
|
||||
return NewClientWithRegion(endpoint, accessKeyId, accessKeySecret, regionID)
|
||||
}
|
||||
|
||||
func NewClientWithRegion(endpoint string, accessKeyId, accessKeySecret string, regionID common.Region) *Client {
|
||||
func NewClientWithRegion(endpoint string, accessKeyId string, accessKeySecret string, regionID common.Region) *Client {
|
||||
client := &Client{}
|
||||
client.NewInit(endpoint, ECSAPIVersion, accessKeyId, accessKeySecret, ECSServiceCode, regionID)
|
||||
return client
|
||||
}
|
||||
|
||||
func NewClientWithEndpoint(endpoint string, accessKeyId, accessKeySecret string) *Client {
|
||||
func NewClientWithEndpoint(endpoint string, accessKeyId string, accessKeySecret string) *Client {
|
||||
client := &Client{}
|
||||
client.Init(endpoint, ECSAPIVersion, accessKeyId, accessKeySecret)
|
||||
return client
|
||||
}
|
||||
|
||||
func NewVPCClient(accessKeyId, accessKeySecret string, regionID common.Region) *Client {
|
||||
// ---------------------------------------
|
||||
// NewECSClient creates a new instance of ECS client
|
||||
// ---------------------------------------
|
||||
func NewECSClient(accessKeyId, accessKeySecret string, regionID common.Region) *Client {
|
||||
return NewECSClientWithSecurityToken(accessKeyId, accessKeySecret, "", regionID)
|
||||
}
|
||||
|
||||
func NewECSClientWithSecurityToken(accessKeyId string, accessKeySecret string, securityToken string, regionID common.Region) *Client {
|
||||
endpoint := os.Getenv("ECS_ENDPOINT")
|
||||
if endpoint == "" {
|
||||
endpoint = ECSDefaultEndpoint
|
||||
}
|
||||
|
||||
return NewECSClientWithEndpointAndSecurityToken(endpoint, accessKeyId, accessKeySecret, securityToken, regionID)
|
||||
}
|
||||
|
||||
func NewECSClientWithEndpoint(endpoint string, accessKeyId string, accessKeySecret string, regionID common.Region) *Client {
|
||||
return NewECSClientWithEndpointAndSecurityToken(endpoint, accessKeyId, accessKeySecret, "", regionID)
|
||||
}
|
||||
|
||||
func NewECSClientWithEndpointAndSecurityToken(endpoint string, accessKeyId string, accessKeySecret string, securityToken string, regionID common.Region) *Client {
|
||||
client := &Client{}
|
||||
client.WithEndpoint(endpoint).
|
||||
WithVersion(ECSAPIVersion).
|
||||
WithAccessKeyId(accessKeyId).
|
||||
WithAccessKeySecret(accessKeySecret).
|
||||
WithSecurityToken(securityToken).
|
||||
WithServiceCode(ECSServiceCode).
|
||||
WithRegionID(regionID).
|
||||
InitClient()
|
||||
return client
|
||||
}
|
||||
|
||||
// ---------------------------------------
|
||||
// NewVPCClient creates a new instance of VPC client
|
||||
// ---------------------------------------
|
||||
func NewVPCClient(accessKeyId string, accessKeySecret string, regionID common.Region) *Client {
|
||||
return NewVPCClientWithSecurityToken(accessKeyId, accessKeySecret, "", regionID)
|
||||
}
|
||||
|
||||
func NewVPCClientWithSecurityToken(accessKeyId string, accessKeySecret string, securityToken string, regionID common.Region) *Client {
|
||||
endpoint := os.Getenv("VPC_ENDPOINT")
|
||||
if endpoint == "" {
|
||||
endpoint = VPCDefaultEndpoint
|
||||
}
|
||||
|
||||
return NewVPCClientWithRegion(endpoint, accessKeyId, accessKeySecret, regionID)
|
||||
return NewVPCClientWithEndpointAndSecurityToken(endpoint, accessKeyId, accessKeySecret, securityToken, regionID)
|
||||
}
|
||||
|
||||
func NewVPCClientWithRegion(endpoint string, accessKeyId, accessKeySecret string, regionID common.Region) *Client {
|
||||
func NewVPCClientWithEndpoint(endpoint string, accessKeyId string, accessKeySecret string, regionID common.Region) *Client {
|
||||
return NewVPCClientWithEndpointAndSecurityToken(endpoint, accessKeyId, accessKeySecret, "", regionID)
|
||||
}
|
||||
|
||||
func NewVPCClientWithEndpointAndSecurityToken(endpoint string, accessKeyId string, accessKeySecret string, securityToken string, regionID common.Region) *Client {
|
||||
client := &Client{}
|
||||
client.NewInit(endpoint, VPCAPIVersion, accessKeyId, accessKeySecret, VPCServiceCode, regionID)
|
||||
client.WithEndpoint(endpoint).
|
||||
WithVersion(VPCAPIVersion).
|
||||
WithAccessKeyId(accessKeyId).
|
||||
WithAccessKeySecret(accessKeySecret).
|
||||
WithSecurityToken(securityToken).
|
||||
WithServiceCode(VPCServiceCode).
|
||||
WithRegionID(regionID).
|
||||
InitClient()
|
||||
return client
|
||||
}
|
||||
|
|
|
@ -135,6 +135,7 @@ type CreateDiskArgs struct {
|
|||
ZoneId string
|
||||
DiskName string
|
||||
Description string
|
||||
Encrypted bool
|
||||
DiskCategory DiskCategory
|
||||
Size int
|
||||
SnapshotId string
|
||||
|
@ -240,6 +241,29 @@ func (client *Client) DetachDisk(instanceId string, diskId string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
type ResizeDiskArgs struct {
|
||||
DiskId string
|
||||
NewSize int
|
||||
}
|
||||
|
||||
type ResizeDiskResponse struct {
|
||||
common.Response
|
||||
}
|
||||
|
||||
//
|
||||
// ResizeDisk can only support to enlarge disk size
|
||||
// You can read doc at https://help.aliyun.com/document_detail/25522.html
|
||||
func (client *Client) ResizeDisk(diskId string, sizeGB int) error {
|
||||
args := ResizeDiskArgs{
|
||||
DiskId:diskId,
|
||||
NewSize:sizeGB,
|
||||
}
|
||||
response := ResizeDiskResponse{}
|
||||
err := client.Invoke("ResizeDisk", &args, &response)
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
type ResetDiskArgs struct {
|
||||
DiskId string
|
||||
SnapshotId string
|
||||
|
@ -249,6 +273,7 @@ type ResetDiskResponse struct {
|
|||
common.Response
|
||||
}
|
||||
|
||||
|
||||
// ResetDisk resets disk to original status
|
||||
//
|
||||
// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/disk&resetdisk
|
||||
|
|
|
@ -224,6 +224,7 @@ type SpotStrategyType string
|
|||
const (
|
||||
NoSpot = SpotStrategyType("NoSpot")
|
||||
SpotWithPriceLimit = SpotStrategyType("SpotWithPriceLimit")
|
||||
SpotAsPriceGo = SpotStrategyType("SpotAsPriceGo")
|
||||
)
|
||||
|
||||
//
|
||||
|
@ -244,7 +245,7 @@ type InstanceAttributesType struct {
|
|||
SerialNumber string
|
||||
Status InstanceStatus
|
||||
OperationLocks OperationLocksType
|
||||
SecurityGroupIds struct {
|
||||
SecurityGroupIds struct {
|
||||
SecurityGroupId []string
|
||||
}
|
||||
PublicIpAddress IpAddressSetType
|
||||
|
@ -259,11 +260,12 @@ type InstanceAttributesType struct {
|
|||
IoOptimized StringOrBool
|
||||
InstanceChargeType common.InstanceChargeType
|
||||
ExpiredTime util.ISO6801Time
|
||||
Tags struct {
|
||||
Tags struct {
|
||||
Tag []TagItemType
|
||||
}
|
||||
SpotStrategy SpotStrategyType
|
||||
KeyPairName string
|
||||
SpotStrategy SpotStrategyType
|
||||
SpotPriceLimit float64
|
||||
KeyPairName string
|
||||
}
|
||||
|
||||
type DescribeInstanceAttributeResponse struct {
|
||||
|
@ -535,7 +537,9 @@ type CreateInstanceArgs struct {
|
|||
AutoRenew bool
|
||||
AutoRenewPeriod int
|
||||
SpotStrategy SpotStrategyType
|
||||
SpotPriceLimit float64
|
||||
KeyPairName string
|
||||
RamRoleName string
|
||||
}
|
||||
|
||||
type CreateInstanceResponse struct {
|
||||
|
@ -624,3 +628,57 @@ func (client *Client) LeaveSecurityGroup(instanceId string, securityGroupId stri
|
|||
err := client.Invoke("LeaveSecurityGroup", &args, &response)
|
||||
return err
|
||||
}
|
||||
|
||||
type AttachInstancesArgs struct {
|
||||
RegionId common.Region
|
||||
RamRoleName string
|
||||
InstanceIds string
|
||||
}
|
||||
|
||||
// AttachInstanceRamRole attach instances to ram role
|
||||
//
|
||||
// You can read doc at https://help.aliyun.com/document_detail/54244.html?spm=5176.doc54245.6.811.zEJcS5
|
||||
func (client *Client) AttachInstanceRamRole(args *AttachInstancesArgs) (err error) {
|
||||
response := common.Response{}
|
||||
err = client.Invoke("AttachInstanceRamRole", args, &response)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DetachInstanceRamRole detach instances from ram role
|
||||
//
|
||||
// You can read doc at https://help.aliyun.com/document_detail/54245.html?spm=5176.doc54243.6.813.bt8RB3
|
||||
func (client *Client) DetachInstanceRamRole(args *AttachInstancesArgs) (err error) {
|
||||
response := common.Response{}
|
||||
err = client.Invoke("DetachInstanceRamRole", args, &response)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type DescribeInstanceRamRoleResponse struct {
|
||||
common.Response
|
||||
InstanceRamRoleSets struct {
|
||||
InstanceRamRoleSet []InstanceRamRoleSetType
|
||||
}
|
||||
}
|
||||
|
||||
type InstanceRamRoleSetType struct {
|
||||
InstanceId string
|
||||
RamRoleName string
|
||||
}
|
||||
|
||||
// DescribeInstanceRamRole
|
||||
//
|
||||
// You can read doc at https://help.aliyun.com/document_detail/54243.html?spm=5176.doc54245.6.812.RgNCoi
|
||||
func (client *Client) DescribeInstanceRamRole(args *AttachInstancesArgs) (resp *DescribeInstanceRamRoleResponse, err error) {
|
||||
response := &DescribeInstanceRamRoleResponse{}
|
||||
err = client.Invoke("DescribeInstanceRamRole", args, response)
|
||||
if err != nil {
|
||||
return response, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
|
|
@ -36,8 +36,8 @@ func (client *Client) AllocatePublicIpAddress(instanceId string) (ipAddress stri
|
|||
|
||||
type ModifyInstanceNetworkSpec struct {
|
||||
InstanceId string
|
||||
InternetMaxBandwidthOut *int
|
||||
InternetMaxBandwidthIn *int
|
||||
InternetMaxBandwidthOut int
|
||||
InternetMaxBandwidthIn int
|
||||
}
|
||||
|
||||
type ModifyInstanceNetworkSpecResponse struct {
|
||||
|
|
|
@ -102,6 +102,7 @@ type NextHopType string
|
|||
const (
|
||||
NextHopIntance = NextHopType("Instance") //Default
|
||||
NextHopTunnel = NextHopType("Tunnel")
|
||||
NextHopTunnelRouterInterface = NextHopType("RouterInterface")
|
||||
)
|
||||
|
||||
type CreateRouteEntryArgs struct {
|
||||
|
|
|
@ -0,0 +1,227 @@
|
|||
package ecs
|
||||
|
||||
import (
|
||||
"github.com/denverdino/aliyungo/common"
|
||||
)
|
||||
|
||||
type EcsCommonResponse struct {
|
||||
common.Response
|
||||
}
|
||||
type RouterType string
|
||||
type InterfaceStatus string
|
||||
type Role string
|
||||
type Spec string
|
||||
|
||||
const (
|
||||
VRouter = RouterType("VRouter")
|
||||
VBR = RouterType("VBR")
|
||||
|
||||
Idl = InterfaceStatus("Idl")
|
||||
Active = InterfaceStatus("Active")
|
||||
Inactive = InterfaceStatus("Inactive")
|
||||
|
||||
InitiatingSide = Role("InitiatingSide")
|
||||
AcceptingSide = Role("AcceptingSide")
|
||||
|
||||
Small1 = Spec("Small.1")
|
||||
Small2 = Spec("Small.2")
|
||||
Small5 = Spec("Small.5")
|
||||
Middle1 = Spec("Middle.1")
|
||||
Middle2 = Spec("Middle.2")
|
||||
Middle5 = Spec("Middle.5")
|
||||
Large1 = Spec("Large.1")
|
||||
Large2 = Spec("Large.2")
|
||||
)
|
||||
|
||||
type CreateRouterInterfaceArgs struct {
|
||||
RegionId common.Region
|
||||
OppositeRegionId common.Region
|
||||
RouterType RouterType
|
||||
OppositeRouterType RouterType
|
||||
RouterId string
|
||||
OppositeRouterId string
|
||||
Role Role
|
||||
Spec Spec
|
||||
AccessPointId string
|
||||
OppositeAccessPointId string
|
||||
OppositeInterfaceId string
|
||||
OppositeInterfaceOwnerId string
|
||||
Name string
|
||||
Description string
|
||||
HealthCheckSourceIp string
|
||||
HealthCheckTargetIp string
|
||||
}
|
||||
|
||||
type CreateRouterInterfaceResponse struct {
|
||||
common.Response
|
||||
RouterInterfaceId string
|
||||
}
|
||||
|
||||
// CreateRouterInterface create Router interface
|
||||
//
|
||||
// You can read doc at https://help.aliyun.com/document_detail/36032.html?spm=5176.product27706.6.664.EbBsxC
|
||||
func (client *Client) CreateRouterInterface(args *CreateRouterInterfaceArgs) (response *CreateRouterInterfaceResponse, err error) {
|
||||
response = &CreateRouterInterfaceResponse{}
|
||||
err = client.Invoke("CreateRouterInterface", args, &response)
|
||||
if err != nil {
|
||||
return response, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
type Filter struct {
|
||||
Key string
|
||||
Value []string
|
||||
}
|
||||
|
||||
type DescribeRouterInterfacesArgs struct {
|
||||
RegionId common.Region
|
||||
common.Pagination
|
||||
Filter []Filter
|
||||
}
|
||||
|
||||
type RouterInterfaceItemType struct {
|
||||
ChargeType string
|
||||
RouterInterfaceId string
|
||||
AccessPointId string
|
||||
OppositeRegionId string
|
||||
OppositeAccessPointId string
|
||||
Role Role
|
||||
Spec Spec
|
||||
Name string
|
||||
Description string
|
||||
RouterId string
|
||||
RouterType RouterType
|
||||
CreationTime string
|
||||
Status string
|
||||
BusinessStatus string
|
||||
ConnectedTime string
|
||||
OppositeInterfaceId string
|
||||
OppositeInterfaceSpec string
|
||||
OppositeInterfaceStatus string
|
||||
OppositeInterfaceBusinessStatus string
|
||||
OppositeRouterId string
|
||||
OppositeRouterType RouterType
|
||||
OppositeInterfaceOwnerId string
|
||||
HealthCheckSourceIp string
|
||||
HealthCheckTargetIp string
|
||||
}
|
||||
|
||||
type DescribeRouterInterfacesResponse struct {
|
||||
RouterInterfaceSet struct {
|
||||
RouterInterfaceType []RouterInterfaceItemType
|
||||
}
|
||||
common.PaginationResult
|
||||
}
|
||||
|
||||
// DescribeRouterInterfaces describe Router interfaces
|
||||
//
|
||||
// You can read doc at https://help.aliyun.com/document_detail/36032.html?spm=5176.product27706.6.664.EbBsxC
|
||||
func (client *Client) DescribeRouterInterfaces(args *DescribeRouterInterfacesArgs) (response *DescribeRouterInterfacesResponse, err error) {
|
||||
response = &DescribeRouterInterfacesResponse{}
|
||||
err = client.Invoke("DescribeRouterInterfaces", args, &response)
|
||||
if err != nil {
|
||||
return response, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
type OperateRouterInterfaceArgs struct {
|
||||
RegionId common.Region
|
||||
RouterInterfaceId string
|
||||
}
|
||||
|
||||
// ConnectRouterInterface
|
||||
//
|
||||
// You can read doc at https://help.aliyun.com/document_detail/36031.html?spm=5176.doc36035.6.666.wkyljN
|
||||
func (client *Client) ConnectRouterInterface(args *OperateRouterInterfaceArgs) (response *EcsCommonResponse, err error) {
|
||||
response = &EcsCommonResponse{}
|
||||
err = client.Invoke("ConnectRouterInterface", args, &response)
|
||||
if err != nil {
|
||||
return response, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
// ActivateRouterInterface active Router Interface
|
||||
//
|
||||
// You can read doc at https://help.aliyun.com/document_detail/36030.html?spm=5176.doc36031.6.667.DAuZLD
|
||||
func (client *Client) ActivateRouterInterface(args *OperateRouterInterfaceArgs) (response *EcsCommonResponse, err error) {
|
||||
response = &EcsCommonResponse{}
|
||||
err = client.Invoke("ActivateRouterInterface", args, &response)
|
||||
if err != nil {
|
||||
return response, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
// DeactivateRouterInterface deactivate Router Interface
|
||||
//
|
||||
// You can read doc at https://help.aliyun.com/document_detail/36033.html?spm=5176.doc36030.6.668.JqCWUz
|
||||
func (client *Client) DeactivateRouterInterface(args *OperateRouterInterfaceArgs) (response *EcsCommonResponse, err error) {
|
||||
response = &EcsCommonResponse{}
|
||||
err = client.Invoke("DeactivateRouterInterface", args, &response)
|
||||
if err != nil {
|
||||
return response, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
type ModifyRouterInterfaceSpecArgs struct {
|
||||
RegionId common.Region
|
||||
RouterInterfaceId string
|
||||
Spec Spec
|
||||
}
|
||||
|
||||
type ModifyRouterInterfaceSpecResponse struct {
|
||||
common.Response
|
||||
Spec Spec
|
||||
}
|
||||
|
||||
// ModifyRouterInterfaceSpec
|
||||
//
|
||||
// You can read doc at https://help.aliyun.com/document_detail/36037.html?spm=5176.doc36036.6.669.McKiye
|
||||
func (client *Client) ModifyRouterInterfaceSpec(args *ModifyRouterInterfaceSpecArgs) (response *ModifyRouterInterfaceSpecResponse, err error) {
|
||||
response = &ModifyRouterInterfaceSpecResponse{}
|
||||
err = client.Invoke("ModifyRouterInterfaceSpec", args, &response)
|
||||
if err != nil {
|
||||
return response, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
type ModifyRouterInterfaceAttributeArgs struct {
|
||||
RegionId common.Region
|
||||
RouterInterfaceId string
|
||||
Name string
|
||||
Description string
|
||||
OppositeInterfaceId string
|
||||
OppositeRouterId string
|
||||
OppositeInterfaceOwnerId string
|
||||
HealthCheckSourceIp string
|
||||
HealthCheckTargetIp string
|
||||
}
|
||||
|
||||
// ModifyRouterInterfaceAttribute
|
||||
//
|
||||
// You can read doc at https://help.aliyun.com/document_detail/36036.html?spm=5176.doc36037.6.670.Dcz3xS
|
||||
func (client *Client) ModifyRouterInterfaceAttribute(args *ModifyRouterInterfaceAttributeArgs) (response *EcsCommonResponse, err error) {
|
||||
response = &EcsCommonResponse{}
|
||||
err = client.Invoke("ModifyRouterInterfaceAttribute", args, &response)
|
||||
if err != nil {
|
||||
return response, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
// DeleteRouterInterface delete Router Interface
|
||||
//
|
||||
// You can read doc at https://help.aliyun.com/document_detail/36034.html?spm=5176.doc36036.6.671.y2xpNt
|
||||
func (client *Client) DeleteRouterInterface(args *OperateRouterInterfaceArgs) (response *EcsCommonResponse, err error) {
|
||||
response = &EcsCommonResponse{}
|
||||
err = client.Invoke("DeleteRouterInterface", args, &response)
|
||||
if err != nil {
|
||||
return response, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
|
@ -1,8 +1,9 @@
|
|||
package ram
|
||||
|
||||
import (
|
||||
"github.com/denverdino/aliyungo/common"
|
||||
"os"
|
||||
|
||||
"github.com/denverdino/aliyungo/common"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -16,15 +17,29 @@ type RamClient struct {
|
|||
}
|
||||
|
||||
func NewClient(accessKeyId string, accessKeySecret string) RamClientInterface {
|
||||
return NewClientWithSecurityToken(accessKeyId, accessKeySecret, "")
|
||||
}
|
||||
|
||||
func NewClientWithSecurityToken(accessKeyId string, accessKeySecret string, securityToken string) RamClientInterface {
|
||||
endpoint := os.Getenv("RAM_ENDPOINT")
|
||||
if endpoint == "" {
|
||||
endpoint = RAMDefaultEndpoint
|
||||
}
|
||||
return NewClientWithEndpoint(endpoint, accessKeyId, accessKeySecret)
|
||||
|
||||
return NewClientWithEndpointAndSecurityToken(endpoint, accessKeyId, accessKeySecret, securityToken)
|
||||
}
|
||||
|
||||
func NewClientWithEndpoint(endpoint string, accessKeyId string, accessKeySecret string) RamClientInterface {
|
||||
return NewClientWithEndpointAndSecurityToken(endpoint, accessKeyId, accessKeySecret, "")
|
||||
}
|
||||
|
||||
func NewClientWithEndpointAndSecurityToken(endpoint string, accessKeyId string, accessKeySecret string, securityToken string) RamClientInterface {
|
||||
client := &RamClient{}
|
||||
client.Init(endpoint, RAMAPIVersion, accessKeyId, accessKeySecret)
|
||||
client.WithEndpoint(endpoint).
|
||||
WithVersion(RAMAPIVersion).
|
||||
WithAccessKeyId(accessKeyId).
|
||||
WithAccessKeySecret(accessKeySecret).
|
||||
WithSecurityToken(securityToken).
|
||||
InitClient()
|
||||
return client
|
||||
}
|
||||
|
|
|
@ -31,6 +31,8 @@ type GroupResponse struct {
|
|||
|
||||
type GroupListResponse struct {
|
||||
RamCommonResponse
|
||||
IsTruncated bool
|
||||
Marker string
|
||||
Groups struct {
|
||||
Group []Group
|
||||
}
|
||||
|
|
|
@ -1,8 +1,15 @@
|
|||
package ram
|
||||
|
||||
type Type string
|
||||
|
||||
const (
|
||||
Custom Type = "Custom"
|
||||
System Type = "System"
|
||||
)
|
||||
|
||||
type PolicyRequest struct {
|
||||
PolicyName string
|
||||
PolicyType string
|
||||
PolicyType Type
|
||||
Description string
|
||||
PolicyDocument string
|
||||
SetAsDefault string
|
||||
|
@ -21,15 +28,16 @@ type PolicyResponse struct {
|
|||
}
|
||||
|
||||
type PolicyQueryRequest struct {
|
||||
PolicyType string
|
||||
PolicyType Type
|
||||
Marker string
|
||||
MaxItems int8
|
||||
}
|
||||
|
||||
type PolicyQueryResponse struct {
|
||||
RamCommonResponse
|
||||
IsTruncated bool
|
||||
Marker string
|
||||
Policies struct {
|
||||
Policies struct {
|
||||
Policy []Policy
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,24 +66,26 @@ func setQueryValues(i interface{}, values *url.Values, prefix string) {
|
|||
// TODO Use Tag for validation
|
||||
// tag := typ.Field(i).Tag.Get("tagname")
|
||||
kind := field.Kind()
|
||||
isPtr := false
|
||||
if (kind == reflect.Ptr || kind == reflect.Array || kind == reflect.Slice || kind == reflect.Map || kind == reflect.Chan) && field.IsNil() {
|
||||
continue
|
||||
}
|
||||
if kind == reflect.Ptr {
|
||||
field = field.Elem()
|
||||
kind = field.Kind()
|
||||
isPtr = true
|
||||
}
|
||||
var value string
|
||||
//switch field.Interface().(type) {
|
||||
switch kind {
|
||||
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|
||||
i := field.Int()
|
||||
if i != 0 {
|
||||
if i != 0 || isPtr {
|
||||
value = strconv.FormatInt(i, 10)
|
||||
}
|
||||
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
|
||||
i := field.Uint()
|
||||
if i != 0 {
|
||||
if i != 0 || isPtr {
|
||||
value = strconv.FormatUint(i, 10)
|
||||
}
|
||||
case reflect.Float32:
|
||||
|
@ -197,12 +199,14 @@ func setQueryValuesByFlattenMethod(i interface{}, values *url.Values, prefix str
|
|||
// tag := typ.Field(i).Tag.Get("tagname")
|
||||
kind := field.Kind()
|
||||
|
||||
isPtr := false
|
||||
if (kind == reflect.Ptr || kind == reflect.Array || kind == reflect.Slice || kind == reflect.Map || kind == reflect.Chan) && field.IsNil() {
|
||||
continue
|
||||
}
|
||||
if kind == reflect.Ptr {
|
||||
field = field.Elem()
|
||||
kind = field.Kind()
|
||||
isPtr = true
|
||||
}
|
||||
|
||||
var value string
|
||||
|
@ -210,12 +214,12 @@ func setQueryValuesByFlattenMethod(i interface{}, values *url.Values, prefix str
|
|||
switch kind {
|
||||
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|
||||
i := field.Int()
|
||||
if i != 0 {
|
||||
if i != 0 || isPtr {
|
||||
value = strconv.FormatInt(i, 10)
|
||||
}
|
||||
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
|
||||
i := field.Uint()
|
||||
if i != 0 {
|
||||
if i != 0 || isPtr {
|
||||
value = strconv.FormatUint(i, 10)
|
||||
}
|
||||
case reflect.Float32:
|
||||
|
|
|
@ -572,34 +572,34 @@
|
|||
"revision": "6d212800a42e8ab5c146b8ace3490ee17e5225f9"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "b2m7aICkBOz9JqmnX2kdDN4wgjI=",
|
||||
"checksumSHA1": "2+1TPdvFj4W1QS5drkFr+ibM3G0=",
|
||||
"path": "github.com/denverdino/aliyungo/common",
|
||||
"revision": "b8a81c0f54003ea306ef566807919955d639cd48",
|
||||
"revisionTime": "2017-08-02T08:24:47Z"
|
||||
"revision": "ec0e57291175fc9b06c62977f384756642285aab",
|
||||
"revisionTime": "2017-11-27T16:20:29Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "5UYxIc/DZ5g0SM7qwXskoyNOc78=",
|
||||
"checksumSHA1": "y4Ay4E5HqT25sweC/Bl9/odNWaI=",
|
||||
"path": "github.com/denverdino/aliyungo/ecs",
|
||||
"revision": "b8a81c0f54003ea306ef566807919955d639cd48",
|
||||
"revisionTime": "2017-08-02T08:24:47Z"
|
||||
"revision": "ec0e57291175fc9b06c62977f384756642285aab",
|
||||
"revisionTime": "2017-11-27T16:20:29Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "VfIjW9Tf2eLmHrgrvk1wRnBaxTE=",
|
||||
"checksumSHA1": "sievsBvgtVF2iZ2FjmDZppH3+Ro=",
|
||||
"path": "github.com/denverdino/aliyungo/ram",
|
||||
"revision": "b8a81c0f54003ea306ef566807919955d639cd48",
|
||||
"revisionTime": "2017-08-02T08:24:47Z"
|
||||
"revision": "ec0e57291175fc9b06c62977f384756642285aab",
|
||||
"revisionTime": "2017-11-27T16:20:29Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "pQHH9wpyS0e4wpW0erxe3D7OILM=",
|
||||
"path": "github.com/denverdino/aliyungo/slb",
|
||||
"revision": "b8a81c0f54003ea306ef566807919955d639cd48",
|
||||
"revisionTime": "2017-08-02T08:24:47Z"
|
||||
"revision": "ec0e57291175fc9b06c62977f384756642285aab",
|
||||
"revisionTime": "2017-11-27T16:20:29Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "piZlmhWPLGxYkXLysTrjcXllO4c=",
|
||||
"checksumSHA1": "cKVBRn7GKT+0IqfGUc/NnKDWzCw=",
|
||||
"path": "github.com/denverdino/aliyungo/util",
|
||||
"revision": "b8a81c0f54003ea306ef566807919955d639cd48",
|
||||
"revisionTime": "2017-08-02T08:24:47Z"
|
||||
"revision": "ec0e57291175fc9b06c62977f384756642285aab",
|
||||
"revisionTime": "2017-11-27T16:20:29Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "D37uI+U+FYvTJIdG2TTozXe7i7U=",
|
||||
|
|
|
@ -183,6 +183,12 @@ builder.
|
|||
generate. By default, Packer generates a name that looks like `packer_<UUID>`,
|
||||
where `<UUID>` is a 36 character unique identifier.
|
||||
|
||||
- `security_token` (string) - STS access token, can be set through template or by exporting
|
||||
as environment vairalbe such "export SecurityToken=value".
|
||||
|
||||
- `TLSHandshakeTimeout` (int) - When happen "net/http: TLS handshake timeout" problem, set this environment variable
|
||||
to a bigger such as "export TLSHandshakeTimeout=30", it will set the TLS handshake timeout value to 30s.
|
||||
|
||||
## Basic Example
|
||||
|
||||
Here is a basic example for Alicloud.
|
||||
|
|
Loading…
Reference in New Issue