func reportError(desc string, err error) { // print to stderr and sns notify if required if cfg.Sns.FailureNotifications && len(cfg.Sns.Topic) > 0 && len(cfg.Aws.Accesskey) > 0 && len(cfg.Aws.Secretkey) > 0 { _, snsErr := sns.New(aws.Auth{cfg.Aws.Accesskey, cfg.Aws.Secretkey}, aws.Regions[cfg.Aws.Region]).Publish(&sns.PublishOpt{fmt.Sprintf("%s: %#v", desc, err), "", "[redshift-tracking-copy-from-s3] ERROR Notification", cfg.Sns.Topic}) if snsErr != nil { log.Println(fmt.Sprintf("SNS error: %#v during report of error writing to kafka: %#v", snsErr, err)) } } fmt.Printf("%s: %s\n", desc, err) panic(err) }
func (s *S) SetUpSuite(c *check.C) { testServer.Start() auth := aws.Auth{AccessKey: "abc", SecretKey: "123"} s.sns = sns.New(auth, aws.Region{SNSEndpoint: testServer.URL}) }
func (s *S) SetUpSuite(c *C) { testServer.Start() auth := aws.Auth{"abc", "123"} s.sns = sns.New(auth, aws.Region{SNSEndpoint: testServer.URL}) }