diff --git a/pkg/k2/language_host/python/samples/fastapi_postgres/infra.py b/pkg/k2/language_host/python/samples/fastapi_postgres/infra.py index 3fc67a95..3fb8a889 100644 --- a/pkg/k2/language_host/python/samples/fastapi_postgres/infra.py +++ b/pkg/k2/language_host/python/samples/fastapi_postgres/infra.py @@ -5,10 +5,8 @@ # Create the Application instance app = klotho.Application( - "my-app", - project=os.getenv("PROJECT_NAME", "my-project"), # Default to 'my-project' or the environment variable value - environment=os.getenv("KLOTHO_ENVIRONMENT", "default"), # Default to 'default' or the environment variable value - default_region=os.getenv("AWS_REGION", "us-east-1"), # Default to 'us-east-1' or the environment variable value + "app", + project=os.getenv("PROJECT_NAME", "fastapi_postgres"), ) # Generate an absolute path to the directory containing the infra.py file /Dockerfile diff --git a/pkg/k2/language_host/python/samples/func/infra.py b/pkg/k2/language_host/python/samples/func/infra.py index 06fec5f8..62e4fa57 100644 --- a/pkg/k2/language_host/python/samples/func/infra.py +++ b/pkg/k2/language_host/python/samples/func/infra.py @@ -6,15 +6,8 @@ # Create the Application instance app = klotho.Application( - "my-app", - project=os.getenv( - "PROJECT_NAME", "my-project" - ), # Default to 'my-project' or the environment variable value - environment=os.getenv("KLOTHO_ENVIRONMENT", "default"), - # Default to 'default' or the environment variable value - default_region=os.getenv( - "AWS_REGION", "us-west-2" - ), # Default to 'us-east-1' or the environment variable value + "app", + project=os.getenv("PROJECT_NAME", "func"), ) dir = Path(__file__).parent.absolute() diff --git a/pkg/k2/language_host/python/samples/func_dynamo/infra.py b/pkg/k2/language_host/python/samples/func_dynamo/infra.py index 8ae4d361..498cb4c4 100644 --- a/pkg/k2/language_host/python/samples/func_dynamo/infra.py +++ b/pkg/k2/language_host/python/samples/func_dynamo/infra.py @@ -6,10 +6,8 @@ # Create the Application instance app = klotho.Application( - "my-dynamo-app", - project=os.getenv("PROJECT_NAME", "my-project"), - environment=os.getenv("KLOTHO_ENVIRONMENT", "default"), - default_region=os.getenv("AWS_REGION", "us-west-2"), + "app", + project=os.getenv("PROJECT_NAME", "func_dynamo"), ) dir = Path(__file__).parent.absolute() @@ -39,4 +37,4 @@ code=str(dir), ) -my_function.bind(dynamodb) \ No newline at end of file +my_function.bind(dynamodb) diff --git a/pkg/k2/language_host/python/samples/starter/infra-api.py b/pkg/k2/language_host/python/samples/starter/infra-api.py index ff8d1fe3..53ac94aa 100644 --- a/pkg/k2/language_host/python/samples/starter/infra-api.py +++ b/pkg/k2/language_host/python/samples/starter/infra-api.py @@ -1,5 +1,21 @@ -import infra +import os +from pathlib import Path + +import klotho import klotho.aws as aws +app = klotho.Application( + "api", + project=os.getenv("PROJECT_NAME", "starter1"), +) + +dir = Path(__file__).parent.absolute() + +container = aws.Container( + "my-container", + dockerfile=str(dir / "Dockerfile"), + context=str(dir), +) + api = aws.Api("my-api") -api.route_to("/", infra.container) +api.route_to("/", container) diff --git a/pkg/k2/language_host/python/samples/starter/infra-binding.py b/pkg/k2/language_host/python/samples/starter/infra-binding.py index 804ec216..2a8be383 100644 --- a/pkg/k2/language_host/python/samples/starter/infra-binding.py +++ b/pkg/k2/language_host/python/samples/starter/infra-binding.py @@ -3,23 +3,13 @@ import klotho import klotho.aws as aws -# Create the Application instance app = klotho.Application( - "binding-app", - project=os.getenv( - "PROJECT_NAME", "my-project" - ), # Default to 'my-project' or the environment variable value - environment=os.getenv("KLOTHO_ENVIRONMENT", "default"), - # Default to 'default' or the environment variable value - default_region=os.getenv( - "AWS_REGION", "us-west-2" - ), # Default to 'us-east-1' or the environment variable value + "my-app", + project=os.getenv("PROJECT_NAME", "starter.binding"), ) -# Create a Bucket resource bucket = aws.Bucket("my-bucket", force_destroy=True) -# Create a Container resource with a binding to the Bucket resource container = aws.Container( "my-container", dockerfile="Dockerfile", bindings=[bucket.use_read_only()] ) diff --git a/pkg/k2/language_host/python/samples/starter/infra-dynamodb.py b/pkg/k2/language_host/python/samples/starter/infra-dynamodb.py index 94e1fa84..e7350305 100644 --- a/pkg/k2/language_host/python/samples/starter/infra-dynamodb.py +++ b/pkg/k2/language_host/python/samples/starter/infra-dynamodb.py @@ -6,12 +6,10 @@ # Create the Application instance app = klotho.Application( - "my-dynamo-app", - project=os.getenv("PROJECT_NAME", "my-project"), - environment=os.getenv("KLOTHO_ENVIRONMENT", "default"), - default_region=os.getenv("AWS_REGION", "us-west-2"), + "dynamodb", + project=os.getenv("PROJECT_NAME", "starter"), ) dir = Path(__file__).parent.absolute() -dynamodb = aws.DynamoDB("my-dynamodb", attributes=[{"Name": "id", "Type": "S"}], hash_key="id") \ No newline at end of file +dynamodb = aws.DynamoDB("my-dynamodb", attributes=[{"Name": "id", "Type": "S"}], hash_key="id") diff --git a/pkg/k2/language_host/python/samples/starter/infra.py b/pkg/k2/language_host/python/samples/starter/infra.py index 005d2353..1ba4ab62 100644 --- a/pkg/k2/language_host/python/samples/starter/infra.py +++ b/pkg/k2/language_host/python/samples/starter/infra.py @@ -6,15 +6,8 @@ # Create the Application instance app = klotho.Application( - "my-app", - project=os.getenv( - "PROJECT_NAME", "my-project" - ), # Default to 'my-project' or the environment variable value - environment=os.getenv("KLOTHO_ENVIRONMENT", "default"), - # Default to 'default' or the environment variable value - default_region=os.getenv( - "AWS_REGION", "us-west-2" - ), # Default to 'us-east-1' or the environment variable value + "basic", + project=os.getenv("PROJECT_NAME", "starter"), ) dir = Path(__file__).parent.absolute()