github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/directconnect/connectionAssociation.go (about) 1 // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT. 2 // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** 3 4 package directconnect 5 6 import ( 7 "context" 8 "reflect" 9 10 "errors" 11 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 12 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 13 ) 14 15 // Associates a Direct Connect Connection with a LAG. 16 // 17 // ## Example Usage 18 // 19 // <!--Start PulumiCodeChooser --> 20 // ```go 21 // package main 22 // 23 // import ( 24 // 25 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/directconnect" 26 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 27 // 28 // ) 29 // 30 // func main() { 31 // pulumi.Run(func(ctx *pulumi.Context) error { 32 // example, err := directconnect.NewConnection(ctx, "example", &directconnect.ConnectionArgs{ 33 // Name: pulumi.String("example"), 34 // Bandwidth: pulumi.String("1Gbps"), 35 // Location: pulumi.String("EqSe2-EQ"), 36 // }) 37 // if err != nil { 38 // return err 39 // } 40 // exampleLinkAggregationGroup, err := directconnect.NewLinkAggregationGroup(ctx, "example", &directconnect.LinkAggregationGroupArgs{ 41 // Name: pulumi.String("example"), 42 // ConnectionsBandwidth: pulumi.String("1Gbps"), 43 // Location: pulumi.String("EqSe2-EQ"), 44 // }) 45 // if err != nil { 46 // return err 47 // } 48 // _, err = directconnect.NewConnectionAssociation(ctx, "example", &directconnect.ConnectionAssociationArgs{ 49 // ConnectionId: example.ID(), 50 // LagId: exampleLinkAggregationGroup.ID(), 51 // }) 52 // if err != nil { 53 // return err 54 // } 55 // return nil 56 // }) 57 // } 58 // 59 // ``` 60 // <!--End PulumiCodeChooser --> 61 type ConnectionAssociation struct { 62 pulumi.CustomResourceState 63 64 // The ID of the connection. 65 ConnectionId pulumi.StringOutput `pulumi:"connectionId"` 66 // The ID of the LAG with which to associate the connection. 67 LagId pulumi.StringOutput `pulumi:"lagId"` 68 } 69 70 // NewConnectionAssociation registers a new resource with the given unique name, arguments, and options. 71 func NewConnectionAssociation(ctx *pulumi.Context, 72 name string, args *ConnectionAssociationArgs, opts ...pulumi.ResourceOption) (*ConnectionAssociation, error) { 73 if args == nil { 74 return nil, errors.New("missing one or more required arguments") 75 } 76 77 if args.ConnectionId == nil { 78 return nil, errors.New("invalid value for required argument 'ConnectionId'") 79 } 80 if args.LagId == nil { 81 return nil, errors.New("invalid value for required argument 'LagId'") 82 } 83 opts = internal.PkgResourceDefaultOpts(opts) 84 var resource ConnectionAssociation 85 err := ctx.RegisterResource("aws:directconnect/connectionAssociation:ConnectionAssociation", name, args, &resource, opts...) 86 if err != nil { 87 return nil, err 88 } 89 return &resource, nil 90 } 91 92 // GetConnectionAssociation gets an existing ConnectionAssociation resource's state with the given name, ID, and optional 93 // state properties that are used to uniquely qualify the lookup (nil if not required). 94 func GetConnectionAssociation(ctx *pulumi.Context, 95 name string, id pulumi.IDInput, state *ConnectionAssociationState, opts ...pulumi.ResourceOption) (*ConnectionAssociation, error) { 96 var resource ConnectionAssociation 97 err := ctx.ReadResource("aws:directconnect/connectionAssociation:ConnectionAssociation", name, id, state, &resource, opts...) 98 if err != nil { 99 return nil, err 100 } 101 return &resource, nil 102 } 103 104 // Input properties used for looking up and filtering ConnectionAssociation resources. 105 type connectionAssociationState struct { 106 // The ID of the connection. 107 ConnectionId *string `pulumi:"connectionId"` 108 // The ID of the LAG with which to associate the connection. 109 LagId *string `pulumi:"lagId"` 110 } 111 112 type ConnectionAssociationState struct { 113 // The ID of the connection. 114 ConnectionId pulumi.StringPtrInput 115 // The ID of the LAG with which to associate the connection. 116 LagId pulumi.StringPtrInput 117 } 118 119 func (ConnectionAssociationState) ElementType() reflect.Type { 120 return reflect.TypeOf((*connectionAssociationState)(nil)).Elem() 121 } 122 123 type connectionAssociationArgs struct { 124 // The ID of the connection. 125 ConnectionId string `pulumi:"connectionId"` 126 // The ID of the LAG with which to associate the connection. 127 LagId string `pulumi:"lagId"` 128 } 129 130 // The set of arguments for constructing a ConnectionAssociation resource. 131 type ConnectionAssociationArgs struct { 132 // The ID of the connection. 133 ConnectionId pulumi.StringInput 134 // The ID of the LAG with which to associate the connection. 135 LagId pulumi.StringInput 136 } 137 138 func (ConnectionAssociationArgs) ElementType() reflect.Type { 139 return reflect.TypeOf((*connectionAssociationArgs)(nil)).Elem() 140 } 141 142 type ConnectionAssociationInput interface { 143 pulumi.Input 144 145 ToConnectionAssociationOutput() ConnectionAssociationOutput 146 ToConnectionAssociationOutputWithContext(ctx context.Context) ConnectionAssociationOutput 147 } 148 149 func (*ConnectionAssociation) ElementType() reflect.Type { 150 return reflect.TypeOf((**ConnectionAssociation)(nil)).Elem() 151 } 152 153 func (i *ConnectionAssociation) ToConnectionAssociationOutput() ConnectionAssociationOutput { 154 return i.ToConnectionAssociationOutputWithContext(context.Background()) 155 } 156 157 func (i *ConnectionAssociation) ToConnectionAssociationOutputWithContext(ctx context.Context) ConnectionAssociationOutput { 158 return pulumi.ToOutputWithContext(ctx, i).(ConnectionAssociationOutput) 159 } 160 161 // ConnectionAssociationArrayInput is an input type that accepts ConnectionAssociationArray and ConnectionAssociationArrayOutput values. 162 // You can construct a concrete instance of `ConnectionAssociationArrayInput` via: 163 // 164 // ConnectionAssociationArray{ ConnectionAssociationArgs{...} } 165 type ConnectionAssociationArrayInput interface { 166 pulumi.Input 167 168 ToConnectionAssociationArrayOutput() ConnectionAssociationArrayOutput 169 ToConnectionAssociationArrayOutputWithContext(context.Context) ConnectionAssociationArrayOutput 170 } 171 172 type ConnectionAssociationArray []ConnectionAssociationInput 173 174 func (ConnectionAssociationArray) ElementType() reflect.Type { 175 return reflect.TypeOf((*[]*ConnectionAssociation)(nil)).Elem() 176 } 177 178 func (i ConnectionAssociationArray) ToConnectionAssociationArrayOutput() ConnectionAssociationArrayOutput { 179 return i.ToConnectionAssociationArrayOutputWithContext(context.Background()) 180 } 181 182 func (i ConnectionAssociationArray) ToConnectionAssociationArrayOutputWithContext(ctx context.Context) ConnectionAssociationArrayOutput { 183 return pulumi.ToOutputWithContext(ctx, i).(ConnectionAssociationArrayOutput) 184 } 185 186 // ConnectionAssociationMapInput is an input type that accepts ConnectionAssociationMap and ConnectionAssociationMapOutput values. 187 // You can construct a concrete instance of `ConnectionAssociationMapInput` via: 188 // 189 // ConnectionAssociationMap{ "key": ConnectionAssociationArgs{...} } 190 type ConnectionAssociationMapInput interface { 191 pulumi.Input 192 193 ToConnectionAssociationMapOutput() ConnectionAssociationMapOutput 194 ToConnectionAssociationMapOutputWithContext(context.Context) ConnectionAssociationMapOutput 195 } 196 197 type ConnectionAssociationMap map[string]ConnectionAssociationInput 198 199 func (ConnectionAssociationMap) ElementType() reflect.Type { 200 return reflect.TypeOf((*map[string]*ConnectionAssociation)(nil)).Elem() 201 } 202 203 func (i ConnectionAssociationMap) ToConnectionAssociationMapOutput() ConnectionAssociationMapOutput { 204 return i.ToConnectionAssociationMapOutputWithContext(context.Background()) 205 } 206 207 func (i ConnectionAssociationMap) ToConnectionAssociationMapOutputWithContext(ctx context.Context) ConnectionAssociationMapOutput { 208 return pulumi.ToOutputWithContext(ctx, i).(ConnectionAssociationMapOutput) 209 } 210 211 type ConnectionAssociationOutput struct{ *pulumi.OutputState } 212 213 func (ConnectionAssociationOutput) ElementType() reflect.Type { 214 return reflect.TypeOf((**ConnectionAssociation)(nil)).Elem() 215 } 216 217 func (o ConnectionAssociationOutput) ToConnectionAssociationOutput() ConnectionAssociationOutput { 218 return o 219 } 220 221 func (o ConnectionAssociationOutput) ToConnectionAssociationOutputWithContext(ctx context.Context) ConnectionAssociationOutput { 222 return o 223 } 224 225 // The ID of the connection. 226 func (o ConnectionAssociationOutput) ConnectionId() pulumi.StringOutput { 227 return o.ApplyT(func(v *ConnectionAssociation) pulumi.StringOutput { return v.ConnectionId }).(pulumi.StringOutput) 228 } 229 230 // The ID of the LAG with which to associate the connection. 231 func (o ConnectionAssociationOutput) LagId() pulumi.StringOutput { 232 return o.ApplyT(func(v *ConnectionAssociation) pulumi.StringOutput { return v.LagId }).(pulumi.StringOutput) 233 } 234 235 type ConnectionAssociationArrayOutput struct{ *pulumi.OutputState } 236 237 func (ConnectionAssociationArrayOutput) ElementType() reflect.Type { 238 return reflect.TypeOf((*[]*ConnectionAssociation)(nil)).Elem() 239 } 240 241 func (o ConnectionAssociationArrayOutput) ToConnectionAssociationArrayOutput() ConnectionAssociationArrayOutput { 242 return o 243 } 244 245 func (o ConnectionAssociationArrayOutput) ToConnectionAssociationArrayOutputWithContext(ctx context.Context) ConnectionAssociationArrayOutput { 246 return o 247 } 248 249 func (o ConnectionAssociationArrayOutput) Index(i pulumi.IntInput) ConnectionAssociationOutput { 250 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ConnectionAssociation { 251 return vs[0].([]*ConnectionAssociation)[vs[1].(int)] 252 }).(ConnectionAssociationOutput) 253 } 254 255 type ConnectionAssociationMapOutput struct{ *pulumi.OutputState } 256 257 func (ConnectionAssociationMapOutput) ElementType() reflect.Type { 258 return reflect.TypeOf((*map[string]*ConnectionAssociation)(nil)).Elem() 259 } 260 261 func (o ConnectionAssociationMapOutput) ToConnectionAssociationMapOutput() ConnectionAssociationMapOutput { 262 return o 263 } 264 265 func (o ConnectionAssociationMapOutput) ToConnectionAssociationMapOutputWithContext(ctx context.Context) ConnectionAssociationMapOutput { 266 return o 267 } 268 269 func (o ConnectionAssociationMapOutput) MapIndex(k pulumi.StringInput) ConnectionAssociationOutput { 270 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ConnectionAssociation { 271 return vs[0].(map[string]*ConnectionAssociation)[vs[1].(string)] 272 }).(ConnectionAssociationOutput) 273 } 274 275 func init() { 276 pulumi.RegisterInputType(reflect.TypeOf((*ConnectionAssociationInput)(nil)).Elem(), &ConnectionAssociation{}) 277 pulumi.RegisterInputType(reflect.TypeOf((*ConnectionAssociationArrayInput)(nil)).Elem(), ConnectionAssociationArray{}) 278 pulumi.RegisterInputType(reflect.TypeOf((*ConnectionAssociationMapInput)(nil)).Elem(), ConnectionAssociationMap{}) 279 pulumi.RegisterOutputType(ConnectionAssociationOutput{}) 280 pulumi.RegisterOutputType(ConnectionAssociationArrayOutput{}) 281 pulumi.RegisterOutputType(ConnectionAssociationMapOutput{}) 282 }