Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions internal/app/enaptercli/cmd_device_create_standalone.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type cmdDeviceCreateStandalone struct {
cmdDeviceCreate
siteID string
deviceName string
deviceSlug string
}

func buildCmdDeviceCreateStandalone() *cli.Command {
Expand Down Expand Up @@ -43,13 +44,18 @@ func (c *cmdDeviceCreateStandalone) Flags() []cli.Flag {
Usage: "name for the new device",
Destination: &c.deviceName,
Required: true,
}, &cli.StringFlag{
Name: "device-slug",
Usage: "slug for the new standalone device",
Destination: &c.deviceSlug,
})
}

func (c *cmdDeviceCreateStandalone) do(ctx context.Context) error {
body, err := json.Marshal(map[string]any{
"site_id": c.siteID,
"name": c.deviceName,
"slug": c.deviceSlug,
})
if err != nil {
return fmt.Errorf("build request: %w", err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ OPTIONS:
--verbose log extra details about the operation (default: false)
--site-id value, -s value site ID where the device will be created
--device-name value, -n value name for the new device
--device-slug value slug for the new standalone device
--help, -h show help

ENVIRONMENT VARIABLES:
Expand Down
Loading