Skip to content

Commit eb66420

Browse files
committed
Use the released Hypeman SDK
1 parent 0b8c8d4 commit eb66420

5 files changed

Lines changed: 13 additions & 16 deletions

File tree

‎go.mod‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ require (
88
github.com/charmbracelet/bubbletea v1.3.6
99
github.com/charmbracelet/lipgloss v1.1.0
1010
github.com/charmbracelet/x/term v0.2.1
11+
github.com/docker/docker v28.5.2+incompatible
1112
github.com/google/go-containerregistry v0.20.7
1213
github.com/gorilla/websocket v1.5.3
1314
github.com/itchyny/json2yaml v0.1.4
14-
github.com/kernel/hypeman-go v0.24.0
15+
github.com/kernel/hypeman-go v0.28.0
1516
github.com/knadh/koanf/parsers/yaml v1.1.0
1617
github.com/knadh/koanf/providers/env v1.1.0
1718
github.com/knadh/koanf/providers/file v1.2.1
@@ -43,7 +44,6 @@ require (
4344
github.com/distribution/reference v0.6.0 // indirect
4445
github.com/docker/cli v29.0.3+incompatible // indirect
4546
github.com/docker/distribution v2.8.3+incompatible // indirect
46-
github.com/docker/docker v28.5.2+incompatible // indirect
4747
github.com/docker/docker-credential-helpers v0.9.3 // indirect
4848
github.com/docker/go-connections v0.5.0 // indirect
4949
github.com/docker/go-units v0.5.0 // indirect

‎go.sum‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2
126126
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
127127
github.com/itchyny/json2yaml v0.1.4 h1:/pErVOXGG5iTyXHi/QKR4y3uzhLjGTEmmJIy97YT+k8=
128128
github.com/itchyny/json2yaml v0.1.4/go.mod h1:6iudhBZdarpjLFRNj+clWLAkGft+9uCcjAZYXUH9eGI=
129-
github.com/kernel/hypeman-go v0.24.0 h1:kWssdYGVmnzVAYJcfbowieCazGxITUebrYil+BEBfag=
130-
github.com/kernel/hypeman-go v0.24.0/go.mod h1:of8qI/nef2OPLzt0EMlIRbMdJHEvuc4yWG8g/ioNg48=
129+
github.com/kernel/hypeman-go v0.28.0 h1:1flQG6NfifaqrZsoU5LHydnVEUzaVdWt64/9JvEaOk8=
130+
github.com/kernel/hypeman-go v0.28.0/go.mod h1:of8qI/nef2OPLzt0EMlIRbMdJHEvuc4yWG8g/ioNg48=
131131
github.com/keybase/go-keychain v0.0.1 h1:way+bWYa6lDppZoZcgMbYsvC7GxljxrskdNInRtuthU=
132132
github.com/keybase/go-keychain v0.0.1/go.mod h1:PdEILRW3i9D8JcdM+FmY6RwkHGnhHxXwkPPMeUgOK1k=
133133
github.com/klauspost/compress v1.18.1 h1:bcSGx7UbpBqMChDtsF28Lw6v/G94LPrrbMbdC3JH2co=

‎lib/compose/reconcile.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ func (r *Runner) applyDelete(ctx context.Context, action *Action) error {
320320
return err
321321
}
322322
case "instance":
323-
if err := r.client.Instances.Delete(ctx, action.instanceID, r.opts...); err != nil && !isHTTPNotFound(err) {
323+
if err := r.client.Instances.Delete(ctx, action.instanceID, hypeman.InstanceDeleteParams{}, r.opts...); err != nil && !isHTTPNotFound(err) {
324324
return err
325325
}
326326
case "volume":
@@ -382,7 +382,7 @@ func (r *Runner) applyReplace(ctx context.Context, action *Action, opts UpOption
382382
switch action.Type {
383383
case "instance":
384384
if action.instanceID != "" {
385-
if err := r.client.Instances.Delete(ctx, action.instanceID, r.opts...); err != nil && !isHTTPNotFound(err) {
385+
if err := r.client.Instances.Delete(ctx, action.instanceID, hypeman.InstanceDeleteParams{}, r.opts...); err != nil && !isHTTPNotFound(err) {
386386
return err
387387
}
388388
}

‎pkg/cmd/rm.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ func handleRm(ctx context.Context, cmd *cli.Command) error {
107107
err = client.Instances.Delete(
108108
ctx,
109109
instanceID,
110+
hypeman.InstanceDeleteParams{},
110111
opts...,
111112
)
112113
if err != nil {

‎pkg/cmd/tag.go‎

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,24 +40,20 @@ func handleTag(ctx context.Context, cmd *cli.Command) error {
4040
opts = append(opts, debugMiddlewareOption)
4141
}
4242

43-
var res []byte
44-
opts = append(opts, option.WithResponseBodyInto(&res))
45-
// TODO: switch to a typed Images.Tag once the tag API from kernel/hypeman#453
46-
// is generated into hypeman-go.
47-
body := struct {
48-
Target string `json:"target"`
49-
}{Target: target}
50-
if err := client.Post(ctx, "/images/"+url.PathEscape(source)+"/tag", body, nil, opts...); err != nil {
43+
res, err := client.Images.Tag(ctx, url.PathEscape(source), hypeman.ImageTagParams{
44+
TagImageRequest: hypeman.TagImageRequestParam{Target: target},
45+
}, opts...)
46+
if err != nil {
5147
return err
5248
}
5349

5450
format := cmd.Root().String("format")
5551
transform := cmd.Root().String("transform")
5652
if format != "auto" {
57-
return ShowJSON(os.Stdout, "tag", gjson.ParseBytes(res), format, transform)
53+
return ShowJSON(os.Stdout, "tag", gjson.Parse(res.RawJSON()), format, transform)
5854
}
5955

60-
imageName := gjson.GetBytes(res, "name").String()
56+
imageName := res.Name
6157
if imageName == "" {
6258
imageName = target
6359
}

0 commit comments

Comments
 (0)