schubergphilis / awsapilib

A python library exposing services that are not covered by the official boto3 library but are driven by undocumented APIs.
MIT License
60 stars 8 forks source link

fix "get_changing_accounts" where only first 100 results are returned #26

Closed nikoizs closed 2 years ago

nikoizs commented 2 years ago

First I wanted to add pagination, retrieve all provisioned products and filter later in the code , like it was done originally, but unfortunately boto3 doesn't support pagination for the search_provisioned_products call. Instead I used the built in filter functionality to return only UNDER_CHANGE products( which will return less than 100 results in 99.999% of the cases) and then filter later on type="CONTROL_TOWER_ACCOUNT"

The other option would be to switch to scan_provisioned_products that supports pagination , but doesn't support filtering on the status.

nikoizs commented 2 years ago

Update: looks like that SearchQuery supports multiple filters in one query , I will try to simplify it a bit more.

costastf commented 2 years ago

Looks great, I assume this has been tested and works around your issue?

nikoizs commented 2 years ago

Tested the code separately but not as part of the lib

costastf commented 2 years ago

Please have a full successfull run the change and let me know, so I can merge and release.

nikoizs commented 2 years ago

Fully tested in our test environment and all works as expected.

costastf commented 2 years ago

Linting fails, please fix it and then I will message again and you can tag with a patch version.

nikoizs commented 2 years ago

should i create a new pull request ?

costastf commented 2 years ago

Yeah with the linting fixed

nikoizs commented 2 years ago

sorry for that :) here is the new pr with the fix: https://github.com/schubergphilis/awsapilib/pull/27