All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.gcp.vmwareengine.kotlin.ExternalAccessRule.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 8.10.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.vmwareengine.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.vmwareengine.kotlin.outputs.ExternalAccessRuleDestinationIpRange
import com.pulumi.gcp.vmwareengine.kotlin.outputs.ExternalAccessRuleSourceIpRange
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.gcp.vmwareengine.kotlin.outputs.ExternalAccessRuleDestinationIpRange.Companion.toKotlin as externalAccessRuleDestinationIpRangeToKotlin
import com.pulumi.gcp.vmwareengine.kotlin.outputs.ExternalAccessRuleSourceIpRange.Companion.toKotlin as externalAccessRuleSourceIpRangeToKotlin

/**
 * Builder for [ExternalAccessRule].
 */
@PulumiTagMarker
public class ExternalAccessRuleResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: ExternalAccessRuleArgs = ExternalAccessRuleArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend ExternalAccessRuleArgsBuilder.() -> Unit) {
        val builder = ExternalAccessRuleArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): ExternalAccessRule {
        val builtJavaResource = com.pulumi.gcp.vmwareengine.ExternalAccessRule(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return ExternalAccessRule(builtJavaResource)
    }
}

/**
 * External access firewall rules for filtering incoming traffic destined to `ExternalAddress` resources.
 * To get more information about ExternalAccessRule, see:
 * * [API documentation](https://cloud.google.com/vmware-engine/docs/reference/rest/v1/projects.locations.networkPolicies.externalAccessRules)
 * ## Example Usage
 * ### Vmware Engine External Access Rule Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const external_access_rule_nw = new gcp.vmwareengine.Network("external-access-rule-nw", {
 *     name: "sample-nw",
 *     location: "global",
 *     type: "STANDARD",
 *     description: "PC network description.",
 * });
 * const external_access_rule_np = new gcp.vmwareengine.NetworkPolicy("external-access-rule-np", {
 *     location: "us-west1",
 *     name: "sample-np",
 *     edgeServicesCidr: "192.168.30.0/26",
 *     vmwareEngineNetwork: external_access_rule_nw.id,
 * });
 * const vmw_engine_external_access_rule = new gcp.vmwareengine.ExternalAccessRule("vmw-engine-external-access-rule", {
 *     name: "sample-external-access-rule",
 *     parent: external_access_rule_np.id,
 *     priority: 101,
 *     action: "DENY",
 *     ipProtocol: "TCP",
 *     sourceIpRanges: [{
 *         ipAddressRange: "0.0.0.0/0",
 *     }],
 *     sourcePorts: ["80"],
 *     destinationIpRanges: [{
 *         ipAddressRange: "0.0.0.0/0",
 *     }],
 *     destinationPorts: ["433"],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * external_access_rule_nw = gcp.vmwareengine.Network("external-access-rule-nw",
 *     name="sample-nw",
 *     location="global",
 *     type="STANDARD",
 *     description="PC network description.")
 * external_access_rule_np = gcp.vmwareengine.NetworkPolicy("external-access-rule-np",
 *     location="us-west1",
 *     name="sample-np",
 *     edge_services_cidr="192.168.30.0/26",
 *     vmware_engine_network=external_access_rule_nw.id)
 * vmw_engine_external_access_rule = gcp.vmwareengine.ExternalAccessRule("vmw-engine-external-access-rule",
 *     name="sample-external-access-rule",
 *     parent=external_access_rule_np.id,
 *     priority=101,
 *     action="DENY",
 *     ip_protocol="TCP",
 *     source_ip_ranges=[gcp.vmwareengine.ExternalAccessRuleSourceIpRangeArgs(
 *         ip_address_range="0.0.0.0/0",
 *     )],
 *     source_ports=["80"],
 *     destination_ip_ranges=[gcp.vmwareengine.ExternalAccessRuleDestinationIpRangeArgs(
 *         ip_address_range="0.0.0.0/0",
 *     )],
 *     destination_ports=["433"])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var external_access_rule_nw = new Gcp.VMwareEngine.Network("external-access-rule-nw", new()
 *     {
 *         Name = "sample-nw",
 *         Location = "global",
 *         Type = "STANDARD",
 *         Description = "PC network description.",
 *     });
 *     var external_access_rule_np = new Gcp.VMwareEngine.NetworkPolicy("external-access-rule-np", new()
 *     {
 *         Location = "us-west1",
 *         Name = "sample-np",
 *         EdgeServicesCidr = "192.168.30.0/26",
 *         VmwareEngineNetwork = external_access_rule_nw.Id,
 *     });
 *     var vmw_engine_external_access_rule = new Gcp.VMwareEngine.ExternalAccessRule("vmw-engine-external-access-rule", new()
 *     {
 *         Name = "sample-external-access-rule",
 *         Parent = external_access_rule_np.Id,
 *         Priority = 101,
 *         Action = "DENY",
 *         IpProtocol = "TCP",
 *         SourceIpRanges = new[]
 *         {
 *             new Gcp.VMwareEngine.Inputs.ExternalAccessRuleSourceIpRangeArgs
 *             {
 *                 IpAddressRange = "0.0.0.0/0",
 *             },
 *         },
 *         SourcePorts = new[]
 *         {
 *             "80",
 *         },
 *         DestinationIpRanges = new[]
 *         {
 *             new Gcp.VMwareEngine.Inputs.ExternalAccessRuleDestinationIpRangeArgs
 *             {
 *                 IpAddressRange = "0.0.0.0/0",
 *             },
 *         },
 *         DestinationPorts = new[]
 *         {
 *             "433",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/vmwareengine"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := vmwareengine.NewNetwork(ctx, "external-access-rule-nw", &vmwareengine.NetworkArgs{
 * 			Name:        pulumi.String("sample-nw"),
 * 			Location:    pulumi.String("global"),
 * 			Type:        pulumi.String("STANDARD"),
 * 			Description: pulumi.String("PC network description."),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = vmwareengine.NewNetworkPolicy(ctx, "external-access-rule-np", &vmwareengine.NetworkPolicyArgs{
 * 			Location:            pulumi.String("us-west1"),
 * 			Name:                pulumi.String("sample-np"),
 * 			EdgeServicesCidr:    pulumi.String("192.168.30.0/26"),
 * 			VmwareEngineNetwork: external_access_rule_nw.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = vmwareengine.NewExternalAccessRule(ctx, "vmw-engine-external-access-rule", &vmwareengine.ExternalAccessRuleArgs{
 * 			Name:       pulumi.String("sample-external-access-rule"),
 * 			Parent:     external_access_rule_np.ID(),
 * 			Priority:   pulumi.Int(101),
 * 			Action:     pulumi.String("DENY"),
 * 			IpProtocol: pulumi.String("TCP"),
 * 			SourceIpRanges: vmwareengine.ExternalAccessRuleSourceIpRangeArray{
 * 				&vmwareengine.ExternalAccessRuleSourceIpRangeArgs{
 * 					IpAddressRange: pulumi.String("0.0.0.0/0"),
 * 				},
 * 			},
 * 			SourcePorts: pulumi.StringArray{
 * 				pulumi.String("80"),
 * 			},
 * 			DestinationIpRanges: vmwareengine.ExternalAccessRuleDestinationIpRangeArray{
 * 				&vmwareengine.ExternalAccessRuleDestinationIpRangeArgs{
 * 					IpAddressRange: pulumi.String("0.0.0.0/0"),
 * 				},
 * 			},
 * 			DestinationPorts: pulumi.StringArray{
 * 				pulumi.String("433"),
 * 			},
 * 		})
 * 		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.vmwareengine.Network;
 * import com.pulumi.gcp.vmwareengine.NetworkArgs;
 * import com.pulumi.gcp.vmwareengine.NetworkPolicy;
 * import com.pulumi.gcp.vmwareengine.NetworkPolicyArgs;
 * import com.pulumi.gcp.vmwareengine.ExternalAccessRule;
 * import com.pulumi.gcp.vmwareengine.ExternalAccessRuleArgs;
 * import com.pulumi.gcp.vmwareengine.inputs.ExternalAccessRuleSourceIpRangeArgs;
 * import com.pulumi.gcp.vmwareengine.inputs.ExternalAccessRuleDestinationIpRangeArgs;
 * 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 external_access_rule_nw = new Network("external-access-rule-nw", NetworkArgs.builder()
 *             .name("sample-nw")
 *             .location("global")
 *             .type("STANDARD")
 *             .description("PC network description.")
 *             .build());
 *         var external_access_rule_np = new NetworkPolicy("external-access-rule-np", NetworkPolicyArgs.builder()
 *             .location("us-west1")
 *             .name("sample-np")
 *             .edgeServicesCidr("192.168.30.0/26")
 *             .vmwareEngineNetwork(external_access_rule_nw.id())
 *             .build());
 *         var vmw_engine_external_access_rule = new ExternalAccessRule("vmw-engine-external-access-rule", ExternalAccessRuleArgs.builder()
 *             .name("sample-external-access-rule")
 *             .parent(external_access_rule_np.id())
 *             .priority(101)
 *             .action("DENY")
 *             .ipProtocol("TCP")
 *             .sourceIpRanges(ExternalAccessRuleSourceIpRangeArgs.builder()
 *                 .ipAddressRange("0.0.0.0/0")
 *                 .build())
 *             .sourcePorts("80")
 *             .destinationIpRanges(ExternalAccessRuleDestinationIpRangeArgs.builder()
 *                 .ipAddressRange("0.0.0.0/0")
 *                 .build())
 *             .destinationPorts("433")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   external-access-rule-nw:
 *     type: gcp:vmwareengine:Network
 *     properties:
 *       name: sample-nw
 *       location: global
 *       type: STANDARD
 *       description: PC network description.
 *   external-access-rule-np:
 *     type: gcp:vmwareengine:NetworkPolicy
 *     properties:
 *       location: us-west1
 *       name: sample-np
 *       edgeServicesCidr: 192.168.30.0/26
 *       vmwareEngineNetwork: ${["external-access-rule-nw"].id}
 *   vmw-engine-external-access-rule:
 *     type: gcp:vmwareengine:ExternalAccessRule
 *     properties:
 *       name: sample-external-access-rule
 *       parent: ${["external-access-rule-np"].id}
 *       priority: 101
 *       action: DENY
 *       ipProtocol: TCP
 *       sourceIpRanges:
 *         - ipAddressRange: 0.0.0.0/0
 *       sourcePorts:
 *         - '80'
 *       destinationIpRanges:
 *         - ipAddressRange: 0.0.0.0/0
 *       destinationPorts:
 *         - '433'
 * ```
 * 
 * ### Vmware Engine External Access Rule Full
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const external_access_rule_nw = new gcp.vmwareengine.Network("external-access-rule-nw", {
 *     name: "sample-nw",
 *     location: "global",
 *     type: "STANDARD",
 *     description: "PC network description.",
 * });
 * const external_access_rule_pc = new gcp.vmwareengine.PrivateCloud("external-access-rule-pc", {
 *     location: "us-west1-a",
 *     name: "sample-pc",
 *     description: "Sample test PC.",
 *     networkConfig: {
 *         managementCidr: "192.168.50.0/24",
 *         vmwareEngineNetwork: external_access_rule_nw.id,
 *     },
 *     managementCluster: {
 *         clusterId: "sample-mgmt-cluster",
 *         nodeTypeConfigs: [{
 *             nodeTypeId: "standard-72",
 *             nodeCount: 3,
 *         }],
 *     },
 * });
 * const external_access_rule_np = new gcp.vmwareengine.NetworkPolicy("external-access-rule-np", {
 *     location: "us-west1",
 *     name: "sample-np",
 *     edgeServicesCidr: "192.168.30.0/26",
 *     vmwareEngineNetwork: external_access_rule_nw.id,
 * });
 * const external_access_rule_ea = new gcp.vmwareengine.ExternalAddress("external-access-rule-ea", {
 *     name: "sample-ea",
 *     parent: external_access_rule_pc.id,
 *     internalIp: "192.168.0.65",
 * });
 * const vmw_engine_external_access_rule = new gcp.vmwareengine.ExternalAccessRule("vmw-engine-external-access-rule", {
 *     name: "sample-external-access-rule",
 *     parent: external_access_rule_np.id,
 *     description: "Sample Description",
 *     priority: 101,
 *     action: "ALLOW",
 *     ipProtocol: "tcp",
 *     sourceIpRanges: [{
 *         ipAddressRange: "0.0.0.0/0",
 *     }],
 *     sourcePorts: ["80"],
 *     destinationIpRanges: [{
 *         externalAddress: external_access_rule_ea.id,
 *     }],
 *     destinationPorts: ["433"],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * external_access_rule_nw = gcp.vmwareengine.Network("external-access-rule-nw",
 *     name="sample-nw",
 *     location="global",
 *     type="STANDARD",
 *     description="PC network description.")
 * external_access_rule_pc = gcp.vmwareengine.PrivateCloud("external-access-rule-pc",
 *     location="us-west1-a",
 *     name="sample-pc",
 *     description="Sample test PC.",
 *     network_config=gcp.vmwareengine.PrivateCloudNetworkConfigArgs(
 *         management_cidr="192.168.50.0/24",
 *         vmware_engine_network=external_access_rule_nw.id,
 *     ),
 *     management_cluster=gcp.vmwareengine.PrivateCloudManagementClusterArgs(
 *         cluster_id="sample-mgmt-cluster",
 *         node_type_configs=[gcp.vmwareengine.PrivateCloudManagementClusterNodeTypeConfigArgs(
 *             node_type_id="standard-72",
 *             node_count=3,
 *         )],
 *     ))
 * external_access_rule_np = gcp.vmwareengine.NetworkPolicy("external-access-rule-np",
 *     location="us-west1",
 *     name="sample-np",
 *     edge_services_cidr="192.168.30.0/26",
 *     vmware_engine_network=external_access_rule_nw.id)
 * external_access_rule_ea = gcp.vmwareengine.ExternalAddress("external-access-rule-ea",
 *     name="sample-ea",
 *     parent=external_access_rule_pc.id,
 *     internal_ip="192.168.0.65")
 * vmw_engine_external_access_rule = gcp.vmwareengine.ExternalAccessRule("vmw-engine-external-access-rule",
 *     name="sample-external-access-rule",
 *     parent=external_access_rule_np.id,
 *     description="Sample Description",
 *     priority=101,
 *     action="ALLOW",
 *     ip_protocol="tcp",
 *     source_ip_ranges=[gcp.vmwareengine.ExternalAccessRuleSourceIpRangeArgs(
 *         ip_address_range="0.0.0.0/0",
 *     )],
 *     source_ports=["80"],
 *     destination_ip_ranges=[gcp.vmwareengine.ExternalAccessRuleDestinationIpRangeArgs(
 *         external_address=external_access_rule_ea.id,
 *     )],
 *     destination_ports=["433"])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var external_access_rule_nw = new Gcp.VMwareEngine.Network("external-access-rule-nw", new()
 *     {
 *         Name = "sample-nw",
 *         Location = "global",
 *         Type = "STANDARD",
 *         Description = "PC network description.",
 *     });
 *     var external_access_rule_pc = new Gcp.VMwareEngine.PrivateCloud("external-access-rule-pc", new()
 *     {
 *         Location = "us-west1-a",
 *         Name = "sample-pc",
 *         Description = "Sample test PC.",
 *         NetworkConfig = new Gcp.VMwareEngine.Inputs.PrivateCloudNetworkConfigArgs
 *         {
 *             ManagementCidr = "192.168.50.0/24",
 *             VmwareEngineNetwork = external_access_rule_nw.Id,
 *         },
 *         ManagementCluster = new Gcp.VMwareEngine.Inputs.PrivateCloudManagementClusterArgs
 *         {
 *             ClusterId = "sample-mgmt-cluster",
 *             NodeTypeConfigs = new[]
 *             {
 *                 new Gcp.VMwareEngine.Inputs.PrivateCloudManagementClusterNodeTypeConfigArgs
 *                 {
 *                     NodeTypeId = "standard-72",
 *                     NodeCount = 3,
 *                 },
 *             },
 *         },
 *     });
 *     var external_access_rule_np = new Gcp.VMwareEngine.NetworkPolicy("external-access-rule-np", new()
 *     {
 *         Location = "us-west1",
 *         Name = "sample-np",
 *         EdgeServicesCidr = "192.168.30.0/26",
 *         VmwareEngineNetwork = external_access_rule_nw.Id,
 *     });
 *     var external_access_rule_ea = new Gcp.VMwareEngine.ExternalAddress("external-access-rule-ea", new()
 *     {
 *         Name = "sample-ea",
 *         Parent = external_access_rule_pc.Id,
 *         InternalIp = "192.168.0.65",
 *     });
 *     var vmw_engine_external_access_rule = new Gcp.VMwareEngine.ExternalAccessRule("vmw-engine-external-access-rule", new()
 *     {
 *         Name = "sample-external-access-rule",
 *         Parent = external_access_rule_np.Id,
 *         Description = "Sample Description",
 *         Priority = 101,
 *         Action = "ALLOW",
 *         IpProtocol = "tcp",
 *         SourceIpRanges = new[]
 *         {
 *             new Gcp.VMwareEngine.Inputs.ExternalAccessRuleSourceIpRangeArgs
 *             {
 *                 IpAddressRange = "0.0.0.0/0",
 *             },
 *         },
 *         SourcePorts = new[]
 *         {
 *             "80",
 *         },
 *         DestinationIpRanges = new[]
 *         {
 *             new Gcp.VMwareEngine.Inputs.ExternalAccessRuleDestinationIpRangeArgs
 *             {
 *                 ExternalAddress = external_access_rule_ea.Id,
 *             },
 *         },
 *         DestinationPorts = new[]
 *         {
 *             "433",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/vmwareengine"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := vmwareengine.NewNetwork(ctx, "external-access-rule-nw", &vmwareengine.NetworkArgs{
 * 			Name:        pulumi.String("sample-nw"),
 * 			Location:    pulumi.String("global"),
 * 			Type:        pulumi.String("STANDARD"),
 * 			Description: pulumi.String("PC network description."),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = vmwareengine.NewPrivateCloud(ctx, "external-access-rule-pc", &vmwareengine.PrivateCloudArgs{
 * 			Location:    pulumi.String("us-west1-a"),
 * 			Name:        pulumi.String("sample-pc"),
 * 			Description: pulumi.String("Sample test PC."),
 * 			NetworkConfig: &vmwareengine.PrivateCloudNetworkConfigArgs{
 * 				ManagementCidr:      pulumi.String("192.168.50.0/24"),
 * 				VmwareEngineNetwork: external_access_rule_nw.ID(),
 * 			},
 * 			ManagementCluster: &vmwareengine.PrivateCloudManagementClusterArgs{
 * 				ClusterId: pulumi.String("sample-mgmt-cluster"),
 * 				NodeTypeConfigs: vmwareengine.PrivateCloudManagementClusterNodeTypeConfigArray{
 * 					&vmwareengine.PrivateCloudManagementClusterNodeTypeConfigArgs{
 * 						NodeTypeId: pulumi.String("standard-72"),
 * 						NodeCount:  pulumi.Int(3),
 * 					},
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = vmwareengine.NewNetworkPolicy(ctx, "external-access-rule-np", &vmwareengine.NetworkPolicyArgs{
 * 			Location:            pulumi.String("us-west1"),
 * 			Name:                pulumi.String("sample-np"),
 * 			EdgeServicesCidr:    pulumi.String("192.168.30.0/26"),
 * 			VmwareEngineNetwork: external_access_rule_nw.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = vmwareengine.NewExternalAddress(ctx, "external-access-rule-ea", &vmwareengine.ExternalAddressArgs{
 * 			Name:       pulumi.String("sample-ea"),
 * 			Parent:     external_access_rule_pc.ID(),
 * 			InternalIp: pulumi.String("192.168.0.65"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = vmwareengine.NewExternalAccessRule(ctx, "vmw-engine-external-access-rule", &vmwareengine.ExternalAccessRuleArgs{
 * 			Name:        pulumi.String("sample-external-access-rule"),
 * 			Parent:      external_access_rule_np.ID(),
 * 			Description: pulumi.String("Sample Description"),
 * 			Priority:    pulumi.Int(101),
 * 			Action:      pulumi.String("ALLOW"),
 * 			IpProtocol:  pulumi.String("tcp"),
 * 			SourceIpRanges: vmwareengine.ExternalAccessRuleSourceIpRangeArray{
 * 				&vmwareengine.ExternalAccessRuleSourceIpRangeArgs{
 * 					IpAddressRange: pulumi.String("0.0.0.0/0"),
 * 				},
 * 			},
 * 			SourcePorts: pulumi.StringArray{
 * 				pulumi.String("80"),
 * 			},
 * 			DestinationIpRanges: vmwareengine.ExternalAccessRuleDestinationIpRangeArray{
 * 				&vmwareengine.ExternalAccessRuleDestinationIpRangeArgs{
 * 					ExternalAddress: external_access_rule_ea.ID(),
 * 				},
 * 			},
 * 			DestinationPorts: pulumi.StringArray{
 * 				pulumi.String("433"),
 * 			},
 * 		})
 * 		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.vmwareengine.Network;
 * import com.pulumi.gcp.vmwareengine.NetworkArgs;
 * import com.pulumi.gcp.vmwareengine.PrivateCloud;
 * import com.pulumi.gcp.vmwareengine.PrivateCloudArgs;
 * import com.pulumi.gcp.vmwareengine.inputs.PrivateCloudNetworkConfigArgs;
 * import com.pulumi.gcp.vmwareengine.inputs.PrivateCloudManagementClusterArgs;
 * import com.pulumi.gcp.vmwareengine.NetworkPolicy;
 * import com.pulumi.gcp.vmwareengine.NetworkPolicyArgs;
 * import com.pulumi.gcp.vmwareengine.ExternalAddress;
 * import com.pulumi.gcp.vmwareengine.ExternalAddressArgs;
 * import com.pulumi.gcp.vmwareengine.ExternalAccessRule;
 * import com.pulumi.gcp.vmwareengine.ExternalAccessRuleArgs;
 * import com.pulumi.gcp.vmwareengine.inputs.ExternalAccessRuleSourceIpRangeArgs;
 * import com.pulumi.gcp.vmwareengine.inputs.ExternalAccessRuleDestinationIpRangeArgs;
 * 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 external_access_rule_nw = new Network("external-access-rule-nw", NetworkArgs.builder()
 *             .name("sample-nw")
 *             .location("global")
 *             .type("STANDARD")
 *             .description("PC network description.")
 *             .build());
 *         var external_access_rule_pc = new PrivateCloud("external-access-rule-pc", PrivateCloudArgs.builder()
 *             .location("us-west1-a")
 *             .name("sample-pc")
 *             .description("Sample test PC.")
 *             .networkConfig(PrivateCloudNetworkConfigArgs.builder()
 *                 .managementCidr("192.168.50.0/24")
 *                 .vmwareEngineNetwork(external_access_rule_nw.id())
 *                 .build())
 *             .managementCluster(PrivateCloudManagementClusterArgs.builder()
 *                 .clusterId("sample-mgmt-cluster")
 *                 .nodeTypeConfigs(PrivateCloudManagementClusterNodeTypeConfigArgs.builder()
 *                     .nodeTypeId("standard-72")
 *                     .nodeCount(3)
 *                     .build())
 *                 .build())
 *             .build());
 *         var external_access_rule_np = new NetworkPolicy("external-access-rule-np", NetworkPolicyArgs.builder()
 *             .location("us-west1")
 *             .name("sample-np")
 *             .edgeServicesCidr("192.168.30.0/26")
 *             .vmwareEngineNetwork(external_access_rule_nw.id())
 *             .build());
 *         var external_access_rule_ea = new ExternalAddress("external-access-rule-ea", ExternalAddressArgs.builder()
 *             .name("sample-ea")
 *             .parent(external_access_rule_pc.id())
 *             .internalIp("192.168.0.65")
 *             .build());
 *         var vmw_engine_external_access_rule = new ExternalAccessRule("vmw-engine-external-access-rule", ExternalAccessRuleArgs.builder()
 *             .name("sample-external-access-rule")
 *             .parent(external_access_rule_np.id())
 *             .description("Sample Description")
 *             .priority(101)
 *             .action("ALLOW")
 *             .ipProtocol("tcp")
 *             .sourceIpRanges(ExternalAccessRuleSourceIpRangeArgs.builder()
 *                 .ipAddressRange("0.0.0.0/0")
 *                 .build())
 *             .sourcePorts("80")
 *             .destinationIpRanges(ExternalAccessRuleDestinationIpRangeArgs.builder()
 *                 .externalAddress(external_access_rule_ea.id())
 *                 .build())
 *             .destinationPorts("433")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   external-access-rule-nw:
 *     type: gcp:vmwareengine:Network
 *     properties:
 *       name: sample-nw
 *       location: global
 *       type: STANDARD
 *       description: PC network description.
 *   external-access-rule-pc:
 *     type: gcp:vmwareengine:PrivateCloud
 *     properties:
 *       location: us-west1-a
 *       name: sample-pc
 *       description: Sample test PC.
 *       networkConfig:
 *         managementCidr: 192.168.50.0/24
 *         vmwareEngineNetwork: ${["external-access-rule-nw"].id}
 *       managementCluster:
 *         clusterId: sample-mgmt-cluster
 *         nodeTypeConfigs:
 *           - nodeTypeId: standard-72
 *             nodeCount: 3
 *   external-access-rule-np:
 *     type: gcp:vmwareengine:NetworkPolicy
 *     properties:
 *       location: us-west1
 *       name: sample-np
 *       edgeServicesCidr: 192.168.30.0/26
 *       vmwareEngineNetwork: ${["external-access-rule-nw"].id}
 *   external-access-rule-ea:
 *     type: gcp:vmwareengine:ExternalAddress
 *     properties:
 *       name: sample-ea
 *       parent: ${["external-access-rule-pc"].id}
 *       internalIp: 192.168.0.65
 *   vmw-engine-external-access-rule:
 *     type: gcp:vmwareengine:ExternalAccessRule
 *     properties:
 *       name: sample-external-access-rule
 *       parent: ${["external-access-rule-np"].id}
 *       description: Sample Description
 *       priority: 101
 *       action: ALLOW
 *       ipProtocol: tcp
 *       sourceIpRanges:
 *         - ipAddressRange: 0.0.0.0/0
 *       sourcePorts:
 *         - '80'
 *       destinationIpRanges:
 *         - externalAddress: ${["external-access-rule-ea"].id}
 *       destinationPorts:
 *         - '433'
 * ```
 * 
 * ## Import
 * ExternalAccessRule can be imported using any of these accepted formats:
 * * `{{parent}}/externalAccessRules/{{name}}`
 * When using the `pulumi import` command, ExternalAccessRule can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:vmwareengine/externalAccessRule:ExternalAccessRule default {{parent}}/externalAccessRules/{{name}}
 * ```
 */
