-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
209 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
tests/testdata/codegen/python-typed-dict/python/pulumi_typedDictExample/my_function.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# coding=utf-8 | ||
# *** WARNING: this file was generated by test. *** | ||
# *** Do not edit by hand unless you're certain you know what you are doing! *** | ||
|
||
import copy | ||
import warnings | ||
import sys | ||
import pulumi | ||
import pulumi.runtime | ||
from typing import Any, Mapping, Optional, Sequence, Union, overload | ||
if sys.version_info >= (3, 11): | ||
from typing import NotRequired, TypedDict | ||
else: | ||
from typing_extensions import NotRequired, TypedDict | ||
from . import _utilities | ||
from . import outputs | ||
from ._inputs import * | ||
import pulumi_kubernetes | ||
|
||
__all__ = [ | ||
'MyFunctionResult', | ||
'AwaitableMyFunctionResult', | ||
'my_function', | ||
'my_function_output', | ||
] | ||
|
||
@pulumi.output_type | ||
class MyFunctionResult: | ||
def __init__(__self__, my_output=None, simple_output=None): | ||
if my_output and not isinstance(my_output, dict): | ||
raise TypeError("Expected argument 'my_output' to be a dict") | ||
pulumi.set(__self__, "my_output", my_output) | ||
if simple_output and not isinstance(simple_output, str): | ||
raise TypeError("Expected argument 'simple_output' to be a str") | ||
pulumi.set(__self__, "simple_output", simple_output) | ||
|
||
@property | ||
@pulumi.getter(name="myOutput") | ||
def my_output(self) -> 'outputs.MyOutputType': | ||
return pulumi.get(self, "my_output") | ||
|
||
@property | ||
@pulumi.getter(name="simpleOutput") | ||
def simple_output(self) -> str: | ||
return pulumi.get(self, "simple_output") | ||
|
||
|
||
class AwaitableMyFunctionResult(MyFunctionResult): | ||
# pylint: disable=using-constant-test | ||
def __await__(self): | ||
if False: | ||
yield self | ||
return MyFunctionResult( | ||
my_output=self.my_output, | ||
simple_output=self.simple_output) | ||
|
||
|
||
def my_function(my_type: Optional[Union['MyType', 'MyTypeDict']] = None, | ||
simple_prop: Optional[str] = None, | ||
opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableMyFunctionResult: | ||
""" | ||
Use this data source to access information about an existing resource. | ||
""" | ||
__args__ = dict() | ||
__args__['myType'] = my_type | ||
__args__['simpleProp'] = simple_prop | ||
opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts) | ||
__ret__ = pulumi.runtime.invoke('typedDictExample:index:MyFunction', __args__, opts=opts, typ=MyFunctionResult).value | ||
|
||
return AwaitableMyFunctionResult( | ||
my_output=pulumi.get(__ret__, 'my_output'), | ||
simple_output=pulumi.get(__ret__, 'simple_output')) | ||
|
||
|
||
@_utilities.lift_output_func(my_function) | ||
def my_function_output(my_type: Optional[pulumi.Input[Union['MyType', 'MyTypeDict']]] = None, | ||
simple_prop: Optional[pulumi.Input[Optional[str]]] = None, | ||
opts: Optional[pulumi.InvokeOptions] = None) -> pulumi.Output[MyFunctionResult]: | ||
""" | ||
Use this data source to access information about an existing resource. | ||
""" | ||
... |
32 changes: 32 additions & 0 deletions
32
tests/testdata/codegen/python-typed-dict/python/pulumi_typedDictExample/outputs.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# coding=utf-8 | ||
# *** WARNING: this file was generated by test. *** | ||
# *** Do not edit by hand unless you're certain you know what you are doing! *** | ||
|
||
import copy | ||
import warnings | ||
import sys | ||
import pulumi | ||
import pulumi.runtime | ||
from typing import Any, Mapping, Optional, Sequence, Union, overload | ||
if sys.version_info >= (3, 11): | ||
from typing import NotRequired, TypedDict | ||
else: | ||
from typing_extensions import NotRequired, TypedDict | ||
from . import _utilities | ||
|
||
__all__ = [ | ||
'MyOutputType', | ||
] | ||
|
||
@pulumi.output_type | ||
class MyOutputType(dict): | ||
def __init__(__self__, *, | ||
some_result: str): | ||
pulumi.set(__self__, "some_result", some_result) | ||
|
||
@property | ||
@pulumi.getter(name="someResult") | ||
def some_result(self) -> str: | ||
return pulumi.get(self, "some_result") | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters