MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / validateBedrockArn

Function validateBedrockArn

webview-ui/src/utils/validate.ts:217–235  ·  view source on GitHub ↗
(arn: string, region?: string)

Source from the content-addressed store, hash-verified

215 * @returns An object with validation results: { isValid, arnRegion, errorMessage }
216 */
217export function validateBedrockArn(arn: string, region?: string) {
218 // Try to extract region from ARN for region mismatch warning.
219 // This is a permissive regex that attempts to find the region component
220 // without enforcing strict ARN format validation.
221 const regionMatch = arn.match(/^arn:[^:]+:[^:]+:([^:]+):/)
222 const arnRegion = regionMatch?.[1]
223
224 // Check if region in ARN matches provided region (if specified).
225 if (region && arnRegion && arnRegion !== region) {
226 return {
227 isValid: true,
228 arnRegion,
229 errorMessage: i18next.t("settings:validation.arn.regionMismatch", { arnRegion, region }),
230 }
231 }
232
233 // ARN is always considered valid - trust the user to enter valid ARNs.
234 return { isValid: true, arnRegion, errorMessage: undefined }
235}
236
237function validateDynamicProviderModelId(
238 apiConfiguration: ProviderSettings,

Callers 2

BedrockCustomArnFunction · 0.90
validate.spec.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected