This repository has been archived by the owner on Mar 11, 2021. It is now read-only.
/
budget.go
220 lines (196 loc) · 11.5 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
// *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package v20190401preview
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// A budget resource.
type Budget struct {
pulumi.CustomResourceState
// The total amount of cost to track with the budget
Amount pulumi.Float64Output `pulumi:"amount"`
// The category of the budget, whether the budget tracks cost or usage.
Category pulumi.StringOutput `pulumi:"category"`
// The current amount of cost which is being tracked for a budget.
CurrentSpend CurrentSpendResponseOutput `pulumi:"currentSpend"`
// eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not.
ETag pulumi.StringPtrOutput `pulumi:"eTag"`
// May be used to filter budgets.
Filter ReportConfigFilterResponsePtrOutput `pulumi:"filter"`
// Resource name.
Name pulumi.StringOutput `pulumi:"name"`
// Dictionary of notifications associated with the budget. Budget can have up to five notifications.
Notifications NotificationResponseMapOutput `pulumi:"notifications"`
// The time covered by a budget. Tracking of the amount will be reset based on the time grain.
TimeGrain pulumi.StringOutput `pulumi:"timeGrain"`
// Has start and end date of the budget. The start date must be first of the month and should be less than the end date. Budget start date must be on or after June 1, 2017. Future start date should not be more than three months. Past start date should be selected within the timegrain period. There are no restrictions on the end date.
TimePeriod BudgetTimePeriodResponseOutput `pulumi:"timePeriod"`
// Resource type.
Type pulumi.StringOutput `pulumi:"type"`
}
// 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.BudgetName == nil {
return nil, errors.New("invalid value for required argument 'BudgetName'")
}
if args.Category == nil {
return nil, errors.New("invalid value for required argument 'Category'")
}
if args.Scope == nil {
return nil, errors.New("invalid value for required argument 'Scope'")
}
if args.TimeGrain == nil {
return nil, errors.New("invalid value for required argument 'TimeGrain'")
}
if args.TimePeriod == nil {
return nil, errors.New("invalid value for required argument 'TimePeriod'")
}
var resource Budget
err := ctx.RegisterResource("azure-nextgen:costmanagement/v20190401preview: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("azure-nextgen:costmanagement/v20190401preview: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 {
// The total amount of cost to track with the budget
Amount *float64 `pulumi:"amount"`
// The category of the budget, whether the budget tracks cost or usage.
Category *string `pulumi:"category"`
// The current amount of cost which is being tracked for a budget.
CurrentSpend *CurrentSpendResponse `pulumi:"currentSpend"`
// eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not.
ETag *string `pulumi:"eTag"`
// May be used to filter budgets.
Filter *ReportConfigFilterResponse `pulumi:"filter"`
// Resource name.
Name *string `pulumi:"name"`
// Dictionary of notifications associated with the budget. Budget can have up to five notifications.
Notifications map[string]NotificationResponse `pulumi:"notifications"`
// The time covered by a budget. Tracking of the amount will be reset based on the time grain.
TimeGrain *string `pulumi:"timeGrain"`
// Has start and end date of the budget. The start date must be first of the month and should be less than the end date. Budget start date must be on or after June 1, 2017. Future start date should not be more than three months. Past start date should be selected within the timegrain period. There are no restrictions on the end date.
TimePeriod *BudgetTimePeriodResponse `pulumi:"timePeriod"`
// Resource type.
Type *string `pulumi:"type"`
}
type BudgetState struct {
// The total amount of cost to track with the budget
Amount pulumi.Float64PtrInput
// The category of the budget, whether the budget tracks cost or usage.
Category pulumi.StringPtrInput
// The current amount of cost which is being tracked for a budget.
CurrentSpend CurrentSpendResponsePtrInput
// eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not.
ETag pulumi.StringPtrInput
// May be used to filter budgets.
Filter ReportConfigFilterResponsePtrInput
// Resource name.
Name pulumi.StringPtrInput
// Dictionary of notifications associated with the budget. Budget can have up to five notifications.
Notifications NotificationResponseMapInput
// The time covered by a budget. Tracking of the amount will be reset based on the time grain.
TimeGrain pulumi.StringPtrInput
// Has start and end date of the budget. The start date must be first of the month and should be less than the end date. Budget start date must be on or after June 1, 2017. Future start date should not be more than three months. Past start date should be selected within the timegrain period. There are no restrictions on the end date.
TimePeriod BudgetTimePeriodResponsePtrInput
// Resource type.
Type pulumi.StringPtrInput
}
func (BudgetState) ElementType() reflect.Type {
return reflect.TypeOf((*budgetState)(nil)).Elem()
}
type budgetArgs struct {
// The total amount of cost to track with the budget
Amount float64 `pulumi:"amount"`
// Budget Name.
BudgetName string `pulumi:"budgetName"`
// The category of the budget, whether the budget tracks cost or usage.
Category string `pulumi:"category"`
// eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not.
ETag *string `pulumi:"eTag"`
// May be used to filter budgets.
Filter *ReportConfigFilter `pulumi:"filter"`
// Dictionary of notifications associated with the budget. Budget can have up to five notifications.
Notifications map[string]Notification `pulumi:"notifications"`
// The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope.
Scope string `pulumi:"scope"`
// The time covered by a budget. Tracking of the amount will be reset based on the time grain.
TimeGrain string `pulumi:"timeGrain"`
// Has start and end date of the budget. The start date must be first of the month and should be less than the end date. Budget start date must be on or after June 1, 2017. Future start date should not be more than three months. Past start date should be selected within the timegrain period. There are no restrictions on the end date.
TimePeriod BudgetTimePeriod `pulumi:"timePeriod"`
}
// The set of arguments for constructing a Budget resource.
type BudgetArgs struct {
// The total amount of cost to track with the budget
Amount pulumi.Float64Input
// Budget Name.
BudgetName pulumi.StringInput
// The category of the budget, whether the budget tracks cost or usage.
Category pulumi.StringInput
// eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not.
ETag pulumi.StringPtrInput
// May be used to filter budgets.
Filter ReportConfigFilterPtrInput
// Dictionary of notifications associated with the budget. Budget can have up to five notifications.
Notifications NotificationMapInput
// The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope.
Scope pulumi.StringInput
// The time covered by a budget. Tracking of the amount will be reset based on the time grain.
TimeGrain pulumi.StringInput
// Has start and end date of the budget. The start date must be first of the month and should be less than the end date. Budget start date must be on or after June 1, 2017. Future start date should not be more than three months. Past start date should be selected within the timegrain period. There are no restrictions on the end date.
TimePeriod BudgetTimePeriodInput
}
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))
}
func (i *Budget) ToBudgetOutput() BudgetOutput {
return i.ToBudgetOutputWithContext(context.Background())
}
func (i *Budget) ToBudgetOutputWithContext(ctx context.Context) BudgetOutput {
return pulumi.ToOutputWithContext(ctx, i).(BudgetOutput)
}
type BudgetOutput struct {
*pulumi.OutputState
}
func (BudgetOutput) ElementType() reflect.Type {
return reflect.TypeOf((*Budget)(nil))
}
func (o BudgetOutput) ToBudgetOutput() BudgetOutput {
return o
}
func (o BudgetOutput) ToBudgetOutputWithContext(ctx context.Context) BudgetOutput {
return o
}
func init() {
pulumi.RegisterOutputType(BudgetOutput{})
}