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

com.pulumi.alicloud.ess.Alarm 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.ess;

import com.pulumi.alicloud.Utilities;
import com.pulumi.alicloud.ess.AlarmArgs;
import com.pulumi.alicloud.ess.inputs.AlarmState;
import com.pulumi.alicloud.ess.outputs.AlarmExpression;
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.Boolean;
import java.lang.Integer;
import java.lang.String;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * Provides a ESS alarm task resource.
 * 
 * For information about ess alarm, see [CreateAlarm](https://www.alibabacloud.com/help/en/auto-scaling/latest/createalarm).
 * 
 * > **NOTE:** Available since v1.15.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.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.ess.ScalingGroup;
 * import com.pulumi.alicloud.ess.ScalingGroupArgs;
 * import com.pulumi.alicloud.ess.ScalingRule;
 * import com.pulumi.alicloud.ess.ScalingRuleArgs;
 * import com.pulumi.alicloud.ess.Alarm;
 * import com.pulumi.alicloud.ess.AlarmArgs;
 * 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.getZones(GetZonesArgs.builder()
 *             .availableDiskCategory("cloud_efficiency")
 *             .availableResourceCreation("VSwitch")
 *             .build());
 * 
 *         final var defaultGetInstanceTypes = EcsFunctions.getInstanceTypes(GetInstanceTypesArgs.builder()
 *             .availabilityZone(default_.zones()[0].id())
 *             .cpuCoreCount(2)
 *             .memorySize(4)
 *             .build());
 * 
 *         final var defaultGetImages = EcsFunctions.getImages(GetImagesArgs.builder()
 *             .nameRegex("^ubuntu_18.*64")
 *             .mostRecent(true)
 *             .owners("system")
 *             .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(default_.zones()[0].id())
 *             .vswitchName(myName)
 *             .build());
 * 
 *         var defaultSecurityGroup = new SecurityGroup("defaultSecurityGroup", SecurityGroupArgs.builder()
 *             .name(myName)
 *             .vpcId(defaultNetwork.id())
 *             .build());
 * 
 *         var defaultSecurityGroupRule = new SecurityGroupRule("defaultSecurityGroupRule", SecurityGroupRuleArgs.builder()
 *             .type("ingress")
 *             .ipProtocol("tcp")
 *             .nicType("intranet")
 *             .policy("accept")
 *             .portRange("22/22")
 *             .priority(1)
 *             .securityGroupId(defaultSecurityGroup.id())
 *             .cidrIp("172.16.0.0/24")
 *             .build());
 * 
 *         var default2 = new Switch("default2", SwitchArgs.builder()
 *             .vpcId(defaultNetwork.id())
 *             .cidrBlock("172.16.1.0/24")
 *             .zoneId(default_.zones()[0].id())
 *             .vswitchName(String.format("%s-bar", name))
 *             .build());
 * 
 *         var defaultScalingGroup = new ScalingGroup("defaultScalingGroup", ScalingGroupArgs.builder()
 *             .minSize(1)
 *             .maxSize(1)
 *             .scalingGroupName(myName)
 *             .defaultCooldown(20)
 *             .vswitchIds(            
 *                 defaultSwitch.id(),
 *                 default2.id())
 *             .removalPolicies(            
 *                 "OldestInstance",
 *                 "NewestInstance")
 *             .build());
 * 
 *         var defaultScalingRule = new ScalingRule("defaultScalingRule", ScalingRuleArgs.builder()
 *             .scalingRuleName(myName)
 *             .scalingGroupId(defaultScalingGroup.id())
 *             .adjustmentType("TotalCapacity")
 *             .adjustmentValue(2)
 *             .cooldown(60)
 *             .build());
 * 
 *         var defaultAlarm = new Alarm("defaultAlarm", AlarmArgs.builder()
 *             .name(myName)
 *             .description(name)
 *             .alarmActions(defaultScalingRule.ari())
 *             .scalingGroupId(defaultScalingGroup.id())
 *             .metricType("system")
 *             .metricName("CpuUtilization")
 *             .period(300)
 *             .statistics("Average")
 *             .threshold(200.3)
 *             .comparisonOperator(">=")
 *             .evaluationCount(2)
 *             .build());
 * 
 *     }
 * }
 * }
 * 
