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

com.pulumi.alicloud.eipanycast.AnycastEipAddressAttachment 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.eipanycast;

import com.pulumi.alicloud.Utilities;
import com.pulumi.alicloud.eipanycast.AnycastEipAddressAttachmentArgs;
import com.pulumi.alicloud.eipanycast.inputs.AnycastEipAddressAttachmentState;
import com.pulumi.alicloud.eipanycast.outputs.AnycastEipAddressAttachmentPopLocation;
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;

/**
 * Provides a Eipanycast Anycast Eip Address Attachment resource.
 * 
 * For information about Eipanycast Anycast Eip Address Attachment and how to use it, see [What is Anycast Eip Address Attachment](https://www.alibabacloud.com/help/en/anycast-eip/latest/api-eipanycast-2020-03-09-associateanycasteipaddress).
 * 
 * > **NOTE:** Available since v1.113.0.
 * 
 * > **NOTE:** The following regions support currently while Slb instance support bound.
 * [eu-west-1-gb33-a01,cn-hongkong-am4-c04,ap-southeast-os30-a01,us-west-ot7-a01,ap-south-in73-a01,ap-southeast-my88-a01]
 * 
 * ## 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.slb.SlbFunctions;
 * import com.pulumi.alicloud.slb.inputs.GetZonesArgs;
 * 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.slb.ApplicationLoadBalancer;
 * import com.pulumi.alicloud.slb.ApplicationLoadBalancerArgs;
 * import com.pulumi.alicloud.eipanycast.AnycastEipAddress;
 * import com.pulumi.alicloud.eipanycast.AnycastEipAddressArgs;
 * import com.pulumi.alicloud.AlicloudFunctions;
 * import com.pulumi.alicloud.inputs.GetRegionsArgs;
 * import com.pulumi.alicloud.eipanycast.AnycastEipAddressAttachment;
 * import com.pulumi.alicloud.eipanycast.AnycastEipAddressAttachmentArgs;
 * 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 name = config.get("name").orElse("terraform-example");
 *         final var default = SlbFunctions.getZones(GetZonesArgs.builder()
 *             .availableSlbAddressType("vpc")
 *             .build());
 * 
 *         var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
 *             .vpcName(name)
 *             .cidrBlock("10.0.0.0/8")
 *             .build());
 * 
 *         var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
 *             .vswitchName(name)
 *             .cidrBlock("10.1.0.0/16")
 *             .vpcId(defaultNetwork.id())
 *             .zoneId(default_.zones()[0].id())
 *             .build());
 * 
 *         var defaultApplicationLoadBalancer = new ApplicationLoadBalancer("defaultApplicationLoadBalancer", ApplicationLoadBalancerArgs.builder()
 *             .addressType("intranet")
 *             .vswitchId(defaultSwitch.id())
 *             .loadBalancerName(name)
 *             .loadBalancerSpec("slb.s1.small")
 *             .masterZoneId(default_.zones()[0].id())
 *             .build());
 * 
 *         var defaultAnycastEipAddress = new AnycastEipAddress("defaultAnycastEipAddress", AnycastEipAddressArgs.builder()
 *             .anycastEipAddressName(name)
 *             .serviceLocation("ChineseMainland")
 *             .build());
 * 
 *         final var defaultGetRegions = AlicloudFunctions.getRegions(GetRegionsArgs.builder()
 *             .current(true)
 *             .build());
 * 
 *         var defaultAnycastEipAddressAttachment = new AnycastEipAddressAttachment("defaultAnycastEipAddressAttachment", AnycastEipAddressAttachmentArgs.builder()
 *             .bindInstanceId(defaultApplicationLoadBalancer.id())
 *             .bindInstanceType("SlbInstance")
 *             .bindInstanceRegionId(defaultGetRegions.applyValue(getRegionsResult -> getRegionsResult.regions()[0].id()))
 *             .anycastId(defaultAnycastEipAddress.id())
 *             .build());
 * 
 *     }
 * }
 * }
 * 
* <!--End PulumiCodeChooser --> * * Multiple Usage * * > **NOTE:** Anycast EIP supports binding cloud resource instances in multiple regions. Only one cloud resource instance is supported as the default origin station, and the rest are normal origin stations. When no access point is specified or an access point is added, the access request is forwarded to the default origin by default. If you are bound for the first time, the Default value of the binding mode is **Default * *. /li> li> If you are not binding for the first time, you can set the binding mode to **Default**, and the new Default origin will take effect. The original Default origin will be changed to a common origin. * * <!--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.GetImagesArgs;
 * import com.pulumi.alicloud.ecs.inputs.GetInstanceTypesArgs;
 * 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.Instance;
 * import com.pulumi.alicloud.ecs.InstanceArgs;
 * import com.pulumi.alicloud.eipanycast.AnycastEipAddress;
 * import com.pulumi.alicloud.eipanycast.AnycastEipAddressArgs;
 * import com.pulumi.alicloud.eipanycast.AnycastEipAddressAttachment;
 * import com.pulumi.alicloud.eipanycast.AnycastEipAddressAttachmentArgs;
 * 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 name = config.get("name").orElse("tf-example");
 *         final var default = AlicloudFunctions.getZones(GetZonesArgs.builder()
 *             .availableDiskCategory("cloud_efficiency")
 *             .availableResourceCreation("VSwitch")
 *             .build());
 * 
 *         final var defaultGetImages = EcsFunctions.getImages(GetImagesArgs.builder()
 *             .nameRegex("^ubuntu_18.*64")
 *             .mostRecent(true)
 *             .owners("system")
 *             .build());
 * 
 *         final var defaultGetInstanceTypes = EcsFunctions.getInstanceTypes(GetInstanceTypesArgs.builder()
 *             .availabilityZone(default_.zones()[0].id())
 *             .cpuCoreCount(1)
 *             .memorySize(2)
 *             .build());
 * 
 *         var defaultVpc = new Network("defaultVpc", NetworkArgs.builder()
 *             .vpcName(name)
 *             .cidrBlock("192.168.0.0/16")
 *             .build());
 * 
 *         var defaultVsw = new Switch("defaultVsw", SwitchArgs.builder()
 *             .vpcId(defaultVpc.id())
 *             .cidrBlock("192.168.0.0/24")
 *             .zoneId(default_.zones()[0].id())
 *             .build());
 * 
 *         var defaultuBsECI = new SecurityGroup("defaultuBsECI", SecurityGroupArgs.builder()
 *             .vpcId(defaultVpc.id())
 *             .build());
 * 
 *         var default9KDlN7 = new Instance("default9KDlN7", InstanceArgs.builder()
 *             .imageId(defaultGetImages.applyValue(getImagesResult -> getImagesResult.images()[0].id()))
 *             .instanceType(defaultGetInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.instanceTypes()[0].id()))
 *             .instanceName(name)
 *             .securityGroups(defaultuBsECI.id())
 *             .availabilityZone(defaultVsw.zoneId())
 *             .instanceChargeType("PostPaid")
 *             .systemDiskCategory("cloud_efficiency")
 *             .vswitchId(defaultVsw.id())
 *             .build());
 * 
 *         var defaultXkpFRs = new AnycastEipAddress("defaultXkpFRs", AnycastEipAddressArgs.builder()
 *             .serviceLocation("ChineseMainland")
 *             .build());
 * 
 *         var defaultVpc2 = new Network("defaultVpc2", NetworkArgs.builder()
 *             .vpcName(String.format("%s6", name))
 *             .cidrBlock("192.168.0.0/16")
 *             .build());
 * 
 *         final var default2 = AlicloudFunctions.getZones(GetZonesArgs.builder()
 *             .availableDiskCategory("cloud_efficiency")
 *             .availableResourceCreation("VSwitch")
 *             .build());
 * 
 *         final var default2GetImages = EcsFunctions.getImages(GetImagesArgs.builder()
 *             .nameRegex("^ubuntu_18.*64")
 *             .mostRecent(true)
 *             .owners("system")
 *             .build());
 * 
 *         final var default2GetInstanceTypes = EcsFunctions.getInstanceTypes(GetInstanceTypesArgs.builder()
 *             .availabilityZone(default2.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
 *             .cpuCoreCount(1)
 *             .memorySize(2)
 *             .build());
 * 
 *         var defaultdsVsw2 = new Switch("defaultdsVsw2", SwitchArgs.builder()
 *             .vpcId(defaultVpc2.id())
 *             .cidrBlock("192.168.0.0/24")
 *             .zoneId(default2.applyValue(getZonesResult -> getZonesResult.zones()[1].id()))
 *             .build());
 * 
 *         var defaultuBsECI2 = new SecurityGroup("defaultuBsECI2", SecurityGroupArgs.builder()
 *             .vpcId(defaultVpc2.id())
 *             .build());
 * 
 *         var defaultEcs2 = new Instance("defaultEcs2", InstanceArgs.builder()
 *             .imageId(default2GetImages.applyValue(getImagesResult -> getImagesResult.images()[0].id()))
 *             .instanceType(default2GetInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.instanceTypes()[0].id()))
 *             .instanceName(name)
 *             .securityGroups(defaultuBsECI2.id())
 *             .availabilityZone(defaultdsVsw2.zoneId())
 *             .instanceChargeType("PostPaid")
 *             .systemDiskCategory("cloud_efficiency")
 *             .vswitchId(defaultdsVsw2.id())
 *             .build());
 * 
 *         var defaultEfYBJY = new AnycastEipAddressAttachment("defaultEfYBJY", AnycastEipAddressAttachmentArgs.builder()
 *             .bindInstanceId(default9KDlN7.networkInterfaceId())
 *             .bindInstanceType("NetworkInterface")
 *             .bindInstanceRegionId("cn-beijing")
 *             .anycastId(defaultXkpFRs.id())
 *             .associationMode("Default")
 *             .build());
 * 
 *         var normal = new AnycastEipAddressAttachment("normal", AnycastEipAddressAttachmentArgs.builder()
 *             .bindInstanceId(defaultEcs2.networkInterfaceId())
 *             .bindInstanceType("NetworkInterface")
 *             .bindInstanceRegionId("cn-hangzhou")
 *             .anycastId(defaultEfYBJY.anycastId())
 *             .build());
 * 
 *     }
 * }
 * }
 * 
* <!--End PulumiCodeChooser --> * * ## Import * * Eipanycast Anycast Eip Address Attachment can be imported using the id, e.g. * * ```sh * $ pulumi import alicloud:eipanycast/anycastEipAddressAttachment:AnycastEipAddressAttachment example <anycast_id>:<bind_instance_id>:<bind_instance_region_id>:<bind_instance_type> * ``` * */ @ResourceType(type="alicloud:eipanycast/anycastEipAddressAttachment:AnycastEipAddressAttachment") public class AnycastEipAddressAttachment extends com.pulumi.resources.CustomResource { /** * The ID of the Anycast EIP instance. * */ @Export(name="anycastId", refs={String.class}, tree="[0]") private Output anycastId; /** * @return The ID of the Anycast EIP instance. * */ public Output anycastId() { return this.anycastId; } /** * Binding mode, value: * - **Default**: The Default mode. The cloud resource instance to be bound is set as the Default origin. * - **Normal**: In Normal mode, the cloud resource instance to be bound is set to the common source station. * */ @Export(name="associationMode", refs={String.class}, tree="[0]") private Output associationMode; /** * @return Binding mode, value: * - **Default**: The Default mode. The cloud resource instance to be bound is set as the Default origin. * - **Normal**: In Normal mode, the cloud resource instance to be bound is set to the common source station. * */ public Output associationMode() { return this.associationMode; } /** * The ID of the cloud resource instance to be bound. * */ @Export(name="bindInstanceId", refs={String.class}, tree="[0]") private Output bindInstanceId; /** * @return The ID of the cloud resource instance to be bound. * */ public Output bindInstanceId() { return this.bindInstanceId; } /** * The region ID of the cloud resource instance to be bound.You can only bind cloud resource instances in some regions. You can call the describeanystserverregions operation to obtain the region ID of the cloud resource instances that can be bound. * */ @Export(name="bindInstanceRegionId", refs={String.class}, tree="[0]") private Output bindInstanceRegionId; /** * @return The region ID of the cloud resource instance to be bound.You can only bind cloud resource instances in some regions. You can call the describeanystserverregions operation to obtain the region ID of the cloud resource instances that can be bound. * */ public Output bindInstanceRegionId() { return this.bindInstanceRegionId; } /** * The type of the cloud resource instance to be bound. Value: * - **SlbInstance**: a private network SLB instance. * - **NetworkInterface**: ENI. * */ @Export(name="bindInstanceType", refs={String.class}, tree="[0]") private Output bindInstanceType; /** * @return The type of the cloud resource instance to be bound. Value: * - **SlbInstance**: a private network SLB instance. * - **NetworkInterface**: ENI. * */ public Output bindInstanceType() { return this.bindInstanceType; } /** * Binding time.Time is expressed according to ISO8601 standard and UTC time is used. The format is: 'YYYY-MM-DDThh:mm:ssZ'. * */ @Export(name="bindTime", refs={String.class}, tree="[0]") private Output bindTime; /** * @return Binding time.Time is expressed according to ISO8601 standard and UTC time is used. The format is: 'YYYY-MM-DDThh:mm:ssZ'. * */ public Output bindTime() { return this.bindTime; } /** * The access point information of the associated access area when the cloud resource instance is bound.If you are binding for the first time, this parameter does not need to be configured, and the system automatically associates all access areas. See `pop_locations` below. * */ @Export(name="popLocations", refs={List.class,AnycastEipAddressAttachmentPopLocation.class}, tree="[0,1]") private Output> popLocations; /** * @return The access point information of the associated access area when the cloud resource instance is bound.If you are binding for the first time, this parameter does not need to be configured, and the system automatically associates all access areas. See `pop_locations` below. * */ public Output>> popLocations() { return Codegen.optional(this.popLocations); } /** * The secondary private IP address of the elastic network card to be bound.This parameter takes effect only when **BindInstanceType** is set to **NetworkInterface. When you do not enter, this parameter is the primary private IP of the ENI by default. * */ @Export(name="privateIpAddress", refs={String.class}, tree="[0]") private Output privateIpAddress; /** * @return The secondary private IP address of the elastic network card to be bound.This parameter takes effect only when **BindInstanceType** is set to **NetworkInterface. When you do not enter, this parameter is the primary private IP of the ENI by default. * */ public Output> privateIpAddress() { return Codegen.optional(this.privateIpAddress); } /** * The status of the bound cloud resource instance. Value:BINDING: BINDING.Bound: Bound.UNBINDING: UNBINDING.DELETED: DELETED.MODIFYING: being modified. * */ @Export(name="status", refs={String.class}, tree="[0]") private Output status; /** * @return The status of the bound cloud resource instance. Value:BINDING: BINDING.Bound: Bound.UNBINDING: UNBINDING.DELETED: DELETED.MODIFYING: being modified. * */ public Output status() { return this.status; } /** * * @param name The _unique_ name of the resulting resource. */ public AnycastEipAddressAttachment(java.lang.String name) { this(name, AnycastEipAddressAttachmentArgs.Empty); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. */ public AnycastEipAddressAttachment(java.lang.String name, AnycastEipAddressAttachmentArgs 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 AnycastEipAddressAttachment(java.lang.String name, AnycastEipAddressAttachmentArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("alicloud:eipanycast/anycastEipAddressAttachment:AnycastEipAddressAttachment", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false); } private AnycastEipAddressAttachment(java.lang.String name, Output id, @Nullable AnycastEipAddressAttachmentState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("alicloud:eipanycast/anycastEipAddressAttachment:AnycastEipAddressAttachment", name, state, makeResourceOptions(options, id), false); } private static AnycastEipAddressAttachmentArgs makeArgs(AnycastEipAddressAttachmentArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { if (options != null && options.getUrn().isPresent()) { return null; } return args == null ? AnycastEipAddressAttachmentArgs.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 AnycastEipAddressAttachment get(java.lang.String name, Output id, @Nullable AnycastEipAddressAttachmentState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { return new AnycastEipAddressAttachment(name, id, state, options); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy