Debian Codegraph @

ess/client.go

raw symbols SCIP
1 package ess
2
3 import (
4 "github.com/denverdino/aliyungo/common"
5
6 "os"
7 )
8
9 type Client struct {
10 common.Client
11 }
12
13 const (
14 // ESSDefaultEndpoint is the default API endpoint of ESS services
15 ESSDefaultEndpoint = "https://ess.aliyuncs.com"
16 ESSAPIVersion = "2014-08-28"
17 ESSServiceCode = "ess"
18 )
19
20 // NewClient creates a new instance of RDS client
21 func NewClient(accessKeyId, accessKeySecret string) *Client {
22 endpoint := os.Getenv("ESS_ENDPOINT")
23 if endpoint == "" {
24 endpoint = ESSDefaultEndpoint
25 }
26 return NewClientWithEndpoint(endpoint, accessKeyId, accessKeySecret)
27 }
28
29 func NewClientWithEndpoint(endpoint string, accessKeyId, accessKeySecret string) *Client {
30 client := &Client{}
31 client.Init(endpoint, ESSAPIVersion, accessKeyId, accessKeySecret)
32 return client
33 }
34
35 func NewESSClient(accessKeyId, accessKeySecret string, regionID common.Region) *Client {
36 endpoint := os.Getenv("ESS_ENDPOINT")
37 if endpoint == "" {
38 endpoint = ESSDefaultEndpoint
39 }
40
41 return NewClientWithRegion(endpoint, accessKeyId, accessKeySecret, regionID)
42 }
43
44 func NewClientWithRegion(endpoint string, accessKeyId, accessKeySecret string, regionID common.Region) *Client {
45 client := &Client{}
46 client.NewInit(endpoint, ESSAPIVersion, accessKeyId, accessKeySecret, ESSServiceCode, regionID)
47 return client
48 }