public sealed class CreateSecretRequest : IMessage<CreateSecretRequest>, IEquatable<CreateSecretRequest>, IDeepCloneable<CreateSecretRequest>, IBufferMessage, IMessage
Reference documentation and code samples for the Secret Manager v1beta2 API class CreateSecretRequest.
Request message for
[SecretManagerService.CreateSecret][google.cloud.secretmanager.v1beta2.SecretManagerService.CreateSecret].
Required. The resource name of the project to associate with the
[Secret][google.cloud.secretmanager.v1beta2.Secret], in the format
projects/* or projects/*/locations/*.
A secret ID is a string with a maximum length of 255 characters and can
contain uppercase and lowercase letters, numerals, and the hyphen (-) and
underscore (_) characters.
[[["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-08-07 UTC."],[[["\u003cp\u003eThis documentation details the \u003ccode\u003eCreateSecretRequest\u003c/code\u003e class within the Secret Manager v1beta2 API, version 1.0.0-beta03.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eCreateSecretRequest\u003c/code\u003e is a request message used by \u003ccode\u003eSecretManagerService.CreateSecret\u003c/code\u003e for creating a secret.\u003c/p\u003e\n"],["\u003cp\u003eThe class implements several interfaces including \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and \u003ccode\u003eIBufferMessage\u003c/code\u003e, and inherits from \u003ccode\u003eobject\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eKey properties of \u003ccode\u003eCreateSecretRequest\u003c/code\u003e include \u003ccode\u003eParent\u003c/code\u003e, which specifies the project or location, \u003ccode\u003eSecret\u003c/code\u003e which has the initial field values, and \u003ccode\u003eSecretId\u003c/code\u003e which is a unique identifier for the secret within the project.\u003c/p\u003e\n"],["\u003cp\u003eIt provides multiple constructors for creating an instance of the \u003ccode\u003eCreateSecretRequest\u003c/code\u003e either from default or from an existing \u003ccode\u003eCreateSecretRequest\u003c/code\u003e object.\u003c/p\u003e\n"]]],[],null,["# Secret Manager v1beta2 API - Class CreateSecretRequest (1.0.0-beta03)\n\nVersion latestkeyboard_arrow_down\n\n- [1.0.0-beta03 (latest)](/dotnet/docs/reference/Google.Cloud.SecretManager.V1Beta2/latest/Google.Cloud.SecretManager.V1Beta2.CreateSecretRequest)\n- [1.0.0-beta02](/dotnet/docs/reference/Google.Cloud.SecretManager.V1Beta2/1.0.0-beta02/Google.Cloud.SecretManager.V1Beta2.CreateSecretRequest) \n\n public sealed class CreateSecretRequest : IMessage\u003cCreateSecretRequest\u003e, IEquatable\u003cCreateSecretRequest\u003e, IDeepCloneable\u003cCreateSecretRequest\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Secret Manager v1beta2 API class CreateSecretRequest.\n\nRequest message for\n\\[SecretManagerService.CreateSecret\\]\\[google.cloud.secretmanager.v1beta2.SecretManagerService.CreateSecret\\]. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e CreateSecretRequest \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[CreateSecretRequest](/dotnet/docs/reference/Google.Cloud.SecretManager.V1Beta2/latest/Google.Cloud.SecretManager.V1Beta2.CreateSecretRequest), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[CreateSecretRequest](/dotnet/docs/reference/Google.Cloud.SecretManager.V1Beta2/latest/Google.Cloud.SecretManager.V1Beta2.CreateSecretRequest), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[CreateSecretRequest](/dotnet/docs/reference/Google.Cloud.SecretManager.V1Beta2/latest/Google.Cloud.SecretManager.V1Beta2.CreateSecretRequest), [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.SecretManager.V1Beta2](/dotnet/docs/reference/Google.Cloud.SecretManager.V1Beta2/latest/Google.Cloud.SecretManager.V1Beta2)\n\nAssembly\n--------\n\nGoogle.Cloud.SecretManager.V1Beta2.dll\n\nConstructors\n------------\n\n### CreateSecretRequest()\n\n public CreateSecretRequest()\n\n### CreateSecretRequest(CreateSecretRequest)\n\n public CreateSecretRequest(CreateSecretRequest other)\n\nProperties\n----------\n\n### Parent\n\n public string Parent { get; set; }\n\nRequired. The resource name of the project to associate with the\n\\[Secret\\]\\[google.cloud.secretmanager.v1beta2.Secret\\], in the format\n`projects/*` or `projects/*/locations/*`.\n\n### ParentAsLocationName\n\n public LocationName ParentAsLocationName { get; set; }\n\n[LocationName](https://github.com/googleapis/gax-dotnet/blob/83f42b5edc4529818dbdb34d9ea9ecc3c04f7b6e/Google.Api.Gax/ResourceNames/LocationName.cs)-typed view over the [Parent](/dotnet/docs/reference/Google.Cloud.SecretManager.V1Beta2/latest/Google.Cloud.SecretManager.V1Beta2.CreateSecretRequest#Google_Cloud_SecretManager_V1Beta2_CreateSecretRequest_Parent) resource name property.\n\n### ParentAsProjectName\n\n public ProjectName ParentAsProjectName { get; set; }\n\n[ProjectName](https://github.com/googleapis/gax-dotnet/blob/83f42b5edc4529818dbdb34d9ea9ecc3c04f7b6e/Google.Api.Gax/ResourceNames/ProjectName.cs)-typed view over the [Parent](/dotnet/docs/reference/Google.Cloud.SecretManager.V1Beta2/latest/Google.Cloud.SecretManager.V1Beta2.CreateSecretRequest#Google_Cloud_SecretManager_V1Beta2_CreateSecretRequest_Parent) resource name property.\n\n### ParentAsResourceName\n\n public IResourceName ParentAsResourceName { get; set; }\n\n[IResourceName](https://github.com/googleapis/gax-dotnet/blob/83f42b5edc4529818dbdb34d9ea9ecc3c04f7b6e/Google.Api.Gax/IResourceName.cs)-typed view over the [Parent](/dotnet/docs/reference/Google.Cloud.SecretManager.V1Beta2/latest/Google.Cloud.SecretManager.V1Beta2.CreateSecretRequest#Google_Cloud_SecretManager_V1Beta2_CreateSecretRequest_Parent) resource name property.\n\n### Secret\n\n public Secret Secret { get; set; }\n\nRequired. A \\[Secret\\]\\[google.cloud.secretmanager.v1beta2.Secret\\] with\ninitial field values.\n\n### SecretId\n\n public string SecretId { get; set; }\n\nRequired. This must be unique within the project.\n\nA secret ID is a string with a maximum length of 255 characters and can\ncontain uppercase and lowercase letters, numerals, and the hyphen (`-`) and\nunderscore (`_`) characters."]]