github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/redshift/getClusterCredentials.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 redshift 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 cluster temporary credentials. 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/redshift" 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 := redshift.GetClusterCredentials(ctx, &redshift.GetClusterCredentialsArgs{ 32 // ClusterIdentifier: exampleAwsRedshiftCluster.ClusterIdentifier, 33 // DbUser: exampleAwsRedshiftCluster.MasterUsername, 34 // }, nil) 35 // if err != nil { 36 // return err 37 // } 38 // return nil 39 // }) 40 // } 41 // 42 // ``` 43 // <!--End PulumiCodeChooser --> 44 func GetClusterCredentials(ctx *pulumi.Context, args *GetClusterCredentialsArgs, opts ...pulumi.InvokeOption) (*GetClusterCredentialsResult, error) { 45 opts = internal.PkgInvokeDefaultOpts(opts) 46 var rv GetClusterCredentialsResult 47 err := ctx.Invoke("aws:redshift/getClusterCredentials:getClusterCredentials", args, &rv, opts...) 48 if err != nil { 49 return nil, err 50 } 51 return &rv, nil 52 } 53 54 // A collection of arguments for invoking getClusterCredentials. 55 type GetClusterCredentialsArgs struct { 56 // Create a database user with the name specified for the user named in `dbUser` if one does not exist. 57 AutoCreate *bool `pulumi:"autoCreate"` 58 // Unique identifier of the cluster that contains the database for which your are requesting credentials. 59 ClusterIdentifier string `pulumi:"clusterIdentifier"` 60 // List of the names of existing database groups that the user named in `dbUser` will join for the current session, in addition to any group memberships for an existing user. If not specified, a new user is added only to `PUBLIC`. 61 DbGroups []string `pulumi:"dbGroups"` 62 // Name of a database that DbUser is authorized to log on to. If `dbName` is not specified, `dbUser` can log on to any existing database. 63 DbName *string `pulumi:"dbName"` 64 // Name of a database user. If a user name matching `dbUser` exists in the database, the temporary user credentials have the same permissions as the existing user. If `dbUser` doesn't exist in the database and `autoCreate` is `True`, a new user is created using the value for `dbUser` with `PUBLIC` permissions. If a database user matching the value for `dbUser` doesn't exist and `not` is `False`, then the command succeeds but the connection attempt will fail because the user doesn't exist in the database. 65 DbUser string `pulumi:"dbUser"` 66 // The number of seconds until the returned temporary password expires. Valid values are between `900` and `3600`. Default value is `900`. 67 DurationSeconds *int `pulumi:"durationSeconds"` 68 } 69 70 // A collection of values returned by getClusterCredentials. 71 type GetClusterCredentialsResult struct { 72 AutoCreate *bool `pulumi:"autoCreate"` 73 ClusterIdentifier string `pulumi:"clusterIdentifier"` 74 DbGroups []string `pulumi:"dbGroups"` 75 DbName *string `pulumi:"dbName"` 76 // Temporary password that authorizes the user name returned by `dbUser` to log on to the database `dbName`. 77 DbPassword string `pulumi:"dbPassword"` 78 DbUser string `pulumi:"dbUser"` 79 DurationSeconds *int `pulumi:"durationSeconds"` 80 // Date and time the password in `dbPassword` expires. 81 Expiration string `pulumi:"expiration"` 82 // The provider-assigned unique ID for this managed resource. 83 Id string `pulumi:"id"` 84 } 85 86 func GetClusterCredentialsOutput(ctx *pulumi.Context, args GetClusterCredentialsOutputArgs, opts ...pulumi.InvokeOption) GetClusterCredentialsResultOutput { 87 return pulumi.ToOutputWithContext(context.Background(), args). 88 ApplyT(func(v interface{}) (GetClusterCredentialsResult, error) { 89 args := v.(GetClusterCredentialsArgs) 90 r, err := GetClusterCredentials(ctx, &args, opts...) 91 var s GetClusterCredentialsResult 92 if r != nil { 93 s = *r 94 } 95 return s, err 96 }).(GetClusterCredentialsResultOutput) 97 } 98 99 // A collection of arguments for invoking getClusterCredentials. 100 type GetClusterCredentialsOutputArgs struct { 101 // Create a database user with the name specified for the user named in `dbUser` if one does not exist. 102 AutoCreate pulumi.BoolPtrInput `pulumi:"autoCreate"` 103 // Unique identifier of the cluster that contains the database for which your are requesting credentials. 104 ClusterIdentifier pulumi.StringInput `pulumi:"clusterIdentifier"` 105 // List of the names of existing database groups that the user named in `dbUser` will join for the current session, in addition to any group memberships for an existing user. If not specified, a new user is added only to `PUBLIC`. 106 DbGroups pulumi.StringArrayInput `pulumi:"dbGroups"` 107 // Name of a database that DbUser is authorized to log on to. If `dbName` is not specified, `dbUser` can log on to any existing database. 108 DbName pulumi.StringPtrInput `pulumi:"dbName"` 109 // Name of a database user. If a user name matching `dbUser` exists in the database, the temporary user credentials have the same permissions as the existing user. If `dbUser` doesn't exist in the database and `autoCreate` is `True`, a new user is created using the value for `dbUser` with `PUBLIC` permissions. If a database user matching the value for `dbUser` doesn't exist and `not` is `False`, then the command succeeds but the connection attempt will fail because the user doesn't exist in the database. 110 DbUser pulumi.StringInput `pulumi:"dbUser"` 111 // The number of seconds until the returned temporary password expires. Valid values are between `900` and `3600`. Default value is `900`. 112 DurationSeconds pulumi.IntPtrInput `pulumi:"durationSeconds"` 113 } 114 115 func (GetClusterCredentialsOutputArgs) ElementType() reflect.Type { 116 return reflect.TypeOf((*GetClusterCredentialsArgs)(nil)).Elem() 117 } 118 119 // A collection of values returned by getClusterCredentials. 120 type GetClusterCredentialsResultOutput struct{ *pulumi.OutputState } 121 122 func (GetClusterCredentialsResultOutput) ElementType() reflect.Type { 123 return reflect.TypeOf((*GetClusterCredentialsResult)(nil)).Elem() 124 } 125 126 func (o GetClusterCredentialsResultOutput) ToGetClusterCredentialsResultOutput() GetClusterCredentialsResultOutput { 127 return o 128 } 129 130 func (o GetClusterCredentialsResultOutput) ToGetClusterCredentialsResultOutputWithContext(ctx context.Context) GetClusterCredentialsResultOutput { 131 return o 132 } 133 134 func (o GetClusterCredentialsResultOutput) AutoCreate() pulumi.BoolPtrOutput { 135 return o.ApplyT(func(v GetClusterCredentialsResult) *bool { return v.AutoCreate }).(pulumi.BoolPtrOutput) 136 } 137 138 func (o GetClusterCredentialsResultOutput) ClusterIdentifier() pulumi.StringOutput { 139 return o.ApplyT(func(v GetClusterCredentialsResult) string { return v.ClusterIdentifier }).(pulumi.StringOutput) 140 } 141 142 func (o GetClusterCredentialsResultOutput) DbGroups() pulumi.StringArrayOutput { 143 return o.ApplyT(func(v GetClusterCredentialsResult) []string { return v.DbGroups }).(pulumi.StringArrayOutput) 144 } 145 146 func (o GetClusterCredentialsResultOutput) DbName() pulumi.StringPtrOutput { 147 return o.ApplyT(func(v GetClusterCredentialsResult) *string { return v.DbName }).(pulumi.StringPtrOutput) 148 } 149 150 // Temporary password that authorizes the user name returned by `dbUser` to log on to the database `dbName`. 151 func (o GetClusterCredentialsResultOutput) DbPassword() pulumi.StringOutput { 152 return o.ApplyT(func(v GetClusterCredentialsResult) string { return v.DbPassword }).(pulumi.StringOutput) 153 } 154 155 func (o GetClusterCredentialsResultOutput) DbUser() pulumi.StringOutput { 156 return o.ApplyT(func(v GetClusterCredentialsResult) string { return v.DbUser }).(pulumi.StringOutput) 157 } 158 159 func (o GetClusterCredentialsResultOutput) DurationSeconds() pulumi.IntPtrOutput { 160 return o.ApplyT(func(v GetClusterCredentialsResult) *int { return v.DurationSeconds }).(pulumi.IntPtrOutput) 161 } 162 163 // Date and time the password in `dbPassword` expires. 164 func (o GetClusterCredentialsResultOutput) Expiration() pulumi.StringOutput { 165 return o.ApplyT(func(v GetClusterCredentialsResult) string { return v.Expiration }).(pulumi.StringOutput) 166 } 167 168 // The provider-assigned unique ID for this managed resource. 169 func (o GetClusterCredentialsResultOutput) Id() pulumi.StringOutput { 170 return o.ApplyT(func(v GetClusterCredentialsResult) string { return v.Id }).(pulumi.StringOutput) 171 } 172 173 func init() { 174 pulumi.RegisterOutputType(GetClusterCredentialsResultOutput{}) 175 }