# openstack.compute.v2.keypair

## The Keypair Class

The `Keypair` class inherits from `Resource`.

class openstack.compute.v2.keypair.Keypair(_synchronized=False, connection=None, **attrs)

  The base resource

  Parameters:

    - _synchronized (bool) – This is not intended to be used directly. See `new()` and `existing()`.

    - connection (openstack.connection.Connection) – Reference to the Connection being used. Defaults to None to allow Resource objects to be used without an active Connection, such as in unit tests. Use of `self._connection` in Resource code should protect itself with a check for None.

  resource_key = 'keypair'

    Singular form of key for resource.

  resources_key = 'keypairs'

    Plural form of key for resource.

  base_path = '/os-keypairs'

    The base part of the URI for this resource.

  allow_create = True

    Allow create operation for this resource.

  allow_fetch = True

    Allow get operation for this resource.

  allow_delete = True

    Allow delete operation for this resource.

  allow_list = True

    Allow list operation for this resource.

  created_at

    The date and time when the resource was created.

  is_deleted

    A boolean indicates whether this keypair is deleted or not.

  fingerprint

    The short fingerprint associated with the `public_key` for this keypair.

  id

    The id identifying the keypair

  name

    A name identifying the keypair

  private_key

    The private key for the keypair

  public_key

    The SSH public key that is paired with the server.

  type

    The type of the keypair.

  user_id

    The user_id for a keypair.

  classmethod existing(connection=None, **kwargs)

    Create an instance of an existing remote resource.

    When creating the instance set the `_synchronized` parameter of `Resource` to `True` to indicate that it represents the state of an existing server-side resource. As such, all attributes passed in `**kwargs` are considered “clean”, such that an immediate `update()` call would not generate a body of attributes to be modified on the server.

    Parameters:

      kwargs (dict) – Each of the named arguments will be set as attributes on the resulting Resource object.

this page last updated: 2026-01-16 23:06:19

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.