@azure/keyvault-admin 4.2.1-alpha.20220325.3 → 4.3.0-alpha.20220405.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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Release History
2
2
 
3
- ## 4.2.1 (Unreleased)
3
+ ## 4.3.0-beta.1 (Unreleased)
4
4
 
5
5
  ### Features Added
6
6
 
package/dist/index.js CHANGED
@@ -5,9 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var tslib = require('tslib');
6
6
  var coreClient = require('@azure/core-client');
7
7
  var coreRestPipeline = require('@azure/core-rest-pipeline');
8
- var coreTracing = require('@azure/core-tracing');
9
8
  var logger$1 = require('@azure/logger');
10
9
  var uuid = require('uuid');
10
+ var coreTracing = require('@azure/core-tracing');
11
11
  var coreLro = require('@azure/core-lro');
12
12
 
13
13
  function _interopNamespace(e) {
@@ -35,7 +35,7 @@ var coreClient__namespace = /*#__PURE__*/_interopNamespace(coreClient);
35
35
  /**
36
36
  * Current version of the Key Vault Admin SDK.
37
37
  */
38
- const SDK_VERSION = "4.2.1";
38
+ const SDK_VERSION = "4.3.0-beta.1";
39
39
  /**
40
40
  * The latest supported Key Vault service API version.
41
41
  */
@@ -1260,7 +1260,7 @@ class KeyVaultClientContext extends coreClient__namespace.ServiceClient {
1260
1260
  const defaults = {
1261
1261
  requestContentType: "application/json; charset=utf-8"
1262
1262
  };
1263
- const packageDetails = `azsdk-js-keyvault-admin/4.2.0`;
1263
+ const packageDetails = `azsdk-js-keyvault-admin/4.3.0-beta.1`;
1264
1264
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
1265
1265
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
1266
1266
  : `${packageDetails}`;
@@ -1561,46 +1561,6 @@ function createChallengeCallbacks() {
1561
1561
  };
1562
1562
  }
1563
1563
 
1564
- // Copyright (c) Microsoft Corporation.
1565
- /**
1566
- * Returns a function that can be used for tracing options.
1567
- *
1568
- * @param prefix - The prefix to use, likely the name of the class / client.
1569
- *
1570
- * @example const withTrace = createTraceFunction("Azure.KeyVault.Certificates.CertificateClient")
1571
- *
1572
- * @internal
1573
- */
1574
- function createTraceFunction(prefix) {
1575
- const createSpan = coreTracing.createSpanFunction({
1576
- namespace: "Microsoft.KeyVault",
1577
- packagePrefix: prefix,
1578
- });
1579
- return async function (operationName, options, cb) {
1580
- const { updatedOptions, span } = createSpan(operationName, options);
1581
- try {
1582
- // NOTE: we really do need to await on this function here so we can handle any exceptions thrown and properly
1583
- // close the span.
1584
- const result = await cb(updatedOptions, span);
1585
- // otel 0.16+ needs this or else the code ends up being set as UNSET
1586
- span.setStatus({
1587
- code: coreTracing.SpanStatusCode.OK,
1588
- });
1589
- return result;
1590
- }
1591
- catch (err) {
1592
- span.setStatus({
1593
- code: coreTracing.SpanStatusCode.ERROR,
1594
- message: err.message,
1595
- });
1596
- throw err;
1597
- }
1598
- finally {
1599
- span.end();
1600
- }
1601
- };
1602
- }
1603
-
1604
1564
  // Copyright (c) Microsoft Corporation.
1605
1565
  /**
1606
1566
  * The \@azure/logger configuration for this package.
@@ -1656,7 +1616,13 @@ const mappings = {
1656
1616
  };
1657
1617
 
1658
1618
  // Copyright (c) Microsoft Corporation.
1659
- const withTrace$3 = createTraceFunction("Azure.KeyVault.Admin.KeyVaultAccessControlClient");
1619
+ const tracingClient = coreTracing.createTracingClient({
1620
+ namespace: "Microsoft.KeyVault",
1621
+ packageName: "@azure/keyvault-admin",
1622
+ packageVersion: SDK_VERSION,
1623
+ });
1624
+
1625
+ // Copyright (c) Microsoft Corporation.
1660
1626
  /**
1661
1627
  * The KeyVaultAccessControlClient provides methods to manage
1662
1628
  * access control and role assignments in any given Azure Key Vault instance.
@@ -1716,7 +1682,7 @@ class KeyVaultAccessControlClient {
1716
1682
  * @param options - The optional parameters.
1717
1683
  */
1718
1684
  createRoleAssignment(roleScope, name, roleDefinitionId, principalId, options = {}) {
1719
- return withTrace$3("createRoleAssignment", options, async (updatedOptions) => {
1685
+ return tracingClient.withSpan("KeyVaultAccessControlClient.createRoleAssignment", options, async (updatedOptions) => {
1720
1686
  const response = await this.client.roleAssignments.create(this.vaultUrl, roleScope, name, {
1721
1687
  properties: {
1722
1688
  roleDefinitionId,
@@ -1741,7 +1707,7 @@ class KeyVaultAccessControlClient {
1741
1707
  * @param options - The optional parameters.
1742
1708
  */
1743
1709
  deleteRoleAssignment(roleScope, name, options = {}) {
1744
- return withTrace$3("deleteRoleAssignment", options, async (updatedOptions) => {
1710
+ return tracingClient.withSpan("KeyVaultAccessControlClient.deleteRoleAssignment", options, async (updatedOptions) => {
1745
1711
  await this.client.roleAssignments.delete(this.vaultUrl, roleScope, name, updatedOptions);
1746
1712
  });
1747
1713
  }
@@ -1761,7 +1727,7 @@ class KeyVaultAccessControlClient {
1761
1727
  * @param options - The optional parameters.
1762
1728
  */
1763
1729
  getRoleAssignment(roleScope, name, options = {}) {
1764
- return withTrace$3("getRoleAssignment", options, async (updatedOptions) => {
1730
+ return tracingClient.withSpan("KeyVaultAccessControlClient.getRoleAssignment", options, async (updatedOptions) => {
1765
1731
  const response = await this.client.roleAssignments.get(this.vaultUrl, roleScope, name, updatedOptions);
1766
1732
  return mappings.roleAssignment.generatedToPublic(response);
1767
1733
  });
@@ -1776,7 +1742,7 @@ class KeyVaultAccessControlClient {
1776
1742
  return tslib.__asyncGenerator(this, arguments, function* listRoleAssignmentsPage_1() {
1777
1743
  if (!continuationState.continuationToken) {
1778
1744
  const optionsComplete = options || {};
1779
- const currentSetResponse = yield tslib.__await(withTrace$3("listRoleAssignments", optionsComplete, async (updatedOptions) => {
1745
+ const currentSetResponse = yield tslib.__await(tracingClient.withSpan("KeyVaultAccessControlClient.listRoleAssignmentsPage", optionsComplete, async (updatedOptions) => {
1780
1746
  return this.client.roleAssignments.listForScope(this.vaultUrl, roleScope, updatedOptions);
1781
1747
  }));
1782
1748
  continuationState.continuationToken = currentSetResponse.nextLink;
@@ -1785,7 +1751,7 @@ class KeyVaultAccessControlClient {
1785
1751
  }
1786
1752
  }
1787
1753
  while (continuationState.continuationToken) {
1788
- const currentSetResponse = yield tslib.__await(withTrace$3("listRoleAssignments", options || {}, async (updatedOptions) => {
1754
+ const currentSetResponse = yield tslib.__await(tracingClient.withSpan("KeyVaultAccessControlClient.listRoleAssignmentsPage", options || {}, async (updatedOptions) => {
1789
1755
  return this.client.roleAssignments.listForScopeNext(this.vaultUrl, roleScope, continuationState.continuationToken, updatedOptions);
1790
1756
  }));
1791
1757
  continuationState.continuationToken = currentSetResponse.nextLink;
@@ -1857,14 +1823,14 @@ class KeyVaultAccessControlClient {
1857
1823
  return tslib.__asyncGenerator(this, arguments, function* listRoleDefinitionsPage_1() {
1858
1824
  if (!continuationState.continuationToken) {
1859
1825
  const optionsComplete = options || {};
1860
- const currentSetResponse = yield tslib.__await(withTrace$3("listRoleDefinitions", optionsComplete, (updatedOptions) => this.client.roleDefinitions.list(this.vaultUrl, roleScope, updatedOptions)));
1826
+ const currentSetResponse = yield tslib.__await(tracingClient.withSpan("KeyVaultAccessControlClient.listRoleDefinitionsPage", optionsComplete, (updatedOptions) => this.client.roleDefinitions.list(this.vaultUrl, roleScope, updatedOptions)));
1861
1827
  continuationState.continuationToken = currentSetResponse.nextLink;
1862
1828
  if (currentSetResponse.value) {
1863
1829
  yield yield tslib.__await(currentSetResponse.value.map(mappings.roleDefinition.generatedToPublic, this));
1864
1830
  }
1865
1831
  }
1866
1832
  while (continuationState.continuationToken) {
1867
- const currentSetResponse = yield tslib.__await(withTrace$3("listRoleDefinitions", options, (updatedOptions) => this.client.roleDefinitions.listNext(this.vaultUrl, roleScope, continuationState.continuationToken, updatedOptions)));
1833
+ const currentSetResponse = yield tslib.__await(tracingClient.withSpan("KeyVaultAccessControlClient.listRoleDefinitionsPage", options, (updatedOptions) => this.client.roleDefinitions.listNext(this.vaultUrl, roleScope, continuationState.continuationToken, updatedOptions)));
1868
1834
  continuationState.continuationToken = currentSetResponse.nextLink;
1869
1835
  if (currentSetResponse.value) {
1870
1836
  yield yield tslib.__await(currentSetResponse.value.map(mappings.roleDefinition.generatedToPublic, this));
@@ -1938,7 +1904,7 @@ class KeyVaultAccessControlClient {
1938
1904
  * @param options - The optional parameters.
1939
1905
  */
1940
1906
  getRoleDefinition(roleScope, name, options = {}) {
1941
- return withTrace$3("getRoleDefinition", options, async (updatedOptions) => {
1907
+ return tracingClient.withSpan("KeyVaultAccessControlClient.getRoleDefinition", options, async (updatedOptions) => {
1942
1908
  const response = await this.client.roleDefinitions.get(this.vaultUrl, roleScope, name, updatedOptions);
1943
1909
  return mappings.roleDefinition.generatedToPublic(response);
1944
1910
  });
@@ -1958,7 +1924,7 @@ class KeyVaultAccessControlClient {
1958
1924
  * @param options - The optional parameters.
1959
1925
  */
1960
1926
  setRoleDefinition(roleScope, options = {}) {
1961
- return withTrace$3("setRoleDefinition", options, async (updatedOptions) => {
1927
+ return tracingClient.withSpan("KeyVaultAccessControlClient.setRoleDefinition", options, async (updatedOptions) => {
1962
1928
  const response = await this.client.roleDefinitions.createOrUpdate(this.vaultUrl, roleScope, options.roleDefinitionName || uuid.v4(), {
1963
1929
  properties: {
1964
1930
  description: options.description,
@@ -1985,7 +1951,7 @@ class KeyVaultAccessControlClient {
1985
1951
  * @param options - The optional parameters.
1986
1952
  */
1987
1953
  deleteRoleDefinition(roleScope, name, options = {}) {
1988
- return withTrace$3("deleteRoleDefinition", options, async (updatedOptions) => {
1954
+ return tracingClient.withSpan("KeyVaultAccessControlClient.deleteRoleDefinition", options, async (updatedOptions) => {
1989
1955
  await this.client.roleDefinitions.delete(this.vaultUrl, roleScope, name, updatedOptions);
1990
1956
  });
1991
1957
  }
@@ -2171,10 +2137,6 @@ class KeyVaultAdminPollOperation {
2171
2137
  }
2172
2138
 
2173
2139
  // Copyright (c) Microsoft Corporation.
2174
- /**
2175
- * @internal
2176
- */
2177
- const withTrace$2 = createTraceFunction("Azure.KeyVault.Admin.KeyVaultBackupPoller");
2178
2140
  /**
2179
2141
  * The backup Key Vault's poll operation.
2180
2142
  */
@@ -2190,13 +2152,13 @@ class KeyVaultBackupPollOperation extends KeyVaultAdminPollOperation {
2190
2152
  * Tracing the fullBackup operation
2191
2153
  */
2192
2154
  fullBackup(options) {
2193
- return withTrace$2("fullBackup", options, (updatedOptions) => this.client.fullBackup(this.vaultUrl, updatedOptions));
2155
+ return tracingClient.withSpan("KeyVaultBackupPoller.fullBackup", options, (updatedOptions) => this.client.fullBackup(this.vaultUrl, updatedOptions));
2194
2156
  }
2195
2157
  /**
2196
2158
  * Tracing the fullBackupStatus operation
2197
2159
  */
2198
2160
  fullBackupStatus(jobId, options) {
2199
- return withTrace$2("fullBackupStatus", options, (updatedOptions) => this.client.fullBackupStatus(this.vaultUrl, jobId, updatedOptions));
2161
+ return tracingClient.withSpan("KeyVaultBackupPoller.fullBackupStatus", options, (updatedOptions) => this.client.fullBackupStatus(this.vaultUrl, jobId, updatedOptions));
2200
2162
  }
2201
2163
  /**
2202
2164
  * Reaches to the service and updates the backup's poll operation.
@@ -2268,10 +2230,6 @@ class KeyVaultBackupPoller extends KeyVaultAdminPoller {
2268
2230
  }
2269
2231
 
2270
2232
  // Copyright (c) Microsoft Corporation.
2271
- /**
2272
- * @internal
2273
- */
2274
- const withTrace$1 = createTraceFunction("Azure.KeyVault.Admin.KeyVaultRestorePoller");
2275
2233
  /**
2276
2234
  * An interface representing a restore Key Vault's poll operation.
2277
2235
  */
@@ -2289,13 +2247,13 @@ class KeyVaultRestorePollOperation extends KeyVaultAdminPollOperation {
2289
2247
  * Tracing the fullRestore operation
2290
2248
  */
2291
2249
  fullRestore(options) {
2292
- return withTrace$1("fullRestore", options, (updatedOptions) => this.client.fullRestoreOperation(this.vaultUrl, updatedOptions));
2250
+ return tracingClient.withSpan("KeyVaultRestorePoller.fullRestore", options, (updatedOptions) => this.client.fullRestoreOperation(this.vaultUrl, updatedOptions));
2293
2251
  }
2294
2252
  /**
2295
2253
  * Tracing the restoreStatus operation.
2296
2254
  */
2297
2255
  async restoreStatus(jobId, options) {
2298
- return withTrace$1("restoreStatus", options, (updatedOptions) => this.client.restoreStatus(this.vaultUrl, jobId, updatedOptions));
2256
+ return tracingClient.withSpan("KeyVaultRestorePoller.restoreStatus", options, (updatedOptions) => this.client.restoreStatus(this.vaultUrl, jobId, updatedOptions));
2299
2257
  }
2300
2258
  /**
2301
2259
  * Reaches to the service and updates the restore poll operation.
@@ -2370,10 +2328,6 @@ class KeyVaultRestorePoller extends KeyVaultAdminPoller {
2370
2328
  }
2371
2329
 
2372
2330
  // Copyright (c) Microsoft Corporation.
2373
- /**
2374
- * @internal
2375
- */
2376
- const withTrace = createTraceFunction("Azure.KeyVault.Admin.KeyVaultSelectiveKeyRestorePoller");
2377
2331
  /**
2378
2332
  * The selective restore Key Vault's poll operation.
2379
2333
  */
@@ -2389,13 +2343,13 @@ class KeyVaultSelectiveKeyRestorePollOperation extends KeyVaultAdminPollOperatio
2389
2343
  * Tracing the selectiveRestore operation
2390
2344
  */
2391
2345
  selectiveRestore(keyName, options) {
2392
- return withTrace("selectiveRestore", options, (updatedOptions) => this.client.selectiveKeyRestoreOperation(this.vaultUrl, keyName, updatedOptions));
2346
+ return tracingClient.withSpan("KeyVaultSelectiveKeyRestorePoller.selectiveRestore", options, (updatedOptions) => this.client.selectiveKeyRestoreOperation(this.vaultUrl, keyName, updatedOptions));
2393
2347
  }
2394
2348
  /**
2395
2349
  * Tracing the restoreStatus operation.
2396
2350
  */
2397
2351
  restoreStatus(jobId, options) {
2398
- return withTrace("restoreStatus", options, (updatedOptions) => this.client.restoreStatus(this.vaultUrl, jobId, updatedOptions));
2352
+ return tracingClient.withSpan("KeyVaultSelectiveKeyRestorePoller.restoreStatus", options, (updatedOptions) => this.client.restoreStatus(this.vaultUrl, jobId, updatedOptions));
2399
2353
  }
2400
2354
  /**
2401
2355
  * Reaches to the service and updates the selective restore poll operation.