当前位置: 首页>>代码示例>>Golang>>正文


Golang aws.MakeParams函数代码示例

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


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

示例1: ListMetrics

func (c *CloudWatch) ListMetrics(req *ListMetricsRequest) (result *ListMetricsResponse, err error) {

	// Serialize all the params
	params := aws.MakeParams("ListMetrics")
	if req.Namespace != "" {
		params["Namespace"] = req.Namespace
	}
	if len(req.Dimensions) > 0 {
		for i, d := range req.Dimensions {
			prefix := "Dimensions.member." + strconv.Itoa(i+1)
			params[prefix+".Name"] = d.Name
			params[prefix+".Value"] = d.Value
		}
	}

	result = new(ListMetricsResponse)
	err = c.query("GET", "/", params, &result)
	metrics := result.ListMetricsResult.Metrics
	if result.ListMetricsResult.NextToken != "" {
		params = aws.MakeParams("ListMetrics")
		params["NextToken"] = result.ListMetricsResult.NextToken
		for result.ListMetricsResult.NextToken != "" && err == nil {
			result = new(ListMetricsResponse)
			err = c.query("GET", "/", params, &result)
			if err == nil {
				newslice := make([]Metric, len(metrics)+len(result.ListMetricsResult.Metrics))
				copy(newslice, metrics)
				copy(newslice[len(metrics):], result.ListMetricsResult.Metrics)
				metrics = newslice
			}
		}
		result.ListMetricsResult.Metrics = metrics
	}
	return
}
开发者ID:reedobrien,项目名称:goamz,代码行数:35,代码来源:cloudwatch.go

示例2: GetTopicAttributes

// Returns all of the properties of a topic. Topic properties returned might differ based on the authorization of the user.
func (sns *SNS) GetTopicAttributes(topicArn string) (*GetTopicAttributesResponse, error) {
	params := aws.MakeParams("GetTopicAttributes")
	params["TopicArn"] = topicArn

	response := &GetTopicAttributesResponse{}
	err := sns.query("GET", params, response)
	return response, err
}
开发者ID:APTrust,项目名称:exchange,代码行数:9,代码来源:sns.go

示例3: CreateTopic

// Creates a topic to which notifications can be published. Users can create at most 3000 topics.
// This action is idempotent, so if the requester already owns a topic with the specified name, that topic's ARN is returned without creating a new topic.
func (sns *SNS) CreateTopic(name string) (*CreateTopicResponse, error) {
	params := aws.MakeParams("CreateTopic")
	params["Name"] = name

	response := &CreateTopicResponse{}
	err := sns.query("POST", params, response)

	return response, err
}
开发者ID:APTrust,项目名称:exchange,代码行数:11,代码来源:sns.go

示例4: GetSubscriptionAttributes

// Returns all of the properties of a subscription.
func (sns *SNS) GetSubscriptionAttributes(subscriptionArn string) (*GetSubscriptionAttributesResponse, error) {
	params := aws.MakeParams("GetSubscriptionAttributes")
	params["SubscriptionArn"] = subscriptionArn

	response := &GetSubscriptionAttributesResponse{}
	err := sns.query("GET", params, response)

	return response, err
}
开发者ID:APTrust,项目名称:exchange,代码行数:10,代码来源:sns.go

示例5: GetEndpointAttributes

// Retrieves the endpoint attributes for a device on one of the supported push notification services, such as GCM and APNS
func (sns *SNS) GetEndpointAttributes(endpointArn string) (*GetEndpointAttributesResponse, error) {
	params := aws.MakeParams("GetEndpointAttributes")
	params["EndpointArn"] = endpointArn

	response := &GetEndpointAttributesResponse{}
	err := sns.query("GET", params, response)

	return response, err
}
开发者ID:APTrust,项目名称:exchange,代码行数:10,代码来源:sns.go

示例6: Unsubscribe

