@azure/app-configuration 1.4.1 → 1.5.0-alpha.20230714.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +79 -1
  2. package/dist/index.js +1120 -77
  3. package/dist/index.js.map +1 -1
  4. package/dist-esm/samples-dev/snapshot.js +130 -0
  5. package/dist-esm/samples-dev/snapshot.js.map +1 -0
  6. package/dist-esm/src/appConfigurationClient.js +139 -3
  7. package/dist-esm/src/appConfigurationClient.js.map +1 -1
  8. package/dist-esm/src/generated/src/appConfiguration.js +313 -28
  9. package/dist-esm/src/generated/src/appConfiguration.js.map +1 -1
  10. package/dist-esm/src/generated/src/lroImpl.js +21 -0
  11. package/dist-esm/src/generated/src/lroImpl.js.map +1 -0
  12. package/dist-esm/src/generated/src/models/index.js +61 -6
  13. package/dist-esm/src/generated/src/models/index.js.map +1 -1
  14. package/dist-esm/src/generated/src/models/mappers.js +406 -8
  15. package/dist-esm/src/generated/src/models/mappers.js.map +1 -1
  16. package/dist-esm/src/generated/src/models/parameters.js +140 -5
  17. package/dist-esm/src/generated/src/models/parameters.js.map +1 -1
  18. package/dist-esm/src/index.js.map +1 -1
  19. package/dist-esm/src/internal/constants.js +1 -1
  20. package/dist-esm/src/internal/constants.js.map +1 -1
  21. package/dist-esm/src/internal/helpers.js +44 -4
  22. package/dist-esm/src/internal/helpers.js.map +1 -1
  23. package/dist-esm/src/models.js +26 -1
  24. package/dist-esm/src/models.js.map +1 -1
  25. package/dist-esm/test/internal/helpers.spec.js +16 -4
  26. package/dist-esm/test/internal/helpers.spec.js.map +1 -1
  27. package/dist-esm/test/internal/node/http.spec.js.map +1 -1
  28. package/dist-esm/test/public/auth.spec.js +1 -1
  29. package/dist-esm/test/public/auth.spec.js.map +1 -1
  30. package/dist-esm/test/public/index.readonlytests.spec.js +2 -1
  31. package/dist-esm/test/public/index.readonlytests.spec.js.map +1 -1
  32. package/dist-esm/test/public/index.spec.js +13 -18
  33. package/dist-esm/test/public/index.spec.js.map +1 -1
  34. package/dist-esm/test/public/snapshot.spec.js +256 -0
  35. package/dist-esm/test/public/snapshot.spec.js.map +1 -0
  36. package/dist-esm/test/public/utils/testHelpers.js +68 -1
  37. package/dist-esm/test/public/utils/testHelpers.js.map +1 -1
  38. package/package.json +6 -5
  39. package/types/app-configuration.d.ts +369 -12
package/dist/index.js CHANGED
@@ -9,6 +9,8 @@ var coreAuth = require('@azure/core-auth');
9
9
  var coreUtil = require('@azure/core-util');
10
10
  var coreClient = require('@azure/core-client');
11
11
  var coreHttpCompat = require('@azure/core-http-compat');
12
+ var coreLro = require('@azure/core-lro');
13
+ var tslib = require('tslib');
12
14
  var coreTracing = require('@azure/core-tracing');
13
15
 
