api_op_GetContactMethods.go raw
1 // Code generated by smithy-go-codegen DO NOT EDIT.
2
3 package lightsail
4
5 import (
6 "context"
7 "fmt"
8 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
9 "github.com/aws/aws-sdk-go-v2/service/lightsail/types"
10 "github.com/aws/smithy-go/middleware"
11 smithyhttp "github.com/aws/smithy-go/transport/http"
12 )
13
14 // Returns information about the configured contact methods. Specify a protocol in
15 // your request to return information about a specific contact method.
16 //
17 // A contact method is used to send you notifications about your Amazon Lightsail
18 // resources. You can add one email address and one mobile phone number contact
19 // method in each Amazon Web Services Region. However, SMS text messaging is not
20 // supported in some Amazon Web Services Regions, and SMS text messages cannot be
21 // sent to some countries/regions. For more information, see [Notifications in Amazon Lightsail].
22 //
23 // [Notifications in Amazon Lightsail]: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-notifications
24 func (c *Client) GetContactMethods(ctx context.Context, params *GetContactMethodsInput, optFns ...func(*Options)) (*GetContactMethodsOutput, error) {
25 if params == nil {
26 params = &GetContactMethodsInput{}
27 }
28
29 result, metadata, err := c.invokeOperation(ctx, "GetContactMethods", params, optFns, c.addOperationGetContactMethodsMiddlewares)
30 if err != nil {
31 return nil, err
32 }
33
34 out := result.(*GetContactMethodsOutput)
35 out.ResultMetadata = metadata
36 return out, nil
37 }
38
39 type GetContactMethodsInput struct {
40
41 // The protocols used to send notifications, such as Email , or SMS (text
42 // messaging).
43 //
44 // Specify a protocol in your request to return information about a specific
45 // contact method protocol.
46 Protocols []types.ContactProtocol
47
48 noSmithyDocumentSerde
49 }
50
51 type GetContactMethodsOutput struct {
52
53 // An array of objects that describe the contact methods.
54 ContactMethods []types.ContactMethod
55
56 // Metadata pertaining to the operation's result.
57 ResultMetadata middleware.Metadata
58
59 noSmithyDocumentSerde
60 }
61
62 func (c *Client) addOperationGetContactMethodsMiddlewares(stack *middleware.Stack, options Options) (err error) {
63 if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
64 return err
65 }
66 err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetContactMethods{}, middleware.After)
67 if err != nil {
68 return err
69 }
70 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetContactMethods{}, middleware.After)
71 if err != nil {
72 return err
73 }
74 if err := addProtocolFinalizerMiddlewares(stack, options, "GetContactMethods"); err != nil {
75 return fmt.Errorf("add protocol finalizers: %v", err)
76 }
77
78 if err = addlegacyEndpointContextSetter(stack, options); err != nil {
79 return err
80 }
81 if err = addSetLoggerMiddleware(stack, options); err != nil {
82 return err
83 }
84 if err = addClientRequestID(stack); err != nil {
85 return err
86 }
87 if err = addComputeContentLength(stack); err != nil {
88 return err
89 }
90 if err = addResolveEndpointMiddleware(stack, options); err != nil {
91 return err
92 }
93 if err = addComputePayloadSHA256(stack); err != nil {
94 return err
95 }
96 if err = addRetry(stack, options); err != nil {
97 return err
98 }
99 if err = addRawResponseToMetadata(stack); err != nil {
100 return err
101 }
102 if err = addRecordResponseTiming(stack); err != nil {
103 return err
104 }
105 if err = addSpanRetryLoop(stack, options); err != nil {
106 return err
107 }
108 if err = addClientUserAgent(stack, options); err != nil {
109 return err
110 }
111 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
112 return err
113 }
114 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
115 return err
116 }
117 if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
118 return err
119 }
120 if err = addTimeOffsetBuild(stack, c); err != nil {
121 return err
122 }
123 if err = addUserAgentRetryMode(stack, options); err != nil {
124 return err
125 }
126 if err = addCredentialSource(stack, options); err != nil {
127 return err
128 }
129 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetContactMethods(options.Region), middleware.Before); err != nil {
130 return err
131 }
132 if err = addRecursionDetection(stack); err != nil {
133 return err
134 }
135 if err = addRequestIDRetrieverMiddleware(stack); err != nil {
136 return err
137 }
138 if err = addResponseErrorMiddleware(stack); err != nil {
139 return err
140 }
141 if err = addRequestResponseLogging(stack, options); err != nil {
142 return err
143 }
144 if err = addDisableHTTPSMiddleware(stack, options); err != nil {
145 return err
146 }
147 if err = addInterceptBeforeRetryLoop(stack, options); err != nil {
148 return err
149 }
150 if err = addInterceptAttempt(stack, options); err != nil {
151 return err
152 }
153 if err = addInterceptors(stack, options); err != nil {
154 return err
155 }
156 return nil
157 }
158
159 func newServiceMetadataMiddleware_opGetContactMethods(region string) *awsmiddleware.RegisterServiceMetadata {
160 return &awsmiddleware.RegisterServiceMetadata{
161 Region: region,
162 ServiceID: ServiceID,
163 OperationName: "GetContactMethods",
164 }
165 }
166