pulumi/tests/testdata/codegen/assets-and-archives-go-gene.../go/example/getAssets.go

79 lines
2.5 KiB
Go

// Code generated by test DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package example
import (
"context"
"reflect"
"assets-and-archives-go-generics-only/example/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumix"
)
func GetAssets(ctx *pulumi.Context, args *GetAssetsArgs, opts ...pulumi.InvokeOption) (*GetAssetsResult, error) {
opts = internal.PkgInvokeDefaultOpts(opts)
var rv GetAssetsResult
err := ctx.Invoke("example::GetAssets", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
type GetAssetsArgs struct {
Archive pulumi.Archive `pulumi:"archive"`
Source pulumi.AssetOrArchive `pulumi:"source"`
}
type GetAssetsResult struct {
Archive pulumi.Archive `pulumi:"archive"`
Source pulumi.AssetOrArchive `pulumi:"source"`
}
func GetAssetsOutput(ctx *pulumi.Context, args GetAssetsOutputArgs, opts ...pulumi.InvokeOption) GetAssetsResultOutput {
outputResult := pulumix.ApplyErr[*GetAssetsArgs](args.ToOutput(), func(plainArgs *GetAssetsArgs) (*GetAssetsResult, error) {
return GetAssets(ctx, plainArgs, opts...)
})
return pulumix.Cast[GetAssetsResultOutput, *GetAssetsResult](outputResult)
}
type GetAssetsOutputArgs struct {
Archive pulumix.Input[pulumi.Archive] `pulumi:"archive"`
Source pulumix.Input[pulumi.AssetOrArchive] `pulumi:"source"`
}
func (args GetAssetsOutputArgs) ToOutput() pulumix.Output[*GetAssetsArgs] {
allArgs := pulumix.All(
args.Archive.ToOutput(context.Background()).AsAny(),
args.Source.ToOutput(context.Background()).AsAny())
return pulumix.Apply[[]any](allArgs, func(resolvedArgs []interface{}) *GetAssetsArgs {
return &GetAssetsArgs{
Archive: resolvedArgs[0].(pulumi.Archive),
Source: resolvedArgs[1].(pulumi.AssetOrArchive),
}
})
}
type GetAssetsResultOutput struct{ *pulumi.OutputState }
func (GetAssetsResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*GetAssetsResult)(nil)).Elem()
}
func (o GetAssetsResultOutput) ToOutput(context.Context) pulumix.Output[*GetAssetsResult] {
return pulumix.Output[*GetAssetsResult]{
OutputState: o.OutputState,
}
}
func (o GetAssetsResultOutput) Archive() pulumix.Output[pulumi.Archive] {
return pulumix.Apply[*GetAssetsResult](o, func(v *GetAssetsResult) pulumi.Archive { return v.Archive })
}
func (o GetAssetsResultOutput) Source() pulumix.Output[pulumi.AssetOrArchive] {
return pulumix.Apply[*GetAssetsResult](o, func(v *GetAssetsResult) pulumi.AssetOrArchive { return v.Source })
}