# Cloud Shell API . users . environments . publicKeys

## Instance Methods

Close httplib2 connections.

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 format and content already exists, this will return the existing key.

Removes a public SSH key from an environment. Clients will no longer be able to connect to the environment using the corresponding private key.

### Method Details

`close()`

    Close httplib2 connections.

`create(parent, body=None, x__xgafv=None)`

    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 format and content already exists, this will return the existing key.

    Args:
      parent: string, Parent resource name, e.g. `users/me/environments/default`. (required)
      body: object, The request body.
        The object takes the form of:

    { # Request message for CreatePublicKey.
        "key": { # A public SSH key, corresponding to a private SSH key held by the client. # Key that should be added to the environment.
          "name": "A String", # Output only. Full name of this resource, in the format `users/{owner_email}/environments/{environment_id}/publicKeys/{key_id}`. `{owner_email}` is the email address of the user to whom the key belongs. `{environment_id}` is the identifier of the environment to which the key grants access. `{key_id}` is the unique identifier of the key. For example, `users/someone@example.com/environments/default/publicKeys/myKey`.
          "format": "A String", # Required. Format of this key's content.
          "key": "A String", # Required. Content of this key.
        },
      }

      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # A public SSH key, corresponding to a private SSH key held by the client.
        "name": "A String", # Output only. Full name of this resource, in the format `users/{owner_email}/environments/{environment_id}/publicKeys/{key_id}`. `{owner_email}` is the email address of the user to whom the key belongs. `{environment_id}` is the identifier of the environment to which the key grants access. `{key_id}` is the unique identifier of the key. For example, `users/someone@example.com/environments/default/publicKeys/myKey`.
        "format": "A String", # Required. Format of this key's content.
        "key": "A String", # Required. Content of this key.
      }

`delete(name, x__xgafv=None)`

    Removes a public SSH key from an environment. Clients will no longer be able to connect to the environment using the corresponding private key.

    Args:
      name: string, Name of the resource to be deleted, e.g. `users/me/environments/default/publicKeys/my-key`. (required)
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`.
      }