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

75 lines
2.4 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 a Dict<str,str> parameter.
func FuncWithDictParam(ctx *pulumi.Context, args *FuncWithDictParamArgs, opts ...pulumi.InvokeOption) (*FuncWithDictParamResult, error) {
opts = internal.PkgInvokeDefaultOpts(opts)
var rv FuncWithDictParamResult
err := ctx.Invoke("mypkg::funcWithDictParam", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
type FuncWithDictParamArgs struct {
A map[string]string `pulumi:"a"`
B *string `pulumi:"b"`
}
type FuncWithDictParamResult struct {
R string `pulumi:"r"`
}
func FuncWithDictParamOutput(ctx *pulumi.Context, args FuncWithDictParamOutputArgs, opts ...pulumi.InvokeOption) FuncWithDictParamResultOutput {
outputResult := pulumix.ApplyErr[*FuncWithDictParamArgs](args.ToOutput(), func(plainArgs *FuncWithDictParamArgs) (*FuncWithDictParamResult, error) {
return FuncWithDictParam(ctx, plainArgs, opts...)
})
return pulumix.Cast[FuncWithDictParamResultOutput, *FuncWithDictParamResult](outputResult)
}
type FuncWithDictParamOutputArgs struct {
A pulumix.Input[map[string]string] `pulumi:"a"`
B pulumix.Input[*string] `pulumi:"b"`
}
func (args FuncWithDictParamOutputArgs) ToOutput() pulumix.Output[*FuncWithDictParamArgs] {
allArgs := pulumix.All(
args.A.ToOutput(context.Background()).AsAny(),
args.B.ToOutput(context.Background()).AsAny())
return pulumix.Apply[[]any](allArgs, func(resolvedArgs []interface{}) *FuncWithDictParamArgs {
return &FuncWithDictParamArgs{
A: resolvedArgs[0].(map[string]string),
B: resolvedArgs[1].(*string),
}
})
}
type FuncWithDictParamResultOutput struct{ *pulumi.OutputState }
func (FuncWithDictParamResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*FuncWithDictParamResult)(nil)).Elem()
}
func (o FuncWithDictParamResultOutput) ToOutput(context.Context) pulumix.Output[*FuncWithDictParamResult] {
return pulumix.Output[*FuncWithDictParamResult]{
OutputState: o.OutputState,
}
}
func (o FuncWithDictParamResultOutput) R() pulumix.Output[string] {
return pulumix.Apply[*FuncWithDictParamResult](o, func(v *FuncWithDictParamResult) string { return v.R })
}