diff --git a/.github/workflows/publish-command.yml b/.github/workflows/publish-command.yml index 6dfb5913c895..e7f8de2da4b7 100644 --- a/.github/workflows/publish-command.yml +++ b/.github/workflows/publish-command.yml @@ -133,6 +133,7 @@ jobs: TWILIO_TEST_CREDS: ${{ secrets.TWILIO_TEST_CREDS }} ZENDESK_CHAT_INTEGRATION_TEST_CREDS: ${{ secrets.ZENDESK_CHAT_INTEGRATION_TEST_CREDS }} ZENDESK_SECRETS_CREDS: ${{ secrets.ZENDESK_SECRETS_CREDS }} + ZENDESK_SUNSHINE_TEST_CREDS: ${{ secrets.ZENDESK_SUNSHINE_TEST_CREDS }} ZENDESK_TALK_TEST_CREDS: ${{ secrets.ZENDESK_TALK_TEST_CREDS }} ZOOM_INTEGRATION_TEST_CREDS: ${{ secrets.ZOOM_INTEGRATION_TEST_CREDS }} PLAID_INTEGRATION_TEST_CREDS: ${{ secrets.PLAID_INTEGRATION_TEST_CREDS }} diff --git a/.github/workflows/test-command.yml b/.github/workflows/test-command.yml index 545d70a568ca..8c3984f01c45 100644 --- a/.github/workflows/test-command.yml +++ b/.github/workflows/test-command.yml @@ -131,6 +131,7 @@ jobs: TWILIO_TEST_CREDS: ${{ secrets.TWILIO_TEST_CREDS }} ZENDESK_CHAT_INTEGRATION_TEST_CREDS: ${{ secrets.ZENDESK_CHAT_INTEGRATION_TEST_CREDS }} ZENDESK_SECRETS_CREDS: ${{ secrets.ZENDESK_SECRETS_CREDS }} + ZENDESK_SUNSHINE_TEST_CREDS: ${{ secrets.ZENDESK_SUNSHINE_TEST_CREDS }} ZENDESK_TALK_TEST_CREDS: ${{ secrets.ZENDESK_TALK_TEST_CREDS }} ZOOM_INTEGRATION_TEST_CREDS: ${{ secrets.ZOOM_INTEGRATION_TEST_CREDS }} PLAID_INTEGRATION_TEST_CREDS: ${{ secrets.PLAID_INTEGRATION_TEST_CREDS }} diff --git a/airbyte-config/init/src/main/resources/config/STANDARD_SOURCE_DEFINITION/325e0640-e7b3-4e24-b823-3361008f603f.json b/airbyte-config/init/src/main/resources/config/STANDARD_SOURCE_DEFINITION/325e0640-e7b3-4e24-b823-3361008f603f.json new file mode 100644 index 000000000000..615ed01d0c64 --- /dev/null +++ b/airbyte-config/init/src/main/resources/config/STANDARD_SOURCE_DEFINITION/325e0640-e7b3-4e24-b823-3361008f603f.json @@ -0,0 +1,7 @@ +{ + "sourceDefinitionId": "325e0640-e7b3-4e24-b823-3361008f603f", + "name": "Zendesk Sunshine", + "dockerRepository": "airbyte/source-zendesk-sunshine", + "dockerImageTag": "0.1.0", + "documentationUrl": "https://docs.airbyte.io/integrations/sources/zendesk-sunshine" +} diff --git a/airbyte-config/init/src/main/resources/seed/source_definitions.yaml b/airbyte-config/init/src/main/resources/seed/source_definitions.yaml index a984a2894e27..0ab6f14de2e0 100644 --- a/airbyte-config/init/src/main/resources/seed/source_definitions.yaml +++ b/airbyte-config/init/src/main/resources/seed/source_definitions.yaml @@ -358,6 +358,11 @@ dockerRepository: airbyte/source-square dockerImageTag: 0.1.0 documentationUrl: https://docs.airbyte.io/integrations/sources/square +- sourceDefinitionId: 325e0640-e7b3-4e24-b823-3361008f603f + name: Zendesk Sunshine + dockerRepository: airbyte/source-zendesk-sunshine + dockerImageTag: 0.1.0 + documentationUrl: https://docs.airbyte.io/integrations/sources/zendesk-sunshine - sourceDefinitionId: d913b0f2-cc51-4e55-a44c-8ba1697b9239 name: Paypal Transaction dockerRepository: airbyte/source-paypal-transaction diff --git a/airbyte-integrations/connectors/source-zendesk-sunshine/.dockerignore b/airbyte-integrations/connectors/source-zendesk-sunshine/.dockerignore new file mode 100644 index 000000000000..d4dfcb5ef3a4 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sunshine/.dockerignore @@ -0,0 +1,6 @@ +* +!Dockerfile +!main.py +!source_zendesk_sunshine +!setup.py +!secrets diff --git a/airbyte-integrations/connectors/source-zendesk-sunshine/Dockerfile b/airbyte-integrations/connectors/source-zendesk-sunshine/Dockerfile new file mode 100644 index 000000000000..e46b751b39c2 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sunshine/Dockerfile @@ -0,0 +1,16 @@ +FROM python:3.7-slim + +# Bash is installed for more convenient debugging. +RUN apt-get update && apt-get install -y bash && rm -rf /var/lib/apt/lists/* + +WORKDIR /airbyte/integration_code +COPY source_zendesk_sunshine ./source_zendesk_sunshine +COPY main.py ./ +COPY setup.py ./ +RUN pip install . + +ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py" +ENTRYPOINT ["python", "/airbyte/integration_code/main.py"] + +LABEL io.airbyte.version=0.1.0 +LABEL io.airbyte.name=airbyte/source-zendesk-sunshine diff --git a/airbyte-integrations/connectors/source-zendesk-sunshine/README.md b/airbyte-integrations/connectors/source-zendesk-sunshine/README.md new file mode 100644 index 000000000000..0470a8420569 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sunshine/README.md @@ -0,0 +1,131 @@ +# Zendesk Sunshine Source + +This is the repository for the Zendesk Sunshine source connector, written in Python. +For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.io/integrations/sources/zendesk-sunshine). + +## Local development + +### Prerequisites +**To iterate on this connector, make sure to complete this prerequisites section.** + +#### Minimum Python version required `= 3.7.0` + +#### Build & Activate Virtual Environment and install dependencies +From this connector directory, create a virtual environment: +``` +python -m venv .venv +``` + +This will generate a virtualenv for this module in `.venv/`. Make sure this venv is active in your +development environment of choice. To activate it from the terminal, run: +``` +source .venv/bin/activate +pip install -r requirements.txt +``` +If you are in an IDE, follow your IDE's instructions to activate the virtualenv. + +Note that while we are installing dependencies from `requirements.txt`, you should only edit `setup.py` for your dependencies. `requirements.txt` is +used for editable installs (`pip install -e`) to pull in Python dependencies from the monorepo and will call `setup.py`. +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 +should work as you expect. + +#### Building via Gradle +You can also build the connector in Gradle. This is typically used in CI and not needed for your development workflow. + +To build using Gradle, from the Airbyte repository root, run: +``` +./gradlew :airbyte-integrations:connectors:source-zendesk-sunshine:build +``` + +#### Create credentials +**If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.io/integrations/sources/zendesk-sunshine) +to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_zendesk_sunshine/spec.json` file. +Note that any directory named `secrets` is gitignored across the entire Airbyte repo, so there is no danger of accidentally checking in sensitive information. +See `integration_tests/sample_config.json` for a sample config file. + +**If you are an Airbyte core member**, copy the credentials in Lastpass under the secret name `source zendesk-sunshine test creds` +and place them into `secrets/config.json`. + +### Locally running the connector +``` +python main.py spec +python main.py check --config secrets/config.json +python main.py discover --config secrets/config.json +python main.py read --config secrets/config.json --catalog integration_tests/configured_catalog.json +``` + +### Locally running the connector docker image + +#### Build +First, make sure you build the latest Docker image: +``` +docker build . -t airbyte/source-zendesk-sunshine:dev +``` + +You can also build the connector image via Gradle: +``` +./gradlew :airbyte-integrations:connectors:source-zendesk-sunshine:airbyteDocker +``` +When building via Gradle, the docker image name and tag, respectively, are the values of the `io.airbyte.name` and `io.airbyte.version` `LABEL`s in +the Dockerfile. + +#### Run +Then run any of the connector commands as follows: +``` +docker run --rm airbyte/source-zendesk-sunshine:dev spec +docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-zendesk-sunshine:dev check --config /secrets/config.json +docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-zendesk-sunshine:dev discover --config /secrets/config.json +docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/source-zendesk-sunshine:dev read --config /secrets/config.json --catalog /integration_tests/configured_catalog.json +``` +## Testing +Make sure to familiarize yourself with [pytest test discovery](https://docs.pytest.org/en/latest/goodpractices.html#test-discovery) to know how your test files and methods should be named. +First install test dependencies into your virtual environment: +``` +pip install .[tests] +``` +### Unit Tests +To run unit tests locally, from the connector directory run: +``` +python -m pytest unit_tests +``` + +### Integration Tests +There are two types of integration tests: Acceptance Tests (Airbyte's test suite for all source connectors) and custom integration tests (which are specific to this connector). +#### Custom Integration tests +Place custom tests inside `integration_tests/` folder, then, from the connector root, run +``` +python -m pytest integration_tests +``` +#### Acceptance Tests +Customize `acceptance-test-config.yml` file to configure tests. See [Source Acceptance Tests](source-acceptance-tests.md) for more information. +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. +To run your integration tests with acceptance tests, from the connector root, run +``` +python -m pytest integration_tests -p integration_tests.acceptance +``` +To run your integration tests with docker + +### Using gradle to run tests +All commands should be run from airbyte project root. +To run unit tests: +``` +./gradlew :airbyte-integrations:connectors:source-zendesk-sunshine:unitTest +``` +To run acceptance and custom integration tests: +``` +./gradlew :airbyte-integrations:connectors:source-zendesk-sunshine:integrationTest +``` + +## Dependency Management +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. +We split dependencies between two groups, dependencies that are: +* required for your connector to work need to go to `MAIN_REQUIREMENTS` list. +* required for the testing need to go to `TEST_REQUIREMENTS` list + +### Publishing a new version of the connector +You've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what? +1. Make sure your changes are passing unit and integration tests. +1. Bump the connector version in `Dockerfile` -- just increment the value of the `LABEL io.airbyte.version` appropriately (we use [SemVer](https://semver.org/)). +1. Create a Pull Request. +1. Pat yourself on the back for being an awesome contributor. +1. Someone from Airbyte will take a look at your PR and iterate with you to merge it into master. diff --git a/airbyte-integrations/connectors/source-zendesk-sunshine/acceptance-test-config.yml b/airbyte-integrations/connectors/source-zendesk-sunshine/acceptance-test-config.yml new file mode 100644 index 000000000000..dee49e1f0e5c --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sunshine/acceptance-test-config.yml @@ -0,0 +1,24 @@ +# See [Source Acceptance Tests](https://docs.airbyte.io/contributing-to-airbyte/building-new-connector/source-acceptance-tests.md) +# for more information about how to configure these tests +connector_image: airbyte/source-zendesk-sunshine:dev +tests: + spec: + - spec_path: "source_zendesk_sunshine/spec.json" + connection: + - config_path: "secrets/config.json" + status: "succeed" + - config_path: "integration_tests/invalid_config.json" + status: "failed" + discovery: + - config_path: "secrets/config.json" + basic_read: + - config_path: "secrets/config.json" + configured_catalog_path: "integration_tests/configured_catalog.json" + validate_output_from_all_streams: yes +# incremental: # complex state ( {parent_id: {cur_field: value}} still not supported ) +# - config_path: "secrets/config.json" +# configured_catalog_path: "integration_tests/configured_catalog.json" +# future_state_path: "integration_tests/abnormal_state.json" + full_refresh: + - config_path: "secrets/config.json" + configured_catalog_path: "integration_tests/configured_catalog.json" diff --git a/airbyte-integrations/connectors/source-zendesk-sunshine/acceptance-test-docker.sh b/airbyte-integrations/connectors/source-zendesk-sunshine/acceptance-test-docker.sh new file mode 100644 index 000000000000..1425ff74f151 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sunshine/acceptance-test-docker.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env sh +docker run --rm -it \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v /tmp:/tmp \ + -v $(pwd):/test_input \ + airbyte/source-acceptance-test \ + --acceptance-test-config /test_input diff --git a/airbyte-integrations/connectors/source-zendesk-sunshine/build.gradle b/airbyte-integrations/connectors/source-zendesk-sunshine/build.gradle new file mode 100644 index 000000000000..09281b03a7ed --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sunshine/build.gradle @@ -0,0 +1,13 @@ +plugins { + id 'airbyte-python' + id 'airbyte-docker' + id 'airbyte-source-acceptance-test' +} + +airbytePython { + moduleDirectory 'source_zendesk_sunshine' +} + +dependencies { + implementation files(project(':airbyte-integrations:bases:source-acceptance-test').airbyteDocker.outputs) +} diff --git a/airbyte-integrations/connectors/source-zendesk-sunshine/integration_tests/__init__.py b/airbyte-integrations/connectors/source-zendesk-sunshine/integration_tests/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/airbyte-integrations/connectors/source-zendesk-sunshine/integration_tests/acceptance.py b/airbyte-integrations/connectors/source-zendesk-sunshine/integration_tests/acceptance.py new file mode 100644 index 000000000000..d6cbdc97c495 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sunshine/integration_tests/acceptance.py @@ -0,0 +1,34 @@ +# +# MIT License +# +# Copyright (c) 2020 Airbyte +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# + + +import pytest + +pytest_plugins = ("source_acceptance_test.plugin",) + + +@pytest.fixture(scope="session", autouse=True) +def connector_setup(): + """ This fixture is a placeholder for external resources that acceptance test might require.""" + yield diff --git a/airbyte-integrations/connectors/source-zendesk-sunshine/integration_tests/configured_catalog.json b/airbyte-integrations/connectors/source-zendesk-sunshine/integration_tests/configured_catalog.json new file mode 100644 index 000000000000..9f3045cca3f4 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sunshine/integration_tests/configured_catalog.json @@ -0,0 +1,260 @@ +{ + "streams": [ + { + "stream": { + "name": "object_types", + "json_schema": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "schema": { + "type": "object", + "properties": { + "properties": { + "type": "object" + }, + "required": { + "type": "array", + "items": { + "type": "string" + } + }, + "additionalProperties": { + "type": "boolean" + } + } + }, + "created_at": { + "type": "string" + }, + "updated_at": { + "type": "string" + } + } + }, + "supported_sync_modes": [ + "full_refresh", + "incremental" + ], + "source_defined_cursor": true, + "default_cursor_field": [] + }, + "sync_mode": "full_refresh", + "cursor_field": [], + "destination_sync_mode": "append" + }, + { + "stream": { + "name": "object_records", + "json_schema": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "id": { + "type": "string" + }, + "external_id": { + "type": "string" + }, + "attributes": { + "type": "object" + }, + "created_at": { + "type": "string" + }, + "updated_at": { + "type": "string" + } + } + }, + "supported_sync_modes": [ + "full_refresh", + "incremental" + ], + "source_defined_cursor": true, + "default_cursor_field": ["updated_at"] + }, + "sync_mode": "incremental", + "cursor_field": ["updated_at"], + "destination_sync_mode": "append" + }, + { + "stream": { + "name": "relationship_types", + "json_schema": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "source": { + "type": "string" + }, + "target": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "updated_at": { + "type": "string" + } + } + }, + "supported_sync_modes": [ + "full_refresh", + "incremental" + ], + "source_defined_cursor": true, + "default_cursor_field": [] + }, + "sync_mode": "full_refresh", + "cursor_field": [], + "destination_sync_mode": "append" + }, + { + "stream": { + "name": "relationship_records", + "json_schema": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "relationship_type": { + "type": "string" + }, + "source": { + "type": "string" + }, + "target": { + "type": "string" + }, + "created_at": { + "type": "string" + } + } + }, + "supported_sync_modes": [ + "full_refresh", + "incremental" + ], + "source_defined_cursor": true, + "default_cursor_field": [] + }, + "sync_mode": "full_refresh", + "cursor_field": [], + "destination_sync_mode": "append" + }, + { + "stream": { + "name": "object_type_policies", + "json_schema": { + "type": "object", + "properties": { + "object_type": { + "type": "string" + }, + "rbac": { + "type": "object", + "properties": { + "admin": { + "type": "object", + "properties": { + "create": { + "type": "boolean" + }, + "read": { + "type": "boolean" + }, + "update": { + "type": "boolean" + }, + "delete": { + "type": "boolean" + } + } + }, + "agent": { + "type": "object", + "properties": { + "create": { + "type": "boolean" + }, + "read": { + "type": "boolean" + }, + "update": { + "type": "boolean" + }, + "delete": { + "type": "boolean" + } + } + }, + "end_user": { + "type": "object", + "properties": { + "create": { + "type": "boolean" + }, + "read": { + "type": "boolean" + }, + "update": { + "type": "boolean" + }, + "delete": { + "type": "boolean" + } + } + } + } + } + } + }, + "supported_sync_modes": [ + "full_refresh", + "incremental" + ], + "source_defined_cursor": true, + "default_cursor_field": [] + }, + "sync_mode": "full_refresh", + "cursor_field": [], + "destination_sync_mode": "append" + }, + { + "stream": { + "name": "limits", + "json_schema": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "limit": { + "type": "integer" + }, + "count": { + "type": "integer" + } + } + }, + "supported_sync_modes": [ + "full_refresh", + "incremental" + ], + "source_defined_cursor": true, + "default_cursor_field": [] + }, + "sync_mode": "full_refresh", + "cursor_field": [], + "destination_sync_mode": "append" + } + ] +} diff --git a/airbyte-integrations/connectors/source-zendesk-sunshine/integration_tests/invalid_config.json b/airbyte-integrations/connectors/source-zendesk-sunshine/integration_tests/invalid_config.json new file mode 100644 index 000000000000..b94ebf14cc68 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sunshine/integration_tests/invalid_config.json @@ -0,0 +1,6 @@ +{ + "email": "test@ayhghghte.io", + "api_token": "fgfgvf ghnbvg hnghbvnhbvnvbn", + "subdomain": "d3v-airbyte", + "start_date": "2020-01-01T00:00:00Z" +} diff --git a/airbyte-integrations/connectors/source-zendesk-sunshine/main.py b/airbyte-integrations/connectors/source-zendesk-sunshine/main.py new file mode 100644 index 000000000000..46eb54eed29a --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sunshine/main.py @@ -0,0 +1,33 @@ +# +# MIT License +# +# Copyright (c) 2020 Airbyte +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# + + +import sys + +from airbyte_cdk.entrypoint import launch +from source_zendesk_sunshine import SourceZendeskSunshine + +if __name__ == "__main__": + source = SourceZendeskSunshine() + launch(source, sys.argv[1:]) diff --git a/airbyte-integrations/connectors/source-zendesk-sunshine/requirements.txt b/airbyte-integrations/connectors/source-zendesk-sunshine/requirements.txt new file mode 100644 index 000000000000..0411042aa091 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sunshine/requirements.txt @@ -0,0 +1,2 @@ +-e ../../bases/source-acceptance-test +-e . diff --git a/airbyte-integrations/connectors/source-zendesk-sunshine/sample_files/state.json b/airbyte-integrations/connectors/source-zendesk-sunshine/sample_files/state.json new file mode 100644 index 000000000000..5915164004e8 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sunshine/sample_files/state.json @@ -0,0 +1,7 @@ +{ + "object_records": { + "s1tfq4tjlyaw": { + "updated_at": "2021-06-24T10:50:39.772Z" + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sunshine/setup.py b/airbyte-integrations/connectors/source-zendesk-sunshine/setup.py new file mode 100644 index 000000000000..b4a03c646b12 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sunshine/setup.py @@ -0,0 +1,48 @@ +# +# MIT License +# +# Copyright (c) 2020 Airbyte +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# + + +from setuptools import find_packages, setup + +MAIN_REQUIREMENTS = [ + "airbyte-cdk", +] + +TEST_REQUIREMENTS = [ + "pytest~=6.1", + "source-acceptance-test", +] + +setup( + name="source_zendesk_sunshine", + description="Source implementation for Zendesk Sunshine.", + author="Airbyte", + author_email="contact@airbyte.io", + packages=find_packages(), + install_requires=MAIN_REQUIREMENTS, + package_data={"": ["*.json", "schemas/*.json", "schemas/shared/*.json"]}, + extras_require={ + "tests": TEST_REQUIREMENTS, + }, +) diff --git a/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/__init__.py b/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/__init__.py new file mode 100644 index 000000000000..f1f84df11521 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/__init__.py @@ -0,0 +1,27 @@ +""" +MIT License + +Copyright (c) 2020 Airbyte + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +""" + +from .source import SourceZendeskSunshine + +__all__ = ["SourceZendeskSunshine"] diff --git a/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/schemas/jobs.json b/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/schemas/jobs.json new file mode 100644 index 000000000000..9325c5687d8d --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/schemas/jobs.json @@ -0,0 +1,20 @@ +{ + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "job_status": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "completed_at": { + "type": "string" + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/schemas/limits.json b/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/schemas/limits.json new file mode 100644 index 000000000000..14c7b0e353b5 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/schemas/limits.json @@ -0,0 +1,14 @@ +{ + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "limit": { + "type": "integer" + }, + "count": { + "type": "integer" + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/schemas/object_records.json b/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/schemas/object_records.json new file mode 100644 index 000000000000..ab297c1759de --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/schemas/object_records.json @@ -0,0 +1,23 @@ +{ + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "id": { + "type": "string" + }, + "external_id": { + "type": ["string", "null"] + }, + "attributes": { + "type": "object" + }, + "created_at": { + "type": "string" + }, + "updated_at": { + "type": "string" + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/schemas/object_type_policies.json b/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/schemas/object_type_policies.json new file mode 100644 index 000000000000..bc5a007ed826 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/schemas/object_type_policies.json @@ -0,0 +1,64 @@ +{ + "type": "object", + "properties": { + "object_type": { + "type": "string" + }, + "rbac": { + "type": "object", + "properties": { + "admin": { + "type": "object", + "properties": { + "create": { + "type": "boolean" + }, + "read": { + "type": "boolean" + }, + "update": { + "type": "boolean" + }, + "delete": { + "type": "boolean" + } + } + }, + "agent": { + "type": "object", + "properties": { + "create": { + "type": "boolean" + }, + "read": { + "type": "boolean" + }, + "update": { + "type": "boolean" + }, + "delete": { + "type": "boolean" + } + } + }, + "end_user": { + "type": "object", + "properties": { + "create": { + "type": "boolean" + }, + "read": { + "type": "boolean" + }, + "update": { + "type": "boolean" + }, + "delete": { + "type": "boolean" + } + } + } + } + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/schemas/object_types.json b/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/schemas/object_types.json new file mode 100644 index 000000000000..5414d5ba1550 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/schemas/object_types.json @@ -0,0 +1,31 @@ +{ + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "schema": { + "type": "object", + "properties": { + "properties": { + "type": "object" + }, + "required": { + "type": "array", + "items": { + "type": "string" + } + }, + "additionalProperties": { + "type": "boolean" + } + } + }, + "created_at": { + "type": "string" + }, + "updated_at": { + "type": "string" + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/schemas/relationship_records.json b/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/schemas/relationship_records.json new file mode 100644 index 000000000000..621db91cdcff --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/schemas/relationship_records.json @@ -0,0 +1,20 @@ +{ + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "relationship_type": { + "type": "string" + }, + "source": { + "type": "string" + }, + "target": { + "type": "string" + }, + "created_at": { + "type": "string" + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/schemas/relationship_types.json b/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/schemas/relationship_types.json new file mode 100644 index 000000000000..6c5ae84b3a89 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/schemas/relationship_types.json @@ -0,0 +1,20 @@ +{ + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "source": { + "type": "string" + }, + "target": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "updated_at": { + "type": "string" + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/source.py b/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/source.py new file mode 100644 index 000000000000..8e74755164ff --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/source.py @@ -0,0 +1,88 @@ +# +# MIT License +# +# Copyright (c) 2020 Airbyte +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# + + +import base64 +from typing import Any, List, Mapping, Tuple + +import pendulum +from airbyte_cdk.logger import AirbyteLogger +from airbyte_cdk.models import SyncMode +from airbyte_cdk.sources import AbstractSource +from airbyte_cdk.sources.streams import Stream +from airbyte_cdk.sources.streams.http.auth import TokenAuthenticator + +from .streams import ( + Limits, + ObjectRecords, + ObjectTypePolicies, + ObjectTypes, + RelationshipRecords, + RelationshipTypes, +) + + +class Base64HttpAuthenticator(TokenAuthenticator): + def __init__(self, auth: Tuple[str, str], auth_method: str = "Basic", **kwargs): + auth_string = f"{auth[0]}:{auth[1]}".encode("utf8") + b64_encoded = base64.b64encode(auth_string).decode("utf8") + super().__init__(token=b64_encoded, auth_method=auth_method, **kwargs) + + +class SourceZendeskSunshine(AbstractSource): + def check_connection(self, logger: AirbyteLogger, config: Mapping[str, Any]) -> Tuple[bool, Any]: + try: + pendulum.parse(config["start_date"], strict=True) + authenticator = Base64HttpAuthenticator(auth=(f'{config["email"]}/token', config["api_token"])) + stream = Limits(authenticator=authenticator, subdomain=config["subdomain"], start_date=pendulum.parse(config["start_date"])) + records = stream.read_records(sync_mode=SyncMode.full_refresh) + next(records) + return True, None + except Exception as e: + return False, repr(e) + + def streams(self, config: Mapping[str, Any]) -> List[Stream]: + """ + CustomObjectEvents stream is an early access stream. (looks like it is a new feature) + It requires activation in site ui + manual activation from Zendesk via call. + I requested the call, but since they did not approve it, + this endpoint will return 403 Forbidden. Thats why it is disabled here. + + Jobs stream is also commented out. Reason: It is dynamic. + It can have the data, but this data have time to live. + After this time is passed we have no data. It will require permanent population, to pass + the test criteria `stream should contain at least 1 record) + """ + authenticator = Base64HttpAuthenticator(auth=(f'{config["email"]}/token', config["api_token"])) + args = {"authenticator": authenticator, "subdomain": config["subdomain"], "start_date": config["start_date"]} + return [ + ObjectTypes(**args), + ObjectRecords(**args), + RelationshipTypes(**args), + RelationshipRecords(**args), + # CustomObjectEvents(**args), + ObjectTypePolicies(**args), + # Jobs(**args), + Limits(**args), + ] diff --git a/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/spec.json b/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/spec.json new file mode 100644 index 000000000000..9adb9b65dc05 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/spec.json @@ -0,0 +1,32 @@ +{ + "documentationUrl": "https://docs.airbyte.io/integrations/sources/zendesk_sunshine", + "connectionSpecification": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Zendesk Sunshine Spec", + "type": "object", + "required": ["api_token", "email", "start_date" ,"subdomain"], + "additionalProperties": false, + "properties": { + "api_token": { + "type": "string", + "airbyte_secret": true, + "description": "API Token. See the docs for information on how to generate this key." + }, + "email": { + "type": "string", + "description": "The user email for your Zendesk account" + }, + "subdomain": { + "type": "string", + "description": "The subdomain for your Zendesk Account" + }, + "start_date": { + "title": "Start Date", + "type": "string", + "description": "The date from which you'd like to replicate the data", + "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$", + "examples": "2021-01-01T00:00:00.000000Z" + } + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/streams.py b/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/streams.py new file mode 100644 index 000000000000..8e077d386351 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-sunshine/source_zendesk_sunshine/streams.py @@ -0,0 +1,222 @@ +# +# MIT License +# +# Copyright (c) 2020 Airbyte +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# + + +import urllib.parse +from abc import ABC +from typing import Any, Iterable, Mapping, MutableMapping, Optional + +import pendulum +import requests +from airbyte_cdk.models import SyncMode +from airbyte_cdk.sources.streams.http import HttpStream + + +class SunshineStream(HttpStream, ABC): + primary_key = "id" + data_field = "data" + page_size = 100 + + def __init__(self, subdomain: str, start_date: pendulum.datetime, **kwargs): + self._start_date = start_date + self.subdomain = subdomain + super().__init__(**kwargs) + + @property + def url_base(self) -> str: + return f"https://{self.subdomain}.zendesk.com/api/sunshine/" + + def backoff_time(self, response: requests.Response) -> Optional[float]: + delay_time = response.headers.get("Retry-After") + if delay_time: + return float(delay_time) + + def next_page_token(self, response: requests.Response) -> Optional[Mapping[str, Any]]: + resp_json = response.json() + if resp_json.get("links") and resp_json.get("links").get("next"): + next_query_string = urllib.parse.urlsplit(resp_json.get("links").get("next")).query + params = dict(urllib.parse.parse_qsl(next_query_string)) + return params + return {} + + def request_headers(self, **kwargs) -> Mapping[str, Any]: + return {"Content-Type": "application/json"} + + def parse_response(self, response: requests.Response, stream_state: Mapping[str, Any], **kwargs) -> Iterable[Mapping]: + """ + The response data field is mostly a list of objects. Sometimes we can have object in data field. + (example `ObjectTypePolicies`). In this case this method should be overridden. + """ + response_json = response.json() + yield from response_json.get(self.data_field, []) + + def request_params( + self, stream_state: Mapping[str, Any], stream_slice: Mapping[str, Any] = None, next_page_token: Mapping[str, Any] = None + ) -> MutableMapping[str, Any]: + + params = {"per_page": self.page_size} + if next_page_token: + params.update(next_page_token) + return params + + +class IncrementalSunshineStream(SunshineStream, ABC): + state_checkpoint_interval = 1000 + cursor_field = "updated_at" # most common + + def get_updated_state(self, current_stream_state: MutableMapping[str, Any], latest_record: Mapping[str, Any]) -> Mapping[str, Any]: + """ + Return the latest state by comparing the cursor value in the latest record with the stream's most recent state object + and returning an updated state object. + """ + latest_state = latest_record.get(self.cursor_field) + current_state = current_stream_state.get(self.cursor_field) or latest_state + # dates are ISO-formatted, no need to parse + return {self.cursor_field: max(latest_state, current_state)} + + +class ObjectTypes(SunshineStream): + def path(self, **kwargs) -> str: + return "objects/types" + + +class ObjectRecords(IncrementalSunshineStream): + """ + The get method supports only the full-refresh way to get the information fron this source. + This source has date fields in all the endpoints, but we cannot query this field during GET requests. + To support Incremental for this stream I had to use `query` endpoint instead of `objects/records` - + this allows me to use date filters. This is the only way to have incremental support. + """ + http_method = "POST" + + def request_body_json( + self, + stream_state: Mapping[str, Any], + stream_slice: Mapping[str, Any] = None, + next_page_token: Mapping[str, Any] = None, + ) -> Optional[Mapping]: + type_ = stream_slice["type"] + state_value = stream_state.get(type_, {}).get(self.cursor_field) + start_date = state_value or self._start_date + formatted_start_date = pendulum.parse(start_date).strftime("%Y-%m-%d %H:%M:%S.%f")[:-3] + query = { + "query": {"_type": {"$eq": type_}}, + "_updated_at": { + "start": formatted_start_date, + }, + "sort_by": "_updated_at asc", + } + return query + + def path(self, **kwargs) -> str: + return "objects/query" + + def stream_slices(self, **kwargs): + parent_stream = ObjectTypes(authenticator=self.authenticator, subdomain=self.subdomain, start_date=self._start_date) + for obj_type in parent_stream.read_records(sync_mode=SyncMode.full_refresh): + yield {"type": obj_type["key"]} + + def get_updated_state(self, current_stream_state: MutableMapping[str, Any], latest_record: Mapping[str, Any]) -> Mapping[str, Any]: + type_ = latest_record.get("type") + latest_cursor_value = latest_record.get(self.cursor_field) + current_stream_state = current_stream_state or {} + current_state = current_stream_state.get(type_) if current_stream_state else None + if current_state: + current_state = current_state.get(self.cursor_field) + current_state_value = current_state or latest_cursor_value + max_value = max(current_state_value, latest_cursor_value) + new_value = {self.cursor_field: max_value} + + current_stream_state[type_] = new_value + return current_stream_state + + +class RelationshipTypes(SunshineStream): + def path(self, **kwargs) -> str: + return "relationships/types" + + +class RelationshipRecords(SunshineStream): + def path(self, **kwargs) -> str: + return "relationships/records" + + def stream_slices(self, **kwargs): + parent_stream = RelationshipTypes(authenticator=self.authenticator, subdomain=self.subdomain, start_date=self._start_date) + for rel_type in parent_stream.read_records(sync_mode=SyncMode.full_refresh): + yield {"type": rel_type["key"]} + + def request_params( + self, stream_state: Mapping[str, Any], stream_slice: Mapping[str, Any] = None, next_page_token: Mapping[str, Any] = None + ) -> MutableMapping[str, Any]: + + params = super().request_params(stream_state=stream_state, stream_slice=stream_slice, next_page_token=next_page_token) + type_ = stream_slice["type"] + params["type"] = type_ + return params + + +class CustomObjectEvents(SunshineStream): + """ + This stream is early access stream. (look like a new feature) + It requires activation in site ui + manual activation from Zendesk via call. + I requested the call, but since they did not approve it, + this endpoint will return 403 Forbidden + """ + + def path(self, **kwargs) -> str: + return "objects/events" + + +class ObjectTypePolicies(SunshineStream): + def stream_slices(self, **kwargs): + parent_stream = ObjectTypes(authenticator=self.authenticator, subdomain=self.subdomain, start_date=self._start_date) + for obj_type in parent_stream.read_records(sync_mode=SyncMode.full_refresh): + yield {"type": obj_type["key"]} + + def path(self, stream_slice: Mapping[str, Any] = None, **kwargs) -> str: + obj_type = stream_slice["type"] + return f"objects/types/{obj_type}/permissions" + + def parse_response( + self, response: requests.Response, stream_state: Mapping[str, Any], stream_slice: Mapping[str, Any] = None, **kwargs + ) -> Iterable[Mapping]: + response_json = response.json() + data = response_json.get(self.data_field, {}) + # the response does not contain info about parent itself - only rules. Need to add this. + data["object_type"] = stream_slice["type"] + yield data + + +class Jobs(SunshineStream): + """ + This stream is dynamic. The data can exist today, but may be absent tomorrow. + Since we need to have some data in the stream this stream is disabled. + """ + def path(self, **kwargs) -> str: + return "jobs" + + +class Limits(SunshineStream): + def path(self, **kwargs) -> str: + return "limits" diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index 009a90b54691..b19140e156df 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -95,6 +95,7 @@ * [Tempo](integrations/sources/tempo.md) * [Twilio](integrations/sources/twilio.md) * [Zendesk Chat](integrations/sources/zendesk-chat.md) + * [Zendesk Sunshine](integrations/sources/zendesk-sunshine.md) * [Zendesk Support](integrations/sources/zendesk-support.md) * [Zendesk Talk](integrations/sources/zendesk-talk.md) * [Zoom](integrations/sources/zoom.md) diff --git a/docs/integrations/README.md b/docs/integrations/README.md index bdd15ad67a58..e21b945a02de 100644 --- a/docs/integrations/README.md +++ b/docs/integrations/README.md @@ -72,6 +72,7 @@ Airbyte uses a grading system for connectors to help users understand what to ex |[Tempo](./sources/tempo.md)| Beta | |[Twilio](./sources/twilio.md)| Beta | |[Zendesk Chat](./sources/zendesk-chat.md)| Certified | +|[Zendesk Sunshine](./sources/zendesk-sunshine.md)| Beta | |[Zendesk Support](./sources/zendesk-support.md)| Certified | |[Zendesk Talk](./sources/zendesk-talk.md)| Certified | |[Zoom](./sources/zoom.md)| Beta | diff --git a/docs/integrations/sources/zendesk-sunshine.md b/docs/integrations/sources/zendesk-sunshine.md new file mode 100644 index 000000000000..844d6721b3a2 --- /dev/null +++ b/docs/integrations/sources/zendesk-sunshine.md @@ -0,0 +1,66 @@ +# Zendesk Sunshine + +## Sync overview + +The Zendesk Chat source supports Full Refresh and Incremental syncs. + +This source can sync data for the [Zendesk Sunshine API](https://developer.zendesk.com/documentation/custom-data/custom-objects/custom-objects-handbook/). + +### Output schema + +This Source is capable of syncing the following core Streams: + +* [ObjectTypes](https://developer.zendesk.com/api-reference/custom-data/custom-objects-api/resource_types/) +* [ObjectRecords](https://developer.zendesk.com/api-reference/custom-data/custom-objects-api/resources/) +* [RelationshipTypes](https://developer.zendesk.com/api-reference/custom-data/custom-objects-api/relationship_types/) +* [RelationshipRecords](https://developer.zendesk.com/api-reference/custom-data/custom-objects-api/relationships/) +* [ObjectTypePolicies](https://developer.zendesk.com/api-reference/custom-data/custom-objects-api/permissions/) +* [Jobs](https://developer.zendesk.com/api-reference/custom-data/custom-objects-api/jobs/) + This stream is currently not available because it stores data temporary. +* [Limits](https://developer.zendesk.com/api-reference/custom-data/custom-objects-api/limits/) + + + + +### Data type mapping + +| Integration Type | Airbyte Type | Notes | +| :--- | :--- | :--- | +| `string` | `string` | | +| `number` | `number` | | +| `array` | `array` | | +| `object` | `object` | | + +### Features + +| Feature | Supported?\(Yes/No\) | Notes | +| :--- | :--- | :--- | +| Full Refresh Sync | Yes | | +| Incremental Sync | Yes | | + +### Performance considerations + +The connector is restricted by normal Zendesk [requests limitation](https://developer.zendesk.com/api-reference/ticketing/account-configuration/usage_limits/) + +The Zendesk connector should not run into Zendesk API limitations under normal usage. Please [create an issue](https://github.com/airbytehq/airbyte/issues) if you see any rate limit issues that are not automatically retried successfully. + +## Getting started + +### Requirements + +* Zendesk Sunshine Access Token + +### Setup guide + +Please follow this [guide](https://developer.zendesk.com/documentation/custom-data/custom-objects/getting-started-with-custom-objects/#enabling-custom-objects) + +Generate a Access Token as described in [here](https://developer.zendesk.com/api-reference/ticketing/introduction/#security-and-authentication) + +We recommend creating a restricted, read-only key specifically for Airbyte access. This will allow you to control which resources Airbyte should be able to access. + +## Changelog + +| Version | Date | Pull Request | Subject | +| :------ | :-------- | :----- | :------ | +| 0.1.0 | 2021-07-08 | [4359](https://github.com/airbytehq/airbyte/pull/4359) | Initial Release | + diff --git a/tools/bin/ci_credentials.sh b/tools/bin/ci_credentials.sh index 56f58c9a0e4d..4d76b90bbde7 100755 --- a/tools/bin/ci_credentials.sh +++ b/tools/bin/ci_credentials.sh @@ -95,6 +95,7 @@ write_standard_creds source-tempo "$TEMPO_INTEGRATION_TEST_CREDS" write_standard_creds source-twilio-singer "$TWILIO_TEST_CREDS" write_standard_creds source-twilio "$TWILIO_TEST_CREDS" write_standard_creds source-zendesk-chat "$ZENDESK_CHAT_INTEGRATION_TEST_CREDS" +write_standard_creds source-zendesk-sunshine "$ZENDESK_SUNSHINE_TEST_CREDS" write_standard_creds source-zendesk-support-singer "$ZENDESK_SECRETS_CREDS" write_standard_creds source-zendesk-talk "$ZENDESK_TALK_TEST_CREDS" write_standard_creds source-zoom-singer "$ZOOM_INTEGRATION_TEST_CREDS"