
    gM                         S r SSKJr  SSKJr  SSKJr  S 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 rS rg)z6Flags and helpers for the Datastream related commands.    )actions)arg_parsers)basec                 *    SnU R                  SUSS9  g)z'Adds a --type flag to the given parser.z^Type can be MYSQL, ORACLE, POSTGRESQL, SQLSERVER, SALESFORCE, GOOGLE-CLOUD-STORAGE or BIGQUERYz--typeThelprequiredNadd_argument)parser	help_texts     Flib/googlecloudsdk/command_lib/datastream/connection_profiles/flags.pyAddTypeFlagr      s    r)hY>    c                 (    SnU R                  SX!S9  g)z/Adds a --display-name flag to the given parser.z)Friendly name for the connection profile.z--display-namer   Nr
   )r   r	   r   s      r   AddDisplayNameFlagr      s    =)&YJr   c                    U R                  5       nUR                  SSUS9  UR                  SSU[        S9  UR                  SSUS9  UR                  US	S
9nUR                  SSSS9  UR                  SSSS9  UR                  SSSS9  UR                  5       nUR                  SSUS9  UR                  SSUS9  UR                  SSUS9  g)z7Adds necessary mysql profile flags to the given parser.z--mysql-hostnamez,IP or hostname of the MySQL source database.r   z--mysql-portz*Network port of the MySQL source database.r   r	   typez--mysql-username8Username Datastream will use to connect to the database.Tr	   mutexz--mysql-password          Password for the user that Datastream will be using to
          connect to the database.
          This field is not returned on request, and the value is encrypted
          when stored in Datastream. r   defaultz--mysql-prompt-for-password
store_true8Prompt for the password used to connect to the database.actionr   z&--mysql-secret-manager-stored-passwordZPath to secret manager, storing the password for the user used to connect to the database.z--ca-certificate          x509 PEM-encoded certificate of the CA that signed the source database
          server's certificate. The replica will use this certificate to verify
          it's connecting to the right host.z--client-certificate          x509 PEM-encoded certificate that will be used by the replica to
          authenticate against the source database server.z--client-keyp          Unencrypted PKCS#1 or PKCS#8 PEM-encoded private key associated with
          the Client Certificate.N	add_groupr   int)r   r	   mysql_profilepassword_group
ssl_configs        r   AddMysqlProfileGroupr+   $   sW   ""$-=   ;	  
 I   !**HD*I.(
    #E  G .&    &&(*0    >    %   r   c                    U R                  5       nUR                  SSUS9  UR                  SSU[        S9  UR                  SSUS9  UR                  S	S
US9  UR                  USS9nUR                  SSSS9  UR                  SSSS9  UR                  SSSS9  UR                  5       nUR                  SSSS9  UR                  SSSS9  g)z8Adds necessary oracle profile flags to the given parser.z--oracle-hostnamez-IP or hostname of the oracle source database.r   z--oracle-portz+Network port of the oracle source database.r   z--oracle-usernamer   z--database-servicez+Database service for the Oracle connection.Tr   z--oracle-passwordr   r   r   z--oracle-prompt-for-passwordr   r   r   z'--oracle-secret-manager-stored-passwordr!   z--oracle-ca-certificatezk          PEM-encoded certificate of the CA that signed the source database
          server's certificate.z.--oracle-server-certificate-distinguished-namez          The distinguished name (DN) mentioned in the server
          certificate. This corresponds to the SSL_SERVER_CERT_DN sqlnet parameter.
          If this field is not provided, the DN matching is not enforced.Nr%   )r   r	   oracle_profiler)   r*   s        r   AddOracleProfileGroupr.   _   sT   ##%.>   <	  
 I   <   "++XT+J.(
    $E  G /&    '')*#    6M   r   c                    U R                  5       nUR                  SSUS9  UR                  SSU[        S9  UR                  SSUS9  UR                  S	S
