github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/glue/connection.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 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 11 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 12 ) 13 14 // Provides a Glue Connection resource. 15 // 16 // ## Example Usage 17 // 18 // ### Non-VPC Connection 19 // 20 // <!--Start PulumiCodeChooser --> 21 // ```go 22 // package main 23 // 24 // import ( 25 // 26 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/glue" 27 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 28 // 29 // ) 30 // 31 // func main() { 32 // pulumi.Run(func(ctx *pulumi.Context) error { 33 // _, err := glue.NewConnection(ctx, "example", &glue.ConnectionArgs{ 34 // ConnectionProperties: pulumi.StringMap{ 35 // "JDBC_CONNECTION_URL": pulumi.String("jdbc:mysql://example.com/exampledatabase"), 36 // "PASSWORD": pulumi.String("examplepassword"), 37 // "USERNAME": pulumi.String("exampleusername"), 38 // }, 39 // Name: pulumi.String("example"), 40 // }) 41 // if err != nil { 42 // return err 43 // } 44 // return nil 45 // }) 46 // } 47 // 48 // ``` 49 // <!--End PulumiCodeChooser --> 50 // 51 // ### VPC Connection 52 // 53 // For more information, see the [AWS Documentation](https://docs.aws.amazon.com/glue/latest/dg/populate-add-connection.html#connection-JDBC-VPC). 54 // 55 // <!--Start PulumiCodeChooser --> 56 // ```go 57 // package main 58 // 59 // import ( 60 // 61 // "fmt" 62 // 63 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/glue" 64 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 65 // 66 // ) 67 // 68 // func main() { 69 // pulumi.Run(func(ctx *pulumi.Context) error { 70 // _, err := glue.NewConnection(ctx, "example", &glue.ConnectionArgs{ 71 // ConnectionProperties: pulumi.StringMap{ 72 // "JDBC_CONNECTION_URL": pulumi.String(fmt.Sprintf("jdbc:mysql://%v/exampledatabase", exampleAwsRdsCluster.Endpoint)), 73 // "PASSWORD": pulumi.String("examplepassword"), 74 // "USERNAME": pulumi.String("exampleusername"), 75 // }, 76 // Name: pulumi.String("example"), 77 // PhysicalConnectionRequirements: &glue.ConnectionPhysicalConnectionRequirementsArgs{ 78 // AvailabilityZone: pulumi.Any(exampleAwsSubnet.AvailabilityZone), 79 // SecurityGroupIdLists: pulumi.StringArray{ 80 // exampleAwsSecurityGroup.Id, 81 // }, 82 // SubnetId: pulumi.Any(exampleAwsSubnet.Id), 83 // }, 84 // }) 85 // if err != nil { 86 // return err 87 // } 88 // return nil 89 // }) 90 // } 91 // 92 // ``` 93 // <!--End PulumiCodeChooser --> 94 // 95 // ## Import 96 // 97 // Using `pulumi import`, import Glue Connections using the `CATALOG-ID` (AWS account ID if not custom) and `NAME`. For example: 98 // 99 // ```sh 100 // $ pulumi import aws:glue/connection:Connection MyConnection 123456789012:MyConnection 101 // ``` 102 type Connection struct { 103 pulumi.CustomResourceState 104 105 // The ARN of the Glue Connection. 106 Arn pulumi.StringOutput `pulumi:"arn"` 107 // The ID of the Data Catalog in which to create the connection. If none is supplied, the AWS account ID is used by default. 108 CatalogId pulumi.StringOutput `pulumi:"catalogId"` 109 // A map of key-value pairs used as parameters for this connection. 110 ConnectionProperties pulumi.StringMapOutput `pulumi:"connectionProperties"` 111 // The type of the connection. Supported are: `CUSTOM`, `JDBC`, `KAFKA`, `MARKETPLACE`, `MONGODB`, and `NETWORK`. Defaults to `JDBC`. 112 ConnectionType pulumi.StringPtrOutput `pulumi:"connectionType"` 113 // Description of the connection. 114 Description pulumi.StringPtrOutput `pulumi:"description"` 115 // A list of criteria that can be used in selecting this connection. 116 MatchCriterias pulumi.StringArrayOutput `pulumi:"matchCriterias"` 117 // The name of the connection. 118 Name pulumi.StringOutput `pulumi:"name"` 119 // A map of physical connection requirements, such as VPC and SecurityGroup. Defined below. 120 PhysicalConnectionRequirements ConnectionPhysicalConnectionRequirementsPtrOutput `pulumi:"physicalConnectionRequirements"` 121 // 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. 122 Tags pulumi.StringMapOutput `pulumi:"tags"` 123 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 124 // 125 // Deprecated: Please use `tags` instead. 126 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 127 } 128 129 // NewConnection registers a new resource with the given unique name, arguments, and options. 130 func NewConnection(ctx *pulumi.Context, 131 name string, args *ConnectionArgs, opts ...pulumi.ResourceOption) (*Connection, error) { 132 if args == nil { 133 args = &ConnectionArgs{} 134 } 135 136 if args.ConnectionProperties != nil { 137 args.ConnectionProperties = pulumi.ToSecret(args.ConnectionProperties).(pulumi.StringMapInput) 138 } 139 secrets := pulumi.AdditionalSecretOutputs([]string{ 140 "connectionProperties", 141 }) 142 opts = append(opts, secrets) 143 opts = internal.PkgResourceDefaultOpts(opts) 144 var resource Connection 145 err := ctx.RegisterResource("aws:glue/connection:Connection", name, args, &resource, opts...) 146 if err != nil { 147 return nil, err 148 } 149 return &resource, nil 150 } 151 152 // GetConnection gets an existing Connection resource's state with the given name, ID, and optional 153 // state properties that are used to uniquely qualify the lookup (nil if not required). 154 func GetConnection(ctx *pulumi.Context, 155 name string, id pulumi.IDInput, state *ConnectionState, opts ...pulumi.ResourceOption) (*Connection, error) { 156 var resource Connection 157 err := ctx.ReadResource("aws:glue/connection:Connection", name, id, state, &resource, opts...) 158 if err != nil { 159 return nil, err 160 } 161 return &resource, nil 162 } 163 164 // Input properties used for looking up and filtering Connection resources. 165 type connectionState struct { 166 // The ARN of the Glue Connection. 167 Arn *string `pulumi:"arn"` 168 // The ID of the Data Catalog in which to create the connection. If none is supplied, the AWS account ID is used by default. 169 CatalogId *string `pulumi:"catalogId"` 170 // A map of key-value pairs used as parameters for this connection. 171 ConnectionProperties map[string]string `pulumi:"connectionProperties"` 172 // The type of the connection. Supported are: `CUSTOM`, `JDBC`, `KAFKA`, `MARKETPLACE`, `MONGODB`, and `NETWORK`. Defaults to `JDBC`. 173 ConnectionType *string `pulumi:"connectionType"` 174 // Description of the connection. 175 Description *string `pulumi:"description"` 176 // A list of criteria that can be used in selecting this connection. 177 MatchCriterias []string `pulumi:"matchCriterias"` 178 // The name of the connection. 179 Name *string `pulumi:"name"` 180 // A map of physical connection requirements, such as VPC and SecurityGroup. Defined below. 181 PhysicalConnectionRequirements *ConnectionPhysicalConnectionRequirements `pulumi:"physicalConnectionRequirements"` 182 // 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. 183 Tags map[string]string `pulumi:"tags"` 184 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 185 // 186 // Deprecated: Please use `tags` instead. 187 TagsAll map[string]string `pulumi:"tagsAll"` 188 } 189 190 type ConnectionState struct { 191 // The ARN of the Glue Connection. 192 Arn pulumi.StringPtrInput 193 // The ID of the Data Catalog in which to create the connection. If none is supplied, the AWS account ID is used by default. 194 CatalogId pulumi.StringPtrInput 195 // A map of key-value pairs used as parameters for this connection. 196 ConnectionProperties pulumi.StringMapInput 197 // The type of the connection. Supported are: `CUSTOM`, `JDBC`, `KAFKA`, `MARKETPLACE`, `MONGODB`, and `NETWORK`. Defaults to `JDBC`. 198 ConnectionType pulumi.StringPtrInput 199 // Description of the connection. 200 Description pulumi.StringPtrInput 201 // A list of criteria that can be used in selecting this connection. 202 MatchCriterias pulumi.StringArrayInput 203 // The name of the connection. 204 Name pulumi.StringPtrInput 205 // A map of physical connection requirements, such as VPC and SecurityGroup. Defined below. 206 PhysicalConnectionRequirements ConnectionPhysicalConnectionRequirementsPtrInput 207 // 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. 208 Tags pulumi.StringMapInput 209 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 210 // 211 // Deprecated: Please use `tags` instead. 212 TagsAll pulumi.StringMapInput 213 } 214 215 func (ConnectionState) ElementType() reflect.Type { 216 return reflect.TypeOf((*connectionState)(nil)).Elem() 217 } 218 219 type connectionArgs struct { 220 // The ID of the Data Catalog in which to create the connection. If none is supplied, the AWS account ID is used by default. 221 CatalogId *string `pulumi:"catalogId"` 222 // A map of key-value pairs used as parameters for this connection. 223 ConnectionProperties map[string]string `pulumi:"connectionProperties"` 224 // The type of the connection. Supported are: `CUSTOM`, `JDBC`, `KAFKA`, `MARKETPLACE`, `MONGODB`, and `NETWORK`. Defaults to `JDBC`. 225 ConnectionType *string `pulumi:"connectionType"` 226 // Description of the connection. 227 Description *string `pulumi:"description"` 228 // A list of criteria that can be used in selecting this connection. 229 MatchCriterias []string `pulumi:"matchCriterias"` 230 // The name of the connection. 231 Name *string `pulumi:"name"` 232 // A map of physical connection requirements, such as VPC and SecurityGroup. Defined below. 233 PhysicalConnectionRequirements *ConnectionPhysicalConnectionRequirements `pulumi:"physicalConnectionRequirements"` 234 // 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. 235 Tags map[string]string `pulumi:"tags"` 236 } 237 238 // The set of arguments for constructing a Connection resource. 239 type ConnectionArgs struct { 240 // The ID of the Data Catalog in which to create the connection. If none is supplied, the AWS account ID is used by default. 241 CatalogId pulumi.StringPtrInput 242 // A map of key-value pairs used as parameters for this connection. 243 ConnectionProperties pulumi.StringMapInput 244 // The type of the connection. Supported are: `CUSTOM`, `JDBC`, `KAFKA`, `MARKETPLACE`, `MONGODB`, and `NETWORK`. Defaults to `JDBC`. 245 ConnectionType pulumi.StringPtrInput 246 // Description of the connection. 247 Description pulumi.StringPtrInput 248 // A list of criteria that can be used in selecting this connection. 249 MatchCriterias pulumi.StringArrayInput 250 // The name of the connection. 251 Name pulumi.StringPtrInput 252 // A map of physical connection requirements, such as VPC and SecurityGroup. Defined below. 253 PhysicalConnectionRequirements ConnectionPhysicalConnectionRequirementsPtrInput 254 // 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. 255 Tags pulumi.StringMapInput 256 } 257 258 func (ConnectionArgs) ElementType() reflect.Type { 259 return reflect.TypeOf((*connectionArgs)(nil)).Elem() 260 } 261 262 type ConnectionInput interface { 263 pulumi.Input 264 265 ToConnectionOutput() ConnectionOutput 266 ToConnectionOutputWithContext(ctx context.Context) ConnectionOutput 267 } 268 269 func (*Connection) ElementType() reflect.Type { 270 return reflect.TypeOf((**Connection)(nil)).Elem() 271 } 272 273 func (i *Connection) ToConnectionOutput() ConnectionOutput { 274 return i.ToConnectionOutputWithContext(context.Background()) 275 } 276 277 func (i *Connection) ToConnectionOutputWithContext(ctx context.Context) ConnectionOutput { 278 return pulumi.ToOutputWithContext(ctx, i).(ConnectionOutput) 279 } 280 281 // ConnectionArrayInput is an input type that accepts ConnectionArray and ConnectionArrayOutput values. 282 // You can construct a concrete instance of `ConnectionArrayInput` via: 283 // 284 // ConnectionArray{ ConnectionArgs{...} } 285 type ConnectionArrayInput interface { 286 pulumi.Input 287 288 ToConnectionArrayOutput() ConnectionArrayOutput 289 ToConnectionArrayOutputWithContext(context.Context) ConnectionArrayOutput 290 } 291 292 type ConnectionArray []ConnectionInput 293 294 func (ConnectionArray) ElementType() reflect.Type { 295 return reflect.TypeOf((*[]*Connection)(nil)).Elem() 296 } 297 298 func (i ConnectionArray) ToConnectionArrayOutput() ConnectionArrayOutput { 299 return i.ToConnectionArrayOutputWithContext(context.Background()) 300 } 301 302 func (i ConnectionArray) ToConnectionArrayOutputWithContext(ctx context.Context) ConnectionArrayOutput { 303 return pulumi.ToOutputWithContext(ctx, i).(ConnectionArrayOutput) 304 } 305 306 // ConnectionMapInput is an input type that accepts ConnectionMap and ConnectionMapOutput values. 307 // You can construct a concrete instance of `ConnectionMapInput` via: 308 // 309 // ConnectionMap{ "key": ConnectionArgs{...} } 310 type ConnectionMapInput interface { 311 pulumi.Input 312 313 ToConnectionMapOutput() ConnectionMapOutput 314 ToConnectionMapOutputWithContext(context.Context) ConnectionMapOutput 315 } 316 317 type ConnectionMap map[string]ConnectionInput 318 319 func (ConnectionMap) ElementType() reflect.Type { 320 return reflect.TypeOf((*map[string]*Connection)(nil)).Elem() 321 } 322 323 func (i ConnectionMap) ToConnectionMapOutput() ConnectionMapOutput { 324 return i.ToConnectionMapOutputWithContext(context.Background()) 325 } 326 327 func (i ConnectionMap) ToConnectionMapOutputWithContext(ctx context.Context) ConnectionMapOutput { 328 return pulumi.ToOutputWithContext(ctx, i).(ConnectionMapOutput) 329 } 330 331 type ConnectionOutput struct{ *pulumi.OutputState } 332 333 func (ConnectionOutput) ElementType() reflect.Type { 334 return reflect.TypeOf((**Connection)(nil)).Elem() 335 } 336 337 func (o ConnectionOutput) ToConnectionOutput() ConnectionOutput { 338 return o 339 } 340 341 func (o ConnectionOutput) ToConnectionOutputWithContext(ctx context.Context) ConnectionOutput { 342 return o 343 } 344 345 // The ARN of the Glue Connection. 346 func (o ConnectionOutput) Arn() pulumi.StringOutput { 347 return o.ApplyT(func(v *Connection) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 348 } 349 350 // The ID of the Data Catalog in which to create the connection. If none is supplied, the AWS account ID is used by default. 351 func (o ConnectionOutput) CatalogId() pulumi.StringOutput { 352 return o.ApplyT(func(v *Connection) pulumi.StringOutput { return v.CatalogId }).(pulumi.StringOutput) 353 } 354 355 // A map of key-value pairs used as parameters for this connection. 356 func (o ConnectionOutput) ConnectionProperties() pulumi.StringMapOutput { 357 return o.ApplyT(func(v *Connection) pulumi.StringMapOutput { return v.ConnectionProperties }).(pulumi.StringMapOutput) 358 } 359 360 // The type of the connection. Supported are: `CUSTOM`, `JDBC`, `KAFKA`, `MARKETPLACE`, `MONGODB`, and `NETWORK`. Defaults to `JDBC`. 361 func (o ConnectionOutput) ConnectionType() pulumi.StringPtrOutput { 362 return o.ApplyT(func(v *Connection) pulumi.StringPtrOutput { return v.ConnectionType }).(pulumi.StringPtrOutput) 363 } 364 365 // Description of the connection. 366 func (o ConnectionOutput) Description() pulumi.StringPtrOutput { 367 return o.ApplyT(func(v *Connection) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput) 368 } 369 370 // A list of criteria that can be used in selecting this connection. 371 func (o ConnectionOutput) MatchCriterias() pulumi.StringArrayOutput { 372 return o.ApplyT(func(v *Connection) pulumi.StringArrayOutput { return v.MatchCriterias }).(pulumi.StringArrayOutput) 373 } 374 375 // The name of the connection. 376 func (o ConnectionOutput) Name() pulumi.StringOutput { 377 return o.ApplyT(func(v *Connection) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 378 } 379 380 // A map of physical connection requirements, such as VPC and SecurityGroup. Defined below. 381 func (o ConnectionOutput) PhysicalConnectionRequirements() ConnectionPhysicalConnectionRequirementsPtrOutput { 382 return o.ApplyT(func(v *Connection) ConnectionPhysicalConnectionRequirementsPtrOutput { 383 return v.PhysicalConnectionRequirements 384 }).(ConnectionPhysicalConnectionRequirementsPtrOutput) 385 } 386 387 // 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. 388 func (o ConnectionOutput) Tags() pulumi.StringMapOutput { 389 return o.ApplyT(func(v *Connection) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 390 } 391 392 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 393 // 394 // Deprecated: Please use `tags` instead. 395 func (o ConnectionOutput) TagsAll() pulumi.StringMapOutput { 396 return o.ApplyT(func(v *Connection) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 397 } 398 399 type ConnectionArrayOutput struct{ *pulumi.OutputState } 400 401 func (ConnectionArrayOutput) ElementType() reflect.Type { 402 return reflect.TypeOf((*[]*Connection)(nil)).Elem() 403 } 404 405 func (o ConnectionArrayOutput) ToConnectionArrayOutput() ConnectionArrayOutput { 406 return o 407 } 408 409 func (o ConnectionArrayOutput) ToConnectionArrayOutputWithContext(ctx context.Context) ConnectionArrayOutput { 410 return o 411 } 412 413 func (o ConnectionArrayOutput) Index(i pulumi.IntInput) ConnectionOutput { 414 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Connection { 415 return vs[0].([]*Connection)[vs[1].(int)] 416 }).(ConnectionOutput) 417 } 418 419 type ConnectionMapOutput struct{ *pulumi.OutputState } 420 421 func (ConnectionMapOutput) ElementType() reflect.Type { 422 return reflect.TypeOf((*map[string]*Connection)(nil)).Elem() 423 } 424 425 func (o ConnectionMapOutput) ToConnectionMapOutput() ConnectionMapOutput { 426 return o 427 } 428 429 func (o ConnectionMapOutput) ToConnectionMapOutputWithContext(ctx context.Context) ConnectionMapOutput { 430 return o 431 } 432 433 func (o ConnectionMapOutput) MapIndex(k pulumi.StringInput) ConnectionOutput { 434 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Connection { 435 return vs[0].(map[string]*Connection)[vs[1].(string)] 436 }).(ConnectionOutput) 437 } 438 439 func init() { 440 pulumi.RegisterInputType(reflect.TypeOf((*ConnectionInput)(nil)).Elem(), &Connection{}) 441 pulumi.RegisterInputType(reflect.TypeOf((*ConnectionArrayInput)(nil)).Elem(), ConnectionArray{}) 442 pulumi.RegisterInputType(reflect.TypeOf((*ConnectionMapInput)(nil)).Elem(), ConnectionMap{}) 443 pulumi.RegisterOutputType(ConnectionOutput{}) 444 pulumi.RegisterOutputType(ConnectionArrayOutput{}) 445 pulumi.RegisterOutputType(ConnectionMapOutput{}) 446 }