@azure/keyvault-admin 4.3.1-alpha.20221107.3 → 4.4.0-beta.1

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.
package/dist/index.js CHANGED
@@ -629,6 +629,70 @@ const SelectiveKeyRestoreOperation = {
629
629
  }
630
630
  }
631
631
  };
632
+ const UpdateSettingRequest = {
633
+ type: {
634
+ name: "Composite",
635
+ className: "UpdateSettingRequest",
636
+ modelProperties: {
637
+ value: {
638
+ serializedName: "value",
639
+ required: true,
640
+ type: {
641
+ name: "String"
642
+ }
643
+ }
644
+ }
645
+ }
646
+ };
647
+ const Setting = {
648
+ type: {
649
+ name: "Composite",
650
+ className: "Setting",
651
+ modelProperties: {
652
+ name: {
653
+ serializedName: "name",
654
+ required: true,
655
+ type: {
656
+ name: "String"
657
+ }
658
+ },
659
+ value: {
660
+ serializedName: "value",
661
+ required: true,
662
+ type: {
663
+ name: "String"
664
+ }
665
+ },
666
+ type: {
667
+ serializedName: "type",
668
+ type: {
669
+ name: "String"
670
+ }
671
+ }
672
+ }
673
+ }
674
+ };
675
+ const SettingsListResult = {
676
+ type: {
677
+ name: "Composite",
678
+ className: "SettingsListResult",
679
+ modelProperties: {
680
+ settings: {
681
+ serializedName: "settings",
682
+ readOnly: true,
683
+ type: {
684
+ name: "Sequence",
685
+ element: {
686
+ type: {
687
+ name: "Composite",
688
+ className: "Setting"
689
+ }
690
+ }
691
+ }
692
+ }
693
+ }
694
+ }
695
+ };
632
696
  const RoleAssignmentFilter = {
633
697
  type: {
634
698
  name: "Composite",
@@ -738,6 +802,9 @@ var Mappers = /*#__PURE__*/Object.freeze({
738
802
  RestoreOperation: RestoreOperation,
739
803
  SelectiveKeyRestoreOperationParameters: SelectiveKeyRestoreOperationParameters,
740
804
  SelectiveKeyRestoreOperation: SelectiveKeyRestoreOperation,
805
+ UpdateSettingRequest: UpdateSettingRequest,
806
+ Setting: Setting,
807
+ SettingsListResult: SettingsListResult,
741
808
  RoleAssignmentFilter: RoleAssignmentFilter,
742
809
  RoleDefinitionFilter: RoleDefinitionFilter,
743
810
  KeyVaultClientFullBackupHeaders: KeyVaultClientFullBackupHeaders,
@@ -886,6 +953,16 @@ const keyName = {
886
953
  }
887
954
  }
888
955
  };
956
+ const settingName = {
957
+ parameterPath: "settingName",
958
+ mapper: {
959
+ serializedName: "setting-name",
960
+ required: true,
961
+ type: {
962
+ name: "String"
963
+ }
964
+ }
965
+ };
889
966
 
890
967
  /*
891
968
  * Copyright (c) Microsoft Corporation.
@@ -1246,7 +1323,7 @@ class KeyVaultClientContext extends coreClient__namespace.ServiceClient {
1246
1323
  const defaults = {
1247
1324
  requestContentType: "application/json; charset=utf-8"
1248
1325
  };
1249
- const packageDetails = `azsdk-js-keyvault-admin/4.3.1`;
1326
+ const packageDetails = `azsdk-js-keyvault-admin/4.4.0-beta.1`;
1250
1327
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
1251
1328
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
1252
1329
  : `${packageDetails}`;
@@ -1278,8 +1355,7 @@ class KeyVaultClient extends KeyVaultClientContext {
1278
1355
  this.roleAssignments = new RoleAssignmentsImpl(this);
1279
1356
  }
1280
1357
  /**
1281
- * Creates a full backup using a user-provided SAS token to an Azure blob storage container. This
1282
- * operation is supported only by the Managed HSM service.
1358
+ * Creates a full backup using a user-provided SAS token to an Azure blob storage container.
1283
1359
  * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
1284
1360
  * @param options The options parameters.
1285
1361
  */
@@ -1323,6 +1399,33 @@ class KeyVaultClient extends KeyVaultClientContext {
1323
1399
  selectiveKeyRestoreOperation(vaultBaseUrl, keyName, options) {
1324
1400
  return this.sendOperationRequest({ vaultBaseUrl, keyName, options }, selectiveKeyRestoreOperationOperationSpec);
1325
1401
  }
1402
+ /**
1403
+ * Description of the pool setting to be updated
1404
+ * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
1405
+ * @param settingName The name of the account setting. Must be a valid settings option.
1406
+ * @param value The value of the pool setting.
1407
+ * @param options The options parameters.
1408
+ */
1409
+ updateSetting(vaultBaseUrl, settingName, value, options) {
1410
+ return this.sendOperationRequest({ vaultBaseUrl, settingName, value, options }, updateSettingOperationSpec);
1411
+ }
1412
+ /**
1413
+ * Retrieves the setting object of a specified setting name.
1414
+ * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
1415
+ * @param settingName The name of the account setting. Must be a valid settings option.
1416
+ * @param options The options parameters.
1417
+ */
1418
+ getSetting(vaultBaseUrl, settingName, options) {
1419
+ return this.sendOperationRequest({ vaultBaseUrl, settingName, options }, getSettingOperationSpec);
1420
+ }
1421
+ /**
1422
+ * Retrieves a list of all the available account settings that can be configured.
1423
+ * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
1424
+ * @param options The options parameters.
1425
+ */
1426
+ getSettings(vaultBaseUrl, options) {
1427
+ return this.sendOperationRequest({ vaultBaseUrl, options }, getSettingsOperationSpec);
1428
+ }
1326
1429
  }
1327
1430
  // Operation Specifications
1328
1431
  const serializer = coreClient__namespace.createSerializer(Mappers, /* isXml */ false);
@@ -1415,17 +1518,70 @@ const selectiveKeyRestoreOperationOperationSpec = {
1415
1518
  mediaType: "json",
1416
1519
  serializer
1417
1520
  };
1521
+ const updateSettingOperationSpec = {
1522
+ path: "/settings/{setting-name}",
1523
+ httpMethod: "PATCH",
1524
+ responses: {
1525
+ 200: {
1526
+ bodyMapper: Setting
1527
+ },
1528
+ default: {
1529
+ bodyMapper: KeyVaultError
1530
+ }
1531
+ },
1532
+ requestBody: {
1533
+ parameterPath: { value: ["value"] },
1534
+ mapper: Object.assign(Object.assign({}, UpdateSettingRequest), { required: true })
1535
+ },
1536
+ queryParameters: [apiVersion],
1537
+ urlParameters: [vaultBaseUrl, settingName],
1538
+ headerParameters: [accept, contentType],
1539
+ mediaType: "json",
1540
+ serializer
1541
+ };
1542
+ const getSettingOperationSpec = {
1543
+ path: "/settings/{setting-name}",
1544
+ httpMethod: "GET",
1545
+ responses: {
1546
+ 200: {
1547
+ bodyMapper: Setting
1548
+ },
1549
+ default: {
1550
+ bodyMapper: KeyVaultError
1551
+ }
1552
+ },
1553
+ queryParameters: [apiVersion],
1554
+ urlParameters: [vaultBaseUrl, settingName],
1555
+ headerParameters: [accept],
1556
+ serializer
1557
+ };
1558
+ const getSettingsOperationSpec = {
1559
+ path: "/settings",
1560
+ httpMethod: "GET",
1561
+ responses: {
1562
+ 200: {
1563
+ bodyMapper: SettingsListResult
1564
+ },
1565
+ default: {
1566
+ bodyMapper: KeyVaultError
1567
+ }
1568
+ },
1569
+ queryParameters: [apiVersion],
1570
+ urlParameters: [vaultBaseUrl],
1571
+ headerParameters: [accept],
1572
+ serializer
1573
+ };
1418
1574
 
1419
1575
  // Copyright (c) Microsoft Corporation.
1420
1576
  // Licensed under the MIT license.
1421
1577
  /**
1422
1578
  * Current version of the Key Vault Admin SDK.
1423
1579
  */
1424
- const SDK_VERSION = "4.3.1";
1580
+ const SDK_VERSION = "4.4.0-beta.1";
1425
1581
  /**
1426
1582
  * The latest supported Key Vault service API version.
1427
1583
  */
1428
- const LATEST_API_VERSION = "7.3";
1584
+ const LATEST_API_VERSION = "7.4-preview.1";
1429
1585
 
1430
1586
  // Copyright (c) Microsoft Corporation.
1431
1587
  /**
@@ -1832,12 +1988,12 @@ class KeyVaultAccessControlClient {
1832
1988
  * Code generated by Microsoft (R) AutoRest Code Generator.
1833
1989
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
1834
1990
  */
1835
- /** Known values of {@link ApiVersion73} that the service accepts. */
1836
- var KnownApiVersion73;
1837
- (function (KnownApiVersion73) {
1838
- /** Api Version '7.3' */
1839
- KnownApiVersion73["Seven3"] = "7.3";
1840
- })(KnownApiVersion73 || (KnownApiVersion73 = {}));
1991
+ /** Known values of {@link ApiVersion74Preview1} that the service accepts. */
1992
+ var KnownApiVersion74Preview1;
1993
+ (function (KnownApiVersion74Preview1) {
1994
+ /** Api Version '7.4-preview.1' */
1995
+ KnownApiVersion74Preview1["Seven4Preview1"] = "7.4-preview.1";
1996
+ })(KnownApiVersion74Preview1 || (KnownApiVersion74Preview1 = {}));
1841
1997
  /** Known values of {@link RoleType} that the service accepts. */
1842
1998
  var KnownRoleType;
1843
1999
  (function (KnownRoleType) {
@@ -1931,6 +2087,11 @@ var KnownRoleDefinitionType;
1931
2087
  (function (KnownRoleDefinitionType) {
1932
2088
  KnownRoleDefinitionType["MicrosoftAuthorizationRoleDefinitions"] = "Microsoft.Authorization/roleDefinitions";
1933
2089
  })(KnownRoleDefinitionType || (KnownRoleDefinitionType = {}));
2090
+ /** Known values of {@link SettingTypeEnum} that the service accepts. */
2091
+ var KnownSettingTypeEnum;
2092
+ (function (KnownSettingTypeEnum) {
2093
+ KnownSettingTypeEnum["Boolean"] = "boolean";
2094
+ })(KnownSettingTypeEnum || (KnownSettingTypeEnum = {}));
1934
2095
 
1935
2096
  // Copyright (c) Microsoft Corporation.
1936
2097
  /**
@@ -2460,8 +2621,97 @@ class KeyVaultBackupClient {
2460
2621
  }
2461
2622
  }
2462
2623
 
2624
+ // Copyright (c) Microsoft Corporation.
2625
+ function makeSetting(generatedSetting) {
2626
+ if (generatedSetting.type === "boolean") {
2627
+ return {
2628
+ name: generatedSetting.name,
2629
+ value: generatedSetting.value === "true" ? true : false,
2630
+ kind: "boolean",
2631
+ };
2632
+ }
2633
+ else {
2634
+ return {
2635
+ name: generatedSetting.name,
2636
+ value: generatedSetting.value,
2637
+ };
2638
+ }
2639
+ }
2640
+ /**
2641
+ * The KeyVaultSettingsClient provides asynchronous methods to create, update, get and list
2642
+ * settings for the Azure Key Vault.
2643
+ */
2644
+ class KeyVaultSettingsClient {
2645
+ /**
2646
+ * Creates an instance of the KeyVaultSettingsClient.
2647
+ *
2648
+ * Example usage:
2649
+ * ```ts
2650
+ * import { KeyVaultSettingsClient } from "@azure/keyvault-admin";
2651
+ * import { DefaultAzureCredential } from "@azure/identity";
2652
+ *
2653
+ * let vaultUrl = `https://<MY KEY VAULT HERE>.vault.azure.net`;
2654
+ * let credentials = new DefaultAzureCredential();
2655
+ *
2656
+ * let client = new KeyVaultSettingsClient(vaultUrl, credentials);
2657
+ * ```
2658
+ * @param vaultUrl - the URL of the Key Vault. It should have this shape: `https://${your-key-vault-name}.vault.azure.net`. You should validate that this URL references a valid Key Vault or Managed HSM resource. See https://aka.ms/azsdk/blog/vault-uri for details.
2659
+ * @param credential - An object that implements the `TokenCredential` interface used to authenticate requests to the service. Use the \@azure/identity package to create a credential that suits your needs.
2660
+ * @param options - options used to configure Key Vault API requests.
2661
+
2662
+ */
2663
+ constructor(vaultUrl, credential, options = {}) {
2664
+ this.vaultUrl = vaultUrl;
2665
+ const apiVersion = options.serviceVersion || LATEST_API_VERSION;
2666
+ const clientOptions = Object.assign(Object.assign({}, options), { loggingOptions: {
2667
+ logger: logger.info,
2668
+ additionalAllowedHeaderNames: [
2669
+ "x-ms-keyvault-region",
2670
+ "x-ms-keyvault-network-info",
2671
+ "x-ms-keyvault-service-version",
2672
+ ],
2673
+ } });
2674
+ this.client = new KeyVaultClient(apiVersion, clientOptions);
2675
+ this.client.pipeline.addPolicy(coreRestPipeline.bearerTokenAuthenticationPolicy({
2676
+ credential,
2677
+ scopes: [],
2678
+ challengeCallbacks: keyvaultCommon.createKeyVaultChallengeCallbacks(options),
2679
+ }));
2680
+ }
2681
+ /**
2682
+ * Updates the named account setting.
2683
+ *
2684
+ * @param settingName - the name of the account setting. Must be a valid settings option.
2685
+ * @param value - the value of the pool setting.
2686
+ * @param options - the optional parameters.
2687
+ */
2688
+ async updateSetting(settingName, value, options = {}) {
2689
+ return makeSetting(await this.client.updateSetting(this.vaultUrl, settingName, String(value), options));
2690
+ }
2691
+ /**
2692
+ * Get the value of a specific account setting.
2693
+ *
2694
+ * @param settingName - the name of the setting.
2695
+ * @param options - the optional parameters.
2696
+ */
2697
+ async getSetting(settingName, options = {}) {
2698
+ return makeSetting(await this.client.getSetting(this.vaultUrl, settingName, options));
2699
+ }
2700
+ /**
2701
+ * List the account's settings.
2702
+ *
2703
+ * @param options - the optional parameters.
2704
+ */
2705
+ async getSettings(options = {}) {
2706
+ var _a;
2707
+ const { settings } = await this.client.getSettings(this.vaultUrl, options);
2708
+ return { settings: (_a = settings === null || settings === void 0 ? void 0 : settings.map(makeSetting)) !== null && _a !== void 0 ? _a : [] };
2709
+ }
2710
+ }
2711
+
2463
2712
  exports.KeyVaultAccessControlClient = KeyVaultAccessControlClient;
2464
2713
  exports.KeyVaultBackupClient = KeyVaultBackupClient;
2714
+ exports.KeyVaultSettingsClient = KeyVaultSettingsClient;
2465
2715
  exports.LATEST_API_VERSION = LATEST_API_VERSION;
2466
2716
  exports.SDK_VERSION = SDK_VERSION;
2467
2717
  //# sourceMappingURL=index.js.map