Skip to content

Commit

Permalink
Add New-ArmorCompleteVM public cmdlet [new]
Browse files Browse the repository at this point in the history
* #109
* #122
* #126
* Also includes a bug fix for ArmorVM ScheduledEvents property tests
  • Loading branch information
tlindsay42 committed Jul 1, 2018
1 parent 6c57f59 commit a1df180
Show file tree
Hide file tree
Showing 13 changed files with 1,609 additions and 5 deletions.
10 changes: 10 additions & 0 deletions .spelling
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Armor.psm1
ArmorAccount
ArmorAccountAddress
ArmorCompleteDatacenter
ArmorCompleteVmOrder
ArmorCompleteWorkload
ArmorCompleteWorkloadTier
ArmorPowerShell
Expand Down Expand Up @@ -54,6 +55,7 @@ eg
e.g.
ErrorAction
ErrorVariable
ExistingWorkloadAndTier
Expand-ArmorApiResult
FirstName
ForceOff
Expand Down Expand Up @@ -93,11 +95,14 @@ Me_GetMeAsync
MkDocs
mkdocs.org
NewName
NewWorkloadAndTier
New-ArmorApiToken
New-ArmorApiUri
New-ArmorApiUriQuery
New-ArmorCompleteVM
OneDrive
open-vm-tools
Orders_PostVmOrderAsync
OutBuffer
OutVariable
pasteable
Expand Down Expand Up @@ -128,6 +133,7 @@ styleguides
Styleguides
Submit-ArmorApiRequest
SuccessCode
System.Guid
System.Management.Automation.PSObject
System.String
System.UInt16
Expand All @@ -138,6 +144,8 @@ TenantOAuth_AuthorizeAsync
TenantOAuth_ReissueAsync
TenantOAuth_TokenAsync
TEST-VM
TierID
TierName
Tier_AddTier
Tier_DeleteTier
Tier_Get
Expand All @@ -153,6 +161,7 @@ Uri
Users_GetUser
Users_GetUsers
Verb-ArmorNoun
VirtualDisks
VMs
VMware
Vm_DeleteVm
Expand All @@ -169,6 +178,7 @@ whitespace
white_check_mark
Wildcard
WorkloadID
WorkloadName
www.apache.org
xml
#endregion
3 changes: 2 additions & 1 deletion Armor/Armor.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ FunctionsToExport = 'Connect-Armor', 'Disconnect-Armor', 'Get-ArmorAccount',
'Get-ArmorAccountAddress', 'Get-ArmorAccountContext',
'Get-ArmorCompleteDatacenter', 'Get-ArmorCompleteWorkload',
'Get-ArmorCompleteWorkloadTier', 'Get-ArmorIdentity', 'Get-ArmorUser',
'Get-ArmorVM', 'Invoke-ArmorWebRequest',
'Get-ArmorVM', 'Invoke-ArmorWebRequest', 'New-ArmorCompleteVM',
'New-ArmorCompleteWorkloadTier', 'Remove-ArmorCompleteVM',
'Remove-ArmorCompleteWorkload', 'Remove-ArmorCompleteWorkloadTier',
'Rename-ArmorCompleteVM', 'Rename-ArmorCompleteWorkload',
Expand Down Expand Up @@ -120,6 +120,7 @@ FileList = 'Armor.psd1', 'Armor.psm1', 'en-US\Armor-help.xml', 'Etc\Aliases.json
'Public\Get-ArmorCompleteWorkloadTier.ps1',
'Public\Get-ArmorIdentity.ps1', 'Public\Get-ArmorUser.ps1',
'Public\Get-ArmorVM.ps1', 'Public\Invoke-ArmorWebRequest.ps1',
'Public\New-ArmorCompleteVM.ps1',
'Public\New-ArmorCompleteWorkloadTier.ps1',
'Public\Remove-ArmorCompleteVM.ps1',
'Public\Remove-ArmorCompleteWorkload.ps1',
Expand Down
25 changes: 25 additions & 0 deletions Armor/Etc/ApiData.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,31 @@
"SuccessCode": "200"
}
},
"New-ArmorCompleteVM": {
"v1.0": {
"Description": "Order {0} new VM{1}",
"Endpoints": [
"/orders/vms"
],
"Method": "Post",
"Body": {
"name": "Name",
"location": "Armor Complete datacenter location code",
"appId": "Workload ID",
"appName": "New Workload Name",
"tierId": "Workload Tier ID",
"tierName": "New Workload Tier Name",
"storage": "Virtual disks",
"secret": "Password",
"sku": "Fixed instance VM geometry",
"quantity": "Quantity to order"
},
"Query": {},
"Location": "VMs",
"Filter": {},
"SuccessCode": "200"
}
},
"New-ArmorCompleteWorkloadTier": {
"v1.0": {
"Description": "Create workload tier",
Expand Down
65 changes: 65 additions & 0 deletions Armor/Lib/ArmorTypes.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,50 @@ class ArmorCompleteDatacenter {
}


class ArmorCompleteVmOrderVm {
[UInt16] $AccountID

[UInt16] $AppID

[AllowEmptyString()]
[String] $AppName

[AllowEmptyString()]
[String] $Name

[AllowEmptyString()]
[String] $Location

[UInt16] $Quantity

Hidden [String] $Secret

[AllowEmptyString()]
[String] $SKU

[AllowEmptyCollection()]
[PSCustomObject[]] $Software

[AllowEmptyCollection()]
[PSCustomObject[]] $Storage

[UInt16] $TemplateID

[UInt16] $TierID

[AllowEmptyString()]
[String] $TierName

[Guid] $TrackingID

[AllowEmptyString()]
[String] $Zone

#Constructors
ArmorCompleteVmOrderVm () {}
}


class ArmorDepartment {
[ValidateRange( 1, 65535 )]
[UInt16] $ID
Expand Down Expand Up @@ -871,6 +915,27 @@ class ArmorVM {
}


class ArmorCompleteVmOrder {
[ValidateRange( 1, 65535 )]
[UInt16] $ID

[ValidateRange( 1, 65535 )]
[UInt16] $AccountID

[ValidateNotNullOrEmpty()]
[String] $Status

[ValidateNotNull()]
[DateTime] $DateCreated

[ValidateCount( 1, 65535 )]
[ArmorCompleteVmOrderVm[]] $VMs

#Constructors
ArmorCompleteVmOrder () {}
}


class ArmorCompleteWorkloadTier {
[ValidateRange( 1, 65535 )]
[UInt16] $ID
Expand Down
3 changes: 2 additions & 1 deletion Armor/Private/Format-ArmorApiRequestBody.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ function Format-ArmorApiRequestBody {
# Store the results in a JSON string
$return = ConvertTo-Json -InputObject $body -ErrorAction 'Stop'

Write-Verbose -Message "Body = ${return}"
$filteredReturn = $return -replace '"secret": ".+"', '"secret": "[redacted]"'
Write-Verbose -Message "Body = $filteredReturn"

$return
}
Expand Down
Loading

0 comments on commit a1df180

Please sign in to comment.