Skip to content

vendor_connectors.secrets

Secrets Connector - Enterprise-grade secret synchronization.

This connector provides Python bindings for secretssync, enabling enterprise-grade secret synchronization from HashiCorp Vault to AWS Secrets Manager with two-phase architecture, inheritance, versioning, and CI/CD integration.

The connector can operate in two modes:

  1. Native mode: Uses gopy-generated Python bindings for maximum performance
  2. CLI mode: Falls back to subprocess calls if bindings aren’t available

Example usage: from vendor_connectors.secrets import SecretsConnector

# Initialize connector
connector = SecretsConnector()
# Validate a configuration
is_valid, message = connector.validate_config("pipeline.yaml")
# Run a dry-run to see what would change
result = connector.dry_run("pipeline.yaml")
print(f"Would sync {result.secrets_processed} secrets")
# Execute the full pipeline
result = connector.run_pipeline("pipeline.yaml")
if result.success:
print(f"Synced {result.secrets_added} secrets")
SyncOperationPipeline operation types.
OutputFormatOutput format for diff display.
SyncOptionsOptions for pipeline execution.
SyncResultResult of a sync operation.
ConfigInfoInformation about a pipeline configuration.
SecretsConnectorEnterprise-grade secret synchronization connector.
_NATIVE_AVAILABLE

vendor_connectors.secrets._NATIVE_AVAILABLE

Section titled “vendor_connectors.secrets._NATIVE_AVAILABLE”

False

class vendor_connectors.secrets.SyncOperation

Section titled “class vendor_connectors.secrets.SyncOperation”

Bases: str, enum.Enum

Pipeline operation types.

Initialize self. See help(type(self)) for accurate signature.

‘merge’

‘sync’

‘pipeline’

class vendor_connectors.secrets.OutputFormat

Section titled “class vendor_connectors.secrets.OutputFormat”

Bases: str, enum.Enum

Output format for diff display.

Initialize self. See help(type(self)) for accurate signature.

‘human’

‘json’

‘github’

‘compact’

‘side-by-side’

class vendor_connectors.secrets.SyncOptions

Section titled “class vendor_connectors.secrets.SyncOptions”

Options for pipeline execution.

False

None

‘field(…)’

False

4

False

None

class vendor_connectors.secrets.SyncResult

Section titled “class vendor_connectors.secrets.SyncResult”

Result of a sync operation.

False

0

0

0

0

0

0

0

Create from native gopy result.

Create from CLI JSON output.

class vendor_connectors.secrets.ConfigInfo

Section titled “class vendor_connectors.secrets.ConfigInfo”

Information about a pipeline configuration.

False

0

0

‘field(…)’

‘field(…)’

False

Create from native gopy result.

class vendor_connectors.secrets.SecretsConnector(cli_path: str | None = None, prefer_native: bool = True, logger: lifecyclelogging.Logging | None = None, **kwargs)

Section titled “class vendor_connectors.secrets.SecretsConnector(cli_path: str | None = None, prefer_native: bool = True, logger: lifecyclelogging.Logging | None = None, **kwargs)”

Bases: vendor_connectors.base.VendorConnectorBase

Enterprise-grade secret synchronization connector.

This connector wraps the secretssync Go library, providing Python bindings for enterprise-grade secret synchronization between HashiCorp Vault and AWS Secrets Manager.

Features:

  • Two-phase pipeline architecture (merge → sync)
  • Secret inheritance and deep merging
  • AWS Organizations discovery
  • Dry-run with visual diff output
  • CI/CD integration with exit codes

The connector operates in two modes:

  1. Native mode: Uses gopy-generated bindings (faster)
  2. CLI mode: Falls back to subprocess if bindings unavailable

Initialize the secrets connector.

Args: cli_path: Path to secretsync CLI binary (for CLI mode) prefer_native: Prefer native bindings over CLI logger: Logger instance **kwargs: Passed to VendorConnectorBase

Find the secretsync CLI binary.

Check if native bindings are available.

Check if CLI is available.

Validate a pipeline configuration file.

Args: config_path: Path to YAML configuration file

Returns: Tuple of (is_valid, message)

Validate config via CLI.

Get detailed information about a configuration.

Args: config_path: Path to YAML configuration file

Returns: ConfigInfo with configuration details

Get config info via CLI.

Execute the secrets synchronization pipeline.

Args: config_path: Path to YAML configuration file options: Execution options (defaults to full pipeline)

Returns: SyncResult with operation details

Run pipeline via native bindings.

Run pipeline via CLI.

Perform a dry run of the pipeline.

Args: config_path: Path to YAML configuration file

Returns: SyncResult with what would be changed

Run only the merge phase of the pipeline.

Args: config_path: Path to YAML configuration file dry_run: If True, don’t make actual changes

Returns: SyncResult with merge operation details

Run only the sync phase of the pipeline.

Args: config_path: Path to YAML configuration file dry_run: If True, don’t make actual changes

Returns: SyncResult with sync operation details

Get the list of targets from a configuration.

Args: config_path: Path to YAML configuration file

Returns: Tuple of (targets, error_message)

Get the list of sources from a configuration.

Args: config_path: Path to YAML configuration file

Returns: Tuple of (sources, error_message)