github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/rds/clusterEndpoint.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 // Manages an RDS Aurora Cluster Endpoint. 16 // You can refer to the [User Guide](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Aurora.Overview.Endpoints.html#Aurora.Endpoints.Cluster). 17 // 18 // ## Example Usage 19 // 20 // <!--Start PulumiCodeChooser --> 21 // ```go 22 // package main 23 // 24 // import ( 25 // 26 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/rds" 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 := rds.NewCluster(ctx, "default", &rds.ClusterArgs{ 34 // ClusterIdentifier: pulumi.String("aurora-cluster-demo"), 35 // AvailabilityZones: pulumi.StringArray{ 36 // pulumi.String("us-west-2a"), 37 // pulumi.String("us-west-2b"), 38 // pulumi.String("us-west-2c"), 39 // }, 40 // DatabaseName: pulumi.String("mydb"), 41 // MasterUsername: pulumi.String("foo"), 42 // MasterPassword: pulumi.String("bar"), 43 // BackupRetentionPeriod: pulumi.Int(5), 44 // PreferredBackupWindow: pulumi.String("07:00-09:00"), 45 // }) 46 // if err != nil { 47 // return err 48 // } 49 // test1, err := rds.NewClusterInstance(ctx, "test1", &rds.ClusterInstanceArgs{ 50 // ApplyImmediately: pulumi.Bool(true), 51 // ClusterIdentifier: _default.ID(), 52 // Identifier: pulumi.String("test1"), 53 // InstanceClass: pulumi.String(rds.InstanceType_T2_Small), 54 // Engine: _default.Engine, 55 // EngineVersion: _default.EngineVersion, 56 // }) 57 // if err != nil { 58 // return err 59 // } 60 // test2, err := rds.NewClusterInstance(ctx, "test2", &rds.ClusterInstanceArgs{ 61 // ApplyImmediately: pulumi.Bool(true), 62 // ClusterIdentifier: _default.ID(), 63 // Identifier: pulumi.String("test2"), 64 // InstanceClass: pulumi.String(rds.InstanceType_T2_Small), 65 // Engine: _default.Engine, 66 // EngineVersion: _default.EngineVersion, 67 // }) 68 // if err != nil { 69 // return err 70 // } 71 // test3, err := rds.NewClusterInstance(ctx, "test3", &rds.ClusterInstanceArgs{ 72 // ApplyImmediately: pulumi.Bool(true), 73 // ClusterIdentifier: _default.ID(), 74 // Identifier: pulumi.String("test3"), 75 // InstanceClass: pulumi.String(rds.InstanceType_T2_Small), 76 // Engine: _default.Engine, 77 // EngineVersion: _default.EngineVersion, 78 // }) 79 // if err != nil { 80 // return err 81 // } 82 // _, err = rds.NewClusterEndpoint(ctx, "eligible", &rds.ClusterEndpointArgs{ 83 // ClusterIdentifier: _default.ID(), 84 // ClusterEndpointIdentifier: pulumi.String("reader"), 85 // CustomEndpointType: pulumi.String("READER"), 86 // ExcludedMembers: pulumi.StringArray{ 87 // test1.ID(), 88 // test2.ID(), 89 // }, 90 // }) 91 // if err != nil { 92 // return err 93 // } 94 // _, err = rds.NewClusterEndpoint(ctx, "static", &rds.ClusterEndpointArgs{ 95 // ClusterIdentifier: _default.ID(), 96 // ClusterEndpointIdentifier: pulumi.String("static"), 97 // CustomEndpointType: pulumi.String("READER"), 98 // StaticMembers: pulumi.StringArray{ 99 // test1.ID(), 100 // test3.ID(), 101 // }, 102 // }) 103 // if err != nil { 104 // return err 105 // } 106 // return nil 107 // }) 108 // } 109 // 110 // ``` 111 // <!--End PulumiCodeChooser --> 112 // 113 // ## Import 114 // 115 // Using `pulumi import`, import RDS Clusters Endpoint using the `cluster_endpoint_identifier`. For example: 116 // 117 // ```sh 118 // $ pulumi import aws:rds/clusterEndpoint:ClusterEndpoint custom_reader aurora-prod-cluster-custom-reader 119 // ``` 120 type ClusterEndpoint struct { 121 pulumi.CustomResourceState 122 123 // Amazon Resource Name (ARN) of cluster 124 Arn pulumi.StringOutput `pulumi:"arn"` 125 // The identifier to use for the new endpoint. This parameter is stored as a lowercase string. 126 ClusterEndpointIdentifier pulumi.StringOutput `pulumi:"clusterEndpointIdentifier"` 127 // The cluster identifier. 128 ClusterIdentifier pulumi.StringOutput `pulumi:"clusterIdentifier"` 129 // The type of the endpoint. One of: READER , ANY . 130 CustomEndpointType pulumi.StringOutput `pulumi:"customEndpointType"` 131 // A custom endpoint for the Aurora cluster 132 Endpoint pulumi.StringOutput `pulumi:"endpoint"` 133 // List of DB instance identifiers that aren't part of the custom endpoint group. All other eligible instances are reachable through the custom endpoint. Only relevant if the list of static members is empty. Conflicts with `staticMembers`. 134 ExcludedMembers pulumi.StringArrayOutput `pulumi:"excludedMembers"` 135 // List of DB instance identifiers that are part of the custom endpoint group. Conflicts with `excludedMembers`. 136 StaticMembers pulumi.StringArrayOutput `pulumi:"staticMembers"` 137 // 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. 138 Tags pulumi.StringMapOutput `pulumi:"tags"` 139 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 140 // 141 // Deprecated: Please use `tags` instead. 142 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 143 } 144 145 // NewClusterEndpoint registers a new resource with the given unique name, arguments, and options. 146 func NewClusterEndpoint(ctx *pulumi.Context, 147 name string, args *ClusterEndpointArgs, opts ...pulumi.ResourceOption) (*ClusterEndpoint, error) { 148 if args == nil { 149 return nil, errors.New("missing one or more required arguments") 150 } 151 152 if args.ClusterEndpointIdentifier == nil { 153 return nil, errors.New("invalid value for required argument 'ClusterEndpointIdentifier'") 154 } 155 if args.ClusterIdentifier == nil { 156 return nil, errors.New("invalid value for required argument 'ClusterIdentifier'") 157 } 158 if args.CustomEndpointType == nil { 159 return nil, errors.New("invalid value for required argument 'CustomEndpointType'") 160 } 161 opts = internal.PkgResourceDefaultOpts(opts) 162 var resource ClusterEndpoint 163 err := ctx.RegisterResource("aws:rds/clusterEndpoint:ClusterEndpoint", name, args, &resource, opts...) 164 if err != nil { 165 return nil, err 166 } 167 return &resource, nil 168 } 169 170 // GetClusterEndpoint gets an existing ClusterEndpoint resource's state with the given name, ID, and optional 171 // state properties that are used to uniquely qualify the lookup (nil if not required). 172 func GetClusterEndpoint(ctx *pulumi.Context, 173 name string, id pulumi.IDInput, state *ClusterEndpointState, opts ...pulumi.ResourceOption) (*ClusterEndpoint, error) { 174 var resource ClusterEndpoint 175 err := ctx.ReadResource("aws:rds/clusterEndpoint:ClusterEndpoint", name, id, state, &resource, opts...) 176 if err != nil { 177 return nil, err 178 } 179 return &resource, nil 180 } 181 182 // Input properties used for looking up and filtering ClusterEndpoint resources. 183 type clusterEndpointState struct { 184 // Amazon Resource Name (ARN) of cluster 185 Arn *string `pulumi:"arn"` 186 // The identifier to use for the new endpoint. This parameter is stored as a lowercase string. 187 ClusterEndpointIdentifier *string `pulumi:"clusterEndpointIdentifier"` 188 // The cluster identifier. 189 ClusterIdentifier *string `pulumi:"clusterIdentifier"` 190 // The type of the endpoint. One of: READER , ANY . 191 CustomEndpointType *string `pulumi:"customEndpointType"` 192 // A custom endpoint for the Aurora cluster 193 Endpoint *string `pulumi:"endpoint"` 194 // List of DB instance identifiers that aren't part of the custom endpoint group. All other eligible instances are reachable through the custom endpoint. Only relevant if the list of static members is empty. Conflicts with `staticMembers`. 195 ExcludedMembers []string `pulumi:"excludedMembers"` 196 // List of DB instance identifiers that are part of the custom endpoint group. Conflicts with `excludedMembers`. 197 StaticMembers []string `pulumi:"staticMembers"` 198 // 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. 199 Tags map[string]string `pulumi:"tags"` 200 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 201 // 202 // Deprecated: Please use `tags` instead. 203 TagsAll map[string]string `pulumi:"tagsAll"` 204 } 205 206 type ClusterEndpointState struct { 207 // Amazon Resource Name (ARN) of cluster 208 Arn pulumi.StringPtrInput 209 // The identifier to use for the new endpoint. This parameter is stored as a lowercase string. 210 ClusterEndpointIdentifier pulumi.StringPtrInput 211 // The cluster identifier. 212 ClusterIdentifier pulumi.StringPtrInput 213 // The type of the endpoint. One of: READER , ANY . 214 CustomEndpointType pulumi.StringPtrInput 215 // A custom endpoint for the Aurora cluster 216 Endpoint pulumi.StringPtrInput 217 // List of DB instance identifiers that aren't part of the custom endpoint group. All other eligible instances are reachable through the custom endpoint. Only relevant if the list of static members is empty. Conflicts with `staticMembers`. 218 ExcludedMembers pulumi.StringArrayInput 219 // List of DB instance identifiers that are part of the custom endpoint group. Conflicts with `excludedMembers`. 220 StaticMembers pulumi.StringArrayInput 221 // 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. 222 Tags pulumi.StringMapInput 223 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 224 // 225 // Deprecated: Please use `tags` instead. 226 TagsAll pulumi.StringMapInput 227 } 228 229 func (ClusterEndpointState) ElementType() reflect.Type { 230 return reflect.TypeOf((*clusterEndpointState)(nil)).Elem() 231 } 232 233 type clusterEndpointArgs struct { 234 // The identifier to use for the new endpoint. This parameter is stored as a lowercase string. 235 ClusterEndpointIdentifier string `pulumi:"clusterEndpointIdentifier"` 236 // The cluster identifier. 237 ClusterIdentifier string `pulumi:"clusterIdentifier"` 238 // The type of the endpoint. One of: READER , ANY . 239 CustomEndpointType string `pulumi:"customEndpointType"` 240 // List of DB instance identifiers that aren't part of the custom endpoint group. All other eligible instances are reachable through the custom endpoint. Only relevant if the list of static members is empty. Conflicts with `staticMembers`. 241 ExcludedMembers []string `pulumi:"excludedMembers"` 242 // List of DB instance identifiers that are part of the custom endpoint group. Conflicts with `excludedMembers`. 243 StaticMembers []string `pulumi:"staticMembers"` 244 // 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. 245 Tags map[string]string `pulumi:"tags"` 246 } 247 248 // The set of arguments for constructing a ClusterEndpoint resource. 249 type ClusterEndpointArgs struct { 250 // The identifier to use for the new endpoint. This parameter is stored as a lowercase string. 251 ClusterEndpointIdentifier pulumi.StringInput 252 // The cluster identifier. 253 ClusterIdentifier pulumi.StringInput 254 // The type of the endpoint. One of: READER , ANY . 255 CustomEndpointType pulumi.StringInput 256 // List of DB instance identifiers that aren't part of the custom endpoint group. All other eligible instances are reachable through the custom endpoint. Only relevant if the list of static members is empty. Conflicts with `staticMembers`. 257 ExcludedMembers pulumi.StringArrayInput 258 // List of DB instance identifiers that are part of the custom endpoint group. Conflicts with `excludedMembers`. 259 StaticMembers pulumi.StringArrayInput 260 // 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. 261 Tags pulumi.StringMapInput 262 } 263 264 func (ClusterEndpointArgs) ElementType() reflect.Type { 265 return reflect.TypeOf((*clusterEndpointArgs)(nil)).Elem() 266 } 267 268 type ClusterEndpointInput interface { 269 pulumi.Input 270 271 ToClusterEndpointOutput() ClusterEndpointOutput 272 ToClusterEndpointOutputWithContext(ctx context.Context) ClusterEndpointOutput 273 } 274 275 func (*ClusterEndpoint) ElementType() reflect.Type { 276 return reflect.TypeOf((**ClusterEndpoint)(nil)).Elem() 277 } 278 279 func (i *ClusterEndpoint) ToClusterEndpointOutput() ClusterEndpointOutput { 280 return i.ToClusterEndpointOutputWithContext(context.Background()) 281 } 282 283 func (i *ClusterEndpoint) ToClusterEndpointOutputWithContext(ctx context.Context) ClusterEndpointOutput { 284 return pulumi.ToOutputWithContext(ctx, i).(ClusterEndpointOutput) 285 } 286 287 // ClusterEndpointArrayInput is an input type that accepts ClusterEndpointArray and ClusterEndpointArrayOutput values. 288 // You can construct a concrete instance of `ClusterEndpointArrayInput` via: 289 // 290 // ClusterEndpointArray{ ClusterEndpointArgs{...} } 291 type ClusterEndpointArrayInput interface { 292 pulumi.Input 293 294 ToClusterEndpointArrayOutput() ClusterEndpointArrayOutput 295 ToClusterEndpointArrayOutputWithContext(context.Context) ClusterEndpointArrayOutput 296 } 297 298 type ClusterEndpointArray []ClusterEndpointInput 299 300 func (ClusterEndpointArray) ElementType() reflect.Type { 301 return reflect.TypeOf((*[]*ClusterEndpoint)(nil)).Elem() 302 } 303 304 func (i ClusterEndpointArray) ToClusterEndpointArrayOutput() ClusterEndpointArrayOutput { 305 return i.ToClusterEndpointArrayOutputWithContext(context.Background()) 306 } 307 308 func (i ClusterEndpointArray) ToClusterEndpointArrayOutputWithContext(ctx context.Context) ClusterEndpointArrayOutput { 309 return pulumi.ToOutputWithContext(ctx, i).(ClusterEndpointArrayOutput) 310 } 311 312 // ClusterEndpointMapInput is an input type that accepts ClusterEndpointMap and ClusterEndpointMapOutput values. 313 // You can construct a concrete instance of `ClusterEndpointMapInput` via: 314 // 315 // ClusterEndpointMap{ "key": ClusterEndpointArgs{...} } 316 type ClusterEndpointMapInput interface { 317 pulumi.Input 318 319 ToClusterEndpointMapOutput() ClusterEndpointMapOutput 320 ToClusterEndpointMapOutputWithContext(context.Context) ClusterEndpointMapOutput 321 } 322 323 type ClusterEndpointMap map[string]ClusterEndpointInput 324 325 func (ClusterEndpointMap) ElementType() reflect.Type { 326 return reflect.TypeOf((*map[string]*ClusterEndpoint)(nil)).Elem() 327 } 328 329 func (i ClusterEndpointMap) ToClusterEndpointMapOutput() ClusterEndpointMapOutput { 330 return i.ToClusterEndpointMapOutputWithContext(context.Background()) 331 } 332 333 func (i ClusterEndpointMap) ToClusterEndpointMapOutputWithContext(ctx context.Context) ClusterEndpointMapOutput { 334 return pulumi.ToOutputWithContext(ctx, i).(ClusterEndpointMapOutput) 335 } 336 337 type ClusterEndpointOutput struct{ *pulumi.OutputState } 338 339 func (ClusterEndpointOutput) ElementType() reflect.Type { 340 return reflect.TypeOf((**ClusterEndpoint)(nil)).Elem() 341 } 342 343 func (o ClusterEndpointOutput) ToClusterEndpointOutput() ClusterEndpointOutput { 344 return o 345 } 346 347 func (o ClusterEndpointOutput) ToClusterEndpointOutputWithContext(ctx context.Context) ClusterEndpointOutput { 348 return o 349 } 350 351 // Amazon Resource Name (ARN) of cluster 352 func (o ClusterEndpointOutput) Arn() pulumi.StringOutput { 353 return o.ApplyT(func(v *ClusterEndpoint) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 354 } 355 356 // The identifier to use for the new endpoint. This parameter is stored as a lowercase string. 357 func (o ClusterEndpointOutput) ClusterEndpointIdentifier() pulumi.StringOutput { 358 return o.ApplyT(func(v *ClusterEndpoint) pulumi.StringOutput { return v.ClusterEndpointIdentifier }).(pulumi.StringOutput) 359 } 360 361 // The cluster identifier. 362 func (o ClusterEndpointOutput) ClusterIdentifier() pulumi.StringOutput { 363 return o.ApplyT(func(v *ClusterEndpoint) pulumi.StringOutput { return v.ClusterIdentifier }).(pulumi.StringOutput) 364 } 365 366 // The type of the endpoint. One of: READER , ANY . 367 func (o ClusterEndpointOutput) CustomEndpointType() pulumi.StringOutput { 368 return o.ApplyT(func(v *ClusterEndpoint) pulumi.StringOutput { return v.CustomEndpointType }).(pulumi.StringOutput) 369 } 370 371 // A custom endpoint for the Aurora cluster 372 func (o ClusterEndpointOutput) Endpoint() pulumi.StringOutput { 373 return o.ApplyT(func(v *ClusterEndpoint) pulumi.StringOutput { return v.Endpoint }).(pulumi.StringOutput) 374 } 375 376 // List of DB instance identifiers that aren't part of the custom endpoint group. All other eligible instances are reachable through the custom endpoint. Only relevant if the list of static members is empty. Conflicts with `staticMembers`. 377 func (o ClusterEndpointOutput) ExcludedMembers() pulumi.StringArrayOutput { 378 return o.ApplyT(func(v *ClusterEndpoint) pulumi.StringArrayOutput { return v.ExcludedMembers }).(pulumi.StringArrayOutput) 379 } 380 381 // List of DB instance identifiers that are part of the custom endpoint group. Conflicts with `excludedMembers`. 382 func (o ClusterEndpointOutput) StaticMembers() pulumi.StringArrayOutput { 383 return o.ApplyT(func(v *ClusterEndpoint) pulumi.StringArrayOutput { return v.StaticMembers }).(pulumi.StringArrayOutput) 384 } 385 386 // 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. 387 func (o ClusterEndpointOutput) Tags() pulumi.StringMapOutput { 388 return o.ApplyT(func(v *ClusterEndpoint) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 389 } 390 391 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 392 // 393 // Deprecated: Please use `tags` instead. 394 func (o ClusterEndpointOutput) TagsAll() pulumi.StringMapOutput { 395 return o.ApplyT(func(v *ClusterEndpoint) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 396 } 397 398 type ClusterEndpointArrayOutput struct{ *pulumi.OutputState } 399 400 func (ClusterEndpointArrayOutput) ElementType() reflect.Type { 401 return reflect.TypeOf((*[]*ClusterEndpoint)(nil)).Elem() 402 } 403 404 func (o ClusterEndpointArrayOutput) ToClusterEndpointArrayOutput() ClusterEndpointArrayOutput { 405 return o 406 } 407 408 func (o ClusterEndpointArrayOutput) ToClusterEndpointArrayOutputWithContext(ctx context.Context) ClusterEndpointArrayOutput { 409 return o 410 } 411 412 func (o ClusterEndpointArrayOutput) Index(i pulumi.IntInput) ClusterEndpointOutput { 413 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ClusterEndpoint { 414 return vs[0].([]*ClusterEndpoint)[vs[1].(int)] 415 }).(ClusterEndpointOutput) 416 } 417 418 type ClusterEndpointMapOutput struct{ *pulumi.OutputState } 419 420 func (ClusterEndpointMapOutput) ElementType() reflect.Type { 421 return reflect.TypeOf((*map[string]*ClusterEndpoint)(nil)).Elem() 422 } 423 424 func (o ClusterEndpointMapOutput) ToClusterEndpointMapOutput() ClusterEndpointMapOutput { 425 return o 426 } 427 428 func (o ClusterEndpointMapOutput) ToClusterEndpointMapOutputWithContext(ctx context.Context) ClusterEndpointMapOutput { 429 return o 430 } 431 432 func (o ClusterEndpointMapOutput) MapIndex(k pulumi.StringInput) ClusterEndpointOutput { 433 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ClusterEndpoint { 434 return vs[0].(map[string]*ClusterEndpoint)[vs[1].(string)] 435 }).(ClusterEndpointOutput) 436 } 437 438 func init() { 439 pulumi.RegisterInputType(reflect.TypeOf((*ClusterEndpointInput)(nil)).Elem(), &ClusterEndpoint{}) 440 pulumi.RegisterInputType(reflect.TypeOf((*ClusterEndpointArrayInput)(nil)).Elem(), ClusterEndpointArray{}) 441 pulumi.RegisterInputType(reflect.TypeOf((*ClusterEndpointMapInput)(nil)).Elem(), ClusterEndpointMap{}) 442 pulumi.RegisterOutputType(ClusterEndpointOutput{}) 443 pulumi.RegisterOutputType(ClusterEndpointArrayOutput{}) 444 pulumi.RegisterOutputType(ClusterEndpointMapOutput{}) 445 }