Пример #1
0
 internal EnvironmentSpecificationVersion(EnvironmentSpecificationType?type, DockerSpecification docker, string condaFile, string datastoreId, AssetPath assetPath, string description, IDictionary <string, string> tags, IDictionary <string, string> properties)
 {
     Type        = type;
     Docker      = docker;
     CondaFile   = condaFile;
     DatastoreId = datastoreId;
     AssetPath   = assetPath;
     Description = description;
     Tags        = tags;
     Properties  = properties;
 }
Пример #2
0
        internal static EnvironmentSpecificationVersion DeserializeEnvironmentSpecificationVersion(JsonElement element)
        {
            Optional <EnvironmentSpecificationType> type   = default;
            Optional <DockerSpecification>          docker = default;
            Optional <string>    condaFile   = default;
            Optional <string>    datastoreId = default;
            Optional <AssetPath> assetPath   = default;
            Optional <string>    description = default;
            Optional <IDictionary <string, string> > tags       = default;
            Optional <IDictionary <string, string> > properties = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("type"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    type = new EnvironmentSpecificationType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("docker"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    docker = DockerSpecification.DeserializeDockerSpecification(property.Value);
                    continue;
                }
                if (property.NameEquals("condaFile"))
                {
                    condaFile = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("datastoreId"))
                {
                    datastoreId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("assetPath"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    assetPath = AssetPath.DeserializeAssetPath(property.Value);
                    continue;
                }
                if (property.NameEquals("description"))
                {
                    description = 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("properties"))
                {
                    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());
                    }
                    properties = dictionary;
                    continue;
                }
            }
            return(new EnvironmentSpecificationVersion(Optional.ToNullable(type), docker.Value, condaFile.Value, datastoreId.Value, assetPath.Value, description.Value, Optional.ToDictionary(tags), Optional.ToDictionary(properties)));
        }