-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.go
37 lines (29 loc) · 850 Bytes
/
client.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package batch
import (
"os"
"github.com/dreamCodeMan/qcloud-sdk/common"
)
const (
CVMDefaultEndpoint = "https://batch.tencentcloudapi.com/"
CVMAPIVersion = "2017-03-12"
)
// Interval for checking status in WaitForXXX method
const DefaultWaitForInterval = 5
// Default timeout value for WaitForXXX method
const DefaultTimeout = 60
type Client struct {
common.Client
}
// NewClient creates a new instance of CVM client
func NewClient(secretId, secretKey, region string) *Client {
endpoint := os.Getenv("CVM_ENDPOINT")
if endpoint == "" {
endpoint = CVMDefaultEndpoint
}
return NewClientWithEndpoint(endpoint, secretId, secretKey, region)
}
func NewClientWithEndpoint(endpoint, secretId, secretKey, region string) *Client {
client := &Client{}
client.Init(endpoint, CVMAPIVersion, secretId, secretKey, region)
return client
}