airbyte-source-google-directory 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. airbyte-source-google-directory-0.2.1/PKG-INFO +103 -0
  2. airbyte-source-google-directory-0.2.1/README.md +100 -0
  3. airbyte-source-google-directory-0.2.1/airbyte_source_google_directory.egg-info/PKG-INFO +103 -0
  4. airbyte-source-google-directory-0.2.1/airbyte_source_google_directory.egg-info/SOURCES.txt +26 -0
  5. airbyte-source-google-directory-0.2.1/airbyte_source_google_directory.egg-info/dependency_links.txt +1 -0
  6. airbyte-source-google-directory-0.2.1/airbyte_source_google_directory.egg-info/entry_points.txt +2 -0
  7. airbyte-source-google-directory-0.2.1/airbyte_source_google_directory.egg-info/requires.txt +10 -0
  8. airbyte-source-google-directory-0.2.1/airbyte_source_google_directory.egg-info/top_level.txt +2 -0
  9. airbyte-source-google-directory-0.2.1/integration_tests/__init__.py +3 -0
  10. airbyte-source-google-directory-0.2.1/integration_tests/acceptance.py +14 -0
  11. airbyte-source-google-directory-0.2.1/integration_tests/configured_catalog.json +40 -0
  12. airbyte-source-google-directory-0.2.1/integration_tests/invalid_config.json +4 -0
  13. airbyte-source-google-directory-0.2.1/integration_tests/invalid_config_oauth.json +7 -0
  14. airbyte-source-google-directory-0.2.1/integration_tests/sample_config.json +6 -0
  15. airbyte-source-google-directory-0.2.1/integration_tests/sample_config_oauth.json +7 -0
  16. airbyte-source-google-directory-0.2.1/setup.cfg +97 -0
  17. airbyte-source-google-directory-0.2.1/setup.py +47 -0
  18. airbyte-source-google-directory-0.2.1/source_google_directory/__init__.py +6 -0
  19. airbyte-source-google-directory-0.2.1/source_google_directory/api.py +135 -0
  20. airbyte-source-google-directory-0.2.1/source_google_directory/client.py +49 -0
  21. airbyte-source-google-directory-0.2.1/source_google_directory/run.py +14 -0
  22. airbyte-source-google-directory-0.2.1/source_google_directory/schemas/group_members.json +27 -0
  23. airbyte-source-google-directory-0.2.1/source_google_directory/schemas/groups.json +42 -0
  24. airbyte-source-google-directory-0.2.1/source_google_directory/schemas/users.json +294 -0
  25. airbyte-source-google-directory-0.2.1/source_google_directory/source.py +12 -0
  26. airbyte-source-google-directory-0.2.1/source_google_directory/spec.json +78 -0
  27. airbyte-source-google-directory-0.2.1/source_google_directory/utils.py +12 -0
