Class ImportSource
The data to be imported to the key value store.
Namespace: Amazon.CDK.AWS.CloudFront
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public abstract class ImportSource : DeputyBase
Syntax (vb)
Public MustInherit Class ImportSource Inherits DeputyBase
Remarks
ExampleMetadata: infused
Examples
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"
} } }
}))
});
Synopsis
Constructors
| ImportSource() | The data to be imported to the key value store. |
Methods
| FromAsset(string, IAssetOptions?) | An import source that exists as a local file. |
| FromBucket(IBucket, string) | An import source that exists as an object in an S3 bucket. |
| FromInline(string) | An import source that uses an inline string. |
Constructors
ImportSource()
The data to be imported to the key value store.
protected ImportSource()
Remarks
ExampleMetadata: infused
Examples
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"
} } }
}))
});
Methods
FromAsset(string, IAssetOptions?)
An import source that exists as a local file.
public static ImportSource FromAsset(string path, IAssetOptions? options = null)
Parameters
- path string
the path to the local file.
- options IAssetOptions
the configuration for the temporarily created S3 file.
Returns
Remarks
ExampleMetadata: infused
FromBucket(IBucket, string)
An import source that exists as an object in an S3 bucket.
public static ImportSource FromBucket(IBucket bucket, string key)
Parameters
- bucket IBucket
the S3 bucket that contains the data.
- key string
the key within the S3 bucket that contains the data.
Returns
Remarks
ExampleMetadata: infused
FromInline(string)
An import source that uses an inline string.
public static ImportSource FromInline(string data)
Parameters
- data string
the contents of the KeyValueStore.
Returns
Remarks
ExampleMetadata: infused