github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/glue/schema.go (about) 1 // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT. 2 // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** 3 4 package glue 5 6 import ( 7 "context" 8 "reflect" 9 10 "errors" 11 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 12 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 13 ) 14 15 // Provides a Glue Schema resource. 16 // 17 // ## Example Usage 18 // 19 // <!--Start PulumiCodeChooser --> 20 // ```go 21 // package main 22 // 23 // import ( 24 // 25 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/glue" 26 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 27 // 28 // ) 29 // 30 // func main() { 31 // pulumi.Run(func(ctx *pulumi.Context) error { 32 // _, err := glue.NewSchema(ctx, "example", &glue.SchemaArgs{ 33 // SchemaName: pulumi.String("example"), 34 // RegistryArn: pulumi.Any(test.Arn), 35 // DataFormat: pulumi.String("AVRO"), 36 // Compatibility: pulumi.String("NONE"), 37 // SchemaDefinition: pulumi.String("{\"type\": \"record\", \"name\": \"r1\", \"fields\": [ {\"name\": \"f1\", \"type\": \"int\"}, {\"name\": \"f2\", \"type\": \"string\"} ]}"), 38 // }) 39 // if err != nil { 40 // return err 41 // } 42 // return nil 43 // }) 44 // } 45 // 46 // ``` 47 // <!--End PulumiCodeChooser --> 48 // 49 // ## Import 50 // 51 // Using `pulumi import`, import Glue Registries using `arn`. For example: 52 // 53 // ```sh 54 // $ pulumi import aws:glue/schema:Schema example arn:aws:glue:us-west-2:123456789012:schema/example/example 55 // ``` 56 type Schema struct { 57 pulumi.CustomResourceState 58 59 // Amazon Resource Name (ARN) of the schema. 60 Arn pulumi.StringOutput `pulumi:"arn"` 61 // The compatibility mode of the schema. Values values are: `NONE`, `DISABLED`, `BACKWARD`, `BACKWARD_ALL`, `FORWARD`, `FORWARD_ALL`, `FULL`, and `FULL_ALL`. 62 Compatibility pulumi.StringOutput `pulumi:"compatibility"` 63 // The data format of the schema definition. Valid values are `AVRO`, `JSON` and `PROTOBUF`. 64 DataFormat pulumi.StringOutput `pulumi:"dataFormat"` 65 // A description of the schema. 66 Description pulumi.StringPtrOutput `pulumi:"description"` 67 // The latest version of the schema associated with the returned schema definition. 68 LatestSchemaVersion pulumi.IntOutput `pulumi:"latestSchemaVersion"` 69 // The next version of the schema associated with the returned schema definition. 70 NextSchemaVersion pulumi.IntOutput `pulumi:"nextSchemaVersion"` 71 // The ARN of the Glue Registry to create the schema in. 72 RegistryArn pulumi.StringOutput `pulumi:"registryArn"` 73 // The name of the Glue Registry. 74 RegistryName pulumi.StringOutput `pulumi:"registryName"` 75 // The version number of the checkpoint (the last time the compatibility mode was changed). 76 SchemaCheckpoint pulumi.IntOutput `pulumi:"schemaCheckpoint"` 77 // The schema definition using the `dataFormat` setting for `schemaName`. 78 SchemaDefinition pulumi.StringOutput `pulumi:"schemaDefinition"` 79 // The Name of the schema. 80 SchemaName pulumi.StringOutput `pulumi:"schemaName"` 81 // Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 82 Tags pulumi.StringMapOutput `pulumi:"tags"` 83 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 84 // 85 // Deprecated: Please use `tags` instead. 86 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 87 } 88 89 // NewSchema registers a new resource with the given unique name, arguments, and options. 90 func NewSchema(ctx *pulumi.Context, 91 name string, args *SchemaArgs, opts ...pulumi.ResourceOption) (*Schema, error) { 92 if args == nil { 93 return nil, errors.New("missing one or more required arguments") 94 } 95 96 if args.Compatibility == nil { 97 return nil, errors.New("invalid value for required argument 'Compatibility'") 98 } 99 if args.DataFormat == nil { 100 return nil, errors.New("invalid value for required argument 'DataFormat'") 101 } 102 if args.SchemaDefinition == nil { 103 return nil, errors.New("invalid value for required argument 'SchemaDefinition'") 104 } 105 if args.SchemaName == nil { 106 return nil, errors.New("invalid value for required argument 'SchemaName'") 107 } 108 opts = internal.PkgResourceDefaultOpts(opts) 109 var resource Schema 110 err := ctx.RegisterResource("aws:glue/schema:Schema", name, args, &resource, opts...) 111 if err != nil { 112 return nil, err 113 } 114 return &resource, nil 115 } 116 117 // GetSchema gets an existing Schema resource's state with the given name, ID, and optional 118 // state properties that are used to uniquely qualify the lookup (nil if not required). 119 func GetSchema(ctx *pulumi.Context, 120 name string, id pulumi.IDInput, state *SchemaState, opts ...pulumi.ResourceOption) (*Schema, error) { 121 var resource Schema 122 err := ctx.ReadResource("aws:glue/schema:Schema", name, id, state, &resource, opts...) 123 if err != nil { 124 return nil, err 125 } 126 return &resource, nil 127 } 128 129 // Input properties used for looking up and filtering Schema resources. 130 type schemaState struct { 131 // Amazon Resource Name (ARN) of the schema. 132 Arn *string `pulumi:"arn"` 133 // The compatibility mode of the schema. Values values are: `NONE`, `DISABLED`, `BACKWARD`, `BACKWARD_ALL`, `FORWARD`, `FORWARD_ALL`, `FULL`, and `FULL_ALL`. 134 Compatibility *string `pulumi:"compatibility"` 135 // The data format of the schema definition. Valid values are `AVRO`, `JSON` and `PROTOBUF`. 136 DataFormat *string `pulumi:"dataFormat"` 137 // A description of the schema. 138 Description *string `pulumi:"description"` 139 // The latest version of the schema associated with the returned schema definition. 140 LatestSchemaVersion *int `pulumi:"latestSchemaVersion"` 141 // The next version of the schema associated with the returned schema definition. 142 NextSchemaVersion *int `pulumi:"nextSchemaVersion"` 143 // The ARN of the Glue Registry to create the schema in. 144 RegistryArn *string `pulumi:"registryArn"` 145 // The name of the Glue Registry. 146 RegistryName *string `pulumi:"registryName"` 147 // The version number of the checkpoint (the last time the compatibility mode was changed). 148 SchemaCheckpoint *int `pulumi:"schemaCheckpoint"` 149 // The schema definition using the `dataFormat` setting for `schemaName`. 150 SchemaDefinition *string `pulumi:"schemaDefinition"` 151 // The Name of the schema. 152 SchemaName *string `pulumi:"schemaName"` 153 // Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 154 Tags map[string]string `pulumi:"tags"` 155 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 156 // 157 // Deprecated: Please use `tags` instead. 158 TagsAll map[string]string `pulumi:"tagsAll"` 159 } 160 161 type SchemaState struct { 162 // Amazon Resource Name (ARN) of the schema. 163 Arn pulumi.StringPtrInput 164 // The compatibility mode of the schema. Values values are: `NONE`, `DISABLED`, `BACKWARD`, `BACKWARD_ALL`, `FORWARD`, `FORWARD_ALL`, `FULL`, and `FULL_ALL`. 165 Compatibility pulumi.StringPtrInput 166 // The data format of the schema definition. Valid values are `AVRO`, `JSON` and `PROTOBUF`. 167 DataFormat pulumi.StringPtrInput 168 // A description of the schema. 169 Description pulumi.StringPtrInput 170 // The latest version of the schema associated with the returned schema definition. 171 LatestSchemaVersion pulumi.IntPtrInput 172 // The next version of the schema associated with the returned schema definition. 173 NextSchemaVersion pulumi.IntPtrInput 174 // The ARN of the Glue Registry to create the schema in. 175 RegistryArn pulumi.StringPtrInput 176 // The name of the Glue Registry. 177 RegistryName pulumi.StringPtrInput 178 // The version number of the checkpoint (the last time the compatibility mode was changed). 179 SchemaCheckpoint pulumi.IntPtrInput 180 // The schema definition using the `dataFormat` setting for `schemaName`. 181 SchemaDefinition pulumi.StringPtrInput 182 // The Name of the schema. 183 SchemaName pulumi.StringPtrInput 184 // Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 185 Tags pulumi.StringMapInput 186 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 187 // 188 // Deprecated: Please use `tags` instead. 189 TagsAll pulumi.StringMapInput 190 } 191 192 func (SchemaState) ElementType() reflect.Type { 193 return reflect.TypeOf((*schemaState)(nil)).Elem() 194 } 195 196 type schemaArgs struct { 197 // The compatibility mode of the schema. Values values are: `NONE`, `DISABLED`, `BACKWARD`, `BACKWARD_ALL`, `FORWARD`, `FORWARD_ALL`, `FULL`, and `FULL_ALL`. 198 Compatibility string `pulumi:"compatibility"` 199 // The data format of the schema definition. Valid values are `AVRO`, `JSON` and `PROTOBUF`. 200 DataFormat string `pulumi:"dataFormat"` 201 // A description of the schema. 202 Description *string `pulumi:"description"` 203 // The ARN of the Glue Registry to create the schema in. 204 RegistryArn *string `pulumi:"registryArn"` 205 // The schema definition using the `dataFormat` setting for `schemaName`. 206 SchemaDefinition string `pulumi:"schemaDefinition"` 207 // The Name of the schema. 208 SchemaName string `pulumi:"schemaName"` 209 // Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 210 Tags map[string]string `pulumi:"tags"` 211 } 212 213 // The set of arguments for constructing a Schema resource. 214 type SchemaArgs struct { 215 // The compatibility mode of the schema. Values values are: `NONE`, `DISABLED`, `BACKWARD`, `BACKWARD_ALL`, `FORWARD`, `FORWARD_ALL`, `FULL`, and `FULL_ALL`. 216 Compatibility pulumi.StringInput 217 // The data format of the schema definition. Valid values are `AVRO`, `JSON` and `PROTOBUF`. 218 DataFormat pulumi.StringInput 219 // A description of the schema. 220 Description pulumi.StringPtrInput 221 // The ARN of the Glue Registry to create the schema in. 222 RegistryArn pulumi.StringPtrInput 223 // The schema definition using the `dataFormat` setting for `schemaName`. 224 SchemaDefinition pulumi.StringInput 225 // The Name of the schema. 226 SchemaName pulumi.StringInput 227 // Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 228 Tags pulumi.StringMapInput 229 } 230 231 func (SchemaArgs) ElementType() reflect.Type { 232 return reflect.TypeOf((*schemaArgs)(nil)).Elem() 233 } 234 235 type SchemaInput interface { 236 pulumi.Input 237 238 ToSchemaOutput() SchemaOutput 239 ToSchemaOutputWithContext(ctx context.Context) SchemaOutput 240 } 241 242 func (*Schema) ElementType() reflect.Type { 243 return reflect.TypeOf((**Schema)(nil)).Elem() 244 } 245 246 func (i *Schema) ToSchemaOutput() SchemaOutput { 247 return i.ToSchemaOutputWithContext(context.Background()) 248 } 249 250 func (i *Schema) ToSchemaOutputWithContext(ctx context.Context) SchemaOutput { 251 return pulumi.ToOutputWithContext(ctx, i).(SchemaOutput) 252 } 253 254 // SchemaArrayInput is an input type that accepts SchemaArray and SchemaArrayOutput values. 255 // You can construct a concrete instance of `SchemaArrayInput` via: 256 // 257 // SchemaArray{ SchemaArgs{...} } 258 type SchemaArrayInput interface { 259 pulumi.Input 260 261 ToSchemaArrayOutput() SchemaArrayOutput 262 ToSchemaArrayOutputWithContext(context.Context) SchemaArrayOutput 263 } 264 265 type SchemaArray []SchemaInput 266 267 func (SchemaArray) ElementType() reflect.Type { 268 return reflect.TypeOf((*[]*Schema)(nil)).Elem() 269 } 270 271 func (i SchemaArray) ToSchemaArrayOutput() SchemaArrayOutput { 272 return i.ToSchemaArrayOutputWithContext(context.Background()) 273 } 274 275 func (i SchemaArray) ToSchemaArrayOutputWithContext(ctx context.Context) SchemaArrayOutput { 276 return pulumi.ToOutputWithContext(ctx, i).(SchemaArrayOutput) 277 } 278 279 // SchemaMapInput is an input type that accepts SchemaMap and SchemaMapOutput values. 280 // You can construct a concrete instance of `SchemaMapInput` via: 281 // 282 // SchemaMap{ "key": SchemaArgs{...} } 283 type SchemaMapInput interface { 284 pulumi.Input 285 286 ToSchemaMapOutput() SchemaMapOutput 287 ToSchemaMapOutputWithContext(context.Context) SchemaMapOutput 288 } 289 290 type SchemaMap map[string]SchemaInput 291 292 func (SchemaMap) ElementType() reflect.Type { 293 return reflect.TypeOf((*map[string]*Schema)(nil)).Elem() 294 } 295 296 func (i SchemaMap) ToSchemaMapOutput() SchemaMapOutput { 297 return i.ToSchemaMapOutputWithContext(context.Background()) 298 } 299 300 func (i SchemaMap) ToSchemaMapOutputWithContext(ctx context.Context) SchemaMapOutput { 301 return pulumi.ToOutputWithContext(ctx, i).(SchemaMapOutput) 302 } 303 304 type SchemaOutput struct{ *pulumi.OutputState } 305 306 func (SchemaOutput) ElementType() reflect.Type { 307 return reflect.TypeOf((**Schema)(nil)).Elem() 308 } 309 310 func (o SchemaOutput) ToSchemaOutput() SchemaOutput { 311 return o 312 } 313 314 func (o SchemaOutput) ToSchemaOutputWithContext(ctx context.Context) SchemaOutput { 315 return o 316 } 317 318 // Amazon Resource Name (ARN) of the schema. 319 func (o SchemaOutput) Arn() pulumi.StringOutput { 320 return o.ApplyT(func(v *Schema) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 321 } 322 323 // The compatibility mode of the schema. Values values are: `NONE`, `DISABLED`, `BACKWARD`, `BACKWARD_ALL`, `FORWARD`, `FORWARD_ALL`, `FULL`, and `FULL_ALL`. 324 func (o SchemaOutput) Compatibility() pulumi.StringOutput { 325 return o.ApplyT(func(v *Schema) pulumi.StringOutput { return v.Compatibility }).(pulumi.StringOutput) 326 } 327 328 // The data format of the schema definition. Valid values are `AVRO`, `JSON` and `PROTOBUF`. 329 func (o SchemaOutput) DataFormat() pulumi.StringOutput { 330 return o.ApplyT(func(v *Schema) pulumi.StringOutput { return v.DataFormat }).(pulumi.StringOutput) 331 } 332 333 // A description of the schema. 334 func (o SchemaOutput) Description() pulumi.StringPtrOutput { 335 return o.ApplyT(func(v *Schema) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput) 336 } 337 338 // The latest version of the schema associated with the returned schema definition. 339 func (o SchemaOutput) LatestSchemaVersion() pulumi.IntOutput { 340 return o.ApplyT(func(v *Schema) pulumi.IntOutput { return v.LatestSchemaVersion }).(pulumi.IntOutput) 341 } 342 343 // The next version of the schema associated with the returned schema definition. 344 func (o SchemaOutput) NextSchemaVersion() pulumi.IntOutput { 345 return o.ApplyT(func(v *Schema) pulumi.IntOutput { return v.NextSchemaVersion }).(pulumi.IntOutput) 346 } 347 348 // The ARN of the Glue Registry to create the schema in. 349 func (o SchemaOutput) RegistryArn() pulumi.StringOutput { 350 return o.ApplyT(func(v *Schema) pulumi.StringOutput { return v.RegistryArn }).(pulumi.StringOutput) 351 } 352 353 // The name of the Glue Registry. 354 func (o SchemaOutput) RegistryName() pulumi.StringOutput { 355 return o.ApplyT(func(v *Schema) pulumi.StringOutput { return v.RegistryName }).(pulumi.StringOutput) 356 } 357 358 // The version number of the checkpoint (the last time the compatibility mode was changed). 359 func (o SchemaOutput) SchemaCheckpoint() pulumi.IntOutput { 360 return o.ApplyT(func(v *Schema) pulumi.IntOutput { return v.SchemaCheckpoint }).(pulumi.IntOutput) 361 } 362 363 // The schema definition using the `dataFormat` setting for `schemaName`. 364 func (o SchemaOutput) SchemaDefinition() pulumi.StringOutput { 365 return o.ApplyT(func(v *Schema) pulumi.StringOutput { return v.SchemaDefinition }).(pulumi.StringOutput) 366 } 367 368 // The Name of the schema. 369 func (o SchemaOutput) SchemaName() pulumi.StringOutput { 370 return o.ApplyT(func(v *Schema) pulumi.StringOutput { return v.SchemaName }).(pulumi.StringOutput) 371 } 372 373 // Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 374 func (o SchemaOutput) Tags() pulumi.StringMapOutput { 375 return o.ApplyT(func(v *Schema) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 376 } 377 378 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 379 // 380 // Deprecated: Please use `tags` instead. 381 func (o SchemaOutput) TagsAll() pulumi.StringMapOutput { 382 return o.ApplyT(func(v *Schema) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 383 } 384 385 type SchemaArrayOutput struct{ *pulumi.OutputState } 386 387 func (SchemaArrayOutput) ElementType() reflect.Type { 388 return reflect.TypeOf((*[]*Schema)(nil)).Elem() 389 } 390 391 func (o SchemaArrayOutput) ToSchemaArrayOutput() SchemaArrayOutput { 392 return o 393 } 394 395 func (o SchemaArrayOutput) ToSchemaArrayOutputWithContext(ctx context.Context) SchemaArrayOutput { 396 return o 397 } 398 399 func (o SchemaArrayOutput) Index(i pulumi.IntInput) SchemaOutput { 400 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Schema { 401 return vs[0].([]*Schema)[vs[1].(int)] 402 }).(SchemaOutput) 403 } 404 405 type SchemaMapOutput struct{ *pulumi.OutputState } 406 407 func (SchemaMapOutput) ElementType() reflect.Type { 408 return reflect.TypeOf((*map[string]*Schema)(nil)).Elem() 409 } 410 411 func (o SchemaMapOutput) ToSchemaMapOutput() SchemaMapOutput { 412 return o 413 } 414 415 func (o SchemaMapOutput) ToSchemaMapOutputWithContext(ctx context.Context) SchemaMapOutput { 416 return o 417 } 418 419 func (o SchemaMapOutput) MapIndex(k pulumi.StringInput) SchemaOutput { 420 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Schema { 421 return vs[0].(map[string]*Schema)[vs[1].(string)] 422 }).(SchemaOutput) 423 } 424 425 func init() { 426 pulumi.RegisterInputType(reflect.TypeOf((*SchemaInput)(nil)).Elem(), &Schema{}) 427 pulumi.RegisterInputType(reflect.TypeOf((*SchemaArrayInput)(nil)).Elem(), SchemaArray{}) 428 pulumi.RegisterInputType(reflect.TypeOf((*SchemaMapInput)(nil)).Elem(), SchemaMap{}) 429 pulumi.RegisterOutputType(SchemaOutput{}) 430 pulumi.RegisterOutputType(SchemaArrayOutput{}) 431 pulumi.RegisterOutputType(SchemaMapOutput{}) 432 }