Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the Snapshot class.
 /// </summary>
 /// <param name="location">Resource location</param>
 /// <param name="creationData">Disk source information. CreationData
 /// information cannot be changed after the disk has been
 /// created.</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="managedBy">Unused. Always Null.</param>
 /// <param name="extendedLocation">The extended location where the
 /// snapshot will be created. Extended location cannot be
 /// changed.</param>
 /// <param name="timeCreated">The time when the snapshot was
 /// created.</param>
 /// <param name="osType">The Operating System type. Possible values
 /// include: 'Windows', 'Linux'</param>
 /// <param name="hyperVGeneration">The hypervisor generation of the
 /// Virtual Machine. Applicable to OS disks only. Possible values
 /// include: 'V1', 'V2'</param>
 /// <param name="purchasePlan">Purchase plan information for the image
 /// from which the source disk for the snapshot was originally
 /// created.</param>
 /// <param name="supportedCapabilities">List of supported capabilities
 /// for the image from which the source disk from the snapshot was
 /// originally created.</param>
 /// <param name="diskSizeGB">If creationData.createOption is Empty,
 /// this field is mandatory and it indicates the size of the disk to
 /// create. If this field is present for updates or creation with other
 /// options, it indicates a resize. Resizes are only allowed if the
 /// disk is not attached to a running VM, and can only increase the
 /// disk's size.</param>
 /// <param name="diskSizeBytes">The size of the disk in bytes. This
 /// field is read only.</param>
 /// <param name="diskState">The state of the snapshot. Possible values
 /// include: 'Unattached', 'Attached', 'Reserved', 'Frozen',
 /// 'ActiveSAS', 'ActiveSASFrozen', 'ReadyToUpload',
 /// 'ActiveUpload'</param>
 /// <param name="uniqueId">Unique Guid identifying the
 /// resource.</param>
 /// <param name="encryptionSettingsCollection">Encryption settings
 /// collection used be Azure Disk Encryption, can contain multiple
 /// encryption settings per disk or snapshot.</param>
 /// <param name="provisioningState">The disk provisioning
 /// state.</param>
 /// <param name="incremental">Whether a snapshot is incremental.
 /// Incremental snapshots on the same disk occupy less space than full
 /// snapshots and can be diffed.</param>
 /// <param name="encryption">Encryption property can be used to encrypt
 /// data at rest with customer managed keys or platform managed
 /// keys.</param>
 /// <param name="networkAccessPolicy">Possible values include:
 /// 'AllowAll', 'AllowPrivate', 'DenyAll'</param>
 /// <param name="diskAccessId">ARM id of the DiskAccess resource for
 /// using private endpoints on disks.</param>
 /// <param name="securityProfile">Contains the security related
 /// information for the resource.</param>
 /// <param name="supportsHibernation">Indicates the OS on a snapshot
 /// supports hibernation.</param>
 /// <param name="publicNetworkAccess">Possible values include:
 /// 'Enabled', 'Disabled'</param>
 /// <param name="completionPercent">Percentage complete for the
 /// background copy when a resource is created via the CopyStart
 /// operation.</param>
 /// <param name="dataAccessAuthMode">Possible values include:
 /// 'AzureActiveDirectory', 'None'</param>
 public Snapshot(string location, CreationData creationData, string id = default(string), string name = default(string), string type = default(string), IDictionary <string, string> tags = default(IDictionary <string, string>), string managedBy = default(string), SnapshotSku sku = default(SnapshotSku), ExtendedLocation extendedLocation = default(ExtendedLocation), System.DateTime?timeCreated = default(System.DateTime?), OperatingSystemTypes?osType = default(OperatingSystemTypes?), string hyperVGeneration = default(string), PurchasePlan purchasePlan = default(PurchasePlan), SupportedCapabilities supportedCapabilities = default(SupportedCapabilities), int?diskSizeGB = default(int?), long?diskSizeBytes = default(long?), string diskState = default(string), string uniqueId = default(string), EncryptionSettingsCollection encryptionSettingsCollection = default(EncryptionSettingsCollection), string provisioningState = default(string), bool?incremental = default(bool?), Encryption encryption = default(Encryption), string networkAccessPolicy = default(string), string diskAccessId = default(string), DiskSecurityProfile securityProfile = default(DiskSecurityProfile), bool?supportsHibernation = default(bool?), string publicNetworkAccess = default(string), double?completionPercent = default(double?), string dataAccessAuthMode = default(string))
     : base(location, id, name, type, tags)
 {
     ManagedBy                    = managedBy;
     Sku                          = sku;
     ExtendedLocation             = extendedLocation;
     TimeCreated                  = timeCreated;
     OsType                       = osType;
     HyperVGeneration             = hyperVGeneration;
     PurchasePlan                 = purchasePlan;
     SupportedCapabilities        = supportedCapabilities;
     CreationData                 = creationData;
     DiskSizeGB                   = diskSizeGB;
     DiskSizeBytes                = diskSizeBytes;
     DiskState                    = diskState;
     UniqueId                     = uniqueId;
     EncryptionSettingsCollection = encryptionSettingsCollection;
     ProvisioningState            = provisioningState;
     Incremental                  = incremental;
     Encryption                   = encryption;
     NetworkAccessPolicy          = networkAccessPolicy;
     DiskAccessId                 = diskAccessId;
     SecurityProfile              = securityProfile;
     SupportsHibernation          = supportsHibernation;
     PublicNetworkAccess          = publicNetworkAccess;
     CompletionPercent            = completionPercent;
     DataAccessAuthMode           = dataAccessAuthMode;
     CustomInit();
 }
