Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pulumi.gcp.compute.kotlin.RouterNatArgs.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.compute.kotlin
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.compute.RouterNatArgs.builder
import com.pulumi.gcp.compute.kotlin.inputs.RouterNatLogConfigArgs
import com.pulumi.gcp.compute.kotlin.inputs.RouterNatLogConfigArgsBuilder
import com.pulumi.gcp.compute.kotlin.inputs.RouterNatRuleArgs
import com.pulumi.gcp.compute.kotlin.inputs.RouterNatRuleArgsBuilder
import com.pulumi.gcp.compute.kotlin.inputs.RouterNatSubnetworkArgs
import com.pulumi.gcp.compute.kotlin.inputs.RouterNatSubnetworkArgsBuilder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName
/**
* A NAT service created in a router.
* To get more information about RouterNat, see:
* * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/routers)
* * How-to Guides
* * [Google Cloud Router](https://cloud.google.com/router/docs/)
* ## Example Usage
* ### Router Nat Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const net = new gcp.compute.Network("net", {name: "my-network"});
* const subnet = new gcp.compute.Subnetwork("subnet", {
* name: "my-subnetwork",
* network: net.id,
* ipCidrRange: "10.0.0.0/16",
* region: "us-central1",
* });
* const router = new gcp.compute.Router("router", {
* name: "my-router",
* region: subnet.region,
* network: net.id,
* bgp: {
* asn: 64514,
* },
* });
* const nat = new gcp.compute.RouterNat("nat", {
* name: "my-router-nat",
* router: router.name,
* region: router.region,
* natIpAllocateOption: "AUTO_ONLY",
* sourceSubnetworkIpRangesToNat: "ALL_SUBNETWORKS_ALL_IP_RANGES",
* logConfig: {
* enable: true,
* filter: "ERRORS_ONLY",
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* net = gcp.compute.Network("net", name="my-network")
* subnet = gcp.compute.Subnetwork("subnet",
* name="my-subnetwork",
* network=net.id,
* ip_cidr_range="10.0.0.0/16",
* region="us-central1")
* router = gcp.compute.Router("router",
* name="my-router",
* region=subnet.region,
* network=net.id,
* bgp={
* "asn": 64514,
* })
* nat = gcp.compute.RouterNat("nat",
* name="my-router-nat",
* router=router.name,
* region=router.region,
* nat_ip_allocate_option="AUTO_ONLY",
* source_subnetwork_ip_ranges_to_nat="ALL_SUBNETWORKS_ALL_IP_RANGES",
* log_config={
* "enable": True,
* "filter": "ERRORS_ONLY",
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var net = new Gcp.Compute.Network("net", new()
* {
* Name = "my-network",
* });
* var subnet = new Gcp.Compute.Subnetwork("subnet", new()
* {
* Name = "my-subnetwork",
* Network = net.Id,
* IpCidrRange = "10.0.0.0/16",
* Region = "us-central1",
* });
* var router = new Gcp.Compute.Router("router", new()
* {
* Name = "my-router",
* Region = subnet.Region,
* Network = net.Id,
* Bgp = new Gcp.Compute.Inputs.RouterBgpArgs
* {
* Asn = 64514,
* },
* });
* var nat = new Gcp.Compute.RouterNat("nat", new()
* {
* Name = "my-router-nat",
* Router = router.Name,
* Region = router.Region,
* NatIpAllocateOption = "AUTO_ONLY",
* SourceSubnetworkIpRangesToNat = "ALL_SUBNETWORKS_ALL_IP_RANGES",
* LogConfig = new Gcp.Compute.Inputs.RouterNatLogConfigArgs
* {
* Enable = true,
* Filter = "ERRORS_ONLY",
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* net, err := compute.NewNetwork(ctx, "net", &compute.NetworkArgs{
* Name: pulumi.String("my-network"),
* })
* if err != nil {
* return err
* }
* subnet, err := compute.NewSubnetwork(ctx, "subnet", &compute.SubnetworkArgs{
* Name: pulumi.String("my-subnetwork"),
* Network: net.ID(),
* IpCidrRange: pulumi.String("10.0.0.0/16"),
* Region: pulumi.String("us-central1"),
* })
* if err != nil {
* return err
* }
* router, err := compute.NewRouter(ctx, "router", &compute.RouterArgs{
* Name: pulumi.String("my-router"),
* Region: subnet.Region,
* Network: net.ID(),
* Bgp: &compute.RouterBgpArgs{
* Asn: pulumi.Int(64514),
* },
* })
* if err != nil {
* return err
* }
* _, err = compute.NewRouterNat(ctx, "nat", &compute.RouterNatArgs{
* Name: pulumi.String("my-router-nat"),
* Router: router.Name,
* Region: router.Region,
* NatIpAllocateOption: pulumi.String("AUTO_ONLY"),
* SourceSubnetworkIpRangesToNat: pulumi.String("ALL_SUBNETWORKS_ALL_IP_RANGES"),
* LogConfig: &compute.RouterNatLogConfigArgs{
* Enable: pulumi.Bool(true),
* Filter: pulumi.String("ERRORS_ONLY"),
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.compute.Network;
* import com.pulumi.gcp.compute.NetworkArgs;
* import com.pulumi.gcp.compute.Subnetwork;
* import com.pulumi.gcp.compute.SubnetworkArgs;
* import com.pulumi.gcp.compute.Router;
* import com.pulumi.gcp.compute.RouterArgs;
* import com.pulumi.gcp.compute.inputs.RouterBgpArgs;
* import com.pulumi.gcp.compute.RouterNat;
* import com.pulumi.gcp.compute.RouterNatArgs;
* import com.pulumi.gcp.compute.inputs.RouterNatLogConfigArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var net = new Network("net", NetworkArgs.builder()
* .name("my-network")
* .build());
* var subnet = new Subnetwork("subnet", SubnetworkArgs.builder()
* .name("my-subnetwork")
* .network(net.id())
* .ipCidrRange("10.0.0.0/16")
* .region("us-central1")
* .build());
* var router = new Router("router", RouterArgs.builder()
* .name("my-router")
* .region(subnet.region())
* .network(net.id())
* .bgp(RouterBgpArgs.builder()
* .asn(64514)
* .build())
* .build());
* var nat = new RouterNat("nat", RouterNatArgs.builder()
* .name("my-router-nat")
* .router(router.name())
* .region(router.region())
* .natIpAllocateOption("AUTO_ONLY")
* .sourceSubnetworkIpRangesToNat("ALL_SUBNETWORKS_ALL_IP_RANGES")
* .logConfig(RouterNatLogConfigArgs.builder()
* .enable(true)
* .filter("ERRORS_ONLY")
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* net:
* type: gcp:compute:Network
* properties:
* name: my-network
* subnet:
* type: gcp:compute:Subnetwork
* properties:
* name: my-subnetwork
* network: ${net.id}
* ipCidrRange: 10.0.0.0/16
* region: us-central1
* router:
* type: gcp:compute:Router
* properties:
* name: my-router
* region: ${subnet.region}
* network: ${net.id}
* bgp:
* asn: 64514
* nat:
* type: gcp:compute:RouterNat
* properties:
* name: my-router-nat
* router: ${router.name}
* region: ${router.region}
* natIpAllocateOption: AUTO_ONLY
* sourceSubnetworkIpRangesToNat: ALL_SUBNETWORKS_ALL_IP_RANGES
* logConfig:
* enable: true
* filter: ERRORS_ONLY
* ```
*
* ### Router Nat Manual Ips
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const net = new gcp.compute.Network("net", {name: "my-network"});
* const subnet = new gcp.compute.Subnetwork("subnet", {
* name: "my-subnetwork",
* network: net.id,
* ipCidrRange: "10.0.0.0/16",
* region: "us-central1",
* });
* const router = new gcp.compute.Router("router", {
* name: "my-router",
* region: subnet.region,
* network: net.id,
* });
* const address: gcp.compute.Address[] = [];
* for (const range = {value: 0}; range.value < 2; range.value++) {
* address.push(new gcp.compute.Address(`address-${range.value}`, {
* name: `nat-manual-ip-${range.value}`,
* region: subnet.region,
* }));
* }
* const natManual = new gcp.compute.RouterNat("nat_manual", {
* name: "my-router-nat",
* router: router.name,
* region: router.region,
* natIpAllocateOption: "MANUAL_ONLY",
* natIps: address.map(__item => __item.selfLink),
* sourceSubnetworkIpRangesToNat: "LIST_OF_SUBNETWORKS",
* subnetworks: [{
* name: subnet.id,
* sourceIpRangesToNats: ["ALL_IP_RANGES"],
* }],
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* net = gcp.compute.Network("net", name="my-network")
* subnet = gcp.compute.Subnetwork("subnet",
* name="my-subnetwork",
* network=net.id,
* ip_cidr_range="10.0.0.0/16",
* region="us-central1")
* router = gcp.compute.Router("router",
* name="my-router",
* region=subnet.region,
* network=net.id)
* address = []
* for range in [{"value": i} for i in range(0, 2)]:
* address.append(gcp.compute.Address(f"address-{range['value']}",
* name=f"nat-manual-ip-{range['value']}",
* region=subnet.region))
* nat_manual = gcp.compute.RouterNat("nat_manual",
* name="my-router-nat",
* router=router.name,
* region=router.region,
* nat_ip_allocate_option="MANUAL_ONLY",
* nat_ips=[__item.self_link for __item in address],
* source_subnetwork_ip_ranges_to_nat="LIST_OF_SUBNETWORKS",
* subnetworks=[{
* "name": subnet.id,
* "source_ip_ranges_to_nats": ["ALL_IP_RANGES"],
* }])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var net = new Gcp.Compute.Network("net", new()
* {
* Name = "my-network",
* });
* var subnet = new Gcp.Compute.Subnetwork("subnet", new()
* {
* Name = "my-subnetwork",
* Network = net.Id,
* IpCidrRange = "10.0.0.0/16",
* Region = "us-central1",
* });
* var router = new Gcp.Compute.Router("router", new()
* {
* Name = "my-router",
* Region = subnet.Region,
* Network = net.Id,
* });
* var address = new List();
* for (var rangeIndex = 0; rangeIndex < 2; rangeIndex++)
* {
* var range = new { Value = rangeIndex };
* address.Add(new Gcp.Compute.Address($"address-{range.Value}", new()
* {
* Name = $"nat-manual-ip-{range.Value}",
* Region = subnet.Region,
* }));
* }
* var natManual = new Gcp.Compute.RouterNat("nat_manual", new()
* {
* Name = "my-router-nat",
* Router = router.Name,
* Region = router.Region,
* NatIpAllocateOption = "MANUAL_ONLY",
* NatIps = address.Select(__item => __item.SelfLink).ToList(),
* SourceSubnetworkIpRangesToNat = "LIST_OF_SUBNETWORKS",
* Subnetworks = new[]
* {
* new Gcp.Compute.Inputs.RouterNatSubnetworkArgs
* {
* Name = subnet.Id,
* SourceIpRangesToNats = new[]
* {
* "ALL_IP_RANGES",
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "fmt"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* net, err := compute.NewNetwork(ctx, "net", &compute.NetworkArgs{
* Name: pulumi.String("my-network"),
* })
* if err != nil {
* return err
* }
* subnet, err := compute.NewSubnetwork(ctx, "subnet", &compute.SubnetworkArgs{
* Name: pulumi.String("my-subnetwork"),
* Network: net.ID(),
* IpCidrRange: pulumi.String("10.0.0.0/16"),
* Region: pulumi.String("us-central1"),
* })
* if err != nil {
* return err
* }
* router, err := compute.NewRouter(ctx, "router", &compute.RouterArgs{
* Name: pulumi.String("my-router"),
* Region: subnet.Region,
* Network: net.ID(),
* })
* if err != nil {
* return err
* }
* var address []*compute.Address
* for index := 0; index < 2; index++ {
* key0 := index
* val0 := index
* __res, err := compute.NewAddress(ctx, fmt.Sprintf("address-%v", key0), &compute.AddressArgs{
* Name: pulumi.Sprintf("nat-manual-ip-%v", val0),
* Region: subnet.Region,
* })
* if err != nil {
* return err
* }
* address = append(address, __res)
* }
* var splat0 pulumi.StringArray
* for _, val0 := range address {
* splat0 = append(splat0, val0.SelfLink)
* }
* _, err = compute.NewRouterNat(ctx, "nat_manual", &compute.RouterNatArgs{
* Name: pulumi.String("my-router-nat"),
* Router: router.Name,
* Region: router.Region,
* NatIpAllocateOption: pulumi.String("MANUAL_ONLY"),
* NatIps: splat0,
* SourceSubnetworkIpRangesToNat: pulumi.String("LIST_OF_SUBNETWORKS"),
* Subnetworks: compute.RouterNatSubnetworkArray{
* &compute.RouterNatSubnetworkArgs{
* Name: subnet.ID(),
* SourceIpRangesToNats: pulumi.StringArray{
* pulumi.String("ALL_IP_RANGES"),
* },
* },
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.compute.Network;
* import com.pulumi.gcp.compute.NetworkArgs;
* import com.pulumi.gcp.compute.Subnetwork;
* import com.pulumi.gcp.compute.SubnetworkArgs;
* import com.pulumi.gcp.compute.Router;
* import com.pulumi.gcp.compute.RouterArgs;
* import com.pulumi.gcp.compute.Address;
* import com.pulumi.gcp.compute.AddressArgs;
* import com.pulumi.gcp.compute.RouterNat;
* import com.pulumi.gcp.compute.RouterNatArgs;
* import com.pulumi.gcp.compute.inputs.RouterNatSubnetworkArgs;
* import com.pulumi.codegen.internal.KeyedValue;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var net = new Network("net", NetworkArgs.builder()
* .name("my-network")
* .build());
* var subnet = new Subnetwork("subnet", SubnetworkArgs.builder()
* .name("my-subnetwork")
* .network(net.id())
* .ipCidrRange("10.0.0.0/16")
* .region("us-central1")
* .build());
* var router = new Router("router", RouterArgs.builder()
* .name("my-router")
* .region(subnet.region())
* .network(net.id())
* .build());
* for (var i = 0; i < 2; i++) {
* new Address("address-" + i, AddressArgs.builder()
* .name(String.format("nat-manual-ip-%s", range.value()))
* .region(subnet.region())
* .build());
* }
* var natManual = new RouterNat("natManual", RouterNatArgs.builder()
* .name("my-router-nat")
* .router(router.name())
* .region(router.region())
* .natIpAllocateOption("MANUAL_ONLY")
* .natIps(address.stream().map(element -> element.selfLink()).collect(toList()))
* .sourceSubnetworkIpRangesToNat("LIST_OF_SUBNETWORKS")
* .subnetworks(RouterNatSubnetworkArgs.builder()
* .name(subnet.id())
* .sourceIpRangesToNats("ALL_IP_RANGES")
* .build())
* .build());
* }
* }
* ```
*
* ### Router Nat Rules
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const net = new gcp.compute.Network("net", {
* name: "my-network",
* autoCreateSubnetworks: false,
* });
* const subnet = new gcp.compute.Subnetwork("subnet", {
* name: "my-subnetwork",
* network: net.id,
* ipCidrRange: "10.0.0.0/16",
* region: "us-central1",
* });
* const router = new gcp.compute.Router("router", {
* name: "my-router",
* region: subnet.region,
* network: net.id,
* });
* const addr1 = new gcp.compute.Address("addr1", {
* name: "nat-address1",
* region: subnet.region,
* });
* const addr2 = new gcp.compute.Address("addr2", {
* name: "nat-address2",
* region: subnet.region,
* });
* const addr3 = new gcp.compute.Address("addr3", {
* name: "nat-address3",
* region: subnet.region,
* });
* const natRules = new gcp.compute.RouterNat("nat_rules", {
* name: "my-router-nat",
* router: router.name,
* region: router.region,
* natIpAllocateOption: "MANUAL_ONLY",
* natIps: [addr1.selfLink],
* sourceSubnetworkIpRangesToNat: "LIST_OF_SUBNETWORKS",
* subnetworks: [{
* name: subnet.id,
* sourceIpRangesToNats: ["ALL_IP_RANGES"],
* }],
* rules: [{
* ruleNumber: 100,
* description: "nat rules example",
* match: "inIpRange(destination.ip, '1.1.0.0/16') || inIpRange(destination.ip, '2.2.0.0/16')",
* action: {
* sourceNatActiveIps: [
* addr2.selfLink,
* addr3.selfLink,
* ],
* },
* }],
* enableEndpointIndependentMapping: false,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* net = gcp.compute.Network("net",
* name="my-network",
* auto_create_subnetworks=False)
* subnet = gcp.compute.Subnetwork("subnet",
* name="my-subnetwork",
* network=net.id,
* ip_cidr_range="10.0.0.0/16",
* region="us-central1")
* router = gcp.compute.Router("router",
* name="my-router",
* region=subnet.region,
* network=net.id)
* addr1 = gcp.compute.Address("addr1",
* name="nat-address1",
* region=subnet.region)
* addr2 = gcp.compute.Address("addr2",
* name="nat-address2",
* region=subnet.region)
* addr3 = gcp.compute.Address("addr3",
* name="nat-address3",
* region=subnet.region)
* nat_rules = gcp.compute.RouterNat("nat_rules",
* name="my-router-nat",
* router=router.name,
* region=router.region,
* nat_ip_allocate_option="MANUAL_ONLY",
* nat_ips=[addr1.self_link],
* source_subnetwork_ip_ranges_to_nat="LIST_OF_SUBNETWORKS",
* subnetworks=[{
* "name": subnet.id,
* "source_ip_ranges_to_nats": ["ALL_IP_RANGES"],
* }],
* rules=[{
* "rule_number": 100,
* "description": "nat rules example",
* "match": "inIpRange(destination.ip, '1.1.0.0/16') || inIpRange(destination.ip, '2.2.0.0/16')",
* "action": {
* "source_nat_active_ips": [
* addr2.self_link,
* addr3.self_link,
* ],
* },
* }],
* enable_endpoint_independent_mapping=False)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var net = new Gcp.Compute.Network("net", new()
* {
* Name = "my-network",
* AutoCreateSubnetworks = false,
* });
* var subnet = new Gcp.Compute.Subnetwork("subnet", new()
* {
* Name = "my-subnetwork",
* Network = net.Id,
* IpCidrRange = "10.0.0.0/16",
* Region = "us-central1",
* });
* var router = new Gcp.Compute.Router("router", new()
* {
* Name = "my-router",
* Region = subnet.Region,
* Network = net.Id,
* });
* var addr1 = new Gcp.Compute.Address("addr1", new()
* {
* Name = "nat-address1",
* Region = subnet.Region,
* });
* var addr2 = new Gcp.Compute.Address("addr2", new()
* {
* Name = "nat-address2",
* Region = subnet.Region,
* });
* var addr3 = new Gcp.Compute.Address("addr3", new()
* {
* Name = "nat-address3",
* Region = subnet.Region,
* });
* var natRules = new Gcp.Compute.RouterNat("nat_rules", new()
* {
* Name = "my-router-nat",
* Router = router.Name,
* Region = router.Region,
* NatIpAllocateOption = "MANUAL_ONLY",
* NatIps = new[]
* {
* addr1.SelfLink,
* },
* SourceSubnetworkIpRangesToNat = "LIST_OF_SUBNETWORKS",
* Subnetworks = new[]
* {
* new Gcp.Compute.Inputs.RouterNatSubnetworkArgs
* {
* Name = subnet.Id,
* SourceIpRangesToNats = new[]
* {
* "ALL_IP_RANGES",
* },
* },
* },
* Rules = new[]
* {
* new Gcp.Compute.Inputs.RouterNatRuleArgs
* {
* RuleNumber = 100,
* Description = "nat rules example",
* Match = "inIpRange(destination.ip, '1.1.0.0/16') || inIpRange(destination.ip, '2.2.0.0/16')",
* Action = new Gcp.Compute.Inputs.RouterNatRuleActionArgs
* {
* SourceNatActiveIps = new[]
* {
* addr2.SelfLink,
* addr3.SelfLink,
* },
* },
* },
* },
* EnableEndpointIndependentMapping = false,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* net, err := compute.NewNetwork(ctx, "net", &compute.NetworkArgs{
* Name: pulumi.String("my-network"),
* AutoCreateSubnetworks: pulumi.Bool(false),
* })
* if err != nil {
* return err
* }
* subnet, err := compute.NewSubnetwork(ctx, "subnet", &compute.SubnetworkArgs{
* Name: pulumi.String("my-subnetwork"),
* Network: net.ID(),
* IpCidrRange: pulumi.String("10.0.0.0/16"),
* Region: pulumi.String("us-central1"),
* })
* if err != nil {
* return err
* }
* router, err := compute.NewRouter(ctx, "router", &compute.RouterArgs{
* Name: pulumi.String("my-router"),
* Region: subnet.Region,
* Network: net.ID(),
* })
* if err != nil {
* return err
* }
* addr1, err := compute.NewAddress(ctx, "addr1", &compute.AddressArgs{
* Name: pulumi.String("nat-address1"),
* Region: subnet.Region,
* })
* if err != nil {
* return err
* }
* addr2, err := compute.NewAddress(ctx, "addr2", &compute.AddressArgs{
* Name: pulumi.String("nat-address2"),
* Region: subnet.Region,
* })
* if err != nil {
* return err
* }
* addr3, err := compute.NewAddress(ctx, "addr3", &compute.AddressArgs{
* Name: pulumi.String("nat-address3"),
* Region: subnet.Region,
* })
* if err != nil {
* return err
* }
* _, err = compute.NewRouterNat(ctx, "nat_rules", &compute.RouterNatArgs{
* Name: pulumi.String("my-router-nat"),
* Router: router.Name,
* Region: router.Region,
* NatIpAllocateOption: pulumi.String("MANUAL_ONLY"),
* NatIps: pulumi.StringArray{
* addr1.SelfLink,
* },
* SourceSubnetworkIpRangesToNat: pulumi.String("LIST_OF_SUBNETWORKS"),
* Subnetworks: compute.RouterNatSubnetworkArray{
* &compute.RouterNatSubnetworkArgs{
* Name: subnet.ID(),
* SourceIpRangesToNats: pulumi.StringArray{
* pulumi.String("ALL_IP_RANGES"),
* },
* },
* },
* Rules: compute.RouterNatRuleArray{
* &compute.RouterNatRuleArgs{
* RuleNumber: pulumi.Int(100),
* Description: pulumi.String("nat rules example"),
* Match: pulumi.String("inIpRange(destination.ip, '1.1.0.0/16') || inIpRange(destination.ip, '2.2.0.0/16')"),
* Action: &compute.RouterNatRuleActionArgs{
* SourceNatActiveIps: pulumi.StringArray{
* addr2.SelfLink,
* addr3.SelfLink,
* },
* },
* },
* },
* EnableEndpointIndependentMapping: pulumi.Bool(false),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.compute.Network;
* import com.pulumi.gcp.compute.NetworkArgs;
* import com.pulumi.gcp.compute.Subnetwork;
* import com.pulumi.gcp.compute.SubnetworkArgs;
* import com.pulumi.gcp.compute.Router;
* import com.pulumi.gcp.compute.RouterArgs;
* import com.pulumi.gcp.compute.Address;
* import com.pulumi.gcp.compute.AddressArgs;
* import com.pulumi.gcp.compute.RouterNat;
* import com.pulumi.gcp.compute.RouterNatArgs;
* import com.pulumi.gcp.compute.inputs.RouterNatSubnetworkArgs;
* import com.pulumi.gcp.compute.inputs.RouterNatRuleArgs;
* import com.pulumi.gcp.compute.inputs.RouterNatRuleActionArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var net = new Network("net", NetworkArgs.builder()
* .name("my-network")
* .autoCreateSubnetworks(false)
* .build());
* var subnet = new Subnetwork("subnet", SubnetworkArgs.builder()
* .name("my-subnetwork")
* .network(net.id())
* .ipCidrRange("10.0.0.0/16")
* .region("us-central1")
* .build());
* var router = new Router("router", RouterArgs.builder()
* .name("my-router")
* .region(subnet.region())
* .network(net.id())
* .build());
* var addr1 = new Address("addr1", AddressArgs.builder()
* .name("nat-address1")
* .region(subnet.region())
* .build());
* var addr2 = new Address("addr2", AddressArgs.builder()
* .name("nat-address2")
* .region(subnet.region())
* .build());
* var addr3 = new Address("addr3", AddressArgs.builder()
* .name("nat-address3")
* .region(subnet.region())
* .build());
* var natRules = new RouterNat("natRules", RouterNatArgs.builder()
* .name("my-router-nat")
* .router(router.name())
* .region(router.region())
* .natIpAllocateOption("MANUAL_ONLY")
* .natIps(addr1.selfLink())
* .sourceSubnetworkIpRangesToNat("LIST_OF_SUBNETWORKS")
* .subnetworks(RouterNatSubnetworkArgs.builder()
* .name(subnet.id())
* .sourceIpRangesToNats("ALL_IP_RANGES")
* .build())
* .rules(RouterNatRuleArgs.builder()
* .ruleNumber(100)
* .description("nat rules example")
* .match("inIpRange(destination.ip, '1.1.0.0/16') || inIpRange(destination.ip, '2.2.0.0/16')")
* .action(RouterNatRuleActionArgs.builder()
* .sourceNatActiveIps(
* addr2.selfLink(),
* addr3.selfLink())
* .build())
* .build())
* .enableEndpointIndependentMapping(false)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* net:
* type: gcp:compute:Network
* properties:
* name: my-network
* autoCreateSubnetworks: false
* subnet:
* type: gcp:compute:Subnetwork
* properties:
* name: my-subnetwork
* network: ${net.id}
* ipCidrRange: 10.0.0.0/16
* region: us-central1
* router:
* type: gcp:compute:Router
* properties:
* name: my-router
* region: ${subnet.region}
* network: ${net.id}
* addr1:
* type: gcp:compute:Address
* properties:
* name: nat-address1
* region: ${subnet.region}
* addr2:
* type: gcp:compute:Address
* properties:
* name: nat-address2
* region: ${subnet.region}
* addr3:
* type: gcp:compute:Address
* properties:
* name: nat-address3
* region: ${subnet.region}
* natRules:
* type: gcp:compute:RouterNat
* name: nat_rules
* properties:
* name: my-router-nat
* router: ${router.name}
* region: ${router.region}
* natIpAllocateOption: MANUAL_ONLY
* natIps:
* - ${addr1.selfLink}
* sourceSubnetworkIpRangesToNat: LIST_OF_SUBNETWORKS
* subnetworks:
* - name: ${subnet.id}
* sourceIpRangesToNats:
* - ALL_IP_RANGES
* rules:
* - ruleNumber: 100
* description: nat rules example
* match: inIpRange(destination.ip, '1.1.0.0/16') || inIpRange(destination.ip, '2.2.0.0/16')
* action:
* sourceNatActiveIps:
* - ${addr2.selfLink}
* - ${addr3.selfLink}
* enableEndpointIndependentMapping: false
* ```
*
* ### Router Nat Private
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const net = new gcp.compute.Network("net", {name: "my-network"});
* const subnet = new gcp.compute.Subnetwork("subnet", {
* name: "my-subnetwork",
* network: net.id,
* ipCidrRange: "10.0.0.0/16",
* region: "us-central1",
* purpose: "PRIVATE_NAT",
* });
* const router = new gcp.compute.Router("router", {
* name: "my-router",
* region: subnet.region,
* network: net.id,
* });
* const hub = new gcp.networkconnectivity.Hub("hub", {
* name: "my-hub",
* description: "vpc hub for inter vpc nat",
* });
* const spoke = new gcp.networkconnectivity.Spoke("spoke", {
* name: "my-spoke",
* location: "global",
* description: "vpc spoke for inter vpc nat",
* hub: hub.id,
* linkedVpcNetwork: {
* excludeExportRanges: [
* "198.51.100.0/24",
* "10.10.0.0/16",
* ],
* uri: net.selfLink,
* },
* });
* const natType = new gcp.compute.RouterNat("nat_type", {
* name: "my-router-nat",
* router: router.name,
* region: router.region,
* sourceSubnetworkIpRangesToNat: "LIST_OF_SUBNETWORKS",
* enableDynamicPortAllocation: false,
* enableEndpointIndependentMapping: false,
* minPortsPerVm: 32,
* type: "PRIVATE",
* subnetworks: [{
* name: subnet.id,
* sourceIpRangesToNats: ["ALL_IP_RANGES"],
* }],
* rules: [{
* ruleNumber: 100,
* description: "rule for private nat",
* match: "nexthop.hub == \"//networkconnectivity.googleapis.com/projects/acm-test-proj-123/locations/global/hubs/my-hub\"",
* action: {
* sourceNatActiveRanges: [subnet.selfLink],
* },
* }],
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* net = gcp.compute.Network("net", name="my-network")
* subnet = gcp.compute.Subnetwork("subnet",
* name="my-subnetwork",
* network=net.id,
* ip_cidr_range="10.0.0.0/16",
* region="us-central1",
* purpose="PRIVATE_NAT")
* router = gcp.compute.Router("router",
* name="my-router",
* region=subnet.region,
* network=net.id)
* hub = gcp.networkconnectivity.Hub("hub",
* name="my-hub",
* description="vpc hub for inter vpc nat")
* spoke = gcp.networkconnectivity.Spoke("spoke",
* name="my-spoke",
* location="global",
* description="vpc spoke for inter vpc nat",
* hub=hub.id,
* linked_vpc_network={
* "exclude_export_ranges": [
* "198.51.100.0/24",
* "10.10.0.0/16",
* ],
* "uri": net.self_link,
* })
* nat_type = gcp.compute.RouterNat("nat_type",
* name="my-router-nat",
* router=router.name,
* region=router.region,
* source_subnetwork_ip_ranges_to_nat="LIST_OF_SUBNETWORKS",
* enable_dynamic_port_allocation=False,
* enable_endpoint_independent_mapping=False,
* min_ports_per_vm=32,
* type="PRIVATE",
* subnetworks=[{
* "name": subnet.id,
* "source_ip_ranges_to_nats": ["ALL_IP_RANGES"],
* }],
* rules=[{
* "rule_number": 100,
* "description": "rule for private nat",
* "match": "nexthop.hub == \"//networkconnectivity.googleapis.com/projects/acm-test-proj-123/locations/global/hubs/my-hub\"",
* "action": {
* "source_nat_active_ranges": [subnet.self_link],
* },
* }])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var net = new Gcp.Compute.Network("net", new()
* {
* Name = "my-network",
* });
* var subnet = new Gcp.Compute.Subnetwork("subnet", new()
* {
* Name = "my-subnetwork",
* Network = net.Id,
* IpCidrRange = "10.0.0.0/16",
* Region = "us-central1",
* Purpose = "PRIVATE_NAT",
* });
* var router = new Gcp.Compute.Router("router", new()
* {
* Name = "my-router",
* Region = subnet.Region,
* Network = net.Id,
* });
* var hub = new Gcp.NetworkConnectivity.Hub("hub", new()
* {
* Name = "my-hub",
* Description = "vpc hub for inter vpc nat",
* });
* var spoke = new Gcp.NetworkConnectivity.Spoke("spoke", new()
* {
* Name = "my-spoke",
* Location = "global",
* Description = "vpc spoke for inter vpc nat",
* Hub = hub.Id,
* LinkedVpcNetwork = new Gcp.NetworkConnectivity.Inputs.SpokeLinkedVpcNetworkArgs
* {
* ExcludeExportRanges = new[]
* {
* "198.51.100.0/24",
* "10.10.0.0/16",
* },
* Uri = net.SelfLink,
* },
* });
* var natType = new Gcp.Compute.RouterNat("nat_type", new()
* {
* Name = "my-router-nat",
* Router = router.Name,
* Region = router.Region,
* SourceSubnetworkIpRangesToNat = "LIST_OF_SUBNETWORKS",
* EnableDynamicPortAllocation = false,
* EnableEndpointIndependentMapping = false,
* MinPortsPerVm = 32,
* Type = "PRIVATE",
* Subnetworks = new[]
* {
* new Gcp.Compute.Inputs.RouterNatSubnetworkArgs
* {
* Name = subnet.Id,
* SourceIpRangesToNats = new[]
* {
* "ALL_IP_RANGES",
* },
* },
* },
* Rules = new[]
* {
* new Gcp.Compute.Inputs.RouterNatRuleArgs
* {
* RuleNumber = 100,
* Description = "rule for private nat",
* Match = "nexthop.hub == \"//networkconnectivity.googleapis.com/projects/acm-test-proj-123/locations/global/hubs/my-hub\"",
* Action = new Gcp.Compute.Inputs.RouterNatRuleActionArgs
* {
* SourceNatActiveRanges = new[]
* {
* subnet.SelfLink,
* },
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/networkconnectivity"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* net, err := compute.NewNetwork(ctx, "net", &compute.NetworkArgs{
* Name: pulumi.String("my-network"),
* })
* if err != nil {
* return err
* }
* subnet, err := compute.NewSubnetwork(ctx, "subnet", &compute.SubnetworkArgs{
* Name: pulumi.String("my-subnetwork"),
* Network: net.ID(),
* IpCidrRange: pulumi.String("10.0.0.0/16"),
* Region: pulumi.String("us-central1"),
* Purpose: pulumi.String("PRIVATE_NAT"),
* })
* if err != nil {
* return err
* }
* router, err := compute.NewRouter(ctx, "router", &compute.RouterArgs{
* Name: pulumi.String("my-router"),
* Region: subnet.Region,
* Network: net.ID(),
* })
* if err != nil {
* return err
* }
* hub, err := networkconnectivity.NewHub(ctx, "hub", &networkconnectivity.HubArgs{
* Name: pulumi.String("my-hub"),
* Description: pulumi.String("vpc hub for inter vpc nat"),
* })
* if err != nil {
* return err
* }
* _, err = networkconnectivity.NewSpoke(ctx, "spoke", &networkconnectivity.SpokeArgs{
* Name: pulumi.String("my-spoke"),
* Location: pulumi.String("global"),
* Description: pulumi.String("vpc spoke for inter vpc nat"),
* Hub: hub.ID(),
* LinkedVpcNetwork: &networkconnectivity.SpokeLinkedVpcNetworkArgs{
* ExcludeExportRanges: pulumi.StringArray{
* pulumi.String("198.51.100.0/24"),
* pulumi.String("10.10.0.0/16"),
* },
* Uri: net.SelfLink,
* },
* })
* if err != nil {
* return err
* }
* _, err = compute.NewRouterNat(ctx, "nat_type", &compute.RouterNatArgs{
* Name: pulumi.String("my-router-nat"),
* Router: router.Name,
* Region: router.Region,
* SourceSubnetworkIpRangesToNat: pulumi.String("LIST_OF_SUBNETWORKS"),
* EnableDynamicPortAllocation: pulumi.Bool(false),
* EnableEndpointIndependentMapping: pulumi.Bool(false),
* MinPortsPerVm: pulumi.Int(32),
* Type: pulumi.String("PRIVATE"),
* Subnetworks: compute.RouterNatSubnetworkArray{
* &compute.RouterNatSubnetworkArgs{
* Name: subnet.ID(),
* SourceIpRangesToNats: pulumi.StringArray{
* pulumi.String("ALL_IP_RANGES"),
* },
* },
* },
* Rules: compute.RouterNatRuleArray{
* &compute.RouterNatRuleArgs{
* RuleNumber: pulumi.Int(100),
* Description: pulumi.String("rule for private nat"),
* Match: pulumi.String("nexthop.hub == \"//networkconnectivity.googleapis.com/projects/acm-test-proj-123/locations/global/hubs/my-hub\""),
* Action: &compute.RouterNatRuleActionArgs{
* SourceNatActiveRanges: pulumi.StringArray{
* subnet.SelfLink,
* },
* },
* },
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.compute.Network;
* import com.pulumi.gcp.compute.NetworkArgs;
* import com.pulumi.gcp.compute.Subnetwork;
* import com.pulumi.gcp.compute.SubnetworkArgs;
* import com.pulumi.gcp.compute.Router;
* import com.pulumi.gcp.compute.RouterArgs;
* import com.pulumi.gcp.networkconnectivity.Hub;
* import com.pulumi.gcp.networkconnectivity.HubArgs;
* import com.pulumi.gcp.networkconnectivity.Spoke;
* import com.pulumi.gcp.networkconnectivity.SpokeArgs;
* import com.pulumi.gcp.networkconnectivity.inputs.SpokeLinkedVpcNetworkArgs;
* import com.pulumi.gcp.compute.RouterNat;
* import com.pulumi.gcp.compute.RouterNatArgs;
* import com.pulumi.gcp.compute.inputs.RouterNatSubnetworkArgs;
* import com.pulumi.gcp.compute.inputs.RouterNatRuleArgs;
* import com.pulumi.gcp.compute.inputs.RouterNatRuleActionArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var net = new Network("net", NetworkArgs.builder()
* .name("my-network")
* .build());
* var subnet = new Subnetwork("subnet", SubnetworkArgs.builder()
* .name("my-subnetwork")
* .network(net.id())
* .ipCidrRange("10.0.0.0/16")
* .region("us-central1")
* .purpose("PRIVATE_NAT")
* .build());
* var router = new Router("router", RouterArgs.builder()
* .name("my-router")
* .region(subnet.region())
* .network(net.id())
* .build());
* var hub = new Hub("hub", HubArgs.builder()
* .name("my-hub")
* .description("vpc hub for inter vpc nat")
* .build());
* var spoke = new Spoke("spoke", SpokeArgs.builder()
* .name("my-spoke")
* .location("global")
* .description("vpc spoke for inter vpc nat")
* .hub(hub.id())
* .linkedVpcNetwork(SpokeLinkedVpcNetworkArgs.builder()
* .excludeExportRanges(
* "198.51.100.0/24",
* "10.10.0.0/16")
* .uri(net.selfLink())
* .build())
* .build());
* var natType = new RouterNat("natType", RouterNatArgs.builder()
* .name("my-router-nat")
* .router(router.name())
* .region(router.region())
* .sourceSubnetworkIpRangesToNat("LIST_OF_SUBNETWORKS")
* .enableDynamicPortAllocation(false)
* .enableEndpointIndependentMapping(false)
* .minPortsPerVm(32)
* .type("PRIVATE")
* .subnetworks(RouterNatSubnetworkArgs.builder()
* .name(subnet.id())
* .sourceIpRangesToNats("ALL_IP_RANGES")
* .build())
* .rules(RouterNatRuleArgs.builder()
* .ruleNumber(100)
* .description("rule for private nat")
* .match("nexthop.hub == \"//networkconnectivity.googleapis.com/projects/acm-test-proj-123/locations/global/hubs/my-hub\"")
* .action(RouterNatRuleActionArgs.builder()
* .sourceNatActiveRanges(subnet.selfLink())
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* net:
* type: gcp:compute:Network
* properties:
* name: my-network
* subnet:
* type: gcp:compute:Subnetwork
* properties:
* name: my-subnetwork
* network: ${net.id}
* ipCidrRange: 10.0.0.0/16
* region: us-central1
* purpose: PRIVATE_NAT
* router:
* type: gcp:compute:Router
* properties:
* name: my-router
* region: ${subnet.region}
* network: ${net.id}
* hub:
* type: gcp:networkconnectivity:Hub
* properties:
* name: my-hub
* description: vpc hub for inter vpc nat
* spoke:
* type: gcp:networkconnectivity:Spoke
* properties:
* name: my-spoke
* location: global
* description: vpc spoke for inter vpc nat
* hub: ${hub.id}
* linkedVpcNetwork:
* excludeExportRanges:
* - 198.51.100.0/24
* - 10.10.0.0/16
* uri: ${net.selfLink}
* natType:
* type: gcp:compute:RouterNat
* name: nat_type
* properties:
* name: my-router-nat
* router: ${router.name}
* region: ${router.region}
* sourceSubnetworkIpRangesToNat: LIST_OF_SUBNETWORKS
* enableDynamicPortAllocation: false
* enableEndpointIndependentMapping: false
* minPortsPerVm: 32
* type: PRIVATE
* subnetworks:
* - name: ${subnet.id}
* sourceIpRangesToNats:
* - ALL_IP_RANGES
* rules:
* - ruleNumber: 100
* description: rule for private nat
* match: nexthop.hub == "//networkconnectivity.googleapis.com/projects/acm-test-proj-123/locations/global/hubs/my-hub"
* action:
* sourceNatActiveRanges:
* - ${subnet.selfLink}
* ```
*
* ## Import
* RouterNat can be imported using any of these accepted formats:
* * `projects/{{project}}/regions/{{region}}/routers/{{router}}/{{name}}`
* * `{{project}}/{{region}}/{{router}}/{{name}}`
* * `{{region}}/{{router}}/{{name}}`
* * `{{router}}/{{name}}`
* When using the `pulumi import` command, RouterNat can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:compute/routerNat:RouterNat default projects/{{project}}/regions/{{region}}/routers/{{router}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:compute/routerNat:RouterNat default {{project}}/{{region}}/{{router}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:compute/routerNat:RouterNat default {{region}}/{{router}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:compute/routerNat:RouterNat default {{router}}/{{name}}
* ```
* @property autoNetworkTier The network tier to use when automatically reserving NAT IP addresses.
* Must be one of: PREMIUM, STANDARD. If not specified, then the current
* project-level default tier is used.
* Possible values are: `PREMIUM`, `STANDARD`.
* @property drainNatIps A list of URLs of the IP resources to be drained. These IPs must be
* valid static external IPs that have been assigned to the NAT.
* @property enableDynamicPortAllocation Enable Dynamic Port Allocation.
* If minPortsPerVm is set, minPortsPerVm must be set to a power of two greater than or equal to 32.
* If minPortsPerVm is not set, a minimum of 32 ports will be allocated to a VM from this NAT config.
* If maxPortsPerVm is set, maxPortsPerVm must be set to a power of two greater than minPortsPerVm.
* If maxPortsPerVm is not set, a maximum of 65536 ports will be allocated to a VM from this NAT config.
* Mutually exclusive with enableEndpointIndependentMapping.
* @property enableEndpointIndependentMapping Enable endpoint independent mapping.
* For more information see the [official documentation](https://cloud.google.com/nat/docs/overview#specs-rfcs).
* @property endpointTypes Specifies the endpoint Types supported by the NAT Gateway.
* Supported values include:
* `ENDPOINT_TYPE_VM`, `ENDPOINT_TYPE_SWG`,
* `ENDPOINT_TYPE_MANAGED_PROXY_LB`.
* @property icmpIdleTimeoutSec Timeout (in seconds) for ICMP connections. Defaults to 30s if not set.
* @property logConfig Configuration for logging on NAT
* Structure is documented below.
* @property maxPortsPerVm Maximum number of ports allocated to a VM from this NAT.
* This field can only be set when enableDynamicPortAllocation is enabled.
* @property minPortsPerVm Minimum number of ports allocated to a VM from this NAT. Defaults to 64 for static port allocation and 32 dynamic port allocation if not set.
* @property name Name of the NAT service. The name must be 1-63 characters long and
* comply with RFC1035.
* @property natIpAllocateOption How external IPs should be allocated for this NAT. Valid values are
* `AUTO_ONLY` for only allowing NAT IPs allocated by Google Cloud
* Platform, or `MANUAL_ONLY` for only user-allocated NAT IP addresses.
* Possible values are: `MANUAL_ONLY`, `AUTO_ONLY`.
* @property natIps Self-links of NAT IPs. Only valid if natIpAllocateOption
* is set to MANUAL_ONLY.
* @property project The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
* @property region Region where the router and NAT reside.
* @property router The name of the Cloud Router in which this NAT will be configured.
* - - -
* @property rules A list of rules associated with this NAT.
* Structure is documented below.
* @property sourceSubnetworkIpRangesToNat How NAT should be configured per Subnetwork.
* If `ALL_SUBNETWORKS_ALL_IP_RANGES`, all of the
* IP ranges in every Subnetwork are allowed to Nat.
* If `ALL_SUBNETWORKS_ALL_PRIMARY_IP_RANGES`, all of the primary IP
* ranges in every Subnetwork are allowed to Nat.
* `LIST_OF_SUBNETWORKS`: A list of Subnetworks are allowed to Nat
* (specified in the field subnetwork below). Note that if this field
* contains ALL_SUBNETWORKS_ALL_IP_RANGES or
* ALL_SUBNETWORKS_ALL_PRIMARY_IP_RANGES, then there should not be any
* other RouterNat section in any Router for this network in this region.
* Possible values are: `ALL_SUBNETWORKS_ALL_IP_RANGES`, `ALL_SUBNETWORKS_ALL_PRIMARY_IP_RANGES`, `LIST_OF_SUBNETWORKS`.
* @property subnetworks One or more subnetwork NAT configurations. Only used if
* `source_subnetwork_ip_ranges_to_nat` is set to `LIST_OF_SUBNETWORKS`
* Structure is documented below.
* @property tcpEstablishedIdleTimeoutSec Timeout (in seconds) for TCP established connections.
* Defaults to 1200s if not set.
* @property tcpTimeWaitTimeoutSec Timeout (in seconds) for TCP connections that are in TIME_WAIT state.
* Defaults to 120s if not set.
* @property tcpTransitoryIdleTimeoutSec Timeout (in seconds) for TCP transitory connections.
* Defaults to 30s if not set.
* @property type Indicates whether this NAT is used for public or private IP translation.
* If unspecified, it defaults to PUBLIC.
* If `PUBLIC` NAT used for public IP translation.
* If `PRIVATE` NAT used for private IP translation.
* Default value is `PUBLIC`.
* Possible values are: `PUBLIC`, `PRIVATE`.
* @property udpIdleTimeoutSec Timeout (in seconds) for UDP connections. Defaults to 30s if not set.
*/
public data class RouterNatArgs(
public val autoNetworkTier: Output? = null,
public val drainNatIps: Output>? = null,
public val enableDynamicPortAllocation: Output? = null,
public val enableEndpointIndependentMapping: Output? = null,
public val endpointTypes: Output>? = null,
public val icmpIdleTimeoutSec: Output? = null,
public val logConfig: Output? = null,
public val maxPortsPerVm: Output? = null,
public val minPortsPerVm: Output? = null,
public val name: Output? = null,
public val natIpAllocateOption: Output? = null,
public val natIps: Output>? = null,
public val project: Output? = null,
public val region: Output? = null,
public val router: Output? = null,
public val rules: Output>? = null,
public val sourceSubnetworkIpRangesToNat: Output? = null,
public val subnetworks: Output>? = null,
public val tcpEstablishedIdleTimeoutSec: Output? = null,
public val tcpTimeWaitTimeoutSec: Output? = null,
public val tcpTransitoryIdleTimeoutSec: Output? = null,
public val type: Output? = null,
public val udpIdleTimeoutSec: Output? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.gcp.compute.RouterNatArgs =
com.pulumi.gcp.compute.RouterNatArgs.builder()
.autoNetworkTier(autoNetworkTier?.applyValue({ args0 -> args0 }))
.drainNatIps(drainNatIps?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
.enableDynamicPortAllocation(enableDynamicPortAllocation?.applyValue({ args0 -> args0 }))
.enableEndpointIndependentMapping(enableEndpointIndependentMapping?.applyValue({ args0 -> args0 }))
.endpointTypes(endpointTypes?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
.icmpIdleTimeoutSec(icmpIdleTimeoutSec?.applyValue({ args0 -> args0 }))
.logConfig(logConfig?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
.maxPortsPerVm(maxPortsPerVm?.applyValue({ args0 -> args0 }))
.minPortsPerVm(minPortsPerVm?.applyValue({ args0 -> args0 }))
.name(name?.applyValue({ args0 -> args0 }))
.natIpAllocateOption(natIpAllocateOption?.applyValue({ args0 -> args0 }))
.natIps(natIps?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
.project(project?.applyValue({ args0 -> args0 }))
.region(region?.applyValue({ args0 -> args0 }))
.router(router?.applyValue({ args0 -> args0 }))
.rules(rules?.applyValue({ args0 -> args0.map({ args0 -> args0.let({ args0 -> args0.toJava() }) }) }))
.sourceSubnetworkIpRangesToNat(sourceSubnetworkIpRangesToNat?.applyValue({ args0 -> args0 }))
.subnetworks(
subnetworks?.applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
args0.toJava()
})
})
}),
)
.tcpEstablishedIdleTimeoutSec(tcpEstablishedIdleTimeoutSec?.applyValue({ args0 -> args0 }))
.tcpTimeWaitTimeoutSec(tcpTimeWaitTimeoutSec?.applyValue({ args0 -> args0 }))
.tcpTransitoryIdleTimeoutSec(tcpTransitoryIdleTimeoutSec?.applyValue({ args0 -> args0 }))
.type(type?.applyValue({ args0 -> args0 }))
.udpIdleTimeoutSec(udpIdleTimeoutSec?.applyValue({ args0 -> args0 })).build()
}
/**
* Builder for [RouterNatArgs].
*/
@PulumiTagMarker
public class RouterNatArgsBuilder internal constructor() {
private var autoNetworkTier: Output? = null
private var drainNatIps: Output>? = null
private var enableDynamicPortAllocation: Output? = null
private var enableEndpointIndependentMapping: Output? = null
private var endpointTypes: Output>? = null
private var icmpIdleTimeoutSec: Output? = null
private var logConfig: Output? = null
private var maxPortsPerVm: Output? = null
private var minPortsPerVm: Output? = null
private var name: Output? = null
private var natIpAllocateOption: Output? = null
private var natIps: Output>? = null
private var project: Output? = null
private var region: Output? = null
private var router: Output? = null
private var rules: Output>? = null
private var sourceSubnetworkIpRangesToNat: Output? = null
private var subnetworks: Output>? = null
private var tcpEstablishedIdleTimeoutSec: Output? = null
private var tcpTimeWaitTimeoutSec: Output? = null
private var tcpTransitoryIdleTimeoutSec: Output? = null
private var type: Output? = null
private var udpIdleTimeoutSec: Output? = null
/**
* @param value The network tier to use when automatically reserving NAT IP addresses.
* Must be one of: PREMIUM, STANDARD. If not specified, then the current
* project-level default tier is used.
* Possible values are: `PREMIUM`, `STANDARD`.
*/
@JvmName("vpnwxdakjfpkhbee")
public suspend fun autoNetworkTier(`value`: Output) {
this.autoNetworkTier = value
}
/**
* @param value A list of URLs of the IP resources to be drained. These IPs must be
* valid static external IPs that have been assigned to the NAT.
*/
@JvmName("kafnrmgcktticgbq")
public suspend fun drainNatIps(`value`: Output>) {
this.drainNatIps = value
}
@JvmName("vxiemvcydhhhlukd")
public suspend fun drainNatIps(vararg values: Output) {
this.drainNatIps = Output.all(values.asList())
}
/**
* @param values A list of URLs of the IP resources to be drained. These IPs must be
* valid static external IPs that have been assigned to the NAT.
*/
@JvmName("temvsgmeghnpgwwt")
public suspend fun drainNatIps(values: List>) {
this.drainNatIps = Output.all(values)
}
/**
* @param value Enable Dynamic Port Allocation.
* If minPortsPerVm is set, minPortsPerVm must be set to a power of two greater than or equal to 32.
* If minPortsPerVm is not set, a minimum of 32 ports will be allocated to a VM from this NAT config.
* If maxPortsPerVm is set, maxPortsPerVm must be set to a power of two greater than minPortsPerVm.
* If maxPortsPerVm is not set, a maximum of 65536 ports will be allocated to a VM from this NAT config.
* Mutually exclusive with enableEndpointIndependentMapping.
*/
@JvmName("fchshfmecagjfrmb")
public suspend fun enableDynamicPortAllocation(`value`: Output) {
this.enableDynamicPortAllocation = value
}
/**
* @param value Enable endpoint independent mapping.
* For more information see the [official documentation](https://cloud.google.com/nat/docs/overview#specs-rfcs).
*/
@JvmName("ywurlgfemvqoyxpk")
public suspend fun enableEndpointIndependentMapping(`value`: Output) {
this.enableEndpointIndependentMapping = value
}
/**
* @param value Specifies the endpoint Types supported by the NAT Gateway.
* Supported values include:
* `ENDPOINT_TYPE_VM`, `ENDPOINT_TYPE_SWG`,
* `ENDPOINT_TYPE_MANAGED_PROXY_LB`.
*/
@JvmName("bkqfgkmvxewylrik")
public suspend fun endpointTypes(`value`: Output>) {
this.endpointTypes = value
}
@JvmName("uaoqplikknvcgxvm")
public suspend fun endpointTypes(vararg values: Output) {
this.endpointTypes = Output.all(values.asList())
}
/**
* @param values Specifies the endpoint Types supported by the NAT Gateway.
* Supported values include:
* `ENDPOINT_TYPE_VM`, `ENDPOINT_TYPE_SWG`,
* `ENDPOINT_TYPE_MANAGED_PROXY_LB`.
*/
@JvmName("vgmvmxstkiatjjgh")
public suspend fun endpointTypes(values: List>) {
this.endpointTypes = Output.all(values)
}
/**
* @param value Timeout (in seconds) for ICMP connections. Defaults to 30s if not set.
*/
@JvmName("mfosykgbvscmqpnv")
public suspend fun icmpIdleTimeoutSec(`value`: Output) {
this.icmpIdleTimeoutSec = value
}
/**
* @param value Configuration for logging on NAT
* Structure is documented below.
*/
@JvmName("iuyfyehuaptcycjs")
public suspend fun logConfig(`value`: Output) {
this.logConfig = value
}
/**
* @param value Maximum number of ports allocated to a VM from this NAT.
* This field can only be set when enableDynamicPortAllocation is enabled.
*/
@JvmName("uxlmrrnanvxtiejd")
public suspend fun maxPortsPerVm(`value`: Output) {
this.maxPortsPerVm = value
}
/**
* @param value Minimum number of ports allocated to a VM from this NAT. Defaults to 64 for static port allocation and 32 dynamic port allocation if not set.
*/
@JvmName("aghgkhqqcblkbkbd")
public suspend fun minPortsPerVm(`value`: Output) {
this.minPortsPerVm = value
}
/**
* @param value Name of the NAT service. The name must be 1-63 characters long and
* comply with RFC1035.
*/
@JvmName("dpepbmfklqolhprg")
public suspend fun name(`value`: Output) {
this.name = value
}
/**
* @param value How external IPs should be allocated for this NAT. Valid values are
* `AUTO_ONLY` for only allowing NAT IPs allocated by Google Cloud
* Platform, or `MANUAL_ONLY` for only user-allocated NAT IP addresses.
* Possible values are: `MANUAL_ONLY`, `AUTO_ONLY`.
*/
@JvmName("djsaubukkhugjafj")
public suspend fun natIpAllocateOption(`value`: Output) {
this.natIpAllocateOption = value
}
/**
* @param value Self-links of NAT IPs. Only valid if natIpAllocateOption
* is set to MANUAL_ONLY.
*/
@JvmName("liobxcvejoelgkmi")
public suspend fun natIps(`value`: Output>) {
this.natIps = value
}
@JvmName("kpahjidgdbadbwvo")
public suspend fun natIps(vararg values: Output) {
this.natIps = Output.all(values.asList())
}
/**
* @param values Self-links of NAT IPs. Only valid if natIpAllocateOption
* is set to MANUAL_ONLY.
*/
@JvmName("afffedbgixjtqkur")
public suspend fun natIps(values: List>) {
this.natIps = Output.all(values)
}
/**
* @param value The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
@JvmName("ubcdrhdsqsdaoxpt")
public suspend fun project(`value`: Output) {
this.project = value
}
/**
* @param value Region where the router and NAT reside.
*/
@JvmName("hbnfyeqbolgvgbnm")
public suspend fun region(`value`: Output) {
this.region = value
}
/**
* @param value The name of the Cloud Router in which this NAT will be configured.
* - - -
*/
@JvmName("lxbxwcedlmykpgbp")
public suspend fun router(`value`: Output) {
this.router = value
}
/**
* @param value A list of rules associated with this NAT.
* Structure is documented below.
*/
@JvmName("eukpsqfgnqrafcwv")
public suspend fun rules(`value`: Output>) {
this.rules = value
}
@JvmName("ginsgyrjxrlepmuo")
public suspend fun rules(vararg values: Output) {
this.rules = Output.all(values.asList())
}
/**
* @param values A list of rules associated with this NAT.
* Structure is documented below.
*/
@JvmName("utpiyrodywyhujxo")
public suspend fun rules(values: List>) {
this.rules = Output.all(values)
}
/**
* @param value How NAT should be configured per Subnetwork.
* If `ALL_SUBNETWORKS_ALL_IP_RANGES`, all of the
* IP ranges in every Subnetwork are allowed to Nat.
* If `ALL_SUBNETWORKS_ALL_PRIMARY_IP_RANGES`, all of the primary IP
* ranges in every Subnetwork are allowed to Nat.
* `LIST_OF_SUBNETWORKS`: A list of Subnetworks are allowed to Nat
* (specified in the field subnetwork below). Note that if this field
* contains ALL_SUBNETWORKS_ALL_IP_RANGES or
* ALL_SUBNETWORKS_ALL_PRIMARY_IP_RANGES, then there should not be any
* other RouterNat section in any Router for this network in this region.
* Possible values are: `ALL_SUBNETWORKS_ALL_IP_RANGES`, `ALL_SUBNETWORKS_ALL_PRIMARY_IP_RANGES`, `LIST_OF_SUBNETWORKS`.
*/
@JvmName("jnxnwralrkvctalq")
public suspend fun sourceSubnetworkIpRangesToNat(`value`: Output) {
this.sourceSubnetworkIpRangesToNat = value
}
/**
* @param value One or more subnetwork NAT configurations. Only used if
* `source_subnetwork_ip_ranges_to_nat` is set to `LIST_OF_SUBNETWORKS`
* Structure is documented below.
*/
@JvmName("hdnakcftbvrnrsts")
public suspend fun subnetworks(`value`: Output>) {
this.subnetworks = value
}
@JvmName("wkhxpdioswvwbtty")
public suspend fun subnetworks(vararg values: Output) {
this.subnetworks = Output.all(values.asList())
}
/**
* @param values One or more subnetwork NAT configurations. Only used if
* `source_subnetwork_ip_ranges_to_nat` is set to `LIST_OF_SUBNETWORKS`
* Structure is documented below.
*/
@JvmName("kmkyujbigicompiu")
public suspend fun subnetworks(values: List>) {
this.subnetworks = Output.all(values)
}
/**
* @param value Timeout (in seconds) for TCP established connections.
* Defaults to 1200s if not set.
*/
@JvmName("baadccjjttqryytp")
public suspend fun tcpEstablishedIdleTimeoutSec(`value`: Output) {
this.tcpEstablishedIdleTimeoutSec = value
}
/**
* @param value Timeout (in seconds) for TCP connections that are in TIME_WAIT state.
* Defaults to 120s if not set.
*/
@JvmName("kcjsdcykvqudftsi")
public suspend fun tcpTimeWaitTimeoutSec(`value`: Output) {
this.tcpTimeWaitTimeoutSec = value
}
/**
* @param value Timeout (in seconds) for TCP transitory connections.
* Defaults to 30s if not set.
*/
@JvmName("cashexbfqnswdqwv")
public suspend fun tcpTransitoryIdleTimeoutSec(`value`: Output) {
this.tcpTransitoryIdleTimeoutSec = value
}
/**
* @param value Indicates whether this NAT is used for public or private IP translation.
* If unspecified, it defaults to PUBLIC.
* If `PUBLIC` NAT used for public IP translation.
* If `PRIVATE` NAT used for private IP translation.
* Default value is `PUBLIC`.
* Possible values are: `PUBLIC`, `PRIVATE`.
*/
@JvmName("rwwroslnmbqjrwdl")
public suspend fun type(`value`: Output) {
this.type = value
}
/**
* @param value Timeout (in seconds) for UDP connections. Defaults to 30s if not set.
*/
@JvmName("mtogjkcmvmsxmkuu")
public suspend fun udpIdleTimeoutSec(`value`: Output) {
this.udpIdleTimeoutSec = value
}
/**
* @param value The network tier to use when automatically reserving NAT IP addresses.
* Must be one of: PREMIUM, STANDARD. If not specified, then the current
* project-level default tier is used.
* Possible values are: `PREMIUM`, `STANDARD`.
*/
@JvmName("sakdawdkbivvedwj")
public suspend fun autoNetworkTier(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.autoNetworkTier = mapped
}
/**
* @param value A list of URLs of the IP resources to be drained. These IPs must be
* valid static external IPs that have been assigned to the NAT.
*/
@JvmName("dindmwxckfwoiaml")
public suspend fun drainNatIps(`value`: List?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.drainNatIps = mapped
}
/**
* @param values A list of URLs of the IP resources to be drained. These IPs must be
* valid static external IPs that have been assigned to the NAT.
*/
@JvmName("hoaisqmqnxamligr")
public suspend fun drainNatIps(vararg values: String) {
val toBeMapped = values.toList()
val mapped = toBeMapped.let({ args0 -> of(args0) })
this.drainNatIps = mapped
}
/**
* @param value Enable Dynamic Port Allocation.
* If minPortsPerVm is set, minPortsPerVm must be set to a power of two greater than or equal to 32.
* If minPortsPerVm is not set, a minimum of 32 ports will be allocated to a VM from this NAT config.
* If maxPortsPerVm is set, maxPortsPerVm must be set to a power of two greater than minPortsPerVm.
* If maxPortsPerVm is not set, a maximum of 65536 ports will be allocated to a VM from this NAT config.
* Mutually exclusive with enableEndpointIndependentMapping.
*/
@JvmName("ruriktrpertsnmlj")
public suspend fun enableDynamicPortAllocation(`value`: Boolean?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.enableDynamicPortAllocation = mapped
}
/**
* @param value Enable endpoint independent mapping.
* For more information see the [official documentation](https://cloud.google.com/nat/docs/overview#specs-rfcs).
*/
@JvmName("wljhiereajnugpwa")
public suspend fun enableEndpointIndependentMapping(`value`: Boolean?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.enableEndpointIndependentMapping = mapped
}
/**
* @param value Specifies the endpoint Types supported by the NAT Gateway.
* Supported values include:
* `ENDPOINT_TYPE_VM`, `ENDPOINT_TYPE_SWG`,
* `ENDPOINT_TYPE_MANAGED_PROXY_LB`.
*/
@JvmName("umfxqldrwqplmyyw")
public suspend fun endpointTypes(`value`: List?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.endpointTypes = mapped
}
/**
* @param values Specifies the endpoint Types supported by the NAT Gateway.
* Supported values include:
* `ENDPOINT_TYPE_VM`, `ENDPOINT_TYPE_SWG`,
* `ENDPOINT_TYPE_MANAGED_PROXY_LB`.
*/
@JvmName("uwysewgmxlvthomt")
public suspend fun endpointTypes(vararg values: String) {
val toBeMapped = values.toList()
val mapped = toBeMapped.let({ args0 -> of(args0) })
this.endpointTypes = mapped
}
/**
* @param value Timeout (in seconds) for ICMP connections. Defaults to 30s if not set.
*/
@JvmName("pkvxgstbovhqvsqy")
public suspend fun icmpIdleTimeoutSec(`value`: Int?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.icmpIdleTimeoutSec = mapped
}
/**
* @param value Configuration for logging on NAT
* Structure is documented below.
*/
@JvmName("tthvflqigiwqbvmr")
public suspend fun logConfig(`value`: RouterNatLogConfigArgs?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.logConfig = mapped
}
/**
* @param argument Configuration for logging on NAT
* Structure is documented below.
*/
@JvmName("yljfwhuqgkykokjn")
public suspend fun logConfig(argument: suspend RouterNatLogConfigArgsBuilder.() -> Unit) {
val toBeMapped = RouterNatLogConfigArgsBuilder().applySuspend { argument() }.build()
val mapped = of(toBeMapped)
this.logConfig = mapped
}
/**
* @param value Maximum number of ports allocated to a VM from this NAT.
* This field can only be set when enableDynamicPortAllocation is enabled.
*/
@JvmName("okjcbivqghfqtwsy")
public suspend fun maxPortsPerVm(`value`: Int?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.maxPortsPerVm = mapped
}
/**
* @param value Minimum number of ports allocated to a VM from this NAT. Defaults to 64 for static port allocation and 32 dynamic port allocation if not set.
*/
@JvmName("lfujwqgqsolvbqto")
public suspend fun minPortsPerVm(`value`: Int?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.minPortsPerVm = mapped
}
/**
* @param value Name of the NAT service. The name must be 1-63 characters long and
* comply with RFC1035.
*/
@JvmName("ralsfjpyppsodmjq")
public suspend fun name(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.name = mapped
}
/**
* @param value How external IPs should be allocated for this NAT. Valid values are
* `AUTO_ONLY` for only allowing NAT IPs allocated by Google Cloud
* Platform, or `MANUAL_ONLY` for only user-allocated NAT IP addresses.
* Possible values are: `MANUAL_ONLY`, `AUTO_ONLY`.
*/
@JvmName("pmvxdfgsednvkeon")
public suspend fun natIpAllocateOption(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.natIpAllocateOption = mapped
}
/**
* @param value Self-links of NAT IPs. Only valid if natIpAllocateOption
* is set to MANUAL_ONLY.
*/
@JvmName("rdikpdmomsjjqmlo")
public suspend fun natIps(`value`: List?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.natIps = mapped
}
/**
* @param values Self-links of NAT IPs. Only valid if natIpAllocateOption
* is set to MANUAL_ONLY.
*/
@JvmName("jtecoqnvvftbnjqr")
public suspend fun natIps(vararg values: String) {
val toBeMapped = values.toList()
val mapped = toBeMapped.let({ args0 -> of(args0) })
this.natIps = mapped
}
/**
* @param value The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
@JvmName("qsllbpkrcdurbvcf")
public suspend fun project(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.project = mapped
}
/**
* @param value Region where the router and NAT reside.
*/
@JvmName("wufldaehxvxpuhaw")
public suspend fun region(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.region = mapped
}
/**
* @param value The name of the Cloud Router in which this NAT will be configured.
* - - -
*/
@JvmName("llruyebcxybqytgy")
public suspend fun router(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.router = mapped
}
/**
* @param value A list of rules associated with this NAT.
* Structure is documented below.
*/
@JvmName("yxcfrraukvtvdpqt")
public suspend fun rules(`value`: List?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.rules = mapped
}
/**
* @param argument A list of rules associated with this NAT.
* Structure is documented below.
*/
@JvmName("afcuxhpjlhmicsoi")
public suspend fun rules(argument: List Unit>) {
val toBeMapped = argument.toList().map {
RouterNatRuleArgsBuilder().applySuspend { it() }.build()
}
val mapped = of(toBeMapped)
this.rules = mapped
}
/**
* @param argument A list of rules associated with this NAT.
* Structure is documented below.
*/
@JvmName("ecnwtyggrrlvxbob")
public suspend fun rules(vararg argument: suspend RouterNatRuleArgsBuilder.() -> Unit) {
val toBeMapped = argument.toList().map {
RouterNatRuleArgsBuilder().applySuspend { it() }.build()
}
val mapped = of(toBeMapped)
this.rules = mapped
}
/**
* @param argument A list of rules associated with this NAT.
* Structure is documented below.
*/
@JvmName("wheyhleohqkisprf")
public suspend fun rules(argument: suspend RouterNatRuleArgsBuilder.() -> Unit) {
val toBeMapped = listOf(RouterNatRuleArgsBuilder().applySuspend { argument() }.build())
val mapped = of(toBeMapped)
this.rules = mapped
}
/**
* @param values A list of rules associated with this NAT.
* Structure is documented below.
*/
@JvmName("fjwfbqwufnswjbuf")
public suspend fun rules(vararg values: RouterNatRuleArgs) {
val toBeMapped = values.toList()
val mapped = toBeMapped.let({ args0 -> of(args0) })
this.rules = mapped
}
/**
* @param value How NAT should be configured per Subnetwork.
* If `ALL_SUBNETWORKS_ALL_IP_RANGES`, all of the
* IP ranges in every Subnetwork are allowed to Nat.
* If `ALL_SUBNETWORKS_ALL_PRIMARY_IP_RANGES`, all of the primary IP
* ranges in every Subnetwork are allowed to Nat.
* `LIST_OF_SUBNETWORKS`: A list of Subnetworks are allowed to Nat
* (specified in the field subnetwork below). Note that if this field
* contains ALL_SUBNETWORKS_ALL_IP_RANGES or
* ALL_SUBNETWORKS_ALL_PRIMARY_IP_RANGES, then there should not be any
* other RouterNat section in any Router for this network in this region.
* Possible values are: `ALL_SUBNETWORKS_ALL_IP_RANGES`, `ALL_SUBNETWORKS_ALL_PRIMARY_IP_RANGES`, `LIST_OF_SUBNETWORKS`.
*/
@JvmName("pxwuqitwvtkvylnl")
public suspend fun sourceSubnetworkIpRangesToNat(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.sourceSubnetworkIpRangesToNat = mapped
}
/**
* @param value One or more subnetwork NAT configurations. Only used if
* `source_subnetwork_ip_ranges_to_nat` is set to `LIST_OF_SUBNETWORKS`
* Structure is documented below.
*/
@JvmName("hwmxfuvbbfwvjhlf")
public suspend fun subnetworks(`value`: List?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.subnetworks = mapped
}
/**
* @param argument One or more subnetwork NAT configurations. Only used if
* `source_subnetwork_ip_ranges_to_nat` is set to `LIST_OF_SUBNETWORKS`
* Structure is documented below.
*/
@JvmName("hoalqdnxhofqvyna")
public suspend fun subnetworks(argument: List Unit>) {
val toBeMapped = argument.toList().map {
RouterNatSubnetworkArgsBuilder().applySuspend {
it()
}.build()
}
val mapped = of(toBeMapped)
this.subnetworks = mapped
}
/**
* @param argument One or more subnetwork NAT configurations. Only used if
* `source_subnetwork_ip_ranges_to_nat` is set to `LIST_OF_SUBNETWORKS`
* Structure is documented below.
*/
@JvmName("wmrsovlesjiayvsu")
public suspend fun subnetworks(vararg argument: suspend RouterNatSubnetworkArgsBuilder.() -> Unit) {
val toBeMapped = argument.toList().map {
RouterNatSubnetworkArgsBuilder().applySuspend {
it()
}.build()
}
val mapped = of(toBeMapped)
this.subnetworks = mapped
}
/**
* @param argument One or more subnetwork NAT configurations. Only used if
* `source_subnetwork_ip_ranges_to_nat` is set to `LIST_OF_SUBNETWORKS`
* Structure is documented below.
*/
@JvmName("klkmiimtshiqjlrb")
public suspend fun subnetworks(argument: suspend RouterNatSubnetworkArgsBuilder.() -> Unit) {
val toBeMapped = listOf(RouterNatSubnetworkArgsBuilder().applySuspend { argument() }.build())
val mapped = of(toBeMapped)
this.subnetworks = mapped
}
/**
* @param values One or more subnetwork NAT configurations. Only used if
* `source_subnetwork_ip_ranges_to_nat` is set to `LIST_OF_SUBNETWORKS`
* Structure is documented below.
*/
@JvmName("onebdvuxjquwgiqt")
public suspend fun subnetworks(vararg values: RouterNatSubnetworkArgs) {
val toBeMapped = values.toList()
val mapped = toBeMapped.let({ args0 -> of(args0) })
this.subnetworks = mapped
}
/**
* @param value Timeout (in seconds) for TCP established connections.
* Defaults to 1200s if not set.
*/
@JvmName("ogenqhhcitnksrpq")
public suspend fun tcpEstablishedIdleTimeoutSec(`value`: Int?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.tcpEstablishedIdleTimeoutSec = mapped
}
/**
* @param value Timeout (in seconds) for TCP connections that are in TIME_WAIT state.
* Defaults to 120s if not set.
*/
@JvmName("cuqhuhkvtevlrdgs")
public suspend fun tcpTimeWaitTimeoutSec(`value`: Int?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.tcpTimeWaitTimeoutSec = mapped
}
/**
* @param value Timeout (in seconds) for TCP transitory connections.
* Defaults to 30s if not set.
*/
@JvmName("ursyyechwwlkqluf")
public suspend fun tcpTransitoryIdleTimeoutSec(`value`: Int?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.tcpTransitoryIdleTimeoutSec = mapped
}
/**
* @param value Indicates whether this NAT is used for public or private IP translation.
* If unspecified, it defaults to PUBLIC.
* If `PUBLIC` NAT used for public IP translation.
* If `PRIVATE` NAT used for private IP translation.
* Default value is `PUBLIC`.
* Possible values are: `PUBLIC`, `PRIVATE`.
*/
@JvmName("kxbhapasaqcxmdkn")
public suspend fun type(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.type = mapped
}
/**
* @param value Timeout (in seconds) for UDP connections. Defaults to 30s if not set.
*/
@JvmName("pwgnkxshcfruikcf")
public suspend fun udpIdleTimeoutSec(`value`: Int?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.udpIdleTimeoutSec = mapped
}
internal fun build(): RouterNatArgs = RouterNatArgs(
autoNetworkTier = autoNetworkTier,
drainNatIps = drainNatIps,
enableDynamicPortAllocation = enableDynamicPortAllocation,
enableEndpointIndependentMapping = enableEndpointIndependentMapping,
endpointTypes = endpointTypes,
icmpIdleTimeoutSec = icmpIdleTimeoutSec,
logConfig = logConfig,
maxPortsPerVm = maxPortsPerVm,
minPortsPerVm = minPortsPerVm,
name = name,
natIpAllocateOption = natIpAllocateOption,
natIps = natIps,
project = project,
region = region,
router = router,
rules = rules,
sourceSubnetworkIpRangesToNat = sourceSubnetworkIpRangesToNat,
subnetworks = subnetworks,
tcpEstablishedIdleTimeoutSec = tcpEstablishedIdleTimeoutSec,
tcpTimeWaitTimeoutSec = tcpTimeWaitTimeoutSec,
tcpTransitoryIdleTimeoutSec = tcpTransitoryIdleTimeoutSec,
type = type,
udpIdleTimeoutSec = udpIdleTimeoutSec,
)
}