1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package ec2 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/ec2/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12) 13 14// Creates a Connect peer for a specified transit gateway Connect attachment 15// between a transit gateway and an appliance. The peer address and transit gateway 16// address must be the same IP address family (IPv4 or IPv6). For more information, 17// see Connect peers 18// (https://docs.aws.amazon.com/vpc/latest/tgw/tgw-connect.html#tgw-connect-peer) 19// in the Transit Gateways Guide. 20func (c *Client) CreateTransitGatewayConnectPeer(ctx context.Context, params *CreateTransitGatewayConnectPeerInput, optFns ...func(*Options)) (*CreateTransitGatewayConnectPeerOutput, error) { 21 if params == nil { 22 params = &CreateTransitGatewayConnectPeerInput{} 23 } 24 25 result, metadata, err := c.invokeOperation(ctx, "CreateTransitGatewayConnectPeer", params, optFns, addOperationCreateTransitGatewayConnectPeerMiddlewares) 26 if err != nil { 27 return nil, err 28 } 29 30 out := result.(*CreateTransitGatewayConnectPeerOutput) 31 out.ResultMetadata = metadata 32 return out, nil 33} 34 35type CreateTransitGatewayConnectPeerInput struct { 36 37 // The range of inside IP addresses that are used for BGP peering. You must specify 38 // a size /29 IPv4 CIDR block from the 169.254.0.0/16 range. The first address from 39 // the range must be configured on the appliance as the BGP IP address. You can 40 // also optionally specify a size /125 IPv6 CIDR block from the fd00::/8 range. 41 // 42 // This member is required. 43 InsideCidrBlocks []string 44 45 // The peer IP address (GRE outer IP address) on the appliance side of the Connect 46 // peer. 47 // 48 // This member is required. 49 PeerAddress *string 50 51 // The ID of the Connect attachment. 52 // 53 // This member is required. 54 TransitGatewayAttachmentId *string 55 56 // The BGP options for the Connect peer. 57 BgpOptions *types.TransitGatewayConnectRequestBgpOptions 58 59 // Checks whether you have the required permissions for the action, without 60 // actually making the request, and provides an error response. If you have the 61 // required permissions, the error response is DryRunOperation. Otherwise, it is 62 // UnauthorizedOperation. 63 DryRun bool 64 65 // The tags to apply to the Connect peer. 66 TagSpecifications []types.TagSpecification 67 68 // The peer IP address (GRE outer IP address) on the transit gateway side of the 69 // Connect peer, which must be specified from a transit gateway CIDR block. If not 70 // specified, Amazon automatically assigns the first available IP address from the 71 // transit gateway CIDR block. 72 TransitGatewayAddress *string 73} 74 75type CreateTransitGatewayConnectPeerOutput struct { 76 77 // Information about the Connect peer. 78 TransitGatewayConnectPeer *types.TransitGatewayConnectPeer 79 80 // Metadata pertaining to the operation's result. 81 ResultMetadata middleware.Metadata 82} 83 84func addOperationCreateTransitGatewayConnectPeerMiddlewares(stack *middleware.Stack, options Options) (err error) { 85 err = stack.Serialize.Add(&awsEc2query_serializeOpCreateTransitGatewayConnectPeer{}, middleware.After) 86 if err != nil { 87 return err 88 } 89 err = stack.Deserialize.Add(&awsEc2query_deserializeOpCreateTransitGatewayConnectPeer{}, middleware.After) 90 if err != nil { 91 return err 92 } 93 if err = addSetLoggerMiddleware(stack, options); err != nil { 94 return err 95 } 96 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 97 return err 98 } 99 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 100 return err 101 } 102 if err = addResolveEndpointMiddleware(stack, options); err != nil { 103 return err 104 } 105 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 106 return err 107 } 108 if err = addRetryMiddlewares(stack, options); err != nil { 109 return err 110 } 111 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 112 return err 113 } 114 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 115 return err 116 } 117 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 118 return err 119 } 120 if err = addClientUserAgent(stack); err != nil { 121 return err 122 } 123 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 124 return err 125 } 126 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 127 return err 128 } 129 if err = addOpCreateTransitGatewayConnectPeerValidationMiddleware(stack); err != nil { 130 return err 131 } 132 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateTransitGatewayConnectPeer(options.Region), middleware.Before); 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 return nil 145} 146 147func newServiceMetadataMiddleware_opCreateTransitGatewayConnectPeer(region string) *awsmiddleware.RegisterServiceMetadata { 148 return &awsmiddleware.RegisterServiceMetadata{ 149 Region: region, 150 ServiceID: ServiceID, 151 SigningName: "ec2", 152 OperationName: "CreateTransitGatewayConnectPeer", 153 } 154} 155