當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Config.Endpoint方法代碼示例

本文整理匯總了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 = &region
	}
	if region := os.Getenv("AWS_DEFAULT_REGION"); region != "" {
		ecsconfig.Region = &region
	}
	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),
	})
}
開發者ID:instacart,項目名稱:amazon-ecs-agent,代碼行數:26,代碼來源:utils.go

示例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)
		}
	}
}
開發者ID:ahamilton55,項目名稱:aws-sdk-go,代碼行數:34,代碼來源:dynamodb_test.go

示例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 ""
}
開發者ID:Yelp,項目名稱:terraform,代碼行數:9,代碼來源:auth_helpers.go

示例4: newClient

func (factory *ecrFactory) newClient(region, endpointOverride string) ECRSDK {
	var ecrConfig aws.Config
	ecrConfig.Region = &region
	ecrConfig.HTTPClient = factory.httpClient
	if endpointOverride != "" {
		ecrConfig.Endpoint = &endpointOverride
	}
	return ecrapi.New(&ecrConfig)
}
開發者ID:bmanas,項目名稱:amazon-ecs-agent,代碼行數:9,代碼來源:factory.go

示例5: newClient

func (factory *ecrFactory) newClient(region, endpointOverride string) ECRClient {
	var ecrConfig aws.Config
	ecrConfig.Region = &region
	ecrConfig.HTTPClient = factory.httpClient
	if endpointOverride != "" {
		ecrConfig.Endpoint = &endpointOverride
	}
	sdkClient := ecrapi.New(session.New(&ecrConfig))
	tokenCache := async.NewLRUCache(tokenCacheSize, tokenCacheTTL)
	return NewECRClient(sdkClient, tokenCache)
}
開發者ID:umaptechnologies,項目名稱:amazon-ecs-agent,代碼行數:11,代碼來源:factory.go

示例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,
	}
}
開發者ID:bmanas,項目名稱:amazon-ecs-agent,代碼行數:18,代碼來源:api_client.go


注:本文中的github.com/aws/aws-sdk-go/aws.Config.Endpoint方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。