mirror of https://github.com/pulumi/pulumi.git
51 lines
1.0 KiB
Go
51 lines
1.0 KiB
Go
// Copyright 2016-2021, Pulumi Corporation. All rights reserved.
|
|
//go:build !all
|
|
// +build !all
|
|
|
|
// Exposes the Random resource from the testprovider.
|
|
|
|
package main
|
|
|
|
import (
|
|
"errors"
|
|
"reflect"
|
|
|
|
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
|
)
|
|
|
|
type Random struct {
|
|
pulumi.CustomResourceState
|
|
|
|
Length pulumi.IntOutput `pulumi:"length"`
|
|
Result pulumi.StringOutput `pulumi:"result"`
|
|
}
|
|
|
|
func NewRandom(ctx *pulumi.Context,
|
|
name string, args *RandomArgs, opts ...pulumi.ResourceOption,
|
|
) (*Random, error) {
|
|
if args == nil || args.Length == nil {
|
|
return nil, errors.New("missing required argument 'Length'")
|
|
}
|
|
if args == nil {
|
|
args = &RandomArgs{}
|
|
}
|
|
var resource Random
|
|
err := ctx.RegisterResource("testprovider:index:Random", name, args, &resource, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &resource, nil
|
|
}
|
|
|
|
type randomArgs struct {
|
|
Length int `pulumi:"length"`
|
|
}
|
|
|
|
type RandomArgs struct {
|
|
Length pulumi.IntInput
|
|
}
|
|
|
|
func (RandomArgs) ElementType() reflect.Type {
|
|
return reflect.TypeOf((*randomArgs)(nil)).Elem()
|
|
}
|