Ejemplo n.º 2
0
        private void Run()
        {
            // EncryptionSettings
            Microsoft.Azure.Management.Compute.Models.EncryptionSettings vEncryptionSettings = null;

            // Sku
            Microsoft.Azure.Management.Compute.Models.SnapshotSku vSku = null;

            if (this.MyInvocation.BoundParameters.ContainsKey("EncryptionSettingsEnabled"))
            {
                if (vEncryptionSettings == null)
                {
                    vEncryptionSettings = new Microsoft.Azure.Management.Compute.Models.EncryptionSettings();
                }
                vEncryptionSettings.Enabled = this.EncryptionSettingsEnabled;
            }

            if (this.MyInvocation.BoundParameters.ContainsKey("DiskEncryptionKey"))
            {
                if (vEncryptionSettings == null)
                {
                    vEncryptionSettings = new Microsoft.Azure.Management.Compute.Models.EncryptionSettings();
                }
                vEncryptionSettings.DiskEncryptionKey = this.DiskEncryptionKey;
            }

            if (this.MyInvocation.BoundParameters.ContainsKey("KeyEncryptionKey"))
            {
                if (vEncryptionSettings == null)
                {
                    vEncryptionSettings = new Microsoft.Azure.Management.Compute.Models.EncryptionSettings();
                }
                vEncryptionSettings.KeyEncryptionKey = this.KeyEncryptionKey;
            }

            if (this.MyInvocation.BoundParameters.ContainsKey("SkuName"))
            {
                if (vSku == null)
                {
                    vSku = new Microsoft.Azure.Management.Compute.Models.SnapshotSku();
                }
                vSku.Name = this.SkuName;
            }

            var vSnapshotUpdate = new PSSnapshotUpdate
            {
                OsType             = this.MyInvocation.BoundParameters.ContainsKey("OsType") ? this.OsType : (OperatingSystemTypes?)null,
                DiskSizeGB         = this.MyInvocation.BoundParameters.ContainsKey("DiskSizeGB") ? this.DiskSizeGB : (int?)null,
                Tags               = this.MyInvocation.BoundParameters.ContainsKey("Tag") ? this.Tag.Cast <DictionaryEntry>().ToDictionary(ht => (string)ht.Key, ht => (string)ht.Value) : null,
                EncryptionSettings = vEncryptionSettings,
                Sku = new DiskSku
                {
                    Name = vSku.Name.ToString()
                }
            };

            WriteObject(vSnapshotUpdate);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the SnapshotUpdate class.
 /// </summary>
 /// <param name="osType">the Operating System type. Possible values
 /// include: 'Windows', 'Linux'</param>
 /// <param name="diskSizeGB">If creationData.createOption is Empty,
 /// this field is mandatory and it indicates the size of the disk to
 /// create. If this field is present for updates or creation with other
 /// options, it indicates a resize. Resizes are only allowed if the
 /// disk is not attached to a running VM, and can only increase the
 /// disk's size.</param>
 /// <param name="encryptionSettingsCollection">Encryption settings
 /// collection used be Azure Disk Encryption, can contain multiple
 /// encryption settings per disk or snapshot.</param>
 /// <param name="tags">Resource tags</param>
 public SnapshotUpdate(OperatingSystemTypes?osType = default(OperatingSystemTypes?), int?diskSizeGB = default(int?), EncryptionSettingsCollection encryptionSettingsCollection = default(EncryptionSettingsCollection), IDictionary <string, string> tags = default(IDictionary <string, string>), SnapshotSku sku = default(SnapshotSku))
 {
     OsType     = osType;
     DiskSizeGB = diskSizeGB;
     EncryptionSettingsCollection = encryptionSettingsCollection;
     Tags = tags;
     Sku  = sku;
     CustomInit();
 }
 public SnapshotUpdate(OperatingSystemTypes?osType, int?diskSizeGB, EncryptionSettingsCollection encryptionSettingsCollection, Encryption encryption, string networkAccessPolicy, string diskAccessId, IDictionary <string, string> tags, SnapshotSku sku)
 {
     OsType     = osType;
     DiskSizeGB = diskSizeGB;
     EncryptionSettingsCollection = encryptionSettingsCollection;
     Encryption          = encryption;
     NetworkAccessPolicy = networkAccessPolicy;
     DiskAccessId        = diskAccessId;
     Tags = tags;
     Sku  = sku;
     CustomInit();
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the SnapshotUpdate class.
 /// </summary>
 /// <param name="osType">the Operating System type. Possible values
 /// include: 'Windows', 'Linux'</param>
 /// <param name="diskSizeGB">If creationData.createOption is Empty,
 /// this field is mandatory and it indicates the size of the disk to
 /// create. If this field is present for updates or creation with other
 /// options, it indicates a resize. Resizes are only allowed if the
 /// disk is not attached to a running VM, and can only increase the
 /// disk's size.</param>
 /// <param name="encryptionSettingsCollection">Encryption settings
 /// collection used be Azure Disk Encryption, can contain multiple
 /// encryption settings per disk or snapshot.</param>
 /// <param name="encryption">Encryption property can be used to encrypt
 /// data at rest with customer managed keys or platform managed
 /// keys.</param>
 /// <param name="networkAccessPolicy">Possible values include:
 /// 'AllowAll', 'AllowPrivate', 'DenyAll'</param>
 /// <param name="diskAccessId">ARM id of the DiskAccess resource for
 /// using private endpoints on disks.</param>
 /// <param name="supportsHibernation">Indicates the OS on a snapshot
 /// supports hibernation.</param>
 /// <param name="tags">Resource tags</param>
 public SnapshotUpdate(OperatingSystemTypes?osType = default(OperatingSystemTypes?), int?diskSizeGB = default(int?), EncryptionSettingsCollection encryptionSettingsCollection = default(EncryptionSettingsCollection), Encryption encryption = default(Encryption), string networkAccessPolicy = default(string), string diskAccessId = default(string), bool?supportsHibernation = default(bool?), IDictionary <string, string> tags = default(IDictionary <string, string>), SnapshotSku sku = default(SnapshotSku))
 {
     OsType     = osType;
     DiskSizeGB = diskSizeGB;
     EncryptionSettingsCollection = encryptionSettingsCollection;
     Encryption          = encryption;
     NetworkAccessPolicy = networkAccessPolicy;
     DiskAccessId        = diskAccessId;
     SupportsHibernation = supportsHibernation;
     Tags = tags;
     Sku  = sku;
     CustomInit();
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the Snapshot class.
 /// </summary>
 /// <param name="location">Resource location</param>
 /// <param name="creationData">Disk source information. CreationData
 /// information cannot be changed after the disk has been
 /// created.</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="managedBy">Unused. Always Null.</param>
 /// <param name="timeCreated">The time when the disk was
 /// created.</param>
 /// <param name="osType">The Operating System type. Possible values
 /// include: 'Windows', 'Linux'</param>
 /// <param name="diskSizeGB">If creationData.createOption is Empty,
 /// this field is mandatory and it indicates the size of the VHD to
 /// create. If this field is present for updates or creation with other
 /// options, it indicates a resize. Resizes are only allowed if the
 /// disk is not attached to a running VM, and can only increase the
 /// disk's size.</param>
 /// <param name="encryptionSettings">Encryption settings for disk or
 /// snapshot</param>
 /// <param name="provisioningState">The disk provisioning
 /// state.</param>
 public Snapshot(string location, CreationData creationData, string id = default(string), string name = default(string), string type = default(string), IDictionary <string, string> tags = default(IDictionary <string, string>), string managedBy = default(string), SnapshotSku sku = default(SnapshotSku), System.DateTime?timeCreated = default(System.DateTime?), OperatingSystemTypes?osType = default(OperatingSystemTypes?), int?diskSizeGB = default(int?), EncryptionSettings encryptionSettings = default(EncryptionSettings), string provisioningState = default(string))
     : base(location, id, name, type, tags)
 {
     ManagedBy          = managedBy;
     Sku                = sku;
     TimeCreated        = timeCreated;
     OsType             = osType;
     CreationData       = creationData;
     DiskSizeGB         = diskSizeGB;
     EncryptionSettings = encryptionSettings;
     ProvisioningState  = provisioningState;
     CustomInit();
 }
 public SnapshotUpdate(OperatingSystemTypes?osType, int?diskSizeGB, EncryptionSettingsCollection encryptionSettingsCollection, Encryption encryption, string networkAccessPolicy, string diskAccessId, bool?supportsHibernation, string publicNetworkAccess, SupportedCapabilities supportedCapabilities, IDictionary <string, string> tags = default(IDictionary <string, string>), SnapshotSku sku = default(SnapshotSku))
 {
     OsType     = osType;
     DiskSizeGB = diskSizeGB;
     EncryptionSettingsCollection = encryptionSettingsCollection;
     Encryption            = encryption;
     NetworkAccessPolicy   = networkAccessPolicy;
     DiskAccessId          = diskAccessId;
     SupportsHibernation   = supportsHibernation;
     PublicNetworkAccess   = publicNetworkAccess;
     SupportedCapabilities = supportedCapabilities;
     Tags = tags;
     Sku  = sku;
     CustomInit();
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the Snapshot class.
 /// </summary>
 /// <param name="location">Resource location</param>
 /// <param name="creationData">Disk source information. CreationData
 /// information cannot be changed after the disk has been
 /// created.</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="managedBy">Unused. Always Null.</param>
 /// <param name="timeCreated">The time when the disk was
 /// created.</param>
 /// <param name="osType">The Operating System type. Possible values
 /// include: 'Windows', 'Linux'</param>
 /// <param name="hyperVGeneration">The hypervisor generation of the
 /// Virtual Machine. Applicable to OS disks only. Possible values
 /// include: 'V1', 'V2'</param>
 /// <param name="diskSizeGB">If creationData.createOption is Empty,
 /// this field is mandatory and it indicates the size of the disk to
 /// create. If this field is present for updates or creation with other
 /// options, it indicates a resize. Resizes are only allowed if the
 /// disk is not attached to a running VM, and can only increase the
 /// disk's size.</param>
 /// <param name="diskSizeBytes">The size of the disk in bytes. This
 /// field is read only.</param>
 /// <param name="uniqueId">Unique Guid identifying the
 /// resource.</param>
 /// <param name="encryptionSettingsCollection">Encryption settings
 /// collection used be Azure Disk Encryption, can contain multiple
 /// encryption settings per disk or snapshot.</param>
 /// <param name="provisioningState">The disk provisioning
 /// state.</param>
 /// <param name="incremental">Whether a snapshot is incremental.
 /// Incremental snapshots on the same disk occupy less space than full
 /// snapshots and can be diffed.</param>
 public Snapshot(string location, CreationData creationData, string id = default(string), string name = default(string), string type = default(string), IDictionary <string, string> tags = default(IDictionary <string, string>), string managedBy = default(string), SnapshotSku sku = default(SnapshotSku), System.DateTime?timeCreated = default(System.DateTime?), OperatingSystemTypes?osType = default(OperatingSystemTypes?), string hyperVGeneration = default(string), int?diskSizeGB = default(int?), long?diskSizeBytes = default(long?), string uniqueId = default(string), EncryptionSettingsCollection encryptionSettingsCollection = default(EncryptionSettingsCollection), string provisioningState = default(string), bool?incremental = default(bool?))
     : base(location, id, name, type, tags)
 {
     ManagedBy                    = managedBy;
     Sku                          = sku;
     TimeCreated                  = timeCreated;
     OsType                       = osType;
     HyperVGeneration             = hyperVGeneration;
     CreationData                 = creationData;
     DiskSizeGB                   = diskSizeGB;
     DiskSizeBytes                = diskSizeBytes;
     UniqueId                     = uniqueId;
     EncryptionSettingsCollection = encryptionSettingsCollection;
     ProvisioningState            = provisioningState;
     Incremental                  = incremental;
     CustomInit();
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the Snapshot class.
 /// </summary>
 /// <param name="location">Resource location</param>
 /// <param name="creationData">Disk source information. CreationData
 /// information cannot be changed after the disk has been
 /// created.</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="managedBy">Unused. Always Null.</param>
 /// <param name="extendedLocation">The extended location where the
 /// snapshot will be created. Extended location cannot be
 /// changed.</param>
 /// <param name="timeCreated">The time when the snapshot was
 /// created.</param>
 /// <param name="osType">The Operating System type. Possible values
 /// include: 'Windows', 'Linux'</param>
 /// <param name="hyperVGeneration">The hypervisor generation of the
 /// Virtual Machine. Applicable to OS disks only. Possible values
 /// include: 'V1', 'V2'</param>
 /// <param name="purchasePlan">Purchase plan information for the image
 /// from which the source disk for the snapshot was originally
 /// created.</param>
 /// <param name="diskSizeGB">If creationData.createOption is Empty,
 /// this field is mandatory and it indicates the size of the disk to
 /// create. If this field is present for updates or creation with other
 /// options, it indicates a resize. Resizes are only allowed if the
 /// disk is not attached to a running VM, and can only increase the
 /// disk's size.</param>
 /// <param name="diskSizeBytes">The size of the disk in bytes. This
 /// field is read only.</param>
 /// <param name="diskState">The state of the snapshot. Possible values
 /// include: 'Unattached', 'Attached', 'Reserved', 'Frozen',
 /// 'ActiveSAS', 'ActiveSASFrozen', 'ReadyToUpload',
 /// 'ActiveUpload'</param>
 /// <param name="uniqueId">Unique Guid identifying the
 /// resource.</param>
 /// <param name="encryptionSettingsCollection">Encryption settings
 /// collection used be Azure Disk Encryption, can contain multiple
 /// encryption settings per disk or snapshot.</param>
 /// <param name="provisioningState">The disk provisioning
 /// state.</param>
 /// <param name="incremental">Whether a snapshot is incremental.
 /// Incremental snapshots on the same disk occupy less space than full
 /// snapshots and can be diffed.</param>
 /// <param name="encryption">Encryption property can be used to encrypt
 /// data at rest with customer managed keys or platform managed
 /// keys.</param>
 /// <param name="networkAccessPolicy">Possible values include:
 /// 'AllowAll', 'AllowPrivate', 'DenyAll'</param>
 /// <param name="diskAccessId">ARM id of the DiskAccess resource for
 /// using private endpoints on disks.</param>
 /// <param name="supportsHibernation">Indicates the OS on a snapshot
 /// supports hibernation.</param>
 /// <param name="publicNetworkAccess">Possible values include:
 /// 'Enabled', 'Disabled'</param>
 /// <param name="completionPercent">Percentage complete for the
 /// background copy when a resource is created via the CopyStart
 /// operation.</param>
 /// <param name="supportedCapabilities">List of supported capabilities
 /// (like Accelerated Networking) for the image from which the source
 /// disk from the snapshot was originally created.</param>
 public Snapshot(string location, CreationData creationData, string id, string name, string type, IDictionary <string, string> tags, string managedBy, SnapshotSku sku, ExtendedLocation extendedLocation, System.DateTime?timeCreated, OperatingSystemTypes?osType, string hyperVGeneration, PurchasePlan purchasePlan, int?diskSizeGB, long?diskSizeBytes = default(long?), string diskState = default(string), string uniqueId = default(string), EncryptionSettingsCollection encryptionSettingsCollection = default(EncryptionSettingsCollection), string provisioningState = default(string), bool?incremental = default(bool?), Encryption encryption = default(Encryption), string networkAccessPolicy = default(string), string diskAccessId = default(string), bool?supportsHibernation = default(bool?))
     : base(location, id, name, type, tags)
 {
     ManagedBy                    = managedBy;
     Sku                          = sku;
     ExtendedLocation             = extendedLocation;
     TimeCreated                  = timeCreated;
     OsType                       = osType;
     HyperVGeneration             = hyperVGeneration;
     PurchasePlan                 = purchasePlan;
     CreationData                 = creationData;
     DiskSizeGB                   = diskSizeGB;
     DiskSizeBytes                = diskSizeBytes;
     DiskState                    = diskState;
     UniqueId                     = uniqueId;
     EncryptionSettingsCollection = encryptionSettingsCollection;
     ProvisioningState            = provisioningState;
     Incremental                  = incremental;
     Encryption                   = encryption;
     NetworkAccessPolicy          = networkAccessPolicy;
     DiskAccessId                 = diskAccessId;
     SupportsHibernation          = supportsHibernation;
     CustomInit();
 }
Ejemplo n.º 10
0
        private void Run()
        {
            WriteWarning("New-AzureRmSnapshotConfig: A property of the output of this cmdlet will change in an upcoming breaking change release. " +
                         "The Name property for a Sku will return Standard_LRS and Premium_LRS");

            // Sku
            Microsoft.Azure.Management.Compute.Models.SnapshotSku vSku = null;

            // CreationData
            Microsoft.Azure.Management.Compute.Models.CreationData vCreationData = null;

            // EncryptionSettings
            Microsoft.Azure.Management.Compute.Models.EncryptionSettings vEncryptionSettings = null;

            if (this.MyInvocation.BoundParameters.ContainsKey("SkuName"))
            {
                WriteWarning("New-AzureRmSnapshotConfig: The accepted values for parameter SkuName will change in an upcoming breaking change release " +
                             "from StandardLRS and PremiumLRS to Standard_LRS and Premium_LRS, respectively.");
                if (vSku == null)
                {
                    vSku = new Microsoft.Azure.Management.Compute.Models.SnapshotSku();
                }
                vSku.Name = this.SkuName;
            }

            if (this.MyInvocation.BoundParameters.ContainsKey("CreateOption"))
            {
                if (vCreationData == null)
                {
                    vCreationData = new Microsoft.Azure.Management.Compute.Models.CreationData();
                }
                vCreationData.CreateOption = this.CreateOption;
            }

            if (this.MyInvocation.BoundParameters.ContainsKey("StorageAccountId"))
            {
                if (vCreationData == null)
                {
                    vCreationData = new Microsoft.Azure.Management.Compute.Models.CreationData();
                }
                vCreationData.StorageAccountId = this.StorageAccountId;
            }

            if (this.MyInvocation.BoundParameters.ContainsKey("ImageReference"))
            {
                if (vCreationData == null)
                {
                    vCreationData = new Microsoft.Azure.Management.Compute.Models.CreationData();
                }
                vCreationData.ImageReference = this.ImageReference;
            }

            if (this.MyInvocation.BoundParameters.ContainsKey("SourceUri"))
            {
                if (vCreationData == null)
                {
                    vCreationData = new Microsoft.Azure.Management.Compute.Models.CreationData();
                }
                vCreationData.SourceUri = this.SourceUri;
            }

            if (this.MyInvocation.BoundParameters.ContainsKey("SourceResourceId"))
            {
                if (vCreationData == null)
                {
                    vCreationData = new Microsoft.Azure.Management.Compute.Models.CreationData();
                }
                vCreationData.SourceResourceId = this.SourceResourceId;
            }

            if (this.MyInvocation.BoundParameters.ContainsKey("EncryptionSettingsEnabled"))
            {
                if (vEncryptionSettings == null)
                {
                    vEncryptionSettings = new Microsoft.Azure.Management.Compute.Models.EncryptionSettings();
                }
                vEncryptionSettings.Enabled = this.EncryptionSettingsEnabled;
            }

            if (this.MyInvocation.BoundParameters.ContainsKey("DiskEncryptionKey"))
            {
                if (vEncryptionSettings == null)
                {
                    vEncryptionSettings = new Microsoft.Azure.Management.Compute.Models.EncryptionSettings();
                }
                vEncryptionSettings.DiskEncryptionKey = this.DiskEncryptionKey;
            }

            if (this.MyInvocation.BoundParameters.ContainsKey("KeyEncryptionKey"))
            {
                if (vEncryptionSettings == null)
                {
                    vEncryptionSettings = new Microsoft.Azure.Management.Compute.Models.EncryptionSettings();
                }
                vEncryptionSettings.KeyEncryptionKey = this.KeyEncryptionKey;
            }

            var vSnapshot = new PSSnapshot
            {
                OsType             = this.MyInvocation.BoundParameters.ContainsKey("OsType") ? this.OsType : (OperatingSystemTypes?)null,
                DiskSizeGB         = this.MyInvocation.BoundParameters.ContainsKey("DiskSizeGB") ? this.DiskSizeGB : (int?)null,
                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,
                Sku                = vSku,
                CreationData       = vCreationData,
                EncryptionSettings = vEncryptionSettings,
            };

            WriteObject(vSnapshot);
        }
Ejemplo n.º 11
0
        private void Run()
        {
            // Sku
            Microsoft.Azure.Management.Compute.Models.SnapshotSku vSku = null;

            // CreationData
            Microsoft.Azure.Management.Compute.Models.CreationData vCreationData = null;

            // EncryptionSettings
            Microsoft.Azure.Management.Compute.Models.EncryptionSettings vEncryptionSettings = null;

            if (this.MyInvocation.BoundParameters.ContainsKey("SkuName"))
            {
                if (vSku == null)
                {
                    vSku = new Microsoft.Azure.Management.Compute.Models.SnapshotSku();
                }
                vSku.Name = this.SkuName;
            }

            if (this.MyInvocation.BoundParameters.ContainsKey("CreateOption"))
            {
                if (vCreationData == null)
                {
                    vCreationData = new Microsoft.Azure.Management.Compute.Models.CreationData();
                }
                vCreationData.CreateOption = this.CreateOption;
            }

            if (this.MyInvocation.BoundParameters.ContainsKey("StorageAccountId"))
            {
                if (vCreationData == null)
                {
                    vCreationData = new Microsoft.Azure.Management.Compute.Models.CreationData();
                }
                vCreationData.StorageAccountId = this.StorageAccountId;
            }

            if (this.MyInvocation.BoundParameters.ContainsKey("ImageReference"))
            {
                if (vCreationData == null)
                {
                    vCreationData = new Microsoft.Azure.Management.Compute.Models.CreationData();
                }
                vCreationData.ImageReference = this.ImageReference;
            }

            if (this.MyInvocation.BoundParameters.ContainsKey("SourceUri"))
            {
                if (vCreationData == null)
                {
                    vCreationData = new Microsoft.Azure.Management.Compute.Models.CreationData();
                }
                vCreationData.SourceUri = this.SourceUri;
            }

            if (this.MyInvocation.BoundParameters.ContainsKey("SourceResourceId"))
            {
                if (vCreationData == null)
                {
                    vCreationData = new Microsoft.Azure.Management.Compute.Models.CreationData();
                }
                vCreationData.SourceResourceId = this.SourceResourceId;
            }

            if (this.MyInvocation.BoundParameters.ContainsKey("EncryptionSettingsEnabled"))
            {
                if (vEncryptionSettings == null)
                {
                    vEncryptionSettings = new Microsoft.Azure.Management.Compute.Models.EncryptionSettings();
                }
                vEncryptionSettings.Enabled = this.EncryptionSettingsEnabled;
            }

            if (this.MyInvocation.BoundParameters.ContainsKey("DiskEncryptionKey"))
            {
                if (vEncryptionSettings == null)
                {
                    vEncryptionSettings = new Microsoft.Azure.Management.Compute.Models.EncryptionSettings();
                }
                vEncryptionSettings.DiskEncryptionKey = this.DiskEncryptionKey;
            }

            if (this.MyInvocation.BoundParameters.ContainsKey("KeyEncryptionKey"))
            {
                if (vEncryptionSettings == null)
                {
                    vEncryptionSettings = new Microsoft.Azure.Management.Compute.Models.EncryptionSettings();
                }
                vEncryptionSettings.KeyEncryptionKey = this.KeyEncryptionKey;
            }

            var vSnapshot = new PSSnapshot
            {
                OsType             = this.MyInvocation.BoundParameters.ContainsKey("OsType") ? this.OsType : (OperatingSystemTypes?)null,
                DiskSizeGB         = this.MyInvocation.BoundParameters.ContainsKey("DiskSizeGB") ? this.DiskSizeGB : (int?)null,
                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,
                Sku                = vSku,
                CreationData       = vCreationData,
                EncryptionSettings = vEncryptionSettings,
            };

            WriteObject(vSnapshot);
        }