pulumi/tests/testdata/codegen/output-funcs-go-generics-only/go/mypkg/getIntegrationRuntimeObject...

103 lines
4.3 KiB
Go
Raw Normal View History

[go/sdk-gen] Fix generics-only option missing ToOutput(...) methods (#14584) # Description PR #14492 removed `ToOutput(...)` methods for output types when generating non-generic SDK variants. The fix there was added to only include these when `side-by-side` is enabled, which implicitly included `generics-only` except for a _single_ place where that wasn't the case 😓 (see comment below in `gen.go`) This PR fixes issue and includes tests for go sdkgen where `generics` setting is set to `generics-only`: - `output-funcs-go-generics-only` - `plain-and-default-go-generics-only` - `secrets-go-generics-only` - `simple-enum-schema-go-generics-only` - `simple-plain-schema-go-generics-only` ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [x] I have run `make lint` to verify my code passes the lint check - [x] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2023-11-16 18:41:57 +00:00
// Code generated by test DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package mypkg
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumix"
"output-funcs-go-generics-only/mypkg/internal"
)
// Another failing example. A list of SSIS object metadata.
// API Version: 2018-06-01.
func GetIntegrationRuntimeObjectMetadatum(ctx *pulumi.Context, args *GetIntegrationRuntimeObjectMetadatumArgs, opts ...pulumi.InvokeOption) (*GetIntegrationRuntimeObjectMetadatumResult, error) {
opts = internal.PkgInvokeDefaultOpts(opts)
var rv GetIntegrationRuntimeObjectMetadatumResult
err := ctx.Invoke("mypkg::getIntegrationRuntimeObjectMetadatum", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
type GetIntegrationRuntimeObjectMetadatumArgs struct {
// The factory name.
FactoryName string `pulumi:"factoryName"`
// The integration runtime name.
IntegrationRuntimeName string `pulumi:"integrationRuntimeName"`
// Metadata path.
MetadataPath *string `pulumi:"metadataPath"`
// The resource group name.
ResourceGroupName string `pulumi:"resourceGroupName"`
}
// A list of SSIS object metadata.
type GetIntegrationRuntimeObjectMetadatumResult struct {
// The link to the next page of results, if any remaining results exist.
NextLink *string `pulumi:"nextLink"`
// List of SSIS object metadata.
Value []interface{} `pulumi:"value"`
}
func GetIntegrationRuntimeObjectMetadatumOutput(ctx *pulumi.Context, args GetIntegrationRuntimeObjectMetadatumOutputArgs, opts ...pulumi.InvokeOption) GetIntegrationRuntimeObjectMetadatumResultOutput {
outputResult := pulumix.ApplyErr[*GetIntegrationRuntimeObjectMetadatumArgs](args.ToOutput(), func(plainArgs *GetIntegrationRuntimeObjectMetadatumArgs) (*GetIntegrationRuntimeObjectMetadatumResult, error) {
return GetIntegrationRuntimeObjectMetadatum(ctx, plainArgs, opts...)
})
return pulumix.Cast[GetIntegrationRuntimeObjectMetadatumResultOutput, *GetIntegrationRuntimeObjectMetadatumResult](outputResult)
}
type GetIntegrationRuntimeObjectMetadatumOutputArgs struct {
// The factory name.
FactoryName pulumix.Input[string] `pulumi:"factoryName"`
// The integration runtime name.
IntegrationRuntimeName pulumix.Input[string] `pulumi:"integrationRuntimeName"`
// Metadata path.
MetadataPath pulumix.Input[*string] `pulumi:"metadataPath"`
// The resource group name.
ResourceGroupName pulumix.Input[string] `pulumi:"resourceGroupName"`
}
func (args GetIntegrationRuntimeObjectMetadatumOutputArgs) ToOutput() pulumix.Output[*GetIntegrationRuntimeObjectMetadatumArgs] {
allArgs := pulumix.All(
args.FactoryName.ToOutput(context.Background()).AsAny(),
args.IntegrationRuntimeName.ToOutput(context.Background()).AsAny(),
args.MetadataPath.ToOutput(context.Background()).AsAny(),
args.ResourceGroupName.ToOutput(context.Background()).AsAny())
return pulumix.Apply[[]any](allArgs, func(resolvedArgs []interface{}) *GetIntegrationRuntimeObjectMetadatumArgs {
return &GetIntegrationRuntimeObjectMetadatumArgs{
FactoryName: resolvedArgs[0].(string),
IntegrationRuntimeName: resolvedArgs[1].(string),
MetadataPath: resolvedArgs[2].(*string),
ResourceGroupName: resolvedArgs[3].(string),
}
})
}
type GetIntegrationRuntimeObjectMetadatumResultOutput struct{ *pulumi.OutputState }
func (GetIntegrationRuntimeObjectMetadatumResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*GetIntegrationRuntimeObjectMetadatumResult)(nil)).Elem()
}
func (o GetIntegrationRuntimeObjectMetadatumResultOutput) ToOutput(context.Context) pulumix.Output[*GetIntegrationRuntimeObjectMetadatumResult] {
return pulumix.Output[*GetIntegrationRuntimeObjectMetadatumResult]{
OutputState: o.OutputState,
}
}
func (o GetIntegrationRuntimeObjectMetadatumResultOutput) NextLink() pulumix.Output[*string] {
return pulumix.Apply[*GetIntegrationRuntimeObjectMetadatumResult](o, func(v *GetIntegrationRuntimeObjectMetadatumResult) *string { return v.NextLink })
}
func (o GetIntegrationRuntimeObjectMetadatumResultOutput) Value() pulumix.ArrayOutput[any] {
value := pulumix.Apply[*GetIntegrationRuntimeObjectMetadatumResult](o, func(v *GetIntegrationRuntimeObjectMetadatumResult) []interface{} { return v.Value })
return pulumix.ArrayOutput[any]{
OutputState: value.OutputState,
}
}