mirror of https://github.com/pulumi/pulumi.git
[Go/conformance] Fix l2-primitive-ref and l2-resource-asset-archive (#17389)
This PR fixes l2-primitive-ref and l2-resource-asset-archive Go conformance tests. The problem was two fold: - Module alias inconsistent for dashed names: `primitive-ref` was `primitiveRef` instead of `primitiveref` - The import base path for local packages wasn't normalizing package names `primitive-ref` should have been `primitiveref` to mirror the directory name generated for the module in the Go sdk Sidenote: the `go mod tidy` issue in `l2-resource-config` was fixed but now there is a SDK runtime error: `expected no error, got BAIL: unexpected provider request with no version`
This commit is contained in:
parent
4b377af5fb
commit
dc0100f4dc
pkg/codegen/go
sdk/go/pulumi-language-go
language_test.go
testdata
projects
l2-primitive-ref
l2-resource-asset-archive
sdks
asset-archive-5.0.0
assetarchive
go.modprimitive-ref-11.0.0
tests/testdata/codegen/using-dashes-pp/go
|
@ -3795,7 +3795,7 @@ func extractImportBasePath(extPkg schema.PackageReference) string {
|
|||
// Support pack sdks write a go mod inside the go folder. Old legacy sdks would manually write a go.mod in the sdk
|
||||
// folder. This happened to mean that sdk/dotnet, sdk/nodejs etc where also considered part of the go sdk module.
|
||||
if extPkg.SupportPack() {
|
||||
return fmt.Sprintf("%s/%s", modpath, name)
|
||||
return fmt.Sprintf("%s/%s", modpath, goPackage(name))
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%s/go/%s", modpath, name)
|
||||
|
|
|
@ -974,8 +974,12 @@ func (g *generator) addPulumiImport(pkg, versionPath, mod, name string) {
|
|||
}
|
||||
|
||||
if strings.Contains(mod, "-") {
|
||||
// convert the dashed package name into camelCase
|
||||
mod = strcase.ToLowerCamel(mod)
|
||||
alias := ""
|
||||
for _, part := range strings.Split(mod, "-") {
|
||||
alias += strcase.ToLowerCamel(part)
|
||||
}
|
||||
// convert the dashed package such as package-name into packagename
|
||||
mod = alias
|
||||
}
|
||||
g.importer.Import(path, mod)
|
||||
return
|
||||
|
@ -1695,7 +1699,11 @@ func (g *generator) getModOrAlias(pkg, mod, originalMod string) string {
|
|||
if !ok {
|
||||
needsAliasing := strings.Contains(mod, "-")
|
||||
if needsAliasing {
|
||||
return strcase.ToLowerCamel(mod)
|
||||
moduleAlias := ""
|
||||
for _, part := range strings.Split(mod, "-") {
|
||||
moduleAlias += strcase.ToLowerCamel(part)
|
||||
}
|
||||
return moduleAlias
|
||||
}
|
||||
return mod
|
||||
}
|
||||
|
|
|
@ -172,12 +172,10 @@ func runTestingHost(t *testing.T) (string, testingrpc.LanguageTestClient) {
|
|||
|
||||
// TODO: These tests are not working yet because of issues in sdkgen and programgen
|
||||
var expectedFailures = map[string]string{
|
||||
"l1-output-map": "constants don't compile",
|
||||
"l2-primitive-ref": "go mod tidy fails",
|
||||
"l2-resource-asset-archive": "missing go.mod",
|
||||
"l2-resource-config": "missing go.mod",
|
||||
"l2-invoke-simple": "multiple-value in single-value context",
|
||||
"l2-invoke-variants": "multiple-value in single-value context",
|
||||
"l1-output-map": "constants don't compile",
|
||||
"l2-resource-config": "expected no error, got BAIL: unexpected provider request with no version",
|
||||
"l2-invoke-simple": "multiple-value in single-value context",
|
||||
"l2-invoke-variants": "multiple-value in single-value context",
|
||||
}
|
||||
|
||||
func TestLanguage(t *testing.T) {
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
name: l2-primitive-ref
|
||||
runtime: go
|
|
@ -0,0 +1,12 @@
|
|||
module l2-primitive-ref
|
||||
|
||||
go 1.20
|
||||
|
||||
require (
|
||||
github.com/pulumi/pulumi/sdk/v3 v3.30.0
|
||||
example.com/pulumi-primitive-ref/sdk/go/v11 v11.0.0
|
||||
)
|
||||
|
||||
replace example.com/pulumi-primitive-ref/sdk/go/v11 => /ROOT/artifacts/example.com_pulumi-primitive-ref_sdk_go_v11
|
||||
|
||||
replace github.com/pulumi/pulumi/sdk/v3 => /ROOT/artifacts/github.com_pulumi_pulumi_sdk_v3
|
|
@ -0,0 +1,31 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"example.com/pulumi-primitive-ref/sdk/go/v11/primitiveref"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
func main() {
|
||||
pulumi.Run(func(ctx *pulumi.Context) error {
|
||||
_, err := primitiveref.NewResource(ctx, "res", &primitiveref.ResourceArgs{
|
||||
Data: &primitiveref.DataArgs{
|
||||
Boolean: pulumi.Bool(false),
|
||||
Float: pulumi.Float64(2.17),
|
||||
Integer: pulumi.Int(-12),
|
||||
String: pulumi.String("Goodbye"),
|
||||
BoolArray: pulumi.BoolArray{
|
||||
pulumi.Bool(false),
|
||||
pulumi.Bool(true),
|
||||
},
|
||||
StringMap: pulumi.StringMap{
|
||||
"two": pulumi.String("turtle doves"),
|
||||
"three": pulumi.String("french hens"),
|
||||
},
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
3
sdk/go/pulumi-language-go/testdata/projects/l2-resource-asset-archive/Pulumi.yaml
vendored
Normal file
3
sdk/go/pulumi-language-go/testdata/projects/l2-resource-asset-archive/Pulumi.yaml
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
name: l2-resource-asset-archive
|
||||
runtime: go
|
||||
main: subdir
|
BIN
sdk/go/pulumi-language-go/testdata/projects/l2-resource-asset-archive/archive.tar
vendored
Normal file
BIN
sdk/go/pulumi-language-go/testdata/projects/l2-resource-asset-archive/archive.tar
vendored
Normal file
Binary file not shown.
1
sdk/go/pulumi-language-go/testdata/projects/l2-resource-asset-archive/folder/test.txt
vendored
Normal file
1
sdk/go/pulumi-language-go/testdata/projects/l2-resource-asset-archive/folder/test.txt
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
data in a folder
|
12
sdk/go/pulumi-language-go/testdata/projects/l2-resource-asset-archive/subdir/go.mod
vendored
Normal file
12
sdk/go/pulumi-language-go/testdata/projects/l2-resource-asset-archive/subdir/go.mod
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
module l2-resource-asset-archive
|
||||
|
||||
go 1.20
|
||||
|
||||
require (
|
||||
github.com/pulumi/pulumi/sdk/v3 v3.30.0
|
||||
example.com/pulumi-asset-archive/sdk/go/v5 v5.0.0
|
||||
)
|
||||
|
||||
replace example.com/pulumi-asset-archive/sdk/go/v5 => /ROOT/artifacts/example.com_pulumi-asset-archive_sdk_go_v5
|
||||
|
||||
replace github.com/pulumi/pulumi/sdk/v3 => /ROOT/artifacts/github.com_pulumi_pulumi_sdk_v3
|
47
sdk/go/pulumi-language-go/testdata/projects/l2-resource-asset-archive/subdir/main.go
vendored
Normal file
47
sdk/go/pulumi-language-go/testdata/projects/l2-resource-asset-archive/subdir/main.go
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"example.com/pulumi-asset-archive/sdk/go/v5/assetarchive"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
func main() {
|
||||
pulumi.Run(func(ctx *pulumi.Context) error {
|
||||
_, err := assetarchive.NewAssetResource(ctx, "ass", &assetarchive.AssetResourceArgs{
|
||||
Value: pulumi.NewFileAsset("../test.txt"),
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = assetarchive.NewArchiveResource(ctx, "arc", &assetarchive.ArchiveResourceArgs{
|
||||
Value: pulumi.NewFileArchive("../archive.tar"),
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = assetarchive.NewArchiveResource(ctx, "dir", &assetarchive.ArchiveResourceArgs{
|
||||
Value: pulumi.NewFileArchive("../folder"),
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = assetarchive.NewArchiveResource(ctx, "assarc", &assetarchive.ArchiveResourceArgs{
|
||||
Value: pulumi.NewAssetArchive(map[string]interface{}{
|
||||
"string": pulumi.NewStringAsset("file contents"),
|
||||
"file": pulumi.NewFileAsset("../test.txt"),
|
||||
"folder": pulumi.NewFileArchive("../folder"),
|
||||
"archive": pulumi.NewFileArchive("../archive.tar"),
|
||||
}),
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = assetarchive.NewAssetResource(ctx, "remoteass", &assetarchive.AssetResourceArgs{
|
||||
Value: pulumi.NewRemoteAsset("https://raw.githubusercontent.com/pulumi/pulumi/master/cmd/pulumi-test-language/testdata/l2-resource-asset-archive/test.txt"),
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
1
sdk/go/pulumi-language-go/testdata/projects/l2-resource-asset-archive/test.txt
vendored
Normal file
1
sdk/go/pulumi-language-go/testdata/projects/l2-resource-asset-archive/test.txt
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
text
|
116
sdk/go/pulumi-language-go/testdata/sdks/asset-archive-5.0.0/assetarchive/archiveResource.go
vendored
Normal file
116
sdk/go/pulumi-language-go/testdata/sdks/asset-archive-5.0.0/assetarchive/archiveResource.go
vendored
Normal file
|
@ -0,0 +1,116 @@
|
|||
// Code generated by pulumi-language-go DO NOT EDIT.
|
||||
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
package assetarchive
|
||||
|
||||
import (
|
||||
"context"
|
||||
"reflect"
|
||||
|
||||
"errors"
|
||||
"example.com/pulumi-asset-archive/sdk/go/v5/assetarchive/internal"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
type ArchiveResource struct {
|
||||
pulumi.CustomResourceState
|
||||
|
||||
Value pulumi.ArchiveOutput `pulumi:"value"`
|
||||
}
|
||||
|
||||
// NewArchiveResource registers a new resource with the given unique name, arguments, and options.
|
||||
func NewArchiveResource(ctx *pulumi.Context,
|
||||
name string, args *ArchiveResourceArgs, opts ...pulumi.ResourceOption) (*ArchiveResource, error) {
|
||||
if args == nil {
|
||||
return nil, errors.New("missing one or more required arguments")
|
||||
}
|
||||
|
||||
if args.Value == nil {
|
||||
return nil, errors.New("invalid value for required argument 'Value'")
|
||||
}
|
||||
opts = internal.PkgResourceDefaultOpts(opts)
|
||||
var resource ArchiveResource
|
||||
err := ctx.RegisterResource("asset-archive:index:ArchiveResource", name, args, &resource, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resource, nil
|
||||
}
|
||||
|
||||
// GetArchiveResource gets an existing ArchiveResource resource's state with the given name, ID, and optional
|
||||
// state properties that are used to uniquely qualify the lookup (nil if not required).
|
||||
func GetArchiveResource(ctx *pulumi.Context,
|
||||
name string, id pulumi.IDInput, state *ArchiveResourceState, opts ...pulumi.ResourceOption) (*ArchiveResource, error) {
|
||||
var resource ArchiveResource
|
||||
err := ctx.ReadResource("asset-archive:index:ArchiveResource", name, id, state, &resource, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resource, nil
|
||||
}
|
||||
|
||||
// Input properties used for looking up and filtering ArchiveResource resources.
|
||||
type archiveResourceState struct {
|
||||
}
|
||||
|
||||
type ArchiveResourceState struct {
|
||||
}
|
||||
|
||||
func (ArchiveResourceState) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*archiveResourceState)(nil)).Elem()
|
||||
}
|
||||
|
||||
type archiveResourceArgs struct {
|
||||
Value pulumi.Archive `pulumi:"value"`
|
||||
}
|
||||
|
||||
// The set of arguments for constructing a ArchiveResource resource.
|
||||
type ArchiveResourceArgs struct {
|
||||
Value pulumi.ArchiveInput
|
||||
}
|
||||
|
||||
func (ArchiveResourceArgs) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*archiveResourceArgs)(nil)).Elem()
|
||||
}
|
||||
|
||||
type ArchiveResourceInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToArchiveResourceOutput() ArchiveResourceOutput
|
||||
ToArchiveResourceOutputWithContext(ctx context.Context) ArchiveResourceOutput
|
||||
}
|
||||
|
||||
func (*ArchiveResource) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((**ArchiveResource)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (i *ArchiveResource) ToArchiveResourceOutput() ArchiveResourceOutput {
|
||||
return i.ToArchiveResourceOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i *ArchiveResource) ToArchiveResourceOutputWithContext(ctx context.Context) ArchiveResourceOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(ArchiveResourceOutput)
|
||||
}
|
||||
|
||||
type ArchiveResourceOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (ArchiveResourceOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((**ArchiveResource)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (o ArchiveResourceOutput) ToArchiveResourceOutput() ArchiveResourceOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o ArchiveResourceOutput) ToArchiveResourceOutputWithContext(ctx context.Context) ArchiveResourceOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o ArchiveResourceOutput) Value() pulumi.ArchiveOutput {
|
||||
return o.ApplyT(func(v *ArchiveResource) pulumi.ArchiveOutput { return v.Value }).(pulumi.ArchiveOutput)
|
||||
}
|
||||
|
||||
func init() {
|
||||
pulumi.RegisterInputType(reflect.TypeOf((*ArchiveResourceInput)(nil)).Elem(), &ArchiveResource{})
|
||||
pulumi.RegisterOutputType(ArchiveResourceOutput{})
|
||||
}
|
116
sdk/go/pulumi-language-go/testdata/sdks/asset-archive-5.0.0/assetarchive/assetResource.go
vendored
Normal file
116
sdk/go/pulumi-language-go/testdata/sdks/asset-archive-5.0.0/assetarchive/assetResource.go
vendored
Normal file
|
@ -0,0 +1,116 @@
|
|||
// Code generated by pulumi-language-go DO NOT EDIT.
|
||||
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
package assetarchive
|
||||
|
||||
import (
|
||||
"context"
|
||||
"reflect"
|
||||
|
||||
"errors"
|
||||
"example.com/pulumi-asset-archive/sdk/go/v5/assetarchive/internal"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
type AssetResource struct {
|
||||
pulumi.CustomResourceState
|
||||
|
||||
Value pulumi.AssetOrArchiveOutput `pulumi:"value"`
|
||||
}
|
||||
|
||||
// NewAssetResource registers a new resource with the given unique name, arguments, and options.
|
||||
func NewAssetResource(ctx *pulumi.Context,
|
||||
name string, args *AssetResourceArgs, opts ...pulumi.ResourceOption) (*AssetResource, error) {
|
||||
if args == nil {
|
||||
return nil, errors.New("missing one or more required arguments")
|
||||
}
|
||||
|
||||
if args.Value == nil {
|
||||
return nil, errors.New("invalid value for required argument 'Value'")
|
||||
}
|
||||
opts = internal.PkgResourceDefaultOpts(opts)
|
||||
var resource AssetResource
|
||||
err := ctx.RegisterResource("asset-archive:index:AssetResource", name, args, &resource, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resource, nil
|
||||
}
|
||||
|
||||
// GetAssetResource gets an existing AssetResource resource's state with the given name, ID, and optional
|
||||
// state properties that are used to uniquely qualify the lookup (nil if not required).
|
||||
func GetAssetResource(ctx *pulumi.Context,
|
||||
name string, id pulumi.IDInput, state *AssetResourceState, opts ...pulumi.ResourceOption) (*AssetResource, error) {
|
||||
var resource AssetResource
|
||||
err := ctx.ReadResource("asset-archive:index:AssetResource", name, id, state, &resource, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resource, nil
|
||||
}
|
||||
|
||||
// Input properties used for looking up and filtering AssetResource resources.
|
||||
type assetResourceState struct {
|
||||
}
|
||||
|
||||
type AssetResourceState struct {
|
||||
}
|
||||
|
||||
func (AssetResourceState) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*assetResourceState)(nil)).Elem()
|
||||
}
|
||||
|
||||
type assetResourceArgs struct {
|
||||
Value pulumi.AssetOrArchive `pulumi:"value"`
|
||||
}
|
||||
|
||||
// The set of arguments for constructing a AssetResource resource.
|
||||
type AssetResourceArgs struct {
|
||||
Value pulumi.AssetOrArchiveInput
|
||||
}
|
||||
|
||||
func (AssetResourceArgs) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*assetResourceArgs)(nil)).Elem()
|
||||
}
|
||||
|
||||
type AssetResourceInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToAssetResourceOutput() AssetResourceOutput
|
||||
ToAssetResourceOutputWithContext(ctx context.Context) AssetResourceOutput
|
||||
}
|
||||
|
||||
func (*AssetResource) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((**AssetResource)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (i *AssetResource) ToAssetResourceOutput() AssetResourceOutput {
|
||||
return i.ToAssetResourceOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i *AssetResource) ToAssetResourceOutputWithContext(ctx context.Context) AssetResourceOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(AssetResourceOutput)
|
||||
}
|
||||
|
||||
type AssetResourceOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (AssetResourceOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((**AssetResource)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (o AssetResourceOutput) ToAssetResourceOutput() AssetResourceOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o AssetResourceOutput) ToAssetResourceOutputWithContext(ctx context.Context) AssetResourceOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o AssetResourceOutput) Value() pulumi.AssetOrArchiveOutput {
|
||||
return o.ApplyT(func(v *AssetResource) pulumi.AssetOrArchiveOutput { return v.Value }).(pulumi.AssetOrArchiveOutput)
|
||||
}
|
||||
|
||||
func init() {
|
||||
pulumi.RegisterInputType(reflect.TypeOf((*AssetResourceInput)(nil)).Elem(), &AssetResource{})
|
||||
pulumi.RegisterOutputType(AssetResourceOutput{})
|
||||
}
|
2
sdk/go/pulumi-language-go/testdata/sdks/asset-archive-5.0.0/assetarchive/doc.go
vendored
Normal file
2
sdk/go/pulumi-language-go/testdata/sdks/asset-archive-5.0.0/assetarchive/doc.go
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
// Package assetarchive exports types, functions, subpackages for provisioning assetarchive resources.
|
||||
package assetarchive
|
68
sdk/go/pulumi-language-go/testdata/sdks/asset-archive-5.0.0/assetarchive/init.go
vendored
Normal file
68
sdk/go/pulumi-language-go/testdata/sdks/asset-archive-5.0.0/assetarchive/init.go
vendored
Normal file
|
@ -0,0 +1,68 @@
|
|||
// Code generated by pulumi-language-go DO NOT EDIT.
|
||||
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
package assetarchive
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"example.com/pulumi-asset-archive/sdk/go/v5/assetarchive/internal"
|
||||
"github.com/blang/semver"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
type module struct {
|
||||
version semver.Version
|
||||
}
|
||||
|
||||
func (m *module) Version() semver.Version {
|
||||
return m.version
|
||||
}
|
||||
|
||||
func (m *module) Construct(ctx *pulumi.Context, name, typ, urn string) (r pulumi.Resource, err error) {
|
||||
switch typ {
|
||||
case "asset-archive:index:ArchiveResource":
|
||||
r = &ArchiveResource{}
|
||||
case "asset-archive:index:AssetResource":
|
||||
r = &AssetResource{}
|
||||
default:
|
||||
return nil, fmt.Errorf("unknown resource type: %s", typ)
|
||||
}
|
||||
|
||||
err = ctx.RegisterResource(typ, name, nil, r, pulumi.URN_(urn))
|
||||
return
|
||||
}
|
||||
|
||||
type pkg struct {
|
||||
version semver.Version
|
||||
}
|
||||
|
||||
func (p *pkg) Version() semver.Version {
|
||||
return p.version
|
||||
}
|
||||
|
||||
func (p *pkg) ConstructProvider(ctx *pulumi.Context, name, typ, urn string) (pulumi.ProviderResource, error) {
|
||||
if typ != "pulumi:providers:asset-archive" {
|
||||
return nil, fmt.Errorf("unknown provider type: %s", typ)
|
||||
}
|
||||
|
||||
r := &Provider{}
|
||||
err := ctx.RegisterResource(typ, name, nil, r, pulumi.URN_(urn))
|
||||
return r, err
|
||||
}
|
||||
|
||||
func init() {
|
||||
version, err := internal.PkgVersion()
|
||||
if err != nil {
|
||||
version = semver.Version{Major: 1}
|
||||
}
|
||||
pulumi.RegisterResourceModule(
|
||||
"asset-archive",
|
||||
"index",
|
||||
&module{version},
|
||||
)
|
||||
pulumi.RegisterResourcePackage(
|
||||
"asset-archive",
|
||||
&pkg{version},
|
||||
)
|
||||
}
|
184
sdk/go/pulumi-language-go/testdata/sdks/asset-archive-5.0.0/assetarchive/internal/pulumiUtilities.go
vendored
Normal file
184
sdk/go/pulumi-language-go/testdata/sdks/asset-archive-5.0.0/assetarchive/internal/pulumiUtilities.go
vendored
Normal file
|
@ -0,0 +1,184 @@
|
|||
// Code generated by pulumi-language-go DO NOT EDIT.
|
||||
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/blang/semver"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
import (
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/internals"
|
||||
)
|
||||
|
||||
type envParser func(v string) interface{}
|
||||
|
||||
func ParseEnvBool(v string) interface{} {
|
||||
b, err := strconv.ParseBool(v)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func ParseEnvInt(v string) interface{} {
|
||||
i, err := strconv.ParseInt(v, 0, 0)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return int(i)
|
||||
}
|
||||
|
||||
func ParseEnvFloat(v string) interface{} {
|
||||
f, err := strconv.ParseFloat(v, 64)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return f
|
||||
}
|
||||
|
||||
func ParseEnvStringArray(v string) interface{} {
|
||||
var result pulumi.StringArray
|
||||
for _, item := range strings.Split(v, ";") {
|
||||
result = append(result, pulumi.String(item))
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func GetEnvOrDefault(def interface{}, parser envParser, vars ...string) interface{} {
|
||||
for _, v := range vars {
|
||||
if value, ok := os.LookupEnv(v); ok {
|
||||
if parser != nil {
|
||||
return parser(value)
|
||||
}
|
||||
return value
|
||||
}
|
||||
}
|
||||
return def
|
||||
}
|
||||
|
||||
// PkgVersion uses reflection to determine the version of the current package.
|
||||
// If a version cannot be determined, v1 will be assumed. The second return
|
||||
// value is always nil.
|
||||
func PkgVersion() (semver.Version, error) {
|
||||
// emptyVersion defaults to v0.0.0
|
||||
if !SdkVersion.Equals(semver.Version{}) {
|
||||
return SdkVersion, nil
|
||||
}
|
||||
type sentinal struct{}
|
||||
pkgPath := reflect.TypeOf(sentinal{}).PkgPath()
|
||||
re := regexp.MustCompile("^.*/pulumi-asset-archive/sdk(/v\\d+)?")
|
||||
if match := re.FindStringSubmatch(pkgPath); match != nil {
|
||||
vStr := match[1]
|
||||
if len(vStr) == 0 { // If the version capture group was empty, default to v1.
|
||||
return semver.Version{Major: 1}, nil
|
||||
}
|
||||
return semver.MustParse(fmt.Sprintf("%s.0.0", vStr[2:])), nil
|
||||
}
|
||||
return semver.Version{Major: 1}, nil
|
||||
}
|
||||
|
||||
// isZero is a null safe check for if a value is it's types zero value.
|
||||
func IsZero(v interface{}) bool {
|
||||
if v == nil {
|
||||
return true
|
||||
}
|
||||
return reflect.ValueOf(v).IsZero()
|
||||
}
|
||||
|
||||
func CallPlain(
|
||||
ctx *pulumi.Context,
|
||||
tok string,
|
||||
args pulumi.Input,
|
||||
output pulumi.Output,
|
||||
self pulumi.Resource,
|
||||
property string,
|
||||
resultPtr reflect.Value,
|
||||
errorPtr *error,
|
||||
opts ...pulumi.InvokeOption,
|
||||
) {
|
||||
res, err := callPlainInner(ctx, tok, args, output, self, opts...)
|
||||
if err != nil {
|
||||
*errorPtr = err
|
||||
return
|
||||
}
|
||||
|
||||
v := reflect.ValueOf(res)
|
||||
|
||||
// extract res.property field if asked to do so
|
||||
if property != "" {
|
||||
v = v.FieldByName("Res")
|
||||
}
|
||||
|
||||
// return by setting the result pointer; this style of returns shortens the generated code without generics
|
||||
resultPtr.Elem().Set(v)
|
||||
}
|
||||
|
||||
func callPlainInner(
|
||||
ctx *pulumi.Context,
|
||||
tok string,
|
||||
args pulumi.Input,
|
||||
output pulumi.Output,
|
||||
self pulumi.Resource,
|
||||
opts ...pulumi.InvokeOption,
|
||||
) (any, error) {
|
||||
o, err := ctx.Call(tok, args, output, self, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
outputData, err := internals.UnsafeAwaitOutput(ctx.Context(), o)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Ingoring deps silently. They are typically non-empty, r.f() calls include r as a dependency.
|
||||
known := outputData.Known
|
||||
value := outputData.Value
|
||||
secret := outputData.Secret
|
||||
|
||||
problem := ""
|
||||
if !known {
|
||||
problem = "an unknown value"
|
||||
} else if secret {
|
||||
problem = "a secret value"
|
||||
}
|
||||
|
||||
if problem != "" {
|
||||
return nil, fmt.Errorf("Plain resource method %q incorrectly returned %s. "+
|
||||
"This is an error in the provider, please report this to the provider developer.",
|
||||
tok, problem)
|
||||
}
|
||||
|
||||
return value, nil
|
||||
}
|
||||
|
||||
// PkgResourceDefaultOpts provides package level defaults to pulumi.OptionResource.
|
||||
func PkgResourceDefaultOpts(opts []pulumi.ResourceOption) []pulumi.ResourceOption {
|
||||
defaults := []pulumi.ResourceOption{}
|
||||
|
||||
version := SdkVersion
|
||||
if !version.Equals(semver.Version{}) {
|
||||
defaults = append(defaults, pulumi.Version(version.String()))
|
||||
}
|
||||
return append(defaults, opts...)
|
||||
}
|
||||
|
||||
// PkgInvokeDefaultOpts provides package level defaults to pulumi.OptionInvoke.
|
||||
func PkgInvokeDefaultOpts(opts []pulumi.InvokeOption) []pulumi.InvokeOption {
|
||||
defaults := []pulumi.InvokeOption{}
|
||||
|
||||
version := SdkVersion
|
||||
if !version.Equals(semver.Version{}) {
|
||||
defaults = append(defaults, pulumi.Version(version.String()))
|
||||
}
|
||||
return append(defaults, opts...)
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
// Code generated by pulumi-language-go DO NOT EDIT.
|
||||
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"github.com/blang/semver"
|
||||
)
|
||||
|
||||
var SdkVersion semver.Version = semver.Version{}
|
||||
var pluginDownloadURL string = ""
|
81
sdk/go/pulumi-language-go/testdata/sdks/asset-archive-5.0.0/assetarchive/provider.go
vendored
Normal file
81
sdk/go/pulumi-language-go/testdata/sdks/asset-archive-5.0.0/assetarchive/provider.go
vendored
Normal file
|
@ -0,0 +1,81 @@
|
|||
// Code generated by pulumi-language-go DO NOT EDIT.
|
||||
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
package assetarchive
|
||||
|
||||
import (
|
||||
"context"
|
||||
"reflect"
|
||||
|
||||
"example.com/pulumi-asset-archive/sdk/go/v5/assetarchive/internal"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
type Provider struct {
|
||||
pulumi.ProviderResourceState
|
||||
}
|
||||
|
||||
// NewProvider registers a new resource with the given unique name, arguments, and options.
|
||||
func NewProvider(ctx *pulumi.Context,
|
||||
name string, args *ProviderArgs, opts ...pulumi.ResourceOption) (*Provider, error) {
|
||||
if args == nil {
|
||||
args = &ProviderArgs{}
|
||||
}
|
||||
|
||||
opts = internal.PkgResourceDefaultOpts(opts)
|
||||
var resource Provider
|
||||
err := ctx.RegisterResource("pulumi:providers:asset-archive", name, args, &resource, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resource, nil
|
||||
}
|
||||
|
||||
type providerArgs struct {
|
||||
}
|
||||
|
||||
// The set of arguments for constructing a Provider resource.
|
||||
type ProviderArgs struct {
|
||||
}
|
||||
|
||||
func (ProviderArgs) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*providerArgs)(nil)).Elem()
|
||||
}
|
||||
|
||||
type ProviderInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToProviderOutput() ProviderOutput
|
||||
ToProviderOutputWithContext(ctx context.Context) ProviderOutput
|
||||
}
|
||||
|
||||
func (*Provider) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((**Provider)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (i *Provider) ToProviderOutput() ProviderOutput {
|
||||
return i.ToProviderOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i *Provider) ToProviderOutputWithContext(ctx context.Context) ProviderOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(ProviderOutput)
|
||||
}
|
||||
|
||||
type ProviderOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (ProviderOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((**Provider)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (o ProviderOutput) ToProviderOutput() ProviderOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o ProviderOutput) ToProviderOutputWithContext(ctx context.Context) ProviderOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func init() {
|
||||
pulumi.RegisterInputType(reflect.TypeOf((*ProviderInput)(nil)).Elem(), &Provider{})
|
||||
pulumi.RegisterOutputType(ProviderOutput{})
|
||||
}
|
4
sdk/go/pulumi-language-go/testdata/sdks/asset-archive-5.0.0/assetarchive/pulumi-plugin.json
vendored
Normal file
4
sdk/go/pulumi-language-go/testdata/sdks/asset-archive-5.0.0/assetarchive/pulumi-plugin.json
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"resource": true,
|
||||
"name": "asset-archive"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
module example.com/pulumi-asset-archive/sdk/go/v5
|
||||
|
||||
go 1.20
|
||||
|
||||
require github.com/pulumi/pulumi/sdk/v3 v3.30.0
|
||||
|
||||
replace github.com/pulumi/pulumi/sdk/v3 => /ROOT/artifacts/github.com_pulumi_pulumi_sdk_v3
|
|
@ -0,0 +1,7 @@
|
|||
module example.com/pulumi-primitive-ref/sdk/go/v11
|
||||
|
||||
go 1.20
|
||||
|
||||
require github.com/pulumi/pulumi/sdk/v3 v3.30.0
|
||||
|
||||
replace github.com/pulumi/pulumi/sdk/v3 => /ROOT/artifacts/github.com_pulumi_pulumi_sdk_v3
|
2
sdk/go/pulumi-language-go/testdata/sdks/primitive-ref-11.0.0/primitiveref/doc.go
vendored
Normal file
2
sdk/go/pulumi-language-go/testdata/sdks/primitive-ref-11.0.0/primitiveref/doc.go
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
// Package primitiveref exports types, functions, subpackages for provisioning primitiveref resources.
|
||||
package primitiveref
|
66
sdk/go/pulumi-language-go/testdata/sdks/primitive-ref-11.0.0/primitiveref/init.go
vendored
Normal file
66
sdk/go/pulumi-language-go/testdata/sdks/primitive-ref-11.0.0/primitiveref/init.go
vendored
Normal file
|
@ -0,0 +1,66 @@
|
|||
// Code generated by pulumi-language-go DO NOT EDIT.
|
||||
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
package primitiveref
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"example.com/pulumi-primitive-ref/sdk/go/v11/primitiveref/internal"
|
||||
"github.com/blang/semver"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
type module struct {
|
||||
version semver.Version
|
||||
}
|
||||
|
||||
func (m *module) Version() semver.Version {
|
||||
return m.version
|
||||
}
|
||||
|
||||
func (m *module) Construct(ctx *pulumi.Context, name, typ, urn string) (r pulumi.Resource, err error) {
|
||||
switch typ {
|
||||
case "primitive-ref:index:Resource":
|
||||
r = &Resource{}
|
||||
default:
|
||||
return nil, fmt.Errorf("unknown resource type: %s", typ)
|
||||
}
|
||||
|
||||
err = ctx.RegisterResource(typ, name, nil, r, pulumi.URN_(urn))
|
||||
return
|
||||
}
|
||||
|
||||
type pkg struct {
|
||||
version semver.Version
|
||||
}
|
||||
|
||||
func (p *pkg) Version() semver.Version {
|
||||
return p.version
|
||||
}
|
||||
|
||||
func (p *pkg) ConstructProvider(ctx *pulumi.Context, name, typ, urn string) (pulumi.ProviderResource, error) {
|
||||
if typ != "pulumi:providers:primitive-ref" {
|
||||
return nil, fmt.Errorf("unknown provider type: %s", typ)
|
||||
}
|
||||
|
||||
r := &Provider{}
|
||||
err := ctx.RegisterResource(typ, name, nil, r, pulumi.URN_(urn))
|
||||
return r, err
|
||||
}
|
||||
|
||||
func init() {
|
||||
version, err := internal.PkgVersion()
|
||||
if err != nil {
|
||||
version = semver.Version{Major: 1}
|
||||
}
|
||||
pulumi.RegisterResourceModule(
|
||||
"primitive-ref",
|
||||
"index",
|
||||
&module{version},
|
||||
)
|
||||
pulumi.RegisterResourcePackage(
|
||||
"primitive-ref",
|
||||
&pkg{version},
|
||||
)
|
||||
}
|
|
@ -0,0 +1,184 @@
|
|||
// Code generated by pulumi-language-go DO NOT EDIT.
|
||||
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/blang/semver"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
import (
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/internals"
|
||||
)
|
||||
|
||||
type envParser func(v string) interface{}
|
||||
|
||||
func ParseEnvBool(v string) interface{} {
|
||||
b, err := strconv.ParseBool(v)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func ParseEnvInt(v string) interface{} {
|
||||
i, err := strconv.ParseInt(v, 0, 0)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return int(i)
|
||||
}
|
||||
|
||||
func ParseEnvFloat(v string) interface{} {
|
||||
f, err := strconv.ParseFloat(v, 64)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return f
|
||||
}
|
||||
|
||||
func ParseEnvStringArray(v string) interface{} {
|
||||
var result pulumi.StringArray
|
||||
for _, item := range strings.Split(v, ";") {
|
||||
result = append(result, pulumi.String(item))
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func GetEnvOrDefault(def interface{}, parser envParser, vars ...string) interface{} {
|
||||
for _, v := range vars {
|
||||
if value, ok := os.LookupEnv(v); ok {
|
||||
if parser != nil {
|
||||
return parser(value)
|
||||
}
|
||||
return value
|
||||
}
|
||||
}
|
||||
return def
|
||||
}
|
||||
|
||||
// PkgVersion uses reflection to determine the version of the current package.
|
||||
// If a version cannot be determined, v1 will be assumed. The second return
|
||||
// value is always nil.
|
||||
func PkgVersion() (semver.Version, error) {
|
||||
// emptyVersion defaults to v0.0.0
|
||||
if !SdkVersion.Equals(semver.Version{}) {
|
||||
return SdkVersion, nil
|
||||
}
|
||||
type sentinal struct{}
|
||||
pkgPath := reflect.TypeOf(sentinal{}).PkgPath()
|
||||
re := regexp.MustCompile("^.*/pulumi-primitive-ref/sdk(/v\\d+)?")
|
||||
if match := re.FindStringSubmatch(pkgPath); match != nil {
|
||||
vStr := match[1]
|
||||
if len(vStr) == 0 { // If the version capture group was empty, default to v1.
|
||||
return semver.Version{Major: 1}, nil
|
||||
}
|
||||
return semver.MustParse(fmt.Sprintf("%s.0.0", vStr[2:])), nil
|
||||
}
|
||||
return semver.Version{Major: 1}, nil
|
||||
}
|
||||
|
||||
// isZero is a null safe check for if a value is it's types zero value.
|
||||
func IsZero(v interface{}) bool {
|
||||
if v == nil {
|
||||
return true
|
||||
}
|
||||
return reflect.ValueOf(v).IsZero()
|
||||
}
|
||||
|
||||
func CallPlain(
|
||||
ctx *pulumi.Context,
|
||||
tok string,
|
||||
args pulumi.Input,
|
||||
output pulumi.Output,
|
||||
self pulumi.Resource,
|
||||
property string,
|
||||
resultPtr reflect.Value,
|
||||
errorPtr *error,
|
||||
opts ...pulumi.InvokeOption,
|
||||
) {
|
||||
res, err := callPlainInner(ctx, tok, args, output, self, opts...)
|
||||
if err != nil {
|
||||
*errorPtr = err
|
||||
return
|
||||
}
|
||||
|
||||
v := reflect.ValueOf(res)
|
||||
|
||||
// extract res.property field if asked to do so
|
||||
if property != "" {
|
||||
v = v.FieldByName("Res")
|
||||
}
|
||||
|
||||
// return by setting the result pointer; this style of returns shortens the generated code without generics
|
||||
resultPtr.Elem().Set(v)
|
||||
}
|
||||
|
||||
func callPlainInner(
|
||||
ctx *pulumi.Context,
|
||||
tok string,
|
||||
args pulumi.Input,
|
||||
output pulumi.Output,
|
||||
self pulumi.Resource,
|
||||
opts ...pulumi.InvokeOption,
|
||||
) (any, error) {
|
||||
o, err := ctx.Call(tok, args, output, self, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
outputData, err := internals.UnsafeAwaitOutput(ctx.Context(), o)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Ingoring deps silently. They are typically non-empty, r.f() calls include r as a dependency.
|
||||
known := outputData.Known
|
||||
value := outputData.Value
|
||||
secret := outputData.Secret
|
||||
|
||||
problem := ""
|
||||
if !known {
|
||||
problem = "an unknown value"
|
||||
} else if secret {
|
||||
problem = "a secret value"
|
||||
}
|
||||
|
||||
if problem != "" {
|
||||
return nil, fmt.Errorf("Plain resource method %q incorrectly returned %s. "+
|
||||
"This is an error in the provider, please report this to the provider developer.",
|
||||
tok, problem)
|
||||
}
|
||||
|
||||
return value, nil
|
||||
}
|
||||
|
||||
// PkgResourceDefaultOpts provides package level defaults to pulumi.OptionResource.
|
||||
func PkgResourceDefaultOpts(opts []pulumi.ResourceOption) []pulumi.ResourceOption {
|
||||
defaults := []pulumi.ResourceOption{}
|
||||
|
||||
version := SdkVersion
|
||||
if !version.Equals(semver.Version{}) {
|
||||
defaults = append(defaults, pulumi.Version(version.String()))
|
||||
}
|
||||
return append(defaults, opts...)
|
||||
}
|
||||
|
||||
// PkgInvokeDefaultOpts provides package level defaults to pulumi.OptionInvoke.
|
||||
func PkgInvokeDefaultOpts(opts []pulumi.InvokeOption) []pulumi.InvokeOption {
|
||||
defaults := []pulumi.InvokeOption{}
|
||||
|
||||
version := SdkVersion
|
||||
if !version.Equals(semver.Version{}) {
|
||||
defaults = append(defaults, pulumi.Version(version.String()))
|
||||
}
|
||||
return append(defaults, opts...)
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
// Code generated by pulumi-language-go DO NOT EDIT.
|
||||
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"github.com/blang/semver"
|
||||
)
|
||||
|
||||
var SdkVersion semver.Version = semver.Version{}
|
||||
var pluginDownloadURL string = ""
|
81
sdk/go/pulumi-language-go/testdata/sdks/primitive-ref-11.0.0/primitiveref/provider.go
vendored
Normal file
81
sdk/go/pulumi-language-go/testdata/sdks/primitive-ref-11.0.0/primitiveref/provider.go
vendored
Normal file
|
@ -0,0 +1,81 @@
|
|||
// Code generated by pulumi-language-go DO NOT EDIT.
|
||||
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
package primitiveref
|
||||
|
||||
import (
|
||||
"context"
|
||||
"reflect"
|
||||
|
||||
"example.com/pulumi-primitive-ref/sdk/go/v11/primitiveref/internal"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
type Provider struct {
|
||||
pulumi.ProviderResourceState
|
||||
}
|
||||
|
||||
// NewProvider registers a new resource with the given unique name, arguments, and options.
|
||||
func NewProvider(ctx *pulumi.Context,
|
||||
name string, args *ProviderArgs, opts ...pulumi.ResourceOption) (*Provider, error) {
|
||||
if args == nil {
|
||||
args = &ProviderArgs{}
|
||||
}
|
||||
|
||||
opts = internal.PkgResourceDefaultOpts(opts)
|
||||
var resource Provider
|
||||
err := ctx.RegisterResource("pulumi:providers:primitive-ref", name, args, &resource, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resource, nil
|
||||
}
|
||||
|
||||
type providerArgs struct {
|
||||
}
|
||||
|
||||
// The set of arguments for constructing a Provider resource.
|
||||
type ProviderArgs struct {
|
||||
}
|
||||
|
||||
func (ProviderArgs) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*providerArgs)(nil)).Elem()
|
||||
}
|
||||
|
||||
type ProviderInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToProviderOutput() ProviderOutput
|
||||
ToProviderOutputWithContext(ctx context.Context) ProviderOutput
|
||||
}
|
||||
|
||||
func (*Provider) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((**Provider)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (i *Provider) ToProviderOutput() ProviderOutput {
|
||||
return i.ToProviderOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i *Provider) ToProviderOutputWithContext(ctx context.Context) ProviderOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(ProviderOutput)
|
||||
}
|
||||
|
||||
type ProviderOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (ProviderOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((**Provider)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (o ProviderOutput) ToProviderOutput() ProviderOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o ProviderOutput) ToProviderOutputWithContext(ctx context.Context) ProviderOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func init() {
|
||||
pulumi.RegisterInputType(reflect.TypeOf((*ProviderInput)(nil)).Elem(), &Provider{})
|
||||
pulumi.RegisterOutputType(ProviderOutput{})
|
||||
}
|
4
sdk/go/pulumi-language-go/testdata/sdks/primitive-ref-11.0.0/primitiveref/pulumi-plugin.json
vendored
Normal file
4
sdk/go/pulumi-language-go/testdata/sdks/primitive-ref-11.0.0/primitiveref/pulumi-plugin.json
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"resource": true,
|
||||
"name": "primitive-ref"
|
||||
}
|
98
sdk/go/pulumi-language-go/testdata/sdks/primitive-ref-11.0.0/primitiveref/pulumiTypes.go
vendored
Normal file
98
sdk/go/pulumi-language-go/testdata/sdks/primitive-ref-11.0.0/primitiveref/pulumiTypes.go
vendored
Normal file
|
@ -0,0 +1,98 @@
|
|||
// Code generated by pulumi-language-go DO NOT EDIT.
|
||||
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
package primitiveref
|
||||
|
||||
import (
|
||||
"context"
|
||||
"reflect"
|
||||
|
||||
"example.com/pulumi-primitive-ref/sdk/go/v11/primitiveref/internal"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
var _ = internal.GetEnvOrDefault
|
||||
|
||||
type Data struct {
|
||||
BoolArray []bool `pulumi:"boolArray"`
|
||||
Boolean bool `pulumi:"boolean"`
|
||||
Float float64 `pulumi:"float"`
|
||||
Integer int `pulumi:"integer"`
|
||||
String string `pulumi:"string"`
|
||||
StringMap map[string]string `pulumi:"stringMap"`
|
||||
}
|
||||
|
||||
// DataInput is an input type that accepts DataArgs and DataOutput values.
|
||||
// You can construct a concrete instance of `DataInput` via:
|
||||
//
|
||||
// DataArgs{...}
|
||||
type DataInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToDataOutput() DataOutput
|
||||
ToDataOutputWithContext(context.Context) DataOutput
|
||||
}
|
||||
|
||||
type DataArgs struct {
|
||||
BoolArray pulumi.BoolArrayInput `pulumi:"boolArray"`
|
||||
Boolean pulumi.BoolInput `pulumi:"boolean"`
|
||||
Float pulumi.Float64Input `pulumi:"float"`
|
||||
Integer pulumi.IntInput `pulumi:"integer"`
|
||||
String pulumi.StringInput `pulumi:"string"`
|
||||
StringMap pulumi.StringMapInput `pulumi:"stringMap"`
|
||||
}
|
||||
|
||||
func (DataArgs) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*Data)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (i DataArgs) ToDataOutput() DataOutput {
|
||||
return i.ToDataOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i DataArgs) ToDataOutputWithContext(ctx context.Context) DataOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(DataOutput)
|
||||
}
|
||||
|
||||
type DataOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (DataOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*Data)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (o DataOutput) ToDataOutput() DataOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o DataOutput) ToDataOutputWithContext(ctx context.Context) DataOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o DataOutput) BoolArray() pulumi.BoolArrayOutput {
|
||||
return o.ApplyT(func(v Data) []bool { return v.BoolArray }).(pulumi.BoolArrayOutput)
|
||||
}
|
||||
|
||||
func (o DataOutput) Boolean() pulumi.BoolOutput {
|
||||
return o.ApplyT(func(v Data) bool { return v.Boolean }).(pulumi.BoolOutput)
|
||||
}
|
||||
|
||||
func (o DataOutput) Float() pulumi.Float64Output {
|
||||
return o.ApplyT(func(v Data) float64 { return v.Float }).(pulumi.Float64Output)
|
||||
}
|
||||
|
||||
func (o DataOutput) Integer() pulumi.IntOutput {
|
||||
return o.ApplyT(func(v Data) int { return v.Integer }).(pulumi.IntOutput)
|
||||
}
|
||||
|
||||
func (o DataOutput) String() pulumi.StringOutput {
|
||||
return o.ApplyT(func(v Data) string { return v.String }).(pulumi.StringOutput)
|
||||
}
|
||||
|
||||
func (o DataOutput) StringMap() pulumi.StringMapOutput {
|
||||
return o.ApplyT(func(v Data) map[string]string { return v.StringMap }).(pulumi.StringMapOutput)
|
||||
}
|
||||
|
||||
func init() {
|
||||
pulumi.RegisterInputType(reflect.TypeOf((*DataInput)(nil)).Elem(), DataArgs{})
|
||||
pulumi.RegisterOutputType(DataOutput{})
|
||||
}
|
116
sdk/go/pulumi-language-go/testdata/sdks/primitive-ref-11.0.0/primitiveref/resource.go
vendored
Normal file
116
sdk/go/pulumi-language-go/testdata/sdks/primitive-ref-11.0.0/primitiveref/resource.go
vendored
Normal file
|
@ -0,0 +1,116 @@
|
|||
// Code generated by pulumi-language-go DO NOT EDIT.
|
||||
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
package primitiveref
|
||||
|
||||
import (
|
||||
"context"
|
||||
"reflect"
|
||||
|
||||
"errors"
|
||||
"example.com/pulumi-primitive-ref/sdk/go/v11/primitiveref/internal"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
type Resource struct {
|
||||
pulumi.CustomResourceState
|
||||
|
||||
Data DataOutput `pulumi:"data"`
|
||||
}
|
||||
|
||||
// NewResource registers a new resource with the given unique name, arguments, and options.
|
||||
func NewResource(ctx *pulumi.Context,
|
||||
name string, args *ResourceArgs, opts ...pulumi.ResourceOption) (*Resource, error) {
|
||||
if args == nil {
|
||||
return nil, errors.New("missing one or more required arguments")
|
||||
}
|
||||
|
||||
if args.Data == nil {
|
||||
return nil, errors.New("invalid value for required argument 'Data'")
|
||||
}
|
||||
opts = internal.PkgResourceDefaultOpts(opts)
|
||||
var resource Resource
|
||||
err := ctx.RegisterResource("primitive-ref:index:Resource", name, args, &resource, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resource, nil
|
||||
}
|
||||
|
||||
// GetResource gets an existing Resource resource's state with the given name, ID, and optional
|
||||
// state properties that are used to uniquely qualify the lookup (nil if not required).
|
||||
func GetResource(ctx *pulumi.Context,
|
||||
name string, id pulumi.IDInput, state *ResourceState, opts ...pulumi.ResourceOption) (*Resource, error) {
|
||||
var resource Resource
|
||||
err := ctx.ReadResource("primitive-ref:index:Resource", name, id, state, &resource, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resource, nil
|
||||
}
|
||||
|
||||
// Input properties used for looking up and filtering Resource resources.
|
||||
type resourceState struct {
|
||||
}
|
||||
|
||||
type ResourceState struct {
|
||||
}
|
||||
|
||||
func (ResourceState) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*resourceState)(nil)).Elem()
|
||||
}
|
||||
|
||||
type resourceArgs struct {
|
||||
Data Data `pulumi:"data"`
|
||||
}
|
||||
|
||||
// The set of arguments for constructing a Resource resource.
|
||||
type ResourceArgs struct {
|
||||
Data DataInput
|
||||
}
|
||||
|
||||
func (ResourceArgs) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*resourceArgs)(nil)).Elem()
|
||||
}
|
||||
|
||||
type ResourceInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToResourceOutput() ResourceOutput
|
||||
ToResourceOutputWithContext(ctx context.Context) ResourceOutput
|
||||
}
|
||||
|
||||
func (*Resource) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((**Resource)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (i *Resource) ToResourceOutput() ResourceOutput {
|
||||
return i.ToResourceOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i *Resource) ToResourceOutputWithContext(ctx context.Context) ResourceOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(ResourceOutput)
|
||||
}
|
||||
|
||||
type ResourceOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (ResourceOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((**Resource)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (o ResourceOutput) ToResourceOutput() ResourceOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o ResourceOutput) ToResourceOutputWithContext(ctx context.Context) ResourceOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o ResourceOutput) Data() DataOutput {
|
||||
return o.ApplyT(func(v *Resource) DataOutput { return v.Data }).(DataOutput)
|
||||
}
|
||||
|
||||
func init() {
|
||||
pulumi.RegisterInputType(reflect.TypeOf((*ResourceInput)(nil)).Elem(), &Resource{})
|
||||
pulumi.RegisterOutputType(ResourceOutput{})
|
||||
}
|
|
@ -1,13 +1,13 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
usingDashes "example.com/pulumi-using-dashes/sdk/go/using-dashes"
|
||||
usingdashes "example.com/pulumi-using-dashes/sdk/go/using-dashes"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
func main() {
|
||||
pulumi.Run(func(ctx *pulumi.Context) error {
|
||||
_, err := usingDashes.NewDash(ctx, "main", &usingDashes.DashArgs{
|
||||
_, err := usingdashes.NewDash(ctx, "main", &usingdashes.DashArgs{
|
||||
Stack: pulumi.String("dev"),
|
||||
})
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue