a1e67401d2
- updated the default value for `--limit` on `docker search` as the const has been removed (added a todo to remove it) - updated some fixtures to account for `KernelMemoryTCP` no longer being included in the output. full diff: https://github.com/docker/docker/compare/83b51522df43866e39f7c757a6ab84ef4050eeb3...8941dcfcc5db4aefc351cd5b5bb4d524823035c0 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
33 lines
819 B
Go
33 lines
819 B
Go
package client // import "github.com/docker/docker/client"
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
"encoding/json"
|
|
"io"
|
|
|
|
"github.com/docker/docker/api/types/swarm"
|
|
)
|
|
|
|
// TaskInspectWithRaw returns the task information and its raw representation.
|
|
func (cli *Client) TaskInspectWithRaw(ctx context.Context, taskID string) (swarm.Task, []byte, error) {
|
|
if taskID == "" {
|
|
return swarm.Task{}, nil, objectNotFoundError{object: "task", id: taskID}
|
|
}
|
|
serverResp, err := cli.get(ctx, "/tasks/"+taskID, nil, nil)
|
|
defer ensureReaderClosed(serverResp)
|
|
if err != nil {
|
|
return swarm.Task{}, nil, err
|
|
}
|
|
|
|
body, err := io.ReadAll(serverResp.body)
|
|
if err != nil {
|
|
return swarm.Task{}, nil, err
|
|
}
|
|
|
|
var response swarm.Task
|
|
rdr := bytes.NewReader(body)
|
|
err = json.NewDecoder(rdr).Decode(&response)
|
|
return response, body, err
|
|
}
|