Skip to content

Commit 25a48da

Browse files
authored
Add allow_amend, internet and aleph_api parameters to create_program (#77)
1 parent 82f7c6a commit 25a48da

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/aleph/sdk/client/abstract.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,9 @@ async def create_program(
315315
vcpus: Optional[int] = None,
316316
timeout_seconds: Optional[float] = None,
317317
persistent: bool = False,
318+
allow_amend: bool = False,
319+
internet: bool = True,
320+
aleph_api: bool = True,
318321
encoding: Encoding = Encoding.zip,
319322
volumes: Optional[List[Mapping]] = None,
320323
subscriptions: Optional[List[Mapping]] = None,
@@ -335,6 +338,9 @@ async def create_program(
335338
:param vcpus: Number of vCPUs to allocate (Default: 1)
336339
:param timeout_seconds: Timeout in seconds (Default: 30.0)
337340
:param persistent: Whether the program should be persistent or not (Default: False)
341+
:param allow_amend: Whether the deployed VM image may be changed (Default: False)
342+
:param internet: Whether the VM should have internet connectivity. (Default: True)
343+
:param aleph_api: Whether the VM needs access to Aleph messages API (Default: True)
338344
:param encoding: Encoding to use (Default: Encoding.zip)
339345
:param volumes: Volumes to mount
340346
:param subscriptions: Patterns of aleph.im messages to forward to the program's event receiver

src/aleph/sdk/client/authenticated_http.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,9 @@ async def create_program(
401401
vcpus: Optional[int] = None,
402402
timeout_seconds: Optional[float] = None,
403403
persistent: bool = False,
404+
allow_amend: bool = False,
405+
internet: bool = True,
406+
aleph_api: bool = True,
404407
encoding: Encoding = Encoding.zip,
405408
volumes: Optional[List[Mapping]] = None,
406409
subscriptions: Optional[List[Mapping]] = None,
@@ -434,7 +437,7 @@ async def create_program(
434437
content = ProgramContent(
435438
type="vm-function",
436439
address=address,
437-
allow_amend=False,
440+
allow_amend=allow_amend,
438441
code=CodeContent(
439442
encoding=encoding,
440443
entrypoint=entrypoint,
@@ -444,8 +447,8 @@ async def create_program(
444447
on=triggers,
445448
environment=FunctionEnvironment(
446449
reproducible=False,
447-
internet=True,
448-
aleph_api=True,
450+
internet=internet,
451+
aleph_api=aleph_api,
449452
),
450453
variables=environment_variables,
451454
resources=MachineResources(

0 commit comments

Comments
 (0)