export default function SwitchTypeContent()

in aws-core-ui/src/App/SwitchTypeContent.tsx [11:32]


export default function SwitchTypeContent({ config }: { config: Config }) {
  const { watch } = useFormContext<FormFields>();
  const selectedConnectionType = watch(FormFieldsNames.AWS_CREDENTIALS_TYPE);

  let key: string | undefined;
  if (typeof selectedConnectionType === 'string') {
    key = selectedConnectionType;
  } else if (typeof selectedConnectionType === 'object') {
    key = selectedConnectionType.key;
  }

  switch (key) {
    case AwsCredentialsType.ACCESS_KEYS:
      return <AccessKeysConnectionType />;
    case AwsCredentialsType.IAM_ROLE:
      return <IamRoleConnectionType config={config} />;
    case AwsCredentialsType.DEFAULT_PROVIDER:
      return <DefaultConnectionType />;
    default:
      return <div />;
  }
}