本文整理汇总了Golang中github.com/awslabs/aws-sdk-go/service/sns.New函数的典型用法代码示例。如果您正苦于以下问题:Golang New函数的具体用法?Golang New怎么用?Golang New使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了New函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: ExampleSNS_CreatePlatformApplication
func ExampleSNS_CreatePlatformApplication() {
svc := sns.New(nil)
params := &sns.CreatePlatformApplicationInput{
Attributes: &map[string]*string{ // Required
"Key": aws.String("String"), // Required
// More values...
},
Name: aws.String("String"), // Required
Platform: aws.String("String"), // Required
}
resp, err := svc.CreatePlatformApplication(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS Error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, The SDK should alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:31,代码来源:examples_test.go
示例2: ExampleSNS_Unsubscribe
func ExampleSNS_Unsubscribe() {
svc := sns.New(nil)
params := &sns.UnsubscribeInput{
SubscriptionARN: aws.String("subscriptionARN"), // Required
}
resp, err := svc.Unsubscribe(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS Error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, The SDK should alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:26,代码来源:examples_test.go
示例3: ExampleSNS_AddPermission
func ExampleSNS_AddPermission() {
svc := sns.New(nil)
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 {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS Error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, The SDK should alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:35,代码来源:examples_test.go
示例4: ExampleSNS_Publish
func ExampleSNS_Publish() {
svc := sns.New(nil)
params := &sns.PublishInput{
Message: aws.String("message"), // Required
MessageAttributes: &map[string]*sns.MessageAttributeValue{
"Key": &sns.MessageAttributeValue{ // 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 {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS Error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, The SDK should alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:38,代码来源:examples_test.go
示例5: init
func init() {
Before("@sns", func() {
World["client"] = sns.New(nil)
})
}
开发者ID:ninefive,项目名称:confd,代码行数:5,代码来源:client.go
示例6: TestInterface
func TestInterface(t *testing.T) {
assert.Implements(t, (*snsiface.SNSAPI)(nil), sns.New(nil))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:3,代码来源:interface_test.go
注:本文中的github.com/awslabs/aws-sdk-go/service/sns.New函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论