1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package directconnect
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/directconnect/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Provisions a private virtual interface to be owned by the specified AWS account.
15// Virtual interfaces created using this action must be confirmed by the owner
16// using ConfirmPrivateVirtualInterface. Until then, the virtual interface is in
17// the Confirming state and is not available to handle traffic.
18func (c *Client) AllocatePrivateVirtualInterface(ctx context.Context, params *AllocatePrivateVirtualInterfaceInput, optFns ...func(*Options)) (*AllocatePrivateVirtualInterfaceOutput, error) {
19	if params == nil {
20		params = &AllocatePrivateVirtualInterfaceInput{}
21	}
22
23	result, metadata, err := c.invokeOperation(ctx, "AllocatePrivateVirtualInterface", params, optFns, addOperationAllocatePrivateVirtualInterfaceMiddlewares)
24	if err != nil {
25		return nil, err
26	}
27
28	out := result.(*AllocatePrivateVirtualInterfaceOutput)
29	out.ResultMetadata = metadata
30	return out, nil
31}
32
33type AllocatePrivateVirtualInterfaceInput struct {
34
35	// The ID of the connection on which the private virtual interface is provisioned.
36	//
37	// This member is required.
38	ConnectionId *string
39
40	// Information about the private virtual interface.
41	//
42	// This member is required.
43	NewPrivateVirtualInterfaceAllocation *types.NewPrivateVirtualInterfaceAllocation
44
45	// The ID of the AWS account that owns the virtual private interface.
46	//
47	// This member is required.
48	OwnerAccount *string
49}
50
51// Information about a virtual interface.
52type AllocatePrivateVirtualInterfaceOutput struct {
53
54	// The address family for the BGP peer.
55	AddressFamily types.AddressFamily
56
57	// The IP address assigned to the Amazon interface.
58	AmazonAddress *string
59
60	// The autonomous system number (ASN) for the Amazon side of the connection.
61	AmazonSideAsn *int64
62
63	// The autonomous system (AS) number for Border Gateway Protocol (BGP)
64	// configuration. The valid values are 1-2147483647.
65	Asn int32
66
67	// The authentication key for BGP configuration. This string has a minimum length
68	// of 6 characters and and a maximun lenth of 80 characters.
69	AuthKey *string
70
71	// The Direct Connect endpoint on which the virtual interface terminates.
72	AwsDeviceV2 *string
73
74	// The BGP peers configured on this virtual interface.
75	BgpPeers []types.BGPPeer
76
77	// The ID of the connection.
78	ConnectionId *string
79
80	// The IP address assigned to the customer interface.
81	CustomerAddress *string
82
83	// The customer router configuration.
84	CustomerRouterConfig *string
85
86	// The ID of the Direct Connect gateway.
87	DirectConnectGatewayId *string
88
89	// Indicates whether jumbo frames (9001 MTU) are supported.
90	JumboFrameCapable *bool
91
92	// The location of the connection.
93	Location *string
94
95	// The maximum transmission unit (MTU), in bytes. The supported values are 1500 and
96	// 9001. The default value is 1500.
97	Mtu *int32
98
99	// The ID of the AWS account that owns the virtual interface.
100	OwnerAccount *string
101
102	// The AWS Region where the virtual interface is located.
103	Region *string
104
105	// The routes to be advertised to the AWS network in this Region. Applies to public
106	// virtual interfaces.
107	RouteFilterPrefixes []types.RouteFilterPrefix
108
109	// The tags associated with the virtual interface.
110	Tags []types.Tag
111
112	// The ID of the virtual private gateway. Applies only to private virtual
113	// interfaces.
114	VirtualGatewayId *string
115
116	// The ID of the virtual interface.
117	VirtualInterfaceId *string
118
119	// The name of the virtual interface assigned by the customer network. The name has
120	// a maximum of 100 characters. The following are valid characters: a-z, 0-9 and a
121	// hyphen (-).
122	VirtualInterfaceName *string
123
124	// The state of the virtual interface. The following are the possible values:
125	//
126	// *
127	// confirming: The creation of the virtual interface is pending confirmation from
128	// the virtual interface owner. If the owner of the virtual interface is different
129	// from the owner of the connection on which it is provisioned, then the virtual
130	// interface will remain in this state until it is confirmed by the virtual
131	// interface owner.
132	//
133	// * verifying: This state only applies to public virtual
134	// interfaces. Each public virtual interface needs validation before the virtual
135	// interface can be created.
136	//
137	// * pending: A virtual interface is in this state from
138	// the time that it is created until the virtual interface is ready to forward
139	// traffic.
140	//
141	// * available: A virtual interface that is able to forward traffic.
142	//
143	// *
144	// down: A virtual interface that is BGP down.
145	//
146	// * deleting: A virtual interface is
147	// in this state immediately after calling DeleteVirtualInterface until it can no
148	// longer forward traffic.
149	//
150	// * deleted: A virtual interface that cannot forward
151	// traffic.
152	//
153	// * rejected: The virtual interface owner has declined creation of the
154	// virtual interface. If a virtual interface in the Confirming state is deleted by
155	// the virtual interface owner, the virtual interface enters the Rejected state.
156	//
157	// *
158	// unknown: The state of the virtual interface is not available.
159	VirtualInterfaceState types.VirtualInterfaceState
160
161	// The type of virtual interface. The possible values are private and public.
162	VirtualInterfaceType *string
163
164	// The ID of the VLAN.
165	Vlan int32
166
167	// Metadata pertaining to the operation's result.
168	ResultMetadata middleware.Metadata
169}
170
171func addOperationAllocatePrivateVirtualInterfaceMiddlewares(stack *middleware.Stack, options Options) (err error) {
172	err = stack.Serialize.Add(&awsAwsjson11_serializeOpAllocatePrivateVirtualInterface{}, middleware.After)
173	if err != nil {
174		return err
175	}
176	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpAllocatePrivateVirtualInterface{}, middleware.After)
177	if err != nil {
178		return err
179	}
180	if err = addSetLoggerMiddleware(stack, options); err != nil {
181		return err
182	}
183	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
184		return err
185	}
186	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
187		return err
188	}
189	if err = addResolveEndpointMiddleware(stack, options); err != nil {
190		return err
191	}
192	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
193		return err
194	}
195	if err = addRetryMiddlewares(stack, options); err != nil {
196		return err
197	}
198	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
199		return err
200	}
201	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
202		return err
203	}
204	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
205		return err
206	}
207	if err = addClientUserAgent(stack); err != nil {
208		return err
209	}
210	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
211		return err
212	}
213	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
214		return err
215	}
216	if err = addOpAllocatePrivateVirtualInterfaceValidationMiddleware(stack); err != nil {
217		return err
218	}
219	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAllocatePrivateVirtualInterface(options.Region), middleware.Before); err != nil {
220		return err
221	}
222	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
223		return err
224	}
225	if err = addResponseErrorMiddleware(stack); err != nil {
226		return err
227	}
228	if err = addRequestResponseLogging(stack, options); err != nil {
229		return err
230	}
231	return nil
232}
233
234func newServiceMetadataMiddleware_opAllocatePrivateVirtualInterface(region string) *awsmiddleware.RegisterServiceMetadata {
235	return &awsmiddleware.RegisterServiceMetadata{
236		Region:        region,
237		ServiceID:     ServiceID,
238		SigningName:   "directconnect",
239		OperationName: "AllocatePrivateVirtualInterface",
240	}
241}
242