
    1                        S r SSKJr  SSKJr  SSKJr  SSK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                  \
R                   " \
R"                  R$                  \
R"                  R&                  5       " S S\
R(                  5      5       5       r\
R                  \
R                   " \
R"                  R,                  5       " S S\5      5       5       rg)z-Command to create a Cloud Firestore Database.    )absolute_import)division)unicode_literalsN)	api_utils)	databases)base)flags)
propertiesc                   L    \ rS rSrSrS rS rS rS rS r	S r
\S	 5       rS
rg)CreateFirestoreAPI     Create a Google Cloud Firestore database via Firestore API.

## EXAMPLES

To create a Firestore Enterprise database named `foo` in `nam5` for use with
MongoDB Compatibility.

    $ {command} --database=foo --edition=enterprise --location=nam5

To create a Firestore Native database in `nam5`.

    $ {command} --location=nam5

To create a Firestore Native database in `us-central1` with tags.

    $ {command} --location=us-central1 --tags=key1=value1,key2=value2

To create a Datastore Mode database in `us-east1`.

    $ {command} --location=us-east1 --type=datastore-mode

To create a Datastore Mode database in `us-east1` with a databaseId `foo`.

    $ {command} --database=foo --location=us-east1 --type=datastore-mode

To create a Firestore Native database in `nam5` with delete protection
enabled.

    $ {command} --location=nam5 --delete-protection

To create a Firestore Native database in `nam5` with Point In Time Recovery
(PITR) enabled.

    $ {command} --location=nam5 --enable-pitr

To create a Firestore Native database in `nam5` encrypted by a
Customer-managed encryption key (CMEK).

    $ {command}
    --location=nam5
    --kms-key-name=projects/PROJECT_ID/locations/us/keyRings/KEY_RING_ID/cryptoKeys/CRYPTO_KEY_ID
c                    US:X  a3  [         R                  " 5       R                  R                  R                  $ US:X  a3  [         R                  " 5       R                  R                  R
                  $ [        SR                  U5      5      e)Nfirestore-nativedatastore-modezinvalid database type: {})r   GetMessagesGoogleFirestoreAdminV1DatabaseTypeValueValuesEnumFIRESTORE_NATIVEDATASTORE_MODE
ValueErrorformat)selfdatabase_types     )lib/surface/firestore/databases/create.pyDatabaseTypeCreateFirestoreAPI.DatabaseTypeL   su    **



!
@
@
T
T
e
e 
*	*



!
@
@
T
T
c
c 299-HII    c                    US:X  a3  [         R                  " 5       R                  R                  R                  $ US:X  a3  [         R                  " 5       R                  R                  R
                  $ [        SR                  U5      5      e)Nstandard
enterprisezinvalid database edition: {})r   r   r   DatabaseEditionValueValuesEnumSTANDARD
ENTERPRISEr   r   )r   database_editions     r   DatabaseEdition"CreateFirestoreAPI.DatabaseEditionX   st    :%



!
@
@
_
_
h
h 
\	)



!
@
@
_
_
j
j 5<<=MNOOr   c                     U(       a3  [         R                  " 5       R                  R                  R                  $ [         R                  " 5       R                  R                  R
                  $ N)r   r   r   $DeleteProtectionStateValueValuesEnumDELETE_PROTECTION_ENABLEDDELETE_PROTECTION_DISABLED)r   enable_delete_protections     r   DatabaseDeleteProtectionState0CreateFirestoreAPI.DatabaseDeleteProtectionStated   sM    



