function isMatchingRotationSchedule()

in src/rules/secretsmanager/SecretsManagerRotationEnabled.ts [99:129]


function isMatchingRotationSchedule(
  node: CfnRotationSchedule,
  secretLogicalId: string,
  secretTargetAttachmentLogicalIds: string[]
): boolean {
  const resourceSecretId = NagRules.resolveResourceFromInstrinsic(
    node,
    node.secretId
  );
  if (
    secretLogicalId === resourceSecretId ||
    secretTargetAttachmentLogicalIds.includes(resourceSecretId)
  ) {
    if (
      Stack.of(node).resolve(node.hostedRotationLambda) === undefined &&
      Stack.of(node).resolve(node.rotationLambdaArn) === undefined
    ) {
      return false;
    }
    const rotationRules = Stack.of(node).resolve(node.rotationRules);
    if (rotationRules !== undefined) {
      const automaticallyAfterDays = Stack.of(node).resolve(
        rotationRules.automaticallyAfterDays
      );
      if (automaticallyAfterDays !== undefined) {
        return true;
      }
    }
  }
  return false;
}