
com.pulumi.azurenative.network.Subnet 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.SubnetArgs;
import com.pulumi.azurenative.network.outputs.ApplicationGatewayIPConfigurationResponse;
import com.pulumi.azurenative.network.outputs.DelegationResponse;
import com.pulumi.azurenative.network.outputs.IPConfigurationProfileResponse;
import com.pulumi.azurenative.network.outputs.IPConfigurationResponse;
import com.pulumi.azurenative.network.outputs.NetworkSecurityGroupResponse;
import com.pulumi.azurenative.network.outputs.PrivateEndpointResponse;
import com.pulumi.azurenative.network.outputs.ResourceNavigationLinkResponse;
import com.pulumi.azurenative.network.outputs.RouteTableResponse;
import com.pulumi.azurenative.network.outputs.ServiceAssociationLinkResponse;
import com.pulumi.azurenative.network.outputs.ServiceEndpointPolicyResponse;
import com.pulumi.azurenative.network.outputs.ServiceEndpointPropertiesFormatResponse;
import com.pulumi.azurenative.network.outputs.SubResourceResponse;
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.String;
import java.util.List;
import java.util.Optional;
import javax.annotation.Nullable;
/**
* Subnet in a virtual network resource.
* Azure REST API version: 2023-02-01. Prior API version in Azure Native 1.x: 2020-11-01.
*
* Other available API versions: 2015-05-01-preview, 2016-03-30, 2019-02-01, 2019-06-01, 2019-08-01, 2020-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 subnet
*
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azurenative.network.Subnet;
* import com.pulumi.azurenative.network.SubnetArgs;
* 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 subnet = new Subnet("subnet", SubnetArgs.builder()
* .addressPrefix("10.0.0.0/16")
* .resourceGroupName("subnet-test")
* .subnetName("subnet1")
* .virtualNetworkName("vnetname")
* .build());
*
* }
* }
*
* }
*
* ### Create subnet with a delegation
*
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azurenative.network.Subnet;
* import com.pulumi.azurenative.network.SubnetArgs;
* 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 subnet = new Subnet("subnet", SubnetArgs.builder()
* .addressPrefix("10.0.0.0/16")
* .resourceGroupName("subnet-test")
* .subnetName("subnet1")
* .virtualNetworkName("vnetname")
* .build());
*
* }
* }
*
* }
*
* ### Create subnet with service endpoints
*
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azurenative.network.Subnet;
* import com.pulumi.azurenative.network.SubnetArgs;
* import com.pulumi.azurenative.network.inputs.ServiceEndpointPropertiesFormatArgs;
* 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 subnet = new Subnet("subnet", SubnetArgs.builder()
* .addressPrefix("10.0.0.0/16")
* .resourceGroupName("subnet-test")
* .serviceEndpoints(ServiceEndpointPropertiesFormatArgs.builder()
* .service("Microsoft.Storage")
* .build())
* .subnetName("subnet1")
* .virtualNetworkName("vnetname")
* .build());
*
* }
* }
*
* }
*
*
* ## Import
*
* An existing resource can be imported using its type token, name, and identifier, e.g.
*
* ```sh
* $ pulumi import azure-native:network:Subnet subnet1 /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}
* ```
*
*/
@ResourceType(type="azure-native:network:Subnet")
public class Subnet extends com.pulumi.resources.CustomResource {
/**
* The address prefix for the subnet.
*
*/
@Export(name="addressPrefix", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> addressPrefix;
/**
* @return The address prefix for the subnet.
*
*/
public Output> addressPrefix() {
return Codegen.optional(this.addressPrefix);
}
/**
* List of address prefixes for the subnet.
*
*/
@Export(name="addressPrefixes", refs={List.class,String.class}, tree="[0,1]")
private Output* @Nullable */ List> addressPrefixes;
/**
* @return List of address prefixes for the subnet.
*
*/
public Output>> addressPrefixes() {
return Codegen.optional(this.addressPrefixes);
}
/**
* Application gateway IP configurations of virtual network resource.
*
*/
@Export(name="applicationGatewayIPConfigurations", refs={List.class,ApplicationGatewayIPConfigurationResponse.class}, tree="[0,1]")
private Output* @Nullable */ List> applicationGatewayIPConfigurations;
/**
* @return Application gateway IP configurations of virtual network resource.
*
*/
public Output>> applicationGatewayIPConfigurations() {
return Codegen.optional(this.applicationGatewayIPConfigurations);
}
/**
* An array of references to the delegations on the subnet.
*
*/
@Export(name="delegations", refs={List.class,DelegationResponse.class}, tree="[0,1]")
private Output* @Nullable */ List> delegations;
/**
* @return An array of references to the delegations on the subnet.
*
*/
public Output>> delegations() {
return Codegen.optional(this.delegations);
}
/**
* 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;
}
/**
* Array of IpAllocation which reference this subnet.
*
*/
@Export(name="ipAllocations", refs={List.class,SubResourceResponse.class}, tree="[0,1]")
private Output* @Nullable */ List> ipAllocations;
/**
* @return Array of IpAllocation which reference this subnet.
*
*/
public Output>> ipAllocations() {
return Codegen.optional(this.ipAllocations);
}
/**
* Array of IP configuration profiles which reference this subnet.
*
*/
@Export(name="ipConfigurationProfiles", refs={List.class,IPConfigurationProfileResponse.class}, tree="[0,1]")
private Output> ipConfigurationProfiles;
/**
* @return Array of IP configuration profiles which reference this subnet.
*
*/
public Output> ipConfigurationProfiles() {
return this.ipConfigurationProfiles;
}
/**
* An array of references to the network interface IP configurations using subnet.
*
*/
@Export(name="ipConfigurations", refs={List.class,IPConfigurationResponse.class}, tree="[0,1]")
private Output> ipConfigurations;
/**
* @return An array of references to the network interface IP configurations using subnet.
*
*/
public Output> ipConfigurations() {
return this.ipConfigurations;
}
/**
* 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);
}
/**
* Nat gateway associated with this subnet.
*
*/
@Export(name="natGateway", refs={SubResourceResponse.class}, tree="[0]")
private Output* @Nullable */ SubResourceResponse> natGateway;
/**
* @return Nat gateway associated with this subnet.
*
*/
public Output> natGateway() {
return Codegen.optional(this.natGateway);
}
/**
* The reference to the NetworkSecurityGroup resource.
*
*/
@Export(name="networkSecurityGroup", refs={NetworkSecurityGroupResponse.class}, tree="[0]")
private Output* @Nullable */ NetworkSecurityGroupResponse> networkSecurityGroup;
/**
* @return The reference to the NetworkSecurityGroup resource.
*
*/
public Output> networkSecurityGroup() {
return Codegen.optional(this.networkSecurityGroup);
}
/**
* Enable or Disable apply network policies on private end point in the subnet.
*
*/
@Export(name="privateEndpointNetworkPolicies", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> privateEndpointNetworkPolicies;
/**
* @return Enable or Disable apply network policies on private end point in the subnet.
*
*/
public Output> privateEndpointNetworkPolicies() {
return Codegen.optional(this.privateEndpointNetworkPolicies);
}
/**
* An array of references to private endpoints.
*
*/
@Export(name="privateEndpoints", refs={List.class,PrivateEndpointResponse.class}, tree="[0,1]")
private Output> privateEndpoints;
/**
* @return An array of references to private endpoints.
*
*/
public Output> privateEndpoints() {
return this.privateEndpoints;
}
/**
* Enable or Disable apply network policies on private link service in the subnet.
*
*/
@Export(name="privateLinkServiceNetworkPolicies", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> privateLinkServiceNetworkPolicies;
/**
* @return Enable or Disable apply network policies on private link service in the subnet.
*
*/
public Output> privateLinkServiceNetworkPolicies() {
return Codegen.optional(this.privateLinkServiceNetworkPolicies);
}
/**
* The provisioning state of the subnet resource.
*
*/
@Export(name="provisioningState", refs={String.class}, tree="[0]")
private Output provisioningState;
/**
* @return The provisioning state of the subnet resource.
*
*/
public Output provisioningState() {
return this.provisioningState;
}
/**
* A read-only string identifying the intention of use for this subnet based on delegations and other user-defined properties.
*
*/
@Export(name="purpose", refs={String.class}, tree="[0]")
private Output purpose;
/**
* @return A read-only string identifying the intention of use for this subnet based on delegations and other user-defined properties.
*
*/
public Output purpose() {
return this.purpose;
}
/**
* An array of references to the external resources using subnet.
*
*/
@Export(name="resourceNavigationLinks", refs={List.class,ResourceNavigationLinkResponse.class}, tree="[0,1]")
private Output> resourceNavigationLinks;
/**
* @return An array of references to the external resources using subnet.
*
*/
public Output> resourceNavigationLinks() {
return this.resourceNavigationLinks;
}
/**
* The reference to the RouteTable resource.
*
*/
@Export(name="routeTable", refs={RouteTableResponse.class}, tree="[0]")
private Output* @Nullable */ RouteTableResponse> routeTable;
/**
* @return The reference to the RouteTable resource.
*
*/
public Output> routeTable() {
return Codegen.optional(this.routeTable);
}
/**
* An array of references to services injecting into this subnet.
*
*/
@Export(name="serviceAssociationLinks", refs={List.class,ServiceAssociationLinkResponse.class}, tree="[0,1]")
private Output> serviceAssociationLinks;
/**
* @return An array of references to services injecting into this subnet.
*
*/
public Output> serviceAssociationLinks() {
return this.serviceAssociationLinks;
}
/**
* An array of service endpoint policies.
*
*/
@Export(name="serviceEndpointPolicies", refs={List.class,ServiceEndpointPolicyResponse.class}, tree="[0,1]")
private Output* @Nullable */ List> serviceEndpointPolicies;
/**
* @return An array of service endpoint policies.
*
*/
public Output>> serviceEndpointPolicies() {
return Codegen.optional(this.serviceEndpointPolicies);
}
/**
* An array of service endpoints.
*
*/
@Export(name="serviceEndpoints", refs={List.class,ServiceEndpointPropertiesFormatResponse.class}, tree="[0,1]")
private Output* @Nullable */ List> serviceEndpoints;
/**
* @return An array of service endpoints.
*
*/
public Output>> serviceEndpoints() {
return Codegen.optional(this.serviceEndpoints);
}
/**
* Resource type.
*
*/
@Export(name="type", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> type;
/**
* @return Resource type.
*
*/
public Output> type() {
return Codegen.optional(this.type);
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public Subnet(java.lang.String name) {
this(name, SubnetArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public Subnet(java.lang.String name, SubnetArgs 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 Subnet(java.lang.String name, SubnetArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure-native:network:Subnet", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private Subnet(java.lang.String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure-native:network:Subnet", name, null, makeResourceOptions(options, id), false);
}
private static SubnetArgs makeArgs(SubnetArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? SubnetArgs.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:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20150615:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20160330:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20160601:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20160901:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20161201:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20170301:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20170601:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20170801:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20170901:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20171001:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20171101:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20180101:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20180201:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20180401:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20180601:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20180701:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20180801:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20181001:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20181101:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20181201:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20190201:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20190401:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20190601:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20190701:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20190801:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20190901:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20191101:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20191201:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20200301:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20200401:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20200501:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20200601:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20200701:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20200801:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20201101:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20210201:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20210301:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20210501:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20210801:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20220101:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20220501:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20220701:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20220901:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20221101:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20230201:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20230401:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20230501:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20230601:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20230901:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20231101:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20240101:Subnet").build()),
Output.of(Alias.builder().type("azure-native:network/v20240301:Subnet").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 Subnet get(java.lang.String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new Subnet(name, id, options);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy