api_op_TestDNSAnswer.go (7132B)
1 // Code generated by smithy-go-codegen DO NOT EDIT. 2 3 package route53 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/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. The TestDnsAnswer returns 18 // information similar to what you would expect from the answer section of the dig 19 // command. Therefore, if you query for the name servers of a subdomain that point 20 // to the parent name servers, those will not be returned. 21 func (c *Client) TestDNSAnswer(ctx context.Context, params *TestDNSAnswerInput, optFns ...func(*Options)) (*TestDNSAnswerOutput, error) { 22 if params == nil { 23 params = &TestDNSAnswerInput{} 24 } 25 26 result, metadata, err := c.invokeOperation(ctx, "TestDNSAnswer", params, optFns, c.addOperationTestDNSAnswerMiddlewares) 27 if err != nil { 28 return nil, err 29 } 30 31 out := result.(*TestDNSAnswerOutput) 32 out.ResultMetadata = metadata 33 return out, nil 34 } 35 36 // Gets the value that Amazon Route 53 returns in response to a DNS request for a 37 // specified record name and type. You can optionally specify the IP address of a 38 // DNS resolver, an EDNS0 client subnet IP address, and a subnet mask. 39 type TestDNSAnswerInput struct { 40 41 // The ID of the hosted zone that you want Amazon Route 53 to simulate a query for. 42 // 43 // This member is required. 44 HostedZoneId *string 45 46 // The name of the resource record set that you want Amazon Route 53 to simulate a 47 // query for. 48 // 49 // This member is required. 50 RecordName *string 51 52 // The type of the resource record set. 53 // 54 // This member is required. 55 RecordType types.RRType 56 57 // If the resolver that you specified for resolverip supports EDNS0, specify the 58 // IPv4 or IPv6 address of a client in the applicable location, for example, 59 // 192.0.2.44 or 2001:db8:85a3::8a2e:370:7334 . 60 EDNS0ClientSubnetIP *string 61 62 // If you specify an IP address for edns0clientsubnetip , you can optionally 63 // specify the number of bits of the IP address that you want the checking tool to 64 // include in the DNS query. For example, if you specify 192.0.2.44 for 65 // edns0clientsubnetip and 24 for edns0clientsubnetmask , the checking tool will 66 // simulate a request from 192.0.2.0/24. The default value is 24 bits for IPv4 67 // addresses and 64 bits for IPv6 addresses. The range of valid values depends on 68 // whether edns0clientsubnetip is an IPv4 or an IPv6 address: 69 // - IPv4: Specify a value between 0 and 32 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. 83 type 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 (http://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-6) 116 // on the IANA website. 117 // 118 // This member is required. 119 ResponseCode *string 120 121 // Metadata pertaining to the operation's result. 122 ResultMetadata middleware.Metadata 123 124 noSmithyDocumentSerde 125 } 126 127 func (c *Client) addOperationTestDNSAnswerMiddlewares(stack *middleware.Stack, options Options) (err error) { 128 if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { 129 return err 130 } 131 err = stack.Serialize.Add(&awsRestxml_serializeOpTestDNSAnswer{}, middleware.After) 132 if err != nil { 133 return err 134 } 135 err = stack.Deserialize.Add(&awsRestxml_deserializeOpTestDNSAnswer{}, middleware.After) 136 if err != nil { 137 return err 138 } 139 if err := addProtocolFinalizerMiddlewares(stack, options, "TestDNSAnswer"); err != nil { 140 return fmt.Errorf("add protocol finalizers: %v", err) 141 } 142 143 if err = addlegacyEndpointContextSetter(stack, options); err != nil { 144 return err 145 } 146 if err = addSetLoggerMiddleware(stack, options); err != nil { 147 return err 148 } 149 if err = addClientRequestID(stack); err != nil { 150 return err 151 } 152 if err = addComputeContentLength(stack); err != nil { 153 return err 154 } 155 if err = addResolveEndpointMiddleware(stack, options); err != nil { 156 return err 157 } 158 if err = addComputePayloadSHA256(stack); err != nil { 159 return err 160 } 161 if err = addRetry(stack, options); err != nil { 162 return err 163 } 164 if err = addRawResponseToMetadata(stack); err != nil { 165 return err 166 } 167 if err = addRecordResponseTiming(stack); err != nil { 168 return err 169 } 170 if err = addClientUserAgent(stack, options); err != nil { 171 return err 172 } 173 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 174 return err 175 } 176 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 177 return err 178 } 179 if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { 180 return err 181 } 182 if err = addOpTestDNSAnswerValidationMiddleware(stack); err != nil { 183 return err 184 } 185 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opTestDNSAnswer(options.Region), middleware.Before); err != nil { 186 return err 187 } 188 if err = addRecursionDetection(stack); err != nil { 189 return err 190 } 191 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 192 return err 193 } 194 if err = addResponseErrorMiddleware(stack); err != nil { 195 return err 196 } 197 if err = addSanitizeURLMiddleware(stack); err != nil { 198 return err 199 } 200 if err = addRequestResponseLogging(stack, options); err != nil { 201 return err 202 } 203 if err = addDisableHTTPSMiddleware(stack, options); err != nil { 204 return err 205 } 206 return nil 207 } 208 209 func newServiceMetadataMiddleware_opTestDNSAnswer(region string) *awsmiddleware.RegisterServiceMetadata { 210 return &awsmiddleware.RegisterServiceMetadata{ 211 Region: region, 212 ServiceID: ServiceID, 213 OperationName: "TestDNSAnswer", 214 } 215 }