/
taxCategoryRate.go
302 lines (249 loc) · 12.1 KB
/
taxCategoryRate.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
// 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 commercetools
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-commercetools/sdk/go/commercetools/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
type TaxCategoryRate struct {
pulumi.CustomResourceState
// Number Percentage in the range of [0..1]. The sum of the amounts of all subRates, if there are any
Amount pulumi.Float64PtrOutput `pulumi:"amount"`
// A two-digit country code as per [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
Country pulumi.StringOutput `pulumi:"country"`
IncludedInPrice pulumi.BoolOutput `pulumi:"includedInPrice"`
Name pulumi.StringOutput `pulumi:"name"`
// The state in the country
State pulumi.StringPtrOutput `pulumi:"state"`
// For countries (for example the US) where the total tax is a combination of multiple taxes (for example state and local
// taxes)
SubRates TaxCategoryRateSubRateArrayOutput `pulumi:"subRates"`
TaxCategoryId pulumi.StringOutput `pulumi:"taxCategoryId"`
}
// NewTaxCategoryRate registers a new resource with the given unique name, arguments, and options.
func NewTaxCategoryRate(ctx *pulumi.Context,
name string, args *TaxCategoryRateArgs, opts ...pulumi.ResourceOption) (*TaxCategoryRate, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Country == nil {
return nil, errors.New("invalid value for required argument 'Country'")
}
if args.IncludedInPrice == nil {
return nil, errors.New("invalid value for required argument 'IncludedInPrice'")
}
if args.TaxCategoryId == nil {
return nil, errors.New("invalid value for required argument 'TaxCategoryId'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource TaxCategoryRate
err := ctx.RegisterResource("commercetools:index/taxCategoryRate:TaxCategoryRate", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetTaxCategoryRate gets an existing TaxCategoryRate 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 GetTaxCategoryRate(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *TaxCategoryRateState, opts ...pulumi.ResourceOption) (*TaxCategoryRate, error) {
var resource TaxCategoryRate
err := ctx.ReadResource("commercetools:index/taxCategoryRate:TaxCategoryRate", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering TaxCategoryRate resources.
type taxCategoryRateState struct {
// Number Percentage in the range of [0..1]. The sum of the amounts of all subRates, if there are any
Amount *float64 `pulumi:"amount"`
// A two-digit country code as per [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
Country *string `pulumi:"country"`
IncludedInPrice *bool `pulumi:"includedInPrice"`
Name *string `pulumi:"name"`
// The state in the country
State *string `pulumi:"state"`
// For countries (for example the US) where the total tax is a combination of multiple taxes (for example state and local
// taxes)
SubRates []TaxCategoryRateSubRate `pulumi:"subRates"`
TaxCategoryId *string `pulumi:"taxCategoryId"`
}
type TaxCategoryRateState struct {
// Number Percentage in the range of [0..1]. The sum of the amounts of all subRates, if there are any
Amount pulumi.Float64PtrInput
// A two-digit country code as per [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
Country pulumi.StringPtrInput
IncludedInPrice pulumi.BoolPtrInput
Name pulumi.StringPtrInput
// The state in the country
State pulumi.StringPtrInput
// For countries (for example the US) where the total tax is a combination of multiple taxes (for example state and local
// taxes)
SubRates TaxCategoryRateSubRateArrayInput
TaxCategoryId pulumi.StringPtrInput
}
func (TaxCategoryRateState) ElementType() reflect.Type {
return reflect.TypeOf((*taxCategoryRateState)(nil)).Elem()
}
type taxCategoryRateArgs struct {
// Number Percentage in the range of [0..1]. The sum of the amounts of all subRates, if there are any
Amount *float64 `pulumi:"amount"`
// A two-digit country code as per [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
Country string `pulumi:"country"`
IncludedInPrice bool `pulumi:"includedInPrice"`
Name *string `pulumi:"name"`
// The state in the country
State *string `pulumi:"state"`
// For countries (for example the US) where the total tax is a combination of multiple taxes (for example state and local
// taxes)
SubRates []TaxCategoryRateSubRate `pulumi:"subRates"`
TaxCategoryId string `pulumi:"taxCategoryId"`
}
// The set of arguments for constructing a TaxCategoryRate resource.
type TaxCategoryRateArgs struct {
// Number Percentage in the range of [0..1]. The sum of the amounts of all subRates, if there are any
Amount pulumi.Float64PtrInput
// A two-digit country code as per [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
Country pulumi.StringInput
IncludedInPrice pulumi.BoolInput
Name pulumi.StringPtrInput
// The state in the country
State pulumi.StringPtrInput
// For countries (for example the US) where the total tax is a combination of multiple taxes (for example state and local
// taxes)
SubRates TaxCategoryRateSubRateArrayInput
TaxCategoryId pulumi.StringInput
}
func (TaxCategoryRateArgs) ElementType() reflect.Type {
return reflect.TypeOf((*taxCategoryRateArgs)(nil)).Elem()
}
type TaxCategoryRateInput interface {
pulumi.Input
ToTaxCategoryRateOutput() TaxCategoryRateOutput
ToTaxCategoryRateOutputWithContext(ctx context.Context) TaxCategoryRateOutput
}
func (*TaxCategoryRate) ElementType() reflect.Type {
return reflect.TypeOf((**TaxCategoryRate)(nil)).Elem()
}
func (i *TaxCategoryRate) ToTaxCategoryRateOutput() TaxCategoryRateOutput {
return i.ToTaxCategoryRateOutputWithContext(context.Background())
}
func (i *TaxCategoryRate) ToTaxCategoryRateOutputWithContext(ctx context.Context) TaxCategoryRateOutput {
return pulumi.ToOutputWithContext(ctx, i).(TaxCategoryRateOutput)
}
// TaxCategoryRateArrayInput is an input type that accepts TaxCategoryRateArray and TaxCategoryRateArrayOutput values.
// You can construct a concrete instance of `TaxCategoryRateArrayInput` via:
//
// TaxCategoryRateArray{ TaxCategoryRateArgs{...} }
type TaxCategoryRateArrayInput interface {
pulumi.Input
ToTaxCategoryRateArrayOutput() TaxCategoryRateArrayOutput
ToTaxCategoryRateArrayOutputWithContext(context.Context) TaxCategoryRateArrayOutput
}
type TaxCategoryRateArray []TaxCategoryRateInput
func (TaxCategoryRateArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*TaxCategoryRate)(nil)).Elem()
}
func (i TaxCategoryRateArray) ToTaxCategoryRateArrayOutput() TaxCategoryRateArrayOutput {
return i.ToTaxCategoryRateArrayOutputWithContext(context.Background())
}
func (i TaxCategoryRateArray) ToTaxCategoryRateArrayOutputWithContext(ctx context.Context) TaxCategoryRateArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(TaxCategoryRateArrayOutput)
}
// TaxCategoryRateMapInput is an input type that accepts TaxCategoryRateMap and TaxCategoryRateMapOutput values.
// You can construct a concrete instance of `TaxCategoryRateMapInput` via:
//
// TaxCategoryRateMap{ "key": TaxCategoryRateArgs{...} }
type TaxCategoryRateMapInput interface {
pulumi.Input
ToTaxCategoryRateMapOutput() TaxCategoryRateMapOutput
ToTaxCategoryRateMapOutputWithContext(context.Context) TaxCategoryRateMapOutput
}
type TaxCategoryRateMap map[string]TaxCategoryRateInput
func (TaxCategoryRateMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*TaxCategoryRate)(nil)).Elem()
}
func (i TaxCategoryRateMap) ToTaxCategoryRateMapOutput() TaxCategoryRateMapOutput {
return i.ToTaxCategoryRateMapOutputWithContext(context.Background())
}
func (i TaxCategoryRateMap) ToTaxCategoryRateMapOutputWithContext(ctx context.Context) TaxCategoryRateMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(TaxCategoryRateMapOutput)
}
type TaxCategoryRateOutput struct{ *pulumi.OutputState }
func (TaxCategoryRateOutput) ElementType() reflect.Type {
return reflect.TypeOf((**TaxCategoryRate)(nil)).Elem()
}
func (o TaxCategoryRateOutput) ToTaxCategoryRateOutput() TaxCategoryRateOutput {
return o
}
func (o TaxCategoryRateOutput) ToTaxCategoryRateOutputWithContext(ctx context.Context) TaxCategoryRateOutput {
return o
}
// Number Percentage in the range of [0..1]. The sum of the amounts of all subRates, if there are any
func (o TaxCategoryRateOutput) Amount() pulumi.Float64PtrOutput {
return o.ApplyT(func(v *TaxCategoryRate) pulumi.Float64PtrOutput { return v.Amount }).(pulumi.Float64PtrOutput)
}
// A two-digit country code as per [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
func (o TaxCategoryRateOutput) Country() pulumi.StringOutput {
return o.ApplyT(func(v *TaxCategoryRate) pulumi.StringOutput { return v.Country }).(pulumi.StringOutput)
}
func (o TaxCategoryRateOutput) IncludedInPrice() pulumi.BoolOutput {
return o.ApplyT(func(v *TaxCategoryRate) pulumi.BoolOutput { return v.IncludedInPrice }).(pulumi.BoolOutput)
}
func (o TaxCategoryRateOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *TaxCategoryRate) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// The state in the country
func (o TaxCategoryRateOutput) State() pulumi.StringPtrOutput {
return o.ApplyT(func(v *TaxCategoryRate) pulumi.StringPtrOutput { return v.State }).(pulumi.StringPtrOutput)
}
// For countries (for example the US) where the total tax is a combination of multiple taxes (for example state and local
// taxes)
func (o TaxCategoryRateOutput) SubRates() TaxCategoryRateSubRateArrayOutput {
return o.ApplyT(func(v *TaxCategoryRate) TaxCategoryRateSubRateArrayOutput { return v.SubRates }).(TaxCategoryRateSubRateArrayOutput)
}
func (o TaxCategoryRateOutput) TaxCategoryId() pulumi.StringOutput {
return o.ApplyT(func(v *TaxCategoryRate) pulumi.StringOutput { return v.TaxCategoryId }).(pulumi.StringOutput)
}
type TaxCategoryRateArrayOutput struct{ *pulumi.OutputState }
func (TaxCategoryRateArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*TaxCategoryRate)(nil)).Elem()
}
func (o TaxCategoryRateArrayOutput) ToTaxCategoryRateArrayOutput() TaxCategoryRateArrayOutput {
return o
}
func (o TaxCategoryRateArrayOutput) ToTaxCategoryRateArrayOutputWithContext(ctx context.Context) TaxCategoryRateArrayOutput {
return o
}
func (o TaxCategoryRateArrayOutput) Index(i pulumi.IntInput) TaxCategoryRateOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *TaxCategoryRate {
return vs[0].([]*TaxCategoryRate)[vs[1].(int)]
}).(TaxCategoryRateOutput)
}
type TaxCategoryRateMapOutput struct{ *pulumi.OutputState }
func (TaxCategoryRateMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*TaxCategoryRate)(nil)).Elem()
}
func (o TaxCategoryRateMapOutput) ToTaxCategoryRateMapOutput() TaxCategoryRateMapOutput {
return o
}
func (o TaxCategoryRateMapOutput) ToTaxCategoryRateMapOutputWithContext(ctx context.Context) TaxCategoryRateMapOutput {
return o
}
func (o TaxCategoryRateMapOutput) MapIndex(k pulumi.StringInput) TaxCategoryRateOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *TaxCategoryRate {
return vs[0].(map[string]*TaxCategoryRate)[vs[1].(string)]
}).(TaxCategoryRateOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*TaxCategoryRateInput)(nil)).Elem(), &TaxCategoryRate{})
pulumi.RegisterInputType(reflect.TypeOf((*TaxCategoryRateArrayInput)(nil)).Elem(), TaxCategoryRateArray{})
pulumi.RegisterInputType(reflect.TypeOf((*TaxCategoryRateMapInput)(nil)).Elem(), TaxCategoryRateMap{})
pulumi.RegisterOutputType(TaxCategoryRateOutput{})
pulumi.RegisterOutputType(TaxCategoryRateArrayOutput{})
pulumi.RegisterOutputType(TaxCategoryRateMapOutput{})
}