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

88 lines
3.3 KiB
Go
Raw Permalink 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"
)
// Response for all the Bastion Shareable Link endpoints.
// API Version: 2020-11-01.
func GetBastionShareableLink(ctx *pulumi.Context, args *GetBastionShareableLinkArgs, opts ...pulumi.InvokeOption) (*GetBastionShareableLinkResult, error) {
opts = internal.PkgInvokeDefaultOpts(opts)
var rv GetBastionShareableLinkResult
err := ctx.Invoke("mypkg::getBastionShareableLink", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
type GetBastionShareableLinkArgs struct {
// The name of the Bastion Host.
BastionHostName string `pulumi:"bastionHostName"`
// The name of the resource group.
ResourceGroupName string `pulumi:"resourceGroupName"`
// List of VM references.
Vms []BastionShareableLink `pulumi:"vms"`
}
// Response for all the Bastion Shareable Link endpoints.
type GetBastionShareableLinkResult struct {
// The URL to get the next set of results.
NextLink *string `pulumi:"nextLink"`
}
func GetBastionShareableLinkOutput(ctx *pulumi.Context, args GetBastionShareableLinkOutputArgs, opts ...pulumi.InvokeOption) GetBastionShareableLinkResultOutput {
outputResult := pulumix.ApplyErr[*GetBastionShareableLinkArgs](args.ToOutput(), func(plainArgs *GetBastionShareableLinkArgs) (*GetBastionShareableLinkResult, error) {
return GetBastionShareableLink(ctx, plainArgs, opts...)
})
return pulumix.Cast[GetBastionShareableLinkResultOutput, *GetBastionShareableLinkResult](outputResult)
}
type GetBastionShareableLinkOutputArgs struct {
// The name of the Bastion Host.
BastionHostName pulumix.Input[string] `pulumi:"bastionHostName"`
// The name of the resource group.
ResourceGroupName pulumix.Input[string] `pulumi:"resourceGroupName"`
// List of VM references.
Vms pulumix.Input[[]*BastionShareableLinkArgs] `pulumi:"vms"`
}
func (args GetBastionShareableLinkOutputArgs) ToOutput() pulumix.Output[*GetBastionShareableLinkArgs] {
allArgs := pulumix.All(
args.BastionHostName.ToOutput(context.Background()).AsAny(),
args.ResourceGroupName.ToOutput(context.Background()).AsAny(),
args.Vms.ToOutput(context.Background()).AsAny())
return pulumix.Apply[[]any](allArgs, func(resolvedArgs []interface{}) *GetBastionShareableLinkArgs {
return &GetBastionShareableLinkArgs{
BastionHostName: resolvedArgs[0].(string),
ResourceGroupName: resolvedArgs[1].(string),
Vms: resolvedArgs[2].([]BastionShareableLink),
}
})
}
type GetBastionShareableLinkResultOutput struct{ *pulumi.OutputState }
func (GetBastionShareableLinkResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*GetBastionShareableLinkResult)(nil)).Elem()
}
func (o GetBastionShareableLinkResultOutput) ToOutput(context.Context) pulumix.Output[*GetBastionShareableLinkResult] {
return pulumix.Output[*GetBastionShareableLinkResult]{
OutputState: o.OutputState,
}
}
func (o GetBastionShareableLinkResultOutput) NextLink() pulumix.Output[*string] {
return pulumix.Apply[*GetBastionShareableLinkResult](o, func(v *GetBastionShareableLinkResult) *string { return v.NextLink })
}