Skip to content
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

source-amazon-seller-partner: allow to use IAM user arn or IAM role arn #12523

Merged
merged 17 commits into from
May 4, 2022
Merged

source-amazon-seller-partner: allow to use IAM user arn or IAM role arn #12523

merged 17 commits into from
May 4, 2022

Conversation

pecalleja
Copy link
Contributor

What

  • The amazon sp-api integration allows to use IAM user entity or IAM role entity. amazon documentation
    if we use a user based arn we need to use another function from the boto3 client to get the required credentials role

  • This will allow to integrate with airbyte apps configured with user arn entity in the amazon seller central app.

How

just use the required function for differents IAM entities

🚨 User Impact 🚨

None

Pre-merge Checklist

Expand the relevant checklist and delete the others.

Updating a connector

Community member or Airbyter

  • Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • Changelog updated in docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
  • PR name follows PR naming conventions

Tests

Unit

Put your unit tests output here.

Integration

Put your integration tests output here.

Acceptance

Put your acceptance tests output here.

@CLAassistant
Copy link

CLAassistant commented May 2, 2022

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added the area/connectors Connector related issues label May 2, 2022
@pecalleja pecalleja changed the title allow to use IAM user arn or IAM role arn. This resolve #5942 allow to use IAM user arn or IAM role arn in the amazon seller partner connector May 2, 2022
@alafanechere alafanechere self-assigned this May 3, 2022
@alafanechere
Copy link
Contributor

Thank you @pecalleja for this contribution. I'm running the tests and will get back for a first review once they pass.

@alafanechere
Copy link
Contributor

alafanechere commented May 3, 2022

/test connector=connectors/source-amazon-seller-partner

🕑 connectors/source-amazon-seller-partner https://github.com/airbytehq/airbyte/actions/runs/2264220922
✅ connectors/source-amazon-seller-partner https://github.com/airbytehq/airbyte/actions/runs/2264220922
Python tests coverage:

Name                                                 Stmts   Miss  Cover
------------------------------------------------------------------------
source_acceptance_test/utils/__init__.py                 6      0   100%
source_acceptance_test/tests/__init__.py                 4      0   100%
source_acceptance_test/__init__.py                       2      0   100%
source_acceptance_test/tests/test_full_refresh.py       52      2    96%
source_acceptance_test/utils/asserts.py                 37      2    95%
source_acceptance_test/config.py                        74      6    92%
source_acceptance_test/utils/json_schema_helper.py     105     13    88%
source_acceptance_test/utils/common.py                  80     17    79%
source_acceptance_test/utils/compare.py                 62     23    63%
source_acceptance_test/tests/test_core.py              285    106    63%
source_acceptance_test/base.py                          10      4    60%
source_acceptance_test/utils/connector_runner.py       110     48    56%
source_acceptance_test/tests/test_incremental.py        69     38    45%
------------------------------------------------------------------------
TOTAL                                                  896    259    71%
Name                                        Stmts   Miss  Cover
---------------------------------------------------------------
source_amazon_seller_partner/__init__.py        2      0   100%
source_amazon_seller_partner/constants.py      37      1    97%
source_amazon_seller_partner/source.py         68     10    85%
source_amazon_seller_partner/streams.py       353    163    54%
source_amazon_seller_partner/auth.py           61     36    41%
---------------------------------------------------------------
TOTAL                                         521    210    60%

Python short test summary info:

=========================== short test summary info ============================
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/plugin.py:56: Skipping TestBasicRead.test_read because not found in the config
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/plugin.py:56: Skipping TestFullRefresh.test_sequential_reads because not found in the config
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/plugin.py:56: Skipping TestIncremental.test_two_sequential_reads because not found in the config
======================== 17 passed, 3 skipped in 6.05s =========================

Copy link
Contributor

@alafanechere alafanechere left a comment

Choose a reason for hiding this comment

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

Minor suggestions

@pecalleja
Copy link
Contributor Author

do you want I include more unit tests in this PR to fully cover the connector source code?

pecalleja and others added 2 commits May 3, 2022 10:33
…ource_amazon_seller_partner/source.py


use a better exception text message

Co-authored-by: Augustin <augustin@airbyte.io>
…ource_amazon_seller_partner/source.py


use better variable name

Co-authored-by: Augustin <augustin@airbyte.io>
@alafanechere
Copy link
Contributor

do you want I include more unit tests in this PR to fully cover the connector source code?

I'd prefer you only add tests for the code you add. Feel free to open another PR if you want to increase the coverage of other functions.

@alafanechere alafanechere changed the title allow to use IAM user arn or IAM role arn in the amazon seller partner connector source-amazon-seller-partner: allow to use IAM user arn or IAM role arn May 3, 2022
@alafanechere
Copy link
Contributor

alafanechere commented May 4, 2022

/test connector=connectors/source-amazon-seller-partner

🕑 connectors/source-amazon-seller-partner https://github.com/airbytehq/airbyte/actions/runs/2268452681
❌ connectors/source-amazon-seller-partner https://github.com/airbytehq/airbyte/actions/runs/2268452681
🐛 https://gradle.com/s/3ftqpzn7vgzeq
Python short test summary info:

