• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang aws.EscapePath函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/awslabs/aws-sdk-go/aws.EscapePath函数的典型用法代码示例。如果您正苦于以下问题:Golang EscapePath函数的具体用法?Golang EscapePath怎么用?Golang EscapePath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了EscapePath函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: ListDatasets

// ListDatasets lists datasets for an identity. The credentials used to
// make this API call need to have access to the identity data. With Amazon
// Cognito Sync, each identity has access only to its own data. You should
// use Amazon Cognito Identity service to retrieve the credentials
// necessary to make this API call.
func (c *CognitoSync) ListDatasets(req *ListDatasetsRequest) (resp *ListDatasetsResponse, err error) {
	resp = &ListDatasetsResponse{}

	var body io.Reader
	var contentType string

	uri := c.client.Endpoint + "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets"

	if req.IdentityID != nil {
		uri = strings.Replace(uri, "{"+"IdentityId"+"}", aws.EscapePath(*req.IdentityID), -1)
		uri = strings.Replace(uri, "{"+"IdentityId+"+"}", aws.EscapePath(*req.IdentityID), -1)
	}

	if req.IdentityPoolID != nil {
		uri = strings.Replace(uri, "{"+"IdentityPoolId"+"}", aws.EscapePath(*req.IdentityPoolID), -1)
		uri = strings.Replace(uri, "{"+"IdentityPoolId+"+"}", aws.EscapePath(*req.IdentityPoolID), -1)
	}

	q := url.Values{}

	if req.MaxResults != nil {
		q.Set("maxResults", strconv.Itoa(*req.MaxResults))
	}

	if req.NextToken != nil {
		q.Set("nextToken", *req.NextToken)
	}

	if len(q) > 0 {
		uri += "?" + q.Encode()
	}

	httpReq, err := http.NewRequest("GET", uri, body)
	if err != nil {
		return
	}

	if contentType != "" {
		httpReq.Header.Set("Content-Type", contentType)
	}

	httpResp, err := c.client.Do(httpReq)
	if err != nil {
		return
	}

	defer httpResp.Body.Close()

	if e := json.NewDecoder(httpResp.Body).Decode(resp); e != nil && e != io.EOF {
		err = e
		return
	}

	return
}
开发者ID:2722,项目名称:lantern,代码行数:60,代码来源:sync.go


示例2: InvokeAsync

// InvokeAsync submits an invocation request to AWS Lambda. Upon receiving
// the request, Lambda executes the specified function asynchronously. To
// see the logs generated by the Lambda function execution, see the
// CloudWatch logs console. This operation requires permission for the
// lambda:InvokeAsync action.
func (c *Lambda) InvokeAsync(req *InvokeAsyncRequest) (resp *InvokeAsyncResponse, err error) {
	resp = &InvokeAsyncResponse{}

	var body io.Reader
	var contentType string

	contentType = "application/json"
	b, err := json.Marshal(req.InvokeArgs)
	if err != nil {
		return
	}
	body = bytes.NewReader(b)

	uri := c.client.Endpoint + "/2014-11-13/functions/{FunctionName}/invoke-async/"

	if req.FunctionName != nil {
		uri = strings.Replace(uri, "{"+"FunctionName"+"}", aws.EscapePath(*req.FunctionName), -1)
		uri = strings.Replace(uri, "{"+"FunctionName+"+"}", aws.EscapePath(*req.FunctionName), -1)
	}

	q := url.Values{}

	if len(q) > 0 {
		uri += "?" + q.Encode()
	}

	httpReq, err := http.NewRequest("POST", uri, body)
	if err != nil {
		return
	}

	if contentType != "" {
		httpReq.Header.Set("Content-Type", contentType)
	}

	httpResp, err := c.client.Do(httpReq)
	if err != nil {
		return
	}

	defer httpResp.Body.Close()

	if e := json.NewDecoder(httpResp.Body).Decode(resp); e != nil && e != io.EOF {
		err = e
		return
	}

	resp.Status = aws.Integer(httpResp.StatusCode)

	return
}
开发者ID:ComeOn-Wuhan,项目名称:lantern,代码行数:56,代码来源:lambda.go


示例3: ListJobsByStatus

