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 always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(resp)) }
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 always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(resp)) }
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 always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(resp)) }
func ExampleSNS_Publish() { svc := sns.New(nil) 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 { 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 always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(resp)) }
func init() { Before("@sns", func() { World["client"] = sns.New(nil) }) }
func TestInterface(t *testing.T) { assert.Implements(t, (*snsiface.SNSAPI)(nil), sns.New(nil)) }