-
Notifications
You must be signed in to change notification settings - Fork 227
Add new public commands for managing SQL Agent Alerts #2149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
85 commits
Select commit
Hold shift + click to select a range
0ecece0
Improve markdown and changelog instructions for clarity and consistency
johlju 276c6c9
Add new public commands for managing SQL Agent Alerts
johlju 92edce7
Add regex pattern to ignore specific word formats in cSpell settings
johlju 57d8b88
Update DSC class-based resource guidelines for clarity and consistency
johlju 76dd156
Clarify guideline to avoid testing verbose or debug messages in Peste…
johlju d462a1b
Enhance guidelines for ShouldProcess and Force parameter usage in Pow…
johlju 0fd3ee4
Add unit test guidelines for SMO type stubbing and session management
johlju e021916
Clarify guideline on `InModuleScope` usage for public commands to inc…
johlju 6768018
Clarify OutputType usage in function definitions to specify System.St…
johlju 9f1315d
Add guideline to use ErrorAction 'Stop' for immediate failure visibil…
johlju 38e8096
Remove unused New-SqlDscAgentAlertSmoObject and its associated tests
johlju a11721c
Update OutputType guideline to specify empty usage for functions with…
johlju 29f28d9
Fix file naming convention in DSC class resource guidelines
johlju 30983a4
Add section for file naming conventions in PowerShell guidelines
johlju 44e4805
Fix indentation for ShouldProcess guidelines in function parameters s…
johlju e1b0043
Remove sqlcmd.exe from cSpell ignoreRegExpList in settings.json
johlju 7e8fe27
Fix localization keys for SQL Agent Alert functions
johlju 7f6c28b
Update key naming section in localization guidelines for clarity and …
johlju 2be3e9f
Clarify testing guidelines by refining language on verbose/debug mess…
johlju 5de581f
Enhance parameter documentation for SQL Agent Alert functions by addi…
johlju 81f1829
Add clarification for private function naming format in guidelines
johlju ec839f2
Rename private function
johlju c9b9e8c
Add guidelines for handling `-MockWith` blocks in tests
johlju 1fee3f9
Refactor mock commands in tests to remove unnecessary `-MockWith` par…
johlju ced263d
Add guidelines for `$PSDefaultParameterValues` and `-ModuleName` para…
johlju 6f63ee2
Refactor tests for Remove-SqlDscAgentAlert to improve parameter valid…
johlju 7116c8a
Refactor unit tests for SQL DSC Agent Alerts
johlju 3597d33
Refactor New-SqlDscAgentAlert to use static method for alert object c…
johlju c5ec58d
Update source/Public/Get-SqlDscAgentAlert.ps1
johlju 5c59760
Update source/Public/Set-SqlDscAgentAlert.ps1
johlju f875e17
Update source/Public/Test-SqlDscAgentAlert.ps1
johlju 8074e3d
Update tests/Unit/Public/Get-SqlDscAgentAlert.Tests.ps1
johlju a38325f
Add validation for Name parameter in SQL Agent Alert functions
johlju 6993fe4
Refactor Get-SqlDscAgentAlert to streamline alert retrieval and remov…
johlju c5b8e9b
Add INPUTS section to SQL Agent Alert functions for clarity on expect…
johlju c1a5fc2
Add Parent property to JobServer class for better hierarchy represent…
johlju 32fe9e1
Add integration tests for SqlDscAgentAlert commands to enhance test c…
johlju 3c42557
Add integration tests for SQL Agent Alert commands, including Get, Ne…
johlju 7f7082d
Fix formatting in integration tests guidelines for ErrorAction parameter
johlju 0d6d99b
Enhance Server creation by initializing JobServer and its Alerts in C…
johlju 83cea57
Refine ShouldProcess pattern by updating message variable names for c…
johlju 4b5acf5
Refactor SQL Agent Alert messages for improved clarity and consistency
johlju 68444ea
Update output documentation for Get-AgentAlertObject to clarify retur…
johlju 8c3e102
Update Get-SqlDscAgentAlert documentation and tests to clarify output…
johlju a6b13cc
Update New-SqlDscAgentAlert documentation to clarify parameter requir…
johlju d974935
Remove redundant comment in Get-SqlDscAgentAlert tests for clarity
johlju 95469d2
Clarify best practice for assigning unused return objects in Pester t…
johlju 0c7bd9f
Refactor tests to suppress unused return value warnings for alert man…
johlju 790b81c
Enhance tests for New-SqlDscAgentAlert to verify boundary values and …
johlju 6f42365
Enhance Set-SqlDscAgentAlert to check for unchanged properties before…
johlju 387fb3e
Remove redundant comment in 'When no changes are needed' context for …
johlju 9e27498
Merge branch 'main' into f/refactor-sqlagentalert
johlju 816f511
Clarify requirement for string localization to include removal of orp…
johlju d5f0b8b
Remove obsolete SQL Agent Alert strings to streamline localization
johlju a1d3da6
Update source/en-US/SqlServerDsc.strings.psd1
johlju 8d24c97
Update .github/instructions/dsc-community-style-guidelines.instructio…
johlju 0dcf6bb
Remove OUTPUTS section from Remove-SqlDscAgentAlert documentation
johlju 2668b0c
Add Force parameter to Set-SqlDscAgentAlert for non-interactive updates
johlju 32148e6
Clarify 'It' description rule in Pester guidelines to emphasize not u…
johlju 5c85f3e
Refactor integration tests for SqlDscAgentAlert commands to improve c…
johlju bb8c5b2
Add -ErrorAction Stop to New-SqlDscAgentAlert and related tests for b…
johlju e013689
Remove redundant cleanup logic for test alerts in Remove-SqlDscAgentA…
johlju f7332c8
Refactor test cases in Test-SqlDscAgentAlert to improve clarity and c…
johlju edb9243
Refactor New-SqlDscAgentAlert tests to improve structure and clarity …
johlju 25fa7c9
Refactor tests for Set-SqlDscAgentAlert to improve structure and add …
johlju 67606f7
Add test to verify ServerObject parameter accepts pipeline input in T…
johlju b9565fc
Set JobServer.Parent property in Server initialization to establish p…
johlju c32518d
Refactor CreateTypeInstance method to use object initializer for JobS…
johlju 6ee68c3
Set JobServer.Alerts.Parent to establish parent-child relationship in…
johlju 5912913
Fix wording in Test-SqlDscAgentAlert message for clarity
johlju 9317dd8
Update source/Public/Set-SqlDscAgentAlert.ps1
johlju d5e3f5f
Update .github/instructions/dsc-community-style-guidelines-pester.ins…
johlju 38e8822
Clarify syntax rule for 'It' descriptions in Pester guidelines
johlju 3582c0d
Refactor alert cleanup in integration tests for Get-SqlDscAgentAlert,…
johlju a694dca
Refactor integration tests for SQL DSC agent alerts to use mock crede…
johlju ad21960
Update SQL Server connection setup in integration tests to use the co…
johlju 8c1efad
Enhance integration tests for SQL DSC agent alerts by starting and st…
johlju a33cca4
Add SQL Server system message for testing message ID alerts in integr…
johlju dfe3d0c
Remove unused variable for computer name in Get-SqlDscRole integratio…
johlju 84bf73b
Add verbose logging for adding SQL Server system message in integrati…
johlju babe813
Add verbose flag to Invoke-SqlDscQuery for better logging in integrat…
johlju 7ded823
Enhance integration tests for SQL DSC agent alerts by adding error ha…
johlju b508273
Fix severity levels in duplicate alert tests and ensure error handlin…
johlju bc7871f
Set conflicting properties to 0 when updating Severity or MessageId i…
johlju d82b5f8
Add tests to ensure Severity and MessageId are reset to avoid conflic…
johlju File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| <# | ||
| .SYNOPSIS | ||
| Gets a SQL Agent Alert object from the JobServer. | ||
|
|
||
| .DESCRIPTION | ||
| Gets a SQL Agent Alert object from the JobServer based on the specified name. | ||
|
|
||
| .PARAMETER ServerObject | ||
| Specifies the SQL Server object. | ||
|
|
||
| .PARAMETER Name | ||
| Specifies the name of the SQL Agent Alert. | ||
|
|
||
| .OUTPUTS | ||
| Microsoft.SqlServer.Management.Smo.Agent.Alert | ||
|
|
||
| Returns the SQL Agent Alert object when an alert with the specified name is found. | ||
|
|
||
| .OUTPUTS | ||
| None. | ||
|
|
||
| When no alert with the specified name is found. | ||
|
|
||
| .EXAMPLE | ||
| $serverObject = Connect-SqlDscDatabaseEngine | ||
| Get-AgentAlertObject -ServerObject $serverObject -Name 'MyAlert' | ||
|
|
||
| Gets the SQL Agent Alert named 'MyAlert'. | ||
| #> | ||
| function Get-AgentAlertObject | ||
| { | ||
| [CmdletBinding()] | ||
| [OutputType([Microsoft.SqlServer.Management.Smo.Agent.Alert])] | ||
| param | ||
| ( | ||
| [Parameter(Mandatory = $true)] | ||
| [Microsoft.SqlServer.Management.Smo.Server] | ||
| $ServerObject, | ||
|
|
||
| [Parameter(Mandatory = $true)] | ||
| [System.String] | ||
| $Name | ||
| ) | ||
|
|
||
| Write-Verbose -Message ($script:localizedData.Get_AgentAlertObject_GettingAlert -f $Name) | ||
|
|
||
| $alertObject = $ServerObject.JobServer.Alerts | Where-Object -FilterScript { $_.Name -eq $Name } | ||
|
|
||
| return $alertObject | ||
johlju marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.