forked from denverdino/aliyungo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.go
50 lines (41 loc) · 1.39 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
package dns
import (
"os"
"github.com/denverdino/aliyungo/common"
)
type Client struct {
common.Client
}
const (
// DNSDefaultEndpoint is the default API endpoint of DNS services
DNSDefaultEndpoint = "http://dns.aliyuncs.com"
DNSAPIVersion = "2015-01-09"
DNSDefaultEndpointNew = "http://alidns.aliyuncs.com"
)
// NewClient creates a new instance of DNS client
func NewClient(accessKeyId, accessKeySecret string) *Client {
endpoint := os.Getenv("DNS_ENDPOINT")
if endpoint == "" {
endpoint = DNSDefaultEndpoint
}
return NewClientWithEndpoint(endpoint, accessKeyId, accessKeySecret)
}
// NewClientNew creates a new instance of DNS client, with http://alidns.aliyuncs.com as default endpoint
func NewClientNew(accessKeyId, accessKeySecret string) *Client {
endpoint := os.Getenv("DNS_ENDPOINT")
if endpoint == "" {
endpoint = DNSDefaultEndpointNew
}
return NewClientWithEndpoint(endpoint, accessKeyId, accessKeySecret)
}
// NewCustomClient creates a new instance of ECS client with customized API endpoint
func NewCustomClient(accessKeyId, accessKeySecret string, endpoint string) *Client {
client := &Client{}
client.Init(endpoint, DNSAPIVersion, accessKeyId, accessKeySecret)
return client
}
func NewClientWithEndpoint(endpoint string, accessKeyId, accessKeySecret string) *Client {
client := &Client{}
client.Init(endpoint, DNSAPIVersion, accessKeyId, accessKeySecret)
return client
}