internal static DatabricksCompute DeserializeDatabricksCompute(JsonElement element) { Optional <DatabricksProperties> properties = default; ComputeType computeType = default; Optional <string> computeLocation = default; Optional <ProvisioningState> provisioningState = default; Optional <string> description = default; Optional <DateTimeOffset> createdOn = default; Optional <DateTimeOffset> modifiedOn = default; Optional <ResourceIdentifier> resourceId = default; Optional <IReadOnlyList <ErrorResponse> > provisioningErrors = default; Optional <bool> isAttachedCompute = default; Optional <bool> disableLocalAuth = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } properties = DatabricksProperties.DeserializeDatabricksProperties(property.Value); continue; } if (property.NameEquals("computeType")) { computeType = new ComputeType(property.Value.GetString()); continue; } if (property.NameEquals("computeLocation")) { computeLocation = property.Value.GetString(); continue; } if (property.NameEquals("provisioningState")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } provisioningState = new ProvisioningState(property.Value.GetString()); continue; } if (property.NameEquals("description")) { description = property.Value.GetString(); continue; } if (property.NameEquals("createdOn")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } createdOn = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("modifiedOn")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } modifiedOn = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("resourceId")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } resourceId = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("provisioningErrors")) { if (property.Value.ValueKind == JsonValueKind.Null) { provisioningErrors = null; continue; } List <ErrorResponse> array = new List <ErrorResponse>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(ErrorResponse.DeserializeErrorResponse(item)); } provisioningErrors = array; continue; } if (property.NameEquals("isAttachedCompute")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } isAttachedCompute = property.Value.GetBoolean(); continue; } if (property.NameEquals("disableLocalAuth")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } disableLocalAuth = property.Value.GetBoolean(); continue; } } return(new DatabricksCompute(computeType, computeLocation.Value, Optional.ToNullable(provisioningState), description.Value, Optional.ToNullable(createdOn), Optional.ToNullable(modifiedOn), resourceId.Value, Optional.ToList(provisioningErrors), Optional.ToNullable(isAttachedCompute), Optional.ToNullable(disableLocalAuth), properties.Value)); }
internal static AmlComputeProperties DeserializeAmlComputeProperties(JsonElement element) { Optional <OSType> osType = default; Optional <string> vmSize = default; Optional <VmPriority> vmPriority = default; Optional <VirtualMachineImage> virtualMachineImage = default; Optional <bool> isolatedNetwork = default; Optional <ScaleSettings> scaleSettings = default; Optional <UserAccountCredentials> userAccountCredentials = default; Optional <ResourceId> subnet = default; Optional <RemoteLoginPortPublicAccess> remoteLoginPortPublicAccess = default; Optional <AllocationState> allocationState = default; Optional <DateTimeOffset> allocationStateTransitionTime = default; Optional <IReadOnlyList <ErrorResponse> > errors = default; Optional <int> currentNodeCount = default; Optional <int> targetNodeCount = default; Optional <NodeStateCounts> nodeStateCounts = default; Optional <bool> enableNodePublicIp = default; Optional <IDictionary <string, BinaryData> > propertyBag = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("osType")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } osType = new OSType(property.Value.GetString()); continue; } if (property.NameEquals("vmSize")) { vmSize = property.Value.GetString(); continue; } if (property.NameEquals("vmPriority")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } vmPriority = new VmPriority(property.Value.GetString()); continue; } if (property.NameEquals("virtualMachineImage")) { if (property.Value.ValueKind == JsonValueKind.Null) { virtualMachineImage = null; continue; } virtualMachineImage = VirtualMachineImage.DeserializeVirtualMachineImage(property.Value); continue; } if (property.NameEquals("isolatedNetwork")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } isolatedNetwork = property.Value.GetBoolean(); continue; } if (property.NameEquals("scaleSettings")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } scaleSettings = ScaleSettings.DeserializeScaleSettings(property.Value); continue; } if (property.NameEquals("userAccountCredentials")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } userAccountCredentials = UserAccountCredentials.DeserializeUserAccountCredentials(property.Value); continue; } if (property.NameEquals("subnet")) { if (property.Value.ValueKind == JsonValueKind.Null) { subnet = null; continue; } subnet = ResourceId.DeserializeResourceId(property.Value); continue; } if (property.NameEquals("remoteLoginPortPublicAccess")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } remoteLoginPortPublicAccess = new RemoteLoginPortPublicAccess(property.Value.GetString()); continue; } if (property.NameEquals("allocationState")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } allocationState = new AllocationState(property.Value.GetString()); continue; } if (property.NameEquals("allocationStateTransitionTime")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } allocationStateTransitionTime = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("errors")) { if (property.Value.ValueKind == JsonValueKind.Null) { errors = null; continue; } List <ErrorResponse> array = new List <ErrorResponse>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(ErrorResponse.DeserializeErrorResponse(item)); } errors = array; continue; } if (property.NameEquals("currentNodeCount")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } currentNodeCount = property.Value.GetInt32(); continue; } if (property.NameEquals("targetNodeCount")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } targetNodeCount = property.Value.GetInt32(); continue; } if (property.NameEquals("nodeStateCounts")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } nodeStateCounts = NodeStateCounts.DeserializeNodeStateCounts(property.Value); continue; } if (property.NameEquals("enableNodePublicIp")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } enableNodePublicIp = property.Value.GetBoolean(); continue; } if (property.NameEquals("propertyBag")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } Dictionary <string, BinaryData> dictionary = new Dictionary <string, BinaryData>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); } propertyBag = dictionary; continue; } } return(new AmlComputeProperties(Optional.ToNullable(osType), vmSize.Value, Optional.ToNullable(vmPriority), virtualMachineImage.Value, Optional.ToNullable(isolatedNetwork), scaleSettings.Value, userAccountCredentials.Value, subnet.Value, Optional.ToNullable(remoteLoginPortPublicAccess), Optional.ToNullable(allocationState), Optional.ToNullable(allocationStateTransitionTime), Optional.ToList(errors), Optional.ToNullable(currentNodeCount), Optional.ToNullable(targetNodeCount), nodeStateCounts.Value, Optional.ToNullable(enableNodePublicIp), Optional.ToDictionary(propertyBag))); }
internal static ComputeInstanceProperties DeserializeComputeInstanceProperties(JsonElement element) { Optional <string> vmSize = default; Optional <ResourceId> subnet = default; Optional <ApplicationSharingPolicy> applicationSharingPolicy = default; Optional <ComputeInstanceSshSettings> sshSettings = default; Optional <ComputeInstanceConnectivityEndpoints> connectivityEndpoints = default; Optional <IReadOnlyList <ComputeInstanceApplication> > applications = default; Optional <ComputeInstanceCreatedBy> createdBy = default; Optional <IReadOnlyList <ErrorResponse> > errors = default; Optional <ComputeInstanceState> state = default; Optional <ComputeInstanceAuthorizationType> computeInstanceAuthorizationType = default; Optional <PersonalComputeInstanceSettings> personalComputeInstanceSettings = default; Optional <SetupScripts> setupScripts = default; Optional <ComputeInstanceLastOperation> lastOperation = default; Optional <ComputeSchedules> schedules = default; Optional <bool> enableNodePublicIp = default; Optional <IReadOnlyList <ComputeInstanceContainer> > containers = default; Optional <IReadOnlyList <ComputeInstanceDataDisk> > dataDisks = default; Optional <IReadOnlyList <ComputeInstanceDataMount> > dataMounts = default; Optional <ComputeInstanceVersion> versions = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("vmSize")) { vmSize = property.Value.GetString(); continue; } if (property.NameEquals("subnet")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } subnet = ResourceId.DeserializeResourceId(property.Value); continue; } if (property.NameEquals("applicationSharingPolicy")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } applicationSharingPolicy = new ApplicationSharingPolicy(property.Value.GetString()); continue; } if (property.NameEquals("sshSettings")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } sshSettings = ComputeInstanceSshSettings.DeserializeComputeInstanceSshSettings(property.Value); continue; } if (property.NameEquals("connectivityEndpoints")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } connectivityEndpoints = ComputeInstanceConnectivityEndpoints.DeserializeComputeInstanceConnectivityEndpoints(property.Value); continue; } if (property.NameEquals("applications")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <ComputeInstanceApplication> array = new List <ComputeInstanceApplication>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(ComputeInstanceApplication.DeserializeComputeInstanceApplication(item)); } applications = array; continue; } if (property.NameEquals("createdBy")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } createdBy = ComputeInstanceCreatedBy.DeserializeComputeInstanceCreatedBy(property.Value); continue; } if (property.NameEquals("errors")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <ErrorResponse> array = new List <ErrorResponse>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(ErrorResponse.DeserializeErrorResponse(item)); } errors = array; continue; } if (property.NameEquals("state")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } state = new ComputeInstanceState(property.Value.GetString()); continue; } if (property.NameEquals("computeInstanceAuthorizationType")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } computeInstanceAuthorizationType = new ComputeInstanceAuthorizationType(property.Value.GetString()); continue; } if (property.NameEquals("personalComputeInstanceSettings")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } personalComputeInstanceSettings = PersonalComputeInstanceSettings.DeserializePersonalComputeInstanceSettings(property.Value); continue; } if (property.NameEquals("setupScripts")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } setupScripts = SetupScripts.DeserializeSetupScripts(property.Value); continue; } if (property.NameEquals("lastOperation")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } lastOperation = ComputeInstanceLastOperation.DeserializeComputeInstanceLastOperation(property.Value); continue; } if (property.NameEquals("schedules")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } schedules = ComputeSchedules.DeserializeComputeSchedules(property.Value); continue; } if (property.NameEquals("enableNodePublicIp")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } enableNodePublicIp = property.Value.GetBoolean(); continue; } if (property.NameEquals("containers")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <ComputeInstanceContainer> array = new List <ComputeInstanceContainer>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(ComputeInstanceContainer.DeserializeComputeInstanceContainer(item)); } containers = array; continue; } if (property.NameEquals("dataDisks")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <ComputeInstanceDataDisk> array = new List <ComputeInstanceDataDisk>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(ComputeInstanceDataDisk.DeserializeComputeInstanceDataDisk(item)); } dataDisks = array; continue; } if (property.NameEquals("dataMounts")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <ComputeInstanceDataMount> array = new List <ComputeInstanceDataMount>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(ComputeInstanceDataMount.DeserializeComputeInstanceDataMount(item)); } dataMounts = array; continue; } if (property.NameEquals("versions")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } versions = ComputeInstanceVersion.DeserializeComputeInstanceVersion(property.Value); continue; } } return(new ComputeInstanceProperties(vmSize.Value, subnet.Value, Optional.ToNullable(applicationSharingPolicy), sshSettings.Value, connectivityEndpoints.Value, Optional.ToList(applications), createdBy.Value, Optional.ToList(errors), Optional.ToNullable(state), Optional.ToNullable(computeInstanceAuthorizationType), personalComputeInstanceSettings.Value, setupScripts.Value, lastOperation.Value, schedules.Value, Optional.ToNullable(enableNodePublicIp), Optional.ToList(containers), Optional.ToList(dataDisks), Optional.ToList(dataMounts), versions.Value)); }
internal static Compute DeserializeCompute(JsonElement element) { if (element.TryGetProperty("computeType", out JsonElement discriminator)) { switch (discriminator.GetString()) { case "AKS": return(AksCompute.DeserializeAksCompute(element)); case "AmlCompute": return(AmlCompute.DeserializeAmlCompute(element)); case "ComputeInstance": return(ComputeInstance.DeserializeComputeInstance(element)); case "DataFactory": return(DataFactoryCompute.DeserializeDataFactoryCompute(element)); case "DataLakeAnalytics": return(DataLakeAnalyticsCompute.DeserializeDataLakeAnalyticsCompute(element)); case "Databricks": return(DatabricksCompute.DeserializeDatabricksCompute(element)); case "HDInsight": return(HDInsightCompute.DeserializeHDInsightCompute(element)); case "Kubernetes": return(KubernetesCompute.DeserializeKubernetesCompute(element)); case "SynapseSpark": return(SynapseSparkCompute.DeserializeSynapseSparkCompute(element)); case "VirtualMachine": return(VirtualMachineCompute.DeserializeVirtualMachineCompute(element)); } } ComputeType computeType = default; Optional <string> computeLocation = default; Optional <ProvisioningState> provisioningState = default; Optional <string> description = default; Optional <DateTimeOffset> createdOn = default; Optional <DateTimeOffset> modifiedOn = default; Optional <ResourceIdentifier> resourceId = default; Optional <IReadOnlyList <ErrorResponse> > provisioningErrors = default; Optional <bool> isAttachedCompute = default; Optional <bool> disableLocalAuth = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("computeType")) { computeType = new ComputeType(property.Value.GetString()); continue; } if (property.NameEquals("computeLocation")) { computeLocation = property.Value.GetString(); continue; } if (property.NameEquals("provisioningState")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } provisioningState = new ProvisioningState(property.Value.GetString()); continue; } if (property.NameEquals("description")) { description = property.Value.GetString(); continue; } if (property.NameEquals("createdOn")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } createdOn = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("modifiedOn")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } modifiedOn = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("resourceId")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } resourceId = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("provisioningErrors")) { if (property.Value.ValueKind == JsonValueKind.Null) { provisioningErrors = null; continue; } List <ErrorResponse> array = new List <ErrorResponse>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(ErrorResponse.DeserializeErrorResponse(item)); } provisioningErrors = array; continue; } if (property.NameEquals("isAttachedCompute")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } isAttachedCompute = property.Value.GetBoolean(); continue; } if (property.NameEquals("disableLocalAuth")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } disableLocalAuth = property.Value.GetBoolean(); continue; } } return(new Compute(computeType, computeLocation.Value, Optional.ToNullable(provisioningState), description.Value, Optional.ToNullable(createdOn), Optional.ToNullable(modifiedOn), resourceId.Value, Optional.ToList(provisioningErrors), Optional.ToNullable(isAttachedCompute), Optional.ToNullable(disableLocalAuth))); }