Debian Codegraph @

dns/client.go

raw symbols SCIP
1 package dns
2
3 import (
4 "os"
5
6 "github.com/denverdino/aliyungo/common"
7 )
8
9 type Client struct {
10 common.Client
11 }
12
13 const (
14 // DNSDefaultEndpoint is the default API endpoint of DNS services
15 DNSDefaultEndpoint = "http://dns.aliyuncs.com"
16 DNSAPIVersion = "2015-01-09"
17
18 DNSDefaultEndpointNew = "http://alidns.aliyuncs.com"
19 )
20
21 // NewClient creates a new instance of DNS client
22 func NewClient(accessKeyId, accessKeySecret string) *Client {
23 endpoint := os.Getenv("DNS_ENDPOINT")
24 if endpoint == "" {
25 endpoint = DNSDefaultEndpoint
26 }
27 return NewClientWithEndpoint(endpoint, accessKeyId, accessKeySecret)
28 }
29
30 // NewClientNew creates a new instance of DNS client, with http://alidns.aliyuncs.com as default endpoint
31 func NewClientNew(accessKeyId, accessKeySecret string) *Client {
32 endpoint := os.Getenv("DNS_ENDPOINT")
33 if endpoint == "" {
34 endpoint = DNSDefaultEndpointNew
35 }
36 return NewClientWithEndpoint(endpoint, accessKeyId, accessKeySecret)
37 }
38
39 // NewCustomClient creates a new instance of ECS client with customized API endpoint
40 func NewCustomClient(accessKeyId, accessKeySecret string, endpoint string) *Client {
41 client := &Client{}
42 client.Init(endpoint, DNSAPIVersion, accessKeyId, accessKeySecret)
43 return client
44 }
45
46 func NewClientWithEndpoint(endpoint string, accessKeyId, accessKeySecret string) *Client {
47 client := &Client{}
48 client.Init(endpoint, DNSAPIVersion, accessKeyId, accessKeySecret)
49 return client
50 }