Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the ImageUpdate class.
 /// </summary>
 /// <param name="tags">Resource tags</param>
 /// <param name="sourceVirtualMachine">The source virtual machine from
 /// which Image is created.</param>
 /// <param name="storageProfile">Specifies the storage settings for the
 /// virtual machine disks.</param>
 /// <param name="provisioningState">The provisioning state.</param>
 public ImageUpdate(IDictionary <string, string> tags = default(IDictionary <string, string>), SubResource sourceVirtualMachine = default(SubResource), ImageStorageProfile storageProfile = default(ImageStorageProfile), string provisioningState = default(string))
     : base(tags)
 {
     SourceVirtualMachine = sourceVirtualMachine;
     StorageProfile       = storageProfile;
     ProvisioningState    = provisioningState;
     CustomInit();
 }
 /// <summary>
 /// Initializes a new instance of the ImageUpdate class.
 /// </summary>
 /// <param name="tags">Resource tags</param>
 /// <param name="id">Resource Id</param>
 /// <param name="name">Resource name</param>
 /// <param name="type">Resource type</param>
 /// <param name="sourceVirtualMachine">The source virtual machine from
 /// which Image is created.</param>
 /// <param name="storageProfile">Specifies the storage settings for the
 /// virtual machine disks.</param>
 /// <param name="provisioningState">The provisioning state.</param>
 /// <param name="hyperVGeneration">Gets the HyperVGenerationType of the
 /// VirtualMachine created from the image. Possible values include:
 /// 'V1', 'V2'</param>
 public ImageUpdate(IDictionary <string, string> tags = default(IDictionary <string, string>), string id = default(string), string name = default(string), string type = default(string), SubResource sourceVirtualMachine = default(SubResource), ImageStorageProfile storageProfile = default(ImageStorageProfile), string provisioningState = default(string), string hyperVGeneration = default(string))
     : base(tags, id, name, type)
 {
     SourceVirtualMachine = sourceVirtualMachine;
     StorageProfile       = storageProfile;
     ProvisioningState    = provisioningState;
     HyperVGeneration     = hyperVGeneration;
     CustomInit();
 }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the Image class.
 /// </summary>
 /// <param name="location">Resource location</param>
 /// <param name="id">Resource Id</param>
 /// <param name="name">Resource name</param>
 /// <param name="type">Resource type</param>
 /// <param name="tags">Resource tags</param>
 /// <param name="sourceVirtualMachine">The source virtual machine from
 /// which Image is created.</param>
 /// <param name="storageProfile">Specifies the storage settings for the
 /// virtual machine disks.</param>
 /// <param name="provisioningState">The provisioning state.</param>
 /// <param name="hyperVGeneration">Specifies the HyperVGenerationType
 /// of the VirtualMachine created from the image. From API Version
 /// 2019-03-01 if the image source is a blob, then we need the user to
 /// specify the value, if the source is managed resource like disk or
 /// snapshot, we may require the user to specify the property if we
 /// cannot deduce it from the source managed resource. Possible values
 /// include: 'V1', 'V2'</param>
 /// <param name="extendedLocation">The extended location of the
 /// Image.</param>
 public Image(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary <string, string> tags = default(IDictionary <string, string>), SubResource sourceVirtualMachine = default(SubResource), ImageStorageProfile storageProfile = default(ImageStorageProfile), string provisioningState = default(string), string hyperVGeneration = default(string), ExtendedLocation extendedLocation = default(ExtendedLocation))
     : base(location, id, name, type, tags)
 {
     SourceVirtualMachine = sourceVirtualMachine;
     StorageProfile       = storageProfile;
     ProvisioningState    = provisioningState;
     HyperVGeneration     = hyperVGeneration;
     ExtendedLocation     = extendedLocation;
     CustomInit();
 }
        private void Run()
        {
            WriteWarning("New-AzureRmImageConfig: 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");

            // SourceVirtualMachine
            Microsoft.Azure.Management.Compute.Models.SubResource vSourceVirtualMachine = null;

            // StorageProfile
            Microsoft.Azure.Management.Compute.Models.ImageStorageProfile vStorageProfile = null;

            if (this.MyInvocation.BoundParameters.ContainsKey("SourceVirtualMachineId"))
            {
                if (vSourceVirtualMachine == null)
                {
                    vSourceVirtualMachine = new Microsoft.Azure.Management.Compute.Models.SubResource();
                }
                vSourceVirtualMachine.Id = this.SourceVirtualMachineId;
            }

            if (this.MyInvocation.BoundParameters.ContainsKey("OsDisk"))
            {
                if (vStorageProfile == null)
                {
                    vStorageProfile = new Microsoft.Azure.Management.Compute.Models.ImageStorageProfile();
                }
                vStorageProfile.OsDisk = this.OsDisk;
            }

            if (this.MyInvocation.BoundParameters.ContainsKey("DataDisk"))
            {
                if (vStorageProfile == null)
                {
                    vStorageProfile = new Microsoft.Azure.Management.Compute.Models.ImageStorageProfile();
                }
                vStorageProfile.DataDisks = this.DataDisk;
            }

            if (vStorageProfile == null)
            {
                vStorageProfile = new Microsoft.Azure.Management.Compute.Models.ImageStorageProfile();
            }
            vStorageProfile.ZoneResilient = this.ZoneResilient.IsPresent;

            var vImage = new PSImage
            {
                Location             = this.MyInvocation.BoundParameters.ContainsKey("Location") ? this.Location : null,
                Tags                 = this.MyInvocation.BoundParameters.ContainsKey("Tag") ? this.Tag.Cast <DictionaryEntry>().ToDictionary(ht => (string)ht.Key, ht => (string)ht.Value) : null,
                SourceVirtualMachine = vSourceVirtualMachine,
                StorageProfile       = vStorageProfile,
            };

            WriteObject(vImage);
        }
