From 22c1df0714a2d93c6c400dc0d1abaa88c0d82993 Mon Sep 17 00:00:00 2001 From: Matt Galbraith Date: Wed, 15 Dec 2021 16:49:19 -0800 Subject: [PATCH 1/3] Regenerate Swagger client for Arcade Helix SDK --- .../Client/CSharp/generated-code/Aggregate.cs | 1306 +++++++++++++++++ .../Client/CSharp/generated-code/Analysis.cs | 252 ++++ .../Client/CSharp/generated-code/HelixApi.cs | 14 +- .../Models/AggregateAnalysisDetail.cs | 54 + .../Models/AggregateAnalysisSummary.cs | 46 + .../AggregateAnalysisSummaryKeyedData.cs | 38 + .../Models/AggregateWorkItemSummary.cs | 38 + .../Models/AggregatedVMScalingHistory.cs | 25 + .../Models/AggregatedWorkItemCounts.cs | 38 + .../generated-code/Models/AnalysisCount.cs | 38 + .../generated-code/Models/BuildAggregation.cs | 34 + .../Models/BuildAggregationSource.cs | 17 + .../generated-code/Models/BuildHistoryItem.cs | 38 + .../Models/DetailedVMScalingHistory.cs | 52 + .../generated-code/Models/Displayable.cs | 19 - .../Models/HistoricalAnalysisItem.cs | 22 + .../Models/InvestigationAnalysis.cs | 54 + .../Models/InvestigationGroup.cs | 38 + .../Models/InvestigationResult.cs | 19 + .../Models/MultiSourceRequest.cs | 21 + .../Models/MultiSourceResponse.cs | 17 + .../Models/MultiSourceResponseSource.cs | 17 + .../CSharp/generated-code/Models/QueueInfo.cs | 3 + .../Models/SingleSourceRequest.cs | 21 + .../Models/UnknownWorkItemEvent.cs | 22 + .../Models/ViewConfiguration.cs | 25 - .../ViewConfigurationExternalTelemetry.cs | 19 - .../Models/ViewConfigurationFlavor.cs | 22 - .../Models/ViewConfigurationProduct.cs | 22 - .../Models/ViewConfigurationRepositories.cs | 22 - .../Models/ViewConfigurationSource.cs | 43 - .../Models/ViewConfigurationType.cs | 28 - .../Models/WorkItemAggregateSummary.cs | 70 + .../generated-code/Models/WorkItemDetails.cs | 15 + .../Models/WorkItemStatusCounts.cs | 38 + .../CSharp/generated-code/Repository.cs | 109 -- .../Client/CSharp/generated-code/ScaleSets.cs | 194 +++ 37 files changed, 2538 insertions(+), 312 deletions(-) create mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Aggregate.cs create mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Analysis.cs create mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/AggregateAnalysisDetail.cs create mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/AggregateAnalysisSummary.cs create mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/AggregateAnalysisSummaryKeyedData.cs create mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/AggregateWorkItemSummary.cs create mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/AggregatedVMScalingHistory.cs create mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/AggregatedWorkItemCounts.cs create mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/AnalysisCount.cs create mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/BuildAggregation.cs create mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/BuildAggregationSource.cs create mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/BuildHistoryItem.cs create mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/DetailedVMScalingHistory.cs delete mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/Displayable.cs create mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/HistoricalAnalysisItem.cs create mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/InvestigationAnalysis.cs create mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/InvestigationGroup.cs create mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/InvestigationResult.cs create mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/MultiSourceRequest.cs create mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/MultiSourceResponse.cs create mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/MultiSourceResponseSource.cs create mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/SingleSourceRequest.cs create mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/UnknownWorkItemEvent.cs delete mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ViewConfiguration.cs delete mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ViewConfigurationExternalTelemetry.cs delete mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ViewConfigurationFlavor.cs delete mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ViewConfigurationProduct.cs delete mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ViewConfigurationRepositories.cs delete mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ViewConfigurationSource.cs delete mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ViewConfigurationType.cs create mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/WorkItemAggregateSummary.cs create mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/WorkItemStatusCounts.cs delete mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Repository.cs create mode 100644 src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/ScaleSets.cs diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Aggregate.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Aggregate.cs new file mode 100644 index 00000000000..7b78fa25798 --- /dev/null +++ b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Aggregate.cs @@ -0,0 +1,1306 @@ +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.IO; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; + + + +namespace Microsoft.DotNet.Helix.Client +{ + public partial interface IAggregate + { + Task AnalysisSummaryAsync( + IImmutableList groupBy, + IImmutableList otherProperties, + string workitem, + string build = default, + string creator = default, + string name = default, + string source = default, + string type = default, + CancellationToken cancellationToken = default + ); + + Task> BuildHistoryAsync( + IImmutableList source, + IImmutableList type, + CancellationToken cancellationToken = default + ); + + Task BuildAsync( + string buildNumber, + IImmutableList sources, + IImmutableList types, + CancellationToken cancellationToken = default + ); + + Task> JobSummaryAsync( + IImmutableList groupBy, + int maxResultSets, + string build = default, + string creator = default, + string name = default, + string source = default, + string type = default, + CancellationToken cancellationToken = default + ); + + Task> WorkItemSummaryAsync( + IImmutableList groupBy, + string build = default, + string creator = default, + string name = default, + string source = default, + string type = default, + CancellationToken cancellationToken = default + ); + + Task> AnalysisDetailAsync( + string analysisName, + string analysisType, + string build, + IImmutableList groupBy, + string source, + string type, + string workitem, + CancellationToken cancellationToken = default + ); + + Task> PropertiesAsync( + string build = default, + string creator = default, + string name = default, + string source = default, + string type = default, + CancellationToken cancellationToken = default + ); + + Task Investigation_ContinueAsync( + string id, + CancellationToken cancellationToken = default + ); + + Task InvestigationAsync( + IImmutableList groupBy, + int maxGroups, + int maxResults, + string build = default, + string creator = default, + string name = default, + string source = default, + string type = default, + CancellationToken cancellationToken = default + ); + + Task> HistoryAsync( + string analysisName, + string analysisType, + int days, + string source, + string type, + string workitem, + CancellationToken cancellationToken = default + ); + + Task MultiSourceAsync( + Models.MultiSourceRequest body, + CancellationToken cancellationToken = default + ); + + } + + internal partial class Aggregate : IServiceOperations, IAggregate + { + public Aggregate(HelixApi client) + { + Client = client ?? throw new ArgumentNullException(nameof(client)); + } + + public HelixApi Client { get; } + + partial void HandleFailedRequest(RestApiException ex); + + partial void HandleFailedAnalysisSummaryRequest(RestApiException ex); + + public async Task AnalysisSummaryAsync( + IImmutableList groupBy, + IImmutableList otherProperties, + string workitem, + string build = default, + string creator = default, + string name = default, + string source = default, + string type = default, + CancellationToken cancellationToken = default + ) + { + + if (groupBy == default(IImmutableList)) + { + throw new ArgumentNullException(nameof(groupBy)); + } + + if (otherProperties == default(IImmutableList)) + { + throw new ArgumentNullException(nameof(otherProperties)); + } + + if (string.IsNullOrEmpty(workitem)) + { + throw new ArgumentNullException(nameof(workitem)); + } + + const string apiVersion = "2019-06-17"; + + var _baseUri = Client.Options.BaseUri; + var _url = new RequestUriBuilder(); + _url.Reset(_baseUri); + _url.AppendPath( + "/api/aggregate/analysis", + false); + + if (!string.IsNullOrEmpty(creator)) + { + _url.AppendQuery("Creator", Client.Serialize(creator)); + } + if (!string.IsNullOrEmpty(source)) + { + _url.AppendQuery("Source", Client.Serialize(source)); + } + if (!string.IsNullOrEmpty(type)) + { + _url.AppendQuery("Type", Client.Serialize(type)); + } + if (!string.IsNullOrEmpty(build)) + { + _url.AppendQuery("Build", Client.Serialize(build)); + } + if (!string.IsNullOrEmpty(name)) + { + _url.AppendQuery("Name", Client.Serialize(name)); + } + if (!string.IsNullOrEmpty(workitem)) + { + _url.AppendQuery("workitem", Client.Serialize(workitem)); + } + if (groupBy != default(IImmutableList)) + { + foreach (var _item in groupBy) + { + _url.AppendQuery("groupBy", Client.Serialize(_item)); + } + } + if (otherProperties != default(IImmutableList)) + { + foreach (var _item in otherProperties) + { + _url.AppendQuery("otherProperties", Client.Serialize(_item)); + } + } + _url.AppendQuery("api-version", Client.Serialize(apiVersion)); + + + using (var _req = Client.Pipeline.CreateRequest()) + { + _req.Uri = _url; + _req.Method = RequestMethod.Get; + + using (var _res = await Client.SendAsync(_req, cancellationToken).ConfigureAwait(false)) + { + if (_res.Status < 200 || _res.Status >= 300) + { + await OnAnalysisSummaryFailed(_req, _res).ConfigureAwait(false); + } + + if (_res.ContentStream == null) + { + await OnAnalysisSummaryFailed(_req, _res).ConfigureAwait(false); + } + + using (var _reader = new StreamReader(_res.ContentStream)) + { + var _content = await _reader.ReadToEndAsync().ConfigureAwait(false); + var _body = Client.Deserialize(_content); + return _body; + } + } + } + } + + internal async Task OnAnalysisSummaryFailed(Request req, Response res) + { + string content = null; + if (res.ContentStream != null) + { + using (var reader = new StreamReader(res.ContentStream)) + { + content = await reader.ReadToEndAsync().ConfigureAwait(false); + } + } + + var ex = new RestApiException( + req, + res, + content, + Client.Deserialize(content) + ); + HandleFailedAnalysisSummaryRequest(ex); + HandleFailedRequest(ex); + Client.OnFailedRequest(ex); + throw ex; + } + + partial void HandleFailedBuildHistoryRequest(RestApiException ex); + + public async Task> BuildHistoryAsync( + IImmutableList source, + IImmutableList type, + CancellationToken cancellationToken = default + ) + { + + if (source == default(IImmutableList)) + { + throw new ArgumentNullException(nameof(source)); + } + + if (type == default(IImmutableList)) + { + throw new ArgumentNullException(nameof(type)); + } + + const string apiVersion = "2019-06-17"; + + var _baseUri = Client.Options.BaseUri; + var _url = new RequestUriBuilder(); + _url.Reset(_baseUri); + _url.AppendPath( + "/api/aggregate/build/history", + false); + + if (source != default(IImmutableList)) + { + foreach (var _item in source) + { + _url.AppendQuery("source", Client.Serialize(_item)); + } + } + if (type != default(IImmutableList)) + { + foreach (var _item in type) + { + _url.AppendQuery("type", Client.Serialize(_item)); + } + } + _url.AppendQuery("api-version", Client.Serialize(apiVersion)); + + + using (var _req = Client.Pipeline.CreateRequest()) + { + _req.Uri = _url; + _req.Method = RequestMethod.Get; + + using (var _res = await Client.SendAsync(_req, cancellationToken).ConfigureAwait(false)) + { + if (_res.Status < 200 || _res.Status >= 300) + { + await OnBuildHistoryFailed(_req, _res).ConfigureAwait(false); + } + + if (_res.ContentStream == null) + { + await OnBuildHistoryFailed(_req, _res).ConfigureAwait(false); + } + + using (var _reader = new StreamReader(_res.ContentStream)) + { + var _content = await _reader.ReadToEndAsync().ConfigureAwait(false); + var _body = Client.Deserialize>(_content); + return _body; + } + } + } + } + + internal async Task OnBuildHistoryFailed(Request req, Response res) + { + string content = null; + if (res.ContentStream != null) + { + using (var reader = new StreamReader(res.ContentStream)) + { + content = await reader.ReadToEndAsync().ConfigureAwait(false); + } + } + + var ex = new RestApiException( + req, + res, + content, + Client.Deserialize(content) + ); + HandleFailedBuildHistoryRequest(ex); + HandleFailedRequest(ex); + Client.OnFailedRequest(ex); + throw ex; + } + + partial void HandleFailedBuildRequest(RestApiException ex); + + public async Task BuildAsync( + string buildNumber, + IImmutableList sources, + IImmutableList types, + CancellationToken cancellationToken = default + ) + { + + if (string.IsNullOrEmpty(buildNumber)) + { + throw new ArgumentNullException(nameof(buildNumber)); + } + + if (sources == default(IImmutableList)) + { + throw new ArgumentNullException(nameof(sources)); + } + + if (types == default(IImmutableList)) + { + throw new ArgumentNullException(nameof(types)); + } + + const string apiVersion = "2019-06-17"; + + var _baseUri = Client.Options.BaseUri; + var _url = new RequestUriBuilder(); + _url.Reset(_baseUri); + _url.AppendPath( + "/api/aggregate/build", + false); + + if (sources != default(IImmutableList)) + { + foreach (var _item in sources) + { + _url.AppendQuery("sources", Client.Serialize(_item)); + } + } + if (types != default(IImmutableList)) + { + foreach (var _item in types) + { + _url.AppendQuery("types", Client.Serialize(_item)); + } + } + if (!string.IsNullOrEmpty(buildNumber)) + { + _url.AppendQuery("buildNumber", Client.Serialize(buildNumber)); + } + _url.AppendQuery("api-version", Client.Serialize(apiVersion)); + + + using (var _req = Client.Pipeline.CreateRequest()) + { + _req.Uri = _url; + _req.Method = RequestMethod.Get; + + using (var _res = await Client.SendAsync(_req, cancellationToken).ConfigureAwait(false)) + { + if (_res.Status < 200 || _res.Status >= 300) + { + await OnBuildFailed(_req, _res).ConfigureAwait(false); + } + + if (_res.ContentStream == null) + { + await OnBuildFailed(_req, _res).ConfigureAwait(false); + } + + using (var _reader = new StreamReader(_res.ContentStream)) + { + var _content = await _reader.ReadToEndAsync().ConfigureAwait(false); + var _body = Client.Deserialize(_content); + return _body; + } + } + } + } + + internal async Task OnBuildFailed(Request req, Response res) + { + string content = null; + if (res.ContentStream != null) + { + using (var reader = new StreamReader(res.ContentStream)) + { + content = await reader.ReadToEndAsync().ConfigureAwait(false); + } + } + + var ex = new RestApiException( + req, + res, + content, + Client.Deserialize(content) + ); + HandleFailedBuildRequest(ex); + HandleFailedRequest(ex); + Client.OnFailedRequest(ex); + throw ex; + } + + partial void HandleFailedJobSummaryRequest(RestApiException ex); + + public async Task> JobSummaryAsync( + IImmutableList groupBy, + int maxResultSets, + string build = default, + string creator = default, + string name = default, + string source = default, + string type = default, + CancellationToken cancellationToken = default + ) + { + + if (groupBy == default(IImmutableList)) + { + throw new ArgumentNullException(nameof(groupBy)); + } + + const string apiVersion = "2019-06-17"; + + var _baseUri = Client.Options.BaseUri; + var _url = new RequestUriBuilder(); + _url.Reset(_baseUri); + _url.AppendPath( + "/api/aggregate/jobs", + false); + + if (!string.IsNullOrEmpty(creator)) + { + _url.AppendQuery("Creator", Client.Serialize(creator)); + } + if (!string.IsNullOrEmpty(source)) + { + _url.AppendQuery("Source", Client.Serialize(source)); + } + if (!string.IsNullOrEmpty(type)) + { + _url.AppendQuery("Type", Client.Serialize(type)); + } + if (!string.IsNullOrEmpty(build)) + { + _url.AppendQuery("Build", Client.Serialize(build)); + } + if (!string.IsNullOrEmpty(name)) + { + _url.AppendQuery("Name", Client.Serialize(name)); + } + if (groupBy != default(IImmutableList)) + { + foreach (var _item in groupBy) + { + _url.AppendQuery("groupBy", Client.Serialize(_item)); + } + } + if (maxResultSets != default(int)) + { + _url.AppendQuery("maxResultSets", Client.Serialize(maxResultSets)); + } + _url.AppendQuery("api-version", Client.Serialize(apiVersion)); + + + using (var _req = Client.Pipeline.CreateRequest()) + { + _req.Uri = _url; + _req.Method = RequestMethod.Get; + + using (var _res = await Client.SendAsync(_req, cancellationToken).ConfigureAwait(false)) + { + if (_res.Status < 200 || _res.Status >= 300) + { + await OnJobSummaryFailed(_req, _res).ConfigureAwait(false); + } + + if (_res.ContentStream == null) + { + await OnJobSummaryFailed(_req, _res).ConfigureAwait(false); + } + + using (var _reader = new StreamReader(_res.ContentStream)) + { + var _content = await _reader.ReadToEndAsync().ConfigureAwait(false); + var _body = Client.Deserialize>(_content); + return _body; + } + } + } + } + + internal async Task OnJobSummaryFailed(Request req, Response res) + { + string content = null; + if (res.ContentStream != null) + { + using (var reader = new StreamReader(res.ContentStream)) + { + content = await reader.ReadToEndAsync().ConfigureAwait(false); + } + } + + var ex = new RestApiException( + req, + res, + content, + Client.Deserialize(content) + ); + HandleFailedJobSummaryRequest(ex); + HandleFailedRequest(ex); + Client.OnFailedRequest(ex); + throw ex; + } + + partial void HandleFailedWorkItemSummaryRequest(RestApiException ex); + + public async Task> WorkItemSummaryAsync( + IImmutableList groupBy, + string build = default, + string creator = default, + string name = default, + string source = default, + string type = default, + CancellationToken cancellationToken = default + ) + { + + if (groupBy == default(IImmutableList)) + { + throw new ArgumentNullException(nameof(groupBy)); + } + + const string apiVersion = "2019-06-17"; + + var _baseUri = Client.Options.BaseUri; + var _url = new RequestUriBuilder(); + _url.Reset(_baseUri); + _url.AppendPath( + "/api/aggregate/workitems", + false); + + if (!string.IsNullOrEmpty(creator)) + { + _url.AppendQuery("Creator", Client.Serialize(creator)); + } + if (!string.IsNullOrEmpty(source)) + { + _url.AppendQuery("Source", Client.Serialize(source)); + } + if (!string.IsNullOrEmpty(type)) + { + _url.AppendQuery("Type", Client.Serialize(type)); + } + if (!string.IsNullOrEmpty(build)) + { + _url.AppendQuery("Build", Client.Serialize(build)); + } + if (!string.IsNullOrEmpty(name)) + { + _url.AppendQuery("Name", Client.Serialize(name)); + } + if (groupBy != default(IImmutableList)) + { + foreach (var _item in groupBy) + { + _url.AppendQuery("groupBy", Client.Serialize(_item)); + } + } + _url.AppendQuery("api-version", Client.Serialize(apiVersion)); + + + using (var _req = Client.Pipeline.CreateRequest()) + { + _req.Uri = _url; + _req.Method = RequestMethod.Get; + + using (var _res = await Client.SendAsync(_req, cancellationToken).ConfigureAwait(false)) + { + if (_res.Status < 200 || _res.Status >= 300) + { + await OnWorkItemSummaryFailed(_req, _res).ConfigureAwait(false); + } + + if (_res.ContentStream == null) + { + await OnWorkItemSummaryFailed(_req, _res).ConfigureAwait(false); + } + + using (var _reader = new StreamReader(_res.ContentStream)) + { + var _content = await _reader.ReadToEndAsync().ConfigureAwait(false); + var _body = Client.Deserialize>(_content); + return _body; + } + } + } + } + + internal async Task OnWorkItemSummaryFailed(Request req, Response res) + { + string content = null; + if (res.ContentStream != null) + { + using (var reader = new StreamReader(res.ContentStream)) + { + content = await reader.ReadToEndAsync().ConfigureAwait(false); + } + } + + var ex = new RestApiException( + req, + res, + content, + Client.Deserialize(content) + ); + HandleFailedWorkItemSummaryRequest(ex); + HandleFailedRequest(ex); + Client.OnFailedRequest(ex); + throw ex; + } + + partial void HandleFailedAnalysisDetailRequest(RestApiException ex); + + public async Task> AnalysisDetailAsync( + string analysisName, + string analysisType, + string build, + IImmutableList groupBy, + string source, + string type, + string workitem, + CancellationToken cancellationToken = default + ) + { + + if (string.IsNullOrEmpty(analysisName)) + { + throw new ArgumentNullException(nameof(analysisName)); + } + + if (string.IsNullOrEmpty(analysisType)) + { + throw new ArgumentNullException(nameof(analysisType)); + } + + if (string.IsNullOrEmpty(build)) + { + throw new ArgumentNullException(nameof(build)); + } + + if (groupBy == default(IImmutableList)) + { + throw new ArgumentNullException(nameof(groupBy)); + } + + if (string.IsNullOrEmpty(source)) + { + throw new ArgumentNullException(nameof(source)); + } + + if (string.IsNullOrEmpty(type)) + { + throw new ArgumentNullException(nameof(type)); + } + + if (string.IsNullOrEmpty(workitem)) + { + throw new ArgumentNullException(nameof(workitem)); + } + + const string apiVersion = "2019-06-17"; + + var _baseUri = Client.Options.BaseUri; + var _url = new RequestUriBuilder(); + _url.Reset(_baseUri); + _url.AppendPath( + "/api/aggregate/analysisdetail", + false); + + if (!string.IsNullOrEmpty(source)) + { + _url.AppendQuery("source", Client.Serialize(source)); + } + if (!string.IsNullOrEmpty(type)) + { + _url.AppendQuery("type", Client.Serialize(type)); + } + if (!string.IsNullOrEmpty(build)) + { + _url.AppendQuery("build", Client.Serialize(build)); + } + if (!string.IsNullOrEmpty(workitem)) + { + _url.AppendQuery("workitem", Client.Serialize(workitem)); + } + if (!string.IsNullOrEmpty(analysisType)) + { + _url.AppendQuery("analysisType", Client.Serialize(analysisType)); + } + if (!string.IsNullOrEmpty(analysisName)) + { + _url.AppendQuery("analysisName", Client.Serialize(analysisName)); + } + if (groupBy != default(IImmutableList)) + { + foreach (var _item in groupBy) + { + _url.AppendQuery("groupBy", Client.Serialize(_item)); + } + } + _url.AppendQuery("api-version", Client.Serialize(apiVersion)); + + + using (var _req = Client.Pipeline.CreateRequest()) + { + _req.Uri = _url; + _req.Method = RequestMethod.Get; + + using (var _res = await Client.SendAsync(_req, cancellationToken).ConfigureAwait(false)) + { + if (_res.Status < 200 || _res.Status >= 300) + { + await OnAnalysisDetailFailed(_req, _res).ConfigureAwait(false); + } + + if (_res.ContentStream == null) + { + await OnAnalysisDetailFailed(_req, _res).ConfigureAwait(false); + } + + using (var _reader = new StreamReader(_res.ContentStream)) + { + var _content = await _reader.ReadToEndAsync().ConfigureAwait(false); + var _body = Client.Deserialize>(_content); + return _body; + } + } + } + } + + internal async Task OnAnalysisDetailFailed(Request req, Response res) + { + string content = null; + if (res.ContentStream != null) + { + using (var reader = new StreamReader(res.ContentStream)) + { + content = await reader.ReadToEndAsync().ConfigureAwait(false); + } + } + + var ex = new RestApiException( + req, + res, + content, + Client.Deserialize(content) + ); + HandleFailedAnalysisDetailRequest(ex); + HandleFailedRequest(ex); + Client.OnFailedRequest(ex); + throw ex; + } + + partial void HandleFailedPropertiesRequest(RestApiException ex); + + public async Task> PropertiesAsync( + string build = default, + string creator = default, + string name = default, + string source = default, + string type = default, + CancellationToken cancellationToken = default + ) + { + + const string apiVersion = "2019-06-17"; + + var _baseUri = Client.Options.BaseUri; + var _url = new RequestUriBuilder(); + _url.Reset(_baseUri); + _url.AppendPath( + "/api/aggregate/properties", + false); + + if (!string.IsNullOrEmpty(creator)) + { + _url.AppendQuery("Creator", Client.Serialize(creator)); + } + if (!string.IsNullOrEmpty(source)) + { + _url.AppendQuery("Source", Client.Serialize(source)); + } + if (!string.IsNullOrEmpty(type)) + { + _url.AppendQuery("Type", Client.Serialize(type)); + } + if (!string.IsNullOrEmpty(build)) + { + _url.AppendQuery("Build", Client.Serialize(build)); + } + if (!string.IsNullOrEmpty(name)) + { + _url.AppendQuery("Name", Client.Serialize(name)); + } + _url.AppendQuery("api-version", Client.Serialize(apiVersion)); + + + using (var _req = Client.Pipeline.CreateRequest()) + { + _req.Uri = _url; + _req.Method = RequestMethod.Get; + + using (var _res = await Client.SendAsync(_req, cancellationToken).ConfigureAwait(false)) + { + if (_res.Status < 200 || _res.Status >= 300) + { + await OnPropertiesFailed(_req, _res).ConfigureAwait(false); + } + + if (_res.ContentStream == null) + { + await OnPropertiesFailed(_req, _res).ConfigureAwait(false); + } + + using (var _reader = new StreamReader(_res.ContentStream)) + { + var _content = await _reader.ReadToEndAsync().ConfigureAwait(false); + var _body = Client.Deserialize>(_content); + return _body; + } + } + } + } + + internal async Task OnPropertiesFailed(Request req, Response res) + { + string content = null; + if (res.ContentStream != null) + { + using (var reader = new StreamReader(res.ContentStream)) + { + content = await reader.ReadToEndAsync().ConfigureAwait(false); + } + } + + var ex = new RestApiException( + req, + res, + content, + Client.Deserialize(content) + ); + HandleFailedPropertiesRequest(ex); + HandleFailedRequest(ex); + Client.OnFailedRequest(ex); + throw ex; + } + + partial void HandleFailedInvestigation_ContinueRequest(RestApiException ex); + + public async Task Investigation_ContinueAsync( + string id, + CancellationToken cancellationToken = default + ) + { + + if (string.IsNullOrEmpty(id)) + { + throw new ArgumentNullException(nameof(id)); + } + + const string apiVersion = "2019-06-17"; + + var _baseUri = Client.Options.BaseUri; + var _url = new RequestUriBuilder(); + _url.Reset(_baseUri); + _url.AppendPath( + "/api/aggregate/investigation/continue/{id}".Replace("{id}", Uri.EscapeDataString(Client.Serialize(id))), + false); + + _url.AppendQuery("api-version", Client.Serialize(apiVersion)); + + + using (var _req = Client.Pipeline.CreateRequest()) + { + _req.Uri = _url; + _req.Method = RequestMethod.Get; + + using (var _res = await Client.SendAsync(_req, cancellationToken).ConfigureAwait(false)) + { + if (_res.Status < 200 || _res.Status >= 300) + { + await OnInvestigation_ContinueFailed(_req, _res).ConfigureAwait(false); + } + + if (_res.ContentStream == null) + { + await OnInvestigation_ContinueFailed(_req, _res).ConfigureAwait(false); + } + + using (var _reader = new StreamReader(_res.ContentStream)) + { + var _content = await _reader.ReadToEndAsync().ConfigureAwait(false); + var _body = Client.Deserialize(_content); + return _body; + } + } + } + } + + internal async Task OnInvestigation_ContinueFailed(Request req, Response res) + { + string content = null; + if (res.ContentStream != null) + { + using (var reader = new StreamReader(res.ContentStream)) + { + content = await reader.ReadToEndAsync().ConfigureAwait(false); + } + } + + var ex = new RestApiException( + req, + res, + content, + Client.Deserialize(content) + ); + HandleFailedInvestigation_ContinueRequest(ex); + HandleFailedRequest(ex); + Client.OnFailedRequest(ex); + throw ex; + } + + partial void HandleFailedInvestigationRequest(RestApiException ex); + + public async Task InvestigationAsync( + IImmutableList groupBy, + int maxGroups, + int maxResults, + string build = default, + string creator = default, + string name = default, + string source = default, + string type = default, + CancellationToken cancellationToken = default + ) + { + + if (groupBy == default(IImmutableList)) + { + throw new ArgumentNullException(nameof(groupBy)); + } + + const string apiVersion = "2019-06-17"; + + var _baseUri = Client.Options.BaseUri; + var _url = new RequestUriBuilder(); + _url.Reset(_baseUri); + _url.AppendPath( + "/api/aggregate/investigation", + false); + + if (!string.IsNullOrEmpty(creator)) + { + _url.AppendQuery("Creator", Client.Serialize(creator)); + } + if (!string.IsNullOrEmpty(source)) + { + _url.AppendQuery("Source", Client.Serialize(source)); + } + if (!string.IsNullOrEmpty(type)) + { + _url.AppendQuery("Type", Client.Serialize(type)); + } + if (!string.IsNullOrEmpty(build)) + { + _url.AppendQuery("Build", Client.Serialize(build)); + } + if (!string.IsNullOrEmpty(name)) + { + _url.AppendQuery("Name", Client.Serialize(name)); + } + if (groupBy != default(IImmutableList)) + { + foreach (var _item in groupBy) + { + _url.AppendQuery("groupBy", Client.Serialize(_item)); + } + } + if (maxGroups != default(int)) + { + _url.AppendQuery("maxGroups", Client.Serialize(maxGroups)); + } + if (maxResults != default(int)) + { + _url.AppendQuery("maxResults", Client.Serialize(maxResults)); + } + _url.AppendQuery("api-version", Client.Serialize(apiVersion)); + + + using (var _req = Client.Pipeline.CreateRequest()) + { + _req.Uri = _url; + _req.Method = RequestMethod.Get; + + using (var _res = await Client.SendAsync(_req, cancellationToken).ConfigureAwait(false)) + { + if (_res.Status < 200 || _res.Status >= 300) + { + await OnInvestigationFailed(_req, _res).ConfigureAwait(false); + } + + if (_res.ContentStream == null) + { + await OnInvestigationFailed(_req, _res).ConfigureAwait(false); + } + + using (var _reader = new StreamReader(_res.ContentStream)) + { + var _content = await _reader.ReadToEndAsync().ConfigureAwait(false); + var _body = Client.Deserialize(_content); + return _body; + } + } + } + } + + internal async Task OnInvestigationFailed(Request req, Response res) + { + string content = null; + if (res.ContentStream != null) + { + using (var reader = new StreamReader(res.ContentStream)) + { + content = await reader.ReadToEndAsync().ConfigureAwait(false); + } + } + + var ex = new RestApiException( + req, + res, + content, + Client.Deserialize(content) + ); + HandleFailedInvestigationRequest(ex); + HandleFailedRequest(ex); + Client.OnFailedRequest(ex); + throw ex; + } + + partial void HandleFailedHistoryRequest(RestApiException ex); + + public async Task> HistoryAsync( + string analysisName, + string analysisType, + int days, + string source, + string type, + string workitem, + CancellationToken cancellationToken = default + ) + { + + if (string.IsNullOrEmpty(analysisName)) + { + throw new ArgumentNullException(nameof(analysisName)); + } + + if (string.IsNullOrEmpty(analysisType)) + { + throw new ArgumentNullException(nameof(analysisType)); + } + + if (string.IsNullOrEmpty(source)) + { + throw new ArgumentNullException(nameof(source)); + } + + if (string.IsNullOrEmpty(type)) + { + throw new ArgumentNullException(nameof(type)); + } + + if (string.IsNullOrEmpty(workitem)) + { + throw new ArgumentNullException(nameof(workitem)); + } + + const string apiVersion = "2019-06-17"; + + var _baseUri = Client.Options.BaseUri; + var _url = new RequestUriBuilder(); + _url.Reset(_baseUri); + _url.AppendPath( + "/api/aggregate/history/{analysisType}".Replace("{analysisType}", Uri.EscapeDataString(Client.Serialize(analysisType))), + false); + + if (!string.IsNullOrEmpty(source)) + { + _url.AppendQuery("source", Client.Serialize(source)); + } + if (!string.IsNullOrEmpty(type)) + { + _url.AppendQuery("type", Client.Serialize(type)); + } + if (!string.IsNullOrEmpty(workitem)) + { + _url.AppendQuery("workitem", Client.Serialize(workitem)); + } + if (!string.IsNullOrEmpty(analysisName)) + { + _url.AppendQuery("analysisName", Client.Serialize(analysisName)); + } + if (days != default(int)) + { + _url.AppendQuery("days", Client.Serialize(days)); + } + _url.AppendQuery("api-version", Client.Serialize(apiVersion)); + + + using (var _req = Client.Pipeline.CreateRequest()) + { + _req.Uri = _url; + _req.Method = RequestMethod.Get; + + using (var _res = await Client.SendAsync(_req, cancellationToken).ConfigureAwait(false)) + { + if (_res.Status < 200 || _res.Status >= 300) + { + await OnHistoryFailed(_req, _res).ConfigureAwait(false); + } + + if (_res.ContentStream == null) + { + await OnHistoryFailed(_req, _res).ConfigureAwait(false); + } + + using (var _reader = new StreamReader(_res.ContentStream)) + { + var _content = await _reader.ReadToEndAsync().ConfigureAwait(false); + var _body = Client.Deserialize>(_content); + return _body; + } + } + } + } + + internal async Task OnHistoryFailed(Request req, Response res) + { + string content = null; + if (res.ContentStream != null) + { + using (var reader = new StreamReader(res.ContentStream)) + { + content = await reader.ReadToEndAsync().ConfigureAwait(false); + } + } + + var ex = new RestApiException( + req, + res, + content, + Client.Deserialize(content) + ); + HandleFailedHistoryRequest(ex); + HandleFailedRequest(ex); + Client.OnFailedRequest(ex); + throw ex; + } + + partial void HandleFailedMultiSourceRequest(RestApiException ex); + + public async Task MultiSourceAsync( + Models.MultiSourceRequest body, + CancellationToken cancellationToken = default + ) + { + + if (body == default(Models.MultiSourceRequest)) + { + throw new ArgumentNullException(nameof(body)); + } + + const string apiVersion = "2019-06-17"; + + var _baseUri = Client.Options.BaseUri; + var _url = new RequestUriBuilder(); + _url.Reset(_baseUri); + _url.AppendPath( + "/api/aggregate/multi-source", + false); + + _url.AppendQuery("api-version", Client.Serialize(apiVersion)); + + + using (var _req = Client.Pipeline.CreateRequest()) + { + _req.Uri = _url; + _req.Method = RequestMethod.Post; + + if (body != default(Models.MultiSourceRequest)) + { + _req.Content = RequestContent.Create(Encoding.UTF8.GetBytes(Client.Serialize(body))); + _req.Headers.Add("Content-Type", "application/json; charset=utf-8"); + } + + using (var _res = await Client.SendAsync(_req, cancellationToken).ConfigureAwait(false)) + { + if (_res.Status < 200 || _res.Status >= 300) + { + await OnMultiSourceFailed(_req, _res).ConfigureAwait(false); + } + + if (_res.ContentStream == null) + { + await OnMultiSourceFailed(_req, _res).ConfigureAwait(false); + } + + using (var _reader = new StreamReader(_res.ContentStream)) + { + var _content = await _reader.ReadToEndAsync().ConfigureAwait(false); + var _body = Client.Deserialize(_content); + return _body; + } + } + } + } + + internal async Task OnMultiSourceFailed(Request req, Response res) + { + string content = null; + if (res.ContentStream != null) + { + using (var reader = new StreamReader(res.ContentStream)) + { + content = await reader.ReadToEndAsync().ConfigureAwait(false); + } + } + + var ex = new RestApiException( + req, + res, + content, + Client.Deserialize(content) + ); + HandleFailedMultiSourceRequest(ex); + HandleFailedRequest(ex); + Client.OnFailedRequest(ex); + throw ex; + } + } +} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Analysis.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Analysis.cs new file mode 100644 index 00000000000..7f1329d740e --- /dev/null +++ b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Analysis.cs @@ -0,0 +1,252 @@ +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.IO; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; + + + +namespace Microsoft.DotNet.Helix.Client +{ + public partial interface IAnalysis + { + Task SetReasonAsync( + string analysisName, + string analysisType, + Models.FailureReason body, + string job, + string workitem, + CancellationToken cancellationToken = default + ); + + Task GetDetailsAsync( + string analysisName, + string analysisType, + string job, + string workitem, + CancellationToken cancellationToken = default + ); + + } + + internal partial class Analysis : IServiceOperations, IAnalysis + { + public Analysis(HelixApi client) + { + Client = client ?? throw new ArgumentNullException(nameof(client)); + } + + public HelixApi Client { get; } + + partial void HandleFailedRequest(RestApiException ex); + + partial void HandleFailedSetReasonRequest(RestApiException ex); + + public async Task SetReasonAsync( + string analysisName, + string analysisType, + Models.FailureReason body, + string job, + string workitem, + CancellationToken cancellationToken = default + ) + { + + if (string.IsNullOrEmpty(analysisName)) + { + throw new ArgumentNullException(nameof(analysisName)); + } + + if (string.IsNullOrEmpty(analysisType)) + { + throw new ArgumentNullException(nameof(analysisType)); + } + + if (body == default(Models.FailureReason)) + { + throw new ArgumentNullException(nameof(body)); + } + + if (string.IsNullOrEmpty(job)) + { + throw new ArgumentNullException(nameof(job)); + } + + if (string.IsNullOrEmpty(workitem)) + { + throw new ArgumentNullException(nameof(workitem)); + } + + const string apiVersion = "2019-06-17"; + + var _baseUri = Client.Options.BaseUri; + var _url = new RequestUriBuilder(); + _url.Reset(_baseUri); + _url.AppendPath( + "/api/analysis/{job}/{analysisType}/reason".Replace("{job}", Uri.EscapeDataString(Client.Serialize(job))).Replace("{analysisType}", Uri.EscapeDataString(Client.Serialize(analysisType))), + false); + + if (!string.IsNullOrEmpty(workitem)) + { + _url.AppendQuery("workitem", Client.Serialize(workitem)); + } + if (!string.IsNullOrEmpty(analysisName)) + { + _url.AppendQuery("analysisName", Client.Serialize(analysisName)); + } + _url.AppendQuery("api-version", Client.Serialize(apiVersion)); + + + using (var _req = Client.Pipeline.CreateRequest()) + { + _req.Uri = _url; + _req.Method = RequestMethod.Put; + + if (body != default(Models.FailureReason)) + { + _req.Content = RequestContent.Create(Encoding.UTF8.GetBytes(Client.Serialize(body))); + _req.Headers.Add("Content-Type", "application/json; charset=utf-8"); + } + + using (var _res = await Client.SendAsync(_req, cancellationToken).ConfigureAwait(false)) + { + if (_res.Status < 200 || _res.Status >= 300) + { + await OnSetReasonFailed(_req, _res).ConfigureAwait(false); + } + + + return; + } + } + } + + internal async Task OnSetReasonFailed(Request req, Response res) + { + string content = null; + if (res.ContentStream != null) + { + using (var reader = new StreamReader(res.ContentStream)) + { + content = await reader.ReadToEndAsync().ConfigureAwait(false); + } + } + + var ex = new RestApiException( + req, + res, + content, + Client.Deserialize(content) + ); + HandleFailedSetReasonRequest(ex); + HandleFailedRequest(ex); + Client.OnFailedRequest(ex); + throw ex; + } + + partial void HandleFailedGetDetailsRequest(RestApiException ex); + + public async Task GetDetailsAsync( + string analysisName, + string analysisType, + string job, + string workitem, + CancellationToken cancellationToken = default + ) + { + + if (string.IsNullOrEmpty(analysisName)) + { + throw new ArgumentNullException(nameof(analysisName)); + } + + if (string.IsNullOrEmpty(analysisType)) + { + throw new ArgumentNullException(nameof(analysisType)); + } + + if (string.IsNullOrEmpty(job)) + { + throw new ArgumentNullException(nameof(job)); + } + + if (string.IsNullOrEmpty(workitem)) + { + throw new ArgumentNullException(nameof(workitem)); + } + + const string apiVersion = "2019-06-17"; + + var _baseUri = Client.Options.BaseUri; + var _url = new RequestUriBuilder(); + _url.Reset(_baseUri); + _url.AppendPath( + "/api/analysis/{job}/{analysisType}".Replace("{job}", Uri.EscapeDataString(Client.Serialize(job))).Replace("{analysisType}", Uri.EscapeDataString(Client.Serialize(analysisType))), + false); + + if (!string.IsNullOrEmpty(workitem)) + { + _url.AppendQuery("workitem", Client.Serialize(workitem)); + } + if (!string.IsNullOrEmpty(analysisName)) + { + _url.AppendQuery("analysisName", Client.Serialize(analysisName)); + } + _url.AppendQuery("api-version", Client.Serialize(apiVersion)); + + + using (var _req = Client.Pipeline.CreateRequest()) + { + _req.Uri = _url; + _req.Method = RequestMethod.Get; + + using (var _res = await Client.SendAsync(_req, cancellationToken).ConfigureAwait(false)) + { + if (_res.Status < 200 || _res.Status >= 300) + { + await OnGetDetailsFailed(_req, _res).ConfigureAwait(false); + } + + if (_res.ContentStream == null) + { + await OnGetDetailsFailed(_req, _res).ConfigureAwait(false); + } + + using (var _reader = new StreamReader(_res.ContentStream)) + { + var _content = await _reader.ReadToEndAsync().ConfigureAwait(false); + var _body = Client.Deserialize(_content); + return _body; + } + } + } + } + + internal async Task OnGetDetailsFailed(Request req, Response res) + { + string content = null; + if (res.ContentStream != null) + { + using (var reader = new StreamReader(res.ContentStream)) + { + content = await reader.ReadToEndAsync().ConfigureAwait(false); + } + } + + var ex = new RestApiException( + req, + res, + content, + Client.Deserialize(content) + ); + HandleFailedGetDetailsRequest(ex); + HandleFailedRequest(ex); + Client.OnFailedRequest(ex); + throw ex; + } + } +} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/HelixApi.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/HelixApi.cs index e2017f366f3..29d69b2657d 100644 --- a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/HelixApi.cs +++ b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/HelixApi.cs @@ -23,10 +23,12 @@ public partial interface IHelixApi { HelixApiOptions Options { get; set; } + IAggregate Aggregate { get; } + IAnalysis Analysis { get; } IInformation Information { get; } IJob Job { get; } IMachine Machine { get; } - IRepository Repository { get; } + IScaleSets ScaleSets { get; } IStorage Storage { get; } ITelemetry Telemetry { get; } IWorkItem WorkItem { get; } @@ -105,13 +107,17 @@ public HttpPipeline Pipeline public JsonSerializerSettings SerializerSettings { get; } + public IAggregate Aggregate { get; } + + public IAnalysis Analysis { get; } + public IInformation Information { get; } public IJob Job { get; } public IMachine Machine { get; } - public IRepository Repository { get; } + public IScaleSets ScaleSets { get; } public IStorage Storage { get; } @@ -128,10 +134,12 @@ public HelixApi() public HelixApi(HelixApiOptions options) { Options = options; + Aggregate = new Aggregate(this); + Analysis = new Analysis(this); Information = new Information(this); Job = new Job(this); Machine = new Machine(this); - Repository = new Repository(this); + ScaleSets = new ScaleSets(this); Storage = new Storage(this); Telemetry = new Telemetry(this); WorkItem = new WorkItem(this); diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/AggregateAnalysisDetail.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/AggregateAnalysisDetail.cs new file mode 100644 index 00000000000..eb63905292c --- /dev/null +++ b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/AggregateAnalysisDetail.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Immutable; +using Newtonsoft.Json; + +namespace Microsoft.DotNet.Helix.Client.Models +{ + public partial class AggregateAnalysisDetail + { + public AggregateAnalysisDetail(Newtonsoft.Json.Linq.JToken analysis, string job, string workItem, IImmutableDictionary key) + { + Analysis = analysis; + Job = job; + WorkItem = workItem; + Key = key; + } + + [JsonProperty("Analysis")] + public Newtonsoft.Json.Linq.JToken Analysis { get; set; } + + [JsonProperty("Job")] + public string Job { get; set; } + + [JsonProperty("WorkItem")] + public string WorkItem { get; set; } + + [JsonProperty("Key")] + public IImmutableDictionary Key { get; set; } + + [JsonIgnore] + public bool IsValid + { + get + { + if (Analysis == default(Newtonsoft.Json.Linq.JToken)) + { + return false; + } + if (string.IsNullOrEmpty(Job)) + { + return false; + } + if (string.IsNullOrEmpty(WorkItem)) + { + return false; + } + if (Key == default(IImmutableDictionary)) + { + return false; + } + return true; + } + } + } +} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/AggregateAnalysisSummary.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/AggregateAnalysisSummary.cs new file mode 100644 index 00000000000..ca57dfed6e6 --- /dev/null +++ b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/AggregateAnalysisSummary.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Immutable; +using Newtonsoft.Json; + +namespace Microsoft.DotNet.Helix.Client.Models +{ + public partial class AggregateAnalysisSummary + { + public AggregateAnalysisSummary(string type, string name, IImmutableDictionary status) + { + Type = type; + Name = name; + Status = status; + } + + [JsonProperty("Type")] + public string Type { get; set; } + + [JsonProperty("Name")] + public string Name { get; set; } + + [JsonProperty("Status")] + public IImmutableDictionary Status { get; set; } + + [JsonIgnore] + public bool IsValid + { + get + { + if (string.IsNullOrEmpty(Type)) + { + return false; + } + if (string.IsNullOrEmpty(Name)) + { + return false; + } + if (Status == default(IImmutableDictionary)) + { + return false; + } + return true; + } + } + } +} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/AggregateAnalysisSummaryKeyedData.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/AggregateAnalysisSummaryKeyedData.cs new file mode 100644 index 00000000000..bfbecc08424 --- /dev/null +++ b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/AggregateAnalysisSummaryKeyedData.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Immutable; +using Newtonsoft.Json; + +namespace Microsoft.DotNet.Helix.Client.Models +{ + public partial class AggregateAnalysisSummaryKeyedData + { + public AggregateAnalysisSummaryKeyedData(IImmutableDictionary key, Models.AggregateAnalysisSummary data) + { + Key = key; + Data = data; + } + + [JsonProperty("Key")] + public IImmutableDictionary Key { get; set; } + + [JsonProperty("Data")] + public Models.AggregateAnalysisSummary Data { get; set; } + + [JsonIgnore] + public bool IsValid + { + get + { + if (Key == default(IImmutableDictionary)) + { + return false; + } + if (Data == default(Models.AggregateAnalysisSummary)) + { + return false; + } + return true; + } + } + } +} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/AggregateWorkItemSummary.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/AggregateWorkItemSummary.cs new file mode 100644 index 00000000000..dc28995cf54 --- /dev/null +++ b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/AggregateWorkItemSummary.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Immutable; +using Newtonsoft.Json; + +namespace Microsoft.DotNet.Helix.Client.Models +{ + public partial class AggregateWorkItemSummary + { + public AggregateWorkItemSummary(IImmutableList workItems, IImmutableList analyses) + { + WorkItems = workItems; + Analyses = analyses; + } + + [JsonProperty("WorkItems")] + public IImmutableList WorkItems { get; set; } + + [JsonProperty("Analyses")] + public IImmutableList Analyses { get; set; } + + [JsonIgnore] + public bool IsValid + { + get + { + if (WorkItems == default(IImmutableList)) + { + return false; + } + if (Analyses == default(IImmutableList)) + { + return false; + } + return true; + } + } + } +} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/AggregatedVMScalingHistory.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/AggregatedVMScalingHistory.cs new file mode 100644 index 00000000000..b42c028d870 --- /dev/null +++ b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/AggregatedVMScalingHistory.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Immutable; +using Newtonsoft.Json; + +namespace Microsoft.DotNet.Helix.Client.Models +{ + public partial class AggregatedVMScalingHistory + { + public AggregatedVMScalingHistory(DateTimeOffset timestamp, int totalMessageCount, int totalVMCount) + { + Timestamp = timestamp; + TotalMessageCount = totalMessageCount; + TotalVMCount = totalVMCount; + } + + [JsonProperty("Timestamp")] + public DateTimeOffset Timestamp { get; set; } + + [JsonProperty("TotalMessageCount")] + public int TotalMessageCount { get; set; } + + [JsonProperty("TotalVMCount")] + public int TotalVMCount { get; set; } + } +} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/AggregatedWorkItemCounts.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/AggregatedWorkItemCounts.cs new file mode 100644 index 00000000000..e61c5783ad6 --- /dev/null +++ b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/AggregatedWorkItemCounts.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Immutable; +using Newtonsoft.Json; + +namespace Microsoft.DotNet.Helix.Client.Models +{ + public partial class AggregatedWorkItemCounts + { + public AggregatedWorkItemCounts(IImmutableDictionary key, Models.WorkItemStatusCounts data) + { + Key = key; + Data = data; + } + + [JsonProperty("Key")] + public IImmutableDictionary Key { get; set; } + + [JsonProperty("Data")] + public Models.WorkItemStatusCounts Data { get; set; } + + [JsonIgnore] + public bool IsValid + { + get + { + if (Key == default(IImmutableDictionary)) + { + return false; + } + if (Data == default(Models.WorkItemStatusCounts)) + { + return false; + } + return true; + } + } + } +} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/AnalysisCount.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/AnalysisCount.cs new file mode 100644 index 00000000000..f87f6d9bc6d --- /dev/null +++ b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/AnalysisCount.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Immutable; +using Newtonsoft.Json; + +namespace Microsoft.DotNet.Helix.Client.Models +{ + public partial class AnalysisCount + { + public AnalysisCount(string name, IImmutableDictionary status) + { + Name = name; + Status = status; + } + + [JsonProperty("Name")] + public string Name { get; set; } + + [JsonProperty("Status")] + public IImmutableDictionary Status { get; set; } + + [JsonIgnore] + public bool IsValid + { + get + { + if (string.IsNullOrEmpty(Name)) + { + return false; + } + if (Status == default(IImmutableDictionary)) + { + return false; + } + return true; + } + } + } +} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/BuildAggregation.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/BuildAggregation.cs new file mode 100644 index 00000000000..046d7c4b98e --- /dev/null +++ b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/BuildAggregation.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Immutable; +using Newtonsoft.Json; + +namespace Microsoft.DotNet.Helix.Client.Models +{ + public partial class BuildAggregation + { + public BuildAggregation(string buildNumber, IImmutableDictionary sources) + { + BuildNumber = buildNumber; + Sources = sources; + } + + [JsonProperty("BuildNumber")] + public string BuildNumber { get; set; } + + [JsonProperty("Sources")] + public IImmutableDictionary Sources { get; } + + [JsonIgnore] + public bool IsValid + { + get + { + if (string.IsNullOrEmpty(BuildNumber)) + { + return false; + } + return true; + } + } + } +} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/BuildAggregationSource.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/BuildAggregationSource.cs new file mode 100644 index 00000000000..41908012d24 --- /dev/null +++ b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/BuildAggregationSource.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Immutable; +using Newtonsoft.Json; + +namespace Microsoft.DotNet.Helix.Client.Models +{ + public partial class BuildAggregationSource + { + public BuildAggregationSource(IImmutableDictionary types) + { + Types = types; + } + + [JsonProperty("Types")] + public IImmutableDictionary Types { get; } + } +} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/BuildHistoryItem.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/BuildHistoryItem.cs new file mode 100644 index 00000000000..8271d23b6ab --- /dev/null +++ b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/BuildHistoryItem.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Immutable; +using Newtonsoft.Json; + +namespace Microsoft.DotNet.Helix.Client.Models +{ + public partial class BuildHistoryItem + { + public BuildHistoryItem(string buildNumber, DateTimeOffset timestamp, bool passed) + { + BuildNumber = buildNumber; + Timestamp = timestamp; + Passed = passed; + } + + [JsonProperty("BuildNumber")] + public string BuildNumber { get; set; } + + [JsonProperty("Timestamp")] + public DateTimeOffset Timestamp { get; set; } + + [JsonProperty("Passed")] + public bool Passed { get; set; } + + [JsonIgnore] + public bool IsValid + { + get + { + if (string.IsNullOrEmpty(BuildNumber)) + { + return false; + } + return true; + } + } + } +} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/DetailedVMScalingHistory.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/DetailedVMScalingHistory.cs new file mode 100644 index 00000000000..aaf847dc9c8 --- /dev/null +++ b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/DetailedVMScalingHistory.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Immutable; +using Newtonsoft.Json; + +namespace Microsoft.DotNet.Helix.Client.Models +{ + public partial class DetailedVMScalingHistory + { + public DetailedVMScalingHistory(string scaleSetName, string vMState, int vMCount, DateTimeOffset timestamp) + { + ScaleSetName = scaleSetName; + VMState = vMState; + VMCount = vMCount; + Timestamp = timestamp; + } + + [JsonProperty("ScaleSetName")] + public string ScaleSetName { get; set; } + + [JsonProperty("VMState")] + public string VMState { get; set; } + + [JsonProperty("VMCount")] + public int VMCount { get; set; } + + [JsonProperty("QueueName")] + public string QueueName { get; set; } + + [JsonProperty("MessageCount")] + public int? MessageCount { get; set; } + + [JsonProperty("Timestamp")] + public DateTimeOffset Timestamp { get; set; } + + [JsonIgnore] + public bool IsValid + { + get + { + if (string.IsNullOrEmpty(ScaleSetName)) + { + return false; + } + if (string.IsNullOrEmpty(VMState)) + { + return false; + } + return true; + } + } + } +} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/Displayable.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/Displayable.cs deleted file mode 100644 index 54163b50813..00000000000 --- a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/Displayable.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Immutable; -using Newtonsoft.Json; - -namespace Microsoft.DotNet.Helix.Client.Models -{ - public partial class Displayable - { - public Displayable() - { - } - - [JsonProperty("name")] - public string Name { get; set; } - - [JsonProperty("displayName")] - public string DisplayName { get; set; } - } -} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/HistoricalAnalysisItem.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/HistoricalAnalysisItem.cs new file mode 100644 index 00000000000..a14342fd250 --- /dev/null +++ b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/HistoricalAnalysisItem.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Immutable; +using Newtonsoft.Json; + +namespace Microsoft.DotNet.Helix.Client.Models +{ + public partial class HistoricalAnalysisItem + { + public HistoricalAnalysisItem() + { + } + + [JsonProperty("Queued")] + public DateTimeOffset? Queued { get; set; } + + [JsonProperty("Build")] + public string Build { get; set; } + + [JsonProperty("Results")] + public IImmutableDictionary Results { get; set; } + } +} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/InvestigationAnalysis.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/InvestigationAnalysis.cs new file mode 100644 index 00000000000..af5998aa9a7 --- /dev/null +++ b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/InvestigationAnalysis.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Immutable; +using Newtonsoft.Json; + +namespace Microsoft.DotNet.Helix.Client.Models +{ + public partial class InvestigationAnalysis + { + public InvestigationAnalysis(string job, string workItem, string name, Newtonsoft.Json.Linq.JToken analysis) + { + Job = job; + WorkItem = workItem; + Name = name; + Analysis = analysis; + } + + [JsonProperty("Job")] + public string Job { get; set; } + + [JsonProperty("WorkItem")] + public string WorkItem { get; set; } + + [JsonProperty("Name")] + public string Name { get; set; } + + [JsonProperty("Analysis")] + public Newtonsoft.Json.Linq.JToken Analysis { get; set; } + + [JsonIgnore] + public bool IsValid + { + get + { + if (string.IsNullOrEmpty(Job)) + { + return false; + } + if (string.IsNullOrEmpty(WorkItem)) + { + return false; + } + if (string.IsNullOrEmpty(Name)) + { + return false; + } + if (Analysis == default(Newtonsoft.Json.Linq.JToken)) + { + return false; + } + return true; + } + } + } +} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/InvestigationGroup.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/InvestigationGroup.cs new file mode 100644 index 00000000000..9de1720faef --- /dev/null +++ b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/InvestigationGroup.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Immutable; +using Newtonsoft.Json; + +namespace Microsoft.DotNet.Helix.Client.Models +{ + public partial class InvestigationGroup + { + public InvestigationGroup(IImmutableDictionary key, IImmutableDictionary> data) + { + Key = key; + Data = data; + } + + [JsonProperty("Key")] + public IImmutableDictionary Key { get; set; } + + [JsonProperty("Data")] + public IImmutableDictionary> Data { get; set; } + + [JsonIgnore] + public bool IsValid + { + get + { + if (Key == default(IImmutableDictionary)) + { + return false; + } + if (Data == default(IImmutableDictionary>)) + { + return false; + } + return true; + } + } + } +} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/InvestigationResult.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/InvestigationResult.cs new file mode 100644 index 00000000000..b5354117f18 --- /dev/null +++ b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/InvestigationResult.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Immutable; +using Newtonsoft.Json; + +namespace Microsoft.DotNet.Helix.Client.Models +{ + public partial class InvestigationResult + { + public InvestigationResult() + { + } + + [JsonProperty("Result")] + public IImmutableList Result { get; set; } + + [JsonProperty("ContinuationToken")] + public string ContinuationToken { get; set; } + } +} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/MultiSourceRequest.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/MultiSourceRequest.cs new file mode 100644 index 00000000000..464ea901bcf --- /dev/null +++ b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/MultiSourceRequest.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Immutable; +using Newtonsoft.Json; + +namespace Microsoft.DotNet.Helix.Client.Models +{ + public partial class MultiSourceRequest + { + public MultiSourceRequest(IImmutableList sources, int? buildCount) + { + Sources = sources; + BuildCount = buildCount; + } + + [JsonProperty("Sources")] + public IImmutableList Sources { get; } + + [JsonProperty("BuildCount")] + public int? BuildCount { get; } + } +} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/MultiSourceResponse.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/MultiSourceResponse.cs new file mode 100644 index 00000000000..c963ad3a3ad --- /dev/null +++ b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/MultiSourceResponse.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Immutable; +using Newtonsoft.Json; + +namespace Microsoft.DotNet.Helix.Client.Models +{ + public partial class MultiSourceResponse + { + public MultiSourceResponse(IImmutableDictionary sources) + { + Sources = sources; + } + + [JsonProperty("Sources")] + public IImmutableDictionary Sources { get; } + } +} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/MultiSourceResponseSource.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/MultiSourceResponseSource.cs new file mode 100644 index 00000000000..d9a496b092f --- /dev/null +++ b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/MultiSourceResponseSource.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Immutable; +using Newtonsoft.Json; + +namespace Microsoft.DotNet.Helix.Client.Models +{ + public partial class MultiSourceResponseSource + { + public MultiSourceResponseSource(IImmutableDictionary> types) + { + Types = types; + } + + [JsonProperty("Types")] + public IImmutableDictionary> Types { get; } + } +} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/QueueInfo.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/QueueInfo.cs index 5c5d4d1377c..106ba0ae7d4 100644 --- a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/QueueInfo.cs +++ b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/QueueInfo.cs @@ -60,5 +60,8 @@ public QueueInfo() [JsonProperty("WorkspacePath")] public string WorkspacePath { get; set; } + + [JsonProperty("EstimatedRemovalDate")] + public string EstimatedRemovalDate { get; set; } } } diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/SingleSourceRequest.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/SingleSourceRequest.cs new file mode 100644 index 00000000000..603978ba372 --- /dev/null +++ b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/SingleSourceRequest.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Immutable; +using Newtonsoft.Json; + +namespace Microsoft.DotNet.Helix.Client.Models +{ + public partial class SingleSourceRequest + { + public SingleSourceRequest(string name, IImmutableList types) + { + Name = name; + Types = types; + } + + [JsonProperty("Name")] + public string Name { get; } + + [JsonProperty("Types")] + public IImmutableList Types { get; } + } +} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/UnknownWorkItemEvent.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/UnknownWorkItemEvent.cs new file mode 100644 index 00000000000..0d0c4281c00 --- /dev/null +++ b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/UnknownWorkItemEvent.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Immutable; +using Newtonsoft.Json; + +namespace Microsoft.DotNet.Helix.Client.Models +{ + public partial class UnknownWorkItemEvent + { + public UnknownWorkItemEvent() + { + } + + [JsonProperty("Type")] + public string Type { get; set; } + + [JsonProperty("Timestamp")] + public DateTimeOffset? Timestamp { get; set; } + + [JsonProperty("Values")] + public IImmutableDictionary Values { get; set; } + } +} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ViewConfiguration.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ViewConfiguration.cs deleted file mode 100644 index a19fdb15c70..00000000000 --- a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ViewConfiguration.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Immutable; -using Newtonsoft.Json; - -namespace Microsoft.DotNet.Helix.Client.Models -{ - public partial class ViewConfiguration - { - public ViewConfiguration() - { - } - - [JsonProperty("products")] - public IImmutableList Products { get; set; } - - [JsonProperty("repositories")] - public IImmutableList Repositories { get; set; } - - [JsonProperty("name")] - public string Name { get; set; } - - [JsonProperty("displayName")] - public string DisplayName { get; set; } - } -} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ViewConfigurationExternalTelemetry.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ViewConfigurationExternalTelemetry.cs deleted file mode 100644 index 4a9f4e420f7..00000000000 --- a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ViewConfigurationExternalTelemetry.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Immutable; -using Newtonsoft.Json; - -namespace Microsoft.DotNet.Helix.Client.Models -{ - public partial class ViewConfigurationExternalTelemetry - { - public ViewConfigurationExternalTelemetry() - { - } - - [JsonProperty("name")] - public string Name { get; set; } - - [JsonProperty("value")] - public string Value { get; set; } - } -} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ViewConfigurationFlavor.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ViewConfigurationFlavor.cs deleted file mode 100644 index 2ff87cc9b91..00000000000 --- a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ViewConfigurationFlavor.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Immutable; -using Newtonsoft.Json; - -namespace Microsoft.DotNet.Helix.Client.Models -{ - public partial class ViewConfigurationFlavor - { - public ViewConfigurationFlavor() - { - } - - [JsonProperty("sources")] - public IImmutableList Sources { get; set; } - - [JsonProperty("name")] - public string Name { get; set; } - - [JsonProperty("displayName")] - public string DisplayName { get; set; } - } -} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ViewConfigurationProduct.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ViewConfigurationProduct.cs deleted file mode 100644 index 8c9cdff5fca..00000000000 --- a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ViewConfigurationProduct.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Immutable; -using Newtonsoft.Json; - -namespace Microsoft.DotNet.Helix.Client.Models -{ - public partial class ViewConfigurationProduct - { - public ViewConfigurationProduct() - { - } - - [JsonProperty("flavors")] - public IImmutableList Flavors { get; set; } - - [JsonProperty("name")] - public string Name { get; set; } - - [JsonProperty("displayName")] - public string DisplayName { get; set; } - } -} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ViewConfigurationRepositories.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ViewConfigurationRepositories.cs deleted file mode 100644 index 0a851a8c9ab..00000000000 --- a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ViewConfigurationRepositories.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Immutable; -using Newtonsoft.Json; - -namespace Microsoft.DotNet.Helix.Client.Models -{ - public partial class ViewConfigurationRepositories - { - public ViewConfigurationRepositories() - { - } - - [JsonProperty("repository")] - public string Repository { get; set; } - - [JsonProperty("name")] - public string Name { get; set; } - - [JsonProperty("displayName")] - public string DisplayName { get; set; } - } -} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ViewConfigurationSource.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ViewConfigurationSource.cs deleted file mode 100644 index a6652ef2eb1..00000000000 --- a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ViewConfigurationSource.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Collections.Immutable; -using Newtonsoft.Json; - -namespace Microsoft.DotNet.Helix.Client.Models -{ - public partial class ViewConfigurationSource - { - public ViewConfigurationSource() - { - } - - [JsonProperty("repository")] - public string Repository { get; set; } - - [JsonProperty("branch")] - public string Branch { get; set; } - - [JsonProperty("milestone")] - public string Milestone { get; set; } - - [JsonProperty("sortByBuild")] - public bool? SortByBuild { get; set; } - - [JsonProperty("releaseLinks")] - public IImmutableList ReleaseLinks { get; set; } - - [JsonProperty("types")] - public IImmutableList Types { get; set; } - - [JsonProperty("externalLinks")] - public IImmutableList ExternalLinks { get; set; } - - [JsonProperty("buildProperties")] - public IImmutableDictionary BuildProperties { get; set; } - - [JsonProperty("name")] - public string Name { get; set; } - - [JsonProperty("displayName")] - public string DisplayName { get; set; } - } -} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ViewConfigurationType.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ViewConfigurationType.cs deleted file mode 100644 index 291e5fe0bdf..00000000000 --- a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ViewConfigurationType.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Immutable; -using Newtonsoft.Json; - -namespace Microsoft.DotNet.Helix.Client.Models -{ - public partial class ViewConfigurationType - { - public ViewConfigurationType() - { - } - - [JsonProperty("columns")] - public IImmutableList Columns { get; set; } - - [JsonProperty("otherProperties")] - public IImmutableList OtherProperties { get; set; } - - [JsonProperty("noWorkitems")] - public bool? NoWorkitems { get; set; } - - [JsonProperty("name")] - public string Name { get; set; } - - [JsonProperty("displayName")] - public string DisplayName { get; set; } - } -} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/WorkItemAggregateSummary.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/WorkItemAggregateSummary.cs new file mode 100644 index 00000000000..410ca356f7e --- /dev/null +++ b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/WorkItemAggregateSummary.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Immutable; +using Newtonsoft.Json; + +namespace Microsoft.DotNet.Helix.Client.Models +{ + public partial class WorkItemAggregateSummary + { + public WorkItemAggregateSummary() + { + } + + [JsonProperty("JobId")] + public int? JobId { get; set; } + + [JsonProperty("WorkItemId")] + public int? WorkItemId { get; set; } + + [JsonProperty("MachineName")] + public string MachineName { get; set; } + + [JsonProperty("Job")] + public string Job { get; set; } + + [JsonProperty("Name")] + public string Name { get; set; } + + [JsonProperty("Guid")] + public Guid? Guid { get; set; } + + [JsonProperty("QueueTime")] + public DateTimeOffset? QueueTime { get; set; } + + [JsonProperty("StartTime")] + public DateTimeOffset? StartTime { get; set; } + + [JsonProperty("FinishedTime")] + public DateTimeOffset? FinishedTime { get; set; } + + [JsonProperty("ExitCode")] + public int? ExitCode { get; set; } + + [JsonProperty("ConsoleOutputUri")] + public string ConsoleOutputUri { get; set; } + + [JsonProperty("Logs")] + public IImmutableList Logs { get; set; } + + [JsonProperty("Errors")] + public IImmutableList Errors { get; set; } + + [JsonProperty("Warnings")] + public IImmutableList Warnings { get; set; } + + [JsonProperty("OtherEvents")] + public IImmutableList OtherEvents { get; set; } + + [JsonProperty("Passed")] + public bool? Passed { get; set; } + + [JsonProperty("Attempt")] + public int? Attempt { get; set; } + + [JsonProperty("State")] + public string State { get; set; } + + [JsonProperty("Key")] + public IImmutableDictionary Key { get; set; } + } +} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/WorkItemDetails.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/WorkItemDetails.cs index ec5965534f1..7f351058eff 100644 --- a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/WorkItemDetails.cs +++ b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/WorkItemDetails.cs @@ -18,6 +18,21 @@ public WorkItemDetails(string id, string machineName, string job, string name, s [JsonProperty("FailureReason")] public Models.FailureReason FailureReason { get; set; } + [JsonProperty("Queued")] + public DateTimeOffset? Queued { get; set; } + + [JsonProperty("Started")] + public DateTimeOffset? Started { get; set; } + + [JsonProperty("Finished")] + public DateTimeOffset? Finished { get; set; } + + [JsonProperty("Delay")] + public string Delay { get; set; } + + [JsonProperty("Duration")] + public string Duration { get; set; } + [JsonProperty("Id")] public string Id { get; set; } diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/WorkItemStatusCounts.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/WorkItemStatusCounts.cs new file mode 100644 index 00000000000..288ac0e0cfc --- /dev/null +++ b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/WorkItemStatusCounts.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Immutable; +using Newtonsoft.Json; + +namespace Microsoft.DotNet.Helix.Client.Models +{ + public partial class WorkItemStatusCounts + { + public WorkItemStatusCounts(IImmutableList analysis, IImmutableDictionary workItemStatus) + { + Analysis = analysis; + WorkItemStatus = workItemStatus; + } + + [JsonProperty("Analysis")] + public IImmutableList Analysis { get; set; } + + [JsonProperty("WorkItemStatus")] + public IImmutableDictionary WorkItemStatus { get; set; } + + [JsonIgnore] + public bool IsValid + { + get + { + if (Analysis == default(IImmutableList)) + { + return false; + } + if (WorkItemStatus == default(IImmutableDictionary)) + { + return false; + } + return true; + } + } + } +} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Repository.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Repository.cs deleted file mode 100644 index 06996a6acd9..00000000000 --- a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Repository.cs +++ /dev/null @@ -1,109 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.Immutable; -using System.IO; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; - - - -namespace Microsoft.DotNet.Helix.Client -{ - public partial interface IRepository - { - Task GetRepositoriesAsync( - string vcb = default, - CancellationToken cancellationToken = default - ); - - } - - internal partial class Repository : IServiceOperations, IRepository - { - public Repository(HelixApi client) - { - Client = client ?? throw new ArgumentNullException(nameof(client)); - } - - public HelixApi Client { get; } - - partial void HandleFailedRequest(RestApiException ex); - - partial void HandleFailedGetRepositoriesRequest(RestApiException ex); - - public async Task GetRepositoriesAsync( - string vcb = default, - CancellationToken cancellationToken = default - ) - { - - const string apiVersion = "2019-06-17"; - - var _baseUri = Client.Options.BaseUri; - var _url = new RequestUriBuilder(); - _url.Reset(_baseUri); - _url.AppendPath( - "/api/repo", - false); - - if (!string.IsNullOrEmpty(vcb)) - { - _url.AppendQuery("_vcb", Client.Serialize(vcb)); - } - _url.AppendQuery("api-version", Client.Serialize(apiVersion)); - - - using (var _req = Client.Pipeline.CreateRequest()) - { - _req.Uri = _url; - _req.Method = RequestMethod.Get; - - using (var _res = await Client.SendAsync(_req, cancellationToken).ConfigureAwait(false)) - { - if (_res.Status < 200 || _res.Status >= 300) - { - await OnGetRepositoriesFailed(_req, _res).ConfigureAwait(false); - } - - if (_res.ContentStream == null) - { - await OnGetRepositoriesFailed(_req, _res).ConfigureAwait(false); - } - - using (var _reader = new StreamReader(_res.ContentStream)) - { - var _content = await _reader.ReadToEndAsync().ConfigureAwait(false); - var _body = Client.Deserialize(_content); - return _body; - } - } - } - } - - internal async Task OnGetRepositoriesFailed(Request req, Response res) - { - string content = null; - if (res.ContentStream != null) - { - using (var reader = new StreamReader(res.ContentStream)) - { - content = await reader.ReadToEndAsync().ConfigureAwait(false); - } - } - - var ex = new RestApiException( - req, - res, - content, - Client.Deserialize(content) - ); - HandleFailedGetRepositoriesRequest(ex); - HandleFailedRequest(ex); - Client.OnFailedRequest(ex); - throw ex; - } - } -} diff --git a/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/ScaleSets.cs b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/ScaleSets.cs new file mode 100644 index 00000000000..22c73fbb5f9 --- /dev/null +++ b/src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/ScaleSets.cs @@ -0,0 +1,194 @@ +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.IO; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; + + + +namespace Microsoft.DotNet.Helix.Client +{ + public partial interface IScaleSets + { + Task> GetDetailedVMScalingHistoryAsync( + DateTimeOffset date, + string scaleSet = default, + CancellationToken cancellationToken = default + ); + + Task> GetAggregatedVMScalingHistoryAsync( + DateTimeOffset date, + CancellationToken cancellationToken = default + ); + + } + + internal partial class ScaleSets : IServiceOperations, IScaleSets + { + public ScaleSets(HelixApi client) + { + Client = client ?? throw new ArgumentNullException(nameof(client)); + } + + public HelixApi Client { get; } + + partial void HandleFailedRequest(RestApiException ex); + + partial void HandleFailedGetDetailedVMScalingHistoryRequest(RestApiException ex); + + public async Task> GetDetailedVMScalingHistoryAsync( + DateTimeOffset date, + string scaleSet = default, + CancellationToken cancellationToken = default + ) + { + + const string apiVersion = "2019-06-17"; + + var _baseUri = Client.Options.BaseUri; + var _url = new RequestUriBuilder(); + _url.Reset(_baseUri); + _url.AppendPath( + "/api/scalesets/detailedHistory", + false); + + if (date != default(DateTimeOffset)) + { + _url.AppendQuery("date", Client.Serialize(date)); + } + if (!string.IsNullOrEmpty(scaleSet)) + { + _url.AppendQuery("scaleSet", Client.Serialize(scaleSet)); + } + _url.AppendQuery("api-version", Client.Serialize(apiVersion)); + + + using (var _req = Client.Pipeline.CreateRequest()) + { + _req.Uri = _url; + _req.Method = RequestMethod.Get; + + using (var _res = await Client.SendAsync(_req, cancellationToken).ConfigureAwait(false)) + { + if (_res.Status < 200 || _res.Status >= 300) + { + await OnGetDetailedVMScalingHistoryFailed(_req, _res).ConfigureAwait(false); + } + + if (_res.ContentStream == null) + { + await OnGetDetailedVMScalingHistoryFailed(_req, _res).ConfigureAwait(false); + } + + using (var _reader = new StreamReader(_res.ContentStream)) + { + var _content = await _reader.ReadToEndAsync().ConfigureAwait(false); + var _body = Client.Deserialize>(_content); + return _body; + } + } + } + } + + internal async Task OnGetDetailedVMScalingHistoryFailed(Request req, Response res) + { + string content = null; + if (res.ContentStream != null) + { + using (var reader = new StreamReader(res.ContentStream)) + { + content = await reader.ReadToEndAsync().ConfigureAwait(false); + } + } + + var ex = new RestApiException( + req, + res, + content, + Client.Deserialize(content) + ); + HandleFailedGetDetailedVMScalingHistoryRequest(ex); + HandleFailedRequest(ex); + Client.OnFailedRequest(ex); + throw ex; + } + + partial void HandleFailedGetAggregatedVMScalingHistoryRequest(RestApiException ex); + + public async Task> GetAggregatedVMScalingHistoryAsync( + DateTimeOffset date, + CancellationToken cancellationToken = default + ) + { + + const string apiVersion = "2019-06-17"; + + var _baseUri = Client.Options.BaseUri; + var _url = new RequestUriBuilder(); + _url.Reset(_baseUri); + _url.AppendPath( + "/api/scalesets/aggregatedHistory", + false); + + if (date != default(DateTimeOffset)) + { + _url.AppendQuery("date", Client.Serialize(date)); + } + _url.AppendQuery("api-version", Client.Serialize(apiVersion)); + + + using (var _req = Client.Pipeline.CreateRequest()) + { + _req.Uri = _url; + _req.Method = RequestMethod.Get; + + using (var _res = await Client.SendAsync(_req, cancellationToken).ConfigureAwait(false)) + { + if (_res.Status < 200 || _res.Status >= 300) + { + await OnGetAggregatedVMScalingHistoryFailed(_req, _res).ConfigureAwait(false); + } + + if (_res.ContentStream == null) + { + await OnGetAggregatedVMScalingHistoryFailed(_req, _res).ConfigureAwait(false); + } + + using (var _reader = new StreamReader(_res.ContentStream)) + { + var _content = await _reader.ReadToEndAsync().ConfigureAwait(false); + var _body = Client.Deserialize>(_content); + return _body; + } + } + } + } + + internal async Task OnGetAggregatedVMScalingHistoryFailed(Request req, Response res) + { + string content = null; + if (res.ContentStream != null) + { + using (var reader = new StreamReader(res.ContentStream)) + { + content = await reader.ReadToEndAsync().ConfigureAwait(false); + } + } + + var ex = new RestApiException( + req, + res, + content, + Client.Deserialize(content) + ); + HandleFailedGetAggregatedVMScalingHistoryRequest(ex); + HandleFailedRequest(ex); + Client.OnFailedRequest(ex); + throw ex; + } + } +} From 53f340e4185622e03a321c6b7150d1ffecb438ce Mon Sep 17 00:00:00 2001 From: Matt Galbraith Date: Thu, 16 Dec 2021 16:53:54 -0800 Subject: [PATCH 2/3] Add warning for Helix queue expiration date coming in next 3 weeks --- .../JobSender/JobDefinition.cs | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/Microsoft.DotNet.Helix/JobSender/JobDefinition.cs b/src/Microsoft.DotNet.Helix/JobSender/JobDefinition.cs index 078cff49c71..14cd21ea08d 100644 --- a/src/Microsoft.DotNet.Helix/JobSender/JobDefinition.cs +++ b/src/Microsoft.DotNet.Helix/JobSender/JobDefinition.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Collections.Immutable; using System.Collections.ObjectModel; +using System.Globalization; using System.IO; using System.Linq; using System.Text.RegularExpressions; @@ -158,6 +159,7 @@ public async Task SendAsync(Action log, CancellationToken canc try { QueueInfo queueInfo = await HelixApi.Information.QueueInfoAsync(queueId, false, cancellationToken); + WarnForImpendingRemoval(log, queueInfo); } // 404 = this queue does not exist, or did and was removed. catch (RestApiException ex) when (ex.Response?.Status == 404) @@ -234,6 +236,36 @@ public async Task SendAsync(Action log, CancellationToken canc return new SentJob(JobApi, newJob, newJob.ResultsUri, newJob.ResultsUriRSAS); } + private void WarnForImpendingRemoval(Action log, QueueInfo queueInfo) + { + bool azDoVariableDefined = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("SYSTEM_TEAMPROJECT")); + DateTime whenItExpires = DateTime.MaxValue; + + if (DateTime.TryParseExact(queueInfo.EstimatedRemovalDate, "yyyy-MM-dd", null, DateTimeStyles.AssumeUniversal, out DateTime dtIso)) + { + whenItExpires = dtIso; + } + // This branch can be removed once the strings start coming in in ISO-8601 format + // Currently the API provides values in this format though and they are unlikely to get confused with each other. + else if (DateTime.TryParseExact(queueInfo.EstimatedRemovalDate, "M/d/yyyy", null, DateTimeStyles.AssumeUniversal, out DateTime dtUsa)) + { + whenItExpires = dtUsa; + } + + if (whenItExpires != DateTime.MaxValue) // We recognized a date from the string + { + TimeSpan untilRemoved = whenItExpires.ToUniversalTime().Subtract(DateTime.UtcNow); + if (untilRemoved.TotalDays <= 21) + { + Console.WriteLine($"{(azDoVariableDefined ? "##vso[task.logissue type=warning]" : "")}Helix queue {queueInfo.QueueId} {(untilRemoved.TotalDays < 0 ? "was" : "is")} slated for removal on {queueInfo.EstimatedRemovalDate}. Please discontinue usage. Contact dnceng for questions / concerns "); + } + } + else + { + Console.WriteLine($"{(azDoVariableDefined ? "##vso[task.logissue type=warning]" : "")}Unable to parse estimated removal date '{queueInfo.EstimatedRemovalDate}' for queue '{queueInfo.QueueId}' (please contact dnceng with this information)"); + } + } + private (string queueId, string dockerTag, string queueAlias) ParseQueueId(string value) { var @index = value.IndexOf('@'); From 567acd43b1d65ff57289b27b8132934221d989ce Mon Sep 17 00:00:00 2001 From: Matt Galbraith Date: Mon, 27 Dec 2021 11:43:09 -0800 Subject: [PATCH 3/3] PR feedbacks- Use the passed-in logger --- src/Microsoft.DotNet.Helix/JobSender/JobDefinition.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.DotNet.Helix/JobSender/JobDefinition.cs b/src/Microsoft.DotNet.Helix/JobSender/JobDefinition.cs index 14cd21ea08d..e6ca7b2cc70 100644 --- a/src/Microsoft.DotNet.Helix/JobSender/JobDefinition.cs +++ b/src/Microsoft.DotNet.Helix/JobSender/JobDefinition.cs @@ -257,12 +257,12 @@ private void WarnForImpendingRemoval(Action log, QueueInfo queueInfo) TimeSpan untilRemoved = whenItExpires.ToUniversalTime().Subtract(DateTime.UtcNow); if (untilRemoved.TotalDays <= 21) { - Console.WriteLine($"{(azDoVariableDefined ? "##vso[task.logissue type=warning]" : "")}Helix queue {queueInfo.QueueId} {(untilRemoved.TotalDays < 0 ? "was" : "is")} slated for removal on {queueInfo.EstimatedRemovalDate}. Please discontinue usage. Contact dnceng for questions / concerns "); + log?.Invoke($"{(azDoVariableDefined ? "##vso[task.logissue type=warning]" : "")}Helix queue {queueInfo.QueueId} {(untilRemoved.TotalDays < 0 ? "was" : "is")} slated for removal on {queueInfo.EstimatedRemovalDate}. Please discontinue usage. Contact dnceng for questions / concerns "); } } else { - Console.WriteLine($"{(azDoVariableDefined ? "##vso[task.logissue type=warning]" : "")}Unable to parse estimated removal date '{queueInfo.EstimatedRemovalDate}' for queue '{queueInfo.QueueId}' (please contact dnceng with this information)"); + log?.Invoke($"{(azDoVariableDefined ? "##vso[task.logissue type=warning]" : "")}Unable to parse estimated removal date '{queueInfo.EstimatedRemovalDate}' for queue '{queueInfo.QueueId}' (please contact dnceng with this information)"); } }