diff --git a/docs/metal_device_create.md b/docs/metal_device_create.md index af67616c..827decb9 100644 --- a/docs/metal_device_create.md +++ b/docs/metal_device_create.md @@ -37,7 +37,7 @@ metal device create -p (-m | -f ) -P -H 0 { - req.Tags = &tags + DeviceUpdate.Tags = tags } if alwaysPXE { - req.AlwaysPXE = &alwaysPXE + DeviceUpdate.AlwaysPxe = &alwaysPXE } if ipxescripturl != "" { - req.IPXEScriptURL = &ipxescripturl + DeviceUpdate.IpxeScriptUrl = &ipxescripturl } if customdata != "" { - req.CustomData = &customdata - } + var customdataIntr map[string]interface{} + err := json.Unmarshal([]byte(customdata), &customdataIntr) + if err != nil { + panic(err) + } - device, _, err := c.Service.Update(deviceID, req) + DeviceUpdate.Customdata = customdataIntr + } + device, _, err := c.Service.UpdateDevice(context.Background(), deviceID).DeviceUpdateInput(*DeviceUpdate).Execute() if err != nil { return fmt.Errorf("Could not update Device: %w", err) } header := []string{"ID", "Hostname", "OS", "State"} data := make([][]string, 1) - data[0] = []string{device.ID, device.Hostname, device.OS.Name, device.State} + data[0] = []string{device.GetId(), device.GetHostname(), *device.GetOperatingSystem().Name, device.GetState()} return c.Out.Output(device, header, &data) },