Skip to content

Commit 0405990

Browse files
ambirdsalllazebnyigirarda
authored
🚨🚨 Migrate source-zendesk-talk to low code (#35780)
Co-authored-by: Serhii Lazebnyi <[email protected]> Co-authored-by: Alexandre Girard <[email protected]>
1 parent 7cdf69e commit 0405990

File tree

14 files changed

+1898
-979
lines changed

14 files changed

+1898
-979
lines changed

airbyte-integrations/connectors/source-zendesk-talk/acceptance-test-config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ acceptance_tests:
1212
- config_path: "secrets/config.json"
1313
status: "succeed"
1414
- config_path: "integration_tests/invalid_config.json"
15-
status: "exception"
15+
status: "failed"
1616
- config_path: "secrets/config_old.json"
1717
status: "succeed"
1818
discovery:

airbyte-integrations/connectors/source-zendesk-talk/metadata.yaml

+11-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ data:
1111
connectorSubtype: api
1212
connectorType: source
1313
definitionId: c8630570-086d-4a40-99ae-ea5b18673071
14-
dockerImageTag: 0.2.1
14+
dockerImageTag: 1.0.0
1515
dockerRepository: airbyte/source-zendesk-talk
1616
documentationUrl: https://docs.airbyte.com/integrations/sources/zendesk-talk
1717
githubIssueLabel: source-zendesk-talk
@@ -30,7 +30,16 @@ data:
3030
enabled: true
3131
releaseStage: generally_available
3232
supportLevel: certified
33+
releases:
34+
breakingChanges:
35+
1.0.0:
36+
upgradeDeadline: "2024-05-31"
37+
message: >-
38+
The source Zendesk Talk connector is being migrated from the Python CDK to our declarative low-code CDK.
39+
Due to changes to the incremental stream state message format and the removal of a nonexistent field from
40+
the ivrs stream schema, this migration constitutes a breaking change. After updating, please reset your source
41+
before resuming syncs. For more information, see our migration documentation for source Zendesk Talk.
3342
tags:
3443
- language:python
35-
- cdk:python
44+
- cdk:low-code
3645
metadataSpecVersion: "1.0"

airbyte-integrations/connectors/source-zendesk-talk/poetry.lock

+67-66
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

airbyte-integrations/connectors/source-zendesk-talk/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",]
33
build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
6-
version = "0.2.1"
6+
version = "1.0.0"
77
name = "source-zendesk-talk"
88
description = "Source implementation for Zendesk Talk."
99
authors = [ "Airbyte <[email protected]>",]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
2+
3+
from dataclasses import dataclass
4+
from typing import Any, List, Mapping
5+
6+
import requests
7+
from airbyte_cdk.sources.declarative.auth.declarative_authenticator import DeclarativeAuthenticator
8+
from airbyte_cdk.sources.declarative.auth.token import BasicHttpAuthenticator, BearerAuthenticator
9+
from airbyte_cdk.sources.declarative.extractors.record_extractor import RecordExtractor
10+
from airbyte_cdk.sources.declarative.types import Record
11+
12+
13+
@dataclass
14+
class IVRMenusRecordExtractor(RecordExtractor):
15+
def extract_records(self, response: requests.Response) -> List[Record]:
16+
ivrs = response.json().get("ivrs", [])
17+
records = []
18+
for ivr in ivrs:
19+
for menu in ivr.get("menus", []):
20+
records.append({"ivr_id": ivr["id"], **menu})
21+
return records
22+
23+
24+
@dataclass
25+
class IVRRoutesRecordExtractor(RecordExtractor):
26+
def extract_records(self, response: requests.Response) -> List[Record]:
27+
ivrs = response.json().get("ivrs", [])
28+
records = []
29+
for ivr in ivrs:
30+
for menu in ivr.get("menus", []):
31+
for route in menu.get("routes", []):
32+
records.append({"ivr_id": ivr["id"], "ivr_menu_id": menu["id"], **route})
33+
return records
34+
35+
36+
@dataclass
37+
class ZendeskTalkAuthenticator(DeclarativeAuthenticator):
38+
config: Mapping[str, Any]
39+
legacy_basic_auth: BasicHttpAuthenticator
40+
basic_auth: BasicHttpAuthenticator
41+
oauth: BearerAuthenticator
42+
43+
def __new__(cls, legacy_basic_auth, basic_auth, oauth, config, *args, **kwargs):
44+
credentials = config.get("credentials", {})
45+
if config.get("access_token", {}) and config.get("email", {}):
46+
return legacy_basic_auth
47+
elif credentials["auth_type"] == "api_token":
48+
return basic_auth
49+
elif credentials["auth_type"] == "oauth2.0":
50+
return oauth
51+
else:
52+
raise Exception(f"Missing valid authenticator for auth_type: {credentials['auth_type']}")

0 commit comments

Comments
 (0)