* <!--End PulumiCodeChooser --> * * ## Module Support * * You can use to the existing autoscaling-rule module * to create alarm task, different type rules and scheduled task one-click. * * ## Import * * Ess alarm can be imported using the id, e.g. * * ```sh * $ pulumi import alicloud:ess/alarm:Alarm example asg-2ze500_045efffe-4d05 * ``` * */ @ResourceType(type="alicloud:ess/alarm:Alarm") public class Alarm extends com.pulumi.resources.CustomResource { /** * The list of actions to execute when this alarm transition into an ALARM state. Each action is specified as ess scaling rule ari. * */ @Export(name="alarmActions", refs={List.class,String.class}, tree="[0,1]") private Output> alarmActions; /** * @return The list of actions to execute when this alarm transition into an ALARM state. Each action is specified as ess scaling rule ari. * */ public Output> alarmActions() { return this.alarmActions; } /** * Defines the application group id defined by CMS which is assigned when you upload custom metric to CMS, only available for custom metirc. * */ @Export(name="cloudMonitorGroupId", refs={Integer.class}, tree="[0]") private Output cloudMonitorGroupId; /** * @return Defines the application group id defined by CMS which is assigned when you upload custom metric to CMS, only available for custom metirc. * */ public Output> cloudMonitorGroupId() { return Codegen.optional(this.cloudMonitorGroupId); } /** * The arithmetic operation to use when comparing the specified Statistic and Threshold. The specified Statistic value is used as the first operand. Supported value: >=, <=, >, <. Defaults to >=. * */ @Export(name="comparisonOperator", refs={String.class}, tree="[0]") private Output comparisonOperator; /** * @return The arithmetic operation to use when comparing the specified Statistic and Threshold. The specified Statistic value is used as the first operand. Supported value: >=, <=, >, <. Defaults to >=. * */ public Output comparisonOperator() { return this.comparisonOperator; } /** * The description for the alarm. * */ @Export(name="description", refs={String.class}, tree="[0]") private Output description; /** * @return The description for the alarm. * */ public Output> description() { return Codegen.optional(this.description); } /** * The dimension map for the alarm's associated metric. For all metrics, you can not set the dimension key as "scaling_group" or "userId", which is set by default, the second dimension for metric, such as "device" for "PackagesNetIn", need to be set by users. See `dimensions` below. * */ @Export(name="dimensions", refs={Map.class,String.class}, tree="[0,1,1]") private Output> dimensions; /** * @return The dimension map for the alarm's associated metric. For all metrics, you can not set the dimension key as "scaling_group" or "userId", which is set by default, the second dimension for metric, such as "device" for "PackagesNetIn", need to be set by users. See `dimensions` below. * */ public Output> dimensions() { return this.dimensions; } /** * Whether to enable specific ess alarm. Default to true. * */ @Export(name="enable", refs={Boolean.class}, tree="[0]") private Output enable; /** * @return Whether to enable specific ess alarm. Default to true. * */ public Output> enable() { return Codegen.optional(this.enable); } /** * The number of times that needs to satisfies comparison condition before transition into ALARM state. Defaults to 3. * */ @Export(name="evaluationCount", refs={Integer.class}, tree="[0]") private Output evaluationCount; /** * @return The number of times that needs to satisfies comparison condition before transition into ALARM state. Defaults to 3. * */ public Output> evaluationCount() { return Codegen.optional(this.evaluationCount); } /** * Support multi alert rule. See `expressions` below for details. * */ @Export(name="expressions", refs={List.class,AlarmExpression.class}, tree="[0,1]") private Output> expressions; /** * @return Support multi alert rule. See `expressions` below for details. * */ public Output> expressions() { return this.expressions; } /** * The relationship between the trigger conditions in the multi-metric alert rule. * */ @Export(name="expressionsLogicOperator", refs={String.class}, tree="[0]") private Output expressionsLogicOperator; /** * @return The relationship between the trigger conditions in the multi-metric alert rule. * */ public Output expressionsLogicOperator() { return this.expressionsLogicOperator; } /** * The name for the alarm's associated metric. See `dimensions` below for details. * */ @Export(name="metricName", refs={String.class}, tree="[0]") private Output metricName; /** * @return The name for the alarm's associated metric. See `dimensions` below for details. * */ public Output metricName() { return this.metricName; } /** * The type for the alarm's associated metric. Supported value: system, custom. "system" means the metric data is collected by Aliyun Cloud Monitor Service(CMS), "custom" means the metric data is upload to CMS by users. Defaults to system. * */ @Export(name="metricType", refs={String.class}, tree="[0]") private Output metricType; /** * @return The type for the alarm's associated metric. Supported value: system, custom. "system" means the metric data is collected by Aliyun Cloud Monitor Service(CMS), "custom" means the metric data is upload to CMS by users. Defaults to system. * */ public Output> metricType() { return Codegen.optional(this.metricType); } /** * The name for ess alarm. * */ @Export(name="name", refs={String.class}, tree="[0]") private Output name; /** * @return The name for ess alarm. * */ public Output name() { return this.name; } /** * The period in seconds over which the specified statistic is applied. Supported value: 60, 120, 300, 900. Defaults to 300. * */ @Export(name="period", refs={Integer.class}, tree="[0]") private Output period; /** * @return The period in seconds over which the specified statistic is applied. Supported value: 60, 120, 300, 900. Defaults to 300. * */ public Output period() { return this.period; } /** * The scaling group associated with this alarm, the 'ForceNew' attribute is available in 1.56.0+. * */ @Export(name="scalingGroupId", refs={String.class}, tree="[0]") private Output scalingGroupId; /** * @return The scaling group associated with this alarm, the 'ForceNew' attribute is available in 1.56.0+. * */ public Output scalingGroupId() { return this.scalingGroupId; } /** * The status of the event-triggered task. Valid values: * - ALARM: The alert condition is met and an alert is triggered. * - OK: The alert condition is not met. * - INSUFFICIENT_DATA: Auto Scaling cannot determine whether the alert condition is met due to insufficient data. * */ @Export(name="state", refs={String.class}, tree="[0]") private Output state; /** * @return The status of the event-triggered task. Valid values: * - ALARM: The alert condition is met and an alert is triggered. * - OK: The alert condition is not met. * - INSUFFICIENT_DATA: Auto Scaling cannot determine whether the alert condition is met due to insufficient data. * */ public Output state() { return this.state; } /** * The statistic to apply to the alarm's associated metric. Supported value: Average, Minimum, Maximum. Defaults to Average. * */ @Export(name="statistics", refs={String.class}, tree="[0]") private Output statistics; /** * @return The statistic to apply to the alarm's associated metric. Supported value: Average, Minimum, Maximum. Defaults to Average. * */ public Output statistics() { return this.statistics; } /** * The value against which the specified statistics is compared. * */ @Export(name="threshold", refs={String.class}, tree="[0]") private Output threshold; /** * @return The value against which the specified statistics is compared. * */ public Output threshold() { return this.threshold; } /** * * @param name The _unique_ name of the resulting resource. */ public Alarm(java.lang.String name) { this(name, AlarmArgs.Empty); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. */ public Alarm(java.lang.String name, AlarmArgs 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 Alarm(java.lang.String name, AlarmArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("alicloud:ess/alarm:Alarm", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false); } private Alarm(java.lang.String name, Output id, @Nullable AlarmState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("alicloud:ess/alarm:Alarm", name, state, makeResourceOptions(options, id), false); } private static AlarmArgs makeArgs(AlarmArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { if (options != null && options.getUrn().isPresent()) { return null; } return args == null ? AlarmArgs.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 Alarm get(java.lang.String name, Output id, @Nullable AlarmState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { return new Alarm(name, id, state, options); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy