in s3-artifact-storage-ui/src/App/S3/AwsS3.tsx [109:151]
function toConnectionsData(
connId: string | undefined,
config: Config,
methods: UseFormReturn,
onSuccess: (connection: Option) => void,
dpc: boolean,
connectionsFilter: ((type: string) => boolean) | undefined
): AwsConnectionData {
const { getValues, watch } = methods;
const secretInput = watch(FormFields.SECRET_ACCESS_KEY);
let secret = '';
if (secretInput) {
secret =
secretInput === PASSWORD_STUB
? config.secretAcessKeyValue
: encodeSecret(secretInput, config.publicKey);
}
return {
awsConnectionId: connId,
key: getValues(FormFields.ACCESS_KEY_ID),
secret,
allRegionKeys: config.regionCodes,
allRegionValues: config.regionDescriptions,
projectId: config.projectId,
publicKey: config.publicKey,
onSuccess,
defaultProviderChain: config.showDefaultCredentialsChain,
credentialsType: dpc
? AwsConnectionCredentialsType.DEFAULT_PROVIDER
: AwsConnectionCredentialsType.ACCESS_KEYS,
region: '',
awsConnectionsUrl: config.postConnectionUrl,
awsAvailableConnectionsControllerUrl:
config.availableAwsConnectionsControllerUrl,
awsAvailableConnectionsResource:
config.availableAwsConnectionsControllerResource,
testConnectionsUrl: config.testConnectionUrl,
awsConnectionTypesFilter: connectionsFilter,
} as AwsConnectionData;
}