1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package route53
4
5import (
6	"context"
7	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
8	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
9	"github.com/aws/aws-sdk-go-v2/service/route53/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Gets the value that Amazon Route 53 returns in response to a DNS request for a
15// specified record name and type. You can optionally specify the IP address of a
16// DNS resolver, an EDNS0 client subnet IP address, and a subnet mask. This call
17// only supports querying public hosted zones.
18func (c *Client) TestDNSAnswer(ctx context.Context, params *TestDNSAnswerInput, optFns ...func(*Options)) (*TestDNSAnswerOutput, error) {
19	if params == nil {
20		params = &TestDNSAnswerInput{}
21	}
22
23	result, metadata, err := c.invokeOperation(ctx, "TestDNSAnswer", params, optFns, c.addOperationTestDNSAnswerMiddlewares)
24	if err != nil {
25		return nil, err
26	}
27
28	out := result.(*TestDNSAnswerOutput)
29	out.ResultMetadata = metadata
30	return out, nil
31}
32
33// Gets the value that Amazon Route 53 returns in response to a DNS request for a
34// specified record name and type. You can optionally specify the IP address of a
35// DNS resolver, an EDNS0 client subnet IP address, and a subnet mask.
36type TestDNSAnswerInput struct {
37
38	// The ID of the hosted zone that you want Amazon Route 53 to simulate a query for.
39	//
40	// This member is required.
41	HostedZoneId *string
42
43	// The name of the resource record set that you want Amazon Route 53 to simulate a
44	// query for.
45	//
46	// This member is required.
47	RecordName *string
48
49	// The type of the resource record set.
50	//
51	// This member is required.
52	RecordType types.RRType
53
54	// If the resolver that you specified for resolverip supports EDNS0, specify the
55	// IPv4 or IPv6 address of a client in the applicable location, for example,
56	// 192.0.2.44 or 2001:db8:85a3::8a2e:370:7334.
57	EDNS0ClientSubnetIP *string
58
59	// If you specify an IP address for edns0clientsubnetip, you can optionally specify
60	// the number of bits of the IP address that you want the checking tool to include
61	// in the DNS query. For example, if you specify 192.0.2.44 for edns0clientsubnetip
62	// and 24 for edns0clientsubnetmask, the checking tool will simulate a request from
63	// 192.0.2.0/24. The default value is 24 bits for IPv4 addresses and 64 bits for
64	// IPv6 addresses. The range of valid values depends on whether edns0clientsubnetip
65	// is an IPv4 or an IPv6 address:
66	//
67	// * IPv4: Specify a value between 0 and 32
68	//
69	// *
70	// IPv6: Specify a value between 0 and 128
71	EDNS0ClientSubnetMask *string
72
73	// If you want to simulate a request from a specific DNS resolver, specify the IP
74	// address for that resolver. If you omit this value, TestDnsAnswer uses the IP
75	// address of a DNS resolver in the Amazon Web Services US East (N. Virginia)
76	// Region (us-east-1).
77	ResolverIP *string
78
79	noSmithyDocumentSerde
80}
81
82// A complex type that contains the response to a TestDNSAnswer request.
83type TestDNSAnswerOutput struct {
84
85	// The Amazon Route 53 name server used to respond to the request.
86	//
87	// This member is required.
88	Nameserver *string
89
90	// The protocol that Amazon Route 53 used to respond to the request, either UDP or
91	// TCP.
92	//
93	// This member is required.
94	Protocol *string
95
96	// A list that contains values that Amazon Route 53 returned for this resource
97	// record set.
98	//
99	// This member is required.
100	RecordData []string
101
102	// The name of the resource record set that you submitted a request for.
103	//
104	// This member is required.
105	RecordName *string
106
107	// The type of the resource record set that you submitted a request for.
108	//
109	// This member is required.
110	RecordType types.RRType
111
112	// A code that indicates whether the request is valid or not. The most common
113	// response code is NOERROR, meaning that the request is valid. If the response is
114	// not valid, Amazon Route 53 returns a response code that describes the error. For
115	// a list of possible response codes, see DNS RCODES
116	// (http://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-6)
117	// on the IANA website.
118	//
119	// This member is required.
120	ResponseCode *string
121
122	// Metadata pertaining to the operation's result.
123	ResultMetadata middleware.Metadata
124
125	noSmithyDocumentSerde
126}
127
128func (c *Client) addOperationTestDNSAnswerMiddlewares(stack *middleware.Stack, options Options) (err error) {
129	err = stack.Serialize.Add(&awsRestxml_serializeOpTestDNSAnswer{}, middleware.After)
130	if err != nil {
131		return err
132	}
133	err = stack.Deserialize.Add(&awsRestxml_deserializeOpTestDNSAnswer{}, middleware.After)
134	if err != nil {
135		return err
136	}
137	if err = addSetLoggerMiddleware(stack, options); err != nil {
138		return err
139	}
140	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
141		return err
142	}
143	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
144		return err
145	}
146	if err = addResolveEndpointMiddleware(stack, options); err != nil {
147		return err
148	}
149	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
150		return err
151	}
152	if err = addRetryMiddlewares(stack, options); err != nil {
153		return err
154	}
155	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
156		return err
157	}
158	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
159		return err
160	}
161	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
162		return err
163	}
164	if err = addClientUserAgent(stack); err != nil {
165		return err
166	}
167	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
168		return err
169	}
170	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
171		return err
172	}
173	if err = addOpTestDNSAnswerValidationMiddleware(stack); err != nil {
174		return err
175	}
176	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opTestDNSAnswer(options.Region), middleware.Before); err != nil {
177		return err
178	}
179	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
180		return err
181	}
182	if err = addResponseErrorMiddleware(stack); err != nil {
183		return err
184	}
185	if err = addSanitizeURLMiddleware(stack); err != nil {
186		return err
187	}
188	if err = addRequestResponseLogging(stack, options); err != nil {
189		return err
190	}
191	return nil
192}
193
194func newServiceMetadataMiddleware_opTestDNSAnswer(region string) *awsmiddleware.RegisterServiceMetadata {
195	return &awsmiddleware.RegisterServiceMetadata{
196		Region:        region,
197		ServiceID:     ServiceID,
198		SigningName:   "route53",
199		OperationName: "TestDNSAnswer",
200	}
201}
202