/
getProject.go
174 lines (149 loc) · 6.31 KB
/
getProject.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
169
170
171
172
173
174
// *** 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 digitalocean
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Get information on a single DigitalOcean project. If neither the `id` nor `name` attributes are provided,
// then this data source returns the default project.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := digitalocean.LookupProject(ctx, nil, nil)
// if err != nil {
// return err
// }
// _, err = digitalocean.LookupProject(ctx, &GetProjectArgs{
// Name: pulumi.StringRef("My Staging Project"),
// }, nil)
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
func LookupProject(ctx *pulumi.Context, args *LookupProjectArgs, opts ...pulumi.InvokeOption) (*LookupProjectResult, error) {
var rv LookupProjectResult
err := ctx.Invoke("digitalocean:index/getProject:getProject", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getProject.
type LookupProjectArgs struct {
// the ID of the project to retrieve
Id *string `pulumi:"id"`
// the name of the project to retrieve. The data source will raise an error if more than
// one project has the provided name or if no project has that name.
Name *string `pulumi:"name"`
}
// A collection of values returned by getProject.
type LookupProjectResult struct {
// The date and time when the project was created, (ISO8601)
CreatedAt string `pulumi:"createdAt"`
// The description of the project
Description string `pulumi:"description"`
// The environment of the project's resources. The possible values are: `Development`, `Staging`, `Production`.
Environment string `pulumi:"environment"`
Id string `pulumi:"id"`
IsDefault bool `pulumi:"isDefault"`
Name string `pulumi:"name"`
// The ID of the project owner.
OwnerId int `pulumi:"ownerId"`
// The unique universal identifier of the project owner.
OwnerUuid string `pulumi:"ownerUuid"`
// The purpose of the project, (Default: "Web Application")
Purpose string `pulumi:"purpose"`
// A set of uniform resource names (URNs) for the resources associated with the project
Resources []string `pulumi:"resources"`
// The date and time when the project was last updated, (ISO8601)
UpdatedAt string `pulumi:"updatedAt"`
}
func LookupProjectOutput(ctx *pulumi.Context, args LookupProjectOutputArgs, opts ...pulumi.InvokeOption) LookupProjectResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (LookupProjectResult, error) {
args := v.(LookupProjectArgs)
r, err := LookupProject(ctx, &args, opts...)
return *r, err
}).(LookupProjectResultOutput)
}
// A collection of arguments for invoking getProject.
type LookupProjectOutputArgs struct {
// the ID of the project to retrieve
Id pulumi.StringPtrInput `pulumi:"id"`
// the name of the project to retrieve. The data source will raise an error if more than
// one project has the provided name or if no project has that name.
Name pulumi.StringPtrInput `pulumi:"name"`
}
func (LookupProjectOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*LookupProjectArgs)(nil)).Elem()
}
// A collection of values returned by getProject.
type LookupProjectResultOutput struct{ *pulumi.OutputState }
func (LookupProjectResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*LookupProjectResult)(nil)).Elem()
}
func (o LookupProjectResultOutput) ToLookupProjectResultOutput() LookupProjectResultOutput {
return o
}
func (o LookupProjectResultOutput) ToLookupProjectResultOutputWithContext(ctx context.Context) LookupProjectResultOutput {
return o
}
// The date and time when the project was created, (ISO8601)
func (o LookupProjectResultOutput) CreatedAt() pulumi.StringOutput {
return o.ApplyT(func(v LookupProjectResult) string { return v.CreatedAt }).(pulumi.StringOutput)
}
// The description of the project
func (o LookupProjectResultOutput) Description() pulumi.StringOutput {
return o.ApplyT(func(v LookupProjectResult) string { return v.Description }).(pulumi.StringOutput)
}
// The environment of the project's resources. The possible values are: `Development`, `Staging`, `Production`.
func (o LookupProjectResultOutput) Environment() pulumi.StringOutput {
return o.ApplyT(func(v LookupProjectResult) string { return v.Environment }).(pulumi.StringOutput)
}
func (o LookupProjectResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v LookupProjectResult) string { return v.Id }).(pulumi.StringOutput)
}
func (o LookupProjectResultOutput) IsDefault() pulumi.BoolOutput {
return o.ApplyT(func(v LookupProjectResult) bool { return v.IsDefault }).(pulumi.BoolOutput)
}
func (o LookupProjectResultOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v LookupProjectResult) string { return v.Name }).(pulumi.StringOutput)
}
// The ID of the project owner.
func (o LookupProjectResultOutput) OwnerId() pulumi.IntOutput {
return o.ApplyT(func(v LookupProjectResult) int { return v.OwnerId }).(pulumi.IntOutput)
}
// The unique universal identifier of the project owner.
func (o LookupProjectResultOutput) OwnerUuid() pulumi.StringOutput {
return o.ApplyT(func(v LookupProjectResult) string { return v.OwnerUuid }).(pulumi.StringOutput)
}
// The purpose of the project, (Default: "Web Application")
func (o LookupProjectResultOutput) Purpose() pulumi.StringOutput {
return o.ApplyT(func(v LookupProjectResult) string { return v.Purpose }).(pulumi.StringOutput)
}
// A set of uniform resource names (URNs) for the resources associated with the project
func (o LookupProjectResultOutput) Resources() pulumi.StringArrayOutput {
return o.ApplyT(func(v LookupProjectResult) []string { return v.Resources }).(pulumi.StringArrayOutput)
}
// The date and time when the project was last updated, (ISO8601)
func (o LookupProjectResultOutput) UpdatedAt() pulumi.StringOutput {
return o.ApplyT(func(v LookupProjectResult) string { return v.UpdatedAt }).(pulumi.StringOutput)
}
func init() {
pulumi.RegisterOutputType(LookupProjectResultOutput{})
}