本文整理汇总了Golang中github.com/aws/aws-sdk-go/aws.Config.Endpoint方法的典型用法代码示例。如果您正苦于以下问题:Golang Config.Endpoint方法的具体用法?Golang Config.Endpoint怎么用?Golang Config.Endpoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/aws/aws-sdk-go/aws.Config
的用法示例。
在下文中一共展示了Config.Endpoint方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: init
func init() {
var ecsconfig aws.Config
if region := os.Getenv("AWS_REGION"); region != "" {
ecsconfig.Region = ®ion
}
if region := os.Getenv("AWS_DEFAULT_REGION"); region != "" {
ecsconfig.Region = ®ion
}
if ecsconfig.Region == nil {
if iid, err := ec2.GetInstanceIdentityDocument(); err == nil {
ecsconfig.Region = &iid.Region
}
}
if envEndpoint := os.Getenv("ECS_BACKEND_HOST"); envEndpoint != "" {
ecsconfig.Endpoint = &envEndpoint
}
ECS = ecs.New(session.New(&ecsconfig))
Cluster = "ecs-functional-tests"
if envCluster := os.Getenv("ECS_CLUSTER"); envCluster != "" {
Cluster = envCluster
}
ECS.CreateCluster(&ecs.CreateClusterInput{
ClusterName: aws.String(Cluster),
})
}
示例2: BenchmarkPutItem
func BenchmarkPutItem(b *testing.B) {
cfg := aws.Config{
DisableSSL: aws.Bool(true),
Credentials: credentials.NewStaticCredentials("AKID", "SECRET", ""),
}
server := successRespServer([]byte(`{}`))
cfg.Endpoint = aws.String(server.URL)
svc := dynamodb.New(&cfg)
svc.Handlers.Send.Clear()
svc.Handlers.Send.PushBack(func(r *service.Request) {
r.HTTPResponse = &http.Response{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: noopBody,
}
})
b.ResetTimer()
for i := 0; i < b.N; i++ {
av, err := dynamodbattribute.ConvertToMap(dbItem{Key: "MyKey", Data: "MyData"})
if err != nil {
b.Fatal("benchPutItem, expect no ConvertToMap errors", err)
}
params := &dynamodb.PutItemInput{
Item: av,
TableName: aws.String("tablename"),
}
_, err = svc.PutItem(params)
if err != nil {
b.Error("benchPutItem, expect no request errors", err)
}
}
}
示例3: setOptionalEndpoint
func setOptionalEndpoint(cfg *aws.Config) string {
endpoint := os.Getenv("AWS_METADATA_URL")
if endpoint != "" {
log.Printf("[INFO] Setting custom metadata endpoint: %q", endpoint)
cfg.Endpoint = aws.String(endpoint)
return endpoint
}
return ""
}
示例4: newClient
func (factory *ecrFactory) newClient(region, endpointOverride string) ECRSDK {
var ecrConfig aws.Config
ecrConfig.Region = ®ion
ecrConfig.HTTPClient = factory.httpClient
if endpointOverride != "" {
ecrConfig.Endpoint = &endpointOverride
}
return ecrapi.New(&ecrConfig)
}
示例5: newClient
func (factory *ecrFactory) newClient(region, endpointOverride string) ECRClient {
var ecrConfig aws.Config
ecrConfig.Region = ®ion
ecrConfig.HTTPClient = factory.httpClient
if endpointOverride != "" {
ecrConfig.Endpoint = &endpointOverride
}
sdkClient := ecrapi.New(session.New(&ecrConfig))
tokenCache := async.NewLRUCache(tokenCacheSize, tokenCacheTTL)
return NewECRClient(sdkClient, tokenCache)
}
示例6: NewECSClient
func NewECSClient(credentialProvider *credentials.Credentials, config *config.Config, httpClient *http.Client, ec2MetadataClient ec2.EC2MetadataClient) ECSClient {
var ecsConfig aws.Config
ecsConfig.Credentials = credentialProvider
ecsConfig.Region = &config.AWSRegion
ecsConfig.HTTPClient = httpClient
if config.APIEndpoint != "" {
ecsConfig.Endpoint = &config.APIEndpoint
}
standardClient := ecs.New(&ecsConfig)
submitStateChangeClient := newSubmitStateChangeClient(&ecsConfig)
return &ApiECSClient{
credentialProvider: credentialProvider,
config: config,
standardClient: standardClient,
submitStateChangeClient: submitStateChangeClient,
ec2metadata: ec2MetadataClient,
}
}