github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/glue/userDefinedFunction.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 User Defined Function 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 // example, err := glue.NewCatalogDatabase(ctx, "example", &glue.CatalogDatabaseArgs{ 33 // Name: pulumi.String("my_database"), 34 // }) 35 // if err != nil { 36 // return err 37 // } 38 // _, err = glue.NewUserDefinedFunction(ctx, "example", &glue.UserDefinedFunctionArgs{ 39 // Name: pulumi.String("my_func"), 40 // CatalogId: example.CatalogId, 41 // DatabaseName: example.Name, 42 // ClassName: pulumi.String("class"), 43 // OwnerName: pulumi.String("owner"), 44 // OwnerType: pulumi.String("GROUP"), 45 // ResourceUris: glue.UserDefinedFunctionResourceUriArray{ 46 // &glue.UserDefinedFunctionResourceUriArgs{ 47 // ResourceType: pulumi.String("ARCHIVE"), 48 // Uri: pulumi.String("uri"), 49 // }, 50 // }, 51 // }) 52 // if err != nil { 53 // return err 54 // } 55 // return nil 56 // }) 57 // } 58 // 59 // ``` 60 // <!--End PulumiCodeChooser --> 61 // 62 // ## Import 63 // 64 // Using `pulumi import`, import Glue User Defined Functions using the `catalog_id:database_name:function_name`. If you have not set a Catalog ID specify the AWS Account ID that the database is in. For example: 65 // 66 // ```sh 67 // $ pulumi import aws:glue/userDefinedFunction:UserDefinedFunction func 123456789012:my_database:my_func 68 // ``` 69 type UserDefinedFunction struct { 70 pulumi.CustomResourceState 71 72 // The ARN of the Glue User Defined Function. 73 Arn pulumi.StringOutput `pulumi:"arn"` 74 // ID of the Glue Catalog to create the function in. If omitted, this defaults to the AWS Account ID. 75 CatalogId pulumi.StringPtrOutput `pulumi:"catalogId"` 76 // The Java class that contains the function code. 77 ClassName pulumi.StringOutput `pulumi:"className"` 78 // The time at which the function was created. 79 CreateTime pulumi.StringOutput `pulumi:"createTime"` 80 // The name of the Database to create the Function. 81 DatabaseName pulumi.StringOutput `pulumi:"databaseName"` 82 // The name of the function. 83 Name pulumi.StringOutput `pulumi:"name"` 84 // The owner of the function. 85 OwnerName pulumi.StringOutput `pulumi:"ownerName"` 86 // The owner type. can be one of `USER`, `ROLE`, and `GROUP`. 87 OwnerType pulumi.StringOutput `pulumi:"ownerType"` 88 // The configuration block for Resource URIs. See resource uris below for more details. 89 ResourceUris UserDefinedFunctionResourceUriArrayOutput `pulumi:"resourceUris"` 90 } 91 92 // NewUserDefinedFunction registers a new resource with the given unique name, arguments, and options. 93 func NewUserDefinedFunction(ctx *pulumi.Context, 94 name string, args *UserDefinedFunctionArgs, opts ...pulumi.ResourceOption) (*UserDefinedFunction, error) { 95 if args == nil { 96 return nil, errors.New("missing one or more required arguments") 97 } 98 99 if args.ClassName == nil { 100 return nil, errors.New("invalid value for required argument 'ClassName'") 101 } 102 if args.DatabaseName == nil { 103 return nil, errors.New("invalid value for required argument 'DatabaseName'") 104 } 105 if args.OwnerName == nil { 106 return nil, errors.New("invalid value for required argument 'OwnerName'") 107 } 108 if args.OwnerType == nil { 109 return nil, errors.New("invalid value for required argument 'OwnerType'") 110 } 111 opts = internal.PkgResourceDefaultOpts(opts) 112 var resource UserDefinedFunction 113 err := ctx.RegisterResource("aws:glue/userDefinedFunction:UserDefinedFunction", name, args, &resource, opts...) 114 if err != nil { 115 return nil, err 116 } 117 return &resource, nil 118 } 119 120 // GetUserDefinedFunction gets an existing UserDefinedFunction resource's state with the given name, ID, and optional 121 // state properties that are used to uniquely qualify the lookup (nil if not required). 122 func GetUserDefinedFunction(ctx *pulumi.Context, 123 name string, id pulumi.IDInput, state *UserDefinedFunctionState, opts ...pulumi.ResourceOption) (*UserDefinedFunction, error) { 124 var resource UserDefinedFunction 125 err := ctx.ReadResource("aws:glue/userDefinedFunction:UserDefinedFunction", name, id, state, &resource, opts...) 126 if err != nil { 127 return nil, err 128 } 129 return &resource, nil 130 } 131 132 // Input properties used for looking up and filtering UserDefinedFunction resources. 133 type userDefinedFunctionState struct { 134 // The ARN of the Glue User Defined Function. 135 Arn *string `pulumi:"arn"` 136 // ID of the Glue Catalog to create the function in. If omitted, this defaults to the AWS Account ID. 137 CatalogId *string `pulumi:"catalogId"` 138 // The Java class that contains the function code. 139 ClassName *string `pulumi:"className"` 140 // The time at which the function was created. 141 CreateTime *string `pulumi:"createTime"` 142 // The name of the Database to create the Function. 143 DatabaseName *string `pulumi:"databaseName"` 144 // The name of the function. 145 Name *string `pulumi:"name"` 146 // The owner of the function. 147 OwnerName *string `pulumi:"ownerName"` 148 // The owner type. can be one of `USER`, `ROLE`, and `GROUP`. 149 OwnerType *string `pulumi:"ownerType"` 150 // The configuration block for Resource URIs. See resource uris below for more details. 151 ResourceUris []UserDefinedFunctionResourceUri `pulumi:"resourceUris"` 152 } 153 154 type UserDefinedFunctionState struct { 155 // The ARN of the Glue User Defined Function. 156 Arn pulumi.StringPtrInput 157 // ID of the Glue Catalog to create the function in. If omitted, this defaults to the AWS Account ID. 158 CatalogId pulumi.StringPtrInput 159 // The Java class that contains the function code. 160 ClassName pulumi.StringPtrInput 161 // The time at which the function was created. 162 CreateTime pulumi.StringPtrInput 163 // The name of the Database to create the Function. 164 DatabaseName pulumi.StringPtrInput 165 // The name of the function. 166 Name pulumi.StringPtrInput 167 // The owner of the function. 168 OwnerName pulumi.StringPtrInput 169 // The owner type. can be one of `USER`, `ROLE`, and `GROUP`. 170 OwnerType pulumi.StringPtrInput 171 // The configuration block for Resource URIs. See resource uris below for more details. 172 ResourceUris UserDefinedFunctionResourceUriArrayInput 173 } 174 175 func (UserDefinedFunctionState) ElementType() reflect.Type { 176 return reflect.TypeOf((*userDefinedFunctionState)(nil)).Elem() 177 } 178 179 type userDefinedFunctionArgs struct { 180 // ID of the Glue Catalog to create the function in. If omitted, this defaults to the AWS Account ID. 181 CatalogId *string `pulumi:"catalogId"` 182 // The Java class that contains the function code. 183 ClassName string `pulumi:"className"` 184 // The name of the Database to create the Function. 185 DatabaseName string `pulumi:"databaseName"` 186 // The name of the function. 187 Name *string `pulumi:"name"` 188 // The owner of the function. 189 OwnerName string `pulumi:"ownerName"` 190 // The owner type. can be one of `USER`, `ROLE`, and `GROUP`. 191 OwnerType string `pulumi:"ownerType"` 192 // The configuration block for Resource URIs. See resource uris below for more details. 193 ResourceUris []UserDefinedFunctionResourceUri `pulumi:"resourceUris"` 194 } 195 196 // The set of arguments for constructing a UserDefinedFunction resource. 197 type UserDefinedFunctionArgs struct { 198 // ID of the Glue Catalog to create the function in. If omitted, this defaults to the AWS Account ID. 199 CatalogId pulumi.StringPtrInput 200 // The Java class that contains the function code. 201 ClassName pulumi.StringInput 202 // The name of the Database to create the Function. 203 DatabaseName pulumi.StringInput 204 // The name of the function. 205 Name pulumi.StringPtrInput 206 // The owner of the function. 207 OwnerName pulumi.StringInput 208 // The owner type. can be one of `USER`, `ROLE`, and `GROUP`. 209 OwnerType pulumi.StringInput 210 // The configuration block for Resource URIs. See resource uris below for more details. 211 ResourceUris UserDefinedFunctionResourceUriArrayInput 212 } 213 214 func (UserDefinedFunctionArgs) ElementType() reflect.Type { 215 return reflect.TypeOf((*userDefinedFunctionArgs)(nil)).Elem() 216 } 217 218 type UserDefinedFunctionInput interface { 219 pulumi.Input 220 221 ToUserDefinedFunctionOutput() UserDefinedFunctionOutput 222 ToUserDefinedFunctionOutputWithContext(ctx context.Context) UserDefinedFunctionOutput 223 } 224 225 func (*UserDefinedFunction) ElementType() reflect.Type { 226 return reflect.TypeOf((**UserDefinedFunction)(nil)).Elem() 227 } 228 229 func (i *UserDefinedFunction) ToUserDefinedFunctionOutput() UserDefinedFunctionOutput { 230 return i.ToUserDefinedFunctionOutputWithContext(context.Background()) 231 } 232 233 func (i *UserDefinedFunction) ToUserDefinedFunctionOutputWithContext(ctx context.Context) UserDefinedFunctionOutput { 234 return pulumi.ToOutputWithContext(ctx, i).(UserDefinedFunctionOutput) 235 } 236 237 // UserDefinedFunctionArrayInput is an input type that accepts UserDefinedFunctionArray and UserDefinedFunctionArrayOutput values. 238 // You can construct a concrete instance of `UserDefinedFunctionArrayInput` via: 239 // 240 // UserDefinedFunctionArray{ UserDefinedFunctionArgs{...} } 241 type UserDefinedFunctionArrayInput interface { 242 pulumi.Input 243 244 ToUserDefinedFunctionArrayOutput() UserDefinedFunctionArrayOutput 245 ToUserDefinedFunctionArrayOutputWithContext(context.Context) UserDefinedFunctionArrayOutput 246 } 247 248 type UserDefinedFunctionArray []UserDefinedFunctionInput 249 250 func (UserDefinedFunctionArray) ElementType() reflect.Type { 251 return reflect.TypeOf((*[]*UserDefinedFunction)(nil)).Elem() 252 } 253 254 func (i UserDefinedFunctionArray) ToUserDefinedFunctionArrayOutput() UserDefinedFunctionArrayOutput { 255 return i.ToUserDefinedFunctionArrayOutputWithContext(context.Background()) 256 } 257 258 func (i UserDefinedFunctionArray) ToUserDefinedFunctionArrayOutputWithContext(ctx context.Context) UserDefinedFunctionArrayOutput { 259 return pulumi.ToOutputWithContext(ctx, i).(UserDefinedFunctionArrayOutput) 260 } 261 262 // UserDefinedFunctionMapInput is an input type that accepts UserDefinedFunctionMap and UserDefinedFunctionMapOutput values. 263 // You can construct a concrete instance of `UserDefinedFunctionMapInput` via: 264 // 265 // UserDefinedFunctionMap{ "key": UserDefinedFunctionArgs{...} } 266 type UserDefinedFunctionMapInput interface { 267 pulumi.Input 268 269 ToUserDefinedFunctionMapOutput() UserDefinedFunctionMapOutput 270 ToUserDefinedFunctionMapOutputWithContext(context.Context) UserDefinedFunctionMapOutput 271 } 272 273 type UserDefinedFunctionMap map[string]UserDefinedFunctionInput 274 275 func (UserDefinedFunctionMap) ElementType() reflect.Type { 276 return reflect.TypeOf((*map[string]*UserDefinedFunction)(nil)).Elem() 277 } 278 279 func (i UserDefinedFunctionMap) ToUserDefinedFunctionMapOutput() UserDefinedFunctionMapOutput { 280 return i.ToUserDefinedFunctionMapOutputWithContext(context.Background()) 281 } 282 283 func (i UserDefinedFunctionMap) ToUserDefinedFunctionMapOutputWithContext(ctx context.Context) UserDefinedFunctionMapOutput { 284 return pulumi.ToOutputWithContext(ctx, i).(UserDefinedFunctionMapOutput) 285 } 286 287 type UserDefinedFunctionOutput struct{ *pulumi.OutputState } 288 289 func (UserDefinedFunctionOutput) ElementType() reflect.Type { 290 return reflect.TypeOf((**UserDefinedFunction)(nil)).Elem() 291 } 292 293 func (o UserDefinedFunctionOutput) ToUserDefinedFunctionOutput() UserDefinedFunctionOutput { 294 return o 295 } 296 297 func (o UserDefinedFunctionOutput) ToUserDefinedFunctionOutputWithContext(ctx context.Context) UserDefinedFunctionOutput { 298 return o 299 } 300 301 // The ARN of the Glue User Defined Function. 302 func (o UserDefinedFunctionOutput) Arn() pulumi.StringOutput { 303 return o.ApplyT(func(v *UserDefinedFunction) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 304 } 305 306 // ID of the Glue Catalog to create the function in. If omitted, this defaults to the AWS Account ID. 307 func (o UserDefinedFunctionOutput) CatalogId() pulumi.StringPtrOutput { 308 return o.ApplyT(func(v *UserDefinedFunction) pulumi.StringPtrOutput { return v.CatalogId }).(pulumi.StringPtrOutput) 309 } 310 311 // The Java class that contains the function code. 312 func (o UserDefinedFunctionOutput) ClassName() pulumi.StringOutput { 313 return o.ApplyT(func(v *UserDefinedFunction) pulumi.StringOutput { return v.ClassName }).(pulumi.StringOutput) 314 } 315 316 // The time at which the function was created. 317 func (o UserDefinedFunctionOutput) CreateTime() pulumi.StringOutput { 318 return o.ApplyT(func(v *UserDefinedFunction) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput) 319 } 320 321 // The name of the Database to create the Function. 322 func (o UserDefinedFunctionOutput) DatabaseName() pulumi.StringOutput { 323 return o.ApplyT(func(v *UserDefinedFunction) pulumi.StringOutput { return v.DatabaseName }).(pulumi.StringOutput) 324 } 325 326 // The name of the function. 327 func (o UserDefinedFunctionOutput) Name() pulumi.StringOutput { 328 return o.ApplyT(func(v *UserDefinedFunction) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 329 } 330 331 // The owner of the function. 332 func (o UserDefinedFunctionOutput) OwnerName() pulumi.StringOutput { 333 return o.ApplyT(func(v *UserDefinedFunction) pulumi.StringOutput { return v.OwnerName }).(pulumi.StringOutput) 334 } 335 336 // The owner type. can be one of `USER`, `ROLE`, and `GROUP`. 337 func (o UserDefinedFunctionOutput) OwnerType() pulumi.StringOutput { 338 return o.ApplyT(func(v *UserDefinedFunction) pulumi.StringOutput { return v.OwnerType }).(pulumi.StringOutput) 339 } 340 341 // The configuration block for Resource URIs. See resource uris below for more details. 342 func (o UserDefinedFunctionOutput) ResourceUris() UserDefinedFunctionResourceUriArrayOutput { 343 return o.ApplyT(func(v *UserDefinedFunction) UserDefinedFunctionResourceUriArrayOutput { return v.ResourceUris }).(UserDefinedFunctionResourceUriArrayOutput) 344 } 345 346 type UserDefinedFunctionArrayOutput struct{ *pulumi.OutputState } 347 348 func (UserDefinedFunctionArrayOutput) ElementType() reflect.Type { 349 return reflect.TypeOf((*[]*UserDefinedFunction)(nil)).Elem() 350 } 351 352 func (o UserDefinedFunctionArrayOutput) ToUserDefinedFunctionArrayOutput() UserDefinedFunctionArrayOutput { 353 return o 354 } 355 356 func (o UserDefinedFunctionArrayOutput) ToUserDefinedFunctionArrayOutputWithContext(ctx context.Context) UserDefinedFunctionArrayOutput { 357 return o 358 } 359 360 func (o UserDefinedFunctionArrayOutput) Index(i pulumi.IntInput) UserDefinedFunctionOutput { 361 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *UserDefinedFunction { 362 return vs[0].([]*UserDefinedFunction)[vs[1].(int)] 363 }).(UserDefinedFunctionOutput) 364 } 365 366 type UserDefinedFunctionMapOutput struct{ *pulumi.OutputState } 367 368 func (UserDefinedFunctionMapOutput) ElementType() reflect.Type { 369 return reflect.TypeOf((*map[string]*UserDefinedFunction)(nil)).Elem() 370 } 371 372 func (o UserDefinedFunctionMapOutput) ToUserDefinedFunctionMapOutput() UserDefinedFunctionMapOutput { 373 return o 374 } 375 376 func (o UserDefinedFunctionMapOutput) ToUserDefinedFunctionMapOutputWithContext(ctx context.Context) UserDefinedFunctionMapOutput { 377 return o 378 } 379 380 func (o UserDefinedFunctionMapOutput) MapIndex(k pulumi.StringInput) UserDefinedFunctionOutput { 381 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *UserDefinedFunction { 382 return vs[0].(map[string]*UserDefinedFunction)[vs[1].(string)] 383 }).(UserDefinedFunctionOutput) 384 } 385 386 func init() { 387 pulumi.RegisterInputType(reflect.TypeOf((*UserDefinedFunctionInput)(nil)).Elem(), &UserDefinedFunction{}) 388 pulumi.RegisterInputType(reflect.TypeOf((*UserDefinedFunctionArrayInput)(nil)).Elem(), UserDefinedFunctionArray{}) 389 pulumi.RegisterInputType(reflect.TypeOf((*UserDefinedFunctionMapInput)(nil)).Elem(), UserDefinedFunctionMap{}) 390 pulumi.RegisterOutputType(UserDefinedFunctionOutput{}) 391 pulumi.RegisterOutputType(UserDefinedFunctionArrayOutput{}) 392 pulumi.RegisterOutputType(UserDefinedFunctionMapOutput{}) 393 }