com.pulumi.azurenative.network.SecurityRule Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-native Show documentation
Show all versions of azure-native Show documentation
A native Pulumi package for creating and managing Azure resources.
// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package com.pulumi.azurenative.network;
import com.pulumi.azurenative.Utilities;
import com.pulumi.azurenative.network.SecurityRuleArgs;
import com.pulumi.azurenative.network.outputs.ApplicationSecurityGroupResponse;
import com.pulumi.core.Alias;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.Integer;
import java.lang.String;
import java.util.List;
import java.util.Optional;
import javax.annotation.Nullable;
/**
* 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, 2024-03-01.
*
* ## Example Usage
* ### Create security rule
*
*
* {@code
* 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}
* ```
*
*/
@ResourceType(type="azure-native:network:SecurityRule")
public class SecurityRule extends com.pulumi.resources.CustomResource {
/**
* The network traffic is allowed or denied.
*
*/
@Export(name="access", refs={String.class}, tree="[0]")
private Output access;
/**
* @return The network traffic is allowed or denied.
*
*/
public Output access() {
return this.access;
}
/**
* A description for this rule. Restricted to 140 chars.
*
*/
@Export(name="description", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> description;
/**
* @return A description for this rule. Restricted to 140 chars.
*
*/
public Output> description() {
return Codegen.optional(this.description);
}
/**
* 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.
*
*/
@Export(name="destinationAddressPrefix", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> destinationAddressPrefix;
/**
* @return 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.
*
*/
public Output> destinationAddressPrefix() {
return Codegen.optional(this.destinationAddressPrefix);
}
/**
* The destination address prefixes. CIDR or destination IP ranges.
*
*/
@Export(name="destinationAddressPrefixes", refs={List.class,String.class}, tree="[0,1]")
private Output* @Nullable */ List> destinationAddressPrefixes;
/**
* @return The destination address prefixes. CIDR or destination IP ranges.
*
*/
public Output>> destinationAddressPrefixes() {
return Codegen.optional(this.destinationAddressPrefixes);
}
/**
* The application security group specified as destination.
*
*/
@Export(name="destinationApplicationSecurityGroups", refs={List.class,ApplicationSecurityGroupResponse.class}, tree="[0,1]")
private Output* @Nullable */ List> destinationApplicationSecurityGroups;
/**
* @return The application security group specified as destination.
*
*/
public Output>> destinationApplicationSecurityGroups() {
return Codegen.optional(this.destinationApplicationSecurityGroups);
}
/**
* The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
*
*/
@Export(name="destinationPortRange", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> destinationPortRange;
/**
* @return The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
*
*/
public Output> destinationPortRange() {
return Codegen.optional(this.destinationPortRange);
}
/**
* The destination port ranges.
*
*/
@Export(name="destinationPortRanges", refs={List.class,String.class}, tree="[0,1]")
private Output* @Nullable */ List> destinationPortRanges;
/**
* @return The destination port ranges.
*
*/
public Output>> destinationPortRanges() {
return Codegen.optional(this.destinationPortRanges);
}
/**
* The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic.
*
*/
@Export(name="direction", refs={String.class}, tree="[0]")
private Output direction;
/**
* @return The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic.
*
*/
public Output direction() {
return this.direction;
}
/**
* A unique read-only string that changes whenever the resource is updated.
*
*/
@Export(name="etag", refs={String.class}, tree="[0]")
private Output etag;
/**
* @return A unique read-only string that changes whenever the resource is updated.
*
*/
public Output etag() {
return this.etag;
}
/**
* The name of the resource that is unique within a resource group. This name can be used to access the resource.
*
*/
@Export(name="name", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> name;
/**
* @return The name of the resource that is unique within a resource group. This name can be used to access the resource.
*
*/
public Output> name() {
return Codegen.optional(this.name);
}
/**
* 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.
*
*/
@Export(name="priority", refs={Integer.class}, tree="[0]")
private Output priority;
/**
* @return 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.
*
*/
public Output priority() {
return this.priority;
}
/**
* Network protocol this rule applies to.
*
*/
@Export(name="protocol", refs={String.class}, tree="[0]")
private Output protocol;
/**
* @return Network protocol this rule applies to.
*
*/
public Output protocol() {
return this.protocol;
}
/**
* The provisioning state of the security rule resource.
*
*/
@Export(name="provisioningState", refs={String.class}, tree="[0]")
private Output provisioningState;
/**
* @return The provisioning state of the security rule resource.
*
*/
public Output provisioningState() {
return this.provisioningState;
}
/**
* 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.
*
*/
@Export(name="sourceAddressPrefix", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> sourceAddressPrefix;
/**
* @return 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.
*
*/
public Output> sourceAddressPrefix() {
return Codegen.optional(this.sourceAddressPrefix);
}
/**
* The CIDR or source IP ranges.
*
*/
@Export(name="sourceAddressPrefixes", refs={List.class,String.class}, tree="[0,1]")
private Output* @Nullable */ List> sourceAddressPrefixes;
/**
* @return The CIDR or source IP ranges.
*
*/
public Output>> sourceAddressPrefixes() {
return Codegen.optional(this.sourceAddressPrefixes);
}
/**
* The application security group specified as source.
*
*/
@Export(name="sourceApplicationSecurityGroups", refs={List.class,ApplicationSecurityGroupResponse.class}, tree="[0,1]")
private Output* @Nullable */ List> sourceApplicationSecurityGroups;
/**
* @return The application security group specified as source.
*
*/
public Output>> sourceApplicationSecurityGroups() {
return Codegen.optional(this.sourceApplicationSecurityGroups);
}
/**
* The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
*
*/
@Export(name="sourcePortRange", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> sourcePortRange;
/**
* @return The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
*
*/
public Output> sourcePortRange() {
return Codegen.optional(this.sourcePortRange);
}
/**
* The source port ranges.
*
*/
@Export(name="sourcePortRanges", refs={List.class,String.class}, tree="[0,1]")
private Output* @Nullable */ List> sourcePortRanges;
/**
* @return The source port ranges.
*
*/
public Output>> sourcePortRanges() {
return Codegen.optional(this.sourcePortRanges);
}
/**
* The type of the resource.
*
*/
@Export(name="type", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> type;
/**
* @return The type of the resource.
*
*/
public Output> type() {
return Codegen.optional(this.type);
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public SecurityRule(java.lang.String name) {
this(name, SecurityRuleArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public SecurityRule(java.lang.String name, SecurityRuleArgs args) {
this(name, args, null);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
* @param options A bag of options that control this resource's behavior.
*/
public SecurityRule(java.lang.String name, SecurityRuleArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure-native:network:SecurityRule", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private SecurityRule(java.lang.String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure-native:network:SecurityRule", name, null, makeResourceOptions(options, id), false);
}
private static SecurityRuleArgs makeArgs(SecurityRuleArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? SecurityRuleArgs.Empty : args;
}
private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) {
var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder()
.version(Utilities.getVersion())
.aliases(List.of(
Output.of(Alias.builder().type("azure-native:network/v20150501preview:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20150615:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20160330:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20160601:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20160901:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20161201:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20170301:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20170601:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20170801:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20170901:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20171001:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20171101:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20180101:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20180201:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20180401:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20180601:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20180701:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20180801:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20181001:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20181101:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20181201:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20190201:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20190401:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20190601:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20190701:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20190801:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20190901:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20191101:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20191201:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20200301:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20200401:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20200501:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20200601:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20200701:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20200801:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20201101:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20210201:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20210301:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20210501:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20210801:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20220101:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20220501:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20220701:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20220901:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20221101:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20230201:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20230401:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20230501:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20230601:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20230901:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20231101:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20240101:SecurityRule").build()),
Output.of(Alias.builder().type("azure-native:network/v20240301:SecurityRule").build())
))
.build();
return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id);
}
/**
* Get an existing Host resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param options Optional settings to control the behavior of the CustomResource.
*/
public static SecurityRule get(java.lang.String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new SecurityRule(name, id, options);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy