github.com/myhau/pulumi/pkg/v3@v3.70.2-0.20221116134521-f2775972e587/codegen/testing/test/testdata/synthetic-resource-properties-pp/go/synthetic-resource-properties.go (about)

     1  package main
     2  
     3  import (
     4  	resourceProperties "git.example.org/pulumi-synthetic/resourceProperties"
     5  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
     6  )
     7  
     8  func main() {
     9  	pulumi.Run(func(ctx *pulumi.Context) error {
    10  		rt, err := resourceProperties.NewRoot(ctx, "rt", nil)
    11  		if err != nil {
    12  			return err
    13  		}
    14  		ctx.Export("trivial", rt)
    15  		ctx.Export("simple", rt.Res1)
    16  		ctx.Export("foo", rt.Res1.ApplyT(func(res1 *resourceproperties.Res1) (resourceproperties.Obj2, error) {
    17  			return res1.Obj1.Res2.Obj2, nil
    18  		}).(resourceproperties.Obj2Output))
    19  		ctx.Export("complex", rt.Res1.ApplyT(func(res1 *resourceproperties.Res1) (float64, error) {
    20  			return res1.Obj1.Res2.Obj2.Answer, nil
    21  		}).(pulumi.Float64Output))
    22  		return nil
    23  	})
    24  }