-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Modular Magician <[email protected]>
- Loading branch information
1 parent
407a94c
commit 9144e21
Showing
2 changed files
with
140 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
// ---------------------------------------------------------------------------- | ||
// | ||
// *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** | ||
// | ||
// ---------------------------------------------------------------------------- | ||
// | ||
// 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" | ||
|
||
"google.golang.org/api/bigtableadmin/v2" | ||
) | ||
|
||
func GetBigtableAppProfileCaiObject(d TerraformResourceData, config *Config) (Asset, error) { | ||
name, err := assetName(d, config, "//bigtable.googleapis.com/projects/{{project}}/instances/{{instance}}/appProfiles/{{app_profile_id}}") | ||
if err != nil { | ||
return Asset{}, err | ||
} | ||
if obj, err := GetBigtableAppProfileApiObject(d, config); err == nil { | ||
return Asset{ | ||
Name: name, | ||
Type: "bigtable.googleapis.com/AppProfile", | ||
Resource: &AssetResource{ | ||
Version: "v2", | ||
DiscoveryDocumentURI: "https://www.googleapis.com/discovery/v1/apis/bigtable/v2/rest", | ||
DiscoveryName: "AppProfile", | ||
Data: obj, | ||
}, | ||
}, nil | ||
} else { | ||
return Asset{}, err | ||
} | ||
} | ||
|
||
func GetBigtableAppProfileApiObject(d TerraformResourceData, config *Config) (map[string]interface{}, error) { | ||
obj := make(map[string]interface{}) | ||
appProfileIdProp, err := expandBigtableAppProfileAppProfileId(d.Get("app_profile_id"), d, config) | ||
if err != nil { | ||
return nil, err | ||
} else if v, ok := d.GetOkExists("app_profile_id"); !isEmptyValue(reflect.ValueOf(appProfileIdProp)) && (ok || !reflect.DeepEqual(v, appProfileIdProp)) { | ||
obj["appProfileId"] = appProfileIdProp | ||
} | ||
instanceProp, err := expandBigtableAppProfileInstance(d.Get("instance"), d, config) | ||
if err != nil { | ||
return nil, err | ||
} else if v, ok := d.GetOkExists("instance"); !isEmptyValue(reflect.ValueOf(instanceProp)) && (ok || !reflect.DeepEqual(v, instanceProp)) { | ||
obj["instance"] = instanceProp | ||
} | ||
descriptionProp, err := expandBigtableAppProfileDescription(d.Get("description"), d, config) | ||
if err != nil { | ||
return nil, err | ||
} else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(descriptionProp)) && (ok || !reflect.DeepEqual(v, descriptionProp)) { | ||
obj["description"] = descriptionProp | ||
} | ||
multiClusterRoutingUseAnyProp, err := expandBigtableAppProfileMultiClusterRoutingUseAny(d.Get("multi_cluster_routing_use_any"), d, config) | ||
if err != nil { | ||
return nil, err | ||
} else if v, ok := d.GetOkExists("multi_cluster_routing_use_any"); !isEmptyValue(reflect.ValueOf(multiClusterRoutingUseAnyProp)) && (ok || !reflect.DeepEqual(v, multiClusterRoutingUseAnyProp)) { | ||
obj["multiClusterRoutingUseAny"] = multiClusterRoutingUseAnyProp | ||
} | ||
singleClusterRoutingProp, err := expandBigtableAppProfileSingleClusterRouting(d.Get("single_cluster_routing"), d, config) | ||
if err != nil { | ||
return nil, err | ||
} else if v, ok := d.GetOkExists("single_cluster_routing"); !isEmptyValue(reflect.ValueOf(singleClusterRoutingProp)) && (ok || !reflect.DeepEqual(v, singleClusterRoutingProp)) { | ||
obj["singleClusterRouting"] = singleClusterRoutingProp | ||
} | ||
|
||
return resourceBigtableAppProfileEncoder(d, config, obj) | ||
} | ||
|
||
func resourceBigtableAppProfileEncoder(d TerraformResourceData, meta interface{}, obj map[string]interface{}) (map[string]interface{}, error) { | ||
delete(obj, "appProfileId") | ||
delete(obj, "instance") | ||
|
||
if mc_routing := d.Get("multi_cluster_routing_use_any").(bool); mc_routing { | ||
obj["multiClusterRoutingUseAny"] = bigtableadmin.MultiClusterRoutingUseAny{} | ||
} | ||
|
||
return obj, nil | ||
} | ||
|
||
func expandBigtableAppProfileAppProfileId(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { | ||
return v, nil | ||
} | ||
|
||
func expandBigtableAppProfileInstance(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { | ||
return v, nil | ||
} | ||
|
||
func expandBigtableAppProfileDescription(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { | ||
return v, nil | ||
} | ||
|
||
func expandBigtableAppProfileMultiClusterRoutingUseAny(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { | ||
return v, nil | ||
} | ||
|
||
func expandBigtableAppProfileSingleClusterRouting(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { | ||
l := v.([]interface{}) | ||
if len(l) == 0 || l[0] == nil { | ||
return nil, nil | ||
} | ||
raw := l[0] | ||
original := raw.(map[string]interface{}) | ||
transformed := make(map[string]interface{}) | ||
|
||
transformedClusterId, err := expandBigtableAppProfileSingleClusterRoutingClusterId(original["cluster_id"], d, config) | ||
if err != nil { | ||
return nil, err | ||
} else if val := reflect.ValueOf(transformedClusterId); val.IsValid() && !isEmptyValue(val) { | ||
transformed["clusterId"] = transformedClusterId | ||
} | ||
|
||
transformedAllowTransactionalWrites, err := expandBigtableAppProfileSingleClusterRoutingAllowTransactionalWrites(original["allow_transactional_writes"], d, config) | ||
if err != nil { | ||
return nil, err | ||
} else if val := reflect.ValueOf(transformedAllowTransactionalWrites); val.IsValid() && !isEmptyValue(val) { | ||
transformed["allowTransactionalWrites"] = transformedAllowTransactionalWrites | ||
} | ||
|
||
return transformed, nil | ||
} | ||
|
||
func expandBigtableAppProfileSingleClusterRoutingClusterId(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { | ||
return v, nil | ||
} | ||
|
||
func expandBigtableAppProfileSingleClusterRoutingAllowTransactionalWrites(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { | ||
return v, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters