topicCredentials.js 1010 B

1234567891011121314151617181920212223242526272829
  1. "use strict";
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. // Licensed under the MIT License. See License.txt in the project root for license information.
  4. Object.defineProperty(exports, "__esModule", { value: true });
  5. const ms_rest_js_1 = require("@azure/ms-rest-js");
  6. /**
  7. * Creates a new CognitiveServicesCredentials object.
  8. */
  9. class TopicCredentials extends ms_rest_js_1.ApiKeyCredentials {
  10. /**
  11. * Creates a new EventGrid TopicCredentials object.
  12. *
  13. * @constructor
  14. * @param {string} topicKey The EventGrid topic key
  15. */
  16. constructor(topicKey) {
  17. if (!topicKey || (topicKey && typeof topicKey !== "string")) {
  18. throw new Error(`topicKey cannot be null or undefined and must be of type string.`);
  19. }
  20. const options = {
  21. inHeader: {
  22. "aeg-sas-key": topicKey
  23. }
  24. };
  25. super(options);
  26. }
  27. }
  28. exports.TopicCredentials = TopicCredentials;
  29. //# sourceMappingURL=topicCredentials.js.map