@azure/keyvault-admin 4.2.0-beta.2 → 4.2.1-alpha.20220330.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 +17 -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 +14 -30
- package/types/keyvault-admin.d.ts +36 -11
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
3
|
/// <reference lib="esnext.asynciterable" />
|
|
4
4
|
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib";
|
|
5
|
-
import { createTraceFunction } from "./tracingHelpers";
|
|
6
|
-
import { KeyVaultClient } from "./generated/keyVaultClient";
|
|
7
5
|
import { LATEST_API_VERSION, authenticationScopes } from "./constants";
|
|
8
|
-
import {
|
|
9
|
-
import { logger } from "./log";
|
|
10
|
-
import { v4 as v4uuid } from "uuid";
|
|
6
|
+
import { KeyVaultClient } from "./generated/keyVaultClient";
|
|
11
7
|
import { bearerTokenAuthenticationPolicy } from "@azure/core-rest-pipeline";
|
|
12
8
|
import { createChallengeCallbacks } from "./challengeAuthenticationCallbacks";
|
|
9
|
+
import { createTraceFunction } from "./tracingHelpers";
|
|
10
|
+
import { logger } from "./log";
|
|
11
|
+
import { mappings } from "./mappings";
|
|
12
|
+
import { v4 as v4uuid } from "uuid";
|
|
13
13
|
const withTrace = createTraceFunction("Azure.KeyVault.Admin.KeyVaultAccessControlClient");
|
|
14
14
|
/**
|
|
15
15
|
* The KeyVaultAccessControlClient provides methods to manage
|
|
@@ -42,14 +42,14 @@ export class KeyVaultAccessControlClient {
|
|
|
42
42
|
additionalAllowedHeaderNames: [
|
|
43
43
|
"x-ms-keyvault-region",
|
|
44
44
|
"x-ms-keyvault-network-info",
|
|
45
|
-
"x-ms-keyvault-service-version"
|
|
46
|
-
]
|
|
45
|
+
"x-ms-keyvault-service-version",
|
|
46
|
+
],
|
|
47
47
|
} });
|
|
48
48
|
this.client = new KeyVaultClient(serviceVersion, clientOptions);
|
|
49
49
|
this.client.pipeline.addPolicy(bearerTokenAuthenticationPolicy({
|
|
50
50
|
credential,
|
|
51
51
|
scopes: authenticationScopes,
|
|
52
|
-
challengeCallbacks: createChallengeCallbacks()
|
|
52
|
+
challengeCallbacks: createChallengeCallbacks(),
|
|
53
53
|
}));
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
@@ -74,8 +74,8 @@ export class KeyVaultAccessControlClient {
|
|
|
74
74
|
const response = await this.client.roleAssignments.create(this.vaultUrl, roleScope, name, {
|
|
75
75
|
properties: {
|
|
76
76
|
roleDefinitionId,
|
|
77
|
-
principalId
|
|
78
|
-
}
|
|
77
|
+
principalId,
|
|
78
|
+
},
|
|
79
79
|
}, updatedOptions);
|
|
80
80
|
return mappings.roleAssignment.generatedToPublic(response);
|
|
81
81
|
});
|
|
@@ -121,7 +121,6 @@ export class KeyVaultAccessControlClient {
|
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
123
|
/**
|
|
124
|
-
* @internal
|
|
125
124
|
* Deals with the pagination of {@link listRoleAssignments}.
|
|
126
125
|
* @param roleScope - The scope of the role assignments.
|
|
127
126
|
* @param continuationState - An object that indicates the position of the paginated request.
|
|
@@ -154,7 +153,6 @@ export class KeyVaultAccessControlClient {
|
|
|
154
153
|
});
|
|
155
154
|
}
|
|
156
155
|
/**
|
|
157
|
-
* @internal
|
|
158
156
|
* Deals with the iteration of all the available results of {@link listRoleAssignments}.
|
|
159
157
|
* @param roleScope - The scope of the role assignments.
|
|
160
158
|
* @param options - Common options for the iterative endpoints.
|
|
@@ -200,11 +198,10 @@ export class KeyVaultAccessControlClient {
|
|
|
200
198
|
[Symbol.asyncIterator]() {
|
|
201
199
|
return this;
|
|
202
200
|
},
|
|
203
|
-
byPage: (settings = {}) => this.listRoleAssignmentsPage(roleScope, settings, options)
|
|
201
|
+
byPage: (settings = {}) => this.listRoleAssignmentsPage(roleScope, settings, options),
|
|
204
202
|
};
|
|
205
203
|
}
|
|
206
204
|
/**
|
|
207
|
-
* @internal
|
|
208
205
|
* Deals with the pagination of {@link listRoleDefinitions}.
|
|
209
206
|
* @param roleScope - The scope of the role definition.
|
|
210
207
|
* @param continuationState - An object that indicates the position of the paginated request.
|
|
@@ -233,7 +230,6 @@ export class KeyVaultAccessControlClient {
|
|
|
233
230
|
});
|
|
234
231
|
}
|
|
235
232
|
/**
|
|
236
|
-
* @internal
|
|
237
233
|
* Deals with the iteration of all the available results of {@link listRoleDefinitions}.
|
|
238
234
|
* @param roleScope - The scope of the role definition.
|
|
239
235
|
* @param options - Common options for the iterative endpoints.
|
|
@@ -279,7 +275,7 @@ export class KeyVaultAccessControlClient {
|
|
|
279
275
|
[Symbol.asyncIterator]() {
|
|
280
276
|
return this;
|
|
281
277
|
},
|
|
282
|
-
byPage: (settings = {}) => this.listRoleDefinitionsPage(roleScope, settings, options)
|
|
278
|
+
byPage: (settings = {}) => this.listRoleDefinitionsPage(roleScope, settings, options),
|
|
283
279
|
};
|
|
284
280
|
}
|
|
285
281
|
/**
|
|
@@ -313,9 +309,6 @@ export class KeyVaultAccessControlClient {
|
|
|
313
309
|
* console.log(roleDefinition);
|
|
314
310
|
* ```
|
|
315
311
|
* @param roleScope - The scope of the role definition.
|
|
316
|
-
* @param name - The name of the role definition. Must be a UUID.
|
|
317
|
-
* @param permissions - The set of {@link KeyVaultPermission} for this role definition.
|
|
318
|
-
* @param description - The role definition description.
|
|
319
312
|
* @param options - The optional parameters.
|
|
320
313
|
*/
|
|
321
314
|
setRoleDefinition(roleScope, options = {}) {
|
|
@@ -326,8 +319,8 @@ export class KeyVaultAccessControlClient {
|
|
|
326
319
|
permissions: options.permissions,
|
|
327
320
|
assignableScopes: [roleScope],
|
|
328
321
|
roleName: options.roleName,
|
|
329
|
-
roleType: "CustomRole"
|
|
330
|
-
}
|
|
322
|
+
roleType: "CustomRole",
|
|
323
|
+
},
|
|
331
324
|
}, updatedOptions);
|
|
332
325
|
return mappings.roleDefinition.generatedToPublic(response);
|
|
333
326
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accessControlClient.js","sourceRoot":"","sources":["../../../src/accessControlClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,4CAA4C;;AAK5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAoB5D,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,QAAQ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EAAE,cAAc,EAAE,EAAE;YACzE,MAAM,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;QAC3F,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n/// <reference lib=\"esnext.asynciterable\" />\n\nimport { TokenCredential } from \"@azure/core-auth\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\n\nimport { createTraceFunction } from \"./tracingHelpers\";\nimport { KeyVaultClient } from \"./generated/keyVaultClient\";\nimport { RoleAssignmentsListForScopeOptionalParams } from \"./generated/models\";\n\nimport {\n CreateRoleAssignmentOptions,\n KeyVaultRoleAssignment,\n AccessControlClientOptions,\n KeyVaultRoleScope,\n DeleteRoleAssignmentOptions,\n ListRoleAssignmentsOptions,\n ListRoleDefinitionsOptions,\n KeyVaultRoleDefinition,\n GetRoleAssignmentOptions,\n ListRoleDefinitionsPageSettings,\n ListRoleAssignmentsPageSettings,\n GetRoleDefinitionOptions,\n SetRoleDefinitionOptions,\n DeleteRoleDefinitionOptions\n} from \"./accessControlModels\";\n\nimport { LATEST_API_VERSION, authenticationScopes } from \"./constants\";\nimport { mappings } from \"./mappings\";\nimport { logger } from \"./log\";\nimport { v4 as v4uuid } from \"uuid\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\nimport { createChallengeCallbacks } from \"./challengeAuthenticationCallbacks\";\n\nconst withTrace = createTraceFunction(\"Azure.KeyVault.Admin.KeyVaultAccessControlClient\");\n\n/**\n * The KeyVaultAccessControlClient provides methods to manage\n * access control and role assignments in any given Azure Key Vault instance.\n * The client supports creating, retrieving and deleting roles.\n */\nexport class KeyVaultAccessControlClient {\n /**\n * The base URL to the vault\n */\n public readonly vaultUrl: string;\n\n /**\n * @internal\n * A reference to the auto-generated Key Vault HTTP client.\n */\n private readonly client: KeyVaultClient;\n\n /**\n * Creates an instance of the KeyVaultAccessControlClient.\n *\n * Example usage:\n * ```ts\n * import { KeyVaultAccessControlClient } from \"@azure/keyvault-admin\";\n * import { DefaultAzureCredential } from \"@azure/identity\";\n *\n * let vaultUrl = `https://<MY KEY VAULT HERE>.vault.azure.net`;\n * let credentials = new DefaultAzureCredential();\n *\n * let client = new KeyVaultAccessControlClient(vaultUrl, credentials);\n * ```\n * @param vaultUrl - the URL of the Key Vault. It should have this shape: `https://${your-key-vault-name}.vault.azure.net`\n * @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.\n * @param pipelineOptions - Pipeline options used to configure Key Vault API requests. Omit this parameter to use the default pipeline configuration.\n */\n constructor(\n vaultUrl: string,\n credential: TokenCredential,\n options: AccessControlClientOptions = {}\n ) {\n this.vaultUrl = vaultUrl;\n\n const serviceVersion = options.serviceVersion || LATEST_API_VERSION;\n\n const clientOptions = {\n ...options,\n loggingOptions: {\n logger: logger.info,\n additionalAllowedHeaderNames: [\n \"x-ms-keyvault-region\",\n \"x-ms-keyvault-network-info\",\n \"x-ms-keyvault-service-version\"\n ]\n }\n };\n\n this.client = new KeyVaultClient(serviceVersion, clientOptions);\n\n this.client.pipeline.addPolicy(\n bearerTokenAuthenticationPolicy({\n credential,\n scopes: authenticationScopes,\n challengeCallbacks: createChallengeCallbacks()\n })\n );\n }\n\n /**\n * Creates a role assignment in an Azure Key Vault.\n *\n * Example usage:\n * ```ts\n * const client = new KeyVaultAccessControlClient(url, credentials);\n * const roleDefinition = await client.listRoleDefinitions(\"/\").next();\n * const principalId = \"4871f6a6-374f-4b6b-8b0c-f5d84db823f6\";\n * const result = await client.createRoleAssignment(\"/\", \"295c179b-9ad3-4117-99cd-b1aa66cf4517\", roleDefinition, principalId);\n * ```\n * Creates a new role assignment.\n * @param roleScope - The scope of the role assignment.\n * @param name - The name of the role assignment. Must be a UUID.\n * @param roleDefinitionId - The role definition ID used in the role assignment.\n * @param principalId - The principal ID assigned to the role. This maps to the ID inside the Active Directory. It can point to a user, service principal, or security group.\n * @param options - The optional parameters.\n */\n public createRoleAssignment(\n roleScope: KeyVaultRoleScope,\n name: string,\n roleDefinitionId: string,\n principalId: string,\n options: CreateRoleAssignmentOptions = {}\n ): Promise<KeyVaultRoleAssignment> {\n return withTrace(\"createRoleAssignment\", options, async (updatedOptions) => {\n const response = await this.client.roleAssignments.create(\n this.vaultUrl,\n roleScope,\n name,\n {\n properties: {\n roleDefinitionId,\n principalId\n }\n },\n updatedOptions\n );\n return mappings.roleAssignment.generatedToPublic(response);\n });\n }\n\n /**\n * Deletes role assignments previously created in an Azure Key Vault.\n *\n * Example usage:\n * ```ts\n * const client = new KeyVaultAccessControlClient(url, credentials);\n * const roleAssignment = await client.createRoleAssignment(\"/\", \"295c179b-9ad3-4117-99cd-b1aa66cf4517\");\n * await client.deleteRoleAssignment(roleAssignment.properties.roleScope, roleAssignment.name);\n * ```\n * Deletes an existing role assignment.\n * @param roleScope - The scope of the role assignment.\n * @param name - The name of the role assignment.\n * @param options - The optional parameters.\n */\n public deleteRoleAssignment(\n roleScope: KeyVaultRoleScope,\n name: string,\n options: DeleteRoleAssignmentOptions = {}\n ): Promise<void> {\n return withTrace(\"deleteRoleAssignment\", options, async (updatedOptions) => {\n await this.client.roleAssignments.delete(this.vaultUrl, roleScope, name, updatedOptions);\n });\n }\n\n /**\n * Gets a role assignments previously created in an Azure Key Vault.\n *\n * Example usage:\n * ```ts\n * const client = new KeyVaultAccessControlClient(url, credentials);\n * let roleAssignment = await client.createRoleAssignment(\"/\", \"295c179b-9ad3-4117-99cd-b1aa66cf4517\");\n * roleAssignment = const await client.getRoleAssignment(roleAssignment.properties.roleScope, roleAssignment.name);\n * console.log(roleAssignment);\n * ```\n * Gets an existing role assignment.\n * @param roleScope - The scope of the role assignment.\n * @param name - The name of the role assignment.\n * @param options - The optional parameters.\n */\n public getRoleAssignment(\n roleScope: KeyVaultRoleScope,\n name: string,\n options: GetRoleAssignmentOptions = {}\n ): Promise<KeyVaultRoleAssignment> {\n return withTrace(\"getRoleAssignment\", options, async (updatedOptions) => {\n const response = await this.client.roleAssignments.get(\n this.vaultUrl,\n roleScope,\n name,\n updatedOptions\n );\n return mappings.roleAssignment.generatedToPublic(response);\n });\n }\n\n /**\n * @internal\n * Deals with the pagination of {@link listRoleAssignments}.\n * @param roleScope - The scope of the role assignments.\n * @param continuationState - An object that indicates the position of the paginated request.\n * @param options - Common options for the iterative endpoints.\n */\n private async *listRoleAssignmentsPage(\n roleScope: KeyVaultRoleScope,\n continuationState: ListRoleAssignmentsPageSettings,\n options?: ListRoleAssignmentsOptions\n ): AsyncIterableIterator<KeyVaultRoleAssignment[]> {\n if (!continuationState.continuationToken) {\n const optionsComplete: RoleAssignmentsListForScopeOptionalParams = options || {};\n const currentSetResponse = await withTrace(\n \"listRoleAssignments\",\n optionsComplete,\n async (updatedOptions) => {\n return this.client.roleAssignments.listForScope(this.vaultUrl, roleScope, updatedOptions);\n }\n );\n continuationState.continuationToken = currentSetResponse.nextLink;\n if (currentSetResponse.value) {\n yield currentSetResponse.value.map(mappings.roleAssignment.generatedToPublic, this);\n }\n }\n while (continuationState.continuationToken) {\n const currentSetResponse = await withTrace(\n \"listRoleAssignments\",\n options || {},\n async (updatedOptions) => {\n return this.client.roleAssignments.listForScopeNext(\n this.vaultUrl,\n roleScope,\n continuationState.continuationToken!,\n updatedOptions\n );\n }\n );\n continuationState.continuationToken = currentSetResponse.nextLink;\n if (currentSetResponse.value) {\n yield currentSetResponse.value.map(mappings.roleAssignment.generatedToPublic, this);\n } else {\n break;\n }\n }\n }\n\n /**\n * @internal\n * Deals with the iteration of all the available results of {@link listRoleAssignments}.\n * @param roleScope - The scope of the role assignments.\n * @param options - Common options for the iterative endpoints.\n */\n private async *listRoleAssignmentsAll(\n roleScope: KeyVaultRoleScope,\n options?: ListRoleAssignmentsOptions\n ): AsyncIterableIterator<KeyVaultRoleAssignment> {\n for await (const page of this.listRoleAssignmentsPage(roleScope, {}, options)) {\n yield* page;\n }\n }\n\n /**\n * Iterates over all of the available role assignments in an Azure Key Vault.\n *\n * Example usage:\n * ```ts\n * let client = new KeyVaultAccessControlClient(url, credentials);\n * for await (const roleAssignment of client.listRoleAssignments(\"/\")) {\n * console.log(\"Role assignment: \", roleAssignment);\n * }\n * ```\n * Lists all of the role assignments in a given scope.\n * @param roleScope - The scope of the role assignments.\n * @param options - The optional parameters.\n */\n public listRoleAssignments(\n roleScope: KeyVaultRoleScope,\n options: ListRoleAssignmentsOptions = {}\n ): PagedAsyncIterableIterator<KeyVaultRoleAssignment> {\n const iter = this.listRoleAssignmentsAll(roleScope, options);\n\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings: ListRoleAssignmentsPageSettings = {}) =>\n this.listRoleAssignmentsPage(roleScope, settings, options)\n };\n }\n\n /**\n * @internal\n * Deals with the pagination of {@link listRoleDefinitions}.\n * @param roleScope - The scope of the role definition.\n * @param continuationState - An object that indicates the position of the paginated request.\n * @param options - Common options for the iterative endpoints.\n */\n private async *listRoleDefinitionsPage(\n roleScope: KeyVaultRoleScope,\n continuationState: ListRoleDefinitionsPageSettings,\n options: ListRoleDefinitionsOptions = {}\n ): AsyncIterableIterator<KeyVaultRoleDefinition[]> {\n if (!continuationState.continuationToken) {\n const optionsComplete: RoleAssignmentsListForScopeOptionalParams = options || {};\n const currentSetResponse = await withTrace(\n \"listRoleDefinitions\",\n optionsComplete,\n (updatedOptions) =>\n this.client.roleDefinitions.list(this.vaultUrl, roleScope, updatedOptions)\n );\n continuationState.continuationToken = currentSetResponse.nextLink;\n if (currentSetResponse.value) {\n yield currentSetResponse.value.map(mappings.roleDefinition.generatedToPublic, this);\n }\n }\n while (continuationState.continuationToken) {\n const currentSetResponse = await withTrace(\"listRoleDefinitions\", options, (updatedOptions) =>\n this.client.roleDefinitions.listNext(\n this.vaultUrl,\n roleScope,\n continuationState.continuationToken!,\n updatedOptions\n )\n );\n continuationState.continuationToken = currentSetResponse.nextLink;\n if (currentSetResponse.value) {\n yield currentSetResponse.value.map(mappings.roleDefinition.generatedToPublic, this);\n } else {\n break;\n }\n }\n }\n\n /**\n * @internal\n * Deals with the iteration of all the available results of {@link listRoleDefinitions}.\n * @param roleScope - The scope of the role definition.\n * @param options - Common options for the iterative endpoints.\n */\n private async *listRoleDefinitionsAll(\n roleScope: KeyVaultRoleScope,\n options?: ListRoleDefinitionsOptions\n ): AsyncIterableIterator<KeyVaultRoleDefinition> {\n for await (const page of this.listRoleDefinitionsPage(roleScope, {}, options)) {\n yield* page;\n }\n }\n\n /**\n * Iterates over all of the available role definitions in an Azure Key Vault.\n *\n * Example usage:\n * ```ts\n * let client = new KeyVaultAccessControlClient(url, credentials);\n * for await (const roleDefinitions of client.listRoleDefinitions(\"/\")) {\n * console.log(\"Role definition: \", roleDefinitions);\n * }\n * ```\n * Lists all of the role definition in a given scope.\n * @param roleScope - The scope of the role definition.\n * @param options - The optional parameters.\n */\n public listRoleDefinitions(\n roleScope: KeyVaultRoleScope,\n options: ListRoleDefinitionsOptions = {}\n ): PagedAsyncIterableIterator<KeyVaultRoleDefinition> {\n const iter = this.listRoleDefinitionsAll(roleScope, options);\n\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings: ListRoleDefinitionsPageSettings = {}) =>\n this.listRoleDefinitionsPage(roleScope, settings, options)\n };\n }\n\n /**\n * Gets a role definition from Azure Key Vault.\n *\n * Example usage:\n * ```\n * const client = new KeyVaultAccessControlClient(url, credentials);\n * const roleDefinition = await client.getRoleDefinition(\"/\", \"b86a8fe4-44ce-4948-aee5-eccb2c155cd7\");\n * console.log(roleDefinition);\n * ```\n * @param roleScope - The scope of the role definition.\n * @param name - The name of the role definition.\n * @param options - The optional parameters.\n */\n public getRoleDefinition(\n roleScope: KeyVaultRoleScope,\n name: string,\n options: GetRoleDefinitionOptions = {}\n ): Promise<KeyVaultRoleDefinition> {\n return withTrace(\"getRoleDefinition\", options, async (updatedOptions) => {\n const response = await this.client.roleDefinitions.get(\n this.vaultUrl,\n roleScope,\n name,\n updatedOptions\n );\n return mappings.roleDefinition.generatedToPublic(response);\n });\n }\n\n /**\n * Creates or updates a role definition in an Azure Key Vault.\n *\n * Example usage:\n * ```ts\n * const client = new KeyVaultAccessControlClient(url, credentials);\n * const permissions = [{ dataActions: [KnownKeyVaultDataAction.BackupHsmKeys] }];\n * const roleDefinitionName = \"23b8bb1a-39c0-4c89-a85b-dd3c99273a8a\";\n * const roleDefinition = await client.setRoleDefinition(KnownKeyVaultRoleScope.Global, { permissions, roleDefinitionName });\n * console.log(roleDefinition);\n * ```\n * @param roleScope - The scope of the role definition.\n * @param name - The name of the role definition. Must be a UUID.\n * @param permissions - The set of {@link KeyVaultPermission} for this role definition.\n * @param description - The role definition description.\n * @param options - The optional parameters.\n */\n public setRoleDefinition(\n roleScope: KeyVaultRoleScope,\n options: SetRoleDefinitionOptions = {}\n ): Promise<KeyVaultRoleDefinition> {\n return withTrace(\"setRoleDefinition\", options, async (updatedOptions) => {\n const response = await this.client.roleDefinitions.createOrUpdate(\n this.vaultUrl,\n roleScope,\n options.roleDefinitionName || v4uuid(),\n {\n properties: {\n description: options.description,\n permissions: options.permissions,\n assignableScopes: [roleScope],\n roleName: options.roleName,\n roleType: \"CustomRole\"\n }\n },\n updatedOptions\n );\n return mappings.roleDefinition.generatedToPublic(response);\n });\n }\n\n /**\n * Deletes a custom role definition previously created in an Azure Key Vault.\n *\n * Example usage:\n * ```ts\n * const client = new KeyVaultAccessControlClient(url, credentials);\n * const roleDefinition = await client.setRoleDefinition(\"/\", \"23b8bb1a-39c0-4c89-a85b-dd3c99273a8a\", []);\n * await client.deleteRoleDefinition(\"/\", roleDefinition.name);\n * ```\n * @param roleScope - The scope of the role definition.\n * @param name - The name of the role definition to delete.\n * @param options - The optional parameters.\n */\n public deleteRoleDefinition(\n roleScope: KeyVaultRoleScope,\n name: string,\n options: DeleteRoleDefinitionOptions = {}\n ): Promise<void> {\n return withTrace(\"deleteRoleDefinition\", options, async (updatedOptions) => {\n await this.client.roleDefinitions.delete(this.vaultUrl, roleScope, name, updatedOptions);\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"accessControlClient.js","sourceRoot":"","sources":["../../../src/accessControlClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,4CAA4C;;AAkB5C,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAI5D,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAEpC,MAAM,SAAS,GAAG,mBAAmB,CAAC,kDAAkD,CAAC,CAAC;AAE1F;;;;GAIG;AACH,MAAM,OAAO,2BAA2B;IAWtC;;;;;;;;;;;;;;;;OAgBG;IACH,YACE,QAAgB,EAChB,UAA2B,EAC3B,UAAsC,EAAE;QAExC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,kBAAkB,CAAC;QAEpE,MAAM,aAAa,mCACd,OAAO,KACV,cAAc,EAAE;gBACd,MAAM,EAAE,MAAM,CAAC,IAAI;gBACnB,4BAA4B,EAAE;oBAC5B,sBAAsB;oBACtB,4BAA4B;oBAC5B,+BAA+B;iBAChC;aACF,GACF,CAAC;QAEF,IAAI,CAAC,MAAM,GAAG,IAAI,cAAc,CAAC,cA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V,WAAW,EAAE,OAAO,CAAC,WAAW;oBAChC,WAAW,EAAE,OAAO,CAAC,WAAW;oBAChC,gBAAgB,EAAE,CAAC,SAAS,CAAC;oBAC7B,QAAQ,EAAE,OAAO,CAAC,QAAQ;oBAC1B,QAAQ,EAAE,YAAY;iBACvB;aACF,EACD,cAAc,CACf,CAAC;YACF,OAAO,QAAQ,CAAC,cAAc,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;OAYG;IACI,oBAAoB,CACzB,SAA4B,EAC5B,IAAY,EACZ,UAAuC,EAAE;QAEzC,OAAO,SAAS,CAAC,sBAAsB,EAAE,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,EAAE;YACzE,MAAM,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;QAC3F,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n/// <reference lib=\"esnext.asynciterable\" />\n\nimport {\n AccessControlClientOptions,\n CreateRoleAssignmentOptions,\n DeleteRoleAssignmentOptions,\n DeleteRoleDefinitionOptions,\n GetRoleAssignmentOptions,\n GetRoleDefinitionOptions,\n KeyVaultRoleAssignment,\n KeyVaultRoleDefinition,\n KeyVaultRoleScope,\n ListRoleAssignmentsOptions,\n ListRoleAssignmentsPageSettings,\n ListRoleDefinitionsOptions,\n ListRoleDefinitionsPageSettings,\n SetRoleDefinitionOptions,\n} from \"./accessControlModels\";\nimport { LATEST_API_VERSION, authenticationScopes } from \"./constants\";\nimport { KeyVaultClient } from \"./generated/keyVaultClient\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { RoleAssignmentsListForScopeOptionalParams } from \"./generated/models\";\nimport { TokenCredential } from \"@azure/core-auth\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\nimport { createChallengeCallbacks } from \"./challengeAuthenticationCallbacks\";\nimport { createTraceFunction } from \"./tracingHelpers\";\nimport { logger } from \"./log\";\nimport { mappings } from \"./mappings\";\nimport { v4 as v4uuid } from \"uuid\";\n\nconst withTrace = createTraceFunction(\"Azure.KeyVault.Admin.KeyVaultAccessControlClient\");\n\n/**\n * The KeyVaultAccessControlClient provides methods to manage\n * access control and role assignments in any given Azure Key Vault instance.\n * The client supports creating, retrieving and deleting roles.\n */\nexport class KeyVaultAccessControlClient {\n /**\n * The base URL to the vault\n */\n public readonly vaultUrl: string;\n\n /**\n * A reference to the auto-generated Key Vault HTTP client.\n */\n private readonly client: KeyVaultClient;\n\n /**\n * Creates an instance of the KeyVaultAccessControlClient.\n *\n * Example usage:\n * ```ts\n * import { KeyVaultAccessControlClient } from \"@azure/keyvault-admin\";\n * import { DefaultAzureCredential } from \"@azure/identity\";\n *\n * let vaultUrl = `https://<MY KEY VAULT HERE>.vault.azure.net`;\n * let credentials = new DefaultAzureCredential();\n *\n * let client = new KeyVaultAccessControlClient(vaultUrl, credentials);\n * ```\n * @param vaultUrl - the URL of the Key Vault. It should have this shape: `https://${your-key-vault-name}.vault.azure.net`\n * @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.\n * @param pipelineOptions - Pipeline options used to configure Key Vault API requests. Omit this parameter to use the default pipeline configuration.\n */\n constructor(\n vaultUrl: string,\n credential: TokenCredential,\n options: AccessControlClientOptions = {}\n ) {\n this.vaultUrl = vaultUrl;\n\n const serviceVersion = options.serviceVersion || LATEST_API_VERSION;\n\n const clientOptions = {\n ...options,\n loggingOptions: {\n logger: logger.info,\n additionalAllowedHeaderNames: [\n \"x-ms-keyvault-region\",\n \"x-ms-keyvault-network-info\",\n \"x-ms-keyvault-service-version\",\n ],\n },\n };\n\n this.client = new KeyVaultClient(serviceVersion, clientOptions);\n\n this.client.pipeline.addPolicy(\n bearerTokenAuthenticationPolicy({\n credential,\n scopes: authenticationScopes,\n challengeCallbacks: createChallengeCallbacks(),\n })\n );\n }\n\n /**\n * Creates a role assignment in an Azure Key Vault.\n *\n * Example usage:\n * ```ts\n * const client = new KeyVaultAccessControlClient(url, credentials);\n * const roleDefinition = await client.listRoleDefinitions(\"/\").next();\n * const principalId = \"4871f6a6-374f-4b6b-8b0c-f5d84db823f6\";\n * const result = await client.createRoleAssignment(\"/\", \"295c179b-9ad3-4117-99cd-b1aa66cf4517\", roleDefinition, principalId);\n * ```\n * Creates a new role assignment.\n * @param roleScope - The scope of the role assignment.\n * @param name - The name of the role assignment. Must be a UUID.\n * @param roleDefinitionId - The role definition ID used in the role assignment.\n * @param principalId - The principal ID assigned to the role. This maps to the ID inside the Active Directory. It can point to a user, service principal, or security group.\n * @param options - The optional parameters.\n */\n public createRoleAssignment(\n roleScope: KeyVaultRoleScope,\n name: string,\n roleDefinitionId: string,\n principalId: string,\n options: CreateRoleAssignmentOptions = {}\n ): Promise<KeyVaultRoleAssignment> {\n return withTrace(\"createRoleAssignment\", options, async (updatedOptions) => {\n const response = await this.client.roleAssignments.create(\n this.vaultUrl,\n roleScope,\n name,\n {\n properties: {\n roleDefinitionId,\n principalId,\n },\n },\n updatedOptions\n );\n return mappings.roleAssignment.generatedToPublic(response);\n });\n }\n\n /**\n * Deletes role assignments previously created in an Azure Key Vault.\n *\n * Example usage:\n * ```ts\n * const client = new KeyVaultAccessControlClient(url, credentials);\n * const roleAssignment = await client.createRoleAssignment(\"/\", \"295c179b-9ad3-4117-99cd-b1aa66cf4517\");\n * await client.deleteRoleAssignment(roleAssignment.properties.roleScope, roleAssignment.name);\n * ```\n * Deletes an existing role assignment.\n * @param roleScope - The scope of the role assignment.\n * @param name - The name of the role assignment.\n * @param options - The optional parameters.\n */\n public deleteRoleAssignment(\n roleScope: KeyVaultRoleScope,\n name: string,\n options: DeleteRoleAssignmentOptions = {}\n ): Promise<void> {\n return withTrace(\"deleteRoleAssignment\", options, async (updatedOptions) => {\n await this.client.roleAssignments.delete(this.vaultUrl, roleScope, name, updatedOptions);\n });\n }\n\n /**\n * Gets a role assignments previously created in an Azure Key Vault.\n *\n * Example usage:\n * ```ts\n * const client = new KeyVaultAccessControlClient(url, credentials);\n * let roleAssignment = await client.createRoleAssignment(\"/\", \"295c179b-9ad3-4117-99cd-b1aa66cf4517\");\n * roleAssignment = const await client.getRoleAssignment(roleAssignment.properties.roleScope, roleAssignment.name);\n * console.log(roleAssignment);\n * ```\n * Gets an existing role assignment.\n * @param roleScope - The scope of the role assignment.\n * @param name - The name of the role assignment.\n * @param options - The optional parameters.\n */\n public getRoleAssignment(\n roleScope: KeyVaultRoleScope,\n name: string,\n options: GetRoleAssignmentOptions = {}\n ): Promise<KeyVaultRoleAssignment> {\n return withTrace(\"getRoleAssignment\", options, async (updatedOptions) => {\n const response = await this.client.roleAssignments.get(\n this.vaultUrl,\n roleScope,\n name,\n updatedOptions\n );\n return mappings.roleAssignment.generatedToPublic(response);\n });\n }\n\n /**\n * Deals with the pagination of {@link listRoleAssignments}.\n * @param roleScope - The scope of the role assignments.\n * @param continuationState - An object that indicates the position of the paginated request.\n * @param options - Common options for the iterative endpoints.\n */\n private async *listRoleAssignmentsPage(\n roleScope: KeyVaultRoleScope,\n continuationState: ListRoleAssignmentsPageSettings,\n options?: ListRoleAssignmentsOptions\n ): AsyncIterableIterator<KeyVaultRoleAssignment[]> {\n if (!continuationState.continuationToken) {\n const optionsComplete: RoleAssignmentsListForScopeOptionalParams = options || {};\n const currentSetResponse = await withTrace(\n \"listRoleAssignments\",\n optionsComplete,\n async (updatedOptions) => {\n return this.client.roleAssignments.listForScope(this.vaultUrl, roleScope, updatedOptions);\n }\n );\n continuationState.continuationToken = currentSetResponse.nextLink;\n if (currentSetResponse.value) {\n yield currentSetResponse.value.map(mappings.roleAssignment.generatedToPublic, this);\n }\n }\n while (continuationState.continuationToken) {\n const currentSetResponse = await withTrace(\n \"listRoleAssignments\",\n options || {},\n async (updatedOptions) => {\n return this.client.roleAssignments.listForScopeNext(\n this.vaultUrl,\n roleScope,\n continuationState.continuationToken!,\n updatedOptions\n );\n }\n );\n continuationState.continuationToken = currentSetResponse.nextLink;\n if (currentSetResponse.value) {\n yield currentSetResponse.value.map(mappings.roleAssignment.generatedToPublic, this);\n } else {\n break;\n }\n }\n }\n\n /**\n * Deals with the iteration of all the available results of {@link listRoleAssignments}.\n * @param roleScope - The scope of the role assignments.\n * @param options - Common options for the iterative endpoints.\n */\n private async *listRoleAssignmentsAll(\n roleScope: KeyVaultRoleScope,\n options?: ListRoleAssignmentsOptions\n ): AsyncIterableIterator<KeyVaultRoleAssignment> {\n for await (const page of this.listRoleAssignmentsPage(roleScope, {}, options)) {\n yield* page;\n }\n }\n\n /**\n * Iterates over all of the available role assignments in an Azure Key Vault.\n *\n * Example usage:\n * ```ts\n * let client = new KeyVaultAccessControlClient(url, credentials);\n * for await (const roleAssignment of client.listRoleAssignments(\"/\")) {\n * console.log(\"Role assignment: \", roleAssignment);\n * }\n * ```\n * Lists all of the role assignments in a given scope.\n * @param roleScope - The scope of the role assignments.\n * @param options - The optional parameters.\n */\n public listRoleAssignments(\n roleScope: KeyVaultRoleScope,\n options: ListRoleAssignmentsOptions = {}\n ): PagedAsyncIterableIterator<KeyVaultRoleAssignment> {\n const iter = this.listRoleAssignmentsAll(roleScope, options);\n\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings: ListRoleAssignmentsPageSettings = {}) =>\n this.listRoleAssignmentsPage(roleScope, settings, options),\n };\n }\n\n /**\n * Deals with the pagination of {@link listRoleDefinitions}.\n * @param roleScope - The scope of the role definition.\n * @param continuationState - An object that indicates the position of the paginated request.\n * @param options - Common options for the iterative endpoints.\n */\n private async *listRoleDefinitionsPage(\n roleScope: KeyVaultRoleScope,\n continuationState: ListRoleDefinitionsPageSettings,\n options: ListRoleDefinitionsOptions = {}\n ): AsyncIterableIterator<KeyVaultRoleDefinition[]> {\n if (!continuationState.continuationToken) {\n const optionsComplete: RoleAssignmentsListForScopeOptionalParams = options || {};\n const currentSetResponse = await withTrace(\n \"listRoleDefinitions\",\n optionsComplete,\n (updatedOptions) =>\n this.client.roleDefinitions.list(this.vaultUrl, roleScope, updatedOptions)\n );\n continuationState.continuationToken = currentSetResponse.nextLink;\n if (currentSetResponse.value) {\n yield currentSetResponse.value.map(mappings.roleDefinition.generatedToPublic, this);\n }\n }\n while (continuationState.continuationToken) {\n const currentSetResponse = await withTrace(\"listRoleDefinitions\", options, (updatedOptions) =>\n this.client.roleDefinitions.listNext(\n this.vaultUrl,\n roleScope,\n continuationState.continuationToken!,\n updatedOptions\n )\n );\n continuationState.continuationToken = currentSetResponse.nextLink;\n if (currentSetResponse.value) {\n yield currentSetResponse.value.map(mappings.roleDefinition.generatedToPublic, this);\n } else {\n break;\n }\n }\n }\n\n /**\n * Deals with the iteration of all the available results of {@link listRoleDefinitions}.\n * @param roleScope - The scope of the role definition.\n * @param options - Common options for the iterative endpoints.\n */\n private async *listRoleDefinitionsAll(\n roleScope: KeyVaultRoleScope,\n options?: ListRoleDefinitionsOptions\n ): AsyncIterableIterator<KeyVaultRoleDefinition> {\n for await (const page of this.listRoleDefinitionsPage(roleScope, {}, options)) {\n yield* page;\n }\n }\n\n /**\n * Iterates over all of the available role definitions in an Azure Key Vault.\n *\n * Example usage:\n * ```ts\n * let client = new KeyVaultAccessControlClient(url, credentials);\n * for await (const roleDefinitions of client.listRoleDefinitions(\"/\")) {\n * console.log(\"Role definition: \", roleDefinitions);\n * }\n * ```\n * Lists all of the role definition in a given scope.\n * @param roleScope - The scope of the role definition.\n * @param options - The optional parameters.\n */\n public listRoleDefinitions(\n roleScope: KeyVaultRoleScope,\n options: ListRoleDefinitionsOptions = {}\n ): PagedAsyncIterableIterator<KeyVaultRoleDefinition> {\n const iter = this.listRoleDefinitionsAll(roleScope, options);\n\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings: ListRoleDefinitionsPageSettings = {}) =>\n this.listRoleDefinitionsPage(roleScope, settings, options),\n };\n }\n\n /**\n * Gets a role definition from Azure Key Vault.\n *\n * Example usage:\n * ```\n * const client = new KeyVaultAccessControlClient(url, credentials);\n * const roleDefinition = await client.getRoleDefinition(\"/\", \"b86a8fe4-44ce-4948-aee5-eccb2c155cd7\");\n * console.log(roleDefinition);\n * ```\n * @param roleScope - The scope of the role definition.\n * @param name - The name of the role definition.\n * @param options - The optional parameters.\n */\n public getRoleDefinition(\n roleScope: KeyVaultRoleScope,\n name: string,\n options: GetRoleDefinitionOptions = {}\n ): Promise<KeyVaultRoleDefinition> {\n return withTrace(\"getRoleDefinition\", options, async (updatedOptions) => {\n const response = await this.client.roleDefinitions.get(\n this.vaultUrl,\n roleScope,\n name,\n updatedOptions\n );\n return mappings.roleDefinition.generatedToPublic(response);\n });\n }\n\n /**\n * Creates or updates a role definition in an Azure Key Vault.\n *\n * Example usage:\n * ```ts\n * const client = new KeyVaultAccessControlClient(url, credentials);\n * const permissions = [{ dataActions: [KnownKeyVaultDataAction.BackupHsmKeys] }];\n * const roleDefinitionName = \"23b8bb1a-39c0-4c89-a85b-dd3c99273a8a\";\n * const roleDefinition = await client.setRoleDefinition(KnownKeyVaultRoleScope.Global, { permissions, roleDefinitionName });\n * console.log(roleDefinition);\n * ```\n * @param roleScope - The scope of the role definition.\n * @param options - The optional parameters.\n */\n public setRoleDefinition(\n roleScope: KeyVaultRoleScope,\n options: SetRoleDefinitionOptions = {}\n ): Promise<KeyVaultRoleDefinition> {\n return withTrace(\"setRoleDefinition\", options, async (updatedOptions) => {\n const response = await this.client.roleDefinitions.createOrUpdate(\n this.vaultUrl,\n roleScope,\n options.roleDefinitionName || v4uuid(),\n {\n properties: {\n description: options.description,\n permissions: options.permissions,\n assignableScopes: [roleScope],\n roleName: options.roleName,\n roleType: \"CustomRole\",\n },\n },\n updatedOptions\n );\n return mappings.roleDefinition.generatedToPublic(response);\n });\n }\n\n /**\n * Deletes a custom role definition previously created in an Azure Key Vault.\n *\n * Example usage:\n * ```ts\n * const client = new KeyVaultAccessControlClient(url, credentials);\n * const roleDefinition = await client.setRoleDefinition(\"/\", \"23b8bb1a-39c0-4c89-a85b-dd3c99273a8a\", []);\n * await client.deleteRoleDefinition(\"/\", roleDefinition.name);\n * ```\n * @param roleScope - The scope of the role definition.\n * @param name - The name of the role definition to delete.\n * @param options - The optional parameters.\n */\n public deleteRoleDefinition(\n roleScope: KeyVaultRoleScope,\n name: string,\n options: DeleteRoleDefinitionOptions = {}\n ): Promise<void> {\n return withTrace(\"deleteRoleDefinition\", options, async (updatedOptions) => {\n await this.client.roleDefinitions.delete(this.vaultUrl, roleScope, name, updatedOptions);\n });\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
|
-
import { KnownDataAction as KnownKeyVaultDataAction, KnownRoleScope as KnownKeyVaultRoleScope } from "./generated/index";
|
|
3
|
+
import { KnownDataAction as KnownKeyVaultDataAction, KnownRoleScope as KnownKeyVaultRoleScope, } from "./generated/index";
|
|
4
4
|
export { KnownKeyVaultDataAction, KnownKeyVaultRoleScope };
|
|
5
5
|
//# sourceMappingURL=accessControlModels.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accessControlModels.js","sourceRoot":"","sources":["../../../src/accessControlModels.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;
|
|
1
|
+
{"version":3,"file":"accessControlModels.js","sourceRoot":"","sources":["../../../src/accessControlModels.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAGL,eAAe,IAAI,uBAAuB,EAC1C,cAAc,IAAI,sBAAsB,GACzC,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAyC,uBAAuB,EAAE,sBAAsB,EAAE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { CommonClientOptions, OperationOptions } from \"@azure/core-client\";\nimport {\n DataAction as KeyVaultDataAction,\n RoleScope as KeyVaultRoleScope,\n KnownDataAction as KnownKeyVaultDataAction,\n KnownRoleScope as KnownKeyVaultRoleScope,\n} from \"./generated/index\";\nimport { SUPPORTED_API_VERSIONS } from \"./constants\";\n\nexport { KeyVaultDataAction, KeyVaultRoleScope, KnownKeyVaultDataAction, KnownKeyVaultRoleScope };\n\n/**\n * The optional parameters accepted by the Key Vault's AccessControlClient\n */\nexport interface AccessControlClientOptions extends CommonClientOptions {\n /**\n * The accepted versions of the Key Vault's service API.\n */\n serviceVersion?: SUPPORTED_API_VERSIONS;\n}\n\n/**\n * A Key Vault role assignment.\n */\nexport interface KeyVaultRoleAssignment {\n /**\n * The role assignment ID.\n */\n readonly id: string;\n /**\n * The role assignment name.\n */\n readonly name: string;\n /**\n * The role assignment type.\n */\n readonly kind: string;\n /**\n * Role assignment properties.\n */\n properties: KeyVaultRoleAssignmentProperties;\n}\n\n/**\n * A list of Key Vault permissions.\n */\nexport interface KeyVaultPermission {\n /**\n * Allowed actions.\n */\n actions?: string[];\n /**\n * Actions that are excluded but not denied. They may be granted by other role definitions assigned to a principal.\n */\n notActions?: string[];\n /**\n * Allowed Data actions.\n */\n dataActions?: KeyVaultDataAction[];\n /**\n * Data actions that are excluded but not denied. They may be granted by other role definitions assigned to a principal.\n */\n notDataActions?: KeyVaultDataAction[];\n}\n\n/**\n * A Key Vault role definition.\n */\nexport interface KeyVaultRoleDefinition {\n /**\n * The role definition ID.\n */\n readonly id: string;\n /**\n * The role definition name.\n */\n readonly name: string;\n /**\n * The role definition type.\n */\n readonly kind: string;\n /**\n * The role name.\n */\n roleName: string;\n /**\n * The role definition description.\n */\n description: string;\n /**\n * The role type.\n */\n roleType: string;\n /**\n * A list of Key Vault permissions.\n */\n permissions: KeyVaultPermission[];\n /**\n * Role definition assignable scopes.\n */\n assignableScopes: string[];\n}\n\n/**\n * Role assignment properties.\n */\nexport interface KeyVaultRoleAssignmentProperties {\n /**\n * The role definition ID.\n */\n roleDefinitionId: string;\n /**\n * The principal ID.\n */\n principalId: string;\n /**\n * The role assignment scope.\n */\n scope?: KeyVaultRoleScope;\n}\n\n/**\n * An interface representing the optional parameters that can be\n * passed to {@link createRoleAssignment}\n */\nexport interface CreateRoleAssignmentOptions extends OperationOptions {}\n\n/**\n * An interface representing the optional parameters that can be\n * passed to {@link deleteRoleAssignment}\n */\nexport interface DeleteRoleAssignmentOptions extends OperationOptions {}\n\n/**\n * An interface representing the optional parameters that can be\n * passed to {@link getRoleAssignment}\n */\nexport interface GetRoleAssignmentOptions extends OperationOptions {}\n\n/**\n * An interface representing optional parameters passed to {@link listRoleAssignments}.\n */\nexport interface ListRoleAssignmentsOptions extends OperationOptions {}\n\n/**\n * An interface representing optional parameters passed to {@link listRoleDefinitions}.\n */\nexport interface ListRoleDefinitionsOptions extends OperationOptions {}\n\n/**\n * An interface representing optional parameters passed to {@link getRoleDefinition}.\n */\nexport interface GetRoleDefinitionOptions extends OperationOptions {}\n\n/**\n * An interface representing optional parameters passed to {@link setRoleDefinition}.\n */\nexport interface SetRoleDefinitionOptions extends OperationOptions {\n /**\n * UUID used as the name of the role definition to create. If it's not provided, a new UUID will be generated.\n */\n roleDefinitionName?: string;\n /**\n * Friendly display name for the role definition.\n */\n roleName?: string;\n /**\n * Long-form description of the role definition.\n */\n description?: string;\n /**\n * List of Key Vault permissions\n */\n permissions?: KeyVaultPermission[];\n /**\n * List of assignable Key Vault role scopes\n */\n assignableScopes?: KeyVaultRoleScope[];\n}\n\n/**\n * An interface representing optional parameters passed to {@link deleteRoleDefinition}.\n */\nexport interface DeleteRoleDefinitionOptions extends OperationOptions {}\n\n/**\n * Arguments for retrieving the next page of search results.\n */\nexport interface ListRoleDefinitionsPageSettings {\n /**\n * A token used for retrieving the next page of results when the server\n * enforces pagination.\n */\n continuationToken?: string;\n}\n\n/**\n * Arguments for retrieving the next page of search results.\n */\nexport interface ListRoleAssignmentsPageSettings {\n /**\n * A token used for retrieving the next page of results when the server\n * enforces pagination.\n */\n continuationToken?: string;\n}\n"]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
|
-
import { KeyVaultClient } from "./generated/keyVaultClient";
|
|
4
3
|
import { LATEST_API_VERSION, authenticationScopes } from "./constants";
|
|
5
|
-
import { logger } from "./log";
|
|
6
4
|
import { KeyVaultBackupPoller } from "./lro/backup/poller";
|
|
5
|
+
import { KeyVaultClient } from "./generated/keyVaultClient";
|
|
7
6
|
import { KeyVaultRestorePoller } from "./lro/restore/poller";
|
|
8
7
|
import { KeyVaultSelectiveKeyRestorePoller } from "./lro/selectiveKeyRestore/poller";
|
|
9
|
-
import { mappings } from "./mappings";
|
|
10
8
|
import { bearerTokenAuthenticationPolicy } from "@azure/core-rest-pipeline";
|
|
11
9
|
import { createChallengeCallbacks } from "./challengeAuthenticationCallbacks";
|
|
10
|
+
import { logger } from "./log";
|
|
11
|
+
import { mappings } from "./mappings";
|
|
12
12
|
/**
|
|
13
13
|
* The KeyVaultBackupClient provides methods to generate backups
|
|
14
14
|
* and restore backups of any given Azure Key Vault instance.
|
|
@@ -41,14 +41,14 @@ export class KeyVaultBackupClient {
|
|
|
41
41
|
additionalAllowedHeaderNames: [
|
|
42
42
|
"x-ms-keyvault-region",
|
|
43
43
|
"x-ms-keyvault-network-info",
|
|
44
|
-
"x-ms-keyvault-service-version"
|
|
45
|
-
]
|
|
44
|
+
"x-ms-keyvault-service-version",
|
|
45
|
+
],
|
|
46
46
|
} });
|
|
47
47
|
this.client = new KeyVaultClient(apiVersion, clientOptions);
|
|
48
48
|
this.client.pipeline.addPolicy(bearerTokenAuthenticationPolicy({
|
|
49
49
|
credential,
|
|
50
50
|
scopes: authenticationScopes,
|
|
51
|
-
challengeCallbacks: createChallengeCallbacks()
|
|
51
|
+
challengeCallbacks: createChallengeCallbacks(),
|
|
52
52
|
}));
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
@@ -90,7 +90,7 @@ export class KeyVaultBackupClient {
|
|
|
90
90
|
vaultUrl: this.vaultUrl,
|
|
91
91
|
intervalInMs: options.intervalInMs,
|
|
92
92
|
resumeFrom: options.resumeFrom,
|
|
93
|
-
requestOptions: options
|
|
93
|
+
requestOptions: options,
|
|
94
94
|
});
|
|
95
95
|
// This will initialize the poller's operation (the generation of the backup).
|
|
96
96
|
await poller.poll();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backupClient.js","sourceRoot":"","sources":["../../../src/backupClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAU5D,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,iCAAiC,EAAE,MAAM,kCAAkC,CAAC;AAKrF,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAS9E;;;;;GAKG;AACH,MAAM,OAAO,oBAAoB;IAY/B;;;;;;;;;;;;;;;;OAgBG;IACH,YACE,QAAgB,EAChB,UAA2B,EAC3B,UAAuC,EAAE;QAEzC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,MAAM,UAAU,GAAG,OAAO,CAAC,cAAc,IAAI,kBAAkB,CAAC;QAEhE,MAAM,aAAa,mCACd,OAAO,KACV,cAAc,EAAE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,EAAE,OAAO,IACvB,CAAC;QAEH,8EAA8E;QAC9E,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QAEpB,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACI,KAAK,CAAC,wBAAwB,CACnC,OAAe,EACf,SAAiB,EACjB,QAAgB,EAChB,UAAmD,EAAE;QAIrD,MAAM,MAAM,GAAG,IAAI,iCAAiC,iCAC/C,QAAQ,CAAC,cAAc,CAAC,SAAS,CAAC,KACrC,OAAO;YACP,QAAQ,EACR,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,YAAY,EAAE,OAAO,CAAC,YAAY,EAClC,UAAU,EAAE,OAAO,CAAC,UAAU,EAC9B,cAAc,EAAE,OAAO,IACvB,CAAC;QAEH,8EAA8E;QAC9E,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QAEpB,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { PollerLike } from \"@azure/core-lro\";\n\nimport { KeyVaultClient } from \"./generated/keyVaultClient\";\nimport {\n KeyVaultBackupClientOptions,\n KeyVaultBackupResult,\n KeyVaultBeginBackupOptions,\n KeyVaultBeginRestoreOptions,\n KeyVaultBeginSelectiveKeyRestoreOptions,\n KeyVaultRestoreResult,\n KeyVaultSelectiveKeyRestoreResult\n} from \"./backupClientModels\";\nimport { LATEST_API_VERSION, authenticationScopes } from \"./constants\";\nimport { logger } from \"./log\";\nimport { KeyVaultBackupPoller } from \"./lro/backup/poller\";\nimport { KeyVaultRestorePoller } from \"./lro/restore/poller\";\nimport { KeyVaultSelectiveKeyRestorePoller } from \"./lro/selectiveKeyRestore/poller\";\nimport { KeyVaultBackupOperationState } from \"./lro/backup/operation\";\nimport { KeyVaultRestoreOperationState } from \"./lro/restore/operation\";\nimport { KeyVaultAdminPollOperationState } from \"./lro/keyVaultAdminPoller\";\nimport { KeyVaultSelectiveKeyRestoreOperationState } from \"./lro/selectiveKeyRestore/operation\";\nimport { mappings } from \"./mappings\";\nimport { TokenCredential } from \"@azure/core-auth\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\nimport { createChallengeCallbacks } from \"./challengeAuthenticationCallbacks\";\n\nexport {\n KeyVaultBackupOperationState,\n KeyVaultRestoreOperationState,\n KeyVaultSelectiveKeyRestoreOperationState,\n KeyVaultAdminPollOperationState\n};\n\n/**\n * The KeyVaultBackupClient provides methods to generate backups\n * and restore backups of any given Azure Key Vault instance.\n * This client supports generating full backups, selective restores of specific keys\n * and full restores of Key Vault instances.\n */\nexport class KeyVaultBackupClient {\n /**\n * The base URL to the vault\n */\n public readonly vaultUrl: string;\n\n /**\n * @internal\n * A reference to the auto-generated Key Vault HTTP client.\n */\n private readonly client: KeyVaultClient;\n\n /**\n * Creates an instance of the KeyVaultBackupClient.\n *\n * Example usage:\n * ```ts\n * import { KeyVaultBackupClient } from \"@azure/keyvault-admin\";\n * import { DefaultAzureCredential } from \"@azure/identity\";\n *\n * let vaultUrl = `https://<MY KEY VAULT HERE>.vault.azure.net`;\n * let credentials = new DefaultAzureCredential();\n *\n * let client = new KeyVaultBackupClient(vaultUrl, credentials);\n * ```\n * @param vaultUrl - the URL of the Key Vault. It should have this shape: `https://${your-key-vault-name}.vault.azure.net`\n * @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.\n * @param options - options used to configure Key Vault API requests.\n */\n constructor(\n vaultUrl: string,\n credential: TokenCredential,\n options: KeyVaultBackupClientOptions = {}\n ) {\n this.vaultUrl = vaultUrl;\n\n const apiVersion = options.serviceVersion || LATEST_API_VERSION;\n\n const clientOptions = {\n ...options,\n loggingOptions: {\n logger: logger.info,\n additionalAllowedHeaderNames: [\n \"x-ms-keyvault-region\",\n \"x-ms-keyvault-network-info\",\n \"x-ms-keyvault-service-version\"\n ]\n }\n };\n\n this.client = new KeyVaultClient(apiVersion, clientOptions);\n this.client.pipeline.addPolicy(\n bearerTokenAuthenticationPolicy({\n credential,\n scopes: authenticationScopes,\n challengeCallbacks: createChallengeCallbacks()\n })\n );\n }\n\n /**\n * Starts generating a backup of an Azure Key Vault on the specified Storage Blob account.\n *\n * This function returns a Long Running Operation poller that allows you to wait indefinitely until the Key Vault backup is generated.\n *\n * Example usage:\n * ```ts\n * const client = new KeyVaultBackupClient(url, credentials);\n *\n * const blobStorageUri = \"<blob-storage-uri>\"; // <Blob storage URL>/<folder name>\n * const sasToken = \"<sas-token>\";\n * const poller = await client.beginBackup(blobStorageUri, sasToken);\n *\n * // Serializing the poller\n * //\n * // const serialized = poller.toString();\n * //\n * // A new poller can be created with:\n * //\n * // await client.beginBackup(blobStorageUri, sasToken, { resumeFrom: serialized });\n * //\n *\n * // Waiting until it's done\n * const backupUri = await poller.pollUntilDone();\n * console.log(backupUri);\n * ```\n * Starts a full backup operation.\n * @param blobStorageUri - The URL of the blob storage resource, including the path to the container where the backup will end up being stored.\n * @param sasToken - The SAS token.\n * @param options - The optional parameters.\n */\n public async beginBackup(\n blobStorageUri: string,\n sasToken: string,\n options: KeyVaultBeginBackupOptions = {}\n ): Promise<PollerLike<KeyVaultBackupOperationState, KeyVaultBackupResult>> {\n const poller = new KeyVaultBackupPoller({\n blobStorageUri,\n sasToken,\n client: this.client,\n vaultUrl: this.vaultUrl,\n intervalInMs: options.intervalInMs,\n resumeFrom: options.resumeFrom,\n requestOptions: options\n });\n\n // This will initialize the poller's operation (the generation of the backup).\n await poller.poll();\n\n return poller;\n }\n\n /**\n * Starts restoring all key materials using the SAS token pointing to a previously stored Azure Blob storage\n * backup folder.\n *\n * This function returns a Long Running Operation poller that allows you to wait indefinitely until the Key Vault restore operation is complete.\n *\n * Example usage:\n * ```ts\n * const client = new KeyVaultBackupClient(url, credentials);\n *\n * const blobStorageUri = \"<blob-storage-uri>\"; // <Blob storage URL>/<folder name>\n * const sasToken = \"<sas-token>\";\n * const poller = await client.beginRestore(blobStorageUri, sasToken);\n *\n * // The poller can be serialized with:\n * //\n * // const serialized = poller.toString();\n * //\n * // A new poller can be created with:\n * //\n * // await client.beginRestore(blobStorageUri, sasToken, { resumeFrom: serialized });\n * //\n *\n * // Waiting until it's done\n * const backupUri = await poller.pollUntilDone();\n * console.log(backupUri);\n * ```\n * Starts a full restore operation.\n * @param folderUri - The URL of the blob storage resource where the previous successful full backup was stored.\n * @param sasToken - The SAS token.\n * @param options - The optional parameters.\n */\n public async beginRestore(\n folderUri: string,\n sasToken: string,\n options: KeyVaultBeginRestoreOptions = {}\n ): Promise<PollerLike<KeyVaultRestoreOperationState, KeyVaultRestoreResult>> {\n const poller = new KeyVaultRestorePoller({\n ...mappings.folderUriParts(folderUri),\n sasToken,\n client: this.client,\n vaultUrl: this.vaultUrl,\n intervalInMs: options.intervalInMs,\n resumeFrom: options.resumeFrom,\n requestOptions: options\n });\n\n // This will initialize the poller's operation (the generation of the backup).\n await poller.poll();\n\n return poller;\n }\n\n /**\n * Starts restoring all key versions of a given key using user supplied SAS token pointing to a previously\n * stored Azure Blob storage backup folder.\n *\n * This function returns a Long Running Operation poller that allows you to wait indefinitely until the Key Vault selective restore is complete.\n *\n * Example usage:\n * ```ts\n * const client = new KeyVaultBackupClient(url, credentials);\n *\n * const blobStorageUri = \"<blob-storage-uri>\";\n * const sasToken = \"<sas-token>\";\n * const keyName = \"<key-name>\";\n * const poller = await client.beginSelectiveKeyRestore(keyName, blobStorageUri, sasToken);\n *\n * // Serializing the poller\n * //\n * // const serialized = poller.toString();\n * //\n * // A new poller can be created with:\n * //\n * // await client.beginSelectiveKeyRestore(keyName, blobStorageUri, sasToken, { resumeFrom: serialized });\n * //\n *\n * // Waiting until it's done\n * await poller.pollUntilDone();\n * ```\n * Creates a new role assignment.\n * @param keyName - The name of the key that wants to be restored.\n * @param folderUri - The URL of the blob storage resource, with the folder name of the blob where the previous successful full backup was stored.\n * @param sasToken - The SAS token.\n * @param options - The optional parameters.\n */\n public async beginSelectiveKeyRestore(\n keyName: string,\n folderUri: string,\n sasToken: string,\n options: KeyVaultBeginSelectiveKeyRestoreOptions = {}\n ): Promise<\n PollerLike<KeyVaultSelectiveKeyRestoreOperationState, KeyVaultSelectiveKeyRestoreResult>\n > {\n const poller = new KeyVaultSelectiveKeyRestorePoller({\n ...mappings.folderUriParts(folderUri),\n keyName,\n sasToken,\n client: this.client,\n vaultUrl: this.vaultUrl,\n intervalInMs: options.intervalInMs,\n resumeFrom: options.resumeFrom,\n requestOptions: options\n });\n\n // This will initialize the poller's operation (the generation of the backup).\n await poller.poll();\n\n return poller;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"backupClient.js","sourceRoot":"","sources":["../../../src/backupClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAWlC,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAE,iCAAiC,EAAE,MAAM,kCAAkC,CAAC;AAGrF,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAStC;;;;;GAKG;AACH,MAAM,OAAO,oBAAoB;IAW/B;;;;;;;;;;;;;;;;OAgBG;IACH,YACE,QAAgB,EAChB,UAA2B,EAC3B,UAAuC,EAAE;QAEzC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,MAAM,UAAU,GAAG,O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EACvB,YAAY,EAAE,OAAO,CAAC,YAAY,EAClC,UAAU,EAAE,OAAO,CAAC,UAAU,EAC9B,cAAc,EAAE,OAAO,IACvB,CAAC;QAEH,8EAA8E;QAC9E,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QAEpB,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACI,KAAK,CAAC,wBAAwB,CACnC,OAAe,EACf,SAAiB,EACjB,QAAgB,EAChB,UAAmD,EAAE;QAIrD,MAAM,MAAM,GAAG,IAAI,iCAAiC,iCAC/C,QAAQ,CAAC,cAAc,CAAC,SAAS,CAAC,KACrC,OAAO;YACP,QAAQ,EACR,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,YAAY,EAAE,OAAO,CAAC,YAAY,EAClC,UAAU,EAAE,OAAO,CAAC,UAAU,EAC9B,cAAc,EAAE,OAAO,IACvB,CAAC;QAEH,8EAA8E;QAC9E,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QAEpB,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n KeyVaultBackupClientOptions,\n KeyVaultBackupResult,\n KeyVaultBeginBackupOptions,\n KeyVaultBeginRestoreOptions,\n KeyVaultBeginSelectiveKeyRestoreOptions,\n KeyVaultRestoreResult,\n KeyVaultSelectiveKeyRestoreResult,\n} from \"./backupClientModels\";\nimport { LATEST_API_VERSION, authenticationScopes } from \"./constants\";\nimport { KeyVaultAdminPollOperationState } from \"./lro/keyVaultAdminPoller\";\nimport { KeyVaultBackupOperationState } from \"./lro/backup/operation\";\nimport { KeyVaultBackupPoller } from \"./lro/backup/poller\";\nimport { KeyVaultClient } from \"./generated/keyVaultClient\";\nimport { KeyVaultRestoreOperationState } from \"./lro/restore/operation\";\nimport { KeyVaultRestorePoller } from \"./lro/restore/poller\";\nimport { KeyVaultSelectiveKeyRestoreOperationState } from \"./lro/selectiveKeyRestore/operation\";\nimport { KeyVaultSelectiveKeyRestorePoller } from \"./lro/selectiveKeyRestore/poller\";\nimport { PollerLike } from \"@azure/core-lro\";\nimport { TokenCredential } from \"@azure/core-auth\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\nimport { createChallengeCallbacks } from \"./challengeAuthenticationCallbacks\";\nimport { logger } from \"./log\";\nimport { mappings } from \"./mappings\";\n\nexport {\n KeyVaultBackupOperationState,\n KeyVaultRestoreOperationState,\n KeyVaultSelectiveKeyRestoreOperationState,\n KeyVaultAdminPollOperationState,\n};\n\n/**\n * The KeyVaultBackupClient provides methods to generate backups\n * and restore backups of any given Azure Key Vault instance.\n * This client supports generating full backups, selective restores of specific keys\n * and full restores of Key Vault instances.\n */\nexport class KeyVaultBackupClient {\n /**\n * The base URL to the vault\n */\n public readonly vaultUrl: string;\n\n /**\n * A reference to the auto-generated Key Vault HTTP client.\n */\n private readonly client: KeyVaultClient;\n\n /**\n * Creates an instance of the KeyVaultBackupClient.\n *\n * Example usage:\n * ```ts\n * import { KeyVaultBackupClient } from \"@azure/keyvault-admin\";\n * import { DefaultAzureCredential } from \"@azure/identity\";\n *\n * let vaultUrl = `https://<MY KEY VAULT HERE>.vault.azure.net`;\n * let credentials = new DefaultAzureCredential();\n *\n * let client = new KeyVaultBackupClient(vaultUrl, credentials);\n * ```\n * @param vaultUrl - the URL of the Key Vault. It should have this shape: `https://${your-key-vault-name}.vault.azure.net`\n * @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.\n * @param options - options used to configure Key Vault API requests.\n */\n constructor(\n vaultUrl: string,\n credential: TokenCredential,\n options: KeyVaultBackupClientOptions = {}\n ) {\n this.vaultUrl = vaultUrl;\n\n const apiVersion = options.serviceVersion || LATEST_API_VERSION;\n\n const clientOptions = {\n ...options,\n loggingOptions: {\n logger: logger.info,\n additionalAllowedHeaderNames: [\n \"x-ms-keyvault-region\",\n \"x-ms-keyvault-network-info\",\n \"x-ms-keyvault-service-version\",\n ],\n },\n };\n\n this.client = new KeyVaultClient(apiVersion, clientOptions);\n this.client.pipeline.addPolicy(\n bearerTokenAuthenticationPolicy({\n credential,\n scopes: authenticationScopes,\n challengeCallbacks: createChallengeCallbacks(),\n })\n );\n }\n\n /**\n * Starts generating a backup of an Azure Key Vault on the specified Storage Blob account.\n *\n * This function returns a Long Running Operation poller that allows you to wait indefinitely until the Key Vault backup is generated.\n *\n * Example usage:\n * ```ts\n * const client = new KeyVaultBackupClient(url, credentials);\n *\n * const blobStorageUri = \"<blob-storage-uri>\"; // <Blob storage URL>/<folder name>\n * const sasToken = \"<sas-token>\";\n * const poller = await client.beginBackup(blobStorageUri, sasToken);\n *\n * // Serializing the poller\n * //\n * // const serialized = poller.toString();\n * //\n * // A new poller can be created with:\n * //\n * // await client.beginBackup(blobStorageUri, sasToken, { resumeFrom: serialized });\n * //\n *\n * // Waiting until it's done\n * const backupUri = await poller.pollUntilDone();\n * console.log(backupUri);\n * ```\n * Starts a full backup operation.\n * @param blobStorageUri - The URL of the blob storage resource, including the path to the container where the backup will end up being stored.\n * @param sasToken - The SAS token.\n * @param options - The optional parameters.\n */\n public async beginBackup(\n blobStorageUri: string,\n sasToken: string,\n options: KeyVaultBeginBackupOptions = {}\n ): Promise<PollerLike<KeyVaultBackupOperationState, KeyVaultBackupResult>> {\n const poller = new KeyVaultBackupPoller({\n blobStorageUri,\n sasToken,\n client: this.client,\n vaultUrl: this.vaultUrl,\n intervalInMs: options.intervalInMs,\n resumeFrom: options.resumeFrom,\n requestOptions: options,\n });\n\n // This will initialize the poller's operation (the generation of the backup).\n await poller.poll();\n\n return poller;\n }\n\n /**\n * Starts restoring all key materials using the SAS token pointing to a previously stored Azure Blob storage\n * backup folder.\n *\n * This function returns a Long Running Operation poller that allows you to wait indefinitely until the Key Vault restore operation is complete.\n *\n * Example usage:\n * ```ts\n * const client = new KeyVaultBackupClient(url, credentials);\n *\n * const blobStorageUri = \"<blob-storage-uri>\"; // <Blob storage URL>/<folder name>\n * const sasToken = \"<sas-token>\";\n * const poller = await client.beginRestore(blobStorageUri, sasToken);\n *\n * // The poller can be serialized with:\n * //\n * // const serialized = poller.toString();\n * //\n * // A new poller can be created with:\n * //\n * // await client.beginRestore(blobStorageUri, sasToken, { resumeFrom: serialized });\n * //\n *\n * // Waiting until it's done\n * const backupUri = await poller.pollUntilDone();\n * console.log(backupUri);\n * ```\n * Starts a full restore operation.\n * @param folderUri - The URL of the blob storage resource where the previous successful full backup was stored.\n * @param sasToken - The SAS token.\n * @param options - The optional parameters.\n */\n public async beginRestore(\n folderUri: string,\n sasToken: string,\n options: KeyVaultBeginRestoreOptions = {}\n ): Promise<PollerLike<KeyVaultRestoreOperationState, KeyVaultRestoreResult>> {\n const poller = new KeyVaultRestorePoller({\n ...mappings.folderUriParts(folderUri),\n sasToken,\n client: this.client,\n vaultUrl: this.vaultUrl,\n intervalInMs: options.intervalInMs,\n resumeFrom: options.resumeFrom,\n requestOptions: options,\n });\n\n // This will initialize the poller's operation (the generation of the backup).\n await poller.poll();\n\n return poller;\n }\n\n /**\n * Starts restoring all key versions of a given key using user supplied SAS token pointing to a previously\n * stored Azure Blob storage backup folder.\n *\n * This function returns a Long Running Operation poller that allows you to wait indefinitely until the Key Vault selective restore is complete.\n *\n * Example usage:\n * ```ts\n * const client = new KeyVaultBackupClient(url, credentials);\n *\n * const blobStorageUri = \"<blob-storage-uri>\";\n * const sasToken = \"<sas-token>\";\n * const keyName = \"<key-name>\";\n * const poller = await client.beginSelectiveKeyRestore(keyName, blobStorageUri, sasToken);\n *\n * // Serializing the poller\n * //\n * // const serialized = poller.toString();\n * //\n * // A new poller can be created with:\n * //\n * // await client.beginSelectiveKeyRestore(keyName, blobStorageUri, sasToken, { resumeFrom: serialized });\n * //\n *\n * // Waiting until it's done\n * await poller.pollUntilDone();\n * ```\n * Creates a new role assignment.\n * @param keyName - The name of the key that wants to be restored.\n * @param folderUri - The URL of the blob storage resource, with the folder name of the blob where the previous successful full backup was stored.\n * @param sasToken - The SAS token.\n * @param options - The optional parameters.\n */\n public async beginSelectiveKeyRestore(\n keyName: string,\n folderUri: string,\n sasToken: string,\n options: KeyVaultBeginSelectiveKeyRestoreOptions = {}\n ): Promise<\n PollerLike<KeyVaultSelectiveKeyRestoreOperationState, KeyVaultSelectiveKeyRestoreResult>\n > {\n const poller = new KeyVaultSelectiveKeyRestorePoller({\n ...mappings.folderUriParts(folderUri),\n keyName,\n sasToken,\n client: this.client,\n vaultUrl: this.vaultUrl,\n intervalInMs: options.intervalInMs,\n resumeFrom: options.resumeFrom,\n requestOptions: options,\n });\n\n // This will initialize the poller's operation (the generation of the backup).\n await poller.poll();\n\n return poller;\n }\n}\n"]}
|
|
@@ -21,9 +21,9 @@ export function createChallengeCallbacks() {
|
|
|
21
21
|
return {
|
|
22
22
|
abortSignal: request.abortSignal,
|
|
23
23
|
requestOptions: {
|
|
24
|
-
timeout: request.timeout
|
|
24
|
+
timeout: request.timeout,
|
|
25
25
|
},
|
|
26
|
-
tracingOptions: request.tracingOptions
|
|
26
|
+
tracingOptions: request.tracingOptions,
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
async function authorizeRequest(options) {
|
|
@@ -33,7 +33,7 @@ export function createChallengeCallbacks() {
|
|
|
33
33
|
case "none":
|
|
34
34
|
challengeState = {
|
|
35
35
|
status: "started",
|
|
36
|
-
originalBody: request.body
|
|
36
|
+
originalBody: request.body,
|
|
37
37
|
};
|
|
38
38
|
request.body = null;
|
|
39
39
|
break;
|
|
@@ -69,13 +69,13 @@ export function createChallengeCallbacks() {
|
|
|
69
69
|
}
|
|
70
70
|
options.request.headers.set("Authorization", `Bearer ${accessToken.token}`);
|
|
71
71
|
challengeState = {
|
|
72
|
-
status: "complete"
|
|
72
|
+
status: "complete",
|
|
73
73
|
};
|
|
74
74
|
return true;
|
|
75
75
|
}
|
|
76
76
|
return {
|
|
77
77
|
authorizeRequest,
|
|
78
|
-
authorizeRequestOnChallenge
|
|
78
|
+
authorizeRequestOnChallenge,
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
81
|
//# sourceMappingURL=challengeAuthenticationCallbacks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"challengeAuthenticationCallbacks.js","sourceRoot":"","sources":["../../../src/challengeAuthenticationCallbacks.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;
|
|
1
|
+
{"version":3,"file":"challengeAuthenticationCallbacks.js","sourceRoot":"","sources":["../../../src/challengeAuthenticationCallbacks.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AASlC,OAAO,EAAyB,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AA4BxF;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,wBAAwB;IACtC,IAAI,cAAc,GAAmB,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAExD,SAAS,gBAAgB,CAAC,OAAwB;QAChD,OAAO;YACL,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,cAAc,EAAE;gBACd,OAAO,EAAE,OAAO,CAAC,OAAO;aACzB;YACD,cAAc,EAAE,OAAO,CAAC,cAAc;SACvC,CAAC;IACJ,CAAC;IAED,KAAK,UAAU,gBAAgB,CAAC,OAAgC;QAC9D,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;QACpC,MAAM,cAAc,GAAoB,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAElE,QAAQ,cAAc,CAAC,MAAM,EAAE;YAC7B,KAAK,MAAM;gBACT,cAAc,GAAG;oBACf,MAAM,EAAE,SAAS;oBACjB,YAAY,EAAE,OAAO,CAAC,IAAI;iBAC3B,CAAC;gBACF,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;gBACpB,MAAM;YACR,KAAK,SAAS;gBACZ,MAAM,CAAC,mD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GAAG,CAAC,eAAe,EAAE,UAAU,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC;QAE5E,cAAc,GAAG;YACf,MAAM,EAAE,UAAU;SACnB,CAAC;QAEF,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO;QACL,gBAAgB;QAChB,2BAA2B;KAC5B,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n AuthorizeRequestOnChallengeOptions,\n AuthorizeRequestOptions,\n ChallengeCallbacks,\n PipelineRequest,\n RequestBodyType,\n} from \"@azure/core-rest-pipeline\";\nimport { ParsedWWWAuthenticate, parseWWWAuthenticate } from \"../../keyvault-common/src\";\n\nimport { GetTokenOptions } from \"@azure/core-auth\";\n\n/**\n * @internal\n * Holds the state of Challenge Auth.\n * When making the first request we force Key Vault to begin a challenge\n * by clearing out the request body and storing it locally.\n *\n * Later on, the authorizeRequestOnChallenge callback will process the\n * challenge and, if ready to resend the original request, reset the body\n * so that it may be sent again.\n *\n * Once a client has succeeded once, we can start skipping CAE.\n */\ntype ChallengeState =\n | {\n status: \"none\";\n }\n | {\n status: \"started\";\n originalBody?: RequestBodyType;\n }\n | {\n status: \"complete\";\n };\n\n/**\n * @internal\n *\n * Creates challenge callback handlers to manage CAE lifecycle in Azure Key Vault.\n *\n * Key Vault supports other authentication schemes, but we ensure challenge authentication\n * is used by first sending a copy of the request, without authorization or content.\n *\n * when the challenge is received, it will be authenticated and used to send the original\n * request with authorization.\n *\n * Following the first request of a client, follow-up requests will get the cached token\n * if possible.\n */\nexport function createChallengeCallbacks(): ChallengeCallbacks {\n let challengeState: ChallengeState = { status: \"none\" };\n\n function requestToOptions(request: PipelineRequest): GetTokenOptions {\n return {\n abortSignal: request.abortSignal,\n requestOptions: {\n timeout: request.timeout,\n },\n tracingOptions: request.tracingOptions,\n };\n }\n\n async function authorizeRequest(options: AuthorizeRequestOptions) {\n const { scopes, request } = options;\n const requestOptions: GetTokenOptions = requestToOptions(request);\n\n switch (challengeState.status) {\n case \"none\":\n challengeState = {\n status: \"started\",\n originalBody: request.body,\n };\n request.body = null;\n break;\n case \"started\":\n break; // Retry, we should not overwrite the original body\n case \"complete\": {\n const token = await options.getAccessToken(scopes, requestOptions);\n if (token) {\n request.headers.set(\"authorization\", `Bearer ${token.token}`);\n }\n break;\n }\n }\n return Promise.resolve();\n }\n\n async function authorizeRequestOnChallenge(\n options: AuthorizeRequestOnChallengeOptions\n ): Promise<boolean> {\n const { scopes, request, response } = options;\n\n if (request.body === null && challengeState.status === \"started\") {\n // Reset the original body before doing anything else.\n // Note: If successful status will be \"complete\", otherwise \"none\" will\n // restart the process.\n request.body = challengeState.originalBody;\n }\n\n const getTokenOptions = requestToOptions(request);\n\n const challenge = response.headers.get(\"WWW-Authenticate\");\n if (!challenge) {\n throw new Error(\"Missing challenge.\");\n }\n const parsedChallenge: ParsedWWWAuthenticate = parseWWWAuthenticate(challenge) || [];\n\n const accessToken = await options.getAccessToken(\n parsedChallenge.scope ? [parsedChallenge.scope] : scopes,\n { ...getTokenOptions, tenantId: parsedChallenge.tenantId }\n );\n\n if (!accessToken) {\n return false;\n }\n\n options.request.headers.set(\"Authorization\", `Bearer ${accessToken.token}`);\n\n challengeState = {\n status: \"complete\",\n };\n\n return true;\n }\n\n return {\n authorizeRequest,\n authorizeRequestOnChallenge,\n };\n}\n"]}
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* Current version of the Key Vault Admin SDK.
|
|
5
5
|
*/
|
|
6
|
-
export const SDK_VERSION = "4.2.
|
|
6
|
+
export const SDK_VERSION = "4.2.1";
|
|
7
7
|
/**
|
|
8
8
|
* The latest supported Key Vault service API version.
|
|
9
9
|
*/
|
|
10
|
-
export const LATEST_API_VERSION = "7.3
|
|
10
|
+
export const LATEST_API_VERSION = "7.3";
|
|
11
11
|
/**
|
|
12
12
|
* Authentication scopes
|
|
13
13
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAW,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAW,OAAO,CAAC;AAE3C;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC;AAOxC;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,uCAAuC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Current version of the Key Vault Admin SDK.\n */\nexport const SDK_VERSION: string = \"4.2.1\";\n\n/**\n * The latest supported Key Vault service API version.\n */\nexport const LATEST_API_VERSION = \"7.3\";\n\n/**\n * Supported API versions\n */\nexport type SUPPORTED_API_VERSIONS = \"7.2\" | \"7.3\";\n\n/**\n * Authentication scopes\n */\nexport const authenticationScopes = [\"https://managedhsm.azure.net/.default\"];\n"]}
|
|
@@ -22,7 +22,8 @@ export class KeyVaultClient extends KeyVaultClientContext {
|
|
|
22
22
|
this.roleAssignments = new RoleAssignmentsImpl(this);
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
* Creates a full backup using a user-provided SAS token to an Azure blob storage container.
|
|
25
|
+
* Creates a full backup using a user-provided SAS token to an Azure blob storage container. This
|
|
26
|
+
* operation is supported only by the Managed HSM service.
|
|
26
27
|
* @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
|
|
27
28
|
* @param options The options parameters.
|
|
28
29
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyVaultClient.js","sourceRoot":"","sources":["../../../../src/generated/keyVaultClient.ts"],"names":[],"mappings":"AAAA;;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B;IAC3C,eAAe,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC;IACxC,aAAa,EAAE,CAAC,UAAU,CAAC,YAAY,EAAE,UAAU,CAAC,OAAO,CAAC;IAC5D,gBAAgB,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,WAAW,CAAC;IAC7D,SAAS,EAAE,MAAM;IACjB,UAAU;CACX,CAAC","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport * as coreClient from \"@azure/core-client\";\nimport { RoleDefinitionsImpl, RoleAssignmentsImpl } from \"./operations\";\nimport { RoleDefinitions, RoleAssignments } from \"./operationsInterfaces\";\nimport * as Parameters from \"./models/parameters\";\nimport * as Mappers from \"./models/mappers\";\nimport { KeyVaultClientContext } from \"./keyVaultClientContext\";\nimport {\n KeyVaultClientOptionalParams,\n ApiVersion73Preview,\n KeyVaultClientFullBackupOptionalParams,\n KeyVaultClientFullBackupResponse,\n KeyVaultClientFullBackupStatusOptionalParams,\n KeyVaultClientFullBackupStatusResponse,\n KeyVaultClientFullRestoreOperationOptionalParams,\n KeyVaultClientFullRestoreOperationResponse,\n KeyVaultClientRestoreStatusOptionalParams,\n KeyVaultClientRestoreStatusResponse,\n KeyVaultClientSelectiveKeyRestoreOperationOptionalParams,\n KeyVaultClientSelectiveKeyRestoreOperationResponse\n} from \"./models\";\n\nexport class KeyVaultClient extends KeyVaultClientContext {\n /**\n * Initializes a new instance of the KeyVaultClient class.\n * @param apiVersion Api Version\n * @param options The parameter options\n */\n constructor(\n apiVersion: ApiVersion73Preview,\n options?: KeyVaultClientOptionalParams\n ) {\n super(apiVersion, options);\n this.roleDefinitions = new RoleDefinitionsImpl(this);\n this.roleAssignments = new RoleAssignmentsImpl(this);\n }\n\n /**\n * Creates a full backup using a user-provided SAS token to an Azure blob storage container.\n * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.\n * @param options The options parameters.\n */\n fullBackup(\n vaultBaseUrl: string,\n options?: KeyVaultClientFullBackupOptionalParams\n ): Promise<KeyVaultClientFullBackupResponse> {\n return this.sendOperationRequest(\n { vaultBaseUrl, options },\n fullBackupOperationSpec\n );\n }\n\n /**\n * Returns the status of full backup operation\n * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.\n * @param jobId The id returned as part of the backup request\n * @param options The options parameters.\n */\n fullBackupStatus(\n vaultBaseUrl: string,\n jobId: string,\n options?: KeyVaultClientFullBackupStatusOptionalParams\n ): Promise<KeyVaultClientFullBackupStatusResponse> {\n return this.sendOperationRequest(\n { vaultBaseUrl, jobId, options },\n fullBackupStatusOperationSpec\n );\n }\n\n /**\n * Restores all key materials using the SAS token pointing to a previously stored Azure Blob storage\n * backup folder\n * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.\n * @param options The options parameters.\n */\n fullRestoreOperation(\n vaultBaseUrl: string,\n options?: KeyVaultClientFullRestoreOperationOptionalParams\n ): Promise<KeyVaultClientFullRestoreOperationResponse> {\n return this.sendOperationRequest(\n { vaultBaseUrl, options },\n fullRestoreOperationOperationSpec\n );\n }\n\n /**\n * Returns the status of restore operation\n * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.\n * @param jobId The Job Id returned part of the restore operation\n * @param options The options parameters.\n */\n restoreStatus(\n vaultBaseUrl: string,\n jobId: string,\n options?: KeyVaultClientRestoreStatusOptionalParams\n ): Promise<KeyVaultClientRestoreStatusResponse> {\n return this.sendOperationRequest(\n { vaultBaseUrl, jobId, options },\n restoreStatusOperationSpec\n );\n }\n\n /**\n * Restores all key versions of a given key using user supplied SAS token pointing to a previously\n * stored Azure Blob storage backup folder\n * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.\n * @param keyName The name of the key to be restored from the user supplied backup\n * @param options The options parameters.\n */\n selectiveKeyRestoreOperation(\n vaultBaseUrl: string,\n keyName: string,\n options?: KeyVaultClientSelectiveKeyRestoreOperationOptionalParams\n ): Promise<KeyVaultClientSelectiveKeyRestoreOperationResponse> {\n return this.sendOperationRequest(\n { vaultBaseUrl, keyName, options },\n selectiveKeyRestoreOperationOperationSpec\n );\n }\n\n roleDefinitions: RoleDefinitions;\n roleAssignments: RoleAssignments;\n}\n// Operation Specifications\nconst serializer = coreClient.createSerializer(Mappers, /* isXml */ false);\n\nconst fullBackupOperationSpec: coreClient.OperationSpec = {\n path: \"/backup\",\n httpMethod: \"POST\",\n responses: {\n 202: {\n bodyMapper: Mappers.FullBackupOperation,\n headersMapper: Mappers.KeyVaultClientFullBackupHeaders\n },\n default: {\n bodyMapper: Mappers.KeyVaultError\n }\n },\n requestBody: Parameters.azureStorageBlobContainerUri,\n queryParameters: [Parameters.apiVersion],\n urlParameters: [Parameters.vaultBaseUrl],\n headerParameters: [Parameters.accept, Parameters.contentType],\n mediaType: \"json\",\n serializer\n};\nconst fullBackupStatusOperationSpec: coreClient.OperationSpec = {\n path: \"/backup/{jobId}/pending\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.FullBackupOperation\n },\n default: {\n bodyMapper: Mappers.KeyVaultError\n }\n },\n queryParameters: [Parameters.apiVersion],\n urlParameters: [Parameters.vaultBaseUrl, Parameters.jobId],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst fullRestoreOperationOperationSpec: coreClient.OperationSpec = {\n path: \"/restore\",\n httpMethod: \"PUT\",\n responses: {\n 202: {\n bodyMapper: Mappers.RestoreOperation,\n headersMapper: Mappers.KeyVaultClientFullRestoreOperationHeaders\n },\n default: {\n bodyMapper: Mappers.KeyVaultError\n }\n },\n requestBody: Parameters.restoreBlobDetails,\n queryParameters: [Parameters.apiVersion],\n urlParameters: [Parameters.vaultBaseUrl],\n headerParameters: [Parameters.accept, Parameters.contentType],\n mediaType: \"json\",\n serializer\n};\nconst restoreStatusOperationSpec: coreClient.OperationSpec = {\n path: \"/restore/{jobId}/pending\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.RestoreOperation\n },\n default: {\n bodyMapper: Mappers.KeyVaultError\n }\n },\n queryParameters: [Parameters.apiVersion],\n urlParameters: [Parameters.vaultBaseUrl, Parameters.jobId],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst selectiveKeyRestoreOperationOperationSpec: coreClient.OperationSpec = {\n path: \"/keys/{keyName}/restore\",\n httpMethod: \"PUT\",\n responses: {\n 202: {\n bodyMapper: Mappers.SelectiveKeyRestoreOperation,\n headersMapper: Mappers.KeyVaultClientSelectiveKeyRestoreOperationHeaders\n },\n default: {\n bodyMapper: Mappers.KeyVaultError\n }\n },\n requestBody: Parameters.restoreBlobDetails1,\n queryParameters: [Parameters.apiVersion],\n urlParameters: [Parameters.vaultBaseUrl, Parameters.keyName],\n headerParameters: [Parameters.accept, Parameters.contentType],\n mediaType: \"json\",\n serializer\n};\n"]}
|
|
1
|
+
{"version":3,"file":"keyVaultClient.js","sourceRoot":"","sources":["../../../../src/generated/keyVaultClient.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExE,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAgBhE,MAAM,OAAO,cAAe,SAAQ,qBAAqB;IACvD;;;;OAIG;IACH,YACE,UAAwB,EACxB,OAAsC;QAEtC,KAAK,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QAC3B,IAAI,CAAC,eAAe,GAAG,IAAI,mBAAmB,CAAC,IAAI,CAAC,CAAC;QACrD,IAAI,CAAC,eAAe,GAAG,IAAI,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACvD,CAAC;IAED;;;;;OAKG;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E,0BAA0B;IAChC,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE;QACT,GAAG,EAAE;YACH,UAAU,EAAE,OAAO,CAAC,gBAAgB;SACrC;QACD,OAAO,EAAE;YACP,UAAU,EAAE,OAAO,CAAC,aAAa;SAClC;KACF;IACD,eAAe,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC;IACxC,aAAa,EAAE,CAAC,UAAU,CAAC,YAAY,EAAE,UAAU,CAAC,KAAK,CAAC;IAC1D,gBAAgB,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC;IACrC,UAAU;CACX,CAAC;AACF,MAAM,yCAAyC,GAA6B;IAC1E,IAAI,EAAE,yBAAyB;IAC/B,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE;QACT,GAAG,EAAE;YACH,UAAU,EAAE,OAAO,CAAC,4BAA4B;YAChD,aAAa,EAAE,OAAO,CAAC,iDAAiD;SACzE;QACD,OAAO,EAAE;YACP,UAAU,EAAE,OAAO,CAAC,aAAa;SAClC;KACF;IACD,WAAW,EAAE,UAAU,CAAC,mBAAmB;IAC3C,eAAe,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC;IACxC,aAAa,EAAE,CAAC,UAAU,CAAC,YAAY,EAAE,UAAU,CAAC,OAAO,CAAC;IAC5D,gBAAgB,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,WAAW,CAAC;IAC7D,SAAS,EAAE,MAAM;IACjB,UAAU;CACX,CAAC","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport * as coreClient from \"@azure/core-client\";\nimport { RoleDefinitionsImpl, RoleAssignmentsImpl } from \"./operations\";\nimport { RoleDefinitions, RoleAssignments } from \"./operationsInterfaces\";\nimport * as Parameters from \"./models/parameters\";\nimport * as Mappers from \"./models/mappers\";\nimport { KeyVaultClientContext } from \"./keyVaultClientContext\";\nimport {\n KeyVaultClientOptionalParams,\n ApiVersion73,\n FullBackupOptionalParams,\n FullBackupResponse,\n FullBackupStatusOptionalParams,\n FullBackupStatusResponse,\n FullRestoreOperationOptionalParams,\n FullRestoreOperationResponse,\n RestoreStatusOptionalParams,\n RestoreStatusResponse,\n SelectiveKeyRestoreOperationOptionalParams,\n SelectiveKeyRestoreOperationResponse\n} from \"./models\";\n\nexport class KeyVaultClient extends KeyVaultClientContext {\n /**\n * Initializes a new instance of the KeyVaultClient class.\n * @param apiVersion Api Version\n * @param options The parameter options\n */\n constructor(\n apiVersion: ApiVersion73,\n options?: KeyVaultClientOptionalParams\n ) {\n super(apiVersion, options);\n this.roleDefinitions = new RoleDefinitionsImpl(this);\n this.roleAssignments = new RoleAssignmentsImpl(this);\n }\n\n /**\n * Creates a full backup using a user-provided SAS token to an Azure blob storage container. This\n * operation is supported only by the Managed HSM service.\n * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.\n * @param options The options parameters.\n */\n fullBackup(\n vaultBaseUrl: string,\n options?: FullBackupOptionalParams\n ): Promise<FullBackupResponse> {\n return this.sendOperationRequest(\n { vaultBaseUrl, options },\n fullBackupOperationSpec\n );\n }\n\n /**\n * Returns the status of full backup operation\n * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.\n * @param jobId The id returned as part of the backup request\n * @param options The options parameters.\n */\n fullBackupStatus(\n vaultBaseUrl: string,\n jobId: string,\n options?: FullBackupStatusOptionalParams\n ): Promise<FullBackupStatusResponse> {\n return this.sendOperationRequest(\n { vaultBaseUrl, jobId, options },\n fullBackupStatusOperationSpec\n );\n }\n\n /**\n * Restores all key materials using the SAS token pointing to a previously stored Azure Blob storage\n * backup folder\n * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.\n * @param options The options parameters.\n */\n fullRestoreOperation(\n vaultBaseUrl: string,\n options?: FullRestoreOperationOptionalParams\n ): Promise<FullRestoreOperationResponse> {\n return this.sendOperationRequest(\n { vaultBaseUrl, options },\n fullRestoreOperationOperationSpec\n );\n }\n\n /**\n * Returns the status of restore operation\n * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.\n * @param jobId The Job Id returned part of the restore operation\n * @param options The options parameters.\n */\n restoreStatus(\n vaultBaseUrl: string,\n jobId: string,\n options?: RestoreStatusOptionalParams\n ): Promise<RestoreStatusResponse> {\n return this.sendOperationRequest(\n { vaultBaseUrl, jobId, options },\n restoreStatusOperationSpec\n );\n }\n\n /**\n * Restores all key versions of a given key using user supplied SAS token pointing to a previously\n * stored Azure Blob storage backup folder\n * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.\n * @param keyName The name of the key to be restored from the user supplied backup\n * @param options The options parameters.\n */\n selectiveKeyRestoreOperation(\n vaultBaseUrl: string,\n keyName: string,\n options?: SelectiveKeyRestoreOperationOptionalParams\n ): Promise<SelectiveKeyRestoreOperationResponse> {\n return this.sendOperationRequest(\n { vaultBaseUrl, keyName, options },\n selectiveKeyRestoreOperationOperationSpec\n );\n }\n\n roleDefinitions: RoleDefinitions;\n roleAssignments: RoleAssignments;\n}\n// Operation Specifications\nconst serializer = coreClient.createSerializer(Mappers, /* isXml */ false);\n\nconst fullBackupOperationSpec: coreClient.OperationSpec = {\n path: \"/backup\",\n httpMethod: \"POST\",\n responses: {\n 202: {\n bodyMapper: Mappers.FullBackupOperation,\n headersMapper: Mappers.KeyVaultClientFullBackupHeaders\n },\n default: {\n bodyMapper: Mappers.KeyVaultError\n }\n },\n requestBody: Parameters.azureStorageBlobContainerUri,\n queryParameters: [Parameters.apiVersion],\n urlParameters: [Parameters.vaultBaseUrl],\n headerParameters: [Parameters.accept, Parameters.contentType],\n mediaType: \"json\",\n serializer\n};\nconst fullBackupStatusOperationSpec: coreClient.OperationSpec = {\n path: \"/backup/{jobId}/pending\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.FullBackupOperation\n },\n default: {\n bodyMapper: Mappers.KeyVaultError\n }\n },\n queryParameters: [Parameters.apiVersion],\n urlParameters: [Parameters.vaultBaseUrl, Parameters.jobId],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst fullRestoreOperationOperationSpec: coreClient.OperationSpec = {\n path: \"/restore\",\n httpMethod: \"PUT\",\n responses: {\n 202: {\n bodyMapper: Mappers.RestoreOperation,\n headersMapper: Mappers.KeyVaultClientFullRestoreOperationHeaders\n },\n default: {\n bodyMapper: Mappers.KeyVaultError\n }\n },\n requestBody: Parameters.restoreBlobDetails,\n queryParameters: [Parameters.apiVersion],\n urlParameters: [Parameters.vaultBaseUrl],\n headerParameters: [Parameters.accept, Parameters.contentType],\n mediaType: \"json\",\n serializer\n};\nconst restoreStatusOperationSpec: coreClient.OperationSpec = {\n path: \"/restore/{jobId}/pending\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.RestoreOperation\n },\n default: {\n bodyMapper: Mappers.KeyVaultError\n }\n },\n queryParameters: [Parameters.apiVersion],\n urlParameters: [Parameters.vaultBaseUrl, Parameters.jobId],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst selectiveKeyRestoreOperationOperationSpec: coreClient.OperationSpec = {\n path: \"/keys/{keyName}/restore\",\n httpMethod: \"PUT\",\n responses: {\n 202: {\n bodyMapper: Mappers.SelectiveKeyRestoreOperation,\n headersMapper: Mappers.KeyVaultClientSelectiveKeyRestoreOperationHeaders\n },\n default: {\n bodyMapper: Mappers.KeyVaultError\n }\n },\n requestBody: Parameters.restoreBlobDetails1,\n queryParameters: [Parameters.apiVersion],\n urlParameters: [Parameters.vaultBaseUrl, Parameters.keyName],\n headerParameters: [Parameters.accept, Parameters.contentType],\n mediaType: \"json\",\n serializer\n};\n"]}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
7
|
*/
|
|
8
8
|
import * as coreClient from "@azure/core-client";
|
|
9
|
-
export const packageVersion = "4.2.
|
|
9
|
+
export const packageVersion = "4.2.1";
|
|
10
10
|
export class KeyVaultClientContext extends coreClient.ServiceClient {
|
|
11
11
|
/**
|
|
12
12
|
* Initializes a new instance of the KeyVaultClientContext class.
|
|
@@ -24,7 +24,7 @@ export class KeyVaultClientContext extends coreClient.ServiceClient {
|
|
|
24
24
|
const defaults = {
|
|
25
25
|
requestContentType: "application/json; charset=utf-8"
|
|
26
26
|
};
|
|
27
|
-
const packageDetails = `azsdk-js-keyvault-admin/4.2.0
|
|
27
|
+
const packageDetails = `azsdk-js-keyvault-admin/4.2.0`;
|
|
28
28
|
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
29
29
|
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
30
30
|
: `${packageDetails}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyVaultClientContext.js","sourceRoot":"","sources":["../../../../src/generated/keyVaultClientContext.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AAGjD,MAAM,CAAC,MAAM,cAAc,GAAG,
|
|
1
|
+
{"version":3,"file":"keyVaultClientContext.js","sourceRoot":"","sources":["../../../../src/generated/keyVaultClientContext.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AAGjD,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC;AAEtC,MAAM,OAAO,qBAAsB,SAAQ,UAAU,CAAC,aAAa;IAGjE;;;;OAIG;IACH,YACE,UAAwB,EACxB,OAAsC;QAEtC,IAAI,UAAU,KAAK,SAAS,EAAE;YAC5B,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;SAChD;QAED,0CAA0C;QAC1C,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,EAAE,CAAC;SACd;QACD,MAAM,QAAQ,GAAiC;YAC7C,kBAAkB,EAAE,iCAAiC;SACtD,CAAC;QAEF,MAAM,cAAc,GAAG,+BAA+B,CAAC;QACvD,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC,eAAe;YAClE,CAAC,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAe,IAAI,cAAc,EAAE;YACjE,CAAC,CAAC,GAAG,cAAc,EAAE,CAAC;QAE1B,MAAM,mBAAmB,iDACpB,QAAQ,GACR,OAAO,KACV,gBAAgB,EAAE;gBAChB,eAAe;aAChB,EACD,OAAO,EAAE,OAAO,CAAC,QAAQ,IAAI,gBAAgB,GAC9C,CAAC;QACF,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAC3B,wBAAwB;QACxB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CACF","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport * as coreClient from \"@azure/core-client\";\nimport { ApiVersion73, KeyVaultClientOptionalParams } from \"./models\";\n\nexport const packageVersion = \"4.2.1\";\n\nexport class KeyVaultClientContext extends coreClient.ServiceClient {\n apiVersion: ApiVersion73;\n\n /**\n * Initializes a new instance of the KeyVaultClientContext class.\n * @param apiVersion Api Version\n * @param options The parameter options\n */\n constructor(\n apiVersion: ApiVersion73,\n options?: KeyVaultClientOptionalParams\n ) {\n if (apiVersion === undefined) {\n throw new Error(\"'apiVersion' cannot be null\");\n }\n\n // Initializing default values for options\n if (!options) {\n options = {};\n }\n const defaults: KeyVaultClientOptionalParams = {\n requestContentType: \"application/json; charset=utf-8\"\n };\n\n const packageDetails = `azsdk-js-keyvault-admin/4.2.0`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`\n : `${packageDetails}`;\n\n const optionsWithDefaults = {\n ...defaults,\n ...options,\n userAgentOptions: {\n userAgentPrefix\n },\n baseUri: options.endpoint || \"{vaultBaseUrl}\"\n };\n super(optionsWithDefaults);\n // Parameter assignments\n this.apiVersion = apiVersion;\n }\n}\n"]}
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
6
6
|
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
7
|
*/
|
|
8
|
-
/** Known values of {@link
|
|
9
|
-
export var
|
|
10
|
-
(function (
|
|
11
|
-
/** Api Version '7.3
|
|
12
|
-
|
|
13
|
-
})(
|
|
8
|
+
/** Known values of {@link ApiVersion73} that the service accepts. */
|
|
9
|
+
export var KnownApiVersion73;
|
|
10
|
+
(function (KnownApiVersion73) {
|
|
11
|
+
/** Api Version '7.3' */
|
|
12
|
+
KnownApiVersion73["Seven3"] = "7.3";
|
|
13
|
+
})(KnownApiVersion73 || (KnownApiVersion73 = {}));
|
|
14
14
|
/** Known values of {@link RoleType} that the service accepts. */
|
|
15
15
|
export var KnownRoleType;
|
|
16
16
|
(function (KnownRoleType) {
|