
    =                         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   " S S\
R                  5      rg)z"Command for spanner backup create.    )absolute_import)division)unicode_literalsN)backup_operations)backups)base)resource_args)logc                   V    \ rS rSrSrS\R                  " S5      0r\S 5       r	S r
Srg)	Create   z]Creates a backup of a Cloud Spanner database.

Creates a backup of a Cloud Spanner database.
EXAMPLESaI          To create a backup asynchronously, run:

          $ {command} BACKUP_ID --instance=INSTANCE_NAME --database=DATABASE --expiration-date=2020-03-29T10:49:41Z --async

        To create a backup synchronously, run:

          $ {command} BACKUP_ID --instance=INSTANCE_NAME --database=DATABASE --retention-period=2w
        c                    [         R                  " U S5        U R                  SSSS9  U R                  SSS9nUR                  SSS	9  UR                  S
SS	9  U R                  SSSS9  [        R
                  R                  U 5        U R                  5       n[         R                  " U5        [         R                  " US5        g)z Register flags for this command.z	to createz
--databaseTz9ID of the database from which the backup will be created.)requiredhelp)mutexr   z--expiration-datezExpiration time of the backup, must be at least 6 hours and at most 30 days from the time the request is received. See `$ gcloud topic datetimes` for information on date/time formats.)r   z--retention-periodzRetention period of the backup relative from now, must be at least 6 hours and at most 30 days. See `$ gcloud topic datetimes` for information on duration formats.z--version-time	TIMESTAMPzThe backup will contain an externally consistent copy of the database at the timestamp specified by `--version-time`. If `--version-time` is not specified, the system will use the creation time of the backup.)metavarr   z"to create the Cloud Spanner backupN)	r	   AddBackupResourceArgadd_argumentadd_argument_groupr   
ASYNC_FLAGAddToParser AddCreateBackupEncryptionTypeArgAddKmsKeyResourceArg)parsergroup_parserencryption_group_parsers      %lib/surface/spanner/backups/create.pyArgsCreate.Args1   s     &&v{;
H  J
 ,,4$,GLK  L
 :  ;    	OO'$779223JK&&'>'KM    c                 &   UR                   R                  R                  5       n[        R                  " U5      n[        R
                  " U5      n[        R                  " X!X45      nUR                  (       aE  [        R                  R                  SR                  UR                  UR                  5      5        U$ [        R                  " USR                  UR                  5      5      nUR                   c  [        R"                  " U5        U$ )z9This is what gets called when the user runs this command.z@Create request issued for: [{}]
Check operation [{}] for status.z&Waiting for operation [{}] to complete)CONCEPTSbackupParser	   GetCreateBackupEncryptionTypeGetAndValidateKmsKeyNamer   CreateBackupasync_r
   statusPrintformatnamer   AwaiterrorCreatedResource)selfargs
backup_refencryption_typekms_keyop	op_results          r   Run
Create.RunU   s     %%++-J#AA$GO44T:G			j	IB{{	jj ::@&;;;12 i!''
4;;BGGDFI	xx	)$r"    N)__name__
__module____qualname____firstlineno____doc__textwrapdedentdetailed_helpstaticmethodr    r9   __static_attributes__r;   r"   r   r   r      s@     
//  - !M !MFr"   r   )r@   
__future__r   r   r   rA   googlecloudsdk.api_lib.spannerr   r   googlecloudsdk.callioper   "googlecloudsdk.command_lib.spannerr	   googlecloudsdk.corer
   CreateCommandr   r;   r"   r   <module>rL      s9    ) &  '  < 2 ( < #HT Hr"   