All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.azure.network.NetworkSecurityGroup Maven / Gradle / Ivy

Go to download

A Pulumi package for creating and managing Microsoft Azure cloud resources, based on the Terraform azurerm provider. We recommend using the [Azure Native provider](https://github.com/pulumi/pulumi-azure-native) to provision Azure infrastructure. Azure Native provides complete coverage of Azure resources and same-day access to new resources and resource updates.

There is a newer version: 6.10.0-alpha.1731737215
Show newest version
// *** 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.azure.network;

import com.pulumi.azure.Utilities;
import com.pulumi.azure.network.NetworkSecurityGroupArgs;
import com.pulumi.azure.network.inputs.NetworkSecurityGroupState;
import com.pulumi.azure.network.outputs.NetworkSecurityGroupSecurityRule;
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.String;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * Manages a network security group that contains a list of network security rules.  Network security groups enable inbound or outbound traffic to be enabled or denied.
 * 
 * > **NOTE on Network Security Groups and Network Security Rules:** This provider currently
 * provides both a standalone Network Security Rule resource, and allows for Network Security Rules to be defined in-line within the Network Security Group resource.
 * At this time you cannot use a Network Security Group with in-line Network Security Rules in conjunction with any Network Security Rule resources. Doing so will cause a conflict of rule settings and will overwrite rules.
 * 
 * ## Example Usage
 * 
 * <!--Start PulumiCodeChooser -->
 * 
 * {@code
 * 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.NetworkSecurityGroup;
 * import com.pulumi.azure.network.NetworkSecurityGroupArgs;
 * import com.pulumi.azure.network.inputs.NetworkSecurityGroupSecurityRuleArgs;
 * 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 exampleNetworkSecurityGroup = new NetworkSecurityGroup("exampleNetworkSecurityGroup", NetworkSecurityGroupArgs.builder()
 *             .name("acceptanceTestSecurityGroup1")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .securityRules(NetworkSecurityGroupSecurityRuleArgs.builder()
 *                 .name("test123")
 *                 .priority(100)
 *                 .direction("Inbound")
 *                 .access("Allow")
 *                 .protocol("Tcp")
 *                 .sourcePortRange("*")
 *                 .destinationPortRange("*")
 *                 .sourceAddressPrefix("*")
 *                 .destinationAddressPrefix("*")
 *                 .build())
 *             .tags(Map.of("environment", "Production"))
 *             .build());
 * 
 *     }
 * }
 * }
 * 
* <!--End PulumiCodeChooser --> * * ## Import * * Network Security Groups can be imported using the `resource id`, e.g. * * ```sh * $ pulumi import azure:network/networkSecurityGroup:NetworkSecurityGroup group1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/networkSecurityGroups/mySecurityGroup * ``` * */ @ResourceType(type="azure:network/networkSecurityGroup:NetworkSecurityGroup") public class NetworkSecurityGroup extends com.pulumi.resources.CustomResource { /** * Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. * */ @Export(name="location", refs={String.class}, tree="[0]") private Output location; /** * @return Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. * */ public Output location() { return this.location; } /** * The name of the security rule. * */ @Export(name="name", refs={String.class}, tree="[0]") private Output name; /** * @return The name of the security rule. * */ public Output name() { return this.name; } /** * The name of the resource group in which to create the network security group. Changing this forces a new resource to be created. * */ @Export(name="resourceGroupName", refs={String.class}, tree="[0]") private Output resourceGroupName; /** * @return The name of the resource group in which to create the network security group. Changing this forces a new resource to be created. * */ public Output resourceGroupName() { return this.resourceGroupName; } /** * A list of objects representing security rules, as defined below. * * > **NOTE** Since `security_rule` can be configured both inline and via the separate `azure.network.NetworkSecurityRule` resource, we have to explicitly set it to empty slice (`[]`) to remove it. * */ @Export(name="securityRules", refs={List.class,NetworkSecurityGroupSecurityRule.class}, tree="[0,1]") private Output> securityRules; /** * @return A list of objects representing security rules, as defined below. * * > **NOTE** Since `security_rule` can be configured both inline and via the separate `azure.network.NetworkSecurityRule` resource, we have to explicitly set it to empty slice (`[]`) to remove it. * */ public Output> securityRules() { return this.securityRules; } /** * A mapping of tags to assign to the resource. * */ @Export(name="tags", refs={Map.class,String.class}, tree="[0,1,1]") private Output> tags; /** * @return A mapping of tags to assign to the resource. * */ public Output>> tags() { return Codegen.optional(this.tags); } /** * * @param name The _unique_ name of the resulting resource. */ public NetworkSecurityGroup(java.lang.String name) { this(name, NetworkSecurityGroupArgs.Empty); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. */ public NetworkSecurityGroup(java.lang.String name, NetworkSecurityGroupArgs 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 NetworkSecurityGroup(java.lang.String name, NetworkSecurityGroupArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("azure:network/networkSecurityGroup:NetworkSecurityGroup", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false); } private NetworkSecurityGroup(java.lang.String name, Output id, @Nullable NetworkSecurityGroupState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("azure:network/networkSecurityGroup:NetworkSecurityGroup", name, state, makeResourceOptions(options, id), false); } private static NetworkSecurityGroupArgs makeArgs(NetworkSecurityGroupArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { if (options != null && options.getUrn().isPresent()) { return null; } return args == null ? NetworkSecurityGroupArgs.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()) .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 state * @param options Optional settings to control the behavior of the CustomResource. */ public static NetworkSecurityGroup get(java.lang.String name, Output id, @Nullable NetworkSecurityGroupState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { return new NetworkSecurityGroup(name, id, state, options); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy