github.com/myhau/pulumi/pkg/v3@v3.70.2-0.20221116134521-f2775972e587/codegen/testing/test/testdata/simple-resource-schema/go/example/argFunction.go (about)

     1  // Code generated by test DO NOT EDIT.
     2  // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
     3  
     4  package example
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    11  )
    12  
    13  func ArgFunction(ctx *pulumi.Context, args *ArgFunctionArgs, opts ...pulumi.InvokeOption) (*ArgFunctionResult, error) {
    14  	opts = pkgInvokeDefaultOpts(opts)
    15  	var rv ArgFunctionResult
    16  	err := ctx.Invoke("example::argFunction", args, &rv, opts...)
    17  	if err != nil {
    18  		return nil, err
    19  	}
    20  	return &rv, nil
    21  }
    22  
    23  type ArgFunctionArgs struct {
    24  	Arg1 *Resource `pulumi:"arg1"`
    25  }
    26  
    27  type ArgFunctionResult struct {
    28  	Result *Resource `pulumi:"result"`
    29  }
    30  
    31  func ArgFunctionOutput(ctx *pulumi.Context, args ArgFunctionOutputArgs, opts ...pulumi.InvokeOption) ArgFunctionResultOutput {
    32  	return pulumi.ToOutputWithContext(context.Background(), args).
    33  		ApplyT(func(v interface{}) (ArgFunctionResult, error) {
    34  			args := v.(ArgFunctionArgs)
    35  			r, err := ArgFunction(ctx, &args, opts...)
    36  			var s ArgFunctionResult
    37  			if r != nil {
    38  				s = *r
    39  			}
    40  			return s, err
    41  		}).(ArgFunctionResultOutput)
    42  }
    43  
    44  type ArgFunctionOutputArgs struct {
    45  	Arg1 ResourceInput `pulumi:"arg1"`
    46  }
    47  
    48  func (ArgFunctionOutputArgs) ElementType() reflect.Type {
    49  	return reflect.TypeOf((*ArgFunctionArgs)(nil)).Elem()
    50  }
    51  
    52  type ArgFunctionResultOutput struct{ *pulumi.OutputState }
    53  
    54  func (ArgFunctionResultOutput) ElementType() reflect.Type {
    55  	return reflect.TypeOf((*ArgFunctionResult)(nil)).Elem()
    56  }
    57  
    58  func (o ArgFunctionResultOutput) ToArgFunctionResultOutput() ArgFunctionResultOutput {
    59  	return o
    60  }
    61  
    62  func (o ArgFunctionResultOutput) ToArgFunctionResultOutputWithContext(ctx context.Context) ArgFunctionResultOutput {
    63  	return o
    64  }
    65  
    66  func (o ArgFunctionResultOutput) Result() ResourceOutput {
    67  	return o.ApplyT(func(v ArgFunctionResult) *Resource { return v.Result }).(ResourceOutput)
    68  }
    69  
    70  func init() {
    71  	pulumi.RegisterOutputType(ArgFunctionResultOutput{})
    72  }