Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

Commit

Permalink
Merge pull request #48 from xpouyat/dev
Browse files Browse the repository at this point in the history
Dev - version 1.4.0
  • Loading branch information
xpouyat authored Mar 25, 2024
2 parents 68d51a6 + c1b2b0c commit 979f2ed
Show file tree
Hide file tree
Showing 132 changed files with 898 additions and 825 deletions.
4 changes: 3 additions & 1 deletion MK.IO/Account/AccountOperations.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

namespace MK.IO
using MK.IO.Models;

namespace MK.IO.Operations
{
/// <summary>
/// REST Client for MKIO
Expand Down
4 changes: 3 additions & 1 deletion MK.IO/Account/IAccountOperations.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

namespace MK.IO
using MK.IO.Models;

namespace MK.IO.Operations
{
public interface IAccountOperations
{
Expand Down
3 changes: 1 addition & 2 deletions MK.IO/Account/Models/AccountProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace MK.IO
namespace MK.IO.Models
{
public partial class AccountProfile
{
Expand Down Expand Up @@ -56,7 +56,6 @@ public class Permissions
}



public class UserInfo
{
[JsonProperty("name")]
Expand Down
4 changes: 1 addition & 3 deletions MK.IO/Account/Models/AccountStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@

using Newtonsoft.Json;

namespace MK.IO
namespace MK.IO.Models
{

public partial class AccountStats
{
public static AccountStats FromJson(string json)
Expand Down Expand Up @@ -44,7 +43,6 @@ public string ToJson()
public StreamingPolicies StreamingPolicies { get; set; }
}


public class Assets
{
[JsonProperty("total")]
Expand Down
3 changes: 1 addition & 2 deletions MK.IO/Account/Models/LocationListResponseSchema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using Newtonsoft.Json;

namespace MK.IO
namespace MK.IO.Models
{
public partial class LocationListResponseSchema
{
Expand All @@ -17,7 +17,6 @@ public string ToJson()
return JsonConvert.SerializeObject(this, ConverterLE.Settings);
}


[JsonProperty("kind")]
public string Kind { get; set; }

Expand Down
3 changes: 1 addition & 2 deletions MK.IO/Account/Models/LocationResponseSchema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using Newtonsoft.Json;

namespace MK.IO
namespace MK.IO.Models
{
public partial class LocationResponseSchema
{
Expand All @@ -22,7 +22,6 @@ public string ToJson()
public MetadataLocation Metadata { get; set; }
}


public class MetadataLocation
{
[JsonProperty("id")]
Expand Down
3 changes: 1 addition & 2 deletions MK.IO/Account/Models/SubscriptionListResponseSchema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using Newtonsoft.Json;

namespace MK.IO
namespace MK.IO.Models
{
public partial class SubscriptionListResponseSchema
{
Expand All @@ -17,7 +17,6 @@ public string ToJson()
return JsonConvert.SerializeObject(this, ConverterLE.Settings);
}


[JsonProperty("kind")]
public string Kind { get; set; }

Expand Down
5 changes: 2 additions & 3 deletions MK.IO/Account/Models/SubscriptionResponseSchema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@

using Newtonsoft.Json;

namespace MK.IO
namespace MK.IO.Models
{

public class SubscriptionResponseSchema
{
public static SubscriptionResponseSchema FromJson(string json)
Expand All @@ -31,7 +30,7 @@ public class MetadataSubscription
public Guid Id { get; set; }

[JsonProperty("created")]
public DateTime Created { get; set; }
public DateTime? Created { get; private set; }

[JsonProperty("updated")]
public DateTime Updated { get; set; }
Expand Down
14 changes: 7 additions & 7 deletions MK.IO/Account/Models/SubscriptionSchema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@

using Newtonsoft.Json;

namespace MK.IO
namespace MK.IO.Models
{
public class SubscriptionSchema
{
[JsonProperty("customerId")]
public Guid CustomerId { get; set; }

[JsonProperty("createdById")]
public Guid CreatedById { get; set; }
public Guid CreatedById { get; private set; }

[JsonProperty("locationId")]
public Guid LocationId { get; set; }

[JsonProperty("azureSubscriptionName")]
public string AzureSubscriptionName { get; set; }
public string? AzureSubscriptionName { get; set; }

[JsonProperty("name")]
public string Name { get; set; }
public string? Name { get; set; }

[JsonProperty("isActive")]
public bool IsActive { get; set; }
Expand All @@ -32,15 +32,15 @@ public class SubscriptionSchema
public Guid ProductPublicationId { get; set; }

[JsonProperty("azureSubscriptionStatus")]
public string AzureSubscriptionStatus { get; set; }
public string? AzureSubscriptionStatus { get; set; }

[JsonProperty("azureSubscriptionId")]
public Guid AzureSubscriptionId { get; set; }

[JsonProperty("azureSubscriptionOfferId")]
public string AzureSubscriptionOfferId { get; set; }
public string? AzureSubscriptionOfferId { get; set; }

[JsonProperty("azureSubscriptionPlanId")]
public string AzureSubscriptionPlanId { get; set; }
public string? AzureSubscriptionPlanId { get; set; }
}
}
9 changes: 7 additions & 2 deletions MK.IO/AccountFilter/AccountFiltersOperations.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
using MK.IO.Models;
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using MK.IO.Models;
using Newtonsoft.Json;
#if NET462
using System.Net.Http;
#endif

namespace MK.IO.Asset
namespace MK.IO.Operations
{
internal class AccountFiltersOperations : IAccountFiltersOperations
{
Expand Down Expand Up @@ -75,6 +78,8 @@ public async Task<AccountFilterSchema> CreateOrUpdateAsync(string accountFilterN
{
Argument.AssertNotNullOrEmpty(accountFilterName, nameof(accountFilterName));
Argument.AssertNotContainsSpace(accountFilterName, nameof(accountFilterName));
Argument.AssertNotMoreThanLength(accountFilterName, nameof(accountFilterName), 260);
Argument.AssertRespectRegex(accountFilterName, nameof(accountFilterName), @"^[a-zA-Z0-9\-_.~]+$");
Argument.AssertNotNull(properties, nameof(properties));

var url = Client.GenerateApiUrl(_accountFilterApiUrl, accountFilterName);
Expand Down
7 changes: 5 additions & 2 deletions MK.IO/AccountFilter/IAccountFiltersOperations.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using MK.IO.Models;
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

namespace MK.IO.Asset
using MK.IO.Models;

namespace MK.IO.Operations
{
public interface IAccountFiltersOperations
{
Expand Down
19 changes: 19 additions & 0 deletions MK.IO/Argument.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System.Text.RegularExpressions;

namespace MK.IO
{
internal class Argument
Expand Down Expand Up @@ -33,5 +35,22 @@ public static void AssertNotContainsSpace(string value, string name)
throw new ArgumentException("Value cannot contain space.", name);
}
}

public static void AssertNotMoreThanLength(string value, string name, int length)
{
if (value.Length > length)
{
throw new ArgumentException($"Value length cannot exceed {length}.", name);
}
}

public static void AssertRespectRegex(string value, string name, string regexPattern)
{
// check if value respects regex pattern
if (!Regex.IsMatch(value, regexPattern))
{
throw new ArgumentException($"Value does not respect regex pattern {regexPattern}.", name);
}
}
}
}
10 changes: 8 additions & 2 deletions MK.IO/Asset/AssetsOperations.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
using MK.IO.Models;
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using MK.IO.Models;
using Newtonsoft.Json;
using System.Net;
#if NET462
using System.Net.Http;
#endif

namespace MK.IO.Asset
namespace MK.IO.Operations
{
internal class AssetsOperations : IAssetsOperations
{
Expand Down Expand Up @@ -153,7 +156,10 @@ public async Task<AssetSchema> CreateOrUpdateAsync(string assetName, string cont
{
Argument.AssertNotNullOrEmpty(assetName, nameof(assetName));
Argument.AssertNotContainsSpace(assetName, nameof(assetName));
Argument.AssertNotMoreThanLength(assetName, nameof(assetName), 260);
Argument.AssertNotNullOrEmpty(containerName, nameof(containerName));
Argument.AssertNotMoreThanLength(containerName, nameof(containerName), 63);
Argument.AssertRespectRegex(containerName, nameof(containerName), @"^(?=.{3,63}$)[a-z0-9]+(-[a-z0-9]+)*$");
Argument.AssertNotNullOrEmpty(storageName, nameof(storageName));

var url = Client.GenerateApiUrl(_assetApiUrl, assetName);
Expand Down
8 changes: 5 additions & 3 deletions MK.IO/Asset/IAssetsOperations.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using MK.IO.Models;
using System.Net.NetworkInformation;
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

namespace MK.IO.Asset
using MK.IO.Models;

namespace MK.IO.Operations
{
public interface IAssetsOperations
{
Expand Down
2 changes: 1 addition & 1 deletion MK.IO/Asset/Models/AssetContainerDeletionPolicyType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Newtonsoft.Json.Converters;
using System.Runtime.Serialization;

namespace MK.IO
namespace MK.IO.Models
{
/// <summary>
/// Deletion Policy type.
Expand Down
2 changes: 1 addition & 1 deletion MK.IO/Asset/Models/AssetStreamingLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class AssetStreamingLocator
public string? DefaultContentKeyPolicyName { get; set; }

[JsonProperty("created")]
public DateTime? Created { get; set; }
public DateTime? Created { get; private set; }

[JsonProperty("endTime")]
public DateTime? EndTime { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion MK.IO/Asset/PagedResult.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

namespace MK.IO.Asset
namespace MK.IO.Operations
{
public class PagedResult<T>
{
Expand Down
9 changes: 7 additions & 2 deletions MK.IO/AssetFilter/AssetFiltersOperations.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
using MK.IO.Models;
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using MK.IO.Models;
using Newtonsoft.Json;
#if NET462
using System.Net.Http;
#endif

namespace MK.IO.Asset
namespace MK.IO.Operations
{
internal class AssetFiltersOperations : IAssetFiltersOperations
{
Expand Down Expand Up @@ -81,6 +84,8 @@ public async Task<AssetFilterSchema> CreateOrUpdateAsync(string assetName, strin
Argument.AssertNotNullOrEmpty(assetName, nameof(assetName));
Argument.AssertNotNullOrEmpty(filterName, nameof(filterName));
Argument.AssertNotContainsSpace(filterName, nameof(filterName));
Argument.AssertNotMoreThanLength(filterName, nameof(filterName), 260);
Argument.AssertRespectRegex(filterName, nameof(filterName), @"^[a-zA-Z0-9\-_.~]+$");
Argument.AssertNotNull(properties, nameof(properties));

var url = Client.GenerateApiUrl(_assetFilterApiUrl, assetName, filterName);
Expand Down
7 changes: 5 additions & 2 deletions MK.IO/AssetFilter/IAssetFiltersOperations.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using MK.IO.Models;
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

namespace MK.IO.Asset
using MK.IO.Models;

namespace MK.IO.Operations
{
public interface IAssetFiltersOperations
{
Expand Down
2 changes: 1 addition & 1 deletion MK.IO/ContentKeyPolicy/ContentKeyPoliciesOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using MK.IO.Models;
using Newtonsoft.Json;

namespace MK.IO
namespace MK.IO.Operations
{
/// <summary>
/// REST Client for MKIO
Expand Down
2 changes: 1 addition & 1 deletion MK.IO/ContentKeyPolicy/IContentKeyPoliciesOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using MK.IO.Models;

namespace MK.IO
namespace MK.IO.Operations
{
public interface IContentKeyPoliciesOperations
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Newtonsoft.Json.Converters;
using System.Runtime.Serialization;

namespace MK.IO
namespace MK.IO.Models
{
/// <summary>
/// Configures Unknown output handling settings of the license.
Expand Down
Loading

0 comments on commit 979f2ed

Please sign in to comment.