Skip to main content

Storage CRUD

Create, list, fetch, update, and delete storage configurations for a product. File upload/download operations use a storage tag at runtime — see Storage overview and Processing Storage.

Quick Example

import Ductape, { StorageProviders } from '@ductape/sdk';

const ductape = new Ductape({ accessKey: 'your-access-key' });

await ductape.storage.create({
product: 'my-product',
name: 'App Storage',
tag: 'app-storage',
envs: [{
slug: 'prd',
type: StorageProviders.AWS,
config: {
cloud: 'prod_aws',
bucketName: 'my-prod-bucket',
region: 'us-east-1',
},
}],
});

Create

import { StorageProviders } from '@ductape/sdk/types';

// Cloud-linked (recommended)
await ductape.storage.create({
product: 'my-product',
name: 'App Storage',
tag: 'app-storage',
description: 'Production file storage',
envs: [{
slug: 'prd',
type: StorageProviders.AWS,
config: {
cloud: 'prod_aws',
bucketName: 'my-prod-bucket',
region: 'us-east-1',
},
}],
});

// Manual credentials
await ductape.storage.create({
product: 'my-product',
name: 'App Storage',
tag: 'app-storage',
envs: [{
slug: 'prd',
type: StorageProviders.AWS,
config: {
bucketName: 'my-prod-bucket',
region: 'us-east-1',
accessKeyId: process.env.AWS_ACCESS_KEY,
secretAccessKey: process.env.AWS_SECRET_KEY,
},
}],
});

Fields

FieldTypeDescription
productstringProduct tag
namestringDisplay name
tagstringUnique storage identifier within the product
descriptionstringOptional description
envsarrayPer-environment provider configs

Each env config includes slug, type (StorageProviders.AWS, GCP, or AZURE), and a config object. For cloud-linked configs, set cloud to your connection tag instead of storing credentials.

List

const storages = await ductape.storage.list('my-product');
// Returns array of storage configs

Fetch

const storage = await ductape.storage.fetch('my-product', 'app-storage');

Update

await ductape.storage.update('my-product', 'app-storage', {
name: 'Updated Storage Name',
envs: [{
slug: 'prd',
type: StorageProviders.GCP,
config: {
cloud: 'gcp_prod',
bucketName: 'my-dev-bucket',
location: 'US',
},
}],
});

You can update name, description, and envs. When using a cloud connection, only pass cloud, bucket/container name, and region/location — credentials are resolved at runtime.

Delete

await ductape.storage.delete('my-product', 'app-storage');

Deleting a storage config does not delete files in the underlying bucket.

See Also