Public/Auto-scaleprofile.ps1
Function Get-NmeAutoScaleProfile { <# .SYNOPSIS . .DESCRIPTION . This function calls the /api/v1/auto-scale-profile endpoint of the NME REST API, using the get method. #> [CmdletBinding()] Param( ) Set-NmeAuthHeaders Try { $Result = Invoke-RestMethod "$script:NmeUri/api/v1/auto-scale-profile$Querystring" -Method get -Headers $script:AuthHeaders -ContentType 'application/json' $Result.PSObject.TypeNames.Insert(0, 'NmeAutoScaleProfileRest_GET') $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function New-NmeAutoScaleProfile { <# .SYNOPSIS . .DESCRIPTION . This function calls the /api/v1/auto-scale-profile endpoint of the NME REST API, using the post method. .PARAMETER NmeAutoScaleProfileRest_POST Requires an NmeAutoScaleProfileRest_POST object, as generated by the New-NmeAutoScaleProfileRest_POST command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeAutoScaleProfileRest_POST"){$true} else{throw " is not a NmeAutoScaleProfileRest_POST object."}})]$NmeAutoScaleProfileRest_POST ) Set-NmeAuthHeaders Try { $json = $NmeAutoScaleProfileRest_POST | ConvertTo-Json -Depth 20 Write-Debug 'json:' Write-Debug $json $Result = Invoke-RestMethod "$script:NmeUri/api/v1/auto-scale-profile$QueryString" -Method post -Headers $script:AuthHeaders -ContentType 'application/json' -body $json Write-Verbose ($result | out-string) $Result.PSObject.TypeNames.Insert(0, 'NmeAutoScaleProfileRest_GET') $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Get-NmeAutoScaleProfileId { <# .SYNOPSIS . .DESCRIPTION . This function calls the /api/v1/auto-scale-profile/{profileId} endpoint of the NME REST API, using the get method. .PARAMETER ProfileId Auto scale profile id #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][int]$ProfileId ) Set-NmeAuthHeaders Try { $Result = Invoke-RestMethod "$script:NmeUri/api/v1/auto-scale-profile/$ProfileId$Querystring" -Method get -Headers $script:AuthHeaders -ContentType 'application/json' $Result.PSObject.TypeNames.Insert(0, 'NmeAutoScaleProfileRest_GET') $Result | Add-Member -NotePropertyName 'profileId' -NotePropertyValue $profileId -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Set-NmeAutoScaleProfileId { <# .SYNOPSIS . .DESCRIPTION . This function calls the /api/v1/auto-scale-profile/{profileId} endpoint of the NME REST API, using the patch method. .PARAMETER ProfileId Auto scale profile id .PARAMETER NmeAutoScaleProfileRest_PATCH Requires an NmeAutoScaleProfileRest_PATCH object, as generated by the New-NmeAutoScaleProfileRest_PATCH command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][int]$ProfileId, [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeAutoScaleProfileRest_PATCH"){$true} else{throw " is not a NmeAutoScaleProfileRest_PATCH object."}})]$NmeAutoScaleProfileRest_PATCH ) Set-NmeAuthHeaders Try { $json = $NmeAutoScaleProfileRest_PATCH | ConvertTo-Json -Depth 20 Write-Debug 'json:' Write-Debug $json $Result = Invoke-RestMethod "$script:NmeUri/api/v1/auto-scale-profile/$ProfileId$QueryString" -Method patch -Headers $script:AuthHeaders -ContentType 'application/json' -body $json Write-Verbose ($result | out-string) $Result.PSObject.TypeNames.Insert(0, 'NmeAutoScaleProfileRest_GET') $Result | Add-Member -NotePropertyName 'profileId' -NotePropertyValue $profileId -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Remove-NmeAutoScaleProfileId { <# .SYNOPSIS . .DESCRIPTION . This function calls the /api/v1/auto-scale-profile/{profileId} endpoint of the NME REST API, using the delete method. .PARAMETER ProfileId Auto scale profile id #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][int]$ProfileId ) Set-NmeAuthHeaders Try { $Result = Invoke-RestMethod "$script:NmeUri/api/v1/auto-scale-profile/$ProfileId$Querystring" -Method delete -Headers $script:AuthHeaders -ContentType 'application/json' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Get-NmeAutoScaleProfileAssignment { <# .SYNOPSIS . .DESCRIPTION . This function calls the /api/v1/auto-scale-profile/{profileId}/assignments endpoint of the NME REST API, using the get method. .PARAMETER ProfileId Auto scale profile id #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][int]$ProfileId ) Set-NmeAuthHeaders Try { $Result = Invoke-RestMethod "$script:NmeUri/api/v1/auto-scale-profile/$ProfileId/assignments$Querystring" -Method get -Headers $script:AuthHeaders -ContentType 'application/json' $Result.PSObject.TypeNames.Insert(0, 'NmeAutoScaleProfileAssignmentRest_GET') $Result | ForEach-Object {$_ | Add-Member -NotePropertyName 'profileId' -NotePropertyValue $profileId -erroraction 'SilentlyContinue'} $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function New-NmeAutoScaleProfileAssignment { <# .SYNOPSIS . .DESCRIPTION . This function calls the /api/v1/auto-scale-profile/{profileId}/assignments endpoint of the NME REST API, using the post method. .PARAMETER ProfileId Auto scale profile id .PARAMETER NmeAutoScaleProfileAssignmentRest_POST Requires an NmeAutoScaleProfileAssignmentRest_POST object, as generated by the New-NmeAutoScaleProfileAssignmentRest_POST command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][int]$ProfileId, [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeAutoScaleProfileAssignmentRest_POST"){$true} else{throw " is not a NmeAutoScaleProfileAssignmentRest_POST object."}})]$NmeAutoScaleProfileAssignmentRest_POST ) Set-NmeAuthHeaders Try { $json = $NmeAutoScaleProfileAssignmentRest_POST | ConvertTo-Json -Depth 20 Write-Debug 'json:' Write-Debug $json $Result = Invoke-RestMethod "$script:NmeUri/api/v1/auto-scale-profile/$ProfileId/assignments$QueryString" -Method post -Headers $script:AuthHeaders -ContentType 'application/json' -body $json Write-Verbose ($result | out-string) $Result.PSObject.TypeNames.Insert(0, 'NmeAutoScaleProfileAssignmentRest_GET') $Result | Add-Member -NotePropertyName 'profileId' -NotePropertyValue $profileId -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Remove-NmeAutoScaleProfileAssignmentId { <# .SYNOPSIS . .DESCRIPTION . This function calls the /api/v1/auto-scale-profile/{profileId}/assignments/{assignmentId} endpoint of the NME REST API, using the delete method. .PARAMETER ProfileId Auto scale profile id .PARAMETER AssignmentId Auto scale profile assignment id #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][int]$ProfileId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][int]$AssignmentId ) Set-NmeAuthHeaders Try { $Result = Invoke-RestMethod "$script:NmeUri/api/v1/auto-scale-profile/$ProfileId/assignments/$AssignmentId$Querystring" -Method delete -Headers $script:AuthHeaders -ContentType 'application/json' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } |