/
dataset.go
253 lines (223 loc) · 8.14 KB
/
dataset.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
// 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 personalize
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-aws-native/sdk/go/aws/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Resource schema for AWS::Personalize::Dataset.
//
// ## Example Usage
// ### Example
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws-native/sdk/go/aws/personalize"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := personalize.NewDataset(ctx, "myDataset", &personalize.DatasetArgs{
// Name: pulumi.String("my-dataset-name"),
// DatasetType: personalize.DatasetTypeInteractions,
// DatasetGroupArn: pulumi.String("arn:aws:personalize:us-west-2:123456789012:dataset-group/dataset-group-name"),
// SchemaArn: pulumi.String("arn:aws:personalize:us-west-2:123456789012:schema/schema-name"),
// DatasetImportJob: &personalize.DatasetImportJobArgs{
// JobName: pulumi.String("my-import-job-name"),
// DataSource: &personalize.DatasetImportJobDataSourcePropertiesArgs{
// DataLocation: pulumi.String("s3://bucket-name/file-name.csv"),
// },
// RoleArn: pulumi.String("arn:aws:iam::123456789012:role/personalize-role"),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// ### Example
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws-native/sdk/go/aws/personalize"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := personalize.NewDataset(ctx, "myDataset", &personalize.DatasetArgs{
// Name: pulumi.String("my-dataset-name"),
// DatasetType: personalize.DatasetTypeInteractions,
// DatasetGroupArn: pulumi.String("arn:aws:personalize:us-west-2:123456789012:dataset-group/dataset-group-name"),
// SchemaArn: pulumi.String("arn:aws:personalize:us-west-2:123456789012:schema/schema-name"),
// DatasetImportJob: &personalize.DatasetImportJobArgs{
// JobName: pulumi.String("my-import-job-name"),
// DataSource: &personalize.DatasetImportJobDataSourcePropertiesArgs{
// DataLocation: pulumi.String("s3://bucket-name/file-name.csv"),
// },
// RoleArn: pulumi.String("arn:aws:iam::123456789012:role/personalize-role"),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
type Dataset struct {
pulumi.CustomResourceState
// The ARN of the dataset
DatasetArn pulumi.StringOutput `pulumi:"datasetArn"`
// The Amazon Resource Name (ARN) of the dataset group to add the dataset to
DatasetGroupArn pulumi.StringOutput `pulumi:"datasetGroupArn"`
DatasetImportJob DatasetImportJobPtrOutput `pulumi:"datasetImportJob"`
// The type of dataset
DatasetType DatasetTypeOutput `pulumi:"datasetType"`
// The name for the dataset
Name pulumi.StringOutput `pulumi:"name"`
// The ARN of the schema to associate with the dataset. The schema defines the dataset fields.
SchemaArn pulumi.StringOutput `pulumi:"schemaArn"`
}
// NewDataset registers a new resource with the given unique name, arguments, and options.
func NewDataset(ctx *pulumi.Context,
name string, args *DatasetArgs, opts ...pulumi.ResourceOption) (*Dataset, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.DatasetGroupArn == nil {
return nil, errors.New("invalid value for required argument 'DatasetGroupArn'")
}
if args.DatasetType == nil {
return nil, errors.New("invalid value for required argument 'DatasetType'")
}
if args.SchemaArn == nil {
return nil, errors.New("invalid value for required argument 'SchemaArn'")
}
replaceOnChanges := pulumi.ReplaceOnChanges([]string{
"datasetGroupArn",
"datasetType",
"name",
"schemaArn",
})
opts = append(opts, replaceOnChanges)
opts = internal.PkgResourceDefaultOpts(opts)
var resource Dataset
err := ctx.RegisterResource("aws-native:personalize:Dataset", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetDataset gets an existing Dataset 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 GetDataset(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *DatasetState, opts ...pulumi.ResourceOption) (*Dataset, error) {
var resource Dataset
err := ctx.ReadResource("aws-native:personalize:Dataset", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Dataset resources.
type datasetState struct {
}
type DatasetState struct {
}
func (DatasetState) ElementType() reflect.Type {
return reflect.TypeOf((*datasetState)(nil)).Elem()
}
type datasetArgs struct {
// The Amazon Resource Name (ARN) of the dataset group to add the dataset to
DatasetGroupArn string `pulumi:"datasetGroupArn"`
DatasetImportJob *DatasetImportJob `pulumi:"datasetImportJob"`
// The type of dataset
DatasetType DatasetType `pulumi:"datasetType"`
// The name for the dataset
Name *string `pulumi:"name"`
// The ARN of the schema to associate with the dataset. The schema defines the dataset fields.
SchemaArn string `pulumi:"schemaArn"`
}
// The set of arguments for constructing a Dataset resource.
type DatasetArgs struct {
// The Amazon Resource Name (ARN) of the dataset group to add the dataset to
DatasetGroupArn pulumi.StringInput
DatasetImportJob DatasetImportJobPtrInput
// The type of dataset
DatasetType DatasetTypeInput
// The name for the dataset
Name pulumi.StringPtrInput
// The ARN of the schema to associate with the dataset. The schema defines the dataset fields.
SchemaArn pulumi.StringInput
}
func (DatasetArgs) ElementType() reflect.Type {
return reflect.TypeOf((*datasetArgs)(nil)).Elem()
}
type DatasetInput interface {
pulumi.Input
ToDatasetOutput() DatasetOutput
ToDatasetOutputWithContext(ctx context.Context) DatasetOutput
}
func (*Dataset) ElementType() reflect.Type {
return reflect.TypeOf((**Dataset)(nil)).Elem()
}
func (i *Dataset) ToDatasetOutput() DatasetOutput {
return i.ToDatasetOutputWithContext(context.Background())
}
func (i *Dataset) ToDatasetOutputWithContext(ctx context.Context) DatasetOutput {
return pulumi.ToOutputWithContext(ctx, i).(DatasetOutput)
}
type DatasetOutput struct{ *pulumi.OutputState }
func (DatasetOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Dataset)(nil)).Elem()
}
func (o DatasetOutput) ToDatasetOutput() DatasetOutput {
return o
}
func (o DatasetOutput) ToDatasetOutputWithContext(ctx context.Context) DatasetOutput {
return o
}
// The ARN of the dataset
func (o DatasetOutput) DatasetArn() pulumi.StringOutput {
return o.ApplyT(func(v *Dataset) pulumi.StringOutput { return v.DatasetArn }).(pulumi.StringOutput)
}
// The Amazon Resource Name (ARN) of the dataset group to add the dataset to
func (o DatasetOutput) DatasetGroupArn() pulumi.StringOutput {
return o.ApplyT(func(v *Dataset) pulumi.StringOutput { return v.DatasetGroupArn }).(pulumi.StringOutput)
}
func (o DatasetOutput) DatasetImportJob() DatasetImportJobPtrOutput {
return o.ApplyT(func(v *Dataset) DatasetImportJobPtrOutput { return v.DatasetImportJob }).(DatasetImportJobPtrOutput)
}
// The type of dataset
func (o DatasetOutput) DatasetType() DatasetTypeOutput {
return o.ApplyT(func(v *Dataset) DatasetTypeOutput { return v.DatasetType }).(DatasetTypeOutput)
}
// The name for the dataset
func (o DatasetOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *Dataset) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// The ARN of the schema to associate with the dataset. The schema defines the dataset fields.
func (o DatasetOutput) SchemaArn() pulumi.StringOutput {
return o.ApplyT(func(v *Dataset) pulumi.StringOutput { return v.SchemaArn }).(pulumi.StringOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*DatasetInput)(nil)).Elem(), &Dataset{})
pulumi.RegisterOutputType(DatasetOutput{})
}