Skip to content

Commit

Permalink
✨Source Zendesk Support: New Stream - Audit Logs (#26347)
Browse files Browse the repository at this point in the history
* Initial commit

* EOF

* add audit_logs to empty streams and bump number of streams

* docs: make a note that audit logs is only available on enterprise accounts

---------

Co-authored-by: Sajarin <sajarindider@gmail.com>
  • Loading branch information
btkcodedev and sajarin committed May 24, 2023
1 parent e12daa7 commit 5280e3c
Show file tree
Hide file tree
Showing 11 changed files with 210 additions and 85 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ COPY source_zendesk_support ./source_zendesk_support
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=0.2.30
LABEL io.airbyte.version=0.3.0
LABEL io.airbyte.name=airbyte/source-zendesk-support
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,41 @@ test_strictness_level: high
acceptance_tests:
spec:
tests:
- spec_path: "source_zendesk_support/spec.json"
- spec_path: "source_zendesk_support/spec.json"
connection:
tests:
- config_path: "secrets/config.json"
status: "succeed"
- config_path: "secrets/config_oauth.json"
status: "succeed"
- config_path: "integration_tests/invalid_config.json"
status: "failed"
- config_path: "secrets/config.json"
status: "succeed"
- config_path: "secrets/config_oauth.json"
status: "succeed"
- config_path: "integration_tests/invalid_config.json"
status: "failed"
discovery:
tests:
- config_path: "secrets/config.json"
- config_path: "secrets/config_oauth.json"
- config_path: "secrets/config.json"
- config_path: "secrets/config_oauth.json"
basic_read:
tests:
- config_path: "secrets/config.json"
expect_records:
path: "integration_tests/expected_records.jsonl"
extra_fields: no
exact_order: no
extra_records: yes
fail_on_extra_columns: false
- config_path: "secrets/config.json"
expect_records:
path: "integration_tests/expected_records.jsonl"
extra_fields: no
exact_order: no
extra_records: yes
fail_on_extra_columns: false
empty_streams:
# This stream is only available for enterprise accounts https://developer.zendesk.com/api-reference/ticketing/account-configuration/audit_logs/
- name: "audit_logs"
bypass_reason: "no records"
incremental:
tests:
- config_path: "secrets/config.json"
configured_catalog_path: "integration_tests/incremental_catalog.json"
future_state:
future_state_path: "integration_tests/abnormal_state.json"
cursor_paths:
ticket_comments: ["created_at"]
- config_path: "secrets/config.json"
configured_catalog_path: "integration_tests/incremental_catalog.json"
future_state:
future_state_path: "integration_tests/abnormal_state.json"
cursor_paths:
ticket_comments: ["created_at"]
full_refresh:
tests:
- config_path: "secrets/config.json"
configured_catalog_path: "integration_tests/configured_catalog.json"
- config_path: "secrets/config.json"
configured_catalog_path: "integration_tests/configured_catalog.json"
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,12 @@
"stream_state": { "created_at": "2222-07-19T22:21:26Z" },
"stream_descriptor": { "name": "ticket_audits" }
}
},
{
"type": "STREAM",
"stream": {
"stream_state": { "created_at": "2222-07-19T22:21:26Z" },
"stream_descriptor": { "name": "audit_logs" }
}
}
]
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
{
"streams": [
{
"stream": {
"name": "audit_logs",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": true,
"default_cursor_field": ["created_at"],
"source_defined_primary_key": [["id"]]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "append"
},
{
"stream": {
"name": "group_memberships",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
{
"streams": [
{
"stream": {
"name": "audit_logs",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": true,
"default_cursor_field": ["created_at"],
"source_defined_primary_key": [["id"]]
},
"sync_mode": "incremental",
"destination_sync_mode": "append"
},
{
"stream": {
"name": "group_memberships",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ data:
connectorType: source
maxSecondsBetweenMessages: 10800
definitionId: 79c1aa37-dae3-42ae-b333-d1c105477715
dockerImageTag: 0.2.30
dockerImageTag: 0.3.0
dockerRepository: airbyte/source-zendesk-support
githubIssueLabel: source-zendesk-support
icon: zendesk-support.svg
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Audit_logs Schema",
"additionalProperties": true,
"type": ["null", "object"],
"properties": {
"action": {
"type": ["null", "string"]
},
"actor_id": {
"type": ["null", "number"]
},
"actor_name": {
"type": ["null", "string"]
},
"change_description": {
"type": ["null", "string"]
},
"created_at": {
"type": ["null", "string"],
"format": "date-time"
},
"id": {
"type": ["null", "number"]
},
"ip_address": {
"type": ["null", "string"]
},
"source_id": {
"type": ["null", "number"]
},
"source_label": {
"type": ["null", "string"]
},
"source_type": {
"type": ["null", "string"]
},
"url": {
"type": ["null", "string"]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from source_zendesk_support.streams import DATETIME_FORMAT, SourceZendeskException

from .streams import (
AuditLogs,
Brands,
CustomRoles,
GroupMemberships,
Expand Down Expand Up @@ -111,6 +112,7 @@ def streams(self, config: Mapping[str, Any]) -> List[Stream]:
"""
args = self.convert_config2stream_args(config)
streams = [
AuditLogs(**args),
GroupMemberships(**args),
Groups(**args),
Macros(**args),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,15 @@ def parse_response(self, response: requests.Response, **kwargs) -> Iterable[Mapp
yield event


class AuditLogs(SourceZendeskSupportCursorPaginationStream):
"""AuditLogs stream: https://developer.zendesk.com/api-reference/ticketing/account-configuration/audit_logs/#list-audit-logs"""

# can request a maximum of 1,00 results
page_size = 100
# audit_logs doesn't have the 'updated_by' field
cursor_field = "created_at"


class Users(SourceZendeskIncrementalExportStream):
"""Users stream: https://developer.zendesk.com/api-reference/ticketing/ticket-management/incremental_exports/#incremental-user-export"""

Expand Down

0 comments on commit 5280e3c

Please sign in to comment.