// Deletes a subscription.
// If the subscription requires authentication for deletion, only the owner of the subscription or the topic's owner can unsubscribe, and an AWS signature is required.
// If the Unsubscribe call does not require authentication and the requester is not the subscription owner, a final cancellation message is delivered to the endpoint, so that the endpoint owner can easily resubscribe to the topic if the Unsubscribe request was unintended.
func (sns *SNS) Unsubscribe(subscriptionArn string) (*UnsubscribeResponse, error) {
	params := aws.MakeParams("Unsubscribe")
	params["SubscriptionArn"] = subscriptionArn

	response := &UnsubscribeResponse{}
	err := sns.query("POST", params, response)

	return response, err
}
开发者ID:APTrust,项目名称:exchange,代码行数:12,代码来源:sns.go

示例7: GetPlatformApplicationAttributes

// Retrieves the attributes of the platform application object for the supported push notification services, such as APNS and GCM
func (sns *SNS) GetPlatformApplicationAttributes(platformApplicationArn string) (*GetPlatformApplicationAttributesResponse, error) {
	params := aws.MakeParams("GetPlatformApplicationAttributes")
	params["PlatformApplicationArn"] = platformApplicationArn

	response := &GetPlatformApplicationAttributesResponse{}
	err := sns.query("GET", params, response)

	return response, err
}
开发者ID:APTrust,项目名称:exchange,代码行数:10,代码来源:sns.go

示例8: DeleteTopic

// Deletes a topic and all its subscriptions.
// Deleting a topic might prevent some messages previously sent to the topic from being delivered to subscribers.
// This action is idempotent, so deleting a topic that does not exist does not result in an error.
func (sns *SNS) DeleteTopic(topicArn string) (*DeleteTopicResponse, error) {
	params := aws.MakeParams("DeleteTopic")
	params["TopicArn"] = topicArn

	response := &DeleteTopicResponse{}
	err := sns.query("POST", params, response)

	return response, err
}
开发者ID:APTrust,项目名称:exchange,代码行数:12,代码来源:sns.go

示例9: PutMetricAlarm

func (c *CloudWatch) PutMetricAlarm(alarm *MetricAlarm) (result *aws.BaseResponse, err error) {
	// Serialize the params
	params := aws.MakeParams("PutMetricAlarm")

	switch {
	case alarm.AlarmName == "":
		err = errors.New("No AlarmName supplied")
	case !validComparisonOperators.Member(alarm.ComparisonOperator):
		err = errors.New("ComparisonOperator is not valid")
	case alarm.EvaluationPeriods == 0:
		err = errors.New("No number of EvaluationPeriods specified")
	case alarm.MetricName == "":
		err = errors.New("No MetricName specified")
	case alarm.Namespace == "":
		err = errors.New("No Namespace specified")
	case alarm.Period == 0:
		err = errors.New("No Period over which statistic should apply was specified")
	case !validMetricStatistics.Member(alarm.Statistic):
		err = errors.New("Invalid statistic value supplied")
	case alarm.Threshold == 0:
		err = errors.New("No Threshold value specified")
	case alarm.Unit != "" && !validUnits.Member(alarm.Unit):
		err = errors.New("Unit is not a valid value")
	}
	if err != nil {
		return
	}

	for i, action := range alarm.AlarmActions {
		params["AlarmActions.member."+strconv.Itoa(i+1)] = action.ARN
	}
	if alarm.AlarmDescription != "" {
		params["AlarmDescription"] = alarm.AlarmDescription
		return
	}
	params["AlarmDescription"] = alarm.AlarmDescription
	params["AlarmName"] = alarm.AlarmName
	params["ComparisonOperator"] = alarm.ComparisonOperator
	for i, dim := range alarm.Dimensions {
		dimprefix := "Dimensions.member." + strconv.Itoa(i+1)
		params[dimprefix+".Name"] = dim.Name
		params[dimprefix+".Value"] = dim.Value
	}
	params["EvaluationPeriods"] = strconv.Itoa(alarm.EvaluationPeriods)
	params["MetricName"] = alarm.MetricName
	params["Namespace"] = alarm.Namespace
	params["Period"] = strconv.Itoa(alarm.Period)
	params["Statistic"] = alarm.Statistic
	params["Threshold"] = strconv.FormatFloat(alarm.Threshold, 'E', 10, 64)
	if alarm.Unit != "" {
		params["Unit"] = alarm.Unit
	}

	result = new(aws.BaseResponse)
	err = c.query("POST", "/", params, result)
	return
}
开发者ID:hayesgm,项目名称:goamz,代码行数:57,代码来源:cloudwatch.go

