"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getAWSAuthSection = void 0;
const index_js_1 = require("../../../types/index.js");
const getAWSAuthSection = (config) => {
    return {
        name: 'auth',
        borderThreshold: 1,
        items: [
            {
                label: 'Auth type',
                name: 'awsAuthType',
                startVersion: config.startVersion,
                componentType: index_js_1.FormComponentType.DROPDOWN,
                initialValue: index_js_1.AWSAuthType.ACCESS_KEY,
                options: Object.values(index_js_1.AWSAuthType).map((authType) => ({
                    displayName: (0, index_js_1.getAWSAuthTypeDisplayName)(authType),
                    value: authType,
                    key: authType
                })),
                agentType: index_js_1.AgentType.ONPREMISE
            },
            {
                label: 'Region',
                name: 'authentication.custom.region.value',
                startVersion: config.startVersion,
                componentType: index_js_1.FormComponentType.INPUT_TEXT,
                display: {
                    show: {
                        awsAuthType: [index_js_1.AWSAuthType.ACCESS_KEY, index_js_1.AWSAuthType.EC2_INSTANCE_METADATA, index_js_1.AWSAuthType.TOKEN_FILE]
                    }
                },
                agentType: index_js_1.AgentType.ONPREMISE
            },
            {
                label: 'Access key ID',
                name: 'authentication.custom.accessKeyID.value',
                startVersion: config.startVersion,
                componentType: index_js_1.FormComponentType.INPUT_TEXT,
                display: {
                    show: {
                        awsAuthType: [index_js_1.AWSAuthType.ACCESS_KEY]
                    }
                },
                agentType: index_js_1.AgentType.ONPREMISE
            },
            {
                label: 'Secret key',
                name: 'authentication.custom.secretKey.value',
                startVersion: config.startVersion,
                componentType: index_js_1.FormComponentType.INPUT_TEXT,
                dataType: index_js_1.InputDataType.PASSWORD,
                display: {
                    show: {
                        awsAuthType: [index_js_1.AWSAuthType.ACCESS_KEY]
                    }
                },
                agentType: index_js_1.AgentType.ONPREMISE
            },
            {
                label: 'IAM role ARN (optional)',
                name: 'authentication.custom.iamRoleArn.value',
                startVersion: config.startVersionForRoleAssumption,
                componentType: index_js_1.FormComponentType.INPUT_TEXT,
                display: {
                    show: {
                        awsAuthType: [index_js_1.AWSAuthType.ACCESS_KEY, index_js_1.AWSAuthType.EC2_INSTANCE_METADATA, index_js_1.AWSAuthType.TOKEN_FILE]
                    }
                },
                agentType: index_js_1.AgentType.ONPREMISE,
                rules: [{ required: false }]
            },
            {
                label: '',
                messageTemplate: `This option allows you to use [Service Account Token Volume Projection](https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html) to authorize your On-Premise Agent to connect to your S3 Buckets.`,
                name: 'TokenFileAlert',
                startVersion: config.startVersion,
                componentType: index_js_1.FormComponentType.ALERT,
                agentType: index_js_1.AgentType.ONPREMISE,
                display: {
                    show: {
                        awsAuthType: [index_js_1.AWSAuthType.TOKEN_FILE]
                    }
                }
            },
            {
                label: '',
                messageTemplate: `This option allows you to use [EC2 Instance Metadata](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html) to authorize your On-Premise Agent to connect to your S3 Buckets. If you are using [Kube2Iam](https://github.com/jtblin/kube2iam), you would select this option.`,
                name: 'EC2InstanceMetadataAlert',
                startVersion: config.startVersion,
                componentType: index_js_1.FormComponentType.ALERT,
                agentType: index_js_1.AgentType.ONPREMISE,
                display: {
                    show: {
                        awsAuthType: [index_js_1.AWSAuthType.EC2_INSTANCE_METADATA]
                    }
                }
            }
        ]
    };
};
exports.getAWSAuthSection = getAWSAuthSection;
//# sourceMappingURL=aws.js.map