
                             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   " S S\	R                  5      rg)z$The gcloud datastore import command.    )absolute_import)division)unicode_literals)	admin_api)
operations)base)flags)
properties)	resourcesc                   6    \ rS rSrSrSS0r\S 5       rS rSr	g)	Import   a  Import Cloud Datastore entities from Google Cloud Storage.

Imports entities into Google Cloud Datastore. Existing entities with
the same key are overwritten. The import occurs in the background and its
progress can be monitored and managed via the Operation resource that is
created. If an Import operation is cancelled, it is possible that a subset of
the data has already been imported to Cloud Datastore. This data will not be
removed.
EXAMPLESaW            To import all data exported to the output URL
          `gs://exampleBucket/exampleExport/exampleExport.overall_export_metadata`, run:

            $ {command} gs://exampleBucket/exampleExport/exampleExport.overall_export_metadata

          To import all data exported to the output URL
          `gs://exampleBucket/exampleExport/exampleExport.overall_export_metadata`
          without waiting for the operation to complete, run:

            $ {command} gs://exampleBucket/exampleExport/exampleExport.overall_export_metadata --async

          To import only the `exampleKind` from the data exported to the output
          URL `gs://exampleBucket/exampleExport/exampleExport.overall_export_metadata`,
          run:

            $ {command} gs://exampleBucket/exampleExport/exampleExport.overall_export_metadata --kinds='exampleKind'
      c                     [         R                  " U 5        [         R                  " U 5        U R                  SSS9  [        R
                  R                  U 5        g)z Register flags for this command.	input_urla  
        Location of the import metadata. Must be a valid Google Cloud Storage
        object. The file extension is 'overall_export_metadata'.

        This location is the 'output_url' field of a previous export, and can
        be found via the 'operations describe' command.
        )helpN)r	   AddEntityFilterFlagsAddLabelsFlagadd_argumentr   
ASYNC_FLAGAddToParser)parsers    lib/surface/datastore/import.pyArgsImport.Args>   sO     
v&	
   	OO'    c                    [         R                  R                  R                  R	                  SS9n[
        R                  R                  UR                  SS9n[        R                  " USR                  UR                  UR                  5      UR                  UR                  UR                   S9nUR"                  (       d  [$        R&                  " U5        U$ )NT)requiredzstorage.objects)
collectionz
gs://{}/{})kinds
namespaceslabels)r
   VALUEScoreprojectGetr   REGISTRYParser   r   r   formatbucketobjectr    r!   operation_labelsasync_r   WaitForOperation)selfargsr%   input_url_refresponses        r   Run
Import.RunN   s    $$,,00$0?G&&,,#4 - 6M M00-2F2FGjj??$$&H ;;!!(+Or    N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr   r3   __static_attributes__r5   r   r   r   r      s1     
-, ( (r   r   N)r:   
__future__r   r   r    googlecloudsdk.api_lib.datastorer   r   googlecloudsdk.callioper   $googlecloudsdk.command_lib.datastorer	   googlecloudsdk.corer
   r   Commandr   r5   r   r   <module>rD      s7    + &  ' 6 7 ( 6 * )@T\\ @r   