com.pulumi.alicloud.ess.Notification Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of alicloud Show documentation
Show all versions of alicloud Show documentation
A Pulumi package for creating and managing AliCloud 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.alicloud.ess;
import com.pulumi.alicloud.Utilities;
import com.pulumi.alicloud.ess.NotificationArgs;
import com.pulumi.alicloud.ess.inputs.NotificationState;
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 javax.annotation.Nullable;
/**
* Provides a ESS notification resource. More about Ess notification, see [Autoscaling Notification](https://www.alibabacloud.com/help/doc-detail/71114.htm).
*
* > **NOTE:** Available since v1.55.0.
*
* ## Example Usage
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.random.integer;
* import com.pulumi.random.IntegerArgs;
* import com.pulumi.alicloud.AlicloudFunctions;
* import com.pulumi.alicloud.inputs.GetRegionsArgs;
* import com.pulumi.alicloud.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.ess.ScalingGroup;
* import com.pulumi.alicloud.ess.ScalingGroupArgs;
* import com.pulumi.alicloud.mns.Queue;
* import com.pulumi.alicloud.mns.QueueArgs;
* import com.pulumi.alicloud.ess.Notification;
* import com.pulumi.alicloud.ess.NotificationArgs;
* 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");
* var defaultInteger = new Integer("defaultInteger", IntegerArgs.builder()
* .min(10000)
* .max(99999)
* .build());
*
* final var myName = String.format("%s-%s", name,defaultInteger.result());
*
* final var default = AlicloudFunctions.getRegions(GetRegionsArgs.builder()
* .current(true)
* .build());
*
* final var defaultGetAccount = AlicloudFunctions.getAccount();
*
* final var defaultGetZones = AlicloudFunctions.getZones(GetZonesArgs.builder()
* .availableDiskCategory("cloud_efficiency")
* .availableResourceCreation("VSwitch")
* .build());
*
* var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
* .vpcName(myName)
* .cidrBlock("172.16.0.0/16")
* .build());
*
* var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
* .vpcId(defaultNetwork.id())
* .cidrBlock("172.16.0.0/24")
* .zoneId(defaultGetZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
* .vswitchName(myName)
* .build());
*
* var defaultScalingGroup = new ScalingGroup("defaultScalingGroup", ScalingGroupArgs.builder()
* .minSize(1)
* .maxSize(1)
* .scalingGroupName(myName)
* .removalPolicies(
* "OldestInstance",
* "NewestInstance")
* .vswitchIds(defaultSwitch.id())
* .build());
*
* var defaultQueue = new Queue("defaultQueue", QueueArgs.builder()
* .name(myName)
* .build());
*
* var defaultNotification = new Notification("defaultNotification", NotificationArgs.builder()
* .scalingGroupId(defaultScalingGroup.id())
* .notificationTypes(
* "AUTOSCALING:SCALE_OUT_SUCCESS",
* "AUTOSCALING:SCALE_OUT_ERROR")
* .notificationArn(defaultQueue.name().applyValue(name -> String.format("acs:ess:%s:%s:queue/%s", default_.regions()[0].id(),defaultGetAccount.applyValue(getAccountResult -> getAccountResult.id()),name)))
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* Ess notification can be imported using the id, e.g.
*
* ```sh
* $ pulumi import alicloud:ess/notification:Notification example 'scaling_group_id:notification_arn'
* ```
*
*/
@ResourceType(type="alicloud:ess/notification:Notification")
public class Notification extends com.pulumi.resources.CustomResource {
/**
* The Alibaba Cloud Resource Name (ARN) of the notification object, The value must be in `acs:ess:{region}:{account-id}:{resource-relative-id}` format.
* * region: the region ID of the scaling group. For more information, see `Regions and zones`
* * account-id: the ID of your account.
* * resource-relative-id: the notification method. Valid values : `cloudmonitor`, MNS queue: `queue/{queuename}`, Replace the queuename with the specific MNS queue name, MNS topic: `topic/{topicname}`, Replace the topicname with the specific MNS topic name.
*
*/
@Export(name="notificationArn", refs={String.class}, tree="[0]")
private Output notificationArn;
/**
* @return The Alibaba Cloud Resource Name (ARN) of the notification object, The value must be in `acs:ess:{region}:{account-id}:{resource-relative-id}` format.
* * region: the region ID of the scaling group. For more information, see `Regions and zones`
* * account-id: the ID of your account.
* * resource-relative-id: the notification method. Valid values : `cloudmonitor`, MNS queue: `queue/{queuename}`, Replace the queuename with the specific MNS queue name, MNS topic: `topic/{topicname}`, Replace the topicname with the specific MNS topic name.
*
*/
public Output notificationArn() {
return this.notificationArn;
}
/**
* The notification types of Auto Scaling events and resource changes. Supported notification types: 'AUTOSCALING:SCALE_OUT_SUCCESS', 'AUTOSCALING:SCALE_IN_SUCCESS', 'AUTOSCALING:SCALE_OUT_ERROR', 'AUTOSCALING:SCALE_IN_ERROR', 'AUTOSCALING:SCALE_REJECT', 'AUTOSCALING:SCALE_OUT_START', 'AUTOSCALING:SCALE_IN_START', 'AUTOSCALING:SCHEDULE_TASK_EXPIRING'.
*
*/
@Export(name="notificationTypes", refs={List.class,String.class}, tree="[0,1]")
private Output> notificationTypes;
/**
* @return The notification types of Auto Scaling events and resource changes. Supported notification types: 'AUTOSCALING:SCALE_OUT_SUCCESS', 'AUTOSCALING:SCALE_IN_SUCCESS', 'AUTOSCALING:SCALE_OUT_ERROR', 'AUTOSCALING:SCALE_IN_ERROR', 'AUTOSCALING:SCALE_REJECT', 'AUTOSCALING:SCALE_OUT_START', 'AUTOSCALING:SCALE_IN_START', 'AUTOSCALING:SCHEDULE_TASK_EXPIRING'.
*
*/
public Output> notificationTypes() {
return this.notificationTypes;
}
/**
* The ID of the Auto Scaling group.
*
*/
@Export(name="scalingGroupId", refs={String.class}, tree="[0]")
private Output scalingGroupId;
/**
* @return The ID of the Auto Scaling group.
*
*/
public Output scalingGroupId() {
return this.scalingGroupId;
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public Notification(java.lang.String name) {
this(name, NotificationArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public Notification(java.lang.String name, NotificationArgs 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 Notification(java.lang.String name, NotificationArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("alicloud:ess/notification:Notification", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private Notification(java.lang.String name, Output id, @Nullable NotificationState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("alicloud:ess/notification:Notification", name, state, makeResourceOptions(options, id), false);
}
private static NotificationArgs makeArgs(NotificationArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? NotificationArgs.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 Notification get(java.lang.String name, Output id, @Nullable NotificationState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new Notification(name, id, state, options);
}
}