Example #1
0
        internal static FlowLogInformation DeserializeFlowLogInformation(JsonElement element)
        {
            string targetResourceId = default;
            Optional <TrafficAnalyticsProperties> flowAnalyticsConfiguration = default;
            string storageId = default;
            bool   enabled   = default;
            Optional <RetentionPolicyParameters> retentionPolicy = default;
            Optional <FlowLogFormatParameters>   format          = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("targetResourceId"))
                {
                    targetResourceId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("flowAnalyticsConfiguration"))
                {
                    flowAnalyticsConfiguration = TrafficAnalyticsProperties.DeserializeTrafficAnalyticsProperties(property.Value);
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("storageId"))
                        {
                            storageId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("enabled"))
                        {
                            enabled = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("retentionPolicy"))
                        {
                            retentionPolicy = RetentionPolicyParameters.DeserializeRetentionPolicyParameters(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("format"))
                        {
                            format = FlowLogFormatParameters.DeserializeFlowLogFormatParameters(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new FlowLogInformation(targetResourceId, flowAnalyticsConfiguration.Value, storageId, enabled, retentionPolicy.Value, format.Value));
        }
Example #2
0
        internal static FlowLog DeserializeFlowLog(JsonElement element)
        {
            Optional <string> etag     = default;
            Optional <string> id       = default;
            Optional <string> name     = default;
            Optional <string> type     = default;
            Optional <string> location = default;
            Optional <IDictionary <string, string> > tags = default;
            Optional <string> targetResourceId            = default;
            Optional <string> targetResourceGuid          = default;
            Optional <string> storageId = default;
            Optional <bool>   enabled   = default;
            Optional <RetentionPolicyParameters>  retentionPolicy            = default;
            Optional <FlowLogFormatParameters>    format                     = default;
            Optional <TrafficAnalyticsProperties> flowAnalyticsConfiguration = default;
            Optional <ProvisioningState>          provisioningState          = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("etag"))
                {
                    etag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("targetResourceId"))
                        {
                            targetResourceId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("targetResourceGuid"))
                        {
                            targetResourceGuid = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("storageId"))
                        {
                            storageId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("enabled"))
                        {
                            enabled = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("retentionPolicy"))
                        {
                            retentionPolicy = RetentionPolicyParameters.DeserializeRetentionPolicyParameters(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("format"))
                        {
                            format = FlowLogFormatParameters.DeserializeFlowLogFormatParameters(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("flowAnalyticsConfiguration"))
                        {
                            flowAnalyticsConfiguration = TrafficAnalyticsProperties.DeserializeTrafficAnalyticsProperties(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new FlowLog(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, targetResourceId.Value, targetResourceGuid.Value, storageId.Value, Optional.ToNullable(enabled), retentionPolicy.Value, format.Value, flowAnalyticsConfiguration.Value, Optional.ToNullable(provisioningState)));
        }
        internal static FlowLog DeserializeFlowLog(JsonElement element)
        {
            string etag     = default;
            string id       = default;
            string name     = default;
            string type     = default;
            string location = default;
            IDictionary <string, string> tags = default;
            string targetResourceId           = default;
            string targetResourceGuid         = default;
            string storageId = default;
            bool?  enabled   = default;
            RetentionPolicyParameters  retentionPolicy            = default;
            FlowLogFormatParameters    format                     = default;
            TrafficAnalyticsProperties flowAnalyticsConfiguration = default;
            ProvisioningState?         provisioningState          = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("etag"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    etag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.Value.ValueKind == JsonValueKind.Null)
                        {
                            dictionary.Add(property0.Name, null);
                        }
                        else
                        {
                            dictionary.Add(property0.Name, property0.Value.GetString());
                        }
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("targetResourceId"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            targetResourceId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("targetResourceGuid"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            targetResourceGuid = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("storageId"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            storageId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("enabled"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            enabled = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("retentionPolicy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            retentionPolicy = RetentionPolicyParameters.DeserializeRetentionPolicyParameters(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("format"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            format = FlowLogFormatParameters.DeserializeFlowLogFormatParameters(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("flowAnalyticsConfiguration"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            flowAnalyticsConfiguration = TrafficAnalyticsProperties.DeserializeTrafficAnalyticsProperties(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new FlowLog(id, name, type, location, tags, etag, targetResourceId, targetResourceGuid, storageId, enabled, retentionPolicy, format, flowAnalyticsConfiguration, provisioningState));
        }