Esempio n. 1
0
 internal ConfigurationServiceProperties(ConfigurationServiceProvisioningState?provisioningState, ConfigurationServiceResourceRequests resourceRequests, IReadOnlyList <ConfigurationServiceInstance> instances, ConfigurationServiceSettings settings)
 {
     ProvisioningState = provisioningState;
     ResourceRequests  = resourceRequests;
     Instances         = instances;
     Settings          = settings;
 }
Esempio n. 2
0
        internal static ConfigurationServiceProperties DeserializeConfigurationServiceProperties(JsonElement element)
        {
            Optional <ConfigurationServiceProvisioningState>         provisioningState = default;
            Optional <ConfigurationServiceResourceRequests>          resourceRequests  = default;
            Optional <IReadOnlyList <ConfigurationServiceInstance> > instances         = default;
            Optional <ConfigurationServiceSettings> settings = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("provisioningState"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    provisioningState = new ConfigurationServiceProvisioningState(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("resourceRequests"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    resourceRequests = ConfigurationServiceResourceRequests.DeserializeConfigurationServiceResourceRequests(property.Value);
                    continue;
                }
                if (property.NameEquals("instances"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <ConfigurationServiceInstance> array = new List <ConfigurationServiceInstance>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ConfigurationServiceInstance.DeserializeConfigurationServiceInstance(item));
                    }
                    instances = array;
                    continue;
                }
                if (property.NameEquals("settings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    settings = ConfigurationServiceSettings.DeserializeConfigurationServiceSettings(property.Value);
                    continue;
                }
            }
            return(new ConfigurationServiceProperties(Optional.ToNullable(provisioningState), resourceRequests.Value, Optional.ToList(instances), settings.Value));
        }