Generated from Morpheus OpenAPI 8.0.13.
- This module is generated from the Morpheus OpenAPI specification.
- Use at your own risk.
- No standard support is offered for this module.
- Support is best-effort only.
git clone https://github.com/HewlettPackard/morpheus-powershell.git
Set-Location .\morpheus-powershell
Import-Module .\Morpheus.OpenApi.psd1 -Force$version = '8.0.13'
$moduleRoot = Join-Path $HOME "Documents\PowerShell\Modules\Morpheus.OpenApi\$version"
New-Item -ItemType Directory -Path $moduleRoot -Force | Out-Null
Copy-Item .\Morpheus.OpenApi.psd1 $moduleRoot -Force
Copy-Item .\Morpheus.OpenApi.psm1 $moduleRoot -Force
Copy-Item .\Morpheus.OpenApi.ColumnProfiles.psd1 $moduleRoot -Force
Import-Module Morpheus.OpenApi -RequiredVersion $version -ForceManual install note: if you use a different PowerShell module path, copy the same files into Morpheus.OpenApi\8.0.13 under that path.
906generated API operation cmdlets4session cmdlets:Connect-MorpheusDisconnect-MorpheusGet-MorpheusConnectionSet-MorpheusDefault
2async task cmdlets:Get-MorpheusTaskWait-MorpheusTask
1helper cmdlet:New-MorpheusKeyValueMap
- Full named parameter flags generated from OpenAPI operation parameters
- Request-body fields are also exposed as cmdlet flags (schema-driven), with clean names like
-PlanId,-ZoneId,-Copies,-LayoutSize - Dynamic live argument completion for common ID flags (for example
-ZoneId,-SiteId,-PlanId,-LayoutId,-NetworkId) using connected Morpheus data - Generated comment-based help on endpoint cmdlets (
.SYNOPSIS,.DESCRIPTION,.PARAMETER,.EXAMPLE,.OUTPUTS) sourced from OpenAPI metadata - Typed object layer on API results using
PSTypeName(for exampleMorpheus.Group,Morpheus.Group.Summary) for cleaner formatting/extensions - Pipeline-first identity binding via
ValueFromPipelineByPropertyNameon ID-style parameters (supports chaining byid/*Idfields) - Parameter tab completion for
-Morpheusconnection names - Friendly resource-style names where possible (for example
Get-MorpheusGroups,New-MorpheusGroup) - Consolidated GET behavior for standard collection/item endpoints (
Get-MorpheusGroups -Id <id>for a specific item)- use the plural cmdlet only (for example
Get-MorpheusGroups) Idis positional on consolidated GET cmdlets, soGet-MorpheusServers 123works
- use the plural cmdlet only (for example
- Path parameters are positional for all endpoints (in path order)
- examples:
Remove-MorpheusGroup 7,Get-MorpheusClusterAffinityGroup 12 3
- examples:
- Automatic pagination on GET endpoints that support
max/offset- default behavior pages through all results
- specify
-Max/-Offsetfor manual paging windows - use
-NoPagingto return only one page
- Smart response shaping for all endpoints:
- Default GET output uses endpoint-aware defaults
- list endpoints show concise operational columns
- specific-item endpoints show richer detail by default
- Use
-Propertyto choose additional/alternate columns - Use
-Detailedto return the full object graph
- Default GET output uses endpoint-aware defaults
- JSON body handling for all endpoints: pass hashtables/objects or raw JSON strings
- Customizable default column profiles via
Morpheus.OpenApi.ColumnProfiles.psd1 - Required request-body fields are prompted automatically (schema-driven) when omitted
- Remove actions support confirmation (
-Confirm,-Confirm:$false,-WhatIf) - Create/update actions (
POST/PUT/PATCH) support-WhatIf/-Confirmparity viaShouldProcess - Request preview mode on all endpoint cmdlets:
-Curloutputs the exact API call and does not execute it-Scrub(with-Curl) only obfuscates the bearer API token in output
Import-Module "<repo>\morpheus-powershell\Morpheus.OpenApi.psd1" -ForceConnect-Morpheus -Name prod -Server https://morpheus-prod.example.com -ApiToken '<token>' -Default
Connect-Morpheus -Name dev -Server https://morpheus-dev.example.com -ApiToken '<token>'$cred = Get-Credential
Connect-Morpheus -Name prod -Server https://morpheus-prod.example.com -Credential $cred -Default$password = Read-Host 'Password' -AsSecureString
Connect-Morpheus -Name prod -Server https://morpheus-prod.example.com -Username 'admin' -Password $password -DefaultConnect-Morpheus -Name prod -Server https://morpheus-prod.example.com -Username 'admin' -PlainTextPassword 'SuperSecret!'Warning: -PlainTextPassword can expose credentials in shell history/logs. Prefer -Password when possible.
- Read-style operations (
GET,HEAD,OPTIONS):-Morpheusis optional.- If omitted, request runs across all connected Morpheus appliances.
POST,PUT, andDELETEoperations:- If more than one Morpheus is connected,
-Morpheusis required. - If only one Morpheus is connected,
-Morpheusis optional.
- If more than one Morpheus is connected,
- For all other operations:
- If only one Morpheus is connected,
-Morpheusis optional.
- If only one Morpheus is connected,
This matches the requested scoping behavior.
Use -Curl on any generated endpoint cmdlet to print the exact API call that would be sent.
-Curlis preview-only and does not execute the request.-Curl -Scrubkeeps output identical to-Curl, except the bearer API token is obfuscated.- Works across all verbs (
GET,POST,PUT,DELETE) and all generated endpoint cmdlets.
Examples:
# GET preview
Get-MorpheusGroups -Curl
# POST preview
New-MorpheusApp -Morpheus prod -Body @{ app = @{ name = 'my-app' } } -Curl
# PUT preview with scrubbing
Set-MorpheusApp -Morpheus prod -Id 123 -Body @{ app = @{ description = 'updated' } } -Curl -Scrub
# DELETE preview with positional id and scrubbing
Remove-MorpheusGroup 123 -Curl -ScrubFor endpoints like New-MorpheusInstance (and others) where config is a flexible JSON object, use one of these patterns.
Preferred for scripts (clean + repeatable):
$config = @{
diskMode = 'thin'
cpuHotAdd = $true
maxConnections = 200
tags = @('prod','web')
}
New-MorpheusInstance -Morpheus prod -Body @{
instance = @{
name = 'vm-demo'
config = $config
}
}Direct map input (for scripted use):
$config = New-MorpheusKeyValueMap -Map @{
diskMode = 'thin'
cpuHotAdd = $true
maxConnections = 200
tags = @('prod','web')
}Interactive ad-hoc entry (variable pairs until blank key):
$config = New-MorpheusKeyValueMap -InteractiveIn interactive mode, users always enter a key and then a value (repeat until key is blank).
When required-field prompting encounters a missing config object, the module uses this same key/value flow automatically.
For endpoints with request bodies, schema fields are available as direct flags so users do not need dotted property syntax.
Example (New-MorpheusInstance):
New-MorpheusInstance -Morpheus prod -Name vm-demo -PlanId 995 -ZoneId 12 -Copies 2 -LayoutSize 50 -Config @{ diskMode = 'thin' }Required value prompts now use clean flag-style names (for example planId) instead of dotted paths like instance.plan.id.
For array-of-object fields (for example -NetworkInterfaces, -Volumes, -SecurityGroups), the module now validates and prompts required per-item keys when needed.
Example pattern:
New-MorpheusInstance -Morpheus prod -Name vm-demo -PlanId 995 -ZoneId 12 -NetworkInterfaces @(
@{ network = @{ id = 201 } },
@{ network = @{ id = 202 }; ipMode = 'dhcp' }
)If a required nested key is missing in an item, prompts are clean (for example networkId) and scoped by item index.
Use these helpers to poll long-running Morpheus tasks in a consistent way.
# Poll by explicit task id
Wait-MorpheusTask -TaskId 12345 -Morpheus prod
# Extract task id from response object (taskId/process/execution shapes)
$resp = New-MorpheusInstance -Morpheus prod -Name vm-demo -PlanId 995 -ZoneId 12
$resp | Wait-MorpheusTask -Morpheus prod -PassThru
# Inspect current task status without waiting
Get-MorpheusTask -TaskId 12345 -Morpheus prodGet-MorpheusTask probes known Morpheus task endpoints and returns normalized task metadata (TaskId, TaskPath, TaskStatus, IsTerminal, IsSuccess) when available.
# Read from all connected appliances (if -Morpheus omitted)
Get-MorpheusApps -Max 25
# Consolidated list/detail GET pattern
Get-MorpheusGroups
Get-MorpheusGroups -Id 1
Get-MorpheusServers 123
Get-MorpheusClusters 12
# Automatic paging (default) vs manual page
Get-MorpheusServers
Get-MorpheusServers -NoPaging
Get-MorpheusServers -Offset 0 -Max 25
# Custom columns
Get-MorpheusGroups -Property Id,Name,Code,Uuid
# Full payload
Get-MorpheusGroups -Detailed
# Example endpoint-aware defaults
Get-MorpheusInstances # concise list view (id/name/group/site/zone...)
Get-MorpheusInstances -Id 123 # richer detail view by default
# Read from a specific appliance
Get-MorpheusApps -Morpheus prod -Max 25
# POST/PUT/DELETE with multiple connected Morpheus: specify one appliance
New-MorpheusApp -Morpheus prod -Body @{ app = @{ name = 'my-app' } }
Set-MorpheusApp -Morpheus prod -Id 123 -Body @{ app = @{ description = 'updated' } }
# WhatIf parity for non-delete changes
New-MorpheusInstance -Morpheus prod -Name vm-demo -PlanId 995 -ZoneId 12 -WhatIf
Set-MorpheusApp -Morpheus prod -Id 123 -Body @{ app = @{ description = 'updated' } } -WhatIf
# Preview-only API call generation (no execution)
Get-MorpheusGroups -Curl
Set-MorpheusApp -Morpheus prod -Id 123 -Body @{ app = @{ description = 'updated' } } -Curl
# Preview with API token scrubbing
Get-MorpheusGroups -Curl -Scrub
Remove-MorpheusGroup 123 -Curl -Scrub
# JSON body as string also works
Set-MorpheusApp -Morpheus prod -Id 123 -Body '{"app":{"description":"updated"}}'
# If required fields are omitted, module prompts interactively (example: group.name)
New-MorpheusGroup -Morpheus prodEdit GIT/morpheus-powershell/Morpheus.OpenApi.ColumnProfiles.psd1 to tune list/detail defaults by resource key (instances, servers, groups, apps, default).
Example profile section:
instances = @{
list = @('id','name','group','site','zone','status')
detail = @('id','name','displayName','status','group','site','zone','uuid')
}Set-Location "<repo>\morpheus-powershell\scripts"
./Generate-MorpheusModule.ps1This regenerates:
Morpheus.OpenApi.psm1Morpheus.OpenApi.psd1
Remove-Module Morpheus.OpenApi -Force -ErrorAction SilentlyContinue
Import-Module "<repo>\morpheus-powershell\Morpheus.OpenApi.psd1" -Force