github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2clientvpn/networkAssociation.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 ec2clientvpn 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 // Provides network associations for AWS Client VPN endpoints. For more information on usage, please see the 16 // [AWS Client VPN Administrator's Guide](https://docs.aws.amazon.com/vpn/latest/clientvpn-admin/what-is.html). 17 // 18 // ## Example Usage 19 // 20 // <!--Start PulumiCodeChooser --> 21 // ```go 22 // package main 23 // 24 // import ( 25 // 26 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2clientvpn" 27 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 28 // 29 // ) 30 // 31 // func main() { 32 // pulumi.Run(func(ctx *pulumi.Context) error { 33 // _, err := ec2clientvpn.NewNetworkAssociation(ctx, "example", &ec2clientvpn.NetworkAssociationArgs{ 34 // ClientVpnEndpointId: pulumi.Any(exampleAwsEc2ClientVpnEndpoint.Id), 35 // SubnetId: pulumi.Any(exampleAwsSubnet.Id), 36 // }) 37 // if err != nil { 38 // return err 39 // } 40 // return nil 41 // }) 42 // } 43 // 44 // ``` 45 // <!--End PulumiCodeChooser --> 46 // 47 // ## Import 48 // 49 // Using `pulumi import`, import AWS Client VPN network associations using the endpoint ID and the association ID. Values are separated by a `,`. For example: 50 // 51 // ```sh 52 // $ pulumi import aws:ec2clientvpn/networkAssociation:NetworkAssociation example cvpn-endpoint-0ac3a1abbccddd666,cvpn-assoc-0b8db902465d069ad 53 // ``` 54 type NetworkAssociation struct { 55 pulumi.CustomResourceState 56 57 // The unique ID of the target network association. 58 AssociationId pulumi.StringOutput `pulumi:"associationId"` 59 // The ID of the Client VPN endpoint. 60 ClientVpnEndpointId pulumi.StringOutput `pulumi:"clientVpnEndpointId"` 61 // The ID of the subnet to associate with the Client VPN endpoint. 62 SubnetId pulumi.StringOutput `pulumi:"subnetId"` 63 // The ID of the VPC in which the target subnet is located. 64 VpcId pulumi.StringOutput `pulumi:"vpcId"` 65 } 66 67 // NewNetworkAssociation registers a new resource with the given unique name, arguments, and options. 68 func NewNetworkAssociation(ctx *pulumi.Context, 69 name string, args *NetworkAssociationArgs, opts ...pulumi.ResourceOption) (*NetworkAssociation, error) { 70 if args == nil { 71 return nil, errors.New("missing one or more required arguments") 72 } 73 74 if args.ClientVpnEndpointId == nil { 75 return nil, errors.New("invalid value for required argument 'ClientVpnEndpointId'") 76 } 77 if args.SubnetId == nil { 78 return nil, errors.New("invalid value for required argument 'SubnetId'") 79 } 80 opts = internal.PkgResourceDefaultOpts(opts) 81 var resource NetworkAssociation 82 err := ctx.RegisterResource("aws:ec2clientvpn/networkAssociation:NetworkAssociation", name, args, &resource, opts...) 83 if err != nil { 84 return nil, err 85 } 86 return &resource, nil 87 } 88 89 // GetNetworkAssociation gets an existing NetworkAssociation resource's state with the given name, ID, and optional 90 // state properties that are used to uniquely qualify the lookup (nil if not required). 91 func GetNetworkAssociation(ctx *pulumi.Context, 92 name string, id pulumi.IDInput, state *NetworkAssociationState, opts ...pulumi.ResourceOption) (*NetworkAssociation, error) { 93 var resource NetworkAssociation 94 err := ctx.ReadResource("aws:ec2clientvpn/networkAssociation:NetworkAssociation", name, id, state, &resource, opts...) 95 if err != nil { 96 return nil, err 97 } 98 return &resource, nil 99 } 100 101 // Input properties used for looking up and filtering NetworkAssociation resources. 102 type networkAssociationState struct { 103 // The unique ID of the target network association. 104 AssociationId *string `pulumi:"associationId"` 105 // The ID of the Client VPN endpoint. 106 ClientVpnEndpointId *string `pulumi:"clientVpnEndpointId"` 107 // The ID of the subnet to associate with the Client VPN endpoint. 108 SubnetId *string `pulumi:"subnetId"` 109 // The ID of the VPC in which the target subnet is located. 110 VpcId *string `pulumi:"vpcId"` 111 } 112 113 type NetworkAssociationState struct { 114 // The unique ID of the target network association. 115 AssociationId pulumi.StringPtrInput 116 // The ID of the Client VPN endpoint. 117 ClientVpnEndpointId pulumi.StringPtrInput 118 // The ID of the subnet to associate with the Client VPN endpoint. 119 SubnetId pulumi.StringPtrInput 120 // The ID of the VPC in which the target subnet is located. 121 VpcId pulumi.StringPtrInput 122 } 123 124 func (NetworkAssociationState) ElementType() reflect.Type { 125 return reflect.TypeOf((*networkAssociationState)(nil)).Elem() 126 } 127 128 type networkAssociationArgs struct { 129 // The ID of the Client VPN endpoint. 130 ClientVpnEndpointId string `pulumi:"clientVpnEndpointId"` 131 // The ID of the subnet to associate with the Client VPN endpoint. 132 SubnetId string `pulumi:"subnetId"` 133 } 134 135 // The set of arguments for constructing a NetworkAssociation resource. 136 type NetworkAssociationArgs struct { 137 // The ID of the Client VPN endpoint. 138 ClientVpnEndpointId pulumi.StringInput 139 // The ID of the subnet to associate with the Client VPN endpoint. 140 SubnetId pulumi.StringInput 141 } 142 143 func (NetworkAssociationArgs) ElementType() reflect.Type { 144 return reflect.TypeOf((*networkAssociationArgs)(nil)).Elem() 145 } 146 147 type NetworkAssociationInput interface { 148 pulumi.Input 149 150 ToNetworkAssociationOutput() NetworkAssociationOutput 151 ToNetworkAssociationOutputWithContext(ctx context.Context) NetworkAssociationOutput 152 } 153 154 func (*NetworkAssociation) ElementType() reflect.Type { 155 return reflect.TypeOf((**NetworkAssociation)(nil)).Elem() 156 } 157 158 func (i *NetworkAssociation) ToNetworkAssociationOutput() NetworkAssociationOutput { 159 return i.ToNetworkAssociationOutputWithContext(context.Background()) 160 } 161 162 func (i *NetworkAssociation) ToNetworkAssociationOutputWithContext(ctx context.Context) NetworkAssociationOutput { 163 return pulumi.ToOutputWithContext(ctx, i).(NetworkAssociationOutput) 164 } 165 166 // NetworkAssociationArrayInput is an input type that accepts NetworkAssociationArray and NetworkAssociationArrayOutput values. 167 // You can construct a concrete instance of `NetworkAssociationArrayInput` via: 168 // 169 // NetworkAssociationArray{ NetworkAssociationArgs{...} } 170 type NetworkAssociationArrayInput interface { 171 pulumi.Input 172 173 ToNetworkAssociationArrayOutput() NetworkAssociationArrayOutput 174 ToNetworkAssociationArrayOutputWithContext(context.Context) NetworkAssociationArrayOutput 175 } 176 177 type NetworkAssociationArray []NetworkAssociationInput 178 179 func (NetworkAssociationArray) ElementType() reflect.Type { 180 return reflect.TypeOf((*[]*NetworkAssociation)(nil)).Elem() 181 } 182 183 func (i NetworkAssociationArray) ToNetworkAssociationArrayOutput() NetworkAssociationArrayOutput { 184 return i.ToNetworkAssociationArrayOutputWithContext(context.Background()) 185 } 186 187 func (i NetworkAssociationArray) ToNetworkAssociationArrayOutputWithContext(ctx context.Context) NetworkAssociationArrayOutput { 188 return pulumi.ToOutputWithContext(ctx, i).(NetworkAssociationArrayOutput) 189 } 190 191 // NetworkAssociationMapInput is an input type that accepts NetworkAssociationMap and NetworkAssociationMapOutput values. 192 // You can construct a concrete instance of `NetworkAssociationMapInput` via: 193 // 194 // NetworkAssociationMap{ "key": NetworkAssociationArgs{...} } 195 type NetworkAssociationMapInput interface { 196 pulumi.Input 197 198 ToNetworkAssociationMapOutput() NetworkAssociationMapOutput 199 ToNetworkAssociationMapOutputWithContext(context.Context) NetworkAssociationMapOutput 200 } 201 202 type NetworkAssociationMap map[string]NetworkAssociationInput 203 204 func (NetworkAssociationMap) ElementType() reflect.Type { 205 return reflect.TypeOf((*map[string]*NetworkAssociation)(nil)).Elem() 206 } 207 208 func (i NetworkAssociationMap) ToNetworkAssociationMapOutput() NetworkAssociationMapOutput { 209 return i.ToNetworkAssociationMapOutputWithContext(context.Background()) 210 } 211 212 func (i NetworkAssociationMap) ToNetworkAssociationMapOutputWithContext(ctx context.Context) NetworkAssociationMapOutput { 213 return pulumi.ToOutputWithContext(ctx, i).(NetworkAssociationMapOutput) 214 } 215 216 type NetworkAssociationOutput struct{ *pulumi.OutputState } 217 218 func (NetworkAssociationOutput) ElementType() reflect.Type { 219 return reflect.TypeOf((**NetworkAssociation)(nil)).Elem() 220 } 221 222 func (o NetworkAssociationOutput) ToNetworkAssociationOutput() NetworkAssociationOutput { 223 return o 224 } 225 226 func (o NetworkAssociationOutput) ToNetworkAssociationOutputWithContext(ctx context.Context) NetworkAssociationOutput { 227 return o 228 } 229 230 // The unique ID of the target network association. 231 func (o NetworkAssociationOutput) AssociationId() pulumi.StringOutput { 232 return o.ApplyT(func(v *NetworkAssociation) pulumi.StringOutput { return v.AssociationId }).(pulumi.StringOutput) 233 } 234 235 // The ID of the Client VPN endpoint. 236 func (o NetworkAssociationOutput) ClientVpnEndpointId() pulumi.StringOutput { 237 return o.ApplyT(func(v *NetworkAssociation) pulumi.StringOutput { return v.ClientVpnEndpointId }).(pulumi.StringOutput) 238 } 239 240 // The ID of the subnet to associate with the Client VPN endpoint. 241 func (o NetworkAssociationOutput) SubnetId() pulumi.StringOutput { 242 return o.ApplyT(func(v *NetworkAssociation) pulumi.StringOutput { return v.SubnetId }).(pulumi.StringOutput) 243 } 244 245 // The ID of the VPC in which the target subnet is located. 246 func (o NetworkAssociationOutput) VpcId() pulumi.StringOutput { 247 return o.ApplyT(func(v *NetworkAssociation) pulumi.StringOutput { return v.VpcId }).(pulumi.StringOutput) 248 } 249 250 type NetworkAssociationArrayOutput struct{ *pulumi.OutputState } 251 252 func (NetworkAssociationArrayOutput) ElementType() reflect.Type { 253 return reflect.TypeOf((*[]*NetworkAssociation)(nil)).Elem() 254 } 255 256 func (o NetworkAssociationArrayOutput) ToNetworkAssociationArrayOutput() NetworkAssociationArrayOutput { 257 return o 258 } 259 260 func (o NetworkAssociationArrayOutput) ToNetworkAssociationArrayOutputWithContext(ctx context.Context) NetworkAssociationArrayOutput { 261 return o 262 } 263 264 func (o NetworkAssociationArrayOutput) Index(i pulumi.IntInput) NetworkAssociationOutput { 265 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *NetworkAssociation { 266 return vs[0].([]*NetworkAssociation)[vs[1].(int)] 267 }).(NetworkAssociationOutput) 268 } 269 270 type NetworkAssociationMapOutput struct{ *pulumi.OutputState } 271 272 func (NetworkAssociationMapOutput) ElementType() reflect.Type { 273 return reflect.TypeOf((*map[string]*NetworkAssociation)(nil)).Elem() 274 } 275 276 func (o NetworkAssociationMapOutput) ToNetworkAssociationMapOutput() NetworkAssociationMapOutput { 277 return o 278 } 279 280 func (o NetworkAssociationMapOutput) ToNetworkAssociationMapOutputWithContext(ctx context.Context) NetworkAssociationMapOutput { 281 return o 282 } 283 284 func (o NetworkAssociationMapOutput) MapIndex(k pulumi.StringInput) NetworkAssociationOutput { 285 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *NetworkAssociation { 286 return vs[0].(map[string]*NetworkAssociation)[vs[1].(string)] 287 }).(NetworkAssociationOutput) 288 } 289 290 func init() { 291 pulumi.RegisterInputType(reflect.TypeOf((*NetworkAssociationInput)(nil)).Elem(), &NetworkAssociation{}) 292 pulumi.RegisterInputType(reflect.TypeOf((*NetworkAssociationArrayInput)(nil)).Elem(), NetworkAssociationArray{}) 293 pulumi.RegisterInputType(reflect.TypeOf((*NetworkAssociationMapInput)(nil)).Elem(), NetworkAssociationMap{}) 294 pulumi.RegisterOutputType(NetworkAssociationOutput{}) 295 pulumi.RegisterOutputType(NetworkAssociationArrayOutput{}) 296 pulumi.RegisterOutputType(NetworkAssociationMapOutput{}) 297 }