Documentation
¶
Overview ¶
Package ppdmclient is the per-server Dell PowerProtect Data Manager REST API client.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client interface {
// Name returns the configured server name (used as the `server` label).
Name() string
// Get fetches an absolute API path (e.g. "/api/v2/activities") and JSON-decodes
// the body into out. It (re-)authenticates as needed.
Get(ctx context.Context, path string, out any) error
// Close releases the session and HTTP resources.
Close() error
}
Client is the per-server PPDM API client abstraction, satisfied by the live ServerClient and by Mock (tests). Get authenticates lazily and decodes JSON.
type Config ¶
type Config struct {
Name string
BaseURL string // e.g. https://ppdm01.example.com:8443
Username string
Password string
InsecureSkipVerify bool
HTTPClient *http.Client
// Trace logs every API response body (method, URL, status, body) for
// validating payload shapes against a live appliance. The login exchange is
// skipped — PPDM returns the access_token in the login response body — and
// headers are never logged, so the bearer token cannot leak. Verbose —
// debugging only.
Trace bool
}
Config configures a ServerClient. HTTPClient is optional (tests inject the httptest TLS client); when nil a client honoring InsecureSkipVerify is built.
type Mock ¶
type Mock struct {
// contains filtered or unexported fields
}
Mock is an in-memory Client that serves canned JSON bodies per path. Tests use it to drive collectors without a live server.
func (*Mock) SetJSONPrefix ¶
SetJSONPrefix registers a body matched by path prefix (ignores the query string), so paginated calls like "/api/v2/assets?page=0&pageSize=500" resolve to one body.
type ServerClient ¶
type ServerClient struct {
// contains filtered or unexported fields
}
ServerClient is the live per-server PPDM REST client.
func NewServerClient ¶
func NewServerClient(cfg Config) *ServerClient
NewServerClient builds a client. Auth is lazy (on first Get).
func (*ServerClient) Close ¶
func (c *ServerClient) Close() error
Close is best-effort logout. PPDM access tokens expire on their own; there is no mandatory server-side logout, so this just drops the cached token.
func (*ServerClient) Get ¶
Get fetches path, authenticating first and re-authenticating once on 401.
func (*ServerClient) Name ¶
func (c *ServerClient) Name() string