github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/autoscalingplans/scalingPlan.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 autoscalingplans 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 // Manages an AWS Auto Scaling scaling plan. 16 // More information can be found in the [AWS Auto Scaling User Guide](https://docs.aws.amazon.com/autoscaling/plans/userguide/what-is-aws-auto-scaling.html). 17 // 18 // > **NOTE:** The AWS Auto Scaling service uses an AWS IAM service-linked role to manage predictive scaling of Amazon EC2 Auto Scaling groups. The service attempts to automatically create this role the first time a scaling plan with predictive scaling enabled is created. 19 // An `iam.ServiceLinkedRole` resource can be used to manually manage this role. 20 // See the [AWS documentation](https://docs.aws.amazon.com/autoscaling/plans/userguide/aws-auto-scaling-service-linked-roles.html#create-service-linked-role-manual) for more details. 21 // 22 // ## Example Usage 23 // 24 // ## Import 25 // 26 // Using `pulumi import`, import Auto Scaling scaling plans using the `name`. For example: 27 // 28 // ```sh 29 // $ pulumi import aws:autoscalingplans/scalingPlan:ScalingPlan example MyScale1 30 // ``` 31 type ScalingPlan struct { 32 pulumi.CustomResourceState 33 34 // CloudFormation stack or set of tags. You can create one scaling plan per application source. 35 ApplicationSource ScalingPlanApplicationSourceOutput `pulumi:"applicationSource"` 36 // Name of the scaling plan. Names cannot contain vertical bars, colons, or forward slashes. 37 Name pulumi.StringOutput `pulumi:"name"` 38 // Scaling instructions. More details can be found in the [AWS Auto Scaling API Reference](https://docs.aws.amazon.com/autoscaling/plans/APIReference/API_ScalingInstruction.html). 39 ScalingInstructions ScalingPlanScalingInstructionArrayOutput `pulumi:"scalingInstructions"` 40 // The version number of the scaling plan. This value is always 1. 41 ScalingPlanVersion pulumi.IntOutput `pulumi:"scalingPlanVersion"` 42 } 43 44 // NewScalingPlan registers a new resource with the given unique name, arguments, and options. 45 func NewScalingPlan(ctx *pulumi.Context, 46 name string, args *ScalingPlanArgs, opts ...pulumi.ResourceOption) (*ScalingPlan, error) { 47 if args == nil { 48 return nil, errors.New("missing one or more required arguments") 49 } 50 51 if args.ApplicationSource == nil { 52 return nil, errors.New("invalid value for required argument 'ApplicationSource'") 53 } 54 if args.ScalingInstructions == nil { 55 return nil, errors.New("invalid value for required argument 'ScalingInstructions'") 56 } 57 opts = internal.PkgResourceDefaultOpts(opts) 58 var resource ScalingPlan 59 err := ctx.RegisterResource("aws:autoscalingplans/scalingPlan:ScalingPlan", name, args, &resource, opts...) 60 if err != nil { 61 return nil, err 62 } 63 return &resource, nil 64 } 65 66 // GetScalingPlan gets an existing ScalingPlan resource's state with the given name, ID, and optional 67 // state properties that are used to uniquely qualify the lookup (nil if not required). 68 func GetScalingPlan(ctx *pulumi.Context, 69 name string, id pulumi.IDInput, state *ScalingPlanState, opts ...pulumi.ResourceOption) (*ScalingPlan, error) { 70 var resource ScalingPlan 71 err := ctx.ReadResource("aws:autoscalingplans/scalingPlan:ScalingPlan", name, id, state, &resource, opts...) 72 if err != nil { 73 return nil, err 74 } 75 return &resource, nil 76 } 77 78 // Input properties used for looking up and filtering ScalingPlan resources. 79 type scalingPlanState struct { 80 // CloudFormation stack or set of tags. You can create one scaling plan per application source. 81 ApplicationSource *ScalingPlanApplicationSource `pulumi:"applicationSource"` 82 // Name of the scaling plan. Names cannot contain vertical bars, colons, or forward slashes. 83 Name *string `pulumi:"name"` 84 // Scaling instructions. More details can be found in the [AWS Auto Scaling API Reference](https://docs.aws.amazon.com/autoscaling/plans/APIReference/API_ScalingInstruction.html). 85 ScalingInstructions []ScalingPlanScalingInstruction `pulumi:"scalingInstructions"` 86 // The version number of the scaling plan. This value is always 1. 87 ScalingPlanVersion *int `pulumi:"scalingPlanVersion"` 88 } 89 90 type ScalingPlanState struct { 91 // CloudFormation stack or set of tags. You can create one scaling plan per application source. 92 ApplicationSource ScalingPlanApplicationSourcePtrInput 93 // Name of the scaling plan. Names cannot contain vertical bars, colons, or forward slashes. 94 Name pulumi.StringPtrInput 95 // Scaling instructions. More details can be found in the [AWS Auto Scaling API Reference](https://docs.aws.amazon.com/autoscaling/plans/APIReference/API_ScalingInstruction.html). 96 ScalingInstructions ScalingPlanScalingInstructionArrayInput 97 // The version number of the scaling plan. This value is always 1. 98 ScalingPlanVersion pulumi.IntPtrInput 99 } 100 101 func (ScalingPlanState) ElementType() reflect.Type { 102 return reflect.TypeOf((*scalingPlanState)(nil)).Elem() 103 } 104 105 type scalingPlanArgs struct { 106 // CloudFormation stack or set of tags. You can create one scaling plan per application source. 107 ApplicationSource ScalingPlanApplicationSource `pulumi:"applicationSource"` 108 // Name of the scaling plan. Names cannot contain vertical bars, colons, or forward slashes. 109 Name *string `pulumi:"name"` 110 // Scaling instructions. More details can be found in the [AWS Auto Scaling API Reference](https://docs.aws.amazon.com/autoscaling/plans/APIReference/API_ScalingInstruction.html). 111 ScalingInstructions []ScalingPlanScalingInstruction `pulumi:"scalingInstructions"` 112 } 113 114 // The set of arguments for constructing a ScalingPlan resource. 115 type ScalingPlanArgs struct { 116 // CloudFormation stack or set of tags. You can create one scaling plan per application source. 117 ApplicationSource ScalingPlanApplicationSourceInput 118 // Name of the scaling plan. Names cannot contain vertical bars, colons, or forward slashes. 119 Name pulumi.StringPtrInput 120 // Scaling instructions. More details can be found in the [AWS Auto Scaling API Reference](https://docs.aws.amazon.com/autoscaling/plans/APIReference/API_ScalingInstruction.html). 121 ScalingInstructions ScalingPlanScalingInstructionArrayInput 122 } 123 124 func (ScalingPlanArgs) ElementType() reflect.Type { 125 return reflect.TypeOf((*scalingPlanArgs)(nil)).Elem() 126 } 127 128 type ScalingPlanInput interface { 129 pulumi.Input 130 131 ToScalingPlanOutput() ScalingPlanOutput 132 ToScalingPlanOutputWithContext(ctx context.Context) ScalingPlanOutput 133 } 134 135 func (*ScalingPlan) ElementType() reflect.Type { 136 return reflect.TypeOf((**ScalingPlan)(nil)).Elem() 137 } 138 139 func (i *ScalingPlan) ToScalingPlanOutput() ScalingPlanOutput { 140 return i.ToScalingPlanOutputWithContext(context.Background()) 141 } 142 143 func (i *ScalingPlan) ToScalingPlanOutputWithContext(ctx context.Context) ScalingPlanOutput { 144 return pulumi.ToOutputWithContext(ctx, i).(ScalingPlanOutput) 145 } 146 147 // ScalingPlanArrayInput is an input type that accepts ScalingPlanArray and ScalingPlanArrayOutput values. 148 // You can construct a concrete instance of `ScalingPlanArrayInput` via: 149 // 150 // ScalingPlanArray{ ScalingPlanArgs{...} } 151 type ScalingPlanArrayInput interface { 152 pulumi.Input 153 154 ToScalingPlanArrayOutput() ScalingPlanArrayOutput 155 ToScalingPlanArrayOutputWithContext(context.Context) ScalingPlanArrayOutput 156 } 157 158 type ScalingPlanArray []ScalingPlanInput 159 160 func (ScalingPlanArray) ElementType() reflect.Type { 161 return reflect.TypeOf((*[]*ScalingPlan)(nil)).Elem() 162 } 163 164 func (i ScalingPlanArray) ToScalingPlanArrayOutput() ScalingPlanArrayOutput { 165 return i.ToScalingPlanArrayOutputWithContext(context.Background()) 166 } 167 168 func (i ScalingPlanArray) ToScalingPlanArrayOutputWithContext(ctx context.Context) ScalingPlanArrayOutput { 169 return pulumi.ToOutputWithContext(ctx, i).(ScalingPlanArrayOutput) 170 } 171 172 // ScalingPlanMapInput is an input type that accepts ScalingPlanMap and ScalingPlanMapOutput values. 173 // You can construct a concrete instance of `ScalingPlanMapInput` via: 174 // 175 // ScalingPlanMap{ "key": ScalingPlanArgs{...} } 176 type ScalingPlanMapInput interface { 177 pulumi.Input 178 179 ToScalingPlanMapOutput() ScalingPlanMapOutput 180 ToScalingPlanMapOutputWithContext(context.Context) ScalingPlanMapOutput 181 } 182 183 type ScalingPlanMap map[string]ScalingPlanInput 184 185 func (ScalingPlanMap) ElementType() reflect.Type { 186 return reflect.TypeOf((*map[string]*ScalingPlan)(nil)).Elem() 187 } 188 189 func (i ScalingPlanMap) ToScalingPlanMapOutput() ScalingPlanMapOutput { 190 return i.ToScalingPlanMapOutputWithContext(context.Background()) 191 } 192 193 func (i ScalingPlanMap) ToScalingPlanMapOutputWithContext(ctx context.Context) ScalingPlanMapOutput { 194 return pulumi.ToOutputWithContext(ctx, i).(ScalingPlanMapOutput) 195 } 196 197 type ScalingPlanOutput struct{ *pulumi.OutputState } 198 199 func (ScalingPlanOutput) ElementType() reflect.Type { 200 return reflect.TypeOf((**ScalingPlan)(nil)).Elem() 201 } 202 203 func (o ScalingPlanOutput) ToScalingPlanOutput() ScalingPlanOutput { 204 return o 205 } 206 207 func (o ScalingPlanOutput) ToScalingPlanOutputWithContext(ctx context.Context) ScalingPlanOutput { 208 return o 209 } 210 211 // CloudFormation stack or set of tags. You can create one scaling plan per application source. 212 func (o ScalingPlanOutput) ApplicationSource() ScalingPlanApplicationSourceOutput { 213 return o.ApplyT(func(v *ScalingPlan) ScalingPlanApplicationSourceOutput { return v.ApplicationSource }).(ScalingPlanApplicationSourceOutput) 214 } 215 216 // Name of the scaling plan. Names cannot contain vertical bars, colons, or forward slashes. 217 func (o ScalingPlanOutput) Name() pulumi.StringOutput { 218 return o.ApplyT(func(v *ScalingPlan) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 219 } 220 221 // Scaling instructions. More details can be found in the [AWS Auto Scaling API Reference](https://docs.aws.amazon.com/autoscaling/plans/APIReference/API_ScalingInstruction.html). 222 func (o ScalingPlanOutput) ScalingInstructions() ScalingPlanScalingInstructionArrayOutput { 223 return o.ApplyT(func(v *ScalingPlan) ScalingPlanScalingInstructionArrayOutput { return v.ScalingInstructions }).(ScalingPlanScalingInstructionArrayOutput) 224 } 225 226 // The version number of the scaling plan. This value is always 1. 227 func (o ScalingPlanOutput) ScalingPlanVersion() pulumi.IntOutput { 228 return o.ApplyT(func(v *ScalingPlan) pulumi.IntOutput { return v.ScalingPlanVersion }).(pulumi.IntOutput) 229 } 230 231 type ScalingPlanArrayOutput struct{ *pulumi.OutputState } 232 233 func (ScalingPlanArrayOutput) ElementType() reflect.Type { 234 return reflect.TypeOf((*[]*ScalingPlan)(nil)).Elem() 235 } 236 237 func (o ScalingPlanArrayOutput) ToScalingPlanArrayOutput() ScalingPlanArrayOutput { 238 return o 239 } 240 241 func (o ScalingPlanArrayOutput) ToScalingPlanArrayOutputWithContext(ctx context.Context) ScalingPlanArrayOutput { 242 return o 243 } 244 245 func (o ScalingPlanArrayOutput) Index(i pulumi.IntInput) ScalingPlanOutput { 246 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ScalingPlan { 247 return vs[0].([]*ScalingPlan)[vs[1].(int)] 248 }).(ScalingPlanOutput) 249 } 250 251 type ScalingPlanMapOutput struct{ *pulumi.OutputState } 252 253 func (ScalingPlanMapOutput) ElementType() reflect.Type { 254 return reflect.TypeOf((*map[string]*ScalingPlan)(nil)).Elem() 255 } 256 257 func (o ScalingPlanMapOutput) ToScalingPlanMapOutput() ScalingPlanMapOutput { 258 return o 259 } 260 261 func (o ScalingPlanMapOutput) ToScalingPlanMapOutputWithContext(ctx context.Context) ScalingPlanMapOutput { 262 return o 263 } 264 265 func (o ScalingPlanMapOutput) MapIndex(k pulumi.StringInput) ScalingPlanOutput { 266 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ScalingPlan { 267 return vs[0].(map[string]*ScalingPlan)[vs[1].(string)] 268 }).(ScalingPlanOutput) 269 } 270 271 func init() { 272 pulumi.RegisterInputType(reflect.TypeOf((*ScalingPlanInput)(nil)).Elem(), &ScalingPlan{}) 273 pulumi.RegisterInputType(reflect.TypeOf((*ScalingPlanArrayInput)(nil)).Elem(), ScalingPlanArray{}) 274 pulumi.RegisterInputType(reflect.TypeOf((*ScalingPlanMapInput)(nil)).Elem(), ScalingPlanMap{}) 275 pulumi.RegisterOutputType(ScalingPlanOutput{}) 276 pulumi.RegisterOutputType(ScalingPlanArrayOutput{}) 277 pulumi.RegisterOutputType(ScalingPlanMapOutput{}) 278 }