pulumi/tests/testdata/codegen/urn-id-properties/go/urnid/test.go

88 lines
2.3 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 urnid
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"urn-id-properties/urnid/internal"
)
// It's fine for invokes to use urn and id
func Test(ctx *pulumi.Context, args *TestArgs, opts ...pulumi.InvokeOption) (*TestResult, error) {
opts = internal.PkgInvokeDefaultOpts(opts)
var rv TestResult
err := ctx.Invoke("urnid:index:Test", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
type TestArgs struct {
Id float64 `pulumi:"id"`
Urn float64 `pulumi:"urn"`
}
type TestResult struct {
Id *float64 `pulumi:"id"`
Urn float64 `pulumi:"urn"`
}
func TestOutput(ctx *pulumi.Context, args TestOutputArgs, opts ...pulumi.InvokeOption) TestResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (TestResultOutput, error) {
args := v.(TestArgs)
opts = internal.PkgInvokeDefaultOpts(opts)
var rv TestResult
secret, err := ctx.InvokePackageRaw("urnid:index:Test", args, &rv, "", opts...)
if err != nil {
return TestResultOutput{}, err
}
output := pulumi.ToOutput(rv).(TestResultOutput)
if secret {
return pulumi.ToSecret(output).(TestResultOutput), nil
}
return output, nil
}).(TestResultOutput)
}
type TestOutputArgs struct {
Id pulumi.Float64Input `pulumi:"id"`
Urn pulumi.Float64Input `pulumi:"urn"`
}
func (TestOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*TestArgs)(nil)).Elem()
}
type TestResultOutput struct{ *pulumi.OutputState }
func (TestResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*TestResult)(nil)).Elem()
}
func (o TestResultOutput) ToTestResultOutput() TestResultOutput {
return o
}
func (o TestResultOutput) ToTestResultOutputWithContext(ctx context.Context) TestResultOutput {
return o
}
func (o TestResultOutput) Id() pulumi.Float64PtrOutput {
return o.ApplyT(func(v TestResult) *float64 { return v.Id }).(pulumi.Float64PtrOutput)
}
func (o TestResultOutput) Urn() pulumi.Float64Output {
return o.ApplyT(func(v TestResult) float64 { return v.Urn }).(pulumi.Float64Output)
}
func init() {
pulumi.RegisterOutputType(TestResultOutput{})
}