Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dagger/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "localstack-dagger-module"
name = "localstack"
version = "0.1.0"
requires-python = ">=3.10"
dependencies = ["dagger-io", "requests"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""A generated module for LocalstackDaggerModule functions
"""A generated module for Localstack functions

This module has been generated via dagger init and serves as a reference to
basic module structure as you get started with Dagger.
Expand All @@ -13,4 +13,4 @@
if appropriate. All modules should have a short description.
"""

from .main import LocalstackDaggerModule as LocalstackDaggerModule
from .main import Localstack as Localstack
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


@object_type
class LocalstackDaggerModule:
class Localstack:
@function
def start(
self,
Expand Down
2 changes: 1 addition & 1 deletion .dagger/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dagger.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "localstack-dagger-module",
"name": "localstack",
"engineVersion": "v0.18.2",
"sdk": {
"source": "python"
Expand Down
2 changes: 1 addition & 1 deletion examples/python/dagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"dependencies": [
{
"name": "localstack-dagger-module",
"name": "localstack",
"source": "../.."
}
]
Expand Down
28 changes: 14 additions & 14 deletions examples/python/src/example/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
@object_type
class Example:
@function
async def localstack_dagger_module__quickstart(self) -> str:
async def localstack__quickstart(self) -> str:
"""Example showing how to start LocalStack Community edition."""
service = dag.localstack_dagger_module().start()
service = dag.localstack().start()

await service.start()
endpoint = await service.endpoint()
Expand Down Expand Up @@ -40,10 +40,10 @@ async def localstack_dagger_module__quickstart(self) -> str:
print(f"S3 object content: {content}")

@function
async def localstack_dagger_module__pro(self, auth_token: dagger.Secret) -> str:
async def localstack__pro(self, auth_token: dagger.Secret) -> str:
"""Example showing how to start LocalStack Pro with custom configuration."""
# Start LocalStack Pro using the module
service = dag.localstack_dagger_module().start(
service = dag.localstack().start(
auth_token=auth_token,
configuration="DEBUG=1,SERVICES=ecr"
)
Expand All @@ -66,9 +66,9 @@ async def localstack_dagger_module__pro(self, auth_token: dagger.Secret) -> str:
print(f"ECR repository '{repository_name}' created")

@function
async def localstack_dagger_module__state(self, auth_token: dagger.Secret) -> str:
async def localstack__state(self, auth_token: dagger.Secret) -> str:
"""Example showing how to manage LocalStack state using Cloud Pods."""
service = dag.localstack_dagger_module().start(auth_token=auth_token)
service = dag.localstack().start(auth_token=auth_token)
await service.start()
endpoint = await service.endpoint()

Expand All @@ -84,20 +84,20 @@ async def localstack_dagger_module__state(self, auth_token: dagger.Secret) -> st
s3.create_bucket(Bucket='test-bucket')

# Save state to Cloud Pod
await dag.localstack_dagger_module().state(
await dag.localstack().state(
auth_token=auth_token,
save="test-dagger-example-pod",
endpoint=f"http://{endpoint}"
)

# Reset state
await dag.localstack_dagger_module().state(
await dag.localstack().state(
reset=True,
endpoint=f"http://{endpoint}"
)

# Load state back
await dag.localstack_dagger_module().state(
await dag.localstack().state(
auth_token=auth_token,
load="test-dagger-example-pod",
endpoint=f"http://{endpoint}"
Expand All @@ -108,11 +108,11 @@ async def localstack_dagger_module__state(self, auth_token: dagger.Secret) -> st
return f"Error: {str(e)}"

@function
async def localstack_dagger_module_ephemeral(self, auth_token: dagger.Secret) -> str:
async def localstack_ephemeral(self, auth_token: dagger.Secret) -> str:
"""Example showing how to manage LocalStack Ephemeral Instances."""
try:
# Create a new ephemeral instance
await dag.localstack_dagger_module().ephemeral(
await dag.localstack().ephemeral(
auth_token=auth_token,
operation="create",
name="test-dagger-example-instance",
Expand All @@ -125,15 +125,15 @@ async def localstack_dagger_module_ephemeral(self, auth_token: dagger.Secret) ->
print("Instance created")

# List instances
list_response = await dag.localstack_dagger_module().ephemeral(
list_response = await dag.localstack().ephemeral(
auth_token=auth_token,
operation="list"
)

print(f"Ephemeral instances: {list_response}")

# Get instance logs
instance_logs = await dag.localstack_dagger_module().ephemeral(
instance_logs = await dag.localstack().ephemeral(
auth_token=auth_token,
operation="logs",
name="test-dagger-example-instance"
Expand All @@ -142,7 +142,7 @@ async def localstack_dagger_module_ephemeral(self, auth_token: dagger.Secret) ->
print(f"Instance logs: {instance_logs}")

# Delete instance
await dag.localstack_dagger_module().ephemeral(
await dag.localstack().ephemeral(
auth_token=auth_token,
operation="delete",
name="test-dagger-example-instance"
Expand Down
2 changes: 1 addition & 1 deletion examples/typescript/dagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"dependencies": [
{
"name": "localstack-dagger-module",
"name": "localstack",
"source": "../.."
}
]
Expand Down
28 changes: 14 additions & 14 deletions examples/typescript/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ export class Example {
* @returns Promise<void>
*/
@func()
async localstack_dagger_module__quickstart() {
async localstack__quickstart() {
await connect(async (client) => {
// Start LocalStack using the module
const service = client.localstackDaggerModule().start()
const service = client.localstack().start()

await service.start()
const endpoint = await service.endpoint()
Expand Down Expand Up @@ -69,9 +69,9 @@ export class Example {
* @returns Promise<void>
*/
@func()
async localstack_dagger_module__pro(authToken: Secret) {
async localstack__pro(authToken: Secret) {
await connect(async (client) => {
const service = client.localstackDaggerModule().start({
const service = client.localstack().start({
authToken,
configuration: "DEBUG=1,SERVICES=ecr",
})
Expand Down Expand Up @@ -107,9 +107,9 @@ export class Example {
* @returns Promise<void>
*/
@func()
async localstack_dagger_module__state(authToken: Secret) {
async localstack__state(authToken: Secret) {
await connect(async (client) => {
const service = client.localstackDaggerModule().start({
const service = client.localstack().start({
authToken
})

Expand All @@ -133,7 +133,7 @@ export class Example {
console.log("Test bucket created")

// Save state to Cloud Pod
await client.localstackDaggerModule().state({
await client.localstack().state({
authToken,
save: "test-dagger-example-pod",
endpoint: `http://${endpoint}`
Expand All @@ -142,14 +142,14 @@ export class Example {
console.log("State saved to Cloud Pod")

// Reset state
await client.localstackDaggerModule().state({
await client.localstack().state({
reset: true,
endpoint: `http://${endpoint}`
})
console.log("State reset")

// Load state back
await client.localstackDaggerModule().state({
await client.localstack().state({
authToken,
load: "test-dagger-example-pod",
endpoint: `http://${endpoint}`
Expand All @@ -168,10 +168,10 @@ export class Example {
* @returns Promise<void>
*/
@func()
async localstack_dagger_module__ephemeral(authToken: Secret) {
async localstack__ephemeral(authToken: Secret) {
await connect(async (client) => {
// Create a new ephemeral instance
await client.localstackDaggerModule().ephemeral(
await client.localstack().ephemeral(
authToken,
"create",
{
Expand All @@ -185,14 +185,14 @@ export class Example {
await new Promise(resolve => setTimeout(resolve, 15000))

// List instances
const listResponse = await client.localstackDaggerModule().ephemeral(
const listResponse = await client.localstack().ephemeral(
authToken,
"list"
)
console.log(`Ephemeral instances: ${listResponse}`)

// Get instance logs
const instanceLogs = await client.localstackDaggerModule().ephemeral(
const instanceLogs = await client.localstack().ephemeral(
authToken,
"logs",
{
Expand All @@ -202,7 +202,7 @@ export class Example {
console.log(`Instance logs: ${instanceLogs}`)

// Delete instance
await client.localstackDaggerModule().ephemeral(
await client.localstack().ephemeral(
authToken,
"delete",
{
Expand Down
Loading