internal static AmlCompute DeserializeAmlCompute(JsonElement element)
        {
            Optional <AmlComputeProperties> 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 <string>            resourceId        = default;
            Optional <IReadOnlyList <MachineLearningServiceError> > provisioningErrors = default;
            Optional <bool> isAttachedCompute = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    properties = AmlComputeProperties.DeserializeAmlComputeProperties(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"))
                {
                    resourceId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("provisioningErrors"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <MachineLearningServiceError> array = new List <MachineLearningServiceError>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(MachineLearningServiceError.DeserializeMachineLearningServiceError(item));
                    }
                    provisioningErrors = array;
                    continue;
                }
                if (property.NameEquals("isAttachedCompute"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    isAttachedCompute = property.Value.GetBoolean();
                    continue;
                }
            }
            return(new AmlCompute(computeType, computeLocation.Value, Optional.ToNullable(provisioningState), description.Value, Optional.ToNullable(createdOn), Optional.ToNullable(modifiedOn), resourceId.Value, Optional.ToList(provisioningErrors), Optional.ToNullable(isAttachedCompute), properties.Value));
        }
예제 #2
0
 internal AmlCompute(ComputeType computeType, string computeLocation, ProvisioningState?provisioningState, string description, DateTimeOffset?createdOn, DateTimeOffset?modifiedOn, string resourceId, IReadOnlyList <MachineLearningServiceError> provisioningErrors, bool?isAttachedCompute, AmlComputeProperties properties) : base(computeType, computeLocation, provisioningState, description, createdOn, modifiedOn, resourceId, provisioningErrors, isAttachedCompute)
 {
     Properties  = properties;
     ComputeType = computeType;
 }