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// Modifies the customer gateway or the target gateway of an AWS Site-to-Site VPN 15// connection. To modify the target gateway, the following migration options are 16// available: 17// 18// * An existing virtual private gateway to a new virtual private 19// gateway 20// 21// * An existing virtual private gateway to a transit gateway 22// 23// * An 24// existing transit gateway to a new transit gateway 25// 26// * An existing transit gateway 27// to a virtual private gateway 28// 29// Before you perform the migration to the new 30// gateway, you must configure the new gateway. Use CreateVpnGateway to create a 31// virtual private gateway, or CreateTransitGateway to create a transit gateway. 32// This step is required when you migrate from a virtual private gateway with 33// static routes to a transit gateway. You must delete the static routes before you 34// migrate to the new gateway. Keep a copy of the static route before you delete 35// it. You will need to add back these routes to the transit gateway after the VPN 36// connection migration is complete. After you migrate to the new gateway, you 37// might need to modify your VPC route table. Use CreateRoute and DeleteRoute to 38// make the changes described in VPN Gateway Target Modification Required VPC Route 39// Table Updates 40// (https://docs.aws.amazon.com/vpn/latest/s2svpn/modify-vpn-target.html#step-update-routing) 41// in the AWS Site-to-Site VPN User Guide. When the new gateway is a transit 42// gateway, modify the transit gateway route table to allow traffic between the VPC 43// and the AWS Site-to-Site VPN connection. Use CreateTransitGatewayRoute to add 44// the routes. If you deleted VPN static routes, you must add the static routes to 45// the transit gateway route table. After you perform this operation, the AWS VPN 46// endpoint's IP addresses on the AWS side and the tunnel options remain intact. 47// Your AWS Site-to-Site VPN connection will be temporarily unavailable for a brief 48// period while we provision the new endpoints. 49func (c *Client) ModifyVpnConnection(ctx context.Context, params *ModifyVpnConnectionInput, optFns ...func(*Options)) (*ModifyVpnConnectionOutput, error) { 50 if params == nil { 51 params = &ModifyVpnConnectionInput{} 52 } 53 54 result, metadata, err := c.invokeOperation(ctx, "ModifyVpnConnection", params, optFns, addOperationModifyVpnConnectionMiddlewares) 55 if err != nil { 56 return nil, err 57 } 58 59 out := result.(*ModifyVpnConnectionOutput) 60 out.ResultMetadata = metadata 61 return out, nil 62} 63 64type ModifyVpnConnectionInput struct { 65 66 // The ID of the VPN connection. 67 // 68 // This member is required. 69 VpnConnectionId *string 70 71 // The ID of the customer gateway at your end of the VPN connection. 72 CustomerGatewayId *string 73 74 // Checks whether you have the required permissions for the action, without 75 // actually making the request, and provides an error response. If you have the 76 // required permissions, the error response is DryRunOperation. Otherwise, it is 77 // UnauthorizedOperation. 78 DryRun bool 79 80 // The ID of the transit gateway. 81 TransitGatewayId *string 82 83 // The ID of the virtual private gateway at the AWS side of the VPN connection. 84 VpnGatewayId *string 85} 86 87type ModifyVpnConnectionOutput struct { 88 89 // Describes a VPN connection. 90 VpnConnection *types.VpnConnection 91 92 // Metadata pertaining to the operation's result. 93 ResultMetadata middleware.Metadata 94} 95 96func addOperationModifyVpnConnectionMiddlewares(stack *middleware.Stack, options Options) (err error) { 97 err = stack.Serialize.Add(&awsEc2query_serializeOpModifyVpnConnection{}, middleware.After) 98 if err != nil { 99 return err 100 } 101 err = stack.Deserialize.Add(&awsEc2query_deserializeOpModifyVpnConnection{}, middleware.After) 102 if err != nil { 103 return err 104 } 105 if err = addSetLoggerMiddleware(stack, options); err != nil { 106 return err 107 } 108 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 109 return err 110 } 111 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 112 return err 113 } 114 if err = addResolveEndpointMiddleware(stack, options); err != nil { 115 return err 116 } 117 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 118 return err 119 } 120 if err = addRetryMiddlewares(stack, options); err != nil { 121 return err 122 } 123 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 124 return err 125 } 126 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 127 return err 128 } 129 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 130 return err 131 } 132 if err = addClientUserAgent(stack); err != nil { 133 return err 134 } 135 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 136 return err 137 } 138 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 139 return err 140 } 141 if err = addOpModifyVpnConnectionValidationMiddleware(stack); err != nil { 142 return err 143 } 144 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opModifyVpnConnection(options.Region), middleware.Before); err != nil { 145 return err 146 } 147 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 148 return err 149 } 150 if err = addResponseErrorMiddleware(stack); err != nil { 151 return err 152 } 153 if err = addRequestResponseLogging(stack, options); err != nil { 154 return err 155 } 156 return nil 157} 158 159func newServiceMetadataMiddleware_opModifyVpnConnection(region string) *awsmiddleware.RegisterServiceMetadata { 160 return &awsmiddleware.RegisterServiceMetadata{ 161 Region: region, 162 ServiceID: ServiceID, 163 SigningName: "ec2", 164 OperationName: "ModifyVpnConnection", 165 } 166} 167