Skip to content

Conversation

@lucix-aws
Copy link
Contributor

Closes #2977

@lucix-aws lucix-aws requested a review from a team as a code owner January 30, 2025 20:57
Copy link
Contributor

@Madrigal Madrigal left a comment

Choose a reason for hiding this comment

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

We have about 600 waiters that changed with this new re-gen, so it's impossible to review them all. I did a quick search for jmespath.Search and manually classified them into the following 6 types of waiters

Simple selector

  • jmespath.Search("AuditReportStatus", output)
  • Sample location service/acmpca/api_op_DescribeCertificateAuthorityAuditReport.go

Nested selector with list

  • jmespath.Search("Certificate.DomainValidationOptions[].ValidationStatus", output)
  • Sample location service/acm/api_op_DescribeCertificate.go

Wildcard selector (only one I saw)

  • jmespath.Search("VerificationAttributes.*.VerificationStatus", output)
  • Sample location service/ses/api_op_GetIdentityVerificationAttributes.go

Length selector

  • jmespath.Search("length(DBClusterSnapshots) == 0", output)
  • Sample location service/rds/api_op_DescribeDBClusterSnapshots.go

Complex filter expression

  • jmespath.Search("length(services[?!(length(deployments) == 1&& runningCount == desiredCount)]) ==0", output)
  • Location service/ecs/api_op_DescribeServices.go

AND simple selector

  • jmespath.Search("status != 'CANCELLING' && status != 'CANCELLED'", output)
  • Sample location service/neptunegraph/api_op_GetExportTask.go

Took a look at the generated code and ensured that the code is equivalent and correct. Left some comments for observations, but everything looks correct.

This is a great change to get rid of one of our last dependencies in the Go SDK 🎉

for _, v := range v4 {
if string(v) != expectedValue {
match = false
break
Copy link
Contributor

Choose a reason for hiding this comment

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

nice extra optimization we got

pathValue, err := jmespath.Search("VerificationAttributes.*.VerificationStatus", output)
if err != nil {
return false, fmt.Errorf("error evaluating waiter state: %w", err)
v1 := output.VerificationAttributes
Copy link
Contributor

Choose a reason for hiding this comment

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

[observation] This wildcard took a 2nd reading. The model is

VerificationAttributes map[string]types.IdentityVerificationAttributes

So iterating through the values gets us the same result as the wildcard

}

if err == nil {
pathValue, err := jmespath.Search("length(services[?!(length(deployments) == `1` && runningCount == desiredCount)]) == `0`", output)
Copy link
Contributor

Choose a reason for hiding this comment

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

For my sanity reading this expression, this is what this means (which may be easier to reason in the newer version)

  • is there an ongoing deployment -> length(deployments) == 1
  • do we have enough containers running already -> runningCount == desiredCount
  • are there any services where this is not happening -> [?!(a&&b)]
  • on this cluster, is the service stable, meaning there are no deployments and there are enough containers running? -> length[] == 0

@lucix-aws lucix-aws merged commit 8da49e5 into main Jan 31, 2025
13 checks passed
@lucix-aws lucix-aws deleted the feat-jmespathcodegen2 branch January 31, 2025 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

finish rollout of codegen-based waiters

3 participants