assertIamRoleServiceCode

assertIamRoleServiceCode( value: unknown, fieldName: string, ownerName: string, ): IamRoleServiceCode

Validates that a resolved value is an allowed IAM role service code and returns it narrowed.

Remarks

Fail-fast validator for the serviceCode segment of an IAM role name: it rejects any value outside iamRoleServiceCodes (all lowercase) rather than coercing it. Prefer referencing the codes directly (for example iamRoleServiceCodes.s3); use this helper when the code is a computed value that must be validated at runtime.

Parameters

  • value (unknown) — Resolved service code, already un-wrapped from any Input/Output.
  • fieldName (string) — Consumer-facing argument path used in error messages (for example args.serviceCode).
  • ownerName (string) — Component name used in error messages.

Returns