Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
 internal TargetRegion(string name, int?regionalReplicaCount, StorageAccountType?storageAccountType, EncryptionImages encryption)
 {
     Name = name;
     RegionalReplicaCount = regionalReplicaCount;
     StorageAccountType   = storageAccountType;
     Encryption           = encryption;
 }
Ejemplo n.º 3
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));
        }