Exemplo n.º 1
0
 internal SharedGalleryImageData(string name, string location, string uniqueId, OperatingSystemTypes?osType, OperatingSystemStateTypes?osState, DateTimeOffset?endOfLifeDate, GalleryImageIdentifier identifier, RecommendedMachineConfiguration recommended, Disallowed disallowed, HyperVGeneration?hyperVGeneration, IReadOnlyList <GalleryImageFeature> features, ImagePurchasePlan purchasePlan) : base(name, location, uniqueId)
 {
     OsType           = osType;
     OsState          = osState;
     EndOfLifeDate    = endOfLifeDate;
     Identifier       = identifier;
     Recommended      = recommended;
     Disallowed       = disallowed;
     HyperVGeneration = hyperVGeneration;
     Features         = features;
     PurchasePlan     = purchasePlan;
 }
Exemplo n.º 2
0
 internal CommunityGalleryImageData(string name, AzureLocation?location, ResourceType?resourceType, string uniqueId, OperatingSystemTypes?osType, OperatingSystemStateTypes?osState, DateTimeOffset?endOfLifeOn, GalleryImageIdentifier identifier, RecommendedMachineConfiguration recommended, Disallowed disallowed, HyperVGeneration?hyperVGeneration, IReadOnlyList <GalleryImageFeature> features, ImagePurchasePlan purchasePlan, ArchitectureTypes?architecture, Uri privacyStatementUri, string eula) : base(name, location, resourceType, uniqueId)
 {
     OSType              = osType;
     OSState             = osState;
     EndOfLifeOn         = endOfLifeOn;
     Identifier          = identifier;
     Recommended         = recommended;
     Disallowed          = disallowed;
     HyperVGeneration    = hyperVGeneration;
     Features            = features;
     PurchasePlan        = purchasePlan;
     Architecture        = architecture;
     PrivacyStatementUri = privacyStatementUri;
     Eula = eula;
 }
Exemplo n.º 3
0
 internal GalleryImageData(ResourceIdentifier id, string name, ResourceType type, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, string description, string eula, Uri privacyStatementUri, Uri releaseNoteUri, OperatingSystemTypes?osType, OperatingSystemStateTypes?osState, HyperVGeneration?hyperVGeneration, DateTimeOffset?endOfLifeDate, GalleryImageIdentifier identifier, RecommendedMachineConfiguration recommended, Disallowed disallowed, ImagePurchasePlan purchasePlan, GalleryImagePropertiesProvisioningState?provisioningState, IList <GalleryImageFeature> features) : base(id, name, type, systemData, tags, location)
 {
     Description         = description;
     Eula                = eula;
     PrivacyStatementUri = privacyStatementUri;
     ReleaseNoteUri      = releaseNoteUri;
     OSType              = osType;
     OSState             = osState;
     HyperVGeneration    = hyperVGeneration;
     EndOfLifeDate       = endOfLifeDate;
     Identifier          = identifier;
     Recommended         = recommended;
     Disallowed          = disallowed;
     PurchasePlan        = purchasePlan;
     ProvisioningState   = provisioningState;
     Features            = features;
 }
