Method: users.environments.addPublicKey

Adds a public SSH key to an environment, allowing clients with the corresponding private key to connect to that environment via SSH. If a key with the same content already exists, this will error with ALREADY_EXISTS.

HTTP request

POST https://cloudshell.googleapis.com/v1/{environment=users/*/environments/*}:addPublicKey

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
environment

string

Environment this key should be added to, e.g. users/me/environments/default.

Request body

The request body contains data with the following structure:

JSON representation
{
  "key": string
}
Fields
key

string

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.

Response body

If successful, the response body contains an instance of Operation.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.