-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #128 from microsoft/sf_10_1
10_1 updates
- Loading branch information
Showing
15 changed files
with
342 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
...rviceFabric.Client.Http/Generated/Serialization/ServiceSensitivityDescriptionConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
// ------------------------------------------------------------ | ||
// 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="ServiceSensitivityDescription" />. | ||
/// </summary> | ||
internal class ServiceSensitivityDescriptionConverter | ||
{ | ||
/// <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 ServiceSensitivityDescription 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 ServiceSensitivityDescription GetFromJsonProperties(JsonReader reader) | ||
{ | ||
var primaryDefaultSensitivity = default(int?); | ||
var secondaryDefaultSensitivity = default(int?); | ||
var auxiliaryDefaultSensitivity = default(int?); | ||
var isMaximumSensitivity = default(bool?); | ||
|
||
do | ||
{ | ||
var propName = reader.ReadPropertyName(); | ||
if (string.Compare("PrimaryDefaultSensitivity", propName, StringComparison.OrdinalIgnoreCase) == 0) | ||
{ | ||
primaryDefaultSensitivity = reader.ReadValueAsInt(); | ||
} | ||
else if (string.Compare("SecondaryDefaultSensitivity", propName, StringComparison.OrdinalIgnoreCase) == 0) | ||
{ | ||
secondaryDefaultSensitivity = reader.ReadValueAsInt(); | ||
} | ||
else if (string.Compare("AuxiliaryDefaultSensitivity", propName, StringComparison.OrdinalIgnoreCase) == 0) | ||
{ | ||
auxiliaryDefaultSensitivity = reader.ReadValueAsInt(); | ||
} | ||
else if (string.Compare("IsMaximumSensitivity", propName, StringComparison.OrdinalIgnoreCase) == 0) | ||
{ | ||
isMaximumSensitivity = reader.ReadValueAsBool(); | ||
} | ||
else | ||
{ | ||
reader.SkipPropertyValue(); | ||
} | ||
} | ||
while (reader.TokenType != JsonToken.EndObject); | ||
|
||
return new ServiceSensitivityDescription( | ||
primaryDefaultSensitivity: primaryDefaultSensitivity, | ||
secondaryDefaultSensitivity: secondaryDefaultSensitivity, | ||
auxiliaryDefaultSensitivity: auxiliaryDefaultSensitivity, | ||
isMaximumSensitivity: isMaximumSensitivity); | ||
} | ||
|
||
/// <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, ServiceSensitivityDescription obj) | ||
{ | ||
// Required properties are always serialized, optional properties are serialized when not null. | ||
writer.WriteStartObject(); | ||
if (obj.PrimaryDefaultSensitivity != null) | ||
{ | ||
writer.WriteProperty(obj.PrimaryDefaultSensitivity, "PrimaryDefaultSensitivity", JsonWriterExtensions.WriteIntValue); | ||
} | ||
|
||
if (obj.SecondaryDefaultSensitivity != null) | ||
{ | ||
writer.WriteProperty(obj.SecondaryDefaultSensitivity, "SecondaryDefaultSensitivity", JsonWriterExtensions.WriteIntValue); | ||
} | ||
|
||
if (obj.AuxiliaryDefaultSensitivity != null) | ||
{ | ||
writer.WriteProperty(obj.AuxiliaryDefaultSensitivity, "AuxiliaryDefaultSensitivity", JsonWriterExtensions.WriteIntValue); | ||
} | ||
|
||
if (obj.IsMaximumSensitivity != null) | ||
{ | ||
writer.WriteProperty(obj.IsMaximumSensitivity, "IsMaximumSensitivity", JsonWriterExtensions.WriteBoolValue); | ||
} | ||
|
||
writer.WriteEndObject(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/Microsoft.ServiceFabric.Common/Generated/ServiceSensitivityDescription.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// ------------------------------------------------------------ | ||
// 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.Common | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
/// <summary> | ||
/// Describes sensitivities for different types of replicas. | ||
/// </summary> | ||
public partial class ServiceSensitivityDescription | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the ServiceSensitivityDescription class. | ||
/// </summary> | ||
/// <param name="primaryDefaultSensitivity">Default sensitivity for a primary replica.</param> | ||
/// <param name="secondaryDefaultSensitivity">Default sensitivity for a secondary replica.</param> | ||
/// <param name="auxiliaryDefaultSensitivity">Default sensitivity for an auxiliary replica.</param> | ||
/// <param name="isMaximumSensitivity">Denotes whether the sensitivities should be set to maximum. If true, other | ||
/// values are ignored.</param> | ||
public ServiceSensitivityDescription( | ||
int? primaryDefaultSensitivity = default(int?), | ||
int? secondaryDefaultSensitivity = default(int?), | ||
int? auxiliaryDefaultSensitivity = default(int?), | ||
bool? isMaximumSensitivity = default(bool?)) | ||
{ | ||
this.PrimaryDefaultSensitivity = primaryDefaultSensitivity; | ||
this.SecondaryDefaultSensitivity = secondaryDefaultSensitivity; | ||
this.AuxiliaryDefaultSensitivity = auxiliaryDefaultSensitivity; | ||
this.IsMaximumSensitivity = isMaximumSensitivity; | ||
} | ||
|
||
/// <summary> | ||
/// Gets default sensitivity for a primary replica. | ||
/// </summary> | ||
public int? PrimaryDefaultSensitivity { get; } | ||
|
||
/// <summary> | ||
/// Gets default sensitivity for a secondary replica. | ||
/// </summary> | ||
public int? SecondaryDefaultSensitivity { get; } | ||
|
||
/// <summary> | ||
/// Gets default sensitivity for an auxiliary replica. | ||
/// </summary> | ||
public int? AuxiliaryDefaultSensitivity { get; } | ||
|
||
/// <summary> | ||
/// Gets denotes whether the sensitivities should be set to maximum. If true, other values are ignored. | ||
/// </summary> | ||
public bool? IsMaximumSensitivity { get; } | ||
} | ||
} |
Oops, something went wrong.