/
collection.go
290 lines (257 loc) · 9.83 KB
/
collection.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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
// 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 opensearchserverless
import (
"context"
"reflect"
"github.com/pulumi/pulumi-aws-native/sdk/go/aws"
"github.com/pulumi/pulumi-aws-native/sdk/go/aws/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Amazon OpenSearchServerless collection resource
//
// ## Example Usage
// ### Example
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws-native/sdk/go/aws/opensearchserverless"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// encryptionPolicy, err := opensearchserverless.NewSecurityPolicy(ctx, "encryptionPolicy", &opensearchserverless.SecurityPolicyArgs{
// Name: pulumi.String("test-encryption-policy"),
// Type: opensearchserverless.SecurityPolicyTypeEncryption,
// Description: pulumi.String("Encryption policy for test collection"),
// Policy: pulumi.String("{\"Rules\":[{\"ResourceType\":\"collection\",\"Resource\":[\"collection/test-collection\"]}],\"AWSOwnedKey\":true}"),
// })
// if err != nil {
// return err
// }
// _, err = opensearchserverless.NewCollection(ctx, "testCollection", &opensearchserverless.CollectionArgs{
// Name: pulumi.String("test-collection"),
// Type: opensearchserverless.CollectionTypeSearch,
// Description: pulumi.String("Search collection"),
// }, pulumi.DependsOn([]pulumi.Resource{
// encryptionPolicy,
// }))
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// ### Example
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws-native/sdk/go/aws/opensearchserverless"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// encryptionPolicy, err := opensearchserverless.NewSecurityPolicy(ctx, "encryptionPolicy", &opensearchserverless.SecurityPolicyArgs{
// Name: pulumi.String("test-encryption-policy"),
// Type: opensearchserverless.SecurityPolicyTypeEncryption,
// Description: pulumi.String("Encryption policy for test collection"),
// Policy: pulumi.String("{\"Rules\":[{\"ResourceType\":\"collection\",\"Resource\":[\"collection/test-collection\"]}],\"AWSOwnedKey\":true}"),
// })
// if err != nil {
// return err
// }
// _, err = opensearchserverless.NewCollection(ctx, "testCollection", &opensearchserverless.CollectionArgs{
// Name: pulumi.String("test-collection"),
// Type: opensearchserverless.CollectionTypeSearch,
// Description: pulumi.String("Search collection"),
// }, pulumi.DependsOn([]pulumi.Resource{
// encryptionPolicy,
// }))
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
type Collection struct {
pulumi.CustomResourceState
// The Amazon Resource Name (ARN) of the collection.
Arn pulumi.StringOutput `pulumi:"arn"`
// The identifier of the collection
AwsId pulumi.StringOutput `pulumi:"awsId"`
// The endpoint for the collection.
CollectionEndpoint pulumi.StringOutput `pulumi:"collectionEndpoint"`
// The OpenSearch Dashboards endpoint for the collection.
DashboardEndpoint pulumi.StringOutput `pulumi:"dashboardEndpoint"`
// The description of the collection
Description pulumi.StringPtrOutput `pulumi:"description"`
// The name of the collection.
//
// The name must meet the following criteria:
// Unique to your account and AWS Region
// Starts with a lowercase letter
// Contains only lowercase letters a-z, the numbers 0-9 and the hyphen (-)
// Contains between 3 and 32 characters
Name pulumi.StringOutput `pulumi:"name"`
StandbyReplicas CollectionStandbyReplicasPtrOutput `pulumi:"standbyReplicas"`
// List of tags to be added to the resource
Tags aws.CreateOnlyTagArrayOutput `pulumi:"tags"`
Type CollectionTypePtrOutput `pulumi:"type"`
}
// NewCollection registers a new resource with the given unique name, arguments, and options.
func NewCollection(ctx *pulumi.Context,
name string, args *CollectionArgs, opts ...pulumi.ResourceOption) (*Collection, error) {
if args == nil {
args = &CollectionArgs{}
}
replaceOnChanges := pulumi.ReplaceOnChanges([]string{
"name",
"tags[*]",
"type",
})
opts = append(opts, replaceOnChanges)
opts = internal.PkgResourceDefaultOpts(opts)
var resource Collection
err := ctx.RegisterResource("aws-native:opensearchserverless:Collection", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetCollection gets an existing Collection resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetCollection(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *CollectionState, opts ...pulumi.ResourceOption) (*Collection, error) {
var resource Collection
err := ctx.ReadResource("aws-native:opensearchserverless:Collection", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Collection resources.
type collectionState struct {
}
type CollectionState struct {
}
func (CollectionState) ElementType() reflect.Type {
return reflect.TypeOf((*collectionState)(nil)).Elem()
}
type collectionArgs struct {
// The description of the collection
Description *string `pulumi:"description"`
// The name of the collection.
//
// The name must meet the following criteria:
// Unique to your account and AWS Region
// Starts with a lowercase letter
// Contains only lowercase letters a-z, the numbers 0-9 and the hyphen (-)
// Contains between 3 and 32 characters
Name *string `pulumi:"name"`
StandbyReplicas *CollectionStandbyReplicas `pulumi:"standbyReplicas"`
// List of tags to be added to the resource
Tags []aws.CreateOnlyTag `pulumi:"tags"`
Type *CollectionType `pulumi:"type"`
}
// The set of arguments for constructing a Collection resource.
type CollectionArgs struct {
// The description of the collection
Description pulumi.StringPtrInput
// The name of the collection.
//
// The name must meet the following criteria:
// Unique to your account and AWS Region
// Starts with a lowercase letter
// Contains only lowercase letters a-z, the numbers 0-9 and the hyphen (-)
// Contains between 3 and 32 characters
Name pulumi.StringPtrInput
StandbyReplicas CollectionStandbyReplicasPtrInput
// List of tags to be added to the resource
Tags aws.CreateOnlyTagArrayInput
Type CollectionTypePtrInput
}
func (CollectionArgs) ElementType() reflect.Type {
return reflect.TypeOf((*collectionArgs)(nil)).Elem()
}
type CollectionInput interface {
pulumi.Input
ToCollectionOutput() CollectionOutput
ToCollectionOutputWithContext(ctx context.Context) CollectionOutput
}
func (*Collection) ElementType() reflect.Type {
return reflect.TypeOf((**Collection)(nil)).Elem()
}
func (i *Collection) ToCollectionOutput() CollectionOutput {
return i.ToCollectionOutputWithContext(context.Background())
}
func (i *Collection) ToCollectionOutputWithContext(ctx context.Context) CollectionOutput {
return pulumi.ToOutputWithContext(ctx, i).(CollectionOutput)
}
type CollectionOutput struct{ *pulumi.OutputState }
func (CollectionOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Collection)(nil)).Elem()
}
func (o CollectionOutput) ToCollectionOutput() CollectionOutput {
return o
}
func (o CollectionOutput) ToCollectionOutputWithContext(ctx context.Context) CollectionOutput {
return o
}
// The Amazon Resource Name (ARN) of the collection.
func (o CollectionOutput) Arn() pulumi.StringOutput {
return o.ApplyT(func(v *Collection) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
}
// The identifier of the collection
func (o CollectionOutput) AwsId() pulumi.StringOutput {
return o.ApplyT(func(v *Collection) pulumi.StringOutput { return v.AwsId }).(pulumi.StringOutput)
}
// The endpoint for the collection.
func (o CollectionOutput) CollectionEndpoint() pulumi.StringOutput {
return o.ApplyT(func(v *Collection) pulumi.StringOutput { return v.CollectionEndpoint }).(pulumi.StringOutput)
}
// The OpenSearch Dashboards endpoint for the collection.
func (o CollectionOutput) DashboardEndpoint() pulumi.StringOutput {
return o.ApplyT(func(v *Collection) pulumi.StringOutput { return v.DashboardEndpoint }).(pulumi.StringOutput)
}
// The description of the collection
func (o CollectionOutput) Description() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Collection) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
}
// The name of the collection.
//
// The name must meet the following criteria:
// Unique to your account and AWS Region
// Starts with a lowercase letter
// Contains only lowercase letters a-z, the numbers 0-9 and the hyphen (-)
// Contains between 3 and 32 characters
func (o CollectionOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *Collection) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
func (o CollectionOutput) StandbyReplicas() CollectionStandbyReplicasPtrOutput {
return o.ApplyT(func(v *Collection) CollectionStandbyReplicasPtrOutput { return v.StandbyReplicas }).(CollectionStandbyReplicasPtrOutput)
}
// List of tags to be added to the resource
func (o CollectionOutput) Tags() aws.CreateOnlyTagArrayOutput {
return o.ApplyT(func(v *Collection) aws.CreateOnlyTagArrayOutput { return v.Tags }).(aws.CreateOnlyTagArrayOutput)
}
func (o CollectionOutput) Type() CollectionTypePtrOutput {
return o.ApplyT(func(v *Collection) CollectionTypePtrOutput { return v.Type }).(CollectionTypePtrOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*CollectionInput)(nil)).Elem(), &Collection{})
pulumi.RegisterOutputType(CollectionOutput{})
}