github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/redshiftserverless/getCredentials.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 redshiftserverless
     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 redshift serverless temporary credentials for a workgroup.
    15  //
    16  // ## Example Usage
    17  //
    18  // <!--Start PulumiCodeChooser -->
    19  // ```go
    20  // package main
    21  //
    22  // import (
    23  //
    24  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/redshiftserverless"
    25  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    26  //
    27  // )
    28  //
    29  //	func main() {
    30  //		pulumi.Run(func(ctx *pulumi.Context) error {
    31  //			_, err := redshiftserverless.GetCredentials(ctx, &redshiftserverless.GetCredentialsArgs{
    32  //				WorkgroupName: exampleAwsRedshiftserverlessWorkgroup.WorkgroupName,
    33  //			}, nil)
    34  //			if err != nil {
    35  //				return err
    36  //			}
    37  //			return nil
    38  //		})
    39  //	}
    40  //
    41  // ```
    42  // <!--End PulumiCodeChooser -->
    43  func GetCredentials(ctx *pulumi.Context, args *GetCredentialsArgs, opts ...pulumi.InvokeOption) (*GetCredentialsResult, error) {
    44  	opts = internal.PkgInvokeDefaultOpts(opts)
    45  	var rv GetCredentialsResult
    46  	err := ctx.Invoke("aws:redshiftserverless/getCredentials:getCredentials", args, &rv, opts...)
    47  	if err != nil {
    48  		return nil, err
    49  	}
    50  	return &rv, nil
    51  }
    52  
    53  // A collection of arguments for invoking getCredentials.
    54  type GetCredentialsArgs struct {
    55  	// The name of the database to get temporary authorization to log on to.
    56  	DbName *string `pulumi:"dbName"`
    57  	// The number of seconds until the returned temporary password expires. The minimum is 900 seconds, and the maximum is 3600 seconds.
    58  	DurationSeconds *int `pulumi:"durationSeconds"`
    59  	// The name of the workgroup associated with the database.
    60  	WorkgroupName string `pulumi:"workgroupName"`
    61  }
    62  
    63  // A collection of values returned by getCredentials.
    64  type GetCredentialsResult struct {
    65  	DbName *string `pulumi:"dbName"`
    66  	// Temporary password that authorizes the user name returned by `dbUser` to log on to the database `dbName`.
    67  	DbPassword string `pulumi:"dbPassword"`
    68  	// A database user name that is authorized to log on to the database `dbName` using the password `dbPassword` . If the specified `dbUser` exists in the database, the new user name has the same database privileges as the user named in `dbUser` . By default, the user is added to PUBLIC. the user doesn't exist in the database.
    69  	DbUser          string `pulumi:"dbUser"`
    70  	DurationSeconds *int   `pulumi:"durationSeconds"`
    71  	// Date and time the password in `dbPassword` expires.
    72  	Expiration string `pulumi:"expiration"`
    73  	// The provider-assigned unique ID for this managed resource.
    74  	Id            string `pulumi:"id"`
    75  	WorkgroupName string `pulumi:"workgroupName"`
    76  }
    77  
    78  func GetCredentialsOutput(ctx *pulumi.Context, args GetCredentialsOutputArgs, opts ...pulumi.InvokeOption) GetCredentialsResultOutput {
    79  	return pulumi.ToOutputWithContext(context.Background(), args).
    80  		ApplyT(func(v interface{}) (GetCredentialsResult, error) {
    81  			args := v.(GetCredentialsArgs)
    82  			r, err := GetCredentials(ctx, &args, opts...)
    83  			var s GetCredentialsResult
    84  			if r != nil {
    85  				s = *r
    86  			}
    87  			return s, err
    88  		}).(GetCredentialsResultOutput)
    89  }
    90  
    91  // A collection of arguments for invoking getCredentials.
    92  type GetCredentialsOutputArgs struct {
    93  	// The name of the database to get temporary authorization to log on to.
    94  	DbName pulumi.StringPtrInput `pulumi:"dbName"`
    95  	// The number of seconds until the returned temporary password expires. The minimum is 900 seconds, and the maximum is 3600 seconds.
    96  	DurationSeconds pulumi.IntPtrInput `pulumi:"durationSeconds"`
    97  	// The name of the workgroup associated with the database.
    98  	WorkgroupName pulumi.StringInput `pulumi:"workgroupName"`
    99  }
   100  
   101  func (GetCredentialsOutputArgs) ElementType() reflect.Type {
   102  	return reflect.TypeOf((*GetCredentialsArgs)(nil)).Elem()
   103  }
   104  
   105  // A collection of values returned by getCredentials.
   106  type GetCredentialsResultOutput struct{ *pulumi.OutputState }
   107  
   108  func (GetCredentialsResultOutput) ElementType() reflect.Type {
   109  	return reflect.TypeOf((*GetCredentialsResult)(nil)).Elem()
   110  }
   111  
   112  func (o GetCredentialsResultOutput) ToGetCredentialsResultOutput() GetCredentialsResultOutput {
   113  	return o
   114  }
   115  
   116  func (o GetCredentialsResultOutput) ToGetCredentialsResultOutputWithContext(ctx context.Context) GetCredentialsResultOutput {
   117  	return o
   118  }
   119  
   120  func (o GetCredentialsResultOutput) DbName() pulumi.StringPtrOutput {
   121  	return o.ApplyT(func(v GetCredentialsResult) *string { return v.DbName }).(pulumi.StringPtrOutput)
   122  }
   123  
   124  // Temporary password that authorizes the user name returned by `dbUser` to log on to the database `dbName`.
   125  func (o GetCredentialsResultOutput) DbPassword() pulumi.StringOutput {
   126  	return o.ApplyT(func(v GetCredentialsResult) string { return v.DbPassword }).(pulumi.StringOutput)
   127  }
   128  
   129  // A database user name that is authorized to log on to the database `dbName` using the password `dbPassword` . If the specified `dbUser` exists in the database, the new user name has the same database privileges as the user named in `dbUser` . By default, the user is added to PUBLIC. the user doesn't exist in the database.
   130  func (o GetCredentialsResultOutput) DbUser() pulumi.StringOutput {
   131  	return o.ApplyT(func(v GetCredentialsResult) string { return v.DbUser }).(pulumi.StringOutput)
   132  }
   133  
   134  func (o GetCredentialsResultOutput) DurationSeconds() pulumi.IntPtrOutput {
   135  	return o.ApplyT(func(v GetCredentialsResult) *int { return v.DurationSeconds }).(pulumi.IntPtrOutput)
   136  }
   137  
   138  // Date and time the password in `dbPassword` expires.
   139  func (o GetCredentialsResultOutput) Expiration() pulumi.StringOutput {
   140  	return o.ApplyT(func(v GetCredentialsResult) string { return v.Expiration }).(pulumi.StringOutput)
   141  }
   142  
   143  // The provider-assigned unique ID for this managed resource.
   144  func (o GetCredentialsResultOutput) Id() pulumi.StringOutput {
   145  	return o.ApplyT(func(v GetCredentialsResult) string { return v.Id }).(pulumi.StringOutput)
   146  }
   147  
   148  func (o GetCredentialsResultOutput) WorkgroupName() pulumi.StringOutput {
   149  	return o.ApplyT(func(v GetCredentialsResult) string { return v.WorkgroupName }).(pulumi.StringOutput)
   150  }
   151  
   152  func init() {
   153  	pulumi.RegisterOutputType(GetCredentialsResultOutput{})
   154  }