示例10: DeleteEndpoint

// Deletes the endpoint from Amazon SNS. This action is idempotent.
func (sns *SNS) DeleteEndpoint(endpointArn string) (*DeleteEndpointResponse, error) {
	params := aws.MakeParams("DeleteEndpoint")
	params["EndpointArn"] = endpointArn

	response := &DeleteEndpointResponse{}
	err := sns.query("POST", params, response)

	return response, err
}
开发者ID:APTrust,项目名称:exchange,代码行数:10,代码来源:sns.go

示例11: DeletePlatformApplication

// Deletes a platform application object for one of the supported push notification services, such as APNS and GCM
func (sns *SNS) DeletePlatformApplication(platformApplicationArn string) (*DeletePlatformApplicationResponse, error) {
	params := aws.MakeParams("DeletePlatformApplication")
	params["PlatformApplicationArn"] = platformApplicationArn

	response := &DeletePlatformApplicationResponse{}
	err := sns.query("POST", params, response)

	return response, err
}
开发者ID:APTrust,项目名称:exchange,代码行数:10,代码来源:sns.go

示例12: RemovePermission

// Removes a statement from a topic's access control policy.
func (sns *SNS) RemovePermission(label, topicArn string) (*RemovePermissionResponse, error) {
	params := aws.MakeParams("RemovePermission")
	params["Label"] = label
	params["TopicArn"] = topicArn

	response := &RemovePermissionResponse{}
	err := sns.query("POST", params, response)

	return response, err
}
开发者ID:APTrust,项目名称:exchange,代码行数:11,代码来源:sns.go

示例13: ListSubscriptions

// Returns a list of the requester's subscriptions. Each call returns a limited list of subscriptions, up to 100.
// If there are more subscriptions, a NextToken is also returned.
// Use the NextToken parameter in a new ListSubscriptions call to get further results.
func (sns *SNS) ListSubscriptions(nextToken string) (*ListSubscriptionsResponse, error) {
	params := aws.MakeParams("ListSubscriptions")
	if nextToken != "" {
		params["NextToken"] = nextToken
	}

	response := &ListSubscriptionsResponse{}
	err := sns.query("GET", params, response)

	return response, err
}
开发者ID:APTrust,项目名称:exchange,代码行数:14,代码来源:sns.go

示例14: ListSubscriptionsByTopic

// Returns a list of the subscriptions to a specific topic.
// Each call returns a limited list of subscriptions, up to 100.
// If there are more subscriptions, a NextToken is also returned.
// Use the NextToken parameter in a new ListSubscriptionsByTopic call to get further results.
func (sns *SNS) ListSubscriptionsByTopic(topicArn, nextToken string) (*ListSubscriptionByTopicResponse, error) {
	params := aws.MakeParams("ListSubscriptionsByTopic")
	params["TopicArn"] = topicArn
	if nextToken != "" {
		params["NextToken"] = nextToken
	}

	response := &ListSubscriptionByTopicResponse{}
	err := sns.query("GET", params, response)

	return response, err
}
开发者ID:APTrust,项目名称:exchange,代码行数:16,代码来源:sns.go

示例15: ConfirmSubscription

// Verifies an endpoint owner's intent to receive messages by validating the token sent to the endpoint by an earlier Subscribe action.
// If the token is valid, the action creates a new subscription and returns its Amazon Resource Name (ARN).
// This call requires an AWS signature only when the AuthenticateOnUnsubscribe flag is set to "true".
func (sns *SNS) ConfirmSubscription(topicArn, token, authenticateOnUnsubscribe string) (*ConfirmSubscriptionResponse, error) {
	params := aws.MakeParams("ConfirmSubscription")
	params["TopicArn"] = topicArn
	params["Token"] = token
	if authenticateOnUnsubscribe != "" {
		params["AuthenticateOnUnsubscribe"] = authenticateOnUnsubscribe
	}

	response := &ConfirmSubscriptionResponse{}
	err := sns.query("POST", params, response)

	return response, err
}
开发者ID:APTrust,项目名称:exchange,代码行数:16,代码来源:sns.go


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