/
getFolder.go
168 lines (144 loc) · 6.36 KB
/
getFolder.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package organizations
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Use this data source to get information about a Google Cloud Folder.
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-gcp/sdk/v5/go/gcp/organizations"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// opt0 := true
// myFolder1, err := organizations.LookupFolder(ctx, &organizations.LookupFolderArgs{
// Folder: "folders/12345",
// LookupOrganization: &opt0,
// }, nil)
// if err != nil {
// return err
// }
// myFolder2, err := organizations.LookupFolder(ctx, &organizations.LookupFolderArgs{
// Folder: "folders/23456",
// }, nil)
// if err != nil {
// return err
// }
// ctx.Export("myFolder1Organization", myFolder1.Organization)
// ctx.Export("myFolder2Parent", myFolder2.Parent)
// return nil
// })
// }
// ```
func LookupFolder(ctx *pulumi.Context, args *LookupFolderArgs, opts ...pulumi.InvokeOption) (*LookupFolderResult, error) {
var rv LookupFolderResult
err := ctx.Invoke("gcp:organizations/getFolder:getFolder", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getFolder.
type LookupFolderArgs struct {
// The name of the Folder in the form `{folder_id}` or `folders/{folder_id}`.
Folder string `pulumi:"folder"`
// `true` to find the organization that the folder belongs, `false` to avoid the lookup. It searches up the tree. (defaults to `false`)
LookupOrganization *bool `pulumi:"lookupOrganization"`
}
// A collection of values returned by getFolder.
type LookupFolderResult struct {
// Timestamp when the Organization was created. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z".
CreateTime string `pulumi:"createTime"`
// The folder's display name.
DisplayName string `pulumi:"displayName"`
Folder string `pulumi:"folder"`
FolderId string `pulumi:"folderId"`
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
// The Folder's current lifecycle state.
LifecycleState string `pulumi:"lifecycleState"`
LookupOrganization *bool `pulumi:"lookupOrganization"`
// The resource name of the Folder in the form `folders/{folder_id}`.
Name string `pulumi:"name"`
// If `lookupOrganization` is enable, the resource name of the Organization that the folder belongs.
Organization string `pulumi:"organization"`
// The resource name of the parent Folder or Organization.
Parent string `pulumi:"parent"`
}
func LookupFolderOutput(ctx *pulumi.Context, args LookupFolderOutputArgs, opts ...pulumi.InvokeOption) LookupFolderResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (LookupFolderResult, error) {
args := v.(LookupFolderArgs)
r, err := LookupFolder(ctx, &args, opts...)
return *r, err
}).(LookupFolderResultOutput)
}
// A collection of arguments for invoking getFolder.
type LookupFolderOutputArgs struct {
// The name of the Folder in the form `{folder_id}` or `folders/{folder_id}`.
Folder pulumi.StringInput `pulumi:"folder"`
// `true` to find the organization that the folder belongs, `false` to avoid the lookup. It searches up the tree. (defaults to `false`)
LookupOrganization pulumi.BoolPtrInput `pulumi:"lookupOrganization"`
}
func (LookupFolderOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*LookupFolderArgs)(nil)).Elem()
}
// A collection of values returned by getFolder.
type LookupFolderResultOutput struct{ *pulumi.OutputState }
func (LookupFolderResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*LookupFolderResult)(nil)).Elem()
}
func (o LookupFolderResultOutput) ToLookupFolderResultOutput() LookupFolderResultOutput {
return o
}
func (o LookupFolderResultOutput) ToLookupFolderResultOutputWithContext(ctx context.Context) LookupFolderResultOutput {
return o
}
// Timestamp when the Organization was created. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z".
func (o LookupFolderResultOutput) CreateTime() pulumi.StringOutput {
return o.ApplyT(func(v LookupFolderResult) string { return v.CreateTime }).(pulumi.StringOutput)
}
// The folder's display name.
func (o LookupFolderResultOutput) DisplayName() pulumi.StringOutput {
return o.ApplyT(func(v LookupFolderResult) string { return v.DisplayName }).(pulumi.StringOutput)
}
func (o LookupFolderResultOutput) Folder() pulumi.StringOutput {
return o.ApplyT(func(v LookupFolderResult) string { return v.Folder }).(pulumi.StringOutput)
}
func (o LookupFolderResultOutput) FolderId() pulumi.StringOutput {
return o.ApplyT(func(v LookupFolderResult) string { return v.FolderId }).(pulumi.StringOutput)
}
// The provider-assigned unique ID for this managed resource.
func (o LookupFolderResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v LookupFolderResult) string { return v.Id }).(pulumi.StringOutput)
}
// The Folder's current lifecycle state.
func (o LookupFolderResultOutput) LifecycleState() pulumi.StringOutput {
return o.ApplyT(func(v LookupFolderResult) string { return v.LifecycleState }).(pulumi.StringOutput)
}
func (o LookupFolderResultOutput) LookupOrganization() pulumi.BoolPtrOutput {
return o.ApplyT(func(v LookupFolderResult) *bool { return v.LookupOrganization }).(pulumi.BoolPtrOutput)
}
// The resource name of the Folder in the form `folders/{folder_id}`.
func (o LookupFolderResultOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v LookupFolderResult) string { return v.Name }).(pulumi.StringOutput)
}
// If `lookupOrganization` is enable, the resource name of the Organization that the folder belongs.
func (o LookupFolderResultOutput) Organization() pulumi.StringOutput {
return o.ApplyT(func(v LookupFolderResult) string { return v.Organization }).(pulumi.StringOutput)
}
// The resource name of the parent Folder or Organization.
func (o LookupFolderResultOutput) Parent() pulumi.StringOutput {
return o.ApplyT(func(v LookupFolderResult) string { return v.Parent }).(pulumi.StringOutput)
}
func init() {
pulumi.RegisterOutputType(LookupFolderResultOutput{})
}