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


Golang sns.New函數代碼示例

本文整理匯總了Golang中github.com/convox/rack/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/sns.New函數的典型用法代碼示例。如果您正苦於以下問題:Golang New函數的具體用法?Golang New怎麽用?Golang New使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


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

示例1: ExampleSNS_Publish

func ExampleSNS_Publish() {
	svc := sns.New(session.New())

	params := &sns.PublishInput{
		Message: aws.String("message"), // Required
		MessageAttributes: map[string]*sns.MessageAttributeValue{
			"Key": { // Required
				DataType:    aws.String("String"), // Required
				BinaryValue: []byte("PAYLOAD"),
				StringValue: aws.String("String"),
			},
			// More values...
		},
		MessageStructure: aws.String("messageStructure"),
		Subject:          aws.String("subject"),
		TargetArn:        aws.String("String"),
		TopicArn:         aws.String("topicARN"),
	}
	resp, err := svc.Publish(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
開發者ID:kuenzaa,項目名稱:rack,代碼行數:30,代碼來源:examples_test.go

示例2: ExampleSNS_AddPermission

func ExampleSNS_AddPermission() {
	svc := sns.New(session.New())

	params := &sns.AddPermissionInput{
		AWSAccountId: []*string{ // Required
			aws.String("delegate"), // Required
			// More values...
		},
		ActionName: []*string{ // Required
			aws.String("action"), // Required
			// More values...
		},
		Label:    aws.String("label"),    // Required
		TopicArn: aws.String("topicARN"), // Required
	}
	resp, err := svc.AddPermission(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
開發者ID:kuenzaa,項目名稱:rack,代碼行數:27,代碼來源:examples_test.go

示例3: ExampleSNS_Unsubscribe

func ExampleSNS_Unsubscribe() {
	svc := sns.New(session.New())

	params := &sns.UnsubscribeInput{
		SubscriptionArn: aws.String("subscriptionARN"), // Required
	}
	resp, err := svc.Unsubscribe(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
開發者ID:kuenzaa,項目名稱:rack,代碼行數:18,代碼來源:examples_test.go

示例4: ExampleSNS_ListTopics

func ExampleSNS_ListTopics() {
	svc := sns.New(session.New())

	params := &sns.ListTopicsInput{
		NextToken: aws.String("nextToken"),
	}
	resp, err := svc.ListTopics(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
開發者ID:kuenzaa,項目名稱:rack,代碼行數:18,代碼來源:examples_test.go

示例5: ExampleSNS_GetTopicAttributes

func ExampleSNS_GetTopicAttributes() {
	svc := sns.New(session.New())

	params := &sns.GetTopicAttributesInput{
		TopicArn: aws.String("topicARN"), // Required
	}
	resp, err := svc.GetTopicAttributes(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
開發者ID:kuenzaa,項目名稱:rack,代碼行數:18,代碼來源:examples_test.go

示例6: ExampleSNS_DeletePlatformApplication

func ExampleSNS_DeletePlatformApplication() {
	svc := sns.New(session.New())

	params := &sns.DeletePlatformApplicationInput{
		PlatformApplicationArn: aws.String("String"), // Required
	}
	resp, err := svc.DeletePlatformApplication(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
開發者ID:kuenzaa,項目名稱:rack,代碼行數:18,代碼來源:examples_test.go

示例7: ExampleSNS_CreateTopic

func ExampleSNS_CreateTopic() {
	svc := sns.New(session.New())

	params := &sns.CreateTopicInput{
		Name: aws.String("topicName"), // Required
	}
	resp, err := svc.CreateTopic(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
開發者ID:kuenzaa,項目名稱:rack,代碼行數:18,代碼來源:examples_test.go

示例8: ExampleSNS_RemovePermission

func ExampleSNS_RemovePermission() {
	svc := sns.New(session.New())

	params := &sns.RemovePermissionInput{
		Label:    aws.String("label"),    // Required
		TopicArn: aws.String("topicARN"), // Required
	}
	resp, err := svc.RemovePermission(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
開發者ID:kuenzaa,項目名稱:rack,代碼行數:19,代碼來源:examples_test.go

示例9: ExampleSNS_Subscribe

func ExampleSNS_Subscribe() {
	svc := sns.New(session.New())

	params := &sns.SubscribeInput{
		Protocol: aws.String("protocol"), // Required
		TopicArn: aws.String("topicARN"), // Required
		Endpoint: aws.String("endpoint"),
	}
	resp, err := svc.Subscribe(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
開發者ID:kuenzaa,項目名稱:rack,代碼行數:20,代碼來源:examples_test.go

示例10: ExampleSNS_SetSubscriptionAttributes

func ExampleSNS_SetSubscriptionAttributes() {
	svc := sns.New(session.New())

	params := &sns.SetSubscriptionAttributesInput{
		AttributeName:   aws.String("attributeName"),   // Required
		SubscriptionArn: aws.String("subscriptionARN"), // Required
		AttributeValue:  aws.String("attributeValue"),
	}
	resp, err := svc.SetSubscriptionAttributes(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
開發者ID:kuenzaa,項目名稱:rack,代碼行數:20,代碼來源:examples_test.go

示例11: ExampleSNS_ConfirmSubscription

func ExampleSNS_ConfirmSubscription() {
	svc := sns.New(session.New())

	params := &sns.ConfirmSubscriptionInput{
		Token:                     aws.String("token"),    // Required
		TopicArn:                  aws.String("topicARN"), // Required
		AuthenticateOnUnsubscribe: aws.String("authenticateOnUnsubscribe"),
	}
	resp, err := svc.ConfirmSubscription(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
開發者ID:kuenzaa,項目名稱:rack,代碼行數:20,代碼來源:examples_test.go

示例12: ExampleSNS_SetPlatformApplicationAttributes

func ExampleSNS_SetPlatformApplicationAttributes() {
	svc := sns.New(session.New())

	params := &sns.SetPlatformApplicationAttributesInput{
		Attributes: map[string]*string{ // Required
			"Key": aws.String("String"), // Required
			// More values...
		},
		PlatformApplicationArn: aws.String("String"), // Required
	}
	resp, err := svc.SetPlatformApplicationAttributes(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
開發者ID:kuenzaa,項目名稱:rack,代碼行數:22,代碼來源:examples_test.go

示例13: ExampleSNS_CreatePlatformEndpoint

func ExampleSNS_CreatePlatformEndpoint() {
	svc := sns.New(session.New())

	params := &sns.CreatePlatformEndpointInput{
		PlatformApplicationArn: aws.String("String"), // Required
		Token: aws.String("String"), // Required
		Attributes: map[string]*string{
			"Key": aws.String("String"), // Required
			// More values...
		},
		CustomUserData: aws.String("String"),
	}
	resp, err := svc.CreatePlatformEndpoint(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
開發者ID:kuenzaa,項目名稱:rack,代碼行數:24,代碼來源:examples_test.go

示例14: SNS

func SNS() *sns.SNS {
	return sns.New(awsConfig())
}
開發者ID:gisnalbert,項目名稱:rack,代碼行數:3,代碼來源:models.go

示例15: SNS

func SNS() *sns.SNS {
	return sns.New(session.New(), awsConfig())
}
開發者ID:soulware,項目名稱:rack,代碼行數:3,代碼來源:models.go


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