diff --git a/pkg/api/list_of_shame.go b/pkg/api/list_of_shame.go index 45ed1fe1..5f4cfd74 100644 --- a/pkg/api/list_of_shame.go +++ b/pkg/api/list_of_shame.go @@ -29,152 +29,6 @@ func (ts persistAPITypes) Output(serviceName, opName string) bool { // not generating unique input/output shapes is not desired, we will generate // unique input/output shapes for new operations. var shamelist = persistAPITypes{ - "APIGateway": { - "CreateApiKey": { - output: true, - }, - "CreateAuthorizer": { - output: true, - }, - "CreateBasePathMapping": { - output: true, - }, - "CreateDeployment": { - output: true, - }, - "CreateDocumentationPart": { - output: true, - }, - "CreateDocumentationVersion": { - output: true, - }, - "CreateDomainName": { - output: true, - }, - "CreateModel": { - output: true, - }, - "CreateUsagePlan": { - output: true, - }, - "CreateUsagePlanKey": { - output: true, - }, - "GenerateClientCertificate": { - output: true, - }, - "GetAccount": { - output: true, - }, - "GetApiKey": { - output: true, - }, - "GetAuthorizer": { - output: true, - }, - "GetBasePathMapping": { - output: true, - }, - "GetClientCertificate": { - output: true, - }, - "GetDeployment": { - output: true, - }, - "GetDocumentationPart": { - output: true, - }, - "GetDocumentationVersion": { - output: true, - }, - "GetDomainName": { - output: true, - }, - "GetIntegrationResponse": { - output: true, - }, - "GetMethod": { - output: true, - }, - "GetMethodResponse": { - output: true, - }, - "GetModel": { - output: true, - }, - "GetSdkType": { - output: true, - }, - "GetUsage": { - output: true, - }, - "GetUsagePlan": { - output: true, - }, - "GetUsagePlanKey": { - output: true, - }, - "ImportRestApi": { - output: true, - }, - "PutIntegrationResponse": { - output: true, - }, - "PutMethod": { - output: true, - }, - "PutMethodResponse": { - output: true, - }, - "PutRestApi": { - output: true, - }, - "UpdateAccount": { - output: true, - }, - "UpdateApiKey": { - output: true, - }, - "UpdateAuthorizer": { - output: true, - }, - "UpdateBasePathMapping": { - output: true, - }, - "UpdateClientCertificate": { - output: true, - }, - "UpdateDeployment": { - output: true, - }, - "UpdateDocumentationPart": { - output: true, - }, - "UpdateDocumentationVersion": { - output: true, - }, - "UpdateDomainName": { - output: true, - }, - "UpdateIntegrationResponse": { - output: true, - }, - "UpdateMethod": { - output: true, - }, - "UpdateMethodResponse": { - output: true, - }, - "UpdateModel": { - output: true, - }, - "UpdateUsage": { - output: true, - }, - "UpdateUsagePlan": { - output: true, - }, - }, "AutoScaling": { "ResumeProcesses": { input: true, diff --git a/pkg/generate/code/set_sdk.go b/pkg/generate/code/set_sdk.go index 9a6fbac3..200ac4fa 100644 --- a/pkg/generate/code/set_sdk.go +++ b/pkg/generate/code/set_sdk.go @@ -1374,7 +1374,7 @@ func setSDKForMap( out += fmt.Sprintf("%s}\n", indent) return out } else if targetShape.ValueRef.Shape.ValueRef.Shape.Type == "boolean" { - out += fmt.Sprintf("%s\t%s[%s] = aws.ToBoolgMap(%s)\n", indent, targetVarName, keyVarName, valIterVarName) + out += fmt.Sprintf("%s\t%s[%s] = aws.ToBoolMap(%s)\n", indent, targetVarName, keyVarName, valIterVarName) out += fmt.Sprintf("%s}\n", indent) return out } @@ -1636,15 +1636,40 @@ func setSDKAdaptiveResourceCollection( out += fmt.Sprintf("%s\t%s.%s = aws.ToInt64Slice(%s)\n", indent, targetVarName, memberName, sourceAdaptedVarName) } - } else if shape.Type == "map" && + } else if shape.Type == "map" && shape.KeyRef.Shape.Type == "string" && - shape.ValueRef.Shape.Type == "string" { - out += fmt.Sprintf("%s\t%s.%s = aws.ToStringMap(%s)\n", indent, targetVarName, memberName, sourceAdaptedVarName) + isPrimitiveType(shape.ValueRef.Shape.Type) { + mapType := resolveAWSMapValueType(shape.ValueRef.Shape.Type) + out += fmt.Sprintf("%s\t%s.%s = aws.To%sMap(%s)\n", indent, targetVarName, memberName, mapType, sourceAdaptedVarName) } - return out } +func isPrimitiveType(valueType string) bool { + switch valueType { + case "string", "boolean", "integer", "long", "float", "double": + return true + default: + return false + } +} + +func resolveAWSMapValueType(valueType string) string { + switch valueType { + case "string": + return "String" + case "boolean": + return "Bool" + case "integer", "long": + return "Int64" + case "float", "double": + return "Float64" + default: + // For any other type, return String as a safe fallback + return "String" + } +} + func setSDKForUnion( cfg *ackgenconfig.Config, r *model.CRD, @@ -1749,4 +1774,4 @@ func setSDKForUnion( } return out -} +} \ No newline at end of file