/
bigqueryreservation_capacity_commitment.go
93 lines (82 loc) · 3.71 KB
/
bigqueryreservation_capacity_commitment.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
// ----------------------------------------------------------------------------
//
// *** AUTO GENERATED CODE *** Type: MMv1 ***
//
// ----------------------------------------------------------------------------
//
// This file is automatically generated by Magic Modules and manual
// changes will be clobbered when the file is regenerated.
//
// Please read more about how to change this file in
// .github/CONTRIBUTING.md.
//
// ----------------------------------------------------------------------------
package google
import "reflect"
const BigqueryReservationCapacityCommitmentAssetType string = "bigqueryreservation.googleapis.com/CapacityCommitment"
func resourceConverterBigqueryReservationCapacityCommitment() ResourceConverter {
return ResourceConverter{
AssetType: BigqueryReservationCapacityCommitmentAssetType,
Convert: GetBigqueryReservationCapacityCommitmentCaiObject,
}
}
func GetBigqueryReservationCapacityCommitmentCaiObject(d TerraformResourceData, config *Config) ([]Asset, error) {
name, err := assetName(d, config, "//bigqueryreservation.googleapis.com/projects/{{project}}/locations/{{location}}/capacityCommitments/{{capacity_commitment_id}}")
if err != nil {
return []Asset{}, err
}
if obj, err := GetBigqueryReservationCapacityCommitmentApiObject(d, config); err == nil {
return []Asset{{
Name: name,
Type: BigqueryReservationCapacityCommitmentAssetType,
Resource: &AssetResource{
Version: "v1",
DiscoveryDocumentURI: "https://www.googleapis.com/discovery/v1/apis/bigqueryreservation/v1/rest",
DiscoveryName: "CapacityCommitment",
Data: obj,
},
}}, nil
} else {
return []Asset{}, err
}
}
func GetBigqueryReservationCapacityCommitmentApiObject(d TerraformResourceData, config *Config) (map[string]interface{}, error) {
obj := make(map[string]interface{})
slotCountProp, err := expandBigqueryReservationCapacityCommitmentSlotCount(d.Get("slot_count"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("slot_count"); !isEmptyValue(reflect.ValueOf(slotCountProp)) && (ok || !reflect.DeepEqual(v, slotCountProp)) {
obj["slotCount"] = slotCountProp
}
planProp, err := expandBigqueryReservationCapacityCommitmentPlan(d.Get("plan"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("plan"); !isEmptyValue(reflect.ValueOf(planProp)) && (ok || !reflect.DeepEqual(v, planProp)) {
obj["plan"] = planProp
}
renewalPlanProp, err := expandBigqueryReservationCapacityCommitmentRenewalPlan(d.Get("renewal_plan"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("renewal_plan"); !isEmptyValue(reflect.ValueOf(renewalPlanProp)) && (ok || !reflect.DeepEqual(v, renewalPlanProp)) {
obj["renewalPlan"] = renewalPlanProp
}
editionProp, err := expandBigqueryReservationCapacityCommitmentEdition(d.Get("edition"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("edition"); !isEmptyValue(reflect.ValueOf(editionProp)) && (ok || !reflect.DeepEqual(v, editionProp)) {
obj["edition"] = editionProp
}
return obj, nil
}
func expandBigqueryReservationCapacityCommitmentSlotCount(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}
func expandBigqueryReservationCapacityCommitmentPlan(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}
func expandBigqueryReservationCapacityCommitmentRenewalPlan(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}
func expandBigqueryReservationCapacityCommitmentEdition(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}