-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Struggling with Syntax #96
Comments
Also, when I attempt to pull records for any object type, it appears that results are limited to a count of 100.
If I want to sort my results locally, it doesn't look like it is possible if we are limited to a 100 object return. In theory, this would have worked, but the objects im trying to find don't happen to be in the first 100 objects.
HERE IS WHAT ACTUALLY WORKED(Which has a ridiculous number of extra steps)
Can the above be simplified in this strange syntax this module is using? |
Sorry for the challenges in using the module. We'll be adding more examples soon to intersight.com/apidocs on query operations like the above and there are currently a few examples including paging through the API at https://github.com/CiscoDevNet/intersight-powershell-utils . Here's a hopefully simpler example of finding vHBAs tied to a profile: |
I haven't tried that yet for myself, but I'll give it a go this week. I've moved on with my prior findings which seem to work well enough. How would one use the -Profile parameter? I would have though (Get-IntersightVnicFcIf -Profile $ServerProfile) would have worked, or am I misunderstanding the usage of that parameter? In UCSM the code was too simple. Are we reinventing the wheel here or are these changes required by Intersight design? |
The -Profile parameter can also be used, although it takes a Managed Object (MO) Ref so there's 1 extra call to convert ServerProfile to a MORef: Much of the module is auto-generated from Intersight's OpenAPI spec and the params like -Profile are typically queries behind the scenes where the module is handling the specific query and required types based on the spec. |
The Cisco Intersight API is much more powerful than the UCSM XML API. With the Cisco Intersight API, we are able to filter, select, expand, and select or expand on the expanded object all on the server side. With these query options, we get exactly the properties we want and no more. This reduces the amount of data sent over the network. A single query is limited to 1000 results. If you have more than 1000 results, you'll need to paginate/loop the same command until all results have been pulled into powershell. Here's a way to get the same information in a single api call. # Expand the Profile property on VnicFcIf objects and only return the profile's name property after the expansion in addition to all of the VnicFcIf properties
# This is one api call to Intersight
# Without Top parameter, by default, the commands return 100 objects
$results = Get-IntersightVnicFcIf -Top 1000 -Expand 'Profile($select=Name)' | Select-Object -ExpandProperty Results
# Pull out only the properties we are interested in, in powershell
$results | Select-Object @{n='Profile';e={$_.Profile.ActualInstance.Name}},@{n='Vhba';e={$_.Name}} |
I'm really struggling with the Intersight PowerShell syntax after working with UCSM and VMware for so long.
It just does not seem very intuitive.
I'm really trying to perform a simple task right now by requesting a server profile by name, and retrieving all of its assigned vNICs/vHBAs (a laughably simple task in UCSM).
For example, just trying to pull the WWPNs from a server profile with Get-IntersightVnicFcIf is proving overly complicated. I can't even seem to pass the correct information to the -Profile parameter on some of these commands.
Should it not work as simple as this?
I'm also not used to the json style payloads that are loaded into these properties.
And why does "ActualInstance" even exist. All these nested properties are unnecessarily complicated.
If I expand $intersightVnicFcIf.WwpnPool, then take me straight to the "ActualInstance"...
And what's with "AdditionalProperties"? Why does that even exist. Just put ALL the properties in the object...
I'm no schema architect by any means, just a heavy user, and this is just not user friendly whatsoever, so much so that I guarantee I'm not the only one with these same opinions.
Sorry for venting, but it really shouldn't be this hard to transition from the UCSPowertool.
The text was updated successfully, but these errors were encountered: