/// <summary> /// Serializes this instance of <see cref="Resource" /> into a <see cref="Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode" />. /// </summary> /// <param name="container">The <see cref="Microsoft.Azure.PowerShell.Cmdlets.BareMetal.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.BareMetal.Runtime.SerializationMode"/>.</param> /// <returns> /// a serialized instance of <see cref="Resource" /> as a <see cref="Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode" />. /// </returns> public Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.SerializationMode serializationMode) { container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonObject(); bool returnNow = false; BeforeToJson(ref container, ref returnNow); if (returnNow) { return(container); } if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.SerializationMode.IncludeReadOnly)) { AddIf(null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonString(this._id.ToString()) : null, "id", container.Add); } if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.SerializationMode.IncludeReadOnly)) { AddIf(null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonString(this._name.ToString()) : null, "name", container.Add); } if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.SerializationMode.IncludeReadOnly)) { AddIf(null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonString(this._type.ToString()) : null, "type", container.Add); } AfterToJson(ref container); return(container); }
/// <summary> /// Serializes this instance of <see cref="Display" /> into a <see cref="Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode" />. /// </summary> /// <param name="container">The <see cref="Microsoft.Azure.PowerShell.Cmdlets.BareMetal.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.BareMetal.Runtime.SerializationMode"/>.</param> /// <returns> /// a serialized instance of <see cref="Display" /> as a <see cref="Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode" />. /// </returns> public Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.SerializationMode serializationMode) { container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonObject(); bool returnNow = false; BeforeToJson(ref container, ref returnNow); if (returnNow) { return(container); } if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.SerializationMode.IncludeReadOnly)) { AddIf(null != (((object)this._provider)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonString(this._provider.ToString()) : null, "provider", container.Add); } if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.SerializationMode.IncludeReadOnly)) { AddIf(null != (((object)this._resource)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonString(this._resource.ToString()) : null, "resource", container.Add); } if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.SerializationMode.IncludeReadOnly)) { AddIf(null != (((object)this._operation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonString(this._operation.ToString()) : null, "operation", container.Add); } if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.SerializationMode.IncludeReadOnly)) { AddIf(null != (((object)this._description)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonString(this._description.ToString()) : null, "description", container.Add); } AfterToJson(ref container); return(container); }
/// <summary> /// Serializes this instance of <see cref="ErrorDefinition" /> into a <see cref="Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode" />. /// </summary> /// <param name="container">The <see cref="Microsoft.Azure.PowerShell.Cmdlets.BareMetal.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.BareMetal.Runtime.SerializationMode"/>.</param> /// <returns> /// a serialized instance of <see cref="ErrorDefinition" /> as a <see cref="Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode" />. /// </returns> public Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.SerializationMode serializationMode) { container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonObject(); bool returnNow = false; BeforeToJson(ref container, ref returnNow); if (returnNow) { return(container); } if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.SerializationMode.IncludeReadOnly)) { AddIf(null != (((object)this._code)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonString(this._code.ToString()) : null, "code", container.Add); } if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.SerializationMode.IncludeReadOnly)) { AddIf(null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonString(this._message.ToString()) : null, "message", container.Add); } if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.SerializationMode.IncludeReadOnly)) { if (null != this._detail) { var __w = new Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.XNodeArray(); foreach (var __x in this._detail) { AddIf(__x?.ToJson(null, serializationMode), __w.Add); } container.Add("details", __w); } } AfterToJson(ref container); return(container); }
/// <summary> /// Serializes this instance of <see cref="AzureBareMetalInstanceProperties" /> into a <see cref="Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode" />. /// </summary> /// <param name="container">The <see cref="Microsoft.Azure.PowerShell.Cmdlets.BareMetal.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.BareMetal.Runtime.SerializationMode"/>.</param> /// <returns> /// a serialized instance of <see cref="AzureBareMetalInstanceProperties" /> as a <see cref="Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode" />. /// </returns> public Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.SerializationMode serializationMode) { container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonObject(); bool returnNow = false; BeforeToJson(ref container, ref returnNow); if (returnNow) { return(container); } AddIf(null != this._hardwareProfile ? (Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode) this._hardwareProfile.ToJson(null, serializationMode) : null, "hardwareProfile", container.Add); AddIf(null != this._storageProfile ? (Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode) this._storageProfile.ToJson(null, serializationMode) : null, "storageProfile", container.Add); AddIf(null != this._oSProfile ? (Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode) this._oSProfile.ToJson(null, serializationMode) : null, "osProfile", container.Add); AddIf(null != this._networkProfile ? (Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode) this._networkProfile.ToJson(null, serializationMode) : null, "networkProfile", container.Add); if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.SerializationMode.IncludeReadOnly)) { AddIf(null != (((object)this._azureBareMetalInstanceId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonString(this._azureBareMetalInstanceId.ToString()) : null, "azureBareMetalInstanceId", container.Add); } if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.SerializationMode.IncludeReadOnly)) { AddIf(null != (((object)this._powerState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonString(this._powerState.ToString()) : null, "powerState", container.Add); } if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.SerializationMode.IncludeReadOnly)) { AddIf(null != (((object)this._proximityPlacementGroup)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonString(this._proximityPlacementGroup.ToString()) : null, "proximityPlacementGroup", container.Add); } if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.SerializationMode.IncludeReadOnly)) { AddIf(null != (((object)this._hwRevision)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonString(this._hwRevision.ToString()) : null, "hwRevision", container.Add); } AddIf(null != (((object)this._partnerNodeId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonString(this._partnerNodeId.ToString()) : null, "partnerNodeId", container.Add); if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.SerializationMode.IncludeReadOnly)) { AddIf(null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState", container.Add); } AfterToJson(ref container); return(container); }
/// <summary> /// Serializes this instance of <see cref="OSProfile" /> into a <see cref="Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode" />. /// </summary> /// <param name="container">The <see cref="Microsoft.Azure.PowerShell.Cmdlets.BareMetal.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.BareMetal.Runtime.SerializationMode"/>.</param> /// <returns> /// a serialized instance of <see cref="OSProfile" /> as a <see cref="Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode" />. /// </returns> public Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.SerializationMode serializationMode) { container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonObject(); bool returnNow = false; BeforeToJson(ref container, ref returnNow); if (returnNow) { return(container); } AddIf(null != (((object)this._computerName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonString(this._computerName.ToString()) : null, "computerName", container.Add); if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.SerializationMode.IncludeReadOnly)) { AddIf(null != (((object)this._oSType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonString(this._oSType.ToString()) : null, "osType", container.Add); } if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.SerializationMode.IncludeReadOnly)) { AddIf(null != (((object)this._version)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonString(this._version.ToString()) : null, "version", container.Add); } AddIf(null != (((object)this._sshPublicKey)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonString(this._sshPublicKey.ToString()) : null, "sshPublicKey", container.Add); AfterToJson(ref container); return(container); }
/// <summary> /// Serializes this instance of <see cref="AzureBareMetalInstance" /> into a <see cref="Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode" />. /// </summary> /// <param name="container">The <see cref="Microsoft.Azure.PowerShell.Cmdlets.BareMetal.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.BareMetal.Runtime.SerializationMode"/>.</param> /// <returns> /// a serialized instance of <see cref="AzureBareMetalInstance" /> as a <see cref="Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode" />. /// </returns> public Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.SerializationMode serializationMode) { container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonObject(); bool returnNow = false; BeforeToJson(ref container, ref returnNow); if (returnNow) { return(container); } __trackedResource?.ToJson(container, serializationMode); AddIf(null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode) this._property.ToJson(null, serializationMode) : null, "properties", container.Add); if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.SerializationMode.IncludeReadOnly)) { AddIf(null != this._systemData ? (Microsoft.Azure.PowerShell.Cmdlets.BareMetal.Runtime.Json.JsonNode) this._systemData.ToJson(null, serializationMode) : null, "systemData", container.Add); } AfterToJson(ref container); return(container); }