GoogleSecretManagerResultStatus Status { get; }
Source
Gets the resolution status.
Validates convention mappings against the finalized declaration registry during options startup validation.
Validates AppSurfaceGoogleSecretManagerOptions
before provider lookup.
bool IsValidDeclarationReference(AppSurfaceGoogleSecretManagerOptions options, string key, string? version)
Validates a file declaration locally using the same project/default/latest policy as mappings.
options
key
version
Whether the declaration is structurally valid and satisfies the existing options policy.
The historical mapping validator remains permissive about resource syntax for compatibility. File declarations additionally reject malformed segments locally, including disabled references. Numeric versions and Google version aliases are accepted; latest still requires explicit opt-in in every environment. No resource identity or diagnostic text escapes this method, and no client is constructed.
bool IsProjectSegment(string? value)
Rejects path separators, escaping, whitespace and empty project segments without normalizing ids.
Project ids/numbers and legacy domain-scoped projects are preserved; project existence is remote.
bool IsSecretId(string value)
Checks the Secret Manager secret-id character set and 255-character limit.
bool IsVersionSegment(string? value)
Accepts numeric versions or bounded aliases, preserving case and explicit latest policy.
Alias syntax follows the Secret resource's versionAliases contract
. NEW is reserved. This structural check does not resolve aliases or establish that a numeric version exists.
Describes a typed Google Secret Manager configuration resolution.
T
GoogleSecretManagerConfigResolution<T> Unclaimed()
GoogleSecretManagerConfigResolution<T> Found(T? value, string source)
Creates a found resolution.
value
source
A found resolution.
GoogleSecretManagerConfigResolution<T> Failed(GoogleSecretManagerResultStatus status, ConfigProviderTerminalDiagnostic diagnostic, string source)
Creates a failed claimed-key resolution.
status
diagnostic
source
A failed resolution.
GoogleSecretManagerResultStatus Status { get; }
Source
Gets the resolution status.
T? Value { get; }
Source
Gets the converted value when Status
is GoogleSecretManagerResultStatus.Found
.
ConfigProviderTerminalDiagnostic? Diagnostic { get; }
Source
Gets the display-safe terminal diagnostic when resolution failed for a claimed key.
string? Source { get; }
Source
Gets the provider source name.
Describes a scoped convention resolver for Google Secret Manager mappings.
LogicalKeyPrefix
SecretIdPrefix
Version
Resolves explicitly claimed AppSurface keys from Google Secret Manager.
ConfigProviderValueResult<T> Resolve<T>(ConfigProviderRequest request)
Rechecks the resource claim before publishing a value so a collision discovered during a shared fetch or conversion remains terminal for the pending resolution, including cached values.
T? GetValue<T>(string environment, string key)
Resolves a strict string key through the compatibility surface.
environment
key
GoogleSecretManagerConfigResolution<T> ResolveValue<T>(string environment, string key)
Resolves a strict string key through the compatibility result surface.
environment
key
ConfigProviderAuditResolution ResolveForAudit(ConfigProviderRequest request, Type valueType, ConfigAuditSourceRole role)
Resolves a typed value while returning source provenance for audit.
request
valueType
role
Source provenance identifies the version returned by Google, including when a requested alias resolves to a numeric version or a project ID resolves to a project number. Cached bytes retain that same source name.
IReadOnlyList<ConfigAuditDiagnostic> GetReportDiagnostics(string environment)
Gets provider report diagnostics for the supplied environment.
environment
int Priority { get; }
Source
Gets this provider's precedence.
string Name { get; }
Source
Gets this provider's stable name.
int PublishedFlightCount { get; }
Source
Gets the number of published flights for deterministic retirement tests without exposing resource identities.
Describes one known Google convention identity that needs an explicit migration mapping.
string MapSecretSnippet { get; }
Source
Gets the exact options call that pins the existing legacy secret id.
Computes Google convention migration mappings without accessing Secret Manager.
IReadOnlyList<AppSurfaceGoogleSecretMigrationEntry> Inventory(AppSurfaceGoogleSecretManagerOptions options, IEnumerable<AppSurfaceConfigKey> knownKeys)
Computes mappings for known keys whose old lossy id differs from the new injective id.
IReadOnlyList<AppSurfaceGoogleSecretMigrationEntry> Inventory(AppSurfaceGoogleSecretManagerOptions options, IEnumerable<AppSurfaceConfigKey> knownKeys, string legacyLogicalKeyPrefix, string legacySecretIdPrefix)
Computes migration mappings using caller-supplied raw legacy convention prefixes.
options
knownKeys
legacyLogicalKeyPrefix
string.StartsWith(string, StringComparison)
semantics after keys are scoped to a current convention by segment ancestry.legacySecretIdPrefix
Mappings for keys whose historical normalized id differs from the current encoded id.
ArgumentNullException
knownKeys
is null.ArgumentException
Maps one AppSurface logical configuration key to a Google Secret Manager secret.
LogicalKey
SecretIdOrResourceName
Version
Registers the AppSurface Google Secret Manager configuration provider.
Reads Secret Manager version payloads for the AppSurface Google Secret Manager provider.
AppSurfaceGoogleSecretPayload AccessSecretVersion(string resourceName, TimeSpan timeout)
Accesses one Secret Manager version.
resourceName
timeout
The secret version payload.
Describes a value-safe Google Secret Manager transfer diagnostic.
string ToDisplayString()
Renders the diagnostic for terminal output without secret payloads.
A display-safe diagnostic string.
Describes a value-safe Google Secret Manager probe result.
Status
ResourceName
HasEnabledVersions
Diagnostic
AppSurfaceGoogleSecretProbeResult Ready(string resourceName, bool hasEnabledVersions = false)
Creates a successful probe result.
resourceName
hasEnabledVersions
The successful probe result.
AppSurfaceGoogleSecretProbeResult Failed(GoogleSecretManagerTransferStatus status, string resourceName, AppSurfaceGoogleSecretTransferDiagnostic diagnostic)
Creates a failed probe result.
status
resourceName
diagnostic
The failed probe result.
Describes a value-safe Google Secret Manager write result.
Status
ResourceName
WrittenVersionResourceName
Diagnostic
AppSurfaceGoogleSecretWriteResult Written(string resourceName, string? writtenVersionResourceName)
Creates a successful write result.
resourceName
writtenVersionResourceName
The successful write result.
AppSurfaceGoogleSecretWriteResult Failed(GoogleSecretManagerTransferStatus status, string resourceName, AppSurfaceGoogleSecretTransferDiagnostic diagnostic)
Creates a failed write result.
status
resourceName
diagnostic
The failed write result.
Describes a value-safe Google Secret Manager payload access result.
Status
ResourceName
Payload
Diagnostic
AppSurfaceGoogleSecretAccessResult Accessed(string resourceName, AppSurfaceGoogleSecretPayload payload)
Creates a successful access result.
resourceName
payload
The successful access result.
AppSurfaceGoogleSecretAccessResult Failed(GoogleSecretManagerTransferStatus status, string resourceName, AppSurfaceGoogleSecretTransferDiagnostic diagnostic)
Creates a failed access result.
status
resourceName
diagnostic
The failed access result.
Probes and writes Google Secret Manager resources for explicit AppSurface secret transfer workflows.
This seam is intentionally separate from IAppSurfaceGoogleSecretManagerClient
, which remains the read-only runtime configuration provider client. Implementations must keep diagnostics value-safe and must not create, disable, destroy, rotate, or provision secrets. Version 1 transfer workflows can write an existing Google secret; version 2 workflows use this client only to probe and read a pinned Google version before guarded local materialization.
AppSurfaceGoogleSecretProbeResult ProbeSecret(string secretResourceName, TimeSpan timeout)
Probes one existing Google Secret Manager secret parent.
secretResourceName
projects/.../secrets/...
resource name.timeout
The probe result.
AppSurfaceGoogleSecretProbeResult ProbeSecretVersion(string versionResourceName, TimeSpan timeout)
Probes one existing Google Secret Manager secret version.
versionResourceName
projects/.../secrets/.../versions/...
resource name.timeout
The probe result, whose resource name is the canonical provider response identity.
AppSurfaceGoogleSecretAccessResult AccessSecretVersion(string versionResourceName, TimeSpan timeout)
Accesses one Google Secret Manager version payload for an apply operation.
versionResourceName
timeout
The version payload.
AppSurfaceGoogleSecretWriteResult AddSecretVersion(string secretResourceName, string value, TimeSpan timeout)
Adds a new enabled version to an existing Google Secret Manager secret.
secretResourceName
value
timeout
The write result.
Default transfer client backed by Google Cloud Secret Manager.
GoogleSecretManagerTransferClientAdapter FromCredentialFile(string credentialFilePath)
Creates a transfer client that uses one explicit service-account credential file.
credentialFilePath
A client isolated from ambient Application Default Credentials.
Use this factory for operator-owned transfer profiles only. The caller owns file validation and must never include the path or file contents in diagnostics. Runtime configuration continues to use its existing credential flow.
Configures the AppSurface Google Secret Manager provider.
Keys are claimed explicitly by MapSecret(string, string, string?)
or by an opt-in convention resolver. Claimed keys fail closed by default when Google Secret Manager cannot safely return the value. Environment variables still remain the top AppSurface emergency override because DefaultConfigManager
checks them before normal providers.
AppSurfaceGoogleSecretManagerOptions AllowLatest()
Allows use of the mutable latest
Secret Manager version alias.
The same options instance.
AppSurfaceGoogleSecretManagerOptions MapSecret(string logicalKey, string secretIdOrResourceName, string? version = null)
Maps an AppSurface logical configuration key to a Google Secret Manager secret id or full version resource name.
logicalKey
Stripe:ApiKey
.secretIdOrResourceName
projects/.../secrets/.../versions/...
name.version
DefaultVersion
.The same options instance.
AppSurfaceGoogleSecretManagerOptions MapSecret(AppSurfaceConfigKey logicalKey, string secretIdOrResourceName, string? version = null)
Maps a parsed logical key to a Google Secret Manager resource.
logicalKey
secretIdOrResourceName
projects/.../secrets/.../versions/...
name.version
DefaultVersion
.The same options instance.
ArgumentNullException
logicalKey
is null
.AppSurfaceGoogleSecretManagerOptions EnableConventionResolver(string logicalKeyPrefix, string secretIdPrefix, string? version = null)
Enables a scoped convention resolver for logical keys under logicalKeyPrefix
.
logicalKeyPrefix
secretIdPrefix
version
The same options instance.
AppSurfaceGoogleSecretManagerOptions EnableConventionResolver(AppSurfaceConfigKey logicalKeyPrefix, string secretIdPrefix, string? version = null)
Enables a convention resolver under a parsed logical-key prefix.
logicalKeyPrefix
secretIdPrefix
version
The same options instance.
AppSurfaceGoogleSecretManagerOptions CreateSnapshot()
Copies host settings and registration collections for a single provider's lifetime.
An isolated options instance owned exclusively by the provider.
Mappings and conventions contain only immutable strings. Copying their collections prevents later additions or host-option changes from altering validation, access, or cache identity.
string? ProjectId { get; set; }
Source
Gets or sets the Google Cloud project id used for short secret ids.
string? DefaultVersion { get; set; }
Source
Gets or sets the default secret version used by mappings that do not specify one.
Keep this unset for production unless every mapping supplies its own version or alias. Set AllowLatestVersion
before using latest
; mutable latest is an explicit opt-in, not the silent production default.
bool AllowLatestVersion { get; set; }
Source
Gets or sets a value indicating whether the mutable latest
version alias is allowed.
bool FailClosedOnProviderFailure { get; set; }
Source
Gets or sets a value indicating whether a failed raw whole-root base stops fallback to lower-priority bases.
Applies only when this provider supplies a raw whole-root base for a Secret{T}
root. File-declared scalar references and the logical-key provider contract always report claimed failures.
TimeSpan LookupTimeout { get; set; }
Source
Gets or sets the bounded timeout for one Secret Manager lookup.
TimeSpan? CacheTtl { get; set; }
Source
Gets or sets the optional in-memory cache duration for successful secret values.
Leave unset for strict read-through behavior. When enabled, rotation is visible after this duration or after the app rebuilds the provider. The provider does not run background refresh.
int CacheCapacity { get; set; }
Source
Gets or sets the maximum number of successful payloads retained by the bounded cache.
int MaxAdHocClaims { get; set; }
Source
Gets or sets the maximum number of ad-hoc exact-resource claims retained by this provider.
IReadOnlyList<AppSurfaceGoogleSecretMapping> Mappings { get; }
Source
Gets explicit logical-key to Secret Manager mappings.
IReadOnlyList<AppSurfaceGoogleSecretConvention> Conventions { get; }
Source
Gets opt-in convention resolvers.
Default IAppSurfaceGoogleSecretManagerClient
backed by Google Cloud Secret Manager.
The default constructor creates the Google client lazily so applications that register the provider but do not resolve Google-backed keys avoid opening Secret Manager transport during service registration.
Carries one Google Secret Manager version payload.
Payload bytes are copied when received and whenever returned, so callers cannot mutate provider-owned data. The resolved name is the service response's exact version name. It may differ from the requested name when Google resolves a version alias or a project ID to its numeric identifier. The provider requires this name for source provenance and validates it before publishing or caching the payload.
byte[] Data { get; }
Source
Gets a defensive copy of the raw payload bytes.
string? ResolvedResourceName { get; }
Source
Gets the exact resolved Secret Manager version resource name, if available.
Provides service collection helpers for AppSurface Google Secret Manager.
IServiceCollection ConfigureAppSurfaceGoogleSecretManager(this IServiceCollection services, Action<AppSurfaceGoogleSecretManagerOptions> configure)
Configures Google Secret Manager options.
services
configure
The original service collection.
IServiceCollection UseAppSurfaceGoogleSecretManagerClient<TClient>(this IServiceCollection services)
Replaces the Google Secret Manager client seam.
TClient
services
The original service collection.
IServiceCollection UseAppSurfaceGoogleSecretManagerClient(this IServiceCollection services, IAppSurfaceGoogleSecretManagerClient client)
Replaces the Google Secret Manager client seam with a specific instance.
services
client
The original service collection.
IServiceCollection UseAppSurfaceGoogleSecretTransferClient<TClient>(this IServiceCollection services)
Replaces the Google Secret Manager transfer client seam.
TClient
services
The original service collection.
IServiceCollection UseAppSurfaceGoogleSecretTransferClient(this IServiceCollection services, IAppSurfaceGoogleSecretTransferClient client)
Replaces the Google Secret Manager transfer client seam with a specific instance.
services
client
The original service collection.
Classifies Google Secret Manager configuration resolution outcomes.
Classifies Google Secret Manager transfer operations without exposing payload bytes.