14
16
  function _interopNamespace(e) {
@@ -32,6 +34,35 @@ function _interopNamespace(e) {
32
34
  var coreClient__namespace = /*#__PURE__*/_interopNamespace(coreClient);
33
35
  var coreHttpCompat__namespace = /*#__PURE__*/_interopNamespace(coreHttpCompat);
34
36
 
37
+ // Copyright (c) Microsoft Corporation.
38
+ // Licensed under the MIT license.
39
+ /**
40
+ * Supported and common values of AppConfigurationApiVersion.
41
+ */
42
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
43
+ const AppConfigurationApiVersion = {
44
+ /**
45
+ * The newest version of the service known to be supported by the client (default).
46
+ *
47
+ * If using a beta package version, this will be identical to the latest preview version. Otherwise, it will be
48
+ * identical to the latest stable version.
49
+ */
50
+ Latest: "2022-11-01-preview",
51
+ /**
52
+ * The newest stable version of the service known to be supported by the package. This will be a Generally Available
53
+ * (GA) version, even if the package version is a beta.
54
+ */
55
+ Stable: "1.0",
56
+ /**
57
+ * App Configuration API version "1.0" (GA).
58
+ */
59
+ "1.0": "1.0",
60
+ /**
61
+ * App Configuration API version 2022-11-01-preview.
62
+ */
63
+ "2022-11-01-preview": "2022-11-01-preview",
64
+ };
65
+
35
66
  // Copyright (c) Microsoft Corporation.
36
67
  /**
37
68
  * The `@azure/logger` configuration for this package.
@@ -299,7 +330,7 @@ function quoteETag(etag) {
299
330
  * @param options - An options object with onlyIfChanged/onlyIfUnchanged fields
300
331
  * @internal
301
332
  */
302
- function checkAndFormatIfAndIfNoneMatch(configurationSetting, options) {
333
+ function checkAndFormatIfAndIfNoneMatch(objectWithEtag, options) {
303
334
  if (options.onlyIfChanged && options.onlyIfUnchanged) {
304
335
  logger.error("onlyIfChanged and onlyIfUnchanged are both specified", options.onlyIfChanged, options.onlyIfUnchanged);
305
336
  throw new Error("onlyIfChanged and onlyIfUnchanged are mutually-exclusive");
@@ -307,10 +338,10 @@ function checkAndFormatIfAndIfNoneMatch(configurationSetting, options) {
307
338
  let ifMatch;
308
339
  let ifNoneMatch;
309
340
  if (options.onlyIfUnchanged) {
310
- ifMatch = quoteETag(configurationSetting.etag);
341
+ ifMatch = quoteETag(objectWithEtag.etag);
311
342
  }
312
343
  if (options.onlyIfChanged) {
313
- ifNoneMatch = quoteETag(configurationSetting.etag);
344
+ ifNoneMatch = quoteETag(objectWithEtag.etag);
314
345
  }
315
346
  return {
316
347
  ifMatch: ifMatch,
@@ -318,7 +349,7 @@ function checkAndFormatIfAndIfNoneMatch(configurationSetting, options) {
318
349
  };
319
350
  }
320
351
  /**
321
- * Transforms some of the key fields in ListConfigurationSettingsOptions and ListRevisionsOptions
352
+ * Transforms some of the key fields in SendConfigurationSettingsOptions and ListRevisionsOptions
322
353
  * so they can be added to a request using AppConfigurationGetKeyValuesOptionalParams.
323
354
  * - `options.acceptDateTime` is converted into an ISO string
324
355
  * - `select` is populated with the proper field names from `options.fields`
@@ -334,10 +365,26 @@ function formatFiltersAndSelect(listConfigOptions) {
334
365
  return {
335
366
  key: listConfigOptions.keyFilter,
336
367
  label: listConfigOptions.labelFilter,
368
+ snapshot: listConfigOptions.snapshotName,
337
369
  acceptDatetime,
338
370
  select: formatFieldsForSelect(listConfigOptions.fields),
339
371
  };
340
372
  }
373
+ /**
374
+ * Transforms some of the key fields in ListSnapshotsOptions
375
+ * so they can be added to a request using AppConfigurationGetSnapshotsOptionalParams.
376
+ * - `select` is populated with the proper field names from `options.fields`
377
+ * - keyFilter and labelFilter are moved to key and label, respectively.
378
+ *
379
+ * @internal
380
+ */
381
+ function formatSnapshotFiltersAndSelect(listSnapshotOptions) {
382
+ return {
383
+ name: listSnapshotOptions.nameFilter,
384
+ status: listSnapshotOptions.statusFilter,
385
+ select: listSnapshotOptions.fields,
386
+ };
387
+ }
341
388
  /**
342
389
  * Handles translating a Date acceptDateTime into a string as needed by the API
343
390
  * @param newOptions - A newer style options with acceptDateTime as a date (and with proper casing!)
@@ -461,6 +508,18 @@ function transformKeyValueResponse(kvp) {
461
508
  delete setting.eTag;
462
509
  return setting;
463
510
  }
511
+ /**
512
+ * @internal
513
+ */
514
+ function transformSnapshotResponse(snapshot) {
515
+ if (hasUnderscoreResponse(snapshot)) {
516
+ Object.defineProperty(snapshot, "_response", {
517
+ enumerable: false,
518
+ value: snapshot._response,
519
+ });
520
+ }
521
+ return snapshot;
522
+ }
464
523
  /**
465
524
  * Translates user-facing field names into their `select` equivalents (these can be
466
525
  * seen in the `KnownEnum5`)
@@ -502,6 +561,26 @@ function hasUnderscoreResponse(result) {
502
561
  return Object.prototype.hasOwnProperty.call(result, "_response");
503
562
  }
504
563
 
564
+ /*
565
+ * Copyright (c) Microsoft Corporation.
566
+ * Licensed under the MIT License.
567
+ *
568
+ * Code generated by Microsoft (R) AutoRest Code Generator.
569
+ * Changes may cause incorrect behavior and will be lost if the code is regenerated.
570
+ */
571
+ function createLroSpec(inputs) {
572
+ const { args, spec, sendOperationFn } = inputs;
573
+ return {
574
+ requestMethod: spec.httpMethod,
575
+ requestPath: spec.path,
576
+ sendInitialRequest: () => sendOperationFn(args, spec),
577
+ sendPollRequest: (path, options) => {
578
+ const restSpec = tslib.__rest(spec, ["requestBody"]);
579
+ return sendOperationFn(args, Object.assign(Object.assign({}, restSpec), { httpMethod: "GET", path, abortSignal: options === null || options === void 0 ? void 0 : options.abortSignal }));
580
+ }
581
+ };
582
+ }
583
+
505
584
  /*
506
585
  * Copyright (c) Microsoft Corporation.
507
586
  * Licensed under the MIT License.
@@ -672,6 +751,166 @@ const KeyValue = {
672
751
  }
673
752
  }
674
753
  };
754
+ const SnapshotListResult = {
755
+ type: {
756
+ name: "Composite",
757
+ className: "SnapshotListResult",
758
+ modelProperties: {
759
+ items: {
760
+ serializedName: "items",
761
+ type: {
762
+ name: "Sequence",
763
+ element: {
764
+ type: {
765
+ name: "Composite",
766
+ className: "Snapshot"
767
+ }
768
+ }
769
+ }
770
+ },
771
+ nextLink: {
772
+ serializedName: "@nextLink",
773
+ type: {
774
+ name: "String"
775
+ }
776
+ }
777
+ }
778
+ }
779
+ };
780
+ const Snapshot = {
781
+ type: {
782
+ name: "Composite",
783
+ className: "Snapshot",
784
+ modelProperties: {
785
+ name: {
786
+ serializedName: "name",
787
+ required: true,
788
+ readOnly: true,
789
+ type: {
790
+ name: "String"
791
+ }
792
+ },
793
+ status: {
794
+ serializedName: "status",
795
+ readOnly: true,
796
+ type: {
797
+ name: "String"
798
+ }
799
+ },
800
+ filters: {
801
+ constraints: {
802
+ MinItems: 1,
803
+ MaxItems: 3
804
+ },
805
+ serializedName: "filters",
806
+ required: true,
807
+ type: {
808
+ name: "Sequence",
809
+ element: {
810
+ type: {
811
+ name: "Composite",
812
+ className: "ConfigurationSettingsFilter"
813
+ }
814
+ }
815
+ }
816
+ },
817
+ compositionType: {
818
+ serializedName: "composition_type",
819
+ type: {
820
+ name: "String"
821
+ }
822
+ },
823
+ createdOn: {
824
+ serializedName: "created",
825
+ readOnly: true,
826
+ type: {
827
+ name: "DateTime"
828
+ }
829
+ },
830
+ expiresOn: {
831
+ serializedName: "expires",
832
+ readOnly: true,
833
+ nullable: true,
834
+ type: {
835
+ name: "DateTime"
836
+ }
837
+ },
838
+ retentionPeriod: {
839
+ constraints: {
840
+ InclusiveMaximum: 7776000,
841
+ InclusiveMinimum: 3600
842
+ },
843
+ serializedName: "retention_period",
844
+ type: {
845
+ name: "Number"
846
+ }
847
+ },
848
+ size: {
849
+ serializedName: "size",
850
+ readOnly: true,
851
+ type: {
852
+ name: "Number"
853
+ }
854
+ },
855
+ itemCount: {
856
+ serializedName: "items_count",
857
+ readOnly: true,
858
+ type: {
859
+ name: "Number"
860
+ }
861
+ },
862
+ tags: {
863
+ serializedName: "tags",
864
+ type: {
865
+ name: "Dictionary",
866
+ value: { type: { name: "String" } }
867
+ }
868
+ },
869
+ etag: {
870
+ serializedName: "etag",
871
+ readOnly: true,
872
+ type: {
873
+ name: "String"
874
+ }
875
+ }
876
+ }
877
+ }
878
+ };
879
+ const ConfigurationSettingsFilter = {
880
+ type: {
881
+ name: "Composite",
882
+ className: "ConfigurationSettingsFilter",
883
+ modelProperties: {
884
+ key: {
885
+ serializedName: "key",
886
+ required: true,
887
+ type: {
888
+ name: "String"
889
+ }
890
+ },
891
+ label: {
892
+ serializedName: "label",
893
+ type: {
894
+ name: "String"
895
+ }
896
+ }
897
+ }
898
+ }
899
+ };
900
+ const SnapshotUpdateParameters = {
901
+ type: {
902
+ name: "Composite",
903
+ className: "SnapshotUpdateParameters",
904
+ modelProperties: {
905
+ status: {
906
+ serializedName: "status",
907
+ type: {
908
+ name: "String"
909
+ }
910
+ }
911
+ }
912
+ }
913
+ };
675
914
  const LabelListResult = {
676
915
  type: {
677
916
  name: "Composite",
@@ -713,6 +952,104 @@ const Label = {
713
952
  }
714
953
  }
715
954
  };
955
+ const OperationDetails = {
956
+ type: {
957
+ name: "Composite",
958
+ className: "OperationDetails",
959
+ modelProperties: {
960
+ id: {
961
+ serializedName: "id",
962
+ required: true,
963
+ type: {
964
+ name: "String"
965
+ }
966
+ },
967
+ status: {
968
+ serializedName: "status",
969
+ required: true,
970
+ type: {
971
+ name: "Enum",
972
+ allowedValues: [
973
+ "NotStarted",
974
+ "Running",
975
+ "Succeeded",
976
+ "Failed",
977
+ "Canceled"
978
+ ]
979
+ }
980
+ },
981
+ error: {
982
+ serializedName: "error",
983
+ type: {
984
+ name: "Composite",
985
+ className: "ErrorDetail"
986
+ }
987
+ }
988
+ }
989
+ }
990
+ };
991
+ const ErrorDetail = {
992
+ type: {
993
+ name: "Composite",
994
+ className: "ErrorDetail",
995
+ modelProperties: {
996
+ code: {
997
+ serializedName: "code",
998
+ required: true,
999
+ type: {
1000
+ name: "String"
1001
+ }
1002
+ },
1003
+ message: {
1004
+ serializedName: "message",
1005
+ required: true,
1006
+ type: {
1007
+ name: "String"
1008
+ }
1009
+ },
1010
+ details: {
1011
+ serializedName: "details",
1012
+ type: {
1013
+ name: "Sequence",
1014
+ element: {
1015
+ type: {
1016
+ name: "Composite",
1017
+ className: "ErrorDetail"
1018
+ }
1019
+ }
1020
+ }
1021
+ },
1022
+ innererror: {
1023
+ serializedName: "innererror",
1024
+ type: {
1025
+ name: "Composite",
1026
+ className: "InnerError"
1027
+ }
1028
+ }
1029
+ }
1030
+ }
1031
+ };
1032
+ const InnerError = {
1033
+ type: {
1034
+ name: "Composite",
1035
+ className: "InnerError",
1036
+ modelProperties: {
1037
+ code: {
1038
+ serializedName: "code",
1039
+ type: {
1040
+ name: "String"
1041
+ }
1042
+ },
1043
+ innererror: {
1044
+ serializedName: "innererror",
1045
+ type: {
1046
+ name: "Composite",
1047
+ className: "InnerError"
1048
+ }
1049
+ }
1050
+ }
1051
+ }
1052
+ };
716
1053
  const AppConfigurationGetKeysHeaders = {
717
1054
  type: {
718
1055
  name: "Composite",
@@ -785,12 +1122,6 @@ const AppConfigurationGetKeyValueHeaders = {
785
1122
  type: {
786
1123
  name: "String"
787
1124
  }
788
- },
789
- lastModified: {
790
- serializedName: "last-modified",
791
- type: {
792
- name: "String"
793
- }
794
1125
  }
795
1126
  }
796
1127
  }
@@ -851,20 +1182,14 @@ const AppConfigurationCheckKeyValueHeaders = {
851
1182
  type: {
852
1183
  name: "String"
853
1184
  }
854
- },
855
- lastModified: {
856
- serializedName: "last-modified",
857
- type: {
858
- name: "String"
859
- }
860
1185
  }
861
1186
  }
862
1187
  }
863
1188
  };
864
- const AppConfigurationGetLabelsHeaders = {
1189
+ const AppConfigurationGetSnapshotsHeaders = {
865
1190
  type: {
866
1191
  name: "Composite",
867
- className: "AppConfigurationGetLabelsHeaders",
1192
+ className: "AppConfigurationGetSnapshotsHeaders",
868
1193
  modelProperties: {
869
1194
  syncToken: {
870
1195
  serializedName: "sync-token",
@@ -875,10 +1200,10 @@ const AppConfigurationGetLabelsHeaders = {
875
1200
  }
876
1201
  }
877
1202
  };
878
- const AppConfigurationCheckLabelsHeaders = {
1203
+ const AppConfigurationCheckSnapshotsHeaders = {
879
1204
  type: {
880
1205
  name: "Composite",
881
- className: "AppConfigurationCheckLabelsHeaders",
1206
+ className: "AppConfigurationCheckSnapshotsHeaders",
882
1207
  modelProperties: {
883
1208
  syncToken: {
884
1209
  serializedName: "sync-token",
@@ -889,10 +1214,10 @@ const AppConfigurationCheckLabelsHeaders = {
889
1214
  }
890
1215
  }
891
1216
  };
892
- const AppConfigurationPutLockHeaders = {
1217
+ const AppConfigurationGetSnapshotHeaders = {
893
1218
  type: {
894
1219
  name: "Composite",
895
- className: "AppConfigurationPutLockHeaders",
1220
+ className: "AppConfigurationGetSnapshotHeaders",
896
1221
  modelProperties: {
897
1222
  syncToken: {
898
1223
  serializedName: "sync-token",
@@ -905,14 +1230,20 @@ const AppConfigurationPutLockHeaders = {
905
1230
  type: {
906
1231
  name: "String"
907
1232
  }
1233
+ },
1234
+ link: {
1235
+ serializedName: "link",
1236
+ type: {
1237
+ name: "String"
1238
+ }
908
1239
  }
909
1240
  }
910
1241
  }
911
1242
  };
912
- const AppConfigurationDeleteLockHeaders = {
1243
+ const AppConfigurationCreateSnapshotHeaders = {
913
1244
  type: {
914
1245
  name: "Composite",
915
- className: "AppConfigurationDeleteLockHeaders",
1246
+ className: "AppConfigurationCreateSnapshotHeaders",
916
1247
  modelProperties: {
917
1248
  syncToken: {
918
1249
  serializedName: "sync-token",
@@ -925,9 +1256,141 @@ const AppConfigurationDeleteLockHeaders = {
925
1256
  type: {
926
1257
  name: "String"
927
1258
  }
928
- }
929
- }
930
- }
1259
+ },
1260
+ link: {
1261
+ serializedName: "link",
1262
+ type: {
1263
+ name: "String"
1264
+ }
1265
+ },
1266
+ operationLocation: {
1267
+ serializedName: "operation-location",
1268
+ type: {
1269
+ name: "String"
1270
+ }
1271
+ }
1272
+ }
1273
+ }
1274
+ };
1275
+ const AppConfigurationUpdateSnapshotHeaders = {
1276
+ type: {
1277
+ name: "Composite",
1278
+ className: "AppConfigurationUpdateSnapshotHeaders",
1279
+ modelProperties: {
1280
+ syncToken: {
1281
+ serializedName: "sync-token",
1282
+ type: {
1283
+ name: "String"
1284
+ }
1285
+ },
1286
+ eTag: {
1287
+ serializedName: "etag",
1288
+ type: {
1289
+ name: "String"
1290
+ }
1291
+ },
1292
+ link: {
1293
+ serializedName: "link",
1294
+ type: {
1295
+ name: "String"
1296
+ }
1297
+ }
1298
+ }
1299
+ }
1300
+ };
1301
+ const AppConfigurationCheckSnapshotHeaders = {
1302
+ type: {
1303
+ name: "Composite",
1304
+ className: "AppConfigurationCheckSnapshotHeaders",
1305
+ modelProperties: {
1306
+ syncToken: {
1307
+ serializedName: "sync-token",
1308
+ type: {
1309
+ name: "String"
1310
+ }
1311
+ },
1312
+ eTag: {
1313
+ serializedName: "etag",
1314
+ type: {
1315
+ name: "String"
1316
+ }
1317
+ },
1318
+ link: {
1319
+ serializedName: "link",
1320
+ type: {
1321
+ name: "String"
1322
+ }
1323
+ }
1324
+ }
1325
+ }
1326
+ };
1327
+ const AppConfigurationGetLabelsHeaders = {
1328
+ type: {
1329
+ name: "Composite",
1330
+ className: "AppConfigurationGetLabelsHeaders",
1331
+ modelProperties: {
1332
+ syncToken: {
1333
+ serializedName: "sync-token",
1334
+ type: {
1335
+ name: "String"
1336
+ }
1337
+ }
1338
+ }
1339
+ }
1340
+ };
1341
+ const AppConfigurationCheckLabelsHeaders = {
1342
+ type: {
1343
+ name: "Composite",
1344
+ className: "AppConfigurationCheckLabelsHeaders",
1345
+ modelProperties: {
1346
+ syncToken: {
1347
+ serializedName: "sync-token",
1348
+ type: {
1349
+ name: "String"
1350
+ }
1351
+ }
1352
+ }
1353
+ }
1354
+ };
1355
+ const AppConfigurationPutLockHeaders = {
1356
+ type: {
1357
+ name: "Composite",
1358
+ className: "AppConfigurationPutLockHeaders",
1359
+ modelProperties: {
1360
+ syncToken: {
1361
+ serializedName: "sync-token",
1362
+ type: {
1363
+ name: "String"
1364
+ }
1365
+ },
1366
+ eTag: {
1367
+ serializedName: "etag",
1368
+ type: {
1369
+ name: "String"
1370
+ }
1371
+ }
1372
+ }
1373
+ }
1374
+ };
1375
+ const AppConfigurationDeleteLockHeaders = {
1376
+ type: {
1377
+ name: "Composite",
1378
+ className: "AppConfigurationDeleteLockHeaders",
1379
+ modelProperties: {
1380
+ syncToken: {
1381
+ serializedName: "sync-token",
1382
+ type: {
1383
+ name: "String"
1384
+ }
1385
+ },
1386
+ eTag: {
1387
+ serializedName: "etag",
1388
+ type: {
1389
+ name: "String"
1390
+ }
1391
+ }
1392
+ }
1393
+ }
931
1394
  };
932
1395
  const AppConfigurationGetRevisionsHeaders = {
933
1396
  type: {
@@ -985,6 +1448,20 @@ const AppConfigurationGetKeyValuesNextHeaders = {
985
1448
  }
986
1449
  }
987
1450
  };
1451
+ const AppConfigurationGetSnapshotsNextHeaders = {
1452
+ type: {
1453
+ name: "Composite",
1454
+ className: "AppConfigurationGetSnapshotsNextHeaders",
1455
+ modelProperties: {
1456
+ syncToken: {
1457
+ serializedName: "sync-token",
1458
+ type: {
1459
+ name: "String"
1460
+ }
1461
+ }
1462
+ }
1463
+ }
1464
+ };
988
1465
  const AppConfigurationGetLabelsNextHeaders = {
989
1466
  type: {
990
1467
  name: "Composite",
@@ -1021,8 +1498,15 @@ var Mappers = /*#__PURE__*/Object.freeze({
1021
1498
  ErrorModel: ErrorModel,
1022
1499
  KeyValueListResult: KeyValueListResult,
1023
1500
  KeyValue: KeyValue,
1501
+ SnapshotListResult: SnapshotListResult,
1502
+ Snapshot: Snapshot,
1503
+ ConfigurationSettingsFilter: ConfigurationSettingsFilter,
1504
+ SnapshotUpdateParameters: SnapshotUpdateParameters,
1024
1505
  LabelListResult: LabelListResult,
1025
1506
  Label: Label,
1507
+ OperationDetails: OperationDetails,
1508
+ ErrorDetail: ErrorDetail,
1509
+ InnerError: InnerError,
1026
1510
  AppConfigurationGetKeysHeaders: AppConfigurationGetKeysHeaders,
1027
1511
  AppConfigurationCheckKeysHeaders: AppConfigurationCheckKeysHeaders,
1028
1512
  AppConfigurationGetKeyValuesHeaders: AppConfigurationGetKeyValuesHeaders,
@@ -1031,6 +1515,12 @@ var Mappers = /*#__PURE__*/Object.freeze({
1031
1515
  AppConfigurationPutKeyValueHeaders: AppConfigurationPutKeyValueHeaders,
1032
1516
  AppConfigurationDeleteKeyValueHeaders: AppConfigurationDeleteKeyValueHeaders,
1033
1517
  AppConfigurationCheckKeyValueHeaders: AppConfigurationCheckKeyValueHeaders,
1518
+ AppConfigurationGetSnapshotsHeaders: AppConfigurationGetSnapshotsHeaders,
1519
+ AppConfigurationCheckSnapshotsHeaders: AppConfigurationCheckSnapshotsHeaders,
1520
+ AppConfigurationGetSnapshotHeaders: AppConfigurationGetSnapshotHeaders,
1521
+ AppConfigurationCreateSnapshotHeaders: AppConfigurationCreateSnapshotHeaders,
1522
+ AppConfigurationUpdateSnapshotHeaders: AppConfigurationUpdateSnapshotHeaders,
1523
+ AppConfigurationCheckSnapshotHeaders: AppConfigurationCheckSnapshotHeaders,
1034
1524
  AppConfigurationGetLabelsHeaders: AppConfigurationGetLabelsHeaders,
1035
1525
  AppConfigurationCheckLabelsHeaders: AppConfigurationCheckLabelsHeaders,
1036
1526
  AppConfigurationPutLockHeaders: AppConfigurationPutLockHeaders,
@@ -1039,6 +1529,7 @@ var Mappers = /*#__PURE__*/Object.freeze({
1039
1529
  AppConfigurationCheckRevisionsHeaders: AppConfigurationCheckRevisionsHeaders,
1040
1530
  AppConfigurationGetKeysNextHeaders: AppConfigurationGetKeysNextHeaders,
1041
1531
  AppConfigurationGetKeyValuesNextHeaders: AppConfigurationGetKeyValuesNextHeaders,
1532
+ AppConfigurationGetSnapshotsNextHeaders: AppConfigurationGetSnapshotsNextHeaders,
1042
1533
  AppConfigurationGetLabelsNextHeaders: AppConfigurationGetLabelsNextHeaders,
1043
1534
  AppConfigurationGetRevisionsNextHeaders: AppConfigurationGetRevisionsNextHeaders
1044
1535
  });
@@ -1053,7 +1544,7 @@ var Mappers = /*#__PURE__*/Object.freeze({
1053
1544
  const accept = {
1054
1545
  parameterPath: "accept",
1055
1546
  mapper: {
1056
- defaultValue: "application/vnd.microsoft.appconfig.keyset+json, application/json, application/problem+json",
1547
+ defaultValue: "application/vnd.microsoft.appconfig.keyset+json, application/problem+json",
1057
1548
  isConstant: true,
1058
1549
  serializedName: "Accept",
1059
1550
  type: {
@@ -1090,7 +1581,7 @@ const syncToken = {
1090
1581
  }
1091
1582
  }
1092
1583
  };
1093
- const apiVersion$1 = {
1584
+ const apiVersion = {
1094
1585
  parameterPath: "apiVersion",
1095
1586
  mapper: {
1096
1587
  serializedName: "api-version",
@@ -1121,7 +1612,7 @@ const acceptDatetime = {
1121
1612
  const accept1 = {
1122
1613
  parameterPath: "accept",
1123
1614
  mapper: {
1124
- defaultValue: "application/vnd.microsoft.appconfig.kvset+json, application/json, application/problem+json",
1615
+ defaultValue: "application/vnd.microsoft.appconfig.kvset+json, application/problem+json",
1125
1616
  isConstant: true,
1126
1617
  serializedName: "Accept",
1127
1618
  type: {
@@ -1162,10 +1653,19 @@ const select = {
1162
1653
  },
1163
1654
  collectionFormat: "CSV"
1164
1655
  };
1656
+ const snapshot = {
1657
+ parameterPath: ["options", "snapshot"],
1658
+ mapper: {
1659
+ serializedName: "snapshot",
1660
+ type: {
1661
+ name: "String"
1662
+ }
1663
+ }
1664
+ };
1165
1665
  const accept2 = {
1166
1666
  parameterPath: "accept",
1167
1667
  mapper: {
1168
- defaultValue: "application/vnd.microsoft.appconfig.kv+json, application/json, application/problem+json",
1668
+ defaultValue: "application/vnd.microsoft.appconfig.kv+json, application/problem+json",
1169
1669
  isConstant: true,
1170
1670
  serializedName: "Accept",
1171
1671
  type: {
@@ -1219,7 +1719,7 @@ const entity = {
1219
1719
  const accept3 = {
1220
1720
  parameterPath: "accept",
1221
1721
  mapper: {
1222
- defaultValue: "application/vnd.microsoft.appconfig.labelset+json, application/json, application/problem+json",
1722
+ defaultValue: "application/vnd.microsoft.appconfig.snapshotset+json, application/problem+json",
1223
1723
  isConstant: true,
1224
1724
  serializedName: "Accept",
1225
1725
  type: {
@@ -1242,6 +1742,132 @@ const select1 = {
1242
1742
  },
1243
1743
  collectionFormat: "CSV"
1244
1744
  };
1745
+ const status = {
1746
+ parameterPath: ["options", "status"],
1747
+ mapper: {
1748
+ serializedName: "Status",
1749
+ type: {
1750
+ name: "Sequence",
1751
+ element: {
1752
+ type: {
1753
+ name: "String"
1754
+ }
1755
+ }
1756
+ }
1757
+ },
1758
+ collectionFormat: "CSV"
1759
+ };
1760
+ const accept4 = {
1761
+ parameterPath: "accept",
1762
+ mapper: {
1763
+ defaultValue: "application/vnd.microsoft.appconfig.snapshot+json, application/problem+json",
1764
+ isConstant: true,
1765
+ serializedName: "Accept",
1766
+ type: {
1767
+ name: "String"
1768
+ }
1769
+ }
1770
+ };
1771
+ const name1 = {
1772
+ parameterPath: "name",
1773
+ mapper: {
1774
+ serializedName: "name",
1775
+ required: true,
1776
+ type: {
1777
+ name: "String"
1778
+ }
1779
+ }
1780
+ };
1781
+ const contentType1 = {
1782
+ parameterPath: ["options", "contentType"],
1783
+ mapper: {
1784
+ defaultValue: "application/vnd.microsoft.appconfig.snapshot+json",
1785
+ isConstant: true,
1786
+ serializedName: "Content-Type",
1787
+ type: {
1788
+ name: "String"
1789
+ }
1790
+ }
1791
+ };
1792
+ const entity1 = {
1793
+ parameterPath: "entity",
1794
+ mapper: Snapshot
1795
+ };
1796
+ const name2 = {
1797
+ parameterPath: "name",
1798
+ mapper: {
1799
+ constraints: {
1800
+ MaxLength: 256
1801
+ },
1802
+ serializedName: "name",
1803
+ required: true,
1804
+ type: {
1805
+ name: "String"
1806
+ }
1807
+ }
1808
+ };
1809
+ const contentType2 = {
1810
+ parameterPath: ["options", "contentType"],
1811
+ mapper: {
1812
+ defaultValue: "application/json",
1813
+ isConstant: true,
1814
+ serializedName: "Content-Type",
1815
+ type: {
1816
+ name: "String"
1817
+ }
1818
+ }
1819
+ };
1820
+ const entity2 = {
1821
+ parameterPath: "entity",
1822
+ mapper: SnapshotUpdateParameters
1823
+ };
1824
+ const accept5 = {
1825
+ parameterPath: "accept",
1826
+ mapper: {
1827
+ defaultValue: "application/vnd.microsoft.appconfig.labelset+json, application/problem+json",
1828
+ isConstant: true,
1829
+ serializedName: "Accept",
1830
+ type: {
1831
+ name: "String"
1832
+ }
1833
+ }
1834
+ };
1835
+ const select2 = {
1836
+ parameterPath: ["options", "select"],
1837
+ mapper: {
1838
+ serializedName: "$Select",
1839
+ type: {
1840
+ name: "Sequence",
1841
+ element: {
1842
+ type: {
1843
+ name: "String"
1844
+ }
1845
+ }
1846
+ }
1847
+ },
1848
+ collectionFormat: "CSV"
1849
+ };
1850
+ const accept6 = {
1851
+ parameterPath: "accept",
1852
+ mapper: {
1853
+ defaultValue: "application/json",
1854
+ isConstant: true,
1855
+ serializedName: "Accept",
1856
+ type: {
1857
+ name: "String"
1858
+ }
1859
+ }
1860
+ };
1861
+ const snapshot1 = {
1862
+ parameterPath: "snapshot",
1863
+ mapper: {
1864
+ serializedName: "snapshot",
1865
+ required: true,
1866
+ type: {
1867
+ name: "String"
1868
+ }
1869
+ }
1870
+ };
1245
1871
  const nextLink = {
1246
1872
  parameterPath: "nextLink",
1247
1873
  mapper: {
@@ -1270,6 +1896,7 @@ class AppConfiguration extends coreHttpCompat__namespace.ExtendedServiceClient {
1270
1896
  * @param options The parameter options
1271
1897
  */
1272
1898
  constructor(endpoint, apiVersion, options) {
1899
+ var _a, _b;
1273
1900
  if (endpoint === undefined) {
1274
1901
  throw new Error("'endpoint' cannot be null");
1275
1902
  }
@@ -1289,11 +1916,37 @@ class AppConfiguration extends coreHttpCompat__namespace.ExtendedServiceClient {
1289
1916
  : `${packageDetails}`;
1290
1917
  const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
1291
1918
  userAgentPrefix
1292
- }, baseUri: options.endpoint || "{endpoint}" });
1919
+ }, endpoint: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "{endpoint}" });
1293
1920
  super(optionsWithDefaults);
1294
1921
  // Parameter assignments
1295
1922
  this.endpoint = endpoint;
1296
1923
  this.apiVersion = apiVersion;
1924
+ this.addCustomApiVersionPolicy(apiVersion);
1925
+ }
1926
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
1927
+ addCustomApiVersionPolicy(apiVersion) {
1928
+ if (!apiVersion) {
1929
+ return;
1930
+ }
1931
+ const apiVersionPolicy = {
1932
+ name: "CustomApiVersionPolicy",
1933
+ async sendRequest(request, next) {
1934
+ const param = request.url.split("?");
1935
+ if (param.length > 1) {
1936
+ const newParams = param[1].split("&").map((item) => {
1937
+ if (item.indexOf("api-version") > -1) {
1938
+ return "api-version=" + apiVersion;
1939
+ }
1940
+ else {
1941
+ return item;
1942
+ }
1943
+ });
1944
+ request.url = param[0] + "?" + newParams.join("&");
1945
+ }
1946
+ return next(request);
1947
+ }
1948
+ };
1949
+ this.pipeline.addPolicy(apiVersionPolicy);
1297
1950
  }
1298
1951
  /**
1299
1952
  * Gets a list of keys.
@@ -1355,6 +2008,96 @@ class AppConfiguration extends coreHttpCompat__namespace.ExtendedServiceClient {
1355
2008
  checkKeyValue(key, options) {
1356
2009
  return this.sendOperationRequest({ key, options }, checkKeyValueOperationSpec);
1357
2010
  }
2011
+ /**
2012
+ * Gets a list of key-value snapshots.
2013
+ * @param options The options parameters.
2014
+ */
2015
+ getSnapshots(options) {
2016
+ return this.sendOperationRequest({ options }, getSnapshotsOperationSpec);
2017
+ }
2018
+ /**
2019
+ * Requests the headers and status of the given resource.
2020
+ * @param options The options parameters.
2021
+ */
2022
+ checkSnapshots(options) {
2023
+ return this.sendOperationRequest({ options }, checkSnapshotsOperationSpec);
2024
+ }
2025
+ /**
2026
+ * Gets a single key-value snapshot.
2027
+ * @param name The name of the key-value snapshot to retrieve.
2028
+ * @param options The options parameters.
2029
+ */
2030
+ getSnapshot(name, options) {
2031
+ return this.sendOperationRequest({ name, options }, getSnapshotOperationSpec);
2032
+ }
2033
+ /**
2034
+ * Creates a key-value snapshot.
2035
+ * @param name The name of the key-value snapshot to create.
2036
+ * @param entity The key-value snapshot to create.
2037
+ * @param options The options parameters.
2038
+ */
2039
+ async beginCreateSnapshot(name, entity, options) {
2040
+ const directSendOperation = async (args, spec) => {
2041
+ return this.sendOperationRequest(args, spec);
2042
+ };
2043
+ const sendOperationFn = async (args, spec) => {
2044
+ var _a;
2045
+ let currentRawResponse = undefined;
2046
+ const providedCallback = (_a = args.options) === null || _a === void 0 ? void 0 : _a.onResponse;
2047
+ const callback = (rawResponse, flatResponse) => {
2048
+ currentRawResponse = rawResponse;
2049
+ providedCallback === null || providedCallback === void 0 ? void 0 : providedCallback(rawResponse, flatResponse);
2050
+ };
2051
+ const updatedArgs = Object.assign(Object.assign({}, args), { options: Object.assign(Object.assign({}, args.options), { onResponse: callback }) });
2052
+ const flatResponse = await directSendOperation(updatedArgs, spec);
2053
+ return {
2054
+ flatResponse,
2055
+ rawResponse: {
2056
+ statusCode: currentRawResponse.status,
2057
+ body: currentRawResponse.parsedBody,
2058
+ headers: currentRawResponse.headers.toJSON()
2059
+ }
2060
+ };
2061
+ };
2062
+ const lro = createLroSpec({
2063
+ sendOperationFn,
2064
+ args: { name, entity, options },
2065
+ spec: createSnapshotOperationSpec
2066
+ });
2067
+ const poller = await coreLro.createHttpPoller(lro, {
2068
+ restoreFrom: options === null || options === void 0 ? void 0 : options.resumeFrom,
2069
+ intervalInMs: options === null || options === void 0 ? void 0 : options.updateIntervalInMs
2070
+ });
2071
+ await poller.poll();
2072
+ return poller;
2073
+ }
2074
+ /**
2075
+ * Creates a key-value snapshot.
2076
+ * @param name The name of the key-value snapshot to create.
2077
+ * @param entity The key-value snapshot to create.
2078
+ * @param options The options parameters.
2079
+ */
2080
+ async beginCreateSnapshotAndWait(name, entity, options) {
2081
+ const poller = await this.beginCreateSnapshot(name, entity, options);
2082
+ return poller.pollUntilDone();
2083
+ }
2084
+ /**
2085
+ * Updates the state of a key-value snapshot.
2086
+ * @param name The name of the key-value snapshot to update.
2087
+ * @param entity The parameters used to update the snapshot.
2088
+ * @param options The options parameters.
2089
+ */
2090
+ updateSnapshot(name, entity, options) {
2091
+ return this.sendOperationRequest({ name, entity, options }, updateSnapshotOperationSpec);
2092
+ }
2093
+ /**
2094
+ * Requests the headers and status of the given resource.
2095
+ * @param name The name of the key-value snapshot to check.
2096
+ * @param options The options parameters.
2097
+ */
2098
+ checkSnapshot(name, options) {
2099
+ return this.sendOperationRequest({ name, options }, checkSnapshotOperationSpec);
2100
+ }
1358
2101
  /**
1359
2102
  * Gets a list of labels.
1360
2103
  * @param options The options parameters.
@@ -1399,6 +2142,14 @@ class AppConfiguration extends coreHttpCompat__namespace.ExtendedServiceClient {
1399
2142
  checkRevisions(options) {
1400
2143
  return this.sendOperationRequest({ options }, checkRevisionsOperationSpec);
1401
2144
  }
2145
+ /**
2146
+ * Gets the state of a long running operation.
2147
+ * @param snapshot Snapshot identifier for the long running operation.
2148
+ * @param options The options parameters.
2149
+ */
2150
+ getOperationDetails(snapshot, options) {
2151
+ return this.sendOperationRequest({ snapshot, options }, getOperationDetailsOperationSpec);
2152
+ }
1402
2153
  /**
1403
2154
  * GetKeysNext
1404
2155
  * @param nextLink The nextLink from the previous successful call to the GetKeys method.
@@ -1415,6 +2166,14 @@ class AppConfiguration extends coreHttpCompat__namespace.ExtendedServiceClient {
1415
2166
  getKeyValuesNext(nextLink, options) {
1416
2167
  return this.sendOperationRequest({ nextLink, options }, getKeyValuesNextOperationSpec);
1417
2168
  }
2169
+ /**
2170
+ * GetSnapshotsNext
2171
+ * @param nextLink The nextLink from the previous successful call to the GetSnapshots method.
2172
+ * @param options The options parameters.
2173
+ */
2174
+ getSnapshotsNext(nextLink, options) {
2175
+ return this.sendOperationRequest({ nextLink, options }, getSnapshotsNextOperationSpec);
2176
+ }
1418
2177
  /**
1419
2178
  * GetLabelsNext
1420
2179
  * @param nextLink The nextLink from the previous successful call to the GetLabels method.
@@ -1446,7 +2205,7 @@ const getKeysOperationSpec = {
1446
2205
  bodyMapper: ErrorModel
1447
2206
  }
1448
2207
  },
1449
- queryParameters: [name, apiVersion$1, after],
2208
+ queryParameters: [name, apiVersion, after],
1450
2209
  urlParameters: [endpoint],
1451
2210
  headerParameters: [
1452
2211
  accept,
@@ -1464,7 +2223,7 @@ const checkKeysOperationSpec = {
1464
2223
  },
1465
2224
  default: {}
1466
2225
  },
1467
- queryParameters: [name, apiVersion$1, after],
2226
+ queryParameters: [name, apiVersion, after],
1468
2227
  urlParameters: [endpoint],
1469
2228
  headerParameters: [syncToken, acceptDatetime],
1470
2229
  serializer
@@ -1482,11 +2241,12 @@ const getKeyValuesOperationSpec = {
1482
2241
  }
1483
2242
  },
1484
2243
  queryParameters: [
1485
- apiVersion$1,
2244
+ apiVersion,
1486
2245
  after,
1487
2246
  key,
1488
2247
  label,
1489
- select
2248
+ select,
2249
+ snapshot
1490
2250
  ],
1491
2251
  urlParameters: [endpoint],
1492
2252
  headerParameters: [
@@ -1506,11 +2266,12 @@ const checkKeyValuesOperationSpec = {
1506
2266
  default: {}
1507
2267
  },
1508
2268
  queryParameters: [
1509
- apiVersion$1,
2269
+ apiVersion,
1510
2270
  after,
1511
2271
  key,
1512
2272
  label,
1513
- select
2273
+ select,
2274
+ snapshot
1514
2275
  ],
1515
2276
  urlParameters: [endpoint],
1516
2277
  headerParameters: [syncToken, acceptDatetime],
@@ -1531,7 +2292,7 @@ const getKeyValueOperationSpec = {
1531
2292
  bodyMapper: ErrorModel
1532
2293
  }
1533
2294
  },
1534
- queryParameters: [apiVersion$1, label, select],
2295
+ queryParameters: [apiVersion, label, select],
1535
2296
  urlParameters: [endpoint, key1],
1536
2297
  headerParameters: [
1537
2298
  syncToken,
@@ -1555,7 +2316,7 @@ const putKeyValueOperationSpec = {
1555
2316
  }
1556
2317
  },
1557
2318
  requestBody: entity,
1558
- queryParameters: [apiVersion$1, label],
2319
+ queryParameters: [apiVersion, label],
1559
2320
  urlParameters: [endpoint, key1],
1560
2321
  headerParameters: [
1561
2322
  syncToken,
@@ -1582,7 +2343,7 @@ const deleteKeyValueOperationSpec = {
1582
2343
  bodyMapper: ErrorModel
1583
2344
  }
1584
2345
  },
1585
- queryParameters: [apiVersion$1, label],
2346
+ queryParameters: [apiVersion, label],
1586
2347
  urlParameters: [endpoint, key1],
1587
2348
  headerParameters: [
1588
2349
  syncToken,
@@ -1603,7 +2364,7 @@ const checkKeyValueOperationSpec = {
1603
2364
  },
1604
2365
  default: {}
1605
2366
  },
1606
- queryParameters: [apiVersion$1, label, select],
2367
+ queryParameters: [apiVersion, label, select],
1607
2368
  urlParameters: [endpoint, key1],
1608
2369
  headerParameters: [
1609
2370
  syncToken,
@@ -1613,6 +2374,143 @@ const checkKeyValueOperationSpec = {
1613
2374
  ],
1614
2375
  serializer
1615
2376
  };
2377
+ const getSnapshotsOperationSpec = {
2378
+ path: "/snapshots",
2379
+ httpMethod: "GET",
2380
+ responses: {
2381
+ 200: {
2382
+ bodyMapper: SnapshotListResult,
2383
+ headersMapper: AppConfigurationGetSnapshotsHeaders
2384
+ },
2385
+ default: {
2386
+ bodyMapper: ErrorModel
2387
+ }
2388
+ },
2389
+ queryParameters: [
2390
+ name,
2391
+ apiVersion,
2392
+ after,
2393
+ select1,
2394
+ status
2395
+ ],
2396
+ urlParameters: [endpoint],
2397
+ headerParameters: [syncToken, accept3],
2398
+ serializer
2399
+ };
2400
+ const checkSnapshotsOperationSpec = {
2401
+ path: "/snapshots",
2402
+ httpMethod: "HEAD",
2403
+ responses: {
2404
+ 200: {
2405
+ headersMapper: AppConfigurationCheckSnapshotsHeaders
2406
+ },
2407
+ default: {}
2408
+ },
2409
+ queryParameters: [apiVersion, after],
2410
+ urlParameters: [endpoint],
2411
+ headerParameters: [syncToken],
2412
+ serializer
2413
+ };
2414
+ const getSnapshotOperationSpec = {
2415
+ path: "/snapshots/{name}",
2416
+ httpMethod: "GET",
2417
+ responses: {
2418
+ 200: {
2419
+ bodyMapper: Snapshot,
2420
+ headersMapper: AppConfigurationGetSnapshotHeaders
2421
+ },
2422
+ default: {
2423
+ bodyMapper: ErrorModel
2424
+ }
2425
+ },
2426
+ queryParameters: [apiVersion, select1],
2427
+ urlParameters: [endpoint, name1],
2428
+ headerParameters: [
2429
+ syncToken,
2430
+ ifMatch,
2431
+ ifNoneMatch,
2432
+ accept4
2433
+ ],
2434
+ serializer
2435
+ };
2436
+ const createSnapshotOperationSpec = {
2437
+ path: "/snapshots/{name}",
2438
+ httpMethod: "PUT",
2439
+ responses: {
2440
+ 200: {
2441
+ bodyMapper: Snapshot,
2442
+ headersMapper: AppConfigurationCreateSnapshotHeaders
2443
+ },
2444
+ 201: {
2445
+ bodyMapper: Snapshot,
2446
+ headersMapper: AppConfigurationCreateSnapshotHeaders
2447
+ },
2448
+ 202: {
2449
+ bodyMapper: Snapshot,
2450
+ headersMapper: AppConfigurationCreateSnapshotHeaders
2451
+ },
2452
+ 204: {
2453
+ bodyMapper: Snapshot,
2454
+ headersMapper: AppConfigurationCreateSnapshotHeaders
2455
+ },
2456
+ default: {
2457
+ bodyMapper: ErrorModel
2458
+ }
2459
+ },
2460
+ requestBody: entity1,
2461
+ queryParameters: [apiVersion],
2462
+ urlParameters: [endpoint, name2],
2463
+ headerParameters: [
2464
+ syncToken,
2465
+ accept4,
2466
+ contentType1
2467
+ ],
2468
+ mediaType: "json",
2469
+ serializer
2470
+ };
2471
+ const updateSnapshotOperationSpec = {
2472
+ path: "/snapshots/{name}",
2473
+ httpMethod: "PATCH",
2474
+ responses: {
2475
+ 200: {
2476
+ bodyMapper: Snapshot,
2477
+ headersMapper: AppConfigurationUpdateSnapshotHeaders
2478
+ },
2479
+ default: {
2480
+ bodyMapper: ErrorModel
2481
+ }
2482
+ },
2483
+ requestBody: entity2,
2484
+ queryParameters: [apiVersion],
2485
+ urlParameters: [endpoint, name1],
2486
+ headerParameters: [
2487
+ syncToken,
2488
+ ifMatch,
2489
+ ifNoneMatch,
2490
+ accept4,
2491
+ contentType2
2492
+ ],
2493
+ mediaType: "json",
2494
+ serializer
2495
+ };
2496
+ const checkSnapshotOperationSpec = {
2497
+ path: "/snapshots/{name}",
2498
+ httpMethod: "HEAD",
2499
+ responses: {
2500
+ 200: {
2501
+ headersMapper: AppConfigurationCheckSnapshotHeaders
2502
+ },
2503
+ default: {}
2504
+ },
2505
+ queryParameters: [apiVersion],
2506
+ urlParameters: [endpoint, name1],
2507
+ headerParameters: [
2508
+ syncToken,
2509
+ ifMatch,
2510
+ ifNoneMatch
2511
+ ],
2512
+ serializer
2513
+ };
1616
2514
  const getLabelsOperationSpec = {
1617
2515
  path: "/labels",
1618
2516
  httpMethod: "GET",
@@ -1627,15 +2525,15 @@ const getLabelsOperationSpec = {
1627
2525
  },
1628
2526
  queryParameters: [
1629
2527
  name,
1630
- apiVersion$1,
2528
+ apiVersion,
1631
2529
  after,
1632
- select1
2530
+ select2
1633
2531
  ],
1634
2532
  urlParameters: [endpoint],
1635
2533
  headerParameters: [
1636
2534
  syncToken,
1637
2535
  acceptDatetime,
1638
- accept3
2536
+ accept5
1639
2537
  ],
1640
2538
  serializer
1641
2539
  };
@@ -1650,9 +2548,9 @@ const checkLabelsOperationSpec = {
1650
2548
  },
1651
2549
  queryParameters: [
1652
2550
  name,
1653
- apiVersion$1,
2551
+ apiVersion,
1654
2552
  after,
1655
- select1
2553
+ select2
1656
2554
  ],
1657
2555
  urlParameters: [endpoint],
1658
2556
  headerParameters: [syncToken, acceptDatetime],
@@ -1670,7 +2568,7 @@ const putLockOperationSpec = {
1670
2568
  bodyMapper: ErrorModel
1671
2569
  }
1672
2570
  },
1673
- queryParameters: [apiVersion$1, label],
2571
+ queryParameters: [apiVersion, label],
1674
2572
  urlParameters: [endpoint, key1],
1675
2573
  headerParameters: [
1676
2574
  syncToken,
@@ -1692,7 +2590,7 @@ const deleteLockOperationSpec = {
1692
2590
  bodyMapper: ErrorModel
1693
2591
  }
1694
2592
  },
1695
- queryParameters: [apiVersion$1, label],
2593
+ queryParameters: [apiVersion, label],
1696
2594
  urlParameters: [endpoint, key1],
1697
2595
  headerParameters: [
1698
2596
  syncToken,
@@ -1715,7 +2613,7 @@ const getRevisionsOperationSpec = {
1715
2613
  }
1716
2614
  },
1717
2615
  queryParameters: [
1718
- apiVersion$1,
2616
+ apiVersion,
1719
2617
  after,
1720
2618
  key,
1721
2619
  label,
@@ -1739,7 +2637,7 @@ const checkRevisionsOperationSpec = {
1739
2637
  default: {}
1740
2638
  },
1741
2639
  queryParameters: [
1742
- apiVersion$1,
2640
+ apiVersion,
1743
2641
  after,
1744
2642
  key,
1745
2643
  label,
@@ -1749,6 +2647,22 @@ const checkRevisionsOperationSpec = {
1749
2647
  headerParameters: [syncToken, acceptDatetime],
1750
2648
  serializer
1751
2649
  };
2650
+ const getOperationDetailsOperationSpec = {
2651
+ path: "/operations",
2652
+ httpMethod: "GET",
2653
+ responses: {
2654
+ 200: {
2655
+ bodyMapper: OperationDetails
2656
+ },
2657
+ default: {
2658
+ bodyMapper: ErrorModel
2659
+ }
2660
+ },
2661
+ queryParameters: [apiVersion, snapshot1],
2662
+ urlParameters: [endpoint],
2663
+ headerParameters: [accept6],
2664
+ serializer
2665
+ };
1752
2666
  const getKeysNextOperationSpec = {
1753
2667
  path: "{nextLink}",
1754
2668
  httpMethod: "GET",
@@ -1761,7 +2675,6 @@ const getKeysNextOperationSpec = {
1761
2675
  bodyMapper: ErrorModel
1762
2676
  }
1763
2677
  },
1764
- queryParameters: [name, apiVersion$1, after],
1765
2678
  urlParameters: [endpoint, nextLink],
1766
2679
  headerParameters: [
1767
2680
  accept,
@@ -1782,13 +2695,6 @@ const getKeyValuesNextOperationSpec = {
1782
2695
  bodyMapper: ErrorModel
1783
2696
  }
1784
2697
  },
1785
- queryParameters: [
1786
- apiVersion$1,
1787
- after,
1788
- key,
1789
- label,
1790
- select
1791
- ],
1792
2698
  urlParameters: [endpoint, nextLink],
1793
2699
  headerParameters: [
1794
2700
  syncToken,
@@ -1797,6 +2703,22 @@ const getKeyValuesNextOperationSpec = {
1797
2703
  ],
1798
2704
  serializer
1799
2705
  };
2706
+ const getSnapshotsNextOperationSpec = {
2707
+ path: "{nextLink}",
2708
+ httpMethod: "GET",
2709
+ responses: {
2710
+ 200: {
2711
+ bodyMapper: SnapshotListResult,
2712
+ headersMapper: AppConfigurationGetSnapshotsNextHeaders
2713
+ },
2714
+ default: {
2715
+ bodyMapper: ErrorModel
2716
+ }
2717
+ },
2718
+ urlParameters: [endpoint, nextLink],
2719
+ headerParameters: [syncToken, accept3],
2720
+ serializer
2721
+ };
1800
2722
  const getLabelsNextOperationSpec = {
1801
2723
  path: "{nextLink}",
1802
2724
  httpMethod: "GET",
@@ -1809,17 +2731,11 @@ const getLabelsNextOperationSpec = {
1809
2731
  bodyMapper: ErrorModel
1810
2732
  }
1811
2733
  },
1812
- queryParameters: [
1813
- name,
1814
- apiVersion$1,
1815
- after,
1816
- select1
1817
- ],
1818
2734
  urlParameters: [endpoint, nextLink],
1819
2735
  headerParameters: [
1820
2736
  syncToken,
1821
2737
  acceptDatetime,
1822
- accept3
2738
+ accept5
1823
2739
  ],
1824
2740
  serializer
1825
2741
  };
@@ -1835,13 +2751,6 @@ const getRevisionsNextOperationSpec = {
1835
2751
  bodyMapper: ErrorModel
1836
2752
  }
1837
2753
  },
1838
- queryParameters: [
1839
- apiVersion$1,
1840
- after,
1841
- key,
1842
- label,
1843
- select
1844
- ],
1845
2754
  urlParameters: [endpoint, nextLink],
1846
2755
  headerParameters: [
1847
2756
  syncToken,
@@ -1887,7 +2796,7 @@ function appConfigKeyCredentialPolicy(credential, secret) {
1887
2796
  /**
1888
2797
  * @internal
1889
2798
  */
1890
- const packageVersion = "1.4.1";
2799
+ const packageVersion = "1.5.0-beta.1";
1891
2800
 
1892
2801
  // Copyright (c) Microsoft Corporation.
1893
2802
  /** @internal */
@@ -1898,7 +2807,6 @@ const tracingClient = coreTracing.createTracingClient({
1898
2807
  });
1899
2808
 
1900
2809
  // Copyright (c) Microsoft Corporation.
1901
- const apiVersion = "1.0";
1902
2810
  const ConnectionStringRegex = /Endpoint=(.*);Id=(.*);Secret=(.*)/;
1903
2811
  const deserializationContentTypes = {
1904
2812
  json: [
@@ -1907,6 +2815,9 @@ const deserializationContentTypes = {
1907
2815
  "application/vnd.microsoft.appconfig.kvs+json",
1908
2816
  "application/vnd.microsoft.appconfig.keyset+json",
1909
2817
  "application/vnd.microsoft.appconfig.revs+json",
2818
+ "application/vnd.microsoft.appconfig.snapshotset+json",
2819
+ "application/vnd.microsoft.appconfig.snapshot+json",
2820
+ "application/json",
1910
2821
  ],
1911
2822
  };
1912
2823
  /**
@@ -1946,7 +2857,7 @@ class AppConfigurationClient {
1946
2857
  expectedContentTypes: deserializationContentTypes,
1947
2858
  } });
1948
2859
  this._syncTokens = appConfigOptions.syncTokens || new SyncTokens();
1949
- this.client = new AppConfiguration(appConfigEndpoint, apiVersion, internalClientPipelineOptions);
2860
+ this.client = new AppConfiguration(appConfigEndpoint, (appConfigOptions === null || appConfigOptions === void 0 ? void 0 : appConfigOptions.apiVersion) || AppConfigurationApiVersion.Latest, internalClientPipelineOptions);
1950
2861
  this.client.pipeline.addPolicy(authPolicy, { phase: "Sign" });
1951
2862
  this.client.pipeline.addPolicy(syncTokenPolicy(this._syncTokens), { afterPhase: "Retry" });
1952
2863
  }
@@ -2063,6 +2974,34 @@ class AppConfigurationClient {
2063
2974
  };
2064
2975
  return corePaging.getPagedAsyncIterator(pagedResult);
2065
2976
  }
2977
+ /**
2978
+ * Lists settings from the Azure App Configuration service for snapshots based on name, optionally
2979
+ * filtered by key names, labels and accept datetime.
2980
+ *
2981
+ * Example code:
2982
+ * ```ts
2983
+ * const allSettingsWithLabel = client.listConfigurationSettingsForSnashots({ snapshotName: "MySnapshot" });
2984
+ * ```
2985
+ * @param options - Optional parameters for the request.
2986
+ */
2987
+ listConfigurationSettingsForSnapshot(snapshotName, options = {}) {
2988
+ const pagedResult = {
2989
+ firstPageLink: undefined,
2990
+ getPage: async (pageLink) => {
2991
+ var _a;
2992
+ const response = await this.sendConfigurationSettingsRequest(Object.assign({ snapshotName }, options), pageLink);
2993
+ const currentResponse = Object.assign(Object.assign({}, response), { items: response.items != null ? (_a = response.items) === null || _a === void 0 ? void 0 : _a.map(transformKeyValue) : [], continuationToken: response.nextLink
2994
+ ? extractAfterTokenFromNextLink(response.nextLink)
2995
+ : undefined });
2996
+ return {
2997
+ page: currentResponse,
2998
+ nextPageLink: currentResponse.continuationToken,
2999
+ };
3000
+ },
3001
+ toElements: (page) => page.items,
3002
+ };
3003
+ return corePaging.getPagedAsyncIterator(pagedResult);
3004
+ }
2066
3005
  async sendConfigurationSettingsRequest(options = {}, pageLink) {
2067
3006
  return tracingClient.withSpan("AppConfigurationClient.listConfigurationSettings", options, async (updatedOptions) => {
2068
3007
  const response = await this.client.getKeyValues(Object.assign(Object.assign(Object.assign(Object.assign({}, updatedOptions), formatAcceptDateTime(options)), formatFiltersAndSelect(options)), { after: pageLink }));
@@ -2151,8 +3090,112 @@ class AppConfigurationClient {
2151
3090
  updateSyncToken(syncToken) {
2152
3091
  this._syncTokens.addSyncTokenFromHeaderValue(syncToken);
2153
3092
  }
3093
+ /**
3094
+ * Begins creating a snapshot for Azure App Configuration service, fails if it
3095
+ * already exists.
3096
+ */
3097
+ beginCreateSnapshot(snapshot, options = {}) {
3098
+ return tracingClient.withSpan(`${AppConfigurationClient.name}.beginCreateSnapshot`, options, (updatedOptions) => this.client.beginCreateSnapshot(snapshot.name, snapshot, Object.assign({}, updatedOptions)));
3099
+ }
3100
+ /**
3101
+ * Begins creating a snapshot for Azure App Configuration service, waits until it is done,
3102
+ * fails if it already exists.
3103
+ */
3104
+ beginCreateSnapshotAndWait(snapshot, options = {}) {
3105
+ return tracingClient.withSpan(`${AppConfigurationClient.name}.beginCreateSnapshotAndWait`, options, (updatedOptions) => this.client.beginCreateSnapshotAndWait(snapshot.name, snapshot, Object.assign({}, updatedOptions)));
3106
+ }
3107
+ /**
3108
+ * Get a snapshot from Azure App Configuration service
3109
+ *
3110
+ * Example usage:
3111
+ * ```ts
3112
+ * const result = await client.getSnapshot("MySnapshot");
3113
+ * ```
3114
+ * @param name - The name of the snapshot.
3115
+ * @param options - Optional parameters for the request.
3116
+ */
3117
+ getSnapshot(name, options = {}) {
3118
+ return tracingClient.withSpan("AppConfigurationClient.getSnapshot", options, async (updatedOptions) => {
3119
+ logger.info("[getSnapshot] Get a snapshot");
3120
+ const originalResponse = await this.client.getSnapshot(name, Object.assign({}, updatedOptions));
3121
+ const response = transformSnapshotResponse(originalResponse);
3122
+ assertResponse(response);
3123
+ return response;
3124
+ });
3125
+ }
3126
+ /**
3127
+ * Recover an archived snapshot back to ready status
3128
+ *
3129
+ * Example usage:
3130
+ * ```ts
3131
+ * const result = await client.recoverSnapshot("MySnapshot");
3132
+ * ```
3133
+ * @param name - The name of the snapshot.
3134
+ * @param options - Optional parameters for the request.
3135
+ */
3136
+ recoverSnapshot(snapshotId, options = {}) {
3137
+ return tracingClient.withSpan("AppConfigurationClient.recoverSnapshot", options, async (updatedOptions) => {
3138
+ logger.info("[recoverSnapshot] Recover a snapshot");
3139
+ const originalResponse = await this.client.updateSnapshot(snapshotId.name, { status: "ready" }, Object.assign(Object.assign({}, updatedOptions), checkAndFormatIfAndIfNoneMatch({ etag: snapshotId.etag }, options)));
3140
+ const response = transformSnapshotResponse(originalResponse);
3141
+ assertResponse(response);
3142
+ return response;
3143
+ });
3144
+ }
3145
+ /**
3146
+ * Archive a ready snapshot
3147
+ *
3148
+ * Example usage:
3149
+ * ```ts
3150
+ * const result = await client.archiveSnapshot("MySnapshot");
3151
+ * ```
3152
+ * @param name - The name of the snapshot.
3153
+ * @param options - Optional parameters for the request.
3154
+ */
3155
+ archiveSnapshot(snapshotId, options = {}) {
3156
+ return tracingClient.withSpan("AppConfigurationClient.archiveSnapshot", options, async (updatedOptions) => {
3157
+ logger.info("[archiveSnapshot] Archive a snapshot");
3158
+ const originalResponse = await this.client.updateSnapshot(snapshotId.name, { status: "archived" }, Object.assign(Object.assign({}, updatedOptions), checkAndFormatIfAndIfNoneMatch({ etag: snapshotId.etag }, options)));
3159
+ const response = transformSnapshotResponse(originalResponse);
3160
+ assertResponse(response);
3161
+ return response;
3162
+ });
3163
+ }
3164
+ /**
3165
+ * List all snapshots from Azure App Configuration service
3166
+ *
3167
+ * Example usage:
3168
+ * ```ts
3169
+ * const result = await client.listSnapshots();
3170
+ * ```
3171
+ * @param options - Optional parameters for the request.
3172
+ */
3173
+ listSnapshots(options = {}) {
3174
+ const pagedResult = {
3175
+ firstPageLink: undefined,
3176
+ getPage: async (pageLink) => {
3177
+ const response = await this.sendSnapShotsRequest(options, pageLink);
3178
+ const currentResponse = Object.assign(Object.assign({}, response), { items: response.items != null ? response.items : [], continuationToken: response.nextLink
3179
+ ? extractAfterTokenFromNextLink(response.nextLink)
3180
+ : undefined });
3181
+ return {
3182
+ page: currentResponse,
3183
+ nextPageLink: currentResponse.continuationToken,
3184
+ };
3185
+ },
3186
+ toElements: (page) => page.items,
3187
+ };
3188
+ return corePaging.getPagedAsyncIterator(pagedResult);
3189
+ }
3190
+ async sendSnapShotsRequest(options = {}, pageLink) {
3191
+ return tracingClient.withSpan("AppConfigurationClient.listSnapshots", options, async (updatedOptions) => {
3192
+ const response = await this.client.getSnapshots(Object.assign(Object.assign(Object.assign({}, updatedOptions), formatSnapshotFiltersAndSelect(options)), { after: pageLink }));
3193
+ return response;
3194
+ });
3195
+ }
2154
3196
  }
2155
3197
 
3198
+ exports.AppConfigurationApiVersion = AppConfigurationApiVersion;
2156
3199
  exports.AppConfigurationClient = AppConfigurationClient;
2157
3200
  exports.featureFlagContentType = featureFlagContentType;
2158
3201
  exports.featureFlagPrefix = featureFlagPrefix;