# novaclient.v2.keypairs module

Keypair interface

class novaclient.v2.keypairs.Keypair(manager, info, loaded=False, resp=None)

  Bases: `Resource`

  A keypair is a ssh key that can be injected into a server on launch.

  Populate and bind to a manager.

  Parameters:

    - manager – BaseManager object

    - info – dictionary representing resource attributes

    - loaded – prevent lazy-loading if set to True

    - resp – Response or list of Response objects

  delete()

    Delete this keypair.

    Returns:

      An instance of novaclient.base.TupleWithMeta

  property id

class novaclient.v2.keypairs.KeypairManager(api)

  Bases: `ManagerWithFind`

  create(name, public_key, key_type='ssh', user_id=None)

    Create a keypair

    Parameters:

      - name – name for the keypair to create

      - public_key – existing public key to import

      - key_type – keypair type to create

      - user_id – user to add.

  delete(key, user_id=None)

    Delete a keypair

    Parameters:

      - key – The `Keypair` (or its ID) to delete.

      - user_id – Id of key-pair owner (Admin only).

    Returns:

      An instance of novaclient.base.TupleWithMeta

  get(keypair, user_id=None)

    Get a keypair.

    Parameters:

      - keypair – The ID of the keypair to get.

      - user_id – Id of key-pair owner (Admin only).

    Return type:

      `Keypair`

  is_alphanum_id_allowed = True
  keypair_prefix = 'os-keypairs'
  list(user_id=None, marker=None, limit=None)

    Get a list of keypairs.

    Parameters:

      - user_id – Id of key-pairs owner (Admin only).

      - marker – Begin returning keypairs that appear later in the keypair list than that represented by this keypair name (optional).

      - limit – maximum number of keypairs to return (optional). Note the API server has a configurable default limit. If no limit is specified here or limit is larger than default, the default limit will be used.

  resource_class

    alias of `Keypair`

this page last updated: 2026-04-01 09:32:37

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

found an error? report a bug