update FabricDetails to use class object for consistency#526
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request refactors SDN fabric infrastructure handling by introducing a centralized SdnFabricInfrastructure class and using it as a strongly-typed parameter across certificate management functions. The changes improve code maintainability, type safety, and consistency while automating certificate distribution across SDN fabric nodes.
Changes:
- Centralized the
SdnFabricInfrastructureclass definition in the main module and updated all role modules to reference it viausing modulestatements - Replaced generic
[System.Object]parameter types with strongly-typed[SdnFabricInfrastructure]across certificate creation and rotation functions - Enhanced certificate functions to conditionally distribute generated certificates to all fabric nodes when FabricDetails is provided
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/SdnDiagnostics.psm1 | Added centralized SdnFabricInfrastructure class definition and updated parameter type in certificate rotation scriptblock |
| src/modules/SdnDiag.NetworkController.psm1 | Removed duplicate class definition, added using statement, updated parameter types, improved role validation, and added conditional certificate distribution |
| src/modules/SdnDiag.LoadBalancerMux.psm1 | Added using statement, updated parameter types, replaced feature checks with Confirm-IsLoadBalancerMux, and added conditional certificate distribution |
| src/modules/SdnDiag.Server.psm1 | Added using statement, updated parameter types and documentation, and added conditional certificate distribution |
| src/modules/SdnDiag.Common.psm1 | Added using statement and updated parameter types for certificate distribution functions |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…to make-fabricdetails-required
…osoft/SdnDiagnostics into make-fabricdetails-required
andrwli
reviewed
Jan 21, 2026
andrwli
approved these changes
Jan 26, 2026
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.
This pull request introduces a new shared
SdnFabricInfrastructureclass for representing SDN fabric details and updates all relevant modules and functions to use this strongly-typed class instead ofSystem.Object. Additionally, it improves certificate management by ensuring generated certificates are distributed to the entire SDN fabric when appropriate, and refactors admin/environment checks for clarity and consistency. Below are the most important changes:Shared Infrastructure Type and Refactoring:
SdnFabricInfrastructureclass insrc/classes/Common.psm1to standardize SDN fabric details across modules. All functions that previously accepted a genericSystem.Objectfor fabric details now require this strongly-typed class.SdnFabricInfrastructureclass definition fromSdnDiag.NetworkController.psm1in favor of the shared version. All modules now import the shared class usingusing modulestatements. [1] [2] [3] [4] [5] [6]Certificate Management Improvements:
New-SdnNetworkControllerNodeCertificate,New-SdnMuxCertificate,New-SdnServerCertificate) to distribute newly generated certificates to all relevant nodes in the SDN fabric ifFabricDetailsis provided, using the new type. [1] [2] [3]SdnFabricInfrastructuretype and clarify the expected input. [1] [2] [3] [4] [5] [6]Admin and Environment Validation Refactoring:
Confirm-IsAdmin,Confirm-IsNetworkController,Confirm-IsLoadBalancerMux) for improved clarity and maintainability. [1] [2]Certificate Rotation Functions:
SdnFabricInfrastructuretype for fabric details and improved logging and try/catch structure for better error handling and traceability. [1] [2] [3] [4] [5] [6] [7] [8]Documentation and Parameter Updates:
FabricDetailsnow refers to the environment info derived fromGet-SdnInfrastructureInfoand is of the new shared type. [1] [2] [3]These changes improve code consistency, type safety, and reliability in SDN diagnostics and certificate management workflows.
Change type
Checklist: