Skip to content

Design doc for AMT WSMAN Class data fetch feature

ShradhaGupta31 edited this page May 11, 2026 · 3 revisions

WSMAN Diagnostics Get Flow

This document describes the execution flow of:

rpc diagnostics ws-man get ...

Sequence Diagram

sequenceDiagram
    participant U as User
    participant R as WSManGetCmd.Run
    participant C as resolveClasses
    participant P as ensureAMTPassword
    participant M as newWSMANMessages
    participant F as classFetcher
    participant O as renderResults
    participant T as table renderer

    U->>R: ws-man get -c <class> --format <fmt>
    R->>C: validate class args
    C-->>R: classes / error
    R->>P: ensure credentials
    P-->>R: ok / error
    R->>M: create wsman client
    M-->>R: messages / error

    loop each class
        R->>F: fetch data
        F-->>R: data / error
    end

    R->>O: render by format
    alt format == table
        O->>T: extractClassInstances
        T->>T: parse raw XMLOutput if present
        T-->>O: Name/Value table
    end

    O-->>R: rendered bytes
    R-->>U: stdout or output file
Loading

Notes

  • ensureAMTPassword(ctx) is required so WS-Man requests have credentials. It is fetched using GetLocalSystemAccount().
  • In multi-class mode, a single class fetch failure does not stop the whole command.
  • --format table is XML-driven and prefers raw XMLOutput so zero/false/empty fields are preserved. This is mainly for user to get only the meaningful data.
  • --format json and --format xml keep their existing serialization behavior.

Main Code Reference

  • internal/commands/diagnostics/wsman.go

Clone this wiki locally