本文整理汇总了Golang中github.com/aws/aws-sdk-go/service/ses.New函数的典型用法代码示例。如果您正苦于以下问题:Golang New函数的具体用法?Golang New怎么用?Golang New使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了New函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ExampleSES_ListIdentities
func ExampleSES_ListIdentities() {
svc := ses.New(nil)
params := &ses.ListIdentitiesInput{
IdentityType: aws.String("IdentityType"),
MaxItems: aws.Long(1),
NextToken: aws.String("NextToken"),
}
resp, err := svc.ListIdentities(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.StringValue(resp))
}
示例2: ExampleSES_SetIdentityFeedbackForwardingEnabled
func ExampleSES_SetIdentityFeedbackForwardingEnabled() {
svc := ses.New(nil)
params := &ses.SetIdentityFeedbackForwardingEnabledInput{
ForwardingEnabled: aws.Bool(true), // Required
Identity: aws.String("Identity"), // Required
}
resp, err := svc.SetIdentityFeedbackForwardingEnabled(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))
}
示例3: ExampleSES_DeleteConfigurationSetEventDestination
func ExampleSES_DeleteConfigurationSetEventDestination() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := ses.New(sess)
params := &ses.DeleteConfigurationSetEventDestinationInput{
ConfigurationSetName: aws.String("ConfigurationSetName"), // Required
EventDestinationName: aws.String("EventDestinationName"), // Required
}
resp, err := svc.DeleteConfigurationSetEventDestination(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)
}
示例4: ExampleSES_SendRawEmail
func ExampleSES_SendRawEmail() {
svc := ses.New(nil)
params := &ses.SendRawEmailInput{
RawMessage: &ses.RawMessage{ // Required
Data: []byte("PAYLOAD"), // Required
},
Destinations: []*string{
aws.String("Address"), // Required
// More values...
},
Source: aws.String("Address"),
}
resp, err := svc.SendRawEmail(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.StringValue(resp))
}
示例5: sendSES
func sendSES(email *Email) error {
svc := ses.New(session.New())
params := &ses.SendEmailInput{
Destination: &ses.Destination{
ToAddresses: []*string{
aws.String(email.To),
},
},
Message: &ses.Message{
Body: &ses.Body{
Text: &ses.Content{
Data: aws.String(email.Body),
},
},
Subject: &ses.Content{
Data: aws.String(email.Subject),
},
},
Source: aws.String("[email protected]"),
ReplyToAddresses: []*string{
aws.String("[email protected]"),
},
}
if _, err := svc.SendEmail(params); err != nil {
return err
}
return nil
}
示例6: ExampleSES_SendRawEmail
func ExampleSES_SendRawEmail() {
svc := ses.New(nil)
params := &ses.SendRawEmailInput{
RawMessage: &ses.RawMessage{ // Required
Data: []byte("PAYLOAD"), // Required
},
Destinations: []*string{
aws.String("Address"), // Required
// More values...
},
FromArn: aws.String("AmazonResourceName"),
ReturnPathArn: aws.String("AmazonResourceName"),
Source: aws.String("Address"),
SourceArn: aws.String("AmazonResourceName"),
}
resp, err := svc.SendRawEmail(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)
}
示例7: ExampleSES_ListIdentities
func ExampleSES_ListIdentities() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := ses.New(sess)
params := &ses.ListIdentitiesInput{
IdentityType: aws.String("IdentityType"),
MaxItems: aws.Int64(1),
NextToken: aws.String("NextToken"),
}
resp, err := svc.ListIdentities(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)
}
示例8: ExampleSES_DescribeConfigurationSet
func ExampleSES_DescribeConfigurationSet() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := ses.New(sess)
params := &ses.DescribeConfigurationSetInput{
ConfigurationSetName: aws.String("ConfigurationSetName"), // Required
ConfigurationSetAttributeNames: []*string{
aws.String("ConfigurationSetAttribute"), // Required
// More values...
},
}
resp, err := svc.DescribeConfigurationSet(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)
}
示例9: ExampleSES_CreateReceiptFilter
func ExampleSES_CreateReceiptFilter() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := ses.New(sess)
params := &ses.CreateReceiptFilterInput{
Filter: &ses.ReceiptFilter{ // Required
IpFilter: &ses.ReceiptIpFilter{ // Required
Cidr: aws.String("Cidr"), // Required
Policy: aws.String("ReceiptFilterPolicy"), // Required
},
Name: aws.String("ReceiptFilterName"), // Required
},
}
resp, err := svc.CreateReceiptFilter(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)
}
示例10: ExampleSES_SetReceiptRulePosition
func ExampleSES_SetReceiptRulePosition() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := ses.New(sess)
params := &ses.SetReceiptRulePositionInput{
RuleName: aws.String("ReceiptRuleName"), // Required
RuleSetName: aws.String("ReceiptRuleSetName"), // Required
After: aws.String("ReceiptRuleName"),
}
resp, err := svc.SetReceiptRulePosition(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)
}
示例11: ExampleSES_SetIdentityNotificationTopic
func ExampleSES_SetIdentityNotificationTopic() {
svc := ses.New(nil)
params := &ses.SetIdentityNotificationTopicInput{
Identity: aws.String("Identity"), // Required
NotificationType: aws.String("NotificationType"), // Required
SNSTopic: aws.String("NotificationTopic"),
}
resp, err := svc.SetIdentityNotificationTopic(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.StringValue(resp))
}
示例12: ExampleSES_SetIdentityNotificationTopic
func ExampleSES_SetIdentityNotificationTopic() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := ses.New(sess)
params := &ses.SetIdentityNotificationTopicInput{
Identity: aws.String("Identity"), // Required
NotificationType: aws.String("NotificationType"), // Required
SnsTopic: aws.String("NotificationTopic"),
}
resp, err := svc.SetIdentityNotificationTopic(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)
}
示例13: ExampleSES_SetIdentityMailFromDomain
func ExampleSES_SetIdentityMailFromDomain() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := ses.New(sess)
params := &ses.SetIdentityMailFromDomainInput{
Identity: aws.String("Identity"), // Required
BehaviorOnMXFailure: aws.String("BehaviorOnMXFailure"),
MailFromDomain: aws.String("MailFromDomainName"),
}
resp, err := svc.SetIdentityMailFromDomain(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)
}
示例14: ExampleSES_SetIdentityFeedbackForwardingEnabled
func ExampleSES_SetIdentityFeedbackForwardingEnabled() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := ses.New(sess)
params := &ses.SetIdentityFeedbackForwardingEnabledInput{
ForwardingEnabled: aws.Bool(true), // Required
Identity: aws.String("Identity"), // Required
}
resp, err := svc.SetIdentityFeedbackForwardingEnabled(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)
}
示例15: ExampleSES_ReorderReceiptRuleSet
func ExampleSES_ReorderReceiptRuleSet() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := ses.New(sess)
params := &ses.ReorderReceiptRuleSetInput{
RuleNames: []*string{ // Required
aws.String("ReceiptRuleName"), // Required
// More values...
},
RuleSetName: aws.String("ReceiptRuleSetName"), // Required
}
resp, err := svc.ReorderReceiptRuleSet(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)
}