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