| 233 | } |
| 234 | |
| 235 | async function deleteObject(input: { |
| 236 | bucket: string |
| 237 | objectName: string |
| 238 | jwt: JWT |
| 239 | signal: AbortSignal |
| 240 | }): Promise<void> { |
| 241 | const url = `${GCS_HOST}/storage/v1/b/${encodeURIComponent(input.bucket)}/o/${encodeURIComponent(input.objectName)}` |
| 242 | await fetchWithRetry({ |
| 243 | action: 'delete-object', |
| 244 | bucket: input.bucket, |
| 245 | url, |
| 246 | method: 'DELETE', |
| 247 | buildHeaders: async () => { |
| 248 | const token = await getAccessToken(input.jwt) |
| 249 | return { |
| 250 | Authorization: `Bearer ${token}`, |
| 251 | 'User-Agent': USER_AGENT, |
| 252 | } |
| 253 | }, |
| 254 | signal: input.signal, |
| 255 | successStatuses: [404], |
| 256 | }) |
| 257 | } |
| 258 | |
| 259 | export const gcsDestination: DrainDestination<GCSDestinationConfig, GCSDestinationCredentials> = { |
| 260 | type: 'gcs', |