11# Copyright (c) 2025 Airbyte, Inc., all rights reserved.
2- """Secret management commands."""
2+ """Secret management commands.
3+
4+ This module provides commands for managing secrets for Airbyte connectors.
5+
6+ Usage:
7+ airbyte-cdk secrets fetch --connector-name source-github
8+ airbyte-cdk secrets fetch --connector-directory /path/to/connector
9+ airbyte-cdk secrets fetch # Run from within a connector directory
10+
11+ The 'fetch' command retrieves secrets from Google Secret Manager based on connector
12+ labels and writes them to the connector's secrets directory.
13+ """
314
415import json
516import os
1627
1728@click .group (name = "secrets" )
1829def secrets_cli_group () -> None :
19- """Secret management commands."""
30+ """Secret management commands.
31+
32+ This module provides commands for managing secrets for Airbyte connectors.
33+
34+ Usage:
35+ airbyte-cdk secrets fetch --connector-name source-github
36+ airbyte-cdk secrets fetch --connector-directory /path/to/connector
37+ airbyte-cdk secrets fetch # Run from within a connector directory
38+
39+ The 'fetch' command retrieves secrets from Google Secret Manager based on connector
40+ labels and writes them to the connector's secrets directory.
41+ """
2042 pass
2143
2244
@@ -32,15 +54,15 @@ def secrets_cli_group() -> None:
3254 help = "Path to the connector directory." ,
3355)
3456@click .option (
35- "--project" ,
57+ "--gcp- project-id " ,
3658 type = str ,
3759 default = AIRBYTE_INTERNAL_GCP_PROJECT ,
3860 help = f"GCP project ID. Defaults to '{ AIRBYTE_INTERNAL_GCP_PROJECT } '." ,
3961)
4062def fetch (
4163 connector_name : Optional [str ] = None ,
4264 connector_directory : Optional [Path ] = None ,
43- project : str = AIRBYTE_INTERNAL_GCP_PROJECT ,
65+ gcp_project_id : str = AIRBYTE_INTERNAL_GCP_PROJECT ,
4466) -> None :
4567 """Fetch secrets for a connector from Google Secret Manager.
4668
@@ -56,7 +78,7 @@ def fetch(
5678 except ImportError :
5779 raise ImportError (
5880 "google-cloud-secret-manager package is required for Secret Manager integration. "
59- "Install it with 'pip install google-cloud-secret-manager'."
81+ "Install it with 'pip install airbyte-cdk[dev]' or 'pip install google-cloud-secret-manager'."
6082 )
6183
6284 click .echo ("Fetching secrets..." )
@@ -98,7 +120,7 @@ def fetch(
98120 )
99121
100122 # List all secrets with the connector label
101- parent = f"projects/{ project } "
123+ parent = f"projects/{ gcp_project_id } "
102124 filter_string = f"labels.{ CONNECTOR_LABEL } ={ connector_name } "
103125 secrets = client .list_secrets (
104126 request = secretmanager .ListSecretsRequest (
0 commit comments