/
storage_hmac_key.go
73 lines (64 loc) · 2.5 KB
/
storage_hmac_key.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
// ----------------------------------------------------------------------------
//
// *** 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 StorageHmacKeyAssetType string = "storage.googleapis.com/HmacKey"
func resourceConverterStorageHmacKey() ResourceConverter {
return ResourceConverter{
AssetType: StorageHmacKeyAssetType,
Convert: GetStorageHmacKeyCaiObject,
}
}
func GetStorageHmacKeyCaiObject(d TerraformResourceData, config *Config) ([]Asset, error) {
name, err := assetName(d, config, "//storage.googleapis.com/projects/{{project}}/hmacKeys/{{access_id}}")
if err != nil {
return []Asset{}, err
}
if obj, err := GetStorageHmacKeyApiObject(d, config); err == nil {
return []Asset{{
Name: name,
Type: StorageHmacKeyAssetType,
Resource: &AssetResource{
Version: "v1",
DiscoveryDocumentURI: "https://www.googleapis.com/discovery/v1/apis/storage/v1/rest",
DiscoveryName: "HmacKey",
Data: obj,
},
}}, nil
} else {
return []Asset{}, err
}
}
func GetStorageHmacKeyApiObject(d TerraformResourceData, config *Config) (map[string]interface{}, error) {
obj := make(map[string]interface{})
serviceAccountEmailProp, err := expandStorageHmacKeyServiceAccountEmail(d.Get("service_account_email"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("service_account_email"); !isEmptyValue(reflect.ValueOf(serviceAccountEmailProp)) && (ok || !reflect.DeepEqual(v, serviceAccountEmailProp)) {
obj["serviceAccountEmail"] = serviceAccountEmailProp
}
stateProp, err := expandStorageHmacKeyState(d.Get("state"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("state"); !isEmptyValue(reflect.ValueOf(stateProp)) && (ok || !reflect.DeepEqual(v, stateProp)) {
obj["state"] = stateProp
}
return obj, nil
}
func expandStorageHmacKeyServiceAccountEmail(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}
func expandStorageHmacKeyState(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}