@@ -13,214 +13,6 @@ import AWSPluginsCore
13
13
14
14
extension AWSS3StoragePlugin {
15
15
16
- /// Retrieves the preSigned URL of the S3 object.
17
- ///
18
- /// Stores the input in a storage request, constructs an operation to perform the work, queues it in the
19
- /// OperationQueue to perform the work asychronously.
20
- ///
21
- /// - Parameters:
22
- /// - key: The unique identifier of the object in the bucket.
23
- /// - options: Additional parameters to specify API behavior.
24
- /// - listener: The closure to receive status updates.
25
- /// - Returns: An operation object representing the work to be done.
26
- public func getURL(
27
- key: String ,
28
- options: StorageGetURLRequest . Options ? = nil ,
29
- resultListener: StorageGetURLOperation . ResultListener ? = nil
30
- ) -> StorageGetURLOperation {
31
- let options = options ?? StorageGetURLRequest . Options ( )
32
- let request = StorageGetURLRequest ( key: key, options: options)
33
- let getURLOperation = AWSS3StorageGetURLOperation ( request,
34
- storageConfiguration: storageConfiguration,
35
- storageService: storageService,
36
- authService: authService,
37
- resultListener: resultListener)
38
-
39
- queue. addOperation ( getURLOperation)
40
-
41
- return getURLOperation
42
- }
43
-
44
- /// Downloads S3 object into memory.
45
- ///
46
- /// Stores the input in a storage request, constructs an operation to perform the work, queues it in the
47
- /// OperationQueue to perform the work asychronously.
48
- ///
49
- /// - Parameters:
50
- /// - key: The unique identifier of the object in the bucket.
51
- /// - options: Additional parameters to specify API behavior.
52
- /// - listener: The closure to receive status updates.
53
- /// - Returns: An operation object representing the work to be done.
54
- public func downloadData(
55
- key: String ,
56
- options: StorageDownloadDataRequest . Options ? = nil ,
57
- progressListener: StorageDownloadDataOperation . InProcessListener ? = nil ,
58
- resultListener: StorageDownloadDataOperation . ResultListener ? = nil
59
- ) -> StorageDownloadDataOperation {
60
- let options = options ?? StorageDownloadDataRequest . Options ( )
61
- let request = StorageDownloadDataRequest ( key: key, options: options)
62
- let downloadDataOperation = AWSS3StorageDownloadDataOperation ( request,
63
- storageConfiguration: storageConfiguration,
64
- storageService: storageService,
65
- authService: authService,
66
- progressListener: progressListener,
67
- resultListener: resultListener)
68
-
69
- queue. addOperation ( downloadDataOperation)
70
-
71
- return downloadDataOperation
72
- }
73
-
74
- /// Downloads to file of the S3 object.
75
- ///
76
- /// Stores the input in a storage request, constructs an operation to perform the work, queues it in the
77
- /// OperationQueue to perform the work asychronously.
78
- ///
79
- /// - Parameters:
80
- /// - key: The unique identifier of the object in the bucket.
81
- /// - local: The local file URL to download the object to.
82
- /// - options: Additional parameters to specify API behavior.
83
- /// - listener: The closure to receive status updates.
84
- /// - Returns: An operation object representing the work to be done.
85
- public func downloadFile(
86
- key: String ,
87
- local: URL ,
88
- options: StorageDownloadFileRequest . Options ? = nil ,
89
- progressListener: StorageDownloadFileOperation . InProcessListener ? ,
90
- resultListener: StorageDownloadFileOperation . ResultListener ?
91
- ) -> StorageDownloadFileOperation {
92
- let options = options ?? StorageDownloadFileRequest . Options ( )
93
- let request = StorageDownloadFileRequest ( key: key, local: local, options: options)
94
- let downloadFileOperation = AWSS3StorageDownloadFileOperation ( request,
95
- storageConfiguration: storageConfiguration,
96
- storageService: storageService,
97
- authService: authService,
98
- progressListener: progressListener,
99
- resultListener: resultListener)
100
-
101
- queue. addOperation ( downloadFileOperation)
102
-
103
- return downloadFileOperation
104
- }
105
-
106
- /// Uploads the data object with the specified key to the S3 bucket.
107
- ///
108
- /// Stores the input in a storage request, constructs an operation to perform the work, adds it to the
109
- /// OperationQueue to perform the work asychronously.
110
- ///
111
- /// - Parameters:
112
- /// - key: The unique identifier of the object in the bucket.
113
- /// - data: The data object to be uploaded.
114
- /// - options: Additional parameters to specify API behavior.
115
- /// - listener: The closure to receive status updates.
116
- /// - Returns: An operation object representing the work to be done.
117
- public func uploadData(
118
- key: String ,
119
- data: Data ,
120
- options: StorageUploadDataRequest . Options ? = nil ,
121
- progressListener: StorageUploadDataOperation . InProcessListener ? ,
122
- resultListener: StorageUploadDataOperation . ResultListener ?
123
- ) -> StorageUploadDataOperation {
124
- let options = options ?? StorageUploadDataRequest . Options ( )
125
- let request = StorageUploadDataRequest ( key: key, data: data, options: options)
126
-
127
- let uploadDataOperation = AWSS3StorageUploadDataOperation ( request,
128
- storageConfiguration: storageConfiguration,
129
- storageService: storageService,
130
- authService: authService,
131
- progressListener: progressListener,
132
- resultListener: resultListener)
133
-
134
- queue. addOperation ( uploadDataOperation)
135
-
136
- return uploadDataOperation
137
- }
138
-
139
- /// Uploads the file located at the local URL with the specified key to the S3 bucket.
140
- ///
141
- /// Stores the input in a storage request, and calls the put method. Internally, it constructs the operation
142
- /// to perform the work, and adds it to the OperationQueue to perform the work asychronously.
143
- ///
144
- /// - Parameters:
145
- /// - key: The unique identifier of the object in the bucket.
146
- /// - local: The URL representing the file on the device.
147
- /// - options: Additional parameters to specify API behavior.
148
- /// - listener: The closure to receive status updates.
149
- /// - Returns: An operation object representing the work to be done.
150
- public func uploadFile(
151
- key: String ,
152
- local: URL ,
153
- options: StorageUploadFileRequest . Options ? = nil ,
154
- progressListener: StorageUploadFileOperation . InProcessListener ? ,
155
- resultListener: StorageUploadFileOperation . ResultListener ?
156
- ) -> StorageUploadFileOperation {
157
- let options = options ?? StorageUploadFileRequest . Options ( )
158
- let request = StorageUploadFileRequest ( key: key, local: local, options: options)
159
-
160
- let uploadFileOperation = AWSS3StorageUploadFileOperation ( request,
161
- storageConfiguration: storageConfiguration,
162
- storageService: storageService,
163
- authService: authService,
164
- progressListener: progressListener,
165
- resultListener: resultListener)
166
-
167
- queue. addOperation ( uploadFileOperation)
168
-
169
- return uploadFileOperation
170
- }
171
-
172
- /// Removes the object from S3 at the specified key.
173
- ///
174
- /// Stores the input in a storage request, constructs an operation to perform the work, adds it to the
175
- /// OperationQueue to perform the work asychronously.
176
- ///
177
- /// - Parameters:
178
- /// - key: The unique identifier of the object in the bucket.
179
- /// - options: Additional parameters to specify API behavior.
180
- /// - listener: The closure to receive status updates.
181
- /// - Returns: An operation object representing the work to be done.
182
- public func remove(
183
- key: String ,
184
- options: StorageRemoveRequest . Options ? = nil ,
185
- resultListener: StorageRemoveOperation . ResultListener ? = nil
186
- ) -> StorageRemoveOperation {
187
- let options = options ?? StorageRemoveRequest . Options ( )
188
- let request = StorageRemoveRequest ( key: key, options: options)
189
- let removeOperation = AWSS3StorageRemoveOperation ( request,
190
- storageConfiguration: storageConfiguration,
191
- storageService: storageService,
192
- authService: authService,
193
- resultListener: resultListener)
194
-
195
- queue. addOperation ( removeOperation)
196
-
197
- return removeOperation
198
- }
199
-
200
- /// Lists all of the keys in the bucket, under specified access level.
201
- ///
202
- /// Stores the input in a storage request, constructs an operation to perform the work, adds it to the
203
- /// OperationQueue to perform the work asychronously.
204
- ///
205
- /// - Parameters:
206
- /// - options: Additional parameters to specify API behavior.
207
- /// - listener: The closure to receive status updates.
208
- /// - Returns: An operation object representing the work to be done.
209
- public func list( options: StorageListRequest . Options ? = nil ,
210
- resultListener: StorageListOperation . ResultListener ? = nil ) -> StorageListOperation {
211
- let options = options ?? StorageListRequest . Options ( )
212
- let request = StorageListRequest ( options: options)
213
- let listOperation = AWSS3StorageListOperation ( request,
214
- storageConfiguration: storageConfiguration,
215
- storageService: storageService,
216
- authService: authService,
217
- resultListener: resultListener)
218
-
219
- queue. addOperation ( listOperation)
220
-
221
- return listOperation
222
- }
223
-
224
16
/// Retrieve the escape hatch to perform low level operations on S3.
225
17
///
226
18
/// - Returns: S3 client
0 commit comments