diff --git a/web/packages/teleport/src/Discover/Database/ConnectAwsAccount/ConnectAwsAccount.tsx b/web/packages/teleport/src/Discover/Database/ConnectAwsAccount/ConnectAwsAccount.tsx new file mode 100644 index 0000000000000..0f47d8e35b5f1 --- /dev/null +++ b/web/packages/teleport/src/Discover/Database/ConnectAwsAccount/ConnectAwsAccount.tsx @@ -0,0 +1,217 @@ +/** + * Copyright 2023 Gravitational, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import React, { useEffect, useState } from 'react'; +import { Link } from 'react-router-dom'; +import { + Box, + ButtonLink, + Text, + ButtonPrimary, + Indicator, + Alert, + Flex, +} from 'design'; +import theme from 'design/theme'; +import FieldSelect from 'shared/components/FieldSelect'; +import useAttempt from 'shared/hooks/useAttemptNext'; +import { Option } from 'shared/components/Select'; +import Validation, { Validator } from 'shared/components/Validation'; +import { requiredField } from 'shared/components/Validation/rules'; +import TextEditor from 'shared/components/TextEditor'; + +import cfg from 'teleport/config'; +import { + IntegrationKind, + integrationService, +} from 'teleport/services/integrations'; +import { integrationRWE } from 'teleport/Discover/yamlTemplates'; +import useTeleport from 'teleport/useTeleport'; + +import { ActionButtons, HeaderSubtitle, HeaderWithBackBtn } from '../../Shared'; + +import { DbMeta, useDiscover } from '../../useDiscover'; + +export function ConnectAwsAccount() { + const { storeUser } = useTeleport(); + const { prevStep, nextStep, agentMeta, updateAgentMeta, eventState } = + useDiscover(); + + // TODO(lisa): also need to check for verb `use` which is pending + // work. + const access = storeUser.getIntegrationsAccess(); + const hasAccess = access.create && access.list; + const { attempt, run } = useAttempt(hasAccess ? 'processing' : ''); + + const [awsIntegrations, setAwsIntegrations] = useState([]); + const [selectedAwsIntegration, setSelectedAwsIntegration] = + useState