api_op_TestDNSAnswer.go raw

   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.
  17  //
  18  // This call only supports querying public hosted zones.
  19  //
  20  // The TestDnsAnswer  returns information similar to what you would expect from
  21  // the answer section of the dig command. Therefore, if you query for the name
  22  // servers of a subdomain that point to the parent name servers, those will not be
  23  // returned.
  24  func (c *Client) TestDNSAnswer(ctx context.Context, params *TestDNSAnswerInput, optFns ...func(*Options)) (*TestDNSAnswerOutput, error) {
  25  	if params == nil {
  26  		params = &TestDNSAnswerInput{}
  27  	}
  28  
  29  	result, metadata, err := c.invokeOperation(ctx, "TestDNSAnswer", params, optFns, c.addOperationTestDNSAnswerMiddlewares)
  30  	if err != nil {
  31  		return nil, err
  32  	}
  33  
  34  	out := result.(*TestDNSAnswerOutput)
  35  	out.ResultMetadata = metadata
  36  	return out, nil
  37  }
  38  
  39  // Gets the value that Amazon Route 53 returns in response to a DNS request for a
  40  // specified record name and type. You can optionally specify the IP address of a
  41  // DNS resolver, an EDNS0 client subnet IP address, and a subnet mask.
  42  type TestDNSAnswerInput struct {
  43  
  44  	// The ID of the hosted zone that you want Amazon Route 53 to simulate a query for.
  45  	//
  46  	// This member is required.
  47  	HostedZoneId *string
  48  
  49  	// The name of the resource record set that you want Amazon Route 53 to simulate a
  50  	// query for.
  51  	//
  52  	// This member is required.
  53  	RecordName *string
  54  
  55  	// The type of the resource record set.
  56  	//
  57  	// This member is required.
  58  	RecordType types.RRType
  59  
  60  	// If the resolver that you specified for resolverip supports EDNS0, specify the
  61  	// IPv4 or IPv6 address of a client in the applicable location, for example,
  62  	// 192.0.2.44 or 2001:db8:85a3::8a2e:370:7334 .
  63  	EDNS0ClientSubnetIP *string
  64  
  65  	// If you specify an IP address for edns0clientsubnetip , you can optionally
  66  	// specify the number of bits of the IP address that you want the checking tool to
  67  	// include in the DNS query. For example, if you specify 192.0.2.44 for
  68  	// edns0clientsubnetip and 24 for edns0clientsubnetmask , the checking tool will
  69  	// simulate a request from 192.0.2.0/24. The default value is 24 bits for IPv4
  70  	// addresses and 64 bits for IPv6 addresses.
  71  	//
  72  	// The range of valid values depends on whether edns0clientsubnetip is an IPv4 or
  73  	// an IPv6 address:
  74  	//
  75  	//   - IPv4: Specify a value between 0 and 32
  76  	//
  77  	//   - IPv6: Specify a value between 0 and 128
  78  	EDNS0ClientSubnetMask *string
  79  
  80  	// If you want to simulate a request from a specific DNS resolver, specify the IP
  81  	// address for that resolver. If you omit this value, TestDnsAnswer uses the IP
  82  	// address of a DNS resolver in the Amazon Web Services US East (N. Virginia)
  83  	// Region ( us-east-1 ).
  84  	ResolverIP *string
  85  
  86  	noSmithyDocumentSerde
  87  }
  88  
  89  // A complex type that contains the response to a TestDNSAnswer request.
  90  type TestDNSAnswerOutput struct {
  91  
  92  	// The Amazon Route 53 name server used to respond to the request.
  93  	//
  94  	// This member is required.
  95  	Nameserver *string
  96  
  97  	// The protocol that Amazon Route 53 used to respond to the request, either UDP or
  98  	// TCP .
  99  	//
 100  	// This member is required.
 101  	Protocol *string
 102  
 103  	// A list that contains values that Amazon Route 53 returned for this resource
 104  	// record set.
 105  	//
 106  	// This member is required.
 107  	RecordData []string
 108  
 109  	// The name of the resource record set that you submitted a request for.
 110  	//
 111  	// This member is required.
 112  	RecordName *string
 113  
 114  	// The type of the resource record set that you submitted a request for.
 115  	//
 116  	// This member is required.
 117  	RecordType types.RRType
 118  
 119  	// A code that indicates whether the request is valid or not. The most common
 120  	// response code is NOERROR , meaning that the request is valid. If the response is
 121  	// not valid, Amazon Route 53 returns a response code that describes the error. For
 122  	// a list of possible response codes, see [DNS RCODES]on the IANA website.
 123  	//
 124  	// [DNS RCODES]: http://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-6
 125  	//
 126  	// This member is required.
 127  	ResponseCode *string
 128  
 129  	// Metadata pertaining to the operation's result.
 130  	ResultMetadata middleware.Metadata
 131  
 132  	noSmithyDocumentSerde
 133  }
 134  
 135  func (c *Client) addOperationTestDNSAnswerMiddlewares(stack *middleware.Stack, options Options) (err error) {
 136  	if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
 137  		return err
 138  	}
 139  	err = stack.Serialize.Add(&awsRestxml_serializeOpTestDNSAnswer{}, middleware.After)
 140  	if err != nil {
 141  		return err
 142  	}
 143  	err = stack.Deserialize.Add(&awsRestxml_deserializeOpTestDNSAnswer{}, middleware.After)
 144  	if err != nil {
 145  		return err
 146  	}
 147  	if err := addProtocolFinalizerMiddlewares(stack, options, "TestDNSAnswer"); err != nil {
 148  		return fmt.Errorf("add protocol finalizers: %v", err)
 149  	}
 150  
 151  	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
 152  		return err
 153  	}
 154  	if err = addSetLoggerMiddleware(stack, options); err != nil {
 155  		return err
 156  	}
 157  	if err = addClientRequestID(stack); err != nil {
 158  		return err
 159  	}
 160  	if err = addComputeContentLength(stack); err != nil {
 161  		return err
 162  	}
 163  	if err = addResolveEndpointMiddleware(stack, options); err != nil {
 164  		return err
 165  	}
 166  	if err = addComputePayloadSHA256(stack); err != nil {
 167  		return err
 168  	}
 169  	if err = addRetry(stack, options); err != nil {
 170  		return err
 171  	}
 172  	if err = addRawResponseToMetadata(stack); err != nil {
 173  		return err
 174  	}
 175  	if err = addRecordResponseTiming(stack); err != nil {
 176  		return err
 177  	}
 178  	if err = addSpanRetryLoop(stack, options); err != nil {
 179  		return err
 180  	}
 181  	if err = addClientUserAgent(stack, options); err != nil {
 182  		return err
 183  	}
 184  	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
 185  		return err
 186  	}
 187  	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
 188  		return err
 189  	}
 190  	if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
 191  		return err
 192  	}
 193  	if err = addTimeOffsetBuild(stack, c); err != nil {
 194  		return err
 195  	}
 196  	if err = addUserAgentRetryMode(stack, options); err != nil {
 197  		return err
 198  	}
 199  	if err = addCredentialSource(stack, options); err != nil {
 200  		return err
 201  	}
 202  	if err = addOpTestDNSAnswerValidationMiddleware(stack); err != nil {
 203  		return err
 204  	}
 205  	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opTestDNSAnswer(options.Region), middleware.Before); err != nil {
 206  		return err
 207  	}
 208  	if err = addRecursionDetection(stack); err != nil {
 209  		return err
 210  	}
 211  	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
 212  		return err
 213  	}
 214  	if err = addResponseErrorMiddleware(stack); err != nil {
 215  		return err
 216  	}
 217  	if err = addSanitizeURLMiddleware(stack); err != nil {
 218  		return err
 219  	}
 220  	if err = addRequestResponseLogging(stack, options); err != nil {
 221  		return err
 222  	}
 223  	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
 224  		return err
 225  	}
 226  	if err = addInterceptBeforeRetryLoop(stack, options); err != nil {
 227  		return err
 228  	}
 229  	if err = addInterceptAttempt(stack, options); err != nil {
 230  		return err
 231  	}
 232  	if err = addInterceptors(stack, options); err != nil {
 233  		return err
 234  	}
 235  	return nil
 236  }
 237  
 238  func newServiceMetadataMiddleware_opTestDNSAnswer(region string) *awsmiddleware.RegisterServiceMetadata {
 239  	return &awsmiddleware.RegisterServiceMetadata{
 240  		Region:        region,
 241  		ServiceID:     ServiceID,
 242  		OperationName: "TestDNSAnswer",
 243  	}
 244  }
 245