0
# Main Connector Interface
1
2
The primary interface for the Airbyte source connector, providing entry points and connector lifecycle management. This module contains the main classes and functions needed to run the Google Directory connector as an Airbyte source.
3
4
## Capabilities
5
6
### Source Connector Class
7
8
The main connector class that extends Airbyte's BaseSource to provide Google Directory-specific functionality.
9
10
```python { .api }
11
class SourceGoogleDirectory(BaseSource):
12
"""
13
Main connector class for Google Directory integration.
14
15
This class extends the Airbyte CDK BaseSource and configures
16
the connector to use the Google Directory Client.
17
"""
18
client_class = Client
19
```
20
21
### Entry Point Function
22
23
The main entry point for running the connector from command line or programmatically.
24
25
```python { .api }
26
def run():
27
"""
28
Main entry point function that launches the connector.
29
30
Creates a SourceGoogleDirectory instance and launches it using
31
the Airbyte CDK entrypoint with command-line arguments.
32
"""
33
```
34
35
## Usage Examples
36
37
### Basic Connector Usage
38
39
```python
40
from source_google_directory import SourceGoogleDirectory
41
42
# Create connector instance
43
source = SourceGoogleDirectory()
44
45
# The connector can be used with Airbyte's launch function
46
from airbyte_cdk.entrypoint import launch
47
import sys
48
49
launch(source, sys.argv[1:])
50
```
51
52
### Command-Line Entry Point
53
54
```python
55
from source_google_directory.run import run
56
57
# Run connector with command-line arguments
58
run()
59
```
60
61
This will process command-line arguments and execute the appropriate connector operations (spec, check, discover, read).
62
63
### Direct Import Usage
64
65
```python
66
# Direct import of the main class
67
from source_google_directory import SourceGoogleDirectory
68
69
# This import works because __all__ = ["SourceGoogleDirectory"] in __init__.py
70
source = SourceGoogleDirectory()
71
```
72
73
## Integration with Airbyte Framework
74
75
The connector integrates with the Airbyte framework through:
76
77
- **BaseSource inheritance**: Provides standard Airbyte source interface
78
- **Client class configuration**: Uses the Google Directory-specific Client
79
- **Airbyte CDK launch**: Standard Airbyte connector lifecycle management
80
- **Command-line interface**: Standard Airbyte connector command structure
81
82
The connector responds to standard Airbyte commands:
83
- `spec`: Returns connection specification
84
- `check`: Validates connection configuration
85
- `discover`: Returns available streams (users, groups, group_members)
86
- `read`: Extracts data from Google Directory API