Skip to content

Commit

Permalink
🚨🚨 Migrate source-zendesk-talk to low code (#35780)
Browse files Browse the repository at this point in the history
Co-authored-by: Serhii Lazebnyi <serhii.lazebnyi@globallogic.com>
Co-authored-by: Alexandre Girard <alexandre@airbyte.io>
  • Loading branch information
3 people authored May 13, 2024
1 parent 7cdf69e commit 0405990
Show file tree
Hide file tree
Showing 14 changed files with 1,898 additions and 979 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ acceptance_tests:
- config_path: "secrets/config.json"
status: "succeed"
- config_path: "integration_tests/invalid_config.json"
status: "exception"
status: "failed"
- config_path: "secrets/config_old.json"
status: "succeed"
discovery:
Expand Down
13 changes: 11 additions & 2 deletions airbyte-integrations/connectors/source-zendesk-talk/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: c8630570-086d-4a40-99ae-ea5b18673071
dockerImageTag: 0.2.1
dockerImageTag: 1.0.0
dockerRepository: airbyte/source-zendesk-talk
documentationUrl: https://docs.airbyte.com/integrations/sources/zendesk-talk
githubIssueLabel: source-zendesk-talk
Expand All @@ -30,7 +30,16 @@ data:
enabled: true
releaseStage: generally_available
supportLevel: certified
releases:
breakingChanges:
1.0.0:
upgradeDeadline: "2024-05-31"
message: >-
The source Zendesk Talk connector is being migrated from the Python CDK to our declarative low-code CDK.
Due to changes to the incremental stream state message format and the removal of a nonexistent field from
the ivrs stream schema, this migration constitutes a breaking change. After updating, please reset your source
before resuming syncs. For more information, see our migration documentation for source Zendesk Talk.
tags:
- language:python
- cdk:python
- cdk:low-code
metadataSpecVersion: "1.0"
133 changes: 67 additions & 66 deletions airbyte-integrations/connectors/source-zendesk-talk/poetry.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
version = "0.2.1"
version = "1.0.0"
name = "source-zendesk-talk"
description = "Source implementation for Zendesk Talk."
authors = [ "Airbyte <contact@airbyte.io>",]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.

from dataclasses import dataclass
from typing import Any, List, Mapping

import requests
from airbyte_cdk.sources.declarative.auth.declarative_authenticator import DeclarativeAuthenticator
from airbyte_cdk.sources.declarative.auth.token import BasicHttpAuthenticator, BearerAuthenticator
from airbyte_cdk.sources.declarative.extractors.record_extractor import RecordExtractor
from airbyte_cdk.sources.declarative.types import Record


@dataclass
class IVRMenusRecordExtractor(RecordExtractor):
def extract_records(self, response: requests.Response) -> List[Record]:
ivrs = response.json().get("ivrs", [])
records = []
for ivr in ivrs:
for menu in ivr.get("menus", []):
records.append({"ivr_id": ivr["id"], **menu})
return records


@dataclass
class IVRRoutesRecordExtractor(RecordExtractor):
def extract_records(self, response: requests.Response) -> List[Record]:
ivrs = response.json().get("ivrs", [])
records = []
for ivr in ivrs:
for menu in ivr.get("menus", []):
for route in menu.get("routes", []):
records.append({"ivr_id": ivr["id"], "ivr_menu_id": menu["id"], **route})
return records


@dataclass
class ZendeskTalkAuthenticator(DeclarativeAuthenticator):
config: Mapping[str, Any]
legacy_basic_auth: BasicHttpAuthenticator
basic_auth: BasicHttpAuthenticator
oauth: BearerAuthenticator

def __new__(cls, legacy_basic_auth, basic_auth, oauth, config, *args, **kwargs):
credentials = config.get("credentials", {})
if config.get("access_token", {}) and config.get("email", {}):
return legacy_basic_auth
elif credentials["auth_type"] == "api_token":
return basic_auth
elif credentials["auth_type"] == "oauth2.0":
return oauth
else:
raise Exception(f"Missing valid authenticator for auth_type: {credentials['auth_type']}")
Loading

0 comments on commit 0405990

Please sign in to comment.