github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/redshiftserverless/snapshot.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 "errors" 11 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 12 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 13 ) 14 15 // Creates a new Amazon Redshift Serverless Snapshot. 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/redshiftserverless" 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 := redshiftserverless.NewSnapshot(ctx, "example", &redshiftserverless.SnapshotArgs{ 33 // NamespaceName: pulumi.Any(exampleAwsRedshiftserverlessWorkgroup.NamespaceName), 34 // SnapshotName: pulumi.String("example"), 35 // }) 36 // if err != nil { 37 // return err 38 // } 39 // return nil 40 // }) 41 // } 42 // 43 // ``` 44 // <!--End PulumiCodeChooser --> 45 // 46 // ## Import 47 // 48 // Using `pulumi import`, import Redshift Serverless Snapshots using the `snapshot_name`. For example: 49 // 50 // ```sh 51 // $ pulumi import aws:redshiftserverless/snapshot:Snapshot example example 52 // ``` 53 type Snapshot struct { 54 pulumi.CustomResourceState 55 56 // All of the Amazon Web Services accounts that have access to restore a snapshot to a provisioned cluster. 57 AccountsWithProvisionedRestoreAccesses pulumi.StringArrayOutput `pulumi:"accountsWithProvisionedRestoreAccesses"` 58 // All of the Amazon Web Services accounts that have access to restore a snapshot to a namespace. 59 AccountsWithRestoreAccesses pulumi.StringArrayOutput `pulumi:"accountsWithRestoreAccesses"` 60 // The username of the database within a snapshot. 61 AdminUsername pulumi.StringOutput `pulumi:"adminUsername"` 62 // The Amazon Resource Name (ARN) of the snapshot. 63 Arn pulumi.StringOutput `pulumi:"arn"` 64 // The unique identifier of the KMS key used to encrypt the snapshot. 65 KmsKeyId pulumi.StringOutput `pulumi:"kmsKeyId"` 66 // The Amazon Resource Name (ARN) of the namespace the snapshot was created from. 67 NamespaceArn pulumi.StringOutput `pulumi:"namespaceArn"` 68 // The namespace to create a snapshot for. 69 NamespaceName pulumi.StringOutput `pulumi:"namespaceName"` 70 // The owner Amazon Web Services; account of the snapshot. 71 OwnerAccount pulumi.StringOutput `pulumi:"ownerAccount"` 72 // How long to retain the created snapshot. Default value is `-1`. 73 RetentionPeriod pulumi.IntPtrOutput `pulumi:"retentionPeriod"` 74 // The name of the snapshot. 75 SnapshotName pulumi.StringOutput `pulumi:"snapshotName"` 76 } 77 78 // NewSnapshot registers a new resource with the given unique name, arguments, and options. 79 func NewSnapshot(ctx *pulumi.Context, 80 name string, args *SnapshotArgs, opts ...pulumi.ResourceOption) (*Snapshot, error) { 81 if args == nil { 82 return nil, errors.New("missing one or more required arguments") 83 } 84 85 if args.NamespaceName == nil { 86 return nil, errors.New("invalid value for required argument 'NamespaceName'") 87 } 88 if args.SnapshotName == nil { 89 return nil, errors.New("invalid value for required argument 'SnapshotName'") 90 } 91 opts = internal.PkgResourceDefaultOpts(opts) 92 var resource Snapshot 93 err := ctx.RegisterResource("aws:redshiftserverless/snapshot:Snapshot", name, args, &resource, opts...) 94 if err != nil { 95 return nil, err 96 } 97 return &resource, nil 98 } 99 100 // GetSnapshot gets an existing Snapshot resource's state with the given name, ID, and optional 101 // state properties that are used to uniquely qualify the lookup (nil if not required). 102 func GetSnapshot(ctx *pulumi.Context, 103 name string, id pulumi.IDInput, state *SnapshotState, opts ...pulumi.ResourceOption) (*Snapshot, error) { 104 var resource Snapshot 105 err := ctx.ReadResource("aws:redshiftserverless/snapshot:Snapshot", name, id, state, &resource, opts...) 106 if err != nil { 107 return nil, err 108 } 109 return &resource, nil 110 } 111 112 // Input properties used for looking up and filtering Snapshot resources. 113 type snapshotState struct { 114 // All of the Amazon Web Services accounts that have access to restore a snapshot to a provisioned cluster. 115 AccountsWithProvisionedRestoreAccesses []string `pulumi:"accountsWithProvisionedRestoreAccesses"` 116 // All of the Amazon Web Services accounts that have access to restore a snapshot to a namespace. 117 AccountsWithRestoreAccesses []string `pulumi:"accountsWithRestoreAccesses"` 118 // The username of the database within a snapshot. 119 AdminUsername *string `pulumi:"adminUsername"` 120 // The Amazon Resource Name (ARN) of the snapshot. 121 Arn *string `pulumi:"arn"` 122 // The unique identifier of the KMS key used to encrypt the snapshot. 123 KmsKeyId *string `pulumi:"kmsKeyId"` 124 // The Amazon Resource Name (ARN) of the namespace the snapshot was created from. 125 NamespaceArn *string `pulumi:"namespaceArn"` 126 // The namespace to create a snapshot for. 127 NamespaceName *string `pulumi:"namespaceName"` 128 // The owner Amazon Web Services; account of the snapshot. 129 OwnerAccount *string `pulumi:"ownerAccount"` 130 // How long to retain the created snapshot. Default value is `-1`. 131 RetentionPeriod *int `pulumi:"retentionPeriod"` 132 // The name of the snapshot. 133 SnapshotName *string `pulumi:"snapshotName"` 134 } 135 136 type SnapshotState struct { 137 // All of the Amazon Web Services accounts that have access to restore a snapshot to a provisioned cluster. 138 AccountsWithProvisionedRestoreAccesses pulumi.StringArrayInput 139 // All of the Amazon Web Services accounts that have access to restore a snapshot to a namespace. 140 AccountsWithRestoreAccesses pulumi.StringArrayInput 141 // The username of the database within a snapshot. 142 AdminUsername pulumi.StringPtrInput 143 // The Amazon Resource Name (ARN) of the snapshot. 144 Arn pulumi.StringPtrInput 145 // The unique identifier of the KMS key used to encrypt the snapshot. 146 KmsKeyId pulumi.StringPtrInput 147 // The Amazon Resource Name (ARN) of the namespace the snapshot was created from. 148 NamespaceArn pulumi.StringPtrInput 149 // The namespace to create a snapshot for. 150 NamespaceName pulumi.StringPtrInput 151 // The owner Amazon Web Services; account of the snapshot. 152 OwnerAccount pulumi.StringPtrInput 153 // How long to retain the created snapshot. Default value is `-1`. 154 RetentionPeriod pulumi.IntPtrInput 155 // The name of the snapshot. 156 SnapshotName pulumi.StringPtrInput 157 } 158 159 func (SnapshotState) ElementType() reflect.Type { 160 return reflect.TypeOf((*snapshotState)(nil)).Elem() 161 } 162 163 type snapshotArgs struct { 164 // The namespace to create a snapshot for. 165 NamespaceName string `pulumi:"namespaceName"` 166 // How long to retain the created snapshot. Default value is `-1`. 167 RetentionPeriod *int `pulumi:"retentionPeriod"` 168 // The name of the snapshot. 169 SnapshotName string `pulumi:"snapshotName"` 170 } 171 172 // The set of arguments for constructing a Snapshot resource. 173 type SnapshotArgs struct { 174 // The namespace to create a snapshot for. 175 NamespaceName pulumi.StringInput 176 // How long to retain the created snapshot. Default value is `-1`. 177 RetentionPeriod pulumi.IntPtrInput 178 // The name of the snapshot. 179 SnapshotName pulumi.StringInput 180 } 181 182 func (SnapshotArgs) ElementType() reflect.Type { 183 return reflect.TypeOf((*snapshotArgs)(nil)).Elem() 184 } 185 186 type SnapshotInput interface { 187 pulumi.Input 188 189 ToSnapshotOutput() SnapshotOutput 190 ToSnapshotOutputWithContext(ctx context.Context) SnapshotOutput 191 } 192 193 func (*Snapshot) ElementType() reflect.Type { 194 return reflect.TypeOf((**Snapshot)(nil)).Elem() 195 } 196 197 func (i *Snapshot) ToSnapshotOutput() SnapshotOutput { 198 return i.ToSnapshotOutputWithContext(context.Background()) 199 } 200 201 func (i *Snapshot) ToSnapshotOutputWithContext(ctx context.Context) SnapshotOutput { 202 return pulumi.ToOutputWithContext(ctx, i).(SnapshotOutput) 203 } 204 205 // SnapshotArrayInput is an input type that accepts SnapshotArray and SnapshotArrayOutput values. 206 // You can construct a concrete instance of `SnapshotArrayInput` via: 207 // 208 // SnapshotArray{ SnapshotArgs{...} } 209 type SnapshotArrayInput interface { 210 pulumi.Input 211 212 ToSnapshotArrayOutput() SnapshotArrayOutput 213 ToSnapshotArrayOutputWithContext(context.Context) SnapshotArrayOutput 214 } 215 216 type SnapshotArray []SnapshotInput 217 218 func (SnapshotArray) ElementType() reflect.Type { 219 return reflect.TypeOf((*[]*Snapshot)(nil)).Elem() 220 } 221 222 func (i SnapshotArray) ToSnapshotArrayOutput() SnapshotArrayOutput { 223 return i.ToSnapshotArrayOutputWithContext(context.Background()) 224 } 225 226 func (i SnapshotArray) ToSnapshotArrayOutputWithContext(ctx context.Context) SnapshotArrayOutput { 227 return pulumi.ToOutputWithContext(ctx, i).(SnapshotArrayOutput) 228 } 229 230 // SnapshotMapInput is an input type that accepts SnapshotMap and SnapshotMapOutput values. 231 // You can construct a concrete instance of `SnapshotMapInput` via: 232 // 233 // SnapshotMap{ "key": SnapshotArgs{...} } 234 type SnapshotMapInput interface { 235 pulumi.Input 236 237 ToSnapshotMapOutput() SnapshotMapOutput 238 ToSnapshotMapOutputWithContext(context.Context) SnapshotMapOutput 239 } 240 241 type SnapshotMap map[string]SnapshotInput 242 243 func (SnapshotMap) ElementType() reflect.Type { 244 return reflect.TypeOf((*map[string]*Snapshot)(nil)).Elem() 245 } 246 247 func (i SnapshotMap) ToSnapshotMapOutput() SnapshotMapOutput { 248 return i.ToSnapshotMapOutputWithContext(context.Background()) 249 } 250 251 func (i SnapshotMap) ToSnapshotMapOutputWithContext(ctx context.Context) SnapshotMapOutput { 252 return pulumi.ToOutputWithContext(ctx, i).(SnapshotMapOutput) 253 } 254 255 type SnapshotOutput struct{ *pulumi.OutputState } 256 257 func (SnapshotOutput) ElementType() reflect.Type { 258 return reflect.TypeOf((**Snapshot)(nil)).Elem() 259 } 260 261 func (o SnapshotOutput) ToSnapshotOutput() SnapshotOutput { 262 return o 263 } 264 265 func (o SnapshotOutput) ToSnapshotOutputWithContext(ctx context.Context) SnapshotOutput { 266 return o 267 } 268 269 // All of the Amazon Web Services accounts that have access to restore a snapshot to a provisioned cluster. 270 func (o SnapshotOutput) AccountsWithProvisionedRestoreAccesses() pulumi.StringArrayOutput { 271 return o.ApplyT(func(v *Snapshot) pulumi.StringArrayOutput { return v.AccountsWithProvisionedRestoreAccesses }).(pulumi.StringArrayOutput) 272 } 273 274 // All of the Amazon Web Services accounts that have access to restore a snapshot to a namespace. 275 func (o SnapshotOutput) AccountsWithRestoreAccesses() pulumi.StringArrayOutput { 276 return o.ApplyT(func(v *Snapshot) pulumi.StringArrayOutput { return v.AccountsWithRestoreAccesses }).(pulumi.StringArrayOutput) 277 } 278 279 // The username of the database within a snapshot. 280 func (o SnapshotOutput) AdminUsername() pulumi.StringOutput { 281 return o.ApplyT(func(v *Snapshot) pulumi.StringOutput { return v.AdminUsername }).(pulumi.StringOutput) 282 } 283 284 // The Amazon Resource Name (ARN) of the snapshot. 285 func (o SnapshotOutput) Arn() pulumi.StringOutput { 286 return o.ApplyT(func(v *Snapshot) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 287 } 288 289 // The unique identifier of the KMS key used to encrypt the snapshot. 290 func (o SnapshotOutput) KmsKeyId() pulumi.StringOutput { 291 return o.ApplyT(func(v *Snapshot) pulumi.StringOutput { return v.KmsKeyId }).(pulumi.StringOutput) 292 } 293 294 // The Amazon Resource Name (ARN) of the namespace the snapshot was created from. 295 func (o SnapshotOutput) NamespaceArn() pulumi.StringOutput { 296 return o.ApplyT(func(v *Snapshot) pulumi.StringOutput { return v.NamespaceArn }).(pulumi.StringOutput) 297 } 298 299 // The namespace to create a snapshot for. 300 func (o SnapshotOutput) NamespaceName() pulumi.StringOutput { 301 return o.ApplyT(func(v *Snapshot) pulumi.StringOutput { return v.NamespaceName }).(pulumi.StringOutput) 302 } 303 304 // The owner Amazon Web Services; account of the snapshot. 305 func (o SnapshotOutput) OwnerAccount() pulumi.StringOutput { 306 return o.ApplyT(func(v *Snapshot) pulumi.StringOutput { return v.OwnerAccount }).(pulumi.StringOutput) 307 } 308 309 // How long to retain the created snapshot. Default value is `-1`. 310 func (o SnapshotOutput) RetentionPeriod() pulumi.IntPtrOutput { 311 return o.ApplyT(func(v *Snapshot) pulumi.IntPtrOutput { return v.RetentionPeriod }).(pulumi.IntPtrOutput) 312 } 313 314 // The name of the snapshot. 315 func (o SnapshotOutput) SnapshotName() pulumi.StringOutput { 316 return o.ApplyT(func(v *Snapshot) pulumi.StringOutput { return v.SnapshotName }).(pulumi.StringOutput) 317 } 318 319 type SnapshotArrayOutput struct{ *pulumi.OutputState } 320 321 func (SnapshotArrayOutput) ElementType() reflect.Type { 322 return reflect.TypeOf((*[]*Snapshot)(nil)).Elem() 323 } 324 325 func (o SnapshotArrayOutput) ToSnapshotArrayOutput() SnapshotArrayOutput { 326 return o 327 } 328 329 func (o SnapshotArrayOutput) ToSnapshotArrayOutputWithContext(ctx context.Context) SnapshotArrayOutput { 330 return o 331 } 332 333 func (o SnapshotArrayOutput) Index(i pulumi.IntInput) SnapshotOutput { 334 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Snapshot { 335 return vs[0].([]*Snapshot)[vs[1].(int)] 336 }).(SnapshotOutput) 337 } 338 339 type SnapshotMapOutput struct{ *pulumi.OutputState } 340 341 func (SnapshotMapOutput) ElementType() reflect.Type { 342 return reflect.TypeOf((*map[string]*Snapshot)(nil)).Elem() 343 } 344 345 func (o SnapshotMapOutput) ToSnapshotMapOutput() SnapshotMapOutput { 346 return o 347 } 348 349 func (o SnapshotMapOutput) ToSnapshotMapOutputWithContext(ctx context.Context) SnapshotMapOutput { 350 return o 351 } 352 353 func (o SnapshotMapOutput) MapIndex(k pulumi.StringInput) SnapshotOutput { 354 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Snapshot { 355 return vs[0].(map[string]*Snapshot)[vs[1].(string)] 356 }).(SnapshotOutput) 357 } 358 359 func init() { 360 pulumi.RegisterInputType(reflect.TypeOf((*SnapshotInput)(nil)).Elem(), &Snapshot{}) 361 pulumi.RegisterInputType(reflect.TypeOf((*SnapshotArrayInput)(nil)).Elem(), SnapshotArray{}) 362 pulumi.RegisterInputType(reflect.TypeOf((*SnapshotMapInput)(nil)).Elem(), SnapshotMap{}) 363 pulumi.RegisterOutputType(SnapshotOutput{}) 364 pulumi.RegisterOutputType(SnapshotArrayOutput{}) 365 pulumi.RegisterOutputType(SnapshotMapOutput{}) 366 }