// ListJobsByStatus the ListJobsByStatus operation gets a list of jobs that
// have a specified status. The response body contains one element for each
// job that satisfies the search criteria.
func (c *ElasticTranscoder) ListJobsByStatus(req *ListJobsByStatusRequest) (resp *ListJobsByStatusResponse, err error) {
	resp = &ListJobsByStatusResponse{}

	var body io.Reader
	var contentType string

	uri := c.client.Endpoint + "/2012-09-25/jobsByStatus/{Status}"

	if req.Status != nil {
		uri = strings.Replace(uri, "{"+"Status"+"}", aws.EscapePath(*req.Status), -1)
		uri = strings.Replace(uri, "{"+"Status+"+"}", aws.EscapePath(*req.Status), -1)
	}

	q := url.Values{}

	if req.Ascending != nil {
		q.Set("Ascending", *req.Ascending)
	}

	if req.PageToken != nil {
		q.Set("PageToken", *req.PageToken)
	}

	if len(q) > 0 {
		uri += "?" + q.Encode()
	}

	httpReq, err := http.NewRequest("GET", uri, body)
	if err != nil {
		return
	}

	if contentType != "" {
		httpReq.Header.Set("Content-Type", contentType)
	}

	httpResp, err := c.client.Do(httpReq)
	if err != nil {
		return
	}

	defer httpResp.Body.Close()

	if e := json.NewDecoder(httpResp.Body).Decode(resp); e != nil && e != io.EOF {
		err = e
		return
	}

	return
}
开发者ID:2722,项目名称:lantern,代码行数:53,代码来源:elastictranscoder.go


示例4: UnsubscribeFromDataset

// UnsubscribeFromDataset unsubscribe from receiving notifications when a
// dataset is modified by another device.
func (c *CognitoSync) UnsubscribeFromDataset(req *UnsubscribeFromDatasetRequest) (resp *UnsubscribeFromDatasetResponse, err error) {
	resp = &UnsubscribeFromDatasetResponse{}

	var body io.Reader
	var contentType string

	uri := c.client.Endpoint + "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}/subscriptions/{DeviceId}"

	if req.DatasetName != nil {
		uri = strings.Replace(uri, "{"+"DatasetName"+"}", aws.EscapePath(*req.DatasetName), -1)
		uri = strings.Replace(uri, "{"+"DatasetName+"+"}", aws.EscapePath(*req.DatasetName), -1)
	}

	if req.DeviceID != nil {
		uri = strings.Replace(uri, "{"+"DeviceId"+"}", aws.EscapePath(*req.DeviceID), -1)
		uri = strings.Replace(uri, "{"+"DeviceId+"+"}", aws.EscapePath(*req.DeviceID), -1)
	}

	if req.IdentityID != nil {
		uri = strings.Replace(uri, "{"+"IdentityId"+"}", aws.EscapePath(*req.IdentityID), -1)
		uri = strings.Replace(uri, "{"+"IdentityId+"+"}", aws.EscapePath(*req.IdentityID), -1)
	}

	if req.IdentityPoolID != nil {
		uri = strings.Replace(uri, "{"+"IdentityPoolId"+"}", aws.EscapePath(*req.IdentityPoolID), -1)
		uri = strings.Replace(uri, "{"+"IdentityPoolId+"+"}", aws.EscapePath(*req.IdentityPoolID), -1)
	}

	q := url.Values{}

	if len(q) > 0 {
		uri += "?" + q.Encode()
	}

	httpReq, err := http.NewRequest("DELETE", uri, body)
	if err != nil {
		return
	}

	if contentType != "" {
		httpReq.Header.Set("Content-Type", contentType)
	}

	httpResp, err := c.client.Do(httpReq)
	if err != nil {
		return
	}

	defer httpResp.Body.Close()

	if e := json.NewDecoder(httpResp.Body).Decode(resp); e != nil && e != io.EOF {
		err = e
		return
	}

	return
}
开发者ID:2722,项目名称:lantern,代码行数:59,代码来源:sync.go


示例5: RegisterDevice

