diff --git a/pkg/bindings/generate/generate.go b/pkg/bindings/generate/generate.go index 810aab2b34..d5c9207c6a 100644 --- a/pkg/bindings/generate/generate.go +++ b/pkg/bindings/generate/generate.go @@ -7,10 +7,10 @@ import ( "strconv" "github.com/containers/podman/v4/pkg/bindings" - "github.com/containers/podman/v4/pkg/domain/entities" + "github.com/containers/podman/v4/pkg/domain/entities/types" ) -func Systemd(ctx context.Context, nameOrID string, options *SystemdOptions) (*entities.GenerateSystemdReport, error) { +func Systemd(ctx context.Context, nameOrID string, options *SystemdOptions) (*types.GenerateSystemdReport, error) { if options == nil { options = new(SystemdOptions) } @@ -29,14 +29,14 @@ func Systemd(ctx context.Context, nameOrID string, options *SystemdOptions) (*en } defer response.Body.Close() - report := &entities.GenerateSystemdReport{} + report := &types.GenerateSystemdReport{} return report, response.Process(&report.Units) } // Kube generate Kubernetes YAML (v1 specification) // // Note: Caller is responsible for closing returned reader -func Kube(ctx context.Context, nameOrIDs []string, options *KubeOptions) (*entities.GenerateKubeReport, error) { +func Kube(ctx context.Context, nameOrIDs []string, options *KubeOptions) (*types.GenerateKubeReport, error) { if options == nil { options = new(KubeOptions) } @@ -64,7 +64,7 @@ func Kube(ctx context.Context, nameOrIDs []string, options *KubeOptions) (*entit } if response.StatusCode == http.StatusOK { - return &entities.GenerateKubeReport{Reader: response.Body}, nil + return &types.GenerateKubeReport{Reader: response.Body}, nil } // Unpack the error. diff --git a/pkg/domain/entities/generate.go b/pkg/domain/entities/generate.go index e67c5bb8d9..c123187ced 100644 --- a/pkg/domain/entities/generate.go +++ b/pkg/domain/entities/generate.go @@ -1,6 +1,8 @@ package entities -import "io" +import ( + "github.com/containers/podman/v4/pkg/domain/entities/types" +) // GenerateSystemdOptions control the generation of systemd unit files. type GenerateSystemdOptions struct { @@ -22,10 +24,7 @@ type GenerateSystemdOptions struct { } // GenerateSystemdReport -type GenerateSystemdReport struct { - // Units of the generate process. key = unit name -> value = unit content - Units map[string]string -} +type GenerateSystemdReport = types.GenerateSystemdReport // GenerateKubeOptions control the generation of Kubernetes YAML files. type GenerateKubeOptions struct { @@ -44,16 +43,9 @@ type GenerateKubeOptions struct { type KubeGenerateOptions = GenerateKubeOptions // GenerateKubeReport -// -// FIXME: Podman4.0 should change io.Reader to io.ReaderCloser -type GenerateKubeReport struct { - // Reader - the io.Reader to reader the generated YAML file. - Reader io.Reader -} +type GenerateKubeReport = types.GenerateKubeReport -type GenerateSpecReport struct { - Data []byte -} +type GenerateSpecReport = types.GenerateSpecReport type GenerateSpecOptions struct { ID string diff --git a/pkg/domain/entities/types/generate.go b/pkg/domain/entities/types/generate.go new file mode 100644 index 0000000000..45d4241a63 --- /dev/null +++ b/pkg/domain/entities/types/generate.go @@ -0,0 +1,20 @@ +package types + +import ( + "io" +) + +type GenerateSystemdReport struct { + // Units of the generate process. key = unit name -> value = unit content + Units map[string]string +} + +type GenerateKubeReport struct { + // FIXME: Podman4.0 should change io.Reader to io.ReaderCloser + // Reader - the io.Reader to reader the generated YAML file. + Reader io.Reader +} + +type GenerateSpecReport struct { + Data []byte +}