/src/SpringCloud/generated/api/Models/Api20190501Preview/GitPatternRepository.json.cs

https://github.com/Azure/azure-powershell · C# · 137 lines · 75 code · 13 blank · 49 comment · 17 complexity · 1dd13b9d36a43d38cf35e16d5ba8b4b1 MD5 · raw file

  1. namespace Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Models.Api20190501Preview
  2. {
  3. using static Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Extensions;
  4. /// <summary>Git repository property payload</summary>
  5. public partial class GitPatternRepository
  6. {
  7. /// <summary>
  8. /// <c>AfterFromJson</c> will be called after the json deserialization has finished, allowing customization of the object
  9. /// before it is returned. Implement this method in a partial class to enable this behavior
  10. /// </summary>
  11. /// <param name="json">The JsonNode that should be deserialized into this object.</param>
  12. partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonObject json);
  13. /// <summary>
  14. /// <c>AfterToJson</c> will be called after the json erialization has finished, allowing customization of the <see cref="Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonObject"
  15. /// /> before it is returned. Implement this method in a partial class to enable this behavior
  16. /// </summary>
  17. /// <param name="container">The JSON container that the serialization result will be placed in.</param>
  18. partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonObject container);
  19. /// <summary>
  20. /// <c>BeforeFromJson</c> will be called before the json deserialization has commenced, allowing complete customization of
  21. /// the object before it is deserialized.
  22. /// If you wish to disable the default deserialization entirely, return <c>true</c> in the <see "returnNow" /> output parameter.
  23. /// Implement this method in a partial class to enable this behavior.
  24. /// </summary>
  25. /// <param name="json">The JsonNode that should be deserialized into this object.</param>
  26. /// <param name="returnNow">Determines if the rest of the deserialization should be processed, or if the method should return
  27. /// instantly.</param>
  28. partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonObject json, ref bool returnNow);
  29. /// <summary>
  30. /// <c>BeforeToJson</c> will be called before the json serialization has commenced, allowing complete customization of the
  31. /// object before it is serialized.
  32. /// If you wish to disable the default serialization entirely, return <c>true</c> in the <see "returnNow" /> output parameter.
  33. /// Implement this method in a partial class to enable this behavior.
  34. /// </summary>
  35. /// <param name="container">The JSON container that the serialization result will be placed in.</param>
  36. /// <param name="returnNow">Determines if the rest of the serialization should be processed, or if the method should return
  37. /// instantly.</param>
  38. partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonObject container, ref bool returnNow);
  39. /// <summary>
  40. /// Deserializes a <see cref="Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonNode"/> into an instance of Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Models.Api20190501Preview.IGitPatternRepository.
  41. /// </summary>
  42. /// <param name="node">a <see cref="Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonNode" /> to deserialize from.</param>
  43. /// <returns>
  44. /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Models.Api20190501Preview.IGitPatternRepository.
  45. /// </returns>
  46. public static Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Models.Api20190501Preview.IGitPatternRepository FromJson(Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonNode node)
  47. {
  48. return node is Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonObject json ? new GitPatternRepository(json) : null;
  49. }
  50. /// <summary>
  51. /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonObject into a new instance of <see cref="GitPatternRepository" />.
  52. /// </summary>
  53. /// <param name="json">A Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonObject instance to deserialize from.</param>
  54. internal GitPatternRepository(Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonObject json)
  55. {
  56. bool returnNow = false;
  57. BeforeFromJson(json, ref returnNow);
  58. if (returnNow)
  59. {
  60. return;
  61. }
  62. {_name = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonString>("name"), out var __jsonName) ? (string)__jsonName : (string)Name;}
  63. {_hostKey = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonString>("hostKey"), out var __jsonHostKey) ? (string)__jsonHostKey : (string)HostKey;}
  64. {_hostKeyAlgorithm = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonString>("hostKeyAlgorithm"), out var __jsonHostKeyAlgorithm) ? (string)__jsonHostKeyAlgorithm : (string)HostKeyAlgorithm;}
  65. {_label = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonString>("label"), out var __jsonLabel) ? (string)__jsonLabel : (string)Label;}
  66. {_password = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonString>("password"), out var __jsonPassword) ? (string)__jsonPassword : (string)Password;}
  67. {_pattern = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonArray>("pattern"), out var __jsonPattern) ? If( __jsonPattern as Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonArray, out var __v) ? new global::System.Func<string[]>(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : Pattern;}
  68. {_privateKey = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonString>("privateKey"), out var __jsonPrivateKey) ? (string)__jsonPrivateKey : (string)PrivateKey;}
  69. {_searchPath = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonArray>("searchPaths"), out var __jsonSearchPaths) ? If( __jsonSearchPaths as Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonArray, out var __q) ? new global::System.Func<string[]>(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(string) (__p is Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonString __o ? (string)(__o.ToString()) : null)) ))() : null : SearchPath;}
  70. {_strictHostKeyChecking = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonBoolean>("strictHostKeyChecking"), out var __jsonStrictHostKeyChecking) ? (bool?)__jsonStrictHostKeyChecking : StrictHostKeyChecking;}
  71. {_uri = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonString>("uri"), out var __jsonUri) ? (string)__jsonUri : (string)Uri;}
  72. {_username = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonString>("username"), out var __jsonUsername) ? (string)__jsonUsername : (string)Username;}
  73. AfterFromJson(json);
  74. }
  75. /// <summary>
  76. /// Serializes this instance of <see cref="GitPatternRepository" /> into a <see cref="Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonNode" />.
  77. /// </summary>
  78. /// <param name="container">The <see cref="Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonObject"/> container to serialize this object into. If the caller
  79. /// passes in <c>null</c>, a new instance will be created and returned to the caller.</param>
  80. /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.SerializationMode"/>.</param>
  81. /// <returns>
  82. /// a serialized instance of <see cref="GitPatternRepository" /> as a <see cref="Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonNode" />.
  83. /// </returns>
  84. public Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.SerializationMode serializationMode)
  85. {
  86. container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonObject();
  87. bool returnNow = false;
  88. BeforeToJson(ref container, ref returnNow);
  89. if (returnNow)
  90. {
  91. return container;
  92. }
  93. AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add );
  94. AddIf( null != (((object)this._hostKey)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonString(this._hostKey.ToString()) : null, "hostKey" ,container.Add );
  95. AddIf( null != (((object)this._hostKeyAlgorithm)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonString(this._hostKeyAlgorithm.ToString()) : null, "hostKeyAlgorithm" ,container.Add );
  96. AddIf( null != (((object)this._label)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonString(this._label.ToString()) : null, "label" ,container.Add );
  97. AddIf( null != (((object)this._password)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonString(this._password.ToString()) : null, "password" ,container.Add );
  98. if (null != this._pattern)
  99. {
  100. var __w = new Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.XNodeArray();
  101. foreach( var __x in this._pattern )
  102. {
  103. AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add);
  104. }
  105. container.Add("pattern",__w);
  106. }
  107. AddIf( null != (((object)this._privateKey)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonString(this._privateKey.ToString()) : null, "privateKey" ,container.Add );
  108. if (null != this._searchPath)
  109. {
  110. var __r = new Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.XNodeArray();
  111. foreach( var __s in this._searchPath )
  112. {
  113. AddIf(null != (((object)__s)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonString(__s.ToString()) : null ,__r.Add);
  114. }
  115. container.Add("searchPaths",__r);
  116. }
  117. AddIf( null != this._strictHostKeyChecking ? (Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonBoolean((bool)this._strictHostKeyChecking) : null, "strictHostKeyChecking" ,container.Add );
  118. AddIf( null != (((object)this._uri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonString(this._uri.ToString()) : null, "uri" ,container.Add );
  119. AddIf( null != (((object)this._username)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonString(this._username.ToString()) : null, "username" ,container.Add );
  120. AfterToJson(ref container);
  121. return container;
  122. }
  123. }
  124. }