// RegisterDevice registers a device to receive push sync notifications.
func (c *CognitoSync) RegisterDevice(req *RegisterDeviceRequest) (resp *RegisterDeviceResponse, err error) {
	resp = &RegisterDeviceResponse{}

	var body io.Reader
	var contentType string

	uri := c.client.Endpoint + "/identitypools/{IdentityPoolId}/identity/{IdentityId}/device"

	if req.IdentityID != nil {
		uri = strings.Replace(uri, "{"+"IdentityId"+"}", aws.EscapePath(*req.IdentityID), -1)
		uri = strings.Replace(uri, "{"+"IdentityId+"+"}", aws.EscapePath(*req.IdentityID), -1)
	}

	if req.IdentityPoolID != nil {
		uri = strings.Replace(uri, "{"+"IdentityPoolId"+"}", aws.EscapePath(*req.IdentityPoolID), -1)
		uri = strings.Replace(uri, "{"+"IdentityPoolId+"+"}", aws.EscapePath(*req.IdentityPoolID), -1)
	}

	q := url.Values{}

	if len(q) > 0 {
		uri += "?" + q.Encode()
	}

	httpReq, err := http.NewRequest("POST", uri, body)
	if err != nil {
		return
	}

	if contentType != "" {
		httpReq.Header.Set("Content-Type", contentType)
	}

	httpResp, err := c.client.Do(httpReq)
	if err != nil {
		return
	}

	defer httpResp.Body.Close()

	if e := json.NewDecoder(httpResp.Body).Decode(resp); e != nil && e != io.EOF {
		err = e
		return
	}

	return
}
开发者ID:2722,项目名称:lantern,代码行数:48,代码来源:sync.go


示例6: UpdatePipelineStatus

// UpdatePipelineStatus the UpdatePipelineStatus operation pauses or
// reactivates a pipeline, so that the pipeline stops or restarts the
// processing of jobs. Changing the pipeline status is useful if you want
// to cancel one or more jobs. You can't cancel jobs after Elastic
// Transcoder has started processing them; if you pause the pipeline to
// which you submitted the jobs, you have more time to get the job IDs for
// the jobs that you want to cancel, and to send a CancelJob request.
func (c *ElasticTranscoder) UpdatePipelineStatus(req *UpdatePipelineStatusRequest) (resp *UpdatePipelineStatusResponse, err error) {
	resp = &UpdatePipelineStatusResponse{}

	var body io.Reader
	var contentType string

	uri := c.client.Endpoint + "/2012-09-25/pipelines/{Id}/status"

	if req.ID != nil {
		uri = strings.Replace(uri, "{"+"Id"+"}", aws.EscapePath(*req.ID), -1)
		uri = strings.Replace(uri, "{"+"Id+"+"}", aws.EscapePath(*req.ID), -1)
	}

	q := url.Values{}

	if len(q) > 0 {
		uri += "?" + q.Encode()
	}

	httpReq, err := http.NewRequest("POST", uri, body)
	if err != nil {
		return
	}

	if contentType != "" {
		httpReq.Header.Set("Content-Type", contentType)
	}

	httpResp, err := c.client.Do(httpReq)
	if err != nil {
		return
	}

	defer httpResp.Body.Close()

	if e := json.NewDecoder(httpResp.Body).Decode(resp); e != nil && e != io.EOF {
		err = e
		return
	}

	return
}
开发者ID:2722,项目名称:lantern,代码行数:49,代码来源:elastictranscoder.go


示例7: GetFunctionConfiguration

// GetFunctionConfiguration returns the configuration information of the
// Lambda function. This the same information you provided as parameters
// when uploading the function by using UploadFunction This operation
// requires permission for the lambda:GetFunctionConfiguration operation.
func (c *Lambda) GetFunctionConfiguration(req *GetFunctionConfigurationRequest) (resp *FunctionConfiguration, err error) {
	resp = &FunctionConfiguration{}

	var body io.Reader
	var contentType string

	uri := c.client.Endpoint + "/2014-11-13/functions/{FunctionName}/configuration"

	if req.FunctionName != nil {
		uri = strings.Replace(uri, "{"+"FunctionName"+"}", aws.EscapePath(*req.FunctionName), -1)
		uri = strings.Replace(uri, "{"+"FunctionName+"+"}", aws.EscapePath(*req.FunctionName), -1)
	}

	q := url.Values{}

	if len(q) > 0 {
		uri += "?" + q.Encode()
	}

	httpReq, err := http.NewRequest("GET", uri, body)
	if err != nil {
		return
	}

	if contentType != "" {
		httpReq.Header.Set("Content-Type", contentType)
	}

	httpResp, err := c.client.Do(httpReq)
	if err != nil {
		return
	}

	defer httpResp.Body.Close()

	if e := json.NewDecoder(httpResp.Body).Decode(resp); e != nil && e != io.EOF {
		err = e
		return
	}

	return
}
开发者ID:ComeOn-Wuhan,项目名称:lantern,代码行数:46,代码来源:lambda.go


