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

com.pulumi.alicloud.vpc.RouteEntry Maven / Gradle / Ivy

There is a newer version: 3.63.0-alpha.1727424957
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.alicloud.vpc;

import com.pulumi.alicloud.Utilities;
import com.pulumi.alicloud.vpc.RouteEntryArgs;
import com.pulumi.alicloud.vpc.inputs.RouteEntryState;
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.Optional;
import javax.annotation.Nullable;

/**
 * Provides a route entry resource. A route entry represents a route item of one VPC route table.
 * 
 * ## Example Usage
 * 
 * Basic Usage
 * 
 * <!--Start PulumiCodeChooser -->
 * 
 * {@code
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.alicloud.AlicloudFunctions;
 * import com.pulumi.alicloud.inputs.GetZonesArgs;
 * import com.pulumi.alicloud.ecs.EcsFunctions;
 * import com.pulumi.alicloud.ecs.inputs.GetInstanceTypesArgs;
 * import com.pulumi.alicloud.ecs.inputs.GetImagesArgs;
 * import com.pulumi.alicloud.vpc.Network;
 * import com.pulumi.alicloud.vpc.NetworkArgs;
 * import com.pulumi.alicloud.vpc.Switch;
 * import com.pulumi.alicloud.vpc.SwitchArgs;
 * import com.pulumi.alicloud.ecs.SecurityGroup;
 * import com.pulumi.alicloud.ecs.SecurityGroupArgs;
 * import com.pulumi.alicloud.ecs.SecurityGroupRule;
 * import com.pulumi.alicloud.ecs.SecurityGroupRuleArgs;
 * import com.pulumi.alicloud.ecs.Instance;
 * import com.pulumi.alicloud.ecs.InstanceArgs;
 * import com.pulumi.alicloud.vpc.RouteEntry;
 * import com.pulumi.alicloud.vpc.RouteEntryArgs;
 * 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) {
 *         final var config = ctx.config();
 *         final var default = AlicloudFunctions.getZones(GetZonesArgs.builder()
 *             .availableResourceCreation("VSwitch")
 *             .build());
 * 
 *         final var defaultGetInstanceTypes = EcsFunctions.getInstanceTypes(GetInstanceTypesArgs.builder()
 *             .availabilityZone(default_.zones()[0].id())
 *             .cpuCoreCount(1)
 *             .memorySize(2)
 *             .build());
 * 
 *         final var defaultGetImages = EcsFunctions.getImages(GetImagesArgs.builder()
 *             .nameRegex("^ubuntu_18.*64")
 *             .mostRecent(true)
 *             .owners("system")
 *             .build());
 * 
 *         final var name = config.get("name").orElse("RouteEntryConfig");
 *         var foo = new Network("foo", NetworkArgs.builder()
 *             .vpcName(name)
 *             .cidrBlock("10.1.0.0/21")
 *             .build());
 * 
 *         var fooSwitch = new Switch("fooSwitch", SwitchArgs.builder()
 *             .vpcId(foo.id())
 *             .cidrBlock("10.1.1.0/24")
 *             .zoneId(default_.zones()[0].id())
 *             .vswitchName(name)
 *             .build());
 * 
 *         var tfTestFoo = new SecurityGroup("tfTestFoo", SecurityGroupArgs.builder()
 *             .name(name)
 *             .description("foo")
 *             .vpcId(foo.id())
 *             .build());
 * 
 *         var ingress = new SecurityGroupRule("ingress", SecurityGroupRuleArgs.builder()
 *             .type("ingress")
 *             .ipProtocol("tcp")
 *             .nicType("intranet")
 *             .policy("accept")
 *             .portRange("22/22")
 *             .priority(1)
 *             .securityGroupId(tfTestFoo.id())
 *             .cidrIp("0.0.0.0/0")
 *             .build());
 * 
 *         var fooInstance = new Instance("fooInstance", InstanceArgs.builder()
 *             .securityGroups(tfTestFoo.id())
 *             .vswitchId(fooSwitch.id())
 *             .instanceChargeType("PostPaid")
 *             .instanceType(defaultGetInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.instanceTypes()[0].id()))
 *             .internetChargeType("PayByTraffic")
 *             .internetMaxBandwidthOut(5)
 *             .systemDiskCategory("cloud_efficiency")
 *             .imageId(defaultGetImages.applyValue(getImagesResult -> getImagesResult.images()[0].id()))
 *             .instanceName(name)
 *             .build());
 * 
 *         var fooRouteEntry = new RouteEntry("fooRouteEntry", RouteEntryArgs.builder()
 *             .routeTableId(foo.routeTableId())
 *             .destinationCidrblock("172.11.1.1/32")
 *             .nexthopType("Instance")
 *             .nexthopId(fooInstance.id())
 *             .build());
 * 
 *     }
 * }
 * }
 * 
* <!--End PulumiCodeChooser --> * * ## Module Support * * You can use to the existing vpc module * to create a VPC, several VSwitches and add several route entries one-click. * * ## Import * * Router entry can be imported using the id, e.g (formatted as<route_table_id:router_id:destination_cidrblock:nexthop_type:nexthop_id>). * * ```sh * $ pulumi import alicloud:vpc/routeEntry:RouteEntry example vtb-123456:vrt-123456:0.0.0.0/0:NatGateway:ngw-123456 * ``` * */ @ResourceType(type="alicloud:vpc/routeEntry:RouteEntry") public class RouteEntry extends com.pulumi.resources.CustomResource { /** * The RouteEntry's target network segment. * */ @Export(name="destinationCidrblock", refs={String.class}, tree="[0]") private Output destinationCidrblock; /** * @return The RouteEntry's target network segment. * */ public Output> destinationCidrblock() { return Codegen.optional(this.destinationCidrblock); } /** * The name of the route entry. This name can have a string of 2 to 128 characters, must contain only alphanumeric characters or hyphens, such as "-",".","_", and must not begin or end with a hyphen, and must not begin with http:// or https://. * */ @Export(name="name", refs={String.class}, tree="[0]") private Output name; /** * @return The name of the route entry. This name can have a string of 2 to 128 characters, must contain only alphanumeric characters or hyphens, such as "-",".","_", and must not begin or end with a hyphen, and must not begin with http:// or https://. * */ public Output name() { return this.name; } /** * The route entry's next hop. ECS instance ID or VPC router interface ID. * */ @Export(name="nexthopId", refs={String.class}, tree="[0]") private Output nexthopId; /** * @return The route entry's next hop. ECS instance ID or VPC router interface ID. * */ public Output> nexthopId() { return Codegen.optional(this.nexthopId); } /** * The next hop type. Available values: * - `Instance` (Default): an Elastic Compute Service (ECS) instance. This is the default value. * - `RouterInterface`: a router interface. * - `VpnGateway`: a VPN Gateway. * - `HaVip`: a high-availability virtual IP address (HAVIP). * - `NetworkInterface`: an elastic network interface (ENI). * - `NatGateway`: a Nat Gateway. * - `IPv6Gateway`: an IPv6 gateway. * - `Attachment`: a transit router. * - `VpcPeer`: a VPC Peering Connection. * - `Ipv4Gateway` (Available in 1.193.0+): an IPv4 gateway. * */ @Export(name="nexthopType", refs={String.class}, tree="[0]") private Output nexthopType; /** * @return The next hop type. Available values: * - `Instance` (Default): an Elastic Compute Service (ECS) instance. This is the default value. * - `RouterInterface`: a router interface. * - `VpnGateway`: a VPN Gateway. * - `HaVip`: a high-availability virtual IP address (HAVIP). * - `NetworkInterface`: an elastic network interface (ENI). * - `NatGateway`: a Nat Gateway. * - `IPv6Gateway`: an IPv6 gateway. * - `Attachment`: a transit router. * - `VpcPeer`: a VPC Peering Connection. * - `Ipv4Gateway` (Available in 1.193.0+): an IPv4 gateway. * */ public Output> nexthopType() { return Codegen.optional(this.nexthopType); } /** * The ID of the route table. * */ @Export(name="routeTableId", refs={String.class}, tree="[0]") private Output routeTableId; /** * @return The ID of the route table. * */ public Output routeTableId() { return this.routeTableId; } /** * This argument has been deprecated. Please use other arguments to launch a custom route entry. * * @deprecated * Attribute router_id has been deprecated and suggest removing it from your template. * */ @Deprecated /* Attribute router_id has been deprecated and suggest removing it from your template. */ @Export(name="routerId", refs={String.class}, tree="[0]") private Output routerId; /** * @return This argument has been deprecated. Please use other arguments to launch a custom route entry. * */ public Output routerId() { return this.routerId; } /** * * @param name The _unique_ name of the resulting resource. */ public RouteEntry(java.lang.String name) { this(name, RouteEntryArgs.Empty); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. */ public RouteEntry(java.lang.String name, RouteEntryArgs 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 RouteEntry(java.lang.String name, RouteEntryArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("alicloud:vpc/routeEntry:RouteEntry", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false); } private RouteEntry(java.lang.String name, Output id, @Nullable RouteEntryState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("alicloud:vpc/routeEntry:RouteEntry", name, state, makeResourceOptions(options, id), false); } private static RouteEntryArgs makeArgs(RouteEntryArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { if (options != null && options.getUrn().isPresent()) { return null; } return args == null ? RouteEntryArgs.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 RouteEntry get(java.lang.String name, Output id, @Nullable RouteEntryState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { return new RouteEntry(name, id, state, options); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy