
                         R   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  \
R                  \
R                  " \
R                  R                   \
R                  R"                  \
R                  R$                  5       " S
 S\
R&                  5      5       5       rg)z+Command for spanner backup schedule create.    )absolute_import)division)unicode_literalsN)backup_schedules)arg_parsers)base)resource_argsc                   V    \ rS rSrSrS\R                  " S5      0r\S 5       r	S r
Srg)	Create   z'Create a Cloud Spanner backup schedule.EXAMPLESz        To create a Cloud Spanner backup schedule, run:

          $ {command} backup-schedule-id --instance=instance-id --database=database-id --cron="0 2 * * *" --retention-duration=2w --backup-type=full-backup
        c                 D   [         R                  " U S5        SS/nU R                  SSSS[        R                  " USS	9S
9  U R                  SSSS9  U R                  SSSS9  U R                  5       n[         R                  " U5        [         R                  " US5        g)aa  Args is called by calliope to gather arguments for this command.

Please add arguments in alphabetical order except for no- or a clear- pair
for that argument which can follow the argument itself.

Args:
  parser: An argparse parser that you can use to add arguments that go on
    the command line after this command. Positional arguments are allowed.
z	to createzfull-backupzincremental-backupz--backup-typeBACKUP_TYPETa  Type of backups created by this schedule.

Supported backup types:

`full-backup`
  A full backup stores the entire contents of the database at a given version time.

`incremental-backup`
  An incremental backup contains only the data that has changed since a previous backup.
   )choices
max_length)metavarrequiredhelptypez--crona  Textual representation of the crontab. User can customize the backup frequency and the backup version time using the cron expression. The version time must be in UTC timzeone. The backup will contain an externally consistent copy of the database at the version time. Allowed frequencies are 12 hour, 1 day, 1 week and 1 month. Examples of valid cron specifications: * `0 2/12 * * * ` : every 12 hours at (2, 14) hours past midnight in UTC. * `0 2,14 * * * ` : every 12 hours at (2,14) hours past midnight in UTC. * `0 2 * * * ` : once a day at 2 past midnight in UTC. * `0 2 * * 0 ` : once a week every Sunday at 2 past midnight in UTC. * `0 2 8 * * ` : once a month on 8th day at 2 past midnight in UTC.)r   r   z--retention-durationzThe retention duration of a backup that must be at least 6 hours and at most 366 days. The backup is eligible to be automatically deleted once the retention period has elapsed.z"to create the Cloud Spanner backupN)r	   AddBackupScheduleResourceArgadd_argumentr   ArgListadd_argument_group&AddCreateBackupEncryptionConfigTypeArgAddKmsKeyResourceArg)parserbackup_type_choicesencryption_group_parsers      .lib/surface/spanner/backup_schedules/create.pyArgsCreate.Args,   s     ..v{C(*>?

   '
  ( 
J	  " >	   %77988 &&!E    c                     UR                   R                  R                  5       n[        R                  " U5      n[        R
                  " U5      n[        R                  " X!X45      $ )zThis is what gets called when the user runs this command.

Args:
  args: an argparse namespace. All the arguments that were provided to this
    command invocation.

Returns:
  Some value that we want to have printed later.
)CONCEPTSbackup_scheduleParser	   #GetCreateBackupEncryptionConfigTypeGetAndValidateKmsKeyNamer   r   )selfargsbackup_schedule_refencryption_typekms_keys        r    Run
Create.Runo   sU     --77==?#GGMO44T:G""? r#    N)__name__
__module____qualname____firstlineno____doc__textwrapdedentdetailed_helpstaticmethodr!   r/   __static_attributes__r1   r#   r    r   r      s?    
 0 (// # - @ @Dr#   r   )r6   
__future__r   r   r   r7   googlecloudsdk.api_lib.spannerr   googlecloudsdk.callioper   r   "googlecloudsdk.command_lib.spannerr	   DefaultUniverseOnlyReleaseTracksReleaseTrackALPHABETAGACreateCommandr   r1   r#   r    <module>rG      s    2 &  '  ; / ( < T..33T5F5F5I5I]T ] ]r#   