Пример #1
0
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",
        )
Пример #2
0
def get_access_token() -> str:
    return ssm.get_parameter("/lumina/github/access-token")
Пример #3
0
def get_jwt_private_key() -> str:
    """Get private key for JWT signing."""
    return ssm.get_parameter("/lumina/jwt/private")
Пример #4
0
def get_jwt_public_key() -> str:
    """Get public key for JWT verification."""
    return ssm.get_parameter("/lumina/jwt/public")
Пример #5
0
def get_webhook_secret() -> str:
    return ssm.get_parameter("/lumina/github/webhook-secret")
Пример #6
0
 def test_get_missing_param(self):
     with pytest.raises(ValueError):
         ssm.get_parameter("/test/not-exists")
Пример #7
0
 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"