
    g
                         d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZ dd
Z G d dej                        Zdddde_        y	)zIImplements command to remove an SSH public key from the OS Login profile.    )absolute_import)division)unicode_literals)client)base)oslogin_utils)
propertiesNc                     d }| j                  d      }|r$t        j                  |j                  d            }|xs |S )NvalueexpirationTimeUsec)getr   ConvertUsecToRfc3339)resource	undefineddisplayr   s       -lib/surface/compute/os_login/ssh_keys/list.py_TransformExpiryr      sB    '
,,w
%
00		&')G 
	I    c                   8     e Zd ZdZ fdZed        Zd Z xZS )Listz2List the SSH public keys from an OS Login profile.c                 ,    t        t        | 
  |i | y N)superr   __init__)selfargskwargs	__class__s      r   r   zList.__init__)   s    	$//r   c                     t         j                  j                  |        | j                  j	                  d       | j                  j                  dt        i       y )Nzk
          table(
            key:label=FINGERPRINT,
            expiry():label=EXPIRY
          )
        expiry)r   URI_FLAGRemoveFromParserdisplay_info	AddFormatAddTransformsr   )parsers    r   Argsz	List.Args,   sN    MM""6*
!! #  %%"' r   c                 D   t        j                  | j                               }t        j                  j
                  j                  j                         xs2 t        j                  j                  j                  j                         }t        j                  ||      }|S )z$See ssh_utils.BaseSSHCLICommand.Run.)r   OsloginClientReleaseTrackr	   VALUESauthimpersonate_service_accountGetcoreaccountr   GetKeysFromProfile)r   r   oslogin_client
user_emailkeyss        r   RunzList.Run:   s|     ))$*;*;*=>N##((DDHHJ :&&++33779  ++JGDKr   )	__name__
__module____qualname____doc__r   staticmethodr'   r5   __classcell__)r   s   @r   r   r   &   s$    :0  r   r   z.List SSH public keys from an OS Login profile.z
      *{command}* lists the SSH public keys in an OS Login profile. By
      default, the command only displays the fingerprints and experation
      time for the keys. Additional data can be displayed using the `--format`
      flag.
    z
      To list the keys in your OS Login profile, run:

        $ {command}

      To show all of the SSH public key information, in YAML format, run:

        $ {command} --format=yaml
    )briefDESCRIPTIONEXAMPLESr   )r9   
__future__r   r   r   googlecloudsdk.api_lib.osloginr   googlecloudsdk.callioper   "googlecloudsdk.command_lib.osloginr   googlecloudsdk.corer	   r   ListCommandr   detailed_help r   r   <module>rG      sP     P &  ' 1 ( < *4 > > r   