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	"time"
13)
14
15// Creates a hosted connection on the specified interconnect or a link aggregation
16// group (LAG) of interconnects. Allocates a VLAN number and a specified amount of
17// capacity (bandwidth) for use by a hosted connection on the specified
18// interconnect or LAG of interconnects. AWS polices the hosted connection for the
19// specified capacity and the AWS Direct Connect Partner must also police the
20// hosted connection for the specified capacity. Intended for use by AWS Direct
21// Connect Partners only.
22func (c *Client) AllocateHostedConnection(ctx context.Context, params *AllocateHostedConnectionInput, optFns ...func(*Options)) (*AllocateHostedConnectionOutput, error) {
23	if params == nil {
24		params = &AllocateHostedConnectionInput{}
25	}
26
27	result, metadata, err := c.invokeOperation(ctx, "AllocateHostedConnection", params, optFns, addOperationAllocateHostedConnectionMiddlewares)
28	if err != nil {
29		return nil, err
30	}
31
32	out := result.(*AllocateHostedConnectionOutput)
33	out.ResultMetadata = metadata
34	return out, nil
35}
36
37type AllocateHostedConnectionInput struct {
38
39	// The bandwidth of the connection. The possible values are 50Mbps, 100Mbps,
40	// 200Mbps, 300Mbps, 400Mbps, 500Mbps, 1Gbps, 2Gbps, 5Gbps, and 10Gbps. Note that
41	// only those AWS Direct Connect Partners who have met specific requirements are
42	// allowed to create a 1Gbps, 2Gbps, 5Gbps or 10Gbps hosted connection.
43	//
44	// This member is required.
45	Bandwidth *string
46
47	// The ID of the interconnect or LAG.
48	//
49	// This member is required.
50	ConnectionId *string
51
52	// The name of the hosted connection.
53	//
54	// This member is required.
55	ConnectionName *string
56
57	// The ID of the AWS account ID of the customer for the connection.
58	//
59	// This member is required.
60	OwnerAccount *string
61
62	// The dedicated VLAN provisioned to the hosted connection.
63	//
64	// This member is required.
65	Vlan int32
66
67	// The tags associated with the connection.
68	Tags []types.Tag
69}
70
71// Information about an AWS Direct Connect connection.
72type AllocateHostedConnectionOutput struct {
73
74	// The Direct Connect endpoint on which the physical connection terminates.
75	//
76	// Deprecated: This member has been deprecated.
77	AwsDevice *string
78
79	// The Direct Connect endpoint on which the physical connection terminates.
80	AwsDeviceV2 *string
81
82	// The bandwidth of the connection.
83	Bandwidth *string
84
85	// The ID of the connection.
86	ConnectionId *string
87
88	// The name of the connection.
89	ConnectionName *string
90
91	// The state of the connection. The following are the possible values:
92	//
93	// * ordering:
94	// The initial state of a hosted connection provisioned on an interconnect. The
95	// connection stays in the ordering state until the owner of the hosted connection
96	// confirms or declines the connection order.
97	//
98	// * requested: The initial state of a
99	// standard connection. The connection stays in the requested state until the
100	// Letter of Authorization (LOA) is sent to the customer.
101	//
102	// * pending: The
103	// connection has been approved and is being initialized.
104	//
105	// * available: The network
106	// link is up and the connection is ready for use.
107	//
108	// * down: The network link is
109	// down.
110	//
111	// * deleting: The connection is being deleted.
112	//
113	// * deleted: The connection
114	// has been deleted.
115	//
116	// * rejected: A hosted connection in the ordering state enters
117	// the rejected state if it is deleted by the customer.
118	//
119	// * unknown: The state of
120	// the connection is not available.
121	ConnectionState types.ConnectionState
122
123	// The MAC Security (MACsec) connection encryption mode. The valid values are
124	// no_encrypt, should_encrypt, and must_encrypt.
125	EncryptionMode *string
126
127	// Indicates whether the connection supports a secondary BGP peer in the same
128	// address family (IPv4/IPv6).
129	HasLogicalRedundancy types.HasLogicalRedundancy
130
131	// Indicates whether jumbo frames (9001 MTU) are supported.
132	JumboFrameCapable *bool
133
134	// The ID of the LAG.
135	LagId *string
136
137	// The time of the most recent call to DescribeLoa for this connection.
138	LoaIssueTime *time.Time
139
140	// The location of the connection.
141	Location *string
142
143	// Indicates whether the connection supports MAC Security (MACsec).
144	MacSecCapable *bool
145
146	// The MAC Security (MACsec) security keys associated with the connection.
147	MacSecKeys []types.MacSecKey
148
149	// The ID of the AWS account that owns the connection.
150	OwnerAccount *string
151
152	// The name of the AWS Direct Connect service provider associated with the
153	// connection.
154	PartnerName *string
155
156	// The MAC Security (MACsec) port link status of the connection. The valid values
157	// are Encryption Up, which means that there is an active Connection Key Name, or
158	// Encryption Down.
159	PortEncryptionStatus *string
160
161	// The name of the service provider associated with the connection.
162	ProviderName *string
163
164	// The AWS Region where the connection is located.
165	Region *string
166
167	// The tags associated with the connection.
168	Tags []types.Tag
169
170	// The ID of the VLAN.
171	Vlan int32
172
173	// Metadata pertaining to the operation's result.
174	ResultMetadata middleware.Metadata
175}
176
177func addOperationAllocateHostedConnectionMiddlewares(stack *middleware.Stack, options Options) (err error) {
178	err = stack.Serialize.Add(&awsAwsjson11_serializeOpAllocateHostedConnection{}, middleware.After)
179	if err != nil {
180		return err
181	}
182	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpAllocateHostedConnection{}, middleware.After)
183	if err != nil {
184		return err
185	}
186	if err = addSetLoggerMiddleware(stack, options); err != nil {
187		return err
188	}
189	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
190		return err
191	}
192	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
193		return err
194	}
195	if err = addResolveEndpointMiddleware(stack, options); err != nil {
196		return err
197	}
198	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
199		return err
200	}
201	if err = addRetryMiddlewares(stack, options); err != nil {
202		return err
203	}
204	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
205		return err
206	}
207	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
208		return err
209	}
210	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
211		return err
212	}
213	if err = addClientUserAgent(stack); err != nil {
214		return err
215	}
216	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
217		return err
218	}
219	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
220		return err
221	}
222	if err = addOpAllocateHostedConnectionValidationMiddleware(stack); err != nil {
223		return err
224	}
225	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAllocateHostedConnection(options.Region), middleware.Before); err != nil {
226		return err
227	}
228	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
229		return err
230	}
231	if err = addResponseErrorMiddleware(stack); err != nil {
232		return err
233	}
234	if err = addRequestResponseLogging(stack, options); err != nil {
235		return err
236	}
237	return nil
238}
239
240func newServiceMetadataMiddleware_opAllocateHostedConnection(region string) *awsmiddleware.RegisterServiceMetadata {
241	return &awsmiddleware.RegisterServiceMetadata{
242		Region:        region,
243		ServiceID:     ServiceID,
244		SigningName:   "directconnect",
245		OperationName: "AllocateHostedConnection",
246	}
247}
248