US9  UR                  USS9nUR                  SSSS9  UR                  SSSS9  UR                  SSSS9  UR                  5       nUR                  SSUS9  UR                  SSSS9  UR                  5       nUR                  SSUS9  UR                  SSUS9  g) z<Adds necessary postgresql profile flags to the given parser.z--postgresql-hostnamez1IP or hostname of the PostgreSQL source database.r   z--postgresql-portz/Network port of the PostgreSQL source database.r   z--postgresql-usernamer   z--postgresql-databasez/Database service for the PostgreSQL connection.Tr   z--postgresql-passwordr   r   r   z --postgresql-prompt-for-passwordr   r   r   z+--postgresql-secret-manager-stored-passwordr!   z--postgresql-ca-certificater"   z(--postgresql-server-certificate-hostnamez          The hostname mentioned in the Subject or SAN extension of the server
          certificate. If this field is not provided, the hostname in the
          server certificate is not validated.z--postgresql-client-certificater#   z--postgresql-client-keyr$   Nr%   )r   r	   postgresql_profiler)   r*   client_ssl_configs         r   AddPostgresqlProfileGroupr2      s   '')!!B "  !!@	 " 
 !!I "  !!@ "  &///N.(
    (E  G 3&    "++-*#0    02    !**,  '>  !    %  ! r   c                 <   U R                  5       nUR                  SSUS9  UR                  SSU[        S9  UR                  SSUS9  UR                  S	S
US9  UR                  USS9nUR                  SSSS9  UR                  SSSS9  UR                  SSSS9  g)z;Adds necessary sqlserver profile flags to the given parser.z--sqlserver-hostnamez1IP or hostname of the SQL Server source database.r   z--sqlserver-portz/Network port of the SQL Server source database.r   z--sqlserver-usernamer   z--sqlserver-databasez/Database service for the SQL Server connection.Tr   z--sqlserver-passwordr   r   r   z--sqlserver-prompt-for-passwordr   r   r   z*--sqlserver-secret-manager-stored-passwordr!   Nr%   )r   r	   sqlserver_profiler)   s       r   AddSqlServerProfileGroupr5      s   &&(  B ! 
   @	 !    I ! 
   @ ! 
 %...M.(
    'E  
 2&   r   c                 |   U R                  5       nUR                  SSUS9  UR                  USS9nUR                  5       nUR                  SSUS9  UR                  USS9nUR                  SS	S
S9  UR                  SSSS9  UR                  SSS
S9  UR                  USS9nUR                  SSS
S9  UR                  SSSS9  UR                  SSS
S9  UR                  5       nUR                  SSUS9  UR                  USS9nUR                  SSS
S9  UR                  SSSS9  UR                  SSS
S9  g )!zAdds necessary salesforce profile flags to the given parser.

Args:
  parser: The parser for the command line flags.
  required: Whether or not the flags are required.
z--salesforce-domainzMDomain of the Salesforce organization. For example, 'myorg.my.salesforce.com'r   Tr   z--salesforce-usernamer   z--salesforce-passwordz          Password for the user that Datastream will be using to
          connect to Salesforce.
          This field is not returned on request, and the value is encrypted
          when stored in Datastream.r   r   z --salesforce-prompt-for-passwordr   z6Prompt for the password used to connect to Salesforce.r   z+--salesforce-secret-manager-stored-passwordzXPath to secret manager, storing the password for the user used to connect to Salesforce.z--salesforce-security-tokenzg          Security token for the user that Datastream will be using to
          connect to Salesforce.z&--salesforce-prompt-for-security-tokenz<Prompt for the security token used to connect to Salesforce.z1--salesforce-secret-manager-stored-security-tokenzQPath to secret manager, storing the security token used to connect to Salesforce.z--salesforce-oauth2-client-idz2OAuth 2.0 Client ID used to connect to Salesforce.z!--salesforce-oauth2-client-secretz@          OAuth 2.0 Client secret used to connect to Salesforce.z,--salesforce-prompt-for-oauth2-client-secretzEPrompt for the OAuth 2.0 Client secret used to connect to Salesforce.z7--salesforce-secret-manager-stored-oauth2-client-secretzZPath to secret manager, storing the OAuth 2.0 Client secret used to connect to Salesforce.Nr&   r   )	r   r	   salesforce_profilelogin_groupuser_login_groupr)   security_token_groupoauth2_login_groupclient_secret_groups	            r   AddSalesforceProfileGroupr>     s    '')!!^ "  #,,hd,K+ **,I    $--xt-L.(
    (C  
 3$    *33t 4  ###$  $  ##.I $ 
 ##9  $  #,,.!!%C " 
 +44t 5  "")D	 #  ""4	 #  ""?$  # r   c                     U R                  5       nSnU[        R                  R                  :X  a  SnUR	                  USUS9  UR	                  SSSS9  g)	z5Adds necessary GCS profile flags to the given parser.z--bucketz--bucket-namezUThe full project and resource path for Cloud Storage
      bucket including the name.r   z--root-pathz.The root path inside the Cloud Storage bucket.FN)r&   r   ReleaseTrackBETAr   )r   release_trackr	   gcs_profilebucket_field_names        r   AddGcsProfileGrouprE     sl      "+ d'',,,'$	   ?  r   c                 &   U R                  5       nUR                  SS[        R                  " SS9SUS9  UR                  SSS	9  UR                  S
