/
budget.go
759 lines (700 loc) · 24.3 KB
/
budget.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package billing
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumix"
)
// Budget configuration for a billing account.
//
// To get more information about Budget, see:
//
// * [API documentation](https://cloud.google.com/billing/docs/reference/budget/rest/v1/billingAccounts.budgets)
// * How-to Guides
// - [Creating a budget](https://cloud.google.com/billing/docs/how-to/budgets)
//
// > **Warning:** If you are using User ADCs (Application Default Credentials) with this resource,
// you must specify a `billingProject` and set `userProjectOverride` to true
// in the provider configuration. Otherwise the Billing Budgets API will return a 403 error.
// Your account must have the `serviceusage.services.use` permission on the
// `billingProject` you defined.
//
// ## Example Usage
// ### Billing Budget Basic
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/billing"
// "github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/organizations"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// account, err := organizations.GetBillingAccount(ctx, &organizations.GetBillingAccountArgs{
// BillingAccount: pulumi.StringRef("000000-0000000-0000000-000000"),
// }, nil)
// if err != nil {
// return err
// }
// _, err = billing.NewBudget(ctx, "budget", &billing.BudgetArgs{
// BillingAccount: *pulumi.String(account.Id),
// DisplayName: pulumi.String("Example Billing Budget"),
// Amount: &billing.BudgetAmountArgs{
// SpecifiedAmount: &billing.BudgetAmountSpecifiedAmountArgs{
// CurrencyCode: pulumi.String("USD"),
// Units: pulumi.String("100000"),
// },
// },
// ThresholdRules: billing.BudgetThresholdRuleArray{
// &billing.BudgetThresholdRuleArgs{
// ThresholdPercent: pulumi.Float64(0.5),
// },
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// ### Billing Budget Lastperiod
//
// ```go
// package main
//
// import (
//
// "fmt"
//
// "github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/billing"
// "github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/organizations"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// account, err := organizations.GetBillingAccount(ctx, &organizations.GetBillingAccountArgs{
// BillingAccount: pulumi.StringRef("000000-0000000-0000000-000000"),
// }, nil)
// if err != nil {
// return err
// }
// project, err := organizations.LookupProject(ctx, nil, nil)
// if err != nil {
// return err
// }
// _, err = billing.NewBudget(ctx, "budget", &billing.BudgetArgs{
// BillingAccount: *pulumi.String(account.Id),
// DisplayName: pulumi.String("Example Billing Budget"),
// BudgetFilter: &billing.BudgetBudgetFilterArgs{
// Projects: pulumi.StringArray{
// pulumi.String(fmt.Sprintf("projects/%v", project.Number)),
// },
// },
// Amount: &billing.BudgetAmountArgs{
// LastPeriodAmount: pulumi.Bool(true),
// },
// ThresholdRules: billing.BudgetThresholdRuleArray{
// &billing.BudgetThresholdRuleArgs{
// ThresholdPercent: pulumi.Float64(10),
// },
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// ### Billing Budget Filter
//
// ```go
// package main
//
// import (
//
// "fmt"
//
// "github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/billing"
// "github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/organizations"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// account, err := organizations.GetBillingAccount(ctx, &organizations.GetBillingAccountArgs{
// BillingAccount: pulumi.StringRef("000000-0000000-0000000-000000"),
// }, nil)
// if err != nil {
// return err
// }
// project, err := organizations.LookupProject(ctx, nil, nil)
// if err != nil {
// return err
// }
// _, err = billing.NewBudget(ctx, "budget", &billing.BudgetArgs{
// BillingAccount: *pulumi.String(account.Id),
// DisplayName: pulumi.String("Example Billing Budget"),
// BudgetFilter: &billing.BudgetBudgetFilterArgs{
// Projects: pulumi.StringArray{
// pulumi.String(fmt.Sprintf("projects/%v", project.Number)),
// },
// CreditTypesTreatment: pulumi.String("INCLUDE_SPECIFIED_CREDITS"),
// Services: pulumi.StringArray{
// pulumi.String("services/24E6-581D-38E5"),
// },
// CreditTypes: pulumi.StringArray{
// pulumi.String("PROMOTION"),
// pulumi.String("FREE_TIER"),
// },
// ResourceAncestors: pulumi.StringArray{
// pulumi.String("organizations/123456789"),
// },
// },
// Amount: &billing.BudgetAmountArgs{
// SpecifiedAmount: &billing.BudgetAmountSpecifiedAmountArgs{
// CurrencyCode: pulumi.String("USD"),
// Units: pulumi.String("100000"),
// },
// },
// ThresholdRules: billing.BudgetThresholdRuleArray{
// &billing.BudgetThresholdRuleArgs{
// ThresholdPercent: pulumi.Float64(0.5),
// },
// &billing.BudgetThresholdRuleArgs{
// ThresholdPercent: pulumi.Float64(0.9),
// SpendBasis: pulumi.String("FORECASTED_SPEND"),
// },
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// ### Billing Budget Notify
//
// ```go
// package main
//
// import (
//
// "fmt"
//
// "github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/billing"
// "github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/monitoring"
// "github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/organizations"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// account, err := organizations.GetBillingAccount(ctx, &organizations.GetBillingAccountArgs{
// BillingAccount: pulumi.StringRef("000000-0000000-0000000-000000"),
// }, nil)
// if err != nil {
// return err
// }
// project, err := organizations.LookupProject(ctx, nil, nil)
// if err != nil {
// return err
// }
// notificationChannel, err := monitoring.NewNotificationChannel(ctx, "notificationChannel", &monitoring.NotificationChannelArgs{
// DisplayName: pulumi.String("Example Notification Channel"),
// Type: pulumi.String("email"),
// Labels: pulumi.StringMap{
// "email_address": pulumi.String("address@example.com"),
// },
// })
// if err != nil {
// return err
// }
// _, err = billing.NewBudget(ctx, "budget", &billing.BudgetArgs{
// BillingAccount: *pulumi.String(account.Id),
// DisplayName: pulumi.String("Example Billing Budget"),
// BudgetFilter: &billing.BudgetBudgetFilterArgs{
// Projects: pulumi.StringArray{
// pulumi.String(fmt.Sprintf("projects/%v", project.Number)),
// },
// },
// Amount: &billing.BudgetAmountArgs{
// SpecifiedAmount: &billing.BudgetAmountSpecifiedAmountArgs{
// CurrencyCode: pulumi.String("USD"),
// Units: pulumi.String("100000"),
// },
// },
// ThresholdRules: billing.BudgetThresholdRuleArray{
// &billing.BudgetThresholdRuleArgs{
// ThresholdPercent: pulumi.Float64(1),
// },
// &billing.BudgetThresholdRuleArgs{
// ThresholdPercent: pulumi.Float64(1),
// SpendBasis: pulumi.String("FORECASTED_SPEND"),
// },
// },
// AllUpdatesRule: &billing.BudgetAllUpdatesRuleArgs{
// MonitoringNotificationChannels: pulumi.StringArray{
// notificationChannel.ID(),
// },
// DisableDefaultIamRecipients: pulumi.Bool(true),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// ### Billing Budget Customperiod
//
// ```go
// package main
//
// import (
//
// "fmt"
//
// "github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/billing"
// "github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/organizations"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// account, err := organizations.GetBillingAccount(ctx, &organizations.GetBillingAccountArgs{
// BillingAccount: pulumi.StringRef("000000-0000000-0000000-000000"),
// }, nil)
// if err != nil {
// return err
// }
// project, err := organizations.LookupProject(ctx, nil, nil)
// if err != nil {
// return err
// }
// _, err = billing.NewBudget(ctx, "budget", &billing.BudgetArgs{
// BillingAccount: *pulumi.String(account.Id),
// DisplayName: pulumi.String("Example Billing Budget"),
// BudgetFilter: &billing.BudgetBudgetFilterArgs{
// Projects: pulumi.StringArray{
// pulumi.String(fmt.Sprintf("projects/%v", project.Number)),
// },
// CreditTypesTreatment: pulumi.String("EXCLUDE_ALL_CREDITS"),
// Services: pulumi.StringArray{
// pulumi.String("services/24E6-581D-38E5"),
// },
// CustomPeriod: &billing.BudgetBudgetFilterCustomPeriodArgs{
// StartDate: &billing.BudgetBudgetFilterCustomPeriodStartDateArgs{
// Year: pulumi.Int(2022),
// Month: pulumi.Int(1),
// Day: pulumi.Int(1),
// },
// EndDate: &billing.BudgetBudgetFilterCustomPeriodEndDateArgs{
// Year: pulumi.Int(2023),
// Month: pulumi.Int(12),
// Day: pulumi.Int(31),
// },
// },
// },
// Amount: &billing.BudgetAmountArgs{
// SpecifiedAmount: &billing.BudgetAmountSpecifiedAmountArgs{
// CurrencyCode: pulumi.String("USD"),
// Units: pulumi.String("100000"),
// },
// },
// ThresholdRules: billing.BudgetThresholdRuleArray{
// &billing.BudgetThresholdRuleArgs{
// ThresholdPercent: pulumi.Float64(0.5),
// },
// &billing.BudgetThresholdRuleArgs{
// ThresholdPercent: pulumi.Float64(0.9),
// },
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// # Budget can be imported using any of these accepted formats
//
// ```sh
//
// $ pulumi import gcp:billing/budget:Budget default billingAccounts/{{billing_account}}/budgets/{{name}}
//
// ```
//
// ```sh
//
// $ pulumi import gcp:billing/budget:Budget default {{billing_account}}/{{name}}
//
// ```
//
// ```sh
//
// $ pulumi import gcp:billing/budget:Budget default {{name}}
//
// ```
type Budget struct {
pulumi.CustomResourceState
// Defines notifications that are sent on every update to the
// billing account's spend, regardless of the thresholds defined
// using threshold rules.
// Structure is documented below.
AllUpdatesRule BudgetAllUpdatesRulePtrOutput `pulumi:"allUpdatesRule"`
// The budgeted amount for each usage period.
// Structure is documented below.
Amount BudgetAmountOutput `pulumi:"amount"`
// ID of the billing account to set a budget on.
BillingAccount pulumi.StringOutput `pulumi:"billingAccount"`
// Filters that define which resources are used to compute the actual
// spend against the budget.
// Structure is documented below.
BudgetFilter BudgetBudgetFilterOutput `pulumi:"budgetFilter"`
// User data for display name in UI. Must be <= 60 chars.
DisplayName pulumi.StringPtrOutput `pulumi:"displayName"`
// Resource name of the budget. The resource name
// implies the scope of a budget. Values are of the form
// billingAccounts/{billingAccountId}/budgets/{budgetId}.
Name pulumi.StringOutput `pulumi:"name"`
// Rules that trigger alerts (notifications of thresholds being
// crossed) when spend exceeds the specified percentages of the
// budget.
// Structure is documented below.
ThresholdRules BudgetThresholdRuleArrayOutput `pulumi:"thresholdRules"`
}
// NewBudget registers a new resource with the given unique name, arguments, and options.
func NewBudget(ctx *pulumi.Context,
name string, args *BudgetArgs, opts ...pulumi.ResourceOption) (*Budget, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Amount == nil {
return nil, errors.New("invalid value for required argument 'Amount'")
}
if args.BillingAccount == nil {
return nil, errors.New("invalid value for required argument 'BillingAccount'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource Budget
err := ctx.RegisterResource("gcp:billing/budget:Budget", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetBudget gets an existing Budget resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetBudget(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *BudgetState, opts ...pulumi.ResourceOption) (*Budget, error) {
var resource Budget
err := ctx.ReadResource("gcp:billing/budget:Budget", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Budget resources.
type budgetState struct {
// Defines notifications that are sent on every update to the
// billing account's spend, regardless of the thresholds defined
// using threshold rules.
// Structure is documented below.
AllUpdatesRule *BudgetAllUpdatesRule `pulumi:"allUpdatesRule"`
// The budgeted amount for each usage period.
// Structure is documented below.
Amount *BudgetAmount `pulumi:"amount"`
// ID of the billing account to set a budget on.
BillingAccount *string `pulumi:"billingAccount"`
// Filters that define which resources are used to compute the actual
// spend against the budget.
// Structure is documented below.
BudgetFilter *BudgetBudgetFilter `pulumi:"budgetFilter"`
// User data for display name in UI. Must be <= 60 chars.
DisplayName *string `pulumi:"displayName"`
// Resource name of the budget. The resource name
// implies the scope of a budget. Values are of the form
// billingAccounts/{billingAccountId}/budgets/{budgetId}.
Name *string `pulumi:"name"`
// Rules that trigger alerts (notifications of thresholds being
// crossed) when spend exceeds the specified percentages of the
// budget.
// Structure is documented below.
ThresholdRules []BudgetThresholdRule `pulumi:"thresholdRules"`
}
type BudgetState struct {
// Defines notifications that are sent on every update to the
// billing account's spend, regardless of the thresholds defined
// using threshold rules.
// Structure is documented below.
AllUpdatesRule BudgetAllUpdatesRulePtrInput
// The budgeted amount for each usage period.
// Structure is documented below.
Amount BudgetAmountPtrInput
// ID of the billing account to set a budget on.
BillingAccount pulumi.StringPtrInput
// Filters that define which resources are used to compute the actual
// spend against the budget.
// Structure is documented below.
BudgetFilter BudgetBudgetFilterPtrInput
// User data for display name in UI. Must be <= 60 chars.
DisplayName pulumi.StringPtrInput
// Resource name of the budget. The resource name
// implies the scope of a budget. Values are of the form
// billingAccounts/{billingAccountId}/budgets/{budgetId}.
Name pulumi.StringPtrInput
// Rules that trigger alerts (notifications of thresholds being
// crossed) when spend exceeds the specified percentages of the
// budget.
// Structure is documented below.
ThresholdRules BudgetThresholdRuleArrayInput
}
func (BudgetState) ElementType() reflect.Type {
return reflect.TypeOf((*budgetState)(nil)).Elem()
}
type budgetArgs struct {
// Defines notifications that are sent on every update to the
// billing account's spend, regardless of the thresholds defined
// using threshold rules.
// Structure is documented below.
AllUpdatesRule *BudgetAllUpdatesRule `pulumi:"allUpdatesRule"`
// The budgeted amount for each usage period.
// Structure is documented below.
Amount BudgetAmount `pulumi:"amount"`
// ID of the billing account to set a budget on.
BillingAccount string `pulumi:"billingAccount"`
// Filters that define which resources are used to compute the actual
// spend against the budget.
// Structure is documented below.
BudgetFilter *BudgetBudgetFilter `pulumi:"budgetFilter"`
// User data for display name in UI. Must be <= 60 chars.
DisplayName *string `pulumi:"displayName"`
// Rules that trigger alerts (notifications of thresholds being
// crossed) when spend exceeds the specified percentages of the
// budget.
// Structure is documented below.
ThresholdRules []BudgetThresholdRule `pulumi:"thresholdRules"`
}
// The set of arguments for constructing a Budget resource.
type BudgetArgs struct {
// Defines notifications that are sent on every update to the
// billing account's spend, regardless of the thresholds defined
// using threshold rules.
// Structure is documented below.
AllUpdatesRule BudgetAllUpdatesRulePtrInput
// The budgeted amount for each usage period.
// Structure is documented below.
Amount BudgetAmountInput
// ID of the billing account to set a budget on.
BillingAccount pulumi.StringInput
// Filters that define which resources are used to compute the actual
// spend against the budget.
// Structure is documented below.
BudgetFilter BudgetBudgetFilterPtrInput
// User data for display name in UI. Must be <= 60 chars.
DisplayName pulumi.StringPtrInput
// Rules that trigger alerts (notifications of thresholds being
// crossed) when spend exceeds the specified percentages of the
// budget.
// Structure is documented below.
ThresholdRules BudgetThresholdRuleArrayInput
}
func (BudgetArgs) ElementType() reflect.Type {
return reflect.TypeOf((*budgetArgs)(nil)).Elem()
}
type BudgetInput interface {
pulumi.Input
ToBudgetOutput() BudgetOutput
ToBudgetOutputWithContext(ctx context.Context) BudgetOutput
}
func (*Budget) ElementType() reflect.Type {
return reflect.TypeOf((**Budget)(nil)).Elem()
}
func (i *Budget) ToBudgetOutput() BudgetOutput {
return i.ToBudgetOutputWithContext(context.Background())
}
func (i *Budget) ToBudgetOutputWithContext(ctx context.Context) BudgetOutput {
return pulumi.ToOutputWithContext(ctx, i).(BudgetOutput)
}
func (i *Budget) ToOutput(ctx context.Context) pulumix.Output[*Budget] {
return pulumix.Output[*Budget]{
OutputState: i.ToBudgetOutputWithContext(ctx).OutputState,
}
}
// BudgetArrayInput is an input type that accepts BudgetArray and BudgetArrayOutput values.
// You can construct a concrete instance of `BudgetArrayInput` via:
//
// BudgetArray{ BudgetArgs{...} }
type BudgetArrayInput interface {
pulumi.Input
ToBudgetArrayOutput() BudgetArrayOutput
ToBudgetArrayOutputWithContext(context.Context) BudgetArrayOutput
}
type BudgetArray []BudgetInput
func (BudgetArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Budget)(nil)).Elem()
}
func (i BudgetArray) ToBudgetArrayOutput() BudgetArrayOutput {
return i.ToBudgetArrayOutputWithContext(context.Background())
}
func (i BudgetArray) ToBudgetArrayOutputWithContext(ctx context.Context) BudgetArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(BudgetArrayOutput)
}
func (i BudgetArray) ToOutput(ctx context.Context) pulumix.Output[[]*Budget] {
return pulumix.Output[[]*Budget]{
OutputState: i.ToBudgetArrayOutputWithContext(ctx).OutputState,
}
}
// BudgetMapInput is an input type that accepts BudgetMap and BudgetMapOutput values.
// You can construct a concrete instance of `BudgetMapInput` via:
//
// BudgetMap{ "key": BudgetArgs{...} }
type BudgetMapInput interface {
pulumi.Input
ToBudgetMapOutput() BudgetMapOutput
ToBudgetMapOutputWithContext(context.Context) BudgetMapOutput
}
type BudgetMap map[string]BudgetInput
func (BudgetMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Budget)(nil)).Elem()
}
func (i BudgetMap) ToBudgetMapOutput() BudgetMapOutput {
return i.ToBudgetMapOutputWithContext(context.Background())
}
func (i BudgetMap) ToBudgetMapOutputWithContext(ctx context.Context) BudgetMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(BudgetMapOutput)
}
func (i BudgetMap) ToOutput(ctx context.Context) pulumix.Output[map[string]*Budget] {
return pulumix.Output[map[string]*Budget]{
OutputState: i.ToBudgetMapOutputWithContext(ctx).OutputState,
}
}
type BudgetOutput struct{ *pulumi.OutputState }
func (BudgetOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Budget)(nil)).Elem()
}
func (o BudgetOutput) ToBudgetOutput() BudgetOutput {
return o
}
func (o BudgetOutput) ToBudgetOutputWithContext(ctx context.Context) BudgetOutput {
return o
}
func (o BudgetOutput) ToOutput(ctx context.Context) pulumix.Output[*Budget] {
return pulumix.Output[*Budget]{
OutputState: o.OutputState,
}
}
// Defines notifications that are sent on every update to the
// billing account's spend, regardless of the thresholds defined
// using threshold rules.
// Structure is documented below.
func (o BudgetOutput) AllUpdatesRule() BudgetAllUpdatesRulePtrOutput {
return o.ApplyT(func(v *Budget) BudgetAllUpdatesRulePtrOutput { return v.AllUpdatesRule }).(BudgetAllUpdatesRulePtrOutput)
}
// The budgeted amount for each usage period.
// Structure is documented below.
func (o BudgetOutput) Amount() BudgetAmountOutput {
return o.ApplyT(func(v *Budget) BudgetAmountOutput { return v.Amount }).(BudgetAmountOutput)
}
// ID of the billing account to set a budget on.
func (o BudgetOutput) BillingAccount() pulumi.StringOutput {
return o.ApplyT(func(v *Budget) pulumi.StringOutput { return v.BillingAccount }).(pulumi.StringOutput)
}
// Filters that define which resources are used to compute the actual
// spend against the budget.
// Structure is documented below.
func (o BudgetOutput) BudgetFilter() BudgetBudgetFilterOutput {
return o.ApplyT(func(v *Budget) BudgetBudgetFilterOutput { return v.BudgetFilter }).(BudgetBudgetFilterOutput)
}
// User data for display name in UI. Must be <= 60 chars.
func (o BudgetOutput) DisplayName() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Budget) pulumi.StringPtrOutput { return v.DisplayName }).(pulumi.StringPtrOutput)
}
// Resource name of the budget. The resource name
// implies the scope of a budget. Values are of the form
// billingAccounts/{billingAccountId}/budgets/{budgetId}.
func (o BudgetOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *Budget) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// Rules that trigger alerts (notifications of thresholds being
// crossed) when spend exceeds the specified percentages of the
// budget.
// Structure is documented below.
func (o BudgetOutput) ThresholdRules() BudgetThresholdRuleArrayOutput {
return o.ApplyT(func(v *Budget) BudgetThresholdRuleArrayOutput { return v.ThresholdRules }).(BudgetThresholdRuleArrayOutput)
}
type BudgetArrayOutput struct{ *pulumi.OutputState }
func (BudgetArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Budget)(nil)).Elem()
}
func (o BudgetArrayOutput) ToBudgetArrayOutput() BudgetArrayOutput {
return o
}
func (o BudgetArrayOutput) ToBudgetArrayOutputWithContext(ctx context.Context) BudgetArrayOutput {
return o
}
func (o BudgetArrayOutput) ToOutput(ctx context.Context) pulumix.Output[[]*Budget] {
return pulumix.Output[[]*Budget]{
OutputState: o.OutputState,
}
}
func (o BudgetArrayOutput) Index(i pulumi.IntInput) BudgetOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Budget {
return vs[0].([]*Budget)[vs[1].(int)]
}).(BudgetOutput)
}
type BudgetMapOutput struct{ *pulumi.OutputState }
func (BudgetMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Budget)(nil)).Elem()
}
func (o BudgetMapOutput) ToBudgetMapOutput() BudgetMapOutput {
return o
}
func (o BudgetMapOutput) ToBudgetMapOutputWithContext(ctx context.Context) BudgetMapOutput {
return o
}
func (o BudgetMapOutput) ToOutput(ctx context.Context) pulumix.Output[map[string]*Budget] {
return pulumix.Output[map[string]*Budget]{
OutputState: o.OutputState,
}
}
func (o BudgetMapOutput) MapIndex(k pulumi.StringInput) BudgetOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Budget {
return vs[0].(map[string]*Budget)[vs[1].(string)]
}).(BudgetOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*BudgetInput)(nil)).Elem(), &Budget{})
pulumi.RegisterInputType(reflect.TypeOf((*BudgetArrayInput)(nil)).Elem(), BudgetArray{})
pulumi.RegisterInputType(reflect.TypeOf((*BudgetMapInput)(nil)).Elem(), BudgetMap{})
pulumi.RegisterOutputType(BudgetOutput{})
pulumi.RegisterOutputType(BudgetArrayOutput{})
pulumi.RegisterOutputType(BudgetMapOutput{})
}