示例8: GetEventSource

// GetEventSource returns configuration information for the specified event
// source mapping (see AddEventSource This operation requires permission
// for the lambda:GetEventSource action.
func (c *Lambda) GetEventSource(req *GetEventSourceRequest) (resp *EventSourceConfiguration, err error) {
	resp = &EventSourceConfiguration{}

	var body io.Reader
	var contentType string

	uri := c.client.Endpoint + "/2014-11-13/event-source-mappings/{UUID}"

	if req.UUID != nil {
		uri = strings.Replace(uri, "{"+"UUID"+"}", aws.EscapePath(*req.UUID), -1)
		uri = strings.Replace(uri, "{"+"UUID+"+"}", aws.EscapePath(*req.UUID), -1)
	}

	q := url.Values{}

	if len(q) > 0 {
		uri += "?" + q.Encode()
	}

	httpReq, err := http.NewRequest("GET", uri, body)
	if err != nil {
		return
	}

	if contentType != "" {
		httpReq.Header.Set("Content-Type", contentType)
	}

	httpResp, err := c.client.Do(httpReq)
	if err != nil {
		return
	}

	defer httpResp.Body.Close()

	if e := json.NewDecoder(httpResp.Body).Decode(resp); e != nil && e != io.EOF {
		err = e
		return
	}

	return
}
开发者ID:ComeOn-Wuhan,项目名称:lantern,代码行数:45,代码来源:lambda.go


示例9: RemoveEventSource

// RemoveEventSource removes an event source mapping. This means AWS Lambda
// will no longer invoke the function for events in the associated source.
// This operation requires permission for the lambda:RemoveEventSource
// action.
func (c *Lambda) RemoveEventSource(req *RemoveEventSourceRequest) (err error) {
	// NRE

	var body io.Reader
	var contentType string

	uri := c.client.Endpoint + "/2014-11-13/event-source-mappings/{UUID}"

	if req.UUID != nil {
		uri = strings.Replace(uri, "{"+"UUID"+"}", aws.EscapePath(*req.UUID), -1)
		uri = strings.Replace(uri, "{"+"UUID+"+"}", aws.EscapePath(*req.UUID), -1)
	}

	q := url.Values{}

	if len(q) > 0 {
		uri += "?" + q.Encode()
	}

	httpReq, err := http.NewRequest("DELETE", uri, body)
	if err != nil {
		return
	}

	if contentType != "" {
		httpReq.Header.Set("Content-Type", contentType)
	}

	httpResp, err := c.client.Do(httpReq)
	if err != nil {
		return
	}

	defer httpResp.Body.Close()

	return
}
开发者ID:ComeOn-Wuhan,项目名称:lantern,代码行数:41,代码来源:lambda.go


示例10: DeleteFunction

// DeleteFunction deletes the specified Lambda function code and
// configuration. This operation requires permission for the
// lambda:DeleteFunction action.
func (c *Lambda) DeleteFunction(req *DeleteFunctionRequest) (err error) {
	// NRE

	var body io.Reader
	var contentType string

	uri := c.client.Endpoint + "/2014-11-13/functions/{FunctionName}"

	if req.FunctionName != nil {
		uri = strings.Replace(uri, "{"+"FunctionName"+"}", aws.EscapePath(*req.FunctionName), -1)
		uri = strings.Replace(uri, "{"+"FunctionName+"+"}", aws.EscapePath(*req.FunctionName), -1)
	}

	q := url.Values{}

	if len(q) > 0 {
		uri += "?" + q.Encode()
	}

	httpReq, err := http.NewRequest("DELETE", uri, body)
	if err != nil {
		return
	}

	if contentType != "" {
		httpReq.Header.Set("Content-Type", contentType)
	}

	httpResp, err := c.client.Do(httpReq)
	if err != nil {
		return
	}

	defer httpResp.Body.Close()

	return
}
开发者ID:ComeOn-Wuhan,项目名称:lantern,代码行数:40,代码来源:lambda.go


