/
getSpacesBuckets.go
174 lines (156 loc) · 5.52 KB
/
getSpacesBuckets.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 Spaces buckets for use in other resources, with the ability to filter and sort the results.
// If no filters are specified, all Spaces buckets will be returned.
//
// Note: You can use the `SpacesBucket` data source to
// obtain metadata about a single bucket if you already know its `name` and `region`.
//
// ## Example Usage
//
// Use the `filter` block with a `key` string and `values` list to filter buckets.
//
// Get all buckets in a region:
//
// ```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.GetSpacesBuckets(ctx, &GetSpacesBucketsArgs{
// Filters: []GetSpacesBucketsFilter{
// GetSpacesBucketsFilter{
// Key: "region",
// Values: []string{
// "nyc3",
// },
// },
// },
// }, nil)
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
// You can sort the results as well:
//
// ```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.GetSpacesBuckets(ctx, &GetSpacesBucketsArgs{
// Filters: []GetSpacesBucketsFilter{
// GetSpacesBucketsFilter{
// Key: "region",
// Values: []string{
// "nyc3",
// },
// },
// },
// Sorts: []GetSpacesBucketsSort{
// GetSpacesBucketsSort{
// Direction: pulumi.StringRef("desc"),
// Key: "name",
// },
// },
// }, nil)
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
func GetSpacesBuckets(ctx *pulumi.Context, args *GetSpacesBucketsArgs, opts ...pulumi.InvokeOption) (*GetSpacesBucketsResult, error) {
var rv GetSpacesBucketsResult
err := ctx.Invoke("digitalocean:index/getSpacesBuckets:getSpacesBuckets", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getSpacesBuckets.
type GetSpacesBucketsArgs struct {
// Filter the results.
// The `filter` block is documented below.
Filters []GetSpacesBucketsFilter `pulumi:"filters"`
// Sort the results.
// The `sort` block is documented below.
Sorts []GetSpacesBucketsSort `pulumi:"sorts"`
}
// A collection of values returned by getSpacesBuckets.
type GetSpacesBucketsResult struct {
// A list of Spaces buckets satisfying any `filter` and `sort` criteria. Each bucket has the following attributes:
Buckets []GetSpacesBucketsBucket `pulumi:"buckets"`
Filters []GetSpacesBucketsFilter `pulumi:"filters"`
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
Sorts []GetSpacesBucketsSort `pulumi:"sorts"`
}
func GetSpacesBucketsOutput(ctx *pulumi.Context, args GetSpacesBucketsOutputArgs, opts ...pulumi.InvokeOption) GetSpacesBucketsResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (GetSpacesBucketsResult, error) {
args := v.(GetSpacesBucketsArgs)
r, err := GetSpacesBuckets(ctx, &args, opts...)
return *r, err
}).(GetSpacesBucketsResultOutput)
}
// A collection of arguments for invoking getSpacesBuckets.
type GetSpacesBucketsOutputArgs struct {
// Filter the results.
// The `filter` block is documented below.
Filters GetSpacesBucketsFilterArrayInput `pulumi:"filters"`
// Sort the results.
// The `sort` block is documented below.
Sorts GetSpacesBucketsSortArrayInput `pulumi:"sorts"`
}
func (GetSpacesBucketsOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*GetSpacesBucketsArgs)(nil)).Elem()
}
// A collection of values returned by getSpacesBuckets.
type GetSpacesBucketsResultOutput struct{ *pulumi.OutputState }
func (GetSpacesBucketsResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*GetSpacesBucketsResult)(nil)).Elem()
}
func (o GetSpacesBucketsResultOutput) ToGetSpacesBucketsResultOutput() GetSpacesBucketsResultOutput {
return o
}
func (o GetSpacesBucketsResultOutput) ToGetSpacesBucketsResultOutputWithContext(ctx context.Context) GetSpacesBucketsResultOutput {
return o
}
// A list of Spaces buckets satisfying any `filter` and `sort` criteria. Each bucket has the following attributes:
func (o GetSpacesBucketsResultOutput) Buckets() GetSpacesBucketsBucketArrayOutput {
return o.ApplyT(func(v GetSpacesBucketsResult) []GetSpacesBucketsBucket { return v.Buckets }).(GetSpacesBucketsBucketArrayOutput)
}
func (o GetSpacesBucketsResultOutput) Filters() GetSpacesBucketsFilterArrayOutput {
return o.ApplyT(func(v GetSpacesBucketsResult) []GetSpacesBucketsFilter { return v.Filters }).(GetSpacesBucketsFilterArrayOutput)
}
// The provider-assigned unique ID for this managed resource.
func (o GetSpacesBucketsResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v GetSpacesBucketsResult) string { return v.Id }).(pulumi.StringOutput)
}
func (o GetSpacesBucketsResultOutput) Sorts() GetSpacesBucketsSortArrayOutput {
return o.ApplyT(func(v GetSpacesBucketsResult) []GetSpacesBucketsSort { return v.Sorts }).(GetSpacesBucketsSortArrayOutput)
}
func init() {
pulumi.RegisterOutputType(GetSpacesBucketsResultOutput{})
}