github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/budgets/getBudget.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 budgets 5 6 import ( 7 "context" 8 "reflect" 9 10 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 11 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 12 ) 13 14 // Data source for managing an AWS Web Services Budgets Budget. 15 // 16 // ## Example Usage 17 // 18 // ### Basic Usage 19 // 20 // <!--Start PulumiCodeChooser --> 21 // ```go 22 // package main 23 // 24 // import ( 25 // 26 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/budgets" 27 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 28 // 29 // ) 30 // 31 // func main() { 32 // pulumi.Run(func(ctx *pulumi.Context) error { 33 // _, err := budgets.LookupBudget(ctx, &budgets.LookupBudgetArgs{ 34 // Name: testAwsBudgetsBudget.Name, 35 // }, nil) 36 // if err != nil { 37 // return err 38 // } 39 // return nil 40 // }) 41 // } 42 // 43 // ``` 44 // <!--End PulumiCodeChooser --> 45 func LookupBudget(ctx *pulumi.Context, args *LookupBudgetArgs, opts ...pulumi.InvokeOption) (*LookupBudgetResult, error) { 46 opts = internal.PkgInvokeDefaultOpts(opts) 47 var rv LookupBudgetResult 48 err := ctx.Invoke("aws:budgets/getBudget:getBudget", args, &rv, opts...) 49 if err != nil { 50 return nil, err 51 } 52 return &rv, nil 53 } 54 55 // A collection of arguments for invoking getBudget. 56 type LookupBudgetArgs struct { 57 // The ID of the target account for budget. Will use current user's accountId by default if omitted. 58 AccountId *string `pulumi:"accountId"` 59 // The name of a budget. Unique within accounts. 60 // 61 // The following arguments are optional: 62 Name string `pulumi:"name"` 63 // The prefix of the name of a budget. Unique within accounts. 64 NamePrefix *string `pulumi:"namePrefix"` 65 } 66 67 // A collection of values returned by getBudget. 68 type LookupBudgetResult struct { 69 AccountId string `pulumi:"accountId"` 70 Arn string `pulumi:"arn"` 71 // Object containing [AutoAdjustData] which determines the budget amount for an auto-adjusting budget. 72 AutoAdjustDatas []GetBudgetAutoAdjustData `pulumi:"autoAdjustDatas"` 73 // Boolean indicating whether this budget has been exceeded. 74 BudgetExceeded bool `pulumi:"budgetExceeded"` 75 // The total amount of cost, usage, RI utilization, RI coverage, Savings Plans utilization, or Savings Plans coverage that you want to track with your budget. Contains object Spend. 76 BudgetLimits []GetBudgetBudgetLimit `pulumi:"budgetLimits"` 77 // Whether this budget tracks monetary cost or usage. 78 BudgetType string `pulumi:"budgetType"` 79 // The spend objects that are associated with this budget. The actualSpend tracks how much you've used, cost, usage, RI units, or Savings Plans units and the forecastedSpend tracks how much that you're predicted to spend based on your historical usage profile. 80 CalculatedSpends []GetBudgetCalculatedSpend `pulumi:"calculatedSpends"` 81 // A list of CostFilter name/values pair to apply to budget. 82 CostFilters []GetBudgetCostFilter `pulumi:"costFilters"` 83 // Object containing CostTypes The types of cost included in a budget, such as tax and subscriptions. 84 CostTypes []GetBudgetCostType `pulumi:"costTypes"` 85 // The provider-assigned unique ID for this managed resource. 86 Id string `pulumi:"id"` 87 Name string `pulumi:"name"` 88 NamePrefix *string `pulumi:"namePrefix"` 89 // Object containing Budget Notifications. Can be used multiple times to define more than one budget notification. 90 Notifications []GetBudgetNotification `pulumi:"notifications"` 91 // Object containing Planned Budget Limits. Can be used multiple times to plan more than one budget limit. See [PlannedBudgetLimits](https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_budgets_Budget.html#awscostmanagement-Type-budgets_Budget-PlannedBudgetLimits) documentation. 92 PlannedLimits []GetBudgetPlannedLimit `pulumi:"plannedLimits"` 93 // The end of the time period covered by the budget. There are no restrictions on the end date. Format: `2017-01-01_12:00`. 94 TimePeriodEnd string `pulumi:"timePeriodEnd"` 95 // The start of the time period covered by the budget. If you don't specify a start date, AWS defaults to the start of your chosen time period. The start date must come before the end date. Format: `2017-01-01_12:00`. 96 TimePeriodStart string `pulumi:"timePeriodStart"` 97 // The length of time until a budget resets the actual and forecasted spend. Valid values: `MONTHLY`, `QUARTERLY`, `ANNUALLY`, and `DAILY`. 98 TimeUnit string `pulumi:"timeUnit"` 99 } 100 101 func LookupBudgetOutput(ctx *pulumi.Context, args LookupBudgetOutputArgs, opts ...pulumi.InvokeOption) LookupBudgetResultOutput { 102 return pulumi.ToOutputWithContext(context.Background(), args). 103 ApplyT(func(v interface{}) (LookupBudgetResult, error) { 104 args := v.(LookupBudgetArgs) 105 r, err := LookupBudget(ctx, &args, opts...) 106 var s LookupBudgetResult 107 if r != nil { 108 s = *r 109 } 110 return s, err 111 }).(LookupBudgetResultOutput) 112 } 113 114 // A collection of arguments for invoking getBudget. 115 type LookupBudgetOutputArgs struct { 116 // The ID of the target account for budget. Will use current user's accountId by default if omitted. 117 AccountId pulumi.StringPtrInput `pulumi:"accountId"` 118 // The name of a budget. Unique within accounts. 119 // 120 // The following arguments are optional: 121 Name pulumi.StringInput `pulumi:"name"` 122 // The prefix of the name of a budget. Unique within accounts. 123 NamePrefix pulumi.StringPtrInput `pulumi:"namePrefix"` 124 } 125 126 func (LookupBudgetOutputArgs) ElementType() reflect.Type { 127 return reflect.TypeOf((*LookupBudgetArgs)(nil)).Elem() 128 } 129 130 // A collection of values returned by getBudget. 131 type LookupBudgetResultOutput struct{ *pulumi.OutputState } 132 133 func (LookupBudgetResultOutput) ElementType() reflect.Type { 134 return reflect.TypeOf((*LookupBudgetResult)(nil)).Elem() 135 } 136 137 func (o LookupBudgetResultOutput) ToLookupBudgetResultOutput() LookupBudgetResultOutput { 138 return o 139 } 140 141 func (o LookupBudgetResultOutput) ToLookupBudgetResultOutputWithContext(ctx context.Context) LookupBudgetResultOutput { 142 return o 143 } 144 145 func (o LookupBudgetResultOutput) AccountId() pulumi.StringOutput { 146 return o.ApplyT(func(v LookupBudgetResult) string { return v.AccountId }).(pulumi.StringOutput) 147 } 148 149 func (o LookupBudgetResultOutput) Arn() pulumi.StringOutput { 150 return o.ApplyT(func(v LookupBudgetResult) string { return v.Arn }).(pulumi.StringOutput) 151 } 152 153 // Object containing [AutoAdjustData] which determines the budget amount for an auto-adjusting budget. 154 func (o LookupBudgetResultOutput) AutoAdjustDatas() GetBudgetAutoAdjustDataArrayOutput { 155 return o.ApplyT(func(v LookupBudgetResult) []GetBudgetAutoAdjustData { return v.AutoAdjustDatas }).(GetBudgetAutoAdjustDataArrayOutput) 156 } 157 158 // Boolean indicating whether this budget has been exceeded. 159 func (o LookupBudgetResultOutput) BudgetExceeded() pulumi.BoolOutput { 160 return o.ApplyT(func(v LookupBudgetResult) bool { return v.BudgetExceeded }).(pulumi.BoolOutput) 161 } 162 163 // The total amount of cost, usage, RI utilization, RI coverage, Savings Plans utilization, or Savings Plans coverage that you want to track with your budget. Contains object Spend. 164 func (o LookupBudgetResultOutput) BudgetLimits() GetBudgetBudgetLimitArrayOutput { 165 return o.ApplyT(func(v LookupBudgetResult) []GetBudgetBudgetLimit { return v.BudgetLimits }).(GetBudgetBudgetLimitArrayOutput) 166 } 167 168 // Whether this budget tracks monetary cost or usage. 169 func (o LookupBudgetResultOutput) BudgetType() pulumi.StringOutput { 170 return o.ApplyT(func(v LookupBudgetResult) string { return v.BudgetType }).(pulumi.StringOutput) 171 } 172 173 // The spend objects that are associated with this budget. The actualSpend tracks how much you've used, cost, usage, RI units, or Savings Plans units and the forecastedSpend tracks how much that you're predicted to spend based on your historical usage profile. 174 func (o LookupBudgetResultOutput) CalculatedSpends() GetBudgetCalculatedSpendArrayOutput { 175 return o.ApplyT(func(v LookupBudgetResult) []GetBudgetCalculatedSpend { return v.CalculatedSpends }).(GetBudgetCalculatedSpendArrayOutput) 176 } 177 178 // A list of CostFilter name/values pair to apply to budget. 179 func (o LookupBudgetResultOutput) CostFilters() GetBudgetCostFilterArrayOutput { 180 return o.ApplyT(func(v LookupBudgetResult) []GetBudgetCostFilter { return v.CostFilters }).(GetBudgetCostFilterArrayOutput) 181 } 182 183 // Object containing CostTypes The types of cost included in a budget, such as tax and subscriptions. 184 func (o LookupBudgetResultOutput) CostTypes() GetBudgetCostTypeArrayOutput { 185 return o.ApplyT(func(v LookupBudgetResult) []GetBudgetCostType { return v.CostTypes }).(GetBudgetCostTypeArrayOutput) 186 } 187 188 // The provider-assigned unique ID for this managed resource. 189 func (o LookupBudgetResultOutput) Id() pulumi.StringOutput { 190 return o.ApplyT(func(v LookupBudgetResult) string { return v.Id }).(pulumi.StringOutput) 191 } 192 193 func (o LookupBudgetResultOutput) Name() pulumi.StringOutput { 194 return o.ApplyT(func(v LookupBudgetResult) string { return v.Name }).(pulumi.StringOutput) 195 } 196 197 func (o LookupBudgetResultOutput) NamePrefix() pulumi.StringPtrOutput { 198 return o.ApplyT(func(v LookupBudgetResult) *string { return v.NamePrefix }).(pulumi.StringPtrOutput) 199 } 200 201 // Object containing Budget Notifications. Can be used multiple times to define more than one budget notification. 202 func (o LookupBudgetResultOutput) Notifications() GetBudgetNotificationArrayOutput { 203 return o.ApplyT(func(v LookupBudgetResult) []GetBudgetNotification { return v.Notifications }).(GetBudgetNotificationArrayOutput) 204 } 205 206 // Object containing Planned Budget Limits. Can be used multiple times to plan more than one budget limit. See [PlannedBudgetLimits](https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_budgets_Budget.html#awscostmanagement-Type-budgets_Budget-PlannedBudgetLimits) documentation. 207 func (o LookupBudgetResultOutput) PlannedLimits() GetBudgetPlannedLimitArrayOutput { 208 return o.ApplyT(func(v LookupBudgetResult) []GetBudgetPlannedLimit { return v.PlannedLimits }).(GetBudgetPlannedLimitArrayOutput) 209 } 210 211 // The end of the time period covered by the budget. There are no restrictions on the end date. Format: `2017-01-01_12:00`. 212 func (o LookupBudgetResultOutput) TimePeriodEnd() pulumi.StringOutput { 213 return o.ApplyT(func(v LookupBudgetResult) string { return v.TimePeriodEnd }).(pulumi.StringOutput) 214 } 215 216 // The start of the time period covered by the budget. If you don't specify a start date, AWS defaults to the start of your chosen time period. The start date must come before the end date. Format: `2017-01-01_12:00`. 217 func (o LookupBudgetResultOutput) TimePeriodStart() pulumi.StringOutput { 218 return o.ApplyT(func(v LookupBudgetResult) string { return v.TimePeriodStart }).(pulumi.StringOutput) 219 } 220 221 // The length of time until a budget resets the actual and forecasted spend. Valid values: `MONTHLY`, `QUARTERLY`, `ANNUALLY`, and `DAILY`. 222 func (o LookupBudgetResultOutput) TimeUnit() pulumi.StringOutput { 223 return o.ApplyT(func(v LookupBudgetResult) string { return v.TimeUnit }).(pulumi.StringOutput) 224 } 225 226 func init() { 227 pulumi.RegisterOutputType(LookupBudgetResultOutput{}) 228 }