@@ -117,14 +117,14 @@ func fixtureStandardInputModel(mods ...func(model *inputModel)) *inputModel {
117117 Verbosity : globalflags .VerbosityDefault ,
118118 },
119119 InstanceId : testInstanceId ,
120- FlavorId : utils . Ptr (testFlavorId ),
121- InstanceName : utils . Ptr ("example-name" ),
122- ACL : utils . Ptr ([]string {"0.0.0.0/0" }),
123- BackupSchedule : utils . Ptr ("0 0 * * *" ),
124- StorageClass : utils . Ptr ("class" ),
125- StorageSize : utils . Ptr (int64 (10 )),
126- Version : utils . Ptr ("5.0" ),
127- Type : utils . Ptr ("Single" ),
120+ FlavorId : new (testFlavorId ),
121+ InstanceName : new ("example - name "),
122+ ACL : new ([]string {"0.0 .0 .0 / 0 "}),
123+ BackupSchedule : new ("0 0 * * * "),
124+ StorageClass : new ("class" ),
125+ StorageSize : new (int64 (10 )),
126+ Version : new ("5.0 "),
127+ Type : new ("Single "),
128128 }
129129 for _ , mod := range mods {
130130 mod (model )
@@ -193,8 +193,8 @@ func TestParseInput(t *testing.T) {
193193 isValid : true ,
194194 expectedModel : fixtureStandardInputModel (func (model * inputModel ) {
195195 model .FlavorId = nil
196- model .CPU = utils . Ptr (int32 (2 ))
197- model .RAM = utils . Ptr (int32 (4 ))
196+ model .CPU = new (int32 (2 ))
197+ model.RAM = new (int32 (4 ))
198198 }),
199199 },
200200 {
@@ -270,7 +270,7 @@ func TestParseInput(t *testing.T) {
270270 aclValues : []string {"198.51.100.14/24" , "198.51.100.14/32" },
271271 isValid : true ,
272272 expectedModel : fixtureRequiredInputModel (func (model * inputModel ) {
273- model .ACL = utils . Ptr ([]string {"198.51.100.14/24" , "198.51.100.14/32" })
273+ model .ACL = new ([]string {"198.51.100.14/24" , "198.51.100.14/32" })
274274 }),
275275 },
276276 }
@@ -357,100 +357,100 @@ func TestBuildRequest(t *testing.T) {
357357 {
358358 description : "update flavor from id" ,
359359 model : fixtureRequiredInputModel (func (model * inputModel ) {
360- model .FlavorId = utils . Ptr (testFlavorId )
360+ model .FlavorId = new (testFlavorId )
361361 }),
362362 isValid : true ,
363363 mockClientSettings : mockClientSettings {
364364 listFlavorsResp : & mongodbflex.ListFlavorsResponse {
365365 Flavors : []mongodbflex.InstanceFlavor {
366366 {
367- Id : utils . Ptr (testFlavorId ),
368- Cpu : utils . Ptr (int32 (2 )),
369- Memory : utils . Ptr (int32 (4 )),
367+ Id : new (testFlavorId ),
368+ Cpu : new (int32 (2 )),
369+ Memory : new (int32 (4 )),
370370 },
371371 },
372372 },
373373 },
374374 expectedRequest : testClient .DefaultAPI .PartialUpdateInstance (testCtx , testProjectId , testInstanceId , testRegion ).
375375 PartialUpdateInstancePayload (mongodbflex.PartialUpdateInstancePayload {
376- FlavorId : utils . Ptr (testFlavorId ),
376+ FlavorId : new (testFlavorId ),
377377 }),
378378 },
379379 {
380380 description : "update flavor from cpu and ram" ,
381381 model : fixtureRequiredInputModel (func (model * inputModel ) {
382- model .CPU = utils . Ptr (int32 (2 ))
383- model .RAM = utils . Ptr (int32 (4 ))
382+ model .CPU = new (int32 (2 ))
383+ model.RAM = new (int32 (4 ))
384384 }),
385385 isValid : true ,
386386 mockClientSettings : mockClientSettings {
387387 listFlavorsResp : & mongodbflex.ListFlavorsResponse {
388388 Flavors : []mongodbflex.InstanceFlavor {
389389 {
390- Id : utils . Ptr (testFlavorId ),
391- Cpu : utils . Ptr (int32 (2 )),
392- Memory : utils . Ptr (int32 (4 )),
390+ Id : new (testFlavorId ),
391+ Cpu : new (int32 (2 )),
392+ Memory : new (int32 (4 )),
393393 },
394394 },
395395 },
396396 },
397397 expectedRequest : testClient .DefaultAPI .PartialUpdateInstance (testCtx , testProjectId , testInstanceId , testRegion ).
398398 PartialUpdateInstancePayload (mongodbflex.PartialUpdateInstancePayload {
399- FlavorId : utils . Ptr (testFlavorId ),
399+ FlavorId : new (testFlavorId ),
400400 }),
401401 },
402402 {
403403 description : "update storage class only" ,
404404 model : fixtureRequiredInputModel (func (model * inputModel ) {
405- model .StorageClass = utils . Ptr ("class" )
405+ model .StorageClass = new ("class ")
406406 }),
407407 isValid : true ,
408408 mockClientSettings : mockClientSettings {
409409 getInstanceResp : & mongodbflex.InstanceResponse {
410410 Item : & mongodbflex.Instance {
411411 Flavor : & mongodbflex.Flavor {
412- Id : utils . Ptr (testFlavorId ),
412+ Id : new (testFlavorId ),
413413 },
414414 },
415415 },
416416 },
417417 expectedRequest : testClient .DefaultAPI .PartialUpdateInstance (testCtx , testProjectId , testInstanceId , testRegion ).
418418 PartialUpdateInstancePayload (mongodbflex.PartialUpdateInstancePayload {
419419 Storage : & mongodbflex.Storage {
420- Class : utils . Ptr ("class" ),
420+ Class : new ("class "),
421421 },
422422 }),
423423 },
424424 {
425425 description : "update storage class and size" ,
426426 model : fixtureRequiredInputModel (func (model * inputModel ) {
427- model .StorageClass = utils . Ptr ("class" )
428- model .StorageSize = utils . Ptr (int64 (10 ))
427+ model .StorageClass = new ("class ")
428+ model .StorageSize = new (int64 (10 ))
429429 }),
430430 isValid : true ,
431431 mockClientSettings : mockClientSettings {
432432 getInstanceResp : & mongodbflex.InstanceResponse {
433433 Item : & mongodbflex.Instance {
434434 Flavor : & mongodbflex.Flavor {
435- Id : utils . Ptr (testFlavorId ),
435+ Id : new (testFlavorId ),
436436 },
437437 },
438438 },
439439 },
440440 expectedRequest : testClient .DefaultAPI .PartialUpdateInstance (testCtx , testProjectId , testInstanceId , testRegion ).
441441 PartialUpdateInstancePayload (mongodbflex.PartialUpdateInstancePayload {
442442 Storage : & mongodbflex.Storage {
443- Class : utils . Ptr ("class" ),
444- Size : utils . Ptr (int64 (10 )),
443+ Class : new ("class "),
444+ Size : new (int64 (10 )),
445445 },
446446 }),
447447 },
448448 {
449449 description : "get flavors fails" ,
450450 model : fixtureRequiredInputModel (
451451 func (model * inputModel ) {
452- model .CPU = utils . Ptr (int32 (2 ))
453- model .RAM = utils . Ptr (int32 (4 ))
452+ model .CPU = new (int32 (2 ))
453+ model.RAM = new (int32 (4 ))
454454 },
455455 ),
456456 mockClientSettings : mockClientSettings {
@@ -462,22 +462,22 @@ func TestBuildRequest(t *testing.T) {
462462 description : "flavor id not found" ,
463463 model : fixtureRequiredInputModel (
464464 func (model * inputModel ) {
465- model .CPU = utils . Ptr (int32 (5 ))
466- model .RAM = utils . Ptr (int32 (9 ))
465+ model .CPU = new (int32 (5 ))
466+ model.RAM = new (int32 (9 ))
467467 },
468468 ),
469469 mockClientSettings : mockClientSettings {
470470 listFlavorsResp : & mongodbflex.ListFlavorsResponse {
471471 Flavors : []mongodbflex.InstanceFlavor {
472472 {
473- Id : utils . Ptr (testFlavorId ),
474- Cpu : utils . Ptr (int32 (2 )),
475- Memory : utils . Ptr (int32 (4 )),
473+ Id : new (testFlavorId ),
474+ Cpu : new (int32 (2 )),
475+ Memory : new (int32 (4 )),
476476 },
477477 {
478- Id : utils . Ptr ("other-flavor" ),
479- Cpu : utils . Ptr (int32 (1 )),
480- Memory : utils . Ptr (int32 (8 )),
478+ Id : new ("other - flavor "),
479+ Cpu : new (int32 (1 )),
480+ Memory : new (int32 (8 )),
481481 },
482482 },
483483 },
@@ -497,8 +497,8 @@ func TestBuildRequest(t *testing.T) {
497497 model : fixtureRequiredInputModel (
498498 func (model * inputModel ) {
499499 model .FlavorId = nil
500- model .CPU = utils . Ptr (int32 (2 ))
501- model .RAM = utils . Ptr (int32 (4 ))
500+ model .CPU = new (int32 (2 ))
501+ model.RAM = new (int32 (4 ))
502502 },
503503 ),
504504 mockClientSettings : mockClientSettings {
0 commit comments