github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/rds/getClusterSnapshot.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 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 11 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 12 ) 13 14 // Use this data source to get information about a DB Cluster Snapshot for use when provisioning DB clusters. 15 // 16 // > **NOTE:** This data source does not apply to snapshots created on DB Instances. 17 // See the `rds.Snapshot` data source for DB Instance snapshots. 18 // 19 // ## Example Usage 20 // 21 // <!--Start PulumiCodeChooser --> 22 // ```go 23 // package main 24 // 25 // import ( 26 // 27 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/rds" 28 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 29 // 30 // ) 31 // 32 // func main() { 33 // pulumi.Run(func(ctx *pulumi.Context) error { 34 // developmentFinalSnapshot, err := rds.LookupClusterSnapshot(ctx, &rds.LookupClusterSnapshotArgs{ 35 // DbClusterIdentifier: pulumi.StringRef("development_cluster"), 36 // MostRecent: pulumi.BoolRef(true), 37 // }, nil) 38 // if err != nil { 39 // return err 40 // } 41 // // Use the last snapshot of the dev database before it was destroyed to create 42 // // a new dev database. 43 // aurora, err := rds.NewCluster(ctx, "aurora", &rds.ClusterArgs{ 44 // ClusterIdentifier: pulumi.String("development_cluster"), 45 // SnapshotIdentifier: pulumi.String(developmentFinalSnapshot.Id), 46 // DbSubnetGroupName: pulumi.String("my_db_subnet_group"), 47 // }) 48 // if err != nil { 49 // return err 50 // } 51 // _, err = rds.NewClusterInstance(ctx, "aurora", &rds.ClusterInstanceArgs{ 52 // ClusterIdentifier: aurora.ID(), 53 // InstanceClass: pulumi.String(rds.InstanceType_T2_Small), 54 // DbSubnetGroupName: pulumi.String("my_db_subnet_group"), 55 // }) 56 // if err != nil { 57 // return err 58 // } 59 // return nil 60 // }) 61 // } 62 // 63 // ``` 64 // <!--End PulumiCodeChooser --> 65 func LookupClusterSnapshot(ctx *pulumi.Context, args *LookupClusterSnapshotArgs, opts ...pulumi.InvokeOption) (*LookupClusterSnapshotResult, error) { 66 opts = internal.PkgInvokeDefaultOpts(opts) 67 var rv LookupClusterSnapshotResult 68 err := ctx.Invoke("aws:rds/getClusterSnapshot:getClusterSnapshot", args, &rv, opts...) 69 if err != nil { 70 return nil, err 71 } 72 return &rv, nil 73 } 74 75 // A collection of arguments for invoking getClusterSnapshot. 76 type LookupClusterSnapshotArgs struct { 77 // Returns the list of snapshots created by the specific db_cluster 78 DbClusterIdentifier *string `pulumi:"dbClusterIdentifier"` 79 // Returns information on a specific snapshot_id. 80 DbClusterSnapshotIdentifier *string `pulumi:"dbClusterSnapshotIdentifier"` 81 // Set this value to true to include manual DB Cluster Snapshots that are public and can be 82 // copied or restored by any AWS account, otherwise set this value to false. The default is `false`. 83 IncludePublic *bool `pulumi:"includePublic"` 84 // Set this value to true to include shared manual DB Cluster Snapshots from other 85 // AWS accounts that this AWS account has been given permission to copy or restore, otherwise set this value to false. 86 // The default is `false`. 87 IncludeShared *bool `pulumi:"includeShared"` 88 // If more than one result is returned, use the most recent Snapshot. 89 MostRecent *bool `pulumi:"mostRecent"` 90 // Type of snapshots to be returned. If you don't specify a SnapshotType 91 // value, then both automated and manual DB cluster snapshots are returned. Shared and public DB Cluster Snapshots are not 92 // included in the returned results by default. Possible values are, `automated`, `manual`, `shared`, `public` and `awsbackup`. 93 SnapshotType *string `pulumi:"snapshotType"` 94 // Mapping of tags, each pair of which must exactly match 95 // a pair on the desired DB cluster snapshot. 96 Tags map[string]string `pulumi:"tags"` 97 } 98 99 // A collection of values returned by getClusterSnapshot. 100 type LookupClusterSnapshotResult struct { 101 // Allocated storage size in gigabytes (GB). 102 AllocatedStorage int `pulumi:"allocatedStorage"` 103 // List of EC2 Availability Zones that instances in the DB cluster snapshot can be restored in. 104 AvailabilityZones []string `pulumi:"availabilityZones"` 105 // Specifies the DB cluster identifier of the DB cluster that this DB cluster snapshot was created from. 106 DbClusterIdentifier *string `pulumi:"dbClusterIdentifier"` 107 // The ARN for the DB Cluster Snapshot. 108 DbClusterSnapshotArn string `pulumi:"dbClusterSnapshotArn"` 109 DbClusterSnapshotIdentifier *string `pulumi:"dbClusterSnapshotIdentifier"` 110 // Name of the database engine. 111 Engine string `pulumi:"engine"` 112 // Version of the database engine for this DB cluster snapshot. 113 EngineVersion string `pulumi:"engineVersion"` 114 // The provider-assigned unique ID for this managed resource. 115 Id string `pulumi:"id"` 116 IncludePublic *bool `pulumi:"includePublic"` 117 IncludeShared *bool `pulumi:"includeShared"` 118 // If storageEncrypted is true, the AWS KMS key identifier for the encrypted DB cluster snapshot. 119 KmsKeyId string `pulumi:"kmsKeyId"` 120 // License model information for the restored DB cluster. 121 LicenseModel string `pulumi:"licenseModel"` 122 MostRecent *bool `pulumi:"mostRecent"` 123 // Port that the DB cluster was listening on at the time of the snapshot. 124 Port int `pulumi:"port"` 125 // Time when the snapshot was taken, in Universal Coordinated Time (UTC). 126 SnapshotCreateTime string `pulumi:"snapshotCreateTime"` 127 SnapshotType *string `pulumi:"snapshotType"` 128 SourceDbClusterSnapshotArn string `pulumi:"sourceDbClusterSnapshotArn"` 129 // Status of this DB Cluster Snapshot. 130 Status string `pulumi:"status"` 131 // Whether the DB cluster snapshot is encrypted. 132 StorageEncrypted bool `pulumi:"storageEncrypted"` 133 // Map of tags for the resource. 134 Tags map[string]string `pulumi:"tags"` 135 // VPC ID associated with the DB cluster snapshot. 136 VpcId string `pulumi:"vpcId"` 137 } 138 139 func LookupClusterSnapshotOutput(ctx *pulumi.Context, args LookupClusterSnapshotOutputArgs, opts ...pulumi.InvokeOption) LookupClusterSnapshotResultOutput { 140 return pulumi.ToOutputWithContext(context.Background(), args). 141 ApplyT(func(v interface{}) (LookupClusterSnapshotResult, error) { 142 args := v.(LookupClusterSnapshotArgs) 143 r, err := LookupClusterSnapshot(ctx, &args, opts...) 144 var s LookupClusterSnapshotResult 145 if r != nil { 146 s = *r 147 } 148 return s, err 149 }).(LookupClusterSnapshotResultOutput) 150 } 151 152 // A collection of arguments for invoking getClusterSnapshot. 153 type LookupClusterSnapshotOutputArgs struct { 154 // Returns the list of snapshots created by the specific db_cluster 155 DbClusterIdentifier pulumi.StringPtrInput `pulumi:"dbClusterIdentifier"` 156 // Returns information on a specific snapshot_id. 157 DbClusterSnapshotIdentifier pulumi.StringPtrInput `pulumi:"dbClusterSnapshotIdentifier"` 158 // Set this value to true to include manual DB Cluster Snapshots that are public and can be 159 // copied or restored by any AWS account, otherwise set this value to false. The default is `false`. 160 IncludePublic pulumi.BoolPtrInput `pulumi:"includePublic"` 161 // Set this value to true to include shared manual DB Cluster Snapshots from other 162 // AWS accounts that this AWS account has been given permission to copy or restore, otherwise set this value to false. 163 // The default is `false`. 164 IncludeShared pulumi.BoolPtrInput `pulumi:"includeShared"` 165 // If more than one result is returned, use the most recent Snapshot. 166 MostRecent pulumi.BoolPtrInput `pulumi:"mostRecent"` 167 // Type of snapshots to be returned. If you don't specify a SnapshotType 168 // value, then both automated and manual DB cluster snapshots are returned. Shared and public DB Cluster Snapshots are not 169 // included in the returned results by default. Possible values are, `automated`, `manual`, `shared`, `public` and `awsbackup`. 170 SnapshotType pulumi.StringPtrInput `pulumi:"snapshotType"` 171 // Mapping of tags, each pair of which must exactly match 172 // a pair on the desired DB cluster snapshot. 173 Tags pulumi.StringMapInput `pulumi:"tags"` 174 } 175 176 func (LookupClusterSnapshotOutputArgs) ElementType() reflect.Type { 177 return reflect.TypeOf((*LookupClusterSnapshotArgs)(nil)).Elem() 178 } 179 180 // A collection of values returned by getClusterSnapshot. 181 type LookupClusterSnapshotResultOutput struct{ *pulumi.OutputState } 182 183 func (LookupClusterSnapshotResultOutput) ElementType() reflect.Type { 184 return reflect.TypeOf((*LookupClusterSnapshotResult)(nil)).Elem() 185 } 186 187 func (o LookupClusterSnapshotResultOutput) ToLookupClusterSnapshotResultOutput() LookupClusterSnapshotResultOutput { 188 return o 189 } 190 191 func (o LookupClusterSnapshotResultOutput) ToLookupClusterSnapshotResultOutputWithContext(ctx context.Context) LookupClusterSnapshotResultOutput { 192 return o 193 } 194 195 // Allocated storage size in gigabytes (GB). 196 func (o LookupClusterSnapshotResultOutput) AllocatedStorage() pulumi.IntOutput { 197 return o.ApplyT(func(v LookupClusterSnapshotResult) int { return v.AllocatedStorage }).(pulumi.IntOutput) 198 } 199 200 // List of EC2 Availability Zones that instances in the DB cluster snapshot can be restored in. 201 func (o LookupClusterSnapshotResultOutput) AvailabilityZones() pulumi.StringArrayOutput { 202 return o.ApplyT(func(v LookupClusterSnapshotResult) []string { return v.AvailabilityZones }).(pulumi.StringArrayOutput) 203 } 204 205 // Specifies the DB cluster identifier of the DB cluster that this DB cluster snapshot was created from. 206 func (o LookupClusterSnapshotResultOutput) DbClusterIdentifier() pulumi.StringPtrOutput { 207 return o.ApplyT(func(v LookupClusterSnapshotResult) *string { return v.DbClusterIdentifier }).(pulumi.StringPtrOutput) 208 } 209 210 // The ARN for the DB Cluster Snapshot. 211 func (o LookupClusterSnapshotResultOutput) DbClusterSnapshotArn() pulumi.StringOutput { 212 return o.ApplyT(func(v LookupClusterSnapshotResult) string { return v.DbClusterSnapshotArn }).(pulumi.StringOutput) 213 } 214 215 func (o LookupClusterSnapshotResultOutput) DbClusterSnapshotIdentifier() pulumi.StringPtrOutput { 216 return o.ApplyT(func(v LookupClusterSnapshotResult) *string { return v.DbClusterSnapshotIdentifier }).(pulumi.StringPtrOutput) 217 } 218 219 // Name of the database engine. 220 func (o LookupClusterSnapshotResultOutput) Engine() pulumi.StringOutput { 221 return o.ApplyT(func(v LookupClusterSnapshotResult) string { return v.Engine }).(pulumi.StringOutput) 222 } 223 224 // Version of the database engine for this DB cluster snapshot. 225 func (o LookupClusterSnapshotResultOutput) EngineVersion() pulumi.StringOutput { 226 return o.ApplyT(func(v LookupClusterSnapshotResult) string { return v.EngineVersion }).(pulumi.StringOutput) 227 } 228 229 // The provider-assigned unique ID for this managed resource. 230 func (o LookupClusterSnapshotResultOutput) Id() pulumi.StringOutput { 231 return o.ApplyT(func(v LookupClusterSnapshotResult) string { return v.Id }).(pulumi.StringOutput) 232 } 233 234 func (o LookupClusterSnapshotResultOutput) IncludePublic() pulumi.BoolPtrOutput { 235 return o.ApplyT(func(v LookupClusterSnapshotResult) *bool { return v.IncludePublic }).(pulumi.BoolPtrOutput) 236 } 237 238 func (o LookupClusterSnapshotResultOutput) IncludeShared() pulumi.BoolPtrOutput { 239 return o.ApplyT(func(v LookupClusterSnapshotResult) *bool { return v.IncludeShared }).(pulumi.BoolPtrOutput) 240 } 241 242 // If storageEncrypted is true, the AWS KMS key identifier for the encrypted DB cluster snapshot. 243 func (o LookupClusterSnapshotResultOutput) KmsKeyId() pulumi.StringOutput { 244 return o.ApplyT(func(v LookupClusterSnapshotResult) string { return v.KmsKeyId }).(pulumi.StringOutput) 245 } 246 247 // License model information for the restored DB cluster. 248 func (o LookupClusterSnapshotResultOutput) LicenseModel() pulumi.StringOutput { 249 return o.ApplyT(func(v LookupClusterSnapshotResult) string { return v.LicenseModel }).(pulumi.StringOutput) 250 } 251 252 func (o LookupClusterSnapshotResultOutput) MostRecent() pulumi.BoolPtrOutput { 253 return o.ApplyT(func(v LookupClusterSnapshotResult) *bool { return v.MostRecent }).(pulumi.BoolPtrOutput) 254 } 255 256 // Port that the DB cluster was listening on at the time of the snapshot. 257 func (o LookupClusterSnapshotResultOutput) Port() pulumi.IntOutput { 258 return o.ApplyT(func(v LookupClusterSnapshotResult) int { return v.Port }).(pulumi.IntOutput) 259 } 260 261 // Time when the snapshot was taken, in Universal Coordinated Time (UTC). 262 func (o LookupClusterSnapshotResultOutput) SnapshotCreateTime() pulumi.StringOutput { 263 return o.ApplyT(func(v LookupClusterSnapshotResult) string { return v.SnapshotCreateTime }).(pulumi.StringOutput) 264 } 265 266 func (o LookupClusterSnapshotResultOutput) SnapshotType() pulumi.StringPtrOutput { 267 return o.ApplyT(func(v LookupClusterSnapshotResult) *string { return v.SnapshotType }).(pulumi.StringPtrOutput) 268 } 269 270 func (o LookupClusterSnapshotResultOutput) SourceDbClusterSnapshotArn() pulumi.StringOutput { 271 return o.ApplyT(func(v LookupClusterSnapshotResult) string { return v.SourceDbClusterSnapshotArn }).(pulumi.StringOutput) 272 } 273 274 // Status of this DB Cluster Snapshot. 275 func (o LookupClusterSnapshotResultOutput) Status() pulumi.StringOutput { 276 return o.ApplyT(func(v LookupClusterSnapshotResult) string { return v.Status }).(pulumi.StringOutput) 277 } 278 279 // Whether the DB cluster snapshot is encrypted. 280 func (o LookupClusterSnapshotResultOutput) StorageEncrypted() pulumi.BoolOutput { 281 return o.ApplyT(func(v LookupClusterSnapshotResult) bool { return v.StorageEncrypted }).(pulumi.BoolOutput) 282 } 283 284 // Map of tags for the resource. 285 func (o LookupClusterSnapshotResultOutput) Tags() pulumi.StringMapOutput { 286 return o.ApplyT(func(v LookupClusterSnapshotResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput) 287 } 288 289 // VPC ID associated with the DB cluster snapshot. 290 func (o LookupClusterSnapshotResultOutput) VpcId() pulumi.StringOutput { 291 return o.ApplyT(func(v LookupClusterSnapshotResult) string { return v.VpcId }).(pulumi.StringOutput) 292 } 293 294 func init() { 295 pulumi.RegisterOutputType(LookupClusterSnapshotResultOutput{}) 296 }