Aller au contenu principal

Bucket

Les fichiers peuvent être regroupés dans des Buckets.

Les Buckets sont créés dynamiquement lorsque vous uploadez un nouveau fichier.

Via l'API

Dans l'exemple ci-dessous, le bucket my-super-bucket sera créé.

const resultPreSignUrl = await getPreSignedUrlApplicationFile(
{ applicationId: "my-application-id" },
{
type: PreSignUrlType.UPLOAD,
fileName: fileToUpload.name,
bucket: `my-super-bucket`
},
);

Vous pouvez gérer les buckets à l'aide de deleteBucketApplicationFile, renameBucketApplicationFile et updateBucketApplicationFile.

// It will delete bucket `my-bucket` and sub buckets `my-bucket/sub-bucket` and corresponding files
await deleteBucketApplicationFile(
{ applicationId: "my-application-id" },
{ bucket: `my-bucket` },
);
// It will rename bucket
// `my-bucket` -> `new-bucket`
// `my-bucket/sub-bucket` -> `new-bucket/sub-bucket/`
await renameBucketApplicationFile(
{ applicationId: "my-application-id" },
{ bucket: `my-bucket`, newBucket: `new-bucket` },
);
// It will update bucket for corresponding file
// Before: file.bucket => `old-bucket/sub-bucket`
// After: file.bucket => `my-bucket/`
await updateBucketApplicationFile(
  { applicationId: "my-application-id" },
  { bucket: `my-bucket`, applicationFileIds: ["file-id"] },
);

Application client

Créer un nouveau bucket

Vous pouvez créer un nouveau bucket en vous plaçant sur un chemin de bucket spécifique et en uploadant un nouveau fichier.

Renommer un bucket

Vous pouvez mettre à jour le bucket pour plusieurs fichiers.