Ejemplo n.º 1
0
        internal static DeploymentPropertiesExtended DeserializeDeploymentPropertiesExtended(JsonElement element)
        {
            Optional <ProvisioningState>                  provisioningState = default;
            Optional <string>                             correlationId     = default;
            Optional <DateTimeOffset>                     timestamp         = default;
            Optional <string>                             duration          = default;
            Optional <object>                             outputs           = default;
            Optional <IReadOnlyList <ProviderData> >      providers         = default;
            Optional <IReadOnlyList <Dependency> >        dependencies      = default;
            Optional <TemplateLink>                       templateLink      = default;
            Optional <object>                             parameters        = default;
            Optional <ParametersLink>                     parametersLink    = default;
            Optional <DeploymentMode>                     mode               = default;
            Optional <DebugSetting>                       debugSetting       = default;
            Optional <OnErrorDeploymentExtended>          onErrorDeployment  = default;
            Optional <string>                             templateHash       = default;
            Optional <IReadOnlyList <ResourceReference> > outputResources    = default;
            Optional <IReadOnlyList <ResourceReference> > validatedResources = default;
            Optional <ErrorDetail>                        error              = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("provisioningState"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    provisioningState = new ProvisioningState(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("correlationId"))
                {
                    correlationId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("timestamp"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    timestamp = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("duration"))
                {
                    duration = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("outputs"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    outputs = property.Value.GetObject();
                    continue;
                }
                if (property.NameEquals("providers"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <ProviderData> array = new List <ProviderData>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(JsonSerializer.Deserialize <ProviderData>(item.ToString()));
                    }
                    providers = array;
                    continue;
                }
                if (property.NameEquals("dependencies"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <Dependency> array = new List <Dependency>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(Dependency.DeserializeDependency(item));
                    }
                    dependencies = array;
                    continue;
                }
                if (property.NameEquals("templateLink"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    templateLink = TemplateLink.DeserializeTemplateLink(property.Value);
                    continue;
                }
                if (property.NameEquals("parameters"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    parameters = property.Value.GetObject();
                    continue;
                }
                if (property.NameEquals("parametersLink"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    parametersLink = ParametersLink.DeserializeParametersLink(property.Value);
                    continue;
                }
                if (property.NameEquals("mode"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    mode = new DeploymentMode(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("debugSetting"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    debugSetting = DebugSetting.DeserializeDebugSetting(property.Value);
                    continue;
                }
                if (property.NameEquals("onErrorDeployment"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    onErrorDeployment = OnErrorDeploymentExtended.DeserializeOnErrorDeploymentExtended(property.Value);
                    continue;
                }
                if (property.NameEquals("templateHash"))
                {
                    templateHash = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("outputResources"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <ResourceReference> array = new List <ResourceReference>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ResourceReference.DeserializeResourceReference(item));
                    }
                    outputResources = array;
                    continue;
                }
                if (property.NameEquals("validatedResources"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <ResourceReference> array = new List <ResourceReference>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ResourceReference.DeserializeResourceReference(item));
                    }
                    validatedResources = array;
                    continue;
                }
                if (property.NameEquals("error"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    error = JsonSerializer.Deserialize <ErrorDetail>(property.Value.ToString());
                    continue;
                }
            }
            return(new DeploymentPropertiesExtended(Optional.ToNullable(provisioningState), correlationId.Value, Optional.ToNullable(timestamp), duration.Value, outputs.Value, Optional.ToList(providers), Optional.ToList(dependencies), templateLink.Value, parameters.Value, parametersLink.Value, Optional.ToNullable(mode), debugSetting.Value, onErrorDeployment.Value, templateHash.Value, Optional.ToList(outputResources), Optional.ToList(validatedResources), error));
        }
Ejemplo n.º 2
0
 internal DeploymentPropertiesExtended(ProvisioningState?provisioningState, string correlationId, DateTimeOffset?timestamp, string duration, object outputs, IReadOnlyList <ProviderData> providers, IReadOnlyList <Dependency> dependencies, TemplateLink templateLink, object parameters, ParametersLink parametersLink, DeploymentMode?mode, DebugSetting debugSetting, OnErrorDeploymentExtended onErrorDeployment, string templateHash, IReadOnlyList <SubResource> outputResources, IReadOnlyList <SubResource> validatedResources, ErrorDetail error)
 {
     ProvisioningState = provisioningState;
     CorrelationId     = correlationId;
     Timestamp         = timestamp;
     Duration          = duration;
     Outputs           = outputs;
     Providers         = providers;
     Dependencies      = dependencies;
     TemplateLink      = templateLink;
     Parameters        = parameters;
     ParametersLink    = parametersLink;
     Mode               = mode;
     DebugSetting       = debugSetting;
     OnErrorDeployment  = onErrorDeployment;
     TemplateHash       = templateHash;
     OutputResources    = outputResources;
     ValidatedResources = validatedResources;
     Error              = error;
 }
Ejemplo n.º 3
0
 internal ArmDeploymentPropertiesExtended(ResourcesProvisioningState?provisioningState, string correlationId, DateTimeOffset?timestamp, TimeSpan?duration, BinaryData outputs, IReadOnlyList <ResourceProviderData> providers, IReadOnlyList <ArmDependency> dependencies, ArmDeploymentTemplateLink templateLink, BinaryData parameters, ArmDeploymentParametersLink parametersLink, ArmDeploymentMode?mode, DebugSetting debugSetting, ErrorDeploymentExtended errorDeployment, string templateHash, IReadOnlyList <SubResource> outputResources, IReadOnlyList <SubResource> validatedResources, ResponseError error)
 {
     ProvisioningState = provisioningState;
     CorrelationId     = correlationId;
     Timestamp         = timestamp;
     Duration          = duration;
     Outputs           = outputs;
     Providers         = providers;
     Dependencies      = dependencies;
     TemplateLink      = templateLink;
     Parameters        = parameters;
     ParametersLink    = parametersLink;
     Mode               = mode;
     DebugSetting       = debugSetting;
     ErrorDeployment    = errorDeployment;
     TemplateHash       = templateHash;
     OutputResources    = outputResources;
     ValidatedResources = validatedResources;
     Error              = error;
 }
Ejemplo n.º 4
0
        internal static DeploymentPropertiesExtended DeserializeDeploymentPropertiesExtended(JsonElement element)
        {
            string                            provisioningState = default;
            string                            correlationId     = default;
            DateTimeOffset?                   timestamp         = default;
            string                            duration          = default;
            object                            outputs           = default;
            IReadOnlyList <Provider>          providers         = default;
            IReadOnlyList <Dependency>        dependencies      = default;
            TemplateLink                      templateLink      = default;
            object                            parameters        = default;
            ParametersLink                    parametersLink    = default;
            DeploymentMode?                   mode               = default;
            DebugSetting                      debugSetting       = default;
            OnErrorDeploymentExtended         onErrorDeployment  = default;
            string                            templateHash       = default;
            IReadOnlyList <ResourceReference> outputResources    = default;
            IReadOnlyList <ResourceReference> validatedResources = default;
            ErrorResponse                     error              = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("provisioningState"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    provisioningState = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("correlationId"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    correlationId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("timestamp"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    timestamp = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("duration"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    duration = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("outputs"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    outputs = property.Value.GetObject();
                    continue;
                }
                if (property.NameEquals("providers"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <Provider> array = new List <Provider>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(Provider.DeserializeProvider(item));
                        }
                    }
                    providers = array;
                    continue;
                }
                if (property.NameEquals("dependencies"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <Dependency> array = new List <Dependency>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(Dependency.DeserializeDependency(item));
                        }
                    }
                    dependencies = array;
                    continue;
                }
                if (property.NameEquals("templateLink"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    templateLink = TemplateLink.DeserializeTemplateLink(property.Value);
                    continue;
                }
                if (property.NameEquals("parameters"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    parameters = property.Value.GetObject();
                    continue;
                }
                if (property.NameEquals("parametersLink"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    parametersLink = ParametersLink.DeserializeParametersLink(property.Value);
                    continue;
                }
                if (property.NameEquals("mode"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    mode = property.Value.GetString().ToDeploymentMode();
                    continue;
                }
                if (property.NameEquals("debugSetting"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    debugSetting = DebugSetting.DeserializeDebugSetting(property.Value);
                    continue;
                }
                if (property.NameEquals("onErrorDeployment"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    onErrorDeployment = OnErrorDeploymentExtended.DeserializeOnErrorDeploymentExtended(property.Value);
                    continue;
                }
                if (property.NameEquals("templateHash"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    templateHash = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("outputResources"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <ResourceReference> array = new List <ResourceReference>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(ResourceReference.DeserializeResourceReference(item));
                        }
                    }
                    outputResources = array;
                    continue;
                }
                if (property.NameEquals("validatedResources"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <ResourceReference> array = new List <ResourceReference>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(ResourceReference.DeserializeResourceReference(item));
                        }
                    }
                    validatedResources = array;
                    continue;
                }
                if (property.NameEquals("error"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    error = ErrorResponse.DeserializeErrorResponse(property.Value);
                    continue;
                }
            }
            return(new DeploymentPropertiesExtended(provisioningState, correlationId, timestamp, duration, outputs, providers, dependencies, templateLink, parameters, parametersLink, mode, debugSetting, onErrorDeployment, templateHash, outputResources, validatedResources, error));
        }
Ejemplo n.º 5
0
        internal static ArmDeploymentPropertiesExtended DeserializeArmDeploymentPropertiesExtended(JsonElement element)
        {
            Optional <ResourcesProvisioningState> provisioningState = default;
            Optional <string>         correlationId = default;
            Optional <DateTimeOffset> timestamp     = default;
            Optional <TimeSpan>       duration      = default;
            Optional <BinaryData>     outputs       = default;
            Optional <IReadOnlyList <ResourceProviderData> > providers    = default;
            Optional <IReadOnlyList <ArmDependency> >        dependencies = default;
            Optional <ArmDeploymentTemplateLink>             templateLink = default;
            Optional <BinaryData> parameters = default;
            Optional <ArmDeploymentParametersLink> parametersLink = default;
            Optional <ArmDeploymentMode>           mode           = default;
            Optional <DebugSetting>            debugSetting       = default;
            Optional <ErrorDeploymentExtended> onErrorDeployment  = default;
            Optional <string> templateHash = default;
            Optional <IReadOnlyList <SubResource> > outputResources    = default;
            Optional <IReadOnlyList <SubResource> > validatedResources = default;
            Optional <ResourcesResponseError>       error = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("provisioningState"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    provisioningState = new ResourcesProvisioningState(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("correlationId"))
                {
                    correlationId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("timestamp"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    timestamp = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("duration"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    duration = property.Value.GetTimeSpan("P");
                    continue;
                }
                if (property.NameEquals("outputs"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    outputs = BinaryData.FromString(property.Value.GetRawText());
                    continue;
                }
                if (property.NameEquals("providers"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <ResourceProviderData> array = new List <ResourceProviderData>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(JsonSerializer.Deserialize <ResourceProviderData>(item.ToString()));
                    }
                    providers = array;
                    continue;
                }
                if (property.NameEquals("dependencies"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <ArmDependency> array = new List <ArmDependency>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ArmDependency.DeserializeArmDependency(item));
                    }
                    dependencies = array;
                    continue;
                }
                if (property.NameEquals("templateLink"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    templateLink = ArmDeploymentTemplateLink.DeserializeArmDeploymentTemplateLink(property.Value);
                    continue;
                }
                if (property.NameEquals("parameters"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    parameters = BinaryData.FromString(property.Value.GetRawText());
                    continue;
                }
                if (property.NameEquals("parametersLink"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    parametersLink = ArmDeploymentParametersLink.DeserializeArmDeploymentParametersLink(property.Value);
                    continue;
                }
                if (property.NameEquals("mode"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    mode = property.Value.GetString().ToArmDeploymentMode();
                    continue;
                }
                if (property.NameEquals("debugSetting"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    debugSetting = DebugSetting.DeserializeDebugSetting(property.Value);
                    continue;
                }
                if (property.NameEquals("onErrorDeployment"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    onErrorDeployment = ErrorDeploymentExtended.DeserializeErrorDeploymentExtended(property.Value);
                    continue;
                }
                if (property.NameEquals("templateHash"))
                {
                    templateHash = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("outputResources"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <SubResource> array = new List <SubResource>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(JsonSerializer.Deserialize <SubResource>(item.ToString()));
                    }
                    outputResources = array;
                    continue;
                }
                if (property.NameEquals("validatedResources"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <SubResource> array = new List <SubResource>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(JsonSerializer.Deserialize <SubResource>(item.ToString()));
                    }
                    validatedResources = array;
                    continue;
                }
                if (property.NameEquals("error"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    error = ResourcesResponseError.DeserializeResourcesResponseError(property.Value);
                    continue;
                }
            }
            return(new ArmDeploymentPropertiesExtended(Optional.ToNullable(provisioningState), correlationId.Value, Optional.ToNullable(timestamp), Optional.ToNullable(duration), outputs.Value, Optional.ToList(providers), Optional.ToList(dependencies), templateLink.Value, parameters.Value, parametersLink.Value, Optional.ToNullable(mode), debugSetting.Value, onErrorDeployment.Value, templateHash.Value, Optional.ToList(outputResources), Optional.ToList(validatedResources), error.Value));
        }