github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/networkmanager/linkAssociation.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 networkmanager 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 link to a device. 16 // A device can be associated to multiple links and a link can be associated to multiple devices. 17 // The device and link must be in the same global network and the same site. 18 // 19 // ## Example Usage 20 // 21 // <!--Start PulumiCodeChooser --> 22 // ```go 23 // package main 24 // 25 // import ( 26 // 27 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/networkmanager" 28 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 29 // 30 // ) 31 // 32 // func main() { 33 // pulumi.Run(func(ctx *pulumi.Context) error { 34 // _, err := networkmanager.NewLinkAssociation(ctx, "example", &networkmanager.LinkAssociationArgs{ 35 // GlobalNetworkId: pulumi.Any(exampleAwsNetworkmanagerGlobalNetwork.Id), 36 // LinkId: pulumi.Any(exampleAwsNetworkmanagerLink.Id), 37 // DeviceId: pulumi.Any(exampleAwsNetworkmanagerDevice.Id), 38 // }) 39 // if err != nil { 40 // return err 41 // } 42 // return nil 43 // }) 44 // } 45 // 46 // ``` 47 // <!--End PulumiCodeChooser --> 48 // 49 // ## Import 50 // 51 // Using `pulumi import`, import `aws_networkmanager_link_association` using the global network ID, link ID and device ID. For example: 52 // 53 // ```sh 54 // $ pulumi import aws:networkmanager/linkAssociation:LinkAssociation example global-network-0d47f6t230mz46dy4,link-444555aaabbb11223,device-07f6fd08867abc123 55 // ``` 56 type LinkAssociation struct { 57 pulumi.CustomResourceState 58 59 // The ID of the device. 60 DeviceId pulumi.StringOutput `pulumi:"deviceId"` 61 // The ID of the global network. 62 GlobalNetworkId pulumi.StringOutput `pulumi:"globalNetworkId"` 63 // The ID of the link. 64 LinkId pulumi.StringOutput `pulumi:"linkId"` 65 } 66 67 // NewLinkAssociation registers a new resource with the given unique name, arguments, and options. 68 func NewLinkAssociation(ctx *pulumi.Context, 69 name string, args *LinkAssociationArgs, opts ...pulumi.ResourceOption) (*LinkAssociation, error) { 70 if args == nil { 71 return nil, errors.New("missing one or more required arguments") 72 } 73 74 if args.DeviceId == nil { 75 return nil, errors.New("invalid value for required argument 'DeviceId'") 76 } 77 if args.GlobalNetworkId == nil { 78 return nil, errors.New("invalid value for required argument 'GlobalNetworkId'") 79 } 80 if args.LinkId == nil { 81 return nil, errors.New("invalid value for required argument 'LinkId'") 82 } 83 opts = internal.PkgResourceDefaultOpts(opts) 84 var resource LinkAssociation 85 err := ctx.RegisterResource("aws:networkmanager/linkAssociation:LinkAssociation", name, args, &resource, opts...) 86 if err != nil { 87 return nil, err 88 } 89 return &resource, nil 90 } 91 92 // GetLinkAssociation gets an existing LinkAssociation 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 GetLinkAssociation(ctx *pulumi.Context, 95 name string, id pulumi.IDInput, state *LinkAssociationState, opts ...pulumi.ResourceOption) (*LinkAssociation, error) { 96 var resource LinkAssociation 97 err := ctx.ReadResource("aws:networkmanager/linkAssociation:LinkAssociation", 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 LinkAssociation resources. 105 type linkAssociationState struct { 106 // The ID of the device. 107 DeviceId *string `pulumi:"deviceId"` 108 // The ID of the global network. 109 GlobalNetworkId *string `pulumi:"globalNetworkId"` 110 // The ID of the link. 111 LinkId *string `pulumi:"linkId"` 112 } 113 114 type LinkAssociationState struct { 115 // The ID of the device. 116 DeviceId pulumi.StringPtrInput 117 // The ID of the global network. 118 GlobalNetworkId pulumi.StringPtrInput 119 // The ID of the link. 120 LinkId pulumi.StringPtrInput 121 } 122 123 func (LinkAssociationState) ElementType() reflect.Type { 124 return reflect.TypeOf((*linkAssociationState)(nil)).Elem() 125 } 126 127 type linkAssociationArgs struct { 128 // The ID of the device. 129 DeviceId string `pulumi:"deviceId"` 130 // The ID of the global network. 131 GlobalNetworkId string `pulumi:"globalNetworkId"` 132 // The ID of the link. 133 LinkId string `pulumi:"linkId"` 134 } 135 136 // The set of arguments for constructing a LinkAssociation resource. 137 type LinkAssociationArgs struct { 138 // The ID of the device. 139 DeviceId pulumi.StringInput 140 // The ID of the global network. 141 GlobalNetworkId pulumi.StringInput 142 // The ID of the link. 143 LinkId pulumi.StringInput 144 } 145 146 func (LinkAssociationArgs) ElementType() reflect.Type { 147 return reflect.TypeOf((*linkAssociationArgs)(nil)).Elem() 148 } 149 150 type LinkAssociationInput interface { 151 pulumi.Input 152 153 ToLinkAssociationOutput() LinkAssociationOutput 154 ToLinkAssociationOutputWithContext(ctx context.Context) LinkAssociationOutput 155 } 156 157 func (*LinkAssociation) ElementType() reflect.Type { 158 return reflect.TypeOf((**LinkAssociation)(nil)).Elem() 159 } 160 161 func (i *LinkAssociation) ToLinkAssociationOutput() LinkAssociationOutput { 162 return i.ToLinkAssociationOutputWithContext(context.Background()) 163 } 164 165 func (i *LinkAssociation) ToLinkAssociationOutputWithContext(ctx context.Context) LinkAssociationOutput { 166 return pulumi.ToOutputWithContext(ctx, i).(LinkAssociationOutput) 167 } 168 169 // LinkAssociationArrayInput is an input type that accepts LinkAssociationArray and LinkAssociationArrayOutput values. 170 // You can construct a concrete instance of `LinkAssociationArrayInput` via: 171 // 172 // LinkAssociationArray{ LinkAssociationArgs{...} } 173 type LinkAssociationArrayInput interface { 174 pulumi.Input 175 176 ToLinkAssociationArrayOutput() LinkAssociationArrayOutput 177 ToLinkAssociationArrayOutputWithContext(context.Context) LinkAssociationArrayOutput 178 } 179 180 type LinkAssociationArray []LinkAssociationInput 181 182 func (LinkAssociationArray) ElementType() reflect.Type { 183 return reflect.TypeOf((*[]*LinkAssociation)(nil)).Elem() 184 } 185 186 func (i LinkAssociationArray) ToLinkAssociationArrayOutput() LinkAssociationArrayOutput { 187 return i.ToLinkAssociationArrayOutputWithContext(context.Background()) 188 } 189 190 func (i LinkAssociationArray) ToLinkAssociationArrayOutputWithContext(ctx context.Context) LinkAssociationArrayOutput { 191 return pulumi.ToOutputWithContext(ctx, i).(LinkAssociationArrayOutput) 192 } 193 194 // LinkAssociationMapInput is an input type that accepts LinkAssociationMap and LinkAssociationMapOutput values. 195 // You can construct a concrete instance of `LinkAssociationMapInput` via: 196 // 197 // LinkAssociationMap{ "key": LinkAssociationArgs{...} } 198 type LinkAssociationMapInput interface { 199 pulumi.Input 200 201 ToLinkAssociationMapOutput() LinkAssociationMapOutput 202 ToLinkAssociationMapOutputWithContext(context.Context) LinkAssociationMapOutput 203 } 204 205 type LinkAssociationMap map[string]LinkAssociationInput 206 207 func (LinkAssociationMap) ElementType() reflect.Type { 208 return reflect.TypeOf((*map[string]*LinkAssociation)(nil)).Elem() 209 } 210 211 func (i LinkAssociationMap) ToLinkAssociationMapOutput() LinkAssociationMapOutput { 212 return i.ToLinkAssociationMapOutputWithContext(context.Background()) 213 } 214 215 func (i LinkAssociationMap) ToLinkAssociationMapOutputWithContext(ctx context.Context) LinkAssociationMapOutput { 216 return pulumi.ToOutputWithContext(ctx, i).(LinkAssociationMapOutput) 217 } 218 219 type LinkAssociationOutput struct{ *pulumi.OutputState } 220 221 func (LinkAssociationOutput) ElementType() reflect.Type { 222 return reflect.TypeOf((**LinkAssociation)(nil)).Elem() 223 } 224 225 func (o LinkAssociationOutput) ToLinkAssociationOutput() LinkAssociationOutput { 226 return o 227 } 228 229 func (o LinkAssociationOutput) ToLinkAssociationOutputWithContext(ctx context.Context) LinkAssociationOutput { 230 return o 231 } 232 233 // The ID of the device. 234 func (o LinkAssociationOutput) DeviceId() pulumi.StringOutput { 235 return o.ApplyT(func(v *LinkAssociation) pulumi.StringOutput { return v.DeviceId }).(pulumi.StringOutput) 236 } 237 238 // The ID of the global network. 239 func (o LinkAssociationOutput) GlobalNetworkId() pulumi.StringOutput { 240 return o.ApplyT(func(v *LinkAssociation) pulumi.StringOutput { return v.GlobalNetworkId }).(pulumi.StringOutput) 241 } 242 243 // The ID of the link. 244 func (o LinkAssociationOutput) LinkId() pulumi.StringOutput { 245 return o.ApplyT(func(v *LinkAssociation) pulumi.StringOutput { return v.LinkId }).(pulumi.StringOutput) 246 } 247 248 type LinkAssociationArrayOutput struct{ *pulumi.OutputState } 249 250 func (LinkAssociationArrayOutput) ElementType() reflect.Type { 251 return reflect.TypeOf((*[]*LinkAssociation)(nil)).Elem() 252 } 253 254 func (o LinkAssociationArrayOutput) ToLinkAssociationArrayOutput() LinkAssociationArrayOutput { 255 return o 256 } 257 258 func (o LinkAssociationArrayOutput) ToLinkAssociationArrayOutputWithContext(ctx context.Context) LinkAssociationArrayOutput { 259 return o 260 } 261 262 func (o LinkAssociationArrayOutput) Index(i pulumi.IntInput) LinkAssociationOutput { 263 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *LinkAssociation { 264 return vs[0].([]*LinkAssociation)[vs[1].(int)] 265 }).(LinkAssociationOutput) 266 } 267 268 type LinkAssociationMapOutput struct{ *pulumi.OutputState } 269 270 func (LinkAssociationMapOutput) ElementType() reflect.Type { 271 return reflect.TypeOf((*map[string]*LinkAssociation)(nil)).Elem() 272 } 273 274 func (o LinkAssociationMapOutput) ToLinkAssociationMapOutput() LinkAssociationMapOutput { 275 return o 276 } 277 278 func (o LinkAssociationMapOutput) ToLinkAssociationMapOutputWithContext(ctx context.Context) LinkAssociationMapOutput { 279 return o 280 } 281 282 func (o LinkAssociationMapOutput) MapIndex(k pulumi.StringInput) LinkAssociationOutput { 283 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *LinkAssociation { 284 return vs[0].(map[string]*LinkAssociation)[vs[1].(string)] 285 }).(LinkAssociationOutput) 286 } 287 288 func init() { 289 pulumi.RegisterInputType(reflect.TypeOf((*LinkAssociationInput)(nil)).Elem(), &LinkAssociation{}) 290 pulumi.RegisterInputType(reflect.TypeOf((*LinkAssociationArrayInput)(nil)).Elem(), LinkAssociationArray{}) 291 pulumi.RegisterInputType(reflect.TypeOf((*LinkAssociationMapInput)(nil)).Elem(), LinkAssociationMap{}) 292 pulumi.RegisterOutputType(LinkAssociationOutput{}) 293 pulumi.RegisterOutputType(LinkAssociationArrayOutput{}) 294 pulumi.RegisterOutputType(LinkAssociationMapOutput{}) 295 }