@azure/keyvault-secrets
Version:
Isomorphic client library for Azure KeyVault's secrets.
28 lines • 1.08 kB
JavaScript
;
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseKeyVaultSecretIdentifier = parseKeyVaultSecretIdentifier;
const keyvault_common_1 = require("@azure/keyvault-common");
/**
* Parses the given Key Vault Secret Id. An example is:
*
* https://<keyvault-name>.vault.azure.net/secrets/<secret-name>/<unique-version-id>
*
* On parsing the above Id, this function returns:
*```ts snippet:ignore
* {
* sourceId: "https://<keyvault-name>.vault.azure.net/secrets/<secret-name>/<unique-version-id>",
* vaultUrl: "https://<keyvault-name>.vault.azure.net",
* version: "<unique-version-id>",
* name: "<secret-name>"
* }
*```
* @param id - The Id of the Key Vault Secret.
*/
function parseKeyVaultSecretIdentifier(id) {
const urlParts = id.split("/");
const collection = urlParts[3];
return Object.assign({ sourceId: id }, (0, keyvault_common_1.parseKeyVaultIdentifier)(collection, id));
}
//# sourceMappingURL=identifier.js.map