com.pulumi.gcp.dns.kotlin.ResponsePolicyArgs.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.dns.kotlin
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.dns.ResponsePolicyArgs.builder
import com.pulumi.gcp.dns.kotlin.inputs.ResponsePolicyGkeClusterArgs
import com.pulumi.gcp.dns.kotlin.inputs.ResponsePolicyGkeClusterArgsBuilder
import com.pulumi.gcp.dns.kotlin.inputs.ResponsePolicyNetworkArgs
import com.pulumi.gcp.dns.kotlin.inputs.ResponsePolicyNetworkArgsBuilder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName
/**
* A Response Policy is a collection of selectors that apply to queries
* made against one or more Virtual Private Cloud networks.
* ## Example Usage
* ### Dns Response Policy Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const network_1 = new gcp.compute.Network("network-1", {
* name: "network-1",
* autoCreateSubnetworks: false,
* });
* const network_2 = new gcp.compute.Network("network-2", {
* name: "network-2",
* autoCreateSubnetworks: false,
* });
* const subnetwork_1 = new gcp.compute.Subnetwork("subnetwork-1", {
* name: network_1.name,
* network: network_1.name,
* ipCidrRange: "10.0.36.0/24",
* region: "us-central1",
* privateIpGoogleAccess: true,
* secondaryIpRanges: [
* {
* rangeName: "pod",
* ipCidrRange: "10.0.0.0/19",
* },
* {
* rangeName: "svc",
* ipCidrRange: "10.0.32.0/22",
* },
* ],
* });
* const cluster_1 = new gcp.container.Cluster("cluster-1", {
* name: "cluster-1",
* location: "us-central1-c",
* initialNodeCount: 1,
* networkingMode: "VPC_NATIVE",
* defaultSnatStatus: {
* disabled: true,
* },
* network: network_1.name,
* subnetwork: subnetwork_1.name,
* privateClusterConfig: {
* enablePrivateEndpoint: true,
* enablePrivateNodes: true,
* masterIpv4CidrBlock: "10.42.0.0/28",
* masterGlobalAccessConfig: {
* enabled: true,
* },
* },
* masterAuthorizedNetworksConfig: {},
* ipAllocationPolicy: {
* clusterSecondaryRangeName: subnetwork_1.secondaryIpRanges.apply(secondaryIpRanges => secondaryIpRanges[0].rangeName),
* servicesSecondaryRangeName: subnetwork_1.secondaryIpRanges.apply(secondaryIpRanges => secondaryIpRanges[1].rangeName),
* },
* deletionProtection: true,
* });
* const example_response_policy = new gcp.dns.ResponsePolicy("example-response-policy", {
* responsePolicyName: "example-response-policy",
* networks: [
* {
* networkUrl: network_1.id,
* },
* {
* networkUrl: network_2.id,
* },
* ],
* gkeClusters: [{
* gkeClusterName: cluster_1.id,
* }],
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* network_1 = gcp.compute.Network("network-1",
* name="network-1",
* auto_create_subnetworks=False)
* network_2 = gcp.compute.Network("network-2",
* name="network-2",
* auto_create_subnetworks=False)
* subnetwork_1 = gcp.compute.Subnetwork("subnetwork-1",
* name=network_1.name,
* network=network_1.name,
* ip_cidr_range="10.0.36.0/24",
* region="us-central1",
* private_ip_google_access=True,
* secondary_ip_ranges=[
* gcp.compute.SubnetworkSecondaryIpRangeArgs(
* range_name="pod",
* ip_cidr_range="10.0.0.0/19",
* ),
* gcp.compute.SubnetworkSecondaryIpRangeArgs(
* range_name="svc",
* ip_cidr_range="10.0.32.0/22",
* ),
* ])
* cluster_1 = gcp.container.Cluster("cluster-1",
* name="cluster-1",
* location="us-central1-c",
* initial_node_count=1,
* networking_mode="VPC_NATIVE",
* default_snat_status=gcp.container.ClusterDefaultSnatStatusArgs(
* disabled=True,
* ),
* network=network_1.name,
* subnetwork=subnetwork_1.name,
* private_cluster_config=gcp.container.ClusterPrivateClusterConfigArgs(
* enable_private_endpoint=True,
* enable_private_nodes=True,
* master_ipv4_cidr_block="10.42.0.0/28",
* master_global_access_config=gcp.container.ClusterPrivateClusterConfigMasterGlobalAccessConfigArgs(
* enabled=True,
* ),
* ),
* master_authorized_networks_config=gcp.container.ClusterMasterAuthorizedNetworksConfigArgs(),
* ip_allocation_policy=gcp.container.ClusterIpAllocationPolicyArgs(
* cluster_secondary_range_name=subnetwork_1.secondary_ip_ranges[0].range_name,
* services_secondary_range_name=subnetwork_1.secondary_ip_ranges[1].range_name,
* ),
* deletion_protection=True)
* example_response_policy = gcp.dns.ResponsePolicy("example-response-policy",
* response_policy_name="example-response-policy",
* networks=[
* gcp.dns.ResponsePolicyNetworkArgs(
* network_url=network_1.id,
* ),
* gcp.dns.ResponsePolicyNetworkArgs(
* network_url=network_2.id,
* ),
* ],
* gke_clusters=[gcp.dns.ResponsePolicyGkeClusterArgs(
* gke_cluster_name=cluster_1.id,
* )])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var network_1 = new Gcp.Compute.Network("network-1", new()
* {
* Name = "network-1",
* AutoCreateSubnetworks = false,
* });
* var network_2 = new Gcp.Compute.Network("network-2", new()
* {
* Name = "network-2",
* AutoCreateSubnetworks = false,
* });
* var subnetwork_1 = new Gcp.Compute.Subnetwork("subnetwork-1", new()
* {
* Name = network_1.Name,
* Network = network_1.Name,
* IpCidrRange = "10.0.36.0/24",
* Region = "us-central1",
* PrivateIpGoogleAccess = true,
* SecondaryIpRanges = new[]
* {
* new Gcp.Compute.Inputs.SubnetworkSecondaryIpRangeArgs
* {
* RangeName = "pod",
* IpCidrRange = "10.0.0.0/19",
* },
* new Gcp.Compute.Inputs.SubnetworkSecondaryIpRangeArgs
* {
* RangeName = "svc",
* IpCidrRange = "10.0.32.0/22",
* },
* },
* });
* var cluster_1 = new Gcp.Container.Cluster("cluster-1", new()
* {
* Name = "cluster-1",
* Location = "us-central1-c",
* InitialNodeCount = 1,
* NetworkingMode = "VPC_NATIVE",
* DefaultSnatStatus = new Gcp.Container.Inputs.ClusterDefaultSnatStatusArgs
* {
* Disabled = true,
* },
* Network = network_1.Name,
* Subnetwork = subnetwork_1.Name,
* PrivateClusterConfig = new Gcp.Container.Inputs.ClusterPrivateClusterConfigArgs
* {
* EnablePrivateEndpoint = true,
* EnablePrivateNodes = true,
* MasterIpv4CidrBlock = "10.42.0.0/28",
* MasterGlobalAccessConfig = new Gcp.Container.Inputs.ClusterPrivateClusterConfigMasterGlobalAccessConfigArgs
* {
* Enabled = true,
* },
* },
* MasterAuthorizedNetworksConfig = null,
* IpAllocationPolicy = new Gcp.Container.Inputs.ClusterIpAllocationPolicyArgs
* {
* ClusterSecondaryRangeName = subnetwork_1.SecondaryIpRanges.Apply(secondaryIpRanges => secondaryIpRanges[0].RangeName),
* ServicesSecondaryRangeName = subnetwork_1.SecondaryIpRanges.Apply(secondaryIpRanges => secondaryIpRanges[1].RangeName),
* },
* DeletionProtection = true,
* });
* var example_response_policy = new Gcp.Dns.ResponsePolicy("example-response-policy", new()
* {
* ResponsePolicyName = "example-response-policy",
* Networks = new[]
* {
* new Gcp.Dns.Inputs.ResponsePolicyNetworkArgs
* {
* NetworkUrl = network_1.Id,
* },
* new Gcp.Dns.Inputs.ResponsePolicyNetworkArgs
* {
* NetworkUrl = network_2.Id,
* },
* },
* GkeClusters = new[]
* {
* new Gcp.Dns.Inputs.ResponsePolicyGkeClusterArgs
* {
* GkeClusterName = cluster_1.Id,
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/container"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/dns"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := compute.NewNetwork(ctx, "network-1", &compute.NetworkArgs{
* Name: pulumi.String("network-1"),
* AutoCreateSubnetworks: pulumi.Bool(false),
* })
* if err != nil {
* return err
* }
* _, err = compute.NewNetwork(ctx, "network-2", &compute.NetworkArgs{
* Name: pulumi.String("network-2"),
* AutoCreateSubnetworks: pulumi.Bool(false),
* })
* if err != nil {
* return err
* }
* _, err = compute.NewSubnetwork(ctx, "subnetwork-1", &compute.SubnetworkArgs{
* Name: network_1.Name,
* Network: network_1.Name,
* IpCidrRange: pulumi.String("10.0.36.0/24"),
* Region: pulumi.String("us-central1"),
* PrivateIpGoogleAccess: pulumi.Bool(true),
* SecondaryIpRanges: compute.SubnetworkSecondaryIpRangeArray{
* &compute.SubnetworkSecondaryIpRangeArgs{
* RangeName: pulumi.String("pod"),
* IpCidrRange: pulumi.String("10.0.0.0/19"),
* },
* &compute.SubnetworkSecondaryIpRangeArgs{
* RangeName: pulumi.String("svc"),
* IpCidrRange: pulumi.String("10.0.32.0/22"),
* },
* },
* })
* if err != nil {
* return err
* }
* _, err = container.NewCluster(ctx, "cluster-1", &container.ClusterArgs{
* Name: pulumi.String("cluster-1"),
* Location: pulumi.String("us-central1-c"),
* InitialNodeCount: pulumi.Int(1),
* NetworkingMode: pulumi.String("VPC_NATIVE"),
* DefaultSnatStatus: &container.ClusterDefaultSnatStatusArgs{
* Disabled: pulumi.Bool(true),
* },
* Network: network_1.Name,
* Subnetwork: subnetwork_1.Name,
* PrivateClusterConfig: &container.ClusterPrivateClusterConfigArgs{
* EnablePrivateEndpoint: pulumi.Bool(true),
* EnablePrivateNodes: pulumi.Bool(true),
* MasterIpv4CidrBlock: pulumi.String("10.42.0.0/28"),
* MasterGlobalAccessConfig: &container.ClusterPrivateClusterConfigMasterGlobalAccessConfigArgs{
* Enabled: pulumi.Bool(true),
* },
* },
* MasterAuthorizedNetworksConfig: nil,
* IpAllocationPolicy: &container.ClusterIpAllocationPolicyArgs{
* ClusterSecondaryRangeName: subnetwork_1.SecondaryIpRanges.ApplyT(func(secondaryIpRanges []compute.SubnetworkSecondaryIpRange) (*string, error) {
* return &secondaryIpRanges[0].RangeName, nil
* }).(pulumi.StringPtrOutput),
* ServicesSecondaryRangeName: subnetwork_1.SecondaryIpRanges.ApplyT(func(secondaryIpRanges []compute.SubnetworkSecondaryIpRange) (*string, error) {
* return &secondaryIpRanges[1].RangeName, nil
* }).(pulumi.StringPtrOutput),
* },
* DeletionProtection: pulumi.Bool(true),
* })
* if err != nil {
* return err
* }
* _, err = dns.NewResponsePolicy(ctx, "example-response-policy", &dns.ResponsePolicyArgs{
* ResponsePolicyName: pulumi.String("example-response-policy"),
* Networks: dns.ResponsePolicyNetworkArray{
* &dns.ResponsePolicyNetworkArgs{
* NetworkUrl: network_1.ID(),
* },
* &dns.ResponsePolicyNetworkArgs{
* NetworkUrl: network_2.ID(),
* },
* },
* GkeClusters: dns.ResponsePolicyGkeClusterArray{
* &dns.ResponsePolicyGkeClusterArgs{
* GkeClusterName: cluster_1.ID(),
* },
* },
* })
* 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.inputs.SubnetworkSecondaryIpRangeArgs;
* import com.pulumi.gcp.container.Cluster;
* import com.pulumi.gcp.container.ClusterArgs;
* import com.pulumi.gcp.container.inputs.ClusterDefaultSnatStatusArgs;
* import com.pulumi.gcp.container.inputs.ClusterPrivateClusterConfigArgs;
* import com.pulumi.gcp.container.inputs.ClusterPrivateClusterConfigMasterGlobalAccessConfigArgs;
* import com.pulumi.gcp.container.inputs.ClusterMasterAuthorizedNetworksConfigArgs;
* import com.pulumi.gcp.container.inputs.ClusterIpAllocationPolicyArgs;
* import com.pulumi.gcp.dns.ResponsePolicy;
* import com.pulumi.gcp.dns.ResponsePolicyArgs;
* import com.pulumi.gcp.dns.inputs.ResponsePolicyNetworkArgs;
* import com.pulumi.gcp.dns.inputs.ResponsePolicyGkeClusterArgs;
* 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 network_1 = new Network("network-1", NetworkArgs.builder()
* .name("network-1")
* .autoCreateSubnetworks(false)
* .build());
* var network_2 = new Network("network-2", NetworkArgs.builder()
* .name("network-2")
* .autoCreateSubnetworks(false)
* .build());
* var subnetwork_1 = new Subnetwork("subnetwork-1", SubnetworkArgs.builder()
* .name(network_1.name())
* .network(network_1.name())
* .ipCidrRange("10.0.36.0/24")
* .region("us-central1")
* .privateIpGoogleAccess(true)
* .secondaryIpRanges(
* SubnetworkSecondaryIpRangeArgs.builder()
* .rangeName("pod")
* .ipCidrRange("10.0.0.0/19")
* .build(),
* SubnetworkSecondaryIpRangeArgs.builder()
* .rangeName("svc")
* .ipCidrRange("10.0.32.0/22")
* .build())
* .build());
* var cluster_1 = new Cluster("cluster-1", ClusterArgs.builder()
* .name("cluster-1")
* .location("us-central1-c")
* .initialNodeCount(1)
* .networkingMode("VPC_NATIVE")
* .defaultSnatStatus(ClusterDefaultSnatStatusArgs.builder()
* .disabled(true)
* .build())
* .network(network_1.name())
* .subnetwork(subnetwork_1.name())
* .privateClusterConfig(ClusterPrivateClusterConfigArgs.builder()
* .enablePrivateEndpoint(true)
* .enablePrivateNodes(true)
* .masterIpv4CidrBlock("10.42.0.0/28")
* .masterGlobalAccessConfig(ClusterPrivateClusterConfigMasterGlobalAccessConfigArgs.builder()
* .enabled(true)
* .build())
* .build())
* .masterAuthorizedNetworksConfig()
* .ipAllocationPolicy(ClusterIpAllocationPolicyArgs.builder()
* .clusterSecondaryRangeName(subnetwork_1.secondaryIpRanges().applyValue(secondaryIpRanges -> secondaryIpRanges[0].rangeName()))
* .servicesSecondaryRangeName(subnetwork_1.secondaryIpRanges().applyValue(secondaryIpRanges -> secondaryIpRanges[1].rangeName()))
* .build())
* .deletionProtection("true")
* .build());
* var example_response_policy = new ResponsePolicy("example-response-policy", ResponsePolicyArgs.builder()
* .responsePolicyName("example-response-policy")
* .networks(
* ResponsePolicyNetworkArgs.builder()
* .networkUrl(network_1.id())
* .build(),
* ResponsePolicyNetworkArgs.builder()
* .networkUrl(network_2.id())
* .build())
* .gkeClusters(ResponsePolicyGkeClusterArgs.builder()
* .gkeClusterName(cluster_1.id())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* network-1:
* type: gcp:compute:Network
* properties:
* name: network-1
* autoCreateSubnetworks: false
* network-2:
* type: gcp:compute:Network
* properties:
* name: network-2
* autoCreateSubnetworks: false
* subnetwork-1:
* type: gcp:compute:Subnetwork
* properties:
* name: ${["network-1"].name}
* network: ${["network-1"].name}
* ipCidrRange: 10.0.36.0/24
* region: us-central1
* privateIpGoogleAccess: true
* secondaryIpRanges:
* - rangeName: pod
* ipCidrRange: 10.0.0.0/19
* - rangeName: svc
* ipCidrRange: 10.0.32.0/22
* cluster-1:
* type: gcp:container:Cluster
* properties:
* name: cluster-1
* location: us-central1-c
* initialNodeCount: 1
* networkingMode: VPC_NATIVE
* defaultSnatStatus:
* disabled: true
* network: ${["network-1"].name}
* subnetwork: ${["subnetwork-1"].name}
* privateClusterConfig:
* enablePrivateEndpoint: true
* enablePrivateNodes: true
* masterIpv4CidrBlock: 10.42.0.0/28
* masterGlobalAccessConfig:
* enabled: true
* masterAuthorizedNetworksConfig: {}
* ipAllocationPolicy:
* clusterSecondaryRangeName: ${["subnetwork-1"].secondaryIpRanges[0].rangeName}
* servicesSecondaryRangeName: ${["subnetwork-1"].secondaryIpRanges[1].rangeName}
* deletionProtection: 'true'
* example-response-policy:
* type: gcp:dns:ResponsePolicy
* properties:
* responsePolicyName: example-response-policy
* networks:
* - networkUrl: ${["network-1"].id}
* - networkUrl: ${["network-2"].id}
* gkeClusters:
* - gkeClusterName: ${["cluster-1"].id}
* ```
*
* ## Import
* ResponsePolicy can be imported using any of these accepted formats:
* * `projects/{{project}}/responsePolicies/{{response_policy_name}}`
* * `{{project}}/{{response_policy_name}}`
* * `{{response_policy_name}}`
* When using the `pulumi import` command, ResponsePolicy can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:dns/responsePolicy:ResponsePolicy default projects/{{project}}/responsePolicies/{{response_policy_name}}
* ```
* ```sh
* $ pulumi import gcp:dns/responsePolicy:ResponsePolicy default {{project}}/{{response_policy_name}}
* ```
* ```sh
* $ pulumi import gcp:dns/responsePolicy:ResponsePolicy default {{response_policy_name}}
* ```
* @property description The description of the response policy, such as `My new response policy`.
* @property gkeClusters The list of Google Kubernetes Engine clusters that can see this zone.
* Structure is documented below.
* @property networks The list of network names specifying networks to which this policy is applied.
* Structure is documented below.
* @property project The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
* @property responsePolicyName The user assigned name for this Response Policy, such as `myresponsepolicy`.
* - - -
*/
public data class ResponsePolicyArgs(
public val description: Output? = null,
public val gkeClusters: Output>? = null,
public val networks: Output>? = null,
public val project: Output? = null,
public val responsePolicyName: Output? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.gcp.dns.ResponsePolicyArgs =
com.pulumi.gcp.dns.ResponsePolicyArgs.builder()
.description(description?.applyValue({ args0 -> args0 }))
.gkeClusters(
gkeClusters?.applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
args0.toJava()
})
})
}),
)
.networks(
networks?.applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
args0.toJava()
})
})
}),
)
.project(project?.applyValue({ args0 -> args0 }))
.responsePolicyName(responsePolicyName?.applyValue({ args0 -> args0 })).build()
}
/**
* Builder for [ResponsePolicyArgs].
*/
@PulumiTagMarker
public class ResponsePolicyArgsBuilder internal constructor() {
private var description: Output? = null
private var gkeClusters: Output>? = null
private var networks: Output>? = null
private var project: Output? = null
private var responsePolicyName: Output? = null
/**
* @param value The description of the response policy, such as `My new response policy`.
*/
@JvmName("npatglobnwwkxrso")
public suspend fun description(`value`: Output) {
this.description = value
}
/**
* @param value The list of Google Kubernetes Engine clusters that can see this zone.
* Structure is documented below.
*/
@JvmName("nyljrordldytxvqa")
public suspend fun gkeClusters(`value`: Output>) {
this.gkeClusters = value
}
@JvmName("ikvoqasdbwqfwgea")
public suspend fun gkeClusters(vararg values: Output) {
this.gkeClusters = Output.all(values.asList())
}
/**
* @param values The list of Google Kubernetes Engine clusters that can see this zone.
* Structure is documented below.
*/
@JvmName("bgdyxauavdgfwipq")
public suspend fun gkeClusters(values: List
© 2015 - 2024 Weber Informatics LLC | Privacy Policy