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
- TypeScript
- Java
- Go
- .NET
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',
},
}],
});
import Ductape, Map.of( StorageProviders ) from '@ductape/sdk';
RequestContext auth = new RequestContext(null, null, null, null, 'your-access-key' );
Ductape ductape = new Ductape(EnvType.PRODUCTION, auth);
ductape.storage.create(Map.of(
"product", "my-product",
"name", "App Storage",
"tag", "app-storage",
envs: [Map.of(
"slug", "prd",
type: StorageProviders.AWS,
config: Map.of(
"cloud", "prod_aws",
"bucketName", "my-prod-bucket",
"region", "us-east-1"
)
)]
));
import Ductape, { StorageProviders } from '@ductape/sdk';
auth := core.NewRequestContext("", "", "", "", 'your-access-key' )
client, err := ductapesdk.New(core.EnvProduction, auth)
if err != nil {
return err
}
client.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",
},
}],
});
import Ductape, { StorageProviders } from '@ductape/sdk';
var auth = new RequestContext(null, null, null, null, 'your-access-key' , null);
var ductape = new Ductape(EnvType.Production, auth);
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
- TypeScript
- Java
- Go
- .NET
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,
},
}],
});
// Cloud-linked (recommended)
ductape.storage.create(Map.of(
"product", "my-product",
"name", "App Storage",
"tag", "app-storage",
"description", "Production file storage",
envs: [Map.of(
"slug", "prd",
type: StorageProviders.AWS,
config: Map.of(
"cloud", "prod_aws",
"bucketName", "my-prod-bucket",
"region", "us-east-1"
)
)]
));
// Manual credentials
ductape.storage.create(Map.of(
"product", "my-product",
"name", "App Storage",
"tag", "app-storage",
envs: [Map.of(
"slug", "prd",
type: StorageProviders.AWS,
config: Map.of(
"bucketName", "my-prod-bucket",
"region", "us-east-1",
accessKeyId: System.getenv("AWS_ACCESS_KEY"),
secretAccessKey: System.getenv("AWS_SECRET_KEY")
)
)]
));
// Cloud-linked (recommended)
client.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
client.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: os.Getenv("AWS_ACCESS_KEY"),
secretAccessKey: os.Getenv("AWS_SECRET_KEY"),
},
}],
});
// 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: Environment.GetEnvironmentVariable("AWS_ACCESS_KEY"),
secretAccessKey: Environment.GetEnvironmentVariable("AWS_SECRET_KEY"),
},
}],
});
Fields
| Field | Type | Description |
|---|---|---|
product | string | Product tag |
name | string | Display name |
tag | string | Unique storage identifier within the product |
description | string | Optional description |
envs | array | Per-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
- TypeScript
- Java
- Go
- .NET
const storages = await ductape.storage.list('my-product');
// Returns array of storage configs
Map<String, Object> storages = ductape.storage.list('my-product');
// Returns array of storage configs
storages := client.storage.list('my-product');
// Returns array of storage configs
var storages = await ductape.storage.list('my-product');
// Returns array of storage configs
Fetch
- TypeScript
- Java
- Go
- .NET
const storage = await ductape.storage.fetch('my-product', 'app-storage');
Map<String, Object> storage = ductape.storage.fetch('my-product', 'app-storage');
storage := client.storage.fetch('my-product', 'app-storage');
var storage = await ductape.storage.fetch('my-product', 'app-storage');
Update
- TypeScript
- Java
- Go
- .NET
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',
},
}],
});
ductape.storage.update('my-product', 'app-storage', Map.of(
"name", "Updated Storage Name",
envs: [Map.of(
"slug", "prd",
type: StorageProviders.GCP,
config: Map.of(
"cloud", "gcp_prod",
"bucketName", "my-dev-bucket",
"location", "US"
)
)]
));
client.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",
},
}],
});
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
- TypeScript
- Java
- Go
- .NET
await ductape.storage.delete('my-product', 'app-storage');
ductape.storage.delete('my-product', 'app-storage');
client.storage.delete('my-product', 'app-storage');
await ductape.storage.delete('my-product', 'app-storage');
Deleting a storage config does not delete files in the underlying bucket.