HEX
Server: Apache/2.4.68 (Debian)
System: Linux as-cs-widget-demo-us-central1 6.1.0-44-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.164-1 (2026-03-09) x86_64
User: root (0)
PHP: 8.2.32
Disabled: NONE
Upload Files
File: //lib/google-cloud-sdk/lib/surface/firestore/databases/__pycache__/create.cpython-312.pyc
�

����^�dZddlmZddlmZddlmZddlZddlmZddlmZddl	m
Z
dd	lmZdd
l
mZe
je
j e
j"j$e
j"j&e
j"j(�Gd�de
j*���Zy)
z-Command to create a Cloud Firestore Database.�)�absolute_import)�division)�unicode_literalsN)�	api_utils)�	databases)�base)�flags)�
propertiesc�D�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	e
d��Zy	)
�CreateFirestoreAPIaCreate 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��|dk(r2tj�jjjS|dk(r2tj�jjj
St
dj|���)N�firestore-native�datastore-modezinvalid database type: {})r�GetMessages�GoogleFirestoreAdminV1Database�TypeValueValuesEnum�FIRESTORE_NATIVE�DATASTORE_MODE�
ValueError�format)�self�
database_types  �)lib/surface/firestore/databases/create.py�DatabaseTypezCreateFirestoreAPI.DatabaseTypeNsu���*�*�
�
�
�
!�
@�
@�
T�
T�
e�
e��
�*�	*�
�
�
�
!�
@�
@�
T�
T�
c�
c��
�2�9�9�-�H�I�I�c��|dk(r2tj�jjjS|dk(r2tj�jjj
St
dj|���)N�standard�
enterprisezinvalid database edition: {})rrr�DatabaseEditionValueValuesEnum�STANDARD�
ENTERPRISErr)r�database_editions  r�DatabaseEditionz"CreateFirestoreAPI.DatabaseEditionZst���:�%�
�
�
�
!�
@�
@�
_�
_�
h�
h��
�\�	)�
�
�
�
!�
@�
@�
_�
_�
j�
j��
�5�<�<�=M�N�O�Orc���|r2tj�jjjStj�jjj
S�N)rrr�$DeleteProtectionStateValueValuesEnum�DELETE_PROTECTION_ENABLED�DELETE_PROTECTION_DISABLED)r�enable_delete_protections  r�DatabaseDeleteProtectionStatez0CreateFirestoreAPI.DatabaseDeleteProtectionStatefsM���
�
�
�
!�
@�
@�
e�
e�
�
��	����>�>�c�c�~�~�rc�6�|�2tj�jjjS|r2tj�jjj
Stj�jjjSr%)rrr�,PointInTimeRecoveryEnablementValueValuesEnum�-POINT_IN_TIME_RECOVERY_ENABLEMENT_UNSPECIFIED�POINT_IN_TIME_RECOVERY_ENABLED�POINT_IN_TIME_RECOVERY_DISABLED)r�enable_pitrs  r�DatabasePitrStatez$CreateFirestoreAPI.DatabasePitrStateos�����
�
�
�
!�
@�
@�
m�
m�\�\���
�
�
�
!�
@�
@�
m�
m�M�M��	����>�>�k�k�	L�	L�rc��|j�.tj�j|j��Stj�j�S)N)�
kmsKeyName)�kms_key_namerr� GoogleFirestoreAdminV1CmekConfig)r�argss  r�DatabaseCmekConfigz%CreateFirestoreAPI.DatabaseCmekConfig|sS�����$�
�
"�
"�
$�
E�
E��&�&�F���� � �"�C�C�E�Erc���tjjjj	d��}tj||j|j|j|j�|j|j�|j|j�|j|j �|j#|�|j$�	S)NT)�required)r
�VALUES�core�project�Getr�CreateDatabase�location�databaser�typer#�editionr*�delete_protectionr1r0r7�tags)rr6r<s   r�RunzCreateFirestoreAPI.Run�s������$�$�,�,�0�0�$�0�?�G��#�#���
�
��
�
����$�)�)�$����T�\�\�*��*�*�4�+A�+A�B����t�/�/�0�����%��	�	�
�
rc���tj|ddg��|jdddddg��|jd	d
dddg��|jd
tjd�t
d��|jdtjd�dd��|jdtjd�dd��tj|�tj|d�y)NTz--region)r9�suggestion_aliasesz	--editionzThe edition of the database.rr)�help�default�choicesz--typezThe type of the database.rrz
--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))rHrArIz--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)rH�actionrIz
--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.
            r@)r	�AddLocationFlag�add_argument�textwrap�dedent�str�AddKmsKeyNameFlag�AddTags)�cls�parsers  r�ArgszCreateFirestoreAPI.Args�s��	�����:�,������
+���\�*�	������
(�"�#�%5�6�	������
�_�_�
�
����� ����
�_�_�����������
�_�_���
���	�
���F�#�	�M�M�&�*�%rN)�__name__�
__module__�__qualname__�__doc__rr#r*r1r7rE�classmethodrV�rrrrs=��
)�V
J�
P���F���8&��8&rr)rZ�
__future__rrrrO� googlecloudsdk.api_lib.firestorerr�googlecloudsdk.callioper�$googlecloudsdk.command_lib.firestorer	�googlecloudsdk.corer
�DefaultUniverseOnly�
ReleaseTracks�ReleaseTrack�ALPHA�BETA�GA�Commandrr\rr�<module>ris���4�&��'��6�6�(�6�*�������������T�.�.�3�3�T�5F�5F�5I�5I��h&����h&���h&r