如何以编程方式更改Azure Media Encoder保留单元配置?

时间:2014-12-12 19:01:00

标签: c# azure azure-media-services azure-management

Azure Media Encoder允许您配置Web界面上保留单元的数量和大小(基本/标准/高级)。

是否有以编程方式管理此操作的API?

1 个答案:

答案 0 :(得分:1)

最近发布的AMS .NET SDK v 3.1.0.0公开了更改保留单元的功能。 以下是如何更新保留单位的代码示例:

var encodingBasicReservedUnit = _dataContext.EncodingReservedUnits.FirstOrDefault();
        var initialReservedUnitCount = encodingBasicReservedUnit.CurrentReservedUnits;
        encodingBasicReservedUnit.CurrentReservedUnits = encodingBasicReservedUnit.MaxReservableUnits;
        encodingBasicReservedUnit.Update();
        encodingBasicReservedUnit = _dataContext.EncodingReservedUnits.FirstOrDefault();
        Assert.AreEqual(encodingBasicReservedUnit.CurrentReservedUnits, encodingBasicReservedUnit.MaxReservableUnits,
            "Expecting Encoding ReservedUnit to have increased to Max");
        encodingBasicReservedUnit.CurrentReservedUnits = initialReservedUnitCount;
        encodingBasicReservedUnit.Update();
        encodingBasicReservedUnit = _dataContext.EncodingReservedUnits.FirstOrDefault();
        Assert.AreEqual(encodingBasicReservedUnit.CurrentReservedUnits, initialReservedUnitCount,
            "Expecting Encoding ReservedUnit to have decreased again to initialCount from Max");

可以在https://github.com/Azure/azure-sdk-for-media-services/blob/dev/test/net/Scenario/EncodingReservedUnitDataTests.cs

中找到更多情景测试