
    j#                        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rS	rS
r\R                   \R"                  " \R$                  R&                  5       " S S\R(                  5      5       5       r\R,                  " SSS9\R"                  " \R$                  R.                  5       " S S\5      5       5       rg)z5Command to update connection profiles for datastream.    )connection_profiles)util)base)flags)resource_args)
console_ioz'Updates a Datastream connection profilea}	      To update a connection profile for Oracle:

        $ {command} CONNECTION_PROFILE --location=us-central1 --type=oracle --oracle-password=fakepassword --oracle-username=fakeuser --display-name=my-profile --oracle-hostname=35.188.150.50 --oracle-port=1521 --database-service=ORCL --static-ip-connectivity

    To update a connection profile for MySQL:

        $ {command} CONNECTION_PROFILE --location=us-central1 --type=mysql --mysql-password=fakepassword --mysql-username=fakeuser --display-name=my-profile --mysql-hostname=35.188.150.50 --mysql-port=3306 --static-ip-connectivity

    To update a connection profile for PostgreSQL:

        $ {command} CONNECTION_PROFILE --location=us-central1 --type=postgresql --postgresql-password=fakepassword --postgresql-username=fakeuser --display-name=my-profile --postgresql-hostname=35.188.150.50 --postgresql-port=5432 --postgresql-database=db --static-ip-connectivity

    To update a connection profile for SQL Server:

        $ {command} CONNECTION_PROFILE --location=us-central1 --type=sqlserver --sqlserver-password=fakepassword --sqlserver-username=fakeuser --display-name=my-profile --sqlserver-hostname=35.188.150.50 --sqlserver-port=1433 --sqlserver-database=db --static-ip-connectivity

    To update a connection profile for Salesforce:

        $ {command} CONNECTION_PROFILE --location=us-central1 --type=salesforce --salesforce-password=fakepassword --salesforce-username=fakeuser --display-name=my-profile --salesforce-domain=fakecompany.my.salesforce.com --static-ip-connectivity

    To update a connection profile for Spanner:

        $ {command} CONNECTION_PROFILE --location=us-central1 --type=spanner --spanner-host=https://spanner.us-central1.rep.googleapis.com --display-name=my-profile

    To update a connection profile for Google Cloud Storage:

        $ {command} CONNECTION_PROFILE --location=us-central1 --type=google-cloud-storage --bucket=fake-bucket --root-path=/root/path --display-name=my-profile

    To update a connection profile for BigQuery:

        $ {command} CONNECTION_PROFILE --location=us-central1 --type=bigquery --display-name=my-profile

    To update a connection profile for MongoDB:

        $ {command} CONNECTION_PROFILE --location=us-central1 --type=mongodb --mongodb-password=fakepassword --mongodb-username=fakeuser --display-name=my-profile --mongodb-host-addresses=35.188.150.50:27017 --static-ip-connectivity

   aD      To update a connection profile for Oracle:

        $ {command} CONNECTION_PROFILE --location=us-central1 --type=oracle --oracle-password=fakepassword --oracle-username=fakeuser --display-name=my-profile --oracle-hostname=35.188.150.50 --oracle-port=1521 --database-service=ORCL --static-ip-connectivity

    To update a connection profile for MySQL:

        $ {command} CONNECTION_PROFILE --location=us-central1 --type=mysql --mysql-password=fakepassword --mysql-username=fakeuser --display-name=my-profile --mysql-hostname=35.188.150.50 --mysql-port=3306 --static-ip-connectivity

    To update a connection profile for Google Cloud Storage:

        $ {command} CONNECTION_PROFILE --location=us-central1 --type=google-cloud-storage --bucket-name=fake-bucket --root-path=/root/path --display-name=my-profile --no-connectivity
   c                   H    \ rS rSrSr\\S.r\S 5       r	\S 5       r
