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

com.pulumi.azurenative.insights.kotlin.AutoscaleSetting.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azurenative.insights.kotlin

import com.pulumi.azurenative.insights.kotlin.outputs.AutoscaleNotificationResponse
import com.pulumi.azurenative.insights.kotlin.outputs.AutoscaleProfileResponse
import com.pulumi.azurenative.insights.kotlin.outputs.PredictiveAutoscalePolicyResponse
import com.pulumi.azurenative.insights.kotlin.outputs.SystemDataResponse
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.azurenative.insights.kotlin.outputs.AutoscaleNotificationResponse.Companion.toKotlin as autoscaleNotificationResponseToKotlin
import com.pulumi.azurenative.insights.kotlin.outputs.AutoscaleProfileResponse.Companion.toKotlin as autoscaleProfileResponseToKotlin
import com.pulumi.azurenative.insights.kotlin.outputs.PredictiveAutoscalePolicyResponse.Companion.toKotlin as predictiveAutoscalePolicyResponseToKotlin
import com.pulumi.azurenative.insights.kotlin.outputs.SystemDataResponse.Companion.toKotlin as systemDataResponseToKotlin

/**
 * Builder for [AutoscaleSetting].
 */
@PulumiTagMarker
public class AutoscaleSettingResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: AutoscaleSettingArgs = AutoscaleSettingArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend AutoscaleSettingArgsBuilder.() -> Unit) {
        val builder = AutoscaleSettingArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): AutoscaleSetting {
        val builtJavaResource =
            com.pulumi.azurenative.insights.AutoscaleSetting(
                this.name,
                this.args.toJava(),
                this.opts.toJava(),
            )
        return AutoscaleSetting(builtJavaResource)
    }
}

