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.
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.azurenative.network.kotlin
import com.pulumi.azurenative.network.SecurityRuleArgs.builder
import com.pulumi.azurenative.network.kotlin.enums.SecurityRuleAccess
import com.pulumi.azurenative.network.kotlin.enums.SecurityRuleDirection
import com.pulumi.azurenative.network.kotlin.enums.SecurityRuleProtocol
import com.pulumi.azurenative.network.kotlin.inputs.ApplicationSecurityGroupArgs
import com.pulumi.azurenative.network.kotlin.inputs.ApplicationSecurityGroupArgsBuilder
import com.pulumi.core.Either
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName
/**
* Network security rule.
* Azure REST API version: 2023-02-01. Prior API version in Azure Native 1.x: 2020-11-01.
* Other available API versions: 2017-03-01, 2019-06-01, 2022-07-01, 2023-04-01, 2023-05-01, 2023-06-01, 2023-09-01, 2023-11-01, 2024-01-01.
* ## Example Usage
* ### Create security rule
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using AzureNative = Pulumi.AzureNative;
* return await Deployment.RunAsync(() =>
* {
* var securityRule = new AzureNative.Network.SecurityRule("securityRule", new()
* {
* Access = AzureNative.Network.SecurityRuleAccess.Deny,
* DestinationAddressPrefix = "11.0.0.0/8",
* DestinationPortRange = "8080",
* Direction = AzureNative.Network.SecurityRuleDirection.Outbound,
* NetworkSecurityGroupName = "testnsg",
* Priority = 100,
* Protocol = AzureNative.Network.SecurityRuleProtocol.Asterisk,
* ResourceGroupName = "rg1",
* SecurityRuleName = "rule1",
* SourceAddressPrefix = "10.0.0.0/8",
* SourcePortRange = "*",
* });
* });
* ```
* ```go
* package main
* import (
* network "github.com/pulumi/pulumi-azure-native-sdk/network/v2"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := network.NewSecurityRule(ctx, "securityRule", &network.SecurityRuleArgs{
* Access: pulumi.String(network.SecurityRuleAccessDeny),
* DestinationAddressPrefix: pulumi.String("11.0.0.0/8"),
* DestinationPortRange: pulumi.String("8080"),
* Direction: pulumi.String(network.SecurityRuleDirectionOutbound),
* NetworkSecurityGroupName: pulumi.String("testnsg"),
* Priority: pulumi.Int(100),
* Protocol: pulumi.String(network.SecurityRuleProtocolAsterisk),
* ResourceGroupName: pulumi.String("rg1"),
* SecurityRuleName: pulumi.String("rule1"),
* SourceAddressPrefix: pulumi.String("10.0.0.0/8"),
* SourcePortRange: pulumi.String("*"),
* })
* 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.azurenative.network.SecurityRule;
* import com.pulumi.azurenative.network.SecurityRuleArgs;
* 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 securityRule = new SecurityRule("securityRule", SecurityRuleArgs.builder()
* .access("Deny")
* .destinationAddressPrefix("11.0.0.0/8")
* .destinationPortRange("8080")
* .direction("Outbound")
* .networkSecurityGroupName("testnsg")
* .priority(100)
* .protocol("*")
* .resourceGroupName("rg1")
* .securityRuleName("rule1")
* .sourceAddressPrefix("10.0.0.0/8")
* .sourcePortRange("*")
* .build());
* }
* }
* ```
* ## Import
* An existing resource can be imported using its type token, name, and identifier, e.g.
* ```sh
* $ pulumi import azure-native:network:SecurityRule rule1 /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}
* ```
* @property access The network traffic is allowed or denied.
* @property description A description for this rule. Restricted to 140 chars.
* @property destinationAddressPrefix The destination address prefix. CIDR or destination IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used.
* @property destinationAddressPrefixes The destination address prefixes. CIDR or destination IP ranges.
* @property destinationApplicationSecurityGroups The application security group specified as destination.
* @property destinationPortRange The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
* @property destinationPortRanges The destination port ranges.
* @property direction The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic.
* @property id Resource ID.
* @property name The name of the resource that is unique within a resource group. This name can be used to access the resource.
* @property networkSecurityGroupName The name of the network security group.
* @property priority The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.
* @property protocol Network protocol this rule applies to.
* @property resourceGroupName The name of the resource group.
* @property securityRuleName The name of the security rule.
* @property sourceAddressPrefix The CIDR or source IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from.
* @property sourceAddressPrefixes The CIDR or source IP ranges.
* @property sourceApplicationSecurityGroups The application security group specified as source.
* @property sourcePortRange The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
* @property sourcePortRanges The source port ranges.
* @property type The type of the resource.
*/
public data class SecurityRuleArgs(
public val access: Output>? = null,
public val description: Output? = null,
public val destinationAddressPrefix: Output? = null,
public val destinationAddressPrefixes: Output>? = null,
public val destinationApplicationSecurityGroups: Output>? =
null,
public val destinationPortRange: Output? = null,
public val destinationPortRanges: Output>? = null,
public val direction: Output>? = null,
public val id: Output? = null,
public val name: Output? = null,
public val networkSecurityGroupName: Output? = null,
public val priority: Output? = null,
public val protocol: Output>? = null,
public val resourceGroupName: Output? = null,
public val securityRuleName: Output? = null,
public val sourceAddressPrefix: Output? = null,
public val sourceAddressPrefixes: Output>? = null,
public val sourceApplicationSecurityGroups: Output>? = null,
public val sourcePortRange: Output? = null,
public val sourcePortRanges: Output>? = null,
public val type: Output? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.azurenative.network.SecurityRuleArgs =
com.pulumi.azurenative.network.SecurityRuleArgs.builder()
.access(
access?.applyValue({ args0 ->
args0.transform({ args0 -> args0 }, { args0 ->
args0.let({ args0 -> args0.toJava() })
})
}),
)
.description(description?.applyValue({ args0 -> args0 }))
.destinationAddressPrefix(destinationAddressPrefix?.applyValue({ args0 -> args0 }))
.destinationAddressPrefixes(
destinationAddressPrefixes?.applyValue({ args0 ->
args0.map({ args0 ->
args0
})
}),
)
.destinationApplicationSecurityGroups(
destinationApplicationSecurityGroups?.applyValue({ args0 ->
args0.map({ args0 -> args0.let({ args0 -> args0.toJava() }) })
}),
)
.destinationPortRange(destinationPortRange?.applyValue({ args0 -> args0 }))
.destinationPortRanges(destinationPortRanges?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
.direction(
direction?.applyValue({ args0 ->
args0.transform({ args0 -> args0 }, { args0 ->
args0.let({ args0 -> args0.toJava() })
})
}),
)
.id(id?.applyValue({ args0 -> args0 }))
.name(name?.applyValue({ args0 -> args0 }))
.networkSecurityGroupName(networkSecurityGroupName?.applyValue({ args0 -> args0 }))
.priority(priority?.applyValue({ args0 -> args0 }))
.protocol(
protocol?.applyValue({ args0 ->
args0.transform({ args0 -> args0 }, { args0 ->
args0.let({ args0 -> args0.toJava() })
})
}),
)
.resourceGroupName(resourceGroupName?.applyValue({ args0 -> args0 }))
.securityRuleName(securityRuleName?.applyValue({ args0 -> args0 }))
.sourceAddressPrefix(sourceAddressPrefix?.applyValue({ args0 -> args0 }))
.sourceAddressPrefixes(sourceAddressPrefixes?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
.sourceApplicationSecurityGroups(
sourceApplicationSecurityGroups?.applyValue({ args0 ->
args0.map({ args0 -> args0.let({ args0 -> args0.toJava() }) })
}),
)
.sourcePortRange(sourcePortRange?.applyValue({ args0 -> args0 }))
.sourcePortRanges(sourcePortRanges?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
.type(type?.applyValue({ args0 -> args0 })).build()
}
/**
* Builder for [SecurityRuleArgs].
*/
@PulumiTagMarker
public class SecurityRuleArgsBuilder internal constructor() {
private var access: Output>? = null
private var description: Output? = null
private var destinationAddressPrefix: Output? = null
private var destinationAddressPrefixes: Output>? = null
private var destinationApplicationSecurityGroups: Output>? =
null
private var destinationPortRange: Output? = null
private var destinationPortRanges: Output>? = null
private var direction: Output>? = null
private var id: Output? = null
private var name: Output? = null
private var networkSecurityGroupName: Output? = null
private var priority: Output? = null
private var protocol: Output>? = null
private var resourceGroupName: Output? = null
private var securityRuleName: Output? = null
private var sourceAddressPrefix: Output? = null
private var sourceAddressPrefixes: Output>? = null
private var sourceApplicationSecurityGroups: Output>? = null
private var sourcePortRange: Output? = null
private var sourcePortRanges: Output>? = null
private var type: Output? = null
/**
* @param value The network traffic is allowed or denied.
*/
@JvmName("fwdsodqmdstfhhnq")
public suspend fun access(`value`: Output>) {
this.access = value
}
/**
* @param value A description for this rule. Restricted to 140 chars.
*/
@JvmName("jbuvgqtjxcedwusn")
public suspend fun description(`value`: Output) {
this.description = value
}
/**
* @param value The destination address prefix. CIDR or destination IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used.
*/
@JvmName("idbxtitmukrdniqu")
public suspend fun destinationAddressPrefix(`value`: Output) {
this.destinationAddressPrefix = value
}
/**
* @param value The destination address prefixes. CIDR or destination IP ranges.
*/
@JvmName("fhnisqdydcubrpgv")
public suspend fun destinationAddressPrefixes(`value`: Output>) {
this.destinationAddressPrefixes = value
}
@JvmName("ygnulvnkpdsxiark")
public suspend fun destinationAddressPrefixes(vararg values: Output) {
this.destinationAddressPrefixes = Output.all(values.asList())
}
/**
* @param values The destination address prefixes. CIDR or destination IP ranges.
*/
@JvmName("kxqbfygbgvpxjawr")
public suspend fun destinationAddressPrefixes(values: List