Skip to content

Conversation

@brycahta
Copy link
Contributor

Issue #, if available: #891

Description of changes:

  • adds setSDKReadMany func to SetSDK
  • adds unit test

Testing:

  • make test
  • make build-controller
// newListRequestPayload returns SDK-specific struct for the HTTP request
// payload of the List API call for the resource
func (rm *resourceManager) newListRequestPayload(
	r *resource,
) (*svcsdk.DescribeVpcsInput, error) {
	res := &svcsdk.DescribeVpcsInput{}

	if r.ko.Spec.DryRun != nil {
		res.SetDryRun(*r.ko.Spec.DryRun)
	}
	if r.ko.Status.VPCID != nil {
		f4 := []*string{}
		f4 = append(f4, r.ko.Status.VPCID)
		res.SetVpcIds(f4)
	}

	return res, nil
}

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ack-bot ack-bot requested review from a-hilaly and vijtrip2 August 16, 2021 17:05
@ack-bot
Copy link
Collaborator

ack-bot commented Aug 16, 2021

Hi @brycahta. Thanks for your PR.

I'm waiting for a aws-controllers-k8s member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ack-bot ack-bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 16, 2021
@brycahta
Copy link
Contributor Author

Refactor Opportunity

  • There's duplicate logic between this ReadMany impl and the one done for CheckRequiredFields in this pr.
  • I'd like to encapsulate this locating-and-matching-identifier logic as /pkg/generate/code/identifier.go (common.go will be deleted after moving helpers to this new file.)
  • This set of helpers will not only help locate identifiers, but also match identifier fields between API Input Shape and a CRD model.
  • Are there other areas in the project that reconcile complex data (i.e. comparing names and plurals) between API Input Shape and CRD?
  • If so, please post details and we can see if a higher level abstraction would be more appropriate

@vijtrip2
Copy link
Contributor

/ok-to-test

@ack-bot ack-bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 16, 2021
@vijtrip2
Copy link
Contributor

  • I'd like to encapsulate this locating-and-matching-identifier logic as /pkg/generate/code/identifier.go (common.go will be deleted after moving helpers to this new file.)

+1 . The less places we have the duplicated code the better because if a bug fix is needed in future, duplicated code may cause some places to be missed with the fix.

Copy link
Contributor

@vijtrip2 vijtrip2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Just one very minor nit about unit test data.

Copy link
Collaborator

@jaypipes jaypipes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm impressed with you digging into the code-generator like this, @brycahta. Well done. :)

I've left a couple comments inline for you to ponder.

Copy link
Member

@a-hilaly a-hilaly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome stuff! 👍

I Ieft few comments below

@brycahta
Copy link
Contributor Author

  • I'd like to encapsulate this locating-and-matching-identifier logic as /pkg/generate/code/identifier.go (common.go will be deleted after moving helpers to this new file.)

+1 . The less places we have the duplicated code the better because if a bug fix is needed in future, duplicated code may cause some places to be missed with the fix.

@vijtrip2 agreed. I will submit a separate refactor PR following the merge of this one

Copy link
Contributor

@vijtrip2 vijtrip2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

Copy link
Collaborator

@jaypipes jaypipes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice work on this, @brycahta, thank you sir!

@jaypipes
Copy link
Collaborator

/lgtm

@ack-bot ack-bot added the lgtm Indicates that a PR is ready to be merged. label Aug 23, 2021
@ack-bot
Copy link
Collaborator

ack-bot commented Aug 23, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: brycahta, jaypipes, vijtrip2

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ack-bot ack-bot merged commit be9e3ab into aws-controllers-k8s:main Aug 23, 2021
@brycahta brycahta deleted the issue-891 branch August 23, 2021 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants