Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sb upgrades testing #1

Merged
merged 9 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<RequiredTargetFrameworks>netstandard2.0;net5.0;net47</RequiredTargetFrameworks>
<RequiredTargetFrameworks>net6.0;net47</RequiredTargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand Down
16 changes: 8 additions & 8 deletions Microsoft.Marketplace.sln
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -32,18 +32,18 @@ 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
EndGlobalSection
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}
Expand Down
12 changes: 6 additions & 6 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
<!-- <Import Project="$(MSBuildThisFileDirectory)\Directory.Build.props" Condition="Exists('..\Directory.Build.props')" /> -->

<PropertyGroup>
<RequiredTargetFrameworks Condition="$(RequiredTargetFrameworks) == ''">netstandard2.0;net5.0;net47</RequiredTargetFrameworks>
<RequiredTargetFrameworks Condition="$(RequiredTargetFrameworks) == ''">netstandard2.0;net461;net472;net6.0</RequiredTargetFrameworks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.3.0"/>
<PackageReference Include="System.Text.Json" Version="5.0.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.9.0" />
<PackageReference Include="Microsoft.Azure.AutoRest.CSharp" Version="3.0.0-beta.20210211.2" PrivateAssets="All"/>
<PackageReference Include="Azure.Core" Version="1.10.0"/>
<PackageReference Include="Azure.Identity" Version="1.10.4" />
<PackageReference Include="System.Text.Json" Version="8.0.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
<PackageReference Include="Microsoft.Azure.AutoRest.CSharp" Version="3.0.0-beta.20210211.2" PrivateAssets="All"/>
<PackageReference Include="Azure.Core" Version="1.37.0"/>
</ItemGroup>

</Project>
53 changes: 53 additions & 0 deletions src/Microsoft.Marketplace.Metering/Generated/MeteringOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#nullable disable

using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Azure;
Expand Down Expand Up @@ -115,5 +116,57 @@ public virtual Response<BatchUsageEventOkResponse> PostBatchUsageEvent(BatchUsag
throw;
}
}

/// <summary> You can call the usage events API to get the list of usage events. </summary>
/// <param name="usageStartDate"> DateTime in ISO8601 format. For example, 2020-12-03T15:00 or 2020-12-03. </param>
/// <param name="usageEndDate"> DateTime in ISO8601 format. Default = current date. </param>
/// <param name="offerId"> OfferId. </param>
/// <param name="planId"> PlanId. </param>
/// <param name="dimension"> DimensionId. </param>
/// <param name="azureSubscriptionId"> Azure Subscription Id. </param>
/// <param name="reconStatus"> Recon Status. </param>
/// <param name="requestId"> A unique string value for tracking the request from the client, preferably a GUID. If this value isn&apos;t provided, one will be generated and provided in the response headers. </param>
/// <param name="correlationId"> 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&apos;t provided, one will be generated and provided in the response headers. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<IReadOnlyList<GetUsageEvent>>> 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;
}
}

/// <summary> You can call the usage events API to get the list of usage events. </summary>
/// <param name="usageStartDate"> DateTime in ISO8601 format. For example, 2020-12-03T15:00 or 2020-12-03. </param>
/// <param name="usageEndDate"> DateTime in ISO8601 format. Default = current date. </param>
/// <param name="offerId"> OfferId. </param>
/// <param name="planId"> PlanId. </param>
/// <param name="dimension"> DimensionId. </param>
/// <param name="azureSubscriptionId"> Azure Subscription Id. </param>
/// <param name="reconStatus"> Recon Status. </param>
/// <param name="requestId"> A unique string value for tracking the request from the client, preferably a GUID. If this value isn&apos;t provided, one will be generated and provided in the response headers. </param>
/// <param name="correlationId"> 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&apos;t provided, one will be generated and provided in the response headers. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<IReadOnlyList<GetUsageEvent>> 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;
}
}
}
}
116 changes: 116 additions & 0 deletions src/Microsoft.Marketplace.Metering/Generated/MeteringRestClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#nullable disable

using System;
using System.Collections.Generic;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -210,5 +211,120 @@ public Response<BatchUsageEventOkResponse> 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;
}

/// <summary> You can call the usage events API to get the list of usage events. </summary>
/// <param name="usageStartDate"> DateTime in ISO8601 format. For example, 2020-12-03T15:00 or 2020-12-03. </param>
/// <param name="usageEndDate"> DateTime in ISO8601 format. Default = current date. </param>
/// <param name="offerId"> OfferId. </param>
/// <param name="planId"> PlanId. </param>
/// <param name="dimension"> DimensionId. </param>
/// <param name="azureSubscriptionId"> Azure Subscription Id. </param>
/// <param name="reconStatus"> Recon Status. </param>
/// <param name="requestId"> A unique string value for tracking the request from the client, preferably a GUID. If this value isn&apos;t provided, one will be generated and provided in the response headers. </param>
/// <param name="correlationId"> 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&apos;t provided, one will be generated and provided in the response headers. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async Task<Response<IReadOnlyList<GetUsageEvent>>> 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<GetUsageEvent> value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
List<GetUsageEvent> array = new List<GetUsageEvent>();
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);
}
}

/// <summary> You can call the usage events API to get the list of usage events. </summary>
/// <param name="usageStartDate"> DateTime in ISO8601 format. For example, 2020-12-03T15:00 or 2020-12-03. </param>
/// <param name="usageEndDate"> DateTime in ISO8601 format. Default = current date. </param>
/// <param name="offerId"> OfferId. </param>
/// <param name="planId"> PlanId. </param>
/// <param name="dimension"> DimensionId. </param>
/// <param name="azureSubscriptionId"> Azure Subscription Id. </param>
/// <param name="reconStatus"> Recon Status. </param>
/// <param name="requestId"> A unique string value for tracking the request from the client, preferably a GUID. If this value isn&apos;t provided, one will be generated and provided in the response headers. </param>
/// <param name="correlationId"> 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&apos;t provided, one will be generated and provided in the response headers. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response<IReadOnlyList<GetUsageEvent>> 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<GetUsageEvent> value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
List<GetUsageEvent> array = new List<GetUsageEvent>();
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);
}
}
}
}
Loading
Loading