@azure/keyvault-secrets 4.4.0 → 4.5.0-alpha.20220401.2

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,5 +1,15 @@
1
1
  # Release History
2
2
 
3
+ ## 4.5.0-beta.1 (Unreleased)
4
+
5
+ ### Features Added
6
+
7
+ ### Breaking Changes
8
+
9
+ ### Bugs Fixed
10
+
11
+ ### Other Changes
12
+
3
13
  ## 4.4.0 (2022-03-24)
4
14
 
5
15
  ### Other Changes
package/dist/index.js CHANGED
@@ -621,7 +621,7 @@ const nextLink = {
621
621
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
622
622
  */
623
623
  const packageName = "@azure/keyvault-secrets";
624
- const packageVersion = "4.4.0";
624
+ const packageVersion = "4.5.0-beta.1";
625
625
  /** @internal */
626
626
  class KeyVaultClientContext extends coreHttp__namespace.ServiceClient {
627
627
  /**
@@ -1175,7 +1175,7 @@ const getDeletedSecretsNextOperationSpec = {
1175
1175
 
1176
1176
  // Copyright (c) Microsoft Corporation.
1177
1177
  // Licensed under the MIT license.
1178
- const SDK_VERSION = "4.4.0";
1178
+ const SDK_VERSION = "4.5.0-beta.1";
1179
1179
 
1180
1180
  // Copyright (c) Microsoft Corporation.
1181
1181
  // Licensed under the MIT license.
@@ -1425,46 +1425,6 @@ function parseKeyvaultIdentifier(collection, identifier) {
1425
1425
  };
1426
1426
  }
1427
1427
 
1428
- // Copyright (c) Microsoft Corporation.
1429
- /**
1430
- * Returns a function that can be used for tracing options.
1431
- *
1432
- * @param prefix - The prefix to use, likely the name of the class / client.
1433
- *
1434
- * @example const withTrace = createTraceFunction("Azure.KeyVault.Certificates.CertificateClient")
1435
- *
1436
- * @internal
1437
- */
1438
- function createTraceFunction(prefix) {
1439
- const createSpan = coreTracing.createSpanFunction({
1440
- namespace: "Microsoft.KeyVault",
1441
- packagePrefix: prefix,
1442
- });
1443
- return async function (operationName, options, cb) {
1444
- const { updatedOptions, span } = createSpan(operationName, options);
1445
- try {
1446
- // NOTE: we really do need to await on this function here so we can handle any exceptions thrown and properly
1447
- // close the span.
1448
- const result = await cb(updatedOptions, span);
1449
- // otel 0.16+ needs this or else the code ends up being set as UNSET
1450
- span.setStatus({
1451
- code: coreTracing.SpanStatusCode.OK,
1452
- });
1453
- return result;
1454
- }
1455
- catch (err) {
1456
- span.setStatus({
1457
- code: coreTracing.SpanStatusCode.ERROR,
1458
- message: err.message,
1459
- });
1460
- throw err;
1461
- }
1462
- finally {
1463
- span.end();
1464
- }
1465
- };
1466
- }
1467
-
1468
1428
  // Copyright (c) Microsoft Corporation.
1469
1429
  /**
1470
1430
  * Common properties and methods of the Key Vault Secret Pollers.
@@ -1600,11 +1560,13 @@ function getSecretFromSecretBundle(bundle) {
1600
1560
  return resultObject;
1601
1561
  }
1602
1562
 
1563
+ const tracingClient = coreTracing.createTracingClient({
1564
+ namespace: "Microsoft.KeyVault",
1565
+ packageName: "@azure/keyvault-secrets",
1566
+ packageVersion: SDK_VERSION,
1567
+ });
1568
+
1603
1569
  // Copyright (c) Microsoft Corporation.
1604
- /**
1605
- * @internal
1606
- */
1607
- const withTrace$2 = createTraceFunction("Azure.KeyVault.Secrets.DeleteSecretPoller");
1608
1570
  /**
1609
1571
  * An interface representing a delete secret's poll operation
1610
1572
  */
@@ -1621,7 +1583,7 @@ class DeleteSecretPollOperation extends KeyVaultSecretPollOperation {
1621
1583
  * Since the Key Vault Key won't be immediately deleted, we have {@link beginDeleteKey}.
1622
1584
  */
1623
1585
  deleteSecret(name, options = {}) {
1624
- return withTrace$2("deleteSecret", options, async (updatedOptions) => {
1586
+ return tracingClient.withSpan("DeleteSecretPoller.deleteSecret", options, async (updatedOptions) => {
1625
1587
  const response = await this.client.deleteSecret(this.vaultUrl, name, updatedOptions);
1626
1588
  return getSecretFromSecretBundle(response);
1627
1589
  });
@@ -1631,7 +1593,7 @@ class DeleteSecretPollOperation extends KeyVaultSecretPollOperation {
1631
1593
  * This operation requires the secrets/get permission.
1632
1594
  */
1633
1595
  getDeletedSecret(name, options = {}) {
1634
- return withTrace$2("getDeletedSecret", options, async (updatedOptions) => {
1596
+ return tracingClient.withSpan("DeleteSecretPoller.getDeletedSecret", options, async (updatedOptions) => {
1635
1597
  const response = await this.client.getDeletedSecret(this.vaultUrl, name, updatedOptions);
1636
1598
  return getSecretFromSecretBundle(response);
1637
1599
  });
@@ -1692,10 +1654,6 @@ class DeleteSecretPoller extends KeyVaultSecretPoller {
1692
1654
  }
1693
1655
 
1694
1656
  // Copyright (c) Microsoft Corporation.
1695
- /**
1696
- * @internal
1697
- */
1698
- const withTrace$1 = createTraceFunction("Azure.KeyVault.Secrets.RecoverDeletedSecretPoller");
1699
1657
  /**
1700
1658
  * An interface representing a delete secret's poll operation
1701
1659
  */
@@ -1712,7 +1670,7 @@ class RecoverDeletedSecretPollOperation extends KeyVaultSecretPollOperation {
1712
1670
  * This operation requires the secrets/get permission.
1713
1671
  */
1714
1672
  getSecret(name, options = {}) {
1715
- return withTrace$1("getSecret", options, async (updatedOptions) => {
1673
+ return tracingClient.withSpan("RecoverDeletedSecretPoller.getSecret", options, async (updatedOptions) => {
1716
1674
  const response = await this.client.getSecret(this.vaultUrl, name, options && options.version ? options.version : "", updatedOptions);
1717
1675
  return getSecretFromSecretBundle(response);
1718
1676
  });
@@ -1722,7 +1680,7 @@ class RecoverDeletedSecretPollOperation extends KeyVaultSecretPollOperation {
1722
1680
  * This operation requires the secrets/recover permission.
1723
1681
  */
1724
1682
  recoverDeletedSecret(name, options = {}) {
1725
- return withTrace$1("recoverDeletedSecret", options, async (updatedOptions) => {
1683
+ return tracingClient.withSpan("RecoverDeletedSecretPoller.recoverDeletedSecret", options, async (updatedOptions) => {
1726
1684
  const response = await this.client.recoverDeletedSecret(this.vaultUrl, name, updatedOptions);
1727
1685
  return getSecretFromSecretBundle(response);
1728
1686
  });
@@ -1795,7 +1753,6 @@ class RecoverDeletedSecretPoller extends KeyVaultSecretPoller {
1795
1753
  const LATEST_API_VERSION = "7.3";
1796
1754
 
1797
1755
  // Copyright (c) Microsoft Corporation.
1798
- const withTrace = createTraceFunction("Azure.KeyVault.Secrets.SecretClient");
1799
1756
  /**
1800
1757
  * The SecretClient provides methods to manage {@link KeyVaultSecret} in
1801
1758
  * the Azure Key Vault. The client supports creating, retrieving, updating,
@@ -1869,7 +1826,7 @@ class SecretClient {
1869
1826
  expires,
1870
1827
  } });
1871
1828
  }
1872
- return withTrace("setSecret", unflattenedOptions, async (updatedOptions) => {
1829
+ return tracingClient.withSpan("SecretClient.setSecret", unflattenedOptions, async (updatedOptions) => {
1873
1830
  const response = await this.client.setSecret(this.vaultUrl, secretName, value, updatedOptions);
1874
1831
  return getSecretFromSecretBundle(response);
1875
1832
  });
@@ -1934,7 +1891,7 @@ class SecretClient {
1934
1891
  expires,
1935
1892
  } });
1936
1893
  }
1937
- return withTrace("updateSecretProperties", unflattenedOptions, async (updatedOptions) => {
1894
+ return tracingClient.withSpan("SecretClient.updateSecretProperties", unflattenedOptions, async (updatedOptions) => {
1938
1895
  const response = await this.client.updateSecret(this.vaultUrl, secretName, secretVersion, updatedOptions);
1939
1896
  return getSecretFromSecretBundle(response).properties;
1940
1897
  });
@@ -1953,7 +1910,7 @@ class SecretClient {
1953
1910
  * @param options - The optional parameters.
1954
1911
  */
1955
1912
  getSecret(secretName, options = {}) {
1956
- return withTrace("getSecret", options, async (updatedOptions) => {
1913
+ return tracingClient.withSpan("SecretClient.getSecret", options, async (updatedOptions) => {
1957
1914
  const response = await this.client.getSecret(this.vaultUrl, secretName, options && options.version ? options.version : "", updatedOptions);
1958
1915
  return getSecretFromSecretBundle(response);
1959
1916
  });
@@ -1972,7 +1929,7 @@ class SecretClient {
1972
1929
  * @param options - The optional parameters.
1973
1930
  */
1974
1931
  getDeletedSecret(secretName, options = {}) {
1975
- return withTrace("getDeletedSecret", options, async (updatedOptions) => {
1932
+ return tracingClient.withSpan("SecretClient.getDeletedSecret", options, async (updatedOptions) => {
1976
1933
  const response = await this.client.getDeletedSecret(this.vaultUrl, secretName, updatedOptions);
1977
1934
  return getSecretFromSecretBundle(response);
1978
1935
  });
@@ -1994,7 +1951,7 @@ class SecretClient {
1994
1951
  * @param options - The optional parameters.
1995
1952
  */
1996
1953
  purgeDeletedSecret(secretName, options = {}) {
1997
- return withTrace("purgeDeletedSecret", options, async (updatedOptions) => {
1954
+ return tracingClient.withSpan("SecretClient.purgeDeletedSecret", options, async (updatedOptions) => {
1998
1955
  await this.client.purgeDeletedSecret(this.vaultUrl, secretName, updatedOptions);
1999
1956
  });
2000
1957
  }
@@ -2048,7 +2005,7 @@ class SecretClient {
2048
2005
  * @param options - The optional parameters.
2049
2006
  */
2050
2007
  backupSecret(secretName, options = {}) {
2051
- return withTrace("backupSecret", options, async (updatedOptions) => {
2008
+ return tracingClient.withSpan("SecretClient.backupSecret", options, async (updatedOptions) => {
2052
2009
  const response = await this.client.backupSecret(this.vaultUrl, secretName, updatedOptions);
2053
2010
  return response.value;
2054
2011
  });
@@ -2069,7 +2026,7 @@ class SecretClient {
2069
2026
  * @param options - The optional parameters.
2070
2027
  */
2071
2028
  restoreSecretBackup(secretBundleBackup, options = {}) {
2072
- return withTrace("restoreSecretBackup", options, async (updatedOptions) => {
2029
+ return tracingClient.withSpan("SecretClient.restoreSecretBackup", options, async (updatedOptions) => {
2073
2030
  const response = await this.client.restoreSecret(this.vaultUrl, secretBundleBackup, updatedOptions);
2074
2031
  return getSecretFromSecretBundle(response).properties;
2075
2032
  });
@@ -2084,14 +2041,14 @@ class SecretClient {
2084
2041
  return tslib.__asyncGenerator(this, arguments, function* listPropertiesOfSecretVersionsPage_1() {
2085
2042
  if (continuationState.continuationToken == null) {
2086
2043
  const optionsComplete = Object.assign({ maxresults: continuationState.maxPageSize }, options);
2087
- const currentSetResponse = yield tslib.__await(withTrace("listPropertiesOfSecretVersions", optionsComplete, (updatedOptions) => this.client.getSecretVersions(this.vaultUrl, secretName, updatedOptions)));
2044
+ const currentSetResponse = yield tslib.__await(tracingClient.withSpan("SecretClient.listPropertiesOfSecretVersionsPage", optionsComplete, (updatedOptions) => this.client.getSecretVersions(this.vaultUrl, secretName, updatedOptions)));
2088
2045
  continuationState.continuationToken = currentSetResponse.nextLink;
2089
2046
  if (currentSetResponse.value) {
2090
2047
  yield yield tslib.__await(currentSetResponse.value.map((bundle) => getSecretFromSecretBundle(bundle).properties));
2091
2048
  }
2092
2049
  }
2093
2050
  while (continuationState.continuationToken) {
2094
- const currentSetResponse = yield tslib.__await(withTrace("listPropertiesOfSecretVersions", options, (updatedOptions) => this.client.getSecretVersions(continuationState.continuationToken, secretName, updatedOptions)));
2051
+ const currentSetResponse = yield tslib.__await(tracingClient.withSpan("SecretClient.listPropertiesOfSecretVersionsPage", options, (updatedOptions) => this.client.getSecretVersions(continuationState.continuationToken, secretName, updatedOptions)));
2095
2052
  continuationState.continuationToken = currentSetResponse.nextLink;
2096
2053
  if (currentSetResponse.value) {
2097
2054
  yield yield tslib.__await(currentSetResponse.value.map((bundle) => getSecretFromSecretBundle(bundle).properties));
@@ -2164,14 +2121,14 @@ class SecretClient {
2164
2121
  return tslib.__asyncGenerator(this, arguments, function* listPropertiesOfSecretsPage_1() {
2165
2122
  if (continuationState.continuationToken == null) {
2166
2123
  const optionsComplete = Object.assign({ maxresults: continuationState.maxPageSize }, options);
2167
- const currentSetResponse = yield tslib.__await(withTrace("listPropertiesOfSecrets", optionsComplete, (updatedOptions) => this.client.getSecrets(this.vaultUrl, updatedOptions)));
2124
+ const currentSetResponse = yield tslib.__await(tracingClient.withSpan("SecretClient.listPropertiesOfSecretsPage", optionsComplete, (updatedOptions) => this.client.getSecrets(this.vaultUrl, updatedOptions)));
2168
2125
  continuationState.continuationToken = currentSetResponse.nextLink;
2169
2126
  if (currentSetResponse.value) {
2170
2127
  yield yield tslib.__await(currentSetResponse.value.map((bundle) => getSecretFromSecretBundle(bundle).properties));
2171
2128
  }
2172
2129
  }
2173
2130
  while (continuationState.continuationToken) {
2174
- const currentSetResponse = yield tslib.__await(withTrace("listPropertiesOfSecrets", options, (updatedOptions) => this.client.getSecrets(continuationState.continuationToken, updatedOptions)));
2131
+ const currentSetResponse = yield tslib.__await(tracingClient.withSpan("SecretClient.listPropertiesOfSecretsPage", options, (updatedOptions) => this.client.getSecrets(continuationState.continuationToken, updatedOptions)));
2175
2132
  continuationState.continuationToken = currentSetResponse.nextLink;
2176
2133
  if (currentSetResponse.value) {
2177
2134
  yield yield tslib.__await(currentSetResponse.value.map((bundle) => getSecretFromSecretBundle(bundle).properties));
@@ -2243,14 +2200,14 @@ class SecretClient {
2243
2200
  return tslib.__asyncGenerator(this, arguments, function* listDeletedSecretsPage_1() {
2244
2201
  if (continuationState.continuationToken == null) {
2245
2202
  const optionsComplete = Object.assign({ maxresults: continuationState.maxPageSize }, options);
2246
- const currentSetResponse = yield tslib.__await(withTrace("listDeletedSecrets", optionsComplete, (updatedOptions) => this.client.getDeletedSecrets(this.vaultUrl, updatedOptions)));
2203
+ const currentSetResponse = yield tslib.__await(tracingClient.withSpan("SecretClient.listDeletedSecretsPage", optionsComplete, (updatedOptions) => this.client.getDeletedSecrets(this.vaultUrl, updatedOptions)));
2247
2204
  continuationState.continuationToken = currentSetResponse.nextLink;
2248
2205
  if (currentSetResponse.value) {
2249
2206
  yield yield tslib.__await(currentSetResponse.value.map((bundle) => getSecretFromSecretBundle(bundle)));
2250
2207
  }
2251
2208
  }
2252
2209
  while (continuationState.continuationToken) {
2253
- const currentSetResponse = yield tslib.__await(withTrace("lisDeletedSecrets", options, (updatedOptions) => this.client.getDeletedSecrets(continuationState.continuationToken, updatedOptions)));
2210
+ const currentSetResponse = yield tslib.__await(tracingClient.withSpan("SecretClient.lisDeletedSecretsPage", options, (updatedOptions) => this.client.getDeletedSecrets(continuationState.continuationToken, updatedOptions)));
2254
2211
  continuationState.continuationToken = currentSetResponse.nextLink;
2255
2212
  if (currentSetResponse.value) {
2256
2213
  yield yield tslib.__await(currentSetResponse.value.map((bundle) => getSecretFromSecretBundle(bundle)));