/// <summary>
        /// Serializes this instance of <see cref="UserAssignedIdentityProperties" /> into a <see cref="Microsoft.Azure.PowerShell.Cmdlets.ManagedServiceIdentity.Runtime.Json.JsonNode" />.
        /// </summary>
        /// <param name="container">The <see cref="Microsoft.Azure.PowerShell.Cmdlets.ManagedServiceIdentity.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.ManagedServiceIdentity.Runtime.SerializationMode"/>.</param>
        /// <returns>
        /// a serialized instance of <see cref="UserAssignedIdentityProperties" /> as a <see cref="Microsoft.Azure.PowerShell.Cmdlets.ManagedServiceIdentity.Runtime.Json.JsonNode" />.
        /// </returns>
        public Microsoft.Azure.PowerShell.Cmdlets.ManagedServiceIdentity.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ManagedServiceIdentity.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ManagedServiceIdentity.Runtime.SerializationMode serializationMode)
        {
            container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ManagedServiceIdentity.Runtime.Json.JsonObject();

            bool returnNow = false;

            BeforeToJson(ref container, ref returnNow);
            if (returnNow)
            {
                return(container);
            }
            if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.ManagedServiceIdentity.Runtime.SerializationMode.IncludeReadOnly))
            {
                AddIf(null != (((object)this._tenantId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ManagedServiceIdentity.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ManagedServiceIdentity.Runtime.Json.JsonString(this._tenantId.ToString()) : null, "tenantId", container.Add);
            }
            if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.ManagedServiceIdentity.Runtime.SerializationMode.IncludeReadOnly))
            {
                AddIf(null != (((object)this._principalId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ManagedServiceIdentity.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ManagedServiceIdentity.Runtime.Json.JsonString(this._principalId.ToString()) : null, "principalId", container.Add);
            }
            if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.ManagedServiceIdentity.Runtime.SerializationMode.IncludeReadOnly))
            {
                AddIf(null != (((object)this._clientId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ManagedServiceIdentity.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ManagedServiceIdentity.Runtime.Json.JsonString(this._clientId.ToString()) : null, "clientId", container.Add);
            }
            AfterToJson(ref container);
            return(container);
        }
예제 #2
0
        /// <summary>
        /// Serializes this instance of <see cref="Identity" /> into a <see cref="Microsoft.Azure.PowerShell.Cmdlets.ManagedServiceIdentity.Runtime.Json.JsonNode" />.
        /// </summary>
        /// <param name="container">The <see cref="Microsoft.Azure.PowerShell.Cmdlets.ManagedServiceIdentity.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.ManagedServiceIdentity.Runtime.SerializationMode"/>.</param>
        /// <returns>
        /// a serialized instance of <see cref="Identity" /> as a <see cref="Microsoft.Azure.PowerShell.Cmdlets.ManagedServiceIdentity.Runtime.Json.JsonNode" />.
        /// </returns>
        public Microsoft.Azure.PowerShell.Cmdlets.ManagedServiceIdentity.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ManagedServiceIdentity.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ManagedServiceIdentity.Runtime.SerializationMode serializationMode)
        {
            container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ManagedServiceIdentity.Runtime.Json.JsonObject();

            bool returnNow = false;

            BeforeToJson(ref container, ref returnNow);
            if (returnNow)
            {
                return(container);
            }
            __trackedResource?.ToJson(container, serializationMode);
            if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.ManagedServiceIdentity.Runtime.SerializationMode.IncludeReadOnly))
            {
                AddIf(null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.ManagedServiceIdentity.Runtime.Json.JsonNode) this._property.ToJson(null, serializationMode) : null, "properties", container.Add);
            }
            AfterToJson(ref container);
            return(container);
        }