
    Z"                        d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl	mZ
 ddlmZ dZd	Zd
Zej                    ej"                  ej$                  j&                         G d dej(                                      Z ej,                  dd       ej"                  ej$                  j.                         G d de                    Zy)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 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                   @    e Zd ZdZeedZed        Zed        Z	d Z
y)Update'Update a Datastream connection profile.DESCRIPTIONEXAMPLESc                    t        j                  | d|d       t        j                  |        t        j                  | d       |t
        j                  j                  k(  rt        j                  | d       | j                  d      }t        j                  |d       t        j                  |d       t        j                  |d       t        j                  |d       t        j                  |d       t        j                  ||d       t        j                   |d       t#        j$                  |        y)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AddGcsProfileGroupAddMongodbProfileGroupr   AddLabelsUpdateFlags)parserrelease_trackprofile_flagss      4lib/surface/datastream/connection_profiles/update.py
CommonArgszUpdate.CommonArgsS   s     11]U<  7)),,,!!&(3$$4$0M!!-%@""=5A&&}uE%%meD&&}uE}uM##MEB	v&    c                 `    t         j                  | t        j                  j                         yz@Args is called by calliope to gather arguments for this command.N)r
   r&   r   r   r   r"   s    r%   ArgszUpdate.Argso   s      fd//223r'   c                    |j                   j                  j                         }|j                  rt	        j
                  d      |_        |j                  rt	        j
                  d      |_        |j                  rt	        j
                  d      |_
        |j                  rt	        j
                  d      |_        |j                  rt	        j
                  d      |_        |j                  rt	        j
                  d      |_        |j                   rt	        j
                  d      |_        |j$                  rt	        j
                  d      |_        |j(                  j+                         }t-        j.                         }|j1                  |j3                         || j5                         |      }t7        j8                         }t7        j:                         }t7        j<                         }|j?                  d|j@                  |jB                  |jD                        }	|jF                  jI                  |jK                  |	jL                              S )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Creater0   r.   r/   projects_locations_operationsGet/DatastreamProjectsLocationsOperationsGetRequestr-   )
selfargsconnection_profile_refcp_type	cp_clientresult_operationclientmessagesresource_parseroperation_refs
             r%   Runz
Update.Runt   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____doc__r   r   detailed_helpstaticmethodr&   r+   rY    r'   r%   r
   r
   M   s=     0"-8D-' '6 4 4A.r'   r
   FzpDatastream beta version is deprecated. Please use`gcloud datastream connection-profiles update` command instead.)
is_removedwarningc                   *    e Zd ZdZeedZed        Zy)
UpdateBetar   r   c                 `    t         j                  | t        j                  j                         yr)   )r
   r&   r   r   BETAr*   s    r%   r+   zUpdateBeta.Args   s      fd//445r'   N)	rZ   r[   r\   r]   r   EXAMPLES_BETAr^   r_   r+   r`   r'   r%   rd   rd      s#     0"-=I-6 6r'   rd   N)r]   !googlecloudsdk.api_lib.datastreamr   r   googlecloudsdk.callioper   %googlecloudsdk.command_lib.datastreamr   r   9googlecloudsdk.command_lib.datastream.connection_profilesr   googlecloudsdk.core.consoler   r   r   rg   DefaultUniverseOnlyReleaseTracksr   r   Commandr
   	Deprecaterf   rd   r`   r'   r%   <module>rq      s    < B 2 ( 7 ? W 28!F D%%(()f.T\\ f. * f.R G
 D%%**+6 6 ,6r'   