/
getDropletSnapshot.go
172 lines (148 loc) · 7.14 KB
/
getDropletSnapshot.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
// *** 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"
)
// Droplet snapshots are saved instances of a Droplet. Use this data
// source to retrieve the ID of a DigitalOcean Droplet snapshot for use in other
// resources.
//
// ## Example Usage
//
// Get the Droplet snapshot:
//
// ```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.LookupDropletSnapshot(ctx, &GetDropletSnapshotArgs{
// MostRecent: pulumi.BoolRef(true),
// NameRegex: pulumi.StringRef("^web"),
// Region: pulumi.StringRef("nyc3"),
// }, nil)
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
func LookupDropletSnapshot(ctx *pulumi.Context, args *LookupDropletSnapshotArgs, opts ...pulumi.InvokeOption) (*LookupDropletSnapshotResult, error) {
var rv LookupDropletSnapshotResult
err := ctx.Invoke("digitalocean:index/getDropletSnapshot:getDropletSnapshot", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getDropletSnapshot.
type LookupDropletSnapshotArgs struct {
// If more than one result is returned, use the most recent Droplet snapshot.
MostRecent *bool `pulumi:"mostRecent"`
// The name of the Droplet snapshot.
Name *string `pulumi:"name"`
// A regex string to apply to the Droplet snapshot list returned by DigitalOcean. This allows more advanced filtering not supported from the DigitalOcean API. This filtering is done locally on what DigitalOcean returns.
NameRegex *string `pulumi:"nameRegex"`
// A "slug" representing a DigitalOcean region (e.g. `nyc1`). If set, only Droplet snapshots available in the region will be returned.
Region *string `pulumi:"region"`
}
// A collection of values returned by getDropletSnapshot.
type LookupDropletSnapshotResult struct {
// The date and time the Droplet snapshot was created.
CreatedAt string `pulumi:"createdAt"`
// The ID of the Droplet from which the Droplet snapshot originated.
DropletId string `pulumi:"dropletId"`
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
// The minimum size in gigabytes required for a Droplet to be created based on this Droplet snapshot.
MinDiskSize int `pulumi:"minDiskSize"`
MostRecent *bool `pulumi:"mostRecent"`
Name *string `pulumi:"name"`
NameRegex *string `pulumi:"nameRegex"`
Region *string `pulumi:"region"`
// A list of DigitalOcean region "slugs" indicating where the Droplet snapshot is available.
Regions []string `pulumi:"regions"`
// The billable size of the Droplet snapshot in gigabytes.
Size float64 `pulumi:"size"`
}
func LookupDropletSnapshotOutput(ctx *pulumi.Context, args LookupDropletSnapshotOutputArgs, opts ...pulumi.InvokeOption) LookupDropletSnapshotResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (LookupDropletSnapshotResult, error) {
args := v.(LookupDropletSnapshotArgs)
r, err := LookupDropletSnapshot(ctx, &args, opts...)
return *r, err
}).(LookupDropletSnapshotResultOutput)
}
// A collection of arguments for invoking getDropletSnapshot.
type LookupDropletSnapshotOutputArgs struct {
// If more than one result is returned, use the most recent Droplet snapshot.
MostRecent pulumi.BoolPtrInput `pulumi:"mostRecent"`
// The name of the Droplet snapshot.
Name pulumi.StringPtrInput `pulumi:"name"`
// A regex string to apply to the Droplet snapshot list returned by DigitalOcean. This allows more advanced filtering not supported from the DigitalOcean API. This filtering is done locally on what DigitalOcean returns.
NameRegex pulumi.StringPtrInput `pulumi:"nameRegex"`
// A "slug" representing a DigitalOcean region (e.g. `nyc1`). If set, only Droplet snapshots available in the region will be returned.
Region pulumi.StringPtrInput `pulumi:"region"`
}
func (LookupDropletSnapshotOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*LookupDropletSnapshotArgs)(nil)).Elem()
}
// A collection of values returned by getDropletSnapshot.
type LookupDropletSnapshotResultOutput struct{ *pulumi.OutputState }
func (LookupDropletSnapshotResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*LookupDropletSnapshotResult)(nil)).Elem()
}
func (o LookupDropletSnapshotResultOutput) ToLookupDropletSnapshotResultOutput() LookupDropletSnapshotResultOutput {
return o
}
func (o LookupDropletSnapshotResultOutput) ToLookupDropletSnapshotResultOutputWithContext(ctx context.Context) LookupDropletSnapshotResultOutput {
return o
}
// The date and time the Droplet snapshot was created.
func (o LookupDropletSnapshotResultOutput) CreatedAt() pulumi.StringOutput {
return o.ApplyT(func(v LookupDropletSnapshotResult) string { return v.CreatedAt }).(pulumi.StringOutput)
}
// The ID of the Droplet from which the Droplet snapshot originated.
func (o LookupDropletSnapshotResultOutput) DropletId() pulumi.StringOutput {
return o.ApplyT(func(v LookupDropletSnapshotResult) string { return v.DropletId }).(pulumi.StringOutput)
}
// The provider-assigned unique ID for this managed resource.
func (o LookupDropletSnapshotResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v LookupDropletSnapshotResult) string { return v.Id }).(pulumi.StringOutput)
}
// The minimum size in gigabytes required for a Droplet to be created based on this Droplet snapshot.
func (o LookupDropletSnapshotResultOutput) MinDiskSize() pulumi.IntOutput {
return o.ApplyT(func(v LookupDropletSnapshotResult) int { return v.MinDiskSize }).(pulumi.IntOutput)
}
func (o LookupDropletSnapshotResultOutput) MostRecent() pulumi.BoolPtrOutput {
return o.ApplyT(func(v LookupDropletSnapshotResult) *bool { return v.MostRecent }).(pulumi.BoolPtrOutput)
}
func (o LookupDropletSnapshotResultOutput) Name() pulumi.StringPtrOutput {
return o.ApplyT(func(v LookupDropletSnapshotResult) *string { return v.Name }).(pulumi.StringPtrOutput)
}
func (o LookupDropletSnapshotResultOutput) NameRegex() pulumi.StringPtrOutput {
return o.ApplyT(func(v LookupDropletSnapshotResult) *string { return v.NameRegex }).(pulumi.StringPtrOutput)
}
func (o LookupDropletSnapshotResultOutput) Region() pulumi.StringPtrOutput {
return o.ApplyT(func(v LookupDropletSnapshotResult) *string { return v.Region }).(pulumi.StringPtrOutput)
}
// A list of DigitalOcean region "slugs" indicating where the Droplet snapshot is available.
func (o LookupDropletSnapshotResultOutput) Regions() pulumi.StringArrayOutput {
return o.ApplyT(func(v LookupDropletSnapshotResult) []string { return v.Regions }).(pulumi.StringArrayOutput)
}
// The billable size of the Droplet snapshot in gigabytes.
func (o LookupDropletSnapshotResultOutput) Size() pulumi.Float64Output {
return o.ApplyT(func(v LookupDropletSnapshotResult) float64 { return v.Size }).(pulumi.Float64Output)
}
func init() {
pulumi.RegisterOutputType(LookupDropletSnapshotResultOutput{})
}