@@ -236,9 +236,10 @@ func (c *Client) NewListRevisionsPager(selector SettingSelector, options *ListRe
236
236
if err != nil {
237
237
return ListRevisionsPageResponse {}, err
238
238
}
239
- var css []Setting
240
- for _ , cs := range page .Items {
241
- css = append (css , settingFromGenerated (cs ))
239
+
240
+ css := make ([]Setting , len (page .Items ))
241
+ for i := range page .Items {
242
+ css [i ] = settingFromGenerated (page .Items [i ])
242
243
}
243
244
244
245
return ListRevisionsPageResponse {
@@ -262,9 +263,9 @@ func (c *Client) NewListSettingsPager(selector SettingSelector, options *ListSet
262
263
if err != nil {
263
264
return ListSettingsPageResponse {}, err
264
265
}
265
- var css []Setting
266
- for _ , cs := range page .Items {
267
- css = append ( css , settingFromGenerated (cs ) )
266
+ css := make ( []Setting , len ( page . Items ))
267
+ for i := range page .Items {
268
+ css [ i ] = settingFromGenerated (page . Items [ i ] )
268
269
}
269
270
270
271
return ListSettingsPageResponse {
@@ -296,18 +297,16 @@ func (c *Client) NewListSnapshotsPager(options *ListSnapshotsOptions) *runtime.P
296
297
297
298
snapshots := make ([]Snapshot , len (page .Items ))
298
299
299
- for i := 0 ; i < len (page .Items ); i ++ {
300
-
300
+ for i := range page .Items {
301
301
snapshot := page .Items [i ]
302
302
303
303
convertedETag := azcore .ETag (* snapshot .Etag )
304
304
305
- convertedFilters := make ([]KeyValueFilter , len (snapshot .Filters ))
306
-
307
- for j := 0 ; j < len (snapshot .Filters ); j ++ {
308
- convertedFilters [j ] = KeyValueFilter {
309
- Key : snapshot .Filters [j ].Key ,
310
- Label : snapshot .Filters [j ].Label ,
305
+ convertedFilters := make ([]SettingFilter , len (snapshot .Filters ))
306
+ for j := range snapshot .Filters {
307
+ convertedFilters [j ] = SettingFilter {
308
+ KeyFilter : snapshot .Filters [j ].Key ,
309
+ LabelFilter : snapshot .Filters [j ].Label ,
311
310
}
312
311
}
313
312
@@ -367,8 +366,7 @@ func (c *Client) NewListSettingsForSnapshotPager(snapshotName string, options *L
367
366
}
368
367
369
368
settings := make ([]Setting , len (page .Items ))
370
-
371
- for i := 0 ; i < len (page .Items ); i ++ {
369
+ for i := range page .Items {
372
370
setting := page .Items [i ]
373
371
374
372
settings [i ] = settingFromGenerated (setting )
@@ -386,52 +384,63 @@ func (c *Client) NewListSettingsForSnapshotPager(snapshotName string, options *L
386
384
// BeginCreateSnapshot creates a snapshot of the configuration store.
387
385
//
388
386
// - snapshotName - The name of the snapshot to create.
389
- // - keyLabelFilter - The filters to apply on the key-values.
387
+ // - settingFilter - The filters to apply on the key-values.
390
388
// - options - CreateSnapshotOptions contains the optional parameters to create a Snapshot
391
- func (c * Client ) BeginCreateSnapshot (ctx context.Context , snapshotName string , keyLabelFilter []SettingFilter , options * CreateSnapshotOptions ) (* runtime.Poller [CreateSnapshotResponse ], error ) {
392
- filter := []generated.KeyValueFilter {}
393
-
389
+ func (c * Client ) BeginCreateSnapshot (ctx context.Context , snapshotName string , settingFilter []SettingFilter , options * CreateSnapshotOptions ) (* runtime.Poller [CreateSnapshotResponse ], error ) {
394
390
if options == nil {
395
391
options = & CreateSnapshotOptions {}
396
392
}
397
393
398
- for _ , f := range keyLabelFilter {
399
- filter = append (filter , generated.KeyValueFilter {
400
- Key : f .KeyFilter ,
401
- Label : f .LabelFilter ,
402
- })
394
+ filter := make ([]generated.KeyValueFilter , len (settingFilter ))
395
+ for i := range settingFilter {
396
+ filter [i ] = generated.KeyValueFilter {
397
+ Key : settingFilter [i ].KeyFilter ,
398
+ Label : settingFilter [i ].LabelFilter ,
399
+ }
403
400
}
404
401
402
+ // if no filters were specified, add an empty filter to mean "all the things"
405
403
if len (filter ) == 0 {
406
404
filter = append (filter , generated.KeyValueFilter {})
407
405
}
408
406
409
407
entity := generated.Snapshot {
410
- Filters : filter ,
411
408
CompositionType : options .CompositionType ,
409
+ Filters : filter ,
410
+ Name : & snapshotName ,
412
411
RetentionPeriod : options .RetentionPeriod ,
413
412
Tags : options .Tags ,
414
- Name : & snapshotName ,
415
413
}
416
414
417
- opts := generated.AzureAppConfigurationClientBeginCreateSnapshotOptions {
418
- ResumeToken : options .ResumeToken ,
415
+ if options .ResumeToken != "" {
416
+ return runtime .NewPollerFromResumeToken (options .ResumeToken , c .appConfigClient .Pipeline (), & runtime.NewPollerFromResumeTokenOptions [CreateSnapshotResponse ]{
417
+ Tracer : c .appConfigClient .Tracer (),
418
+ })
419
419
}
420
420
421
- pollerSS , err := generated .NewCreateSnapshotPoller [CreateSnapshotResponse ](ctx , c .appConfigClient , snapshotName , entity , & opts )
421
+ var err error
422
+ ctx , endSpan := runtime .StartSpan (ctx , "Client.BeginCreateSnapshot" , c .appConfigClient .Tracer (), nil )
423
+ defer func () { endSpan (err ) }()
422
424
425
+ resp , err := c .appConfigClient .CreateSnapshot (ctx , snapshotName , entity , nil )
423
426
if err != nil {
424
427
return nil , err
425
428
}
426
-
427
- return pollerSS , nil
429
+ poller , err := runtime .NewPoller (resp , c .appConfigClient .Pipeline (), & runtime.NewPollerOptions [CreateSnapshotResponse ]{
430
+ Tracer : c .appConfigClient .Tracer (),
431
+ })
432
+ return poller , err
428
433
}
429
434
430
435
// GetSnapshot gets a snapshot
431
436
//
432
437
// - snapshotName - The name of the snapshot to get.
433
438
// - options - GetSnapshotOptions contains the optional parameters to get a snapshot
434
439
func (c * Client ) GetSnapshot (ctx context.Context , snapshotName string , options * GetSnapshotOptions ) (GetSnapshotResponse , error ) {
440
+ var err error
441
+ ctx , endSpan := runtime .StartSpan (ctx , "Client.GetSnapshot" , c .appConfigClient .Tracer (), nil )
442
+ defer func () { endSpan (err ) }()
443
+
435
444
if options == nil {
436
445
options = & GetSnapshotOptions {}
437
446
}
@@ -446,13 +455,12 @@ func (c *Client) GetSnapshot(ctx context.Context, snapshotName string, options *
446
455
447
456
convertedETag := azcore .ETag (* getResp .Etag )
448
457
449
- var convertedFilters []KeyValueFilter
450
-
451
- for _ , filter := range getResp .Filters {
452
- convertedFilters = append (convertedFilters , KeyValueFilter {
453
- Key : filter .Key ,
454
- Label : filter .Label ,
455
- })
458
+ convertedFilters := make ([]SettingFilter , len (getResp .Filters ))
459
+ for i := range getResp .Filters {
460
+ convertedFilters [i ] = SettingFilter {
461
+ KeyFilter : getResp .Filters [i ].Key ,
462
+ LabelFilter : getResp .Filters [i ].Label ,
463
+ }
456
464
}
457
465
458
466
resp := GetSnapshotResponse {
@@ -481,6 +489,10 @@ func (c *Client) GetSnapshot(ctx context.Context, snapshotName string, options *
481
489
// - snapshotName - The name of the snapshot to archive.
482
490
// - options - ArchiveSnapshotOptions contains the optional parameters to archive a snapshot
483
491
func (c * Client ) ArchiveSnapshot (ctx context.Context , snapshotName string , options * ArchiveSnapshotOptions ) (ArchiveSnapshotResponse , error ) {
492
+ var err error
493
+ ctx , endSpan := runtime .StartSpan (ctx , "Client.ArchiveSnapshot" , c .appConfigClient .Tracer (), nil )
494
+ defer func () { endSpan (err ) }()
495
+
484
496
if options == nil {
485
497
options = & ArchiveSnapshotOptions {}
486
498
}
@@ -503,6 +515,10 @@ func (c *Client) ArchiveSnapshot(ctx context.Context, snapshotName string, optio
503
515
// - snapshotName - The name of the snapshot to recover.
504
516
// - options - RecoverSnapshotOptions contains the optional parameters to recover a snapshot
505
517
func (c * Client ) RecoverSnapshot (ctx context.Context , snapshotName string , options * RecoverSnapshotOptions ) (RecoverSnapshotResponse , error ) {
518
+ var err error
519
+ ctx , endSpan := runtime .StartSpan (ctx , "Client.RecoverSnapshot" , c .appConfigClient .Tracer (), nil )
520
+ defer func () { endSpan (err ) }()
521
+
506
522
if options == nil {
507
523
options = & RecoverSnapshotOptions {}
508
524
}
@@ -535,13 +551,12 @@ func (c *Client) updateSnapshotStatus(ctx context.Context, snapshotName string,
535
551
536
552
convertedETag := azcore .ETag (* updateResp .Etag )
537
553
538
- var convertedFilters []KeyValueFilter
539
-
540
- for _ , filter := range updateResp .Filters {
541
- convertedFilters = append (convertedFilters , KeyValueFilter {
542
- Key : filter .Key ,
543
- Label : filter .Label ,
544
- })
554
+ convertedFilters := make ([]SettingFilter , len (updateResp .Filters ))
555
+ for i := range updateResp .Filters {
556
+ convertedFilters [i ] = SettingFilter {
557
+ KeyFilter : updateResp .Filters [i ].Key ,
558
+ LabelFilter : updateResp .Filters [i ].Label ,
559
+ }
545
560
}
546
561
547
562
resp := updateSnapshotStatusResponse {
0 commit comments