com.pulumi.azure.network.kotlin.VirtualNetworkDnsServers.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-azure-kotlin Show documentation
Show all versions of pulumi-azure-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.azure.network.kotlin
import com.pulumi.core.Output
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.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
/**
* Builder for [VirtualNetworkDnsServers].
*/
@PulumiTagMarker
public class VirtualNetworkDnsServersResourceBuilder internal constructor() {
public var name: String? = null
public var args: VirtualNetworkDnsServersArgs = VirtualNetworkDnsServersArgs()
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 VirtualNetworkDnsServersArgsBuilder.() -> Unit) {
val builder = VirtualNetworkDnsServersArgsBuilder()
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(): VirtualNetworkDnsServers {
val builtJavaResource =
com.pulumi.azure.network.VirtualNetworkDnsServers(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return VirtualNetworkDnsServers(builtJavaResource)
}
}
/**
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
* const example = new azure.core.ResourceGroup("example", {
* name: "example-resources",
* location: "West Europe",
* });
* const exampleVirtualNetwork = new azure.network.VirtualNetwork("example", {
* name: "example-vnet",
* addressSpaces: ["10.0.0.0/16"],
* location: example.location,
* resourceGroupName: example.name,
* subnets: [{
* name: "subnet1",
* addressPrefix: "10.0.1.0/24",
* }],
* });
* const exampleVirtualNetworkDnsServers = new azure.network.VirtualNetworkDnsServers("example", {
* virtualNetworkId: exampleVirtualNetwork.id,
* dnsServers: [
* "10.7.7.2",
* "10.7.7.7",
* "10.7.7.1",
* ],
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* example = azure.core.ResourceGroup("example",
* name="example-resources",
* location="West Europe")
* example_virtual_network = azure.network.VirtualNetwork("example",
* name="example-vnet",
* address_spaces=["10.0.0.0/16"],
* location=example.location,
* resource_group_name=example.name,
* subnets=[azure.network.VirtualNetworkSubnetArgs(
* name="subnet1",
* address_prefix="10.0.1.0/24",
* )])
* example_virtual_network_dns_servers = azure.network.VirtualNetworkDnsServers("example",
* virtual_network_id=example_virtual_network.id,
* dns_servers=[
* "10.7.7.2",
* "10.7.7.7",
* "10.7.7.1",
* ])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Azure = Pulumi.Azure;
* return await Deployment.RunAsync(() =>
* {
* var example = new Azure.Core.ResourceGroup("example", new()
* {
* Name = "example-resources",
* Location = "West Europe",
* });
* var exampleVirtualNetwork = new Azure.Network.VirtualNetwork("example", new()
* {
* Name = "example-vnet",
* AddressSpaces = new[]
* {
* "10.0.0.0/16",
* },
* Location = example.Location,
* ResourceGroupName = example.Name,
* Subnets = new[]
* {
* new Azure.Network.Inputs.VirtualNetworkSubnetArgs
* {
* Name = "subnet1",
* AddressPrefix = "10.0.1.0/24",
* },
* },
* });
* var exampleVirtualNetworkDnsServers = new Azure.Network.VirtualNetworkDnsServers("example", new()
* {
* VirtualNetworkId = exampleVirtualNetwork.Id,
* DnsServers = new[]
* {
* "10.7.7.2",
* "10.7.7.7",
* "10.7.7.1",
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/network"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
* Name: pulumi.String("example-resources"),
* Location: pulumi.String("West Europe"),
* })
* if err != nil {
* return err
* }
* exampleVirtualNetwork, err := network.NewVirtualNetwork(ctx, "example", &network.VirtualNetworkArgs{
* Name: pulumi.String("example-vnet"),
* AddressSpaces: pulumi.StringArray{
* pulumi.String("10.0.0.0/16"),
* },
* Location: example.Location,
* ResourceGroupName: example.Name,
* Subnets: network.VirtualNetworkSubnetArray{
* &network.VirtualNetworkSubnetArgs{
* Name: pulumi.String("subnet1"),
* AddressPrefix: pulumi.String("10.0.1.0/24"),
* },
* },
* })
* if err != nil {
* return err
* }
* _, err = network.NewVirtualNetworkDnsServers(ctx, "example", &network.VirtualNetworkDnsServersArgs{
* VirtualNetworkId: exampleVirtualNetwork.ID(),
* DnsServers: pulumi.StringArray{
* pulumi.String("10.7.7.2"),
* pulumi.String("10.7.7.7"),
* pulumi.String("10.7.7.1"),
* },
* })
* 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.azure.core.ResourceGroup;
* import com.pulumi.azure.core.ResourceGroupArgs;
* import com.pulumi.azure.network.VirtualNetwork;
* import com.pulumi.azure.network.VirtualNetworkArgs;
* import com.pulumi.azure.network.inputs.VirtualNetworkSubnetArgs;
* import com.pulumi.azure.network.VirtualNetworkDnsServers;
* import com.pulumi.azure.network.VirtualNetworkDnsServersArgs;
* 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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
* .name("example-resources")
* .location("West Europe")
* .build());
* var exampleVirtualNetwork = new VirtualNetwork("exampleVirtualNetwork", VirtualNetworkArgs.builder()
* .name("example-vnet")
* .addressSpaces("10.0.0.0/16")
* .location(example.location())
* .resourceGroupName(example.name())
* .subnets(VirtualNetworkSubnetArgs.builder()
* .name("subnet1")
* .addressPrefix("10.0.1.0/24")
* .build())
* .build());
* var exampleVirtualNetworkDnsServers = new VirtualNetworkDnsServers("exampleVirtualNetworkDnsServers", VirtualNetworkDnsServersArgs.builder()
* .virtualNetworkId(exampleVirtualNetwork.id())
* .dnsServers(
* "10.7.7.2",
* "10.7.7.7",
* "10.7.7.1")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:core:ResourceGroup
* properties:
* name: example-resources
* location: West Europe
* exampleVirtualNetwork:
* type: azure:network:VirtualNetwork
* name: example
* properties:
* name: example-vnet
* addressSpaces:
* - 10.0.0.0/16
* location: ${example.location}
* resourceGroupName: ${example.name}
* subnets:
* - name: subnet1
* addressPrefix: 10.0.1.0/24
* exampleVirtualNetworkDnsServers:
* type: azure:network:VirtualNetworkDnsServers
* name: example
* properties:
* virtualNetworkId: ${exampleVirtualNetwork.id}
* dnsServers:
* - 10.7.7.2
* - 10.7.7.7
* - 10.7.7.1
* ```
*
* ## Import
* Virtual Network DNS Servers can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:network/virtualNetworkDnsServers:VirtualNetworkDnsServers exampleNetwork /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/virtualNetworks/myvnet1/dnsServers/default
* ```
*/
public class VirtualNetworkDnsServers internal constructor(
override val javaResource: com.pulumi.azure.network.VirtualNetworkDnsServers,
) : KotlinCustomResource(javaResource, VirtualNetworkDnsServersMapper) {
/**
* List of IP addresses of DNS servers
*/
public val dnsServers: Output>?
get() = javaResource.dnsServers().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0
})
}).orElse(null)
})
/**
* The ID of the Virtual Network that should be linked to the DNS Zone. Changing this forces a new resource to be created.
*/
public val virtualNetworkId: Output
get() = javaResource.virtualNetworkId().applyValue({ args0 -> args0 })
}
public object VirtualNetworkDnsServersMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.network.VirtualNetworkDnsServers::class == javaResource::class
override fun map(javaResource: Resource): VirtualNetworkDnsServers =
VirtualNetworkDnsServers(javaResource as com.pulumi.azure.network.VirtualNetworkDnsServers)
}
/**
* @see [VirtualNetworkDnsServers].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [VirtualNetworkDnsServers].
*/
public suspend fun virtualNetworkDnsServers(
name: String,
block: suspend VirtualNetworkDnsServersResourceBuilder.() -> Unit,
): VirtualNetworkDnsServers {
val builder = VirtualNetworkDnsServersResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [VirtualNetworkDnsServers].
* @param name The _unique_ name of the resulting resource.
*/
public fun virtualNetworkDnsServers(name: String): VirtualNetworkDnsServers {
val builder = VirtualNetworkDnsServersResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy