| 1 |
package location |
| 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 |
|
| 15 |
LocationDefaultEndpoint = "https://location.aliyuncs.com" |
| 16 |
LocationAPIVersion = "2015-06-12" |
| 17 |
) |
| 18 |
|
| 19 |
|
| 20 |
func NewClient(accessKeyId, accessKeySecret string) *Client { |
| 21 |
endpoint := os.Getenv("LOCATION_ENDPOINT") |
| 22 |
if endpoint == "" { |
| 23 |
endpoint = LocationDefaultEndpoint |
| 24 |
} |
| 25 |
return NewClientWithEndpoint(endpoint, accessKeyId, accessKeySecret) |
| 26 |
} |
| 27 |
|
| 28 |
func NewClientWithEndpoint(endpoint string, accessKeyId, accessKeySecret string) *Client { |
| 29 |
client := &Client{} |
| 30 |
client.Init(endpoint, LocationAPIVersion, accessKeyId, accessKeySecret) |
| 31 |
return client |
| 32 |
} |