11// SPDX-FileCopyrightText: © 2021-2022 MONAI Consortium
22// SPDX-License-Identifier: Apache License 2.0
33
4+ using Amazon . SecurityToken . Model ;
45using Monai . Deploy . Storage . Common ;
56
67namespace Monai . Deploy . Storage
@@ -57,7 +58,7 @@ public interface IStorageService
5758 Task CopyObject ( string sourceBucketName , string sourceObjectName , string destinationBucketName , string destinationObjectName , CancellationToken cancellationToken = default ) ;
5859
5960 /// <summary>
60- /// Removes an objects .
61+ /// Removes an object .
6162 /// </summary>
6263 /// <param name="bucketName">Name of the bucket</param>
6364 /// <param name="objectName">Name of the object in the bucket</param>
@@ -73,5 +74,103 @@ public interface IStorageService
7374 /// <param name="cancellationToken">Optional cancellation token. Defaults to default(CancellationToken)</param>
7475 /// <returns>Task</returns>
7576 Task RemoveObjects ( string bucketName , IEnumerable < string > objectNames , CancellationToken cancellationToken = default ) ;
77+
78+ /// <summary>
79+ /// Creates a folder with stub file.
80+ /// </summary>
81+ /// <param name="bucketName">Name of the bucket</param>
82+ /// <param name="folderPath">Name/Path of the folder to be created. A stub file will also be created as this is required for MinIO</param>
83+ /// <param name="cancellationToken">Optional cancellation token. Defaults to default(CancellationToken)</param>
84+ /// <returns>Task</returns>
85+ Task CreateFolder ( string bucketName , string folderPath , CancellationToken cancellationToken = default ) ;
86+
87+ /// <summary>
88+ /// Creates temporary credentials for a specified folder for a specified length of time.
89+ /// </summary>
90+ /// <param name="bucketName">Name of the bucket</param>
91+ /// <param name="folderName">Name/Path of the folder to be allowed access to</param>
92+ /// <param name="durationSeconds">Expiration time of the credentials</param>
93+ /// <param name="cancellationToken">Optional cancellation token. Defaults to default(CancellationToken)</param>
94+ /// <returns>Task</returns>
95+ Task < Credentials > CreateTemporaryCredentials ( string bucketName , string folderName , int durationSeconds = 3600 , CancellationToken cancellationToken = default ) ;
96+
97+ /// <summary>
98+ /// Copies content of an object from source to destination using temporary credentials.
99+ /// </summary>
100+ /// <param name="sourceBucketName">Name of the source bucket</param>
101+ /// <param name="sourceObjectName">Name of the object in the source bucket</param>
102+ /// <param name="destinationBucketName">Name of the destination bucket</param>
103+ /// <param name="destinationObjectName">Name of the object in the destination bucket</param>
104+ /// <param name="credentials">Temporary credentials used to connect</param>
105+ /// <param name="cancellationToken">Optional cancellation token. Defaults to default(CancellationToken)</param>
106+ /// <returns>Task</returns>
107+ Task CopyObjectWithCredentials ( string sourceBucketName , string sourceObjectName , string destinationBucketName , string destinationObjectName , Credentials credentials , CancellationToken cancellationToken = default ) ;
108+
109+ /// <summary>
110+ /// Downloads an objects as stream using temporary credentials.
111+ /// </summary>
112+ /// <param name="bucketName">Name of the bucket</param>
113+ /// <param name="objectName">Name of the object in the bucket</param>
114+ /// <param name="credentials">Temporary credentials used to connect</param>
115+ /// <param name="callback">Action to be called when stream is ready</param>
116+ /// <param name="cancellationToken">Optional cancellation token. Defaults to default(CancellationToken)</param>
117+ /// <returns>Task</returns>
118+ Task GetObjectWithCredentials ( string bucketName , string objectName , Credentials credentials , Action < Stream > callback , CancellationToken cancellationToken = default ) ;
119+
120+ /// <summary>
121+ /// Lists objects in a bucket using temporary credentials.
122+ /// </summary>
123+ /// <param name="bucketName">Name of the bucket</param>
124+ /// <param name="credentials">Temporary credentials used to connect</param>
125+ /// <param name="prefix">Objects with name starts with prefix</param>
126+ /// <param name="recursive">Whether to recurse into subdirectories</param>
127+ /// <param name="cancellationToken">Optional cancellation token. Defaults to default(CancellationToken)</param>
128+ /// <returns></returns>
129+ IList < VirtualFileInfo > ListObjectsWithCredentials ( string bucketName , Credentials credentials , string ? prefix = "" , bool recursive = false , CancellationToken cancellationToken = default ) ;
130+
131+ /// <summary>
132+ /// Uploads an object using temporary credentials.
133+ /// </summary>
134+ /// <param name="bucketName">Name of the bucket</param>
135+ /// <param name="objectName">Name of the object in the bucket</param>
136+ /// <param name="data">Stream to upload</param>
137+ /// <param name="size">Size of the stream</param>
138+ /// <param name="contentType">Content type of the object</param>
139+ /// <param name="metadata">Metadata of the object</param>
140+ /// <param name="credentials">Temporary credentials used to connect</param>
141+ /// <param name="cancellationToken">Optional cancellation token. Defaults to default(CancellationToken)</param>
142+ /// <returns>Task</returns>
143+ Task PutObjectWithCredentials ( string bucketName , string objectName , Stream data , long size , string contentType , Dictionary < string , string > metadata , Credentials credentials , CancellationToken cancellationToken = default ) ;
144+
145+ /// <summary>
146+ /// Removes an object with temporary credentials.
147+ /// </summary>
148+ /// <param name="bucketName">Name of the bucket</param>
149+ /// <param name="objectName">Name of the object in the bucket</param>
150+ /// <param name="credentials">Temporary credentials used to connect</param>
151+ /// <param name="cancellationToken">Optional cancellation token. Defaults to default(CancellationToken)</param>
152+ /// <returns>Task</returns>
153+ Task RemoveObjectWithCredentials ( string bucketName , string objectName , Credentials credentials , CancellationToken cancellationToken = default ) ;
154+
155+ /// <summary>
156+ /// Removes a list of objects with temporary credentials.
157+ /// </summary>
158+ /// <param name="bucketName">Name of the bucket</param>
159+ /// <param name="objectNames">An enumerable of object names to be removed in the bucket</param>
160+ /// <param name="credentials">Temporary credentials used to connect</param>
161+ /// <param name="cancellationToken">Optional cancellation token. Defaults to default(CancellationToken)</param>
162+ /// <returns>Task</returns>
163+ Task RemoveObjectsWithCredentials ( string bucketName , IEnumerable < string > objectNames , Credentials credentials , CancellationToken cancellationToken = default ) ;
164+
165+ /// <summary>
166+ /// Creates a folder using temporary credentials.
167+ /// </summary>
168+ /// <param name="bucketName">Name of the bucket</param>
169+ /// <param name="folderPath">The path of the root folder to assign credentials to</param>
170+ /// <param name="credentials">Temporary credentials used to connect</param>
171+ /// <param name="cancellationToken">Optional cancellation token. Defaults to default(CancellationToken)</param>
172+ /// <returns>Task</returns>
173+ Task CreateFolderWithCredentials ( string bucketName , string folderPath , Credentials credentials , CancellationToken cancellationToken = default ) ;
174+
76175 }
77176}
0 commit comments