
                         ^   d Z ddlmZ ddlmZ ddlm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)zImports data into a Cloud SQL instance from a BAK file.

Imports data into a Cloud SQL instance from a BAK backup file in Google Cloud
Storage.
    )absolute_import)division)unicode_literalsN)api_util)base)flags)import_util)
console_ioc                   p    e Zd ZdZ ej
                  d       ej
                  d      dZed        Zd Z	y)Bakz6Import data into a Cloud SQL instance from a BAK file.ag            {command} imports data into a Cloud SQL instance from a BAK backup
          file in Google Cloud Storage. You should use a full backup file with a
          single backup set.

          For detailed help on importing data into Cloud SQL, refer to this
          guide: https://cloud.google.com/sql/docs/sqlserver/import-export/importing
          a            To import data from the BAK file `my-bucket/my-export.bak` into the
          database `my-database` in the Cloud SQL instance `my-instance`,
          run:

            $ {command} my-instance gs://my-bucket/my-export.bak --database=my-database

          To import data from the encrypted BAK file `my-bucket/my-export.bak` into the database
          `my-database` in the Cloud SQL instance `my-instance`, with the certificate
          `gs://my-bucket/my-cert.crt`, private key `gs://my-bucket/my-key.key` and prompting for the
          private key password,
          run:

            $ {command} my-instance gs://my-bucket/my-export.bak --database=my-database --cert-path=gs://my-bucket/my-cert.crt --pvk-path=gs://my-bucket/my-key.key --prompt-for-pvk-password
          )DESCRIPTIONEXAMPLESc                    t        j                  | ddd       t        j                  | t        j                  d       t        j
                  |        t        j                  |        t        j                  |        t        j                  |        t        j                  |        t        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.
    zBAK fileF)filetypegz_supporteduser_supportedT)requiredN)r	   AddBakImportFlagsr   AddDatabase#SQLSERVER_DATABASE_IMPORT_HELP_TEXTAddEncryptedBakFlagsAddBakImportStripedArgumentAddBakImportNoRecoveryArgument AddBakImportRecoveryOnlyArgumentAddBakImportBakTypeArgumentAddBakImportStopAtArgumentAddBakImportStopAtMarkArgument!AddBakImportKeepEncryptedArgument)parsers    lib/surface/sql/import/bak.pyArgszBak.ArgsD   s     !!% 
99DJ	v&	%%f-	((0	**62	%%f-	$$V,	((0	++F3    c                     |j                   rt        j                  d      |_        t	        j
                  t        j                        }t        j                  ||      S )z7Runs the command to import into the Cloud SQL instance.zPrivate Key Password: )	prompt_for_pvk_passwordr
   PromptPasswordpvk_passwordr   	SqlClientAPI_VERSION_DEFAULTr	   RunBakImportCommand)selfargsclients      r    RunzBak.RunZ   sH    ##$334LMd < <=F**488r"   N)
__name__
__module____qualname____doc__textwrapdedentdetailed_helpstaticmethodr!   r-    r"   r    r   r   "   sQ     ? (//   (//  -8 4 4*9r"   r   )r1   
__future__r   r   r   r2   googlecloudsdk.api_lib.sqlr   googlecloudsdk.callioper   googlecloudsdk.command_lib.sqlr   r	   googlecloudsdk.core.consoler
   DefaultUniverseOnlyReleaseTracksReleaseTrackGABETAALPHACommandr   r6   r"   r    <module>rC      s    '  '  / ( 0 6 2 D%%(($*;*;*@*@%%++-;9$,, ;9- ;9r"   