api_op_CreateDomainEntry.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  // Creates one of the following domain name system (DNS) records in a domain DNS
  15  // zone: Address (A), canonical name (CNAME), mail exchanger (MX), name server
  16  // (NS), start of authority (SOA), service locator (SRV), or text (TXT).
  17  //
  18  // The create domain entry operation supports tag-based access control via
  19  // resource tags applied to the resource identified by domain name . For more
  20  // information, see the [Amazon Lightsail Developer Guide].
  21  //
  22  // [Amazon Lightsail Developer Guide]: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-controlling-access-using-tags
  23  func (c *Client) CreateDomainEntry(ctx context.Context, params *CreateDomainEntryInput, optFns ...func(*Options)) (*CreateDomainEntryOutput, error) {
  24  	if params == nil {
  25  		params = &CreateDomainEntryInput{}
  26  	}
  27  
  28  	result, metadata, err := c.invokeOperation(ctx, "CreateDomainEntry", params, optFns, c.addOperationCreateDomainEntryMiddlewares)
  29  	if err != nil {
  30  		return nil, err
  31  	}
  32  
  33  	out := result.(*CreateDomainEntryOutput)
  34  	out.ResultMetadata = metadata
  35  	return out, nil
  36  }
  37  
  38  type CreateDomainEntryInput struct {
  39  
  40  	// An array of key-value pairs containing information about the domain entry
  41  	// request.
  42  	//
  43  	// This member is required.
  44  	DomainEntry *types.DomainEntry
  45  
  46  	// The domain name ( example.com ) for which you want to create the domain entry.
  47  	//
  48  	// This member is required.
  49  	DomainName *string
  50  
  51  	noSmithyDocumentSerde
  52  }
  53  
  54  type CreateDomainEntryOutput struct {
  55  
  56  	// An array of objects that describe the result of the action, such as the status
  57  	// of the request, the timestamp of the request, and the resources affected by the
  58  	// request.
  59  	Operation *types.Operation
  60  
  61  	// Metadata pertaining to the operation's result.
  62  	ResultMetadata middleware.Metadata
  63  
  64  	noSmithyDocumentSerde
  65  }
  66  
  67  func (c *Client) addOperationCreateDomainEntryMiddlewares(stack *middleware.Stack, options Options) (err error) {
  68  	if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
  69  		return err
  70  	}
  71  	err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateDomainEntry{}, middleware.After)
  72  	if err != nil {
  73  		return err
  74  	}
  75  	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateDomainEntry{}, middleware.After)
  76  	if err != nil {
  77  		return err
  78  	}
  79  	if err := addProtocolFinalizerMiddlewares(stack, options, "CreateDomainEntry"); err != nil {
  80  		return fmt.Errorf("add protocol finalizers: %v", err)
  81  	}
  82  
  83  	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
  84  		return err
  85  	}
  86  	if err = addSetLoggerMiddleware(stack, options); err != nil {
  87  		return err
  88  	}
  89  	if err = addClientRequestID(stack); err != nil {
  90  		return err
  91  	}
  92  	if err = addComputeContentLength(stack); err != nil {
  93  		return err
  94  	}
  95  	if err = addResolveEndpointMiddleware(stack, options); err != nil {
  96  		return err
  97  	}
  98  	if err = addComputePayloadSHA256(stack); err != nil {
  99  		return err
 100  	}
 101  	if err = addRetry(stack, options); err != nil {
 102  		return err
 103  	}
 104  	if err = addRawResponseToMetadata(stack); err != nil {
 105  		return err
 106  	}
 107  	if err = addRecordResponseTiming(stack); err != nil {
 108  		return err
 109  	}
 110  	if err = addSpanRetryLoop(stack, options); err != nil {
 111  		return err
 112  	}
 113  	if err = addClientUserAgent(stack, options); err != nil {
 114  		return err
 115  	}
 116  	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
 117  		return err
 118  	}
 119  	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
 120  		return err
 121  	}
 122  	if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
 123  		return err
 124  	}
 125  	if err = addTimeOffsetBuild(stack, c); err != nil {
 126  		return err
 127  	}
 128  	if err = addUserAgentRetryMode(stack, options); err != nil {
 129  		return err
 130  	}
 131  	if err = addCredentialSource(stack, options); err != nil {
 132  		return err
 133  	}
 134  	if err = addOpCreateDomainEntryValidationMiddleware(stack); err != nil {
 135  		return err
 136  	}
 137  	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateDomainEntry(options.Region), middleware.Before); err != nil {
 138  		return err
 139  	}
 140  	if err = addRecursionDetection(stack); err != nil {
 141  		return err
 142  	}
 143  	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
 144  		return err
 145  	}
 146  	if err = addResponseErrorMiddleware(stack); err != nil {
 147  		return err
 148  	}
 149  	if err = addRequestResponseLogging(stack, options); err != nil {
 150  		return err
 151  	}
 152  	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
 153  		return err
 154  	}
 155  	if err = addInterceptBeforeRetryLoop(stack, options); err != nil {
 156  		return err
 157  	}
 158  	if err = addInterceptAttempt(stack, options); err != nil {
 159  		return err
 160  	}
 161  	if err = addInterceptors(stack, options); err != nil {
 162  		return err
 163  	}
 164  	return nil
 165  }
 166  
 167  func newServiceMetadataMiddleware_opCreateDomainEntry(region string) *awsmiddleware.RegisterServiceMetadata {
 168  	return &awsmiddleware.RegisterServiceMetadata{
 169  		Region:        region,
 170  		ServiceID:     ServiceID,
 171  		OperationName: "CreateDomainEntry",
 172  	}
 173  }
 174