Skip to content

Implement what-if functionality for Windows service operation#1507

Open
Gijsreyn wants to merge 3 commits intoPowerShell:mainfrom
Gijsreyn:gh-1506/main/add-whatif-winservice
Open

Implement what-if functionality for Windows service operation#1507
Gijsreyn wants to merge 3 commits intoPowerShell:mainfrom
Gijsreyn:gh-1506/main/add-whatif-winservice

Conversation

@Gijsreyn
Copy link
Copy Markdown
Collaborator

@Gijsreyn Gijsreyn commented May 2, 2026

PR Summary

Adds what-if support for Microsoft.Windows/Service set operations so the resource can return projected state and _metadata.whatIf details without changing the service.

PR Context

Fixes #1506

Copilot AI review requested due to automatic review settings May 2, 2026 11:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds native what-if support for the Microsoft.Windows/Service command resource so dsc resource set --what-if can return a projected afterState plus _metadata.whatIf entries without changing the actual service.

Changes:

  • Introduces _metadata.whatIf modeling on the WindowsService type for what-if projections.
  • Extends the set operation plumbing to parse a what-if flag and return projected state/messages (including delete projections when _exist:false).
  • Adds Pester coverage for what-if projections and new localized what-if strings.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
resources/windows_service/tests/windows_service_set.tests.ps1 Adds Pester tests validating projected state and _metadata.whatIf for what-if set/delete scenarios.
resources/windows_service/src/types.rs Adds _metadata / Metadata types to the resource’s JSON model.
resources/windows_service/src/service.rs Implements what-if projection logic for set and delete operations; updates set_service signature.
resources/windows_service/src/main.rs Parses --what-if and routes set requests accordingly (including delete projection).
resources/windows_service/locales/en-us.toml Adds user-facing what-if messages and updates usage text.

Comment thread resources/windows_service/tests/windows_service_set.tests.ps1
Comment thread resources/windows_service/src/service.rs Outdated
Comment thread resources/windows_service/src/service.rs Outdated
Comment thread resources/windows_service/src/main.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support WhatIf for Microsoft.Windows/Service

2 participants