2022-04-19 16:39:23 +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! ***
2021-10-07 19:39:19 +00:00
package mypkg
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
2023-06-14 16:34:49 +00:00
"output-funcs-tfbridge20/mypkg/internal"
2021-10-07 19:39:19 +00:00
)
// Taken from pulumi-AWS to regress an issue
//
// Deprecated: aws.getAmiIds has been deprecated in favor of aws.ec2.getAmiIds
func GetAmiIds ( ctx * pulumi . Context , args * GetAmiIdsArgs , opts ... pulumi . InvokeOption ) ( * GetAmiIdsResult , error ) {
2023-06-14 16:34:49 +00:00
opts = internal . PkgInvokeDefaultOpts ( opts )
2021-10-07 19:39:19 +00:00
var rv GetAmiIdsResult
err := ctx . Invoke ( "mypkg::getAmiIds" , args , & rv , opts ... )
if err != nil {
return nil , err
}
return & rv , nil
}
// A collection of arguments for invoking getAmiIds.
type GetAmiIdsArgs struct {
// Limit search to users with *explicit* launch
// permission on the image. Valid items are the numeric account ID or `self`.
ExecutableUsers [ ] string ` pulumi:"executableUsers" `
// One or more name/value pairs to filter off of. There
// are several valid keys, for a full reference, check out
// [describe-images in the AWS CLI reference][1].
Filters [ ] GetAmiIdsFilter ` pulumi:"filters" `
// A regex string to apply to the AMI list returned
// by AWS. This allows more advanced filtering not supported from the AWS API.
// This filtering is done locally on what AWS returns, and could have a performance
// impact if the result is large. It is recommended to combine this with other
// options to narrow down the list AWS returns.
NameRegex * string ` pulumi:"nameRegex" `
// List of AMI owners to limit search. At least 1 value must be specified. Valid values: an AWS account ID, `self` (the current account), or an AWS owner alias (e.g. `amazon`, `aws-marketplace`, `microsoft`).
Owners [ ] string ` pulumi:"owners" `
// Used to sort AMIs by creation time.
SortAscending * bool ` pulumi:"sortAscending" `
}
// A collection of values returned by getAmiIds.
type GetAmiIdsResult struct {
ExecutableUsers [ ] string ` pulumi:"executableUsers" `
Filters [ ] GetAmiIdsFilter ` pulumi:"filters" `
// The provider-assigned unique ID for this managed resource.
Id string ` pulumi:"id" `
Ids [ ] string ` pulumi:"ids" `
NameRegex * string ` pulumi:"nameRegex" `
Owners [ ] string ` pulumi:"owners" `
SortAscending * bool ` pulumi:"sortAscending" `
}
func GetAmiIdsOutput ( ctx * pulumi . Context , args GetAmiIdsOutputArgs , opts ... pulumi . InvokeOption ) GetAmiIdsResultOutput {
return pulumi . ToOutputWithContext ( context . Background ( ) , args ) .
ApplyT ( func ( v interface { } ) ( GetAmiIdsResult , error ) {
args := v . ( GetAmiIdsArgs )
r , err := GetAmiIds ( ctx , & args , opts ... )
[codegen/go] Update Go SDK function output to check for errors (#9274)
* [codegen/go] Update Go SDK function output to check for errors
Fixes https://github.com/pulumi/pulumi-aws/issues/1872.
This should result in the following sample output in the Go SDK:
```
func GetPolicyDocumentOutput(ctx *pulumi.Context, args GetPolicyDocumentOutputArgs, opts ...pulumi.InvokeOption) GetPolicyDocumentResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (GetPolicyDocumentResult, error) {
args := v.(GetPolicyDocumentArgs)
r, err := GetPolicyDocument(ctx, &args, opts...)
if err != nil {
return nil, err
}
if r == nil {
return nil, fmt.Errorf("expected either result or error to be nil, not both")
}
return *r, err
}).(GetPolicyDocumentResultOutput)
}
```
* Fix generated code panic on *nil (#9284)
* [codegen/go] Update Go SDK function output to check for errors
Fixes https://github.com/pulumi/pulumi-aws/issues/1872.
This should result in the following sample output in the Go SDK:
```
func GetPolicyDocumentOutput(ctx *pulumi.Context, args GetPolicyDocumentOutputArgs, opts ...pulumi.InvokeOption) GetPolicyDocumentResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (GetPolicyDocumentResult, error) {
args := v.(GetPolicyDocumentArgs)
r, err := GetPolicyDocument(ctx, &args, opts...)
if r != nil {
s = *r
}
return s, err
}).(GetPolicyDocumentResultOutput)
}
```
* Alternate fix to safeguard dereferencing nil
* Accept codegen changes in the test suite
Co-authored-by: Guinevere Saenger <guinevere@pulumi.com>
* Update CHANGELOG_PENDING.md
Co-authored-by: Anton Tayanovskyy <anton@pulumi.com>
2022-03-25 03:11:53 +00:00
var s GetAmiIdsResult
if r != nil {
s = * r
}
return s , err
2021-10-07 19:39:19 +00:00
} ) . ( GetAmiIdsResultOutput )
}
// A collection of arguments for invoking getAmiIds.
type GetAmiIdsOutputArgs struct {
// Limit search to users with *explicit* launch
// permission on the image. Valid items are the numeric account ID or `self`.
ExecutableUsers pulumi . StringArrayInput ` pulumi:"executableUsers" `
// One or more name/value pairs to filter off of. There
// are several valid keys, for a full reference, check out
// [describe-images in the AWS CLI reference][1].
Filters GetAmiIdsFilterArrayInput ` pulumi:"filters" `
// A regex string to apply to the AMI list returned
// by AWS. This allows more advanced filtering not supported from the AWS API.
// This filtering is done locally on what AWS returns, and could have a performance
// impact if the result is large. It is recommended to combine this with other
// options to narrow down the list AWS returns.
NameRegex pulumi . StringPtrInput ` pulumi:"nameRegex" `
// List of AMI owners to limit search. At least 1 value must be specified. Valid values: an AWS account ID, `self` (the current account), or an AWS owner alias (e.g. `amazon`, `aws-marketplace`, `microsoft`).
Owners pulumi . StringArrayInput ` pulumi:"owners" `
// Used to sort AMIs by creation time.
SortAscending pulumi . BoolPtrInput ` pulumi:"sortAscending" `
}
func ( GetAmiIdsOutputArgs ) ElementType ( ) reflect . Type {
return reflect . TypeOf ( ( * GetAmiIdsArgs ) ( nil ) ) . Elem ( )
}
// A collection of values returned by getAmiIds.
type GetAmiIdsResultOutput struct { * pulumi . OutputState }
func ( GetAmiIdsResultOutput ) ElementType ( ) reflect . Type {
return reflect . TypeOf ( ( * GetAmiIdsResult ) ( nil ) ) . Elem ( )
}
func ( o GetAmiIdsResultOutput ) ToGetAmiIdsResultOutput ( ) GetAmiIdsResultOutput {
return o
}
func ( o GetAmiIdsResultOutput ) ToGetAmiIdsResultOutputWithContext ( ctx context . Context ) GetAmiIdsResultOutput {
return o
}
func ( o GetAmiIdsResultOutput ) ExecutableUsers ( ) pulumi . StringArrayOutput {
return o . ApplyT ( func ( v GetAmiIdsResult ) [ ] string { return v . ExecutableUsers } ) . ( pulumi . StringArrayOutput )
}
func ( o GetAmiIdsResultOutput ) Filters ( ) GetAmiIdsFilterArrayOutput {
return o . ApplyT ( func ( v GetAmiIdsResult ) [ ] GetAmiIdsFilter { return v . Filters } ) . ( GetAmiIdsFilterArrayOutput )
}
// The provider-assigned unique ID for this managed resource.
func ( o GetAmiIdsResultOutput ) Id ( ) pulumi . StringOutput {
return o . ApplyT ( func ( v GetAmiIdsResult ) string { return v . Id } ) . ( pulumi . StringOutput )
}
func ( o GetAmiIdsResultOutput ) Ids ( ) pulumi . StringArrayOutput {
return o . ApplyT ( func ( v GetAmiIdsResult ) [ ] string { return v . Ids } ) . ( pulumi . StringArrayOutput )
}
func ( o GetAmiIdsResultOutput ) NameRegex ( ) pulumi . StringPtrOutput {
return o . ApplyT ( func ( v GetAmiIdsResult ) * string { return v . NameRegex } ) . ( pulumi . StringPtrOutput )
}
func ( o GetAmiIdsResultOutput ) Owners ( ) pulumi . StringArrayOutput {
return o . ApplyT ( func ( v GetAmiIdsResult ) [ ] string { return v . Owners } ) . ( pulumi . StringArrayOutput )
}
func ( o GetAmiIdsResultOutput ) SortAscending ( ) pulumi . BoolPtrOutput {
return o . ApplyT ( func ( v GetAmiIdsResult ) * bool { return v . SortAscending } ) . ( pulumi . BoolPtrOutput )
}
func init ( ) {
pulumi . RegisterOutputType ( GetAmiIdsResultOutput { } )
}