Created
March 3, 2017 14:43
-
-
Save mtboren/3a47a1cfc103605d897e8df1c5e65091 to your computer and use it in GitHub Desktop.
Getting EMC Unity array API types' definitions from API itself
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## URI is to just get the "types" info | |
$tmpUri = "https://someunity.dom.com/api/types" | |
## this example uses the websession and headers from already having established connection to Unity API (as perfomed by Connect-Unity cmdlet from "Unity-PowerShell" PS module) | |
$oWebResponse = Invoke-WebRequest -Uri $tmpURI -ContentType "application/json" -Websession $Session.Websession -Headers $session.headers -Method GET | |
## the ".entries" property has the collection of types data | |
## there are about 422 objects returned in ".entries" property on this 600F (about half of which are Enum types) | |
($oWebResponse.content | ConvertFrom-Json).entries | |
# @base updated links | |
# ----- ------- ----- | |
# https://someunity.dom.com/api/types 2017-03-03T14:19:11.799Z {@{rel=self; href=/ACEAccessLevelEnum}} | |
# https://someunity.dom.com/api/types 2017-03-03T14:19:11.799Z {@{rel=self; href=/ACEAccessTypeEnum}} | |
# https://someunity.dom.com/api/types 2017-03-03T14:19:11.799Z {@{rel=self; href=/AccessPolicyEnum}} | |
# https://someunity.dom.com/api/types 2017-03-03T14:19:11.799Z {@{rel=self; href=/AllocationStatusEnum}} | |
# ... | |
## some member info for the entries | |
($oWebResponse.content | ConvertFrom-Json).entries | Get-Member | |
# TypeName: System.Management.Automation.PSCustomObject | |
# Name MemberType Definition | |
# ---- ---------- ---------- | |
# Equals Method bool Equals(System.Object obj) | |
# GetHashCode Method int GetHashCode() | |
# GetType Method type GetType() | |
# ToString Method string ToString() | |
# @base NoteProperty string @base=https://someunity.dom.com/api/types | |
# content NoteProperty System.Management.Automation.PSCustomObject content=@{name=ACEAccessLevelEnum... | |
# links NoteProperty Object[] links=System.Object[] | |
# updated NoteProperty string updated=2017-03-03T14:19:11.799Z | |
## getting the "attributes" property of a LUN entry (LUN object type definition, essentially) | |
(($oWebResponse.content | ConvertFrom-Json).entries | Where-Object {$_.content.name -eq "lun"}).content.attributes | sort name | |
# name type description | |
# ---- ---- ----------- | |
# compressionPercent Integer Percent compression rate | |
# compressionRatio Float compression ratio | |
# compressionSizeSaved Integer Storage element saved space by inline compression | |
# currentNode NodeEnum The storage processor that is the current owner of this LUN. | |
# defaultNode NodeEnum The storage processor that is the default owner of this LUN. | |
# description String Description of the LUN. | |
# health health Health information for the LUN, as defined by the health resource typ... | |
# hostAccess List<blockHostAccess> Host access permissions for the LUN. | |
# id String Unique identifier of the LUN. | |
# ioLimitPolicy ioLimitPolicy I/O limit policy that applies to the LUN, as defined by the ioLimitPo... | |
# isCompressionEnabled Boolean True if compression is enabled | |
# isReplicationDestination Boolean Indicates whether the LUN is a replication destination. Valid values ... | |
# isSnapSchedulePaused Boolean (Applies if the LUN has an associated snap schedule.) Indicates wheth... | |
# isThinEnabled Boolean Indicates whether thin provisioning is enabled. <ul> <li>true - The L... | |
# metadataSize Integer Size of the LUN metadata. | |
# metadataSizeAllocated Integer Size of pool space allocated for the LUN's metadata. | |
# moveSession moveSession The moveSession associated with the current lun | |
# name String Name of the LUN. | |
# perTierSizeUsed List<Integer> Sizes of space allocations by the LUN on the tiers of multi-tier stor... | |
# pool pool The pool in which the LUN is allocated. | |
# sizeAllocated Integer Size of space actually allocated in the pool for the LUN: <ul> <li>Fo... | |
# sizeTotal Integer LUN size that the system presents to the host or end user. | |
# sizeUsed Integer Used size is not applicable to LUN and this value is not set. | |
# snapCount Integer Number of snapshots of the LUN. | |
# snapSchedule snapSchedule Snapshot schedule for the LUN, as defined by the snapSchedule. This v... | |
# snapsSize Integer Size of the LUN snapshots. | |
# snapsSizeAllocated Integer Size of pool space allocated for snapshots of the LUN. | |
# snapWwn String World Wide Name of the Snap Mount Point. | |
# storageResource storageResource The storage resource with which LUN is associated. | |
# type LUNTypeEnum Type of the LUN. | |
# wwn String The world wide name of the LUN. |
Yessirree. And, good to know about Get-UnityItem
, thanks -- that will definitely be handy for exploring.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the tips !!!
FYI you can use function
Get-UnityItem
to query a specific item.