public sealed class SecretVolume : IMessage<SecretVolume>, IEquatable<SecretVolume>, IDeepCloneable<SecretVolume>, IBufferMessage, IMessage
Reference documentation and code samples for the Cloud Functions v2 API class SecretVolume.
Configuration for a secret volume. It has the information necessary to fetch
the secret value from secret manager and make it available as files mounted
at the requested paths within the application container.
The path within the container to mount the secret volume. For example,
setting the mount_path as /etc/secrets would mount the secret value files
under the /etc/secrets directory. This directory will also be completely
shadowed and unavailable to mount any other secrets.
Recommended mount path: /etc/secrets
Project identifier (preferably project number but can also be the project
ID) of the project that contains the secret. If not set, it is
assumed that the secret is in the same project as the function.
public RepeatedField<SecretVolume.Types.SecretVersion> Versions { get; }
List of secret versions to mount for this secret. If empty, the latest
version of the secret will be made available in a file named after the
secret under the mount point.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-09 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eSecretVolume\u003c/code\u003e class in the Google Cloud Functions v2 API allows for mounting secret values from Secret Manager into application containers.\u003c/p\u003e\n"],["\u003cp\u003eIt supports fetching secret values and making them accessible as files within the container, at a specified \u003ccode\u003eMountPath\u003c/code\u003e, such as \u003ccode\u003e/etc/secrets\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe class allows you to set a specific \u003ccode\u003eProjectId\u003c/code\u003e for the secret, defaulting to the function's project if not specified.\u003c/p\u003e\n"],["\u003cp\u003eYou can select a secret from the secret manager using the \u003ccode\u003eSecret\u003c/code\u003e property, or list specific secret \u003ccode\u003eVersions\u003c/code\u003e to mount.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version of the Google Cloud Functions v2 API is 1.7.0, with several previous versions also available for use and documentation.\u003c/p\u003e\n"]]],[],null,["# Cloud Functions v2 API - Class SecretVolume (1.7.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.7.0 (latest)](/dotnet/docs/reference/Google.Cloud.Functions.V2/latest/Google.Cloud.Functions.V2.SecretVolume)\n- [1.6.0](/dotnet/docs/reference/Google.Cloud.Functions.V2/1.6.0/Google.Cloud.Functions.V2.SecretVolume)\n- [1.5.0](/dotnet/docs/reference/Google.Cloud.Functions.V2/1.5.0/Google.Cloud.Functions.V2.SecretVolume)\n- [1.4.0](/dotnet/docs/reference/Google.Cloud.Functions.V2/1.4.0/Google.Cloud.Functions.V2.SecretVolume)\n- [1.3.0](/dotnet/docs/reference/Google.Cloud.Functions.V2/1.3.0/Google.Cloud.Functions.V2.SecretVolume)\n- [1.2.0](/dotnet/docs/reference/Google.Cloud.Functions.V2/1.2.0/Google.Cloud.Functions.V2.SecretVolume)\n- [1.1.0](/dotnet/docs/reference/Google.Cloud.Functions.V2/1.1.0/Google.Cloud.Functions.V2.SecretVolume)\n- [1.0.0](/dotnet/docs/reference/Google.Cloud.Functions.V2/1.0.0/Google.Cloud.Functions.V2.SecretVolume) \n\n public sealed class SecretVolume : IMessage\u003cSecretVolume\u003e, IEquatable\u003cSecretVolume\u003e, IDeepCloneable\u003cSecretVolume\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Cloud Functions v2 API class SecretVolume.\n\nConfiguration for a secret volume. It has the information necessary to fetch\nthe secret value from secret manager and make it available as files mounted\nat the requested paths within the application container. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e SecretVolume \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[SecretVolume](/dotnet/docs/reference/Google.Cloud.Functions.V2/latest/Google.Cloud.Functions.V2.SecretVolume), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[SecretVolume](/dotnet/docs/reference/Google.Cloud.Functions.V2/latest/Google.Cloud.Functions.V2.SecretVolume), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[SecretVolume](/dotnet/docs/reference/Google.Cloud.Functions.V2/latest/Google.Cloud.Functions.V2.SecretVolume), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.Functions.V2](/dotnet/docs/reference/Google.Cloud.Functions.V2/latest/Google.Cloud.Functions.V2)\n\nAssembly\n--------\n\nGoogle.Cloud.Functions.V2.dll\n\nConstructors\n------------\n\n### SecretVolume()\n\n public SecretVolume()\n\n### SecretVolume(SecretVolume)\n\n public SecretVolume(SecretVolume other)\n\nProperties\n----------\n\n### MountPath\n\n public string MountPath { get; set; }\n\nThe path within the container to mount the secret volume. For example,\nsetting the mount_path as `/etc/secrets` would mount the secret value files\nunder the `/etc/secrets` directory. This directory will also be completely\nshadowed and unavailable to mount any other secrets.\nRecommended mount path: /etc/secrets\n\n### ProjectId\n\n public string ProjectId { get; set; }\n\nProject identifier (preferably project number but can also be the project\nID) of the project that contains the secret. If not set, it is\nassumed that the secret is in the same project as the function.\n\n### Secret\n\n public string Secret { get; set; }\n\nName of the secret in secret manager (not the full resource name).\n\n### Versions\n\n public RepeatedField\u003cSecretVolume.Types.SecretVersion\u003e Versions { get; }\n\nList of secret versions to mount for this secret. If empty, the `latest`\nversion of the secret will be made available in a file named after the\nsecret under the mount point."]]