create AWS infra
This commit is contained in:
22
src/infra/state.py
Normal file
22
src/infra/state.py
Normal file
@@ -0,0 +1,22 @@
|
||||
import json
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
INFRA_STATE_FILE = ".qai-cli-infra.json"
|
||||
|
||||
|
||||
def state_path(config_dir: str) -> Path:
|
||||
return Path(config_dir) / INFRA_STATE_FILE
|
||||
|
||||
|
||||
def read_infra_state(config_dir: str) -> dict[str, Any]:
|
||||
path = state_path(config_dir)
|
||||
if not path.exists():
|
||||
return {}
|
||||
with open(path) as f:
|
||||
return json.load(f)
|
||||
|
||||
|
||||
def write_infra_state(config_dir: str, state: dict[str, Any]) -> None:
|
||||
with open(state_path(config_dir), "w") as f:
|
||||
json.dump(state, f, indent=2)
|
||||
Reference in New Issue
Block a user