github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/rds/proxyTarget.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 rds 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 an RDS DB proxy target 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/rds" 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 := rds.NewProxy(ctx, "example", &rds.ProxyArgs{ 33 // Name: pulumi.String("example"), 34 // DebugLogging: pulumi.Bool(false), 35 // EngineFamily: pulumi.String("MYSQL"), 36 // IdleClientTimeout: pulumi.Int(1800), 37 // RequireTls: pulumi.Bool(true), 38 // RoleArn: pulumi.Any(exampleAwsIamRole.Arn), 39 // VpcSecurityGroupIds: pulumi.StringArray{ 40 // exampleAwsSecurityGroup.Id, 41 // }, 42 // VpcSubnetIds: pulumi.StringArray{ 43 // exampleAwsSubnet.Id, 44 // }, 45 // Auths: rds.ProxyAuthArray{ 46 // &rds.ProxyAuthArgs{ 47 // AuthScheme: pulumi.String("SECRETS"), 48 // Description: pulumi.String("example"), 49 // IamAuth: pulumi.String("DISABLED"), 50 // SecretArn: pulumi.Any(exampleAwsSecretsmanagerSecret.Arn), 51 // }, 52 // }, 53 // Tags: pulumi.StringMap{ 54 // "Name": pulumi.String("example"), 55 // "Key": pulumi.String("value"), 56 // }, 57 // }) 58 // if err != nil { 59 // return err 60 // } 61 // exampleProxyDefaultTargetGroup, err := rds.NewProxyDefaultTargetGroup(ctx, "example", &rds.ProxyDefaultTargetGroupArgs{ 62 // DbProxyName: example.Name, 63 // ConnectionPoolConfig: &rds.ProxyDefaultTargetGroupConnectionPoolConfigArgs{ 64 // ConnectionBorrowTimeout: pulumi.Int(120), 65 // InitQuery: pulumi.String("SET x=1, y=2"), 66 // MaxConnectionsPercent: pulumi.Int(100), 67 // MaxIdleConnectionsPercent: pulumi.Int(50), 68 // SessionPinningFilters: pulumi.StringArray{ 69 // pulumi.String("EXCLUDE_VARIABLE_SETS"), 70 // }, 71 // }, 72 // }) 73 // if err != nil { 74 // return err 75 // } 76 // _, err = rds.NewProxyTarget(ctx, "example", &rds.ProxyTargetArgs{ 77 // DbInstanceIdentifier: pulumi.Any(exampleAwsDbInstance.Identifier), 78 // DbProxyName: example.Name, 79 // TargetGroupName: exampleProxyDefaultTargetGroup.Name, 80 // }) 81 // if err != nil { 82 // return err 83 // } 84 // return nil 85 // }) 86 // } 87 // 88 // ``` 89 // <!--End PulumiCodeChooser --> 90 // 91 // ## Import 92 // 93 // Provisioned Clusters: 94 // 95 // __Using `pulumi import` to import__ RDS DB Proxy Targets using the `db_proxy_name`, `target_group_name`, target type (such as `RDS_INSTANCE` or `TRACKED_CLUSTER`), and resource identifier separated by forward slashes (`/`). For example: 96 // 97 // Instances: 98 // 99 // ```sh 100 // $ pulumi import aws:rds/proxyTarget:ProxyTarget example example-proxy/default/RDS_INSTANCE/example-instance 101 // ``` 102 // Provisioned Clusters: 103 // 104 // ```sh 105 // $ pulumi import aws:rds/proxyTarget:ProxyTarget example example-proxy/default/TRACKED_CLUSTER/example-cluster 106 // ``` 107 type ProxyTarget struct { 108 pulumi.CustomResourceState 109 110 // DB cluster identifier. 111 // 112 // **NOTE:** Either `dbInstanceIdentifier` or `dbClusterIdentifier` should be specified and both should not be specified together 113 DbClusterIdentifier pulumi.StringPtrOutput `pulumi:"dbClusterIdentifier"` 114 // DB instance identifier. 115 DbInstanceIdentifier pulumi.StringPtrOutput `pulumi:"dbInstanceIdentifier"` 116 // The name of the DB proxy. 117 DbProxyName pulumi.StringOutput `pulumi:"dbProxyName"` 118 // Hostname for the target RDS DB Instance. Only returned for `RDS_INSTANCE` type. 119 Endpoint pulumi.StringOutput `pulumi:"endpoint"` 120 // Port for the target RDS DB Instance or Aurora DB Cluster. 121 Port pulumi.IntOutput `pulumi:"port"` 122 // Identifier representing the DB Instance or DB Cluster target. 123 RdsResourceId pulumi.StringOutput `pulumi:"rdsResourceId"` 124 // Amazon Resource Name (ARN) for the DB instance or DB cluster. Currently not returned by the RDS API. 125 TargetArn pulumi.StringOutput `pulumi:"targetArn"` 126 // The name of the target group. 127 TargetGroupName pulumi.StringOutput `pulumi:"targetGroupName"` 128 // DB Cluster identifier for the DB Instance target. Not returned unless manually importing an `RDS_INSTANCE` target that is part of a DB Cluster. 129 TrackedClusterId pulumi.StringOutput `pulumi:"trackedClusterId"` 130 // Type of targetE.g., `RDS_INSTANCE` or `TRACKED_CLUSTER` 131 Type pulumi.StringOutput `pulumi:"type"` 132 } 133 134 // NewProxyTarget registers a new resource with the given unique name, arguments, and options. 135 func NewProxyTarget(ctx *pulumi.Context, 136 name string, args *ProxyTargetArgs, opts ...pulumi.ResourceOption) (*ProxyTarget, error) { 137 if args == nil { 138 return nil, errors.New("missing one or more required arguments") 139 } 140 141 if args.DbProxyName == nil { 142 return nil, errors.New("invalid value for required argument 'DbProxyName'") 143 } 144 if args.TargetGroupName == nil { 145 return nil, errors.New("invalid value for required argument 'TargetGroupName'") 146 } 147 opts = internal.PkgResourceDefaultOpts(opts) 148 var resource ProxyTarget 149 err := ctx.RegisterResource("aws:rds/proxyTarget:ProxyTarget", name, args, &resource, opts...) 150 if err != nil { 151 return nil, err 152 } 153 return &resource, nil 154 } 155 156 // GetProxyTarget gets an existing ProxyTarget resource's state with the given name, ID, and optional 157 // state properties that are used to uniquely qualify the lookup (nil if not required). 158 func GetProxyTarget(ctx *pulumi.Context, 159 name string, id pulumi.IDInput, state *ProxyTargetState, opts ...pulumi.ResourceOption) (*ProxyTarget, error) { 160 var resource ProxyTarget 161 err := ctx.ReadResource("aws:rds/proxyTarget:ProxyTarget", name, id, state, &resource, opts...) 162 if err != nil { 163 return nil, err 164 } 165 return &resource, nil 166 } 167 168 // Input properties used for looking up and filtering ProxyTarget resources. 169 type proxyTargetState struct { 170 // DB cluster identifier. 171 // 172 // **NOTE:** Either `dbInstanceIdentifier` or `dbClusterIdentifier` should be specified and both should not be specified together 173 DbClusterIdentifier *string `pulumi:"dbClusterIdentifier"` 174 // DB instance identifier. 175 DbInstanceIdentifier *string `pulumi:"dbInstanceIdentifier"` 176 // The name of the DB proxy. 177 DbProxyName *string `pulumi:"dbProxyName"` 178 // Hostname for the target RDS DB Instance. Only returned for `RDS_INSTANCE` type. 179 Endpoint *string `pulumi:"endpoint"` 180 // Port for the target RDS DB Instance or Aurora DB Cluster. 181 Port *int `pulumi:"port"` 182 // Identifier representing the DB Instance or DB Cluster target. 183 RdsResourceId *string `pulumi:"rdsResourceId"` 184 // Amazon Resource Name (ARN) for the DB instance or DB cluster. Currently not returned by the RDS API. 185 TargetArn *string `pulumi:"targetArn"` 186 // The name of the target group. 187 TargetGroupName *string `pulumi:"targetGroupName"` 188 // DB Cluster identifier for the DB Instance target. Not returned unless manually importing an `RDS_INSTANCE` target that is part of a DB Cluster. 189 TrackedClusterId *string `pulumi:"trackedClusterId"` 190 // Type of targetE.g., `RDS_INSTANCE` or `TRACKED_CLUSTER` 191 Type *string `pulumi:"type"` 192 } 193 194 type ProxyTargetState struct { 195 // DB cluster identifier. 196 // 197 // **NOTE:** Either `dbInstanceIdentifier` or `dbClusterIdentifier` should be specified and both should not be specified together 198 DbClusterIdentifier pulumi.StringPtrInput 199 // DB instance identifier. 200 DbInstanceIdentifier pulumi.StringPtrInput 201 // The name of the DB proxy. 202 DbProxyName pulumi.StringPtrInput 203 // Hostname for the target RDS DB Instance. Only returned for `RDS_INSTANCE` type. 204 Endpoint pulumi.StringPtrInput 205 // Port for the target RDS DB Instance or Aurora DB Cluster. 206 Port pulumi.IntPtrInput 207 // Identifier representing the DB Instance or DB Cluster target. 208 RdsResourceId pulumi.StringPtrInput 209 // Amazon Resource Name (ARN) for the DB instance or DB cluster. Currently not returned by the RDS API. 210 TargetArn pulumi.StringPtrInput 211 // The name of the target group. 212 TargetGroupName pulumi.StringPtrInput 213 // DB Cluster identifier for the DB Instance target. Not returned unless manually importing an `RDS_INSTANCE` target that is part of a DB Cluster. 214 TrackedClusterId pulumi.StringPtrInput 215 // Type of targetE.g., `RDS_INSTANCE` or `TRACKED_CLUSTER` 216 Type pulumi.StringPtrInput 217 } 218 219 func (ProxyTargetState) ElementType() reflect.Type { 220 return reflect.TypeOf((*proxyTargetState)(nil)).Elem() 221 } 222 223 type proxyTargetArgs struct { 224 // DB cluster identifier. 225 // 226 // **NOTE:** Either `dbInstanceIdentifier` or `dbClusterIdentifier` should be specified and both should not be specified together 227 DbClusterIdentifier *string `pulumi:"dbClusterIdentifier"` 228 // DB instance identifier. 229 DbInstanceIdentifier *string `pulumi:"dbInstanceIdentifier"` 230 // The name of the DB proxy. 231 DbProxyName string `pulumi:"dbProxyName"` 232 // The name of the target group. 233 TargetGroupName string `pulumi:"targetGroupName"` 234 } 235 236 // The set of arguments for constructing a ProxyTarget resource. 237 type ProxyTargetArgs struct { 238 // DB cluster identifier. 239 // 240 // **NOTE:** Either `dbInstanceIdentifier` or `dbClusterIdentifier` should be specified and both should not be specified together 241 DbClusterIdentifier pulumi.StringPtrInput 242 // DB instance identifier. 243 DbInstanceIdentifier pulumi.StringPtrInput 244 // The name of the DB proxy. 245 DbProxyName pulumi.StringInput 246 // The name of the target group. 247 TargetGroupName pulumi.StringInput 248 } 249 250 func (ProxyTargetArgs) ElementType() reflect.Type { 251 return reflect.TypeOf((*proxyTargetArgs)(nil)).Elem() 252 } 253 254 type ProxyTargetInput interface { 255 pulumi.Input 256 257 ToProxyTargetOutput() ProxyTargetOutput 258 ToProxyTargetOutputWithContext(ctx context.Context) ProxyTargetOutput 259 } 260 261 func (*ProxyTarget) ElementType() reflect.Type { 262 return reflect.TypeOf((**ProxyTarget)(nil)).Elem() 263 } 264 265 func (i *ProxyTarget) ToProxyTargetOutput() ProxyTargetOutput { 266 return i.ToProxyTargetOutputWithContext(context.Background()) 267 } 268 269 func (i *ProxyTarget) ToProxyTargetOutputWithContext(ctx context.Context) ProxyTargetOutput { 270 return pulumi.ToOutputWithContext(ctx, i).(ProxyTargetOutput) 271 } 272 273 // ProxyTargetArrayInput is an input type that accepts ProxyTargetArray and ProxyTargetArrayOutput values. 274 // You can construct a concrete instance of `ProxyTargetArrayInput` via: 275 // 276 // ProxyTargetArray{ ProxyTargetArgs{...} } 277 type ProxyTargetArrayInput interface { 278 pulumi.Input 279 280 ToProxyTargetArrayOutput() ProxyTargetArrayOutput 281 ToProxyTargetArrayOutputWithContext(context.Context) ProxyTargetArrayOutput 282 } 283 284 type ProxyTargetArray []ProxyTargetInput 285 286 func (ProxyTargetArray) ElementType() reflect.Type { 287 return reflect.TypeOf((*[]*ProxyTarget)(nil)).Elem() 288 } 289 290 func (i ProxyTargetArray) ToProxyTargetArrayOutput() ProxyTargetArrayOutput { 291 return i.ToProxyTargetArrayOutputWithContext(context.Background()) 292 } 293 294 func (i ProxyTargetArray) ToProxyTargetArrayOutputWithContext(ctx context.Context) ProxyTargetArrayOutput { 295 return pulumi.ToOutputWithContext(ctx, i).(ProxyTargetArrayOutput) 296 } 297 298 // ProxyTargetMapInput is an input type that accepts ProxyTargetMap and ProxyTargetMapOutput values. 299 // You can construct a concrete instance of `ProxyTargetMapInput` via: 300 // 301 // ProxyTargetMap{ "key": ProxyTargetArgs{...} } 302 type ProxyTargetMapInput interface { 303 pulumi.Input 304 305 ToProxyTargetMapOutput() ProxyTargetMapOutput 306 ToProxyTargetMapOutputWithContext(context.Context) ProxyTargetMapOutput 307 } 308 309 type ProxyTargetMap map[string]ProxyTargetInput 310 311 func (ProxyTargetMap) ElementType() reflect.Type { 312 return reflect.TypeOf((*map[string]*ProxyTarget)(nil)).Elem() 313 } 314 315 func (i ProxyTargetMap) ToProxyTargetMapOutput() ProxyTargetMapOutput { 316 return i.ToProxyTargetMapOutputWithContext(context.Background()) 317 } 318 319 func (i ProxyTargetMap) ToProxyTargetMapOutputWithContext(ctx context.Context) ProxyTargetMapOutput { 320 return pulumi.ToOutputWithContext(ctx, i).(ProxyTargetMapOutput) 321 } 322 323 type ProxyTargetOutput struct{ *pulumi.OutputState } 324 325 func (ProxyTargetOutput) ElementType() reflect.Type { 326 return reflect.TypeOf((**ProxyTarget)(nil)).Elem() 327 } 328 329 func (o ProxyTargetOutput) ToProxyTargetOutput() ProxyTargetOutput { 330 return o 331 } 332 333 func (o ProxyTargetOutput) ToProxyTargetOutputWithContext(ctx context.Context) ProxyTargetOutput { 334 return o 335 } 336 337 // DB cluster identifier. 338 // 339 // **NOTE:** Either `dbInstanceIdentifier` or `dbClusterIdentifier` should be specified and both should not be specified together 340 func (o ProxyTargetOutput) DbClusterIdentifier() pulumi.StringPtrOutput { 341 return o.ApplyT(func(v *ProxyTarget) pulumi.StringPtrOutput { return v.DbClusterIdentifier }).(pulumi.StringPtrOutput) 342 } 343 344 // DB instance identifier. 345 func (o ProxyTargetOutput) DbInstanceIdentifier() pulumi.StringPtrOutput { 346 return o.ApplyT(func(v *ProxyTarget) pulumi.StringPtrOutput { return v.DbInstanceIdentifier }).(pulumi.StringPtrOutput) 347 } 348 349 // The name of the DB proxy. 350 func (o ProxyTargetOutput) DbProxyName() pulumi.StringOutput { 351 return o.ApplyT(func(v *ProxyTarget) pulumi.StringOutput { return v.DbProxyName }).(pulumi.StringOutput) 352 } 353 354 // Hostname for the target RDS DB Instance. Only returned for `RDS_INSTANCE` type. 355 func (o ProxyTargetOutput) Endpoint() pulumi.StringOutput { 356 return o.ApplyT(func(v *ProxyTarget) pulumi.StringOutput { return v.Endpoint }).(pulumi.StringOutput) 357 } 358 359 // Port for the target RDS DB Instance or Aurora DB Cluster. 360 func (o ProxyTargetOutput) Port() pulumi.IntOutput { 361 return o.ApplyT(func(v *ProxyTarget) pulumi.IntOutput { return v.Port }).(pulumi.IntOutput) 362 } 363 364 // Identifier representing the DB Instance or DB Cluster target. 365 func (o ProxyTargetOutput) RdsResourceId() pulumi.StringOutput { 366 return o.ApplyT(func(v *ProxyTarget) pulumi.StringOutput { return v.RdsResourceId }).(pulumi.StringOutput) 367 } 368 369 // Amazon Resource Name (ARN) for the DB instance or DB cluster. Currently not returned by the RDS API. 370 func (o ProxyTargetOutput) TargetArn() pulumi.StringOutput { 371 return o.ApplyT(func(v *ProxyTarget) pulumi.StringOutput { return v.TargetArn }).(pulumi.StringOutput) 372 } 373 374 // The name of the target group. 375 func (o ProxyTargetOutput) TargetGroupName() pulumi.StringOutput { 376 return o.ApplyT(func(v *ProxyTarget) pulumi.StringOutput { return v.TargetGroupName }).(pulumi.StringOutput) 377 } 378 379 // DB Cluster identifier for the DB Instance target. Not returned unless manually importing an `RDS_INSTANCE` target that is part of a DB Cluster. 380 func (o ProxyTargetOutput) TrackedClusterId() pulumi.StringOutput { 381 return o.ApplyT(func(v *ProxyTarget) pulumi.StringOutput { return v.TrackedClusterId }).(pulumi.StringOutput) 382 } 383 384 // Type of targetE.g., `RDS_INSTANCE` or `TRACKED_CLUSTER` 385 func (o ProxyTargetOutput) Type() pulumi.StringOutput { 386 return o.ApplyT(func(v *ProxyTarget) pulumi.StringOutput { return v.Type }).(pulumi.StringOutput) 387 } 388 389 type ProxyTargetArrayOutput struct{ *pulumi.OutputState } 390 391 func (ProxyTargetArrayOutput) ElementType() reflect.Type { 392 return reflect.TypeOf((*[]*ProxyTarget)(nil)).Elem() 393 } 394 395 func (o ProxyTargetArrayOutput) ToProxyTargetArrayOutput() ProxyTargetArrayOutput { 396 return o 397 } 398 399 func (o ProxyTargetArrayOutput) ToProxyTargetArrayOutputWithContext(ctx context.Context) ProxyTargetArrayOutput { 400 return o 401 } 402 403 func (o ProxyTargetArrayOutput) Index(i pulumi.IntInput) ProxyTargetOutput { 404 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ProxyTarget { 405 return vs[0].([]*ProxyTarget)[vs[1].(int)] 406 }).(ProxyTargetOutput) 407 } 408 409 type ProxyTargetMapOutput struct{ *pulumi.OutputState } 410 411 func (ProxyTargetMapOutput) ElementType() reflect.Type { 412 return reflect.TypeOf((*map[string]*ProxyTarget)(nil)).Elem() 413 } 414 415 func (o ProxyTargetMapOutput) ToProxyTargetMapOutput() ProxyTargetMapOutput { 416 return o 417 } 418 419 func (o ProxyTargetMapOutput) ToProxyTargetMapOutputWithContext(ctx context.Context) ProxyTargetMapOutput { 420 return o 421 } 422 423 func (o ProxyTargetMapOutput) MapIndex(k pulumi.StringInput) ProxyTargetOutput { 424 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ProxyTarget { 425 return vs[0].(map[string]*ProxyTarget)[vs[1].(string)] 426 }).(ProxyTargetOutput) 427 } 428 429 func init() { 430 pulumi.RegisterInputType(reflect.TypeOf((*ProxyTargetInput)(nil)).Elem(), &ProxyTarget{}) 431 pulumi.RegisterInputType(reflect.TypeOf((*ProxyTargetArrayInput)(nil)).Elem(), ProxyTargetArray{}) 432 pulumi.RegisterInputType(reflect.TypeOf((*ProxyTargetMapInput)(nil)).Elem(), ProxyTargetMap{}) 433 pulumi.RegisterOutputType(ProxyTargetOutput{}) 434 pulumi.RegisterOutputType(ProxyTargetArrayOutput{}) 435 pulumi.RegisterOutputType(ProxyTargetMapOutput{}) 436 }