@@ -807,6 +807,7 @@ class ProjectManager(CRUDMixin, RESTManager):
807807 def get (self , id : Union [str , int ], lazy : bool = False , ** kwargs : Any ) -> Project :
808808 return cast (Project , super ().get (id = id , lazy = lazy , ** kwargs ))
809809
810+ @exc .on_http_error (exc .GitlabImportError )
810811 def import_project (
811812 self ,
812813 file : str ,
@@ -833,7 +834,7 @@ def import_project(
833834
834835 Raises:
835836 GitlabAuthenticationError: If authentication is not correct
836- GitlabListError : If the server failed to perform the request
837+ GitlabImportError : If the server failed to perform the request
837838
838839 Returns:
839840 A representation of the import status.
@@ -851,6 +852,7 @@ def import_project(
851852 "/projects/import" , post_data = data , files = files , ** kwargs
852853 )
853854
855+ @exc .on_http_error (exc .GitlabImportError )
854856 def remote_import (
855857 self ,
856858 url : str ,
@@ -877,7 +879,7 @@ def remote_import(
877879
878880 Raises:
879881 GitlabAuthenticationError: If authentication is not correct
880- GitlabListError : If the server failed to perform the request
882+ GitlabImportError : If the server failed to perform the request
881883
882884 Returns:
883885 A representation of the import status.
@@ -894,6 +896,66 @@ def remote_import(
894896 "/projects/remote-import" , post_data = data , ** kwargs
895897 )
896898
899+ @exc .on_http_error (exc .GitlabImportError )
900+ def remote_import_s3 (
901+ self ,
902+ path : str ,
903+ region : str ,
904+ bucket_name : str ,
905+ file_key : str ,
906+ access_key_id : str ,
907+ secret_access_key : str ,
908+ name : Optional [str ] = None ,
909+ namespace : Optional [str ] = None ,
910+ overwrite : bool = False ,
911+ override_params : Optional [Dict [str , Any ]] = None ,
912+ ** kwargs : Any ,
913+ ) -> Union [Dict [str , Any ], requests .Response ]:
914+ """Import a project from an archive file stored on AWS S3.
915+
916+ Args:
917+ region: AWS S3 region name where the file is stored
918+ bucket_name: AWS S3 bucket name where the file is stored
919+ file_key: AWS S3 file key to identify the file.
920+ access_key_id: AWS S3 access key ID.
921+ secret_access_key: AWS S3 secret access key.
922+ path: Name and path for the new project
923+ name: The name of the project to import. If not provided,
924+ defaults to the path of the project.
925+ namespace: The ID or path of the namespace that the project
926+ will be imported to
927+ overwrite: If True overwrite an existing project with the
928+ same path
929+ override_params: Set the specific settings for the project
930+ **kwargs: Extra options to send to the server (e.g. sudo)
931+
932+ Raises:
933+ GitlabAuthenticationError: If authentication is not correct
934+ GitlabImportError: If the server failed to perform the request
935+
936+ Returns:
937+ A representation of the import status.
938+ """
939+ data = {
940+ "region" : region ,
941+ "bucket_name" : bucket_name ,
942+ "file_key" : file_key ,
943+ "access_key_id" : access_key_id ,
944+ "secret_access_key" : secret_access_key ,
945+ "path" : path ,
946+ "overwrite" : str (overwrite ),
947+ }
948+ if override_params :
949+ for k , v in override_params .items ():
950+ data [f"override_params[{ k } ]" ] = v
951+ if name is not None :
952+ data ["name" ] = name
953+ if namespace :
954+ data ["namespace" ] = namespace
955+ return self .gitlab .http_post (
956+ "/projects/remote-import-s3" , post_data = data , ** kwargs
957+ )
958+
897959 def import_bitbucket_server (
898960 self ,
899961 bitbucket_server_url : str ,
0 commit comments