
                             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                    " S S\R"                  5      5       rg)z$The gcloud firestore export command.    )absolute_import)division)unicode_literals)importexport)
operations)storage_util)base)flags)
propertiesc                   6    \ rS rSrSrSS0r\S 5       rS rSr	g)	Export   z9export Cloud Firestore documents to Google Cloud Storage.EXAMPLESa            To export all collection groups to `mybucket` in objects prefixed with `my/path`, run:

            $ {command} gs://mybucket/my/path

          To export a specific set of collections groups asynchronously, run:

            $ {command} gs://mybucket/my/path --collection-ids='specific collection group1','specific collection group2' --async

          To export all collection groups from certain namespace, run:

            $ {command} gs://mybucket/my/path --namespace-ids='specific namespace id'

          To export from a snapshot at '2023-05-26T10:20:00.00Z', run:

            $ {command} gs://mybucket/my/path --snapshot-time='2023-05-26T10:20:00.00Z'
      c                    [         R                  " U5        [         R                  " U5        [         R                  " U5        [         R                  " U5        UR                  SSS9  [        R                  R                  U5        g)z Register flags for this command.OUTPUT_URI_PREFIXa:  
        Location where the export files will be stored. Must be a valid
        Google Cloud Storage bucket with an optional path prefix.

        For example:

          $ {command} gs://mybucket/my/path

        Will place the export in the `mybucket` bucket in objects prefixed with
        `my/path`.
        )helpN)	r
   AddCollectionGroupIdsFlagAddNamespaceIdsFlagAddSnapshotTimeFlagAddDatabaseIdFlagadd_argumentr	   
ASYNC_FLAGAddToParser)clsparsers     lib/surface/firestore/export.pyArgsExport.Args3   sk     
##F+	f%	f%	F#

   	OO'    c           	         [         R                  R                  R                  R	                  SS9n[
        R                  R                  UR                  SS9n[        R                  " UUR                  UR                  5       R                  S5      UR                  UR                  UR                   S9nUR"                  (       d  [$        R&                  " U5        U$ )NT)required)allow_empty_object/)namespace_idscollection_idssnapshot_time)r   VALUEScoreprojectGetr   ObjectReferenceFromUrlr   r   r   databaseToUrlrstripr$   r%   r&   async_r   WaitForOperation)selfargsr)   
object_refresponses        r   Run
Export.RunJ   s    $$,,00$0?G--554 6 J ""!!#&((**((H ;;!!(+Or    N)
__name__
__module____qualname____firstlineno____doc__detailed_helpclassmethodr   r6   __static_attributes__r8   r   r   r   r      s-    A  
 -$ ( (,r   r   N)r=   
__future__r   r   r    googlecloudsdk.api_lib.firestorer   r   googlecloudsdk.api_lib.storager   googlecloudsdk.callioper	   $googlecloudsdk.command_lib.firestorer
   googlecloudsdk.corer   DefaultUniverseOnlyCommandr   r8   r   r   <module>rI      sJ    + &  ' 9 7 7 ( 6 * ?T\\ ? ?r   