@azure/keyvault-admin 4.2.0-beta.2 → 4.2.0
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 +7 -1
- package/README.md +3 -0
- package/dist/index.js +218 -209
- package/dist/index.js.map +1 -1
- package/dist-esm/keyvault-admin/src/accessControlClient.js +14 -21
- package/dist-esm/keyvault-admin/src/accessControlClient.js.map +1 -1
- package/dist-esm/keyvault-admin/src/accessControlModels.js +1 -1
- package/dist-esm/keyvault-admin/src/accessControlModels.js.map +1 -1
- package/dist-esm/keyvault-admin/src/backupClient.js +7 -7
- package/dist-esm/keyvault-admin/src/backupClient.js.map +1 -1
- package/dist-esm/keyvault-admin/src/challengeAuthenticationCallbacks.js +5 -5
- package/dist-esm/keyvault-admin/src/challengeAuthenticationCallbacks.js.map +1 -1
- package/dist-esm/keyvault-admin/src/constants.js +2 -2
- package/dist-esm/keyvault-admin/src/constants.js.map +1 -1
- package/dist-esm/keyvault-admin/src/generated/keyVaultClient.js +2 -1
- package/dist-esm/keyvault-admin/src/generated/keyVaultClient.js.map +1 -1
- package/dist-esm/keyvault-admin/src/generated/keyVaultClientContext.js +2 -2
- package/dist-esm/keyvault-admin/src/generated/keyVaultClientContext.js.map +1 -1
- package/dist-esm/keyvault-admin/src/generated/models/index.js +6 -6
- package/dist-esm/keyvault-admin/src/generated/models/index.js.map +1 -1
- package/dist-esm/keyvault-admin/src/generated/operations/roleAssignments.js +1 -1
- package/dist-esm/keyvault-admin/src/generated/operations/roleAssignments.js.map +1 -1
- package/dist-esm/keyvault-admin/src/generated/operations/roleDefinitions.js +1 -1
- package/dist-esm/keyvault-admin/src/generated/operations/roleDefinitions.js.map +1 -1
- package/dist-esm/keyvault-admin/src/lro/backup/operation.js +4 -4
- package/dist-esm/keyvault-admin/src/lro/backup/operation.js.map +1 -1
- package/dist-esm/keyvault-admin/src/lro/backup/poller.js +2 -2
- package/dist-esm/keyvault-admin/src/lro/backup/poller.js.map +1 -1
- package/dist-esm/keyvault-admin/src/lro/keyVaultAdminPoller.js +2 -2
- package/dist-esm/keyvault-admin/src/lro/keyVaultAdminPoller.js.map +1 -1
- package/dist-esm/keyvault-admin/src/lro/restore/operation.js +5 -5
- package/dist-esm/keyvault-admin/src/lro/restore/operation.js.map +1 -1
- package/dist-esm/keyvault-admin/src/lro/restore/poller.js +2 -2
- package/dist-esm/keyvault-admin/src/lro/restore/poller.js.map +1 -1
- package/dist-esm/keyvault-admin/src/lro/selectiveKeyRestore/operation.js +4 -4
- package/dist-esm/keyvault-admin/src/lro/selectiveKeyRestore/operation.js.map +1 -1
- package/dist-esm/keyvault-admin/src/lro/selectiveKeyRestore/poller.js +2 -2
- package/dist-esm/keyvault-admin/src/lro/selectiveKeyRestore/poller.js.map +1 -1
- package/dist-esm/keyvault-admin/src/mappings.js +7 -7
- package/dist-esm/keyvault-admin/src/mappings.js.map +1 -1
- package/dist-esm/keyvault-admin/src/tracingHelpers.js +4 -4
- package/dist-esm/keyvault-admin/src/tracingHelpers.js.map +1 -1
- package/dist-esm/keyvault-common/src/challengeBasedAuthenticationPolicy.js +4 -4
- package/dist-esm/keyvault-common/src/challengeBasedAuthenticationPolicy.js.map +1 -1
- package/dist-esm/keyvault-common/src/parseKeyvaultIdentifier.js +1 -1
- package/dist-esm/keyvault-common/src/parseKeyvaultIdentifier.js.map +1 -1
- package/dist-esm/keyvault-common/src/parseWWWAuthenticate.js +1 -1
- package/dist-esm/keyvault-common/src/parseWWWAuthenticate.js.map +1 -1
- package/dist-esm/keyvault-common/src/tracingHelpers.js +4 -4
- package/dist-esm/keyvault-common/src/tracingHelpers.js.map +1 -1
- package/package.json +11 -27
- package/types/keyvault-admin.d.ts +36 -11
package/dist/index.js
CHANGED
|
@@ -1,63 +1,49 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License. See License.txt in the project root for
|
|
4
|
-
* license information.
|
|
5
|
-
*
|
|
6
|
-
* Azure KeyVault Admin SDK for JavaScript - 4.2.0-beta.2
|
|
7
|
-
*/
|
|
8
1
|
'use strict';
|
|
9
2
|
|
|
10
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
4
|
|
|
12
5
|
var tslib = require('tslib');
|
|
13
|
-
var coreTracing = require('@azure/core-tracing');
|
|
14
6
|
var coreClient = require('@azure/core-client');
|
|
7
|
+
var coreRestPipeline = require('@azure/core-rest-pipeline');
|
|
8
|
+
var coreTracing = require('@azure/core-tracing');
|
|
15
9
|
var logger$1 = require('@azure/logger');
|
|
16
10
|
var uuid = require('uuid');
|
|
17
|
-
var coreRestPipeline = require('@azure/core-rest-pipeline');
|
|
18
|
-
require('@azure/core-http');
|
|
19
|
-
require('url');
|
|
20
11
|
var coreLro = require('@azure/core-lro');
|
|
21
12
|
|
|
13
|
+
function _interopNamespace(e) {
|
|
14
|
+
if (e && e.__esModule) return e;
|
|
15
|
+
var n = Object.create(null);
|
|
16
|
+
if (e) {
|
|
17
|
+
Object.keys(e).forEach(function (k) {
|
|
18
|
+
if (k !== 'default') {
|
|
19
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
20
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return e[k]; }
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
n["default"] = e;
|
|
28
|
+
return Object.freeze(n);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
var coreClient__namespace = /*#__PURE__*/_interopNamespace(coreClient);
|
|
32
|
+
|
|
22
33
|
// Copyright (c) Microsoft Corporation.
|
|
34
|
+
// Licensed under the MIT license.
|
|
23
35
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* @param prefix - The prefix to use, likely the name of the class / client.
|
|
27
|
-
*
|
|
28
|
-
* @example const withTrace = createTraceFunction("Azure.KeyVault.Certificates.CertificateClient")
|
|
29
|
-
*
|
|
30
|
-
* @internal
|
|
36
|
+
* Current version of the Key Vault Admin SDK.
|
|
31
37
|
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
// close the span.
|
|
42
|
-
const result = await cb(updatedOptions, span);
|
|
43
|
-
// otel 0.16+ needs this or else the code ends up being set as UNSET
|
|
44
|
-
span.setStatus({
|
|
45
|
-
code: coreTracing.SpanStatusCode.OK
|
|
46
|
-
});
|
|
47
|
-
return result;
|
|
48
|
-
}
|
|
49
|
-
catch (err) {
|
|
50
|
-
span.setStatus({
|
|
51
|
-
code: coreTracing.SpanStatusCode.ERROR,
|
|
52
|
-
message: err.message
|
|
53
|
-
});
|
|
54
|
-
throw err;
|
|
55
|
-
}
|
|
56
|
-
finally {
|
|
57
|
-
span.end();
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
}
|
|
38
|
+
const SDK_VERSION = "4.2.0";
|
|
39
|
+
/**
|
|
40
|
+
* The latest supported Key Vault service API version.
|
|
41
|
+
*/
|
|
42
|
+
const LATEST_API_VERSION = "7.3";
|
|
43
|
+
/**
|
|
44
|
+
* Authentication scopes
|
|
45
|
+
*/
|
|
46
|
+
const authenticationScopes = ["https://managedhsm.azure.net/.default"];
|
|
61
47
|
|
|
62
48
|
/*
|
|
63
49
|
* Copyright (c) Microsoft Corporation.
|
|
@@ -922,7 +908,7 @@ const keyName = {
|
|
|
922
908
|
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
923
909
|
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
924
910
|
*/
|
|
925
|
-
/** Class
|
|
911
|
+
/** Class containing RoleDefinitions operations. */
|
|
926
912
|
class RoleDefinitionsImpl {
|
|
927
913
|
/**
|
|
928
914
|
* Initialize a new instance of the class RoleDefinitions class.
|
|
@@ -939,7 +925,7 @@ class RoleDefinitionsImpl {
|
|
|
939
925
|
* @param options The options parameters.
|
|
940
926
|
*/
|
|
941
927
|
delete(vaultBaseUrl, scope, roleDefinitionName, options) {
|
|
942
|
-
return this.client.sendOperationRequest({ vaultBaseUrl, scope, roleDefinitionName, options }, deleteOperationSpec);
|
|
928
|
+
return this.client.sendOperationRequest({ vaultBaseUrl, scope, roleDefinitionName, options }, deleteOperationSpec$1);
|
|
943
929
|
}
|
|
944
930
|
/**
|
|
945
931
|
* Creates or updates a custom role definition.
|
|
@@ -961,7 +947,7 @@ class RoleDefinitionsImpl {
|
|
|
961
947
|
* @param options The options parameters.
|
|
962
948
|
*/
|
|
963
949
|
get(vaultBaseUrl, scope, roleDefinitionName, options) {
|
|
964
|
-
return this.client.sendOperationRequest({ vaultBaseUrl, scope, roleDefinitionName, options }, getOperationSpec);
|
|
950
|
+
return this.client.sendOperationRequest({ vaultBaseUrl, scope, roleDefinitionName, options }, getOperationSpec$1);
|
|
965
951
|
}
|
|
966
952
|
/**
|
|
967
953
|
* Get all role definitions that are applicable at scope and above.
|
|
@@ -984,8 +970,8 @@ class RoleDefinitionsImpl {
|
|
|
984
970
|
}
|
|
985
971
|
}
|
|
986
972
|
// Operation Specifications
|
|
987
|
-
const serializer =
|
|
988
|
-
const deleteOperationSpec = {
|
|
973
|
+
const serializer$2 = coreClient__namespace.createSerializer(Mappers, /* isXml */ false);
|
|
974
|
+
const deleteOperationSpec$1 = {
|
|
989
975
|
path: "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}",
|
|
990
976
|
httpMethod: "DELETE",
|
|
991
977
|
responses: {
|
|
@@ -1002,7 +988,7 @@ const deleteOperationSpec = {
|
|
|
1002
988
|
roleDefinitionName
|
|
1003
989
|
],
|
|
1004
990
|
headerParameters: [accept],
|
|
1005
|
-
serializer
|
|
991
|
+
serializer: serializer$2
|
|
1006
992
|
};
|
|
1007
993
|
const createOrUpdateOperationSpec = {
|
|
1008
994
|
path: "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}",
|
|
@@ -1024,9 +1010,9 @@ const createOrUpdateOperationSpec = {
|
|
|
1024
1010
|
],
|
|
1025
1011
|
headerParameters: [accept, contentType],
|
|
1026
1012
|
mediaType: "json",
|
|
1027
|
-
serializer
|
|
1013
|
+
serializer: serializer$2
|
|
1028
1014
|
};
|
|
1029
|
-
const getOperationSpec = {
|
|
1015
|
+
const getOperationSpec$1 = {
|
|
1030
1016
|
path: "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionName}",
|
|
1031
1017
|
httpMethod: "GET",
|
|
1032
1018
|
responses: {
|
|
@@ -1044,7 +1030,7 @@ const getOperationSpec = {
|
|
|
1044
1030
|
roleDefinitionName
|
|
1045
1031
|
],
|
|
1046
1032
|
headerParameters: [accept],
|
|
1047
|
-
serializer
|
|
1033
|
+
serializer: serializer$2
|
|
1048
1034
|
};
|
|
1049
1035
|
const listOperationSpec = {
|
|
1050
1036
|
path: "/{scope}/providers/Microsoft.Authorization/roleDefinitions",
|
|
@@ -1060,7 +1046,7 @@ const listOperationSpec = {
|
|
|
1060
1046
|
queryParameters: [apiVersion, filter],
|
|
1061
1047
|
urlParameters: [vaultBaseUrl, scope],
|
|
1062
1048
|
headerParameters: [accept],
|
|
1063
|
-
serializer
|
|
1049
|
+
serializer: serializer$2
|
|
1064
1050
|
};
|
|
1065
1051
|
const listNextOperationSpec = {
|
|
1066
1052
|
path: "{nextLink}",
|
|
@@ -1080,7 +1066,7 @@ const listNextOperationSpec = {
|
|
|
1080
1066
|
nextLink
|
|
1081
1067
|
],
|
|
1082
1068
|
headerParameters: [accept],
|
|
1083
|
-
serializer
|
|
1069
|
+
serializer: serializer$2
|
|
1084
1070
|
};
|
|
1085
1071
|
|
|
1086
1072
|
/*
|
|
@@ -1090,7 +1076,7 @@ const listNextOperationSpec = {
|
|
|
1090
1076
|
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
1091
1077
|
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
1092
1078
|
*/
|
|
1093
|
-
/** Class
|
|
1079
|
+
/** Class containing RoleAssignments operations. */
|
|
1094
1080
|
class RoleAssignmentsImpl {
|
|
1095
1081
|
/**
|
|
1096
1082
|
* Initialize a new instance of the class RoleAssignments class.
|
|
@@ -1107,7 +1093,7 @@ class RoleAssignmentsImpl {
|
|
|
1107
1093
|
* @param options The options parameters.
|
|
1108
1094
|
*/
|
|
1109
1095
|
delete(vaultBaseUrl, scope, roleAssignmentName, options) {
|
|
1110
|
-
return this.client.sendOperationRequest({ vaultBaseUrl, scope, roleAssignmentName, options }, deleteOperationSpec
|
|
1096
|
+
return this.client.sendOperationRequest({ vaultBaseUrl, scope, roleAssignmentName, options }, deleteOperationSpec);
|
|
1111
1097
|
}
|
|
1112
1098
|
/**
|
|
1113
1099
|
* Creates a role assignment.
|
|
@@ -1128,7 +1114,7 @@ class RoleAssignmentsImpl {
|
|
|
1128
1114
|
* @param options The options parameters.
|
|
1129
1115
|
*/
|
|
1130
1116
|
get(vaultBaseUrl, scope, roleAssignmentName, options) {
|
|
1131
|
-
return this.client.sendOperationRequest({ vaultBaseUrl, scope, roleAssignmentName, options }, getOperationSpec
|
|
1117
|
+
return this.client.sendOperationRequest({ vaultBaseUrl, scope, roleAssignmentName, options }, getOperationSpec);
|
|
1132
1118
|
}
|
|
1133
1119
|
/**
|
|
1134
1120
|
* Gets role assignments for a scope.
|
|
@@ -1151,8 +1137,8 @@ class RoleAssignmentsImpl {
|
|
|
1151
1137
|
}
|
|
1152
1138
|
}
|
|
1153
1139
|
// Operation Specifications
|
|
1154
|
-
const serializer$1 =
|
|
1155
|
-
const deleteOperationSpec
|
|
1140
|
+
const serializer$1 = coreClient__namespace.createSerializer(Mappers, /* isXml */ false);
|
|
1141
|
+
const deleteOperationSpec = {
|
|
1156
1142
|
path: "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}",
|
|
1157
1143
|
httpMethod: "DELETE",
|
|
1158
1144
|
responses: {
|
|
@@ -1193,7 +1179,7 @@ const createOperationSpec = {
|
|
|
1193
1179
|
mediaType: "json",
|
|
1194
1180
|
serializer: serializer$1
|
|
1195
1181
|
};
|
|
1196
|
-
const getOperationSpec
|
|
1182
|
+
const getOperationSpec = {
|
|
1197
1183
|
path: "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}",
|
|
1198
1184
|
httpMethod: "GET",
|
|
1199
1185
|
responses: {
|
|
@@ -1257,7 +1243,7 @@ const listForScopeNextOperationSpec = {
|
|
|
1257
1243
|
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
1258
1244
|
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
1259
1245
|
*/
|
|
1260
|
-
class KeyVaultClientContext extends
|
|
1246
|
+
class KeyVaultClientContext extends coreClient__namespace.ServiceClient {
|
|
1261
1247
|
/**
|
|
1262
1248
|
* Initializes a new instance of the KeyVaultClientContext class.
|
|
1263
1249
|
* @param apiVersion Api Version
|
|
@@ -1274,7 +1260,7 @@ class KeyVaultClientContext extends coreClient.ServiceClient {
|
|
|
1274
1260
|
const defaults = {
|
|
1275
1261
|
requestContentType: "application/json; charset=utf-8"
|
|
1276
1262
|
};
|
|
1277
|
-
const packageDetails = `azsdk-js-keyvault-admin/4.2.0
|
|
1263
|
+
const packageDetails = `azsdk-js-keyvault-admin/4.2.0`;
|
|
1278
1264
|
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
1279
1265
|
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
1280
1266
|
: `${packageDetails}`;
|
|
@@ -1306,7 +1292,8 @@ class KeyVaultClient extends KeyVaultClientContext {
|
|
|
1306
1292
|
this.roleAssignments = new RoleAssignmentsImpl(this);
|
|
1307
1293
|
}
|
|
1308
1294
|
/**
|
|
1309
|
-
* Creates a full backup using a user-provided SAS token to an Azure blob storage container.
|
|
1295
|
+
* Creates a full backup using a user-provided SAS token to an Azure blob storage container. This
|
|
1296
|
+
* operation is supported only by the Managed HSM service.
|
|
1310
1297
|
* @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
|
|
1311
1298
|
* @param options The options parameters.
|
|
1312
1299
|
*/
|
|
@@ -1352,7 +1339,7 @@ class KeyVaultClient extends KeyVaultClientContext {
|
|
|
1352
1339
|
}
|
|
1353
1340
|
}
|
|
1354
1341
|
// Operation Specifications
|
|
1355
|
-
const serializer
|
|
1342
|
+
const serializer = coreClient__namespace.createSerializer(Mappers, /* isXml */ false);
|
|
1356
1343
|
const fullBackupOperationSpec = {
|
|
1357
1344
|
path: "/backup",
|
|
1358
1345
|
httpMethod: "POST",
|
|
@@ -1370,7 +1357,7 @@ const fullBackupOperationSpec = {
|
|
|
1370
1357
|
urlParameters: [vaultBaseUrl],
|
|
1371
1358
|
headerParameters: [accept, contentType],
|
|
1372
1359
|
mediaType: "json",
|
|
1373
|
-
serializer
|
|
1360
|
+
serializer
|
|
1374
1361
|
};
|
|
1375
1362
|
const fullBackupStatusOperationSpec = {
|
|
1376
1363
|
path: "/backup/{jobId}/pending",
|
|
@@ -1386,7 +1373,7 @@ const fullBackupStatusOperationSpec = {
|
|
|
1386
1373
|
queryParameters: [apiVersion],
|
|
1387
1374
|
urlParameters: [vaultBaseUrl, jobId],
|
|
1388
1375
|
headerParameters: [accept],
|
|
1389
|
-
serializer
|
|
1376
|
+
serializer
|
|
1390
1377
|
};
|
|
1391
1378
|
const fullRestoreOperationOperationSpec = {
|
|
1392
1379
|
path: "/restore",
|
|
@@ -1405,7 +1392,7 @@ const fullRestoreOperationOperationSpec = {
|
|
|
1405
1392
|
urlParameters: [vaultBaseUrl],
|
|
1406
1393
|
headerParameters: [accept, contentType],
|
|
1407
1394
|
mediaType: "json",
|
|
1408
|
-
serializer
|
|
1395
|
+
serializer
|
|
1409
1396
|
};
|
|
1410
1397
|
const restoreStatusOperationSpec = {
|
|
1411
1398
|
path: "/restore/{jobId}/pending",
|
|
@@ -1421,7 +1408,7 @@ const restoreStatusOperationSpec = {
|
|
|
1421
1408
|
queryParameters: [apiVersion],
|
|
1422
1409
|
urlParameters: [vaultBaseUrl, jobId],
|
|
1423
1410
|
headerParameters: [accept],
|
|
1424
|
-
serializer
|
|
1411
|
+
serializer
|
|
1425
1412
|
};
|
|
1426
1413
|
const selectiveKeyRestoreOperationOperationSpec = {
|
|
1427
1414
|
path: "/keys/{keyName}/restore",
|
|
@@ -1440,78 +1427,9 @@ const selectiveKeyRestoreOperationOperationSpec = {
|
|
|
1440
1427
|
urlParameters: [vaultBaseUrl, keyName],
|
|
1441
1428
|
headerParameters: [accept, contentType],
|
|
1442
1429
|
mediaType: "json",
|
|
1443
|
-
serializer
|
|
1444
|
-
};
|
|
1445
|
-
|
|
1446
|
-
// Copyright (c) Microsoft Corporation.
|
|
1447
|
-
// Licensed under the MIT license.
|
|
1448
|
-
/**
|
|
1449
|
-
* Current version of the Key Vault Admin SDK.
|
|
1450
|
-
*/
|
|
1451
|
-
const SDK_VERSION = "4.2.0-beta.2";
|
|
1452
|
-
/**
|
|
1453
|
-
* The latest supported Key Vault service API version.
|
|
1454
|
-
*/
|
|
1455
|
-
const LATEST_API_VERSION = "7.3-preview";
|
|
1456
|
-
/**
|
|
1457
|
-
* Authentication scopes
|
|
1458
|
-
*/
|
|
1459
|
-
const authenticationScopes = ["https://managedhsm.azure.net/.default"];
|
|
1460
|
-
|
|
1461
|
-
// Copyright (c) Microsoft Corporation.
|
|
1462
|
-
// Licensed under the MIT license.
|
|
1463
|
-
const mappings = {
|
|
1464
|
-
roleAssignment: {
|
|
1465
|
-
generatedToPublic(roleAssignment) {
|
|
1466
|
-
const { id, name, type, properties } = roleAssignment;
|
|
1467
|
-
const { scope, roleDefinitionId, principalId } = properties || {};
|
|
1468
|
-
return {
|
|
1469
|
-
id: id,
|
|
1470
|
-
name: name,
|
|
1471
|
-
kind: type,
|
|
1472
|
-
properties: {
|
|
1473
|
-
scope: scope,
|
|
1474
|
-
roleDefinitionId: roleDefinitionId,
|
|
1475
|
-
principalId: principalId
|
|
1476
|
-
}
|
|
1477
|
-
};
|
|
1478
|
-
}
|
|
1479
|
-
},
|
|
1480
|
-
roleDefinition: {
|
|
1481
|
-
generatedToPublic(roleDefinition) {
|
|
1482
|
-
const { id, name, type, roleName, description, roleType, permissions, assignableScopes } = roleDefinition;
|
|
1483
|
-
return {
|
|
1484
|
-
id: id,
|
|
1485
|
-
name: name,
|
|
1486
|
-
kind: type,
|
|
1487
|
-
roleName: roleName,
|
|
1488
|
-
description: description,
|
|
1489
|
-
roleType: roleType,
|
|
1490
|
-
permissions: permissions,
|
|
1491
|
-
assignableScopes: assignableScopes
|
|
1492
|
-
};
|
|
1493
|
-
}
|
|
1494
|
-
},
|
|
1495
|
-
folderUriParts(folderUri) {
|
|
1496
|
-
const uriParts = folderUri.split("/");
|
|
1497
|
-
const folderName = uriParts.pop();
|
|
1498
|
-
const storageUri = uriParts.join("/");
|
|
1499
|
-
if (!folderName) {
|
|
1500
|
-
throw new Error("The provided folder URI is missing the folder name.");
|
|
1501
|
-
}
|
|
1502
|
-
return {
|
|
1503
|
-
folderName,
|
|
1504
|
-
folderUri: storageUri
|
|
1505
|
-
};
|
|
1506
|
-
}
|
|
1430
|
+
serializer
|
|
1507
1431
|
};
|
|
1508
1432
|
|
|
1509
|
-
// Copyright (c) Microsoft Corporation.
|
|
1510
|
-
/**
|
|
1511
|
-
* The \@azure/logger configuration for this package.
|
|
1512
|
-
*/
|
|
1513
|
-
const logger = logger$1.createClientLogger("keyvault-admin");
|
|
1514
|
-
|
|
1515
1433
|
// Copyright (c) Microsoft Corporation.
|
|
1516
1434
|
// Licensed under the MIT license.
|
|
1517
1435
|
/**
|
|
@@ -1524,7 +1442,7 @@ const validParsedWWWAuthenticateProperties = [
|
|
|
1524
1442
|
"authorization_url",
|
|
1525
1443
|
"resource",
|
|
1526
1444
|
"scope",
|
|
1527
|
-
"tenantId"
|
|
1445
|
+
"tenantId",
|
|
1528
1446
|
];
|
|
1529
1447
|
/**
|
|
1530
1448
|
* Parses an WWW-Authenticate response.
|
|
@@ -1585,9 +1503,9 @@ function createChallengeCallbacks() {
|
|
|
1585
1503
|
return {
|
|
1586
1504
|
abortSignal: request.abortSignal,
|
|
1587
1505
|
requestOptions: {
|
|
1588
|
-
timeout: request.timeout
|
|
1506
|
+
timeout: request.timeout,
|
|
1589
1507
|
},
|
|
1590
|
-
tracingOptions: request.tracingOptions
|
|
1508
|
+
tracingOptions: request.tracingOptions,
|
|
1591
1509
|
};
|
|
1592
1510
|
}
|
|
1593
1511
|
async function authorizeRequest(options) {
|
|
@@ -1597,7 +1515,7 @@ function createChallengeCallbacks() {
|
|
|
1597
1515
|
case "none":
|
|
1598
1516
|
challengeState = {
|
|
1599
1517
|
status: "started",
|
|
1600
|
-
originalBody: request.body
|
|
1518
|
+
originalBody: request.body,
|
|
1601
1519
|
};
|
|
1602
1520
|
request.body = null;
|
|
1603
1521
|
break;
|
|
@@ -1633,18 +1551,112 @@ function createChallengeCallbacks() {
|
|
|
1633
1551
|
}
|
|
1634
1552
|
options.request.headers.set("Authorization", `Bearer ${accessToken.token}`);
|
|
1635
1553
|
challengeState = {
|
|
1636
|
-
status: "complete"
|
|
1554
|
+
status: "complete",
|
|
1637
1555
|
};
|
|
1638
1556
|
return true;
|
|
1639
1557
|
}
|
|
1640
1558
|
return {
|
|
1641
1559
|
authorizeRequest,
|
|
1642
|
-
authorizeRequestOnChallenge
|
|
1560
|
+
authorizeRequestOnChallenge,
|
|
1561
|
+
};
|
|
1562
|
+
}
|
|
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
|
+
}
|
|
1643
1601
|
};
|
|
1644
1602
|
}
|
|
1645
1603
|
|
|
1646
1604
|
// Copyright (c) Microsoft Corporation.
|
|
1647
|
-
|
|
1605
|
+
/**
|
|
1606
|
+
* The \@azure/logger configuration for this package.
|
|
1607
|
+
*/
|
|
1608
|
+
const logger = logger$1.createClientLogger("keyvault-admin");
|
|
1609
|
+
|
|
1610
|
+
// Copyright (c) Microsoft Corporation.
|
|
1611
|
+
// Licensed under the MIT license.
|
|
1612
|
+
const mappings = {
|
|
1613
|
+
roleAssignment: {
|
|
1614
|
+
generatedToPublic(roleAssignment) {
|
|
1615
|
+
const { id, name, type, properties } = roleAssignment;
|
|
1616
|
+
const { scope, roleDefinitionId, principalId } = properties || {};
|
|
1617
|
+
return {
|
|
1618
|
+
id: id,
|
|
1619
|
+
name: name,
|
|
1620
|
+
kind: type,
|
|
1621
|
+
properties: {
|
|
1622
|
+
scope: scope,
|
|
1623
|
+
roleDefinitionId: roleDefinitionId,
|
|
1624
|
+
principalId: principalId,
|
|
1625
|
+
},
|
|
1626
|
+
};
|
|
1627
|
+
},
|
|
1628
|
+
},
|
|
1629
|
+
roleDefinition: {
|
|
1630
|
+
generatedToPublic(roleDefinition) {
|
|
1631
|
+
const { id, name, type, roleName, description, roleType, permissions, assignableScopes } = roleDefinition;
|
|
1632
|
+
return {
|
|
1633
|
+
id: id,
|
|
1634
|
+
name: name,
|
|
1635
|
+
kind: type,
|
|
1636
|
+
roleName: roleName,
|
|
1637
|
+
description: description,
|
|
1638
|
+
roleType: roleType,
|
|
1639
|
+
permissions: permissions,
|
|
1640
|
+
assignableScopes: assignableScopes,
|
|
1641
|
+
};
|
|
1642
|
+
},
|
|
1643
|
+
},
|
|
1644
|
+
folderUriParts(folderUri) {
|
|
1645
|
+
const uriParts = folderUri.split("/");
|
|
1646
|
+
const folderName = uriParts.pop();
|
|
1647
|
+
const storageUri = uriParts.join("/");
|
|
1648
|
+
if (!folderName) {
|
|
1649
|
+
throw new Error("The provided folder URI is missing the folder name.");
|
|
1650
|
+
}
|
|
1651
|
+
return {
|
|
1652
|
+
folderName,
|
|
1653
|
+
folderUri: storageUri,
|
|
1654
|
+
};
|
|
1655
|
+
},
|
|
1656
|
+
};
|
|
1657
|
+
|
|
1658
|
+
// Copyright (c) Microsoft Corporation.
|
|
1659
|
+
const withTrace$3 = createTraceFunction("Azure.KeyVault.Admin.KeyVaultAccessControlClient");
|
|
1648
1660
|
/**
|
|
1649
1661
|
* The KeyVaultAccessControlClient provides methods to manage
|
|
1650
1662
|
* access control and role assignments in any given Azure Key Vault instance.
|
|
@@ -1676,14 +1688,14 @@ class KeyVaultAccessControlClient {
|
|
|
1676
1688
|
additionalAllowedHeaderNames: [
|
|
1677
1689
|
"x-ms-keyvault-region",
|
|
1678
1690
|
"x-ms-keyvault-network-info",
|
|
1679
|
-
"x-ms-keyvault-service-version"
|
|
1680
|
-
]
|
|
1691
|
+
"x-ms-keyvault-service-version",
|
|
1692
|
+
],
|
|
1681
1693
|
} });
|
|
1682
1694
|
this.client = new KeyVaultClient(serviceVersion, clientOptions);
|
|
1683
1695
|
this.client.pipeline.addPolicy(coreRestPipeline.bearerTokenAuthenticationPolicy({
|
|
1684
1696
|
credential,
|
|
1685
1697
|
scopes: authenticationScopes,
|
|
1686
|
-
challengeCallbacks: createChallengeCallbacks()
|
|
1698
|
+
challengeCallbacks: createChallengeCallbacks(),
|
|
1687
1699
|
}));
|
|
1688
1700
|
}
|
|
1689
1701
|
/**
|
|
@@ -1704,12 +1716,12 @@ class KeyVaultAccessControlClient {
|
|
|
1704
1716
|
* @param options - The optional parameters.
|
|
1705
1717
|
*/
|
|
1706
1718
|
createRoleAssignment(roleScope, name, roleDefinitionId, principalId, options = {}) {
|
|
1707
|
-
return withTrace("createRoleAssignment", options, async (updatedOptions) => {
|
|
1719
|
+
return withTrace$3("createRoleAssignment", options, async (updatedOptions) => {
|
|
1708
1720
|
const response = await this.client.roleAssignments.create(this.vaultUrl, roleScope, name, {
|
|
1709
1721
|
properties: {
|
|
1710
1722
|
roleDefinitionId,
|
|
1711
|
-
principalId
|
|
1712
|
-
}
|
|
1723
|
+
principalId,
|
|
1724
|
+
},
|
|
1713
1725
|
}, updatedOptions);
|
|
1714
1726
|
return mappings.roleAssignment.generatedToPublic(response);
|
|
1715
1727
|
});
|
|
@@ -1729,7 +1741,7 @@ class KeyVaultAccessControlClient {
|
|
|
1729
1741
|
* @param options - The optional parameters.
|
|
1730
1742
|
*/
|
|
1731
1743
|
deleteRoleAssignment(roleScope, name, options = {}) {
|
|
1732
|
-
return withTrace("deleteRoleAssignment", options, async (updatedOptions) => {
|
|
1744
|
+
return withTrace$3("deleteRoleAssignment", options, async (updatedOptions) => {
|
|
1733
1745
|
await this.client.roleAssignments.delete(this.vaultUrl, roleScope, name, updatedOptions);
|
|
1734
1746
|
});
|
|
1735
1747
|
}
|
|
@@ -1749,13 +1761,12 @@ class KeyVaultAccessControlClient {
|
|
|
1749
1761
|
* @param options - The optional parameters.
|
|
1750
1762
|
*/
|
|
1751
1763
|
getRoleAssignment(roleScope, name, options = {}) {
|
|
1752
|
-
return withTrace("getRoleAssignment", options, async (updatedOptions) => {
|
|
1764
|
+
return withTrace$3("getRoleAssignment", options, async (updatedOptions) => {
|
|
1753
1765
|
const response = await this.client.roleAssignments.get(this.vaultUrl, roleScope, name, updatedOptions);
|
|
1754
1766
|
return mappings.roleAssignment.generatedToPublic(response);
|
|
1755
1767
|
});
|
|
1756
1768
|
}
|
|
1757
1769
|
/**
|
|
1758
|
-
* @internal
|
|
1759
1770
|
* Deals with the pagination of {@link listRoleAssignments}.
|
|
1760
1771
|
* @param roleScope - The scope of the role assignments.
|
|
1761
1772
|
* @param continuationState - An object that indicates the position of the paginated request.
|
|
@@ -1765,7 +1776,7 @@ class KeyVaultAccessControlClient {
|
|
|
1765
1776
|
return tslib.__asyncGenerator(this, arguments, function* listRoleAssignmentsPage_1() {
|
|
1766
1777
|
if (!continuationState.continuationToken) {
|
|
1767
1778
|
const optionsComplete = options || {};
|
|
1768
|
-
const currentSetResponse = yield tslib.__await(withTrace("listRoleAssignments", optionsComplete, async (updatedOptions) => {
|
|
1779
|
+
const currentSetResponse = yield tslib.__await(withTrace$3("listRoleAssignments", optionsComplete, async (updatedOptions) => {
|
|
1769
1780
|
return this.client.roleAssignments.listForScope(this.vaultUrl, roleScope, updatedOptions);
|
|
1770
1781
|
}));
|
|
1771
1782
|
continuationState.continuationToken = currentSetResponse.nextLink;
|
|
@@ -1774,7 +1785,7 @@ class KeyVaultAccessControlClient {
|
|
|
1774
1785
|
}
|
|
1775
1786
|
}
|
|
1776
1787
|
while (continuationState.continuationToken) {
|
|
1777
|
-
const currentSetResponse = yield tslib.__await(withTrace("listRoleAssignments", options || {}, async (updatedOptions) => {
|
|
1788
|
+
const currentSetResponse = yield tslib.__await(withTrace$3("listRoleAssignments", options || {}, async (updatedOptions) => {
|
|
1778
1789
|
return this.client.roleAssignments.listForScopeNext(this.vaultUrl, roleScope, continuationState.continuationToken, updatedOptions);
|
|
1779
1790
|
}));
|
|
1780
1791
|
continuationState.continuationToken = currentSetResponse.nextLink;
|
|
@@ -1788,7 +1799,6 @@ class KeyVaultAccessControlClient {
|
|
|
1788
1799
|
});
|
|
1789
1800
|
}
|
|
1790
1801
|
/**
|
|
1791
|
-
* @internal
|
|
1792
1802
|
* Deals with the iteration of all the available results of {@link listRoleAssignments}.
|
|
1793
1803
|
* @param roleScope - The scope of the role assignments.
|
|
1794
1804
|
* @param options - Common options for the iterative endpoints.
|
|
@@ -1834,11 +1844,10 @@ class KeyVaultAccessControlClient {
|
|
|
1834
1844
|
[Symbol.asyncIterator]() {
|
|
1835
1845
|
return this;
|
|
1836
1846
|
},
|
|
1837
|
-
byPage: (settings = {}) => this.listRoleAssignmentsPage(roleScope, settings, options)
|
|
1847
|
+
byPage: (settings = {}) => this.listRoleAssignmentsPage(roleScope, settings, options),
|
|
1838
1848
|
};
|
|
1839
1849
|
}
|
|
1840
1850
|
/**
|
|
1841
|
-
* @internal
|
|
1842
1851
|
* Deals with the pagination of {@link listRoleDefinitions}.
|
|
1843
1852
|
* @param roleScope - The scope of the role definition.
|
|
1844
1853
|
* @param continuationState - An object that indicates the position of the paginated request.
|
|
@@ -1848,14 +1857,14 @@ class KeyVaultAccessControlClient {
|
|
|
1848
1857
|
return tslib.__asyncGenerator(this, arguments, function* listRoleDefinitionsPage_1() {
|
|
1849
1858
|
if (!continuationState.continuationToken) {
|
|
1850
1859
|
const optionsComplete = options || {};
|
|
1851
|
-
const currentSetResponse = yield tslib.__await(withTrace("listRoleDefinitions", optionsComplete, (updatedOptions) => this.client.roleDefinitions.list(this.vaultUrl, roleScope, updatedOptions)));
|
|
1860
|
+
const currentSetResponse = yield tslib.__await(withTrace$3("listRoleDefinitions", optionsComplete, (updatedOptions) => this.client.roleDefinitions.list(this.vaultUrl, roleScope, updatedOptions)));
|
|
1852
1861
|
continuationState.continuationToken = currentSetResponse.nextLink;
|
|
1853
1862
|
if (currentSetResponse.value) {
|
|
1854
1863
|
yield yield tslib.__await(currentSetResponse.value.map(mappings.roleDefinition.generatedToPublic, this));
|
|
1855
1864
|
}
|
|
1856
1865
|
}
|
|
1857
1866
|
while (continuationState.continuationToken) {
|
|
1858
|
-
const currentSetResponse = yield tslib.__await(withTrace("listRoleDefinitions", options, (updatedOptions) => this.client.roleDefinitions.listNext(this.vaultUrl, roleScope, continuationState.continuationToken, updatedOptions)));
|
|
1867
|
+
const currentSetResponse = yield tslib.__await(withTrace$3("listRoleDefinitions", options, (updatedOptions) => this.client.roleDefinitions.listNext(this.vaultUrl, roleScope, continuationState.continuationToken, updatedOptions)));
|
|
1859
1868
|
continuationState.continuationToken = currentSetResponse.nextLink;
|
|
1860
1869
|
if (currentSetResponse.value) {
|
|
1861
1870
|
yield yield tslib.__await(currentSetResponse.value.map(mappings.roleDefinition.generatedToPublic, this));
|
|
@@ -1867,7 +1876,6 @@ class KeyVaultAccessControlClient {
|
|
|
1867
1876
|
});
|
|
1868
1877
|
}
|
|
1869
1878
|
/**
|
|
1870
|
-
* @internal
|
|
1871
1879
|
* Deals with the iteration of all the available results of {@link listRoleDefinitions}.
|
|
1872
1880
|
* @param roleScope - The scope of the role definition.
|
|
1873
1881
|
* @param options - Common options for the iterative endpoints.
|
|
@@ -1913,7 +1921,7 @@ class KeyVaultAccessControlClient {
|
|
|
1913
1921
|
[Symbol.asyncIterator]() {
|
|
1914
1922
|
return this;
|
|
1915
1923
|
},
|
|
1916
|
-
byPage: (settings = {}) => this.listRoleDefinitionsPage(roleScope, settings, options)
|
|
1924
|
+
byPage: (settings = {}) => this.listRoleDefinitionsPage(roleScope, settings, options),
|
|
1917
1925
|
};
|
|
1918
1926
|
}
|
|
1919
1927
|
/**
|
|
@@ -1930,7 +1938,7 @@ class KeyVaultAccessControlClient {
|
|
|
1930
1938
|
* @param options - The optional parameters.
|
|
1931
1939
|
*/
|
|
1932
1940
|
getRoleDefinition(roleScope, name, options = {}) {
|
|
1933
|
-
return withTrace("getRoleDefinition", options, async (updatedOptions) => {
|
|
1941
|
+
return withTrace$3("getRoleDefinition", options, async (updatedOptions) => {
|
|
1934
1942
|
const response = await this.client.roleDefinitions.get(this.vaultUrl, roleScope, name, updatedOptions);
|
|
1935
1943
|
return mappings.roleDefinition.generatedToPublic(response);
|
|
1936
1944
|
});
|
|
@@ -1947,21 +1955,18 @@ class KeyVaultAccessControlClient {
|
|
|
1947
1955
|
* console.log(roleDefinition);
|
|
1948
1956
|
* ```
|
|
1949
1957
|
* @param roleScope - The scope of the role definition.
|
|
1950
|
-
* @param name - The name of the role definition. Must be a UUID.
|
|
1951
|
-
* @param permissions - The set of {@link KeyVaultPermission} for this role definition.
|
|
1952
|
-
* @param description - The role definition description.
|
|
1953
1958
|
* @param options - The optional parameters.
|
|
1954
1959
|
*/
|
|
1955
1960
|
setRoleDefinition(roleScope, options = {}) {
|
|
1956
|
-
return withTrace("setRoleDefinition", options, async (updatedOptions) => {
|
|
1961
|
+
return withTrace$3("setRoleDefinition", options, async (updatedOptions) => {
|
|
1957
1962
|
const response = await this.client.roleDefinitions.createOrUpdate(this.vaultUrl, roleScope, options.roleDefinitionName || uuid.v4(), {
|
|
1958
1963
|
properties: {
|
|
1959
1964
|
description: options.description,
|
|
1960
1965
|
permissions: options.permissions,
|
|
1961
1966
|
assignableScopes: [roleScope],
|
|
1962
1967
|
roleName: options.roleName,
|
|
1963
|
-
roleType: "CustomRole"
|
|
1964
|
-
}
|
|
1968
|
+
roleType: "CustomRole",
|
|
1969
|
+
},
|
|
1965
1970
|
}, updatedOptions);
|
|
1966
1971
|
return mappings.roleDefinition.generatedToPublic(response);
|
|
1967
1972
|
});
|
|
@@ -1980,7 +1985,7 @@ class KeyVaultAccessControlClient {
|
|
|
1980
1985
|
* @param options - The optional parameters.
|
|
1981
1986
|
*/
|
|
1982
1987
|
deleteRoleDefinition(roleScope, name, options = {}) {
|
|
1983
|
-
return withTrace("deleteRoleDefinition", options, async (updatedOptions) => {
|
|
1988
|
+
return withTrace$3("deleteRoleDefinition", options, async (updatedOptions) => {
|
|
1984
1989
|
await this.client.roleDefinitions.delete(this.vaultUrl, roleScope, name, updatedOptions);
|
|
1985
1990
|
});
|
|
1986
1991
|
}
|
|
@@ -1993,12 +1998,12 @@ class KeyVaultAccessControlClient {
|
|
|
1993
1998
|
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
1994
1999
|
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
1995
2000
|
*/
|
|
1996
|
-
/** Known values of {@link
|
|
1997
|
-
var
|
|
1998
|
-
(function (
|
|
1999
|
-
/** Api Version '7.3
|
|
2000
|
-
|
|
2001
|
-
})(
|
|
2001
|
+
/** Known values of {@link ApiVersion73} that the service accepts. */
|
|
2002
|
+
var KnownApiVersion73;
|
|
2003
|
+
(function (KnownApiVersion73) {
|
|
2004
|
+
/** Api Version '7.3' */
|
|
2005
|
+
KnownApiVersion73["Seven3"] = "7.3";
|
|
2006
|
+
})(KnownApiVersion73 || (KnownApiVersion73 = {}));
|
|
2002
2007
|
/** Known values of {@link RoleType} that the service accepts. */
|
|
2003
2008
|
var KnownRoleType;
|
|
2004
2009
|
(function (KnownRoleType) {
|
|
@@ -2007,6 +2012,8 @@ var KnownRoleType;
|
|
|
2007
2012
|
/** Custom role. */
|
|
2008
2013
|
KnownRoleType["CustomRole"] = "CustomRole";
|
|
2009
2014
|
})(KnownRoleType || (KnownRoleType = {}));
|
|
2015
|
+
/** Known values of {@link DataAction} that the service accepts. */
|
|
2016
|
+
exports.KnownKeyVaultDataAction = void 0;
|
|
2010
2017
|
(function (KnownDataAction) {
|
|
2011
2018
|
/** Read HSM key metadata. */
|
|
2012
2019
|
KnownDataAction["ReadHsmKey"] = "Microsoft.KeyVault/managedHsm/keys/read/action";
|
|
@@ -2077,6 +2084,8 @@ var KnownRoleType;
|
|
|
2077
2084
|
/** Generate random numbers. */
|
|
2078
2085
|
KnownDataAction["RandomNumbersGenerate"] = "Microsoft.KeyVault/managedHsm/rng/action";
|
|
2079
2086
|
})(exports.KnownKeyVaultDataAction || (exports.KnownKeyVaultDataAction = {}));
|
|
2087
|
+
/** Known values of {@link RoleScope} that the service accepts. */
|
|
2088
|
+
exports.KnownKeyVaultRoleScope = void 0;
|
|
2080
2089
|
(function (KnownRoleScope) {
|
|
2081
2090
|
/** Global scope */
|
|
2082
2091
|
KnownRoleScope["Global"] = "/";
|
|
@@ -2104,7 +2113,7 @@ function cleanState(state) {
|
|
|
2104
2113
|
isCancelled: state.isCancelled,
|
|
2105
2114
|
isCompleted: state.isCompleted,
|
|
2106
2115
|
error: state.error,
|
|
2107
|
-
result: state.result
|
|
2116
|
+
result: state.result,
|
|
2108
2117
|
};
|
|
2109
2118
|
}
|
|
2110
2119
|
/**
|
|
@@ -2156,7 +2165,7 @@ class KeyVaultAdminPollOperation {
|
|
|
2156
2165
|
*/
|
|
2157
2166
|
toString() {
|
|
2158
2167
|
return JSON.stringify({
|
|
2159
|
-
state: cleanState(this.state)
|
|
2168
|
+
state: cleanState(this.state),
|
|
2160
2169
|
});
|
|
2161
2170
|
}
|
|
2162
2171
|
}
|
|
@@ -2165,7 +2174,7 @@ class KeyVaultAdminPollOperation {
|
|
|
2165
2174
|
/**
|
|
2166
2175
|
* @internal
|
|
2167
2176
|
*/
|
|
2168
|
-
const withTrace$
|
|
2177
|
+
const withTrace$2 = createTraceFunction("Azure.KeyVault.Admin.KeyVaultBackupPoller");
|
|
2169
2178
|
/**
|
|
2170
2179
|
* The backup Key Vault's poll operation.
|
|
2171
2180
|
*/
|
|
@@ -2181,13 +2190,13 @@ class KeyVaultBackupPollOperation extends KeyVaultAdminPollOperation {
|
|
|
2181
2190
|
* Tracing the fullBackup operation
|
|
2182
2191
|
*/
|
|
2183
2192
|
fullBackup(options) {
|
|
2184
|
-
return withTrace$
|
|
2193
|
+
return withTrace$2("fullBackup", options, (updatedOptions) => this.client.fullBackup(this.vaultUrl, updatedOptions));
|
|
2185
2194
|
}
|
|
2186
2195
|
/**
|
|
2187
2196
|
* Tracing the fullBackupStatus operation
|
|
2188
2197
|
*/
|
|
2189
2198
|
fullBackupStatus(jobId, options) {
|
|
2190
|
-
return withTrace$
|
|
2199
|
+
return withTrace$2("fullBackupStatus", options, (updatedOptions) => this.client.fullBackupStatus(this.vaultUrl, jobId, updatedOptions));
|
|
2191
2200
|
}
|
|
2192
2201
|
/**
|
|
2193
2202
|
* Reaches to the service and updates the backup's poll operation.
|
|
@@ -2201,7 +2210,7 @@ class KeyVaultBackupPollOperation extends KeyVaultAdminPollOperation {
|
|
|
2201
2210
|
if (!state.isStarted) {
|
|
2202
2211
|
const serviceOperation = await this.fullBackup(Object.assign(Object.assign({}, this.requestOptions), { azureStorageBlobContainerUri: {
|
|
2203
2212
|
storageResourceUri: blobStorageUri,
|
|
2204
|
-
token: sasToken
|
|
2213
|
+
token: sasToken,
|
|
2205
2214
|
} }));
|
|
2206
2215
|
this.mapState(serviceOperation);
|
|
2207
2216
|
}
|
|
@@ -2216,7 +2225,7 @@ class KeyVaultBackupPollOperation extends KeyVaultAdminPollOperation {
|
|
|
2216
2225
|
}
|
|
2217
2226
|
mapState(serviceOperation) {
|
|
2218
2227
|
const state = this.state;
|
|
2219
|
-
const { startTime, jobId, azureStorageBlobContainerUri, endTime, error, status, statusDetails } = serviceOperation;
|
|
2228
|
+
const { startTime, jobId, azureStorageBlobContainerUri, endTime, error, status, statusDetails, } = serviceOperation;
|
|
2220
2229
|
if (!startTime) {
|
|
2221
2230
|
throw new Error(`Missing "startTime" from the full backup operation. Full backup did not start successfully.`);
|
|
2222
2231
|
}
|
|
@@ -2234,7 +2243,7 @@ class KeyVaultBackupPollOperation extends KeyVaultAdminPollOperation {
|
|
|
2234
2243
|
state.result = {
|
|
2235
2244
|
folderUri: azureStorageBlobContainerUri,
|
|
2236
2245
|
startTime,
|
|
2237
|
-
endTime
|
|
2246
|
+
endTime,
|
|
2238
2247
|
};
|
|
2239
2248
|
}
|
|
2240
2249
|
}
|
|
@@ -2246,7 +2255,7 @@ class KeyVaultBackupPollOperation extends KeyVaultAdminPollOperation {
|
|
|
2246
2255
|
*/
|
|
2247
2256
|
class KeyVaultBackupPoller extends KeyVaultAdminPoller {
|
|
2248
2257
|
constructor(options) {
|
|
2249
|
-
const { client, vaultUrl, blobStorageUri, sasToken, requestOptions, intervalInMs = 2000, resumeFrom } = options;
|
|
2258
|
+
const { client, vaultUrl, blobStorageUri, sasToken, requestOptions, intervalInMs = 2000, resumeFrom, } = options;
|
|
2250
2259
|
let state;
|
|
2251
2260
|
if (resumeFrom) {
|
|
2252
2261
|
state = JSON.parse(resumeFrom).state;
|
|
@@ -2262,14 +2271,14 @@ class KeyVaultBackupPoller extends KeyVaultAdminPoller {
|
|
|
2262
2271
|
/**
|
|
2263
2272
|
* @internal
|
|
2264
2273
|
*/
|
|
2265
|
-
const withTrace$
|
|
2274
|
+
const withTrace$1 = createTraceFunction("Azure.KeyVault.Admin.KeyVaultRestorePoller");
|
|
2266
2275
|
/**
|
|
2267
2276
|
* An interface representing a restore Key Vault's poll operation.
|
|
2268
2277
|
*/
|
|
2269
2278
|
class KeyVaultRestorePollOperation extends KeyVaultAdminPollOperation {
|
|
2270
2279
|
constructor(state, vaultUrl, client, requestOptions = {}) {
|
|
2271
2280
|
super(state, {
|
|
2272
|
-
cancelMessage: "Cancelling the restoration full Key Vault backup is not supported."
|
|
2281
|
+
cancelMessage: "Cancelling the restoration full Key Vault backup is not supported.",
|
|
2273
2282
|
});
|
|
2274
2283
|
this.state = state;
|
|
2275
2284
|
this.vaultUrl = vaultUrl;
|
|
@@ -2280,13 +2289,13 @@ class KeyVaultRestorePollOperation extends KeyVaultAdminPollOperation {
|
|
|
2280
2289
|
* Tracing the fullRestore operation
|
|
2281
2290
|
*/
|
|
2282
2291
|
fullRestore(options) {
|
|
2283
|
-
return withTrace$
|
|
2292
|
+
return withTrace$1("fullRestore", options, (updatedOptions) => this.client.fullRestoreOperation(this.vaultUrl, updatedOptions));
|
|
2284
2293
|
}
|
|
2285
2294
|
/**
|
|
2286
2295
|
* Tracing the restoreStatus operation.
|
|
2287
2296
|
*/
|
|
2288
2297
|
async restoreStatus(jobId, options) {
|
|
2289
|
-
return withTrace$
|
|
2298
|
+
return withTrace$1("restoreStatus", options, (updatedOptions) => this.client.restoreStatus(this.vaultUrl, jobId, updatedOptions));
|
|
2290
2299
|
}
|
|
2291
2300
|
/**
|
|
2292
2301
|
* Reaches to the service and updates the restore poll operation.
|
|
@@ -2302,8 +2311,8 @@ class KeyVaultRestorePollOperation extends KeyVaultAdminPollOperation {
|
|
|
2302
2311
|
folderToRestore: folderName,
|
|
2303
2312
|
sasTokenParameters: {
|
|
2304
2313
|
storageResourceUri: folderUri,
|
|
2305
|
-
token: sasToken
|
|
2306
|
-
}
|
|
2314
|
+
token: sasToken,
|
|
2315
|
+
},
|
|
2307
2316
|
} }));
|
|
2308
2317
|
this.mapState(serviceOperation);
|
|
2309
2318
|
}
|
|
@@ -2335,7 +2344,7 @@ class KeyVaultRestorePollOperation extends KeyVaultAdminPollOperation {
|
|
|
2335
2344
|
if (state.isCompleted) {
|
|
2336
2345
|
state.result = {
|
|
2337
2346
|
startTime,
|
|
2338
|
-
endTime
|
|
2347
|
+
endTime,
|
|
2339
2348
|
};
|
|
2340
2349
|
}
|
|
2341
2350
|
}
|
|
@@ -2347,7 +2356,7 @@ class KeyVaultRestorePollOperation extends KeyVaultAdminPollOperation {
|
|
|
2347
2356
|
*/
|
|
2348
2357
|
class KeyVaultRestorePoller extends KeyVaultAdminPoller {
|
|
2349
2358
|
constructor(options) {
|
|
2350
|
-
const { client, vaultUrl, folderUri, sasToken, folderName, requestOptions, intervalInMs = 2000, resumeFrom } = options;
|
|
2359
|
+
const { client, vaultUrl, folderUri, sasToken, folderName, requestOptions, intervalInMs = 2000, resumeFrom, } = options;
|
|
2351
2360
|
let state;
|
|
2352
2361
|
if (resumeFrom) {
|
|
2353
2362
|
state = JSON.parse(resumeFrom).state;
|
|
@@ -2364,7 +2373,7 @@ class KeyVaultRestorePoller extends KeyVaultAdminPoller {
|
|
|
2364
2373
|
/**
|
|
2365
2374
|
* @internal
|
|
2366
2375
|
*/
|
|
2367
|
-
const withTrace
|
|
2376
|
+
const withTrace = createTraceFunction("Azure.KeyVault.Admin.KeyVaultSelectiveKeyRestorePoller");
|
|
2368
2377
|
/**
|
|
2369
2378
|
* The selective restore Key Vault's poll operation.
|
|
2370
2379
|
*/
|
|
@@ -2380,13 +2389,13 @@ class KeyVaultSelectiveKeyRestorePollOperation extends KeyVaultAdminPollOperatio
|
|
|
2380
2389
|
* Tracing the selectiveRestore operation
|
|
2381
2390
|
*/
|
|
2382
2391
|
selectiveRestore(keyName, options) {
|
|
2383
|
-
return withTrace
|
|
2392
|
+
return withTrace("selectiveRestore", options, (updatedOptions) => this.client.selectiveKeyRestoreOperation(this.vaultUrl, keyName, updatedOptions));
|
|
2384
2393
|
}
|
|
2385
2394
|
/**
|
|
2386
2395
|
* Tracing the restoreStatus operation.
|
|
2387
2396
|
*/
|
|
2388
2397
|
restoreStatus(jobId, options) {
|
|
2389
|
-
return withTrace
|
|
2398
|
+
return withTrace("restoreStatus", options, (updatedOptions) => this.client.restoreStatus(this.vaultUrl, jobId, updatedOptions));
|
|
2390
2399
|
}
|
|
2391
2400
|
/**
|
|
2392
2401
|
* Reaches to the service and updates the selective restore poll operation.
|
|
@@ -2402,8 +2411,8 @@ class KeyVaultSelectiveKeyRestorePollOperation extends KeyVaultAdminPollOperatio
|
|
|
2402
2411
|
folder: folderName,
|
|
2403
2412
|
sasTokenParameters: {
|
|
2404
2413
|
storageResourceUri: folderUri,
|
|
2405
|
-
token: sasToken
|
|
2406
|
-
}
|
|
2414
|
+
token: sasToken,
|
|
2415
|
+
},
|
|
2407
2416
|
} }));
|
|
2408
2417
|
this.mapState(selectiveRestoreOperation);
|
|
2409
2418
|
}
|
|
@@ -2435,7 +2444,7 @@ class KeyVaultSelectiveKeyRestorePollOperation extends KeyVaultAdminPollOperatio
|
|
|
2435
2444
|
if (state.isCompleted) {
|
|
2436
2445
|
state.result = {
|
|
2437
2446
|
startTime,
|
|
2438
|
-
endTime
|
|
2447
|
+
endTime,
|
|
2439
2448
|
};
|
|
2440
2449
|
}
|
|
2441
2450
|
}
|
|
@@ -2447,7 +2456,7 @@ class KeyVaultSelectiveKeyRestorePollOperation extends KeyVaultAdminPollOperatio
|
|
|
2447
2456
|
*/
|
|
2448
2457
|
class KeyVaultSelectiveKeyRestorePoller extends KeyVaultAdminPoller {
|
|
2449
2458
|
constructor(options) {
|
|
2450
|
-
const { client, vaultUrl, keyName, folderUri, sasToken, folderName, requestOptions, intervalInMs = 2000, resumeFrom } = options;
|
|
2459
|
+
const { client, vaultUrl, keyName, folderUri, sasToken, folderName, requestOptions, intervalInMs = 2000, resumeFrom, } = options;
|
|
2451
2460
|
let state;
|
|
2452
2461
|
if (resumeFrom) {
|
|
2453
2462
|
state = JSON.parse(resumeFrom).state;
|
|
@@ -2492,14 +2501,14 @@ class KeyVaultBackupClient {
|
|
|
2492
2501
|
additionalAllowedHeaderNames: [
|
|
2493
2502
|
"x-ms-keyvault-region",
|
|
2494
2503
|
"x-ms-keyvault-network-info",
|
|
2495
|
-
"x-ms-keyvault-service-version"
|
|
2496
|
-
]
|
|
2504
|
+
"x-ms-keyvault-service-version",
|
|
2505
|
+
],
|
|
2497
2506
|
} });
|
|
2498
2507
|
this.client = new KeyVaultClient(apiVersion, clientOptions);
|
|
2499
2508
|
this.client.pipeline.addPolicy(coreRestPipeline.bearerTokenAuthenticationPolicy({
|
|
2500
2509
|
credential,
|
|
2501
2510
|
scopes: authenticationScopes,
|
|
2502
|
-
challengeCallbacks: createChallengeCallbacks()
|
|
2511
|
+
challengeCallbacks: createChallengeCallbacks(),
|
|
2503
2512
|
}));
|
|
2504
2513
|
}
|
|
2505
2514
|
/**
|
|
@@ -2541,7 +2550,7 @@ class KeyVaultBackupClient {
|
|
|
2541
2550
|
vaultUrl: this.vaultUrl,
|
|
2542
2551
|
intervalInMs: options.intervalInMs,
|
|
2543
2552
|
resumeFrom: options.resumeFrom,
|
|
2544
|
-
requestOptions: options
|
|
2553
|
+
requestOptions: options,
|
|
2545
2554
|
});
|
|
2546
2555
|
// This will initialize the poller's operation (the generation of the backup).
|
|
2547
2556
|
await poller.poll();
|