Add local blob-triggered CSV validation with Azurite
This commit is contained in:
1 parent
b72aa278a5
commit
2075bcb2c3
7 files changed
+153
-27
No files matched your search
@@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Azure.Storage.Blobs" Version="12.29.2" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,21 @@
|
||||
using Azure.Storage.Blobs;
|
||||
|
||||
if (args.Length != 1 || !File.Exists(args[0]))
|
||||
{
|
||||
Console.Error.WriteLine("Bitte eine vorhandene Datei angeben.");
|
||||
Environment.ExitCode = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
var container = new BlobContainerClient(
|
||||
"UseDevelopmentStorage=true",
|
||||
"imports");
|
||||
|
||||
await container.CreateIfNotExistsAsync();
|
||||
|
||||
var blobName = $"{Guid.NewGuid():N}-{Path.GetFileName(args[0])}";
|
||||
var blob = container.GetBlobClient(blobName);
|
||||
|
||||
await blob.UploadAsync(args[0]);
|
||||
|
||||
Console.WriteLine($"Hochgeladen: imports/{blobName}");
|
||||
Reference in new issue
Block a user