public override void ExecuteCmdlet()
        {
            if (ParameterSetName == ParentObjectParameterSet)
            {
                ResourceGroupName = VolumeObject.ResourceGroupName;
                Location          = VolumeObject.Location;
                var NameParts = VolumeObject.Name.Split('/');
                AccountName = NameParts[0];
                PoolName    = NameParts[1];
                VolumeName  = NameParts[2];
            }

            var subvolumeInfoBody = new Management.NetApp.Models.SubvolumeInfo()
            {
                Path       = Path,
                Size       = Size,
                ParentPath = ParentPath
            };

            if (ShouldProcess(Name, string.Format(PowerShell.Cmdlets.NetAppFiles.Properties.Resources.CreateResourceMessage, Name)))
            {
                var anfSubvolume = AzureNetAppFilesManagementClient.Subvolumes.Create(subvolumeInfoBody, ResourceGroupName, AccountName, poolName: PoolName, volumeName: VolumeName, subvolumeName: Name);
                WriteObject(anfSubvolume.ConvertToPs());
            }
        }
Ejemplo n.º 2
0
        public static PSNetAppFilesSubvolumeInfo ConvertToPs(this Management.NetApp.Models.SubvolumeInfo subvolumeInfo)
        {
            var psSubvolumeInfo = new PSNetAppFilesSubvolumeInfo()
            {
                ResourceGroupName = new ResourceIdentifier(subvolumeInfo.Id).ResourceGroupName,
                Id   = subvolumeInfo.Id,
                Name = subvolumeInfo.Name,
                Type = subvolumeInfo.Type,
                ProvisioningState = subvolumeInfo.ProvisioningState,
                Path       = subvolumeInfo.Path,
                ParentPath = subvolumeInfo.ParentPath,
                Size       = subvolumeInfo.Size,
                SystemData = subvolumeInfo.SystemData?.ToPsSystemData()
            };

            return(psSubvolumeInfo);
        }