podman
27 строк · 813.0 Байт
1// Copyright 2017 go-dockerclient authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package docker
6
7import (
8"encoding/json"
9"net/http"
10
11"github.com/docker/docker/api/types/registry"
12)
13
14// InspectDistribution returns image digest and platform information by contacting the registry
15func (c *Client) InspectDistribution(name string) (*registry.DistributionInspect, error) {
16path := "/distribution/" + name + "/json"
17resp, err := c.do(http.MethodGet, path, doOptions{})
18if err != nil {
19return nil, err
20}
21defer resp.Body.Close()
22var distributionInspect registry.DistributionInspect
23if err := json.NewDecoder(resp.Body).Decode(&distributionInspect); err != nil {
24return nil, err
25}
26return &distributionInspect, nil
27}
28