github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/emr/managedScalingPolicy.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 emr
     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 a Managed Scaling policy for EMR Cluster. With Amazon EMR versions 5.30.0 and later (except for Amazon EMR 6.0.0), you can enable EMR managed scaling to automatically increase or decrease the number of instances or units in your cluster based on workload. See [Using EMR Managed Scaling in Amazon EMR](https://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-managed-scaling.html) for more information.
    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/emr"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			sample, err := emr.NewCluster(ctx, "sample", &emr.ClusterArgs{
    33  //				Name:         pulumi.String("emr-sample-cluster"),
    34  //				ReleaseLabel: pulumi.String("emr-5.30.0"),
    35  //				MasterInstanceGroup: &emr.ClusterMasterInstanceGroupArgs{
    36  //					InstanceType: pulumi.String("m4.large"),
    37  //				},
    38  //				CoreInstanceGroup: &emr.ClusterCoreInstanceGroupArgs{
    39  //					InstanceType: pulumi.String("c4.large"),
    40  //				},
    41  //			})
    42  //			if err != nil {
    43  //				return err
    44  //			}
    45  //			_, err = emr.NewManagedScalingPolicy(ctx, "samplepolicy", &emr.ManagedScalingPolicyArgs{
    46  //				ClusterId: sample.ID(),
    47  //				ComputeLimits: emr.ManagedScalingPolicyComputeLimitArray{
    48  //					&emr.ManagedScalingPolicyComputeLimitArgs{
    49  //						UnitType:                     pulumi.String("Instances"),
    50  //						MinimumCapacityUnits:         pulumi.Int(2),
    51  //						MaximumCapacityUnits:         pulumi.Int(10),
    52  //						MaximumOndemandCapacityUnits: pulumi.Int(2),
    53  //						MaximumCoreCapacityUnits:     pulumi.Int(10),
    54  //					},
    55  //				},
    56  //			})
    57  //			if err != nil {
    58  //				return err
    59  //			}
    60  //			return nil
    61  //		})
    62  //	}
    63  //
    64  // ```
    65  // <!--End PulumiCodeChooser -->
    66  //
    67  // ## Import
    68  //
    69  // Using `pulumi import`, import EMR Managed Scaling Policies using the EMR Cluster identifier. For example:
    70  //
    71  // ```sh
    72  // $ pulumi import aws:emr/managedScalingPolicy:ManagedScalingPolicy example j-123456ABCDEF
    73  // ```
    74  type ManagedScalingPolicy struct {
    75  	pulumi.CustomResourceState
    76  
    77  	// ID of the EMR cluster
    78  	ClusterId pulumi.StringOutput `pulumi:"clusterId"`
    79  	// Configuration block with compute limit settings. Described below.
    80  	ComputeLimits ManagedScalingPolicyComputeLimitArrayOutput `pulumi:"computeLimits"`
    81  }
    82  
    83  // NewManagedScalingPolicy registers a new resource with the given unique name, arguments, and options.
    84  func NewManagedScalingPolicy(ctx *pulumi.Context,
    85  	name string, args *ManagedScalingPolicyArgs, opts ...pulumi.ResourceOption) (*ManagedScalingPolicy, error) {
    86  	if args == nil {
    87  		return nil, errors.New("missing one or more required arguments")
    88  	}
    89  
    90  	if args.ClusterId == nil {
    91  		return nil, errors.New("invalid value for required argument 'ClusterId'")
    92  	}
    93  	if args.ComputeLimits == nil {
    94  		return nil, errors.New("invalid value for required argument 'ComputeLimits'")
    95  	}
    96  	opts = internal.PkgResourceDefaultOpts(opts)
    97  	var resource ManagedScalingPolicy
    98  	err := ctx.RegisterResource("aws:emr/managedScalingPolicy:ManagedScalingPolicy", name, args, &resource, opts...)
    99  	if err != nil {
   100  		return nil, err
   101  	}
   102  	return &resource, nil
   103  }
   104  
   105  // GetManagedScalingPolicy gets an existing ManagedScalingPolicy resource's state with the given name, ID, and optional
   106  // state properties that are used to uniquely qualify the lookup (nil if not required).
   107  func GetManagedScalingPolicy(ctx *pulumi.Context,
   108  	name string, id pulumi.IDInput, state *ManagedScalingPolicyState, opts ...pulumi.ResourceOption) (*ManagedScalingPolicy, error) {
   109  	var resource ManagedScalingPolicy
   110  	err := ctx.ReadResource("aws:emr/managedScalingPolicy:ManagedScalingPolicy", name, id, state, &resource, opts...)
   111  	if err != nil {
   112  		return nil, err
   113  	}
   114  	return &resource, nil
   115  }
   116  
   117  // Input properties used for looking up and filtering ManagedScalingPolicy resources.
   118  type managedScalingPolicyState struct {
   119  	// ID of the EMR cluster
   120  	ClusterId *string `pulumi:"clusterId"`
   121  	// Configuration block with compute limit settings. Described below.
   122  	ComputeLimits []ManagedScalingPolicyComputeLimit `pulumi:"computeLimits"`
   123  }
   124  
   125  type ManagedScalingPolicyState struct {
   126  	// ID of the EMR cluster
   127  	ClusterId pulumi.StringPtrInput
   128  	// Configuration block with compute limit settings. Described below.
   129  	ComputeLimits ManagedScalingPolicyComputeLimitArrayInput
   130  }
   131  
   132  func (ManagedScalingPolicyState) ElementType() reflect.Type {
   133  	return reflect.TypeOf((*managedScalingPolicyState)(nil)).Elem()
   134  }
   135  
   136  type managedScalingPolicyArgs struct {
   137  	// ID of the EMR cluster
   138  	ClusterId string `pulumi:"clusterId"`
   139  	// Configuration block with compute limit settings. Described below.
   140  	ComputeLimits []ManagedScalingPolicyComputeLimit `pulumi:"computeLimits"`
   141  }
   142  
   143  // The set of arguments for constructing a ManagedScalingPolicy resource.
   144  type ManagedScalingPolicyArgs struct {
   145  	// ID of the EMR cluster
   146  	ClusterId pulumi.StringInput
   147  	// Configuration block with compute limit settings. Described below.
   148  	ComputeLimits ManagedScalingPolicyComputeLimitArrayInput
   149  }
   150  
   151  func (ManagedScalingPolicyArgs) ElementType() reflect.Type {
   152  	return reflect.TypeOf((*managedScalingPolicyArgs)(nil)).Elem()
   153  }
   154  
   155  type ManagedScalingPolicyInput interface {
   156  	pulumi.Input
   157  
   158  	ToManagedScalingPolicyOutput() ManagedScalingPolicyOutput
   159  	ToManagedScalingPolicyOutputWithContext(ctx context.Context) ManagedScalingPolicyOutput
   160  }
   161  
   162  func (*ManagedScalingPolicy) ElementType() reflect.Type {
   163  	return reflect.TypeOf((**ManagedScalingPolicy)(nil)).Elem()
   164  }
   165  
   166  func (i *ManagedScalingPolicy) ToManagedScalingPolicyOutput() ManagedScalingPolicyOutput {
   167  	return i.ToManagedScalingPolicyOutputWithContext(context.Background())
   168  }
   169  
   170  func (i *ManagedScalingPolicy) ToManagedScalingPolicyOutputWithContext(ctx context.Context) ManagedScalingPolicyOutput {
   171  	return pulumi.ToOutputWithContext(ctx, i).(ManagedScalingPolicyOutput)
   172  }
   173  
   174  // ManagedScalingPolicyArrayInput is an input type that accepts ManagedScalingPolicyArray and ManagedScalingPolicyArrayOutput values.
   175  // You can construct a concrete instance of `ManagedScalingPolicyArrayInput` via:
   176  //
   177  //	ManagedScalingPolicyArray{ ManagedScalingPolicyArgs{...} }
   178  type ManagedScalingPolicyArrayInput interface {
   179  	pulumi.Input
   180  
   181  	ToManagedScalingPolicyArrayOutput() ManagedScalingPolicyArrayOutput
   182  	ToManagedScalingPolicyArrayOutputWithContext(context.Context) ManagedScalingPolicyArrayOutput
   183  }
   184  
   185  type ManagedScalingPolicyArray []ManagedScalingPolicyInput
   186  
   187  func (ManagedScalingPolicyArray) ElementType() reflect.Type {
   188  	return reflect.TypeOf((*[]*ManagedScalingPolicy)(nil)).Elem()
   189  }
   190  
   191  func (i ManagedScalingPolicyArray) ToManagedScalingPolicyArrayOutput() ManagedScalingPolicyArrayOutput {
   192  	return i.ToManagedScalingPolicyArrayOutputWithContext(context.Background())
   193  }
   194  
   195  func (i ManagedScalingPolicyArray) ToManagedScalingPolicyArrayOutputWithContext(ctx context.Context) ManagedScalingPolicyArrayOutput {
   196  	return pulumi.ToOutputWithContext(ctx, i).(ManagedScalingPolicyArrayOutput)
   197  }
   198  
   199  // ManagedScalingPolicyMapInput is an input type that accepts ManagedScalingPolicyMap and ManagedScalingPolicyMapOutput values.
   200  // You can construct a concrete instance of `ManagedScalingPolicyMapInput` via:
   201  //
   202  //	ManagedScalingPolicyMap{ "key": ManagedScalingPolicyArgs{...} }
   203  type ManagedScalingPolicyMapInput interface {
   204  	pulumi.Input
   205  
   206  	ToManagedScalingPolicyMapOutput() ManagedScalingPolicyMapOutput
   207  	ToManagedScalingPolicyMapOutputWithContext(context.Context) ManagedScalingPolicyMapOutput
   208  }
   209  
   210  type ManagedScalingPolicyMap map[string]ManagedScalingPolicyInput
   211  
   212  func (ManagedScalingPolicyMap) ElementType() reflect.Type {
   213  	return reflect.TypeOf((*map[string]*ManagedScalingPolicy)(nil)).Elem()
   214  }
   215  
   216  func (i ManagedScalingPolicyMap) ToManagedScalingPolicyMapOutput() ManagedScalingPolicyMapOutput {
   217  	return i.ToManagedScalingPolicyMapOutputWithContext(context.Background())
   218  }
   219  
   220  func (i ManagedScalingPolicyMap) ToManagedScalingPolicyMapOutputWithContext(ctx context.Context) ManagedScalingPolicyMapOutput {
   221  	return pulumi.ToOutputWithContext(ctx, i).(ManagedScalingPolicyMapOutput)
   222  }
   223  
   224  type ManagedScalingPolicyOutput struct{ *pulumi.OutputState }
   225  
   226  func (ManagedScalingPolicyOutput) ElementType() reflect.Type {
   227  	return reflect.TypeOf((**ManagedScalingPolicy)(nil)).Elem()
   228  }
   229  
   230  func (o ManagedScalingPolicyOutput) ToManagedScalingPolicyOutput() ManagedScalingPolicyOutput {
   231  	return o
   232  }
   233  
   234  func (o ManagedScalingPolicyOutput) ToManagedScalingPolicyOutputWithContext(ctx context.Context) ManagedScalingPolicyOutput {
   235  	return o
   236  }
   237  
   238  // ID of the EMR cluster
   239  func (o ManagedScalingPolicyOutput) ClusterId() pulumi.StringOutput {
   240  	return o.ApplyT(func(v *ManagedScalingPolicy) pulumi.StringOutput { return v.ClusterId }).(pulumi.StringOutput)
   241  }
   242  
   243  // Configuration block with compute limit settings. Described below.
   244  func (o ManagedScalingPolicyOutput) ComputeLimits() ManagedScalingPolicyComputeLimitArrayOutput {
   245  	return o.ApplyT(func(v *ManagedScalingPolicy) ManagedScalingPolicyComputeLimitArrayOutput { return v.ComputeLimits }).(ManagedScalingPolicyComputeLimitArrayOutput)
   246  }
   247  
   248  type ManagedScalingPolicyArrayOutput struct{ *pulumi.OutputState }
   249  
   250  func (ManagedScalingPolicyArrayOutput) ElementType() reflect.Type {
   251  	return reflect.TypeOf((*[]*ManagedScalingPolicy)(nil)).Elem()
   252  }
   253  
   254  func (o ManagedScalingPolicyArrayOutput) ToManagedScalingPolicyArrayOutput() ManagedScalingPolicyArrayOutput {
   255  	return o
   256  }
   257  
   258  func (o ManagedScalingPolicyArrayOutput) ToManagedScalingPolicyArrayOutputWithContext(ctx context.Context) ManagedScalingPolicyArrayOutput {
   259  	return o
   260  }
   261  
   262  func (o ManagedScalingPolicyArrayOutput) Index(i pulumi.IntInput) ManagedScalingPolicyOutput {
   263  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ManagedScalingPolicy {
   264  		return vs[0].([]*ManagedScalingPolicy)[vs[1].(int)]
   265  	}).(ManagedScalingPolicyOutput)
   266  }
   267  
   268  type ManagedScalingPolicyMapOutput struct{ *pulumi.OutputState }
   269  
   270  func (ManagedScalingPolicyMapOutput) ElementType() reflect.Type {
   271  	return reflect.TypeOf((*map[string]*ManagedScalingPolicy)(nil)).Elem()
   272  }
   273  
   274  func (o ManagedScalingPolicyMapOutput) ToManagedScalingPolicyMapOutput() ManagedScalingPolicyMapOutput {
   275  	return o
   276  }
   277  
   278  func (o ManagedScalingPolicyMapOutput) ToManagedScalingPolicyMapOutputWithContext(ctx context.Context) ManagedScalingPolicyMapOutput {
   279  	return o
   280  }
   281  
   282  func (o ManagedScalingPolicyMapOutput) MapIndex(k pulumi.StringInput) ManagedScalingPolicyOutput {
   283  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ManagedScalingPolicy {
   284  		return vs[0].(map[string]*ManagedScalingPolicy)[vs[1].(string)]
   285  	}).(ManagedScalingPolicyOutput)
   286  }
   287  
   288  func init() {
   289  	pulumi.RegisterInputType(reflect.TypeOf((*ManagedScalingPolicyInput)(nil)).Elem(), &ManagedScalingPolicy{})
   290  	pulumi.RegisterInputType(reflect.TypeOf((*ManagedScalingPolicyArrayInput)(nil)).Elem(), ManagedScalingPolicyArray{})
   291  	pulumi.RegisterInputType(reflect.TypeOf((*ManagedScalingPolicyMapInput)(nil)).Elem(), ManagedScalingPolicyMap{})
   292  	pulumi.RegisterOutputType(ManagedScalingPolicyOutput{})
   293  	pulumi.RegisterOutputType(ManagedScalingPolicyArrayOutput{})
   294  	pulumi.RegisterOutputType(ManagedScalingPolicyMapOutput{})
   295  }