@@ -0,0 +1,103 @@
1
+ Metadata-Version: 2.1
2
+ Name: airbyte-source-google-directory
3
+ Version: 0.2.1
4
+ Summary: Source implementation for Google Directory.
5
+ Author: Airbyte
6
+ Author-email: contact@airbyte.io
7
+ Description-Content-Type: text/markdown
8
+ Requires-Dist: airbyte-cdk~=0.1
9
+ Requires-Dist: google-api-python-client==1.12.8
10
+ Requires-Dist: google-auth-httplib2==0.0.4
11
+ Requires-Dist: google-auth-oauthlib==0.4.2
12
+ Requires-Dist: backoff==1.10.0
13
+ Provides-Extra: tests
14
+ Requires-Dist: requests-mock~=1.9.3; extra == "tests"
15
+ Requires-Dist: pytest~=6.1; extra == "tests"
16
+ Requires-Dist: pytest-mock~=3.6.1; extra == "tests"
17
+
18
+ # Freshsales Source
19
+
20
+ This is the repository for the Freshsales source connector, written in Python.
21
+ For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.io/integrations/sources/freshsales).
22
+
23
+
24
+ **To iterate on this connector, make sure to complete this prerequisites section.**
25
+
26
+
27
+ From this connector directory, create a virtual environment:
28
+ ```
29
+ python -m venv .venv
30
+ ```
31
+
32
+ This will generate a virtualenv for this module in `.venv/`. Make sure this venv is active in your
33
+ development environment of choice. To activate it from the terminal, run:
34
+ ```
35
+ source .venv/bin/activate
36
+ pip install -r requirements.txt
37
+ pip install '.[tests]'
38
+ ```
39
+ If you are in an IDE, follow your IDE's instructions to activate the virtualenv.
40
+
41
+ Note that while we are installing dependencies from `requirements.txt`, you should only edit `setup.py` for your dependencies. `requirements.txt` is
42
+ used for editable installs (`pip install -e`) to pull in Python dependencies from the monorepo and will call `setup.py`.
43
+ If this is mumbo jumbo to you, don't worry about it, just put your deps in `setup.py` but install using `pip install -r requirements.txt` and everything
44
+ should work as you expect.
45
+
46
+ **If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.io/integrations/sources/freshsales)
47
+ to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_freshsales/spec.json` file.
48
+ Note that any directory named `secrets` is gitignored across the entire Airbyte repo, so there is no danger of accidentally checking in sensitive information.
49
+ See `integration_tests/sample_config.json` for a sample config file.
50
+
51
+ **If you are an Airbyte core member**, copy the credentials in Lastpass under the secret name `source freshsales test creds`
52
+ and place them into `secrets/config.json`.
53
+
54
+ ```
55
+ python main.py spec
56
+ python main.py check --config secrets/config.json
57
+ python main.py discover --config secrets/config.json
58
+ python main.py read --config secrets/config.json --catalog integration_tests/configured_catalog.json
59
+ ```
60
+
61
+
62
+
63
+ **Via [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md) (recommended):**
64
+ ```bash
65
+ airbyte-ci connectors --name source-freshsales build
66
+ ```
67
+
68
+ An image will be built with the tag `airbyte/source-freshsales:dev`.
69
+
70
+ **Via `docker build`:**
71
+ ```bash
72
+ docker build -t airbyte/source-freshsales:dev .
73
+ ```
74
+
75
+ Then run any of the connector commands as follows:
76
+ ```
77
+ docker run --rm airbyte/source-freshsales:dev spec
78
+ docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-freshsales:dev check --config /secrets/config.json
79
+ docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-freshsales:dev discover --config /secrets/config.json
80
+ docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/source-freshsales:dev read --config /secrets/config.json --catalog /integration_tests/configured_catalog.json
81
+ ```
82
+
83
+ You can run our full test suite locally using [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md):
84
+ ```bash
85
+ airbyte-ci connectors --name=source-google-directory test
86
+ ```
87
+
88
+ Customize `acceptance-test-config.yml` file to configure tests. See [Connector Acceptance Tests](https://docs.airbyte.com/connector-development/testing-connectors/connector-acceptance-tests-reference) for more information.
89
+ If your connector requires to create or destroy resources for use during acceptance tests create fixtures for it and place them inside integration_tests/acceptance.py.
90
+
91
+ All of your dependencies should go in `setup.py`, NOT `requirements.txt`. The requirements file is only used to connect internal Airbyte dependencies in the monorepo for local development.
92
+ We split dependencies between two groups, dependencies that are:
93
+ * required for your connector to work need to go to `MAIN_REQUIREMENTS` list.
94
+ * required for the testing need to go to `TEST_REQUIREMENTS` list
95
+
96
+ You've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what?
97
+ 1. Make sure your changes are passing our test suite: `airbyte-ci connectors --name=source-google-directory test`
98
+ 2. Bump the connector version in `metadata.yaml`: increment the `dockerImageTag` value. Please follow [semantic versioning for connectors](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#semantic-versioning-for-connectors).
99
+ 3. Make sure the `metadata.yaml` content is up to date.
100
+ 4. Make the connector documentation and its changelog is up to date (`docs/integrations/sources/google-directory.md`).
101
+ 5. Create a Pull Request: use [our PR naming conventions](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#pull-request-title-convention).
102
+ 6. Pat yourself on the back for being an awesome contributor.
103
+ 7. Someone from Airbyte will take a look at your PR and iterate with you to merge it into master.
@@ -0,0 +1,100 @@
1
+ # Freshsales Source
2
+
3
+ This is the repository for the Freshsales source connector, written in Python.
4
+ For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.io/integrations/sources/freshsales).
5
+
6
+ ## Local development
7
+
8
+ ### Prerequisites
9
+ **To iterate on this connector, make sure to complete this prerequisites section.**
10
+
11
+ #### Minimum Python version required `= 3.7.0`
12
+
13
+ #### Build & Activate Virtual Environment and install dependencies
14
+ From this connector directory, create a virtual environment:
15
+ ```
16
+ python -m venv .venv
17
+ ```
18
+
19
+ This will generate a virtualenv for this module in `.venv/`. Make sure this venv is active in your
20
+ development environment of choice. To activate it from the terminal, run:
21
+ ```
22
+ source .venv/bin/activate
23
+ pip install -r requirements.txt
24
+ pip install '.[tests]'
25
+ ```
26
+ If you are in an IDE, follow your IDE's instructions to activate the virtualenv.
27
+
28
+ Note that while we are installing dependencies from `requirements.txt`, you should only edit `setup.py` for your dependencies. `requirements.txt` is
29
+ used for editable installs (`pip install -e`) to pull in Python dependencies from the monorepo and will call `setup.py`.
30
+ If this is mumbo jumbo to you, don't worry about it, just put your deps in `setup.py` but install using `pip install -r requirements.txt` and everything
31
+ should work as you expect.
32
+
33
+ #### Create credentials
34
+ **If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.io/integrations/sources/freshsales)
35
+ to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_freshsales/spec.json` file.
36
+ Note that any directory named `secrets` is gitignored across the entire Airbyte repo, so there is no danger of accidentally checking in sensitive information.
37
+ See `integration_tests/sample_config.json` for a sample config file.
38
+
39
+ **If you are an Airbyte core member**, copy the credentials in Lastpass under the secret name `source freshsales test creds`
40
+ and place them into `secrets/config.json`.
41
+
42
+ ### Locally running the connector
43
+ ```
44
+ python main.py spec
45
+ python main.py check --config secrets/config.json
46
+ python main.py discover --config secrets/config.json
47
+ python main.py read --config secrets/config.json --catalog integration_tests/configured_catalog.json
48
+ ```
49
+
50
+ ### Locally running the connector docker image
51
+
52
+
53
+ #### Build
54
+ **Via [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md) (recommended):**
55
+ ```bash
56
+ airbyte-ci connectors --name source-freshsales build
57
+ ```
58
+
59
+ An image will be built with the tag `airbyte/source-freshsales:dev`.
60
+
61
+ **Via `docker build`:**
62
+ ```bash
63
+ docker build -t airbyte/source-freshsales:dev .
64
+ ```
65
+
66
+ #### Run
67
+ Then run any of the connector commands as follows:
68
+ ```
69
+ docker run --rm airbyte/source-freshsales:dev spec
70
+ docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-freshsales:dev check --config /secrets/config.json
71
+ docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-freshsales:dev discover --config /secrets/config.json
72
+ docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/source-freshsales:dev read --config /secrets/config.json --catalog /integration_tests/configured_catalog.json
73
+ ```
74
+
75
+ ## Testing
76
+ You can run our full test suite locally using [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md):
77
+ ```bash
78
+ airbyte-ci connectors --name=source-google-directory test
79
+ ```
80
+
81
+ ### Customizing acceptance Tests
82
+ Customize `acceptance-test-config.yml` file to configure tests. See [Connector Acceptance Tests](https://docs.airbyte.com/connector-development/testing-connectors/connector-acceptance-tests-reference) for more information.
83
+ If your connector requires to create or destroy resources for use during acceptance tests create fixtures for it and place them inside integration_tests/acceptance.py.
84
+
85
+ ## Dependency Management
86
+ All of your dependencies should go in `setup.py`, NOT `requirements.txt`. The requirements file is only used to connect internal Airbyte dependencies in the monorepo for local development.
87
+ We split dependencies between two groups, dependencies that are:
88
+ * required for your connector to work need to go to `MAIN_REQUIREMENTS` list.
89
+ * required for the testing need to go to `TEST_REQUIREMENTS` list
90
+
91
+ ### Publishing a new version of the connector
92
+ You've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what?
93
+ 1. Make sure your changes are passing our test suite: `airbyte-ci connectors --name=source-google-directory test`
94
+ 2. Bump the connector version in `metadata.yaml`: increment the `dockerImageTag` value. Please follow [semantic versioning for connectors](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#semantic-versioning-for-connectors).
95
+ 3. Make sure the `metadata.yaml` content is up to date.
96
+ 4. Make the connector documentation and its changelog is up to date (`docs/integrations/sources/google-directory.md`).
97
+ 5. Create a Pull Request: use [our PR naming conventions](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#pull-request-title-convention).
98
+ 6. Pat yourself on the back for being an awesome contributor.
99
+ 7. Someone from Airbyte will take a look at your PR and iterate with you to merge it into master.
100
+
@@ -0,0 +1,103 @@
1
+ Metadata-Version: 2.1
2
+ Name: airbyte-source-google-directory
3
+ Version: 0.2.1
4
+ Summary: Source implementation for Google Directory.
5
+ Author: Airbyte
6
+ Author-email: contact@airbyte.io
7
+ Description-Content-Type: text/markdown
8
+ Requires-Dist: airbyte-cdk~=0.1
9
+ Requires-Dist: google-api-python-client==1.12.8
10
+ Requires-Dist: google-auth-httplib2==0.0.4
11
+ Requires-Dist: google-auth-oauthlib==0.4.2
12
+ Requires-Dist: backoff==1.10.0
13
+ Provides-Extra: tests
14
+ Requires-Dist: requests-mock~=1.9.3; extra == "tests"
15
+ Requires-Dist: pytest~=6.1; extra == "tests"
16
+ Requires-Dist: pytest-mock~=3.6.1; extra == "tests"
17
+
18
+ # Freshsales Source
19
+
20
+ This is the repository for the Freshsales source connector, written in Python.
21
+ For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.io/integrations/sources/freshsales).
22
+
23
+
24
+ **To iterate on this connector, make sure to complete this prerequisites section.**
25
+
26
+
27
+ From this connector directory, create a virtual environment:
28
+ ```
29
+ python -m venv .venv
30
+ ```
31
+
32
+ This will generate a virtualenv for this module in `.venv/`. Make sure this venv is active in your
33
+ development environment of choice. To activate it from the terminal, run:
34
+ ```
35
+ source .venv/bin/activate
36
+ pip install -r requirements.txt
37
+ pip install '.[tests]'
38
+ ```
39
+ If you are in an IDE, follow your IDE's instructions to activate the virtualenv.
40
+
41
+ Note that while we are installing dependencies from `requirements.txt`, you should only edit `setup.py` for your dependencies. `requirements.txt` is
42
+ used for editable installs (`pip install -e`) to pull in Python dependencies from the monorepo and will call `setup.py`.
43
+ If this is mumbo jumbo to you, don't worry about it, just put your deps in `setup.py` but install using `pip install -r requirements.txt` and everything
44
+ should work as you expect.
45
+
46
+ **If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.io/integrations/sources/freshsales)
47
+ to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_freshsales/spec.json` file.
48
+ Note that any directory named `secrets` is gitignored across the entire Airbyte repo, so there is no danger of accidentally checking in sensitive information.
49
+ See `integration_tests/sample_config.json` for a sample config file.
50
+
51
+ **If you are an Airbyte core member**, copy the credentials in Lastpass under the secret name `source freshsales test creds`
52
+ and place them into `secrets/config.json`.
53
+
54
+ ```
55
+ python main.py spec
56
+ python main.py check --config secrets/config.json
57
+ python main.py discover --config secrets/config.json
58
+ python main.py read --config secrets/config.json --catalog integration_tests/configured_catalog.json
59
+ ```
60
+
61
+
62
+
63
+ **Via [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md) (recommended):**
64
+ ```bash
65
+ airbyte-ci connectors --name source-freshsales build
66
+ ```
67
+
68
+ An image will be built with the tag `airbyte/source-freshsales:dev`.
69
+
70
+ **Via `docker build`:**
71
+ ```bash
72
+ docker build -t airbyte/source-freshsales:dev .
73
+ ```
74
+
75
+ Then run any of the connector commands as follows:
76
+ ```
77
+ docker run --rm airbyte/source-freshsales:dev spec
78
+ docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-freshsales:dev check --config /secrets/config.json
79
+ docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-freshsales:dev discover --config /secrets/config.json
80
+ docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/source-freshsales:dev read --config /secrets/config.json --catalog /integration_tests/configured_catalog.json
81
+ ```
82
+
83
+ You can run our full test suite locally using [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md):
84
+ ```bash
85
+ airbyte-ci connectors --name=source-google-directory test
86
+ ```
87
+
88
+ Customize `acceptance-test-config.yml` file to configure tests. See [Connector Acceptance Tests](https://docs.airbyte.com/connector-development/testing-connectors/connector-acceptance-tests-reference) for more information.
89
+ If your connector requires to create or destroy resources for use during acceptance tests create fixtures for it and place them inside integration_tests/acceptance.py.
90
+
91
+ All of your dependencies should go in `setup.py`, NOT `requirements.txt`. The requirements file is only used to connect internal Airbyte dependencies in the monorepo for local development.
92
+ We split dependencies between two groups, dependencies that are:
93
+ * required for your connector to work need to go to `MAIN_REQUIREMENTS` list.
94
+ * required for the testing need to go to `TEST_REQUIREMENTS` list
95
+
96
+ You've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what?
97
+ 1. Make sure your changes are passing our test suite: `airbyte-ci connectors --name=source-google-directory test`
98
+ 2. Bump the connector version in `metadata.yaml`: increment the `dockerImageTag` value. Please follow [semantic versioning for connectors](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#semantic-versioning-for-connectors).
99
+ 3. Make sure the `metadata.yaml` content is up to date.
100
+ 4. Make the connector documentation and its changelog is up to date (`docs/integrations/sources/google-directory.md`).
101
+ 5. Create a Pull Request: use [our PR naming conventions](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#pull-request-title-convention).
102
+ 6. Pat yourself on the back for being an awesome contributor.
103
+ 7. Someone from Airbyte will take a look at your PR and iterate with you to merge it into master.
@@ -0,0 +1,26 @@
1
+ README.md
2
+ setup.cfg
3
+ setup.py
4
+ airbyte_source_google_directory.egg-info/PKG-INFO
5
+ airbyte_source_google_directory.egg-info/SOURCES.txt
6
+ airbyte_source_google_directory.egg-info/dependency_links.txt
7
+ airbyte_source_google_directory.egg-info/entry_points.txt
8
+ airbyte_source_google_directory.egg-info/requires.txt
9
+ airbyte_source_google_directory.egg-info/top_level.txt
10
+ integration_tests/__init__.py
11
+ integration_tests/acceptance.py
12
+ integration_tests/configured_catalog.json
13
+ integration_tests/invalid_config.json
14
+ integration_tests/invalid_config_oauth.json
15
+ integration_tests/sample_config.json
16
+ integration_tests/sample_config_oauth.json
17
+ source_google_directory/__init__.py
18
+ source_google_directory/api.py
19
+ source_google_directory/client.py
20
+ source_google_directory/run.py
21
+ source_google_directory/source.py
22
+ source_google_directory/spec.json
23
+ source_google_directory/utils.py
24
+ source_google_directory/schemas/group_members.json
25
+ source_google_directory/schemas/groups.json
26
+ source_google_directory/schemas/users.json
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ source-google-directory = source_google_directory.run:run
@@ -0,0 +1,10 @@
1
+ airbyte-cdk~=0.1
2
+ google-api-python-client==1.12.8
3
+ google-auth-httplib2==0.0.4
4
+ google-auth-oauthlib==0.4.2
5
+ backoff==1.10.0
6
+
7
+ [tests]
8
+ requests-mock~=1.9.3
9
+ pytest~=6.1
10
+ pytest-mock~=3.6.1
@@ -0,0 +1,2 @@
1
+ integration_tests
2
+ source_google_directory
@@ -0,0 +1,3 @@
1
+ #
2
+ # Copyright (c) 2023 Airbyte, Inc., all rights reserved.
3
+ #
@@ -0,0 +1,14 @@
1
+ #
2
+ # Copyright (c) 2023 Airbyte, Inc., all rights reserved.
3
+ #
4
+
5
+
6
+ import pytest
7
+
8
+ pytest_plugins = ("connector_acceptance_test.plugin",)
9
+
10
+
11
+ @pytest.fixture(scope="session", autouse=True)
12
+ def connector_setup():
13
+ """This fixture is a placeholder for external resources that acceptance test might require."""
14
+ yield
@@ -0,0 +1,40 @@
1
+ {
2
+ "streams": [
3
+ {
4
+ "stream": {
5
+ "name": "users",
6
+ "json_schema": {},
7
+ "supported_sync_modes": ["full_refresh"],
8
+ "source_defined_cursor": false,
9
+ "source_defined_primary_key": [["id"]]
10
+ },
11
+ "sync_mode": "full_refresh",
12
+ "destination_sync_mode": "overwrite",
13
+ "primary_key": [["id"]]
14
+ },
15
+ {
16
+ "stream": {
17
+ "name": "groups",
18
+ "json_schema": {},
19
+ "supported_sync_modes": ["full_refresh"],
20
+ "source_defined_cursor": false,
21
+ "source_defined_primary_key": [["id"]]
22
+ },
23
+ "sync_mode": "full_refresh",
24
+ "destination_sync_mode": "overwrite",
25
+ "primary_key": [["id"]]
26
+ },
27
+ {
28
+ "stream": {
29
+ "name": "group_members",
30
+ "json_schema": {},
31
+ "supported_sync_modes": ["full_refresh"],
32
+ "source_defined_cursor": false,
33
+ "source_defined_primary_key": [["id"]]
34
+ },
35
+ "sync_mode": "full_refresh",
36
+ "destination_sync_mode": "overwrite",
37
+ "primary_key": [["id"]]
38
+ }
39
+ ]
40
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "credentials_json": "{}",
3
+ "email": "test@test.test"
4
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "credentials": {
3
+ "client_id": "<invalid_client_id>",
4
+ "client_secret": "<invalid_client_secret>",
5
+ "refresh_token": "<invalid_refresh_token>"
6
+ }
7
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "credentials": {
3
+ "credentials_json": "<The contents of the JSON service account key>",
4
+ "email": "test@test.test"
5
+ }
6
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "credentials": {
3
+ "client_id": "<Client ID>",
4
+ "client_secret": "<Client secret>",
5
+ "refresh_token": "<Refresh token>"
6
+ }
7
+ }
@@ -0,0 +1,97 @@
1
+ [metadata]
2
+ name = airbyte-source-google-directory
3
+ version = 0.2.1
4
+ author = Airbyte
5
+ author_email = contact@airbyte.io
6
+ long_description = # Freshsales Source
7
+
8
+ This is the repository for the Freshsales source connector, written in Python.
9
+ For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.io/integrations/sources/freshsales).
10
+
11
+
12
+ **To iterate on this connector, make sure to complete this prerequisites section.**
13
+
14
+
15
+ From this connector directory, create a virtual environment:
16
+ ```
17
+ python -m venv .venv
18
+ ```
19
+
20
+ This will generate a virtualenv for this module in `.venv/`. Make sure this venv is active in your
21
+ development environment of choice. To activate it from the terminal, run:
22
+ ```
23
+ source .venv/bin/activate
24
+ pip install -r requirements.txt
25
+ pip install '.[tests]'
26
+ ```
27
+ If you are in an IDE, follow your IDE's instructions to activate the virtualenv.
28
+
29
+ Note that while we are installing dependencies from `requirements.txt`, you should only edit `setup.py` for your dependencies. `requirements.txt` is
30
+ used for editable installs (`pip install -e`) to pull in Python dependencies from the monorepo and will call `setup.py`.
31
+ If this is mumbo jumbo to you, don't worry about it, just put your deps in `setup.py` but install using `pip install -r requirements.txt` and everything
32
+ should work as you expect.
33
+
34
+ **If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.io/integrations/sources/freshsales)
35
+ to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_freshsales/spec.json` file.
36
+ Note that any directory named `secrets` is gitignored across the entire Airbyte repo, so there is no danger of accidentally checking in sensitive information.
37
+ See `integration_tests/sample_config.json` for a sample config file.
38
+
39
+ **If you are an Airbyte core member**, copy the credentials in Lastpass under the secret name `source freshsales test creds`
40
+ and place them into `secrets/config.json`.
41
+
42
+ ```
43
+ python main.py spec
44
+ python main.py check --config secrets/config.json
45
+ python main.py discover --config secrets/config.json
46
+ python main.py read --config secrets/config.json --catalog integration_tests/configured_catalog.json
47
+ ```
48
+
49
+
50
+
51
+ **Via [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md) (recommended):**
52
+ ```bash
53
+ airbyte-ci connectors --name source-freshsales build
54
+ ```
55
+
56
+ An image will be built with the tag `airbyte/source-freshsales:dev`.
57
+
58
+ **Via `docker build`:**
59
+ ```bash
60
+ docker build -t airbyte/source-freshsales:dev .
61
+ ```
62
+
63
+ Then run any of the connector commands as follows:
64
+ ```
65
+ docker run --rm airbyte/source-freshsales:dev spec
66
+ docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-freshsales:dev check --config /secrets/config.json
67
+ docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-freshsales:dev discover --config /secrets/config.json
68
+ docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/source-freshsales:dev read --config /secrets/config.json --catalog /integration_tests/configured_catalog.json
69
+ ```
70
+
71
+ You can run our full test suite locally using [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md):
72
+ ```bash
73
+ airbyte-ci connectors --name=source-google-directory test
74
+ ```
75
+
76
+ Customize `acceptance-test-config.yml` file to configure tests. See [Connector Acceptance Tests](https://docs.airbyte.com/connector-development/testing-connectors/connector-acceptance-tests-reference) for more information.
77
+ If your connector requires to create or destroy resources for use during acceptance tests create fixtures for it and place them inside integration_tests/acceptance.py.
78
+
79
+ All of your dependencies should go in `setup.py`, NOT `requirements.txt`. The requirements file is only used to connect internal Airbyte dependencies in the monorepo for local development.
80
+ We split dependencies between two groups, dependencies that are:
81
+ * required for your connector to work need to go to `MAIN_REQUIREMENTS` list.
82
+ * required for the testing need to go to `TEST_REQUIREMENTS` list
83
+
84
+ You've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what?
85
+ 1. Make sure your changes are passing our test suite: `airbyte-ci connectors --name=source-google-directory test`
86
+ 2. Bump the connector version in `metadata.yaml`: increment the `dockerImageTag` value. Please follow [semantic versioning for connectors](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#semantic-versioning-for-connectors).
87
+ 3. Make sure the `metadata.yaml` content is up to date.
88
+ 4. Make the connector documentation and its changelog is up to date (`docs/integrations/sources/google-directory.md`).
89
+ 5. Create a Pull Request: use [our PR naming conventions](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#pull-request-title-convention).
90
+ 6. Pat yourself on the back for being an awesome contributor.
91
+ 7. Someone from Airbyte will take a look at your PR and iterate with you to merge it into master.
92
+ long_description_content_type = text/markdown
93
+
94
+ [egg_info]
95
+ tag_build =
96
+ tag_date = 0
97
+
@@ -0,0 +1,47 @@
1
+ #
2
+ # Copyright (c) 2023 Airbyte, Inc., all rights reserved.
3
+ #
4
+
5
+
6
+ from setuptools import find_packages, setup
7
+
8
+ MAIN_REQUIREMENTS = [
9
+ "airbyte-cdk~=0.1",
10
+ "google-api-python-client==1.12.8",
11
+ "google-auth-httplib2==0.0.4",
12
+ "google-auth-oauthlib==0.4.2",
13
+ "backoff==1.10.0",
14
+ ]
15
+
16
+ TEST_REQUIREMENTS = [
17
+ "requests-mock~=1.9.3",
18
+ "pytest~=6.1",
19
+ "pytest-mock~=3.6.1",
20
+ ]
21
+
22
+ setup(
23
+ entry_points={
24
+ "console_scripts": [
25
+ "source-google-directory=source_google_directory.run:run",
26
+ ],
27
+ },
28
+ description="Source implementation for Google Directory.",
29
+ packages=find_packages(),
30
+ install_requires=MAIN_REQUIREMENTS,
31
+ package_data={
32
+ "": [
33
+ # Include yaml files in the package (if any)
34
+ "*.yml",
35
+ "*.yaml",
36
+ # Include all json files in the package, up to 4 levels deep
37
+ "*.json",
38
+ "*/*.json",
39
+ "*/*/*.json",
40
+ "*/*/*/*.json",
41
+ "*/*/*/*/*.json",
42
+ ]
43
+ },
44
+ extras_require={
45
+ "tests": TEST_REQUIREMENTS,
46
+ },
47
+ )
@@ -0,0 +1,6 @@
1
+ #
2
+ # Copyright (c) 2023 Airbyte, Inc., all rights reserved.
3
+ #
4
+ from .source import SourceGoogleDirectory
5
+
6
+ __all__ = ["SourceGoogleDirectory"]
@@ -0,0 +1,135 @@
1
+ #
2
+ # Copyright (c) 2023 Airbyte, Inc., all rights reserved.
3
+ #
4
+
5
+
6
+ import json
7
+ from abc import ABC, abstractmethod
8
+ from functools import partial
9
+ from typing import Any, Callable, Dict, Iterator, Mapping, Sequence
10
+
11
+ import backoff
12
+ from google.auth.transport.requests import Request
13
+ from google.oauth2 import service_account
14
+ from google.oauth2.credentials import Credentials
15
+ from googleapiclient.discovery import build
16
+ from googleapiclient.errors import HttpError as GoogleApiHttpError
17
+
18
+ from .utils import rate_limit_handling
19
+
20
+ SCOPES = ["https://www.googleapis.com/auth/admin.directory.user.readonly", "https://www.googleapis.com/auth/admin.directory.group.readonly"]
21
+
22
+
23
+ class API:
24
+ def __init__(self, credentials: Mapping[str, Any]):
25
+ self._creds = None
26
+ self._raw_credentials = credentials
27
+ self._service = None
28
+
29
+ @staticmethod
30
+ def _load_account_info(credentials_json: str) -> Dict:
31
+ account_info = json.loads(credentials_json)
32
+ return account_info
33
+
34
+ def _obtain_service_account_creds(self) -> service_account.Credentials:
35
+ """Obtaining creds based on Service account scenario"""
36
+ credentials_json = self._raw_credentials.get("credentials_json")
37
+ admin_email = self._raw_credentials.get("email")
38
+ account_info = self._load_account_info(credentials_json)
39
+ creds = service_account.Credentials.from_service_account_info(account_info, scopes=SCOPES)
40
+ self._creds = creds.with_subject(admin_email)
41
+
42
+ def _obtain_web_app_creds(self) -> Credentials:
43
+ """Obtaining creds based on Web server application scenario"""
44
+ info = {
45
+ "client_id": self._raw_credentials.get("client_id"),
46
+ "client_secret": self._raw_credentials.get("client_secret"),
47
+ "refresh_token": self._raw_credentials.get("refresh_token"),
48
+ }
49
+ creds = Credentials.from_authorized_user_info(info)
50
+ if creds.expired:
51
+ creds.refresh(Request())
52
+ self._creds = creds
53
+
54
+ def _obtain_creds(self):
55
+ if "credentials_json" in self._raw_credentials:
56
+ self._obtain_service_account_creds()
57
+ elif "client_id" and "client_secret" in self._raw_credentials:
58
+ self._obtain_web_app_creds()
59
+
60
+ def _construct_resource(self):
61
+ if not self._creds:
62
+ self._obtain_creds()
63
+ if not self._service:
64
+ self._service = build("admin", "directory_v1", credentials=self._creds)
65
+
66
+ def _get_resource(self, name: str):
67
+ self._construct_resource()
68
+ return getattr(self._service, name)
69
+
70
+ @backoff.on_exception(backoff.expo, GoogleApiHttpError, max_tries=7, giveup=rate_limit_handling)
71
+ def get(self, name: str, params: Dict = None) -> Dict:
72
+ resource = self._get_resource(name)
73
+ response = resource().list(**params).execute()
74
+ return response
75
+
76
+
77
+ class StreamAPI(ABC):
78
+ results_per_page = 100
79
+
80
+ def __init__(self, api: API, *args, **kwargs):
81
+ super().__init__(*args, **kwargs)
82
+ self._api = api
83
+
84
+ def _api_get(self, resource: str, params: Dict = None):
85
+ return self._api.get(resource, params=params)
86
+
87
+ @abstractmethod
88
+ def list(self, fields: Sequence[str] = None) -> Iterator[dict]:
89
+ """Iterate over entities"""
90
+
91
+ @abstractmethod
92
+ def process_response(self, response: Dict) -> Iterator[dict]:
93
+ """Process Google Directory API response"""
94
+
95
+ def read(self, getter: Callable, params: Dict = None) -> Iterator:
96
+ """Read using getter"""
97
+ params = params or {}
98
+ params["maxResults"] = self.results_per_page
99
+ while True:
100
+ batch = getter(params={**params})
101
+ yield from self.process_response(batch)
102
+
103
+ if "nextPageToken" in batch:
104
+ params["pageToken"] = batch["nextPageToken"]
105
+ else:
106
+ break
107
+
108
+
109
+ class UsersAPI(StreamAPI):
110
+ def process_response(self, response: Dict) -> Iterator[dict]:
111
+ return response["users"]
112
+
113
+ def list(self, fields: Sequence[str] = None) -> Iterator[dict]:
114
+ params = {"customer": "my_customer"}
115
+ yield from self.read(partial(self._api_get, resource="users"), params=params)
116
+
117
+
118
+ class GroupsAPI(StreamAPI):
119
+ def process_response(self, response: Dict) -> Iterator[dict]:
120
+ return response["groups"]
121
+
122
+ def list(self, fields: Sequence[str] = None) -> Iterator[dict]:
123
+ params = {"customer": "my_customer"}
124
+ yield from self.read(partial(self._api_get, resource="groups"), params=params)
125
+
126
+
127
+ class GroupMembersAPI(StreamAPI):
128
+ def process_response(self, response: Dict) -> Iterator[dict]:
129
+ return response.get("members", [])
130
+
131
+ def list(self, fields: Sequence[str] = None) -> Iterator[dict]:
132
+ groups = GroupsAPI(self._api)
133
+ for group in groups.list():
134
+ params = {"groupKey": group["id"]}
135
+ yield from self.read(partial(self._api_get, resource="members"), params=params)
@@ -0,0 +1,49 @@
1
+ #
2
+ # Copyright (c) 2023 Airbyte, Inc., all rights reserved.
3
+ #
4
+
5
+
6
+ from typing import Any, Generator, Mapping, Tuple
7
+
8
+ from airbyte_cdk.models import AirbyteStream
9
+ from airbyte_cdk.sources.deprecated.client import BaseClient
10
+
11
+ from .api import API, GroupMembersAPI, GroupsAPI, UsersAPI
12
+
13
+
14
+ class Client(BaseClient):
15
+ def __init__(self, credentials: Mapping[str, Any] = None, credentials_json: str = None, email: str = None):
16
+ # supporting old config format
17
+ if not credentials:
18
+ credentials = {"credentials_json": credentials_json, "email": email}
19
+ self._api = API(credentials)
20
+ self._apis = {"users": UsersAPI(self._api), "groups": GroupsAPI(self._api), "group_members": GroupMembersAPI(self._api)}
21
+ super().__init__()
22
+
23
+ def get_stream_state(self, name: str) -> Any:
24
+ pass
25
+
26
+ def set_stream_state(self, name: str, state: Any):
27
+ pass
28
+
29
+ def _enumerate_methods(self) -> Mapping[str, callable]:
30
+ return {name: api.list for name, api in self._apis.items()}
31
+
32
+ def health_check(self) -> Tuple[bool, str]:
33
+ alive = True
34
+ error_msg = None
35
+
36
+ try:
37
+ params = {"customer": "my_customer"}
38
+ self._api.get(name="users", params=params)
39
+ except Exception as error:
40
+ alive = False
41
+ error_msg = repr(error)
42
+
43
+ return alive, error_msg
44
+
45
+ @property
46
+ def streams(self) -> Generator[AirbyteStream, None, None]:
47
+ for stream in super().streams:
48
+ stream.source_defined_primary_key = [["id"]]
49
+ yield stream
@@ -0,0 +1,14 @@
1
+ #
2
+ # Copyright (c) 2023 Airbyte, Inc., all rights reserved.
3
+ #
4
+
5
+
6
+ import sys
7
+
8
+ from airbyte_cdk.entrypoint import launch
9
+ from source_google_directory import SourceGoogleDirectory
10
+
11
+
12
+ def run():
13
+ source = SourceGoogleDirectory()
14
+ launch(source, sys.argv[1:])
@@ -0,0 +1,27 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "kind": {
6
+ "type": ["null", "string"]
7
+ },
8
+ "id": {
9
+ "type": ["null", "string"]
10
+ },
11
+ "email": {
12
+ "type": ["null", "string"]
13
+ },
14
+ "role": {
15
+ "type": ["null", "string"]
16
+ },
17
+ "type": {
18
+ "type": ["null", "string"]
19
+ },
20
+ "etag": {
21
+ "type": ["null", "string"]
22
+ },
23
+ "status": {
24
+ "type": ["null", "string"]
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "kind": {
6
+ "type": ["null", "string"]
7
+ },
8
+ "id": {
9
+ "type": ["null", "string"]
10
+ },
11
+ "etag": {
12
+ "type": ["null", "string"]
13
+ },
14
+ "email": {
15
+ "type": ["null", "string"]
16
+ },
17
+ "name": {
18
+ "type": ["null", "string"]
19
+ },
20
+ "directMembersCount": {
21
+ "type": ["null", "string"]
22
+ },
23
+ "description": {
24
+ "type": ["null", "string"]
25
+ },
26
+ "adminCreated": {
27
+ "type": ["null", "boolean"]
28
+ },
29
+ "aliases": {
30
+ "type": ["null", "array"],
31
+ "items": {
32
+ "type": ["null", "string"]
33
+ }
34
+ },
35
+ "nonEditableAliases": {
36
+ "type": ["null", "array"],
37
+ "items": {
38
+ "type": ["null", "string"]
39
+ }
40
+ }
41
+ }
42
+ }
@@ -0,0 +1,294 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "kind": {
6
+ "type": ["null", "string"]
7
+ },
8
+ "id": {
9
+ "type": ["null", "string"]
10
+ },
11
+ "username": {
12
+ "type": ["null", "string"]
13
+ },
14
+ "name": {
15
+ "type": ["null", "object"],
16
+ "properties": {
17
+ "givenName": {
18
+ "type": ["null", "string"]
19
+ },
20
+ "familyName": {
21
+ "type": ["null", "string"]
22
+ },
23
+ "fullName": {
24
+ "type": ["null", "string"]
25
+ }
26
+ }
27
+ },
28
+ "isAdmin": {
29
+ "type": ["null", "boolean"]
30
+ },
31
+ "isDelegatedAdmin": {
32
+ "type": ["null", "boolean"]
33
+ },
34
+ "lastLoginTime": {
35
+ "type": ["null", "string"]
36
+ },
37
+ "creationTime": {
38
+ "type": ["null", "string"]
39
+ },
40
+ "agreedToTerms": {
41
+ "type": ["null", "boolean"]
42
+ },
43
+ "hashFunction": {
44
+ "type": ["null", "string"]
45
+ },
46
+ "suspended": {
47
+ "type": ["null", "boolean"]
48
+ },
49
+ "changePasswordAtNextLogin": {
50
+ "type": ["null", "boolean"]
51
+ },
52
+ "ipWhitelisted": {
53
+ "type": ["null", "boolean"]
54
+ },
55
+ "emails": {
56
+ "type": ["null", "array"],
57
+ "items": {
58
+ "type": "object",
59
+ "properties": {
60
+ "address": {
61
+ "type": ["null", "string"]
62
+ },
63
+ "type": {
64
+ "type": ["null", "string"]
65
+ },
66
+ "customType": {
67
+ "type": ["null", "string"]
68
+ },
69
+ "primary": {
70
+ "type": ["null", "boolean"]
71
+ }
72
+ }
73
+ }
74
+ },
75
+ "externalIds": {
76
+ "type": ["null", "array"],
77
+ "items": {
78
+ "type": "object",
79
+ "properties": {
80
+ "value": {
81
+ "type": ["null", "string"]
82
+ },
83
+ "type": {
84
+ "type": ["null", "string"]
85
+ },
86
+ "customType": {
87
+ "type": ["null", "string"]
88
+ }
89
+ }
90
+ }
91
+ },
92
+ "relations": {
93
+ "type": ["null", "array"],
94
+ "items": {
95
+ "type": "object",
96
+ "properties": {
97
+ "value": {
98
+ "type": ["null", "string"]
99
+ },
100
+ "type": {
101
+ "type": ["null", "string"]
102
+ },
103
+ "customType": {
104
+ "type": ["null", "string"]
105
+ }
106
+ }
107
+ }
108
+ },
109
+ "organizations": {
110
+ "type": ["null", "array"],
111
+ "items": {
112
+ "type": "object",
113
+ "properties": {
114
+ "name": {
115
+ "type": ["null", "string"]
116
+ },
117
+ "title": {
118
+ "type": ["null", "string"]
119
+ },
120
+ "primary": {
121
+ "type": ["null", "boolean"]
122
+ },
123
+ "customType": {
124
+ "type": ["null", "string"]
125
+ },
126
+ "description": {
127
+ "type": ["null", "string"]
128
+ }
129
+ }
130
+ }
131
+ },
132
+ "phones": {
133
+ "type": ["null", "array"],
134
+ "items": {
135
+ "type": "object",
136
+ "properties": {
137
+ "value": {
138
+ "type": ["null", "string"]
139
+ },
140
+ "type": {
141
+ "type": ["null", "string"]
142
+ }
143
+ }
144
+ }
145
+ },
146
+ "aliases": {
147
+ "type": ["null", "array"],
148
+ "items": {
149
+ "type": ["null", "string"]
150
+ }
151
+ },
152
+ "nonEditableAliases": {
153
+ "type": ["null", "array"],
154
+ "items": {
155
+ "type": ["null", "string"]
156
+ }
157
+ },
158
+ "customerId": {
159
+ "type": ["null", "string"]
160
+ },
161
+ "orgUnitPath": {
162
+ "type": ["null", "string"]
163
+ },
164
+ "isMailboxSetup": {
165
+ "type": ["null", "boolean"]
166
+ },
167
+ "includeInGlobalAddressList": {
168
+ "type": ["null", "boolean"]
169
+ },
170
+ "etag": {
171
+ "type": ["null", "string"]
172
+ },
173
+ "languages": {
174
+ "type": ["null", "array"],
175
+ "items": {
176
+ "type": ["null", "object"],
177
+ "properties": {
178
+ "languageCode": {
179
+ "type": ["null", "string"]
180
+ },
181
+ "preference": {
182
+ "type": ["null", "string"]
183
+ }
184
+ }
185
+ }
186
+ },
187
+ "isEnforcedIn2Sv": {
188
+ "type": ["null", "boolean"]
189
+ },
190
+ "isEnrolledIn2Sv": {
191
+ "type": ["null", "boolean"]
192
+ },
193
+ "archived": {
194
+ "type": ["null", "boolean"]
195
+ },
196
+ "primaryEmail": {
197
+ "type": ["null", "string"]
198
+ },
199
+ "suspensionReason": {
200
+ "type": ["null", "string"]
201
+ },
202
+ "locations": {
203
+ "type": ["null", "array"],
204
+ "items": {
205
+ "type": ["null", "object"],
206
+ "properties": {
207
+ "area": {
208
+ "type": ["null", "string"]
209
+ },
210
+ "buildingId": {
211
+ "type": ["null", "string"]
212
+ },
213
+ "type": {
214
+ "type": ["null", "string"]
215
+ }
216
+ }
217
+ }
218
+ },
219
+ "thumbnailPhotoEtag": {
220
+ "type": ["null", "string"]
221
+ },
222
+ "thumbnailPhotoUrl": {
223
+ "type": ["null", "string"]
224
+ },
225
+ "addresses": {
226
+ "type": ["null", "array"],
227
+ "items": {
228
+ "type": ["null", "object"],
229
+ "properties": {
230
+ "formatted": {
231
+ "type": ["null", "string"]
232
+ },
233
+ "type": {
234
+ "type": ["null", "string"]
235
+ }
236
+ }
237
+ }
238
+ },
239
+ "recoveryPhone": {
240
+ "type": ["null", "string"]
241
+ },
242
+ "recoveryEmail": {
243
+ "type": ["null", "string"]
244
+ },
245
+ "gender": {
246
+ "type": ["null", "object"],
247
+ "properties": {
248
+ "type": {
249
+ "type": ["null", "string"]
250
+ }
251
+ }
252
+ },
253
+ "sshPublicKeys": {
254
+ "type": ["null", "array"],
255
+ "items": {
256
+ "type": ["null", "object"],
257
+ "properties": {
258
+ "expirationTimeUsec": {
259
+ "type": ["null", "string"]
260
+ },
261
+ "fingerprint": {
262
+ "type": ["null", "string"]
263
+ },
264
+ "key": {
265
+ "type": ["null", "string"]
266
+ }
267
+ }
268
+ }
269
+ },
270
+ "posixAccounts": {
271
+ "gid": {
272
+ "type": ["null", "string"]
273
+ },
274
+ "homeDirectory": {
275
+ "type": ["null", "string"]
276
+ },
277
+ "operatingSystemType": {
278
+ "type": ["null", "string"]
279
+ },
280
+ "primary": {
281
+ "type": ["null", "boolean"]
282
+ },
283
+ "systemId": {
284
+ "type": ["null", "string"]
285
+ },
286
+ "uid": {
287
+ "type": ["null", "string"]
288
+ },
289
+ "username": {
290
+ "type": ["null", "string"]
291
+ }
292
+ }
293
+ }
294
+ }
@@ -0,0 +1,12 @@
1
+ #
2
+ # Copyright (c) 2023 Airbyte, Inc., all rights reserved.
3
+ #
4
+
5
+
6
+ from airbyte_cdk.sources.deprecated.base_source import BaseSource
7
+
8
+ from .client import Client
9
+
10
+
11
+ class SourceGoogleDirectory(BaseSource):
12
+ client_class = Client
@@ -0,0 +1,78 @@
1
+ {
2
+ "documentationUrl": "https://docs.airbyte.com/integrations/sources/google-directory",
3
+ "connectionSpecification": {
4
+ "$schema": "http://json-schema.org/draft-07/schema#",
5
+ "title": "Google Directory Spec",
6
+ "type": "object",
7
+ "required": [],
8
+ "additionalProperties": true,
9
+ "properties": {
10
+ "credentials": {
11
+ "title": "Google Credentials",
12
+ "description": "Google APIs use the OAuth 2.0 protocol for authentication and authorization. The Source supports <a href=\"https://developers.google.com/identity/protocols/oauth2#webserver\" target=\"_blank\">Web server application</a> and <a href=\"https://developers.google.com/identity/protocols/oauth2#serviceaccount\" target=\"_blank\">Service accounts</a> scenarios.",
13
+ "type": "object",
14
+ "oneOf": [
15
+ {
16
+ "title": "Sign in via Google (OAuth)",
17
+ "description": "For these scenario user only needs to give permission to read Google Directory data.",
18
+ "type": "object",
19
+ "required": ["client_id", "client_secret", "refresh_token"],
20
+ "properties": {
21
+ "credentials_title": {
22
+ "type": "string",
23
+ "title": "Credentials Title",
24
+ "description": "Authentication Scenario",
25
+ "const": "Web server app",
26
+ "order": 0
27
+ },
28
+ "client_id": {
29
+ "title": "Client ID",
30
+ "type": "string",
31
+ "description": "The Client ID of the developer application.",
32
+ "airbyte_secret": true
33
+ },
34
+ "client_secret": {
35
+ "title": "Client secret",
36
+ "type": "string",
37
+ "description": "The Client Secret of the developer application.",
38
+ "airbyte_secret": true
39
+ },
40
+ "refresh_token": {
41
+ "title": "Refresh Token",
42
+ "type": "string",
43
+ "description": "The Token for obtaining a new access token.",
44
+ "airbyte_secret": true
45
+ }
46
+ }
47
+ },
48
+ {
49
+ "title": "Service Account Key",
50
+ "description": "For these scenario user should obtain service account's credentials from the Google API Console and provide delegated email.",
51
+ "type": "object",
52
+ "required": ["credentials_json", "email"],
53
+ "properties": {
54
+ "credentials_title": {
55
+ "type": "string",
56
+ "title": "Credentials Title",
57
+ "description": "Authentication Scenario",
58
+ "const": "Service accounts",
59
+ "order": 0
60
+ },
61
+ "credentials_json": {
62
+ "type": "string",
63
+ "title": "Credentials JSON",
64
+ "description": "The contents of the JSON service account key. See the <a href=\"https://developers.google.com/admin-sdk/directory/v1/guides/delegation\">docs</a> for more information on how to generate this key.",
65
+ "airbyte_secret": true
66
+ },
67
+ "email": {
68
+ "type": "string",
69
+ "title": "Email",
70
+ "description": "The email of the user, which has permissions to access the Google Workspace Admin APIs."
71
+ }
72
+ }
73
+ }
74
+ ]
75
+ }
76
+ }
77
+ }
78
+ }
@@ -0,0 +1,12 @@
1
+ #
2
+ # Copyright (c) 2023 Airbyte, Inc., all rights reserved.
3
+ #
4
+
5
+
6
+ def rate_limit_handling(error):
7
+ retried_cases = [
8
+ (403, "quotaExceeded"),
9
+ (429, "rateLimitExceeded"),
10
+ ]
11
+
12
+ return (error.resp.status, error.resp.reason) not in retried_cases