github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/rds/proxyEndpoint.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 endpoint resource. For additional information, see the [RDS User Guide](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-proxy-endpoints.html).
    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  // func main() {
    30  // pulumi.Run(func(ctx *pulumi.Context) error {
    31  // var splat0 []interface{}
    32  // for _, val0 := range testAwsSubnet {
    33  // splat0 = append(splat0, val0.Id)
    34  // }
    35  // _, err := rds.NewProxyEndpoint(ctx, "example", &rds.ProxyEndpointArgs{
    36  // DbProxyName: pulumi.Any(test.Name),
    37  // DbProxyEndpointName: pulumi.String("example"),
    38  // VpcSubnetIds: toPulumiArray(splat0),
    39  // TargetRole: pulumi.String("READ_ONLY"),
    40  // })
    41  // if err != nil {
    42  // return err
    43  // }
    44  // return nil
    45  // })
    46  // }
    47  // func toPulumiArray(arr []) pulumi.Array {
    48  // var pulumiArr pulumi.Array
    49  // for _, v := range arr {
    50  // pulumiArr = append(pulumiArr, pulumi.(v))
    51  // }
    52  // return pulumiArr
    53  // }
    54  // ```
    55  // <!--End PulumiCodeChooser -->
    56  //
    57  // ## Import
    58  //
    59  // Using `pulumi import`, import DB proxy endpoints using the `DB-PROXY-NAME/DB-PROXY-ENDPOINT-NAME`. For example:
    60  //
    61  // ```sh
    62  // $ pulumi import aws:rds/proxyEndpoint:ProxyEndpoint example example/example
    63  // ```
    64  type ProxyEndpoint struct {
    65  	pulumi.CustomResourceState
    66  
    67  	// The Amazon Resource Name (ARN) for the proxy endpoint.
    68  	Arn pulumi.StringOutput `pulumi:"arn"`
    69  	// The identifier for the proxy endpoint. An identifier must begin with a letter and must contain only ASCII letters, digits, and hyphens; it can't end with a hyphen or contain two consecutive hyphens.
    70  	DbProxyEndpointName pulumi.StringOutput `pulumi:"dbProxyEndpointName"`
    71  	// The name of the DB proxy associated with the DB proxy endpoint that you create.
    72  	DbProxyName pulumi.StringOutput `pulumi:"dbProxyName"`
    73  	// The endpoint that you can use to connect to the proxy. You include the endpoint value in the connection string for a database client application.
    74  	Endpoint pulumi.StringOutput `pulumi:"endpoint"`
    75  	// Indicates whether this endpoint is the default endpoint for the associated DB proxy.
    76  	IsDefault pulumi.BoolOutput `pulumi:"isDefault"`
    77  	// A mapping of tags to assign to the resource.
    78  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    79  	// Deprecated: Please use `tags` instead.
    80  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    81  	// Indicates whether the DB proxy endpoint can be used for read/write or read-only operations. The default is `READ_WRITE`. Valid values are `READ_WRITE` and `READ_ONLY`.
    82  	TargetRole pulumi.StringPtrOutput `pulumi:"targetRole"`
    83  	// The VPC ID of the DB proxy endpoint.
    84  	VpcId pulumi.StringOutput `pulumi:"vpcId"`
    85  	// One or more VPC security group IDs to associate with the new proxy.
    86  	VpcSecurityGroupIds pulumi.StringArrayOutput `pulumi:"vpcSecurityGroupIds"`
    87  	// One or more VPC subnet IDs to associate with the new proxy.
    88  	VpcSubnetIds pulumi.StringArrayOutput `pulumi:"vpcSubnetIds"`
    89  }
    90  
    91  // NewProxyEndpoint registers a new resource with the given unique name, arguments, and options.
    92  func NewProxyEndpoint(ctx *pulumi.Context,
    93  	name string, args *ProxyEndpointArgs, opts ...pulumi.ResourceOption) (*ProxyEndpoint, error) {
    94  	if args == nil {
    95  		return nil, errors.New("missing one or more required arguments")
    96  	}
    97  
    98  	if args.DbProxyEndpointName == nil {
    99  		return nil, errors.New("invalid value for required argument 'DbProxyEndpointName'")
   100  	}
   101  	if args.DbProxyName == nil {
   102  		return nil, errors.New("invalid value for required argument 'DbProxyName'")
   103  	}
   104  	if args.VpcSubnetIds == nil {
   105  		return nil, errors.New("invalid value for required argument 'VpcSubnetIds'")
   106  	}
   107  	opts = internal.PkgResourceDefaultOpts(opts)
   108  	var resource ProxyEndpoint
   109  	err := ctx.RegisterResource("aws:rds/proxyEndpoint:ProxyEndpoint", name, args, &resource, opts...)
   110  	if err != nil {
   111  		return nil, err
   112  	}
   113  	return &resource, nil
   114  }
   115  
   116  // GetProxyEndpoint gets an existing ProxyEndpoint resource's state with the given name, ID, and optional
   117  // state properties that are used to uniquely qualify the lookup (nil if not required).
   118  func GetProxyEndpoint(ctx *pulumi.Context,
   119  	name string, id pulumi.IDInput, state *ProxyEndpointState, opts ...pulumi.ResourceOption) (*ProxyEndpoint, error) {
   120  	var resource ProxyEndpoint
   121  	err := ctx.ReadResource("aws:rds/proxyEndpoint:ProxyEndpoint", name, id, state, &resource, opts...)
   122  	if err != nil {
   123  		return nil, err
   124  	}
   125  	return &resource, nil
   126  }
   127  
   128  // Input properties used for looking up and filtering ProxyEndpoint resources.
   129  type proxyEndpointState struct {
   130  	// The Amazon Resource Name (ARN) for the proxy endpoint.
   131  	Arn *string `pulumi:"arn"`
   132  	// The identifier for the proxy endpoint. An identifier must begin with a letter and must contain only ASCII letters, digits, and hyphens; it can't end with a hyphen or contain two consecutive hyphens.
   133  	DbProxyEndpointName *string `pulumi:"dbProxyEndpointName"`
   134  	// The name of the DB proxy associated with the DB proxy endpoint that you create.
   135  	DbProxyName *string `pulumi:"dbProxyName"`
   136  	// The endpoint that you can use to connect to the proxy. You include the endpoint value in the connection string for a database client application.
   137  	Endpoint *string `pulumi:"endpoint"`
   138  	// Indicates whether this endpoint is the default endpoint for the associated DB proxy.
   139  	IsDefault *bool `pulumi:"isDefault"`
   140  	// A mapping of tags to assign to the resource.
   141  	Tags map[string]string `pulumi:"tags"`
   142  	// Deprecated: Please use `tags` instead.
   143  	TagsAll map[string]string `pulumi:"tagsAll"`
   144  	// Indicates whether the DB proxy endpoint can be used for read/write or read-only operations. The default is `READ_WRITE`. Valid values are `READ_WRITE` and `READ_ONLY`.
   145  	TargetRole *string `pulumi:"targetRole"`
   146  	// The VPC ID of the DB proxy endpoint.
   147  	VpcId *string `pulumi:"vpcId"`
   148  	// One or more VPC security group IDs to associate with the new proxy.
   149  	VpcSecurityGroupIds []string `pulumi:"vpcSecurityGroupIds"`
   150  	// One or more VPC subnet IDs to associate with the new proxy.
   151  	VpcSubnetIds []string `pulumi:"vpcSubnetIds"`
   152  }
   153  
   154  type ProxyEndpointState struct {
   155  	// The Amazon Resource Name (ARN) for the proxy endpoint.
   156  	Arn pulumi.StringPtrInput
   157  	// The identifier for the proxy endpoint. An identifier must begin with a letter and must contain only ASCII letters, digits, and hyphens; it can't end with a hyphen or contain two consecutive hyphens.
   158  	DbProxyEndpointName pulumi.StringPtrInput
   159  	// The name of the DB proxy associated with the DB proxy endpoint that you create.
   160  	DbProxyName pulumi.StringPtrInput
   161  	// The endpoint that you can use to connect to the proxy. You include the endpoint value in the connection string for a database client application.
   162  	Endpoint pulumi.StringPtrInput
   163  	// Indicates whether this endpoint is the default endpoint for the associated DB proxy.
   164  	IsDefault pulumi.BoolPtrInput
   165  	// A mapping of tags to assign to the resource.
   166  	Tags pulumi.StringMapInput
   167  	// Deprecated: Please use `tags` instead.
   168  	TagsAll pulumi.StringMapInput
   169  	// Indicates whether the DB proxy endpoint can be used for read/write or read-only operations. The default is `READ_WRITE`. Valid values are `READ_WRITE` and `READ_ONLY`.
   170  	TargetRole pulumi.StringPtrInput
   171  	// The VPC ID of the DB proxy endpoint.
   172  	VpcId pulumi.StringPtrInput
   173  	// One or more VPC security group IDs to associate with the new proxy.
   174  	VpcSecurityGroupIds pulumi.StringArrayInput
   175  	// One or more VPC subnet IDs to associate with the new proxy.
   176  	VpcSubnetIds pulumi.StringArrayInput
   177  }
   178  
   179  func (ProxyEndpointState) ElementType() reflect.Type {
   180  	return reflect.TypeOf((*proxyEndpointState)(nil)).Elem()
   181  }
   182  
   183  type proxyEndpointArgs struct {
   184  	// The identifier for the proxy endpoint. An identifier must begin with a letter and must contain only ASCII letters, digits, and hyphens; it can't end with a hyphen or contain two consecutive hyphens.
   185  	DbProxyEndpointName string `pulumi:"dbProxyEndpointName"`
   186  	// The name of the DB proxy associated with the DB proxy endpoint that you create.
   187  	DbProxyName string `pulumi:"dbProxyName"`
   188  	// A mapping of tags to assign to the resource.
   189  	Tags map[string]string `pulumi:"tags"`
   190  	// Indicates whether the DB proxy endpoint can be used for read/write or read-only operations. The default is `READ_WRITE`. Valid values are `READ_WRITE` and `READ_ONLY`.
   191  	TargetRole *string `pulumi:"targetRole"`
   192  	// One or more VPC security group IDs to associate with the new proxy.
   193  	VpcSecurityGroupIds []string `pulumi:"vpcSecurityGroupIds"`
   194  	// One or more VPC subnet IDs to associate with the new proxy.
   195  	VpcSubnetIds []string `pulumi:"vpcSubnetIds"`
   196  }
   197  
   198  // The set of arguments for constructing a ProxyEndpoint resource.
   199  type ProxyEndpointArgs struct {
   200  	// The identifier for the proxy endpoint. An identifier must begin with a letter and must contain only ASCII letters, digits, and hyphens; it can't end with a hyphen or contain two consecutive hyphens.
   201  	DbProxyEndpointName pulumi.StringInput
   202  	// The name of the DB proxy associated with the DB proxy endpoint that you create.
   203  	DbProxyName pulumi.StringInput
   204  	// A mapping of tags to assign to the resource.
   205  	Tags pulumi.StringMapInput
   206  	// Indicates whether the DB proxy endpoint can be used for read/write or read-only operations. The default is `READ_WRITE`. Valid values are `READ_WRITE` and `READ_ONLY`.
   207  	TargetRole pulumi.StringPtrInput
   208  	// One or more VPC security group IDs to associate with the new proxy.
   209  	VpcSecurityGroupIds pulumi.StringArrayInput
   210  	// One or more VPC subnet IDs to associate with the new proxy.
   211  	VpcSubnetIds pulumi.StringArrayInput
   212  }
   213  
   214  func (ProxyEndpointArgs) ElementType() reflect.Type {
   215  	return reflect.TypeOf((*proxyEndpointArgs)(nil)).Elem()
   216  }
   217  
   218  type ProxyEndpointInput interface {
   219  	pulumi.Input
   220  
   221  	ToProxyEndpointOutput() ProxyEndpointOutput
   222  	ToProxyEndpointOutputWithContext(ctx context.Context) ProxyEndpointOutput
   223  }
   224  
   225  func (*ProxyEndpoint) ElementType() reflect.Type {
   226  	return reflect.TypeOf((**ProxyEndpoint)(nil)).Elem()
   227  }
   228  
   229  func (i *ProxyEndpoint) ToProxyEndpointOutput() ProxyEndpointOutput {
   230  	return i.ToProxyEndpointOutputWithContext(context.Background())
   231  }
   232  
   233  func (i *ProxyEndpoint) ToProxyEndpointOutputWithContext(ctx context.Context) ProxyEndpointOutput {
   234  	return pulumi.ToOutputWithContext(ctx, i).(ProxyEndpointOutput)
   235  }
   236  
   237  // ProxyEndpointArrayInput is an input type that accepts ProxyEndpointArray and ProxyEndpointArrayOutput values.
   238  // You can construct a concrete instance of `ProxyEndpointArrayInput` via:
   239  //
   240  //	ProxyEndpointArray{ ProxyEndpointArgs{...} }
   241  type ProxyEndpointArrayInput interface {
   242  	pulumi.Input
   243  
   244  	ToProxyEndpointArrayOutput() ProxyEndpointArrayOutput
   245  	ToProxyEndpointArrayOutputWithContext(context.Context) ProxyEndpointArrayOutput
   246  }
   247  
   248  type ProxyEndpointArray []ProxyEndpointInput
   249  
   250  func (ProxyEndpointArray) ElementType() reflect.Type {
   251  	return reflect.TypeOf((*[]*ProxyEndpoint)(nil)).Elem()
   252  }
   253  
   254  func (i ProxyEndpointArray) ToProxyEndpointArrayOutput() ProxyEndpointArrayOutput {
   255  	return i.ToProxyEndpointArrayOutputWithContext(context.Background())
   256  }
   257  
   258  func (i ProxyEndpointArray) ToProxyEndpointArrayOutputWithContext(ctx context.Context) ProxyEndpointArrayOutput {
   259  	return pulumi.ToOutputWithContext(ctx, i).(ProxyEndpointArrayOutput)
   260  }
   261  
   262  // ProxyEndpointMapInput is an input type that accepts ProxyEndpointMap and ProxyEndpointMapOutput values.
   263  // You can construct a concrete instance of `ProxyEndpointMapInput` via:
   264  //
   265  //	ProxyEndpointMap{ "key": ProxyEndpointArgs{...} }
   266  type ProxyEndpointMapInput interface {
   267  	pulumi.Input
   268  
   269  	ToProxyEndpointMapOutput() ProxyEndpointMapOutput
   270  	ToProxyEndpointMapOutputWithContext(context.Context) ProxyEndpointMapOutput
   271  }
   272  
   273  type ProxyEndpointMap map[string]ProxyEndpointInput
   274  
   275  func (ProxyEndpointMap) ElementType() reflect.Type {
   276  	return reflect.TypeOf((*map[string]*ProxyEndpoint)(nil)).Elem()
   277  }
   278  
   279  func (i ProxyEndpointMap) ToProxyEndpointMapOutput() ProxyEndpointMapOutput {
   280  	return i.ToProxyEndpointMapOutputWithContext(context.Background())
   281  }
   282  
   283  func (i ProxyEndpointMap) ToProxyEndpointMapOutputWithContext(ctx context.Context) ProxyEndpointMapOutput {
   284  	return pulumi.ToOutputWithContext(ctx, i).(ProxyEndpointMapOutput)
   285  }
   286  
   287  type ProxyEndpointOutput struct{ *pulumi.OutputState }
   288  
   289  func (ProxyEndpointOutput) ElementType() reflect.Type {
   290  	return reflect.TypeOf((**ProxyEndpoint)(nil)).Elem()
   291  }
   292  
   293  func (o ProxyEndpointOutput) ToProxyEndpointOutput() ProxyEndpointOutput {
   294  	return o
   295  }
   296  
   297  func (o ProxyEndpointOutput) ToProxyEndpointOutputWithContext(ctx context.Context) ProxyEndpointOutput {
   298  	return o
   299  }
   300  
   301  // The Amazon Resource Name (ARN) for the proxy endpoint.
   302  func (o ProxyEndpointOutput) Arn() pulumi.StringOutput {
   303  	return o.ApplyT(func(v *ProxyEndpoint) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   304  }
   305  
   306  // The identifier for the proxy endpoint. An identifier must begin with a letter and must contain only ASCII letters, digits, and hyphens; it can't end with a hyphen or contain two consecutive hyphens.
   307  func (o ProxyEndpointOutput) DbProxyEndpointName() pulumi.StringOutput {
   308  	return o.ApplyT(func(v *ProxyEndpoint) pulumi.StringOutput { return v.DbProxyEndpointName }).(pulumi.StringOutput)
   309  }
   310  
   311  // The name of the DB proxy associated with the DB proxy endpoint that you create.
   312  func (o ProxyEndpointOutput) DbProxyName() pulumi.StringOutput {
   313  	return o.ApplyT(func(v *ProxyEndpoint) pulumi.StringOutput { return v.DbProxyName }).(pulumi.StringOutput)
   314  }
   315  
   316  // The endpoint that you can use to connect to the proxy. You include the endpoint value in the connection string for a database client application.
   317  func (o ProxyEndpointOutput) Endpoint() pulumi.StringOutput {
   318  	return o.ApplyT(func(v *ProxyEndpoint) pulumi.StringOutput { return v.Endpoint }).(pulumi.StringOutput)
   319  }
   320  
   321  // Indicates whether this endpoint is the default endpoint for the associated DB proxy.
   322  func (o ProxyEndpointOutput) IsDefault() pulumi.BoolOutput {
   323  	return o.ApplyT(func(v *ProxyEndpoint) pulumi.BoolOutput { return v.IsDefault }).(pulumi.BoolOutput)
   324  }
   325  
   326  // A mapping of tags to assign to the resource.
   327  func (o ProxyEndpointOutput) Tags() pulumi.StringMapOutput {
   328  	return o.ApplyT(func(v *ProxyEndpoint) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   329  }
   330  
   331  // Deprecated: Please use `tags` instead.
   332  func (o ProxyEndpointOutput) TagsAll() pulumi.StringMapOutput {
   333  	return o.ApplyT(func(v *ProxyEndpoint) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   334  }
   335  
   336  // Indicates whether the DB proxy endpoint can be used for read/write or read-only operations. The default is `READ_WRITE`. Valid values are `READ_WRITE` and `READ_ONLY`.
   337  func (o ProxyEndpointOutput) TargetRole() pulumi.StringPtrOutput {
   338  	return o.ApplyT(func(v *ProxyEndpoint) pulumi.StringPtrOutput { return v.TargetRole }).(pulumi.StringPtrOutput)
   339  }
   340  
   341  // The VPC ID of the DB proxy endpoint.
   342  func (o ProxyEndpointOutput) VpcId() pulumi.StringOutput {
   343  	return o.ApplyT(func(v *ProxyEndpoint) pulumi.StringOutput { return v.VpcId }).(pulumi.StringOutput)
   344  }
   345  
   346  // One or more VPC security group IDs to associate with the new proxy.
   347  func (o ProxyEndpointOutput) VpcSecurityGroupIds() pulumi.StringArrayOutput {
   348  	return o.ApplyT(func(v *ProxyEndpoint) pulumi.StringArrayOutput { return v.VpcSecurityGroupIds }).(pulumi.StringArrayOutput)
   349  }
   350  
   351  // One or more VPC subnet IDs to associate with the new proxy.
   352  func (o ProxyEndpointOutput) VpcSubnetIds() pulumi.StringArrayOutput {
   353  	return o.ApplyT(func(v *ProxyEndpoint) pulumi.StringArrayOutput { return v.VpcSubnetIds }).(pulumi.StringArrayOutput)
   354  }
   355  
   356  type ProxyEndpointArrayOutput struct{ *pulumi.OutputState }
   357  
   358  func (ProxyEndpointArrayOutput) ElementType() reflect.Type {
   359  	return reflect.TypeOf((*[]*ProxyEndpoint)(nil)).Elem()
   360  }
   361  
   362  func (o ProxyEndpointArrayOutput) ToProxyEndpointArrayOutput() ProxyEndpointArrayOutput {
   363  	return o
   364  }
   365  
   366  func (o ProxyEndpointArrayOutput) ToProxyEndpointArrayOutputWithContext(ctx context.Context) ProxyEndpointArrayOutput {
   367  	return o
   368  }
   369  
   370  func (o ProxyEndpointArrayOutput) Index(i pulumi.IntInput) ProxyEndpointOutput {
   371  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ProxyEndpoint {
   372  		return vs[0].([]*ProxyEndpoint)[vs[1].(int)]
   373  	}).(ProxyEndpointOutput)
   374  }
   375  
   376  type ProxyEndpointMapOutput struct{ *pulumi.OutputState }
   377  
   378  func (ProxyEndpointMapOutput) ElementType() reflect.Type {
   379  	return reflect.TypeOf((*map[string]*ProxyEndpoint)(nil)).Elem()
   380  }
   381  
   382  func (o ProxyEndpointMapOutput) ToProxyEndpointMapOutput() ProxyEndpointMapOutput {
   383  	return o
   384  }
   385  
   386  func (o ProxyEndpointMapOutput) ToProxyEndpointMapOutputWithContext(ctx context.Context) ProxyEndpointMapOutput {
   387  	return o
   388  }
   389  
   390  func (o ProxyEndpointMapOutput) MapIndex(k pulumi.StringInput) ProxyEndpointOutput {
   391  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ProxyEndpoint {
   392  		return vs[0].(map[string]*ProxyEndpoint)[vs[1].(string)]
   393  	}).(ProxyEndpointOutput)
   394  }
   395  
   396  func init() {
   397  	pulumi.RegisterInputType(reflect.TypeOf((*ProxyEndpointInput)(nil)).Elem(), &ProxyEndpoint{})
   398  	pulumi.RegisterInputType(reflect.TypeOf((*ProxyEndpointArrayInput)(nil)).Elem(), ProxyEndpointArray{})
   399  	pulumi.RegisterInputType(reflect.TypeOf((*ProxyEndpointMapInput)(nil)).Elem(), ProxyEndpointMap{})
   400  	pulumi.RegisterOutputType(ProxyEndpointOutput{})
   401  	pulumi.RegisterOutputType(ProxyEndpointArrayOutput{})
   402  	pulumi.RegisterOutputType(ProxyEndpointMapOutput{})
   403  }