Skip to content

api/types: move Ping and swarm.Status to client#51258

Merged
thaJeztah merged 1 commit intomoby:masterfrom
thaJeztah:client_ping
Oct 22, 2025
Merged

api/types: move Ping and swarm.Status to client#51258
thaJeztah merged 1 commit intomoby:masterfrom
thaJeztah:client_ping

Conversation

@thaJeztah
Copy link
Member

The API does not produce these as a response; the fields in the Ping struct, including the Swarm status are propagated from headers returned by the /_ping endpoint.

- Human readable description for the release notes

- A picture of a cute animal (not mandatory but encouraged)

@thaJeztah thaJeztah added this to the 29.0.0 milestone Oct 22, 2025
@thaJeztah thaJeztah added status/2-code-review kind/refactor PR's that refactor, or clean-up code release-blocker PRs we want to block a release on module/api module/client labels Oct 22, 2025
// back to the oldest API version supported.
func (cli *Client) NegotiateAPIVersionPing(pingResponse types.Ping) {
func (cli *Client) NegotiateAPIVersionPing(pingResponse PingResult) {
// TODO(thaJeztah): should this take a "Ping" option? It only consumes the version. This method should be removed overall and not be exported.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some ideas to get rid of this, but will work on that for a follow-up;

  • Make Ping also perform negotiation if the CLI is configured to do so
  • Optionally, add a PingOptions struct to force negotiation

With that, we could potentially;

  • Remove NegotiateAPIVersionPing
  • Remove NegotiateAPIVersion (which would now become Ping() with the NegotiateAPIVersion option enabled

client/ping.go Outdated
Comment on lines +21 to +47
func (cli *Client) Ping(ctx context.Context) (types.Ping, error) {
func (cli *Client) Ping(ctx context.Context) (PingResult, error) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually; let me already add a PingOptions struct

The API does not produce these as a response; the fields in the Ping
struct, including the Swarm status are propagated from headers returned
by the /_ping endpoint.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah merged commit 78d228b into moby:master Oct 22, 2025
253 of 255 checks passed
@thaJeztah thaJeztah deleted the client_ping branch October 22, 2025 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants