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