Skip to content

Commit 25c43e8

Browse files
authored
Remove code setting a resource ARN from its spec primary identifier (#243)
Originally, this code was added to be able to make `ReadOne` calls when a resource was not created yet and its ARN is not known, by trying to build the ARN from the primary identifier field. Currently `ReadOne` calls uses `requiredFieldsMissingFromReadOneInput` to know whether a resource was created or not - if a required field is missing, the `sdkFind` function will return a `ackerr.NotFound` This also fixes code generation for lambda `CodeSigningConfig` resource which was panicking because `CodeSIgningConfig` doesn't have a spec identifier field. Tested with dynamodb and ECR. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 2965d26 commit 25c43e8

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

pkg/generate/code/set_sdk.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,6 @@ func SetSDK(
194194
if r.IsPrimaryARNField(memberName) {
195195
// if ko.Status.ACKResourceMetadata != nil && ko.Status.ACKResourceMetadata.ARN != nil {
196196
// res.SetTopicArn(string(*ko.Status.ACKResourceMetadata.ARN))
197-
// } else {
198-
// res.SetTopicArn(rm.ARNFromName(*ko.Spec.Name))
199197
// }
200198
out += fmt.Sprintf(
201199
"%sif %s.Status.ACKResourceMetadata != nil && %s.Status.ACKResourceMetadata.ARN != nil {\n",
@@ -205,14 +203,6 @@ func SetSDK(
205203
"%s\t%s.Set%s(string(*%s.Status.ACKResourceMetadata.ARN))\n",
206204
indent, targetVarName, memberName, sourceVarName,
207205
)
208-
out += fmt.Sprintf(
209-
"%s} else {\n", indent,
210-
)
211-
nameField := *r.SpecIdentifierField()
212-
out += fmt.Sprintf(
213-
"%s\t%s.Set%s(rm.ARNFromName(*%s.Spec.%s))\n",
214-
indent, targetVarName, memberName, sourceVarName, nameField,
215-
)
216206
out += fmt.Sprintf(
217207
"%s}\n", indent,
218208
)

0 commit comments

Comments
 (0)