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.azurenative.azurestackhci.kotlin.SecurityRuleArgs.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azurenative.azurestackhci.kotlin
import com.pulumi.azurenative.azurestackhci.SecurityRuleArgs.builder
import com.pulumi.azurenative.azurestackhci.kotlin.enums.SecurityRuleAccess
import com.pulumi.azurenative.azurestackhci.kotlin.enums.SecurityRuleDirection
import com.pulumi.azurenative.azurestackhci.kotlin.enums.SecurityRuleProtocol
import com.pulumi.azurenative.azurestackhci.kotlin.inputs.ExtendedLocationArgs
import com.pulumi.azurenative.azurestackhci.kotlin.inputs.ExtendedLocationArgsBuilder
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
/**
* Security Rule resource.
* Azure REST API version: 2024-02-01-preview.
* Other available API versions: 2024-05-01-preview.
* ## Example Usage
* ### SecurityRulesCreateOrUpdate
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using AzureNative = Pulumi.AzureNative;
* return await Deployment.RunAsync(() =>
* {
* var securityRule = new AzureNative.AzureStackHCI.SecurityRule("securityRule", new()
* {
* Access = AzureNative.AzureStackHCI.SecurityRuleAccess.Allow,
* DestinationAddressPrefixes = new[]
* {
* "*",
* },
* DestinationPortRanges = new[]
* {
* "80",
* },
* Direction = AzureNative.AzureStackHCI.SecurityRuleDirection.Inbound,
* ExtendedLocation = new AzureNative.AzureStackHCI.Inputs.ExtendedLocationArgs
* {
* Name = "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location",
* Type = AzureNative.AzureStackHCI.ExtendedLocationTypes.CustomLocation,
* },
* NetworkSecurityGroupName = "testnsg",
* Priority = 130,
* Protocol = AzureNative.AzureStackHCI.SecurityRuleProtocol.Asterisk,
* ResourceGroupName = "testrg",
* SecurityRuleName = "rule1",
* SourceAddressPrefixes = new[]
* {
* "*",
* },
* SourcePortRanges = new[]
* {
* "*",
* },
* });
* });
* ```
* ```go
* package main
* import (
* azurestackhci "github.com/pulumi/pulumi-azure-native-sdk/azurestackhci/v2"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := azurestackhci.NewSecurityRule(ctx, "securityRule", &azurestackhci.SecurityRuleArgs{
* Access: pulumi.String(azurestackhci.SecurityRuleAccessAllow),
* DestinationAddressPrefixes: pulumi.StringArray{
* pulumi.String("*"),
* },
* DestinationPortRanges: pulumi.StringArray{
* pulumi.String("80"),
* },
* Direction: pulumi.String(azurestackhci.SecurityRuleDirectionInbound),
* ExtendedLocation: &azurestackhci.ExtendedLocationArgs{
* Name: pulumi.String("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"),
* Type: pulumi.String(azurestackhci.ExtendedLocationTypesCustomLocation),
* },
* NetworkSecurityGroupName: pulumi.String("testnsg"),
* Priority: pulumi.Int(130),
* Protocol: pulumi.String(azurestackhci.SecurityRuleProtocolAsterisk),
* ResourceGroupName: pulumi.String("testrg"),
* SecurityRuleName: pulumi.String("rule1"),
* SourceAddressPrefixes: pulumi.StringArray{
* pulumi.String("*"),
* },
* SourcePortRanges: pulumi.StringArray{
* 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.azurestackhci.SecurityRule;
* import com.pulumi.azurenative.azurestackhci.SecurityRuleArgs;
* import com.pulumi.azurenative.azurestackhci.inputs.ExtendedLocationArgs;
* 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("Allow")
* .destinationAddressPrefixes("*")
* .destinationPortRanges("80")
* .direction("Inbound")
* .extendedLocation(ExtendedLocationArgs.builder()
* .name("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location")
* .type("CustomLocation")
* .build())
* .networkSecurityGroupName("testnsg")
* .priority(130)
* .protocol("*")
* .resourceGroupName("testrg")
* .securityRuleName("rule1")
* .sourceAddressPrefixes("*")
* .sourcePortRanges("*")
* .build());
* }
* }
* ```
* ## Import
* An existing resource can be imported using its type token, name, and identifier, e.g.
* ```sh
* $ pulumi import azure-native:azurestackhci:SecurityRule rule1 /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/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 destinationAddressPrefixes The destination address prefixes. CIDR or destination IP ranges.
* @property destinationPortRanges The destination port ranges. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
* @property direction The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic.
* @property extendedLocation The extendedLocation of the resource.
* @property networkSecurityGroupName 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. The name is case insensitive.
* @property securityRuleName Name of the security rule.
* @property sourceAddressPrefixes The CIDR or source IP ranges.
* @property sourcePortRanges The source port ranges. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
*/
public data class SecurityRuleArgs(
public val access: Output>? = null,
public val description: Output? = null,
public val destinationAddressPrefixes: Output>? = null,
public val destinationPortRanges: Output>? = null,
public val direction: Output>? = null,
public val extendedLocation: 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 sourceAddressPrefixes: Output>? = null,
public val sourcePortRanges: Output>? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.azurenative.azurestackhci.SecurityRuleArgs =
com.pulumi.azurenative.azurestackhci.SecurityRuleArgs.builder()
.access(
access?.applyValue({ args0 ->
args0.transform({ args0 -> args0 }, { args0 ->
args0.let({ args0 -> args0.toJava() })
})
}),
)
.description(description?.applyValue({ args0 -> args0 }))
.destinationAddressPrefixes(
destinationAddressPrefixes?.applyValue({ args0 ->
args0.map({ args0 ->
args0
})
}),
)
.destinationPortRanges(destinationPortRanges?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
.direction(
direction?.applyValue({ args0 ->
args0.transform({ args0 -> args0 }, { args0 ->
args0.let({ args0 -> args0.toJava() })
})
}),
)
.extendedLocation(extendedLocation?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
.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 }))
.sourceAddressPrefixes(sourceAddressPrefixes?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
.sourcePortRanges(sourcePortRanges?.applyValue({ args0 -> args0.map({ args0 -> args0 }) })).build()
}
/**
* Builder for [SecurityRuleArgs].
*/
@PulumiTagMarker
public class SecurityRuleArgsBuilder internal constructor() {
private var access: Output>? = null
private var description: Output? = null
private var destinationAddressPrefixes: Output>? = null
private var destinationPortRanges: Output>? = null
private var direction: Output>? = null
private var extendedLocation: 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 sourceAddressPrefixes: Output>? = null
private var sourcePortRanges: Output>? = null
/**
* @param value The network traffic is allowed or denied.
*/
@JvmName("hnkuotppgthcuvuy")
public suspend fun access(`value`: Output>) {
this.access = value
}
/**
* @param value A description for this rule. Restricted to 140 chars.
*/
@JvmName("kpkmnmqoxbskafwg")
public suspend fun description(`value`: Output) {
this.description = value
}
/**
* @param value The destination address prefixes. CIDR or destination IP ranges.
*/
@JvmName("qcddfmmxaxccotrk")
public suspend fun destinationAddressPrefixes(`value`: Output>) {
this.destinationAddressPrefixes = value
}
@JvmName("flvbulebhaxjnbfr")
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("foxyksevingpwopr")
public suspend fun destinationAddressPrefixes(values: List>) {
this.destinationAddressPrefixes = Output.all(values)
}
/**
* @param value The destination port ranges. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
*/
@JvmName("qkdrwmuqiepvgxgd")
public suspend fun destinationPortRanges(`value`: Output>) {
this.destinationPortRanges = value
}
@JvmName("awadfafayshqpkyl")
public suspend fun destinationPortRanges(vararg values: Output) {
this.destinationPortRanges = Output.all(values.asList())
}
/**
* @param values The destination port ranges. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
*/
@JvmName("jbasxdvedldelils")
public suspend fun destinationPortRanges(values: List>) {
this.destinationPortRanges = Output.all(values)
}
/**
* @param value The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic.
*/
@JvmName("qwwsmkmjwvrneind")
public suspend fun direction(`value`: Output>) {
this.direction = value
}
/**
* @param value The extendedLocation of the resource.
*/
@JvmName("mdorkyfjsttssrku")
public suspend fun extendedLocation(`value`: Output) {
this.extendedLocation = value
}
/**
* @param value Name of the network security group
*/
@JvmName("lmdaryyiwxrcarpn")
public suspend fun networkSecurityGroupName(`value`: Output) {
this.networkSecurityGroupName = value
}
/**
* @param value 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.
*/
@JvmName("taaexgixhmgvcidr")
public suspend fun priority(`value`: Output) {
this.priority = value
}
/**
* @param value Network protocol this rule applies to.
*/
@JvmName("qfcwlhjycjjnenac")
public suspend fun protocol(`value`: Output>) {
this.protocol = value
}
/**
* @param value The name of the resource group. The name is case insensitive.
*/
@JvmName("qabldwgfgjfvrowa")
public suspend fun resourceGroupName(`value`: Output) {
this.resourceGroupName = value
}
/**
* @param value Name of the security rule.
*/
@JvmName("qserksqqohmpoprb")
public suspend fun securityRuleName(`value`: Output) {
this.securityRuleName = value
}
/**
* @param value The CIDR or source IP ranges.
*/
@JvmName("fcafxhravbuyvyys")
public suspend fun sourceAddressPrefixes(`value`: Output>) {
this.sourceAddressPrefixes = value
}
@JvmName("urwbcfkxqdkyckcm")
public suspend fun sourceAddressPrefixes(vararg values: Output) {
this.sourceAddressPrefixes = Output.all(values.asList())
}
/**
* @param values The CIDR or source IP ranges.
*/
@JvmName("okrjhaofniqdqumh")
public suspend fun sourceAddressPrefixes(values: List>) {
this.sourceAddressPrefixes = Output.all(values)
}
/**
* @param value The source port ranges. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
*/
@JvmName("kvgirsyyxtkmjyck")
public suspend fun sourcePortRanges(`value`: Output>) {
this.sourcePortRanges = value
}
@JvmName("orrgemboqwljyhko")
public suspend fun sourcePortRanges(vararg values: Output) {
this.sourcePortRanges = Output.all(values.asList())
}
/**
* @param values The source port ranges. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
*/
@JvmName("kapangurwsmdbhip")
public suspend fun sourcePortRanges(values: List>) {
this.sourcePortRanges = Output.all(values)
}
/**
* @param value The network traffic is allowed or denied.
*/
@JvmName("ykroibqfcywviyrl")
public suspend fun access(`value`: Either?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.access = mapped
}
/**
* @param value The network traffic is allowed or denied.
*/
@JvmName("tgjbslifwcvbwung")
public fun access(`value`: String) {
val toBeMapped = Either.ofLeft(value)
val mapped = toBeMapped.let({ args0 -> of(args0) })
this.access = mapped
}
/**
* @param value The network traffic is allowed or denied.
*/
@JvmName("riqweibnojjbwajc")
public fun access(`value`: SecurityRuleAccess) {
val toBeMapped = Either.ofRight(value)
val mapped = toBeMapped.let({ args0 -> of(args0) })
this.access = mapped
}
/**
* @param value A description for this rule. Restricted to 140 chars.
*/
@JvmName("krnpccbamqndripw")
public suspend fun description(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.description = mapped
}
/**
* @param value The destination address prefixes. CIDR or destination IP ranges.
*/
@JvmName("kykowoaklhfrvrmi")
public suspend fun destinationAddressPrefixes(`value`: List?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.destinationAddressPrefixes = mapped
}
/**
* @param values The destination address prefixes. CIDR or destination IP ranges.
*/
@JvmName("unnonxpvfkdokryb")
public suspend fun destinationAddressPrefixes(vararg values: String) {
val toBeMapped = values.toList()
val mapped = toBeMapped.let({ args0 -> of(args0) })
this.destinationAddressPrefixes = mapped
}
/**
* @param value The destination port ranges. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
*/
@JvmName("ldwveuehdmjkyrti")
public suspend fun destinationPortRanges(`value`: List?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.destinationPortRanges = mapped
}
/**
* @param values The destination port ranges. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
*/
@JvmName("fanlurobnkwjrtyi")
public suspend fun destinationPortRanges(vararg values: String) {
val toBeMapped = values.toList()
val mapped = toBeMapped.let({ args0 -> of(args0) })
this.destinationPortRanges = mapped
}
/**
* @param value The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic.
*/
@JvmName("ntfmuirpjmfrbvon")
public suspend fun direction(`value`: Either?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.direction = mapped
}
/**
* @param value The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic.
*/
@JvmName("svcufoteqgqkpqxy")
public fun direction(`value`: String) {
val toBeMapped = Either.ofLeft(value)
val mapped = toBeMapped.let({ args0 -> of(args0) })
this.direction = mapped
}
/**
* @param value The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic.
*/
@JvmName("hddtshremiqolejj")
public fun direction(`value`: SecurityRuleDirection) {
val toBeMapped = Either.ofRight(value)
val mapped = toBeMapped.let({ args0 -> of(args0) })
this.direction = mapped
}
/**
* @param value The extendedLocation of the resource.
*/
@JvmName("kweiimrlkdmyngmk")
public suspend fun extendedLocation(`value`: ExtendedLocationArgs?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.extendedLocation = mapped
}
/**
* @param argument The extendedLocation of the resource.
*/
@JvmName("qaqfynuqfkjhlcpp")
public suspend fun extendedLocation(argument: suspend ExtendedLocationArgsBuilder.() -> Unit) {
val toBeMapped = ExtendedLocationArgsBuilder().applySuspend { argument() }.build()
val mapped = of(toBeMapped)
this.extendedLocation = mapped
}
/**
* @param value Name of the network security group
*/
@JvmName("nbyqnmavhkboihpw")
public suspend fun networkSecurityGroupName(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.networkSecurityGroupName = mapped
}
/**
* @param value 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.
*/
@JvmName("usttanjpafjyrohy")
public suspend fun priority(`value`: Int?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.priority = mapped
}
/**
* @param value Network protocol this rule applies to.
*/
@JvmName("ohixbefskltjfoxx")
public suspend fun protocol(`value`: Either?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.protocol = mapped
}
/**
* @param value Network protocol this rule applies to.
*/
@JvmName("rvofhwsgmnjsrvgu")
public fun protocol(`value`: String) {
val toBeMapped = Either.ofLeft(value)
val mapped = toBeMapped.let({ args0 -> of(args0) })
this.protocol = mapped
}
/**
* @param value Network protocol this rule applies to.
*/
@JvmName("aifcsiomxaproyhv")
public fun protocol(`value`: SecurityRuleProtocol) {
val toBeMapped = Either.ofRight(value)
val mapped = toBeMapped.let({ args0 -> of(args0) })
this.protocol = mapped
}
/**
* @param value The name of the resource group. The name is case insensitive.
*/
@JvmName("vjmdggvxybuqjpad")
public suspend fun resourceGroupName(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.resourceGroupName = mapped
}
/**
* @param value Name of the security rule.
*/
@JvmName("bwmfwnatyotseckf")
public suspend fun securityRuleName(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.securityRuleName = mapped
}
/**
* @param value The CIDR or source IP ranges.
*/
@JvmName("auiiiynhlaigfstp")
public suspend fun sourceAddressPrefixes(`value`: List?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.sourceAddressPrefixes = mapped
}
/**
* @param values The CIDR or source IP ranges.
*/
@JvmName("qsqaxbdapfrbrkau")
public suspend fun sourceAddressPrefixes(vararg values: String) {
val toBeMapped = values.toList()
val mapped = toBeMapped.let({ args0 -> of(args0) })
this.sourceAddressPrefixes = mapped
}
/**
* @param value The source port ranges. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
*/
@JvmName("axqfeofnbvdvptrq")
public suspend fun sourcePortRanges(`value`: List?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.sourcePortRanges = mapped
}
/**
* @param values The source port ranges. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
*/
@JvmName("dfrianabrpcevols")
public suspend fun sourcePortRanges(vararg values: String) {
val toBeMapped = values.toList()
val mapped = toBeMapped.let({ args0 -> of(args0) })
this.sourcePortRanges = mapped
}
internal fun build(): SecurityRuleArgs = SecurityRuleArgs(
access = access,
description = description,
destinationAddressPrefixes = destinationAddressPrefixes,
destinationPortRanges = destinationPortRanges,
direction = direction,
extendedLocation = extendedLocation,
networkSecurityGroupName = networkSecurityGroupName,
priority = priority,
protocol = protocol,
resourceGroupName = resourceGroupName,
securityRuleName = securityRuleName,
sourceAddressPrefixes = sourceAddressPrefixes,
sourcePortRanges = sourcePortRanges,
)
}