ó
    €Ï¶  ã                   óf   • S 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S	 jr	S
 r
S rg)zKUseful commands for interacting with the Cloud Firestore Import/Export API.é    )Úabsolute_import)Údivision)Úunicode_literals)Ú	api_utilsc                  ó@   • [         R                  " 5       R                  $ )zEReturns the service for interacting with the Datastore Admin service.)r   Ú	GetClientÚprojects_databases© ó    Ú4lib/googlecloudsdk/api_lib/firestore/importexport.pyÚ_GetDatabaseServicer      s   € ä	×	Ò	Ó	×	1Ñ	1Ð1r   Nc                 ó–   • [         R                  " 5       nUR                  UU(       a  UO/ U(       a  UO/ US9nUR                  XS9nU$ )a«  Returns a request for a Firestore Admin Export.

Args:
  database: the database id to export, a string.
  output_uri_prefix: the output GCS path prefix, a string.
  namespace_ids: a string list of namespace ids to export.
  collection_ids: a string list of collection ids to export.
  snapshot_time: the version of the database to export, as string in
    google-datetime format.

Returns:
  an ExportDocumentsRequest message.
)ÚoutputUriPrefixÚnamespaceIdsÚcollectionIdsÚsnapshotTime)ÚnameÚ,googleFirestoreAdminV1ExportDocumentsRequest)r   ÚGetMessagesÚ,GoogleFirestoreAdminV1ExportDocumentsRequestÚ0FirestoreProjectsDatabasesExportDocumentsRequest)ÚdatabaseÚoutput_uri_prefixÚnamespace_idsÚcollection_idsÚsnapshot_timeÚmessagesÚexport_requestÚrequests           r   ÚGetExportDocumentsRequestr       s^   € ô( ×"Ò"Ó$€(Ø×HÑHØ'Þ$1‘=°rÞ&4‘N¸"Ø ð	 Ið €.ð ×EÑEØð Fð €'ð 
€.r   c                 ó¦   • [         R                  " 5       nUR                  nSU0nU(       a  X6S'   U(       a  X&S'   U" S0 UD6nUR                  XS9$ )aS  Returns a request for a Firestore Admin Import.

Args:
  database: the database id to import, a string.
  input_uri_prefix: the location of the GCS export files, a string.
  namespace_ids: a string list of namespace ids to import.
  collection_ids: a string list of collection ids to import.

Returns:
  an ImportDocumentsRequest message.
ÚinputUriPrefixr   r   )r   Ú,googleFirestoreAdminV1ImportDocumentsRequestr
   )r   r   Ú,GoogleFirestoreAdminV1ImportDocumentsRequestÚ0FirestoreProjectsDatabasesImportDocumentsRequest)r   Úinput_uri_prefixr   r   r   Úrequest_classÚkwargsÚimport_requests           r   ÚGetImportDocumentsRequestr*   ?   sg   € ô ×"Ò"Ó$€(Ø×GÑG€-àÐ.Ð/€&ÞØ,ˆ?ÑæØ*ˆ>Ñá Ñ* 6Ñ*€.à	×	BÑ	BØð 
Cð 
ð r   c           
      ól   • SR                  X5      n[        5       R                  [        UUUUUS95      $ )a´  Performs a Firestore Admin Export.

Args:
  project: the project id to export, a string.
  database: the databae id to import, a string.
  output_uri_prefix: the output GCS path prefix, a string.
  namespace_ids: a string list of namespace ids to import.
  collection_ids: a string list of collections to export.
  snapshot_time: the version of the database to export, as string in
    google-datetime format.

Returns:
  an Operation.
úprojects/{}/databases/{})r   r   r   r   r   )Úformatr   ÚExportDocumentsr    )Úprojectr   r   r   r   r   Údbnames          r   ÚExportr1   ^   sA   € ð, &×,Ñ,¨WÓ?€&Ü	Ó	×	.Ñ	.ÜØØ-Ø%Ø'Ø%ñó
ð r   c           	      ój   • SR                  X5      n[        5       R                  [        UUUUS95      $ )ae  Performs a Firestore Admin v1 Import.

Args:
  project: the project id to import, a string.
  database: the databae id to import, a string.
  input_uri_prefix: the input uri prefix of the exported files, a string.
  namespace_ids: a string list of namespace ids to import.
  collection_ids: a string list of collections to import.

Returns:
  an Operation.
r,   )r   r&   r   r   )r-   r   ÚImportDocumentsr*   )r/   r   r&   r   r   r0   s         r   ÚImportr4   €   s>   € ð &×,Ñ,¨WÓ?€&Ü	Ó	×	.Ñ	.ÜØØ+Ø%Ø'ñ	ó
ð r   )NNN)NN)Ú__doc__Ú
__future__r   r   r   Ú googlecloudsdk.api_lib.firestorer   r   r    r*   r1   r4   r
   r   r   Ú<module>r8      sD   ðñ Rå &Ý Ý 'å 6ò2ð ØØôðF DHôò>óDr   