Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
pohhsu committed Jun 26, 2023
1 parent 7c0de6b commit 0c96425
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 2 deletions.
1 change: 1 addition & 0 deletions AMSMigrate.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
<PackageReference Include="System.Threading.Channels" Version="7.0.0" />
<PackageReference Include="vertical-spectreconsolelogger" Version="0.10.1-dev.20230510.16" />
<PackageReference Include="WindowsAzure.Storage" Version="9.3.3" />
</ItemGroup>

<ItemGroup>
Expand Down
24 changes: 24 additions & 0 deletions AssetOptionsBinder.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using AMSMigrate.Ams;
using AMSMigrate.Contracts;
using Microsoft.WindowsAzure.Storage;
using System.CommandLine;
using System.CommandLine.Binding;

Expand Down Expand Up @@ -96,6 +97,29 @@ public AssetOptionsBinder()
{
result.ErrorMessage = $"Invalid template: {value}. Template key '{key}' is invalid.";
}
string containerName;
var index = value.IndexOf('/');
if (index == -1)
{
containerName = value;
}
else
{
containerName = value.Substring(0, index);
}
if (!containerName.StartsWith("$"))
{
try
{
NameValidator.ValidateContainerName(containerName);
}
catch (Exception ex)
{
result.ErrorMessage = $"Invalid template: {value}. Template container name '{containerName}' is invalid. {ex.Message}";
}
}
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"AMSMigrate": {
"commandName": "Project",
"commandLineArgs": "assets -s b2c12710-ecdf-4532-9ba6-7e74a219b5f2 -g provenance -n provenanceuswc -a amsencodermsitest -t $web/live/${AssetName}-stream-dash -f \"name eq 'live-discontinuity'\" "
"commandLineArgs": "assets -s b2c12710-ecdf-4532-9ba6-7e74a219b5f2 -g pohhsuTest -n pohhsumediaservice -o pohhsumediaservice -f \"name eq '0365video-03f3f58678-StandardEncoder-H265ContentAwareEncoding-042d34d192'\" --skip-migrated False"
},
"Docker": {
"commandName": "Docker",
Expand Down
2 changes: 1 addition & 1 deletion ams/TemplateMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Azure.ResourceManager.Media.Models;
using Azure.Storage.Blobs;
using Microsoft.Extensions.Logging;
using Microsoft.WindowsAzure.Storage;
using System.Text.RegularExpressions;

namespace AMSMigrate.Ams
Expand Down Expand Up @@ -68,7 +69,6 @@ public static (bool, string?) Validate(string template, TemplateType type = Temp
return (false, key);
}
}

return (true, null);
}

Expand Down
1 change: 1 addition & 0 deletions azure/AzureStorageUploader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public async Task UploadBlobAsync(
{
var container = _blobServiceClient.GetBlobContainerClient(containerName);
var outputBlob = container.GetBlockBlobClient(fileName);
await container.CreateIfNotExistsAsync(cancellationToken: cancellationToken);
var operation = await outputBlob.StartCopyFromUriAsync(blob.Uri, cancellationToken: cancellationToken);
await operation.WaitForCompletionAsync(cancellationToken);
}
Expand Down

0 comments on commit 0c96425

Please sign in to comment.