github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/autoscaling/schedule.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 Schedule resource. 16 // 17 // ## Example Usage 18 // 19 // <!--Start PulumiCodeChooser --> 20 // ```go 21 // package main 22 // 23 // import ( 24 // 25 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/autoscaling" 26 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 27 // 28 // ) 29 // 30 // func main() { 31 // pulumi.Run(func(ctx *pulumi.Context) error { 32 // foobar, err := autoscaling.NewGroup(ctx, "foobar", &autoscaling.GroupArgs{ 33 // AvailabilityZones: pulumi.StringArray{ 34 // pulumi.String("us-west-2a"), 35 // }, 36 // Name: pulumi.String("test-foobar5"), 37 // MaxSize: pulumi.Int(1), 38 // MinSize: pulumi.Int(1), 39 // HealthCheckGracePeriod: pulumi.Int(300), 40 // HealthCheckType: pulumi.String("ELB"), 41 // ForceDelete: pulumi.Bool(true), 42 // TerminationPolicies: pulumi.StringArray{ 43 // pulumi.String("OldestInstance"), 44 // }, 45 // }) 46 // if err != nil { 47 // return err 48 // } 49 // _, err = autoscaling.NewSchedule(ctx, "foobar", &autoscaling.ScheduleArgs{ 50 // ScheduledActionName: pulumi.String("foobar"), 51 // MinSize: pulumi.Int(0), 52 // MaxSize: pulumi.Int(1), 53 // DesiredCapacity: pulumi.Int(0), 54 // StartTime: pulumi.String("2016-12-11T18:00:00Z"), 55 // EndTime: pulumi.String("2016-12-12T06:00:00Z"), 56 // AutoscalingGroupName: foobar.Name, 57 // }) 58 // if err != nil { 59 // return err 60 // } 61 // return nil 62 // }) 63 // } 64 // 65 // ``` 66 // <!--End PulumiCodeChooser --> 67 // 68 // ## Import 69 // 70 // Using `pulumi import`, import AutoScaling ScheduledAction using the `auto-scaling-group-name` and `scheduled-action-name`. For example: 71 // 72 // ```sh 73 // $ pulumi import aws:autoscaling/schedule:Schedule resource-name auto-scaling-group-name/scheduled-action-name 74 // ``` 75 type Schedule struct { 76 pulumi.CustomResourceState 77 78 // ARN assigned by AWS to the autoscaling schedule. 79 Arn pulumi.StringOutput `pulumi:"arn"` 80 // The name of the Auto Scaling group. 81 AutoscalingGroupName pulumi.StringOutput `pulumi:"autoscalingGroupName"` 82 // The initial capacity of the Auto Scaling group after the scheduled action runs and the capacity it attempts to maintain. Set to `-1` if you don't want to change the desired capacity at the scheduled time. Defaults to `0`. 83 DesiredCapacity pulumi.IntOutput `pulumi:"desiredCapacity"` 84 // The date and time for the recurring schedule to end, in UTC with the format `"YYYY-MM-DDThh:mm:ssZ"` (e.g. `"2021-06-01T00:00:00Z"`). 85 EndTime pulumi.StringOutput `pulumi:"endTime"` 86 // The maximum size of the Auto Scaling group. Set to `-1` if you don't want to change the maximum size at the scheduled time. Defaults to `0`. 87 MaxSize pulumi.IntOutput `pulumi:"maxSize"` 88 // The minimum size of the Auto Scaling group. Set to `-1` if you don't want to change the minimum size at the scheduled time. Defaults to `0`. 89 MinSize pulumi.IntOutput `pulumi:"minSize"` 90 // The recurring schedule for this action specified using the Unix cron syntax format. 91 Recurrence pulumi.StringOutput `pulumi:"recurrence"` 92 // The name of this scaling action. 93 // 94 // The following arguments are optional: 95 ScheduledActionName pulumi.StringOutput `pulumi:"scheduledActionName"` 96 // The date and time for the recurring schedule to start, in UTC with the format `"YYYY-MM-DDThh:mm:ssZ"` (e.g. `"2021-06-01T00:00:00Z"`). 97 StartTime pulumi.StringOutput `pulumi:"startTime"` 98 // Specifies the time zone for a cron expression. Valid values are the canonical names of the IANA time zones (such as `Etc/GMT+9` or `Pacific/Tahiti`). 99 // 100 // > **NOTE:** When `startTime` and `endTime` are specified with `recurrence` , they form the boundaries of when the recurring action will start and stop. 101 TimeZone pulumi.StringOutput `pulumi:"timeZone"` 102 } 103 104 // NewSchedule registers a new resource with the given unique name, arguments, and options. 105 func NewSchedule(ctx *pulumi.Context, 106 name string, args *ScheduleArgs, opts ...pulumi.ResourceOption) (*Schedule, error) { 107 if args == nil { 108 return nil, errors.New("missing one or more required arguments") 109 } 110 111 if args.AutoscalingGroupName == nil { 112 return nil, errors.New("invalid value for required argument 'AutoscalingGroupName'") 113 } 114 if args.ScheduledActionName == nil { 115 return nil, errors.New("invalid value for required argument 'ScheduledActionName'") 116 } 117 opts = internal.PkgResourceDefaultOpts(opts) 118 var resource Schedule 119 err := ctx.RegisterResource("aws:autoscaling/schedule:Schedule", name, args, &resource, opts...) 120 if err != nil { 121 return nil, err 122 } 123 return &resource, nil 124 } 125 126 // GetSchedule gets an existing Schedule resource's state with the given name, ID, and optional 127 // state properties that are used to uniquely qualify the lookup (nil if not required). 128 func GetSchedule(ctx *pulumi.Context, 129 name string, id pulumi.IDInput, state *ScheduleState, opts ...pulumi.ResourceOption) (*Schedule, error) { 130 var resource Schedule 131 err := ctx.ReadResource("aws:autoscaling/schedule:Schedule", name, id, state, &resource, opts...) 132 if err != nil { 133 return nil, err 134 } 135 return &resource, nil 136 } 137 138 // Input properties used for looking up and filtering Schedule resources. 139 type scheduleState struct { 140 // ARN assigned by AWS to the autoscaling schedule. 141 Arn *string `pulumi:"arn"` 142 // The name of the Auto Scaling group. 143 AutoscalingGroupName *string `pulumi:"autoscalingGroupName"` 144 // The initial capacity of the Auto Scaling group after the scheduled action runs and the capacity it attempts to maintain. Set to `-1` if you don't want to change the desired capacity at the scheduled time. Defaults to `0`. 145 DesiredCapacity *int `pulumi:"desiredCapacity"` 146 // The date and time for the recurring schedule to end, in UTC with the format `"YYYY-MM-DDThh:mm:ssZ"` (e.g. `"2021-06-01T00:00:00Z"`). 147 EndTime *string `pulumi:"endTime"` 148 // The maximum size of the Auto Scaling group. Set to `-1` if you don't want to change the maximum size at the scheduled time. Defaults to `0`. 149 MaxSize *int `pulumi:"maxSize"` 150 // The minimum size of the Auto Scaling group. Set to `-1` if you don't want to change the minimum size at the scheduled time. Defaults to `0`. 151 MinSize *int `pulumi:"minSize"` 152 // The recurring schedule for this action specified using the Unix cron syntax format. 153 Recurrence *string `pulumi:"recurrence"` 154 // The name of this scaling action. 155 // 156 // The following arguments are optional: 157 ScheduledActionName *string `pulumi:"scheduledActionName"` 158 // The date and time for the recurring schedule to start, in UTC with the format `"YYYY-MM-DDThh:mm:ssZ"` (e.g. `"2021-06-01T00:00:00Z"`). 159 StartTime *string `pulumi:"startTime"` 160 // Specifies the time zone for a cron expression. Valid values are the canonical names of the IANA time zones (such as `Etc/GMT+9` or `Pacific/Tahiti`). 161 // 162 // > **NOTE:** When `startTime` and `endTime` are specified with `recurrence` , they form the boundaries of when the recurring action will start and stop. 163 TimeZone *string `pulumi:"timeZone"` 164 } 165 166 type ScheduleState struct { 167 // ARN assigned by AWS to the autoscaling schedule. 168 Arn pulumi.StringPtrInput 169 // The name of the Auto Scaling group. 170 AutoscalingGroupName pulumi.StringPtrInput 171 // The initial capacity of the Auto Scaling group after the scheduled action runs and the capacity it attempts to maintain. Set to `-1` if you don't want to change the desired capacity at the scheduled time. Defaults to `0`. 172 DesiredCapacity pulumi.IntPtrInput 173 // The date and time for the recurring schedule to end, in UTC with the format `"YYYY-MM-DDThh:mm:ssZ"` (e.g. `"2021-06-01T00:00:00Z"`). 174 EndTime pulumi.StringPtrInput 175 // The maximum size of the Auto Scaling group. Set to `-1` if you don't want to change the maximum size at the scheduled time. Defaults to `0`. 176 MaxSize pulumi.IntPtrInput 177 // The minimum size of the Auto Scaling group. Set to `-1` if you don't want to change the minimum size at the scheduled time. Defaults to `0`. 178 MinSize pulumi.IntPtrInput 179 // The recurring schedule for this action specified using the Unix cron syntax format. 180 Recurrence pulumi.StringPtrInput 181 // The name of this scaling action. 182 // 183 // The following arguments are optional: 184 ScheduledActionName pulumi.StringPtrInput 185 // The date and time for the recurring schedule to start, in UTC with the format `"YYYY-MM-DDThh:mm:ssZ"` (e.g. `"2021-06-01T00:00:00Z"`). 186 StartTime pulumi.StringPtrInput 187 // Specifies the time zone for a cron expression. Valid values are the canonical names of the IANA time zones (such as `Etc/GMT+9` or `Pacific/Tahiti`). 188 // 189 // > **NOTE:** When `startTime` and `endTime` are specified with `recurrence` , they form the boundaries of when the recurring action will start and stop. 190 TimeZone pulumi.StringPtrInput 191 } 192 193 func (ScheduleState) ElementType() reflect.Type { 194 return reflect.TypeOf((*scheduleState)(nil)).Elem() 195 } 196 197 type scheduleArgs struct { 198 // The name of the Auto Scaling group. 199 AutoscalingGroupName string `pulumi:"autoscalingGroupName"` 200 // The initial capacity of the Auto Scaling group after the scheduled action runs and the capacity it attempts to maintain. Set to `-1` if you don't want to change the desired capacity at the scheduled time. Defaults to `0`. 201 DesiredCapacity *int `pulumi:"desiredCapacity"` 202 // The date and time for the recurring schedule to end, in UTC with the format `"YYYY-MM-DDThh:mm:ssZ"` (e.g. `"2021-06-01T00:00:00Z"`). 203 EndTime *string `pulumi:"endTime"` 204 // The maximum size of the Auto Scaling group. Set to `-1` if you don't want to change the maximum size at the scheduled time. Defaults to `0`. 205 MaxSize *int `pulumi:"maxSize"` 206 // The minimum size of the Auto Scaling group. Set to `-1` if you don't want to change the minimum size at the scheduled time. Defaults to `0`. 207 MinSize *int `pulumi:"minSize"` 208 // The recurring schedule for this action specified using the Unix cron syntax format. 209 Recurrence *string `pulumi:"recurrence"` 210 // The name of this scaling action. 211 // 212 // The following arguments are optional: 213 ScheduledActionName string `pulumi:"scheduledActionName"` 214 // The date and time for the recurring schedule to start, in UTC with the format `"YYYY-MM-DDThh:mm:ssZ"` (e.g. `"2021-06-01T00:00:00Z"`). 215 StartTime *string `pulumi:"startTime"` 216 // Specifies the time zone for a cron expression. Valid values are the canonical names of the IANA time zones (such as `Etc/GMT+9` or `Pacific/Tahiti`). 217 // 218 // > **NOTE:** When `startTime` and `endTime` are specified with `recurrence` , they form the boundaries of when the recurring action will start and stop. 219 TimeZone *string `pulumi:"timeZone"` 220 } 221 222 // The set of arguments for constructing a Schedule resource. 223 type ScheduleArgs struct { 224 // The name of the Auto Scaling group. 225 AutoscalingGroupName pulumi.StringInput 226 // The initial capacity of the Auto Scaling group after the scheduled action runs and the capacity it attempts to maintain. Set to `-1` if you don't want to change the desired capacity at the scheduled time. Defaults to `0`. 227 DesiredCapacity pulumi.IntPtrInput 228 // The date and time for the recurring schedule to end, in UTC with the format `"YYYY-MM-DDThh:mm:ssZ"` (e.g. `"2021-06-01T00:00:00Z"`). 229 EndTime pulumi.StringPtrInput 230 // The maximum size of the Auto Scaling group. Set to `-1` if you don't want to change the maximum size at the scheduled time. Defaults to `0`. 231 MaxSize pulumi.IntPtrInput 232 // The minimum size of the Auto Scaling group. Set to `-1` if you don't want to change the minimum size at the scheduled time. Defaults to `0`. 233 MinSize pulumi.IntPtrInput 234 // The recurring schedule for this action specified using the Unix cron syntax format. 235 Recurrence pulumi.StringPtrInput 236 // The name of this scaling action. 237 // 238 // The following arguments are optional: 239 ScheduledActionName pulumi.StringInput 240 // The date and time for the recurring schedule to start, in UTC with the format `"YYYY-MM-DDThh:mm:ssZ"` (e.g. `"2021-06-01T00:00:00Z"`). 241 StartTime pulumi.StringPtrInput 242 // Specifies the time zone for a cron expression. Valid values are the canonical names of the IANA time zones (such as `Etc/GMT+9` or `Pacific/Tahiti`). 243 // 244 // > **NOTE:** When `startTime` and `endTime` are specified with `recurrence` , they form the boundaries of when the recurring action will start and stop. 245 TimeZone pulumi.StringPtrInput 246 } 247 248 func (ScheduleArgs) ElementType() reflect.Type { 249 return reflect.TypeOf((*scheduleArgs)(nil)).Elem() 250 } 251 252 type ScheduleInput interface { 253 pulumi.Input 254 255 ToScheduleOutput() ScheduleOutput 256 ToScheduleOutputWithContext(ctx context.Context) ScheduleOutput 257 } 258 259 func (*Schedule) ElementType() reflect.Type { 260 return reflect.TypeOf((**Schedule)(nil)).Elem() 261 } 262 263 func (i *Schedule) ToScheduleOutput() ScheduleOutput { 264 return i.ToScheduleOutputWithContext(context.Background()) 265 } 266 267 func (i *Schedule) ToScheduleOutputWithContext(ctx context.Context) ScheduleOutput { 268 return pulumi.ToOutputWithContext(ctx, i).(ScheduleOutput) 269 } 270 271 // ScheduleArrayInput is an input type that accepts ScheduleArray and ScheduleArrayOutput values. 272 // You can construct a concrete instance of `ScheduleArrayInput` via: 273 // 274 // ScheduleArray{ ScheduleArgs{...} } 275 type ScheduleArrayInput interface { 276 pulumi.Input 277 278 ToScheduleArrayOutput() ScheduleArrayOutput 279 ToScheduleArrayOutputWithContext(context.Context) ScheduleArrayOutput 280 } 281 282 type ScheduleArray []ScheduleInput 283 284 func (ScheduleArray) ElementType() reflect.Type { 285 return reflect.TypeOf((*[]*Schedule)(nil)).Elem() 286 } 287 288 func (i ScheduleArray) ToScheduleArrayOutput() ScheduleArrayOutput { 289 return i.ToScheduleArrayOutputWithContext(context.Background()) 290 } 291 292 func (i ScheduleArray) ToScheduleArrayOutputWithContext(ctx context.Context) ScheduleArrayOutput { 293 return pulumi.ToOutputWithContext(ctx, i).(ScheduleArrayOutput) 294 } 295 296 // ScheduleMapInput is an input type that accepts ScheduleMap and ScheduleMapOutput values. 297 // You can construct a concrete instance of `ScheduleMapInput` via: 298 // 299 // ScheduleMap{ "key": ScheduleArgs{...} } 300 type ScheduleMapInput interface { 301 pulumi.Input 302 303 ToScheduleMapOutput() ScheduleMapOutput 304 ToScheduleMapOutputWithContext(context.Context) ScheduleMapOutput 305 } 306 307 type ScheduleMap map[string]ScheduleInput 308 309 func (ScheduleMap) ElementType() reflect.Type { 310 return reflect.TypeOf((*map[string]*Schedule)(nil)).Elem() 311 } 312 313 func (i ScheduleMap) ToScheduleMapOutput() ScheduleMapOutput { 314 return i.ToScheduleMapOutputWithContext(context.Background()) 315 } 316 317 func (i ScheduleMap) ToScheduleMapOutputWithContext(ctx context.Context) ScheduleMapOutput { 318 return pulumi.ToOutputWithContext(ctx, i).(ScheduleMapOutput) 319 } 320 321 type ScheduleOutput struct{ *pulumi.OutputState } 322 323 func (ScheduleOutput) ElementType() reflect.Type { 324 return reflect.TypeOf((**Schedule)(nil)).Elem() 325 } 326 327 func (o ScheduleOutput) ToScheduleOutput() ScheduleOutput { 328 return o 329 } 330 331 func (o ScheduleOutput) ToScheduleOutputWithContext(ctx context.Context) ScheduleOutput { 332 return o 333 } 334 335 // ARN assigned by AWS to the autoscaling schedule. 336 func (o ScheduleOutput) Arn() pulumi.StringOutput { 337 return o.ApplyT(func(v *Schedule) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 338 } 339 340 // The name of the Auto Scaling group. 341 func (o ScheduleOutput) AutoscalingGroupName() pulumi.StringOutput { 342 return o.ApplyT(func(v *Schedule) pulumi.StringOutput { return v.AutoscalingGroupName }).(pulumi.StringOutput) 343 } 344 345 // The initial capacity of the Auto Scaling group after the scheduled action runs and the capacity it attempts to maintain. Set to `-1` if you don't want to change the desired capacity at the scheduled time. Defaults to `0`. 346 func (o ScheduleOutput) DesiredCapacity() pulumi.IntOutput { 347 return o.ApplyT(func(v *Schedule) pulumi.IntOutput { return v.DesiredCapacity }).(pulumi.IntOutput) 348 } 349 350 // The date and time for the recurring schedule to end, in UTC with the format `"YYYY-MM-DDThh:mm:ssZ"` (e.g. `"2021-06-01T00:00:00Z"`). 351 func (o ScheduleOutput) EndTime() pulumi.StringOutput { 352 return o.ApplyT(func(v *Schedule) pulumi.StringOutput { return v.EndTime }).(pulumi.StringOutput) 353 } 354 355 // The maximum size of the Auto Scaling group. Set to `-1` if you don't want to change the maximum size at the scheduled time. Defaults to `0`. 356 func (o ScheduleOutput) MaxSize() pulumi.IntOutput { 357 return o.ApplyT(func(v *Schedule) pulumi.IntOutput { return v.MaxSize }).(pulumi.IntOutput) 358 } 359 360 // The minimum size of the Auto Scaling group. Set to `-1` if you don't want to change the minimum size at the scheduled time. Defaults to `0`. 361 func (o ScheduleOutput) MinSize() pulumi.IntOutput { 362 return o.ApplyT(func(v *Schedule) pulumi.IntOutput { return v.MinSize }).(pulumi.IntOutput) 363 } 364 365 // The recurring schedule for this action specified using the Unix cron syntax format. 366 func (o ScheduleOutput) Recurrence() pulumi.StringOutput { 367 return o.ApplyT(func(v *Schedule) pulumi.StringOutput { return v.Recurrence }).(pulumi.StringOutput) 368 } 369 370 // The name of this scaling action. 371 // 372 // The following arguments are optional: 373 func (o ScheduleOutput) ScheduledActionName() pulumi.StringOutput { 374 return o.ApplyT(func(v *Schedule) pulumi.StringOutput { return v.ScheduledActionName }).(pulumi.StringOutput) 375 } 376 377 // The date and time for the recurring schedule to start, in UTC with the format `"YYYY-MM-DDThh:mm:ssZ"` (e.g. `"2021-06-01T00:00:00Z"`). 378 func (o ScheduleOutput) StartTime() pulumi.StringOutput { 379 return o.ApplyT(func(v *Schedule) pulumi.StringOutput { return v.StartTime }).(pulumi.StringOutput) 380 } 381 382 // Specifies the time zone for a cron expression. Valid values are the canonical names of the IANA time zones (such as `Etc/GMT+9` or `Pacific/Tahiti`). 383 // 384 // > **NOTE:** When `startTime` and `endTime` are specified with `recurrence` , they form the boundaries of when the recurring action will start and stop. 385 func (o ScheduleOutput) TimeZone() pulumi.StringOutput { 386 return o.ApplyT(func(v *Schedule) pulumi.StringOutput { return v.TimeZone }).(pulumi.StringOutput) 387 } 388 389 type ScheduleArrayOutput struct{ *pulumi.OutputState } 390 391 func (ScheduleArrayOutput) ElementType() reflect.Type { 392 return reflect.TypeOf((*[]*Schedule)(nil)).Elem() 393 } 394 395 func (o ScheduleArrayOutput) ToScheduleArrayOutput() ScheduleArrayOutput { 396 return o 397 } 398 399 func (o ScheduleArrayOutput) ToScheduleArrayOutputWithContext(ctx context.Context) ScheduleArrayOutput { 400 return o 401 } 402 403 func (o ScheduleArrayOutput) Index(i pulumi.IntInput) ScheduleOutput { 404 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Schedule { 405 return vs[0].([]*Schedule)[vs[1].(int)] 406 }).(ScheduleOutput) 407 } 408 409 type ScheduleMapOutput struct{ *pulumi.OutputState } 410 411 func (ScheduleMapOutput) ElementType() reflect.Type { 412 return reflect.TypeOf((*map[string]*Schedule)(nil)).Elem() 413 } 414 415 func (o ScheduleMapOutput) ToScheduleMapOutput() ScheduleMapOutput { 416 return o 417 } 418 419 func (o ScheduleMapOutput) ToScheduleMapOutputWithContext(ctx context.Context) ScheduleMapOutput { 420 return o 421 } 422 423 func (o ScheduleMapOutput) MapIndex(k pulumi.StringInput) ScheduleOutput { 424 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Schedule { 425 return vs[0].(map[string]*Schedule)[vs[1].(string)] 426 }).(ScheduleOutput) 427 } 428 429 func init() { 430 pulumi.RegisterInputType(reflect.TypeOf((*ScheduleInput)(nil)).Elem(), &Schedule{}) 431 pulumi.RegisterInputType(reflect.TypeOf((*ScheduleArrayInput)(nil)).Elem(), ScheduleArray{}) 432 pulumi.RegisterInputType(reflect.TypeOf((*ScheduleMapInput)(nil)).Elem(), ScheduleMap{}) 433 pulumi.RegisterOutputType(ScheduleOutput{}) 434 pulumi.RegisterOutputType(ScheduleArrayOutput{}) 435 pulumi.RegisterOutputType(ScheduleMapOutput{}) 436 }