
                         b    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 r	SS jr
S	\
0rS
 rg)a  Container resource transforms and symbols dict.

A resource transform function converts a JSON-serializable resource to a string
value. This module contains built-in transform functions that may be used in
resource projection and filter expressions.

NOTICE: Each TransformFoo() method is the implementation of a foo() transform
function. Even though the implementation here is in Python the usage in resource
projection and filter expressions is language agnostic. This affects the
Pythonicness of the Transform*() methods:
  (1) The docstrings are used to generate external user documentation.
  (2) The method prototypes are included in the documentation. In particular the
      prototype formal parameter names are stylized for the documentation.
  (3) The 'r', 'kwargs', and 'projection' args are not included in the external
      documentation. Docstring descriptions, other than the Args: line for the
      arg itself, should not mention these args. Assume the reader knows the
      specific item the transform is being applied to. When in doubt refer to
      the output of $ gcloud topic projections.
  (4) The types of some args, like r, are not fixed until runtime. Other args
      may have either a base type value or string representation of that type.
      It is up to the transform implementation to silently do the string=>type
      conversions. That's why you may see e.g. int(arg) in some of the methods.
  (5) Unless it is documented to do so, a transform function must not raise any
      exceptions related to the resource r. The `undefined' arg is used to
      handle all unusual conditions, including ones that would raise exceptions.
      Exceptions for arguments explicitly under the caller's control are OK.
    )absolute_import)division)unicode_literals)	constants)timesc                     U (       d  g[         R                  " U 5      nU(       d  gU[         R                  " UR                  5      -
  $ )zReturn timedelta TTL for a cluster.

Args:
  s: expireTime string timestamp in RFC3339 format.
Returns:
  datetime.timedelta of time remaining before cluster expiration.
Raises:
  TypeError, ValueError if time could not be parsed.
N)r   ParseDateTimeNowtzinfo)s	expire_dts     2lib/googlecloudsdk/api_lib/container/transforms.pyParseExpireTimer   5   s:     
!!!$)		UYYy//0	00    c                    U R                  SS5      nUc  U$ U R                  SS5      (       a  SR                  U5      n [        U R                  SS5      5      nUb\  UR                  [        R
                  :  a   USR                  UR                  5      -  nU$ USR                  UR                  5      -  nU$ ! [        R                   a    Us $ f = f)	zReturns the formatted master version.

Args:
  r: JSON-serializable object.
  undefined: Returns this value if the resource cannot be formatted.
Returns:
  The formatted master version.
currentMasterVersionNenableKubernetesAlphaFz	{0} ALPHA
expireTimez ({0} days left)z (! {0} days left !))getformatr   daysr   EXPIRE_WARNING_DAYSr   Error)r	undefinedversion	time_lefts       r   TransformMasterVersionr   G   s     EE($/'_UU"E**  )G	lD 9:I	)77	7%,,Y^^<< N 	)00@@N	 s   AB= B= =CCmaster_versionc                      [         $ )z=Returns the compute specific resource transform symbol table.)_TRANSFORMS r   r   GetTransformsr#   g   s    	r   N) )__doc__
__future__r   r   r   $googlecloudsdk.command_lib.containerr   googlecloudsdk.core.utilr   r   r   r!   r#   r"   r   r   <module>r)      s9   "8 '  ' : *1$8 ,
r   