CiscoDevNet / intersight-powershell

Cisco Intersight PowerShell
Apache License 2.0
16 stars 4 forks source link

Initialize-IntersightSdcardVirtualDrive does not implement "Name" parameter #135

Closed tgrabrian closed 9 months ago

tgrabrian commented 10 months ago

Describe the bug Initialize-IntersightSdcardVirtualDrive does not implement the "Name" parameter. The Intersight API does implement the Name parameter and it is utilized to name give the User or Operating System partitions a custom name. This may also affect the related functions: Initialize-IntersightSdcardPartition and New-IntersightSdcardPolicy.

To Reproduce

PS C:\Example> $SdcardVirtualDriveConfig = @{
>>     Enable = $true
>>     ClassId = "SdcardOperatingSystem"
>>     Name = "Hypervisor"
>>     ObjectType = "SdcardOperatingSystem"
>> }
PS C:\Example> $SdcardVirtualDrive = Initialize-IntersightSdcardVirtualDrive @SdcardVirtualDriveConfig
Initialize-IntersightSdcardVirtualDrive: A parameter cannot be found that matches parameter name 'Name'.

Version used Version 1.0.11.14968 of Intersight.PowerShell (SaaS connection)

Expected behavior Name to be supported, no error.

Screenshots Intersight's options image

Additional context API JSON (working capture from Intersight.com interaction):

{
    "ObjectType": "sdcard.Policy",
    "ClassId": "sdcard.Policy",
    "Name": "example",
    "Partitions": [
        {
            "ClassId": "sdcard.Partition",
            "ObjectType": "sdcard.Partition",
            "Type": "OS",
            "VirtualDrives": [
                {
                    "ClassId": "sdcard.OperatingSystem",
                    "ObjectType": "sdcard.OperatingSystem",
                    "Enable": true,
                    "Name": "Hypervisor"
                }
            ]
        }
    ]
}
Ghufz commented 9 months ago

Please use the specific Initialize cmdlet to get all the property which can be configured.

Use Initialize-IntersightSdcardOperatingSystem cmdlet to configure Name and Enabled property.

$SdcardVirtualDriveConfig = @{
        Enable = $true
        Name = "Hypervisor"
     }
Initialize-IntersightSdcardOperatingSystem @SdcardVirtualDriveConfig

or If you use Initialize-IntersightSdcardVirtualDrive then Name and other specific property may not be there to configure, in this case use AdditionalProperties parameter for the parameter which are not the part of Initialize cmdlet.

I would recommend to use the specific Initialize cmdlet to get all the supported property to configure as parameter value.

tgrabrian commented 9 months ago

Ghufran, than you for that information; I was unaware of the OperatingSystem/UserPartition variants of the Sdcard initialize functions. This same issue exists for the other versions of that family of commands, though. Diagnostics, Drivers, UpgradeUtility, and ServerConfiguration Utility do not implement the ClassId/ObjectType;

PS C:\Example> Initialize-IntersightSdcardUserPartition -Enable $true

ClassId              : SdcardUserPartition
ObjectType           : SdcardUserPartition
Name                 :
AdditionalProperties : {}
Enable               : True

PS C:\Example> Initialize-IntersightSdcardOperatingSystem -Enable $true

ClassId              : SdcardOperatingSystem
ObjectType           : SdcardOperatingSystem
Name                 :
AdditionalProperties : {}
Enable               : True

PS C:\Example> Initialize-IntersightSdcardDiagnostics -Enable $true

AdditionalProperties ClassId ObjectType Enable
-------------------- ------- ---------- ------
{}                         0          0   True

PS C:\Example> Initialize-IntersightSdcardDrivers -Enable $true

AdditionalProperties ClassId ObjectType Enable
-------------------- ------- ---------- ------
{}                         0          0   True

PS C:\Example> Initialize-IntersightSdcardHostUpgradeUtility -Enable $true

AdditionalProperties ClassId ObjectType Enable
-------------------- ------- ---------- ------
{}                         0          0   True

PS C:\Example> Initialize-IntersightSdcardServerConfigurationUtility -Enable $true

AdditionalProperties ClassId ObjectType Enable
-------------------- ------- ---------- ------
{}                         0          0   True

PS C:\Example>