internal static Notebook DeserializeNotebook(JsonElement element)
        {
            Optional <string> description = default;
            Optional <BigDataPoolReference>      bigDataPool       = default;
            Optional <NotebookSessionProperties> sessionProperties = default;
            NotebookMetadata metadata = default;
            int nbformat      = default;
            int nbformatMinor = default;
            IList <NotebookCell>         cells = default;
            IDictionary <string, object> additionalProperties           = default;
            Dictionary <string, object>  additionalPropertiesDictionary = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("description"))
                {
                    description = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("bigDataPool"))
                {
                    bigDataPool = BigDataPoolReference.DeserializeBigDataPoolReference(property.Value);
                    continue;
                }
                if (property.NameEquals("sessionProperties"))
                {
                    sessionProperties = NotebookSessionProperties.DeserializeNotebookSessionProperties(property.Value);
                    continue;
                }
                if (property.NameEquals("metadata"))
                {
                    metadata = NotebookMetadata.DeserializeNotebookMetadata(property.Value);
                    continue;
                }
                if (property.NameEquals("nbformat"))
                {
                    nbformat = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("nbformat_minor"))
                {
                    nbformatMinor = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("cells"))
                {
                    List <NotebookCell> array = new List <NotebookCell>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(NotebookCell.DeserializeNotebookCell(item));
                    }
                    cells = array;
                    continue;
                }
                additionalPropertiesDictionary ??= new Dictionary <string, object>();
                additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject());
            }
            additionalProperties = additionalPropertiesDictionary;
            return(new Notebook(description.Value, bigDataPool.Value, sessionProperties.Value, metadata, nbformat, nbformatMinor, cells, additionalProperties));
        }
예제 #2
0
 internal SparkJobDefinition(string description, BigDataPoolReference targetBigDataPool, string requiredSparkVersion, string language, SparkJobProperties jobProperties, IDictionary <string, object> additionalProperties)
 {
     Description          = description;
     TargetBigDataPool    = targetBigDataPool;
     RequiredSparkVersion = requiredSparkVersion;
     Language             = language;
     JobProperties        = jobProperties;
     AdditionalProperties = additionalProperties;
 }
예제 #3
0
 internal Notebook(string description, BigDataPoolReference bigDataPool, NotebookSessionProperties sessionProperties, NotebookMetadata metadata, int nbformat, int nbformatMinor, IList <NotebookCell> cells, IDictionary <string, object> additionalProperties)
 {
     Description          = description;
     BigDataPool          = bigDataPool;
     SessionProperties    = sessionProperties;
     Metadata             = metadata;
     Nbformat             = nbformat;
     NbformatMinor        = nbformatMinor;
     Cells                = cells;
     AdditionalProperties = additionalProperties;
 }
예제 #4
0
        internal static SparkJobDefinition DeserializeSparkJobDefinition(JsonElement element)
        {
            Optional <string>    description           = default;
            BigDataPoolReference targetBigDataPool     = default;
            Optional <string>    requiredSparkVersion  = default;
            Optional <string>    language              = default;
            SparkJobProperties   jobProperties         = default;
            Optional <SparkJobDefinitionFolder> folder = default;
            IDictionary <string, object>        additionalProperties           = default;
            Dictionary <string, object>         additionalPropertiesDictionary = new Dictionary <string, object>();

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("description"))
                {
                    description = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("targetBigDataPool"))
                {
                    targetBigDataPool = BigDataPoolReference.DeserializeBigDataPoolReference(property.Value);
                    continue;
                }
                if (property.NameEquals("requiredSparkVersion"))
                {
                    requiredSparkVersion = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("language"))
                {
                    language = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("jobProperties"))
                {
                    jobProperties = SparkJobProperties.DeserializeSparkJobProperties(property.Value);
                    continue;
                }
                if (property.NameEquals("folder"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        folder = null;
                        continue;
                    }
                    folder = SparkJobDefinitionFolder.DeserializeSparkJobDefinitionFolder(property.Value);
                    continue;
                }
                additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject());
            }
            additionalProperties = additionalPropertiesDictionary;
            return(new SparkJobDefinition(description.Value, targetBigDataPool, requiredSparkVersion.Value, language.Value, jobProperties, folder.Value, additionalProperties));
        }
예제 #5
0
        public SparkJobDefinition(BigDataPoolReference targetBigDataPool, SparkJobProperties jobProperties)
        {
            if (targetBigDataPool == null)
            {
                throw new ArgumentNullException(nameof(targetBigDataPool));
            }
            if (jobProperties == null)
            {
                throw new ArgumentNullException(nameof(jobProperties));
            }

            TargetBigDataPool    = targetBigDataPool;
            JobProperties        = jobProperties;
            AdditionalProperties = new ChangeTrackingDictionary <string, object>();
        }
예제 #6
0
        internal static SparkJobDefinition DeserializeSparkJobDefinition(JsonElement element)
        {
            string description = default;
            BigDataPoolReference targetBigDataPool                      = default;
            string                       requiredSparkVersion           = default;
            string                       language                       = default;
            SparkJobProperties           jobProperties                  = default;
            IDictionary <string, object> additionalProperties           = default;
            Dictionary <string, object>  additionalPropertiesDictionary = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("description"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    description = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("targetBigDataPool"))
                {
                    targetBigDataPool = BigDataPoolReference.DeserializeBigDataPoolReference(property.Value);
                    continue;
                }
                if (property.NameEquals("requiredSparkVersion"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    requiredSparkVersion = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("language"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    language = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("jobProperties"))
                {
                    jobProperties = SparkJobProperties.DeserializeSparkJobProperties(property.Value);
                    continue;
                }
                additionalPropertiesDictionary ??= new Dictionary <string, object>();
                if (property.Value.ValueKind == JsonValueKind.Null)
                {
                    additionalPropertiesDictionary.Add(property.Name, null);
                }
                else
                {
                    additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject());
                }
            }
            additionalProperties = additionalPropertiesDictionary;
            return(new SparkJobDefinition(description, targetBigDataPool, requiredSparkVersion, language, jobProperties, additionalProperties));
        }