Exemplo n.º 4
0
        internal static GalleryImageData DeserializeGalleryImageData(JsonElement element)
        {
            IDictionary <string, string> tags                                    = default;
            AzureLocation      location                                          = default;
            ResourceIdentifier id                                                = default;
            string             name                                              = default;
            ResourceType       type                                              = default;
            SystemData         systemData                                        = default;
            Optional <string>  description                                       = default;
            Optional <string>  eula                                              = default;
            Optional <string>  privacyStatementUri                               = default;
            Optional <string>  releaseNoteUri                                    = default;
            Optional <OperatingSystemTypes>            osType                    = default;
            Optional <OperatingSystemStateTypes>       osState                   = default;
            Optional <HyperVGeneration>                hyperVGeneration          = default;
            Optional <DateTimeOffset>                  endOfLifeDate             = default;
            Optional <GalleryImageIdentifier>          identifier                = default;
            Optional <RecommendedMachineConfiguration> recommended               = default;
            Optional <Disallowed>        disallowed                              = default;
            Optional <ImagePurchasePlan> purchasePlan                            = default;
            Optional <GalleryImagePropertiesProvisioningState> provisioningState = default;
            Optional <IList <GalleryImageFeature> >            features          = default;

            foreach (var property in element.EnumerateObject())
            {
                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 = new ResourceIdentifier(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("systemData"))
                {
                    systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("description"))
                        {
                            description = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("eula"))
                        {
                            eula = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("privacyStatementUri"))
                        {
                            privacyStatementUri = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("releaseNoteUri"))
                        {
                            releaseNoteUri = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("osType"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            osType = property0.Value.GetString().ToOperatingSystemTypes();
                            continue;
                        }
                        if (property0.NameEquals("osState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            osState = property0.Value.GetString().ToOperatingSystemStateTypes();
                            continue;
                        }
                        if (property0.NameEquals("hyperVGeneration"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            hyperVGeneration = new HyperVGeneration(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("endOfLifeDate"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            endOfLifeDate = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("identifier"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            identifier = GalleryImageIdentifier.DeserializeGalleryImageIdentifier(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("recommended"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            recommended = RecommendedMachineConfiguration.DeserializeRecommendedMachineConfiguration(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("disallowed"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            disallowed = Disallowed.DeserializeDisallowed(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("purchasePlan"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            purchasePlan = ImagePurchasePlan.DeserializeImagePurchasePlan(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = new GalleryImagePropertiesProvisioningState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("features"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <GalleryImageFeature> array = new List <GalleryImageFeature>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(GalleryImageFeature.DeserializeGalleryImageFeature(item));
                            }
                            features = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new GalleryImageData(id, name, type, systemData, tags, location, description.Value, eula.Value, privacyStatementUri.Value, releaseNoteUri.Value, Optional.ToNullable(osType), Optional.ToNullable(osState), Optional.ToNullable(hyperVGeneration), Optional.ToNullable(endOfLifeDate), identifier.Value, recommended.Value, disallowed.Value, purchasePlan.Value, Optional.ToNullable(provisioningState), Optional.ToList(features)));
        }
 /// <summary>
 /// Specifies identifier (publisher, offer and sku) for the image.
 /// </summary>
 /// <param name="identifier">The identifier parameter value.</param>
 /// <return>The next definition stage.</return>
 GalleryImage.Definition.IWithOsTypeAndState GalleryImage.Definition.IWithIdentifier.WithIdentifier(GalleryImageIdentifier identifier)
 {
     return(this.WithIdentifier(identifier));
 }
Exemplo n.º 6
0
        public static GalleryImageData GetBasicGalleryImageData(AzureLocation location, OperatingSystemTypes osType, GalleryImageIdentifier identifier)
        {
            var data = new GalleryImageData(location)
            {
                OSType     = osType,
                Identifier = identifier
            };

            return(data);
        }
 ///GENMHASH:4FF261989C984084E4F237BBB3F3166D:C1387D5805B738EDA65329EFF9CEDD95
 public GalleryImageImpl WithIdentifier(GalleryImageIdentifier identifier)
 {
     this.Inner.Identifier = identifier;
     return(this);
 }
Exemplo n.º 8
0
        internal static CommunityGalleryImageData DeserializeCommunityGalleryImageData(JsonElement element)
        {
            Optional <string>                               name             = default;
            Optional <AzureLocation>                        location         = default;
            Optional <ResourceType>                         type             = default;
            Optional <OperatingSystemTypes>                 osType           = default;
            Optional <OperatingSystemStateTypes>            osState          = default;
            Optional <DateTimeOffset>                       endOfLifeDate    = default;
            Optional <GalleryImageIdentifier>               identifier       = default;
            Optional <RecommendedMachineConfiguration>      recommended      = default;
            Optional <Disallowed>                           disallowed       = default;
            Optional <HyperVGeneration>                     hyperVGeneration = default;
            Optional <IReadOnlyList <GalleryImageFeature> > features         = default;
            Optional <ImagePurchasePlan>                    purchasePlan     = default;
            Optional <ArchitectureTypes>                    architecture     = default;
            Optional <Uri>    privacyStatementUri = default;
            Optional <string> eula     = default;
            Optional <string> uniqueId = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    location = new AzureLocation(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    type = new ResourceType(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("osType"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            osType = property0.Value.GetString().ToOperatingSystemTypes();
                            continue;
                        }
                        if (property0.NameEquals("osState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            osState = property0.Value.GetString().ToOperatingSystemStateTypes();
                            continue;
                        }
                        if (property0.NameEquals("endOfLifeDate"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            endOfLifeDate = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("identifier"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            identifier = GalleryImageIdentifier.DeserializeGalleryImageIdentifier(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("recommended"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            recommended = RecommendedMachineConfiguration.DeserializeRecommendedMachineConfiguration(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("disallowed"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            disallowed = Disallowed.DeserializeDisallowed(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("hyperVGeneration"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            hyperVGeneration = new HyperVGeneration(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("features"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <GalleryImageFeature> array = new List <GalleryImageFeature>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(GalleryImageFeature.DeserializeGalleryImageFeature(item));
                            }
                            features = array;
                            continue;
                        }
                        if (property0.NameEquals("purchasePlan"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            purchasePlan = ImagePurchasePlan.DeserializeImagePurchasePlan(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("architecture"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            architecture = new ArchitectureTypes(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("privacyStatementUri"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                privacyStatementUri = null;
                                continue;
                            }
                            privacyStatementUri = new Uri(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("eula"))
                        {
                            eula = property0.Value.GetString();
                            continue;
                        }
                    }
                    continue;
                }
                if (property.NameEquals("identifier"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("uniqueId"))
                        {
                            uniqueId = property0.Value.GetString();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new CommunityGalleryImageData(name.Value, Optional.ToNullable(location), Optional.ToNullable(type), uniqueId.Value, Optional.ToNullable(osType), Optional.ToNullable(osState), Optional.ToNullable(endOfLifeDate), identifier.Value, recommended.Value, disallowed.Value, Optional.ToNullable(hyperVGeneration), Optional.ToList(features), purchasePlan.Value, Optional.ToNullable(architecture), privacyStatementUri.Value, eula.Value));
        }