internal static TargetRegion DeserializeTargetRegion(JsonElement element)
        {
            string         name = default;
            Optional <int> regionalReplicaCount = default;
            Optional <StorageAccountType> storageAccountType = default;
            Optional <EncryptionImages>   encryption         = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("regionalReplicaCount"))
                {
                    regionalReplicaCount = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("storageAccountType"))
                {
                    storageAccountType = new StorageAccountType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("encryption"))
                {
                    encryption = EncryptionImages.DeserializeEncryptionImages(property.Value);
                    continue;
                }
            }
            return(new TargetRegion(name, Optional.ToNullable(regionalReplicaCount), Optional.ToNullable(storageAccountType), encryption.Value));
        }
Exemple #2
0
        internal static GalleryTargetExtendedLocation DeserializeGalleryTargetExtendedLocation(JsonElement element)
        {
            Optional <string> name = default;
            Optional <GalleryExtendedLocation> extendedLocation = default;
            Optional <int> extendedLocationReplicaCount         = default;
            Optional <StorageAccountType> storageAccountType    = default;
            Optional <EncryptionImages>   encryption            = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("extendedLocation"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    extendedLocation = GalleryExtendedLocation.DeserializeGalleryExtendedLocation(property.Value);
                    continue;
                }
                if (property.NameEquals("extendedLocationReplicaCount"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    extendedLocationReplicaCount = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("storageAccountType"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    storageAccountType = new StorageAccountType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("encryption"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    encryption = EncryptionImages.DeserializeEncryptionImages(property.Value);
                    continue;
                }
            }
            return(new GalleryTargetExtendedLocation(name.Value, extendedLocation.Value, Optional.ToNullable(extendedLocationReplicaCount), Optional.ToNullable(storageAccountType), encryption.Value));
        }
        internal static GalleryArtifactPublishingProfileBase DeserializeGalleryArtifactPublishingProfileBase(JsonElement element)
        {
            Optional <IList <TargetRegion> > targetRegions   = default;
            Optional <int>                replicaCount       = default;
            Optional <bool>               excludeFromLatest  = default;
            Optional <DateTimeOffset>     publishedDate      = default;
            Optional <DateTimeOffset>     endOfLifeDate      = default;
            Optional <StorageAccountType> storageAccountType = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("targetRegions"))
                {
                    List <TargetRegion> array = new List <TargetRegion>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(TargetRegion.DeserializeTargetRegion(item));
                    }
                    targetRegions = array;
                    continue;
                }
                if (property.NameEquals("replicaCount"))
                {
                    replicaCount = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("excludeFromLatest"))
                {
                    excludeFromLatest = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("publishedDate"))
                {
                    publishedDate = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("endOfLifeDate"))
                {
                    endOfLifeDate = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("storageAccountType"))
                {
                    storageAccountType = new StorageAccountType(property.Value.GetString());
                    continue;
                }
            }
            return(new GalleryArtifactPublishingProfileBase(Optional.ToList(targetRegions), Optional.ToNullable(replicaCount), Optional.ToNullable(excludeFromLatest), Optional.ToNullable(publishedDate), Optional.ToNullable(endOfLifeDate), Optional.ToNullable(storageAccountType)));
        }
Exemple #4
0
        internal static TargetRegion DeserializeTargetRegion(JsonElement element)
        {
            string             name = default;
            int?               regionalReplicaCount = default;
            StorageAccountType?storageAccountType   = default;
            EncryptionImages   encryption           = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("regionalReplicaCount"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    regionalReplicaCount = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("storageAccountType"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    storageAccountType = new StorageAccountType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("encryption"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    encryption = EncryptionImages.DeserializeEncryptionImages(property.Value);
                    continue;
                }
            }
            return(new TargetRegion(name, regionalReplicaCount, storageAccountType, encryption));
        }
Exemple #5
0
        internal static GalleryApplicationVersionPublishingProfile DeserializeGalleryApplicationVersionPublishingProfile(JsonElement element)
        {
            UserArtifactSource            source             = default;
            Optional <UserArtifactManage> manageActions      = default;
            Optional <bool> enableHealthCheck                = default;
            Optional <IList <TargetRegion> > targetRegions   = default;
            Optional <int>                replicaCount       = default;
            Optional <bool>               excludeFromLatest  = default;
            Optional <DateTimeOffset>     publishedDate      = default;
            Optional <DateTimeOffset>     endOfLifeDate      = default;
            Optional <StorageAccountType> storageAccountType = default;
            Optional <ReplicationMode>    replicationMode    = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("source"))
                {
                    source = UserArtifactSource.DeserializeUserArtifactSource(property.Value);
                    continue;
                }
                if (property.NameEquals("manageActions"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    manageActions = UserArtifactManage.DeserializeUserArtifactManage(property.Value);
                    continue;
                }
                if (property.NameEquals("enableHealthCheck"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    enableHealthCheck = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("targetRegions"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <TargetRegion> array = new List <TargetRegion>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(TargetRegion.DeserializeTargetRegion(item));
                    }
                    targetRegions = array;
                    continue;
                }
                if (property.NameEquals("replicaCount"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    replicaCount = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("excludeFromLatest"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    excludeFromLatest = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("publishedDate"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    publishedDate = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("endOfLifeDate"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    endOfLifeDate = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("storageAccountType"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    storageAccountType = new StorageAccountType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("replicationMode"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    replicationMode = new ReplicationMode(property.Value.GetString());
                    continue;
                }
            }
            return(new GalleryApplicationVersionPublishingProfile(Optional.ToList(targetRegions), Optional.ToNullable(replicaCount), Optional.ToNullable(excludeFromLatest), Optional.ToNullable(publishedDate), Optional.ToNullable(endOfLifeDate), Optional.ToNullable(storageAccountType), Optional.ToNullable(replicationMode), source, manageActions.Value, Optional.ToNullable(enableHealthCheck)));
        }
Exemple #6
0
        internal static GalleryImageVersionPublishingProfile DeserializeGalleryImageVersionPublishingProfile(JsonElement element)
        {
            IList <TargetRegion> targetRegions    = default;
            int?               replicaCount       = default;
            bool?              excludeFromLatest  = default;
            DateTimeOffset?    publishedDate      = default;
            DateTimeOffset?    endOfLifeDate      = default;
            StorageAccountType?storageAccountType = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("targetRegions"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <TargetRegion> array = new List <TargetRegion>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(TargetRegion.DeserializeTargetRegion(item));
                        }
                    }
                    targetRegions = array;
                    continue;
                }
                if (property.NameEquals("replicaCount"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    replicaCount = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("excludeFromLatest"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    excludeFromLatest = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("publishedDate"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    publishedDate = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("endOfLifeDate"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    endOfLifeDate = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("storageAccountType"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    storageAccountType = new StorageAccountType(property.Value.GetString());
                    continue;
                }
            }
            return(new GalleryImageVersionPublishingProfile(targetRegions, replicaCount, excludeFromLatest, publishedDate, endOfLifeDate, storageAccountType));
        }