Beispiel #1
0
 internal DeploymentSettings(ResourceRequests resourceRequests, IDictionary <string, string> environmentVariables, IDictionary <string, IDictionary <string, BinaryData> > addonConfigs, ContainerProbeSettings containerProbeSettings)
 {
     ResourceRequests       = resourceRequests;
     EnvironmentVariables   = environmentVariables;
     AddonConfigs           = addonConfigs;
     ContainerProbeSettings = containerProbeSettings;
 }
Beispiel #2
0
        internal static DeploymentSettings DeserializeDeploymentSettings(JsonElement element)
        {
            Optional <ResourceRequests> resourceRequests = default;
            Optional <IDictionary <string, string> > environmentVariables = default;
            Optional <IDictionary <string, IDictionary <string, BinaryData> > > addonConfigs = default;
            Optional <ContainerProbeSettings> containerProbeSettings = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("resourceRequests"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    resourceRequests = ResourceRequests.DeserializeResourceRequests(property.Value);
                    continue;
                }
                if (property.NameEquals("environmentVariables"))
                {
                    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());
                    }
                    environmentVariables = dictionary;
                    continue;
                }
                if (property.NameEquals("addonConfigs"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    Dictionary <string, IDictionary <string, BinaryData> > dictionary = new Dictionary <string, IDictionary <string, BinaryData> >();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        Dictionary <string, BinaryData> dictionary0 = new Dictionary <string, BinaryData>();
                        foreach (var property1 in property0.Value.EnumerateObject())
                        {
                            dictionary0.Add(property1.Name, BinaryData.FromString(property1.Value.GetRawText()));
                        }
                        dictionary.Add(property0.Name, dictionary0);
                    }
                    addonConfigs = dictionary;
                    continue;
                }
                if (property.NameEquals("containerProbeSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    containerProbeSettings = ContainerProbeSettings.DeserializeContainerProbeSettings(property.Value);
                    continue;
                }
            }
            return(new DeploymentSettings(resourceRequests.Value, Optional.ToDictionary(environmentVariables), Optional.ToDictionary(addonConfigs), containerProbeSettings.Value));
        }