github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2clientvpn/route.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 additional routes 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 // exampleEndpoint, err := ec2clientvpn.NewEndpoint(ctx, "example", &ec2clientvpn.EndpointArgs{ 34 // Description: pulumi.String("Example Client VPN endpoint"), 35 // ServerCertificateArn: pulumi.Any(exampleAwsAcmCertificate.Arn), 36 // ClientCidrBlock: pulumi.String("10.0.0.0/16"), 37 // AuthenticationOptions: ec2clientvpn.EndpointAuthenticationOptionArray{ 38 // &ec2clientvpn.EndpointAuthenticationOptionArgs{ 39 // Type: pulumi.String("certificate-authentication"), 40 // RootCertificateChainArn: pulumi.Any(exampleAwsAcmCertificate.Arn), 41 // }, 42 // }, 43 // ConnectionLogOptions: &ec2clientvpn.EndpointConnectionLogOptionsArgs{ 44 // Enabled: pulumi.Bool(false), 45 // }, 46 // }) 47 // if err != nil { 48 // return err 49 // } 50 // exampleNetworkAssociation, err := ec2clientvpn.NewNetworkAssociation(ctx, "example", &ec2clientvpn.NetworkAssociationArgs{ 51 // ClientVpnEndpointId: exampleEndpoint.ID(), 52 // SubnetId: pulumi.Any(exampleAwsSubnet.Id), 53 // }) 54 // if err != nil { 55 // return err 56 // } 57 // _, err = ec2clientvpn.NewRoute(ctx, "example", &ec2clientvpn.RouteArgs{ 58 // ClientVpnEndpointId: exampleEndpoint.ID(), 59 // DestinationCidrBlock: pulumi.String("0.0.0.0/0"), 60 // TargetVpcSubnetId: exampleNetworkAssociation.SubnetId, 61 // }) 62 // if err != nil { 63 // return err 64 // } 65 // return nil 66 // }) 67 // } 68 // 69 // ``` 70 // <!--End PulumiCodeChooser --> 71 // 72 // ## Import 73 // 74 // Using `pulumi import`, import AWS Client VPN routes using the endpoint ID, target subnet ID, and destination CIDR block. All values are separated by a `,`. For example: 75 // 76 // ```sh 77 // $ pulumi import aws:ec2clientvpn/route:Route example cvpn-endpoint-1234567890abcdef,subnet-9876543210fedcba,10.1.0.0/24 78 // ``` 79 type Route struct { 80 pulumi.CustomResourceState 81 82 // The ID of the Client VPN endpoint. 83 ClientVpnEndpointId pulumi.StringOutput `pulumi:"clientVpnEndpointId"` 84 // A brief description of the route. 85 Description pulumi.StringPtrOutput `pulumi:"description"` 86 // The IPv4 address range, in CIDR notation, of the route destination. 87 DestinationCidrBlock pulumi.StringOutput `pulumi:"destinationCidrBlock"` 88 // Indicates how the Client VPN route was added. Will be `add-route` for routes created by this resource. 89 Origin pulumi.StringOutput `pulumi:"origin"` 90 // The ID of the Subnet to route the traffic through. It must already be attached to the Client VPN. 91 TargetVpcSubnetId pulumi.StringOutput `pulumi:"targetVpcSubnetId"` 92 // The type of the route. 93 Type pulumi.StringOutput `pulumi:"type"` 94 } 95 96 // NewRoute registers a new resource with the given unique name, arguments, and options. 97 func NewRoute(ctx *pulumi.Context, 98 name string, args *RouteArgs, opts ...pulumi.ResourceOption) (*Route, error) { 99 if args == nil { 100 return nil, errors.New("missing one or more required arguments") 101 } 102 103 if args.ClientVpnEndpointId == nil { 104 return nil, errors.New("invalid value for required argument 'ClientVpnEndpointId'") 105 } 106 if args.DestinationCidrBlock == nil { 107 return nil, errors.New("invalid value for required argument 'DestinationCidrBlock'") 108 } 109 if args.TargetVpcSubnetId == nil { 110 return nil, errors.New("invalid value for required argument 'TargetVpcSubnetId'") 111 } 112 opts = internal.PkgResourceDefaultOpts(opts) 113 var resource Route 114 err := ctx.RegisterResource("aws:ec2clientvpn/route:Route", name, args, &resource, opts...) 115 if err != nil { 116 return nil, err 117 } 118 return &resource, nil 119 } 120 121 // GetRoute gets an existing Route resource's state with the given name, ID, and optional 122 // state properties that are used to uniquely qualify the lookup (nil if not required). 123 func GetRoute(ctx *pulumi.Context, 124 name string, id pulumi.IDInput, state *RouteState, opts ...pulumi.ResourceOption) (*Route, error) { 125 var resource Route 126 err := ctx.ReadResource("aws:ec2clientvpn/route:Route", name, id, state, &resource, opts...) 127 if err != nil { 128 return nil, err 129 } 130 return &resource, nil 131 } 132 133 // Input properties used for looking up and filtering Route resources. 134 type routeState struct { 135 // The ID of the Client VPN endpoint. 136 ClientVpnEndpointId *string `pulumi:"clientVpnEndpointId"` 137 // A brief description of the route. 138 Description *string `pulumi:"description"` 139 // The IPv4 address range, in CIDR notation, of the route destination. 140 DestinationCidrBlock *string `pulumi:"destinationCidrBlock"` 141 // Indicates how the Client VPN route was added. Will be `add-route` for routes created by this resource. 142 Origin *string `pulumi:"origin"` 143 // The ID of the Subnet to route the traffic through. It must already be attached to the Client VPN. 144 TargetVpcSubnetId *string `pulumi:"targetVpcSubnetId"` 145 // The type of the route. 146 Type *string `pulumi:"type"` 147 } 148 149 type RouteState struct { 150 // The ID of the Client VPN endpoint. 151 ClientVpnEndpointId pulumi.StringPtrInput 152 // A brief description of the route. 153 Description pulumi.StringPtrInput 154 // The IPv4 address range, in CIDR notation, of the route destination. 155 DestinationCidrBlock pulumi.StringPtrInput 156 // Indicates how the Client VPN route was added. Will be `add-route` for routes created by this resource. 157 Origin pulumi.StringPtrInput 158 // The ID of the Subnet to route the traffic through. It must already be attached to the Client VPN. 159 TargetVpcSubnetId pulumi.StringPtrInput 160 // The type of the route. 161 Type pulumi.StringPtrInput 162 } 163 164 func (RouteState) ElementType() reflect.Type { 165 return reflect.TypeOf((*routeState)(nil)).Elem() 166 } 167 168 type routeArgs struct { 169 // The ID of the Client VPN endpoint. 170 ClientVpnEndpointId string `pulumi:"clientVpnEndpointId"` 171 // A brief description of the route. 172 Description *string `pulumi:"description"` 173 // The IPv4 address range, in CIDR notation, of the route destination. 174 DestinationCidrBlock string `pulumi:"destinationCidrBlock"` 175 // The ID of the Subnet to route the traffic through. It must already be attached to the Client VPN. 176 TargetVpcSubnetId string `pulumi:"targetVpcSubnetId"` 177 } 178 179 // The set of arguments for constructing a Route resource. 180 type RouteArgs struct { 181 // The ID of the Client VPN endpoint. 182 ClientVpnEndpointId pulumi.StringInput 183 // A brief description of the route. 184 Description pulumi.StringPtrInput 185 // The IPv4 address range, in CIDR notation, of the route destination. 186 DestinationCidrBlock pulumi.StringInput 187 // The ID of the Subnet to route the traffic through. It must already be attached to the Client VPN. 188 TargetVpcSubnetId pulumi.StringInput 189 } 190 191 func (RouteArgs) ElementType() reflect.Type { 192 return reflect.TypeOf((*routeArgs)(nil)).Elem() 193 } 194 195 type RouteInput interface { 196 pulumi.Input 197 198 ToRouteOutput() RouteOutput 199 ToRouteOutputWithContext(ctx context.Context) RouteOutput 200 } 201 202 func (*Route) ElementType() reflect.Type { 203 return reflect.TypeOf((**Route)(nil)).Elem() 204 } 205 206 func (i *Route) ToRouteOutput() RouteOutput { 207 return i.ToRouteOutputWithContext(context.Background()) 208 } 209 210 func (i *Route) ToRouteOutputWithContext(ctx context.Context) RouteOutput { 211 return pulumi.ToOutputWithContext(ctx, i).(RouteOutput) 212 } 213 214 // RouteArrayInput is an input type that accepts RouteArray and RouteArrayOutput values. 215 // You can construct a concrete instance of `RouteArrayInput` via: 216 // 217 // RouteArray{ RouteArgs{...} } 218 type RouteArrayInput interface { 219 pulumi.Input 220 221 ToRouteArrayOutput() RouteArrayOutput 222 ToRouteArrayOutputWithContext(context.Context) RouteArrayOutput 223 } 224 225 type RouteArray []RouteInput 226 227 func (RouteArray) ElementType() reflect.Type { 228 return reflect.TypeOf((*[]*Route)(nil)).Elem() 229 } 230 231 func (i RouteArray) ToRouteArrayOutput() RouteArrayOutput { 232 return i.ToRouteArrayOutputWithContext(context.Background()) 233 } 234 235 func (i RouteArray) ToRouteArrayOutputWithContext(ctx context.Context) RouteArrayOutput { 236 return pulumi.ToOutputWithContext(ctx, i).(RouteArrayOutput) 237 } 238 239 // RouteMapInput is an input type that accepts RouteMap and RouteMapOutput values. 240 // You can construct a concrete instance of `RouteMapInput` via: 241 // 242 // RouteMap{ "key": RouteArgs{...} } 243 type RouteMapInput interface { 244 pulumi.Input 245 246 ToRouteMapOutput() RouteMapOutput 247 ToRouteMapOutputWithContext(context.Context) RouteMapOutput 248 } 249 250 type RouteMap map[string]RouteInput 251 252 func (RouteMap) ElementType() reflect.Type { 253 return reflect.TypeOf((*map[string]*Route)(nil)).Elem() 254 } 255 256 func (i RouteMap) ToRouteMapOutput() RouteMapOutput { 257 return i.ToRouteMapOutputWithContext(context.Background()) 258 } 259 260 func (i RouteMap) ToRouteMapOutputWithContext(ctx context.Context) RouteMapOutput { 261 return pulumi.ToOutputWithContext(ctx, i).(RouteMapOutput) 262 } 263 264 type RouteOutput struct{ *pulumi.OutputState } 265 266 func (RouteOutput) ElementType() reflect.Type { 267 return reflect.TypeOf((**Route)(nil)).Elem() 268 } 269 270 func (o RouteOutput) ToRouteOutput() RouteOutput { 271 return o 272 } 273 274 func (o RouteOutput) ToRouteOutputWithContext(ctx context.Context) RouteOutput { 275 return o 276 } 277 278 // The ID of the Client VPN endpoint. 279 func (o RouteOutput) ClientVpnEndpointId() pulumi.StringOutput { 280 return o.ApplyT(func(v *Route) pulumi.StringOutput { return v.ClientVpnEndpointId }).(pulumi.StringOutput) 281 } 282 283 // A brief description of the route. 284 func (o RouteOutput) Description() pulumi.StringPtrOutput { 285 return o.ApplyT(func(v *Route) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput) 286 } 287 288 // The IPv4 address range, in CIDR notation, of the route destination. 289 func (o RouteOutput) DestinationCidrBlock() pulumi.StringOutput { 290 return o.ApplyT(func(v *Route) pulumi.StringOutput { return v.DestinationCidrBlock }).(pulumi.StringOutput) 291 } 292 293 // Indicates how the Client VPN route was added. Will be `add-route` for routes created by this resource. 294 func (o RouteOutput) Origin() pulumi.StringOutput { 295 return o.ApplyT(func(v *Route) pulumi.StringOutput { return v.Origin }).(pulumi.StringOutput) 296 } 297 298 // The ID of the Subnet to route the traffic through. It must already be attached to the Client VPN. 299 func (o RouteOutput) TargetVpcSubnetId() pulumi.StringOutput { 300 return o.ApplyT(func(v *Route) pulumi.StringOutput { return v.TargetVpcSubnetId }).(pulumi.StringOutput) 301 } 302 303 // The type of the route. 304 func (o RouteOutput) Type() pulumi.StringOutput { 305 return o.ApplyT(func(v *Route) pulumi.StringOutput { return v.Type }).(pulumi.StringOutput) 306 } 307 308 type RouteArrayOutput struct{ *pulumi.OutputState } 309 310 func (RouteArrayOutput) ElementType() reflect.Type { 311 return reflect.TypeOf((*[]*Route)(nil)).Elem() 312 } 313 314 func (o RouteArrayOutput) ToRouteArrayOutput() RouteArrayOutput { 315 return o 316 } 317 318 func (o RouteArrayOutput) ToRouteArrayOutputWithContext(ctx context.Context) RouteArrayOutput { 319 return o 320 } 321 322 func (o RouteArrayOutput) Index(i pulumi.IntInput) RouteOutput { 323 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Route { 324 return vs[0].([]*Route)[vs[1].(int)] 325 }).(RouteOutput) 326 } 327 328 type RouteMapOutput struct{ *pulumi.OutputState } 329 330 func (RouteMapOutput) ElementType() reflect.Type { 331 return reflect.TypeOf((*map[string]*Route)(nil)).Elem() 332 } 333 334 func (o RouteMapOutput) ToRouteMapOutput() RouteMapOutput { 335 return o 336 } 337 338 func (o RouteMapOutput) ToRouteMapOutputWithContext(ctx context.Context) RouteMapOutput { 339 return o 340 } 341 342 func (o RouteMapOutput) MapIndex(k pulumi.StringInput) RouteOutput { 343 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Route { 344 return vs[0].(map[string]*Route)[vs[1].(string)] 345 }).(RouteOutput) 346 } 347 348 func init() { 349 pulumi.RegisterInputType(reflect.TypeOf((*RouteInput)(nil)).Elem(), &Route{}) 350 pulumi.RegisterInputType(reflect.TypeOf((*RouteArrayInput)(nil)).Elem(), RouteArray{}) 351 pulumi.RegisterInputType(reflect.TypeOf((*RouteMapInput)(nil)).Elem(), RouteMap{}) 352 pulumi.RegisterOutputType(RouteOutput{}) 353 pulumi.RegisterOutputType(RouteArrayOutput{}) 354 pulumi.RegisterOutputType(RouteMapOutput{}) 355 }