github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/opsworks/rdsDbInstance.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 opsworks
     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 OpsWorks RDS DB Instance 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/opsworks"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			_, err := opsworks.NewRdsDbInstance(ctx, "my_instance", &opsworks.RdsDbInstanceArgs{
    33  //				StackId:          pulumi.Any(myStack.Id),
    34  //				RdsDbInstanceArn: pulumi.Any(myInstanceAwsDbInstance.Arn),
    35  //				DbUser:           pulumi.String("someUser"),
    36  //				DbPassword:       pulumi.String("somePass"),
    37  //			})
    38  //			if err != nil {
    39  //				return err
    40  //			}
    41  //			return nil
    42  //		})
    43  //	}
    44  //
    45  // ```
    46  // <!--End PulumiCodeChooser -->
    47  type RdsDbInstance struct {
    48  	pulumi.CustomResourceState
    49  
    50  	// A db password
    51  	DbPassword pulumi.StringOutput `pulumi:"dbPassword"`
    52  	// A db username
    53  	DbUser pulumi.StringOutput `pulumi:"dbUser"`
    54  	// The db instance to register for this stack. Changing this will force a new resource.
    55  	RdsDbInstanceArn pulumi.StringOutput `pulumi:"rdsDbInstanceArn"`
    56  	// The stack to register a db instance for. Changing this will force a new resource.
    57  	StackId pulumi.StringOutput `pulumi:"stackId"`
    58  }
    59  
    60  // NewRdsDbInstance registers a new resource with the given unique name, arguments, and options.
    61  func NewRdsDbInstance(ctx *pulumi.Context,
    62  	name string, args *RdsDbInstanceArgs, opts ...pulumi.ResourceOption) (*RdsDbInstance, error) {
    63  	if args == nil {
    64  		return nil, errors.New("missing one or more required arguments")
    65  	}
    66  
    67  	if args.DbPassword == nil {
    68  		return nil, errors.New("invalid value for required argument 'DbPassword'")
    69  	}
    70  	if args.DbUser == nil {
    71  		return nil, errors.New("invalid value for required argument 'DbUser'")
    72  	}
    73  	if args.RdsDbInstanceArn == nil {
    74  		return nil, errors.New("invalid value for required argument 'RdsDbInstanceArn'")
    75  	}
    76  	if args.StackId == nil {
    77  		return nil, errors.New("invalid value for required argument 'StackId'")
    78  	}
    79  	if args.DbPassword != nil {
    80  		args.DbPassword = pulumi.ToSecret(args.DbPassword).(pulumi.StringInput)
    81  	}
    82  	secrets := pulumi.AdditionalSecretOutputs([]string{
    83  		"dbPassword",
    84  	})
    85  	opts = append(opts, secrets)
    86  	opts = internal.PkgResourceDefaultOpts(opts)
    87  	var resource RdsDbInstance
    88  	err := ctx.RegisterResource("aws:opsworks/rdsDbInstance:RdsDbInstance", name, args, &resource, opts...)
    89  	if err != nil {
    90  		return nil, err
    91  	}
    92  	return &resource, nil
    93  }
    94  
    95  // GetRdsDbInstance gets an existing RdsDbInstance resource's state with the given name, ID, and optional
    96  // state properties that are used to uniquely qualify the lookup (nil if not required).
    97  func GetRdsDbInstance(ctx *pulumi.Context,
    98  	name string, id pulumi.IDInput, state *RdsDbInstanceState, opts ...pulumi.ResourceOption) (*RdsDbInstance, error) {
    99  	var resource RdsDbInstance
   100  	err := ctx.ReadResource("aws:opsworks/rdsDbInstance:RdsDbInstance", name, id, state, &resource, opts...)
   101  	if err != nil {
   102  		return nil, err
   103  	}
   104  	return &resource, nil
   105  }
   106  
   107  // Input properties used for looking up and filtering RdsDbInstance resources.
   108  type rdsDbInstanceState struct {
   109  	// A db password
   110  	DbPassword *string `pulumi:"dbPassword"`
   111  	// A db username
   112  	DbUser *string `pulumi:"dbUser"`
   113  	// The db instance to register for this stack. Changing this will force a new resource.
   114  	RdsDbInstanceArn *string `pulumi:"rdsDbInstanceArn"`
   115  	// The stack to register a db instance for. Changing this will force a new resource.
   116  	StackId *string `pulumi:"stackId"`
   117  }
   118  
   119  type RdsDbInstanceState struct {
   120  	// A db password
   121  	DbPassword pulumi.StringPtrInput
   122  	// A db username
   123  	DbUser pulumi.StringPtrInput
   124  	// The db instance to register for this stack. Changing this will force a new resource.
   125  	RdsDbInstanceArn pulumi.StringPtrInput
   126  	// The stack to register a db instance for. Changing this will force a new resource.
   127  	StackId pulumi.StringPtrInput
   128  }
   129  
   130  func (RdsDbInstanceState) ElementType() reflect.Type {
   131  	return reflect.TypeOf((*rdsDbInstanceState)(nil)).Elem()
   132  }
   133  
   134  type rdsDbInstanceArgs struct {
   135  	// A db password
   136  	DbPassword string `pulumi:"dbPassword"`
   137  	// A db username
   138  	DbUser string `pulumi:"dbUser"`
   139  	// The db instance to register for this stack. Changing this will force a new resource.
   140  	RdsDbInstanceArn string `pulumi:"rdsDbInstanceArn"`
   141  	// The stack to register a db instance for. Changing this will force a new resource.
   142  	StackId string `pulumi:"stackId"`
   143  }
   144  
   145  // The set of arguments for constructing a RdsDbInstance resource.
   146  type RdsDbInstanceArgs struct {
   147  	// A db password
   148  	DbPassword pulumi.StringInput
   149  	// A db username
   150  	DbUser pulumi.StringInput
   151  	// The db instance to register for this stack. Changing this will force a new resource.
   152  	RdsDbInstanceArn pulumi.StringInput
   153  	// The stack to register a db instance for. Changing this will force a new resource.
   154  	StackId pulumi.StringInput
   155  }
   156  
   157  func (RdsDbInstanceArgs) ElementType() reflect.Type {
   158  	return reflect.TypeOf((*rdsDbInstanceArgs)(nil)).Elem()
   159  }
   160  
   161  type RdsDbInstanceInput interface {
   162  	pulumi.Input
   163  
   164  	ToRdsDbInstanceOutput() RdsDbInstanceOutput
   165  	ToRdsDbInstanceOutputWithContext(ctx context.Context) RdsDbInstanceOutput
   166  }
   167  
   168  func (*RdsDbInstance) ElementType() reflect.Type {
   169  	return reflect.TypeOf((**RdsDbInstance)(nil)).Elem()
   170  }
   171  
   172  func (i *RdsDbInstance) ToRdsDbInstanceOutput() RdsDbInstanceOutput {
   173  	return i.ToRdsDbInstanceOutputWithContext(context.Background())
   174  }
   175  
   176  func (i *RdsDbInstance) ToRdsDbInstanceOutputWithContext(ctx context.Context) RdsDbInstanceOutput {
   177  	return pulumi.ToOutputWithContext(ctx, i).(RdsDbInstanceOutput)
   178  }
   179  
   180  // RdsDbInstanceArrayInput is an input type that accepts RdsDbInstanceArray and RdsDbInstanceArrayOutput values.
   181  // You can construct a concrete instance of `RdsDbInstanceArrayInput` via:
   182  //
   183  //	RdsDbInstanceArray{ RdsDbInstanceArgs{...} }
   184  type RdsDbInstanceArrayInput interface {
   185  	pulumi.Input
   186  
   187  	ToRdsDbInstanceArrayOutput() RdsDbInstanceArrayOutput
   188  	ToRdsDbInstanceArrayOutputWithContext(context.Context) RdsDbInstanceArrayOutput
   189  }
   190  
   191  type RdsDbInstanceArray []RdsDbInstanceInput
   192  
   193  func (RdsDbInstanceArray) ElementType() reflect.Type {
   194  	return reflect.TypeOf((*[]*RdsDbInstance)(nil)).Elem()
   195  }
   196  
   197  func (i RdsDbInstanceArray) ToRdsDbInstanceArrayOutput() RdsDbInstanceArrayOutput {
   198  	return i.ToRdsDbInstanceArrayOutputWithContext(context.Background())
   199  }
   200  
   201  func (i RdsDbInstanceArray) ToRdsDbInstanceArrayOutputWithContext(ctx context.Context) RdsDbInstanceArrayOutput {
   202  	return pulumi.ToOutputWithContext(ctx, i).(RdsDbInstanceArrayOutput)
   203  }
   204  
   205  // RdsDbInstanceMapInput is an input type that accepts RdsDbInstanceMap and RdsDbInstanceMapOutput values.
   206  // You can construct a concrete instance of `RdsDbInstanceMapInput` via:
   207  //
   208  //	RdsDbInstanceMap{ "key": RdsDbInstanceArgs{...} }
   209  type RdsDbInstanceMapInput interface {
   210  	pulumi.Input
   211  
   212  	ToRdsDbInstanceMapOutput() RdsDbInstanceMapOutput
   213  	ToRdsDbInstanceMapOutputWithContext(context.Context) RdsDbInstanceMapOutput
   214  }
   215  
   216  type RdsDbInstanceMap map[string]RdsDbInstanceInput
   217  
   218  func (RdsDbInstanceMap) ElementType() reflect.Type {
   219  	return reflect.TypeOf((*map[string]*RdsDbInstance)(nil)).Elem()
   220  }
   221  
   222  func (i RdsDbInstanceMap) ToRdsDbInstanceMapOutput() RdsDbInstanceMapOutput {
   223  	return i.ToRdsDbInstanceMapOutputWithContext(context.Background())
   224  }
   225  
   226  func (i RdsDbInstanceMap) ToRdsDbInstanceMapOutputWithContext(ctx context.Context) RdsDbInstanceMapOutput {
   227  	return pulumi.ToOutputWithContext(ctx, i).(RdsDbInstanceMapOutput)
   228  }
   229  
   230  type RdsDbInstanceOutput struct{ *pulumi.OutputState }
   231  
   232  func (RdsDbInstanceOutput) ElementType() reflect.Type {
   233  	return reflect.TypeOf((**RdsDbInstance)(nil)).Elem()
   234  }
   235  
   236  func (o RdsDbInstanceOutput) ToRdsDbInstanceOutput() RdsDbInstanceOutput {
   237  	return o
   238  }
   239  
   240  func (o RdsDbInstanceOutput) ToRdsDbInstanceOutputWithContext(ctx context.Context) RdsDbInstanceOutput {
   241  	return o
   242  }
   243  
   244  // A db password
   245  func (o RdsDbInstanceOutput) DbPassword() pulumi.StringOutput {
   246  	return o.ApplyT(func(v *RdsDbInstance) pulumi.StringOutput { return v.DbPassword }).(pulumi.StringOutput)
   247  }
   248  
   249  // A db username
   250  func (o RdsDbInstanceOutput) DbUser() pulumi.StringOutput {
   251  	return o.ApplyT(func(v *RdsDbInstance) pulumi.StringOutput { return v.DbUser }).(pulumi.StringOutput)
   252  }
   253  
   254  // The db instance to register for this stack. Changing this will force a new resource.
   255  func (o RdsDbInstanceOutput) RdsDbInstanceArn() pulumi.StringOutput {
   256  	return o.ApplyT(func(v *RdsDbInstance) pulumi.StringOutput { return v.RdsDbInstanceArn }).(pulumi.StringOutput)
   257  }
   258  
   259  // The stack to register a db instance for. Changing this will force a new resource.
   260  func (o RdsDbInstanceOutput) StackId() pulumi.StringOutput {
   261  	return o.ApplyT(func(v *RdsDbInstance) pulumi.StringOutput { return v.StackId }).(pulumi.StringOutput)
   262  }
   263  
   264  type RdsDbInstanceArrayOutput struct{ *pulumi.OutputState }
   265  
   266  func (RdsDbInstanceArrayOutput) ElementType() reflect.Type {
   267  	return reflect.TypeOf((*[]*RdsDbInstance)(nil)).Elem()
   268  }
   269  
   270  func (o RdsDbInstanceArrayOutput) ToRdsDbInstanceArrayOutput() RdsDbInstanceArrayOutput {
   271  	return o
   272  }
   273  
   274  func (o RdsDbInstanceArrayOutput) ToRdsDbInstanceArrayOutputWithContext(ctx context.Context) RdsDbInstanceArrayOutput {
   275  	return o
   276  }
   277  
   278  func (o RdsDbInstanceArrayOutput) Index(i pulumi.IntInput) RdsDbInstanceOutput {
   279  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *RdsDbInstance {
   280  		return vs[0].([]*RdsDbInstance)[vs[1].(int)]
   281  	}).(RdsDbInstanceOutput)
   282  }
   283  
   284  type RdsDbInstanceMapOutput struct{ *pulumi.OutputState }
   285  
   286  func (RdsDbInstanceMapOutput) ElementType() reflect.Type {
   287  	return reflect.TypeOf((*map[string]*RdsDbInstance)(nil)).Elem()
   288  }
   289  
   290  func (o RdsDbInstanceMapOutput) ToRdsDbInstanceMapOutput() RdsDbInstanceMapOutput {
   291  	return o
   292  }
   293  
   294  func (o RdsDbInstanceMapOutput) ToRdsDbInstanceMapOutputWithContext(ctx context.Context) RdsDbInstanceMapOutput {
   295  	return o
   296  }
   297  
   298  func (o RdsDbInstanceMapOutput) MapIndex(k pulumi.StringInput) RdsDbInstanceOutput {
   299  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *RdsDbInstance {
   300  		return vs[0].(map[string]*RdsDbInstance)[vs[1].(string)]
   301  	}).(RdsDbInstanceOutput)
   302  }
   303  
   304  func init() {
   305  	pulumi.RegisterInputType(reflect.TypeOf((*RdsDbInstanceInput)(nil)).Elem(), &RdsDbInstance{})
   306  	pulumi.RegisterInputType(reflect.TypeOf((*RdsDbInstanceArrayInput)(nil)).Elem(), RdsDbInstanceArray{})
   307  	pulumi.RegisterInputType(reflect.TypeOf((*RdsDbInstanceMapInput)(nil)).Elem(), RdsDbInstanceMap{})
   308  	pulumi.RegisterOutputType(RdsDbInstanceOutput{})
   309  	pulumi.RegisterOutputType(RdsDbInstanceArrayOutput{})
   310  	pulumi.RegisterOutputType(RdsDbInstanceMapOutput{})
   311  }