Skip to main content

node.disk.get

Get disk usage statistics for all mounted filesystems.

Usage

task := plan.TaskFunc("get-disk",
func(
ctx context.Context,
c *client.Client,
) (*orchestrator.Result, error) {
resp, err := c.Node.Disk(ctx, "_any")
if err != nil {
return nil, err
}

return orchestrator.CollectionResult(
resp.Data,
func(r client.DiskResult) orchestrator.HostResult {
return orchestrator.HostResult{
Hostname: r.Hostname,
Changed: r.Changed,
Error: r.Error,
}
},
), nil
},
)

Parameters

None.

Target

Accepts any valid target: _any, _all, a hostname, or a label selector (key:value).

Idempotency

Read-only. Never modifies state. Always returns Changed: false.

Permissions

Requires node:read permission.

Example

See examples/sdk/orchestrator/operations/node-disk.go for a complete working example.