Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,21 @@ const OPTIONS = [

interface AwsAuthTypeSelectorProps {
selectedAuthType: AwsAuthType;
showIdentityFederation?: boolean;
onChange: (authType: AwsAuthType) => void;
}

export const AwsAuthTypeSelector: React.FC<AwsAuthTypeSelectorProps> = ({
selectedAuthType,
showIdentityFederation = true,
onChange,
}) => {
const options = showIdentityFederation
? OPTIONS
: OPTIONS.filter((o) => o.value !== 'identity_federation');
return (
<EuiSelect
options={OPTIONS}
options={options}
value={selectedAuthType}
onChange={(e) => onChange(e.target.value as AwsAuthType)}
aria-label={i18n.translate('xpack.fleet.awsConnectSetup.authType.selectorAriaLabel', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
EuiFlexItem,
EuiFormRow,
EuiLink,
EuiSkeletonText,
EuiSpacer,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
Expand Down Expand Up @@ -57,7 +58,7 @@ export const AwsIdentityFederationSetup: React.FC<AwsIdentityFederationSetupProp
onReadyChange,
onConnectorIdChange,
}) => {
const { data: cloudConnectors = [] } = useGetCloudConnectors({
const { data: cloudConnectors = [], isLoading: isLoadingConnectors } = useGetCloudConnectors({
cloudProvider: 'aws',
accountType,
packageName,
Expand Down Expand Up @@ -123,12 +124,16 @@ export const AwsIdentityFederationSetup: React.FC<AwsIdentityFederationSetupProp
const externalIdInvalid = hasInvalidRequiredVars && !externalId;
const isCreateDisabled = !roleArn || !externalId || !!getCloudConnectorNameError(connectorName);

const handleTabClick = useCallback((tab: { id: string }) => {
if (isLoadingConnectors) {
return <EuiSkeletonText lines={4} data-test-subj="awsIdentityFederationSetup-loading" />;
}

const handleTabClick = (tab: { id: string }) => {
setSelectedTabId(tab.id);
if (tab.id === TABS.NEW_CONNECTION) {
setSelectedConnectorId(undefined);
}
}, []);
};

const tabs: CloudConnectorTab[] = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export interface AwsConnectSetupProps {
initialConnectorId?: string;
initialStaticKeys?: Partial<AwsStaticKeyCredentials>;
initialTemporaryKeys?: Partial<AwsTemporaryKeyCredentials>;
showIdentityFederation?: boolean;
onNext?: () => void;
onConnectorIdChange?: (connectorId: string | undefined) => void;
onStaticKeysChange?: (keys: AwsStaticKeyCredentials | undefined) => void;
Expand All @@ -53,6 +54,7 @@ export const AwsConnectSetup: React.FC<AwsConnectSetupProps> = ({
initialConnectorId,
initialStaticKeys,
initialTemporaryKeys,
showIdentityFederation = true,
onNext,
onConnectorIdChange,
onStaticKeysChange,
Expand All @@ -63,7 +65,9 @@ export const AwsConnectSetup: React.FC<AwsConnectSetupProps> = ({
? 'temporary_keys'
: initialStaticKeys
? 'static_keys'
: 'identity_federation'
: showIdentityFederation
? 'identity_federation'
: 'static_keys'
);
const [isFormReady, setIsFormReady] = useState(false);

Expand Down Expand Up @@ -91,7 +95,11 @@ export const AwsConnectSetup: React.FC<AwsConnectSetupProps> = ({
</p>
</EuiText>
<EuiSpacer size="m" />
<AwsAuthTypeSelector selectedAuthType={authType} onChange={handleAuthTypeChange} />
<AwsAuthTypeSelector
selectedAuthType={authType}
showIdentityFederation={showIdentityFederation}
onChange={handleAuthTypeChange}
/>
<EuiSpacer size="l" />
{authType === 'identity_federation' && (
<AwsIdentityFederationSetup
Expand Down
1 change: 1 addition & 0 deletions x-pack/platform/plugins/shared/ingest_hub/moon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ dependsOn:
- '@kbn/kibana-react-plugin'
- '@kbn/react-query'
- '@kbn/fleet-plugin'
- '@kbn/i18n-react'
tags:
- plugin
- prod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import type {
DeliveryMethod,
SignalType,
ServiceCategory,
} from './aws_services_matrix';
import { AWS_SERVICES_MATRIX } from './aws_services_matrix';
} from './aws_service_matrix';
import { AWS_SERVICES_MATRIX } from './aws_service_matrix';

const VALID_SIGNAL_TYPES: SignalType[] = ['logs', 'metrics'];
const VALID_DELIVERY_METHODS: DeliveryMethod[] = ['agentless', 'firehose', 'cloud_forwarder'];
Expand Down Expand Up @@ -65,11 +65,16 @@ describe('AWS_SERVICES_MATRIX', () => {
});

it('has only valid delivery method values', () => {
entry.deliveryMethods.forEach((method) => {
entry.deliveryMethods.forEach(({ method }) => {
expect(VALID_DELIVERY_METHODS).toContain(method);
});
});

it('has exactly one preferred delivery method', () => {
const preferred = entry.deliveryMethods.filter((dm) => dm.preferred === true);
expect(preferred).toHaveLength(1);
});

it('has a non-empty packageName', () => {
expect(entry.packageName).toBeTruthy();
});
Expand Down
Loading
Loading