
    Vh,                     R    d Z dZdZddlmZ  G d de      Zd Zedk(  r e        y	y	)
a  
---
module: keypair_info
short_description: Get information about keypairs from OpenStack
author: OpenStack Ansible SIG
description:
  - Get information about keypairs that are associated with the account
options:
  name:
    description:
      - Name or ID of the keypair
    type: str
  user_id:
    description:
      - It allows admin users to operate key-pairs of specified user ID.
    type: str
  limit:
    description:
      - Requests a page size of items.
      - Returns a number of items up to a limit value.
    type: int
  marker:
    description:
      - The last-seen item.
    type: str
extends_documentation_fragment:
- openstack.cloud.openstack
a3  
- name: Get information about keypairs
  openstack.cloud.keypair_info:
  register: result

- name: Get information about keypairs using optional parameters
  openstack.cloud.keypair_info:
    name: "test"
    user_id: "fed75b36fd7a4078a769178d2b1bd844"
    limit: 10
    marker: "jdksl"
  register: result
a   
keypairs:
  description:
    - Lists keypairs that are associated with the account.
  type: list
  elements: dict
  returned: always
  contains:
    created_at:
      description:
        - The date and time when the resource was created.
      type: str
      sample: "2021-01-19T14:52:07.261634"
    id:
      description:
        - The id identifying the keypair
      type: str
      sample: "keypair-5d935425-31d5-48a7-a0f1-e76e9813f2c3"
    is_deleted:
      description:
        - A boolean indicates whether this keypair is deleted or not.
      type: bool
    fingerprint:
      description:
        - The fingerprint for the keypair.
      type: str
      sample: "7e:eb:ab:24:ba:d1:e1:88:ae:9a:fb:66:53:df:d3:bd"
    name:
      description:
        - A keypair name which will be used to reference it later.
      type: str
      sample: "keypair-5d935425-31d5-48a7-a0f1-e76e9813f2c3"
    private_key:
      description:
        - The private key for the keypair.
      type: str
      sample: "MIICXAIBAAKBgQCqGKukO ... hZj6+H0qtjTkVxwTCpvKe4eCZ0FPq"
    public_key:
      description:
        - The keypair public key.
      type: str
      sample: "ssh-rsa AAAAB3NzaC1yc ... 8rPsBUHNLQp Generated-by-Nova"
    type:
      description:
        - The type of the keypair.
        - Allowed values are ssh or x509.
      type: str
      sample: "ssh"
    user_id:
      description:
        - It allows admin users to operate key-pairs of specified user ID.
      type: str
      sample: "59b10f2a2138428ea9358e10c7e44444"
    )OpenStackModulec                   h    e Zd Z e e        e        ed       e             Z ed      Zd Zy)KeyPairInfoModuleint)type)nameuser_idlimitmarkerT)supports_check_modec                 (   dD ci c]!  }| j                   |   || j                   |   # }}| j                  j                  | j                   d   |      }|D cg c]  }|j                  d       }}| j	                  d|       y c c}w c c}w )N)r	   r   r
   r   r   )
name_or_idfiltersF)computed)changedkeypairs)paramsconnsearch_keypairsto_dictexit)selfkr   r   rawresults         p/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/openstack/cloud/plugins/modules/keypair_info.pyrunzKeyPairInfoModule.runx   s    92kk!n0 dkk!n$ 2 2 99,,F8K5< - >9AB##++u+-BB		%&	12
 Cs   &B
BN)__name__
__module____qualname__dictargument_specmodule_kwargsr        r   r   r   m   s7    Vv	M  M2r%   r   c                  &    t               }  |         y )N)r   )modules    r   mainr(      s     F
Hr%   __main__N)DOCUMENTATIONEXAMPLESRETURNBansible_collections.openstack.cloud.plugins.module_utils.openstackr   r   r(   r   r$   r%   r   <module>r.      sE   :5
n2 2*
 zF r%   