github.com/Jeffail/benthos/v3@v3.65.0/lib/output/aws_sns.go (about) 1 package output 2 3 import ( 4 "github.com/Jeffail/benthos/v3/internal/docs" 5 "github.com/Jeffail/benthos/v3/internal/metadata" 6 "github.com/Jeffail/benthos/v3/lib/log" 7 "github.com/Jeffail/benthos/v3/lib/metrics" 8 "github.com/Jeffail/benthos/v3/lib/output/writer" 9 "github.com/Jeffail/benthos/v3/lib/types" 10 "github.com/Jeffail/benthos/v3/lib/util/aws/session" 11 ) 12 13 //------------------------------------------------------------------------------ 14 15 func init() { 16 fields := docs.FieldSpecs{ 17 docs.FieldCommon("topic_arn", "The topic to publish to."), 18 docs.FieldCommon("message_group_id", "An optional group ID to set for messages.").IsInterpolated().AtVersion("3.60.0"), 19 docs.FieldCommon("message_deduplication_id", "An optional deduplication ID to set for messages.").IsInterpolated().AtVersion("3.60.0"), 20 docs.FieldCommon("max_in_flight", "The maximum number of messages to have in flight at a given time. Increase this to improve throughput."), 21 docs.FieldCommon("metadata", "Specify criteria for which metadata values are sent as headers.").WithChildren(metadata.ExcludeFilterFields()...).AtVersion("3.60.0"), 22 docs.FieldAdvanced("timeout", "The maximum period to wait on an upload before abandoning it and reattempting."), 23 }.Merge(session.FieldSpecs()) 24 25 Constructors[TypeAWSSNS] = TypeSpec{ 26 constructor: fromSimpleConstructor(NewAWSSNS), 27 Version: "3.36.0", 28 Summary: ` 29 Sends messages to an AWS SNS topic.`, 30 Description: ` 31 ### Credentials 32 33 By default Benthos will use a shared credentials file when connecting to AWS 34 services. It's also possible to set them explicitly at the component level, 35 allowing you to transfer data across accounts. You can find out more 36 [in this document](/docs/guides/cloud/aws).`, 37 Async: true, 38 FieldSpecs: fields, 39 Categories: []Category{ 40 CategoryServices, 41 CategoryAWS, 42 }, 43 } 44 45 Constructors[TypeSNS] = TypeSpec{ 46 constructor: fromSimpleConstructor(NewAmazonSNS), 47 Status: docs.StatusDeprecated, 48 Summary: ` 49 Sends messages to an AWS SNS topic.`, 50 Description: ` 51 ## Alternatives 52 53 This output has been renamed to ` + "[`aws_sns`](/docs/components/outputs/aws_sns)" + `. 54 55 ### Credentials 56 57 By default Benthos will use a shared credentials file when connecting to AWS 58 services. It's also possible to set them explicitly at the component level, 59 allowing you to transfer data across accounts. You can find out more 60 [in this document](/docs/guides/cloud/aws).`, 61 Async: true, 62 FieldSpecs: fields, 63 Categories: []Category{ 64 CategoryServices, 65 CategoryAWS, 66 }, 67 } 68 } 69 70 //------------------------------------------------------------------------------ 71 72 // NewAWSSNS creates a new AmazonSNS output type. 73 func NewAWSSNS(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error) { 74 return newAmazonSNS(TypeAWSSNS, conf.AWSSNS, mgr, log, stats) 75 } 76 77 // NewAmazonSNS creates a new AmazonSNS output type. 78 func NewAmazonSNS(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error) { 79 return newAmazonSNS(TypeSNS, conf.SNS, mgr, log, stats) 80 } 81 82 func newAmazonSNS(name string, conf writer.SNSConfig, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error) { 83 s, err := writer.NewSNSV2(conf, mgr, log, stats) 84 if err != nil { 85 return nil, err 86 } 87 a, err := NewAsyncWriter(name, conf.MaxInFlight, s, log, stats) 88 if err != nil { 89 return nil, err 90 } 91 return OnlySinglePayloads(a), nil 92 } 93 94 //------------------------------------------------------------------------------