mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-17 20:38:06 +00:00
Interact with migrations via cli (#2816)
* Interact with migrations via cli * Move command under notifications
This commit is contained in:
@ -13,7 +13,7 @@ import time
|
||||
import uuid
|
||||
from enum import Enum
|
||||
from shutil import which
|
||||
from typing import Callable, Dict, List, Optional, Tuple, Type, TypeVar
|
||||
from typing import Callable, Dict, List, Optional, Tuple, Type, TypeVar, Union
|
||||
from urllib.parse import urlparse
|
||||
from uuid import UUID
|
||||
|
||||
@ -859,6 +859,30 @@ class Notifications(Endpoint):
|
||||
data=requests.NotificationSearch(container=container),
|
||||
)
|
||||
|
||||
def migrate_jinja_to_scriban(
|
||||
self, dry_run: bool = False
|
||||
) -> Union[
|
||||
responses.JinjaToScribanMigrationResponse,
|
||||
responses.JinjaToScribanMigrationDryRunResponse,
|
||||
]:
|
||||
"""Migrates all notification templates from jinja to scriban"""
|
||||
|
||||
migration_endpoint = "migrations/jinja_to_scriban"
|
||||
if dry_run:
|
||||
return self._req_model(
|
||||
"POST",
|
||||
responses.JinjaToScribanMigrationDryRunResponse,
|
||||
data=requests.JinjaToScribanMigrationPost(dry_run=dry_run),
|
||||
alternate_endpoint=migration_endpoint,
|
||||
)
|
||||
else:
|
||||
return self._req_model(
|
||||
"POST",
|
||||
responses.JinjaToScribanMigrationResponse,
|
||||
data=requests.JinjaToScribanMigrationPost(dry_run=dry_run),
|
||||
alternate_endpoint=migration_endpoint,
|
||||
)
|
||||
|
||||
|
||||
class Tasks(Endpoint):
|
||||
"""Interact with tasks"""
|
||||
|
Reference in New Issue
Block a user