-
Notifications
You must be signed in to change notification settings - Fork 86
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
Add get_aws_accounts typed query #3470
Conversation
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.
TBH, I don't like such general-purpose queries. With our new GQL classes, it's much easier to fine-grain define all required attributes in a query instead of reusing existing ones. It would be better to define some important and commonly needed attributes as a fragment and reuse this fragment in gql queries defined for special use cases or integration needs.
This is equivalent to queries.get_aws_accounts, but with typed query, there are many combinations of different usages, I'm afraid it may be too many similar pieces if we split them. |
That is what I mean, do not follow the same pattern/path as with See the |
Cool, then I'll update this to only keep parts needed for |
Having 2 directories in |
3c6c3a2
to
8c88cf3
Compare
reconcile/test/test_typed_queries/terraform_tgw_attachments/test_get_aws_accounts.py
Show resolved
Hide resolved
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.
LGTM! Thanks for all your effort! ❤️
Signed-off-by: Di Wang <[email protected]>
Signed-off-by: Di Wang <[email protected]>
Signed-off-by: Di Wang <[email protected]>
8c88cf3
to
ce949ac
Compare
* Add AWSAccounts gql definition * Add get_aws_accounts typed query * Update aws_accounts gql and typed_query to fit terraform_tgw_attachments Signed-off-by: Di Wang <[email protected]>
* Add AWSAccounts gql definition * Add get_aws_accounts typed query * Update aws_accounts gql and typed_query to fit terraform_tgw_attachments Signed-off-by: Di Wang <[email protected]>
Add
get_aws_accounts
typed query using GraphQL query variables. This will be used interraform-tgw-attachments
integration.Rely on app-sre/qontract-server#200 for server side support.
🤖 Generated by Copilot at 8c88cf3
This pull request adds typed queries and data classes for AWS accounts and their Terraform state. It uses qenerate to generate Python data classes from GraphQL definitions, and pydantic to validate and serialize the data. It also adds unit tests for the typed query functions. The main files affected are
reconcile/gql_definitions/terraform_tgw_attachments/aws_accounts.py
andreconcile/typed_queries/terraform_tgw_attachments/aws_accounts.py
.🤖 Generated by Copilot at 8c88cf3
query
inreconcile/gql_definitions/terraform_tgw_attachments/aws_accounts.py
that queries and parses the data into the data classes (link)get_aws_accounts
inreconcile/typed_queries/terraform_tgw_attachments/aws_accounts.py
that takes aGqlApi
instance and an optional name argument, and returns a list ofAWSAccountV1
instances using thequery
function (link)get_aws_accounts
inreconcile/test/test_typed_queries/terraform_tgw_attachments/test_get_aws_accounts.py
that use pytest fixtures and mock data classes andGqlApi
instances, and assert the expected results and variables (link)