
    /                         d Z ddlmZ ddlmZ ddlmZ ddlZddlmZ ddlm	Z
 ddlm	Z	 ddlmZ  G d	 d
e	j                  e
j                        Zy)zCThe command to describe the status of the Identity Service Feature.    )absolute_import)division)unicode_literalsN)client)base)timesc                   0    e Zd ZdZdZed        Zd Zd Zy)DescribezPrints the status of all clusters with Identity Service installed.

  Prints the status of the Identity Service Feature resource in a fleet.

  ## EXAMPLES

  To describe the status of the Identity Service configuration, run:

    $ {command}

  identityservicec                      y )N )clsparsers     8lib/surface/container/fleet/identity_service/describe.pyArgszDescribe.Args,   s        c                 p   | j                         }t        j                  j                  |j                        }|j                         D ]  \  }}| j                  |d        | j                  j                  |      |_        t        j                  j                  |j                        }|j                         D ]  \  }}| j                  |d        | j                  j                  | j                  j                  j                  |      |_	        |j                  }| j                  |d       d|iS )Nz&identityservice.identityServiceOptionsz3identityservice.memberConfig.identityServiceOptionszIdentity Service Feature)
GetFeaturer   	HubClientToPyDictmembershipSpecsitemsFormatSessionDuration	hubclientToMembershipSpecsmembershipStates
ToProtoMapmessagesFeatureMembershipStatesValuefleetDefaultMemberConfig)	selfargsfeaturespecs_specstatesstatedefault_configs	            r   RunzDescribe.Run0   s   ooG%%g&=&=>E;;=4
  'OP !"nn>>uEG&&w'?'?@FLLN5
  
F #  $~~8833V G 55N@ '00r   c                    	  t        j                  |      |      }|j                  Mt        j                  |j                  d      j
                  }t        |dz        }t        |      dz   |_        y y # t        $ r Y y w xY w)Ns)default_suffix<   z mins)	operator
attrgettersessionDurationr   ParseDurationtotal_secondsintstrAttributeError)r"   configpathidentity_service_optionssession_duration_secssession_duration_minss         r   r   zDescribe.FormatSessionDurationH   s    !:!4!4T!:6!B	!	1	1	= % 3 3$44S!

- 	 !$$9"$< =%&0 	!0 
>  
s   A3A7 7	BBN)	__name__
__module____qualname____doc__feature_nameclassmethodr   r+   r   r   r   r   r
   r
      s*    
 #,	 	10r   r
   )r@   
__future__r   r   r   r0   &googlecloudsdk.api_lib.container.fleetr   googlecloudsdk.callioper   calliope_base3googlecloudsdk.command_lib.container.fleet.featuresgooglecloudsdk.core.utilr   FeatureCommandListCommandr
   r   r   r   <module>rK      s=    J &  '  9 9 D *7t""M$=$= 7r   