PageRenderTime 27ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/Assets/AWSSDK/src/Core/Amazon.Runtime/SharedInterfaces/ICoreAmazonS3.cs

https://gitlab.com/vectorci/aws-sdk-unity
C# | 286 lines | 51 code | 32 blank | 203 comment | 0 complexity | 398e28344ac1eb25a62b31a85f84ae4f MD5 | raw file
  1. #define AWS_APM_API
  2. #define AWSSDK_UNITY
  3. //
  4. // Copyright 2014-2015 Amazon.com,
  5. // Inc. or its affiliates. All Rights Reserved.
  6. //
  7. // Licensed under the Amazon Software License (the "License").
  8. // You may not use this file except in compliance with the
  9. // License. A copy of the License is located at
  10. //
  11. // http://aws.amazon.com/asl/
  12. //
  13. // or in the "license" file accompanying this file. This file is
  14. // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
  15. // CONDITIONS OF ANY KIND, express or implied. See the License
  16. // for the specific language governing permissions and
  17. // limitations under the License.
  18. //
  19. using System;
  20. using System.Collections.Generic;
  21. using System.IO;
  22. using System.Linq;
  23. using System.Text;
  24. using System.Threading;
  25. #if AWS_ASYNC_API
  26. using System.Threading.Tasks;
  27. #endif
  28. namespace Amazon.Runtime.SharedInterfaces
  29. {
  30. /// <summary>
  31. /// ICoreAmazonS3 is not meant to use directly. It defines S3 with basic .NET types
  32. /// and allows other services to be able to use S3 as a runtime dependency. This interface
  33. /// is implemented by the AmazonS3Client defined in the S3 assembly.
  34. /// </summary>
  35. public interface ICoreAmazonS3
  36. {
  37. /// <summary>
  38. /// Generate a presigned URL.
  39. /// </summary>
  40. /// <param name="bucketName"></param>
  41. /// <param name="objectKey"></param>
  42. /// <param name="expiration"></param>
  43. /// <param name="additionalProperties"></param>
  44. /// <returns></returns>
  45. string GeneratePreSignedURL(string bucketName, string objectKey, DateTime expiration, IDictionary<string, object> additionalProperties);
  46. #if BCL||AWSSDK_UNITY
  47. /// <summary>
  48. /// Get all the object keys for the particular bucket and key prefix.
  49. /// </summary>
  50. /// <param name="bucketName"></param>
  51. /// <param name="prefix"></param>
  52. /// <param name="additionalProperties"></param>
  53. /// <returns></returns>
  54. IList<string> GetAllObjectKeys(string bucketName, string prefix, IDictionary<string, object> additionalProperties);
  55. /// <summary>
  56. /// Delete the object.
  57. /// </summary>
  58. /// <param name="bucketName"></param>
  59. /// <param name="objectKey"></param>
  60. /// <param name="additionalProperties"></param>
  61. void Delete(string bucketName, string objectKey, IDictionary<string, object> additionalProperties);
  62. /// <summary>
  63. /// Deletes the ojects.
  64. /// </summary>
  65. /// <param name="bucketName"></param>
  66. /// <param name="objectKeys"></param>
  67. /// <param name="additionalProperties"></param>
  68. void Deletes(string bucketName, IEnumerable<string> objectKeys, IDictionary<string, object> additionalProperties);
  69. /// <summary>
  70. /// Upload an object from a stream.
  71. /// </summary>
  72. /// <param name="bucketName"></param>
  73. /// <param name="objectKey"></param>
  74. /// <param name="stream"></param>
  75. /// <param name="additionalProperties"></param>
  76. void UploadObjectFromStream(string bucketName, string objectKey, Stream stream, IDictionary<string, object> additionalProperties);
  77. /// <summary>
  78. /// Upload an object from a file path.
  79. /// </summary>
  80. /// <param name="bucketName"></param>
  81. /// <param name="objectKey"></param>
  82. /// <param name="filepath"></param>
  83. /// <param name="additionalProperties"></param>
  84. void UploadObjectFromFilePath(string bucketName, string objectKey, string filepath, IDictionary<string, object> additionalProperties);
  85. /// <summary>
  86. /// Download object to a file path.
  87. /// </summary>
  88. /// <param name="bucketName"></param>
  89. /// <param name="objectKey"></param>
  90. /// <param name="filepath"></param>
  91. /// <param name="additionalProperties"></param>
  92. void DownloadToFilePath(string bucketName, string objectKey, string filepath, IDictionary<string, object> additionalProperties);
  93. /// <summary>
  94. /// Get stream for an object.
  95. /// </summary>
  96. /// <param name="bucketName"></param>
  97. /// <param name="objectKey"></param>
  98. /// <param name="additionalProperties"></param>
  99. /// <returns></returns>
  100. Stream GetObjectStream(string bucketName, string objectKey, IDictionary<string, object> additionalProperties);
  101. /// <summary>
  102. /// Set the ACL on the object to public readable.
  103. /// </summary>
  104. /// <param name="bucketName"></param>
  105. /// <param name="objectKey"></param>
  106. /// <param name="enable"></param>
  107. void MakeObjectPublic(string bucketName, string objectKey, bool enable);
  108. /// <summary>
  109. /// Check to see if the bucket exists and if it doesn't create the bucket.
  110. /// </summary>
  111. /// <param name="bucketName"></param>
  112. void EnsureBucketExists(string bucketName);
  113. /// <summary>
  114. /// Check to see if the bucket exists.
  115. /// </summary>
  116. /// <param name="bucketName"></param>
  117. /// <returns></returns>
  118. bool DoesS3BucketExist(string bucketName);
  119. #endif
  120. #if AWS_APM_API
  121. /// <summary>
  122. /// Start a delete object.
  123. /// </summary>
  124. /// <param name="bucketName"></param>
  125. /// <param name="objectKey"></param>
  126. /// <param name="additionalProperties"></param>
  127. /// <param name="callback"></param>
  128. /// <param name="state"></param>
  129. /// <returns></returns>
  130. IAsyncResult BeginDelete(string bucketName, string objectKey, IDictionary<string, object> additionalProperties, AsyncCallback callback, object state);
  131. /// <summary>
  132. /// Get the results of a delete object.
  133. /// </summary>
  134. /// <param name="result"></param>
  135. void EndDelete(IAsyncResult result);
  136. /// <summary>
  137. /// Start an upload object from stream.
  138. /// </summary>
  139. /// <param name="bucketName"></param>
  140. /// <param name="objectKey"></param>
  141. /// <param name="stream"></param>
  142. /// <param name="additionalProperties"></param>
  143. /// <param name="callback"></param>
  144. /// <param name="state"></param>
  145. /// <returns></returns>
  146. IAsyncResult BeginUploadObjectFromStream(string bucketName, string objectKey, Stream stream, IDictionary<string, object> additionalProperties, AsyncCallback callback, object state);
  147. /// <summary>
  148. /// Get the results of an upload from stream.
  149. /// </summary>
  150. /// <param name="result"></param>
  151. void EndUploadObjectFromStream(IAsyncResult result);
  152. /// <summary>
  153. /// Start an upload object from file path.
  154. /// </summary>
  155. /// <param name="bucketName"></param>
  156. /// <param name="objectKey"></param>
  157. /// <param name="filepath"></param>
  158. /// <param name="additionalProperties"></param>
  159. /// <param name="callback"></param>
  160. /// <param name="state"></param>
  161. /// <returns></returns>
  162. IAsyncResult BeginUploadObjectFromFilePath(string bucketName, string objectKey, string filepath, IDictionary<string, object> additionalProperties, AsyncCallback callback, object state);
  163. /// <summary>
  164. /// Get the results of an upload from file path.
  165. /// </summary>
  166. /// <param name="result"></param>
  167. void EndUploadObjectFromFilePath(IAsyncResult result);
  168. /// <summary>
  169. /// Start a download to a file path.
  170. /// </summary>
  171. /// <param name="bucketName"></param>
  172. /// <param name="objectKey"></param>
  173. /// <param name="filepath"></param>
  174. /// <param name="additionalProperties"></param>
  175. /// <param name="callback"></param>
  176. /// <param name="state"></param>
  177. /// <returns></returns>
  178. IAsyncResult BeginDownloadToFilePath(string bucketName, string objectKey, string filepath, IDictionary<string, object> additionalProperties, AsyncCallback callback, object state);
  179. /// <summary>
  180. /// Get results of downloading an object to a file path.
  181. /// </summary>
  182. /// <param name="result"></param>
  183. void EndDownloadToFilePath(IAsyncResult result);
  184. /// <summary>
  185. /// Start opening a stream to an object in S3.
  186. /// </summary>
  187. /// <param name="bucketName"></param>
  188. /// <param name="objectKey"></param>
  189. /// <param name="additionalProperties"></param>
  190. /// <param name="callback"></param>
  191. /// <param name="state"></param>
  192. /// <returns></returns>
  193. IAsyncResult BeginGetObjectStream(string bucketName, string objectKey, IDictionary<string, object> additionalProperties, AsyncCallback callback, object state);
  194. /// <summary>
  195. /// Get results of opening a stream to an object in S3.
  196. /// </summary>
  197. /// <param name="result"></param>
  198. /// <returns></returns>
  199. Stream EndGetObjectStream(IAsyncResult result);
  200. #endif
  201. #if AWS_ASYNC_API
  202. /// <summary>
  203. /// Upload an object from a stream.
  204. /// </summary>
  205. /// <param name="bucketName"></param>
  206. /// <param name="objectKey"></param>
  207. /// <param name="stream"></param>
  208. /// <param name="additionalProperties"></param>
  209. /// <param name="cancellationToken"></param>
  210. /// <returns></returns>
  211. Task UploadObjectFromStreamAsync(string bucketName, string objectKey, Stream stream, IDictionary<string, object> additionalProperties, CancellationToken cancellationToken = default(CancellationToken));
  212. /// <summary>
  213. /// Delete an object.
  214. /// </summary>
  215. /// <param name="bucketName"></param>
  216. /// <param name="objectKey"></param>
  217. /// <param name="additionalProperties"></param>
  218. /// <param name="cancellationToken"></param>
  219. /// <returns></returns>
  220. Task DeleteAsync(string bucketName, string objectKey, IDictionary<string, object> additionalProperties, CancellationToken cancellationToken = default(CancellationToken));
  221. /// <summary>
  222. /// Open a stream to an object in S3.
  223. /// </summary>
  224. /// <param name="bucketName"></param>
  225. /// <param name="objectKey"></param>
  226. /// <param name="additionalProperties"></param>
  227. /// <param name="cancellationToken"></param>
  228. /// <returns></returns>
  229. Task<Stream> GetObjectStreamAsync(string bucketName, string objectKey, IDictionary<string, object> additionalProperties, CancellationToken cancellationToken = default(CancellationToken));
  230. /// <summary>
  231. /// Upload an object from a file path.
  232. /// </summary>
  233. /// <param name="bucketName"></param>
  234. /// <param name="objectKey"></param>
  235. /// <param name="filepath"></param>
  236. /// <param name="additionalProperties"></param>
  237. /// <param name="cancellationToken"></param>
  238. /// <returns></returns>
  239. Task UploadObjectFromFilePathAsync(string bucketName, string objectKey, string filepath, IDictionary<string, object> additionalProperties, CancellationToken cancellationToken = default(CancellationToken));
  240. #endif
  241. #if BCL45
  242. /// <summary>
  243. /// Download an object in S3 to a file path.
  244. /// </summary>
  245. /// <param name="bucketName"></param>
  246. /// <param name="objectKey"></param>
  247. /// <param name="filepath"></param>
  248. /// <param name="additionalProperties"></param>
  249. /// <param name="cancellationToken"></param>
  250. /// <returns></returns>
  251. Task DownloadToFilePathAsync(string bucketName, string objectKey, string filepath, IDictionary<string, object> additionalProperties, CancellationToken cancellationToken = default(CancellationToken));
  252. #endif
  253. }
  254. }