示例#1
0
        internal static BatchDeploymentProperties DeserializeBatchDeploymentProperties(JsonElement element)
        {
            Optional <string>                        compute                   = default;
            Optional <int>                           errorThreshold            = default;
            Optional <BatchLoggingLevel>             loggingLevel              = default;
            Optional <int>                           maxConcurrencyPerInstance = default;
            Optional <long>                          miniBatchSize             = default;
            Optional <AssetReferenceBase>            model                = default;
            Optional <BatchOutputAction>             outputAction         = default;
            Optional <string>                        outputFileName       = default;
            Optional <DeploymentProvisioningState>   provisioningState    = default;
            Optional <ResourceConfiguration>         resources            = default;
            Optional <BatchRetrySettings>            retrySettings        = default;
            Optional <CodeConfiguration>             codeConfiguration    = default;
            Optional <string>                        description          = default;
            Optional <string>                        environmentId        = default;
            Optional <IDictionary <string, string> > environmentVariables = default;
            Optional <IDictionary <string, string> > properties           = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("compute"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        compute = null;
                        continue;
                    }
                    compute = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("errorThreshold"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    errorThreshold = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("loggingLevel"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    loggingLevel = new BatchLoggingLevel(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("maxConcurrencyPerInstance"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    maxConcurrencyPerInstance = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("miniBatchSize"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    miniBatchSize = property.Value.GetInt64();
                    continue;
                }
                if (property.NameEquals("model"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        model = null;
                        continue;
                    }
                    model = AssetReferenceBase.DeserializeAssetReferenceBase(property.Value);
                    continue;
                }
                if (property.NameEquals("outputAction"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    outputAction = new BatchOutputAction(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("outputFileName"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        outputFileName = null;
                        continue;
                    }
                    outputFileName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("provisioningState"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    provisioningState = new DeploymentProvisioningState(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("resources"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        resources = null;
                        continue;
                    }
                    resources = ResourceConfiguration.DeserializeResourceConfiguration(property.Value);
                    continue;
                }
                if (property.NameEquals("retrySettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        retrySettings = null;
                        continue;
                    }
                    retrySettings = BatchRetrySettings.DeserializeBatchRetrySettings(property.Value);
                    continue;
                }
                if (property.NameEquals("codeConfiguration"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        codeConfiguration = null;
                        continue;
                    }
                    codeConfiguration = CodeConfiguration.DeserializeCodeConfiguration(property.Value);
                    continue;
                }
                if (property.NameEquals("description"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        description = null;
                        continue;
                    }
                    description = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("environmentId"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        environmentId = null;
                        continue;
                    }
                    environmentId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("environmentVariables"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        environmentVariables = null;
                        continue;
                    }
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.Value.ValueKind == JsonValueKind.Null)
                        {
                            dictionary.Add(property0.Name, null);
                        }
                        else
                        {
                            dictionary.Add(property0.Name, property0.Value.GetString());
                        }
                    }
                    environmentVariables = dictionary;
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        properties = null;
                        continue;
                    }
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.Value.ValueKind == JsonValueKind.Null)
                        {
                            dictionary.Add(property0.Name, null);
                        }
                        else
                        {
                            dictionary.Add(property0.Name, property0.Value.GetString());
                        }
                    }
                    properties = dictionary;
                    continue;
                }
            }
            return(new BatchDeploymentProperties(codeConfiguration.Value, description.Value, environmentId.Value, Optional.ToDictionary(environmentVariables), Optional.ToDictionary(properties), compute.Value, Optional.ToNullable(errorThreshold), Optional.ToNullable(loggingLevel), Optional.ToNullable(maxConcurrencyPerInstance), Optional.ToNullable(miniBatchSize), model.Value, Optional.ToNullable(outputAction), outputFileName.Value, Optional.ToNullable(provisioningState), resources.Value, retrySettings.Value));
        }
示例#2
0
        internal static KubernetesOnlineDeployment DeserializeKubernetesOnlineDeployment(JsonElement element)
        {
            Optional <ContainerResourceRequirements> containerResourceRequirements = default;
            Optional <bool> appInsightsEnabled = default;
            Optional <EgressPublicNetworkAccessType> egressPublicNetworkAccess = default;
            EndpointComputeType      endpointComputeType = default;
            Optional <string>        instanceType        = default;
            Optional <ProbeSettings> livenessProbe       = default;
            Optional <string>        model                           = default;
            Optional <string>        modelMountPath                  = default;
            Optional <bool>          privateNetworkConnection        = default;
            Optional <DeploymentProvisioningState> provisioningState = default;
            Optional <ProbeSettings>         readinessProbe          = default;
            Optional <OnlineRequestSettings> requestSettings         = default;
            Optional <OnlineScaleSettings>   scaleSettings           = default;
            Optional <CodeConfiguration>     codeConfiguration       = default;
            Optional <string> description   = default;
            Optional <string> environmentId = default;
            Optional <IDictionary <string, string> > environmentVariables = default;
            Optional <IDictionary <string, string> > properties           = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("containerResourceRequirements"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        containerResourceRequirements = null;
                        continue;
                    }
                    containerResourceRequirements = ContainerResourceRequirements.DeserializeContainerResourceRequirements(property.Value);
                    continue;
                }
                if (property.NameEquals("appInsightsEnabled"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    appInsightsEnabled = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("egressPublicNetworkAccess"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    egressPublicNetworkAccess = new EgressPublicNetworkAccessType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("endpointComputeType"))
                {
                    endpointComputeType = new EndpointComputeType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("instanceType"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        instanceType = null;
                        continue;
                    }
                    instanceType = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("livenessProbe"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        livenessProbe = null;
                        continue;
                    }
                    livenessProbe = ProbeSettings.DeserializeProbeSettings(property.Value);
                    continue;
                }
                if (property.NameEquals("model"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        model = null;
                        continue;
                    }
                    model = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("modelMountPath"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        modelMountPath = null;
                        continue;
                    }
                    modelMountPath = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("privateNetworkConnection"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    privateNetworkConnection = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("provisioningState"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    provisioningState = new DeploymentProvisioningState(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("readinessProbe"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        readinessProbe = null;
                        continue;
                    }
                    readinessProbe = ProbeSettings.DeserializeProbeSettings(property.Value);
                    continue;
                }
                if (property.NameEquals("requestSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        requestSettings = null;
                        continue;
                    }
                    requestSettings = OnlineRequestSettings.DeserializeOnlineRequestSettings(property.Value);
                    continue;
                }
                if (property.NameEquals("scaleSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        scaleSettings = null;
                        continue;
                    }
                    scaleSettings = OnlineScaleSettings.DeserializeOnlineScaleSettings(property.Value);
                    continue;
                }
                if (property.NameEquals("codeConfiguration"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        codeConfiguration = null;
                        continue;
                    }
                    codeConfiguration = CodeConfiguration.DeserializeCodeConfiguration(property.Value);
                    continue;
                }
                if (property.NameEquals("description"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        description = null;
                        continue;
                    }
                    description = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("environmentId"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        environmentId = null;
                        continue;
                    }
                    environmentId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("environmentVariables"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        environmentVariables = null;
                        continue;
                    }
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.Value.ValueKind == JsonValueKind.Null)
                        {
                            dictionary.Add(property0.Name, null);
                        }
                        else
                        {
                            dictionary.Add(property0.Name, property0.Value.GetString());
                        }
                    }
                    environmentVariables = dictionary;
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        properties = null;
                        continue;
                    }
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.Value.ValueKind == JsonValueKind.Null)
                        {
                            dictionary.Add(property0.Name, null);
                        }
                        else
                        {
                            dictionary.Add(property0.Name, property0.Value.GetString());
                        }
                    }
                    properties = dictionary;
                    continue;
                }
            }
            return(new KubernetesOnlineDeployment(codeConfiguration.Value, description.Value, environmentId.Value, Optional.ToDictionary(environmentVariables), Optional.ToDictionary(properties), Optional.ToNullable(appInsightsEnabled), Optional.ToNullable(egressPublicNetworkAccess), endpointComputeType, instanceType.Value, livenessProbe.Value, model.Value, modelMountPath.Value, Optional.ToNullable(privateNetworkConnection), Optional.ToNullable(provisioningState), readinessProbe.Value, requestSettings.Value, scaleSettings.Value, containerResourceRequirements.Value));
        }