KeyValueStoreProps Struct
The properties to create a Key Value Store.
| Source | aws-cloudfront/lib/key-value-store.ts |
|---|---|
| Type last changed |
Example
ts
const storeAsset = new cloudfront.KeyValueStore(this, 'KeyValueStoreAsset', {
keyValueStoreName: 'KeyValueStoreAsset',
source: cloudfront.ImportSource.fromAsset('path-to-data.json'),
});
const storeInline = new cloudfront.KeyValueStore(this, 'KeyValueStoreInline', {
keyValueStoreName: 'KeyValueStoreInline',
source: cloudfront.ImportSource.fromInline(JSON.stringify({
data: [
{
key: "key1",
value: "value1",
},
{
key: "key2",
value: "value2",
},
],
})),
});
python
store_asset = cloudfront.KeyValueStore(self, "KeyValueStoreAsset",
key_value_store_name="KeyValueStoreAsset",
source=cloudfront.ImportSource.from_asset("path-to-data.json")
)
store_inline = cloudfront.KeyValueStore(self, "KeyValueStoreInline",
key_value_store_name="KeyValueStoreInline",
source=cloudfront.ImportSource.from_inline(JSON.stringify({
"data": [{
"key": "key1",
"value": "value1"
}, {
"key": "key2",
"value": "value2"
}
]
}))
)
java
KeyValueStore storeAsset = KeyValueStore.Builder.create(this, "KeyValueStoreAsset")
.keyValueStoreName("KeyValueStoreAsset")
.source(ImportSource.fromAsset("path-to-data.json"))
.build();
KeyValueStore storeInline = KeyValueStore.Builder.create(this, "KeyValueStoreInline")
.keyValueStoreName("KeyValueStoreInline")
.source(ImportSource.fromInline(JSON.stringify(Map.of(
"data", List.of(Map.of(
"key", "key1",
"value", "value1"), Map.of(
"key", "key2",
"value", "value2"))))))
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
var storeAsset = new KeyValueStore(this, "KeyValueStoreAsset", new KeyValueStoreProps {
KeyValueStoreName = "KeyValueStoreAsset",
Source = ImportSource.FromAsset("path-to-data.json")
});
var storeInline = new KeyValueStore(this, "KeyValueStoreInline", new KeyValueStoreProps {
KeyValueStoreName = "KeyValueStoreInline",
Source = ImportSource.FromInline(JSON.Stringify(new Dictionary<string, IDictionary<string, string>[]> {
{ "data", new [] { new Struct {
Key = "key1",
Value = "value1"
}, new Struct {
Key = "key2",
Value = "value2"
} } }
}))
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
storeAsset := cloudfront.NewKeyValueStore(this, jsii.String("KeyValueStoreAsset"), &KeyValueStoreProps{
KeyValueStoreName: jsii.String("KeyValueStoreAsset"),
Source: cloudfront.ImportSource_FromAsset(jsii.String("path-to-data.json")),
})
storeInline := cloudfront.NewKeyValueStore(this, jsii.String("KeyValueStoreInline"), &KeyValueStoreProps{
KeyValueStoreName: jsii.String("KeyValueStoreInline"),
Source: cloudfront.ImportSource_FromInline(jSON.stringify(map[string][]map[string]*string{
"data": []map[string]*string{
map[string]*string{
"key": jsii.String("key1"),
"value": jsii.String("value1"),
},
map[string]*string{
"key": jsii.String("key2"),
"value": jsii.String("value2"),
},
},
})),
})
Properties
commentoptionalstringcommentoptionalstrcommentoptionalStringCommentoptionalstringCommentoptional*string #A comment for the Key Value Store.
Default: No comment will be specified
keyValueStoreNameoptionalstringkey_value_store_nameoptionalstrkeyValueStoreNameoptionalStringKeyValueStoreNameoptionalstringKeyValueStoreNameoptional*string #The unique name of the Key Value Store.
Default: A generated name
sourceoptionalImportSourcesourceoptionalImportSourcesourceoptionalImportSourceSourceoptionalImportSourceSourceoptionalImportSource #The import source for the Key Value Store.
Default: No data will be imported to the store
This will populate the initial items in the Key Value Store. The source data must be in a valid JSON format.