Skip to content

Commit

Permalink
6.5.2 update
Browse files Browse the repository at this point in the history
  • Loading branch information
stevevillardi committed Jan 22, 2025
1 parent d09268d commit 4e81ef1
Show file tree
Hide file tree
Showing 8 changed files with 202 additions and 17 deletions.
62 changes: 62 additions & 0 deletions Public/Get-LMNormalizedProperties.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
Function Get-LMNormalizedProperties {

[CmdletBinding()]
Param ()

#Check if we are logged in and have valid api creds
Begin {}
Process {
If ($Script:LMAuth.Valid) {

#Build header and uri
$ResourcePath = "/normalizedProperties/filter"

$Body = [PSCustomObject]@{
meta = @{
filters = @{
filterType = "FILTER_CATEGORICAL_MODEL_TYPE"
normalizedProperties = @{
dynamic = @(
@{
field = "alias"
expressions = @(
@{
operator = "REGEX"
value = ".*"
}
)
}
)
}
}
paging = @{
perPageCount = 100
pageOffsetCount = 0
}
sort = "alias, hostPropertyPriority"
}
} | ConvertTo-Json -Depth 10

Try {
$Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Version 4
$Uri = "https://$($Script:LMAuth.Portal).logicmonitor.com/santaba/rest" + $ResourcePath

Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation

#Issue request
$Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Body
}
Catch [Exception] {
$Proceed = Resolve-LMException -LMException $PSItem
If (!$Proceed) {
Return
}
}
Return $Response
}
Else {
Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again."
}
}
End {}
}
2 changes: 1 addition & 1 deletion Public/New-LMDevice.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ Function New-LMDevice {
#Remove empty keys so we dont overwrite them
@($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } }

$Data = ($Data | ConvertTo-Json)
$Data = ($Data | ConvertTo-Json -Depth 5)
$Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data
$Uri = "https://$($Script:LMAuth.Portal).logicmonitor.com/santaba/rest" + $ResourcePath

Expand Down
2 changes: 1 addition & 1 deletion Public/New-LMNetscan.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ Function New-LMNetScan {
#Remove empty keys so we dont overwrite them
@($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } }

$Data = ($Data | ConvertTo-Json)
$Data = ($Data | ConvertTo-Json -Depth 5)
$Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data
$Uri = "https://$($Script:LMAuth.Portal).logicmonitor.com/santaba/rest" + $ResourcePath

Expand Down
60 changes: 60 additions & 0 deletions Public/New-LMNormalizedProperties.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
Function New-LMNormalizedProperties {

[CmdletBinding()]
Param (
[Parameter(Mandatory = $true)]
[String]$Alias,
[Parameter(Mandatory = $true)]
[Array]$Properties
)

#Check if we are logged in and have valid api creds
Begin {}
Process {
If ($Script:LMAuth.Valid) {

#Build header and uri
$ResourcePath = "/normalizedProperties/bulk"

#Loop through each property and build the body
$Body = [PSCustomObject]@{
data = [PSCustomObject]@{
items = @()
}
}
$Index = 1
ForEach ($Property in $Properties) {
$Body.data.items += [PSCustomObject]@{
alias = $Alias
hostProperty = $Property
hostPropertyPriority = $Index
model = "normalizedProperties"
}
$Index++
}

$Body = $Body | ConvertTo-Json -Depth 10

Try {
$Headers = New-LMHeader -Auth $Script:LMAuth -Method "PATCH" -ResourcePath $ResourcePath -Version 4
$Uri = "https://$($Script:LMAuth.Portal).logicmonitor.com/santaba/rest" + $ResourcePath

Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation

#Issue request
$Response = Invoke-RestMethod -Uri $Uri -Method "PATCH" -Headers $Headers[0] -WebSession $Headers[1] -Body $Body
}
Catch [Exception] {
$Proceed = Resolve-LMException -LMException $PSItem
If (!$Proceed) {
Return
}
}
Return $Response
}
Else {
Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again."
}
}
End {}
}
2 changes: 1 addition & 1 deletion Public/New-LMUser.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ Function New-LMUser {
#Remove empty keys so we dont overwrite them
@($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } }

$Data = ($Data | ConvertTo-Json)
$Data = ($Data | ConvertTo-Json -Depth 5)

$Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data
$Uri = "https://$($Script:LMAuth.Portal).logicmonitor.com/santaba/rest" + $ResourcePath
Expand Down
53 changes: 53 additions & 0 deletions Public/Remove-LMNormalizedProperties.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Function Remove-LMNormalizedProperties {

[CmdletBinding()]
Param (
[Parameter(Mandatory = $true)]
[String]$Alias
)

#Check if we are logged in and have valid api creds
Begin {}
Process {
If ($Script:LMAuth.Valid) {

#Build header and uri
$ResourcePath = "/normalizedProperties/alias"

#Loop through each property and build the body
$Body = [PSCustomObject]@{
data = [PSCustomObject]@{
items = @()
}
}

$Body.data.items += [PSCustomObject]@{
alias = $Alias
model = "normalizedProperties"
}

$Body = $Body | ConvertTo-Json -Depth 10

Try {
$Headers = New-LMHeader -Auth $Script:LMAuth -Method "DELETE" -ResourcePath $ResourcePath -Version 4
$Uri = "https://$($Script:LMAuth.Portal).logicmonitor.com/santaba/rest" + $ResourcePath

Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation

#Issue request
$Response = Invoke-RestMethod -Uri $Uri -Method "DELETE" -Headers $Headers[0] -WebSession $Headers[1] -Body $Body
}
Catch [Exception] {
$Proceed = Resolve-LMException -LMException $PSItem
If (!$Proceed) {
Return
}
}
Return $Response
}
Else {
Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again."
}
}
End {}
}
20 changes: 6 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -427,24 +427,16 @@ This change aims to enhance visibility within the community and to foster a more

We appreciate your continued support and enthusiasm for the Logic.Monitor PowerShell module. Your contributions and feedback are vital to the success of this project, and we look forward to seeing how the module evolves with your participation.

## 6.5.1
## 6.5.2
### Bug Fixes
- Fixed a bug that caused Informational console logs from being displayed. Cmdlets that previously on output status messages to the console should once again produce output as informational stream data.
- Fixed a bug the prevented certain size json objects from being sent to the LM API due to the default depth of 2 being too small.


## 6.5
### Module Updates/Changes
- **Set-LMDeviceDatasourceInstance**: Added `-PropertiesMethod` parameter to control property update behavior. Defaults to "Replace" to match other property-related cmdlets.
- **Copy-LMDashboard**: Added `-DashboardTokens` parameter (hashtable) to override tokens when cloning dashboards.
- **Copy-Report**: Now accepts a report object as a template for cloning. This enables customization of properties, resource scope, and other parameters before creating the copy.
- **New-LMNetScan** and **Set-LMNetScan**: Added `-Schedule` parameter that accepts a PSCustomObject to define scan scheduling. Maintains default manual scheduling when parameter is omitted.

### New Cmdlets
- **Remove-LMDeviceGroupProperty**: Enables removal of device properties at the resource group level.

### Bug Fixes
- **Set-LMCollectorConfig**: Resolved an issue where similar configuration paths could cause unintended multiple updates.
- **New-LMNormalizedProperties**: Added cmdlet to create normalized properties.
- **Remove-LMNormalizedProperties**: Added cmdlet to remove normalized properties.
- **Get-LMNormalizedProperties**: Added cmdlet to get normalized properties.

**Note**: The normalized properties cmdlets are currently only supported for the v4 API and are not supported in the v3 API currently, they are being added to the module as a preview feature for select users until the v3 API is updated to support them in which case the cmdlets will be updated to support the v3 API and available to all users.

[Previous Release Notes](RELEASENOTES.md)

Expand Down
18 changes: 18 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
# Previous module release notes
## 6.5.1
### Bug Fixes
- Fixed a bug that caused Informational console logs from being displayed. Cmdlets that previously on output status messages to the console should once again produce output as informational stream data.


## 6.5
### Module Updates/Changes
- **Set-LMDeviceDatasourceInstance**: Added `-PropertiesMethod` parameter to control property update behavior. Defaults to "Replace" to match other property-related cmdlets.
- **Copy-LMDashboard**: Added `-DashboardTokens` parameter (hashtable) to override tokens when cloning dashboards.
- **Copy-Report**: Now accepts a report object as a template for cloning. This enables customization of properties, resource scope, and other parameters before creating the copy.
- **New-LMNetScan** and **Set-LMNetScan**: Added `-Schedule` parameter that accepts a PSCustomObject to define scan scheduling. Maintains default manual scheduling when parameter is omitted.

### New Cmdlets
- **Remove-LMDeviceGroupProperty**: Enables removal of device properties at the resource group level.

### Bug Fixes
- **Set-LMCollectorConfig**: Resolved an issue where similar configuration paths could cause unintended multiple updates.

## 6.4.1
### Module Updates/Changes
- **Write-LMHost** has been removed entirely starting in this version and replaced with native Write-Information,Warning and Error cmdlets. If you would like to suppress the output of these cmdlets you can use the *\$InformationPreference*, *\$DebugPreference* and *\$WarningPreference* variables. Additionally you can use the *-DisableConsoleLogging* switch on Connect-LMAccount to suppress Write-Information output.
Expand Down

0 comments on commit 4e81ef1

Please sign in to comment.