BitwardenSecretManagerExtensions
Classstaticnet10.0
Extension methods for adding Bitwarden Secrets Manager resources.
namespace Aspire.Hosting;
public static class BitwardenSecretManagerExtensions{ // ...}26 members
Methods26
Section titled MethodsAddBitwardenSecretManager(IDistributedApplicationBuilder, string, IResourceBuilder<ParameterResource>, IResourceBuilder<ParameterResource>, IResourceBuilder<ParameterResource>)extensionats exportIResourceBuilder<BitwardenSecretManagerResource> Adds a Bitwarden Secrets Manager resource. The
projectNameOrId parameter resolves to either a project name (creates or finds by name) or a project identifier GUID (adopts the existing project by ID). AddSecret(IResourceBuilder<BitwardenSecretManagerResource>, string)extensionats exportIResourceBuilder<BitwardenSecretResource> Adds a managed Bitwarden secret whose local and remote names are the same. The secret value is resolved from configuration key
Parameters:{parentName}-{name}. AddSecret(IResourceBuilder<BitwardenSecretManagerResource>, string, string)extensionats exportIResourceBuilder<BitwardenSecretResource> Adds a managed Bitwarden secret with distinct Aspire and remote names. The secret value is resolved from configuration key
Parameters:{parentName}-{name}. AsSecretId(IResourceBuilder<BitwardenSecretResource>)extensionats exportIExpressionValue Returns an
ApplicationModel.IExpressionValue that resolves to the Bitwarden secret identifier. Pass it to WithEnvironment to inject the secret ID as an environment variable. The app then uses the Bitwarden SDK to fetch the secret value at runtime. GetSecret(IResourceBuilder<BitwardenSecretManagerResource>, string)extensionats exportIResourceBuilder<BitwardenSecretResource> Gets or creates a Bitwarden secret reference whose Aspire and remote names are the same. The secret must already exist in Bitwarden; use
BitwardenSecretManagerExtensions.AddSecret if Aspire should own and write the secret value. GetSecret(IResourceBuilder<BitwardenSecretManagerResource>, string, string)extensionats exportIResourceBuilder<BitwardenSecretResource> Gets or creates a Bitwarden secret reference with distinct Aspire and remote names. The secret must already exist in Bitwarden; use
BitwardenSecretManagerExtensions.AddSecret if Aspire should own and write the secret value. GetSecret(IResourceBuilder<BitwardenSecretManagerResource>, string, Guid)extensionats exportIResourceBuilder<BitwardenSecretResource> Gets or creates a Bitwarden secret reference by secret identifier. Use this when multiple secrets share the same name and the identifier is the only unambiguous key. The secret must already exist in Bitwarden; use
BitwardenSecretManagerExtensions.AddSecret if Aspire should own and write the secret value. WithApiUrl(IResourceBuilder<BitwardenSecretManagerResource>, string)extensionats exportIResourceBuilder<BitwardenSecretManagerResource> Overrides the Bitwarden API URL.
WithApiUrl(IResourceBuilder<BitwardenSecretManagerResource>, IResourceBuilder<ParameterResource>)extensionats exportIResourceBuilder<BitwardenSecretManagerResource> Overrides the Bitwarden API URL using a parameter.
WithApiUrl(IResourceBuilder<BitwardenSecretManagerResource>, IResourceBuilder<ExternalServiceResource>)extensionats exportIResourceBuilder<BitwardenSecretManagerResource> Overrides the Bitwarden API URL using an external service resource. The Bitwarden resource will wait for the external service before authenticating.
WithApiUrl(IResourceBuilder<BitwardenSecretManagerResource>, EndpointReference)extensionats ignoredIResourceBuilder<BitwardenSecretManagerResource> Overrides the Bitwarden API URL using an endpoint from another resource in the Aspire model.
WithAuthCacheDirectory(IResourceBuilder<BitwardenSecretManagerResource>, string)extensionats exportIResourceBuilder<BitwardenSecretManagerResource> Overrides the AppHost auth cache directory (Bitwarden SDK auth session used by the AppHost reconciler). Defaults to the Aspire store when not set. Override to reuse a cached auth session across CI runs. To configure the auth cache directory inside the deployed app, use
BitwardenSecretManagerExtensions.WithBitwardenAuthCacheDirectory. WithBitwardenAccessToken(IResourceBuilder<TDestination>, IResourceBuilder<BitwardenSecretManagerResource>, IResourceBuilder<ParameterResource>)extensionats exportIResourceBuilder<TDestination> Overrides the Bitwarden access token injected into the connection for
source. By default the management token is used. Supply a least-privilege read-only token here. WithBitwardenAccessToken(IResourceBuilder<TDestination>, string, IResourceBuilder<ParameterResource>)extensionats ignoredIResourceBuilder<TDestination> Overrides the Bitwarden access token injected into the specified connection. By default the management token is used. Supply a least-privilege read-only token here. Use the source-based overload when the connection name equals the Bitwarden resource name.
WithBitwardenAuthCacheDirectory(IResourceBuilder<TDestination>, IResourceBuilder<BitwardenSecretManagerResource>, string)extensionats exportIResourceBuilder<TDestination> Configures the directory where the Bitwarden SDK stores its auth cache inside the resource, for the connection associated with
source. WithBitwardenAuthCacheDirectory(IResourceBuilder<TDestination>, string, string)extensionats ignoredIResourceBuilder<TDestination> Configures the directory where the Bitwarden SDK stores its auth cache inside the resource, for the specified connection. Use the source-based overload when the connection name equals the Bitwarden resource name.
WithBitwardenAuthCacheDirectory(IResourceBuilder<TDestination>, IResourceBuilder<BitwardenSecretManagerResource>, IResourceBuilder<ParameterResource>)extensionats exportIResourceBuilder<TDestination> Configures the directory where the Bitwarden SDK stores its auth cache inside the resource, using a parameter, for the connection associated with
source. WithBitwardenAuthCacheDirectory(IResourceBuilder<TDestination>, string, IResourceBuilder<ParameterResource>)extensionats ignoredIResourceBuilder<TDestination> Configures the directory where the Bitwarden SDK stores its auth cache inside the resource, using a parameter, for the specified connection. Use the source-based overload when the connection name equals the Bitwarden resource name.
WithBitwardenAuthCacheVolume(IResourceBuilder<TDestination>, IResourceBuilder<BitwardenSecretManagerResource>, string?, string)extensionats exportIResourceBuilder<TDestination> Mounts a named volume and configures the Bitwarden SDK to store its auth cache there, for the connection associated with
source. Use this for container resources. For process resources or when the container path is already known, use BitwardenSecretManagerExtensions.WithBitwardenAuthCacheDirectory instead. WithBitwardenAuthCacheVolume(IResourceBuilder<TDestination>, string, string?, string)extensionats ignoredIResourceBuilder<TDestination> Mounts a named volume and configures the Bitwarden SDK to store its auth cache there, for the specified connection. Use this for container resources. Use the source-based overload when the connection name equals the Bitwarden resource name.
WithCacheFile(IResourceBuilder<BitwardenSecretManagerResource>, string)extensionats exportIResourceBuilder<BitwardenSecretManagerResource> Overrides the AppHost cache file path (integration bookkeeping: Bitwarden project ID, secret ID mappings). Defaults to
.bitwarden/{resourceName}.{environment}.json relative to the AppHost directory. Override to share the cache across multiple AppHost projects, or to store it in a CI cache directory. WithIdentityUrl(IResourceBuilder<BitwardenSecretManagerResource>, string)extensionats exportIResourceBuilder<BitwardenSecretManagerResource> Overrides the Bitwarden identity URL.
WithIdentityUrl(IResourceBuilder<BitwardenSecretManagerResource>, IResourceBuilder<ParameterResource>)extensionats exportIResourceBuilder<BitwardenSecretManagerResource> Overrides the Bitwarden identity URL using a parameter.
WithIdentityUrl(IResourceBuilder<BitwardenSecretManagerResource>, IResourceBuilder<ExternalServiceResource>)extensionats exportIResourceBuilder<BitwardenSecretManagerResource> Overrides the Bitwarden identity URL using an external service resource. The Bitwarden resource will wait for the external service before authenticating.
WithIdentityUrl(IResourceBuilder<BitwardenSecretManagerResource>, EndpointReference)extensionats ignoredIResourceBuilder<BitwardenSecretManagerResource> Overrides the Bitwarden identity URL using an endpoint from another resource in the Aspire model.
WithReference(IResourceBuilder<TDestination>, IResourceBuilder<BitwardenSecretManagerResource>, string?)extensionats exportIResourceBuilder<TDestination> Injects structured Bitwarden client configuration into the destination resource.