
    }              	           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d	lmZ dd
lmZ ddlmZ  G d de
j                         Zdddj%                  ddddd      de_        y)zCImplements the command to import Debian packages into a repository.    )absolute_import)division)unicode_literals)apis)waiter)arg_parsers)base)
exceptions)flags)	resourcesc                   *    e Zd ZdZdZed        Zd Zy)Import?Import one or more Debian packages into an artifact repository.v1c                     t        j                         j                  |        t        j                  j                  |        | j                  dddt        j                         d       y)z\Set up arguements for this command.

    Args:
      parser: An argparse.ArgumentPaser.
    z--gcs-source
GCS_SOURCETz            The Google Cloud Storage location of a package to import.
            To import multiple packages, use wildcards at the end of the path.
            )metavarrequiredtypehelpN)r   
GetRepoArgAddToParserr	   
ASYNC_FLAGadd_argumentr   ArgList)parsers    #lib/surface/artifacts/apt/import.pyArgszImport.Args$   sZ     
""6*OO'
  "      c                    t        j                  d| j                        }|j                  }|j                  D ].  }d|v s|j                  d      rt        j                  dd       |j                  j                  j                         }|j                  |j                  d      }|j                  |      }|j                  ||j                               }|j                  j!                  |      }t"        j$                  j'                  |j(                  d	
      }	|j*                  r|	S t-        j.                  t-        j0                  |j2                        |	d      }
|
S )zRun package import command.artifactregistry*r   z-Wildcards must be at the end of the GCS path.T)urisuseWildcards)	gcsSource)importAptArtifactsRequestparentz.artifactregistry.projects.locations.operations)
collectionzImporting package(s))r   GetClientInstanceapi_versionMESSAGES_MODULE
gcs_sourceendswithr
   InvalidArgumentExceptionCONCEPTS
repositoryParseImportAptArtifactsGcsSourceImportAptArtifactsRequestFArtifactregistryProjectsLocationsRepositoriesAptArtifactsImportRequestRelativeName,projects_locations_repositories_aptArtifactsr   r   REGISTRYParseRelativeNamenameasync_r   WaitForCloudOperationPollerNoResourcesprojects_locations_operations)selfargsclientmessagesr,   repo_refimport_requestrequestopop_refresults              r   Runz
Import.Run8   s\   ##$68H8HIF%%Hoo
	
	:#6#6s#;11IK 	K &
 }}''--/H55__ 6 J 77 8 N ]]"0$$& ^ (G 
	<	<	C	CG	LB11
L 2 NF {{m~~

0
0224
(*f
 mr   N)__name__
__module____qualname____doc__r*   staticmethodr   rH    r   r   r   r      s!    G+ &"r   r   r   zy
      *{command}* imports Debian packages from Google Cloud Storage into the specified
      artifact repository.
      a  
      To import the package `my-package.deb` from Google Cloud Storage into
      `my-repo`, run:

        $ {0} my-repo --location=us-central1 --gcs-source={1}

      To import the packages `my-package.deb` and `other-package.deb` into
      `my-repo`, run:

        $ {0} my-repo --location=us-central1 --gcs-source={1},{2}

      To import all packages from `my-directory` into `my-repo`, run:

        $ {0} my-repo --location=us-central1 --gcs-source={3}

      To import all packages in all subdirectories from a Google Cloud
      Storage bucket into `my-repo`, run:

        $ {0} my-repo --location=us-central1 --gcs-source={4}
    z	{command}z%gs://my-bucket/path/to/my-package.debz(gs://my-bucket/path/to/other-package.debzgs://my-bucket/my-directory/*zgs://my-bucket/**)briefDESCRIPTIONEXAMPLESN)rL   
__future__r   r   r   googlecloudsdk.api_lib.utilr   r   googlecloudsdk.callioper   r	   r
   $googlecloudsdk.command_lib.artifactsr   googlecloudsdk.corer   Commandr   formatdetailed_helprN   r   r   <module>rZ      sn     J &  ' , . / ( . 6 );T\\ ;~ O
& 	{C9."	$3 r   