Skip to content

PutKey

Source: src/AWS/CloudFront/PutKey.ts

Runtime binding for cloudfront-keyvaluestore:PutKey.

Creates or replaces a single key in the bound KeyValueStore’s data plane. Writes use optimistic concurrency: pass the store’s current ETag as IfMatch (from DescribeKeyValueStore or a previous write’s response). Provide the implementation with Effect.provide(AWS.CloudFront.PutKeyHttp).

// init — bind the operations to the store
const describeStore = yield* CloudFront.DescribeKeyValueStore(store);
const putKey = yield* CloudFront.PutKey(store);
// runtime
const meta = yield* describeStore({});
const res = yield* putKey({
Key: "routes:/about",
Value: "/about.html",
IfMatch: meta.ETag,
});
// res.ETag is the store's new entity tag