/// <summary>
 /// Specifies the Hyper-V image generation.
 /// </summary>
 /// <param name="hyperVGeneration">Hyper-V image generation</param>
 /// <returns>The next stage of the definition.</returns>
 IWithOSDiskImageSourceAltVirtualMachineSource IWithHyperVGeneration.WithHyperVGeneration(HyperVGenerationTypes hyperVGeneration)
 {
     return(this.WithHyperVGeneration(hyperVGeneration));
 }
Exemple #2
0
 public VirtualMachineCustomImageImpl WithHyperVGeneration(HyperVGenerationTypes hyperVGeneration)
 {
     this.Inner.HyperVGeneration = hyperVGeneration;
     return(this);
 }
Exemple #3
0
        internal static ImageData DeserializeImageData(JsonElement element)
        {
            Optional <ExtendedLocation>  extendedLocation         = default;
            IDictionary <string, string> tags                     = default;
            Location                         location             = default;
            ResourceIdentifier               id                   = default;
            string                           name                 = default;
            ResourceType                     type                 = default;
            Optional <WritableSubResource>   sourceVirtualMachine = default;
            Optional <ImageStorageProfile>   storageProfile       = default;
            Optional <string>                provisioningState    = default;
            Optional <HyperVGenerationTypes> hyperVGeneration     = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("extendedLocation"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    extendedLocation = ExtendedLocation.DeserializeExtendedLocation(property.Value);
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("sourceVirtualMachine"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            sourceVirtualMachine = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString());
                            continue;
                        }
                        if (property0.NameEquals("storageProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            storageProfile = ImageStorageProfile.DeserializeImageStorageProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("hyperVGeneration"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            hyperVGeneration = new HyperVGenerationTypes(property0.Value.GetString());
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ImageData(id, name, type, tags, location, extendedLocation.Value, sourceVirtualMachine, storageProfile.Value, provisioningState.Value, Optional.ToNullable(hyperVGeneration)));
        }