1 | // Copyright (c) Microsoft Corporation. All rights reserved.
|
2 | // Licensed under the MIT License. See License.txt in the project root for license information.
|
3 |
|
4 | import { ApiKeyCredentials, ApiKeyCredentialOptions } from "./apiKeyCredentials";
|
5 |
|
6 | export class DomainCredentials extends ApiKeyCredentials {
|
7 | /**
|
8 | * Creates a new EventGrid DomainCredentials object.
|
9 | *
|
10 | * @constructor
|
11 | * @param {string} domainKey The EventGrid domain key
|
12 | */
|
13 | constructor(domainKey: string) {
|
14 | if (!domainKey || (domainKey && typeof domainKey !== "string")) {
|
15 | throw new Error("domainKey cannot be null or undefined and must be of type string.");
|
16 | }
|
17 | const options: ApiKeyCredentialOptions = {
|
18 | inHeader: {
|
19 | "aeg-sas-key": domainKey,
|
20 | },
|
21 | };
|
22 | super(options);
|
23 | }
|
24 | }
|