pulumi/tests/integration/call_component_failures/go/component.go

46 lines
989 B
Go

// Copyright 2016-2024, Pulumi Corporation. All rights reserved.
//go:build !all
// +build !all
package main
import (
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
type componentArgs struct {
Foo string `pulumi:"foo"`
}
type ComponentArgs struct {
Foo pulumi.StringInput
}
func (ComponentArgs) ElementType() reflect.Type {
return reflect.TypeOf((*componentArgs)(nil)).Elem()
}
type Component struct {
pulumi.ResourceState
Foo pulumi.StringOutput `pulumi:"foo"`
}
func NewComponent(
ctx *pulumi.Context, name string, args *ComponentArgs, opts ...pulumi.ResourceOption,
) (*Component, error) {
var resource Component
err := ctx.RegisterRemoteComponentResource("testcomponent:index:Component", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
func (c *Component) GetMessage(ctx *pulumi.Context) (pulumi.Output, error) {
return ctx.Call("testcomponent:index:Component/getMessage", nil, pulumi.StringOutput{}, c)
}