S rSrg)	UpdateQ   'Update a Datastream connection profile.DESCRIPTIONEXAMPLESc                    [         R                  " U SUSS9  [        R                  " U 5        [        R                  " U SS9  U[
        R                  R                  :X  a  [        R                  " U S5        U R                  SS9n[        R                  " USS9  [        R                  " USS9  [        R                  " USS9  [        R                  " USS9  [        R                  " USS9  [        R                  " U5        [        R                   " X!SS9  [        R"                  " USS9  [$        R&                  " U 5        g)a  Common arguments for all release tracks.

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.
  release_track: Some arguments are added based on the command release
    track.
z	to updateF)requiredr
   T)mutexN)r   AddConnectionProfileResourceArgcp_flagsAddTypeFlagAddDisplayNameFlagr   ReleaseTrackGAAddValidationGroup	add_groupAddMysqlProfileGroupAddOracleProfileGroupAddPostgresqlProfileGroupAddSqlServerProfileGroupAddSalesforceProfileGroupAddSpannerProfileUpdateGroupAddGcsProfileGroupAddMongodbProfileGroupr   AddLabelsUpdateFlags)parserrelease_trackprofile_flagss      4lib/surface/datastream/connection_profiles/update.py
CommonArgsUpdate.CommonArgsW   s     11]U<  7)),,,!!&(3$$4$0M!!-%@""=5A&&}uE%%meD&&}uE))-8uM##MEB	v&    c                 `    [         R                  U [        R                  R                  5        gz@Args is called by calliope to gather arguments for this command.N)r
   r(   r   r   r   r$   s    r'   ArgsUpdate.Argst   s      fd//223r*   c                    UR                   R                  R                  5       nUR                  (       a  [        R
                  " S5      Ul        UR                  (       a  [        R
                  " S5      Ul        UR                  (       a  [        R
                  " S5      Ul
        UR                  (       a  [        R
                  " S5      Ul        UR                  (       a  [        R
                  " S5      Ul        UR                  (       a  [        R
                  " S5      Ul        UR                   (       a  [        R
                  " S5      Ul        UR$                  (       a  [        R
                  " S5      Ul        UR(                  R+                  5       n[,        R.                  " 5       nUR1                  UR3                  5       X0R5                  5       U5      n[6        R8                  " 5       n[6        R:                  " 5       n[6        R<                  " 5       nUR?                  SUR@                  URB                  URD                  S9n	URF                  RI                  URK                  U	RL                  S95      $ )a   Update a Datastream connection profile.

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

Returns:
  A dict object representing the operations resource describing the update
  operation if the update was successful.
zPlease Enter Password: zPlease Enter Security Token: z&Please Enter OAuth 2.0 Client Secret: z(datastream.projects.locations.operations)operationsId
projectsIdlocationsId)name)'CONCEPTSconnection_profileParseoracle_prompt_for_passwordr   PromptPasswordoracle_passwordmysql_prompt_for_passwordmysql_passwordpostgresql_prompt_for_passwordpostgresql_passwordsqlserver_prompt_for_passwordsqlserver_passwordsalesforce_prompt_for_passwordsalesforce_password$salesforce_prompt_for_security_token*salesforce_prompt_for_oauth2_client_secretsalesforce_oauth2_client_secretmongodb_prompt_for_passwordmongodb_passwordtypeupperr   ConnectionProfilesClientr
   RelativeNamer   r   GetClientInstanceGetMessagesModuleGetResourceParserCreater4   r2   r3   projects_locations_operationsGet/DatastreamProjectsLocationsOperationsGetRequestr1   )
selfargsconnection_profile_refcp_type	cp_clientresult_operationclientmessagesresource_parseroperation_refs
             r'   Run
Update.Runy   s    "]]==CCE&&'66
#%d %%&556OPd**!+!:!:
#"%d )) * 9 9
#!d **!+!:!:
#"d 00!+!:!:
)"d 66-7-F-F
2.d* ''(77
#d yy!G#<<>I ''(>(K(K(M(/1B1B1DdL ##%F%%'H,,.O#**2%**)44*66	 + 8M //33@@++ 	A 	-. .r*    N)__name__
__module____qualname____firstlineno____doc__r   r   detailed_helpstaticmethodr(   r.   r]   __static_attributes__r_   r*   r'   r
   r
   Q   s=     0"-8D-' '8 4 4A.r*   r
   FzpDatastream beta version is deprecated. Please use`gcloud datastream connection-profiles update` command instead.)
is_removedwarningc                   2    \ rS rSrSr\\S.r\S 5       r	Sr
g)
UpdateBeta   r   r   c                 `    [         R                  U [        R                  R                  5        gr,   )r
   r(   r   r   BETAr-   s    r'   r.   UpdateBeta.Args   s      fd//445r*   r_   N)r`   ra   rb   rc   rd   r   EXAMPLES_BETAre   rf   r.   rg   r_   r*   r'   rk   rk      s#     0"-=I-6 6r*   rk   N)rd   !googlecloudsdk.api_lib.datastreamr   r   googlecloudsdk.callioper   %googlecloudsdk.command_lib.datastreamr   r   9googlecloudsdk.command_lib.datastream.connection_profilesr   googlecloudsdk.core.consoler   r   r   rp   DefaultUniverseOnlyReleaseTracksr   r   Commandr
   	Deprecatern   rk   r_   r*   r'   <module>rz      s    < B 2 ( 7 ? W 28%N D%%(()g.T\\ g. * g.T G
 D%%**+6 6 ,6r*   