/**
 * The autoscale setting resource.
 * Azure REST API version: 2022-10-01. Prior API version in Azure Native 1.x: 2015-04-01.
 * ## Example Usage
 * ### Create or update an autoscale setting
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AzureNative = Pulumi.AzureNative;
 * return await Deployment.RunAsync(() =>
 * {
 *     var autoscaleSetting = new AzureNative.Insights.AutoscaleSetting("autoscaleSetting", new()
 *     {
 *         AutoscaleSettingName = "MySetting",
 *         Enabled = true,
 *         Location = "West US",
 *         Notifications = new[]
 *         {
 *             new AzureNative.Insights.Inputs.AutoscaleNotificationArgs
 *             {
 *                 Email = new AzureNative.Insights.Inputs.EmailNotificationArgs
 *                 {
 *                     CustomEmails = new[]
 *                     {
 *                         "[email protected]",
 *                         "[email protected]",
 *                     },
 *                     SendToSubscriptionAdministrator = true,
 *                     SendToSubscriptionCoAdministrators = true,
 *                 },
 *                 Operation = AzureNative.Insights.OperationType.Scale,
 *                 Webhooks = new[]
 *                 {
 *                     new AzureNative.Insights.Inputs.WebhookNotificationArgs
 *                     {
 *                         Properties = null,
 *                         ServiceUri = "http://myservice.com",
 *                     },
 *                 },
 *             },
 *         },
 *         PredictiveAutoscalePolicy = new AzureNative.Insights.Inputs.PredictiveAutoscalePolicyArgs
 *         {
 *             ScaleMode = AzureNative.Insights.PredictiveAutoscalePolicyScaleMode.Enabled,
 *         },
 *         Profiles = new[]
 *         {
 *             new AzureNative.Insights.Inputs.AutoscaleProfileArgs
 *             {
 *                 Capacity = new AzureNative.Insights.Inputs.ScaleCapacityArgs
 *                 {
 *                     Default = "1",
 *                     Maximum = "10",
 *                     Minimum = "1",
 *                 },
 *                 FixedDate = new AzureNative.Insights.Inputs.TimeWindowArgs
 *                 {
 *                     End = "2015-03-05T14:30:00Z",
 *                     Start = "2015-03-05T14:00:00Z",
 *                     TimeZone = "UTC",
 *                 },
 *                 Name = "adios",
 *                 Rules = new[]
 *                 {
 *                     new AzureNative.Insights.Inputs.ScaleRuleArgs
 *                     {
 *                         MetricTrigger = new AzureNative.Insights.Inputs.MetricTriggerArgs
 *                         {
 *                             DividePerInstance = false,
 *                             MetricName = "Percentage CPU",
 *                             MetricResourceUri = "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc",
 *                             Operator = AzureNative.Insights.ComparisonOperationType.GreaterThan,
 *                             Statistic = AzureNative.Insights.MetricStatisticType.Average,
 *                             Threshold = 10,
 *                             TimeAggregation = AzureNative.Insights.TimeAggregationType.Average,
 *                             TimeGrain = "PT1M",
 *                             TimeWindow = "PT5M",
 *                         },
 *                         ScaleAction = new AzureNative.Insights.Inputs.ScaleActionArgs
 *                         {
 *                             Cooldown = "PT5M",
 *                             Direction = AzureNative.Insights.ScaleDirection.Increase,
 *                             Type = AzureNative.Insights.ScaleType.ChangeCount,
 *                             Value = "1",
 *                         },
 *                     },
 *                     new AzureNative.Insights.Inputs.ScaleRuleArgs
 *                     {
 *                         MetricTrigger = new AzureNative.Insights.Inputs.MetricTriggerArgs
 *                         {
 *                             DividePerInstance = false,
 *                             MetricName = "Percentage CPU",
 *                             MetricResourceUri = "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc",
 *                             Operator = AzureNative.Insights.ComparisonOperationType.GreaterThan,
 *                             Statistic = AzureNative.Insights.MetricStatisticType.Average,
 *                             Threshold = 15,
 *                             TimeAggregation = AzureNative.Insights.TimeAggregationType.Average,
 *                             TimeGrain = "PT2M",
 *                             TimeWindow = "PT5M",
 *                         },
 *                         ScaleAction = new AzureNative.Insights.Inputs.ScaleActionArgs
 *                         {
 *                             Cooldown = "PT6M",
 *                             Direction = AzureNative.Insights.ScaleDirection.Decrease,
 *                             Type = AzureNative.Insights.ScaleType.ChangeCount,
 *                             Value = "2",
 *                         },
 *                     },
 *                 },
 *             },
 *             new AzureNative.Insights.Inputs.AutoscaleProfileArgs
 *             {
 *                 Capacity = new AzureNative.Insights.Inputs.ScaleCapacityArgs
 *                 {
 *                     Default = "1",
 *                     Maximum = "10",
 *                     Minimum = "1",
 *                 },
 *                 Name = "saludos",
 *                 Recurrence = new AzureNative.Insights.Inputs.RecurrenceArgs
 *                 {
 *                     Frequency = AzureNative.Insights.RecurrenceFrequency.Week,
 *                     Schedule = new AzureNative.Insights.Inputs.RecurrentScheduleArgs
 *                     {
 *                         Days = new[]
 *                         {
 *                             "1",
 *                         },
 *                         Hours = new[]
 *                         {
 *                             5,
 *                         },
 *                         Minutes = new[]
 *                         {
 *                             15,
 *                         },
 *                         TimeZone = "UTC",
 *                     },
 *                 },
 *                 Rules = new[]
 *                 {
 *                     new AzureNative.Insights.Inputs.ScaleRuleArgs
 *                     {
 *                         MetricTrigger = new AzureNative.Insights.Inputs.MetricTriggerArgs
 *                         {
 *                             DividePerInstance = false,
 *                             MetricName = "Percentage CPU",
 *                             MetricResourceUri = "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc",
 *                             Operator = AzureNative.Insights.ComparisonOperationType.GreaterThan,
 *                             Statistic = AzureNative.Insights.MetricStatisticType.Average,
 *                             Threshold = 10,
 *                             TimeAggregation = AzureNative.Insights.TimeAggregationType.Average,
 *                             TimeGrain = "PT1M",
 *                             TimeWindow = "PT5M",
 *                         },
 *                         ScaleAction = new AzureNative.Insights.Inputs.ScaleActionArgs
 *                         {
 *                             Cooldown = "PT5M",
 *                             Direction = AzureNative.Insights.ScaleDirection.Increase,
 *                             Type = AzureNative.Insights.ScaleType.ChangeCount,
 *                             Value = "1",
 *                         },
 *                     },
 *                     new AzureNative.Insights.Inputs.ScaleRuleArgs
 *                     {
 *                         MetricTrigger = new AzureNative.Insights.Inputs.MetricTriggerArgs
 *                         {
 *                             DividePerInstance = false,
 *                             MetricName = "Percentage CPU",
 *                             MetricResourceUri = "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc",
 *                             Operator = AzureNative.Insights.ComparisonOperationType.GreaterThan,
 *                             Statistic = AzureNative.Insights.MetricStatisticType.Average,
 *                             Threshold = 15,
 *                             TimeAggregation = AzureNative.Insights.TimeAggregationType.Average,
 *                             TimeGrain = "PT2M",
 *                             TimeWindow = "PT5M",
 *                         },
 *                         ScaleAction = new AzureNative.Insights.Inputs.ScaleActionArgs
 *                         {
 *                             Cooldown = "PT6M",
 *                             Direction = AzureNative.Insights.ScaleDirection.Decrease,
 *                             Type = AzureNative.Insights.ScaleType.ChangeCount,
 *                             Value = "2",
 *                         },
 *                     },
 *                 },
 *             },
 *         },
 *         ResourceGroupName = "TestingMetricsScaleSet",
 *         Tags =
 *         {
 *             { "key1", "value1" },
 *             { "key2", "value2" },
 *         },
 *         TargetResourceUri = "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	insights "github.com/pulumi/pulumi-azure-native-sdk/insights/v2"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := insights.NewAutoscaleSetting(ctx, "autoscaleSetting", &insights.AutoscaleSettingArgs{
 * 			AutoscaleSettingName: pulumi.String("MySetting"),
 * 			Enabled:              pulumi.Bool(true),
 * 			Location:             pulumi.String("West US"),
 * 			Notifications: insights.AutoscaleNotificationArray{
 * 				&insights.AutoscaleNotificationArgs{
 * 					Email: &insights.EmailNotificationArgs{
 * 						CustomEmails: pulumi.StringArray{
 * 							pulumi.String("[email protected]"),
 * 							pulumi.String("[email protected]"),
 * 						},
 * 						SendToSubscriptionAdministrator:    pulumi.Bool(true),
 * 						SendToSubscriptionCoAdministrators: pulumi.Bool(true),
 * 					},
 * 					Operation: insights.OperationTypeScale,
 * 					Webhooks: insights.WebhookNotificationArray{
 * 						&insights.WebhookNotificationArgs{
 * 							Properties: nil,
 * 							ServiceUri: pulumi.String("http://myservice.com"),
 * 						},
 * 					},
 * 				},
 * 			},
 * 			PredictiveAutoscalePolicy: &insights.PredictiveAutoscalePolicyArgs{
 * 				ScaleMode: insights.PredictiveAutoscalePolicyScaleModeEnabled,
 * 			},
 * 			Profiles: insights.AutoscaleProfileArray{
 * 				&insights.AutoscaleProfileArgs{
 * 					Capacity: &insights.ScaleCapacityArgs{
 * 						Default: pulumi.String("1"),
 * 						Maximum: pulumi.String("10"),
 * 						Minimum: pulumi.String("1"),
 * 					},
 * 					FixedDate: &insights.TimeWindowArgs{
 * 						End:      pulumi.String("2015-03-05T14:30:00Z"),
 * 						Start:    pulumi.String("2015-03-05T14:00:00Z"),
 * 						TimeZone: pulumi.String("UTC"),
 * 					},
 * 					Name: pulumi.String("adios"),
 * 					Rules: insights.ScaleRuleArray{
 * 						&insights.ScaleRuleArgs{
 * 							MetricTrigger: &insights.MetricTriggerArgs{
 * 								DividePerInstance: pulumi.Bool(false),
 * 								MetricName:        pulumi.String("Percentage CPU"),
 * 								MetricResourceUri: pulumi.String("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"),
 * 								Operator:          insights.ComparisonOperationTypeGreaterThan,
 * 								Statistic:         insights.MetricStatisticTypeAverage,
 * 								Threshold:         pulumi.Float64(10),
 * 								TimeAggregation:   insights.TimeAggregationTypeAverage,
 * 								TimeGrain:         pulumi.String("PT1M"),
 * 								TimeWindow:        pulumi.String("PT5M"),
 * 							},
 * 							ScaleAction: &insights.ScaleActionArgs{
 * 								Cooldown:  pulumi.String("PT5M"),
 * 								Direction: insights.ScaleDirectionIncrease,
 * 								Type:      insights.ScaleTypeChangeCount,
 * 								Value:     pulumi.String("1"),
 * 							},
 * 						},
 * 						&insights.ScaleRuleArgs{
 * 							MetricTrigger: &insights.MetricTriggerArgs{
 * 								DividePerInstance: pulumi.Bool(false),
 * 								MetricName:        pulumi.String("Percentage CPU"),
 * 								MetricResourceUri: pulumi.String("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"),
 * 								Operator:          insights.ComparisonOperationTypeGreaterThan,
 * 								Statistic:         insights.MetricStatisticTypeAverage,
 * 								Threshold:         pulumi.Float64(15),
 * 								TimeAggregation:   insights.TimeAggregationTypeAverage,
 * 								TimeGrain:         pulumi.String("PT2M"),
 * 								TimeWindow:        pulumi.String("PT5M"),
 * 							},
 * 							ScaleAction: &insights.ScaleActionArgs{
 * 								Cooldown:  pulumi.String("PT6M"),
 * 								Direction: insights.ScaleDirectionDecrease,
 * 								Type:      insights.ScaleTypeChangeCount,
 * 								Value:     pulumi.String("2"),
 * 							},
 * 						},
 * 					},
 * 				},
 * 				&insights.AutoscaleProfileArgs{
 * 					Capacity: &insights.ScaleCapacityArgs{
 * 						Default: pulumi.String("1"),
 * 						Maximum: pulumi.String("10"),
 * 						Minimum: pulumi.String("1"),
 * 					},
 * 					Name: pulumi.String("saludos"),
 * 					Recurrence: &insights.RecurrenceArgs{
 * 						Frequency: insights.RecurrenceFrequencyWeek,
 * 						Schedule: &insights.RecurrentScheduleArgs{
 * 							Days: pulumi.StringArray{
 * 								pulumi.String("1"),
 * 							},
 * 							Hours: pulumi.IntArray{
 * 								pulumi.Int(5),
 * 							},
 * 							Minutes: pulumi.IntArray{
 * 								pulumi.Int(15),
 * 							},
 * 							TimeZone: pulumi.String("UTC"),
 * 						},
 * 					},
 * 					Rules: insights.ScaleRuleArray{
 * 						&insights.ScaleRuleArgs{
 * 							MetricTrigger: &insights.MetricTriggerArgs{
 * 								DividePerInstance: pulumi.Bool(false),
 * 								MetricName:        pulumi.String("Percentage CPU"),
 * 								MetricResourceUri: pulumi.String("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"),
 * 								Operator:          insights.ComparisonOperationTypeGreaterThan,
 * 								Statistic:         insights.MetricStatisticTypeAverage,
 * 								Threshold:         pulumi.Float64(10),
 * 								TimeAggregation:   insights.TimeAggregationTypeAverage,
 * 								TimeGrain:         pulumi.String("PT1M"),
 * 								TimeWindow:        pulumi.String("PT5M"),
 * 							},
 * 							ScaleAction: &insights.ScaleActionArgs{
 * 								Cooldown:  pulumi.String("PT5M"),
 * 								Direction: insights.ScaleDirectionIncrease,
 * 								Type:      insights.ScaleTypeChangeCount,
 * 								Value:     pulumi.String("1"),
 * 							},
 * 						},
 * 						&insights.ScaleRuleArgs{
 * 							MetricTrigger: &insights.MetricTriggerArgs{
 * 								DividePerInstance: pulumi.Bool(false),
 * 								MetricName:        pulumi.String("Percentage CPU"),
 * 								MetricResourceUri: pulumi.String("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"),
 * 								Operator:          insights.ComparisonOperationTypeGreaterThan,
 * 								Statistic:         insights.MetricStatisticTypeAverage,
 * 								Threshold:         pulumi.Float64(15),
 * 								TimeAggregation:   insights.TimeAggregationTypeAverage,
 * 								TimeGrain:         pulumi.String("PT2M"),
 * 								TimeWindow:        pulumi.String("PT5M"),
 * 							},
 * 							ScaleAction: &insights.ScaleActionArgs{
 * 								Cooldown:  pulumi.String("PT6M"),
 * 								Direction: insights.ScaleDirectionDecrease,
 * 								Type:      insights.ScaleTypeChangeCount,
 * 								Value:     pulumi.String("2"),
 * 							},
 * 						},
 * 					},
 * 				},
 * 			},
 * 			ResourceGroupName: pulumi.String("TestingMetricsScaleSet"),
 * 			Tags: pulumi.StringMap{
 * 				"key1": pulumi.String("value1"),
 * 				"key2": pulumi.String("value2"),
 * 			},
 * 			TargetResourceUri: pulumi.String("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.azurenative.insights.AutoscaleSetting;
 * import com.pulumi.azurenative.insights.AutoscaleSettingArgs;
 * import com.pulumi.azurenative.insights.inputs.AutoscaleNotificationArgs;
 * import com.pulumi.azurenative.insights.inputs.EmailNotificationArgs;
 * import com.pulumi.azurenative.insights.inputs.PredictiveAutoscalePolicyArgs;
 * import com.pulumi.azurenative.insights.inputs.AutoscaleProfileArgs;
 * import com.pulumi.azurenative.insights.inputs.ScaleCapacityArgs;
 * import com.pulumi.azurenative.insights.inputs.TimeWindowArgs;
 * import com.pulumi.azurenative.insights.inputs.RecurrenceArgs;
 * import com.pulumi.azurenative.insights.inputs.RecurrentScheduleArgs;
 * 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 autoscaleSetting = new AutoscaleSetting("autoscaleSetting", AutoscaleSettingArgs.builder()
 *             .autoscaleSettingName("MySetting")
 *             .enabled(true)
 *             .location("West US")
 *             .notifications(AutoscaleNotificationArgs.builder()
 *                 .email(EmailNotificationArgs.builder()
 *                     .customEmails(
 *                         "[email protected]",
 *                         "[email protected]")
 *                     .sendToSubscriptionAdministrator(true)
 *                     .sendToSubscriptionCoAdministrators(true)
 *                     .build())
 *                 .operation("Scale")
 *                 .webhooks(WebhookNotificationArgs.builder()
 *                     .properties()
 *                     .serviceUri("http://myservice.com")
 *                     .build())
 *                 .build())
 *             .predictiveAutoscalePolicy(PredictiveAutoscalePolicyArgs.builder()
 *                 .scaleMode("Enabled")
 *                 .build())
 *             .profiles(
 *                 AutoscaleProfileArgs.builder()
 *                     .capacity(ScaleCapacityArgs.builder()
 *                         .default_("1")
 *                         .maximum("10")
 *                         .minimum("1")
 *                         .build())
 *                     .fixedDate(TimeWindowArgs.builder()
 *                         .end("2015-03-05T14:30:00Z")
 *                         .start("2015-03-05T14:00:00Z")
 *                         .timeZone("UTC")
 *                         .build())
 *                     .name("adios")
 *                     .rules(
 *                         ScaleRuleArgs.builder()
 *                             .metricTrigger(MetricTriggerArgs.builder()
 *                                 .dividePerInstance(false)
 *                                 .metricName("Percentage CPU")
 *                                 .metricResourceUri("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc")
 *                                 .operator("GreaterThan")
 *                                 .statistic("Average")
 *                                 .threshold(10)
 *                                 .timeAggregation("Average")
 *                                 .timeGrain("PT1M")
 *                                 .timeWindow("PT5M")
 *                                 .build())
 *                             .scaleAction(ScaleActionArgs.builder()
 *                                 .cooldown("PT5M")
 *                                 .direction("Increase")
 *                                 .type("ChangeCount")
 *                                 .value("1")
 *                                 .build())
 *                             .build(),
 *                         ScaleRuleArgs.builder()
 *                             .metricTrigger(MetricTriggerArgs.builder()
 *                                 .dividePerInstance(false)
 *                                 .metricName("Percentage CPU")
 *                                 .metricResourceUri("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc")
 *                                 .operator("GreaterThan")
 *                                 .statistic("Average")
 *                                 .threshold(15)
 *                                 .timeAggregation("Average")
 *                                 .timeGrain("PT2M")
 *                                 .timeWindow("PT5M")
 *                                 .build())
 *                             .scaleAction(ScaleActionArgs.builder()
 *                                 .cooldown("PT6M")
 *                                 .direction("Decrease")
 *                                 .type("ChangeCount")
 *                                 .value("2")
 *                                 .build())
 *                             .build())
 *                     .build(),
 *                 AutoscaleProfileArgs.builder()
 *                     .capacity(ScaleCapacityArgs.builder()
 *                         .default_("1")
 *                         .maximum("10")
 *                         .minimum("1")
 *                         .build())
 *                     .name("saludos")
 *                     .recurrence(RecurrenceArgs.builder()
 *                         .frequency("Week")
 *                         .schedule(RecurrentScheduleArgs.builder()
 *                             .days("1")
 *                             .hours(5)
 *                             .minutes(15)
 *                             .timeZone("UTC")
 *                             .build())
 *                         .build())
 *                     .rules(
 *                         ScaleRuleArgs.builder()
 *                             .metricTrigger(MetricTriggerArgs.builder()
 *                                 .dividePerInstance(false)
 *                                 .metricName("Percentage CPU")
 *                                 .metricResourceUri("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc")
 *                                 .operator("GreaterThan")
 *                                 .statistic("Average")
 *                                 .threshold(10)
 *                                 .timeAggregation("Average")
 *                                 .timeGrain("PT1M")
 *                                 .timeWindow("PT5M")
 *                                 .build())
 *                             .scaleAction(ScaleActionArgs.builder()
 *                                 .cooldown("PT5M")
 *                                 .direction("Increase")
 *                                 .type("ChangeCount")
 *                                 .value("1")
 *                                 .build())
 *                             .build(),
 *                         ScaleRuleArgs.builder()
 *                             .metricTrigger(MetricTriggerArgs.builder()
 *                                 .dividePerInstance(false)
 *                                 .metricName("Percentage CPU")
 *                                 .metricResourceUri("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc")
 *                                 .operator("GreaterThan")
 *                                 .statistic("Average")
 *                                 .threshold(15)
 *                                 .timeAggregation("Average")
 *                                 .timeGrain("PT2M")
 *                                 .timeWindow("PT5M")
 *                                 .build())
 *                             .scaleAction(ScaleActionArgs.builder()
 *                                 .cooldown("PT6M")
 *                                 .direction("Decrease")
 *                                 .type("ChangeCount")
 *                                 .value("2")
 *                                 .build())
 *                             .build())
 *                     .build())
 *             .resourceGroupName("TestingMetricsScaleSet")
 *             .tags(Map.ofEntries(
 *                 Map.entry("key1", "value1"),
 *                 Map.entry("key2", "value2")
 *             ))
 *             .targetResourceUri("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc")
 *             .build());
 *     }
 * }
 * ```
 * ## Import
 * An existing resource can be imported using its type token, name, and identifier, e.g.
 * ```sh
 * $ pulumi import azure-native:insights:AutoscaleSetting MySetting /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}
 * ```
 */
