@@ -63,12 +63,17 @@ func (c BrowserPoolsCmd) List(ctx context.Context, in BrowserPoolsListInput) err
6363 }
6464
6565 tableData := pterm.TableData {
66- {"ID" , "Available" , "Acquired" , "Created At" , "Size" },
66+ {"ID" , "Name" , " Available" , "Acquired" , "Created At" , "Size" },
6767 }
6868
6969 for _ , p := range * pools {
70+ name := p .Name
71+ if name == "" {
72+ name = "-"
73+ }
7074 tableData = append (tableData , []string {
7175 p .ID ,
76+ name ,
7277 fmt .Sprintf ("%d" , p .AvailableCount ),
7378 fmt .Sprintf ("%d" , p .AcquiredCount ),
7479 util .FormatLocal (p .CreatedAt ),
@@ -81,6 +86,7 @@ func (c BrowserPoolsCmd) List(ctx context.Context, in BrowserPoolsListInput) err
8186}
8287
8388type BrowserPoolsCreateInput struct {
89+ Name string
8490 Size int64
8591 FillRate int64
8692 TimeoutSeconds int64
@@ -100,6 +106,9 @@ func (c BrowserPoolsCmd) Create(ctx context.Context, in BrowserPoolsCreateInput)
100106 Size : in .Size ,
101107 }
102108
109+ if in .Name != "" {
110+ params .Name = kernel .String (in .Name )
111+ }
103112 if in .FillRate > 0 {
104113 params .FillRatePerMinute = kernel .Int (in .FillRate )
105114 }
@@ -173,7 +182,11 @@ func (c BrowserPoolsCmd) Create(ctx context.Context, in BrowserPoolsCreateInput)
173182 return util.CleanedUpSdkError {Err : err }
174183 }
175184
176- pterm .Success .Printf ("Created browser pool %s\n " , pool .ID )
185+ if pool .Name != "" {
186+ pterm .Success .Printf ("Created browser pool %s (%s)\n " , pool .Name , pool .ID )
187+ } else {
188+ pterm .Success .Printf ("Created browser pool %s\n " , pool .ID )
189+ }
177190 return nil
178191}
179192
@@ -202,9 +215,14 @@ func (c BrowserPoolsCmd) Get(ctx context.Context, in BrowserPoolsGetInput) error
202215 return nil
203216 }
204217
218+ name := pool .Name
219+ if name == "" {
220+ name = "-"
221+ }
205222 tableData := pterm.TableData {
206223 {"Property" , "Value" },
207224 {"ID" , pool .ID },
225+ {"Name" , name },
208226 {"Size" , fmt .Sprintf ("%d" , pool .BrowserPoolConfig .Size )},
209227 {"Available" , fmt .Sprintf ("%d" , pool .AvailableCount )},
210228 {"Acquired" , fmt .Sprintf ("%d" , pool .AcquiredCount )},
@@ -217,6 +235,7 @@ func (c BrowserPoolsCmd) Get(ctx context.Context, in BrowserPoolsGetInput) error
217235
218236type BrowserPoolsUpdateInput struct {
219237 IDOrName string
238+ Name string
220239 Size int64
221240 FillRate int64
222241 TimeoutSeconds int64
@@ -235,6 +254,9 @@ type BrowserPoolsUpdateInput struct {
235254func (c BrowserPoolsCmd ) Update (ctx context.Context , in BrowserPoolsUpdateInput ) error {
236255 params := kernel.BrowserPoolUpdateParams {}
237256
257+ if in .Name != "" {
258+ params .Name = kernel .String (in .Name )
259+ }
238260 if in .Size > 0 {
239261 params .Size = in .Size
240262 }
@@ -313,7 +335,11 @@ func (c BrowserPoolsCmd) Update(ctx context.Context, in BrowserPoolsUpdateInput)
313335 if err != nil {
314336 return util.CleanedUpSdkError {Err : err }
315337 }
316- pterm .Success .Printf ("Updated browser pool %s\n " , pool .ID )
338+ if pool .Name != "" {
339+ pterm .Success .Printf ("Updated browser pool %s (%s)\n " , pool .Name , pool .ID )
340+ } else {
341+ pterm .Success .Printf ("Updated browser pool %s\n " , pool .ID )
342+ }
317343 return nil
318344}
319345
@@ -398,9 +424,6 @@ func (c BrowserPoolsCmd) Flush(ctx context.Context, in BrowserPoolsFlushInput) e
398424 return nil
399425}
400426
401- // Cobra commands (same as before)
402- // ...
403-
404427var browserPoolsCmd = & cobra.Command {
405428 Use : "browser-pools" ,
406429 Aliases : []string {"browser-pool" , "pool" , "pools" },
@@ -467,6 +490,7 @@ func init() {
467490 browserPoolsListCmd .Flags ().StringP ("output" , "o" , "" , "Output format: json for raw API response" )
468491
469492 // create flags
493+ browserPoolsCreateCmd .Flags ().String ("name" , "" , "Optional unique name for the pool" )
470494 browserPoolsCreateCmd .Flags ().Int64 ("size" , 0 , "Number of browsers in the pool" )
471495 _ = browserPoolsCreateCmd .MarkFlagRequired ("size" )
472496 browserPoolsCreateCmd .Flags ().Int64 ("fill-rate" , 0 , "Fill rate per minute" )
@@ -485,6 +509,7 @@ func init() {
485509 browserPoolsGetCmd .Flags ().StringP ("output" , "o" , "" , "Output format: json for raw API response" )
486510
487511 // update flags
512+ browserPoolsUpdateCmd .Flags ().String ("name" , "" , "Update the pool name" )
488513 browserPoolsUpdateCmd .Flags ().Int64 ("size" , 0 , "Number of browsers in the pool" )
489514 browserPoolsUpdateCmd .Flags ().Int64 ("fill-rate" , 0 , "Fill rate per minute" )
490515 browserPoolsUpdateCmd .Flags ().Int64 ("timeout" , 0 , "Idle timeout in seconds" )
@@ -530,6 +555,7 @@ func runBrowserPoolsList(cmd *cobra.Command, args []string) error {
530555func runBrowserPoolsCreate (cmd * cobra.Command , args []string ) error {
531556 client := getKernelClient (cmd )
532557
558+ name , _ := cmd .Flags ().GetString ("name" )
533559 size , _ := cmd .Flags ().GetInt64 ("size" )
534560 fillRate , _ := cmd .Flags ().GetInt64 ("fill-rate" )
535561 timeout , _ := cmd .Flags ().GetInt64 ("timeout" )
@@ -544,6 +570,7 @@ func runBrowserPoolsCreate(cmd *cobra.Command, args []string) error {
544570 viewport , _ := cmd .Flags ().GetString ("viewport" )
545571
546572 in := BrowserPoolsCreateInput {
573+ Name : name ,
547574 Size : size ,
548575 FillRate : fillRate ,
549576 TimeoutSeconds : timeout ,
@@ -572,6 +599,7 @@ func runBrowserPoolsGet(cmd *cobra.Command, args []string) error {
572599func runBrowserPoolsUpdate (cmd * cobra.Command , args []string ) error {
573600 client := getKernelClient (cmd )
574601
602+ name , _ := cmd .Flags ().GetString ("name" )
575603 size , _ := cmd .Flags ().GetInt64 ("size" )
576604 fillRate , _ := cmd .Flags ().GetInt64 ("fill-rate" )
577605 timeout , _ := cmd .Flags ().GetInt64 ("timeout" )
@@ -588,6 +616,7 @@ func runBrowserPoolsUpdate(cmd *cobra.Command, args []string) error {
588616
589617 in := BrowserPoolsUpdateInput {
590618 IDOrName : args [0 ],
619+ Name : name ,
591620 Size : size ,
592621 FillRate : fillRate ,
593622 TimeoutSeconds : timeout ,
0 commit comments