
    E                        S r SSKJr  SSKJr  SSKJr  SSK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r     S'S jr   S(S jr   S)S jr         S*S jr   S)S jrS+S jr   S(S jr   S,S jrS rS r     S'S jrS+S jr     S-S jr!        S.S jr"S r#S-S jr$S r%S r&   S(S jr'S+S  jr(S! r)       S/S" jr* S+S# jr+S0S$ jr,  S1S% jr-   S(S& jr.g)2zHReducer functions to generate instance props from prior state and flags.    )absolute_import)division)unicode_literalsN)api_util)	constants)
exceptions)	instances)arg_parsers)
properties)filesc                 0   [        USLUSLUSLUSLUSL/5      nU(       d  gU R                  5       nUb  Xl        Ub  XGl        Ub8  U R                  R                  R                  UR                  5       5      Ul        U(       a  X7l        Ub  XWl	        U$ )a  Generates the Active Directory configuration for the instance.

Args:
  sql_messages: module, The messages module that should be used.
  domain: string, the Active Directory domain value.
  mode: string, the Active Directory mode value.
  dns_servers: list of strings, the list of dns servers.
  admin_credential_secret_key: string, the name of the admin credential secret
    manager key.
  organizational_unit: string, the organizational unit value.

Returns:
  sql_messages.SqlActiveDirectoryConfig object.
N)
anySqlActiveDirectoryConfigdomainadminCredentialSecretNameModeValueValuesEnumlookup_by_nameuppermode
dnsServersorganizationalUnit)sql_messagesr   r   dns_serversadmin_credential_secret_keyorganizational_unitshould_generate_configconfigs           8lib/googlecloudsdk/api_lib/sql/instance_prop_reducers.pyActiveDirectoryConfigr   $   s    . D
$!-%   
 002&M ,'B$	77KKZZ

FK #$ 3	-    c                     Uc  Uc  Uc  gU R                  5       nUb  Xl        Ub  [        R                  " U5      S-   Ul        Ub  [        R                  " U5      S-   Ul        U$ )ai  Generates the Audit configuration for the instance.

Args:
  sql_messages: module, The messages module that should be used.
  bucket: string, the GCS bucket name.
  retention_interval: duration, how long to keep generated audit files.
  upload_interval: duration, how often to upload generated audit files.

Returns:
  sql_messages.SqlServerAuditConfig object.
Ns)SqlServerAuditConfigbucketsix	text_typeretentionIntervaluploadInterval)r   r$   retention_intervalupload_intervalr   s        r   r#   r#   U   sn      ^*27N,,.&M#"}}-?@3FF MM/:S@F	-r    c                     U(       a  U R                  SSS9$ Uc  Uc  gU R                  5       nUb  Xl        Ub  X$l        U$ )ab  Generates the Entra ID configuration for the SQL Server instance.

Args:
  sql_messages: module, The messages module that should be used.
  tenant_id: string, the Entra ID tenant ID.
  application_id: string, the Entra ID application ID.
  clear_entraid_config: If true, clear the Entra ID config.

