
    r                     n   S r SSKrSSK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	KJr  SS
KJr  SSKJr  SSKJr  \R
                  " SSSSSSSSSSSSS.5      r\R
                  " SSSSSSS S!.5      rS"rS#rS$rS% rS& rS' rS( rS) rS* rS+ rS, r S- r!S. r"S/ r#S0 r$S1 r%S2 r&SUS3 jr'S4 r(S5 r)SVS6 jr*SVS7 jr+SWS8 jr,S9 r-S: r.S; r/S< r0S= r1S> r2S? r3S@ r4SA r5SB r6SXSC jr7SXSD jr8SE r9SF r:SG r;SH\<4SI jr=SJ r>SK r?SL r@SYSM jrASYSN jrBSO\R                  4SP jrDSQ rESR rFSS rGST rHg)ZzFlags for backup-dr commands.    N)Any)actions)arg_parsers)base)concepts)deps)util)concept_parsers)presentation_specs)
propertiesJANUARYFEBRUARYMARCHAPRILMAYJUNEJULYAUGUST	SEPTEMBEROCTOBERNOVEMBERDECEMBER)JANFEBMARAPRr   JUNJULAUGSEPOCTNOVDECMONDAYTUESDAY	WEDNESDAYTHURSDAYFRIDAYSATURDAYSUNDAY)MONTUEWEDTHUFRISATSUN)HOURLYDAILYWEEKLYMONTHLYYEARLY)FIRSTSECONDTHIRDFOURTHLASTa$
  
Parameters for the backup rule include:

*rule-id*::: Name of the backup rule. The name must be unique and
start with a lowercase letter followed by up to 62 lowercase letters,
numbers, or hyphens.

*retention-days*::: Duration for which backup data should be
retained. It must be defined in "days". The value should be greater
than or equal to the enforced retention period set for the backup vault.

*recurrence*::: Frequency for the backup schedule. It must be either:
HOURLY, DAILY, WEEKLY, MONTHLY or YEARLY.

*backup-window-start*::: Start time of the interval during which
backup jobs should be executed. It can be defined as backup-window-start=2,
that means backup window starts at 2 a.m. The start time and end time must
have an interval of 6 hours.

*backup-window-end*::: End time of the interval during which backup
jobs should be executed. It can be defined as backup-window-end=14,
that means backup window ends at 2 p.m. The start time and end time
must have an interval of 6 hours.

Jobs are queued at the beginning of the window and will be marked as
`SKIPPED` if they do not start by the end time. Jobs that are
in progress will not be canceled at the end time.

