import type { FormikErrors, FormikProps } from 'formik'; import React from 'react'; import type { IWizardPageComponent } from '@spinnaker/core'; import { FormikFormField, FormValidator, TextInput } from '@spinnaker/core'; import { iamRoleValidator } from '../../aws.validators'; import type { IAmazonFunction } from '../../domain'; import type { IAmazonFunctionUpsertCommand } from '../../index'; export interface IExecutionRoleProps { formik: FormikProps; isNew?: boolean; functionDef: IAmazonFunction; } export class ExecutionRole extends React.Component implements IWizardPageComponent { constructor(props: IExecutionRoleProps) { super(props); } public validate(values: IAmazonFunctionUpsertCommand): FormikErrors { const validator = new FormValidator(values); validator.field('role', 'Role ARN').required().withValidators(iamRoleValidator); return validator.validateForm(); } public render() { return (
} required={true} />
); } }