コード例 #1
0
        private void Run()
        {
            // StorageProfile
            if (this.Image.StorageProfile == null)
            {
                this.Image.StorageProfile = new Microsoft.Azure.Management.Compute.Models.ImageStorageProfile();
            }

            // DataDisks
            if (this.Image.StorageProfile.DataDisks == null)
            {
                this.Image.StorageProfile.DataDisks = new List <Microsoft.Azure.Management.Compute.Models.ImageDataDisk>();
            }

            var vDataDisks = new Microsoft.Azure.Management.Compute.Models.ImageDataDisk();

            vDataDisks.Lun        = this.Lun;
            vDataDisks.BlobUri    = this.BlobUri;
            vDataDisks.Caching    = this.Caching;
            vDataDisks.DiskSizeGB = this.DiskSizeGB;
            if (this.SnapshotId != null)
            {
                // Snapshot
                vDataDisks.Snapshot    = new Microsoft.Azure.Management.Compute.Models.SubResource();
                vDataDisks.Snapshot.Id = this.SnapshotId;
            }
            if (this.ManagedDiskId != null)
            {
                // ManagedDisk
                vDataDisks.ManagedDisk    = new Microsoft.Azure.Management.Compute.Models.SubResource();
                vDataDisks.ManagedDisk.Id = this.ManagedDiskId;
            }
            this.Image.StorageProfile.DataDisks.Add(vDataDisks);
            WriteObject(this.Image);
        }
コード例 #2
0
        private void Run()
        {
            WriteWarning("Add-AzureRmImageDataDisk: A property of the output of this cmdlet will change in an upcoming breaking change release. " +
                         "The StorageAccountType property for a DataDisk will return Standard_LRS and Premium_LRS");

            // StorageProfile
            if (this.Image.StorageProfile == null)
            {
                this.Image.StorageProfile = new Microsoft.Azure.Management.Compute.Models.ImageStorageProfile();
            }

            // DataDisks
            if (this.Image.StorageProfile.DataDisks == null)
            {
                this.Image.StorageProfile.DataDisks = new List <Microsoft.Azure.Management.Compute.Models.ImageDataDisk>();
            }

            var vDataDisks = new Microsoft.Azure.Management.Compute.Models.ImageDataDisk();

            vDataDisks.Lun        = this.Lun;
            vDataDisks.BlobUri    = this.MyInvocation.BoundParameters.ContainsKey("BlobUri") ? this.BlobUri : null;
            vDataDisks.Caching    = this.MyInvocation.BoundParameters.ContainsKey("Caching") ? this.Caching : (CachingTypes?)null;
            vDataDisks.DiskSizeGB = this.MyInvocation.BoundParameters.ContainsKey("DiskSizeGB") ? this.DiskSizeGB : (int?)null;
            if (this.MyInvocation.BoundParameters.ContainsKey("StorageAccountType"))
            {
                WriteWarning("Add-AzureRmImageDataDisk: The accepted values for parameter StorageAccountType will change in an upcoming breaking change release " +
                             "from StandardLRS and PremiumLRS to Standard_LRS and Premium_LRS, respectively.");
            }

            vDataDisks.StorageAccountType = this.MyInvocation.BoundParameters.ContainsKey("StorageAccountType") ? this.StorageAccountType : null;
            if (this.MyInvocation.BoundParameters.ContainsKey("SnapshotId"))
            {
                // Snapshot
                vDataDisks.Snapshot    = new Microsoft.Azure.Management.Compute.Models.SubResource();
                vDataDisks.Snapshot.Id = this.SnapshotId;
            }
            if (this.MyInvocation.BoundParameters.ContainsKey("ManagedDiskId"))
            {
                // ManagedDisk
                vDataDisks.ManagedDisk    = new Microsoft.Azure.Management.Compute.Models.SubResource();
                vDataDisks.ManagedDisk.Id = this.ManagedDiskId;
            }
            this.Image.StorageProfile.DataDisks.Add(vDataDisks);
            WriteObject(this.Image);
        }
コード例 #3
0
        private void Run()
        {
            // StorageProfile
            if (this.Image.StorageProfile == null)
            {
                this.Image.StorageProfile = new Microsoft.Azure.Management.Compute.Models.ImageStorageProfile();
            }

            // DataDisks
            if (this.Image.StorageProfile.DataDisks == null)
            {
                this.Image.StorageProfile.DataDisks = new List <Microsoft.Azure.Management.Compute.Models.ImageDataDisk>();
            }

            var vDataDisks = new Microsoft.Azure.Management.Compute.Models.ImageDataDisk();

            vDataDisks.Lun        = this.Lun;
            vDataDisks.BlobUri    = this.MyInvocation.BoundParameters.ContainsKey("BlobUri") ? this.BlobUri : null;
            vDataDisks.Caching    = this.MyInvocation.BoundParameters.ContainsKey("Caching") ? this.Caching : (CachingTypes?)null;
            vDataDisks.DiskSizeGB = this.MyInvocation.BoundParameters.ContainsKey("DiskSizeGB") ? this.DiskSizeGB : (int?)null;
            if (this.MyInvocation.BoundParameters.ContainsKey("StorageAccountType"))
            {
                vDataDisks.StorageAccountType = (StorageAccountTypes?)this.StorageAccountType;
            }
            if (this.MyInvocation.BoundParameters.ContainsKey("SnapshotId"))
            {
                // Snapshot
                vDataDisks.Snapshot    = new Microsoft.Azure.Management.Compute.Models.SubResource();
                vDataDisks.Snapshot.Id = this.SnapshotId;
            }
            if (this.MyInvocation.BoundParameters.ContainsKey("ManagedDiskId"))
            {
                // ManagedDisk
                vDataDisks.ManagedDisk    = new Microsoft.Azure.Management.Compute.Models.SubResource();
                vDataDisks.ManagedDisk.Id = this.ManagedDiskId;
            }
            this.Image.StorageProfile.DataDisks.Add(vDataDisks);
            WriteObject(this.Image);
        }