-
Notifications
You must be signed in to change notification settings - Fork 547
feat(aws): Support Table level inputs #10564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Nice, I like this, and it's also a really unexpectedly small code change 😄 The only issue I see that I'd like to discuss a bit, is what if users want to apply multiple filters? For example, for One could argue that this is a limitation of the AWS API, take it up with them. But on the other hand, we do have ways to deal with this. For example, what if instead of using: we did: (so Which is almost exactly the same as before, except there's an extra dash. However it can then be used in this way: You'd have to repeat the start time/end time if you need this, but at least you could then fetch all the events you need in a single sync. Inside the resolver, we could loop over each entry in the list and do them one-by-one (probably in separate goroutines, but not necessarily). What do you think? |
|
@hermanschaaf - I like the idea of taking in an array of input arguments and then iterating over them! I think if we do it for a single table we should support it for all tables/APIs that support user provided inputs. One other thing that this will possibly generate will be duplicate data as the filters could theoretically overlap. Is that a concern? |
|
Where do we stand on account-level filtering of these options? Each account gets its own list of TableOptions. But then you'd need catch-all etc. as well so it could get out of hand quickly. Maybe some kind of an account-id-match "metafield" can be included, which could take wildcards or multiple account ids. In a future iteration. |
At this time I think we should start with just a single "global" |
|
I will not be including the documentation in this PR. I am working on a follow up PR that will solely be the documentation |
| svc := c.Services().Accessanalyzer | ||
| paginator := accessanalyzer.NewListAnalyzersPaginator(svc, &accessanalyzer.ListAnalyzersInput{}) | ||
| for paginator.HasMorePages() { | ||
| // no need to override API call options anymore: https://github.com/aws/aws-sdk-go-v2/issues/1260 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we used to override the region due to a bug in the sdk, now we do it because our sdk clients aren't per account+region...
|
I had a few comments on the codegen, but hoping we can get away with a shorter solution that doesn't require any codegen; here's a branch that demonstrates the idea (and some other changes): https://github.com/cloudquery/cloudquery/compare/aws-inputs-simplified The basic idea is to use a custom JSON Unmarshal function that first unmarshals to a map[string]any, then transforms all the key names from snake to camel, then marshalling the map back to JSON and calling the default config object unmarshal on that instead. It seems to work in my testing and it's relatively simple I think |
|
@hermanschaaf - I am fine with your approach... In the end both approaches achieve the same thing with the exact same public interface. The difference that I see between the two solutions is the codegen solutions handles all of the name changing at build time rather than run time. Having access to the structs that define |
hermanschaaf
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks for the update! I think the only thing remaining now is to use a list instead of individual objects so that you can combine multiple filters.
|
@bbernays I pushed a couple of commits to the branch:
|
hermanschaaf
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving so the PR is unblocked; since I pushed a couple of commits myself though it would be good to get a review of that :)
🤖 I have created a release *beep* *boop* --- ## [17.3.0](plugins-source-aws-v17.2.0...plugins-source-aws-v17.3.0) (2023-05-16) ### This Release has the Following Changes to Tables - Table `aws_acmpca_certificate_authorities` was added - Table `aws_cloudformation_stack_templates` was added - Table `aws_cloudformation_template_summaries` was added - Table `aws_config_config_rule_compliance_details` was added - Table `aws_efs_access_points` was added ### Features * Add AWS Config Compliance Details table ([#10544](#10544)) ([9b43a2a](9b43a2a)) * Add Cloudformation Template Summaries table ([#10571](#10571)) ([3515db9](3515db9)) * **aws-services:** Support newly added regions ([#10806](#10806)) ([52b5e0f](52b5e0f)) * **aws:** Add private certificate authorities ([#10691](#10691)) ([9c97e85](9c97e85)) * **aws:** Add Support for Cloudformation Templates ([#10701](#10701)) ([7a23c2e](7a23c2e)) * **aws:** Add support for EFS Access Point ([#10803](#10803)) ([d994c85](d994c85)) * **aws:** Support Table level inputs ([#10564](#10564)) ([161b11b](161b11b)) * **deps:** Upgrade to Apache Arrow v13 (latest `cqmain`) ([#10605](#10605)) ([a55da3d](a55da3d)) ### Bug Fixes * **aws-policies:** Api Gateway stage logging for REST ([#10625](#10625)) ([f0d6f57](f0d6f57)) * **aws-policies:** Api Gateway stage logging for websockets ([#10702](#10702)) ([e667400](e667400)) * **aws:** Change column type of `aws_cloudformation_stack_templates.template_body` ([#10752](#10752)) ([75b9785](75b9785)) * **aws:** Fix the case where resrouce_id is null in ECS.2 of foundational policy ([#10692](#10692)) ([f5cf2d8](f5cf2d8)) * **aws:** Handle Cloudfront Regions in different partitions ([#10690](#10690)) ([158aab1](158aab1)) * **deps:** Update module github.com/aws/aws-sdk-go-v2/config to v1.18.25 ([#10786](#10786)) ([caca1a4](caca1a4)) * **deps:** Update module github.com/aws/aws-sdk-go-v2/service/acm to v1.17.11 ([#10789](#10789)) ([9122f84](9122f84)) * **deps:** Update module github.com/aws/aws-sdk-go-v2/service/amp to v1.16.11 ([#10790](#10790)) ([431905f](431905f)) * **deps:** Update module github.com/aws/aws-sdk-go-v2/service/amplify to v1.13.10 ([#10791](#10791)) ([81d175b](81d175b)) * **deps:** Update module github.com/cloudquery/plugin-pb-go to v1.0.8 ([#10798](#10798)) ([27ff430](27ff430)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
#### Summary Add docs for #10564
Summary
In this PR we add experimental support for 2 tables (
aws_inspector2_findingsandaws_cloudtrail_events).TableOptionsis a nested structure that uses the CQ table name as the first level key. After that each table uses the aws API call to hold the actual API input. So in JSON form the object looks like this:{ "table_options":{ "aws_inspector2_findings":{ "ListFindings":{} } "aws_cloudtrail_events":{ "LookupEvents":{} } } }Update: