Skip to content

Commit

Permalink
Merge pull request microsoft#103 from microsoft/release_8.2
Browse files Browse the repository at this point in the history
Release 8.2
  • Loading branch information
jeffj6123 authored Oct 21, 2021
2 parents a4a9f85 + 291ba20 commit 83d04d7
Show file tree
Hide file tree
Showing 46 changed files with 1,637 additions and 75 deletions.
2 changes: 1 addition & 1 deletion properties/service_fabric_common.props
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<!-- Version for binaries, nuget packages generated from this repo. -->
<!-- TODO: Versions numbers are changed here manually for now, Integrate this with GitVersion. -->
<MajorVersion>4</MajorVersion>
<MinorVersion>5</MinorVersion>
<MinorVersion>6</MinorVersion>
<BuildVersion>0</BuildVersion>
<Revision>0</Revision>
</PropertyGroup>
Expand Down
38 changes: 38 additions & 0 deletions src/Microsoft.ServiceFabric.Client.Http/Generated/ClusterClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -828,5 +828,43 @@ HttpRequestMessage RequestFunc()

return this.httpClient.SendAsync(RequestFunc, url, requestId, cancellationToken);
}

/// <inheritdoc />
public Task<ValidateClusterUpgradeResult> ValidateClusterUpgradeAsync(
StartClusterUpgradeDescription startClusterUpgradeDescription,
long? serverTimeout = 60,
CancellationToken cancellationToken = default(CancellationToken))
{
startClusterUpgradeDescription.ThrowIfNull(nameof(startClusterUpgradeDescription));
serverTimeout?.ThrowIfOutOfInclusiveRange("serverTimeout", 1, 4294967295);
var requestId = Guid.NewGuid().ToString();
var url = "$/ValidateUpgrade";
var queryParams = new List<string>();

// Append to queryParams if not null.
serverTimeout?.AddToQueryParameters(queryParams, $"timeout={serverTimeout}");
queryParams.Add("api-version=8.2");
url += "?" + string.Join("&", queryParams);

string content;
using (var sw = new StringWriter())
{
StartClusterUpgradeDescriptionConverter.Serialize(new JsonTextWriter(sw), startClusterUpgradeDescription);
content = sw.ToString();
}

HttpRequestMessage RequestFunc()
{
var request = new HttpRequestMessage()
{
Method = HttpMethod.Post,
Content = new StringContent(content, Encoding.UTF8),
};
request.Content.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
return request;
}

return this.httpClient.SendAsyncGetResponse(RequestFunc, url, ValidateClusterUpgradeResultConverter.Deserialize, requestId, cancellationToken);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ internal static ApplicationUpgradeProgressInfo GetFromJsonProperties(JsonReader
var typeName = default(string);
var targetApplicationTypeVersion = default(string);
var upgradeDomains = default(IEnumerable<UpgradeDomainInfo>);
var upgradeUnits = default(IEnumerable<UpgradeUnitInfo>);
var upgradeState = default(UpgradeState?);
var nextUpgradeDomain = default(string);
var rollingUpgradeMode = default(UpgradeMode?);
Expand All @@ -45,11 +46,13 @@ internal static ApplicationUpgradeProgressInfo GetFromJsonProperties(JsonReader
var upgradeDomainDurationInMilliseconds = default(string);
var unhealthyEvaluations = default(IEnumerable<HealthEvaluationWrapper>);
var currentUpgradeDomainProgress = default(CurrentUpgradeDomainProgressInfo);
var currentUpgradeUnitsProgress = default(CurrentUpgradeUnitsProgressInfo);
var startTimestampUtc = default(string);
var failureTimestampUtc = default(string);
var failureReason = default(FailureReason?);
var upgradeDomainProgressAtFailure = default(FailureUpgradeDomainProgressInfo);
var upgradeStatusDetails = default(string);
var isNodeByNode = default(bool?);

do
{
Expand All @@ -70,6 +73,10 @@ internal static ApplicationUpgradeProgressInfo GetFromJsonProperties(JsonReader
{
upgradeDomains = reader.ReadList(UpgradeDomainInfoConverter.Deserialize);
}
else if (string.Compare("UpgradeUnits", propName, StringComparison.OrdinalIgnoreCase) == 0)
{
upgradeUnits = reader.ReadList(UpgradeUnitInfoConverter.Deserialize);
}
else if (string.Compare("UpgradeState", propName, StringComparison.OrdinalIgnoreCase) == 0)
{
upgradeState = UpgradeStateConverter.Deserialize(reader);
Expand Down Expand Up @@ -102,6 +109,10 @@ internal static ApplicationUpgradeProgressInfo GetFromJsonProperties(JsonReader
{
currentUpgradeDomainProgress = CurrentUpgradeDomainProgressInfoConverter.Deserialize(reader);
}
else if (string.Compare("CurrentUpgradeUnitsProgress", propName, StringComparison.OrdinalIgnoreCase) == 0)
{
currentUpgradeUnitsProgress = CurrentUpgradeUnitsProgressInfoConverter.Deserialize(reader);
}
else if (string.Compare("StartTimestampUtc", propName, StringComparison.OrdinalIgnoreCase) == 0)
{
startTimestampUtc = reader.ReadValueAsString();
Expand All @@ -122,6 +133,10 @@ internal static ApplicationUpgradeProgressInfo GetFromJsonProperties(JsonReader
{
upgradeStatusDetails = reader.ReadValueAsString();
}
else if (string.Compare("IsNodeByNode", propName, StringComparison.OrdinalIgnoreCase) == 0)
{
isNodeByNode = reader.ReadValueAsBool();
}
else
{
reader.SkipPropertyValue();
Expand All @@ -134,6 +149,7 @@ internal static ApplicationUpgradeProgressInfo GetFromJsonProperties(JsonReader
typeName: typeName,
targetApplicationTypeVersion: targetApplicationTypeVersion,
upgradeDomains: upgradeDomains,
upgradeUnits: upgradeUnits,
upgradeState: upgradeState,
nextUpgradeDomain: nextUpgradeDomain,
rollingUpgradeMode: rollingUpgradeMode,
Expand All @@ -142,11 +158,13 @@ internal static ApplicationUpgradeProgressInfo GetFromJsonProperties(JsonReader
upgradeDomainDurationInMilliseconds: upgradeDomainDurationInMilliseconds,
unhealthyEvaluations: unhealthyEvaluations,
currentUpgradeDomainProgress: currentUpgradeDomainProgress,
currentUpgradeUnitsProgress: currentUpgradeUnitsProgress,
startTimestampUtc: startTimestampUtc,
failureTimestampUtc: failureTimestampUtc,
failureReason: failureReason,
upgradeDomainProgressAtFailure: upgradeDomainProgressAtFailure,
upgradeStatusDetails: upgradeStatusDetails);
upgradeStatusDetails: upgradeStatusDetails,
isNodeByNode: isNodeByNode);
}

/// <summary>
Expand Down Expand Up @@ -181,6 +199,11 @@ internal static void Serialize(JsonWriter writer, ApplicationUpgradeProgressInfo
writer.WriteEnumerableProperty(obj.UpgradeDomains, "UpgradeDomains", UpgradeDomainInfoConverter.Serialize);
}

if (obj.UpgradeUnits != null)
{
writer.WriteEnumerableProperty(obj.UpgradeUnits, "UpgradeUnits", UpgradeUnitInfoConverter.Serialize);
}

if (obj.NextUpgradeDomain != null)
{
writer.WriteProperty(obj.NextUpgradeDomain, "NextUpgradeDomain", JsonWriterExtensions.WriteStringValue);
Expand Down Expand Up @@ -211,6 +234,11 @@ internal static void Serialize(JsonWriter writer, ApplicationUpgradeProgressInfo
writer.WriteProperty(obj.CurrentUpgradeDomainProgress, "CurrentUpgradeDomainProgress", CurrentUpgradeDomainProgressInfoConverter.Serialize);
}

if (obj.CurrentUpgradeUnitsProgress != null)
{
writer.WriteProperty(obj.CurrentUpgradeUnitsProgress, "CurrentUpgradeUnitsProgress", CurrentUpgradeUnitsProgressInfoConverter.Serialize);
}

if (obj.StartTimestampUtc != null)
{
writer.WriteProperty(obj.StartTimestampUtc, "StartTimestampUtc", JsonWriterExtensions.WriteStringValue);
Expand All @@ -231,6 +259,11 @@ internal static void Serialize(JsonWriter writer, ApplicationUpgradeProgressInfo
writer.WriteProperty(obj.UpgradeStatusDetails, "UpgradeStatusDetails", JsonWriterExtensions.WriteStringValue);
}

if (obj.IsNodeByNode != null)
{
writer.WriteProperty(obj.IsNodeByNode, "IsNodeByNode", JsonWriterExtensions.WriteBoolValue);
}

writer.WriteEndObject();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ internal static ClusterUpgradeProgressObject GetFromJsonProperties(JsonReader re
var codeVersion = default(string);
var configVersion = default(string);
var upgradeDomains = default(IEnumerable<UpgradeDomainInfo>);
var upgradeUnits = default(IEnumerable<UpgradeUnitInfo>);
var upgradeState = default(UpgradeState?);
var nextUpgradeDomain = default(string);
var rollingUpgradeMode = default(UpgradeMode?);
Expand All @@ -44,10 +45,12 @@ internal static ClusterUpgradeProgressObject GetFromJsonProperties(JsonReader re
var upgradeDomainDurationInMilliseconds = default(string);
var unhealthyEvaluations = default(IEnumerable<HealthEvaluationWrapper>);
var currentUpgradeDomainProgress = default(CurrentUpgradeDomainProgressInfo);
var currentUpgradeUnitsProgress = default(CurrentUpgradeUnitsProgressInfo);
var startTimestampUtc = default(string);
var failureTimestampUtc = default(string);
var failureReason = default(FailureReason?);
var upgradeDomainProgressAtFailure = default(FailedUpgradeDomainProgressObject);
var isNodeByNode = default(bool?);

do
{
Expand All @@ -64,6 +67,10 @@ internal static ClusterUpgradeProgressObject GetFromJsonProperties(JsonReader re
{
upgradeDomains = reader.ReadList(UpgradeDomainInfoConverter.Deserialize);
}
else if (string.Compare("UpgradeUnits", propName, StringComparison.OrdinalIgnoreCase) == 0)
{
upgradeUnits = reader.ReadList(UpgradeUnitInfoConverter.Deserialize);
}
else if (string.Compare("UpgradeState", propName, StringComparison.OrdinalIgnoreCase) == 0)
{
upgradeState = UpgradeStateConverter.Deserialize(reader);
Expand Down Expand Up @@ -96,6 +103,10 @@ internal static ClusterUpgradeProgressObject GetFromJsonProperties(JsonReader re
{
currentUpgradeDomainProgress = CurrentUpgradeDomainProgressInfoConverter.Deserialize(reader);
}
else if (string.Compare("CurrentUpgradeUnitsProgress", propName, StringComparison.OrdinalIgnoreCase) == 0)
{
currentUpgradeUnitsProgress = CurrentUpgradeUnitsProgressInfoConverter.Deserialize(reader);
}
else if (string.Compare("StartTimestampUtc", propName, StringComparison.OrdinalIgnoreCase) == 0)
{
startTimestampUtc = reader.ReadValueAsString();
Expand All @@ -112,6 +123,10 @@ internal static ClusterUpgradeProgressObject GetFromJsonProperties(JsonReader re
{
upgradeDomainProgressAtFailure = FailedUpgradeDomainProgressObjectConverter.Deserialize(reader);
}
else if (string.Compare("IsNodeByNode", propName, StringComparison.OrdinalIgnoreCase) == 0)
{
isNodeByNode = reader.ReadValueAsBool();
}
else
{
reader.SkipPropertyValue();
Expand All @@ -123,6 +138,7 @@ internal static ClusterUpgradeProgressObject GetFromJsonProperties(JsonReader re
codeVersion: codeVersion,
configVersion: configVersion,
upgradeDomains: upgradeDomains,
upgradeUnits: upgradeUnits,
upgradeState: upgradeState,
nextUpgradeDomain: nextUpgradeDomain,
rollingUpgradeMode: rollingUpgradeMode,
Expand All @@ -131,10 +147,12 @@ internal static ClusterUpgradeProgressObject GetFromJsonProperties(JsonReader re
upgradeDomainDurationInMilliseconds: upgradeDomainDurationInMilliseconds,
unhealthyEvaluations: unhealthyEvaluations,
currentUpgradeDomainProgress: currentUpgradeDomainProgress,
currentUpgradeUnitsProgress: currentUpgradeUnitsProgress,
startTimestampUtc: startTimestampUtc,
failureTimestampUtc: failureTimestampUtc,
failureReason: failureReason,
upgradeDomainProgressAtFailure: upgradeDomainProgressAtFailure);
upgradeDomainProgressAtFailure: upgradeDomainProgressAtFailure,
isNodeByNode: isNodeByNode);
}

/// <summary>
Expand Down Expand Up @@ -164,6 +182,11 @@ internal static void Serialize(JsonWriter writer, ClusterUpgradeProgressObject o
writer.WriteEnumerableProperty(obj.UpgradeDomains, "UpgradeDomains", UpgradeDomainInfoConverter.Serialize);
}

if (obj.UpgradeUnits != null)
{
writer.WriteEnumerableProperty(obj.UpgradeUnits, "UpgradeUnits", UpgradeUnitInfoConverter.Serialize);
}

if (obj.NextUpgradeDomain != null)
{
writer.WriteProperty(obj.NextUpgradeDomain, "NextUpgradeDomain", JsonWriterExtensions.WriteStringValue);
Expand Down Expand Up @@ -194,6 +217,11 @@ internal static void Serialize(JsonWriter writer, ClusterUpgradeProgressObject o
writer.WriteProperty(obj.CurrentUpgradeDomainProgress, "CurrentUpgradeDomainProgress", CurrentUpgradeDomainProgressInfoConverter.Serialize);
}

if (obj.CurrentUpgradeUnitsProgress != null)
{
writer.WriteProperty(obj.CurrentUpgradeUnitsProgress, "CurrentUpgradeUnitsProgress", CurrentUpgradeUnitsProgressInfoConverter.Serialize);
}

if (obj.StartTimestampUtc != null)
{
writer.WriteProperty(obj.StartTimestampUtc, "StartTimestampUtc", JsonWriterExtensions.WriteStringValue);
Expand All @@ -209,6 +237,11 @@ internal static void Serialize(JsonWriter writer, ClusterUpgradeProgressObject o
writer.WriteProperty(obj.UpgradeDomainProgressAtFailure, "UpgradeDomainProgressAtFailure", FailedUpgradeDomainProgressObjectConverter.Serialize);
}

if (obj.IsNodeByNode != null)
{
writer.WriteProperty(obj.IsNodeByNode, "IsNodeByNode", JsonWriterExtensions.WriteBoolValue);
}

writer.WriteEndObject();
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
// ------------------------------------------------------------

namespace Microsoft.ServiceFabric.Client.Http.Serialization
{
using System;
using System.Collections.Generic;
using Microsoft.ServiceFabric.Common;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

/// <summary>
/// Converter for <see cref="CurrentUpgradeUnitsProgressInfo" />.
/// </summary>
internal class CurrentUpgradeUnitsProgressInfoConverter
{
/// <summary>
/// Deserializes the JSON representation of the object.
/// </summary>
/// <param name="reader">The <see cref="T: Newtonsoft.Json.JsonReader" /> to read from.</param>
/// <returns>The object Value.</returns>
internal static CurrentUpgradeUnitsProgressInfo Deserialize(JsonReader reader)
{
return reader.Deserialize(GetFromJsonProperties);
}

/// <summary>
/// Gets the object from Json properties.
/// </summary>
/// <param name="reader">The <see cref="T: Newtonsoft.Json.JsonReader" /> to read from, reader must be placed at first property.</param>
/// <returns>The object Value.</returns>
internal static CurrentUpgradeUnitsProgressInfo GetFromJsonProperties(JsonReader reader)
{
var domainName = default(string);
var nodeUpgradeProgressList = default(IEnumerable<NodeUpgradeProgressInfo>);

do
{
var propName = reader.ReadPropertyName();
if (string.Compare("DomainName", propName, StringComparison.OrdinalIgnoreCase) == 0)
{
domainName = reader.ReadValueAsString();
}
else if (string.Compare("NodeUpgradeProgressList", propName, StringComparison.OrdinalIgnoreCase) == 0)
{
nodeUpgradeProgressList = reader.ReadList(NodeUpgradeProgressInfoConverter.Deserialize);
}
else
{
reader.SkipPropertyValue();
}
}
while (reader.TokenType != JsonToken.EndObject);

return new CurrentUpgradeUnitsProgressInfo(
domainName: domainName,
nodeUpgradeProgressList: nodeUpgradeProgressList);
}

/// <summary>
/// Serializes the object to JSON.
/// </summary>
/// <param name="writer">The <see cref="T: Newtonsoft.Json.JsonWriter" /> to write to.</param>
/// <param name="obj">The object to serialize to JSON.</param>
internal static void Serialize(JsonWriter writer, CurrentUpgradeUnitsProgressInfo obj)
{
// Required properties are always serialized, optional properties are serialized when not null.
writer.WriteStartObject();
if (obj.DomainName != null)
{
writer.WriteProperty(obj.DomainName, "DomainName", JsonWriterExtensions.WriteStringValue);
}

if (obj.NodeUpgradeProgressList != null)
{
writer.WriteEnumerableProperty(obj.NodeUpgradeProgressList, "NodeUpgradeProgressList", NodeUpgradeProgressInfoConverter.Serialize);
}

writer.WriteEndObject();
}
}
}
Loading

0 comments on commit 83d04d7

Please sign in to comment.