예제 #1
0
 internal AksSchemaProperties(string clusterFqdn, IReadOnlyList <SystemService> systemServices, int?agentCount, string agentVmSize, ClusterPurpose?clusterPurpose, SslConfiguration sslConfiguration, AksNetworkingConfiguration aksNetworkingConfiguration, LoadBalancerType?loadBalancerType, string loadBalancerSubnet)
 {
     ClusterFqdn                = clusterFqdn;
     SystemServices             = systemServices;
     AgentCount                 = agentCount;
     AgentVmSize                = agentVmSize;
     ClusterPurpose             = clusterPurpose;
     SslConfiguration           = sslConfiguration;
     AksNetworkingConfiguration = aksNetworkingConfiguration;
     LoadBalancerType           = loadBalancerType;
     LoadBalancerSubnet         = loadBalancerSubnet;
 }
예제 #2
0
        internal static AksSchemaProperties DeserializeAksSchemaProperties(JsonElement element)
        {
            Optional <string> clusterFqdn = default;
            Optional <IReadOnlyList <SystemService> > systemServices         = default;
            Optional <int>                        agentCount                 = default;
            Optional <string>                     agentVmSize                = default;
            Optional <ClusterPurpose>             clusterPurpose             = default;
            Optional <SslConfiguration>           sslConfiguration           = default;
            Optional <AksNetworkingConfiguration> aksNetworkingConfiguration = default;
            Optional <LoadBalancerType>           loadBalancerType           = default;
            Optional <string>                     loadBalancerSubnet         = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("clusterFqdn"))
                {
                    clusterFqdn = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("systemServices"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <SystemService> array = new List <SystemService>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(SystemService.DeserializeSystemService(item));
                    }
                    systemServices = array;
                    continue;
                }
                if (property.NameEquals("agentCount"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    agentCount = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("agentVmSize"))
                {
                    agentVmSize = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("clusterPurpose"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    clusterPurpose = new ClusterPurpose(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("sslConfiguration"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    sslConfiguration = SslConfiguration.DeserializeSslConfiguration(property.Value);
                    continue;
                }
                if (property.NameEquals("aksNetworkingConfiguration"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    aksNetworkingConfiguration = AksNetworkingConfiguration.DeserializeAksNetworkingConfiguration(property.Value);
                    continue;
                }
                if (property.NameEquals("loadBalancerType"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    loadBalancerType = new LoadBalancerType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("loadBalancerSubnet"))
                {
                    loadBalancerSubnet = property.Value.GetString();
                    continue;
                }
            }
            return(new AksSchemaProperties(clusterFqdn.Value, Optional.ToList(systemServices), Optional.ToNullable(agentCount), agentVmSize.Value, Optional.ToNullable(clusterPurpose), sslConfiguration.Value, aksNetworkingConfiguration.Value, Optional.ToNullable(loadBalancerType), loadBalancerSubnet.Value));
        }