SUS9  UR                  USS9nUR                  SSSS9  UR                  SSSS9  UR                  SSSS9  UR                  USS9nUR                  SSSSS9  UR                  SSSSS9  UR                  SS SSS9  UR                  5       nUR                  S!S"SSS9  UR                  S#S$S	9  g%)&z9Adds necessary mongodb profile flags to the given parser.z--mongodb-host-addressesz7IP or hostname and port of the MongoDB source database.   )
min_lengthzIPv4_ADDRESS_OR_HOSTNAME:PORT)r   r   metavarr	   z--mongodb-replica-setz+Replica set of the MongoDB source database.r   z--mongodb-usernamer   r   Tr   z--mongodb-passwordr   r   r   z--mongodb-prompt-for-passwordr   r   r   z(--mongodb-secret-manager-stored-passwordr!   z--mongodb-srv-connection-formatz6SRV Connection format for the MongoDB source database.Fr   r    r   z$--mongodb-standard-connection-formatz;Standard connection format for the MongoDB source database.z--mongodb-direct-connectionzoConnect to the mongodb hosts directly and do not try to resolve
      any of the replicas from the replica set.z--mongodb-tlsz<Enable Transport Layer Security for the monogodb connection.z--mongodb-ca-certificatez      x509 PEM-encoded certificate of the CA that signed the source database
      server's certificate. The replica will use this certificate to verify
      it's connecting to the right host.N)r&   r   r   ArgList)r   r	   mongodb_profiler)   connection_format_groupr*   s         r   AddMongodbProfileGrouprO     s   $$&/ H!,-   <   I  
 #,,hd,K.(
    %E  
 0&    ,55t 6  &&'G	 '  &&,L	 '  #3   ((**M	  
  ,  -r   c                     U R                  SS9nUR                  SS[        R                  " SSSSS9S	9  UR                  S
S[        R                  " S
SSS9S	9  g)z7Adds necessary depth flags for discover command parser.Tr   z--recursive`Whether to retrieve the full hierarchy of data objects (TRUE) or only the current level (FALSE).zEThe {flag_name} option is deprecated; use `--full-hierarchy` instead.Fr   )warnremovedr    r   r    z--recursive-depthGThe number of hierarchy levels below the current level to be retrieved.zFThe {flag_name} option is deprecated; use `--hierarchy-depth` instead.)rS   rT   N)r&   r   r   DeprecationAction)r   depth_parsers     r   AddDepthGrouprY     s    !!!-,q&&
    X&&
   r   c                 d    U R                  SS9nUR                  SSSS9  UR                  SSS	9  g
)z;Adds necessary hierarchy flags for discover command parser.TrQ   z--full-hierarchyrR   r   rU   z--hierarchy-depthrV   rJ   Nr7   )r   hierarchy_parsers     r   AddHierarchyGroupr\     sM    %%D%1q    X   r   c                     U R                  SS9nUR                  SSS9  UR                  SSS9  UR                  SS	S9  UR                  S
SS9  g)z8Adds necessary RDBMS params for discover command parser.TrQ   z--mysql-rdbms-filezPath to a YAML (or JSON) file containing the MySQL RDBMS to enrich with child data objects and metadata. If you pass - as the value of the flag the file content will be read from stdin. rJ   z--oracle-rdbms-filezPath to a YAML (or JSON) file containing the Oracle RDBMS to enrich with child data objects and metadata. If you pass - as the value of the flag the file content will be read from stdin.z--postgresql-rdbms-filezPath to a YAML (or JSON) file containing the PostgreSQL RDBMS to enrich with child data objects and metadata. If you pass - as the value of the flag the file content will be read from stdin.z--sqlserver-rdbms-filezPath to a YAML (or JSON) file containing the SQL Server RDBMS to enrich with child data objects and metadata. If you pass - as the value of the flag the file content will be read from stdin.Nr7   )r   rdbms_parsers     r   AddRdbmsGroupr_     s    !!!-, L    L    P    P  r   c                 L    U R                  SS9nUR                  SSU-  SSS9  g)	z(Adds a --force flag to the given parser.TrQ   z--forcez0%s the connection profile without validating it.r   FrK   Nr7   )r   verbvalidation_groups      r   AddValidationGrouprc   #  s:    %%D%1ADH	   r   N)T)__doc__googlecloudsdk.callioper   r   r   r   r   r+   r.   r2   r5   r>   rE   rO   rY   r\   r_   rc    r   r   <module>rg      s`    = , / (?K8v9xGT.bfR(K-\<*r   