pulumi/tests/integration/construct_component_failures/go/component.go

42 lines
817 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
}