!
@
@
e
e

 	>>cc~~r   c                 H   Uc3  [         R                  " 5       R                  R                  R                  $ U(       a3  [         R                  " 5       R                  R                  R
                  $ [         R                  " 5       R                  R                  R                  $ r)   )r   r   r   ,PointInTimeRecoveryEnablementValueValuesEnum-POINT_IN_TIME_RECOVERY_ENABLEMENT_UNSPECIFIEDPOINT_IN_TIME_RECOVERY_ENABLEDPOINT_IN_TIME_RECOVERY_DISABLED)r   enable_pitrs     r   DatabasePitrState$CreateFirestoreAPI.DatabasePitrStatem   s    



!
@
@
m
m  \  \ 



!
@
@
m
m  M  M 	>>kk  	L  	Lr   c                     UR                   b,  [        R                  " 5       R                  UR                   S9$ [        R                  " 5       R                  5       $ )N)
kmsKeyName)kms_key_namer   r    GoogleFirestoreAdminV1CmekConfig)r   argss     r   DatabaseCmekConfig%CreateFirestoreAPI.DatabaseCmekConfigz   sS    $""$EE&& F     "CCEEr   c                    [         R                  R                  R                  R	                  SS9n[
        R                  " UUR                  UR                  U R                  UR                  5      U R                  UR                  5      U R                  UR                  5      U R                  UR                   5      U R#                  U5      S S S UR$                  S9$ )NTrequired)#mongodb_compatible_data_access_modefirestore_data_access_moderealtime_updates_modetags)r
   VALUEScoreprojectGetr   CreateDatabaselocationdatabaser   typer&   editionr.   delete_protectionr6   r5   r=   rE   r   r<   rH   s      r   RunCreateFirestoreAPI.Run   s    $$,,00$0?G##$))$T\\***4+A+ABt//0%,0#'"YY r   c                    [         R                  " USS/S9  UR                  SSSSS/S9  UR                  S	S
SSS/S9  UR                  S[        R                  " S5      [
        SS9  UR                  S[        R                  " S5      SSS9  UR                  S[        R                  " S5      SS S9  [         R                  " U5        [         R                  " US5        g )NTz--region)rA   suggestion_aliasesz	--editionzThe edition of the database.r    r!   )helpdefaultchoicesz--typezThe type of the database.r   r   z
--databasea              The ID to use for the database, which will become the final
            component of the database's resource name. If database ID is not
            provided, (default) will be used as database ID.

            This value should be 4-63 characters. Valid characters are /[a-z][0-9]-/
            with first character a letter and the last a letter or a number. Must
            not be UUID-like /[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/.

            Using "(default)" database ID is also allowed.
            z	(default))rU   rM   rV   z--delete-protectiona              Whether to enable delete protection on the created database.

            If set to true, delete protection of the new database will be enabled
            and delete operations will fail unless delete protection is disabled.

            Default to false.
            
