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


Golang Request.Params方法代碼示例

本文整理匯總了Golang中github.com/aws/aws-sdk-go/aws/request.Request.Params方法的典型用法代碼示例。如果您正苦於以下問題:Golang Request.Params方法的具體用法?Golang Request.Params怎麽用?Golang Request.Params使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/aws/aws-sdk-go/aws/request.Request的用法示例。


在下文中一共展示了Request.Params方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: populateLocationConstraint

func populateLocationConstraint(r *request.Request) {
	if r.ParamsFilled() && aws.StringValue(r.Service.Config.Region) != "us-east-1" {
		in := r.Params.(*CreateBucketInput)
		if in.CreateBucketConfiguration == nil {
			r.Params = awsutil.CopyOf(r.Params)
			in = r.Params.(*CreateBucketInput)
			in.CreateBucketConfiguration = &CreateBucketConfiguration{
				LocationConstraint: r.Service.Config.Region,
			}
		}
	}
}
開發者ID:Celluliodio,項目名稱:flannel,代碼行數:12,代碼來源:bucket_location.go

示例2: fillPresignedURL

func fillPresignedURL(r *request.Request) {
	if !r.ParamsFilled() {
		return
	}

	params := r.Params.(*CopySnapshotInput)

	// Stop if PresignedURL/DestinationRegion is set
	if params.PresignedUrl != nil || params.DestinationRegion != nil {
		return
	}

	// First generate a copy of parameters
	r.Params = awsutil.CopyOf(r.Params)
	params = r.Params.(*CopySnapshotInput)

	// Set destination region. Avoids infinite handler loop.
	// Also needed to sign sub-request.
	params.DestinationRegion = r.Service.Config.Region

	// Create a new client pointing at source region.
	// We will use this to presign the CopySnapshot request against
	// the source region
	config := r.Service.Config.Copy().
		WithEndpoint("").
		WithRegion(*params.SourceRegion)

	client := New(config)

	// Presign a CopySnapshot request with modified params
	req, _ := client.CopySnapshotRequest(params)
	url, err := req.Presign(300 * time.Second) // 5 minutes should be enough.

	if err != nil { // bubble error back up to original request
		r.Error = err
	}

	// We have our URL, set it on params
	params.PresignedUrl = &url
}
開發者ID:ManifoldMike,項目名稱:coreos-kubernetes,代碼行數:40,代碼來源:customizations.go

示例3: copyParams

func copyParams(r *request.Request) {
	r.Params = awsutil.CopyOf(r.Params)
}
開發者ID:charles-at-linknext,項目名稱:aws-sdk-go,代碼行數:3,代碼來源:customizations.go


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