Exemple #1
0
 internal CdnEndpointData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, string originPath, IList <string> contentTypesToCompress, string originHostHeader, bool?isCompressionEnabled, bool?isHttpAllowed, bool?isHttpsAllowed, QueryStringCachingBehavior?queryStringCachingBehavior, OptimizationType?optimizationType, string probePath, IList <GeoFilter> geoFilters, EndpointPropertiesUpdateParametersDefaultOriginGroup defaultOriginGroup, IList <UrlSigningKey> urlSigningKeys, EndpointPropertiesUpdateParametersDeliveryPolicy deliveryPolicy, EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink webApplicationFirewallPolicyLink, string hostName, IList <DeepCreatedOrigin> origins, IList <DeepCreatedOriginGroup> originGroups, EndpointResourceState?resourceState, string provisioningState) : base(id, name, resourceType, systemData, tags, location)
 {
     OriginPath                 = originPath;
     ContentTypesToCompress     = contentTypesToCompress;
     OriginHostHeader           = originHostHeader;
     IsCompressionEnabled       = isCompressionEnabled;
     IsHttpAllowed              = isHttpAllowed;
     IsHttpsAllowed             = isHttpsAllowed;
     QueryStringCachingBehavior = queryStringCachingBehavior;
     OptimizationType           = optimizationType;
     ProbePath          = probePath;
     GeoFilters         = geoFilters;
     DefaultOriginGroup = defaultOriginGroup;
     UrlSigningKeys     = urlSigningKeys;
     DeliveryPolicy     = deliveryPolicy;
     WebApplicationFirewallPolicyLink = webApplicationFirewallPolicyLink;
     HostName          = hostName;
     Origins           = origins;
     OriginGroups      = originGroups;
     ResourceState     = resourceState;
     ProvisioningState = provisioningState;
 }
Exemple #2
0
        internal static CdnEndpointData DeserializeCdnEndpointData(JsonElement element)
        {
            IDictionary <string, string> tags = default;
            AzureLocation                         location                   = default;
            ResourceIdentifier                    id                         = default;
            string                                name                       = default;
            ResourceType                          type                       = default;
            SystemData                            systemData                 = default;
            Optional <string>                     originPath                 = default;
            Optional <IList <string> >            contentTypesToCompress     = default;
            Optional <string>                     originHostHeader           = default;
            Optional <bool>                       isCompressionEnabled       = default;
            Optional <bool>                       isHttpAllowed              = default;
            Optional <bool>                       isHttpsAllowed             = default;
            Optional <QueryStringCachingBehavior> queryStringCachingBehavior = default;
            Optional <OptimizationType?>          optimizationType           = default;
            Optional <string>                     probePath                  = default;
            Optional <IList <GeoFilter> >         geoFilters                 = default;
            Optional <EndpointPropertiesUpdateParametersDefaultOriginGroup> defaultOriginGroup = default;
            Optional <IList <UriSigningKey> > urlSigningKeys = default;
            Optional <EndpointDeliveryPolicy> deliveryPolicy = default;
            Optional <EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink> webApplicationFirewallPolicyLink = default;
            Optional <string> hostName = default;
            Optional <IList <DeepCreatedOrigin> >           origins       = default;
            Optional <IList <DeepCreatedOriginGroup> >      originGroups  = default;
            Optional <IReadOnlyList <CdnCustomDomainData> > customDomains = default;
            Optional <EndpointResourceState>     resourceState            = default;
            Optional <EndpointProvisioningState> provisioningState        = default;

            foreach (var property in element.EnumerateObject())
            {
                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("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = new ResourceIdentifier(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("systemData"))
                {
                    systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("originPath"))
                        {
                            originPath = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("contentTypesToCompress"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <string> array = new List <string>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(item.GetString());
                            }
                            contentTypesToCompress = array;
                            continue;
                        }
                        if (property0.NameEquals("originHostHeader"))
                        {
                            originHostHeader = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("isCompressionEnabled"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            isCompressionEnabled = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("isHttpAllowed"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            isHttpAllowed = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("isHttpsAllowed"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            isHttpsAllowed = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("queryStringCachingBehavior"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            queryStringCachingBehavior = property0.Value.GetString().ToQueryStringCachingBehavior();
                            continue;
                        }
                        if (property0.NameEquals("optimizationType"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                optimizationType = null;
                                continue;
                            }
                            optimizationType = new OptimizationType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("probePath"))
                        {
                            probePath = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("geoFilters"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <GeoFilter> array = new List <GeoFilter>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(GeoFilter.DeserializeGeoFilter(item));
                            }
                            geoFilters = array;
                            continue;
                        }
                        if (property0.NameEquals("defaultOriginGroup"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                defaultOriginGroup = null;
                                continue;
                            }
                            defaultOriginGroup = EndpointPropertiesUpdateParametersDefaultOriginGroup.DeserializeEndpointPropertiesUpdateParametersDefaultOriginGroup(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("urlSigningKeys"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                urlSigningKeys = null;
                                continue;
                            }
                            List <UriSigningKey> array = new List <UriSigningKey>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(UriSigningKey.DeserializeUriSigningKey(item));
                            }
                            urlSigningKeys = array;
                            continue;
                        }
                        if (property0.NameEquals("deliveryPolicy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                deliveryPolicy = null;
                                continue;
                            }
                            deliveryPolicy = EndpointDeliveryPolicy.DeserializeEndpointDeliveryPolicy(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("webApplicationFirewallPolicyLink"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                webApplicationFirewallPolicyLink = null;
                                continue;
                            }
                            webApplicationFirewallPolicyLink = EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink.DeserializeEndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("hostName"))
                        {
                            hostName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("origins"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <DeepCreatedOrigin> array = new List <DeepCreatedOrigin>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(DeepCreatedOrigin.DeserializeDeepCreatedOrigin(item));
                            }
                            origins = array;
                            continue;
                        }
                        if (property0.NameEquals("originGroups"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <DeepCreatedOriginGroup> array = new List <DeepCreatedOriginGroup>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(DeepCreatedOriginGroup.DeserializeDeepCreatedOriginGroup(item));
                            }
                            originGroups = array;
                            continue;
                        }
                        if (property0.NameEquals("customDomains"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <CdnCustomDomainData> array = new List <CdnCustomDomainData>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(CdnCustomDomainData.DeserializeCdnCustomDomainData(item));
                            }
                            customDomains = array;
                            continue;
                        }
                        if (property0.NameEquals("resourceState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            resourceState = new EndpointResourceState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = new EndpointProvisioningState(property0.Value.GetString());
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new CdnEndpointData(id, name, type, systemData, tags, location, originPath.Value, Optional.ToList(contentTypesToCompress), originHostHeader.Value, Optional.ToNullable(isCompressionEnabled), Optional.ToNullable(isHttpAllowed), Optional.ToNullable(isHttpsAllowed), Optional.ToNullable(queryStringCachingBehavior), Optional.ToNullable(optimizationType), probePath.Value, Optional.ToList(geoFilters), defaultOriginGroup.Value, Optional.ToList(urlSigningKeys), deliveryPolicy.Value, webApplicationFirewallPolicyLink.Value, hostName.Value, Optional.ToList(origins), Optional.ToList(originGroups), Optional.ToList(customDomains), Optional.ToNullable(resourceState), Optional.ToNullable(provisioningState)));
        }