github.com/containers/podman/v4@v4.9.4/pkg/bindings/images/diff.go (about)

     1  package images
     2  
     3  import (
     4  	"context"
     5  	"net/http"
     6  
     7  	"github.com/containers/podman/v4/pkg/bindings"
     8  	"github.com/containers/storage/pkg/archive"
     9  )
    10  
    11  // Diff provides the changes between two container layers
    12  func Diff(ctx context.Context, nameOrID string, options *DiffOptions) ([]archive.Change, error) {
    13  	if options == nil {
    14  		options = new(DiffOptions)
    15  	}
    16  	_ = options
    17  	conn, err := bindings.GetClient(ctx)
    18  	if err != nil {
    19  		return nil, err
    20  	}
    21  
    22  	response, err := conn.DoRequest(ctx, nil, http.MethodGet, "/images/%s/changes", nil, nil, nameOrID)
    23  	if err != nil {
    24  		return nil, err
    25  	}
    26  	defer response.Body.Close()
    27  
    28  	var changes []archive.Change
    29  	return changes, response.Process(&changes)
    30  }