Skip to content

Commit

Permalink
Changes for ignoring SetS3SHA
Browse files Browse the repository at this point in the history
  • Loading branch information
Vandita2020 committed Sep 25, 2023
1 parent e0dc6c3 commit 0d29975
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/config/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
package config

import (
"encoding/json"
"fmt"
"strings"

awssdkmodel "github.com/aws/aws-sdk-go/private/model/api"
Expand Down Expand Up @@ -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
}
Expand Down
42 changes: 42 additions & 0 deletions pkg/generate/code/set_sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package code

import (
"encoding/json"
"fmt"
"sort"
"strings"
Expand Down Expand Up @@ -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 ""
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand Down
8 changes: 8 additions & 0 deletions pkg/model/crd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 0d29975

Please sign in to comment.