=========================== short test summary info ============================
FAILED test_core.py::TestSpec::test_match_expected[inputs0] - AssertionError:...
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/plugin.py:56: Skipping TestBasicRead.test_read because not found in the config
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/plugin.py:56: Skipping TestFullRefresh.test_sequential_reads because not found in the config
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/plugin.py:56: Skipping TestIncremental.test_two_sequential_reads because not found in the config
=================== 1 failed, 16 passed, 3 skipped in 5.96s ====================

Copy link
Contributor

@alafanechere alafanechere left a comment

Choose a reason for hiding this comment

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

Thank you @pecalleja, we are close to having a mergeable PR 😄
I need to ask you some extra work to make your change available in the published connector:

  • Bump the connector version in
    • Dockerfile
    • airbyte-config/init/src/main/resources/seed/source_definitions.yaml
    • airbyte-config/init/src/main/resources/seed/source_specs.yaml

Update the changelog in docs/integrations/sources/amazon-seller-partner.md

I can't do these changes myself as I've no permission to push on your branch.

@alafanechere
Copy link
Contributor

Could you also please merge master into your branch? This is probably the reason the latest test fail.

@github-actions github-actions bot added the area/documentation Improvements or additions to documentation label May 4, 2022
Copy link
Contributor Author

@pecalleja pecalleja left a comment

Choose a reason for hiding this comment

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

requested changes implemented 👍. Thank you.

@alafanechere
Copy link
Contributor

alafanechere commented May 4, 2022

/test connector=connectors/source-amazon-seller-partner

🕑 connectors/source-amazon-seller-partner https://github.com/airbytehq/airbyte/actions/runs/2269823429
❌ connectors/source-amazon-seller-partner https://github.com/airbytehq/airbyte/actions/runs/2269823429
🐛 https://gradle.com/s/4qbn3b22bdywy
Python short test summary info:

=========================== short test summary info ============================
FAILED test_core.py::TestSpec::test_match_expected[inputs0] - AssertionError:...
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/plugin.py:56: Skipping TestBasicRead.test_read because not found in the config
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/plugin.py:56: Skipping TestFullRefresh.test_sequential_reads because not found in the config
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/plugin.py:56: Skipping TestIncremental.test_two_sequential_reads because not found in the config
=================== 1 failed, 16 passed, 3 skipped in 5.84s ====================

Copy link
Contributor Author

@pecalleja pecalleja left a comment

Choose a reason for hiding this comment

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

LGTM

@pecalleja
Copy link
Contributor Author

/test connector=connectors/source-amazon-seller-partner

@alafanechere
Copy link
Contributor

alafanechere commented May 4, 2022

/test connector=connectors/source-amazon-seller-partner

🕑 connectors/source-amazon-seller-partner https://github.com/airbytehq/airbyte/actions/runs/2270436193
✅ connectors/source-amazon-seller-partner https://github.com/airbytehq/airbyte/actions/runs/2270436193
Python tests coverage:

Name                                                 Stmts   Miss  Cover
------------------------------------------------------------------------
source_acceptance_test/utils/__init__.py                 6      0   100%
source_acceptance_test/tests/__init__.py                 4      0   100%
source_acceptance_test/__init__.py                       2      0   100%
source_acceptance_test/tests/test_full_refresh.py       52      2    96%
source_acceptance_test/utils/asserts.py                 37      2    95%
source_acceptance_test/config.py                        74      6    92%
source_acceptance_test/utils/json_schema_helper.py     105     13    88%
source_acceptance_test/utils/common.py                  80     17    79%
source_acceptance_test/utils/compare.py                 62     23    63%
source_acceptance_test/tests/test_core.py              285    106    63%
source_acceptance_test/base.py                          10      4    60%
source_acceptance_test/utils/connector_runner.py       110     48    56%
source_acceptance_test/tests/test_incremental.py        69     38    45%
------------------------------------------------------------------------
TOTAL                                                  896    259    71%
Name                                        Stmts   Miss  Cover
---------------------------------------------------------------
source_amazon_seller_partner/__init__.py        2      0   100%
source_amazon_seller_partner/constants.py      37      1    97%
source_amazon_seller_partner/source.py         64      9    86%
source_amazon_seller_partner/streams.py       353    163    54%
source_amazon_seller_partner/auth.py           61     36    41%
---------------------------------------------------------------
TOTAL                                         517    209    60%

Python short test summary info:

=========================== short test summary info ============================
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/plugin.py:56: Skipping TestBasicRead.test_read because not found in the config
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/plugin.py:56: Skipping TestFullRefresh.test_sequential_reads because not found in the config
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/plugin.py:56: Skipping TestIncremental.test_two_sequential_reads because not found in the config
======================== 17 passed, 3 skipped in 5.76s =========================

@alafanechere
Copy link
Contributor

alafanechere commented May 4, 2022

/publish connector=connectors/source-amazon-seller-partner auto-bump-version=false

🕑 connectors/source-amazon-seller-partner https://github.com/airbytehq/airbyte/actions/runs/2270647087
🚀 Successfully published connectors/source-amazon-seller-partner
✅ connectors/source-amazon-seller-partner https://github.com/airbytehq/airbyte/actions/runs/2270647087

Copy link
Contributor

@alafanechere alafanechere left a comment

Choose a reason for hiding this comment

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

Thank you @pecalleja for your changes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connectors Connector related issues area/documentation Improvements or additions to documentation community connectors/source/amazon-seller-partner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants