public sealed class AddPublicKeyRequest : IMessage<AddPublicKeyRequest>, IEquatable<AddPublicKeyRequest>, IDeepCloneable<AddPublicKeyRequest>, IBufferMessage, IMessage
Reference documentation and code samples for the Cloud Shell v1 API class AddPublicKeyRequest.
Request message for
[AddPublicKey][google.cloud.shell.v1.CloudShellService.AddPublicKey].
Key that should be added to the environment. Supported formats are
ssh-dss (see RFC4253), ssh-rsa (see RFC4253), ecdsa-sha2-nistp256
(see RFC5656), ecdsa-sha2-nistp384 (see RFC5656) and
ecdsa-sha2-nistp521 (see RFC5656). It should be structured as
<format> <content>, where <content> part is encoded with
Base64.
[[["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\u003eThe latest version of the \u003ccode\u003eAddPublicKeyRequest\u003c/code\u003e class in the Cloud Shell v1 API is 2.5.0, with documentation available for versions back to 1.0.0.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eAddPublicKeyRequest\u003c/code\u003e class is used to send requests for adding a public key to a Cloud Shell environment.\u003c/p\u003e\n"],["\u003cp\u003eThis class inherits from \u003ccode\u003eobject\u003c/code\u003e and 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.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eAddPublicKeyRequest\u003c/code\u003e class has properties for setting the \u003ccode\u003eEnvironment\u003c/code\u003e (where the key is added) and the \u003ccode\u003eKey\u003c/code\u003e itself, which must be in a supported SSH format.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eAddPublicKeyRequest\u003c/code\u003e has two constructors, one parameterless, and another that allows you to set the values based on a pre-existing \u003ccode\u003eAddPublicKeyRequest\u003c/code\u003e object.\u003c/p\u003e\n"]]],[],null,["# Cloud Shell v1 API - Class AddPublicKeyRequest (2.5.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.5.0 (latest)](/dotnet/docs/reference/Google.Cloud.Shell.V1/latest/Google.Cloud.Shell.V1.AddPublicKeyRequest)\n- [2.4.0](/dotnet/docs/reference/Google.Cloud.Shell.V1/2.4.0/Google.Cloud.Shell.V1.AddPublicKeyRequest)\n- [2.3.0](/dotnet/docs/reference/Google.Cloud.Shell.V1/2.3.0/Google.Cloud.Shell.V1.AddPublicKeyRequest)\n- [2.2.0](/dotnet/docs/reference/Google.Cloud.Shell.V1/2.2.0/Google.Cloud.Shell.V1.AddPublicKeyRequest)\n- [2.1.0](/dotnet/docs/reference/Google.Cloud.Shell.V1/2.1.0/Google.Cloud.Shell.V1.AddPublicKeyRequest)\n- [2.0.0](/dotnet/docs/reference/Google.Cloud.Shell.V1/2.0.0/Google.Cloud.Shell.V1.AddPublicKeyRequest)\n- [1.1.0](/dotnet/docs/reference/Google.Cloud.Shell.V1/1.1.0/Google.Cloud.Shell.V1.AddPublicKeyRequest)\n- [1.0.0](/dotnet/docs/reference/Google.Cloud.Shell.V1/1.0.0/Google.Cloud.Shell.V1.AddPublicKeyRequest) \n\n public sealed class AddPublicKeyRequest : IMessage\u003cAddPublicKeyRequest\u003e, IEquatable\u003cAddPublicKeyRequest\u003e, IDeepCloneable\u003cAddPublicKeyRequest\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Cloud Shell v1 API class AddPublicKeyRequest.\n\nRequest message for\n\\[AddPublicKey\\]\\[google.cloud.shell.v1.CloudShellService.AddPublicKey\\]. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e AddPublicKeyRequest \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[AddPublicKeyRequest](/dotnet/docs/reference/Google.Cloud.Shell.V1/latest/Google.Cloud.Shell.V1.AddPublicKeyRequest), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[AddPublicKeyRequest](/dotnet/docs/reference/Google.Cloud.Shell.V1/latest/Google.Cloud.Shell.V1.AddPublicKeyRequest), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[AddPublicKeyRequest](/dotnet/docs/reference/Google.Cloud.Shell.V1/latest/Google.Cloud.Shell.V1.AddPublicKeyRequest), [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.Shell.V1](/dotnet/docs/reference/Google.Cloud.Shell.V1/latest/Google.Cloud.Shell.V1)\n\nAssembly\n--------\n\nGoogle.Cloud.Shell.V1.dll\n\nConstructors\n------------\n\n### AddPublicKeyRequest()\n\n public AddPublicKeyRequest()\n\n### AddPublicKeyRequest(AddPublicKeyRequest)\n\n public AddPublicKeyRequest(AddPublicKeyRequest other)\n\nProperties\n----------\n\n### Environment\n\n public string Environment { get; set; }\n\nEnvironment this key should be added to, e.g.\n`users/me/environments/default`.\n\n### Key\n\n public string Key { get; set; }\n\nKey that should be added to the environment. Supported formats are\n`ssh-dss` (see RFC4253), `ssh-rsa` (see RFC4253), `ecdsa-sha2-nistp256`\n(see RFC5656), `ecdsa-sha2-nistp384` (see RFC5656) and\n`ecdsa-sha2-nistp521` (see RFC5656). It should be structured as\n\\<format\\> \\<content\\>, where \\<content\\> part is encoded with\nBase64."]]