示例#1
0
func NewFromEnv() *Client {
	cl := &Client{
		Client: aws.NewFromEnv(),
	}
	if reg := os.Getenv("AWS_DEFAULT_REGION"); reg != "" {
		cl.CustomEndpointHost = "s3-" + reg + ".amazonaws.com"
	}
	return cl
}
示例#2
0
func cloudwatchList() error {
	client := cloudwatch.Client{Client: aws.NewFromEnv()}
	rsp, e := client.ListMetrics()
	if e != nil {
		return e
	}
	table := gocli.NewTable()
	for _, m := range rsp.Metrics {
		table.Add(m.Namespace, m.MetricName)
		for _, d := range m.Dimensions {
			table.Add("", d.Name, d.Value)
		}
	}
	fmt.Println(table)
	return nil
}
示例#3
0
func NewFromEnv() *Client {
	return &Client{Client: aws.NewFromEnv()}
}
示例#4
0
func NewFromEnv() *Client {
	return &Client{
		aws.NewFromEnv(),
	}
}