
    #                        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)z7Command to create connection profiles for a datastream.    )connection_profiles)util)base)flags)resource_args)
console_ioz&Create a Datastream connection profileaK
      To create 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 create 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 create 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 create 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 create a connection profile for Salesforce using Username, Password and Security Token:

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

    To create a connection profile for Salesforce using OAuth:

        $ {command} CONNECTION_PROFILE --location=us-central1 --type=salesforce --salesforce-client-secret=fakesecret --salesforce-client-id=fake-client-id --display-name=my-profile --salesforce-domain=fakecompany.my.salesforce.com --static-ip-connectivity

    To create 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 create a connection profile for BigQuery:

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

    To create 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

   aD      To create 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 create 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 create 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)Create'Create a Datastream connection profile.DESCRIPTIONEXAMPLESc                 b   t        j                  | d|       t        j                  |        t        j                  |        |t
        j                  j                  k(  rt        j                  | d       | j                  d      }t        j                  |       t        j                  |       t        j                  |       t        j                  |       t        j                  |       t        j                  ||       t        j                   |       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 creater
   T)mutexN)r   AddConnectionProfileResourceArgcp_flagsAddTypeFlagAddDisplayNameFlagr   ReleaseTrackGAAddValidationGroup	add_groupAddMysqlProfileGroupAddOracleProfileGroupAddPostgresqlProfileGroupAddSqlServerProfileGroupAddSalesforceProfileGroupAddGcsProfileGroupAddMongodbProfileGroupr   AddLabelsCreateFlags)parserrelease_trackprofile_flagss      4lib/surface/datastream/connection_profiles/create.py
CommonArgszCreate.CommonArgsV   s     11&+2?A  ')),,,!!&(3$$4$0M!!-0""=1&&}5%%m4&&}5}=##M2	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Create.Argsr   s      fd//223r&   c                    |j                   j                  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.                  j1                         }t3        j4                         }|j7                  ||j8                  || j;                         |      }t=        j>                         }t=        j@                         }t=        jB                         }	|	j7                  d|jD                  |jF                  |jH                        }
|jJ                  jM                  |jO                  |
jP                              S )a  Create 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 create
      operation if the create 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ParentRelativeName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_security_token*salesforce_prompt_for_oauth2_client_secretsalesforce_oauth2_client_secretmongodb_prompt_for_passwordmongodb_passwordtypeupperr   ConnectionProfilesClientr
   connectionProfilesIdr   r   GetClientInstanceGetMessagesModuleGetResourceParserr/   r-   r.   projects_locations_operationsGet/DatastreamProjectsLocationsOperationsGetRequestr,   )selfargsconnection_profile_ref
parent_refcp_type	cp_clientresult_operationclientmessagesresource_parseroperation_refs              r$   Runz
Create.Runw   s    "]]==CCE'..0==?J&&'66
#%d %%&556OPd**!+!:!:
#"%d )) * 9 9
#!d **!+!:!:
#"d 00'1'@'@
)(d$ 66-7-F-F
2.d* ''(77
#d yy!G#<<>I ''*??T# ##%F%%'H,,.O#**2%**)44*66	 + 8M //33@@++ 	A 	-. .r&   N)__name__
__module____qualname____doc__r   r   detailed_helpstaticmethodr%   r*   r[    r&   r$   r
   r
   P   s=     0"-8D-' '6 4 4C.r&   r
   FzpDatastream beta version is deprecated. Please use`gcloud datastream connection-profiles create` command instead.)
is_removedwarningc                   *    e Zd ZdZeedZed        Zy)
CreateBetar   r   c                 `    t         j                  | t        j                  j                         yr(   )r
   r%   r   r   BETAr)   s    r$   r*   zCreateBeta.Args   s      fd//445r&   N)	r\   r]   r^   r_   r   EXAMPLES_BETAr`   ra   r*   rb   r&   r$   rf   rf      s#     0"-=I-6 6r&   rf   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   ri   DefaultUniverseOnlyReleaseTracksr   r   Commandr
   	Deprecaterh   rf   rb   r&   r$   <module>rs      s    > B 2 ( 7 ? W 27%L D%%(()h.T\\ h. * h.V GI D%%**+6 6 ,	I
6r&   