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