Skip to content

Commit

Permalink
Terraform AppEngine Dispatch Resource (#227)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician authored and rileykarson committed Oct 18, 2019
1 parent af8ba4e commit 4700f12
Showing 1 changed file with 98 additions and 0 deletions.
98 changes: 98 additions & 0 deletions google/appengine_application_url_dispatch_rules.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
// ----------------------------------------------------------------------------
//
// *** 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"

func GetAppEngineApplicationUrlDispatchRulesCaiObject(d TerraformResourceData, config *Config) (Asset, error) {
name, err := assetName(d, config, "//appengine.googleapis.com/apps/{{project}}/{{name}}")
if err != nil {
return Asset{}, err
}
if obj, err := GetAppEngineApplicationUrlDispatchRulesApiObject(d, config); err == nil {
return Asset{
Name: name,
Type: "appengine.googleapis.com/ApplicationUrlDispatchRules",
Resource: &AssetResource{
Version: "v1",
DiscoveryDocumentURI: "https://www.googleapis.com/discovery/v1/apis/appengine/v1/rest",
DiscoveryName: "ApplicationUrlDispatchRules",
Data: obj,
},
}, nil
} else {
return Asset{}, err
}
}

func GetAppEngineApplicationUrlDispatchRulesApiObject(d TerraformResourceData, config *Config) (map[string]interface{}, error) {
obj := make(map[string]interface{})
dispatchRulesProp, err := expandAppEngineApplicationUrlDispatchRulesDispatchRules(d.Get("dispatch_rules"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("dispatch_rules"); !isEmptyValue(reflect.ValueOf(dispatchRulesProp)) && (ok || !reflect.DeepEqual(v, dispatchRulesProp)) {
obj["dispatchRules"] = dispatchRulesProp
}

return obj, nil
}

func expandAppEngineApplicationUrlDispatchRulesDispatchRules(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
l := v.([]interface{})
req := make([]interface{}, 0, len(l))
for _, raw := range l {
if raw == nil {
continue
}
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})

transformedDomain, err := expandAppEngineApplicationUrlDispatchRulesDispatchRulesDomain(original["domain"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedDomain); val.IsValid() && !isEmptyValue(val) {
transformed["domain"] = transformedDomain
}

transformedPath, err := expandAppEngineApplicationUrlDispatchRulesDispatchRulesPath(original["path"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedPath); val.IsValid() && !isEmptyValue(val) {
transformed["path"] = transformedPath
}

transformedService, err := expandAppEngineApplicationUrlDispatchRulesDispatchRulesService(original["service"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedService); val.IsValid() && !isEmptyValue(val) {
transformed["service"] = transformedService
}

req = append(req, transformed)
}
return req, nil
}

func expandAppEngineApplicationUrlDispatchRulesDispatchRulesDomain(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}

func expandAppEngineApplicationUrlDispatchRulesDispatchRulesPath(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}

func expandAppEngineApplicationUrlDispatchRulesDispatchRulesService(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}

0 comments on commit 4700f12

Please sign in to comment.