pulumi/tests/integration/construct_component_methods_errors/go/component.go

68 lines
1.7 KiB
Go
Raw Normal View History

// Copyright 2016-2021, Pulumi Corporation. All rights reserved.
package main
import (
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
type Component struct {
pulumi.ResourceState
}
func NewComponent(
ctx *pulumi.Context, name string, opts ...pulumi.ResourceOption) (*Component, error) {
var resource Component
err := ctx.RegisterRemoteComponentResource("testcomponent:index:Component", name, nil, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
func (c *Component) GetMessage(ctx *pulumi.Context, args *ComponentGetMessageArgs) (ComponentGetMessageResultOutput, error) {
out, err := ctx.Call("testcomponent:index:Component/getMessage", args, ComponentGetMessageResultOutput{}, c)
if err != nil {
return ComponentGetMessageResultOutput{}, err
}
return out.(ComponentGetMessageResultOutput), nil
}
type componentGetMessageArgs struct {
Echo string `pulumi:"echo"`
}
type ComponentGetMessageArgs struct {
Echo pulumi.StringInput
}
func (ComponentGetMessageArgs) ElementType() reflect.Type {
return reflect.TypeOf((*componentGetMessageArgs)(nil)).Elem()
}
type ComponentGetMessageResult struct {
Message string `pulumi:"message"`
}
type ComponentGetMessageResultOutput struct{ *pulumi.OutputState }
func (ComponentGetMessageResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*ComponentGetMessageResult)(nil)).Elem()
}
func (o ComponentGetMessageResultOutput) Message() pulumi.StringOutput {
return o.ApplyT(func(v ComponentGetMessageResult) string { return v.Message }).(pulumi.StringOutput)
}
func (*Component) ElementType() reflect.Type {
return reflect.TypeOf((*Component)(nil))
}
func init() {
pulumi.RegisterOutputType(ComponentGetMessageResultOutput{})
}