public class ExternalAccessRule internal constructor(
    override val javaResource: com.pulumi.gcp.vmwareengine.ExternalAccessRule,
) : KotlinCustomResource(javaResource, ExternalAccessRuleMapper) {
    /**
     * The action that the external access rule performs.
     * Possible values are: `ALLOW`, `DENY`.
     */
    public val action: Output
        get() = javaResource.action().applyValue({ args0 -> args0 })

    /**
     * Creation time of this resource.
     * A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and
     * up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
     */
    public val createTime: Output
        get() = javaResource.createTime().applyValue({ args0 -> args0 })

    /**
     * User-provided description for the external access rule.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * If destination ranges are specified, the external access rule applies only to
     * traffic that has a destination IP address in these ranges.
     * Structure is documented below.
     */
    public val destinationIpRanges: Output>
        get() = javaResource.destinationIpRanges().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> externalAccessRuleDestinationIpRangeToKotlin(args0) })
            })
        })

    /**
     * A list of destination ports to which the external access rule applies.
     */
    public val destinationPorts: Output>
        get() = javaResource.destinationPorts().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * The IP protocol to which the external access rule applies.
     */
    public val ipProtocol: Output
        get() = javaResource.ipProtocol().applyValue({ args0 -> args0 })

    /**
     * The ID of the external access rule.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The resource name of the network policy.
     * Resource names are schemeless URIs that follow the conventions in https://cloud.google.com/apis/design/resource_names.
     * For example: projects/my-project/locations/us-west1-a/networkPolicies/my-policy
     */
    public val parent: Output
        get() = javaResource.parent().applyValue({ args0 -> args0 })

    /**
     * External access rule priority, which determines the external access rule to use when multiple rules apply.
     */
    public val priority: Output
        get() = javaResource.priority().applyValue({ args0 -> args0 })

    /**
     * If source ranges are specified, the external access rule applies only to
     * traffic that has a source IP address in these ranges.
     * Structure is documented below.
     */
    public val sourceIpRanges: Output>
        get() = javaResource.sourceIpRanges().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> externalAccessRuleSourceIpRangeToKotlin(args0) })
            })
        })

    /**
     * A list of source ports to which the external access rule applies.
     */
    public val sourcePorts: Output>
        get() = javaResource.sourcePorts().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * State of the Cluster.
     */
    public val state: Output
        get() = javaResource.state().applyValue({ args0 -> args0 })

    /**
     * System-generated unique identifier for the resource.
     */
    public val uid: Output
        get() = javaResource.uid().applyValue({ args0 -> args0 })

    /**
     * Last updated time of this resource.
     * A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine
     * fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
     */
    public val updateTime: Output
        get() = javaResource.updateTime().applyValue({ args0 -> args0 })
}

public object ExternalAccessRuleMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.vmwareengine.ExternalAccessRule::class == javaResource::class

    override fun map(javaResource: Resource): ExternalAccessRule = ExternalAccessRule(
        javaResource as
            com.pulumi.gcp.vmwareengine.ExternalAccessRule,
    )
}

/**
 * @see [ExternalAccessRule].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [ExternalAccessRule].
 */
public suspend fun externalAccessRule(
    name: String,
    block: suspend ExternalAccessRuleResourceBuilder.() -> Unit,
): ExternalAccessRule {
    val builder = ExternalAccessRuleResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [ExternalAccessRule].
 * @param name The _unique_ name of the resulting resource.
 */
public fun externalAccessRule(name: String): ExternalAccessRule {
    val builder = ExternalAccessRuleResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy