/
index.go
76 lines (61 loc) · 1.92 KB
/
index.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// 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 std
import (
"context"
"reflect"
"github.com/pulumi/pulumi-std/sdk/go/std/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Finds the index of a given element in a list.
func Index(ctx *pulumi.Context, args *IndexArgs, opts ...pulumi.InvokeOption) (*IndexResult, error) {
opts = internal.PkgInvokeDefaultOpts(opts)
var rv IndexResult
err := ctx.Invoke("std:index:index", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
type IndexArgs struct {
Element interface{} `pulumi:"element"`
Input []interface{} `pulumi:"input"`
}
type IndexResult struct {
Result int `pulumi:"result"`
}
func IndexOutput(ctx *pulumi.Context, args IndexOutputArgs, opts ...pulumi.InvokeOption) IndexResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (IndexResult, error) {
args := v.(IndexArgs)
r, err := Index(ctx, &args, opts...)
var s IndexResult
if r != nil {
s = *r
}
return s, err
}).(IndexResultOutput)
}
type IndexOutputArgs struct {
Element pulumi.Input `pulumi:"element"`
Input pulumi.ArrayInput `pulumi:"input"`
}
func (IndexOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*IndexArgs)(nil)).Elem()
}
type IndexResultOutput struct{ *pulumi.OutputState }
func (IndexResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*IndexResult)(nil)).Elem()
}
func (o IndexResultOutput) ToIndexResultOutput() IndexResultOutput {
return o
}
func (o IndexResultOutput) ToIndexResultOutputWithContext(ctx context.Context) IndexResultOutput {
return o
}
func (o IndexResultOutput) Result() pulumi.IntOutput {
return o.ApplyT(func(v IndexResult) int { return v.Result }).(pulumi.IntOutput)
}
func init() {
pulumi.RegisterOutputType(IndexResultOutput{})
}