
    ~                     ^   d Z ddlmZ ddlmZ ddlmZ ddlZddlmZ ddlmZ ddl	m
Z
 dd	l	mZ dd
lmZ  ej                  ej                  j                   ej                  j"                  ej                  j$                        ej&                   G d dej(                                      Zy)z(gcloud datastore emulator start command.    )absolute_import)division)unicode_literalsN)arg_parsers)base)firestore_util)util)javac                   .    e Zd ZdZddiZed        Zd Zy)StartzWStart a local Firestore emulator.

  This command starts a local Firestore emulator.
  EXAMPLESa            To start the local Firestore emulator, run:

            $ {command}

          To bind to a specific host and port, run:

            $ {command} --host-port=0.0.0.0:8080

          To run the local Firestore emulator with a Firebase Rules set, run:

            $ {command} --rules=firestore.rules

          To run the local Firestore emulator in Datastore Mode, run:

            $ {command} --database-mode=datastore-mode

          To import data at the start of the Firestore emulator, run:

            $ {command} --import-data=<path/to/file>

          To export emulator data upon emulator shutdown, run:

            $ {command} --export-on-exit=<path/to/directory>
          c                 &   | j                  ddd       | j                  ddd d       | j                  d	dd
       | j                  ddddd       | j                  ddd       | j                  ddd       | j                  dddd       y )Nz--rulesFzIf set, all projects will use the security rules in this file. More information on Firebase Rules and the syntax for this file is available at https://firebase.google.com/docs/rules.)requiredhelpz--host-portc                 D    t         j                  j                  | d      S )NTipv6_enabled)r   HostPortParse)args    (lib/surface/emulators/firestore/start.py<lambda>zStart.Args.<locals>.<lambda>N   s    --33Cd3K    a*  The host:port to which the emulator should be bound. Can take the form of a single address (hostname, IPv4, or IPv6) and/or port:

  [ADDRESS][:PORT]

In this format you must enclose IPv6 addresses in square brackets: e.g.

  [2001:db8:0:0:0:ff00:42:8329]:8080

The default value is localhost:8080.)r   typer   z--database-modezThe database mode to start the Firestore Emulator in. The valid options are: 

  `firestore-native` (default): start the emulator in Firestore Native
  `datastore-mode`: start the emulator in Datastore Modez!--use-firestore-in-datastore-mode
store_trueTz$Runs the emulator in Datastore Mode.)defaultactionhiddenr   z--import-datazFile path to the data to be loaded into the emulator upon start up. Example:`/home/user/myexports/sampleExport/sampleExport.overall_export_metadata.`z--export-on-exitzmDirectory path in which emulator data will be saved upon shutdown. Example:`/home/user/myexports/2024-03-26/`z
--licenseszQIf set, the emulator will print open-source dependencies and licenses, then exit.)r   r   r   )add_argument)parsers    r   Argsz
Start.ArgsC   s    
B  C K/	  
0 C  D +3  5 `  a
 ?  @
 	   r   c                 j   |j                   sFt        j                  j                  t	        j
                         t        j                        |_         |j                   j                  xs d|j                   _        |j                   j                  xs d|j                   _	        |j                  xs d|_
        t	        j                  |       t        j                  t        j                  d       t	        j                  |      5 }t!        j"                  |d       d d d        y # 1 sw Y   y xY w)Nr   	localhost8080zfirestore-native   )min_version	firestore)	host_portr   r   r   r   GetHostPortsockethas_ipv6hostportdatabase_modeValidateStartArgsr
   RequireJavaInstalledFIRESTORE_TITLEStartFirestoreEmulatorr	   PrefixOutput)selfargsprocs      r   Runz	Start.Runu   s    >>"++11

$
$
&V__ 2 Fdn..--<DNN..--7DNN++A/AD$$T*n<<"M		.	.t	4
k* 
5	4	4s   	D))D2N)__name__
__module____qualname____doc__detailed_helpstaticmethodr!   r7    r   r   r   r      s2     -: /  / b
+r   r   )r;   
__future__r   r   r   r*   googlecloudsdk.callioper   r   $googlecloudsdk.command_lib.emulatorsr   r	   googlecloudsdk.command_lib.utilr
   ReleaseTracksReleaseTrackALPHABETAGADefaultUniverseOnlyCommandr   r>   r   r   <module>rJ      s    / &  '  / ( ? 5 0 D%%++T->->-C-C%%((*_+DLL _+ *_+r   