[Change Safety] Generator: emit GetDynamicParametersValue delegate + IDynamicParameters on write cmdlets (Stages C+D)#1548
Closed
YangAn-microsoft wants to merge 2 commits into
Conversation
…Module.cs and psm1 (Change Safety Stage C)
…eters (Change Safety Stage D)
Author
|
Superseded by #1549. The dynamic-parameter approach here (runtime-wired VTable GetDynamicParameters delegate + generated IDynamicParameters) was replaced, per review feedback, with codegen-owned static parameters — simpler and with no cross-repo runtime coupling. See #1549 and the design in Azure/CLIPS#408. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Generator support for bringing the Change Safety feature (
-AcquirePolicyToken/-ChangeReference) to AutoRest-generated cmdlets. Two commits:powershell/module/module-class.ts,powershell/generators/psm1.ts): the generatedModule.csgains aGetDynamicParametersValueVTable delegate property plus aGetDynamicParameters(invocationInfo, correlationId)wrapper method (mirroring the existingGetParameterValue/GetParameterpattern), and the generated.psm1wires$instance.GetDynamicParametersValue = $VTable.GetDynamicParametersValue. Inert until a cmdlet calls it (Stage D).powershell/cmdlets/class.ts,powershell/internal/powershell-declarations.ts): generated write-verb cmdlets (HTTP PUT/POST/DELETE/PATCH) implementSystem.Management.Automation.IDynamicParametersand emitGetDynamicParameters() => Module.Instance.GetDynamicParameters(this.InvocationInformation, __correlationId). Read-verb cmdlets (GET/HEAD) get a zero diff. Emit is gated to azure projects (where the VTable /__correlationIdexist).Why / dependencies
AutoRest cmdlets don't inherit
AzurePSCmdlet, so Change Safety is injected via theRegister-AzModuleVTable — the same mechanism as auth/telemetry/completers. This generator change is consumed by modules at regeneration time.GetDynamicParametersValueVTable delegate +ContextAdapterimplementation + theAcquirePolicyTokenpipeline step).PolicyTokenAcquirer+ChangeSafetyParameters).Verification
Built the generator, ESLint clean, unit tests pass. Smoke-generation of an azure spec confirms: a write cmdlet (
New-*) implementsIDynamicParametersand emits the wrapper call; aGet-*cmdlet has no such member (zero diff). The generatedModule.csexposesGetDynamicParametersValue+ theGetDynamicParameterswrapper, and the.psm1wires the delegate.Rollout
Ships as a
@autorest/powershellrelease; azure-powershell adopts it per-module at regeneration (pilot module first, then batched) — no module changes here.