diff --git a/changelog/pending/20221208--sdkgen-dotnet-go-nodejs-python--do-not-generate-result-types-for-functions-with-empty-outputs.yaml b/changelog/pending/20221208--sdkgen-dotnet-go-nodejs-python--do-not-generate-result-types-for-functions-with-empty-outputs.yaml new file mode 100644 index 000000000000..3478fa51ab5c --- /dev/null +++ b/changelog/pending/20221208--sdkgen-dotnet-go-nodejs-python--do-not-generate-result-types-for-functions-with-empty-outputs.yaml @@ -0,0 +1,4 @@ +changes: +- type: fix + scope: sdkgen/dotnet,go,nodejs,python + description: Do not generate Result types for functions with empty outputs diff --git a/pkg/codegen/dotnet/gen.go b/pkg/codegen/dotnet/gen.go index e2ab8dd01fce..8f776f2c1b7b 100644 --- a/pkg/codegen/dotnet/gen.go +++ b/pkg/codegen/dotnet/gen.go @@ -1349,7 +1349,7 @@ func (mod *modContext) genFunction(w io.Writer, fun *schema.Function) error { fmt.Fprintf(w, "{\n") var typeParameter string - if fun.Outputs != nil { + if fun.Outputs != nil && len(fun.Outputs.Properties) > 0 { typeParameter = fmt.Sprintf("<%sResult>", className) } @@ -1412,7 +1412,7 @@ func (mod *modContext) genFunction(w io.Writer, fun *schema.Function) error { return err } - if fun.Outputs != nil { + if fun.Outputs != nil && len(fun.Outputs.Properties) > 0 { fmt.Fprintf(w, "\n") res := &plainType{ diff --git a/pkg/codegen/go/gen.go b/pkg/codegen/go/gen.go index f8e26cc9fdfd..67a9f2437aec 100644 --- a/pkg/codegen/go/gen.go +++ b/pkg/codegen/go/gen.go @@ -2110,7 +2110,7 @@ func (pkg *pkgContext) genFunction(w io.Writer, f *schema.Function) error { argsig = fmt.Sprintf("%s, args *%sArgs", argsig, name) } var retty string - if f.Outputs == nil { + if f.Outputs == nil || len(f.Outputs.Properties) == 0 { retty = "error" } else { retty = fmt.Sprintf("(*%sResult, error)", name) @@ -2129,7 +2129,7 @@ func (pkg *pkgContext) genFunction(w io.Writer, f *schema.Function) error { // Now simply invoke the runtime function with the arguments. var outputsType string - if f.Outputs == nil { + if f.Outputs == nil || len(f.Outputs.Properties) == 0 { outputsType = "struct{}" } else { outputsType = name + "Result" @@ -2143,7 +2143,7 @@ func (pkg *pkgContext) genFunction(w io.Writer, f *schema.Function) error { fmt.Fprintf(w, "\tvar rv %s\n", outputsType) fmt.Fprintf(w, "\terr := ctx.Invoke(\"%s\", %s, &rv, opts...)\n", f.Token, inputsVar) - if f.Outputs == nil { + if f.Outputs == nil || len(f.Outputs.Properties) == 0 { fmt.Fprintf(w, "\treturn err\n") } else { // Check the error before proceeding. @@ -2173,7 +2173,7 @@ func (pkg *pkgContext) genFunction(w io.Writer, f *schema.Function) error { } } } - if f.Outputs != nil { + if f.Outputs != nil && len(f.Outputs.Properties) > 0 { fmt.Fprintf(w, "\n") fnOutputsName := pkg.functionResultTypeName(f) pkg.genPlainType(w, fnOutputsName, f.Outputs.Comment, "", f.Outputs.Properties) diff --git a/pkg/codegen/nodejs/gen.go b/pkg/codegen/nodejs/gen.go index f2c00b6d1150..90c8b5554040 100644 --- a/pkg/codegen/nodejs/gen.go +++ b/pkg/codegen/nodejs/gen.go @@ -1146,7 +1146,7 @@ func (mod *modContext) genFunction(w io.Writer, fun *schema.Function) (functionF } info.functionArgsInterfaceName = argsInterfaceName } - if fun.Outputs != nil { + if fun.Outputs != nil && len(fun.Outputs.Properties) > 0 { fmt.Fprintf(w, "\n") resultInterfaceName := title(name) + "Result" if err := mod.genPlainType(w, resultInterfaceName, fun.Outputs.Comment, fun.Outputs.Properties, false, true, 0); err != nil { @@ -1170,7 +1170,7 @@ func functionArgsOptional(fun *schema.Function) bool { } func functionReturnType(fun *schema.Function) string { - if fun.Outputs == nil { + if fun.Outputs == nil || len(fun.Outputs.Properties) == 0 { return "void" } return title(tokenToFunctionName(fun.Token)) + "Result" diff --git a/pkg/codegen/python/gen.go b/pkg/codegen/python/gen.go index c437c53db726..dfa70a6c382e 100644 --- a/pkg/codegen/python/gen.go +++ b/pkg/codegen/python/gen.go @@ -365,29 +365,54 @@ func genStandardHeader(w io.Writer, tool string) { fmt.Fprintf(w, "# *** Do not edit by hand unless you're certain you know what you are doing! ***\n\n") } +func typingImports() []string { + return []string{ + "Any", + "Mapping", + "Optional", + "Sequence", + "Union", + "overload", + } +} + +func (mod *modContext) generateCommonImports(w io.Writer, imports imports, typingImports []string) { + rel, err := filepath.Rel(mod.mod, "") + contract.Assert(err == nil) + relRoot := path.Dir(rel) + relImport := relPathToRelImport(relRoot) + + fmt.Fprintf(w, "import copy\n") + fmt.Fprintf(w, "import warnings\n") + fmt.Fprintf(w, "import pulumi\n") + fmt.Fprintf(w, "import pulumi.runtime\n") + fmt.Fprintf(w, "from typing import %s\n", strings.Join(typingImports, ", ")) + fmt.Fprintf(w, "from %s import _utilities\n", relImport) + for _, imp := range imports.strings() { + fmt.Fprintf(w, "%s\n", imp) + } + fmt.Fprintf(w, "\n") +} + func (mod *modContext) genHeader(w io.Writer, needsSDK bool, imports imports) { genStandardHeader(w, mod.tool) // If needed, emit the standard Pulumi SDK import statement. if needsSDK { - rel, err := filepath.Rel(mod.mod, "") - contract.Assert(err == nil) - relRoot := path.Dir(rel) - relImport := relPathToRelImport(relRoot) - - fmt.Fprintf(w, "import copy\n") - fmt.Fprintf(w, "import warnings\n") - fmt.Fprintf(w, "import pulumi\n") - fmt.Fprintf(w, "import pulumi.runtime\n") - fmt.Fprintf(w, "from typing import Any, Mapping, Optional, Sequence, Union, overload\n") - fmt.Fprintf(w, "from %s import _utilities\n", relImport) - for _, imp := range imports.strings() { - fmt.Fprintf(w, "%s\n", imp) - } - fmt.Fprintf(w, "\n") + typings := typingImports() + mod.generateCommonImports(w, imports, typings) } } +func (mod *modContext) genFunctionHeader(w io.Writer, function *schema.Function, imports imports) { + genStandardHeader(w, mod.tool) + typings := typingImports() + if function.Outputs == nil || len(function.Outputs.Properties) == 0 { + typings = append(typings, "Awaitable") + } + mod.generateCommonImports(w, imports, typings) +} + func relPathToRelImport(relPath string) string { // Convert relative path to relative import e.g. "../.." -> "..." // https://realpython.com/absolute-vs-relative-python-imports/#relative-imports @@ -1696,17 +1721,17 @@ func (mod *modContext) genFunction(fun *schema.Function) (string, error) { mod.collectImports(fun.Outputs.Properties, imports, false) } - mod.genHeader(w, true /*needsSDK*/, imports) + mod.genFunctionHeader(w, fun, imports) var baseName, awaitableName string - if fun.Outputs != nil { + if fun.Outputs != nil && len(fun.Outputs.Properties) > 0 { baseName, awaitableName = awaitableTypeNames(fun.Outputs.Token) } name := PyName(tokenToName(fun.Token)) // Export only the symbols we want exported. fmt.Fprintf(w, "__all__ = [\n") - if fun.Outputs != nil { + if fun.Outputs != nil && len(fun.Outputs.Properties) > 0 { fmt.Fprintf(w, " '%s',\n", baseName) fmt.Fprintf(w, " '%s',\n", awaitableName) } @@ -1724,9 +1749,11 @@ func (mod *modContext) genFunction(fun *schema.Function) (string, error) { // If there is a return type, emit it. retTypeName := "" var rets []*schema.Property - if fun.Outputs != nil { + if fun.Outputs != nil && len(fun.Outputs.Properties) > 0 { retTypeName, rets = mod.genAwaitableType(w, fun.Outputs), fun.Outputs.Properties fmt.Fprintf(w, "\n\n") + } else { + retTypeName = "Awaitable[None]" } var args []*schema.Property @@ -1750,7 +1777,7 @@ func (mod *modContext) genFunction(fun *schema.Function) (string, error) { // Now simply invoke the runtime function with the arguments. var typ string - if fun.Outputs != nil { + if fun.Outputs != nil && len(fun.Outputs.Properties) > 0 { // Pass along the private output_type we generated, so any nested outputs classes are instantiated by // the call to invoke. typ = fmt.Sprintf(", typ=%s", baseName) @@ -1759,7 +1786,7 @@ func (mod *modContext) genFunction(fun *schema.Function) (string, error) { fmt.Fprintf(w, "\n") // And copy the results to an object, if there are indeed any expected returns. - if fun.Outputs != nil { + if fun.Outputs != nil && len(fun.Outputs.Properties) > 0 { fmt.Fprintf(w, " return %s(", retTypeName) for i, ret := range rets { if i > 0 { diff --git a/pkg/codegen/schema/schema.go b/pkg/codegen/schema/schema.go index 46f072ab3eb6..58983ad60a59 100644 --- a/pkg/codegen/schema/schema.go +++ b/pkg/codegen/schema/schema.go @@ -561,7 +561,7 @@ func (fun *Function) NeedsOutputVersion() bool { // support them and return `Task`, but there are no such // functions in `pulumi-azure-native` or `pulumi-aws` so we // omit to simplify. - if fun.Outputs == nil { + if fun.Outputs == nil || len(fun.Outputs.Properties) == 0 { return false } diff --git a/pkg/codegen/testing/test/testdata/output-funcs/docs/funcwithemptyoutputs/_index.md b/pkg/codegen/testing/test/testdata/output-funcs/docs/funcwithemptyoutputs/_index.md index 58d6c6102acf..f8be5fb64f71 100644 --- a/pkg/codegen/testing/test/testdata/output-funcs/docs/funcwithemptyoutputs/_index.md +++ b/pkg/codegen/testing/test/testdata/output-funcs/docs/funcwithemptyoutputs/_index.md @@ -19,11 +19,6 @@ n/a ## Using funcWithEmptyOutputs {#using} -Two invocation forms are available. The direct form accepts plain -arguments and either blocks until the result value is available, or -returns a Promise-wrapped result. The output form accepts -Input-wrapped arguments and returns an Output-wrapped result. -
@@ -34,8 +29,6 @@ Input-wrapped arguments and returns an Output-wrapped result.
function funcWithEmptyOutputs(args: FuncWithEmptyOutputsArgs, opts?: InvokeOptions): Promise<FuncWithEmptyOutputsResult>
-function funcWithEmptyOutputsOutput(args: FuncWithEmptyOutputsOutputArgs, opts?: InvokeOptions): Output<FuncWithEmptyOutputsResult>
@@ -46,9 +39,6 @@ function funcWithEmptyOutputsOutput(
def func_with_empty_outputs(name: Optional[str] = None,
                             opts: Optional[InvokeOptions] = None) -> FuncWithEmptyOutputsResult
-def func_with_empty_outputs_output(name: Optional[pulumi.Input[str]] = None,
-                            opts: Optional[InvokeOptions] = None) -> Output[FuncWithEmptyOutputsResult]
@@ -58,8 +48,6 @@ def
func_with_empty_outputs_output(
func FuncWithEmptyOutputs(ctx *Context, args *FuncWithEmptyOutputsArgs, opts ...InvokeOption) (*FuncWithEmptyOutputsResult, error)
-func FuncWithEmptyOutputsOutput(ctx *Context, args *FuncWithEmptyOutputsOutputArgs, opts ...InvokeOption) FuncWithEmptyOutputsResultOutput
> Note: This function is named `FuncWithEmptyOutputs` in the Go SDK. @@ -72,8 +60,7 @@ func
FuncWithEmptyOutputsOutput(c
public static class FuncWithEmptyOutputs 
 {
-    public static Task<FuncWithEmptyOutputsResult> InvokeAsync(FuncWithEmptyOutputsArgs args, InvokeOptions? opts = null)
-    public static Output<FuncWithEmptyOutputsResult> Invoke(FuncWithEmptyOutputsInvokeArgs args, InvokeOptions? opts = null)
+    public static Task<FuncWithEmptyOutputsResult> InvokeAsync(FuncWithEmptyOutputsArgs args, InvokeOptions? opts = null)
 }
diff --git a/pkg/codegen/testing/test/testdata/output-funcs/dotnet/FuncWithEmptyOutputs.cs b/pkg/codegen/testing/test/testdata/output-funcs/dotnet/FuncWithEmptyOutputs.cs index 54eeb96d6a75..d5fab76b0904 100644 --- a/pkg/codegen/testing/test/testdata/output-funcs/dotnet/FuncWithEmptyOutputs.cs +++ b/pkg/codegen/testing/test/testdata/output-funcs/dotnet/FuncWithEmptyOutputs.cs @@ -14,14 +14,8 @@ public static class FuncWithEmptyOutputs /// /// n/a /// - public static Task InvokeAsync(FuncWithEmptyOutputsArgs args, InvokeOptions? options = null) - => global::Pulumi.Deployment.Instance.InvokeAsync("mypkg::funcWithEmptyOutputs", args ?? new FuncWithEmptyOutputsArgs(), options.WithDefaults()); - - /// - /// n/a - /// - public static Output Invoke(FuncWithEmptyOutputsInvokeArgs args, InvokeOptions? options = null) - => global::Pulumi.Deployment.Instance.Invoke("mypkg::funcWithEmptyOutputs", args ?? new FuncWithEmptyOutputsInvokeArgs(), options.WithDefaults()); + public static Task InvokeAsync(FuncWithEmptyOutputsArgs args, InvokeOptions? options = null) + => global::Pulumi.Deployment.Instance.InvokeAsync("mypkg::funcWithEmptyOutputs", args ?? new FuncWithEmptyOutputsArgs(), options.WithDefaults()); } @@ -38,28 +32,4 @@ public FuncWithEmptyOutputsArgs() } public static new FuncWithEmptyOutputsArgs Empty => new FuncWithEmptyOutputsArgs(); } - - public sealed class FuncWithEmptyOutputsInvokeArgs : global::Pulumi.InvokeArgs - { - /// - /// The Name of the FeatureGroup. - /// - [Input("name", required: true)] - public Input Name { get; set; } = null!; - - public FuncWithEmptyOutputsInvokeArgs() - { - } - public static new FuncWithEmptyOutputsInvokeArgs Empty => new FuncWithEmptyOutputsInvokeArgs(); - } - - - [OutputType] - public sealed class FuncWithEmptyOutputsResult - { - [OutputConstructor] - private FuncWithEmptyOutputsResult() - { - } - } } diff --git a/pkg/codegen/testing/test/testdata/output-funcs/go/mypkg/funcWithEmptyOutputs.go b/pkg/codegen/testing/test/testdata/output-funcs/go/mypkg/funcWithEmptyOutputs.go index edf25d7bd3cc..8589fa8e5383 100644 --- a/pkg/codegen/testing/test/testdata/output-funcs/go/mypkg/funcWithEmptyOutputs.go +++ b/pkg/codegen/testing/test/testdata/output-funcs/go/mypkg/funcWithEmptyOutputs.go @@ -4,66 +4,17 @@ package mypkg import ( - "context" - "reflect" - "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) // n/a -func FuncWithEmptyOutputs(ctx *pulumi.Context, args *FuncWithEmptyOutputsArgs, opts ...pulumi.InvokeOption) (*FuncWithEmptyOutputsResult, error) { - var rv FuncWithEmptyOutputsResult +func FuncWithEmptyOutputs(ctx *pulumi.Context, args *FuncWithEmptyOutputsArgs, opts ...pulumi.InvokeOption) error { + var rv struct{} err := ctx.Invoke("mypkg::funcWithEmptyOutputs", args, &rv, opts...) - if err != nil { - return nil, err - } - return &rv, nil + return err } type FuncWithEmptyOutputsArgs struct { // The Name of the FeatureGroup. Name string `pulumi:"name"` } - -type FuncWithEmptyOutputsResult struct { -} - -func FuncWithEmptyOutputsOutput(ctx *pulumi.Context, args FuncWithEmptyOutputsOutputArgs, opts ...pulumi.InvokeOption) FuncWithEmptyOutputsResultOutput { - return pulumi.ToOutputWithContext(context.Background(), args). - ApplyT(func(v interface{}) (FuncWithEmptyOutputsResult, error) { - args := v.(FuncWithEmptyOutputsArgs) - r, err := FuncWithEmptyOutputs(ctx, &args, opts...) - var s FuncWithEmptyOutputsResult - if r != nil { - s = *r - } - return s, err - }).(FuncWithEmptyOutputsResultOutput) -} - -type FuncWithEmptyOutputsOutputArgs struct { - // The Name of the FeatureGroup. - Name pulumi.StringInput `pulumi:"name"` -} - -func (FuncWithEmptyOutputsOutputArgs) ElementType() reflect.Type { - return reflect.TypeOf((*FuncWithEmptyOutputsArgs)(nil)).Elem() -} - -type FuncWithEmptyOutputsResultOutput struct{ *pulumi.OutputState } - -func (FuncWithEmptyOutputsResultOutput) ElementType() reflect.Type { - return reflect.TypeOf((*FuncWithEmptyOutputsResult)(nil)).Elem() -} - -func (o FuncWithEmptyOutputsResultOutput) ToFuncWithEmptyOutputsResultOutput() FuncWithEmptyOutputsResultOutput { - return o -} - -func (o FuncWithEmptyOutputsResultOutput) ToFuncWithEmptyOutputsResultOutputWithContext(ctx context.Context) FuncWithEmptyOutputsResultOutput { - return o -} - -func init() { - pulumi.RegisterOutputType(FuncWithEmptyOutputsResultOutput{}) -} diff --git a/pkg/codegen/testing/test/testdata/output-funcs/nodejs/funcWithEmptyOutputs.ts b/pkg/codegen/testing/test/testdata/output-funcs/nodejs/funcWithEmptyOutputs.ts index 228f98fab6cf..aba76f190603 100644 --- a/pkg/codegen/testing/test/testdata/output-funcs/nodejs/funcWithEmptyOutputs.ts +++ b/pkg/codegen/testing/test/testdata/output-funcs/nodejs/funcWithEmptyOutputs.ts @@ -7,7 +7,7 @@ import * as utilities from "./utilities"; /** * n/a */ -export function funcWithEmptyOutputs(args: FuncWithEmptyOutputsArgs, opts?: pulumi.InvokeOptions): Promise { +export function funcWithEmptyOutputs(args: FuncWithEmptyOutputsArgs, opts?: pulumi.InvokeOptions): Promise { opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts || {}); return pulumi.runtime.invoke("mypkg::funcWithEmptyOutputs", { @@ -21,19 +21,3 @@ export interface FuncWithEmptyOutputsArgs { */ name: string; } - -export interface FuncWithEmptyOutputsResult { -} -/** - * n/a - */ -export function funcWithEmptyOutputsOutput(args: FuncWithEmptyOutputsOutputArgs, opts?: pulumi.InvokeOptions): pulumi.Output { - return pulumi.output(args).apply((a: any) => funcWithEmptyOutputs(a, opts)) -} - -export interface FuncWithEmptyOutputsOutputArgs { - /** - * The Name of the FeatureGroup. - */ - name: pulumi.Input; -} diff --git a/pkg/codegen/testing/test/testdata/output-funcs/nodejs/index.ts b/pkg/codegen/testing/test/testdata/output-funcs/nodejs/index.ts index c4fa16d58047..0eb08e6bd842 100644 --- a/pkg/codegen/testing/test/testdata/output-funcs/nodejs/index.ts +++ b/pkg/codegen/testing/test/testdata/output-funcs/nodejs/index.ts @@ -24,10 +24,9 @@ export const funcWithDictParam: typeof import("./funcWithDictParam").funcWithDic export const funcWithDictParamOutput: typeof import("./funcWithDictParam").funcWithDictParamOutput = null as any; utilities.lazyLoad(exports, ["funcWithDictParam","funcWithDictParamOutput"], () => require("./funcWithDictParam")); -export { FuncWithEmptyOutputsArgs, FuncWithEmptyOutputsResult, FuncWithEmptyOutputsOutputArgs } from "./funcWithEmptyOutputs"; +export { FuncWithEmptyOutputsArgs } from "./funcWithEmptyOutputs"; export const funcWithEmptyOutputs: typeof import("./funcWithEmptyOutputs").funcWithEmptyOutputs = null as any; -export const funcWithEmptyOutputsOutput: typeof import("./funcWithEmptyOutputs").funcWithEmptyOutputsOutput = null as any; -utilities.lazyLoad(exports, ["funcWithEmptyOutputs","funcWithEmptyOutputsOutput"], () => require("./funcWithEmptyOutputs")); +utilities.lazyLoad(exports, ["funcWithEmptyOutputs"], () => require("./funcWithEmptyOutputs")); export { FuncWithListParamArgs, FuncWithListParamResult, FuncWithListParamOutputArgs } from "./funcWithListParam"; export const funcWithListParam: typeof import("./funcWithListParam").funcWithListParam = null as any; diff --git a/pkg/codegen/testing/test/testdata/output-funcs/python/pulumi_mypkg/func_with_const_input.py b/pkg/codegen/testing/test/testdata/output-funcs/python/pulumi_mypkg/func_with_const_input.py index e65015b2dd67..730d3c2fb85b 100644 --- a/pkg/codegen/testing/test/testdata/output-funcs/python/pulumi_mypkg/func_with_const_input.py +++ b/pkg/codegen/testing/test/testdata/output-funcs/python/pulumi_mypkg/func_with_const_input.py @@ -6,7 +6,7 @@ import warnings import pulumi import pulumi.runtime -from typing import Any, Mapping, Optional, Sequence, Union, overload +from typing import Any, Mapping, Optional, Sequence, Union, overload, Awaitable from . import _utilities __all__ = [ @@ -14,7 +14,7 @@ ] def func_with_const_input(plain_input: Optional[str] = None, - opts: Optional[pulumi.InvokeOptions] = None): + opts: Optional[pulumi.InvokeOptions] = None) -> Awaitable[None]: """ Codegen demo with const inputs """ diff --git a/pkg/codegen/testing/test/testdata/output-funcs/python/pulumi_mypkg/func_with_empty_outputs.py b/pkg/codegen/testing/test/testdata/output-funcs/python/pulumi_mypkg/func_with_empty_outputs.py index f3d101b8290d..9d0d6c81f9c4 100644 --- a/pkg/codegen/testing/test/testdata/output-funcs/python/pulumi_mypkg/func_with_empty_outputs.py +++ b/pkg/codegen/testing/test/testdata/output-funcs/python/pulumi_mypkg/func_with_empty_outputs.py @@ -6,31 +6,15 @@ import warnings import pulumi import pulumi.runtime -from typing import Any, Mapping, Optional, Sequence, Union, overload +from typing import Any, Mapping, Optional, Sequence, Union, overload, Awaitable from . import _utilities __all__ = [ - 'FuncWithEmptyOutputsResult', - 'AwaitableFuncWithEmptyOutputsResult', 'func_with_empty_outputs', - 'func_with_empty_outputs_output', ] -@pulumi.output_type -class FuncWithEmptyOutputsResult: - def __init__(__self__): - pass - -class AwaitableFuncWithEmptyOutputsResult(FuncWithEmptyOutputsResult): - # pylint: disable=using-constant-test - def __await__(self): - if False: - yield self - return FuncWithEmptyOutputsResult() - - def func_with_empty_outputs(name: Optional[str] = None, - opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableFuncWithEmptyOutputsResult: + opts: Optional[pulumi.InvokeOptions] = None) -> Awaitable[None]: """ n/a @@ -40,18 +24,5 @@ def func_with_empty_outputs(name: Optional[str] = None, __args__ = dict() __args__['name'] = name opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts) - __ret__ = pulumi.runtime.invoke('mypkg::funcWithEmptyOutputs', __args__, opts=opts, typ=FuncWithEmptyOutputsResult).value + __ret__ = pulumi.runtime.invoke('mypkg::funcWithEmptyOutputs', __args__, opts=opts).value - return AwaitableFuncWithEmptyOutputsResult() - - -@_utilities.lift_output_func(func_with_empty_outputs) -def func_with_empty_outputs_output(name: Optional[pulumi.Input[str]] = None, - opts: Optional[pulumi.InvokeOptions] = None) -> pulumi.Output[FuncWithEmptyOutputsResult]: - """ - n/a - - - :param str name: The Name of the FeatureGroup. - """ - ... diff --git a/pkg/codegen/testing/test/testdata/regress-node-8110/python/pulumi_my8110/example_func.py b/pkg/codegen/testing/test/testdata/regress-node-8110/python/pulumi_my8110/example_func.py index eb63bf80019c..f7e64ab757f1 100644 --- a/pkg/codegen/testing/test/testdata/regress-node-8110/python/pulumi_my8110/example_func.py +++ b/pkg/codegen/testing/test/testdata/regress-node-8110/python/pulumi_my8110/example_func.py @@ -6,7 +6,7 @@ import warnings import pulumi import pulumi.runtime -from typing import Any, Mapping, Optional, Sequence, Union, overload +from typing import Any, Mapping, Optional, Sequence, Union, overload, Awaitable from . import _utilities from ._enums import * @@ -15,7 +15,7 @@ ] def example_func(enums: Optional[Sequence[Union[str, 'MyEnum']]] = None, - opts: Optional[pulumi.InvokeOptions] = None): + opts: Optional[pulumi.InvokeOptions] = None) -> Awaitable[None]: """ Use this data source to access information about an existing resource. """ diff --git a/pkg/codegen/testing/test/testdata/simple-plain-schema/python/pulumi_example/do_foo.py b/pkg/codegen/testing/test/testdata/simple-plain-schema/python/pulumi_example/do_foo.py index 3635cb794612..17cf22139d81 100644 --- a/pkg/codegen/testing/test/testdata/simple-plain-schema/python/pulumi_example/do_foo.py +++ b/pkg/codegen/testing/test/testdata/simple-plain-schema/python/pulumi_example/do_foo.py @@ -6,7 +6,7 @@ import warnings import pulumi import pulumi.runtime -from typing import Any, Mapping, Optional, Sequence, Union, overload +from typing import Any, Mapping, Optional, Sequence, Union, overload, Awaitable from . import _utilities from ._inputs import * @@ -15,7 +15,7 @@ ] def do_foo(foo: Optional[pulumi.InputType['Foo']] = None, - opts: Optional[pulumi.InvokeOptions] = None): + opts: Optional[pulumi.InvokeOptions] = None) -> Awaitable[None]: """ Use this data source to access information about an existing resource. """