@@ -98,27 +98,27 @@ type BrowserPoolsCreateInput struct {
9898}
9999
100100func (c BrowserPoolsCmd ) Create (ctx context.Context , in BrowserPoolsCreateInput ) error {
101- req := kernel.BrowserPoolRequestParam {
101+ params := kernel.BrowserPoolNewParams {
102102 Size : in .Size ,
103103 }
104104
105105 if in .Name != "" {
106- req .Name = kernel .String (in .Name )
106+ params .Name = kernel .String (in .Name )
107107 }
108108 if in .FillRate > 0 {
109- req .FillRatePerMinute = kernel .Int (in .FillRate )
109+ params .FillRatePerMinute = kernel .Int (in .FillRate )
110110 }
111111 if in .TimeoutSeconds > 0 {
112- req .TimeoutSeconds = kernel .Int (in .TimeoutSeconds )
112+ params .TimeoutSeconds = kernel .Int (in .TimeoutSeconds )
113113 }
114114 if in .Stealth .Set {
115- req .Stealth = kernel .Bool (in .Stealth .Value )
115+ params .Stealth = kernel .Bool (in .Stealth .Value )
116116 }
117117 if in .Headless .Set {
118- req .Headless = kernel .Bool (in .Headless .Value )
118+ params .Headless = kernel .Bool (in .Headless .Value )
119119 }
120120 if in .Kiosk .Set {
121- req .KioskMode = kernel .Bool (in .Kiosk .Value )
121+ params .KioskMode = kernel .Bool (in .Kiosk .Value )
122122 }
123123
124124 profile , err := buildProfileParam (in .ProfileID , in .ProfileName , in .ProfileSaveChanges )
@@ -127,26 +127,22 @@ func (c BrowserPoolsCmd) Create(ctx context.Context, in BrowserPoolsCreateInput)
127127 return nil
128128 }
129129 if profile != nil {
130- req .Profile = * profile
130+ params .Profile = * profile
131131 }
132132
133133 if in .ProxyID != "" {
134- req .ProxyID = kernel .String (in .ProxyID )
134+ params .ProxyID = kernel .String (in .ProxyID )
135135 }
136136
137- req .Extensions = buildExtensionsParam (in .Extensions )
137+ params .Extensions = buildExtensionsParam (in .Extensions )
138138
139139 viewport , err := buildViewportParam (in .Viewport )
140140 if err != nil {
141141 pterm .Error .Println (err .Error ())
142142 return nil
143143 }
144144 if viewport != nil {
145- req .Viewport = * viewport
146- }
147-
148- params := kernel.BrowserPoolNewParams {
149- BrowserPoolRequest : req ,
145+ params .Viewport = * viewport
150146 }
151147
152148 pool , err := c .client .New (ctx , params )
@@ -231,31 +227,31 @@ type BrowserPoolsUpdateInput struct {
231227}
232228
233229func (c BrowserPoolsCmd ) Update (ctx context.Context , in BrowserPoolsUpdateInput ) error {
234- req := kernel.BrowserPoolUpdateRequestParam {}
230+ params := kernel.BrowserPoolUpdateParams {}
235231
236232 if in .Name != "" {
237- req .Name = kernel .String (in .Name )
233+ params .Name = kernel .String (in .Name )
238234 }
239235 if in .Size > 0 {
240- req .Size = in .Size
236+ params .Size = in .Size
241237 }
242238 if in .FillRate > 0 {
243- req .FillRatePerMinute = kernel .Int (in .FillRate )
239+ params .FillRatePerMinute = kernel .Int (in .FillRate )
244240 }
245241 if in .TimeoutSeconds > 0 {
246- req .TimeoutSeconds = kernel .Int (in .TimeoutSeconds )
242+ params .TimeoutSeconds = kernel .Int (in .TimeoutSeconds )
247243 }
248244 if in .Stealth .Set {
249- req .Stealth = kernel .Bool (in .Stealth .Value )
245+ params .Stealth = kernel .Bool (in .Stealth .Value )
250246 }
251247 if in .Headless .Set {
252- req .Headless = kernel .Bool (in .Headless .Value )
248+ params .Headless = kernel .Bool (in .Headless .Value )
253249 }
254250 if in .Kiosk .Set {
255- req .KioskMode = kernel .Bool (in .Kiosk .Value )
251+ params .KioskMode = kernel .Bool (in .Kiosk .Value )
256252 }
257253 if in .DiscardAllIdle .Set {
258- req .DiscardAllIdle = kernel .Bool (in .DiscardAllIdle .Value )
254+ params .DiscardAllIdle = kernel .Bool (in .DiscardAllIdle .Value )
259255 }
260256
261257 profile , err := buildProfileParam (in .ProfileID , in .ProfileName , in .ProfileSaveChanges )
@@ -264,26 +260,22 @@ func (c BrowserPoolsCmd) Update(ctx context.Context, in BrowserPoolsUpdateInput)
264260 return nil
265261 }
266262 if profile != nil {
267- req .Profile = * profile
263+ params .Profile = * profile
268264 }
269265
270266 if in .ProxyID != "" {
271- req .ProxyID = kernel .String (in .ProxyID )
267+ params .ProxyID = kernel .String (in .ProxyID )
272268 }
273269
274- req .Extensions = buildExtensionsParam (in .Extensions )
270+ params .Extensions = buildExtensionsParam (in .Extensions )
275271
276272 viewport , err := buildViewportParam (in .Viewport )
277273 if err != nil {
278274 pterm .Error .Println (err .Error ())
279275 return nil
280276 }
281277 if viewport != nil {
282- req .Viewport = * viewport
283- }
284-
285- params := kernel.BrowserPoolUpdateParams {
286- BrowserPoolUpdateRequest : req ,
278+ params .Viewport = * viewport
287279 }
288280
289281 pool , err := c .client .Update (ctx , in .IDOrName , params )
@@ -322,12 +314,9 @@ type BrowserPoolsAcquireInput struct {
322314}
323315
324316func (c BrowserPoolsCmd ) Acquire (ctx context.Context , in BrowserPoolsAcquireInput ) error {
325- req := kernel.BrowserPoolAcquireRequestParam {}
317+ params := kernel.BrowserPoolAcquireParams {}
326318 if in .TimeoutSeconds > 0 {
327- req .AcquireTimeoutSeconds = kernel .Int (in .TimeoutSeconds )
328- }
329- params := kernel.BrowserPoolAcquireParams {
330- BrowserPoolAcquireRequest : req ,
319+ params .AcquireTimeoutSeconds = kernel .Int (in .TimeoutSeconds )
331320 }
332321 resp , err := c .client .Acquire (ctx , in .IDOrName , params )
333322 if err != nil {
@@ -355,14 +344,11 @@ type BrowserPoolsReleaseInput struct {
355344}
356345
357346func (c BrowserPoolsCmd ) Release (ctx context.Context , in BrowserPoolsReleaseInput ) error {
358- req := kernel.BrowserPoolReleaseRequestParam {
347+ params := kernel.BrowserPoolReleaseParams {
359348 SessionID : in .SessionID ,
360349 }
361350 if in .Reuse .Set {
362- req .Reuse = kernel .Bool (in .Reuse .Value )
363- }
364- params := kernel.BrowserPoolReleaseParams {
365- BrowserPoolReleaseRequest : req ,
351+ params .Reuse = kernel .Bool (in .Reuse .Value )
366352 }
367353 err := c .client .Release (ctx , in .IDOrName , params )
368354 if err != nil {
0 commit comments