No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

functions-secrets-get.js 1.0KB

123456789101112131415161718192021222324
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.command = void 0;
  4. const Table = require("cli-table");
  5. const command_1 = require("../command");
  6. const logger_1 = require("../logger");
  7. const projectUtils_1 = require("../projectUtils");
  8. const secretManager_1 = require("../gcp/secretManager");
  9. const requirePermissions_1 = require("../requirePermissions");
  10. exports.command = new command_1.Command("functions:secrets:get <KEY>")
  11. .description("Get metadata for secret and its versions")
  12. .before(requirePermissions_1.requirePermissions, ["secretmanager.secrets.get"])
  13. .action(async (key, options) => {
  14. const projectId = (0, projectUtils_1.needProjectId)(options);
  15. const versions = await (0, secretManager_1.listSecretVersions)(projectId, key);
  16. const table = new Table({
  17. head: ["Version", "State"],
  18. style: { head: ["yellow"] },
  19. });
  20. for (const version of versions) {
  21. table.push([version.versionId, version.state]);
  22. }
  23. logger_1.logger.info(table.toString());
  24. });