diff --git a/airbyte/cloud/workspaces.py b/airbyte/cloud/workspaces.py index e33530aa..a8f2636d 100644 --- a/airbyte/cloud/workspaces.py +++ b/airbyte/cloud/workspaces.py @@ -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( @@ -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,