Skip to content

Commit

Permalink
try passing in a dummy request body
Browse files Browse the repository at this point in the history
  • Loading branch information
ctreatma committed Jun 25, 2024
1 parent 8ac5db5 commit 40fe50f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions internal/resources/metal/port/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ import (
"github.com/pkg/errors"
)

var (
// Deprecated: empty port assignment input that is required
// for some endpoints; probably indicates a bug in the API spec
dummy = metalv1.PortAssignInput{}
)

type ClientPortResource struct {
Client *metalv1.APIClient
Port *metalv1.Port
Expand Down Expand Up @@ -287,7 +293,7 @@ func convertToL2(ctx context.Context) func(cpr *ClientPortResource) error {
isLayer2 := slices.Contains(l2Types, cpr.Port.GetNetworkType())

if l2Ok && l2.(bool) && !isLayer2 {
port, _, err := cpr.Client.PortsApi.ConvertLayer2(ctx, cpr.Port.GetId()).Execute()
port, _, err := cpr.Client.PortsApi.ConvertLayer2(ctx, cpr.Port.GetId()).PortAssignInput(dummy).Execute()
if err != nil {
return err
}
Expand All @@ -311,7 +317,7 @@ func convertToL3(ctx context.Context) func(cpr *ClientPortResource) error {
},
}

port, _, err := cpr.Client.PortsApi.ConvertLayer3(ctx, cpr.Port.GetId()).PortConvertLayer3Input(ips).Execute()
port, _, err := cpr.Client.PortsApi.ConvertLayer3(ctx, cpr.Port.GetId()).PortConvertLayer3Input(ips).PortAssignInput(dummy).Execute()

Check failure on line 320 in internal/resources/metal/port/helpers.go

View workflow job for this annotation

GitHub Actions / Test

cpr.Client.PortsApi.ConvertLayer3(ctx, cpr.Port.GetId()).PortConvertLayer3Input(ips).PortAssignInput undefined (type metalv1.ApiConvertLayer3Request has no field or method PortAssignInput)

Check failure on line 320 in internal/resources/metal/port/helpers.go

View workflow job for this annotation

GitHub Actions / Build

cpr.Client.PortsApi.ConvertLayer3(ctx, cpr.Port.GetId()).PortConvertLayer3Input(ips).PortAssignInput undefined (type metalv1.ApiConvertLayer3Request has no field or method PortAssignInput)
if err != nil {
return err
}
Expand Down

0 comments on commit 40fe50f

Please sign in to comment.