Skip to content

Commit

Permalink
feat: add missing get_*() methods
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronsteers committed Dec 16, 2024
1 parent f89b6a2 commit 7378bf4
Showing 1 changed file with 44 additions and 14 deletions.
58 changes: 44 additions & 14 deletions airbyte/cloud/workspaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,50 @@ def connect(self) -> None:
)
print(f"Successfully connected to workspace: {self.workspace_url}")

# Get sources, destinations, and connections

def get_connection(
self,
connection_id: str,
) -> CloudConnection:
"""Get a connection by ID.
This method does not fetch data from the API. It returns a `CloudConnection` object,
which will be loaded lazily as needed.
"""
return CloudConnection(
workspace=self,
connection_id=connection_id,
)

def get_source(
self,
source_id: str,
) -> CloudSource:
"""Get a source by ID.
This method does not fetch data from the API. It returns a `CloudSource` object,
which will be loaded lazily as needed.
"""
return CloudSource(
workspace=self,
connector_id=source_id,
)

def get_destination(
self,
destination_id: str,
) -> CloudDestination:
"""Get a destination by ID.
This method does not fetch data from the API. It returns a `CloudDestination` object,
which will be loaded lazily as needed.
"""
return CloudDestination(
workspace=self,
connector_id=destination_id,
)

# Deploy sources and destinations

def deploy_source(
Expand Down Expand Up @@ -293,20 +337,6 @@ def deploy_connection(
destination=deployed_connection.destination_id,
)

def get_connection(
self,
connection_id: str,
) -> CloudConnection:
"""Get a connection by ID.
This method does not fetch data from the API. It returns a `CloudConnection` object,
which will be loaded lazily as needed.
"""
return CloudConnection(
workspace=self,
connection_id=connection_id,
)

def permanently_delete_connection(
self,
connection: str | CloudConnection,
Expand Down

0 comments on commit 7378bf4

Please sign in to comment.