cadrumo.adapters.outbound.google.records module

Pydantic records for the Google OAuth and Drive configuration boundary.

The per-profile Google session persists adapters.outbound.google.records.OAuthClient, adapters.outbound.google.records.OAuthToken, and adapters.outbound.google.records.OAuthMetadata through adapters.outbound.google.session_store. adapters.outbound.google.records.DriveConfig stores the Drive root folder selected for the profile and is read by adapters.outbound.storage.factory.get_storage_provider() when building the Drive backend. adapters.outbound.google.records.DriveAppProperties captures the typed appProperties commit-log schema at the storage boundary. See adapters.outbound.google.impersonation for adapters.outbound.google.impersonation.GoogleCredentialSourceSelection, the per-profile persisted choice of core.google_credential_source.GoogleCredentialSourceKind.

The OAuth scope constants come from core.config.Settings and are bundled as adapters.outbound.google.records.REQUIRED_SCOPES for login, refresh, and validation flows. Every record is frozen, strict, and forbids extra fields.

class OAuthClient(**data)[source]

Bases: BaseModel

Operator-imported Cloud Console Desktop OAuth client metadata.

Carries the JSON the operator downloaded from the Cloud Console after creating a Desktop application OAuth client. adapters.outbound.google.session_store.save_client() stores this record under the SECRET classification because client_secret is a long-lived credential. client_id and project_id can surface in status output for operator orientation.

Parameters:

data (Any)

client_id: str
client_secret: str
project_id: str
auth_uri: str
token_uri: str
auth_provider_x509_cert_url: str
redirect_uris: tuple[str, ...]
class OAuthToken(**data)[source]

Bases: BaseModel

The refresh credential issued by Google for a per-profile login.

adapters.outbound.google.oauth_flow.run_login_flow() returns this record with adapters.outbound.google.records.OAuthMetadata. adapters.outbound.google.session_store.save_token() persists it under the SECRET classification. The refresh token is re-persisted on every successful refresh because Google may rotate it. Access tokens are held in memory only and rebuilt from the refresh token on process start.

Parameters:

data (Any)

refresh_token: str
token_uri: str
class OAuthMetadata(**data)[source]

Bases: BaseModel

Audit fields surfaced by aeat config google status and refresh policy.

This is the non-secret companion record to adapters.outbound.google.records.OAuthToken. adapters.outbound.google.session_store.save_metadata() persists which Google account the operator linked, which adapters.outbound.google.records.REQUIRED_SCOPES the consent screen granted, when the credential was issued, when it was last refreshed, and whether the most recent refresh hit a hard invalid_grant requiring re-consent.

Parameters:

data (Any)

account_email: str
granted_scopes: tuple[str, ...]
issued_at: UtcInstant
last_refresh_at: UtcInstant
reauth_required: bool
class DriveConfig(**data)[source]

Bases: BaseModel

Per-profile Drive backend configuration persisted alongside OAuth records.

adapters.outbound.google.session_store.save_drive_config() persists the operator’s chosen cadrumo-vault/ parent folder id. adapters.outbound.storage.factory.get_storage_provider() reads it after core.config.Settings; the CADRUMO_GOOGLE_DRIVE_ROOT_FOLDER_ID setting remains an override for one-off and CI runs.

Parameters:

data (Any)

root_folder_id: str
class DriveAppProperties(**data)[source]

Bases: BaseModel

Typed appProperties payload used by the Drive storage provider.

Parameters:

data (Any)

ownership_marker: Literal['cadrumo']
namespace: str
object_key_hmac: str
content_hash: str