public class AutoscaleSetting internal constructor(
    override val javaResource: com.pulumi.azurenative.insights.AutoscaleSetting,
) : KotlinCustomResource(javaResource, AutoscaleSettingMapper) {
    /**
     * the enabled flag. Specifies whether automatic scaling is enabled for the resource. The default value is 'false'.
     */
    public val enabled: Output?
        get() = javaResource.enabled().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Resource location
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * Azure resource name
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * the collection of notifications.
     */
    public val notifications: Output>?
        get() = javaResource.notifications().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        autoscaleNotificationResponseToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * the predictive autoscale policy mode.
     */
    public val predictiveAutoscalePolicy: Output?
        get() = javaResource.predictiveAutoscalePolicy().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> predictiveAutoscalePolicyResponseToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * the collection of automatic scaling profiles that specify different scaling parameters for different time periods. A maximum of 20 profiles can be specified.
     */
    public val profiles: Output>
        get() = javaResource.profiles().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    autoscaleProfileResponseToKotlin(args0)
                })
            })
        })

    /**
     * The system metadata related to the response.
     */
    public val systemData: Output
        get() = javaResource.systemData().applyValue({ args0 ->
            args0.let({ args0 ->
                systemDataResponseToKotlin(args0)
            })
        })

    /**
     * Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * the location of the resource that the autoscale setting should be added to.
     */
    public val targetResourceLocation: Output?
        get() = javaResource.targetResourceLocation().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * the resource identifier of the resource that the autoscale setting should be added to.
     */
    public val targetResourceUri: Output?
        get() = javaResource.targetResourceUri().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Azure resource type
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })
}

public object AutoscaleSettingMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azurenative.insights.AutoscaleSetting::class == javaResource::class

    override fun map(javaResource: Resource): AutoscaleSetting = AutoscaleSetting(
        javaResource as
            com.pulumi.azurenative.insights.AutoscaleSetting,
    )
}

/**
 * @see [AutoscaleSetting].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [AutoscaleSetting].
 */
public suspend fun autoscaleSetting(
    name: String,
    block: suspend AutoscaleSettingResourceBuilder.() -> Unit,
): AutoscaleSetting {
    val builder = AutoscaleSettingResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [AutoscaleSetting].
 * @param name The _unique_ name of the resulting resource.
 */
public fun autoscaleSetting(name: String): AutoscaleSetting {
    val builder = AutoscaleSettingResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy