github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/autoscaling/policy.go (about) 1 // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT. 2 // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** 3 4 package autoscaling 5 6 import ( 7 "context" 8 "reflect" 9 10 "errors" 11 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 12 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 13 ) 14 15 // Provides an AutoScaling Scaling Policy resource. 16 // 17 // > **NOTE:** You may want to omit `desiredCapacity` attribute from attached `autoscaling.Group` 18 // when using autoscaling policies. It's good practice to pick either 19 // [manual](https://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/as-manual-scaling.html) 20 // or [dynamic](https://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/as-scale-based-on-demand.html) 21 // (policy-based) scaling. 22 // 23 // ## Example Usage 24 // 25 // <!--Start PulumiCodeChooser --> 26 // ```go 27 // package main 28 // 29 // import ( 30 // 31 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/autoscaling" 32 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2" 33 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 34 // 35 // ) 36 // 37 // func main() { 38 // pulumi.Run(func(ctx *pulumi.Context) error { 39 // bar, err := autoscaling.NewGroup(ctx, "bar", &autoscaling.GroupArgs{ 40 // AvailabilityZones: pulumi.StringArray{ 41 // pulumi.String("us-east-1a"), 42 // }, 43 // Name: pulumi.String("foobar3-test"), 44 // MaxSize: pulumi.Int(5), 45 // MinSize: pulumi.Int(2), 46 // HealthCheckGracePeriod: pulumi.Int(300), 47 // HealthCheckType: pulumi.String("ELB"), 48 // ForceDelete: pulumi.Bool(true), 49 // LaunchConfiguration: pulumi.Any(foo.Name), 50 // }) 51 // if err != nil { 52 // return err 53 // } 54 // _, err = autoscaling.NewPolicy(ctx, "bat", &autoscaling.PolicyArgs{ 55 // Name: pulumi.String("foobar3-test"), 56 // ScalingAdjustment: pulumi.Int(4), 57 // AdjustmentType: pulumi.String("ChangeInCapacity"), 58 // Cooldown: pulumi.Int(300), 59 // AutoscalingGroupName: bar.Name, 60 // }) 61 // if err != nil { 62 // return err 63 // } 64 // return nil 65 // }) 66 // } 67 // 68 // ``` 69 // <!--End PulumiCodeChooser --> 70 // 71 // ### Create target tracking scaling policy using metric math 72 // 73 // <!--Start PulumiCodeChooser --> 74 // ```go 75 // package main 76 // 77 // import ( 78 // 79 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/autoscaling" 80 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 81 // 82 // ) 83 // 84 // func main() { 85 // pulumi.Run(func(ctx *pulumi.Context) error { 86 // _, err := autoscaling.NewPolicy(ctx, "example", &autoscaling.PolicyArgs{ 87 // AutoscalingGroupName: pulumi.String("my-test-asg"), 88 // Name: pulumi.String("foo"), 89 // PolicyType: pulumi.String("TargetTrackingScaling"), 90 // TargetTrackingConfiguration: &autoscaling.PolicyTargetTrackingConfigurationArgs{ 91 // TargetValue: pulumi.Float64(100), 92 // CustomizedMetricSpecification: &autoscaling.PolicyTargetTrackingConfigurationCustomizedMetricSpecificationArgs{ 93 // Metrics: autoscaling.PolicyTargetTrackingConfigurationCustomizedMetricSpecificationMetricArray{ 94 // &autoscaling.PolicyTargetTrackingConfigurationCustomizedMetricSpecificationMetricArgs{ 95 // Label: pulumi.String("Get the queue size (the number of messages waiting to be processed)"), 96 // Id: pulumi.String("m1"), 97 // MetricStat: &autoscaling.PolicyTargetTrackingConfigurationCustomizedMetricSpecificationMetricMetricStatArgs{ 98 // Metric: &autoscaling.PolicyTargetTrackingConfigurationCustomizedMetricSpecificationMetricMetricStatMetricArgs{ 99 // Namespace: pulumi.String("AWS/SQS"), 100 // MetricName: pulumi.String("ApproximateNumberOfMessagesVisible"), 101 // Dimensions: autoscaling.PolicyTargetTrackingConfigurationCustomizedMetricSpecificationMetricMetricStatMetricDimensionArray{ 102 // &autoscaling.PolicyTargetTrackingConfigurationCustomizedMetricSpecificationMetricMetricStatMetricDimensionArgs{ 103 // Name: pulumi.String("QueueName"), 104 // Value: pulumi.String("my-queue"), 105 // }, 106 // }, 107 // }, 108 // Stat: pulumi.String("Sum"), 109 // }, 110 // ReturnData: pulumi.Bool(false), 111 // }, 112 // &autoscaling.PolicyTargetTrackingConfigurationCustomizedMetricSpecificationMetricArgs{ 113 // Label: pulumi.String("Get the group size (the number of InService instances)"), 114 // Id: pulumi.String("m2"), 115 // MetricStat: &autoscaling.PolicyTargetTrackingConfigurationCustomizedMetricSpecificationMetricMetricStatArgs{ 116 // Metric: &autoscaling.PolicyTargetTrackingConfigurationCustomizedMetricSpecificationMetricMetricStatMetricArgs{ 117 // Namespace: pulumi.String("AWS/AutoScaling"), 118 // MetricName: pulumi.String("GroupInServiceInstances"), 119 // Dimensions: autoscaling.PolicyTargetTrackingConfigurationCustomizedMetricSpecificationMetricMetricStatMetricDimensionArray{ 120 // &autoscaling.PolicyTargetTrackingConfigurationCustomizedMetricSpecificationMetricMetricStatMetricDimensionArgs{ 121 // Name: pulumi.String("AutoScalingGroupName"), 122 // Value: pulumi.String("my-asg"), 123 // }, 124 // }, 125 // }, 126 // Stat: pulumi.String("Average"), 127 // }, 128 // ReturnData: pulumi.Bool(false), 129 // }, 130 // &autoscaling.PolicyTargetTrackingConfigurationCustomizedMetricSpecificationMetricArgs{ 131 // Label: pulumi.String("Calculate the backlog per instance"), 132 // Id: pulumi.String("e1"), 133 // Expression: pulumi.String("m1 / m2"), 134 // ReturnData: pulumi.Bool(true), 135 // }, 136 // }, 137 // }, 138 // }, 139 // }) 140 // if err != nil { 141 // return err 142 // } 143 // return nil 144 // }) 145 // } 146 // 147 // ``` 148 // <!--End PulumiCodeChooser --> 149 // 150 // ### Create predictive scaling policy using customized metrics 151 // 152 // <!--Start PulumiCodeChooser --> 153 // ```go 154 // package main 155 // 156 // import ( 157 // 158 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/autoscaling" 159 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 160 // 161 // ) 162 // 163 // func main() { 164 // pulumi.Run(func(ctx *pulumi.Context) error { 165 // _, err := autoscaling.NewPolicy(ctx, "example", &autoscaling.PolicyArgs{ 166 // AutoscalingGroupName: pulumi.String("my-test-asg"), 167 // Name: pulumi.String("foo"), 168 // PolicyType: pulumi.String("PredictiveScaling"), 169 // PredictiveScalingConfiguration: &autoscaling.PolicyPredictiveScalingConfigurationArgs{ 170 // MetricSpecification: &autoscaling.PolicyPredictiveScalingConfigurationMetricSpecificationArgs{ 171 // TargetValue: pulumi.Float64(10), 172 // CustomizedLoadMetricSpecification: &autoscaling.PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedLoadMetricSpecificationArgs{ 173 // MetricDataQueries: autoscaling.PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedLoadMetricSpecificationMetricDataQueryArray{ 174 // &autoscaling.PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedLoadMetricSpecificationMetricDataQueryArgs{ 175 // Id: pulumi.String("load_sum"), 176 // Expression: pulumi.String("SUM(SEARCH('{AWS/EC2,AutoScalingGroupName} MetricName=\"CPUUtilization\" my-test-asg', 'Sum', 3600))"), 177 // }, 178 // }, 179 // }, 180 // CustomizedCapacityMetricSpecification: &autoscaling.PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedCapacityMetricSpecificationArgs{ 181 // MetricDataQueries: autoscaling.PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedCapacityMetricSpecificationMetricDataQueryArray{ 182 // &autoscaling.PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedCapacityMetricSpecificationMetricDataQueryArgs{ 183 // Id: pulumi.String("capacity_sum"), 184 // Expression: pulumi.String("SUM(SEARCH('{AWS/AutoScaling,AutoScalingGroupName} MetricName=\"GroupInServiceIntances\" my-test-asg', 'Average', 300))"), 185 // }, 186 // }, 187 // }, 188 // CustomizedScalingMetricSpecification: &autoscaling.PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedScalingMetricSpecificationArgs{ 189 // MetricDataQueries: autoscaling.PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedScalingMetricSpecificationMetricDataQueryArray{ 190 // &autoscaling.PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedScalingMetricSpecificationMetricDataQueryArgs{ 191 // Id: pulumi.String("capacity_sum"), 192 // Expression: pulumi.String("SUM(SEARCH('{AWS/AutoScaling,AutoScalingGroupName} MetricName=\"GroupInServiceIntances\" my-test-asg', 'Average', 300))"), 193 // ReturnData: pulumi.Bool(false), 194 // }, 195 // &autoscaling.PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedScalingMetricSpecificationMetricDataQueryArgs{ 196 // Id: pulumi.String("load_sum"), 197 // Expression: pulumi.String("SUM(SEARCH('{AWS/EC2,AutoScalingGroupName} MetricName=\"CPUUtilization\" my-test-asg', 'Sum', 300))"), 198 // ReturnData: pulumi.Bool(false), 199 // }, 200 // &autoscaling.PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedScalingMetricSpecificationMetricDataQueryArgs{ 201 // Id: pulumi.String("weighted_average"), 202 // Expression: pulumi.String("load_sum / (capacity_sum * PERIOD(capacity_sum) / 60)"), 203 // }, 204 // }, 205 // }, 206 // }, 207 // }, 208 // }) 209 // if err != nil { 210 // return err 211 // } 212 // return nil 213 // }) 214 // } 215 // 216 // ``` 217 // <!--End PulumiCodeChooser --> 218 // 219 // ### Create predictive scaling policy using customized scaling and predefined load metric 220 // 221 // <!--Start PulumiCodeChooser --> 222 // ```go 223 // package main 224 // 225 // import ( 226 // 227 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/autoscaling" 228 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 229 // 230 // ) 231 // 232 // func main() { 233 // pulumi.Run(func(ctx *pulumi.Context) error { 234 // _, err := autoscaling.NewPolicy(ctx, "example", &autoscaling.PolicyArgs{ 235 // AutoscalingGroupName: pulumi.String("my-test-asg"), 236 // Name: pulumi.String("foo"), 237 // PolicyType: pulumi.String("PredictiveScaling"), 238 // PredictiveScalingConfiguration: &autoscaling.PolicyPredictiveScalingConfigurationArgs{ 239 // MetricSpecification: &autoscaling.PolicyPredictiveScalingConfigurationMetricSpecificationArgs{ 240 // TargetValue: pulumi.Float64(10), 241 // PredefinedLoadMetricSpecification: &autoscaling.PolicyPredictiveScalingConfigurationMetricSpecificationPredefinedLoadMetricSpecificationArgs{ 242 // PredefinedMetricType: pulumi.String("ASGTotalCPUUtilization"), 243 // ResourceLabel: pulumi.String("app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff"), 244 // }, 245 // CustomizedScalingMetricSpecification: &autoscaling.PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedScalingMetricSpecificationArgs{ 246 // MetricDataQueries: autoscaling.PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedScalingMetricSpecificationMetricDataQueryArray{ 247 // &autoscaling.PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedScalingMetricSpecificationMetricDataQueryArgs{ 248 // Id: pulumi.String("scaling"), 249 // MetricStat: &autoscaling.PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedScalingMetricSpecificationMetricDataQueryMetricStatArgs{ 250 // Metric: &autoscaling.PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedScalingMetricSpecificationMetricDataQueryMetricStatMetricArgs{ 251 // MetricName: pulumi.String("CPUUtilization"), 252 // Namespace: pulumi.String("AWS/EC2"), 253 // Dimensions: autoscaling.PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedScalingMetricSpecificationMetricDataQueryMetricStatMetricDimensionArray{ 254 // &autoscaling.PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedScalingMetricSpecificationMetricDataQueryMetricStatMetricDimensionArgs{ 255 // Name: pulumi.String("AutoScalingGroupName"), 256 // Value: pulumi.String("my-test-asg"), 257 // }, 258 // }, 259 // }, 260 // Stat: pulumi.String("Average"), 261 // }, 262 // }, 263 // }, 264 // }, 265 // }, 266 // }, 267 // }) 268 // if err != nil { 269 // return err 270 // } 271 // return nil 272 // }) 273 // } 274 // 275 // ``` 276 // <!--End PulumiCodeChooser --> 277 // 278 // ## Import 279 // 280 // Using `pulumi import`, import AutoScaling scaling policy using the role autoscaling_group_name and name separated by `/`. For example: 281 // 282 // ```sh 283 // $ pulumi import aws:autoscaling/policy:Policy test-policy asg-name/policy-name 284 // ``` 285 type Policy struct { 286 pulumi.CustomResourceState 287 288 // Whether the adjustment is an absolute number or a percentage of the current capacity. Valid values are `ChangeInCapacity`, `ExactCapacity`, and `PercentChangeInCapacity`. 289 AdjustmentType pulumi.StringPtrOutput `pulumi:"adjustmentType"` 290 // ARN assigned by AWS to the scaling policy. 291 Arn pulumi.StringOutput `pulumi:"arn"` 292 // Name of the autoscaling group. 293 AutoscalingGroupName pulumi.StringOutput `pulumi:"autoscalingGroupName"` 294 // Amount of time, in seconds, after a scaling activity completes and before the next scaling activity can start. 295 Cooldown pulumi.IntPtrOutput `pulumi:"cooldown"` 296 // Whether the scaling policy is enabled or disabled. Default: `true`. 297 // 298 // The following argument is only available to "SimpleScaling" and "StepScaling" type policies: 299 Enabled pulumi.BoolPtrOutput `pulumi:"enabled"` 300 // Estimated time, in seconds, until a newly launched instance will contribute CloudWatch metrics. Without a value, AWS will default to the group's specified cooldown period. 301 EstimatedInstanceWarmup pulumi.IntPtrOutput `pulumi:"estimatedInstanceWarmup"` 302 // Aggregation type for the policy's metrics. Valid values are "Minimum", "Maximum", and "Average". Without a value, AWS will treat the aggregation type as "Average". 303 MetricAggregationType pulumi.StringOutput `pulumi:"metricAggregationType"` 304 // Minimum value to scale by when `adjustmentType` is set to `PercentChangeInCapacity`. 305 // 306 // The following arguments are only available to "SimpleScaling" type policies: 307 MinAdjustmentMagnitude pulumi.IntPtrOutput `pulumi:"minAdjustmentMagnitude"` 308 // Name of the policy. 309 Name pulumi.StringOutput `pulumi:"name"` 310 // Policy type, either "SimpleScaling", "StepScaling", "TargetTrackingScaling", or "PredictiveScaling". If this value isn't provided, AWS will default to "SimpleScaling." 311 PolicyType pulumi.StringPtrOutput `pulumi:"policyType"` 312 // Predictive scaling policy configuration to use with Amazon EC2 Auto Scaling. 313 PredictiveScalingConfiguration PolicyPredictiveScalingConfigurationPtrOutput `pulumi:"predictiveScalingConfiguration"` 314 // Number of members by which to 315 // scale, when the adjustment bounds are breached. A positive value scales 316 // up. A negative value scales down. 317 ScalingAdjustment pulumi.IntPtrOutput `pulumi:"scalingAdjustment"` 318 // Set of adjustments that manage 319 // group scaling. These have the following structure: 320 // 321 // <!--Start PulumiCodeChooser --> 322 // ```go 323 // package main 324 // 325 // import ( 326 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/autoscaling" 327 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 328 // ) 329 // 330 // func main() { 331 // pulumi.Run(func(ctx *pulumi.Context) error { 332 // _, err := autoscaling.NewPolicy(ctx, "example", &autoscaling.PolicyArgs{ 333 // StepAdjustments: autoscaling.PolicyStepAdjustmentArray{ 334 // &autoscaling.PolicyStepAdjustmentArgs{ 335 // ScalingAdjustment: -1, 336 // MetricIntervalLowerBound: pulumi.String("1"), 337 // MetricIntervalUpperBound: pulumi.String("2"), 338 // }, 339 // &autoscaling.PolicyStepAdjustmentArgs{ 340 // ScalingAdjustment: pulumi.Int(1), 341 // MetricIntervalLowerBound: pulumi.String("2"), 342 // MetricIntervalUpperBound: pulumi.String("3"), 343 // }, 344 // }, 345 // }) 346 // if err != nil { 347 // return err 348 // } 349 // return nil 350 // }) 351 // } 352 // ``` 353 // <!--End PulumiCodeChooser --> 354 // 355 // The following fields are available in step adjustments: 356 StepAdjustments PolicyStepAdjustmentArrayOutput `pulumi:"stepAdjustments"` 357 // Target tracking policy. These have the following structure: 358 // 359 // <!--Start PulumiCodeChooser --> 360 // ```go 361 // package main 362 // 363 // import ( 364 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/autoscaling" 365 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 366 // ) 367 // 368 // func main() { 369 // pulumi.Run(func(ctx *pulumi.Context) error { 370 // _, err := autoscaling.NewPolicy(ctx, "example", &autoscaling.PolicyArgs{ 371 // TargetTrackingConfiguration: &autoscaling.PolicyTargetTrackingConfigurationArgs{ 372 // PredefinedMetricSpecification: &autoscaling.PolicyTargetTrackingConfigurationPredefinedMetricSpecificationArgs{ 373 // PredefinedMetricType: pulumi.String("ASGAverageCPUUtilization"), 374 // }, 375 // TargetValue: pulumi.Float64(40), 376 // }, 377 // }) 378 // if err != nil { 379 // return err 380 // } 381 // return nil 382 // }) 383 // } 384 // ``` 385 // <!--End PulumiCodeChooser --> 386 // 387 // The following fields are available in target tracking configuration: 388 TargetTrackingConfiguration PolicyTargetTrackingConfigurationPtrOutput `pulumi:"targetTrackingConfiguration"` 389 } 390 391 // NewPolicy registers a new resource with the given unique name, arguments, and options. 392 func NewPolicy(ctx *pulumi.Context, 393 name string, args *PolicyArgs, opts ...pulumi.ResourceOption) (*Policy, error) { 394 if args == nil { 395 return nil, errors.New("missing one or more required arguments") 396 } 397 398 if args.AutoscalingGroupName == nil { 399 return nil, errors.New("invalid value for required argument 'AutoscalingGroupName'") 400 } 401 opts = internal.PkgResourceDefaultOpts(opts) 402 var resource Policy 403 err := ctx.RegisterResource("aws:autoscaling/policy:Policy", name, args, &resource, opts...) 404 if err != nil { 405 return nil, err 406 } 407 return &resource, nil 408 } 409 410 // GetPolicy gets an existing Policy resource's state with the given name, ID, and optional 411 // state properties that are used to uniquely qualify the lookup (nil if not required). 412 func GetPolicy(ctx *pulumi.Context, 413 name string, id pulumi.IDInput, state *PolicyState, opts ...pulumi.ResourceOption) (*Policy, error) { 414 var resource Policy 415 err := ctx.ReadResource("aws:autoscaling/policy:Policy", name, id, state, &resource, opts...) 416 if err != nil { 417 return nil, err 418 } 419 return &resource, nil 420 } 421 422 // Input properties used for looking up and filtering Policy resources. 423 type policyState struct { 424 // Whether the adjustment is an absolute number or a percentage of the current capacity. Valid values are `ChangeInCapacity`, `ExactCapacity`, and `PercentChangeInCapacity`. 425 AdjustmentType *string `pulumi:"adjustmentType"` 426 // ARN assigned by AWS to the scaling policy. 427 Arn *string `pulumi:"arn"` 428 // Name of the autoscaling group. 429 AutoscalingGroupName *string `pulumi:"autoscalingGroupName"` 430 // Amount of time, in seconds, after a scaling activity completes and before the next scaling activity can start. 431 Cooldown *int `pulumi:"cooldown"` 432 // Whether the scaling policy is enabled or disabled. Default: `true`. 433 // 434 // The following argument is only available to "SimpleScaling" and "StepScaling" type policies: 435 Enabled *bool `pulumi:"enabled"` 436 // Estimated time, in seconds, until a newly launched instance will contribute CloudWatch metrics. Without a value, AWS will default to the group's specified cooldown period. 437 EstimatedInstanceWarmup *int `pulumi:"estimatedInstanceWarmup"` 438 // Aggregation type for the policy's metrics. Valid values are "Minimum", "Maximum", and "Average". Without a value, AWS will treat the aggregation type as "Average". 439 MetricAggregationType *string `pulumi:"metricAggregationType"` 440 // Minimum value to scale by when `adjustmentType` is set to `PercentChangeInCapacity`. 441 // 442 // The following arguments are only available to "SimpleScaling" type policies: 443 MinAdjustmentMagnitude *int `pulumi:"minAdjustmentMagnitude"` 444 // Name of the policy. 445 Name *string `pulumi:"name"` 446 // Policy type, either "SimpleScaling", "StepScaling", "TargetTrackingScaling", or "PredictiveScaling". If this value isn't provided, AWS will default to "SimpleScaling." 447 PolicyType *string `pulumi:"policyType"` 448 // Predictive scaling policy configuration to use with Amazon EC2 Auto Scaling. 449 PredictiveScalingConfiguration *PolicyPredictiveScalingConfiguration `pulumi:"predictiveScalingConfiguration"` 450 // Number of members by which to 451 // scale, when the adjustment bounds are breached. A positive value scales 452 // up. A negative value scales down. 453 ScalingAdjustment *int `pulumi:"scalingAdjustment"` 454 // Set of adjustments that manage 455 // group scaling. These have the following structure: 456 // 457 // <!--Start PulumiCodeChooser --> 458 // ```go 459 // package main 460 // 461 // import ( 462 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/autoscaling" 463 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 464 // ) 465 // 466 // func main() { 467 // pulumi.Run(func(ctx *pulumi.Context) error { 468 // _, err := autoscaling.NewPolicy(ctx, "example", &autoscaling.PolicyArgs{ 469 // StepAdjustments: autoscaling.PolicyStepAdjustmentArray{ 470 // &autoscaling.PolicyStepAdjustmentArgs{ 471 // ScalingAdjustment: -1, 472 // MetricIntervalLowerBound: pulumi.String("1"), 473 // MetricIntervalUpperBound: pulumi.String("2"), 474 // }, 475 // &autoscaling.PolicyStepAdjustmentArgs{ 476 // ScalingAdjustment: pulumi.Int(1), 477 // MetricIntervalLowerBound: pulumi.String("2"), 478 // MetricIntervalUpperBound: pulumi.String("3"), 479 // }, 480 // }, 481 // }) 482 // if err != nil { 483 // return err 484 // } 485 // return nil 486 // }) 487 // } 488 // ``` 489 // <!--End PulumiCodeChooser --> 490 // 491 // The following fields are available in step adjustments: 492 StepAdjustments []PolicyStepAdjustment `pulumi:"stepAdjustments"` 493 // Target tracking policy. These have the following structure: 494 // 495 // <!--Start PulumiCodeChooser --> 496 // ```go 497 // package main 498 // 499 // import ( 500 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/autoscaling" 501 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 502 // ) 503 // 504 // func main() { 505 // pulumi.Run(func(ctx *pulumi.Context) error { 506 // _, err := autoscaling.NewPolicy(ctx, "example", &autoscaling.PolicyArgs{ 507 // TargetTrackingConfiguration: &autoscaling.PolicyTargetTrackingConfigurationArgs{ 508 // PredefinedMetricSpecification: &autoscaling.PolicyTargetTrackingConfigurationPredefinedMetricSpecificationArgs{ 509 // PredefinedMetricType: pulumi.String("ASGAverageCPUUtilization"), 510 // }, 511 // TargetValue: pulumi.Float64(40), 512 // }, 513 // }) 514 // if err != nil { 515 // return err 516 // } 517 // return nil 518 // }) 519 // } 520 // ``` 521 // <!--End PulumiCodeChooser --> 522 // 523 // The following fields are available in target tracking configuration: 524 TargetTrackingConfiguration *PolicyTargetTrackingConfiguration `pulumi:"targetTrackingConfiguration"` 525 } 526 527 type PolicyState struct { 528 // Whether the adjustment is an absolute number or a percentage of the current capacity. Valid values are `ChangeInCapacity`, `ExactCapacity`, and `PercentChangeInCapacity`. 529 AdjustmentType pulumi.StringPtrInput 530 // ARN assigned by AWS to the scaling policy. 531 Arn pulumi.StringPtrInput 532 // Name of the autoscaling group. 533 AutoscalingGroupName pulumi.StringPtrInput 534 // Amount of time, in seconds, after a scaling activity completes and before the next scaling activity can start. 535 Cooldown pulumi.IntPtrInput 536 // Whether the scaling policy is enabled or disabled. Default: `true`. 537 // 538 // The following argument is only available to "SimpleScaling" and "StepScaling" type policies: 539 Enabled pulumi.BoolPtrInput 540 // Estimated time, in seconds, until a newly launched instance will contribute CloudWatch metrics. Without a value, AWS will default to the group's specified cooldown period. 541 EstimatedInstanceWarmup pulumi.IntPtrInput 542 // Aggregation type for the policy's metrics. Valid values are "Minimum", "Maximum", and "Average". Without a value, AWS will treat the aggregation type as "Average". 543 MetricAggregationType pulumi.StringPtrInput 544 // Minimum value to scale by when `adjustmentType` is set to `PercentChangeInCapacity`. 545 // 546 // The following arguments are only available to "SimpleScaling" type policies: 547 MinAdjustmentMagnitude pulumi.IntPtrInput 548 // Name of the policy. 549 Name pulumi.StringPtrInput 550 // Policy type, either "SimpleScaling", "StepScaling", "TargetTrackingScaling", or "PredictiveScaling". If this value isn't provided, AWS will default to "SimpleScaling." 551 PolicyType pulumi.StringPtrInput 552 // Predictive scaling policy configuration to use with Amazon EC2 Auto Scaling. 553 PredictiveScalingConfiguration PolicyPredictiveScalingConfigurationPtrInput 554 // Number of members by which to 555 // scale, when the adjustment bounds are breached. A positive value scales 556 // up. A negative value scales down. 557 ScalingAdjustment pulumi.IntPtrInput 558 // Set of adjustments that manage 559 // group scaling. These have the following structure: 560 // 561 // <!--Start PulumiCodeChooser --> 562 // ```go 563 // package main 564 // 565 // import ( 566 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/autoscaling" 567 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 568 // ) 569 // 570 // func main() { 571 // pulumi.Run(func(ctx *pulumi.Context) error { 572 // _, err := autoscaling.NewPolicy(ctx, "example", &autoscaling.PolicyArgs{ 573 // StepAdjustments: autoscaling.PolicyStepAdjustmentArray{ 574 // &autoscaling.PolicyStepAdjustmentArgs{ 575 // ScalingAdjustment: -1, 576 // MetricIntervalLowerBound: pulumi.String("1"), 577 // MetricIntervalUpperBound: pulumi.String("2"), 578 // }, 579 // &autoscaling.PolicyStepAdjustmentArgs{ 580 // ScalingAdjustment: pulumi.Int(1), 581 // MetricIntervalLowerBound: pulumi.String("2"), 582 // MetricIntervalUpperBound: pulumi.String("3"), 583 // }, 584 // }, 585 // }) 586 // if err != nil { 587 // return err 588 // } 589 // return nil 590 // }) 591 // } 592 // ``` 593 // <!--End PulumiCodeChooser --> 594 // 595 // The following fields are available in step adjustments: 596 StepAdjustments PolicyStepAdjustmentArrayInput 597 // Target tracking policy. These have the following structure: 598 // 599 // <!--Start PulumiCodeChooser --> 600 // ```go 601 // package main 602 // 603 // import ( 604 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/autoscaling" 605 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 606 // ) 607 // 608 // func main() { 609 // pulumi.Run(func(ctx *pulumi.Context) error { 610 // _, err := autoscaling.NewPolicy(ctx, "example", &autoscaling.PolicyArgs{ 611 // TargetTrackingConfiguration: &autoscaling.PolicyTargetTrackingConfigurationArgs{ 612 // PredefinedMetricSpecification: &autoscaling.PolicyTargetTrackingConfigurationPredefinedMetricSpecificationArgs{ 613 // PredefinedMetricType: pulumi.String("ASGAverageCPUUtilization"), 614 // }, 615 // TargetValue: pulumi.Float64(40), 616 // }, 617 // }) 618 // if err != nil { 619 // return err 620 // } 621 // return nil 622 // }) 623 // } 624 // ``` 625 // <!--End PulumiCodeChooser --> 626 // 627 // The following fields are available in target tracking configuration: 628 TargetTrackingConfiguration PolicyTargetTrackingConfigurationPtrInput 629 } 630 631 func (PolicyState) ElementType() reflect.Type { 632 return reflect.TypeOf((*policyState)(nil)).Elem() 633 } 634 635 type policyArgs struct { 636 // Whether the adjustment is an absolute number or a percentage of the current capacity. Valid values are `ChangeInCapacity`, `ExactCapacity`, and `PercentChangeInCapacity`. 637 AdjustmentType *string `pulumi:"adjustmentType"` 638 // Name of the autoscaling group. 639 AutoscalingGroupName string `pulumi:"autoscalingGroupName"` 640 // Amount of time, in seconds, after a scaling activity completes and before the next scaling activity can start. 641 Cooldown *int `pulumi:"cooldown"` 642 // Whether the scaling policy is enabled or disabled. Default: `true`. 643 // 644 // The following argument is only available to "SimpleScaling" and "StepScaling" type policies: 645 Enabled *bool `pulumi:"enabled"` 646 // Estimated time, in seconds, until a newly launched instance will contribute CloudWatch metrics. Without a value, AWS will default to the group's specified cooldown period. 647 EstimatedInstanceWarmup *int `pulumi:"estimatedInstanceWarmup"` 648 // Aggregation type for the policy's metrics. Valid values are "Minimum", "Maximum", and "Average". Without a value, AWS will treat the aggregation type as "Average". 649 MetricAggregationType *string `pulumi:"metricAggregationType"` 650 // Minimum value to scale by when `adjustmentType` is set to `PercentChangeInCapacity`. 651 // 652 // The following arguments are only available to "SimpleScaling" type policies: 653 MinAdjustmentMagnitude *int `pulumi:"minAdjustmentMagnitude"` 654 // Name of the policy. 655 Name *string `pulumi:"name"` 656 // Policy type, either "SimpleScaling", "StepScaling", "TargetTrackingScaling", or "PredictiveScaling". If this value isn't provided, AWS will default to "SimpleScaling." 657 PolicyType *string `pulumi:"policyType"` 658 // Predictive scaling policy configuration to use with Amazon EC2 Auto Scaling. 659 PredictiveScalingConfiguration *PolicyPredictiveScalingConfiguration `pulumi:"predictiveScalingConfiguration"` 660 // Number of members by which to 661 // scale, when the adjustment bounds are breached. A positive value scales 662 // up. A negative value scales down. 663 ScalingAdjustment *int `pulumi:"scalingAdjustment"` 664 // Set of adjustments that manage 665 // group scaling. These have the following structure: 666 // 667 // <!--Start PulumiCodeChooser --> 668 // ```go 669 // package main 670 // 671 // import ( 672 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/autoscaling" 673 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 674 // ) 675 // 676 // func main() { 677 // pulumi.Run(func(ctx *pulumi.Context) error { 678 // _, err := autoscaling.NewPolicy(ctx, "example", &autoscaling.PolicyArgs{ 679 // StepAdjustments: autoscaling.PolicyStepAdjustmentArray{ 680 // &autoscaling.PolicyStepAdjustmentArgs{ 681 // ScalingAdjustment: -1, 682 // MetricIntervalLowerBound: pulumi.String("1"), 683 // MetricIntervalUpperBound: pulumi.String("2"), 684 // }, 685 // &autoscaling.PolicyStepAdjustmentArgs{ 686 // ScalingAdjustment: pulumi.Int(1), 687 // MetricIntervalLowerBound: pulumi.String("2"), 688 // MetricIntervalUpperBound: pulumi.String("3"), 689 // }, 690 // }, 691 // }) 692 // if err != nil { 693 // return err 694 // } 695 // return nil 696 // }) 697 // } 698 // ``` 699 // <!--End PulumiCodeChooser --> 700 // 701 // The following fields are available in step adjustments: 702 StepAdjustments []PolicyStepAdjustment `pulumi:"stepAdjustments"` 703 // Target tracking policy. These have the following structure: 704 // 705 // <!--Start PulumiCodeChooser --> 706 // ```go 707 // package main 708 // 709 // import ( 710 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/autoscaling" 711 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 712 // ) 713 // 714 // func main() { 715 // pulumi.Run(func(ctx *pulumi.Context) error { 716 // _, err := autoscaling.NewPolicy(ctx, "example", &autoscaling.PolicyArgs{ 717 // TargetTrackingConfiguration: &autoscaling.PolicyTargetTrackingConfigurationArgs{ 718 // PredefinedMetricSpecification: &autoscaling.PolicyTargetTrackingConfigurationPredefinedMetricSpecificationArgs{ 719 // PredefinedMetricType: pulumi.String("ASGAverageCPUUtilization"), 720 // }, 721 // TargetValue: pulumi.Float64(40), 722 // }, 723 // }) 724 // if err != nil { 725 // return err 726 // } 727 // return nil 728 // }) 729 // } 730 // ``` 731 // <!--End PulumiCodeChooser --> 732 // 733 // The following fields are available in target tracking configuration: 734 TargetTrackingConfiguration *PolicyTargetTrackingConfiguration `pulumi:"targetTrackingConfiguration"` 735 } 736 737 // The set of arguments for constructing a Policy resource. 738 type PolicyArgs struct { 739 // Whether the adjustment is an absolute number or a percentage of the current capacity. Valid values are `ChangeInCapacity`, `ExactCapacity`, and `PercentChangeInCapacity`. 740 AdjustmentType pulumi.StringPtrInput 741 // Name of the autoscaling group. 742 AutoscalingGroupName pulumi.StringInput 743 // Amount of time, in seconds, after a scaling activity completes and before the next scaling activity can start. 744 Cooldown pulumi.IntPtrInput 745 // Whether the scaling policy is enabled or disabled. Default: `true`. 746 // 747 // The following argument is only available to "SimpleScaling" and "StepScaling" type policies: 748 Enabled pulumi.BoolPtrInput 749 // Estimated time, in seconds, until a newly launched instance will contribute CloudWatch metrics. Without a value, AWS will default to the group's specified cooldown period. 750 EstimatedInstanceWarmup pulumi.IntPtrInput 751 // Aggregation type for the policy's metrics. Valid values are "Minimum", "Maximum", and "Average". Without a value, AWS will treat the aggregation type as "Average". 752 MetricAggregationType pulumi.StringPtrInput 753 // Minimum value to scale by when `adjustmentType` is set to `PercentChangeInCapacity`. 754 // 755 // The following arguments are only available to "SimpleScaling" type policies: 756 MinAdjustmentMagnitude pulumi.IntPtrInput 757 // Name of the policy. 758 Name pulumi.StringPtrInput 759 // Policy type, either "SimpleScaling", "StepScaling", "TargetTrackingScaling", or "PredictiveScaling". If this value isn't provided, AWS will default to "SimpleScaling." 760 PolicyType pulumi.StringPtrInput 761 // Predictive scaling policy configuration to use with Amazon EC2 Auto Scaling. 762 PredictiveScalingConfiguration PolicyPredictiveScalingConfigurationPtrInput 763 // Number of members by which to 764 // scale, when the adjustment bounds are breached. A positive value scales 765 // up. A negative value scales down. 766 ScalingAdjustment pulumi.IntPtrInput 767 // Set of adjustments that manage 768 // group scaling. These have the following structure: 769 // 770 // <!--Start PulumiCodeChooser --> 771 // ```go 772 // package main 773 // 774 // import ( 775 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/autoscaling" 776 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 777 // ) 778 // 779 // func main() { 780 // pulumi.Run(func(ctx *pulumi.Context) error { 781 // _, err := autoscaling.NewPolicy(ctx, "example", &autoscaling.PolicyArgs{ 782 // StepAdjustments: autoscaling.PolicyStepAdjustmentArray{ 783 // &autoscaling.PolicyStepAdjustmentArgs{ 784 // ScalingAdjustment: -1, 785 // MetricIntervalLowerBound: pulumi.String("1"), 786 // MetricIntervalUpperBound: pulumi.String("2"), 787 // }, 788 // &autoscaling.PolicyStepAdjustmentArgs{ 789 // ScalingAdjustment: pulumi.Int(1), 790 // MetricIntervalLowerBound: pulumi.String("2"), 791 // MetricIntervalUpperBound: pulumi.String("3"), 792 // }, 793 // }, 794 // }) 795 // if err != nil { 796 // return err 797 // } 798 // return nil 799 // }) 800 // } 801 // ``` 802 // <!--End PulumiCodeChooser --> 803 // 804 // The following fields are available in step adjustments: 805 StepAdjustments PolicyStepAdjustmentArrayInput 806 // Target tracking policy. These have the following structure: 807 // 808 // <!--Start PulumiCodeChooser --> 809 // ```go 810 // package main 811 // 812 // import ( 813 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/autoscaling" 814 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 815 // ) 816 // 817 // func main() { 818 // pulumi.Run(func(ctx *pulumi.Context) error { 819 // _, err := autoscaling.NewPolicy(ctx, "example", &autoscaling.PolicyArgs{ 820 // TargetTrackingConfiguration: &autoscaling.PolicyTargetTrackingConfigurationArgs{ 821 // PredefinedMetricSpecification: &autoscaling.PolicyTargetTrackingConfigurationPredefinedMetricSpecificationArgs{ 822 // PredefinedMetricType: pulumi.String("ASGAverageCPUUtilization"), 823 // }, 824 // TargetValue: pulumi.Float64(40), 825 // }, 826 // }) 827 // if err != nil { 828 // return err 829 // } 830 // return nil 831 // }) 832 // } 833 // ``` 834 // <!--End PulumiCodeChooser --> 835 // 836 // The following fields are available in target tracking configuration: 837 TargetTrackingConfiguration PolicyTargetTrackingConfigurationPtrInput 838 } 839 840 func (PolicyArgs) ElementType() reflect.Type { 841 return reflect.TypeOf((*policyArgs)(nil)).Elem() 842 } 843 844 type PolicyInput interface { 845 pulumi.Input 846 847 ToPolicyOutput() PolicyOutput 848 ToPolicyOutputWithContext(ctx context.Context) PolicyOutput 849 } 850 851 func (*Policy) ElementType() reflect.Type { 852 return reflect.TypeOf((**Policy)(nil)).Elem() 853 } 854 855 func (i *Policy) ToPolicyOutput() PolicyOutput { 856 return i.ToPolicyOutputWithContext(context.Background()) 857 } 858 859 func (i *Policy) ToPolicyOutputWithContext(ctx context.Context) PolicyOutput { 860 return pulumi.ToOutputWithContext(ctx, i).(PolicyOutput) 861 } 862 863 // PolicyArrayInput is an input type that accepts PolicyArray and PolicyArrayOutput values. 864 // You can construct a concrete instance of `PolicyArrayInput` via: 865 // 866 // PolicyArray{ PolicyArgs{...} } 867 type PolicyArrayInput interface { 868 pulumi.Input 869 870 ToPolicyArrayOutput() PolicyArrayOutput 871 ToPolicyArrayOutputWithContext(context.Context) PolicyArrayOutput 872 } 873 874 type PolicyArray []PolicyInput 875 876 func (PolicyArray) ElementType() reflect.Type { 877 return reflect.TypeOf((*[]*Policy)(nil)).Elem() 878 } 879 880 func (i PolicyArray) ToPolicyArrayOutput() PolicyArrayOutput { 881 return i.ToPolicyArrayOutputWithContext(context.Background()) 882 } 883 884 func (i PolicyArray) ToPolicyArrayOutputWithContext(ctx context.Context) PolicyArrayOutput { 885 return pulumi.ToOutputWithContext(ctx, i).(PolicyArrayOutput) 886 } 887 888 // PolicyMapInput is an input type that accepts PolicyMap and PolicyMapOutput values. 889 // You can construct a concrete instance of `PolicyMapInput` via: 890 // 891 // PolicyMap{ "key": PolicyArgs{...} } 892 type PolicyMapInput interface { 893 pulumi.Input 894 895 ToPolicyMapOutput() PolicyMapOutput 896 ToPolicyMapOutputWithContext(context.Context) PolicyMapOutput 897 } 898 899 type PolicyMap map[string]PolicyInput 900 901 func (PolicyMap) ElementType() reflect.Type { 902 return reflect.TypeOf((*map[string]*Policy)(nil)).Elem() 903 } 904 905 func (i PolicyMap) ToPolicyMapOutput() PolicyMapOutput { 906 return i.ToPolicyMapOutputWithContext(context.Background()) 907 } 908 909 func (i PolicyMap) ToPolicyMapOutputWithContext(ctx context.Context) PolicyMapOutput { 910 return pulumi.ToOutputWithContext(ctx, i).(PolicyMapOutput) 911 } 912 913 type PolicyOutput struct{ *pulumi.OutputState } 914 915 func (PolicyOutput) ElementType() reflect.Type { 916 return reflect.TypeOf((**Policy)(nil)).Elem() 917 } 918 919 func (o PolicyOutput) ToPolicyOutput() PolicyOutput { 920 return o 921 } 922 923 func (o PolicyOutput) ToPolicyOutputWithContext(ctx context.Context) PolicyOutput { 924 return o 925 } 926 927 // Whether the adjustment is an absolute number or a percentage of the current capacity. Valid values are `ChangeInCapacity`, `ExactCapacity`, and `PercentChangeInCapacity`. 928 func (o PolicyOutput) AdjustmentType() pulumi.StringPtrOutput { 929 return o.ApplyT(func(v *Policy) pulumi.StringPtrOutput { return v.AdjustmentType }).(pulumi.StringPtrOutput) 930 } 931 932 // ARN assigned by AWS to the scaling policy. 933 func (o PolicyOutput) Arn() pulumi.StringOutput { 934 return o.ApplyT(func(v *Policy) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 935 } 936 937 // Name of the autoscaling group. 938 func (o PolicyOutput) AutoscalingGroupName() pulumi.StringOutput { 939 return o.ApplyT(func(v *Policy) pulumi.StringOutput { return v.AutoscalingGroupName }).(pulumi.StringOutput) 940 } 941 942 // Amount of time, in seconds, after a scaling activity completes and before the next scaling activity can start. 943 func (o PolicyOutput) Cooldown() pulumi.IntPtrOutput { 944 return o.ApplyT(func(v *Policy) pulumi.IntPtrOutput { return v.Cooldown }).(pulumi.IntPtrOutput) 945 } 946 947 // Whether the scaling policy is enabled or disabled. Default: `true`. 948 // 949 // The following argument is only available to "SimpleScaling" and "StepScaling" type policies: 950 func (o PolicyOutput) Enabled() pulumi.BoolPtrOutput { 951 return o.ApplyT(func(v *Policy) pulumi.BoolPtrOutput { return v.Enabled }).(pulumi.BoolPtrOutput) 952 } 953 954 // Estimated time, in seconds, until a newly launched instance will contribute CloudWatch metrics. Without a value, AWS will default to the group's specified cooldown period. 955 func (o PolicyOutput) EstimatedInstanceWarmup() pulumi.IntPtrOutput { 956 return o.ApplyT(func(v *Policy) pulumi.IntPtrOutput { return v.EstimatedInstanceWarmup }).(pulumi.IntPtrOutput) 957 } 958 959 // Aggregation type for the policy's metrics. Valid values are "Minimum", "Maximum", and "Average". Without a value, AWS will treat the aggregation type as "Average". 960 func (o PolicyOutput) MetricAggregationType() pulumi.StringOutput { 961 return o.ApplyT(func(v *Policy) pulumi.StringOutput { return v.MetricAggregationType }).(pulumi.StringOutput) 962 } 963 964 // Minimum value to scale by when `adjustmentType` is set to `PercentChangeInCapacity`. 965 // 966 // The following arguments are only available to "SimpleScaling" type policies: 967 func (o PolicyOutput) MinAdjustmentMagnitude() pulumi.IntPtrOutput { 968 return o.ApplyT(func(v *Policy) pulumi.IntPtrOutput { return v.MinAdjustmentMagnitude }).(pulumi.IntPtrOutput) 969 } 970 971 // Name of the policy. 972 func (o PolicyOutput) Name() pulumi.StringOutput { 973 return o.ApplyT(func(v *Policy) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 974 } 975 976 // Policy type, either "SimpleScaling", "StepScaling", "TargetTrackingScaling", or "PredictiveScaling". If this value isn't provided, AWS will default to "SimpleScaling." 977 func (o PolicyOutput) PolicyType() pulumi.StringPtrOutput { 978 return o.ApplyT(func(v *Policy) pulumi.StringPtrOutput { return v.PolicyType }).(pulumi.StringPtrOutput) 979 } 980 981 // Predictive scaling policy configuration to use with Amazon EC2 Auto Scaling. 982 func (o PolicyOutput) PredictiveScalingConfiguration() PolicyPredictiveScalingConfigurationPtrOutput { 983 return o.ApplyT(func(v *Policy) PolicyPredictiveScalingConfigurationPtrOutput { return v.PredictiveScalingConfiguration }).(PolicyPredictiveScalingConfigurationPtrOutput) 984 } 985 986 // Number of members by which to 987 // scale, when the adjustment bounds are breached. A positive value scales 988 // up. A negative value scales down. 989 func (o PolicyOutput) ScalingAdjustment() pulumi.IntPtrOutput { 990 return o.ApplyT(func(v *Policy) pulumi.IntPtrOutput { return v.ScalingAdjustment }).(pulumi.IntPtrOutput) 991 } 992 993 // Set of adjustments that manage 994 // group scaling. These have the following structure: 995 // 996 // <!--Start PulumiCodeChooser --> 997 // ```go 998 // package main 999 // 1000 // import ( 1001 // 1002 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/autoscaling" 1003 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 1004 // 1005 // ) 1006 // 1007 // func main() { 1008 // pulumi.Run(func(ctx *pulumi.Context) error { 1009 // _, err := autoscaling.NewPolicy(ctx, "example", &autoscaling.PolicyArgs{ 1010 // StepAdjustments: autoscaling.PolicyStepAdjustmentArray{ 1011 // &autoscaling.PolicyStepAdjustmentArgs{ 1012 // ScalingAdjustment: -1, 1013 // MetricIntervalLowerBound: pulumi.String("1"), 1014 // MetricIntervalUpperBound: pulumi.String("2"), 1015 // }, 1016 // &autoscaling.PolicyStepAdjustmentArgs{ 1017 // ScalingAdjustment: pulumi.Int(1), 1018 // MetricIntervalLowerBound: pulumi.String("2"), 1019 // MetricIntervalUpperBound: pulumi.String("3"), 1020 // }, 1021 // }, 1022 // }) 1023 // if err != nil { 1024 // return err 1025 // } 1026 // return nil 1027 // }) 1028 // } 1029 // 1030 // ``` 1031 // <!--End PulumiCodeChooser --> 1032 // 1033 // The following fields are available in step adjustments: 1034 func (o PolicyOutput) StepAdjustments() PolicyStepAdjustmentArrayOutput { 1035 return o.ApplyT(func(v *Policy) PolicyStepAdjustmentArrayOutput { return v.StepAdjustments }).(PolicyStepAdjustmentArrayOutput) 1036 } 1037 1038 // Target tracking policy. These have the following structure: 1039 // 1040 // <!--Start PulumiCodeChooser --> 1041 // ```go 1042 // package main 1043 // 1044 // import ( 1045 // 1046 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/autoscaling" 1047 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 1048 // 1049 // ) 1050 // 1051 // func main() { 1052 // pulumi.Run(func(ctx *pulumi.Context) error { 1053 // _, err := autoscaling.NewPolicy(ctx, "example", &autoscaling.PolicyArgs{ 1054 // TargetTrackingConfiguration: &autoscaling.PolicyTargetTrackingConfigurationArgs{ 1055 // PredefinedMetricSpecification: &autoscaling.PolicyTargetTrackingConfigurationPredefinedMetricSpecificationArgs{ 1056 // PredefinedMetricType: pulumi.String("ASGAverageCPUUtilization"), 1057 // }, 1058 // TargetValue: pulumi.Float64(40), 1059 // }, 1060 // }) 1061 // if err != nil { 1062 // return err 1063 // } 1064 // return nil 1065 // }) 1066 // } 1067 // 1068 // ``` 1069 // <!--End PulumiCodeChooser --> 1070 // 1071 // The following fields are available in target tracking configuration: 1072 func (o PolicyOutput) TargetTrackingConfiguration() PolicyTargetTrackingConfigurationPtrOutput { 1073 return o.ApplyT(func(v *Policy) PolicyTargetTrackingConfigurationPtrOutput { return v.TargetTrackingConfiguration }).(PolicyTargetTrackingConfigurationPtrOutput) 1074 } 1075 1076 type PolicyArrayOutput struct{ *pulumi.OutputState } 1077 1078 func (PolicyArrayOutput) ElementType() reflect.Type { 1079 return reflect.TypeOf((*[]*Policy)(nil)).Elem() 1080 } 1081 1082 func (o PolicyArrayOutput) ToPolicyArrayOutput() PolicyArrayOutput { 1083 return o 1084 } 1085 1086 func (o PolicyArrayOutput) ToPolicyArrayOutputWithContext(ctx context.Context) PolicyArrayOutput { 1087 return o 1088 } 1089 1090 func (o PolicyArrayOutput) Index(i pulumi.IntInput) PolicyOutput { 1091 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Policy { 1092 return vs[0].([]*Policy)[vs[1].(int)] 1093 }).(PolicyOutput) 1094 } 1095 1096 type PolicyMapOutput struct{ *pulumi.OutputState } 1097 1098 func (PolicyMapOutput) ElementType() reflect.Type { 1099 return reflect.TypeOf((*map[string]*Policy)(nil)).Elem() 1100 } 1101 1102 func (o PolicyMapOutput) ToPolicyMapOutput() PolicyMapOutput { 1103 return o 1104 } 1105 1106 func (o PolicyMapOutput) ToPolicyMapOutputWithContext(ctx context.Context) PolicyMapOutput { 1107 return o 1108 } 1109 1110 func (o PolicyMapOutput) MapIndex(k pulumi.StringInput) PolicyOutput { 1111 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Policy { 1112 return vs[0].(map[string]*Policy)[vs[1].(string)] 1113 }).(PolicyOutput) 1114 } 1115 1116 func init() { 1117 pulumi.RegisterInputType(reflect.TypeOf((*PolicyInput)(nil)).Elem(), &Policy{}) 1118 pulumi.RegisterInputType(reflect.TypeOf((*PolicyArrayInput)(nil)).Elem(), PolicyArray{}) 1119 pulumi.RegisterInputType(reflect.TypeOf((*PolicyMapInput)(nil)).Elem(), PolicyMap{}) 1120 pulumi.RegisterOutputType(PolicyOutput{}) 1121 pulumi.RegisterOutputType(PolicyArrayOutput{}) 1122 pulumi.RegisterOutputType(PolicyMapOutput{}) 1123 }