
                         :   d Z ddl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
 ej                   ej                  ej                  j                  ej                  j                  ej                  j                          G d d	ej"                                      Zy)
zExport TDE certificate from a Cloud SQL for SQL Server instance.

Export data from a Cloud SQL instance to a Google Cloud Storage bucket as
a BAK backup file.
    N)api_util)base)export_util)flags)
console_ioc                   N    e Zd ZdZd ej
                  d      iZed        Zd Z	y)TdezExport a TDE certificate from a Cloud SQL for SQL Server instance.

  Exports a TDE certificate from a Cloud SQL instance to a Google Cloud Storage
  bucket. This is only supported for SQL Server.
  EXAMPLESa            To export a TDE certificate with the name `foo` and private key password `my-pvk-password` in the Cloud SQL
          instance `my-instance` to certificate path `my-bucket/my-cert.cert` and private key path `my-bucket/my-key.pvk`,
          run:

            $ {command} my-instance --certificate=foo --cert-path=gs://my-bucket/my-cert.cert --pvk-path=gs://my-bucket/my-key.pvk --pvk-password=my-pvk-password

          To export a TDE certificate with the name `foo` and private key password `my-pvk-password` in the Cloud SQL
          instance `my-instance` and prompting for the private key password,
          run:

            $ {command} my-instance --certificate=foo --cert-path=gs://my-bucket/my-cert.cert --pvk-path=gs://my-bucket/my-key.pvk --prompt-for-pvk-password

          c                     t         j                  j                  |        t        j                  |        t        j
                  |        y)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.
    N)r   
ASYNC_FLAGAddToParserr   AddInstanceArgumentAddTdeFlags)parsers    lib/surface/sql/export/tde.pyArgszTde.Args;   s2     	OO'	f%	f    c                     |j                   rt        j                  d      |_        t	        j
                  t        j                        }t        j                  ||      S )z2Runs the command to export the Cloud SQL instance.zPrivate Key Password: )	prompt_for_pvk_passwordr   PromptPasswordpvk_passwordr   	SqlClientAPI_VERSION_DEFAULTr   RunTdeExportCommand)selfargsclients      r   RunzTde.RunG   sH    ##$334LMd < <=F**488r   N)
__name__
__module____qualname____doc__textwrapdedentdetailed_helpstaticmethodr   r    r   r   r	   r	      s?     
(//  -$ 	 	9r   r	   )r"   r#   googlecloudsdk.api_lib.sqlr   googlecloudsdk.callioper   googlecloudsdk.command_lib.sqlr   r   googlecloudsdk.core.consoler   DefaultUniverseOnlyReleaseTracksReleaseTrackGABETAALPHACommandr	   r'   r   r   <module>r3      s     / ( 6 0 2 D%%(($*;*;*@*@%%++-+9$,, +9- +9r   