示例11: TestEscapePath

func TestEscapePath(t *testing.T) {
	for _, x := range []struct {
		in   string
		want string
	}{
		{"", ""},
		{"ABCDEFGHIJKLMNOPQRTSUVWXYZ", "ABCDEFGHIJKLMNOPQRTSUVWXYZ"},
		{"abcdefghijklmnopqrtsuvwxyz", "abcdefghijklmnopqrtsuvwxyz"},
		{"0123456789", "0123456789"},
		{"_-~./:", "_-~./:"},
		{"test? file", "test%3F%20file"},
		{`hello? sausage/êé/Hello, 世界/ " ' @ < > & ?/z.txt`, "hello%3F%20sausage/%C3%AA%C3%A9/Hello%2C%20%E4%B8%96%E7%95%8C/%20%22%20%27%20%40%20%3C%20%3E%20%26%20%3F/z.txt"},
	} {
		got := aws.EscapePath(x.in)
		if got != x.want {
			t.Errorf("EscapePath(%q) got %q, want %v", x.in, got, x.want)
		}
	}
}
开发者ID:2722,项目名称:lantern,代码行数:19,代码来源:rest_test.go


示例12: UploadFunction

// UploadFunction creates a new Lambda function or updates an existing
// function. The function metadata is created from the request parameters,
// and the code for the function is provided by a .zip file in the request
// body. If the function name already exists, the existing Lambda function
// is updated with the new code and metadata. This operation requires
// permission for the lambda:UploadFunction action.
func (c *Lambda) UploadFunction(req *UploadFunctionRequest) (resp *FunctionConfiguration, err error) {
	resp = &FunctionConfiguration{}

	var body io.Reader
	var contentType string

	contentType = "application/json"
	b, err := json.Marshal(req.FunctionZip)
	if err != nil {
		return
	}
	body = bytes.NewReader(b)

	uri := c.client.Endpoint + "/2014-11-13/functions/{FunctionName}"

	if req.FunctionName != nil {
		uri = strings.Replace(uri, "{"+"FunctionName"+"}", aws.EscapePath(*req.FunctionName), -1)
		uri = strings.Replace(uri, "{"+"FunctionName+"+"}", aws.EscapePath(*req.FunctionName), -1)
	}

	q := url.Values{}

	if req.Description != nil {
		q.Set("Description", *req.Description)
	}

	if req.Handler != nil {
		q.Set("Handler", *req.Handler)
	}

	if req.MemorySize != nil {
		q.Set("MemorySize", strconv.Itoa(*req.MemorySize))
	}

	if req.Mode != nil {
		q.Set("Mode", *req.Mode)
	}

	if req.Role != nil {
		q.Set("Role", *req.Role)
	}

	if req.Runtime != nil {
		q.Set("Runtime", *req.Runtime)
	}

	if req.Timeout != nil {
		q.Set("Timeout", strconv.Itoa(*req.Timeout))
	}

	if len(q) > 0 {
		uri += "?" + q.Encode()
	}

	httpReq, err := http.NewRequest("PUT", uri, body)
	if err != nil {
		return
	}

	if contentType != "" {
		httpReq.Header.Set("Content-Type", contentType)
	}

	httpResp, err := c.client.Do(httpReq)
	if err != nil {
		return
	}

	defer httpResp.Body.Close()

	if e := json.NewDecoder(httpResp.Body).Decode(resp); e != nil && e != io.EOF {
		err = e
		return
	}

	return
}
开发者ID:ComeOn-Wuhan,项目名称:lantern,代码行数:83,代码来源:lambda.go



注:本文中的github.com/awslabs/aws-sdk-go/aws.EscapePath函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang aws.Long函数代码示例发布时间:2022-05-24
下一篇:
Golang aws.Error函数代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap