Пример #1
0
 internal LoadBalancerData(string id, string name, string type, string location, IDictionary <string, string> tags, ExtendedLocation extendedLocation, LoadBalancerSku sku, string etag, IList <FrontendIPConfiguration> frontendIPConfigurations, IList <BackendAddressPoolData> backendAddressPools, IList <LoadBalancingRule> loadBalancingRules, IList <Probe> probes, IList <InboundNatRuleData> inboundNatRules, IList <InboundNatPool> inboundNatPools, IList <OutboundRule> outboundRules, string resourceGuid, ProvisioningState?provisioningState) : base(id, name, type, location, tags)
 {
     ExtendedLocation = extendedLocation;
     Sku  = sku;
     Etag = etag;
     FrontendIPConfigurations = frontendIPConfigurations;
     BackendAddressPools      = backendAddressPools;
     LoadBalancingRules       = loadBalancingRules;
     Probes            = probes;
     InboundNatRules   = inboundNatRules;
     InboundNatPools   = inboundNatPools;
     OutboundRules     = outboundRules;
     ResourceGuid      = resourceGuid;
     ProvisioningState = provisioningState;
 }
Пример #2
0
 internal LoadBalancerData(ResourceIdentifier id, string name, ResourceType?resourceType, AzureLocation?location, IDictionary <string, string> tags, ExtendedLocation extendedLocation, LoadBalancerSku sku, ETag?etag, IList <FrontendIPConfigurationData> frontendIPConfigurations, IList <BackendAddressPoolData> backendAddressPools, IList <LoadBalancingRuleData> loadBalancingRules, IList <ProbeData> probes, IList <InboundNatRuleData> inboundNatRules, IList <InboundNatPool> inboundNatPools, IList <OutboundRuleData> outboundRules, Guid?resourceGuid, NetworkProvisioningState?provisioningState) : base(id, name, resourceType, location, tags)
 {
     ExtendedLocation = extendedLocation;
     Sku  = sku;
     Etag = etag;
     FrontendIPConfigurations = frontendIPConfigurations;
     BackendAddressPools      = backendAddressPools;
     LoadBalancingRules       = loadBalancingRules;
     Probes            = probes;
     InboundNatRules   = inboundNatRules;
     InboundNatPools   = inboundNatPools;
     OutboundRules     = outboundRules;
     ResourceGuid      = resourceGuid;
     ProvisioningState = provisioningState;
 }
Пример #3
0
        internal static LoadBalancerData DeserializeLoadBalancerData(JsonElement element)
        {
            Optional <ExtendedLocation> extendedLocation = default;
            Optional <LoadBalancerSku>  sku               = default;
            Optional <string>           etag              = default;
            Optional <string>           name              = default;
            Optional <string>           type              = default;
            Optional <string>           location          = default;
            Optional <IDictionary <string, string> > tags = default;
            ResourceIdentifier id = default;
            Optional <IList <FrontendIPConfiguration> > frontendIPConfigurations = default;
            Optional <IList <BackendAddressPoolData> >  backendAddressPools      = default;
            Optional <IList <LoadBalancingRule> >       loadBalancingRules       = default;
            Optional <IList <Probe> > probes = default;
            Optional <IList <InboundNatRuleData> > inboundNatRules = default;
            Optional <IList <InboundNatPool> >     inboundNatPools = default;
            Optional <IList <OutboundRule> >       outboundRules   = default;
            Optional <string>            resourceGuid      = default;
            Optional <ProvisioningState> provisioningState = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("extendedLocation"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    extendedLocation = ExtendedLocation.DeserializeExtendedLocation(property.Value);
                    continue;
                }
                if (property.NameEquals("sku"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    sku = LoadBalancerSku.DeserializeLoadBalancerSku(property.Value);
                    continue;
                }
                if (property.NameEquals("etag"))
                {
                    etag = 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("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("frontendIPConfigurations"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <FrontendIPConfiguration> array = new List <FrontendIPConfiguration>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(FrontendIPConfiguration.DeserializeFrontendIPConfiguration(item));
                            }
                            frontendIPConfigurations = array;
                            continue;
                        }
                        if (property0.NameEquals("backendAddressPools"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <BackendAddressPoolData> array = new List <BackendAddressPoolData>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(BackendAddressPoolData.DeserializeBackendAddressPoolData(item));
                            }
                            backendAddressPools = array;
                            continue;
                        }
                        if (property0.NameEquals("loadBalancingRules"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <LoadBalancingRule> array = new List <LoadBalancingRule>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(LoadBalancingRule.DeserializeLoadBalancingRule(item));
                            }
                            loadBalancingRules = array;
                            continue;
                        }
                        if (property0.NameEquals("probes"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <Probe> array = new List <Probe>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(Probe.DeserializeProbe(item));
                            }
                            probes = array;
                            continue;
                        }
                        if (property0.NameEquals("inboundNatRules"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <InboundNatRuleData> array = new List <InboundNatRuleData>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(InboundNatRuleData.DeserializeInboundNatRuleData(item));
                            }
                            inboundNatRules = array;
                            continue;
                        }
                        if (property0.NameEquals("inboundNatPools"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <InboundNatPool> array = new List <InboundNatPool>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(InboundNatPool.DeserializeInboundNatPool(item));
                            }
                            inboundNatPools = array;
                            continue;
                        }
                        if (property0.NameEquals("outboundRules"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <OutboundRule> array = new List <OutboundRule>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(OutboundRule.DeserializeOutboundRule(item));
                            }
                            outboundRules = array;
                            continue;
                        }
                        if (property0.NameEquals("resourceGuid"))
                        {
                            resourceGuid = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new LoadBalancerData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), extendedLocation.Value, sku.Value, etag.Value, Optional.ToList(frontendIPConfigurations), Optional.ToList(backendAddressPools), Optional.ToList(loadBalancingRules), Optional.ToList(probes), Optional.ToList(inboundNatRules), Optional.ToList(inboundNatPools), Optional.ToList(outboundRules), resourceGuid.Value, Optional.ToNullable(provisioningState)));
        }
 /// <summary>
 /// Converts the <see cref="sourceValue" /> parameter to the <see cref="destinationType" /> parameter using <see cref="formatProvider"
 /// /> and <see cref="ignoreCase" />
 /// </summary>
 /// <param name="sourceValue">the <see cref="System.Object"/> to convert from</param>
 /// <param name="destinationType">the <see cref="System.Type" /> to convert to</param>
 /// <param name="formatProvider">not used by this TypeConverter.</param>
 /// <param name="ignoreCase">when set to <c>true</c>, will ignore the case when converting.</param>
 /// <returns>
 /// an instance of <see cref="LoadBalancerSku" />, or <c>null</c> if there is no suitable conversion.
 /// </returns>
 public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => LoadBalancerSku.CreateFrom(sourceValue);