diff --git a/Directory.Build.props b/Directory.Build.props index 1696791..e3de725 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -2,7 +2,7 @@ xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - netstandard2.0;net5.0;net47 + net6.0;net47 diff --git a/Microsoft.Marketplace.sln b/Microsoft.Marketplace.sln index 0a47a97..6ffa1e8 100644 --- a/Microsoft.Marketplace.sln +++ b/Microsoft.Marketplace.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30517.126 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34408.163 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{99CA6AAF-0F44-43CA-AD94-E02AAA6BBCF4}" EndProject @@ -16,7 +16,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Marketplace", "src\Microsoft.Marketplace.csproj", "{5E6B12AF-5AA4-4ECD-8EB7-82E9F692BA9C}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.TestFramework", "tests\Azure.Core.TestFramework\src\Azure.Core.TestFramework.csproj", "{DE29A78C-BCDD-4A58-AD8C-C7CCF983DDC5}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.TestFramework", "tests\Azure.Core.TestFramework\src\Azure.Core.TestFramework.csproj", "{F42E16A3-7B4A-4E22-9154-40B988B9848D}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -32,10 +32,10 @@ Global {5E6B12AF-5AA4-4ECD-8EB7-82E9F692BA9C}.Debug|Any CPU.Build.0 = Debug|Any CPU {5E6B12AF-5AA4-4ECD-8EB7-82E9F692BA9C}.Release|Any CPU.ActiveCfg = Release|Any CPU {5E6B12AF-5AA4-4ECD-8EB7-82E9F692BA9C}.Release|Any CPU.Build.0 = Release|Any CPU - {DE29A78C-BCDD-4A58-AD8C-C7CCF983DDC5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DE29A78C-BCDD-4A58-AD8C-C7CCF983DDC5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DE29A78C-BCDD-4A58-AD8C-C7CCF983DDC5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DE29A78C-BCDD-4A58-AD8C-C7CCF983DDC5}.Release|Any CPU.Build.0 = Release|Any CPU + {F42E16A3-7B4A-4E22-9154-40B988B9848D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F42E16A3-7B4A-4E22-9154-40B988B9848D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F42E16A3-7B4A-4E22-9154-40B988B9848D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F42E16A3-7B4A-4E22-9154-40B988B9848D}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -43,7 +43,7 @@ Global GlobalSection(NestedProjects) = preSolution {EABC6306-053C-4B32-B90F-6F8B77ED5F8D} = {99CA6AAF-0F44-43CA-AD94-E02AAA6BBCF4} {5E6B12AF-5AA4-4ECD-8EB7-82E9F692BA9C} = {481A46CA-F6C0-4580-9DDA-684C421D465E} - {DE29A78C-BCDD-4A58-AD8C-C7CCF983DDC5} = {99CA6AAF-0F44-43CA-AD94-E02AAA6BBCF4} + {F42E16A3-7B4A-4E22-9154-40B988B9848D} = {99CA6AAF-0F44-43CA-AD94-E02AAA6BBCF4} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {A40602C4-D62A-4759-AB32-1DD847B6A35B} diff --git a/src/Directory.Build.props b/src/Directory.Build.props index a4a75fd..94695f0 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -5,15 +5,15 @@ - netstandard2.0;net5.0;net47 + netstandard2.0;net461;net472;net6.0 - - - - - + + + + + diff --git a/src/Microsoft.Marketplace.Metering/Generated/MeteringOperations.cs b/src/Microsoft.Marketplace.Metering/Generated/MeteringOperations.cs index b24e74a..dca365e 100644 --- a/src/Microsoft.Marketplace.Metering/Generated/MeteringOperations.cs +++ b/src/Microsoft.Marketplace.Metering/Generated/MeteringOperations.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Azure; @@ -115,5 +116,57 @@ public virtual Response PostBatchUsageEvent(BatchUsag throw; } } + + /// You can call the usage events API to get the list of usage events. + /// DateTime in ISO8601 format. For example, 2020-12-03T15:00 or 2020-12-03. + /// DateTime in ISO8601 format. Default = current date. + /// OfferId. + /// PlanId. + /// DimensionId. + /// Azure Subscription Id. + /// Recon Status. + /// A unique string value for tracking the request from the client, preferably a GUID. If this value isn't provided, one will be generated and provided in the response headers. + /// A unique string value for operation on the client. This parameter correlates all events from client operation with events on the server side. If this value isn't provided, one will be generated and provided in the response headers. + /// The cancellation token to use. + public virtual async Task>> GetUsageEventAsync(DateTimeOffset usageStartDate, DateTimeOffset? usageEndDate = null, string offerId = null, string planId = null, string dimension = null, Guid? azureSubscriptionId = null, ReconStatusEnum? reconStatus = null, Guid? requestId = null, Guid? correlationId = null, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("MeteringOperations.GetUsageEvent"); + scope.Start(); + try + { + return await RestClient.GetUsageEventAsync(usageStartDate, usageEndDate, offerId, planId, dimension, azureSubscriptionId, reconStatus, requestId, correlationId, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// You can call the usage events API to get the list of usage events. + /// DateTime in ISO8601 format. For example, 2020-12-03T15:00 or 2020-12-03. + /// DateTime in ISO8601 format. Default = current date. + /// OfferId. + /// PlanId. + /// DimensionId. + /// Azure Subscription Id. + /// Recon Status. + /// A unique string value for tracking the request from the client, preferably a GUID. If this value isn't provided, one will be generated and provided in the response headers. + /// A unique string value for operation on the client. This parameter correlates all events from client operation with events on the server side. If this value isn't provided, one will be generated and provided in the response headers. + /// The cancellation token to use. + public virtual Response> GetUsageEvent(DateTimeOffset usageStartDate, DateTimeOffset? usageEndDate = null, string offerId = null, string planId = null, string dimension = null, Guid? azureSubscriptionId = null, ReconStatusEnum? reconStatus = null, Guid? requestId = null, Guid? correlationId = null, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("MeteringOperations.GetUsageEvent"); + scope.Start(); + try + { + return RestClient.GetUsageEvent(usageStartDate, usageEndDate, offerId, planId, dimension, azureSubscriptionId, reconStatus, requestId, correlationId, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/src/Microsoft.Marketplace.Metering/Generated/MeteringRestClient.cs b/src/Microsoft.Marketplace.Metering/Generated/MeteringRestClient.cs index ee181cb..2fa6cdf 100644 --- a/src/Microsoft.Marketplace.Metering/Generated/MeteringRestClient.cs +++ b/src/Microsoft.Marketplace.Metering/Generated/MeteringRestClient.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading; using System.Threading.Tasks; @@ -210,5 +211,120 @@ public Response PostBatchUsageEvent(BatchUsageEvent b throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } + + internal HttpMessage CreateGetUsageEventRequest(DateTimeOffset usageStartDate, DateTimeOffset? usageEndDate, string offerId, string planId, string dimension, Guid? azureSubscriptionId, ReconStatusEnum? reconStatus, Guid? requestId, Guid? correlationId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/usageEvents", false); + uri.AppendQuery("api-version", apiVersion, true); + uri.AppendQuery("usageStartDate", usageStartDate, "O", true); + if (usageEndDate != null) + { + uri.AppendQuery("UsageEndDate", usageEndDate.Value, "O", true); + } + if (offerId != null) + { + uri.AppendQuery("offerId", offerId, true); + } + if (planId != null) + { + uri.AppendQuery("planId", planId, true); + } + if (dimension != null) + { + uri.AppendQuery("dimension", dimension, true); + } + if (azureSubscriptionId != null) + { + uri.AppendQuery("azureSubscriptionId", azureSubscriptionId.Value, true); + } + if (reconStatus != null) + { + uri.AppendQuery("reconStatus", reconStatus.Value.ToSerialString(), true); + } + request.Uri = uri; + if (requestId != null) + { + request.Headers.Add("x-ms-requestid", requestId.Value); + } + if (correlationId != null) + { + request.Headers.Add("x-ms-correlationid", correlationId.Value); + } + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// You can call the usage events API to get the list of usage events. + /// DateTime in ISO8601 format. For example, 2020-12-03T15:00 or 2020-12-03. + /// DateTime in ISO8601 format. Default = current date. + /// OfferId. + /// PlanId. + /// DimensionId. + /// Azure Subscription Id. + /// Recon Status. + /// A unique string value for tracking the request from the client, preferably a GUID. If this value isn't provided, one will be generated and provided in the response headers. + /// A unique string value for operation on the client. This parameter correlates all events from client operation with events on the server side. If this value isn't provided, one will be generated and provided in the response headers. + /// The cancellation token to use. + public async Task>> GetUsageEventAsync(DateTimeOffset usageStartDate, DateTimeOffset? usageEndDate = null, string offerId = null, string planId = null, string dimension = null, Guid? azureSubscriptionId = null, ReconStatusEnum? reconStatus = null, Guid? requestId = null, Guid? correlationId = null, CancellationToken cancellationToken = default) + { + using var message = CreateGetUsageEventRequest(usageStartDate, usageEndDate, offerId, planId, dimension, azureSubscriptionId, reconStatus, requestId, correlationId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + IReadOnlyList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + List array = new List(); + foreach (var item in document.RootElement.EnumerateArray()) + { + array.Add(Models.GetUsageEvent.DeserializeGetUsageEvent(item)); + } + value = array; + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// You can call the usage events API to get the list of usage events. + /// DateTime in ISO8601 format. For example, 2020-12-03T15:00 or 2020-12-03. + /// DateTime in ISO8601 format. Default = current date. + /// OfferId. + /// PlanId. + /// DimensionId. + /// Azure Subscription Id. + /// Recon Status. + /// A unique string value for tracking the request from the client, preferably a GUID. If this value isn't provided, one will be generated and provided in the response headers. + /// A unique string value for operation on the client. This parameter correlates all events from client operation with events on the server side. If this value isn't provided, one will be generated and provided in the response headers. + /// The cancellation token to use. + public Response> GetUsageEvent(DateTimeOffset usageStartDate, DateTimeOffset? usageEndDate = null, string offerId = null, string planId = null, string dimension = null, Guid? azureSubscriptionId = null, ReconStatusEnum? reconStatus = null, Guid? requestId = null, Guid? correlationId = null, CancellationToken cancellationToken = default) + { + using var message = CreateGetUsageEventRequest(usageStartDate, usageEndDate, offerId, planId, dimension, azureSubscriptionId, reconStatus, requestId, correlationId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + IReadOnlyList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + List array = new List(); + foreach (var item in document.RootElement.EnumerateArray()) + { + array.Add(Models.GetUsageEvent.DeserializeGetUsageEvent(item)); + } + value = array; + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } } } diff --git a/src/Microsoft.Marketplace.Metering/Generated/Models/GetUsageEvent.Serialization.cs b/src/Microsoft.Marketplace.Metering/Generated/Models/GetUsageEvent.Serialization.cs new file mode 100644 index 0000000..d9dec0c --- /dev/null +++ b/src/Microsoft.Marketplace.Metering/Generated/Models/GetUsageEvent.Serialization.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Microsoft.Marketplace.Metering.Models +{ + public partial class GetUsageEvent + { + internal static GetUsageEvent DeserializeGetUsageEvent(JsonElement element) + { + Optional usageDate = default; + Optional usageResourceId = default; + Optional dimension = default; + Optional planId = default; + Optional planName = default; + Optional offerId = default; + Optional offerName = default; + Optional offerType = default; + Optional azureSubscriptionId = default; + Optional reconStatus = default; + Optional submittedQuantity = default; + Optional processedQuantity = default; + Optional submittedCount = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("usageDate")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + usageDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("usageResourceId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + usageResourceId = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("dimension")) + { + dimension = property.Value.GetString(); + continue; + } + if (property.NameEquals("planId")) + { + planId = property.Value.GetString(); + continue; + } + if (property.NameEquals("planName")) + { + planName = property.Value.GetString(); + continue; + } + if (property.NameEquals("offerId")) + { + offerId = property.Value.GetString(); + continue; + } + if (property.NameEquals("offerName")) + { + offerName = property.Value.GetString(); + continue; + } + if (property.NameEquals("offerType")) + { + offerType = property.Value.GetString(); + continue; + } + if (property.NameEquals("azureSubscriptionId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + azureSubscriptionId = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("reconStatus")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + reconStatus = property.Value.GetString().ToReconStatusEnum(); + continue; + } + if (property.NameEquals("submittedQuantity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + submittedQuantity = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("processedQuantity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + processedQuantity = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("submittedCount")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + submittedCount = property.Value.GetDouble(); + continue; + } + } + return new GetUsageEvent(Optional.ToNullable(usageDate), Optional.ToNullable(usageResourceId), dimension.Value, planId.Value, planName.Value, offerId.Value, offerName.Value, offerType.Value, Optional.ToNullable(azureSubscriptionId), Optional.ToNullable(reconStatus), Optional.ToNullable(submittedQuantity), Optional.ToNullable(processedQuantity), Optional.ToNullable(submittedCount)); + } + } +} diff --git a/src/Microsoft.Marketplace.Metering/Generated/Models/GetUsageEvent.cs b/src/Microsoft.Marketplace.Metering/Generated/Models/GetUsageEvent.cs new file mode 100644 index 0000000..1aac1cf --- /dev/null +++ b/src/Microsoft.Marketplace.Metering/Generated/Models/GetUsageEvent.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Microsoft.Marketplace.Metering.Models +{ + /// The GetUsageEvent. + public partial class GetUsageEvent + { + /// Initializes a new instance of GetUsageEvent. + internal GetUsageEvent() + { + } + + /// Initializes a new instance of GetUsageEvent. + /// Time in UTC when the usage event occurred. + /// Identifier of the resource against which usage is emitted. + /// Dimension. + /// PlanId. + /// PlanName. + /// OfferId. + /// OfferName. + /// OfferType. + /// Azure Subscription Id. + /// Recon Status. + /// Submitted Quantity. + /// Processed Quantity. + /// Submitted count. + internal GetUsageEvent(DateTimeOffset? usageDate, Guid? usageResourceId, string dimension, string planId, string planName, string offerId, string offerName, string offerType, Guid? azureSubscriptionId, ReconStatusEnum? reconStatus, double? submittedQuantity, double? processedQuantity, double? submittedCount) + { + UsageDate = usageDate; + UsageResourceId = usageResourceId; + Dimension = dimension; + PlanId = planId; + PlanName = planName; + OfferId = offerId; + OfferName = offerName; + OfferType = offerType; + AzureSubscriptionId = azureSubscriptionId; + ReconStatus = reconStatus; + SubmittedQuantity = submittedQuantity; + ProcessedQuantity = processedQuantity; + SubmittedCount = submittedCount; + } + + /// Time in UTC when the usage event occurred. + public DateTimeOffset? UsageDate { get; } + /// Identifier of the resource against which usage is emitted. + public Guid? UsageResourceId { get; } + /// Dimension. + public string Dimension { get; } + /// PlanId. + public string PlanId { get; } + /// PlanName. + public string PlanName { get; } + /// OfferId. + public string OfferId { get; } + /// OfferName. + public string OfferName { get; } + /// OfferType. + public string OfferType { get; } + /// Azure Subscription Id. + public Guid? AzureSubscriptionId { get; } + /// Recon Status. + public ReconStatusEnum? ReconStatus { get; } + /// Submitted Quantity. + public double? SubmittedQuantity { get; } + /// Processed Quantity. + public double? ProcessedQuantity { get; } + /// Submitted count. + public double? SubmittedCount { get; } + } +} diff --git a/src/Microsoft.Marketplace.Metering/Generated/Models/ReconStatusEnum.Serialization.cs b/src/Microsoft.Marketplace.Metering/Generated/Models/ReconStatusEnum.Serialization.cs new file mode 100644 index 0000000..25c3568 --- /dev/null +++ b/src/Microsoft.Marketplace.Metering/Generated/Models/ReconStatusEnum.Serialization.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Microsoft.Marketplace.Metering.Models +{ + internal static partial class ReconStatusEnumExtensions + { + public static string ToSerialString(this ReconStatusEnum value) => value switch + { + ReconStatusEnum.Submitted => "Submitted", + ReconStatusEnum.Accepted => "Accepted", + ReconStatusEnum.Rejected => "Rejected", + ReconStatusEnum.Mismatch => "Mismatch", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ReconStatusEnum value.") + }; + + public static ReconStatusEnum ToReconStatusEnum(this string value) + { + if (string.Equals(value, "Submitted", StringComparison.InvariantCultureIgnoreCase)) return ReconStatusEnum.Submitted; + if (string.Equals(value, "Accepted", StringComparison.InvariantCultureIgnoreCase)) return ReconStatusEnum.Accepted; + if (string.Equals(value, "Rejected", StringComparison.InvariantCultureIgnoreCase)) return ReconStatusEnum.Rejected; + if (string.Equals(value, "Mismatch", StringComparison.InvariantCultureIgnoreCase)) return ReconStatusEnum.Mismatch; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ReconStatusEnum value."); + } + } +} diff --git a/src/Microsoft.Marketplace.Metering/Generated/Models/ReconStatusEnum.cs b/src/Microsoft.Marketplace.Metering/Generated/Models/ReconStatusEnum.cs new file mode 100644 index 0000000..def09a1 --- /dev/null +++ b/src/Microsoft.Marketplace.Metering/Generated/Models/ReconStatusEnum.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Microsoft.Marketplace.Metering.Models +{ + /// Reconcilliation status of the submitted meter. + public enum ReconStatusEnum + { + /// Submitted. + Submitted, + /// Accepted. + Accepted, + /// Rejected. + Rejected, + /// Mismatch. + Mismatch + } +} diff --git a/src/Microsoft.Marketplace.Metering/Generated/Models/UsageEventStatusEnum.Serialization.cs b/src/Microsoft.Marketplace.Metering/Generated/Models/UsageEventStatusEnum.Serialization.cs index 2926d12..4c5fe06 100644 --- a/src/Microsoft.Marketplace.Metering/Generated/Models/UsageEventStatusEnum.Serialization.cs +++ b/src/Microsoft.Marketplace.Metering/Generated/Models/UsageEventStatusEnum.Serialization.cs @@ -19,6 +19,7 @@ internal static partial class UsageEventStatusEnumExtensions UsageEventStatusEnum.Error => "Error", UsageEventStatusEnum.ResourceNotFound => "ResourceNotFound", UsageEventStatusEnum.ResourceNotAuthorized => "ResourceNotAuthorized", + UsageEventStatusEnum.ResourceNotActive => "ResourceNotActive", UsageEventStatusEnum.InvalidDimension => "InvalidDimension", UsageEventStatusEnum.InvalidQuantity => "InvalidQuantity", UsageEventStatusEnum.BadArgument => "BadArgument", @@ -33,6 +34,7 @@ public static UsageEventStatusEnum ToUsageEventStatusEnum(this string value) if (string.Equals(value, "Error", StringComparison.InvariantCultureIgnoreCase)) return UsageEventStatusEnum.Error; if (string.Equals(value, "ResourceNotFound", StringComparison.InvariantCultureIgnoreCase)) return UsageEventStatusEnum.ResourceNotFound; if (string.Equals(value, "ResourceNotAuthorized", StringComparison.InvariantCultureIgnoreCase)) return UsageEventStatusEnum.ResourceNotAuthorized; + if (string.Equals(value, "ResourceNotActive", StringComparison.InvariantCultureIgnoreCase)) return UsageEventStatusEnum.ResourceNotActive; if (string.Equals(value, "InvalidDimension", StringComparison.InvariantCultureIgnoreCase)) return UsageEventStatusEnum.InvalidDimension; if (string.Equals(value, "InvalidQuantity", StringComparison.InvariantCultureIgnoreCase)) return UsageEventStatusEnum.InvalidQuantity; if (string.Equals(value, "BadArgument", StringComparison.InvariantCultureIgnoreCase)) return UsageEventStatusEnum.BadArgument; diff --git a/src/Microsoft.Marketplace.Metering/Generated/Models/UsageEventStatusEnum.cs b/src/Microsoft.Marketplace.Metering/Generated/Models/UsageEventStatusEnum.cs index 6426cf0..b8ec8fd 100644 --- a/src/Microsoft.Marketplace.Metering/Generated/Models/UsageEventStatusEnum.cs +++ b/src/Microsoft.Marketplace.Metering/Generated/Models/UsageEventStatusEnum.cs @@ -22,6 +22,8 @@ public enum UsageEventStatusEnum ResourceNotFound, /// ResourceNotAuthorized. ResourceNotAuthorized, + /// ResourceNotActive. + ResourceNotActive, /// InvalidDimension. InvalidDimension, /// InvalidQuantity. diff --git a/src/Microsoft.Marketplace.Metering/IMeteringOperations.cs b/src/Microsoft.Marketplace.Metering/IMeteringOperations.cs index e8081b8..dcc08f4 100644 --- a/src/Microsoft.Marketplace.Metering/IMeteringOperations.cs +++ b/src/Microsoft.Marketplace.Metering/IMeteringOperations.cs @@ -19,5 +19,9 @@ public interface IMeteringOperations Response PostUsageEvent(UsageEvent body, Guid? requestId = null, Guid? correlationId = null, CancellationToken cancellationToken = default); Task> PostUsageEventAsync(UsageEvent body, Guid? requestId = null, Guid? correlationId = null, CancellationToken cancellationToken = default); + + Response> GetUsageEvent(DateTimeOffset usageStartDate, DateTimeOffset? usageEndDate = null, string offerId = null, string planId = null, string dimension = null, Guid? azureSubscriptionId = null, ReconStatusEnum? reconStatus = null, Guid? requestId = null, Guid? correlationId = null, CancellationToken cancellationToken = default); + + Task>> GetUsageEventAsync(DateTimeOffset usageStartDate, DateTimeOffset? usageEndDate = null, string offerId = null, string planId = null, string dimension = null, Guid? azureSubscriptionId = null, ReconStatusEnum? reconStatus = null, Guid? requestId = null, Guid? correlationId = null, CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/Microsoft.Marketplace.Metering/autorest.md b/src/Microsoft.Marketplace.Metering/autorest.md index d0d3192..1ff9cbf 100644 --- a/src/Microsoft.Marketplace.Metering/autorest.md +++ b/src/Microsoft.Marketplace.Metering/autorest.md @@ -7,7 +7,7 @@ title: Microsoft.Marketplace.Metering require: $(this-folder)/../autorest.md input-file: - - https://github.com/microsoft/commercial-marketplace-openapi/blob/ae3f6900997e0bf850dae86aec61098cf179efd3/Microsoft.Marketplace.Metering/2018-08-31/meteringapi.v1.json + - https://github.com/microsoft/commercial-marketplace-openapi/blob/4eede61a53c509ea78e4ad36591bea793aafa44c/Microsoft.Marketplace.Metering/2018-08-31/meteringapi.v1.json namespace: Microsoft.Marketplace.Metering directive: from: swagger-document diff --git a/src/Microsoft.Marketplace.SaaS/Generated/Models/OperationList.Serialization.cs b/src/Microsoft.Marketplace.SaaS/Generated/Models/OperationList.Serialization.cs index 85ef223..cc7bde4 100644 --- a/src/Microsoft.Marketplace.SaaS/Generated/Models/OperationList.Serialization.cs +++ b/src/Microsoft.Marketplace.SaaS/Generated/Models/OperationList.Serialization.cs @@ -15,7 +15,7 @@ public partial class OperationList { internal static OperationList DeserializeOperationList(JsonElement element) { - Optional> operations = default; + Optional> operations = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("operations")) @@ -25,10 +25,10 @@ internal static OperationList DeserializeOperationList(JsonElement element) property.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(Operation.DeserializeOperation(item)); + array.Add(SaaSOperation.DeserializeSaaSOperation(item)); } operations = array; continue; diff --git a/src/Microsoft.Marketplace.SaaS/Generated/Models/OperationList.cs b/src/Microsoft.Marketplace.SaaS/Generated/Models/OperationList.cs index 5f7ca8a..155bebc 100644 --- a/src/Microsoft.Marketplace.SaaS/Generated/Models/OperationList.cs +++ b/src/Microsoft.Marketplace.SaaS/Generated/Models/OperationList.cs @@ -16,16 +16,16 @@ public partial class OperationList /// Initializes a new instance of OperationList. internal OperationList() { - Operations = new ChangeTrackingList(); + Operations = new ChangeTrackingList(); } /// Initializes a new instance of OperationList. /// . - internal OperationList(IReadOnlyList operations) + internal OperationList(IReadOnlyList operations) { Operations = operations; } - public IReadOnlyList Operations { get; } + public IReadOnlyList Operations { get; } } } diff --git a/src/Microsoft.Marketplace.SaaS/Generated/Models/Plan.Serialization.cs b/src/Microsoft.Marketplace.SaaS/Generated/Models/Plan.Serialization.cs index 903ab80..a23746f 100644 --- a/src/Microsoft.Marketplace.SaaS/Generated/Models/Plan.Serialization.cs +++ b/src/Microsoft.Marketplace.SaaS/Generated/Models/Plan.Serialization.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure.Core; @@ -18,11 +20,14 @@ internal static Plan DeserializePlan(JsonElement element) Optional displayName = default; Optional isPrivate = default; Optional description = default; + Optional minQuantity = default; + Optional maxQuantity = default; Optional hasFreeTrials = default; Optional isPricePerSeat = default; Optional isStopSell = default; Optional market = default; Optional planComponents = default; + Optional> sourceOffers = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("planId")) @@ -50,6 +55,26 @@ internal static Plan DeserializePlan(JsonElement element) description = property.Value.GetString(); continue; } + if (property.NameEquals("minQuantity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + minQuantity = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("maxQuantity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + maxQuantity = property.Value.GetInt64(); + continue; + } if (property.NameEquals("hasFreeTrials")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -95,8 +120,23 @@ internal static Plan DeserializePlan(JsonElement element) planComponents = PlanComponents.DeserializePlanComponents(property.Value); continue; } + if (property.NameEquals("sourceOffers")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetGuid()); + } + sourceOffers = array; + continue; + } } - return new Plan(planId.Value, displayName.Value, Optional.ToNullable(isPrivate), description.Value, Optional.ToNullable(hasFreeTrials), Optional.ToNullable(isPricePerSeat), Optional.ToNullable(isStopSell), market.Value, planComponents.Value); + return new Plan(planId.Value, displayName.Value, Optional.ToNullable(isPrivate), description.Value, Optional.ToNullable(minQuantity), Optional.ToNullable(maxQuantity), Optional.ToNullable(hasFreeTrials), Optional.ToNullable(isPricePerSeat), Optional.ToNullable(isStopSell), market.Value, planComponents.Value, Optional.ToList(sourceOffers)); } } } diff --git a/src/Microsoft.Marketplace.SaaS/Generated/Models/Plan.cs b/src/Microsoft.Marketplace.SaaS/Generated/Models/Plan.cs index b77fa03..2266204 100644 --- a/src/Microsoft.Marketplace.SaaS/Generated/Models/Plan.cs +++ b/src/Microsoft.Marketplace.SaaS/Generated/Models/Plan.cs @@ -5,6 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; +using Azure.Core; + namespace Microsoft.Marketplace.SaaS.Models { /// The Plan. @@ -13,6 +17,7 @@ public partial class Plan /// Initializes a new instance of Plan. internal Plan() { + SourceOffers = new ChangeTrackingList(); } /// Initializes a new instance of Plan. @@ -20,32 +25,41 @@ internal Plan() /// . /// . /// . + /// . + /// . /// . /// . /// . /// . /// . - internal Plan(string planId, string displayName, bool? isPrivate, string description, bool? hasFreeTrials, bool? isPricePerSeat, bool? isStopSell, string market, PlanComponents planComponents) + /// . + internal Plan(string planId, string displayName, bool? isPrivate, string description, long? minQuantity, long? maxQuantity, bool? hasFreeTrials, bool? isPricePerSeat, bool? isStopSell, string market, PlanComponents planComponents, IReadOnlyList sourceOffers) { PlanId = planId; DisplayName = displayName; IsPrivate = isPrivate; Description = description; + MinQuantity = minQuantity; + MaxQuantity = maxQuantity; HasFreeTrials = hasFreeTrials; IsPricePerSeat = isPricePerSeat; IsStopSell = isStopSell; Market = market; PlanComponents = planComponents; + SourceOffers = sourceOffers; } public string PlanId { get; } public string DisplayName { get; } public bool? IsPrivate { get; } public string Description { get; } + public long? MinQuantity { get; } + public long? MaxQuantity { get; } public bool? HasFreeTrials { get; } public bool? IsPricePerSeat { get; } public bool? IsStopSell { get; } public string Market { get; } public PlanComponents PlanComponents { get; } + public IReadOnlyList SourceOffers { get; } } } diff --git a/src/Microsoft.Marketplace.SaaS/Generated/Models/Operation.Serialization.cs b/src/Microsoft.Marketplace.SaaS/Generated/Models/SaaSOperation.Serialization.cs similarity index 90% rename from src/Microsoft.Marketplace.SaaS/Generated/Models/Operation.Serialization.cs rename to src/Microsoft.Marketplace.SaaS/Generated/Models/SaaSOperation.Serialization.cs index 07ec4d8..41e4aee 100644 --- a/src/Microsoft.Marketplace.SaaS/Generated/Models/Operation.Serialization.cs +++ b/src/Microsoft.Marketplace.SaaS/Generated/Models/SaaSOperation.Serialization.cs @@ -11,9 +11,9 @@ namespace Microsoft.Marketplace.SaaS.Models { - public partial class Operation + public partial class SaaSOperation { - internal static Operation DeserializeOperation(JsonElement element) + internal static SaaSOperation DeserializeSaaSOperation(JsonElement element) { Optional id = default; Optional activityId = default; @@ -113,7 +113,7 @@ internal static Operation DeserializeOperation(JsonElement element) continue; } } - return new Operation(Optional.ToNullable(id), Optional.ToNullable(activityId), Optional.ToNullable(subscriptionId), offerId.Value, publisherId.Value, planId.Value, Optional.ToNullable(quantity), Optional.ToNullable(action), Optional.ToNullable(timeStamp), Optional.ToNullable(status)); + return new SaaSOperation(Optional.ToNullable(id), Optional.ToNullable(activityId), Optional.ToNullable(subscriptionId), offerId.Value, publisherId.Value, planId.Value, Optional.ToNullable(quantity), Optional.ToNullable(action), Optional.ToNullable(timeStamp), Optional.ToNullable(status)); } } } diff --git a/src/Microsoft.Marketplace.SaaS/Generated/Models/Operation.cs b/src/Microsoft.Marketplace.SaaS/Generated/Models/SaaSOperation.cs similarity index 74% rename from src/Microsoft.Marketplace.SaaS/Generated/Models/Operation.cs rename to src/Microsoft.Marketplace.SaaS/Generated/Models/SaaSOperation.cs index c2bb436..37b0d0a 100644 --- a/src/Microsoft.Marketplace.SaaS/Generated/Models/Operation.cs +++ b/src/Microsoft.Marketplace.SaaS/Generated/Models/SaaSOperation.cs @@ -9,15 +9,15 @@ namespace Microsoft.Marketplace.SaaS.Models { - /// The Operation. - public partial class Operation + /// The SaaSOperation. + public partial class SaaSOperation { - /// Initializes a new instance of Operation. - internal Operation() + /// Initializes a new instance of SaaSOperation. + internal SaaSOperation() { } - /// Initializes a new instance of Operation. + /// Initializes a new instance of SaaSOperation. /// . /// . /// . @@ -28,7 +28,7 @@ internal Operation() /// . /// . /// . - internal Operation(Guid? id, Guid? activityId, Guid? subscriptionId, string offerId, string publisherId, string planId, int? quantity, OperationActionEnum? action, DateTimeOffset? timeStamp, OperationStatusEnum? status) + internal SaaSOperation(Guid? id, Guid? activityId, Guid? subscriptionId, string offerId, string publisherId, string planId, int? quantity, OperationActionEnum? action, DateTimeOffset? timeStamp, OperationStatusEnum? status) { Id = id; ActivityId = activityId; diff --git a/src/Microsoft.Marketplace.SaaS/Generated/Models/Subscription.Serialization.cs b/src/Microsoft.Marketplace.SaaS/Generated/Models/Subscription.Serialization.cs index 70ec2d7..46f315b 100644 --- a/src/Microsoft.Marketplace.SaaS/Generated/Models/Subscription.Serialization.cs +++ b/src/Microsoft.Marketplace.SaaS/Generated/Models/Subscription.Serialization.cs @@ -30,9 +30,6 @@ internal static Subscription DeserializeSubscription(JsonElement element) Optional isTest = default; Optional isFreeTrial = default; Optional> allowedCustomerOperations = default; - Optional sessionId = default; - Optional fulfillmentId = default; - Optional storeFront = default; Optional sandboxType = default; Optional created = default; Optional sessionMode = default; @@ -163,31 +160,6 @@ internal static Subscription DeserializeSubscription(JsonElement element) allowedCustomerOperations = array; continue; } - if (property.NameEquals("sessionId")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - sessionId = property.Value.GetGuid(); - continue; - } - if (property.NameEquals("fulfillmentId")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - fulfillmentId = property.Value.GetGuid(); - continue; - } - if (property.NameEquals("storeFront")) - { - storeFront = property.Value.GetString(); - continue; - } if (property.NameEquals("sandboxType")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -219,7 +191,7 @@ internal static Subscription DeserializeSubscription(JsonElement element) continue; } } - return new Subscription(Optional.ToNullable(id), publisherId.Value, offerId.Value, name.Value, Optional.ToNullable(saasSubscriptionStatus), beneficiary.Value, purchaser.Value, planId.Value, Optional.ToNullable(quantity), term.Value, Optional.ToNullable(autoRenew), Optional.ToNullable(isTest), Optional.ToNullable(isFreeTrial), Optional.ToList(allowedCustomerOperations), Optional.ToNullable(sessionId), Optional.ToNullable(fulfillmentId), storeFront.Value, Optional.ToNullable(sandboxType), Optional.ToNullable(created), Optional.ToNullable(sessionMode)); + return new Subscription(Optional.ToNullable(id), publisherId.Value, offerId.Value, name.Value, Optional.ToNullable(saasSubscriptionStatus), beneficiary.Value, purchaser.Value, planId.Value, Optional.ToNullable(quantity), term.Value, Optional.ToNullable(autoRenew), Optional.ToNullable(isTest), Optional.ToNullable(isFreeTrial), Optional.ToList(allowedCustomerOperations), Optional.ToNullable(sandboxType), Optional.ToNullable(created), Optional.ToNullable(sessionMode)); } } } diff --git a/src/Microsoft.Marketplace.SaaS/Generated/Models/Subscription.cs b/src/Microsoft.Marketplace.SaaS/Generated/Models/Subscription.cs index 0c25738..7c1cb03 100644 --- a/src/Microsoft.Marketplace.SaaS/Generated/Models/Subscription.cs +++ b/src/Microsoft.Marketplace.SaaS/Generated/Models/Subscription.cs @@ -35,13 +35,10 @@ internal Subscription() /// Indicating whether the current subscription is a test asset. /// true - the customer subscription is currently in free trial, false - the customer subscription is not currently in free trial.(optional field - default false). /// . - /// . - /// . - /// . /// Possible Values are None, Csp (Csp sandbox purchase). /// . /// Dry Run indicates all transactions run as Test-Mode in the commerce stack. - internal Subscription(Guid? id, string publisherId, string offerId, string name, SubscriptionStatusEnum? saasSubscriptionStatus, AadIdentifier beneficiary, AadIdentifier purchaser, string planId, int? quantity, SubscriptionTerm term, bool? autoRenew, bool? isTest, bool? isFreeTrial, IReadOnlyList allowedCustomerOperations, Guid? sessionId, Guid? fulfillmentId, string storeFront, SandboxTypeEnum? sandboxType, DateTimeOffset? created, SessionModeEnum? sessionMode) + internal Subscription(Guid? id, string publisherId, string offerId, string name, SubscriptionStatusEnum? saasSubscriptionStatus, AadIdentifier beneficiary, AadIdentifier purchaser, string planId, int? quantity, SubscriptionTerm term, bool? autoRenew, bool? isTest, bool? isFreeTrial, IReadOnlyList allowedCustomerOperations, SandboxTypeEnum? sandboxType, DateTimeOffset? created, SessionModeEnum? sessionMode) { Id = id; PublisherId = publisherId; @@ -57,9 +54,6 @@ internal Subscription(Guid? id, string publisherId, string offerId, string name, IsTest = isTest; IsFreeTrial = isFreeTrial; AllowedCustomerOperations = allowedCustomerOperations; - SessionId = sessionId; - FulfillmentId = fulfillmentId; - StoreFront = storeFront; SandboxType = sandboxType; Created = created; SessionMode = sessionMode; @@ -83,9 +77,6 @@ internal Subscription(Guid? id, string publisherId, string offerId, string name, /// true - the customer subscription is currently in free trial, false - the customer subscription is not currently in free trial.(optional field - default false). public bool? IsFreeTrial { get; } public IReadOnlyList AllowedCustomerOperations { get; } - public Guid? SessionId { get; } - public Guid? FulfillmentId { get; } - public string StoreFront { get; } /// Possible Values are None, Csp (Csp sandbox purchase). public SandboxTypeEnum? SandboxType { get; } public DateTimeOffset? Created { get; } diff --git a/src/Microsoft.Marketplace.SaaS/Generated/SubscriptionOperations.cs b/src/Microsoft.Marketplace.SaaS/Generated/SubscriptionOperations.cs index 5ca88c3..49ab2aa 100644 --- a/src/Microsoft.Marketplace.SaaS/Generated/SubscriptionOperations.cs +++ b/src/Microsoft.Marketplace.SaaS/Generated/SubscriptionOperations.cs @@ -82,7 +82,7 @@ public virtual Response ListOperations(Guid subscriptionId, Guid? /// A unique string value for tracking the request from the client, preferably a GUID. If this value isn't provided, one will be generated and provided in the response headers. /// A unique string value for operation on the client. This parameter correlates all events from client operation with events on the server side. If this value isn't provided, one will be generated and provided in the response headers. /// The cancellation token to use. - public virtual async Task> GetOperationStatusAsync(Guid subscriptionId, Guid operationId, Guid? requestId = null, Guid? correlationId = null, CancellationToken cancellationToken = default) + public virtual async Task> GetOperationStatusAsync(Guid subscriptionId, Guid operationId, Guid? requestId = null, Guid? correlationId = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("SubscriptionOperations.GetOperationStatus"); scope.Start(); @@ -103,7 +103,7 @@ public virtual async Task> GetOperationStatusAsync(Guid subs /// A unique string value for tracking the request from the client, preferably a GUID. If this value isn't provided, one will be generated and provided in the response headers. /// A unique string value for operation on the client. This parameter correlates all events from client operation with events on the server side. If this value isn't provided, one will be generated and provided in the response headers. /// The cancellation token to use. - public virtual Response GetOperationStatus(Guid subscriptionId, Guid operationId, Guid? requestId = null, Guid? correlationId = null, CancellationToken cancellationToken = default) + public virtual Response GetOperationStatus(Guid subscriptionId, Guid operationId, Guid? requestId = null, Guid? correlationId = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("SubscriptionOperations.GetOperationStatus"); scope.Start(); diff --git a/src/Microsoft.Marketplace.SaaS/Generated/SubscriptionOperationsRestClient.cs b/src/Microsoft.Marketplace.SaaS/Generated/SubscriptionOperationsRestClient.cs index edb99a5..25cd733 100644 --- a/src/Microsoft.Marketplace.SaaS/Generated/SubscriptionOperationsRestClient.cs +++ b/src/Microsoft.Marketplace.SaaS/Generated/SubscriptionOperationsRestClient.cs @@ -144,7 +144,7 @@ internal HttpMessage CreateGetOperationStatusRequest(Guid subscriptionId, Guid o /// A unique string value for tracking the request from the client, preferably a GUID. If this value isn't provided, one will be generated and provided in the response headers. /// A unique string value for operation on the client. This parameter correlates all events from client operation with events on the server side. If this value isn't provided, one will be generated and provided in the response headers. /// The cancellation token to use. - public async Task> GetOperationStatusAsync(Guid subscriptionId, Guid operationId, Guid? requestId = null, Guid? correlationId = null, CancellationToken cancellationToken = default) + public async Task> GetOperationStatusAsync(Guid subscriptionId, Guid operationId, Guid? requestId = null, Guid? correlationId = null, CancellationToken cancellationToken = default) { using var message = CreateGetOperationStatusRequest(subscriptionId, operationId, requestId, correlationId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); @@ -152,9 +152,9 @@ public async Task> GetOperationStatusAsync(Guid subscription { case 200: { - Operation value = default; + SaaSOperation value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = Operation.DeserializeOperation(document.RootElement); + value = SaaSOperation.DeserializeSaaSOperation(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -168,7 +168,7 @@ public async Task> GetOperationStatusAsync(Guid subscription /// A unique string value for tracking the request from the client, preferably a GUID. If this value isn't provided, one will be generated and provided in the response headers. /// A unique string value for operation on the client. This parameter correlates all events from client operation with events on the server side. If this value isn't provided, one will be generated and provided in the response headers. /// The cancellation token to use. - public Response GetOperationStatus(Guid subscriptionId, Guid operationId, Guid? requestId = null, Guid? correlationId = null, CancellationToken cancellationToken = default) + public Response GetOperationStatus(Guid subscriptionId, Guid operationId, Guid? requestId = null, Guid? correlationId = null, CancellationToken cancellationToken = default) { using var message = CreateGetOperationStatusRequest(subscriptionId, operationId, requestId, correlationId); _pipeline.Send(message, cancellationToken); @@ -176,9 +176,9 @@ public Response GetOperationStatus(Guid subscriptionId, Guid operatio { case 200: { - Operation value = default; + SaaSOperation value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = Operation.DeserializeOperation(document.RootElement); + value = SaaSOperation.DeserializeSaaSOperation(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/src/Microsoft.Marketplace.SaaS/ISubscriptionOperations.cs b/src/Microsoft.Marketplace.SaaS/ISubscriptionOperations.cs index b40189c..8d51ae2 100644 --- a/src/Microsoft.Marketplace.SaaS/ISubscriptionOperations.cs +++ b/src/Microsoft.Marketplace.SaaS/ISubscriptionOperations.cs @@ -11,9 +11,9 @@ namespace Microsoft.Marketplace.SaaS { public interface ISubscriptionOperations { - Response GetOperationStatus(Guid subscriptionId, Guid operationId, Guid? requestId = null, Guid? correlationId = null, CancellationToken cancellationToken = default); + Response GetOperationStatus(Guid subscriptionId, Guid operationId, Guid? requestId = null, Guid? correlationId = null, CancellationToken cancellationToken = default); - Task> GetOperationStatusAsync(Guid subscriptionId, Guid operationId, Guid? requestId = null, Guid? correlationId = null, CancellationToken cancellationToken = default); + Task> GetOperationStatusAsync(Guid subscriptionId, Guid operationId, Guid? requestId = null, Guid? correlationId = null, CancellationToken cancellationToken = default); Response ListOperations(Guid subscriptionId, Guid? requestId = null, Guid? correlationId = null, CancellationToken cancellationToken = default); diff --git a/src/Microsoft.Marketplace.SaaS/autorest.md b/src/Microsoft.Marketplace.SaaS/autorest.md index 2050d11..174201f 100644 --- a/src/Microsoft.Marketplace.SaaS/autorest.md +++ b/src/Microsoft.Marketplace.SaaS/autorest.md @@ -7,7 +7,7 @@ title: Microsoft.Marketplace.SaaS require: $(this-folder)/../autorest.md input-file: - - https://github.com/microsoft/commercial-marketplace-openapi/blob/0c7ce552cb6d5121b983f8351697965b6551f8cd/Microsoft.Marketplace.SaaS/2018-08-31/saasapi.v2.json + - https://github.com/microsoft/commercial-marketplace-openapi/blob/c817ffae1642f09937633f7b41090891958d8500/Microsoft.Marketplace.SaaS/2018-08-31/saasapi.v2.json namespace: Microsoft.Marketplace.SaaS directive: from: swagger-document diff --git a/tests/Azure.Core.TestFramework/src/Azure.Core.TestFramework.csproj b/tests/Azure.Core.TestFramework/src/Azure.Core.TestFramework.csproj index bf8d702..f2429bc 100644 --- a/tests/Azure.Core.TestFramework/src/Azure.Core.TestFramework.csproj +++ b/tests/Azure.Core.TestFramework/src/Azure.Core.TestFramework.csproj @@ -8,12 +8,12 @@ - - - - - - + + + + + + diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index 8c18a40..c71c133 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -4,7 +4,7 @@ - netstandard2.0;net5.0;net47 + net6.0;net47 diff --git a/tests/Microsoft.Marketplace.Tests/FulfillmentTests.cs b/tests/Microsoft.Marketplace.Tests/FulfillmentTests.cs index 1f3421e..56c865a 100644 --- a/tests/Microsoft.Marketplace.Tests/FulfillmentTests.cs +++ b/tests/Microsoft.Marketplace.Tests/FulfillmentTests.cs @@ -6,7 +6,6 @@ using System.Diagnostics; using System.Linq; using System.Net.Http; -using System.Security; using System.Security.Cryptography.X509Certificates; using System.Threading.Tasks; using Azure.Core; @@ -19,6 +18,7 @@ using Microsoft.Marketplace.SaaS; using Microsoft.Marketplace.SaaS.Models; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace Microsoft.Marketplace.Tests { @@ -27,7 +27,7 @@ namespace Microsoft.Marketplace.Tests public class FulfillmentTests : RecordedTestBase #pragma warning restore SA1600 // Elements should be documented { - private const string MarketplacePurchaseIdentificationToken = "IPZARpJbiIC3rDAESnmm2Zg1GJdHYHshWjLOvr/g+ASyLao9rPVrQ+mu2Li6uOBdtf7v/vXH6v+FdBT8egYh0Pmrv/kLoIbf/MuINnMLi+4IW2UFhR2qsrxRbEBfxYthSjKIrk28TgeZp19rDcNV1GqSXqR49Pma9i9EkPj6E8OTd71WWrJHG/4j+GOtm3Q1sFoBIzslczlC+BX89bcH8/a3zbir8fy+rDl576YKdE8="; + private const string MarketplacePurchaseIdentificationToken = "2FnFznEDcwKdPBXWJ/3Lm+3pZHkfYAgDLE8g7Msv2kQ1Z5P9x8Ddtq4ST4VV8PauQjkTaUpH74IclbSNexpiD9jdickD4U2waJ0KatdID8UdS6/xOvIlu5H7uawLWQUnzLCvNa0BNBR2VOGStPaC6PUG0RI/tqfwooiCH4OgYc5zRNC9qZAB3BBf4L9JpFGJRa6H2cnEcdwi/ZRN89u87w=="; private IConfigurationRoot config; @@ -35,9 +35,9 @@ public class FulfillmentTests : RecordedTestBase #pragma warning disable SA1600 // Elements should be documented public FulfillmentTests() - // Uncomment following to record - // : base(true, RecordedTestMode.Record) - : base(true, RecordedTestMode.Playback) + // Uncomment following to record + // : base(true, RecordedTestMode.Record) + : base(true, RecordedTestMode.Playback) #pragma warning restore SA1600 // Elements should be documented { this.config = new ConfigurationBuilder() @@ -55,7 +55,7 @@ public async Task GetAllSubscriptionsAsListAsync() Debug.Print($"Received {subscriptions} subscriptions"); Debug.Print($"Received {subscriptions.Select(s => s.Id).Distinct().ToList().Count} distinct subscriptions"); - NUnit.Framework.Assert.IsTrue(subscriptions.Any()); + ClassicAssert.IsTrue(subscriptions.Any()); } [RecordedTest] @@ -67,7 +67,7 @@ public async Task GetAllSubscriptionsAsListWithCertAsync() Debug.Print($"Received {subscriptions} subscriptions"); Debug.Print($"Received {subscriptions.Select(s => s.Id).Distinct().ToList().Count} distinct subscriptions"); - NUnit.Framework.Assert.IsTrue(subscriptions.Any()); + ClassicAssert.IsTrue(subscriptions.Any()); } [RecordedTest] @@ -75,17 +75,17 @@ public async Task GetSubscription() { var sut = this.InstrumentClient(this.GetMarketplaceSaaSClient()); var subscriptions = await sut.Fulfillment.ListSubscriptionsAsync().ToListAsync(); - Assert.IsTrue(subscriptions.Any()); + ClassicAssert.IsTrue(subscriptions.Any()); var subscription = subscriptions.First(); var result = await sut.Fulfillment.GetSubscriptionAsync(subscription.Id.Value); - Assert.IsNotNull(result); + ClassicAssert.IsNotNull(result); - Assert.IsNotNull(result.Value.Beneficiary.TenantId); + ClassicAssert.IsNotNull(result.Value.Beneficiary.TenantId); - Assert.IsInstanceOf(result.Value.Created); + ClassicAssert.IsInstanceOf(result.Value.Created); } [RecordedTest] @@ -105,7 +105,7 @@ public async Task GetAllSubscriptionsPaged() Debug.Print($"Received {subscriptions} subscriptions"); Debug.Print($"Received {subscriptions.Select(s => s.Id).Distinct().ToList().Count} distinct subscriptions"); - Assert.IsTrue(subscriptions.Any()); + ClassicAssert.IsTrue(subscriptions.Any()); } [RecordedTest] @@ -119,7 +119,7 @@ public async Task ResolveSubscription() var resolvedSubscription = await sut.Fulfillment.ResolveAsync(marketplaceToken); Debug.Print(resolvedSubscription.Value.SubscriptionName); - Assert.IsNotNull(resolvedSubscription); + ClassicAssert.IsNotNull(resolvedSubscription); } [RecordedTest] @@ -133,7 +133,7 @@ public async Task ResolveSubscriptionWithCert() var resolvedSubscription = await sut.Fulfillment.ResolveAsync(marketplaceToken); Debug.Print(resolvedSubscription.Value.SubscriptionName); - Assert.IsNotNull(resolvedSubscription); + ClassicAssert.IsNotNull(resolvedSubscription); } [RecordedTest] @@ -142,7 +142,7 @@ public async Task UpdateSubscription() var sut = this.InstrumentClient(this.GetMarketplaceSaaSClient()); var subscriptions = await sut.Fulfillment.ListSubscriptionsAsync().ToListAsync(); - Assert.IsTrue(subscriptions.Any()); + ClassicAssert.IsTrue(subscriptions.Any()); var firstActiveSubscription = subscriptions.First(s => s.SaasSubscriptionStatus.Value == SubscriptionStatusEnum.Subscribed); @@ -155,7 +155,7 @@ public async Task UpdateSubscription() var operation = await sut.Operations.GetOperationStatusAsync(firstActiveSubscription.Id.Value, operationId); - Assert.IsNotNull(operation); + ClassicAssert.IsNotNull(operation); Debug.Print(Enum.GetName(typeof(OperationStatusEnum), operation.Value.Status)); } @@ -170,8 +170,8 @@ public async Task ListAvailablePlans() var availablePlans = await sut.Fulfillment.ListAvailablePlansAsync(contosoSubscription.Id.Value); - Assert.IsTrue(availablePlans.Value.Plans.SelectMany(p => p.PlanComponents.MeteringDimensions).Any()); - Assert.IsTrue(availablePlans.Value.Plans.SelectMany(p => p.PlanComponents.RecurrentBillingTerms).Any()); + ClassicAssert.IsTrue(availablePlans.Value.Plans.SelectMany(p => p.PlanComponents.MeteringDimensions).Any()); + ClassicAssert.IsTrue(availablePlans.Value.Plans.SelectMany(p => p.PlanComponents.RecurrentBillingTerms).Any()); } [RecordedTest] @@ -192,8 +192,8 @@ public async Task PostSingleUsageWithResourceUri() var result = await sut.Metering.PostUsageEventAsync(usageEvent); - Assert.AreEqual(result.Value.Status, UsageEventStatusEnum.Accepted); - Assert.AreEqual(result.Value.Quantity, 20.5); + ClassicAssert.AreEqual(result.Value.Status, UsageEventStatusEnum.Accepted); + ClassicAssert.AreEqual(result.Value.Quantity, 20.5); } [RecordedTest] @@ -216,8 +216,8 @@ public async Task PostSingleUsageWithResourceId() var result = await sut.Metering.PostUsageEventAsync(usageEvent); - Assert.AreEqual(result.Value.Status, UsageEventStatusEnum.Accepted); - Assert.AreEqual(result.Value.Quantity, 20.5); + ClassicAssert.AreEqual(result.Value.Status, UsageEventStatusEnum.Accepted); + ClassicAssert.AreEqual(result.Value.Quantity, 20.5); } [RecordedTest] @@ -251,17 +251,27 @@ public async Task PostBatchUsage() var result = await sut.Metering.PostBatchUsageEventAsync(usageBatch); - Assert.IsTrue(result.Value.Result.All(r => r.Status == UsageEventStatusEnum.Accepted)); - Assert.IsTrue(result.Value.Result.All(r => r.Quantity == 20.5)); - Assert.AreEqual(result.Value.Count, 2); - Assert.IsTrue(result.Value.Result.All(r => r.Error == default)); + ClassicAssert.IsTrue(result.Value.Result.All(r => r.Status == UsageEventStatusEnum.Accepted)); + ClassicAssert.IsTrue(result.Value.Result.All(r => r.Quantity == 20.5)); + ClassicAssert.AreEqual(result.Value.Count, 2); + ClassicAssert.IsTrue(result.Value.Result.All(r => r.Error == default)); // Now get duplicates result = await sut.Metering.PostBatchUsageEventAsync(usageBatch); - Assert.IsTrue(result.Value.Result.All(r => r.Status == UsageEventStatusEnum.Duplicate)); - Assert.IsTrue(result.Value.Result.All(r => r.Error != default)); - Assert.IsTrue(result.Value.Result.All(r => r.UsageEventId == default)); + ClassicAssert.IsTrue(result.Value.Result.All(r => r.Status == UsageEventStatusEnum.Duplicate)); + ClassicAssert.IsTrue(result.Value.Result.All(r => r.Error != default)); + ClassicAssert.IsTrue(result.Value.Result.All(r => r.UsageEventId == default)); + } + + [RecordedTest] + public async Task GetMeterUsage() + { + var sut = this.InstrumentClient(this.GetMarketplaceMeteringClient()); + var yesterday = this.Mode == RecordedTestMode.Playback ? DateTime.Parse("2024-01-18T06:12:40.0746760Z").ToUniversalTime() : DateTime.UtcNow.AddDays(-1); + var result = await sut.Metering.GetUsageEventAsync(yesterday); + + ClassicAssert.IsTrue(result.Value.Any()); } private MarketplaceSaaSClient GetMarketplaceSaaSClient(bool useCert = false) diff --git a/tests/Microsoft.Marketplace.Tests/Microsoft.Marketplace.Tests.csproj b/tests/Microsoft.Marketplace.Tests/Microsoft.Marketplace.Tests.csproj index 2bc4303..5bb9a87 100644 --- a/tests/Microsoft.Marketplace.Tests/Microsoft.Marketplace.Tests.csproj +++ b/tests/Microsoft.Marketplace.Tests/Microsoft.Marketplace.Tests.csproj @@ -1,7 +1,7 @@ - + - net5.0 + net6.0 a41117b3-abaa-4bd0-86cc-bf3c014142c8 @@ -15,19 +15,12 @@ true - - - - - - - - + - - + + @@ -35,10 +28,10 @@ - - - - + + + + @@ -49,15 +42,15 @@ - - - + + + - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all @@ -68,4 +61,9 @@ + + + + + diff --git a/tests/Microsoft.Marketplace.Tests/SessionRecords/FulfillmentTests/GetMeterUsageAsync.json b/tests/Microsoft.Marketplace.Tests/SessionRecords/FulfillmentTests/GetMeterUsageAsync.json new file mode 100644 index 0000000..e3ebb89 --- /dev/null +++ b/tests/Microsoft.Marketplace.Tests/SessionRecords/FulfillmentTests/GetMeterUsageAsync.json @@ -0,0 +1,40 @@ +{ + "Entries": [ + { + "RequestUri": "https://marketplaceapi.microsoft.com/api/usageEvents?api-version=2018-08-31\u0026usageStartDate=2024-01-18T06%3A12%3A40.0746760Z", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-742831eb8c8e7c22ccf8d19be01f4fb9-ec7ee813bfee1b56-00", + "User-Agent": "azsdk-net-Microsoft.Marketplace/1.0.0 (.NET 6.0.26; Microsoft Windows 10.0.22621)", + "x-ms-client-request-id": "18f5ce3e-6790-a548-91fc-0cb06c94a724", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Accept-Ranges": "bytes", + "Connection": "keep-alive", + "Content-Length": "1089", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 19 Jan 2024 06:12:41 GMT", + "mise-correlation-id": "b4714cb7-fd04-4dd0-a4e6-002d20236d47", + "Set-Cookie": [ + "ARRAffinity=3b465a6a7ecf1050cba96e08bdd73408f917882519717f0e1456eda9f6b61aee;Path=/;HttpOnly;Secure;Domain=saasapi.azure.com", + "ARRAffinitySameSite=3b465a6a7ecf1050cba96e08bdd73408f917882519717f0e1456eda9f6b61aee;Path=/;HttpOnly;SameSite=None;Secure;Domain=saasapi.azure.com" + ], + "x-azure-ref": "20240119T061241Z-sptutmqcg11cx8k9v1edm5p8x800000000m000000001t892", + "X-Cache": "CONFIG_NOCACHE", + "X-Content-Type-Options": "nosniff", + "x-ms-correlationid": "bda7fccc-a3b8-4d9b-bc70-7cc49b15f4b1", + "x-ms-requestid": "bda7fccc-a3b8-4d9b-bc70-7cc49b15f4b1", + "X-Powered-By": "ASP.NET" + }, + "ResponseBody": "[{\u0022usageDate\u0022:\u00222024-01-19T00:00:00Z\u0022,\u0022usageResourceId\u0022:\u002218c51f6e-4d1b-48da-da96-23c9f3558cfc\u0022,\u0022dimension\u0022:\u0022q2\u0022,\u0022planId\u0022:\u0022milestone\u0022,\u0022planName\u0022:\u0022\u0022,\u0022offerId\u0022:\u0022sb-test-preview\u0022,\u0022offerName\u0022:\u0022\u0022,\u0022offerType\u0022:\u0022SaaS\u0022,\u0022azureSubscriptionId\u0022:\u00226791bfbb-5494-4eca-ae6f-e60a7c01077c\u0022,\u0022reconStatus\u0022:\u0022Submitted\u0022,\u0022submittedQuantity\u0022:6.0,\u0022processedQuantity\u0022:0.0,\u0022submittedCount\u0022:6},{\u0022usageDate\u0022:\u00222024-01-18T00:00:00Z\u0022,\u0022usageResourceId\u0022:\u002218c51f6e-4d1b-48da-da96-23c9f3558cfc\u0022,\u0022dimension\u0022:\u0022q2\u0022,\u0022planId\u0022:\u0022milestone\u0022,\u0022planName\u0022:\u0022\u0022,\u0022offerId\u0022:\u0022sb-test-preview\u0022,\u0022offerName\u0022:\u0022\u0022,\u0022offerType\u0022:\u0022SaaS\u0022,\u0022azureSubscriptionId\u0022:\u00226791bfbb-5494-4eca-ae6f-e60a7c01077c\u0022,\u0022reconStatus\u0022:\u0022Submitted\u0022,\u0022submittedQuantity\u0022:17.0,\u0022processedQuantity\u0022:0.0,\u0022submittedCount\u0022:17},{\u0022usageDate\u0022:\u00222024-01-18T00:00:00Z\u0022,\u0022usageResourceId\u0022:\u002248e4f71a-35de-48ec-d602-b748a986587f\u0022,\u0022dimension\u0022:\u0022q2\u0022,\u0022planId\u0022:\u0022milestone\u0022,\u0022planName\u0022:\u0022\u0022,\u0022offerId\u0022:\u0022sb-test-preview\u0022,\u0022offerName\u0022:\u0022\u0022,\u0022offerType\u0022:\u0022SaaS\u0022,\u0022azureSubscriptionId\u0022:\u00226791bfbb-5494-4eca-ae6f-e60a7c01077c\u0022,\u0022reconStatus\u0022:\u0022Submitted\u0022,\u0022submittedQuantity\u0022:1.0,\u0022processedQuantity\u0022:0.0,\u0022submittedCount\u0022:1}]" + } + ], + "Variables": { + "RandomSeed": "25035204" + } +} \ No newline at end of file diff --git a/tests/Microsoft.Marketplace.Tests/SessionRecords/FulfillmentTests/ResolveSubscriptionAsync.json b/tests/Microsoft.Marketplace.Tests/SessionRecords/FulfillmentTests/ResolveSubscriptionAsync.json index 3d5cf19..427f651 100644 --- a/tests/Microsoft.Marketplace.Tests/SessionRecords/FulfillmentTests/ResolveSubscriptionAsync.json +++ b/tests/Microsoft.Marketplace.Tests/SessionRecords/FulfillmentTests/ResolveSubscriptionAsync.json @@ -6,59 +6,60 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "traceparent": "00-a2dbe797c81df84eb6f690658417d4a1-6a2e60b08e17b24e-00", - "User-Agent": [ - "azsdk-net-Microsoft.Marketplace/1.0.0", - "(.NET 5.0.2; Microsoft Windows 10.0.21332)" - ], + "traceparent": "00-1c9fc1b4b73b5420247b66d0c80bb9c6-37e71520d906a8aa-00", + "User-Agent": "azsdk-net-Microsoft.Marketplace/1.0.0 (.NET 6.0.26; Microsoft Windows 10.0.22621)", "x-ms-client-request-id": "fcf5a7ee-1b2f-a327-a5aa-09b406b5fe11", - "x-ms-marketplace-token": "IPZARpJbiIC3rDAESnmm2Zg1GJdHYHshWjLOvr/g\u002BASyLao9rPVrQ\u002Bmu2Li6uOBdtf7v/vXH6v\u002BFdBT8egYh0Pmrv/kLoIbf/MuINnMLi\u002B4IW2UFhR2qsrxRbEBfxYthSjKIrk28TgeZp19rDcNV1GqSXqR49Pma9i9EkPj6E8OTd71WWrJHG/4j\u002BGOtm3Q1sFoBIzslczlC\u002BBX89bcH8/a3zbir8fy\u002BrDl576YKdE8=", + "x-ms-marketplace-token": "2FnFznEDcwKdPBXWJ/3Lm\u002B3pZHkfYAgDLE8g7Msv2kQ1Z5P9x8Ddtq4ST4VV8PauQjkTaUpH74IclbSNexpiD9jdickD4U2waJ0KatdID8UdS6/xOvIlu5H7uawLWQUnzLCvNa0BNBR2VOGStPaC6PUG0RI/tqfwooiCH4OgYc5zRNC9qZAB3BBf4L9JpFGJRa6H2cnEcdwi/ZRN89u87w==", "x-ms-return-client-request-id": "true" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "Content-Length": "1027", + "Accept-Ranges": "bytes", + "Connection": "keep-alive", + "Content-Length": "1000", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 15 Mar 2021 23:06:04 GMT", + "Date": "Wed, 17 Jan 2024 17:40:57 GMT", + "mise-correlation-id": "863071a7-1c3e-4ca3-9078-52410ee7c5cc", "Set-Cookie": [ - "ARRAffinity=ff65af957656edaa56e531d6c6097c7d151aeacf50dad58bbf5b489286d2e843;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceapi.azure.com", - "ARRAffinitySameSite=ff65af957656edaa56e531d6c6097c7d151aeacf50dad58bbf5b489286d2e843;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceapi.azure.com" + "ARRAffinity=de7d6685337db5796ac937cb299869659d92886509fa86a84877d6b74ca14565;Path=/;HttpOnly;Secure;Domain=saasapi.azure.com", + "ARRAffinitySameSite=de7d6685337db5796ac937cb299869659d92886509fa86a84877d6b74ca14565;Path=/;HttpOnly;SameSite=None;Secure;Domain=saasapi.azure.com" ], - "X-Azure-Ref": "0XOhPYAAAAAC/vEtIDoCsS44HjSZ6R8VVV1NURURHRTA4MTcAMzEwNGIwOWItOTRhZS00NmZjLTkwMDYtMWVhMjA3YmE3YzE4", + "x-azure-ref": "20240117T174056Z-scx7sggch51gt19h2n2xadfg8g00000006n000000000mk3p", + "X-Cache": "CONFIG_NOCACHE", "X-Content-Type-Options": "nosniff", - "x-ms-activityid": "93de0d2b-bccf-4341-a286-27f6ffeeb381", - "x-ms-correlationid": "ad4ce12f-0c45-4a51-9474-aaaa395cac36", - "x-ms-requestid": "ad4ce12f-0c45-4a51-9474-aaaa395cac36", + "x-ms-activityid": "31bf9d6c-a117-4537-b820-fbf3d5c288fc", + "x-ms-correlationid": "d7891dd7-bc3c-49fc-b847-9d10b0e65278", + "x-ms-requestid": "d7891dd7-bc3c-49fc-b847-9d10b0e65278", "X-Powered-By": "ASP.NET" }, "ResponseBody": { - "id": "da8dc4ae-4cdf-ed6b-e12e-9d0219306842", - "subscriptionName": "Redmond121", - "offerId": "contoso_saas_offer-preview", - "planId": "silver", + "id": "b8d6908b-0058-413a-cd62-b6761cf31997", + "subscriptionName": "sb-2023134", + "offerId": "sb-test-preview", + "planId": "test", "subscription": { - "id": "da8dc4ae-4cdf-ed6b-e12e-9d0219306842", + "id": "b8d6908b-0058-413a-cd62-b6761cf31997", "publisherId": "testtestindustryexperiencestest", - "offerId": "contoso_saas_offer-preview", - "name": "Redmond121", + "offerId": "sb-test-preview", + "name": "sb-2023134", "saasSubscriptionStatus": "Subscribed", "beneficiary": { - "emailId": "ercenk@microsoft.com", - "objectId": "df30a7e0-98dc-41a6-afa6-d1ddea551529", + "emailId": "sbomma@microsoft.com", + "objectId": "20688948-5bcb-4b80-bc9d-4cb83b4e32fd", "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", - "puid": "10033FFFA7593A0D" + "puid": "10032000748AD514" }, "purchaser": { - "emailId": "ercenk@microsoft.com", - "objectId": "df30a7e0-98dc-41a6-afa6-d1ddea551529", + "emailId": "sbomma@microsoft.com", + "objectId": "20688948-5bcb-4b80-bc9d-4cb83b4e32fd", "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", - "puid": "10033FFFA7593A0D" + "puid": "10032000748AD514" }, - "planId": "silver", + "planId": "test", "term": { - "startDate": "2021-02-21T00:00:00Z", - "endDate": "2021-03-20T00:00:00Z", + "startDate": "2024-01-14T00:00:00Z", + "endDate": "2024-02-13T00:00:00Z", "termUnit": "P1M" }, "autoRenew": true, @@ -66,11 +67,11 @@ "isFreeTrial": false, "allowedCustomerOperations": [ "Delete", - "Update", - "Read" + "Read", + "Update" ], "sandboxType": "None", - "created": "2021-01-21T18:47:25.2241546Z", + "created": "2023-04-14T00:07:14.962328Z", "lastModified": "0001-01-01T00:00:00", "sessionMode": "None" } diff --git a/tests/Microsoft.Marketplace.Tests/SessionRecords/FulfillmentTests/ResolveSubscriptionWithCertAsync.json b/tests/Microsoft.Marketplace.Tests/SessionRecords/FulfillmentTests/ResolveSubscriptionWithCertAsync.json index 4cd0eba..86f76ac 100644 --- a/tests/Microsoft.Marketplace.Tests/SessionRecords/FulfillmentTests/ResolveSubscriptionWithCertAsync.json +++ b/tests/Microsoft.Marketplace.Tests/SessionRecords/FulfillmentTests/ResolveSubscriptionWithCertAsync.json @@ -6,59 +6,60 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "traceparent": "00-8b235b5624818e45b17bc67ad04432c8-e5bd48476d70e947-00", - "User-Agent": [ - "azsdk-net-Microsoft.Marketplace/1.0.0", - "(.NET 5.0.2; Microsoft Windows 10.0.21332)" - ], + "traceparent": "00-37da38d26c6fffc5e4086029ae5bc85a-58cad35b458b02f7-00", + "User-Agent": "azsdk-net-Microsoft.Marketplace/1.0.0 (.NET 6.0.26; Microsoft Windows 10.0.22621)", "x-ms-client-request-id": "8ee70faf-9b5f-e40d-dbb9-ba6a9b5da94e", - "x-ms-marketplace-token": "IPZARpJbiIC3rDAESnmm2Zg1GJdHYHshWjLOvr/g\u002BASyLao9rPVrQ\u002Bmu2Li6uOBdtf7v/vXH6v\u002BFdBT8egYh0Pmrv/kLoIbf/MuINnMLi\u002B4IW2UFhR2qsrxRbEBfxYthSjKIrk28TgeZp19rDcNV1GqSXqR49Pma9i9EkPj6E8OTd71WWrJHG/4j\u002BGOtm3Q1sFoBIzslczlC\u002BBX89bcH8/a3zbir8fy\u002BrDl576YKdE8=", + "x-ms-marketplace-token": "2FnFznEDcwKdPBXWJ/3Lm\u002B3pZHkfYAgDLE8g7Msv2kQ1Z5P9x8Ddtq4ST4VV8PauQjkTaUpH74IclbSNexpiD9jdickD4U2waJ0KatdID8UdS6/xOvIlu5H7uawLWQUnzLCvNa0BNBR2VOGStPaC6PUG0RI/tqfwooiCH4OgYc5zRNC9qZAB3BBf4L9JpFGJRa6H2cnEcdwi/ZRN89u87w==", "x-ms-return-client-request-id": "true" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "Content-Length": "1027", + "Accept-Ranges": "bytes", + "Connection": "keep-alive", + "Content-Length": "1000", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 15 Mar 2021 23:06:05 GMT", + "Date": "Wed, 17 Jan 2024 17:40:58 GMT", + "mise-correlation-id": "5b1c6e34-ef0e-4a66-90cf-e4452c3a9d01", "Set-Cookie": [ - "ARRAffinity=13673d48a5a129d46ca17ebde23192c9909d356fbe3a23654c2a7fe603495bcb;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceapi.azure.com", - "ARRAffinitySameSite=13673d48a5a129d46ca17ebde23192c9909d356fbe3a23654c2a7fe603495bcb;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceapi.azure.com" + "ARRAffinity=de7d6685337db5796ac937cb299869659d92886509fa86a84877d6b74ca14565;Path=/;HttpOnly;Secure;Domain=saasapi.azure.com", + "ARRAffinitySameSite=de7d6685337db5796ac937cb299869659d92886509fa86a84877d6b74ca14565;Path=/;HttpOnly;SameSite=None;Secure;Domain=saasapi.azure.com" ], - "X-Azure-Ref": "0XehPYAAAAADhSegXyoOQQKHwLbEPmH4zV1NURURHRTA4MDgAMzEwNGIwOWItOTRhZS00NmZjLTkwMDYtMWVhMjA3YmE3YzE4", + "x-azure-ref": "20240117T174058Z-suh3u1r1517sxduexs3ga16k3800000000bg00000000bs0s", + "X-Cache": "CONFIG_NOCACHE", "X-Content-Type-Options": "nosniff", - "x-ms-activityid": "2a674cb3-1459-44e0-9d0f-135fb819a1c5", - "x-ms-correlationid": "094609e4-30c7-4b12-9f54-2bbc02e41eed", - "x-ms-requestid": "094609e4-30c7-4b12-9f54-2bbc02e41eed", + "x-ms-activityid": "cbb76436-c4f1-45bf-a165-4cc117313fa3", + "x-ms-correlationid": "a2a80b3a-d1ea-4b3c-9ed7-c44c170a07e0", + "x-ms-requestid": "a2a80b3a-d1ea-4b3c-9ed7-c44c170a07e0", "X-Powered-By": "ASP.NET" }, "ResponseBody": { - "id": "da8dc4ae-4cdf-ed6b-e12e-9d0219306842", - "subscriptionName": "Redmond121", - "offerId": "contoso_saas_offer-preview", - "planId": "silver", + "id": "b8d6908b-0058-413a-cd62-b6761cf31997", + "subscriptionName": "sb-2023134", + "offerId": "sb-test-preview", + "planId": "test", "subscription": { - "id": "da8dc4ae-4cdf-ed6b-e12e-9d0219306842", + "id": "b8d6908b-0058-413a-cd62-b6761cf31997", "publisherId": "testtestindustryexperiencestest", - "offerId": "contoso_saas_offer-preview", - "name": "Redmond121", + "offerId": "sb-test-preview", + "name": "sb-2023134", "saasSubscriptionStatus": "Subscribed", "beneficiary": { - "emailId": "ercenk@microsoft.com", - "objectId": "df30a7e0-98dc-41a6-afa6-d1ddea551529", + "emailId": "sbomma@microsoft.com", + "objectId": "20688948-5bcb-4b80-bc9d-4cb83b4e32fd", "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", - "puid": "10033FFFA7593A0D" + "puid": "10032000748AD514" }, "purchaser": { - "emailId": "ercenk@microsoft.com", - "objectId": "df30a7e0-98dc-41a6-afa6-d1ddea551529", + "emailId": "sbomma@microsoft.com", + "objectId": "20688948-5bcb-4b80-bc9d-4cb83b4e32fd", "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", - "puid": "10033FFFA7593A0D" + "puid": "10032000748AD514" }, - "planId": "silver", + "planId": "test", "term": { - "startDate": "2021-02-21T00:00:00Z", - "endDate": "2021-03-20T00:00:00Z", + "startDate": "2024-01-14T00:00:00Z", + "endDate": "2024-02-13T00:00:00Z", "termUnit": "P1M" }, "autoRenew": true, @@ -66,11 +67,11 @@ "isFreeTrial": false, "allowedCustomerOperations": [ "Delete", - "Update", - "Read" + "Read", + "Update" ], "sandboxType": "None", - "created": "2021-01-21T18:47:25.2241546Z", + "created": "2023-04-14T00:07:14.962328Z", "lastModified": "0001-01-01T00:00:00", "sessionMode": "None" }