Skip to content

Commit 55364f4

Browse files
committed
bring back some imp code that were removed previously and fix some nits
1 parent d47b553 commit 55364f4

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

pkg/client/sdk.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ func (c *SdkStackitClient) GetNICsForServer(ctx context.Context, projectID, regi
298298
}
299299

300300
func (c *SdkStackitClient) ListNICs(ctx context.Context, projectID, region, networkID string) ([]*NIC, error) {
301-
res, err := c.iaasClient.ListNics(ctx, projectID, region, networkID).Execute()
301+
res, err := c.iaasClient.DefaultAPI.ListNics(ctx, projectID, region, networkID).Execute()
302302
if err != nil {
303303
return nil, fmt.Errorf("SDK ListServerNICs failed: %w", err)
304304
}
@@ -308,15 +308,15 @@ func (c *SdkStackitClient) ListNICs(ctx context.Context, projectID, region, netw
308308
}
309309

310310
nics := make([]*NIC, 0)
311-
for _, nic := range *res.Items {
311+
for _, nic := range res.Items {
312312
nics = append(nics, convertSDKNICtoNIC(&nic))
313313
}
314314

315315
return nics, nil
316316
}
317317

318318
func (c *SdkStackitClient) DeleteNIC(ctx context.Context, projectID, region, networkID, nicID string) error {
319-
err := c.iaasClient.DeleteNic(ctx, projectID, region, networkID, nicID).Execute()
319+
err := c.iaasClient.DefaultAPI.DeleteNic(ctx, projectID, region, networkID, nicID).Execute()
320320
if err != nil {
321321
// Check if error is 404 Not Found - this is OK (idempotent)
322322
if isNotFoundError(err) {
@@ -393,3 +393,10 @@ func isNotFoundError(err error) bool {
393393
}
394394
return false
395395
}
396+
397+
func getStringValue(s *string) string {
398+
if s == nil {
399+
return ""
400+
}
401+
return *s
402+
}

0 commit comments

Comments
 (0)