store_trueF)rU   actionrV   z--enable-pitrz            Whether to enable Point In Time Recovery (PITR) on the created database.

            If set to true, PITR on the new database will be enabled. By default, this feature is not enabled.
            rL   )r	   AddLocationFlagadd_argumenttextwrapdedentstrAddKmsKeyNameFlagAddTagsclsparsers     r   ArgsCreateFirestoreAPI.Args   s   	:, +\*	   ("#%56	   __ 
 
     __      __  
   	 
F#	MM&*%r    N)__name__
__module____qualname____firstlineno____doc__r   r&   r.   r6   r=   rQ   classmethodrd   __static_attributes__rf   r   r   r   r      s=    )V
J
PF" 8& 8&r   r   c                   @    \ rS rSrSrS rS rS rS r\	S 5       r
Srg	)
CreateFirestoreAPIAlpha   r   c                 H   Uc3  [         R                  " 5       R                  R                  R                  $ U(       a3  [         R                  " 5       R                  R                  R
                  $ [         R                  " 5       R                  R                  R                  $ r)   )r   r   r   .MongodbCompatibleDataAccessModeValueValuesEnumDATA_ACCESS_MODE_UNSPECIFIEDDATA_ACCESS_MODE_ENABLEDDATA_ACCESS_MODE_DISABLEDr   enables     r   MongodbCompatibleDataAccessMode7CreateFirestoreAPIAlpha.MongodbCompatibleDataAccessMode   s    ~



!
@
@
o
o  M  M 



!
@
@
o
o  I  I 	>>mm  	H  	Hr   c                 H   Uc3  [         R                  " 5       R                  R                  R                  $ U(       a3  [         R                  " 5       R                  R                  R
                  $ [         R                  " 5       R                  R                  R                  $ r)   )r   r   r   &FirestoreDataAccessModeValueValuesEnumrs   rt   ru   rv   s     r   FirestoreDataAccessMode/CreateFirestoreAPIAlpha.FirestoreDataAccessMode	  s    ~



!
@
@
g
g  E  E 



!
@
@
g
g  A  A 	>>eer   c                 H   Uc3  [         R                  " 5       R                  R                  R                  $ U(       a3  [         R                  " 5       R                  R                  R
                  $ [         R                  " 5       R                  R                  R                  $ r)   )r   r   r   "RealtimeUpdatesModeValueValuesEnum!REALTIME_UPDATES_MODE_UNSPECIFIEDREALTIME_UPDATES_MODE_ENABLEDREALTIME_UPDATES_MODE_DISABLEDrv   s     r   RealtimeUpdatesMode+CreateFirestoreAPIAlpha.RealtimeUpdatesMode  s    ~



!
@
@
c
c  F  F 



!
@
@
c
c  B  B 	>>aa  	A  	Ar   c                 ^   [         R                  R                  R                  R	                  SS9n[
        R                  " UUR                  UR                  U R                  UR                  5      U R                  UR                  5      U R                  UR                  5      U R                  UR                   5      U R#                  U5      U R%                  UR&                  5      U R)                  UR*                  5      U R-                  UR.                  5      UR0                  5      $ )NTr@   )r
   rF   rG   rH   rI   r   rJ   rK   rL   r   rM   r&   rN   r.   rO   r6   r5   r=   rx   %enable_mongodb_compatible_data_accessr|   enable_firestore_data_accessr   enable_realtime_updatesrE   rP   s      r   rQ   CreateFirestoreAPIAlpha.Run#  s    $$,,00$0?G##$))$T\\***4+A+ABt//0%,,66	
 	$$T%F%FG  !=!=>		 r   c                    [         R                  U5        UR                  S[        R                  " S5      SS SS9  UR                  S[        R                  " S5      SS SS9  UR                  S[        R                  " S	5      SS SS9  g )
Nz'--enable-mongodb-compatible-data-accessa}              Whether to enable MongoDB Compatible API Data Access on the
            created database.

            If set to true, MongoDB Compatible API Data Access on the new
            database will be enabled. By default, this feature is enabled for
            Enterprise edition databases.
            To disable, use --no-enable-mongodb-compatible-data-access.
            rX   T)rU   rY   rV   hiddenz--enable-firestore-data-accessan              Whether to enable Firestore API Data Access on the created
            database.

            If set to true, Firestore API Data Access on the new database will
            be enabled. By default, this feature is disabled for Enterprise
            edition databases. To explicitly disable,
            use --no-enable-firestore-data-access.
            z--enable-realtime-updatesa[              Whether to enable Realtime Updates feature on the created database.

            If set to true, Realtime Updates feature on the new database will
            be enabled. By default, this feature is disabled for Enterprise
            edition databases. To explicitly disable,
            use --no-enable-realtime-updates.
            )r   rd   r[   r\   r]   ra   s     r   rd   CreateFirestoreAPIAlpha.Args6  s    F#
1__      (__      #__     r   rf   N)rg   rh   ri   rj   rk   rx   r|   r   rQ   rl   rd   rm   rf   r   r   ro   ro      s0    )V& - -r   ro   )rk   
__future__r   r   r   r\    googlecloudsdk.api_lib.firestorer   r   googlecloudsdk.callioper   $googlecloudsdk.command_lib.firestorer	   googlecloudsdk.corer
   DefaultUniverseOnlyReleaseTracksReleaseTrackBETAGACommandr   ALPHAro   rf   r   r   <module>r      s    4 &  '  6 6 ( 6 * D%%**D,=,=,@,@Ak& k& B k&\ D%%++,T0 T - Tr   