
                            S 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  SS
KJr  SSKJr  SSKJr  SSS.r " S S\5      r\
R,                  " \
R.                  R0                  5       " S S\\
R2                  5      5       r\
R,                  " \
R.                  R6                  5       " S S\\
R2                  5      5       rg)z?Command to update connection profiles for a database migration.    )absolute_import)division)unicode_literals)api_util)connection_profiles)resource_args)base)flags)oracle_flags)sqlserver_flags)
console_ioa	  
        Update a Database Migration Service connection profile.
        - Draft connection profile: the user can update all flags available in
        `connection-profiles create` command.
        - Existing connection profile: the user can update a limited list of
        flags, see `connection-profiles update` Synopsis.
        - If a migration job is using the connection profile, then updates to
        fields `host`, `port`, `username`, and `password` will propagate to the
        destination instance.
        z        To update the username of a connection profile:

            $ {command} my-profile --region=us-central1
            --username=new-user
        )DESCRIPTIONEXAMPLESc                   2    \ rS rSrSr\r\S 5       rS r	Sr
g)_Update5   7Update a Database Migration Service connection profile.c                    [         R                  " U S5        [        R                  " U 5        [        R                  " U 5        [        R
                  " U 5        [        R                  " U 5        [        R                  " U 5        [        R                  " U 5        [        R                  " U 5        [        R                  " U 5        [        R                  " U 5        g)zArgs is called by calliope to gather arguments for this command.

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 updateN)r   AddConnectionProfileResourceArgcp_flagsAddDisplayNameFlagAddUsernameFlagAddPasswordFlagGroupAddHostFlagAddPortFlagAddDbmPortFlagAddCaCertificateFlagAddPrivateKeyFlagr
   AddLabelsUpdateFlagsparsers    <lib/surface/database_migration/connection_profiles/update.pyArgs_Update.Args:   s     11&+F'V$!!&)  F#!!&)v&	v&    c                    UR                   R                  R                  5       nUR                  (       a  [        R
                  " S5      Ul        [        R                  " U R                  5       5      nUR                  UR                  5       U5      n[        R                  " U R                  5       5      n[        R                  " U R                  5       5      n[        R                  " U R                  5       5      nUR!                  SUR"                  UR$                  UR&                  S9nUR(                  R+                  UR-                  UR.                  S95      $ )a  Update a Database Migration Service connection profiles.

Args:
  args: argparse.Namespace, The arguments that this command was invoked
    with.

Returns:
  A dict object representing the operations resource describing the create
  operation if the create was successful.
zPlease Enter Password: z+datamigration.projects.locations.operations)operationsId
projectsIdlocationsId)name)CONCEPTSconnection_profileParseprompt_for_passwordr   PromptPasswordpasswordr   ConnectionProfilesClientReleaseTrackUpdateRelativeNamer   GetClientInstanceGetMessagesModuleGetResourceParserCreater*   r(   r)   projects_locations_operationsGet2DatamigrationProjectsLocationsOperationsGetRequestr'   )	selfargsconnection_profile_ref	cp_clientresult_operationclientmessagesresource_parseroperation_refs	            r"   Run_Update.RunN   s-    "]]==CCE //0IJdm#<<I ''(>(K(K(M(,. ''(9(9(;<F))$*;*;*=>H001B1B1DEO#**5%**)44*66	 + 8M //33CC++ 	D 	-. .r%    N)__name__
__module____qualname____firstlineno____doc__DETAILED_HELPdetailed_helpstaticmethodr#   rE   __static_attributes__rG   r%   r"   r   r   5   s!    ?-' '&!.r%   r   c                   (    \ rS rSrSr\S 5       rSrg)UpdateAlphar   r   c                     [         R                  U 5        [        R                  " U 5        [        R                  " U 5        g )N)r   r#   r   AddCertificateFlagAddInstanceFlagr    s    r"   r#   UpdateAlpha.Argsv   s*    LL'V$r%   rG   NrH   rI   rJ   rK   rL   rO   r#   rP   rG   r%   r"   rR   rR   r   s    ?% %r%   rR   c                   (    \ rS rSrSr\S 5       rSrg)UpdateGA}   r   c                    [         R                  U 5        [        R                  " U 5        [        R                  " U 5        [        R
                  " U 5        [        R                  " U SS S9  [        R                  " U 5        [        R                  " U 5        [        R                  " U 5        [        R                  " U SS9  [        R                  " U 5        g )NF)hiddenchoices)required)r   r#   r   AddClientCertificateFlagAddCloudSQLInstanceFlagAddAlloydbClusterFlagAddSslTypeFlagr   AddSourceUpdateFlagAddCloudSqlProjectIdFlagAddDatabaseFlagr   AddDatabaseServiceFlagAddEnableIamAuthenticationFlagr    s    r"   r#   UpdateGA.Args   s    LL%%f-$$V,""6*ud ''/,,V4V$''?++F3r%   rG   NrX   rG   r%   r"   rZ   rZ   }   s    ?4 4r%   rZ   N)rL   
__future__r   r   r   )googlecloudsdk.api_lib.database_migrationr   r   r   googlecloudsdk.callioper	   -googlecloudsdk.command_lib.database_migrationr
   Agooglecloudsdk.command_lib.database_migration.connection_profilesr   r   r   googlecloudsdk.core.consoler   rM   objectr   ReleaseTracksr2   ALPHACommandrR   GArZ   rG   r%   r"   <module>ru      s    F &  ' > I C ( ? _ Z ] 2			,:.f :.z D%%++,%'4<< % -% D%%(()4w 4 *4r%   