fix(resources): fall back to ARN in ModelPackage.refresh for versioned packages - #6378
rsareddy0329 wants to merge 3 commits into
Conversation
…d packages ModelPackage.get_all() over a model package group fails with ParamValidationError: Missing required parameter "ModelPackageName". The ResourceIterator calls refresh() on each constructed ModelPackage, and refresh() built its describe input from self.model_package_name only. For versioned packages ListModelPackages returns only ModelPackageArn, so model_package_name stays Unassigned, serializes to None, is dropped from the request, and the describe call fails (aws#5606). DescribeModelPackage accepts either the name or the ARN for the ModelPackageName parameter, so refresh() now falls back to model_package_arn when model_package_name is Unassigned. resources.py is generated, so the fix is in the generator: add a scoped REFRESH_IDENTIFIER_FALLBACKS map and emit the fallback in _generate_operation_input_necessary_args, wired in only for refresh. The blast radius is limited to ModelPackage.refresh -- update already excludes identifiers and every other resource is unchanged. resources.py is the regenerated output of this change (ModelPackage.refresh hunk only). Add runtime tests covering the ARN fallback and the name path. Relates-to aws#5606
|
Claude finished @rsareddy0329's task in 1m 11s —— View job Review: PR #6378 —
|
|
Claude finished @rsareddy0329's task in 54s —— View job Review: PR #6378 —
|
|
Claude finished @rsareddy0329's task in 44s —— View job Review: PR #6378 —
|
Issue #, if available: Fixes #5606
Description of changes:
ModelPackage.get_all()over a model package group fails with:The
ResourceIteratorcallsrefresh()on eachModelPackageit constructs from thelist summary.
refresh()built itsDescribeModelPackageinput fromself.model_package_nameonly — but for versioned packagesListModelPackagesreturns only
ModelPackageArn, somodel_package_namestaysUnassigned, serializes toNone, is dropped from the request, and the describe call fails.DescribeModelPackageaccepts either the name or the ARN for theModelPackageNameparameter, so
refresh()now falls back tomodel_package_arnwhenmodel_package_nameis
Unassigned.Fix is in the generator, not a hand-edit of generated code.
resources.pyis producedby
tools/resources_codegen.py, so a direct edit would be clobbered on the next sync. Thechange adds a scoped
REFRESH_IDENTIFIER_FALLBACKSmap and emits the fallback in_generate_operation_input_necessary_args, wired in only forrefresh. The committedresources.pyhunk is the regenerated output of that change.Blast radius is limited to
ModelPackage.refresh:updatealready excludes identifiers,deleteand every other resource are unchanged (verified — the map keys onlyModelPackage/ModelPackageName). V3-only; V2 has no generated resources layer.Testing:
TestModelPackageRefreshIdentifierFallback: refresh() uses the ARN when the name isUnassigned, and uses the name when it is present (no regression).tests/unit/generated/test_resources.pypasses (25 passed, 1 skipped).flake8andblack -l 100clean on all changed files.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.