Skip to content

Refactor identifier logic in pkg/generate/code #922

@brycahta

Description

@brycahta

Is your feature request related to a problem?
No, this is to consolidate and clean up some recently introduced code that works with shape and model identifiers.

Describe the solution you'd like

crd.go

  • Move getSanitizedMemberPath and FindIdentifiersInCRD here as member functions
  • Introduce GetPrimaryIdentifier member func. Precedence: Arn, Id, Name
    • Not seeing the value in this when FindPrimaryIdentifierFieldNames exists

check.go

  • Move getSanitizedMemberPath out of here

common.go

  • Move Find members relating to CRD to crd.go
  • Add more unit tests to common_test.go

set_resource.go

  • Refactor setResourceForScalar() to no longer construct paths, but simply take fully-qualified target var name and the source var name to set it to.
    • users of setResourceForScalar that use CRD members can use getSanitizedMemberPath to construct fully-qualified name
      • most users of that func also require targetShapeRef which getSanitized doesn't support right now.

set_sdk.go

  • Refactor setSDKReadMany() to use refactored identifier logic

Describe alternatives you've considered
Discussed with @RedbackThomson offline

Metadata

Metadata

Assignees

Labels

kind/enhancementCategorizes issue or PR as related to existing feature enhancements.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions