github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/costexplorer/costCategory.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 costexplorer
     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 CE Cost Category.
    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/costexplorer"
    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 := costexplorer.NewCostCategory(ctx, "test", &costexplorer.CostCategoryArgs{
    33  //				Name:        pulumi.String("NAME"),
    34  //				RuleVersion: pulumi.String("CostCategoryExpression.v1"),
    35  //				Rules: costexplorer.CostCategoryRuleArray{
    36  //					&costexplorer.CostCategoryRuleArgs{
    37  //						Value: pulumi.String("production"),
    38  //						Rule: &costexplorer.CostCategoryRuleRuleArgs{
    39  //							Dimension: &costexplorer.CostCategoryRuleRuleDimensionArgs{
    40  //								Key: pulumi.String("LINKED_ACCOUNT_NAME"),
    41  //								Values: pulumi.StringArray{
    42  //									pulumi.String("-prod"),
    43  //								},
    44  //								MatchOptions: pulumi.StringArray{
    45  //									pulumi.String("ENDS_WITH"),
    46  //								},
    47  //							},
    48  //						},
    49  //					},
    50  //					&costexplorer.CostCategoryRuleArgs{
    51  //						Value: pulumi.String("staging"),
    52  //						Rule: &costexplorer.CostCategoryRuleRuleArgs{
    53  //							Dimension: &costexplorer.CostCategoryRuleRuleDimensionArgs{
    54  //								Key: pulumi.String("LINKED_ACCOUNT_NAME"),
    55  //								Values: pulumi.StringArray{
    56  //									pulumi.String("-stg"),
    57  //								},
    58  //								MatchOptions: pulumi.StringArray{
    59  //									pulumi.String("ENDS_WITH"),
    60  //								},
    61  //							},
    62  //						},
    63  //					},
    64  //					&costexplorer.CostCategoryRuleArgs{
    65  //						Value: pulumi.String("testing"),
    66  //						Rule: &costexplorer.CostCategoryRuleRuleArgs{
    67  //							Dimension: &costexplorer.CostCategoryRuleRuleDimensionArgs{
    68  //								Key: pulumi.String("LINKED_ACCOUNT_NAME"),
    69  //								Values: pulumi.StringArray{
    70  //									pulumi.String("-dev"),
    71  //								},
    72  //								MatchOptions: pulumi.StringArray{
    73  //									pulumi.String("ENDS_WITH"),
    74  //								},
    75  //							},
    76  //						},
    77  //					},
    78  //				},
    79  //			})
    80  //			if err != nil {
    81  //				return err
    82  //			}
    83  //			return nil
    84  //		})
    85  //	}
    86  //
    87  // ```
    88  // <!--End PulumiCodeChooser -->
    89  //
    90  // ## Import
    91  //
    92  // Using `pulumi import`, import `aws_ce_cost_category` using the id. For example:
    93  //
    94  // ```sh
    95  // $ pulumi import aws:costexplorer/costCategory:CostCategory example costCategoryARN
    96  // ```
    97  type CostCategory struct {
    98  	pulumi.CustomResourceState
    99  
   100  	// ARN of the cost category.
   101  	Arn pulumi.StringOutput `pulumi:"arn"`
   102  	// Default value for the cost category.
   103  	DefaultValue pulumi.StringPtrOutput `pulumi:"defaultValue"`
   104  	// Effective end data of your Cost Category.
   105  	EffectiveEnd pulumi.StringOutput `pulumi:"effectiveEnd"`
   106  	// The Cost Category's effective start date. It can only be a billing start date (first day of the month). If the date isn't provided, it's the first day of the current month. Dates can't be before the previous twelve months, or in the future. For example `2022-11-01T00:00:00Z`.
   107  	//
   108  	// The following arguments are optional:
   109  	EffectiveStart pulumi.StringOutput `pulumi:"effectiveStart"`
   110  	// Unique name for the Cost Category.
   111  	Name pulumi.StringOutput `pulumi:"name"`
   112  	// Rule schema version in this particular Cost Category.
   113  	RuleVersion pulumi.StringOutput `pulumi:"ruleVersion"`
   114  	// Configuration block for the Cost Category rules used to categorize costs. See below.
   115  	Rules CostCategoryRuleArrayOutput `pulumi:"rules"`
   116  	// Configuration block for the split charge rules used to allocate your charges between your Cost Category values. See below.
   117  	SplitChargeRules CostCategorySplitChargeRuleArrayOutput `pulumi:"splitChargeRules"`
   118  	// Key-value mapping of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   119  	Tags pulumi.StringMapOutput `pulumi:"tags"`
   120  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   121  	//
   122  	// Deprecated: Please use `tags` instead.
   123  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
   124  }
   125  
   126  // NewCostCategory registers a new resource with the given unique name, arguments, and options.
   127  func NewCostCategory(ctx *pulumi.Context,
   128  	name string, args *CostCategoryArgs, opts ...pulumi.ResourceOption) (*CostCategory, error) {
   129  	if args == nil {
   130  		return nil, errors.New("missing one or more required arguments")
   131  	}
   132  
   133  	if args.RuleVersion == nil {
   134  		return nil, errors.New("invalid value for required argument 'RuleVersion'")
   135  	}
   136  	if args.Rules == nil {
   137  		return nil, errors.New("invalid value for required argument 'Rules'")
   138  	}
   139  	opts = internal.PkgResourceDefaultOpts(opts)
   140  	var resource CostCategory
   141  	err := ctx.RegisterResource("aws:costexplorer/costCategory:CostCategory", name, args, &resource, opts...)
   142  	if err != nil {
   143  		return nil, err
   144  	}
   145  	return &resource, nil
   146  }
   147  
   148  // GetCostCategory gets an existing CostCategory resource's state with the given name, ID, and optional
   149  // state properties that are used to uniquely qualify the lookup (nil if not required).
   150  func GetCostCategory(ctx *pulumi.Context,
   151  	name string, id pulumi.IDInput, state *CostCategoryState, opts ...pulumi.ResourceOption) (*CostCategory, error) {
   152  	var resource CostCategory
   153  	err := ctx.ReadResource("aws:costexplorer/costCategory:CostCategory", name, id, state, &resource, opts...)
   154  	if err != nil {
   155  		return nil, err
   156  	}
   157  	return &resource, nil
   158  }
   159  
   160  // Input properties used for looking up and filtering CostCategory resources.
   161  type costCategoryState struct {
   162  	// ARN of the cost category.
   163  	Arn *string `pulumi:"arn"`
   164  	// Default value for the cost category.
   165  	DefaultValue *string `pulumi:"defaultValue"`
   166  	// Effective end data of your Cost Category.
   167  	EffectiveEnd *string `pulumi:"effectiveEnd"`
   168  	// The Cost Category's effective start date. It can only be a billing start date (first day of the month). If the date isn't provided, it's the first day of the current month. Dates can't be before the previous twelve months, or in the future. For example `2022-11-01T00:00:00Z`.
   169  	//
   170  	// The following arguments are optional:
   171  	EffectiveStart *string `pulumi:"effectiveStart"`
   172  	// Unique name for the Cost Category.
   173  	Name *string `pulumi:"name"`
   174  	// Rule schema version in this particular Cost Category.
   175  	RuleVersion *string `pulumi:"ruleVersion"`
   176  	// Configuration block for the Cost Category rules used to categorize costs. See below.
   177  	Rules []CostCategoryRule `pulumi:"rules"`
   178  	// Configuration block for the split charge rules used to allocate your charges between your Cost Category values. See below.
   179  	SplitChargeRules []CostCategorySplitChargeRule `pulumi:"splitChargeRules"`
   180  	// Key-value mapping of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   181  	Tags map[string]string `pulumi:"tags"`
   182  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   183  	//
   184  	// Deprecated: Please use `tags` instead.
   185  	TagsAll map[string]string `pulumi:"tagsAll"`
   186  }
   187  
   188  type CostCategoryState struct {
   189  	// ARN of the cost category.
   190  	Arn pulumi.StringPtrInput
   191  	// Default value for the cost category.
   192  	DefaultValue pulumi.StringPtrInput
   193  	// Effective end data of your Cost Category.
   194  	EffectiveEnd pulumi.StringPtrInput
   195  	// The Cost Category's effective start date. It can only be a billing start date (first day of the month). If the date isn't provided, it's the first day of the current month. Dates can't be before the previous twelve months, or in the future. For example `2022-11-01T00:00:00Z`.
   196  	//
   197  	// The following arguments are optional:
   198  	EffectiveStart pulumi.StringPtrInput
   199  	// Unique name for the Cost Category.
   200  	Name pulumi.StringPtrInput
   201  	// Rule schema version in this particular Cost Category.
   202  	RuleVersion pulumi.StringPtrInput
   203  	// Configuration block for the Cost Category rules used to categorize costs. See below.
   204  	Rules CostCategoryRuleArrayInput
   205  	// Configuration block for the split charge rules used to allocate your charges between your Cost Category values. See below.
   206  	SplitChargeRules CostCategorySplitChargeRuleArrayInput
   207  	// Key-value mapping of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   208  	Tags pulumi.StringMapInput
   209  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   210  	//
   211  	// Deprecated: Please use `tags` instead.
   212  	TagsAll pulumi.StringMapInput
   213  }
   214  
   215  func (CostCategoryState) ElementType() reflect.Type {
   216  	return reflect.TypeOf((*costCategoryState)(nil)).Elem()
   217  }
   218  
   219  type costCategoryArgs struct {
   220  	// Default value for the cost category.
   221  	DefaultValue *string `pulumi:"defaultValue"`
   222  	// The Cost Category's effective start date. It can only be a billing start date (first day of the month). If the date isn't provided, it's the first day of the current month. Dates can't be before the previous twelve months, or in the future. For example `2022-11-01T00:00:00Z`.
   223  	//
   224  	// The following arguments are optional:
   225  	EffectiveStart *string `pulumi:"effectiveStart"`
   226  	// Unique name for the Cost Category.
   227  	Name *string `pulumi:"name"`
   228  	// Rule schema version in this particular Cost Category.
   229  	RuleVersion string `pulumi:"ruleVersion"`
   230  	// Configuration block for the Cost Category rules used to categorize costs. See below.
   231  	Rules []CostCategoryRule `pulumi:"rules"`
   232  	// Configuration block for the split charge rules used to allocate your charges between your Cost Category values. See below.
   233  	SplitChargeRules []CostCategorySplitChargeRule `pulumi:"splitChargeRules"`
   234  	// Key-value mapping of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   235  	Tags map[string]string `pulumi:"tags"`
   236  }
   237  
   238  // The set of arguments for constructing a CostCategory resource.
   239  type CostCategoryArgs struct {
   240  	// Default value for the cost category.
   241  	DefaultValue pulumi.StringPtrInput
   242  	// The Cost Category's effective start date. It can only be a billing start date (first day of the month). If the date isn't provided, it's the first day of the current month. Dates can't be before the previous twelve months, or in the future. For example `2022-11-01T00:00:00Z`.
   243  	//
   244  	// The following arguments are optional:
   245  	EffectiveStart pulumi.StringPtrInput
   246  	// Unique name for the Cost Category.
   247  	Name pulumi.StringPtrInput
   248  	// Rule schema version in this particular Cost Category.
   249  	RuleVersion pulumi.StringInput
   250  	// Configuration block for the Cost Category rules used to categorize costs. See below.
   251  	Rules CostCategoryRuleArrayInput
   252  	// Configuration block for the split charge rules used to allocate your charges between your Cost Category values. See below.
   253  	SplitChargeRules CostCategorySplitChargeRuleArrayInput
   254  	// Key-value mapping of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   255  	Tags pulumi.StringMapInput
   256  }
   257  
   258  func (CostCategoryArgs) ElementType() reflect.Type {
   259  	return reflect.TypeOf((*costCategoryArgs)(nil)).Elem()
   260  }
   261  
   262  type CostCategoryInput interface {
   263  	pulumi.Input
   264  
   265  	ToCostCategoryOutput() CostCategoryOutput
   266  	ToCostCategoryOutputWithContext(ctx context.Context) CostCategoryOutput
   267  }
   268  
   269  func (*CostCategory) ElementType() reflect.Type {
   270  	return reflect.TypeOf((**CostCategory)(nil)).Elem()
   271  }
   272  
   273  func (i *CostCategory) ToCostCategoryOutput() CostCategoryOutput {
   274  	return i.ToCostCategoryOutputWithContext(context.Background())
   275  }
   276  
   277  func (i *CostCategory) ToCostCategoryOutputWithContext(ctx context.Context) CostCategoryOutput {
   278  	return pulumi.ToOutputWithContext(ctx, i).(CostCategoryOutput)
   279  }
   280  
   281  // CostCategoryArrayInput is an input type that accepts CostCategoryArray and CostCategoryArrayOutput values.
   282  // You can construct a concrete instance of `CostCategoryArrayInput` via:
   283  //
   284  //	CostCategoryArray{ CostCategoryArgs{...} }
   285  type CostCategoryArrayInput interface {
   286  	pulumi.Input
   287  
   288  	ToCostCategoryArrayOutput() CostCategoryArrayOutput
   289  	ToCostCategoryArrayOutputWithContext(context.Context) CostCategoryArrayOutput
   290  }
   291  
   292  type CostCategoryArray []CostCategoryInput
   293  
   294  func (CostCategoryArray) ElementType() reflect.Type {
   295  	return reflect.TypeOf((*[]*CostCategory)(nil)).Elem()
   296  }
   297  
   298  func (i CostCategoryArray) ToCostCategoryArrayOutput() CostCategoryArrayOutput {
   299  	return i.ToCostCategoryArrayOutputWithContext(context.Background())
   300  }
   301  
   302  func (i CostCategoryArray) ToCostCategoryArrayOutputWithContext(ctx context.Context) CostCategoryArrayOutput {
   303  	return pulumi.ToOutputWithContext(ctx, i).(CostCategoryArrayOutput)
   304  }
   305  
   306  // CostCategoryMapInput is an input type that accepts CostCategoryMap and CostCategoryMapOutput values.
   307  // You can construct a concrete instance of `CostCategoryMapInput` via:
   308  //
   309  //	CostCategoryMap{ "key": CostCategoryArgs{...} }
   310  type CostCategoryMapInput interface {
   311  	pulumi.Input
   312  
   313  	ToCostCategoryMapOutput() CostCategoryMapOutput
   314  	ToCostCategoryMapOutputWithContext(context.Context) CostCategoryMapOutput
   315  }
   316  
   317  type CostCategoryMap map[string]CostCategoryInput
   318  
   319  func (CostCategoryMap) ElementType() reflect.Type {
   320  	return reflect.TypeOf((*map[string]*CostCategory)(nil)).Elem()
   321  }
   322  
   323  func (i CostCategoryMap) ToCostCategoryMapOutput() CostCategoryMapOutput {
   324  	return i.ToCostCategoryMapOutputWithContext(context.Background())
   325  }
   326  
   327  func (i CostCategoryMap) ToCostCategoryMapOutputWithContext(ctx context.Context) CostCategoryMapOutput {
   328  	return pulumi.ToOutputWithContext(ctx, i).(CostCategoryMapOutput)
   329  }
   330  
   331  type CostCategoryOutput struct{ *pulumi.OutputState }
   332  
   333  func (CostCategoryOutput) ElementType() reflect.Type {
   334  	return reflect.TypeOf((**CostCategory)(nil)).Elem()
   335  }
   336  
   337  func (o CostCategoryOutput) ToCostCategoryOutput() CostCategoryOutput {
   338  	return o
   339  }
   340  
   341  func (o CostCategoryOutput) ToCostCategoryOutputWithContext(ctx context.Context) CostCategoryOutput {
   342  	return o
   343  }
   344  
   345  // ARN of the cost category.
   346  func (o CostCategoryOutput) Arn() pulumi.StringOutput {
   347  	return o.ApplyT(func(v *CostCategory) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   348  }
   349  
   350  // Default value for the cost category.
   351  func (o CostCategoryOutput) DefaultValue() pulumi.StringPtrOutput {
   352  	return o.ApplyT(func(v *CostCategory) pulumi.StringPtrOutput { return v.DefaultValue }).(pulumi.StringPtrOutput)
   353  }
   354  
   355  // Effective end data of your Cost Category.
   356  func (o CostCategoryOutput) EffectiveEnd() pulumi.StringOutput {
   357  	return o.ApplyT(func(v *CostCategory) pulumi.StringOutput { return v.EffectiveEnd }).(pulumi.StringOutput)
   358  }
   359  
   360  // The Cost Category's effective start date. It can only be a billing start date (first day of the month). If the date isn't provided, it's the first day of the current month. Dates can't be before the previous twelve months, or in the future. For example `2022-11-01T00:00:00Z`.
   361  //
   362  // The following arguments are optional:
   363  func (o CostCategoryOutput) EffectiveStart() pulumi.StringOutput {
   364  	return o.ApplyT(func(v *CostCategory) pulumi.StringOutput { return v.EffectiveStart }).(pulumi.StringOutput)
   365  }
   366  
   367  // Unique name for the Cost Category.
   368  func (o CostCategoryOutput) Name() pulumi.StringOutput {
   369  	return o.ApplyT(func(v *CostCategory) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   370  }
   371  
   372  // Rule schema version in this particular Cost Category.
   373  func (o CostCategoryOutput) RuleVersion() pulumi.StringOutput {
   374  	return o.ApplyT(func(v *CostCategory) pulumi.StringOutput { return v.RuleVersion }).(pulumi.StringOutput)
   375  }
   376  
   377  // Configuration block for the Cost Category rules used to categorize costs. See below.
   378  func (o CostCategoryOutput) Rules() CostCategoryRuleArrayOutput {
   379  	return o.ApplyT(func(v *CostCategory) CostCategoryRuleArrayOutput { return v.Rules }).(CostCategoryRuleArrayOutput)
   380  }
   381  
   382  // Configuration block for the split charge rules used to allocate your charges between your Cost Category values. See below.
   383  func (o CostCategoryOutput) SplitChargeRules() CostCategorySplitChargeRuleArrayOutput {
   384  	return o.ApplyT(func(v *CostCategory) CostCategorySplitChargeRuleArrayOutput { return v.SplitChargeRules }).(CostCategorySplitChargeRuleArrayOutput)
   385  }
   386  
   387  // Key-value mapping of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   388  func (o CostCategoryOutput) Tags() pulumi.StringMapOutput {
   389  	return o.ApplyT(func(v *CostCategory) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   390  }
   391  
   392  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   393  //
   394  // Deprecated: Please use `tags` instead.
   395  func (o CostCategoryOutput) TagsAll() pulumi.StringMapOutput {
   396  	return o.ApplyT(func(v *CostCategory) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   397  }
   398  
   399  type CostCategoryArrayOutput struct{ *pulumi.OutputState }
   400  
   401  func (CostCategoryArrayOutput) ElementType() reflect.Type {
   402  	return reflect.TypeOf((*[]*CostCategory)(nil)).Elem()
   403  }
   404  
   405  func (o CostCategoryArrayOutput) ToCostCategoryArrayOutput() CostCategoryArrayOutput {
   406  	return o
   407  }
   408  
   409  func (o CostCategoryArrayOutput) ToCostCategoryArrayOutputWithContext(ctx context.Context) CostCategoryArrayOutput {
   410  	return o
   411  }
   412  
   413  func (o CostCategoryArrayOutput) Index(i pulumi.IntInput) CostCategoryOutput {
   414  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *CostCategory {
   415  		return vs[0].([]*CostCategory)[vs[1].(int)]
   416  	}).(CostCategoryOutput)
   417  }
   418  
   419  type CostCategoryMapOutput struct{ *pulumi.OutputState }
   420  
   421  func (CostCategoryMapOutput) ElementType() reflect.Type {
   422  	return reflect.TypeOf((*map[string]*CostCategory)(nil)).Elem()
   423  }
   424  
   425  func (o CostCategoryMapOutput) ToCostCategoryMapOutput() CostCategoryMapOutput {
   426  	return o
   427  }
   428  
   429  func (o CostCategoryMapOutput) ToCostCategoryMapOutputWithContext(ctx context.Context) CostCategoryMapOutput {
   430  	return o
   431  }
   432  
   433  func (o CostCategoryMapOutput) MapIndex(k pulumi.StringInput) CostCategoryOutput {
   434  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *CostCategory {
   435  		return vs[0].(map[string]*CostCategory)[vs[1].(string)]
   436  	}).(CostCategoryOutput)
   437  }
   438  
   439  func init() {
   440  	pulumi.RegisterInputType(reflect.TypeOf((*CostCategoryInput)(nil)).Elem(), &CostCategory{})
   441  	pulumi.RegisterInputType(reflect.TypeOf((*CostCategoryArrayInput)(nil)).Elem(), CostCategoryArray{})
   442  	pulumi.RegisterInputType(reflect.TypeOf((*CostCategoryMapInput)(nil)).Elem(), CostCategoryMap{})
   443  	pulumi.RegisterOutputType(CostCategoryOutput{})
   444  	pulumi.RegisterOutputType(CostCategoryArrayOutput{})
   445  	pulumi.RegisterOutputType(CostCategoryMapOutput{})
   446  }