Esempio n. 1
0
        internal static CreationData DeserializeCreationData(JsonElement element)
        {
            DiskCreateOption              createOption          = default;
            Optional <string>             storageAccountId      = default;
            Optional <ImageDiskReference> imageReference        = default;
            Optional <ImageDiskReference> galleryImageReference = default;
            Optional <string>             sourceUri             = default;
            Optional <string>             sourceResourceId      = default;
            Optional <string>             sourceUniqueId        = default;
            Optional <long> uploadSizeBytes = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("createOption"))
                {
                    createOption = new DiskCreateOption(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("storageAccountId"))
                {
                    storageAccountId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("imageReference"))
                {
                    imageReference = ImageDiskReference.DeserializeImageDiskReference(property.Value);
                    continue;
                }
                if (property.NameEquals("galleryImageReference"))
                {
                    galleryImageReference = ImageDiskReference.DeserializeImageDiskReference(property.Value);
                    continue;
                }
                if (property.NameEquals("sourceUri"))
                {
                    sourceUri = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("sourceResourceId"))
                {
                    sourceResourceId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("sourceUniqueId"))
                {
                    sourceUniqueId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("uploadSizeBytes"))
                {
                    uploadSizeBytes = property.Value.GetInt64();
                    continue;
                }
            }
            return(new CreationData(createOption, storageAccountId.Value, imageReference.Value, galleryImageReference.Value, sourceUri.Value, sourceResourceId.Value, sourceUniqueId.Value, Optional.ToNullable(uploadSizeBytes)));
        }
Esempio n. 2
0
 internal CreationData(DiskCreateOption createOption, string storageAccountId, ImageDiskReference imageReference, ImageDiskReference galleryImageReference, Uri sourceUri, string sourceResourceId, string sourceUniqueId, long?uploadSizeBytes, int?logicalSectorSize, Uri securityDataUri)
 {
     CreateOption          = createOption;
     StorageAccountId      = storageAccountId;
     ImageReference        = imageReference;
     GalleryImageReference = galleryImageReference;
     SourceUri             = sourceUri;
     SourceResourceId      = sourceResourceId;
     SourceUniqueId        = sourceUniqueId;
     UploadSizeBytes       = uploadSizeBytes;
     LogicalSectorSize     = logicalSectorSize;
     SecurityDataUri       = securityDataUri;
 }
Esempio n. 3
0
        internal static CreationData DeserializeCreationData(JsonElement element)
        {
            DiskCreateOption              createOption          = default;
            Optional <string>             storageAccountId      = default;
            Optional <ImageDiskReference> imageReference        = default;
            Optional <ImageDiskReference> galleryImageReference = default;
            Optional <Uri>    sourceUri         = default;
            Optional <string> sourceResourceId  = default;
            Optional <string> sourceUniqueId    = default;
            Optional <long>   uploadSizeBytes   = default;
            Optional <int>    logicalSectorSize = default;
            Optional <Uri>    securityDataUri   = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("createOption"))
                {
                    createOption = new DiskCreateOption(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("storageAccountId"))
                {
                    storageAccountId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("imageReference"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    imageReference = ImageDiskReference.DeserializeImageDiskReference(property.Value);
                    continue;
                }
                if (property.NameEquals("galleryImageReference"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    galleryImageReference = ImageDiskReference.DeserializeImageDiskReference(property.Value);
                    continue;
                }
                if (property.NameEquals("sourceUri"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    sourceUri = new Uri(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("sourceResourceId"))
                {
                    sourceResourceId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("sourceUniqueId"))
                {
                    sourceUniqueId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("uploadSizeBytes"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    uploadSizeBytes = property.Value.GetInt64();
                    continue;
                }
                if (property.NameEquals("logicalSectorSize"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    logicalSectorSize = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("securityDataUri"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    securityDataUri = new Uri(property.Value.GetString());
                    continue;
                }
            }
            return(new CreationData(createOption, storageAccountId.Value, imageReference.Value, galleryImageReference.Value, sourceUri.Value, sourceResourceId.Value, sourceUniqueId.Value, Optional.ToNullable(uploadSizeBytes), Optional.ToNullable(logicalSectorSize), securityDataUri.Value));
        }
Esempio n. 4
0
 public CreationData(DiskCreateOption createOption)
 {
     CreateOption = createOption;
 }
        internal static CreationData DeserializeCreationData(JsonElement element)
        {
            DiskCreateOption   createOption          = default;
            string             storageAccountId      = default;
            ImageDiskReference imageReference        = default;
            ImageDiskReference galleryImageReference = default;
            string             sourceUri             = default;
            string             sourceResourceId      = default;
            string             sourceUniqueId        = default;
            long?uploadSizeBytes = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("createOption"))
                {
                    createOption = new DiskCreateOption(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("storageAccountId"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    storageAccountId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("imageReference"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    imageReference = ImageDiskReference.DeserializeImageDiskReference(property.Value);
                    continue;
                }
                if (property.NameEquals("galleryImageReference"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    galleryImageReference = ImageDiskReference.DeserializeImageDiskReference(property.Value);
                    continue;
                }
                if (property.NameEquals("sourceUri"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    sourceUri = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("sourceResourceId"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    sourceResourceId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("sourceUniqueId"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    sourceUniqueId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("uploadSizeBytes"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    uploadSizeBytes = property.Value.GetInt64();
                    continue;
                }
            }
            return(new CreationData(createOption, storageAccountId, imageReference, galleryImageReference, sourceUri, sourceResourceId, sourceUniqueId, uploadSizeBytes));
        }