diff --git a/.github/workflows/publishnuget.yml b/.github/workflows/publishnuget.yml index 769a507..8e04763 100644 --- a/.github/workflows/publishnuget.yml +++ b/.github/workflows/publishnuget.yml @@ -22,7 +22,6 @@ defaults: jobs: create_nuget: runs-on: windows-2019 - needs: [ run_test ] steps: - uses: actions/checkout@v3 @@ -33,7 +32,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: '7.x' + dotnet-version: '6.x' # Create the NuGet package in the folder from the environment variable NuGetDirectory - run: dotnet build MK.IO\MK.IO.csproj --configuration Release @@ -69,7 +68,7 @@ jobs: # You can update this logic if you want to manage releases differently if: github.event_name == 'release' runs-on: windows-latest - needs: [ create_nuget ] + needs: [ create_nuget, run_test ] steps: # Download the NuGet package created in the previous job - uses: actions/download-artifact@v3 diff --git a/MK.IO.sln b/MK.IO.sln index 023e375..7fd3c35 100644 --- a/MK.IO.sln +++ b/MK.IO.sln @@ -12,7 +12,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleNetFramework4.8", "Sa {D49EB09F-BB45-446F-8CC6-29E1C6E73EFB} = {D49EB09F-BB45-446F-8CC6-29E1C6E73EFB} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleCore3.1", "SampleCore3.1\SampleCore3.1.csproj", "{7E4DC505-6D8E-4210-9EB1-9A71F0754D60}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleCore3.1", "SampleCore3.1\SampleCore3.1.csproj", "{7E4DC505-6D8E-4210-9EB1-9A71F0754D60}" ProjectSection(ProjectDependencies) = postProject {D49EB09F-BB45-446F-8CC6-29E1C6E73EFB} = {D49EB09F-BB45-446F-8CC6-29E1C6E73EFB} EndProjectSection diff --git a/MK.IO/AccountFilter/AccountFiltersOperations.cs b/MK.IO/AccountFilter/AccountFiltersOperations.cs index 63d855a..3f284cb 100644 --- a/MK.IO/AccountFilter/AccountFiltersOperations.cs +++ b/MK.IO/AccountFilter/AccountFiltersOperations.cs @@ -1,6 +1,6 @@ using MK.IO.Models; using Newtonsoft.Json; -#if NET45 +#if NET462 using System.Net.Http; #endif diff --git a/MK.IO/Asset/AssetsOperations.cs b/MK.IO/Asset/AssetsOperations.cs index 45775fa..00a4632 100644 --- a/MK.IO/Asset/AssetsOperations.cs +++ b/MK.IO/Asset/AssetsOperations.cs @@ -1,7 +1,7 @@ using MK.IO.Models; using Newtonsoft.Json; using System.Net; -#if NET45 +#if NET462 using System.Net.Http; #endif diff --git a/MK.IO/AssetFilter/AssetFiltersOperations.cs b/MK.IO/AssetFilter/AssetFiltersOperations.cs index e4a054b..9b21c25 100644 --- a/MK.IO/AssetFilter/AssetFiltersOperations.cs +++ b/MK.IO/AssetFilter/AssetFiltersOperations.cs @@ -1,6 +1,6 @@ using MK.IO.Models; using Newtonsoft.Json; -#if NET45 +#if NET462 using System.Net.Http; #endif diff --git a/MK.IO/ContentKeyPolicy/ContentKeyPoliciesOperations.cs b/MK.IO/ContentKeyPolicy/ContentKeyPoliciesOperations.cs index 2a708ec..2c7fa2a 100644 --- a/MK.IO/ContentKeyPolicy/ContentKeyPoliciesOperations.cs +++ b/MK.IO/ContentKeyPolicy/ContentKeyPoliciesOperations.cs @@ -1,10 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -#if NET45 +#if NET462 using System.Net.Http; #endif - namespace MK.IO { /// diff --git a/MK.IO/CsharpDotNet2/Model/StreamingEndpointScaleSchema.cs b/MK.IO/CsharpDotNet2/Model/StreamingEndpointScaleSchema.cs new file mode 100644 index 0000000..6918a98 --- /dev/null +++ b/MK.IO/CsharpDotNet2/Model/StreamingEndpointScaleSchema.cs @@ -0,0 +1,46 @@ +using System.Text; +using System.Runtime.Serialization; +using Newtonsoft.Json; + +namespace MK.IO.Models +{ + + /// + /// + /// + [DataContract] + public class StreamingEndpointScaleSchema + { + /// + /// The scale unit count for this streaming endpoint. + /// + /// The scale unit count for this streaming endpoint. + [DataMember(Name = "scaleUnit", EmitDefaultValue = false)] + [JsonProperty(PropertyName = "scaleUnit")] + public int? ScaleUnit { get; set; } + + + /// + /// Get the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class StreamingEndpointScaleSchema {\n"); + sb.Append(" ScaleUnit: ").Append(ScaleUnit).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Get the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, ConverterLE.Settings); + } + + } +} diff --git a/MK.IO/Job/JobsOperations.cs b/MK.IO/Job/JobsOperations.cs index 0836e8f..56f131a 100644 --- a/MK.IO/Job/JobsOperations.cs +++ b/MK.IO/Job/JobsOperations.cs @@ -3,7 +3,8 @@ using MK.IO.Models; using Newtonsoft.Json; -#if NET45 + +#if NET462 using System.Net.Http; #endif diff --git a/MK.IO/LiveEvent/ILiveEventsOperations.cs b/MK.IO/LiveEvent/ILiveEventsOperations.cs index df61d75..ce6ee68 100644 --- a/MK.IO/LiveEvent/ILiveEventsOperations.cs +++ b/MK.IO/LiveEvent/ILiveEventsOperations.cs @@ -23,20 +23,20 @@ public interface ILiveEventsOperations /// /// Delete a live event. /// - /// + /// The name of the live event. void Delete(string liveEventName); /// /// Delete a live event. /// - /// + /// The name of the live event. /// Task DeleteAsync(string liveEventName); /// /// Returns a single live event. /// - /// + /// The name of the live event. /// LiveEventSchema Get(string liveEventName); @@ -47,11 +47,11 @@ public interface ILiveEventsOperations /// Task GetAsync(string liveEventName); -#if NET6_0_OR_GREATER +#if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER /// /// Update a live event /// - /// The name of the live event + /// The name of the live event. /// The location of the live event. This must match the configured location for your account. /// The properties of the live event. /// A dictionary of tags associated with the live event. Maximum number of tags: 16. Maximum length of a tag: 256 characters. @@ -61,7 +61,7 @@ public interface ILiveEventsOperations /// /// Update a live event /// - /// The name of the live event + /// The name of the live event. /// The location of the live event. This must match the configured location for your account. /// The properties of the live event. /// A dictionary of tags associated with the live event. Maximum number of tags: 16. Maximum length of a tag: 256 characters. @@ -72,7 +72,7 @@ public interface ILiveEventsOperations /// /// Create a single live event /// - /// The name of the live event + /// The name of the live event. /// The location of the live event. This must match the configured location for your account. /// The properties of the live event. /// A dictionary of tags associated with the live event. Maximum number of tags: 16. Maximum length of a tag: 256 characters. @@ -82,7 +82,7 @@ public interface ILiveEventsOperations /// /// Create a single live event /// - /// The name of the live event + /// The name of the live event. /// The location of the live event. This must match the configured location for your account. /// The properties of the live event. /// A dictionary of tags associated with the live event. Maximum number of tags: 16. Maximum length of a tag: 256 characters. @@ -92,51 +92,51 @@ public interface ILiveEventsOperations /// /// Allocates resources for a Live Event. A live event is in StandBy state after allocation completes, and is ready to start. /// - /// + /// The name of the live event. void Allocate(string liveEventName); /// /// Allocates resources for a Live Event. A live event is in StandBy state after allocation completes, and is ready to start. /// - /// + /// The name of the live event. Task AllocateAsync(string liveEventName); /// /// Resets a Live Event. All live outputs for the live event are deleted and the live event is stopped and will be started again. /// - /// + /// The name of the live event. void Reset(string liveEventName); /// /// Resets a Live Event. All live outputs for the live event are deleted and the live event is stopped and will be started again. /// - /// + /// The name of the live event. /// Task ResetAsync(string liveEventName); /// /// Start Live Events. This operation transitions your Live Event into a running state /// - /// + /// The name of the live event. void Start(string liveEventName); /// /// Start Live Events. This operation transitions your Live Event into a running state /// - /// + /// The name of the live event. /// Task StartAsync(string liveEventName); /// /// Stops a Live Event. Any active playback sessions will be interrupted. /// - /// + /// The name of the live event. void Stop(string liveEventName); /// /// Stops a Live Event. Any active playback sessions will be interrupted. /// - /// + /// The name of the live event. /// Task StopAsync(string liveEventName); } diff --git a/MK.IO/LiveEvent/LiveEventsOperations.cs b/MK.IO/LiveEvent/LiveEventsOperations.cs index 323313e..2d8675b 100644 --- a/MK.IO/LiveEvent/LiveEventsOperations.cs +++ b/MK.IO/LiveEvent/LiveEventsOperations.cs @@ -4,10 +4,9 @@ using MK.IO.Models; using Newtonsoft.Json; -#if NET45 +#if NET462 using System.Net.Http; #endif - namespace MK.IO { /// @@ -75,7 +74,7 @@ public async Task GetAsync(string liveEventName) return JsonConvert.DeserializeObject(responseContent, ConverterLE.Settings) ?? throw new Exception("Error with live event deserialization"); } -#if NET6_0_OR_GREATER +#if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER /// public LiveEventSchema Update(string liveEventName, string location, LiveEventProperties properties, Dictionary? tags = null) { diff --git a/MK.IO/LiveOutput/ILiveOutputsOperations.cs b/MK.IO/LiveOutput/ILiveOutputsOperations.cs index e9ee432..e8d31c6 100644 --- a/MK.IO/LiveOutput/ILiveOutputsOperations.cs +++ b/MK.IO/LiveOutput/ILiveOutputsOperations.cs @@ -11,61 +11,63 @@ public interface ILiveOutputsOperations /// /// Returns a list of Live Outputs for a Live Event. /// + /// The name of the live event. /// List List(string liveEventName); /// /// Returns a list of Live Outputs for a Live Event. /// + /// The name of the live event. /// Task> ListAsync(string liveEventName); /// /// Deletes a Live Output. /// - /// - /// + /// The name of the live event. + /// The name of the live output. void Delete(string liveEventName, string liveOutputName); /// /// /// - /// - /// + /// The name of the live event. + /// The name of the live output. /// Task DeleteAsync(string liveEventName, string liveOutputName); /// /// Returns a single Live Output. /// - /// - /// + /// The name of the live event. + /// The name of the live output. /// LiveOutputSchema Get(string liveEventName, string liveOutputName); /// /// Returns a single Live Output. /// - /// - /// + /// The name of the live event. + /// The name of the live output. /// Task GetAsync(string liveEventName, string liveOutputName); /// /// Creates a Live Output /// - /// - /// - /// + /// The name of the live event. + /// The name of the live output. + /// The properties of the live output. /// LiveOutputSchema Create(string liveEventName, string liveOutputName, LiveOutputProperties properties); /// /// Creates a Live Output /// - /// - /// - /// + /// The name of the live event. + /// The name of the live output. + /// The properties of the live output. /// Task CreateAsync(string liveEventName, string liveOutputName, LiveOutputProperties properties); } diff --git a/MK.IO/LiveOutput/LiveOutputsOperations.cs b/MK.IO/LiveOutput/LiveOutputsOperations.cs index 5d9acef..1cef890 100644 --- a/MK.IO/LiveOutput/LiveOutputsOperations.cs +++ b/MK.IO/LiveOutput/LiveOutputsOperations.cs @@ -1,10 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. - using MK.IO.Models; using Newtonsoft.Json; -#if NET45 +#if NET462 using System.Net.Http; #endif diff --git a/MK.IO/MK.IO.csproj b/MK.IO/MK.IO.csproj index 66b0543..95352f6 100644 --- a/MK.IO/MK.IO.csproj +++ b/MK.IO/MK.IO.csproj @@ -1,84 +1,90 @@  - - net45;net6.0;netstandard2.1 - 10.0 - enable - enable - True - xpouyat - Microsoft - A client library for MediaKind MK/IO. - LICENSE.txt - README.md - 1.0.14 - https://github.com/xpouyat/MK.IO - git - https://github.com/xpouyat/MK.IO/blob/master/README.md - 1.0.14.0 - 1.0.14.0 - A client library for MediaKind MK/IO. - True - snupkg - mkio.png - - true - - true - - + + net6.0;netstandard2.1;netstandard2.0;net462 + 10.0 + enable + enable + True + xpouyat + Microsoft + A client library for MediaKind MK/IO. + LICENSE.txt + README.md + 1.1.0 + https://github.com/xpouyat/MK.IO + git + https://github.com/xpouyat/MK.IO/blob/master/README.md + 1.1.0.0 + 1.1.0.1 + A client library for MediaKind MK/IO. + True + snupkg + mkio.png + + true + + true + + - - true - + + true + - - - True - \ - - - True - \ - - - True - \ - - - - - - - + + + True + \ + + + True + \ + + + True + \ + + + + + + + - - - - - + + + + + - - + + - + + + + + + + - - + + - - + + - - True - \ - + + True + \ + diff --git a/MK.IO/MKIOClient.cs b/MK.IO/MKIOClient.cs index 39b4da6..d87b86f 100644 --- a/MK.IO/MKIOClient.cs +++ b/MK.IO/MKIOClient.cs @@ -5,7 +5,7 @@ using Newtonsoft.Json; using System.Net; using System.Net.Http.Headers; -#if NET45 +#if NET462 using System.Net.Http; #endif @@ -168,7 +168,7 @@ internal async Task CreateObjectPostAsync(string url, string amsJSONObje return await CreateObjectInternalAsync(url, amsJSONObject, HttpMethod.Post); } -#if NET6_0_OR_GREATER +#if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER internal async Task UpdateObjectPatchAsync(string url, string amsJSONObject) { return await CreateObjectInternalAsync(url, amsJSONObject, HttpMethod.Patch); @@ -191,7 +191,7 @@ internal async Task CreateObjectInternalAsync(string url, string amsJSON AnalyzeResponseAndThrowIfNeeded(amsRequestResult, responseContent); - if (amsRequestResult.StatusCode == System.Net.HttpStatusCode.Accepted) + if (amsRequestResult.StatusCode == HttpStatusCode.Accepted) { // let's wait for the operation to complete var monitorUrl = amsRequestResult.Headers.Where(h => h.Key == "Azure-AsyncOperation").FirstOrDefault().Value.FirstOrDefault(); diff --git a/MK.IO/StorageAccount/IStorageAccountsOperations.cs b/MK.IO/StorageAccount/IStorageAccountsOperations.cs index 9738a84..3934a72 100644 --- a/MK.IO/StorageAccount/IStorageAccountsOperations.cs +++ b/MK.IO/StorageAccount/IStorageAccountsOperations.cs @@ -25,7 +25,7 @@ public interface IStorageAccountsOperations /// The account must be in the same location as your subscription. /// The SAS token in the spec.azureStorageConfiguration.url field will be used to create a related Storage Credential object for you. /// - /// + /// The specification of the storage account to be created. /// StorageResponseSchema Create(StorageRequestSchema storage); @@ -34,7 +34,7 @@ public interface IStorageAccountsOperations /// The account must be in the same location as your subscription. /// The SAS token in the spec.azureStorageConfiguration.url field will be used to create a related Storage Credential object for you. /// - /// + /// The specification of the storage account to be created. /// Task CreateAsync(StorageRequestSchema storage); @@ -42,27 +42,27 @@ public interface IStorageAccountsOperations /// Delete our record of your storage account. This operation does not delete the storage account itself. /// This operation will not complete successfully if any assets are associated with the storage account. /// - /// + /// The storage account Id. void Delete(Guid storageAccountId); /// /// Delete our record of your storage account. This operation does not delete the storage account itself. /// This operation will not complete successfully if any assets are associated with the storage account. /// - /// + /// The storage account Id. Task DeleteAsync(Guid storageAccountId); /// /// Returns details on a single storage account /// - /// + /// The storage account Id. /// StorageResponseSchema Get(Guid storageAccountId); /// /// Returns details on a single storage account /// - /// + /// The storage account Id. /// Task GetAsync(Guid storageAccountId); @@ -70,7 +70,8 @@ public interface IStorageAccountsOperations /// Update a storage account. /// Only the description and privateLinkServiceConnection details are updatable. /// - /// + /// The storage account Id. + /// The specification of the storage account to be updated. /// StorageResponseSchema Update(Guid storageAccountId, StorageRequestSchema storage); @@ -78,37 +79,38 @@ public interface IStorageAccountsOperations /// Update a storage account. /// Only the description and privateLinkServiceConnection details are updatable. /// - /// + /// The storage account Id. + /// The specification of the storage account to be updated. /// Task UpdateAsync(Guid storageAccountId, StorageRequestSchema storage); /// /// Returns a list of storage credentials /// - /// + /// The storage account Id. /// List ListCredentials(Guid storageAccountId); /// /// Returns a list of storage credentials /// - /// + /// The storage account Id. /// Task> ListCredentialsAsync(Guid storageAccountId); /// /// Returns a single storage credential. Any secret data will be sanitized in the response. /// - /// - /// + /// The storage account Id. + /// The credential Id. /// CredentialResponseSchema GetCredential(Guid storageAccountId, Guid credentialId); /// /// Returns a single storage credential. Any secret data will be sanitized in the response. /// - /// - /// + /// The storage account Id. + /// The credential Id. /// Task GetCredentialAsync(Guid storageAccountId, Guid credentialId); @@ -118,7 +120,8 @@ public interface IStorageAccountsOperations /// We will choose the credential with the longest expiry time when we need to access the storage account. /// Credentials are immutable once created - create a new credential record, then delete the old one, to change a credential. /// - /// + /// The storage account Id. + /// The credential data. /// CredentialResponseSchema CreateCredential(Guid storageAccountId, CredentialSchema credential); @@ -128,7 +131,8 @@ public interface IStorageAccountsOperations /// We will choose the credential with the longest expiry time when we need to access the storage account. /// Credentials are immutable once created - create a new credential record, then delete the old one, to change a credential. /// - /// + /// The storage account Id. + /// The credential data. /// Task CreateCredentialAsync(Guid storageAccountId, CredentialSchema credential); @@ -136,7 +140,8 @@ public interface IStorageAccountsOperations /// Removes a storage credential from the storage account. /// If the credential is in use and no alternative credentials are available, the storage account will be inaccessible. /// - /// + /// The storage account Id. + /// The credential Id. /// void DeleteCredential(Guid storageAccountId, Guid credentialId); @@ -144,7 +149,8 @@ public interface IStorageAccountsOperations /// Removes a storage credential from the storage account. /// If the credential is in use and no alternative credentials are available, the storage account will be inaccessible. /// - /// + /// The storage account Id. + /// The credential Id. /// Task DeleteCredentialAsync(Guid storageAccountId, Guid credentialId); } diff --git a/MK.IO/StorageAccount/StorageAccountsOperations.cs b/MK.IO/StorageAccount/StorageAccountsOperations.cs index 1b2f891..9744f7b 100644 --- a/MK.IO/StorageAccount/StorageAccountsOperations.cs +++ b/MK.IO/StorageAccount/StorageAccountsOperations.cs @@ -4,7 +4,7 @@ using MK.IO.Models; using Newtonsoft.Json; -#if NET45 +#if NET462 using System.Net.Http; #endif diff --git a/MK.IO/StreamingEndpoint/IStreamingEndpointsOperations.cs b/MK.IO/StreamingEndpoint/IStreamingEndpointsOperations.cs index 39f9e2f..7c24000 100644 --- a/MK.IO/StreamingEndpoint/IStreamingEndpointsOperations.cs +++ b/MK.IO/StreamingEndpoint/IStreamingEndpointsOperations.cs @@ -3,6 +3,7 @@ using MK.IO.Models; +using Newtonsoft.Json; namespace MK.IO { @@ -23,76 +24,114 @@ public interface IStreamingEndpointsOperations /// /// Delete a Streaming Endpoint. If the Streaming Endpoint does not exist, this API will return a 204. /// - /// + /// The name of the streaming endpoint. void Delete(string streamingEndpointName); /// /// Delete a Streaming Endpoint. If the Streaming Endpoint does not exist, this API will return a 204. /// - /// + /// The name of the streaming endpoint. /// Task DeleteAsync(string streamingEndpointName); /// /// Retrieves a single Streaming Endpoint record. /// - /// + /// The name of the streaming endpoint. /// StreamingEndpointSchema Get(string streamingEndpointName); /// /// Retrieves a single Streaming Endpoint record. /// - /// + /// The name of the streaming endpoint. /// Task GetAsync(string streamingEndpointName); +#if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER + /// + /// Update a Streaming Endpoint. + /// Only the Name and cdnProvider fields are immutable. + /// + /// The name of the streaming endpoint. + /// The name of the location in which the streaming endpoint is located. This field must match the location in which the user's subscription is provisioned. + /// The properties of the streaming endpoint. + /// A dictionary of key:value pairs describing the resource. Search may be implemented against tags in the future. + /// + StreamingEndpointSchema Update(string streamingEndpointName, string location, StreamingEndpointProperties properties, Dictionary? tags = null); + + /// + /// Update a Streaming Endpoint. + /// Only the Name and cdnProvider fields are immutable. + /// + /// The name of the streaming endpoint. + /// The name of the location in which the streaming endpoint is located. This field must match the location in which the user's subscription is provisioned. + /// The properties of the streaming endpoint. + /// A dictionary of key:value pairs describing the resource. Search may be implemented against tags in the future. + /// + Task UpdateAsync(string streamingEndpointName, string location, StreamingEndpointProperties properties, Dictionary? tags = null); +#endif + /// /// Create a Streaming Endpoint. /// - /// - /// - /// + /// The name of the streaming endpoint. + /// The name of the location in which the streaming endpoint is located. This field must match the location in which the user's subscription is provisioned. + /// The properties of the streaming endpoint. /// - /// + /// A dictionary of key:value pairs describing the resource. Search may be implemented against tags in the future. /// - StreamingEndpointSchema Create(string streamingEndpointName, string location, StreamingEndpointProperties content, bool autoStart = false, Dictionary? tags = null); + StreamingEndpointSchema Create(string streamingEndpointName, string location, StreamingEndpointProperties properties, bool autoStart = false, Dictionary? tags = null); /// /// Create a Streaming Endpoint. /// - /// - /// - /// + /// The name of the streaming endpoint. + /// The name of the location in which the streaming endpoint is located. This field must match the location in which the user's subscription is provisioned. + /// The properties of the streaming endpoint. /// - /// + /// A dictionary of key:value pairs describing the resource. Search may be implemented against tags in the future. /// Task CreateAsync(string streamingEndpointName, string location, StreamingEndpointProperties properties, bool autoStart = false, Dictionary? tags = null); + /// + /// Changes the scale of the streaming endpoint. + /// + /// The name of the streaming endpoint. + /// The scale unit count for this streaming endpoint. + void Scale(string streamingEndpointName, int scaleUnit); + + /// + /// Changes the scale of the streaming endpoint. + /// + /// The name of the streaming endpoint. + /// The scale unit count for this streaming endpoint. + Task ScaleAsync(string streamingEndpointName, int scaleUnit); + /// /// Start Streaming Endpoints. /// This operation transitions your streaming endpoints into a running state. /// - /// + /// The name of the streaming endpoint. void Start(string streamingEndpointName); /// /// Start Streaming Endpoints. /// This operation transitions your streaming endpoints into a running state. /// - /// + /// The name of the streaming endpoint. Task StartAsync(string streamingEndpointName); /// /// Stops a streaming endpoint. Any active playback sessions will be interrupted. /// - /// + /// The name of the streaming endpoint. void Stop(string streamingEndpointName); /// /// Stops a streaming endpoint. Any active playback sessions will be interrupted. /// - /// + /// The name of the streaming endpoint. /// Task StopAsync(string streamingEndpointName); } diff --git a/MK.IO/StreamingEndpoint/StreamingEndpointsOperations.cs b/MK.IO/StreamingEndpoint/StreamingEndpointsOperations.cs index b8fdfc2..1ed4765 100644 --- a/MK.IO/StreamingEndpoint/StreamingEndpointsOperations.cs +++ b/MK.IO/StreamingEndpoint/StreamingEndpointsOperations.cs @@ -4,7 +4,7 @@ using MK.IO.Models; using Newtonsoft.Json; -#if NET45 +#if NET462 using System.Net.Http; #endif @@ -75,10 +75,33 @@ public async Task GetAsync(string streamingEndpointName return JsonConvert.DeserializeObject(responseContent, ConverterLE.Settings) ?? throw new Exception("Error with streaming endpoint deserialization"); } +#if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER /// - public StreamingEndpointSchema Create(string streamingEndpointName, string location, StreamingEndpointProperties content, bool autoStart = false, Dictionary? tags = null) + public StreamingEndpointSchema Update(string streamingEndpointName, string location, StreamingEndpointProperties properties, Dictionary? tags = null) { - var task = Task.Run(async () => await CreateAsync(streamingEndpointName, location, content, autoStart, tags)); + var task = Task.Run(async () => await UpdateAsync(streamingEndpointName, location, properties, tags)); + return task.GetAwaiter().GetResult(); + } + + /// + public async Task UpdateAsync(string streamingEndpointName, string location, StreamingEndpointProperties properties, Dictionary? tags = null) + { + Argument.AssertNotNullOrEmpty(streamingEndpointName, nameof(streamingEndpointName)); + Argument.AssertNotNullOrEmpty(location, nameof(location)); + Argument.AssertNotNull(properties, nameof(properties)); + + var url = Client.GenerateApiUrl(_streamingEndpointApiUrl, streamingEndpointName); + tags ??= new Dictionary(); + var content = new StreamingEndpointSchema { Location = location, Properties = properties, Tags = tags }; + string responseContent = await Client.UpdateObjectPatchAsync(url, JsonConvert.SerializeObject(content, ConverterLE.Settings)); + return JsonConvert.DeserializeObject(responseContent, ConverterLE.Settings) ?? throw new Exception("Error with streaming endpoint deserialization"); + } +#endif + + /// + public StreamingEndpointSchema Create(string streamingEndpointName, string location, StreamingEndpointProperties properties, bool autoStart = false, Dictionary? tags = null) + { + var task = Task.Run(async () => await CreateAsync(streamingEndpointName, location, properties, autoStart, tags)); return task.GetAwaiter().GetResult(); } @@ -96,6 +119,21 @@ public async Task CreateAsync(string streamingEndpointN return JsonConvert.DeserializeObject(responseContent, ConverterLE.Settings) ?? throw new Exception("Error with streaming endpoint deserialization"); } + /// + public void Scale(string streamingEndpointName, int scaleUnit) + { + Task.Run(async () => await ScaleAsync(streamingEndpointName, scaleUnit)).GetAwaiter().GetResult(); + } + + /// + public async Task ScaleAsync(string streamingEndpointName, int scaleUnit) + { + Argument.AssertNotNullOrEmpty(streamingEndpointName, nameof(streamingEndpointName)); + var url = Client.GenerateApiUrl(_streamingEndpointApiUrl + "/scale", streamingEndpointName); + var content = new StreamingEndpointScaleSchema { ScaleUnit = scaleUnit }; + await Client.CreateObjectPostAsync(url, JsonConvert.SerializeObject(content, ConverterLE.Settings)); + } + /// public void Stop(string streamingEndpointName) { diff --git a/MK.IO/StreamingLocator/IStreamingLocatorsOperations.cs b/MK.IO/StreamingLocator/IStreamingLocatorsOperations.cs index 42ab6b3..a61a2a4 100644 --- a/MK.IO/StreamingLocator/IStreamingLocatorsOperations.cs +++ b/MK.IO/StreamingLocator/IStreamingLocatorsOperations.cs @@ -26,7 +26,7 @@ public interface IStreamingLocatorsOperations /// Once the streaming locator is deleted, all future requests to the path owned by the streaming locator will fail. If content is /// cached in a CDN, playback may continue to work for some time until the cached content expires. /// - /// + /// The name of the streaming locator. /// /// void Delete(string streamingLocatorName); @@ -36,37 +36,37 @@ public interface IStreamingLocatorsOperations /// Once the streaming locator is deleted, all future requests to the path owned by the streaming locator will fail. If content is /// cached in a CDN, playback may continue to work for some time until the cached content expires. /// - /// + /// The name of the streaming locator. /// Task DeleteAsync(string streamingLocatorName); /// /// Get a streaming locator by name. /// - /// + /// The name of the streaming locator. /// StreamingLocatorSchema Get(string streamingLocatorName); /// /// Get a streaming locator by name. /// - /// + /// The name of the streaming locator. /// Task GetAsync(string streamingLocatorName); /// /// Create a streaming locator. /// - /// - /// + /// The name of the streaming locator. + /// Properties for streaming locator /// StreamingLocatorSchema Create(string streamingLocatorName, StreamingLocatorProperties properties); /// /// Create a streaming locator. /// - /// - /// + /// The name of the streaming locator. + /// Properties for streaming locator /// Task CreateAsync(string streamingLocatorName, StreamingLocatorProperties properties); @@ -74,7 +74,7 @@ public interface IStreamingLocatorsOperations /// Return the set of valid streaming paths for a given streaming locator. A distinct set of paths /// is returned for each type of DRM configured, per the 'EnabledProtocols' property of the streaming policy. /// - /// + /// The name of the streaming locator. /// StreamingLocatorListPathsResponseSchema ListUrlPaths(string streamingLocatorName); @@ -82,7 +82,7 @@ public interface IStreamingLocatorsOperations /// Return the set of valid streaming paths for a given streaming locator. A distinct set of paths /// is returned for each type of DRM configured, per the 'EnabledProtocols' property of the streaming policy. /// - /// + /// The name of the streaming locator. /// Task ListUrlPathsAsync(string streamingLocatorName); } diff --git a/MK.IO/StreamingLocator/StreamingLocatorsOperations.cs b/MK.IO/StreamingLocator/StreamingLocatorsOperations.cs index 8c634c7..8ea9211 100644 --- a/MK.IO/StreamingLocator/StreamingLocatorsOperations.cs +++ b/MK.IO/StreamingLocator/StreamingLocatorsOperations.cs @@ -4,7 +4,7 @@ using MK.IO.Models; using Newtonsoft.Json; -#if NET45 +#if NET462 using System.Net.Http; #endif diff --git a/MK.IO/Transform/ITransformsOperations.cs b/MK.IO/Transform/ITransformsOperations.cs index 3819f81..4d2686b 100644 --- a/MK.IO/Transform/ITransformsOperations.cs +++ b/MK.IO/Transform/ITransformsOperations.cs @@ -23,43 +23,43 @@ public interface ITransformsOperations /// /// Delete a Transform. /// - /// + /// The name of the transform. void Delete(string transformName); /// /// Delete a Transform. /// - /// + /// The name of the transform. /// Task DeleteAsync(string transformName); /// /// Get a Transform by name. /// - /// + /// The name of the transform. /// TransformSchema Get(string transformName); /// /// Get a Transform by name. /// - /// + /// The name of the transform. /// Task GetAsync(string transformName); /// /// Create or Update a new Transform. /// - /// - /// + /// The name of the transform. + /// he properties of the transform /// TransformSchema CreateOrUpdate(string transformName, TransformProperties properties); /// /// Create or Update a new Transform. /// - /// - /// + /// The name of the transform. + /// he properties of the transform /// Task CreateOrUpdateAsync(string transformName, TransformProperties properties); } diff --git a/MK.IO/Transform/TransformsOperations.cs b/MK.IO/Transform/TransformsOperations.cs index 86c18b8..766291b 100644 --- a/MK.IO/Transform/TransformsOperations.cs +++ b/MK.IO/Transform/TransformsOperations.cs @@ -4,7 +4,7 @@ using MK.IO.Models; using Newtonsoft.Json; -#if NET45 +#if NET462 using System.Net.Http; #endif