1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | var tslib_1 = require("tslib");
|
4 |
|
5 |
|
6 | var MqttOverWSProvider_1 = require("./MqttOverWSProvider");
|
7 | var core_1 = require("@aws-amplify/core");
|
8 | var SERVICE_NAME = 'iotdevicegateway';
|
9 | var AWSIoTProvider = (function (_super) {
|
10 | tslib_1.__extends(AWSIoTProvider, _super);
|
11 | function AWSIoTProvider(options) {
|
12 | if (options === void 0) { options = {}; }
|
13 | return _super.call(this, options) || this;
|
14 | }
|
15 | Object.defineProperty(AWSIoTProvider.prototype, "region", {
|
16 | get: function () {
|
17 | return this.options['aws_pubsub_region'];
|
18 | },
|
19 | enumerable: true,
|
20 | configurable: true
|
21 | });
|
22 | AWSIoTProvider.prototype.getProviderName = function () {
|
23 | return 'AWSIoTProvider';
|
24 | };
|
25 | Object.defineProperty(AWSIoTProvider.prototype, "endpoint", {
|
26 | get: function () {
|
27 | var _this = this;
|
28 | return (function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
29 | var endpoint, serviceInfo, _a, access_key, secret_key, session_token, result;
|
30 | return tslib_1.__generator(this, function (_b) {
|
31 | switch (_b.label) {
|
32 | case 0:
|
33 | endpoint = this.options.aws_pubsub_endpoint;
|
34 | serviceInfo = {
|
35 | service: SERVICE_NAME,
|
36 | region: this.region,
|
37 | };
|
38 | return [4 , core_1.Credentials.get()];
|
39 | case 1:
|
40 | _a = _b.sent(), access_key = _a.accessKeyId, secret_key = _a.secretAccessKey, session_token = _a.sessionToken;
|
41 | result = core_1.Signer.signUrl(endpoint, { access_key: access_key, secret_key: secret_key, session_token: session_token }, serviceInfo);
|
42 | return [2 , result];
|
43 | }
|
44 | });
|
45 | }); })();
|
46 | },
|
47 | enumerable: true,
|
48 | configurable: true
|
49 | });
|
50 | return AWSIoTProvider;
|
51 | }(MqttOverWSProvider_1.MqttOverWSProvider));
|
52 | exports.AWSIoTProvider = AWSIoTProvider;
|
53 |
|
\ | No newline at end of file |