def create_prefect_project(environment: str, prefect_token_secret_name: str): """ Get the Prefect Agent definition for an environment that run workflows on AWS ECS Fargate Parameters: environment [str] -- environment to create the prefect project prefect_token_secret_name [str] -- aws secret name for the prefect token """ client = Client(api_token=get_prefect_token( secret_name=prefect_token_secret_name)) client.create_project(project_name=f"{environment}_dataflow_automation")
def create_prefect_project(environment: str, prefect_agent_token: str) -> None: """ Get the Prefect Agent definition for an environment that run workflows on AWS ECS Fargate Parameters: environment [str] -- environment to create the prefect project prefect_agent_token [str] -- prefect token """ client = Client(api_token=prefect_agent_token) try: client.create_project( project_name=f"{environment}_dataflow_automation") except AuthorizationError: error_message = ( "Invalid API token provided. Check that the secret " "PREFECT_AGENT_TOKEN is set on the Github repository configuration" ) logger.error(error_message) raise AuthorizationError(error_message)