示例#1
0
 internal FlowLog(string id, string name, string type, string location, IDictionary <string, string> tags, string etag, string targetResourceId, string targetResourceGuid, string storageId, bool?enabled, RetentionPolicyParameters retentionPolicy, FlowLogFormatParameters format, TrafficAnalyticsProperties flowAnalyticsConfiguration, ProvisioningState?provisioningState) : base(id, name, type, location, tags)
 {
     Etag                       = etag;
     TargetResourceId           = targetResourceId;
     TargetResourceGuid         = targetResourceGuid;
     StorageId                  = storageId;
     Enabled                    = enabled;
     RetentionPolicy            = retentionPolicy;
     Format                     = format;
     FlowAnalyticsConfiguration = flowAnalyticsConfiguration;
     ProvisioningState          = provisioningState;
 }
示例#2
0
        internal static FlowLogInformation DeserializeFlowLogInformation(JsonElement element)
        {
            ResourceIdentifier 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 = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("flowAnalyticsConfiguration"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    flowAnalyticsConfiguration = TrafficAnalyticsProperties.DeserializeTrafficAnalyticsProperties(property.Value);
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    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"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            retentionPolicy = RetentionPolicyParameters.DeserializeRetentionPolicyParameters(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("format"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            format = FlowLogFormatParameters.DeserializeFlowLogFormatParameters(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new FlowLogInformation(targetResourceId, flowAnalyticsConfiguration.Value, storageId, enabled, retentionPolicy.Value, format.Value));
        }
示例#3
0
 internal FlowLogInformation(string targetResourceId, TrafficAnalyticsProperties flowAnalyticsConfiguration, string storageId, bool enabled, RetentionPolicyParameters retentionPolicy, FlowLogFormatParameters format)
 {
     TargetResourceId           = targetResourceId;
     FlowAnalyticsConfiguration = flowAnalyticsConfiguration;
     StorageId       = storageId;
     Enabled         = enabled;
     RetentionPolicy = retentionPolicy;
     Format          = format;
 }
        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"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    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"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    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"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enabled = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("retentionPolicy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            retentionPolicy = RetentionPolicyParameters.DeserializeRetentionPolicyParameters(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("format"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            format = FlowLogFormatParameters.DeserializeFlowLogFormatParameters(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("flowAnalyticsConfiguration"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            flowAnalyticsConfiguration = TrafficAnalyticsProperties.DeserializeTrafficAnalyticsProperties(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            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)));
        }