*time-zone*::: The time zone to be used for the backup schedule.
The value must exist in the
[IANA tz database](https://www.iana.org/time-zones).
The default value is UTC. E.g., Europe/Paris

::: Following flags are mutually exclusive:

*hourly-frequency*::: Frequency for hourly backups. An hourly
frequency of 2 means backup jobs will run every 2 hours from start
time till the end time defined. The hourly frequency must be between
4 and 23. The value is needed only if recurrence type is HOURLY.

*days-of-week*::: Days of the week when the backup job should be
executed. The value is needed if recurrence type is WEEKLY.
E.g., MONDAY,TUESDAY

*days-of-month*::: Days of the month when the backup job should
be executed. The value is needed only if recurrence type is YEARLY.
E.g.,"1,5,14"

*months*::: Month for the backup schedule. The value is needed only if
recurrence type is YEARLY. E.g., JANUARY, MARCH

*week-day-of-month*::: Recurring day of the week in the month or
year when the backup job should be executed. E.g. FIRST-SUNDAY, THIRD-MONDAY.
The value can only be provided if the recurrence type is MONTHLY or YEARLY.
Allowed values for the number of week - FIRST, SECOND, THIRD, FOURTH, LAST.
Allowed values for days of the week - MONDAY to SUNDAY.

::: E.g., "rule-id=sample-daily-rule,recurrence=WEEKLY,backup-window-start=2,backup-window-end=14,retention-days=20,days-of-week='SUNDAY MONDAY'"
c                  ,    [         R                  " SSS9$ )Nzbackup-vaultzThe ID of the Backup Vault.name	help_textr    ResourceParameterAttributeConfig     0lib/googlecloudsdk/command_lib/backupdr/flags.pyBackupVaultAttributeConfigrE   w   s    		2	2%B
 rC   c                  ,    [         R                  " SSS9$ )Nzdata-sourcezThe ID of the Data Source.r=   r@   rB   rC   rD   DataSourceAttributeConfigrG   }   s    		2	2$@
 rC   c                  ^    [         R                  " SS[        5       [         R                  SS9$ )Nz-backupdr.projects.locations.managementServerszManagement ServerFresource_namelocationsId
projectsIddisable_auto_completersr   ResourceSpecLocationAttributeConfig DEFAULT_PROJECT_ATTRIBUTE_CONFIGrB   rC   rD   GetManagementServerResourceSpecrR      s-    			5')+::#
 rC   c                      [         R                  " SS[        R                  " S5      [        R                  " [
        R                  R                  R                  5      /S9$ )Nzworkload-projectz$Cloud project id for the {resource}.z	--project)r>   r?   fallthroughs)	r   rA   r   ArgFallthroughPropertyFallthroughr   VALUEScoreprojectrB   rC   rD   +BackupPlanAssociationProjectAttributeConfigrZ      sN    		2	26


k
*

"
":#4#4#9#9#A#A
B
 rC   c                  ^    [         R                  " SS[        5       [         R                  SS9$ )Nz'backupdr.projects.locations.backupPlanszBackup PlanFrI   rN   rB   rC   rD   GetBackupPlanResourceSpecr\      s-    			/!)+::#
 rC   c                  R    [         R                  " SS[        5       [        5       SS9$ )Nz2backupdr.projects.locations.backupPlanAssociationszBackup Plan AssociationFrI   )r   rO   rP   rZ   rB   rC   rD   $GetBackupPlanAssociationResourceSpecr^      s*    			:-)+<>#
 rC   c            
          [         R                  " SS[        5       [         R                  [	        5       [        5       SS9$ )Nz<backupdr.projects.locations.backupVaults.dataSources.backupsBackupFrJ   rK   rL   backupVaultsIddataSourcesIdrM   r   rO   rP   rQ   rE   rG   rB   rC   rD   GetBackupResourceSpecre      s9    			D)+::/1-/#
 rC   c            
          [         R                  " SS[        5       [         R                  [	        5       [        5       SS9$ )Nz4backupdr.projects.locations.backupVaults.dataSourceszData SourceFra   rd   rB   rC   rD   GetDataSourceResourceSpecrg      s9    			<!)+::/1-/#
 rC   c                 v    Sn[         R                  R                  U[        5       USS9R	                  U 5        g)z1Adds an argument for management server to parser.management_serverTrequiredN)r
   ConceptParserForResourcerR   AddToParserparserr?   r>   s      rD   AddManagementServerResourceArgrq      s;    	$++
%'	 , 
 KrC   c                 v    Sn[         R                  R                  U[        5       USS9R	                  U 5        g)z7Adds an argument for backup plan association to parser.backup_plan_associationTrj   N)r
   rl   rm   r^   rn   ro   s      rD   #AddBackupPlanAssociationResourceArgrt      s;    	"$++
*,	 , 
 KrC   c                 v    Sn[         R                  R                  U[        5       USS9R	                  U 5        g)z&Adds an argument for backup to parser.backupTrj   N)r
   rl   rm   re   rn   ro   s      rD   AddBackupResourceArgrw      s;    	$++
	 , 
 KrC   c                    [         R                  " [        R                  " S[	        5       SSS9[        R                  " S[        5       SSS0SS	9/S
S/0S9R                  U 5        U R                  SS[        SS9  [        U S5        g)8Adds flags required to create a backup plan association.BACKUP_PLAN_ASSOCIATIONa'  Name of the backup plan association to be created. Once the backup plan association is created, this name can't be changed. The name must be unique for a project and location. To create backup plan associations in a project that's different from the backup plan, use the --workload-project flag.Trj   --backup-planzThe backup plan to be applied to the resource. E.g., projects/sample-project/locations/us-central1/backupPlans/sample-backup-planlocation flag_name_overridesrk   --backup-plan.location BACKUP_PLAN_ASSOCIATION.locationcommand_level_fallthroughsz
--resourcezThe resource to which the backup plan is to be applied. E.g., projects/sample-project/zones/us-central1-a/instances/sample-instancerk   typehelpzvType of resource to which the backup plan should be applied.
          E.g., `compute.<UNIVERSE_DOMAIN>.com/Instance` N)
r
   rl   r   ResourcePresentationSpecr^   r\   rn   add_argumentstrAddResourceTyperp   s    rD   #AddCreateBackupPlanAssociationFlagsr      s    

5
5'24?
 	 
5
5')^ b# 
0 #%G$H"16 KS   =rC   c                     [         R                  " [        R                  " S[	        5       SSS9[        R                  " S[        5       SSS0SS	9/S
S/0S9R                  U 5        g)z8Adds flags required to update a backup plan association.rz   zBackup plan association to be updated. To update backup plan associations in a project that's different from the backup plan, use the --workload-project flag.Trj   r{   zName of the specific backup plan to be applied to the backup plan association. E.g., projects/sample-project/locations/us-central1/backupPlans/sample-backup-planr|   r}   r~   r   r   r   N)r
   rl   r   r   r^   r\   rn   r   s    rD   #AddUpdateBackupPlanAssociationFlagsr     s    

5
5'24?  
5
5')# b# 0 #%G$H"16 KrC   c           	         [         R                  " [        R                  " S[	        5       SSS9/5      R                  U 5        U R                  5       nUR                  SS[        SS9  UR                  S	S[        S
S9  [        R                  " SS[        R                  " [        S9[        R                  SS9R                  U 5        g)ry   rz   zTName of an existing backup plan association to use for creating an on-demand backup.Trj   z--backup-rule-idFzHName of an existing backup rule to use for creating an on-demand backup.r   z--custom-retention-dayszmDuration for which backup data will be retained. If not specified, the default retention period will be used.--labels	KEY=VALUE)
value_typez#Labels to be applied to the backup.metavarr   actionr   N)r
   rl   r   r   r^   rn   add_mutually_exclusive_groupr   r   intr   Argumentr   ArgDictUpdateAction)rp   groups     rD   AddTriggerBackupFlagsr   5  s    

5
5'24&
 K

-
-
/%   I   --#.%%02
 3>+f2ErC   c                 X    U R                  SU[        S[        R                  " SSS9S9  g)zAdds a positional network argument to parser.

Args:
  parser: argparse.Parser: Parser object for command line inputs.
  required: Whether or not --network is required.
z	--networka  Name of an existing VPC network with private service access configured in the format - projects/<project>/global/networks/<network>. This VPC network allows the management console to communicate with all backup/recovery appliances and requires a minimum IP range of /23. This value cannot be changed after you deploy the management server. If you don't have private service access, configure one. [Learn more] (https://cloud.google.com/vpc/docs/configure-private-services-access)F)removed)rk   r   r   r   N)r   r   r   DeprecationActionrp   rk   s     rD   
AddNetworkr   `  s8     	S &&{EB  rC   c                 v    Sn[         R                  R                  U[        5       USS9R	                  U 5        g)z,Adds an argument for backup vault to parser.backup_vaultTrj   N)r
   rl   rm   GetBackupVaultResourceSpecrn   ro   s      rD   AddBackupVaultResourceArgr   z  s;    	$++
 "	 , 
 KrC   c                  ^    [         R                  " SS[        5       [         R                  SS9$ )Nz(backupdr.projects.locations.backupVaultszBackup VaultFrI   rN   rB   rC   rD   r   r     s-    			0")+::#
 rC   c                    ^ / nT(       a*  UR                  [        R                  " U4S jS5      5        [        R                  " U USS9$ )z"Creates location attribute config.c                     > T $ NrB   defaults   rD   <lambda>)LocationAttributeConfig.<locals>.<lambda>  s    GrC   zDefaults to all locationszThe location of the {resource}.)r>   rT   r?   )appendr   Fallthroughr   rA   )arg_namer   rT   s    ` rD   rP   rP     sK    ,'	
 
	2	21
 rC   c                 Z    [         R                  " SU [        US9[         R                  S9$ )Nzbackupdr.projects.locationsr   )rJ   rK   rL   rN   )rJ   r   s     rD   GetLocationResourceSpecr     s,    			#!)':::	
 rC   c                     SnSnUS:X  a  SS0n[         R                  R                  U[        US9UUUS9R	                  U 5        g)z(Adds an argument for location to parser.z
--locationNglobalr|   r}   r   r~   )r
   rl   rm   r   rn   )rp   r?   r   rk   r>   overrides         rD   AddLocationResourceArgr     sW    	$(BH++
g." ,  KrC   c                 *    SnU R                  SSUS9  g)z-Adds the --no-async flag to the given parser.z/Wait for the operation in progress to complete.z
--no-async
store_truer   r   Nr   rp   r?   s     rD   AddNoAsyncFlagr     s    ?)l<iHrC   c                 *    SnU R                  SSUS9  g)z>Adds a --ignore-inactive-datasources flag to the given parser.zIf set, the following restrictions against deletion of the backup vault instance can be overridden: * deletion of a backup vault instance containing no backups,but still contains empty datasources.z--ignore-inactive-datasourcesr   r   Nr   r   s     rD    AddIgnoreInactiveDatasourcesFlagr     s(    .  	%l  rC   c                 *    SnU R                  SSUS9  g)z@Adds a --ignore-backup-plan-references flag to the given parser.zIf set, the following restrictions against deletion of the backup vault instance can be overridden: * deletion of a backup vault instance being actively referenced by a backup plan.z--ignore-backup-plan-referencesr   r   Nr   r   s     rD   !AddIgnoreBackupPlanReferencesFlagr     s(      	'9  rC   c                 *    SnU R                  SSUS9  g)z/Adds a --force-update flag to the given parser.a/  If set, allow update to extend the minimum enforced retention for backup vault. This overrides the restriction against conflicting retention periods. This conflict may occur when the expiration schedule defined by the associated backup plan is shorter than the minimum retention set by the backup vault.z--force-updater   r   Nr   r   s     rD   AddForceUpdateFlagr     s$      	&|)LrC   c                 v    Sn[         R                  R                  U[        5       USS9R	                  U 5        g)z+Adds an argument for backup plan to parser.backup_planTrj   N)r
   rl   rm   r\   rn   ro   s      rD   AddBackupPlanResourceArgr     s;    	$++
!	 , 
 KrC   c                     [         R                  " [        R                  " S[	        5       USS9[        R                  " S[        5       SSS0SS9/S	S
/0S9R                  U 5        g)z:Adds an argument for backup plan & backup vault to parser.BACKUP_PLANTrj   z--backup-vaultzcThe backup vault where the backups gets stored using this
              backup plan.
              r|   r}   r~   z--backup-vault.locationzBACKUP_PLAN.locationr   N)r
   rl   r   r   r\   r   rn   r   s     rD   'AddBackupPlanResourceArgWithBackupVaultr     s}    

5
5')	 
5
5(* b# 
( $&<%="). KrC   c           
      P    U R                  SU[        R                  " SSSS9SS9  g)	zAdds a positional enforced-retention argument to parser.

Args:
  parser: argparse.Parser: Parser object for command line inputs.
  required: Whether or not --backup-min-enforced-retention is required.
z--backup-min-enforced-retention036159ds)lower_boundupper_boundparsed_unitzBackups will be kept for this minimum period before they can be deleted. Once the effective time is reached, the enforced retention period cannot be decreased or removed. The value must be specified in relative time format (e.g. p1d, p1m, p1m1d).r   N)r   r   Durationr   s     rD   AddEnforcedRetentionr     s7     	'xS=  rC   c                 ,    U R                  SSSS/SS9  g)zAdds the --backup-retention-inheritance flag to the given parser.

Args:
  parser: argparse.Parser: Parser object for command line inputs.
z--backup-retention-inheritanceFzinherit-vault-retentionzmatch-backup-expire-timea  The inheritance mode for enforced retention end time of the backup within this backup vault. Once set, the inheritance mode cannot be changed. Default is inherit-vault-retention. If set to inherit-vault-retention, the backup retention period will be inherited from the backup vault. If set to match-backup-expire-time, the backup retention period will  be the same as the backup expiration time. )rk   choicesr   Nr   r   s    rD   AddBackupRetentionInheritancer   #  s-     	&
#
$
2  rC   c                     U R                  SSS9nSnUR                  S[        R                  R                  US9  UR                  S[        R                  R                  SS9  g	)
zSAdds the --enforced-retention-end-time and --expire-time flags to the given parser.zUpdate Backup FlagsTrj   a  
   Backups cannot be deleted until this time or later. This period can be extended, but not shortened.
   It should be specified in the format of "YYYY-MM-DD".

   * For backup configured with a backup appliance, there are additional restrictions:
     1. Enforced retention cannot be extended past the expiry time.
     2. Enforced retention can only be updated for finalized backups.
  z--enforced-retention-end-timer   r   z--expire-timezThe date when this backup is automatically expired. This date can be extended, but not shortened. It should be specified in the format of "YYYY-MM-DD".N)add_argument_groupr   r   DatetimeParse)rp   r   r?   s      rD   AddUpdateBackupFlagsr   <  su    

#
#$9D
#
I%) %%%  
 %%%	  rC   c                     U R                   R                  U5        U R                   R                  S[        R                  05        g )N&backupMinimumEnforcedRetentionDuration)display_info	AddFormatAddTransformsr	   TransformEnforcedRetention)rp   output_formats     rD   AddOutputFormatr   W  s:    .##.0O0O% rC   c                 D    U=(       d    SnU R                  S[        US9  g)z0Adds the --description flag to the given parser.zDOptional description for the backup vault (2048 characters or less).z--descriptionr   Nr   r   rp   r?   final_help_texts      rD   AddDescriptionr   ^  s,      P	O  	oCoFrC   c                     U=(       d    SnU R                  SS[        R                  " 5       [        R                  US9  g)z+Adds the --labels flag to the given parser.zDOptional resource labels to represent metadata provided by the user.r   r   r   N)r   r   r   r   r   s      rD   	AddLabelsr   g  sH      P	O  	 %%  rC   c                 Z    SnU R                  S[        R                  R                  US9  g)z3Adds the --effective-time flag to the given parser.zThe time at which the enforced retention period becomes locked. This flag is mutually exclusive with --unlock-backup-min-enforced-retention.z--effective-timer   N)r   r   r   r   r   s     rD   AddEffectiveTimer   v  s7    Q  	%%  rC   c                 D    SnU R                  SSUR                  US9S9  g)zAdds the --allow-missing flag to the given parser for delete operation to return success and perform no action when there is no matching resource.znAllow idempotent deletion of {resource}. The request will still succeed in case the {resource} does not exist.z--allow-missingr   )resourcer   N)r   format)rp   r   r?   s      rD   AddAllowMissingr     s8    0  	X.  rC   c                 *    SnU R                  SSUS9  g)zIAdds the --unlock-backup-min-enforced-retention flag to the given parser.zRemoves the lock on the backup minimum enforced retention period, and resets the effective time. When unlocked, the enforced retention period can be changed at any time. This flag is mutually exclusive with --effective-time.z&--unlock-backup-min-enforced-retentionr   r   Nr   r   s     rD   #AddUnlockBackupMinEnforcedRetentionr     s*      	.  rC   commandc                 N    / SQnUS:X  a  SnSnOSnSnU R                  SUUUS9  g)	z:Adds Backup Vault's Access Restriction flag to the parser.)zwithin-project
within-orgunrestrictedz"within-org-but-unrestricted-for-bacreatea  Authorize certain sources and destinations for data being sent into, or restored from, the backup vault being created. This choice  determines the type of resources that can be stored. Restricting access to within your project or organization limits the resources to those managed through the Google Cloud console (e.g., Compute Engine VMs). Unrestricted access is required for resources managed through the management console (e.g., VMware Engine VMs, databases, and file systems).r   au  
Authorize certain sources and destinations for data being sent into, or restored from the current backup vault.

Access restrictions can be modified to be more or less restrictive.

    ::: More restrictive access restriction update will fail by default if there will be non compliant Data Sources.
    To allow such updates, use the --force-update-access-restriction flag.
    :::  For Google Cloud Console resources, the following changes are allowed to make access restrictions more restrictive:
        *   `UNRESTRICTED` to `WITHIN_PROJECT` / `WITHIN_ORG_BUT_UNRESTRICTED_FOR_BA` / `WITHIN_ORGANIZATION`
        *   `WITHIN_PROJECT` to `WITHIN_ORGANIZATION` / `WITHIN_ORG_BUT_UNRESTRICTED_FOR_BA`

    ::: For Management Server resources, the following changes are allowed to make access restrictions more restrictive:
        *   `UNRESTRICTED` to `WITHIN_PROJECT` / `WITHIN_ORG_BUT_UNRESTRICTED_FOR_BA` / `WITHIN_ORGANIZATION`
        *   `WITHIN_PROJECT` to `WITHIN_ORGANIZATION` / `WITHIN_ORG_BUT_UNRESTRICTED_FOR_BA`

    :::   For both Google Cloud Console and Management Server resources, the following changes are allowed to make access restrictions more restrictive:
        *   `UNRESTRICTED` to `WITHIN_PROJECT` / `WITHIN_ORG_BUT_UNRESTRICTED_FOR_BA` / `WITHIN_ORGANIZATION`
        *   `WITHIN_PROJECT` to `WITHIN_ORGANIZATION` / `WITHIN_ORG_BUT_UNRESTRICTED_FOR_BA`

    ::: For Google Cloud Console resources,  the following changes are allowed to make access restrictions less restrictive:
        *   `WITHIN_ORGANIZATION` to `UNRESTRICTED` / `WITHIN_ORG_BUT_UNRESTRICTED_FOR_BA`
        *   `WITHIN_PROJECT` to `UNRESTRICTED`
        *   `WITHIN_ORG_BUT_UNRESTRICTED_FOR_BA` to `UNRESTRICTED`

    ::: For Management Server resources, the following changes are allowed to make access restrictions less restrictive:
        *   `WITHIN_ORG_BUT_UNRESTRICTED_FOR_BA` to `UNRESTRICTED`
    Nz--access-restriction)r   r   r   r   )rp   r   r   r?   r   s        rD   'AddBackupVaultAccessRestrictionEnumFlagr     sQ    ' 	5  GI6 G	  rC   c                 *    SnU R                  SSUS9  g)zDAdds the --force-update-access-restriction flag to the given parser.zIf set, the access restriction can be updated even if there are non-compliant data sources. Backups for those data sources will fail afterward.z!--force-update-access-restrictionr   r   Nr   r   s     rD   AddForceUpdateAccessRestrictionr     s*     
 	)  rC   c                 0    U R                  SS[        SS9  g)z,Adds the --kms-key flag to the given parser.z	--kms-keyFzThe Cloud KMS key resource name to be used for encryption. Format: projects/{project}/locations/{location}/keyRings/{ring}/cryptoKeys/{key}r   Nr   r   s    rD   	AddKmsKeyr     s$    V  rC   c                 0    U R                  SS[        US9  g)zAdds a positional resource-type argument to parser.

Args:
  parser: argparse.Parser: Parser object for command line inputs.
  help_text: Help text for the resource-type argument.
z--resource-typeTr   Nr   r   s     rD   r   r     s#     		  rC   c                 2    U R                  SSU[        SS9  g)zAdds a positional log-retention-days argument to parser.

Args:
  parser: argparse.Parser: Parser object for command line inputs.
  hidden: Whether or not --log-retention-days is hidden. Default is True.
z--log-retention-daysFzConfigures how long logs will be stored. It is defined in "days".
          This value should be greater than or equal to minimum enforced log
          retention duration of the backup vault.)rk   hiddenr   r   Nr   r   )rp   r   s     rD   AddLogRetentionDaysr     s(     	5  rC   c                 ,   [         R                  " SS5      n[        R                  " [        [
        R                  5       5       VVs/ s H  u  p4U SU 3PM     nnnSS[        S[        S[         R                  4S jjn[        R                  " S[        5      nU R                  S	U[         R                  " U[        U[         R                   " S
S5      [         R                   " SS5      [        [        U" [        R"                  " [
        5      R$                  5      U" [         R                   " SS5      5      U" [        R"                  " [&        5      R$                  5      [        R                  " SU5      S./ SQS9SSS[(         S3S9  gs  snnf )zAdds a positional backup-rule argument to parser.

Args:
  parser: argparse.Parser: Parser object for command line inputs.
  required: Whether or not --backup-rule is required.
[a-z][a-z0-9-]{0,62}Invalid rule-id. This human-readable name must be unique and start with a lowercase letter followed by up to 62 lowercase letters, numbers, or hyphens-
obj_parserdelimreturnc                 *    [         R                  " XS9$ N)custom_delim_charr   ArgListr  r  s     rD   ArgListParser$AddBackupRule.<locals>.ArgListParser)      zCCrC   
recurrence--backup-ruler               week-day-of-monthrule-idretention-daysr  backup-window-startbackup-window-endz	time-zonezhourly-frequencyzdays-of-weekzdays-of-monthmonthsr  r  r  r  r  r  specrequired_keysr   PROPERTY=VALUEzBackup rule that defines parameters for when and how a backup
          is created. This flag can be repeated to create more backup rules.

          
          rk   r   r   r   r   N r   RegexpValidator	itertoolsproductWEEK_OPTIONSDAY_OPTIONSvaluesr   r   r  r	   GetOneOfValidatorRECURRENCE_OPTIONSr   r   r   
BoundedIntOptionsMapValidatorr   MONTH_OPTIONSBACKUP_RULE_COMMON_HELP_TEXT)rp   rk   rule_id_validatorweekdayweek_day_of_month_optionsr  recurrence_validators           rD   AddBackupRuler9    s    "11 !(({7I7I7KLL)$ 
auoL  
D DC D+:M:M D //& 	* #0%0%;%;Ar%B#.#9#9!R#@"%+**;7==  -[-C-CAr-JK%**=9?? $(#9#9%'@$&)8  (
( )E  (s   Frp   c                 (   [         R                  " SS5      n[        R                  " [        [
        R                  5       5       VVs/ s H  u  p#U SU 3PM     nnnSS[        S[        S[         R                  4S jjn[        R                  " S[        5      nU R                  S	[         R                  " U[        U[         R                   " S
S5      [         R                   " SS5      [        [        U" [        R"                  " [
        5      R$                  5      U" [         R                   " SS5      5      U" [        R"                  " [&        5      R$                  5      [        R                  " SU5      S.S/S9SSS[(         S3S9  gs  snnf )z{Adds a positional backup-rule argument to parser.

Args:
  parser: argparse.Parser: Parser object for command line inputs.
r  r  r  r  r  r  c                 *    [         R                  " XS9$ r	  r  r  s     rD   r  *AddUpdateBackupRule.<locals>.ArgListParsern  r  rC   r  r  r   r  r  r  r  r  r  r  r  r   r"  aJ  Full definition of an existing backup rule with updated values.
          The existing backup rule is replaced by this new set of values.
          This flag can be repeated to update multiple backup rules.
          It is not allowed to pass the same rule-id in this flag more than once
          in the same command.

          r#  )r   r   r   r   Nr%  r'  rp   r4  r5  r6  r7  r  r8  s          rD   AddUpdateBackupRuler>  [  s    "11 !(({7I7I7KLL)$ 
auoL  
D DC D+:M:M D //& 	* #0%0%;%;Ar%B#.#9#9!R#@"%+**;7==  -[-C-CAr-JK%**=9?? $(#9#9%'@$& #),  (
( )7  $s   Fc                    [         R                  " SS5      n[        R                  " [        [
        R                  5       5       VVs/ s H  u  p#U SU 3PM     nnnSS[        S[        S[         R                  4S jjn[        R                  " S[        5      nU R                  S	S
[         R                  " U[        U[         R                   " SS5      [         R                   " SS5      [        [        U" [        R"                  " [
        5      R$                  5      U" [         R                   " SS5      5      U" [        R"                  " [&        5      R$                  5      [        R                  " SU5      S./ SQS9SSSS9  gs  snnf )zsAdds flags required to add a backup rule.

Args:
  parser: argparse.Parser: Parser object for command line inputs.
r  r  r  r  r  r  c                 *    [         R                  " XS9$ r	  r  r  s     rD   r  'AddAddBackupRule.<locals>.ArgListParser  r  rC   r  z--add-backup-ruleFr   r  r  r  r  r  r  r  r  r   r"  zxParameters of backup rule to be added to the Backup Plan. This flag can be repeated to add more backup rules.
          r$  Nr%  )r   r(  r)  r*  r+  r,  r-  r   r   r  r	   r.  r/  r   r   r   r0  r1  r   r2  r=  s          rD   AddAddBackupRulerB    sx    "11 !(({7I7I7KLL)$ 
auoL  
D DC D+:M:M D //& 	* #0%0%;%;Ar%B#.#9#9!R#@"%+**;7==  -[-C-CAr-JK%**=9?? $(#9#9%'@$&)8 E  %s   Fc           	      4    U R                  SS[        SSSS9  g)zvAdds flags required to remove a backup rule.

Args:
  parser: argparse.Parser: Parser object for command line inputs.
z--remove-backup-ruleFzName of an existing backup rule to be removed from the Backup Plan. This flag can be repeated to remove more backup rules.
          r   zRULE-ID)rk   r   r   r   r   Nr   r   s    rD   AddRemoveBackupRulerD    s-     	   
rC   c                 N    U R                  SS[        R                  " 5       SS9  g)z~Adds flags required to add backup rules from a file.

Args:
  parser: argparse.Parser: Parser object for command line inputs.
z--backup-rules-from-fileFz4Path to a YAML or JSON file containing backup rules.r   N)r   r   FileContentsr   s    rD   AddBackupRulesFromFilerG    s,     	 ##%A	  rC   c                 0    U R                  SS[        SS9  g)z>Adds a max-custom-on-demand-retention-days argument to parser.z%--max-custom-on-demand-retention-daysFzConfigure the maximum retention period for on-demand backups.
          The value must be greater than or equal to the minimum enforced
          retention period set on the backup vault.r   Nr   r   s    rD   !AddMaxCustomOnDemandRetentionDaysrI    s#    -7	  rC   )F)r|   N)NTr   )T)I__doc__argparser)  typingr   
frozendictgooglecloudsdk.callioper   r   r    googlecloudsdk.calliope.conceptsr   r   #googlecloudsdk.command_lib.backupdrr	   (googlecloudsdk.command_lib.util.conceptsr
   r   googlecloudsdk.corer   r2  r,  r/  r+  r3  rE   rG   rR   rZ   r\   r^   re   rg   rq   rt   rw   r   r   r   r   r   r   rP   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r9  ArgumentParserr>  rB  rD  rG  rI  rB   rC   rD   <module>rT     s   $     + / ( 5 1 4 D G * %%'  ##%  H =:  z		-`@(FV4$ I

	M8,26G

7S 7t
$CL> 7 7 >B?D&	rC   