diff --git a/pkg/config/resource.go b/pkg/config/resource.go index bdfe9945..044a52cf 100644 --- a/pkg/config/resource.go +++ b/pkg/config/resource.go @@ -14,6 +14,8 @@ package config import ( + "encoding/json" + "fmt" "strings" awssdkmodel "github.com/aws/aws-sdk-go/private/model/api" @@ -524,6 +526,14 @@ func (c *Config) GetResourceFieldName( if !ok { return origFieldName } + + if resourceName == "Function" { + if origFieldName == "Code" { + t, _ := json.Marshal(rConfig.Renames) + fmt.Println("rConfig.Renames", string(t)) + } + } + if rConfig.Renames == nil { return origFieldName } diff --git a/pkg/generate/code/set_sdk.go b/pkg/generate/code/set_sdk.go index bac62aa7..ab2455b1 100644 --- a/pkg/generate/code/set_sdk.go +++ b/pkg/generate/code/set_sdk.go @@ -14,6 +14,7 @@ package code import ( + "encoding/json" "fmt" "sort" "strings" @@ -113,6 +114,18 @@ func SetSDK( return "" } inputShape := op.InputRef.Shape + + if r.Names.Camel == "Function" { + _, ok := r.SpecFields["Code"] + if ok { + // k, _ := json.Marshal(op.InputRef.Shape) + // fmt.Println("InputRef.Shape", string(k)) // createFunction, getFunction, deleteFunction + + i, _ := json.Marshal(op.InputRef.Shape.MemberRefs["Attributes"]) + fmt.Println("InputRef.Shape.MemeberRefs[Attributes]", string(i)) // null + } + } + if inputShape == nil { return "" } @@ -177,6 +190,20 @@ func SetSDK( } opConfig, override := cfg.GetOverrideValues(op.ExportedName) + + if r.Names.Camel == "Function" { + _, ok := r.SpecFields["Code"] + if ok { + opConfig, override := cfg.GetOverrideValues(op.ExportedName) + + fmt.Println("opConfig is", opConfig) // map[] + fmt.Println("override is", override) // false + + fmt.Println("Member names are", inputShape.MemberNames()) + } + } + + // for create op: Member Names have Code for memberIndex, memberName := range inputShape.MemberNames() { if r.UnpacksAttributesMap() && memberName == "Attributes" { continue @@ -240,6 +267,21 @@ func SetSDK( } inSpec, inStatus := r.HasMember(fieldName, op.ExportedName) + if r.Names.Camel == "Function" { + _, ok := r.SpecFields["Code"] + // d, _ := json.Marshal(r.SpecFields["Code"]) + // fmt.Println("Fields are", string(d)) + + if ok { + _, ok2 := r.SpecFields["Code"].MemberFields["S3SHA256"] + if ok2 { + fmt.Println("spec status", inSpec, inStatus) + } + fmt.Println("spec status", inSpec, inStatus) + } + + } + if inSpec { sourceAdaptedVarName += cfg.PrefixConfig.SpecField f = r.SpecFields[fieldName] diff --git a/pkg/model/crd.go b/pkg/model/crd.go index 16734d37..c452b623 100644 --- a/pkg/model/crd.go +++ b/pkg/model/crd.go @@ -426,6 +426,14 @@ func (r *CRD) GetMatchingInputShapeFieldName(opType OpType, sdkField string) str if f.FieldConfig == nil { continue } + if r.Names.Camel == "Function" && f.Names.Camel == "Code" { + // a, _ := json.Marshal(f.FieldConfig) + // fmt.Println("f.Fieldconfig", string(a)) + + // b, _ := json.Marshal(f.FieldConfig.Set) + // fmt.Println("f.fieldConfig.Set", string(b)) + + } rmMethod := ResourceManagerMethodFromOpType(opType) for _, setCfg := range f.FieldConfig.Set { if setCfg == nil {