Returns:
  sql_messages.SqlServerEntraIdConfig object.
 )tenantIdapplicationIdN)SqlServerEntraIdConfigr-   r.   )r   	tenant_idapplication_idclear_entraid_configr   s        r   r/   r/   s   s_    $ .. /  
 N2..0&O)	-r    c
           	         [        USLUUSLUSLUSLUSLU(       + /5      n
U
(       d  gU(       a  UR                  R                  (       d  U R                  SSUS9nOUR                  R                  nUR                  U R                  R
                  R                  :H  nU	(       a  U(       a  [        R                  " S5      eUb  X;l	        SUl
        U(       a  XKl        SUl
        Ub[  UR                  =(       d    U R                  5       nU R                  R                  R                  Ul        X}l        Xl        SUl
        Ub  Xl        SUl
        U(       d-  Uc  U(       d  Uc  Ub  [        R                  " S5      eSUl
        Ub  X[l        Ub  Xkl        UR*                  b  UUl        U(       a8  UR&                  (       d'  UR(                  (       d  [        R                  " S	5      eU$ )
a  Generates the backup configuration for the instance.

Args:
  sql_messages: module, The messages module that should be used.
  instance: sql_messages.DatabaseInstance, the original instance, if the
    previous state is needed.
  backup_enabled: boolean, True if backup should be enabled.
  backup_location: string, location where to store backups by default.
  backup_start_time: string, start time of backup specified in 24-hour format.
  enable_bin_log: boolean, True if binary logging should be enabled.
  enable_point_in_time_recovery: boolean, True if point-in-time recovery
    (using write-ahead log archiving) should be enabled.
  retained_backups_count: int, how many backups to keep stored.
  retained_transaction_log_days: int, how many days of transaction logs to
    keep stored.
  patch_request: boolean, True if this is a patch request.

Returns:
  sql_messages.BackupConfiguration object, or None

Raises:
  ToolException: Bad combination of arguments.
Nzsql#backupConfigurationz00:00)kind	startTimeenabledzZBackup configuration cannot be changed for instances with a BackupDR backup plan attached.TzArgument --no-backup not allowed with --backup-location, --backup-start-time, --retained-backups-count, or --retained-transaction-log-daysFzArgument --retained-transaction-log-days only valid when transaction logs are enabled. To enable transaction logs, use --enable-bin-log for MySQL, and use --enable-point-in-time-recovery for Postgres and SQL Server.)r   settingsbackupConfigurationBackupConfiguration
backupTierBackupTierValueValuesEnumENHANCEDsql_exceptionsArgumentErrorlocationr6   r5   backupRetentionSettingsBackupRetentionSettingsRetentionUnitValueValuesEnumCOUNTretentionUnitretainedBackupstransactionLogRetentionDaysbinaryLogEnabledpointInTimeRecoveryEnabledreplicationLogArchivingEnabled)r   instancebackup_enabledbackup_locationbackup_start_timeenable_bin_logenable_point_in_time_recoveryretained_backups_countretained_transaction_log_dayspatch_requestr   backup_configgcbdr_managedbackup_retention_settingss                 r   r9   r9      s   F T!D #4/D(#4/
   
 	**>> 44& 5  M
 %%99M 		)	)	C	C	L	LM 
 }

&
&	! 
  , M/ M'-- 	/,,.  /;.R.R.o.o.u.u+0F-,E) M".0M- M	#'8*%1((,- - "M%3""./L,33?
' 2 $,,66

&
&	'  
r    c                     / nU(       aB  [        UR                  5       5       H#  u  pVUR                  U R                  XVS95        M%     U$ U(       a  / nU$ U(       a  UR                  nU$ )ap  Generates the database flags for the instance.

Args:
  sql_messages: module, The messages module that should be used.
  settings: sql_messages.Settings, the original settings, if the previous
    state is needed.
  database_flags: dict of flags.
  clear_database_flags: boolean, True if flags should be cleared.

Returns:
  list of sql_messages.DatabaseFlags objects
namevalue)sorteditemsappendDatabaseFlagsdatabaseFlags)r   r7   database_flagsclear_database_flagsupdated_flagsrX   rY   s          r   r]   r]     sr      - 4 4 67<5545MN 8 
 M 
 **M	r    c                 f    / nU(       a'  U H!  nUR                  U R                  US95        M#     U$ )zGenerates the tags for the instance.

Args:
  sql_messages: module, The messages module that should be used.
  tags: list of tags.

Returns:
  list of sql_messages.Tags objects
)tag)r\   Tags)r   tagsupdated_tagsrc   s       r   rd   rd   /  s:     ,	,+++45  
r    c                 p   UnUnUn[        XVU/5      (       d  gU R                  SS9nU(       a,  UR                  (       a  UR                  R                  (       d#  Uc  Uc  Uc  Ub  [        R
                  " SS5      eU(       ai  U R                  R                  R                  U R                  R                  R                  U R                  R                  R                  S.n	X   Ul
        U(       a7  [        R                  R                  R                  U5      n
U
S:X  a  Sn
Xl        Ub  Xxl        U$ )a=  Generates the maintenance window for the instance.

Args:
  sql_messages: module, The messages module that should be used.
  instance: sql_messages.DatabaseInstance, The original instance, if it might
    be needed to generate the maintenance window.
  maintenance_release_channel: string, which channel's updates to apply.
  maintenance_window_day: string, maintenance window day of week.
  maintenance_window_hour: int, maintenance window hour of day.

Returns:
  sql_messages.MaintenanceWindow or None

Raises:
  argparse.ArgumentError: no maintenance window specified.
Nzsql#maintenanceWindow)r4   zlThere is currently no maintenance window on the instance. To add one, specify values for both day, and hour.)week5
productionpreviewr      )r   MaintenanceWindowr7   maintenanceWindowargparser>   UpdateTrackValueValuesEnumrh   stablecanaryupdateTrackr
   	DayOfWeekDAYSindexdayhour)r   rJ   maintenance_release_channelmaintenance_window_daymaintenance_window_hourchannelrv   rw   maintenance_windownamesday_nums              r   rl   rl   A  s(   * ('#	 $	gD!	"	"#55" 6 $
 (++



-
-	)	#/""
 ?@ @  **EEKK**EELL**EELLE &+^"##((..s3G!|g$	"	r    c                 b   SnU(       ac  UR                   (       aR  UR                   R                  (       a7  UR                   R                  S   (       a  UR                   R                  S   nU R                  5       nU(       aL  UnU(       a  [        U5        X&l        U(       a  [        U5        X6l        U(       a  [        U5        XFl        U$ U(       a  U(       d  [        R                  " SS5      e[        U5        X&l        [        U5        X6l        U(       a  [        U5        XFl        U$ )a  Generates the deny maintenance period for the instance.

Args:
  sql_messages: module, The messages module that should be used.
  instance: sql_messages.DatabaseInstance, The original instance, if it might
    be needed to generate the deny maintenance period.
  deny_maintenance_period_start_date: date, Date when the deny maintenance
    period begins, i.e., 2020-11-01.
  deny_maintenance_period_end_date: date, Date when the deny maintenance
    period ends, i.e., 2021-01-10.
  deny_maintenance_period_time: Time when the deny maintenance period
    starts/ends, i.e., 05:00:00.

Returns:
  sql_messages.DenyMaintenancePeriod or None

Raises:
  argparse.ArgumentError: invalid deny maintenance period specified.
Nr   zqThere is no deny maintenance period on the instance. To add one, specify values for both start date and end date.)
r7   denyMaintenancePeriodsDenyMaintenancePeriodValidateDate	startDateendDate	ValidTimetimern   r>   )r   rJ   "deny_maintenance_period_start_date deny_maintenance_period_end_datedeny_maintenance_period_timeold_deny_maintenance_perioddeny_maintenance_periods          r   r   r     s   0 !%8$$....q1"*"3"3"J"J1"M(>>@ 9)56*L''34(H%#,-%A"" 
!  /,""
 JK K 34(J%12&F##,-%A"	  r    c                      [         R                   R                  U S5        g ! [         a    [        R                  " S S5      ef = f)Nz%H:%M:%Sz2Invalid time value. The format should be HH:mm:SS.datetimestrptime
ValueErrorrn   r>   r"   s    r   r   r     sJ    Dq*-	 D

 
 BD DDs	    # "Ac                      [         R                   R                  U S5      $ ! [         aI     [         R                   R                  U S5      s $ ! [         a    [        R                  " S S5      ef = ff = f)Nz%Y-%m-%dz%m-%dz=Invalid date value. The format should be yyyy-mm-dd or mm-dd.r   r   s    r   r   r     s}    Q%%a44	 QQ''733 Q""
OQ QQQs    " 
A5AA5"A11A5c                     [        USLUSLUSLUSLUSL/5      nU(       d  gU R                  5       nUb  UUl        Ub  X'l        Ub  UUl        Ub  XGl        Ub  XWl        U$ )a  Generates the insights config for the instance.

Args:
  sql_messages: module, The messages module that should be used.
  insights_config_query_insights_enabled: boolean, True if query insights
    should be enabled.
  insights_config_query_string_length: number, length of the query string to
    be stored.
  insights_config_record_application_tags: boolean, True if application tags
    should be recorded.
  insights_config_record_client_address: boolean, True if client address
    should be recorded.
  insights_config_query_plans_per_minute: number, number of query plans to
    sample every minute.

Returns:
  sql_messages.InsightsConfig or None
N)r   InsightsConfigqueryInsightsEnabledqueryStringLengthrecordApplicationTagsrecordClientAddressqueryPlansPerMinute)r   &insights_config_query_insights_enabled#insights_config_query_string_length'insights_config_record_application_tags%insights_config_record_client_address&insights_config_query_plans_per_minuter   insights_configs           r   r   r     s    2 ,D8)5-T9+47,D8   
  !//1/+7. ((4(K%,8/ )*6*O'+7*P'	r    c                 (    Uc  gU R                  US9$ )z?Generates the db aligned atomic writes Config for the instance.N)dbAlignedAtomicWrites)DbAlignedAtomicWritesConfig)r   db_aligned_atomic_writess     r   r   r     s&    %		1	14 
2 
 r    c                 4   [        USL USL USL /5      (       a  gU=(       d    U R                  5       nUb  Xl        UbJ  / n[        UR	                  5       5       H#  u  pxUR                  U R                  XxS95        M%     Xel        U$ U(       a  / Ul        U$ )z9Generates the connection pooling config for the instance.NrW   )allConnectionPoolConfigconnectionPoolingEnabledrZ   r[   r\   ConnectionPoolFlagsflags)	r   enable_connection_poolingconnection_pool_flagsclear_connection_pool_flagscurrent_configconnection_pool_configra   rX   rY   s	            r   r   r     s     	4't#!T)
  
 )P\-N-N-P*6O3&M399;<

*
*
*
B = $1  
  ##% 	r    c	           
         [        USL USL USL USL USL USL USL /5      (       a  gU=(       d    U R                  5       n	Ub  U(       a  SU	l        OU R                  SS9$ Ub  X)l        Ub  X9l        UbJ  / U	l        UR                  5        H/  u  n
nU	R
                  R                  U R                  U
US95        M1     Ub  XYl	        Ub  UU	l
        Ub  UU	l        U	$ )z;Generates the read pool auto-scale config for the instance.NTF)r6   )metrictargetValue)r   ReadPoolAutoScaleConfigr6   minNodeCountmaxNodeCounttargetMetricsr[   r\   TargetMetricdisableScaleInscaleInCooldownSecondsscaleOutCooldownSeconds)r   auto_scale_enabledauto_scale_min_node_countauto_scale_max_node_countauto_scale_target_metricsauto_scale_disable_scale_inauto_scale_in_cooldown_secondsauto_scale_out_cooldown_secondsr   read_pool_auto_scale_configr   rY   s               r   r   r   3  s?    	D 4'4'4'!T)$,%-
   ><<>  #,0!) 11%1@@*/H,*/H,*02- 
#	(	(	*	!//66

#
# $  
+ !,1L.#/&  6 %0'  7 
%$r    c                 (    SR                  X5      nU$ )a!  Creates a custom machine type from the CPU and memory specs.

Args:
  cpu: the number of cpu desired for the custom machine type
  memory_mib: the amount of ram desired in MiB for the custom machine type
    instance

Returns:
  The custom machine type name for the 'instance create' call
zdb-custom-{0}-{1})format)cpu
memory_mibmachine_types      r   _CustomMachineTypeStringr   o  s     %++C<,	r    c                 J   SnU(       a  UnU(       d  U(       ak  U(       d  [         R                  " SS5      eU(       d  [         R                  " SS5      eU(       a  [         R                  " SS5      e[        UUS-  5      nUnU(       d  U (       d  [        R
                  nU$ )a  Generates the machine type for the instance.

Adapted from compute.

Args:
  instance: sql_messages.DatabaseInstance, The original instance, if it might
    be needed to generate the machine type.
  tier: string, the v1 or v2 tier.
  memory: string, the amount of memory.
  cpu: int, the number of CPUs.

Returns:
  A string representing the URL naming a machine-type.

Raises:
  exceptions.RequiredArgumentException when only one of the two custom
      machine type flags are used, or when none of the flags are used.
  exceptions.InvalidArgumentException when both the tier and
      custom machine type flags are used to generate a new instance.
Nz--cpuzQBoth [--cpu] and [--memory] must be set to create a custom machine type instance.z--memoryz--tierzFCannot set both [--tier] and [--cpu]/[--memory] for the same instance.i   )r   RequiredArgumentExceptionInvalidArgumentExceptionr   r   DEFAULT_MACHINE_TYPE)rJ   tiermemoryr   r   custom_type_strings         r   MachineTyper   ~  s    . ,	L 	F00
 :; ; 00
 => > //
 67 7 25 &L 
h11L	r    c                 @    U R                  SSR                  X5      S9$ )aM  Generates the external primary configuration for the instance.

Args:
  sql_messages: module, The messages module that should be used.
  source_ip_address: string, the IP address of the external data source.
  source_port: number, the port number of the external data source.

Returns:
  sql_messages.OnPremisesConfiguration object.
zsql#onPremisesConfigurationz{0}:{1})r4   hostPort)OnPremisesConfigurationr   )r   source_ip_addresssource_ports      r   r   r     s0     
	-	-( 1? 
. 
A Ar    c                     [         R                  " [         R                  5      nUR                  R	                  U S[
        R                  R                  R                  R                  0SS9nUR                  5       $ )zGenerates the self-link of the instance's private network.

Args:
  network: The ID of the network.

Returns:
  string, the URL of the network.
projectcompute.networks)params
collection)common_api_util	SqlClientAPI_VERSION_DEFAULTresource_parserParser   VALUEScorer   	GetOrFailSelfLink)networkclientnetwork_refs      r   PrivateNetworkUrlr     sp     $$_%H%HI&&&,,
Z&&++33== $ - %+ 
			r    c                 .   U R                  SUUUR                  5       S9nU(       a  [        R                  " U5      Ul        U(       a  [        R                  " U5      Ul        U(       a  [        R                  " U5      Ul        U R                  SUS9$ )a  Generates the config for an external primary replica.

Args:
  sql_messages: module, The messages module that should be used.
  primary_username: The username for connecting to the external instance.
  primary_password: The password for connecting to the external instance.
  primary_dump_file_path: ObjectReference, a wrapper for the URI of the Cloud
    Storage path containing the dumpfile to seed the replica with.
  primary_ca_certificate_path: The path to the CA certificate PEM file.
  client_certificate_path: The path to the client certificate PEM file.
  client_key_path: The path to the client private key PEM file.

Returns:
  sql_messages.MySqlReplicaConfiguration object.
zsql#mysqlReplicaConfiguration)r4   usernamepassworddumpFilePathz)sql#demoteMasterMysqlReplicaConfiguration)r4   mysqlReplicaConfiguration)MySqlReplicaConfigurationToUrlr   ReadFileContentscaCertificateclientCertificate	clientKeyReplicaConfiguration)r   primary_usernameprimary_passwordprimary_dump_file_pathprimary_ca_certificate_pathclient_certificate_pathclient_key_pathmysql_replica_configurations           r   r   r     s    , !- F F*)//1	 !G !3
 !050F0F#1%-494J4J5!1,1,B,B-)		*	*6 ; 
+ 
= =r    c                     U(       aN  U(       aG  [         R                  " U5      n[         R                  " U5      nX4:w  a  [        R                  " S5      eU(       a  [         R                  " U5      nU$ U $ )a;  Generates the region string for the instance.

Args:
  specified_region: string, the GCE region to create the instance in.
  gce_zone: string, the GCE zone to create the instance in.
  secondary_zone: string, the GCE zone to create the standby instance in.

Returns:
  string, the region to create the instance in.
zKZones in arguments --zone and --secondary-zone belong to different regions.)r   GetRegionFromZoner   ConflictingArgumentsException)specified_regiongce_zonesecondary_zoneregion_from_zoneregion_from_secondary_zonederived_regions         r   Regionr    sj     .11(;!)!;!;N!K544)* * //9N	r    c                 x    U(       a3  U R                   R                  R                  UR                  5       5      $ g N)PasswordValidationPolicyComplexityValueValuesEnumr   r   )r   
complexitys     r   _ParseComplexityr	    s3    00JJYY 	r    c           	         [        USLUSLUSLUSLUSLUSL/5      nU(       a  U(       a  gU R                  5       n	Ub  Xl        Ub  [        U U5      U	l        Ub  X9l        Ub  XIl        Ub  [        U5      S-   U	l        Ub  Xil	        U	$ )a$  Generates or clears password policy for the instance.

Args:
  sql_messages: module, The messages module that should be used.
  password_policy_min_length: int, Minimum number of characters allowed.
  password_policy_complexity: string, The complexity of the password.
  password_policy_reuse_interval: int, Number of previous passwords that
    cannot be reused.
  password_policy_disallow_username_substring: boolean, True if disallow
    username as a part of the password.
  password_policy_password_change_interval: duration, Minimum interval at
    which password can be changed.
  enable_password_policy: boolean, True if password validation policy is
    enabled.
  clear_password_policy: boolean, True if clear existing password policy.

Returns:
  sql_messages.PasswordValidationPolicy or None
Nr"   )
r   r  	minLengthr	  r  reuseIntervaldisallowUsernameSubstringstrpasswordChangeIntervalenablePasswordPolicy)
r   password_policy_min_lengthpassword_policy_complexitypassword_policy_reuse_interval+password_policy_disallow_username_substring(password_policy_password_change_intervalenable_password_policyclear_password_policyshould_generate_policypassword_policys
             r   PasswordPolicyr  !  s    :  , ,$D01=.d:D(   
 #8 !99;/+ :+!1,2L"NO#/$B!0<0[--9-00.247.8O*'+A(	r    c                    / nU H  nU R                  5       nUR                  S5      Ul        UR                  S5      =n(       a  XTl        OY[        R
                  " [        R                  5      nUR                  R                  UR                  SS9nUR                  Ul        UR                  (       a$  UR                  (       a  UR                  U5        M  [        R                  " SS5      e   U$ )al  Generates PSC auto connections for the instance.

Args:
  sql_messages: module, The messages module that should be used.
  psc_auto_connections: dict of the allowed consumer projects and networks.

Returns:
  list of sql_messages.PscAutoConnectionConfig objects

Raises:
  exceptions.InvalidArgumentException when there is no valid network or
  project specified.
r   r   r   )r   z--psc-auto-connectionsz0PSC auto connection must have network specified.)PscAutoConnectionConfiggetconsumerNetworkconsumerProjectr   r   r   r   ParseRelativeNamer   r\   r   r   )r   psc_auto_connectionsupdated_psc_auto_connections
connectioncurrent_psc_auto_connectionr   r   r   s           r   PscAutoConnectionsr%  ^  s    " "$(j"."F"F"H2<..2K/..++w+4;1(()L)LMf**<<
%
5
5' = k 5@4G4G!1 	$33'77"))*EF//
" % ) )0 
&%r    c                    / nU(       a  U H}  n UR                  SS5      u  pVUR                  SS5      u  pxUR                  U R                  UUU R                  R                  R                  UR                  5       5      S95        M     U$ U(       a  / nU$ ! [         a  n	[        S5      U	eSn	A	f[         a  n	[        S5      U	eSn	A	ff = f)a$  Generates the database flags for the instance.

Args:
  sql_messages: module, The messages module that should be used.
  unc_mappings: input unc mappings from the user.
  clear_unc_mappings: boolean, True if unc mappings should be cleared.

Returns:
  list of sql_messages.UncMapping objects
:   =)uncPathgcsPathr   z=Invalid UNC mapping input. Expected 'unc-path=gcs-path:mode'.Nz;Invalid mode. Expected 'snapshot_read' or 'snapshot_write'.)	rsplitsplitr\   
UncMappingr   r   r   r   KeyError)
r   unc_mappingsclear_unc_mappingsupdated_mappingsmapping_strrestmode_strunc_pathgcs_pathes
             r   UncMappingsr9    s     #$++C3!ZZQ/##  !,,@@OONN$ $ 	
	 $0 
 	  K
	  I
	s$   A9B
C$B00C=C		Cc           	         Uc  gU=(       d    U R                  5       nSS0nSSSSSS.n[        UR                  5       5       Hp  u  pgXd;   a"  [        X4U   UR	                  5       S	:H  5        M,  Xe;   a   [        X5U   [        U5      5        ML  [        R                  " S
SR                  U5      5      e   U$ ! [         a'    [        R                  " S
SR                  Xg5      5      ef = f)a  Generates the performance capture config for the instance.

Args:
  sql_messages: module, The messages module that should be used.
  performance_capture_config: dict of the performance capture config.
  current_config: sql_messages.PerformanceCaptureConfig, the original
    performance capture config, if the previous state is needed.

Returns:
  sql_messages.PerformanceCaptureConfig object, or None

Raises:
  exceptions.InvalidArgumentException: If an unknown key is provided in
    performance_capture_config.
Nr6   probingIntervalSecondsprobeThresholdrunningThreadsThresholdsecondsBehindSourceThresholdtransactionDurationThreshold)zprobing-interval-secondszprobe-thresholdzrunning-threads-thresholdzseconds-behind-source-thresholdztransaction-duration-thresholdtruez--performance-capture-configz(Invalid integer value for key [{0}]: {1}zUnknown key: {0})
PerformanceCaptureConfigrZ   r[   setattrlowerintr   r   r   r   )r   performance_capture_configr   r   	bool_keysint_keyskeyrY   s           r   rA  rA    s    *  'D\BBD& ) #;)#<)G(F( 5;;=>jc
fnekkmv&=>	
s5z2 //
(*<*C*CC*H  ?  
-  
11*6==cI
 	

s   5B991C*c                 d   [        USLUSL/5      nU(       d  gUb   U(       d  Ub  [        R                  " S5      eU(       a  UR                  R                  (       d  U R                  5       nOUR                  R                  nUb  X%l        Ub  X5l        SUl        Ub  U(       d  SUl        U$ )a
  Generates the Final Backup configuration for the instance.

Args:
  sql_messages: module, The messages module that should be used.
  instance: sql_messages.DatabaseInstance, the original instance, if the
    previous state is needed.
  final_backup_enabled: boolean, True if final backup should be enabled.
  final_backup_retention_days: int, how many days to retain the final backup.

Returns:
  sql_messages.FinalBackupConfiguration object, or None

Raises:
  sql_exceptions.ArgumentError: Bad combination of arguments.
NzPYou cannot set final-backup-retention-days while final-backup field is disabled.T)r   r=   r>   r7   finalBackupConfigFinalBackupConfigr6   retentionDays)r   rJ   final_backup_enabledfinal_backup_retention_daysr   final_backup_configs         r   FinalBackupConfigurationrP    s    * $&!-  
 
  %.B".((
\  
**<<&88:"++== %"6 ,(C%"& %.B(,%	r    )NNNNN)NNN)NNF)	NNNNNNNNFr  )NNz00:00:00)NNNN)NNNNNNNN)NNNNNNN)NF)NN)/__doc__
__future__r   r   r   rn   r   googlecloudsdk.api_lib.sqlr   r   r   r   r=   r	   googlecloudsdk.callioper
   googlecloudsdk.corer   googlecloudsdk.core.utilr   r%   r   r#   r/   r9   r]   rd   rl   r   r   r   r   r   r   r   r   r   r   r   r   r  r	  r  r%  r9  rA  rP   r    r   <module>rX     s   O '  '   B 0 C < / . * * 

 	 $.d !%,0)-@ 	 J "&"&z|  !%',8( 37-1.2	;@ >B;?7A	>!BDQ ;?7;;?9=:>2j # $ H """ $#'$(9%x5pA  . 6:15)-&=R0  $##'04-1:~ *&Z%T  $6v  $	6r    