-
Notifications
You must be signed in to change notification settings - Fork 622
/
api_op_ConfirmSubscription.go
139 lines (113 loc) · 4.15 KB
/
api_op_ConfirmSubscription.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
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package sns
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
)
// Input for ConfirmSubscription action.
type ConfirmSubscriptionInput struct {
_ struct{} `type:"structure"`
// Disallows unauthenticated unsubscribes of the subscription. If the value
// of this parameter is true and the request has an AWS signature, then only
// the topic owner and the subscription owner can unsubscribe the endpoint.
// The unsubscribe action requires AWS authentication.
AuthenticateOnUnsubscribe *string `type:"string"`
// Short-lived token sent to an endpoint during the Subscribe action.
//
// Token is a required field
Token *string `type:"string" required:"true"`
// The ARN of the topic for which you wish to confirm a subscription.
//
// TopicArn is a required field
TopicArn *string `type:"string" required:"true"`
}
// String returns the string representation
func (s ConfirmSubscriptionInput) String() string {
return awsutil.Prettify(s)
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *ConfirmSubscriptionInput) Validate() error {
invalidParams := aws.ErrInvalidParams{Context: "ConfirmSubscriptionInput"}
if s.Token == nil {
invalidParams.Add(aws.NewErrParamRequired("Token"))
}
if s.TopicArn == nil {
invalidParams.Add(aws.NewErrParamRequired("TopicArn"))
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
// Response for ConfirmSubscriptions action.
type ConfirmSubscriptionOutput struct {
_ struct{} `type:"structure"`
// The ARN of the created subscription.
SubscriptionArn *string `type:"string"`
}
// String returns the string representation
func (s ConfirmSubscriptionOutput) String() string {
return awsutil.Prettify(s)
}
const opConfirmSubscription = "ConfirmSubscription"
// ConfirmSubscriptionRequest returns a request value for making API operation for
// Amazon Simple Notification Service.
//
// Verifies an endpoint owner's intent to receive messages by validating the
// token sent to the endpoint by an earlier Subscribe action. If the token is
// valid, the action creates a new subscription and returns its Amazon Resource
// Name (ARN). This call requires an AWS signature only when the AuthenticateOnUnsubscribe
// flag is set to "true".
//
// // Example sending a request using ConfirmSubscriptionRequest.
// req := client.ConfirmSubscriptionRequest(params)
// resp, err := req.Send(context.TODO())
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/ConfirmSubscription
func (c *Client) ConfirmSubscriptionRequest(input *ConfirmSubscriptionInput) ConfirmSubscriptionRequest {
op := &aws.Operation{
Name: opConfirmSubscription,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &ConfirmSubscriptionInput{}
}
req := c.newRequest(op, input, &ConfirmSubscriptionOutput{})
return ConfirmSubscriptionRequest{Request: req, Input: input, Copy: c.ConfirmSubscriptionRequest}
}
// ConfirmSubscriptionRequest is the request type for the
// ConfirmSubscription API operation.
type ConfirmSubscriptionRequest struct {
*aws.Request
Input *ConfirmSubscriptionInput
Copy func(*ConfirmSubscriptionInput) ConfirmSubscriptionRequest
}
// Send marshals and sends the ConfirmSubscription API request.
func (r ConfirmSubscriptionRequest) Send(ctx context.Context) (*ConfirmSubscriptionResponse, error) {
r.Request.SetContext(ctx)
err := r.Request.Send()
if err != nil {
return nil, err
}
resp := &ConfirmSubscriptionResponse{
ConfirmSubscriptionOutput: r.Request.Data.(*ConfirmSubscriptionOutput),
response: &aws.Response{Request: r.Request},
}
return resp, nil
}
// ConfirmSubscriptionResponse is the response type for the
// ConfirmSubscription API operation.
type ConfirmSubscriptionResponse struct {
*ConfirmSubscriptionOutput
response *aws.Response
}
// SDKResponseMetdata returns the response metadata for the
// ConfirmSubscription request.
func (r *ConfirmSubscriptionResponse) SDKResponseMetdata() *aws.Response {
return r.response
}