/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
- namespace Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Models.Api20190501Preview
- {
- using static Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Extensions;
-
- /// <summary>Git repository property payload</summary>
- public partial class GitPatternRepository
- {
-
- /// <summary>
- /// <c>AfterFromJson</c> will be called after the json deserialization has finished, allowing customization of the object
- /// before it is returned. Implement this method in a partial class to enable this behavior
- /// </summary>
- /// <param name="json">The JsonNode that should be deserialized into this object.</param>
-
- partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonObject json);
-
- /// <summary>
- /// <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"
- /// /> before it is returned. Implement this method in a partial class to enable this behavior
- /// </summary>
- /// <param name="container">The JSON container that the serialization result will be placed in.</param>
-
- partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonObject container);
-
- /// <summary>
- /// <c>BeforeFromJson</c> will be called before the json deserialization has commenced, allowing complete customization of
- /// the object before it is deserialized.
- /// If you wish to disable the default deserialization entirely, return <c>true</c> in the <see "returnNow" /> output parameter.
- /// Implement this method in a partial class to enable this behavior.
- /// </summary>
- /// <param name="json">The JsonNode that should be deserialized into this object.</param>
- /// <param name="returnNow">Determines if the rest of the deserialization should be processed, or if the method should return
- /// instantly.</param>
-
- partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonObject json, ref bool returnNow);
-
- /// <summary>
- /// <c>BeforeToJson</c> will be called before the json serialization has commenced, allowing complete customization of the
- /// object before it is serialized.
- /// If you wish to disable the default serialization entirely, return <c>true</c> in the <see "returnNow" /> output parameter.
- /// Implement this method in a partial class to enable this behavior.
- /// </summary>
- /// <param name="container">The JSON container that the serialization result will be placed in.</param>
- /// <param name="returnNow">Determines if the rest of the serialization should be processed, or if the method should return
- /// instantly.</param>
-
- partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonObject container, ref bool returnNow);
-
- /// <summary>
- /// Deserializes a <see cref="Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonNode"/> into an instance of Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Models.Api20190501Preview.IGitPatternRepository.
- /// </summary>
- /// <param name="node">a <see cref="Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonNode" /> to deserialize from.</param>
- /// <returns>
- /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Models.Api20190501Preview.IGitPatternRepository.
- /// </returns>
- public static Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Models.Api20190501Preview.IGitPatternRepository FromJson(Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonNode node)
- {
- return node is Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonObject json ? new GitPatternRepository(json) : null;
- }
-
- /// <summary>
- /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonObject into a new instance of <see cref="GitPatternRepository" />.
- /// </summary>
- /// <param name="json">A Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonObject instance to deserialize from.</param>
- internal GitPatternRepository(Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonObject json)
- {
- bool returnNow = false;
- BeforeFromJson(json, ref returnNow);
- if (returnNow)
- {
- return;
- }
- {_name = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonString>("name"), out var __jsonName) ? (string)__jsonName : (string)Name;}
- {_hostKey = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonString>("hostKey"), out var __jsonHostKey) ? (string)__jsonHostKey : (string)HostKey;}
- {_hostKeyAlgorithm = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonString>("hostKeyAlgorithm"), out var __jsonHostKeyAlgorithm) ? (string)__jsonHostKeyAlgorithm : (string)HostKeyAlgorithm;}
- {_label = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonString>("label"), out var __jsonLabel) ? (string)__jsonLabel : (string)Label;}
- {_password = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonString>("password"), out var __jsonPassword) ? (string)__jsonPassword : (string)Password;}
- {_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;}
- {_privateKey = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonString>("privateKey"), out var __jsonPrivateKey) ? (string)__jsonPrivateKey : (string)PrivateKey;}
- {_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;}
- {_strictHostKeyChecking = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonBoolean>("strictHostKeyChecking"), out var __jsonStrictHostKeyChecking) ? (bool?)__jsonStrictHostKeyChecking : StrictHostKeyChecking;}
- {_uri = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonString>("uri"), out var __jsonUri) ? (string)__jsonUri : (string)Uri;}
- {_username = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonString>("username"), out var __jsonUsername) ? (string)__jsonUsername : (string)Username;}
- AfterFromJson(json);
- }
-
- /// <summary>
- /// Serializes this instance of <see cref="GitPatternRepository" /> into a <see cref="Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonNode" />.
- /// </summary>
- /// <param name="container">The <see cref="Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonObject"/> container to serialize this object into. If the caller
- /// passes in <c>null</c>, a new instance will be created and returned to the caller.</param>
- /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.SerializationMode"/>.</param>
- /// <returns>
- /// a serialized instance of <see cref="GitPatternRepository" /> as a <see cref="Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonNode" />.
- /// </returns>
- 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)
- {
- container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.JsonObject();
-
- bool returnNow = false;
- BeforeToJson(ref container, ref returnNow);
- if (returnNow)
- {
- return container;
- }
- 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 );
- 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 );
- 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 );
- 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 );
- 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 );
- if (null != this._pattern)
- {
- var __w = new Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.XNodeArray();
- foreach( var __x in this._pattern )
- {
- 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);
- }
- container.Add("pattern",__w);
- }
- 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 );
- if (null != this._searchPath)
- {
- var __r = new Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Json.XNodeArray();
- foreach( var __s in this._searchPath )
- {
- 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);
- }
- container.Add("searchPaths",__r);
- }
- 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 );
- 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 );
- 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 );
- AfterToJson(ref container);
- return container;
- }
- }
- }