Skip to content

Commit

Permalink
updated storage_pool (#9229) (#1719)
Browse files Browse the repository at this point in the history
[upstream:7a20c9cc77f933c0085225b00e59556e8ae3b57c]

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Nov 21, 2023
1 parent 8d4c974 commit 496dc48
Show file tree
Hide file tree
Showing 3 changed files with 149 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/hashicorp/hcl/v2 v2.19.1
github.com/hashicorp/terraform-json v0.17.1
github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20231120212659-9fdec91fbe54
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20231121133934-269de2a0b031
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.8.3
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwU
github.com/hashicorp/terraform-plugin-mux v0.8.0 h1:WCTP66mZ+iIaIrCNJnjPEYnVjawTshnDJu12BcXK1EI=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0 h1:wcOKYwPI9IorAJEBLzgclh3xVolO7ZorYd6U1vnok14=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0/go.mod h1:qH/34G25Ugdj5FcM95cSoXzUgIbgfhVLXCcEcYaMwq8=
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20231120212659-9fdec91fbe54 h1:9a1bMEQkm+erLblcbAxy4owdMEwOHxHwQhe5P+VIv7U=
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20231120212659-9fdec91fbe54/go.mod h1:W/Ri6ztEJqzSaQcRxRLTlbjcguRWT5M0nGvNcnqmGps=
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20231121133934-269de2a0b031 h1:MLaZU3afWwBO1PHvI8msaB1KOrEIP2rnKLwYvl6rrO8=
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20231121133934-269de2a0b031/go.mod h1:W/Ri6ztEJqzSaQcRxRLTlbjcguRWT5M0nGvNcnqmGps=
github.com/hashicorp/terraform-registry-address v0.2.2 h1:lPQBg403El8PPicg/qONZJDC6YlgCVbWDtNmmZKtBno=
github.com/hashicorp/terraform-registry-address v0.2.2/go.mod h1:LtwNbCihUoUZ3RYriyS2wF/lGPB6gF9ICLRtuDk7hSo=
github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ=
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
// ----------------------------------------------------------------------------
//
// *** 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 netapp

import (
"reflect"

"github.com/GoogleCloudPlatform/terraform-google-conversion/v2/tfplan2cai/converters/google/resources/cai"
"github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource"
transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport"
)

const NetappstoragePoolAssetType string = "netapp.googleapis.com/storagePool"

func ResourceConverterNetappstoragePool() cai.ResourceConverter {
return cai.ResourceConverter{
AssetType: NetappstoragePoolAssetType,
Convert: GetNetappstoragePoolCaiObject,
}
}

func GetNetappstoragePoolCaiObject(d tpgresource.TerraformResourceData, config *transport_tpg.Config) ([]cai.Asset, error) {
name, err := cai.AssetName(d, config, "//netapp.googleapis.com/projects/{{project}}/locations/{{location}}/storagePools/{{name}}")
if err != nil {
return []cai.Asset{}, err
}
if obj, err := GetNetappstoragePoolApiObject(d, config); err == nil {
return []cai.Asset{{
Name: name,
Type: NetappstoragePoolAssetType,
Resource: &cai.AssetResource{
Version: "v1beta1",
DiscoveryDocumentURI: "https://www.googleapis.com/discovery/v1/apis/netapp/v1beta1/rest",
DiscoveryName: "storagePool",
Data: obj,
},
}}, nil
} else {
return []cai.Asset{}, err
}
}

func GetNetappstoragePoolApiObject(d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]interface{}, error) {
obj := make(map[string]interface{})
serviceLevelProp, err := expandNetappstoragePoolServiceLevel(d.Get("service_level"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("service_level"); !tpgresource.IsEmptyValue(reflect.ValueOf(serviceLevelProp)) && (ok || !reflect.DeepEqual(v, serviceLevelProp)) {
obj["serviceLevel"] = serviceLevelProp
}
capacityGibProp, err := expandNetappstoragePoolCapacityGib(d.Get("capacity_gib"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("capacity_gib"); !tpgresource.IsEmptyValue(reflect.ValueOf(capacityGibProp)) && (ok || !reflect.DeepEqual(v, capacityGibProp)) {
obj["capacityGib"] = capacityGibProp
}
descriptionProp, err := expandNetappstoragePoolDescription(d.Get("description"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("description"); !tpgresource.IsEmptyValue(reflect.ValueOf(descriptionProp)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
obj["description"] = descriptionProp
}
networkProp, err := expandNetappstoragePoolNetwork(d.Get("network"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("network"); !tpgresource.IsEmptyValue(reflect.ValueOf(networkProp)) && (ok || !reflect.DeepEqual(v, networkProp)) {
obj["network"] = networkProp
}
activeDirectoryProp, err := expandNetappstoragePoolActiveDirectory(d.Get("active_directory"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("active_directory"); !tpgresource.IsEmptyValue(reflect.ValueOf(activeDirectoryProp)) && (ok || !reflect.DeepEqual(v, activeDirectoryProp)) {
obj["activeDirectory"] = activeDirectoryProp
}
kmsConfigProp, err := expandNetappstoragePoolKmsConfig(d.Get("kms_config"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("kms_config"); !tpgresource.IsEmptyValue(reflect.ValueOf(kmsConfigProp)) && (ok || !reflect.DeepEqual(v, kmsConfigProp)) {
obj["kmsConfig"] = kmsConfigProp
}
ldapEnabledProp, err := expandNetappstoragePoolLdapEnabled(d.Get("ldap_enabled"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("ldap_enabled"); !tpgresource.IsEmptyValue(reflect.ValueOf(ldapEnabledProp)) && (ok || !reflect.DeepEqual(v, ldapEnabledProp)) {
obj["ldapEnabled"] = ldapEnabledProp
}
labelsProp, err := expandNetappstoragePoolEffectiveLabels(d.Get("effective_labels"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("effective_labels"); !tpgresource.IsEmptyValue(reflect.ValueOf(labelsProp)) && (ok || !reflect.DeepEqual(v, labelsProp)) {
obj["labels"] = labelsProp
}

return obj, nil
}

func expandNetappstoragePoolServiceLevel(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}

func expandNetappstoragePoolCapacityGib(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}

func expandNetappstoragePoolDescription(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}

func expandNetappstoragePoolNetwork(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}

func expandNetappstoragePoolActiveDirectory(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}

func expandNetappstoragePoolKmsConfig(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}

func expandNetappstoragePoolLdapEnabled(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}

func expandNetappstoragePoolEffectiveLabels(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]string, error) {
if v == nil {
return map[string]string{}, nil
}
m := make(map[string]string)
for k, val := range v.(map[string]interface{}) {
m[k] = val.(string)
}
return m, nil
}

0 comments on commit 496dc48

Please sign in to comment.