github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/redshift/usageLimit.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 redshift
     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  // Creates a new Amazon Redshift Usage Limit.
    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/redshift"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			_, err := redshift.NewUsageLimit(ctx, "example", &redshift.UsageLimitArgs{
    33  //				ClusterIdentifier: pulumi.Any(exampleAwsRedshiftCluster.Id),
    34  //				FeatureType:       pulumi.String("concurrency-scaling"),
    35  //				LimitType:         pulumi.String("time"),
    36  //				Amount:            pulumi.Int(60),
    37  //			})
    38  //			if err != nil {
    39  //				return err
    40  //			}
    41  //			return nil
    42  //		})
    43  //	}
    44  //
    45  // ```
    46  // <!--End PulumiCodeChooser -->
    47  //
    48  // ## Import
    49  //
    50  // Using `pulumi import`, import Redshift usage limits using the `id`. For example:
    51  //
    52  // ```sh
    53  // $ pulumi import aws:redshift/usageLimit:UsageLimit example example-id
    54  // ```
    55  type UsageLimit struct {
    56  	pulumi.CustomResourceState
    57  
    58  	// The limit amount. If time-based, this amount is in minutes. If data-based, this amount is in terabytes (TB). The value must be a positive number.
    59  	Amount pulumi.IntOutput `pulumi:"amount"`
    60  	// Amazon Resource Name (ARN) of the Redshift Usage Limit.
    61  	Arn pulumi.StringOutput `pulumi:"arn"`
    62  	// The action that Amazon Redshift takes when the limit is reached. The default is `log`. Valid values are `log`, `emit-metric`, and `disable`.
    63  	BreachAction pulumi.StringPtrOutput `pulumi:"breachAction"`
    64  	// The identifier of the cluster that you want to limit usage.
    65  	ClusterIdentifier pulumi.StringOutput `pulumi:"clusterIdentifier"`
    66  	// The Amazon Redshift feature that you want to limit. Valid values are `spectrum`, `concurrency-scaling`, and `cross-region-datasharing`.
    67  	FeatureType pulumi.StringOutput `pulumi:"featureType"`
    68  	// The type of limit. Depending on the feature type, this can be based on a time duration or data size. If FeatureType is `spectrum`, then LimitType must be `data-scanned`. If FeatureType is `concurrency-scaling`, then LimitType must be `time`. If FeatureType is `cross-region-datasharing`, then LimitType must be `data-scanned`. Valid values are `data-scanned`, and `time`.
    69  	LimitType pulumi.StringOutput `pulumi:"limitType"`
    70  	// The time period that the amount applies to. A weekly period begins on Sunday. The default is `monthly`. Valid values are `daily`, `weekly`, and `monthly`.
    71  	Period pulumi.StringPtrOutput `pulumi:"period"`
    72  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    73  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    74  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
    75  	//
    76  	// Deprecated: Please use `tags` instead.
    77  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    78  }
    79  
    80  // NewUsageLimit registers a new resource with the given unique name, arguments, and options.
    81  func NewUsageLimit(ctx *pulumi.Context,
    82  	name string, args *UsageLimitArgs, opts ...pulumi.ResourceOption) (*UsageLimit, error) {
    83  	if args == nil {
    84  		return nil, errors.New("missing one or more required arguments")
    85  	}
    86  
    87  	if args.Amount == nil {
    88  		return nil, errors.New("invalid value for required argument 'Amount'")
    89  	}
    90  	if args.ClusterIdentifier == nil {
    91  		return nil, errors.New("invalid value for required argument 'ClusterIdentifier'")
    92  	}
    93  	if args.FeatureType == nil {
    94  		return nil, errors.New("invalid value for required argument 'FeatureType'")
    95  	}
    96  	if args.LimitType == nil {
    97  		return nil, errors.New("invalid value for required argument 'LimitType'")
    98  	}
    99  	opts = internal.PkgResourceDefaultOpts(opts)
   100  	var resource UsageLimit
   101  	err := ctx.RegisterResource("aws:redshift/usageLimit:UsageLimit", name, args, &resource, opts...)
   102  	if err != nil {
   103  		return nil, err
   104  	}
   105  	return &resource, nil
   106  }
   107  
   108  // GetUsageLimit gets an existing UsageLimit resource's state with the given name, ID, and optional
   109  // state properties that are used to uniquely qualify the lookup (nil if not required).
   110  func GetUsageLimit(ctx *pulumi.Context,
   111  	name string, id pulumi.IDInput, state *UsageLimitState, opts ...pulumi.ResourceOption) (*UsageLimit, error) {
   112  	var resource UsageLimit
   113  	err := ctx.ReadResource("aws:redshift/usageLimit:UsageLimit", name, id, state, &resource, opts...)
   114  	if err != nil {
   115  		return nil, err
   116  	}
   117  	return &resource, nil
   118  }
   119  
   120  // Input properties used for looking up and filtering UsageLimit resources.
   121  type usageLimitState struct {
   122  	// The limit amount. If time-based, this amount is in minutes. If data-based, this amount is in terabytes (TB). The value must be a positive number.
   123  	Amount *int `pulumi:"amount"`
   124  	// Amazon Resource Name (ARN) of the Redshift Usage Limit.
   125  	Arn *string `pulumi:"arn"`
   126  	// The action that Amazon Redshift takes when the limit is reached. The default is `log`. Valid values are `log`, `emit-metric`, and `disable`.
   127  	BreachAction *string `pulumi:"breachAction"`
   128  	// The identifier of the cluster that you want to limit usage.
   129  	ClusterIdentifier *string `pulumi:"clusterIdentifier"`
   130  	// The Amazon Redshift feature that you want to limit. Valid values are `spectrum`, `concurrency-scaling`, and `cross-region-datasharing`.
   131  	FeatureType *string `pulumi:"featureType"`
   132  	// The type of limit. Depending on the feature type, this can be based on a time duration or data size. If FeatureType is `spectrum`, then LimitType must be `data-scanned`. If FeatureType is `concurrency-scaling`, then LimitType must be `time`. If FeatureType is `cross-region-datasharing`, then LimitType must be `data-scanned`. Valid values are `data-scanned`, and `time`.
   133  	LimitType *string `pulumi:"limitType"`
   134  	// The time period that the amount applies to. A weekly period begins on Sunday. The default is `monthly`. Valid values are `daily`, `weekly`, and `monthly`.
   135  	Period *string `pulumi:"period"`
   136  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   137  	Tags map[string]string `pulumi:"tags"`
   138  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   139  	//
   140  	// Deprecated: Please use `tags` instead.
   141  	TagsAll map[string]string `pulumi:"tagsAll"`
   142  }
   143  
   144  type UsageLimitState struct {
   145  	// The limit amount. If time-based, this amount is in minutes. If data-based, this amount is in terabytes (TB). The value must be a positive number.
   146  	Amount pulumi.IntPtrInput
   147  	// Amazon Resource Name (ARN) of the Redshift Usage Limit.
   148  	Arn pulumi.StringPtrInput
   149  	// The action that Amazon Redshift takes when the limit is reached. The default is `log`. Valid values are `log`, `emit-metric`, and `disable`.
   150  	BreachAction pulumi.StringPtrInput
   151  	// The identifier of the cluster that you want to limit usage.
   152  	ClusterIdentifier pulumi.StringPtrInput
   153  	// The Amazon Redshift feature that you want to limit. Valid values are `spectrum`, `concurrency-scaling`, and `cross-region-datasharing`.
   154  	FeatureType pulumi.StringPtrInput
   155  	// The type of limit. Depending on the feature type, this can be based on a time duration or data size. If FeatureType is `spectrum`, then LimitType must be `data-scanned`. If FeatureType is `concurrency-scaling`, then LimitType must be `time`. If FeatureType is `cross-region-datasharing`, then LimitType must be `data-scanned`. Valid values are `data-scanned`, and `time`.
   156  	LimitType pulumi.StringPtrInput
   157  	// The time period that the amount applies to. A weekly period begins on Sunday. The default is `monthly`. Valid values are `daily`, `weekly`, and `monthly`.
   158  	Period pulumi.StringPtrInput
   159  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   160  	Tags pulumi.StringMapInput
   161  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   162  	//
   163  	// Deprecated: Please use `tags` instead.
   164  	TagsAll pulumi.StringMapInput
   165  }
   166  
   167  func (UsageLimitState) ElementType() reflect.Type {
   168  	return reflect.TypeOf((*usageLimitState)(nil)).Elem()
   169  }
   170  
   171  type usageLimitArgs struct {
   172  	// The limit amount. If time-based, this amount is in minutes. If data-based, this amount is in terabytes (TB). The value must be a positive number.
   173  	Amount int `pulumi:"amount"`
   174  	// The action that Amazon Redshift takes when the limit is reached. The default is `log`. Valid values are `log`, `emit-metric`, and `disable`.
   175  	BreachAction *string `pulumi:"breachAction"`
   176  	// The identifier of the cluster that you want to limit usage.
   177  	ClusterIdentifier string `pulumi:"clusterIdentifier"`
   178  	// The Amazon Redshift feature that you want to limit. Valid values are `spectrum`, `concurrency-scaling`, and `cross-region-datasharing`.
   179  	FeatureType string `pulumi:"featureType"`
   180  	// The type of limit. Depending on the feature type, this can be based on a time duration or data size. If FeatureType is `spectrum`, then LimitType must be `data-scanned`. If FeatureType is `concurrency-scaling`, then LimitType must be `time`. If FeatureType is `cross-region-datasharing`, then LimitType must be `data-scanned`. Valid values are `data-scanned`, and `time`.
   181  	LimitType string `pulumi:"limitType"`
   182  	// The time period that the amount applies to. A weekly period begins on Sunday. The default is `monthly`. Valid values are `daily`, `weekly`, and `monthly`.
   183  	Period *string `pulumi:"period"`
   184  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   185  	Tags map[string]string `pulumi:"tags"`
   186  }
   187  
   188  // The set of arguments for constructing a UsageLimit resource.
   189  type UsageLimitArgs struct {
   190  	// The limit amount. If time-based, this amount is in minutes. If data-based, this amount is in terabytes (TB). The value must be a positive number.
   191  	Amount pulumi.IntInput
   192  	// The action that Amazon Redshift takes when the limit is reached. The default is `log`. Valid values are `log`, `emit-metric`, and `disable`.
   193  	BreachAction pulumi.StringPtrInput
   194  	// The identifier of the cluster that you want to limit usage.
   195  	ClusterIdentifier pulumi.StringInput
   196  	// The Amazon Redshift feature that you want to limit. Valid values are `spectrum`, `concurrency-scaling`, and `cross-region-datasharing`.
   197  	FeatureType pulumi.StringInput
   198  	// The type of limit. Depending on the feature type, this can be based on a time duration or data size. If FeatureType is `spectrum`, then LimitType must be `data-scanned`. If FeatureType is `concurrency-scaling`, then LimitType must be `time`. If FeatureType is `cross-region-datasharing`, then LimitType must be `data-scanned`. Valid values are `data-scanned`, and `time`.
   199  	LimitType pulumi.StringInput
   200  	// The time period that the amount applies to. A weekly period begins on Sunday. The default is `monthly`. Valid values are `daily`, `weekly`, and `monthly`.
   201  	Period pulumi.StringPtrInput
   202  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   203  	Tags pulumi.StringMapInput
   204  }
   205  
   206  func (UsageLimitArgs) ElementType() reflect.Type {
   207  	return reflect.TypeOf((*usageLimitArgs)(nil)).Elem()
   208  }
   209  
   210  type UsageLimitInput interface {
   211  	pulumi.Input
   212  
   213  	ToUsageLimitOutput() UsageLimitOutput
   214  	ToUsageLimitOutputWithContext(ctx context.Context) UsageLimitOutput
   215  }
   216  
   217  func (*UsageLimit) ElementType() reflect.Type {
   218  	return reflect.TypeOf((**UsageLimit)(nil)).Elem()
   219  }
   220  
   221  func (i *UsageLimit) ToUsageLimitOutput() UsageLimitOutput {
   222  	return i.ToUsageLimitOutputWithContext(context.Background())
   223  }
   224  
   225  func (i *UsageLimit) ToUsageLimitOutputWithContext(ctx context.Context) UsageLimitOutput {
   226  	return pulumi.ToOutputWithContext(ctx, i).(UsageLimitOutput)
   227  }
   228  
   229  // UsageLimitArrayInput is an input type that accepts UsageLimitArray and UsageLimitArrayOutput values.
   230  // You can construct a concrete instance of `UsageLimitArrayInput` via:
   231  //
   232  //	UsageLimitArray{ UsageLimitArgs{...} }
   233  type UsageLimitArrayInput interface {
   234  	pulumi.Input
   235  
   236  	ToUsageLimitArrayOutput() UsageLimitArrayOutput
   237  	ToUsageLimitArrayOutputWithContext(context.Context) UsageLimitArrayOutput
   238  }
   239  
   240  type UsageLimitArray []UsageLimitInput
   241  
   242  func (UsageLimitArray) ElementType() reflect.Type {
   243  	return reflect.TypeOf((*[]*UsageLimit)(nil)).Elem()
   244  }
   245  
   246  func (i UsageLimitArray) ToUsageLimitArrayOutput() UsageLimitArrayOutput {
   247  	return i.ToUsageLimitArrayOutputWithContext(context.Background())
   248  }
   249  
   250  func (i UsageLimitArray) ToUsageLimitArrayOutputWithContext(ctx context.Context) UsageLimitArrayOutput {
   251  	return pulumi.ToOutputWithContext(ctx, i).(UsageLimitArrayOutput)
   252  }
   253  
   254  // UsageLimitMapInput is an input type that accepts UsageLimitMap and UsageLimitMapOutput values.
   255  // You can construct a concrete instance of `UsageLimitMapInput` via:
   256  //
   257  //	UsageLimitMap{ "key": UsageLimitArgs{...} }
   258  type UsageLimitMapInput interface {
   259  	pulumi.Input
   260  
   261  	ToUsageLimitMapOutput() UsageLimitMapOutput
   262  	ToUsageLimitMapOutputWithContext(context.Context) UsageLimitMapOutput
   263  }
   264  
   265  type UsageLimitMap map[string]UsageLimitInput
   266  
   267  func (UsageLimitMap) ElementType() reflect.Type {
   268  	return reflect.TypeOf((*map[string]*UsageLimit)(nil)).Elem()
   269  }
   270  
   271  func (i UsageLimitMap) ToUsageLimitMapOutput() UsageLimitMapOutput {
   272  	return i.ToUsageLimitMapOutputWithContext(context.Background())
   273  }
   274  
   275  func (i UsageLimitMap) ToUsageLimitMapOutputWithContext(ctx context.Context) UsageLimitMapOutput {
   276  	return pulumi.ToOutputWithContext(ctx, i).(UsageLimitMapOutput)
   277  }
   278  
   279  type UsageLimitOutput struct{ *pulumi.OutputState }
   280  
   281  func (UsageLimitOutput) ElementType() reflect.Type {
   282  	return reflect.TypeOf((**UsageLimit)(nil)).Elem()
   283  }
   284  
   285  func (o UsageLimitOutput) ToUsageLimitOutput() UsageLimitOutput {
   286  	return o
   287  }
   288  
   289  func (o UsageLimitOutput) ToUsageLimitOutputWithContext(ctx context.Context) UsageLimitOutput {
   290  	return o
   291  }
   292  
   293  // The limit amount. If time-based, this amount is in minutes. If data-based, this amount is in terabytes (TB). The value must be a positive number.
   294  func (o UsageLimitOutput) Amount() pulumi.IntOutput {
   295  	return o.ApplyT(func(v *UsageLimit) pulumi.IntOutput { return v.Amount }).(pulumi.IntOutput)
   296  }
   297  
   298  // Amazon Resource Name (ARN) of the Redshift Usage Limit.
   299  func (o UsageLimitOutput) Arn() pulumi.StringOutput {
   300  	return o.ApplyT(func(v *UsageLimit) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   301  }
   302  
   303  // The action that Amazon Redshift takes when the limit is reached. The default is `log`. Valid values are `log`, `emit-metric`, and `disable`.
   304  func (o UsageLimitOutput) BreachAction() pulumi.StringPtrOutput {
   305  	return o.ApplyT(func(v *UsageLimit) pulumi.StringPtrOutput { return v.BreachAction }).(pulumi.StringPtrOutput)
   306  }
   307  
   308  // The identifier of the cluster that you want to limit usage.
   309  func (o UsageLimitOutput) ClusterIdentifier() pulumi.StringOutput {
   310  	return o.ApplyT(func(v *UsageLimit) pulumi.StringOutput { return v.ClusterIdentifier }).(pulumi.StringOutput)
   311  }
   312  
   313  // The Amazon Redshift feature that you want to limit. Valid values are `spectrum`, `concurrency-scaling`, and `cross-region-datasharing`.
   314  func (o UsageLimitOutput) FeatureType() pulumi.StringOutput {
   315  	return o.ApplyT(func(v *UsageLimit) pulumi.StringOutput { return v.FeatureType }).(pulumi.StringOutput)
   316  }
   317  
   318  // The type of limit. Depending on the feature type, this can be based on a time duration or data size. If FeatureType is `spectrum`, then LimitType must be `data-scanned`. If FeatureType is `concurrency-scaling`, then LimitType must be `time`. If FeatureType is `cross-region-datasharing`, then LimitType must be `data-scanned`. Valid values are `data-scanned`, and `time`.
   319  func (o UsageLimitOutput) LimitType() pulumi.StringOutput {
   320  	return o.ApplyT(func(v *UsageLimit) pulumi.StringOutput { return v.LimitType }).(pulumi.StringOutput)
   321  }
   322  
   323  // The time period that the amount applies to. A weekly period begins on Sunday. The default is `monthly`. Valid values are `daily`, `weekly`, and `monthly`.
   324  func (o UsageLimitOutput) Period() pulumi.StringPtrOutput {
   325  	return o.ApplyT(func(v *UsageLimit) pulumi.StringPtrOutput { return v.Period }).(pulumi.StringPtrOutput)
   326  }
   327  
   328  // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   329  func (o UsageLimitOutput) Tags() pulumi.StringMapOutput {
   330  	return o.ApplyT(func(v *UsageLimit) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   331  }
   332  
   333  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   334  //
   335  // Deprecated: Please use `tags` instead.
   336  func (o UsageLimitOutput) TagsAll() pulumi.StringMapOutput {
   337  	return o.ApplyT(func(v *UsageLimit) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   338  }
   339  
   340  type UsageLimitArrayOutput struct{ *pulumi.OutputState }
   341  
   342  func (UsageLimitArrayOutput) ElementType() reflect.Type {
   343  	return reflect.TypeOf((*[]*UsageLimit)(nil)).Elem()
   344  }
   345  
   346  func (o UsageLimitArrayOutput) ToUsageLimitArrayOutput() UsageLimitArrayOutput {
   347  	return o
   348  }
   349  
   350  func (o UsageLimitArrayOutput) ToUsageLimitArrayOutputWithContext(ctx context.Context) UsageLimitArrayOutput {
   351  	return o
   352  }
   353  
   354  func (o UsageLimitArrayOutput) Index(i pulumi.IntInput) UsageLimitOutput {
   355  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *UsageLimit {
   356  		return vs[0].([]*UsageLimit)[vs[1].(int)]
   357  	}).(UsageLimitOutput)
   358  }
   359  
   360  type UsageLimitMapOutput struct{ *pulumi.OutputState }
   361  
   362  func (UsageLimitMapOutput) ElementType() reflect.Type {
   363  	return reflect.TypeOf((*map[string]*UsageLimit)(nil)).Elem()
   364  }
   365  
   366  func (o UsageLimitMapOutput) ToUsageLimitMapOutput() UsageLimitMapOutput {
   367  	return o
   368  }
   369  
   370  func (o UsageLimitMapOutput) ToUsageLimitMapOutputWithContext(ctx context.Context) UsageLimitMapOutput {
   371  	return o
   372  }
   373  
   374  func (o UsageLimitMapOutput) MapIndex(k pulumi.StringInput) UsageLimitOutput {
   375  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *UsageLimit {
   376  		return vs[0].(map[string]*UsageLimit)[vs[1].(string)]
   377  	}).(UsageLimitOutput)
   378  }
   379  
   380  func init() {
   381  	pulumi.RegisterInputType(reflect.TypeOf((*UsageLimitInput)(nil)).Elem(), &UsageLimit{})
   382  	pulumi.RegisterInputType(reflect.TypeOf((*UsageLimitArrayInput)(nil)).Elem(), UsageLimitArray{})
   383  	pulumi.RegisterInputType(reflect.TypeOf((*UsageLimitMapInput)(nil)).Elem(), UsageLimitMap{})
   384  	pulumi.RegisterOutputType(UsageLimitOutput{})
   385  	pulumi.RegisterOutputType(UsageLimitArrayOutput{})
   386  	pulumi.RegisterOutputType(UsageLimitMapOutput{})
   387  }