def check_ssm() -> HealthCheckCondition: try: # Check if the SSM service is available by grabbing a known key ssm.get_parameter("/lumina/jwt/public") return HealthCheckCondition( ok=True, timestamp=dates.now(), ) except ValueError: return HealthCheckCondition( ok=False, timestamp=dates.now(), message="Parameter not found", ) except botocore.exceptions.ClientError as e: log.error(e) return HealthCheckCondition( ok=False, timestamp=dates.now(), message="ClientError", ) except Exception as e: log.error(e) return HealthCheckCondition( ok=False, timestamp=dates.now(), message="Unknown error", )
def get_access_token() -> str: return ssm.get_parameter("/lumina/github/access-token")
def get_jwt_private_key() -> str: """Get private key for JWT signing.""" return ssm.get_parameter("/lumina/jwt/private")
def get_jwt_public_key() -> str: """Get public key for JWT verification.""" return ssm.get_parameter("/lumina/jwt/public")
def get_webhook_secret() -> str: return ssm.get_parameter("/lumina/github/webhook-secret")
def test_get_missing_param(self): with pytest.raises(ValueError): ssm.get_parameter("/test/not-exists")
def test_get_param(self): boto3.client("ssm", region_name=settings.aws_region).put_parameter( Name="/test/exists", Value="test", Type="String" ) assert ssm.get_parameter("/test/exists") == "test"