pulumi/tests/testdata/codegen/output-funcs-go-generics-only/go/mypkg/funcWithAllOptionalInputs.go

79 lines
2.7 KiB
Go

// Code generated by test DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package mypkg
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumix"
"output-funcs-go-generics-only/mypkg/internal"
)
// Check codegen of functions with all optional inputs.
func FuncWithAllOptionalInputs(ctx *pulumi.Context, args *FuncWithAllOptionalInputsArgs, opts ...pulumi.InvokeOption) (*FuncWithAllOptionalInputsResult, error) {
opts = internal.PkgInvokeDefaultOpts(opts)
var rv FuncWithAllOptionalInputsResult
err := ctx.Invoke("mypkg::funcWithAllOptionalInputs", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
type FuncWithAllOptionalInputsArgs struct {
// Property A
A *string `pulumi:"a"`
// Property B
B *string `pulumi:"b"`
}
type FuncWithAllOptionalInputsResult struct {
R string `pulumi:"r"`
}
func FuncWithAllOptionalInputsOutput(ctx *pulumi.Context, args FuncWithAllOptionalInputsOutputArgs, opts ...pulumi.InvokeOption) FuncWithAllOptionalInputsResultOutput {
outputResult := pulumix.ApplyErr[*FuncWithAllOptionalInputsArgs](args.ToOutput(), func(plainArgs *FuncWithAllOptionalInputsArgs) (*FuncWithAllOptionalInputsResult, error) {
return FuncWithAllOptionalInputs(ctx, plainArgs, opts...)
})
return pulumix.Cast[FuncWithAllOptionalInputsResultOutput, *FuncWithAllOptionalInputsResult](outputResult)
}
type FuncWithAllOptionalInputsOutputArgs struct {
// Property A
A pulumix.Input[*string] `pulumi:"a"`
// Property B
B pulumix.Input[*string] `pulumi:"b"`
}
func (args FuncWithAllOptionalInputsOutputArgs) ToOutput() pulumix.Output[*FuncWithAllOptionalInputsArgs] {
allArgs := pulumix.All(
args.A.ToOutput(context.Background()).AsAny(),
args.B.ToOutput(context.Background()).AsAny())
return pulumix.Apply[[]any](allArgs, func(resolvedArgs []interface{}) *FuncWithAllOptionalInputsArgs {
return &FuncWithAllOptionalInputsArgs{
A: resolvedArgs[0].(*string),
B: resolvedArgs[1].(*string),
}
})
}
type FuncWithAllOptionalInputsResultOutput struct{ *pulumi.OutputState }
func (FuncWithAllOptionalInputsResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*FuncWithAllOptionalInputsResult)(nil)).Elem()
}
func (o FuncWithAllOptionalInputsResultOutput) ToOutput(context.Context) pulumix.Output[*FuncWithAllOptionalInputsResult] {
return pulumix.Output[*FuncWithAllOptionalInputsResult]{
OutputState: o.OutputState,
}
}
func (o FuncWithAllOptionalInputsResultOutput) R() pulumix.Output[string] {
return pulumix.Apply[*FuncWithAllOptionalInputsResult](o, func(v *FuncWithAllOptionalInputsResult) string { return v.R })
}