-
Notifications
You must be signed in to change notification settings - Fork 595
/
api_op_SetSMSAttributes.go
176 lines (164 loc) · 7.29 KB
/
api_op_SetSMSAttributes.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
// Code generated by smithy-go-codegen DO NOT EDIT.
package sns
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Use this request to set the default settings for sending SMS messages and
// receiving daily SMS usage reports. You can override some of these settings for a
// single message when you use the Publish action with the
// MessageAttributes.entry.N parameter. For more information, see Publishing to a
// mobile phone (https://docs.aws.amazon.com/sns/latest/dg/sms_publish-to-phone.html)
// in the Amazon SNS Developer Guide. To use this operation, you must grant the
// Amazon SNS service principal ( sns.amazonaws.com ) permission to perform the
// s3:ListBucket action.
func (c *Client) SetSMSAttributes(ctx context.Context, params *SetSMSAttributesInput, optFns ...func(*Options)) (*SetSMSAttributesOutput, error) {
if params == nil {
params = &SetSMSAttributesInput{}
}
result, metadata, err := c.invokeOperation(ctx, "SetSMSAttributes", params, optFns, c.addOperationSetSMSAttributesMiddlewares)
if err != nil {
return nil, err
}
out := result.(*SetSMSAttributesOutput)
out.ResultMetadata = metadata
return out, nil
}
// The input for the SetSMSAttributes action.
type SetSMSAttributesInput struct {
// The default settings for sending SMS messages from your Amazon Web Services
// account. You can set values for the following attribute names: MonthlySpendLimit
// – The maximum amount in USD that you are willing to spend each month to send SMS
// messages. When Amazon SNS determines that sending an SMS message would incur a
// cost that exceeds this limit, it stops sending SMS messages within minutes.
// Amazon SNS stops sending SMS messages within minutes of the limit being crossed.
// During that interval, if you continue to send SMS messages, you will incur costs
// that exceed your limit. By default, the spend limit is set to the maximum
// allowed by Amazon SNS. If you want to raise the limit, submit an SNS Limit
// Increase case (https://console.aws.amazon.com/support/home#/case/create?issueType=service-limit-increase&limitType=service-code-sns)
// . For New limit value, enter your desired monthly spend limit. In the Use Case
// Description field, explain that you are requesting an SMS monthly spend limit
// increase. DeliveryStatusIAMRole – The ARN of the IAM role that allows Amazon
// SNS to write logs about SMS deliveries in CloudWatch Logs. For each SMS message
// that you send, Amazon SNS writes a log that includes the message price, the
// success or failure status, the reason for failure (if the message failed), the
// message dwell time, and other information. DeliveryStatusSuccessSamplingRate –
// The percentage of successful SMS deliveries for which Amazon SNS will write logs
// in CloudWatch Logs. The value can be an integer from 0 - 100. For example, to
// write logs only for failed deliveries, set this value to 0 . To write logs for
// 10% of your successful deliveries, set it to 10 . DefaultSenderID – A string,
// such as your business brand, that is displayed as the sender on the receiving
// device. Support for sender IDs varies by country. The sender ID can be 1 - 11
// alphanumeric characters, and it must contain at least one letter. DefaultSMSType
// – The type of SMS message that you will send by default. You can assign the
// following values:
// - Promotional – (Default) Noncritical messages, such as marketing messages.
// Amazon SNS optimizes the message delivery to incur the lowest cost.
// - Transactional – Critical messages that support customer transactions, such
// as one-time passcodes for multi-factor authentication. Amazon SNS optimizes the
// message delivery to achieve the highest reliability.
// UsageReportS3Bucket – The name of the Amazon S3 bucket to receive daily SMS
// usage reports from Amazon SNS. Each day, Amazon SNS will deliver a usage report
// as a CSV file to the bucket. The report includes the following information for
// each SMS message that was successfully delivered by your Amazon Web Services
// account:
// - Time that the message was published (in UTC)
// - Message ID
// - Destination phone number
// - Message type
// - Delivery status
// - Message price (in USD)
// - Part number (a message is split into multiple parts if it is too long for a
// single message)
// - Total number of parts
// To receive the report, the bucket must have a policy that allows the Amazon SNS
// service principal to perform the s3:PutObject and s3:GetBucketLocation actions.
// For an example bucket policy and usage report, see Monitoring SMS Activity (https://docs.aws.amazon.com/sns/latest/dg/sms_stats.html)
// in the Amazon SNS Developer Guide.
//
// This member is required.
Attributes map[string]string
noSmithyDocumentSerde
}
// The response for the SetSMSAttributes action.
type SetSMSAttributesOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationSetSMSAttributesMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpSetSMSAttributes{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpSetSMSAttributes{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpSetSMSAttributesValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opSetSMSAttributes(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opSetSMSAttributes(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "sns",
OperationName: "SetSMSAttributes",
}
}