@grafana/aws-sdk 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ConnectionConfig.d.ts +5 -4
- package/dist/ConnectionConfig.test.d.ts +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.development.js +79 -53
- package/dist/index.development.js.map +1 -1
- package/dist/index.production.js +1 -16
- package/dist/index.production.js.map +1 -1
- package/package.json +18 -8
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
2
|
import { DataSourcePluginOptionsEditorProps } from '@grafana/data';
|
|
3
|
-
import { AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData } from '
|
|
4
|
-
interface
|
|
3
|
+
import { AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData } from './types';
|
|
4
|
+
export interface ConnectionConfigProps<J = AwsAuthDataSourceJsonData, S = AwsAuthDataSourceSecureJsonData> extends DataSourcePluginOptionsEditorProps<J, S> {
|
|
5
5
|
standardRegions?: string[];
|
|
6
6
|
loadRegions?: () => Promise<string[]>;
|
|
7
7
|
defaultEndpoint?: string;
|
|
8
|
+
skipHeader?: boolean;
|
|
9
|
+
skipEndpoint?: boolean;
|
|
8
10
|
children?: React.ReactNode;
|
|
9
11
|
}
|
|
10
|
-
export declare const ConnectionConfig: FC<
|
|
11
|
-
export {};
|
|
12
|
+
export declare const ConnectionConfig: FC<ConnectionConfigProps>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom/extend-expect';
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ var React = require('react');
|
|
|
6
6
|
var React__default = _interopDefault(React);
|
|
7
7
|
var ui = require('@grafana/ui');
|
|
8
8
|
var data = require('@grafana/data');
|
|
9
|
-
var runtime = require('@grafana/runtime');
|
|
10
9
|
|
|
11
10
|
/*! *****************************************************************************
|
|
12
11
|
Copyright (c) Microsoft Corporation.
|
|
@@ -23,6 +22,17 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
23
22
|
PERFORMANCE OF THIS SOFTWARE.
|
|
24
23
|
***************************************************************************** */
|
|
25
24
|
|
|
25
|
+
var __assign = function() {
|
|
26
|
+
__assign = Object.assign || function __assign(t) {
|
|
27
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
28
|
+
s = arguments[i];
|
|
29
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
30
|
+
}
|
|
31
|
+
return t;
|
|
32
|
+
};
|
|
33
|
+
return __assign.apply(this, arguments);
|
|
34
|
+
};
|
|
35
|
+
|
|
26
36
|
function __read(o, n) {
|
|
27
37
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
28
38
|
if (!m) return o;
|
|
@@ -40,59 +50,8 @@ function __read(o, n) {
|
|
|
40
50
|
return ar;
|
|
41
51
|
}
|
|
42
52
|
|
|
43
|
-
var toOption = function (value) { return ({ value: value, label: value }); };
|
|
44
|
-
var ConnectionConfig = function (props) {
|
|
45
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
46
|
-
var _h = __read(React.useState((props.standardRegions || standardRegions).map(toOption)), 2), regions = _h[0], setRegions = _h[1];
|
|
47
|
-
React.useEffect(function () {
|
|
48
|
-
if (!props.loadRegions) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
props.loadRegions().then(function (regions) { return setRegions(regions.map(toOption)); });
|
|
52
|
-
}, [props.loadRegions]);
|
|
53
|
-
var options = props.options;
|
|
54
|
-
var profile = options.jsonData.profile;
|
|
55
|
-
if (profile === undefined) {
|
|
56
|
-
profile = options.database;
|
|
57
|
-
}
|
|
58
|
-
return (React__default.createElement(ui.FieldSet, { label: "Connection Details" },
|
|
59
|
-
React__default.createElement(ui.InlineField, { label: "Authentication Provider", labelWidth: 28, tooltip: "Specify which AWS credentials chain to use. AWS SDK Default is the recommended option for EKS, ECS, or if you've attached an IAM role to your EC2 instance." },
|
|
60
|
-
React__default.createElement(ui.Select, { className: "width-30", value: awsAuthProviderOptions.find(function (p) { return p.value === options.jsonData.authType; }) || awsAuthProviderOptions[0], options: awsAuthProviderOptions.filter(function (opt) { return runtime.config.awsAllowedAuthProviders.includes(opt.value); }), defaultValue: options.jsonData.authType, onChange: function (option) {
|
|
61
|
-
data.onUpdateDatasourceJsonDataOptionSelect(props, 'authType')(option);
|
|
62
|
-
} })),
|
|
63
|
-
options.jsonData.authType === 'credentials' && (React__default.createElement(ui.InlineField, { label: "Credentials Profile Name", labelWidth: 28, tooltip: "Credentials profile name, as specified in ~/.aws/credentials, leave blank for default." },
|
|
64
|
-
React__default.createElement(ui.Input, { className: "width-30", placeholder: "default", value: profile, onChange: data.onUpdateDatasourceJsonDataOption(props, 'profile') }))),
|
|
65
|
-
options.jsonData.authType === 'keys' && (React__default.createElement(React__default.Fragment, null,
|
|
66
|
-
React__default.createElement(ui.InlineField, { label: "Access Key ID", labelWidth: 28 }, ((_a = props.options.secureJsonFields) === null || _a === void 0 ? void 0 : _a.accessKey) ? (React__default.createElement(ui.ButtonGroup, { className: "width-30" },
|
|
67
|
-
React__default.createElement(ui.Input, { disabled: true, placeholder: "Configured" }),
|
|
68
|
-
React__default.createElement(ui.ToolbarButton, { icon: "edit", onClick: data.onUpdateDatasourceResetOption(props, 'accessKey') }))) : (React__default.createElement(ui.Input, { className: "width-30", value: (_c = (_b = options.secureJsonData) === null || _b === void 0 ? void 0 : _b.accessKey) !== null && _c !== void 0 ? _c : '', onChange: data.onUpdateDatasourceSecureJsonDataOption(props, 'accessKey') }))),
|
|
69
|
-
React__default.createElement(ui.InlineField, { label: "Secret Access Key", labelWidth: 28 }, ((_d = props.options.secureJsonFields) === null || _d === void 0 ? void 0 : _d.secretKey) ? (React__default.createElement(ui.ButtonGroup, { className: "width-30" },
|
|
70
|
-
React__default.createElement(ui.Input, { disabled: true, placeholder: "Configured" }),
|
|
71
|
-
React__default.createElement(ui.ToolbarButton, { icon: "edit", onClick: data.onUpdateDatasourceResetOption(props, 'secretKey') }))) : (React__default.createElement(ui.Input, { className: "width-30", value: (_f = (_e = options.secureJsonData) === null || _e === void 0 ? void 0 : _e.secretKey) !== null && _f !== void 0 ? _f : '', onChange: data.onUpdateDatasourceSecureJsonDataOption(props, 'secretKey') }))))),
|
|
72
|
-
runtime.config.awsAssumeRoleEnabled && (React__default.createElement(React__default.Fragment, null,
|
|
73
|
-
React__default.createElement(ui.InlineField, { label: "Assume Role ARN", labelWidth: 28, tooltip: "Optionally, specify the ARN of a role to assume. Specifying a role here will ensure that the selected authentication provider is used to assume the specified role rather than using the credentials directly. Leave blank if you don't need to assume a role at all" },
|
|
74
|
-
React__default.createElement(ui.Input, { className: "width-30", placeholder: "arn:aws:iam:*", value: options.jsonData.assumeRoleArn || '', onChange: data.onUpdateDatasourceJsonDataOption(props, 'assumeRoleArn') })),
|
|
75
|
-
React__default.createElement(ui.InlineField, { label: "External ID", labelWidth: 28, tooltip: "If you are assuming a role in another account, that has been created with an external ID, specify the external ID here." },
|
|
76
|
-
React__default.createElement(ui.Input, { className: "width-30", placeholder: "External ID", value: options.jsonData.externalId || '', onChange: data.onUpdateDatasourceJsonDataOption(props, 'externalId') })))),
|
|
77
|
-
React__default.createElement(ui.InlineField, { label: "Endpoint", labelWidth: 28, tooltip: "Optionally, specify a custom endpoint for the service" },
|
|
78
|
-
React__default.createElement(ui.Input, { className: "width-30", placeholder: (_g = props.defaultEndpoint) !== null && _g !== void 0 ? _g : 'https://{service}.{region}.amazonaws.com', value: options.jsonData.endpoint || '', onChange: data.onUpdateDatasourceJsonDataOption(props, 'endpoint') })),
|
|
79
|
-
React__default.createElement(ui.InlineField, { label: "Default Region", labelWidth: 28, tooltip: "Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region." },
|
|
80
|
-
React__default.createElement(ui.Select, { className: "width-30", value: regions.find(function (region) { return region.value === options.jsonData.defaultRegion; }), options: regions, defaultValue: options.jsonData.defaultRegion, allowCustomValue: true, onChange: data.onUpdateDatasourceJsonDataOptionSelect(props, 'defaultRegion') })),
|
|
81
|
-
props.children));
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
(function (AwsAuthType) {
|
|
85
|
-
AwsAuthType["Keys"] = "keys";
|
|
86
|
-
AwsAuthType["Credentials"] = "credentials";
|
|
87
|
-
AwsAuthType["Default"] = "default";
|
|
88
|
-
AwsAuthType["EC2IAMRole"] = "ec2_iam_role";
|
|
89
|
-
/**
|
|
90
|
-
* @deprecated use default
|
|
91
|
-
*/
|
|
92
|
-
AwsAuthType["ARN"] = "arn";
|
|
93
|
-
})(exports.AwsAuthType || (exports.AwsAuthType = {}));
|
|
94
|
-
|
|
95
53
|
var standardRegions = [
|
|
54
|
+
'af-south-1',
|
|
96
55
|
'ap-east-1',
|
|
97
56
|
'ap-northeast-1',
|
|
98
57
|
'ap-northeast-2',
|
|
@@ -120,6 +79,17 @@ var standardRegions = [
|
|
|
120
79
|
'us-west-2',
|
|
121
80
|
];
|
|
122
81
|
|
|
82
|
+
(function (AwsAuthType) {
|
|
83
|
+
AwsAuthType["Keys"] = "keys";
|
|
84
|
+
AwsAuthType["Credentials"] = "credentials";
|
|
85
|
+
AwsAuthType["Default"] = "default";
|
|
86
|
+
AwsAuthType["EC2IAMRole"] = "ec2_iam_role";
|
|
87
|
+
/**
|
|
88
|
+
* @deprecated use default
|
|
89
|
+
*/
|
|
90
|
+
AwsAuthType["ARN"] = "arn";
|
|
91
|
+
})(exports.AwsAuthType || (exports.AwsAuthType = {}));
|
|
92
|
+
|
|
123
93
|
var awsAuthProviderOptions = [
|
|
124
94
|
{
|
|
125
95
|
label: 'Workspace IAM Role',
|
|
@@ -139,6 +109,62 @@ var awsAuthProviderOptions = [
|
|
|
139
109
|
},
|
|
140
110
|
];
|
|
141
111
|
|
|
112
|
+
var toOption = function (value) { return ({ value: value, label: value }); };
|
|
113
|
+
var ConnectionConfig = function (props) {
|
|
114
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
115
|
+
var _k = __read(React.useState((props.standardRegions || standardRegions).map(toOption)), 2), regions = _k[0], setRegions = _k[1];
|
|
116
|
+
var loadRegions = props.loadRegions, onOptionsChange = props.onOptionsChange, _l = props.skipHeader, skipHeader = _l === void 0 ? false : _l, _m = props.skipEndpoint, skipEndpoint = _m === void 0 ? false : _m;
|
|
117
|
+
var options = props.options;
|
|
118
|
+
var profile = options.jsonData.profile;
|
|
119
|
+
if (profile === undefined) {
|
|
120
|
+
profile = options.database;
|
|
121
|
+
}
|
|
122
|
+
var settings = window.grafanaBootData.settings;
|
|
123
|
+
var awsAllowedAuthProviders = (_a = settings.awsAllowedAuthProviders) !== null && _a !== void 0 ? _a : [
|
|
124
|
+
exports.AwsAuthType.Default,
|
|
125
|
+
exports.AwsAuthType.Keys,
|
|
126
|
+
exports.AwsAuthType.Credentials,
|
|
127
|
+
];
|
|
128
|
+
var awsAssumeRoleEnabled = (_b = settings.awsAssumeRoleEnabled) !== null && _b !== void 0 ? _b : true;
|
|
129
|
+
var currentProvider = awsAuthProviderOptions.find(function (p) { return p.value === options.jsonData.authType; });
|
|
130
|
+
React.useEffect(function () {
|
|
131
|
+
// Make sure a authType exists in the current model
|
|
132
|
+
if (!currentProvider && awsAllowedAuthProviders.length) {
|
|
133
|
+
onOptionsChange(__assign(__assign({}, options), { jsonData: __assign(__assign({}, options.jsonData), { authType: awsAllowedAuthProviders[0] }) }));
|
|
134
|
+
}
|
|
135
|
+
}, [currentProvider, options, onOptionsChange]);
|
|
136
|
+
React.useEffect(function () {
|
|
137
|
+
if (!loadRegions) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
loadRegions().then(function (regions) { return setRegions(regions.map(toOption)); });
|
|
141
|
+
}, [loadRegions]);
|
|
142
|
+
return (React__default.createElement(ui.FieldSet, { label: skipHeader ? '' : 'Connection Details', "data-testid": "connection-config" },
|
|
143
|
+
React__default.createElement(ui.InlineField, { label: "Authentication Provider", labelWidth: 28, tooltip: "Specify which AWS credentials chain to use." },
|
|
144
|
+
React__default.createElement(ui.Select, { className: "width-30", value: currentProvider, options: awsAuthProviderOptions.filter(function (opt) { return awsAllowedAuthProviders.includes(opt.value); }), defaultValue: options.jsonData.authType, onChange: function (option) {
|
|
145
|
+
data.onUpdateDatasourceJsonDataOptionSelect(props, 'authType')(option);
|
|
146
|
+
} })),
|
|
147
|
+
options.jsonData.authType === 'credentials' && (React__default.createElement(ui.InlineField, { label: "Credentials Profile Name", labelWidth: 28, tooltip: "Credentials profile name, as specified in ~/.aws/credentials, leave blank for default." },
|
|
148
|
+
React__default.createElement(ui.Input, { className: "width-30", placeholder: "default", value: profile, onChange: data.onUpdateDatasourceJsonDataOption(props, 'profile') }))),
|
|
149
|
+
options.jsonData.authType === 'keys' && (React__default.createElement(React__default.Fragment, null,
|
|
150
|
+
React__default.createElement(ui.InlineField, { label: "Access Key ID", labelWidth: 28 }, ((_c = props.options.secureJsonFields) === null || _c === void 0 ? void 0 : _c.accessKey) ? (React__default.createElement(ui.ButtonGroup, { className: "width-30" },
|
|
151
|
+
React__default.createElement(ui.Input, { disabled: true, placeholder: "Configured" }),
|
|
152
|
+
React__default.createElement(ui.ToolbarButton, { icon: "edit", tooltip: "Edit Access Key ID", type: "button", onClick: data.onUpdateDatasourceResetOption(props, 'accessKey') }))) : (React__default.createElement(ui.Input, { className: "width-30", value: (_e = (_d = options.secureJsonData) === null || _d === void 0 ? void 0 : _d.accessKey) !== null && _e !== void 0 ? _e : '', onChange: data.onUpdateDatasourceSecureJsonDataOption(props, 'accessKey') }))),
|
|
153
|
+
React__default.createElement(ui.InlineField, { label: "Secret Access Key", labelWidth: 28 }, ((_f = props.options.secureJsonFields) === null || _f === void 0 ? void 0 : _f.secretKey) ? (React__default.createElement(ui.ButtonGroup, { className: "width-30" },
|
|
154
|
+
React__default.createElement(ui.Input, { disabled: true, placeholder: "Configured" }),
|
|
155
|
+
React__default.createElement(ui.ToolbarButton, { icon: "edit", type: "button", tooltip: "Edit Secret Access Key", onClick: data.onUpdateDatasourceResetOption(props, 'secretKey') }))) : (React__default.createElement(ui.Input, { className: "width-30", value: (_h = (_g = options.secureJsonData) === null || _g === void 0 ? void 0 : _g.secretKey) !== null && _h !== void 0 ? _h : '', onChange: data.onUpdateDatasourceSecureJsonDataOption(props, 'secretKey') }))))),
|
|
156
|
+
awsAssumeRoleEnabled && (React__default.createElement(React__default.Fragment, null,
|
|
157
|
+
React__default.createElement(ui.InlineField, { label: "Assume Role ARN", labelWidth: 28, tooltip: "Optionally, specify the ARN of a role to assume. Specifying a role here will ensure that the selected authentication provider is used to assume the specified role rather than using the credentials directly. Leave blank if you don't need to assume a role at all" },
|
|
158
|
+
React__default.createElement(ui.Input, { className: "width-30", placeholder: "arn:aws:iam:*", value: options.jsonData.assumeRoleArn || '', onChange: data.onUpdateDatasourceJsonDataOption(props, 'assumeRoleArn') })),
|
|
159
|
+
React__default.createElement(ui.InlineField, { label: "External ID", labelWidth: 28, tooltip: "If you are assuming a role in another account, that has been created with an external ID, specify the external ID here." },
|
|
160
|
+
React__default.createElement(ui.Input, { className: "width-30", placeholder: "External ID", value: options.jsonData.externalId || '', onChange: data.onUpdateDatasourceJsonDataOption(props, 'externalId') })))),
|
|
161
|
+
!skipEndpoint && (React__default.createElement(ui.InlineField, { label: "Endpoint", labelWidth: 28, tooltip: "Optionally, specify a custom endpoint for the service" },
|
|
162
|
+
React__default.createElement(ui.Input, { className: "width-30", placeholder: (_j = props.defaultEndpoint) !== null && _j !== void 0 ? _j : 'https://{service}.{region}.amazonaws.com', value: options.jsonData.endpoint || '', onChange: data.onUpdateDatasourceJsonDataOption(props, 'endpoint') }))),
|
|
163
|
+
React__default.createElement(ui.InlineField, { label: "Default Region", labelWidth: 28, tooltip: "Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region." },
|
|
164
|
+
React__default.createElement(ui.Select, { className: "width-30", value: regions.find(function (region) { return region.value === options.jsonData.defaultRegion; }), options: regions, defaultValue: options.jsonData.defaultRegion, allowCustomValue: true, onChange: data.onUpdateDatasourceJsonDataOptionSelect(props, 'defaultRegion'), formatCreateLabel: function (r) { return "Use region: " + r; } })),
|
|
165
|
+
props.children));
|
|
166
|
+
};
|
|
167
|
+
|
|
142
168
|
exports.ConnectionConfig = ConnectionConfig;
|
|
143
169
|
exports.awsAuthProviderOptions = awsAuthProviderOptions;
|
|
144
170
|
exports.standardRegions = standardRegions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.development.js","sources":["../src/ConnectionConfig.tsx","../src/types.ts","../src/regions.ts","../src/providers.ts"],"sourcesContent":["import React, { FC, useEffect, useState } from 'react';\nimport { Input, Select, InlineField, ButtonGroup, ToolbarButton, FieldSet } from '@grafana/ui';\nimport {\n DataSourcePluginOptionsEditorProps,\n onUpdateDatasourceJsonDataOptionSelect,\n onUpdateDatasourceResetOption,\n onUpdateDatasourceJsonDataOption,\n onUpdateDatasourceSecureJsonDataOption,\n} from '@grafana/data';\nimport { config } from '@grafana/runtime';\n\nimport { awsAuthProviderOptions, standardRegions, AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData } from '.';\n\nconst toOption = (value: string) => ({ value, label: value });\n\ninterface Props extends DataSourcePluginOptionsEditorProps<AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData> {\n standardRegions?: string[];\n loadRegions?: () => Promise<string[]>;\n defaultEndpoint?: string;\n children?: React.ReactNode;\n}\n\nexport const ConnectionConfig: FC<Props> = (props: Props) => {\n const [regions, setRegions] = useState((props.standardRegions || standardRegions).map(toOption));\n\n useEffect(() => {\n if (!props.loadRegions) {\n return;\n }\n\n props.loadRegions().then(regions => setRegions(regions.map(toOption)));\n }, [props.loadRegions]);\n\n const options = props.options;\n let profile = options.jsonData.profile;\n if (profile === undefined) {\n profile = options.database;\n }\n\n return (\n <FieldSet label=\"Connection Details\">\n <InlineField\n label=\"Authentication Provider\"\n labelWidth={28}\n tooltip=\"Specify which AWS credentials chain to use. AWS SDK Default is the recommended option for EKS, ECS, or if you've attached an IAM role to your EC2 instance.\"\n >\n <Select\n className=\"width-30\"\n value={awsAuthProviderOptions.find(p => p.value === options.jsonData.authType) || awsAuthProviderOptions[0]}\n options={awsAuthProviderOptions.filter(opt => config.awsAllowedAuthProviders.includes(opt.value!))}\n defaultValue={options.jsonData.authType}\n onChange={option => {\n onUpdateDatasourceJsonDataOptionSelect(props, 'authType')(option);\n }}\n />\n </InlineField>\n {options.jsonData.authType === 'credentials' && (\n <InlineField\n label=\"Credentials Profile Name\"\n labelWidth={28}\n tooltip=\"Credentials profile name, as specified in ~/.aws/credentials, leave blank for default.\"\n >\n <Input\n className=\"width-30\"\n placeholder=\"default\"\n value={profile}\n onChange={onUpdateDatasourceJsonDataOption(props, 'profile')}\n />\n </InlineField>\n )}\n\n {options.jsonData.authType === 'keys' && (\n <>\n <InlineField label=\"Access Key ID\" labelWidth={28}>\n {props.options.secureJsonFields?.accessKey ? (\n <ButtonGroup className=\"width-30\">\n <Input disabled placeholder=\"Configured\" />\n <ToolbarButton icon=\"edit\" onClick={onUpdateDatasourceResetOption(props as any, 'accessKey')} />\n </ButtonGroup>\n ) : (\n <Input\n className=\"width-30\"\n value={options.secureJsonData?.accessKey ?? ''}\n onChange={onUpdateDatasourceSecureJsonDataOption(props, 'accessKey')}\n />\n )}\n </InlineField>\n\n <InlineField label=\"Secret Access Key\" labelWidth={28}>\n {props.options.secureJsonFields?.secretKey ? (\n <ButtonGroup className=\"width-30\">\n <Input disabled placeholder=\"Configured\" />\n <ToolbarButton icon=\"edit\" onClick={onUpdateDatasourceResetOption(props as any, 'secretKey')} />\n </ButtonGroup>\n ) : (\n <Input\n className=\"width-30\"\n value={options.secureJsonData?.secretKey ?? ''}\n onChange={onUpdateDatasourceSecureJsonDataOption(props, 'secretKey')}\n />\n )}\n </InlineField>\n </>\n )}\n\n {config.awsAssumeRoleEnabled && (\n <>\n <InlineField\n label=\"Assume Role ARN\"\n labelWidth={28}\n tooltip=\"Optionally, specify the ARN of a role to assume. Specifying a role here will ensure that the selected authentication provider is used to assume the specified role rather than using the credentials directly. Leave blank if you don't need to assume a role at all\"\n >\n <Input\n className=\"width-30\"\n placeholder=\"arn:aws:iam:*\"\n value={options.jsonData.assumeRoleArn || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'assumeRoleArn')}\n />\n </InlineField>\n <InlineField\n label=\"External ID\"\n labelWidth={28}\n tooltip=\"If you are assuming a role in another account, that has been created with an external ID, specify the external ID here.\"\n >\n <Input\n className=\"width-30\"\n placeholder=\"External ID\"\n value={options.jsonData.externalId || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'externalId')}\n />\n </InlineField>\n </>\n )}\n <InlineField label=\"Endpoint\" labelWidth={28} tooltip=\"Optionally, specify a custom endpoint for the service\">\n <Input\n className=\"width-30\"\n placeholder={props.defaultEndpoint ?? 'https://{service}.{region}.amazonaws.com'}\n value={options.jsonData.endpoint || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'endpoint')}\n />\n </InlineField>\n <InlineField\n label=\"Default Region\"\n labelWidth={28}\n tooltip=\"Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region.\"\n >\n <Select\n className=\"width-30\"\n value={regions.find(region => region.value === options.jsonData.defaultRegion)}\n options={regions}\n defaultValue={options.jsonData.defaultRegion}\n allowCustomValue={true}\n onChange={onUpdateDatasourceJsonDataOptionSelect(props, 'defaultRegion')}\n />\n </InlineField>\n {props.children}\n </FieldSet>\n );\n};\n","import { DataSourceJsonData } from '@grafana/data';\n\nexport enum AwsAuthType {\n Keys = 'keys',\n Credentials = 'credentials',\n Default = 'default', // was 'arn',\n EC2IAMRole = 'ec2_iam_role',\n /**\n * @deprecated use default\n */\n ARN = 'arn',\n}\n\nexport interface AwsAuthDataSourceJsonData extends DataSourceJsonData {\n authType?: AwsAuthType;\n assumeRoleArn?: string;\n externalId?: string;\n profile?: string; // Credentials profile name, as specified in ~/.aws/credentials\n defaultRegion?: string; // region if it is not defined by your credentials file\n endpoint?: string;\n}\n\nexport interface AwsAuthDataSourceSecureJsonData {\n accessKey?: string;\n secretKey?: string;\n}\n","export const standardRegions: string[] = [\n 'ap-east-1',\n 'ap-northeast-1',\n 'ap-northeast-2',\n 'ap-northeast-3',\n 'ap-south-1',\n 'ap-southeast-1',\n 'ap-southeast-2',\n 'ca-central-1',\n 'cn-north-1',\n 'cn-northwest-1',\n 'eu-central-1',\n 'eu-north-1',\n 'eu-west-1',\n 'eu-west-2',\n 'eu-west-3',\n 'me-south-1',\n 'sa-east-1',\n 'us-east-1',\n 'us-east-2',\n 'us-gov-east-1',\n 'us-gov-west-1',\n 'us-iso-east-1',\n 'us-isob-east-1',\n 'us-west-1',\n 'us-west-2',\n];\n","import { SelectableValue } from '@grafana/data';\nimport { AwsAuthType } from './types';\n\nexport const awsAuthProviderOptions = [\n {\n label: 'Workspace IAM Role',\n value: AwsAuthType.EC2IAMRole,\n },\n {\n label: 'AWS SDK Default',\n value: AwsAuthType.Default,\n },\n {\n label: 'Access & secret key',\n value: AwsAuthType.Keys,\n },\n {\n label: 'Credentials file',\n value: AwsAuthType.Credentials,\n },\n] as Array<SelectableValue<AwsAuthType>>;\n"],"names":["useState","useEffect","React","FieldSet","InlineField","Select","config","onUpdateDatasourceJsonDataOptionSelect","Input","onUpdateDatasourceJsonDataOption","ButtonGroup","ToolbarButton","onUpdateDatasourceResetOption","onUpdateDatasourceSecureJsonDataOption","AwsAuthType"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,IAAM,QAAQ,GAAG,UAAC,KAAa,IAAK,QAAC,EAAE,KAAK,OAAA,EAAE,KAAK,EAAE,KAAK,EAAE,IAAC,CAAC;IASjD,gBAAgB,GAAc,UAAC,KAAY;;IAChD,IAAA,KAAA,OAAwBA,cAAQ,CAAC,CAAC,KAAK,CAAC,eAAe,IAAI,eAAe,EAAE,GAAG,CAAC,QAAQ,CAAC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;KAC/B;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.development.js","sources":["../src/regions.ts","../src/types.ts","../src/providers.ts","../src/ConnectionConfig.tsx"],"sourcesContent":["export const standardRegions: string[] = [\n 'af-south-1',\n 'ap-east-1',\n 'ap-northeast-1',\n 'ap-northeast-2',\n 'ap-northeast-3',\n 'ap-south-1',\n 'ap-southeast-1',\n 'ap-southeast-2',\n 'ca-central-1',\n 'cn-north-1',\n 'cn-northwest-1',\n 'eu-central-1',\n 'eu-north-1',\n 'eu-west-1',\n 'eu-west-2',\n 'eu-west-3',\n 'me-south-1',\n 'sa-east-1',\n 'us-east-1',\n 'us-east-2',\n 'us-gov-east-1',\n 'us-gov-west-1',\n 'us-iso-east-1',\n 'us-isob-east-1',\n 'us-west-1',\n 'us-west-2',\n];\n","import { DataSourceJsonData } from '@grafana/data';\n\nexport enum AwsAuthType {\n Keys = 'keys',\n Credentials = 'credentials',\n Default = 'default', // was 'arn',\n EC2IAMRole = 'ec2_iam_role',\n /**\n * @deprecated use default\n */\n ARN = 'arn',\n}\n\nexport interface AwsAuthDataSourceJsonData extends DataSourceJsonData {\n authType?: AwsAuthType;\n assumeRoleArn?: string;\n externalId?: string;\n profile?: string; // Credentials profile name, as specified in ~/.aws/credentials\n defaultRegion?: string; // region if it is not defined by your credentials file\n endpoint?: string;\n}\n\nexport interface AwsAuthDataSourceSecureJsonData {\n accessKey?: string;\n secretKey?: string;\n}\n","import { SelectableValue } from '@grafana/data';\nimport { AwsAuthType } from './types';\n\nexport const awsAuthProviderOptions = [\n {\n label: 'Workspace IAM Role',\n value: AwsAuthType.EC2IAMRole,\n },\n {\n label: 'AWS SDK Default',\n value: AwsAuthType.Default,\n },\n {\n label: 'Access & secret key',\n value: AwsAuthType.Keys,\n },\n {\n label: 'Credentials file',\n value: AwsAuthType.Credentials,\n },\n] as Array<SelectableValue<AwsAuthType>>;\n","import React, { FC, useEffect, useState } from 'react';\nimport { Input, Select, InlineField, ButtonGroup, ToolbarButton, FieldSet } from '@grafana/ui';\nimport {\n DataSourcePluginOptionsEditorProps,\n onUpdateDatasourceJsonDataOptionSelect,\n onUpdateDatasourceResetOption,\n onUpdateDatasourceJsonDataOption,\n onUpdateDatasourceSecureJsonDataOption,\n} from '@grafana/data';\n\nimport { standardRegions } from './regions';\nimport { AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData, AwsAuthType } from './types';\nimport { awsAuthProviderOptions } from './providers';\n\nconst toOption = (value: string) => ({ value, label: value });\n\nexport interface ConnectionConfigProps<J = AwsAuthDataSourceJsonData, S = AwsAuthDataSourceSecureJsonData>\n extends DataSourcePluginOptionsEditorProps<J, S> {\n standardRegions?: string[];\n loadRegions?: () => Promise<string[]>;\n defaultEndpoint?: string;\n skipHeader?: boolean;\n skipEndpoint?: boolean;\n children?: React.ReactNode;\n}\n\nexport const ConnectionConfig: FC<ConnectionConfigProps> = (props: ConnectionConfigProps) => {\n const [regions, setRegions] = useState((props.standardRegions || standardRegions).map(toOption));\n const { loadRegions, onOptionsChange, skipHeader = false, skipEndpoint = false } = props;\n const options = props.options;\n let profile = options.jsonData.profile;\n if (profile === undefined) {\n profile = options.database;\n }\n\n const settings = (window as any).grafanaBootData.settings;\n const awsAllowedAuthProviders = settings.awsAllowedAuthProviders ?? [\n AwsAuthType.Default,\n AwsAuthType.Keys,\n AwsAuthType.Credentials,\n ];\n const awsAssumeRoleEnabled = settings.awsAssumeRoleEnabled ?? true;\n\n const currentProvider = awsAuthProviderOptions.find((p) => p.value === options.jsonData.authType);\n\n useEffect(() => {\n // Make sure a authType exists in the current model\n if (!currentProvider && awsAllowedAuthProviders.length) {\n onOptionsChange({\n ...options,\n jsonData: {\n ...options.jsonData,\n authType: awsAllowedAuthProviders[0],\n },\n });\n }\n }, [currentProvider, options, onOptionsChange]);\n\n useEffect(() => {\n if (!loadRegions) {\n return;\n }\n\n loadRegions().then((regions) => setRegions(regions.map(toOption)));\n }, [loadRegions]);\n\n return (\n <FieldSet label={skipHeader ? '' : 'Connection Details'} data-testid=\"connection-config\">\n <InlineField\n label=\"Authentication Provider\"\n labelWidth={28}\n tooltip=\"Specify which AWS credentials chain to use.\"\n >\n <Select\n className=\"width-30\"\n value={currentProvider}\n options={awsAuthProviderOptions.filter((opt) => awsAllowedAuthProviders.includes(opt.value!))}\n defaultValue={options.jsonData.authType}\n onChange={(option) => {\n onUpdateDatasourceJsonDataOptionSelect(props, 'authType')(option);\n }}\n />\n </InlineField>\n {options.jsonData.authType === 'credentials' && (\n <InlineField\n label=\"Credentials Profile Name\"\n labelWidth={28}\n tooltip=\"Credentials profile name, as specified in ~/.aws/credentials, leave blank for default.\"\n >\n <Input\n className=\"width-30\"\n placeholder=\"default\"\n value={profile}\n onChange={onUpdateDatasourceJsonDataOption(props, 'profile')}\n />\n </InlineField>\n )}\n\n {options.jsonData.authType === 'keys' && (\n <>\n <InlineField label=\"Access Key ID\" labelWidth={28}>\n {props.options.secureJsonFields?.accessKey ? (\n <ButtonGroup className=\"width-30\">\n <Input disabled placeholder=\"Configured\" />\n <ToolbarButton\n icon=\"edit\"\n tooltip=\"Edit Access Key ID\"\n type=\"button\"\n onClick={onUpdateDatasourceResetOption(props as any, 'accessKey')}\n />\n </ButtonGroup>\n ) : (\n <Input\n className=\"width-30\"\n value={options.secureJsonData?.accessKey ?? ''}\n onChange={onUpdateDatasourceSecureJsonDataOption(props, 'accessKey')}\n />\n )}\n </InlineField>\n\n <InlineField label=\"Secret Access Key\" labelWidth={28}>\n {props.options.secureJsonFields?.secretKey ? (\n <ButtonGroup className=\"width-30\">\n <Input disabled placeholder=\"Configured\" />\n <ToolbarButton\n icon=\"edit\"\n type=\"button\"\n tooltip=\"Edit Secret Access Key\"\n onClick={onUpdateDatasourceResetOption(props as any, 'secretKey')}\n />\n </ButtonGroup>\n ) : (\n <Input\n className=\"width-30\"\n value={options.secureJsonData?.secretKey ?? ''}\n onChange={onUpdateDatasourceSecureJsonDataOption(props, 'secretKey')}\n />\n )}\n </InlineField>\n </>\n )}\n\n {awsAssumeRoleEnabled && (\n <>\n <InlineField\n label=\"Assume Role ARN\"\n labelWidth={28}\n tooltip=\"Optionally, specify the ARN of a role to assume. Specifying a role here will ensure that the selected authentication provider is used to assume the specified role rather than using the credentials directly. Leave blank if you don't need to assume a role at all\"\n >\n <Input\n className=\"width-30\"\n placeholder=\"arn:aws:iam:*\"\n value={options.jsonData.assumeRoleArn || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'assumeRoleArn')}\n />\n </InlineField>\n <InlineField\n label=\"External ID\"\n labelWidth={28}\n tooltip=\"If you are assuming a role in another account, that has been created with an external ID, specify the external ID here.\"\n >\n <Input\n className=\"width-30\"\n placeholder=\"External ID\"\n value={options.jsonData.externalId || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'externalId')}\n />\n </InlineField>\n </>\n )}\n {!skipEndpoint && (\n <InlineField label=\"Endpoint\" labelWidth={28} tooltip=\"Optionally, specify a custom endpoint for the service\">\n <Input\n className=\"width-30\"\n placeholder={props.defaultEndpoint ?? 'https://{service}.{region}.amazonaws.com'}\n value={options.jsonData.endpoint || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'endpoint')}\n />\n </InlineField>\n )}\n <InlineField\n label=\"Default Region\"\n labelWidth={28}\n tooltip=\"Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region.\"\n >\n <Select\n className=\"width-30\"\n value={regions.find((region) => region.value === options.jsonData.defaultRegion)}\n options={regions}\n defaultValue={options.jsonData.defaultRegion}\n allowCustomValue={true}\n onChange={onUpdateDatasourceJsonDataOptionSelect(props, 'defaultRegion')}\n formatCreateLabel={(r) => `Use region: ${r}`}\n />\n </InlineField>\n {props.children}\n </FieldSet>\n );\n};\n"],"names":["AwsAuthType","useState","useEffect","React","FieldSet","InlineField","Select","onUpdateDatasourceJsonDataOptionSelect","Input","onUpdateDatasourceJsonDataOption","ButtonGroup","ToolbarButton","onUpdateDatasourceResetOption","onUpdateDatasourceSecureJsonDataOption"],"mappings":";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;;;;;"}
|
package/dist/index.production.js
CHANGED
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),a=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,n=require("@grafana/ui"),
|
|
2
|
-
/*! *****************************************************************************
|
|
3
|
-
Copyright (c) Microsoft Corporation.
|
|
4
|
-
|
|
5
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
-
purpose with or without fee is hereby granted.
|
|
7
|
-
|
|
8
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */
|
|
16
|
-
function(e,t){var a="function"==typeof Symbol&&e[Symbol.iterator];if(!a)return e;var n,l,o=a.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){l={error:e}}finally{try{n&&!n.done&&(a=o.return)&&a.call(o)}finally{if(l)throw l.error}}return s}(t.useState((e.standardRegions||i).map(r)),2),y=v[0],D=v[1];t.useEffect((function(){e.loadRegions&&e.loadRegions().then((function(e){return D(e.map(r))}))}),[e.loadRegions]);var b=e.options,g=b.jsonData.profile;return void 0===g&&(g=b.database),a.createElement(n.FieldSet,{label:"Connection Details"},a.createElement(n.InlineField,{label:"Authentication Provider",labelWidth:28,tooltip:"Specify which AWS credentials chain to use. AWS SDK Default is the recommended option for EKS, ECS, or if you've attached an IAM role to your EC2 instance."},a.createElement(n.Select,{className:"width-30",value:u.find((function(e){return e.value===b.jsonData.authType}))||u[0],options:u.filter((function(e){return o.config.awsAllowedAuthProviders.includes(e.value)})),defaultValue:b.jsonData.authType,onChange:function(t){l.onUpdateDatasourceJsonDataOptionSelect(e,"authType")(t)}})),"credentials"===b.jsonData.authType&&a.createElement(n.InlineField,{label:"Credentials Profile Name",labelWidth:28,tooltip:"Credentials profile name, as specified in ~/.aws/credentials, leave blank for default."},a.createElement(n.Input,{className:"width-30",placeholder:"default",value:g,onChange:l.onUpdateDatasourceJsonDataOption(e,"profile")})),"keys"===b.jsonData.authType&&a.createElement(a.Fragment,null,a.createElement(n.InlineField,{label:"Access Key ID",labelWidth:28},(null===(s=e.options.secureJsonFields)||void 0===s?void 0:s.accessKey)?a.createElement(n.ButtonGroup,{className:"width-30"},a.createElement(n.Input,{disabled:!0,placeholder:"Configured"}),a.createElement(n.ToolbarButton,{icon:"edit",onClick:l.onUpdateDatasourceResetOption(e,"accessKey")})):a.createElement(n.Input,{className:"width-30",value:null!==(d=null===(c=b.secureJsonData)||void 0===c?void 0:c.accessKey)&&void 0!==d?d:"",onChange:l.onUpdateDatasourceSecureJsonDataOption(e,"accessKey")})),a.createElement(n.InlineField,{label:"Secret Access Key",labelWidth:28},(null===(p=e.options.secureJsonFields)||void 0===p?void 0:p.secretKey)?a.createElement(n.ButtonGroup,{className:"width-30"},a.createElement(n.Input,{disabled:!0,placeholder:"Configured"}),a.createElement(n.ToolbarButton,{icon:"edit",onClick:l.onUpdateDatasourceResetOption(e,"secretKey")})):a.createElement(n.Input,{className:"width-30",value:null!==(f=null===(h=b.secureJsonData)||void 0===h?void 0:h.secretKey)&&void 0!==f?f:"",onChange:l.onUpdateDatasourceSecureJsonDataOption(e,"secretKey")}))),o.config.awsAssumeRoleEnabled&&a.createElement(a.Fragment,null,a.createElement(n.InlineField,{label:"Assume Role ARN",labelWidth:28,tooltip:"Optionally, specify the ARN of a role to assume. Specifying a role here will ensure that the selected authentication provider is used to assume the specified role rather than using the credentials directly. Leave blank if you don't need to assume a role at all"},a.createElement(n.Input,{className:"width-30",placeholder:"arn:aws:iam:*",value:b.jsonData.assumeRoleArn||"",onChange:l.onUpdateDatasourceJsonDataOption(e,"assumeRoleArn")})),a.createElement(n.InlineField,{label:"External ID",labelWidth:28,tooltip:"If you are assuming a role in another account, that has been created with an external ID, specify the external ID here."},a.createElement(n.Input,{className:"width-30",placeholder:"External ID",value:b.jsonData.externalId||"",onChange:l.onUpdateDatasourceJsonDataOption(e,"externalId")}))),a.createElement(n.InlineField,{label:"Endpoint",labelWidth:28,tooltip:"Optionally, specify a custom endpoint for the service"},a.createElement(n.Input,{className:"width-30",placeholder:null!==(m=e.defaultEndpoint)&&void 0!==m?m:"https://{service}.{region}.amazonaws.com",value:b.jsonData.endpoint||"",onChange:l.onUpdateDatasourceJsonDataOption(e,"endpoint")})),a.createElement(n.InlineField,{label:"Default Region",labelWidth:28,tooltip:"Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region."},a.createElement(n.Select,{className:"width-30",value:y.find((function(e){return e.value===b.jsonData.defaultRegion})),options:y,defaultValue:b.jsonData.defaultRegion,allowCustomValue:!0,onChange:l.onUpdateDatasourceJsonDataOptionSelect(e,"defaultRegion")})),e.children)},exports.awsAuthProviderOptions=u,exports.standardRegions=i;
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),a=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,n=require("@grafana/ui"),o=require("@grafana/data"),l=function(){return(l=Object.assign||function(e){for(var t,a=1,n=arguments.length;a<n;a++)for(var o in t=arguments[a])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};var s,r=["af-south-1","ap-east-1","ap-northeast-1","ap-northeast-2","ap-northeast-3","ap-south-1","ap-southeast-1","ap-southeast-2","ca-central-1","cn-north-1","cn-northwest-1","eu-central-1","eu-north-1","eu-west-1","eu-west-2","eu-west-3","me-south-1","sa-east-1","us-east-1","us-east-2","us-gov-east-1","us-gov-west-1","us-iso-east-1","us-isob-east-1","us-west-1","us-west-2"];(s=exports.AwsAuthType||(exports.AwsAuthType={})).Keys="keys",s.Credentials="credentials",s.Default="default",s.EC2IAMRole="ec2_iam_role",s.ARN="arn";var i=[{label:"Workspace IAM Role",value:exports.AwsAuthType.EC2IAMRole},{label:"AWS SDK Default",value:exports.AwsAuthType.Default},{label:"Access & secret key",value:exports.AwsAuthType.Keys},{label:"Credentials file",value:exports.AwsAuthType.Credentials}],u=function(e){return{value:e,label:e}};exports.ConnectionConfig=function(e){var s,c,d,p,h,f,m,y,v,D=function(e,t){var a="function"==typeof Symbol&&e[Symbol.iterator];if(!a)return e;var n,o,l=a.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=l.next()).done;)s.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(a=l.return)&&a.call(l)}finally{if(o)throw o.error}}return s}(t.useState((e.standardRegions||r).map(u)),2),w=D[0],b=D[1],g=e.loadRegions,A=e.onOptionsChange,E=e.skipHeader,I=void 0!==E&&E,C=e.skipEndpoint,x=void 0!==C&&C,O=e.options,R=O.jsonData.profile;void 0===R&&(R=O.database);var S=window.grafanaBootData.settings,T=null!==(s=S.awsAllowedAuthProviders)&&void 0!==s?s:[exports.AwsAuthType.Default,exports.AwsAuthType.Keys,exports.AwsAuthType.Credentials],j=null===(c=S.awsAssumeRoleEnabled)||void 0===c||c,K=i.find((function(e){return e.value===O.jsonData.authType}));return t.useEffect((function(){!K&&T.length&&A(l(l({},O),{jsonData:l(l({},O.jsonData),{authType:T[0]})}))}),[K,O,A]),t.useEffect((function(){g&&g().then((function(e){return b(e.map(u))}))}),[g]),a.createElement(n.FieldSet,{label:I?"":"Connection Details","data-testid":"connection-config"},a.createElement(n.InlineField,{label:"Authentication Provider",labelWidth:28,tooltip:"Specify which AWS credentials chain to use."},a.createElement(n.Select,{className:"width-30",value:K,options:i.filter((function(e){return T.includes(e.value)})),defaultValue:O.jsonData.authType,onChange:function(t){o.onUpdateDatasourceJsonDataOptionSelect(e,"authType")(t)}})),"credentials"===O.jsonData.authType&&a.createElement(n.InlineField,{label:"Credentials Profile Name",labelWidth:28,tooltip:"Credentials profile name, as specified in ~/.aws/credentials, leave blank for default."},a.createElement(n.Input,{className:"width-30",placeholder:"default",value:R,onChange:o.onUpdateDatasourceJsonDataOption(e,"profile")})),"keys"===O.jsonData.authType&&a.createElement(a.Fragment,null,a.createElement(n.InlineField,{label:"Access Key ID",labelWidth:28},(null===(d=e.options.secureJsonFields)||void 0===d?void 0:d.accessKey)?a.createElement(n.ButtonGroup,{className:"width-30"},a.createElement(n.Input,{disabled:!0,placeholder:"Configured"}),a.createElement(n.ToolbarButton,{icon:"edit",tooltip:"Edit Access Key ID",type:"button",onClick:o.onUpdateDatasourceResetOption(e,"accessKey")})):a.createElement(n.Input,{className:"width-30",value:null!==(h=null===(p=O.secureJsonData)||void 0===p?void 0:p.accessKey)&&void 0!==h?h:"",onChange:o.onUpdateDatasourceSecureJsonDataOption(e,"accessKey")})),a.createElement(n.InlineField,{label:"Secret Access Key",labelWidth:28},(null===(f=e.options.secureJsonFields)||void 0===f?void 0:f.secretKey)?a.createElement(n.ButtonGroup,{className:"width-30"},a.createElement(n.Input,{disabled:!0,placeholder:"Configured"}),a.createElement(n.ToolbarButton,{icon:"edit",type:"button",tooltip:"Edit Secret Access Key",onClick:o.onUpdateDatasourceResetOption(e,"secretKey")})):a.createElement(n.Input,{className:"width-30",value:null!==(y=null===(m=O.secureJsonData)||void 0===m?void 0:m.secretKey)&&void 0!==y?y:"",onChange:o.onUpdateDatasourceSecureJsonDataOption(e,"secretKey")}))),j&&a.createElement(a.Fragment,null,a.createElement(n.InlineField,{label:"Assume Role ARN",labelWidth:28,tooltip:"Optionally, specify the ARN of a role to assume. Specifying a role here will ensure that the selected authentication provider is used to assume the specified role rather than using the credentials directly. Leave blank if you don't need to assume a role at all"},a.createElement(n.Input,{className:"width-30",placeholder:"arn:aws:iam:*",value:O.jsonData.assumeRoleArn||"",onChange:o.onUpdateDatasourceJsonDataOption(e,"assumeRoleArn")})),a.createElement(n.InlineField,{label:"External ID",labelWidth:28,tooltip:"If you are assuming a role in another account, that has been created with an external ID, specify the external ID here."},a.createElement(n.Input,{className:"width-30",placeholder:"External ID",value:O.jsonData.externalId||"",onChange:o.onUpdateDatasourceJsonDataOption(e,"externalId")}))),!x&&a.createElement(n.InlineField,{label:"Endpoint",labelWidth:28,tooltip:"Optionally, specify a custom endpoint for the service"},a.createElement(n.Input,{className:"width-30",placeholder:null!==(v=e.defaultEndpoint)&&void 0!==v?v:"https://{service}.{region}.amazonaws.com",value:O.jsonData.endpoint||"",onChange:o.onUpdateDatasourceJsonDataOption(e,"endpoint")})),a.createElement(n.InlineField,{label:"Default Region",labelWidth:28,tooltip:"Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region."},a.createElement(n.Select,{className:"width-30",value:w.find((function(e){return e.value===O.jsonData.defaultRegion})),options:w,defaultValue:O.jsonData.defaultRegion,allowCustomValue:!0,onChange:o.onUpdateDatasourceJsonDataOptionSelect(e,"defaultRegion"),formatCreateLabel:function(e){return"Use region: "+e}})),e.children)},exports.awsAuthProviderOptions=i,exports.standardRegions=r;
|
|
17
2
|
//# sourceMappingURL=index.production.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.production.js","sources":["../src/ConnectionConfig.tsx","../src/types.ts","../src/regions.ts","../src/providers.ts"],"sourcesContent":["import React, { FC, useEffect, useState } from 'react';\nimport { Input, Select, InlineField, ButtonGroup, ToolbarButton, FieldSet } from '@grafana/ui';\nimport {\n DataSourcePluginOptionsEditorProps,\n onUpdateDatasourceJsonDataOptionSelect,\n onUpdateDatasourceResetOption,\n onUpdateDatasourceJsonDataOption,\n onUpdateDatasourceSecureJsonDataOption,\n} from '@grafana/data';\nimport { config } from '@grafana/runtime';\n\nimport { awsAuthProviderOptions, standardRegions, AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData } from '.';\n\nconst toOption = (value: string) => ({ value, label: value });\n\ninterface Props extends DataSourcePluginOptionsEditorProps<AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData> {\n standardRegions?: string[];\n loadRegions?: () => Promise<string[]>;\n defaultEndpoint?: string;\n children?: React.ReactNode;\n}\n\nexport const ConnectionConfig: FC<Props> = (props: Props) => {\n const [regions, setRegions] = useState((props.standardRegions || standardRegions).map(toOption));\n\n useEffect(() => {\n if (!props.loadRegions) {\n return;\n }\n\n props.loadRegions().then(regions => setRegions(regions.map(toOption)));\n }, [props.loadRegions]);\n\n const options = props.options;\n let profile = options.jsonData.profile;\n if (profile === undefined) {\n profile = options.database;\n }\n\n return (\n <FieldSet label=\"Connection Details\">\n <InlineField\n label=\"Authentication Provider\"\n labelWidth={28}\n tooltip=\"Specify which AWS credentials chain to use. AWS SDK Default is the recommended option for EKS, ECS, or if you've attached an IAM role to your EC2 instance.\"\n >\n <Select\n className=\"width-30\"\n value={awsAuthProviderOptions.find(p => p.value === options.jsonData.authType) || awsAuthProviderOptions[0]}\n options={awsAuthProviderOptions.filter(opt => config.awsAllowedAuthProviders.includes(opt.value!))}\n defaultValue={options.jsonData.authType}\n onChange={option => {\n onUpdateDatasourceJsonDataOptionSelect(props, 'authType')(option);\n }}\n />\n </InlineField>\n {options.jsonData.authType === 'credentials' && (\n <InlineField\n label=\"Credentials Profile Name\"\n labelWidth={28}\n tooltip=\"Credentials profile name, as specified in ~/.aws/credentials, leave blank for default.\"\n >\n <Input\n className=\"width-30\"\n placeholder=\"default\"\n value={profile}\n onChange={onUpdateDatasourceJsonDataOption(props, 'profile')}\n />\n </InlineField>\n )}\n\n {options.jsonData.authType === 'keys' && (\n <>\n <InlineField label=\"Access Key ID\" labelWidth={28}>\n {props.options.secureJsonFields?.accessKey ? (\n <ButtonGroup className=\"width-30\">\n <Input disabled placeholder=\"Configured\" />\n <ToolbarButton icon=\"edit\" onClick={onUpdateDatasourceResetOption(props as any, 'accessKey')} />\n </ButtonGroup>\n ) : (\n <Input\n className=\"width-30\"\n value={options.secureJsonData?.accessKey ?? ''}\n onChange={onUpdateDatasourceSecureJsonDataOption(props, 'accessKey')}\n />\n )}\n </InlineField>\n\n <InlineField label=\"Secret Access Key\" labelWidth={28}>\n {props.options.secureJsonFields?.secretKey ? (\n <ButtonGroup className=\"width-30\">\n <Input disabled placeholder=\"Configured\" />\n <ToolbarButton icon=\"edit\" onClick={onUpdateDatasourceResetOption(props as any, 'secretKey')} />\n </ButtonGroup>\n ) : (\n <Input\n className=\"width-30\"\n value={options.secureJsonData?.secretKey ?? ''}\n onChange={onUpdateDatasourceSecureJsonDataOption(props, 'secretKey')}\n />\n )}\n </InlineField>\n </>\n )}\n\n {config.awsAssumeRoleEnabled && (\n <>\n <InlineField\n label=\"Assume Role ARN\"\n labelWidth={28}\n tooltip=\"Optionally, specify the ARN of a role to assume. Specifying a role here will ensure that the selected authentication provider is used to assume the specified role rather than using the credentials directly. Leave blank if you don't need to assume a role at all\"\n >\n <Input\n className=\"width-30\"\n placeholder=\"arn:aws:iam:*\"\n value={options.jsonData.assumeRoleArn || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'assumeRoleArn')}\n />\n </InlineField>\n <InlineField\n label=\"External ID\"\n labelWidth={28}\n tooltip=\"If you are assuming a role in another account, that has been created with an external ID, specify the external ID here.\"\n >\n <Input\n className=\"width-30\"\n placeholder=\"External ID\"\n value={options.jsonData.externalId || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'externalId')}\n />\n </InlineField>\n </>\n )}\n <InlineField label=\"Endpoint\" labelWidth={28} tooltip=\"Optionally, specify a custom endpoint for the service\">\n <Input\n className=\"width-30\"\n placeholder={props.defaultEndpoint ?? 'https://{service}.{region}.amazonaws.com'}\n value={options.jsonData.endpoint || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'endpoint')}\n />\n </InlineField>\n <InlineField\n label=\"Default Region\"\n labelWidth={28}\n tooltip=\"Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region.\"\n >\n <Select\n className=\"width-30\"\n value={regions.find(region => region.value === options.jsonData.defaultRegion)}\n options={regions}\n defaultValue={options.jsonData.defaultRegion}\n allowCustomValue={true}\n onChange={onUpdateDatasourceJsonDataOptionSelect(props, 'defaultRegion')}\n />\n </InlineField>\n {props.children}\n </FieldSet>\n );\n};\n","import { DataSourceJsonData } from '@grafana/data';\n\nexport enum AwsAuthType {\n Keys = 'keys',\n Credentials = 'credentials',\n Default = 'default', // was 'arn',\n EC2IAMRole = 'ec2_iam_role',\n /**\n * @deprecated use default\n */\n ARN = 'arn',\n}\n\nexport interface AwsAuthDataSourceJsonData extends DataSourceJsonData {\n authType?: AwsAuthType;\n assumeRoleArn?: string;\n externalId?: string;\n profile?: string; // Credentials profile name, as specified in ~/.aws/credentials\n defaultRegion?: string; // region if it is not defined by your credentials file\n endpoint?: string;\n}\n\nexport interface AwsAuthDataSourceSecureJsonData {\n accessKey?: string;\n secretKey?: string;\n}\n","export const standardRegions: string[] = [\n 'ap-east-1',\n 'ap-northeast-1',\n 'ap-northeast-2',\n 'ap-northeast-3',\n 'ap-south-1',\n 'ap-southeast-1',\n 'ap-southeast-2',\n 'ca-central-1',\n 'cn-north-1',\n 'cn-northwest-1',\n 'eu-central-1',\n 'eu-north-1',\n 'eu-west-1',\n 'eu-west-2',\n 'eu-west-3',\n 'me-south-1',\n 'sa-east-1',\n 'us-east-1',\n 'us-east-2',\n 'us-gov-east-1',\n 'us-gov-west-1',\n 'us-iso-east-1',\n 'us-isob-east-1',\n 'us-west-1',\n 'us-west-2',\n];\n","import { SelectableValue } from '@grafana/data';\nimport { AwsAuthType } from './types';\n\nexport const awsAuthProviderOptions = [\n {\n label: 'Workspace IAM Role',\n value: AwsAuthType.EC2IAMRole,\n },\n {\n label: 'AWS SDK Default',\n value: AwsAuthType.Default,\n },\n {\n label: 'Access & secret key',\n value: AwsAuthType.Keys,\n },\n {\n label: 'Credentials file',\n value: AwsAuthType.Credentials,\n },\n] as Array<SelectableValue<AwsAuthType>>;\n"],"names":["AwsAuthType","toOption","value","label","standardRegions","awsAuthProviderOptions","EC2IAMRole","Default","Keys","Credentials","props","_h","__read","useState","map","regions","setRegions","useEffect","loadRegions","then","options","profile","jsonData","undefined","database","React","FieldSet","InlineField","labelWidth","tooltip","Select","className","find","p","authType","filter","opt","config","awsAllowedAuthProviders","includes","defaultValue","onChange","option","onUpdateDatasourceJsonDataOptionSelect","Input","placeholder","onUpdateDatasourceJsonDataOption","secureJsonFields","accessKey","ButtonGroup","disabled","ToolbarButton","icon","onClick","onUpdateDatasourceResetOption","secureJsonData","onUpdateDatasourceSecureJsonDataOption","secretKey","awsAssumeRoleEnabled","assumeRoleArn","externalId","defaultEndpoint","endpoint","region","defaultRegion","allowCustomValue","children"],"mappings":"yNAaA,ICXYA,EDWNC,EAAW,SAACC,GAAkB,OAAGA,QAAOC,MAAOD,KCXzCF,EAAAA,sBAAAA,qCAEVA,4BACAA,oBACAA,4BAIAA,gBCVWI,EAA4B,CACvC,YACA,iBACA,iBACA,iBACA,aACA,iBACA,iBACA,eACA,aACA,iBACA,eACA,aACA,YACA,YACA,YACA,aACA,YACA,YACA,YACA,gBACA,gBACA,gBACA,iBACA,YACA,aCtBWC,EAAyB,CACpC,CACEF,MAAO,qBACPD,MAAOF,oBAAYM,YAErB,CACEH,MAAO,kBACPD,MAAOF,oBAAYO,SAErB,CACEJ,MAAO,sBACPD,MAAOF,oBAAYQ,MAErB,CACEL,MAAO,mBACPD,MAAOF,oBAAYS,uCHIoB,SAACC,qBACpCC;;;;;;;;;;;;;;;uRAAAC,CAAwBC,YAAUH,EAAMN,iBAAmBA,GAAiBU,IAAIb,OAA/Ec,OAASC,OAEhBC,aAAU,WACHP,EAAMQ,aAIXR,EAAMQ,cAAcC,MAAK,SAAAJ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0B,iBAAcC,KAAK,OAAOC,QAASC,gCAA8B5C,EAAc,gBAGlFe,gBAACmB,SACCb,UAAU,WACV7B,0BAAOkB,EAAQmC,qCAAgBE,yBAAa,GAC5ChB,SAAUe,yCAAuC9C,EAAO,iBAOjE2B,SAAOqB,sBACNjC,gCACEA,gBAACE,eACCxB,MAAM,kBACNyB,WAAY,GACZC,QAAQ,wQAERJ,gBAACmB,SACCb,UAAU,WACVc,YAAY,gBACZ3C,MAAOkB,EAAQE,SAASqC,eAAiB,GACzClB,SAAUK,mCAAiCpC,EAAO,oBAGtDe,gBAACE,eACCxB,MAAM,cACNyB,WAAY,GACZC,QAAQ,2HAERJ,gBAACmB,SACCb,UAAU,WACVc,YAAY,cACZ3C,MAAOkB,EAAQE,SAASsC,YAAc,GACtCnB,SAAUK,mCAAiCpC,EAAO,kBAK1De,gBAACE,eAAYxB,MAAM,WAAWyB,WAAY,GAAIC,QAAQ,yDACpDJ,gBAACmB,SACCb,UAAU,WACVc,sBAAanC,EAAMmD,+BAAmB,2CACtC3D,MAAOkB,EAAQE,SAASwC,UAAY,GACpCrB,SAAUK,mCAAiCpC,EAAO,eAGtDe,gBAACE,eACCxB,MAAM,iBACNyB,WAAY,GACZC,QAAQ,qFAERJ,gBAACK,UACCC,UAAU,WACV7B,MAAOa,EAAQiB,MAAK,SAAA+B,GAAU,OAAAA,EAAO7D,QAAUkB,EAAQE,SAAS0C,iBAChE5C,QAASL,EACTyB,aAAcpB,EAAQE,SAAS0C,cAC/BC,kBAAkB,EAClBxB,SAAUE,yCAAuCjC,EAAO,oBAG3DA,EAAMwD"}
|
|
1
|
+
{"version":3,"file":"index.production.js","sources":["../src/types.ts","../src/regions.ts","../src/providers.ts","../src/ConnectionConfig.tsx"],"sourcesContent":["import { DataSourceJsonData } from '@grafana/data';\n\nexport enum AwsAuthType {\n Keys = 'keys',\n Credentials = 'credentials',\n Default = 'default', // was 'arn',\n EC2IAMRole = 'ec2_iam_role',\n /**\n * @deprecated use default\n */\n ARN = 'arn',\n}\n\nexport interface AwsAuthDataSourceJsonData extends DataSourceJsonData {\n authType?: AwsAuthType;\n assumeRoleArn?: string;\n externalId?: string;\n profile?: string; // Credentials profile name, as specified in ~/.aws/credentials\n defaultRegion?: string; // region if it is not defined by your credentials file\n endpoint?: string;\n}\n\nexport interface AwsAuthDataSourceSecureJsonData {\n accessKey?: string;\n secretKey?: string;\n}\n","export const standardRegions: string[] = [\n 'af-south-1',\n 'ap-east-1',\n 'ap-northeast-1',\n 'ap-northeast-2',\n 'ap-northeast-3',\n 'ap-south-1',\n 'ap-southeast-1',\n 'ap-southeast-2',\n 'ca-central-1',\n 'cn-north-1',\n 'cn-northwest-1',\n 'eu-central-1',\n 'eu-north-1',\n 'eu-west-1',\n 'eu-west-2',\n 'eu-west-3',\n 'me-south-1',\n 'sa-east-1',\n 'us-east-1',\n 'us-east-2',\n 'us-gov-east-1',\n 'us-gov-west-1',\n 'us-iso-east-1',\n 'us-isob-east-1',\n 'us-west-1',\n 'us-west-2',\n];\n","import { SelectableValue } from '@grafana/data';\nimport { AwsAuthType } from './types';\n\nexport const awsAuthProviderOptions = [\n {\n label: 'Workspace IAM Role',\n value: AwsAuthType.EC2IAMRole,\n },\n {\n label: 'AWS SDK Default',\n value: AwsAuthType.Default,\n },\n {\n label: 'Access & secret key',\n value: AwsAuthType.Keys,\n },\n {\n label: 'Credentials file',\n value: AwsAuthType.Credentials,\n },\n] as Array<SelectableValue<AwsAuthType>>;\n","import React, { FC, useEffect, useState } from 'react';\nimport { Input, Select, InlineField, ButtonGroup, ToolbarButton, FieldSet } from '@grafana/ui';\nimport {\n DataSourcePluginOptionsEditorProps,\n onUpdateDatasourceJsonDataOptionSelect,\n onUpdateDatasourceResetOption,\n onUpdateDatasourceJsonDataOption,\n onUpdateDatasourceSecureJsonDataOption,\n} from '@grafana/data';\n\nimport { standardRegions } from './regions';\nimport { AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData, AwsAuthType } from './types';\nimport { awsAuthProviderOptions } from './providers';\n\nconst toOption = (value: string) => ({ value, label: value });\n\nexport interface ConnectionConfigProps<J = AwsAuthDataSourceJsonData, S = AwsAuthDataSourceSecureJsonData>\n extends DataSourcePluginOptionsEditorProps<J, S> {\n standardRegions?: string[];\n loadRegions?: () => Promise<string[]>;\n defaultEndpoint?: string;\n skipHeader?: boolean;\n skipEndpoint?: boolean;\n children?: React.ReactNode;\n}\n\nexport const ConnectionConfig: FC<ConnectionConfigProps> = (props: ConnectionConfigProps) => {\n const [regions, setRegions] = useState((props.standardRegions || standardRegions).map(toOption));\n const { loadRegions, onOptionsChange, skipHeader = false, skipEndpoint = false } = props;\n const options = props.options;\n let profile = options.jsonData.profile;\n if (profile === undefined) {\n profile = options.database;\n }\n\n const settings = (window as any).grafanaBootData.settings;\n const awsAllowedAuthProviders = settings.awsAllowedAuthProviders ?? [\n AwsAuthType.Default,\n AwsAuthType.Keys,\n AwsAuthType.Credentials,\n ];\n const awsAssumeRoleEnabled = settings.awsAssumeRoleEnabled ?? true;\n\n const currentProvider = awsAuthProviderOptions.find((p) => p.value === options.jsonData.authType);\n\n useEffect(() => {\n // Make sure a authType exists in the current model\n if (!currentProvider && awsAllowedAuthProviders.length) {\n onOptionsChange({\n ...options,\n jsonData: {\n ...options.jsonData,\n authType: awsAllowedAuthProviders[0],\n },\n });\n }\n }, [currentProvider, options, onOptionsChange]);\n\n useEffect(() => {\n if (!loadRegions) {\n return;\n }\n\n loadRegions().then((regions) => setRegions(regions.map(toOption)));\n }, [loadRegions]);\n\n return (\n <FieldSet label={skipHeader ? '' : 'Connection Details'} data-testid=\"connection-config\">\n <InlineField\n label=\"Authentication Provider\"\n labelWidth={28}\n tooltip=\"Specify which AWS credentials chain to use.\"\n >\n <Select\n className=\"width-30\"\n value={currentProvider}\n options={awsAuthProviderOptions.filter((opt) => awsAllowedAuthProviders.includes(opt.value!))}\n defaultValue={options.jsonData.authType}\n onChange={(option) => {\n onUpdateDatasourceJsonDataOptionSelect(props, 'authType')(option);\n }}\n />\n </InlineField>\n {options.jsonData.authType === 'credentials' && (\n <InlineField\n label=\"Credentials Profile Name\"\n labelWidth={28}\n tooltip=\"Credentials profile name, as specified in ~/.aws/credentials, leave blank for default.\"\n >\n <Input\n className=\"width-30\"\n placeholder=\"default\"\n value={profile}\n onChange={onUpdateDatasourceJsonDataOption(props, 'profile')}\n />\n </InlineField>\n )}\n\n {options.jsonData.authType === 'keys' && (\n <>\n <InlineField label=\"Access Key ID\" labelWidth={28}>\n {props.options.secureJsonFields?.accessKey ? (\n <ButtonGroup className=\"width-30\">\n <Input disabled placeholder=\"Configured\" />\n <ToolbarButton\n icon=\"edit\"\n tooltip=\"Edit Access Key ID\"\n type=\"button\"\n onClick={onUpdateDatasourceResetOption(props as any, 'accessKey')}\n />\n </ButtonGroup>\n ) : (\n <Input\n className=\"width-30\"\n value={options.secureJsonData?.accessKey ?? ''}\n onChange={onUpdateDatasourceSecureJsonDataOption(props, 'accessKey')}\n />\n )}\n </InlineField>\n\n <InlineField label=\"Secret Access Key\" labelWidth={28}>\n {props.options.secureJsonFields?.secretKey ? (\n <ButtonGroup className=\"width-30\">\n <Input disabled placeholder=\"Configured\" />\n <ToolbarButton\n icon=\"edit\"\n type=\"button\"\n tooltip=\"Edit Secret Access Key\"\n onClick={onUpdateDatasourceResetOption(props as any, 'secretKey')}\n />\n </ButtonGroup>\n ) : (\n <Input\n className=\"width-30\"\n value={options.secureJsonData?.secretKey ?? ''}\n onChange={onUpdateDatasourceSecureJsonDataOption(props, 'secretKey')}\n />\n )}\n </InlineField>\n </>\n )}\n\n {awsAssumeRoleEnabled && (\n <>\n <InlineField\n label=\"Assume Role ARN\"\n labelWidth={28}\n tooltip=\"Optionally, specify the ARN of a role to assume. Specifying a role here will ensure that the selected authentication provider is used to assume the specified role rather than using the credentials directly. Leave blank if you don't need to assume a role at all\"\n >\n <Input\n className=\"width-30\"\n placeholder=\"arn:aws:iam:*\"\n value={options.jsonData.assumeRoleArn || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'assumeRoleArn')}\n />\n </InlineField>\n <InlineField\n label=\"External ID\"\n labelWidth={28}\n tooltip=\"If you are assuming a role in another account, that has been created with an external ID, specify the external ID here.\"\n >\n <Input\n className=\"width-30\"\n placeholder=\"External ID\"\n value={options.jsonData.externalId || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'externalId')}\n />\n </InlineField>\n </>\n )}\n {!skipEndpoint && (\n <InlineField label=\"Endpoint\" labelWidth={28} tooltip=\"Optionally, specify a custom endpoint for the service\">\n <Input\n className=\"width-30\"\n placeholder={props.defaultEndpoint ?? 'https://{service}.{region}.amazonaws.com'}\n value={options.jsonData.endpoint || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'endpoint')}\n />\n </InlineField>\n )}\n <InlineField\n label=\"Default Region\"\n labelWidth={28}\n tooltip=\"Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region.\"\n >\n <Select\n className=\"width-30\"\n value={regions.find((region) => region.value === options.jsonData.defaultRegion)}\n options={regions}\n defaultValue={options.jsonData.defaultRegion}\n allowCustomValue={true}\n onChange={onUpdateDatasourceJsonDataOptionSelect(props, 'defaultRegion')}\n formatCreateLabel={(r) => `Use region: ${r}`}\n />\n </InlineField>\n {props.children}\n </FieldSet>\n );\n};\n"],"names":["AwsAuthType","standardRegions","awsAuthProviderOptions","label","value","EC2IAMRole","Default","Keys","Credentials","toOption","props","_k","__read","useState","map","regions","setRegions","loadRegions","onOptionsChange","_l","skipHeader","_m","skipEndpoint","options","profile","jsonData","undefined","database","settings","window","grafanaBootData","awsAllowedAuthProviders","awsAssumeRoleEnabled","currentProvider","find","p","authType","useEffect","length","then","React","FieldSet","InlineField","labelWidth","tooltip","Select","className","filter","opt","includes","defaultValue","onChange","option","onUpdateDatasourceJsonDataOptionSelect","Input","placeholder","onUpdateDatasourceJsonDataOption","secureJsonFields","accessKey","ButtonGroup","disabled","ToolbarButton","icon","type","onClick","onUpdateDatasourceResetOption","secureJsonData","onUpdateDatasourceSecureJsonDataOption","secretKey","assumeRoleArn","externalId","defaultEndpoint","endpoint","region","defaultRegion","allowCustomValue","formatCreateLabel","r","children"],"mappings":"8YAEYA,ECFCC,EAA4B,CACvC,aACA,YACA,iBACA,iBACA,iBACA,aACA,iBACA,iBACA,eACA,aACA,iBACA,eACA,aACA,YACA,YACA,YACA,aACA,YACA,YACA,YACA,gBACA,gBACA,gBACA,iBACA,YACA,cDxBUD,EAAAA,sBAAAA,qCAEVA,4BACAA,oBACAA,4BAIAA,gBEPWE,EAAyB,CACpC,CACEC,MAAO,qBACPC,MAAOJ,oBAAYK,YAErB,CACEF,MAAO,kBACPC,MAAOJ,oBAAYM,SAErB,CACEH,MAAO,sBACPC,MAAOJ,oBAAYO,MAErB,CACEJ,MAAO,mBACPC,MAAOJ,oBAAYQ,cCJjBC,EAAW,SAACL,GAAkB,OAAGA,QAAOD,MAAOC,6BAYM,SAACM,yBACpDC,yRAAAC,CAAwBC,YAAUH,EAAMT,iBAAmBA,GAAiBa,IAAIL,OAA/EM,OAASC,OACRC,EAA2EP,cAA9DQ,EAA8DR,kBAA7CS,EAA6CT,aAA7CU,gBAAoBC,EAAyBX,eAAzBY,gBACpDC,EAAUb,EAAMa,QAClBC,EAAUD,EAAQE,SAASD,aACfE,IAAZF,IACFA,EAAUD,EAAQI,UAGpB,IAAMC,EAAYC,OAAeC,gBAAgBF,SAC3CG,YAA0BH,EAASG,uCAA2B,CAClE/B,oBAAYM,QACZN,oBAAYO,KACZP,oBAAYQ,aAERwB,YAAuBJ,EAASI,qCAEhCC,EAAkB/B,EAAuBgC,MAAK,SAACC,GAAM,OAAAA,EAAE/B,QAAUmB,EAAQE,SAASW,YAuBxF,OArBAC,aAAU,YAEHJ,GAAmBF,EAAwBO,QAC9CpB,SACKK,IACHE,gBACKF,EAAQE,WACXW,SAAUL,EAAwB,UAIvC,CAACE,EAAiBV,EAASL,IAE9BmB,aAAU,WACHpB,GAILA,IAAcsB,MAAK,SAACxB,GAA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jB,SAAUgB,yCAAuCzD,EAAO,iBAOjEsB,GACCQ,gCACEA,gBAACE,eACCvC,MAAM,kBACNwC,WAAY,GACZC,QAAQ,wQAERJ,gBAACc,SACCR,UAAU,WACVS,YAAY,gBACZnD,MAAOmB,EAAQE,SAAS4C,eAAiB,GACzClB,SAAUK,mCAAiC9C,EAAO,oBAGtD8B,gBAACE,eACCvC,MAAM,cACNwC,WAAY,GACZC,QAAQ,2HAERJ,gBAACc,SACCR,UAAU,WACVS,YAAY,cACZnD,MAAOmB,EAAQE,SAAS6C,YAAc,GACtCnB,SAAUK,mCAAiC9C,EAAO,mBAKxDY,GACAkB,gBAACE,eAAYvC,MAAM,WAAWwC,WAAY,GAAIC,QAAQ,yDACpDJ,gBAACc,SACCR,UAAU,WACVS,sBAAa7C,EAAM6D,+BAAmB,2CACtCnE,MAAOmB,EAAQE,SAAS+C,UAAY,GACpCrB,SAAUK,mCAAiC9C,EAAO,eAIxD8B,gBAACE,eACCvC,MAAM,iBACNwC,WAAY,GACZC,QAAQ,qFAERJ,gBAACK,UACCC,UAAU,WACV1C,MAAOW,EAAQmB,MAAK,SAACuC,GAAW,OAAAA,EAAOrE,QAAUmB,EAAQE,SAASiD,iBAClEnD,QAASR,EACTmC,aAAc3B,EAAQE,SAASiD,cAC/BC,kBAAkB,EAClBxB,SAAUE,yCAAuC3C,EAAO,iBACxDkE,kBAAmB,SAACC,GAAM,MAAA,eAAeA,MAG5CnE,EAAMoE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafana/aws-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Common AWS features for grafana",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"bundle": "rollup -c rollup.config.ts",
|
|
10
10
|
"clean": "rimraf ./dist ./compiled",
|
|
11
11
|
"typecheck": "tsc --noEmit",
|
|
12
|
-
"publish": "npm publish --access=public --scope=grafana"
|
|
12
|
+
"publish": "npm publish --access=public --scope=grafana",
|
|
13
|
+
"test": "jest --notify --watch"
|
|
13
14
|
},
|
|
14
15
|
"files": [
|
|
15
16
|
"index.js",
|
|
@@ -18,17 +19,21 @@
|
|
|
18
19
|
"repository": "github:grafana/grafana-aws-sdk",
|
|
19
20
|
"author": "Grafana Labs <team@grafana.com> (https://grafanap.com)",
|
|
20
21
|
"license": "Apache-2.0",
|
|
21
|
-
"dependencies": {
|
|
22
|
-
"@grafana/data": "7.5.0-beta.1",
|
|
23
|
-
"@grafana/runtime": "7.5.0-beta.1",
|
|
24
|
-
"@grafana/ui": "7.5.0-beta.1"
|
|
25
|
-
},
|
|
22
|
+
"dependencies": {},
|
|
26
23
|
"devDependencies": {
|
|
27
|
-
"
|
|
24
|
+
"@grafana/data": "^7.5.0",
|
|
25
|
+
"@grafana/ui": "^7.5.0",
|
|
26
|
+
"@babel/preset-env": "^7.13.12",
|
|
27
|
+
"@babel/preset-react": "^7.13.13",
|
|
28
|
+
"@babel/preset-typescript": "^7.13.0",
|
|
29
|
+
"@grafana/toolkit": "^7.5.1",
|
|
28
30
|
"@grafana/tsconfig": "^1.0.0-rc1",
|
|
29
31
|
"@rollup/plugin-commonjs": "11.0.2",
|
|
30
32
|
"@rollup/plugin-json": "4.0.3",
|
|
31
33
|
"@rollup/plugin-node-resolve": "7.1.1",
|
|
34
|
+
"@testing-library/jest-dom": "^5.11.10",
|
|
35
|
+
"@testing-library/react": "^11.2.5",
|
|
36
|
+
"@testing-library/react-hooks": "^5.1.0",
|
|
32
37
|
"@types/braintree__sanitize-url": "4.0.0",
|
|
33
38
|
"@types/jest": "23.3.14",
|
|
34
39
|
"@types/jquery": "3.3.38",
|
|
@@ -36,9 +41,14 @@
|
|
|
36
41
|
"@types/node": "10.14.1",
|
|
37
42
|
"@types/papaparse": "5.2.0",
|
|
38
43
|
"@types/react": "16.8.16",
|
|
44
|
+
"@types/react-test-renderer": "^17.0.1",
|
|
39
45
|
"@types/rollup-plugin-visualizer": "2.6.0",
|
|
40
46
|
"@types/sinon": "^7.5.2",
|
|
47
|
+
"babel-jest": "^26.6.3",
|
|
48
|
+
"jest": "^26.6.3",
|
|
41
49
|
"pretty-format": "25.1.0",
|
|
50
|
+
"react-test-renderer": "^17.0.2",
|
|
51
|
+
"rimraf": "^3.0.2",
|
|
42
52
|
"rollup": "2.0.6",
|
|
43
53
|
"rollup-plugin-sourcemaps": "0.5.0",
|
|
44
54
|
"rollup-plugin-terser": "5.3.0",
|