Exemplo n.º 5
0
        private void Run()
        {
            // SourceVirtualMachine
            Microsoft.Azure.Management.Compute.Models.SubResource vSourceVirtualMachine = null;

            // StorageProfile
            Microsoft.Azure.Management.Compute.Models.ImageStorageProfile vStorageProfile = null;

            if (this.MyInvocation.BoundParameters.ContainsKey("SourceVirtualMachineId"))
            {
                if (vSourceVirtualMachine == null)
                {
                    vSourceVirtualMachine = new Microsoft.Azure.Management.Compute.Models.SubResource();
                }
                vSourceVirtualMachine.Id = this.SourceVirtualMachineId;
            }

            if (this.MyInvocation.BoundParameters.ContainsKey("OsDisk"))
            {
                if (vStorageProfile == null)
                {
                    vStorageProfile = new Microsoft.Azure.Management.Compute.Models.ImageStorageProfile();
                }
                vStorageProfile.OsDisk = this.OsDisk;
            }

            if (this.MyInvocation.BoundParameters.ContainsKey("DataDisk"))
            {
                if (vStorageProfile == null)
                {
                    vStorageProfile = new Microsoft.Azure.Management.Compute.Models.ImageStorageProfile();
                }
                vStorageProfile.DataDisks = this.DataDisk;
            }

            if (vStorageProfile == null)
            {
                vStorageProfile = new Microsoft.Azure.Management.Compute.Models.ImageStorageProfile();
            }
            vStorageProfile.ZoneResilient = this.ZoneResilient.IsPresent;

            var vImage = new PSImage
            {
                Location             = this.MyInvocation.BoundParameters.ContainsKey("Location") ? this.Location : null,
                Tags                 = this.MyInvocation.BoundParameters.ContainsKey("Tag") ? this.Tag.Cast <DictionaryEntry>().ToDictionary(ht => (string)ht.Key, ht => (string)ht.Value) : null,
                SourceVirtualMachine = vSourceVirtualMachine,
                StorageProfile       = vStorageProfile,
            };

            WriteObject(vImage);
        }
        private void Run()
        {
            // SourceVirtualMachine
            Microsoft.Azure.Management.Compute.Models.SubResource vSourceVirtualMachine = null;

            // StorageProfile
            Microsoft.Azure.Management.Compute.Models.ImageStorageProfile vStorageProfile = null;

            if (this.SourceVirtualMachineId != null)
            {
                if (vSourceVirtualMachine == null)
                {
                    vSourceVirtualMachine = new Microsoft.Azure.Management.Compute.Models.SubResource();
                }
                vSourceVirtualMachine.Id = this.SourceVirtualMachineId;
            }

            if (this.OsDisk != null)
            {
                if (vStorageProfile == null)
                {
                    vStorageProfile = new Microsoft.Azure.Management.Compute.Models.ImageStorageProfile();
                }
                vStorageProfile.OsDisk = this.OsDisk;
            }

            if (this.DataDisk != null)
            {
                if (vStorageProfile == null)
                {
                    vStorageProfile = new Microsoft.Azure.Management.Compute.Models.ImageStorageProfile();
                }
                vStorageProfile.DataDisks = this.DataDisk;
            }


            var vImage = new PSImage
            {
                Location             = this.Location,
                Tags                 = (this.Tag == null) ? null : this.Tag.Cast <DictionaryEntry>().ToDictionary(ht => (string)ht.Key, ht => (string)ht.Value),
                SourceVirtualMachine = vSourceVirtualMachine,
                StorageProfile       = vStorageProfile,
            };

            WriteObject(vImage);
        }