ImportSource Class
The data to be imported to the key value store.
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",
},
],
})),
});
Initializer
ts
new ImportSource()
python
ImportSource()
java
new ImportSource()
csharp
new ImportSource()
go
NewImportSource()
Methods
fromAsset(path: string, options?: AssetOptions): ImportSource // chainable@staticmethod def from_asset(path: str, options: typing.Optional[AssetOptions] = None) -> ImportSourcepublic static ImportSource fromAsset(String path, AssetOptions options)public static ImportSource FromAsset(string path, AssetOptions? options = null)func FromAsset(Path *string, Options AssetOptions) ImportSourcestatic#An import source that exists as a local file.
2 parameters
Parameters
pathpathpathpathPath— the path to the local file.optionsoptionsoptionsoptionsOptions— the configuration for the temporarily created S3 file.
fromBucket(bucket: IBucket, key: string): ImportSource // chainable@staticmethod def from_bucket(bucket: IBucket, key: str) -> ImportSourcepublic static ImportSource fromBucket(IBucket bucket, String key)public static ImportSource FromBucket(IBucket bucket, string key)func FromBucket(Bucket IBucket, Key *string) ImportSourcestatic#An import source that exists as an object in an S3 bucket.
2 parameters
Parameters
bucketbucketbucketbucketBucket— the S3 bucket that contains the data.keykeykeykeyKey— the key within the S3 bucket that contains the data.
fromInline(data: string): ImportSource // chainable@staticmethod def from_inline(data: str) -> ImportSourcepublic static ImportSource fromInline(String data)public static ImportSource FromInline(string data)func FromInline(Data *string) ImportSourcestatic#An import source that uses an inline string.
1 parameter
Parameters
datadatadatadataData— the contents of the KeyValueStore.