Skip to content

Commit

Permalink
Release 3.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
TrevorSquillario committed Mar 23, 2023
1 parent 32aecc2 commit ca45f26
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.4.1]() - 2023-03-23
### Changed
- Get-OMEGroup added support for paging results to return over 100 groups

## [3.4.0]() - 2023-02-02
### Added
- Get-OMEFabric
Expand Down
4 changes: 2 additions & 2 deletions DellOpenManage/DellOpenManage.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Generated by: Trevor Squillario <[email protected]>
#
# Generated on: 2/2/2023
# Generated on: 3/23/2023
#

@{
Expand All @@ -12,7 +12,7 @@
RootModule = 'DellOpenManage.psm1'

# Version number of this module.
ModuleVersion = '3.4.0'
ModuleVersion = '3.4.1'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
51 changes: 41 additions & 10 deletions DellOpenManage/Public/OME/Get-OMEGroup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ limitations under the License.
.PARAMETER Value
String containing search value. Use with -FilterBy parameter
.PARAMETER FilterBy
Filter the results by ("Name", "Id")
Filter the results by ("Name", "Type")
.INPUTS
String[]
.EXAMPLE
Expand All @@ -45,7 +45,7 @@ param(
[String[]]$Value,

[Parameter(Mandatory=$false)]
[ValidateSet("Name", "Id")]
[ValidateSet("Name", "Type")]
[String]$FilterBy = "Name"
)

Expand All @@ -56,38 +56,69 @@ Process {
}
Try {
if ($SessionAuth.IgnoreCertificateWarning) { Set-CertPolicy }
$GroupUrl = "https://$($SessionAuth.Host)/api/GroupService/Groups"
$BaseUri = "https://$($SessionAuth.Host)"
$GroupUrl = $BaseUri + "/api/GroupService/Groups"
$Type = "application/json"
$Headers = @{}
$FilterMap = @{'Name'='Name'; 'Id'='DefinitionId'; 'Type'='Type'}
$FilterMap = @{'Name'='Name'; 'Id'='Id'; 'Type'='TypeId'}
$FilterExpr = $FilterMap[$FilterBy]
$GroupData = @()

$Headers."X-Auth-Token" = $SessionAuth.Token
$Filter = ""
if ($Value.Count -gt 0) {
if ($FilterBy -eq 'Id') {
$GroupUrl += "?`$filter=$($FilterExpr) eq $($Value)"
if ($FilterBy -eq 'Id' -or $FilterBy -eq 'Type') {
$Filter += "`$filter=$($FilterExpr) eq $($Value)"
}
else {
$GroupUrl += "?`$filter=$($FilterExpr) eq '$($Value)'"
$Filter += "`$filter=$($FilterExpr) eq '$($Value)'"
}
}
$GroupUrl = $GroupUrl + "?" + $Filter
Write-Verbose $GroupUrl
$GrpResp = Invoke-WebRequest -Uri $GroupUrl -UseBasicParsing -Method Get -Headers $Headers -ContentType $Type
if ($GrpResp.StatusCode -eq 200) {
$GroupInfo = $GrpResp.Content | ConvertFrom-Json
foreach ($Group in $GroupInfo.'value') {
$GroupData += New-GroupFromJson $Group
}
if($GroupInfo.'@odata.nextLink')
{
$NextLinkUrl = $BaseUri + $GroupInfo.'@odata.nextLink' + "&" + $Filter
}
while($NextLinkUrl)
{
Write-Verbose $NextLinkUrl
$NextLinkResponse = Invoke-WebRequest -Uri $NextLinkUrl -UseBasicParsing -Method Get -Headers $Headers -ContentType $Type
if($NextLinkResponse.StatusCode -eq 200)
{
$NextLinkData = $NextLinkResponse.Content | ConvertFrom-Json
foreach ($Group in $NextLinkData.'value') {
$GroupData += New-GroupFromJson $Group
}
if($NextLinkData.'@odata.nextLink')
{
$NextLinkUrl = $BaseUri + $NextLinkData.'@odata.nextLink' + "&" + $Filter
}
else
{
$NextLinkUrl = $null
}
}
else
{
Write-Warning "Unable to get nextlink response for $($NextLinkUrl)"
$NextLinkUrl = $null
}
}
return $GroupData
}
else {
Write-Error "Unable to retrieve group list from $($SessionAuth.Host)"
}
}
Catch {
Write-Error ($_.ErrorDetails)
Write-Error ($_.Exception | Format-List -Force | Out-String)
Write-Error ($_.InvocationInfo | Format-List -Force | Out-String)
Resolve-Error $_
}
}

Expand Down
2 changes: 1 addition & 1 deletion Documentation/Functions/Get-OMEGroup.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Accept wildcard characters: False
```
### -FilterBy
Filter the results by ("Name", "Id")
Filter the results by ("Name", "Type")
```yaml
Type: String
Expand Down

0 comments on commit ca45f26

Please sign in to comment.