
                         8   S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJ	r	  SSK
Jr  SS	KJr  SS
KJr  \R                   \R"                  " \R$                  R&                  \R$                  R(                  5       " S S\R*                  5      5       5       rg)zACommand return config and auth context for use by external tools.    )absolute_import)division)unicode_literals)arg_parsers)base)config_helper)
properties)named_configs)storec                   8    \ rS rSrSrSSS.r\S 5       rS rSr	g	)
ConfigurationHelper   z>A helper for providing auth and config data to external tools.a              {description}

            Tools can call out to this command to get gcloud's current auth and
            configuration context when needed. This is appropriate when external
            tools want to operate within the context of the user's current
            gcloud session.

            This command returns a nested data structure with the following
            schema:

            *  credential
               *  access_token - string, The current OAuth2 access token
               *  token_expiry - string, The time the token will expire. This
                  can be empty for some credential types. It is a UTC time
                  formatted as: '%Y-%m-%dT%H:%M:%SZ'
            *  configuration
               *  active_configuration - string, The name of the active gcloud
                  configuration
               *  properties - {string: {string: string}}, The full set of
                  active gcloud properties
        a              This command should always be used with the --format flag to get the
            output in a structured format.

            To get the current gcloud context:

              $ {command} --format=json

            To get the current gcloud context after forcing a refresh of the
            OAuth2 credentials:

              $ {command} --format=json --force-auth-refresh

            To set MIN_EXPIRY amount of time that if given, refresh the
            credentials if they are within MIN_EXPIRY from expiration:

              $ {command} --format=json --min-expiry=MIN_EXPIRY

            By default, MIN_EXPIRY is set to be 0 second.
        )DESCRIPTIONEXAMPLESc                     U R                  5       nUR                  SSSS9  UR                  S[        R                  " SSS9S	SS
9  g )Nz--force-auth-refresh
store_truezForce a refresh of the credentials even if they have not yet expired. By default, credentials will only refreshed when necessary.)actionhelpz--min-expiry0s1h)lower_boundupper_boundzPIf given, refresh the credentials if they are within MIN_EXPIRY from expiration.)typer   default)add_mutually_exclusive_groupadd_argumentr   Duration)parsergroups     #lib/surface/config/config_helper.pyArgsConfigurationHelper.ArgsR   s^    //1E	   
!!dE       c                    [         R                  " SS9nUR                  (       a  [         R                  " U5        O0[         R                  " USR                  UR                  5      5        [        R                  R                  5       R                  n[        R                  R                  5       n[        R                  " UUUS9$ )NT)use_google_authz{})
credentialactive_configurationr	   )r   Loadforce_auth_refreshRefreshRefreshIfExpireWithinWindowformat
min_expiryr
   ConfigurationStoreActiveConfignamer	   VALUES	AllValuesr   ConfigHelperResult)selfargscredconfig_namepropss        r    RunConfigurationHelper.Runb   s    ::d+DmmD''dkk$//.JK22??AFFK'')E++( r#    N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr!   r9   __static_attributes__r;   r#   r    r   r      s3     G.3--^  r#   r   N)r@   
__future__r   r   r   googlecloudsdk.callioper   r   !googlecloudsdk.command_lib.configr   googlecloudsdk.corer	   "googlecloudsdk.core.configurationsr
   googlecloudsdk.core.credentialsr   HiddenReleaseTracksReleaseTrackBETAGACommandr   r;   r#   r    <module>rP      sz     H &  ' / ( ; * < 1 D%%**D,=,=,@,@AQ$,, Q B Qr#   