You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement ReadMany for CheckRequiredFieldsMissingFromShape (#155)
Issue #, if available: [#890](aws-controllers-k8s/community#890)
Description of changes:
* Adds checkRequiredFieldsMissingFromShapeReadMany to `check.go` to handle ReadMany operations without a corresponding ReadOne.
* The new method will **require resource identifier field** should there exist an *identifier* or *identifierS* field in the ReadMany operation.
* Eventually `newListRequestPayload` will use this identifier field to populate its request in order to guarantee the ReadMany operation returns the desired resource.
* ex: DescribeVpcs has a VpcIds field. Therefore, Vpc shape should require VpcId, which is part of its status field.
* Updated tests and templates
Testing:
* `make test` ✅
* `make build-controller` ✅
```
func (rm *resourceManager) sdkFind(
ctx context.Context,
r *resource,
) (latest *resource, err error) {
rlog := ackrtlog.FromContext(ctx)
exit := rlog.Trace("rm.sdkFind")
defer exit(err)
// If any required fields in the input shape are missing, AWS resource is
// not created yet. Return NotFound here to indicate to callers that the
// resource isn't yet created.
if rm.requiredFieldsMissingFromReadManyInput(r) {
return nil, ackerr.NotFound
}
input, err := rm.newListRequestPayload(r)
...
// requiredFieldsMissingFromReadManyInput returns true if there are any fields
// for the ReadMany Input shape that are required but not present in the
// resource's Spec or Status
func (rm *resourceManager) requiredFieldsMissingFromReadManyInput(
r *resource,
) bool {
return r.ko.Status.VPCID == nil
}
```
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
0 commit comments